10#ifndef GBXSERIALDEVICEACFR_SERIALDEVICEHANDLER_H
11#define GBXSERIALDEVICEACFR_SERIALDEVICEHANDLER_H
13#include <gbxserialacfr/serial.h>
14#include <gbxutilacfr/substatus.h>
15#include <gbxsickacfr/gbxiceutilacfr/safethread.h>
16#include <gbxsickacfr/gbxiceutilacfr/store.h>
17#include <IceUtil/IceUtil.h>
19namespace gbxserialdeviceacfr {
22class RxMsg :
public IceUtil::Shared
29 virtual bool isWarn()
const {
return false; }
32 virtual bool isError()
const {
return false; }
35 virtual std::string toString()
const=0;
37typedef IceUtil::Handle<RxMsg> RxMsgPtr;
54 virtual RxMsgPtr parseBuffer(
const std::vector<char> &buffer,
55 int &numBytesParsed ) = 0;
70 virtual void msgReceived(
const RxMsgPtr &msg,
72 int timeStampUsec )=0;
103 bool verboseDebug=
false,
104 int unparsedBytesWarnThreshold = 20000 );
106 { rxMsgCallback_ = &callback; }
111 void send(
const char* commandBytes,
int numCommandBytes );
114 void setBaudRate(
int baudRate );
117 void startAndWaitTillIsRunning();
128 bool getDataFromSerial();
130 bool processBuffer();
140 std::vector<char> buffer_;
144 int unparsedBytesWarnThreshold_;
149 const bool verboseDebug_;
152typedef IceUtil::Handle<SerialDeviceHandler> SerialDeviceHandlerPtr;
A version of the Thread class which catches all possible exceptions.
Definition: safethread.h:44
Encapsulates a serial port.
Definition: serial.h:44
Definition: serialdevicehandler.h:66
Definition: serialdevicehandler.h:43
A base-class for a message received from the device on the other end.
Definition: serialdevicehandler.h:23
Handles the serial port.
Definition: serialdevicehandler.h:89
Local interface to component status.
Definition: status.h:254
Convenience class which maniupulates the status of a subsystem.
Definition: substatus.h:40