6#include "roo_collections.h"
7#include "roo_collections/flat_small_hash_map.h"
8#include "roo_collections/flat_small_hash_set.h"
9#include "roo_threads.h"
10#include "roo_threads/mutex.h"
48 std::function<
bool(
const DeviceLocator&)> callback)
const override;
77 bool handleDescriptorAdded(
int key,
80 bool handleDescriptorRemoved(
int key);
82 bool handleDevice(
const DeviceLocator& locator,
int descriptor_key);
84 bool handleDeviceAdded(
const DeviceLocator& locator,
int descriptor_key);
86 bool handleDeviceRemoved(
int prev_index);
88 bool handleDevicePreserved(
int prev_index_first,
size_t count);
90 bool handleDeviceModified(
int prev_index,
int descriptor_key);
93 void notifyDevicesChanged();
96 void notifyReadingsAvailable();
100 bool handleUpdateBegin(
bool delta);
102 bool handleUpdateEnd();
104 bool handleReadingsBegin();
109 size_t readings_count);
111 bool handleReadingsEnd();
120 roo_collections::FlatSmallHashMap<int, roo_transceivers_Descriptor>
126 roo_collections::FlatSmallHashMap<DeviceLocator, int> device_idx_by_locator_;
128 std::vector<DeviceEntry> devices_;
130 std::vector<DeviceEntry> updated_devices_;
135 roo_collections::FlatSmallHashMap<SensorLocator, Measurement> readings_;
140 roo_collections::FlatSmallHashSet<ActuatorLocator> actuators_;
143 roo_collections::FlatSmallHashSet<EventListener*> listeners_;
145 mutable roo::mutex state_guard_;
146 mutable roo::mutex listener_guard_;
Identifies actuator within a transceiver device.
Identifies a transceiver device by schema and device id.
Listener for universe-level change notifications.
Measurement of a quantity at a specific time.
Identifies sensor within a transceiver device.
Communication channel for UniverseClient.
virtual void registerServerMessageCallback(ServerMessageCb cb)=0
virtual void sendClientMessage(const roo_transceivers_ClientMessage &msg)=0
virtual ~UniverseClientChannel()=default
std::function< void(const roo_transceivers_ServerMessage &)> ServerMessageCb
Universe that mirrors a remote universe via a bidirectional channel.
void removeEventListener(EventListener *listener) override
Removes a previously registered event listener.
size_t deviceCount() const override
Returns the total number of transceiver devices in this universe.
Measurement read(const SensorLocator &locator) const override
Returns the latest known reading of the sensor identified by locator.
bool forEachDevice(std::function< bool(const DeviceLocator &)> callback) const override
Iterates over all transceiver devices in this universe, calling callback for each device.
void requestUpdate() override
Requests sensor reading update from underlying devices.
void addEventListener(EventListener *listener) override
Registers a listener for device-set and reading update events.
bool write(const ActuatorLocator &locator, float value) override
Writes to the actuator identified by locator.
bool getDeviceDescriptor(const DeviceLocator &locator, roo_transceivers_Descriptor &descriptor) const override
Retrieves the descriptor for the transceiver identified by locator.
An abstract collection of transceiver devices.