Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

ArSickPacketReceiver Class Reference

Given a device connection it receives packets from the sick through it. More...

#include <ArSickPacketReceiver.h>

List of all members.

Public Member Functions

 ArSickPacketReceiver (ArDeviceConnection *deviceConnection, unsigned char receivingAddress=0, bool allocatePackets=false, bool useBase0Address=false)
 Constructor with assignment of a device connection.
 ArSickPacketReceiver (unsigned char receivingAddress=0, bool allocatePackets=false, bool useBase0Address=false)
 Constructor without an already assigned device connection.
ArDeviceConnectiongetDeviceConnection (void)
 Gets the device this instance receives packets from.
bool isAllocatingPackets (void)
 Gets whether or not the receiver is allocating packets.
ArSickPacketreceivePacket (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 ~ArSickPacketReceiver ()
 Destructor.

Protected Types

enum  { STATE_START, STATE_ADDR, STATE_START_COUNT, STATE_ACQUIRE_DATA }

Protected Attributes

bool myAllocatePackets
ArDeviceConnectionmyDeviceConn
ArSickPacket myPacket
unsigned char myReceivingAddress
bool myUseBase0Address


Detailed Description

Given a device connection it receives packets from the sick through it.

Definition at line 35 of file ArSickPacketReceiver.h.


Constructor & Destructor Documentation

ArSickPacketReceiver::ArSickPacketReceiver unsigned char  receivingAddress = 0,
bool  allocatePackets = false,
bool  useBase0Address = false
 

Constructor without an already assigned device connection.

Parameters:
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

Definition at line 40 of file ArSickPacketReceiver.cpp.

ArSickPacketReceiver::ArSickPacketReceiver ArDeviceConnection deviceConnection,
unsigned char  receivingAddress = 0,
bool  allocatePackets = false,
bool  useBase0Address = false
 

Constructor with assignment of a device connection.

Parameters:
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

Definition at line 57 of file ArSickPacketReceiver.cpp.


Member Function Documentation

ArSickPacket * ArSickPacketReceiver::receivePacket unsigned int  msWait = 0  ) 
 

Receives a packet from the robot if there is one available.

Parameters:
msWait how long to block for the start of a packet, nonblocking if 0
Returns:
NULL if there are no packets in alloted time, otherwise a pointer to the packet received, if allocatePackets is true than the place that called this function owns the packet and should delete the packet when done... if allocatePackets is false then nothing must store a pointer to this packet, the packet must be used and done with by the time this method is called again

Definition at line 93 of file ArSickPacketReceiver.cpp.

References ArTime::addMSec(), ArBasePacket::dataToBuf(), ArSickPacket::duplicatePacket(), ArBasePacket::empty(), ArBasePacket::getHeaderLength(), ArBasePacket::getMaxLength(), ArDeviceConnection::getStatus(), ArDeviceConnection::getTimeRead(), ArLog::log(), ArTime::mSecTo(), ArDeviceConnection::read(), ArSickPacket::resetRead(), ArBasePacket::setLength(), ArSickPacket::setTimeReceived(), ArTime::setToNow(), ArBasePacket::uByteToBuf(), and ArSickPacket::verifyCRC().

Referenced by ArSick::disconnect(), ArSick::internalConnectHandler(), and ArSick::runOnce().


The documentation for this class was generated from the following files:
Generated on Wed Oct 19 12:56:54 2005 for Aria by  doxygen 1.4.0