roo_transceivers
API Documentation for roo_transceivers
Loading...
Searching...
No Matches
roo_transceivers::UniverseServer Class Reference

The server keeps cached universe state and the most recent delta. More...

#include <server.h>

Inheritance diagram for roo_transceivers::UniverseServer:
[legend]
Collaboration diagram for roo_transceivers::UniverseServer:
[legend]

Public Member Functions

 UniverseServer (Universe &universe, UniverseServerChannel &channel, Executor &transmit_executor)
 
 ~UniverseServer ()
 
void begin ()
 
void devicesChanged () override
 Called when the set of devices changes.
 
void newReadingsAvailable () override
 Called when new readings are available.
 
- Public Member Functions inherited from roo_transceivers::EventListener
virtual ~EventListener ()=default
 

Detailed Description

The server keeps cached universe state and the most recent delta.

It also tracks whether a transmission is in progress and whether the universe has changed since the last snapshot. At any given time, the server either is not transmitting (no deltas) or is transmitting the most recent delta.

Starting a transmission is always preceded by taking a new snapshot, calculating the delta relative to the previous snapshot, and clearing the state to "unchanged". The new snapshot and delta then remain unchanged during transmission.

Upon a change notification, if a transmission is in progress, the state is updated to indicate the universe has changed, but no other action is taken. If transmission is not in progress, the snapshot-delta-transmit process is triggered.

Upon finishing the transfer, if the "change" state is "changed", the snapshot-delta-transmit process is immediately triggered again (a new delta is calculated and a new transfer starts). Otherwise, the "transmit" state switches to "not transmitting".

All state changes are guarded by a mutex to synchronize transmits with change events.

Definition at line 67 of file server.h.

Constructor & Destructor Documentation

◆ UniverseServer()

roo_transceivers::UniverseServer::UniverseServer ( Universe universe,
UniverseServerChannel channel,
Executor transmit_executor 
)

◆ ~UniverseServer()

roo_transceivers::UniverseServer::~UniverseServer ( )

Member Function Documentation

◆ begin()

void roo_transceivers::UniverseServer::begin ( )

Definition at line 63 of file server.cpp.

◆ devicesChanged()

void roo_transceivers::UniverseServer::devicesChanged ( )
overridevirtual

Called when the set of devices changes.

Reimplemented from roo_transceivers::EventListener.

Definition at line 65 of file server.cpp.

◆ newReadingsAvailable()

void roo_transceivers::UniverseServer::newReadingsAvailable ( )
overridevirtual

Called when new readings are available.

Reimplemented from roo_transceivers::EventListener.

Definition at line 82 of file server.cpp.


The documentation for this class was generated from the following files: