Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

DCDT_Channel_Serial Class Reference

#include <DCDT_Channel_Serial.h>

Inheritance diagram for DCDT_Channel_Serial:

DCDT_Channel List of all members.

Public Member Functions

 DCDT_Channel_Serial (int AgoraID)
void Open (int link_status=0)
 Try to open a serial device.
void Reopen (int link_status)
void Prepare (CommData *local, CommData *remote)
 Prepare channel's data structure.
void StaticPrepare (unsigned int prof, char *dev)
 Prepare static channel's data structure, open a FD.
void ChooseChannel (int channel)
void WaitConn ()
 Method called when the link is in WAITING state.
void StartConn ()
 Method called when the link is in CONNECTING state.
void Send (const DCDT_Msg *msg)
 Send a message.
void SendNotify ()
 Send an HS_NOTIFY message.
void SendAnswer (CommData *to, CommData *local)
 Send an HS_ANSWER message then stop the channel.
DCDT_MsgReceive ()
 Receive a message using the channel settings.
void ReceiveHS (HSMsgHeader *&header, CommData *&remote)
 Receive an handshake message.
void Dispose ()
void Close ()
void KeepAlive ()
CommDataGetStartingCD ()
unsigned int ReadStartingProfile ()
CommDataGetCommData ()
void SetTimers ()
void SetLostTimer (int usec)
void LostTimerOn ()
void LostTimerOff ()
void SetConnTimer (int usec)
void ConnTimerOn ()
void ConnTimerOff ()
void SetSendTimer (int usec)
void SendTimerOn ()
void SendTimerOff ()
void UnblockSend ()
void SetReceiveTimer (int usec)
void ReceiveTimerOn ()
void ReceiveTimerOff ()
void UnblockReceive ()
void Restart (int link_status)
void Stop ()

Private Attributes

int device
int status
CommData_SeriallocalCD
termios options
int trecv_flag
 Flag: = 1 -> use timer when receiving.
int tlost_flag
 Flag: = 1 -> use timer when communicating.
int unblock_recv_flag
 Flag: = 1 -> use no blocking calls when receiving.
timeval trecv_value tlost_value
 Communication timeout.
char device_name [UNIX_PATH_MAX]
unsigned int profile
bool dynamic
 Flag: 1 -> dynamic channel; != 1 -> static channel.

Constructor & Destructor Documentation

DCDT_Channel_Serial::DCDT_Channel_Serial int  AgoraID  )  [inline]
 

Definition at line 47 of file DCDT_Channel_Serial.h.

References device, localCD, status, tlost_flag, tlost_value, trecv_flag, and unblock_recv_flag.


Member Function Documentation

void DCDT_Channel_Serial::ChooseChannel int  channel  )  [inline, virtual]
 

Implements DCDT_Channel.

Definition at line 58 of file DCDT_Channel_Serial.h.

void DCDT_Channel_Serial::Close  )  [inline, virtual]
 

Implements DCDT_Channel.

Definition at line 613 of file DCDT_Channel_Serial.h.

References device.

void DCDT_Channel_Serial::ConnTimerOff  )  [inline, virtual]
 

Implements DCDT_Channel.

Definition at line 654 of file DCDT_Channel_Serial.h.

void DCDT_Channel_Serial::ConnTimerOn  )  [inline, virtual]
 

Implements DCDT_Channel.

Definition at line 650 of file DCDT_Channel_Serial.h.

void DCDT_Channel_Serial::Dispose  )  [inline, virtual]
 

Implements DCDT_Channel.

Definition at line 609 of file DCDT_Channel_Serial.h.

CommData * DCDT_Channel_Serial::GetCommData  )  [inline, virtual]
 

Implements DCDT_Channel.

Definition at line 209 of file DCDT_Channel_Serial.h.

CommData * DCDT_Channel_Serial::GetStartingCD  )  [inline, virtual]
 

Returns an heap memory area of wich is no more responsible

Implements DCDT_Channel.

Definition at line 587 of file DCDT_Channel_Serial.h.

References device_name.

void DCDT_Channel_Serial::KeepAlive  )  [inline, virtual]
 

Implements DCDT_Channel.

Definition at line 68 of file DCDT_Channel_Serial.h.

void DCDT_Channel_Serial::LostTimerOff  )  [inline, virtual]
 

Implements DCDT_Channel.

Definition at line 640 of file DCDT_Channel_Serial.h.

References tlost_flag.

void DCDT_Channel_Serial::LostTimerOn  )  [inline, virtual]
 

Implements DCDT_Channel.

Definition at line 635 of file DCDT_Channel_Serial.h.

References tlost_flag.

Referenced by SetTimers(), and StaticPrepare().

void DCDT_Channel_Serial::Open int  link_status = 0  )  [inline, virtual]
 

Try to open a serial device.

Exceptions:
ChannelError Unable to open the specified device

Implements DCDT_Channel.

Definition at line 183 of file DCDT_Channel_Serial.h.

References BAUDRATE, DCDT_TRC_COMM, device, CommData_Serial::device_name, localCD, options, and TRC_PRINT.

Referenced by Reopen(), Restart(), and StaticPrepare().

void DCDT_Channel_Serial::Prepare CommData local,
CommData remote
[inline, virtual]
 

Prepare channel's data structure.

Implements DCDT_Channel.

Definition at line 146 of file DCDT_Channel_Serial.h.

References DCDT_TRC_COMM, device_name, CommData_Serial::device_name, localCD, and TRC_PRINT.

unsigned int DCDT_Channel_Serial::ReadStartingProfile  )  [inline, virtual]
 

Implements DCDT_Channel.

Definition at line 593 of file DCDT_Channel_Serial.h.

DCDT_Msg * DCDT_Channel_Serial::Receive  )  [inline, virtual]
 

Receive a message using the channel settings.

Exceptions:
ConnError 
Returns:
NULL No new message received
!= NULL Pointer to the message received

Implements DCDT_Channel.

Definition at line 234 of file DCDT_Channel_Serial.h.

References DCDT_MsgHeader, DCDT_TRC_COMM, device, DCDT_Msg::ReadPayloadLen(), DCDT_Msg::SetPayload(), tlost_value, and TRC_PRINT.

void DCDT_Channel_Serial::ReceiveHS HSMsgHeader *&  header,
CommData *&  remote
[inline, virtual]
 

Receive an handshake message.

When an HS_ANSWER message was received close and reopen the channel.

Exceptions:
ConnError 

Implements DCDT_Channel.

Definition at line 378 of file DCDT_Channel_Serial.h.

References DCDT_TRC_COMM, device, device_name, HSMsgHeader, Stop(), tlost_value, TRC_PRINT, and _HSMsgHeader::type.

Referenced by StartConn(), and WaitConn().

void DCDT_Channel_Serial::ReceiveTimerOff  )  [inline, virtual]
 

Implements DCDT_Channel.

Definition at line 687 of file DCDT_Channel_Serial.h.

References trecv_flag.

Referenced by StartConn(), and WaitConn().

void DCDT_Channel_Serial::ReceiveTimerOn  )  [inline, virtual]
 

Implements DCDT_Channel.

Definition at line 681 of file DCDT_Channel_Serial.h.

References trecv_flag, and unblock_recv_flag.

Referenced by SetTimers(), and StaticPrepare().

void DCDT_Channel_Serial::Reopen int  link_status  )  [inline, virtual]
 

Implements DCDT_Channel.

Definition at line 204 of file DCDT_Channel_Serial.h.

References Open().

void DCDT_Channel_Serial::Restart int  link_status  )  [inline, virtual]
 

Implements DCDT_Channel.

Definition at line 697 of file DCDT_Channel_Serial.h.

References Open().

void DCDT_Channel_Serial::Send const DCDT_Msg msg  )  [inline, virtual]
 

Send a message.

Exceptions:
TimeOut Timeout waiting for the channel
ConnError 

Implements DCDT_Channel.

Definition at line 471 of file DCDT_Channel_Serial.h.

References DCDT_TRC_COMM, device, DCDT_Msg::GetHeader(), DCDT_Msg::GetPayload(), DCDT_Msg::ReadPayloadLen(), tlost_value, and TRC_PRINT.

void DCDT_Channel_Serial::SendAnswer CommData to,
CommData local
[inline, virtual]
 

Send an HS_ANSWER message then stop the channel.

Exceptions:
ConnError 

Implements DCDT_Channel.

Definition at line 563 of file DCDT_Channel_Serial.h.

References DCDT_TRC_COMM, device, Stop(), and TRC_PRINT.

void DCDT_Channel_Serial::SendNotify  )  [inline, virtual]
 

Send an HS_NOTIFY message.

Exceptions:
ConnError 

Implements DCDT_Channel.

Definition at line 538 of file DCDT_Channel_Serial.h.

References DCDT_TRC_COMM, device, and TRC_PRINT.

Referenced by StartConn(), and WaitConn().

void DCDT_Channel_Serial::SendTimerOff  )  [inline, virtual]
 

Implements DCDT_Channel.

Definition at line 667 of file DCDT_Channel_Serial.h.

void DCDT_Channel_Serial::SendTimerOn  )  [inline, virtual]
 

Implements DCDT_Channel.

Definition at line 663 of file DCDT_Channel_Serial.h.

void DCDT_Channel_Serial::SetConnTimer int  usec  )  [inline, virtual]
 

Implements DCDT_Channel.

Definition at line 645 of file DCDT_Channel_Serial.h.

void DCDT_Channel_Serial::SetLostTimer int  usec  )  [inline, virtual]
 

Implements DCDT_Channel.

Definition at line 629 of file DCDT_Channel_Serial.h.

References tlost_value.

Referenced by SetTimers(), and StaticPrepare().

void DCDT_Channel_Serial::SetReceiveTimer int  usec  )  [inline, virtual]
 

Implements DCDT_Channel.

Definition at line 675 of file DCDT_Channel_Serial.h.

Referenced by SetTimers(), and StaticPrepare().

void DCDT_Channel_Serial::SetSendTimer int  usec  )  [inline, virtual]
 

Implements DCDT_Channel.

Definition at line 658 of file DCDT_Channel_Serial.h.

void DCDT_Channel_Serial::SetTimers  )  [inline, virtual]
 

Implements DCDT_Channel.

Definition at line 621 of file DCDT_Channel_Serial.h.

References LostTimerOn(), ReceiveTimerOn(), SER_LOST_TIMER_VAL, SER_RECV_TIMER_VAL, SetLostTimer(), and SetReceiveTimer().

void DCDT_Channel_Serial::StartConn  )  [inline, virtual]
 

Method called when the link is in CONNECTING state.

Implements DCDT_Channel.

Definition at line 600 of file DCDT_Channel_Serial.h.

References HSMsgHeader, ReceiveHS(), ReceiveTimerOff(), and SendNotify().

void DCDT_Channel_Serial::StaticPrepare unsigned int  prof,
char *  dev
[inline]
 

Prepare static channel's data structure, open a FD.

Definition at line 164 of file DCDT_Channel_Serial.h.

References DCDT_TRC_COMM, device_name, dynamic, localCD, LostTimerOn(), Open(), profile, ReceiveTimerOn(), SER_LOST_TIMER_VAL, SetLostTimer(), SetReceiveTimer(), and TRC_PRINT.

void DCDT_Channel_Serial::Stop  )  [inline, virtual]
 

Implements DCDT_Channel.

Definition at line 702 of file DCDT_Channel_Serial.h.

References device.

Referenced by ReceiveHS(), and SendAnswer().

void DCDT_Channel_Serial::UnblockReceive  )  [inline, virtual]
 

Implements DCDT_Channel.

Definition at line 692 of file DCDT_Channel_Serial.h.

References unblock_recv_flag.

void DCDT_Channel_Serial::UnblockSend  )  [inline, virtual]
 

Implements DCDT_Channel.

Definition at line 671 of file DCDT_Channel_Serial.h.

void DCDT_Channel_Serial::WaitConn  )  [inline, virtual]
 

Method called when the link is in WAITING state.

Wait for an HS_NOTIFY message then respond with an HS_ANSWER message. ( ??? ) indefinitamente

Implements DCDT_Channel.

Definition at line 219 of file DCDT_Channel_Serial.h.

References HSMsgHeader, ReceiveHS(), ReceiveTimerOff(), and SendNotify().


Member Data Documentation

int DCDT_Channel_Serial::device [private]
 

Definition at line 92 of file DCDT_Channel_Serial.h.

Referenced by Close(), DCDT_Channel_Serial(), Open(), Receive(), ReceiveHS(), Send(), SendAnswer(), SendNotify(), and Stop().

char DCDT_Channel_Serial::device_name[UNIX_PATH_MAX] [private]
 

Definition at line 109 of file DCDT_Channel_Serial.h.

Referenced by GetStartingCD(), Prepare(), ReceiveHS(), and StaticPrepare().

bool DCDT_Channel_Serial::dynamic [private]
 

Flag: 1 -> dynamic channel; != 1 -> static channel.

Definition at line 113 of file DCDT_Channel_Serial.h.

Referenced by StaticPrepare().

CommData_Serial* DCDT_Channel_Serial::localCD [private]
 

Definition at line 93 of file DCDT_Channel_Serial.h.

Referenced by DCDT_Channel_Serial(), Open(), Prepare(), and StaticPrepare().

struct termios DCDT_Channel_Serial::options [private]
 

Definition at line 94 of file DCDT_Channel_Serial.h.

Referenced by Open().

unsigned int DCDT_Channel_Serial::profile [private]
 

Definition at line 110 of file DCDT_Channel_Serial.h.

Referenced by StaticPrepare().

int DCDT_Channel_Serial::status [private]
 

Definition at line 92 of file DCDT_Channel_Serial.h.

Referenced by DCDT_Channel_Serial().

int DCDT_Channel_Serial::tlost_flag [private]
 

Flag: = 1 -> use timer when communicating.

Definition at line 97 of file DCDT_Channel_Serial.h.

Referenced by DCDT_Channel_Serial(), LostTimerOff(), and LostTimerOn().

struct timeval trecv_value DCDT_Channel_Serial::tlost_value [private]
 

Communication timeout.

Definition at line 103 of file DCDT_Channel_Serial.h.

Referenced by DCDT_Channel_Serial(), Receive(), ReceiveHS(), Send(), and SetLostTimer().

int DCDT_Channel_Serial::trecv_flag [private]
 

Flag: = 1 -> use timer when receiving.

Definition at line 97 of file DCDT_Channel_Serial.h.

Referenced by DCDT_Channel_Serial(), ReceiveTimerOff(), and ReceiveTimerOn().

int DCDT_Channel_Serial::unblock_recv_flag [private]
 

Flag: = 1 -> use no blocking calls when receiving.

Definition at line 97 of file DCDT_Channel_Serial.h.

Referenced by DCDT_Channel_Serial(), ReceiveTimerOn(), and UnblockReceive().


The documentation for this class was generated from the following file:
Generated on Sun Jun 19 10:35:51 2005 for dcdt by  doxygen 1.3.9.1