|
MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
|
| MAYAFLUX_API std::shared_ptr< Vruta::NetworkSource > MayaFlux::Portal::Network::serial_source | ( | uint32_t | device_id, |
| const Core::SerialSpec & | framing ) |
Read a serial device as network messages, framed the way framing says.
| device_id | Id of a serial device from open_serial_port(). |
| framing | Only its framing, terminator, gap and message limit are used. Every message is delivered as bytes whatever its parser says. |
The source reads the same bytes as the device and as every other reader, cut by its own framing, so the device's own reading and the nodes bound to it are unaffected. The message carries the device id as endpoint_id and no sender address. Hand it to on_message_received() or await it like any other NetworkSource. Dropping the last reference stops the reading.
Definition at line 10 of file SerialSource.cpp.
References MayaFlux::Core::BYTES, MayaFlux::Core::NetworkMessage::data, MayaFlux::Core::NetworkMessage::endpoint_id, MayaFlux::Registry::BackendRegistry::get_service(), MayaFlux::Registry::BackendRegistry::instance(), MF_ERROR, MF_WARN, MayaFlux::Journal::Networking, MayaFlux::Core::SerialSpec::parse, MayaFlux::Core::SerialSpec::parser, MayaFlux::Journal::Portal, and MayaFlux::Core::InputValue::try_bytes().