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

◆ on_link_state()

void MayaFlux::Core::SerialInputBackend::on_link_state ( uint32_t device_id,
EndpointState previous,
EndpointState current )
private

Definition at line 558 of file SerialInputBackend.cpp.

559{
560 const bool was_open = previous == EndpointState::OPEN;
561 const bool is_open = current == EndpointState::OPEN;
562 if (was_open == is_open) {
563 return;
564 }
565
566 InputDeviceInfo info {};
567 bool found = false;
568 m_roster.update([&](Roster& roster) {
569 found = false;
570 const auto it = roster.entries.find(device_id);
571 if (it == roster.entries.end()) {
572 return false;
573 }
574 Entry changed = it->second;
575 changed.info.is_connected = is_open;
576 info = changed.info;
577 found = true;
578 roster.entries.insert_or_assign(device_id, std::move(changed));
579 return true;
580 });
581
582 if (found) {
583 notify_device(info, is_open);
584 }
585}
Memory::SnapshotCell< Roster > m_roster
void notify_device(const InputDeviceInfo &info, bool connected) const
bool is_connected
Current connection state.

References MayaFlux::Core::SerialInputBackend::Roster::entries, MayaFlux::Core::SerialInputBackend::Entry::info, MayaFlux::Core::InputDeviceInfo::is_connected, m_roster, notify_device(), on_link_state(), and MayaFlux::Core::OPEN.

Referenced by on_link_state().

Here is the call graph for this function:
Here is the caller graph for this function: