Esempio n. 1
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);
            }
        }
Esempio n. 2
0
        public static void LinkToApiExt(this etc EtcDevice, BasicTriList trilist, uint joinStart, string joinMapKey)
        {
            EtcDeviceJoinMap deviceJoinMap = new EtcDeviceJoinMap(joinStart);
            EtcSceneJoinMap  sceneMap      = new EtcSceneJoinMap(joinStart);

            ushort offset = 1;

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

            //Digtials
            trilist.SetSigTrueAction(deviceJoinMap.PollScenes, () => EtcDevice.PollScenes());

            //Serials
            trilist.SetStringSigAction(deviceJoinMap.TestRx, s => { EtcDevice.ParseRx(s); });
            trilist.SetStringSigAction(deviceJoinMap.CommandPassThruTx, s => { EtcDevice.SendLineRaw(s); });

            trilist.SetStringSigAction(deviceJoinMap.RecallScene, s => { EtcDevice.SetSceneByName(s); });

            //To Bridge
            EtcDevice.TestTxFeedback.LinkInputSig(trilist.StringInput[deviceJoinMap.TestTx]);
            EtcDevice.CommandPassThruFeedback.LinkInputSig(trilist.StringInput[deviceJoinMap.CommandPassThruRx]);
            EtcDevice.ActivePresetFeedback.LinkInputSig(trilist.StringInput[deviceJoinMap.ActivePreset]);



            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 scenes");

                //Digtials
                trilist.SetSigTrueAction(sceneMap.PollScene + offset, () => genericScene.pollScene());
                trilist.SetSigTrueAction(sceneMap.SceneSet + offset, () => genericScene.SetScene());

                trilist.BooleanInput[sceneMap.Enable + offset].BoolValue = genericScene.enabled;

                //Serials
                Debug.Console(2, "Generic Zone Name: {0} Enabled: {1}", genericScene.sceneName, genericScene.enabled);

                trilist.StringInput[sceneMap.Name + offset].StringValue = genericScene.sceneName;


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

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


                offset++;
            }
        }