Main Page | Class Hierarchy | Data Structures | File List | Data Fields | Globals

Communication Class Reference

#include <communication.h>

Inheritance diagram for Communication:

Inheritance graph
[legend]

Detailed Description

Communication class.

Everything related to the communication must belong to this class.


Public Member Functions

 Communication (void)
 The constructor.

virtual int send (unsigned char const *buffer, int numBytes)=0
 Transmits data.

virtual int receive (unsigned char *buffer, int numBytes)=0
 Receives data.

void setFD (int fd_tmp)
 Sets the descriptor of the communication port.

int getFD (void)
 Gets the descriptor of the communication port.

void setTimeout (int value)
 Sets the timeout for the reception of data.

int getTimeout (void)
 Gets the actual value of the timeout for reception.


Constructor & Destructor Documentation

Communication::Communication void   ) 
 

The constructor.

Sets the timeout to 100ms.


Member Function Documentation

int Communication::getFD void   ) 
 

Gets the descriptor of the communication port.

Returns:
the file descriptor for communication.

Reimplemented in CommUDP.

int Communication::getTimeout void   ) 
 

Gets the actual value of the timeout for reception.

Returns:
the timeout in ms.

virtual int Communication::receive unsigned char *  buffer,
int  numBytes
[pure virtual]
 

Receives data.

Parameters:
buffer data received.
numBytes number of bytes expected to be received.
Returns:
the number of bytes received or an error code.

Implemented in CommPLC, and CommSerial.

virtual int Communication::send unsigned char const *  buffer,
int  numBytes
[pure virtual]
 

Transmits data.

Parameters:
buffer data to transmit.
numBytes the number of bytes to transmit.
Returns:
an error code.

Implemented in CommPLC, CommSerial, and CommUDP.

void Communication::setFD int  fd_tmp  ) 
 

Sets the descriptor of the communication port.

Parameters:
fd_tmp the new file descriptor for the communication.

Reimplemented in CommUDP.

void Communication::setTimeout int  value  ) 
 

Sets the timeout for the reception of data.

Parameters:
value the new timeout. Value in miliseconds.


The documentation for this class was generated from the following file:
Generated on Sun Aug 21 21:28:48 2005 for PLC Modem/ABNT-14522 Library by doxygen 1.3.7