MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ initialize()

bool MayaFlux::Core::SerialInputBackend::initialize ( )
overridevirtual

Initialize the input backend.

Returns
true if initialization succeeded

Should discover available devices but not start polling/listening.

Implements MayaFlux::Core::IInputBackend.

Definition at line 62 of file SerialInputBackend.cpp.

63{
64 if (m_initialized.load()) {
65 return true;
66 }
67
68 if (!m_config.network) {
70 "SerialInputBackend needs a NetworkService");
71 return false;
72 }
73
74 m_roster.update([&](Roster& roster) {
75 roster = Roster {};
76 for (const auto& port : m_config.ports) {
77 const uint32_t id = id_for(roster, "c:" + port.port_name);
78 roster.entries.insert_or_assign(id,
79 make_entry(id, port.port_name, port.port_name, port.line, port.protocol, true));
80 }
81 return true;
82 });
83
84 m_initialized.store(true);
85
86 if (m_config.enumerate_ports) {
88 }
89
91 "SerialInputBackend initialized with {} port(s)", get_devices().size());
92
93 return true;
94}
#define MF_INFO(comp, ctx,...)
#define MF_WARN(comp, ctx,...)
std::vector< InputDeviceInfo > get_devices() const override
Get list of available devices.
static uint32_t id_for(Roster &roster, const std::string &key)
size_t refresh_devices() override
Refresh the device list.
static Entry make_entry(uint32_t id, const std::string &path, const std::string &name, const SerialLineSettings &line, const SerialProtocolSettings &protocol, bool configured)
Memory::SnapshotCell< Roster > m_roster
@ InputBackend
Input device backend (HID, MIDI, OSC).
@ Core
Core engine, backend, subsystems.

References MayaFlux::Journal::Core, MayaFlux::Core::SerialInputBackend::Roster::entries, get_devices(), id_for(), MayaFlux::Journal::InputBackend, m_config, m_initialized, m_roster, make_entry(), MF_INFO, MF_WARN, and refresh_devices().

Here is the call graph for this function: