/// <summary> /// Raises the RF command received event. /// </summary> /// <param name="args">Arguments.</param> protected virtual void OnRfCommandReceived(RfCommandReceivedEventArgs args) { if (RfCommandReceived != null) { RfCommandReceived(this, args); } }
private void W800Rf32_RfCommandReceived(object sender, RfCommandReceivedEventArgs args) { string address = args.HouseCode.ToString() + args.UnitCode.ToString().Split('_')[1]; if (args.UnitCode == X10UnitCode.Unit_NotSet) return; var module = modules.Find(m => m.Address == address); if (module == null) { module = new InterfaceModule(); module.Domain = X10_DOMAIN; module.Address = address; module.Description = "W800RF32 module"; module.ModuleType = ModuleTypes.Switch; module.CustomData = 0.0D; modules.Add(module); OnInterfacePropertyChanged(this.GetDomain(), "1", "W800RF32 Receiver", ModuleEvents.Receiver_Status, "Added module " + address); OnInterfaceModulesChanged(X10_DOMAIN); } switch (args.Command) { case X10RfFunction.On: module.CustomData = 1.0D; break; case X10RfFunction.Off: module.CustomData = 0.0D; break; case X10RfFunction.Bright: double lbri = module.CustomData; lbri += 0.1; if (lbri > 1) lbri = 1; module.CustomData = lbri; break; case X10RfFunction.Dim: double ldim = module.CustomData; ldim -= 0.1; if (ldim < 0) ldim = 0; module.CustomData = ldim; break; case X10RfFunction.AllLightsOn: break; case X10RfFunction.AllLightsOff: break; } OnInterfacePropertyChanged(module.Domain, module.Address, "X10 Module", ModuleEvents.Status_Level, module.CustomData); }
static void X10rf_RfCommandReceived(object sender, RfCommandReceivedEventArgs args) { Console.WriteLine("Received X10 command {0} House Code {1} Unit {2}", args.Command, args.HouseCode, args.UnitCode); }
/// <summary> /// Raises the RF command received event. /// </summary> /// <param name="args">Arguments.</param> protected virtual void OnRfCommandReceived(RfCommandReceivedEventArgs args) { if (RfCommandReceived != null) RfCommandReceived(this, args); }