Merge pull request #638 from PepperDash/feature/add-tuner-preset-mirror-config

Feature/add tuner preset mirror config
This commit is contained in:
Neil Dorin
2021-03-02 15:53:35 -07:00
committed by GitHub
2 changed files with 89 additions and 18 deletions

View File

@@ -5,30 +5,62 @@ namespace PepperDash.Essentials.Room.Config
{ {
public class EssentialsTechRoomConfig public class EssentialsTechRoomConfig
{ {
/// <summary>
/// The key of the dummy device used to enable routing
/// </summary>
[JsonProperty("dummySourceKey")] [JsonProperty("dummySourceKey")]
public string DummySourceKey { get; set; } public string DummySourceKey { get; set; }
/// <summary>
/// The keys of the displays assigned to this room
/// </summary>
[JsonProperty("displays")] [JsonProperty("displays")]
public List<string> Displays; public List<string> Displays { get; set; }
/// <summary>
/// The keys of the tuners assinged to this room
/// </summary>
[JsonProperty("tuners")] [JsonProperty("tuners")]
public List<string> Tuners; public List<string> Tuners { get; set; }
/// <summary>
/// PIN to access the room as a normal user
/// </summary>
[JsonProperty("userPin")] [JsonProperty("userPin")]
public string UserPin; public string UserPin { get; set; }
/// <summary>
/// PIN to access the room as a tech user
/// </summary>
[JsonProperty("techPin")] [JsonProperty("techPin")]
public string TechPin; public string TechPin { get; set; }
/// <summary>
/// Name of the presets file. Path prefix is assumed to be /html/presets/lists/
/// </summary>
[JsonProperty("presetsFileName")] [JsonProperty("presetsFileName")]
public string PresetsFileName; public string PresetsFileName { get; set; }
[JsonProperty("scheduledEvents")] [JsonProperty("scheduledEvents")]
public List<ScheduledEventConfig> ScheduledEvents; public List<ScheduledEventConfig> ScheduledEvents { get; set; }
[JsonProperty("isPrimary")] public bool IsPrimary; /// <summary>
/// Indicates that the room is the primary when true
/// </summary>
[JsonProperty("isPrimary")]
public bool IsPrimary { get; set; }
[JsonProperty("isTvPresetsProvider")] public bool IsTvPresetsProvider; /// <summary>
/// Indicates which tuners should mirror preset recall when two rooms are configured in a primary->secondary scenario
/// </summary>
[JsonProperty("mirroredTuners")]
public Dictionary<uint, string> MirroredTuners { get; set; }
/// <summary>
/// Indicates the room
/// </summary>
[JsonProperty("isTvPresetsProvider")]
public bool IsTvPresetsProvider;
public EssentialsTechRoomConfig() public EssentialsTechRoomConfig()
{ {

View File

@@ -373,13 +373,32 @@ Params: {2}"
uint i; uint i;
if (_config.IsPrimary) if (_config.IsPrimary)
{ {
i = 0; Debug.Console(1, this, "Linking Primary system Tuner Preset Mirroring");
foreach (var feedback in CurrentPresetsFeedbacks) if (_config.MirroredTuners != null && _config.MirroredTuners.Count > 0)
{ {
feedback.Value.LinkInputSig(trilist.StringInput[(uint) (joinMap.CurrentPreset.JoinNumber + i)]); foreach (var tuner in _config.MirroredTuners)
i++; {
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) => trilist.OnlineStatusChange += (device, args) =>
{ {
if (!args.DeviceOnLine) if (!args.DeviceOnLine)
@@ -395,15 +414,35 @@ Params: {2}"
return; return;
} }
else
i = 0;
foreach (var setTopBox in _tuners)
{ {
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));
//}
}
} }
} }