diff --git a/PepperDashEssentials/Bridges/BridgeBase.cs b/PepperDashEssentials/Bridges/BridgeBase.cs index e6ecf1c0..ecd5c26c 100644 --- a/PepperDashEssentials/Bridges/BridgeBase.cs +++ b/PepperDashEssentials/Bridges/BridgeBase.cs @@ -56,7 +56,6 @@ namespace PepperDash.Essentials.Bridges public ThreeSeriesTcpIpEthernetIntersystemCommunications Eisc { get; private set; } - public EiscApi(DeviceConfig dc) : base(dc.Key) { @@ -93,9 +92,9 @@ namespace PepperDash.Essentials.Bridges // (device as CameraBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); // continue; //} - else if (device is PepperDash.Essentials.Core.TwoWayDisplayBase) + else if (device is PepperDash.Essentials.Core.DisplayBase) { - (device as TwoWayDisplayBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + (device as DisplayBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); continue; } else if (device is DmChassisController) @@ -141,6 +140,66 @@ namespace PepperDash.Essentials.Bridges }); } + /// + /// Used for debugging to trigger an action based on a join number and type + /// + /// + /// + public void ExecuteJoinAction(uint join, string type, object state) + { + try + { + switch (type.ToLower()) + { + case "digital": + { + var uo = Eisc.BooleanOutput[join].UserObject as Action; + if (uo != null) + { + Debug.Console(1, this, "Executing Action: {0}", uo.ToString()); + uo(Convert.ToBoolean(state)); + } + else + Debug.Console(1, this, "User Action is null. Nothing to Execute"); + break; + } + case "analog": + { + var uo = Eisc.BooleanOutput[join].UserObject as Action; + if (uo != null) + { + Debug.Console(1, this, "Executing Action: {0}", uo.ToString()); + uo(Convert.ToUInt16(state)); + } + else + Debug.Console(1, this, "User Action is null. Nothing to Execute"); break; + } + case "serial": + { + var uo = Eisc.BooleanOutput[join].UserObject as Action; + if (uo != null) + { + Debug.Console(1, this, "Executing Action: {0}", uo.ToString()); + uo(Convert.ToString(state)); + } + else + Debug.Console(1, this, "User Action is null. Nothing to Execute"); + break; + } + default: + { + Debug.Console(1, "Unknown join type. Use digital/serial/analog"); + break; + } + } + } + catch (Exception e) + { + Debug.Console(1, this, "Error: {0}", e); + } + + } + /// /// Handles incoming sig changes /// @@ -151,6 +210,7 @@ namespace PepperDash.Essentials.Bridges if (Debug.Level >= 1) Debug.Console(1, this, "EiscApi change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue); var uo = args.Sig.UserObject; + Debug.Console(1, this, "Executing Action: {0}", uo.ToString()); if (uo is Action) (uo as Action)(args.Sig.BoolValue); else if (uo is Action) diff --git a/PepperDashEssentials/Bridges/DisplayControllerBridge.cs b/PepperDashEssentials/Bridges/DisplayControllerBridge.cs index ba4da8d0..b787b2d7 100644 --- a/PepperDashEssentials/Bridges/DisplayControllerBridge.cs +++ b/PepperDashEssentials/Bridges/DisplayControllerBridge.cs @@ -42,6 +42,8 @@ namespace PepperDash.Essentials.Bridges commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[JoinMap.IsOnline]); } + InputNumberFeedback = new IntFeedback(() => { return InputNumber; }); + // Two way feedbacks var twoWayDisplay = displayDevice as PepperDash.Essentials.Core.TwoWayDisplayBase; if (twoWayDisplay != null) @@ -50,7 +52,7 @@ namespace PepperDash.Essentials.Bridges twoWayDisplay.CurrentInputFeedback.OutputChange += new EventHandler(CurrentInputFeedback_OutputChange); - InputNumberFeedback = new IntFeedback(() => { return InputNumber; }); + InputNumberFeedback.LinkInputSig(_TriList.UShortInput[JoinMap.InputSelect]); } diff --git a/devjson commands.json b/devjson commands.json index e6251e87..9d8ed35d 100644 --- a/devjson commands.json +++ b/devjson commands.json @@ -36,5 +36,6 @@ devjson:2 {"deviceKey":"codec-comms-ssh", "methodName":"SendText", "params": ["x devjson:2 {"deviceKey":"codec-comms-ssh", "methodName":"Connect", "params": []} +devjson:1 {"deviceKey":"commBridge", "methodName":"ExecuteJoinAction", "params":[ 301, "digital", true ]} devjson:2 {"deviceKey":"display01Comm-com", "methodName":"SendText", "params": [ "I'M GETTING TIRED OF THIS" ]} \ No newline at end of file