device::nic::serial::AsioSerialDriver< PL, SFD > Class Template Reference
ASIO based driver for the serial network layer. More...
#include <device/nic/serial/AsioSerialDriver.h>
Data Structures | |
struct | cfgInfo |
definition of driver specific information More... | |
Public Types | |
typedef AsioSerialDriver< PL, SFD > | type |
definition of class type | |
Public Member Functions | |
struct | __attribute__ ((packed)) |
definition of driver specific message object | |
AsioSerialDriver () | |
~AsioSerialDriver () | |
void | close (const boost::system::error_code &error) |
Closes the connection of the driver. | |
void | doneRead (const boost::system::error_code &error, std::size_t size) |
Triggered if async_read_until finished or failed. | |
void | doneWrite (const boost::system::error_code &error, std::size_t size) |
Triggered after async_write finished or failed. | |
void | init () |
(Re)Initializes the driver for the serial connection. | |
void | recv (mob_t &msg) |
Fetches the message received last. | |
void | send (const mob_t &message) |
Transmits a message using the serial port. | |
Data Fields | |
mob_t | |
famouso::util::Delegate | onReceive |
Triggered if a packet was received. | |
famouso::util::Delegate | onReady |
Triggered if driver is able to send new/further messages. |
Detailed Description
template<uint8_t PL = 255, class SFD = struct SerialFrameDelimiter>
class device::nic::serial::AsioSerialDriver< PL, SFD >
ASIO based driver for the serial network layer.
- Template Parameters:
-
available payload of the driver (255 byte) byte modifier for framing/stuffing
- Todo:
separate hardware management from package format management
use same framing/stuffing implementation as the AtmelDriver
Member Typedef Documentation
typedef AsioSerialDriver< PL, SFD > device::nic::serial::AsioSerialDriver< PL, SFD >::type |
definition of class type
Constructor & Destructor Documentation
device::nic::serial::AsioSerialDriver< PL, SFD >::AsioSerialDriver | ( | ) | [inline] |
device::nic::serial::AsioSerialDriver< PL, SFD >::~AsioSerialDriver | ( | ) | [inline] |
Member Function Documentation
struct device::nic::serial::AsioSerialDriver< PL, SFD >::__attribute__ | ( | (packed) | ) | [inline, read] |
definition of driver specific message object
References device::nic::serial::AsioSerialDriver< PL, SFD >::cfgInfo::payload.
void device::nic::serial::AsioSerialDriver< PL, SFD >::close | ( | const boost::system::error_code & | error | ) | [inline] |
Closes the connection of the driver.
- Parameters:
-
[in] error cause of the connection close
Referenced by device::nic::serial::AsioSerialDriver< PL, SFD >::doneRead(), and device::nic::serial::AsioSerialDriver< PL, SFD >::doneWrite().
void device::nic::serial::AsioSerialDriver< PL, SFD >::doneRead | ( | const boost::system::error_code & | error, | |
std::size_t | size | |||
) | [inline] |
Triggered if async_read_until finished or failed.
- Parameters:
-
[in] error error that occured if the operation has failed [in] size number of bytes transfered
References device::nic::serial::AsioSerialDriver< PL, SFD >::close(), device::nic::serial::AsioSerialDriver< PL, SFD >::onReceive, and device::nic::serial::AsioSerialDriver< PL, SFD >::cfgInfo::payload.
Referenced by device::nic::serial::AsioSerialDriver< PL, SFD >::init().
void device::nic::serial::AsioSerialDriver< PL, SFD >::doneWrite | ( | const boost::system::error_code & | error, | |
std::size_t | size | |||
) | [inline] |
Triggered after async_write finished or failed.
- Parameters:
-
[in] error code of error that occured [in] size number of bytes transfered
References device::nic::serial::AsioSerialDriver< PL, SFD >::close(), and device::nic::serial::AsioSerialDriver< PL, SFD >::onReady.
Referenced by device::nic::serial::AsioSerialDriver< PL, SFD >::send().
void device::nic::serial::AsioSerialDriver< PL, SFD >::init | ( | ) | [inline] |
(Re)Initializes the driver for the serial connection.
Initializes the connection with default values (BaudRade 8N1) and checks if connection could be opened.
References device::nic::serial::AsioSerialDriver< PL, SFD >::doneRead(), famouso::util::impl::start_ios(), and TRACE_FUNCTION.
void device::nic::serial::AsioSerialDriver< PL, SFD >::recv | ( | mob_t & | msg | ) | [inline] |
Fetches the message received last.
- Parameters:
-
[out] msg containing the received message
References TRACE_FUNCTION.
void device::nic::serial::AsioSerialDriver< PL, SFD >::send | ( | const mob_t & | message | ) | [inline] |
Transmits a message using the serial port.
- Parameters:
-
[in] message object that is to be send
References device::nic::serial::AsioSerialDriver< PL, SFD >::doneWrite(), and TRACE_FUNCTION.
Field Documentation
device::nic::serial::AsioSerialDriver< PL, SFD >::mob_t |
famouso::util::Delegate device::nic::serial::AsioSerialDriver< PL, SFD >::onReady |
Triggered if driver is able to send new/further messages.
- Note:
- This functionality is not yet implemented.
Referenced by device::nic::serial::AsioSerialDriver< PL, SFD >::doneWrite().
famouso::util::Delegate device::nic::serial::AsioSerialDriver< PL, SFD >::onReceive |
Triggered if a packet was received.
Referenced by device::nic::serial::AsioSerialDriver< PL, SFD >::doneRead().
The documentation for this class was generated from the following file:
- include/devices/nic/serial/AsioSerialDriver.h