Aria  2.7.5.2
ArLMS2xxPacketReceiver Class Reference

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

#include <ArLMS2xxPacketReceiver.h>

Public Member Functions

 ArLMS2xxPacketReceiver (unsigned char receivingAddress=0, bool allocatePackets=false, bool useBase0Address=false)
 Constructor without an already assigned device connection. More...
 
 ArLMS2xxPacketReceiver (ArDeviceConnection *deviceConnection, unsigned char receivingAddress=0, bool allocatePackets=false, bool useBase0Address=false)
 Constructor with assignment of a device connection. More...
 
ArDeviceConnectiongetDeviceConnection (void)
 Gets the device this instance receives packets from.
 
bool isAllocatingPackets (void)
 Gets whether or not the receiver is allocating packets.
 
ArLMS2xxPacketreceivePacket (unsigned int msWait=0)
 Receives a packet from the robot if there is one available. More...
 
void setDeviceConnection (ArDeviceConnection *deviceConnection)
 Sets the device this instance receives packets from.
 
virtual ~ArLMS2xxPacketReceiver ()
 Destructor.
 

Protected Types

enum  { STATE_START, STATE_ADDR, STATE_START_COUNT, STATE_ACQUIRE_DATA }
 

Protected Attributes

bool myAllocatePackets
 
ArDeviceConnectionmyDeviceConn
 
ArLMS2xxPacket myPacket
 
unsigned char myReceivingAddress
 
bool myUseBase0Address
 

Detailed Description

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

Constructor & Destructor Documentation

ArLMS2xxPacketReceiver::ArLMS2xxPacketReceiver ( unsigned char  receivingAddress = 0,
bool  allocatePackets = false,
bool  useBase0Address = false 
)

Constructor without an already assigned device connection.

Parameters
allocatePacketswhether 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
ArLMS2xxPacketReceiver::ArLMS2xxPacketReceiver ( ArDeviceConnection deviceConnection,
unsigned char  receivingAddress = 0,
bool  allocatePackets = false,
bool  useBase0Address = false 
)

Constructor with assignment of a device connection.

Parameters
deviceConnectionthe connection which the receiver will use
allocatePacketswhether 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

Member Function Documentation

ArLMS2xxPacket * ArLMS2xxPacketReceiver::receivePacket ( unsigned int  msWait = 0)

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

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

The documentation for this class was generated from the following files: