mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-01-26 02:44:57 +00:00
Adds DmTxControllerBridge
This commit is contained in:
@@ -76,13 +76,16 @@ namespace PepperDash.Essentials.Bridges
|
||||
{
|
||||
if (device is GenericComm)
|
||||
{
|
||||
|
||||
(device as GenericComm).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||
}
|
||||
if (device is DmChassisController)
|
||||
{
|
||||
(device as DmChassisController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||
}
|
||||
if (device is DmTxControllerBase)
|
||||
{
|
||||
(device as DmTxControllerBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,69 +135,69 @@ namespace PepperDash.Essentials.Bridges
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// API class for IBasicCommunication devices
|
||||
/// </summary>
|
||||
public class IBasicCommunicationApi : DeviceApiBase
|
||||
{
|
||||
public IBasicCommunication Device { get; set; }
|
||||
///// <summary>
|
||||
///// API class for IBasicCommunication devices
|
||||
///// </summary>
|
||||
//public class IBasicCommunicationApi : DeviceApiBase
|
||||
//{
|
||||
// public IBasicCommunication Device { get; set; }
|
||||
|
||||
SerialFeedback TextReceivedFeedback;
|
||||
// SerialFeedback TextReceivedFeedback;
|
||||
|
||||
public IBasicCommunicationApi(IBasicCommunication dev)
|
||||
{
|
||||
TextReceivedFeedback = new SerialFeedback();
|
||||
// public IBasicCommunicationApi(IBasicCommunication dev)
|
||||
// {
|
||||
// TextReceivedFeedback = new SerialFeedback();
|
||||
|
||||
Device = dev;
|
||||
// Device = dev;
|
||||
|
||||
SetupFeedbacks();
|
||||
// SetupFeedbacks();
|
||||
|
||||
ActionApi = new Dictionary<string, Object>
|
||||
{
|
||||
{ "connect", new Action(Device.Connect) },
|
||||
{ "disconnect", new Action(Device.Disconnect) },
|
||||
{ "connectstate", new Action<bool>( b => ConnectByState(b) ) },
|
||||
{ "sendtext", new Action<string>( s => Device.SendText(s) ) }
|
||||
// ActionApi = new Dictionary<string, Object>
|
||||
// {
|
||||
// { "connect", new Action(Device.Connect) },
|
||||
// { "disconnect", new Action(Device.Disconnect) },
|
||||
// { "connectstate", new Action<bool>( b => ConnectByState(b) ) },
|
||||
// { "sendtext", new Action<string>( s => Device.SendText(s) ) }
|
||||
|
||||
};
|
||||
// };
|
||||
|
||||
FeedbackApi = new Dictionary<string, Feedback>
|
||||
{
|
||||
{ "isconnected", new BoolFeedback( () => Device.IsConnected ) },
|
||||
{ "textrecieved", TextReceivedFeedback }
|
||||
};
|
||||
}
|
||||
// FeedbackApi = new Dictionary<string, Feedback>
|
||||
// {
|
||||
// { "isconnected", new BoolFeedback( () => Device.IsConnected ) },
|
||||
// { "textrecieved", TextReceivedFeedback }
|
||||
// };
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// Controls connection based on state of input
|
||||
/// </summary>
|
||||
/// <param name="state"></param>
|
||||
void ConnectByState(bool state)
|
||||
{
|
||||
if (state)
|
||||
Device.Connect();
|
||||
else
|
||||
Device.Disconnect();
|
||||
}
|
||||
// /// <summary>
|
||||
// /// Controls connection based on state of input
|
||||
// /// </summary>
|
||||
// /// <param name="state"></param>
|
||||
// void ConnectByState(bool state)
|
||||
// {
|
||||
// if (state)
|
||||
// Device.Connect();
|
||||
// else
|
||||
// Device.Disconnect();
|
||||
// }
|
||||
|
||||
void SetupFeedbacks()
|
||||
{
|
||||
Device.TextReceived += new EventHandler<GenericCommMethodReceiveTextArgs>(Device_TextReceived);
|
||||
// void SetupFeedbacks()
|
||||
// {
|
||||
// Device.TextReceived += new EventHandler<GenericCommMethodReceiveTextArgs>(Device_TextReceived);
|
||||
|
||||
if(Device is ISocketStatus)
|
||||
(Device as ISocketStatus).ConnectionChange += new EventHandler<GenericSocketStatusChageEventArgs>(IBasicCommunicationApi_ConnectionChange);
|
||||
}
|
||||
// if(Device is ISocketStatus)
|
||||
// (Device as ISocketStatus).ConnectionChange += new EventHandler<GenericSocketStatusChageEventArgs>(IBasicCommunicationApi_ConnectionChange);
|
||||
// }
|
||||
|
||||
void IBasicCommunicationApi_ConnectionChange(object sender, GenericSocketStatusChageEventArgs e)
|
||||
{
|
||||
FeedbackApi["isconnected"].FireUpdate();
|
||||
}
|
||||
// void IBasicCommunicationApi_ConnectionChange(object sender, GenericSocketStatusChageEventArgs e)
|
||||
// {
|
||||
// FeedbackApi["isconnected"].FireUpdate();
|
||||
// }
|
||||
|
||||
void Device_TextReceived(object sender, GenericCommMethodReceiveTextArgs e)
|
||||
{
|
||||
TextReceivedFeedback.FireUpdate(e.Text);
|
||||
}
|
||||
}
|
||||
// void Device_TextReceived(object sender, GenericCommMethodReceiveTextArgs e)
|
||||
// {
|
||||
// TextReceivedFeedback.FireUpdate(e.Text);
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace PepperDash.Essentials.Bridges
|
||||
|
||||
joinMap.OffsetJoinNumbers(joinStart);
|
||||
|
||||
Debug.Console(1, dmChassis, "Linking device '{0}' to Trilist '{1}'", dmChassis.Key, trilist.ID);
|
||||
Debug.Console(1, dmChassis, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||
|
||||
dmChassis.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]);
|
||||
|
||||
@@ -45,7 +45,8 @@ namespace PepperDash.Essentials.Bridges
|
||||
dmChassis.InputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.InputNames + ioSlot]);
|
||||
dmChassis.OutputVideoRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentVideoInputNames + ioSlot]);
|
||||
dmChassis.OutputAudioRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentAudioInputNames + ioSlot]);
|
||||
|
||||
dmChassis.InputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]);
|
||||
dmChassis.OutputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline + ioSlot]);
|
||||
|
||||
|
||||
}
|
||||
@@ -63,7 +64,8 @@ namespace PepperDash.Essentials.Bridges
|
||||
public uint OutputCurrentVideoInputNames { get; set; }
|
||||
public uint OutputCurrentAudioInputNames { get; set; }
|
||||
public uint InputCurrentResolution { get; set; }
|
||||
public uint InputSlotOnline { get; set; }
|
||||
public uint InputEndpointOnline { get; set; }
|
||||
public uint OutputEndpointOnline { get; set; }
|
||||
//public uint HdcpSupport { get; set; }
|
||||
//public uint HdcpSupportCapability { get; set; }
|
||||
|
||||
@@ -79,7 +81,8 @@ namespace PepperDash.Essentials.Bridges
|
||||
OutputCurrentVideoInputNames = 2000; //2001-2199
|
||||
OutputCurrentAudioInputNames = 2200; //2201-2399
|
||||
InputCurrentResolution = 2400; // 2401-2599
|
||||
InputSlotOnline = 500;
|
||||
InputEndpointOnline = 500;
|
||||
OutputEndpointOnline = 700;
|
||||
//HdcpSupport = 1000; //1001-1199
|
||||
//HdcpSupportCapability = 1200; //1201-1399
|
||||
|
||||
@@ -98,7 +101,8 @@ namespace PepperDash.Essentials.Bridges
|
||||
OutputCurrentVideoInputNames = OutputCurrentVideoInputNames + joinOffset;
|
||||
OutputCurrentAudioInputNames = OutputCurrentAudioInputNames + joinOffset;
|
||||
InputCurrentResolution = InputCurrentResolution + joinOffset;
|
||||
InputSlotOnline = InputSlotOnline + joinOffset;
|
||||
InputEndpointOnline = InputEndpointOnline + joinOffset;
|
||||
OutputEndpointOnline = OutputEndpointOnline + joinOffset;
|
||||
//HdcpSupport = HdcpSupport + joinOffset;
|
||||
//HdcpSupportCapability = HdcpSupportCapability + joinOffset;
|
||||
}
|
||||
|
||||
88
PepperDashEssentials/Bridges/DmTxControllerBridge.cs
Normal file
88
PepperDashEssentials/Bridges/DmTxControllerBridge.cs
Normal file
@@ -0,0 +1,88 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.DM;
|
||||
|
||||
namespace PepperDash.Essentials.Bridges
|
||||
{
|
||||
public static class DmTxControllerApiExtensions
|
||||
{
|
||||
public static void LinkToApi(this DmTxControllerBase tx, BasicTriList trilist, uint joinStart, string joinMapKey)
|
||||
{
|
||||
var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as DmTxControllerJoinMap;
|
||||
|
||||
if (joinMap == null)
|
||||
joinMap = new DmTxControllerJoinMap();
|
||||
|
||||
joinMap.OffsetJoinNumbers(joinStart);
|
||||
|
||||
Debug.Console(1, tx, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||
|
||||
tx.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]);
|
||||
tx.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus]);
|
||||
tx.AnyVideoInput.VideoStatus.VideoResolutionFeedback.LinkInputSig(trilist.StringInput[joinMap.CurrentInputResolution]);
|
||||
tx.HdcpSupportAllFeedback.LinkInputSig(trilist.UShortInput[joinMap.HdcpSupportState]);
|
||||
trilist.SetBoolSigAction(joinMap.HdcpSupportOn,
|
||||
new Action<bool>(b => tx.SetHdcpSupportAll(ePdtHdcpSupport.Auto)));
|
||||
tx.HdcpSupportAllFeedback.LinkInputSig(trilist.UShortInput[joinMap.HdcpSupportOn]);
|
||||
trilist.SetBoolSigAction(joinMap.HdcpSupportOff,
|
||||
new Action<bool>(b => tx.SetHdcpSupportAll(ePdtHdcpSupport.HdcpOff)));
|
||||
if (tx is ITxRouting)
|
||||
{
|
||||
trilist.SetUShortSigAction(joinMap.VideoInput,
|
||||
new Action<ushort>(i => (tx as ITxRouting).ExecuteNumericSwitch(i, 0, eRoutingSignalType.Video)));
|
||||
trilist.SetUShortSigAction(joinMap.AudioInput,
|
||||
new Action<ushort>(i => (tx as ITxRouting).ExecuteNumericSwitch(i, 0, eRoutingSignalType.Audio)));
|
||||
|
||||
#warning Deal with how to get the same numeric feedback values out
|
||||
(tx as ITxRouting).VideoSourceNumericFeedback.LinkInputSig(trilist.UShortInput[joinMap.VideoInput]);
|
||||
(tx as ITxRouting).AudioSourceNumericFeedabck.LinkInputSig(trilist.UShortInput[joinMap.AudioInput]);
|
||||
}
|
||||
}
|
||||
|
||||
public class DmTxControllerJoinMap : JoinMapBase
|
||||
{
|
||||
public uint IsOnline { get; set; }
|
||||
public uint VideoSyncStatus { get; set; }
|
||||
public uint CurrentInputResolution { get; set; }
|
||||
public uint HdcpSupportOn { get; set; }
|
||||
public uint HdcpSupportOff { get; set; }
|
||||
public uint HdcpSupportState { get; set; }
|
||||
public uint VideoInput { get; set; }
|
||||
public uint AudioInput { get; set; }
|
||||
|
||||
public DmTxControllerJoinMap()
|
||||
{
|
||||
// Digital
|
||||
IsOnline = 1;
|
||||
VideoSyncStatus = 2;
|
||||
HdcpSupportOn = 3;
|
||||
HdcpSupportOff = 4;
|
||||
// Serial
|
||||
CurrentInputResolution = 1;
|
||||
// Analog
|
||||
VideoInput = 1;
|
||||
AudioInput = 2;
|
||||
HdcpSupportState = 3;
|
||||
}
|
||||
|
||||
public override void OffsetJoinNumbers(uint joinStart)
|
||||
{
|
||||
var joinOffset = joinStart - 1;
|
||||
|
||||
IsOnline = IsOnline + joinOffset;
|
||||
VideoSyncStatus = VideoSyncStatus + joinOffset;
|
||||
CurrentInputResolution = CurrentInputResolution + joinOffset;
|
||||
HdcpSupportOn = HdcpSupportOn + joinOffset;
|
||||
HdcpSupportOff = HdcpSupportOff + joinOffset;
|
||||
HdcpSupportState = HdcpSupportState + joinOffset;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,7 @@ namespace PepperDash.Essentials.Bridges
|
||||
return;
|
||||
}
|
||||
|
||||
Debug.Console(1, comm, "Linking device '{0}' to Trilist '{1}'", comm.Key, trilist.ID);
|
||||
Debug.Console(1, comm, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||
|
||||
// this is a permanent event handler. This cannot be -= from event
|
||||
comm.CommPort.TextReceived += (s, a) => trilist.SetString(joinMap.TextReceived, a.Text);
|
||||
|
||||
@@ -113,6 +113,7 @@
|
||||
<Compile Include="Bridges\BridgeBase.cs" />
|
||||
<Compile Include="Bridges\BridgeFactory.cs" />
|
||||
<Compile Include="Bridges\DmChassisControllerBridge.cs" />
|
||||
<Compile Include="Bridges\DmTxControllerBridge.cs" />
|
||||
<Compile Include="Bridges\IBasicCommunicationBridge.cs" />
|
||||
<Compile Include="Bridges\JoinMapBase.cs" />
|
||||
<Compile Include="Configuration ORIGINAL\Builders\TPConfig.cs" />
|
||||
|
||||
Submodule essentials-framework updated: 25af9c91a1...de0975235d
Reference in New Issue
Block a user