Aria  2.8.0
ArLogFileConnection Class Reference

For connecting through a log file. More...

#include <ArLogFileConnection.h>

Inherits ArDeviceConnection.

Public Types

enum  Open { OPEN_FILE_NOT_FOUND = 1, OPEN_NOT_A_LOG_FILE }
 
- Public Types inherited from ArDeviceConnection
enum  Status {
  STATUS_NEVER_OPENED = 1, STATUS_OPEN, STATUS_OPEN_FAILED, STATUS_CLOSED_NORMALLY,
  STATUS_CLOSED_ERROR
}
 

Public Member Functions

 ArLogFileConnection ()
 Constructor.
 
virtual bool close (void)
 
const char * getLogFile (void)
 Gets the name of the host connected to. More...
 
virtual const char * getOpenMessage (int messageNumber)
 
virtual int getStatus (void)
 
virtual ArTime getTimeRead (int index)
 
int internalOpen (void)
 Internal function used by open and openSimple.
 
virtual bool isTimeStamping (void)
 
int open (const char *fname=NULL)
 Opens a connection to the given host and port. More...
 
virtual bool openSimple (void)
 
virtual int read (const char *data, unsigned int size, unsigned int msWait=0)
 
void setLogFile (const char *fname=NULL)
 
virtual int write (const char *data, unsigned int size)
 
virtual ~ArLogFileConnection ()
 Destructor also closes connection.
 
- Public Member Functions inherited from ArDeviceConnection
 ArDeviceConnection ()
 constructor More...
 
void debugBytesRead (int bytesRead)
 Notifies the device connection that some bytes were read (should call with 0 if it read but got no bytes)
 
void debugEndPacket (bool goodPacket, int type=0)
 Notifies the device connection that the end of a packet was read, which will cause log messages if set to do so.
 
void debugStartPacket (void)
 Notifies the device connection that the start of a packet is trying to be read.
 
const char * getDeviceName (void) const
 Gets the device type (what this is connecting to)
 
const char * getPortName (void) const
 Gets the port name.
 
const char * getPortType (void) const
 Gets the port type.
 
const char * getStatusMessage (int messageNumber) const
 Gets the description string associated with the status. More...
 
void setDeviceName (const char *deviceName)
 Sets the device type (what this is connecting to)
 
virtual int writePacket (ArBasePacket *packet)
 Writes data to connection. More...
 
virtual ~ArDeviceConnection ()
 destructor also forces a close on the connection
 

Public Attributes

bool havePose
 
char myName [100]
 
ArPose myPose
 
char mySubtype [20]
 
char myType [20]
 

Protected Member Functions

void buildStrMap (void)
 
- Protected Member Functions inherited from ArDeviceConnection
void buildStrMap (void)
 
void setPortName (const char *portName)
 Sets the port name.
 
void setPortType (const char *portType)
 Sets the port type.
 

Protected Attributes

FILE * myFD
 
const char * myLogFile
 
int myStatus
 
ArStrMap myStrMap
 
int stopAfter
 
- Protected Attributes inherited from ArDeviceConnection
int myDCDebugBytesRead
 
ArTime myDCDebugFirstByteTime
 
ArTime myDCDebugLastByteTime
 
long long myDCDebugNumBadPackets
 
long long myDCDebugNumGoodPackets
 
bool myDCDebugPacketStarted
 
ArTime myDCDebugStartTime
 
int myDCDebugTimesRead
 
std::string myDCDeviceName
 
std::string myDCPortName
 
std::string myDCPortType
 

Additional Inherited Members

- Static Public Member Functions inherited from ArDeviceConnection
static bool debugShouldLog (bool shouldLog)
 Makes all device connections so that they'll dump data.
 
- Static Protected Attributes inherited from ArDeviceConnection
static ArTime ourDCDebugFirstTime
 
static bool ourDCDebugShouldLog = false
 
static ArStrMap ourStrMap
 
static bool ourStrMapInited = false
 

Detailed Description

For connecting through a log file.

Member Enumeration Documentation

◆ Open

Enumerator
OPEN_FILE_NOT_FOUND 

Can't find the file.

OPEN_NOT_A_LOG_FILE 

Doesn't look like a log file.

Member Function Documentation

◆ getLogFile()

const char * ArLogFileConnection::getLogFile ( void  )

Gets the name of the host connected to.

Returns
the name of the log file

◆ open()

int ArLogFileConnection::open ( const char *  fname = NULL)

Opens a connection to the given host and port.

Parameters
fnamethe file to connect to, if NULL (default) then robot.log
Returns
0 for success, otherwise one of the open enums
See also
getOpenMessage

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