Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
ric_interface::Communicator Class Reference

#include <communicator.h>

Public Types

enum  State { HEADER_PART_A, HEADER_PART_B, PACKAGE, CHECKSUM }
 

Public Member Functions

void connect (std::string port, int baudrate)
 
int read (byte buff[])
 
bool write (const protocol::package &pkg, size_t pkg_size)
 

Static Public Member Functions

static void fromBytes (byte buff[], size_t pkg_size, protocol::package &pkg)
 
static void toBytes (const protocol::package &pkg, size_t pkg_size, byte buff[])
 

Private Member Functions

void reset ()
 
bool tryReadHeader ()
 
int tryReadPkgSize ()
 

Private Attributes

Crc8 crc_
 
int pkg_indx_ = 0
 
int pkg_size_ = 0
 
SerialCom serial_
 
State state_ = HEADER_PART_A
 

Detailed Description

Definition at line 19 of file communicator.h.

Member Enumeration Documentation

Enumerator
HEADER_PART_A 
HEADER_PART_B 
PACKAGE 
CHECKSUM 

Definition at line 24 of file communicator.h.

Member Function Documentation

void ric_interface::Communicator::connect ( std::string  port,
int  baudrate 
)
inline

Definition at line 32 of file communicator.h.

static void ric_interface::Communicator::fromBytes ( byte  buff[],
size_t  pkg_size,
protocol::package pkg 
)
inlinestatic

Definition at line 92 of file communicator.h.

int ric_interface::Communicator::read ( byte  buff[])
inline

Definition at line 38 of file communicator.h.

void ric_interface::Communicator::reset ( )
inlineprivate

Definition at line 130 of file communicator.h.

static void ric_interface::Communicator::toBytes ( const protocol::package pkg,
size_t  pkg_size,
byte  buff[] 
)
inlinestatic

Definition at line 97 of file communicator.h.

bool ric_interface::Communicator::tryReadHeader ( )
inlineprivate

Definition at line 138 of file communicator.h.

int ric_interface::Communicator::tryReadPkgSize ( )
inlineprivate

Definition at line 146 of file communicator.h.

bool ric_interface::Communicator::write ( const protocol::package pkg,
size_t  pkg_size 
)
inline

Definition at line 102 of file communicator.h.

Member Data Documentation

Crc8 ric_interface::Communicator::crc_
private

Definition at line 128 of file communicator.h.

int ric_interface::Communicator::pkg_indx_ = 0
private

Definition at line 126 of file communicator.h.

int ric_interface::Communicator::pkg_size_ = 0
private

Definition at line 127 of file communicator.h.

SerialCom ric_interface::Communicator::serial_
private

Definition at line 124 of file communicator.h.

State ric_interface::Communicator::state_ = HEADER_PART_A
private

Definition at line 125 of file communicator.h.


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


ric_interface
Author(s):
autogenerated on Wed Jan 3 2018 03:48:20