#include <ArClientHandlerConfig.h>
ArClientHandlerConfig processes the network packets that describe a robot's ArConfig. It also provides a means to save the modified configuration data to the robot server. This class is designed to work in conjunction with the ArServerHandlerConfig. See the server handler documentation for a complete description of the networking interface.
This class should be thread safe, with the exception of unThreadSafeGetConfig. (If you want to use this method, surround it with calls to lock() and unlock().)
Note that you can't add callbacks or remove callbacks from within a callback function.
Public Member Functions | |
void | addGotConfigCB (ArFunctor *functor, ArListPos::Pos position=ArListPos::LAST) |
Adds a gotConfig callback. | |
void | addGotConfigDefaultsCB (ArFunctor *functor, ArListPos::Pos position=ArListPos::LAST) |
Adds a got config defaults callback. | |
void | addSaveConfigFailedCB (ArFunctor1< const char * > *functor, ArListPos::Pos position=ArListPos::LAST) |
Adds a save config to server failed callback. | |
void | addSaveConfigSucceededCB (ArFunctor *functor, ArListPos::Pos position=ArListPos::LAST) |
Adds a save config to server succeeded callback. | |
ArClientHandlerConfig (ArClientBase *client, bool ignoreBounds=false, const char *robotName=NULL) | |
Constructor. | |
bool | canRequestDefaults (void) |
Sees if we can request defaults (both types). | |
ArConfig * | getConfig (void) |
Unthreadsafe way to get the config to play with (see long docs). | |
ArConfig | getConfigCopy (void) |
Threadsafe way to get the config to play with. | |
ArConfig * | getDefaultConfig () |
void | handleGetConfig (ArNetPacket *packet) |
Handles the packet from the getConfig. | |
void | handleGetConfigBySections (ArNetPacket *packet) |
Handles the packet from the GetConfigBySections. | |
void | handleGetConfigDefaults (ArNetPacket *packet) |
Handles the return packet from getConfigDefaults. | |
void | handleGetConfigSectionFlags (ArNetPacket *packet) |
Handles the packet from the GetConfigSectionFlags. | |
void | handleSetConfig (ArNetPacket *packet) |
Handles the return packet from the setConfig (saveConfigToServer). | |
bool | haveGottenConfig (void) |
Returns true if config gotten. | |
bool | haveGottenDefaults (void) |
Returns if we've gotten our requested defaults. | |
bool | haveRequestedDefaults (void) |
Returns if we've requested some defaults. | |
int | lock (void) |
Locks the config for if you're using the unthreadsafe getConfig. | |
void | reloadConfigOnServer (void) |
Tells the server to reload the configuration. | |
void | remGotConfigCB (ArFunctor *functor) |
Removes a gotConfig callback. | |
void | remGotConfigDefaultsCB (ArFunctor *functor) |
Removes a got config defaults callback. | |
void | remSaveConfigFailedCB (ArFunctor1< const char * > *functor) |
Removes a save config to server failed callback. | |
void | remSaveConfigSucceededCB (ArFunctor *functor) |
Removes a save config to server succeeded callback. | |
bool | requestConfigDefaults (void) |
Requests defaults for all sections from the server; modifies the config. | |
void | requestConfigFromServer (void) |
Requests the config from the server. | |
bool | requestDefaultConfigFromServer (void) |
bool | requestSectionDefaults (const char *section) |
Requests defaults for one section from the server; modifies the config. | |
void | saveConfigToServer (ArConfig *config, const std::set< std::string, ArStrCaseCmpOp > *ignoreTheseSections=NULL) |
Sends the config back to the server. | |
void | saveConfigToServer (void) |
Sends the config back to the server. | |
void | setQuiet (bool isQuiet) |
Turn on this flag to reduce the number of verbose log messages. | |
int | tryLock (void) |
Try to lock for the config for if you're using the unthreadsafe getConfig. | |
int | unlock (void) |
Unlocks the config for if you're using the unthreadsafe getConfig. | |
virtual | ~ArClientHandlerConfig (void) |
Destructor. | |
Protected Member Functions | |
void | handleGetConfigData (ArNetPacket *packet, bool isMultiplePackets) |
Protected Attributes | |
ArMutex | myCallbackMutex |
ArClientBase * | myClient |
ArConfig | myConfig |
ArMutex | myDataMutex |
ArConfig * | myDefaultConfig |
std::list< ArFunctor * > | myGotConfigCBList |
std::list< ArFunctor * > | myGotConfigDefaultsCBList |
ArFunctor1C< ArClientHandlerConfig, ArNetPacket * > | myHandleGetConfigBySectionsCB |
ArFunctor1C< ArClientHandlerConfig, ArNetPacket * > | myHandleGetConfigCB |
ArFunctor1C< ArClientHandlerConfig, ArNetPacket * > | myHandleGetConfigDefaultsCB |
ArFunctor1C< ArClientHandlerConfig, ArNetPacket * > | myHandleGetConfigSectionFlagsCB |
ArFunctor1C< ArClientHandlerConfig, ArNetPacket * > | myHandleGetDefaultConfigCB |
ArFunctor1C< ArClientHandlerConfig, ArNetPacket * > | myHandleSetConfigCB |
bool | myHaveGottenConfig |
bool | myHaveGottenDefaults |
bool | myHaveRequestedDefaultCopy |
bool | myHaveRequestedDefaults |
bool | myIsQuiet |
std::string | myLogPrefix |
std::string | myRobotName |
std::list< ArFunctor1< const char * > * > | mySaveConfigFailedCBList |
std::list< ArFunctor * > | mySaveConfigSucceededCBList |