BCNP 3.2.1
Batched Command Network Protocol
Loading...
Searching...
No Matches
bcnp::DispatcherDriver Class Reference

Drives a PacketDispatcher from a transport adapter. More...

#include <controller_driver.h>

Public Member Functions

 DispatcherDriver (PacketDispatcher &dispatcher, DuplexAdapter &adapter)
 
void PollOnce ()
 Poll transport and feed data to dispatcher.
 
bool SendBytes (const uint8_t *data, std::size_t length)
 Send raw bytes through the adapter.
 
template<typename MsgType >
bool SendPacket (const TypedPacket< MsgType > &packet)
 Send a typed packet.
 

Detailed Description

Drives a PacketDispatcher from a transport adapter.

Connects a network transport (TCP, UDP, etc.) to a PacketDispatcher, polling for incoming data and feeding it to the parser.

PacketDispatcher dispatcher;
TcpPosixAdapter adapter(5800);
DispatcherDriver driver(dispatcher, adapter);
// In main loop:
driver.PollOnce();
Drives a PacketDispatcher from a transport adapter.
Parses BCNP stream and dispatches packets to registered handlers.
Definition dispatcher.h:49
TCP transport adapter for BCNP over POSIX sockets.
Definition tcp_posix.h:22

Definition at line 25 of file controller_driver.h.

Constructor & Destructor Documentation

◆ DispatcherDriver()

bcnp::DispatcherDriver::DispatcherDriver ( PacketDispatcher & dispatcher,
DuplexAdapter & adapter )

Definition at line 7 of file controller_driver.cpp.

Member Function Documentation

◆ PollOnce()

void bcnp::DispatcherDriver::PollOnce ( )

Poll transport and feed data to dispatcher.

Definition at line 13 of file controller_driver.cpp.

Here is the call graph for this function:

◆ SendBytes()

bool bcnp::DispatcherDriver::SendBytes ( const uint8_t * data,
std::size_t length )

Send raw bytes through the adapter.

Definition at line 25 of file controller_driver.cpp.

Here is the call graph for this function:

◆ SendPacket()

template<typename MsgType >
bool bcnp::DispatcherDriver::SendPacket ( const TypedPacket< MsgType > & packet)
inline

Send a typed packet.

Definition at line 37 of file controller_driver.h.

Here is the call graph for this function:

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