This class is a Serial Port adapter for Beensest. More...
#include <BnSerialPort.h>
Public Member Functions | |
BnSerialPort (const char *name, bool(*pGetParam)(const char *, char *, int)) | |
Constructor. | |
~BnSerialPort () | |
Destructor. | |
virtual BufferHolder | Read (BufferHolder address) throw (BufferHolder) |
Read data from the port. | |
virtual bool | Write (BufferHolder address, BufferHolder value) throw (BufferHolder) |
Write data to the port. | |
virtual bool | IsMultiUse () |
This adapter is NOT for multi-use. |
This class is a Serial Port adapter for Beensest.
It will work only on Windows
Write: always write the buffer address to the port.
Read: if address is empty, it reads the data from the port. if address is _LastError it returns an error message of the last operation (or "OK").
Configuration:
COM = "COMx", x is the port number you want to work with.
Settings = "[baud=b] [parity=p] [data=d] [stop=s] [to={on|off}] [xon={on|off}] [odsr={on|off}] [octs={on|off}] [dtr={on|off|hs}] [rts={on|off|hs|tg}] [idsr={on|off}]"
baud = b : Specifies the transmission rate in bits per second.
11 = 110 baud, 15 = 150 baud, 30 = 300 baud, 60 = 600 baud, 12 = 1200 baud, 24 = 2400 baud, 48 = 4800 baud, 96 = 9600 baud, 19 = 19,200 baud
parity = p : Specifies how to check for transmission errors.
n = none, e = even, o = odd, m = mark, s = space
data = d : Specifies the number of data bits in a byte (5 - 8).
stop = s : Specifies the number of stop bits that define the end of a byte (1, 1.5, or 2).
Read-Interval-Timeout - Maximum time allowed to elapse between the arrival of two bytes on the communications line, in milliseconds.A value of zero indicates that interval time-outs are not used.
Read-Total-Timeout-Multiplier - Multiplier used to calculate the total time-out period for read operations, in milliseconds. For each read operation, this value is multiplied by the requested number of bytes to be read.
Read-Total-Timeout-Constant - Constant used to calculate the total time-out period, in milliseconds. This value is added to the product on Read-Total-Timeout-Multiplier. A value of zero for both the Read-Total-Timeout-Multiplier and Read-Total-Timeout-Constant indicates that total time-outs are not used for read operations.
Write-Total-Timeout-Multiplier - Like Read-Total-Timeout-Multiplier.
Write-Total-Timeout-Constant - Like Read-Total-Timeout-Constant.
Definition at line 53 of file BnSerialPort.h.
BnSerialPort::BnSerialPort | ( | const char * | name, |
bool(*)(const char *, char *, int) | pGetParam | ||
) |
Constructor.
Definition at line 4 of file BnSerialPort.cpp.
BnSerialPort::~BnSerialPort | ( | ) |
Destructor.
Definition at line 83 of file BnSerialPort.cpp.
virtual bool BnSerialPort::IsMultiUse | ( | ) | [inline, virtual] |
This adapter is NOT for multi-use.
Reimplemented from IdcAdapter.
Definition at line 102 of file BnSerialPort.h.
BufferHolder BnSerialPort::Read | ( | BufferHolder | address ) | throw (BufferHolder) [virtual] |
bool BnSerialPort::Write | ( | BufferHolder | address, |
BufferHolder | value | ||
) | throw (BufferHolder) [virtual] |