Nedap.HandheldApi
|
This clas wraps SerialPort class and imelements IComunication interface. It is used as an apstraction for a serial port. More...
Public Member Functions | |
SerialCommunicationPort (string portName, int baudRate, Parity parity, int dataBits, StopBits stopBits) | |
This is a constructor for serial port. It creates new instance of SerialPort class with required parameters. | |
void | Dispose () |
Disposes private members. | |
bool | Connect () |
Connect to port. | |
bool | Disconnect () |
Disconnect from port. | |
int | WriteData (byte[] buffer, int offset, int length) |
Writes data to port. | |
int | ReadData (byte[] buffer, int offset, int length) |
Reads data from port, if no data is available it should return with 0 result. | |
Properties | |
bool | Connected [get, set] |
Defines if port is connected. | |
Events | |
EventHandler | OnDataReceived |
This event is trigered when data are received on the serial port. |
This clas wraps SerialPort class and imelements IComunication interface. It is used as an apstraction for a serial port.
Nedap.HandheldApi.CommunicationPort.SerialCommunicationPort.SerialCommunicationPort | ( | string | portName, |
int | baudRate, | ||
Parity | parity, | ||
int | dataBits, | ||
StopBits | stopBits | ||
) |
This is a constructor for serial port. It creates new instance of SerialPort class with required parameters.
portName | String that holds name of the serial port (e.g. COM7) |
baudRate | Integer number that represents port baud rate |
parity | Port parity checking protocol |
dataBits | Standard length of data bits per byte. |
stopBits | Standard number of stopbits per byte. |
bool Nedap.HandheldApi.CommunicationPort.SerialCommunicationPort.Connect | ( | ) |
Connect to port.
Implements Nedap.HandheldApi.CommunicationQueue.ICommunicationPort.
bool Nedap.HandheldApi.CommunicationPort.SerialCommunicationPort.Disconnect | ( | ) |
Disconnect from port.
Implements Nedap.HandheldApi.CommunicationQueue.ICommunicationPort.
void Nedap.HandheldApi.CommunicationPort.SerialCommunicationPort.Dispose | ( | ) |
Disposes private members.
int Nedap.HandheldApi.CommunicationPort.SerialCommunicationPort.ReadData | ( | byte[] | buffer, |
int | offset, | ||
int | length | ||
) |
Reads data from port, if no data is available it should return with 0 result.
buffer | Buffer to read into |
offset | Position where to start writing |
length | Maximum number of bytes to read |
Implements Nedap.HandheldApi.CommunicationQueue.ICommunicationPort.
int Nedap.HandheldApi.CommunicationPort.SerialCommunicationPort.WriteData | ( | byte[] | buffer, |
int | offset, | ||
int | length | ||
) |
Writes data to port.
buffer | Data buffer |
offset | Position where to start writing |
length | Number of bytes to write |
Implements Nedap.HandheldApi.CommunicationQueue.ICommunicationPort.
bool Nedap.HandheldApi.CommunicationPort.SerialCommunicationPort.Connected [get, set] |
Defines if port is connected.
Implements Nedap.HandheldApi.CommunicationQueue.ICommunicationPort.
EventHandler Nedap.HandheldApi.CommunicationPort.SerialCommunicationPort.OnDataReceived |
This event is trigered when data are received on the serial port.
Implements Nedap.HandheldApi.CommunicationQueue.ICommunicationPort.