botsense  3.2.0
RoadNarrows Client-Server Proxied Services Framework
bsI2C.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // Package: BotSense
4 //
5 // File: bsI2C.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 \h_i2c bus interface.
13  *
14  * \todo Add bsI2CReqCheck() function.
15  * \todo Add bsI2CReqReadLine() function.
16  * \todo Add bsI2CReqWriteLine() function.
17  *
18  * \author Robin Knight (robin.knight@roadnarrows.com)
19  *
20  * \copyright
21  * \h_copy 2010-2017. RoadNarrows LLC.\n
22  * http://www.roadnarrows.com\n
23  * All Rights Reserved
24  */
25 // Permission is hereby granted, without written agreement and without
26 // license or royalty fees, to use, copy, modify, and distribute this
27 // software and its documentation for any purpose, provided that
28 // (1) The above copyright notice and the following two paragraphs
29 // appear in all copies of the source code and (2) redistributions
30 // including binaries reproduces these notices in the supporting
31 // documentation. Substantial modifications to this software may be
32 // copyrighted by their authors and need not follow the licensing terms
33 // described here, provided that the new terms are clearly indicated in
34 // all files where they apply.
35 //
36 // IN NO EVENT SHALL THE AUTHOR, ROADNARROWS LLC, OR ANY MEMBERS/EMPLOYEES
37 // OF ROADNARROW LLC OR DISTRIBUTORS OF THIS SOFTWARE BE LIABLE TO ANY
38 // PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
39 // DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION,
40 // EVEN IF THE AUTHORS OR ANY OF THE ABOVE PARTIES HAVE BEEN ADVISED OF
41 // THE POSSIBILITY OF SUCH DAMAGE.
42 //
43 // THE AUTHOR AND ROADNARROWS LLC SPECIFICALLY DISCLAIM ANY WARRANTIES,
44 // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
45 // FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN
46 // "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO
47 // PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
48 //
49 ////////////////////////////////////////////////////////////////////////////////
50 
51 #ifndef _BSI2C_H
52 #define _BSI2C_H
53 
54 #include "rnr/rnrconfig.h"
55 #include "rnr/i2c.h"
56 
57 #include "botsense/BotSense.h"
58 #include "botsense/libBotSense.h"
59 
60 #define BS_I2C_DEV_NAME_DFT "/dev/i2c-0" ///< default \h_i2c bus device
61 
62 #define BS_I2C_SERVER_MOD "libbsserver_i2c" ///< server plugin dll module
63 #define BS_I2C_CLIENT_LIB "libbsclient_i2c" ///< client app library
64 
65 
66 extern const char *bsI2CGetMsgName(BsClient_P pClient,
67  BsVConnHnd_T hndVConn,
68  uint_t uMsgId);
69 
70 extern int bsI2CReqOpen(BsClient_P pClient,
71  const char *sDevName,
72  bool_t bInitTrace);
73 
74 extern int bsI2CReqClose(BsClient_P pClient, BsVConnHnd_T hndVConn);
75 
76 extern int bsI2CReqRead(BsClient_P pClient,
77  BsVConnHnd_T hndVConn,
78  i2c_addr_t i2cAddr,
79  size_t uReadLen,
80  byte_t rbuf[]);
81 
82 extern int bsI2CReqWrite(BsClient_P pClient,
83  BsVConnHnd_T hndVConn,
84  i2c_addr_t i2cAddr,
85  byte_t wbuf[],
86  size_t uWriteLen);
87 
88 extern int bsI2CReqTrans(BsClient_P pClient,
89  BsVConnHnd_T hndVConn,
90  i2c_addr_t i2cAddr,
91  byte_t wbuf[],
92  size_t uWriteLen,
93  size_t uReadLen,
94  byte_t rbuf[]);
95 
96 extern int bsI2CReqScan(BsClient_P pClient,
97  BsVConnHnd_T hndVConn,
98  i2c_addr_t bufScan[],
99  size_t sizeScanBuf);
100 
101 
102 #endif // _BSI2C_H
int bsI2CReqWrite(BsClient_P pClient, BsVConnHnd_T hndVConn, i2c_addr_t i2cAddr, byte_t wbuf[], size_t uWriteLen)
Proxied request to write to a device attached to the I2C bus.
Definition: bsI2CClient.c:256
int bsI2CReqOpen(BsClient_P pClient, const char *sDevName, bool_t bInitTrace)
Request proxy server to establish a virtual connection to an I2C bus device.
Definition: bsI2CClient.c:124
The Client Structure Type.
Definition: bsLibInternal.h:96
<b><i>BotSense</i></b> client library declarations.
int bsI2CReqTrans(BsClient_P pClient, BsVConnHnd_T hndVConn, i2c_addr_t i2cAddr, byte_t wbuf[], size_t uWriteLen, size_t uReadLen, byte_t rbuf[])
Proxied request to execute a write-read transaction to a device attached to the I2C bus...
Definition: bsI2CClient.c:340
const char * bsI2CGetMsgName(BsClient_P pClient, BsVConnHnd_T hndVConn, uint_t uMsgId)
Get the I2C message name.
Definition: bsI2CClient.c:101
int bsI2CReqRead(BsClient_P pClient, BsVConnHnd_T hndVConn, i2c_addr_t i2cAddr, size_t uReadLen, byte_t rbuf[])
Proxied request to read from a device attached to the I2C bus.
Definition: bsI2CClient.c:171
int bsI2CReqScan(BsClient_P pClient, BsVConnHnd_T hndVConn, i2c_addr_t bufScan[], size_t sizeScanBuf)
Proxied request to scan the I2C bus for all attached devices.
Definition: bsI2CClient.c:433
int bsI2CReqClose(BsClient_P pClient, BsVConnHnd_T hndVConn)
Request proxy server to close client&#39;s proxied I2C device vitual connection.
Definition: bsI2CClient.c:153
<b><i>BotSense</i></b> package top-level, unifying header declarations.
int BsVConnHnd_T
virtual connection handle type
Definition: BotSense.h:151