diff --git a/.github/workflows/add-issues-to-project.yml b/.github/workflows/add-issues-to-project.yml
deleted file mode 100644
index 8811c0cc..00000000
--- a/.github/workflows/add-issues-to-project.yml
+++ /dev/null
@@ -1,37 +0,0 @@
-name: Add bugs to bugs project
-
-on:
- issues:
- types:
- - opened
- - labeled
-
-jobs:
- check-secret:
- runs-on: ubuntu-latest
- outputs:
- my-key: ${{ steps.my-key.outputs.defined }}
- steps:
- - id: my-key
- if: "${{ env.MY_KEY != '' }}"
- run: echo "::set-output name=defined::true"
- env:
- MY_KEY: ${{ secrets.PROJECT_URL }}
- throw-error:
- name: Check
- runs-on: ubuntu-latest
- needs: [check-secret]
- if: needs.check-secret.outputs.my-key != 'true'
- steps:
- - run: echo "The Project URL Repo Secret is empty"
- add-to-project:
- name: Add issue to project
- runs-on: ubuntu-latest
- needs: [check-secret]
- if: needs.check-secret.outputs.my-key == 'true'
- steps:
- - uses: actions/add-to-project@main
- with:
- project-url: ${{ secrets.PROJECT_URL }}
- github-token: ${{ secrets.GH_PROJECTS_PASSWORD }}
-
diff --git a/.gitignore b/.gitignore
index 94b7d400..739a60ab 100644
--- a/.gitignore
+++ b/.gitignore
@@ -389,3 +389,4 @@ MigrationBackup/
# Fody - auto-generated XML schema
FodyWeavers.xsd
essentials-framework/Essentials Interfaces/PepperDash_Essentials_Interfaces/PepperDash_Essentials_Interfaces.csproj
+.DS_Store
diff --git a/PepperDash.Essentials.sln b/PepperDash.Essentials.sln
index 4a9ffd83..40da3b9b 100644
--- a/PepperDash.Essentials.sln
+++ b/PepperDash.Essentials.sln
@@ -3,13 +3,11 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.4.33213.308
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PepperDash.Essentials.Devices.Common", "src\PepperDash.Essentials.Devices.Common\PepperDash.Essentials.Devices.Common.csproj", "{53E204B7-97DD-441D-A96C-721DF014DF82}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PepperDash.Essentials.Devices.Common", "src\PepperDash.Essentials.Devices.Common\PepperDash.Essentials.Devices.Common.csproj", "{53E204B7-97DD-441D-A96C-721DF014DF82}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PepperDash.Essentials.DM", "src\PepperDash.Essentials.DM\PepperDash.Essentials.DM.csproj", "{08EB4B98-9B4D-455A-81E0-4F913E08ADB5}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PepperDash.Essentials", "src\PepperDash.Essentials\PepperDash.Essentials.csproj", "{CB3B11BA-625C-4D35-B663-FDC5BE9A230E}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PepperDash.Essentials", "src\PepperDash.Essentials\PepperDash.Essentials.csproj", "{CB3B11BA-625C-4D35-B663-FDC5BE9A230E}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PepperDash.Essentials.Core", "src\PepperDash.Essentials.Core\PepperDash.Essentials.Core.csproj", "{3D192FED-8FFC-4CB5-B5F7-BA307ABA254B}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PepperDash.Essentials.Core", "src\PepperDash.Essentials.Core\PepperDash.Essentials.Core.csproj", "{3D192FED-8FFC-4CB5-B5F7-BA307ABA254B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -21,10 +19,6 @@ Global
{53E204B7-97DD-441D-A96C-721DF014DF82}.Debug|Any CPU.Build.0 = Debug|Any CPU
{53E204B7-97DD-441D-A96C-721DF014DF82}.Release|Any CPU.ActiveCfg = Release|Any CPU
{53E204B7-97DD-441D-A96C-721DF014DF82}.Release|Any CPU.Build.0 = Release|Any CPU
- {08EB4B98-9B4D-455A-81E0-4F913E08ADB5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {08EB4B98-9B4D-455A-81E0-4F913E08ADB5}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {08EB4B98-9B4D-455A-81E0-4F913E08ADB5}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {08EB4B98-9B4D-455A-81E0-4F913E08ADB5}.Release|Any CPU.Build.0 = Release|Any CPU
{CB3B11BA-625C-4D35-B663-FDC5BE9A230E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CB3B11BA-625C-4D35-B663-FDC5BE9A230E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CB3B11BA-625C-4D35-B663-FDC5BE9A230E}.Release|Any CPU.ActiveCfg = Release|Any CPU
diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets
index 81304ace..807679e4 100644
--- a/src/Directory.Build.targets
+++ b/src/Directory.Build.targets
@@ -19,8 +19,8 @@
-
-
+
+
diff --git a/src/PepperDash.Essentials.Core/Bridges/BridgeBase.cs b/src/PepperDash.Essentials.Core/Bridges/BridgeBase.cs
index 19c0f501..58917199 100644
--- a/src/PepperDash.Essentials.Core/Bridges/BridgeBase.cs
+++ b/src/PepperDash.Essentials.Core/Bridges/BridgeBase.cs
@@ -167,7 +167,7 @@ namespace PepperDash.Essentials.Core.Bridges
Debug.Console(1, this, "Linking Device: '{0}'", device.Key);
- if (!typeof (IBridgeAdvanced).IsAssignableFrom(device.GetType().GetCType()))
+ if (!typeof(IBridgeAdvanced).IsAssignableFrom(device.GetType().GetCType()))
{
Debug.Console(0, this, Debug.ErrorLogLevel.Notice,
"{0} is not compatible with this bridge type. Please use 'eiscapi' instead, or updae the device.",
@@ -411,7 +411,7 @@ namespace PepperDash.Essentials.Core.Bridges
public List Devices { get; set; }
[JsonProperty("rooms")]
- public List Rooms { get; set; }
+ public List Rooms { get; set; }
public class ApiDevicePropertiesConfig
@@ -444,7 +444,7 @@ namespace PepperDash.Essentials.Core.Bridges
{
public EiscApiAdvancedFactory()
{
- TypeNames = new List { "eiscapiadv", "eiscapiadvanced", "eiscapiadvancedserver", "eiscapiadvancedclient", "vceiscapiadv", "vceiscapiadvanced" };
+ TypeNames = new List { "eiscapiadv", "eiscapiadvanced", "eiscapiadvancedserver", "eiscapiadvancedclient", "vceiscapiadv", "vceiscapiadvanced" };
}
public override EssentialsDevice BuildDevice(DeviceConfig dc)
@@ -459,34 +459,34 @@ namespace PepperDash.Essentials.Core.Bridges
{
case "eiscapiadv":
case "eiscapiadvanced":
- {
- eisc = new ThreeSeriesTcpIpEthernetIntersystemCommunications(controlProperties.IpIdInt,
- controlProperties.TcpSshProperties.Address, Global.ControlSystem);
- break;
- }
- case "eiscapiadvancedserver":
- {
- eisc = new EISCServer(controlProperties.IpIdInt, Global.ControlSystem);
- break;
- }
- case "eiscapiadvancedclient":
- {
- eisc = new EISCClient(controlProperties.IpIdInt, controlProperties.TcpSshProperties.Address, Global.ControlSystem);
- break;
- }
- case "vceiscapiadv":
- case "vceiscapiadvanced":
- {
- if (string.IsNullOrEmpty(controlProperties.RoomId))
{
- Debug.Console(0, Debug.ErrorLogLevel.Error, "Unable to build VC-4 EISC Client for device {0}. Room ID is missing or empty", dc.Key);
- eisc = null;
+ eisc = new ThreeSeriesTcpIpEthernetIntersystemCommunications(controlProperties.IpIdInt,
+ controlProperties.TcpSshProperties.Address, Global.ControlSystem);
+ break;
+ }
+ case "eiscapiadvancedserver":
+ {
+ eisc = new EISCServer(controlProperties.IpIdInt, Global.ControlSystem);
+ break;
+ }
+ case "eiscapiadvancedclient":
+ {
+ eisc = new EISCClient(controlProperties.IpIdInt, controlProperties.TcpSshProperties.Address, Global.ControlSystem);
+ break;
+ }
+ case "vceiscapiadv":
+ case "vceiscapiadvanced":
+ {
+ if (string.IsNullOrEmpty(controlProperties.RoomId))
+ {
+ Debug.Console(0, Debug.ErrorLogLevel.Error, "Unable to build VC-4 EISC Client for device {0}. Room ID is missing or empty", dc.Key);
+ eisc = null;
+ break;
+ }
+ eisc = new VirtualControlEISCClient(controlProperties.IpIdInt, controlProperties.RoomId,
+ Global.ControlSystem);
break;
}
- eisc = new VirtualControlEISCClient(controlProperties.IpIdInt, controlProperties.RoomId,
- Global.ControlSystem);
- break;
- }
default:
eisc = null;
break;
diff --git a/src/PepperDash.Essentials.Core/Bridges/JoinMaps/DmRmcControllerJoinMap.cs b/src/PepperDash.Essentials.Core/Bridges/JoinMaps/DmRmcControllerJoinMap.cs
index 8c2386fd..56f0825c 100644
--- a/src/PepperDash.Essentials.Core/Bridges/JoinMaps/DmRmcControllerJoinMap.cs
+++ b/src/PepperDash.Essentials.Core/Bridges/JoinMaps/DmRmcControllerJoinMap.cs
@@ -8,6 +8,18 @@ namespace PepperDash.Essentials.Core.Bridges
public JoinDataComplete IsOnline = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
new JoinMetadata { Description = "DM RMC Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
+ [JoinName("VideoMuteOn")]
+ public JoinDataComplete VideoMuteOn = new JoinDataComplete(new JoinData { JoinNumber = 3, JoinSpan = 1 },
+ new JoinMetadata { Description = "DM RMC Mute Video", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
+
+ [JoinName("VideoMuteOff")]
+ public JoinDataComplete VideoMuteOff = new JoinDataComplete(new JoinData { JoinNumber = 4, JoinSpan = 1 },
+ new JoinMetadata { Description = "DM RMC UnMute Video", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
+
+ [JoinName("VideoMuteToggle")]
+ public JoinDataComplete VideoMuteToggle = new JoinDataComplete(new JoinData { JoinNumber = 5, JoinSpan = 1 },
+ new JoinMetadata { Description = "DM RMC Mute Video Toggle", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
+
[JoinName("CurrentOutputResolution")]
public JoinDataComplete CurrentOutputResolution = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
new JoinMetadata { Description = "DM RMC Current Output Resolution", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
@@ -36,6 +48,28 @@ namespace PepperDash.Essentials.Core.Bridges
public JoinDataComplete AudioVideoSource = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
new JoinMetadata { Description = "DM RMC Audio Video Source Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
+ [JoinName("HdcpSupportCapability")]
+ public JoinDataComplete HdcpSupportCapability = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
+ new JoinMetadata { Description = "DM RMC HDCP Support Capability", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
+
+ [JoinName("Port1HdcpState")]
+ public JoinDataComplete Port1HdcpState = new JoinDataComplete(new JoinData { JoinNumber = 3, JoinSpan = 1 },
+ new JoinMetadata { Description = "DM RMC Port 1 (DM) HDCP State Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
+
+ [JoinName("Port2HdcpState")]
+ public JoinDataComplete Port2HdcpState = new JoinDataComplete(new JoinData { JoinNumber = 4, JoinSpan = 1 },
+ new JoinMetadata { Description = "DM TX Port 2 (HDMI) HDCP State Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
+
+ [JoinName("HdmiInputSync")]
+ public JoinDataComplete HdmiInputSync = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
+ new JoinMetadata { Description = "DM RMC HDMI Input Sync", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
+
+ [JoinName("HdcpInputPortCount")]
+ public JoinDataComplete HdcpInputPortCount = new JoinDataComplete(new JoinData { JoinNumber = 5, JoinSpan = 1 },
+ new JoinMetadata { Description = "Number of Input Ports that support HDCP", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
+
+
+
///
/// Constructor to use when instantiating this Join Map without inheriting from it
///
@@ -50,7 +84,8 @@ namespace PepperDash.Essentials.Core.Bridges
///
/// Join this join map will start at
/// Type of the child join map
- protected DmRmcControllerJoinMap(uint joinStart, Type type) : base(joinStart, type)
+ protected DmRmcControllerJoinMap(uint joinStart, Type type)
+ : base(joinStart, type)
{
}
}
diff --git a/src/PepperDash.Essentials.Core/Bridges/JoinMaps/DmTxControllerJoinMap.cs b/src/PepperDash.Essentials.Core/Bridges/JoinMaps/DmTxControllerJoinMap.cs
index 23d240d5..c6f8f89f 100644
--- a/src/PepperDash.Essentials.Core/Bridges/JoinMaps/DmTxControllerJoinMap.cs
+++ b/src/PepperDash.Essentials.Core/Bridges/JoinMaps/DmTxControllerJoinMap.cs
@@ -64,6 +64,16 @@ namespace PepperDash.Essentials.Core.Bridges
public JoinDataComplete VgaContrast = new JoinDataComplete(new JoinData { JoinNumber = 7, JoinSpan = 1 },
new JoinMetadata { Description = "DM TX Online", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
+ [JoinName("Port3HdcpState")]
+ public JoinDataComplete Port3HdcpState = new JoinDataComplete(new JoinData { JoinNumber = 8, JoinSpan = 1 },
+ new JoinMetadata { Description = "DM TX Port 3 HDCP State Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
+
+ [JoinName("HdcpInputPortCount")]
+ public JoinDataComplete HdcpInputPortCount = new JoinDataComplete(new JoinData { JoinNumber = 9, JoinSpan = 1 },
+ new JoinMetadata { Description = "Number of Input Ports that support HDCP", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
+
+
+
///
/// Constructor to use when instantiating this Join Map without inheriting from it
///
@@ -78,7 +88,8 @@ namespace PepperDash.Essentials.Core.Bridges
///
/// Join this join map will start at
/// Type of the child join map
- protected DmTxControllerJoinMap(uint joinStart, Type type) : base(joinStart, type)
+ protected DmTxControllerJoinMap(uint joinStart, Type type)
+ : base(joinStart, type)
{
}
}
diff --git a/src/PepperDash.Essentials.Core/Bridges/JoinMaps/GenericIrControllerJoinMap.cs b/src/PepperDash.Essentials.Core/Bridges/JoinMaps/GenericIrControllerJoinMap.cs
new file mode 100644
index 00000000..288141bb
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Bridges/JoinMaps/GenericIrControllerJoinMap.cs
@@ -0,0 +1,827 @@
+using PepperDash.Essentials.Core;
+
+namespace PepperDash_Essentials_Core.Bridges.JoinMaps
+{
+ public sealed class GenericIrControllerJoinMap : JoinMapBaseAdvanced
+ {
+ [JoinName("PLAY")]
+ public JoinDataComplete Play = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 1,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "PLAY",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ [JoinName("STOP")]
+ public JoinDataComplete Stop = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 2,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "STOP",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ [JoinName("PAUSE")]
+ public JoinDataComplete Pause = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 3,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "PAUSE",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ [JoinName("FSCAN")]
+ public JoinDataComplete ForwardScan = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 4,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "FSCAN",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ [JoinName("RSCAN")]
+ public JoinDataComplete ReverseScan = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 5,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "RSCAN",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ [JoinName("F_SKIP")]
+ public JoinDataComplete ForwardSkip = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 6,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "F_SKIP",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ [JoinName("R_SKIP")]
+ public JoinDataComplete ReverseSkip = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 7,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "R_SKIP",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ [JoinName("RECORD")]
+ public JoinDataComplete Record = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 8,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "RECORD",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ [JoinName("POWER")]
+ public JoinDataComplete Power = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 9,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "POWER",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ [JoinName("0")]
+ public JoinDataComplete Kp0 = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 10,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "0",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ [JoinName("1")]
+ public JoinDataComplete Kp1 = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 11,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "1",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ [JoinName("2")]
+ public JoinDataComplete Kp2 = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 12,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "2",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ [JoinName("3")]
+ public JoinDataComplete Kp3 = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 13,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "3",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ [JoinName("4")]
+ public JoinDataComplete Kp4 = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 14,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "4",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ [JoinName("5")]
+ public JoinDataComplete Kp5 = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 15,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "5",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ [JoinName("6")]
+ public JoinDataComplete Kp6 = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 16,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "6",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ [JoinName("7")]
+ public JoinDataComplete Kp7 = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 17,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "7",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ [JoinName("8")]
+ public JoinDataComplete Kp8 = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 18,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "8",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ [JoinName("9")]
+ public JoinDataComplete Kp9 = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 19,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "9",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ // [JoinName("+10")]
+ // public JoinDataComplete Kp9 = new JoinDataComplete(
+ // new JoinData
+ // {
+ // JoinNumber = 20,
+ // JoinSpan = 1
+ // },
+ // new JoinMetadata
+ // {
+ // Description = "+10",
+ // JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ // JoinType = eJoinType.Digital
+ // });
+
+ [JoinName("ENTER")]
+ public JoinDataComplete Enter = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 21,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "ENTER",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ [JoinName("CH+")]
+ public JoinDataComplete ChannelUp = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 22,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "CH+",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ [JoinName("CH-")]
+ public JoinDataComplete ChannelDown = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 23,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "CH-",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ [JoinName("*")]
+ public JoinDataComplete KpStar = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 24,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "*",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ [JoinName("#")]
+ public JoinDataComplete KpPound = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 25,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "#",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ // [JoinName(".")]
+ // public JoinDataComplete KpPound = new JoinDataComplete(
+ // new JoinData
+ // {
+ // JoinNumber = 26,
+ // JoinSpan = 1
+ // },
+ // new JoinMetadata
+ // {
+ // Description = ".",
+ // JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ // JoinType = eJoinType.Digital
+ // });
+
+ [JoinName("POWER_ON")]
+ public JoinDataComplete PowerOn = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 27,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "POWER_ON",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ [JoinName("POWER_OFF")]
+ public JoinDataComplete PowerOff = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 28,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "POWER_OFF",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ [JoinName("PLAY_PAUSE")]
+ public JoinDataComplete PlayPause = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 29,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "PLAY_PAUSE",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ [JoinName("LAST")]
+ public JoinDataComplete Last = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 30,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "LAST",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ [JoinName("HOME")]
+ public JoinDataComplete Home = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 40,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "HOME",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ [JoinName("BACK")]
+ public JoinDataComplete Back = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 41,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "BACK",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+
+ [JoinName("GUIDE")]
+ public JoinDataComplete Guide = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 42,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "GUIDE",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ [JoinName("INFO")]
+ public JoinDataComplete Info = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 43,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "INFO",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ [JoinName("MENU")]
+ public JoinDataComplete Menu = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 44,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "MENU",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ [JoinName("UP_ARROW")]
+ public JoinDataComplete DpadUp = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 45,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "UP_ARROW",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ [JoinName("DN_ARROW")]
+ public JoinDataComplete DpadDown = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 46,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "DN_ARROW",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ [JoinName("LEFT_ARROW")]
+ public JoinDataComplete DpadLeft = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 47,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "LEFT_ARROW",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ [JoinName("RIGHT_ARROW")]
+ public JoinDataComplete DpadRight = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 48,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "RIGHT_ARROW",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ [JoinName("SELECT")]
+ public JoinDataComplete DpadSelect = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 49,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "SELECT",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ [JoinName("OPTIONS")]
+ public JoinDataComplete Options = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 50,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "OPTIONS",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ [JoinName("RETURN")]
+ public JoinDataComplete Return = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 51,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "RETURN",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ [JoinName("DVR")]
+ public JoinDataComplete Dvr = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 52,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "DVR",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+
+ [JoinName("ON_DEMAND")]
+ public JoinDataComplete OnDemand = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 53,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "ON_DEMAND",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+
+ [JoinName("PAGE_UP")]
+ public JoinDataComplete PageUp = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 54,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "PAGE_UP",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ [JoinName("PAGE_DOWN")]
+ public JoinDataComplete PageDown = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 55,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "PAGE_DOWN",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ [JoinName("F_SRCH")]
+ public JoinDataComplete ForwardSearch = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 56,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "F_SRCH",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ [JoinName("R_SRCH")]
+ public JoinDataComplete ReverseSearch = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 57,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "R_SRCH",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ [JoinName("TRACK+")]
+ public JoinDataComplete TrackPlus = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 58,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "TRACK+",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ [JoinName("TRACK-")]
+ public JoinDataComplete TrackMinus = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 59,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "TRACK-",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ [JoinName("A")]
+ public JoinDataComplete KpA = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 61,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "A",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ [JoinName("B")]
+ public JoinDataComplete KpB = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 62,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "B",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ [JoinName("C")]
+ public JoinDataComplete KpC = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 63,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "C",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ [JoinName("D")]
+ public JoinDataComplete KpD = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 64,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "D",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ [JoinName("RED")]
+ public JoinDataComplete KpRed = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 65,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "RED",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ [JoinName("GREEN")]
+ public JoinDataComplete KpGreen = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 66,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "GREEN",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ [JoinName("YELLOW")]
+ public JoinDataComplete KpYellow = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 67,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "YELLOW",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ [JoinName("BLUE")]
+ public JoinDataComplete KpBlue = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 68,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "BLUE",
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ public GenericIrControllerJoinMap(uint joinStart)
+ : base(joinStart, typeof(GenericIrControllerJoinMap))
+ {
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Bridges/JoinMaps/HdPsXxxControllerJoinMap.cs b/src/PepperDash.Essentials.Core/Bridges/JoinMaps/HdPsXxxControllerJoinMap.cs
new file mode 100644
index 00000000..3f2901c9
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Bridges/JoinMaps/HdPsXxxControllerJoinMap.cs
@@ -0,0 +1,190 @@
+using System;
+using PepperDash.Essentials.Core;
+
+namespace PepperDash_Essentials_Core.Bridges
+{
+ public class HdPsXxxControllerJoinMap : JoinMapBaseAdvanced
+ {
+
+ #region Digital
+
+ [JoinName("EnableAutoRoute")]
+ public JoinDataComplete EnableAutoRoute = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 1,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "Enable Automatic Routing on Xx1 Switchers",
+ JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+
+ [JoinName("InputSync")]
+ public JoinDataComplete InputSync = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 2,
+ JoinSpan = 8
+ },
+ new JoinMetadata
+ {
+ Description = "Device Input Sync",
+ JoinCapabilities = eJoinCapabilities.ToSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+
+ [JoinName("EnableInputHdcp")]
+ public JoinDataComplete EnableInputHdcp = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 11,
+ JoinSpan = 8
+ },
+ new JoinMetadata
+ {
+ Description = "Device Enable Input Hdcp",
+ JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+
+ [JoinName("DisableInputHdcp")]
+ public JoinDataComplete DisableInputHdcp = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 21,
+ JoinSpan = 8
+ },
+ new JoinMetadata
+ {
+ Description = "Device Disnable Input Hdcp",
+ JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+
+ [JoinName("IsOnline")]
+ public JoinDataComplete IsOnline = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 30,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "Device Onlne",
+ JoinCapabilities = eJoinCapabilities.ToSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ #endregion
+
+
+ #region Analog
+
+ [JoinName("OutputRoute")]
+ public JoinDataComplete OutputRoute = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 11,
+ JoinSpan = 2
+ },
+ new JoinMetadata
+ {
+ Description = "Device Output Route Set/Get",
+ JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
+ JoinType = eJoinType.Analog
+ });
+
+ #endregion
+
+
+ #region Serial
+
+ [JoinName("Name")]
+ public JoinDataComplete Name = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 1,
+ JoinSpan = 1
+ },
+ new JoinMetadata
+ {
+ Description = "Device Name",
+ JoinCapabilities = eJoinCapabilities.ToSIMPL,
+ JoinType = eJoinType.Serial
+ });
+
+
+ [JoinName("InputName")]
+ public JoinDataComplete InputName = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 2,
+ JoinSpan = 8
+ },
+ new JoinMetadata
+ {
+ Description = "Device Input Name",
+ JoinCapabilities = eJoinCapabilities.ToSIMPL,
+ JoinType = eJoinType.Serial
+ });
+
+
+ [JoinName("OutputName")]
+ public JoinDataComplete OutputName = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 11,
+ JoinSpan = 2
+ },
+ new JoinMetadata
+ {
+ Description = "Device Output Name",
+ JoinCapabilities = eJoinCapabilities.ToSIMPL,
+ JoinType = eJoinType.Serial
+ });
+
+
+ [JoinName("OutputRoutedName")]
+ public JoinDataComplete OutputRoutedName = new JoinDataComplete(
+ new JoinData
+ {
+ JoinNumber = 16,
+ JoinSpan = 2
+ },
+ new JoinMetadata
+ {
+ Description = "Device Output Route Name",
+ JoinCapabilities = eJoinCapabilities.ToSIMPL,
+ JoinType = eJoinType.Serial
+ });
+
+
+ #endregion
+
+ ///
+ /// Constructor to use when instantiating this join map without inheriting from it
+ ///
+ /// Join this join map will start at
+ public HdPsXxxControllerJoinMap(uint joinStart)
+ : this(joinStart, typeof(HdPsXxxControllerJoinMap))
+ {
+ }
+
+ ///
+ /// Constructor to use when extending this Join map
+ ///
+ /// Join this join map will start at
+ /// Type of the child join map
+ protected HdPsXxxControllerJoinMap(uint joinStart, Type type)
+ : base(joinStart, type)
+ {
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Bridges/JoinMaps/PduJoinMapBase.cs b/src/PepperDash.Essentials.Core/Bridges/JoinMaps/PduJoinMapBase.cs
index 2ac56ff1..0c2e9ed9 100644
--- a/src/PepperDash.Essentials.Core/Bridges/JoinMaps/PduJoinMapBase.cs
+++ b/src/PepperDash.Essentials.Core/Bridges/JoinMaps/PduJoinMapBase.cs
@@ -10,7 +10,7 @@ namespace PepperDash.Essentials.Core.Bridges
[JoinName("Online")]
public JoinDataComplete Online = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
- new JoinMetadata { Description = "PDU Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
+ new JoinMetadata { Description = "Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("OutletCount")]
public JoinDataComplete OutletCount = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
diff --git a/src/PepperDash.Essentials.Core/Bridges/JoinMaps/SystemMonitorJoinMap.cs b/src/PepperDash.Essentials.Core/Bridges/JoinMaps/SystemMonitorJoinMap.cs
index ffcd5777..9adabfce 100644
--- a/src/PepperDash.Essentials.Core/Bridges/JoinMaps/SystemMonitorJoinMap.cs
+++ b/src/PepperDash.Essentials.Core/Bridges/JoinMaps/SystemMonitorJoinMap.cs
@@ -47,7 +47,7 @@ namespace PepperDash.Essentials.Core.Bridges
[JoinName("ProgramOffsetJoin")]
public JoinDataComplete ProgramOffsetJoin = new JoinDataComplete(new JoinData { JoinNumber = 5, JoinSpan = 5 },
new JoinMetadata { Description = "All Program Data is offset between slots by 5 - First Joins Start at 11", JoinCapabilities = eJoinCapabilities.None, JoinType = eJoinType.None });
-
+
[JoinName("ProgramStart")]
public JoinDataComplete ProgramStart = new JoinDataComplete(new JoinData { JoinNumber = 11, JoinSpan = 1 },
new JoinMetadata { Description = "Processor Program Start / Fb", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
@@ -132,6 +132,23 @@ namespace PepperDash.Essentials.Core.Bridges
public JoinDataComplete DhcpStatus = new JoinDataComplete(new JoinData { JoinNumber = 86, JoinSpan = 1 },
new JoinMetadata { Description = "Processor Ethernet Dhcp Status", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
+ [JoinName("ProcessorRebot")]
+ public JoinDataComplete ProcessorReboot = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
+ new JoinMetadata { Description = "Reboot processor", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
+
+ [JoinName("IsAppliance")]
+ public JoinDataComplete IsAppliance = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
+ new JoinMetadata { Description = "Is appliance Fb", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
+
+ [JoinName("IsServer")]
+ public JoinDataComplete IsServer = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
+ new JoinMetadata { Description = "Is server Fb", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
+
+ [JoinName("ProgramReset")]
+ public JoinDataComplete ProgramReset = new JoinDataComplete(new JoinData { JoinNumber = 15, JoinSpan = 1 },
+ new JoinMetadata { Description = "Resets the program", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
+
+
///
/// Constructor to use when instantiating this Join Map without inheriting from it
///
diff --git a/src/PepperDash.Essentials.Core/Comm and IR/CommFactory.cs b/src/PepperDash.Essentials.Core/Comm and IR/CommFactory.cs
index 892caa92..8c132a1b 100644
--- a/src/PepperDash.Essentials.Core/Comm and IR/CommFactory.cs
+++ b/src/PepperDash.Essentials.Core/Comm and IR/CommFactory.cs
@@ -83,6 +83,15 @@ namespace PepperDash.Essentials.Core
}
case eControlMethod.Telnet:
break;
+ case eControlMethod.SecureTcpIp:
+ {
+ var secureTcp = new GenericSecureTcpIpClient(deviceConfig.Key + "-secureTcp", c.Address, c.Port, c.BufferSize);
+ secureTcp.AutoReconnect = c.AutoReconnect;
+ if (secureTcp.AutoReconnect)
+ secureTcp.AutoReconnectIntervalMs = c.AutoReconnectIntervalMs;
+ comm = secureTcp;
+ break;
+ }
default:
break;
}
@@ -117,41 +126,54 @@ namespace PepperDash.Essentials.Core
///
public static ICec GetCecPort(ControlPropertiesConfig config)
{
- var dev = DeviceManager.GetDeviceForKey(config.ControlPortDevKey);
+ try
+ {
+ var dev = DeviceManager.GetDeviceForKey(config.ControlPortDevKey);
- if (dev != null)
- {
- if (!String.IsNullOrEmpty(config.ControlPortName))
- {
+ Debug.Console(0, "GetCecPort: device '{0}' {1}", config.ControlPortDevKey, dev == null
+ ? "is not valid, failed to get cec port"
+ : "found in device manager, attempting to get cec port");
- var inputPort = (dev as IRoutingInputsOutputs).InputPorts[config.ControlPortName];
+ if (dev == null)
+ return null;
- if (inputPort != null)
- {
- if (inputPort.Port is ICec)
- return inputPort.Port as ICec;
- }
+ if (String.IsNullOrEmpty(config.ControlPortName))
+ {
+ Debug.Console(0, "GetCecPort: '{0}' - Configuration missing 'ControlPortName'", config.ControlPortDevKey);
+ return null;
+ }
- var outputPort = (dev as IRoutingInputsOutputs).OutputPorts[config.ControlPortName];
- if (outputPort != null)
- {
- if (outputPort.Port is ICec)
- return outputPort.Port as ICec;
- }
+ var inputsOutputs = dev as IRoutingInputsOutputs;
+ if (inputsOutputs == null)
+ {
+ Debug.Console(0, "GetCecPort: Device '{0}' does not support IRoutingInputsOutputs, failed to get CEC port called '{1}'",
+ config.ControlPortDevKey, config.ControlPortName);
- else
- Debug.Console(0, "GetCecPort: Device '{0}' does not have a CEC port called: '{1}'",
- config.ControlPortDevKey, config.ControlPortName);
- }
- else
- {
- Debug.Console(0, "GetCecPort: '{0}' - Configuration missing 'ControlPortName'", config.ControlPortDevKey);
- }
- }
- Debug.Console(0, "GetCecPort: Device '{0}' is not a valid device.", config.ControlPortDevKey);
+ return null;
+ }
- return null;
+ var inputPort = inputsOutputs.InputPorts[config.ControlPortName];
+ if (inputPort != null && inputPort.Port is ICec)
+ return inputPort.Port as ICec;
+
+
+ var outputPort = inputsOutputs.OutputPorts[config.ControlPortName];
+ if (outputPort != null && outputPort.Port is ICec)
+ return outputPort.Port as ICec;
+ }
+ catch (Exception ex)
+ {
+ Debug.Console(1, "GetCecPort Exception Message: {0}", ex.Message);
+ Debug.Console(2, "GetCecPort Exception StackTrace: {0}", ex.StackTrace);
+ if (ex.InnerException != null)
+ Debug.Console(0, "GetCecPort Exception InnerException: {0}", ex.InnerException);
+ }
+
+ Debug.Console(0, "GetCecPort: Device '{0}' does not have a CEC port called '{1}'",
+ config.ControlPortDevKey, config.ControlPortName);
+
+ return null;
}
///
diff --git a/src/PepperDash.Essentials.Core/Comm and IR/IRPortHelper.cs b/src/PepperDash.Essentials.Core/Comm and IR/IRPortHelper.cs
index b682af71..4d99edc0 100644
--- a/src/PepperDash.Essentials.Core/Comm and IR/IRPortHelper.cs
+++ b/src/PepperDash.Essentials.Core/Comm and IR/IRPortHelper.cs
@@ -226,12 +226,18 @@ namespace PepperDash.Essentials.Core
///
public class IrOutPortConfig
{
+ [JsonProperty("port")]
public IROutputPort Port { get; set; }
+
+ [JsonProperty("fileName")]
public string FileName { get; set; }
+ [JsonProperty("useBridgeJoinMap")]
+ public bool UseBridgeJoinMap { get; set; }
+
public IrOutPortConfig()
{
- FileName = "";
+ FileName = "";
}
}
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Device Info/NetworkDeviceHelpers.cs b/src/PepperDash.Essentials.Core/Device Info/NetworkDeviceHelpers.cs
new file mode 100644
index 00000000..04e697c9
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Device Info/NetworkDeviceHelpers.cs
@@ -0,0 +1,218 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using PepperDash.Core;
+using Crestron.SimplSharp;
+using PepperDash.Essentials.Core;
+
+namespace PepperDash.Essentials.Core.DeviceInfo
+{
+ public static class NetworkDeviceHelpers
+ {
+ ///
+ /// Event raised when ArpTable changes
+ ///
+ public static event ArpTableEventHandler ArpTableUpdated;
+
+ ///
+ /// Delegate called by ArpTableUpdated
+ ///
+ /// contains the entire ARP table and a bool to note if there was an error in retrieving the data
+ public delegate void ArpTableEventHandler(ArpTableEventArgs args);
+
+ private static readonly char NewLineSplitter = CrestronEnvironment.NewLine.ToCharArray().First();
+ private static readonly string NewLine = CrestronEnvironment.NewLine;
+
+ private static readonly CCriticalSection Lock = new CCriticalSection();
+
+ ///
+ /// Last resolved ARP table - it is recommended to refresh the arp before using this.
+ ///
+ public static List ArpTable { get; private set; }
+
+ ///
+ /// Force recheck of ARP table
+ ///
+ public static void RefreshArp()
+ {
+ var error = false;
+ try
+ {
+ Lock.Enter();
+ var consoleResponse = string.Empty;
+ if (!CrestronConsole.SendControlSystemCommand("showarptable", ref consoleResponse)) return;
+ if (string.IsNullOrEmpty(consoleResponse))
+ {
+ error = true;
+ return;
+ }
+ ArpTable.Clear();
+
+ Debug.Console(2, "ConsoleResponse of 'showarptable' : {0}{1}", NewLine, consoleResponse);
+
+ var myLines =
+ consoleResponse.Split(NewLineSplitter)
+ .ToList()
+ .Where(o => (o.Contains(':') && !o.Contains("Type", StringComparison.OrdinalIgnoreCase)))
+ .ToList();
+ foreach (var line in myLines)
+ {
+ var item = line;
+ var seperator = item.Contains('\t') ? '\t' : ' ';
+ var dataPoints = item.Split(seperator);
+ if (dataPoints == null || dataPoints.Length < 2) continue;
+ var ipAddress = SanitizeIpAddress(dataPoints.First().TrimAll());
+ var macAddress = dataPoints.Last();
+ ArpTable.Add(new ArpEntry(ipAddress, macAddress));
+ }
+ }
+ catch (Exception ex)
+ {
+ Debug.Console(0, "Exception in \"RefreshArp\" : {0}", ex.Message);
+ error = true;
+ }
+ finally
+ {
+ Lock.Leave();
+ OnArpTableUpdated(new ArpTableEventArgs(ArpTable, error));
+ }
+ }
+
+
+ private static void OnArpTableUpdated(ArpTableEventArgs args)
+ {
+ if (args == null) return;
+ var handler = ArpTableUpdated;
+ if (handler == null) return;
+ handler.Invoke(args);
+ }
+
+ static NetworkDeviceHelpers()
+ {
+ ArpTable = new List();
+ }
+
+ ///
+ /// Removes leading zeros, leading whitespace, and trailing whitespace from an IPAddress string
+ ///
+ /// Ip Address to Santitize
+ /// Sanitized Ip Address
+ public static string SanitizeIpAddress(string ipAddressIn)
+ {
+ try
+ {
+ var ipAddress = IPAddress.Parse(ipAddressIn.TrimStart('0'));
+ return ipAddress.ToString();
+ }
+ catch (Exception ex)
+ {
+ Debug.Console(0, "Unable to Santize Ip : {0}", ex.Message);
+ return ipAddressIn;
+ }
+ }
+
+ ///
+ /// Resolves a hostname by IP Address using DNS
+ ///
+ /// IP Address to resolve from
+ /// Resolved Hostname - on failure to determine hostname, will return IP Address
+ public static string ResolveHostnameFromIp(string ipAddress)
+ {
+ try
+ {
+ var santitizedIp = SanitizeIpAddress(ipAddress);
+ var hostEntry = Dns.GetHostEntry(santitizedIp);
+ return hostEntry == null ? ipAddress : hostEntry.HostName;
+ }
+ catch (Exception ex)
+ {
+ Debug.Console(0, "Exception Resolving Hostname from IP Address : {0}", ex.Message);
+ return ipAddress;
+ }
+ }
+
+ ///
+ /// Resolves an IP Address by hostname using DNS
+ ///
+ /// Hostname to resolve from
+ /// Resolved IP Address - on a failure to determine IP Address, will return hostname
+ public static string ResolveIpFromHostname(string hostName)
+ {
+ try
+ {
+ var hostEntry = Dns.GetHostEntry(hostName);
+ return hostEntry == null ? hostName : hostEntry.AddressList.First().ToString();
+ }
+ catch (Exception ex)
+ {
+ Debug.Console(0, "Exception Resolving IP Address from Hostname : {0}", ex.Message);
+ return hostName;
+ }
+ }
+
+ }
+
+ ///
+ /// Object to hold data about an arp entry
+ ///
+ public class ArpEntry
+ {
+ public readonly IPAddress IpAddress;
+ public readonly string MacAddress;
+
+ ///
+ /// Constructs new ArpEntry object
+ ///
+ /// string formatted as ipv4 address
+ /// mac address string - format is unimportant
+ public ArpEntry(string ipAddress, string macAddress)
+ {
+ if (string.IsNullOrEmpty(ipAddress))
+ {
+ throw new ArgumentException("\"ipAddress\" cannot be null or empty");
+ }
+ if (string.IsNullOrEmpty(macAddress))
+ {
+ throw new ArgumentException("\"macAddress\" cannot be null or empty");
+ }
+ IpAddress = IPAddress.Parse(ipAddress.TrimStart().TrimStart('0').TrimEnd());
+ MacAddress = macAddress;
+ }
+ }
+
+ ///
+ /// Arguments passed by the ArpTableUpdated event
+ ///
+ public class ArpTableEventArgs : EventArgs
+ {
+ ///
+ /// The retrieved ARP Table
+ ///
+ public readonly List ArpTable;
+ ///
+ /// True if there was a problem retrieving the ARP Table
+ ///
+ public readonly bool Error;
+
+ ///
+ /// Constructor for ArpTableEventArgs
+ ///
+ /// The entirety of the retrieved ARP table
+ /// True of an error was encountered updating the ARP table
+ public ArpTableEventArgs(List arpTable, bool error)
+ {
+ ArpTable = arpTable;
+ Error = error;
+ }
+
+ ///
+ /// Constructor for ArpTableEventArgs - assumes no error encountered in retrieving ARP Table
+ ///
+ /// The entirety of the retrieved ARP table
+ public ArpTableEventArgs(List arpTable)
+ {
+ ArpTable = arpTable;
+ Error = false;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/DeviceManager.cs b/src/PepperDash.Essentials.Core/Devices/DeviceManager.cs
index 12b3b948..f0101c6c 100644
--- a/src/PepperDash.Essentials.Core/Devices/DeviceManager.cs
+++ b/src/PepperDash.Essentials.Core/Devices/DeviceManager.cs
@@ -379,30 +379,28 @@ namespace PepperDash.Essentials.Core
/// Prints a list of routing inputs and outputs by device key.
///
/// Device key from which to report data
- public static void GetRoutingPorts(string s)
- {
- var device = GetDeviceForKey(s);
+ public static void GetRoutingPorts(string s)
+ {
+ var device = GetDeviceForKey(s);
if (device == null) return;
var inputPorts = ((device as IRoutingInputs) != null) ? (device as IRoutingInputs).InputPorts : null;
var outputPorts = ((device as IRoutingOutputs) != null) ? (device as IRoutingOutputs).OutputPorts : null;
- if (inputPorts != null)
- {
- Debug.Console(0, "Device {0} has {1} Input Ports:", s, inputPorts.Count);
- foreach (var routingInputPort in inputPorts)
- {
- Debug.Console(0, "{0}", routingInputPort.Key);
- }
- }
- if (outputPorts != null)
- {
- Debug.Console(0, "Device {0} has {1} Output Ports:", s, outputPorts.Count);
- foreach (var routingOutputPort in outputPorts)
- {
- Debug.Console(0, "{0}", routingOutputPort.Key);
- }
- }
- }
+ if (inputPorts != null)
+ {
+ CrestronConsole.ConsoleCommandResponse("Device {0} has {1} Input Ports:{2}", s, inputPorts.Count, CrestronEnvironment.NewLine);
+ foreach (var routingInputPort in inputPorts)
+ {
+ CrestronConsole.ConsoleCommandResponse("{0}{1}", routingInputPort.Key, CrestronEnvironment.NewLine);
+ }
+ }
+ if (outputPorts == null) return;
+ CrestronConsole.ConsoleCommandResponse("Device {0} has {1} Output Ports:{2}", s, outputPorts.Count, CrestronEnvironment.NewLine);
+ foreach (var routingOutputPort in outputPorts)
+ {
+ CrestronConsole.ConsoleCommandResponse("{0}{1}", routingOutputPort.Key, CrestronEnvironment.NewLine);
+ }
+ }
///
/// Attempts to set the debug level of a device
@@ -435,7 +433,7 @@ namespace PepperDash.Essentials.Core
if (device == null)
{
- Debug.Console(0, "Unable to get device with key: {0}", deviceKey);
+ CrestronConsole.ConsoleCommandResponse("Unable to get device with key: {0}", deviceKey);
return;
}
@@ -447,7 +445,7 @@ namespace PepperDash.Essentials.Core
}
catch
{
- Debug.Console(0, "Unable to convert setting value. Please use off/rx/tx/both");
+ CrestronConsole.ConsoleCommandResponse("Unable to convert setting value. Please use off/rx/tx/both");
return;
}
@@ -458,18 +456,18 @@ namespace PepperDash.Essentials.Core
var min = Convert.ToUInt32(timeout);
device.StreamDebugging.SetDebuggingWithSpecificTimeout(debugSetting, min);
- Debug.Console(0, "Device: '{0}' debug level set to {1} for {2} minutes", deviceKey, debugSetting, min);
+ CrestronConsole.ConsoleCommandResponse("Device: '{0}' debug level set to {1} for {2} minutes", deviceKey, debugSetting, min);
}
catch (Exception e)
{
- Debug.Console(0, "Unable to convert minutes or settings value. Please use an integer value for minutes. Errro: {0}", e);
+ CrestronConsole.ConsoleCommandResponse("Unable to convert minutes or settings value. Please use an integer value for minutes. Error: {0}", e);
}
}
else
{
device.StreamDebugging.SetDebuggingWithDefaultTimeout(debugSetting);
- Debug.Console(0, "Device: '{0}' debug level set to {1} for default time (30 minutes)", deviceKey, debugSetting);
+ CrestronConsole.ConsoleCommandResponse("Device: '{0}' debug level set to {1} for default time (30 minutes)", deviceKey, debugSetting);
}
}
diff --git a/src/PepperDash.Essentials.Core/Devices/EssentialsDevice.cs b/src/PepperDash.Essentials.Core/Devices/EssentialsDevice.cs
index bc8af721..1846a512 100644
--- a/src/PepperDash.Essentials.Core/Devices/EssentialsDevice.cs
+++ b/src/PepperDash.Essentials.Core/Devices/EssentialsDevice.cs
@@ -121,6 +121,41 @@ namespace PepperDash.Essentials.Core
#endregion
}
+ public abstract class ProcessorExtensionDeviceFactory : IProcessorExtensionDeviceFactory where T: EssentialsDevice
+ {
+ #region IProcessorExtensionDeviceFactory Members
+
+ ///
+ /// A list of strings that can be used in the type property of a DeviceConfig object to build an instance of this device
+ ///
+ public List TypeNames { get; protected set; }
+
+ ///
+ /// Loads an item to the ProcessorExtensionDeviceFactory.ProcessorExtensionFactoryMethods dictionary for each entry in the TypeNames list
+ ///
+ public void LoadFactories()
+ {
+ foreach (var typeName in TypeNames)
+ {
+ //Debug.Console(2, "Getting Description Attribute from class: '{0}'", typeof(T).FullName);
+ var descriptionAttribute = typeof(T).GetCustomAttributes(typeof(DescriptionAttribute), true) as DescriptionAttribute[];
+ string description = descriptionAttribute[0].Description;
+ var snippetAttribute = typeof(T).GetCustomAttributes(typeof(ConfigSnippetAttribute), true) as ConfigSnippetAttribute[];
+ ProcessorExtensionDeviceFactory.AddFactoryForType(typeName.ToLower(), description, typeof(T), BuildDevice);
+ }
+ }
+
+ ///
+ /// The method that will build the device
+ ///
+ /// The device config
+ /// An instance of the device
+ public abstract EssentialsDevice BuildDevice(DeviceConfig dc);
+
+ #endregion
+
+ }
+
///
/// Devices the basic needs for a Device Factory
///
diff --git a/src/PepperDash.Essentials.Core/Devices/GenericIRController.cs b/src/PepperDash.Essentials.Core/Devices/GenericIRController.cs
index 3c35b686..178e0c30 100644
--- a/src/PepperDash.Essentials.Core/Devices/GenericIRController.cs
+++ b/src/PepperDash.Essentials.Core/Devices/GenericIRController.cs
@@ -2,12 +2,13 @@
using System;
using System.Collections.Generic;
+using System.Linq;
using Crestron.SimplSharpPro.DeviceSupport;
using Full.Newtonsoft.Json;
using PepperDash.Core;
-using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.Core.Config;
+using PepperDash_Essentials_Core.Bridges.JoinMaps;
namespace PepperDash.Essentials.Core.Devices
{
@@ -21,12 +22,11 @@ namespace PepperDash.Essentials.Core.Devices
private readonly IrOutputPortController _port;
- public string[] IrCommands {get { return _port.IrFileCommands; }}
+ public string[] IrCommands {get { return _port.IrFileCommands; }}
public GenericIrController(string key, string name, IrOutputPortController irPort) : base(key, name)
{
_port = irPort;
-
if (_port == null)
{
Debug.Console(0, this, Debug.ErrorLogLevel.Error, "IR Port is null, device will not function");
@@ -73,23 +73,65 @@ namespace PepperDash.Essentials.Core.Devices
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject(joinMapSerialized);
- for (uint i = 0; i < _port.IrFileCommands.Length; i++)
- {
- var cmd = _port.IrFileCommands[i];
- var joinData = new JoinDataComplete(new JoinData {JoinNumber = i, JoinSpan = 1},
- new JoinMetadata
- {
- Description = cmd,
- JoinCapabilities = eJoinCapabilities.FromSIMPL,
- JoinType = eJoinType.Digital
- });
+ if (_port.UseBridgeJoinMap)
+ {
+ Debug.Console(0, this, "Using new IR bridge join map");
- joinData.SetJoinOffset(joinStart);
+ var bridgeJoins = joinMap.Joins.Where((kv) => _port.IrFileCommands.Any(cmd => cmd == kv.Key)).ToDictionary(kv => kv.Key);
+ if (bridgeJoins == null)
+ {
+ Debug.Console(0, this, Debug.ErrorLogLevel.Error, "Failed to link new IR bridge join map");
+ return;
+ }
- joinMap.Joins.Add(cmd,joinData);
+ joinMap.Joins.Clear();
- trilist.SetBoolSigAction(joinData.JoinNumber, (b) => Press(cmd, b));
- }
+ foreach (var bridgeJoin in bridgeJoins)
+ {
+ var key = bridgeJoin.Key;
+ var joinDataKey = bridgeJoin.Value.Key;
+ var joinDataValue = bridgeJoin.Value.Value;
+ var joinNumber = bridgeJoin.Value.Value.JoinNumber;
+
+ Debug.Console(2, this, @"bridgeJoin: Key-'{0}'
+Value.Key-'{1}'
+Value.JoinNumber-'{2}'
+Value.Metadata.Description-'{3}'",
+ key,
+ joinDataKey,
+ joinNumber,
+ joinDataValue.Metadata.Description);
+
+
+ joinMap.Joins.Add(key, joinDataValue);
+
+ trilist.SetBoolSigAction(joinNumber, (b) => Press(key, b));
+ }
+ }
+ else
+ {
+ Debug.Console(0, this, "Using legacy IR join mapping based on available IR commands");
+
+ joinMap.Joins.Clear();
+
+ for (uint i = 0; i < _port.IrFileCommands.Length; i++)
+ {
+ var cmd = _port.IrFileCommands[i];
+ var joinData = new JoinDataComplete(new JoinData { JoinNumber = i, JoinSpan = 1 },
+ new JoinMetadata
+ {
+ Description = cmd,
+ JoinCapabilities = eJoinCapabilities.FromSIMPL,
+ JoinType = eJoinType.Digital
+ });
+
+ joinData.SetJoinOffset(joinStart);
+
+ joinMap.Joins.Add(cmd, joinData);
+
+ trilist.SetBoolSigAction(joinData.JoinNumber, (b) => Press(cmd, b));
+ }
+ }
joinMap.PrintJoinMapInfo();
@@ -111,13 +153,6 @@ namespace PepperDash.Essentials.Core.Devices
}
}
- public sealed class GenericIrControllerJoinMap : JoinMapBaseAdvanced
- {
- public GenericIrControllerJoinMap(uint joinStart) : base(joinStart)
- {
- }
- }
-
public class GenericIrControllerFactory : EssentialsDeviceFactory
{
public GenericIrControllerFactory()
diff --git a/src/PepperDash.Essentials.Core/Devices/IVolumeAndAudioInterfaces.cs b/src/PepperDash.Essentials.Core/Devices/IVolumeAndAudioInterfaces.cs
index c8a5df39..c8033b92 100644
--- a/src/PepperDash.Essentials.Core/Devices/IVolumeAndAudioInterfaces.cs
+++ b/src/PepperDash.Essentials.Core/Devices/IVolumeAndAudioInterfaces.cs
@@ -72,6 +72,10 @@ namespace PepperDash.Essentials.Core
{
IBasicVolumeControls CurrentVolumeControls { get; }
event EventHandler CurrentVolumeDeviceChange;
+
+ void SetDefaultLevels();
+
+ bool ZeroVolumeWhenSwtichingVolumeDevices { get; }
}
diff --git a/src/PepperDash.Essentials.Core/Devices/IrOutputPortController.cs b/src/PepperDash.Essentials.Core/Devices/IrOutputPortController.cs
index d3d6e19e..6ffee074 100644
--- a/src/PepperDash.Essentials.Core/Devices/IrOutputPortController.cs
+++ b/src/PepperDash.Essentials.Core/Devices/IrOutputPortController.cs
@@ -31,6 +31,8 @@ namespace PepperDash.Essentials.Core
public string[] IrFileCommands { get { return IrPort.AvailableStandardIRCmds(IrPortUid); } }
+ public bool UseBridgeJoinMap { get; private set; }
+
///
/// Constructor for IrDevice base class. If a null port is provided, this class will
/// still function without trying to talk to a port.
@@ -55,9 +57,10 @@ namespace PepperDash.Essentials.Core
: base(key)
{
DriverLoaded = new BoolFeedback(() => DriverIsLoaded);
+ UseBridgeJoinMap = config.Properties["control"].Value("useBridgeJoinMap");
AddPostActivationAction(() =>
{
- IrPort = postActivationFunc(config);
+ IrPort = postActivationFunc(config);
if (IrPort == null)
{
@@ -69,8 +72,8 @@ namespace PepperDash.Essentials.Core
Debug.Console(1, "*************Attempting to load IR file: {0}***************", filePath);
LoadDriver(filePath);
-
- PrintAvailableCommands();
+
+ PrintAvailableCommands();
});
}
diff --git a/src/PepperDash.Essentials.Core/Devices/PduInterfaces.cs b/src/PepperDash.Essentials.Core/Devices/PduInterfaces.cs
index 0f3b3fbf..94aa71ac 100644
--- a/src/PepperDash.Essentials.Core/Devices/PduInterfaces.cs
+++ b/src/PepperDash.Essentials.Core/Devices/PduInterfaces.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using Crestron.SimplSharp;
using PepperDash.Core;
using PepperDash.Essentials.Core;
@@ -8,6 +9,7 @@ namespace PepperDash_Essentials_Core.Devices
///
/// Interface for any device that is able to control it'spower and has a configurable reboot time
///
+ [Obsolete("PepperDash_Essentials_Core.Devices is Deprecated - use PepperDash.Essentials.Core")]
public interface IHasPowerCycle : IKeyName, IHasPowerControlWithFeedback
{
///
@@ -24,6 +26,7 @@ namespace PepperDash_Essentials_Core.Devices
///
/// Interface for any device that contains a collection of IHasPowerReboot Devices
///
+ [Obsolete("PepperDash_Essentials_Core.Devices is Deprecated - use PepperDash.Essentials.Core")]
public interface IHasControlledPowerOutlets : IKeyName
{
///
diff --git a/src/PepperDash.Essentials.Core/Devices/PowerInterfaces.cs b/src/PepperDash.Essentials.Core/Devices/PowerInterfaces.cs
new file mode 100644
index 00000000..1fc6672a
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Devices/PowerInterfaces.cs
@@ -0,0 +1,87 @@
+using Crestron.SimplSharp;
+using PepperDash.Core;
+
+namespace PepperDash.Essentials.Core
+{
+ ///
+ /// Interface for any device that has a battery that can be monitored
+ ///
+ public interface IHasBatteryStats : IKeyName
+ {
+ int BatteryPercentage { get; }
+ int BatteryCautionThresholdPercentage { get; }
+ int BatteryWarningThresholdPercentage { get; }
+ BoolFeedback BatteryIsWarningFeedback { get; }
+ BoolFeedback BatteryIsCautionFeedback { get; }
+ BoolFeedback BatteryIsOkFeedback { get; }
+ IntFeedback BatteryPercentageFeedback { get; }
+ }
+
+ ///
+ /// Interface for any device that has a battery that can be monitored and the ability to charge and discharge
+ ///
+ public interface IHasBatteryCharging : IHasBatteryStats
+ {
+ BoolFeedback BatteryIsCharging { get; }
+ }
+
+ ///
+ /// Interface for any device that has multiple batteries that can be monitored
+ ///
+ public interface IHasBatteries : IKeyName
+ {
+ ReadOnlyDictionary Batteries { get; }
+ }
+
+ public interface IHasBatteryStatsExtended : IHasBatteryStats
+ {
+ int InputVoltage { get; }
+ int OutputVoltage { get; }
+ int InptuCurrent { get; }
+ int OutputCurrent { get; }
+
+ IntFeedback InputVoltageFeedback { get; }
+ IntFeedback OutputVoltageFeedback { get; }
+ IntFeedback InputCurrentFeedback { get; }
+ IntFeedback OutputCurrentFeedback { get; }
+ }
+
+ ///
+ /// Interface for any device that is able to control its power, has a configurable reboot time, and has batteries that can be monitored
+ ///
+ public interface IHasPowerCycleWithBattery : IHasPowerCycle, IHasBatteryStats
+ {
+
+ }
+
+ ///
+ /// Interface for any device that is able to control it's power and has a configurable reboot time
+ ///
+ public interface IHasPowerCycle : IKeyName, IHasPowerControlWithFeedback
+ {
+ ///
+ /// Delay between power off and power on for reboot
+ ///
+ int PowerCycleTimeMs { get; }
+
+ ///
+ /// Reboot outlet
+ ///
+ void PowerCycle();
+ }
+
+ ///
+ /// Interface for any device that contains a collection of IHasPowerReboot Devices
+ ///
+ public interface IHasControlledPowerOutlets : IKeyName
+ {
+ ///
+ /// Collection of IPduOutlets
+ ///
+ ReadOnlyDictionary PduOutlets { get; }
+
+ }
+
+
+
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Extensions/StringExtensions.cs b/src/PepperDash.Essentials.Core/Extensions/StringExtensions.cs
index 39501387..7bf8d5a5 100644
--- a/src/PepperDash.Essentials.Core/Extensions/StringExtensions.cs
+++ b/src/PepperDash.Essentials.Core/Extensions/StringExtensions.cs
@@ -1,4 +1,5 @@
using System;
+using System.ComponentModel;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -8,17 +9,70 @@ namespace PepperDash.Essentials.Core
{
public static class StringExtensions
{
+ ///
+ /// Returns null if a string is empty, otherwise returns the string
+ ///
+ /// string input
+ /// null if the string is emtpy, otherwise returns the string
public static string NullIfEmpty(this string s)
{
return string.IsNullOrEmpty(s) ? null : s;
}
+
+ ///
+ /// Returns null if a string is empty or made of only whitespace characters, otherwise returns the string
+ ///
+ /// string input
+ /// null if the string is wempty or made of only whitespace characters, otherwise returns the string
public static string NullIfWhiteSpace(this string s)
{
return string.IsNullOrEmpty(s.Trim()) ? null : s;
}
+
+ ///
+ /// Returns a replacement string if the input string is empty or made of only whitespace characters, otherwise returns the input string
+ ///
+ /// input string
+ /// string to replace with if input string is empty or whitespace
+ /// returns newString if s is null, emtpy, or made of whitespace characters, otherwise returns s
public static string ReplaceIfNullOrEmpty(this string s, string newString)
{
return string.IsNullOrEmpty(s) ? newString : s;
}
+
+ ///
+ /// Overload for Contains that allows setting an explicit String Comparison
+ ///
+ /// Source String
+ /// String to check in Source String
+ /// Comparison parameters
+ /// true of string contains "toCheck"
+ public static bool Contains(this string source, string toCheck, StringComparison comp)
+ {
+ if (string.IsNullOrEmpty(source)) return false;
+ return source.IndexOf(toCheck, comp) >= 0;
+ }
+
+ ///
+ /// Performs TrimStart() and TrimEnd() on source string
+ ///
+ /// String to Trim
+ /// Trimmed String
+ public static string TrimAll(this string source)
+ {
+ return string.IsNullOrEmpty(source) ? string.Empty : source.TrimStart().TrimEnd();
+ }
+
+ ///
+ /// Performs TrimStart(chars char[]) and TrimEnd(chars char[]) on source string.
+ ///
+ /// String to Trim
+ /// Char Array to trim from string
+ /// Trimmed String
+ public static string TrimAll(this string source, char[] chars)
+ {
+ return string.IsNullOrEmpty(source) ? string.Empty : source.TrimStart(chars).TrimEnd(chars);
+ }
+
}
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Factory/DeviceFactory.cs b/src/PepperDash.Essentials.Core/Factory/DeviceFactory.cs
index d53aef19..bfc32661 100644
--- a/src/PepperDash.Essentials.Core/Factory/DeviceFactory.cs
+++ b/src/PepperDash.Essentials.Core/Factory/DeviceFactory.cs
@@ -1,20 +1,13 @@
extern alias Full;
+using Crestron.SimplSharp;
+using Crestron.SimplSharp.Reflection;
+using Full.Newtonsoft.Json.Linq;
+using PepperDash.Core;
+using PepperDash.Essentials.Core.Config;
using System;
using System.Collections.Generic;
using System.Linq;
-using System.Text;
-using Crestron.SimplSharp;
-using Crestron.SimplSharpPro;
-using Crestron.SimplSharpPro.GeneralIO;
-using Crestron.SimplSharp.Reflection;
-using PepperDash.Core;
-using Full.Newtonsoft.Json.Linq;
-using Full.Newtonsoft.Json;
-using PepperDash.Essentials.Core;
-using PepperDash.Essentials.Core.Config;
-using PepperDash.Essentials.Core.CrestronIO;
-using PepperDash.Essentials.Core.Touchpanels;
namespace PepperDash.Essentials.Core
{
@@ -174,33 +167,26 @@ namespace PepperDash.Essentials.Core
///
/// Prints the type names and associated metadata from the FactoryMethods collection.
///
- ///
+ ///
public static void GetDeviceFactoryTypes(string filter)
{
- Dictionary types = new Dictionary();
+ var types = !string.IsNullOrEmpty(filter)
+ ? FactoryMethods.Where(k => k.Key.Contains(filter)).ToDictionary(k => k.Key, k => k.Value)
+ : FactoryMethods;
- if (!string.IsNullOrEmpty(filter))
- {
- types = FactoryMethods.Where(k => k.Key.Contains(filter)).ToDictionary(k => k.Key, k => k.Value);
- }
- else
- {
- types = FactoryMethods;
- }
-
- Debug.Console(0, "Device Types:");
+ CrestronConsole.ConsoleCommandResponse("Device Types:");
foreach (var type in types.OrderBy(t => t.Key))
{
var description = type.Value.Description;
var cType = "Not Specified by Plugin";
- if(type.Value.CType != null)
+ if (type.Value.CType != null)
{
cType = type.Value.CType.FullName;
}
- Debug.Console(0,
+ CrestronConsole.ConsoleCommandResponse(
@"Type: '{0}'
CType: '{1}'
Description: {2}", type.Key, cType, description);
diff --git a/src/PepperDash.Essentials.Core/Factory/IProcessorExtensionDeviceFactory.cs b/src/PepperDash.Essentials.Core/Factory/IProcessorExtensionDeviceFactory.cs
new file mode 100644
index 00000000..a50ab16d
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Factory/IProcessorExtensionDeviceFactory.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PepperDash.Essentials.Core
+{
+ public interface IProcessorExtensionDeviceFactory
+ {
+ ///
+ /// Loads all the extension factories to the ProcessorExtensionDeviceFactory
+ ///
+ void LoadFactories();
+ }
+}
diff --git a/src/PepperDash.Essentials.Core/Factory/ProcessorExtensionDeviceFactory.cs b/src/PepperDash.Essentials.Core/Factory/ProcessorExtensionDeviceFactory.cs
new file mode 100644
index 00000000..a5b57ad3
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Factory/ProcessorExtensionDeviceFactory.cs
@@ -0,0 +1,155 @@
+extern alias Full;
+using Crestron.SimplSharp.Reflection;
+using Full.Newtonsoft.Json.Linq;
+using Newtonsoft.Json.Linq;
+using PepperDash.Core;
+using PepperDash.Essentials.Core.Config;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace PepperDash.Essentials.Core
+{
+
+ public class ProcessorExtensionDeviceFactory
+ {
+ public ProcessorExtensionDeviceFactory() {
+ var assy = Assembly.GetExecutingAssembly();
+ PluginLoader.SetEssentialsAssembly(assy.GetName().Name, assy);
+
+ var extensions = assy.GetTypes().Where(ct => typeof(IProcessorExtensionDeviceFactory)
+ .IsAssignableFrom(ct) && !ct.IsInterface && !ct.IsAbstract);
+
+ if (extensions != null )
+ {
+ foreach ( var extension in extensions )
+ {
+ try
+ {
+ var factory = (IProcessorExtensionDeviceFactory)Crestron.SimplSharp.Reflection.Activator.CreateInstance(extension);
+ factory.LoadFactories();
+ }
+ catch( Exception e )
+ {
+ Debug.Console(0, Debug.ErrorLogLevel.Error, "Unable to load extension device: '{1}' ProcessorExtensionDeviceFactory: {0}", e, extension.Name);
+ }
+ }
+ }
+ }
+
+ ///
+ /// A dictionary of factory methods, keyed by config types, added by plugins.
+ /// These methods are looked up and called by GetDevice in this class.
+ ///
+ static Dictionary ProcessorExtensionFactoryMethods =
+ new Dictionary(StringComparer.OrdinalIgnoreCase);
+
+
+ ///
+ /// Adds a plugin factory method
+ ///
+ ///
+ ///
+ public static void AddFactoryForType(string extensionName, Func method)
+ {
+ //Debug.Console(1, Debug.ErrorLogLevel.Notice, "Adding factory method for type '{0}'", typeName);
+ ProcessorExtensionDeviceFactory.ProcessorExtensionFactoryMethods.Add(extensionName, new DeviceFactoryWrapper() { FactoryMethod = method });
+ }
+
+ public static void AddFactoryForType(string extensionName, string description, CType cType, Func method)
+ {
+ //Debug.Console(1, Debug.ErrorLogLevel.Notice, "Adding factory method for type '{0}'", typeName);
+
+ if (ProcessorExtensionFactoryMethods.ContainsKey(extensionName))
+ {
+ Debug.Console(0, Debug.ErrorLogLevel.Error, "Unable to add extension device: '{0}'. Already exists in ProcessorExtensionDeviceFactory", extensionName);
+ return;
+ }
+
+ var wrapper = new DeviceFactoryWrapper() { CType = cType, Description = description, FactoryMethod = method };
+ ProcessorExtensionDeviceFactory.ProcessorExtensionFactoryMethods.Add(extensionName, wrapper);
+ }
+
+ private static void CheckForSecrets(IEnumerable obj)
+ {
+ foreach (var prop in obj.Where(prop => prop.Value as Full.Newtonsoft.Json.Linq.JObject != null))
+ {
+ if (prop.Name.ToLower() == "secret")
+ {
+ var secret = GetSecret(prop.Children().First().ToObject());
+ //var secret = GetSecret(JsonConvert.DeserializeObject(prop.Children().First().ToString()));
+ prop.Parent.Replace(secret);
+ }
+ var recurseProp = prop.Value as Full.Newtonsoft.Json.Linq.JObject;
+ if (recurseProp == null) return;
+ CheckForSecrets(recurseProp.Properties());
+ }
+ }
+
+ private static string GetSecret(SecretsPropertiesConfig data)
+ {
+ var secretProvider = SecretsManager.GetSecretProviderByKey(data.Provider);
+ if (secretProvider == null) return null;
+ var secret = secretProvider.GetSecret(data.Key);
+ if (secret != null) return (string)secret.Value;
+ Debug.Console(1,
+ "Unable to retrieve secret {0}{1} - Make sure you've added it to the secrets provider",
+ data.Provider, data.Key);
+ return String.Empty;
+ }
+
+ ///
+ /// The factory method for processor extension devices. Also iterates the Factory methods that have
+ /// been loaded from plugins
+ ///
+ ///
+ ///
+ public static IKeyed GetExtensionDevice(DeviceConfig dc)
+ {
+ try
+ {
+ Debug.Console(0, Debug.ErrorLogLevel.Notice, "Loading '{0}' from Essentials Core", dc.Type);
+
+ var localDc = new DeviceConfig(dc);
+
+ var key = localDc.Key;
+ var name = localDc.Name;
+ var type = localDc.Type;
+ var properties = localDc.Properties;
+ //var propRecurse = properties;
+
+ var typeName = localDc.Type.ToLower();
+
+ var jObject = properties as Full.Newtonsoft.Json.Linq.JObject;
+ if (jObject != null)
+ {
+ var jProp = jObject.Properties();
+
+ CheckForSecrets(jProp);
+ }
+
+ Debug.Console(2, "typeName = {0}", typeName);
+ // Check for types that have been added by plugin dlls.
+ return !ProcessorExtensionFactoryMethods.ContainsKey(typeName) ? null : ProcessorExtensionFactoryMethods[typeName].FactoryMethod(localDc);
+ }
+ catch (Exception ex)
+ {
+ Debug.Console(0, Debug.ErrorLogLevel.Error, "Exception occurred while creating device {0}: {1}", dc.Key, ex.Message);
+
+ Debug.Console(2, "{0}", ex.StackTrace);
+
+ if (ex.InnerException == null)
+ {
+ return null;
+ }
+
+ Debug.Console(0, Debug.ErrorLogLevel.Error, "Inner exception while creating device {0}: {1}", dc.Key,
+ ex.InnerException.Message);
+ Debug.Console(2, "{0}", ex.InnerException.StackTrace);
+ return null;
+ }
+ }
+
+ }
+
+}
diff --git a/src/PepperDash.Essentials.Core/File/FileIO.cs b/src/PepperDash.Essentials.Core/File/FileIO.cs
index 51d64230..49b70a0c 100644
--- a/src/PepperDash.Essentials.Core/File/FileIO.cs
+++ b/src/PepperDash.Essentials.Core/File/FileIO.cs
@@ -21,35 +21,37 @@ namespace PepperDash.Essentials.Core
///
///
///
- public static FileInfo[] GetFiles(string fileName)
- {
- DirectoryInfo dirInfo = new DirectoryInfo(Path.GetDirectoryName(fileName));
- var files = dirInfo.GetFiles(Path.GetFileName(fileName));
- Debug.Console(0, "FileIO found: {0}, {1}", files.Count(), fileName);
- if (files.Count() > 0)
- {
- return files;
- }
- else
- {
- return null;
- }
- }
+ public static FileInfo[] GetFiles(string fileName)
+ {
+ string fullFilePath = Global.FilePathPrefix + fileName;
+ DirectoryInfo dirInfo = new DirectoryInfo(Path.GetDirectoryName(fullFilePath));
+ var files = dirInfo.GetFiles(Path.GetFileName(fullFilePath));
+ Debug.Console(0, "FileIO found: {0}, {1}", files.Count(), fullFilePath);
+ if (files.Count() > 0)
+ {
+ return files;
+ }
+ else
+ {
+ return null;
+ }
+ }
- public static FileInfo GetFile(string fileName)
- {
- DirectoryInfo dirInfo = new DirectoryInfo(Path.GetDirectoryName(fileName));
- var files = dirInfo.GetFiles(Path.GetFileName(fileName));
- Debug.Console(0, "FileIO found: {0}, {1}", files.Count(), fileName);
- if (files.Count() > 0)
- {
- return files.FirstOrDefault();
- }
- else
- {
- return null;
- }
- }
+ public static FileInfo GetFile(string fileName)
+ {
+ string fullFilePath = Global.FilePathPrefix + fileName;
+ DirectoryInfo dirInfo = new DirectoryInfo(Path.GetDirectoryName(fullFilePath));
+ var files = dirInfo.GetFiles(Path.GetFileName(fullFilePath));
+ Debug.Console(0, "FileIO found: {0}, {1}", files.Count(), fullFilePath);
+ if (files.Count() > 0)
+ {
+ return files.FirstOrDefault();
+ }
+ else
+ {
+ return null;
+ }
+ }
///
@@ -81,7 +83,7 @@ namespace PepperDash.Essentials.Core
{
if (fileLock.TryEnter())
{
- DirectoryInfo dirInfo = new DirectoryInfo(file.Name);
+ DirectoryInfo dirInfo = new DirectoryInfo(file.DirectoryName);
Debug.Console(2, "FileIO Getting Data {0}", file.FullName);
if (File.Exists(file.FullName))
@@ -202,7 +204,7 @@ namespace PepperDash.Essentials.Core
public static void WriteDataToFile(string data, string filePath)
{
Thread _WriteFileThread;
- _WriteFileThread = new Thread((O) => _WriteFileMethod(data, filePath), null, Thread.eThreadStartOptions.CreateSuspended);
+ _WriteFileThread = new Thread((O) => _WriteFileMethod(data, Global.FilePathPrefix + "/" + filePath), null, Thread.eThreadStartOptions.CreateSuspended);
_WriteFileThread.Priority = Thread.eThreadPriority.LowestPriority;
_WriteFileThread.Start();
Debug.Console(0, Debug.ErrorLogLevel.Notice, "New WriteFile Thread");
@@ -217,7 +219,8 @@ namespace PepperDash.Essentials.Core
{
if (fileLock.TryEnter())
{
- using (StreamWriter sw = new StreamWriter(filePath))
+
+ using (StreamWriter sw = new StreamWriter(filePath))
{
sw.Write(data);
sw.Flush();
diff --git a/src/PepperDash.Essentials.Core/Fusion/EssentialsHuddleSpaceFusionSystemControllerBase.cs b/src/PepperDash.Essentials.Core/Fusion/EssentialsHuddleSpaceFusionSystemControllerBase.cs
index f3827d0a..597a31fd 100644
--- a/src/PepperDash.Essentials.Core/Fusion/EssentialsHuddleSpaceFusionSystemControllerBase.cs
+++ b/src/PepperDash.Essentials.Core/Fusion/EssentialsHuddleSpaceFusionSystemControllerBase.cs
@@ -150,15 +150,20 @@ namespace PepperDash.Essentials.Core.Fusion
ReadGuidFile(guidFilePath);
}
- if (Room.RoomOccupancy != null)
+ var occupancyRoom = Room as IRoomOccupancy;
+
+ if (occupancyRoom != null)
{
- if (Room.OccupancyStatusProviderIsRemote)
+ if (occupancyRoom.RoomOccupancy != null)
{
- SetUpRemoteOccupancy();
- }
- else
- {
- SetUpLocalOccupancy();
+ if (occupancyRoom.OccupancyStatusProviderIsRemote)
+ {
+ SetUpRemoteOccupancy();
+ }
+ else
+ {
+ SetUpLocalOccupancy();
+ }
}
}
@@ -1525,10 +1530,15 @@ namespace PepperDash.Essentials.Core.Fusion
// Tie to method on occupancy object
//occSensorShutdownMinutes.OutputSig.UserObject(new Action(ushort)(b => Room.OccupancyObj.SetShutdownMinutes(b));
+ var occRoom = Room as IRoomOccupancy;
+ if (occRoom != null)
+ {
+ occRoom.RoomOccupancy.RoomIsOccupiedFeedback.LinkInputSig(occSensorAsset.RoomOccupied.InputSig);
+ occRoom.RoomOccupancy.RoomIsOccupiedFeedback.OutputChange += RoomIsOccupiedFeedback_OutputChange;
+ }
RoomOccupancyRemoteStringFeedback = new StringFeedback(() => _roomOccupancyRemoteString);
- Room.RoomOccupancy.RoomIsOccupiedFeedback.LinkInputSig(occSensorAsset.RoomOccupied.InputSig);
- Room.RoomOccupancy.RoomIsOccupiedFeedback.OutputChange += RoomIsOccupiedFeedback_OutputChange;
+
RoomOccupancyRemoteStringFeedback.LinkInputSig(occSensorAsset.RoomOccupancyInfo.InputSig);
//}
diff --git a/src/PepperDash.Essentials.Core/JoinMaps/JoinMapBase.cs b/src/PepperDash.Essentials.Core/JoinMaps/JoinMapBase.cs
index e16640ce..6dff477d 100644
--- a/src/PepperDash.Essentials.Core/JoinMaps/JoinMapBase.cs
+++ b/src/PepperDash.Essentials.Core/JoinMaps/JoinMapBase.cs
@@ -2,10 +2,8 @@
using System;
using System.Collections.Generic;
-using System.Data;
using System.Globalization;
using System.Linq;
-using System.Runtime.InteropServices;
using System.Text;
using Crestron.SimplSharp.Reflection;
using Crestron.SimplSharp.CrestronIO;
@@ -105,22 +103,22 @@ namespace PepperDash.Essentials.Core
///
public void PrintJoinMapInfo()
{
- Debug.Console(0, "{0}:\n", GetType().Name);
+ CrestronConsole.ConsoleCommandResponse("{0}:\n", GetType().Name);
// Get the joins of each type and print them
- Debug.Console(0, "Digitals:");
+ CrestronConsole.ConsoleCommandResponse("Digitals:");
var digitals = Joins.Where(j => (j.Value.JoinType & eJoinType.Digital) == eJoinType.Digital).ToDictionary(j => j.Key, j => j.Value);
- Debug.Console(2, "Found {0} Digital Joins", digitals.Count);
+ CrestronConsole.ConsoleCommandResponse("Found {0} Digital Joins", digitals.Count);
PrintJoinList(GetSortedJoins(digitals));
- Debug.Console(0, "Analogs:");
+ CrestronConsole.ConsoleCommandResponse("Analogs:");
var analogs = Joins.Where(j => (j.Value.JoinType & eJoinType.Analog) == eJoinType.Analog).ToDictionary(j => j.Key, j => j.Value);
- Debug.Console(2, "Found {0} Analog Joins", analogs.Count);
+ CrestronConsole.ConsoleCommandResponse("Found {0} Analog Joins", analogs.Count);
PrintJoinList(GetSortedJoins(analogs));
- Debug.Console(0, "Serials:");
+ CrestronConsole.ConsoleCommandResponse("Serials:");
var serials = Joins.Where(j => (j.Value.JoinType & eJoinType.Serial) == eJoinType.Serial).ToDictionary(j => j.Key, j => j.Value);
- Debug.Console(2, "Found {0} Serial Joins", serials.Count);
+ CrestronConsole.ConsoleCommandResponse("Found {0} Serial Joins", serials.Count);
PrintJoinList(GetSortedJoins(serials));
}
@@ -143,7 +141,7 @@ namespace PepperDash.Essentials.Core
{
foreach (var join in joins)
{
- Debug.Console(0,
+ CrestronConsole.ConsoleCommandResponse(
@"Join Number: {0} | Label: '{1}' | JoinSpan: '{2}' | Type: '{3}' | Capabilities: '{4}'",
join.Value.JoinNumber,
join.Value.Label,
@@ -238,25 +236,45 @@ namespace PepperDash.Essentials.Core
///
public void PrintJoinMapInfo()
{
- Debug.Console(0, "{0}:\n", GetType().Name);
+ var sb = JoinmapStringBuilder();
+
+ CrestronConsole.ConsoleCommandResponse(sb.ToString());
+ }
+
+ private StringBuilder JoinmapStringBuilder()
+ {
+ var sb = new StringBuilder();
// Get the joins of each type and print them
- Debug.Console(0, "Digitals:");
- var digitals = Joins.Where(j => (j.Value.Metadata.JoinType & eJoinType.Digital) == eJoinType.Digital).ToDictionary(j => j.Key, j => j.Value);
- Debug.Console(2, "Found {0} Digital Joins", digitals.Count);
- PrintJoinList(GetSortedJoins(digitals));
+ sb.AppendLine(String.Format("# {0}", GetType().Name));
+ sb.AppendLine();
+ sb.AppendLine("## Digitals");
+ sb.AppendLine();
+ // Get the joins of each type and print them
+ var digitals =
+ Joins.Where(j => (j.Value.Metadata.JoinType & eJoinType.Digital) == eJoinType.Digital)
+ .ToDictionary(j => j.Key, j => j.Value);
+ var digitalSb = AppendJoinList(GetSortedJoins(digitals));
+ digitalSb.AppendLine("## Analogs");
+ digitalSb.AppendLine();
- Debug.Console(0, "Analogs:");
- var analogs = Joins.Where(j => (j.Value.Metadata.JoinType & eJoinType.Analog) == eJoinType.Analog).ToDictionary(j => j.Key, j => j.Value);
- Debug.Console(2, "Found {0} Analog Joins", analogs.Count);
- PrintJoinList(GetSortedJoins(analogs));
+ var analogs =
+ Joins.Where(j => (j.Value.Metadata.JoinType & eJoinType.Analog) == eJoinType.Analog)
+ .ToDictionary(j => j.Key, j => j.Value);
+ var analogSb = AppendJoinList(GetSortedJoins(analogs));
+ analogSb.AppendLine("## Serials");
+ analogSb.AppendLine();
- Debug.Console(0, "Serials:");
- var serials = Joins.Where(j => (j.Value.Metadata.JoinType & eJoinType.Serial) == eJoinType.Serial).ToDictionary(j => j.Key, j => j.Value);
- Debug.Console(2, "Found {0} Serial Joins", serials.Count);
- PrintJoinList(GetSortedJoins(serials));
+ var serials =
+ Joins.Where(j => (j.Value.Metadata.JoinType & eJoinType.Serial) == eJoinType.Serial)
+ .ToDictionary(j => j.Key, j => j.Value);
+ var serialSb = AppendJoinList(GetSortedJoins(serials));
+ sb.EnsureCapacity(sb.Length + digitalSb.Length + analogSb.Length + serialSb.Length);
+ sb.Append(digitalSb).Append(analogSb).Append(serialSb);
+ return sb;
}
+
///
/// Prints the join information to console
///
@@ -264,37 +282,11 @@ namespace PepperDash.Essentials.Core
{
var pluginType = GetType().Name;
- Debug.Console(0, "{0}:\n", pluginType);
+ CrestronConsole.ConsoleCommandResponse("{0}:\n", pluginType);
- var sb = new StringBuilder();
- sb.AppendLine(String.Format("# {0}", GetType().Name));
- sb.AppendLine(String.Format("Generated from '{0}' on bridge '{1}'", deviceKey, bridgeKey));
- sb.AppendLine();
- sb.AppendLine("## Digitals");
- // Get the joins of each type and print them
- var digitals = Joins.Where(j => (j.Value.Metadata.JoinType & eJoinType.Digital) == eJoinType.Digital).ToDictionary(j => j.Key, j => j.Value);
- Debug.Console(2, "Found {0} Digital Joins", digitals.Count);
- var digitalSb = AppendJoinList(GetSortedJoins(digitals));
- digitalSb.AppendLine("## Analogs");
- digitalSb.AppendLine();
- Debug.Console(0, "Analogs:");
- var analogs = Joins.Where(j => (j.Value.Metadata.JoinType & eJoinType.Analog) == eJoinType.Analog).ToDictionary(j => j.Key, j => j.Value);
- Debug.Console(2, "Found {0} Analog Joins", analogs.Count);
- var analogSb = AppendJoinList(GetSortedJoins(analogs));
- analogSb.AppendLine("## Serials");
- analogSb.AppendLine();
-
- Debug.Console(0, "Serials:");
- var serials = Joins.Where(j => (j.Value.Metadata.JoinType & eJoinType.Serial) == eJoinType.Serial).ToDictionary(j => j.Key, j => j.Value);
- Debug.Console(2, "Found {0} Serial Joins", serials.Count);
- var serialSb = AppendJoinList(GetSortedJoins(serials));
-
- sb.EnsureCapacity(sb.Length + digitalSb.Length + analogSb.Length + serialSb.Length);
- sb.Append(digitalSb).Append(analogSb).Append(serialSb);
-
- WriteJoinmapMarkdown(sb, pluginType, bridgeKey, deviceKey);
+ WriteJoinmapMarkdown(JoinmapStringBuilder(), pluginType, bridgeKey, deviceKey);
}
@@ -305,7 +297,7 @@ namespace PepperDash.Essentials.Core
using (var sw = new StreamWriter(fileName))
{
sw.WriteLine(stringBuilder.ToString());
- Debug.Console(0, "Joinmap Readme generated and written to {0}", fileName);
+ CrestronConsole.ConsoleCommandResponse("Joinmap Readme generated and written to {0}", fileName);
}
}
@@ -315,7 +307,7 @@ namespace PepperDash.Essentials.Core
///
///
///
- List> GetSortedJoins(Dictionary joins)
+ static List> GetSortedJoins(Dictionary joins)
{
var sortedJoins = joins.ToList();
@@ -324,20 +316,6 @@ namespace PepperDash.Essentials.Core
return sortedJoins;
}
- void PrintJoinList(List> joins)
- {
- foreach (var join in joins)
- {
- Debug.Console(0,
- @"Join Number: {0} | JoinSpan: '{1}' | JoinName: {2} | Description: '{3}' | Type: '{4}' | Capabilities: '{5}'",
- join.Value.JoinNumber,
- join.Value.JoinSpan,
- join.Key,
- String.IsNullOrEmpty(join.Value.AttributeName) ? join.Value.Metadata.Label : join.Value.AttributeName,
- join.Value.Metadata.JoinType.ToString(),
- join.Value.Metadata.JoinCapabilities.ToString());
- }
- }
static StringBuilder AppendJoinList(List> joins)
{
@@ -380,16 +358,18 @@ namespace PepperDash.Essentials.Core
{
foreach (var customJoinData in joinData)
{
- var join = Joins[customJoinData.Key];
+ JoinDataComplete join;
+
+ if (!Joins.TryGetValue(customJoinData.Key, out join))
+ {
+ Debug.Console(2, "No matching key found in join map for: '{0}'", customJoinData.Key);
+ continue;
+ }
if (join != null)
{
join.SetCustomJoinData(customJoinData.Value);
}
- else
- {
- Debug.Console(2, "No matching key found in join map for: '{0}'", customJoinData.Key);
- }
}
PrintJoinMapInfo();
diff --git a/src/PepperDash.Essentials.Core/Monitoring/SystemMonitorController.cs b/src/PepperDash.Essentials.Core/Monitoring/SystemMonitorController.cs
index b9d25127..1066637c 100644
--- a/src/PepperDash.Essentials.Core/Monitoring/SystemMonitorController.cs
+++ b/src/PepperDash.Essentials.Core/Monitoring/SystemMonitorController.cs
@@ -45,7 +45,20 @@ namespace PepperDash.Essentials.Core.Monitoring
public StringFeedback UptimeFeedback { get; set; }
public StringFeedback LastStartFeedback { get; set; }
- public SystemMonitorController(string key)
+ public BoolFeedback IsApplianceFeedback { get; protected set; }
+ private bool _isApplianceFb
+ {
+ get { return CrestronEnvironment.DevicePlatform == eDevicePlatform.Appliance; }
+ }
+
+ public BoolFeedback IsServerFeedback { get; protected set; }
+ private bool _isServerFb
+ {
+ get { return CrestronEnvironment.DevicePlatform == eDevicePlatform.Server; }
+ }
+
+
+ public SystemMonitorController(string key)
: base(key)
{
Debug.Console(2, this, "Adding SystemMonitorController.");
@@ -65,6 +78,9 @@ namespace PepperDash.Essentials.Core.Monitoring
UptimeFeedback = new StringFeedback(() => _uptime);
LastStartFeedback = new StringFeedback(()=> _lastStart);
+ IsApplianceFeedback = new BoolFeedback(() => _isApplianceFb);
+ IsServerFeedback = new BoolFeedback(() => _isServerFb);
+
ProgramStatusFeedbackCollection = new Dictionary();
foreach (var prog in SystemMonitor.ProgramCollection)
@@ -125,6 +141,26 @@ namespace PepperDash.Essentials.Core.Monitoring
_uptime = uptimeRaw.Substring(forIndex + 4);
}
+ private static void ProcessorReboot()
+ {
+ if (CrestronEnvironment.DevicePlatform == eDevicePlatform.Server) return;
+
+ var response = string.Empty;
+ CrestronConsole.SendControlSystemCommand("reboot", ref response);
+ }
+
+ private static void ProgramReset(uint index)
+ {
+ if (CrestronEnvironment.DevicePlatform == eDevicePlatform.Server) return;
+
+ if (index <= 0 || index > 10) return;
+
+ var cmd = string.Format("progreset -p:{0}", index);
+
+ var response = string.Empty;
+ CrestronConsole.SendControlSystemCommand(cmd, ref response);
+ }
+
private void CrestronEnvironmentOnEthernetEventHandler(EthernetEventArgs ethernetEventArgs)
{
if (ethernetEventArgs.EthernetEventType != eEthernetEventType.LinkUp) return;
@@ -187,6 +223,9 @@ namespace PepperDash.Essentials.Core.Monitoring
SerialNumberFeedback.FireUpdate();
ModelFeedback.FireUpdate();
+ IsApplianceFeedback.FireUpdate();
+ IsServerFeedback.FireUpdate();
+
OnSystemMonitorPropertiesChanged();
}
@@ -239,6 +278,11 @@ namespace PepperDash.Essentials.Core.Monitoring
UptimeFeedback.LinkInputSig(trilist.StringInput[joinMap.Uptime.JoinNumber]);
LastStartFeedback.LinkInputSig(trilist.StringInput[joinMap.LastBoot.JoinNumber]);
+ trilist.SetSigHeldAction(joinMap.ProcessorReboot.JoinNumber, 10000, ProcessorReboot);
+
+ IsApplianceFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsAppliance.JoinNumber]);
+ IsServerFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsServer.JoinNumber]);
+
// iterate the program status feedback collection and map all the joins
LinkProgramInfoJoins(this, trilist, joinMap);
@@ -303,11 +347,13 @@ namespace PepperDash.Essentials.Core.Monitoring
p.Value.AggregatedProgramInfoFeedback.LinkInputSig(
trilist.StringInput[programSlotJoinStart + joinMap.AggregatedProgramInfo.JoinNumber]);
+ trilist.SetSigHeldAction(programSlotJoinStart + joinMap.ProgramReset.JoinNumber, 10000, () => ProgramReset(programNumber));
+
programSlotJoinStart = programSlotJoinStart + joinMap.ProgramOffsetJoin.JoinSpan;
}
- }
+ }
- //// Sets the time zone
+ //// Sets the time zone
//public void SetTimeZone(int timeZone)
//{
// SystemMonitor.TimeZoneInformation.TimeZoneNumber = timeZone;
@@ -519,11 +565,11 @@ namespace PepperDash.Essentials.Core.Monitoring
ProgramUnregisteredFeedback =
new BoolFeedback(() => Program.RegistrationState == eProgramRegistrationState.Unregister);
ProgramUnregisteredFeedback.FireUpdate();
-
- ProgramNameFeedback = new StringFeedback(() => ProgramInfo.ProgramFile);
+
+ ProgramNameFeedback = new StringFeedback(() => ProgramInfo.ProgramFile);
+ CrestronDataBaseVersionFeedback = new StringFeedback(() => ProgramInfo.CrestronDb);
+ EnvironmentVersionFeedback = new StringFeedback(() => ProgramInfo.Environment);
ProgramCompileTimeFeedback = new StringFeedback(() => ProgramInfo.CompileTime);
- CrestronDataBaseVersionFeedback = new StringFeedback(() => ProgramInfo.CrestronDb);
- EnvironmentVersionFeedback = new StringFeedback(() => ProgramInfo.Environment);
AggregatedProgramInfoFeedback = new StringFeedback(() => JsonConvert.SerializeObject(ProgramInfo));
GetProgramInfo();
@@ -576,9 +622,9 @@ namespace PepperDash.Essentials.Core.Monitoring
// Assume no valid program info. Constructing a new object will wipe all properties
ProgramInfo = new ProgramInfo(Program.Number)
{
- OperatingState = Program.OperatingState,
+ OperatingState = Program.OperatingState,
RegistrationState = Program.RegistrationState
- };
+ };
UpdateFeedbacks();
@@ -595,13 +641,20 @@ namespace PepperDash.Essentials.Core.Monitoring
if (ProgramInfo.ProgramFile.Contains(".dll"))
{
- // SSP Program
+ // SSP Program
ProgramInfo.FriendlyName = ParseConsoleData(response, "Friendly Name", ": ", "\n");
ProgramInfo.ApplicationName = ParseConsoleData(response, "Application Name", ": ", "\n");
ProgramInfo.ProgramTool = ParseConsoleData(response, "Program Tool", ": ", "\n");
ProgramInfo.MinFirmwareVersion = ParseConsoleData(response, "Min Firmware Version", ": ",
"\n");
ProgramInfo.PlugInVersion = ParseConsoleData(response, "PlugInVersion", ": ", "\n");
+
+ ProgramInfo.ProgramFile += string.Format(" {0}.{1}.{2}",
+ ProgramInfo.CompilerRevisionInfo.Major,
+ ProgramInfo.CompilerRevisionInfo.Minor,
+ ProgramInfo.CompilerRevisionInfo.Build);
+
+ ProgramInfo.Environment = ProgramInfo.ProgramTool;
}
else if (ProgramInfo.ProgramFile.Contains(".smw"))
{
@@ -692,6 +745,15 @@ namespace PepperDash.Essentials.Core.Monitoring
[JsonProperty("compilerRevision")]
public string CompilerRevision { get; set; }
+ [JsonIgnore]
+ public Version CompilerRevisionInfo
+ {
+ get
+ {
+ return new Version(CompilerRevision);
+ }
+ }
+
[JsonProperty("compileTime")]
public string CompileTime { get; set; }
@@ -732,7 +794,7 @@ namespace PepperDash.Essentials.Core.Monitoring
ProgramFile = "";
FriendlyName = "";
CompilerRevision = "";
- CompileTime = "";
+ CompileTime = "";
Include4Dat = "";
SystemName = "";
diff --git a/src/PepperDash.Essentials.Core/PartitionSensor/GlsPartitionSensorController.cs b/src/PepperDash.Essentials.Core/PartitionSensor/GlsPartitionSensorController.cs
index 7298e303..511eda66 100644
--- a/src/PepperDash.Essentials.Core/PartitionSensor/GlsPartitionSensorController.cs
+++ b/src/PepperDash.Essentials.Core/PartitionSensor/GlsPartitionSensorController.cs
@@ -87,18 +87,32 @@ namespace PepperDash.Essentials.Core
{
if (_partitionSensor.IsOnline == false) return;
- Debug.Console(1, this, "Attempting to apply settings to sensor from config");
+ // Default to enable
+ _partitionSensor.Enable.BoolValue = true;
- if (PropertiesConfig.Sensitivity != null)
- {
- Debug.Console(1, this, "Sensitivity found, attempting to set value '{0}' from config",
- PropertiesConfig.Sensitivity);
- _partitionSensor.Sensitivity.UShortValue = (ushort) PropertiesConfig.Sensitivity;
- }
- else
- {
- Debug.Console(1, this, "Sensitivity null, no value specified in config");
- }
+ Debug.Console(1, this, "Attempting to apply settings to sensor from config");
+
+ if (PropertiesConfig.Sensitivity != null)
+ {
+ Debug.Console(1, this, "Sensitivity found, attempting to set value '{0}' from config",
+ PropertiesConfig.Sensitivity);
+ _partitionSensor.Sensitivity.UShortValue = (ushort)PropertiesConfig.Sensitivity;
+ }
+ else
+ {
+ Debug.Console(1, this, "Sensitivity null, no value specified in config");
+ }
+
+ if (PropertiesConfig.Enable != null)
+ {
+ Debug.Console(1, this, "Enable found, attempting to set value '{0}' from config",
+ PropertiesConfig.Enable);
+ _partitionSensor.Enable.BoolValue = (bool)PropertiesConfig.Enable;
+ }
+ else
+ {
+ Debug.Console(1, this, "Enable null, no value specified in config");
+ }
}
diff --git a/src/PepperDash.Essentials.Core/PartitionSensor/GlsPartitionSensorPropertiesConfig.cs b/src/PepperDash.Essentials.Core/PartitionSensor/GlsPartitionSensorPropertiesConfig.cs
index 635b8962..03611dd2 100644
--- a/src/PepperDash.Essentials.Core/PartitionSensor/GlsPartitionSensorPropertiesConfig.cs
+++ b/src/PepperDash.Essentials.Core/PartitionSensor/GlsPartitionSensorPropertiesConfig.cs
@@ -18,6 +18,9 @@ namespace PepperDash_Essentials_Core.PartitionSensor
/// The sensitivity range shall be between 1(lowest) to 10 (highest).
///
[JsonProperty("sensitivity")]
- public ushort? Sensitivity { get; set; }
+ public ushort? Sensitivity { get; set; }
+
+ [JsonProperty("enable")]
+ public bool? Enable { get; set; }
}
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/PepperDash.Essentials.Core.csproj b/src/PepperDash.Essentials.Core/PepperDash.Essentials.Core.csproj
index 7360df12..db87a84d 100644
--- a/src/PepperDash.Essentials.Core/PepperDash.Essentials.Core.csproj
+++ b/src/PepperDash.Essentials.Core/PepperDash.Essentials.Core.csproj
@@ -27,7 +27,7 @@
-
+
Full
diff --git a/src/PepperDash.Essentials.Core/PepperDash_Essentials_Core.csproj b/src/PepperDash.Essentials.Core/PepperDash_Essentials_Core.csproj
index 6020fbac..bd727697 100644
--- a/src/PepperDash.Essentials.Core/PepperDash_Essentials_Core.csproj
+++ b/src/PepperDash.Essentials.Core/PepperDash_Essentials_Core.csproj
@@ -83,7 +83,7 @@
..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.UI.dll
-
+
False
..\..\..\packages\PepperDashCore\lib\net35\PepperDash_Core.dll
@@ -94,7 +94,7 @@
False
- ..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpCWSHelperInterface.dll
+ ..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpCWSHelperInterface.dll
False
@@ -127,6 +127,8 @@
+
+
@@ -200,6 +202,8 @@
+
+
@@ -417,12 +421,6 @@
-
-
- {E51D7C84-4906-486C-B2BA-EEB3B4E9731B}
- PepperDash_Essentials_Interfaces
-
-
diff --git a/src/PepperDash.Essentials.Core/Plugins/PluginLoader.cs b/src/PepperDash.Essentials.Core/Plugins/PluginLoader.cs
index 9da843b8..dcc492df 100644
--- a/src/PepperDash.Essentials.Core/Plugins/PluginLoader.cs
+++ b/src/PepperDash.Essentials.Core/Plugins/PluginLoader.cs
@@ -194,13 +194,13 @@ namespace PepperDash.Essentials
///
public static void ReportAssemblyVersions(string command)
{
- Debug.Console(0, "Loaded Assemblies:");
+
+ CrestronConsole.ConsoleCommandResponse("Loaded Assemblies:" + CrestronEnvironment.NewLine);
foreach (var assembly in LoadedAssemblies)
{
- Debug.Console(0, "{0} Version: {1}", assembly.Name, assembly.Version);
+ CrestronConsole.ConsoleCommandResponse("{0} Version: {1}" + CrestronEnvironment.NewLine, assembly.Name, assembly.Version);
}
}
-
///
/// Moves any .dll assemblies not already loaded from the plugins folder to loadedPlugins folder
///
diff --git a/src/PepperDash.Essentials.Core/Room/Behaviours/RoomOnToDefaultSourceWhenOccupied.cs b/src/PepperDash.Essentials.Core/Room/Behaviours/RoomOnToDefaultSourceWhenOccupied.cs
index e46e93cb..c3bc0ca2 100644
--- a/src/PepperDash.Essentials.Core/Room/Behaviours/RoomOnToDefaultSourceWhenOccupied.cs
+++ b/src/PepperDash.Essentials.Core/Room/Behaviours/RoomOnToDefaultSourceWhenOccupied.cs
@@ -40,7 +40,7 @@ namespace PepperDash.Essentials.Core
ScheduledEventGroup FeatureEventGroup;
- public IEssentialsRoom Room { get; private set; }
+ public IRoomOccupancy Room { get; private set; }
private Fusion.EssentialsHuddleSpaceFusionSystemControllerBase FusionRoom;
@@ -86,7 +86,7 @@ namespace PepperDash.Essentials.Core
///
void SetUpDevice()
{
- Room = DeviceManager.GetDeviceForKey(PropertiesConfig.RoomKey) as IEssentialsRoom;
+ Room = DeviceManager.GetDeviceForKey(PropertiesConfig.RoomKey) as IRoomOccupancy;
if (Room != null)
{
@@ -237,12 +237,23 @@ namespace PepperDash.Essentials.Core
if (FeatureEnabled)
{
- // Check room power state first
- if (!Room.OnFeedback.BoolValue)
- {
- Debug.Console(1, this, "Powering Room on to default source");
- Room.RunDefaultPresentRoute();
+ var essentialsRoom = Room as IEssentialsRoom;
+
+ if (essentialsRoom != null) {
+ if (!essentialsRoom.OnFeedback.BoolValue)
+ {
+ Debug.Console(1, this, "Powering Room on to default source");
+
+ var defaultRouteRoom = Room as IRunDefaultPresentRoute;
+
+ if (defaultRouteRoom != null)
+ {
+ defaultRouteRoom.RunDefaultPresentRoute();
+ }
+ }
}
+ // Check room power state first
+
}
}
}
diff --git a/src/PepperDash.Essentials.Core/Room/EssentialsRoomBase.cs b/src/PepperDash.Essentials.Core/Room/EssentialsRoomBase.cs
index 72bf9060..abfc34b8 100644
--- a/src/PepperDash.Essentials.Core/Room/EssentialsRoomBase.cs
+++ b/src/PepperDash.Essentials.Core/Room/EssentialsRoomBase.cs
@@ -1,6 +1,4 @@
-extern alias Full;
-
-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -13,8 +11,6 @@ using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.Devices;
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
-using Full.Newtonsoft.Json;
-
namespace PepperDash.Essentials.Core
{
///
@@ -37,7 +33,7 @@ namespace PepperDash.Essentials.Core
public BoolFeedback IsWarmingUpFeedback { get; private set; }
public BoolFeedback IsCoolingDownFeedback { get; private set; }
- public IOccupancyStatusProvider RoomOccupancy { get; private set; }
+ public IOccupancyStatusProvider RoomOccupancy { get; protected set; }
public bool OccupancyStatusProviderIsRemote { get; private set; }
diff --git a/src/PepperDash.Essentials.Core/Room/IEssentialsRoom.cs b/src/PepperDash.Essentials.Core/Room/IEssentialsRoom.cs
index 2273690f..9a70f980 100644
--- a/src/PepperDash.Essentials.Core/Room/IEssentialsRoom.cs
+++ b/src/PepperDash.Essentials.Core/Room/IEssentialsRoom.cs
@@ -17,15 +17,10 @@ namespace PepperDash.Essentials.Core
///
public interface IEssentialsRoom : IKeyName, IReconfigurableDevice, IRunDefaultPresentRoute, IEnvironmentalControls
{
- BoolFeedback OnFeedback { get; }
-
- event EventHandler RoomOccupancyIsSet;
+ BoolFeedback OnFeedback { get; }
BoolFeedback IsWarmingUpFeedback { get; }
- BoolFeedback IsCoolingDownFeedback { get; }
-
- IOccupancyStatusProvider RoomOccupancy { get; }
- bool OccupancyStatusProviderIsRemote { get; }
+ BoolFeedback IsCoolingDownFeedback { get; }
bool IsMobileControlEnabled { get; }
IMobileControlRoomBridge MobileControlRoomBridge { get; }
@@ -35,31 +30,16 @@ namespace PepperDash.Essentials.Core
SecondsCountdownTimer ShutdownPromptTimer { get; }
int ShutdownPromptSeconds { get; }
int ShutdownVacancySeconds { get; }
- eShutdownType ShutdownType { get; }
-
- EssentialsRoomEmergencyBase Emergency { get; }
-
- Core.Privacy.MicrophonePrivacyController MicrophonePrivacy { get; }
+ eShutdownType ShutdownType { get; }
string LogoUrlLightBkgnd { get; }
string LogoUrlDarkBkgnd { get; }
- eVacancyMode VacancyMode { get; }
+ void StartShutdown(eShutdownType type);
- bool ZeroVolumeWhenSwtichingVolumeDevices { get; }
+ void Shutdown();
- void StartShutdown(eShutdownType type);
- void StartRoomVacancyTimer(eVacancyMode mode);
-
- void Shutdown();
-
- void SetRoomOccupancy(IOccupancyStatusProvider statusProvider, int timeoutMinutes);
-
- void PowerOnToDefaultOrLastSource();
-
- void SetDefaultLevels();
-
- void RoomVacatedForTimeoutPeriod(object o);
+ void PowerOnToDefaultOrLastSource();
}
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Room/Interfaces.cs b/src/PepperDash.Essentials.Core/Room/Interfaces.cs
index b5121e9c..e962e604 100644
--- a/src/PepperDash.Essentials.Core/Room/Interfaces.cs
+++ b/src/PepperDash.Essentials.Core/Room/Interfaces.cs
@@ -41,7 +41,6 @@ namespace PepperDash.Essentials.Core
void RunRouteAction(string routeKey, string sourceListKey);
void RunRouteAction(string routeKey, string sourceListKey, Action successCallback);
-
}
///
@@ -78,4 +77,30 @@ namespace PepperDash.Essentials.Core
bool HasEnvironmentalControlDevices { get; }
}
+ public interface IRoomOccupancy:IKeyed
+ {
+ IOccupancyStatusProvider RoomOccupancy { get; }
+ bool OccupancyStatusProviderIsRemote { get; }
+
+ void SetRoomOccupancy(IOccupancyStatusProvider statusProvider, int timeoutMinutes);
+
+ void RoomVacatedForTimeoutPeriod(object o);
+
+ void StartRoomVacancyTimer(eVacancyMode mode);
+
+ eVacancyMode VacancyMode { get; }
+
+ event EventHandler RoomOccupancyIsSet;
+ }
+
+ public interface IEmergency
+ {
+ EssentialsRoomEmergencyBase Emergency { get; }
+ }
+
+ public interface IMicrophonePrivacy
+ {
+ Core.Privacy.MicrophonePrivacyController MicrophonePrivacy { get; }
+ }
+
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Routing/RoutingInterfaces.cs b/src/PepperDash.Essentials.Core/Routing/RoutingInterfaces.cs
index 952a48b1..dcec7ae2 100644
--- a/src/PepperDash.Essentials.Core/Routing/RoutingInterfaces.cs
+++ b/src/PepperDash.Essentials.Core/Routing/RoutingInterfaces.cs
@@ -204,4 +204,9 @@ namespace PepperDash.Essentials.Core
SigType = sigType;
}
}
+
+ public interface IRoutingHasVideoInputSyncFeedbacks
+ {
+ FeedbackCollection VideoInputSyncFeedbacks { get; }
+ }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Routing/RoutingPort.cs b/src/PepperDash.Essentials.Core/Routing/RoutingPort.cs
index 79dd4eda..ab64f15e 100644
--- a/src/PepperDash.Essentials.Core/Routing/RoutingPort.cs
+++ b/src/PepperDash.Essentials.Core/Routing/RoutingPort.cs
@@ -42,7 +42,7 @@ namespace PepperDash.Essentials.Core
public enum eRoutingPortConnectionType
{
None, BackplaneOnly, DisplayPort, Dvi, Hdmi, Rgb, Vga, LineAudio, DigitalAudio, Sdi,
- Composite, Component, DmCat, DmMmFiber, DmSmFiber, Speaker, Streaming
+ Composite, Component, DmCat, DmMmFiber, DmSmFiber, Speaker, Streaming, UsbC, HdBaseT
}
///
diff --git a/src/PepperDash.Essentials.Core/Routing/RoutingPortNames.cs b/src/PepperDash.Essentials.Core/Routing/RoutingPortNames.cs
index 00e85191..7029443b 100644
--- a/src/PepperDash.Essentials.Core/Routing/RoutingPortNames.cs
+++ b/src/PepperDash.Essentials.Core/Routing/RoutingPortNames.cs
@@ -199,5 +199,45 @@ namespace PepperDash.Essentials.Core.Routing
/// MediaPlayer
///
public const string MediaPlayer = "mediaPlayer";
- }
+ ///
+ /// UsbCIn
+ ///
+ public const string UsbCIn = "usbCIn";
+ ///
+ /// UsbCIn1
+ ///
+ public const string UsbCIn1 = "usbCIn1";
+ ///
+ /// UsbCIn2
+ ///
+ public const string UsbCIn2 = "usbCIn2";
+ ///
+ /// UsbCIn3
+ ///
+ public const string UsbCIn3 = "usbCIn3";
+ ///
+ /// UsbCOut
+ ///
+ public const string UsbCOut = "usbCOut";
+ ///
+ /// UsbCOut1
+ ///
+ public const string UsbCOut1 = "usbCOut1";
+ ///
+ /// UsbCOut2
+ ///
+ public const string UsbCOut2 = "usbCOut2";
+ ///
+ /// UsbCOut3
+ ///
+ public const string UsbCOut3 = "usbCOut3";
+ ///
+ /// HdBaseTIn
+ ///
+ public const string HdBaseTIn = "hdBaseTIn";
+ ///
+ /// HdBaseTOut
+ ///
+ public const string HdBaseTOut = "hdBaseTOut";
+ }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Touchpanels/Mpc3Touchpanel.cs b/src/PepperDash.Essentials.Core/Touchpanels/Mpc3Touchpanel.cs
index c9a5f605..2f6074dd 100644
--- a/src/PepperDash.Essentials.Core/Touchpanels/Mpc3Touchpanel.cs
+++ b/src/PepperDash.Essentials.Core/Touchpanels/Mpc3Touchpanel.cs
@@ -1,144 +1,352 @@
using System;
using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Crestron.SimplSharp;
+using System.Globalization;
using Crestron.SimplSharpPro;
-
+using Newtonsoft.Json;
using PepperDash.Core;
-using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Core.Touchpanels
{
- ///
- /// A wrapper class for the touchpanel portion of an MPC3 class process to allow for configurable
- /// behavior of the keybad buttons
- ///
- public class Mpc3TouchpanelController : Device
- {
- MPC3Basic _Touchpanel;
+ ///
+ /// A wrapper class for the touchpanel portion of an MPC3 class process to allow for configurable
+ /// behavior of the keybad buttons
+ ///
+ public class Mpc3TouchpanelController : Device
+ {
+ readonly MPC3Basic _touchpanel;
- Dictionary _Buttons;
+ readonly Dictionary _buttons;
- public Mpc3TouchpanelController(string key, string name, CrestronControlSystem processor, Dictionary buttons)
- : base(key, name)
- {
- _Touchpanel = processor.ControllerTouchScreenSlotDevice as MPC3Basic;
- _Buttons = buttons;
+ public Mpc3TouchpanelController(string key, string name, CrestronControlSystem processor, Dictionary buttons)
+ : base(key, name)
+ {
+ _touchpanel = processor.ControllerTouchScreenSlotDevice as MPC3Basic;
+ if (_touchpanel == null)
+ {
+ Debug.Console(1, this, "Failed to construct MPC3 Touchpanel Controller with key {0}, check configuration", key);
+ return;
+ }
- _Touchpanel.ButtonStateChange += new Crestron.SimplSharpPro.DeviceSupport.ButtonEventHandler(_Touchpanel_ButtonStateChange);
+ if (_touchpanel.Registerable)
+ {
+ var registrationResponse = _touchpanel.Register();
+ Debug.Console(0, this, "touchpanel registration response: {0}", registrationResponse);
+ }
- AddPostActivationAction(() =>
- {
- // Link up the button feedbacks to the specified BoolFeedbacks
- foreach (var button in _Buttons)
- {
- var feedbackConfig = button.Value.Feedback;
- var device = DeviceManager.GetDeviceForKey(feedbackConfig.DeviceKey) as Device;
- if (device != null)
- {
- var bKey = button.Key.ToLower();
+ _touchpanel.BaseEvent += _touchpanel_BaseEvent;
+ _touchpanel.ButtonStateChange += _touchpanel_ButtonStateChange;
+ _touchpanel.PanelStateChange += _touchpanel_PanelStateChange;
- var feedback = device.GetFeedbackProperty(feedbackConfig.FeedbackName);
+ _buttons = buttons;
+ if (_buttons == null)
+ {
+ Debug.Console(1, this,
+ "Button properties are null, failed to setup MPC3 Touch Controller, check configuration");
+ return;
+ }
- var bFeedback = feedback as BoolFeedback;
- var iFeedback = feedback as IntFeedback;
- if (bFeedback != null)
- {
+ AddPostActivationAction(() =>
+ {
+ foreach (var button in _buttons)
+ {
+ var buttonKey = button.Key.ToLower();
+ var buttonConfig = button.Value;
- if (bKey == "power")
- {
- bFeedback.LinkCrestronFeedback(_Touchpanel.FeedbackPower);
- continue;
- }
- else if (bKey == "mute")
- {
- bFeedback.LinkCrestronFeedback(_Touchpanel.FeedbackMute);
- continue;
- }
+ InitializeButton(buttonKey, buttonConfig);
+ InitializeButtonFeedback(buttonKey, buttonConfig);
+ }
+ });
+ }
- // Link to the Crestron Feedback corresponding to the button number
- bFeedback.LinkCrestronFeedback(_Touchpanel.Feedbacks[UInt16.Parse(button.Key)]);
- }
- else if (iFeedback != null)
- {
- if (bKey == "volumefeedback")
- {
- var volFeedback = feedback as IntFeedback;
- // TODO: Figure out how to subsribe to a volume IntFeedback and link it to the voluem
- volFeedback.LinkInputSig(_Touchpanel.VolumeBargraph);
- }
- }
- else
- {
- Debug.Console(1, this, "Unable to get BoolFeedback with name: {0} from device: {1}", feedbackConfig.FeedbackName, device.Key);
- }
- }
- else
- {
- Debug.Console(1, this, "Unable to get device with key: {0}", feedbackConfig.DeviceKey);
- }
- }
- });
- }
+ ///
+ /// Enables/disables buttons based on event type configuration
+ ///
+ ///
+ ///
+ public void InitializeButton(string key, KeypadButton config)
+ {
+ if (config == null)
+ {
+ Debug.Console(1, this, "Button '{0}' config is null, unable to initialize", key);
+ return;
+ }
- void _Touchpanel_ButtonStateChange(GenericBase device, Crestron.SimplSharpPro.DeviceSupport.ButtonEventArgs args)
- {
- Debug.Console(1, this, "Button {0} ({1}), {2}", args.Button.Number, args.Button.Name, args.NewButtonState);
- var type = args.NewButtonState.ToString();
+ int buttonNumber;
+ TryParseInt(key, out buttonNumber);
- if (_Buttons.ContainsKey(args.Button.Number.ToString()))
- {
- Press(args.Button.Number.ToString(), type);
- }
- else if(_Buttons.ContainsKey(args.Button.Name.ToString()))
- {
- Press(args.Button.Name.ToString(), type);
- }
- }
+ var buttonEventTypes = config.EventTypes;
+ BoolOutputSig enabledFb = null;
+ BoolOutputSig disabledFb = null;
- ///
- /// Runs the function associated with this button/type. One of the following strings:
- /// Pressed, Released, Tapped, DoubleTapped, Held, HeldReleased
- ///
- ///
- ///
- public void Press(string number, string type)
- {
- // TODO: In future, consider modifying this to generate actions at device activation time
- // to prevent the need to dynamically call the method via reflection on each button press
- if (!_Buttons.ContainsKey(number)) { return; }
- var but = _Buttons[number];
- if (but.EventTypes.ContainsKey(type))
- {
- foreach (var a in but.EventTypes[type]) { DeviceJsonApi.DoDeviceAction(a); }
- }
- }
+ switch (key)
+ {
+ case ("power"):
+ {
+ if (buttonEventTypes == null || buttonEventTypes.Keys == null)
+ _touchpanel.DisablePowerButton();
+ else
+ _touchpanel.EnablePowerButton();
- }
+ enabledFb = _touchpanel.PowerButtonEnabledFeedBack;
+ disabledFb = _touchpanel.PowerButtonDisabledFeedBack;
- ///
- /// Represents the configuration of a keybad buggon
- ///
- public class KeypadButton
- {
- public Dictionary EventTypes { get; set; }
- public KeypadButtonFeedback Feedback { get; set; }
+ break;
+ }
+ //case ("volumeup"):
+ // {
+ // break;
+ // }
+ //case ("volumedown"):
+ // {
+ // break;
+ // }
+ //case ("volumefeedback"):
+ // {
+ // break;
+ // }
+ case ("mute"):
+ {
+ if (buttonEventTypes == null || buttonEventTypes.Keys == null)
+ _touchpanel.DisableMuteButton();
+ else
+ _touchpanel.EnableMuteButton();
- public KeypadButton()
- {
- EventTypes = new Dictionary();
- Feedback = new KeypadButtonFeedback();
- }
- }
- ///
- ///
- ///
- public class KeypadButtonFeedback
- {
- public string DeviceKey { get; set; }
- public string FeedbackName { get; set; }
- }
+ enabledFb = _touchpanel.MuteButtonEnabledFeedBack;
+ disabledFb = _touchpanel.MuteButtonDisabledFeedBack;
+
+ break;
+ }
+ default:
+ {
+ if (buttonNumber == 0 || buttonNumber > 9)
+ break;
+
+ if (buttonEventTypes == null || buttonEventTypes.Keys == null)
+ _touchpanel.DisableNumericalButton((uint)buttonNumber);
+ else
+ _touchpanel.EnableNumericalButton((uint)buttonNumber);
+
+
+ if (_touchpanel.NumericalButtonEnabledFeedBack != null)
+ enabledFb = _touchpanel.NumericalButtonEnabledFeedBack[(uint)buttonNumber];
+
+ if (_touchpanel.NumericalButtonDisabledFeedBack != null)
+ disabledFb = _touchpanel.NumericalButtonDisabledFeedBack[(uint)buttonNumber];
+
+ break;
+ }
+ }
+
+ Debug.Console(0, this, "InitializeButton: key-'{0}' enabledFb-'{1}', disabledFb-'{2}'",
+ key, enabledFb ?? (object)"null", disabledFb ?? (object)"null");
+ }
+
+ ///
+ /// Links button feedback if configured
+ ///
+ ///
+ ///
+ public void InitializeButtonFeedback(string key, KeypadButton config)
+ {
+ //Debug.Console(1, this, "Initializing button '{0}' feedback...", key);
+
+ if (config == null)
+ {
+ Debug.Console(1, this, "Button '{0}' config is null, skipping.", key);
+ return;
+ }
+
+ int buttonNumber;
+ TryParseInt(key, out buttonNumber);
+
+ // Link up the button feedbacks to the specified device feedback
+ var buttonFeedback = config.Feedback;
+ if (buttonFeedback == null || string.IsNullOrEmpty(buttonFeedback.DeviceKey))
+ {
+ Debug.Console(1, this, "Button '{0}' feedback not configured, skipping.",
+ key);
+ return;
+ }
+
+ Feedback deviceFeedback;
+
+ try
+ {
+ var device = DeviceManager.GetDeviceForKey(buttonFeedback.DeviceKey) as Device;
+ if (device == null)
+ {
+ Debug.Console(1, this, "Button '{0}' feedback deviceKey '{1}' not found.",
+ key, buttonFeedback.DeviceKey);
+ return;
+ }
+
+ deviceFeedback = device.GetFeedbackProperty(buttonFeedback.FeedbackName);
+ if (deviceFeedback == null)
+ {
+ Debug.Console(1, this, "Button '{0}' feedbackName property '{1}' not found.",
+ key, buttonFeedback.FeedbackName);
+ return;
+ }
+
+ // TODO [ ] verify if this can replace the current method
+ //Debug.Console(0, this, "deviceFeedback.GetType().Name: '{0}'", deviceFeedback.GetType().Name);
+ //switch (feedback.GetType().Name.ToLower())
+ //{
+ // case("boolfeedback"):
+ // {
+ // break;
+ // }
+ // case("intfeedback"):
+ // {
+ // break;
+ // }
+ // case("stringfeedback"):
+ // {
+ // break;
+ // }
+ //}
+ }
+ catch (Exception ex)
+ {
+ Debug.Console(1, this, "InitializeButtonFeedback (button '{1}', deviceKey '{2}') Exception Message: {0}",
+ ex.Message, key, buttonFeedback.DeviceKey);
+ Debug.Console(2, this, "InitializeButtonFeedback (button '{1}', deviceKey '{2}') Exception StackTrace: {0}",
+ ex.StackTrace, key, buttonFeedback.DeviceKey);
+ if (ex.InnerException != null) Debug.Console(2, this, "InitializeButtonFeedback (button '{1}', deviceKey '{2}') InnerException: {0}",
+ ex.InnerException, key, buttonFeedback.DeviceKey);
+
+ return;
+ }
+
+ var boolFeedback = deviceFeedback as BoolFeedback;
+ var intFeedback = deviceFeedback as IntFeedback;
+
+ switch (key)
+ {
+ case ("power"):
+ {
+ if (boolFeedback != null) boolFeedback.LinkCrestronFeedback(_touchpanel.FeedbackPower);
+ break;
+ }
+ case ("volumeup"):
+ case ("volumedown"):
+ case ("volumefeedback"):
+ {
+ if (intFeedback != null)
+ {
+ var volumeFeedback = intFeedback;
+ volumeFeedback.LinkInputSig(_touchpanel.VolumeBargraph);
+ }
+ break;
+ }
+ case ("mute"):
+ {
+ if (boolFeedback != null) boolFeedback.LinkCrestronFeedback(_touchpanel.FeedbackMute);
+ break;
+ }
+ default:
+ {
+ if (boolFeedback != null) boolFeedback.LinkCrestronFeedback(_touchpanel.Feedbacks[(uint)buttonNumber]);
+ break;
+ }
+ }
+ }
+
+ ///
+ /// Try parse int helper method
+ ///
+ ///
+ ///
+ ///
+ public bool TryParseInt(string str, out int result)
+ {
+ try
+ {
+ result = int.Parse(str);
+ return true;
+ }
+ catch
+ {
+ result = 0;
+ return false;
+ }
+ }
+
+ private void _touchpanel_BaseEvent(GenericBase device, BaseEventArgs args)
+ {
+ Debug.Console(1, this, "BaseEvent: eventId-'{0}', index-'{1}'", args.EventId, args.Index);
+ }
+
+ private void _touchpanel_ButtonStateChange(GenericBase device, Crestron.SimplSharpPro.DeviceSupport.ButtonEventArgs args)
+ {
+ Debug.Console(1, this, "ButtonStateChange: buttonNumber-'{0}' buttonName-'{1}', buttonState-'{2}'", args.Button.Number, args.Button.Name, args.NewButtonState);
+ var type = args.NewButtonState.ToString();
+
+ if (_buttons.ContainsKey(args.Button.Number.ToString(CultureInfo.InvariantCulture)))
+ {
+ Press(args.Button.Number.ToString(CultureInfo.InvariantCulture), type);
+ }
+ else if (_buttons.ContainsKey(args.Button.Name.ToString()))
+ {
+ Press(args.Button.Name.ToString(), type);
+ }
+ }
+
+ private void _touchpanel_PanelStateChange(GenericBase device, BaseEventArgs args)
+ {
+ Debug.Console(1, this, "PanelStateChange: eventId-'{0}', index-'{1}'", args.EventId, args.Index);
+ }
+
+ ///
+ /// Runs the function associated with this button/type. One of the following strings:
+ /// Pressed, Released, Tapped, DoubleTapped, Held, HeldReleased
+ ///
+ ///
+ ///
+ public void Press(string buttonKey, string type)
+ {
+ Debug.Console(2, this, "Press: buttonKey-'{0}', type-'{1}'", buttonKey, type);
+
+ // TODO: In future, consider modifying this to generate actions at device activation time
+ // to prevent the need to dynamically call the method via reflection on each button press
+ if (!_buttons.ContainsKey(buttonKey)) return;
+
+ var button = _buttons[buttonKey];
+ if (!button.EventTypes.ContainsKey(type)) return;
+
+ foreach (var eventType in button.EventTypes[type]) DeviceJsonApi.DoDeviceAction(eventType);
+ }
+ }
+
+ ///
+ /// Represents the configuration of a keypad button
+ ///
+ public class KeypadButton
+ {
+ [JsonProperty("eventTypes")]
+ public Dictionary EventTypes { get; set; }
+
+ [JsonProperty("feedback")]
+ public KeypadButtonFeedback Feedback { get; set; }
+
+ public KeypadButton()
+ {
+ EventTypes = new Dictionary();
+ Feedback = new KeypadButtonFeedback();
+ }
+ }
+
+ ///
+ /// Represents the configuration of a keypad button feedback
+ ///
+ public class KeypadButtonFeedback
+ {
+ [JsonProperty("deviceKey")]
+ public string DeviceKey { get; set; }
+
+ [JsonProperty("feedbackName")]
+ public string FeedbackName { get; set; }
+ }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Web/EssemtialsWebApi.cs b/src/PepperDash.Essentials.Core/Web/EssemtialsWebApi.cs
index dc6b2efb..eb012378 100644
--- a/src/PepperDash.Essentials.Core/Web/EssemtialsWebApi.cs
+++ b/src/PepperDash.Essentials.Core/Web/EssemtialsWebApi.cs
@@ -3,9 +3,6 @@ using System.Collections.Generic;
using System.Linq;
using Crestron.SimplSharp;
using Crestron.SimplSharp.WebScripting;
-using Crestron.SimplSharpPro.Diagnostics;
-using Newtonsoft.Json;
-using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Core.Web;
using PepperDash.Essentials.Core.Web.RequestHandlers;
@@ -20,13 +17,13 @@ namespace PepperDash.Essentials.Core.Web
/// http(s)://{ipaddress}/cws/{basePath}
/// http(s)://{ipaddress}/VirtualControl/Rooms/{roomId}/cws/{basePath}
///
- private readonly string _defaultBasePath =
- CrestronEnvironment.DevicePlatform == eDevicePlatform.Appliance ? string.Format("/app{0:00}/api", InitialParametersClass.ApplicationNumber) : "/api";
+ private readonly string _defaultBasePath = CrestronEnvironment.DevicePlatform == eDevicePlatform.Appliance
+ ? string.Format("/app{0:00}/api", InitialParametersClass.ApplicationNumber)
+ : "/api";
- // TODO [ ] Reset debug levels to proper value Trace = 0, Info = 1, Verbose = 2
private const int DebugTrace = 0;
- private const int DebugInfo = 0;
- private const int DebugVerbose = 0;
+ private const int DebugInfo = 1;
+ private const int DebugVerbose = 2;
///
/// CWS base path
@@ -98,11 +95,6 @@ namespace PepperDash.Essentials.Core.Web
Name = "DevProps",
RouteHandler = new DevPropsRequestHandler()
},
- //new HttpCwsRoute("devprops/{key}")
- //{
- // Name = "DevProps",
- // RouteHandler = new DevPropsRequestHandler()
- //},
new HttpCwsRoute("devjson")
{
Name = "DevJson",
@@ -113,11 +105,6 @@ namespace PepperDash.Essentials.Core.Web
Name = "SetDeviceStreamDebug",
RouteHandler = new SetDeviceStreamDebugRequestHandler()
},
- //new HttpCwsRoute("setdevicestreamdebug/{deviceKey}/{state}")
- //{
- // Name = "SetDeviceStreamDebug",
- // RouteHandler = new SetDeviceStreamDebugRequestHandler()
- //},
new HttpCwsRoute("disableallstreamdebug")
{
Name = "DisableAllStreamDebug",
@@ -173,12 +160,7 @@ namespace PepperDash.Essentials.Core.Web
if (CrestronEnvironment.DevicePlatform == eDevicePlatform.Appliance)
{
/*
- RMC4>
WEBSERVER [ON | OFF | TIMEOUT | MAXSESSIONSPERUSER ]
- WEBSERVER [TIMEOUT] will display current session timeout value
- WEBSERVER MAXSESSIONSPERUSER will display current max web sessions per user
- WEBSERVER ALLOWSHAREDSESSION will display whether 'samesite = none' would be set on cookies
- No parameter - displays current setting
*/
var response = string.Empty;
CrestronConsole.SendControlSystemCommand("webserver", ref response);
diff --git a/src/PepperDash.Essentials.Core/Web/RequestHandlers/AppDebugRequestHandler.cs b/src/PepperDash.Essentials.Core/Web/RequestHandlers/AppDebugRequestHandler.cs
index 91f45927..46a0f980 100644
--- a/src/PepperDash.Essentials.Core/Web/RequestHandlers/AppDebugRequestHandler.cs
+++ b/src/PepperDash.Essentials.Core/Web/RequestHandlers/AppDebugRequestHandler.cs
@@ -1,6 +1,4 @@
-using System;
-using System.Text;
-using Crestron.SimplSharp.WebScripting;
+using Crestron.SimplSharp.WebScripting;
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Core.Web.RequestHandlers;
@@ -10,25 +8,14 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers
public class AppDebugRequestHandler : WebApiBaseRequestHandler
{
///
- /// Handles CONNECT method requests
+ /// Constructor
///
- ///
- protected override void HandleConnect(HttpCwsContext context)
+ ///
+ /// base(true) enables CORS support by default
+ ///
+ public AppDebugRequestHandler()
+ : base(true)
{
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles DELETE method requests
- ///
- ///
- protected override void HandleDelete(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
}
///
@@ -37,7 +24,7 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers
///
protected override void HandleGet(HttpCwsContext context)
{
- var appDebug = new AppDebug {Level = Debug.Level};
+ var appDebug = new AppDebug { Level = Debug.Level };
var body = JsonConvert.SerializeObject(appDebug, Formatting.Indented);
@@ -46,40 +33,7 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers
context.Response.Write(body, false);
context.Response.End();
}
-
- ///
- /// Handles HEAD method requests
- ///
- ///
- protected override void HandleHead(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles OPTIONS method requests
- ///
- ///
- protected override void HandleOptions(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles PATCH method requests
- ///
- ///
- protected override void HandlePatch(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
+
///
/// Handles POST method requests
///
@@ -107,7 +61,7 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers
var appDebug = new AppDebug();
var requestBody = JsonConvert.DeserializeAnonymousType(data, appDebug);
-
+
Debug.SetDebugLevel(requestBody.Level);
appDebug.Level = Debug.Level;
@@ -118,33 +72,11 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers
context.Response.Write(responseBody, false);
context.Response.End();
}
-
- ///
- /// Handles PUT method requests
- ///
- ///
- protected override void HandlePut(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles TRACE method requests
- ///
- ///
- protected override void HandleTrace(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
}
public class AppDebug
{
[JsonProperty("level", NullValueHandling = NullValueHandling.Ignore)]
- public int Level { get; set; }
+ public int Level { get; set; }
}
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Web/RequestHandlers/DefaultRequestHandler.cs b/src/PepperDash.Essentials.Core/Web/RequestHandlers/DefaultRequestHandler.cs
index 1186dc0c..3320de7e 100644
--- a/src/PepperDash.Essentials.Core/Web/RequestHandlers/DefaultRequestHandler.cs
+++ b/src/PepperDash.Essentials.Core/Web/RequestHandlers/DefaultRequestHandler.cs
@@ -5,6 +5,17 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers
{
public class DefaultRequestHandler : WebApiBaseRequestHandler
{
+ ///
+ /// Constructor
+ ///
+ ///
+ /// base(true) enables CORS support by default
+ ///
+ public DefaultRequestHandler()
+ : base(true)
+ {
+ }
+
///
/// Handles CONNECT method requests
///
diff --git a/src/PepperDash.Essentials.Core/Web/RequestHandlers/DevJsonRequestHandler.cs b/src/PepperDash.Essentials.Core/Web/RequestHandlers/DevJsonRequestHandler.cs
index ff3045b5..5c4f33a2 100644
--- a/src/PepperDash.Essentials.Core/Web/RequestHandlers/DevJsonRequestHandler.cs
+++ b/src/PepperDash.Essentials.Core/Web/RequestHandlers/DevJsonRequestHandler.cs
@@ -1,6 +1,6 @@
using System;
-using System.Text;
using Crestron.SimplSharp.WebScripting;
+using PepperDash.Core;
using PepperDash.Core.Web.RequestHandlers;
namespace PepperDash.Essentials.Core.Web.RequestHandlers
@@ -8,69 +8,14 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers
public class DevJsonRequestHandler : WebApiBaseRequestHandler
{
///
- /// Handles CONNECT method requests
+ /// Constructor
///
- ///
- protected override void HandleConnect(HttpCwsContext context)
+ ///
+ /// base(true) enables CORS support by default
+ ///
+ public DevJsonRequestHandler()
+ : base(true)
{
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles DELETE method requests
- ///
- ///
- protected override void HandleDelete(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles GET method requests
- ///
- ///
- protected override void HandleGet(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles HEAD method requests
- ///
- ///
- protected override void HandleHead(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles OPTIONS method requests
- ///
- ///
- protected override void HandleOptions(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles PATCH method requests
- ///
- ///
- protected override void HandlePatch(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
}
///
@@ -108,32 +53,14 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers
}
catch (Exception ex)
{
+ Debug.Console(1, "Exception Message: {0}", ex.Message);
+ Debug.Console(2, "Exception Stack Trace: {0}", ex.StackTrace);
+ if(ex.InnerException != null) Debug.Console(2, "Exception Inner: {0}", ex.InnerException);
+
context.Response.StatusCode = 400;
context.Response.StatusDescription = "Bad Request";
context.Response.End();
}
}
-
- ///
- /// Handles PUT method requests
- ///
- ///
- protected override void HandlePut(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles TRACE method requests
- ///
- ///
- protected override void HandleTrace(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
}
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Web/RequestHandlers/DevListRequestHandler.cs b/src/PepperDash.Essentials.Core/Web/RequestHandlers/DevListRequestHandler.cs
index 1a548f29..e9df4347 100644
--- a/src/PepperDash.Essentials.Core/Web/RequestHandlers/DevListRequestHandler.cs
+++ b/src/PepperDash.Essentials.Core/Web/RequestHandlers/DevListRequestHandler.cs
@@ -8,25 +8,14 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers
public class DevListRequestHandler : WebApiBaseRequestHandler
{
///
- /// Handles CONNECT method requests
+ /// Constructor
///
- ///
- protected override void HandleConnect(HttpCwsContext context)
+ ///
+ /// base(true) enables CORS support by default
+ ///
+ public DevListRequestHandler()
+ : base(true)
{
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles DELETE method requests
- ///
- ///
- protected override void HandleDelete(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
}
///
@@ -58,71 +47,5 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers
context.Response.Write(js, false);
context.Response.End();
}
-
- ///
- /// Handles HEAD method requests
- ///
- ///
- protected override void HandleHead(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles OPTIONS method requests
- ///
- ///
- protected override void HandleOptions(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles PATCH method requests
- ///
- ///
- protected override void HandlePatch(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles POST method requests
- ///
- ///
- protected override void HandlePost(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles PUT method requests
- ///
- ///
- protected override void HandlePut(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles TRACE method requests
- ///
- ///
- protected override void HandleTrace(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
}
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Web/RequestHandlers/DevPropsRequestHandler.cs b/src/PepperDash.Essentials.Core/Web/RequestHandlers/DevPropsRequestHandler.cs
index d7334591..25fadbce 100644
--- a/src/PepperDash.Essentials.Core/Web/RequestHandlers/DevPropsRequestHandler.cs
+++ b/src/PepperDash.Essentials.Core/Web/RequestHandlers/DevPropsRequestHandler.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Text;
+using System.Text;
using Crestron.SimplSharp.WebScripting;
using Newtonsoft.Json;
using PepperDash.Core.Web.RequestHandlers;
@@ -9,69 +8,14 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers
public class DevPropsRequestHandler : WebApiBaseRequestHandler
{
///
- /// Handles CONNECT method requests
+ /// Constructor
///
- ///
- protected override void HandleConnect(HttpCwsContext context)
+ ///
+ /// base(true) enables CORS support by default
+ ///
+ public DevPropsRequestHandler()
+ : base(true)
{
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles DELETE method requests
- ///
- ///
- protected override void HandleDelete(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles GET method requests
- ///
- ///
- protected override void HandleGet(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles HEAD method requests
- ///
- ///
- protected override void HandleHead(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles OPTIONS method requests
- ///
- ///
- protected override void HandleOptions(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles PATCH method requests
- ///
- ///
- protected override void HandlePatch(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
}
///
@@ -128,27 +72,5 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers
context.Response.Write(deviceProps, false);
context.Response.End();
}
-
- ///
- /// Handles PUT method requests
- ///
- ///
- protected override void HandlePut(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles TRACE method requests
- ///
- ///
- protected override void HandleTrace(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
}
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Web/RequestHandlers/DisableAllStreamDebugRequestHandler.cs b/src/PepperDash.Essentials.Core/Web/RequestHandlers/DisableAllStreamDebugRequestHandler.cs
index 41dc4974..0e682d6c 100644
--- a/src/PepperDash.Essentials.Core/Web/RequestHandlers/DisableAllStreamDebugRequestHandler.cs
+++ b/src/PepperDash.Essentials.Core/Web/RequestHandlers/DisableAllStreamDebugRequestHandler.cs
@@ -6,69 +6,14 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers
public class DisableAllStreamDebugRequestHandler : WebApiBaseRequestHandler
{
///
- /// Handles CONNECT method requests
+ /// Constructor
///
- ///
- protected override void HandleConnect(HttpCwsContext context)
+ ///
+ /// base(true) enables CORS support by default
+ ///
+ public DisableAllStreamDebugRequestHandler()
+ : base(true)
{
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles DELETE method requests
- ///
- ///
- protected override void HandleDelete(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles GET method requests
- ///
- ///
- protected override void HandleGet(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles HEAD method requests
- ///
- ///
- protected override void HandleHead(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles OPTIONS method requests
- ///
- ///
- protected override void HandleOptions(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles PATCH method requests
- ///
- ///
- protected override void HandlePatch(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
}
///
@@ -83,27 +28,5 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers
context.Response.StatusDescription = "OK";
context.Response.End();
}
-
- ///
- /// Handles PUT method requests
- ///
- ///
- protected override void HandlePut(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles TRACE method requests
- ///
- ///
- protected override void HandleTrace(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
}
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Web/RequestHandlers/GetFeedbacksForDeviceRequestHandler.cs b/src/PepperDash.Essentials.Core/Web/RequestHandlers/GetFeedbacksForDeviceRequestHandler.cs
index 1055dddd..5dd5495c 100644
--- a/src/PepperDash.Essentials.Core/Web/RequestHandlers/GetFeedbacksForDeviceRequestHandler.cs
+++ b/src/PepperDash.Essentials.Core/Web/RequestHandlers/GetFeedbacksForDeviceRequestHandler.cs
@@ -8,25 +8,14 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers
public class GetFeedbacksForDeviceRequestHandler : WebApiBaseRequestHandler
{
///
- /// Handles CONNECT method requests
+ /// Constructor
///
- ///
- protected override void HandleConnect(HttpCwsContext context)
+ ///
+ /// base(true) enables CORS support by default
+ ///
+ public GetFeedbacksForDeviceRequestHandler()
+ : base(true)
{
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles DELETE method requests
- ///
- ///
- protected override void HandleDelete(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
}
///
@@ -109,71 +98,5 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers
context.Response.Write(js, false);
context.Response.End();
}
-
- ///
- /// Handles HEAD method requests
- ///
- ///
- protected override void HandleHead(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles OPTIONS method requests
- ///
- ///
- protected override void HandleOptions(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles PATCH method requests
- ///
- ///
- protected override void HandlePatch(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles POST method requests
- ///
- ///
- protected override void HandlePost(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles PUT method requests
- ///
- ///
- protected override void HandlePut(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles TRACE method requests
- ///
- ///
- protected override void HandleTrace(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
}
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Web/RequestHandlers/GetJoinMapForBridgeKeyRequestHandler.cs b/src/PepperDash.Essentials.Core/Web/RequestHandlers/GetJoinMapForBridgeKeyRequestHandler.cs
index f4ec3975..f2362f4b 100644
--- a/src/PepperDash.Essentials.Core/Web/RequestHandlers/GetJoinMapForBridgeKeyRequestHandler.cs
+++ b/src/PepperDash.Essentials.Core/Web/RequestHandlers/GetJoinMapForBridgeKeyRequestHandler.cs
@@ -9,25 +9,14 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers
public class GetJoinMapForBridgeKeyRequestHandler : WebApiBaseRequestHandler
{
///
- /// Handles CONNECT method requests
+ /// Constructor
///
- ///
- protected override void HandleConnect(HttpCwsContext context)
+ ///
+ /// base(true) enables CORS support by default
+ ///
+ public GetJoinMapForBridgeKeyRequestHandler()
+ : base(true)
{
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles DELETE method requests
- ///
- ///
- protected override void HandleDelete(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
}
///
@@ -84,74 +73,6 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers
context.Response.ContentEncoding = System.Text.Encoding.UTF8;
context.Response.Write(js, false);
context.Response.End();
- }
-
- ///
- /// Handles HEAD method requests
- ///
- ///
- protected override void HandleHead(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles OPTIONS method requests
- ///
- ///
- protected override void HandleOptions(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles PATCH method requests
- ///
- ///
- protected override void HandlePatch(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles POST method requests
- ///
- ///
- protected override void HandlePost(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles PUT method requests
- ///
- ///
- protected override void HandlePut(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles TRACE method requests
- ///
- ///
- protected override void HandleTrace(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
-
+ }
}
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Web/RequestHandlers/GetJoinMapForDeviceKeyRequestHandler.cs b/src/PepperDash.Essentials.Core/Web/RequestHandlers/GetJoinMapForDeviceKeyRequestHandler.cs
index fe3fc999..6c669189 100644
--- a/src/PepperDash.Essentials.Core/Web/RequestHandlers/GetJoinMapForDeviceKeyRequestHandler.cs
+++ b/src/PepperDash.Essentials.Core/Web/RequestHandlers/GetJoinMapForDeviceKeyRequestHandler.cs
@@ -8,25 +8,14 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers
public class GetJoinMapForDeviceKeyRequestHandler : WebApiBaseRequestHandler
{
///
- /// Handles CONNECT method requests
+ /// Constructor
///
- ///
- protected override void HandleConnect(HttpCwsContext context)
+ ///
+ /// base(true) enables CORS support by default
+ ///
+ public GetJoinMapForDeviceKeyRequestHandler()
+ : base(true)
{
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles DELETE method requests
- ///
- ///
- protected override void HandleDelete(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
}
///
@@ -102,71 +91,5 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers
context.Response.Write(js, false);
context.Response.End();
}
-
- ///
- /// Handles HEAD method requests
- ///
- ///
- protected override void HandleHead(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles OPTIONS method requests
- ///
- ///
- protected override void HandleOptions(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles PATCH method requests
- ///
- ///
- protected override void HandlePatch(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles POST method requests
- ///
- ///
- protected override void HandlePost(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles PUT method requests
- ///
- ///
- protected override void HandlePut(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles TRACE method requests
- ///
- ///
- protected override void HandleTrace(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
}
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Web/RequestHandlers/GetTypesByFilterRequestHandler.cs b/src/PepperDash.Essentials.Core/Web/RequestHandlers/GetTypesByFilterRequestHandler.cs
index 6636d914..105d2419 100644
--- a/src/PepperDash.Essentials.Core/Web/RequestHandlers/GetTypesByFilterRequestHandler.cs
+++ b/src/PepperDash.Essentials.Core/Web/RequestHandlers/GetTypesByFilterRequestHandler.cs
@@ -1,6 +1,8 @@
-using System.Linq;
+extern alias Full
+
+using System.Linq;
using Crestron.SimplSharp.WebScripting;
-using Newtonsoft.Json;
+using Full.Newtonsoft.Json;
using PepperDash.Core.Web.RequestHandlers;
namespace PepperDash.Essentials.Core.Web.RequestHandlers
@@ -8,25 +10,14 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers
public class GetTypesByFilterRequestHandler : WebApiBaseRequestHandler
{
///
- /// Handles CONNECT method requests
+ /// Constructor
///
- ///
- protected override void HandleConnect(HttpCwsContext context)
+ ///
+ /// base(true) enables CORS support by default
+ ///
+ public GetTypesByFilterRequestHandler()
+ : base(true)
{
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles DELETE method requests
- ///
- ///
- protected override void HandleDelete(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
}
///
@@ -75,71 +66,5 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers
context.Response.Write(js, false);
context.Response.End();
}
-
- ///
- /// Handles HEAD method requests
- ///
- ///
- protected override void HandleHead(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles OPTIONS method requests
- ///
- ///
- protected override void HandleOptions(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles PATCH method requests
- ///
- ///
- protected override void HandlePatch(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles POST method requests
- ///
- ///
- protected override void HandlePost(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles PUT method requests
- ///
- ///
- protected override void HandlePut(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles TRACE method requests
- ///
- ///
- protected override void HandleTrace(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
}
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Web/RequestHandlers/GetTypesRequestHandler.cs b/src/PepperDash.Essentials.Core/Web/RequestHandlers/GetTypesRequestHandler.cs
index 094d22f4..a72fe7e4 100644
--- a/src/PepperDash.Essentials.Core/Web/RequestHandlers/GetTypesRequestHandler.cs
+++ b/src/PepperDash.Essentials.Core/Web/RequestHandlers/GetTypesRequestHandler.cs
@@ -1,6 +1,8 @@
-using System.Linq;
+extern alias Full
+
+using System.Linq;
using Crestron.SimplSharp.WebScripting;
-using Newtonsoft.Json;
+using Full.Newtonsoft.Json;
using PepperDash.Core.Web.RequestHandlers;
namespace PepperDash.Essentials.Core.Web.RequestHandlers
@@ -8,25 +10,14 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers
public class GetTypesRequestHandler : WebApiBaseRequestHandler
{
///
- /// Handles CONNECT method requests
+ /// Constructor
///
- ///
- protected override void HandleConnect(HttpCwsContext context)
+ ///
+ /// base(true) enables CORS support by default
+ ///
+ public GetTypesRequestHandler()
+ : base(true)
{
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles DELETE method requests
- ///
- ///
- protected override void HandleDelete(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
}
///
@@ -65,71 +56,5 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers
context.Response.Write(js, false);
context.Response.End();
}
-
- ///
- /// Handles HEAD method requests
- ///
- ///
- protected override void HandleHead(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles OPTIONS method requests
- ///
- ///
- protected override void HandleOptions(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles PATCH method requests
- ///
- ///
- protected override void HandlePatch(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles POST method requests
- ///
- ///
- protected override void HandlePost(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles PUT method requests
- ///
- ///
- protected override void HandlePut(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles TRACE method requests
- ///
- ///
- protected override void HandleTrace(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
}
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Web/RequestHandlers/ReportVersionsRequestHandler.cs b/src/PepperDash.Essentials.Core/Web/RequestHandlers/ReportVersionsRequestHandler.cs
index 321c5bfc..925a95f0 100644
--- a/src/PepperDash.Essentials.Core/Web/RequestHandlers/ReportVersionsRequestHandler.cs
+++ b/src/PepperDash.Essentials.Core/Web/RequestHandlers/ReportVersionsRequestHandler.cs
@@ -1,6 +1,8 @@
-using System.Linq;
+extern alias Full
+
+using System.Linq;
using Crestron.SimplSharp.WebScripting;
-using Newtonsoft.Json;
+using Full.Newtonsoft.Json;
using PepperDash.Core.Web.RequestHandlers;
namespace PepperDash.Essentials.Core.Web.RequestHandlers
@@ -8,25 +10,14 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers
public class ReportVersionsRequestHandler : WebApiBaseRequestHandler
{
///
- /// Handles CONNECT method requests
+ /// Constructor
///
- ///
- protected override void HandleConnect(HttpCwsContext context)
+ ///
+ /// base(true) enables CORS support by default
+ ///
+ public ReportVersionsRequestHandler()
+ : base(true)
{
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles DELETE method requests
- ///
- ///
- protected override void HandleDelete(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
}
///
@@ -56,71 +47,5 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers
context.Response.Write(js, false);
context.Response.End();
}
-
- ///
- /// Handles HEAD method requests
- ///
- ///
- protected override void HandleHead(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles OPTIONS method requests
- ///
- ///
- protected override void HandleOptions(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles PATCH method requests
- ///
- ///
- protected override void HandlePatch(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles POST method requests
- ///
- ///
- protected override void HandlePost(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles PUT method requests
- ///
- ///
- protected override void HandlePut(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles TRACE method requests
- ///
- ///
- protected override void HandleTrace(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
}
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Web/RequestHandlers/ShowConfigRequestHandler.cs b/src/PepperDash.Essentials.Core/Web/RequestHandlers/ShowConfigRequestHandler.cs
index 16c05abf..b017627d 100644
--- a/src/PepperDash.Essentials.Core/Web/RequestHandlers/ShowConfigRequestHandler.cs
+++ b/src/PepperDash.Essentials.Core/Web/RequestHandlers/ShowConfigRequestHandler.cs
@@ -1,5 +1,7 @@
-using Crestron.SimplSharp.WebScripting;
-using Newtonsoft.Json;
+extern alias Full
+
+using Crestron.SimplSharp.WebScripting;
+using Full.Newtonsoft.Json;
using PepperDash.Core.Web.RequestHandlers;
using PepperDash.Essentials.Core.Config;
@@ -8,25 +10,14 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers
public class ShowConfigRequestHandler : WebApiBaseRequestHandler
{
///
- /// Handles CONNECT method requests
+ /// Constructor
///
- ///
- protected override void HandleConnect(HttpCwsContext context)
+ ///
+ /// base(true) enables CORS support by default
+ ///
+ public ShowConfigRequestHandler()
+ : base(true)
{
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles DELETE method requests
- ///
- ///
- protected override void HandleDelete(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
}
///
@@ -44,71 +35,5 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers
context.Response.Write(config, false);
context.Response.End();
}
-
- ///
- /// Handles HEAD method requests
- ///
- ///
- protected override void HandleHead(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles OPTIONS method requests
- ///
- ///
- protected override void HandleOptions(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles PATCH method requests
- ///
- ///
- protected override void HandlePatch(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles POST method requests
- ///
- ///
- protected override void HandlePost(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles PUT method requests
- ///
- ///
- protected override void HandlePut(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
-
- ///
- /// Handles TRACE method requests
- ///
- ///
- protected override void HandleTrace(HttpCwsContext context)
- {
- context.Response.StatusCode = 501;
- context.Response.StatusDescription = "Not Implemented";
- context.Response.End();
- }
}
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.DM/AirMedia/AirMediaController.cs b/src/PepperDash.Essentials.DM/AirMedia/AirMediaController.cs
deleted file mode 100644
index 80f8e64d..00000000
--- a/src/PepperDash.Essentials.DM/AirMedia/AirMediaController.cs
+++ /dev/null
@@ -1,368 +0,0 @@
-extern alias Full;
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Crestron.SimplSharp;
-using Crestron.SimplSharpPro;
-using Crestron.DeviceSupport.Support;
-using Crestron.SimplSharpPro.DeviceSupport;
-using Crestron.SimplSharpPro.DM;
-using Crestron.SimplSharpPro.DM.AirMedia;
-using Full.Newtonsoft.Json;
-using Full.Newtonsoft.Json.Linq;
-using PepperDash.Core;
-using PepperDash.Essentials.Core;
-using PepperDash.Essentials.Core.Bridges;
-using PepperDash.Essentials.Core.Config;
-
-namespace PepperDash.Essentials.DM.AirMedia
-{
- [Description("Wrapper class for an AM-200 or AM-300")]
- public class AirMediaController : CrestronGenericBridgeableBaseDevice, IRoutingNumericWithFeedback, IIROutputPorts, IComPorts
- {
- public AmX00 AirMedia { get; private set; }
-
- public DeviceConfig DeviceConfig { get; private set; }
-
- AirMediaPropertiesConfig PropertiesConfig;
-
- public RoutingPortCollection InputPorts { get; private set; }
-
- public RoutingPortCollection OutputPorts { get; private set; }
-
-
- //IroutingNumericEvent
- public event EventHandler NumericSwitchChange;
-
- public BoolFeedback IsInSessionFeedback { get; private set; }
- public IntFeedback ErrorFeedback { get; private set; }
- public IntFeedback NumberOfUsersConnectedFeedback { get; set; }
- public IntFeedback LoginCodeFeedback { get; set; }
- public StringFeedback ConnectionAddressFeedback { get; set; }
- public StringFeedback HostnameFeedback { get; set; }
- public IntFeedback VideoOutFeedback { get; private set; }
- public BoolFeedback HdmiVideoSyncDetectedFeedback { get; private set; }
- public StringFeedback SerialNumberFeedback { get; private set; }
- public BoolFeedback AutomaticInputRoutingEnabledFeedback { get; private set; }
-
- public AirMediaController(string key, string name, AmX00 device, DeviceConfig dc, AirMediaPropertiesConfig props)
- : base(key, name, device)
- {
-
- AirMedia = device;
-
- DeviceConfig = dc;
-
- PropertiesConfig = props;
-
- InputPorts = new RoutingPortCollection();
- OutputPorts = new RoutingPortCollection();
-
- InputPorts.Add(new RoutingInputPort(DmPortName.Osd, eRoutingSignalType.AudioVideo,
- eRoutingPortConnectionType.None, new Action(SelectPinPointUxLandingPage), this)
- {
- FeedbackMatchObject = 0
- });
-
- InputPorts.Add(new RoutingInputPort(DmPortName.AirMediaIn, eRoutingSignalType.AudioVideo,
- eRoutingPortConnectionType.Streaming, new Action(SelectAirMedia), this)
- {
- FeedbackMatchObject = 1
- });
-
- InputPorts.Add(new RoutingInputPort(DmPortName.HdmiIn, eRoutingSignalType.AudioVideo,
- eRoutingPortConnectionType.Hdmi, new Action(SelectHdmiIn), this)
- {
- FeedbackMatchObject = 2
- });
-
- InputPorts.Add(new RoutingInputPort(DmPortName.AirBoardIn, eRoutingSignalType.AudioVideo,
- eRoutingPortConnectionType.None, new Action(SelectAirboardIn), this)
- {
- FeedbackMatchObject = 4
- });
-
- if (AirMedia is Am300)
- {
- InputPorts.Add(new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.AudioVideo,
- eRoutingPortConnectionType.DmCat, new Action(SelectDmIn), this)
- {
- FeedbackMatchObject = 3
- });
- }
-
- OutputPorts.Add(new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.AudioVideo,
- eRoutingPortConnectionType.Hdmi, null, this));
-
- AirMedia.AirMedia.AirMediaChange += new Crestron.SimplSharpPro.DeviceSupport.GenericEventHandler(AirMedia_AirMediaChange);
-
- IsInSessionFeedback = new BoolFeedback(new Func(() => AirMedia.AirMedia.StatusFeedback.UShortValue == 0));
- ErrorFeedback = new IntFeedback(new Func(() => AirMedia.AirMedia.ErrorFeedback.UShortValue));
- NumberOfUsersConnectedFeedback = new IntFeedback(new Func(() => AirMedia.AirMedia.NumberOfUsersConnectedFeedback.UShortValue));
- LoginCodeFeedback = new IntFeedback(new Func(() => AirMedia.AirMedia.LoginCodeFeedback.UShortValue));
- ConnectionAddressFeedback = new StringFeedback(new Func(() => AirMedia.AirMedia.ConnectionAddressFeedback.StringValue));
- HostnameFeedback = new StringFeedback(new Func(() => AirMedia.AirMedia.HostNameFeedback.StringValue));
-
- // TODO: Figure out if we can actually get the TSID/Serial
- SerialNumberFeedback = new StringFeedback(new Func(() => "unknown"));
-
- AirMedia.DisplayControl.DisplayControlChange += new Crestron.SimplSharpPro.DeviceSupport.GenericEventHandler(DisplayControl_DisplayControlChange);
-
- VideoOutFeedback = new IntFeedback(new Func(() => Convert.ToInt16(AirMedia.DisplayControl.VideoOutFeedback)));
- AutomaticInputRoutingEnabledFeedback = new BoolFeedback(new Func(() => AirMedia.DisplayControl.EnableAutomaticRoutingFeedback.BoolValue));
-
- AirMedia.HdmiIn.StreamChange += new Crestron.SimplSharpPro.DeviceSupport.StreamEventHandler(HdmiIn_StreamChange);
-
- HdmiVideoSyncDetectedFeedback = new BoolFeedback(new Func(() => AirMedia.HdmiIn.SyncDetectedFeedback.BoolValue));
- }
-
- public override bool CustomActivate()
- {
- if (PropertiesConfig.AutoSwitchingEnabled)
- AirMedia.DisplayControl.EnableAutomaticRouting();
- else
- AirMedia.DisplayControl.DisableAutomaticRouting();
-
- return base.CustomActivate();
- }
-
- public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
- {
- var joinMap = new AirMediaControllerJoinMap(joinStart);
-
- var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
-
- if (!string.IsNullOrEmpty(joinMapSerialized))
- joinMap = JsonConvert.DeserializeObject(joinMapSerialized);
-
- if (bridge != null)
- {
- bridge.AddJoinMap(Key, joinMap);
- }
- else
- {
- Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
- }
-
- Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
- Debug.Console(0, "Linking to Airmedia: {0}", Name);
-
- trilist.StringInput[joinMap.Name.JoinNumber].StringValue = Name;
-
- var commMonitor = this as ICommunicationMonitor;
-
- commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]);
-
- IsInSessionFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsInSession.JoinNumber]);
- HdmiVideoSyncDetectedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.HdmiVideoSync.JoinNumber]);
-
- trilist.SetSigTrueAction(joinMap.AutomaticInputRoutingEnabled.JoinNumber, AirMedia.DisplayControl.EnableAutomaticRouting);
- trilist.SetSigFalseAction(joinMap.AutomaticInputRoutingEnabled.JoinNumber, AirMedia.DisplayControl.DisableAutomaticRouting);
- AutomaticInputRoutingEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.AutomaticInputRoutingEnabled.JoinNumber]);
-
- trilist.SetUShortSigAction(joinMap.VideoOut.JoinNumber, (u) => SelectVideoOut(u));
-
- VideoOutFeedback.LinkInputSig(trilist.UShortInput[joinMap.VideoOut.JoinNumber]);
- ErrorFeedback.LinkInputSig(trilist.UShortInput[joinMap.ErrorFB.JoinNumber]);
- NumberOfUsersConnectedFeedback.LinkInputSig(trilist.UShortInput[joinMap.NumberOfUsersConnectedFB.JoinNumber]);
-
- trilist.SetUShortSigAction(joinMap.LoginCode.JoinNumber, (u) => AirMedia.AirMedia.LoginCode.UShortValue = u);
- LoginCodeFeedback.LinkInputSig(trilist.UShortInput[joinMap.LoginCode.JoinNumber]);
-
- ConnectionAddressFeedback.LinkInputSig(trilist.StringInput[joinMap.ConnectionAddressFB.JoinNumber]);
- HostnameFeedback.LinkInputSig(trilist.StringInput[joinMap.HostnameFB.JoinNumber]);
- SerialNumberFeedback.LinkInputSig(trilist.StringInput[joinMap.SerialNumberFeedback.JoinNumber]);
- }
-
- ///
- /// Raise an event when the status of a switch object changes.
- ///
- /// Arguments defined as IKeyName sender, output, input, and eRoutingSignalType
- private void OnSwitchChange(RoutingNumericEventArgs e)
- {
- var newEvent = NumericSwitchChange;
- if (newEvent != null) newEvent(this, e);
- }
-
-
- void AirMedia_AirMediaChange(object sender, Crestron.SimplSharpPro.DeviceSupport.GenericEventArgs args)
- {
- if (args.EventId == AirMediaInputSlot.AirMediaStatusFeedbackEventId)
- IsInSessionFeedback.FireUpdate();
- else if (args.EventId == AirMediaInputSlot.AirMediaErrorFeedbackEventId)
- ErrorFeedback.FireUpdate();
- else if (args.EventId == AirMediaInputSlot.AirMediaNumberOfUserConnectedEventId)
- NumberOfUsersConnectedFeedback.FireUpdate();
- else if (args.EventId == AirMediaInputSlot.AirMediaLoginCodeEventId)
- LoginCodeFeedback.FireUpdate();
- else if (args.EventId == AirMediaInputSlot.AirMediaConnectionAddressFeedbackEventId)
- ConnectionAddressFeedback.FireUpdate();
- else if (args.EventId == AirMediaInputSlot.AirMediaHostNameFeedbackEventId)
- HostnameFeedback.FireUpdate();
- }
-
- void DisplayControl_DisplayControlChange(object sender, Crestron.SimplSharpPro.DeviceSupport.GenericEventArgs args)
- {
- if (args.EventId == AmX00.VideoOutFeedbackEventId)
- {
- VideoOutFeedback.FireUpdate();
-
- var localInputPort =
- InputPorts.FirstOrDefault(p => (int) p.FeedbackMatchObject == VideoOutFeedback.UShortValue);
-
- OnSwitchChange(new RoutingNumericEventArgs(1, VideoOutFeedback.UShortValue, OutputPorts.First(),
- localInputPort, eRoutingSignalType.AudioVideo));
- }
- else if (args.EventId == AmX00.EnableAutomaticRoutingFeedbackEventId)
- AutomaticInputRoutingEnabledFeedback.FireUpdate();
- }
-
- void HdmiIn_StreamChange(Stream stream, Crestron.SimplSharpPro.DeviceSupport.StreamEventArgs args)
- {
- if (args.EventId == DMInputEventIds.SourceSyncEventId)
- HdmiVideoSyncDetectedFeedback.FireUpdate();
- }
-
- ///
- /// Sets the VideoOut source ( 0 = PinpointUX, 1 = AirMedia, 2 = HDMI, 3 = DM, 4 = Airboard )
- ///
- /// source number
- public void SelectVideoOut(uint source)
- {
- AirMedia.DisplayControl.VideoOut = (AmX00DisplayControl.eAirMediaX00VideoSource)source;
- }
-
- ///
- /// Selects the PinPointUXLandingPage input
- ///
- public void SelectPinPointUxLandingPage()
- {
- AirMedia.DisplayControl.VideoOut = AmX00DisplayControl.eAirMediaX00VideoSource.PinPointUxLandingPage;
- }
-
- ///
- /// Selects the AirMedia input
- ///
- public void SelectAirMedia()
- {
- AirMedia.DisplayControl.VideoOut = AmX00DisplayControl.eAirMediaX00VideoSource.AirMedia;
- }
-
- ///
- /// Selects the DM input
- ///
- public void SelectDmIn()
- {
- AirMedia.DisplayControl.VideoOut = AmX00DisplayControl.eAirMediaX00VideoSource.DM;
- }
-
- ///
- /// Selects the HDMI INput
- ///
- public void SelectHdmiIn()
- {
- AirMedia.DisplayControl.VideoOut = AmX00DisplayControl.eAirMediaX00VideoSource.HDMI;
- }
-
- public void SelectAirboardIn()
- {
- AirMedia.DisplayControl.VideoOut = AmX00DisplayControl.eAirMediaX00VideoSource.AirBoard;
- }
-
- ///
- /// Reboots the device
- ///
- public void RebootDevice()
- {
- AirMedia.AirMedia.DeviceReboot();
- }
-
- #region IIROutputPorts Members
-
- public CrestronCollection IROutputPorts
- {
- get { return AirMedia.IROutputPorts; }
- }
-
- public int NumberOfIROutputPorts
- {
- get { return AirMedia.NumberOfIROutputPorts; }
- }
-
-
-
- #endregion
-
-
-
- #region IComPorts Members
-
- public CrestronCollection ComPorts
- {
- get { return AirMedia.ComPorts; }
- }
-
- public int NumberOfComPorts
- {
- get { return AirMedia.NumberOfComPorts; }
- }
-
- #endregion
-
-
-
- #region IRoutingNumeric Members
-
- public void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType signalType)
- {
- if ((signalType & eRoutingSignalType.Video) != eRoutingSignalType.Video) return;
- if (!Enum.IsDefined(typeof (AmX00DisplayControl.eAirMediaX00VideoSource), input))
- {
- Debug.Console(2, this, "Invalid Video Source Index : {0}", input);
- return;
- }
- AirMedia.DisplayControl.VideoOut = (AmX00DisplayControl.eAirMediaX00VideoSource) input;
- }
-
- #endregion
-
- #region IRouting Members
-
- public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType)
- {
- Debug.Console(2, this, "Input Selector = {0}", inputSelector.ToString());
- var handler = inputSelector as Action;
- if (handler == null) return;
- handler();
- }
-
- #endregion
- }
-
- public class AirMediaControllerFactory : EssentialsDeviceFactory
- {
- public AirMediaControllerFactory()
- {
- TypeNames = new List() { "am200", "am300" };
- }
-
- public override EssentialsDevice BuildDevice(DeviceConfig dc)
- {
- var type = dc.Type.ToLower();
-
- Debug.Console(1, "Factory Attempting to create new AirMedia Device");
-
- var props = JsonConvert.DeserializeObject(dc.Properties.ToString());
- AmX00 amDevice = null;
- if (type == "am200")
- amDevice = new Crestron.SimplSharpPro.DM.AirMedia.Am200(props.Control.IpIdInt, Global.ControlSystem);
- else if (type == "am300")
- amDevice = new Crestron.SimplSharpPro.DM.AirMedia.Am300(props.Control.IpIdInt, Global.ControlSystem);
-
- return new AirMediaController(dc.Key, dc.Name, amDevice, dc, props);
-
- }
- }
-}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.DM/AirMedia/AirMediaPropertiesConfig.cs b/src/PepperDash.Essentials.DM/AirMedia/AirMediaPropertiesConfig.cs
deleted file mode 100644
index be46505b..00000000
--- a/src/PepperDash.Essentials.DM/AirMedia/AirMediaPropertiesConfig.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-extern alias Full;
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Crestron.SimplSharp;
-
-using PepperDash.Core;
-
-using Full.Newtonsoft.Json;
-
-namespace PepperDash.Essentials.DM.AirMedia
-{
- public class AirMediaPropertiesConfig
- {
- [JsonProperty("control")]
- public ControlPropertiesConfig Control { get; set; }
-
- [JsonProperty("autoSwitching")]
- public bool AutoSwitchingEnabled { get; set; }
- }
-}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.DM/Chassis/Config/Schema/DmChassisControllerPropertiesConfigSchema.json b/src/PepperDash.Essentials.DM/Chassis/Config/Schema/DmChassisControllerPropertiesConfigSchema.json
deleted file mode 100644
index 7769bdbc..00000000
--- a/src/PepperDash.Essentials.DM/Chassis/Config/Schema/DmChassisControllerPropertiesConfigSchema.json
+++ /dev/null
@@ -1,83 +0,0 @@
-{
- "$schema": "http://json-schema.org/draft-03/schema#",
- "title": "DmChassisController Properties Config Schema",
- "description": "",
- "$ref": "EssentialsConfigSchema.json#definitions/Device",
- "properties": {
- "properties": {
- "$ref": "#/propertiesConfig"
- }
- },
- "propertiesConfig": {
- "type": "object",
- "additionalProperties": true,
- "properties": {
- "control": {
- "required":true,
- "type": "object",
- "$ref": "../../ControlPropertiesConfigSchema.json#/ControlPropertiesConfig"
- },
- "volumeControls": {
- "title": "Volume Controls",
- "type": "object",
- "additionalProperties": {
- "type": "object",
- "$ref": "#/dmAudioCardPropertiesConfig"
- }
- },
- "inputSlots": {
- "required":true,
- "title": "Input Slots",
- "type": "object",
- "additionalProperties": {
- "type": "string"
- }
- },
- "outputSlots": {
- "required":true,
- "title": "Output Slots",
- "type": "object",
- "additionalProperties": {
- "type": "string"
- }
- },
- "inputNames": {
- "title": "Input Names",
- "type": "object",
- "additionalProperties": {
- "type": "string"
- }
- },
- "outputNames": {
- "title": "Output Names",
- "type": "object",
- "additionalProperties": {
- "type": "string"
- }
- },
- "noRouteText": {
- "title": "No Route Text",
- "type": "string"
- },
- "inputSlotSupportsHdcp2": {
- "type": "object",
- "additionalProperties": {
- "type": "boolean"
- }
- }
- }
- },
- "dmAudioCardPropertiesConfig": {
- "type": "object",
- "properties": {
- "OutLevel": {
- "title": "Output Level",
- "type": "integer"
- },
- "isVolumeControlPoint": {
- "title": "Volume Control Point?",
- "type": "boolean"
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.DM/Chassis/DmBladeChassisController.cs b/src/PepperDash.Essentials.DM/Chassis/DmBladeChassisController.cs
deleted file mode 100644
index 841c239a..00000000
--- a/src/PepperDash.Essentials.DM/Chassis/DmBladeChassisController.cs
+++ /dev/null
@@ -1,1001 +0,0 @@
-extern alias Full;
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Crestron.SimplSharp;
-using Crestron.SimplSharpPro;
-using Crestron.SimplSharpPro.DeviceSupport;
-using Crestron.SimplSharpPro.DM;
-using Crestron.SimplSharpPro.DM.Cards;
-using Crestron.SimplSharpPro.DM.Blades;
-using Crestron.SimplSharpPro.DM.Endpoints;
-using Crestron.SimplSharpPro.DM.Endpoints.Receivers;
-using Full.Newtonsoft.Json;
-using PepperDash.Core;
-using PepperDash.Essentials.Core;
-using PepperDash.Essentials.Core.Bridges;
-using PepperDash.Essentials.DM.Config;
-
-namespace PepperDash.Essentials.DM
-{
- ///
- /// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions
- ///
- ///
- public class DmBladeChassisController : CrestronGenericBridgeableBaseDevice, IDmSwitch, IRoutingNumericWithFeedback
- {
- private const string NonePortKey = "inputCard0--None";
-
- public DMChassisPropertiesConfig PropertiesConfig { get; set; }
-
- public Switch Chassis { get; private set; }
-
- //IroutingNumericEvent
- public event EventHandler NumericSwitchChange;
-
- // Feedbacks for EssentialDM
- public Dictionary VideoOutputFeedbacks { get; private set; }
- public Dictionary AudioOutputFeedbacks { get; private set; }
- public Dictionary VideoInputSyncFeedbacks { get; private set; }
- public Dictionary InputEndpointOnlineFeedbacks { get; private set; }
- public Dictionary OutputEndpointOnlineFeedbacks { get; private set; }
- public Dictionary InputNameFeedbacks { get; private set; }
- public Dictionary OutputNameFeedbacks { get; private set; }
- public Dictionary OutputVideoRouteNameFeedbacks { get; private set; }
- public Dictionary OutputAudioRouteNameFeedbacks { get; private set; }
- public Dictionary UsbOutputRoutedToFeebacks { get; private set; }
- public Dictionary UsbInputRoutedToFeebacks { get; private set; }
-
- public IntFeedback SystemIdFeebdack { get; private set; }
- public BoolFeedback SystemIdBusyFeedback { get; private set; }
-
-
- public Dictionary InputCardHdcpCapabilityFeedbacks { get; private set; }
-
- public Dictionary InputCardHdcpCapabilityTypes { get; private set; }
-
-
- // Need a couple Lists of generic Backplane ports
- public RoutingPortCollection InputPorts { get; private set; }
- public RoutingPortCollection OutputPorts { get; private set; }
-
- public Dictionary TxDictionary { get; set; }
- public Dictionary RxDictionary { get; set; }
-
- //public Dictionary InputCards { get; private set; }
- //public Dictionary OutputCards { get; private set; }
-
- public Dictionary InputNames { get; set; }
- public Dictionary OutputNames { get; set; }
- public Dictionary VolumeControls { get; private set; }
-
- public const int RouteOffTime = 500;
- Dictionary RouteOffTimers = new Dictionary();
-
- ///
- /// Factory method to create a new chassis controller from config data. Limited to 8x8 right now
- ///
- public static DmBladeChassisController GetDmChassisController(string key, string name,
- string type, DMChassisPropertiesConfig properties)
- {
- try
- {
- type = type.ToLower();
- uint ipid = properties.Control.IpIdInt;
-
- BladeSwitch chassis = null;
- if (type == "dmmd64x64") { chassis = new DmMd64x64(ipid, Global.ControlSystem); }
- else if (type == "dmmd128x128") { chassis = new DmMd128x128(ipid, Global.ControlSystem); }
-
-
- if (chassis == null)
- {
- return null;
- }
-
- var controller = new DmBladeChassisController(key, name, chassis);
- // add the cards and port names
- foreach (var kvp in properties.InputSlots)
- controller.AddInputBlade(kvp.Value, kvp.Key);
- foreach (var kvp in properties.OutputSlots)
- {
- controller.AddOutputBlade(kvp.Value, kvp.Key);
- }
-
- foreach (var kvp in properties.VolumeControls)
- {
- // get the card
- // check it for an audio-compatible type
- // make a something-something that will make it work
- // retire to mountain village
- var outNum = kvp.Key;
-
- var card = controller.Chassis.Outputs[outNum].Card;
- Audio.Output audio = null;
- if (card is DmHdmi4kOutputBladeCard)
- audio = (card as DmHdmi4kOutputBladeCard).Hdmi4kOutput.Audio;
- if (audio == null)
- continue;
- // wire up the audio to something here...
- controller.AddVolumeControl(outNum, audio);
- }
-
- controller.InputPorts.Add(new RoutingInputPort(NonePortKey, eRoutingSignalType.Video,
- eRoutingPortConnectionType.None, null, controller));
-
-
- controller.InputNames = properties.InputNames;
- controller.OutputNames = properties.OutputNames;
- controller.PropertiesConfig = properties;
- return controller;
- }
- catch (System.Exception e)
- {
- Debug.Console(0, "Error creating DM chassis:\r{0}", e);
- }
- return null;
- }
-
-
- ///
- ///
- ///
- ///
- ///
- ///
- public DmBladeChassisController(string key, string name, BladeSwitch chassis)
- : base(key, name, chassis)
- {
- Chassis = chassis;
- InputPorts = new RoutingPortCollection();
- OutputPorts = new RoutingPortCollection();
- VolumeControls = new Dictionary();
- TxDictionary = new Dictionary();
- RxDictionary = new Dictionary();
- IsOnline.OutputChange += new EventHandler(IsOnline_OutputChange);
- Chassis.DMInputChange += new DMInputEventHandler(Chassis_DMInputChange);
- Chassis.DMOutputChange += new DMOutputEventHandler(Chassis_DMOutputChange);
- VideoOutputFeedbacks = new Dictionary();
- UsbOutputRoutedToFeebacks = new Dictionary();
- UsbInputRoutedToFeebacks = new Dictionary();
- VideoInputSyncFeedbacks = new Dictionary();
- InputNameFeedbacks = new Dictionary();
- OutputNameFeedbacks = new Dictionary();
- OutputVideoRouteNameFeedbacks = new Dictionary();
- OutputAudioRouteNameFeedbacks = new Dictionary();
- InputEndpointOnlineFeedbacks = new Dictionary();
- OutputEndpointOnlineFeedbacks = new Dictionary();
-
- InputCardHdcpCapabilityFeedbacks = new Dictionary();
- InputCardHdcpCapabilityTypes = new Dictionary();
-
- for (uint x = 1; x <= Chassis.NumberOfOutputs; x++)
- {
- var tempX = x;
-
- if (Chassis.Outputs[tempX] != null)
- {
- VideoOutputFeedbacks[tempX] = new IntFeedback(() =>
- {
- if (Chassis.Outputs[tempX].VideoOutFeedback != null) { return (ushort)Chassis.Outputs[tempX].VideoOutFeedback.Number; }
- else { return 0; };
- });
-
- OutputNameFeedbacks[tempX] = new StringFeedback(() =>
- {
- if (Chassis.Outputs[tempX].NameFeedback != null)
- {
- return Chassis.Outputs[tempX].NameFeedback.StringValue;
- }
- else
- {
- return "";
- }
- });
- OutputVideoRouteNameFeedbacks[tempX] = new StringFeedback(() =>
- {
- if (Chassis.Outputs[tempX].VideoOutFeedback != null)
- {
- return Chassis.Outputs[tempX].VideoOutFeedback.NameFeedback.StringValue;
- }
- else
- {
- return "";
- }
- });
-
- OutputEndpointOnlineFeedbacks[tempX] = new BoolFeedback(() =>
- {
- //if (Chassis.Outputs[tempX].Endpoint != null)
- // return Chassis.Outputs[tempX].Endpoint.IsOnline;
- //else
- return Chassis.Outputs[tempX].EndpointOnlineFeedback;
- });
- }
-
- if (Chassis.Inputs[tempX] != null)
- {
- UsbInputRoutedToFeebacks[tempX] = new IntFeedback(() =>
- {
- if (Chassis.Inputs[tempX].USBRoutedToFeedback != null) { return (ushort)Chassis.Inputs[tempX].USBRoutedToFeedback.Number; }
- else { return 0; };
- });
- VideoInputSyncFeedbacks[tempX] = new BoolFeedback(() =>
- {
- if (Chassis.Inputs[tempX].VideoDetectedFeedback != null)
- return Chassis.Inputs[tempX].VideoDetectedFeedback.BoolValue;
- else
- return false;
- });
- InputNameFeedbacks[tempX] = new StringFeedback(() =>
- {
- if (Chassis.Inputs[tempX].NameFeedback != null)
- {
- return Chassis.Inputs[tempX].NameFeedback.StringValue;
- }
- else
- {
- return "";
- }
- });
-
- InputEndpointOnlineFeedbacks[tempX] = new BoolFeedback(() =>
- {
- return Chassis.Inputs[tempX].EndpointOnlineFeedback;
- });
-
- InputCardHdcpCapabilityFeedbacks[tempX] = new IntFeedback(() =>
- {
- var inputCard = Chassis.Inputs[tempX];
-
- if (inputCard.Card is DmHdmi4kInputBladeCard)
- {
- InputCardHdcpCapabilityTypes[tempX] = eHdcpCapabilityType.Hdcp2_2Support;
-
- if ((inputCard.Card as DmHdmi4kInputBladeCard).Hdmi4kInput.HdcpSupportOnFeedback.BoolValue)
- return 1;
- else
- return 0;
- }
-
- if (inputCard.Card is DmC4kInputBladeCard)
- {
- InputCardHdcpCapabilityTypes[tempX] = eHdcpCapabilityType.Hdcp2_2Support;
-
- if ((inputCard.Card as DmC4kInputBladeCard).DmInput.HdcpCapabilityFeedback.Equals(eHdcpCapabilityType.HdcpSupportOff))
- return 0;
- else
- return 1;
- }
-
- else
- return 0;
- });
- }
- }
- }
-
- ///
- ///
- ///
- ///
- ///
- public void AddInputBlade(string type, uint number)
- {
- Debug.Console(2, this, "Adding input blade '{0}', slot {1}", type, number);
-
- type = type.ToLower();
-
- if (type == "dmb4kihd")
- {
- var inputBlade = new Dmb4kIHd(number, this.Chassis);
- foreach (var item in inputBlade.Inputs)
- {
- var card = (item.Card as DmHdmi4kInputBladeCard).Hdmi4kInput;
- var cecPort = card as ICec;
- AddHdmiInBladePorts(item.Number, cecPort);
- }
- }
-
- else if (type == "dmb4kihddnt")
- {
- var inputBlade = new Dmb4kIHd(number, this.Chassis);
- foreach (var item in inputBlade.Inputs)
- {
- var card = (item.Card as DmHdmi4kInputBladeCard).Hdmi4kInput;
- var cecPort = card as ICec;
- AddHdmiInBladePorts(item.Number, cecPort);
- }
- }
-
- else if (type == "dmb4kic")
- {
- var inputBlade = new Dmb4kIC(number, this.Chassis);
- foreach (var item in inputBlade.Inputs)
- {
- AddDmInBladePorts(item.Number);
- }
- }
-
- else if (type == "dmbis")
- {
- var inputBlade = new DmbIS(number, this.Chassis);
- foreach (var item in inputBlade.Inputs)
- {
- AddDmInMmFiberPorts(item.Number);
- }
- }
- else if (type == "dmbis2")
- {
- var inputBlade = new DmbIS2(number, this.Chassis);
- foreach (var item in inputBlade.Inputs)
- {
- AddDmInSmFiberPorts(item.Number);
- }
- }
- }
-
- ///
- /// Raise an event when the status of a switch object changes.
- ///
- /// Arguments defined as IKeyName sender, output, input, and eRoutingSignalType
- private void OnSwitchChange(RoutingNumericEventArgs e)
- {
- var newEvent = NumericSwitchChange;
- if (newEvent != null) newEvent(this, e);
- }
-
-
- void AddHdmiInBladePorts(uint number, ICec cecPort)
- {
- AddInputPortWithDebug(number, "hdmiIn", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmCat, cecPort);
- }
-
- void AddDmInBladePorts(uint number)
- {
- AddInputPortWithDebug(number, "dmCIn", eRoutingSignalType.Video, eRoutingPortConnectionType.DmCat);
- }
-
- void AddDmInMmFiberPorts(uint number)
- {
- AddInputPortWithDebug(number, "dmMmIn", eRoutingSignalType.Video, eRoutingPortConnectionType.DmMmFiber);
- }
-
- void AddDmInSmFiberPorts(uint number)
- {
- AddInputPortWithDebug(number, "dmSmIn", eRoutingSignalType.Video, eRoutingPortConnectionType.DmSmFiber);
- }
-
- ///
- ///
- ///
- ///
- ///
- public void AddOutputBlade(string type, uint number)
- {
- type = type.ToLower();
-
- Debug.Console(2, this, "Adding output blade '{0}', slot {1}", type, number);
- if (type == "dmb4kohd")
- {
- var outputBlade = new Dmb4KOHD(number, Chassis);
- foreach (var item in outputBlade.Outputs)
- {
- AddHdmiOutBladePorts(item.Number);
- }
- }
-
- else if (type == "dmb4kohddnt")
- {
- var outputBlade = new Dmb4KOHD(number, Chassis);
- foreach (var item in outputBlade.Outputs)
- {
- AddHdmiOutBladePorts(item.Number);
- }
- }
-
- else if (type == "dmb4koc")
- {
- var outputBlade = new Dmb4KOC(number, Chassis);
- foreach (var item in outputBlade.Outputs)
- {
- AddDmOutBladePorts(item.Number);
- }
- }
- else if (type == "dmb4koc")
- {
- var outputBlade = new Dmb4KOC(number, Chassis);
- foreach (var item in outputBlade.Outputs)
- {
- AddDmOutBladePorts(item.Number);
- }
- }
- else if (type == "dmbos")
- {
- var outputBlade = new DmbOS(number, Chassis);
- foreach (var item in outputBlade.Outputs)
- {
- AddDmOutMmFiberBladePorts(item.Number);
- }
- }
- else if (type == "dmbos2")
- {
- var outputBlade = new DmbOS2(number, Chassis);
- foreach (var item in outputBlade.Outputs)
- {
- AddDmOutSmFiberBladePorts(item.Number);
- }
- }
- }
-
- void AddHdmiOutBladePorts(uint number)
- {
- AddOutputPortWithDebug(number, "hdmiOut", eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, Chassis.Outputs[number]);
- }
-
- void AddDmOutBladePorts(uint number)
- {
- AddOutputPortWithDebug(number, "dmOut", eRoutingSignalType.Video, eRoutingPortConnectionType.DmCat, Chassis.Outputs[number]);
- }
-
- void AddDmOutMmFiberBladePorts(uint number)
- {
- AddOutputPortWithDebug(number, "dmMmOut", eRoutingSignalType.Video, eRoutingPortConnectionType.DmMmFiber, Chassis.Outputs[number]);
- }
-
- void AddDmOutSmFiberBladePorts(uint number)
- {
- AddOutputPortWithDebug(number, "dmSmOut", eRoutingSignalType.Video, eRoutingPortConnectionType.DmSmFiber, Chassis.Outputs[number]);
- }
-
-
- ///
- /// Adds InputPort
- ///
- void AddInputPortWithDebug(uint cardNum, string portName, eRoutingSignalType sigType, eRoutingPortConnectionType portType)
- {
- AddInputPortWithDebug(cardNum, portName, sigType, portType, null);
- }
-
- ///
- /// Adds InputPort and sets Port as ICec object
- ///
- private void AddInputPortWithDebug(uint cardNum, string portName, eRoutingSignalType sigType,
- eRoutingPortConnectionType portType, ICec cecPort)
- {
- var portKey = string.Format("inputCard{0}--{1}", cardNum, portName);
- Debug.Console(2, this, "Adding input port '{0}'", portKey);
- var inputPort = new RoutingInputPort(portKey, sigType, portType, Chassis.Inputs[cardNum], this)
- {
- FeedbackMatchObject = Chassis.Inputs[cardNum]
- };
-
- if (cecPort != null)
- inputPort.Port = cecPort;
-
- InputPorts.Add(inputPort);
- }
-
-
-
- /*void AddOutputPortWithDebug(string cardName, string portName, eRoutingSignalType sigType, eRoutingPortConnectionType portType, object selector) {
- var portKey = string.Format("{0}--{1}", cardName, portName);
- Debug.Console(2, this, "Adding output port '{0}'", portKey);
- OutputPorts.Add(new RoutingOutputPort(portKey, sigType, portType, selector, this)
- {
- FeedbackMatchObject = selector
- });
- }*/
-
- ///
- /// Adds OutputPort
- ///
- void AddOutputPortWithDebug(uint cardNum, string portName, eRoutingSignalType sigType, eRoutingPortConnectionType portType, object selector)
- {
- try
- {
- var portKey = string.Format("outputCard{0}--{1}", cardNum, portName);
- Debug.Console(2, this, "Adding output port '{0}'", portKey);
- var outputPort = new RoutingOutputPort(portKey, sigType, portType, selector, this)
- {
- FeedbackMatchObject = Chassis.Outputs[cardNum]
- };
- OutputPorts.Add(outputPort);
- }
- catch (Exception ex)
- {
- Debug.Console(0, this, "Exception : {0}", ex);
- }
-
- }
-
-
- ///
- ///
- ///
- void AddVolumeControl(uint number, Audio.Output audio)
- {
- VolumeControls.Add(number, new DmCardAudioOutputController(audio));
- }
-
- //public void SetInputHdcpSupport(uint input, ePdtHdcpSupport hdcpSetting)
- //{
-
- //}
-
-
- void Chassis_DMInputChange(Switch device, DMInputEventArgs args)
- {
-
- switch (args.EventId)
- {
- case DMInputEventIds.EndpointOnlineEventId:
- {
- Debug.Console(2, this, "DM Input EndpointOnlineEventId for input: {0}. State: {1}", args.Number, device.Inputs[args.Number].EndpointOnlineFeedback);
- InputEndpointOnlineFeedbacks[args.Number].FireUpdate();
- break;
- }
- case DMInputEventIds.OnlineFeedbackEventId:
- {
- Debug.Console(2, this, "DM Input OnlineFeedbackEventId for input: {0}. State: {1}", args.Number, device.Inputs[args.Number].EndpointOnlineFeedback);
- InputEndpointOnlineFeedbacks[args.Number].FireUpdate();
- break;
- }
- case DMInputEventIds.VideoDetectedEventId:
- {
- Debug.Console(2, this, "DM Input {0} VideoDetectedEventId", args.Number);
- VideoInputSyncFeedbacks[args.Number].FireUpdate();
- break;
- }
- case DMInputEventIds.InputNameEventId:
- {
- Debug.Console(2, this, "DM Input {0} NameFeedbackEventId", args.Number);
- InputNameFeedbacks[args.Number].FireUpdate();
- break;
- }
- case DMInputEventIds.HdcpCapabilityFeedbackEventId:
- {
- Debug.Console(2, this, "DM Input {0} HdcpCapabilityFeedbackEventId", args.Number);
- InputCardHdcpCapabilityFeedbacks[args.Number].FireUpdate();
- break;
- }
- default:
- {
- Debug.Console(2, this, "DMInputChange fired for Input {0} with Unhandled EventId: {1}", args.Number, args.EventId);
- break;
- }
- }
- }
-
- ///
- ///
- private void Chassis_DMOutputChange(Switch device, DMOutputEventArgs args)
- {
- var output = args.Number;
-
- switch (args.EventId)
- {
- case DMOutputEventIds.VolumeEventId:
- {
- if (VolumeControls.ContainsKey(output))
- {
- VolumeControls[args.Number].VolumeEventFromChassis();
- }
- break;
- }
- case DMOutputEventIds.EndpointOnlineEventId:
- {
- Debug.Console(2, this,
- "Output {0} DMOutputEventIds.EndpointOnlineEventId fired. EndpointOnlineFeedback State: {1}",
- args.Number, Chassis.Outputs[output].EndpointOnlineFeedback);
- if (Chassis.Outputs[output].Endpoint != null)
- Debug.Console(2, this,
- "Output {0} DMOutputEventIds.EndpointOnlineEventId fired. Endpoint.IsOnline State: {1}",
- args.Number, Chassis.Outputs[output].Endpoint.IsOnline);
-
- OutputEndpointOnlineFeedbacks[output].FireUpdate();
- break;
- }
- case DMOutputEventIds.OnlineFeedbackEventId:
- {
- Debug.Console(2, this, "Output {0} DMInputEventIds.OnlineFeedbackEventId fired. State: {1}",
- args.Number, Chassis.Outputs[output].EndpointOnlineFeedback);
- OutputEndpointOnlineFeedbacks[output].FireUpdate();
- break;
- }
- case DMOutputEventIds.VideoOutEventId:
- {
-
- var inputNumber = Chassis.Outputs[output].VideoOutFeedback == null ? 0 : Chassis.Outputs[output].VideoOutFeedback.Number;
-
- Debug.Console(2, this, "DMSwitchAudioVideo:{0} Routed Input:{1} Output:{2}'", this.Name,
- inputNumber, output);
-
- if (VideoOutputFeedbacks.ContainsKey(output))
- {
- var localInputPort = InputPorts.FirstOrDefault(p => (DMInput)p.FeedbackMatchObject == Chassis.Outputs[output].VideoOutFeedback);
- var localOutputPort =
- OutputPorts.FirstOrDefault(p => (DMOutput)p.FeedbackMatchObject == Chassis.Outputs[output]);
-
-
- VideoOutputFeedbacks[output].FireUpdate();
- OnSwitchChange(new RoutingNumericEventArgs(output,
- inputNumber,
- localOutputPort,
- localInputPort,
- eRoutingSignalType.AudioVideo));
-
- }
- if (OutputVideoRouteNameFeedbacks.ContainsKey(output))
- {
- OutputVideoRouteNameFeedbacks[output].FireUpdate();
- }
- break;
- }
- case DMOutputEventIds.OutputNameEventId:
- {
- Debug.Console(2, this, "DM Output {0} NameFeedbackEventId", output);
- OutputNameFeedbacks[output].FireUpdate();
- break;
- }
- default:
- {
- Debug.Console(2, this, "DMOutputChange fired for Output {0} with Unhandled EventId: {1}",
- args.Number, args.EventId);
- break;
- }
- }
-
- }
-
-
- ///
- ///
- ///
- ///
- void StartOffTimer(PortNumberType pnt)
- {
- if (RouteOffTimers.ContainsKey(pnt))
- return;
- RouteOffTimers[pnt] = new CTimer(o => ExecuteSwitch(null, pnt.Selector, pnt.Type), RouteOffTime);
- }
-
-
- // Send out sigs when coming online
- void IsOnline_OutputChange(object sender, EventArgs e)
- {
- if (IsOnline.BoolValue)
- {
- Chassis.EnableUSBBreakaway.BoolValue = true;
-
- if (InputNames != null)
- foreach (var kvp in InputNames)
- Chassis.Inputs[kvp.Key].Name.StringValue = kvp.Value;
- if (OutputNames != null)
- foreach (var kvp in OutputNames)
- Chassis.Outputs[kvp.Key].Name.StringValue = kvp.Value;
- }
- }
-
- #region IRouting Members
-
- public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType sigType)
- {
- Debug.Console(2, this, "Making an awesome DM route from {0} to {1} {2}", inputSelector, outputSelector, sigType);
-
- var input = inputSelector as DMInput; // Cast can sometimes fail
- var output = outputSelector as DMOutput;
-
-
- if (output == null)
- {
- Debug.Console(0, this, Debug.ErrorLogLevel.Warning,
- "Unable to execute switch for inputSelector {0} to outputSelector {1}", inputSelector,
- outputSelector);
- return;
- }
-
- // Check to see if there's an off timer waiting on this and if so, cancel
- var key = new PortNumberType(output, sigType);
-
- if (input == null)
- {
- StartOffTimer(key);
- }
- else
- {
- if (RouteOffTimers.ContainsKey(key))
- {
- Debug.Console(2, this, "{0} cancelling route off due to new source", output);
- RouteOffTimers[key].Stop();
- RouteOffTimers.Remove(key);
- }
- }
-
-
-
- /*var inCard = input == 0 ? null : Chassis.Inputs[input];
- var outCard = input == 0 ? null : Chassis.Outputs[output];*/
-
- // NOTE THAT BITWISE COMPARISONS - TO CATCH ALL ROUTING TYPES
- if ((sigType & eRoutingSignalType.Video) != eRoutingSignalType.Video) return;
- Chassis.VideoEnter.BoolValue = true;
- output.VideoOut = input;
- }
-
- #endregion
-
- #region IRoutingNumeric Members
-
- public void ExecuteNumericSwitch(ushort inputSelector, ushort outputSelector, eRoutingSignalType sigType)
- {
- var input = inputSelector == 0 ? null : Chassis.Inputs[inputSelector];
- var output = Chassis.Outputs[outputSelector];
-
- ExecuteSwitch(input, output, sigType);
- }
-
- #endregion
-
-
- public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
- {
- var joinMap = new DmBladeChassisControllerJoinMap(joinStart);
-
- var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
-
- if (!string.IsNullOrEmpty(joinMapSerialized))
- joinMap = JsonConvert.DeserializeObject(joinMapSerialized);
-
- if (bridge != null)
- {
- bridge.AddJoinMap(Key, joinMap);
- }
- else
- {
- Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
- }
-
- Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
-
- IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]);
-
- // Link up outputs
- for (uint i = 1; i <= Chassis.NumberOfOutputs; i++)
- {
- var ioSlot = i;
- var ioSlotJoin = ioSlot - 1;
-
- // Control
- trilist.SetUShortSigAction(joinMap.OutputVideo.JoinNumber + ioSlotJoin, o => ExecuteNumericSwitch(o, (ushort)ioSlot, eRoutingSignalType.Video));
-
- if (TxDictionary.ContainsKey(ioSlot))
- {
- Debug.Console(2, "Creating Tx Feedbacks {0}", ioSlot);
- var txKey = TxDictionary[ioSlot];
- var basicTxDevice = DeviceManager.GetDeviceForKey(txKey) as BasicDmTxControllerBase;
-
- var advancedTxDevice = basicTxDevice as DmTxControllerBase;
-
- if (Chassis is DmMd128x128 || Chassis is DmMd64x64)
- {
- InputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline.JoinNumber + ioSlotJoin]);
- }
- else
- {
- if (advancedTxDevice != null)
- {
- advancedTxDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline.JoinNumber + ioSlotJoin]);
- Debug.Console(2, "Linking Tx Online Feedback from Advanced Transmitter at input {0}", ioSlot);
- }
- else if (InputEndpointOnlineFeedbacks[ioSlot] != null)
- {
- Debug.Console(2, "Linking Tx Online Feedback from Input Card {0}", ioSlot);
- InputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline.JoinNumber + ioSlotJoin]);
- }
- }
-
- if (basicTxDevice != null && advancedTxDevice == null)
- trilist.BooleanInput[joinMap.TxAdvancedIsPresent.JoinNumber + ioSlotJoin].BoolValue = true;
-
- if (advancedTxDevice != null)
- {
- advancedTxDevice.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus.JoinNumber + ioSlotJoin]);
- }
- else
- {
- Debug.Console(1, "Setting up actions and feedbacks on input card {0}", ioSlot);
- VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus.JoinNumber + ioSlotJoin]);
-
- var inputPort = InputPorts[string.Format("inputCard{0}--hdmiIn", ioSlot)];
- if (inputPort != null)
- {
- Debug.Console(1, "Port value for input card {0} is set", ioSlot);
- var port = inputPort.Port;
-
- if (port != null)
- {
- if (port is HdmiInputWithCEC)
- {
- Debug.Console(1, "Port is HdmiInputWithCec");
-
- var hdmiInPortWCec = port as HdmiInputWithCEC;
-
- if (hdmiInPortWCec.HdcpSupportedLevel != eHdcpSupportedLevel.Unknown)
- {
- SetHdcpStateAction(true, hdmiInPortWCec, joinMap.HdcpSupportState.JoinNumber + ioSlotJoin, trilist);
- }
-
- InputCardHdcpCapabilityFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.HdcpSupportState.JoinNumber + ioSlotJoin]);
-
- if (InputCardHdcpCapabilityTypes.ContainsKey(ioSlot))
- trilist.UShortInput[joinMap.HdcpSupportCapability.JoinNumber + ioSlotJoin].UShortValue = (ushort)InputCardHdcpCapabilityTypes[ioSlot];
- else
- trilist.UShortInput[joinMap.HdcpSupportCapability.JoinNumber + ioSlotJoin].UShortValue = 1;
- }
- }
- }
- else
- {
- inputPort = InputPorts[string.Format("inputCard{0}--dmIn", ioSlot)];
-
- if (inputPort != null)
- {
- var port = inputPort.Port;
-
- if (port is DMInputPortWithCec)
- {
- Debug.Console(1, "Port is DMInputPortWithCec");
-
- var dmInPortWCec = port as DMInputPortWithCec;
-
- SetHdcpStateAction(PropertiesConfig.InputSlotSupportsHdcp2[ioSlot], dmInPortWCec, joinMap.HdcpSupportState.JoinNumber + ioSlotJoin, trilist);
-
- InputCardHdcpCapabilityFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.HdcpSupportState.JoinNumber + ioSlotJoin]);
-
- if (InputCardHdcpCapabilityTypes.ContainsKey(ioSlot))
- trilist.UShortInput[joinMap.HdcpSupportCapability.JoinNumber + ioSlotJoin].UShortValue = (ushort)InputCardHdcpCapabilityTypes[ioSlot];
- else
- trilist.UShortInput[joinMap.HdcpSupportCapability.JoinNumber + ioSlotJoin].UShortValue = 1;
- }
- }
- }
- }
- }
- else
- {
- VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus.JoinNumber + ioSlotJoin]);
-
- var inputPort = InputPorts[string.Format("inputCard{0}--hdmiIn", ioSlot)];
- if (inputPort != null)
- {
- var hdmiPort = inputPort.Port as EndpointHdmiInput;
-
- if (hdmiPort != null)
- {
- SetHdcpStateAction(true, hdmiPort, joinMap.HdcpSupportState.JoinNumber + ioSlotJoin, trilist);
- InputCardHdcpCapabilityFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.HdcpSupportState.JoinNumber + ioSlotJoin]);
- }
- }
- }
- if (RxDictionary.ContainsKey(ioSlot))
- {
- Debug.Console(2, "Creating Rx Feedbacks {0}", ioSlot);
- //var rxKey = RxDictionary[ioSlot];
- //var rxDevice = DeviceManager.GetDeviceForKey(rxKey) as DmRmcControllerBase;
- //var hdBaseTDevice = DeviceManager.GetDeviceForKey(rxKey) as DmHdBaseTControllerBase;
- //if (hdBaseTDevice != null) {
- OutputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline.JoinNumber + ioSlotJoin]);
- //}
- //else if (rxDevice != null) {
- // rxDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline + ioSlot]);
- //}
- }
-
- // Feedback
- VideoOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputVideo.JoinNumber + ioSlotJoin]);
-
-
- OutputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputNames.JoinNumber + ioSlotJoin]);
- InputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.InputNames.JoinNumber + ioSlotJoin]);
- OutputVideoRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentVideoInputNames.JoinNumber + ioSlotJoin]);
- }
- }
-
- private void SetHdcpStateAction(bool hdcpTypeSimple, HdmiInputWithCEC port, uint join, BasicTriList trilist)
- {
- if (hdcpTypeSimple)
- {
- trilist.SetUShortSigAction(join,
- s =>
- {
- if (s == 0)
- {
- port.HdcpSupportOff();
- }
- else if (s > 0)
- {
- port.HdcpSupportOn();
- }
- });
- }
- else
- {
- trilist.SetUShortSigAction(join,
- u =>
- {
- port.HdcpReceiveCapability = (eHdcpCapabilityType)u;
- });
- }
- }
-
- private void SetHdcpStateAction(bool hdcpTypeSimple, EndpointHdmiInput port, uint join, BasicTriList trilist)
- {
- if (hdcpTypeSimple)
- {
- trilist.SetUShortSigAction(join,
- s =>
- {
- if (s == 0)
- {
- port.HdcpSupportOff();
- }
- else if (s > 0)
- {
- port.HdcpSupportOn();
- }
- });
- }
- else
- {
- trilist.SetUShortSigAction(join,
- u =>
- {
- port.HdcpCapability = (eHdcpCapabilityType)u;
- });
- }
- }
-
- private void SetHdcpStateAction(bool supportsHdcp2, DMInputPortWithCec port, uint join, BasicTriList trilist)
- {
- if (!supportsHdcp2)
- {
- trilist.SetUShortSigAction(join,
- s =>
- {
- if (s == 0)
- {
- port.HdcpSupportOff();
- }
- else if (s > 0)
- {
- port.HdcpSupportOn();
- }
- });
- }
- else
- {
- trilist.SetUShortSigAction(join,
- u =>
- {
- port.HdcpReceiveCapability = (eHdcpCapabilityType)u;
- });
- }
- }
-
- }
-
- /*
- public struct PortNumberType {
- public uint Number { get; private set; }
- public eRoutingSignalType Type { get; private set; }
-
- public PortNumberType(uint number, eRoutingSignalType type)
- : this() {
- Number = number;
- Type = type;
- }
- }*/
-}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.DM/Chassis/DmCardAudioOutput.cs b/src/PepperDash.Essentials.DM/Chassis/DmCardAudioOutput.cs
deleted file mode 100644
index 4b4a927e..00000000
--- a/src/PepperDash.Essentials.DM/Chassis/DmCardAudioOutput.cs
+++ /dev/null
@@ -1,116 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Crestron.SimplSharp;
-using Crestron.SimplSharpPro.DM;
-
-using PepperDash.Core;
-using PepperDash.Essentials.Core;
-
-namespace PepperDash.Essentials.DM
-{
- public class DmCardAudioOutputController : IBasicVolumeWithFeedback
- {
- public Audio.Output Output { get; private set; }
-
- public IntFeedback VolumeLevelFeedback { get; private set; }
-
- public BoolFeedback MuteFeedback { get; private set; }
-
- ushort PreMuteVolumeLevel;
- bool IsMuted;
-
- public DmCardAudioOutputController(Audio.Output output)
- {
- Output = output;
- VolumeLevelFeedback = new IntFeedback(() => Output.VolumeFeedback.UShortValue);
- MuteFeedback = new BoolFeedback(() => IsMuted);
- }
-
- #region IBasicVolumeWithFeedback Members
-
- ///
- ///
- ///
- public void MuteOff()
- {
- SetVolume(PreMuteVolumeLevel);
- IsMuted = false;
- MuteFeedback.FireUpdate();
- }
-
- ///
- ///
- ///
- public void MuteOn()
- {
- PreMuteVolumeLevel = Output.VolumeFeedback.UShortValue;
- SetVolume(0);
- IsMuted = true;
- MuteFeedback.FireUpdate();
- }
-
- ///
- ///
- ///
- public void SetVolume(ushort level)
- {
- Debug.Console(2, "Set volume out {0}", level);
- Output.Volume.UShortValue = level;
- }
-
- ///
- ///
- ///
- internal void VolumeEventFromChassis()
- {
- VolumeLevelFeedback.FireUpdate();
- }
-
- #endregion
-
- #region IBasicVolumeControls Members
-
- ///
- ///
- ///
- public void MuteToggle()
- {
- if (IsMuted)
- MuteOff();
- else
- MuteOn();
- }
-
- ///
- ///
- ///
- public void VolumeDown(bool pressRelease)
- {
- if (pressRelease)
- {
- var remainingRatio = Output.Volume.UShortValue / 65535;
- Output.Volume.CreateRamp(0, (uint)(400 * remainingRatio));
- }
- else
- Output.Volume.StopRamp();
- }
-
- ///
- ///
- ///
- public void VolumeUp(bool pressRelease)
- {
- if (pressRelease)
- {
- var remainingRatio = (65535 - Output.Volume.UShortValue) / 65535;
- Output.Volume.CreateRamp(65535, 400);
- }
- else
- Output.Volume.StopRamp();
- }
-
- #endregion
- }
-}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.DM/Chassis/DmChassisController.cs b/src/PepperDash.Essentials.DM/Chassis/DmChassisController.cs
deleted file mode 100644
index e5690166..00000000
--- a/src/PepperDash.Essentials.DM/Chassis/DmChassisController.cs
+++ /dev/null
@@ -1,2128 +0,0 @@
-extern alias Full;
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Crestron.SimplSharp;
-using Crestron.SimplSharp.Reflection;
-using Crestron.SimplSharpPro;
-using Crestron.SimplSharpPro.DeviceSupport;
-using Crestron.SimplSharpPro.DM;
-using Crestron.SimplSharpPro.DM.Cards;
-using Crestron.SimplSharpPro.DM.Endpoints;
-using Crestron.SimplSharpProInternal;
-using Full.Newtonsoft.Json;
-using PepperDash.Core;
-using PepperDash.Essentials.Core;
-using PepperDash.Essentials.Core.Bridges;
-using PepperDash.Essentials.DM.Config;
-using PepperDash.Essentials.Core.Config;
-
-namespace PepperDash.Essentials.DM
-{
- ///
- /// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions
- ///
- ///
- [Description("Wrapper class for all DM-MD chassis variants from 8x8 to 32x32")]
- public class DmChassisController : CrestronGenericBridgeableBaseDevice, IDmSwitch, IRoutingNumericWithFeedback
- {
- private const string NonePortKey = "inputCard0--None";
- public DMChassisPropertiesConfig PropertiesConfig { get; set; }
-
- public Switch Chassis { get; private set; }
-
- //IroutingNumericEvent
- public event EventHandler NumericSwitchChange;
-
- // Feedbacks for EssentialDM
- public Dictionary VideoOutputFeedbacks { get; private set; }
- public Dictionary AudioOutputFeedbacks { get; private set; }
- public Dictionary VideoInputSyncFeedbacks { get; private set; }
- public Dictionary InputEndpointOnlineFeedbacks { get; private set; }
- public Dictionary OutputEndpointOnlineFeedbacks { get; private set; }
- public Dictionary InputNameFeedbacks { get; private set; }
- public Dictionary OutputNameFeedbacks { get; private set; }
- public Dictionary OutputVideoRouteNameFeedbacks { get; private set; }
- public Dictionary OutputAudioRouteNameFeedbacks { get; private set; }
- public Dictionary UsbOutputRoutedToFeebacks { get; private set; }
- public Dictionary UsbInputRoutedToFeebacks { get; private set; }
- public Dictionary OutputDisabledByHdcpFeedbacks { get; private set; }
-
- public IntFeedback SystemIdFeebdack { get; private set; }
- public BoolFeedback SystemIdBusyFeedback { get; private set; }
- public BoolFeedback EnableAudioBreakawayFeedback { get; private set; }
- public BoolFeedback EnableUsbBreakawayFeedback { get; private set; }
-
- public Dictionary InputCardHdcpStateFeedbacks { get; private set; }
- public Dictionary InputStreamCardStateFeedbacks { get; private set; }
- public Dictionary OutputStreamCardStateFeedbacks { get; private set; }
-
- public Dictionary InputCardHdcpCapabilityTypes { get; private set; }
-
- // Need a couple Lists of generic Backplane ports
- public RoutingPortCollection InputPorts { get; private set; }
- public RoutingPortCollection OutputPorts { get; private set; }
-
- public Dictionary TxDictionary { get; set; }
- public Dictionary RxDictionary { get; set; }
-
- //public Dictionary InputCards { get; private set; }
- //public Dictionary OutputCards { get; private set; }
-
- public Dictionary InputNames { get; set; }
- public Dictionary OutputNames { get; set; }
- public Dictionary VolumeControls { get; private set; }
-
- public const int RouteOffTime = 500;
- Dictionary RouteOffTimers = new Dictionary();
-
- ///
- /// Text that represents when an output has no source routed to it
- ///
- public string NoRouteText = "";
-
- ///
- /// Factory method to create a new chassis controller from config data. Limited to 8x8 right now
- ///
- public static DmChassisController GetDmChassisController(string key, string name,
- string type, DMChassisPropertiesConfig properties)
- {
- try
- {
- type = type.ToLower();
- uint ipid = properties.Control.IpIdInt;
-
- DmMDMnxn chassis = null;
- switch (type) {
- case "dmmd8x8":
- chassis = new DmMd8x8(ipid, Global.ControlSystem);
- break;
- case "dmmd8x8rps":
- chassis = new DmMd8x8rps(ipid, Global.ControlSystem);
- break;
- case "dmmd8x8cpu3":
- chassis = new DmMd8x8Cpu3(ipid, Global.ControlSystem);
- break;
- case "dmmd8x8cpu3rps":
- chassis = new DmMd8x8Cpu3rps(ipid, Global.ControlSystem);
- break;
- case "dmmd16x16":
- chassis = new DmMd16x16(ipid, Global.ControlSystem);
- break;
- case "dmmd16x16rps":
- chassis = new DmMd16x16rps(ipid, Global.ControlSystem);
- break;
- case "dmmd16x16cpu3":
- chassis = new DmMd16x16Cpu3(ipid, Global.ControlSystem);
- break;
- case "dmmd16x16cpu3rps":
- chassis = new DmMd16x16Cpu3rps(ipid, Global.ControlSystem);
- break;
- case "dmmd32x32":
- chassis = new DmMd32x32(ipid, Global.ControlSystem);
- break;
- case "dmmd32x32rps":
- chassis = new DmMd32x32rps(ipid, Global.ControlSystem);
- break;
- case "dmmd32x32cpu3":
- chassis = new DmMd32x32Cpu3(ipid, Global.ControlSystem);
- break;
- case "dmmd32x32cpu3rps":
- chassis = new DmMd32x32Cpu3rps(ipid, Global.ControlSystem);
- break;
- }
-
- if (chassis == null)
- return null;
-
- var controller = new DmChassisController(key, name, chassis);
-
- //
- var clearInputPort = new RoutingInputPort(NonePortKey, eRoutingSignalType.AudioVideo,
- eRoutingPortConnectionType.None, null, controller);
-
- controller.InputPorts.Add(clearInputPort);
-
- // add the cards and port names
- foreach (var kvp in properties.InputSlots)
- controller.AddInputCard(kvp.Value, kvp.Key);
-
- foreach (var kvp in properties.OutputSlots)
- controller.AddOutputCard(kvp.Value, kvp.Key);
-
- foreach (var kvp in properties.VolumeControls)
- {
- // get the card
- // check it for an audio-compatible type
- // make a something-something that will make it work
- // retire to mountain village
- var outNum = kvp.Key;
- var card = controller.Chassis.Outputs[outNum].Card;
- Audio.Output audio = null;
- if (card is DmcHdo)
- audio = (card as DmcHdo).Audio;
- else if (card is Dmc4kHdo)
- audio = (card as Dmc4kHdo).Audio;
- if (audio == null)
- continue;
-
- // wire up the audio to something here...
- controller.AddVolumeControl(outNum, audio);
- }
-
- controller.InputNames = properties.InputNames;
- controller.OutputNames = properties.OutputNames;
-
- if (!string.IsNullOrEmpty(properties.NoRouteText))
- {
- controller.NoRouteText = properties.NoRouteText;
- Debug.Console(1, controller, "Setting No Route Text value to: {0}", controller.NoRouteText);
- }
- else
- {
- Debug.Console(1, controller, "NoRouteText not specified. Defaulting to blank string.", controller.NoRouteText);
- }
-
- controller.PropertiesConfig = properties;
- return controller;
- }
- catch (Exception e)
- {
- Debug.Console(0, "Error creating DM chassis:\r{0}", e);
- }
-
- return null;
- }
-
- ///
- ///
- ///
- ///
- ///
- ///
- public DmChassisController(string key, string name, DmMDMnxn chassis)
- : base(key, name, chassis)
- {
-
- Chassis = chassis;
- InputPorts = new RoutingPortCollection();
- OutputPorts = new RoutingPortCollection();
- VolumeControls = new Dictionary();
- TxDictionary = new Dictionary();
- RxDictionary = new Dictionary();
- IsOnline.OutputChange += new EventHandler(IsOnline_OutputChange);
- Chassis.DMInputChange += new DMInputEventHandler(Chassis_DMInputChange);
- Chassis.DMSystemChange += new DMSystemEventHandler(Chassis_DMSystemChange);
- Chassis.DMOutputChange += new DMOutputEventHandler(Chassis_DMOutputChange);
- Chassis.BaseEvent += ChassisOnBaseEvent;
- VideoOutputFeedbacks = new Dictionary();
- AudioOutputFeedbacks = new Dictionary();
- UsbOutputRoutedToFeebacks = new Dictionary();
- UsbInputRoutedToFeebacks = new Dictionary();
- OutputDisabledByHdcpFeedbacks = new Dictionary();
- VideoInputSyncFeedbacks = new Dictionary();
- InputNameFeedbacks = new Dictionary();
- OutputNameFeedbacks = new Dictionary();
- OutputVideoRouteNameFeedbacks = new Dictionary();
- OutputAudioRouteNameFeedbacks = new Dictionary();
- InputEndpointOnlineFeedbacks = new Dictionary();
- OutputEndpointOnlineFeedbacks = new Dictionary();
-
- SystemIdFeebdack = new IntFeedback(() => { return (Chassis as DmMDMnxn).SystemIdFeedback.UShortValue; });
- SystemIdBusyFeedback = new BoolFeedback(() => { return (Chassis as DmMDMnxn).SystemIdBusy.BoolValue; });
- EnableAudioBreakawayFeedback =
- new BoolFeedback(() => (Chassis as DmMDMnxn).EnableAudioBreakawayFeedback.BoolValue);
- EnableUsbBreakawayFeedback =
- new BoolFeedback(() => (Chassis as DmMDMnxn).EnableUSBBreakawayFeedback.BoolValue);
-
- InputCardHdcpStateFeedbacks = new Dictionary();
- InputStreamCardStateFeedbacks = new Dictionary();
- OutputStreamCardStateFeedbacks = new Dictionary();
- InputCardHdcpCapabilityTypes = new Dictionary();
-
- for (uint x = 1; x <= Chassis.NumberOfOutputs; x++)
- {
- var tempX = x;
-
- if (Chassis.Outputs[tempX] != null)
- {
- VideoOutputFeedbacks[tempX] = new IntFeedback(() => {
- if (Chassis.Outputs[tempX].VideoOutFeedback != null)
- return (ushort)Chassis.Outputs[tempX].VideoOutFeedback.Number;
-
- return 0;
- });
- AudioOutputFeedbacks[tempX] = new IntFeedback(() => {
- if (Chassis.Outputs[tempX].AudioOutFeedback != null)
- return (ushort)Chassis.Outputs[tempX].AudioOutFeedback.Number;
-
- return 0;
- });
- UsbOutputRoutedToFeebacks[tempX] = new IntFeedback(() => {
- if (Chassis.Outputs[tempX].USBRoutedToFeedback != null)
- return (ushort)Chassis.Outputs[tempX].USBRoutedToFeedback.Number;
-
- return 0;
- });
-
- OutputNameFeedbacks[tempX] = new StringFeedback(() => {
- if (Chassis.Outputs[tempX].NameFeedback != null)
- return Chassis.Outputs[tempX].NameFeedback.StringValue;
-
- return "";
- });
- OutputVideoRouteNameFeedbacks[tempX] = new StringFeedback(() => {
- if (Chassis.Outputs[tempX].VideoOutFeedback != null)
- return Chassis.Outputs[tempX].VideoOutFeedback.NameFeedback.StringValue;
-
- return NoRouteText;
- });
- OutputAudioRouteNameFeedbacks[tempX] = new StringFeedback(() => {
- if (Chassis.Outputs[tempX].AudioOutFeedback != null)
- return Chassis.Outputs[tempX].AudioOutFeedback.NameFeedback.StringValue;
-
- return NoRouteText;
- });
- OutputEndpointOnlineFeedbacks[tempX] = new BoolFeedback(() => Chassis.Outputs[tempX].EndpointOnlineFeedback);
-
- OutputDisabledByHdcpFeedbacks[tempX] = new BoolFeedback(() => {
- var output = Chassis.Outputs[tempX];
-
- var hdmiTxOutput = output as Card.HdmiTx;
- if (hdmiTxOutput != null)
- return hdmiTxOutput.HdmiOutput.DisabledByHdcp.BoolValue;
-
- var dmHdmiOutput = output as Card.DmHdmiOutput;
- if (dmHdmiOutput != null)
- return dmHdmiOutput.DisabledByHdcpFeedback.BoolValue;
-
- var dmsDmOutAdvanced = output as Card.DmsDmOutAdvanced;
- if (dmsDmOutAdvanced != null)
- return dmsDmOutAdvanced.DisabledByHdcpFeedback.BoolValue;
-
- var dmps3HdmiAudioOutput = output as Card.Dmps3HdmiAudioOutput;
- if (dmps3HdmiAudioOutput != null)
- return dmps3HdmiAudioOutput.HdmiOutputPort.DisabledByHdcpFeedback.BoolValue;
-
- var dmps3HdmiOutput = output as Card.Dmps3HdmiOutput;
- if (dmps3HdmiOutput != null)
- return dmps3HdmiOutput.HdmiOutputPort.DisabledByHdcpFeedback.BoolValue;
-
- var dmps3HdmiOutputBackend = output as Card.Dmps3HdmiOutputBackend;
- if (dmps3HdmiOutputBackend != null)
- return dmps3HdmiOutputBackend.HdmiOutputPort.DisabledByHdcpFeedback.BoolValue;
-
- // var hdRx4kX10HdmiOutput = output as HdRx4kX10HdmiOutput;
- // if (hdRx4kX10HdmiOutput != null)
- // return hdRx4kX10HdmiOutput.HdmiOutputPort.DisabledByHdcpFeedback.BoolValue;
-
- // var hdMdNxMHdmiOutput = output as HdMdNxMHdmiOutput;
- // if (hdMdNxMHdmiOutput != null)
- // return hdMdNxMHdmiOutput.HdmiOutputPort.DisabledByHdcpFeedback.BoolValue;
-
- return false;
- });
- OutputStreamCardStateFeedbacks[tempX] = new IntFeedback(() =>
- {
- try
- {
- var outputCard = Chassis.Outputs[tempX];
-
- if (outputCard.Card is DmcStroAV)
- {
- Debug.Console(2, "Found output stream card in slot: {0}.", tempX);
- var streamCard = outputCard.Card as DmcStroAV;
- if (streamCard.Control.StartFeedback.BoolValue == true)
- return 1;
- else if (streamCard.Control.StopFeedback.BoolValue == true)
- return 2;
- else if (streamCard.Control.PauseFeedback.BoolValue == true)
- return 3;
- else
- return 0;
- }
- return 0;
- }
- catch (InvalidOperationException iopex)
- {
- Debug.Console(0, this, Debug.ErrorLogLevel.Warning, "Error adding output stream card in slot: {0}. Error: {1}", tempX, iopex);
- return 0;
- }
- });
- }
-
- if (Chassis.Inputs[tempX] != null)
- {
- UsbInputRoutedToFeebacks[tempX] = new IntFeedback(() => {
- if (Chassis.Inputs[tempX].USBRoutedToFeedback != null)
- return (ushort)Chassis.Inputs[tempX].USBRoutedToFeedback.Number;
-
- return 0;
- });
- VideoInputSyncFeedbacks[tempX] = new BoolFeedback(() => {
- if (Chassis.Inputs[tempX].VideoDetectedFeedback != null)
- return Chassis.Inputs[tempX].VideoDetectedFeedback.BoolValue;
-
- return false;
- });
- InputNameFeedbacks[tempX] = new StringFeedback(() => {
- if (Chassis.Inputs[tempX].NameFeedback != null)
- return Chassis.Inputs[tempX].NameFeedback.StringValue;
-
- return "";
- });
-
- InputEndpointOnlineFeedbacks[tempX] = new BoolFeedback(() => { return Chassis.Inputs[tempX].EndpointOnlineFeedback; });
-
- InputCardHdcpStateFeedbacks[tempX] = new IntFeedback(() => {
- try
- {
- var inputCard = Chassis.Inputs[tempX];
-
- if (inputCard.Card is DmcHd)
- {
- InputCardHdcpCapabilityTypes[tempX] = eHdcpCapabilityType.HdcpAutoSupport;
-
- if ((inputCard.Card as DmcHd).HdmiInput.HdcpSupportOnFeedback.BoolValue)
- return 1;
- return 0;
- }
-
- if (inputCard.Card is DmcHdDsp)
- {
- InputCardHdcpCapabilityTypes[tempX] = eHdcpCapabilityType.HdcpAutoSupport;
-
- if ((inputCard.Card as DmcHdDsp).HdmiInput.HdcpSupportOnFeedback.BoolValue)
- return 1;
- return 0;
- }
- if (inputCard.Card is Dmc4kHdBase)
- {
- InputCardHdcpCapabilityTypes[tempX] = eHdcpCapabilityType.Hdcp2_2Support;
- return (int)(inputCard.Card as Dmc4kHdBase).HdmiInput.HdcpReceiveCapability;
- }
- if (inputCard.Card is Dmc4kHdDspBase)
- {
- if (PropertiesConfig.InputSlotSupportsHdcp2[tempX])
- {
- InputCardHdcpCapabilityTypes[tempX] = eHdcpCapabilityType.Hdcp2_2Support;
- return (int)(inputCard.Card as Dmc4kHdDspBase).HdmiInput.HdcpReceiveCapability;
- }
-
- InputCardHdcpCapabilityTypes[tempX] = eHdcpCapabilityType.HdcpAutoSupport;
- if ((inputCard.Card as Dmc4kHdDspBase).HdmiInput.HdcpSupportOnFeedback.BoolValue)
- return 1;
- return 0;
- }
-
- if (inputCard.Card is Dmc4kCBase)
- {
- if (PropertiesConfig.InputSlotSupportsHdcp2[tempX])
- {
- InputCardHdcpCapabilityTypes[tempX] = eHdcpCapabilityType.HdcpAutoSupport;
- return (int)(inputCard.Card as Dmc4kCBase).DmInput.HdcpReceiveCapability;
- }
-
- if ((inputCard.Card as Dmc4kCBase).DmInput.HdcpSupportOnFeedback.BoolValue)
- return 1;
- return 0;
- }
- if (inputCard.Card is Dmc4kCDspBase)
- {
- if (PropertiesConfig.InputSlotSupportsHdcp2[tempX])
- {
- InputCardHdcpCapabilityTypes[tempX] = eHdcpCapabilityType.HdcpAutoSupport;
- return (int)(inputCard.Card as Dmc4kCDspBase).DmInput.HdcpReceiveCapability;
- }
-
- if ((inputCard.Card as Dmc4kCDspBase).DmInput.HdcpSupportOnFeedback.BoolValue)
- return 1;
-
- return 0;
- }
- return 0;
- }
- catch (InvalidOperationException iopex)
- {
- Debug.Console(0, this, Debug.ErrorLogLevel.Warning, "The Input Card in slot: {0} supports HDCP 2. Please update the configuration value in the inputCardSupportsHdcp2 object to true. Error: {1}", tempX, iopex);
- return 0;
- }
- });
- InputStreamCardStateFeedbacks[tempX] = new IntFeedback(() =>
- {
- try
- {
- var inputCard = Chassis.Inputs[tempX];
-
- if (inputCard.Card is DmcStr)
- {
- Debug.Console(2, "Found input stream card in slot: {0}.", tempX);
- var streamCard = inputCard.Card as DmcStr;
- if (streamCard.Control.StartFeedback.BoolValue == true)
- return 1;
- else if (streamCard.Control.StopFeedback.BoolValue == true)
- return 2;
- else if (streamCard.Control.PauseFeedback.BoolValue == true)
- return 3;
- else
- return 0;
- }
- return 0;
- }
- catch (InvalidOperationException iopex)
- {
- Debug.Console(0, this, Debug.ErrorLogLevel.Warning, "Error adding input stream card in slot: {0}. Error: {1}", tempX, iopex);
- return 0;
- }
- });
- }
- }
- }
-
- private void ChassisOnBaseEvent(GenericBase device, BaseEventArgs args)
- {
-
- }
-
- private void RegisterForInputResolutionFeedback(IVideoAttributesBasic input, uint number, RoutingInputPortWithVideoStatuses inputPort)
- {
- if (input == null)
- {
- return;
- }
-
- Debug.Console(1, this, "Registering for resolution feedback for input {0} using Routing Port {1}", number, inputPort.Key);
-
- input.VideoAttributes.AttributeChange += (sender, args) =>
- {
- Debug.Console(1, this, "Input {0} resolution updated", number);
-
- Debug.Console(1, this, "Updating resolution feedback for input {0}", number);
- inputPort.VideoStatus.VideoResolutionFeedback.FireUpdate();
- };
- }
-
- ///
- ///
- ///
- ///
- ///
- public void AddInputCard(string type, uint number)
- {
- Debug.Console(2, this, "Adding input card '{0}', slot {1}", type, number);
-
- type = type.ToLower();
-
- switch (type)
- {
- case "dmchd":
- {
- var inputCard = new DmcHd(number, Chassis);
- AddHdmiInCardPorts(number, inputCard.HdmiInput, inputCard.HdmiInput);
- }
- break;
- case "dmchddsp":
- {
- var inputCard = new DmcHdDsp(number, Chassis);
- AddHdmiInCardPorts(number, inputCard.HdmiInput, inputCard.HdmiInput);
- }
- break;
- case "dmc4khd":
- {
- var inputCard = new Dmc4kHd(number, Chassis);
- AddHdmiInCardPorts(number, inputCard.HdmiInput, inputCard.HdmiInput);
- }
- break;
- case "dmc4khddsp":
- {
- var inputCard = new Dmc4kHdDsp(number, Chassis);
- AddHdmiInCardPorts(number, inputCard.HdmiInput, inputCard.HdmiInput);
- }
- break;
- case "dmc4kzhd":
- {
- var inputCard = new Dmc4kzHd(number, Chassis);
- AddHdmiInCardPorts(number, inputCard.HdmiInput, inputCard.HdmiInput);
- break;
- }
- case "dmc4kzhddsp":
- {
- var inputCard = new Dmc4kzHdDsp(number, Chassis);
- AddHdmiInCardPorts(number, inputCard.HdmiInput, inputCard.HdmiInput);
- break;
- }
- case "dmcc":
- {
- var inputCard = new DmcC(number, Chassis);
- //DmInput doesn't implement ICec...cast was resulting in null anyway
- AddDmInCardPorts(number, null, inputCard.DmInput);
- }
- break;
- case "dmccdsp":
- {
- var inputCard = new DmcCDsp(number, Chassis);
- //DmInput doesn't implement ICec...cast was resulting in null anyway
- AddDmInCardPorts(number, null, inputCard.DmInput);
- break;
- }
-
- case "dmc4kc":
- {
- var inputCard = new Dmc4kC(number, Chassis);
- AddDmInCardPorts(number, inputCard.DmInput,inputCard.DmInput);
- break;
- }
-
- case "dmc4kcdsp":
- {
- var inputCard = new Dmc4kCDsp(number, Chassis);
- AddDmInCardPorts(number, inputCard.DmInput,inputCard.DmInput);
- break;
- }
-
- case "dmc4kzc":
- {
- var inputCard = new Dmc4kzC(number, Chassis);
- AddDmInCardPorts(number, inputCard.DmInput,inputCard.DmInput);
- break;
- }
-
- case "dmc4kzcdsp":
- {
- var inputCard = new Dmc4kzCDsp(number, Chassis);
- AddDmInCardPorts(number, inputCard.DmInput, inputCard.DmInput);
- break;
- }
-
- case "dmccat":
- {
- var inputCard = new DmcCat(number, Chassis);
- AddDmInCardPorts(number, null, inputCard.DmInput);
- break;
- }
- case "dmccatdsp":
- {
- var inputCard = new DmcCatDsp(number, Chassis);
- AddDmInCardPorts(number, null, inputCard.DmInput);
- break;
- }
- case "dmcs":
- {
- var inputCard = new DmcS(number, Chassis);
- AddInputPortWithDebug(number, "dmIn", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmMmFiber, null, inputCard.DmInput);
- AddInCardHdmiAndAudioLoopPorts(number);
- break;
- }
- case "dmcsdsp":
- {
- var inputCard = new DmcSDsp(number, Chassis);
- AddInputPortWithDebug(number, "dmIn", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmMmFiber, null, inputCard.DmInput);
- AddInCardHdmiAndAudioLoopPorts(number);
- break;
- }
- case "dmcs2":
- {
- var inputCard = new DmcS2(number, Chassis);
- AddInputPortWithDebug(number, "dmIn", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmSmFiber, null, inputCard.DmInput);
- AddInCardHdmiAndAudioLoopPorts(number);
- break;
- }
- case "dmcs2dsp":
- {
- var inputCard = new DmcS2Dsp(number, Chassis);
- AddInputPortWithDebug(number, "dmIn", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmSmFiber, null, inputCard.DmInput);
- AddInCardHdmiAndAudioLoopPorts(number);
- break;
- }
- case "dmcsdi":
- {
- var inputCard = new DmcSdi(number, Chassis);
- AddInputPortWithDebug(number, "sdiIn", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Sdi, null, inputCard.SdiInput);
- AddOutputPortWithDebug(string.Format("inputCard{0}", number), "sdiOut", eRoutingSignalType.Audio | eRoutingSignalType.Video,
- eRoutingPortConnectionType.Sdi, null);
- AddInCardHdmiAndAudioLoopPorts(number);
- break;
- }
- case "dmcdvi":
- {
- var inputCard = new DmcDvi(number, Chassis);
- AddInputPortWithDebug(number, "dviIn", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Dvi, null, inputCard.DviInput);
- AddInputPortWithDebug(number, "audioIn", eRoutingSignalType.Audio, eRoutingPortConnectionType.LineAudio);
- AddInCardHdmiLoopPort(number);
- break;
- }
- case "dmcvga":
- {
- var inputCard = new DmcVga(number, Chassis);
- AddInputPortWithDebug(number, "vgaIn", eRoutingSignalType.Video, eRoutingPortConnectionType.Vga, null, inputCard.VgaInput);
- AddInputPortWithDebug(number, "audioIn", eRoutingSignalType.Audio, eRoutingPortConnectionType.LineAudio);
- AddInCardHdmiLoopPort(number);
- break;
- }
- case "dmcvidbnc":
- {
- var inputCard = new DmcVidBnc(number, Chassis);
- AddInputPortWithDebug(number, "componentIn", eRoutingSignalType.Video, eRoutingPortConnectionType.Component, null, inputCard.VideoInput);
- AddInputPortWithDebug(number, "audioIn", eRoutingSignalType.Audio, eRoutingPortConnectionType.LineAudio);
- AddInCardHdmiLoopPort(number);
- break;
- }
- case "dmcvidrcaa":
- {
- var inputCard = new DmcVidRcaA(number, Chassis);
- AddInputPortWithDebug(number, "componentIn", eRoutingSignalType.Video, eRoutingPortConnectionType.Component, null, inputCard.VideoInput);
- AddInputPortWithDebug(number, "audioIn", eRoutingSignalType.Audio, eRoutingPortConnectionType.LineAudio);
- AddInCardHdmiLoopPort(number);
- break;
- }
- case "dmcvidrcad":
- {
- var inputCard = new DmcVidRcaD(number, Chassis);
- AddInputPortWithDebug(number, "componentIn", eRoutingSignalType.Video, eRoutingPortConnectionType.Component, null, inputCard.VideoInput);
- AddInputPortWithDebug(number, "audioIn", eRoutingSignalType.Audio, eRoutingPortConnectionType.DigitalAudio);
- AddInCardHdmiLoopPort(number);
- break;
- }
- case "dmcvid4":
- {
- var inputCard = new DmcVid4(number, Chassis);
- AddInputPortWithDebug(number, "compositeIn1", eRoutingSignalType.Video, eRoutingPortConnectionType.Composite);
- AddInputPortWithDebug(number, "compositeIn2", eRoutingSignalType.Video, eRoutingPortConnectionType.Composite);
- AddInputPortWithDebug(number, "compositeIn3", eRoutingSignalType.Video, eRoutingPortConnectionType.Composite);
- AddInputPortWithDebug(number, "compositeIn4", eRoutingSignalType.Video, eRoutingPortConnectionType.Composite);
- AddInCardHdmiLoopPort(number);
- break;
- }
- case "dmcstr":
- {
- var inputCard = new DmcStr(number, Chassis);
- AddInputPortWithDebug(number, "streamIn", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Streaming, null, inputCard.Source);
- AddInCardHdmiAndAudioLoopPorts(number);
- break;
- }
- }
- }
-
- void AddDmInCardPorts(uint number)
- {
- AddInputPortWithDebug(number, "dmIn", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmCat);
- AddInCardHdmiAndAudioLoopPorts(number);
- }
-
- void AddDmInCardPorts(uint number, ICec cecPort)
- {
- AddInputPortWithDebug(number, "dmIn", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmCat, cecPort);
- AddInCardHdmiAndAudioLoopPorts(number);
- }
-
- void AddDmInCardPorts(uint number, ICec cecPort, IVideoAttributesBasic videoAttributes)
- {
- AddInputPortWithDebug(number, "dmIn", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmCat, cecPort, videoAttributes);
- AddInCardHdmiAndAudioLoopPorts(number);
- }
-
- void AddHdmiInCardPorts(uint number, ICec cecPort)
- {
- AddInputPortWithDebug(number, "hdmiIn", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, cecPort);
- AddInCardHdmiAndAudioLoopPorts(number);
- }
-
- void AddHdmiInCardPorts(uint number, ICec cecPort, IVideoAttributesBasic videoAttributes)
- {
- AddInputPortWithDebug(number, "hdmiIn", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, cecPort, videoAttributes);
- AddInCardHdmiAndAudioLoopPorts(number);
- }
-
- void AddInCardHdmiAndAudioLoopPorts(uint number)
- {
- AddOutputPortWithDebug(string.Format("inputCard{0}", number), "hdmiLoopOut", eRoutingSignalType.Audio | eRoutingSignalType.Video,
- eRoutingPortConnectionType.Hdmi, null);
- AddOutputPortWithDebug(string.Format("inputCard{0}", number), "audioLoopOut", eRoutingSignalType.Audio, eRoutingPortConnectionType.Hdmi, null);
- }
-
- void AddInCardHdmiLoopPort(uint number)
- {
- AddOutputPortWithDebug(string.Format("inputCard{0}", number), "hdmiLoopOut", eRoutingSignalType.Audio | eRoutingSignalType.Video,
- eRoutingPortConnectionType.Hdmi, null);
- }
-
- ///
- ///
- ///
- ///
- ///
- public void AddOutputCard(string type, uint number)
- {
- type = type.ToLower();
-
- Debug.Console(2, this, "Adding output card '{0}', slot {1}", type, number);
- switch (type)
- {
- case "dmc4khdo":
- {
- var outputCard = new Dmc4kHdoSingle(number, Chassis);
- var cecPort1 = outputCard.Card1.HdmiOutput;
- var cecPort2 = outputCard.Card2.HdmiOutput;
- AddDmcHdoPorts(number, cecPort1, cecPort2);
- }
- break;
- case "dmc4kzhdo":
- {
- var outputCard = new Dmc4kzHdoSingle(number, Chassis);
- var cecPort1 = outputCard.Card1.HdmiOutput;
- var cecPort2 = outputCard.Card2.HdmiOutput;
- AddDmcHdoPorts(number, cecPort1, cecPort2);
- }
- break;
- case "dmchdo":
- {
- var outputCard = new DmcHdoSingle(number, Chassis);
- var cecPort1 = outputCard.Card1.HdmiOutput;
- var cecPort2 = outputCard.Card2.HdmiOutput;
- AddDmcHdoPorts(number, cecPort1, cecPort2);
- }
- break;
- case "dmc4kcohd":
- {
- var outputCard = new Dmc4kCoHdSingle(number, Chassis);
- var cecPort1 = outputCard.Card1.HdmiOutput;
- AddDmcCoPorts(number, cecPort1);
- }
- break;
- case "dmc4kzcohd":
- {
- var outputCard = new Dmc4kzCoHdSingle(number, Chassis);
- var cecPort1 = outputCard.Card1.HdmiOutput;
- AddDmcCoPorts(number, cecPort1);
- }
- break;
- case "dmccohd":
- {
- var outputCard = new DmcCoHdSingle(number, Chassis);
- var cecPort1 = outputCard.Card1.HdmiOutput;
- AddDmcCoPorts(number, cecPort1);
- }
- break;
- case "dmccatohd":
- {
- var outputCard = new DmcCatoHdSingle(number, Chassis);
- var cecPort1 = outputCard.Card1.HdmiOutput;
- AddDmcCoPorts(number, cecPort1);
- }
- break;
- case "dmcsohd":
- {
- var outputCard = new DmcSoHdSingle(number, Chassis);
- var cecPort1 = outputCard.Card1.HdmiOutput;
- AddOutputPortWithDebug(string.Format("outputCard{0}", number), "dmOut1", eRoutingSignalType.Audio | eRoutingSignalType.Video,
- eRoutingPortConnectionType.DmMmFiber, Chassis.Outputs[2 * (number - 1) + 1]);
- AddOutputPortWithDebug(string.Format("outputCard{0}", number), "hdmiOut1", eRoutingSignalType.Audio | eRoutingSignalType.Video,
- eRoutingPortConnectionType.Hdmi, Chassis.Outputs[2 * (number - 1) + 1], cecPort1);
- AddOutputPortWithDebug(string.Format("outputCard{0}", number), "dmOut2", eRoutingSignalType.Audio | eRoutingSignalType.Video,
- eRoutingPortConnectionType.DmMmFiber, Chassis.Outputs[2 * (number - 1) + 2]);
- }
- break;
- case "dmcs2ohd":
- {
- var outputCard = new DmcS2oHdSingle(number, Chassis);
- var cecPort1 = outputCard.Card1.HdmiOutput;
- AddOutputPortWithDebug(string.Format("outputCard{0}", number), "dmOut1", eRoutingSignalType.Audio | eRoutingSignalType.Video,
- eRoutingPortConnectionType.DmSmFiber, Chassis.Outputs[2 * (number - 1) + 1]);
- AddOutputPortWithDebug(string.Format("outputCard{0}", number), "hdmiOut1", eRoutingSignalType.Audio | eRoutingSignalType.Video,
- eRoutingPortConnectionType.Hdmi, Chassis.Outputs[2 * (number - 1) + 1], cecPort1);
- AddOutputPortWithDebug(string.Format("outputCard{0}", number), "dmOut2", eRoutingSignalType.Audio | eRoutingSignalType.Video,
- eRoutingPortConnectionType.DmSmFiber, Chassis.Outputs[2 * (number - 1) + 2]);
- }
- break;
- case "dmcstro":
- AddOutputPortWithDebug(string.Format("outputCard{0}", number), "streamOut", eRoutingSignalType.Audio | eRoutingSignalType.Video,
- eRoutingPortConnectionType.Streaming, Chassis.Outputs[2 * (number - 1) + 1]);
- break;
- default:
- Debug.Console(1, this, " WARNING: Output card type '{0}' is not available", type);
- break;
- }
- }
-
- void AddDmcHdoPorts(uint number, ICec cecPort1, ICec cecPort2)
- {
- AddOutputPortWithDebug(string.Format("outputCard{0}", number), "hdmiOut1", eRoutingSignalType.Audio | eRoutingSignalType.Video,
- eRoutingPortConnectionType.Hdmi, Chassis.Outputs[2 * (number - 1) + 1], cecPort1);
- AddOutputPortWithDebug(string.Format("outputCard{0}", number), "audioOut1", eRoutingSignalType.Audio, eRoutingPortConnectionType.LineAudio,
- Chassis.Outputs[2 * (number - 1) + 1]);
- AddOutputPortWithDebug(string.Format("outputCard{0}", number), "hdmiOut2", eRoutingSignalType.Audio | eRoutingSignalType.Video,
- eRoutingPortConnectionType.Hdmi, Chassis.Outputs[2 * (number - 1) + 2], cecPort2);
- AddOutputPortWithDebug(string.Format("outputCard{0}", number), "audioOut2", eRoutingSignalType.Audio, eRoutingPortConnectionType.LineAudio,
- Chassis.Outputs[2 * (number - 1) + 2]);
- }
-
- void AddDmcCoPorts(uint number, ICec cecPort1)
- {
- AddOutputPortWithDebug(string.Format("outputCard{0}", number), "dmOut1", eRoutingSignalType.Audio | eRoutingSignalType.Video,
- eRoutingPortConnectionType.DmCat, Chassis.Outputs[2 * (number - 1) + 1]);
- AddOutputPortWithDebug(string.Format("outputCard{0}", number), "hdmiOut1", eRoutingSignalType.Audio | eRoutingSignalType.Video,
- eRoutingPortConnectionType.Hdmi, Chassis.Outputs[2 * (number - 1) + 1], cecPort1);
- AddOutputPortWithDebug(string.Format("outputCard{0}", number), "dmOut2", eRoutingSignalType.Audio | eRoutingSignalType.Video,
- eRoutingPortConnectionType.DmCat, Chassis.Outputs[2 * (number - 1) + 2]);
- }
-
- ///
- /// Adds InputPort
- ///
- void AddInputPortWithDebug(uint cardNum, string portName, eRoutingSignalType sigType, eRoutingPortConnectionType portType)
- {
- //Cast is necessary here to determine the correct overload
- AddInputPortWithDebug(cardNum, portName, sigType, portType, null, null);
- }
-
- private void AddInputPortWithDebug(uint cardNum, string portName, eRoutingSignalType sigType,
- eRoutingPortConnectionType portType, ICec cecPort)
- {
- //Cast is necessary here to determine the correct overload
- AddInputPortWithDebug(cardNum, portName, sigType, portType, cecPort, null);
- }
-
- ///
- /// Adds InputPort and sets Port as ICec object. If videoAttributesBasic is defined, RoutingPort will be RoutingInputPortWithVideoStatuses
- ///
- void AddInputPortWithDebug(uint cardNum, string portName, eRoutingSignalType sigType, eRoutingPortConnectionType portType, ICec cecPort, IVideoAttributesBasic videoAttributesBasic)
- {
- var portKey = string.Format("inputCard{0}--{1}", cardNum, portName);
- Debug.Console(2, this, "Adding input port '{0}'", portKey);
-
- RoutingInputPort inputPort;
-
- if (videoAttributesBasic != null)
- {
- Debug.Console(1, this, "card {0} supports IVideoAttributesBasic", cardNum);
- var statusFuncs = new VideoStatusFuncsWrapper
- {
- VideoResolutionFeedbackFunc = () =>
- {
- var resolution = videoAttributesBasic.VideoAttributes.GetVideoResolutionString();
- Debug.Console(1, this, "Updating resolution for input {0}. New resolution: {1}", cardNum, resolution);
- return resolution;
- }
- };
- inputPort = new RoutingInputPortWithVideoStatuses(portKey, sigType, portType,
- Chassis.Inputs[cardNum], this, statusFuncs)
- {
- FeedbackMatchObject = Chassis.Inputs[cardNum]
- };
-
- RegisterForInputResolutionFeedback(videoAttributesBasic, cardNum, inputPort as RoutingInputPortWithVideoStatuses);
- }
- else
- {
- inputPort = new RoutingInputPort(portKey, sigType, portType,
- Chassis.Inputs[cardNum], this)
- {
- FeedbackMatchObject = Chassis.Inputs[cardNum]
- };
- }
-
- if (cecPort != null)
- inputPort.Port = cecPort;
-
- InputPorts.Add(inputPort);
- }
-
- ///
- /// Adds OutputPort
- ///
- void AddOutputPortWithDebug(string cardName, string portName, eRoutingSignalType sigType, eRoutingPortConnectionType portType, object selector)
- {
- AddOutputPortWithDebug(cardName, portName, sigType, portType, selector, null);
- }
-
- ///
- /// Adds OutputPort and sets Port as ICec object
- ///
- void AddOutputPortWithDebug(string cardName, string portName, eRoutingSignalType sigType, eRoutingPortConnectionType portType, object selector, ICec cecPort)
- {
- var portKey = string.Format("{0}--{1}", cardName, portName);
- Debug.Console(2, this, "Adding output port '{0}'", portKey);
- var outputPort = new RoutingOutputPort(portKey, sigType, portType, selector, this);
-
- if (portName.IndexOf("Loop", StringComparison.InvariantCultureIgnoreCase) < 0)
- {
- outputPort.FeedbackMatchObject = selector;
- }
- if (cecPort != null)
- outputPort.Port = cecPort;
-
- OutputPorts.Add(outputPort);
- }
-
- ///
- ///
- ///
- void AddVolumeControl(uint number, Audio.Output audio)
- {
- VolumeControls.Add(number, new DmCardAudioOutputController(audio));
- }
-
- //public void SetInputHdcpSupport(uint input, ePdtHdcpSupport hdcpSetting)
- //{
-
- //}
-
- void Chassis_DMSystemChange(Switch device, DMSystemEventArgs args)
- {
- switch (args.EventId)
- {
- case DMSystemEventIds.SystemIdEventId:
- {
- Debug.Console(2, this, "SystemIdEvent Value: {0}", (Chassis as DmMDMnxn).SystemIdFeedback.UShortValue);
- SystemIdFeebdack.FireUpdate();
- break;
- }
- case DMSystemEventIds.SystemIdBusyEventId:
- {
- Debug.Console(2, this, "SystemIdBusyEvent State: {0}", (Chassis as DmMDMnxn).SystemIdBusy.BoolValue);
- SystemIdBusyFeedback.FireUpdate();
- break;
- }
- case DMSystemEventIds.AudioBreakawayEventId:
- {
- Debug.Console(2, this, "AudioBreakaway Event: value: {0}",
- (Chassis as DmMDMnxn).EnableAudioBreakawayFeedback.BoolValue);
- EnableAudioBreakawayFeedback.FireUpdate();
- break;
- }
- case DMSystemEventIds.USBBreakawayEventId:
- {
- Debug.Console(2, this, "USBBreakaway Event: value: {0}",
- (Chassis as DmMDMnxn).EnableUSBBreakawayFeedback.BoolValue);
- EnableUsbBreakawayFeedback.FireUpdate();
- break;
- }
- }
- }
-
- void Chassis_DMInputChange(Switch device, DMInputEventArgs args)
- {
- try
- {
- switch (args.EventId)
- {
- case DMInputEventIds.EndpointOnlineEventId:
- {
- Debug.Console(2, this, "DM Input EndpointOnlineEventId for input: {0}. State: {1}", args.Number, device.Inputs[args.Number].EndpointOnlineFeedback);
- InputEndpointOnlineFeedbacks[args.Number].FireUpdate();
- break;
- }
- case DMInputEventIds.OnlineFeedbackEventId:
- {
- Debug.Console(2, this, "DM Input OnlineFeedbackEventId for input: {0}. State: {1}", args.Number, device.Inputs[args.Number].EndpointOnlineFeedback);
- InputEndpointOnlineFeedbacks[args.Number].FireUpdate();
- break;
- }
- case DMInputEventIds.VideoDetectedEventId:
- {
- Debug.Console(2, this, "DM Input {0} VideoDetectedEventId", args.Number);
- VideoInputSyncFeedbacks[args.Number].FireUpdate();
- break;
- }
- case DMInputEventIds.InputNameEventId:
- {
- Debug.Console(2, this, "DM Input {0} NameFeedbackEventId", args.Number);
- InputNameFeedbacks[args.Number].FireUpdate();
- break;
- }
- case DMInputEventIds.UsbRoutedToEventId:
- {
- Debug.Console(2, this, "DM Input {0} UsbRoutedToEventId", args.Number);
- if (UsbInputRoutedToFeebacks[args.Number] != null)
- UsbInputRoutedToFeebacks[args.Number].FireUpdate();
- else
- Debug.Console(1, this, "No index of {0} found in UsbInputRoutedToFeedbacks");
- break;
- }
- case DMInputEventIds.HdcpCapabilityFeedbackEventId:
- {
- Debug.Console(2, this, "DM Input {0} HdcpCapabilityFeedbackEventId", args.Number);
- if (InputCardHdcpStateFeedbacks[args.Number] != null)
- InputCardHdcpStateFeedbacks[args.Number].FireUpdate();
- else
- Debug.Console(1, this, "No index of {0} found in InputCardHdcpCapabilityFeedbacks");
- break;
- }
- case DMInputEventIds.HdcpSupportOffEventId:
- {
- Debug.Console(2, this, "DM Input {0} HdcpSupportOffEventId", args.Number);
- if (InputCardHdcpStateFeedbacks[args.Number] != null)
- InputCardHdcpStateFeedbacks[args.Number].FireUpdate();
- else
- Debug.Console(1, this, "No index of {0} found in InputCardHdcpCapabilityFeedbacks");
- break;
- }
- case DMInputEventIds.HdcpSupportOnEventId:
- {
- Debug.Console(2, this, "DM Input {0} HdcpSupportOnEventId", args.Number);
- if (InputCardHdcpStateFeedbacks[args.Number] != null)
- InputCardHdcpStateFeedbacks[args.Number].FireUpdate();
- else
- Debug.Console(1, this, "No index of {0} found in InputCardHdcpCapabilityFeedbacks");
- break;
- }
- case DMInputEventIds.StartEventId:
- case DMInputEventIds.StopEventId:
- case DMInputEventIds.PauseEventId:
- {
- Debug.Console(2, this, "DM Input {0} Stream Status EventId", args.Number);
- if (InputStreamCardStateFeedbacks[args.Number] != null)
- {
- InputStreamCardStateFeedbacks[args.Number].FireUpdate();
- }
- else
- Debug.Console(2, this, "No index of {0} found in InputStreamCardStateFeedbacks");
- break;
- }
- case DMInputEventIds.HorizontalResolutionFeedbackEventId:
- case DMInputEventIds.VerticalResolutionFeedbackEventId:
- case DMInputEventIds.FramesPerSecondFeedbackEventId:
- case DMInputEventIds.ResolutionEventId:
- {
- Debug.Console(1, this, "Input {0} resolution updated", args.Number);
- var inputPort =
- InputPorts.Cast()
- .FirstOrDefault((ip) => ip.Key.Contains(String.Format("inputCard{0}", args.Number)));
-
- if (inputPort != null)
- {
- Debug.Console(1, this, "Updating resolution feedback for input {0}", args.Number);
- inputPort.VideoStatus.VideoResolutionFeedback.FireUpdate();
- }
- break;
- }
- default:
- {
- Debug.Console(2, this, "DMInputChange fired for Input {0} with Unhandled EventId: {1}", args.Number, args.EventId);
- break;
- }
- }
- }
- catch (Exception ex)
- {
- Debug.Console(2, this, Debug.ErrorLogLevel.Error, "Error in Chassis_DMInputChange: {0}", ex);
- }
- }
-
- ///
- ///
- /// Raise an event when the status of a switch object changes.
- ///
- /// Arguments defined as IKeyName sender, output, input, and eRoutingSignalType
- private void OnSwitchChange(RoutingNumericEventArgs e)
- {
- var newEvent = NumericSwitchChange;
- if (newEvent != null) newEvent(this, e);
- }
-
- ///
- ///
- void Chassis_DMOutputChange(Switch device, DMOutputEventArgs args)
- {
- var output = args.Number;
-
- switch (args.EventId)
- {
- case DMOutputEventIds.VolumeEventId:
- {
- if (VolumeControls.ContainsKey(output))
- {
- VolumeControls[args.Number].VolumeEventFromChassis();
- }
-
- break;
- }
- case DMOutputEventIds.EndpointOnlineEventId:
- {
- Debug.Console(2, this, "Output {0} DMOutputEventIds.EndpointOnlineEventId fired. State: {1}", args.Number,
- Chassis.Outputs[output].EndpointOnlineFeedback);
- OutputEndpointOnlineFeedbacks[output].FireUpdate();
- break;
- }
- case DMOutputEventIds.OnlineFeedbackEventId:
- {
- Debug.Console(2, this, "Output {0} DMInputEventIds.OnlineFeedbackEventId fired. State: {1}", args.Number,
- Chassis.Outputs[output].EndpointOnlineFeedback);
- OutputEndpointOnlineFeedbacks[output].FireUpdate();
- break;
- }
- case DMOutputEventIds.VideoOutEventId:
- {
-
- var inputNumber = Chassis.Outputs[output].VideoOutFeedback == null ? 0 : Chassis.
- Outputs[output].VideoOutFeedback.Number;
-
- Debug.Console(2, this, "DMSwitchVideo:{0} Routed Input:{1} Output:{2}'", Name, inputNumber, output);
-
- if (VideoOutputFeedbacks.ContainsKey(output))
- {
- var localInputPort = InputPorts.FirstOrDefault(p => (DMInput)p.FeedbackMatchObject == Chassis.Outputs[output].VideoOutFeedback);
- var localOutputPort =
- OutputPorts.FirstOrDefault(p => (DMOutput) p.FeedbackMatchObject == Chassis.Outputs[output]);
-
-
- VideoOutputFeedbacks[output].FireUpdate();
- OnSwitchChange(new RoutingNumericEventArgs(output,
- inputNumber,
- localOutputPort,
- localInputPort,
- eRoutingSignalType.Video));
- }
-
- if (OutputVideoRouteNameFeedbacks.ContainsKey(output))
- OutputVideoRouteNameFeedbacks[output].FireUpdate();
-
- break;
- }
- case DMOutputEventIds.AudioOutEventId:
- {
- var inputNumber = Chassis.Outputs[output].AudioOutFeedback == null ? 0 : Chassis.
- Outputs[output].AudioOutFeedback.Number;
-
- Debug.Console(2, this, "DMSwitchAudio:{0} Routed Input:{1} Output:{2}'", Name, inputNumber, output);
-
- if (AudioOutputFeedbacks.ContainsKey(output))
- {
- var localInputPort = InputPorts.FirstOrDefault(p => (DMInput)p.FeedbackMatchObject == Chassis.Outputs[output].AudioOutFeedback);
- var localOutputPort =
- OutputPorts.FirstOrDefault(p => (DMOutput)p.FeedbackMatchObject == Chassis.Outputs[output]);
-
-
- AudioOutputFeedbacks[output].FireUpdate();
- OnSwitchChange(new RoutingNumericEventArgs(output,
- inputNumber,
- localOutputPort,
- localInputPort,
- eRoutingSignalType.Audio));
- }
-
- if (OutputAudioRouteNameFeedbacks.ContainsKey(output))
- OutputAudioRouteNameFeedbacks[output].FireUpdate();
-
- break;
- }
- case DMOutputEventIds.OutputNameEventId:
- {
- Debug.Console(2, this, "DM Output {0} NameFeedbackEventId", output);
- OutputNameFeedbacks[output].FireUpdate();
- break;
- }
- case DMOutputEventIds.UsbRoutedToEventId:
- {
- Debug.Console(2, this, "DM Output {0} UsbRoutedToEventId", args.Number);
- UsbOutputRoutedToFeebacks[args.Number].FireUpdate();
- break;
- }
- case DMOutputEventIds.DisabledByHdcpEventId:
- {
- Debug.Console(2, this, "DM Output {0} DisabledByHdcpEventId", args.Number);
- OutputDisabledByHdcpFeedbacks[args.Number].FireUpdate();
- break;
- }
- case DMOutputEventIds.StartEventId:
- case DMOutputEventIds.StopEventId:
- case DMOutputEventIds.PauseEventId:
- {
- Debug.Console(2, this, "DM Output {0} Stream Status EventId", args.Number);
- if (OutputStreamCardStateFeedbacks[args.Number] != null)
- {
- OutputStreamCardStateFeedbacks[args.Number].FireUpdate();
- }
- else
- Debug.Console(2, this, "No index of {0} found in OutputStreamCardStateFeedbacks");
- break;
- }
- default:
- {
- Debug.Console(2, this, "DMOutputChange fired for Output {0} with Unhandled EventId: {1}", args.Number, args.EventId);
- break;
- }
- }
- }
-
- ///
- ///
- ///
- ///
- void StartOffTimer(PortNumberType pnt)
- {
- if (RouteOffTimers.ContainsKey(pnt))
- return;
- RouteOffTimers[pnt] = new CTimer(o => ExecuteSwitch(null, pnt.Selector, pnt.Type), RouteOffTime);
- }
-
- // Send out sigs when coming online
- void IsOnline_OutputChange(object sender, EventArgs e)
- {
- if (IsOnline.BoolValue)
- {
- (Chassis as DmMDMnxn).EnableAudioBreakaway.BoolValue = true;
- (Chassis as DmMDMnxn).EnableUSBBreakaway.BoolValue = true;
-
-
- EnableAudioBreakawayFeedback.FireUpdate();
- EnableUsbBreakawayFeedback.FireUpdate();
-
- if (InputNames != null)
- foreach (var kvp in InputNames)
- Chassis.Inputs[kvp.Key].Name.StringValue = kvp.Value;
- if (OutputNames != null)
- foreach (var kvp in OutputNames)
- Chassis.Outputs[kvp.Key].Name.StringValue = kvp.Value;
- }
- }
-
- #region IRouting Members
- public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType sigType)
- {
- Debug.Console(2, this, "Making an awesome DM route from {0} to {1} {2}", inputSelector, outputSelector, sigType);
-
- var input = inputSelector as DMInput;//Input Selector could be null...
-
- var output = outputSelector as DMOutput;
-
- var isUsbInput = (sigType & eRoutingSignalType.UsbInput) == eRoutingSignalType.UsbInput;
- var isUsbOutput = (sigType & eRoutingSignalType.UsbOutput) == eRoutingSignalType.UsbOutput;
-
- if (output == null && !(isUsbOutput || isUsbInput))
- {
- Debug.Console(0, this, Debug.ErrorLogLevel.Warning,
- "Unable to execute switch for inputSelector {0} to outputSelector {1}", inputSelector,
- outputSelector);
- return;
- }
-
- // Check to see if there's an off timer waiting on this and if so, cancel
- var key = new PortNumberType(output, sigType);
- if (input == null)
- {
- StartOffTimer(key);
- }
- else
- {
- if (RouteOffTimers.ContainsKey(key))
- {
- Debug.Console(2, this, "{0} cancelling route off due to new source", output);
- RouteOffTimers[key].Stop();
- RouteOffTimers.Remove(key);
- }
- }
-
- //var inCard = input == 0 ? null : Chassis.Inputs[input];
- //var outCard = input == 0 ? null : Chassis.Outputs[output];
-
- // NOTE THAT BITWISE COMPARISONS - TO CATCH ALL ROUTING TYPES
- if ((sigType & eRoutingSignalType.Video) == eRoutingSignalType.Video)
- {
- Chassis.VideoEnter.BoolValue = true;
- if (output != null)
- {
- output.VideoOut = input; //Chassis.Outputs[output].VideoOut = inCard;
- }
- }
-
- if ((sigType & eRoutingSignalType.Audio) == eRoutingSignalType.Audio)
- {
- var dmMdMnxn = Chassis as DmMDMnxn;
- if (dmMdMnxn != null)
- {
- dmMdMnxn.AudioEnter.BoolValue = true;
- }
- if (output != null)
- {
- output.AudioOut = input;
- }
- }
-
- if ((sigType & eRoutingSignalType.UsbOutput) == eRoutingSignalType.UsbOutput)
-
- {
- Chassis.USBEnter.BoolValue = true;
- if (inputSelector == null && output != null)
- {
- //clearing the route is intended
- output.USBRoutedTo = null;
- return;
- }
-
- if (inputSelector != null && input == null)
- {
- //input selector is DMOutput...we're doing a out to out route
- var tempInput = inputSelector as DMOutput;
-
- if (tempInput == null || output == null)
- {
- return;
- }
- output.USBRoutedTo = tempInput;
- return;
- }
-
- if (input != null & output != null)
- {
- output.USBRoutedTo = input;
- }
- }
-
- if((sigType & eRoutingSignalType.UsbInput) != eRoutingSignalType.UsbInput)
- {
- return;
- }
-
- Chassis.USBEnter.BoolValue = true;
- if (output != null)
- {
- output.USBRoutedTo = input;
- return;
- }
- var tempOutput = outputSelector as DMInput;
-
- if (tempOutput == null)
- {
- Debug.Console(0, this, Debug.ErrorLogLevel.Warning,
- "Unable to execute switch for inputSelector {0} to outputSelector {1}", inputSelector,
- outputSelector);
- return;
- }
-
- tempOutput.USBRoutedTo = input;
- }
-
- #endregion
-
- #region IRoutingNumeric Members
-
- public void ExecuteNumericSwitch(ushort inputSelector, ushort outputSelector, eRoutingSignalType sigType)
- {
- var chassisSize = (uint)Chassis.NumberOfInputs; //need this to determine USB routing values 8x8 -> 1-8 is inputs 1-8, 17-24 is outputs 1-8
- //16x16 1-16 is inputs 1-16, 17-32 is outputs 1-16
- //32x32 1-32 is inputs 1-32, 33-64 is outputs 1-32
-
- DMInputOutputBase dmCard;
-
- //Routing Input to Input or Output to Input
- if ((sigType & eRoutingSignalType.UsbInput) == eRoutingSignalType.UsbInput)
- {
- Debug.Console(2, this, "Executing USB Input switch.\r\n in:{0} output: {1}", inputSelector, outputSelector);
- if (outputSelector > chassisSize)
- {
- uint outputIndex;
-
- if (chassisSize == 8)
- {
- outputIndex = (uint) inputSelector - 16;
- }
- else
- {
- outputIndex = inputSelector - chassisSize;
- }
- dmCard = Chassis.Outputs[outputIndex];
- }
- else
- {
- dmCard = Chassis.Inputs[inputSelector];
- }
-
- ExecuteSwitch(dmCard, Chassis.Inputs[outputSelector], sigType);
- return;
- }
- if ((sigType & eRoutingSignalType.UsbOutput) == eRoutingSignalType.UsbOutput)
- {
- Debug.Console(2, this, "Executing USB Output switch.\r\n in:{0} output: {1}", inputSelector, outputSelector);
-
- //routing Output to Output or Input to Output
- if (inputSelector > chassisSize)
- {
- //wanting to route an output to an output. Subtract chassis size and get output, unless it's 8x8
- //need this to determine USB routing values
- //8x8 -> 1-8 is inputs 1-8, 17-24 is outputs 1-8
- //16x16 1-16 is inputs 1-16, 17-32 is outputs 1-16
- //32x32 1-32 is inputs 1-32, 33-64 is outputs 1-32
- uint outputIndex;
-
- if (chassisSize == 8)
- {
- outputIndex = (uint) inputSelector - 16;
- }
- else
- {
- outputIndex = inputSelector - chassisSize;
- }
-
- dmCard = Chassis.Outputs[outputIndex];
- }
- else
- {
- dmCard = Chassis.Inputs[inputSelector];
- }
- Chassis.USBEnter.BoolValue = true;
-
- Debug.Console(2, this, "Routing USB for input {0} to {1}", inputSelector, dmCard);
- ExecuteSwitch(dmCard, Chassis.Outputs[outputSelector], sigType);
- return;
- }
-
- var inputCard = inputSelector == 0 ? null : Chassis.Inputs[inputSelector];
- var outputCard = Chassis.Outputs[outputSelector];
-
- ExecuteSwitch(inputCard, outputCard, sigType);
- }
-
- #endregion
-
- public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
- {
- var joinMap = GetJoinMap(joinStart, joinMapKey, bridge);
-
- Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
-
- LinkChassisToApi(trilist, joinMap);
-
- trilist.StringInput[joinMap.Name.JoinNumber].StringValue = this.Name;
-
- // Link up inputs & outputs
- for (uint i = 1; i <= Chassis.NumberOfOutputs; i++)
- {
- var ioSlot = i;
- var ioSlotJoin = ioSlot - 1;
-
- LinkRoutingJoinsToApi(trilist, joinMap, ioSlotJoin, ioSlot);
-
- if (TxDictionary.ContainsKey(ioSlot))
- {
- LinkTxToApi(trilist, ioSlot, joinMap, ioSlotJoin);
- }
- else
- {
- LinkHdmiInputToApi(trilist, ioSlot, joinMap, ioSlotJoin);
- LinkStreamInputToApi(trilist, ioSlot, joinMap, ioSlotJoin);
- }
-
- if (RxDictionary.ContainsKey(ioSlot))
- {
- LinkRxToApi(trilist, ioSlot, joinMap, ioSlotJoin);
- }
- else
- LinkStreamOutputToApi(trilist, ioSlot, joinMap, ioSlotJoin);
- }
- }
-
- private void LinkHdmiInputToApi(BasicTriList trilist, uint ioSlot, DmChassisControllerJoinMap joinMap, uint ioSlotJoin)
- {
- VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus.JoinNumber + ioSlotJoin]);
-
- var inputPort = InputPorts[string.Format("inputCard{0}--hdmiIn", ioSlot)];
- if (inputPort == null)
- {
- return;
- }
-
- Debug.Console(1, "Port value for input card {0} is set", ioSlot);
- var port = inputPort.Port;
-
- if (port == null)
- {
- return;
- }
- if (!(port is HdmiInputWithCEC))
- {
- Debug.Console(0, this, "HDMI Input port on card {0} does not support HDCP settings.", ioSlot);
- return;
- }
-
- Debug.Console(1, "Port is HdmiInputWithCec");
-
- var hdmiInPortWCec = port as HdmiInputWithCEC;
-
-
- SetHdcpStateAction(PropertiesConfig.InputSlotSupportsHdcp2[ioSlot], hdmiInPortWCec, joinMap.HdcpSupportState.JoinNumber + ioSlotJoin, trilist);
-
-
- InputCardHdcpStateFeedbacks[ioSlot].LinkInputSig(
- trilist.UShortInput[joinMap.HdcpSupportState.JoinNumber + ioSlotJoin]);
-
- if (InputCardHdcpCapabilityTypes.ContainsKey(ioSlot))
- {
- trilist.UShortInput[joinMap.HdcpSupportCapability.JoinNumber + ioSlotJoin].UShortValue =
- (ushort)InputCardHdcpCapabilityTypes[ioSlot];
- }
- else
- {
- trilist.UShortInput[joinMap.HdcpSupportCapability.JoinNumber + ioSlotJoin].UShortValue = 1;
- }
-
- var videoStatus = inputPort as RoutingInputPortWithVideoStatuses;
-
- if (videoStatus == null)
- {
- return;
- }
-
- Debug.Console(1, this, "Linking {0} to join {1} for resolution feedback.", videoStatus.Key, joinMap.InputCurrentResolution.JoinNumber + ioSlotJoin);
- videoStatus.VideoStatus.VideoResolutionFeedback.LinkInputSig(trilist.StringInput[joinMap.InputCurrentResolution.JoinNumber + ioSlotJoin]);
- }
-
- private void LinkStreamInputToApi(BasicTriList trilist, uint ioSlot, DmChassisControllerJoinMap joinMap, uint ioSlotJoin)
- {
- var inputPort = InputPorts[string.Format("inputCard{0}--streamIn", ioSlot)];
- if (inputPort == null)
- {
- return;
- }
- var streamCard = Chassis.Inputs[ioSlot].Card as DmcStr;
- var join = joinMap.InputStreamCardState.JoinNumber + ioSlotJoin;
-
- Debug.Console(1, "Port value for input card {0} is set as a stream card", ioSlot);
-
- trilist.SetUShortSigAction(join, s =>
- {
- if (s == 1)
- {
- Debug.Console(2, this, "Join {0} value {1}: Setting stream state to start", join, s);
- streamCard.Control.Start();
- }
- else if (s == 2)
- {
- Debug.Console(2, this, "Join {0} value {1}: Setting stream state to stop", join, s);
- streamCard.Control.Stop();
- }
- else if (s == 3)
- {
- Debug.Console(2, this, "Join {0} value {1}: Setting stream state to pause", join, s);
- streamCard.Control.Pause();
- }
- else
- {
- Debug.Console(2, this, "Join {0} value {1}: Ignore stream state", join, s);
- }
- });
-
- InputStreamCardStateFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[join]);
-
- trilist.UShortInput[join].UShortValue = InputStreamCardStateFeedbacks[ioSlot].UShortValue;
-
- var videoStatus = inputPort as RoutingInputPortWithVideoStatuses;
-
- if (videoStatus != null)
- {
- videoStatus.VideoStatus.VideoResolutionFeedback.LinkInputSig(trilist.StringInput[joinMap.InputCurrentResolution.JoinNumber + ioSlotJoin]);
- }
- }
-
- private void LinkStreamOutputToApi(BasicTriList trilist, uint ioSlot, DmChassisControllerJoinMap joinMap, uint ioSlotJoin)
- {
- var outputPort = OutputPorts[string.Format("outputCard{0}--streamOut", ioSlot)];
- if (outputPort == null)
- {
- return;
- }
- var streamCard = Chassis.Outputs[ioSlot].Card as DmcStroAV;
- var join = joinMap.OutputStreamCardState.JoinNumber + ioSlotJoin;
-
- Debug.Console(1, "Port value for output card {0} is set as a stream card", ioSlot);
-
- trilist.SetUShortSigAction(join, s =>
- {
- if (s == 1)
- {
- Debug.Console(2, this, "Join {0} value {1}: Setting stream state to start", join, s);
- streamCard.Control.Start();
- }
- else if (s == 2)
- {
- Debug.Console(2, this, "Join {0} value {1}: Setting stream state to stop", join, s);
- streamCard.Control.Stop();
- }
- else if (s == 3)
- {
- Debug.Console(2, this, "Join {0} value {1}: Setting stream state to pause", join, s);
- streamCard.Control.Pause();
- }
- else
- {
- Debug.Console(2, this, "Join {0} value {1}: Ignore stream state", join, s);
- }
- });
-
- OutputStreamCardStateFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[join]);
-
- trilist.UShortInput[join].UShortValue = OutputStreamCardStateFeedbacks[ioSlot].UShortValue;
- }
-
- private void LinkRxToApi(BasicTriList trilist, uint ioSlot, DmChassisControllerJoinMap joinMap, uint ioSlotJoin)
- {
- Debug.Console(2, "Creating Rx Feedbacks {0}", ioSlot);
- var rxKey = RxDictionary[ioSlot];
- var rxDevice = DeviceManager.GetDeviceForKey(rxKey) as DmRmcControllerBase;
- var hdBaseTDevice = DeviceManager.GetDeviceForKey(rxKey) as DmHdBaseTControllerBase;
- if (Chassis is DmMd8x8Cpu3 || Chassis is DmMd8x8Cpu3rps
- || Chassis is DmMd16x16Cpu3 || Chassis is DmMd16x16Cpu3rps
- || Chassis is DmMd32x32Cpu3 || Chassis is DmMd32x32Cpu3rps || hdBaseTDevice != null)
- {
- OutputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(
- trilist.BooleanInput[joinMap.OutputEndpointOnline.JoinNumber + ioSlotJoin]);
- }
- else if (rxDevice != null)
- {
- rxDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline.JoinNumber + ioSlotJoin]);
- }
- }
-
- private void LinkTxToApi(BasicTriList trilist, uint ioSlot, DmChassisControllerJoinMap joinMap, uint ioSlotJoin)
- {
- Debug.Console(1, "Setting up actions and feedbacks on input card {0}", ioSlot);
- VideoInputSyncFeedbacks[ioSlot].LinkInputSig(
- trilist.BooleanInput[joinMap.VideoSyncStatus.JoinNumber + ioSlotJoin]);
-
- Debug.Console(2, "Creating Tx Feedbacks {0}", ioSlot);
- var txKey = TxDictionary[ioSlot];
- var txDevice = DeviceManager.GetDeviceForKey(txKey) as BasicDmTxControllerBase;
-
- if (txDevice == null)
- {
- return;
- }
-
- LinkTxOnlineFeedbackToApi(trilist, ioSlot, joinMap, ioSlotJoin, txDevice);
-
- LinkBasicTxToApi(trilist, joinMap, ioSlot, ioSlotJoin, txDevice);
-
- LinkAdvancedTxToApi(trilist, joinMap, ioSlot, ioSlotJoin, txDevice);
- }
-
- private void LinkBasicTxToApi(BasicTriList trilist, DmChassisControllerJoinMap joinMap, uint ioSlot,
- uint ioSlotJoin, BasicDmTxControllerBase basicTransmitter)
- {
- var advTx = basicTransmitter as DmTxControllerBase;
-
- if (advTx != null)
- {
- return;
- }
- var inputPort = InputPorts[string.Format("inputCard{0}--dmIn", ioSlot)];
-
- if (inputPort == null)
- {
- return;
- }
- var port = inputPort.Port;
-
- if (!(port is DMInputPortWithCec))
- {
- Debug.Console(0, this, "DM Input port on card {0} does not support HDCP settings.", ioSlot);
- return;
- }
- Debug.Console(1, "Port is DMInputPortWithCec");
-
- var dmInPortWCec = port as DMInputPortWithCec;
-
- bool supportsHdcp2;
-
- //added in case the InputSlotSupportsHdcp2 section isn't included in the config, or this slot is left out.
- //if the key isn't in the dictionary, supportsHdcp2 will be false
-
- if(!PropertiesConfig.InputSlotSupportsHdcp2.TryGetValue(ioSlot, out supportsHdcp2))
- {
- Debug.Console(0, this, Debug.ErrorLogLevel.Warning,
- "Input Slot Supports HDCP2 setting not found for slot {0}. Setting to false. Program may not function as intended.",
- ioSlot);
- }
-
- SetHdcpStateAction(supportsHdcp2, dmInPortWCec,
- joinMap.HdcpSupportState.JoinNumber + ioSlotJoin, trilist);
-
- InputCardHdcpStateFeedbacks[ioSlot].LinkInputSig(
- trilist.UShortInput[joinMap.HdcpSupportState.JoinNumber + ioSlotJoin]);
-
- if (InputCardHdcpCapabilityTypes.ContainsKey(ioSlot))
- {
- trilist.UShortInput[joinMap.HdcpSupportCapability.JoinNumber + ioSlotJoin].UShortValue =
- (ushort) InputCardHdcpCapabilityTypes[ioSlot];
- }
- else
- {
- trilist.UShortInput[joinMap.HdcpSupportCapability.JoinNumber + ioSlotJoin].UShortValue = 1;
- }
-
- var videoStatus = inputPort as RoutingInputPortWithVideoStatuses;
-
- if (videoStatus == null)
- {
- return;
- }
- Debug.Console(1, this, "Linking {0} to join {1} for resolution feedback.", videoStatus.Key, joinMap.InputCurrentResolution.JoinNumber + ioSlotJoin);
- videoStatus.VideoStatus.VideoResolutionFeedback.LinkInputSig(trilist.StringInput[joinMap.InputCurrentResolution.JoinNumber + ioSlotJoin]);
- }
-
- private void LinkAdvancedTxToApi(BasicTriList trilist, DmChassisControllerJoinMap joinMap,
- uint ioSlot, uint ioSlotJoin, BasicDmTxControllerBase basicTransmitter)
- {
- var transmitter = basicTransmitter as DmTxControllerBase;
- if (transmitter == null) return;
-
- trilist.BooleanInput[joinMap.TxAdvancedIsPresent.JoinNumber + ioSlotJoin].BoolValue = true;
-
- transmitter.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(
- trilist.BooleanInput[joinMap.VideoSyncStatus.JoinNumber + ioSlotJoin]);
-
- var txRoutingInputs = transmitter as IRoutingInputs;
-
- if (txRoutingInputs == null) return;
-
- var inputPorts =
- txRoutingInputs.InputPorts.Where(
- (p) => p.Port is EndpointHdmiInput || p.Port is EndpointDisplayPortInput).ToList();
-
- if (inputPorts.Count == 0)
- {
- Debug.Console(1, this, "No HDCP-capable input ports found on transmitter for slot {0}", ioSlot);
- return;
- }
-
- bool supportsHdcp2;
-
- if (!PropertiesConfig.InputSlotSupportsHdcp2.TryGetValue(ioSlot, out supportsHdcp2))
- {
- Debug.Console(0, this, Debug.ErrorLogLevel.Warning,
- "Input Slot Supports HDCP2 setting not found for slot {0}. Setting to false. Program may not function as intended.",
- ioSlot);
- }
-
- SetHdcpStateAction(supportsHdcp2, inputPorts, joinMap.HdcpSupportState.JoinNumber + ioSlotJoin, trilist);
-
- if (transmitter.HdcpStateFeedback != null)
- {
- transmitter.HdcpStateFeedback.LinkInputSig(
- trilist.UShortInput[joinMap.HdcpSupportState.JoinNumber + ioSlotJoin]);
- }
- else
- {
- Debug.Console(2, this, "Transmitter Hdcp Feedback null. Linking to card's feedback");
- InputCardHdcpStateFeedbacks[ioSlot].LinkInputSig(
- trilist.UShortInput[joinMap.HdcpSupportState.JoinNumber + ioSlotJoin]);
- }
-
- trilist.UShortInput[joinMap.HdcpSupportCapability.JoinNumber + ioSlotJoin].UShortValue =
- (ushort) transmitter.HdcpSupportCapability;
-
-
- var videoStatus =
- InputPorts[string.Format("inputCard{0}--dmIn", ioSlot)] as RoutingInputPortWithVideoStatuses;
-
- if (videoStatus == null)
- {
- return;
- }
- Debug.Console(1, this, "Linking {0} to join {1} for resolution feedback.", videoStatus.Key,
- joinMap.InputCurrentResolution.JoinNumber + ioSlotJoin);
- videoStatus.VideoStatus.VideoResolutionFeedback.LinkInputSig(
- trilist.StringInput[joinMap.InputCurrentResolution.JoinNumber + ioSlotJoin]);
- }
-
- private void LinkTxOnlineFeedbackToApi(BasicTriList trilist, uint ioSlot, DmChassisControllerJoinMap joinMap,
- uint ioSlotJoin, BasicDmTxControllerBase txDevice)
- {
- var advancedTxDevice = txDevice as DmTxControllerBase;
-
- if ((Chassis is DmMd8x8Cpu3 || Chassis is DmMd8x8Cpu3rps
- || Chassis is DmMd16x16Cpu3 || Chassis is DmMd16x16Cpu3rps
- || Chassis is DmMd32x32Cpu3 || Chassis is DmMd32x32Cpu3rps) ||
- advancedTxDevice == null)
- {
- Debug.Console(2, "Linking Tx Online Feedback from Input Card {0}", ioSlot);
- InputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(
- trilist.BooleanInput[joinMap.InputEndpointOnline.JoinNumber + ioSlotJoin]);
- return;
- }
-
- Debug.Console(2, "Linking Tx Online Feedback from Advanced Transmitter at input {0}", ioSlot);
-
- advancedTxDevice.IsOnline.LinkInputSig(
- trilist.BooleanInput[joinMap.InputEndpointOnline.JoinNumber + ioSlotJoin]);
- }
-
- private void LinkRoutingJoinsToApi(BasicTriList trilist, DmChassisControllerJoinMap joinMap, uint ioSlotJoin,
- uint ioSlot)
- {
- // Routing Control
- trilist.SetUShortSigAction(joinMap.OutputVideo.JoinNumber + ioSlotJoin,
- o => ExecuteNumericSwitch(o, (ushort) ioSlot, eRoutingSignalType.Video));
- trilist.SetUShortSigAction(joinMap.OutputAudio.JoinNumber + ioSlotJoin,
- o => ExecuteNumericSwitch(o, (ushort) ioSlot, eRoutingSignalType.Audio));
- trilist.SetUShortSigAction(joinMap.OutputUsb.JoinNumber + ioSlotJoin,
- o => ExecuteNumericSwitch(o, (ushort) ioSlot, eRoutingSignalType.UsbOutput));
- trilist.SetUShortSigAction(joinMap.InputUsb.JoinNumber + ioSlotJoin,
- o => ExecuteNumericSwitch(o, (ushort) ioSlot, eRoutingSignalType.UsbInput));
-
- //Routing Feedbacks
- VideoOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputVideo.JoinNumber + ioSlotJoin]);
- AudioOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputAudio.JoinNumber + ioSlotJoin]);
- UsbOutputRoutedToFeebacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputUsb.JoinNumber + ioSlotJoin]);
- UsbInputRoutedToFeebacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.InputUsb.JoinNumber + ioSlotJoin]);
-
- OutputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputNames.JoinNumber + ioSlotJoin]);
- InputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.InputNames.JoinNumber + ioSlotJoin]);
- OutputVideoRouteNameFeedbacks[ioSlot].LinkInputSig(
- trilist.StringInput[joinMap.OutputCurrentVideoInputNames.JoinNumber + ioSlotJoin]);
- OutputAudioRouteNameFeedbacks[ioSlot].LinkInputSig(
- trilist.StringInput[joinMap.OutputCurrentAudioInputNames.JoinNumber + ioSlotJoin]);
-
- OutputDisabledByHdcpFeedbacks[ioSlot].LinkInputSig(
- trilist.BooleanInput[joinMap.OutputDisabledByHdcp.JoinNumber + ioSlotJoin]);
- }
-
- private void LinkChassisToApi(BasicTriList trilist, DmChassisControllerJoinMap joinMap)
- {
- var chassis = Chassis as DmMDMnxn;
-
- IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]);
-
- trilist.SetUShortSigAction(joinMap.SystemId.JoinNumber, o =>
- {
- if (chassis != null)
- {
- chassis.SystemId.UShortValue = o;
- }
- });
-
- trilist.SetSigTrueAction(joinMap.SystemId.JoinNumber, () =>
- {
- if (chassis != null)
- {
- chassis.ApplySystemId();
- }
- });
-
- SystemIdFeebdack.LinkInputSig(trilist.UShortInput[joinMap.SystemId.JoinNumber]);
- SystemIdBusyFeedback.LinkInputSig(trilist.BooleanInput[joinMap.SystemId.JoinNumber]);
-
- EnableAudioBreakawayFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableAudioBreakaway.JoinNumber]);
- EnableUsbBreakawayFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableUsbBreakaway.JoinNumber]);
-
- trilist.SetString(joinMap.NoRouteName.JoinNumber, NoRouteText);
-
- trilist.OnlineStatusChange += (o, a) =>
- {
- if (!a.DeviceOnLine)
- {
- return;
- }
-
- EnableAudioBreakawayFeedback.FireUpdate();
- EnableUsbBreakawayFeedback.FireUpdate();
- SystemIdBusyFeedback.FireUpdate();
- SystemIdFeebdack.FireUpdate();
-
- trilist.SetString(joinMap.NoRouteName.JoinNumber, NoRouteText);
- };
- }
-
- private DmChassisControllerJoinMap GetJoinMap(uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
- {
- var joinMap = new DmChassisControllerJoinMap(joinStart);
-
- var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
-
- if (!string.IsNullOrEmpty(joinMapSerialized))
- {
- joinMap = JsonConvert.DeserializeObject(joinMapSerialized);
- }
-
- if (bridge != null)
- {
- bridge.AddJoinMap(Key, joinMap);
- }
- else
- {
- Debug.Console(0, this,
- "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
- }
- return joinMap;
- }
-
- private void SetHdcpStateAction(bool supportsHdcp2, HdmiInputWithCEC port, uint join, BasicTriList trilist)
- {
- if (!supportsHdcp2)
- {
- trilist.SetUShortSigAction(join,
- s =>
- {
- if (s == 0)
- {
- Debug.Console(2, this, "Join {0} value {1} Setting HdcpSupport to off", join, s);
- port.HdcpSupportOff();
- }
- else if (s > 0)
- {
- Debug.Console(2, this, "Join {0} value {1} Setting HdcpSupport to on", join, s);
- port.HdcpSupportOn();
- }
- });
- }
- else
- {
- trilist.SetUShortSigAction(join,
- u =>
- {
- Debug.Console(2, this, "Join {0} value {1} Setting HdcpReceiveCapability to: {2}", join, u, (eHdcpCapabilityType)u);
- port.HdcpReceiveCapability = (eHdcpCapabilityType)u;
- });
- }
- }
-
- private void SetHdcpStateAction(bool supportsHdcp2, EndpointHdmiInput port, uint join, BasicTriList trilist)
- {
- if (!supportsHdcp2)
- {
- trilist.SetUShortSigAction(join,
- s =>
- {
- if (s == 0)
- {
- Debug.Console(2, this, "Join {0} value {1} Setting HdcpSupport to off", join, s);
- port.HdcpSupportOff();
- }
- else if (s > 0)
- {
- Debug.Console(2, this, "Join {0} value {1} Setting HdcpSupport to on", join, s);
- port.HdcpSupportOn();
- }
- });
- }
- else
- {
- trilist.SetUShortSigAction(join,
- u =>
- {
- Debug.Console(2, this, "Join {0} value {1} Setting HdcpReceiveCapability to: {2}", join, u, (eHdcpCapabilityType)u);
- port.HdcpCapability = (eHdcpCapabilityType)u;
- });
- }
- }
-
- private void SetHdcpStateAction(bool supportsHdcp2, List ports, uint join,
- BasicTriList triList)
- {
- if (!supportsHdcp2)
- {
- triList.SetUShortSigAction(join, a =>
- {
- foreach (var tempPort in ports.Select(port => port.Port).OfType())
- {
- if (a == 0)
- {
- tempPort.HdcpSupportOff();
- }
- else if (a > 0)
- {
- tempPort.HdcpSupportOn();
- }
- }
- });
- }
- else
- {
- triList.SetUShortSigAction(join, a =>
- {
- foreach (var tempPort in ports.Select(port => port.Port).OfType())
- {
- tempPort.HdcpCapability = (eHdcpCapabilityType) a;
- }
- });
- }
- }
-
- private void SetHdcpStateAction(bool supportsHdcp2, DMInputPortWithCec port, uint join, BasicTriList trilist)
- {
- if (!supportsHdcp2)
- {
- trilist.SetUShortSigAction(join,
- s =>
- {
- if (s == 0)
- {
- port.HdcpSupportOff();
- }
- else if (s > 0)
- {
- port.HdcpSupportOn();
- }
- });
- }
- else
- {
- trilist.SetUShortSigAction(join,
- u =>
- {
- port.HdcpReceiveCapability = (eHdcpCapabilityType)u;
- });
- }
- }
- }
-
- public struct PortNumberType
- {
- public uint Number { get; private set; }
- public object Selector { get; private set; }
- public eRoutingSignalType Type { get; private set; }
-
- public PortNumberType(object selector, eRoutingSignalType type)
- : this()
- {
- Selector = selector;
- Type = type;
-
- if (Selector is DMOutput)
- {
- Number = (selector as DMOutput).Number;
- }
- else if (Selector is uint)
- {
- Number = (uint) selector;
- }
- }
- }
-
- public class DmChassisControllerFactory : EssentialsDeviceFactory
- {
- public DmChassisControllerFactory()
- {
- TypeNames = new List() { "dmmd8x8", "dmmd8x8rps", "dmmd8x8cpu3", "dmmd8x8cpu3rps",
- "dmmd16x16", "dmmd16x16rps", "dmmd16x16cpu3", "dmmd16x16cpu3rps",
- "dmmd32x32", "dmmd32x32rps", "dmmd32x32cpu3", "dmmd32x32cpu3rps",
- "dmmd64x64", "dmmd128x128" };
- }
-
- public override EssentialsDevice BuildDevice(DeviceConfig dc)
- {
- var type = dc.Type.ToLower();
-
- Debug.Console(1, "Factory Attempting to create new DmChassisController Device");
-
- if (type.StartsWith("dmmd8x") || type.StartsWith("dmmd16x") || type.StartsWith("dmmd32x"))
- {
-
- var props = JsonConvert.DeserializeObject
- (dc.Properties.ToString());
- return DmChassisController.
- GetDmChassisController(dc.Key, dc.Name, type, props);
- }
- else if (type.StartsWith("dmmd128x") || type.StartsWith("dmmd64x"))
- {
- var props = JsonConvert.DeserializeObject
- (dc.Properties.ToString());
- return DmBladeChassisController.
- GetDmChassisController(dc.Key, dc.Name, type, props);
- }
-
- return null;
- }
- }
-
-}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.DM/Chassis/DmpsAudioOutputController.cs b/src/PepperDash.Essentials.DM/Chassis/DmpsAudioOutputController.cs
deleted file mode 100644
index 291492c9..00000000
--- a/src/PepperDash.Essentials.DM/Chassis/DmpsAudioOutputController.cs
+++ /dev/null
@@ -1,705 +0,0 @@
-extern alias Full;
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Crestron.SimplSharp;
-using Crestron.SimplSharpPro;
-using Crestron.SimplSharpPro.DeviceSupport;
-using Crestron.SimplSharpPro.DM;
-using Crestron.SimplSharpPro.DM.Cards;
-using Full.Newtonsoft.Json;
-using PepperDash.Core;
-using PepperDash.Essentials.Core;
-using PepperDash.Essentials.Core.Bridges;
-using PepperDash.Essentials.DM.Config;
-
-
-namespace PepperDash.Essentials.DM
-{
- ///
- /// Exposes the volume levels for Program, Aux1, Aux2, Codec1, Codec2, and Digital outputs on a DMPS3 chassis
- ///
- public class DmpsAudioOutputController : EssentialsBridgeableDevice
- {
- public DmpsAudioOutput MasterVolumeLevel { get; private set; }
- public DmpsAudioOutput SourceVolumeLevel { get; private set; }
- public DmpsAudioOutput MicsMasterVolumeLevel { get; private set; }
- public DmpsAudioOutput Codec1VolumeLevel { get; private set; }
- public DmpsAudioOutput Codec2VolumeLevel { get; private set; }
-
- public DmpsAudioOutputController(string key, string name, DMOutput card, Card.Dmps3DmHdmiAudioOutput.Dmps3AudioOutputStream stream)
- : base(key, name)
- {
- card.BaseDevice.DMOutputChange += new DMOutputEventHandler(BaseDevice_DMOutputChange);
- var output = new Dmps3AudioOutputWithMixerBase(stream);
- MasterVolumeLevel = new DmpsAudioOutputWithMixer(output, eDmpsLevelType.Master);
- SourceVolumeLevel = new DmpsAudioOutput(output, eDmpsLevelType.Source);
- }
- public DmpsAudioOutputController(string key, string name, DMOutput card, Card.Dmps3DmHdmiAudioOutput.Dmps3DmHdmiOutputStream stream)
- : base(key, name)
- {
- card.BaseDevice.DMOutputChange += new DMOutputEventHandler(BaseDevice_DMOutputChange);
- var output = new Dmps3AudioOutputWithMixerBase(stream);
- MasterVolumeLevel = new DmpsAudioOutputWithMixer(output, eDmpsLevelType.Master);
- SourceVolumeLevel = new DmpsAudioOutput(output, eDmpsLevelType.Source);
- }
-
- public DmpsAudioOutputController(string key, string name, Card.Dmps3OutputBase card)
- : base(key, name)
- {
- card.BaseDevice.DMOutputChange += new DMOutputEventHandler(BaseDevice_DMOutputChange);
-
- if (card is Card.Dmps3ProgramOutput)
- {
- var programOutput = card as Card.Dmps3ProgramOutput;
- var output = new Dmps3AudioOutputWithMixerBase(card, programOutput.OutputMixer);
- MasterVolumeLevel = new DmpsAudioOutputWithMixerAndEq(output, eDmpsLevelType.Master, programOutput.OutputEqualizer);
- SourceVolumeLevel = new DmpsAudioOutput(output, eDmpsLevelType.Source);
- MicsMasterVolumeLevel = new DmpsAudioOutput(output, eDmpsLevelType.MicsMaster);
- Codec1VolumeLevel = new DmpsAudioOutput(output, eDmpsLevelType.Codec1);
- Codec2VolumeLevel = new DmpsAudioOutput(output, eDmpsLevelType.Codec2);
- }
- else if (card is Card.Dmps3Aux1Output)
- {
- var auxOutput = card as Card.Dmps3Aux1Output;
- var output = new Dmps3AudioOutputWithMixerBase(card, auxOutput.OutputMixer);
- MasterVolumeLevel = new DmpsAudioOutputWithMixerAndEq(output, eDmpsLevelType.Master, auxOutput.OutputEqualizer);
- SourceVolumeLevel = new DmpsAudioOutput(output, eDmpsLevelType.Source);
- MicsMasterVolumeLevel = new DmpsAudioOutput(output, eDmpsLevelType.MicsMaster);
- Codec2VolumeLevel = new DmpsAudioOutput(output, eDmpsLevelType.Codec2);
- }
- else if (card is Card.Dmps3Aux2Output)
- {
- var auxOutput = card as Card.Dmps3Aux2Output;
- var output = new Dmps3AudioOutputWithMixerBase(card, auxOutput.OutputMixer);
- MasterVolumeLevel = new DmpsAudioOutputWithMixerAndEq(output, eDmpsLevelType.Master, auxOutput.OutputEqualizer);
- SourceVolumeLevel = new DmpsAudioOutput(output, eDmpsLevelType.Source);
- MicsMasterVolumeLevel = new DmpsAudioOutput(output, eDmpsLevelType.MicsMaster);
- Codec1VolumeLevel = new DmpsAudioOutput(output, eDmpsLevelType.Codec1);
- }
- else if (card is Card.Dmps3DigitalMixOutput)
- {
- var mixOutput = card as Card.Dmps3DigitalMixOutput;
- var output = new Dmps3AudioOutputWithMixerBase(card, mixOutput.OutputMixer);
- MasterVolumeLevel = new DmpsAudioOutputWithMixer(output, eDmpsLevelType.Master);
- SourceVolumeLevel = new DmpsAudioOutput(output, eDmpsLevelType.Source);
- MicsMasterVolumeLevel = new DmpsAudioOutput(output, eDmpsLevelType.MicsMaster);
- }
- else if (card is Card.Dmps3HdmiOutput)
- {
- var hdmiOutput = card as Card.Dmps3HdmiOutput;
- var output = new Dmps3AudioOutputWithMixerBase(card, hdmiOutput.OutputMixer);
- MasterVolumeLevel = new DmpsAudioOutputWithMixer(output, eDmpsLevelType.Master);
- SourceVolumeLevel = new DmpsAudioOutput(output, eDmpsLevelType.Source);
- MicsMasterVolumeLevel = new DmpsAudioOutput(output, eDmpsLevelType.MicsMaster);
- }
- else if (card is Card.Dmps3DmOutput)
- {
- var dmOutput = card as Card.Dmps3DmOutput;
- var output = new Dmps3AudioOutputWithMixerBase(card, dmOutput.OutputMixer);
- MasterVolumeLevel = new DmpsAudioOutputWithMixer(output, eDmpsLevelType.Master);
- SourceVolumeLevel = new DmpsAudioOutput(output, eDmpsLevelType.Source);
- MicsMasterVolumeLevel = new DmpsAudioOutput(output, eDmpsLevelType.MicsMaster);
- }
- }
-
- void BaseDevice_DMOutputChange(Switch device, DMOutputEventArgs args)
- {
- Debug.Console(2, this, "Dmps Audio Controller Event Output: {0} EventId: {1}", args.Number, args.EventId.ToString());
- switch (args.EventId)
- {
- case DMOutputEventIds.OutputVuFeedBackEventId:
- {
- //Frequently called event that isn't needed
- return;
- }
- case DMOutputEventIds.MasterVolumeFeedBackEventId:
- {
- MasterVolumeLevel.VolumeLevelFeedback.FireUpdate();
- MasterVolumeLevel.VolumeLevelScaledFeedback.FireUpdate();
- break;
- }
- case DMOutputEventIds.MasterMuteOnFeedBackEventId:
- {
- MasterVolumeLevel.MuteFeedback.FireUpdate();
- break;
- }
- case DMOutputEventIds.SourceLevelFeedBackEventId:
- {
- SourceVolumeLevel.VolumeLevelFeedback.FireUpdate();
- SourceVolumeLevel.VolumeLevelScaledFeedback.FireUpdate();
- break;
- }
- case DMOutputEventIds.SourceMuteOnFeedBackEventId:
- {
- SourceVolumeLevel.MuteFeedback.FireUpdate();
- break;
- }
- case DMOutputEventIds.MicMasterLevelFeedBackEventId:
- {
- MicsMasterVolumeLevel.VolumeLevelFeedback.FireUpdate();
- MicsMasterVolumeLevel.VolumeLevelScaledFeedback.FireUpdate();
- break;
- }
- case DMOutputEventIds.MicMasterMuteOnFeedBackEventId:
- {
- MicsMasterVolumeLevel.MuteFeedback.FireUpdate();
- break;
- }
- case DMOutputEventIds.Codec1LevelFeedBackEventId:
- {
- if (Codec1VolumeLevel != null)
- {
- Codec1VolumeLevel.VolumeLevelFeedback.FireUpdate();
- Codec1VolumeLevel.VolumeLevelScaledFeedback.FireUpdate();
- }
- break;
- }
- case DMOutputEventIds.Codec1MuteOnFeedBackEventId:
- {
- if (Codec1VolumeLevel != null)
- Codec1VolumeLevel.MuteFeedback.FireUpdate();
- break;
- }
- case DMOutputEventIds.Codec2LevelFeedBackEventId:
- {
- if (Codec2VolumeLevel != null)
- {
- Codec2VolumeLevel.VolumeLevelFeedback.FireUpdate();
- Codec2VolumeLevel.VolumeLevelScaledFeedback.FireUpdate();
- }
- break;
- }
- case DMOutputEventIds.Codec2MuteOnFeedBackEventId:
- {
- if (Codec2VolumeLevel != null)
- Codec2VolumeLevel.MuteFeedback.FireUpdate();
- break;
- }
- case DMOutputEventIds.MinVolumeFeedBackEventId:
- {
- Debug.Console(2, this, "MinVolumeFeedBackEventId: {0}", args.Index);
- var level = MasterVolumeLevel as DmpsAudioOutputWithMixer;
- if (level != null)
- {
- level.GetVolumeMin();
- }
- break;
- }
- case DMOutputEventIds.MaxVolumeFeedBackEventId:
- {
- Debug.Console(2, this, "MaxVolumeFeedBackEventId: {0}", args.Index);
- var level = MasterVolumeLevel as DmpsAudioOutputWithMixer;
- if (level != null)
- {
- level.GetVolumeMax();
- }
- break;
- }
- }
- }
-
- public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
- {
- var joinMap = new DmpsAudioOutputControllerJoinMap(joinStart);
-
- if (bridge != null)
- {
- bridge.AddJoinMap(Key, joinMap);
- }
- else
- {
- Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
- }
-
- Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
-
- if (MasterVolumeLevel != null)
- {
- SetUpDmpsAudioOutputJoins(trilist, MasterVolumeLevel, joinMap.MasterVolumeLevel.JoinNumber);
- var mixer = MasterVolumeLevel as DmpsAudioOutputWithMixer;
- if (mixer != null)
- {
- trilist.SetUShortSigAction(joinMap.MixerPresetRecall.JoinNumber, mixer.RecallPreset);
- }
- var eq = MasterVolumeLevel as DmpsAudioOutputWithMixerAndEq;
- if (eq != null)
- {
- trilist.SetUShortSigAction(joinMap.MixerEqPresetRecall.JoinNumber, eq.RecallEqPreset);
- }
- }
-
- if (SourceVolumeLevel != null)
- {
- SetUpDmpsAudioOutputJoins(trilist, SourceVolumeLevel, joinMap.SourceVolumeLevel.JoinNumber);
- }
-
- if (MicsMasterVolumeLevel != null)
- {
- SetUpDmpsAudioOutputJoins(trilist, MicsMasterVolumeLevel, joinMap.MicsMasterVolumeLevel.JoinNumber);
- }
-
- if (Codec1VolumeLevel != null)
- {
- SetUpDmpsAudioOutputJoins(trilist, Codec1VolumeLevel, joinMap.Codec1VolumeLevel.JoinNumber);
- }
-
- if (Codec2VolumeLevel != null)
- {
- SetUpDmpsAudioOutputJoins(trilist, Codec2VolumeLevel, joinMap.Codec2VolumeLevel.JoinNumber);
- }
- }
-
- static void SetUpDmpsAudioOutputJoins(BasicTriList trilist, DmpsAudioOutput output, uint joinStart)
- {
- var volumeLevelJoin = joinStart;
- var volumeLevelScaledJoin = joinStart + 1;
- var muteOnJoin = joinStart;
- var muteOffJoin = joinStart + 1;
- var volumeUpJoin = joinStart + 2;
- var volumeDownJoin = joinStart + 3;
- var sendScaledVolumeJoin = joinStart + 4;
-
- output.VolumeLevelFeedback.LinkInputSig(trilist.UShortInput[volumeLevelJoin]);
- output.VolumeLevelScaledFeedback.LinkInputSig(trilist.UShortInput[volumeLevelScaledJoin]);
-
- trilist.SetSigTrueAction(muteOnJoin, output.MuteOn);
- output.MuteFeedback.LinkInputSig(trilist.BooleanInput[muteOnJoin]);
- trilist.SetSigTrueAction(muteOffJoin, output.MuteOff);
- output.MuteFeedback.LinkComplementInputSig(trilist.BooleanInput[muteOffJoin]);
-
- trilist.SetBoolSigAction(volumeUpJoin, output.VolumeUp);
- trilist.SetBoolSigAction(volumeDownJoin, output.VolumeDown);
- trilist.SetBoolSigAction(sendScaledVolumeJoin, output.SendScaledVolume);
- trilist.SetUShortSigAction(volumeLevelJoin, output.SetVolume);
- trilist.SetUShortSigAction(volumeLevelScaledJoin, output.SetVolumeScaled);
- }
- }
-
- public class DmpsAudioOutputWithMixerAndEq : DmpsAudioOutputWithMixer
- {
- private CrestronControlSystem.Dmps3OutputEqualizer Eq;
- public DmpsAudioOutputWithMixerAndEq(Dmps3AudioOutputWithMixerBase output, eDmpsLevelType type, CrestronControlSystem.Dmps3OutputEqualizer eq)
- : base(output, type)
- {
- Eq = eq;
- }
-
- public void RecallEqPreset(ushort preset)
- {
- Eq.PresetNumber.UShortValue = preset;
- Eq.RecallPreset();
- }
- }
-
- public class DmpsAudioOutputWithMixer : DmpsAudioOutput
- {
- Dmps3AudioOutputWithMixerBase Output;
-
- public DmpsAudioOutputWithMixer(Dmps3AudioOutputWithMixerBase output, eDmpsLevelType type)
- : base(output, type)
- {
- Output = output;
- GetVolumeMax();
- GetVolumeMin();
- }
-
- public void GetVolumeMin()
- {
- MinLevel = (short)Output.MinVolumeFeedback.UShortValue;
- if (VolumeLevelScaledFeedback != null)
- {
- VolumeLevelScaledFeedback.FireUpdate();
- }
- }
-
- public void GetVolumeMax()
- {
- MaxLevel = (short)Output.MaxVolumeFeedback.UShortValue;
- if (VolumeLevelScaledFeedback != null)
- {
- VolumeLevelScaledFeedback.FireUpdate();
- }
- }
-
- public void RecallPreset(ushort preset)
- {
- Output.PresetNumber.UShortValue = preset;
- Output.RecallPreset();
-
- if (!Global.ControlSystemIsDmps4k3xxType)
- {
- //Recall startup volume for main volume level as DMPS3(non-4K) presets don't affect the main volume
- RecallStartupVolume();
- }
- }
-
- public void RecallStartupVolume()
- {
- ushort startupVol = Output.StartupVolumeFeedback.UShortValue;
- //Reset startup vol due to bug on DMPS3 where getting the value from above method clears the startup volume
- Output.StartupVolume.UShortValue = startupVol;
- Debug.Console(1, "DMPS Recalling Startup Volume {0}", startupVol);
- SetVolume(startupVol);
- MuteOff();
- }
- }
-
- public class DmpsAudioOutput : IBasicVolumeWithFeedback
- {
- private UShortInputSig Level;
- private bool EnableVolumeSend;
- private ushort VolumeLevelInput;
- protected short MinLevel { get; set; }
- protected short MaxLevel { get; set; }
-
- public eDmpsLevelType Type { get; private set; }
- public BoolFeedback MuteFeedback { get; private set; }
- public IntFeedback VolumeLevelFeedback { get; private set; }
- public IntFeedback VolumeLevelScaledFeedback { get; private set; }
-
- Action MuteOnAction;
- Action MuteOffAction;
- Action VolumeUpAction;
- Action VolumeDownAction;
-
- public DmpsAudioOutput(Dmps3AudioOutputBase output, eDmpsLevelType type)
- {
- VolumeLevelInput = 0;
- EnableVolumeSend = false;
- Type = type;
- MinLevel = -800;
- MaxLevel = 100;
-
- switch (type)
- {
- case eDmpsLevelType.Master:
- {
- Level = output.MasterVolume;
- MuteFeedback = new BoolFeedback(new Func(() => output.MasterMuteOnFeedBack.BoolValue));
- VolumeLevelFeedback = new IntFeedback(new Func(() => output.MasterVolumeFeedBack.UShortValue));
- MuteOnAction = new Action(output.MasterMuteOn);
- MuteOffAction = new Action(output.MasterMuteOff);
- VolumeUpAction = new Action((b) => output.MasterVolumeUp.BoolValue = b);
- VolumeDownAction = new Action((b) => output.MasterVolumeDown.BoolValue = b);
- break;
- }
- case eDmpsLevelType.MicsMaster:
- {
- if (output.Card is Card.Dmps3OutputBase)
- {
- var micOutput = output.Card as Card.Dmps3OutputBase;
- Level = micOutput.MicMasterLevel;
- MuteFeedback = new BoolFeedback(new Func(() => micOutput.MicMasterMuteOnFeedBack.BoolValue));
- VolumeLevelFeedback = new IntFeedback(new Func(() => micOutput.MicMasterLevelFeedBack.UShortValue));
- MuteOnAction = new Action(micOutput.MicMasterMuteOn);
- MuteOffAction = new Action(micOutput.MicMasterMuteOff);
- VolumeUpAction = new Action((b) => micOutput.MicMasterLevelUp.BoolValue = b);
- VolumeDownAction = new Action((b) => micOutput.MicMasterLevelDown.BoolValue = b);
- }
- break;
- }
- case eDmpsLevelType.Source:
- {
- Level = output.SourceLevel;
- MuteFeedback = new BoolFeedback(new Func(() => output.SourceMuteOnFeedBack.BoolValue));
- VolumeLevelFeedback = new IntFeedback(new Func(() => output.SourceLevelFeedBack.UShortValue));
- MuteOnAction = new Action(output.SourceMuteOn);
- MuteOffAction = new Action(output.SourceMuteOff);
- VolumeUpAction = new Action((b) => output.SourceLevelUp.BoolValue = b);
- VolumeDownAction = new Action((b) => output.SourceLevelDown.BoolValue = b);
- break;
- }
- case eDmpsLevelType.Codec1:
- {
- if (output.Card is Card.Dmps3ProgramOutput)
- {
- var programOutput = output.Card as Card.Dmps3ProgramOutput;
- Level = programOutput.Codec1Level;
- MuteFeedback = new BoolFeedback(new Func(() => programOutput.CodecMute1OnFeedback.BoolValue));
- VolumeLevelFeedback = new IntFeedback(new Func(() => programOutput.Codec1LevelFeedback.UShortValue));
- MuteOnAction = new Action(programOutput.Codec1MuteOn);
- MuteOffAction = new Action(programOutput.Codec1MuteOff);
- VolumeUpAction = new Action((b) => programOutput.Codec1LevelUp.BoolValue = b);
- VolumeDownAction = new Action((b) => programOutput.Codec1LevelDown.BoolValue = b);
- }
- else if (output.Card is Card.Dmps3Aux2Output)
- {
- var auxOutput = output.Card as Card.Dmps3Aux2Output;
- Level = auxOutput.Codec1Level;
- MuteFeedback = new BoolFeedback(new Func(() => auxOutput.CodecMute1OnFeedback.BoolValue));
- VolumeLevelFeedback = new IntFeedback(new Func(() => auxOutput.Codec1LevelFeedback.UShortValue));
- MuteOnAction = new Action(auxOutput.Codec1MuteOn);
- MuteOffAction = new Action(auxOutput.Codec1MuteOff);
- VolumeUpAction = new Action((b) => auxOutput.Codec1LevelUp.BoolValue = b);
- VolumeDownAction = new Action((b) => auxOutput.Codec1LevelDown.BoolValue = b);
- }
- break;
- }
- case eDmpsLevelType.Codec2:
- {
- if (output.Card is Card.Dmps3ProgramOutput)
- {
- var programOutput = output.Card as Card.Dmps3ProgramOutput;
- Level = programOutput.Codec2Level;
- MuteFeedback = new BoolFeedback(new Func(() => programOutput.CodecMute1OnFeedback.BoolValue));
- VolumeLevelFeedback = new IntFeedback(new Func(() => programOutput.Codec2LevelFeedback.UShortValue));
- MuteOnAction = new Action(programOutput.Codec2MuteOn);
- MuteOffAction = new Action(programOutput.Codec2MuteOff);
- VolumeUpAction = new Action((b) => programOutput.Codec2LevelUp.BoolValue = b);
- VolumeDownAction = new Action((b) => programOutput.Codec2LevelDown.BoolValue = b);
- }
- else if (output.Card is Card.Dmps3Aux1Output)
- {
- var auxOutput = output.Card as Card.Dmps3Aux1Output;
-
- Level = auxOutput.Codec2Level;
- MuteFeedback = new BoolFeedback(new Func(() => auxOutput.CodecMute2OnFeedback.BoolValue));
- VolumeLevelFeedback = new IntFeedback(new Func(() => auxOutput.Codec2LevelFeedback.UShortValue));
- MuteOnAction = new Action(auxOutput.Codec2MuteOn);
- MuteOffAction = new Action(auxOutput.Codec2MuteOff);
- VolumeUpAction = new Action((b) => auxOutput.Codec2LevelUp.BoolValue = b);
- VolumeDownAction = new Action((b) => auxOutput.Codec2LevelDown.BoolValue = b);
- }
- break;
- }
- }
- if (VolumeLevelFeedback != null)
- {
- VolumeLevelScaledFeedback = new IntFeedback(new Func(() => ScaleVolumeFeedback(VolumeLevelFeedback.UShortValue)));
- VolumeLevelFeedback.FireUpdate();
- VolumeLevelScaledFeedback.FireUpdate();
- }
- }
-
- public void SetVolumeScaled(ushort level)
- {
- if (ushort.MaxValue + MinLevel != 0)
- {
- VolumeLevelInput = (ushort)(level * (MaxLevel - MinLevel) / ushort.MaxValue + MinLevel);
- if (EnableVolumeSend == true)
- {
- Level.UShortValue = VolumeLevelInput;
- }
- }
- }
-
- public ushort ScaleVolumeFeedback(ushort level)
- {
- short signedLevel = (short)level;
-
- if (MaxLevel - MinLevel != 0)
- {
- return (ushort)((signedLevel - MinLevel) * ushort.MaxValue / (MaxLevel - MinLevel));
- }
- else
- return (ushort)MinLevel;
- }
-
- public void SendScaledVolume(bool pressRelease)
- {
- EnableVolumeSend = pressRelease;
- if (pressRelease == false)
- {
- SetVolumeScaled(VolumeLevelInput);
- }
- }
-
- #region IBasicVolumeWithFeedback Members
-
- public void SetVolume(ushort level)
- {
- Level.UShortValue = level;
- }
-
- public void MuteOn()
- {
- MuteOnAction();
- }
-
- public void MuteOff()
- {
- MuteOffAction();
- }
-
- #endregion
-
- #region IBasicVolumeControls Members
-
- public void VolumeUp(bool pressRelease)
- {
- VolumeUpAction(pressRelease);
- }
-
- public void VolumeDown(bool pressRelease)
- {
- VolumeDownAction(pressRelease);
- }
-
- public void MuteToggle()
- {
- if (MuteFeedback.BoolValue)
- MuteOff();
- else
- MuteOn();
- }
-
- #endregion
- }
-
- public class Dmps3AudioOutputWithMixerBase : Dmps3AudioOutputBase
- {
- public UShortOutputSig MinVolumeFeedback { get; private set; }
- public UShortOutputSig MaxVolumeFeedback { get; private set; }
- public UShortInputSig StartupVolume { get; private set; }
- public UShortOutputSig StartupVolumeFeedback { get; private set; }
- public UShortInputSig PresetNumber { get; private set; }
-
- public Action RecallPreset { get; private set; }
-
- public Dmps3AudioOutputWithMixerBase(Card.Dmps3OutputBase card, CrestronControlSystem.Dmps3OutputMixer mixer)
- : base(card)
- {
- MinVolumeFeedback = mixer.MinVolumeFeedback;
- MaxVolumeFeedback = mixer.MaxVolumeFeedback;
- StartupVolume = mixer.StartupVolume;
- StartupVolumeFeedback = mixer.StartupVolumeFeedback;
- PresetNumber = mixer.PresetNumber;
-
- RecallPreset = new Action(mixer.RecallPreset);
- }
-
- public Dmps3AudioOutputWithMixerBase(Card.Dmps3OutputBase card, CrestronControlSystem.Dmps3AttachableOutputMixer mixer)
- : base(card)
- {
- MinVolumeFeedback = mixer.MinVolumeFeedback;
- MaxVolumeFeedback = mixer.MaxVolumeFeedback;
- StartupVolume = mixer.StartupVolume;
- StartupVolumeFeedback = mixer.StartupVolumeFeedback;
- PresetNumber = mixer.PresetNumber;
-
- RecallPreset = new Action(mixer.RecallPreset);
- }
-
- public Dmps3AudioOutputWithMixerBase(Card.Dmps3DmHdmiAudioOutput.Dmps3AudioOutputStream stream)
- : base(stream)
- {
- var mixer = stream.OutputMixer;
- MinVolumeFeedback = mixer.MinVolumeFeedback;
- MaxVolumeFeedback = mixer.MaxVolumeFeedback;
- StartupVolume = mixer.StartupVolume;
- StartupVolumeFeedback = mixer.StartupVolumeFeedback;
- PresetNumber = stream.PresetNumber;
- RecallPreset = new Action(stream.RecallPreset);
- }
-
- public Dmps3AudioOutputWithMixerBase(Card.Dmps3DmHdmiAudioOutput.Dmps3DmHdmiOutputStream stream)
- : base(stream)
- {
- var mixer = stream.OutputMixer;
- MinVolumeFeedback = mixer.MinVolumeFeedback;
- MaxVolumeFeedback = mixer.MaxVolumeFeedback;
- StartupVolume = mixer.StartupVolume;
- StartupVolumeFeedback = mixer.StartupVolumeFeedback;
- PresetNumber = stream.PresetNumber;
- RecallPreset = new Action(stream.RecallPreset);
- }
- }
- public class Dmps3AudioOutputBase
- {
- public DMOutput Card { get; private set; }
- public BoolOutputSig MasterMuteOffFeedBack { get; private set; }
- public BoolOutputSig MasterMuteOnFeedBack { get; private set; }
- public UShortInputSig MasterVolume { get; private set; }
- public UShortOutputSig MasterVolumeFeedBack { get; private set; }
- public BoolInputSig MasterVolumeUp { get; private set; }
- public BoolInputSig MasterVolumeDown { get; private set; }
- public BoolOutputSig SourceMuteOffFeedBack { get; private set; }
- public BoolOutputSig SourceMuteOnFeedBack { get; private set; }
- public UShortInputSig SourceLevel { get; private set; }
- public UShortOutputSig SourceLevelFeedBack { get; private set; }
- public BoolInputSig SourceLevelUp { get; private set; }
- public BoolInputSig SourceLevelDown { get; private set; }
-
- public Action MasterMuteOff { get; private set; }
- public Action MasterMuteOn { get; private set; }
- public Action SourceMuteOff { get; private set; }
- public Action SourceMuteOn { get; private set; }
-
- public Dmps3AudioOutputBase(Card.Dmps3OutputBase card)
- {
- Card = card;
- MasterMuteOffFeedBack = card.MasterMuteOffFeedBack;
- MasterMuteOnFeedBack = card.MasterMuteOnFeedBack;
- MasterVolume = card.MasterVolume;
- MasterVolumeFeedBack = card.MasterVolumeFeedBack;
- MasterVolumeUp = card.MasterVolumeUp;
- MasterVolumeDown = card.MasterVolumeDown;
- SourceMuteOffFeedBack = card.SourceMuteOffFeedBack;
- SourceMuteOnFeedBack = card.SourceMuteOnFeedBack;
- SourceLevel = card.SourceLevel;
- SourceLevelFeedBack = card.SourceLevelFeedBack;
- SourceLevelUp = card.SourceLevelUp;
- SourceLevelDown = card.SourceLevelDown;
-
- MasterMuteOff = new Action(card.MasterMuteOff);
- MasterMuteOn = new Action(card.MasterMuteOn);
- SourceMuteOff = new Action(card.SourceMuteOff);
- SourceMuteOn = new Action(card.SourceMuteOn);
- }
-
- public Dmps3AudioOutputBase(Card.Dmps3DmHdmiAudioOutput.Dmps3AudioOutputStream stream)
- {
- MasterMuteOffFeedBack = stream.MasterMuteOffFeedBack;
- MasterMuteOnFeedBack = stream.MasterMuteOnFeedBack;
- MasterVolume = stream.MasterVolume;
- MasterVolumeFeedBack = stream.MasterVolumeFeedBack;
- MasterVolumeUp = stream.MasterVolumeUp;
- MasterVolumeDown = stream.MasterVolumeDown;
- SourceMuteOffFeedBack = stream.SourceMuteOffFeedBack;
- SourceMuteOnFeedBack = stream.SourceMuteOnFeedBack;
- SourceLevel = stream.SourceLevel;
- SourceLevelFeedBack = stream.SourceLevelFeedBack;
- SourceLevelUp = stream.SourceLevelUp;
- SourceLevelDown = stream.SourceLevelDown;
-
- MasterMuteOff = new Action(stream.MasterMuteOff);
- MasterMuteOn = new Action(stream.MasterMuteOn);
- SourceMuteOff = new Action(stream.SourceMuteOff);
- SourceMuteOn = new Action(stream.SourceMuteOn);
- }
-
- public Dmps3AudioOutputBase(Card.Dmps3DmHdmiAudioOutput.Dmps3DmHdmiOutputStream stream)
- {
- MasterMuteOffFeedBack = stream.MasterMuteOffFeedBack;
- MasterMuteOnFeedBack = stream.MasterMuteOnFeedBack;
- MasterVolume = stream.MasterVolume;
- MasterVolumeFeedBack = stream.MasterVolumeFeedBack;
- MasterVolumeUp = stream.MasterVolumeUp;
- MasterVolumeDown = stream.MasterVolumeDown;
- SourceMuteOffFeedBack = stream.SourceMuteOffFeedBack;
- SourceMuteOnFeedBack = stream.SourceMuteOnFeedBack;
- SourceLevel = stream.SourceLevel;
- SourceLevelFeedBack = stream.SourceLevelFeedBack;
- SourceLevelUp = stream.SourceLevelUp;
- SourceLevelDown = stream.SourceLevelDown;
-
- MasterMuteOff = new Action(stream.MasterMuteOff);
- MasterMuteOn = new Action(stream.MasterMuteOn);
- SourceMuteOff = new Action(stream.SourceMuteOff);
- SourceMuteOn = new Action(stream.SourceMuteOn);
- }
- }
-
- public enum eDmpsLevelType
- {
- Master,
- Source,
- MicsMaster,
- Codec1,
- Codec2,
- Mic
- }
-}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.DM/Chassis/DmpsDigitalOutputController.cs b/src/PepperDash.Essentials.DM/Chassis/DmpsDigitalOutputController.cs
deleted file mode 100644
index 70465783..00000000
--- a/src/PepperDash.Essentials.DM/Chassis/DmpsDigitalOutputController.cs
+++ /dev/null
@@ -1,165 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Crestron.SimplSharp;
-using Crestron.SimplSharpPro.DM;
-using Crestron.SimplSharpPro.DM.Cards;
-
-using PepperDash.Core;
-using PepperDash.Essentials.Core;
-
-
-namespace PepperDash.Essentials.DM
-{
- ///
- ///
- ///
- public class DmpsDigitalOutputController : Device, IRoutingNumeric, IHasFeedback
- {
- public Card.Dmps3OutputBase OutputCard { get; protected set; }
-
- public RoutingInputPort None { get; protected set; }
- public RoutingInputPort DigitalMix1 { get; protected set; }
- public RoutingInputPort DigitalMix2 { get; protected set; }
- public RoutingInputPort AudioFollowsVideo { get; protected set; }
-
- public RoutingOutputPort DigitalAudioOut { get; protected set; }
-
- public IntFeedback AudioSourceNumericFeedback { get; protected set; }
-
- ///
- /// Returns a list containing the Outputs that we want to expose.
- ///
- public FeedbackCollection Feedbacks { get; private set; }
-
- public virtual RoutingPortCollection InputPorts
- {
- get
- {
- return new RoutingPortCollection
- {
- None,
- DigitalMix1,
- DigitalMix2,
- AudioFollowsVideo
- };
- }
- }
-
- public RoutingPortCollection OutputPorts
- {
- get
- {
- return new RoutingPortCollection { DigitalAudioOut };
- }
- }
-
- public DmpsDigitalOutputController(string key, string name, Card.Dmps3OutputBase outputCard)
- : base(key, name)
- {
- Feedbacks = new FeedbackCollection();
- OutputCard = outputCard;
-
- if (outputCard is Card.Dmps3DmOutputBackend)
- {
- AudioSourceNumericFeedback = new IntFeedback(() =>
- {
- return (int)(outputCard as Card.Dmps3DmOutputBackend).AudioOutSourceDeviceFeedback;
- });
- DigitalAudioOut = new RoutingOutputPort(DmPortName.DmOut + OutputCard.Number, eRoutingSignalType.Audio, eRoutingPortConnectionType.DmCat, null, this);
- }
-
- else if (outputCard is Card.Dmps3HdmiOutputBackend)
- {
- AudioSourceNumericFeedback = new IntFeedback(() =>
- {
- return (int)(outputCard as Card.Dmps3HdmiOutputBackend).AudioOutSourceDeviceFeedback;
- });
- DigitalAudioOut = new RoutingOutputPort(DmPortName.HdmiOut + OutputCard.Number, eRoutingSignalType.Audio, eRoutingPortConnectionType.Hdmi, null, this);
- }
- else
- {
- return;
- }
-
- None = new RoutingInputPort("None", eRoutingSignalType.Audio, eRoutingPortConnectionType.DigitalAudio,
- eDmps34KAudioOutSourceDevice.NoRoute, this);
- DigitalMix1 = new RoutingInputPort("DigitalMix1", eRoutingSignalType.Audio, eRoutingPortConnectionType.DigitalAudio,
- eDmps34KAudioOutSourceDevice.DigitalMixer1, this);
- DigitalMix2 = new RoutingInputPort("DigitalMix2", eRoutingSignalType.Audio, eRoutingPortConnectionType.DigitalAudio,
- eDmps34KAudioOutSourceDevice.DigitalMixer2, this);
- AudioFollowsVideo = new RoutingInputPort("AudioFollowsVideo", eRoutingSignalType.Audio, eRoutingPortConnectionType.DigitalAudio,
- eDmps34KAudioOutSourceDevice.AudioFollowsVideo, this);
-
- AddToFeedbackList(AudioSourceNumericFeedback);
- }
-
- ///
- /// Adds feedback(s) to the list
- ///
- ///
- public void AddToFeedbackList(params Feedback[] newFbs)
- {
- foreach (var f in newFbs)
- {
- if (f != null)
- {
- if (!Feedbacks.Contains(f))
- {
- Feedbacks.Add(f);
- }
- }
- }
- }
-
- public virtual void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type)
- {
- Debug.Console(2, this, "Executing Numeric Switch to input {0}.", input);
-
- switch (input)
- {
- case 0:
- {
- ExecuteSwitch(None.Selector, null, type);
- break;
- }
- case 1:
- {
- ExecuteSwitch(DigitalMix1.Selector, null, type);
- break;
- }
- case 2:
- {
- ExecuteSwitch(DigitalMix2.Selector, null, type);
- break;
- }
- case 3:
- {
- ExecuteSwitch(AudioFollowsVideo.Selector, null, type);
- break;
- }
- }
-
- }
-
- #region IRouting Members
-
- public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType)
- {
- if ((signalType | eRoutingSignalType.Audio) == eRoutingSignalType.Audio)
- {
- if (OutputCard is Card.Dmps3DmOutputBackend)
- {
- (OutputCard as Card.Dmps3DmOutputBackend).AudioOutSourceDevice = (eDmps34KAudioOutSourceDevice)inputSelector;
- }
- else if (OutputCard is Card.Dmps3HdmiOutputBackend)
- {
- (OutputCard as Card.Dmps3HdmiOutputBackend).AudioOutSourceDevice = (eDmps34KAudioOutSourceDevice)inputSelector;
- }
- }
- }
-
- #endregion
- }
-}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.DM/Chassis/DmpsInternalVirtualDmTxController.cs b/src/PepperDash.Essentials.DM/Chassis/DmpsInternalVirtualDmTxController.cs
deleted file mode 100644
index c9c2f261..00000000
--- a/src/PepperDash.Essentials.DM/Chassis/DmpsInternalVirtualDmTxController.cs
+++ /dev/null
@@ -1,458 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Crestron.SimplSharp;
-using Crestron.SimplSharpPro.DM;
-using Crestron.SimplSharpPro.DM.Cards;
-
-using PepperDash.Core;
-using PepperDash.Essentials.Core;
-
-
-namespace PepperDash.Essentials.DM
-{
- ///
- ///
- ///
- public class DmpsInternalVirtualHdmiVgaInputController : Device, ITxRouting, IHasFeedback
- {
- public Card.Dmps3HdmiVgaInput InputCard { get; protected set; }
-
- public eHdcpCapabilityType HdcpSupportCapability { get; protected set; }
- public StringFeedback ActiveVideoInputFeedback { get; protected set; }
-
- public RoutingInputPortWithVideoStatuses HdmiIn { get; protected set; }
- public RoutingInputPortWithVideoStatuses VgaIn { get; protected set; }
- public RoutingInputPort AudioIn { get; protected set; }
- public RoutingInputPortWithVideoStatuses AnyVideoInput { get; protected set; }
-
- public RoutingOutputPort VirtualDmOut { get; protected set; }
-
- public IntFeedback VideoSourceNumericFeedback { get; protected set; }
- public IntFeedback AudioSourceNumericFeedback { get; protected set; }
- public IntFeedback HdmiInHdcpCapabilityFeedback { get; protected set; }
-
- ///
- /// Returns a list containing the Outputs that we want to expose.
- ///
- public FeedbackCollection Feedbacks { get; private set; }
-
- public void SetPortHdcpCapability(eHdcpCapabilityType hdcpMode, uint port) { }
-
- ///
- /// Helps get the "real" inputs, including when in Auto
- ///
- public eDmps3InputVideoSource ActualVideoInput
- {
- get
- {
- try
- {
- if (InputCard.VideoSourceFeedback != eDmps3InputVideoSource.Auto)
- return InputCard.VideoSourceFeedback;
- else // auto
- {
- if (InputCard.HdmiInputPort.SyncDetectedFeedback.BoolValue)
- return eDmps3InputVideoSource.Hdmi;
- else if (InputCard.VgaInputPort.SyncDetectedFeedback.BoolValue)
- return eDmps3InputVideoSource.Vga;
- else
- return eDmps3InputVideoSource.Bnc;
- }
- }
- catch
- {
- return eDmps3InputVideoSource.Bnc;
- }
- }
- }
-
- public virtual RoutingPortCollection InputPorts
- {
- get
- {
- return new RoutingPortCollection
- {
- HdmiIn,
- VgaIn,
- AudioIn,
- AnyVideoInput
- };
- }
- }
-
- public RoutingPortCollection OutputPorts
- {
- get
- {
- return new RoutingPortCollection { VirtualDmOut };
- }
- }
-
- public DmpsInternalVirtualHdmiVgaInputController(string key, string name, DMInput inputCard)
- : base(key, name)
- {
- Feedbacks = new FeedbackCollection();
-
- if (inputCard is Card.Dmps3HdmiVgaInput)
- {
- InputCard = inputCard as Card.Dmps3HdmiVgaInput;
-
- HdmiIn = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi,
- eDmps3InputVideoSource.Hdmi, this, VideoStatusHelper.GetHdmiInputStatusFuncs(InputCard.HdmiInputPort));
- VgaIn = new RoutingInputPortWithVideoStatuses(DmPortName.VgaIn,
- eRoutingSignalType.Video, eRoutingPortConnectionType.Vga, eDmps3InputVideoSource.Vga, this,
- VideoStatusHelper.GetVgaInputStatusFuncs(InputCard.VgaInputPort));
- AudioIn = new RoutingInputPort(DmPortName.AudioIn, eRoutingSignalType.Audio, eRoutingPortConnectionType.LineAudio,
- eDmps3InputAudioSource.Analog, this);
-
- if (InputCard.HdmiInputPort.HdcpSupportedLevelFeedback == eHdcpSupportedLevel.Hdcp2xSupport)
- HdcpSupportCapability = eHdcpCapabilityType.Hdcp2_2Support;
- else if (InputCard.HdmiInputPort.HdcpSupportedLevelFeedback == eHdcpSupportedLevel.Hdcp1xSupport)
- HdcpSupportCapability = eHdcpCapabilityType.Hdcp1xSupport;
-
- var combinedFuncs = new VideoStatusFuncsWrapper
- {
- HdcpActiveFeedbackFunc = () =>
- (ActualVideoInput == eDmps3InputVideoSource.Hdmi
- && InputCard.HdmiInputPort.VideoAttributes.HdcpActiveFeedback.BoolValue),
-
- HdcpStateFeedbackFunc = () =>
- {
- if (ActualVideoInput == eDmps3InputVideoSource.Hdmi)
- return InputCard.HdmiInputPort.VideoAttributes.HdcpStateFeedback.ToString();
- return "";
- },
-
- VideoResolutionFeedbackFunc = () =>
- {
- if (ActualVideoInput == eDmps3InputVideoSource.Hdmi)
- return InputCard.HdmiInputPort.VideoAttributes.GetVideoResolutionString();
- if (ActualVideoInput == eDmps3InputVideoSource.Vga)
- return InputCard.VgaInputPort.VideoAttributes.GetVideoResolutionString();
- return "";
- },
- VideoSyncFeedbackFunc = () =>
- (ActualVideoInput == eDmps3InputVideoSource.Hdmi
- && InputCard.HdmiInputPort.SyncDetectedFeedback.BoolValue)
- || (ActualVideoInput == eDmps3InputVideoSource.Vga
- && InputCard.VgaInputPort.SyncDetectedFeedback.BoolValue),
-
- HasVideoStatusFunc = () =>
- (ActualVideoInput == eDmps3InputVideoSource.Hdmi
- && HdmiIn.VideoStatus.HasVideoStatusFeedback.BoolValue)
- || (ActualVideoInput == eDmps3InputVideoSource.Vga
- && VgaIn.VideoStatus.HasVideoStatusFeedback.BoolValue)
- };
-
- AnyVideoInput = new RoutingInputPortWithVideoStatuses(DmPortName.AnyVideoIn,
- eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.None, eDmps3InputVideoSource.Auto, this, combinedFuncs);
-
- ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput", () => ActualVideoInput.ToString());
-
- VideoSourceNumericFeedback = new IntFeedback(() =>
- {
- return (int)InputCard.VideoSourceFeedback;
- });
- AudioSourceNumericFeedback = new IntFeedback(() =>
- {
- return (int)InputCard.AudioSourceFeedback;
- });
-
- HdmiInHdcpCapabilityFeedback = new IntFeedback("HdmiInHdcpCapability", () =>
- {
- if (InputCard.HdmiInputPort.HdcpSupportOnFeedback.BoolValue)
- return 1;
- else
- return 0;
- });
-
- // Set Ports for CEC
- HdmiIn.Port = InputCard.HdmiInputPort;
-
- VirtualDmOut = new RoutingOutputPort(DmPortName.DmOut, eRoutingSignalType.Audio | eRoutingSignalType.Video,
- eRoutingPortConnectionType.None, null, this);
-
- AddToFeedbackList(ActiveVideoInputFeedback, VideoSourceNumericFeedback, AudioSourceNumericFeedback,
- AnyVideoInput.VideoStatus.HasVideoStatusFeedback, AnyVideoInput.VideoStatus.HdcpActiveFeedback,
- AnyVideoInput.VideoStatus.HdcpStateFeedback, AnyVideoInput.VideoStatus.VideoResolutionFeedback,
- AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiInHdcpCapabilityFeedback);
-
- //AddPostActivationAction(() =>
- //{
- // Link up all of these damned events to the various RoutingPorts via a helper handler
- InputCard.HdmiInputPort.InputOutput.BaseDevice.BaseEvent += (o, a) => FowardInputStreamChange(HdmiIn, a.EventId);
- InputCard.HdmiInputPort.VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(HdmiIn, a.EventId);
-
- InputCard.VgaInputPort.InputOutput.BaseDevice.BaseEvent += (o, a) => FowardInputStreamChange(VgaIn, a.EventId);
- InputCard.VgaInputPort.VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(VgaIn, a.EventId);
- //});
-
- }
-
- }
-
- ///
- /// Relays the input stream change to the appropriate RoutingInputPort.
- ///
- protected void FowardInputStreamChange(RoutingInputPortWithVideoStatuses inputPort, int eventId)
- {
- if (eventId == Crestron.SimplSharpPro.DM.DMInputEventIds.SourceSyncEventId)
- {
- inputPort.VideoStatus.VideoSyncFeedback.FireUpdate();
- AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate();
- }
- }
-
- ///
- /// Relays the VideoAttributes change to a RoutingInputPort
- ///
- protected void ForwardVideoAttributeChange(RoutingInputPortWithVideoStatuses inputPort, int eventId)
- {
- switch (eventId)
- {
- case VideoAttributeEventIds.HdcpActiveFeedbackEventId:
- inputPort.VideoStatus.HdcpActiveFeedback.FireUpdate();
- AnyVideoInput.VideoStatus.HdcpActiveFeedback.FireUpdate();
- break;
- case VideoAttributeEventIds.HdcpStateFeedbackEventId:
- inputPort.VideoStatus.HdcpStateFeedback.FireUpdate();
- AnyVideoInput.VideoStatus.HdcpStateFeedback.FireUpdate();
- break;
- case VideoAttributeEventIds.HorizontalResolutionFeedbackEventId:
- case VideoAttributeEventIds.VerticalResolutionFeedbackEventId:
- inputPort.VideoStatus.VideoResolutionFeedback.FireUpdate();
- AnyVideoInput.VideoStatus.VideoResolutionFeedback.FireUpdate();
- break;
- case VideoAttributeEventIds.FramesPerSecondFeedbackEventId:
- inputPort.VideoStatus.VideoResolutionFeedback.FireUpdate();
- AnyVideoInput.VideoStatus.VideoResolutionFeedback.FireUpdate();
- break;
- }
- }
-
- ///
- /// Adds feedback(s) to the list
- ///
- ///
- public void AddToFeedbackList(params Feedback[] newFbs)
- {
- foreach (var f in newFbs)
- {
- if (f != null)
- {
- if (!Feedbacks.Contains(f))
- {
- Feedbacks.Add(f);
- }
- }
- }
- }
-
- #region ITxRouting Members
-
-
- public virtual void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type)
- {
- Debug.Console(2, this, "Executing Numeric Switch to input {0}.", input);
-
- switch (input)
- {
- case 0:
- {
- ExecuteSwitch(eDmps3InputVideoSource.Auto, null, type);
- break;
- }
- case 1:
- {
- ExecuteSwitch(HdmiIn.Selector, null, type);
- break;
- }
- case 2:
- {
- ExecuteSwitch(VgaIn.Selector, null, type);
- break;
- }
- }
-
- }
-
- #endregion
-
- #region IRouting Members
-
- public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType)
- {
- if ((signalType | eRoutingSignalType.Video) == eRoutingSignalType.Video)
- InputCard.VideoSource = (eDmps3InputVideoSource)inputSelector;
- if ((signalType | eRoutingSignalType.Audio) == eRoutingSignalType.Audio)
- InputCard.AudioSource = (eDmps3InputAudioSource)inputSelector;
- }
-
- #endregion
- }
-
- ///
- ///
- ///
- public class DmpsInternalVirtualHdmiVgaBncInputController : DmpsInternalVirtualHdmiVgaInputController
- {
- public new Card.Dmps3HdmiVgaBncInput InputCard { get; private set; }
-
- public RoutingInputPortWithVideoStatuses BncIn { get; private set; }
- public RoutingInputPort SpdifIn { get; private set; }
-
- public override RoutingPortCollection InputPorts
- {
- get
- {
- return new RoutingPortCollection
- {
- HdmiIn,
- VgaIn,
- BncIn,
- SpdifIn,
- AnyVideoInput
- };
- }
- }
-
- public DmpsInternalVirtualHdmiVgaBncInputController(string key, string name, Card.Dmps3HdmiVgaBncInput inputCard)
- : base(key, name, inputCard)
- {
- InputCard = inputCard;
-
- HdmiIn = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi,
- eDmps3InputVideoSource.Hdmi, this, VideoStatusHelper.GetHdmiInputStatusFuncs(InputCard.HdmiInputPort));
- VgaIn = new RoutingInputPortWithVideoStatuses(DmPortName.VgaIn,
- eRoutingSignalType.Video, eRoutingPortConnectionType.Vga, eDmps3InputVideoSource.Vga, this,
- VideoStatusHelper.GetVgaInputStatusFuncs(InputCard.VgaInputPort));
- BncIn = new RoutingInputPortWithVideoStatuses(DmPortName.BncIn, eRoutingSignalType.Video, eRoutingPortConnectionType.Component,
- eDmps3InputVideoSource.Bnc, this, VideoStatusHelper.GetBncInputStatusFuncs(InputCard.BncInputPort));
- SpdifIn = new RoutingInputPort(DmPortName.SpdifIn, eRoutingSignalType.Audio, eRoutingPortConnectionType.DigitalAudio,
- eDmps3InputAudioSource.Spdif, this);
-
- if (InputCard.HdmiInputPort.HdcpSupportedLevelFeedback == eHdcpSupportedLevel.Hdcp2xSupport)
- HdcpSupportCapability = eHdcpCapabilityType.Hdcp2_2Support;
- else if (InputCard.HdmiInputPort.HdcpSupportedLevelFeedback == eHdcpSupportedLevel.Hdcp1xSupport)
- HdcpSupportCapability = eHdcpCapabilityType.Hdcp1xSupport;
-
- var combinedFuncs = new VideoStatusFuncsWrapper
- {
- HdcpActiveFeedbackFunc = () =>
- (ActualVideoInput == eDmps3InputVideoSource.Hdmi
- && InputCard.HdmiInputPort.VideoAttributes.HdcpActiveFeedback.BoolValue),
-
- HdcpStateFeedbackFunc = () =>
- {
- if (ActualVideoInput == eDmps3InputVideoSource.Hdmi)
- return InputCard.HdmiInputPort.VideoAttributes.HdcpStateFeedback.ToString();
- return "";
- },
-
- VideoResolutionFeedbackFunc = () =>
- {
- if (ActualVideoInput == eDmps3InputVideoSource.Hdmi)
- return InputCard.HdmiInputPort.VideoAttributes.GetVideoResolutionString();
- if (ActualVideoInput == eDmps3InputVideoSource.Vga)
- return InputCard.VgaInputPort.VideoAttributes.GetVideoResolutionString();
- if (ActualVideoInput == eDmps3InputVideoSource.Bnc)
- return InputCard.BncInputPort.VideoAttributes.GetVideoResolutionString();
- return "";
- },
- VideoSyncFeedbackFunc = () =>
- (ActualVideoInput == eDmps3InputVideoSource.Hdmi
- && InputCard.HdmiInputPort.SyncDetectedFeedback.BoolValue)
- || (ActualVideoInput == eDmps3InputVideoSource.Vga
- && InputCard.VgaInputPort.SyncDetectedFeedback.BoolValue)
- || (ActualVideoInput == eDmps3InputVideoSource.Bnc
- && InputCard.BncInputPort.VideoDetectedFeedback.BoolValue),
-
- HasVideoStatusFunc = () =>
- (ActualVideoInput == eDmps3InputVideoSource.Hdmi
- && HdmiIn.VideoStatus.HasVideoStatusFeedback.BoolValue)
- || (ActualVideoInput == eDmps3InputVideoSource.Vga
- && VgaIn.VideoStatus.HasVideoStatusFeedback.BoolValue)
- || (ActualVideoInput == eDmps3InputVideoSource.Bnc
- &&BncIn.VideoStatus.HasVideoStatusFeedback.BoolValue)
- };
-
- AnyVideoInput = new RoutingInputPortWithVideoStatuses(DmPortName.AnyVideoIn,
- eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.None, 0, this, combinedFuncs);
-
- ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput", () => ActualVideoInput.ToString());
-
- VideoSourceNumericFeedback = new IntFeedback(() =>
- {
- return (int)InputCard.VideoSourceFeedback;
- });
- AudioSourceNumericFeedback = new IntFeedback(() =>
- {
- return (int)InputCard.AudioSourceFeedback;
- });
-
- HdmiInHdcpCapabilityFeedback = new IntFeedback("HdmiInHdcpCapability", () =>
- {
- if (InputCard.HdmiInputPort.HdcpSupportOnFeedback.BoolValue)
- return 1;
- else
- return 0;
- });
-
- // Set Ports for CEC
- HdmiIn.Port = InputCard.HdmiInputPort;
-
- VirtualDmOut = new RoutingOutputPort(DmPortName.DmOut, eRoutingSignalType.Audio | eRoutingSignalType.Video,
- eRoutingPortConnectionType.None, null, this);
-
- AddToFeedbackList(ActiveVideoInputFeedback, VideoSourceNumericFeedback, AudioSourceNumericFeedback,
- AnyVideoInput.VideoStatus.HasVideoStatusFeedback, AnyVideoInput.VideoStatus.HdcpActiveFeedback,
- AnyVideoInput.VideoStatus.HdcpStateFeedback, AnyVideoInput.VideoStatus.VideoResolutionFeedback,
- AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiInHdcpCapabilityFeedback);
-
- //AddPostActivationAction(() =>
- //{
- // Link up all of these damned events to the various RoutingPorts via a helper handler
- InputCard.HdmiInputPort.InputOutput.BaseDevice.BaseEvent += (o, a) => FowardInputStreamChange(HdmiIn, a.EventId);
- InputCard.HdmiInputPort.VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(HdmiIn, a.EventId);
-
- InputCard.VgaInputPort.InputOutput.BaseDevice.BaseEvent += (o, a) => FowardInputStreamChange(VgaIn, a.EventId);
- InputCard.VgaInputPort.VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(VgaIn, a.EventId);
-
- InputCard.BncInputPort.InputOutput.BaseDevice.BaseEvent += (o, a) => FowardInputStreamChange(HdmiIn, a.EventId);
- InputCard.BncInputPort.VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(HdmiIn, a.EventId);
- //});
-
- }
-
- public override void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type)
- {
- Debug.Console(2, this, "Executing Numeric Switch to input {0}.", input);
-
- switch (input)
- {
- case 0:
- {
- ExecuteSwitch(eDmps3InputVideoSource.Auto, null, type);
- break;
- }
- case 1:
- {
- ExecuteSwitch(HdmiIn.Selector, null, type);
- break;
- }
- case 2:
- {
- ExecuteSwitch(VgaIn.Selector, null, type);
- break;
- }
- case 3:
- {
- ExecuteSwitch(BncIn.Selector, null, type);
- break;
- }
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.DM/Chassis/DmpsMicrophoneController.cs b/src/PepperDash.Essentials.DM/Chassis/DmpsMicrophoneController.cs
deleted file mode 100644
index 29dc0693..00000000
--- a/src/PepperDash.Essentials.DM/Chassis/DmpsMicrophoneController.cs
+++ /dev/null
@@ -1,195 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Crestron.SimplSharp;
-using Crestron.SimplSharpPro;
-using Crestron.SimplSharpPro.DeviceSupport;
-using PepperDash.Core;
-using PepperDash.Essentials.Core;
-using PepperDash.Essentials.Core.Bridges;
-
-
-namespace PepperDash.Essentials.DM
-{
- ///
- /// Exposes the volume levels for microphones DMPS3 chassis
- ///
- public class DmpsMicrophoneController
- {
- private Dictionary Mics;
-
- public DmpsMicrophoneController(CrestronControlSystem dmps)
- {
- Debug.Console(2, "Creating Dmps Microphone Controller");
- Mics = new Dictionary();
-
- foreach (var mic in dmps.Microphones)
- {
- Debug.Console(0, "Dmps Microphone Controller Adding Mic: {0} Name: {1}", mic.ID, mic.Name);
- var dmpsMic = new DmpsMicrophone("processor-microphone" + mic.ID, mic.Name, mic);
-
- DeviceManager.AddDevice(dmpsMic);
- Mics.Add(mic.ID, dmpsMic);
- }
-
- dmps.MicrophoneChange += new MicrophoneChangeEventHandler(Dmps_MicrophoneChange);
- }
-
- void Dmps_MicrophoneChange(MicrophoneBase mic, GenericEventArgs args)
- {
- if (args.EventId == MicrophoneEventIds.VuFeedBackEventId)
- return;
-
- Debug.Console(2, "Dmps Microphone Controller Index: {0} EventId: {1}", mic.ID, args.EventId.ToString());
-
- if(Mics.ContainsKey(mic.ID))
- {
- Mics[mic.ID].Event(args.EventId);
- }
- }
- }
-
- public class DmpsMicrophone : EssentialsBridgeableDevice, IBasicVolumeWithFeedback
- {
- MicrophoneBase Mic;
-
- private bool EnableVolumeSend;
- private ushort VolumeLevelInput;
- protected short MinLevel { get; set; }
- protected short MaxLevel { get; set; }
-
- public BoolFeedback MuteFeedback { get; private set; }
- public IntFeedback VolumeLevelFeedback { get; private set; }
- public IntFeedback VolumeLevelScaledFeedback { get; private set; }
- public StringFeedback NameFeedback { get; private set; }
-
- Action MuteOnAction;
- Action MuteOffAction;
-
- public DmpsMicrophone(string key, string name, MicrophoneBase mic) : base(key, name)
- {
- Mic = mic;
- VolumeLevelInput = 0;
- EnableVolumeSend = false;
- MinLevel = 0;
- MaxLevel = 600;
-
- MuteFeedback = new BoolFeedback(new Func(() => Mic.MuteOnFeedBack.BoolValue));
- VolumeLevelFeedback = new IntFeedback(new Func(() => Mic.GainFeedBack.UShortValue));
- VolumeLevelScaledFeedback = new IntFeedback(new Func(() => ScaleVolumeFeedback(VolumeLevelFeedback.UShortValue)));
- NameFeedback = new StringFeedback(new Func(() => "Microphone " + Mic.ID));
- MuteOnAction = new Action(Mic.MuteOn);
- MuteOffAction = new Action(Mic.MuteOff);
-
- VolumeLevelFeedback.FireUpdate();
- VolumeLevelScaledFeedback.FireUpdate();
- NameFeedback.FireUpdate();
- MuteFeedback.FireUpdate();
- }
-
- public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
- {
- var joinMap = new DmpsMicrophoneControllerJoinMap(joinStart);
-
- if (bridge != null)
- {
- bridge.AddJoinMap(Key, joinMap);
- }
- else
- {
- Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
- }
-
- Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
-
- VolumeLevelFeedback.LinkInputSig(trilist.UShortInput[joinMap.MicGain.JoinNumber]);
- VolumeLevelScaledFeedback.LinkInputSig(trilist.UShortInput[joinMap.MicGainScaled.JoinNumber ]);
- MuteFeedback.LinkInputSig(trilist.BooleanInput[joinMap.MicMuteOn.JoinNumber]);
- MuteFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.MicMuteOff.JoinNumber]);
- NameFeedback.LinkInputSig(trilist.StringInput[joinMap.MicName.JoinNumber]);
-
- trilist.SetUShortSigAction(joinMap.MicGain.JoinNumber, SetVolume);
- trilist.SetUShortSigAction(joinMap.MicGainScaled.JoinNumber, SetVolumeScaled);
- trilist.SetBoolSigAction(joinMap.MicGainScaledSend.JoinNumber, SendScaledVolume);
- trilist.SetSigTrueAction(joinMap.MicMuteOn.JoinNumber, MuteOnAction);
- trilist.SetSigTrueAction(joinMap.MicMuteOff.JoinNumber, MuteOffAction);
- }
-
- public void Event(int id)
- {
- if (id == MicrophoneEventIds.MuteOnFeedBackEventId)
- {
- MuteFeedback.FireUpdate();
- }
- else if (id == MicrophoneEventIds.GainFeedBackEventId)
- {
- VolumeLevelFeedback.FireUpdate();
- VolumeLevelScaledFeedback.FireUpdate();
- }
- }
-
- public void SetVolumeScaled(ushort level)
- {
- VolumeLevelInput = (ushort)(level * (MaxLevel - MinLevel) / ushort.MaxValue + MinLevel);
- if (EnableVolumeSend == true)
- {
- Mic.Gain.UShortValue = VolumeLevelInput;
- }
- }
-
- public ushort ScaleVolumeFeedback(ushort level)
- {
- short signedLevel = (short)level;
- return (ushort)((signedLevel - MinLevel) * ushort.MaxValue / (MaxLevel - MinLevel));
- }
-
- public void SendScaledVolume(bool pressRelease)
- {
- EnableVolumeSend = pressRelease;
- if (pressRelease == false)
- {
- SetVolumeScaled(VolumeLevelInput);
- }
- }
-
- #region IBasicVolumeWithFeedback Members
-
- public void SetVolume(ushort level)
- {
- Mic.Gain.UShortValue = level;
- }
-
- public void MuteOn()
- {
- MuteOnAction();
- }
-
- public void MuteOff()
- {
- MuteOffAction();
- }
-
- #endregion
-
- #region IBasicVolumeControls Members
-
- public void VolumeUp(bool pressRelease)
- {
- }
-
- public void VolumeDown(bool pressRelease)
- {
- }
-
- public void MuteToggle()
- {
- if (MuteFeedback.BoolValue)
- MuteOff();
- else
- MuteOn();
- }
-
- #endregion
- }
-}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.DM/Chassis/DmpsRoutingController.cs b/src/PepperDash.Essentials.DM/Chassis/DmpsRoutingController.cs
deleted file mode 100644
index f3fd66d5..00000000
--- a/src/PepperDash.Essentials.DM/Chassis/DmpsRoutingController.cs
+++ /dev/null
@@ -1,1371 +0,0 @@
-extern alias Full;
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Crestron.SimplSharp;
-using Crestron.SimplSharpPro;
-using Crestron.SimplSharpPro.DeviceSupport;
-using Crestron.SimplSharpPro.DM;
-using Crestron.SimplSharpPro.DM.Cards;
-using Crestron.SimplSharpPro.DM.Endpoints;
-using Crestron.SimplSharpPro.DM.Endpoints.Receivers;
-using Full.Newtonsoft.Json;
-using PepperDash.Core;
-using PepperDash.Essentials.Core;
-using PepperDash.Essentials.Core.Bridges;
-using PepperDash.Essentials.DM.Config;
-
-using Feedback = PepperDash.Essentials.Core.Feedback;
-
-namespace PepperDash.Essentials.DM
-{
- public class DmpsRoutingController : EssentialsBridgeableDevice, IRoutingNumericWithFeedback, IHasFeedback
- {
- private const string NonePortKey = "none";
-
- public CrestronControlSystem Dmps { get; set; }
- public ISystemControl SystemControl { get; private set; }
- public bool? EnableRouting { get; private set; }
-
- //IroutingNumericEvent
- public event EventHandler NumericSwitchChange;
-
- //Feedback for DMPS System Control
- public BoolFeedback SystemPowerOnFeedback { get; private set; }
- public BoolFeedback SystemPowerOffFeedback { get; private set; }
- public BoolFeedback FrontPanelLockOnFeedback { get; private set; }
- public BoolFeedback FrontPanelLockOffFeedback { get; private set; }
-
- // Feedbacks for EssentialDM
- public Dictionary VideoOutputFeedbacks { get; private set; }
- public Dictionary AudioOutputFeedbacks { get; private set; }
- public Dictionary VideoInputSyncFeedbacks { get; private set; }
- public Dictionary InputEndpointOnlineFeedbacks { get; private set; }
- public Dictionary OutputEndpointOnlineFeedbacks { get; private set; }
- public Dictionary InputNameFeedbacks { get; private set; }
- public Dictionary OutputNameFeedbacks { get; private set; }
- public Dictionary OutputVideoRouteNameFeedbacks { get; private set; }
- public Dictionary OutputAudioRouteNameFeedbacks { get; private set; }
-
- public FeedbackCollection Feedbacks { get; private set; }
-
- // Need a couple Lists of generic Backplane ports
- public RoutingPortCollection InputPorts { get; private set; }
- public RoutingPortCollection OutputPorts { get; private set; }
-
- public Dictionary TxDictionary { get; set; }
- public Dictionary RxDictionary { get; set; }
-
- public Dictionary InputNames { get; set; }
- public Dictionary OutputNames { get; set; }
- public Dictionary VolumeControls { get; private set; }
- public Dictionary DigitalAudioOutputs { get; private set; }
- public DmpsMicrophoneController Microphones { get; private set; }
-
- public const int RouteOffTime = 500;
- Dictionary RouteOffTimers = new Dictionary();
-
- ///
- /// Text that represents when an output has no source routed to it
- ///
- public string NoRouteText = "";
-
- ///
- /// Raise an event when the status of a switch object changes.
- ///
- /// Arguments defined as IKeyName sender, output, input, and eRoutingSignalType
- private void OnSwitchChange(RoutingNumericEventArgs e)
- {
- var newEvent = NumericSwitchChange;
- if (newEvent != null) newEvent(this, e);
- }
-
-
- public static DmpsRoutingController GetDmpsRoutingController(string key, string name,
- DmpsRoutingPropertiesConfig properties)
- {
- try
- {
- var systemControl = Global.ControlSystem.SystemControl;
-
- if (systemControl == null)
- {
- return null;
- }
-
- var controller = new DmpsRoutingController(key, name, systemControl)
- {
- InputNames = properties.InputNames,
- OutputNames = properties.OutputNames
- };
-
- if (!string.IsNullOrEmpty(properties.NoRouteText))
- controller.NoRouteText = properties.NoRouteText;
-
- return controller;
-
- }
- catch (Exception e)
- {
- Debug.Console(0, "Error getting DMPS Controller:\r\n{0}", e);
- }
- return null;
- }
-
-
- ///
- ///
- ///
- ///
- ///
- ///
- public DmpsRoutingController(string key, string name, ISystemControl systemControl)
- : base(key, name)
- {
- Dmps = Global.ControlSystem;
-
- switch (systemControl.SystemControlType)
- {
- case eSystemControlType.Dmps34K150CSystemControl:
- SystemControl = systemControl as Dmps34K150CSystemControl;
- SystemPowerOnFeedback = new BoolFeedback(() => { return true; });
- SystemPowerOffFeedback = new BoolFeedback(() => { return false; });
- break;
- case eSystemControlType.Dmps34K200CSystemControl:
- case eSystemControlType.Dmps34K250CSystemControl:
- case eSystemControlType.Dmps34K300CSystemControl:
- case eSystemControlType.Dmps34K350CSystemControl:
- SystemControl = systemControl as Dmps34K300CSystemControl;
- SystemPowerOnFeedback = new BoolFeedback(() => { return true; });
- SystemPowerOffFeedback = new BoolFeedback(() => { return false; });
- break;
- default:
- SystemControl = systemControl as Dmps3SystemControl;
- SystemPowerOnFeedback = new BoolFeedback(() =>
- {
- return ((Dmps3SystemControl)SystemControl).SystemPowerOnFeedBack.BoolValue;
- });
- SystemPowerOffFeedback = new BoolFeedback(() =>
- {
- return ((Dmps3SystemControl)SystemControl).SystemPowerOffFeedBack.BoolValue;
- });
- break;
- }
- Debug.Console(1, this, "DMPS Type = {0}, 4K Type = {1}", systemControl.SystemControlType, Global.ControlSystemIsDmps4kType);
-
- InputPorts = new RoutingPortCollection();
- OutputPorts = new RoutingPortCollection();
- VolumeControls = new Dictionary();
- DigitalAudioOutputs = new Dictionary();
- TxDictionary = new Dictionary();
- RxDictionary = new Dictionary();
-
- FrontPanelLockOnFeedback = new BoolFeedback(() =>
- {
- return SystemControl.FrontPanelLockOnFeedback.BoolValue;
- });
- FrontPanelLockOffFeedback = new BoolFeedback(() =>
- {
- return SystemControl.FrontPanelLockOffFeedback.BoolValue;
- });
-
- VideoOutputFeedbacks = new Dictionary();
- AudioOutputFeedbacks = new Dictionary();
- VideoInputSyncFeedbacks = new Dictionary();
- InputNameFeedbacks = new Dictionary();
- OutputNameFeedbacks = new Dictionary();
- OutputVideoRouteNameFeedbacks = new Dictionary();
- OutputAudioRouteNameFeedbacks = new Dictionary();
- InputEndpointOnlineFeedbacks = new Dictionary();
- OutputEndpointOnlineFeedbacks = new Dictionary();
-
- Debug.Console(1, this, "{0} Switcher Inputs Present.", Dmps.SwitcherInputs.Count);
- Debug.Console(1, this, "{0} Switcher Outputs Present.", Dmps.SwitcherOutputs.Count);
-
- Debug.Console(1, this, "{0} Inputs in ControlSystem", Dmps.NumberOfSwitcherInputs);
- Debug.Console(1, this, "{0} Outputs in ControlSystem", Dmps.NumberOfSwitcherOutputs);
-
- SetupOutputCards();
-
- SetupInputCards();
-
- Microphones = new DmpsMicrophoneController(Dmps);
- }
-
- public override bool CustomActivate()
- {
- // Set input and output names from config
- SetInputNames();
-
- SetOutputNames();
-
- // Subscribe to events
- Dmps.DMInputChange += Dmps_DMInputChange;
- Dmps.DMOutputChange += Dmps_DMOutputChange;
- Dmps.DMSystemChange += Dmps_DMSystemChange;
-
- foreach (var x in VideoOutputFeedbacks)
- {
- x.Value.FireUpdate();
- }
- foreach (var x in AudioOutputFeedbacks)
- {
- x.Value.FireUpdate();
- }
- foreach (var x in VideoInputSyncFeedbacks)
- {
- x.Value.FireUpdate();
- }
- foreach (var x in InputEndpointOnlineFeedbacks)
- {
- x.Value.FireUpdate();
- }
- foreach (var x in InputNameFeedbacks)
- {
- x.Value.FireUpdate();
- }
- foreach (var x in OutputNameFeedbacks)
- {
- x.Value.FireUpdate();
- }
- foreach (var x in OutputEndpointOnlineFeedbacks)
- {
- x.Value.FireUpdate();
- }
-
- SystemPowerOnFeedback.FireUpdate();
- SystemPowerOffFeedback.FireUpdate();
-
- FrontPanelLockOnFeedback.FireUpdate();
- FrontPanelLockOffFeedback.FireUpdate();
-
- return base.CustomActivate();
- }
-
- private void SetOutputNames()
- {
- if (OutputNames == null)
- {
- return;
- }
- foreach (var kvp in OutputNames)
- {
- var output = (Dmps.SwitcherOutputs[kvp.Key] as DMOutput);
- if (output != null)
- {
- if (output.Name.Supported && kvp.Value.Length > 0)
- {
- output.Name.StringValue = kvp.Value;
- }
- }
- }
- }
-
- private void SetInputNames()
- {
- if (InputNames == null)
- {
- return;
- }
- foreach (var kvp in InputNames)
- {
- var input = (Dmps.SwitcherInputs[kvp.Key] as DMInput);
- if (input != null)
- {
- if (input.Name.Supported && kvp.Value.Length > 0)
- {
- input.Name.StringValue = kvp.Value;
- }
- }
- }
- }
-
- public void SetRoutingEnable(bool enable)
- {
- CrestronEnvironment.Sleep(1000);
- EnableRouting = enable;
- }
-
- public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
- {
- var joinMap = new DmpsRoutingControllerJoinMap(joinStart);
-
- var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
-
- if (!string.IsNullOrEmpty(joinMapSerialized))
- joinMap = JsonConvert.DeserializeObject(joinMapSerialized);
-
- if (bridge != null)
- {
- bridge.AddJoinMap(Key, joinMap);
- }
- else
- {
- Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
- }
-
- Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
-
- //Link up system power only for non-4k DMPS3
- if (SystemControl is Dmps3SystemControl)
- {
- trilist.SetBoolSigAction(joinMap.SystemPowerOn.JoinNumber, a => { if (a) { ((Dmps3SystemControl)SystemControl).SystemPowerOn(); } });
- trilist.SetBoolSigAction(joinMap.SystemPowerOff.JoinNumber, a => { if (a) { ((Dmps3SystemControl)SystemControl).SystemPowerOff(); } });
- }
-
- SystemPowerOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.SystemPowerOn.JoinNumber]);
- SystemPowerOffFeedback.LinkInputSig(trilist.BooleanInput[joinMap.SystemPowerOff.JoinNumber]);
-
- trilist.SetBoolSigAction(joinMap.FrontPanelLockOn.JoinNumber, a => { if (a) {SystemControl.FrontPanelLockOn();}});
- trilist.SetBoolSigAction(joinMap.FrontPanelLockOff.JoinNumber, a => { if (a) {SystemControl.FrontPanelLockOff();}});
-
- FrontPanelLockOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.FrontPanelLockOn.JoinNumber]);
- FrontPanelLockOffFeedback.LinkInputSig(trilist.BooleanInput[joinMap.FrontPanelLockOff.JoinNumber]);
-
- trilist.SetBoolSigAction(joinMap.EnableRouting.JoinNumber, SetRoutingEnable);
-
- // Link up outputs
- LinkInputsToApi(trilist, joinMap);
- LinkOutputsToApi(trilist, joinMap);
- }
-
- private void LinkOutputsToApi(BasicTriList trilist, DmpsRoutingControllerJoinMap joinMap)
- {
- for (uint i = 1; i <= Dmps.SwitcherOutputs.Count; i++)
- {
- Debug.Console(2, this, "Linking Output Card {0}", i);
-
- var ioSlot = i;
- var ioSlotJoin = ioSlot - 1;
-
- // Control
- trilist.SetUShortSigAction(joinMap.OutputVideo.JoinNumber + ioSlotJoin,
- o => ExecuteNumericSwitch(o, (ushort) ioSlot, eRoutingSignalType.Video));
- trilist.SetUShortSigAction(joinMap.OutputAudio.JoinNumber + ioSlotJoin,
- o => ExecuteNumericSwitch(o, (ushort) ioSlot, eRoutingSignalType.Audio));
-
- trilist.SetStringSigAction(joinMap.OutputNames.JoinNumber + ioSlotJoin, s =>
- {
- var outputCard = Dmps.SwitcherOutputs[ioSlot] as DMOutput;
-
- //Debug.Console(2, dmpsRouter, "Output Name String Sig Action for Output Card {0}", ioSlot);
-
- if (outputCard == null)
- {
- return;
- }
- //Debug.Console(2, dmpsRouter, "Card Type: {0}", outputCard.CardInputOutputType);
-
- if (outputCard is Card.Dmps3CodecOutput || outputCard.NameFeedback == null)
- {
- return;
- }
- if (string.IsNullOrEmpty(outputCard.NameFeedback.StringValue))
- {
- return;
- }
- //Debug.Console(2, dmpsRouter, "NameFeedabck: {0}", outputCard.NameFeedback.StringValue);
-
- if (outputCard.NameFeedback.StringValue != s && outputCard.Name != null)
- {
- outputCard.Name.StringValue = s;
- }
- });
-
- // Feedback
- if (VideoOutputFeedbacks[ioSlot] != null)
- {
- VideoOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputVideo.JoinNumber + ioSlotJoin]);
- }
- if (AudioOutputFeedbacks[ioSlot] != null)
- {
- AudioOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputAudio.JoinNumber + ioSlotJoin]);
- }
- if (OutputNameFeedbacks[ioSlot] != null)
- {
- if (Dmps.SwitcherOutputs[ioSlot].CardInputOutputType == eCardInputOutputType.Dmps3DmOutput ||
- Dmps.SwitcherOutputs[ioSlot].CardInputOutputType == eCardInputOutputType.Dmps3DmOutputBackend ||
- Dmps.SwitcherOutputs[ioSlot].CardInputOutputType == eCardInputOutputType.Dmps3HdmiOutput ||
- Dmps.SwitcherOutputs[ioSlot].CardInputOutputType == eCardInputOutputType.Dmps3HdmiOutputBackend ||
- Dmps.SwitcherOutputs[ioSlot].CardInputOutputType == eCardInputOutputType.Dmps3DmHdmiAudioOutput)
- {
- OutputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputVideoNames.JoinNumber + ioSlotJoin]);
- OutputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputNames.JoinNumber + ioSlotJoin]);
- OutputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputAudioNames.JoinNumber + ioSlotJoin]);
- }
- else
- {
- OutputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputNames.JoinNumber + ioSlotJoin]);
- OutputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputAudioNames.JoinNumber + ioSlotJoin]);
- }
- }
- if (OutputVideoRouteNameFeedbacks[ioSlot] != null)
- {
- OutputVideoRouteNameFeedbacks[ioSlot].LinkInputSig(
- trilist.StringInput[joinMap.OutputCurrentVideoInputNames.JoinNumber + ioSlotJoin]);
- }
- if (OutputAudioRouteNameFeedbacks[ioSlot] != null)
- {
- OutputAudioRouteNameFeedbacks[ioSlot].LinkInputSig(
- trilist.StringInput[joinMap.OutputCurrentAudioInputNames.JoinNumber + ioSlotJoin]);
- }
- if (OutputEndpointOnlineFeedbacks[ioSlot] != null)
- {
- OutputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(
- trilist.BooleanInput[joinMap.OutputEndpointOnline.JoinNumber + ioSlotJoin]);
- }
- }
- }
-
- private void LinkInputsToApi(BasicTriList trilist, DmpsRoutingControllerJoinMap joinMap)
- {
- if (Global.ControlSystemIsDmps4k3xxType)
- {
- //Add DMPS-4K mixer input names to end of inputs
- trilist.StringInput[joinMap.InputAudioNames.JoinNumber + (uint)Dmps.SwitcherInputs.Count + 4].StringValue = "Digital Mixer 1";
- trilist.StringInput[joinMap.InputAudioNames.JoinNumber + (uint)Dmps.SwitcherInputs.Count + 5].StringValue = "Digital Mixer 2";
- }
- for (uint i = 1; i <= Dmps.SwitcherInputs.Count; i++)
- {
- Debug.Console(2, this, "Linking Input Card {0}", i);
-
- var ioSlot = i;
- var ioSlotJoin = ioSlot - 1;
-
- if (VideoInputSyncFeedbacks.ContainsKey(ioSlot) && VideoInputSyncFeedbacks[ioSlot] != null)
- {
- VideoInputSyncFeedbacks[ioSlot].LinkInputSig(
- trilist.BooleanInput[joinMap.VideoSyncStatus.JoinNumber + ioSlotJoin]);
- }
-
- if (InputNameFeedbacks.ContainsKey(ioSlot) && InputNameFeedbacks[ioSlot] != null)
- {
- if (Dmps.SwitcherInputs[ioSlot] is Card.Dmps3AnalogAudioInput)
- {
- for (uint j = ioSlot; j < ioSlot + 5; j++)
- {
- InputNameFeedbacks[j].LinkInputSig(trilist.StringInput[joinMap.InputAudioNames.JoinNumber + j - 1]);
- }
- }
- else
- {
- InputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.InputNames.JoinNumber + ioSlotJoin]);
- InputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.InputVideoNames.JoinNumber + ioSlotJoin]);
- InputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.InputAudioNames.JoinNumber + ioSlotJoin]);
- }
- }
-
- trilist.SetStringSigAction(joinMap.InputNames.JoinNumber + ioSlotJoin, s =>
- {
- var inputCard = Dmps.SwitcherInputs[ioSlot] as DMInput;
-
- if (inputCard == null)
- {
- return;
- }
-
- if (inputCard.NameFeedback == null || string.IsNullOrEmpty(inputCard.NameFeedback.StringValue) ||
- inputCard.NameFeedback.StringValue == s)
- {
- return;
- }
-
- if (inputCard.Name != null)
- {
- inputCard.Name.StringValue = s;
- }
- });
-
-
- if (InputEndpointOnlineFeedbacks.ContainsKey(ioSlot) && InputEndpointOnlineFeedbacks[ioSlot] != null)
- {
- InputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(
- trilist.BooleanInput[joinMap.InputEndpointOnline.JoinNumber + ioSlotJoin]);
- }
- }
- }
-
-
- ///
- /// Iterate the SwitcherOutputs collection to setup feedbacks and add routing ports
- ///
- void SetupOutputCards()
- {
- foreach (var card in Dmps.SwitcherOutputs)
- {
- try
- {
- Debug.Console(1, this, "Output Card Type: {0}", card.CardInputOutputType);
-
- var outputCard = card as DMOutput;
-
- if (outputCard == null)
- {
- Debug.Console(1, this, "Output card {0} is not a DMOutput", card.CardInputOutputType);
- continue;
- }
-
- Debug.Console(1, this, "Adding Output Card Number {0} Type: {1}", outputCard.Number, outputCard.CardInputOutputType.ToString());
- VideoOutputFeedbacks[outputCard.Number] = new IntFeedback(() =>
- {
- if (outputCard.VideoOutFeedback != null) { return (ushort)outputCard.VideoOutFeedback.Number; }
- return 0;
- ;
- });
- AudioOutputFeedbacks[outputCard.Number] = new IntFeedback(() =>
- {
- if (!Global.ControlSystemIsDmps4k3xxType)
- {
- if (outputCard.AudioOutFeedback != null)
- {
- return (ushort)outputCard.AudioOutFeedback.Number;
- }
- return 0;
- }
- else
- {
-
- if (outputCard is Card.Dmps3DmOutputBackend || outputCard is Card.Dmps3HdmiOutputBackend)
- {
- //Special cases for DMPS-4K digital audio output
- if (DigitalAudioOutputs[outputCard.Number].AudioSourceNumericFeedback.UShortValue == 0)
- return 0;
- else if (DigitalAudioOutputs[outputCard.Number].AudioSourceNumericFeedback.UShortValue == 1)
- return (ushort)Dmps.SwitcherInputs.Count + 5;
- else if (DigitalAudioOutputs[outputCard.Number].AudioSourceNumericFeedback.UShortValue == 2)
- return (ushort)Dmps.SwitcherInputs.Count + 6;
- else if (DigitalAudioOutputs[outputCard.Number].AudioSourceNumericFeedback.UShortValue == 3)
- return (ushort)outputCard.VideoOutFeedback.Number;
- else
- return 0;
- }
- else if (outputCard.AudioOutSourceFeedback == eDmps34KAudioOutSource.NoRoute)
- {
- //Fixes for weird audio indexing on DMPS3-4K
- return 0;
- }
- else if (outputCard.AudioOutSourceFeedback == eDmps34KAudioOutSource.AirMedia8)
- {
- //Fixes for weird audio indexing on DMPS3-4K
- return 8;
- }
- else if (outputCard.AudioOutSourceFeedback == eDmps34KAudioOutSource.AirMedia9)
- {
- //Fixes for weird audio indexing on DMPS3-4K
- return 9;
- }
- else if ((ushort)outputCard.AudioOutSourceFeedback <= 5)
- {
- //Move analog inputs to after regular dm cards
- return (ushort)outputCard.AudioOutSourceFeedback + (ushort)Dmps.SwitcherInputs.Count - 1;
- }
- else
- {
- //Fixes for weird audio indexing on DMPS3-4K
- return (ushort)outputCard.AudioOutSourceFeedback - 5;
- }
- }
- });
-
- OutputNameFeedbacks[outputCard.Number] = new StringFeedback(() =>
- {
- if(OutputNames.ContainsKey(outputCard.Number))
- {
- return OutputNames[outputCard.Number];
- }
- else if (outputCard.NameFeedback != null && outputCard.NameFeedback != CrestronControlSystem.NullStringOutputSig && !string.IsNullOrEmpty(outputCard.NameFeedback.StringValue))
- {
- Debug.Console(2, this, "Output Card {0} Name: {1}", outputCard.Number, outputCard.NameFeedback.StringValue);
- return outputCard.NameFeedback.StringValue;
- }
- return "";
- });
-
- OutputVideoRouteNameFeedbacks[outputCard.Number] = new StringFeedback(() =>
- {
- if (outputCard.VideoOutFeedback != null && outputCard.VideoOutFeedback.NameFeedback != null)
- {
- return outputCard.VideoOutFeedback.NameFeedback.StringValue;
- }
- return NoRouteText;
- });
- OutputAudioRouteNameFeedbacks[outputCard.Number] = new StringFeedback(() =>
- {
- if (!Global.ControlSystemIsDmps4k3xxType)
- {
- if (outputCard.AudioOutFeedback != null && outputCard.AudioOutFeedback.NameFeedback != null)
- {
- return outputCard.AudioOutFeedback.NameFeedback.StringValue;
- }
- }
- else
- {
- if (outputCard is Card.Dmps3DmOutputBackend || outputCard is Card.Dmps3HdmiOutputBackend)
- {
- //Special cases for DMPS-4K digital audio output
- if (DigitalAudioOutputs[outputCard.Number].AudioSourceNumericFeedback.UShortValue == 0)
- return NoRouteText;
- else if (DigitalAudioOutputs[outputCard.Number].AudioSourceNumericFeedback.UShortValue == 1)
- return "Digital Mix 1";
- else if (DigitalAudioOutputs[outputCard.Number].AudioSourceNumericFeedback.UShortValue == 2)
- return "Digital Mix 2";
- else if (DigitalAudioOutputs[outputCard.Number].AudioSourceNumericFeedback.UShortValue == 3)
- return outputCard.VideoOutFeedback.NameFeedback.StringValue;
- else
- return NoRouteText;
- }
- else
- {
- return outputCard.AudioOutSourceFeedback.ToString();
- }
- }
- return NoRouteText;
- });
-
- OutputEndpointOnlineFeedbacks[outputCard.Number] = new BoolFeedback(() => outputCard.EndpointOnlineFeedback);
-
- AddOutputCard(outputCard.Number, outputCard);
- }
- catch (Exception ex)
- {
- Debug.LogError(Debug.ErrorLogLevel.Error, string.Format("DMPS Controller exception creating output card: {0}", ex));
- }
- }
- }
-
- ///
- /// Iterate the SwitcherInputs collection to setup feedbacks and add routing ports
- ///
- void SetupInputCards()
- {
- foreach (var card in Dmps.SwitcherInputs)
- {
- var inputCard = card as DMInput;
-
- if (inputCard != null)
- {
- Debug.Console(1, this, "Adding Input Card Number {0} Type: {1}", inputCard.Number, inputCard.CardInputOutputType.ToString());
-
- InputEndpointOnlineFeedbacks[inputCard.Number] = new BoolFeedback(() => inputCard.EndpointOnlineFeedback);
-
- if (inputCard.VideoDetectedFeedback != null && inputCard.VideoDetectedFeedback.Supported)
- {
- VideoInputSyncFeedbacks[inputCard.Number] = new BoolFeedback(() => inputCard.VideoDetectedFeedback.BoolValue);
- }
-
- InputNameFeedbacks[inputCard.Number] = new StringFeedback(() =>
- {
- if (InputNames.ContainsKey(inputCard.Number))
- {
- return InputNames[inputCard.Number];
- }
- else if (inputCard.NameFeedback != null && inputCard.NameFeedback != CrestronControlSystem.NullStringOutputSig && !string.IsNullOrEmpty(inputCard.NameFeedback.StringValue))
- {
- Debug.Console(2, this, "Input Card {0} Name: {1}", inputCard.Number, inputCard.NameFeedback.StringValue);
- return inputCard.NameFeedback.StringValue;
- }
- return "";
- });
-
- AddInputCard(inputCard.Number, inputCard);
- }
- else
- {
- Debug.Console(2, this, "***********Input Card of type {0} is cannot be cast as DMInput*************", card.CardInputOutputType);
- }
- }
-
- InputPorts.Add(new RoutingInputPort(NonePortKey, eRoutingSignalType.AudioVideo,
- eRoutingPortConnectionType.None, null, this));
- }
-
- ///
- /// Builds the appropriate ports aand callst the appropreate add port method
- ///
- ///
- ///
- public void AddInputCard(uint number, DMInput inputCard)
- {
- if (inputCard is Card.Dmps3HdmiInputWithoutAnalogAudio)
- {
- var hdmiInputCard = inputCard as Card.Dmps3HdmiInputWithoutAnalogAudio;
-
- var cecPort = hdmiInputCard.HdmiInputPort;
-
- AddInputPortWithDebug(number, string.Format("HdmiIn{0}", number), eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, cecPort);
- }
- else if (inputCard is Card.Dmps3HdmiInput)
- {
- var hdmiInputCard = inputCard as Card.Dmps3HdmiInput;
- var cecPort = hdmiInputCard.HdmiInputPort;
-
- AddInputPortWithDebug(number, string.Format("HdmiIn{0}", number), eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, cecPort);
- AddInputPortWithDebug(number, string.Format("HudioIn{1}", number), eRoutingSignalType.Audio, eRoutingPortConnectionType.LineAudio);
- }
- else if (inputCard is Card.Dmps3HdmiVgaInput)
- {
- var hdmiVgaInputCard = inputCard as Card.Dmps3HdmiVgaInput;
-
- DmpsInternalVirtualHdmiVgaInputController inputCardController = new DmpsInternalVirtualHdmiVgaInputController(Key +
- string.Format("-HdmiVgaIn{0}", number), string.Format("InternalInputController-{0}", number), hdmiVgaInputCard);
-
- DeviceManager.AddDevice(inputCardController);
-
- AddInputPortWithDebug(number, string.Format("HdmiVgaIn{0}", number), eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.BackplaneOnly);
- }
- else if (inputCard is Card.Dmps3HdmiVgaBncInput)
- {
- var hdmiVgaBncInputCard = inputCard as Card.Dmps3HdmiVgaBncInput;
-
- DmpsInternalVirtualHdmiVgaBncInputController inputCardController = new DmpsInternalVirtualHdmiVgaBncInputController(Key +
- string.Format("-HdmiVgaBncIn{0}", number), string.Format("InternalInputController-{0}", number), hdmiVgaBncInputCard);
-
- DeviceManager.AddDevice(inputCardController);
-
- AddInputPortWithDebug(number, string.Format("HdmiVgaBncIn{0}", number), eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.BackplaneOnly);
-
- }
- else if (inputCard is Card.Dmps3DmInput)
- {
- var hdmiInputCard = inputCard as Card.Dmps3DmInput;
- var cecPort = hdmiInputCard.DmInputPort;
-
- AddInputPortWithDebug(number, string.Format("DmIn{0}", number), eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmCat, cecPort);
- }
- else if (inputCard is Card.Dmps3VgaInput)
- {
- AddInputPortWithDebug(number, string.Format("VgaIn{0}", number), eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Vga);
- }
- else if (inputCard is Card.Dmps3AirMediaInput)
- {
- AddInputPortWithDebug(number, string.Format("AirMediaIn{0}", number), eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Streaming);
- }
- else if (inputCard is Card.Dmps3AnalogAudioInput)
- {
- for (uint i = 0; i <= 4; i++)
- {
- uint j = i + 1;
- uint input = i + number;
- InputNameFeedbacks[input] = new StringFeedback(() =>
- {
- if (InputNames.ContainsKey(input))
- {
- return InputNames[input];
- }
- else
- {
- return String.Format("Aux Input {0}", j);
- }
- });
- }
- }
- }
-
-
- ///
- /// Adds InputPort
- ///
- private void AddInputPortWithDebug(uint cardNum, string portName, eRoutingSignalType sigType,
- eRoutingPortConnectionType portType)
- {
- AddInputPortWithDebug(cardNum, portName, sigType, portType, null);
- }
-
- ///
- /// Adds InputPort and sets Port as ICec object
- ///
- void AddInputPortWithDebug(uint cardNum, string portName, eRoutingSignalType sigType, eRoutingPortConnectionType portType, ICec cecPort)
- {
- var portKey = string.Format("inputCard{0}--{1}", cardNum, portName);
- Debug.Console(2, this, "Adding input port '{0}'", portKey);
- var inputPort = new RoutingInputPort(portKey, sigType, portType, Dmps.SwitcherInputs[cardNum], this)
- {
- FeedbackMatchObject = Dmps.SwitcherInputs[cardNum]
- };
-
- if (cecPort != null)
- inputPort.Port = cecPort;
-
- InputPorts.Add(inputPort);
- }
-
-
- ///
- /// Builds the appropriate ports and calls the appropriate add port method
- ///
- ///
- ///
- public void AddOutputCard(uint number, DMOutput outputCard)
- {
- if (outputCard is Card.Dmps3HdmiOutput)
- {
- var hdmiOutputCard = outputCard as Card.Dmps3HdmiOutput;
-
- var cecPort = hdmiOutputCard.HdmiOutputPort;
-
- AddHdmiOutputPort(number, cecPort);
-
- var audioOutput = new DmpsAudioOutputController(string.Format("processor-digitalAudioOutput{0}", number), string.Format("Hdmi Audio Output {0}", number), outputCard as Card.Dmps3HdmiOutput);
- DeviceManager.AddDevice(audioOutput);
- }
- else if (outputCard is Card.Dmps3HdmiOutputBackend)
- {
- var hdmiOutputCard = outputCard as Card.Dmps3HdmiOutputBackend;
- var cecPort = hdmiOutputCard.HdmiOutputPort;
- AddHdmiOutputPort(number, cecPort);
- var audioOutput = new DmpsDigitalOutputController(string.Format("processor-avRouting-HdmiAudioOut{0}", number), string.Format("Hdmi Audio Output {0} Router", number), hdmiOutputCard);
- DigitalAudioOutputs.Add(number, audioOutput);
- DeviceManager.AddDevice(audioOutput);
- }
- else if (outputCard is Card.Dmps3DmOutput)
- {
- AddDmOutputPort(number);
- var audioOutput = new DmpsAudioOutputController(string.Format("processor-digitalAudioOutput{0}", number), string.Format("Dm Audio Output {0}", number), outputCard as Card.Dmps3DmOutput);
- DeviceManager.AddDevice(audioOutput);
- }
- else if (outputCard is Card.Dmps3DmOutputBackend)
- {
- AddDmOutputPort(number);
- var audioOutput = new DmpsDigitalOutputController(string.Format("processor-avRouting-DmAudioOut{0}", number), string.Format("Dm Audio Output {0} Router", number), outputCard as Card.Dmps3DmOutputBackend);
- DigitalAudioOutputs.Add(number, audioOutput);
- DeviceManager.AddDevice(audioOutput);
- }
- else if (outputCard is Card.Dmps3DmHdmiAudioOutput)
- {
- var hdmiOutputCard = outputCard as Card.Dmps3DmHdmiAudioOutput;
- var cecPort = hdmiOutputCard.HdmiOutputPort;
- AddHdmiOutputPort(number, cecPort);
- AddDmOutputPort(number);
- AddAudioOnlyOutputPort(number, "Program");
-
- var audioOutput = new DmpsAudioOutputController(string.Format("processor-programAudioOutput", number), string.Format("Program Audio Output {0}", number), hdmiOutputCard, hdmiOutputCard.AudioOutputStream);
- DeviceManager.AddDevice(audioOutput);
- var digitalAudioOutput = new DmpsAudioOutputController(string.Format("processor-digitalAudioOutput{0}", number), string.Format("Hdmi Audio Output {0}", number), hdmiOutputCard, hdmiOutputCard.DmHdmiOutputStream);
- DeviceManager.AddDevice(digitalAudioOutput);
- }
- else if (outputCard is Card.Dmps3ProgramOutput)
- {
- AddAudioOnlyOutputPort(number, "Program");
-
- var programOutput = new DmpsAudioOutputController(string.Format("processor-programAudioOutput"), "Program Audio Output", outputCard as Card.Dmps3ProgramOutput);
-
- DeviceManager.AddDevice(programOutput);
- }
- else if (outputCard is Card.Dmps3AuxOutput)
- {
- switch (outputCard.CardInputOutputType)
- {
- case eCardInputOutputType.Dmps3Aux1Output:
- {
- AddAudioOnlyOutputPort(number, "Aux1");
-
- var aux1Output = new DmpsAudioOutputController(string.Format("processor-aux1AudioOutput"), "Aux1 Audio Output", outputCard as Card.Dmps3Aux1Output);
-
- DeviceManager.AddDevice(aux1Output);
- }
- break;
- case eCardInputOutputType.Dmps3Aux2Output:
- {
- AddAudioOnlyOutputPort(number, "Aux2");
-
- var aux2Output = new DmpsAudioOutputController(string.Format("processor-aux2AudioOutput"), "Aux2 Audio Output", outputCard as Card.Dmps3Aux2Output);
-
- DeviceManager.AddDevice(aux2Output);
- }
- break;
- }
- }
- else if (outputCard is Card.Dmps3CodecOutput)
- {
- switch (number)
- {
- case (uint)CrestronControlSystem.eDmps34K350COutputs.Codec1:
- case (uint)CrestronControlSystem.eDmps34K250COutputs.Codec1:
- case (uint)CrestronControlSystem.eDmps3300cAecOutputs.Codec1:
- AddAudioOnlyOutputPort(number, CrestronControlSystem.eDmps300cOutputs.Codec1.ToString());
- break;
- case (uint)CrestronControlSystem.eDmps34K350COutputs.Codec2:
- case (uint)CrestronControlSystem.eDmps34K250COutputs.Codec2:
- case (uint)CrestronControlSystem.eDmps3300cAecOutputs.Codec2:
- AddAudioOnlyOutputPort(number, CrestronControlSystem.eDmps300cOutputs.Codec2.ToString());
- break;
- }
- }
- else if (outputCard is Card.Dmps3DialerOutput)
- {
- AddAudioOnlyOutputPort(number, "Dialer");
- }
- else if (outputCard is Card.Dmps3AecOutput)
- {
- AddAudioOnlyOutputPort(number, "Aec");
- }
- else if (outputCard is Card.Dmps3DigitalMixOutput)
- {
- if (number == (uint)CrestronControlSystem.eDmps34K250COutputs.Mix1
- || number == (uint)CrestronControlSystem.eDmps34K300COutputs.Mix1
- || number == (uint)CrestronControlSystem.eDmps34K350COutputs.Mix1)
- AddAudioOnlyOutputPort(number, CrestronControlSystem.eDmps34K250COutputs.Mix1.ToString());
- if (number == (uint)CrestronControlSystem.eDmps34K250COutputs.Mix2
- || number == (uint)CrestronControlSystem.eDmps34K300COutputs.Mix2
- || number == (uint)CrestronControlSystem.eDmps34K350COutputs.Mix2)
- AddAudioOnlyOutputPort(number, CrestronControlSystem.eDmps34K250COutputs.Mix2.ToString());
-
- var audioOutput = new DmpsAudioOutputController(string.Format("processor-digitalAudioOutput{0}", number % 2 + 1), string.Format("Digital Audio Mix {0}", number % 2 + 1), outputCard as Card.Dmps3DigitalMixOutput);
- DeviceManager.AddDevice(audioOutput);
- }
- else
- {
- Debug.Console(1, this, "Output Card is of a type not currently handled:", outputCard.CardInputOutputType.ToString());
- }
- }
-
- ///
- /// Adds an Audio only output port
- ///
- ///
- void AddAudioOnlyOutputPort(uint number, string portName)
- {
- AddOutputPortWithDebug(number, portName, eRoutingSignalType.Audio, eRoutingPortConnectionType.LineAudio, Dmps.SwitcherOutputs[number]);
- }
-
- ///
- /// Adds an HDMI output port
- ///
- ///
- ///
- void AddHdmiOutputPort(uint number, ICec cecPort)
- {
- AddOutputPortWithDebug(number, string.Format("hdmiOut{0}", number), eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, Dmps.SwitcherOutputs[number], cecPort);
- }
-
- ///
- /// Adds a DM output port
- ///
- ///
- void AddDmOutputPort(uint number)
- {
- AddOutputPortWithDebug(number, string.Format("dmOut{0}", number), eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmCat, Dmps.SwitcherOutputs[number]);
- }
-
- ///
- /// Adds OutputPort
- ///
- void AddOutputPortWithDebug(uint cardNum, string portName, eRoutingSignalType sigType, eRoutingPortConnectionType portType, object selector)
- {
- AddOutputPortWithDebug(cardNum, portName, sigType, portType, selector, null);
- }
-
- ///
- /// Adds OutputPort and sets Port as ICec object
- ///
- void AddOutputPortWithDebug(uint cardNum, string portName, eRoutingSignalType sigType, eRoutingPortConnectionType portType, object selector, ICec cecPort)
- {
- var portKey = string.Format("outputCard{0}--{1}", cardNum, portName);
- Debug.Console(2, this, "Adding output port '{0}'", portKey);
- var outputPort = new RoutingOutputPort(portKey, sigType, portType, selector, this)
- {
- FeedbackMatchObject = Dmps.SwitcherOutputs[cardNum]
- };
-
- if (cecPort != null)
- outputPort.Port = cecPort;
-
- OutputPorts.Add(outputPort);
- }
-
- ///
- ///
- ///
- void AddVolumeControl(uint number, Audio.Output audio)
- {
- VolumeControls.Add(number, new DmCardAudioOutputController(audio));
- }
-
- void Dmps_DMInputChange(Switch device, DMInputEventArgs args)
- {
- Debug.Console(2, this, "DMInputChange Input: {0} EventId: {1}", args.Number, args.EventId.ToString());
- try
- {
- switch (args.EventId)
- {
- case (DMInputEventIds.OnlineFeedbackEventId):
- {
- Debug.Console(2, this, "DM Input OnlineFeedbackEventId for input: {0}. State: {1}", args.Number, device.Inputs[args.Number].EndpointOnlineFeedback);
- InputEndpointOnlineFeedbacks[args.Number].FireUpdate();
- break;
- }
- case (DMInputEventIds.EndpointOnlineEventId):
- {
- Debug.Console(2, this, "DM Input EndpointOnlineEventId for input: {0}. State: {1}", args.Number, device.Inputs[args.Number].EndpointOnlineFeedback);
- InputEndpointOnlineFeedbacks[args.Number].FireUpdate();
- break;
- }
- case (DMInputEventIds.VideoDetectedEventId):
- {
- Debug.Console(2, this, "DM Input {0} VideoDetectedEventId", args.Number);
- VideoInputSyncFeedbacks[args.Number].FireUpdate();
- break;
- }
- case (DMInputEventIds.InputNameEventId):
- {
- Debug.Console(2, this, "DM Input {0} NameFeedbackEventId", args.Number);
- if(InputNameFeedbacks.ContainsKey(args.Number))
- {
- InputNameFeedbacks[args.Number].FireUpdate();
- }
- break;
- }
- }
- }
- catch (Exception e)
- {
- Debug.Console(0, Debug.ErrorLogLevel.Notice, "DMSwitch Input Change:{0} Input:{1} Event:{2}\rException: {3}", this.Name, args.Number, args.EventId.ToString(), e.ToString());
- }
- }
- void Dmps_DMOutputChange(Switch device, DMOutputEventArgs args)
- {
- if (args.EventId == DMOutputEventIds.OutputVuFeedBackEventId)
- {
- //Frequently called event that isn't needed
- return;
- }
-
- Debug.Console(2, this, "DMOutputChange Output: {0} EventId: {1}", args.Number, args.EventId.ToString());
- var output = args.Number;
-
- DMOutput outputCard = Dmps.SwitcherOutputs[output] as DMOutput;
-
- if (args.EventId == DMOutputEventIds.VolumeEventId && VolumeControls.ContainsKey(output))
- {
- VolumeControls[args.Number].VolumeEventFromChassis();
- }
- else if (args.EventId == DMOutputEventIds.OnlineFeedbackEventId
- && OutputEndpointOnlineFeedbacks.ContainsKey(output))
- {
- OutputEndpointOnlineFeedbacks[output].FireUpdate();
- }
- else if (args.EventId == DMOutputEventIds.EndpointOnlineEventId
- && OutputEndpointOnlineFeedbacks.ContainsKey(output))
- {
- OutputEndpointOnlineFeedbacks[output].FireUpdate();
- }
- else if (args.EventId == DMOutputEventIds.VideoOutEventId)
- {
- if (outputCard != null && outputCard.VideoOutFeedback != null)
- {
- Debug.Console(2, this, "DMSwitchVideo:{0} Routed Input:{1} Output:{2}'", this.Name, outputCard.VideoOutFeedback.Number, output);
- }
- if (VideoOutputFeedbacks.ContainsKey(output))
- {
- VideoOutputFeedbacks[output].FireUpdate();
- }
- if (OutputVideoRouteNameFeedbacks.ContainsKey(output))
- {
- OutputVideoRouteNameFeedbacks[output].FireUpdate();
- }
- if (outputCard is Card.Dmps3DmOutputBackend || outputCard is Card.Dmps3HdmiOutputBackend)
- {
- if (AudioOutputFeedbacks.ContainsKey(output))
- {
- AudioOutputFeedbacks[output].FireUpdate();
- }
- if (OutputAudioRouteNameFeedbacks.ContainsKey(output))
- {
- OutputAudioRouteNameFeedbacks[output].FireUpdate();
- }
- }
- }
- else if (args.EventId == DMOutputEventIds.AudioOutEventId)
- {
- if (!Global.ControlSystemIsDmps4k3xxType)
- {
- if (outputCard != null && outputCard.AudioOutFeedback != null)
- {
- Debug.Console(2, this, "DMSwitchAudio:{0} Routed Input:{1} Output:{2}'", this.Name,
- outputCard.AudioOutFeedback.Number, output);
- }
- }
- else
- {
- if (outputCard != null)
- {
- if (outputCard is Card.Dmps3DmOutputBackend || outputCard is Card.Dmps3HdmiOutputBackend)
- {
- DigitalAudioOutputs[output].AudioSourceNumericFeedback.FireUpdate();
- }
- else
- {
- Debug.Console(2, this, "DMSwitchAudio:{0} Routed Input:{1} Output:{2}'", Name,
- outputCard.AudioOutSourceFeedback, output);
- }
- }
- }
- if (AudioOutputFeedbacks.ContainsKey(output))
- {
- AudioOutputFeedbacks[output].FireUpdate();
- }
- if (OutputAudioRouteNameFeedbacks.ContainsKey(output))
- {
- OutputAudioRouteNameFeedbacks[output].FireUpdate();
- }
- }
- else if (args.EventId == DMOutputEventIds.OutputNameEventId
- && OutputNameFeedbacks.ContainsKey(output))
- {
- OutputNameFeedbacks[output].FireUpdate();
- }
- else if (args.EventId == DMOutputEventIds.DigitalMixerAudioSourceFeedBackEventId)
- {
- if (AudioOutputFeedbacks.ContainsKey(output))
- {
- AudioOutputFeedbacks[output].FireUpdate();
- }
- if (OutputAudioRouteNameFeedbacks.ContainsKey(output))
- {
- OutputAudioRouteNameFeedbacks[output].FireUpdate();
- }
- }
- }
-
- void Dmps_DMSystemChange(Switch device, DMSystemEventArgs args)
- {
- switch (args.EventId)
- {
- case DMSystemEventIds.SystemPowerOnEventId:
- case DMSystemEventIds.SystemPowerOffEventId:
- {
- SystemPowerOnFeedback.FireUpdate();
- SystemPowerOffFeedback.FireUpdate();
- break;
- }
- case DMSystemEventIds.FrontPanelLockOnEventId:
- case DMSystemEventIds.FrontPanelLockOffEventId:
- {
- FrontPanelLockOnFeedback.FireUpdate();
- FrontPanelLockOffFeedback.FireUpdate();
- break;
- }
- }
- }
-
- ///
- ///
- ///
- ///
- void StartOffTimer(PortNumberType pnt)
- {
- if (RouteOffTimers.ContainsKey(pnt))
- return;
- RouteOffTimers[pnt] = new CTimer(o => ExecuteSwitch(null, pnt.Selector, pnt.Type), RouteOffTime);
- }
-
- #region IRouting Members
-
- public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType sigType)
- {
- try
- {
- if (EnableRouting == false)
- {
- return;
- }
-
- Debug.Console(2, this, "Attempting a DM route from input {0} to output {1} {2}", inputSelector, outputSelector, sigType);
-
- var input = inputSelector as DMInput;
- var output = outputSelector as DMOutput;
-
- if (output == null)
- {
- Debug.Console(0, this, Debug.ErrorLogLevel.Warning,
- "Unable to execute switch for inputSelector {0} to outputSelector {1}", inputSelector,
- outputSelector);
- return;
- }
-
- var sigTypeIsUsbOrVideo = ((sigType & eRoutingSignalType.Video) == eRoutingSignalType.Video) ||
- ((sigType & eRoutingSignalType.UsbInput) == eRoutingSignalType.UsbInput) ||
- ((sigType & eRoutingSignalType.UsbOutput) == eRoutingSignalType.UsbOutput);
-
- if (input == null || (input.Number <= Dmps.NumberOfSwitcherInputs && output.Number <= Dmps.NumberOfSwitcherOutputs &&
- sigTypeIsUsbOrVideo) ||
- (input.Number <= (Dmps.NumberOfSwitcherInputs) && output.Number <= Dmps.NumberOfSwitcherOutputs &&
- (sigType & eRoutingSignalType.Audio) == eRoutingSignalType.Audio))
- {
- // Check to see if there's an off timer waiting on this and if so, cancel
- var key = new PortNumberType(output, sigType);
- if (input == null)
- {
- StartOffTimer(key);
- }
- else if (key.Number > 0)
- {
- if (RouteOffTimers.ContainsKey(key))
- {
- Debug.Console(2, this, "{0} cancelling route off due to new source", output);
- RouteOffTimers[key].Stop();
- RouteOffTimers.Remove(key);
- }
- }
-
- // NOTE THAT BITWISE COMPARISONS - TO CATCH ALL ROUTING TYPES
- if ((sigType & eRoutingSignalType.Video) == eRoutingSignalType.Video)
- {
- output.VideoOut = input;
- }
-
- if ((sigType & eRoutingSignalType.Audio) == eRoutingSignalType.Audio)
- {
- if (!Global.ControlSystemIsDmps4k3xxType)
- {
- output.AudioOut = input;
- }
- else
- {
- if (input == null)
- {
- output.AudioOutSource = eDmps34KAudioOutSource.NoRoute;
- }
- else if (input.CardInputOutputType == eCardInputOutputType.Dmps3AirMediaInput || input.CardInputOutputType == eCardInputOutputType.Dmps3AirMediaNoStreamingInput)
- {
- //Special case for weird AirMedia indexing
- if (Dmps.SystemControl.SystemControlType == eSystemControlType.Dmps34K250CSystemControl)
- output.AudioOutSource = eDmps34KAudioOutSource.AirMedia8;
- else if (Dmps.SystemControl.SystemControlType == eSystemControlType.Dmps34K350CSystemControl)
- output.AudioOutSource = eDmps34KAudioOutSource.AirMedia9;
- }
- else if (input.Number < Dmps.SwitcherInputs.Count)
- {
- //Shift video inputs by 5 for weird DMPS3-4K indexing
- output.AudioOutSource = (eDmps34KAudioOutSource)(input.Number + 5);
- }
- else
- {
- //Shift analog inputs back to inputs 1-5
- output.AudioOutSource = (eDmps34KAudioOutSource)(input.Number - Dmps.SwitcherInputs.Count + 1);
- }
- }
- }
-
- if ((sigType & eRoutingSignalType.UsbOutput) == eRoutingSignalType.UsbOutput)
- {
- output.USBRoutedTo = input;
- }
-
- if ((sigType & eRoutingSignalType.UsbInput) != eRoutingSignalType.UsbInput)
- {
- return;
- }
- if (input != null)
- input.USBRoutedTo = output;
- }
- else
- {
- Debug.Console(1, this, "Unable to execute route from input {0} to output {1}", inputSelector,
- outputSelector);
- }
- }
- catch (Exception e)
- {
- Debug.Console(1, this, "Error executing switch: {0}", e);
- }
- }
-
- #endregion
-
- #region IRoutingNumeric Members
-
- public void ExecuteNumericSwitch(ushort inputSelector, ushort outputSelector, eRoutingSignalType sigType)
- {
- if (EnableRouting == false)
- {
- return;
- }
-
- Debug.Console(1, this, "Attempting a numeric switch from input {0} to output {1} {2}", inputSelector, outputSelector, sigType);
-
- if((sigType & eRoutingSignalType.Video) == eRoutingSignalType.Video)
- {
- if (inputSelector <= Dmps.SwitcherInputs.Count && outputSelector <= Dmps.SwitcherOutputs.Count)
- {
- var input = inputSelector == 0 ? null : Dmps.SwitcherInputs[inputSelector];
- var output = Dmps.SwitcherOutputs[outputSelector];
-
- ExecuteSwitch(input, output, sigType);
- }
- }
- else if ((sigType & eRoutingSignalType.Audio) == eRoutingSignalType.Audio)
- {
- //Special case for DMPS-4K digital audio output
- if (Global.ControlSystemIsDmps4k3xxType)
- {
- if (DigitalAudioOutputs.ContainsKey(outputSelector))
- {
- if (inputSelector == 0) //Clear action
- {
- DigitalAudioOutputs[outputSelector].ExecuteNumericSwitch(0, 0, eRoutingSignalType.Audio);
- }
- else if (inputSelector < Dmps.SwitcherInputs.Count) //DMPS-4K video inputs, set to audio follows video
- {
- DigitalAudioOutputs[outputSelector].ExecuteNumericSwitch(3, 0, eRoutingSignalType.Audio);
- //Force video route since it is now set so audio follows video
- ExecuteNumericSwitch(inputSelector, outputSelector, eRoutingSignalType.Video);
- }
- else if (inputSelector == Dmps.SwitcherInputs.Count + 5)
- {
- //Set to mix 1
- DigitalAudioOutputs[outputSelector].ExecuteNumericSwitch(1, 0, eRoutingSignalType.Audio);
- }
- else if (inputSelector == Dmps.SwitcherInputs.Count + 6)
- {
- //Set to mix 2
- DigitalAudioOutputs[outputSelector].ExecuteNumericSwitch(2, 0, eRoutingSignalType.Audio);
- }
- }
- else if (inputSelector <= (Dmps.SwitcherInputs.Count + 4) && outputSelector <= Dmps.SwitcherOutputs.Count)
- {
- var output = Dmps.SwitcherOutputs[outputSelector] as DMOutput;
- if (inputSelector == 0)
- {
- output.AudioOutSource = eDmps34KAudioOutSource.NoRoute;
- }
- else if(inputSelector >= (Dmps.SwitcherInputs.Count))
- {
- //Shift analog inputs back to inputs 1-5
- Debug.Console(1, this, "Attempting analog route input {0} to output {1}", inputSelector - Dmps.SwitcherInputs.Count + 1, outputSelector);
- output.AudioOutSource = (eDmps34KAudioOutSource)(inputSelector - Dmps.SwitcherInputs.Count + 1);
- }
- else if (inputSelector < Dmps.SwitcherInputs.Count)
- {
- var input = Dmps.SwitcherInputs[inputSelector] as DMInput;
- if (input.CardInputOutputType == eCardInputOutputType.Dmps3AirMediaInput || input.CardInputOutputType == eCardInputOutputType.Dmps3AirMediaNoStreamingInput)
- {
- //Special case for weird AirMedia indexing
- if (Dmps.SystemControl.SystemControlType == eSystemControlType.Dmps34K250CSystemControl)
- output.AudioOutSource = eDmps34KAudioOutSource.AirMedia8;
- else if (Dmps.SystemControl.SystemControlType == eSystemControlType.Dmps34K350CSystemControl)
- output.AudioOutSource = eDmps34KAudioOutSource.AirMedia9;
- }
- else
- {
- //Shift video inputs by 5 for weird DMPS3-4K indexing
- output.AudioOutSource = (eDmps34KAudioOutSource)(inputSelector + 5);
- }
- }
- }
- }
-
- else if (inputSelector <= Dmps.SwitcherInputs.Count && outputSelector <= Dmps.SwitcherOutputs.Count)
- {
- var output = Dmps.SwitcherOutputs[outputSelector] as DMOutput;
- var input = inputSelector == 0 ? null : Dmps.SwitcherInputs[inputSelector] as DMInput;
- output.AudioOut = input;
- }
- }
- }
-
- #endregion
- }
-}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.DM/Chassis/HdMd8xNController.cs b/src/PepperDash.Essentials.DM/Chassis/HdMd8xNController.cs
deleted file mode 100644
index 958f71cc..00000000
--- a/src/PepperDash.Essentials.DM/Chassis/HdMd8xNController.cs
+++ /dev/null
@@ -1,518 +0,0 @@
-extern alias Full;
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Text.RegularExpressions;
-using Full.Newtonsoft.Json;
-using Crestron.SimplSharp;
-using Crestron.SimplSharpPro.DeviceSupport;
-using Crestron.SimplSharpPro.DM;
-using PepperDash.Core;
-using PepperDash.Essentials.Core;
-using PepperDash.Essentials.DM.Config;
-using Crestron.SimplSharpPro.DM.Cards;
-using PepperDash.Essentials.Core.Bridges;
-using PepperDash.Essentials.Core.Config;
-
-
-namespace PepperDash.Essentials.DM.Chassis
-{
- [Description("Wrapper class for all HdMd8xN switchers")]
- public class HdMd8xNController : CrestronGenericBridgeableBaseDevice, IRoutingNumericWithFeedback, IHasFeedback
- {
- private HdMd8xN _Chassis;
-
- public event EventHandler NumericSwitchChange;
-
- public Dictionary InputNames { get; set; }
- public Dictionary OutputNames { get; set; }
-
- public RoutingPortCollection InputPorts { get; private set; }
- public RoutingPortCollection OutputPorts { get; private set; }
-
- public FeedbackCollection VideoInputSyncFeedbacks { get; private set; }
- public FeedbackCollection VideoOutputRouteFeedbacks { get; private set; }
- public FeedbackCollection AudioOutputRouteFeedbacks { get; private set; }
- public FeedbackCollection InputNameFeedbacks { get; private set; }
- public FeedbackCollection OutputNameFeedbacks { get; private set; }
- public FeedbackCollection OutputVideoRouteNameFeedbacks { get; private set; }
- public FeedbackCollection OutputAudioRouteNameFeedbacks { get; private set; }
- public StringFeedback DeviceNameFeedback { get; private set; }
-
- #region Constructor
-
- public HdMd8xNController(string key, string name, HdMd8xN chassis,
- DMChassisPropertiesConfig props)
- : base(key, name, chassis)
- {
- _Chassis = chassis;
- Name = name;
- _Chassis.EnableAudioBreakaway.BoolValue = true;
-
- if (props == null)
- {
- Debug.Console(1, this, "HdMd8xNController properties are null, failed to build the device");
- return;
- }
-
- InputNames = new Dictionary();
- if (props.InputNames != null)
- {
- InputNames = props.InputNames;
- }
- OutputNames = new Dictionary();
- if (props.OutputNames != null)
- {
- OutputNames = props.OutputNames;
- }
-
- DeviceNameFeedback = new StringFeedback(()=> Name);
-
- VideoInputSyncFeedbacks = new FeedbackCollection();
- VideoOutputRouteFeedbacks = new FeedbackCollection();
- AudioOutputRouteFeedbacks = new FeedbackCollection();
- InputNameFeedbacks = new FeedbackCollection();
- OutputNameFeedbacks = new FeedbackCollection();
- OutputVideoRouteNameFeedbacks = new FeedbackCollection();
- OutputAudioRouteNameFeedbacks = new FeedbackCollection();
-
- InputPorts = new RoutingPortCollection();
- OutputPorts = new RoutingPortCollection();
-
- //Inputs - should always be 8 audio/video inputs
- for (uint i = 1; i <= _Chassis.NumberOfInputs; i++)
- {
- try
- {
- var index = i;
- if (!InputNames.ContainsKey(index))
- {
- InputNames.Add(index, string.Format("Input{0}", index));
- }
- string inputName = InputNames[index];
- _Chassis.Inputs[index].Name.StringValue = inputName;
-
-
- InputPorts.Add(new RoutingInputPort(inputName, eRoutingSignalType.AudioVideo,
- eRoutingPortConnectionType.Hdmi, _Chassis.Inputs[index], this)
- {
- FeedbackMatchObject = _Chassis.Inputs[index]
- });
-
- VideoInputSyncFeedbacks.Add(new BoolFeedback(inputName, () => _Chassis.Inputs[index].VideoDetectedFeedback.BoolValue));
- InputNameFeedbacks.Add(new StringFeedback(inputName, () => _Chassis.Inputs[index].NameFeedback.StringValue));
- }
- catch (Exception ex)
- {
- ErrorLog.Error("Exception creating input {0} on HD-MD8xN Chassis: {1}", i, ex);
- }
- }
-
- //Outputs. Either 2 outputs (1 audio, 1 audio/video) for HD-MD8x1 or 4 outputs (2 audio, 2 audio/video) for HD-MD8x2
- for (uint i = 1; i <= _Chassis.NumberOfOutputs; i++)
- {
- try
- {
- var index = i;
- if (!OutputNames.ContainsKey(index))
- {
- OutputNames.Add(index, string.Format("Output{0}", index));
- }
- string outputName = OutputNames[index];
- _Chassis.Outputs[index].Name.StringValue = outputName;
-
- OutputPorts.Add(new RoutingOutputPort(outputName, eRoutingSignalType.AudioVideo,
- eRoutingPortConnectionType.Hdmi, _Chassis.Outputs[index], this)
- {
- FeedbackMatchObject = _Chassis.Outputs[index]
- });
-
- OutputNameFeedbacks.Add(new StringFeedback(outputName, () => _Chassis.Outputs[index].NameFeedback.StringValue));
- VideoOutputRouteFeedbacks.Add(new IntFeedback(outputName, () => _Chassis.Outputs[index].VideoOutFeedback == null ? 0 : (int)_Chassis.Outputs[index].VideoOutFeedback.Number));
- AudioOutputRouteFeedbacks.Add(new IntFeedback(outputName, () => _Chassis.Outputs[index].AudioOutFeedback == null ? 0 : (int)_Chassis.Outputs[index].AudioOutFeedback.Number));
- OutputVideoRouteNameFeedbacks.Add(new StringFeedback(outputName, () => _Chassis.Outputs[index].VideoOutFeedback == null ? "None" : _Chassis.Outputs[index].VideoOutFeedback.NameFeedback.StringValue));
- OutputAudioRouteNameFeedbacks.Add(new StringFeedback(outputName, () => _Chassis.Outputs[index].AudioOutFeedback == null ? "None" : _Chassis.Outputs[index].VideoOutFeedback.NameFeedback.StringValue));
- }
- catch (Exception ex)
- {
- ErrorLog.Error("Exception creating output {0} on HD-MD8xN Chassis: {1}", i, ex);
- }
- }
-
- _Chassis.DMInputChange += Chassis_DMInputChange;
- _Chassis.DMOutputChange += Chassis_DMOutputChange;
-
- AddPostActivationAction(AddFeedbackCollections);
- }
- #endregion
-
- #region Methods
-
- ///
- /// Raise an event when the status of a switch object changes.
- ///
- /// Arguments defined as IKeyName sender, output, input, and eRoutingSignalType
- private void OnSwitchChange(RoutingNumericEventArgs e)
- {
- var newEvent = NumericSwitchChange;
- if (newEvent != null) newEvent(this, e);
- }
-
- #region PostActivate
-
- public void AddFeedbackCollections()
- {
- AddFeedbackToList(DeviceNameFeedback);
- AddCollectionsToList(VideoInputSyncFeedbacks);
- AddCollectionsToList(VideoOutputRouteFeedbacks, AudioOutputRouteFeedbacks);
- AddCollectionsToList(InputNameFeedbacks, OutputNameFeedbacks, OutputVideoRouteNameFeedbacks, OutputAudioRouteNameFeedbacks);
- }
-
- #endregion
-
- #region FeedbackCollection Methods
-
- //Add arrays of collections
- public void AddCollectionsToList(params FeedbackCollection[] newFbs)
- {
- foreach (FeedbackCollection fbCollection in newFbs)
- {
- foreach (var item in newFbs)
- {
- AddCollectionToList(item);
- }
- }
- }
- public void AddCollectionsToList(params FeedbackCollection[] newFbs)
- {
- foreach (FeedbackCollection fbCollection in newFbs)
- {
- foreach (var item in newFbs)
- {
- AddCollectionToList(item);
- }
- }
- }
-
- public void AddCollectionsToList(params FeedbackCollection[] newFbs)
- {
- foreach (FeedbackCollection fbCollection in newFbs)
- {
- foreach (var item in newFbs)
- {
- AddCollectionToList(item);
- }
- }
- }
-
- //Add Collections
- public void AddCollectionToList(FeedbackCollection newFbs)
- {
- foreach (var f in newFbs)
- {
- if (f == null) continue;
-
- AddFeedbackToList(f);
- }
- }
-
- public void AddCollectionToList(FeedbackCollection newFbs)
- {
- foreach (var f in newFbs)
- {
- if (f == null) continue;
-
- AddFeedbackToList(f);
- }
- }
-
- public void AddCollectionToList(FeedbackCollection newFbs)
- {
- foreach (var f in newFbs)
- {
- if (f == null) continue;
-
- AddFeedbackToList(f);
- }
- }
-
- //Add Individual Feedbacks
- public void AddFeedbackToList(PepperDash.Essentials.Core.Feedback newFb)
- {
- if (newFb == null) return;
-
- if (!Feedbacks.Contains(newFb))
- {
- Feedbacks.Add(newFb);
- }
- }
-
- #endregion
-
- #region IRouting Members
-
- public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType sigType)
- {
- var input = inputSelector as DMInput;
- var output = outputSelector as DMOutput;
- Debug.Console(2, this, "ExecuteSwitch: input={0} output={1} sigType={2}", input, output, sigType.ToString());
-
- if (output == null)
- {
- Debug.Console(0, this, "Unable to make switch. Output selector is not DMOutput");
- return;
- }
-
- if ((sigType & eRoutingSignalType.Video) == eRoutingSignalType.Video)
- {
- _Chassis.VideoEnter.BoolValue = true;
- if (output != null)
- {
- output.VideoOut = input;
- }
- }
-
- if ((sigType & eRoutingSignalType.Audio) == eRoutingSignalType.Audio)
- {
- _Chassis.AudioEnter.BoolValue = true;
- if (output != null)
- {
- output.AudioOut = input;
- }
- }
- }
-
- #endregion
-
- #region IRoutingNumeric Members
-
- public void ExecuteNumericSwitch(ushort inputSelector, ushort outputSelector, eRoutingSignalType signalType)
- {
-
- var input = inputSelector == 0 ? null : _Chassis.Inputs[inputSelector];
- var output = _Chassis.Outputs[outputSelector];
-
- Debug.Console(2, this, "ExecuteNumericSwitch: input={0} output={1}", input, output);
-
- ExecuteSwitch(input, output, signalType);
- }
-
- #endregion
-
- #endregion
-
- #region Bridge Linking
-
- public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
- {
- var joinMap = new DmChassisControllerJoinMap(joinStart);
-
- var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
-
- if (!string.IsNullOrEmpty(joinMapSerialized))
- joinMap = JsonConvert.DeserializeObject(joinMapSerialized);
-
- if (bridge != null)
- {
- bridge.AddJoinMap(Key, joinMap);
- }
- else
- {
- Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
- }
-
- IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]);
-
- trilist.StringInput[joinMap.Name.JoinNumber].StringValue = this.Name;
-
- for (uint i = 1; i <= _Chassis.NumberOfInputs; i++)
- {
- var joinIndex = i - 1;
- var input = i;
- //Digital
- VideoInputSyncFeedbacks[InputNames[input]].LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus.JoinNumber + joinIndex]);
-
- //Serial
- InputNameFeedbacks[InputNames[input]].LinkInputSig(trilist.StringInput[joinMap.InputNames.JoinNumber + joinIndex]);
- }
-
- for (uint i = 1; i <= _Chassis.NumberOfOutputs; i++)
- {
- var joinIndex = i - 1;
- var output = i;
- //Analog
- VideoOutputRouteFeedbacks[OutputNames[output]].LinkInputSig(trilist.UShortInput[joinMap.OutputVideo.JoinNumber + joinIndex]);
- trilist.SetUShortSigAction(joinMap.OutputVideo.JoinNumber + joinIndex, (a) => ExecuteNumericSwitch(a, (ushort)output, eRoutingSignalType.Video));
- AudioOutputRouteFeedbacks[OutputNames[output]].LinkInputSig(trilist.UShortInput[joinMap.OutputAudio.JoinNumber + joinIndex]);
- trilist.SetUShortSigAction(joinMap.OutputAudio.JoinNumber + joinIndex, (a) => ExecuteNumericSwitch(a, (ushort)output, eRoutingSignalType.Audio));
-
- //Serial
- OutputNameFeedbacks[OutputNames[output]].LinkInputSig(trilist.StringInput[joinMap.OutputNames.JoinNumber + joinIndex]);
- OutputVideoRouteNameFeedbacks[OutputNames[output]].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentVideoInputNames.JoinNumber + joinIndex]);
- OutputAudioRouteNameFeedbacks[OutputNames[output]].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentAudioInputNames.JoinNumber + joinIndex]);
- }
-
- _Chassis.OnlineStatusChange += Chassis_OnlineStatusChange;
-
- trilist.OnlineStatusChange += (d, args) =>
- {
- if (!args.DeviceOnLine) return;
- };
- }
-
-
- #endregion
-
- #region Events
-
- void Chassis_OnlineStatusChange(Crestron.SimplSharpPro.GenericBase currentDevice, Crestron.SimplSharpPro.OnlineOfflineEventArgs args)
- {
- IsOnline.FireUpdate();
-
- if (!args.DeviceOnLine) return;
-
- foreach (var feedback in Feedbacks)
- {
- feedback.FireUpdate();
- }
- }
-
- void Chassis_DMOutputChange(Switch device, DMOutputEventArgs args)
- {
- switch (args.EventId)
- {
- case DMOutputEventIds.VideoOutEventId:
- {
- var output = args.Number;
- var inputNumber = _Chassis.Outputs[output].VideoOutFeedback == null ? 0 : _Chassis.Outputs[output].VideoOutFeedback.Number;
-
- var outputName = OutputNames[output];
-
- var feedback = VideoOutputRouteFeedbacks[outputName];
-
- if (feedback == null)
- {
- return;
- }
- var inPort = InputPorts.FirstOrDefault(p => p.FeedbackMatchObject == _Chassis.Outputs[output].VideoOutFeedback);
- var outPort = OutputPorts.FirstOrDefault(p => p.FeedbackMatchObject == _Chassis.Outputs[output]);
-
- feedback.FireUpdate();
- OnSwitchChange(new RoutingNumericEventArgs(output, inputNumber, outPort, inPort, eRoutingSignalType.Video));
- break;
- }
- case DMOutputEventIds.AudioOutEventId:
- {
- var output = args.Number;
- var inputNumber = _Chassis.Outputs[output].AudioOutFeedback == null ? 0 : _Chassis.Outputs[output].AudioOutFeedback.Number;
-
- var outputName = OutputNames[output];
-
- var feedback = AudioOutputRouteFeedbacks[outputName];
-
- if (feedback == null)
- {
- return;
- }
- var inPort = InputPorts.FirstOrDefault(p => p.FeedbackMatchObject == _Chassis.Outputs[output].AudioOutFeedback);
- var outPort = OutputPorts.FirstOrDefault(p => p.FeedbackMatchObject == _Chassis.Outputs[output]);
-
- feedback.FireUpdate();
- OnSwitchChange(new RoutingNumericEventArgs(output, inputNumber, outPort, inPort, eRoutingSignalType.Audio));
- break;
- }
- case DMOutputEventIds.OutputNameEventId:
- case DMOutputEventIds.NameFeedbackEventId:
- {
- Debug.Console(1, this, "Event ID {0}: Updating name feedbacks.", args.EventId);
- Debug.Console(1, this, "Output {0} Name {1}", args.Number,
- _Chassis.Outputs[args.Number].NameFeedback.StringValue);
- foreach (var item in OutputNameFeedbacks)
- {
- item.FireUpdate();
- }
- break;
- }
- default:
- {
- Debug.Console(1, this, "Unhandled DM Output Event ID {0}", args.EventId);
- break;
- }
- }
- }
-
- void Chassis_DMInputChange(Switch device, DMInputEventArgs args)
- {
- switch (args.EventId)
- {
- case DMInputEventIds.VideoDetectedEventId:
- {
- Debug.Console(1, this, "Event ID {0}: Updating VideoInputSyncFeedbacks", args.EventId);
- foreach (var item in VideoInputSyncFeedbacks)
- {
- item.FireUpdate();
- }
- break;
- }
- case DMInputEventIds.InputNameFeedbackEventId:
- case DMInputEventIds.InputNameEventId:
- case DMInputEventIds.NameFeedbackEventId:
- {
- Debug.Console(1, this, "Event ID {0}: Updating name feedbacks.", args.EventId);
- Debug.Console(1, this, "Input {0} Name {1}", args.Number,
- _Chassis.Inputs[args.Number].NameFeedback.StringValue);
- foreach (var item in InputNameFeedbacks)
- {
- item.FireUpdate();
- }
- break;
- }
- default:
- {
- Debug.Console(1, this, "Unhandled DM Input Event ID {0}", args.EventId);
- break;
- }
- }
- }
-
- #endregion
-
- #region Factory
-
- public class HdMd8xNControllerFactory : EssentialsDeviceFactory
- {
- public HdMd8xNControllerFactory()
- {
- TypeNames = new List() { "hdmd8x2", "hdmd8x1" };
- }
-
- public override EssentialsDevice BuildDevice(DeviceConfig dc)
- {
- Debug.Console(1, "Factory Attempting to create new HD-MD-8xN Device");
-
- var props = JsonConvert.DeserializeObject(dc.Properties.ToString());
-
- var type = dc.Type.ToLower();
- var control = props.Control;
- var ipid = control.IpIdInt;
-
- switch (type)
- {
- case ("hdmd8x2"):
- return new HdMd8xNController(dc.Key, dc.Name, new HdMd8x2(ipid, Global.ControlSystem), props);
- case ("hdmd8x1"):
- return new HdMd8xNController(dc.Key, dc.Name, new HdMd8x1(ipid, Global.ControlSystem), props);
- default:
- return null;
- }
- }
- }
-
- #endregion
-
-
-
- }
-}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.DM/Chassis/HdMdNxM4kEBridgeableController.cs b/src/PepperDash.Essentials.DM/Chassis/HdMdNxM4kEBridgeableController.cs
deleted file mode 100644
index a2265497..00000000
--- a/src/PepperDash.Essentials.DM/Chassis/HdMdNxM4kEBridgeableController.cs
+++ /dev/null
@@ -1,506 +0,0 @@
-extern alias Full;
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Text.RegularExpressions;
-using Full.Newtonsoft.Json;
-using Crestron.SimplSharp;
-using Crestron.SimplSharpPro.DeviceSupport;
-using Crestron.SimplSharpPro.DM;
-
-using PepperDash.Core;
-using PepperDash.Essentials.Core;
-using PepperDash.Essentials.DM.Config;
-using PepperDash.Essentials.Core.Bridges;
-using PepperDash.Essentials.Core.Config;
-
-namespace PepperDash.Essentials.DM.Chassis
-{
- [Description("Wrapper class for all HdMdNxM4E switchers")]
- public class HdMdNxM4kEBridgeableController : CrestronGenericBridgeableBaseDevice, IRoutingNumericWithFeedback, IHasFeedback
- {
- private HdMdNxM _Chassis;
- private HdMd4x14kE _Chassis4x1;
-
- //IroutingNumericEvent
- public event EventHandler NumericSwitchChange;
-
- public Dictionary InputNames { get; set; }
- public Dictionary OutputNames { get; set; }
-
- public RoutingPortCollection InputPorts { get; private set; }
- public RoutingPortCollection OutputPorts { get; private set; }
-
- public FeedbackCollection VideoInputSyncFeedbacks { get; private set; }
- public FeedbackCollection VideoOutputRouteFeedbacks { get; private set; }
- public FeedbackCollection InputNameFeedbacks { get; private set; }
- public FeedbackCollection OutputNameFeedbacks { get; private set; }
- public FeedbackCollection OutputRouteNameFeedbacks { get; private set; }
- public FeedbackCollection InputHdcpEnableFeedback { get; private set; }
- public StringFeedback DeviceNameFeedback { get; private set; }
- public BoolFeedback AutoRouteFeedback { get; private set; }
-
- #region Constructor
-
- public HdMdNxM4kEBridgeableController(string key, string name, HdMdNxM chassis,
- HdMdNxM4kEBridgeablePropertiesConfig props)
- : base(key, name, chassis)
- {
- _Chassis = chassis;
- Name = name;
-
- if (props == null)
- {
- Debug.Console(1, this, "HdMdNx4keBridgeableController properties are null, failed to build the device");
- return;
- }
-
-
- if (props.Inputs != null)
- {
- foreach (var kvp in props.Inputs)
- {
- Debug.Console(1, this, "props.Inputs: {0}-{1}", kvp.Key, kvp.Value);
- }
- InputNames = props.Inputs;
- }
- if (props.Outputs != null)
- {
- foreach (var kvp in props.Outputs)
- {
- Debug.Console(1, this, "props.Outputs: {0}-{1}", kvp.Key, kvp.Value);
- }
- OutputNames = props.Outputs;
- }
-
- DeviceNameFeedback = new StringFeedback(()=>Name);
-
- VideoInputSyncFeedbacks = new FeedbackCollection();
- VideoOutputRouteFeedbacks = new FeedbackCollection();
- InputNameFeedbacks = new FeedbackCollection();
- OutputNameFeedbacks = new FeedbackCollection();
- OutputRouteNameFeedbacks = new FeedbackCollection();
- InputHdcpEnableFeedback = new FeedbackCollection();
-
- InputPorts = new RoutingPortCollection();
- OutputPorts = new RoutingPortCollection();
-
- if (_Chassis.NumberOfInputs == 1)
- {
- _Chassis4x1 = _Chassis as HdMd4x14kE;
- AutoRouteFeedback = new BoolFeedback(() => _Chassis4x1.AutoModeOnFeedback.BoolValue);
- }
-
- for (uint i = 1; i <= _Chassis.NumberOfInputs; i++)
- {
- var index = i;
- var inputName = InputNames[index];
- //_Chassis.Inputs[index].Name.StringValue = inputName;
- _Chassis.HdmiInputs[index].Name.StringValue = inputName;
-
- InputPorts.Add(new RoutingInputPort(inputName, eRoutingSignalType.AudioVideo,
- eRoutingPortConnectionType.Hdmi, _Chassis.HdmiInputs[index], this)
- {
- FeedbackMatchObject = _Chassis.HdmiInputs[index]
- });
- VideoInputSyncFeedbacks.Add(new BoolFeedback(inputName, () => _Chassis.Inputs[index].VideoDetectedFeedback.BoolValue));
- //InputNameFeedbacks.Add(new StringFeedback(inputName, () => _Chassis.Inputs[index].NameFeedback.StringValue));
- InputNameFeedbacks.Add(new StringFeedback(inputName, () => InputNames[index]));
- InputHdcpEnableFeedback.Add(new BoolFeedback(inputName, () => _Chassis.HdmiInputs[index].HdmiInputPort.HdcpSupportOnFeedback.BoolValue));
- }
-
- for (uint i = 1; i <= _Chassis.NumberOfOutputs; i++)
- {
- var index = i;
- var outputName = OutputNames[index];
- //_Chassis.Outputs[index].Name.StringValue = outputName;
- //_Chassis.HdmiOutputs[index].Name.StringValue = outputName;
-
- OutputPorts.Add(new RoutingOutputPort(outputName, eRoutingSignalType.AudioVideo,
- eRoutingPortConnectionType.Hdmi, _Chassis.HdmiOutputs[index], this)
- {
- FeedbackMatchObject = _Chassis.HdmiOutputs[index]
- });
- VideoOutputRouteFeedbacks.Add(new IntFeedback(outputName, () => _Chassis.Outputs[index].VideoOutFeedback == null ? 0 : (int)_Chassis.Outputs[index].VideoOutFeedback.Number));
- OutputNameFeedbacks.Add(new StringFeedback(outputName, () => OutputNames[index]));
- OutputRouteNameFeedbacks.Add(new StringFeedback(outputName, () => _Chassis.Outputs[index].VideoOutFeedback.NameFeedback.StringValue));
- }
-
- _Chassis.DMInputChange += Chassis_DMInputChange;
- _Chassis.DMOutputChange += Chassis_DMOutputChange;
-
- AddPostActivationAction(AddFeedbackCollections);
- }
-
- #endregion
-
- #region Methods
-
- ///
- /// Raise an event when the status of a switch object changes.
- ///
- /// Arguments defined as IKeyName sender, output, input, and eRoutingSignalType
- private void OnSwitchChange(RoutingNumericEventArgs e)
- {
- var newEvent = NumericSwitchChange;
- if (newEvent != null) newEvent(this, e);
- }
-
- public void EnableHdcp(uint port)
- {
- if (port > _Chassis.NumberOfInputs) return;
- if (port <= 0) return;
-
- _Chassis.HdmiInputs[port].HdmiInputPort.HdcpSupportOn();
- InputHdcpEnableFeedback[InputNames[port]].FireUpdate();
- }
-
- public void DisableHdcp(uint port)
- {
- if (port > _Chassis.NumberOfInputs) return;
- if (port <= 0) return;
-
- _Chassis.HdmiInputs[port].HdmiInputPort.HdcpSupportOff();
- InputHdcpEnableFeedback[InputNames[port]].FireUpdate();
- }
-
- public void EnableAutoRoute()
- {
- if (_Chassis.NumberOfInputs != 1) return;
-
- if (_Chassis4x1 == null) return;
-
- _Chassis4x1.AutoModeOn();
- }
-
- public void DisableAutoRoute()
- {
- if (_Chassis.NumberOfInputs != 1) return;
-
- if (_Chassis4x1 == null) return;
-
- _Chassis4x1.AutoModeOff();
- }
-
- #region PostActivate
-
- public void AddFeedbackCollections()
- {
- AddFeedbackToList(DeviceNameFeedback);
- AddCollectionsToList(VideoInputSyncFeedbacks, InputHdcpEnableFeedback);
- AddCollectionsToList(VideoOutputRouteFeedbacks);
- AddCollectionsToList(InputNameFeedbacks, OutputNameFeedbacks, OutputRouteNameFeedbacks);
- }
-
- #endregion
-
- #region FeedbackCollection Methods
-
- //Add arrays of collections
- public void AddCollectionsToList(params FeedbackCollection[] newFbs)
- {
- foreach (FeedbackCollection fbCollection in newFbs)
- {
- foreach (var item in newFbs)
- {
- AddCollectionToList(item);
- }
- }
- }
- public void AddCollectionsToList(params FeedbackCollection[] newFbs)
- {
- foreach (FeedbackCollection fbCollection in newFbs)
- {
- foreach (var item in newFbs)
- {
- AddCollectionToList(item);
- }
- }
- }
-
- public void AddCollectionsToList(params FeedbackCollection[] newFbs)
- {
- foreach (FeedbackCollection fbCollection in newFbs)
- {
- foreach (var item in newFbs)
- {
- AddCollectionToList(item);
- }
- }
- }
-
- //Add Collections
- public void AddCollectionToList(FeedbackCollection newFbs)
- {
- foreach (var f in newFbs)
- {
- if (f == null) continue;
-
- AddFeedbackToList(f);
- }
- }
-
- public void AddCollectionToList(FeedbackCollection newFbs)
- {
- foreach (var f in newFbs)
- {
- if (f == null) continue;
-
- AddFeedbackToList(f);
- }
- }
-
- public void AddCollectionToList(FeedbackCollection newFbs)
- {
- foreach (var f in newFbs)
- {
- if (f == null) continue;
-
- AddFeedbackToList(f);
- }
- }
-
- //Add Individual Feedbacks
- public void AddFeedbackToList(PepperDash.Essentials.Core.Feedback newFb)
- {
- if (newFb == null) return;
-
- if (!Feedbacks.Contains(newFb))
- {
- Feedbacks.Add(newFb);
- }
- }
-
- #endregion
-
- #region IRouting Members
-
- public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType)
- {
- var input = inputSelector as HdMdNxMHdmiInput; //changed from HdMdNxM4kzEHdmiInput;
- var output = outputSelector as HdMdNxMHdmiOutput;
- Debug.Console(2, this, "ExecuteSwitch: input={0} output={1}", input, output);
-
- if (output == null)
- {
- Debug.Console(0, this, "Unable to make switch. output selector is not HdMdNxMHdmiOutput");
- return;
- }
-
- // Try to make switch only when necessary. The unit appears to toggle when already selected.
- var current = output.VideoOut;
- if (current != input)
- output.VideoOut = input;
- }
-
- #endregion
-
- #region IRoutingNumeric Members
-
- public void ExecuteNumericSwitch(ushort inputSelector, ushort outputSelector, eRoutingSignalType signalType)
- {
- var input = inputSelector == 0 ? null : _Chassis.HdmiInputs[inputSelector];
- var output = _Chassis.HdmiOutputs[outputSelector];
-
- Debug.Console(2, this, "ExecuteNumericSwitch: input={0} output={1}", input, output);
-
- ExecuteSwitch(input, output, signalType);
- }
-
- #endregion
-
- #endregion
-
- #region Bridge Linking
-
- public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
- {
- var joinMap = new HdMdNxM4kEControllerJoinMap(joinStart);
-
- var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
-
- if (!string.IsNullOrEmpty(joinMapSerialized))
- joinMap = JsonConvert.DeserializeObject(joinMapSerialized);
-
- if (bridge != null)
- {
- bridge.AddJoinMap(Key, joinMap);
- }
- else
- {
- Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
- }
-
- IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]);
- DeviceNameFeedback.LinkInputSig(trilist.StringInput[joinMap.Name.JoinNumber]);
-
- if (_Chassis4x1 != null)
- {
- trilist.SetSigTrueAction(joinMap.EnableAutoRoute.JoinNumber, () => _Chassis4x1.AutoModeOn());
- trilist.SetSigFalseAction(joinMap.EnableAutoRoute.JoinNumber, () => _Chassis4x1.AutoModeOff());
- AutoRouteFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableAutoRoute.JoinNumber]);
- }
-
- for (uint i = 1; i <= _Chassis.NumberOfInputs; i++)
- {
- var joinIndex = i - 1;
- var input = i;
- //Digital
- VideoInputSyncFeedbacks[InputNames[input]].LinkInputSig(trilist.BooleanInput[joinMap.InputSync.JoinNumber + joinIndex]);
- InputHdcpEnableFeedback[InputNames[input]].LinkInputSig(trilist.BooleanInput[joinMap.EnableInputHdcp.JoinNumber + joinIndex]);
- InputHdcpEnableFeedback[InputNames[input]].LinkComplementInputSig(trilist.BooleanInput[joinMap.DisableInputHdcp.JoinNumber + joinIndex]);
- trilist.SetSigTrueAction(joinMap.EnableInputHdcp.JoinNumber + joinIndex, () => EnableHdcp(input));
- trilist.SetSigTrueAction(joinMap.DisableInputHdcp.JoinNumber + joinIndex, () => DisableHdcp(input));
-
- //Serial
- InputNameFeedbacks[InputNames[input]].LinkInputSig(trilist.StringInput[joinMap.InputName.JoinNumber + joinIndex]);
- }
-
- for (uint i = 1; i <= _Chassis.NumberOfOutputs; i++)
- {
- var joinIndex = i - 1;
- var output = i;
- //Analog
- VideoOutputRouteFeedbacks[OutputNames[output]].LinkInputSig(trilist.UShortInput[joinMap.OutputRoute.JoinNumber + joinIndex]);
- trilist.SetUShortSigAction(joinMap.OutputRoute.JoinNumber + joinIndex, (a) => ExecuteNumericSwitch(a, (ushort) output, eRoutingSignalType.AudioVideo));
-
- //Serial
- OutputNameFeedbacks[OutputNames[output]].LinkInputSig(trilist.StringInput[joinMap.OutputName.JoinNumber + joinIndex]);
- OutputRouteNameFeedbacks[OutputNames[output]].LinkInputSig(trilist.StringInput[joinMap.OutputRoutedName.JoinNumber + joinIndex]);
- }
-
- _Chassis.OnlineStatusChange += Chassis_OnlineStatusChange;
-
- trilist.OnlineStatusChange += (d, args) =>
- {
- if (!args.DeviceOnLine) return;
-
- // feedback updates was moved to the Chassis_OnlineStatusChange
- // due to the amount of time it takes for the device to come online
- };
- }
-
-
- #endregion
-
- #region Events
-
- void Chassis_OnlineStatusChange(Crestron.SimplSharpPro.GenericBase currentDevice, Crestron.SimplSharpPro.OnlineOfflineEventArgs args)
- {
- IsOnline.FireUpdate();
-
- if (!args.DeviceOnLine) return;
-
- foreach (var feedback in Feedbacks)
- {
- feedback.FireUpdate();
- }
-
- if (_Chassis4x1 != null)
- AutoRouteFeedback.FireUpdate();
- }
-
- void Chassis_DMOutputChange(Switch device, DMOutputEventArgs args)
- {
- if (args.EventId != DMOutputEventIds.VideoOutEventId) return;
-
- var output = args.Number;
-
- var inputNumber = _Chassis.HdmiOutputs[output].VideoOutFeedback == null
- ? 0
- : _Chassis.HdmiOutputs[output].VideoOutFeedback.Number;
-
- var outputName = OutputNames[output];
-
- var feedback = VideoOutputRouteFeedbacks[outputName];
-
- if (feedback == null)
- {
- return;
- }
- var inPort =
- InputPorts.FirstOrDefault(p => p.FeedbackMatchObject == _Chassis.HdmiOutputs[output].VideoOutFeedback);
- var outPort = OutputPorts.FirstOrDefault(p => p.FeedbackMatchObject == _Chassis.HdmiOutputs[output]);
-
- feedback.FireUpdate();
- OnSwitchChange(new RoutingNumericEventArgs(output, inputNumber, outPort, inPort, eRoutingSignalType.AudioVideo));
- }
-
- void Chassis_DMInputChange(Switch device, DMInputEventArgs args)
- {
- switch (args.EventId)
- {
- case DMInputEventIds.VideoDetectedEventId:
- {
- Debug.Console(1, this, "Event ID {0}: Updating VideoInputSyncFeedbacks", args.EventId);
- foreach (var item in VideoInputSyncFeedbacks)
- {
- item.FireUpdate();
- }
- break;
- }
- case DMInputEventIds.InputNameFeedbackEventId:
- case DMInputEventIds.InputNameEventId:
- case DMInputEventIds.NameFeedbackEventId:
- {
- Debug.Console(1, this, "Event ID {0}: Updating name feedbacks.", args.EventId);
- Debug.Console(1, this, "Input {0} Name {1}", args.Number,
- _Chassis.HdmiInputs[args.Number].NameFeedback.StringValue);
- foreach (var item in InputNameFeedbacks)
- {
- item.FireUpdate();
- }
- break;
- }
- default:
- {
- Debug.Console(1, this, "Unhandled DM Input Event ID {0}", args.EventId);
- break;
- }
- }
- }
-
- #endregion
-
- #region Factory
-
- public class HdMdNxM4kEControllerFactory : EssentialsDeviceFactory
- {
- public HdMdNxM4kEControllerFactory()
- {
- TypeNames = new List() { "hdmd4x14ke-bridgeable", "hdmd4x24ke", "hdmd6x24ke" };
- }
-
- public override EssentialsDevice BuildDevice(DeviceConfig dc)
- {
- Debug.Console(1, "Factory Attempting to create new HD-MD-NxM-4K-E Device");
-
- var props = JsonConvert.DeserializeObject(dc.Properties.ToString());
-
- var type = dc.Type.ToLower();
- var control = props.Control;
- var ipid = control.IpIdInt;
- var address = control.TcpSshProperties.Address;
-
- switch (type)
- {
- case ("hdmd4x14ke-bridgeable"):
- return new HdMdNxM4kEBridgeableController(dc.Key, dc.Name, new HdMd4x14kE(ipid, address, Global.ControlSystem), props);
- case ("hdmd4x24ke"):
- return new HdMdNxM4kEBridgeableController(dc.Key, dc.Name, new HdMd4x24kE(ipid, address, Global.ControlSystem), props);
- case ("hdmd6x24ke"):
- return new HdMdNxM4kEBridgeableController(dc.Key, dc.Name, new HdMd6x24kE(ipid, address, Global.ControlSystem), props);
- default:
- return null;
- }
- }
- }
-
- #endregion
-
-
-
- }
-}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.DM/Chassis/HdMdNxM4kEController.cs b/src/PepperDash.Essentials.DM/Chassis/HdMdNxM4kEController.cs
deleted file mode 100644
index 90186587..00000000
--- a/src/PepperDash.Essentials.DM/Chassis/HdMdNxM4kEController.cs
+++ /dev/null
@@ -1,171 +0,0 @@
-extern alias Full;
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Text.RegularExpressions;
-using Crestron.SimplSharp;
-using Crestron.SimplSharpPro.DM;
-using Full.Newtonsoft.Json;
-
-using PepperDash.Core;
-using PepperDash.Essentials.Core;
-using PepperDash.Essentials.Core.Config;
-using PepperDash.Essentials.DM.Config;
-
-namespace PepperDash.Essentials.DM.Chassis
-{
- [Obsolete("Please use HdMdNxM4kEBridgeable Controller")]
- public class HdMdNxM4kEController : CrestronGenericBaseDevice, IRoutingInputsOutputs, IRouting
- {
- public HdMdNxM Chassis { get; private set; }
-
- public RoutingPortCollection InputPorts { get; private set; }
- public RoutingPortCollection