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

communication.h File Reference


Detailed Description

Communication.

#include <plcmodem.h>

Include dependency graph for communication.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Data Structures

class  Communication
 Communication class. More...

class  PLC_ERROR

Defines

#define SERIAL_PORT   "/dev/ttyS0"
 Serial Port.

#define MARCA   1
 Defines a constant for one.

#define ESPACO   0
 Defines a constant for zero.

#define MAX_NUM_NACK   0x07
 Defines the maximum number of NAK signals for a specific data block.

#define MAX_NUM_WAIT   0x0C
 Defines the maximum number of WAIT signals for a specific data block.

#define MAX_NUM_REP   0x07
 Defines the maximum number of repetitions for a specific command to be transmitted.

#define OK   1
 Defines a constant for OK.

#define NOK   0
 Defines a constant for NOK.

#define ETIMEOUT   -2
 Defines an error code for timeout during communication.


Enumerations

enum  COMM_STATE {
  DISCONNECTED = 0xA,
  TRYING_CONNECTION = 0xB,
  CONNECTED = 0xC,
  COMMUNICATION = 0xD,
  END_CONNECTION = 0xE
}
 Defines the possible states in the FSM for the communication. More...

enum  COMM_SIGNAL {
  ENQ = 0x05,
  ACK = 0x06,
  NAK = 0x15,
  WAIT = 0x10
}
 Defines the bytes (signals) used in the communication. More...


Functions

unsigned calcularCRC (unsigned char *buffer, int numBytes)
 a normal function to calculate the CRC of the data to be trasmitted.


Variables

const int MAX_BUFFER_RESPOSTA = 258
 Defines the maximum number of bytes permitted in the answer frame.

const int MAX_BUFFER_DADOS = 66
 Defines the maximum number of bytes permitted in the command frame.


Enumeration Type Documentation

enum COMM_SIGNAL
 

Defines the bytes (signals) used in the communication.

Enumeration values:
ENQ  ENQ byte: used for synchronization.
ACK  ACK byte: means that the last answer transmitted was correctly received.
NAK  NAK byte: means that the last data block was completely received, but with a CRC error.
WAIT  WAIT byte: used to delay the transmition.

enum COMM_STATE
 

Defines the possible states in the FSM for the communication.

Enumeration values:
DISCONNECTED  Disconected state: devices do not receive neither transmit data.
TRYING_CONNECTION  Trying_connection state: devices are trying to establish communication.
CONNECTED  Connected state: communication is established.
COMMUNICATION  Communication state: devices exchanging data.
END_CONNECTION  Termination state: finishes FSM execution.


Function Documentation

unsigned calcularCRC unsigned char *  buffer,
int  numBytes
 

a normal function to calculate the CRC of the data to be trasmitted.

Parameters:
buffer data used to calculate the CRC.
numBytes the number of bytes to take into account for the CRC value.


Generated on Sun Aug 21 21:28:44 2005 for PLC Modem/ABNT-14522 Library by doxygen 1.3.7