setRelayOutputState method

Future<void> setRelayOutputState(
  1. String relayOutputToken, {
  2. bool active = true,
})

Sets the logical state of a relay output. active: true = active (trigger), false = inactive (reset).

Implementation

Future<void> setRelayOutputState(
  String relayOutputToken, {
  bool active = true,
}) async {
  final logicalState = active ? 'active' : 'inactive';
  OnvifLogger.instance.log(
    'SetRelayOutputState token=$relayOutputToken state=$logicalState',
    name: _tag,
  );
  final String body =
      '<tmd:SetRelayOutputState xmlns:tmd="http://www.onvif.org/ver10/deviceIO/wsdl">'
      '<tmd:RelayOutputToken>$relayOutputToken</tmd:RelayOutputToken>'
      '<tmd:LogicalState>$logicalState</tmd:LogicalState>'
      '</tmd:SetRelayOutputState>';
  await client.soapRequest(
    body,
    action: 'http://www.onvif.org/ver10/deviceIO/wsdl/SetRelayOutputState',
  );
  OnvifLogger.instance.log(
    'SetRelayOutputState OK token=$relayOutputToken',
    name: _tag,
  );
}