Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
include
create
serial_stream.h
Go to the documentation of this file.
1
32
// Based on example from:
33
// https://github.com/labust/labust-ros-pkg/wiki/Create-a-Serial-Port-application
34
35
#ifndef CREATE_SERIAL_STREAM_H
36
#define CREATE_SERIAL_STREAM_H
37
38
#include <boost/asio.hpp>
39
#include <boost/thread.hpp>
40
#include <boost/thread/condition_variable.hpp>
41
#include <boost/function.hpp>
42
#include <boost/shared_ptr.hpp>
43
44
#include "
create/data.h
"
45
#include "
create/types.h
"
46
#include "
create/util.h
"
47
#include "
create/serial.h
"
48
49
namespace
create
{
50
class
SerialStream
:
public
Serial
{
51
private
:
52
enum
ReadState
{
53
READ_HEADER
,
54
READ_NBYTES
,
55
READ_PACKET_ID
,
56
READ_PACKET_BYTES
,
57
READ_CHECKSUM
58
};
59
60
// State machine variables
61
ReadState
readState
;
62
uint8_t
headerByte
;
63
uint8_t
packetID
;
64
uint8_t
expectedNumBytes
;
65
uint16_t
packetBytes
;
66
uint8_t
numBytesRead
;
67
uint32_t
byteSum
;
68
uint8_t
numDataBytesRead
;
69
uint8_t
expectedNumDataBytes
;
70
71
protected
:
72
bool
startSensorStream
();
73
void
processByte
(uint8_t
byteRead
);
74
75
public
:
76
SerialStream
(boost::shared_ptr<Data>
data
,
const
uint8_t& header =
create::util::STREAM_HEADER
);
77
78
};
79
}
// namespace create
80
81
#endif // CREATE_SERIAL_H
create::SerialStream::numDataBytesRead
uint8_t numDataBytesRead
Definition:
serial_stream.h:68
create::Serial::byteRead
uint8_t byteRead
Definition:
serial.h:62
create::SerialStream::SerialStream
SerialStream(boost::shared_ptr< Data > data, const uint8_t &header=create::util::STREAM_HEADER)
Definition:
serial_stream.cpp:8
types.h
create::SerialStream
Definition:
serial_stream.h:50
create::SerialStream::startSensorStream
bool startSensorStream()
Definition:
serial_stream.cpp:11
create::Serial
Definition:
serial.h:49
data.h
create::SerialStream::READ_NBYTES
Definition:
serial_stream.h:54
create::Serial::data
boost::shared_ptr< Data > data
Definition:
serial.h:74
create::SerialStream::expectedNumDataBytes
uint8_t expectedNumDataBytes
Definition:
serial_stream.h:69
create
Definition:
create.h:46
create::SerialStream::READ_CHECKSUM
Definition:
serial_stream.h:57
serial.h
create::SerialStream::packetID
uint8_t packetID
Definition:
serial_stream.h:63
create::SerialStream::READ_PACKET_BYTES
Definition:
serial_stream.h:56
util.h
create::SerialStream::processByte
void processByte(uint8_t byteRead)
Definition:
serial_stream.cpp:32
create::SerialStream::readState
ReadState readState
Definition:
serial_stream.h:61
create::SerialStream::expectedNumBytes
uint8_t expectedNumBytes
Definition:
serial_stream.h:64
create::SerialStream::byteSum
uint32_t byteSum
Definition:
serial_stream.h:67
create::SerialStream::headerByte
uint8_t headerByte
Definition:
serial_stream.h:62
create::SerialStream::numBytesRead
uint8_t numBytesRead
Definition:
serial_stream.h:66
create::SerialStream::ReadState
ReadState
Definition:
serial_stream.h:52
create::util::STREAM_HEADER
static const uint8_t STREAM_HEADER
Definition:
util.h:43
create::SerialStream::packetBytes
uint16_t packetBytes
Definition:
serial_stream.h:65
create::SerialStream::READ_PACKET_ID
Definition:
serial_stream.h:55
create::SerialStream::READ_HEADER
Definition:
serial_stream.h:53
libcreate
Author(s): Jacob Perron
autogenerated on Sat Jun 8 2019 17:58:17