5#include "roo_backport.h"
6#include "roo_backport/string_view.h"
12void id2key(
int id,
char* key) { sprintf(key,
"r_%d",
id); }
19 roo_prefs::Transaction t(collection_,
true);
23 roo_prefs::ReadResult result = t.store().readObject(skey, rep);
24 if (result != roo_prefs::READ_OK) {
28 roo::string_view(&rep[16], 24),
29 roo::string_view(&rep[40], 24));
34 roo_prefs::Transaction t(collection_);
38 memset(&rep[0], 0, 64);
39 strncpy(&rep[0], locator.
schema().c_str(), 16);
40 strncpy(&rep[16], locator.
device_id().c_str(), 24);
41 strncpy(&rep[40], locator.
sensor_id().c_str(), 24);
42 t.store().writeObject(skey, rep);
46 roo_prefs::Transaction t(collection_);
49 t.store().clear(skey);
54 roo_prefs::Transaction t(collection_,
true);
58 roo_prefs::ReadResult result = t.store().readObject(skey, rep);
59 if (result != roo_prefs::READ_OK) {
63 roo::string_view(&rep[16], 24),
64 roo::string_view(&rep[40], 24));
69 roo_prefs::Transaction t(collection_);
73 memset(&rep[0], 0, 64);
74 strncpy(&rep[0], locator.
schema().c_str(), 16);
75 strncpy(&rep[16], locator.
device_id().c_str(), 24);
76 strncpy(&rep[40], locator.
actuator_id().c_str(), 24);
77 t.store().writeObject(skey, rep);
81 roo_prefs::Transaction t(collection_);
84 t.store().clear(skey);
88 roo_prefs::Transaction t(collection_,
true);
92 roo_prefs::ReadResult result = t.store().readObject(skey, rep);
93 if (result != roo_prefs::READ_OK) {
97 roo::string_view(&rep[16], 24));
102 roo_prefs::Transaction t(collection_);
106 memset(&rep[0], 0, 40);
107 strncpy(&rep[0], locator.
schema().c_str(), 16);
108 strncpy(&rep[16], locator.
device_id().c_str(), 24);
109 t.store().writeObject(skey, rep);
113 roo_prefs::Transaction t(collection_);
116 t.store().clear(skey);
Identifies actuator within a transceiver device.
const DeviceSchema & schema() const
Returns the device schema.
const DeviceId & device_id() const
Returns the device id.
const ActuatorId & actuator_id() const
Returns the actuator id.
void clearActuatorBinding(ActuatorKey key) override
void clearDeviceBinding(DeviceKey key) override
void setActuatorBinding(ActuatorKey key, const ActuatorLocator &locator) override
DeviceLocator getDeviceBinding(DeviceKey key) override
void setSensorBinding(SensorKey key, const SensorLocator &locator) override
ActuatorLocator getActuatorBinding(ActuatorKey key) override
SensorLocator getSensorBinding(SensorKey key) override
void setDeviceBinding(DeviceKey key, const DeviceLocator &locator) override
void clearSensorBinding(SensorKey key) override
Identifies a transceiver device by schema and device id.
const DeviceId & device_id() const
Returns the device id.
const DeviceSchema & schema() const
Returns the device schema.
Identifies sensor within a transceiver device.
const SensorId & sensor_id() const
Returns the sensor id.
const DeviceSchema & schema() const
Returns the device schema.
const DeviceId & device_id() const
Returns the device id.