Skip to content

OcaPowerManager#

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

Optional manager that manages power settings and state. May be instantiated at most once in any device., If instantiated, object number must be 5.


Overview#

Class Declaration#

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

    // Control Methods
    // Calls GetState and calls on_result or on_failure
    void GetState(auto on_result, failure_callback on_failure);
    // Calls SetTargetState and calls on_result or on_failure
    void SetTargetState(OcaPowerState State, auto on_result, failure_callback on_failure);
    // Calls SetTargetState and does not wait for the response
    void SetTargetState(OcaPowerState State);
    // Calls GetPowerSupplies and calls on_result or on_failure
    void GetPowerSupplies(auto on_result, failure_callback on_failure);
    // Calls GetActivePowerSupplies and calls on_result or on_failure
    void GetActivePowerSupplies(auto on_result, failure_callback on_failure);
    // Calls ExchangePowerSupply and calls on_result or on_failure
    void ExchangePowerSupply(OcaONo oldPsu, OcaONo newPsu, OcaBoolean powerOffOld, auto on_result, failure_callback on_failure);
    // Calls ExchangePowerSupply and does not wait for the response
    void ExchangePowerSupply(OcaONo oldPsu, OcaONo newPsu, OcaBoolean powerOffOld);
    // Calls GetAutoState and calls on_result or on_failure
    void GetAutoState(auto on_result, failure_callback on_failure);
    // Calls GetTargetState and calls on_result or on_failure
    void GetTargetState(auto on_result, failure_callback on_failure);

    // Observing Properties
    subscription observeState(auto callback, failure_callback on_failure);
    subscription observePowerSupplies(auto callback, failure_callback on_failure);
    subscription observeActivePowerSupplies(auto callback, failure_callback on_failure);
    subscription observeAutoState(auto callback, failure_callback on_failure);
    subscription observeTargetState(auto callback, failure_callback on_failure);

    // Property Changed Subscriptions
    subscription OnStateChanged(auto callback, failure_callback on_failure);
    subscription OnPowerSuppliesChanged(auto callback, failure_callback on_failure);
    subscription OnActivePowerSuppliesChanged(auto callback, failure_callback on_failure);
    subscription OnAutoStateChanged(auto callback, failure_callback on_failure);
    subscription OnTargetStateChanged(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:
    • OcaPowerState State
  • failure_callback on_failure: A callback which is called on error.

SetTargetState#

void SetTargetState(OcaPowerState State, auto on_result, failure_callback on_failure)

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

Parameters:#

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

GetPowerSupplies#

void GetPowerSupplies(auto on_result, failure_callback on_failure)

Calls the method GetPowerSupplies in the remote device.

Parameters:#

  • auto on_result: A callable (e.g. a lambda) with the following arguments:
    • OcaList<OcaONo> psuList
  • failure_callback on_failure: A callback which is called on error.

GetActivePowerSupplies#

void GetActivePowerSupplies(auto on_result, failure_callback on_failure)

Calls the method GetActivePowerSupplies in the remote device.

Parameters:#

  • auto on_result: A callable (e.g. a lambda) with the following arguments:
    • OcaList<OcaONo> psuList
  • failure_callback on_failure: A callback which is called on error.

ExchangePowerSupply#

void ExchangePowerSupply(OcaONo oldPsu, OcaONo newPsu, OcaBoolean powerOffOld, auto on_result, failure_callback on_failure)

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

Parameters:#

  • OcaONo oldPsu
  • OcaONo newPsu
  • OcaBoolean powerOffOld
  • auto on_result: A callable (e.g. a lambda) with 0 arguments.
  • failure_callback on_failure: A callback which is called on error.

GetAutoState#

void GetAutoState(auto on_result, failure_callback on_failure)

Calls the method GetAutoState in the remote device.

Parameters:#

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

GetTargetState#

void GetTargetState(auto on_result, failure_callback on_failure)

Calls the method GetTargetState in the remote device.

Parameters:#

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

observePowerSupplies#

subscription observePowerSupplies(auto callback, failure_callback on_failure)

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

Parameters:#

  • auto callback: A callable (e.g. a lambda) with one argument: OcaList<OcaONo> PowerSupplies
  • failure_callback on_failure: A callback which is called on error.

observeActivePowerSupplies#

subscription observeActivePowerSupplies(auto callback, failure_callback on_failure)

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

Parameters:#

  • auto callback: A callable (e.g. a lambda) with one argument: OcaList<OcaONo> ActivePowerSupplies
  • failure_callback on_failure: A callback which is called on error.

observeAutoState#

subscription observeAutoState(auto callback, failure_callback on_failure)

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

Parameters:#

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

observeTargetState#

subscription observeTargetState(auto callback, failure_callback on_failure)

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

Parameters:#

  • auto callback: A callable (e.g. a lambda) with one argument: OcaPowerState TargetState
  • 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: OcaPowerState State
  • failure_callback on_failure: A callback which is called on error.

OnPowerSuppliesChanged#

subscription OnPowerSuppliesChanged(auto callback, failure_callback on_failure)

Parameters#

  • auto callback: A callable (e.g. a lambda) with one argument: OcaList<OcaONo> PowerSupplies
  • failure_callback on_failure: A callback which is called on error.

OnActivePowerSuppliesChanged#

subscription OnActivePowerSuppliesChanged(auto callback, failure_callback on_failure)

Parameters#

  • auto callback: A callable (e.g. a lambda) with one argument: OcaList<OcaONo> ActivePowerSupplies
  • failure_callback on_failure: A callback which is called on error.

OnAutoStateChanged#

subscription OnAutoStateChanged(auto callback, failure_callback on_failure)

Parameters#

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

OnTargetStateChanged#

subscription OnTargetStateChanged(auto callback, failure_callback on_failure)

Parameters#

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