diff --git a/PepperDashEssentials/Room/Config/EssentialsTechRoomConfig.cs b/PepperDashEssentials/Room/Config/EssentialsTechRoomConfig.cs index 06e67f39..9ff3a2d2 100644 --- a/PepperDashEssentials/Room/Config/EssentialsTechRoomConfig.cs +++ b/PepperDashEssentials/Room/Config/EssentialsTechRoomConfig.cs @@ -5,30 +5,62 @@ namespace PepperDash.Essentials.Room.Config { public class EssentialsTechRoomConfig { + /// + /// The key of the dummy device used to enable routing + /// [JsonProperty("dummySourceKey")] public string DummySourceKey { get; set; } + /// + /// The keys of the displays assigned to this room + /// [JsonProperty("displays")] - public List Displays; + public List Displays { get; set; } + /// + /// The keys of the tuners assinged to this room + /// [JsonProperty("tuners")] - public List Tuners; + public List Tuners { get; set; } + /// + /// PIN to access the room as a normal user + /// [JsonProperty("userPin")] - public string UserPin; + public string UserPin { get; set; } + /// + /// PIN to access the room as a tech user + /// [JsonProperty("techPin")] - public string TechPin; + public string TechPin { get; set; } + /// + /// Name of the presets file. Path prefix is assumed to be /html/presets/lists/ + /// [JsonProperty("presetsFileName")] - public string PresetsFileName; + public string PresetsFileName { get; set; } [JsonProperty("scheduledEvents")] - public List ScheduledEvents; + public List ScheduledEvents { get; set; } - [JsonProperty("isPrimary")] public bool IsPrimary; + /// + /// Indicates that the room is the primary when true + /// + [JsonProperty("isPrimary")] + public bool IsPrimary { get; set; } - [JsonProperty("isTvPresetsProvider")] public bool IsTvPresetsProvider; + /// + /// Indicates which tuners should mirror preset recall when two rooms are configured in a primary->secondary scenario + /// + [JsonProperty("mirroredTuners")] + public Dictionary MirroredTuners { get; set; } + + /// + /// Indicates the room + /// + [JsonProperty("isTvPresetsProvider")] + public bool IsTvPresetsProvider; public EssentialsTechRoomConfig() { diff --git a/PepperDashEssentials/Room/Types/EssentialsTechRoom.cs b/PepperDashEssentials/Room/Types/EssentialsTechRoom.cs index bfa56646..b8bbc081 100644 --- a/PepperDashEssentials/Room/Types/EssentialsTechRoom.cs +++ b/PepperDashEssentials/Room/Types/EssentialsTechRoom.cs @@ -373,13 +373,32 @@ Params: {2}" uint i; if (_config.IsPrimary) { - i = 0; - foreach (var feedback in CurrentPresetsFeedbacks) + Debug.Console(1, this, "Linking Primary system Tuner Preset Mirroring"); + if (_config.MirroredTuners != null && _config.MirroredTuners.Count > 0) { - feedback.Value.LinkInputSig(trilist.StringInput[(uint) (joinMap.CurrentPreset.JoinNumber + i)]); - i++; + foreach (var tuner in _config.MirroredTuners) + { + var f = CurrentPresetsFeedbacks[tuner.Value]; + + if (f == null) + { + Debug.Console(1, this, "Unable to find feedback with key: {0}", tuner.Value); + continue; + } + + var join = joinMap.CurrentPreset.JoinNumber + tuner.Key; + f.LinkInputSig(trilist.StringInput[(uint)(join)]); + Debug.Console(1, this, "Linked Current Preset feedback for tuner: {0} to serial join: {1}", tuner.Value, join); + } } + //i = 0; + //foreach (var feedback in CurrentPresetsFeedbacks) + //{ + // feedback.Value.LinkInputSig(trilist.StringInput[(uint) (joinMap.CurrentPreset.JoinNumber + i)]); + // i++; + //} + trilist.OnlineStatusChange += (device, args) => { if (!args.DeviceOnLine) @@ -395,15 +414,35 @@ Params: {2}" return; } - - i = 0; - foreach (var setTopBox in _tuners) + else { - var tuner = setTopBox; + Debug.Console(1, this, "Linking Secondary system Tuner Preset Mirroring"); - trilist.SetStringSigAction(joinMap.CurrentPreset.JoinNumber + i, s => _tunerPresets.Dial(s, tuner.Value)); + if (_config.MirroredTuners != null && _config.MirroredTuners.Count > 0) + { + foreach (var tuner in _config.MirroredTuners) + { + var t = _tuners[tuner.Value]; - i++; + if (t == null) + { + Debug.Console(1, this, "Unable to find tuner with key: {0}", tuner.Value); + continue; + } + + var join = joinMap.CurrentPreset.JoinNumber + tuner.Key; + trilist.SetStringSigAction(join, s => _tunerPresets.Dial(s, t)); + Debug.Console(1, this, "Linked preset recall action for tuner: {0} to serial join: {1}", tuner.Value, join); + } + + //foreach (var setTopBox in _tuners) + //{ + // var tuner = setTopBox; + + // trilist.SetStringSigAction(joinMap.CurrentPreset.JoinNumber + i, s => _tunerPresets.Dial(s, tuner.Value)); + + //} + } } } diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/ConsoleCommMockDevice.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/ConsoleCommMockDevice.cs index 8fc31ea5..f360e52b 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/ConsoleCommMockDevice.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/ConsoleCommMockDevice.cs @@ -47,6 +47,13 @@ namespace PepperDash.Essentials.Core return true; } + void Port_LineReceived(object dev, GenericCommMethodReceiveTextArgs args) + { + if (Debug.Level == 2) + Debug.Console(2, this, "RX: '{0}'", + ShowHexResponse ? ComTextHelper.GetEscapedText(args.Text) : args.Text); + } + void SendLine(string s) { //if (Debug.Level == 2) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/GenericComm.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/GenericComm.cs index 8380a290..b59d35ff 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/GenericComm.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/GenericComm.cs @@ -96,6 +96,7 @@ namespace PepperDash.Essentials.Core // this is a permanent event handler. This cannot be -= from event CommPort.TextReceived += (s, a) => { + //Debug.Console(2, this, "RX: {0}", a.Text); trilist.SetString(joinMap.TextReceived.JoinNumber, a.Text); }; trilist.SetStringSigAction(joinMap.SendText.JoinNumber, s => CommPort.SendText(s)); diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/GenericHttpClient.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/GenericHttpClient.cs index 31342a94..87cde373 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/GenericHttpClient.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/GenericHttpClient.cs @@ -33,6 +33,7 @@ namespace PepperDash.Essentials.Core string url = string.Format("http://{0}/{1}", Client.HostName, path); request.Url = new UrlParser(url); HttpClient.DISPATCHASYNC_ERROR error = Client.DispatchAsyncEx(request, Response, request); + Debug.Console(2, this, "GenericHttpClient SentRequest TX:'{0}'", url); } public void SendText(string format, params object[] items) { @@ -40,6 +41,7 @@ namespace PepperDash.Essentials.Core string url = string.Format("http://{0}/{1}", Client.HostName, string.Format(format, items)); request.Url = new UrlParser(url); HttpClient.DISPATCHASYNC_ERROR error = Client.DispatchAsyncEx(request, Response, request); + Debug.Console(2, this, "GenericHttpClient SentRequest TX:'{0}'", url); } public void SendTextNoResponse(string format, params object[] items) @@ -48,6 +50,7 @@ namespace PepperDash.Essentials.Core string url = string.Format("http://{0}/{1}", Client.HostName, string.Format(format, items)); request.Url = new UrlParser(url); Client.Dispatch(request); + Debug.Console(2, this, "GenericHttpClient SentRequest TX:'{0}'", url); } private void Response(HttpClientResponse response, HTTP_CALLBACK_ERROR error, object request) @@ -60,6 +63,10 @@ namespace PepperDash.Essentials.Core { if (ResponseRecived != null) ResponseRecived(this, new GenericHttpClientEventArgs(responseReceived.ContentString, (request as HttpClientRequest).Url.ToString(), error)); + + Debug.Console(2, this, "GenericHttpClient ResponseReceived"); + Debug.Console(2, this, "RX:{0}", responseReceived.ContentString); + Debug.Console(2, this, "TX:{0}", (request as HttpClientRequest).Url.ToString()); } } diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Utilities/ActionSequence.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Utilities/ActionSequence.cs index bc1e8a4e..90c99579 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Utilities/ActionSequence.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Utilities/ActionSequence.cs @@ -47,7 +47,7 @@ namespace PepperDash.Essentials.Core.Utilities /// public void StartSequence() { - if (_worker.ThreadState == Thread.eThreadStates.ThreadRunning) + if (_worker !=null && _worker.ThreadState == Thread.eThreadStates.ThreadRunning) { Debug.Console(1, this, "Thread already running. Cannot Start Sequence"); return; diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs index 248518aa..d88af7f4 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs @@ -820,7 +820,7 @@ namespace PepperDash.Essentials.DM { if (RouteOffTimers.ContainsKey(pnt)) return; - RouteOffTimers[pnt] = new CTimer(o => ExecuteSwitch(0, pnt.Number, pnt.Type), RouteOffTime); + RouteOffTimers[pnt] = new CTimer(o => ExecuteSwitch(null, pnt.Selector, pnt.Type), RouteOffTime); } #region IRouting Members