#include <ArServerHandlerCommMonitor.h>
ArServerHandlerCommMonitor defines network packet handlers that simply verify the communication between the robot and server.
This class handles the following requests:
Public Types | |
enum | { MIN_HEARTBEAT_INTERVAL = 100, DEFAULT_HEARTBEAT_INTERVAL = 500 } |
Public Member Functions | |
ArServerHandlerCommMonitor (ArServerBase *server, int heartbeatInterval=DEFAULT_HEARTBEAT_INTERVAL) | |
Constructs a new handler to monitor communication between the robot server and client. | |
void | cycleCallback () |
Callback for the server cycle; broadcasts heartbeat packets when interval has elapsed. | |
void | handleAckCommTcp (ArServerClient *client, ArNetPacket *packet) |
Handles the ackCommTcp network packet. | |
void | handleAckCommUdp (ArServerClient *client, ArNetPacket *packet) |
Handles the ackCommUdp network packet. | |
void | handleGetHeartbeatInterval (ArServerClient *client, ArNetPacket *packet) |
Handles the getHeartbeatInterval network packet. | |
virtual | ~ArServerHandlerCommMonitor () |
Destructor. | |
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< ArServerHandlerCommMonitor > | myCycleCB |
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. | |
ArServerBase * | myServer |
Server from which requests are received. | |
Static Protected Attributes | |
static const char * | ACK_COMM_TCP_PACKET_NAME |
Name of the network packet to confirm TCP communication. | |
static const char * | ACK_COMM_UDP_PACKET_NAME |
Name of the network packet to confirm UDP communication. | |
static const char * | COMMAND_GROUP |
static const char * | GET_HEARTBEAT_INTERVAL_PACKET_NAME |
Name of the network packet to get the heartbeat interval. | |
static const char * | HEARTBEAT_TCP_PACKET_NAME |
Name of the network packet broadcast (TCP) to confirm the server is alive. | |
static const char * | HEARTBEAT_UDP_PACKET_NAME |
Name of the network packet broadcast (UDP) to confirm the server is alive. | |
static const char * | NO_ARGS |
ArServerHandlerCommMonitor::ArServerHandlerCommMonitor | ( | ArServerBase * | server, | |
int | heartbeatInterval = DEFAULT_HEARTBEAT_INTERVAL | |||
) |
Constructs a new handler to monitor communication between the robot server and client.
server | the ArServerBase used to send/receive requests | |
heartBeatInterval | How often to send a "heartbeat" packet to the client |
void ArServerHandlerCommMonitor::handleAckCommTcp | ( | ArServerClient * | client, | |
ArNetPacket * | packet | |||
) |
Handles the ackCommTcp network packet.
client | the ArServerClient * that sent the request | |
packet | the ArNetPacket * that contains the request |
void ArServerHandlerCommMonitor::handleAckCommUdp | ( | ArServerClient * | client, | |
ArNetPacket * | packet | |||
) |
Handles the ackCommUdp network packet.
client | the ArServerClient * that sent the request | |
packet | the ArNetPacket * that contains the request |
void ArServerHandlerCommMonitor::handleGetHeartbeatInterval | ( | ArServerClient * | client, | |
ArNetPacket * | packet | |||
) |
Handles the getHeartbeatInterval network packet.
client | the ArServerClient * that sent the request | |
packet | the ArNetPacket * that contains the request |