#ifndef ARSERVERINFODRAWINGS_H
#define ARSERVERINFODRAWINGS_H
#include "Aria.h"
#include "ArServerBase.h"
class ArServerClient;
/** Service to provide clients with information about graphical figures to be
displayed with the map.
Use addDrawing() to add a figure, or use addRangeDevice() or
addRobotsRangeDevice() to automatically create standard drawings for
range devices.
Clients may use the listDrawings
data
request to receive a list of figures and metadata about those figures.
The reply packet to the listDrawings
request is as follows:
- Number of figures (4-byte integer)Then, for each figure, the following values are given
- For each figure:
- Figure name (null-terminated string)
- Shape ID (null-terminated string)
- Primary color:
- Unused (byte)
- Red (byte)
- Green (byte)
- Blue (byte)
- Shape size (4-byte integer)
- Layer number (4-byte integer)
- Suggested refresh time (4-byte integer)
- Secordary color:
- Unused (byte)
- Red (byte)
- Green (byte)
- Blue (byte)
This command is in the SensorInfo
permission group for users.
*/
class ArServerInfoDrawings
{
public:
/// Constructor
AREXPORT ArServerInfoDrawings(ArServerBase *server);
/// Destructor
AREXPORT virtual ~ArServerInfoDrawings();
/// Adds a shape to the set of figures
AREXPORT bool addDrawing(ArDrawingData *drawingData, const char *name,
ArFunctor2 *functor);
/// Adds a specific range device to be drawn (using its default shape)
AREXPORT bool addRangeDevice(ArRangeDevice *rangeDevice);
/// Adds all of the robot's range devices (using their default shape)
AREXPORT bool addRobotsRangeDevices(ArRobot *robot);
/// Client callback: Puts the list of shapes that can be drawn and their metadata into a reply packet (internal use mostly)
AREXPORT void netListDrawings(ArServerClient *client, ArNetPacket *packet);
AREXPORT void netGetDrawingList(ArServerClient *client, ArNetPacket *packet);
/// Client callback utility: Puts the current data for the given range device into a reply packet (internal use mostly)
AREXPORT void netRangeDeviceCurrent(ArServerClient *client,
ArNetPacket *packet,
ArRangeDevice *device);
/// Client callback utilit: Puts the cumulative buffer of the given range device into a reply packet (internal use mostly)
AREXPORT void netRangeDeviceCumulative(ArServerClient *client,
ArNetPacket *packet,
ArRangeDevice *device);
/// internal function that gets the drawing data for a drawing
/// @internal
AREXPORT ArDrawingData *internalGetDrawingData(const char *name);
/// internal function that gets the functor for a drawing
/// @internal
AREXPORT ArFunctor2 *internalGetDrawingCallback(const char *name);
protected:
ArServerBase *myServer;
std::map myDrawingDatas;
std::map *, ArStrCaseCmpOp> myDrawingCallbacks;
ArFunctor2C myNetListDrawingsCB;
ArFunctor2C myNetGetDrawingListCB;
};
#endif