botsense  3.2.0
RoadNarrows Client-Server Proxied Services Framework
bsSerial.doxy
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // Package: BotSense
4 //
5 // File: bsSerial.doxy
6 //
7 // Description:
8 // This file contains the doxygen directives to document the BotSense Standard
9 // R2-232 Serial Module. This module comes standard with the BotSense package.
10 //
11 ////////////////////////////////////////////////////////////////////////////////
12 
13 /*! \file */
14 
15 /* ---------------------------------------------------------------------------
16  * Serial
17  * --------------------------------------------------------------------------*/
18 
19 /*!
20  * \ingroup bsmod
21  * \defgroup bsmod_serial Serial
22  *
23  * BotSense standanrd raw RS-232 serial module.
24  *
25  * \section bsmod_intro Introduction
26  * The client side C/C++ interfaces are provided by the header file
27  * \ref include/botsense/bsSerial.h "botsense/bsSerial.h" in conjunction with
28  * the libraries libbsclient_serial.a or libbsclient_serial.so.
29  * For python clients, the python module
30  * \ref bsPython/modules/BotSense/bsSerial.py "BotSense.bsSerial"
31  * provides wrapper functions for the C libraries.
32  *
33  * The server side \ref man_bsproxy "bsProxy" plug-in is the Dynamic Link
34  * Library (DLL) libbsserver_serial.so.
35  *
36  * \par Source Subdirectory:
37  * bsModules/bsSerial
38  * \{
39  */
40 
41 /*! \} */ /* end bsmod_serial */
42 
43 
44 /* ---------------------------------------------------------------------------
45  * Serial Client
46  * --------------------------------------------------------------------------*/
47 
48 /*!
49  * \ingroup bsmod_serial
50  * \defgroup bsmod_serial_cli Client Interfaces
51  *
52  * The BotSense standard serial client side interfaces provide APIs for C/C++
53  * and python applications.
54  *
55  * \{
56  */
57 
58 /*! \} */ /* end bsmod_serial_cli */
59 
60 /*!
61  * \ingroup bsmod_serial_cli
62  * \defgroup man_libbsclient_serial libbsclient_serial Man Pages
63  *
64  * The libbsclient_serial library provides the functional API between
65  * client applications on one side and request-response messages to/from
66  * the \ref man_bsproxy "bsProxy" server on the other side.
67  * The \ref man_libbotsense "libbotsense" client library mediates the
68  * client-server session.
69  *
70  * \{
71  */
72 
73 /*!
74 \ingroup man_libbsclient_serial
75 \defgroup man_bsSerialGetMsgName bsSerialGetMsgName
76 \par Synopsis:
77 <tt>
78 \#include "rnr/rnrconfig.h"\n
79 \#include "botsense/BotSense.h"\n
80 \#include "botsense/libBotSense.h"\n
81 \#include "botsense/bsSerial.h"\n\n
82 const char * \ref bsSerialGetMsgName(\ref BsClient_P pClient,
83  \ref BsVConnHnd_T hndVConn,
84  uint_t uMsgId);
85 </tt>
86 
87 <b>Description:</b>\n
88 \copydoc bsSerialGetMsgName
89  */
90 
91 /*!
92 \ingroup man_libbsclient_serial
93 \defgroup man_bsSerialReqClose bsSerialReqClose
94 \par Synopsis:
95 <tt>
96 \#include "rnr/rnrconfig.h"\n
97 \#include "botsense/BotSense.h"\n
98 \#include "botsense/libBotSense.h"\n
99 \#include "botsense/bsSerial.h"\n\n
100 int \ref bsSerialReqClose(\ref BsClient_P pClient,
101  \ref BsVConnHnd_T hndVConn);
102 </tt>
103 
104 <b>Description:</b>\n
105 \copydoc bsSerialReqClose
106  */
107 
108 /*!
109 \ingroup man_libbsclient_serial
110 \defgroup man_bsSerialReqOpen bsSerialReqOpen
111 \par Synopsis:
112 <tt>
113 \#include "rnr/rnrconfig.h"\n
114 \#include "botsense/BotSense.h"\n
115 \#include "botsense/libBotSense.h"\n
116 \#include "botsense/bsSerial.h"\n\n
117 int \ref bsSerialReqOpen(\ref BsClient_P pClient,
118  const char *sDevName,
119  int nBaudRate,
120  int nByteSize,
121  int cParity,
122  int nStopBits,
123  bool_t bRtsCts,
124  bool_t bXonXoff,
125  bool_t bInitTrace);
126 </tt>
127 
128 <b>Description:</b>\n
129 \copydoc bsSerialReqOpen
130  */
131 
132 /*!
133 \ingroup man_libbsclient_serial
134 \defgroup man_bsSerialReqRead bsSerialReqRead
135 \par Synopsis:
136 <tt>
137 \#include "rnr/rnrconfig.h"\n
138 \#include "botsense/BotSense.h"\n
139 \#include "botsense/libBotSense.h"\n
140 \#include "botsense/bsSerial.h"\n\n
141 int \ref bsSerialReqRead(\ref BsClient_P pClient,
142  \ref BsVConnHnd_T hndVConn,
143  size_t uReadLen,
144  byte_t rbuf[]);
145 </tt>
146 
147 <b>Description:</b>\n
148 \copydoc bsSerialReqRead
149  */
150 
151 /*!
152 \ingroup man_libbsclient_serial
153 \defgroup man_bsSerialReqTrans bsSerialReqTrans
154 \par Synopsis:
155 <tt>
156 \#include "rnr/rnrconfig.h"\n
157 \#include "botsense/BotSense.h"\n
158 \#include "botsense/libBotSense.h"\n
159 \#include "botsense/bsSerial.h"\n\n
160 int \ref bsSerialReqTrans(\ref BsClient_P pClient,
161  \ref BsVConnHnd_T hndVConn,
162  byte_t wbuf[],
163  size_t uWriteLen,
164  size_t uReadLen,
165  byte_t rbuf[]);
166 </tt>
167 
168 <b>Description:</b>\n
169 \copydoc bsSerialReqTrans
170  */
171 
172 /*!
173 \ingroup man_libbsclient_serial
174 \defgroup man_bsSerialReqWrite bsSerialReqWrite
175 \par Synopsis:
176 <tt>
177 \#include "rnr/rnrconfig.h"\n
178 \#include "botsense/BotSense.h"\n
179 \#include "botsense/libBotSense.h"\n
180 \#include "botsense/bsSerial.h"\n\n
181 int \ref bsSerialReqWrite(\ref BsClient_P pClient,
182  \ref BsVConnHnd_T hndVConn,
183  byte_t wbuf[],
184  size_t uWriteLen);
185 </tt>
186 
187 <b>Description:</b>\n
188 \copydoc bsSerialReqWrite
189  */
190 
191 /*! \} */ /* end bsmod_libbsclient_serial */
192 
193 
194 /*!
195  * \ingroup bsmod_serial_cli
196  * \defgroup bsSerial_py BotSense.bsSerial Python Module
197  *
198  * \{
199 The bsSerial module under the BotSense python package provides python
200 applications an interface to communicate with proxied serial devices.
201 The underlining compiled extension module _bsSerial.so library provides the
202 provides the shim between python calling conventions and the C
203 libbsclient_serial.[a,so] library.
204 
205 \sa \ref BotSense.bsSerial
206 
207 \par Example:
208 \code
209 #
210 # Example use of BotSense.bsSerial Module
211 #
212 
213 import sys
214 
215 import BotSense.BotSenseTypes as bsTypes
216 import BotSense.BotSenseError as bsError
217 import BotSense.BotSenseServer as bsServer
218 import BotSense.bsSerial as bsSerial
219 
220 # create a BotSense client
221 cli = bsTypes.BsClient('myserial')
222 
223 # connect to the bsProxy server at the given IP address and default port
224 try:
225  bsServer.ServerConnect(cli, serverHostName="192.168.0.34")
226 except bsError.BotSenseError, inst:
227  print inst
228  sys.exit(8)
229 
230 # open a virtual connection to a proxied serial device
231 try:
232  hndVConn = bsSerial.SerialReqOpen(cli, "/dev/ttyUSB0", baudRate=115200)
233 except bsError.BotSenseError, inst:
234  print inst
235  sys.exit(8)
236 print "Example: established virtual connection %d" % (hndVConn)
237 
238 # write some data
239 try:
240  n = bsSerial.SerialReqWrite(cli, hndVConn, "hello dude\n")
241 except bsError.BotSenseError, inst:
242  print inst
243  sys.exit(8)
244 print "Example: %d bytes written" % (n)
245 
246 # close the virtual connection
247 try:
248  bsSerial.SerialReqClose(cli, hndVConn)
249 except bsError.BotSenseError, inst:
250  print inst
251  sys.exit(8)
252 
253 # close the connection to the bsProxy server
254 try:
255  bsServer.ServerDisconnect(cli)
256 except bsError.BotSenseError, inst:
257  print inst
258  sys.exit(8)
259 
260 # delete the client
261 del cli
262 
263 \endcode
264  */
265 
266 /*! \} */ /* end bsSerial_py */
267 
268 
269 /* ---------------------------------------------------------------------------
270  * Serial Server
271  * --------------------------------------------------------------------------*/
272 
273 /*!
274  * \ingroup bsmod_serial
275  * \defgroup bsmod_serial_srv Server Plug-In
276  *
277  * BotSense \ref man_bsproxy "bsProxy" server plug-in DLL for proxied raw
278  * RS-232 serial devices.
279  *
280  * See \ref bsModules/bsSerial/bsSerialServer.c
281  *
282  * \{
283  */
284 
285 /*! \} */ /* end bsmod_serial_srv */
286 
287 /*!
288  * \ingroup bsmod_serial_srv
289  * \defgroup bsmod_serial_srv_cfg Serial Configuration
290  *
291  * The serial plug-in XML configuration will be supported in BotSense v3.1.0.
292  * \{
293  */
294 
295 /*! \} */ /* end bsmod_serial_srv_cfg */
296 
297 
298 /* ---------------------------------------------------------------------------
299  * Serial XML
300  * --------------------------------------------------------------------------*/
301 
302 /*!
303  * \ingroup bsmod_serial
304  * \defgroup bsmod_serial_xml XML Message Set
305 
306 The bsSerialMsgs.xml specification defines the set of messages
307 for BotSense virtual connections exstablished
308 between BotSense
309 clients and raw RS-232 serial devices proxied by
310 the \ref bsserver "bsProxy" server.
311 
312 The serial messages are terminated between the BotSense client
313 libbsclient_serial.so shared library or libbsclient_serial.a static library
314 and the bsProxy plug-in libbsserver_serial.so interface module DLL.
315 
316 The message encoding is 8-bit Id-Type-Value (itv). All message fields are
317 packed in big-endian order.
318 
319 \include bsModules/bsSerial/bsSerialMsgs.xml
320 
321  */