Exemplo n.º 1
0
        public void SetScene()
        {
            EtcCommand cmd;

            Debug.Console(2, "Set Scene: {0}", sceneName);
            cmdType   = "pst";
            cmdAction = "act";
            if (this.space != null)
            {
                if (this.fadeTime != null)
                {
                    cmd = new EtcCommand(this.cmdType, this.cmdAction, this.sceneName, this.space, this.fadeTime, _etx);
                }
                else
                {
                    cmd = new EtcCommand(this.cmdType, this.cmdAction, this.sceneName, this.space, _etx);
                }
            }
            else
            {
                cmd = new EtcCommand(this.cmdType, this.cmdAction, this.sceneName, _etx);
            }

            devPollTimer.StartTimer(1);
            _Parent.SendCommand(cmd);
            //_Parent.EnqueueCommand(cmd);
        }
Exemplo n.º 2
0
        public static void LinkToApiExt(this etc EtcDevice, BasicTriList trilist, uint joinStart, string joinMapKey)
        {
            //var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as LutronQuantumBridgeJoinMap;

            //if (joinMap == null)
            //	joinMap = new LutronQuantumDeviceJoinMap();

            EtcDeviceJoinMap deviceJoinMap = new EtcDeviceJoinMap();
            EtcSceneJoinMap  sceneMap      = new EtcSceneJoinMap();



            //ushort x = 1;
            ushort offset = 1;

            //trilist.SetStringSigAction(deviceJoinMap.CommandPassThruTx, s => LutronDevice.Sen

            Debug.Console(1, EtcDevice, "Linking Zones to Trilist '{0}'", trilist.ID.ToString("X"));

            trilist.SetStringSigAction(deviceJoinMap.TestRx, s => { EtcDevice.ParseRx(s); });
            trilist.SetStringSigAction(deviceJoinMap.CommandPassThruTx, s => { EtcDevice.SendCommand(s); });
            trilist.StringInput[deviceJoinMap.CommandPassThruRx].StringValue = EtcDevice.DeviceRx;

            EtcDevice.TestTxFeedback.LinkInputSig(trilist.StringInput[deviceJoinMap.TestTx]);



            foreach (var scene in EtcDevice.Scenes)
            {
                Debug.Console(2, "Zone: Num: {0} is {1} at Offset: {2}", offset, scene.Value.sceneName, offset);

                var genericScene = scene.Value;
                Debug.Console(2, "Linking commands");


                trilist.StringInput[sceneMap.Name + offset].StringValue = genericScene.sceneName;
                Debug.Console(2, "Generic Zone Name: {0} Enabled: {1}", genericScene.label, genericScene.enabled);
                Debug.Console(2, "Zone Name: {0} Enabled {1}", genericScene.sceneName, genericScene.enabled);
                trilist.BooleanInput[sceneMap.Enable + offset].BoolValue = genericScene.enabled;

                trilist.SetSigTrueAction(sceneMap.PollScene + offset, () => genericScene.pollScene());



                Debug.Console(2, "Linking scenes");
                trilist.SetSigTrueAction(sceneMap.SceneSet + offset, () => genericScene.SetScene());

                Debug.Console(2, "Linking Feedbacks");



                genericScene.SceneFeedback.LinkInputSig(trilist.BooleanInput[sceneMap.SceneFb + offset]);


                offset++;
                Debug.Console(2, " Offset is now {0}", offset);
            }
        }