#include <ArServerHandlerMap.h>
A map can be provided from an ArMap object, or else the filename can be given in the global ArConfig object (see Aria::getConfig()) as "Map" in the "Files" section. This handler can also be configured to only send "point" data, "line" data, or both kinds of data from the map.
This service accepts the following data requests:
getMapId getMapName getMap getGoals getMapBinary getMapMultiScans The following data types will also be broadcast to all clients to indicate certain events:
mapUpdated goalsUpdated
The getMapId request replies with... TODO
The getMapName request replies with a packet containing a NULL-terminated string containing the filename of the map, or an empty string ("") if there is no map.
The getMap request replies with a packet containing the map as it appears in the map file (see the documentation for ArMap for the file format).
The getGoals request replies with a series of NULL-terminated strings containing the names of the Goal objects in the map.
The getMapBinary request replies with the map headers and objects list (see ArMap for map file format) as text, but supplies point "DATA" and/or "LINES" as an undelimited sequence of 2-byte integers. (In the case of point data, each pair of integers is a point; for lines, each sequence of four integers defines a line). This binary representation of data is more compact than the ASCII text representation.
The getMapMultiScans request is similar to getMapBinary, but it includes a list of the scan sources, along with the point and lines for each scan source in binary format.
The mapUpdated packet is sent to all connected clients whenever a new map is loaded or the map is changed. The packet contains no data; the new map can be downloaded using one of the above requests.
The goalsUpdated packet is sent to all connected clients whenever the list of Goal objects changes in the map or a new map is loaded. The packet contains no data; the new list of goals can be downloaded using getGoals, or by downloading the entire map.
| ArServerHandlerMap::ArServerHandlerMap | ( | ArServerBase * | server, | |
| ArMapInterface * | arMap = NULL, |
|||
| DataToSend | dataToSend = BOTH | |||
| ) |
Constructor.
| server | the server to add our data too | |
| arMap | If this points to a map file then this will simply serve up that map file and add in a map changed cb for that map, otherwise it'll operate via the Aria::getConfig. | |
| dataToSend | Which data to send, just the lines, the points, or both |
| ArServerHandlerMap::~ArServerHandlerMap | ( | ) | [virtual] |
Destructor.
| DataToSend ArServerHandlerMap::getDataToSend | ( | void | ) | [inline] |
Gets which kind of data we send.
| ArMapInterface * ArServerHandlerMap::getMap | ( | void | ) |
Gets the map object this is using.
| void ArServerHandlerMap::handleCheckMap | ( | ArServerClient * | client, | |
| ArNetPacket * | packet | |||
| ) | [protected] |
| bool ArServerHandlerMap::loadMap | ( | const char * | mapFile | ) |
Loads the map from a file.
| void ArServerHandlerMap::mapChanged | ( | void | ) | [protected] |
| bool ArServerHandlerMap::processFile | ( | void | ) | [protected] |
For internal use only.
| void ArServerHandlerMap::sendMapWithMaxCategory | ( | ArServerClient * | client, | |
| const char * | maxCategory | |||
| ) | [protected] |
| void ArServerHandlerMap::serverGetGoals | ( | ArServerClient * | client, | |
| ArNetPacket * | packet | |||
| ) |
The command that'll get the goals.
For internal use only.
| void ArServerHandlerMap::serverGetMap | ( | ArServerClient * | client, | |
| ArNetPacket * | packet | |||
| ) |
The command that'll get the map itself.
For internal use only.
| void ArServerHandlerMap::serverGetMapBinary | ( | ArServerClient * | client, | |
| ArNetPacket * | packet | |||
| ) |
The command that gets the map, with the data in binary format for improved performance.
| void ArServerHandlerMap::serverGetMapId | ( | ArServerClient * | client, | |
| ArNetPacket * | packet | |||
| ) |
Handles the request for the map ID.
For internal use only.
| void ArServerHandlerMap::serverGetMapMultiScans | ( | ArServerClient * | client, | |
| ArNetPacket * | packet | |||
| ) |
Requests that the server send the map, including scan data for multiple sources if available.
| void ArServerHandlerMap::serverGetMapName | ( | ArServerClient * | client, | |
| ArNetPacket * | packet | |||
| ) |
The command that gets the map name.
For internal use only.
| void ArServerHandlerMap::serverGetMapWithMaxCategory | ( | ArServerClient * | client, | |
| ArNetPacket * | packet | |||
| ) |
Requests that the server send the map with the specified maximum features.
| void ArServerHandlerMap::setDataToSend | ( | DataToSend | dataToSend | ) | [inline] |
Sets which kind of data we send.
| void ArServerHandlerMap::useMap | ( | ArMapInterface * | mapObj, | |
| bool | takeOwnershipOfMap = false | |||
| ) |
Uses a map already loaded.
| void ArServerHandlerMap::writeLinesToClient | ( | int | lineCount, | |
| std::vector< ArLineSegment > * | lines, | |||
| ArServerClient * | client | |||
| ) | [protected] |
For internal use only.
| void ArServerHandlerMap::writeMapToClient | ( | const char * | line, | |
| ArServerClient * | client | |||
| ) | [protected] |
For internal use only.
| void ArServerHandlerMap::writePointsToClient | ( | int | pointCount, | |
| std::vector< ArPose > * | points, | |||
| ArServerClient * | client | |||
| ) | [protected] |
For internal use only.
bool ArServerHandlerMap::myAlreadyLoaded [protected] |
ArFunctor2C<ArServerHandlerMap, ArServerClient *, ArNetPacket *> ArServerHandlerMap::myCheckMapCB [protected] |
DataToSend ArServerHandlerMap::myDataToSend [protected] |
ArFunctor2C<ArServerHandlerMap, ArServerClient *, ArNetPacket *> ArServerHandlerMap::myGetGoalsCB [protected] |
ArFunctor2C<ArServerHandlerMap, ArServerClient *, ArNetPacket *> ArServerHandlerMap::myGetMapBinaryCB [protected] |
ArFunctor2C<ArServerHandlerMap, ArServerClient *, ArNetPacket *> ArServerHandlerMap::myGetMapCB [protected] |
ArFunctor2C<ArServerHandlerMap, ArServerClient *, ArNetPacket *> ArServerHandlerMap::myGetMapIdCB [protected] |
ArFunctor2C<ArServerHandlerMap, ArServerClient *, ArNetPacket *> ArServerHandlerMap::myGetMapMaxCategoryCB [protected] |
ArFunctor2C<ArServerHandlerMap, ArServerClient *, ArNetPacket *> ArServerHandlerMap::myGetMapMultiScansCB [protected] |
ArFunctor2C<ArServerHandlerMap, ArServerClient *, ArNetPacket *> ArServerHandlerMap::myGetMapNameCB [protected] |
char ArServerHandlerMap::myLastMapFile[1024] [protected] |
struct stat ArServerHandlerMap::myLastMapFileStat [protected] |
ArMapInterface* ArServerHandlerMap::myMap [protected] |
char ArServerHandlerMap::myMapFileName[512] [protected] |
std::string ArServerHandlerMap::myMapName [protected] |
bool ArServerHandlerMap::myOwnMap [protected] |
ArRetFunctorC<bool, ArServerHandlerMap> ArServerHandlerMap::myProcessFileCB [protected] |
ArServerBase* ArServerHandlerMap::myServer [protected] |
ArServerHandlerMap* ArServerHandlerMap::myServerHandlerMap [protected] |
1.4.7