Esempio n. 1
0
        private void Cm19LibOnRfCommandReceived(object sender, RfCommandReceivedEventArgs args)
        {
            var address = lastAddressedModule;

            if (args.UnitCode != UnitCode.UnitNotSet)
            {
                address = lastAddressedModule = args.HouseCode + args.UnitCode.ToString().Replace("Unit_", "");
            }
            var module = standardModules.Find(m => m.Address == address);

            // ignore module if not belonging to monitored house codes
            if (module == null)
            {
                return;
            }
            ;
            switch (args.Command)
            {
            case Function.On:
                module.CustomData = 1D;
                UpdateModuleLevel(module);
                break;

            case Function.Off:
                module.CustomData = 0D;
                UpdateModuleLevel(module);
                break;

            case Function.Bright:
                module.CustomData = module.CustomData + 1D / 22D;
                if (module.CustomData > 1)
                {
                    module.CustomData = 1D;
                }
                UpdateModuleLevel(module);
                break;

            case Function.Dim:
                module.CustomData = module.CustomData - 1D / 22D;
                if (module.CustomData < 0)
                {
                    module.CustomData = 0D;
                }
                UpdateModuleLevel(module);
                break;

            case Function.AllLightsOn:
                // TODO: not implemented
                break;

            case Function.AllUnitsOff:
                // TODO: not implemented
                break;
            }
        }
Esempio n. 2
0
 // TODO: Cm19LibOnRfCameraReceived not implemented (perhaps not needed)
 private void Cm19LibOnRfCameraReceived(object sender, RfCommandReceivedEventArgs args)
 {
     /*
      * var address = lastAddressedModule = "CAMERA-" + args.HouseCode;
      * switch (args.Command)
      * {
      *      case RfFunction.CameraLeft:
      *          break;
      *      case RfFunction.CameraUp:
      *          break;
      *      case RfFunction.CameraRight:
      *          break;
      *      case RfFunction.CameraDown:
      *          break;
      * }
      */
     // TODO: not implemented (perhaps not needed)
 }