#include <ArClientBase.h>
Inheritance diagram for ArClientBase:

You need to connect a client to a server using blockingConnect() with the address for the server. Then you should add handlers to the client to receive information from the server (with addHandler(), request(), and requestOnce()). Then call run() or runAsync() (or loopOnce() if you really know what you're doing). You can also add a callback that will get called every cycle of the client.
User and password information may be required by the server. For details on that see ArServerBase. The most important thing is the modification to blockingConnect(), it can now take a user and password argument and upon failure you'll want to check wasRejected() to determine whether the client couldn't find the server or if the user and password were rejected. Another relevant function is setServerKey() to set the key (string of text) we need to connect to the server.
This class should be thread safe... The only thing you cannot do is call 'addHandler' or 'remHandler' from within a handler for that specific piece of data.
Public Types | |
| enum | { CLIENT_KEY_LENGTH = 16 } |
| CLIENT_KEY_LENGTH = 16 | |
| enum | ClientState { STATE_NO_CONNECTION, STATE_FAILED_CONNECTION, STATE_OPENED_SOCKET, STATE_EXCHANGED_INTROS, STATE_REJECTED, STATE_WAITING_LIST, STATE_CONNECTED, STATE_LOST_CONNECTION } |
| The state of the connection. More... | |
| NON_BLOCKING_CONNECTED | |
| Client connected. | |
| NON_BLOCKING_CONTINUE | |
| Client didn't connect or fail to connect yet. | |
| NON_BLOCKING_FAILED | |
| Client couldn't connect. | |
| enum | NonBlockingConnectReturn { NON_BLOCKING_CONTINUE, NON_BLOCKING_CONNECTED, NON_BLOCKING_FAILED } |
| STATE_CONNECTED | |
| Client is connected to server. | |
| STATE_EXCHANGED_INTROS | |
| Client and server have exchanged introductions. | |
| STATE_FAILED_CONNECTION | |
| The client tried to connect and failed. | |
| STATE_LOST_CONNECTION | |
| Client lost connection to server. | |
| STATE_NO_CONNECTION | |
| The client has not connected. | |
| STATE_OPENED_SOCKET | |
| Client opened socket, waiting for intro from srvr. | |
| STATE_REJECTED | |
| Client was rejected by server. | |
| STATE_WAITING_LIST | |
| Client was connected to server, waiting for list. | |
Public Member Functions | |
| void | addCycleCallback (ArFunctor *functor) |
| Adds a functor to call every cycle. | |
| void | addDisconnectOnErrorCB (ArFunctor *functor, ArListPos::Pos position=ArListPos::LAST) |
| Adds a call for when a disconnection has occured because of error. | |
| bool | addHandler (const char *name, ArFunctor1< ArNetPacket * > *functor) |
| Adds a functor for some particular data. | |
| void | addServerShutdownCB (ArFunctor *functor, ArListPos::Pos position=ArListPos::LAST) |
| Adds a call for when the server shuts down. | |
| ArClientBase () | |
| Constructor. | |
| bool | blockingConnect (const char *host, int port, bool print=true, const char *user=NULL, const char *password=NULL, const char *openOnIP=NULL) |
| Connect to a server. | |
| bool | dataExists (const char *name) |
| Sees if this data exists. | |
| bool | disconnect (void) |
| This method blocks while the connection is being shutdown. | |
| void | disconnectSoon (void) |
| This method does not block while the connection is being shutdown, and the disconnect only happens the next time the client base is in its loop. | |
| unsigned int | findCommandFromName (const char *name) |
| Returns the command number from the name. | |
| void | finishNonBlockingDisconnect () |
| This method should be used in conjunction with startNonBlockingDisconnect in threads that should not block (such as the main GUI thread). | |
| void | getClientKey (unsigned char key[CLIENT_KEY_LENGTH]) |
| Gets a (probably) unique key that can be used to identify the client (after connection). | |
| int | getConnectTimeoutTime (void) |
| Gets the time allowed for connection. | |
| const std::map< unsigned int, ArClientData * > * | getDataMap (void) |
| Internal function get get the data map. | |
| bool | getDebugLogging (void) |
| Returns if we're doing debug logging or not. | |
| const char * | getHost (void) |
| Gets the name of the host we tried to connect to. | |
| ArTime | getLastPacketReceived (void) |
| Gets the last time a packet was received. | |
| virtual const char * | getLogPrefix () const |
| Returns the entire string used to prefix log entries for this client base. | |
| const char * | getName (unsigned int command, bool internalCall=false) |
| Gets the name of the data a command is. | |
| const char * | getName (ArNetPacket *packet, bool internalCall=false) |
| Gets the name of the data a packet is for. | |
| bool | getReceivedArgRetList (void) |
| Gets if we received the list of arguments and. | |
| bool | getReceivedDataList (void) |
| Gets if we received the list of commands. | |
| bool | getReceivedGroupAndFlagsList (void) |
| Gets if we received the list of commands. | |
| int | getRejected (void) |
| Tells us the reason the connection was rejected (see ArServerCommands for details). | |
| const char * | getRejectedString (void) |
| Tells us the reason the connection was rejected (see ArServerCommands for details). | |
| virtual const char * | getRobotName () const |
| Returns the optional name of the connected robot for debugging purposes. | |
| ClientState | getState (void) |
| Gets the state of the client. | |
| in_addr * | getTcpAddr (void) |
| Internal function to get the socket (no one should need this). | |
| ArSocket * | getTcpSocket (void) |
| Internal function to get the tcp socket. | |
| ArSocket * | getUdpSocket (void) |
| Internal function to get the udp socket. | |
| bool | internalBlockingConnect (const char *host, int port, bool print, const char *user, const char *password, ArSocket *tcpSocket, const char *openOnIP=NULL) |
| Internal function that'll do the connection (mainly for switch connections). | |
| NonBlockingConnectReturn | internalNonBlockingConnectContinue (void) |
| Internal function that'll start the non blocking connection (mainly for switch connections). | |
| NonBlockingConnectReturn | internalNonBlockingConnectStart (const char *host, int port, bool print, const char *user, const char *password, ArSocket *tcpSocket, const char *openOnIP=NULL) |
| Internal function that'll start the non blocking connection (mainly for switch connections). | |
| bool | isConnected (void) |
| virtual bool | isStopped () |
| Returns whether the client has been stopped (regardless of whether its in its own thread). | |
| bool | isTcpOnlyFromServer (void) |
| Returns whether we only get TCP data from the server not UDP. | |
| bool | isTcpOnlyToServer (void) |
| Returns whether we only send TCP data to the server. | |
| void | logDataList (void) |
| Print out or data with descriptions. | |
| void | logTracking (bool terse) |
| Logs the tracking information (packet and byte counts). | |
| void | loopOnce (void) |
| Run the loop once. | |
| void | processPacket (ArNetPacket *packet, bool tcp) |
| Process the packet wherever it came from. | |
| void | processPacketUdp (ArNetPacket *packet, struct sockaddr_in *sin) |
| Process a packet from udp (just hands off to processPacket). | |
| void | remCycleCallback (ArFunctor *functor) |
| Removes a functor called every cycle. | |
| void | remDisconnectOnErrorCB (ArFunctor *functor) |
| Removes a call for when a disconnection has occured because of error. | |
| bool | remHandler (const char *name, ArFunctor1< ArNetPacket * > *functor) |
| Removes a functor for some particular data by name. | |
| void | remServerShutdownCB (ArFunctor *functor) |
| Removes a call for when the server shuts down. | |
| bool | request (const char *name, long mSec, ArNetPacket *packet=NULL) |
| Request some data every mSec milliseconds. | |
| bool | requestByCommand (unsigned int command, long mSec, ArNetPacket *packet=NULL) |
| Request some data every mSec milliseconds by command not name. | |
| bool | requestOnce (const char *name, ArNetPacket *packet=NULL, bool quiet=false) |
| Request some data (or send a command) just once. | |
| bool | requestOnceByCommand (unsigned int command, ArNetPacket *packet=NULL) |
| Request some data (or send a command) just once by command not name. | |
| bool | requestOnceByCommandUdp (unsigned int command, ArNetPacket *packet=NULL) |
| Request some data (or send a command) just once by command not name. | |
| bool | requestOnceUdp (const char *name, ArNetPacket *packet=NULL, bool quiet=false) |
| Request some data (or send a command) just once by UDP. | |
| bool | requestOnceWithString (const char *name, const char *str) |
| Request some data (or send a command) just once with a string as argument. | |
| bool | requestStop (const char *name) |
| Don't want this data anymore. | |
| bool | requestStopByCommand (unsigned int command) |
| Don't want this data anymore, by command not name. | |
| void | resetTracking (void) |
| Clears the tracking information (resets counters). | |
| virtual void | run (void) |
| Runs the client in this thread. | |
| virtual void | runAsync (void) |
| Runs the client in its own thread. | |
| virtual void * | runThread (void *arg) |
| bool | sendPacketTcp (ArNetPacket *packet) |
| Send a packet over TCP. | |
| bool | sendPacketUdp (ArNetPacket *packet) |
| Send a packet over UDP (unless client only wants tcp then sends over tcp). | |
| void | setBackupTimeout (double timeoutInMins) |
| Sets the backup timeout. | |
| void | setConnectTimeoutTime (int sec) |
| Sets the time to allow for connection (default 3). | |
| virtual void | setRobotName (const char *name, bool debugLogging=false, int robotId=0) |
| Sets the optional name of the connected robot for debugging purposes. | |
| void | setServerKey (const char *serverKey, bool print=true) |
| Sets the 'key' needed to connect to the server. | |
| void | setTcpOnlyFromServer (void) |
| Sets it so we only get TCP data from the server not UDP. | |
| void | setTcpOnlyToServer (void) |
| Sets it so we only send TCP data to the server. | |
| bool | startNonBlockingDisconnect () |
| This method should be called in threads that should not block (such as the main GUI thread). | |
| virtual void | stopRunning (void) |
| Stops the thread and sets the stopped flag. | |
| bool | wasRejected (void) |
| virtual | ~ArClientBase () |
| Destructor. | |
Protected Types | |
| NON_BLOCKING_STATE_NONE | |
| NON_BLOCKING_STATE_TCP | |
| NON_BLOCKING_STATE_UDP | |
| enum | NonBlockingConnectState { NON_BLOCKING_STATE_NONE, NON_BLOCKING_STATE_TCP, NON_BLOCKING_STATE_UDP } |
Protected Member Functions | |
| void | buildList (ArNetPacket *packet) |
| void | clear (void) |
| bool | internalConnect (const char *host, int port, bool obsolete, const char *openOnIP) |
| void | internalStartUdp (void) |
| void | internalSwitchState (ClientState state) |
| bool | setupPacket (ArNetPacket *packet) |
| void | trackPacketReceived (ArNetPacket *packet, bool tcp) |
| void | trackPacketSent (ArNetPacket *packet, bool tcp) |
Protected Attributes | |
| long | myAuthKey |
| double | myBackupTimeout |
| ArMutex | myCallbackMutex |
| unsigned char | myClientKey [16] |
| ArMutex | myClientMutex |
| ArMutex | myCycleCallbackMutex |
| std::list< ArFunctor * > | myCycleCallbacks |
| ArMutex | myDataMutex |
| bool | myDebugLogging |
| std::list< ArFunctor * > | myDisconnectOnErrorCBList |
| bool | myDisconnectSoon |
| std::string | myHost |
| std::map< unsigned int, ArClientData * > | myIntDataMap |
| long | myIntroKey |
| bool | myIsRunningAsync |
| bool | myIsStartedDisconnect |
| bool | myIsStopped |
| ArTime | myLastPacketReceived |
| std::string | myLogPrefix |
| Optional prefix to be inserted at the start of log messages. | |
| ArMutex | myMapsMutex |
| std::map< std::string, unsigned int > | myNameIntMap |
| NonBlockingConnectState | myNonBlockingConnectState |
| ArMutex | myPacketTrackingMutex |
| std::string | myPassword |
| ArFunctor2C< ArClientBase, ArNetPacket *, bool > | myProcessPacketCB |
| ArFunctor2C< ArClientBase, ArNetPacket *, struct sockaddr_in * > | myProcessPacketUdpCB |
| bool | myQuiet |
| bool | myReceivedArgRetList |
| bool | myReceivedDataList |
| bool | myReceivedGroupAndFlagsList |
| int | myRejected |
| char | myRejectedString [32000] |
| std::string | myRobotName |
| Optional robot name for logging. | |
| std::string | myServerKey |
| unsigned int | myServerReportedUdpPort |
| unsigned int | myServerSentUdpPort |
| std::list< ArFunctor * > | myServerShutdownCBList |
| ArTime | myStartedConnection |
| ArTime | myStartedShutdown |
| ArTime | myStartedUdpConnection |
| ClientState | myState |
| ArMutex | myStateMutex |
| ArTime | myStateStarted |
| bool | myTcpOnlyFrom |
| bool | myTcpOnlyTo |
| ArNetPacketReceiverTcp | myTcpReceiver |
| ArNetPacketSenderTcp | myTcpSender |
| ArSocket | myTcpSocket |
| int | myTimeoutTime |
| std::map< unsigned int, Tracker * > | myTrackingReceivedMap |
| std::map< unsigned int, Tracker * > | myTrackingSentMap |
| ArTime | myTrackingStarted |
| bool | myUdpConfirmedFrom |
| bool | myUdpConfirmedTo |
| unsigned int | myUdpPort |
| ArNetPacketReceiverUdp | myUdpReceiver |
| sockaddr_in | myUdpSin |
| bool | myUdpSinValid |
| ArSocket | myUdpSocket |
| std::string | myUser |
| ArLog::LogLevel | myVerboseLogLevel |
Classes | |
| class | Tracker |
The state of the connection.
enum ArClientBase::NonBlockingConnectState [protected] |
| ArClientBase::ArClientBase | ( | ) |
Constructor.
| ArClientBase::~ArClientBase | ( | ) | [virtual] |
Destructor.
| void ArClientBase::addCycleCallback | ( | ArFunctor * | functor | ) |
Adds a functor to call every cycle.
You cannot add a cycle callback from within a cycle or it will deadlock
| functor | callback to add |
| void ArClientBase::addDisconnectOnErrorCB | ( | ArFunctor * | functor, | |
| ArListPos::Pos | position = ArListPos::LAST | |||
| ) |
Adds a call for when a disconnection has occured because of error.
| functor | functor created from ArFunctorC which refers to the function to call. | |
| position | whether to place the functor first or last |
| bool ArClientBase::addHandler | ( | const char * | name, | |
| ArFunctor1< ArNetPacket * > * | functor | |||
| ) |
Adds a functor for some particular data.
Note that if you try and add a handler for a specific piece of data from within a handler for that specific piece of data you'll deadlock.
| name | the name of the data to use with this functor | |
| functor | the functor to call with the packet when data with this name arrives |
Python Wrapper Library: Pass a function taking one argument for
| void ArClientBase::addServerShutdownCB | ( | ArFunctor * | functor, | |
| ArListPos::Pos | position = ArListPos::LAST | |||
| ) |
Adds a call for when the server shuts down.
| functor | functor created from ArFunctorC which refers to the function to call. | |
| position | whether to place the functor first or last |
| bool ArClientBase::blockingConnect | ( | const char * | host, | |
| int | port, | |||
| bool | print = true, |
|||
| const char * | user = NULL, |
|||
| const char * | password = NULL, |
|||
| const char * | openOnIP = NULL | |||
| ) |
Connect to a server.
| host | the host to connect to | |
| port | the port to connect on | |
| whether to print out our connection information or not (you'll usually want to use the default argument of true, only here for some more advanced internal things), this carries over to things like disconnect printing too | ||
| user | user name, or NULL for none. | |
| password | password (cleartext), or NULL for none. | |
| openOnIP | address of the local network interface to use for the outgoing connection, or NULL for any/all. |
| void ArClientBase::buildList | ( | ArNetPacket * | packet | ) | [protected] |
| void ArClientBase::clear | ( | void | ) | [protected] |
| bool ArClientBase::dataExists | ( | const char * | name | ) |
Sees if this data exists.
| name | the name to stop sending |
| bool ArClientBase::disconnect | ( | void | ) |
This method blocks while the connection is being shutdown.
| void ArClientBase::disconnectSoon | ( | void | ) |
This method does not block while the connection is being shutdown, and the disconnect only happens the next time the client base is in its loop.
| unsigned int ArClientBase::findCommandFromName | ( | const char * | name | ) |
Returns the command number from the name.
| name | the name of the data to find the command of |
| void ArClientBase::finishNonBlockingDisconnect | ( | ) |
This method should be used in conjunction with startNonBlockingDisconnect in threads that should not block (such as the main GUI thread).
| void ArClientBase::getClientKey | ( | unsigned char | key[CLIENT_KEY_LENGTH] | ) |
Gets a (probably) unique key that can be used to identify the client (after connection).
| int ArClientBase::getConnectTimeoutTime | ( | void | ) |
Gets the time allowed for connection.
| const std::map<unsigned int, ArClientData *>* ArClientBase::getDataMap | ( | void | ) | [inline] |
Internal function get get the data map.
| bool ArClientBase::getDebugLogging | ( | void | ) |
Returns if we're doing debug logging or not.
| const char * ArClientBase::getHost | ( | void | ) |
| ArTime ArClientBase::getLastPacketReceived | ( | void | ) |
Gets the last time a packet was received.
| const char * ArClientBase::getLogPrefix | ( | ) | const [virtual] |
Returns the entire string used to prefix log entries for this client base.
| const char * ArClientBase::getName | ( | unsigned int | command, | |
| bool | internalCall = false | |||
| ) |
Gets the name of the data a command is.
| const char * ArClientBase::getName | ( | ArNetPacket * | packet, | |
| bool | internalCall = false | |||
| ) |
Gets the name of the data a packet is for.
| bool ArClientBase::getReceivedArgRetList | ( | void | ) | [inline] |
Gets if we received the list of arguments and.
| bool ArClientBase::getReceivedDataList | ( | void | ) | [inline] |
Gets if we received the list of commands.
| bool ArClientBase::getReceivedGroupAndFlagsList | ( | void | ) | [inline] |
Gets if we received the list of commands.
| int ArClientBase::getRejected | ( | void | ) | [inline] |
Tells us the reason the connection was rejected (see ArServerCommands for details).
| const char* ArClientBase::getRejectedString | ( | void | ) | [inline] |
Tells us the reason the connection was rejected (see ArServerCommands for details).
| const char * ArClientBase::getRobotName | ( | ) | const [virtual] |
Returns the optional name of the connected robot for debugging purposes.
| ClientState ArClientBase::getState | ( | void | ) | [inline] |
Gets the state of the client.
| struct in_addr* ArClientBase::getTcpAddr | ( | void | ) | [inline] |
Internal function to get the socket (no one should need this).
| ArSocket* ArClientBase::getTcpSocket | ( | void | ) | [inline] |
Internal function to get the tcp socket.
| ArSocket* ArClientBase::getUdpSocket | ( | void | ) | [inline] |
Internal function to get the udp socket.
| bool ArClientBase::internalBlockingConnect | ( | const char * | host, | |
| int | port, | |||
| bool | print, | |||
| const char * | user, | |||
| const char * | password, | |||
| ArSocket * | tcpSocket, | |||
| const char * | openOnIP = NULL | |||
| ) |
Internal function that'll do the connection (mainly for switch connections).
| bool ArClientBase::internalConnect | ( | const char * | host, | |
| int | port, | |||
| bool | obsolete, | |||
| const char * | openOnIP | |||
| ) | [protected] |
| ArClientBase::NonBlockingConnectReturn ArClientBase::internalNonBlockingConnectContinue | ( | void | ) |
Internal function that'll start the non blocking connection (mainly for switch connections).
| ArClientBase::NonBlockingConnectReturn ArClientBase::internalNonBlockingConnectStart | ( | const char * | host, | |
| int | port, | |||
| bool | print, | |||
| const char * | user, | |||
| const char * | password, | |||
| ArSocket * | tcpSocket, | |||
| const char * | openOnIP = NULL | |||
| ) |
Internal function that'll start the non blocking connection (mainly for switch connections).
| void ArClientBase::internalStartUdp | ( | void | ) | [protected] |
| void ArClientBase::internalSwitchState | ( | ClientState | state | ) | [protected] |
| bool ArClientBase::isConnected | ( | void | ) | [inline] |
| bool ArClientBase::isStopped | ( | ) | [virtual] |
Returns whether the client has been stopped (regardless of whether its in its own thread).
| bool ArClientBase::isTcpOnlyFromServer | ( | void | ) |
Returns whether we only get TCP data from the server not UDP.
| bool ArClientBase::isTcpOnlyToServer | ( | void | ) |
Returns whether we only send TCP data to the server.
| void ArClientBase::logDataList | ( | void | ) |
Print out or data with descriptions.
| void ArClientBase::logTracking | ( | bool | terse | ) |
Logs the tracking information (packet and byte counts).
| void ArClientBase::loopOnce | ( | void | ) |
Run the loop once.
| void ArClientBase::processPacket | ( | ArNetPacket * | packet, | |
| bool | tcp | |||
| ) |
Process the packet wherever it came from.
see if we've opened the socket and this is an intro
| void ArClientBase::processPacketUdp | ( | ArNetPacket * | packet, | |
| struct sockaddr_in * | sin | |||
| ) |
Process a packet from udp (just hands off to processPacket).
| void ArClientBase::remCycleCallback | ( | ArFunctor * | functor | ) |
Removes a functor called every cycle.
| functor | callback to remove |
| void ArClientBase::remDisconnectOnErrorCB | ( | ArFunctor * | functor | ) |
Removes a call for when a disconnection has occured because of error.
| functor | the functor to remove from the list of connect callbacks |
| bool ArClientBase::remHandler | ( | const char * | name, | |
| ArFunctor1< ArNetPacket * > * | functor | |||
| ) |
Removes a functor for some particular data by name.
Note that if you try and remove a handler for a specific piece of data from within a handler for that specific piece of data you'll deadlock.
| name | the name of the data to use with this functor | |
| functor | the functor to call with the packet when data with this name arrives |
| void ArClientBase::remServerShutdownCB | ( | ArFunctor * | functor | ) |
Removes a call for when the server shuts down.
| functor | the functor to remove from the list of connect callbacks |
| bool ArClientBase::request | ( | const char * | name, | |
| long | mSec, | |||
| ArNetPacket * | packet = NULL | |||
| ) |
Request some data every mSec milliseconds.
| name | the name of the data to request from the server | |
| mSec | request interval: the number of milliseconds we want a refresh on this data, if this number is 0 then the server will send the information as often as it is available; if -1, then the server will send the information only when it changes (for broadcast type packets) | |
| packet | a packet to use for the request, may contain data to use as parameters or arguments along with the request. |
| bool ArClientBase::requestByCommand | ( | unsigned int | command, | |
| long | mSec, | |||
| ArNetPacket * | packet = NULL | |||
| ) |
Request some data every mSec milliseconds by command not name.
| command | the command number of the data to request | |
| mSec | the number of milliseconds we want a refresh on this data, if this number is 0 then the server will send the information as often as it is available; if -1, then the server will send the information only when it changes (for broadcast type packets) | |
| packet | the packet that contains the data to use as argument |
| bool ArClientBase::requestOnce | ( | const char * | name, | |
| ArNetPacket * | packet = NULL, |
|||
| bool | quiet = false | |||
| ) |
Request some data (or send a command) just once.
.. this is useful for things like video data that you don't want to clog up the bandwidth with... its also useful for things like sending commands
| name | the name of the data to request | |
| packet | the packet that contains the data to use as argument | |
| quiet | a bool set to true to override the verbose logging of this method (generally for repeating requests); default is false to log. |
| bool ArClientBase::requestOnceByCommand | ( | unsigned int | command, | |
| ArNetPacket * | packet = NULL | |||
| ) |
Request some data (or send a command) just once by command not name.
.. this is useful for things like video data that you don't want to clog up the bandwidth with... its also useful for things like sending commands
| command | the command number to request | |
| packet | the packet that contains the data to use as argument |
| bool ArClientBase::requestOnceByCommandUdp | ( | unsigned int | command, | |
| ArNetPacket * | packet = NULL | |||
| ) |
Request some data (or send a command) just once by command not name.
.. this is useful for things like video data that you don't want to clog up the bandwidth with... its also useful for things like sending commands
| command | the command number to request | |
| packet | the packet that contains the data to use as argument |
| bool ArClientBase::requestOnceUdp | ( | const char * | name, | |
| ArNetPacket * | packet = NULL, |
|||
| bool | quiet = false | |||
| ) |
Request some data (or send a command) just once by UDP.
For example, use this method for certain kinds of data where constant streaming would be undesirable (e.g. video images that might saturate the network), or for sending a simple command. Note that since the request is sent using UDP, you cannot assume it will get there or that you will get a response.
| name | the name of the data to request | |
| packet | the packet that contains the data to use as argument | |
| quiet | If true, suppress verbose-level log message |
| bool ArClientBase::requestOnceWithString | ( | const char * | name, | |
| const char * | str | |||
| ) |
Request some data (or send a command) just once with a string as argument.
.. this is useful for things like video data that you don't want to clog up the bandwidth with... its also useful for things like sending commands
| name | the name of the data to request | |
| str | a string to send as the packet argument |
| bool ArClientBase::requestStop | ( | const char * | name | ) |
Don't want this data anymore.
| name | the name to stop sending |
| bool ArClientBase::requestStopByCommand | ( | unsigned int | command | ) |
Don't want this data anymore, by command not name.
| command | the command number to stop |
| void ArClientBase::resetTracking | ( | void | ) |
Clears the tracking information (resets counters).
| void ArClientBase::run | ( | void | ) | [virtual] |
| void ArClientBase::runAsync | ( | void | ) | [virtual] |
Runs the client in its own thread.
Reimplemented from ArASyncTask.
| void * ArClientBase::runThread | ( | void * | arg | ) | [virtual] |
Implements ArASyncTask.
| bool ArClientBase::sendPacketTcp | ( | ArNetPacket * | packet | ) |
Send a packet over TCP.
| bool ArClientBase::sendPacketUdp | ( | ArNetPacket * | packet | ) |
Send a packet over UDP (unless client only wants tcp then sends over tcp).
| void ArClientBase::setBackupTimeout | ( | double | timeoutInMins | ) |
Sets the backup timeout.
Less than 0 means this won't happen. If this is positive but less than 5 seconds then 5 seconds is used.
| void ArClientBase::setConnectTimeoutTime | ( | int | sec | ) |
Sets the time to allow for connection (default 3).
| sec | This value controls how long the client will give to connect, it is the argument in number of seconds... if <= 0 then no timeout will take place. |
| void ArClientBase::setRobotName | ( | const char * | name, | |
| bool | debugLogging = false, |
|||
| int | robotId = 0 | |||
| ) | [virtual] |
Sets the optional name of the connected robot for debugging purposes.
| name | an optional char * name of the connected robot to be used in the log messages | |
| debugLogging | a bool set to true if log messages should be written at the Normal level, if false, then they are written as Verbose | |
| robotId | an optional int which can be appended to the robot name in the log messages; if 0, then only the robot name is logged |
| void ArClientBase::setServerKey | ( | const char * | serverKey, | |
| bool | print = true | |||
| ) |
Sets the 'key' needed to connect to the server.
| void ArClientBase::setTcpOnlyFromServer | ( | void | ) |
Sets it so we only get TCP data from the server not UDP.
| void ArClientBase::setTcpOnlyToServer | ( | void | ) |
Sets it so we only send TCP data to the server.
| bool ArClientBase::setupPacket | ( | ArNetPacket * | packet | ) | [protected] |
| bool ArClientBase::startNonBlockingDisconnect | ( | ) |
This method should be called in threads that should not block (such as the main GUI thread).
The call should be followed by a delay of one second, followed by a call to finishNonBlockingDisconnect().
| void ArClientBase::stopRunning | ( | void | ) | [virtual] |
| void ArClientBase::trackPacketReceived | ( | ArNetPacket * | packet, | |
| bool | tcp | |||
| ) | [protected] |
| void ArClientBase::trackPacketSent | ( | ArNetPacket * | packet, | |
| bool | tcp | |||
| ) | [protected] |
| bool ArClientBase::wasRejected | ( | void | ) | [inline] |
long ArClientBase::myAuthKey [protected] |
double ArClientBase::myBackupTimeout [protected] |
ArMutex ArClientBase::myCallbackMutex [protected] |
unsigned char ArClientBase::myClientKey[16] [protected] |
ArMutex ArClientBase::myClientMutex [protected] |
ArMutex ArClientBase::myCycleCallbackMutex [protected] |
std::list<ArFunctor *> ArClientBase::myCycleCallbacks [protected] |
ArMutex ArClientBase::myDataMutex [protected] |
bool ArClientBase::myDebugLogging [protected] |
std::list<ArFunctor *> ArClientBase::myDisconnectOnErrorCBList [protected] |
bool ArClientBase::myDisconnectSoon [protected] |
std::string ArClientBase::myHost [protected] |
std::map<unsigned int, ArClientData *> ArClientBase::myIntDataMap [protected] |
long ArClientBase::myIntroKey [protected] |
bool ArClientBase::myIsRunningAsync [protected] |
bool ArClientBase::myIsStartedDisconnect [protected] |
bool ArClientBase::myIsStopped [protected] |
ArTime ArClientBase::myLastPacketReceived [protected] |
std::string ArClientBase::myLogPrefix [protected] |
Optional prefix to be inserted at the start of log messages.
ArMutex ArClientBase::myMapsMutex [protected] |
std::map<std::string, unsigned int> ArClientBase::myNameIntMap [protected] |
ArMutex ArClientBase::myPacketTrackingMutex [protected] |
std::string ArClientBase::myPassword [protected] |
ArFunctor2C<ArClientBase, ArNetPacket *, bool> ArClientBase::myProcessPacketCB [protected] |
ArFunctor2C<ArClientBase, ArNetPacket *, struct sockaddr_in *> ArClientBase::myProcessPacketUdpCB [protected] |
bool ArClientBase::myQuiet [protected] |
bool ArClientBase::myReceivedArgRetList [protected] |
bool ArClientBase::myReceivedDataList [protected] |
bool ArClientBase::myReceivedGroupAndFlagsList [protected] |
int ArClientBase::myRejected [protected] |
char ArClientBase::myRejectedString[32000] [protected] |
std::string ArClientBase::myRobotName [protected] |
Optional robot name for logging.
std::string ArClientBase::myServerKey [protected] |
unsigned int ArClientBase::myServerReportedUdpPort [protected] |
unsigned int ArClientBase::myServerSentUdpPort [protected] |
std::list<ArFunctor *> ArClientBase::myServerShutdownCBList [protected] |
ArTime ArClientBase::myStartedConnection [protected] |
ArTime ArClientBase::myStartedShutdown [protected] |
ArTime ArClientBase::myStartedUdpConnection [protected] |
ClientState ArClientBase::myState [protected] |
ArMutex ArClientBase::myStateMutex [protected] |
ArTime ArClientBase::myStateStarted [protected] |
bool ArClientBase::myTcpOnlyFrom [protected] |
bool ArClientBase::myTcpOnlyTo [protected] |
ArNetPacketReceiverTcp ArClientBase::myTcpReceiver [protected] |
ArNetPacketSenderTcp ArClientBase::myTcpSender [protected] |
ArSocket ArClientBase::myTcpSocket [protected] |
int ArClientBase::myTimeoutTime [protected] |
std::map<unsigned int, Tracker *> ArClientBase::myTrackingReceivedMap [protected] |
std::map<unsigned int, Tracker *> ArClientBase::myTrackingSentMap [protected] |
ArTime ArClientBase::myTrackingStarted [protected] |
bool ArClientBase::myUdpConfirmedFrom [protected] |
bool ArClientBase::myUdpConfirmedTo [protected] |
unsigned int ArClientBase::myUdpPort [protected] |
ArNetPacketReceiverUdp ArClientBase::myUdpReceiver [protected] |
struct sockaddr_in ArClientBase::myUdpSin [protected] |
bool ArClientBase::myUdpSinValid [protected] |
ArSocket ArClientBase::myUdpSocket [protected] |
std::string ArClientBase::myUser [protected] |
ArLog::LogLevel ArClientBase::myVerboseLogLevel [protected] |
1.4.7