DETI-Dynamixel Interface  1
DevCommUsb Class Reference

This class implements the device communication for a USB device in Linux (see DevComm for general details) More...

#include <DevCommUsb.h>

Inheritance diagram for DevCommUsb:
Collaboration diagram for DevCommUsb:

Public Member Functions

 DevCommUsb (const char *devName)
 
void openChannel ()
 
void closeChannel ()
 
bool txRx (const char *txPacket, char *rxPacket, int rxSize)
 

Private Member Functions

int setNewSettings (int baudrate, int databits, const int parity, const int stopbits, bool softwareHandshake, bool hardwareHandshake)
 
void resetAttributes ()
 

Private Attributes

int fd
 
struct termios newtio
 
struct termios oldtio
 
const char * devname
 
int baudrate
 
int databits
 
int stopbits
 
int parity
 

Detailed Description

This class implements the device communication for a USB device in Linux (see DevComm for general details)

Member Function Documentation

void DevCommUsb::closeChannel ( )
virtual

This function will be responsible for closing the communication channel.

Implements DevComm.

References fd, and oldtio.

void DevCommUsb::openChannel ( )
virtual

This function will be responsible for opening the communication channel using the device available.

Todo:
Clarify the purpose of the two following lines

Implements DevComm.

References baudrate, databits, devname, fd, oldtio, and stopbits.

bool DevCommUsb::txRx ( const char *  txPacket,
char *  rxPacket,
int  rxSize 
)
virtual

This function will be responsible for dealing with the "physical" transmission of the data. It will then proceed to listening for the correspondent response. Whoever calls this function is responsible for guaranteeing that the reception buffer is large enough for rxSize+1 (+1 for '\0')

Parameters
txPacketThe data to be transmitted, provided by the DxComm method that invokes the transmission.
rxPacketThe array to store the response from the deti DX board. The DxComm method invoking the transmission will further handle its data.
rxSizeThe maximum size of data on the response packet corresponding to the invoking method.
Returns
a boolean value indicating if the transmission/reception was performed. True in the normal situation, False in case of timeout on reception or channel error.
Todo:
transformar em byte array para verificar checksum

Implements DevComm.

References fd.

Field Documentation

int DevCommUsb::baudrate
private

the baudrate

Referenced by openChannel().

int DevCommUsb::databits
private

number of databits

Referenced by openChannel().

const char* DevCommUsb::devname
private

the device name

Referenced by openChannel().

int DevCommUsb::fd
private

channel file descriptor

Referenced by closeChannel(), openChannel(), and txRx().

struct termios DevCommUsb::newtio
private

the new channel settings

struct termios DevCommUsb::oldtio
private

the previous channel settings

Referenced by closeChannel(), and openChannel().

int DevCommUsb::parity
private

the parity

int DevCommUsb::stopbits
private

number of stopbits

Referenced by openChannel().


The documentation for this class was generated from the following files: