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

#include <TCPDevice.hpp>

List of all members.

Public Types

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

Public Member Functions

void registerHandlers (const HandlerMap &map)
void send (TCONMsgPtr message)
 TCPDevice (const std::string &address, uint32_t port, uint8_t device=Nodes::USBL, uint8_t app_class=TCPRequest::atAMNAV, uint8_t priority=129)
 ~TCPDevice ()

Private Types

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

Private Member Functions

void _setup ()
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 registerDevice (bool register=true)
void start_receive (uint8_t state)

Private Attributes

std::string address
uint8_t app_class
uint8_t device
HandlerMap handlers
boost::asio::streambuf input
boost::asio::io_service io
uint32_t port
uint8_t priority
std::vector< uint8_tringBuffer
boost::thread service
boost::asio::ip::tcp::socket socket

Detailed Description

TCP/IP Tritech devices communication layer.

Todo:

Definition at line 110 of file TCPDevice.hpp.


Member Typedef Documentation

typedef boost::function<void (TCONMsgPtr)> labust::tritech::TCPDevice::FunctorType

The functor typedef.

Definition at line 118 of file TCPDevice.hpp.

The handler typedef.

Definition at line 122 of file TCPDevice.hpp.


Member Enumeration Documentation

anonymous enum [private]
Enumerator:
Sync 
Header 
Data 

Definition at line 112 of file TCPDevice.hpp.

anonymous enum [private]
Enumerator:
ringBufferSize 

Definition at line 113 of file TCPDevice.hpp.


Constructor & Destructor Documentation

TCPDevice::TCPDevice ( const std::string &  address,
uint32_t  port,
uint8_t  device = Nodes::USBL,
uint8_t  app_class = TCPRequest::atAMNAV,
uint8_t  priority = 129 
)

Default constructor with specified portname and baud rate.

Definition at line 52 of file TCPDevice.cpp.

Generic destructor.

Definition at line 69 of file TCPDevice.cpp.


Member Function Documentation

void TCPDevice::_setup ( ) [private]

Setup the TCP/IP connection.

Added on 17.06.2013. to avoid waiting for seanet to start.

Todo:
Refactor this code.

Definition at line 80 of file TCPDevice.cpp.

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

Handle data message.

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

Handle next incoming header.

Definition at line 229 of file TCPDevice.cpp.

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

Handles synchronization.

Definition at line 164 of file TCPDevice.cpp.

void TCPDevice::registerDevice ( bool  register = true) [private]

Register the device at TCP/IP.

Todo:
Temporary added registrations

Definition at line 114 of file TCPDevice.cpp.

The method registers the handler.

Definition at line 143 of file TCPDevice.hpp.

void TCPDevice::send ( TCONMsgPtr  message)

The method sends the buffer content to the device.

Definition at line 312 of file TCPDevice.cpp.

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

Start async_reads based on current state.

Definition at line 147 of file TCPDevice.cpp.


Member Data Documentation

std::string labust::tritech::TCPDevice::address [private]

The remote host address.

Definition at line 185 of file TCPDevice.hpp.

Definition at line 209 of file TCPDevice.hpp.

Device registarion.

Definition at line 209 of file TCPDevice.hpp.

The handler map.

Definition at line 205 of file TCPDevice.hpp.

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

The input buffer.

Definition at line 193 of file TCPDevice.hpp.

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

IO service

Definition at line 177 of file TCPDevice.hpp.

The remote port.

Definition at line 189 of file TCPDevice.hpp.

Definition at line 209 of file TCPDevice.hpp.

The header ring buffer.

Definition at line 197 of file TCPDevice.hpp.

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

The runner thread.

Definition at line 201 of file TCPDevice.hpp.

boost::asio::ip::tcp::socket labust::tritech::TCPDevice::socket [private]

Serial port.

Definition at line 181 of file TCPDevice.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