XORDE  v1.0
eXtensible Operational Robotic Development Environment
ONBCommon.h
1 #ifndef ONBCOMMON_H
2 #define ONBCOMMON_H
3 
4 #include <QString>
5 
6 #define STRING_ID
7 
8 #pragma pack(push,1)
9 
11 typedef enum
12 {
13  aidPropagationUp = 0x40,
14  aidPropagationDown = 0x80,
15  aidPollNodes = 0x00,
16  aidConnReset = 0x01,
17 // aidEnumerate = 0x02, //!< построение карты сети
18  aidPollClasses = 0x03,
19 
20  aidUpgradeStart = 0x30,
21  aidUpgradeConfirm = 0x31,
22  aidUpgradeEnd = 0x32,
23  aidUpgradeSetPage = 0x33,
24  aidUpgradeData = 0x34,
25  aidUpgradeAddress = 0x35,
26  aidUpgradeProbe = 0x36,
27  aidUpgradeRepeat = 0x38,
28  aidUpgradePageDone = 0x39,
29  aidUpgradeAccepted = 0x3A,
30  aidUpgradeReady = 0x3B,
31 } StdAID;
32 
34 typedef enum
35 {
36  svcClass = 0x00,
37  svcName = 0x01,
38  svcFullName = 0x02,
39  svcSerial = 0x03,
40  svcVersion = 0x04,
41  svcBuildDate = 0x05,
42  svcCpuInfo = 0x06,
43  svcBurnCount = 0x07,
44  svcObjectCount = 0x08,
45  svcBusType = 0x09,
46  svcBusAddress = 0x0A,
47  svcClassName = 0x0B,
48  svcIcon = 0x0C,
49 
50  svcObjectInfo = 0x80,
51  svcObjectMinimum = 0x81,
52  svcObjectMaximum = 0x82,
53  svcObjectDefault = 0x83,
54  svcObjectStep = 0x84,
55  svcObjectMimeType = 0x85,
56  svcObjectHint = 0x86,
57  svcObjectUnit = 0x87,
58  svcObjectOptions = 0x88,
59  svcObjectExtInfo = 0x89,
60  svcObjectEnum = 0x8A,
61 
62  svcTimedObject = 0x90,
63  svcGroupedObject = 0xA0,
64 
65  svcCreate = 0xC0,
66 
67  svcMessage = 0xDB,
68 
69  svcUnsubscribe = 0xEA,
70  svcSubscribe = 0xFA,
71 
72  svcEcho = 0xF0,
73  svcHello = 0xF1,
74  svcWelcome = 0xF2,
75  svcWelcomeAgain = 0xF3,
76  svcConnected = 0xF4,
77  svcDisconnected = 0xF5,
78  svcKill = 0xF6,
79  svcRequestAllInfo = 0xF8,
80  svcRequestObjInfo = 0xF9,
81  svcAutoRequest = 0xFA,
82  svcTimedRequest = 0xFB,
83  svcGroupedRequest = 0xFC,
84  svcUpgradeRequest = 0xFE,
85  svcFail = 0xFF,
86 } SvcOID;
87 
88 typedef enum
89 {
90  BusUnknown = 0,
91  BusCan = 1,
92  BusUsbHid = 2,
93  BusWifi = 3,
94  BusSwonb = 4,
95  BusVirtual = 5,
96  BusRadio = 6,
97  BusWebSocket= 7,
98 } BusType;
99 
100 //typedef enum
101 //{
102 // netAddrUniversal = 0x7F,
103 // netAddrInvalid = 0xFF
104 //} NetAddress;
105 
107 //struct LocalMsgId
108 //{
109 // unsigned char oid; //!< object ID
110 // unsigned char sender: 7; //!< sender network address (logical)
111 // unsigned char frag: 1; //!< message is fragmented
112 // unsigned char addr: 7; //!< receiver network address (logical)
113 // unsigned char svc: 1; //!< message is service
114 // unsigned char mac: 4; //!< receiver bus address (physical)
115 // const unsigned char local: 1; //!< local area message (inside the bus) = 1
116 // unsigned char _not_used: 3; //!< reserved bits in CAN 2.0B spec
117 // /*! Конструктор обнуляет. */
118 // LocalMsgId() :
119 // oid(0), sender(0), frag(0), addr(0), svc(0), mac(0), local(1), _not_used(0)
120 // {
121 // }
122 // /*! Неявный конструктор. */
123 // LocalMsgId(const unsigned long &data) :
124 // local(1), _not_used(0)
125 // {
126 // *reinterpret_cast<unsigned long*>(this) = data;
127 // }
128 // /*! Приведение типа к unsigned long */
129 // operator unsigned long&() {return *reinterpret_cast<unsigned long*>(this);}
130 // /*! Приведение типа из unsigned long */
131 // void operator =(const unsigned long &data) {*reinterpret_cast<unsigned long*>(this) = data;}
132 //};
133 
135 //struct GlobalMsgId
136 //{
137 // unsigned char aid; //!< action ID
138 // unsigned char res; //!< reserved
139 // unsigned char addr: 7; //!< own network address (logical)
140 // unsigned char svc: 1; //!< message is service
141 // unsigned char mac: 4; //!< own bus address (physical)
142 // unsigned char local: 1; //!< local area message (inside the bus) = 0
143 // unsigned char _not_used: 3; //!< reserved bits in CAN 2.0B spec
144 // /*! Конструктор обнуляет. */
145 // GlobalMsgId() :
146 // aid(0), res(0), addr(0), svc(0), mac(0), local(0), _not_used(0)
147 // {
148 // }
149 // /*! Неявный конструктор. */
150 // GlobalMsgId(const unsigned long &data) :
151 // local(0), _not_used(0)
152 // {
153 // *reinterpret_cast<unsigned long*>(this) = data;
154 // }
155 // /*! Приведение типа к unsigned long */
156 // operator unsigned long&() {return *reinterpret_cast<unsigned long*>(this);}
157 // /*! Приведение типа из unsigned long */
158 // void operator =(const unsigned long &data) {*reinterpret_cast<unsigned long*>(this) = data;}
159 //};
160 
162 struct ONBHeader
163 {
164  unsigned char objectID;
165  unsigned short componentID;
166  unsigned char _not_used: 4;
167  unsigned char local: 1;
168  unsigned char classInfo: 1;
169  unsigned char svc: 1;
170  unsigned char headerFlag: 1;
171 
174  {
175  *reinterpret_cast<unsigned long*>(this) = 0x80000000; // headerFlag = 1
176  }
178  ONBHeader(const unsigned long &data)
179  {
180  *reinterpret_cast<unsigned long*>(this) = data;
181  _not_used = 0;
182  headerFlag = 1;
183  }
185  operator unsigned long&() {return *reinterpret_cast<unsigned long*>(this);}
187  void operator =(const unsigned long &data) {*reinterpret_cast<unsigned long*>(this) = data;}
188 
189 };
190 
191 #pragma pack(pop)
192 
193 #endif // ONBCOMMON_H
unsigned char headerFlag
message is ONBPacket
Definition: ONBCommon.h:170
Конструктор обнуляет.
Definition: ONBCommon.h:162
unsigned char objectID
unique ID of the object (0...255)
Definition: ONBCommon.h:164
void operator=(const unsigned long &data)
Приведение типа из unsigned long.
Definition: ONBCommon.h:187
unsigned short componentID
unique ID of the component aka address, 0 is reserved for current module
Definition: ONBCommon.h:165
unsigned char classInfo
message contains classID and info for it
Definition: ONBCommon.h:168
ONBHeader()
Конструктор обнуляет.
Definition: ONBCommon.h:173
unsigned char svc
flag of service message
Definition: ONBCommon.h:169
unsigned char local
set to 0 for message broadcasting
Definition: ONBCommon.h:167
ONBHeader(const unsigned long &data)
Неявный конструктор.
Definition: ONBCommon.h:178
unsigned char _not_used
reserved for the future
Definition: ONBCommon.h:166