OSSIA
Open Scenario System for Interactive Application
Loading...
Searching...
No Matches
ossia::qt::qml_serial_socket::state Struct Reference

Inherits Nano::Observer.

Detailed Description

Owns the transport and every asio-side callback. As on the TCP outbound socket, the Nano::Observer lives here and not on the QObject: the signals are members of this very object, so their unsynchronized slot lists can only be mutated while the whole state is being destroyed, and the QObject

  • destroyed on the Qt thread while the asio thread may be firing - is only ever reached under qt_mutex.

Public Member Functions

void detach ()
 
template<typename F >
void post_to_qt (F &&f)
 
void fire_open ()
 Nano slots, always on the asio thread.
 
void fire_fail ()
 
void fire_close ()
 
 state (const ossia::net::serial_configuration &conf, boost::asio::io_context &ctx, ossia::net::framing f, const std::string &delim, std::size_t frame_size, ossia::net::encoding e)
 

Static Public Member Functions

static socket_type make_socket (const ossia::net::serial_configuration &conf, boost::asio::io_context &ctx, ossia::net::framing f)
 

Public Attributes

socket_type socket
 
std::atomic_bool alive {true}
 
ossia::net::encoding enc {ossia::net::encoding::none}
 
std::mutex qt_mutex
 
qml_serial_socket * self {}
 

Member Data Documentation

◆ qt_mutex

std::mutex ossia::qt::qml_serial_socket::state::qt_mutex

Guards self, which is cleared before the QObject starts dying. Held for the whole asio -> Qt handover.