Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages | Examples

ArServerHandlerCommMonitor Class Reference

ArServerHandlerCommMonitor defines network packet handlers that simply verify the communication between the robot and server. More...

#include <ArServerHandlerCommMonitor.h>

List of all members.

Public Types

enum  { MIN_HEARTBEAT_INTERVAL = 100, DEFAULT_HEARTBEAT_INTERVAL = 500 }

Public Member Functions

 ArServerHandlerCommMonitor (ArServerBase *server, int heartbeatInterval=DEFAULT_HEARTBEAT_INTERVAL)
void cycleCallback ()
 Callback for the server cycle; broadcasts heartbeat packets when interval has elapsed.
void handleAckCommTcp (ArServerClient *client, ArNetPacket *packet)
void handleAckCommUdp (ArServerClient *client, ArNetPacket *packet)
void handleGetHeartbeatInterval (ArServerClient *client, ArNetPacket *packet)
virtual ~ArServerHandlerCommMonitor ()
 Destructor.

Static Public Attributes

static const char * ACK_COMM_TCP_PACKET_NAME = "ackCommTcp"
 Name of the network packet to confirm TCP communication.
static const char * ACK_COMM_UDP_PACKET_NAME = "ackCommUdp"
 Name of the network packet to confirm UDP communication.
static const char * COMMAND_GROUP = "RobotInfo"
static const char * GET_HEARTBEAT_INTERVAL_PACKET_NAME = "getHeartbeatInterval"
 Name of the network packet to get the heartbeat interval.
static const char * HEARTBEAT_TCP_PACKET_NAME = "heartbeatTcp"
 Name of the network packet broadcast (TCP) to confirm the server is alive.
static const char * HEARTBEAT_UDP_PACKET_NAME = "heartbeatUdp"
 Name of the network packet broadcast (UDP) to confirm the server is alive.
static const char * NO_ARGS = "None"

Protected Attributes

ArFunctor2C< ArServerHandlerCommMonitor,
ArServerClient *, ArNetPacket * > 
myAckCommTcpCB
 Callback for replying to the ack request (TCP).
ArFunctor2C< ArServerHandlerCommMonitor,
ArServerClient *, ArNetPacket * > 
myAckCommUdpCB
 Callback for replying to the ack request (UDP).
ArFunctorC< ArServerHandlerCommMonitormyCycleCB
 Cycle callback executed to broadcast the heartbeat packets.
ArFunctor2C< ArServerHandlerCommMonitor,
ArServerClient *, ArNetPacket * > 
myGetHeartbeatIntervalCB
 Callback for getting the heartbeat interval.
int myHeartbeatInterval
 Number of msecs between heartbeat broadcasts.
ArTime myLastHeartbeatTime
 Time that the last heartbeat packets were broadcast.
ArServerBasemyServer
 Server from which requests are received.


Detailed Description

ArServerHandlerCommMonitor defines network packet handlers that simply verify the communication between the robot and server.

This class handles the following requests:

Definition at line 55 of file ArServerHandlerCommMonitor.h.


Member Enumeration Documentation

anonymous enum
 

Enumeration values:
MIN_HEARTBEAT_INTERVAL 
DEFAULT_HEARTBEAT_INTERVAL 

Definition at line 59 of file ArServerHandlerCommMonitor.h.


Constructor & Destructor Documentation

ArServerHandlerCommMonitor::ArServerHandlerCommMonitor ArServerBase server,
int  heartbeatInterval = DEFAULT_HEARTBEAT_INTERVAL
 

Parameters:
server the ArServerBase * used to send/receive requests
robot the associated ArRobot *

Definition at line 41 of file ArServerHandlerCommMonitor.cpp.

ArServerHandlerCommMonitor::~ArServerHandlerCommMonitor  )  [virtual]
 

Destructor.

Definition at line 97 of file ArServerHandlerCommMonitor.cpp.


Member Function Documentation

void ArServerHandlerCommMonitor::cycleCallback  ) 
 

Callback for the server cycle; broadcasts heartbeat packets when interval has elapsed.

Definition at line 147 of file ArServerHandlerCommMonitor.cpp.

References ArServerBase::broadcastPacketTcp(), ArServerBase::broadcastPacketUdp(), HEARTBEAT_TCP_PACKET_NAME, HEARTBEAT_UDP_PACKET_NAME, ArTime::mSecSince(), myHeartbeatInterval, myLastHeartbeatTime, myServer, and ArTime::setToNow().

void ArServerHandlerCommMonitor::handleAckCommTcp ArServerClient client,
ArNetPacket packet
 

Parameters:
client the ArServerClient * that sent the request
packet the ArNetPacket * that contains the request

Definition at line 119 of file ArServerHandlerCommMonitor.cpp.

References client, and ArClientBase::sendPacketTcp().

void ArServerHandlerCommMonitor::handleAckCommUdp ArServerClient client,
ArNetPacket packet
 

Parameters:
client the ArServerClient * that sent the request
packet the ArNetPacket * that contains the request

Definition at line 133 of file ArServerHandlerCommMonitor.cpp.

References client, and ArClientBase::sendPacketUdp().

void ArServerHandlerCommMonitor::handleGetHeartbeatInterval ArServerClient client,
ArNetPacket packet
 

Parameters:
client the ArServerClient * that sent the request
packet the ArNetPacket * that contains the request

Definition at line 104 of file ArServerHandlerCommMonitor.cpp.

References client, ArClientBase::sendPacketTcp(), and ArBasePacket::uByte4ToBuf().


Member Data Documentation

const char * ArServerHandlerCommMonitor::ACK_COMM_TCP_PACKET_NAME = "ackCommTcp" [static]
 

Name of the network packet to confirm TCP communication.

Definition at line 34 of file ArServerHandlerCommMonitor.cpp.

const char * ArServerHandlerCommMonitor::ACK_COMM_UDP_PACKET_NAME = "ackCommUdp" [static]
 

Name of the network packet to confirm UDP communication.

Definition at line 35 of file ArServerHandlerCommMonitor.cpp.

const char * ArServerHandlerCommMonitor::COMMAND_GROUP = "RobotInfo" [static]
 

Definition at line 36 of file ArServerHandlerCommMonitor.cpp.

const char * ArServerHandlerCommMonitor::GET_HEARTBEAT_INTERVAL_PACKET_NAME = "getHeartbeatInterval" [static]
 

Name of the network packet to get the heartbeat interval.

Definition at line 33 of file ArServerHandlerCommMonitor.cpp.

const char * ArServerHandlerCommMonitor::HEARTBEAT_TCP_PACKET_NAME = "heartbeatTcp" [static]
 

Name of the network packet broadcast (TCP) to confirm the server is alive.

Definition at line 30 of file ArServerHandlerCommMonitor.cpp.

Referenced by cycleCallback().

const char * ArServerHandlerCommMonitor::HEARTBEAT_UDP_PACKET_NAME = "heartbeatUdp" [static]
 

Name of the network packet broadcast (UDP) to confirm the server is alive.

Definition at line 31 of file ArServerHandlerCommMonitor.cpp.

Referenced by cycleCallback().

ArFunctor2C<ArServerHandlerCommMonitor, ArServerClient *, ArNetPacket *> ArServerHandlerCommMonitor::myAckCommTcpCB [protected]
 

Callback for replying to the ack request (TCP).

Definition at line 142 of file ArServerHandlerCommMonitor.h.

ArFunctor2C<ArServerHandlerCommMonitor, ArServerClient *, ArNetPacket *> ArServerHandlerCommMonitor::myAckCommUdpCB [protected]
 

Callback for replying to the ack request (UDP).

Definition at line 139 of file ArServerHandlerCommMonitor.h.

ArFunctorC<ArServerHandlerCommMonitor> ArServerHandlerCommMonitor::myCycleCB [protected]
 

Cycle callback executed to broadcast the heartbeat packets.

Definition at line 144 of file ArServerHandlerCommMonitor.h.

ArFunctor2C<ArServerHandlerCommMonitor, ArServerClient *, ArNetPacket *> ArServerHandlerCommMonitor::myGetHeartbeatIntervalCB [protected]
 

Callback for getting the heartbeat interval.

Definition at line 136 of file ArServerHandlerCommMonitor.h.

int ArServerHandlerCommMonitor::myHeartbeatInterval [protected]
 

Number of msecs between heartbeat broadcasts.

Definition at line 130 of file ArServerHandlerCommMonitor.h.

Referenced by cycleCallback().

ArTime ArServerHandlerCommMonitor::myLastHeartbeatTime [protected]
 

Time that the last heartbeat packets were broadcast.

Definition at line 132 of file ArServerHandlerCommMonitor.h.

Referenced by cycleCallback().

ArServerBase* ArServerHandlerCommMonitor::myServer [protected]
 

Server from which requests are received.

Definition at line 127 of file ArServerHandlerCommMonitor.h.

Referenced by cycleCallback().

const char * ArServerHandlerCommMonitor::NO_ARGS = "None" [static]
 

Definition at line 37 of file ArServerHandlerCommMonitor.cpp.


The documentation for this class was generated from the following files:
Generated on Tue Feb 20 10:51:51 2007 for ArNetworking by  doxygen 1.4.0