BAOS SDK v2  1.2.1
An SDK providing access to IP-BAOS devices through BAOS binary protocol version 2.x
Loading...
Searching...
No Matches
IOEvent Class Reference

Represents an IOEvent. More...

#include <baos/connection/IOEvent.h>

Public Types

enum class  Type {
  UNKNOWN ,
  OPEN ,
  CLOSE ,
  SOCKETERROR ,
  RESPONSETIMEOUT ,
  HEARTBEAT ,
  RX_PACKET ,
  TX_PACKET ,
  STACK_CONNECT_RESULT ,
  STACK_DISCONNECT_RESULT ,
  TIMER_ELAPSED
}
 The different possible event types. More...
 
using TimerIdList = std::vector< std::uint64_t >
 
using UPtr = std::unique_ptr< IOEvent >
 An alias for an unique pointer to an IOEvent.
 
using EventDataType = std::variant< std::monostate, ip::Ip4SocketAddress, std::unique_ptr< Buffer >, TimerIdList >
 datatypes inside an IOEvent
 

Public Member Functions

 IOEvent ()=default
 Default constructor, generating an empty IOEvent.
 
 IOEvent (Type eventT, EventDataType &&pkt, protocol::ResponsePromise &&prom, std::uint64_t mID=0)
 Construct a new IOEvent object.
 

Public Attributes

Type eventType {Type::UNKNOWN}
 Stors the event type.
 
std::uint64_t msgID {0}
 Stores the msgID.
 
protocol::ResponsePromise responsePromise
 Stores the response promise to resolve later.
 
bool promiseMoved {false}
 Flag to indicate thate the response promise was moved and is therefore invalid.
 
EventDataType data_
 The payload/data for this event.
 

Detailed Description

Represents an IOEvent.

See also
wz::baos::BaosConnection

Member Enumeration Documentation

◆ Type

enum class Type
strong

The different possible event types.

Enumerator
UNKNOWN 

If event is not specified.

OPEN 

An open event is requested.

CLOSE 

An close event is requested.

SOCKETERROR 

Errors regarding the underlying socket.

RESPONSETIMEOUT 

The response was not received in the through timeout given period.

HEARTBEAT 

A Heartbeat is requested.

RX_PACKET 

An incoming (RX) packet was received and should be handled.

TX_PACKET 

An outgoing (TX) packet should be handled.

STACK_CONNECT_RESULT 

Result of asynchronous protocol stack connect.

STACK_DISCONNECT_RESULT 

Result of asynchronous protocol stack disconnect.

TIMER_ELAPSED 

A timer elapsed event.

Constructor & Destructor Documentation

◆ IOEvent()

IOEvent ( Type  eventT,
EventDataType &&  pkt,
protocol::ResponsePromise &&  prom,
std::uint64_t  mID = 0 
)

Construct a new IOEvent object.

Parameters
eventTThe event type
pktThe data of this event as a std::variant
promThe promise which will be resolved if the event is handled
mIDAn unique message id to help with correlate the event

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