Skip to content

Commit

Permalink
Merge pull request #3 from PepperDash/feature/update-bridging-method
Browse files Browse the repository at this point in the history
Updates to latest bridge methodology
  • Loading branch information
ndorin authored Jul 22, 2020
2 parents 0357732 + 841be3a commit d8ec889
Show file tree
Hide file tree
Showing 15 changed files with 124 additions and 234 deletions.
2 changes: 1 addition & 1 deletion EssentialsBuilds
Submodule EssentialsBuilds updated 48 files
+ Crestron.SimplSharpPro.DM.dll
+ Crestron.SimplSharpPro.DeviceSupport.dll
+ Crestron.SimplSharpPro.EthernetCommunications.dll
+ Crestron.SimplSharpPro.Fusion.dll
+ Crestron.SimplSharpPro.Gateways.dll
+ Crestron.SimplSharpPro.GeneralIO.dll
+ Crestron.SimplSharpPro.Lighting.dll
+ Crestron.SimplSharpPro.Remotes.dll
+ Crestron.SimplSharpPro.Shades.dll
+ Crestron.SimplSharpPro.ThreeSeriesCards.dll
+ Crestron.SimplSharpPro.UI.dll
+ Essentials Devices Common.cplz
+ Essentials Devices Common.dll
+ PepperDashEssentials-1.5.8.cpz
+ PepperDashEssentials.dll
+ PepperDashEssentials1.4.14.cpz
+ PepperDashEssentials1.4.15.cpz
+ PepperDashEssentials1.4.16.cpz
+ PepperDashEssentials1.4.17.cpz
+ PepperDashEssentials1.4.18.cpz
+ PepperDashEssentials1.4.19.cpz
+ PepperDashEssentials1.4.20.cpz
+ PepperDashEssentials1.4.21.cpz
+ PepperDashEssentials1.4.22.cpz
+ PepperDashEssentials1.4.23.cpz
+ PepperDashEssentials1.4.24.cpz
+ PepperDashEssentials1.4.25.cpz
+ PepperDashEssentials1.4.26.cpz
+ PepperDashEssentials1.4.27.cpz
+ PepperDashEssentials1.4.28.cpz
+ PepperDashEssentials1.4.29.cpz
+ PepperDashEssentials1.4.30.cpz
+ PepperDashEssentials1.4.31.cpz
+ PepperDashEssentials1.4.32.cpz
+ PepperDash_Core.clz
+ PepperDash_Core.dll
+3,754 −0 PepperDash_Core.xml
+ PepperDash_Essentials_Core.cplz
+ PepperDash_Essentials_Core.dll
+ PepperDash_Essentials_DM.cplz
+ PepperDash_Essentials_DM.dll
+0 −11 README.md
+ SimplSharpCustomAttributesInterface.dll
+ SimplSharpHelperInterface.dll
+ SimplSharpNewtonsoft.dll
+ SimplSharpReflectionInterface.dll
+ SimplSharpSQLHelperInterface.dll
+ SimplSharpTimerEventInterface.dll
1 change: 0 additions & 1 deletion PDT.PanasonicDisplay.EPI/PDT.PanasonicDisplay.EPI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@
</ItemGroup>
<ItemGroup>
<Compile Include="PanasonicDisplay.cs" />
<Compile Include="PanasonicDisplayBridge.cs" />
<Compile Include="PanasonicDisplayConfigObject.cs" />
<Compile Include="PluginFactory.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
Expand Down
Binary file modified PDT.PanasonicDisplay.EPI/PDT.PanasonicDisplay.EPI.suo
Binary file not shown.
Binary file modified PDT.PanasonicDisplay.EPI/PDT.PanasonicDisplay.projectinfo
Binary file not shown.
118 changes: 114 additions & 4 deletions PDT.PanasonicDisplay.EPI/PanasonicDisplay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

using PepperDash.Essentials.Core.Config;
using System.Collections;
using PepperDash.Essentials.Bridges;
using PepperDash.Essentials.Core.Bridges;



Expand All @@ -28,7 +28,8 @@ namespace PDT.PanasonicDisplay.EPI
/// <summary>
///
/// </summary>
public class PanasonicDisplay : TwoWayDisplayBase, IBasicVolumeWithFeedback, ICommunicationMonitor, IBridge
[Description("Panasonic TH series Display")]
public class PanasonicDisplay : TwoWayDisplayBase, IBasicVolumeWithFeedback, ICommunicationMonitor, IBridgeAdvanced
{
/// <summary>
/// The communication device
Expand Down Expand Up @@ -546,11 +547,120 @@ public void VolumeUp(bool pressRelease)
/// <param name="trilist"></param>
/// <param name="joinStart"></param>
/// <param name="joinMapKey"></param>
public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey)
public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{
this.LinkToApiExt(trilist, joinStart, joinMapKey);
DisplayControllerJoinMap joinMap = new DisplayControllerJoinMap(joinStart, typeof(DisplayControllerJoinMap));

var JoinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey);

if (!string.IsNullOrEmpty(JoinMapSerialized))
joinMap = JsonConvert.DeserializeObject<DisplayControllerJoinMap>(JoinMapSerialized);

if (bridge != null)
{
bridge.AddJoinMap(Key, joinMap);
}

Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
Debug.Console(0, "Linking to Display: {0}", Name);

trilist.StringInput[joinMap.Name.JoinNumber].StringValue = Name;


var commMonitor = this as ICommunicationMonitor;
if (commMonitor != null)
{
commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]);
}

InputNumberFeedback.LinkInputSig(trilist.UShortInput[joinMap.InputSelect.JoinNumber]);

// Two way feedbacks
var twoWayDisplay = this as PepperDash.Essentials.Core.TwoWayDisplayBase;
if (twoWayDisplay != null)
{
trilist.SetBool(joinMap.IsTwoWayDisplay.JoinNumber, true);

twoWayDisplay.CurrentInputFeedback.OutputChange += new EventHandler<FeedbackEventArgs>(CurrentInputFeedback_OutputChange);



}

// Power Off
trilist.SetSigTrueAction(joinMap.PowerOff.JoinNumber, () =>
{
PowerOff();
});

PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.PowerOff.JoinNumber]);

// PowerOn
trilist.SetSigTrueAction(joinMap.PowerOn.JoinNumber, () =>
{
PowerOn();
});


PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PowerOn.JoinNumber]);

int count = 1;
var displayBase = this as PepperDash.Essentials.Core.DisplayBase;
foreach (var input in InputPorts)
{
//displayDevice.InputKeys.Add(input.Key.ToString());
//var tempKey = InputKeys.ElementAt(count - 1);
trilist.SetSigTrueAction((ushort)(joinMap.InputSelectOffset.JoinNumber + count), () => { ExecuteSwitch(InputPorts[input.Key.ToString()].Selector); });
Debug.Console(2, this, "Setting Input Select Action on Digital Join {0} to Input: {1}", joinMap.InputSelectOffset.JoinNumber + count, InputPorts[input.Key.ToString()].Key.ToString());
trilist.StringInput[(ushort)(joinMap.InputNamesOffset.JoinNumber + count)].StringValue = input.Key.ToString();
count++;
}

Debug.Console(2, this, "Setting Input Select Action on Analog Join {0}", joinMap.InputSelect);
trilist.SetUShortSigAction(joinMap.InputSelect.JoinNumber, (a) =>
{
if (a == 0)
{
PowerOff();
}
else if (a > 0 && a < InputPorts.Count)
{
ExecuteSwitch(InputPorts.ElementAt(a - 1).Selector);
}
else if (a == 102)
{
PowerToggle();
}
Debug.Console(2, this, "InputChange {0}", a);
});


var volumeDisplay = this as IBasicVolumeControls;
if (volumeDisplay != null)
{
trilist.SetBoolSigAction(joinMap.VolumeUp.JoinNumber, (b) => volumeDisplay.VolumeUp(b));
trilist.SetBoolSigAction(joinMap.VolumeDown.JoinNumber, (b) => volumeDisplay.VolumeDown(b));
trilist.SetSigTrueAction(joinMap.VolumeMute.JoinNumber, () => volumeDisplay.MuteToggle());

var volumeDisplayWithFeedback = volumeDisplay as IBasicVolumeWithFeedback;
if (volumeDisplayWithFeedback != null)
{
volumeDisplayWithFeedback.VolumeLevelFeedback.LinkInputSig(trilist.UShortInput[joinMap.VolumeLevel.JoinNumber]);
volumeDisplayWithFeedback.MuteFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VolumeMute.JoinNumber]);
}
}
}

void CurrentInputFeedback_OutputChange(object sender, FeedbackEventArgs e)
{

Debug.Console(0, this, "CurrentInputFeedback_OutputChange {0}", e.StringValue);

}

#endregion
}
}
217 changes: 0 additions & 217 deletions PDT.PanasonicDisplay.EPI/PanasonicDisplayBridge.cs

This file was deleted.

Loading

0 comments on commit d8ec889

Please sign in to comment.