Open Lighting Architecture 0.10.9
Loading...
Searching...
No Matches
ShowNetPackets.h
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU Library General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
15 *
16 * ShowNetPackets.h
17 * Datagram definitions for the ShowNet protocol.
18 * Copyright (C) 2005 Simon Newton
19 */
20
21#ifndef PLUGINS_SHOWNET_SHOWNETPACKETS_H_
22#define PLUGINS_SHOWNET_SHOWNETPACKETS_H_
23
30#include "ola/Constants.h"
33
34namespace ola {
35namespace plugin {
36namespace shownet {
37
38enum { SHOWNET_MAC_LENGTH = ola::network::MACAddress::LENGTH };
39enum { SHOWNET_NAME_LENGTH = 9 };
40enum { SHOWNET_SPARE_LENGTH = 22 };
41
42// Assume this is 512.
43enum { SHOWNET_DMX_DATA_LENGTH = DMX_UNIVERSE_SIZE };
44
45enum { SHOWNET_COMPRESSED_DATA_LENGTH = 1269 };
46
47enum ShowNetPacketType {
48 DMX_PACKET = 0x202f,
49 COMPRESSED_DMX_PACKET = 0x808f,
50};
51
52// The old style Shownet DMX packet. Type 0x202f . Apparently this isn't used
53// much.
54PACK(
55struct shownet_dmx_s {
56 uint16_t port;
57 uint16_t slot_length;
58 uint16_t pool_size;
59 uint16_t h_slot;
60 uint32_t sequence;
61 uint8_t priority; // 0 = not used
62 uint8_t universe; // 0 = not used
63 uint16_t spare[SHOWNET_SPARE_LENGTH];
64 uint8_t dmx_data[SHOWNET_DMX_DATA_LENGTH];
65});
66
67typedef struct shownet_dmx_s shownet_dmx;
68
69// The 'new' style, compressed shownet packet. Type 0x808f
70// Each packet can contain up to 4 'blocks' of DMX data.
71PACK(
72struct shownet_compressed_dmx_s {
73 uint16_t netSlot[4]; // start channel of each slot (hSlot)
74 uint16_t slotSize[4]; // size of each slot
75 uint16_t indexBlock[5]; // index into data of each slot
76 uint16_t sequence; // not used in n21+ code.
77 uint8_t priority; // not used in n21+ code, 0 = not used
78 uint8_t universe; // not used in n21+ code, 0 = not used
79 uint8_t pass[2]; // something to do with the channels that have
80 // passwords. PasswordNumChans ?
81 char name[SHOWNET_NAME_LENGTH]; // name of console
82 uint8_t data[SHOWNET_COMPRESSED_DATA_LENGTH]; // RLE data.
83});
84
85typedef struct shownet_compressed_dmx_s shownet_compressed_dmx;
86
87// The union of all packets.
88typedef struct {
89 uint16_t type; // packet type
90 uint8_t ip[ola::network::IPV4Address::LENGTH]; // ip of sender
91 union {
92 shownet_dmx dmx;
93 shownet_compressed_dmx compressed_dmx;
94 } data;
96
97} // namespace shownet
98} // namespace plugin
99} // namespace ola
100#endif // PLUGINS_SHOWNET_SHOWNETPACKETS_H_
Constants used throughout OLA.
Represents an IPv4 Address.
Represents a MAC Address.
#define PACK(__Declaration__)
Pack structures.
Definition Macro.h:171
The namespace containing all OLA symbols.
Definition Credentials.cpp:44
@ DMX_UNIVERSE_SIZE
Definition Constants.h:36
Definition ShowNetPackets.h:88