|
roo_transceivers
API Documentation for roo_transceivers
|
The server keeps cached universe state and the most recent delta. More...
#include <server.h>
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 |
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.
| roo_transceivers::UniverseServer::UniverseServer | ( | Universe & | universe, |
| UniverseServerChannel & | channel, | ||
| Executor & | transmit_executor | ||
| ) |
Definition at line 38 of file server.cpp.
References roo_transceivers::Universe::addEventListener(), and roo_transceivers::UniverseServerChannel::registerClientMessageCallback().
| roo_transceivers::UniverseServer::~UniverseServer | ( | ) |
Definition at line 58 of file server.cpp.
References roo_transceivers::UniverseServerChannel::registerClientMessageCallback(), and roo_transceivers::Universe::removeEventListener().
| void roo_transceivers::UniverseServer::begin | ( | ) |
Definition at line 63 of file server.cpp.
|
overridevirtual |
Called when the set of devices changes.
Reimplemented from roo_transceivers::EventListener.
Definition at line 65 of file server.cpp.
|
overridevirtual |
Called when new readings are available.
Reimplemented from roo_transceivers::EventListener.
Definition at line 82 of file server.cpp.