OcaStateSensor#
This document describes the controller implementation of OcaStateSensor. This class is documented in the AES70 standard as:
Sensor that reports a 1-of-n state. Sensor counterpart of the actuator OcaSwitch.
Overview#
- ClassID: 1.1.2.12
- Header:
aes70/controller/OcaStateSensor.hpp
- Namespace:
aes70::controller
- Inheritance: aes70::controller::OcaSensor, aes70::controller::OcaWorker, aes70::controller::OcaRoot, aes70::controller::object
Class Declaration#
namespace aes70::controller
{
class OcaStateSensor : public OcaSensor
{
public:
OcaStateSensor(std::shared_ptr<connection> connection,
uin32_t object_number);
OcaStateSensor(const OcaStateSensor &o);
// Control Methods
// Calls GetState and calls on_result or on_failure
void GetState(auto on_result, failure_callback on_failure);
// Calls GetStateNames and calls on_result or on_failure
void GetStateNames(auto on_result, failure_callback on_failure);
// Calls SetStateNames and calls on_result or on_failure
void SetStateNames(OcaList<OcaString> Names, auto on_result, failure_callback on_failure);
// Calls SetStateNames and does not wait for the response
void SetStateNames(OcaList<OcaString> Names);
// Observing Properties
subscription observeState(auto callback, failure_callback on_failure);
subscription observeStateNames(auto callback, failure_callback on_failure);
// Property Changed Subscriptions
subscription OnStateChanged(auto callback, failure_callback on_failure);
subscription OnStateNamesChanged(auto callback, failure_callback on_failure);
};
}
Methods#
GetState#
void GetState(auto on_result, failure_callback on_failure)
Calls the method GetState in the remote device.
Parameters:#
auto on_result
: A callable (e.g. a lambda) with the following arguments:OcaUint16 State
OcaUint16 minState
OcaUint16 maxState
failure_callback on_failure
: A callback which is called on error.
GetStateNames#
void GetStateNames(auto on_result, failure_callback on_failure)
Calls the method GetStateNames in the remote device.
Parameters:#
auto on_result
: A callable (e.g. a lambda) with the following arguments:OcaList<OcaString> Names
failure_callback on_failure
: A callback which is called on error.
SetStateNames#
void SetStateNames(OcaList<OcaString> Names, auto on_result, failure_callback on_failure)
Calls the method SetStateNames in the remote device. If no result and error callback is specified, the method will be called without requesting a response.
Parameters:#
OcaList<OcaString> Names
auto on_result
: A callable (e.g. a lambda) with 0 arguments.failure_callback on_failure
: A callback which is called on error.
observeState#
subscription observeState(auto callback, failure_callback on_failure)
Fetches the remote property State and subscribes for modifications. The callback is called with the initial values of State and whenever it changes.
Parameters:#
auto callback
: A callable (e.g. a lambda) with one argument:OcaUint16 State
failure_callback on_failure
: A callback which is called on error.
observeStateNames#
subscription observeStateNames(auto callback, failure_callback on_failure)
Fetches the remote property StateNames and subscribes for modifications. The callback is called with the initial values of StateNames and whenever it changes.
Parameters:#
auto callback
: A callable (e.g. a lambda) with one argument:OcaList<OcaString> StateNames
failure_callback on_failure
: A callback which is called on error.
OnStateChanged#
subscription OnStateChanged(auto callback, failure_callback on_failure)
Parameters#
auto callback
: A callable (e.g. a lambda) with one argument:OcaUint16 State
failure_callback on_failure
: A callback which is called on error.
OnStateNamesChanged#
subscription OnStateNamesChanged(auto callback, failure_callback on_failure)
Parameters#
auto callback
: A callable (e.g. a lambda) with one argument:OcaList<OcaString> StateNames
failure_callback on_failure
: A callback which is called on error.