protected Task Handle(SerialResultEvent serialResultCommand) { var system = serialResultCommand.AsByte("System"); var code = serialResultCommand.AsUint("Code"); return(MessageBroker.Publish(InfraredEvent.Create(Uid, system, code), Uid)); }
protected async Task Handle(SerialResultEvent serialResultCommand) { var code = serialResultCommand.AsUint("Code"); var dipswitchCode = DipswitchCode.ParseCode(code); if (dipswitchCode == null) { Logger.LogWarning($"Unrecognized command parsed from code {code}"); return; } await MessageBroker.Publish(DipswitchEvent.Create(Uid, dipswitchCode.Unit.ToString(), dipswitchCode.System.ToString(), dipswitchCode.Command.ToString()), Uid); }