Skip to content

OcaJsonSensor#

This document describes the controller implementation of OcaJsonSensor. This class is documented in the AES70 standard as:

JSON value actuator, with or without schema.


Overview#

Class Declaration#

namespace aes70::controller
{
  class OcaJsonSensor : public OcaBasicSensor
  {
  public:
    OcaJsonSensor(std::shared_ptr<connection> connection,
            uin32_t object_number);
    OcaJsonSensor(const OcaJsonSensor &o);

    // Control Methods
    // Calls GetValue and calls on_result or on_failure
    void GetValue(auto on_result, failure_callback on_failure);
    // Calls GetMaxLen and calls on_result or on_failure
    void GetMaxLen(auto on_result, failure_callback on_failure);
    // Calls SetMaxLen and calls on_result or on_failure
    void SetMaxLen(OcaUint16 Len, auto on_result, failure_callback on_failure);
    // Calls SetMaxLen and does not wait for the response
    void SetMaxLen(OcaUint16 Len);

    // Observing Properties
    subscription observeValue(auto callback, failure_callback on_failure);
    subscription observeMaxLen(auto callback, failure_callback on_failure);

    // Property Changed Subscriptions
    subscription OnValueChanged(auto callback, failure_callback on_failure);
    subscription OnMaxLenChanged(auto callback, failure_callback on_failure);
  };
}

Methods#

GetValue#

void GetValue(auto on_result, failure_callback on_failure)

Calls the method GetValue in the remote device.

Parameters:#

  • auto on_result: A callable (e.g. a lambda) with the following arguments:
    • OcaJsonValue Value
  • failure_callback on_failure: A callback which is called on error.

GetMaxLen#

void GetMaxLen(auto on_result, failure_callback on_failure)

Calls the method GetMaxLen in the remote device.

Parameters:#

  • auto on_result: A callable (e.g. a lambda) with the following arguments:
    • OcaUint16 Len
  • failure_callback on_failure: A callback which is called on error.

SetMaxLen#

void SetMaxLen(OcaUint16 Len, auto on_result, failure_callback on_failure)

Calls the method SetMaxLen in the remote device. If no result and error callback is specified, the method will be called without requesting a response.

Parameters:#

  • OcaUint16 Len
  • auto on_result: A callable (e.g. a lambda) with 0 arguments.
  • failure_callback on_failure: A callback which is called on error.

observeValue#

subscription observeValue(auto callback, failure_callback on_failure)

Fetches the remote property Value and subscribes for modifications. The callback is called with the initial values of Value and whenever it changes.

Parameters:#

  • auto callback: A callable (e.g. a lambda) with one argument: OcaJsonValue Value
  • failure_callback on_failure: A callback which is called on error.

observeMaxLen#

subscription observeMaxLen(auto callback, failure_callback on_failure)

Fetches the remote property MaxLen and subscribes for modifications. The callback is called with the initial values of MaxLen and whenever it changes.

Parameters:#

  • auto callback: A callable (e.g. a lambda) with one argument: OcaUint16 MaxLen
  • failure_callback on_failure: A callback which is called on error.

OnValueChanged#

subscription OnValueChanged(auto callback, failure_callback on_failure)

Parameters#

  • auto callback: A callable (e.g. a lambda) with one argument: OcaJsonValue Value
  • failure_callback on_failure: A callback which is called on error.

OnMaxLenChanged#

subscription OnMaxLenChanged(auto callback, failure_callback on_failure)

Parameters#

  • auto callback: A callable (e.g. a lambda) with one argument: OcaUint16 MaxLen
  • failure_callback on_failure: A callback which is called on error.