public override Task HandleCommand(MPowerConnector connector, CancellationToken token, double value, ePairControlUse control)
        {
            bool?output = null;

            if (control == ePairControlUse._Off)
            {
                output = false;
            }
            else if (control == ePairControlUse._On)
            {
                output = true;
            }
            else if (value == OffValue)
            {
                output = false;
            }
            else if (value == OnValue)
            {
                output = true;
            }

            if (output.HasValue)
            {
                return(connector.UpdateOutput(Port, output.Value, token));
            }
            else
            {
                return(Task.CompletedTask);
            }
        }
Beispiel #2
0
        public async Task HandleCommand(DeviceIdentifier deviceIdentifier, CancellationToken token,
                                        MPowerConnector connector, double value, ePairControlUse control)
        {
            if (deviceIdentifier.DeviceId != rootDeviceId)
            {
                throw new ArgumentException("Invalid Device Identifier");
            }

            if (!currentChildDevices.TryGetValue(deviceIdentifier.Address, out var deviceData))
            {
                throw new HspiException(Invariant($"{deviceIdentifier.Address} Not Found."));
            }

            await deviceData.HandleCommand(connector, token, value, control).ConfigureAwait(false);
        }
        public override Task HandleCommand(MPowerConnector connector, CancellationToken token, double value, ePairControlUse control)
        {
            bool output = false;

            if (control == ePairControlUse._Off)
            {
                output = false;
            }
            else if (control == ePairControlUse._On)
            {
                output = true;
            }
            else if (value == OffValue)
            {
                output = false;
            }
            else if (value == OnValue)
            {
                output = true;
            }

            return(connector.UpdateOutput(Port, output, token));
        }
 public virtual Task HandleCommand(MPowerConnector connector, CancellationToken token,
                                   double value, ePairControlUse control) => throw new NotImplementedException();