Adds Display Controller base with some basic functioanlity.

This commit is contained in:
Jason T Alborough
2019-01-11 20:22:23 -05:00
parent e145bfbaee
commit 34f3e543f2
4 changed files with 127 additions and 149 deletions

View File

@@ -87,6 +87,11 @@ namespace PepperDash.Essentials.Bridges
(device as GenericComm).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); (device as GenericComm).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
continue; continue;
} }
else if (device is PepperDash.Essentials.Core.TwoWayDisplayBase)
{
(device as TwoWayDisplayBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
continue;
}
else if (device is DmChassisController) else if (device is DmChassisController)
{ {
(device as DmChassisController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); (device as DmChassisController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);

View File

@@ -14,9 +14,10 @@ using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.EthernetCommunication; using Crestron.SimplSharpPro.EthernetCommunication;
namespace PepperDash.Essentials namespace PepperDash.Essentials
{
public class BridgeFactory
{ {
public class BridgeFactory
{
public static IKeyed GetDevice(DeviceConfig dc) public static IKeyed GetDevice(DeviceConfig dc)
{ {
// ? why is this static JTA 2018-06-13? // ? why is this static JTA 2018-06-13?
@@ -39,53 +40,11 @@ namespace PepperDash.Essentials
return null; return null;
} }
} }
public class DmBridge : Device
{
public EiscBridgeProperties Properties { get; private set; }
public PepperDash.Essentials.DM.DmChassisController DmSwitch { get; private set; } public class CommBridge : Device
{
public DmBridge(string key, string name, JToken properties) : base(key, name)
{
Properties = JsonConvert.DeserializeObject<EiscBridgeProperties>(properties.ToString());
}
public override bool CustomActivate()
{
// Create EiscApis
if (Properties.Eiscs != null)
{
foreach (var eisc in Properties.Eiscs)
{
var ApiEisc = new BridgeApiEisc(eisc.IpId, eisc.Hostname);
ApiEisc.Eisc.SetUShortSigAction(101, u => DmSwitch.ExecuteSwitch(u,1, eRoutingSignalType.Video));
ApiEisc.Eisc.SetUShortSigAction(102, u => DmSwitch.ExecuteSwitch(u,2, eRoutingSignalType.Video));
}
}
foreach (var device in DeviceManager.AllDevices)
{
if (device.Key == this.Properties.ParentDeviceKey)
{
Debug.Console(0, "deviceKey {0} Matches", device.Key);
DmSwitch = DeviceManager.GetDeviceForKey(device.Key) as PepperDash.Essentials.DM.DmChassisController;
}
else
{
Debug.Console(0, "deviceKey {0} doesn't match", device.Key);
}
}
Debug.Console(0, "Bridge {0} Activated", this.Name);
return true;
}
}
public class CommBridge : Device
{
public CommBridgeProperties Properties { get; private set; } public CommBridgeProperties Properties { get; private set; }
public List<IBasicCommunication> CommDevices { get; private set; } public List<IBasicCommunication> CommDevices { get; private set; }
@@ -128,11 +87,11 @@ namespace PepperDash.Essentials
return true; return true;
} }
} }
public class EiscBridgeProperties public class EiscBridgeProperties
{ {
public string ParentDeviceKey { get; set; } public string ParentDeviceKey { get; set; }
public eApiType ApiType { get; set; } public eApiType ApiType { get; set; }
public List<EiscProperties> Eiscs { get; set; } public List<EiscProperties> Eiscs { get; set; }
@@ -143,17 +102,17 @@ namespace PepperDash.Essentials
public string IpId { get; set; } public string IpId { get; set; }
public string Hostname { get; set; } public string Hostname { get; set; }
} }
} }
public class CommBridgeProperties : EiscBridgeProperties public class CommBridgeProperties : EiscBridgeProperties
{ {
public List<string> CommDevices { get; set; } public List<string> CommDevices { get; set; }
} }
public enum eApiType { Eisc = 0 } public enum eApiType { Eisc = 0 }
public class BridgeApiEisc public class BridgeApiEisc
{ {
public uint Ipid { get; private set; } public uint Ipid { get; private set; }
public ThreeSeriesTcpIpEthernetIntersystemCommunications Eisc { get; private set; } public ThreeSeriesTcpIpEthernetIntersystemCommunications Eisc { get; private set; }
@@ -177,5 +136,6 @@ namespace PepperDash.Essentials
else if (uo is Action<string>) else if (uo is Action<string>)
(uo as Action<string>)(args.Sig.StringValue); (uo as Action<string>)(args.Sig.StringValue);
} }
}
} }
}

View File

@@ -10,7 +10,7 @@ using PepperDash.Essentials.Devices.Common;
namespace PepperDash.Essentials.Bridges namespace PepperDash.Essentials.Bridges
{ {
public static class SamsungDisplayControllerApiExtensions public static class DisplayControllerApiExtensions
{ {
public static void LinkToApi(this PepperDash.Essentials.Core.TwoWayDisplayBase displayDevice, BasicTriList trilist, uint joinStart, string joinMapKey) public static void LinkToApi(this PepperDash.Essentials.Core.TwoWayDisplayBase displayDevice, BasicTriList trilist, uint joinStart, string joinMapKey)
{ {
@@ -23,7 +23,7 @@ namespace PepperDash.Essentials.Bridges
joinMap.OffsetJoinNumbers(joinStart); joinMap.OffsetJoinNumbers(joinStart);
Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
Debug.Console(0, "Linking to lighting Type {0}", displayDevice.GetType().Name.ToString()); Debug.Console(0, "Linking to Bridge Type {0}", displayDevice.GetType().Name.ToString());
var commMonitor = displayDevice as ICommunicationMonitor; var commMonitor = displayDevice as ICommunicationMonitor;
commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]);
@@ -37,6 +37,18 @@ namespace PepperDash.Essentials.Bridges
trilist.SetSigTrueAction(joinMap.PowerOn, () => displayDevice.PowerOn()); trilist.SetSigTrueAction(joinMap.PowerOn, () => displayDevice.PowerOn());
displayDevice.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PowerOn]); displayDevice.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PowerOn]);
trilist.SetUShortSigAction(joinMap.InputSelect, (a) =>
{
if (a == 0)
{
displayDevice.PowerOff();
}
else if (a > 0 && a < displayDevice.InputPorts.Count)
{
displayDevice.ExecuteSwitch(displayDevice.InputPorts.ElementAt(a - 1).Selector);
}
});
// GenericLighitng Actions & FeedBack // GenericLighitng Actions & FeedBack
// int sceneIndex = 1; // int sceneIndex = 1;
@@ -83,6 +95,7 @@ namespace PepperDash.Essentials.Bridges
{ {
public uint IsOnline { get; set; } public uint IsOnline { get; set; }
public uint PowerOff { get; set; } public uint PowerOff { get; set; }
public uint InputSelect { get; set; }
public uint PowerOn { get; set; } public uint PowerOn { get; set; }
public uint SelectScene { get; set; } public uint SelectScene { get; set; }
public uint LightingSceneOffset { get; set; } public uint LightingSceneOffset { get; set; }
@@ -95,7 +108,7 @@ namespace PepperDash.Essentials.Bridges
IsOnline = 1; IsOnline = 1;
PowerOff = 1; PowerOff = 1;
PowerOn = 2; PowerOn = 2;
SelectScene = 1; InputSelect = 1;
IntegrationIdSet = 1; IntegrationIdSet = 1;
LightingSceneOffset = 10; LightingSceneOffset = 10;
ButtonVisibilityOffset = 40; ButtonVisibilityOffset = 40;