class Serial

This class is designed to manage a serial port

Inheritance:


Public Fields

[more]bool bVerbose
verbose serial communication if true
[more]char* device
the device (/dev/ttyS0 or /dev/ttya for instance)
[more]int handle
serial port handle

Public Methods

[more] Serial(char* device_, char port_)
[more]virtual ~Serial()
[more]bool connect()
connect to the serial port
[more]virtual bool init() = 0
specific device initialisation
[more]void printCmd(sCommandPacket* command)
print the command in hexadecimal
[more]bool sendCmd(sCommandPacket* command, bool ack = true, bool cpl = true)
send the command on the serial port.
[more]int send(sCommandPacket* command)
send the command without acknowledgement and completion.
[more]int readCmd(sCommandPacket* command)
read command from the serial port.
[more]int waitingForReply(int timeInSec, sCommandPacket* command)
wait max timeInSec seconds for command.
[more]int isEqual(sCommandPacket* command1, sCommandPacket* command2)
is command1 equal command2
[more]virtual bool IsAck(sCommandPacket* command) = 0
is command an acknowledgement packet
[more]virtual bool IsCpl(sCommandPacket* command) = 0
is command an completion packet
[more]virtual unsigned char byteTerminator() = 0
terminator at the end of packets


Documentation

This class is designed to manage a serial port

obool bVerbose
verbose serial communication if true

ochar* device
the device (/dev/ttyS0 or /dev/ttya for instance)

oint handle
serial port handle

o Serial(char* device_, char port_)

ovirtual ~Serial()

obool connect()
connect to the serial port

ovirtual bool init() = 0
specific device initialisation

ovoid printCmd(sCommandPacket* command)
print the command in hexadecimal

obool sendCmd(sCommandPacket* command, bool ack = true, bool cpl = true)
send the command on the serial port. If ack is true then wait for acknowledgement. If cpl is true then wait for completion.

oint send(sCommandPacket* command)
send the command without acknowledgement and completion. Returns the number of bytes written.

oint readCmd(sCommandPacket* command)
read command from the serial port. Returns the number of bytes which were read.

oint waitingForReply(int timeInSec, sCommandPacket* command)
wait max timeInSec seconds for command. Returns the number of written bytes if success, -1 otherwise.

oint isEqual(sCommandPacket* command1, sCommandPacket* command2)
is command1 equal command2

ovirtual bool IsAck(sCommandPacket* command) = 0
is command an acknowledgement packet

ovirtual bool IsCpl(sCommandPacket* command) = 0
is command an completion packet

ovirtual unsigned char byteTerminator() = 0
terminator at the end of packets


Direct child classes:
cameraControl
Author:
Sebastien Marcel (marcel@idiap.ch)
Version:
2.0 Wed 28 Jun 2006 05:19:41 PM CEST
Since:
2.0

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.