BAOS SDK v2  1.0.1
An SDK providing access to IP-BAOS devices through BAOS binary protocol version 2.x
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
}
 The different possible event types. More...
 
using UPtr = std::unique_ptr< IOEvent >
 An alias for an unique pointer to an IOEvent.
 
using EventDataType = std::variant< ip::Ip4SocketAddress, std::unique_ptr< Buffer > >
 

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. More...
 

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 Typedef Documentation

◆ EventDataType

using EventDataType = std::variant<ip::Ip4SocketAddress, std::unique_ptr<Buffer> >

The different possible datatypes inside an IOEvent

Member Enumeration Documentation

◆ Type

enum 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.

Constructor & Destructor Documentation

◆ IOEvent()

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

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: