#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 } |
Protected Attributes | |
| bool | myAllocatePackets |
| ArDeviceConnection * | myDeviceConn |
| ArRobotPacket | myPacket |
| unsigned char | mySync1 |
| unsigned char | mySync2 |
Definition at line 36 of file ArRobotPacketReceiver.h.
|
||||||||||||||||
|
Constructor without an already assigned device connection.
Definition at line 46 of file ArRobotPacketReceiver.cpp. |
|
||||||||||||||||||||
|
Constructor with assignment of a device connection.
Definition at line 68 of file ArRobotPacketReceiver.cpp. |
|
|
Receives a packet from the robot if there is one available.
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; } Definition at line 104 of file ArRobotPacketReceiver.cpp. References ArTime::addMSec(), ArBasePacket::dataToBuf(), ArBasePacket::empty(), ArDeviceConnection::getStatus(), ArLog::log(), ArTime::mSecTo(), ArBasePacket::resetRead(), ArBasePacket::setLength(), ArRobotPacket::setTimeReceived(), ArTime::setToNow(), ArBasePacket::uByteToBuf(), and ArRobotPacket::verifyCheckSum(). Referenced by ArRobot::asyncConnectHandler(), and ArRobot::packetHandler(). |
1.4.0