botsense  3.2.0
RoadNarrows Client-Server Proxied Services Framework
bsSerial.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // Package: BotSense
4 //
5 // File: bsSerial.h
6 //
7 /*! \file
8  *
9  * $LastChangedDate: 2010-08-20 11:36:38 -0600 (Fri, 20 Aug 2010) $
10  * $Rev: 568 $
11  *
12  * \brief \h_botsense bsProxy client library RS-232 serial interface.
13  *
14  * \todo Add bsSerialReqFlushInput() function.
15  * \todo Add bsSerialReqIoctl() function.
16  * \todo Add bsSerialReqReadLine() function.
17  * \todo Add bsSerialReqWriteLine() function.
18  *
19  * \author Robin Knight (robin.knight@roadnarrows.com)
20  *
21  * \copyright
22  * \h_copy 2010-2017. RoadNarrows LLC.\n
23  * http://www.roadnarrows.com\n
24  * All Rights Reserved
25  */
26 // Permission is hereby granted, without written agreement and without
27 // license or royalty fees, to use, copy, modify, and distribute this
28 // software and its documentation for any purpose, provided that
29 // (1) The above copyright notice and the following two paragraphs
30 // appear in all copies of the source code and (2) redistributions
31 // including binaries reproduces these notices in the supporting
32 // documentation. Substantial modifications to this software may be
33 // copyrighted by their authors and need not follow the licensing terms
34 // described here, provided that the new terms are clearly indicated in
35 // all files where they apply.
36 //
37 // IN NO EVENT SHALL THE AUTHOR, ROADNARROWS LLC, OR ANY MEMBERS/EMPLOYEES
38 // OF ROADNARROW LLC OR DISTRIBUTORS OF THIS SOFTWARE BE LIABLE TO ANY
39 // PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
40 // DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION,
41 // EVEN IF THE AUTHORS OR ANY OF THE ABOVE PARTIES HAVE BEEN ADVISED OF
42 // THE POSSIBILITY OF SUCH DAMAGE.
43 //
44 // THE AUTHOR AND ROADNARROWS LLC SPECIFICALLY DISCLAIM ANY WARRANTIES,
45 // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
46 // FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN
47 // "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO
48 // PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
49 //
50 ////////////////////////////////////////////////////////////////////////////////
51 
52 #ifndef _BSSERIAL_H
53 #define _BSSERIAL_H
54 
55 #include "rnr/rnrconfig.h"
56 
57 #include "botsense/BotSense.h"
58 #include "botsense/libBotSense.h"
59 
60 #if defined(__windows__) || defined(__cygwin__)
61  #define BS_SER_DEV_NAME_DFT "/dev/com0" ///< default serial device
62 #else // linux or osx
63  #define BS_SER_DEV_NAME_DFT "/dev/ttyS0" ///< default serial device
64 #endif
65 
66 #define BS_SER_SERVER_MOD "libbsserver_serial" ///< server plugin dll module
67 #define BS_SER_CLIENT_LIB "libbsclient_serial" ///< client app library
68 
69 
70 extern const char *bsSerialGetMsgName(BsClient_P pClient,
71  BsVConnHnd_T hndVConn,
72  uint_t uMsgId);
73 
74 extern int bsSerialReqOpen(BsClient_P pClient,
75  const char *sDevName,
76  int nBaudRate,
77  int nByteSize,
78  int cParity,
79  int nStopBits,
80  bool_t bRtsCts,
81  bool_t bXonXoff,
82  bool_t bInitTrace);
83 
84 extern int bsSerialReqClose(BsClient_P pClient, BsVConnHnd_T hndVConn);
85 
86 extern int bsSerialReqRead(BsClient_P pClient,
87  BsVConnHnd_T hndVConn,
88  size_t uReadLen,
89  byte_t rbuf[]);
90 
91 extern int bsSerialReqWrite(BsClient_P pClient,
92  BsVConnHnd_T hndVConn,
93  byte_t wbuf[],
94  size_t uWriteLen);
95 
96 extern int bsSerialReqTrans(BsClient_P pClient,
97  BsVConnHnd_T hndVConn,
98  byte_t wbuf[],
99  size_t uWriteLen,
100  size_t uReadLen,
101  byte_t rbuf[]);
102 
103 
104 #endif // _BSSERIAL_H
The Client Structure Type.
Definition: bsLibInternal.h:96
int bsSerialReqOpen(BsClient_P pClient, const char *sDevName, int nBaudRate, int nByteSize, int cParity, int nStopBits, bool_t bRtsCts, bool_t bXonXoff, bool_t bInitTrace)
Request proxy server to establish a virtual connection to an RS-232 serial device.
int bsSerialReqRead(BsClient_P pClient, BsVConnHnd_T hndVConn, size_t uReadLen, byte_t rbuf[])
Proxied request to read from an RS-232 serial device.
int bsSerialReqTrans(BsClient_P pClient, BsVConnHnd_T hndVConn, byte_t wbuf[], size_t uWriteLen, size_t uReadLen, byte_t rbuf[])
Proxied request to execute a write-read transaction on a RS-232 serial device.
const char * bsSerialGetMsgName(BsClient_P pClient, BsVConnHnd_T hndVConn, uint_t uMsgId)
Get the serial message name.
<b><i>BotSense</i></b> client library declarations.
int bsSerialReqWrite(BsClient_P pClient, BsVConnHnd_T hndVConn, byte_t wbuf[], size_t uWriteLen)
Proxied request to write to a RS-232 serial device.
<b><i>BotSense</i></b> package top-level, unifying header declarations.
int bsSerialReqClose(BsClient_P pClient, BsVConnHnd_T hndVConn)
Request proxy server to close client&#39;s proxied serial device vitual connection.
int BsVConnHnd_T
virtual connection handle type
Definition: BotSense.h:151