Skip to content

OcaBitstringSensor#

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

Bit string sensor.


Overview#

Class Declaration#

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

    // Control Methods
    // Calls GetNrBits and calls on_result or on_failure
    void GetNrBits(auto on_result, failure_callback on_failure);
    // Calls GetBit and calls on_result or on_failure
    void GetBit(OcaUint16 bitNr, auto on_result, failure_callback on_failure);
    // Calls GetBit and does not wait for the response
    void GetBit(OcaUint16 bitNr);
    // Calls GetReading and calls on_result or on_failure
    void GetReading(auto on_result, failure_callback on_failure);

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

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

Methods#

GetNrBits#

void GetNrBits(auto on_result, failure_callback on_failure)

Calls the method GetNrBits in the remote device.

Parameters:#

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

GetBit#

void GetBit(OcaUint16 bitNr, auto on_result, failure_callback on_failure)

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

Parameters:#

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

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:
    • OcaBitstring Reading
  • 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: OcaBitstring Reading
  • 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: OcaBitstring Reading
  • failure_callback on_failure: A callback which is called on error.