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 <memory>
39
40
#include "
create/data.h
"
41
#include "
create/types.h
"
42
#include "
create/util.h
"
43
#include "
create/serial.h
"
44
45
namespace
create
{
46
class
SerialStream
:
public
Serial
{
47
private
:
48
enum
ReadState
{
49
READ_HEADER
,
50
READ_NBYTES
,
51
READ_PACKET_ID
,
52
READ_PACKET_BYTES
,
53
READ_CHECKSUM
54
};
55
56
// State machine variables
57
ReadState
readState
;
58
uint8_t
headerByte
;
59
uint8_t
packetID
;
60
uint8_t
expectedNumBytes
;
61
uint16_t
packetBytes
;
62
uint8_t
numBytesRead
;
63
uint32_t
byteSum
;
64
uint8_t
numDataBytesRead
;
65
uint8_t
expectedNumDataBytes
;
66
67
protected
:
68
bool
startSensorStream
();
69
void
processByte
(uint8_t
byteRead
);
70
71
public
:
72
SerialStream
(
73
std::shared_ptr<Data>
data
,
74
const
uint8_t& header =
create::util::STREAM_HEADER
,
75
bool
install_signal_handler =
true
);
76
77
};
78
}
// namespace create
79
80
#endif // CREATE_SERIAL_H
create::SerialStream::numDataBytesRead
uint8_t numDataBytesRead
Definition:
serial_stream.h:64
create::Serial::byteRead
uint8_t byteRead
Definition:
serial.h:65
types.h
create::SerialStream
Definition:
serial_stream.h:46
create::SerialStream::startSensorStream
bool startSensorStream()
Definition:
serial_stream.cpp:12
create::Serial
Definition:
serial.h:51
data.h
create::SerialStream::READ_NBYTES
Definition:
serial_stream.h:50
create::SerialStream::expectedNumDataBytes
uint8_t expectedNumDataBytes
Definition:
serial_stream.h:65
create
Definition:
create.h:48
create::SerialStream::READ_CHECKSUM
Definition:
serial_stream.h:53
serial.h
create::SerialStream::packetID
uint8_t packetID
Definition:
serial_stream.h:59
create::SerialStream::READ_PACKET_BYTES
Definition:
serial_stream.h:52
util.h
create::Serial::data
std::shared_ptr< Data > data
Definition:
serial.h:76
create::SerialStream::processByte
void processByte(uint8_t byteRead)
Definition:
serial_stream.cpp:27
create::SerialStream::readState
ReadState readState
Definition:
serial_stream.h:57
create::SerialStream::expectedNumBytes
uint8_t expectedNumBytes
Definition:
serial_stream.h:60
create::SerialStream::byteSum
uint32_t byteSum
Definition:
serial_stream.h:63
create::SerialStream::headerByte
uint8_t headerByte
Definition:
serial_stream.h:58
create::SerialStream::numBytesRead
uint8_t numBytesRead
Definition:
serial_stream.h:62
create::SerialStream::ReadState
ReadState
Definition:
serial_stream.h:48
create::util::STREAM_HEADER
static const uint8_t STREAM_HEADER
Definition:
util.h:43
create::SerialStream::packetBytes
uint16_t packetBytes
Definition:
serial_stream.h:61
create::SerialStream::SerialStream
SerialStream(std::shared_ptr< Data > data, const uint8_t &header=create::util::STREAM_HEADER, bool install_signal_handler=true)
Definition:
serial_stream.cpp:9
create::SerialStream::READ_PACKET_ID
Definition:
serial_stream.h:51
create::SerialStream::READ_HEADER
Definition:
serial_stream.h:49
libcreate
Author(s): Jacob Perron
autogenerated on Sat May 8 2021 03:02:37