#637 Updates LinkToApi method to map configured tuners

This commit is contained in:
Neil Dorin
2021-03-02 15:09:24 -07:00
parent f0415d0d05
commit 57f2d7c938
2 changed files with 42 additions and 10 deletions

View File

@@ -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
/// </summary>
[JsonProperty("mirroredTuners")]
public List<string> MirroredTuners { get; set; }
public Dictionary<uint, string> MirroredTuners { get; set; }
/// <summary>
/// Indicates the room

View File

@@ -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));
//}
}
}