Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes
labust::tritech::MTDevice Class Reference

#include <MTDevice.hpp>

List of all members.

Public Types

typedef boost::function< void(MTMsgPtr)> FunctorType
typedef std::map< int,
FunctorType
HandlerMap

Public Member Functions

 MTDevice (const std::string &portName, uint32_t baud)
void registerHandlers (const HandlerMap &map)
void send (MTMsgPtr message)
 ~MTDevice ()

Private Types

enum  { Sync, Header, Data }
enum  { ringBufferSize = 7 }

Private Member Functions

void onData (const boost::system::error_code &error, std::size_t bytes_transferred)
void onHeader (StreamPtr data, const boost::system::error_code &error, std::size_t bytes_transferred)
void onSync (const boost::system::error_code &error, std::size_t bytes_transferred)
void start_receive (uint8_t state)

Private Attributes

HandlerMap handlers
boost::asio::streambuf input
boost::archive::binary_iarchive inputSer
boost::asio::io_service io
boost::asio::serial_port port
std::vector< uint8_tringBuffer
boost::thread service

Detailed Description

Serial port Tritech devices communication layer.

Todo:

Definition at line 58 of file MTDevice.hpp.


Member Typedef Documentation

typedef boost::function<void (MTMsgPtr)> labust::tritech::MTDevice::FunctorType

The functor typedef.

Definition at line 66 of file MTDevice.hpp.

The handler typedef.

Definition at line 70 of file MTDevice.hpp.


Member Enumeration Documentation

anonymous enum [private]
Enumerator:
Sync 
Header 
Data 

Definition at line 60 of file MTDevice.hpp.

anonymous enum [private]
Enumerator:
ringBufferSize 

Definition at line 61 of file MTDevice.hpp.


Constructor & Destructor Documentation

MTDevice::MTDevice ( const std::string &  portName,
uint32_t  baud 
)

Default constructor with specified portname and baud rate.

Definition at line 46 of file MTDevice.cpp.

Generic destructor.

Definition at line 75 of file MTDevice.cpp.


Member Function Documentation

void labust::tritech::MTDevice::onData ( const boost::system::error_code &  error,
std::size_t  bytes_transferred 
) [private]

Handle data message.

void MTDevice::onHeader ( StreamPtr  data,
const boost::system::error_code &  error,
std::size_t  bytes_transferred 
) [private]

Handle next incoming header.

Definition at line 143 of file MTDevice.cpp.

void MTDevice::onSync ( const boost::system::error_code &  error,
std::size_t  bytes_transferred 
) [private]

Handles synchronization.

Definition at line 100 of file MTDevice.cpp.

The method registers the handler.

Definition at line 87 of file MTDevice.hpp.

void MTDevice::send ( MTMsgPtr  message)

The method sends the buffer content to the device.

Definition at line 186 of file MTDevice.cpp.

void MTDevice::start_receive ( uint8_t  state) [private]

Start async_reads based on current state.

Definition at line 83 of file MTDevice.cpp.


Member Data Documentation

The handler map.

Definition at line 138 of file MTDevice.hpp.

boost::asio::streambuf labust::tritech::MTDevice::input [private]

The input buffer.

Definition at line 122 of file MTDevice.hpp.

boost::archive::binary_iarchive labust::tritech::MTDevice::inputSer [private]

Structure serializator.

Definition at line 130 of file MTDevice.hpp.

boost::asio::io_service labust::tritech::MTDevice::io [private]

IO service

Definition at line 114 of file MTDevice.hpp.

boost::asio::serial_port labust::tritech::MTDevice::port [private]

Serial port.

Definition at line 118 of file MTDevice.hpp.

The header ring buffer.

Definition at line 126 of file MTDevice.hpp.

boost::thread labust::tritech::MTDevice::service [private]

The runner thread.

Definition at line 134 of file MTDevice.hpp.


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


tritech_sdk
Author(s): Gyula Nagy
autogenerated on Thu Jul 10 2014 10:34:19