botsense  3.2.0
RoadNarrows Client-Server Proxied Services Framework
bsSerialMsgs.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File: bsSerialMsgs.h
4 //
5 /*!
6  * \file
7  *
8  * \brief BotSense bsProxy server - client raw serial NetMsgs XML Definition
9  *
10  * \warning This file was auto-generated on 2018.08.10 13:54:23 from the NetMsgs
11  * XML specification bsSerialMsgs.xml.
12  *
13  * \par Copyright:
14  * (C) 2018. RoadNarrows LLC
15  * (http://www.roadnarrows.com)
16  * All Rights Reserved
17  */
18 ///////////////////////////////////////////////////////////////////////////////
19 
20 
21 #ifndef _BSSERIALMSGS_H
22 #define _BSSERIALMSGS_H
23 
24 #include "rnr/rnrconfig.h"
25 #include "rnr/netmsgs.h"
26 
27 #include "botsense/BotSense.h"
28 
29 
30 C_DECLS_BEGIN
31 
32 /*!
33  * BsSerial Message Id Enumeration
34  */
35 typedef enum
36 {
37  BsSerialMsgIdNone = 0, ///< no message
38  BsSerialMsgIdReqOpenArgs = 1, ///< ReqOpenArgs
39  BsSerialMsgIdReqRead = 2, ///< ReqRead
40  BsSerialMsgIdReqTrans = 3, ///< ReqTrans
41  BsSerialMsgIdRspRead = 4, ///< RspRead
42  BsSerialMsgIdReqWrite = 5, ///< ReqWrite
43  BsSerialMsgIdRspWrite = 6, ///< RspWrite
44  BsSerialMsgIdNumOf = 7 ///< number of message ids
46 
47 
48 //-----------------------------------------------------------------------------
49 // Message Types
50 //-----------------------------------------------------------------------------
51 
52 
53 // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
54 // Message BsSerialReqOpenArgs Declarations
55 // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
56 
57 /*!
58  * Message ReqOpenArgs Structure
59  */
60 typedef struct
61 {
62  uint_t m_baudrate; ///< baudrate
63  byte_t m_bytesize; ///< bytesize
64  char m_parity; ///< parity
65  byte_t m_stopbits; ///< stopbits
66  bool_t m_rtscts; ///< rtscts
67  bool_t m_xonxoff; ///< xonxoff
68 } BsSerialReqOpenArgs_T; ///< ReqOpenArgs structure
69 
70 
71 // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
72 // Message BsSerialReqRead Declarations
73 // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
74 
75 /*!
76  * Message ReqRead Structure
77  */
78 typedef struct
79 {
80  byte_t m_readlen; ///< readlen
81 } BsSerialReqRead_T; ///< ReqRead structure
82 
83 
84 // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
85 // Message BsSerialReqTrans Declarations
86 // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
87 
88 /*! ReqTrans writebuf maximum vector length */
89 #define BSSERIAL_REQTRANS_WRITEBUF_LEN (NMFVAL_LEN_MAX_VECTOR)
90 
91 /*!
92  * Message ReqTrans Structure
93  */
94 typedef struct
95 {
96  struct
97  {
98  size_t m_count; ///< vector item count
99  union
100  {
101  void *m_pAlign; ///< force alignment
103  ///< the item vector
104  } u; ///< aligned vector items
105  } m_writebuf; ///< vector
106  byte_t m_readlen; ///< readlen
107 } BsSerialReqTrans_T; ///< ReqTrans structure
108 
109 
110 // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
111 // Message BsSerialRspRead Declarations
112 // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
113 
114 /*! RspRead readbuf maximum vector length */
115 #define BSSERIAL_RSPREAD_READBUF_LEN (NMFVAL_LEN_MAX_VECTOR)
116 
117 /*!
118  * Message RspRead Structure
119  */
120 typedef struct
121 {
122  struct
123  {
124  size_t m_count; ///< vector item count
125  union
126  {
127  void *m_pAlign; ///< force alignment
129  ///< the item vector
130  } u; ///< aligned vector items
131  } m_readbuf; ///< vector
132 } BsSerialRspRead_T; ///< RspRead structure
133 
134 
135 // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
136 // Message BsSerialReqWrite Declarations
137 // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
138 
139 /*! ReqWrite writebuf maximum vector length */
140 #define BSSERIAL_REQWRITE_WRITEBUF_LEN (NMFVAL_LEN_MAX_VECTOR)
141 
142 /*!
143  * Message ReqWrite Structure
144  */
145 typedef struct
146 {
147  struct
148  {
149  size_t m_count; ///< vector item count
150  union
151  {
152  void *m_pAlign; ///< force alignment
154  ///< the item vector
155  } u; ///< aligned vector items
156  } m_writebuf; ///< vector
157 } BsSerialReqWrite_T; ///< ReqWrite structure
158 
159 
160 // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
161 // Message BsSerialRspWrite Declarations
162 // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
163 
164 /*!
165  * Message RspWrite Structure
166  */
167 typedef struct
168 {
169  byte_t m_byteswritten; ///< byteswritten
170 } BsSerialRspWrite_T; ///< RspWrite structure
171 
172 
173 //-----------------------------------------------------------------------------
174 // External Data
175 //-----------------------------------------------------------------------------
176 
177 //
178 // BsSerial Message Definition Look-Up Table.
179 // (indexed by BsSerialMsgId_T enum)
180 //
181 extern const NMMsgDef_T *BsSerialMsgDefLookupTbl[];
182 
183 //
184 // BsSerial Maximum Message Body Length (bytes) Look-Up Table.
185 // (indexed by BsSerialMsgId_T enum)
186 //
187 extern size_t BsSerialMsgMaxLenLookupTbl[];
188 
189 
190 //-----------------------------------------------------------------------------
191 // Function Prototypes
192 //-----------------------------------------------------------------------------
193 
194 extern const NMMsgDef_T * BsSerialLookupMsgDef( BsSerialMsgId_T eMsgId );
195 
196 extern size_t BsSerialLookupMsgMaxLen( BsSerialMsgId_T eMsgId );
197 
198 extern int BsSerialPackMsg( BsSerialMsgId_T eMsgId,
199  void * pStruct,
200  byte_t buf[],
201  size_t bufSize,
202  bool_t bTrace );
203 
204 extern int BsSerialUnpackMsg( BsSerialMsgId_T eMsgId,
205  byte_t buf[],
206  size_t uMsgLen,
207  void * pStruct,
208  bool_t bTrace );
209 
210 /*!
211  * \brief Pack a BsSerialReqOpenArgs ITV message in big-endian byte order
212  * into the output buffer.
213  *
214  * \param [in] pStruct Pointer to the associated, populated message
215  * structure.
216  * \param [out] buf Output message buffer.
217  * \param bufSize Size of output buffer.
218  * \param bTrace Do [not] trace packing.
219  *
220  * \return
221  * On success, returns the number of bytes packed.
222  * On error, returns the appropriate \h_lt 0 negated NM_ECODE.
223  */
225  byte_t buf[],
226  size_t bufSize,
227  bool_t bTrace )
228 {
229  return BsSerialPackMsg(BsSerialMsgIdReqOpenArgs, pStruct, buf, bufSize, bTrace);
230 }
231 
232 /*!
233  * \brief Unpack a BsSerialReqOpenArgs ITV message in big-endian byte order
234  * from the input buffer.
235  *
236  * \param [in] buf Output message buffer.
237  * \param uMsgLen Length of message (bytes) in input buffer.
238  * \param [out] pStruct Pointer to the associated message structure.
239  * \param bTrace Do [not] trace packing.
240  *
241  * \return
242  * On success, returns the number of bytes unpacked.
243  * On error, returns the appropriate \h_lt 0 negated NM_ECODE.
244  */
245 INLINE_IN_H int BsSerialUnpackReqOpenArgs( byte_t buf[],
246  size_t uMsgLen,
247  BsSerialReqOpenArgs_T * pStruct,
248  bool_t bTrace )
249 {
250  return BsSerialUnpackMsg(BsSerialMsgIdReqOpenArgs, buf, uMsgLen, pStruct, bTrace);
251 }
252 
253 /*!
254  * \brief Pack a BsSerialReqRead ITV message in big-endian byte order
255  * into the output buffer.
256  *
257  * \param [in] pStruct Pointer to the associated, populated message
258  * structure.
259  * \param [out] buf Output message buffer.
260  * \param bufSize Size of output buffer.
261  * \param bTrace Do [not] trace packing.
262  *
263  * \return
264  * On success, returns the number of bytes packed.
265  * On error, returns the appropriate \h_lt 0 negated NM_ECODE.
266  */
267 INLINE_IN_H int BsSerialPackReqRead( BsSerialReqRead_T * pStruct,
268  byte_t buf[],
269  size_t bufSize,
270  bool_t bTrace )
271 {
272  return BsSerialPackMsg(BsSerialMsgIdReqRead, pStruct, buf, bufSize, bTrace);
273 }
274 
275 /*!
276  * \brief Unpack a BsSerialReqRead ITV message in big-endian byte order
277  * from the input buffer.
278  *
279  * \param [in] buf Output message buffer.
280  * \param uMsgLen Length of message (bytes) in input buffer.
281  * \param [out] pStruct Pointer to the associated message structure.
282  * \param bTrace Do [not] trace packing.
283  *
284  * \return
285  * On success, returns the number of bytes unpacked.
286  * On error, returns the appropriate \h_lt 0 negated NM_ECODE.
287  */
288 INLINE_IN_H int BsSerialUnpackReqRead( byte_t buf[],
289  size_t uMsgLen,
290  BsSerialReqRead_T * pStruct,
291  bool_t bTrace )
292 {
293  return BsSerialUnpackMsg(BsSerialMsgIdReqRead, buf, uMsgLen, pStruct, bTrace);
294 }
295 
296 /*!
297  * \brief Pack a BsSerialReqTrans ITV message in big-endian byte order
298  * into the output buffer.
299  *
300  * \param [in] pStruct Pointer to the associated, populated message
301  * structure.
302  * \param [out] buf Output message buffer.
303  * \param bufSize Size of output buffer.
304  * \param bTrace Do [not] trace packing.
305  *
306  * \return
307  * On success, returns the number of bytes packed.
308  * On error, returns the appropriate \h_lt 0 negated NM_ECODE.
309  */
310 INLINE_IN_H int BsSerialPackReqTrans( BsSerialReqTrans_T * pStruct,
311  byte_t buf[],
312  size_t bufSize,
313  bool_t bTrace )
314 {
315  return BsSerialPackMsg(BsSerialMsgIdReqTrans, pStruct, buf, bufSize, bTrace);
316 }
317 
318 /*!
319  * \brief Unpack a BsSerialReqTrans ITV message in big-endian byte order
320  * from the input buffer.
321  *
322  * \param [in] buf Output message buffer.
323  * \param uMsgLen Length of message (bytes) in input buffer.
324  * \param [out] pStruct Pointer to the associated message structure.
325  * \param bTrace Do [not] trace packing.
326  *
327  * \return
328  * On success, returns the number of bytes unpacked.
329  * On error, returns the appropriate \h_lt 0 negated NM_ECODE.
330  */
331 INLINE_IN_H int BsSerialUnpackReqTrans( byte_t buf[],
332  size_t uMsgLen,
333  BsSerialReqTrans_T * pStruct,
334  bool_t bTrace )
335 {
336  return BsSerialUnpackMsg(BsSerialMsgIdReqTrans, buf, uMsgLen, pStruct, bTrace);
337 }
338 
339 /*!
340  * \brief Pack a BsSerialRspRead ITV message in big-endian byte order
341  * into the output buffer.
342  *
343  * \param [in] pStruct Pointer to the associated, populated message
344  * structure.
345  * \param [out] buf Output message buffer.
346  * \param bufSize Size of output buffer.
347  * \param bTrace Do [not] trace packing.
348  *
349  * \return
350  * On success, returns the number of bytes packed.
351  * On error, returns the appropriate \h_lt 0 negated NM_ECODE.
352  */
353 INLINE_IN_H int BsSerialPackRspRead( BsSerialRspRead_T * pStruct,
354  byte_t buf[],
355  size_t bufSize,
356  bool_t bTrace )
357 {
358  return BsSerialPackMsg(BsSerialMsgIdRspRead, pStruct, buf, bufSize, bTrace);
359 }
360 
361 /*!
362  * \brief Unpack a BsSerialRspRead ITV message in big-endian byte order
363  * from the input buffer.
364  *
365  * \param [in] buf Output message buffer.
366  * \param uMsgLen Length of message (bytes) in input buffer.
367  * \param [out] pStruct Pointer to the associated message structure.
368  * \param bTrace Do [not] trace packing.
369  *
370  * \return
371  * On success, returns the number of bytes unpacked.
372  * On error, returns the appropriate \h_lt 0 negated NM_ECODE.
373  */
374 INLINE_IN_H int BsSerialUnpackRspRead( byte_t buf[],
375  size_t uMsgLen,
376  BsSerialRspRead_T * pStruct,
377  bool_t bTrace )
378 {
379  return BsSerialUnpackMsg(BsSerialMsgIdRspRead, buf, uMsgLen, pStruct, bTrace);
380 }
381 
382 /*!
383  * \brief Pack a BsSerialReqWrite ITV message in big-endian byte order
384  * into the output buffer.
385  *
386  * \param [in] pStruct Pointer to the associated, populated message
387  * structure.
388  * \param [out] buf Output message buffer.
389  * \param bufSize Size of output buffer.
390  * \param bTrace Do [not] trace packing.
391  *
392  * \return
393  * On success, returns the number of bytes packed.
394  * On error, returns the appropriate \h_lt 0 negated NM_ECODE.
395  */
396 INLINE_IN_H int BsSerialPackReqWrite( BsSerialReqWrite_T * pStruct,
397  byte_t buf[],
398  size_t bufSize,
399  bool_t bTrace )
400 {
401  return BsSerialPackMsg(BsSerialMsgIdReqWrite, pStruct, buf, bufSize, bTrace);
402 }
403 
404 /*!
405  * \brief Unpack a BsSerialReqWrite ITV message in big-endian byte order
406  * from the input buffer.
407  *
408  * \param [in] buf Output message buffer.
409  * \param uMsgLen Length of message (bytes) in input buffer.
410  * \param [out] pStruct Pointer to the associated message structure.
411  * \param bTrace Do [not] trace packing.
412  *
413  * \return
414  * On success, returns the number of bytes unpacked.
415  * On error, returns the appropriate \h_lt 0 negated NM_ECODE.
416  */
417 INLINE_IN_H int BsSerialUnpackReqWrite( byte_t buf[],
418  size_t uMsgLen,
419  BsSerialReqWrite_T * pStruct,
420  bool_t bTrace )
421 {
422  return BsSerialUnpackMsg(BsSerialMsgIdReqWrite, buf, uMsgLen, pStruct, bTrace);
423 }
424 
425 /*!
426  * \brief Pack a BsSerialRspWrite ITV message in big-endian byte order
427  * into the output buffer.
428  *
429  * \param [in] pStruct Pointer to the associated, populated message
430  * structure.
431  * \param [out] buf Output message buffer.
432  * \param bufSize Size of output buffer.
433  * \param bTrace Do [not] trace packing.
434  *
435  * \return
436  * On success, returns the number of bytes packed.
437  * On error, returns the appropriate \h_lt 0 negated NM_ECODE.
438  */
439 INLINE_IN_H int BsSerialPackRspWrite( BsSerialRspWrite_T * pStruct,
440  byte_t buf[],
441  size_t bufSize,
442  bool_t bTrace )
443 {
444  return BsSerialPackMsg(BsSerialMsgIdRspWrite, pStruct, buf, bufSize, bTrace);
445 }
446 
447 /*!
448  * \brief Unpack a BsSerialRspWrite ITV message in big-endian byte order
449  * from the input buffer.
450  *
451  * \param [in] buf Output message buffer.
452  * \param uMsgLen Length of message (bytes) in input buffer.
453  * \param [out] pStruct Pointer to the associated message structure.
454  * \param bTrace Do [not] trace packing.
455  *
456  * \return
457  * On success, returns the number of bytes unpacked.
458  * On error, returns the appropriate \h_lt 0 negated NM_ECODE.
459  */
460 INLINE_IN_H int BsSerialUnpackRspWrite( byte_t buf[],
461  size_t uMsgLen,
462  BsSerialRspWrite_T * pStruct,
463  bool_t bTrace )
464 {
465  return BsSerialUnpackMsg(BsSerialMsgIdRspWrite, buf, uMsgLen, pStruct, bTrace);
466 }
467 
468 
469 C_DECLS_END
470 
471 
472 #endif // _BSSERIALMSGS_H
INLINE_IN_H int BsSerialUnpackReqRead(byte_t buf[], size_t uMsgLen, BsSerialReqRead_T *pStruct, bool_t bTrace)
Unpack a BsSerialReqRead ITV message in big-endian byte order from the input buffer.
Definition: bsSerialMsgs.h:288
size_t BsSerialLookupMsgMaxLen(BsSerialMsgId_T eMsgId)
Look up the message maximum length associated with the message id.
Definition: bsSerialMsgs.c:488
bool_t m_xonxoff
xonxoff
Definition: bsSerialMsgs.h:67
byte_t m_readlen
readlen
Definition: bsSerialMsgs.h:80
INLINE_IN_H int BsSerialPackReqOpenArgs(BsSerialReqOpenArgs_T *pStruct, byte_t buf[], size_t bufSize, bool_t bTrace)
Pack a BsSerialReqOpenArgs ITV message in big-endian byte order into the output buffer.
Definition: bsSerialMsgs.h:224
bool_t m_rtscts
rtscts
Definition: bsSerialMsgs.h:66
const NMMsgDef_T * BsSerialMsgDefLookupTbl[]
Definition: bsSerialMsgs.c:423
char m_parity
parity
Definition: bsSerialMsgs.h:64
INLINE_IN_H int BsSerialPackRspRead(BsSerialRspRead_T *pStruct, byte_t buf[], size_t bufSize, bool_t bTrace)
Pack a BsSerialRspRead ITV message in big-endian byte order into the output buffer.
Definition: bsSerialMsgs.h:353
INLINE_IN_H int BsSerialUnpackRspRead(byte_t buf[], size_t uMsgLen, BsSerialRspRead_T *pStruct, bool_t bTrace)
Unpack a BsSerialRspRead ITV message in big-endian byte order from the input buffer.
Definition: bsSerialMsgs.h:374
size_t m_count
vector item count
Definition: bsSerialMsgs.h:124
BsSerialMsgId_T
Definition: bsSerialMsgs.h:35
byte_t m_bytesize
bytesize
Definition: bsSerialMsgs.h:63
uint_t m_baudrate
baudrate
Definition: bsSerialMsgs.h:62
void * m_pAlign
force alignment
Definition: bsSerialMsgs.h:152
byte_t m_readlen
readlen
Definition: bsSerialMsgs.h:106
void * m_pAlign
force alignment
Definition: bsSerialMsgs.h:101
INLINE_IN_H int BsSerialPackReqWrite(BsSerialReqWrite_T *pStruct, byte_t buf[], size_t bufSize, bool_t bTrace)
Pack a BsSerialReqWrite ITV message in big-endian byte order into the output buffer.
Definition: bsSerialMsgs.h:396
#define BSSERIAL_REQTRANS_WRITEBUF_LEN
Definition: bsSerialMsgs.h:89
INLINE_IN_H int BsSerialUnpackReqWrite(byte_t buf[], size_t uMsgLen, BsSerialReqWrite_T *pStruct, bool_t bTrace)
Unpack a BsSerialReqWrite ITV message in big-endian byte order from the input buffer.
Definition: bsSerialMsgs.h:417
INLINE_IN_H int BsSerialPackReqRead(BsSerialReqRead_T *pStruct, byte_t buf[], size_t bufSize, bool_t bTrace)
Pack a BsSerialReqRead ITV message in big-endian byte order into the output buffer.
Definition: bsSerialMsgs.h:267
int BsSerialPackMsg(BsSerialMsgId_T eMsgId, void *pStruct, byte_t buf[], size_t bufSize, bool_t bTrace)
Pack a ITV message in big-endian byte order.
Definition: bsSerialMsgs.c:514
INLINE_IN_H int BsSerialUnpackRspWrite(byte_t buf[], size_t uMsgLen, BsSerialRspWrite_T *pStruct, bool_t bTrace)
Unpack a BsSerialRspWrite ITV message in big-endian byte order from the input buffer.
Definition: bsSerialMsgs.h:460
#define BSSERIAL_REQWRITE_WRITEBUF_LEN
Definition: bsSerialMsgs.h:140
INLINE_IN_H int BsSerialPackReqTrans(BsSerialReqTrans_T *pStruct, byte_t buf[], size_t bufSize, bool_t bTrace)
Pack a BsSerialReqTrans ITV message in big-endian byte order into the output buffer.
Definition: bsSerialMsgs.h:310
no message
Definition: bsSerialMsgs.h:37
size_t m_count
vector item count
Definition: bsSerialMsgs.h:98
INLINE_IN_H int BsSerialUnpackReqOpenArgs(byte_t buf[], size_t uMsgLen, BsSerialReqOpenArgs_T *pStruct, bool_t bTrace)
Unpack a BsSerialReqOpenArgs ITV message in big-endian byte order from the input buffer.
Definition: bsSerialMsgs.h:245
size_t m_count
vector item count
Definition: bsSerialMsgs.h:149
byte_t m_stopbits
stopbits
Definition: bsSerialMsgs.h:65
byte_t m_byteswritten
byteswritten
Definition: bsSerialMsgs.h:169
INLINE_IN_H int BsSerialUnpackReqTrans(byte_t buf[], size_t uMsgLen, BsSerialReqTrans_T *pStruct, bool_t bTrace)
Unpack a BsSerialReqTrans ITV message in big-endian byte order from the input buffer.
Definition: bsSerialMsgs.h:331
void * m_pAlign
force alignment
Definition: bsSerialMsgs.h:127
size_t BsSerialMsgMaxLenLookupTbl[]
Definition: bsSerialMsgs.c:438
INLINE_IN_H int BsSerialPackRspWrite(BsSerialRspWrite_T *pStruct, byte_t buf[], size_t bufSize, bool_t bTrace)
Pack a BsSerialRspWrite ITV message in big-endian byte order into the output buffer.
Definition: bsSerialMsgs.h:439
int BsSerialUnpackMsg(BsSerialMsgId_T eMsgId, byte_t buf[], size_t uMsgLen, void *pStruct, bool_t bTrace)
Unpack a ITV message in big-endian byte order.
Definition: bsSerialMsgs.c:552
<b><i>BotSense</i></b> package top-level, unifying header declarations.
const NMMsgDef_T * BsSerialLookupMsgDef(BsSerialMsgId_T eMsgId)
Look up the message definition associated with the message id.
Definition: bsSerialMsgs.c:464
number of message ids
Definition: bsSerialMsgs.h:44
#define BSSERIAL_RSPREAD_READBUF_LEN
Definition: bsSerialMsgs.h:115