#include <ArRobotPacketReceiver.h>
Public Member Functions | |
| ArRobotPacketReceiver (ArDeviceConnection *deviceConnection, bool allocatePackets=false, unsigned char sync1=0xfa, unsigned char sync2=0xfb) | |
| Constructor with assignment of a device connection. | |
| ArRobotPacketReceiver (bool allocatePackets=false, unsigned char sync1=0xfa, unsigned char sync2=0xfb) | |
| Constructor without an already assigned device connection. | |
| ArDeviceConnection * | getDeviceConnection (void) |
| Gets the device this instance receives packets from. | |
| bool | isAllocatingPackets (void) |
| Gets whether or not the receiver is allocating packets. | |
| ArRobotPacket * | receivePacket (unsigned int msWait=0) |
| Receives a packet from the robot if there is one available. | |
| void | setDeviceConnection (ArDeviceConnection *deviceConnection) |
| Sets the device this instance receives packets from. | |
| virtual | ~ArRobotPacketReceiver () |
| Destructor. | |
Protected Types | |
| enum | { STATE_SYNC1, STATE_SYNC2, STATE_ACQUIRE_DATA } |
| STATE_ACQUIRE_DATA | |
| STATE_SYNC1 | |
| STATE_SYNC2 | |
Protected Attributes | |
| bool | myAllocatePackets |
| ArDeviceConnection * | myDeviceConn |
| ArRobotPacket | myPacket |
| unsigned char | mySync1 |
| unsigned char | mySync2 |
| ArRobotPacketReceiver::ArRobotPacketReceiver | ( | bool | allocatePackets = false, |
|
| unsigned char | sync1 = 0xfa, |
|||
| unsigned char | sync2 = 0xfb | |||
| ) |
Constructor without an already assigned device connection.
| allocatePackets | whether to allocate memory for the packets before returning them (true) or to just return a pointer to an internal packet (false)... most everything should use false as this will help prevent many memory leaks or corruptions | |
| sync1 | first byte of the header this receiver will receive, this should be left as the default in nearly all cases, ie don't mess with it | |
| sync2 | second byte of the header this receiver will receive, this should be left as the default in nearly all cases, ie don't mess with it |
| ArRobotPacketReceiver::ArRobotPacketReceiver | ( | ArDeviceConnection * | deviceConnection, | |
| bool | allocatePackets = false, |
|||
| unsigned char | sync1 = 0xfa, |
|||
| unsigned char | sync2 = 0xfb | |||
| ) |
Constructor with assignment of a device connection.
| deviceConnection | the connection which the receiver will use | |
| allocatePackets | whether to allocate memory for the packets before returning them (true) or to just return a pointer to an internal packet (false)... most everything should use false as this will help prevent many memory leaks or corruptions | |
| sync1 | first byte of the header this receiver will receive, this should be left as the default in nearly all cases, ie don't mess with it | |
| sync2 | second byte of the header this receiver will receive, this should be left as the default in nearly all cases, ie don't mess with it |
| ArRobotPacket * ArRobotPacketReceiver::receivePacket | ( | unsigned int | msWait = 0 |
) |
Receives a packet from the robot if there is one available.
| msWait | how long to block for the start of a packet, nonblocking if 0 |
this case can't happen since c can't be over that so taking it out if (c > 255) { ArLog::log(ArLog::Normal, "ArRobotPacketReceiver::receivePacket: bad packet, more than 255 bytes"); state = STATE_SYNC1; break; }
1.4.7