Skip to content

OcaPowerSensor#

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

Power sensor. Reading shall be a watts value and a power factor value.


Overview#

Class Declaration#

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

    // Control Methods
    // Calls GetReading and calls on_result or on_failure
    void GetReading(auto on_result, failure_callback on_failure);

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

    // Property Changed Subscriptions
    subscription OnPowerChanged(auto callback, failure_callback on_failure);
    subscription OnPowerFactorChanged(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:
    • OcaFloat32 Power
    • OcaFloat32 PowerFactor
    • OcaFloat32 minPower
    • OcaFloat32 maxPower
  • failure_callback on_failure: A callback which is called on error.

observePower#

subscription observePower(auto callback, failure_callback on_failure)

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

Parameters:#

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

observePowerFactor#

subscription observePowerFactor(auto callback, failure_callback on_failure)

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

Parameters:#

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

OnPowerChanged#

subscription OnPowerChanged(auto callback, failure_callback on_failure)

Parameters#

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

OnPowerFactorChanged#

subscription OnPowerFactorChanged(auto callback, failure_callback on_failure)

Parameters#

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