Skip to content

OcaStringSensor#

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

UTF-8 string sensor.


Overview#

Class Declaration#

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

    // Control Methods
    // Calls GetReading and calls on_result or on_failure
    void GetReading(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 maxLen, auto on_result, failure_callback on_failure);
    // Calls SetMaxLen and does not wait for the response
    void SetMaxLen(OcaUint16 maxLen);

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

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

Methods#

GetReading#

void GetReading(auto on_result, failure_callback on_failure)

Calls the method GetReading in the remote device.

Parameters:#

  • auto on_result: A callable (e.g. a lambda) with the following arguments:
    • OcaString Reading
  • 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 maxLen
  • failure_callback on_failure: A callback which is called on error.

SetMaxLen#

void SetMaxLen(OcaUint16 maxLen, 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 maxLen
  • auto on_result: A callable (e.g. a lambda) with 0 arguments.
  • failure_callback on_failure: A callback which is called on error.

observeReading#

subscription observeReading(auto callback, failure_callback on_failure)

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

Parameters:#

  • auto callback: A callable (e.g. a lambda) with one argument: OcaString Reading
  • 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.

OnReadingChanged#

subscription OnReadingChanged(auto callback, failure_callback on_failure)

Parameters#

  • auto callback: A callable (e.g. a lambda) with one argument: OcaString Reading
  • 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.