ArNetworking: ArServerHandlerCommMonitor Class Reference

- Main Page
- Classes
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# ArServerHandlerCommMonitor Class Reference

`#include <ArServerHandlerCommMonitor.h>`

List of all members.

## Detailed Description

Handler that enables the client to monitor communication to the robot server.

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

This class handles the following requests:

- heartbeatTcp: Packet broadcast (TCP) periodically to confirm that the server is alive.
- heartbeatUdp: Packet broadcast (UDP) periodically to confirm that the server is alive.
- getHeartbeatInterval: Command to return the expected heartbeat interval. Packet contains:
  1. uByte4 : Interval (msecs)
- ackCommTcp: Command to acknowledge two-way communication over TCP. An empty packet is returned.
- ackCommUdp: Command to acknowledge two-way communication over UDP. An empty packet is returned.

## 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

## Constructor & Destructor Documentation

ArServerHandlerCommMonitor::ArServerHandlerCommMonitor | ( | ArServerBase * | server,
|  | int | heartbeatInterval = `DEFAULT_HEARTBEAT_INTERVAL` |
| ) |  |  |

Constructs a new handler to monitor communication between the robot server and client.

Parameters:

  | server | the ArServerBase used to send/receive requests
  | heartBeatInterval | How often to send a "heartbeat" packet to the client

## Member Function Documentation

void ArServerHandlerCommMonitor::handleAckCommTcp | ( | ArServerClient * | client,
|  | ArNetPacket * | packet |
| ) |  |  |

Handles the ackCommTcp network packet.

Parameters:

  | 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.

Parameters:

  | 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.

Parameters:

  | client | the ArServerClient * that sent the request
  | packet | the ArNetPacket * that contains the request

The documentation for this class was generated from the following file:

- ArServerHandlerCommMonitor.h