From f0415d0d059f5f0d527e320fe672665480278ba6 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Tue, 2 Mar 2021 11:57:10 -0700 Subject: [PATCH 1/3] Adds new mirroredTuners config property and additional help comments --- .../Room/Config/EssentialsTechRoomConfig.cs | 48 +++++++++++++++---- 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/PepperDashEssentials/Room/Config/EssentialsTechRoomConfig.cs b/PepperDashEssentials/Room/Config/EssentialsTechRoomConfig.cs index 06e67f39..4404b377 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 List MirroredTuners { get; set; } + + /// + /// Indicates the room + /// + [JsonProperty("isTvPresetsProvider")] + public bool IsTvPresetsProvider; public EssentialsTechRoomConfig() { From 57f2d7c9389aa70719611efec2cb31c658503e3f Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Tue, 2 Mar 2021 15:09:24 -0700 Subject: [PATCH 2/3] #637 Updates LinkToApi method to map configured tuners --- .../Room/Config/EssentialsTechRoomConfig.cs | 2 +- .../Room/Types/EssentialsTechRoom.cs | 50 +++++++++++++++---- 2 files changed, 42 insertions(+), 10 deletions(-) diff --git a/PepperDashEssentials/Room/Config/EssentialsTechRoomConfig.cs b/PepperDashEssentials/Room/Config/EssentialsTechRoomConfig.cs index 4404b377..9ff3a2d2 100644 --- a/PepperDashEssentials/Room/Config/EssentialsTechRoomConfig.cs +++ b/PepperDashEssentials/Room/Config/EssentialsTechRoomConfig.cs @@ -54,7 +54,7 @@ namespace PepperDash.Essentials.Room.Config /// Indicates which tuners should mirror preset recall when two rooms are configured in a primary->secondary scenario /// [JsonProperty("mirroredTuners")] - public List MirroredTuners { get; set; } + public Dictionary MirroredTuners { get; set; } /// /// Indicates the room diff --git a/PepperDashEssentials/Room/Types/EssentialsTechRoom.cs b/PepperDashEssentials/Room/Types/EssentialsTechRoom.cs index bfa56646..2908642a 100644 --- a/PepperDashEssentials/Room/Types/EssentialsTechRoom.cs +++ b/PepperDashEssentials/Room/Types/EssentialsTechRoom.cs @@ -373,13 +373,30 @@ Params: {2}" uint i; if (_config.IsPrimary) { - i = 0; - foreach (var feedback in CurrentPresetsFeedbacks) + + 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; + } + + f.LinkInputSig(trilist.StringInput[(uint)(joinMap.CurrentPreset.JoinNumber + tuner.Key)]); + } } + //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) @@ -396,14 +413,29 @@ Params: {2}" return; } - i = 0; - foreach (var setTopBox in _tuners) + + if (_config.MirroredTuners != null && _config.MirroredTuners.Count > 0) { - var tuner = setTopBox; + foreach (var tuner in _config.MirroredTuners) + { + var t = _tuners[tuner.Value]; - trilist.SetStringSigAction(joinMap.CurrentPreset.JoinNumber + i, s => _tunerPresets.Dial(s, tuner.Value)); + if (t == null) + { + Debug.Console(1, this, "Unable to find tuner with key: {0}", tuner.Value); + continue; + } - i++; + trilist.SetStringSigAction(joinMap.CurrentPreset.JoinNumber + tuner.Key, s => _tunerPresets.Dial(s, t)); + } + + //foreach (var setTopBox in _tuners) + //{ + // var tuner = setTopBox; + + // trilist.SetStringSigAction(joinMap.CurrentPreset.JoinNumber + i, s => _tunerPresets.Dial(s, tuner.Value)); + + //} } } From 847e106b8d3f7bad487b0a0de43e5431d24c0a65 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Tue, 2 Mar 2021 15:34:35 -0700 Subject: [PATCH 3/3] Adds some debug statements at level 1 to help confirm joins are mapped correctly --- .../Room/Types/EssentialsTechRoom.cs | 47 +++++++++++-------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/PepperDashEssentials/Room/Types/EssentialsTechRoom.cs b/PepperDashEssentials/Room/Types/EssentialsTechRoom.cs index 2908642a..b8bbc081 100644 --- a/PepperDashEssentials/Room/Types/EssentialsTechRoom.cs +++ b/PepperDashEssentials/Room/Types/EssentialsTechRoom.cs @@ -373,7 +373,7 @@ Params: {2}" uint i; if (_config.IsPrimary) { - + Debug.Console(1, this, "Linking Primary system Tuner Preset Mirroring"); if (_config.MirroredTuners != null && _config.MirroredTuners.Count > 0) { foreach (var tuner in _config.MirroredTuners) @@ -386,7 +386,9 @@ Params: {2}" continue; } - f.LinkInputSig(trilist.StringInput[(uint)(joinMap.CurrentPreset.JoinNumber + tuner.Key)]); + 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); } } @@ -412,30 +414,35 @@ Params: {2}" return; } - - - if (_config.MirroredTuners != null && _config.MirroredTuners.Count > 0) + else { - foreach (var tuner in _config.MirroredTuners) - { - var t = _tuners[tuner.Value]; + Debug.Console(1, this, "Linking Secondary system Tuner Preset Mirroring"); - if (t == null) + if (_config.MirroredTuners != null && _config.MirroredTuners.Count > 0) + { + foreach (var tuner in _config.MirroredTuners) { - Debug.Console(1, this, "Unable to find tuner with key: {0}", tuner.Value); - continue; + var t = _tuners[tuner.Value]; + + 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); } - trilist.SetStringSigAction(joinMap.CurrentPreset.JoinNumber + tuner.Key, s => _tunerPresets.Dial(s, t)); + //foreach (var setTopBox in _tuners) + //{ + // var tuner = setTopBox; + + // trilist.SetStringSigAction(joinMap.CurrentPreset.JoinNumber + i, s => _tunerPresets.Dial(s, tuner.Value)); + + //} } - - //foreach (var setTopBox in _tuners) - //{ - // var tuner = setTopBox; - - // trilist.SetStringSigAction(joinMap.CurrentPreset.JoinNumber + i, s => _tunerPresets.Dial(s, tuner.Value)); - - //} } }