botsense  3.2.0
RoadNarrows Client-Server Proxied Services Framework
BotSense.bsSerial Namespace Reference

BotSense Swigged Serial Python Interface Module. More...

Classes

class  _object
 

Functions

def swig_import_helper ()
 
def bsSerialGetMsgName (pClient, hndVConn, uMsgId)
 
def bsSerialReqOpen (pClient, sDevName, nBaudRate, nByteSize, cParity, nStopBits, bRtsCts, bXonXoff, bInitTrace)
 
def bsSerialReqClose (pClient, hndVConn)
 
def bsSerialReqRead (pClient, hndVConn, uReadLen, rbuf)
 
def bsSerialReqWrite (pClient, hndVConn, wbuf, uWriteLen)
 
def bsSerialReqTrans (pClient, hndVConn, wbuf, uWriteLen, uReadLen, rbuf)
 
def SerialGetMsgName (client, hndVConn, msgId)
 
def SerialReqOpen (client, devName, baudRate=9600, byteSize=8, parity='N', stopBits=1, rtscts=False, xonxoff=False, trace=False)
 
def SerialReqClose (client, hndVConn)
 
def SerialReqRead (client, hndVConn, readLen)
 
def SerialReqWrite (client, hndVConn, wbuf)
 
def SerialReqTrans (client, hndVConn, wbuf, readLen)
 

Variables

 BS_SER_DEV_NAME_DFT = _bsSerial.BS_SER_DEV_NAME_DFT
 
 BS_SER_SERVER_MOD = _bsSerial.BS_SER_SERVER_MOD
 
 BS_SER_CLIENT_LIB = _bsSerial.BS_SER_CLIENT_LIB
 
 bsSerialGetMsgName = _bsSerial.bsSerialGetMsgName
 
 bsSerialReqOpen = _bsSerial.bsSerialReqOpen
 
 bsSerialReqClose = _bsSerial.bsSerialReqClose
 
 bsSerialReqRead = _bsSerial.bsSerialReqRead
 
 bsSerialReqWrite = _bsSerial.bsSerialReqWrite
 
 bsSerialReqTrans = _bsSerial.bsSerialReqTrans
 

Detailed Description

BotSense Swigged Serial Python Interface Module.

Author
Robin Knight (robin.nosp@m..kni.nosp@m.ght@r.nosp@m.oadn.nosp@m.arrow.nosp@m.s.co.nosp@m.m)
Copyright:
(C) 2010. RoadNarrows LLC.
(http://www.roadnarrows.com)
All Rights Reserved

Function Documentation

def BotSense.bsSerial.SerialGetMsgName (   client,
  hndVConn,
  msgId 
)
Get the serial message name.

    For each (virtual connection, message id) 2-tuple, there can be a known
    name string (provided the id is valid and an application provides the
    information).

    Parameters:
      client    - BotSenseTypes.BsClient instance.
      hndVConn  - Virtual connection handle (ignored).
      msgId     - Serial message id.

    Return:
      Returns message name string if it can be determined.
      Otherwise returns 'unknown'.

Definition at line 149 of file bsSerial.py.

References BotSense.bsSerial.SerialReqOpen().

149 def SerialGetMsgName(client, hndVConn, msgId):
150  """ Get the serial message name.
151 
152  For each (virtual connection, message id) 2-tuple, there can be a known
153  name string (provided the id is valid and an application provides the
154  information).
155 
156  Parameters:
157  client - BotSenseTypes.BsClient instance.
158  hndVConn - Virtual connection handle (ignored).
159  msgId - Serial message id.
160 
161  Return:
162  Returns message name string if it can be determined.
163  Otherwise returns 'unknown'.
164  """
165  bsTypes.BsClient.ChkClient(client)
166  return bsSerialGetMsgName(client.pClient, hndVConn, msgId)
167 
def SerialGetMsgName(client, hndVConn, msgId)
Definition: bsSerial.py:149
def BotSense.bsSerial.SerialReqClose (   client,
  hndVConn 
)
Proxy server request to close client's proxied serial device virtual
    connection.

    Raises a BotSenseError exception on failure.

    Parameters:
      client    - BotSenseTypes.BsClient instance.
      hndVConn  - Virtual connection handle.

Definition at line 196 of file bsSerial.py.

196 def SerialReqClose(client, hndVConn):
197  """ Proxy server request to close client's proxied serial device virtual
198  connection.
199 
200  Raises a BotSenseError exception on failure.
201 
202  Parameters:
203  client - BotSenseTypes.BsClient instance.
204  hndVConn - Virtual connection handle.
205  """
206  bsTypes.BsClient.ChkClient(client)
207  rc = bsSerialReqClose(client.pClient, hndVConn)
208  bsError.ChkReturnIsOk(rc,
209  "Client %s: Serial Close request failed." % (client.AttrGetName()))
210 
def SerialReqClose(client, hndVConn)
Definition: bsSerial.py:196
def BotSense.bsSerial.SerialReqOpen (   client,
  devName,
  baudRate = 9600,
  byteSize = 8,
  parity = 'N',
  stopBits = 1,
  rtscts = False,
  xonxoff = False,
  trace = False 
)
Proxy server request to establish a virtual connection to an RS-232
    serial device.

    Raises a BotSenseError exception on failure.

    Parameters:
      client    - BotSenseTypes.BsClient instance.
      devName   - Proxied serial device name (e.g. /dev/ttyS0).
      baudRate  -  Baud rate.
      byteSize  - Bytes size in bits 5...8.
      parity    - Parity. One of: 'N', 'E', 'O'
      stopBits  - Number of stop bits 1, 2
      rtscts    - Do [not] use hardware flow control.
      xonxoff   - Do [not] use software flow control.
      trace     - Initial message tracing enable(true)/disable(false) state.

    Return
      New virtual connection handle.

Definition at line 169 of file bsSerial.py.

Referenced by BotSense.bsSerial.SerialGetMsgName().

169  stopBits=1, rtscts=False, xonxoff=False, trace=False):
170  """ Proxy server request to establish a virtual connection to an RS-232
171  serial device.
172 
173  Raises a BotSenseError exception on failure.
174 
175  Parameters:
176  client - BotSenseTypes.BsClient instance.
177  devName - Proxied serial device name (e.g. /dev/ttyS0).
178  baudRate - Baud rate.
179  byteSize - Bytes size in bits 5...8.
180  parity - Parity. One of: 'N', 'E', 'O'
181  stopBits - Number of stop bits 1, 2
182  rtscts - Do [not] use hardware flow control.
183  xonxoff - Do [not] use software flow control.
184  trace - Initial message tracing enable(true)/disable(false) state.
185 
186  Return
187  New virtual connection handle.
188  """
189  bsTypes.BsClient.ChkClient(client)
190  hndVConn = bsSerialReqOpen(client.pClient, devName, baudRate, byteSize,
191  ord(parity), stopBits, rtscts, xonxoff, trace)
192  bsError.ChkReturnIsNonNeg(hndVConn,
193  "Client %s: Serial Open request failed." % (client.AttrGetName()))
194  return hndVConn
195 
def BotSense.bsSerial.SerialReqRead (   client,
  hndVConn,
  readLen 
)
Serial request to read from a proxied RS-232 serial device.

    Raises a BotSenseError exception on failure.

    Parameters:
      client    - BotSenseTypes.BsClient instance.
      hndVConn  - Virtual connection handle.
      readLen   - Number of bytes to read.

    Return:
      Buffer list of read bytes.

Definition at line 211 of file bsSerial.py.

211 def SerialReqRead(client, hndVConn, readLen):
212  """ Serial request to read from a proxied RS-232 serial device.
213 
214  Raises a BotSenseError exception on failure.
215 
216  Parameters:
217  client - BotSenseTypes.BsClient instance.
218  hndVConn - Virtual connection handle.
219  readLen - Number of bytes to read.
220 
221  Return:
222  Buffer list of read bytes.
223  """
224  bsTypes.BsClient.ChkClient(client)
225  rbytebuf = bsTypes.ByteBuf(readLen)
226  n = bsSerialReqRead(client.pClient, hndVConn, readLen, rbytebuf.getSwigObj())
227  bsError.ChkReturnIsNonNeg(n,
228  "Client %s: Serial Read request failed." % (client.AttrGetName()))
229  rbytebuf.copyFromSwigObj(n)
230  return rbytebuf.buf
231 
def SerialReqRead(client, hndVConn, readLen)
Definition: bsSerial.py:211
def BotSense.bsSerial.SerialReqTrans (   client,
  hndVConn,
  wbuf,
  readLen 
)
Serial request to execute a write-read transaction to a proxied
    RS-232 serial device.

    Raises a BotSenseError exception on failure.

    Parameters:
      client    - BotSenseTypes.BsClient instance.
      hndVConn  - Virtual connection handle.
      wbuf      - Write buffer.
      readLen   - Number of bytes to read.

    Return:
      Buffer list of read bytes.

Definition at line 254 of file bsSerial.py.

254 def SerialReqTrans(client, hndVConn, wbuf, readLen):
255  """ Serial request to execute a write-read transaction to a proxied
256  RS-232 serial device.
257 
258  Raises a BotSenseError exception on failure.
259 
260  Parameters:
261  client - BotSenseTypes.BsClient instance.
262  hndVConn - Virtual connection handle.
263  wbuf - Write buffer.
264  readLen - Number of bytes to read.
265 
266  Return:
267  Buffer list of read bytes.
268  """
269  bsTypes.BsClient.ChkClient(client)
270  wbytebuf = bsTypes.ByteBuf.Clone(wbuf)
271  wbytebuf.copyToSwigObj(len(wbytebuf))
272  rbytebuf = bsTypes.ByteBuf(readLen)
273  n = bsSerialReqTrans(client.pClient, hndVConn,
274  wbytebuf.getSwigObj(), len(wbytebuf),
275  readLen, rbytebuf.getSwigObj())
276  bsError.ChkReturnIsNonNeg(n,
277  "Client %s: Serial Transaction request failed." % (client.AttrGetName()))
278  rbytebuf.copyFromSwigObj(n)
279  return rbytebuf.buf
280 
281 
282 # This file is compatible with both classic and new-style classes.
283 
284 
285 
def SerialReqTrans(client, hndVConn, wbuf, readLen)
Definition: bsSerial.py:254
def BotSense.bsSerial.SerialReqWrite (   client,
  hndVConn,
  wbuf 
)
Serial request to write to a proxied RS-232 serial device.

    Raises a BotSenseError exception on failure.

    Parameters:
      client    - BotSenseTypes.BsClient instance.
      hndVConn  - Virtual connection handle.
      wbuf      - Write buffer.

    Return:
      Number of bytes written.

Definition at line 232 of file bsSerial.py.

232 def SerialReqWrite(client, hndVConn, wbuf):
233  """ Serial request to write to a proxied RS-232 serial device.
234 
235  Raises a BotSenseError exception on failure.
236 
237  Parameters:
238  client - BotSenseTypes.BsClient instance.
239  hndVConn - Virtual connection handle.
240  wbuf - Write buffer.
241 
242  Return:
243  Number of bytes written.
244  """
245  bsTypes.BsClient.ChkClient(client)
246  wbytebuf = bsTypes.ByteBuf.Clone(wbuf)
247  wbytebuf.copyToSwigObj(len(wbytebuf))
248  n = bsSerialReqWrite(client.pClient, hndVConn, wbytebuf.getSwigObj(),
249  len(wbytebuf))
250  bsError.ChkReturnIsNonNeg(n,
251  "Client %s: Serial Write request failed." % (client.AttrGetName()))
252  return n
253 
def SerialReqWrite(client, hndVConn, wbuf)
Definition: bsSerial.py:232