From a4f1c7ecb5e75996eddb523866f7c28929a6d592 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Fri, 20 Mar 2020 17:33:14 -0600 Subject: [PATCH 001/156] added spaces to trigger build --- .github/workflows/docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 01e34297..60cb6bdd 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -11,7 +11,7 @@ on: env: # solution path doesn't need slashes unless there it is multiple folders deep - # solution name does not include extension. .sln is assumed + # solution name does not include extension. .sln is assumed SOLUTION_PATH: PepperDashEssentials SOLUTION_FILE: PepperDashEssentials # Do not edit this, we're just creating it here From 0d20ddf66aa55ef12127180dc5cc67ae4fdd3125 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Wed, 8 Apr 2020 23:14:37 -0600 Subject: [PATCH 002/156] fixes master.yml adds back push to builds repos for releases --- .github/workflows/master.yml | 152 +++++++++++++++++++++++++++++++++++ 1 file changed, 152 insertions(+) diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 42c13136..d25376b8 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -72,3 +72,155 @@ jobs: asset_content_type: application/zip env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + Internal_Push_Output: + needs: Build_Project + runs-on: windows-latest + steps: + # Checkout the repo + - name: Checkout Builds Repo + uses: actions/checkout@v2 + with: + token: ${{ secrets.BUILDS_TOKEN }} + repository: PepperDash-Engineering/essentials-builds + ref: ${{ Env.GITHUB_REF }} + # Download the version artifact from the build job + - name: Download Build Version Info + uses: actions/download-artifact@v1 + with: + name: Version + - name: Check Directory + run: Get-ChildItem "./" + # Set the version number environment variable from the file we just downloaded + - name: Set Version Number + shell: powershell + run: | + Get-ChildItem "./Version" + $version = Get-Content -Path ./Version/version.txt + Write-Host "Version: $version" + Write-Output "::set-env name=VERSION::$version" + Remove-Item -Path ./Version/version.txt + Remove-Item -Path ./Version + # Checkout/Create the branch + - name: Create new branch + run: git checkout -b $($Env:GITHUB_REF -replace "refs/heads/") + # Download the build output into the repo + - name: Download Build output + uses: actions/download-artifact@v1 + with: + name: Build + path: ./ + - name: Check directory + run: Get-ChildItem ./ + # Unzip the build package file + - name: Unzip Build file + run: | + Get-ChildItem .\*.zip | Expand-Archive -DestinationPath .\ + Remove-Item -Path .\*.zip + - name: Check directory again + run: Get-ChildItem ./ + # Copy Contents of output folder to root directory + - name: Copy Files to root & delete output directory + run: | + Remove-Item -Path .\* -Include @("*.cpz","*.md","*.cplz","*.json","*.dll","*.clz") + Get-ChildItem -Path .\output\* | Copy-Item -Destination .\ + Remove-Item -Path .\output -Recurse + # Commits the build output to the branch and tags it with the version + - name: Commit build output and tag the commit + shell: powershell + run: | + git config user.email "actions@pepperdash.com" + git config user.name "GitHub Actions" + git add . + $commit = "Build $($Env:GITHUB_RUN_NUMBER) from commit: https://github.com/$($Env:GITHUB_REPOSITORY)/commit/$($Env:GITHUB_SHA)" + Write-Host "Commit: $commit" + git commit -m $commit + git tag $($Env:VERSION) + # Push the commit + - name: Push to Builds Repo + shell: powershell + run: | + $branch = $($Env:GITHUB_REF) -replace "refs/heads/" + Write-Host "Branch: $branch" + git push -u origin $($branch) --force + # Push the tags + - name: Push tags + run: git push --tags origin + - name: Check Directory + run: Get-ChildItem ./ + # This step only runs if the branch is master or release/ runs and pushes the build to the public build repo + Public_Push_Output: + needs: Build_Project + runs-on: windows-latest + if: contains(github.ref, 'master') || contains(github.ref, 'release') + steps: + # Checkout the repo + - name: Checkout Builds Repo + uses: actions/checkout@v2 + with: + token: ${{ secrets.BUILDS_TOKEN }} + repository: PepperDash/Essentials-Builds + ref: ${{ Env.GITHUB_REF }} + # Download the version artifact from the build job + - name: Download Build Version Info + uses: actions/download-artifact@v1 + with: + name: Version + - name: Check Directory + run: Get-ChildItem "./" + # Set the version number environment variable from the file we just downloaded + - name: Set Version Number + shell: powershell + run: | + Get-ChildItem "./Version" + $version = Get-Content -Path ./Version/version.txt + Write-Host "Version: $version" + Write-Output "::set-env name=VERSION::$version" + Remove-Item -Path ./Version/version.txt + Remove-Item -Path ./Version + # Checkout/Create the branch + - name: Create new branch + run: git checkout -b $($Env:GITHUB_REF -replace "refs/heads/") + # Download the build output into the repo + - name: Download Build output + uses: actions/download-artifact@v1 + with: + name: Build + path: ./ + - name: Check directory + run: Get-ChildItem ./ + # Unzip the build package file + - name: Unzip Build file + run: | + Get-ChildItem .\*.zip | Expand-Archive -DestinationPath .\ + Remove-Item -Path .\*.zip + - name: Check directory again + run: Get-ChildItem ./ + # Copy Contents of output folder to root directory + - name: Copy Files to root & delete output directory + run: | + Remove-Item -Path .\* -Include @("*.cpz","*.md","*.cplz","*.json","*.dll","*.clz") + Get-ChildItem -Path .\output\* | Copy-Item -Destination .\ + Remove-Item -Path .\output -Recurse + # Commits the build output to the branch and tags it with the version + - name: Commit build output and tag the commit + shell: powershell + run: | + git config user.email "actions@pepperdash.com" + git config user.name "GitHub Actions" + git add . + $commit = "Build $($Env:GITHUB_RUN_NUMBER) from commit: https://github.com/$($Env:GITHUB_REPOSITORY)/commit/$($Env:GITHUB_SHA)" + Write-Host "Commit: $commit" + git commit -m $commit + git tag $($Env:VERSION) + # Push the commit + - name: Push to Builds Repo + shell: powershell + run: | + $branch = $($Env:GITHUB_REF) -replace "refs/heads/" + Write-Host "Branch: $branch" + git push -u origin $($branch) --force + # Push the tags + - name: Push tags + run: git push --tags origin + - name: Check Directory + run: Get-ChildItem ./ From b3238ec7b4a391e0bb5e5a5e86b6a64259f52f19 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Thu, 9 Apr 2020 09:50:16 -0600 Subject: [PATCH 003/156] adds version.txt creation and upload steps --- .github/workflows/master.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index d25376b8..2341e2c2 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -56,11 +56,21 @@ jobs: - name: Zip Build Output shell: powershell run: ./.github/scripts/ZipBuildOutput.ps1 + # Write the version to a file to be consumed by the push jobs + - name: Write Version + run: Write-Output "$($Env:VERSION)" | Out-File -FilePath "$($Env:GITHUB_HOME)\output\version.txt" + # Upload the build output as an artifact - name: Upload Build Output uses: actions/upload-artifact@v1 with: name: Build path: ./${{ env.SOLUTION_FILE}}-${{ env.VERSION}}.zip + # Upload the Version file as an artifact + - name: Upload version.txt + uses: actions/upload-artifact@v1 + with: + name: Version + path: ${{env.GITHUB_HOME}}\output\version.txt # Upload the build package to the release - name: Upload Release Package id: upload_release From ddab940dab473b45dfc245db39c13332a2a1a124 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Thu, 9 Apr 2020 10:46:23 -0600 Subject: [PATCH 004/156] fixes branch naming & creation --- .github/workflows/master.yml | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 2341e2c2..d8b85716 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -111,8 +111,8 @@ jobs: Remove-Item -Path ./Version/version.txt Remove-Item -Path ./Version # Checkout/Create the branch - - name: Create new branch - run: git checkout -b $($Env:GITHUB_REF -replace "refs/heads/") + - name: Checkout Master branch + run: git checkout -b master # Download the build output into the repo - name: Download Build output uses: actions/download-artifact@v1 @@ -148,10 +148,7 @@ jobs: # Push the commit - name: Push to Builds Repo shell: powershell - run: | - $branch = $($Env:GITHUB_REF) -replace "refs/heads/" - Write-Host "Branch: $branch" - git push -u origin $($branch) --force + run: git push -u origin master --force # Push the tags - name: Push tags run: git push --tags origin @@ -161,7 +158,6 @@ jobs: Public_Push_Output: needs: Build_Project runs-on: windows-latest - if: contains(github.ref, 'master') || contains(github.ref, 'release') steps: # Checkout the repo - name: Checkout Builds Repo @@ -189,7 +185,7 @@ jobs: Remove-Item -Path ./Version # Checkout/Create the branch - name: Create new branch - run: git checkout -b $($Env:GITHUB_REF -replace "refs/heads/") + run: git checkout -b master # Download the build output into the repo - name: Download Build output uses: actions/download-artifact@v1 @@ -225,10 +221,7 @@ jobs: # Push the commit - name: Push to Builds Repo shell: powershell - run: | - $branch = $($Env:GITHUB_REF) -replace "refs/heads/" - Write-Host "Branch: $branch" - git push -u origin $($branch) --force + run: git push -u origin master --force # Push the tags - name: Push tags run: git push --tags origin From 011e82676cf018ef04babfabab7a72ced0bb0a1b Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Fri, 10 Apr 2020 09:51:25 -0600 Subject: [PATCH 005/156] removes -b switch on master branch checkout --- .github/workflows/master.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index d8b85716..22c6ee46 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -112,7 +112,7 @@ jobs: Remove-Item -Path ./Version # Checkout/Create the branch - name: Checkout Master branch - run: git checkout -b master + run: git checkout master # Download the build output into the repo - name: Download Build output uses: actions/download-artifact@v1 From 29a79490babd416c3dc6d33d5ec5fc2be4a17de5 Mon Sep 17 00:00:00 2001 From: Jason T Alborough Date: Fri, 10 Apr 2020 16:29:48 -0400 Subject: [PATCH 006/156] #101 Fixes scope issue with CCriticalSection() in ConfigWriter --- .../Config/Essentials/ConfigWriter.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Essentials/ConfigWriter.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Essentials/ConfigWriter.cs index 1cd7b93e..cb361d28 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Essentials/ConfigWriter.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Essentials/ConfigWriter.cs @@ -19,7 +19,8 @@ namespace PepperDash.Essentials.Core.Config public const long WriteTimeout = 30000; - public static CTimer WriteTimer; + public static CTimer WriteTimer; + static CCriticalSection fileLock = new CCriticalSection(); /// /// Updates the config properties of a device @@ -127,8 +128,6 @@ namespace PepperDash.Essentials.Core.Config Debug.Console(0, Debug.ErrorLogLevel.Notice, "Writing Configuration to file"); - var fileLock = new CCriticalSection(); - Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to write config file: '{0}'", filePath); try From 5a75be0a66f5bd289fc01791dbea066c8288e70f Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 13 Apr 2020 11:37:01 -0600 Subject: [PATCH 007/156] fixes -b switch for public push job --- .github/workflows/master.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 22c6ee46..a362ea47 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -183,9 +183,9 @@ jobs: Write-Output "::set-env name=VERSION::$version" Remove-Item -Path ./Version/version.txt Remove-Item -Path ./Version - # Checkout/Create the branch + # Checkout master branch - name: Create new branch - run: git checkout -b master + run: git checkout master # Download the build output into the repo - name: Download Build output uses: actions/download-artifact@v1 From 31244e4294367b49abff3b80eee082d0dc3b7b0b Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 13 Apr 2020 16:01:19 -0600 Subject: [PATCH 008/156] moves bridgeBase and IBridge/IBridgeAdvanced --- .../Bridges/BridgeBase.cs | 811 +++++++++--------- .../Bridges/IBridge.cs | 6 +- 2 files changed, 406 insertions(+), 411 deletions(-) rename {PepperDashEssentials => essentials-framework/Essentials Core/PepperDashEssentialsBase}/Bridges/BridgeBase.cs (55%) rename {PepperDashEssentials => essentials-framework/Essentials Core/PepperDashEssentialsBase}/Bridges/IBridge.cs (82%) diff --git a/PepperDashEssentials/Bridges/BridgeBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs similarity index 55% rename from PepperDashEssentials/Bridges/BridgeBase.cs rename to essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs index b3f131c3..b71aab01 100644 --- a/PepperDashEssentials/Bridges/BridgeBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs @@ -1,407 +1,406 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro.EthernetCommunication; - -using Newtonsoft.Json; - -using PepperDash.Core; -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Core.Lighting; -using PepperDash.Essentials.Core.Devices; -using PepperDash.Essentials.Devices.Common; -using PepperDash.Essentials.Devices.Common.Cameras; -using PepperDash.Essentials.Core.Config; -using PepperDash.Essentials.Core.CrestronIO; -using PepperDash.Essentials.DM; -//using PepperDash.Essentials.Devices.Common.Cameras; - -namespace PepperDash.Essentials.Bridges -{ - /// - /// Helper methods for bridges - /// - public static class BridgeHelper - { - public static void PrintJoinMap(string command) - { - string bridgeKey = ""; - string deviceKey = ""; - - var targets = command.Split(' '); - - bridgeKey = targets[0].Trim(); - - var bridge = DeviceManager.GetDeviceForKey(bridgeKey) as EiscApi; - - if (bridge == null) - { - Debug.Console(0, "Unable to find bridge with key: '{0}'", bridgeKey); - return; - } - - if (targets.Length > 1) - { - deviceKey = targets[1].Trim(); - - if (!string.IsNullOrEmpty(deviceKey)) - { - bridge.PrintJoinMapForDevice(deviceKey); - return; - } - } - else - { - bridge.PrintJoinMaps(); - } - } - } - - - /// - /// Base class for all bridge class variants - /// - public class BridgeBase : Device - { - public BridgeApi Api { get; private set; } - - public BridgeBase(string key) : - base(key) - { - - } - - } - - /// - /// Base class for bridge API variants - /// - public abstract class BridgeApi : Device - { - public BridgeApi(string key) : - base(key) - { - - } - } - - /// - /// Bridge API using EISC - /// - public class EiscApi : BridgeApi - { - public EiscApiPropertiesConfig PropertiesConfig { get; private set; } - - protected Dictionary JoinMaps { get; private set; } - - public ThreeSeriesTcpIpEthernetIntersystemCommunications Eisc { get; private set; } - - public EiscApi(DeviceConfig dc) : - base(dc.Key) - { - JoinMaps = new Dictionary(); - - PropertiesConfig = JsonConvert.DeserializeObject(dc.Properties.ToString()); - - Eisc = new ThreeSeriesTcpIpEthernetIntersystemCommunications(PropertiesConfig.Control.IpIdInt, PropertiesConfig.Control.TcpSshProperties.Address, Global.ControlSystem); - - Eisc.SigChange += new Crestron.SimplSharpPro.DeviceSupport.SigEventHandler(Eisc_SigChange); - - Eisc.Register(); - - AddPostActivationAction( () => - { - Debug.Console(1, this, "Linking Devices..."); - - foreach (var d in PropertiesConfig.Devices) - { - var device = DeviceManager.GetDeviceForKey(d.DeviceKey); - - if (device != null) - { - Debug.Console(1, this, "Linking Device: '{0}'", device.Key); - - - if (device is IBridge) // Check for this first to allow bridges in plugins to override existing bridges that apply to the same type. - { - (device as IBridge).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - continue; - } - else if (device is IBridgeAdvanced) - { - Debug.Console(2, this, "'{0}' is IBridgeAdvanced", device.Key); - (device as IBridgeAdvanced).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey, this); - } - else if (device is PepperDash.Essentials.Core.Monitoring.SystemMonitorController) - { - (device as PepperDash.Essentials.Core.Monitoring.SystemMonitorController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - continue; - } - else if (device is GenericComm) - { - (device as GenericComm).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - continue; - } - else if (device is CameraBase) - { - (device as CameraBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey, this); - continue; - } - else if (device is PepperDash.Essentials.Core.DisplayBase) - { - (device as DisplayBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - continue; - } - else if (device is DmChassisController) - { - (device as DmChassisController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - continue; - } - else if (device is DmBladeChassisController) - { - (device as DmBladeChassisController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - continue; - } - else if (device is DmpsRoutingController) - { - (device as DmpsRoutingController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - continue; - } - else if (device is DmpsAudioOutputController) - { - (device as DmpsAudioOutputController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - continue; - } - else if (device is DmTxControllerBase) - { - (device as DmTxControllerBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - continue; - } - else if (device is DmRmcControllerBase) - { - (device as DmRmcControllerBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - continue; - } - else if (device is GenericRelayDevice) - { - (device as GenericRelayDevice).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - continue; - } - else if (device is IRSetTopBoxBase) - { - (device as IRSetTopBoxBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - continue; - } - else if (device is IDigitalInput) - { - (device as IDigitalInput).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - continue; - } - else if (device is AppleTV) - { - (device as AppleTV).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - continue; - } - else if (device is HdMdxxxCEController) - { - (device as HdMdxxxCEController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - continue; - } - else if (device is LightingBase) - { - (device as LightingBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - continue; - } - else if (device is DigitalLogger) - { - (device as DigitalLogger).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - continue; - } - else if (device is PepperDash.Essentials.Devices.Common.Occupancy.GlsOccupancySensorBaseController) - { - (device as PepperDash.Essentials.Devices.Common.Occupancy.GlsOccupancySensorBaseController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - continue; - } - else if (device is StatusSignController) - { - (device as StatusSignController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - continue; - } - else if (device is C2nRthsController) - { - (device as C2nRthsController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - continue; - } - } - } - - Debug.Console(1, this, "Devices Linked."); - }); - } - - /// - /// Adds a join map - /// - /// - /// - public void AddJoinMap(string deviceKey, JoinMapBaseAdvanced joinMap) - { - if (!JoinMaps.ContainsKey(deviceKey)) - { - JoinMaps.Add(deviceKey, joinMap); - } - else - { - Debug.Console(2, this, "Unable to add join map with key '{0}'. Key already exists in JoinMaps dictionary", deviceKey); - } - } - - /// - /// Prints all the join maps on this bridge - /// - public void PrintJoinMaps() - { - Debug.Console(0, this, "Join Maps for EISC IPID: {0}", Eisc.ID.ToString("X")); - - foreach (var joinMap in JoinMaps) - { - Debug.Console(0, "Join map for device '{0}':", joinMap.Key); - joinMap.Value.PrintJoinMapInfo(); - } - } - - /// - /// Prints the join map for a device by key - /// - /// - public void PrintJoinMapForDevice(string deviceKey) - { - var joinMap = JoinMaps[deviceKey]; - - if (joinMap == null) - { - Debug.Console(0, this, "Unable to find joinMap for device with key: '{0}'", deviceKey); - return; - } - - Debug.Console(0, "Join map for device '{0}' on EISC '{1}':", deviceKey, this.Key); - joinMap.PrintJoinMapInfo(); - } - - /// - /// Used for debugging to trigger an action based on a join number and type - /// - /// - /// - public void ExecuteJoinAction(uint join, string type, object state) - { - try - { - switch (type.ToLower()) - { - case "digital": - { - var uo = Eisc.BooleanOutput[join].UserObject as Action; - if (uo != null) - { - Debug.Console(1, this, "Executing Action: {0}", uo.ToString()); - uo(Convert.ToBoolean(state)); - } - else - Debug.Console(1, this, "User Action is null. Nothing to Execute"); - break; - } - case "analog": - { - var uo = Eisc.BooleanOutput[join].UserObject as Action; - if (uo != null) - { - Debug.Console(1, this, "Executing Action: {0}", uo.ToString()); - uo(Convert.ToUInt16(state)); - } - else - Debug.Console(1, this, "User Action is null. Nothing to Execute"); break; - } - case "serial": - { - var uo = Eisc.BooleanOutput[join].UserObject as Action; - if (uo != null) - { - Debug.Console(1, this, "Executing Action: {0}", uo.ToString()); - uo(Convert.ToString(state)); - } - else - Debug.Console(1, this, "User Action is null. Nothing to Execute"); - break; - } - default: - { - Debug.Console(1, "Unknown join type. Use digital/serial/analog"); - break; - } - } - } - catch (Exception e) - { - Debug.Console(1, this, "Error: {0}", e); - } - - } - - /// - /// Handles incoming sig changes - /// - /// - /// - void Eisc_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args) - { - try - { - if (Debug.Level >= 1) - Debug.Console(1, this, "EiscApi change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue); - var uo = args.Sig.UserObject; - if (uo != null) - { - Debug.Console(1, this, "Executing Action: {0}", uo.ToString()); - if (uo is Action) - (uo as Action)(args.Sig.BoolValue); - else if (uo is Action) - (uo as Action)(args.Sig.UShortValue); - else if (uo is Action) - (uo as Action)(args.Sig.StringValue); - } - } - catch (Exception e) - { - Debug.Console(2, this, "Error in Eisc_SigChange handler: {0}", e); - } - } - } - - public class EiscApiPropertiesConfig - { - [JsonProperty("control")] - public EssentialsControlPropertiesConfig Control { get; set; } - - [JsonProperty("devices")] - public List Devices { get; set; } - - - public class ApiDevicePropertiesConfig - { - [JsonProperty("deviceKey")] - public string DeviceKey { get; set; } - - [JsonProperty("joinStart")] - public uint JoinStart { get; set; } - - [JsonProperty("joinMapKey")] - public string JoinMapKey { get; set; } - } - - } - - +using System; +using System.Collections.Generic; +using Crestron.SimplSharp.Reflection; +using Crestron.SimplSharpPro.EthernetCommunication; + +using Newtonsoft.Json; + +using PepperDash.Core; +using PepperDash.Essentials.Core.Lighting; +using PepperDash.Essentials.Core.Config; +using PepperDash.Essentials.Core.CrestronIO; + +//using PepperDash.Essentials.Devices.Common.Cameras; + +namespace PepperDash.Essentials.Core.Bridges +{ + /// + /// Helper methods for bridges + /// + public static class BridgeHelper + { + public static void PrintJoinMap(string command) + { + var targets = command.Split(' '); + + var bridgeKey = targets[0].Trim(); + + var bridge = DeviceManager.GetDeviceForKey(bridgeKey) as EiscApi; + + if (bridge == null) + { + Debug.Console(0, "Unable to find bridge with key: '{0}'", bridgeKey); + return; + } + + if (targets.Length > 1) + { + var deviceKey = targets[1].Trim(); + + if (string.IsNullOrEmpty(deviceKey)) return; + bridge.PrintJoinMapForDevice(deviceKey); + } + else + { + bridge.PrintJoinMaps(); + } + } + } + + + /// + /// Base class for all bridge class variants + /// + public class BridgeBase : EssentialsDevice + { + public BridgeApi Api { get; protected set; } + + public BridgeBase(string key) : + base(key) + { + + } + } + + /// + /// Base class for bridge API variants + /// + public abstract class BridgeApi : EssentialsDevice + { + protected BridgeApi(string key) : + base(key) + { + + } + } + + /// + /// Bridge API using EISC + /// + public class EiscApi : BridgeApi + { + public EiscApiPropertiesConfig PropertiesConfig { get; private set; } + + protected Dictionary JoinMaps { get; private set; } + + public ThreeSeriesTcpIpEthernetIntersystemCommunications Eisc { get; private set; } + + public EiscApi(DeviceConfig dc) : + base(dc.Key) + { + JoinMaps = new Dictionary(); + + PropertiesConfig = JsonConvert.DeserializeObject(dc.Properties.ToString()); + + Eisc = new ThreeSeriesTcpIpEthernetIntersystemCommunications(PropertiesConfig.Control.IpIdInt, PropertiesConfig.Control.TcpSshProperties.Address, Global.ControlSystem); + + Eisc.SigChange += Eisc_SigChange; + + Eisc.Register(); + + AddPostActivationAction( () => + { + Debug.Console(1, this, "Linking Devices..."); + + foreach (var d in PropertiesConfig.Devices) + { + var device = DeviceManager.GetDeviceForKey(d.DeviceKey); + + if (device == null) continue; + + Debug.Console(1, this, "Linking Device: '{0}'", device.Key); + + if (device.GetType().GetCType().IsAssignableFrom(typeof (IBridge))) + { + var bridge = device as IBridge; + + if (bridge != null) bridge.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + continue; + } + + if (device.GetType().GetCType().IsAssignableFrom(typeof (IBridgeAdvanced))) + { + var bridge = device as IBridgeAdvanced; + if (bridge != null) bridge.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey, this); + } + + //if (device is IBridge) // Check for this first to allow bridges in plugins to override existing bridges that apply to the same type. + //{ + // (device as IBridge).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + // continue; + //} + //else if (device is IBridgeAdvanced) + //{ + // Debug.Console(2, this, "'{0}' is IBridgeAdvanced", device.Key); + // (device as IBridgeAdvanced).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey, this); + //} + //else if (device is PepperDash.Essentials.Core.Monitoring.SystemMonitorController) + //{ + // (device as PepperDash.Essentials.Core.Monitoring.SystemMonitorController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + // continue; + //} + //else if (device is GenericComm) + //{ + // (device as GenericComm).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + // continue; + //} + //else if (device is CameraBase) + //{ + // (device as CameraBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey, this); + // continue; + //} + //else if (device is PepperDash.Essentials.Core.DisplayBase) + //{ + // (device as DisplayBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + // continue; + //} + //else if (device is DmChassisController) + //{ + // (device as DmChassisController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + // continue; + //} + //else if (device is DmBladeChassisController) + //{ + // (device as DmBladeChassisController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + // continue; + //} + //else if (device is DmpsRoutingController) + //{ + // (device as DmpsRoutingController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + // continue; + //} + //else if (device is DmpsAudioOutputController) + //{ + // (device as DmpsAudioOutputController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + // continue; + //} + //else if (device is DmTxControllerBase) + //{ + // (device as DmTxControllerBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + // continue; + //} + //else if (device is DmRmcControllerBase) + //{ + // (device as DmRmcControllerBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + // continue; + //} + //else if (device is GenericRelayDevice) + //{ + // (device as GenericRelayDevice).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + // continue; + //} + //else if (device is IRSetTopBoxBase) + //{ + // (device as IRSetTopBoxBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + // continue; + //} + //else if (device is IDigitalInput) + //{ + // (device as IDigitalInput).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + // continue; + //} + //else if (device is AppleTV) + //{ + // (device as AppleTV).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + // continue; + //} + //else if (device is HdMdxxxCEController) + //{ + // (device as HdMdxxxCEController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + // continue; + //} + //else if (device is LightingBase) + //{ + // (device as LightingBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + // continue; + //} + //else if (device is DigitalLogger) + //{ + // (device as DigitalLogger).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + // continue; + //} + //else if (device is PepperDash.Essentials.Devices.Common.Occupancy.GlsOccupancySensorBaseController) + //{ + // (device as PepperDash.Essentials.Devices.Common.Occupancy.GlsOccupancySensorBaseController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + // continue; + //} + //else if (device is StatusSignController) + //{ + // (device as StatusSignController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + // continue; + //} + //else if (device is C2nRthsController) + //{ + // (device as C2nRthsController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + // continue; + //} + } + + Debug.Console(1, this, "Devices Linked."); + }); + } + + /// + /// Adds a join map + /// + /// + /// + public void AddJoinMap(string deviceKey, JoinMapBaseAdvanced joinMap) + { + if (!JoinMaps.ContainsKey(deviceKey)) + { + JoinMaps.Add(deviceKey, joinMap); + } + else + { + Debug.Console(2, this, "Unable to add join map with key '{0}'. Key already exists in JoinMaps dictionary", deviceKey); + } + } + + /// + /// Prints all the join maps on this bridge + /// + public void PrintJoinMaps() + { + Debug.Console(0, this, "Join Maps for EISC IPID: {0}", Eisc.ID.ToString("X")); + + foreach (var joinMap in JoinMaps) + { + Debug.Console(0, "Join map for device '{0}':", joinMap.Key); + joinMap.Value.PrintJoinMapInfo(); + } + } + + /// + /// Prints the join map for a device by key + /// + /// + public void PrintJoinMapForDevice(string deviceKey) + { + var joinMap = JoinMaps[deviceKey]; + + if (joinMap == null) + { + Debug.Console(0, this, "Unable to find joinMap for device with key: '{0}'", deviceKey); + return; + } + + Debug.Console(0, "Join map for device '{0}' on EISC '{1}':", deviceKey, this.Key); + joinMap.PrintJoinMapInfo(); + } + + /// + /// Used for debugging to trigger an action based on a join number and type + /// + /// + /// + public void ExecuteJoinAction(uint join, string type, object state) + { + try + { + switch (type.ToLower()) + { + case "digital": + { + var uo = Eisc.BooleanOutput[join].UserObject as Action; + if (uo != null) + { + Debug.Console(1, this, "Executing Action: {0}", uo.ToString()); + uo(Convert.ToBoolean(state)); + } + else + Debug.Console(1, this, "User Action is null. Nothing to Execute"); + break; + } + case "analog": + { + var uo = Eisc.BooleanOutput[join].UserObject as Action; + if (uo != null) + { + Debug.Console(1, this, "Executing Action: {0}", uo.ToString()); + uo(Convert.ToUInt16(state)); + } + else + Debug.Console(1, this, "User Action is null. Nothing to Execute"); break; + } + case "serial": + { + var uo = Eisc.BooleanOutput[join].UserObject as Action; + if (uo != null) + { + Debug.Console(1, this, "Executing Action: {0}", uo.ToString()); + uo(Convert.ToString(state)); + } + else + Debug.Console(1, this, "User Action is null. Nothing to Execute"); + break; + } + default: + { + Debug.Console(1, "Unknown join type. Use digital/serial/analog"); + break; + } + } + } + catch (Exception e) + { + Debug.Console(1, this, "Error: {0}", e); + } + + } + + /// + /// Handles incoming sig changes + /// + /// + /// + void Eisc_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args) + { + try + { + if (Debug.Level >= 1) + Debug.Console(1, this, "EiscApi change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue); + var uo = args.Sig.UserObject; + if (uo != null) + { + Debug.Console(1, this, "Executing Action: {0}", uo.ToString()); + if (uo is Action) + (uo as Action)(args.Sig.BoolValue); + else if (uo is Action) + (uo as Action)(args.Sig.UShortValue); + else if (uo is Action) + (uo as Action)(args.Sig.StringValue); + } + } + catch (Exception e) + { + Debug.Console(2, this, "Error in Eisc_SigChange handler: {0}", e); + } + } + } + + public class EiscApiPropertiesConfig + { + [JsonProperty("control")] + public EssentialsControlPropertiesConfig Control { get; set; } + + [JsonProperty("devices")] + public List Devices { get; set; } + + + public class ApiDevicePropertiesConfig + { + [JsonProperty("deviceKey")] + public string DeviceKey { get; set; } + + [JsonProperty("joinStart")] + public uint JoinStart { get; set; } + + [JsonProperty("joinMapKey")] + public string JoinMapKey { get; set; } + } + + } + + } \ No newline at end of file diff --git a/PepperDashEssentials/Bridges/IBridge.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/IBridge.cs similarity index 82% rename from PepperDashEssentials/Bridges/IBridge.cs rename to essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/IBridge.cs index f2b959ed..a4e09c8e 100644 --- a/PepperDashEssentials/Bridges/IBridge.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/IBridge.cs @@ -1,11 +1,7 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; using Crestron.SimplSharpPro.DeviceSupport; -namespace PepperDash.Essentials.Bridges +namespace PepperDash.Essentials.Core.Bridges { /// /// Defines a device that uses the legacy JoinMapBase for its join map From cebca45877006a502035d737a1c23cb7b42cb64d Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 13 Apr 2020 16:01:43 -0600 Subject: [PATCH 009/156] adds EssentialsBridgeableDevice --- .../Devices/EssentialsBridgeableDevice.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/EssentialsBridgeableDevice.cs diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/EssentialsBridgeableDevice.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/EssentialsBridgeableDevice.cs new file mode 100644 index 00000000..36c5c692 --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/EssentialsBridgeableDevice.cs @@ -0,0 +1,19 @@ +using Crestron.SimplSharpPro.DeviceSupport; +using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; + +namespace PepperDash_Essentials_Core.Devices +{ + public abstract class EssentialsBridgeableDevice:EssentialsDevice, IBridgeAdvanced + { + protected EssentialsBridgeableDevice(string key) : base(key) + { + } + + protected EssentialsBridgeableDevice(string key, string name) : base(key, name) + { + } + + public abstract void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge); + } +} \ No newline at end of file From 999b3903b7be140c69481f874e16b66a7d4b6876 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 13 Apr 2020 16:11:09 -0600 Subject: [PATCH 010/156] moves joinMaps to Essentials Core --- .../JoinMaps/AirMediaControllerJoinMap.cs | 0 .../Bridges/JoinMaps/AppleTvJoinMap.cs | 0 .../JoinMaps/C2nRthsControllerJoinMap.cs | 84 ++-- .../JoinMaps/CameraControllerJoinMap.cs | 0 .../Bridges/JoinMaps/DigitalLoggerJoinMap.cs | 0 .../JoinMaps/DisplayControllerJoinMap.cs | 0 .../DmBladeChassisControllerJoinMap.cs | 218 ++++---- .../JoinMaps/DmChassisControllerJoinMap.cs | 0 .../JoinMaps/DmRmcControllerJoinMap.cs | 0 .../Bridges/JoinMaps/DmTxControllerJoinMap.cs | 0 .../DmpsAudioOutputControllerJoinMap.cs | 0 .../JoinMaps/DmpsRoutingControllerJoinMap.cs | 0 .../JoinMaps/GenericLightingJoinMap.cs | 0 .../JoinMaps/GenericRelayControllerJoinMap.cs | 0 .../JoinMaps/GlsOccupancySensorBaseJoinMap.cs | 476 +++++++++--------- .../JoinMaps/HdMdxxxCEControllerJoinMap.cs | 0 .../JoinMaps/IBasicCommunicationJoinMap.cs | 0 .../Bridges/JoinMaps/IDigitalInputJoinMap.cs | 0 .../JoinMaps/SetTopBoxControllerJoinMap.cs | 422 ++++++++-------- .../JoinMaps/StatusSignControllerJoinMap.cs | 96 ++-- .../Bridges/JoinMaps/SystemMonitorJoinMap.cs | 0 21 files changed, 648 insertions(+), 648 deletions(-) rename {PepperDashEssentials => essentials-framework/Essentials Core/PepperDashEssentialsBase}/Bridges/JoinMaps/AirMediaControllerJoinMap.cs (100%) rename {PepperDashEssentials => essentials-framework/Essentials Core/PepperDashEssentialsBase}/Bridges/JoinMaps/AppleTvJoinMap.cs (100%) rename {PepperDashEssentials => essentials-framework/Essentials Core/PepperDashEssentialsBase}/Bridges/JoinMaps/C2nRthsControllerJoinMap.cs (96%) rename {PepperDashEssentials => essentials-framework/Essentials Core/PepperDashEssentialsBase}/Bridges/JoinMaps/CameraControllerJoinMap.cs (100%) rename {PepperDashEssentials => essentials-framework/Essentials Core/PepperDashEssentialsBase}/Bridges/JoinMaps/DigitalLoggerJoinMap.cs (100%) rename {PepperDashEssentials => essentials-framework/Essentials Core/PepperDashEssentialsBase}/Bridges/JoinMaps/DisplayControllerJoinMap.cs (100%) rename {PepperDashEssentials => essentials-framework/Essentials Core/PepperDashEssentialsBase}/Bridges/JoinMaps/DmBladeChassisControllerJoinMap.cs (97%) rename {PepperDashEssentials => essentials-framework/Essentials Core/PepperDashEssentialsBase}/Bridges/JoinMaps/DmChassisControllerJoinMap.cs (100%) rename {PepperDashEssentials => essentials-framework/Essentials Core/PepperDashEssentialsBase}/Bridges/JoinMaps/DmRmcControllerJoinMap.cs (100%) rename {PepperDashEssentials => essentials-framework/Essentials Core/PepperDashEssentialsBase}/Bridges/JoinMaps/DmTxControllerJoinMap.cs (100%) rename {PepperDashEssentials => essentials-framework/Essentials Core/PepperDashEssentialsBase}/Bridges/JoinMaps/DmpsAudioOutputControllerJoinMap.cs (100%) rename {PepperDashEssentials => essentials-framework/Essentials Core/PepperDashEssentialsBase}/Bridges/JoinMaps/DmpsRoutingControllerJoinMap.cs (100%) rename {PepperDashEssentials => essentials-framework/Essentials Core/PepperDashEssentialsBase}/Bridges/JoinMaps/GenericLightingJoinMap.cs (100%) rename {PepperDashEssentials => essentials-framework/Essentials Core/PepperDashEssentialsBase}/Bridges/JoinMaps/GenericRelayControllerJoinMap.cs (100%) rename {PepperDashEssentials => essentials-framework/Essentials Core/PepperDashEssentialsBase}/Bridges/JoinMaps/GlsOccupancySensorBaseJoinMap.cs (97%) rename {PepperDashEssentials => essentials-framework/Essentials Core/PepperDashEssentialsBase}/Bridges/JoinMaps/HdMdxxxCEControllerJoinMap.cs (100%) rename {PepperDashEssentials => essentials-framework/Essentials Core/PepperDashEssentialsBase}/Bridges/JoinMaps/IBasicCommunicationJoinMap.cs (100%) rename {PepperDashEssentials => essentials-framework/Essentials Core/PepperDashEssentialsBase}/Bridges/JoinMaps/IDigitalInputJoinMap.cs (100%) rename {PepperDashEssentials => essentials-framework/Essentials Core/PepperDashEssentialsBase}/Bridges/JoinMaps/SetTopBoxControllerJoinMap.cs (96%) rename {PepperDashEssentials => essentials-framework/Essentials Core/PepperDashEssentialsBase}/Bridges/JoinMaps/StatusSignControllerJoinMap.cs (96%) rename {PepperDashEssentials => essentials-framework/Essentials Core/PepperDashEssentialsBase}/Bridges/JoinMaps/SystemMonitorJoinMap.cs (100%) diff --git a/PepperDashEssentials/Bridges/JoinMaps/AirMediaControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/AirMediaControllerJoinMap.cs similarity index 100% rename from PepperDashEssentials/Bridges/JoinMaps/AirMediaControllerJoinMap.cs rename to essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/AirMediaControllerJoinMap.cs diff --git a/PepperDashEssentials/Bridges/JoinMaps/AppleTvJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/AppleTvJoinMap.cs similarity index 100% rename from PepperDashEssentials/Bridges/JoinMaps/AppleTvJoinMap.cs rename to essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/AppleTvJoinMap.cs diff --git a/PepperDashEssentials/Bridges/JoinMaps/C2nRthsControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/C2nRthsControllerJoinMap.cs similarity index 96% rename from PepperDashEssentials/Bridges/JoinMaps/C2nRthsControllerJoinMap.cs rename to essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/C2nRthsControllerJoinMap.cs index be0f002e..1c693070 100644 --- a/PepperDashEssentials/Bridges/JoinMaps/C2nRthsControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/C2nRthsControllerJoinMap.cs @@ -1,43 +1,43 @@ -using System.Linq; -using Crestron.SimplSharp.Reflection; -using PepperDash.Essentials.Core; - -namespace PepperDash.Essentials.Bridges -{ - public class C2nRthsControllerJoinMap:JoinMapBase - { - public uint IsOnline { get; set; } - public uint Name { get; set; } - public uint Temperature { get; set; } - public uint Humidity { get; set; } - public uint TemperatureFormat { get; set; } - - public C2nRthsControllerJoinMap() - { - //digital - IsOnline = 1; - TemperatureFormat = 2; - - //Analog - Temperature = 2; - Humidity = 3; - - //serial - Name = 1; - - - } - - public override void OffsetJoinNumbers(uint joinStart) - { - var joinOffset = joinStart - 1; - var properties = - GetType().GetCType().GetProperties().Where(p => p.PropertyType == typeof(uint)).ToList(); - - foreach (var propertyInfo in properties) - { - propertyInfo.SetValue(this, (uint)propertyInfo.GetValue(this, null) + joinOffset, null); - } - } - } +using System.Linq; +using Crestron.SimplSharp.Reflection; +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Bridges +{ + public class C2nRthsControllerJoinMap:JoinMapBase + { + public uint IsOnline { get; set; } + public uint Name { get; set; } + public uint Temperature { get; set; } + public uint Humidity { get; set; } + public uint TemperatureFormat { get; set; } + + public C2nRthsControllerJoinMap() + { + //digital + IsOnline = 1; + TemperatureFormat = 2; + + //Analog + Temperature = 2; + Humidity = 3; + + //serial + Name = 1; + + + } + + public override void OffsetJoinNumbers(uint joinStart) + { + var joinOffset = joinStart - 1; + var properties = + GetType().GetCType().GetProperties().Where(p => p.PropertyType == typeof(uint)).ToList(); + + foreach (var propertyInfo in properties) + { + propertyInfo.SetValue(this, (uint)propertyInfo.GetValue(this, null) + joinOffset, null); + } + } + } } \ No newline at end of file diff --git a/PepperDashEssentials/Bridges/JoinMaps/CameraControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/CameraControllerJoinMap.cs similarity index 100% rename from PepperDashEssentials/Bridges/JoinMaps/CameraControllerJoinMap.cs rename to essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/CameraControllerJoinMap.cs diff --git a/PepperDashEssentials/Bridges/JoinMaps/DigitalLoggerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DigitalLoggerJoinMap.cs similarity index 100% rename from PepperDashEssentials/Bridges/JoinMaps/DigitalLoggerJoinMap.cs rename to essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DigitalLoggerJoinMap.cs diff --git a/PepperDashEssentials/Bridges/JoinMaps/DisplayControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DisplayControllerJoinMap.cs similarity index 100% rename from PepperDashEssentials/Bridges/JoinMaps/DisplayControllerJoinMap.cs rename to essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DisplayControllerJoinMap.cs diff --git a/PepperDashEssentials/Bridges/JoinMaps/DmBladeChassisControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmBladeChassisControllerJoinMap.cs similarity index 97% rename from PepperDashEssentials/Bridges/JoinMaps/DmBladeChassisControllerJoinMap.cs rename to essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmBladeChassisControllerJoinMap.cs index 29ee6471..8a245ad2 100644 --- a/PepperDashEssentials/Bridges/JoinMaps/DmBladeChassisControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmBladeChassisControllerJoinMap.cs @@ -1,109 +1,109 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using PepperDash.Essentials.Core; - -namespace PepperDash.Essentials.Bridges { - public class DmBladeChassisControllerJoinMap : JoinMapBase { - #region Digital/Analogs - #endregion - - #region Digitals - /// - /// High when device is online - /// - public uint IsOnline { get; set; } - /// - /// Range reports video sync feedback for each input - /// - public uint VideoSyncStatus { get; set; } - /// - /// Range reports high if corresponding input's endpoint is online - /// - public uint InputEndpointOnline { get; set; } - /// - /// Range reports high if corresponding output's endpoint is online - /// - public uint OutputEndpointOnline { get; set; } - /// - /// Range reports high if corresponding input's transmitter supports bridging as a separate device for detailed AV switching, HDCP control, etc. - /// - public uint TxAdvancedIsPresent { get; set; } // indicates that there is an attached transmitter that should be bridged to be interacted with - #endregion - - #region Analogs - /// - /// Range sets and reports the current video source for the corresponding output - /// - public uint OutputVideo { get; set; } - /// - /// Range sets and reports the current HDCP state for the corresponding input card - /// - public uint HdcpSupportState { get; set; } - /// - /// Range reports the highest supported HDCP state level for the corresponding input card - /// - public uint HdcpSupportCapability { get; set; } - #endregion - - #region Serials - /// - /// Range sets and reports the name for the corresponding input card - /// - public uint InputNames { get; set; } - /// - /// Range sets and reports the name for the corresponding output card - /// - public uint OutputNames { get; set; } - /// - /// Range reports the name of the current video source for the corresponding output card - /// - public uint OutputCurrentVideoInputNames { get; set; } - /// - /// Range reports the current input resolution for each corresponding input card - /// - public uint InputCurrentResolution { get; set; } - #endregion - - public DmBladeChassisControllerJoinMap() { - //Digital/Analog - - //Digital - IsOnline = 11; - VideoSyncStatus = 100; //101-299 - InputEndpointOnline = 500; //501-699 - OutputEndpointOnline = 700; //701-899 - TxAdvancedIsPresent = 1000; //1001-1199 - - //Analog - OutputVideo = 100; //101-299 - HdcpSupportState = 1000; //1001-1199 - HdcpSupportCapability = 1200; //1201-1399 - - - //Serial - InputNames = 100; //101-299 - OutputNames = 300; //301-499 - OutputCurrentVideoInputNames = 2000; //2001-2199 - InputCurrentResolution = 2400; // 2401-2599 - } - - public override void OffsetJoinNumbers(uint joinStart) { - var joinOffset = joinStart - 1; - - IsOnline = IsOnline + joinOffset; - OutputVideo = OutputVideo + joinOffset; - VideoSyncStatus = VideoSyncStatus + joinOffset; - InputNames = InputNames + joinOffset; - OutputNames = OutputNames + joinOffset; - OutputCurrentVideoInputNames = OutputCurrentVideoInputNames + joinOffset; - InputCurrentResolution = InputCurrentResolution + joinOffset; - InputEndpointOnline = InputEndpointOnline + joinOffset; - OutputEndpointOnline = OutputEndpointOnline + joinOffset; - HdcpSupportState = HdcpSupportState + joinOffset; - HdcpSupportCapability = HdcpSupportCapability + joinOffset; - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Bridges { + public class DmBladeChassisControllerJoinMap : JoinMapBase { + #region Digital/Analogs + #endregion + + #region Digitals + /// + /// High when device is online + /// + public uint IsOnline { get; set; } + /// + /// Range reports video sync feedback for each input + /// + public uint VideoSyncStatus { get; set; } + /// + /// Range reports high if corresponding input's endpoint is online + /// + public uint InputEndpointOnline { get; set; } + /// + /// Range reports high if corresponding output's endpoint is online + /// + public uint OutputEndpointOnline { get; set; } + /// + /// Range reports high if corresponding input's transmitter supports bridging as a separate device for detailed AV switching, HDCP control, etc. + /// + public uint TxAdvancedIsPresent { get; set; } // indicates that there is an attached transmitter that should be bridged to be interacted with + #endregion + + #region Analogs + /// + /// Range sets and reports the current video source for the corresponding output + /// + public uint OutputVideo { get; set; } + /// + /// Range sets and reports the current HDCP state for the corresponding input card + /// + public uint HdcpSupportState { get; set; } + /// + /// Range reports the highest supported HDCP state level for the corresponding input card + /// + public uint HdcpSupportCapability { get; set; } + #endregion + + #region Serials + /// + /// Range sets and reports the name for the corresponding input card + /// + public uint InputNames { get; set; } + /// + /// Range sets and reports the name for the corresponding output card + /// + public uint OutputNames { get; set; } + /// + /// Range reports the name of the current video source for the corresponding output card + /// + public uint OutputCurrentVideoInputNames { get; set; } + /// + /// Range reports the current input resolution for each corresponding input card + /// + public uint InputCurrentResolution { get; set; } + #endregion + + public DmBladeChassisControllerJoinMap() { + //Digital/Analog + + //Digital + IsOnline = 11; + VideoSyncStatus = 100; //101-299 + InputEndpointOnline = 500; //501-699 + OutputEndpointOnline = 700; //701-899 + TxAdvancedIsPresent = 1000; //1001-1199 + + //Analog + OutputVideo = 100; //101-299 + HdcpSupportState = 1000; //1001-1199 + HdcpSupportCapability = 1200; //1201-1399 + + + //Serial + InputNames = 100; //101-299 + OutputNames = 300; //301-499 + OutputCurrentVideoInputNames = 2000; //2001-2199 + InputCurrentResolution = 2400; // 2401-2599 + } + + public override void OffsetJoinNumbers(uint joinStart) { + var joinOffset = joinStart - 1; + + IsOnline = IsOnline + joinOffset; + OutputVideo = OutputVideo + joinOffset; + VideoSyncStatus = VideoSyncStatus + joinOffset; + InputNames = InputNames + joinOffset; + OutputNames = OutputNames + joinOffset; + OutputCurrentVideoInputNames = OutputCurrentVideoInputNames + joinOffset; + InputCurrentResolution = InputCurrentResolution + joinOffset; + InputEndpointOnline = InputEndpointOnline + joinOffset; + OutputEndpointOnline = OutputEndpointOnline + joinOffset; + HdcpSupportState = HdcpSupportState + joinOffset; + HdcpSupportCapability = HdcpSupportCapability + joinOffset; + } + } +} diff --git a/PepperDashEssentials/Bridges/JoinMaps/DmChassisControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmChassisControllerJoinMap.cs similarity index 100% rename from PepperDashEssentials/Bridges/JoinMaps/DmChassisControllerJoinMap.cs rename to essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmChassisControllerJoinMap.cs diff --git a/PepperDashEssentials/Bridges/JoinMaps/DmRmcControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmRmcControllerJoinMap.cs similarity index 100% rename from PepperDashEssentials/Bridges/JoinMaps/DmRmcControllerJoinMap.cs rename to essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmRmcControllerJoinMap.cs diff --git a/PepperDashEssentials/Bridges/JoinMaps/DmTxControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmTxControllerJoinMap.cs similarity index 100% rename from PepperDashEssentials/Bridges/JoinMaps/DmTxControllerJoinMap.cs rename to essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmTxControllerJoinMap.cs diff --git a/PepperDashEssentials/Bridges/JoinMaps/DmpsAudioOutputControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmpsAudioOutputControllerJoinMap.cs similarity index 100% rename from PepperDashEssentials/Bridges/JoinMaps/DmpsAudioOutputControllerJoinMap.cs rename to essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmpsAudioOutputControllerJoinMap.cs diff --git a/PepperDashEssentials/Bridges/JoinMaps/DmpsRoutingControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmpsRoutingControllerJoinMap.cs similarity index 100% rename from PepperDashEssentials/Bridges/JoinMaps/DmpsRoutingControllerJoinMap.cs rename to essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmpsRoutingControllerJoinMap.cs diff --git a/PepperDashEssentials/Bridges/JoinMaps/GenericLightingJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/GenericLightingJoinMap.cs similarity index 100% rename from PepperDashEssentials/Bridges/JoinMaps/GenericLightingJoinMap.cs rename to essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/GenericLightingJoinMap.cs diff --git a/PepperDashEssentials/Bridges/JoinMaps/GenericRelayControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/GenericRelayControllerJoinMap.cs similarity index 100% rename from PepperDashEssentials/Bridges/JoinMaps/GenericRelayControllerJoinMap.cs rename to essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/GenericRelayControllerJoinMap.cs diff --git a/PepperDashEssentials/Bridges/JoinMaps/GlsOccupancySensorBaseJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/GlsOccupancySensorBaseJoinMap.cs similarity index 97% rename from PepperDashEssentials/Bridges/JoinMaps/GlsOccupancySensorBaseJoinMap.cs rename to essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/GlsOccupancySensorBaseJoinMap.cs index 6e19dff2..a40913ee 100644 --- a/PepperDashEssentials/Bridges/JoinMaps/GlsOccupancySensorBaseJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/GlsOccupancySensorBaseJoinMap.cs @@ -1,238 +1,238 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using PepperDash.Essentials.Core; - -namespace PepperDash.Essentials.Bridges -{ - public class GlsOccupancySensorBaseJoinMap : JoinMapBase - { - #region Digitals - - /// - /// High when device is online - /// - public uint IsOnline { get; set; } - /// - /// Forces the device to report occupied status - /// - public uint ForceOccupied { get; set; } - /// - /// Forces the device to report vacant status - /// - public uint ForceVacant { get; set; } - /// - /// Enables raw status reporting - /// - public uint EnableRawStates { get; set; } - /// - /// High when raw occupancy is detected - /// - public uint RawOccupancyFeedback { get; set; } - /// - /// High when PIR sensor detects motion - /// - public uint RawOccupancyPirFeedback { get; set; } - /// - /// High when US sensor detects motion - /// - public uint RawOccupancyUsFeedback { get; set; } - /// - /// High when occupancy is detected - /// - public uint RoomOccupiedFeedback { get; set; } - /// - /// Hich when occupancy is detected in the grace period - /// - public uint GraceOccupancyDetectedFeedback { get; set; } - /// - /// High when vacancy is detected - /// - public uint RoomVacantFeedback { get; set; } - - /// - /// Enables the LED Flash when set high - /// - public uint EnableLedFlash { get; set; } - /// - /// Disables the LED flash when set high - /// - public uint DisableLedFlash { get; set; } - /// - /// Enables the Short Timeout - /// - public uint EnableShortTimeout { get; set; } - /// - /// Disables the Short Timout - /// - public uint DisableShortTimeout { get; set; } - /// - /// Set high to enable one technology to trigger occupancy - /// - public uint OrWhenVacated { get; set; } - /// - /// Set high to require both technologies to trigger occupancy - /// - public uint AndWhenVacated { get; set; } - /// - /// Enables Ultrasonic Sensor A - /// - public uint EnableUsA { get; set; } - /// - /// Disables Ultrasonic Sensor A - /// - public uint DisableUsA { get; set; } - /// - /// Enables Ultrasonic Sensor B - /// - public uint EnableUsB { get; set; } - /// - /// Disables Ultrasonic Sensor B - /// - public uint DisableUsB { get; set; } - /// - /// Enables Pir - /// - public uint EnablePir { get; set; } - /// - /// Disables Pir - /// - public uint DisablePir { get; set; } - public uint IncrementUsInOccupiedState { get; set; } - public uint DecrementUsInOccupiedState { get; set; } - public uint IncrementUsInVacantState { get; set; } - public uint DecrementUsInVacantState { get; set; } - public uint IncrementPirInOccupiedState { get; set; } - public uint DecrementPirInOccupiedState { get; set; } - public uint IncrementPirInVacantState { get; set; } - public uint DecrementPirInVacantState { get; set; } - #endregion - - #region Analogs - /// - /// Sets adn reports the remote timeout value - /// - public uint Timeout { get; set; } - /// - /// Reports the local timeout value - /// - public uint TimeoutLocalFeedback { get; set; } - /// - /// Sets the minimum internal photo sensor value and reports the current level - /// - public uint InternalPhotoSensorValue { get; set; } - /// - /// Sets the minimum external photo sensor value and reports the current level - /// - public uint ExternalPhotoSensorValue { get; set; } - - public uint UsSensitivityInOccupiedState { get; set; } - - public uint UsSensitivityInVacantState { get; set; } - - public uint PirSensitivityInOccupiedState { get; set; } - - public uint PirSensitivityInVacantState { get; set; } - #endregion - - #region Serial - public uint Name { get; set; } - #endregion - - public GlsOccupancySensorBaseJoinMap() - { - IsOnline = 1; - ForceOccupied = 2; - ForceVacant = 3; - EnableRawStates = 4; - RoomOccupiedFeedback = 2; - GraceOccupancyDetectedFeedback = 3; - RoomVacantFeedback = 4; - RawOccupancyFeedback = 5; - RawOccupancyPirFeedback = 6; - RawOccupancyUsFeedback = 7; - EnableLedFlash = 11; - DisableLedFlash = 12; - EnableShortTimeout = 13; - DisableShortTimeout = 14; - OrWhenVacated = 15; - AndWhenVacated = 16; - EnableUsA = 17; - DisableUsA = 18; - EnableUsB = 19; - DisableUsB = 20; - EnablePir = 21; - DisablePir = 22; - IncrementUsInOccupiedState = 23; - DecrementUsInOccupiedState = 24; - IncrementUsInVacantState = 25; - DecrementUsInVacantState = 26; - IncrementPirInOccupiedState = 27; - DecrementPirInOccupiedState = 28; - IncrementPirInVacantState = 29; - DecrementPirInVacantState = 30; - - Timeout = 1; - TimeoutLocalFeedback = 2; - InternalPhotoSensorValue = 3; - ExternalPhotoSensorValue = 4; - UsSensitivityInOccupiedState = 5; - UsSensitivityInVacantState = 6; - PirSensitivityInOccupiedState = 7; - PirSensitivityInVacantState = 8; - - Name = 1; - - } - - public override void OffsetJoinNumbers(uint joinStart) - { - var joinOffset = joinStart - 1; - - IsOnline = IsOnline + joinOffset; - ForceOccupied = ForceOccupied + joinOffset; - ForceVacant = ForceVacant + joinOffset; - EnableRawStates = EnableRawStates + joinOffset; - RoomOccupiedFeedback = RoomOccupiedFeedback + joinOffset; - GraceOccupancyDetectedFeedback = GraceOccupancyDetectedFeedback + joinOffset; - RoomVacantFeedback = RoomVacantFeedback + joinOffset; - RawOccupancyFeedback = RawOccupancyFeedback + joinOffset; - RawOccupancyPirFeedback = RawOccupancyPirFeedback + joinOffset; - RawOccupancyUsFeedback = RawOccupancyUsFeedback + joinOffset; - EnableLedFlash = EnableLedFlash + joinOffset; - DisableLedFlash = DisableLedFlash + joinOffset; - EnableShortTimeout = EnableShortTimeout + joinOffset; - DisableShortTimeout = DisableShortTimeout + joinOffset; - OrWhenVacated = OrWhenVacated + joinOffset; - AndWhenVacated = AndWhenVacated + joinOffset; - EnableUsA = EnableUsA + joinOffset; - DisableUsA = DisableUsA + joinOffset; - EnableUsB = EnableUsB + joinOffset; - DisableUsB = DisableUsB + joinOffset; - EnablePir = EnablePir + joinOffset; - DisablePir = DisablePir + joinOffset; - IncrementUsInOccupiedState = IncrementUsInOccupiedState + joinOffset; - DecrementUsInOccupiedState = DecrementUsInOccupiedState + joinOffset; - IncrementUsInVacantState = IncrementUsInVacantState + joinOffset; - DecrementUsInVacantState = DecrementUsInVacantState + joinOffset; - IncrementPirInOccupiedState = IncrementPirInOccupiedState + joinOffset; - DecrementPirInOccupiedState = DecrementPirInOccupiedState + joinOffset; - IncrementPirInVacantState = IncrementPirInVacantState + joinOffset; - DecrementPirInVacantState = DecrementPirInVacantState + joinOffset; - - Timeout = Timeout + joinOffset; - TimeoutLocalFeedback = TimeoutLocalFeedback + joinOffset; - InternalPhotoSensorValue = InternalPhotoSensorValue + joinOffset; - ExternalPhotoSensorValue = ExternalPhotoSensorValue + joinOffset; - UsSensitivityInOccupiedState = UsSensitivityInOccupiedState + joinOffset; - UsSensitivityInVacantState = UsSensitivityInVacantState + joinOffset; - PirSensitivityInOccupiedState = PirSensitivityInOccupiedState + joinOffset; - PirSensitivityInVacantState = PirSensitivityInVacantState + joinOffset; - - Name = Name + joinOffset; - } - } - -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Bridges +{ + public class GlsOccupancySensorBaseJoinMap : JoinMapBase + { + #region Digitals + + /// + /// High when device is online + /// + public uint IsOnline { get; set; } + /// + /// Forces the device to report occupied status + /// + public uint ForceOccupied { get; set; } + /// + /// Forces the device to report vacant status + /// + public uint ForceVacant { get; set; } + /// + /// Enables raw status reporting + /// + public uint EnableRawStates { get; set; } + /// + /// High when raw occupancy is detected + /// + public uint RawOccupancyFeedback { get; set; } + /// + /// High when PIR sensor detects motion + /// + public uint RawOccupancyPirFeedback { get; set; } + /// + /// High when US sensor detects motion + /// + public uint RawOccupancyUsFeedback { get; set; } + /// + /// High when occupancy is detected + /// + public uint RoomOccupiedFeedback { get; set; } + /// + /// Hich when occupancy is detected in the grace period + /// + public uint GraceOccupancyDetectedFeedback { get; set; } + /// + /// High when vacancy is detected + /// + public uint RoomVacantFeedback { get; set; } + + /// + /// Enables the LED Flash when set high + /// + public uint EnableLedFlash { get; set; } + /// + /// Disables the LED flash when set high + /// + public uint DisableLedFlash { get; set; } + /// + /// Enables the Short Timeout + /// + public uint EnableShortTimeout { get; set; } + /// + /// Disables the Short Timout + /// + public uint DisableShortTimeout { get; set; } + /// + /// Set high to enable one technology to trigger occupancy + /// + public uint OrWhenVacated { get; set; } + /// + /// Set high to require both technologies to trigger occupancy + /// + public uint AndWhenVacated { get; set; } + /// + /// Enables Ultrasonic Sensor A + /// + public uint EnableUsA { get; set; } + /// + /// Disables Ultrasonic Sensor A + /// + public uint DisableUsA { get; set; } + /// + /// Enables Ultrasonic Sensor B + /// + public uint EnableUsB { get; set; } + /// + /// Disables Ultrasonic Sensor B + /// + public uint DisableUsB { get; set; } + /// + /// Enables Pir + /// + public uint EnablePir { get; set; } + /// + /// Disables Pir + /// + public uint DisablePir { get; set; } + public uint IncrementUsInOccupiedState { get; set; } + public uint DecrementUsInOccupiedState { get; set; } + public uint IncrementUsInVacantState { get; set; } + public uint DecrementUsInVacantState { get; set; } + public uint IncrementPirInOccupiedState { get; set; } + public uint DecrementPirInOccupiedState { get; set; } + public uint IncrementPirInVacantState { get; set; } + public uint DecrementPirInVacantState { get; set; } + #endregion + + #region Analogs + /// + /// Sets adn reports the remote timeout value + /// + public uint Timeout { get; set; } + /// + /// Reports the local timeout value + /// + public uint TimeoutLocalFeedback { get; set; } + /// + /// Sets the minimum internal photo sensor value and reports the current level + /// + public uint InternalPhotoSensorValue { get; set; } + /// + /// Sets the minimum external photo sensor value and reports the current level + /// + public uint ExternalPhotoSensorValue { get; set; } + + public uint UsSensitivityInOccupiedState { get; set; } + + public uint UsSensitivityInVacantState { get; set; } + + public uint PirSensitivityInOccupiedState { get; set; } + + public uint PirSensitivityInVacantState { get; set; } + #endregion + + #region Serial + public uint Name { get; set; } + #endregion + + public GlsOccupancySensorBaseJoinMap() + { + IsOnline = 1; + ForceOccupied = 2; + ForceVacant = 3; + EnableRawStates = 4; + RoomOccupiedFeedback = 2; + GraceOccupancyDetectedFeedback = 3; + RoomVacantFeedback = 4; + RawOccupancyFeedback = 5; + RawOccupancyPirFeedback = 6; + RawOccupancyUsFeedback = 7; + EnableLedFlash = 11; + DisableLedFlash = 12; + EnableShortTimeout = 13; + DisableShortTimeout = 14; + OrWhenVacated = 15; + AndWhenVacated = 16; + EnableUsA = 17; + DisableUsA = 18; + EnableUsB = 19; + DisableUsB = 20; + EnablePir = 21; + DisablePir = 22; + IncrementUsInOccupiedState = 23; + DecrementUsInOccupiedState = 24; + IncrementUsInVacantState = 25; + DecrementUsInVacantState = 26; + IncrementPirInOccupiedState = 27; + DecrementPirInOccupiedState = 28; + IncrementPirInVacantState = 29; + DecrementPirInVacantState = 30; + + Timeout = 1; + TimeoutLocalFeedback = 2; + InternalPhotoSensorValue = 3; + ExternalPhotoSensorValue = 4; + UsSensitivityInOccupiedState = 5; + UsSensitivityInVacantState = 6; + PirSensitivityInOccupiedState = 7; + PirSensitivityInVacantState = 8; + + Name = 1; + + } + + public override void OffsetJoinNumbers(uint joinStart) + { + var joinOffset = joinStart - 1; + + IsOnline = IsOnline + joinOffset; + ForceOccupied = ForceOccupied + joinOffset; + ForceVacant = ForceVacant + joinOffset; + EnableRawStates = EnableRawStates + joinOffset; + RoomOccupiedFeedback = RoomOccupiedFeedback + joinOffset; + GraceOccupancyDetectedFeedback = GraceOccupancyDetectedFeedback + joinOffset; + RoomVacantFeedback = RoomVacantFeedback + joinOffset; + RawOccupancyFeedback = RawOccupancyFeedback + joinOffset; + RawOccupancyPirFeedback = RawOccupancyPirFeedback + joinOffset; + RawOccupancyUsFeedback = RawOccupancyUsFeedback + joinOffset; + EnableLedFlash = EnableLedFlash + joinOffset; + DisableLedFlash = DisableLedFlash + joinOffset; + EnableShortTimeout = EnableShortTimeout + joinOffset; + DisableShortTimeout = DisableShortTimeout + joinOffset; + OrWhenVacated = OrWhenVacated + joinOffset; + AndWhenVacated = AndWhenVacated + joinOffset; + EnableUsA = EnableUsA + joinOffset; + DisableUsA = DisableUsA + joinOffset; + EnableUsB = EnableUsB + joinOffset; + DisableUsB = DisableUsB + joinOffset; + EnablePir = EnablePir + joinOffset; + DisablePir = DisablePir + joinOffset; + IncrementUsInOccupiedState = IncrementUsInOccupiedState + joinOffset; + DecrementUsInOccupiedState = DecrementUsInOccupiedState + joinOffset; + IncrementUsInVacantState = IncrementUsInVacantState + joinOffset; + DecrementUsInVacantState = DecrementUsInVacantState + joinOffset; + IncrementPirInOccupiedState = IncrementPirInOccupiedState + joinOffset; + DecrementPirInOccupiedState = DecrementPirInOccupiedState + joinOffset; + IncrementPirInVacantState = IncrementPirInVacantState + joinOffset; + DecrementPirInVacantState = DecrementPirInVacantState + joinOffset; + + Timeout = Timeout + joinOffset; + TimeoutLocalFeedback = TimeoutLocalFeedback + joinOffset; + InternalPhotoSensorValue = InternalPhotoSensorValue + joinOffset; + ExternalPhotoSensorValue = ExternalPhotoSensorValue + joinOffset; + UsSensitivityInOccupiedState = UsSensitivityInOccupiedState + joinOffset; + UsSensitivityInVacantState = UsSensitivityInVacantState + joinOffset; + PirSensitivityInOccupiedState = PirSensitivityInOccupiedState + joinOffset; + PirSensitivityInVacantState = PirSensitivityInVacantState + joinOffset; + + Name = Name + joinOffset; + } + } + +} diff --git a/PepperDashEssentials/Bridges/JoinMaps/HdMdxxxCEControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/HdMdxxxCEControllerJoinMap.cs similarity index 100% rename from PepperDashEssentials/Bridges/JoinMaps/HdMdxxxCEControllerJoinMap.cs rename to essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/HdMdxxxCEControllerJoinMap.cs diff --git a/PepperDashEssentials/Bridges/JoinMaps/IBasicCommunicationJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/IBasicCommunicationJoinMap.cs similarity index 100% rename from PepperDashEssentials/Bridges/JoinMaps/IBasicCommunicationJoinMap.cs rename to essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/IBasicCommunicationJoinMap.cs diff --git a/PepperDashEssentials/Bridges/JoinMaps/IDigitalInputJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/IDigitalInputJoinMap.cs similarity index 100% rename from PepperDashEssentials/Bridges/JoinMaps/IDigitalInputJoinMap.cs rename to essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/IDigitalInputJoinMap.cs diff --git a/PepperDashEssentials/Bridges/JoinMaps/SetTopBoxControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/SetTopBoxControllerJoinMap.cs similarity index 96% rename from PepperDashEssentials/Bridges/JoinMaps/SetTopBoxControllerJoinMap.cs rename to essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/SetTopBoxControllerJoinMap.cs index aa23cb7a..36e5b2da 100644 --- a/PepperDashEssentials/Bridges/JoinMaps/SetTopBoxControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/SetTopBoxControllerJoinMap.cs @@ -1,212 +1,212 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using PepperDash.Essentials.Core; -using Crestron.SimplSharp.Reflection; - - -namespace PepperDash.Essentials.Bridges -{ - public class SetTopBoxControllerJoinMap : JoinMapBase - { - #region Digitals - public uint DvrList { get; set; } // - public uint Replay { get; set; } - public uint Up { get; set; } // - public uint Down { get; set; } // - public uint Left { get; set; } // - public uint Right { get; set; } // - public uint Select { get; set; } // - public uint Menu { get; set; } // - public uint Exit { get; set; } // - public uint Digit0 { get; set; } // - public uint Digit1 { get; set; } // - public uint Digit2 { get; set; } // - public uint Digit3 { get; set; } // - public uint Digit4 { get; set; } // - public uint Digit5 { get; set; } // - public uint Digit6 { get; set; } // - public uint Digit7 { get; set; } // - public uint Digit8 { get; set; } // - public uint Digit9 { get; set; } // - public uint Dash { get; set; } // - public uint KeypadEnter { get; set; } // - public uint ChannelUp { get; set; } // - public uint ChannelDown { get; set; } // - public uint LastChannel { get; set; } // - public uint Guide { get; set; } // - public uint Info { get; set; } // - public uint Red { get; set; } // - public uint Green { get; set; } // - public uint Yellow { get; set; } // - public uint Blue { get; set; } // - public uint ChapMinus { get; set; } - public uint ChapPlus { get; set; } - public uint FFwd { get; set; } // - public uint Pause { get; set; } // - public uint Play { get; set; } // - public uint Record { get; set; } - public uint Rewind { get; set; } // - public uint Stop { get; set; } // - - public uint PowerOn { get; set; } // - public uint PowerOff { get; set; } // - public uint PowerToggle { get; set; } // - - public uint HasKeypadAccessoryButton1 { get; set; } - public uint HasKeypadAccessoryButton2 { get; set; } - - public uint KeypadAccessoryButton1Press { get; set; } - public uint KeypadAccessoryButton2Press { get; set; } - - - public uint HasDvr { get; set; } - public uint HasPresets { get; set; } - public uint HasNumeric { get; set; } - public uint HasDpad { get; set; } - - - #endregion - - #region Analogs - - #endregion - - #region Strings - public uint Name { get; set; } - public uint LoadPresets { get; set; } - public uint KeypadAccessoryButton1Label { get; set; } - public uint KeypadAccessoryButton2Label { get; set; } - - #endregion - - public SetTopBoxControllerJoinMap() - { - PowerOn = 1; - PowerOff = 2; - PowerToggle = 3; - - HasDpad = 4; - Up = 4; - Down = 5; - Left = 6; - Right = 7; - Select = 8; - Menu = 9; - Exit = 10; - - HasNumeric = 11; - Digit0 = 11; - Digit1 = 12; - Digit2 = 13; - Digit3 = 14; - Digit4 = 15; - Digit5 = 16; - Digit6 = 17; - Digit7 = 18; - Digit8 = 19; - Digit9 = 20; - Dash = 21; - KeypadEnter = 22; - ChannelUp = 23; - ChannelDown = 24; - LastChannel = 25; - - Guide = 26; - Info = 27; - Red = 28; - Green = 29; - Yellow = 30; - Blue = 31; - - HasDvr = 32; - DvrList = 32; - Play = 33; - Pause = 34; - Stop = 35; - FFwd = 36; - Rewind = 37; - ChapPlus = 38; - ChapMinus = 39; - Replay = 40; - Record = 41; - HasKeypadAccessoryButton1 = 42; - KeypadAccessoryButton1Press = 42; - HasKeypadAccessoryButton2 = 43; - KeypadAccessoryButton2Press = 43; - - Name = 1; - KeypadAccessoryButton1Label = 42; - KeypadAccessoryButton2Label = 43; - - LoadPresets = 50; - } - - public override void OffsetJoinNumbers(uint joinStart) - { - var joinOffset = joinStart - 1; - - PowerOn += joinOffset; - PowerOff += joinOffset; - PowerToggle += joinOffset; - - HasDpad += joinOffset; - Up += joinOffset; - Down += joinOffset; - Left += joinOffset; - Right += joinOffset; - Select += joinOffset; - Menu += joinOffset; - Exit += joinOffset; - - HasNumeric += joinOffset; - Digit0 += joinOffset; - Digit1 += joinOffset; - Digit2 += joinOffset; - Digit3 += joinOffset; - Digit4 += joinOffset; - Digit5 += joinOffset; - Digit6 += joinOffset; - Digit7 += joinOffset; - Digit8 += joinOffset; - Digit9 += joinOffset; - Dash += joinOffset; - KeypadEnter += joinOffset; - ChannelUp += joinOffset; - ChannelDown += joinOffset; - LastChannel += joinOffset; - - Guide += joinOffset; - Info += joinOffset; - Red += joinOffset; - Green += joinOffset; - Yellow += joinOffset; - Blue += joinOffset; - - HasDvr += joinOffset; - DvrList += joinOffset; - Play += joinOffset; - Pause += joinOffset; - Stop += joinOffset; - FFwd += joinOffset; - Rewind += joinOffset; - ChapPlus += joinOffset; - ChapMinus += joinOffset; - Replay += joinOffset; - Record += joinOffset; - HasKeypadAccessoryButton1 += joinOffset; - KeypadAccessoryButton1Press += joinOffset; - HasKeypadAccessoryButton2 += joinOffset; - KeypadAccessoryButton2Press += joinOffset; - - Name += joinOffset; - KeypadAccessoryButton1Label += joinOffset; - KeypadAccessoryButton2Label += joinOffset; - - LoadPresets += joinOffset; - } - - } +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using PepperDash.Essentials.Core; +using Crestron.SimplSharp.Reflection; + + +namespace PepperDash.Essentials.Bridges +{ + public class SetTopBoxControllerJoinMap : JoinMapBase + { + #region Digitals + public uint DvrList { get; set; } // + public uint Replay { get; set; } + public uint Up { get; set; } // + public uint Down { get; set; } // + public uint Left { get; set; } // + public uint Right { get; set; } // + public uint Select { get; set; } // + public uint Menu { get; set; } // + public uint Exit { get; set; } // + public uint Digit0 { get; set; } // + public uint Digit1 { get; set; } // + public uint Digit2 { get; set; } // + public uint Digit3 { get; set; } // + public uint Digit4 { get; set; } // + public uint Digit5 { get; set; } // + public uint Digit6 { get; set; } // + public uint Digit7 { get; set; } // + public uint Digit8 { get; set; } // + public uint Digit9 { get; set; } // + public uint Dash { get; set; } // + public uint KeypadEnter { get; set; } // + public uint ChannelUp { get; set; } // + public uint ChannelDown { get; set; } // + public uint LastChannel { get; set; } // + public uint Guide { get; set; } // + public uint Info { get; set; } // + public uint Red { get; set; } // + public uint Green { get; set; } // + public uint Yellow { get; set; } // + public uint Blue { get; set; } // + public uint ChapMinus { get; set; } + public uint ChapPlus { get; set; } + public uint FFwd { get; set; } // + public uint Pause { get; set; } // + public uint Play { get; set; } // + public uint Record { get; set; } + public uint Rewind { get; set; } // + public uint Stop { get; set; } // + + public uint PowerOn { get; set; } // + public uint PowerOff { get; set; } // + public uint PowerToggle { get; set; } // + + public uint HasKeypadAccessoryButton1 { get; set; } + public uint HasKeypadAccessoryButton2 { get; set; } + + public uint KeypadAccessoryButton1Press { get; set; } + public uint KeypadAccessoryButton2Press { get; set; } + + + public uint HasDvr { get; set; } + public uint HasPresets { get; set; } + public uint HasNumeric { get; set; } + public uint HasDpad { get; set; } + + + #endregion + + #region Analogs + + #endregion + + #region Strings + public uint Name { get; set; } + public uint LoadPresets { get; set; } + public uint KeypadAccessoryButton1Label { get; set; } + public uint KeypadAccessoryButton2Label { get; set; } + + #endregion + + public SetTopBoxControllerJoinMap() + { + PowerOn = 1; + PowerOff = 2; + PowerToggle = 3; + + HasDpad = 4; + Up = 4; + Down = 5; + Left = 6; + Right = 7; + Select = 8; + Menu = 9; + Exit = 10; + + HasNumeric = 11; + Digit0 = 11; + Digit1 = 12; + Digit2 = 13; + Digit3 = 14; + Digit4 = 15; + Digit5 = 16; + Digit6 = 17; + Digit7 = 18; + Digit8 = 19; + Digit9 = 20; + Dash = 21; + KeypadEnter = 22; + ChannelUp = 23; + ChannelDown = 24; + LastChannel = 25; + + Guide = 26; + Info = 27; + Red = 28; + Green = 29; + Yellow = 30; + Blue = 31; + + HasDvr = 32; + DvrList = 32; + Play = 33; + Pause = 34; + Stop = 35; + FFwd = 36; + Rewind = 37; + ChapPlus = 38; + ChapMinus = 39; + Replay = 40; + Record = 41; + HasKeypadAccessoryButton1 = 42; + KeypadAccessoryButton1Press = 42; + HasKeypadAccessoryButton2 = 43; + KeypadAccessoryButton2Press = 43; + + Name = 1; + KeypadAccessoryButton1Label = 42; + KeypadAccessoryButton2Label = 43; + + LoadPresets = 50; + } + + public override void OffsetJoinNumbers(uint joinStart) + { + var joinOffset = joinStart - 1; + + PowerOn += joinOffset; + PowerOff += joinOffset; + PowerToggle += joinOffset; + + HasDpad += joinOffset; + Up += joinOffset; + Down += joinOffset; + Left += joinOffset; + Right += joinOffset; + Select += joinOffset; + Menu += joinOffset; + Exit += joinOffset; + + HasNumeric += joinOffset; + Digit0 += joinOffset; + Digit1 += joinOffset; + Digit2 += joinOffset; + Digit3 += joinOffset; + Digit4 += joinOffset; + Digit5 += joinOffset; + Digit6 += joinOffset; + Digit7 += joinOffset; + Digit8 += joinOffset; + Digit9 += joinOffset; + Dash += joinOffset; + KeypadEnter += joinOffset; + ChannelUp += joinOffset; + ChannelDown += joinOffset; + LastChannel += joinOffset; + + Guide += joinOffset; + Info += joinOffset; + Red += joinOffset; + Green += joinOffset; + Yellow += joinOffset; + Blue += joinOffset; + + HasDvr += joinOffset; + DvrList += joinOffset; + Play += joinOffset; + Pause += joinOffset; + Stop += joinOffset; + FFwd += joinOffset; + Rewind += joinOffset; + ChapPlus += joinOffset; + ChapMinus += joinOffset; + Replay += joinOffset; + Record += joinOffset; + HasKeypadAccessoryButton1 += joinOffset; + KeypadAccessoryButton1Press += joinOffset; + HasKeypadAccessoryButton2 += joinOffset; + KeypadAccessoryButton2Press += joinOffset; + + Name += joinOffset; + KeypadAccessoryButton1Label += joinOffset; + KeypadAccessoryButton2Label += joinOffset; + + LoadPresets += joinOffset; + } + + } } \ No newline at end of file diff --git a/PepperDashEssentials/Bridges/JoinMaps/StatusSignControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/StatusSignControllerJoinMap.cs similarity index 96% rename from PepperDashEssentials/Bridges/JoinMaps/StatusSignControllerJoinMap.cs rename to essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/StatusSignControllerJoinMap.cs index d3a95383..ad8f1577 100644 --- a/PepperDashEssentials/Bridges/JoinMaps/StatusSignControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/StatusSignControllerJoinMap.cs @@ -1,49 +1,49 @@ -using System.Linq; -using Crestron.SimplSharp.Reflection; -using PepperDash.Essentials.Core; - -namespace PepperDash.Essentials.Bridges -{ - public class StatusSignControllerJoinMap:JoinMapBase - { - public uint IsOnline { get; set; } - public uint Name { get; set; } - public uint RedLed { get; set; } - public uint GreenLed { get; set; } - public uint BlueLed { get; set; } - public uint RedControl { get; set; } - public uint GreenControl { get; set; } - public uint BlueControl { get; set; } - - public StatusSignControllerJoinMap() - { - //digital - IsOnline = 1; - RedControl = 2; - GreenControl = 3; - BlueControl = 4; - - //Analog - RedLed = 2; - GreenLed = 3; - BlueLed = 4; - - //string - Name = 1; - - - } - - public override void OffsetJoinNumbers(uint joinStart) - { - var joinOffset = joinStart - 1; - var properties = - GetType().GetCType().GetProperties().Where(p => p.PropertyType == typeof (uint)).ToList(); - - foreach (var propertyInfo in properties) - { - propertyInfo.SetValue(this, (uint) propertyInfo.GetValue(this, null) + joinOffset, null); - } - } - } +using System.Linq; +using Crestron.SimplSharp.Reflection; +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Bridges +{ + public class StatusSignControllerJoinMap:JoinMapBase + { + public uint IsOnline { get; set; } + public uint Name { get; set; } + public uint RedLed { get; set; } + public uint GreenLed { get; set; } + public uint BlueLed { get; set; } + public uint RedControl { get; set; } + public uint GreenControl { get; set; } + public uint BlueControl { get; set; } + + public StatusSignControllerJoinMap() + { + //digital + IsOnline = 1; + RedControl = 2; + GreenControl = 3; + BlueControl = 4; + + //Analog + RedLed = 2; + GreenLed = 3; + BlueLed = 4; + + //string + Name = 1; + + + } + + public override void OffsetJoinNumbers(uint joinStart) + { + var joinOffset = joinStart - 1; + var properties = + GetType().GetCType().GetProperties().Where(p => p.PropertyType == typeof (uint)).ToList(); + + foreach (var propertyInfo in properties) + { + propertyInfo.SetValue(this, (uint) propertyInfo.GetValue(this, null) + joinOffset, null); + } + } + } } \ No newline at end of file diff --git a/PepperDashEssentials/Bridges/JoinMaps/SystemMonitorJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/SystemMonitorJoinMap.cs similarity index 100% rename from PepperDashEssentials/Bridges/JoinMaps/SystemMonitorJoinMap.cs rename to essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/SystemMonitorJoinMap.cs From 926e3b7bc8f4d24580f7d605d87c205b94c76385 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 13 Apr 2020 16:12:03 -0600 Subject: [PATCH 011/156] makex CrestronGenericBaseDevice abstract --- .../Crestron/CrestronGenericBaseDevice.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron/CrestronGenericBaseDevice.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron/CrestronGenericBaseDevice.cs index 6d6a5fb4..61c4b289 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron/CrestronGenericBaseDevice.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron/CrestronGenericBaseDevice.cs @@ -7,13 +7,15 @@ using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.DeviceSupport; using PepperDash.Core; +using PepperDash.Essentials.Core.Bridges; +using PepperDash_Essentials_Core.Devices; namespace PepperDash.Essentials.Core { /// /// A bridge class to cover the basic features of GenericBase hardware /// - public class CrestronGenericBaseDevice : Device, IOnline, IHasFeedback, ICommunicationMonitor, IUsageTracking + public abstract class CrestronGenericBaseDevice : EssentialsBridgeableDevice, IOnline, IHasFeedback, ICommunicationMonitor, IUsageTracking { public virtual GenericBase Hardware { get; protected set; } @@ -99,8 +101,8 @@ namespace PepperDash.Essentials.Core return success; } - - /// + + /// /// Adds feedback(s) to the list /// /// From 41d123edf34d89ef959e49e2fc5c127a11516803 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 13 Apr 2020 16:31:34 -0600 Subject: [PATCH 012/156] changes PepperDash.Essentials.Bridges to PepperDash.Essentials.Core.Bridges --- .../Messengers/SIMPLCameraMessenger.cs | 2 +- .../SimplMessengerPropertiesConfig.cs | 2 +- .../Bridges/AirMediaControllerBridge.cs | 2 +- PepperDashEssentials/Bridges/AppleTvBridge.cs | 2 +- PepperDashEssentials/Bridges/BridgeFactory.cs | 2 +- .../Bridges/C2nRthsControllerBridge.cs | 2 +- .../Bridges/CameraControllerBridge.cs | 2 +- .../Bridges/DigitalLoggerBridge.cs | 2 +- .../Bridges/DisplayControllerBridge.cs | 2 +- .../Bridges/DmBladeChassisControllerBridge.cs | 2 +- .../Bridges/DmChassisControllerBridge.cs | 2 +- .../Bridges/DmRmcControllerBridge.cs | 2 +- .../Bridges/DmTxControllerBridge.cs | 2 +- .../DmpsAudioOutputControllerBridge.cs | 2 +- .../Bridges/DmpsRoutingControllerBridge.cs | 2 +- .../Bridges/GenericLightingBridge.cs | 2 +- .../Bridges/GenericRelayDeviceBridge.cs | 2 +- .../GlsOccupancySensorBaseControllerBridge.cs | 2 +- .../Bridges/HdMdxxxCEControllerBridge.cs | 2 +- .../Bridges/IBasicCommunicationBridge.cs | 2 +- .../Bridges/IDigitalInputBridge.cs | 2 +- .../Bridges/IRSetTopBoxBaseBridge.cs | 2 +- .../Bridges/StatusSignControllerBridge.cs | 2 +- .../Bridges/SystemMonitorBridge.cs | 2 +- PepperDashEssentials/ControlSystem.cs | 2 +- .../Bridges/BridgeBase.cs | 31 +- .../JoinMaps/AirMediaControllerJoinMap.cs | 2 +- .../Bridges/JoinMaps/AppleTvJoinMap.cs | 2 +- .../JoinMaps/C2nRthsControllerJoinMap.cs | 2 +- .../JoinMaps/CameraControllerJoinMap.cs | 2 +- .../Bridges/JoinMaps/DigitalLoggerJoinMap.cs | 2 +- .../JoinMaps/DisplayControllerJoinMap.cs | 2 +- .../DmBladeChassisControllerJoinMap.cs | 2 +- .../JoinMaps/DmChassisControllerJoinMap.cs | 2 +- .../JoinMaps/DmRmcControllerJoinMap.cs | 2 +- .../Bridges/JoinMaps/DmTxControllerJoinMap.cs | 9 +- .../DmpsAudioOutputControllerJoinMap.cs | 2 +- .../JoinMaps/DmpsRoutingControllerJoinMap.cs | 2 +- .../JoinMaps/GenericLightingJoinMap.cs | 2 +- .../JoinMaps/GenericRelayControllerJoinMap.cs | 2 +- .../JoinMaps/GlsOccupancySensorBaseJoinMap.cs | 2 +- .../JoinMaps/HdMdxxxCEControllerJoinMap.cs | 2 +- .../JoinMaps/IBasicCommunicationJoinMap.cs | 2 +- .../Bridges/JoinMaps/IDigitalInputJoinMap.cs | 2 +- .../JoinMaps/SetTopBoxControllerJoinMap.cs | 2 +- .../JoinMaps/StatusSignControllerJoinMap.cs | 2 +- .../Bridges/JoinMaps/SystemMonitorJoinMap.cs | 2 +- .../Crestron/CrestronGenericBaseDevice.cs | 32 +- .../PepperDash_Essentials_Core.csproj | 24 + .../AirMedia/AirMediaController.cs | 475 ++++++++++-------- 50 files changed, 354 insertions(+), 307 deletions(-) diff --git a/PepperDashEssentials/AppServer/Messengers/SIMPLCameraMessenger.cs b/PepperDashEssentials/AppServer/Messengers/SIMPLCameraMessenger.cs index 9cf6456f..1d2914dc 100644 --- a/PepperDashEssentials/AppServer/Messengers/SIMPLCameraMessenger.cs +++ b/PepperDashEssentials/AppServer/Messengers/SIMPLCameraMessenger.cs @@ -8,7 +8,7 @@ using Crestron.SimplSharpPro.EthernetCommunication; using PepperDash.Core; using PepperDash.Essentials.Core; -using PepperDash.Essentials.Bridges; +using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Devices.Common.Cameras; namespace PepperDash.Essentials.AppServer.Messengers diff --git a/PepperDashEssentials/AppServer/Messengers/SimplMessengerPropertiesConfig.cs b/PepperDashEssentials/AppServer/Messengers/SimplMessengerPropertiesConfig.cs index 9ee7407e..9ced28dd 100644 --- a/PepperDashEssentials/AppServer/Messengers/SimplMessengerPropertiesConfig.cs +++ b/PepperDashEssentials/AppServer/Messengers/SimplMessengerPropertiesConfig.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using Crestron.SimplSharp; -using PepperDash.Essentials.Bridges; +using PepperDash.Essentials.Core.Bridges; namespace PepperDash.Essentials.AppServer.Messengers { diff --git a/PepperDashEssentials/Bridges/AirMediaControllerBridge.cs b/PepperDashEssentials/Bridges/AirMediaControllerBridge.cs index 6d819c7b..869c5614 100644 --- a/PepperDashEssentials/Bridges/AirMediaControllerBridge.cs +++ b/PepperDashEssentials/Bridges/AirMediaControllerBridge.cs @@ -11,7 +11,7 @@ using PepperDash.Essentials.DM.AirMedia; using Newtonsoft.Json; -namespace PepperDash.Essentials.Bridges +namespace PepperDash.Essentials.Core.Bridges { public static class AirMediaControllerApiExtensions { diff --git a/PepperDashEssentials/Bridges/AppleTvBridge.cs b/PepperDashEssentials/Bridges/AppleTvBridge.cs index 99501baa..3c2bb0af 100644 --- a/PepperDashEssentials/Bridges/AppleTvBridge.cs +++ b/PepperDashEssentials/Bridges/AppleTvBridge.cs @@ -11,7 +11,7 @@ using PepperDash.Essentials.Devices.Common; using Newtonsoft.Json; -namespace PepperDash.Essentials.Bridges +namespace PepperDash.Essentials.Core.Bridges { public static class AppleTvApiExtensions { diff --git a/PepperDashEssentials/Bridges/BridgeFactory.cs b/PepperDashEssentials/Bridges/BridgeFactory.cs index 38cd117e..d9b34755 100644 --- a/PepperDashEssentials/Bridges/BridgeFactory.cs +++ b/PepperDashEssentials/Bridges/BridgeFactory.cs @@ -9,7 +9,7 @@ using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Config; using PepperDash.Core; using PepperDash.Essentials.Core.Routing; -using PepperDash.Essentials.Bridges; +using PepperDash.Essentials.Core.Bridges; using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.EthernetCommunication; diff --git a/PepperDashEssentials/Bridges/C2nRthsControllerBridge.cs b/PepperDashEssentials/Bridges/C2nRthsControllerBridge.cs index 13b78bae..931ee231 100644 --- a/PepperDashEssentials/Bridges/C2nRthsControllerBridge.cs +++ b/PepperDashEssentials/Bridges/C2nRthsControllerBridge.cs @@ -4,7 +4,7 @@ using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.CrestronIO; -namespace PepperDash.Essentials.Bridges +namespace PepperDash.Essentials.Core.Bridges { public static class C2nRthsControllerApiExtensions { diff --git a/PepperDashEssentials/Bridges/CameraControllerBridge.cs b/PepperDashEssentials/Bridges/CameraControllerBridge.cs index 732fee2e..6a3771d3 100644 --- a/PepperDashEssentials/Bridges/CameraControllerBridge.cs +++ b/PepperDashEssentials/Bridges/CameraControllerBridge.cs @@ -11,7 +11,7 @@ using PepperDash.Essentials.Devices.Common.Cameras; using Newtonsoft.Json; -namespace PepperDash.Essentials.Bridges +namespace PepperDash.Essentials.Core.Bridges { public static class CameraControllerApiExtensions { diff --git a/PepperDashEssentials/Bridges/DigitalLoggerBridge.cs b/PepperDashEssentials/Bridges/DigitalLoggerBridge.cs index 7d3fab3d..0786b79d 100644 --- a/PepperDashEssentials/Bridges/DigitalLoggerBridge.cs +++ b/PepperDashEssentials/Bridges/DigitalLoggerBridge.cs @@ -10,7 +10,7 @@ using PepperDash.Essentials.Devices.Common; using Newtonsoft.Json; -namespace PepperDash.Essentials.Bridges +namespace PepperDash.Essentials.Core.Bridges { public static class DigitalLoggerApiExtensions { diff --git a/PepperDashEssentials/Bridges/DisplayControllerBridge.cs b/PepperDashEssentials/Bridges/DisplayControllerBridge.cs index c94b3691..b6e3d49b 100644 --- a/PepperDashEssentials/Bridges/DisplayControllerBridge.cs +++ b/PepperDashEssentials/Bridges/DisplayControllerBridge.cs @@ -11,7 +11,7 @@ using PepperDash.Essentials.Devices.Common; using Newtonsoft.Json; -namespace PepperDash.Essentials.Bridges +namespace PepperDash.Essentials.Core.Bridges { public static class DisplayControllerApiExtensions { diff --git a/PepperDashEssentials/Bridges/DmBladeChassisControllerBridge.cs b/PepperDashEssentials/Bridges/DmBladeChassisControllerBridge.cs index 221745e8..6c64356c 100644 --- a/PepperDashEssentials/Bridges/DmBladeChassisControllerBridge.cs +++ b/PepperDashEssentials/Bridges/DmBladeChassisControllerBridge.cs @@ -14,7 +14,7 @@ using PepperDash.Essentials.DM; using Newtonsoft.Json; -namespace PepperDash.Essentials.Bridges { +namespace PepperDash.Essentials.Core.Bridges { public static class DmBladeChassisControllerApiExtentions { public static void LinkToApi(this DmBladeChassisController dmChassis, BasicTriList trilist, uint joinStart, string joinMapKey) { DmBladeChassisControllerJoinMap joinMap = new DmBladeChassisControllerJoinMap(); diff --git a/PepperDashEssentials/Bridges/DmChassisControllerBridge.cs b/PepperDashEssentials/Bridges/DmChassisControllerBridge.cs index 9c8c8551..6522a5f0 100644 --- a/PepperDashEssentials/Bridges/DmChassisControllerBridge.cs +++ b/PepperDashEssentials/Bridges/DmChassisControllerBridge.cs @@ -15,7 +15,7 @@ using PepperDash.Essentials.DM; using Newtonsoft.Json; -namespace PepperDash.Essentials.Bridges +namespace PepperDash.Essentials.Core.Bridges { public static class DmChassisControllerApiExtentions { diff --git a/PepperDashEssentials/Bridges/DmRmcControllerBridge.cs b/PepperDashEssentials/Bridges/DmRmcControllerBridge.cs index 1e99b734..5609cf03 100644 --- a/PepperDashEssentials/Bridges/DmRmcControllerBridge.cs +++ b/PepperDashEssentials/Bridges/DmRmcControllerBridge.cs @@ -11,7 +11,7 @@ using PepperDash.Essentials.DM; using Newtonsoft.Json; -namespace PepperDash.Essentials.Bridges +namespace PepperDash.Essentials.Core.Bridges { public static class DmRmcControllerApiExtensions { diff --git a/PepperDashEssentials/Bridges/DmTxControllerBridge.cs b/PepperDashEssentials/Bridges/DmTxControllerBridge.cs index 9b28611e..c565f41e 100644 --- a/PepperDashEssentials/Bridges/DmTxControllerBridge.cs +++ b/PepperDashEssentials/Bridges/DmTxControllerBridge.cs @@ -14,7 +14,7 @@ using PepperDash.Essentials.DM; using Newtonsoft.Json; -namespace PepperDash.Essentials.Bridges +namespace PepperDash.Essentials.Core.Bridges { public static class DmTxControllerApiExtensions { diff --git a/PepperDashEssentials/Bridges/DmpsAudioOutputControllerBridge.cs b/PepperDashEssentials/Bridges/DmpsAudioOutputControllerBridge.cs index f721b44f..eec058da 100644 --- a/PepperDashEssentials/Bridges/DmpsAudioOutputControllerBridge.cs +++ b/PepperDashEssentials/Bridges/DmpsAudioOutputControllerBridge.cs @@ -12,7 +12,7 @@ using PepperDash.Essentials.DM; using Newtonsoft.Json; -namespace PepperDash.Essentials.Bridges +namespace PepperDash.Essentials.Core.Bridges { public static class DmpsAudioOutputControllerApiExtensions { diff --git a/PepperDashEssentials/Bridges/DmpsRoutingControllerBridge.cs b/PepperDashEssentials/Bridges/DmpsRoutingControllerBridge.cs index eb359dd9..ea775039 100644 --- a/PepperDashEssentials/Bridges/DmpsRoutingControllerBridge.cs +++ b/PepperDashEssentials/Bridges/DmpsRoutingControllerBridge.cs @@ -12,7 +12,7 @@ using PepperDash.Essentials.DM; using Newtonsoft.Json; -namespace PepperDash.Essentials.Bridges +namespace PepperDash.Essentials.Core.Bridges { public static class DmpsRoutingControllerApiExtentions { diff --git a/PepperDashEssentials/Bridges/GenericLightingBridge.cs b/PepperDashEssentials/Bridges/GenericLightingBridge.cs index d76bbebb..5365b813 100644 --- a/PepperDashEssentials/Bridges/GenericLightingBridge.cs +++ b/PepperDashEssentials/Bridges/GenericLightingBridge.cs @@ -10,7 +10,7 @@ using PepperDash.Essentials.Devices.Common; using Newtonsoft.Json; -namespace PepperDash.Essentials.Bridges +namespace PepperDash.Essentials.Core.Bridges { public static class GenericLightingApiExtensions { diff --git a/PepperDashEssentials/Bridges/GenericRelayDeviceBridge.cs b/PepperDashEssentials/Bridges/GenericRelayDeviceBridge.cs index 684a5550..8175f115 100644 --- a/PepperDashEssentials/Bridges/GenericRelayDeviceBridge.cs +++ b/PepperDashEssentials/Bridges/GenericRelayDeviceBridge.cs @@ -11,7 +11,7 @@ using PepperDash.Essentials.Core.CrestronIO; using Newtonsoft.Json; -namespace PepperDash.Essentials.Bridges +namespace PepperDash.Essentials.Core.Bridges { public static class GenericRelayDeviceApiExtensions { diff --git a/PepperDashEssentials/Bridges/GlsOccupancySensorBaseControllerBridge.cs b/PepperDashEssentials/Bridges/GlsOccupancySensorBaseControllerBridge.cs index a49061b7..b073750c 100644 --- a/PepperDashEssentials/Bridges/GlsOccupancySensorBaseControllerBridge.cs +++ b/PepperDashEssentials/Bridges/GlsOccupancySensorBaseControllerBridge.cs @@ -12,7 +12,7 @@ using PepperDash.Core; using Newtonsoft.Json; -namespace PepperDash.Essentials.Bridges +namespace PepperDash.Essentials.Core.Bridges { public static class GlsOccupancySensorBaseControllerApiExtensions { diff --git a/PepperDashEssentials/Bridges/HdMdxxxCEControllerBridge.cs b/PepperDashEssentials/Bridges/HdMdxxxCEControllerBridge.cs index 52bacfec..bf6fdb54 100644 --- a/PepperDashEssentials/Bridges/HdMdxxxCEControllerBridge.cs +++ b/PepperDashEssentials/Bridges/HdMdxxxCEControllerBridge.cs @@ -14,7 +14,7 @@ using PepperDash.Essentials.DM; using Newtonsoft.Json; -namespace PepperDash.Essentials.Bridges +namespace PepperDash.Essentials.Core.Bridges { public static class HdMdxxxCEControllerApiExtensions { diff --git a/PepperDashEssentials/Bridges/IBasicCommunicationBridge.cs b/PepperDashEssentials/Bridges/IBasicCommunicationBridge.cs index 6ae9334c..b23860d3 100644 --- a/PepperDashEssentials/Bridges/IBasicCommunicationBridge.cs +++ b/PepperDashEssentials/Bridges/IBasicCommunicationBridge.cs @@ -10,7 +10,7 @@ using PepperDash.Essentials.Core; using Newtonsoft.Json; -namespace PepperDash.Essentials.Bridges +namespace PepperDash.Essentials.Core.Bridges { public static class IBasicCommunicationApiExtensions { diff --git a/PepperDashEssentials/Bridges/IDigitalInputBridge.cs b/PepperDashEssentials/Bridges/IDigitalInputBridge.cs index 54c48e1a..078e0b13 100644 --- a/PepperDashEssentials/Bridges/IDigitalInputBridge.cs +++ b/PepperDashEssentials/Bridges/IDigitalInputBridge.cs @@ -11,7 +11,7 @@ using PepperDash.Essentials.Core.CrestronIO; using Newtonsoft.Json; -namespace PepperDash.Essentials.Bridges +namespace PepperDash.Essentials.Core.Bridges { public static class IDigitalInputApiExtenstions { diff --git a/PepperDashEssentials/Bridges/IRSetTopBoxBaseBridge.cs b/PepperDashEssentials/Bridges/IRSetTopBoxBaseBridge.cs index 0f7b5786..76e5b5ee 100644 --- a/PepperDashEssentials/Bridges/IRSetTopBoxBaseBridge.cs +++ b/PepperDashEssentials/Bridges/IRSetTopBoxBaseBridge.cs @@ -10,7 +10,7 @@ using PepperDash.Essentials.Devices.Common; using Newtonsoft.Json; -namespace PepperDash.Essentials.Bridges +namespace PepperDash.Essentials.Core.Bridges { public static class IRSetTopBoxBaseApiExtensions { diff --git a/PepperDashEssentials/Bridges/StatusSignControllerBridge.cs b/PepperDashEssentials/Bridges/StatusSignControllerBridge.cs index 860f070d..0b35677d 100644 --- a/PepperDashEssentials/Bridges/StatusSignControllerBridge.cs +++ b/PepperDashEssentials/Bridges/StatusSignControllerBridge.cs @@ -4,7 +4,7 @@ using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.CrestronIO; -namespace PepperDash.Essentials.Bridges +namespace PepperDash.Essentials.Core.Bridges { public static class StatusSignDeviceApiExtensions { diff --git a/PepperDashEssentials/Bridges/SystemMonitorBridge.cs b/PepperDashEssentials/Bridges/SystemMonitorBridge.cs index d048b493..5999c500 100644 --- a/PepperDashEssentials/Bridges/SystemMonitorBridge.cs +++ b/PepperDashEssentials/Bridges/SystemMonitorBridge.cs @@ -6,7 +6,7 @@ using PepperDash.Essentials.Core.Monitoring; using Newtonsoft.Json; -namespace PepperDash.Essentials.Bridges +namespace PepperDash.Essentials.Core.Bridges { public static class SystemMonitorBridge { diff --git a/PepperDashEssentials/ControlSystem.cs b/PepperDashEssentials/ControlSystem.cs index f158fc1f..3b603038 100644 --- a/PepperDashEssentials/ControlSystem.cs +++ b/PepperDashEssentials/ControlSystem.cs @@ -51,7 +51,7 @@ namespace PepperDash.Essentials CrestronConsole.AddNewConsoleCommand(PepperDash.Essentials.Core.DeviceFactory.GetDeviceFactoryTypes, "gettypes", "Gets the device types that can be built. Accepts a filter string.", ConsoleAccessLevelEnum.AccessOperator); - CrestronConsole.AddNewConsoleCommand(PepperDash.Essentials.Bridges.BridgeHelper.PrintJoinMap, "getjoinmap", "map(s) for bridge or device on bridge [brKey [devKey]]", ConsoleAccessLevelEnum.AccessOperator); + CrestronConsole.AddNewConsoleCommand(Core.Bridges.BridgeHelper.PrintJoinMap, "getjoinmap", "map(s) for bridge or device on bridge [brKey [devKey]]", ConsoleAccessLevelEnum.AccessOperator); CrestronConsole.AddNewConsoleCommand(s => { diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs index b71aab01..c0afb5f9 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs @@ -1,14 +1,13 @@ using System; using System.Collections.Generic; using Crestron.SimplSharp.Reflection; +using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.EthernetCommunication; using Newtonsoft.Json; using PepperDash.Core; -using PepperDash.Essentials.Core.Lighting; using PepperDash.Essentials.Core.Config; -using PepperDash.Essentials.Core.CrestronIO; //using PepperDash.Essentials.Devices.Common.Cameras; @@ -90,7 +89,8 @@ namespace PepperDash.Essentials.Core.Bridges { JoinMaps = new Dictionary(); - PropertiesConfig = JsonConvert.DeserializeObject(dc.Properties.ToString()); + PropertiesConfig = dc.Properties.ToObject(); + //PropertiesConfig = JsonConvert.DeserializeObject(dc.Properties.ToString()); Eisc = new ThreeSeriesTcpIpEthernetIntersystemCommunications(PropertiesConfig.Control.IpIdInt, PropertiesConfig.Control.TcpSshProperties.Address, Global.ControlSystem); @@ -285,7 +285,7 @@ namespace PepperDash.Essentials.Core.Bridges return; } - Debug.Console(0, "Join map for device '{0}' on EISC '{1}':", deviceKey, this.Key); + Debug.Console(0, "Join map for device '{0}' on EISC '{1}':", deviceKey, Key); joinMap.PrintJoinMapInfo(); } @@ -294,6 +294,7 @@ namespace PepperDash.Essentials.Core.Bridges /// /// /// + /// public void ExecuteJoinAction(uint join, string type, object state) { try @@ -354,23 +355,23 @@ namespace PepperDash.Essentials.Core.Bridges /// /// /// - void Eisc_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args) + void Eisc_SigChange(object currentDevice, SigEventArgs args) { try { if (Debug.Level >= 1) Debug.Console(1, this, "EiscApi change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue); var uo = args.Sig.UserObject; - if (uo != null) - { - Debug.Console(1, this, "Executing Action: {0}", uo.ToString()); - if (uo is Action) - (uo as Action)(args.Sig.BoolValue); - else if (uo is Action) - (uo as Action)(args.Sig.UShortValue); - else if (uo is Action) - (uo as Action)(args.Sig.StringValue); - } + + if (uo == null) return; + + Debug.Console(1, this, "Executing Action: {0}", uo.ToString()); + if (uo is Action) + (uo as Action)(args.Sig.BoolValue); + else if (uo is Action) + (uo as Action)(args.Sig.UShortValue); + else if (uo is Action) + (uo as Action)(args.Sig.StringValue); } catch (Exception e) { diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/AirMediaControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/AirMediaControllerJoinMap.cs index 042a3bf3..1c091233 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/AirMediaControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/AirMediaControllerJoinMap.cs @@ -5,7 +5,7 @@ using System.Text; using Crestron.SimplSharp; using PepperDash.Essentials.Core; -namespace PepperDash.Essentials.Bridges +namespace PepperDash.Essentials.Core.Bridges { public class AirMediaControllerJoinMap : JoinMapBase { diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/AppleTvJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/AppleTvJoinMap.cs index 8945d9c9..aae9e37b 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/AppleTvJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/AppleTvJoinMap.cs @@ -5,7 +5,7 @@ using System.Text; using Crestron.SimplSharp; using PepperDash.Essentials.Core; -namespace PepperDash.Essentials.Bridges +namespace PepperDash.Essentials.Core.Bridges { public class AppleTvJoinMap : JoinMapBase { diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/C2nRthsControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/C2nRthsControllerJoinMap.cs index 1c693070..2ef315b5 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/C2nRthsControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/C2nRthsControllerJoinMap.cs @@ -2,7 +2,7 @@ using Crestron.SimplSharp.Reflection; using PepperDash.Essentials.Core; -namespace PepperDash.Essentials.Bridges +namespace PepperDash.Essentials.Core.Bridges { public class C2nRthsControllerJoinMap:JoinMapBase { diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/CameraControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/CameraControllerJoinMap.cs index 5a37892f..187978d1 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/CameraControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/CameraControllerJoinMap.cs @@ -6,7 +6,7 @@ using Crestron.SimplSharp; using PepperDash.Essentials.Core; -namespace PepperDash.Essentials.Bridges +namespace PepperDash.Essentials.Core.Bridges { /// /// Join map for CameraBase devices diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DigitalLoggerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DigitalLoggerJoinMap.cs index 2b0a1c15..df90a18b 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DigitalLoggerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DigitalLoggerJoinMap.cs @@ -6,7 +6,7 @@ using Crestron.SimplSharp; using PepperDash.Essentials.Core; -namespace PepperDash.Essentials.Bridges +namespace PepperDash.Essentials.Core.Bridges { public class DigitalLoggerJoinMap : JoinMapBase { diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DisplayControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DisplayControllerJoinMap.cs index ddbec182..c2fe8573 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DisplayControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DisplayControllerJoinMap.cs @@ -5,7 +5,7 @@ using System.Text; using Crestron.SimplSharp; using PepperDash.Essentials.Core; -namespace PepperDash.Essentials.Bridges +namespace PepperDash.Essentials.Core.Bridges { public class DisplayControllerJoinMap : JoinMapBase { diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmBladeChassisControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmBladeChassisControllerJoinMap.cs index 8a245ad2..001d6f94 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmBladeChassisControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmBladeChassisControllerJoinMap.cs @@ -5,7 +5,7 @@ using System.Text; using Crestron.SimplSharp; using PepperDash.Essentials.Core; -namespace PepperDash.Essentials.Bridges { +namespace PepperDash.Essentials.Core.Bridges { public class DmBladeChassisControllerJoinMap : JoinMapBase { #region Digital/Analogs #endregion diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmChassisControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmChassisControllerJoinMap.cs index ff6a42d9..5059333f 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmChassisControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmChassisControllerJoinMap.cs @@ -5,7 +5,7 @@ using System.Text; using Crestron.SimplSharp; using PepperDash.Essentials.Core; -namespace PepperDash.Essentials.Bridges +namespace PepperDash.Essentials.Core.Bridges { public class DmChassisControllerJoinMap : JoinMapBase { diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmRmcControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmRmcControllerJoinMap.cs index 7aa8081a..0bdedbbf 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmRmcControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmRmcControllerJoinMap.cs @@ -5,7 +5,7 @@ using System.Text; using Crestron.SimplSharp; using PepperDash.Essentials.Core; -namespace PepperDash.Essentials.Bridges +namespace PepperDash.Essentials.Core.Bridges { public class DmRmcControllerJoinMap : JoinMapBase { diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmTxControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmTxControllerJoinMap.cs index ff673cab..49bd7ac5 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmTxControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmTxControllerJoinMap.cs @@ -1,11 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using PepperDash.Essentials.Core; - -namespace PepperDash.Essentials.Bridges +namespace PepperDash.Essentials.Core.Bridges { public class DmTxControllerJoinMap : JoinMapBase { diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmpsAudioOutputControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmpsAudioOutputControllerJoinMap.cs index faa30775..125700b2 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmpsAudioOutputControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmpsAudioOutputControllerJoinMap.cs @@ -5,7 +5,7 @@ using System.Text; using Crestron.SimplSharp; using PepperDash.Essentials.Core; -namespace PepperDash.Essentials.Bridges +namespace PepperDash.Essentials.Core.Bridges { public class DmpsAudioOutputControllerJoinMap : JoinMapBase { diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmpsRoutingControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmpsRoutingControllerJoinMap.cs index ba3a8cd0..b58611fe 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmpsRoutingControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmpsRoutingControllerJoinMap.cs @@ -5,7 +5,7 @@ using System.Text; using Crestron.SimplSharp; using PepperDash.Essentials.Core; -namespace PepperDash.Essentials.Bridges +namespace PepperDash.Essentials.Core.Bridges { public class DmpsRoutingControllerJoinMap : JoinMapBase { diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/GenericLightingJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/GenericLightingJoinMap.cs index df5606d0..242be651 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/GenericLightingJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/GenericLightingJoinMap.cs @@ -7,7 +7,7 @@ using Crestron.SimplSharp; using PepperDash.Essentials.Core; -namespace PepperDash.Essentials.Bridges +namespace PepperDash.Essentials.Core.Bridges { public class GenericLightingJoinMap : JoinMapBase { diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/GenericRelayControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/GenericRelayControllerJoinMap.cs index 5c91a358..e4ccdfbd 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/GenericRelayControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/GenericRelayControllerJoinMap.cs @@ -5,7 +5,7 @@ using System.Text; using Crestron.SimplSharp; using PepperDash.Essentials.Core; -namespace PepperDash.Essentials.Bridges +namespace PepperDash.Essentials.Core.Bridges { public class GenericRelayControllerJoinMap : JoinMapBase { diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/GlsOccupancySensorBaseJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/GlsOccupancySensorBaseJoinMap.cs index a40913ee..6e2cd175 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/GlsOccupancySensorBaseJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/GlsOccupancySensorBaseJoinMap.cs @@ -5,7 +5,7 @@ using System.Text; using Crestron.SimplSharp; using PepperDash.Essentials.Core; -namespace PepperDash.Essentials.Bridges +namespace PepperDash.Essentials.Core.Bridges { public class GlsOccupancySensorBaseJoinMap : JoinMapBase { diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/HdMdxxxCEControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/HdMdxxxCEControllerJoinMap.cs index e88980fe..d3769838 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/HdMdxxxCEControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/HdMdxxxCEControllerJoinMap.cs @@ -5,7 +5,7 @@ using System.Text; using Crestron.SimplSharp; using PepperDash.Essentials.Core; -namespace PepperDash.Essentials.Bridges +namespace PepperDash.Essentials.Core.Bridges { public class HdMdxxxCEControllerJoinMap : JoinMapBase { diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/IBasicCommunicationJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/IBasicCommunicationJoinMap.cs index 953bae37..3669738e 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/IBasicCommunicationJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/IBasicCommunicationJoinMap.cs @@ -5,7 +5,7 @@ using System.Text; using Crestron.SimplSharp; using PepperDash.Essentials.Core; -namespace PepperDash.Essentials.Bridges +namespace PepperDash.Essentials.Core.Bridges { public class IBasicCommunicationJoinMap : JoinMapBase { diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/IDigitalInputJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/IDigitalInputJoinMap.cs index 65d4ada4..ba9bcc0f 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/IDigitalInputJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/IDigitalInputJoinMap.cs @@ -5,7 +5,7 @@ using System.Text; using Crestron.SimplSharp; using PepperDash.Essentials.Core; -namespace PepperDash.Essentials.Bridges +namespace PepperDash.Essentials.Core.Bridges { public class IDigitalInputJoinMap : JoinMapBase { diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/SetTopBoxControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/SetTopBoxControllerJoinMap.cs index 36e5b2da..dc634ab3 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/SetTopBoxControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/SetTopBoxControllerJoinMap.cs @@ -7,7 +7,7 @@ using PepperDash.Essentials.Core; using Crestron.SimplSharp.Reflection; -namespace PepperDash.Essentials.Bridges +namespace PepperDash.Essentials.Core.Bridges { public class SetTopBoxControllerJoinMap : JoinMapBase { diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/StatusSignControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/StatusSignControllerJoinMap.cs index ad8f1577..7efd049b 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/StatusSignControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/StatusSignControllerJoinMap.cs @@ -2,7 +2,7 @@ using Crestron.SimplSharp.Reflection; using PepperDash.Essentials.Core; -namespace PepperDash.Essentials.Bridges +namespace PepperDash.Essentials.Core.Bridges { public class StatusSignControllerJoinMap:JoinMapBase { diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/SystemMonitorJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/SystemMonitorJoinMap.cs index b2b66263..b2fd3dfd 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/SystemMonitorJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/SystemMonitorJoinMap.cs @@ -1,6 +1,6 @@ using PepperDash.Essentials.Core; -namespace PepperDash.Essentials.Bridges +namespace PepperDash.Essentials.Core.Bridges { public class SystemMonitorJoinMap : JoinMapBase { diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron/CrestronGenericBaseDevice.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron/CrestronGenericBaseDevice.cs index 61c4b289..d19aa326 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron/CrestronGenericBaseDevice.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron/CrestronGenericBaseDevice.cs @@ -1,13 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; +using System.Linq; using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.DeviceSupport; - using PepperDash.Core; -using PepperDash.Essentials.Core.Bridges; using PepperDash_Essentials_Core.Devices; namespace PepperDash.Essentials.Core @@ -15,7 +8,7 @@ namespace PepperDash.Essentials.Core /// /// A bridge class to cover the basic features of GenericBase hardware /// - public abstract class CrestronGenericBaseDevice : EssentialsBridgeableDevice, IOnline, IHasFeedback, ICommunicationMonitor, IUsageTracking + public abstract class CrestronGenericBaseDevice : EssentialsDevice, IOnline, IHasFeedback, ICommunicationMonitor, IUsageTracking { public virtual GenericBase Hardware { get; protected set; } @@ -34,7 +27,7 @@ namespace PepperDash.Essentials.Core /// public bool PreventRegistration { get; protected set; } - public CrestronGenericBaseDevice(string key, string name, GenericBase hardware) + protected CrestronGenericBaseDevice(string key, string name, GenericBase hardware) : base(key, name) { Feedbacks = new FeedbackCollection(); @@ -42,13 +35,7 @@ namespace PepperDash.Essentials.Core Hardware = hardware; IsOnline = new BoolFeedback("IsOnlineFeedback", () => Hardware.IsOnline); IsRegistered = new BoolFeedback("IsRegistered", () => Hardware.Registered); - IpConnectionsText = new StringFeedback("IpConnectionsText", () => - { - if (Hardware.ConnectedIpList != null) - return string.Join(",", Hardware.ConnectedIpList.Select(cip => cip.DeviceIpAddress).ToArray()); - else - return string.Empty; - }); + IpConnectionsText = new StringFeedback("IpConnectionsText", () => Hardware.ConnectedIpList != null ? string.Join(",", Hardware.ConnectedIpList.Select(cip => cip.DeviceIpAddress).ToArray()) : string.Empty); AddToFeedbackList(IsOnline, IpConnectionsText); CommunicationMonitor = new CrestronGenericBaseCommunicationMonitor(this, hardware, 120000, 300000); @@ -80,7 +67,7 @@ namespace PepperDash.Essentials.Core f.FireUpdate(); } - Hardware.OnlineStatusChange += new OnlineStatusChangeEventHandler(Hardware_OnlineStatusChange); + Hardware.OnlineStatusChange += Hardware_OnlineStatusChange; CommunicationMonitor.Start(); return true; @@ -110,12 +97,11 @@ namespace PepperDash.Essentials.Core { foreach (var f in newFbs) { - if (f != null) + if (f == null) continue; + + if (!Feedbacks.Contains(f)) { - if (!Feedbacks.Contains(f)) - { - Feedbacks.Add(f); - } + Feedbacks.Add(f); } } } diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj index de778fc5..e7a5a8ac 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj @@ -111,6 +111,29 @@ + + + + + + + + + + + + + + + + + + + + + + + @@ -132,6 +155,7 @@ + diff --git a/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs b/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs index 28358a51..ad2309c0 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs @@ -1,220 +1,263 @@ -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.DM; -using Crestron.SimplSharpPro.DM.AirMedia; - -using PepperDash.Core; -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Core.Config; - -namespace PepperDash.Essentials.DM.AirMedia -{ - public class AirMediaController : CrestronGenericBaseDevice, IRoutingInputsOutputs, 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; } - - 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; - +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 Newtonsoft.Json; +using PepperDash.Core; +using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; +using PepperDash.Essentials.Core.Config; + +namespace PepperDash.Essentials.DM.AirMedia +{ + public class AirMediaController : CrestronGenericBridgeableBaseDevice, IRoutingInputsOutputs, 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; } + + 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.Audio | eRoutingSignalType.Video, - eRoutingPortConnectionType.None, new Action(SelectPinPointUxLandingPage), this)); - - InputPorts.Add(new RoutingInputPort(DmPortName.AirMediaIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, - eRoutingPortConnectionType.Streaming, new Action(SelectAirMedia), this)); - - InputPorts.Add(new RoutingInputPort(DmPortName.HdmiIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, - eRoutingPortConnectionType.Hdmi, new Action(SelectHdmiIn), this)); - - InputPorts.Add(new RoutingInputPort(DmPortName.AirBoardIn, eRoutingSignalType.Video, - eRoutingPortConnectionType.None, new Action(SelectAirboardIn), this)); - - if (AirMedia is Am300) - { - InputPorts.Add(new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, - eRoutingPortConnectionType.DmCat, new Action(SelectDmIn), 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(); - } - - 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(); - else if (args.EventId == AmX00.EnableAutomaticRoutingFeedbackEventId) - AutomaticInputRoutingEnabledFeedback.FireUpdate(); - } - - void HdmiIn_StreamChange(Crestron.SimplSharpPro.DeviceSupport.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.HDMI; - } - - /// - /// Selects the HDMI INput - /// - public void SelectHdmiIn() - { - AirMedia.DisplayControl.VideoOut = AmX00DisplayControl.eAirMediaX00VideoSource.DM; - } - - 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 - - - } + OutputPorts = new RoutingPortCollection(); + + InputPorts.Add(new RoutingInputPort(DmPortName.Osd, eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.None, new Action(SelectPinPointUxLandingPage), this)); + + InputPorts.Add(new RoutingInputPort(DmPortName.AirMediaIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.Streaming, new Action(SelectAirMedia), this)); + + InputPorts.Add(new RoutingInputPort(DmPortName.HdmiIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.Hdmi, new Action(SelectHdmiIn), this)); + + InputPorts.Add(new RoutingInputPort(DmPortName.AirBoardIn, eRoutingSignalType.Video, + eRoutingPortConnectionType.None, new Action(SelectAirboardIn), this)); + + if (AirMedia is Am300) + { + InputPorts.Add(new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.DmCat, new Action(SelectDmIn), 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, EiscApi bridge) + { + var joinMap = new AirMediaControllerJoinMap(); + + var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); + + if (!string.IsNullOrEmpty(joinMapSerialized)) + joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + + joinMap.OffsetJoinNumbers(joinStart); + + Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); + Debug.Console(0, "Linking to Airmedia: {0}", Name); + + trilist.StringInput[joinMap.Name].StringValue = Name; + + var commMonitor = this as ICommunicationMonitor; + + commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); + + IsInSessionFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsInSession]); + HdmiVideoSyncDetectedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.HdmiVideoSync]); + + trilist.SetSigTrueAction(joinMap.AutomaticInputRoutingEnabled, AirMedia.DisplayControl.EnableAutomaticRouting); + trilist.SetSigFalseAction(joinMap.AutomaticInputRoutingEnabled, AirMedia.DisplayControl.DisableAutomaticRouting); + AutomaticInputRoutingEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.AutomaticInputRoutingEnabled]); + + trilist.SetUShortSigAction(joinMap.VideoOut, (u) => SelectVideoOut(u)); + + VideoOutFeedback.LinkInputSig(trilist.UShortInput[joinMap.VideoOut]); + ErrorFeedback.LinkInputSig(trilist.UShortInput[joinMap.ErrorFB]); + NumberOfUsersConnectedFeedback.LinkInputSig(trilist.UShortInput[joinMap.NumberOfUsersConnectedFB]); + + trilist.SetUShortSigAction(joinMap.LoginCode, (u) => AirMedia.AirMedia.LoginCode.UShortValue = u); + LoginCodeFeedback.LinkInputSig(trilist.UShortInput[joinMap.LoginCode]); + + ConnectionAddressFeedback.LinkInputSig(trilist.StringInput[joinMap.ConnectionAddressFB]); + HostnameFeedback.LinkInputSig(trilist.StringInput[joinMap.HostnameFB]); + SerialNumberFeedback.LinkInputSig(trilist.StringInput[joinMap.SerialNumberFeedback]); + } + + 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(); + else if (args.EventId == AmX00.EnableAutomaticRoutingFeedbackEventId) + AutomaticInputRoutingEnabledFeedback.FireUpdate(); + } + + void HdmiIn_StreamChange(Crestron.SimplSharpPro.DeviceSupport.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.HDMI; + } + + /// + /// Selects the HDMI INput + /// + public void SelectHdmiIn() + { + AirMedia.DisplayControl.VideoOut = AmX00DisplayControl.eAirMediaX00VideoSource.DM; + } + + 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 + + + } } \ No newline at end of file From 1db9e2cc8c3f869ce4d6dd66efc8b205a7e7a094 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 13 Apr 2020 16:32:06 -0600 Subject: [PATCH 013/156] remove internal device joinMaps --- .../PepperDashEssentials.csproj | 23 ------------------- 1 file changed, 23 deletions(-) diff --git a/PepperDashEssentials/PepperDashEssentials.csproj b/PepperDashEssentials/PepperDashEssentials.csproj index b2830e4e..f9e53fb7 100644 --- a/PepperDashEssentials/PepperDashEssentials.csproj +++ b/PepperDashEssentials/PepperDashEssentials.csproj @@ -125,15 +125,12 @@ - - - @@ -146,27 +143,7 @@ - - - - - - - - - - - - - - - - - - - - From 04bbcd1d31568a6040c873c3f9c070245183f618 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 13 Apr 2020 17:11:32 -0600 Subject: [PATCH 014/156] moves several bridges out of extension methods --- .../Bridges/DigitalLoggerBridge.cs | 42 ----- .../PepperDashEssentials.csproj | 5 - .../Crestron IO/C2nRts/C2nRthsController.cs | 36 +++- .../Crestron/CrestronGenericBaseDevice.cs | 13 ++ .../Display/BasicIrDisplay.cs | 6 + .../Display/DisplayBase.cs | 135 ++++++++++++++- .../Display/MockDisplay.cs | 7 + .../Cameras/CameraBase.cs | 163 +++++++++++++++++- .../Cameras/CameraVisca.cs | 10 +- .../Display/AvocorVTFDisplay.cs | 10 +- .../Display/NECPSXMDisplay.cs | 10 +- .../Display/NecPaSeriesProjector.cs | 7 +- .../Display/PanasonicThDisplay.cs | 10 +- .../Display/SamsungMDCDisplay.cs | 10 +- .../Power Controllers/Digitallogger.cs | 30 +++- .../Streaming/AppleTV.cs | 29 +++- .../VideoCodec/CiscoCodec/CiscoCamera.cs | 13 +- .../VideoCodec/MockVC/MockVCCamera.cs | 13 +- .../VideoCodec/ZoomRoom/ZoomRoomCamera.cs | 8 +- 19 files changed, 485 insertions(+), 72 deletions(-) delete mode 100644 PepperDashEssentials/Bridges/DigitalLoggerBridge.cs diff --git a/PepperDashEssentials/Bridges/DigitalLoggerBridge.cs b/PepperDashEssentials/Bridges/DigitalLoggerBridge.cs deleted file mode 100644 index 0786b79d..00000000 --- a/PepperDashEssentials/Bridges/DigitalLoggerBridge.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro.DeviceSupport; -using PepperDash.Core; -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Devices.Common; - -using Newtonsoft.Json; - -namespace PepperDash.Essentials.Core.Bridges -{ - public static class DigitalLoggerApiExtensions - { - public static void LinkToApi(this DigitalLogger DigitalLogger, BasicTriList trilist, uint joinStart, string joinMapKey) - { - DigitalLoggerJoinMap joinMap = new DigitalLoggerJoinMap(); - - var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); - - if (!string.IsNullOrEmpty(joinMapSerialized)) - joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - - joinMap.OffsetJoinNumbers(joinStart); - - Debug.Console(1, DigitalLogger, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); - for (uint i = 1; i <= DigitalLogger.CircuitCount; i++) - { - var circuit = i; - DigitalLogger.CircuitNameFeedbacks[circuit - 1].LinkInputSig(trilist.StringInput[joinMap.CircuitNames + circuit]); - DigitalLogger.CircuitIsCritical[circuit - 1].LinkInputSig(trilist.BooleanInput[joinMap.CircuitIsCritical + circuit]); - DigitalLogger.CircuitState[circuit - 1].LinkInputSig(trilist.BooleanInput[joinMap.CircuitState + circuit]); - trilist.SetSigTrueAction(joinMap.CircuitCycle + circuit, () => DigitalLogger.CycleCircuit(circuit - 1)); - trilist.SetSigTrueAction(joinMap.CircuitOnCmd + circuit, () => DigitalLogger.TurnOnCircuit(circuit - 1)); - trilist.SetSigTrueAction(joinMap.CircuitOffCmd + circuit, () => DigitalLogger.TurnOffCircuit(circuit - 1)); - - } - } - } -} \ No newline at end of file diff --git a/PepperDashEssentials/PepperDashEssentials.csproj b/PepperDashEssentials/PepperDashEssentials.csproj index f9e53fb7..40e6d882 100644 --- a/PepperDashEssentials/PepperDashEssentials.csproj +++ b/PepperDashEssentials/PepperDashEssentials.csproj @@ -124,17 +124,12 @@ - - - - - diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/C2nRts/C2nRthsController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/C2nRts/C2nRthsController.cs index 865acd1c..43684eb2 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/C2nRts/C2nRthsController.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/C2nRts/C2nRthsController.cs @@ -1,14 +1,15 @@ -using System; -using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.GeneralIO; +using Newtonsoft.Json; using PepperDash.Core; -using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; namespace PepperDash.Essentials.Core.CrestronIO { - public class C2nRthsController:CrestronGenericBaseDevice + public class C2nRthsController:CrestronGenericBridgeableBaseDevice { - private C2nRths _device; + private readonly C2nRths _device; public IntFeedback TemperatureFeedback { get; private set; } public IntFeedback HumidityFeedback { get; private set; } @@ -20,7 +21,7 @@ namespace PepperDash.Essentials.Core.CrestronIO TemperatureFeedback = new IntFeedback(() => _device.TemperatureFeedback.UShortValue); HumidityFeedback = new IntFeedback(() => _device.HumidityFeedback.UShortValue); - _device.BaseEvent += DeviceOnBaseEvent; + if (_device != null) _device.BaseEvent += DeviceOnBaseEvent; } private void DeviceOnBaseEvent(GenericBase device, BaseEventArgs args) @@ -40,5 +41,28 @@ namespace PepperDash.Essentials.Core.CrestronIO { _device.TemperatureFormat.BoolValue = setToC; } + + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + { + var joinMap = new C2nRthsControllerJoinMap(); + + var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); + + if (!string.IsNullOrEmpty(joinMapSerialized)) + joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + + joinMap.OffsetJoinNumbers(joinStart); + + Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); + + + trilist.SetBoolSigAction(joinMap.TemperatureFormat, SetTemperatureFormat); + + IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); + TemperatureFeedback.LinkInputSig(trilist.UShortInput[joinMap.Temperature]); + HumidityFeedback.LinkInputSig(trilist.UShortInput[joinMap.Humidity]); + + trilist.StringInput[joinMap.Name].StringValue = Name; + } } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron/CrestronGenericBaseDevice.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron/CrestronGenericBaseDevice.cs index d19aa326..0dbba8c4 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron/CrestronGenericBaseDevice.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron/CrestronGenericBaseDevice.cs @@ -1,6 +1,8 @@ using System.Linq; using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro.DeviceSupport; using PepperDash.Core; +using PepperDash.Essentials.Core.Bridges; using PepperDash_Essentials_Core.Devices; namespace PepperDash.Essentials.Core @@ -128,6 +130,17 @@ namespace PepperDash.Essentials.Core #endregion } + public abstract class CrestronGenericBridgeableBaseDevice : CrestronGenericBaseDevice, IBridgeAdvanced + { + protected CrestronGenericBridgeableBaseDevice(string key, string name, GenericBase hardware) : base(key, name, hardware) + { + } + + + public abstract void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge); + } + + //*********************************************************************************** public class CrestronGenericBaseDeviceEventIds { diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/BasicIrDisplay.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/BasicIrDisplay.cs index 3ffd0bf4..740c241d 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/BasicIrDisplay.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/BasicIrDisplay.cs @@ -8,6 +8,7 @@ using Crestron.SimplSharpPro.DeviceSupport; using PepperDash.Core; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Routing; namespace PepperDash.Essentials.Core @@ -201,5 +202,10 @@ namespace PepperDash.Essentials.Core } #endregion + + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + { + LinkDisplayToApi(this, trilist, joinStart, joinMapKey, bridge); + } } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs index 98659ab2..4e5a177c 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs @@ -4,11 +4,14 @@ using System.Linq; using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DM; using Crestron.SimplSharpPro.DM.Endpoints; using Crestron.SimplSharpPro.DM.Endpoints.Transmitters; - +using Newtonsoft.Json; using PepperDash.Core; +using PepperDash.Essentials.Core.Bridges; +using PepperDash_Essentials_Core.Devices; namespace PepperDash.Essentials.Core @@ -16,7 +19,7 @@ namespace PepperDash.Essentials.Core /// /// /// - public abstract class DisplayBase : Device, IHasFeedback, IRoutingSinkWithSwitching, IPower, IWarmingCooling, IUsageTracking + public abstract class DisplayBase : EssentialsBridgeableDevice, IHasFeedback, IRoutingSinkWithSwitching, IPower, IWarmingCooling, IUsageTracking { public event SourceInfoChangeHandler CurrentSourceChange; @@ -71,7 +74,7 @@ namespace PepperDash.Essentials.Core #endregion - public DisplayBase(string key, string name) + protected DisplayBase(string key, string name) : base(key, name) { PowerIsOnFeedback = new BoolFeedback("PowerOnFeedback", PowerIsOnFeedbackFunc); @@ -113,6 +116,132 @@ namespace PepperDash.Essentials.Core public abstract void ExecuteSwitch(object selector); + protected void LinkDisplayToApi(DisplayBase displayDevice, BasicTriList trilist, uint joinStart, string joinMapKey, + EiscApi bridge) + { + var inputNumber = 0; + var inputKeys = new List(); + + var joinMap = new DisplayControllerJoinMap(); + + var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); + + if (!string.IsNullOrEmpty(joinMapSerialized)) + joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + + joinMap.OffsetJoinNumbers(joinStart); + + Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); + Debug.Console(0, "Linking to Display: {0}", displayDevice.Name); + + trilist.StringInput[joinMap.Name].StringValue = displayDevice.Name; + + var commMonitor = displayDevice as ICommunicationMonitor; + if (commMonitor != null) + { + commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); + } + + var inputNumberFeedback = new IntFeedback(() => inputNumber); + + // Two way feedbacks + var twoWayDisplay = displayDevice as TwoWayDisplayBase; + + if (twoWayDisplay != null) + { + trilist.SetBool(joinMap.IsTwoWayDisplay, true); + + twoWayDisplay.CurrentInputFeedback.OutputChange += (o, a) => Debug.Console(0, "CurrentInputFeedback_OutputChange {0}", a.StringValue); + + + inputNumberFeedback.LinkInputSig(trilist.UShortInput[joinMap.InputSelect]); + } + + // Power Off + trilist.SetSigTrueAction(joinMap.PowerOff, () => + { + inputNumber = 102; + inputNumberFeedback.FireUpdate(); + displayDevice.PowerOff(); + }); + + displayDevice.PowerIsOnFeedback.OutputChange += (o, a) => + { + if (!a.BoolValue) + { + inputNumber = 102; + inputNumberFeedback.FireUpdate(); + + } + else + { + inputNumber = 0; + inputNumberFeedback.FireUpdate(); + } + }; + + displayDevice.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.PowerOff]); + + // PowerOn + trilist.SetSigTrueAction(joinMap.PowerOn, () => + { + inputNumber = 0; + inputNumberFeedback.FireUpdate(); + displayDevice.PowerOn(); + }); + + + displayDevice.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PowerOn]); + + var count = 1; + foreach (var input in displayDevice.InputPorts) + { + inputKeys.Add(input.Key); + var tempKey = inputKeys.ElementAt(count - 1); + trilist.SetSigTrueAction((ushort)(joinMap.InputSelectOffset + count), () => displayDevice.ExecuteSwitch(displayDevice.InputPorts[tempKey].Selector)); + Debug.Console(2, displayDevice, "Setting Input Select Action on Digital Join {0} to Input: {1}", joinMap.InputSelectOffset + count, displayDevice.InputPorts[tempKey].Key.ToString()); + trilist.StringInput[(ushort)(joinMap.InputNamesOffset + count)].StringValue = input.Key.ToString(); + count++; + } + + Debug.Console(2, displayDevice, "Setting Input Select Action on Analog Join {0}", joinMap.InputSelect); + trilist.SetUShortSigAction(joinMap.InputSelect, (a) => + { + if (a == 0) + { + displayDevice.PowerOff(); + inputNumber = 0; + } + else if (a > 0 && a < displayDevice.InputPorts.Count && a != inputNumber) + { + displayDevice.ExecuteSwitch(displayDevice.InputPorts.ElementAt(a - 1).Selector); + inputNumber = a; + } + else if (a == 102) + { + displayDevice.PowerToggle(); + + } + if (twoWayDisplay != null) + inputNumberFeedback.FireUpdate(); + }); + + + var volumeDisplay = displayDevice as IBasicVolumeControls; + if (volumeDisplay == null) return; + + trilist.SetBoolSigAction(joinMap.VolumeUp, volumeDisplay.VolumeUp); + trilist.SetBoolSigAction(joinMap.VolumeDown, volumeDisplay.VolumeDown); + trilist.SetSigTrueAction(joinMap.VolumeMute, volumeDisplay.MuteToggle); + + var volumeDisplayWithFeedback = volumeDisplay as IBasicVolumeWithFeedback; + + if (volumeDisplayWithFeedback == null) return; + + trilist.SetUShortSigAction(joinMap.VolumeLevel, volumeDisplayWithFeedback.SetVolume); + volumeDisplayWithFeedback.VolumeLevelFeedback.LinkInputSig(trilist.UShortInput[joinMap.VolumeLevel]); + volumeDisplayWithFeedback.MuteFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VolumeMute]); + } } /// diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/MockDisplay.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/MockDisplay.cs index bf728e8a..fc43174c 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/MockDisplay.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/MockDisplay.cs @@ -4,11 +4,13 @@ using System.Linq; using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DM; using Crestron.SimplSharpPro.DM.Endpoints; using Crestron.SimplSharpPro.DM.Endpoints.Transmitters; using PepperDash.Core; +using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Routing; @@ -174,5 +176,10 @@ namespace PepperDash.Essentials.Core } #endregion + + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + { + LinkDisplayToApi(this, trilist, joinStart, joinMapKey, bridge); + } } } \ No newline at end of file diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Cameras/CameraBase.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Cameras/CameraBase.cs index 8e2af6cb..24fe2c77 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Cameras/CameraBase.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Cameras/CameraBase.cs @@ -5,13 +5,15 @@ using System.Text; using System.Text.RegularExpressions; using Crestron.SimplSharp; using Crestron.SimplSharp.Reflection; - +using Crestron.SimplSharpPro.DeviceSupport; using PepperDash.Core; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Presets; using PepperDash.Essentials.Devices.Common.Codec; using Newtonsoft.Json; +using PepperDash_Essentials_Core.Devices; namespace PepperDash.Essentials.Devices.Common.Cameras { @@ -24,7 +26,7 @@ namespace PepperDash.Essentials.Devices.Common.Cameras Focus = 8 } - public abstract class CameraBase : Device, IRoutingOutputs + public abstract class CameraBase : EssentialsBridgeableDevice, IRoutingOutputs { public eCameraControlMode ControlMode { get; protected set; } @@ -69,13 +71,166 @@ namespace PepperDash.Essentials.Devices.Common.Cameras // A bitmasked value to indicate the movement capabilites of this camera protected eCameraCapabilities Capabilities { get; set; } - public CameraBase(string key, string name) : + protected CameraBase(string key, string name) : base(key, name) { OutputPorts = new RoutingPortCollection(); ControlMode = eCameraControlMode.Manual; - } + } + + protected void LinkCameraToApi(CameraBase cameraDevice, BasicTriList trilist, uint joinStart, string joinMapKey, + EiscApi bridge) + { + CameraControllerJoinMap joinMap = new CameraControllerJoinMap(joinStart); + + // Adds the join map to the bridge + bridge.AddJoinMap(cameraDevice.Key, joinMap); + + var customJoins = JoinMapHelper.TryGetJoinMapAdvancedForDevice(joinMapKey); + + if (customJoins != null) + { + joinMap.SetCustomJoinData(customJoins); + } + + Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); + Debug.Console(0, "Linking to Bridge Type {0}", cameraDevice.GetType().Name.ToString()); + + var commMonitor = cameraDevice as ICommunicationMonitor; + commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig( + trilist.BooleanInput[joinMap.IsOnline.JoinNumber]); + + var ptzCamera = cameraDevice as IHasCameraPtzControl; + + if (ptzCamera != null) + { + trilist.SetBoolSigAction(joinMap.PanLeft.JoinNumber, (b) => + { + if (b) + { + ptzCamera.PanLeft(); + } + else + { + ptzCamera.PanStop(); + } + }); + trilist.SetBoolSigAction(joinMap.PanRight.JoinNumber, (b) => + { + if (b) + { + ptzCamera.PanRight(); + } + else + { + ptzCamera.PanStop(); + } + }); + + trilist.SetBoolSigAction(joinMap.TiltUp.JoinNumber, (b) => + { + if (b) + { + ptzCamera.TiltUp(); + } + else + { + ptzCamera.TiltStop(); + } + }); + trilist.SetBoolSigAction(joinMap.TiltDown.JoinNumber, (b) => + { + if (b) + { + ptzCamera.TiltDown(); + } + else + { + ptzCamera.TiltStop(); + } + }); + + trilist.SetBoolSigAction(joinMap.ZoomIn.JoinNumber, (b) => + { + if (b) + { + ptzCamera.ZoomIn(); + } + else + { + ptzCamera.ZoomStop(); + } + }); + + trilist.SetBoolSigAction(joinMap.ZoomOut.JoinNumber, (b) => + { + if (b) + { + ptzCamera.ZoomOut(); + } + else + { + ptzCamera.ZoomStop(); + } + }); + } + + if (cameraDevice is IPower) + { + var powerCamera = cameraDevice as IPower; + trilist.SetSigTrueAction(joinMap.PowerOn.JoinNumber, () => powerCamera.PowerOn()); + trilist.SetSigTrueAction(joinMap.PowerOff.JoinNumber, () => powerCamera.PowerOff()); + + powerCamera.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PowerOn.JoinNumber]); + powerCamera.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.PowerOff.JoinNumber]); + } + + if (cameraDevice is ICommunicationMonitor) + { + var monitoredCamera = cameraDevice as ICommunicationMonitor; + monitoredCamera.CommunicationMonitor.IsOnlineFeedback.LinkInputSig( + trilist.BooleanInput[joinMap.IsOnline.JoinNumber]); + } + + if (cameraDevice is IHasCameraPresets) + { + // Set the preset lables when they change + var presetsCamera = cameraDevice as IHasCameraPresets; + presetsCamera.PresetsListHasChanged += new EventHandler((o, a) => + { + for (int i = 1; i <= joinMap.NumberOfPresets.JoinNumber; i++) + { + int tempNum = i - 1; + + string label = ""; + + var preset = presetsCamera.Presets.FirstOrDefault(p => p.ID.Equals(i)); + + if (preset != null) + label = preset.Description; + + trilist.SetString((ushort) (joinMap.PresetLabelStart.JoinNumber + tempNum), label); + } + }); + + for (int i = 0; i < joinMap.NumberOfPresets.JoinNumber; i++) + { + int tempNum = i; + + trilist.SetSigTrueAction((ushort) (joinMap.PresetRecallStart.JoinNumber + tempNum), () => + { + presetsCamera.PresetSelect(tempNum); + }); + trilist.SetSigTrueAction((ushort) (joinMap.PresetSaveStart.JoinNumber + tempNum), () => + { + var label = trilist.GetString((ushort) (joinMap.PresetLabelStart.JoinNumber + tempNum)); + + presetsCamera.PresetStore(tempNum, label); + }); + } + } + } } public class CameraPreset : PresetBase diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Cameras/CameraVisca.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Cameras/CameraVisca.cs index 3d50079b..7d5fa182 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Cameras/CameraVisca.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Cameras/CameraVisca.cs @@ -3,8 +3,10 @@ using System.Collections.Generic; using System.Linq; using System.Text; using Crestron.SimplSharp; +using Crestron.SimplSharpPro.DeviceSupport; using PepperDash.Core; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Devices.Common.Codec; using System.Text.RegularExpressions; using Crestron.SimplSharp.Reflection; @@ -78,7 +80,13 @@ namespace PepperDash.Essentials.Devices.Common.Cameras CrestronConsole.AddNewConsoleCommand(s => Communication.Connect(), "con" + Key, "", ConsoleAccessLevelEnum.AccessOperator); return true; } - void socket_ConnectionChange(object sender, GenericSocketStatusChageEventArgs e) + + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + { + LinkCameraToApi(this, trilist, joinStart, joinMapKey, bridge); + } + + void socket_ConnectionChange(object sender, GenericSocketStatusChageEventArgs e) { Debug.Console(2, this, "Socket Status Change: {0}", e.Client.ClientStatus.ToString()); diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/AvocorVTFDisplay.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/AvocorVTFDisplay.cs index 22226e74..805a3a12 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/AvocorVTFDisplay.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/AvocorVTFDisplay.cs @@ -5,9 +5,12 @@ using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharpPro.CrestronThread; using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro.DeviceSupport; using PepperDash.Core; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Routing; +using Feedback = PepperDash.Essentials.Core.Feedback; namespace PepperDash.Essentials.Devices.Displays { @@ -199,7 +202,12 @@ namespace PepperDash.Essentials.Devices.Displays return true; } - void socket_ConnectionChange(object sender, GenericSocketStatusChageEventArgs e) + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + { + LinkDisplayToApi(this, trilist, joinStart, joinMapKey, bridge); + } + + void socket_ConnectionChange(object sender, GenericSocketStatusChageEventArgs e) { if (e.Client.IsConnected) StatusGet(); diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/NECPSXMDisplay.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/NECPSXMDisplay.cs index 61349632..316d0ed7 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/NECPSXMDisplay.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/NECPSXMDisplay.cs @@ -4,9 +4,12 @@ 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; using PepperDash.Essentials.Core.Routing; +using Feedback = PepperDash.Essentials.Core.Feedback; namespace PepperDash.Essentials.Devices.Displays { @@ -150,7 +153,12 @@ namespace PepperDash.Essentials.Devices.Displays return true; } - public override FeedbackCollection Feedbacks + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + { + LinkDisplayToApi(this, trilist, joinStart, joinMapKey, bridge); + } + + public override FeedbackCollection Feedbacks { get { diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/NecPaSeriesProjector.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/NecPaSeriesProjector.cs index 34263818..919b0e94 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/NecPaSeriesProjector.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/NecPaSeriesProjector.cs @@ -4,9 +4,10 @@ using System.Linq; using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharpPro; - +using Crestron.SimplSharpPro.DeviceSupport; using PepperDash.Essentials.Core; using PepperDash.Core; +using PepperDash.Essentials.Core.Bridges; namespace PepperDash.Essentials.Devices.Displays { @@ -218,5 +219,9 @@ namespace PepperDash.Essentials.Devices.Displays } + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + { + LinkDisplayToApi(this, trilist, joinStart, joinMapKey, bridge); + } } } \ No newline at end of file diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/PanasonicThDisplay.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/PanasonicThDisplay.cs index 5781f134..a493b517 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/PanasonicThDisplay.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/PanasonicThDisplay.cs @@ -4,9 +4,12 @@ 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; using PepperDash.Essentials.Core.Routing; +using Feedback = PepperDash.Essentials.Core.Feedback; namespace PepperDash.Essentials.Devices.Displays { @@ -142,7 +145,12 @@ namespace PepperDash.Essentials.Devices.Displays return true; } - public override FeedbackCollection Feedbacks + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + { + LinkDisplayToApi(this, trilist, joinStart, joinMapKey, bridge); + } + + public override FeedbackCollection Feedbacks { get { diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/SamsungMDCDisplay.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/SamsungMDCDisplay.cs index 975487e0..4fbce220 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/SamsungMDCDisplay.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/SamsungMDCDisplay.cs @@ -5,9 +5,12 @@ using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharpPro.CrestronThread; using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro.DeviceSupport; using PepperDash.Core; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Routing; +using Feedback = PepperDash.Essentials.Core.Feedback; namespace PepperDash.Essentials.Devices.Displays { @@ -146,7 +149,12 @@ namespace PepperDash.Essentials.Devices.Displays return true; } - public override FeedbackCollection Feedbacks + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + { + LinkDisplayToApi(this, trilist, joinStart, joinMapKey, bridge); + } + + public override FeedbackCollection Feedbacks { get { diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Power Controllers/Digitallogger.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Power Controllers/Digitallogger.cs index 358c63cb..ce9536ef 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Power Controllers/Digitallogger.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Power Controllers/Digitallogger.cs @@ -3,18 +3,21 @@ using System.Collections.Generic; using System.Linq; using System.Text; using Crestron.SimplSharp; +using Crestron.SimplSharpPro.DeviceSupport; using PepperDash.Core; using PepperDash.Essentials.Core; using System.Text.RegularExpressions; using Crestron.SimplSharp.Net.Http; using Newtonsoft.Json; using Newtonsoft.Json.Linq; +using PepperDash.Essentials.Core.Bridges; +using PepperDash_Essentials_Core.Devices; namespace PepperDash.Essentials.Devices.Common { - public class DigitalLogger : Device + public class DigitalLogger : EssentialsBridgeableDevice { public IBasicCommunication Communication { get; private set; } public CommunicationGather PortGather { get; private set; } @@ -134,6 +137,31 @@ namespace PepperDash.Essentials.Devices.Common return true; } + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + { + var joinMap = new DigitalLoggerJoinMap(); + + var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); + + if (!string.IsNullOrEmpty(joinMapSerialized)) + joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + + joinMap.OffsetJoinNumbers(joinStart); + + Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); + for (uint i = 1; i <= CircuitCount; i++) + { + var circuit = i; + CircuitNameFeedbacks[circuit - 1].LinkInputSig(trilist.StringInput[joinMap.CircuitNames + circuit]); + CircuitIsCritical[circuit - 1].LinkInputSig(trilist.BooleanInput[joinMap.CircuitIsCritical + circuit]); + CircuitState[circuit - 1].LinkInputSig(trilist.BooleanInput[joinMap.CircuitState + circuit]); + trilist.SetSigTrueAction(joinMap.CircuitCycle + circuit, () => CycleCircuit(circuit - 1)); + trilist.SetSigTrueAction(joinMap.CircuitOnCmd + circuit, () => TurnOnCircuit(circuit - 1)); + trilist.SetSigTrueAction(joinMap.CircuitOffCmd + circuit, () => TurnOffCircuit(circuit - 1)); + + } + } + void socket_ConnectionChange(object sender, GenericSocketStatusChageEventArgs e) { Debug.Console(2, this, "Socket Status Change: {0}", e.Client.ClientStatus.ToString()); diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Streaming/AppleTV.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Streaming/AppleTV.cs index 596c16dd..83d2073b 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Streaming/AppleTV.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Streaming/AppleTV.cs @@ -5,14 +5,16 @@ using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.DeviceSupport; - +using Newtonsoft.Json; using PepperDash.Core; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Routing; +using PepperDash_Essentials_Core.Devices; namespace PepperDash.Essentials.Devices.Common { - public class AppleTV : Device, IDPad, ITransport, IUiDisplayInfo, IRoutingOutputs + public class AppleTV : EssentialsBridgeableDevice, IDPad, ITransport, IUiDisplayInfo, IRoutingOutputs { public IrOutputPortController IrPort { get; private set; } @@ -141,5 +143,28 @@ namespace PepperDash.Essentials.Devices.Common public RoutingPortCollection OutputPorts { get; private set; } #endregion + + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + { + var joinMap = new AppleTvJoinMap(); + + var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); + + if (!string.IsNullOrEmpty(joinMapSerialized)) + joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + + joinMap.OffsetJoinNumbers(joinStart); + + Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); + Debug.Console(0, "Linking to Bridge Type {0}", GetType().Name); + + trilist.SetBoolSigAction(joinMap.UpArrow, Up); + trilist.SetBoolSigAction(joinMap.DnArrow, Down); + trilist.SetBoolSigAction(joinMap.LeftArrow, Left); + trilist.SetBoolSigAction(joinMap.RightArrow, Right); + trilist.SetBoolSigAction(joinMap.Select, Select); + trilist.SetBoolSigAction(joinMap.Menu, Menu); + trilist.SetBoolSigAction(joinMap.PlayPause, Play); + } } } \ No newline at end of file diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoCamera.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoCamera.cs index 12819336..0faa5934 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoCamera.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoCamera.cs @@ -3,7 +3,8 @@ using System.Collections.Generic; using System.Linq; using System.Text; using Crestron.SimplSharp; - +using Crestron.SimplSharpPro.DeviceSupport; +using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Devices.Common.Cameras; namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco @@ -98,6 +99,11 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco { ParentCodec.SendText(string.Format("xCommand Call FarEndControl Camera Stop CallId: {0}", CallId)); } + + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + { + LinkCameraToApi(this, trilist, joinStart, joinMapKey, bridge); + } } public class CiscoSparkCamera : CameraBase, IHasCameraPtzControl, IHasCameraFocusControl @@ -308,5 +314,10 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco } #endregion + + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + { + LinkCameraToApi(this, trilist, joinStart, joinMapKey, bridge); + } } } \ No newline at end of file diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/MockVC/MockVCCamera.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/MockVC/MockVCCamera.cs index c404ac89..8bd444ee 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/MockVC/MockVCCamera.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/MockVC/MockVCCamera.cs @@ -3,8 +3,9 @@ using System.Collections.Generic; using System.Linq; using System.Text; using Crestron.SimplSharp; - +using Crestron.SimplSharpPro.DeviceSupport; using PepperDash.Core; +using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Devices.Common.VideoCodec; namespace PepperDash.Essentials.Devices.Common.Cameras @@ -111,6 +112,11 @@ namespace PepperDash.Essentials.Devices.Common.Cameras } #endregion + + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + { + LinkCameraToApi(this, trilist, joinStart, joinMapKey, bridge); + } } public class MockFarEndVCCamera : CameraBase, IHasCameraPtzControl, IAmFarEndCamera @@ -191,5 +197,10 @@ namespace PepperDash.Essentials.Devices.Common.Cameras } #endregion + + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + { + LinkCameraToApi(this, trilist, joinStart, joinMapKey, bridge); + } } } \ No newline at end of file diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ZoomRoomCamera.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ZoomRoomCamera.cs index 209cfdd9..037b5104 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ZoomRoomCamera.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ZoomRoomCamera.cs @@ -3,7 +3,8 @@ using System.Collections.Generic; using System.Linq; using System.Text; using Crestron.SimplSharp; - +using Crestron.SimplSharpPro.DeviceSupport; +using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Devices.Common.Cameras; namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom @@ -198,6 +199,11 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom } #endregion + + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + { + LinkCameraToApi(this, trilist, joinStart, joinMapKey, bridge); + } } public class ZoomRoomFarEndCamera : ZoomRoomCamera, IAmFarEndCamera From 2ff87d6c4d04bf4e6177bee1eed5c9d63bf7bdfc Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Tue, 14 Apr 2020 10:47:48 -0600 Subject: [PATCH 015/156] Updates the project name from Essentials_DM to PepperDash_Essentials_DM to generate the correct .cplz filename needed by the GH action script for master builds. --- PepperDashEssentials.sln | 8 +- .../PepperDashEssentials.csproj | 2 +- .../PepperDash_Essentials_Core.csproj | 2 +- ...csproj => PepperDash_Essentials_DM.csproj} | 316 +++++++++--------- .../Essentials_DM/Properties/AssemblyInfo.cs | 2 +- 5 files changed, 165 insertions(+), 165 deletions(-) rename essentials-framework/Essentials DM/Essentials_DM/{Essentials_DM.csproj => PepperDash_Essentials_DM.csproj} (97%) diff --git a/PepperDashEssentials.sln b/PepperDashEssentials.sln index a9a0e6d6..af0007ba 100644 --- a/PepperDashEssentials.sln +++ b/PepperDashEssentials.sln @@ -1,21 +1,21 @@  Microsoft Visual Studio Solution File, Format Version 10.00 # Visual Studio 2008 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PepperDashEssentials", ".\PepperDashEssentials\PepperDashEssentials.csproj", "{1BED5BA9-88C4-4365-9362-6F4B128071D3}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PepperDashEssentials", "PepperDashEssentials\PepperDashEssentials.csproj", "{1BED5BA9-88C4-4365-9362-6F4B128071D3}" ProjectSection(ProjectDependencies) = postProject {892B761C-E479-44CE-BD74-243E9214AF13} = {892B761C-E479-44CE-BD74-243E9214AF13} {9199CE8A-0C9F-4952-8672-3EED798B284F} = {9199CE8A-0C9F-4952-8672-3EED798B284F} {A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5} = {A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PepperDash_Essentials_Core", ".\essentials-framework\Essentials Core\PepperDashEssentialsBase\PepperDash_Essentials_Core.csproj", "{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PepperDash_Essentials_Core", "essentials-framework\Essentials Core\PepperDashEssentialsBase\PepperDash_Essentials_Core.csproj", "{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Essentials Devices Common", ".\essentials-framework\Essentials Devices Common\Essentials Devices Common\Essentials Devices Common.csproj", "{892B761C-E479-44CE-BD74-243E9214AF13}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Essentials Devices Common", "essentials-framework\Essentials Devices Common\Essentials Devices Common\Essentials Devices Common.csproj", "{892B761C-E479-44CE-BD74-243E9214AF13}" ProjectSection(ProjectDependencies) = postProject {A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5} = {A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Essentials_DM", ".\essentials-framework\Essentials DM\Essentials_DM\Essentials_DM.csproj", "{9199CE8A-0C9F-4952-8672-3EED798B284F}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PepperDash_Essentials_DM", "essentials-framework\Essentials DM\Essentials_DM\PepperDash_Essentials_DM.csproj", "{9199CE8A-0C9F-4952-8672-3EED798B284F}" ProjectSection(ProjectDependencies) = postProject {A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5} = {A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5} EndProjectSection diff --git a/PepperDashEssentials/PepperDashEssentials.csproj b/PepperDashEssentials/PepperDashEssentials.csproj index 612bdf10..f96ea4d5 100644 --- a/PepperDashEssentials/PepperDashEssentials.csproj +++ b/PepperDashEssentials/PepperDashEssentials.csproj @@ -7,7 +7,7 @@ {1BED5BA9-88C4-4365-9362-6F4B128071D3} Library Properties - PepperDash.Essentials + PepperDashEssentials PepperDashEssentials {0B4745B0-194B-4BB6-8E21-E9057CA92230};{4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} WindowsCE diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj index 61d1ffce..b3377a70 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj @@ -7,7 +7,7 @@ {A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5} Library Properties - PepperDash.Essentials.Core + PepperDash_Essentials_Core PepperDash_Essentials_Core {0B4745B0-194B-4BB6-8E21-E9057CA92300};{4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} WindowsCE diff --git a/essentials-framework/Essentials DM/Essentials_DM/Essentials_DM.csproj b/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj similarity index 97% rename from essentials-framework/Essentials DM/Essentials_DM/Essentials_DM.csproj rename to essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj index e862f8a1..7ab8a5a9 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Essentials_DM.csproj +++ b/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj @@ -1,159 +1,159 @@ - - - Release - AnyCPU - 9.0.30729 - 2.0 - {9199CE8A-0C9F-4952-8672-3EED798B284F} - Library - Properties - PepperDash.Essentials.DM - PepperDash_Essentials_DM - {0B4745B0-194B-4BB6-8E21-E9057CA92300};{4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - WindowsCE - E2BECB1F-8C8C-41ba-B736-9BE7D946A398 - 5.0 - SmartDeviceProject1 - v3.5 - Windows CE - - - - - .allowedReferenceRelatedFileExtensions - true - full - false - bin\ - DEBUG;TRACE; - prompt - 4 - 512 - true - true - off - - - .allowedReferenceRelatedFileExtensions - none - true - bin\ - prompt - 4 - 512 - true - true - off - - - - False - ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.DeviceSupport.dll - - - False - ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.DM.dll - - - False - ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.UI.dll - - - - False - ..\..\pepperdashcore-builds\PepperDash_Core.dll - - - False - ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpCustomAttributesInterface.dll - False - - - False - ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpHelperInterface.dll - False - - - False - ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpNewtonsoft.dll - - - False - ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpPro.exe - False - - - False - ..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpReflectionInterface.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5} - PepperDash_Essentials_Core - - - - - - - - - rem S# Pro preparation will execute after these operations - + + + Release + AnyCPU + 9.0.30729 + 2.0 + {9199CE8A-0C9F-4952-8672-3EED798B284F} + Library + Properties + PepperDash_Essentials_DM + PepperDash_Essentials_DM + {0B4745B0-194B-4BB6-8E21-E9057CA92300};{4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + WindowsCE + E2BECB1F-8C8C-41ba-B736-9BE7D946A398 + 5.0 + SmartDeviceProject1 + v3.5 + Windows CE + + + + + .allowedReferenceRelatedFileExtensions + true + full + false + bin\ + DEBUG;TRACE; + prompt + 4 + 512 + true + true + off + + + .allowedReferenceRelatedFileExtensions + none + true + bin\ + prompt + 4 + 512 + true + true + off + + + + False + ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.DeviceSupport.dll + + + False + ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.DM.dll + + + False + ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.UI.dll + + + + False + ..\..\pepperdashcore-builds\PepperDash_Core.dll + + + False + ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpCustomAttributesInterface.dll + False + + + False + ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpHelperInterface.dll + False + + + False + ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpNewtonsoft.dll + + + False + ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpPro.exe + False + + + False + ..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpReflectionInterface.dll + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5} + PepperDash_Essentials_Core + + + + + + + + + rem S# Pro preparation will execute after these operations + \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Properties/AssemblyInfo.cs b/essentials-framework/Essentials DM/Essentials_DM/Properties/AssemblyInfo.cs index 1f506f3a..c829e44a 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Properties/AssemblyInfo.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Properties/AssemblyInfo.cs @@ -1,7 +1,7 @@ using System.Reflection; using Crestron.SimplSharp.Reflection; -[assembly: System.Reflection.AssemblyTitle("Essentials_DM")] +[assembly: System.Reflection.AssemblyTitle("PepperDash_Essentials_DM")] [assembly: System.Reflection.AssemblyCompany("PepperDash Technology Corp")] [assembly: System.Reflection.AssemblyProduct("PepperDashEssentials")] [assembly: System.Reflection.AssemblyCopyright("Copyright © PepperDash Technology Corp 2020")] From 3a5033ba4e0ed35173f8353da14be9d101b6e7f8 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 14 Apr 2020 16:04:02 -0600 Subject: [PATCH 016/156] Removes moved bridges from Essentials --- .../Bridges/DisplayControllerBridge.cs | 153 ------------ .../Bridges/DmBladeChassisControllerBridge.cs | 222 ------------------ .../PepperDashEssentials.csproj | 16 -- 3 files changed, 391 deletions(-) delete mode 100644 PepperDashEssentials/Bridges/DisplayControllerBridge.cs delete mode 100644 PepperDashEssentials/Bridges/DmBladeChassisControllerBridge.cs diff --git a/PepperDashEssentials/Bridges/DisplayControllerBridge.cs b/PepperDashEssentials/Bridges/DisplayControllerBridge.cs deleted file mode 100644 index b6e3d49b..00000000 --- a/PepperDashEssentials/Bridges/DisplayControllerBridge.cs +++ /dev/null @@ -1,153 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro.DeviceSupport; -using PepperDash.Core; -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Devices.Common; - -using Newtonsoft.Json; - - -namespace PepperDash.Essentials.Core.Bridges -{ - public static class DisplayControllerApiExtensions - { - public static void LinkToApi(this PepperDash.Essentials.Core.DisplayBase displayDevice, BasicTriList trilist, uint joinStart, string joinMapKey) - { - int inputNumber = 0; - IntFeedback inputNumberFeedback; - List inputKeys = new List(); - - DisplayControllerJoinMap joinMap = new DisplayControllerJoinMap(); - - var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); - - if(!string.IsNullOrEmpty(joinMapSerialized)) - joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - - joinMap.OffsetJoinNumbers(joinStart); - - Debug.Console(1, "Linking to Trilist '{0}'",trilist.ID.ToString("X")); - Debug.Console(0, "Linking to Display: {0}", displayDevice.Name); - - trilist.StringInput[joinMap.Name].StringValue = displayDevice.Name; - - var commMonitor = displayDevice as ICommunicationMonitor; - if (commMonitor != null) - { - commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); - } - - inputNumberFeedback = new IntFeedback(() => { return inputNumber; }); - - // Two way feedbacks - var twoWayDisplay = displayDevice as PepperDash.Essentials.Core.TwoWayDisplayBase; - if (twoWayDisplay != null) - { - trilist.SetBool(joinMap.IsTwoWayDisplay, true); - - twoWayDisplay.CurrentInputFeedback.OutputChange += new EventHandler(CurrentInputFeedback_OutputChange); - - - inputNumberFeedback.LinkInputSig(trilist.UShortInput[joinMap.InputSelect]); - } - - // Power Off - trilist.SetSigTrueAction(joinMap.PowerOff, () => - { - inputNumber = 102; - inputNumberFeedback.FireUpdate(); - displayDevice.PowerOff(); - }); - - displayDevice.PowerIsOnFeedback.OutputChange += new EventHandler( (o,a) => { - if (!a.BoolValue) - { - inputNumber = 102; - inputNumberFeedback.FireUpdate(); - - } - else - { - inputNumber = 0; - inputNumberFeedback.FireUpdate(); - } - }); - - displayDevice.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.PowerOff]); - - // PowerOn - trilist.SetSigTrueAction(joinMap.PowerOn, () => - { - inputNumber = 0; - inputNumberFeedback.FireUpdate(); - displayDevice.PowerOn(); - }); - - - displayDevice.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PowerOn]); - - int count = 1; - foreach (var input in displayDevice.InputPorts) - { - inputKeys.Add(input.Key.ToString()); - var tempKey = inputKeys.ElementAt(count - 1); - trilist.SetSigTrueAction((ushort)(joinMap.InputSelectOffset + count), () => { displayDevice.ExecuteSwitch(displayDevice.InputPorts[tempKey].Selector); }); - Debug.Console(2, displayDevice, "Setting Input Select Action on Digital Join {0} to Input: {1}", joinMap.InputSelectOffset + count, displayDevice.InputPorts[tempKey].Key.ToString()); - trilist.StringInput[(ushort)(joinMap.InputNamesOffset + count)].StringValue = input.Key.ToString(); - count++; - } - - Debug.Console(2, displayDevice, "Setting Input Select Action on Analog Join {0}", joinMap.InputSelect); - trilist.SetUShortSigAction(joinMap.InputSelect, (a) => - { - if (a == 0) - { - displayDevice.PowerOff(); - inputNumber = 0; - } - else if (a > 0 && a < displayDevice.InputPorts.Count && a != inputNumber) - { - displayDevice.ExecuteSwitch(displayDevice.InputPorts.ElementAt(a - 1).Selector); - inputNumber = a; - } - else if (a == 102) - { - displayDevice.PowerToggle(); - - } - if (twoWayDisplay != null) - inputNumberFeedback.FireUpdate(); - }); - - - var volumeDisplay = displayDevice as IBasicVolumeControls; - if (volumeDisplay != null) - { - trilist.SetBoolSigAction(joinMap.VolumeUp, (b) => volumeDisplay.VolumeUp(b)); - trilist.SetBoolSigAction(joinMap.VolumeDown, (b) => volumeDisplay.VolumeDown(b)); - trilist.SetSigTrueAction(joinMap.VolumeMute, () => volumeDisplay.MuteToggle()); - - var volumeDisplayWithFeedback = volumeDisplay as IBasicVolumeWithFeedback; - if(volumeDisplayWithFeedback != null) - { - trilist.SetUShortSigAction(joinMap.VolumeLevel, new Action((u) => volumeDisplayWithFeedback.SetVolume(u))); - volumeDisplayWithFeedback.VolumeLevelFeedback.LinkInputSig(trilist.UShortInput[joinMap.VolumeLevel]); - volumeDisplayWithFeedback.MuteFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VolumeMute]); - } - } - } - - static void CurrentInputFeedback_OutputChange(object sender, FeedbackEventArgs e) - { - - Debug.Console(0, "CurrentInputFeedback_OutputChange {0}", e.StringValue); - - } - - } - -} \ No newline at end of file diff --git a/PepperDashEssentials/Bridges/DmBladeChassisControllerBridge.cs b/PepperDashEssentials/Bridges/DmBladeChassisControllerBridge.cs deleted file mode 100644 index 6c64356c..00000000 --- a/PepperDashEssentials/Bridges/DmBladeChassisControllerBridge.cs +++ /dev/null @@ -1,222 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro.DeviceSupport; -using Crestron.SimplSharpPro.DM; -using Crestron.SimplSharpPro.DM.Endpoints; -using Crestron.SimplSharpPro.DM.Endpoints.Transmitters; - -using PepperDash.Core; -using PepperDash.Essentials.Core; -using PepperDash.Essentials.DM; - -using Newtonsoft.Json; - -namespace PepperDash.Essentials.Core.Bridges { - public static class DmBladeChassisControllerApiExtentions { - public static void LinkToApi(this DmBladeChassisController dmChassis, BasicTriList trilist, uint joinStart, string joinMapKey) { - DmBladeChassisControllerJoinMap joinMap = new DmBladeChassisControllerJoinMap(); - - var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); - - if (!string.IsNullOrEmpty(joinMapSerialized)) - joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - - - joinMap.OffsetJoinNumbers(joinStart); - - Debug.Console(1, dmChassis, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); - - var chassis = dmChassis.Chassis as BladeSwitch; - - dmChassis.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); - - - // Link up outputs - for (uint i = 1; i <= dmChassis.Chassis.NumberOfOutputs; i++) { - var ioSlot = i; - - // Control - trilist.SetUShortSigAction(joinMap.OutputVideo + ioSlot, new Action(o => dmChassis.ExecuteSwitch(o, ioSlot, eRoutingSignalType.Video))); - - if (dmChassis.TxDictionary.ContainsKey(ioSlot)) { - Debug.Console(2, "Creating Tx Feedbacks {0}", ioSlot); - var txKey = dmChassis.TxDictionary[ioSlot]; - var basicTxDevice = DeviceManager.GetDeviceForKey(txKey) as BasicDmTxControllerBase; - - var advancedTxDevice = basicTxDevice as DmTxControllerBase; - - if (dmChassis.Chassis is DmMd128x128 || dmChassis.Chassis is DmMd64x64) { - dmChassis.InputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]); - } - else { - if (advancedTxDevice != null) { - advancedTxDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]); - Debug.Console(2, "Linking Tx Online Feedback from Advanced Transmitter at input {0}", ioSlot); - } - else if (dmChassis.InputEndpointOnlineFeedbacks[ioSlot] != null) { - Debug.Console(2, "Linking Tx Online Feedback from Input Card {0}", ioSlot); - dmChassis.InputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]); - } - } - - if (basicTxDevice != null && advancedTxDevice == null) - trilist.BooleanInput[joinMap.TxAdvancedIsPresent + ioSlot].BoolValue = true; - - if (advancedTxDevice != null) { - advancedTxDevice.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus + ioSlot]); - } - else if (advancedTxDevice == null || basicTxDevice != null) { - Debug.Console(1, "Setting up actions and feedbacks on input card {0}", ioSlot); - dmChassis.VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus + ioSlot]); - - var inputPort = dmChassis.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 + ioSlot, trilist); - } - - dmChassis.InputCardHdcpCapabilityFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.HdcpSupportState + ioSlot]); - - if (dmChassis.InputCardHdcpCapabilityTypes.ContainsKey(ioSlot)) - trilist.UShortInput[joinMap.HdcpSupportCapability + ioSlot].UShortValue = (ushort)dmChassis.InputCardHdcpCapabilityTypes[ioSlot]; - else - trilist.UShortInput[joinMap.HdcpSupportCapability + ioSlot].UShortValue = 1; - } - } - } - else { - inputPort = dmChassis.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; - - if (dmInPortWCec != null) { - SetHdcpStateAction(dmChassis.PropertiesConfig.InputSlotSupportsHdcp2[ioSlot], dmInPortWCec, joinMap.HdcpSupportState + ioSlot, trilist); - } - - dmChassis.InputCardHdcpCapabilityFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.HdcpSupportState + ioSlot]); - - if (dmChassis.InputCardHdcpCapabilityTypes.ContainsKey(ioSlot)) - trilist.UShortInput[joinMap.HdcpSupportCapability + ioSlot].UShortValue = (ushort)dmChassis.InputCardHdcpCapabilityTypes[ioSlot]; - else - trilist.UShortInput[joinMap.HdcpSupportCapability + ioSlot].UShortValue = 1; - } - } - } - } - } - else { - dmChassis.VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus + ioSlot]); - - var inputPort = dmChassis.InputPorts[string.Format("inputCard{0}--hdmiIn", ioSlot)]; - if (inputPort != null) { - var hdmiPort = inputPort.Port as EndpointHdmiInput; - - if (hdmiPort != null) { - SetHdcpStateAction(true, hdmiPort, joinMap.HdcpSupportState + ioSlot, trilist); - dmChassis.InputCardHdcpCapabilityFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.HdcpSupportState + ioSlot]); - } - } - } - if (dmChassis.RxDictionary.ContainsKey(ioSlot)) { - Debug.Console(2, "Creating Rx Feedbacks {0}", ioSlot); - //var rxKey = dmChassis.RxDictionary[ioSlot]; - //var rxDevice = DeviceManager.GetDeviceForKey(rxKey) as DmRmcControllerBase; - //var hdBaseTDevice = DeviceManager.GetDeviceForKey(rxKey) as DmHdBaseTControllerBase; - //if (hdBaseTDevice != null) { - dmChassis.OutputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline + ioSlot]); - //} - //else if (rxDevice != null) { - // rxDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline + ioSlot]); - //} - } - - // Feedback - dmChassis.VideoOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputVideo + ioSlot]); - - - dmChassis.OutputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputNames + ioSlot]); - dmChassis.InputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.InputNames + ioSlot]); - dmChassis.OutputVideoRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentVideoInputNames + ioSlot]); - } - } - - static void SetHdcpStateAction(bool hdcpTypeSimple, HdmiInputWithCEC port, uint join, BasicTriList trilist) { - if (hdcpTypeSimple) { - trilist.SetUShortSigAction(join, - new Action(s => { - if (s == 0) { - port.HdcpSupportOff(); - } - else if (s > 0) { - port.HdcpSupportOn(); - } - })); - } - else { - trilist.SetUShortSigAction(join, - new Action(u => { - port.HdcpReceiveCapability = (eHdcpCapabilityType)u; - })); - } - } - - static void SetHdcpStateAction(bool hdcpTypeSimple, EndpointHdmiInput port, uint join, BasicTriList trilist) { - if (hdcpTypeSimple) { - trilist.SetUShortSigAction(join, - new Action(s => { - if (s == 0) { - port.HdcpSupportOff(); - } - else if (s > 0) { - port.HdcpSupportOn(); - } - })); - } - else { - trilist.SetUShortSigAction(join, - new Action(u => { - port.HdcpCapability = (eHdcpCapabilityType)u; - })); - } - } - - static void SetHdcpStateAction(bool supportsHdcp2, DMInputPortWithCec port, uint join, BasicTriList trilist) { - if (!supportsHdcp2) { - trilist.SetUShortSigAction(join, - new Action(s => { - if (s == 0) { - port.HdcpSupportOff(); - } - else if (s > 0) { - port.HdcpSupportOn(); - } - })); - } - else { - trilist.SetUShortSigAction(join, - new Action(u => { - port.HdcpReceiveCapability = (eHdcpCapabilityType)u; - })); - } - } - - } -} \ No newline at end of file diff --git a/PepperDashEssentials/PepperDashEssentials.csproj b/PepperDashEssentials/PepperDashEssentials.csproj index 40e6d882..5b500425 100644 --- a/PepperDashEssentials/PepperDashEssentials.csproj +++ b/PepperDashEssentials/PepperDashEssentials.csproj @@ -125,22 +125,6 @@ - - - - - - - - - - - - - - - - From 80c1a9a46e989d2d9798e2057a8e9cf2a7f24365 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 14 Apr 2020 16:05:23 -0600 Subject: [PATCH 017/156] remvoes BasicDmTxControllerBase ALL DmTx endpoints now inherit from DmTxControllerBase. If the actual endpoint is a DmHdBasedTEndPoint, it WON'T be bridged. --- .../Endpoints/Transmitters/DmTxHelpers.cs | 174 ++++++++++++++++-- 1 file changed, 161 insertions(+), 13 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs index f438b37b..6a648ea3 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs @@ -4,12 +4,14 @@ using System.Linq; using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DM; using Crestron.SimplSharpPro.DM.Endpoints; using Crestron.SimplSharpPro.DM.Endpoints.Transmitters; - +using Newtonsoft.Json; using PepperDash.Core; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.DM.Config; namespace PepperDash.Essentials.DM @@ -23,7 +25,7 @@ namespace PepperDash.Essentials.DM /// /// /// - public static BasicDmTxControllerBase GetDmTxController(string key, string name, string typeName, DmTxPropertiesConfig props) + public static DmTxControllerBase GetDmTxController(string key, string name, string typeName, DmTxPropertiesConfig props) { // switch on type name... later... @@ -141,26 +143,17 @@ namespace PepperDash.Essentials.DM } } - public abstract class BasicDmTxControllerBase : CrestronGenericBaseDevice - { - public BasicDmTxControllerBase(string key, string name, GenericBase hardware) - : base(key, name, hardware) - { - - } - } - /// /// /// - public abstract class DmTxControllerBase : BasicDmTxControllerBase + public abstract class DmTxControllerBase : CrestronGenericBridgeableBaseDevice { public virtual void SetPortHdcpCapability(eHdcpCapabilityType hdcpMode, uint port) { } public virtual eHdcpCapabilityType HdcpSupportCapability { get; protected set; } public abstract StringFeedback ActiveVideoInputFeedback { get; protected set; } public RoutingInputPortWithVideoStatuses AnyVideoInput { get; protected set; } - public DmTxControllerBase(string key, string name, EndpointTransmitterBase hardware) + protected DmTxControllerBase(string key, string name, EndpointTransmitterBase hardware) : base(key, name, hardware) { // if wired to a chassis, skip registration step in base class @@ -170,6 +163,161 @@ namespace PepperDash.Essentials.DM } AddToFeedbackList(ActiveVideoInputFeedback); } + + protected DmTxControllerBase(string key, string name, DmHDBasedTEndPoint hardware) : base(key, name, hardware) + { + } + + protected void LinkDmTxToApi(DmTxControllerBase tx, BasicTriList trilist, uint joinStart, string joinMapKey, + EiscApi bridge) + { + var joinMap = new DmTxControllerJoinMap(); + + var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); + + if (!string.IsNullOrEmpty(joinMapSerialized)) + joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + + joinMap.OffsetJoinNumbers(joinStart); + + if (tx.Hardware is DmHDBasedTEndPoint) + { + Debug.Console(1, tx, "No properties to link. Skipping device {0}", tx.Name); + return; + } + + Debug.Console(1, tx, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); + + tx.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); + tx.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus]); + tx.AnyVideoInput.VideoStatus.VideoResolutionFeedback.LinkInputSig(trilist.StringInput[joinMap.CurrentInputResolution]); + trilist.UShortInput[joinMap.HdcpSupportCapability].UShortValue = (ushort)tx.HdcpSupportCapability; + + bool hdcpTypeSimple; + + if (tx.Hardware is DmTx4kX02CBase) + hdcpTypeSimple = false; + else + hdcpTypeSimple = true; + + if (tx is ITxRouting) + { + var txR = tx as ITxRouting; + + trilist.SetUShortSigAction(joinMap.VideoInput, + i => txR.ExecuteNumericSwitch(i, 0, eRoutingSignalType.Video)); + trilist.SetUShortSigAction(joinMap.AudioInput, + i => txR.ExecuteNumericSwitch(i, 0, eRoutingSignalType.Audio)); + + txR.VideoSourceNumericFeedback.LinkInputSig(trilist.UShortInput[joinMap.VideoInput]); + txR.AudioSourceNumericFeedback.LinkInputSig(trilist.UShortInput[joinMap.AudioInput]); + + trilist.UShortInput[joinMap.HdcpSupportCapability].UShortValue = (ushort)tx.HdcpSupportCapability; + + if (txR.InputPorts[DmPortName.HdmiIn] != null) + { + var inputPort = txR.InputPorts[DmPortName.HdmiIn]; + + if (tx.Feedbacks["HdmiInHdcpCapability"] != null) + { + var intFeedback = tx.Feedbacks["HdmiInHdcpCapability"] as IntFeedback; + if (intFeedback != null) + intFeedback.LinkInputSig(trilist.UShortInput[joinMap.Port1HdcpState]); + } + + if (inputPort.ConnectionType == eRoutingPortConnectionType.Hdmi && inputPort.Port != null) + { + var port = inputPort.Port as EndpointHdmiInput; + + SetHdcpCapabilityAction(hdcpTypeSimple, port, joinMap.Port1HdcpState, trilist); + } + } + + if (txR.InputPorts[DmPortName.HdmiIn1] != null) + { + var inputPort = txR.InputPorts[DmPortName.HdmiIn1]; + + if (tx.Feedbacks["HdmiIn1HdcpCapability"] != null) + { + var intFeedback = tx.Feedbacks["HdmiIn1HdcpCapability"] as IntFeedback; + if (intFeedback != null) + intFeedback.LinkInputSig(trilist.UShortInput[joinMap.Port1HdcpState]); + } + + if (inputPort.ConnectionType == eRoutingPortConnectionType.Hdmi && inputPort.Port != null) + { + var port = inputPort.Port as EndpointHdmiInput; + + SetHdcpCapabilityAction(hdcpTypeSimple, port, joinMap.Port1HdcpState, trilist); + } + } + + if (txR.InputPorts[DmPortName.HdmiIn2] != null) + { + var inputPort = txR.InputPorts[DmPortName.HdmiIn2]; + + if (tx.Feedbacks["HdmiIn2HdcpCapability"] != null) + { + var intFeedback = tx.Feedbacks["HdmiIn2HdcpCapability"] as IntFeedback; + if (intFeedback != null) + intFeedback.LinkInputSig(trilist.UShortInput[joinMap.Port1HdcpState]); + } + + if (inputPort.ConnectionType == eRoutingPortConnectionType.Hdmi && inputPort.Port != null) + { + var port = inputPort.Port as EndpointHdmiInput; + + SetHdcpCapabilityAction(hdcpTypeSimple, port, joinMap.Port2HdcpState, trilist); + } + } + + } + + var txFreeRun = tx as IHasFreeRun; + if (txFreeRun != null) + { + txFreeRun.FreeRunEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.FreeRunEnabled]); + trilist.SetBoolSigAction(joinMap.FreeRunEnabled, new Action(txFreeRun.SetFreeRunEnabled)); + } + + var txVga = tx as IVgaBrightnessContrastControls; + { + if (txVga == null) return; + + txVga.VgaBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.VgaBrightness]); + txVga.VgaContrastFeedback.LinkInputSig(trilist.UShortInput[joinMap.VgaContrast]); + + trilist.SetUShortSigAction(joinMap.VgaBrightness, txVga.SetVgaBrightness); + trilist.SetUShortSigAction(joinMap.VgaContrast, txVga.SetVgaContrast); + } + } + + private void SetHdcpCapabilityAction(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, + s => + { + port.HdcpCapability = (eHdcpCapabilityType)s; + }); + } + } } //public enum ePdtHdcpSupport //{ From 9ed0390f7912f48dce2c71c9d8567bbbb4b93153 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 14 Apr 2020 16:05:51 -0600 Subject: [PATCH 018/156] Adds LinkToApi method to all DmTx Controller classes --- .../Transmitters/DmTx200Controller.cs | 7 ++++ .../Transmitters/DmTx201CController.cs | 7 ++++ .../Transmitters/DmTx401CController.cs | 7 ++++ .../Transmitters/DmTx4k100Controller.cs | 33 +++++++------------ .../Transmitters/DmTx4k202CController.cs | 7 ++++ .../Transmitters/DmTx4k302CController.cs | 7 ++++ .../Transmitters/DmTx4kz302CController.cs | 7 ++++ 7 files changed, 53 insertions(+), 22 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs index 42ecf5c6..4c2e4ef9 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs @@ -4,12 +4,14 @@ using System.Linq; using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DM; using Crestron.SimplSharpPro.DM.Endpoints; using Crestron.SimplSharpPro.DM.Endpoints.Transmitters; using PepperDash.Core; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.DM.Config; namespace PepperDash.Essentials.DM @@ -216,6 +218,11 @@ namespace PepperDash.Essentials.DM return base.CustomActivate(); } + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + { + LinkDmTxToApi(this, trilist, joinStart, joinMapKey, bridge); + } + /// /// Enables or disables free run /// diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs index 37ee38b3..2231494b 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs @@ -4,12 +4,14 @@ using System.Linq; using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DM; using Crestron.SimplSharpPro.DM.Endpoints; using Crestron.SimplSharpPro.DM.Endpoints.Transmitters; using PepperDash.Core; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.DM.Config; namespace PepperDash.Essentials.DM @@ -218,6 +220,11 @@ namespace PepperDash.Essentials.DM return base.CustomActivate(); } + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + { + LinkDmTxToApi(this, trilist, joinStart, joinMapKey, bridge); + } + /// /// Enables or disables free run /// diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs index 18e91fbe..8765fd73 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs @@ -5,12 +5,14 @@ using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharpPro; //using Crestron.SimplSharpPro.DeviceSupport; +using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DM; using Crestron.SimplSharpPro.DM.Endpoints; using Crestron.SimplSharpPro.DM.Endpoints.Transmitters; using PepperDash.Core; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.DM.Config; namespace PepperDash.Essentials.DM @@ -215,6 +217,11 @@ namespace PepperDash.Essentials.DM return base.CustomActivate(); } + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + { + LinkDmTxToApi(this, trilist, joinStart, joinMapKey, bridge); + } + public void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type) { Debug.Console(2, this, "Executing Numeric Switch to input {0}.", input); diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k100Controller.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k100Controller.cs index a6f41c95..dcd2c4e0 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k100Controller.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k100Controller.cs @@ -1,24 +1,17 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro; //using Crestron.SimplSharpPro.DeviceSupport; +using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DM; -using Crestron.SimplSharpPro.DM.Endpoints; using Crestron.SimplSharpPro.DM.Endpoints.Transmitters; - -using PepperDash.Core; using PepperDash.Essentials.Core; -using PepperDash.Essentials.DM.Config; +using PepperDash.Essentials.Core.Bridges; namespace PepperDash.Essentials.DM { - using eVst = Crestron.SimplSharpPro.DeviceSupport.eX02VideoSourceType; - using eAst = Crestron.SimplSharpPro.DeviceSupport.eX02AudioSourceType; + using eVst = eX02VideoSourceType; + using eAst = eX02AudioSourceType; - public class DmTx4k100Controller : BasicDmTxControllerBase, IRoutingInputsOutputs, IHasFeedback, + public class DmTx4k100Controller : DmTxControllerBase, IRoutingInputsOutputs, IIROutputPorts, IComPorts, ICec { public DmTx4K100C1G Tx { get; private set; } @@ -37,7 +30,7 @@ namespace PepperDash.Essentials.DM /// /// Helps get the "real" inputs, including when in Auto /// - public Crestron.SimplSharpPro.DeviceSupport.eX02VideoSourceType ActualActiveVideoInput + public eX02VideoSourceType ActualActiveVideoInput { get { @@ -77,17 +70,11 @@ namespace PepperDash.Essentials.DM } - - public override bool CustomActivate() + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) { - // Link up all of these damned events to the various RoutingPorts via a helper handler - - - // Base does register and sets up comm monitoring. - return base.CustomActivate(); + LinkDmTxToApi(this, trilist, joinStart, joinMapKey, bridge); } - #region IIROutputPorts Members public CrestronCollection IROutputPorts { get { return Tx.IROutputPorts; } } public int NumberOfIROutputPorts { get { return Tx.NumberOfIROutputPorts; } } @@ -101,5 +88,7 @@ namespace PepperDash.Essentials.DM #region ICec Members public Cec StreamCec { get { return Tx.StreamCec; } } #endregion + + public override StringFeedback ActiveVideoInputFeedback { get; protected set; } } } \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k202CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k202CController.cs index fce45926..073807b6 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k202CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k202CController.cs @@ -5,12 +5,14 @@ using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharpPro; //using Crestron.SimplSharpPro.DeviceSupport; +using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DM; using Crestron.SimplSharpPro.DM.Endpoints; using Crestron.SimplSharpPro.DM.Endpoints.Transmitters; using PepperDash.Core; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.DM.Config; namespace PepperDash.Essentials.DM @@ -186,6 +188,11 @@ namespace PepperDash.Essentials.DM return base.CustomActivate(); } + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + { + LinkDmTxToApi(this, trilist, joinStart, joinMapKey, bridge); + } + public void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type) { Debug.Console(2, this, "Executing Numeric Switch to input {0}.", input); diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k302CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k302CController.cs index baaac013..010fd06b 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k302CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k302CController.cs @@ -5,12 +5,14 @@ using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharpPro; //using Crestron.SimplSharpPro.DeviceSupport; +using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DM; using Crestron.SimplSharpPro.DM.Endpoints; using Crestron.SimplSharpPro.DM.Endpoints.Transmitters; using PepperDash.Core; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.DM.Config; namespace PepperDash.Essentials.DM @@ -223,6 +225,11 @@ namespace PepperDash.Essentials.DM return base.CustomActivate(); } + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + { + LinkDmTxToApi(this, trilist, joinStart, joinMapKey, bridge); + } + /// /// Enables or disables free run /// diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz302CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz302CController.cs index 2f7dfafd..541b9fe8 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz302CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz302CController.cs @@ -5,12 +5,14 @@ using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharpPro; //using Crestron.SimplSharpPro.DeviceSupport; +using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DM; using Crestron.SimplSharpPro.DM.Endpoints; using Crestron.SimplSharpPro.DM.Endpoints.Transmitters; using PepperDash.Core; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.DM.Config; namespace PepperDash.Essentials.DM @@ -199,6 +201,11 @@ namespace PepperDash.Essentials.DM return base.CustomActivate(); } + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + { + LinkDmTxToApi(this, trilist, joinStart, joinMapKey, bridge); + } + public void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type) { Debug.Console(2, this, "Executing Numeric Switch to input {0}.", input); From 02d12c1f60de305040b2f20b54f79685f3ba72f3 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 14 Apr 2020 16:07:03 -0600 Subject: [PATCH 019/156] Adds LinkDmRmcToApi method to base class * changes base class to CrestronGenericBridgeableBaseDevice --- .../Endpoints/Receivers/DmRmcHelper.cs | 31 +++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs index f8ad5cf6..09ace234 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs @@ -8,14 +8,15 @@ using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DM; using Crestron.SimplSharpPro.DM.Endpoints; using Crestron.SimplSharpPro.DM.Endpoints.Receivers; - +using Newtonsoft.Json; using PepperDash.Core; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.DM.Config; namespace PepperDash.Essentials.DM { - public abstract class DmRmcControllerBase : CrestronGenericBaseDevice + public abstract class DmRmcControllerBase : CrestronGenericBridgeableBaseDevice { public virtual StringFeedback VideoOutputResolutionFeedback { get; protected set; } public virtual StringFeedback EdidManufacturerFeedback { get; protected set; } @@ -33,6 +34,32 @@ namespace PepperDash.Essentials.DM } AddToFeedbackList(VideoOutputResolutionFeedback, EdidManufacturerFeedback, EdidSerialNumberFeedback, EdidNameFeedback, EdidPreferredTimingFeedback); } + + protected void LinkDmRmcToApi(DmRmcControllerBase rmc, BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + { + var joinMap = new DmRmcControllerJoinMap(); + + var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); + + if (!string.IsNullOrEmpty(joinMapSerialized)) + joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + + joinMap.OffsetJoinNumbers(joinStart); + + Debug.Console(1, rmc, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); + + rmc.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); + if (rmc.VideoOutputResolutionFeedback != null) + rmc.VideoOutputResolutionFeedback.LinkInputSig(trilist.StringInput[joinMap.CurrentOutputResolution]); + if (rmc.EdidManufacturerFeedback != null) + rmc.EdidManufacturerFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidManufacturer]); + if (rmc.EdidNameFeedback != null) + rmc.EdidNameFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidName]); + if (rmc.EdidPreferredTimingFeedback != null) + rmc.EdidPreferredTimingFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidPrefferedTiming]); + if (rmc.EdidSerialNumberFeedback != null) + rmc.EdidSerialNumberFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidSerialNumber]); + } } public abstract class DmHdBaseTControllerBase : CrestronGenericBaseDevice From bfa27d589b0afcad5048602b9981997a3ed8af20 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 14 Apr 2020 16:07:20 -0600 Subject: [PATCH 020/156] Add LinkToApi method to all RMC Classes --- .../Endpoints/Receivers/DmRmc100SController.cs | 7 +++++++ .../Endpoints/Receivers/DmRmc150SController.cs | 7 +++++++ .../Endpoints/Receivers/DmRmc200CController.cs | 9 ++++++++- .../Endpoints/Receivers/DmRmc200S2Controller.cs | 7 +++++++ .../Endpoints/Receivers/DmRmc200SController.cs | 9 ++++++++- .../Endpoints/Receivers/DmRmc4KScalerCController.cs | 9 ++++++++- .../Endpoints/Receivers/DmRmc4kScalerCDspController.cs | 7 +++++++ .../Endpoints/Receivers/DmRmcScalerCController.cs | 9 ++++++++- .../Endpoints/Receivers/DmRmcScalerS2Controller.cs | 7 +++++++ .../Endpoints/Receivers/DmRmcScalerSController.cs | 7 +++++++ .../Endpoints/Receivers/DmRmcX100CController.cs | 9 ++++++++- 11 files changed, 82 insertions(+), 5 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc100SController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc100SController.cs index 49034fab..3ce6dee0 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc100SController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc100SController.cs @@ -4,11 +4,13 @@ using System.Linq; using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DM; using Crestron.SimplSharpPro.DM.Endpoints; using Crestron.SimplSharpPro.DM.Endpoints.Receivers; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; namespace PepperDash.Essentials.DM { @@ -56,6 +58,11 @@ namespace PepperDash.Essentials.DM return base.CustomActivate(); } + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + { + LinkDmRmcToApi(this, trilist, joinStart, joinMapKey, bridge); + } + #region IIROutputPorts Members public CrestronCollection IROutputPorts { get { return Rmc.IROutputPorts; } } public int NumberOfIROutputPorts { get { return Rmc.NumberOfIROutputPorts; } } diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc150SController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc150SController.cs index e5d5a7df..ea17b8aa 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc150SController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc150SController.cs @@ -4,11 +4,13 @@ using System.Linq; using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DM; using Crestron.SimplSharpPro.DM.Endpoints; using Crestron.SimplSharpPro.DM.Endpoints.Receivers; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; namespace PepperDash.Essentials.DM { @@ -95,6 +97,11 @@ namespace PepperDash.Essentials.DM return base.CustomActivate(); } + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + { + LinkDmRmcToApi(this, trilist, joinStart, joinMapKey, bridge); + } + #region IIROutputPorts Members public CrestronCollection IROutputPorts { get { return Rmc.IROutputPorts; } } public int NumberOfIROutputPorts { get { return Rmc.NumberOfIROutputPorts; } } diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200CController.cs index 7fbef021..a5e977c7 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200CController.cs @@ -4,11 +4,13 @@ using System.Linq; using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DM; using Crestron.SimplSharpPro.DM.Endpoints; using Crestron.SimplSharpPro.DM.Endpoints.Receivers; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; namespace PepperDash.Essentials.DM { @@ -95,7 +97,12 @@ namespace PepperDash.Essentials.DM return base.CustomActivate(); } - #region IIROutputPorts Members + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + { + LinkDmRmcToApi(this, trilist, joinStart, joinMapKey, bridge); + } + + #region IIROutputPorts Members public CrestronCollection IROutputPorts { get { return Rmc.IROutputPorts; } } public int NumberOfIROutputPorts { get { return Rmc.NumberOfIROutputPorts; } } #endregion diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200S2Controller.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200S2Controller.cs index ec2ead98..8ac18c49 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200S2Controller.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200S2Controller.cs @@ -4,11 +4,13 @@ using System.Linq; using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DM; using Crestron.SimplSharpPro.DM.Endpoints; using Crestron.SimplSharpPro.DM.Endpoints.Receivers; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; namespace PepperDash.Essentials.DM { @@ -95,6 +97,11 @@ namespace PepperDash.Essentials.DM return base.CustomActivate(); } + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + { + LinkDmRmcToApi(this, trilist, joinStart, joinMapKey, bridge); + } + #region IIROutputPorts Members public CrestronCollection IROutputPorts { get { return Rmc.IROutputPorts; } } public int NumberOfIROutputPorts { get { return Rmc.NumberOfIROutputPorts; } } diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200SController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200SController.cs index 9f2a5251..957efb56 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200SController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200SController.cs @@ -4,11 +4,13 @@ using System.Linq; using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DM; using Crestron.SimplSharpPro.DM.Endpoints; using Crestron.SimplSharpPro.DM.Endpoints.Receivers; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; namespace PepperDash.Essentials.DM { @@ -95,7 +97,12 @@ namespace PepperDash.Essentials.DM return base.CustomActivate(); } - #region IIROutputPorts Members + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + { + LinkDmRmcToApi(this, trilist, joinStart, joinMapKey, bridge); + } + + #region IIROutputPorts Members public CrestronCollection IROutputPorts { get { return Rmc.IROutputPorts; } } public int NumberOfIROutputPorts { get { return Rmc.NumberOfIROutputPorts; } } #endregion diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4KScalerCController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4KScalerCController.cs index e12aa8e6..b9d61e34 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4KScalerCController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4KScalerCController.cs @@ -4,11 +4,13 @@ using System.Linq; using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DM; using Crestron.SimplSharpPro.DM.Endpoints; using Crestron.SimplSharpPro.DM.Endpoints.Receivers; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; namespace PepperDash.Essentials.DM { @@ -102,7 +104,12 @@ namespace PepperDash.Essentials.DM return base.CustomActivate(); } - #region IIROutputPorts Members + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + { + LinkDmRmcToApi(this, trilist, joinStart, joinMapKey, bridge); + } + + #region IIROutputPorts Members public CrestronCollection IROutputPorts { get { return Rmc.IROutputPorts; } } public int NumberOfIROutputPorts { get { return Rmc.NumberOfIROutputPorts; } } #endregion diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kScalerCDspController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kScalerCDspController.cs index 1d614854..5be4ab41 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kScalerCDspController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kScalerCDspController.cs @@ -4,11 +4,13 @@ using System.Linq; using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DM; using Crestron.SimplSharpPro.DM.Endpoints; using Crestron.SimplSharpPro.DM.Endpoints.Receivers; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; namespace PepperDash.Essentials.DM { @@ -102,6 +104,11 @@ namespace PepperDash.Essentials.DM return base.CustomActivate(); } + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + { + LinkDmRmcToApi(this, trilist, joinStart, joinMapKey, bridge); + } + #region IIROutputPorts Members public CrestronCollection IROutputPorts { get { return Rmc.IROutputPorts; } } public int NumberOfIROutputPorts { get { return Rmc.NumberOfIROutputPorts; } } diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerCController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerCController.cs index c488864e..a43c7ec7 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerCController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerCController.cs @@ -4,11 +4,13 @@ using System.Linq; using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DM; using Crestron.SimplSharpPro.DM.Endpoints; using Crestron.SimplSharpPro.DM.Endpoints.Receivers; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; namespace PepperDash.Essentials.DM { @@ -95,7 +97,12 @@ namespace PepperDash.Essentials.DM return base.CustomActivate(); } - #region IIROutputPorts Members + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + { + LinkDmRmcToApi(this, trilist, joinStart, joinMapKey, bridge); + } + + #region IIROutputPorts Members public CrestronCollection IROutputPorts { get { return Rmc.IROutputPorts; } } public int NumberOfIROutputPorts { get { return Rmc.NumberOfIROutputPorts; } } #endregion diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerS2Controller.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerS2Controller.cs index 29ba7789..e85a7c0a 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerS2Controller.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerS2Controller.cs @@ -4,11 +4,13 @@ using System.Linq; using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DM; using Crestron.SimplSharpPro.DM.Endpoints; using Crestron.SimplSharpPro.DM.Endpoints.Receivers; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; namespace PepperDash.Essentials.DM { @@ -95,6 +97,11 @@ namespace PepperDash.Essentials.DM return base.CustomActivate(); } + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + { + LinkDmRmcToApi(this, trilist, joinStart, joinMapKey, bridge); + } + #region IIROutputPorts Members public CrestronCollection IROutputPorts { get { return Rmc.IROutputPorts; } } public int NumberOfIROutputPorts { get { return Rmc.NumberOfIROutputPorts; } } diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerSController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerSController.cs index 0371f765..7da65899 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerSController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerSController.cs @@ -4,11 +4,13 @@ using System.Linq; using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DM; using Crestron.SimplSharpPro.DM.Endpoints; using Crestron.SimplSharpPro.DM.Endpoints.Receivers; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; namespace PepperDash.Essentials.DM { @@ -95,6 +97,11 @@ namespace PepperDash.Essentials.DM return base.CustomActivate(); } + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + { + LinkDmRmcToApi(this, trilist, joinStart, joinMapKey, bridge); + } + #region IIROutputPorts Members public CrestronCollection IROutputPorts { get { return Rmc.IROutputPorts; } } public int NumberOfIROutputPorts { get { return Rmc.NumberOfIROutputPorts; } } diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcX100CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcX100CController.cs index 33bb6fce..ad77df49 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcX100CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcX100CController.cs @@ -4,11 +4,13 @@ using System.Linq; using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DM; using Crestron.SimplSharpPro.DM.Endpoints; using Crestron.SimplSharpPro.DM.Endpoints.Receivers; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; namespace PepperDash.Essentials.DM { @@ -56,7 +58,12 @@ namespace PepperDash.Essentials.DM return base.CustomActivate(); } - #region IIROutputPorts Members + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + { + LinkDmRmcToApi(this, trilist, joinStart, joinMapKey, bridge); + } + + #region IIROutputPorts Members public CrestronCollection IROutputPorts { get { return Rmc.IROutputPorts; } } public int NumberOfIROutputPorts { get { return Rmc.NumberOfIROutputPorts; } } #endregion From c52e31a78519345761f1a239e82e9a926f9dfb46 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 14 Apr 2020 16:07:36 -0600 Subject: [PATCH 021/156] changes base class and adds LinkToApi method --- .../DmLite/HdMdxxxCEController.cs | 49 ++++++++++++++++++- 1 file changed, 47 insertions(+), 2 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/DmLite/HdMdxxxCEController.cs b/essentials-framework/Essentials DM/Essentials_DM/DmLite/HdMdxxxCEController.cs index 8113c218..0d002dbf 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/DmLite/HdMdxxxCEController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/DmLite/HdMdxxxCEController.cs @@ -4,19 +4,21 @@ using System.Linq; using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DM; using Crestron.SimplSharpPro.DM.Endpoints; using Crestron.SimplSharpPro.DM.Endpoints.Receivers; - +using Newtonsoft.Json; using PepperDash.Core; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; namespace PepperDash.Essentials.DM { /// /// Represent both a transmitter and receiver pair of the HD-MD-400-C-E / HD-MD-300-C-E / HD-MD-200-C-E kits /// - public class HdMdxxxCEController : CrestronGenericBaseDevice, IRouting//, IComPorts + public class HdMdxxxCEController : CrestronGenericBridgeableBaseDevice, IRouting//, IComPorts { /// ///// DmLite Ports @@ -217,6 +219,49 @@ namespace PepperDash.Essentials.DM //public CrestronCollection ComPorts { get { return TxRxPair.ComPorts as CrestronCollection; } } //public int NumberOfComPorts { get { return 1; } } //#endregion + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + { + var joinMap = new HdMdxxxCEControllerJoinMap(); + + var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); + + if (!string.IsNullOrEmpty(joinMapSerialized)) + joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + + joinMap.OffsetJoinNumbers(joinStart); + + Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); + + IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); + RemoteEndDetectedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RemoteEndDetected]); + + trilist.SetSigTrueAction(joinMap.AutoRouteOn, AutoRouteOn); + AutoRouteOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.AutoRouteOn]); + trilist.SetSigTrueAction(joinMap.AutoRouteOff, AutoRouteOff); + AutoRouteOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.AutoRouteOff]); + + trilist.SetSigTrueAction(joinMap.PriorityRoutingOn, PriorityRouteOn); + PriorityRoutingOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PriorityRoutingOn]); + trilist.SetSigTrueAction(joinMap.PriorityRoutingOff, PriorityRouteOff); + PriorityRoutingOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.PriorityRoutingOff]); + + trilist.SetSigTrueAction(joinMap.InputOnScreenDisplayEnabled, OnScreenDisplayEnable); + InputOnScreenDisplayEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.InputOnScreenDisplayEnabled]); + trilist.SetSigTrueAction(joinMap.AutoRouteOff, OnScreenDisplayDisable); + InputOnScreenDisplayEnabledFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.InputOnScreenDisplayDisabled]); + + trilist.SetUShortSigAction(joinMap.VideoSource, (i) => ExecuteSwitch(i, null, eRoutingSignalType.Video | eRoutingSignalType.Audio)); + VideoSourceFeedback.LinkInputSig(trilist.UShortInput[joinMap.VideoSource]); + + trilist.UShortInput[joinMap.SourceCount].UShortValue = (ushort)InputPorts.Count; + + foreach (var input in InputPorts) + { + var number = Convert.ToUInt16(input.Selector); + SyncDetectedFeedbacks[number].LinkInputSig(trilist.BooleanInput[joinMap.SyncDetected + number]); + trilist.StringInput[joinMap.SourceNames + number].StringValue = input.Key; + } + } } public class HdMdxxxCEPropertiesConfig From c8732aa8cfdb163a99553e67f4a2205d174eb294 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 14 Apr 2020 16:08:00 -0600 Subject: [PATCH 022/156] Changes base class to EssentialsBridgeableDevice * adds LinkToApi method --- .../Chassis/DmpsRoutingController.cs | 117 +++++++++++++++++- 1 file changed, 114 insertions(+), 3 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs index 6ed0e63b..c9b545c9 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs @@ -4,19 +4,22 @@ 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 Newtonsoft.Json; using PepperDash.Core; using PepperDash.Essentials.Core; - +using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.DM.Config; +using PepperDash_Essentials_Core.Devices; +using Feedback = PepperDash.Essentials.Core.Feedback; namespace PepperDash.Essentials.DM { - public class DmpsRoutingController : Device, IRoutingInputsOutputs, IRouting, IHasFeedback + public class DmpsRoutingController : EssentialsBridgeableDevice, IRouting, IHasFeedback { public CrestronControlSystem Dmps { get; set; } public ISystemControl SystemControl { get; private set; } @@ -151,6 +154,114 @@ namespace PepperDash.Essentials.DM return base.CustomActivate(); } + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + { + var joinMap = new DmpsRoutingControllerJoinMap(); + + var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); + + if (!string.IsNullOrEmpty(joinMapSerialized)) + joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + + joinMap.OffsetJoinNumbers(joinStart); + + Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); + + // Link up outputs + for (uint i = 1; i <= Dmps.NumberOfSwitcherInputs; i++) + { + Debug.Console(2, this, "Linking Input Card {0}", i); + + var ioSlot = i; + + //if (TxDictionary.ContainsKey(ioSlot)) + //{ + // Debug.Console(2, "Creating Tx Feedbacks {0}", ioSlot); + // var TxKey = TxDictionary[ioSlot]; + // var TxDevice = DeviceManager.GetDeviceForKey(TxKey) as DmTxControllerBase; + // //TxDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]); + // // TxDevice.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]); + // // trilist.SetUShortSigAction((ApiMap.HdcpSupport[ioSlot]), u => TxDevice.SetHdcpSupportAll((ePdtHdcpSupport)(u))); + // // TxDevice.HdcpSupportAllFeedback.LinkInputSig(trilist.UShortInput[joinMap. + ioSlot]); + // // trilist.UShortInput[ApiMap.HdcpSupportCapability[ioSlot]].UShortValue = TxDevice.HdcpSupportCapability; + //} + //else + //{ + // // dmChassis.VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[ApiMap.TxVideoSyncStatus[ioSlot]]); + //} + + if (VideoInputSyncFeedbacks[ioSlot] != null) + VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus + ioSlot]); + + if (InputNameFeedbacks[ioSlot] != null) + InputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.InputNames + ioSlot]); + + trilist.SetStringSigAction(joinMap.InputNames + ioSlot, new Action(s => + { + var inputCard = Dmps.SwitcherInputs[ioSlot] as DMInput; + + if (inputCard != null) + { + if (inputCard.NameFeedback != null && !string.IsNullOrEmpty(inputCard.NameFeedback.StringValue) && inputCard.NameFeedback.StringValue != s) + if (inputCard.Name != null) + inputCard.Name.StringValue = s; + } + })); + + + if (InputEndpointOnlineFeedbacks[ioSlot] != null) + InputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]); + } + + for (uint i = 1; i <= Dmps.NumberOfSwitcherOutputs; i++) + { + Debug.Console(2, this, "Linking Output Card {0}", i); + + var ioSlot = i; + // Control + trilist.SetUShortSigAction(joinMap.OutputVideo + ioSlot, o => ExecuteSwitch(o, ioSlot, eRoutingSignalType.Video)); + trilist.SetUShortSigAction(joinMap.OutputAudio + ioSlot, o => ExecuteSwitch(o, ioSlot, eRoutingSignalType.Audio)); + + trilist.SetStringSigAction(joinMap.OutputNames + ioSlot, 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) + { + //Debug.Console(2, dmpsRouter, "Card Type: {0}", outputCard.CardInputOutputType); + + if (!(outputCard is Card.Dmps3CodecOutput) && outputCard.NameFeedback != null) + { + if (!string.IsNullOrEmpty(outputCard.NameFeedback.StringValue)) + { + //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 + ioSlot]); + if (AudioOutputFeedbacks[ioSlot] != null) + AudioOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputAudio + ioSlot]); + if (OutputNameFeedbacks[ioSlot] != null) + OutputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputNames + ioSlot]); + if (OutputVideoRouteNameFeedbacks[ioSlot] != null) + OutputVideoRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentVideoInputNames + ioSlot]); + if (OutputAudioRouteNameFeedbacks[ioSlot] != null) + OutputAudioRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentAudioInputNames + ioSlot]); + if (OutputEndpointOnlineFeedbacks[ioSlot] != null) + OutputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline + ioSlot]); + } + } /// From 0e27928a88c67893b802fc1a760db87f7efbdf11 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 14 Apr 2020 16:08:25 -0600 Subject: [PATCH 023/156] Changes base class to EssentialsBridgeableDevice * adds LinkToApi method --- .../Chassis/DmpsAudioOutputController.cs | 65 +++++++++++++++++-- 1 file changed, 61 insertions(+), 4 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsAudioOutputController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsAudioOutputController.cs index 8856be01..45e1d0ee 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsAudioOutputController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsAudioOutputController.cs @@ -4,21 +4,22 @@ 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 Newtonsoft.Json; using PepperDash.Core; using PepperDash.Essentials.Core; - +using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.DM.Config; +using PepperDash_Essentials_Core.Devices; namespace PepperDash.Essentials.DM { /// /// Exposes the volume levels for Program, Aux1 or Aux2 outputs on a DMPS3 chassis /// - public class DmpsAudioOutputController : Device + public class DmpsAudioOutputController : EssentialsBridgeableDevice { Card.Dmps3OutputBase OutputCard; @@ -100,6 +101,62 @@ namespace PepperDash.Essentials.DM } } } + + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + { + var joinMap = new DmpsAudioOutputControllerJoinMap(); + + var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); + + if (!string.IsNullOrEmpty(joinMapSerialized)) + joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + + joinMap.OffsetJoinNumbers(joinStart); + + Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); + + if (MasterVolumeLevel != null) + { + SetUpDmpsAudioOutputJoins(trilist, MasterVolumeLevel, joinMap.MasterVolume); + } + + if (SourceVolumeLevel != null) + { + SetUpDmpsAudioOutputJoins(trilist, SourceVolumeLevel, joinMap.SourceVolume); + } + + if (Codec1VolumeLevel != null) + { + SetUpDmpsAudioOutputJoins(trilist, Codec1VolumeLevel, joinMap.Codec1Volume); + } + + if (Codec2VolumeLevel != null) + { + SetUpDmpsAudioOutputJoins(trilist, Codec2VolumeLevel, joinMap.Codec2Volume); + } + + } + + static void SetUpDmpsAudioOutputJoins(BasicTriList trilist, DmpsAudioOutput output, uint joinStart) + { + var volumeLevelJoin = joinStart; + var muteOnJoin = joinStart; + var muteOffJoin = joinStart + 1; + var volumeUpJoin = joinStart + 2; + var volumeDownJoin = joinStart + 3; + + + trilist.SetUShortSigAction(volumeLevelJoin, output.SetVolume); + output.VolumeLevelFeedback.LinkInputSig(trilist.UShortInput[volumeLevelJoin]); + + 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); + } } public class DmpsAudioOutput : IBasicVolumeWithFeedback From 560e7a0f04ae1be63ca63d47cff195957bc54bc1 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 14 Apr 2020 16:08:58 -0600 Subject: [PATCH 024/156] Changes base class to CrestronGenericBridgeableBaseDevice * adds LinkToApi method --- .../Chassis/DmChassisController.cs | 277 +++++++++++++++++- 1 file changed, 276 insertions(+), 1 deletion(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs index 033d6a54..e546b842 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs @@ -2,10 +2,14 @@ using System; using System.Collections.Generic; using Crestron.SimplSharp; +using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DM; using Crestron.SimplSharpPro.DM.Cards; +using Crestron.SimplSharpPro.DM.Endpoints; +using Newtonsoft.Json; using PepperDash.Core; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.DM.Config; namespace PepperDash.Essentials.DM @@ -14,7 +18,7 @@ namespace PepperDash.Essentials.DM /// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions /// /// - public class DmChassisController : CrestronGenericBaseDevice, IDmSwitch, IRoutingInputsOutputs, IRouting, IHasFeedback + public class DmChassisController : CrestronGenericBridgeableBaseDevice, IDmSwitch, IRoutingInputsOutputs, IRouting, IHasFeedback { public DMChassisPropertiesConfig PropertiesConfig { get; set; } @@ -985,6 +989,277 @@ namespace PepperDash.Essentials.DM } } #endregion + + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + { + var joinMap = new DmChassisControllerJoinMap(); + + var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); + + if (!string.IsNullOrEmpty(joinMapSerialized)) + joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + + + joinMap.OffsetJoinNumbers(joinStart); + + Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); + + var chassis = Chassis as DmMDMnxn; + + IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); + + trilist.SetUShortSigAction(joinMap.SystemId, o => + { + if (chassis != null) + chassis.SystemId.UShortValue = o; + }); + + trilist.SetSigTrueAction(joinMap.SystemId, () => { + if (chassis != null) chassis.ApplySystemId(); + }); + + SystemIdFeebdack.LinkInputSig(trilist.UShortInput[joinMap.SystemId]); + SystemIdBusyFeedback.LinkInputSig(trilist.BooleanInput[joinMap.SystemId]); + + // Link up outputs + for (uint i = 1; i <= Chassis.NumberOfOutputs; i++) + { + var ioSlot = i; + + // Control + trilist.SetUShortSigAction(joinMap.OutputVideo + ioSlot, o => ExecuteSwitch(o, ioSlot, eRoutingSignalType.Video)); + trilist.SetUShortSigAction(joinMap.OutputAudio + ioSlot, o => ExecuteSwitch(o, ioSlot, eRoutingSignalType.Audio)); + trilist.SetUShortSigAction(joinMap.OutputUsb + ioSlot, o => ExecuteSwitch(o, ioSlot, eRoutingSignalType.UsbOutput)); + trilist.SetUShortSigAction(joinMap.InputUsb + ioSlot, o => ExecuteSwitch(o, ioSlot, eRoutingSignalType.UsbInput)); + + if (TxDictionary.ContainsKey(ioSlot)) + { + Debug.Console(2, "Creating Tx Feedbacks {0}", ioSlot); + var txKey = TxDictionary[ioSlot]; + var basicTxDevice = DeviceManager.GetDeviceForKey(txKey) as DmTxControllerBase; + + var advancedTxDevice = basicTxDevice; + + if (Chassis is DmMd8x8Cpu3 || Chassis is DmMd8x8Cpu3rps + || Chassis is DmMd16x16Cpu3 || Chassis is DmMd16x16Cpu3rps + || Chassis is DmMd32x32Cpu3 || Chassis is DmMd32x32Cpu3rps) + { + InputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]); + } + else + { + if (advancedTxDevice != null) + { + advancedTxDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]); + 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 + ioSlot]); + } + } + + if (basicTxDevice != null && advancedTxDevice == null) + trilist.BooleanInput[joinMap.TxAdvancedIsPresent + ioSlot].BoolValue = true; + + if (advancedTxDevice != null) + { + advancedTxDevice.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus + ioSlot]); + } + else if (advancedTxDevice == null || basicTxDevice != null) + { + Debug.Console(1, "Setting up actions and feedbacks on input card {0}", ioSlot); + VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus + ioSlot]); + + 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 + ioSlot, trilist); + } + + InputCardHdcpCapabilityFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.HdcpSupportState + ioSlot]); + + if (InputCardHdcpCapabilityTypes.ContainsKey(ioSlot)) + trilist.UShortInput[joinMap.HdcpSupportCapability + ioSlot].UShortValue = (ushort)InputCardHdcpCapabilityTypes[ioSlot]; + else + trilist.UShortInput[joinMap.HdcpSupportCapability + ioSlot].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; + + if (dmInPortWCec != null) + { + SetHdcpStateAction(PropertiesConfig.InputSlotSupportsHdcp2[ioSlot], dmInPortWCec, joinMap.HdcpSupportState + ioSlot, trilist); + } + + InputCardHdcpCapabilityFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.HdcpSupportState + ioSlot]); + + if (InputCardHdcpCapabilityTypes.ContainsKey(ioSlot)) + trilist.UShortInput[joinMap.HdcpSupportCapability + ioSlot].UShortValue = (ushort)InputCardHdcpCapabilityTypes[ioSlot]; + else + trilist.UShortInput[joinMap.HdcpSupportCapability + ioSlot].UShortValue = 1; + } + } + } + } + } + else + { + VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus + ioSlot]); + + 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 + ioSlot, trilist); + InputCardHdcpCapabilityFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.HdcpSupportState + ioSlot]); + } + } + } + + 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 (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 + ioSlot]); + } + else if (rxDevice != null) + { + rxDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline + ioSlot]); + } + } + + // Feedback + VideoOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputVideo + ioSlot]); + AudioOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputAudio + ioSlot]); + UsbOutputRoutedToFeebacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputUsb + ioSlot]); + UsbInputRoutedToFeebacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.InputUsb + ioSlot]); + + OutputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputNames + ioSlot]); + InputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.InputNames + ioSlot]); + OutputVideoRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentVideoInputNames + ioSlot]); + OutputAudioRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentAudioInputNames + ioSlot]); + + OutputDisabledByHdcpFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.OutputDisabledByHdcp + ioSlot]); + } + } + + 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 From 459587bbb8728c79d726b36357a52d9617ee4a01 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 14 Apr 2020 16:09:25 -0600 Subject: [PATCH 025/156] Changes base class to CrestronGenericBridgeableBaseDevice * Adds LinkToApi method --- .../Chassis/DmBladeChassisController.cs | 244 +++++++++++++++++- 1 file changed, 241 insertions(+), 3 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmBladeChassisController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmBladeChassisController.cs index 7d57127a..15860c90 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmBladeChassisController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmBladeChassisController.cs @@ -4,15 +4,16 @@ 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 Newtonsoft.Json; using PepperDash.Core; using PepperDash.Essentials.Core; - +using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.DM.Config; namespace PepperDash.Essentials.DM { @@ -20,7 +21,7 @@ namespace PepperDash.Essentials.DM { /// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions /// /// - public class DmBladeChassisController : CrestronGenericBaseDevice, IDmSwitch, IRoutingInputsOutputs, IRouting, IHasFeedback { + public class DmBladeChassisController : CrestronGenericBridgeableBaseDevice, IDmSwitch, IRoutingInputsOutputs, IRouting, IHasFeedback { public DMChassisPropertiesConfig PropertiesConfig { get; set; } public Switch Chassis { get; private set; } @@ -570,6 +571,243 @@ namespace PepperDash.Essentials.DM { #endregion + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + { + var joinMap = new DmBladeChassisControllerJoinMap(); + + var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); + + if (!string.IsNullOrEmpty(joinMapSerialized)) + joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + + + joinMap.OffsetJoinNumbers(joinStart); + + Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); + + IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); + + // Link up outputs + for (uint i = 1; i <= Chassis.NumberOfOutputs; i++) + { + var ioSlot = i; + + // Control + trilist.SetUShortSigAction(joinMap.OutputVideo + ioSlot, o => ExecuteSwitch(o, 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 DmTxControllerBase; + + var advancedTxDevice = basicTxDevice as DmTxControllerBase; + + if (Chassis is DmMd128x128 || Chassis is DmMd64x64) + { + InputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]); + } + else + { + if (advancedTxDevice != null) + { + advancedTxDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]); + 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 + ioSlot]); + } + } + + if (basicTxDevice != null && advancedTxDevice == null) + trilist.BooleanInput[joinMap.TxAdvancedIsPresent + ioSlot].BoolValue = true; + + if (advancedTxDevice != null) + { + advancedTxDevice.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus + ioSlot]); + } + else + { + Debug.Console(1, "Setting up actions and feedbacks on input card {0}", ioSlot); + VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus + ioSlot]); + + 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 + ioSlot, trilist); + } + + InputCardHdcpCapabilityFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.HdcpSupportState + ioSlot]); + + if (InputCardHdcpCapabilityTypes.ContainsKey(ioSlot)) + trilist.UShortInput[joinMap.HdcpSupportCapability + ioSlot].UShortValue = (ushort)InputCardHdcpCapabilityTypes[ioSlot]; + else + trilist.UShortInput[joinMap.HdcpSupportCapability + ioSlot].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 + ioSlot, trilist); + + InputCardHdcpCapabilityFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.HdcpSupportState + ioSlot]); + + if (InputCardHdcpCapabilityTypes.ContainsKey(ioSlot)) + trilist.UShortInput[joinMap.HdcpSupportCapability + ioSlot].UShortValue = (ushort)InputCardHdcpCapabilityTypes[ioSlot]; + else + trilist.UShortInput[joinMap.HdcpSupportCapability + ioSlot].UShortValue = 1; + } + } + } + } + } + else + { + VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus + ioSlot]); + + 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 + ioSlot, trilist); + InputCardHdcpCapabilityFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.HdcpSupportState + ioSlot]); + } + } + } + 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 + ioSlot]); + //} + //else if (rxDevice != null) { + // rxDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline + ioSlot]); + //} + } + + // Feedback + VideoOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputVideo + ioSlot]); + + + OutputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputNames + ioSlot]); + InputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.InputNames + ioSlot]); + OutputVideoRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentVideoInputNames + ioSlot]); + } + } + + 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; + }); + } + } } /* From c10cf202decd07d22842ff9d52053c2ed731ee10 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 14 Apr 2020 16:09:47 -0600 Subject: [PATCH 026/156] Changes base class to EssentialsBridgeableDevice * Adds LinkToApi Method --- .../SetTopBox/IRSetTopBoxBase.cs | 100 +++++++++++++++++- 1 file changed, 97 insertions(+), 3 deletions(-) diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/SetTopBox/IRSetTopBoxBase.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/SetTopBox/IRSetTopBoxBase.cs index 78e2ac22..5e25fce9 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/SetTopBox/IRSetTopBoxBase.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/SetTopBox/IRSetTopBoxBase.cs @@ -4,15 +4,18 @@ using System.Linq; using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharpPro; - +using Crestron.SimplSharpPro.DeviceSupport; +using Newtonsoft.Json; using PepperDash.Core; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Presets; using PepperDash.Essentials.Core.Routing; +using PepperDash_Essentials_Core.Devices; namespace PepperDash.Essentials.Devices.Common { - public class IRSetTopBoxBase : Device, ISetTopBoxControls, IUiDisplayInfo, IRoutingOutputs, IUsageTracking, IPower + public class IRSetTopBoxBase : EssentialsBridgeableDevice, ISetTopBoxControls, IRoutingOutputs, IUsageTracking, IPower { public IrOutputPortController IrPort { get; private set; } @@ -367,5 +370,96 @@ namespace PepperDash.Essentials.Devices.Common } #endregion - } + + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + { + var joinMap = new SetTopBoxControllerJoinMap(); + var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); + + if (!string.IsNullOrEmpty(joinMapSerialized)) + joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + + joinMap.OffsetJoinNumbers(joinStart); + + Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); + Debug.Console(0, "Linking to Display: {0}", Name); + + trilist.StringInput[joinMap.Name].StringValue = Name; + + var stbBase = this as ISetTopBoxControls; + + trilist.BooleanInput[joinMap.HasDpad].BoolValue = stbBase.HasDpad; + trilist.BooleanInput[joinMap.HasNumeric].BoolValue = stbBase.HasNumeric; + trilist.BooleanInput[joinMap.HasDvr].BoolValue = stbBase.HasDvr; + trilist.BooleanInput[joinMap.HasPresets].BoolValue = stbBase.HasPresets; + + trilist.SetBoolSigAction(joinMap.DvrList, stbBase.DvrList); + trilist.SetBoolSigAction(joinMap.Replay, stbBase.Replay); + + trilist.SetStringSigAction(joinMap.LoadPresets, stbBase.LoadPresets); + + var stbPower = this as IPower; + + trilist.SetSigTrueAction(joinMap.PowerOn, stbPower.PowerOn); + trilist.SetSigTrueAction(joinMap.PowerOff, stbPower.PowerOff); + trilist.SetSigTrueAction(joinMap.PowerToggle, stbPower.PowerToggle); + + var stbDPad = this as IDPad; + + trilist.SetBoolSigAction(joinMap.Up, stbDPad.Up); + trilist.SetBoolSigAction(joinMap.Down, stbDPad.Down); + trilist.SetBoolSigAction(joinMap.Left, stbDPad.Left); + trilist.SetBoolSigAction(joinMap.Right, stbDPad.Right); + trilist.SetBoolSigAction(joinMap.Select, stbDPad.Select); + trilist.SetBoolSigAction(joinMap.Menu, stbDPad.Menu); + trilist.SetBoolSigAction(joinMap.Exit, stbDPad.Exit); + + var stbChannel = this as IChannel; + trilist.SetBoolSigAction(joinMap.ChannelUp, stbChannel.ChannelUp); + trilist.SetBoolSigAction(joinMap.ChannelDown, stbChannel.ChannelDown); + trilist.SetBoolSigAction(joinMap.LastChannel, stbChannel.LastChannel); + trilist.SetBoolSigAction(joinMap.Guide, stbChannel.Guide); + trilist.SetBoolSigAction(joinMap.Info, stbChannel.Info); + trilist.SetBoolSigAction(joinMap.Exit, stbChannel.Exit); + + var stbColor = this as IColor; + trilist.SetBoolSigAction(joinMap.Red, stbColor.Red); + trilist.SetBoolSigAction(joinMap.Green, stbColor.Green); + trilist.SetBoolSigAction(joinMap.Yellow, stbColor.Yellow); + trilist.SetBoolSigAction(joinMap.Blue, stbColor.Blue); + + var stbKeypad = this as ISetTopBoxNumericKeypad; + + trilist.StringInput[joinMap.KeypadAccessoryButton1Label].StringValue = stbKeypad.KeypadAccessoryButton1Label; + trilist.StringInput[joinMap.KeypadAccessoryButton2Label].StringValue = stbKeypad.KeypadAccessoryButton2Label; + + trilist.BooleanInput[joinMap.HasKeypadAccessoryButton1].BoolValue = stbKeypad.HasKeypadAccessoryButton1; + trilist.BooleanInput[joinMap.HasKeypadAccessoryButton2].BoolValue = stbKeypad.HasKeypadAccessoryButton2; + + trilist.SetBoolSigAction(joinMap.Digit0, stbKeypad.Digit0); + trilist.SetBoolSigAction(joinMap.Digit1, stbKeypad.Digit1); + trilist.SetBoolSigAction(joinMap.Digit2, stbKeypad.Digit2); + trilist.SetBoolSigAction(joinMap.Digit3, stbKeypad.Digit3); + trilist.SetBoolSigAction(joinMap.Digit4, stbKeypad.Digit4); + trilist.SetBoolSigAction(joinMap.Digit5, stbKeypad.Digit5); + trilist.SetBoolSigAction(joinMap.Digit6, stbKeypad.Digit6); + trilist.SetBoolSigAction(joinMap.Digit7, stbKeypad.Digit7); + trilist.SetBoolSigAction(joinMap.Digit8, stbKeypad.Digit8); + trilist.SetBoolSigAction(joinMap.Digit9, stbKeypad.Digit9); + trilist.SetBoolSigAction(joinMap.KeypadAccessoryButton1Press, stbKeypad.KeypadAccessoryButton1); + trilist.SetBoolSigAction(joinMap.KeypadAccessoryButton2Press, stbKeypad.KeypadAccessoryButton1); + trilist.SetBoolSigAction(joinMap.Dash, stbKeypad.Dash); + trilist.SetBoolSigAction(joinMap.KeypadEnter, stbKeypad.KeypadEnter); + + var stbTransport = this as ITransport; + trilist.SetBoolSigAction(joinMap.Play, stbTransport.Play); + trilist.SetBoolSigAction(joinMap.Pause, stbTransport.Pause); + trilist.SetBoolSigAction(joinMap.Rewind, stbTransport.Rewind); + trilist.SetBoolSigAction(joinMap.FFwd, stbTransport.FFwd); + trilist.SetBoolSigAction(joinMap.ChapMinus, stbTransport.ChapMinus); + trilist.SetBoolSigAction(joinMap.ChapPlus, stbTransport.ChapPlus); + trilist.SetBoolSigAction(joinMap.Stop, stbTransport.Stop); + trilist.SetBoolSigAction(joinMap.Record, stbTransport.Record); + } + } } \ No newline at end of file From 2f17734a4c0a85ec23f7b9cef5f614915c5642f3 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 14 Apr 2020 16:14:04 -0600 Subject: [PATCH 027/156] Changes base class to CrestronGenericBridgeableBaseDevice * adds LinkToApi method --- .../GlsOccupancySensorBaseController.cs | 117 +++++++++++++++++- 1 file changed, 115 insertions(+), 2 deletions(-) diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOccupancySensorBaseController.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOccupancySensorBaseController.cs index 380a090a..5fe0c8df 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOccupancySensorBaseController.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOccupancySensorBaseController.cs @@ -3,14 +3,16 @@ using System.Collections.Generic; using System.Linq; using System.Text; using Crestron.SimplSharp; +using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.GeneralIO; - +using Newtonsoft.Json; using PepperDash.Core; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; namespace PepperDash.Essentials.Devices.Common.Occupancy { - public class GlsOccupancySensorBaseController : CrestronGenericBaseDevice, IOccupancyStatusProvider + public class GlsOccupancySensorBaseController : CrestronGenericBridgeableBaseDevice, IOccupancyStatusProvider { public GlsOccupancySensorBase OccSensor { get; private set; } @@ -251,5 +253,116 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy { OccSensor.ExternalPhotoSensorMinimumChange.UShortValue = value; } + + + + protected void LinkOccSensorToApi(GlsOccupancySensorBaseController occController, BasicTriList trilist, + uint joinStart, string joinMapKey, EiscApi bridge) + { + var joinMap = new GlsOccupancySensorBaseJoinMap(); + + var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); + + if (!string.IsNullOrEmpty(joinMapSerialized)) + joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + + joinMap.OffsetJoinNumbers(joinStart); + + Debug.Console(1, occController, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); + + #region Single and Dual Sensor Stuff + occController.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); + trilist.StringInput[joinMap.Name].StringValue = occController.Name; + + trilist.OnlineStatusChange += (d, args) => + { + if (args.DeviceOnLine) + { + trilist.StringInput[joinMap.Name].StringValue = occController.Name; + } + }; + + // Occupied status + trilist.SetSigTrueAction(joinMap.ForceOccupied, occController.ForceOccupied); + trilist.SetSigTrueAction(joinMap.ForceVacant, occController.ForceVacant); + occController.RoomIsOccupiedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RoomOccupiedFeedback]); + occController.RoomIsOccupiedFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.RoomVacantFeedback]); + occController.RawOccupancyFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyFeedback]); + trilist.SetBoolSigAction(joinMap.EnableRawStates, occController.EnableRawStates); + + // Timouts + trilist.SetUShortSigAction(joinMap.Timeout, occController.SetRemoteTimeout); + occController.CurrentTimeoutFeedback.LinkInputSig(trilist.UShortInput[joinMap.Timeout]); + occController.LocalTimoutFeedback.LinkInputSig(trilist.UShortInput[joinMap.TimeoutLocalFeedback]); + + // LED Flash + trilist.SetSigTrueAction(joinMap.EnableLedFlash, () => occController.SetLedFlashEnable(true)); + trilist.SetSigTrueAction(joinMap.DisableLedFlash, () => occController.SetLedFlashEnable(false)); + occController.LedFlashEnabledFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.EnableLedFlash]); + + // Short Timeout + trilist.SetSigTrueAction(joinMap.EnableShortTimeout, () => occController.SetShortTimeoutState(true)); + trilist.SetSigTrueAction(joinMap.DisableShortTimeout, () => occController.SetShortTimeoutState(false)); + occController.ShortTimeoutEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableShortTimeout]); + + // PIR Sensor + trilist.SetSigTrueAction(joinMap.EnablePir, () => occController.SetPirEnable(true)); + trilist.SetSigTrueAction(joinMap.DisablePir, () => occController.SetPirEnable(false)); + occController.PirSensorEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnablePir]); + + // PIR Sensitivity in Occupied State + trilist.SetBoolSigAction(joinMap.IncrementPirInOccupiedState, occController.IncrementPirSensitivityInOccupiedState); + trilist.SetBoolSigAction(joinMap.DecrementPirInOccupiedState, occController.DecrementPirSensitivityInOccupiedState); + occController.PirSensitivityInOccupiedStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.PirSensitivityInOccupiedState]); + + // PIR Sensitivity in Vacant State + trilist.SetBoolSigAction(joinMap.IncrementPirInVacantState, occController.IncrementPirSensitivityInVacantState); + trilist.SetBoolSigAction(joinMap.DecrementPirInVacantState, occController.DecrementPirSensitivityInVacantState); + occController.PirSensitivityInVacantStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.PirSensitivityInVacantState]); + #endregion + + #region Dual Technology Sensor Stuff + var odtOccController = occController as GlsOdtOccupancySensorController; + + if (odtOccController == null) return; + // OR When Vacated + trilist.SetBoolSigAction(joinMap.OrWhenVacated, odtOccController.SetOrWhenVacatedState); + odtOccController.OrWhenVacatedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.OrWhenVacated]); + + // AND When Vacated + trilist.SetBoolSigAction(joinMap.AndWhenVacated, odtOccController.SetAndWhenVacatedState); + odtOccController.AndWhenVacatedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.AndWhenVacated]); + + // Ultrasonic A Sensor + trilist.SetSigTrueAction(joinMap.EnableUsA, () => odtOccController.SetUsAEnable(true)); + trilist.SetSigTrueAction(joinMap.DisableUsA, () => odtOccController.SetUsAEnable(false)); + odtOccController.UltrasonicAEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableUsA]); + + // Ultrasonic B Sensor + trilist.SetSigTrueAction(joinMap.EnableUsB, () => odtOccController.SetUsBEnable(true)); + trilist.SetSigTrueAction(joinMap.DisableUsB, () => odtOccController.SetUsBEnable(false)); + odtOccController.UltrasonicAEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableUsB]); + + // US Sensitivity in Occupied State + trilist.SetBoolSigAction(joinMap.IncrementUsInOccupiedState, odtOccController.IncrementUsSensitivityInOccupiedState); + trilist.SetBoolSigAction(joinMap.DecrementUsInOccupiedState, odtOccController.DecrementUsSensitivityInOccupiedState); + odtOccController.UltrasonicSensitivityInOccupiedStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.UsSensitivityInOccupiedState]); + + // US Sensitivity in Vacant State + trilist.SetBoolSigAction(joinMap.IncrementUsInVacantState, odtOccController.IncrementUsSensitivityInVacantState); + trilist.SetBoolSigAction(joinMap.DecrementUsInVacantState, odtOccController.DecrementUsSensitivityInVacantState); + odtOccController.UltrasonicSensitivityInVacantStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.UsSensitivityInVacantState]); + + //Sensor Raw States + odtOccController.RawOccupancyPirFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyPirFeedback]); + odtOccController.RawOccupancyUsFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyUsFeedback]); + + #endregion + } + + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + { + LinkOccSensorToApi(this, trilist, joinStart, joinMapKey, bridge); + } } } \ No newline at end of file From 894a6a70bbcb9959a0743e820ccf393f97e8e307 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 14 Apr 2020 16:14:25 -0600 Subject: [PATCH 028/156] Adds LinkToApi method and cleans up a couple of methods --- .../GlsOdtOccupancySensorController.cs | 31 +++++++------------ 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOdtOccupancySensorController.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOdtOccupancySensorController.cs index 16e449bf..37a2acb4 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOdtOccupancySensorController.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOdtOccupancySensorController.cs @@ -3,10 +3,12 @@ using System.Collections.Generic; using System.Linq; using System.Text; using Crestron.SimplSharp; +using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.GeneralIO; using PepperDash.Core; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; namespace PepperDash.Essentials.Devices.Common.Occupancy { @@ -117,16 +119,8 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy /// public void SetUsAEnable(bool state) { - if (state) - { - OccSensor.EnableUsA.BoolValue = state; - OccSensor.DisableUsA.BoolValue = !state; - } - else - { - OccSensor.EnableUsA.BoolValue = state; - OccSensor.DisableUsA.BoolValue = !state; - } + OccSensor.EnableUsA.BoolValue = state; + OccSensor.DisableUsA.BoolValue = !state; } @@ -136,16 +130,8 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy /// public void SetUsBEnable(bool state) { - if (state) - { - OccSensor.EnableUsB.BoolValue = state; - OccSensor.DisableUsB.BoolValue = !state; - } - else - { - OccSensor.EnableUsB.BoolValue = state; - OccSensor.DisableUsB.BoolValue = !state; - } + OccSensor.EnableUsB.BoolValue = state; + OccSensor.DisableUsB.BoolValue = !state; } public void IncrementUsSensitivityInOccupiedState(bool pressRelease) @@ -167,5 +153,10 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy { OccSensor.DecrementUsSensitivityInVacantState.BoolValue = pressRelease; } + + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + { + LinkOccSensorToApi(this, trilist, joinStart, joinMapKey, bridge); + } } } \ No newline at end of file From 0e211e02b850d1960d067b42f7f6625d497ba1e3 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 14 Apr 2020 16:14:42 -0600 Subject: [PATCH 029/156] Adds LinkToApi method --- .../Environment/Lutron/LutronQuantum.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Environment/Lutron/LutronQuantum.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Environment/Lutron/LutronQuantum.cs index adcceb4f..a752a5b4 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Environment/Lutron/LutronQuantum.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Environment/Lutron/LutronQuantum.cs @@ -3,9 +3,12 @@ using System.Collections.Generic; using System.Linq; using System.Text; using Crestron.SimplSharp; +using Crestron.SimplSharpPro.DeviceSupport; using PepperDash.Core; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Lighting; +using LightingBase = PepperDash.Essentials.Core.Lighting.LightingBase; namespace PepperDash.Essentials.Devices.Common.Environment.Lutron { @@ -77,6 +80,14 @@ namespace PepperDash.Essentials.Devices.Common.Environment.Lutron return true; } + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + { + var joinMap = LinkLightingToApi(this, trilist, joinStart, joinMapKey, bridge); + + CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); + trilist.SetStringSigAction(joinMap.IntegrationIdSet, s => IntegrationId = s); + } + void socket_ConnectionChange(object sender, GenericSocketStatusChageEventArgs e) { Debug.Console(2, this, "Socket Status Change: {0}", e.Client.ClientStatus.ToString()); From f3d8084d1178456c7a02eb48c5f12e029578c41f Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 14 Apr 2020 16:15:18 -0600 Subject: [PATCH 030/156] changes base class to EssentialsBridgeableDevice * Adds LinkToApi method --- .../Monitoring/SystemMonitorController.cs | 100 +++++++++++++++++- 1 file changed, 99 insertions(+), 1 deletion(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Monitoring/SystemMonitorController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Monitoring/SystemMonitorController.cs index 495a4a58..7ede2a52 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Monitoring/SystemMonitorController.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Monitoring/SystemMonitorController.cs @@ -1,10 +1,13 @@ using System; using System.Collections.Generic; using Crestron.SimplSharp; +using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.Diagnostics; using PepperDash.Core; using Newtonsoft.Json; using Newtonsoft.Json.Converters; +using PepperDash.Essentials.Core.Bridges; +using PepperDash_Essentials_Core.Devices; namespace PepperDash.Essentials.Core.Monitoring { @@ -12,7 +15,7 @@ namespace PepperDash.Essentials.Core.Monitoring /// Wrapper for the static SystemMonitor class to extend functionality and provide external access /// to SystemMonitor via APIs /// - public class SystemMonitorController : Device + public class SystemMonitorController : EssentialsBridgeableDevice { private const long UptimePollTime = 300000; private CTimer _uptimePollTimer; @@ -198,6 +201,101 @@ namespace PepperDash.Essentials.Core.Monitoring return base.CustomActivate(); } + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + { + var joinMap = new SystemMonitorJoinMap(); + + var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); + + if (!string.IsNullOrEmpty(joinMapSerialized)) + joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + + joinMap.OffsetJoinNumbers(joinStart); + + Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); + Debug.Console(2, this, "Linking API starting at join: {0}", joinStart); + + TimeZoneFeedback.LinkInputSig(trilist.UShortInput[joinMap.TimeZone]); + TimeZoneTextFeedback.LinkInputSig(trilist.StringInput[joinMap.TimeZoneName]); + + IoControllerVersionFeedback.LinkInputSig(trilist.StringInput[joinMap.IOControllerVersion]); + SnmpVersionFeedback.LinkInputSig(trilist.StringInput[joinMap.SnmpAppVersion]); + BaCnetAppVersionFeedback.LinkInputSig(trilist.StringInput[joinMap.BACnetAppVersion]); + ControllerVersionFeedback.LinkInputSig(trilist.StringInput[joinMap.ControllerVersion]); + SerialNumberFeedback.LinkInputSig(trilist.StringInput[joinMap.SerialNumber]); + ModelFeedback.LinkInputSig(trilist.StringInput[joinMap.Model]); + UptimeFeedback.LinkInputSig(trilist.StringInput[joinMap.Uptime]); + LastStartFeedback.LinkInputSig(trilist.StringInput[joinMap.LastBoot]); + + // iterate the program status feedback collection and map all the joins + LinkProgramInfoJoins(this, trilist, joinMap); + + LinkEthernetInfoJoins(this, trilist, joinMap); + } + + private static void LinkEthernetInfoJoins(SystemMonitorController systemMonitorController, BasicTriList trilist, SystemMonitorJoinMap joinMap) + { + var ethernetSlotJoinStart = joinMap.EthernetStartJoin; + + foreach (var fb in systemMonitorController.EthernetStatusFeedbackCollection) + { + fb.Value.CurrentIpAddressFeedback.LinkInputSig(trilist.StringInput[ethernetSlotJoinStart + joinMap.CurrentIpAddress]); + fb.Value.CurrentSubnetMaskFeedback.LinkInputSig(trilist.StringInput[ethernetSlotJoinStart + joinMap.CurrentSubnetMask]); + fb.Value.CurrentDefaultGatewayFeedback.LinkInputSig(trilist.StringInput[ethernetSlotJoinStart + joinMap.CurrentDefaultGateway]); + fb.Value.StaticIpAddressFeedback.LinkInputSig(trilist.StringInput[ethernetSlotJoinStart + joinMap.StaticIpAddress]); + fb.Value.StaticSubnetMaskFeedback.LinkInputSig(trilist.StringInput[ethernetSlotJoinStart + joinMap.StaticSubnetMask]); + fb.Value.StaticDefaultGatewayFeedback.LinkInputSig(trilist.StringInput[ethernetSlotJoinStart + joinMap.StaticDefaultGateway]); + fb.Value.HostNameFeedback.LinkInputSig(trilist.StringInput[ethernetSlotJoinStart + joinMap.HostName]); + fb.Value.MacAddressFeedback.LinkInputSig(trilist.StringInput[ethernetSlotJoinStart + joinMap.MacAddress]); + fb.Value.DomainFeedback.LinkInputSig(trilist.StringInput[ethernetSlotJoinStart + joinMap.Domain]); + fb.Value.DnsServerFeedback.LinkInputSig(trilist.StringInput[ethernetSlotJoinStart + joinMap.DnsServer]); + fb.Value.DhcpStatusFeedback.LinkInputSig(trilist.StringInput[ethernetSlotJoinStart + joinMap.DhcpStatus]); + + ethernetSlotJoinStart += joinMap.EthernetOffsetJoin; + } + } + + private static void LinkProgramInfoJoins(SystemMonitorController systemMonitorController, BasicTriList trilist, + SystemMonitorJoinMap joinMap) + { + var programSlotJoinStart = joinMap.ProgramStartJoin; + + foreach (var p in systemMonitorController.ProgramStatusFeedbackCollection) + { + var programNumber = p.Value.Program.Number; + + trilist.SetBoolSigAction(programSlotJoinStart + joinMap.ProgramStart, + b => SystemMonitor.ProgramCollection[programNumber].OperatingState = eProgramOperatingState.Start); + p.Value.ProgramStartedFeedback.LinkInputSig(trilist.BooleanInput[programSlotJoinStart + joinMap.ProgramStart]); + + trilist.SetBoolSigAction(programSlotJoinStart + joinMap.ProgramStop, + b => SystemMonitor.ProgramCollection[programNumber].OperatingState = eProgramOperatingState.Stop); + p.Value.ProgramStoppedFeedback.LinkInputSig(trilist.BooleanInput[programSlotJoinStart + joinMap.ProgramStop]); + + trilist.SetBoolSigAction(programSlotJoinStart + joinMap.ProgramRegister, + b => SystemMonitor.ProgramCollection[programNumber].RegistrationState = eProgramRegistrationState.Register); + p.Value.ProgramRegisteredFeedback.LinkInputSig( + trilist.BooleanInput[programSlotJoinStart + joinMap.ProgramRegister]); + + trilist.SetBoolSigAction(programSlotJoinStart + joinMap.ProgramUnregister, + b => SystemMonitor.ProgramCollection[programNumber].RegistrationState = eProgramRegistrationState.Unregister); + p.Value.ProgramUnregisteredFeedback.LinkInputSig( + trilist.BooleanInput[programSlotJoinStart + joinMap.ProgramUnregister]); + + p.Value.ProgramNameFeedback.LinkInputSig(trilist.StringInput[programSlotJoinStart + joinMap.ProgramName]); + p.Value.ProgramCompileTimeFeedback.LinkInputSig( + trilist.StringInput[programSlotJoinStart + joinMap.ProgramCompiledTime]); + p.Value.CrestronDataBaseVersionFeedback.LinkInputSig( + trilist.StringInput[programSlotJoinStart + joinMap.ProgramCrestronDatabaseVersion]); + p.Value.EnvironmentVersionFeedback.LinkInputSig( + trilist.StringInput[programSlotJoinStart + joinMap.ProgramEnvironmentVersion]); + p.Value.AggregatedProgramInfoFeedback.LinkInputSig( + trilist.StringInput[programSlotJoinStart + joinMap.AggregatedProgramInfo]); + + programSlotJoinStart = programSlotJoinStart + joinMap.ProgramOffsetJoin; + } + } + //// Sets the time zone //public void SetTimeZone(int timeZone) //{ From 0acec71a7f6d137d391c5bd3bd24d937efa908bf Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 14 Apr 2020 16:15:48 -0600 Subject: [PATCH 031/156] Changes Base class to EssentialsBridgeableDevice * adds LinkLightingToApi Method --- .../Lighting/LightingBase.cs | 45 +++++++++++++++++-- 1 file changed, 41 insertions(+), 4 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Lighting/LightingBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Lighting/LightingBase.cs index af779c16..0d8d8f6f 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Lighting/LightingBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Lighting/LightingBase.cs @@ -4,12 +4,15 @@ using System.Linq; using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharpPro; - +using Crestron.SimplSharpPro.DeviceSupport; +using Newtonsoft.Json; using PepperDash.Core; +using PepperDash.Essentials.Core.Bridges; +using PepperDash_Essentials_Core.Devices; namespace PepperDash.Essentials.Core.Lighting { - public abstract class LightingBase : Device, ILightingScenes + public abstract class LightingBase : EssentialsBridgeableDevice, ILightingScenes { #region ILightingScenes Members @@ -23,8 +26,7 @@ namespace PepperDash.Essentials.Core.Lighting #endregion - - public LightingBase(string key, string name) + protected LightingBase(string key, string name) : base(key, name) { LightingScenes = new List(); @@ -69,6 +71,41 @@ namespace PepperDash.Essentials.Core.Lighting } } + protected GenericLightingJoinMap LinkLightingToApi(LightingBase lightingDevice, BasicTriList trilist, uint joinStart, + string joinMapKey, EiscApi bridge) + { + var joinMap = new GenericLightingJoinMap(); + + var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); + + if (!string.IsNullOrEmpty(joinMapSerialized)) + joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + + joinMap.OffsetJoinNumbers(joinStart); + + Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); + + Debug.Console(0, "Linking to Lighting Type {0}", lightingDevice.GetType().Name.ToString()); + + // GenericLighitng Actions & FeedBack + trilist.SetUShortSigAction(joinMap.SelectScene, u => lightingDevice.SelectScene(lightingDevice.LightingScenes[u])); + + var sceneIndex = 1; + foreach (var scene in lightingDevice.LightingScenes) + { + var tempIndex = sceneIndex - 1; + trilist.SetSigTrueAction((uint)(joinMap.LightingSceneOffset + sceneIndex), () => lightingDevice.SelectScene(lightingDevice.LightingScenes[tempIndex])); + scene.IsActiveFeedback.LinkInputSig(trilist.BooleanInput[(uint)(joinMap.LightingSceneOffset + sceneIndex)]); + trilist.StringInput[(uint)(joinMap.LightingSceneOffset + sceneIndex)].StringValue = scene.Name; + trilist.BooleanInput[(uint)(joinMap.ButtonVisibilityOffset + sceneIndex)].BoolValue = true; + sceneIndex++; + } + + + + return joinMap; + } + } public class LightingScene From 4102a0649789fd680a46d3e904295fd965ef0bf2 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 14 Apr 2020 16:16:11 -0600 Subject: [PATCH 032/156] Adds ReconfigurableBridgeableDevice base class --- .../Devices/ReconfigurableDevice.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/ReconfigurableDevice.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/ReconfigurableDevice.cs index b19b40b5..6719ae06 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/ReconfigurableDevice.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/ReconfigurableDevice.cs @@ -3,8 +3,9 @@ using System.Collections.Generic; using System.Linq; using System.Text; using Crestron.SimplSharp; - +using Crestron.SimplSharpPro.DeviceSupport; using PepperDash.Core; +using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Config; namespace PepperDash.Essentials.Core.Devices @@ -18,7 +19,7 @@ namespace PepperDash.Essentials.Core.Devices public DeviceConfig Config { get; private set; } - public ReconfigurableDevice(DeviceConfig config) + protected ReconfigurableDevice(DeviceConfig config) : base(config.Key) { SetNameHelper(config); @@ -60,4 +61,13 @@ namespace PepperDash.Essentials.Core.Devices ConfigWriter.UpdateDeviceConfig(config); } } + + public abstract class ReconfigurableBridgableDevice : ReconfigurableDevice, IBridgeAdvanced + { + protected ReconfigurableBridgableDevice(DeviceConfig config) : base(config) + { + } + + public abstract void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge); + } } \ No newline at end of file From 37313040e1398f47aceb42326332ff4da2037901 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 14 Apr 2020 16:16:43 -0600 Subject: [PATCH 033/156] Changes base class to CrestronGenericBridgeableDevice * adds LinkToApi method --- .../StatusSign/StatusSignController.cs | 60 ++++++++++++++++++- 1 file changed, 57 insertions(+), 3 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/StatusSign/StatusSignController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/StatusSign/StatusSignController.cs index b83eae37..7835db7e 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/StatusSign/StatusSignController.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/StatusSign/StatusSignController.cs @@ -2,13 +2,15 @@ using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.GeneralIO; +using Newtonsoft.Json; using PepperDash.Core; +using PepperDash.Essentials.Core.Bridges; namespace PepperDash.Essentials.Core.CrestronIO { - public class StatusSignController:CrestronGenericBaseDevice + public class StatusSignController:CrestronGenericBridgeableBaseDevice { - private StatusSign _device; + private readonly StatusSign _device; public BoolFeedback RedLedEnabledFeedback { get; private set; } public BoolFeedback GreenLedEnabledFeedback { get; private set; } @@ -45,7 +47,7 @@ namespace PepperDash.Essentials.Core.CrestronIO BlueLedBrightnessFeedback = new IntFeedback(() => (int) _device.Leds[(uint) StatusSign.Led.eLedColor.Blue].BrightnessFeedback); - _device.BaseEvent += _device_BaseEvent; + if (_device != null) _device.BaseEvent += _device_BaseEvent; } void _device_BaseEvent(GenericBase device, BaseEventArgs args) @@ -103,5 +105,57 @@ namespace PepperDash.Essentials.Core.CrestronIO Debug.Console(1, this, "Error converting value to Blue LED brightness. value: {0}", blue); } } + + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + { + var joinMap = new StatusSignControllerJoinMap(); + + var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); + + if (!string.IsNullOrEmpty(joinMapSerialized)) + joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + + joinMap.OffsetJoinNumbers(joinStart); + + Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); + + trilist.SetBoolSigAction(joinMap.RedControl, b => EnableControl(trilist, joinMap, this)); + trilist.SetBoolSigAction(joinMap.GreenControl, b => EnableControl(trilist, joinMap, this)); + trilist.SetBoolSigAction(joinMap.BlueControl, b => EnableControl(trilist, joinMap, this)); + + trilist.SetUShortSigAction(joinMap.RedLed, u => SetColor(trilist, joinMap, this)); + trilist.SetUShortSigAction(joinMap.GreenLed, u => SetColor(trilist, joinMap, this)); + trilist.SetUShortSigAction(joinMap.BlueLed, u => SetColor(trilist, joinMap, this)); + + trilist.StringInput[joinMap.Name].StringValue = Name; + + IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); + RedLedEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RedControl]); + BlueLedEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.BlueControl]); + GreenLedEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.GreenControl]); + + RedLedBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.RedLed]); + BlueLedBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.BlueLed]); + GreenLedBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.GreenLed]); + } + + private static void EnableControl(BasicTriList triList, StatusSignControllerJoinMap joinMap, + StatusSignController device) + { + var redEnable = triList.BooleanOutput[joinMap.RedControl].BoolValue; + var greenEnable = triList.BooleanOutput[joinMap.GreenControl].BoolValue; + var blueEnable = triList.BooleanOutput[joinMap.BlueControl].BoolValue; + device.EnableLedControl(redEnable, greenEnable, blueEnable); + } + + private static void SetColor(BasicTriList triList, StatusSignControllerJoinMap joinMap, + StatusSignController device) + { + var redBrightness = triList.UShortOutput[joinMap.RedLed].UShortValue; + var greenBrightness = triList.UShortOutput[joinMap.GreenLed].UShortValue; + var blueBrightness = triList.UShortOutput[joinMap.BlueLed].UShortValue; + + device.SetColor(redBrightness, greenBrightness, blueBrightness); + } } } \ No newline at end of file From 33f5881e91935c7cfc100a5f7fda2e1df8c4d071 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 14 Apr 2020 16:17:11 -0600 Subject: [PATCH 034/156] Changes base class and adds LinkToApi Method --- .../Crestron IO/Relay/GenericRelayDevice.cs | 39 ++++++++++++++++++- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Relay/GenericRelayDevice.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Relay/GenericRelayDevice.cs index 4786cb2b..95d64976 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Relay/GenericRelayDevice.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Relay/GenericRelayDevice.cs @@ -4,15 +4,18 @@ using System.Linq; using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharpPro; - +using Crestron.SimplSharpPro.DeviceSupport; +using Newtonsoft.Json; using PepperDash.Core; +using PepperDash.Essentials.Core.Bridges; +using PepperDash_Essentials_Core.Devices; namespace PepperDash.Essentials.Core.CrestronIO { /// /// Represents a generic device controlled by relays /// - public class GenericRelayDevice : Device, ISwitchedOutput + public class GenericRelayDevice : EssentialsBridgeableDevice, ISwitchedOutput { public Relay RelayOutput { get; private set; } @@ -65,5 +68,37 @@ namespace PepperDash.Essentials.Core.CrestronIO } #endregion + + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + { + var joinMap = new GenericRelayControllerJoinMap(); + + var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); + + if (!string.IsNullOrEmpty(joinMapSerialized)) + joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + + joinMap.OffsetJoinNumbers(joinStart); + + if (RelayOutput == null) + { + Debug.Console(1, this, "Unable to link device '{0}'. Relay is null", Key); + return; + } + + Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); + + trilist.SetBoolSigAction(joinMap.Relay, b => + { + if (b) + CloseRelay(); + else + OpenRelay(); + }); + + // feedback for relay state + + OutputIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Relay]); + } } } \ No newline at end of file From 01bddbf2ff044c37cc51c340a18cf7561008d185 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 14 Apr 2020 16:17:30 -0600 Subject: [PATCH 035/156] Changes Base Class and implements LInkToApi Method --- .../Inputs/GenericDigitalInputDevice.cs | 33 +++++++++++++++++-- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericDigitalInputDevice.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericDigitalInputDevice.cs index 3c1849f9..7abda21e 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericDigitalInputDevice.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericDigitalInputDevice.cs @@ -4,12 +4,15 @@ using System.Linq; using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharpPro; - +using Crestron.SimplSharpPro.DeviceSupport; +using Newtonsoft.Json; using PepperDash.Core; +using PepperDash.Essentials.Core.Bridges; +using PepperDash_Essentials_Core.Devices; namespace PepperDash.Essentials.Core.CrestronIO { - public class GenericDigitalInputDevice : Device, IDigitalInput + public class GenericDigitalInputDevice : EssentialsBridgeableDevice, IDigitalInput { public DigitalInput InputPort { get; private set; } @@ -30,7 +33,7 @@ namespace PepperDash.Essentials.Core.CrestronIO InputPort = inputPort; - InputPort.StateChange += new DigitalInputEventHandler(InputPort_StateChange); + InputPort.StateChange += InputPort_StateChange; } @@ -39,5 +42,29 @@ namespace PepperDash.Essentials.Core.CrestronIO InputStateFeedback.FireUpdate(); } + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + { + var joinMap = new IDigitalInputJoinMap(); + + var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); + + if (!string.IsNullOrEmpty(joinMapSerialized)) + joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + + joinMap.OffsetJoinNumbers(joinStart); + + try + { + Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); + + // Link feedback for input state + InputStateFeedback.LinkInputSig(trilist.BooleanInput[joinMap.InputState]); + } + catch (Exception e) + { + Debug.Console(1, this, "Unable to link device '{0}'. Input is null", Key); + Debug.Console(1, this, "Error: {0}", e); + } + } } } \ No newline at end of file From 08c8cbf7fe1eda740b3bbc9f4abb2c46cdd0bb0e Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 14 Apr 2020 16:17:54 -0600 Subject: [PATCH 036/156] Changes base class and implements LinkToApi method --- .../Config/Comm and IR/GenericComm.cs | 61 +++++++++++++++++-- 1 file changed, 56 insertions(+), 5 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericComm.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericComm.cs index 45657e3e..83861dc8 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericComm.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericComm.cs @@ -2,11 +2,12 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using Crestron.SimplSharp; - +using Crestron.SimplSharp.CrestronSockets; +using Crestron.SimplSharpPro.DeviceSupport; using Newtonsoft.Json; using PepperDash.Core; +using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Devices; using PepperDash.Essentials.Core.Config; @@ -16,7 +17,7 @@ namespace PepperDash.Essentials.Core /// /// Serves as a generic wrapper class for all styles of IBasicCommuncation ports /// - public class GenericComm : ReconfigurableDevice + public class GenericComm : ReconfigurableBridgableDevice { EssentialsControlPropertiesConfig PropertiesConfig; @@ -43,7 +44,7 @@ namespace PepperDash.Essentials.Core try { PropertiesConfig = JsonConvert.DeserializeObject - (portConfig.ToString()); + (portConfig); } catch (Exception e) { @@ -57,9 +58,59 @@ namespace PepperDash.Essentials.Core ConfigWriter.UpdateDeviceConfig(config); } + + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + { + var joinMap = new IBasicCommunicationJoinMap(); + + var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); + + if (!string.IsNullOrEmpty(joinMapSerialized)) + joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + joinMap.OffsetJoinNumbers(joinStart); + + if (CommPort == null) + { + Debug.Console(1, this, "Unable to link device '{0}'. CommPort is null", Key); + return; + } + + Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); + + // this is a permanent event handler. This cannot be -= from event + CommPort.TextReceived += (s, a) => + { + Debug.Console(2, this, "RX: {0}", a.Text); + trilist.SetString(joinMap.TextReceived, a.Text); + }; + trilist.SetStringSigAction(joinMap.SendText, s => CommPort.SendText(s)); + trilist.SetStringSigAction(joinMap.SetPortConfig, SetPortConfig); + + + var sComm = this as ISocketStatus; + if (sComm == null) return; + sComm.ConnectionChange += (s, a) => + { + trilist.SetUshort(joinMap.Status, (ushort)(a.Client.ClientStatus)); + trilist.SetBool(joinMap.Connected, a.Client.ClientStatus == + SocketStatus.SOCKET_STATUS_CONNECTED); + }; + + trilist.SetBoolSigAction(joinMap.Connect, b => + { + if (b) + { + sComm.Connect(); + } + else + { + sComm.Disconnect(); + } + }); + } } - public class GenericCommFactory : Essentials.Core.EssentialsDeviceFactory + public class GenericCommFactory : EssentialsDeviceFactory { public GenericCommFactory() { From 1141ed192dc064de95ab3a508ecc5e72352bab55 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 14 Apr 2020 16:32:48 -0600 Subject: [PATCH 037/156] fixes issues with push to build repos --- .github/workflows/master.yml | 170 ++++++++++++++++++----------------- 1 file changed, 86 insertions(+), 84 deletions(-) diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index b0f3fa6e..a362ea47 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -56,11 +56,21 @@ jobs: - name: Zip Build Output shell: powershell run: ./.github/scripts/ZipBuildOutput.ps1 + # Write the version to a file to be consumed by the push jobs + - name: Write Version + run: Write-Output "$($Env:VERSION)" | Out-File -FilePath "$($Env:GITHUB_HOME)\output\version.txt" + # Upload the build output as an artifact - name: Upload Build Output uses: actions/upload-artifact@v1 with: name: Build path: ./${{ env.SOLUTION_FILE}}-${{ env.VERSION}}.zip + # Upload the Version file as an artifact + - name: Upload version.txt + uses: actions/upload-artifact@v1 + with: + name: Version + path: ${{env.GITHUB_HOME}}\output\version.txt # Upload the build package to the release - name: Upload Release Package id: upload_release @@ -72,7 +82,6 @@ jobs: asset_content_type: application/zip env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # This step always runs and pushes the build to the internal build rep Internal_Push_Output: needs: Build_Project runs-on: windows-latest @@ -102,85 +111,8 @@ jobs: Remove-Item -Path ./Version/version.txt Remove-Item -Path ./Version # Checkout/Create the branch - - name: Create new branch - run: git checkout -b $($Env:GITHUB_REF -replace "refs/heads/") - # Download the build output into the repo - - name: Download Build output - uses: actions/download-artifact@v1 - with: - name: Build - path: ./ - - name: Check directory - run: Get-ChildItem ./ - # Unzip the build package file - - name: Unzip Build file - run: | - Get-ChildItem .\*.zip | Expand-Archive -DestinationPath .\ - Remove-Item -Path .\*.zip - - name: Check directory again - run: Get-ChildItem ./ - # Copy Contents of output folder to root directory - - name: Copy Files to root & delete output directory - run: | - Remove-Item -Path .\* -Include @("*.cpz","*.md","*.cplz","*.json","*.dll","*.clz") - Get-ChildItem -Path .\output\* | Copy-Item -Destination .\ - Remove-Item -Path .\output -Recurse - # Commits the build output to the branch and tags it with the version - - name: Commit build output and tag the commit - shell: powershell - run: | - git config user.email "actions@pepperdash.com" - git config user.name "GitHub Actions" - git add . - $commit = "Build $($Env:GITHUB_RUN_NUMBER) from commit: https://github.com/$($Env:GITHUB_REPOSITORY)/commit/$($Env:GITHUB_SHA)" - Write-Host "Commit: $commit" - git commit -m $commit - git tag $($Env:VERSION) - # Push the commit - - name: Push to Builds Repo - shell: powershell - run: | - $branch = $($Env:GITHUB_REF) -replace "refs/heads/" - Write-Host "Branch: $branch" - git push -u origin $($branch) --force - # Push the tags - - name: Push tags - run: git push --tags origin - - name: Check Directory - run: Get-ChildItem ./ - # This step only runs if the branch is master or release/ runs and pushes the build to the public build repo - Public_Push_Output: - needs: Build_Project - runs-on: windows-latest - if: contains(github.ref, 'master') || contains(github.ref, 'release') - steps: - # Checkout the repo - - name: Checkout Builds Repo - uses: actions/checkout@v2 - with: - token: ${{ secrets.BUILDS_TOKEN }} - repository: PepperDash/Essentials-Builds - ref: ${{ Env.GITHUB_REF }} - # Download the version artifact from the build job - - name: Download Build Version Info - uses: actions/download-artifact@v1 - with: - name: Version - - name: Check Directory - run: Get-ChildItem "./" - # Set the version number environment variable from the file we just downloaded - - name: Set Version Number - shell: powershell - run: | - Get-ChildItem "./Version" - $version = Get-Content -Path ./Version/version.txt - Write-Host "Version: $version" - Write-Output "::set-env name=VERSION::$version" - Remove-Item -Path ./Version/version.txt - Remove-Item -Path ./Version - # Checkout/Create the branch - - name: Create new branch - run: git checkout -b $($Env:GITHUB_REF -replace "refs/heads/") + - name: Checkout Master branch + run: git checkout master # Download the build output into the repo - name: Download Build output uses: actions/download-artifact@v1 @@ -216,10 +148,80 @@ jobs: # Push the commit - name: Push to Builds Repo shell: powershell - run: | - $branch = $($Env:GITHUB_REF) -replace "refs/heads/" - Write-Host "Branch: $branch" - git push -u origin $($branch) --force + run: git push -u origin master --force + # Push the tags + - name: Push tags + run: git push --tags origin + - name: Check Directory + run: Get-ChildItem ./ + # This step only runs if the branch is master or release/ runs and pushes the build to the public build repo + Public_Push_Output: + needs: Build_Project + runs-on: windows-latest + steps: + # Checkout the repo + - name: Checkout Builds Repo + uses: actions/checkout@v2 + with: + token: ${{ secrets.BUILDS_TOKEN }} + repository: PepperDash/Essentials-Builds + ref: ${{ Env.GITHUB_REF }} + # Download the version artifact from the build job + - name: Download Build Version Info + uses: actions/download-artifact@v1 + with: + name: Version + - name: Check Directory + run: Get-ChildItem "./" + # Set the version number environment variable from the file we just downloaded + - name: Set Version Number + shell: powershell + run: | + Get-ChildItem "./Version" + $version = Get-Content -Path ./Version/version.txt + Write-Host "Version: $version" + Write-Output "::set-env name=VERSION::$version" + Remove-Item -Path ./Version/version.txt + Remove-Item -Path ./Version + # Checkout master branch + - name: Create new branch + run: git checkout master + # Download the build output into the repo + - name: Download Build output + uses: actions/download-artifact@v1 + with: + name: Build + path: ./ + - name: Check directory + run: Get-ChildItem ./ + # Unzip the build package file + - name: Unzip Build file + run: | + Get-ChildItem .\*.zip | Expand-Archive -DestinationPath .\ + Remove-Item -Path .\*.zip + - name: Check directory again + run: Get-ChildItem ./ + # Copy Contents of output folder to root directory + - name: Copy Files to root & delete output directory + run: | + Remove-Item -Path .\* -Include @("*.cpz","*.md","*.cplz","*.json","*.dll","*.clz") + Get-ChildItem -Path .\output\* | Copy-Item -Destination .\ + Remove-Item -Path .\output -Recurse + # Commits the build output to the branch and tags it with the version + - name: Commit build output and tag the commit + shell: powershell + run: | + git config user.email "actions@pepperdash.com" + git config user.name "GitHub Actions" + git add . + $commit = "Build $($Env:GITHUB_RUN_NUMBER) from commit: https://github.com/$($Env:GITHUB_REPOSITORY)/commit/$($Env:GITHUB_SHA)" + Write-Host "Commit: $commit" + git commit -m $commit + git tag $($Env:VERSION) + # Push the commit + - name: Push to Builds Repo + shell: powershell + run: git push -u origin master --force # Push the tags - name: Push tags run: git push --tags origin From b70739ac4c342a99ab8215dae7aac8c1bca9a4f8 Mon Sep 17 00:00:00 2001 From: Jason T Alborough Date: Thu, 16 Apr 2020 14:54:46 -0400 Subject: [PATCH 038/156] Adds a reference for IBridge back into PepperDash.Essentials.Bridges that inherits from PepperDash.Essentials.Core.Bridges.IBridge for legacy plugins --- PepperDashEssentials/Bridges/IBridge.cs | 16 ++++++++++++++++ PepperDashEssentials/PepperDashEssentials.csproj | 1 + 2 files changed, 17 insertions(+) create mode 100644 PepperDashEssentials/Bridges/IBridge.cs diff --git a/PepperDashEssentials/Bridges/IBridge.cs b/PepperDashEssentials/Bridges/IBridge.cs new file mode 100644 index 00000000..1b539183 --- /dev/null +++ b/PepperDashEssentials/Bridges/IBridge.cs @@ -0,0 +1,16 @@ +using System; +using Crestron.SimplSharpPro.DeviceSupport; +using PepperDash.Essentials.Core.Bridges; + +namespace PepperDash.Essentials.Bridges +{ + /// + /// Defines a device that uses the legacy JoinMapBase for its join map + /// + [Obsolete("IBridgeAdvanced should be used going forward with JoinMapBaseAdvanced")] + public interface IBridge : PepperDash.Essentials.Core.Bridges.IBridge + { + + } + +} \ No newline at end of file diff --git a/PepperDashEssentials/PepperDashEssentials.csproj b/PepperDashEssentials/PepperDashEssentials.csproj index 5b500425..c403d1c3 100644 --- a/PepperDashEssentials/PepperDashEssentials.csproj +++ b/PepperDashEssentials/PepperDashEssentials.csproj @@ -125,6 +125,7 @@ + From 717b9b272c95a39c087b7e8390c892de5e49eefd Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Thu, 16 Apr 2020 13:39:42 -0600 Subject: [PATCH 039/156] removed the added IBridge and changed... ...the namespace for IBridge in Essentials Core to match the old/existing namespace --- PepperDashEssentials/Bridges/IBridge.cs | 16 ---------------- .../Bridges/BridgeBase.cs | 1 + .../Bridges/IBridge.cs | 19 +++++++++++-------- 3 files changed, 12 insertions(+), 24 deletions(-) delete mode 100644 PepperDashEssentials/Bridges/IBridge.cs diff --git a/PepperDashEssentials/Bridges/IBridge.cs b/PepperDashEssentials/Bridges/IBridge.cs deleted file mode 100644 index 1b539183..00000000 --- a/PepperDashEssentials/Bridges/IBridge.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using Crestron.SimplSharpPro.DeviceSupport; -using PepperDash.Essentials.Core.Bridges; - -namespace PepperDash.Essentials.Bridges -{ - /// - /// Defines a device that uses the legacy JoinMapBase for its join map - /// - [Obsolete("IBridgeAdvanced should be used going forward with JoinMapBaseAdvanced")] - public interface IBridge : PepperDash.Essentials.Core.Bridges.IBridge - { - - } - -} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs index c0afb5f9..dc6f0170 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs @@ -8,6 +8,7 @@ using Newtonsoft.Json; using PepperDash.Core; using PepperDash.Essentials.Core.Config; +using PepperDash.Essentials.Bridges; //using PepperDash.Essentials.Devices.Common.Cameras; diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/IBridge.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/IBridge.cs index a4e09c8e..9731b865 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/IBridge.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/IBridge.cs @@ -2,6 +2,17 @@ using Crestron.SimplSharpPro.DeviceSupport; namespace PepperDash.Essentials.Core.Bridges +{ + /// + /// Defines a device that uses JoinMapBaseAdvanced for its join map + /// + public interface IBridgeAdvanced + { + void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge); + } +} + +namespace PepperDash.Essentials.Bridges { /// /// Defines a device that uses the legacy JoinMapBase for its join map @@ -11,12 +22,4 @@ namespace PepperDash.Essentials.Core.Bridges { void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey); } - - /// - /// Defines a device that uses JoinMapBaseAdvanced for its join map - /// - public interface IBridgeAdvanced - { - void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge); - } } \ No newline at end of file From 5329d7f931b88515b97326c256795770203ffbb8 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Thu, 16 Apr 2020 14:23:24 -0600 Subject: [PATCH 040/156] changes to EiscApi loader --- PepperDashEssentials/PepperDashEssentials.csproj | 1 - .../PepperDashEssentialsBase/Bridges/BridgeBase.cs | 9 ++++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/PepperDashEssentials/PepperDashEssentials.csproj b/PepperDashEssentials/PepperDashEssentials.csproj index c403d1c3..5b500425 100644 --- a/PepperDashEssentials/PepperDashEssentials.csproj +++ b/PepperDashEssentials/PepperDashEssentials.csproj @@ -125,7 +125,6 @@ - diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs index dc6f0170..e7e664be 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs @@ -119,11 +119,10 @@ namespace PepperDash.Essentials.Core.Bridges continue; } - if (device.GetType().GetCType().IsAssignableFrom(typeof (IBridgeAdvanced))) - { - var bridge = device as IBridgeAdvanced; - if (bridge != null) bridge.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey, this); - } + if (!device.GetType().GetCType().IsAssignableFrom(typeof (IBridgeAdvanced))) continue; + + var bridgeAdvanced = device as IBridgeAdvanced; + if (bridgeAdvanced != null) bridgeAdvanced.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey, this); //if (device is IBridge) // Check for this first to allow bridges in plugins to override existing bridges that apply to the same type. //{ From 65881be81bfcd813bbc6dfe432e2074073489e88 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Thu, 16 Apr 2020 15:33:29 -0600 Subject: [PATCH 041/156] moves a version of IBridge back to PepperDash Essentials --- PepperDashEssentials/Bridges/IBridge.cs | 12 ++++++++++++ .../PepperDashEssentialsBase/Bridges/IBridge.cs | 3 --- 2 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 PepperDashEssentials/Bridges/IBridge.cs diff --git a/PepperDashEssentials/Bridges/IBridge.cs b/PepperDashEssentials/Bridges/IBridge.cs new file mode 100644 index 00000000..a8b0a893 --- /dev/null +++ b/PepperDashEssentials/Bridges/IBridge.cs @@ -0,0 +1,12 @@ +using System; + +namespace PepperDash.Essentials.Bridges +{ + /// + /// Defines a device that uses the legacy JoinMapBase for its join map + /// + [Obsolete("IBridgeAdvanced should be used going forward with JoinMapBaseAdvanced")] + public interface IBridge: Core.Bridges.IBridge + { + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/IBridge.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/IBridge.cs index 9731b865..0a4450d0 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/IBridge.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/IBridge.cs @@ -10,10 +10,7 @@ namespace PepperDash.Essentials.Core.Bridges { void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge); } -} -namespace PepperDash.Essentials.Bridges -{ /// /// Defines a device that uses the legacy JoinMapBase for its join map /// From 20e9ab8cb97ff030652e1f0887fbcb6c725eb9bf Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Thu, 16 Apr 2020 15:33:44 -0600 Subject: [PATCH 042/156] fixes issues determining Interface type --- .../Bridges/BridgeBase.cs | 49 +++++++++++-------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs index e7e664be..a2d6d077 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs @@ -110,30 +110,37 @@ namespace PepperDash.Essentials.Core.Bridges if (device == null) continue; Debug.Console(1, this, "Linking Device: '{0}'", device.Key); - - if (device.GetType().GetCType().IsAssignableFrom(typeof (IBridge))) + if (device is IBridge) // Check for this first to allow bridges in plugins to override existing bridges that apply to the same type. { - var bridge = device as IBridge; - - if (bridge != null) bridge.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - continue; + Debug.Console(2, this, "'{0}' is IBridge", device.Key); + (device as IBridge).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); } - - if (!device.GetType().GetCType().IsAssignableFrom(typeof (IBridgeAdvanced))) continue; - - var bridgeAdvanced = device as IBridgeAdvanced; - if (bridgeAdvanced != null) bridgeAdvanced.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey, this); - - //if (device is IBridge) // Check for this first to allow bridges in plugins to override existing bridges that apply to the same type. + else if (device is IBridgeAdvanced) + { + Debug.Console(2, this, "'{0}' is IBridgeAdvanced", device.Key); + (device as IBridgeAdvanced).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey, this); + } + //if (device.GetType().GetCType().IsAssignableFrom(typeof (IBridge))) //{ - // (device as IBridge).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + // var bridge = device as IBridge; + + // if (bridge == null) + // continue; + // Debug.Console(2, this, "Linking device {0} as IBridge"); + // bridge.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); // continue; //} - //else if (device is IBridgeAdvanced) - //{ - // Debug.Console(2, this, "'{0}' is IBridgeAdvanced", device.Key); - // (device as IBridgeAdvanced).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey, this); - //} + + //if (!device.GetType().GetCType().IsAssignableFrom(typeof (IBridgeAdvanced))) continue; + + //var bridgeAdvanced = device as IBridgeAdvanced; + + //if (bridgeAdvanced == null) continue; + //Debug.Console(2, this, "Linking device {0} as IBridgeAdvanced"); + //bridgeAdvanced.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey, this); + } + Debug.Console(1, this, "Devices Linked."); + // //else if (device is PepperDash.Essentials.Core.Monitoring.SystemMonitorController) //{ // (device as PepperDash.Essentials.Core.Monitoring.SystemMonitorController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); @@ -234,9 +241,9 @@ namespace PepperDash.Essentials.Core.Bridges // (device as C2nRthsController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); // continue; //} - } + //} - Debug.Console(1, this, "Devices Linked."); + }); } From be074b572247ae085884cd209e5cef4b79375422 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Thu, 16 Apr 2020 15:52:48 -0600 Subject: [PATCH 043/156] adds iBridge.cs --- PepperDashEssentials/PepperDashEssentials.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/PepperDashEssentials/PepperDashEssentials.csproj b/PepperDashEssentials/PepperDashEssentials.csproj index 5b500425..c403d1c3 100644 --- a/PepperDashEssentials/PepperDashEssentials.csproj +++ b/PepperDashEssentials/PepperDashEssentials.csproj @@ -125,6 +125,7 @@ + From 31418fd469652ba5cec3555e166f8737531b729a Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Thu, 16 Apr 2020 16:16:19 -0600 Subject: [PATCH 044/156] removes bad namespace --- .../PepperDashEssentialsBase/Bridges/BridgeBase.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs index a2d6d077..330cb9fb 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs @@ -8,7 +8,6 @@ using Newtonsoft.Json; using PepperDash.Core; using PepperDash.Essentials.Core.Config; -using PepperDash.Essentials.Bridges; //using PepperDash.Essentials.Devices.Common.Cameras; From 827315c3ccff1774b9a3d2bd8a3ec782cea9e5fc Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Fri, 17 Apr 2020 09:31:55 -0600 Subject: [PATCH 045/156] fixes namespace for EssentialsBridgeableDevice --- .../Devices/EssentialsBridgeableDevice.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/EssentialsBridgeableDevice.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/EssentialsBridgeableDevice.cs index 36c5c692..a4c4ca10 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/EssentialsBridgeableDevice.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/EssentialsBridgeableDevice.cs @@ -1,8 +1,7 @@ using Crestron.SimplSharpPro.DeviceSupport; -using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Bridges; -namespace PepperDash_Essentials_Core.Devices +namespace PepperDash.Essentials.Core { public abstract class EssentialsBridgeableDevice:EssentialsDevice, IBridgeAdvanced { From 54d31e128e6c31a59c89b74e3d56f5e7f8cbc78c Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Fri, 17 Apr 2020 10:09:53 -0600 Subject: [PATCH 046/156] removing bad namespace --- .../Crestron IO/Inputs/GenericDigitalInputDevice.cs | 1 - .../Crestron IO/Relay/GenericRelayDevice.cs | 1 - .../Crestron/CrestronGenericBaseDevice.cs | 1 - .../PepperDashEssentialsBase/Display/DisplayBase.cs | 1 - .../PepperDashEssentialsBase/Lighting/LightingBase.cs | 1 - .../Monitoring/SystemMonitorController.cs | 1 - .../Essentials_DM/Chassis/DmpsAudioOutputController.cs | 2 +- .../Essentials_DM/Chassis/DmpsRoutingController.cs | 2 +- .../Essentials Devices Common/Cameras/CameraBase.cs | 1 - .../Power Controllers/Digitallogger.cs | 1 - .../Essentials Devices Common/SetTopBox/IRSetTopBoxBase.cs | 1 - .../Essentials Devices Common/Streaming/AppleTV.cs | 1 - 12 files changed, 2 insertions(+), 12 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericDigitalInputDevice.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericDigitalInputDevice.cs index 7abda21e..feefeaf5 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericDigitalInputDevice.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericDigitalInputDevice.cs @@ -8,7 +8,6 @@ using Crestron.SimplSharpPro.DeviceSupport; using Newtonsoft.Json; using PepperDash.Core; using PepperDash.Essentials.Core.Bridges; -using PepperDash_Essentials_Core.Devices; namespace PepperDash.Essentials.Core.CrestronIO { diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Relay/GenericRelayDevice.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Relay/GenericRelayDevice.cs index 95d64976..9db3443e 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Relay/GenericRelayDevice.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Relay/GenericRelayDevice.cs @@ -8,7 +8,6 @@ using Crestron.SimplSharpPro.DeviceSupport; using Newtonsoft.Json; using PepperDash.Core; using PepperDash.Essentials.Core.Bridges; -using PepperDash_Essentials_Core.Devices; namespace PepperDash.Essentials.Core.CrestronIO { diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron/CrestronGenericBaseDevice.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron/CrestronGenericBaseDevice.cs index 0dbba8c4..d074a2d4 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron/CrestronGenericBaseDevice.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron/CrestronGenericBaseDevice.cs @@ -3,7 +3,6 @@ using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.DeviceSupport; using PepperDash.Core; using PepperDash.Essentials.Core.Bridges; -using PepperDash_Essentials_Core.Devices; namespace PepperDash.Essentials.Core { diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs index 4e5a177c..26fbb2b6 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs @@ -11,7 +11,6 @@ using Crestron.SimplSharpPro.DM.Endpoints.Transmitters; using Newtonsoft.Json; using PepperDash.Core; using PepperDash.Essentials.Core.Bridges; -using PepperDash_Essentials_Core.Devices; namespace PepperDash.Essentials.Core diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Lighting/LightingBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Lighting/LightingBase.cs index 0d8d8f6f..dafe0518 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Lighting/LightingBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Lighting/LightingBase.cs @@ -8,7 +8,6 @@ using Crestron.SimplSharpPro.DeviceSupport; using Newtonsoft.Json; using PepperDash.Core; using PepperDash.Essentials.Core.Bridges; -using PepperDash_Essentials_Core.Devices; namespace PepperDash.Essentials.Core.Lighting { diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Monitoring/SystemMonitorController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Monitoring/SystemMonitorController.cs index 7ede2a52..2ad8c1b5 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Monitoring/SystemMonitorController.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Monitoring/SystemMonitorController.cs @@ -7,7 +7,6 @@ using PepperDash.Core; using Newtonsoft.Json; using Newtonsoft.Json.Converters; using PepperDash.Essentials.Core.Bridges; -using PepperDash_Essentials_Core.Devices; namespace PepperDash.Essentials.Core.Monitoring { diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsAudioOutputController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsAudioOutputController.cs index 45e1d0ee..939cb0dc 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsAudioOutputController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsAudioOutputController.cs @@ -12,7 +12,7 @@ using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.DM.Config; -using PepperDash_Essentials_Core.Devices; + namespace PepperDash.Essentials.DM { diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs index c9b545c9..499474ac 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs @@ -14,7 +14,7 @@ using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.DM.Config; -using PepperDash_Essentials_Core.Devices; + using Feedback = PepperDash.Essentials.Core.Feedback; namespace PepperDash.Essentials.DM diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Cameras/CameraBase.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Cameras/CameraBase.cs index 24fe2c77..c32bef7d 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Cameras/CameraBase.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Cameras/CameraBase.cs @@ -13,7 +13,6 @@ using PepperDash.Essentials.Core.Presets; using PepperDash.Essentials.Devices.Common.Codec; using Newtonsoft.Json; -using PepperDash_Essentials_Core.Devices; namespace PepperDash.Essentials.Devices.Common.Cameras { diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Power Controllers/Digitallogger.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Power Controllers/Digitallogger.cs index ce9536ef..e6ab1fc3 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Power Controllers/Digitallogger.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Power Controllers/Digitallogger.cs @@ -11,7 +11,6 @@ using Crestron.SimplSharp.Net.Http; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using PepperDash.Essentials.Core.Bridges; -using PepperDash_Essentials_Core.Devices; namespace PepperDash.Essentials.Devices.Common diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/SetTopBox/IRSetTopBoxBase.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/SetTopBox/IRSetTopBoxBase.cs index 5e25fce9..10435180 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/SetTopBox/IRSetTopBoxBase.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/SetTopBox/IRSetTopBoxBase.cs @@ -11,7 +11,6 @@ using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Presets; using PepperDash.Essentials.Core.Routing; -using PepperDash_Essentials_Core.Devices; namespace PepperDash.Essentials.Devices.Common { diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Streaming/AppleTV.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Streaming/AppleTV.cs index 83d2073b..4d17c089 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Streaming/AppleTV.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Streaming/AppleTV.cs @@ -10,7 +10,6 @@ using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Routing; -using PepperDash_Essentials_Core.Devices; namespace PepperDash.Essentials.Devices.Common { From e52b367ef0ed2a9329fefb46d83224f7fd72097b Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 20 Apr 2020 09:31:43 -0600 Subject: [PATCH 047/156] copys join maps back to Essentials... ...to maintain backwards compatability --- .../JoinMaps/AirMediaControllerJoinMap.cs | 110 ++++++++ .../JoinMaps/CameraControllerJoinMap.cs | 64 +++++ .../Bridges/JoinMaps/DigitalLoggerJoinMap.cs | 48 ++++ .../JoinMaps/DisplayControllerJoinMap.cs | 117 +++++++++ .../DmBladeChassisControllerJoinMap.cs | 109 ++++++++ .../JoinMaps/DmChassisControllerJoinMap.cs | 151 +++++++++++ .../JoinMaps/DmRmcControllerJoinMap.cs | 67 +++++ .../Bridges/JoinMaps/DmTxControllerJoinMap.cs | 98 ++++++++ .../DmpsAudioOutputControllerJoinMap.cs | 69 +++++ .../JoinMaps/DmpsRoutingControllerJoinMap.cs | 127 ++++++++++ .../JoinMaps/GenericLightingJoinMap.cs | 41 +++ .../JoinMaps/GenericRelayControllerJoinMap.cs | 31 +++ .../JoinMaps/GlsOccupancySensorBaseJoinMap.cs | 238 ++++++++++++++++++ .../JoinMaps/HdMdxxxCEControllerJoinMap.cs | 119 +++++++++ .../JoinMaps/IBasicCommunicationJoinMap.cs | 67 +++++ .../Bridges/JoinMaps/IDigitalInputJoinMap.cs | 31 +++ .../JoinMaps/SetTopBoxControllerJoinMap.cs | 212 ++++++++++++++++ .../JoinMaps/StatusSignControllerJoinMap.cs | 49 ++++ .../Bridges/JoinMaps/SystemMonitorJoinMap.cs | 225 +++++++++++++++++ .../PepperDashEssentials.csproj | 22 ++ 20 files changed, 1995 insertions(+) create mode 100644 PepperDashEssentials/Bridges/JoinMaps/AirMediaControllerJoinMap.cs create mode 100644 PepperDashEssentials/Bridges/JoinMaps/CameraControllerJoinMap.cs create mode 100644 PepperDashEssentials/Bridges/JoinMaps/DigitalLoggerJoinMap.cs create mode 100644 PepperDashEssentials/Bridges/JoinMaps/DisplayControllerJoinMap.cs create mode 100644 PepperDashEssentials/Bridges/JoinMaps/DmBladeChassisControllerJoinMap.cs create mode 100644 PepperDashEssentials/Bridges/JoinMaps/DmChassisControllerJoinMap.cs create mode 100644 PepperDashEssentials/Bridges/JoinMaps/DmRmcControllerJoinMap.cs create mode 100644 PepperDashEssentials/Bridges/JoinMaps/DmTxControllerJoinMap.cs create mode 100644 PepperDashEssentials/Bridges/JoinMaps/DmpsAudioOutputControllerJoinMap.cs create mode 100644 PepperDashEssentials/Bridges/JoinMaps/DmpsRoutingControllerJoinMap.cs create mode 100644 PepperDashEssentials/Bridges/JoinMaps/GenericLightingJoinMap.cs create mode 100644 PepperDashEssentials/Bridges/JoinMaps/GenericRelayControllerJoinMap.cs create mode 100644 PepperDashEssentials/Bridges/JoinMaps/GlsOccupancySensorBaseJoinMap.cs create mode 100644 PepperDashEssentials/Bridges/JoinMaps/HdMdxxxCEControllerJoinMap.cs create mode 100644 PepperDashEssentials/Bridges/JoinMaps/IBasicCommunicationJoinMap.cs create mode 100644 PepperDashEssentials/Bridges/JoinMaps/IDigitalInputJoinMap.cs create mode 100644 PepperDashEssentials/Bridges/JoinMaps/SetTopBoxControllerJoinMap.cs create mode 100644 PepperDashEssentials/Bridges/JoinMaps/StatusSignControllerJoinMap.cs create mode 100644 PepperDashEssentials/Bridges/JoinMaps/SystemMonitorJoinMap.cs diff --git a/PepperDashEssentials/Bridges/JoinMaps/AirMediaControllerJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/AirMediaControllerJoinMap.cs new file mode 100644 index 00000000..042a3bf3 --- /dev/null +++ b/PepperDashEssentials/Bridges/JoinMaps/AirMediaControllerJoinMap.cs @@ -0,0 +1,110 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Bridges +{ + public class AirMediaControllerJoinMap : JoinMapBase + { + #region Digitals + /// + /// Indicates that the device is online when high + /// + public uint IsOnline { get; set; } + /// + /// Indicates that the device is in session when high + /// + public uint IsInSession { get; set; } + /// + /// Indicates sync detected on HDMI input when high + /// + public uint HdmiVideoSync { get; set; } + /// + /// Set High to enable automatic input routing and low to disable. Feedback high when enabled + /// + public uint AutomaticInputRoutingEnabled { get; set; } + #endregion + + #region Analogs + /// + /// Selects source and provides feedback + /// + public uint VideoOut { get; set; } + /// + /// Provided error feedback + /// + public uint ErrorFB { get; set; } + /// + /// Indicates the number of connected users as feedback + /// + public uint NumberOfUsersConnectedFB { get; set; } + /// + /// Sets the login code and provides the current code as feedback + /// + public uint LoginCode { get; set; } + #endregion + + #region Serials + /// + /// Provides the name defined in config as feedback + /// + public uint Name { get; set; } + /// + /// Provides the connection address as feedback + /// + public uint ConnectionAddressFB { get; set; } + /// + /// Provides the hostname as feedback + /// + public uint HostnameFB { get; set; } + /// + /// Provides the serial number as feedback + /// + public uint SerialNumberFeedback { get; set; } + #endregion + + public AirMediaControllerJoinMap() + { + // Digital + IsOnline = 1; + IsInSession = 2; + HdmiVideoSync = 3; + AutomaticInputRoutingEnabled = 4; + + // Analog + VideoOut = 1; + ErrorFB = 2; + NumberOfUsersConnectedFB = 3; + LoginCode = 4; + + // Serial + Name = 1; + ConnectionAddressFB = 2; + HostnameFB = 3; + SerialNumberFeedback = 4; + } + + public override void OffsetJoinNumbers(uint joinStart) + { + var joinOffset = joinStart - 1; + + IsOnline = IsOnline + joinOffset; + IsInSession = IsInSession + joinOffset; + HdmiVideoSync = HdmiVideoSync + joinOffset; + AutomaticInputRoutingEnabled = AutomaticInputRoutingEnabled + joinOffset; + + VideoOut = VideoOut + joinOffset; + ErrorFB = ErrorFB + joinOffset; + NumberOfUsersConnectedFB = NumberOfUsersConnectedFB + joinOffset; + LoginCode = LoginCode + joinOffset; + + Name = Name + joinOffset; + ConnectionAddressFB = ConnectionAddressFB + joinOffset; + HostnameFB = HostnameFB + joinOffset; + SerialNumberFeedback = SerialNumberFeedback + joinOffset; + } + } +} \ No newline at end of file diff --git a/PepperDashEssentials/Bridges/JoinMaps/CameraControllerJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/CameraControllerJoinMap.cs new file mode 100644 index 00000000..5a37892f --- /dev/null +++ b/PepperDashEssentials/Bridges/JoinMaps/CameraControllerJoinMap.cs @@ -0,0 +1,64 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; + +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Bridges +{ + /// + /// Join map for CameraBase devices + /// + public class CameraControllerJoinMap : JoinMapBaseAdvanced + { + [JoinName("TiltUp")] + public JoinDataComplete TiltUp = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, new JoinMetadata() { Label = "Tilt Up", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + [JoinName("TiltDown")] + public JoinDataComplete TiltDown = new JoinDataComplete(new JoinData() { JoinNumber = 2, JoinSpan = 1 }, new JoinMetadata() { Label = "Tilt Down", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + [JoinName("PanLeft")] + public JoinDataComplete PanLeft = new JoinDataComplete(new JoinData() { JoinNumber = 3, JoinSpan = 1 }, new JoinMetadata() { Label = "Pan Left", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + [JoinName("PanRight")] + public JoinDataComplete PanRight = new JoinDataComplete(new JoinData() { JoinNumber = 4, JoinSpan = 1 }, new JoinMetadata() { Label = "Pan Right", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + [JoinName("ZoomIn")] + public JoinDataComplete ZoomIn = new JoinDataComplete(new JoinData() { JoinNumber = 5, JoinSpan = 1 }, new JoinMetadata() { Label = "Zoom In", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + [JoinName("ZoomOut")] + public JoinDataComplete ZoomOut = new JoinDataComplete(new JoinData() { JoinNumber = 6, JoinSpan = 1 }, new JoinMetadata() { Label = "Zoom Out", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("IsOnline")] + public JoinDataComplete IsOnline = new JoinDataComplete(new JoinData() { JoinNumber = 9, JoinSpan = 1 }, new JoinMetadata() { Label = "Is Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + [JoinName("PowerOn")] + public JoinDataComplete PowerOn = new JoinDataComplete(new JoinData() { JoinNumber = 7, JoinSpan = 1 }, new JoinMetadata() { Label = "Power On", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + [JoinName("PowerOff")] + public JoinDataComplete PowerOff = new JoinDataComplete(new JoinData() { JoinNumber = 8, JoinSpan = 1 }, new JoinMetadata() { Label = "Power Off", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("NumberOfPresets")] + public JoinDataComplete NumberOfPresets = new JoinDataComplete(new JoinData() { JoinNumber = 11, JoinSpan = 1 }, new JoinMetadata() { Label = "Tells Essentials the number of defined presets", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Analog }); + [JoinName("PresetRecallStart")] + public JoinDataComplete PresetRecallStart = new JoinDataComplete(new JoinData() { JoinNumber = 11, JoinSpan = 20 }, new JoinMetadata() { Label = "Preset Recall Start", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + [JoinName("PresetLabelStart")] + public JoinDataComplete PresetLabelStart = new JoinDataComplete(new JoinData() { JoinNumber = 11, JoinSpan = 20 }, new JoinMetadata() { Label = "Preset Label Start", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Serial }); + [JoinName("PresetSaveStart")] + public JoinDataComplete PresetSaveStart = new JoinDataComplete(new JoinData() { JoinNumber = 31, JoinSpan = 20 }, new JoinMetadata() { Label = "Preset Save Start", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("CameraModeAuto")] + public JoinDataComplete CameraModeAuto = new JoinDataComplete(new JoinData() { JoinNumber = 51, JoinSpan = 1 }, new JoinMetadata() { Label = "Camera Mode Auto", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + [JoinName("CameraModeManual")] + public JoinDataComplete CameraModeManual = new JoinDataComplete(new JoinData() { JoinNumber = 52, JoinSpan = 1 }, new JoinMetadata() { Label = "Camera Mode Manual", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + [JoinName("CameraModeOff")] + public JoinDataComplete CameraModeOff = new JoinDataComplete(new JoinData() { JoinNumber = 53, JoinSpan = 1 }, new JoinMetadata() { Label = "Camera Mode Off", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("SupportsCameraModeAuto")] + public JoinDataComplete SupportsCameraModeAuto = new JoinDataComplete(new JoinData() { JoinNumber = 55, JoinSpan = 1 }, new JoinMetadata() { Label = "Supports Camera Mode Auto", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + [JoinName("SupportsCameraModeOff")] + public JoinDataComplete SupportsCameraModeOff = new JoinDataComplete(new JoinData() { JoinNumber = 56, JoinSpan = 1 }, new JoinMetadata() { Label = "Supports Camera Mode Off", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + [JoinName("SupportsPresets")] + public JoinDataComplete SupportsPresets = new JoinDataComplete(new JoinData() { JoinNumber = 57, JoinSpan = 1 }, new JoinMetadata() { Label = "Supports Presets", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + public CameraControllerJoinMap(uint joinStart) + : base(joinStart, typeof(CameraControllerJoinMap)) + { + } + } +} \ No newline at end of file diff --git a/PepperDashEssentials/Bridges/JoinMaps/DigitalLoggerJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/DigitalLoggerJoinMap.cs new file mode 100644 index 00000000..2b0a1c15 --- /dev/null +++ b/PepperDashEssentials/Bridges/JoinMaps/DigitalLoggerJoinMap.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; + +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Bridges +{ + public class DigitalLoggerJoinMap : JoinMapBase + { + public uint IsOnline { get; set; } + public uint CircuitNames { get; set; } + public uint CircuitState { get; set; } + public uint CircuitCycle { get; set; } + public uint CircuitIsCritical { get; set; } + public uint CircuitOnCmd { get; set; } + public uint CircuitOffCmd { get; set; } + + public DigitalLoggerJoinMap() + { + // Digital + IsOnline = 9; + CircuitState = 0; + CircuitCycle = 0; + CircuitIsCritical = 10; + CircuitOnCmd = 10; + CircuitOffCmd = 20; + // Serial + CircuitNames = 0; + // Analog + } + + public override void OffsetJoinNumbers(uint joinStart) + { + var joinOffset = joinStart - 1; + + IsOnline = IsOnline + joinOffset; + CircuitNames = CircuitNames + joinOffset; + CircuitState = CircuitState + joinOffset; + CircuitCycle = CircuitCycle + joinOffset; + CircuitIsCritical = CircuitIsCritical + joinOffset; + CircuitOnCmd = CircuitOnCmd + joinOffset; + CircuitOffCmd = CircuitOffCmd + joinOffset; + } + } +} \ No newline at end of file diff --git a/PepperDashEssentials/Bridges/JoinMaps/DisplayControllerJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/DisplayControllerJoinMap.cs new file mode 100644 index 00000000..ddbec182 --- /dev/null +++ b/PepperDashEssentials/Bridges/JoinMaps/DisplayControllerJoinMap.cs @@ -0,0 +1,117 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Bridges +{ + public class DisplayControllerJoinMap : JoinMapBase + { + #region Digitals + /// + /// Turns the display off and reports power off feedback + /// + public uint PowerOff { get; set; } + /// + /// Turns the display on and repots power on feedback + /// + public uint PowerOn { get; set; } + /// + /// Indicates that the display device supports two way communication when high + /// + public uint IsTwoWayDisplay { get; set; } + /// + /// Increments the volume while high + /// + public uint VolumeUp { get; set; } + /// + /// Decrements teh volume while high + /// + public uint VolumeDown { get; set; } + /// + /// Toggles the mute state. Feedback is high when volume is muted + /// + public uint VolumeMute { get; set; } + /// + /// Range of digital joins to select inputs and report current input as feedback + /// + public uint InputSelectOffset { get; set; } + /// + /// Range of digital joins to report visibility for input buttons + /// + public uint ButtonVisibilityOffset { get; set; } + /// + /// High if the device is online + /// + public uint IsOnline { get; set; } + #endregion + + #region Analogs + /// + /// Analog join to set the input and report current input as feedback + /// + public uint InputSelect { get; set; } + /// + /// Sets the volume level and reports the current level as feedback + /// + public uint VolumeLevel { get; set; } + #endregion + + #region Serials + /// + /// Reports the name of the display as defined in config as feedback + /// + public uint Name { get; set; } + /// + /// Range of serial joins that reports the names of the inputs as feedback + /// + public uint InputNamesOffset { get; set; } + #endregion + + public DisplayControllerJoinMap() + { + // Digital + IsOnline = 50; + PowerOff = 1; + PowerOn = 2; + IsTwoWayDisplay = 3; + VolumeUp = 5; + VolumeDown = 6; + VolumeMute = 7; + + ButtonVisibilityOffset = 40; + InputSelectOffset = 10; + + // Analog + InputSelect = 11; + VolumeLevel = 5; + + // Serial + Name = 1; + InputNamesOffset = 10; + } + + public override void OffsetJoinNumbers(uint joinStart) + { + var joinOffset = joinStart - 1; + + IsOnline = IsOnline + joinOffset; + PowerOff = PowerOff + joinOffset; + PowerOn = PowerOn + joinOffset; + IsTwoWayDisplay = IsTwoWayDisplay + joinOffset; + ButtonVisibilityOffset = ButtonVisibilityOffset + joinOffset; + Name = Name + joinOffset; + InputNamesOffset = InputNamesOffset + joinOffset; + InputSelectOffset = InputSelectOffset + joinOffset; + + InputSelect = InputSelect + joinOffset; + + VolumeUp = VolumeUp + joinOffset; + VolumeDown = VolumeDown + joinOffset; + VolumeMute = VolumeMute + joinOffset; + VolumeLevel = VolumeLevel + joinOffset; + } + } +} \ No newline at end of file diff --git a/PepperDashEssentials/Bridges/JoinMaps/DmBladeChassisControllerJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/DmBladeChassisControllerJoinMap.cs new file mode 100644 index 00000000..8a245ad2 --- /dev/null +++ b/PepperDashEssentials/Bridges/JoinMaps/DmBladeChassisControllerJoinMap.cs @@ -0,0 +1,109 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Bridges { + public class DmBladeChassisControllerJoinMap : JoinMapBase { + #region Digital/Analogs + #endregion + + #region Digitals + /// + /// High when device is online + /// + public uint IsOnline { get; set; } + /// + /// Range reports video sync feedback for each input + /// + public uint VideoSyncStatus { get; set; } + /// + /// Range reports high if corresponding input's endpoint is online + /// + public uint InputEndpointOnline { get; set; } + /// + /// Range reports high if corresponding output's endpoint is online + /// + public uint OutputEndpointOnline { get; set; } + /// + /// Range reports high if corresponding input's transmitter supports bridging as a separate device for detailed AV switching, HDCP control, etc. + /// + public uint TxAdvancedIsPresent { get; set; } // indicates that there is an attached transmitter that should be bridged to be interacted with + #endregion + + #region Analogs + /// + /// Range sets and reports the current video source for the corresponding output + /// + public uint OutputVideo { get; set; } + /// + /// Range sets and reports the current HDCP state for the corresponding input card + /// + public uint HdcpSupportState { get; set; } + /// + /// Range reports the highest supported HDCP state level for the corresponding input card + /// + public uint HdcpSupportCapability { get; set; } + #endregion + + #region Serials + /// + /// Range sets and reports the name for the corresponding input card + /// + public uint InputNames { get; set; } + /// + /// Range sets and reports the name for the corresponding output card + /// + public uint OutputNames { get; set; } + /// + /// Range reports the name of the current video source for the corresponding output card + /// + public uint OutputCurrentVideoInputNames { get; set; } + /// + /// Range reports the current input resolution for each corresponding input card + /// + public uint InputCurrentResolution { get; set; } + #endregion + + public DmBladeChassisControllerJoinMap() { + //Digital/Analog + + //Digital + IsOnline = 11; + VideoSyncStatus = 100; //101-299 + InputEndpointOnline = 500; //501-699 + OutputEndpointOnline = 700; //701-899 + TxAdvancedIsPresent = 1000; //1001-1199 + + //Analog + OutputVideo = 100; //101-299 + HdcpSupportState = 1000; //1001-1199 + HdcpSupportCapability = 1200; //1201-1399 + + + //Serial + InputNames = 100; //101-299 + OutputNames = 300; //301-499 + OutputCurrentVideoInputNames = 2000; //2001-2199 + InputCurrentResolution = 2400; // 2401-2599 + } + + public override void OffsetJoinNumbers(uint joinStart) { + var joinOffset = joinStart - 1; + + IsOnline = IsOnline + joinOffset; + OutputVideo = OutputVideo + joinOffset; + VideoSyncStatus = VideoSyncStatus + joinOffset; + InputNames = InputNames + joinOffset; + OutputNames = OutputNames + joinOffset; + OutputCurrentVideoInputNames = OutputCurrentVideoInputNames + joinOffset; + InputCurrentResolution = InputCurrentResolution + joinOffset; + InputEndpointOnline = InputEndpointOnline + joinOffset; + OutputEndpointOnline = OutputEndpointOnline + joinOffset; + HdcpSupportState = HdcpSupportState + joinOffset; + HdcpSupportCapability = HdcpSupportCapability + joinOffset; + } + } +} diff --git a/PepperDashEssentials/Bridges/JoinMaps/DmChassisControllerJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/DmChassisControllerJoinMap.cs new file mode 100644 index 00000000..ff6a42d9 --- /dev/null +++ b/PepperDashEssentials/Bridges/JoinMaps/DmChassisControllerJoinMap.cs @@ -0,0 +1,151 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Bridges +{ + public class DmChassisControllerJoinMap : JoinMapBase + { +#region Digital/Analogs + /// + /// Analog input sets System ID, output reports current ID as feedback. + /// Digital input applies System ID, output is high when applying busy. + /// + public uint SystemId { get; set; } +#endregion + +#region Digitals + /// + /// High when device is online + /// + public uint IsOnline { get; set; } + /// + /// Range reports video sync feedback for each input + /// + public uint VideoSyncStatus { get; set; } + /// + /// Range reports high if corresponding input's endpoint is online + /// + public uint InputEndpointOnline { get; set; } + /// + /// Range reports high if corresponding output's endpoint is online + /// + public uint OutputEndpointOnline { get; set; } + /// + /// Range reports high if corresponding input's transmitter supports bridging as a separate device for detailed AV switching, HDCP control, etc. + /// + public uint TxAdvancedIsPresent { get; set; } // indicates that there is an attached transmitter that should be bridged to be interacted with + /// + /// Range reports high if corresponding output is disabled by HDCP. + /// + public uint OutputDisabledByHdcp { get; set; } // indicates that there is an attached transmitter that should be bridged to be interacted with +#endregion + +#region Analogs + /// + /// Range sets and reports the current video source for the corresponding output + /// + public uint OutputVideo { get; set; } + /// + /// Range sets and reports the current audio source for the corresponding output + /// + public uint OutputAudio { get; set; } + /// + /// Range sets and reports the current Usb source for the corresponding output + /// + public uint OutputUsb { get; set; } + /// + /// Range sets and reports the current Usb source for the corresponding input + /// + public uint InputUsb { get; set; } + /// + /// Range sets and reports the current HDCP state for the corresponding input card + /// + public uint HdcpSupportState { get; set; } + /// + /// Range reports the highest supported HDCP state level for the corresponding input card + /// + public uint HdcpSupportCapability { get; set; } +#endregion + +#region Serials + /// + /// Range sets and reports the name for the corresponding input card + /// + public uint InputNames { get; set; } + /// + /// Range sets and reports the name for the corresponding output card + /// + public uint OutputNames { get; set; } + /// + /// Range reports the name of the current video source for the corresponding output card + /// + public uint OutputCurrentVideoInputNames { get; set; } + /// + /// Range reports the name of the current audio source for the corresponding output card + /// + public uint OutputCurrentAudioInputNames { get; set; } + /// + /// Range reports the current input resolution for each corresponding input card + /// + public uint InputCurrentResolution { get; set; } +#endregion + + public DmChassisControllerJoinMap() + { + //Digital/Analog + SystemId = 10; // Analog sets/gets SystemId, digital input applies and provides feedback of ID change busy + + //Digital + IsOnline = 11; + VideoSyncStatus = 100; //101-299 + InputEndpointOnline = 500; //501-699 + OutputEndpointOnline = 700; //701-899 + TxAdvancedIsPresent = 1000; //1001-1199 + OutputDisabledByHdcp = 1200; //1201-1399 + + //Analog + OutputVideo = 100; //101-299 + OutputAudio = 300; //301-499 + OutputUsb = 500; //501-699 + InputUsb = 700; //701-899 + HdcpSupportState = 1000; //1001-1199 + HdcpSupportCapability = 1200; //1201-1399 + + + //Serial + InputNames = 100; //101-299 + OutputNames = 300; //301-499 + OutputCurrentVideoInputNames = 2000; //2001-2199 + OutputCurrentAudioInputNames = 2200; //2201-2399 + InputCurrentResolution = 2400; // 2401-2599 + } + + public override void OffsetJoinNumbers(uint joinStart) + { + var joinOffset = joinStart - 1; + + SystemId = SystemId + joinOffset; + IsOnline = IsOnline + joinOffset; + OutputVideo = OutputVideo + joinOffset; + OutputAudio = OutputAudio + joinOffset; + OutputUsb = OutputUsb + joinOffset; + InputUsb = InputUsb + joinOffset; + VideoSyncStatus = VideoSyncStatus + joinOffset; + InputNames = InputNames + joinOffset; + OutputNames = OutputNames + joinOffset; + OutputCurrentVideoInputNames = OutputCurrentVideoInputNames + joinOffset; + OutputCurrentAudioInputNames = OutputCurrentAudioInputNames + joinOffset; + InputCurrentResolution = InputCurrentResolution + joinOffset; + InputEndpointOnline = InputEndpointOnline + joinOffset; + OutputEndpointOnline = OutputEndpointOnline + joinOffset; + HdcpSupportState = HdcpSupportState + joinOffset; + HdcpSupportCapability = HdcpSupportCapability + joinOffset; + OutputDisabledByHdcp = OutputDisabledByHdcp + joinOffset; + TxAdvancedIsPresent = TxAdvancedIsPresent + joinOffset; + } + } +} diff --git a/PepperDashEssentials/Bridges/JoinMaps/DmRmcControllerJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/DmRmcControllerJoinMap.cs new file mode 100644 index 00000000..7aa8081a --- /dev/null +++ b/PepperDashEssentials/Bridges/JoinMaps/DmRmcControllerJoinMap.cs @@ -0,0 +1,67 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Bridges +{ + public class DmRmcControllerJoinMap : JoinMapBase + { + #region Digitals + /// + /// High when device is online (if not attached to a DMP3 or DM chassis with a CPU3 card + /// + public uint IsOnline { get; set; } + #endregion + + #region Serials + /// + /// Reports the current output resolution + /// + public uint CurrentOutputResolution { get; set; } + /// + /// Reports the EDID manufacturer value + /// + public uint EdidManufacturer { get; set; } + /// + /// Reports the EDID Name value + /// + public uint EdidName { get; set; } + /// + /// Reports the EDID preffered timing value + /// + public uint EdidPrefferedTiming { get; set; } + /// + /// Reports the EDID serial number value + /// + public uint EdidSerialNumber { get; set; } + #endregion + + public DmRmcControllerJoinMap() + { + // Digital + IsOnline = 1; + + // Serial + CurrentOutputResolution = 1; + EdidManufacturer = 2; + EdidName = 3; + EdidPrefferedTiming = 4; + EdidSerialNumber = 5; + } + + public override void OffsetJoinNumbers(uint joinStart) + { + var joinOffset = joinStart - 1; + + IsOnline = IsOnline + joinOffset; + CurrentOutputResolution = CurrentOutputResolution + joinOffset; + EdidManufacturer = EdidManufacturer + joinOffset; + EdidName = EdidName + joinOffset; + EdidPrefferedTiming = EdidPrefferedTiming + joinOffset; + EdidSerialNumber = EdidSerialNumber + joinOffset; + } + } +} \ No newline at end of file diff --git a/PepperDashEssentials/Bridges/JoinMaps/DmTxControllerJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/DmTxControllerJoinMap.cs new file mode 100644 index 00000000..6d5c2775 --- /dev/null +++ b/PepperDashEssentials/Bridges/JoinMaps/DmTxControllerJoinMap.cs @@ -0,0 +1,98 @@ +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Bridges +{ + public class DmTxControllerJoinMap : JoinMapBase + { + #region Digitals + /// + /// High when device is online (if not attached to a DMP3 or DM chassis with a CPU3 card + /// + public uint IsOnline { get; set; } + /// + /// High when video sync is detected + /// + public uint VideoSyncStatus { get; set; } + /// + /// + /// + public uint FreeRunEnabled { get; set; } + #endregion + + #region Analogs + /// + /// Sets and reports the video source + /// + public uint VideoInput { get; set; } + /// + /// Sets and reports the audio source + /// + public uint AudioInput { get; set; } + /// + /// Reports the highest supported HDCP state level for the corresponding input card + /// + public uint HdcpSupportCapability { get; set; } + /// + /// Sets and reports the current HDCP state for the corresponding input port + /// + public uint Port1HdcpState { get; set; } + /// + /// Sets and reports the current HDCP state for the corresponding input port + /// + public uint Port2HdcpState { get; set; } + + /// + /// Sets and reports the current VGA Brightness level + /// + public uint VgaBrightness { get; set; } + + /// + /// Sets and reports the current VGA Contrast level + /// + public uint VgaContrast { get; set; } + #endregion + + #region Serials + /// + /// Reports the current input resolution + /// + public uint CurrentInputResolution { get; set; } + #endregion + + + public DmTxControllerJoinMap() + { + // Digital + IsOnline = 1; + VideoSyncStatus = 2; + FreeRunEnabled = 3; + // Serial + CurrentInputResolution = 1; + // Analog + VideoInput = 1; + AudioInput = 2; + HdcpSupportCapability = 3; + Port1HdcpState = 4; + Port2HdcpState = 5; + VgaBrightness = 6; + VgaContrast = 7; + } + + public override void OffsetJoinNumbers(uint joinStart) + { + var joinOffset = joinStart - 1; + + IsOnline = IsOnline + joinOffset; + VideoSyncStatus = VideoSyncStatus + joinOffset; + FreeRunEnabled = FreeRunEnabled + joinOffset; + CurrentInputResolution = CurrentInputResolution + joinOffset; + VideoInput = VideoInput + joinOffset; + AudioInput = AudioInput + joinOffset; + HdcpSupportCapability = HdcpSupportCapability + joinOffset; + Port1HdcpState = Port1HdcpState + joinOffset; + Port2HdcpState = Port2HdcpState + joinOffset; + VgaBrightness = VgaBrightness + joinOffset; + VgaContrast = VgaContrast + joinOffset; + } + } +} \ No newline at end of file diff --git a/PepperDashEssentials/Bridges/JoinMaps/DmpsAudioOutputControllerJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/DmpsAudioOutputControllerJoinMap.cs new file mode 100644 index 00000000..faa30775 --- /dev/null +++ b/PepperDashEssentials/Bridges/JoinMaps/DmpsAudioOutputControllerJoinMap.cs @@ -0,0 +1,69 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Bridges +{ + public class DmpsAudioOutputControllerJoinMap : JoinMapBase + { + #region Digital/Analog + /// + /// Range of joins for Master Volume + /// Analog join 1 is volume level and feedback + /// Digital join 1 is Mute on and feedback + /// Digital join 2 is Mute off and feedback + /// Digital join 3 is volume up + /// Digital join 4 is volume down + /// + public uint MasterVolume { get; set; } + /// + /// Range of joins for Source Volume + /// Analog join 11 is volume level and feedback + /// Digital join 11 is Mute on and feedback + /// Digital join 12 is Mute off and feedback + /// Digital join 13 is volume up + /// Digital join 14 is volume down + /// + public uint SourceVolume { get; set; } + /// + /// Range of joins for Codec1 Volume (if applicable) + /// Analog join 21 is volume level and feedback + /// Digital join 21 is Mute on and feedback + /// Digital join 22 is Mute off and feedback + /// Digital join 23 is volume up + /// Digital join 24 is volume down + /// + public uint Codec1Volume { get; set; } + /// + /// Range of joins for Codec2 Volume (if applicable) + /// Analog join 31 is volume level and feedback + /// Digital join 31 is Mute on and feedback + /// Digital join 32 is Mute off and feedback + /// Digital join 33 is volume up + /// Digital join 34 is volume down + /// + public uint Codec2Volume { get; set; } + #endregion + + public DmpsAudioOutputControllerJoinMap() + { + MasterVolume = 1; // 1-10 + SourceVolume = 11; // 11-20 + Codec1Volume = 21; // 21-30 + Codec2Volume = 31; // 31-40 + } + + public override void OffsetJoinNumbers(uint joinStart) + { + var joinOffset = joinStart; + + MasterVolume = MasterVolume + joinOffset; + SourceVolume = SourceVolume + joinOffset; + Codec1Volume = Codec1Volume + joinOffset; + Codec2Volume = Codec2Volume + joinOffset; + } + } +} \ No newline at end of file diff --git a/PepperDashEssentials/Bridges/JoinMaps/DmpsRoutingControllerJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/DmpsRoutingControllerJoinMap.cs new file mode 100644 index 00000000..ba3a8cd0 --- /dev/null +++ b/PepperDashEssentials/Bridges/JoinMaps/DmpsRoutingControllerJoinMap.cs @@ -0,0 +1,127 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Bridges +{ + public class DmpsRoutingControllerJoinMap : JoinMapBase + { + #region Digitals + /// + /// Range reports video sync feedback for each input + /// + public uint VideoSyncStatus { get; set; } + /// + /// Range reports high if corresponding input's endpoint is online + /// + public uint InputEndpointOnline { get; set; } + /// + /// Range reports high if corresponding output's endpoint is online + /// + public uint OutputEndpointOnline { get; set; } + #endregion + + + #region Analogs + /// + /// Range sets and reports the current video source for the corresponding output + /// + public uint OutputVideo { get; set; } + /// + /// Range sets and reports the current audio source for the corresponding output + /// + public uint OutputAudio { get; set; } + /// + /// Range sets and reports the current Usb source for the corresponding output + /// + //public uint OutputUsb { get; set; } + ///// + ///// Range sets and reports the current Usb source for the corresponding input + ///// + //public uint InputUsb { get; set; } + ///// + ///// Range sets and reports the current HDCP state for the corresponding input card + ///// + //public uint HdcpSupportState { get; set; } + ///// + ///// Range reports the highest supported HDCP state level for the corresponding input card + ///// + //public uint HdcpSupportCapability { get; set; } + #endregion + + #region Serials + /// + /// Range sets and reports the name for the corresponding input card + /// + public uint InputNames { get; set; } + /// + /// Range sets and reports the name for the corresponding output card + /// + public uint OutputNames { get; set; } + /// + /// Range reports the name of the current video source for the corresponding output card + /// + public uint OutputCurrentVideoInputNames { get; set; } + /// + /// Range reports the name of the current audio source for the corresponding output card + /// + public uint OutputCurrentAudioInputNames { get; set; } + /// + /// Range reports the current input resolution for each corresponding input card + /// + public uint InputCurrentResolution { get; set; } + #endregion + + + public DmpsRoutingControllerJoinMap() + { + //Digital + VideoSyncStatus = 100; //101-299 + InputEndpointOnline = 500; //501-699 + OutputEndpointOnline = 700; //701-899 + + //Analog + OutputVideo = 100; //101-299 + OutputAudio = 300; //301-499 + //OutputUsb = 500; //501-699 + //InputUsb = 700; //701-899 + VideoSyncStatus = 100; //101-299 + //HdcpSupportState = 1000; //1001-1199 + //HdcpSupportCapability = 1200; //1201-1399 + + + //Serial + InputNames = 100; //101-299 + OutputNames = 300; //301-499 + OutputCurrentVideoInputNames = 2000; //2001-2199 + OutputCurrentAudioInputNames = 2200; //2201-2399 + InputCurrentResolution = 2400; // 2401-2599 + InputEndpointOnline = 500; //501-699 + OutputEndpointOnline = 700; //701-899 + + } + + public override void OffsetJoinNumbers(uint joinStart) + { + var joinOffset = joinStart - 1; + + OutputVideo = OutputVideo + joinOffset; + OutputAudio = OutputAudio + joinOffset; + //OutputUsb = OutputUsb + joinOffset; + //InputUsb = InputUsb + joinOffset; + VideoSyncStatus = VideoSyncStatus + joinOffset; + InputNames = InputNames + joinOffset; + OutputNames = OutputNames + joinOffset; + OutputCurrentVideoInputNames = OutputCurrentVideoInputNames + joinOffset; + OutputCurrentAudioInputNames = OutputCurrentAudioInputNames + joinOffset; + InputCurrentResolution = InputCurrentResolution + joinOffset; + InputEndpointOnline = InputEndpointOnline + joinOffset; + OutputEndpointOnline = OutputEndpointOnline + joinOffset; + //HdcpSupportState = HdcpSupportState + joinOffset; + //HdcpSupportCapability = HdcpSupportCapability + joinOffset; + } + } +} \ No newline at end of file diff --git a/PepperDashEssentials/Bridges/JoinMaps/GenericLightingJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/GenericLightingJoinMap.cs new file mode 100644 index 00000000..df5606d0 --- /dev/null +++ b/PepperDashEssentials/Bridges/JoinMaps/GenericLightingJoinMap.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; + +using PepperDash.Essentials.Core; + + +namespace PepperDash.Essentials.Bridges +{ + public class GenericLightingJoinMap : JoinMapBase + { + public uint IsOnline { get; set; } + public uint SelectScene { get; set; } + public uint LightingSceneOffset { get; set; } + public uint ButtonVisibilityOffset { get; set; } + public uint IntegrationIdSet { get; set; } + + public GenericLightingJoinMap() + { + // Digital + IsOnline = 1; + SelectScene = 1; + IntegrationIdSet = 1; + LightingSceneOffset = 10; + ButtonVisibilityOffset = 40; + // Analog + } + + public override void OffsetJoinNumbers(uint joinStart) + { + var joinOffset = joinStart - 1; + + IsOnline = IsOnline + joinOffset; + SelectScene = SelectScene + joinOffset; + LightingSceneOffset = LightingSceneOffset + joinOffset; + ButtonVisibilityOffset = ButtonVisibilityOffset + joinOffset; + } + } +} \ No newline at end of file diff --git a/PepperDashEssentials/Bridges/JoinMaps/GenericRelayControllerJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/GenericRelayControllerJoinMap.cs new file mode 100644 index 00000000..5c91a358 --- /dev/null +++ b/PepperDashEssentials/Bridges/JoinMaps/GenericRelayControllerJoinMap.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Bridges +{ + public class GenericRelayControllerJoinMap : JoinMapBase + { + #region Digitals + /// + /// Sets and reports the state of the relay (High = closed, Low = Open) + /// + public uint Relay { get; set; } + #endregion + + public GenericRelayControllerJoinMap() + { + Relay = 1; + } + + public override void OffsetJoinNumbers(uint joinStart) + { + var joinOffset = joinStart - 1; + + Relay = Relay + joinOffset; + } + } +} \ No newline at end of file diff --git a/PepperDashEssentials/Bridges/JoinMaps/GlsOccupancySensorBaseJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/GlsOccupancySensorBaseJoinMap.cs new file mode 100644 index 00000000..a40913ee --- /dev/null +++ b/PepperDashEssentials/Bridges/JoinMaps/GlsOccupancySensorBaseJoinMap.cs @@ -0,0 +1,238 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Bridges +{ + public class GlsOccupancySensorBaseJoinMap : JoinMapBase + { + #region Digitals + + /// + /// High when device is online + /// + public uint IsOnline { get; set; } + /// + /// Forces the device to report occupied status + /// + public uint ForceOccupied { get; set; } + /// + /// Forces the device to report vacant status + /// + public uint ForceVacant { get; set; } + /// + /// Enables raw status reporting + /// + public uint EnableRawStates { get; set; } + /// + /// High when raw occupancy is detected + /// + public uint RawOccupancyFeedback { get; set; } + /// + /// High when PIR sensor detects motion + /// + public uint RawOccupancyPirFeedback { get; set; } + /// + /// High when US sensor detects motion + /// + public uint RawOccupancyUsFeedback { get; set; } + /// + /// High when occupancy is detected + /// + public uint RoomOccupiedFeedback { get; set; } + /// + /// Hich when occupancy is detected in the grace period + /// + public uint GraceOccupancyDetectedFeedback { get; set; } + /// + /// High when vacancy is detected + /// + public uint RoomVacantFeedback { get; set; } + + /// + /// Enables the LED Flash when set high + /// + public uint EnableLedFlash { get; set; } + /// + /// Disables the LED flash when set high + /// + public uint DisableLedFlash { get; set; } + /// + /// Enables the Short Timeout + /// + public uint EnableShortTimeout { get; set; } + /// + /// Disables the Short Timout + /// + public uint DisableShortTimeout { get; set; } + /// + /// Set high to enable one technology to trigger occupancy + /// + public uint OrWhenVacated { get; set; } + /// + /// Set high to require both technologies to trigger occupancy + /// + public uint AndWhenVacated { get; set; } + /// + /// Enables Ultrasonic Sensor A + /// + public uint EnableUsA { get; set; } + /// + /// Disables Ultrasonic Sensor A + /// + public uint DisableUsA { get; set; } + /// + /// Enables Ultrasonic Sensor B + /// + public uint EnableUsB { get; set; } + /// + /// Disables Ultrasonic Sensor B + /// + public uint DisableUsB { get; set; } + /// + /// Enables Pir + /// + public uint EnablePir { get; set; } + /// + /// Disables Pir + /// + public uint DisablePir { get; set; } + public uint IncrementUsInOccupiedState { get; set; } + public uint DecrementUsInOccupiedState { get; set; } + public uint IncrementUsInVacantState { get; set; } + public uint DecrementUsInVacantState { get; set; } + public uint IncrementPirInOccupiedState { get; set; } + public uint DecrementPirInOccupiedState { get; set; } + public uint IncrementPirInVacantState { get; set; } + public uint DecrementPirInVacantState { get; set; } + #endregion + + #region Analogs + /// + /// Sets adn reports the remote timeout value + /// + public uint Timeout { get; set; } + /// + /// Reports the local timeout value + /// + public uint TimeoutLocalFeedback { get; set; } + /// + /// Sets the minimum internal photo sensor value and reports the current level + /// + public uint InternalPhotoSensorValue { get; set; } + /// + /// Sets the minimum external photo sensor value and reports the current level + /// + public uint ExternalPhotoSensorValue { get; set; } + + public uint UsSensitivityInOccupiedState { get; set; } + + public uint UsSensitivityInVacantState { get; set; } + + public uint PirSensitivityInOccupiedState { get; set; } + + public uint PirSensitivityInVacantState { get; set; } + #endregion + + #region Serial + public uint Name { get; set; } + #endregion + + public GlsOccupancySensorBaseJoinMap() + { + IsOnline = 1; + ForceOccupied = 2; + ForceVacant = 3; + EnableRawStates = 4; + RoomOccupiedFeedback = 2; + GraceOccupancyDetectedFeedback = 3; + RoomVacantFeedback = 4; + RawOccupancyFeedback = 5; + RawOccupancyPirFeedback = 6; + RawOccupancyUsFeedback = 7; + EnableLedFlash = 11; + DisableLedFlash = 12; + EnableShortTimeout = 13; + DisableShortTimeout = 14; + OrWhenVacated = 15; + AndWhenVacated = 16; + EnableUsA = 17; + DisableUsA = 18; + EnableUsB = 19; + DisableUsB = 20; + EnablePir = 21; + DisablePir = 22; + IncrementUsInOccupiedState = 23; + DecrementUsInOccupiedState = 24; + IncrementUsInVacantState = 25; + DecrementUsInVacantState = 26; + IncrementPirInOccupiedState = 27; + DecrementPirInOccupiedState = 28; + IncrementPirInVacantState = 29; + DecrementPirInVacantState = 30; + + Timeout = 1; + TimeoutLocalFeedback = 2; + InternalPhotoSensorValue = 3; + ExternalPhotoSensorValue = 4; + UsSensitivityInOccupiedState = 5; + UsSensitivityInVacantState = 6; + PirSensitivityInOccupiedState = 7; + PirSensitivityInVacantState = 8; + + Name = 1; + + } + + public override void OffsetJoinNumbers(uint joinStart) + { + var joinOffset = joinStart - 1; + + IsOnline = IsOnline + joinOffset; + ForceOccupied = ForceOccupied + joinOffset; + ForceVacant = ForceVacant + joinOffset; + EnableRawStates = EnableRawStates + joinOffset; + RoomOccupiedFeedback = RoomOccupiedFeedback + joinOffset; + GraceOccupancyDetectedFeedback = GraceOccupancyDetectedFeedback + joinOffset; + RoomVacantFeedback = RoomVacantFeedback + joinOffset; + RawOccupancyFeedback = RawOccupancyFeedback + joinOffset; + RawOccupancyPirFeedback = RawOccupancyPirFeedback + joinOffset; + RawOccupancyUsFeedback = RawOccupancyUsFeedback + joinOffset; + EnableLedFlash = EnableLedFlash + joinOffset; + DisableLedFlash = DisableLedFlash + joinOffset; + EnableShortTimeout = EnableShortTimeout + joinOffset; + DisableShortTimeout = DisableShortTimeout + joinOffset; + OrWhenVacated = OrWhenVacated + joinOffset; + AndWhenVacated = AndWhenVacated + joinOffset; + EnableUsA = EnableUsA + joinOffset; + DisableUsA = DisableUsA + joinOffset; + EnableUsB = EnableUsB + joinOffset; + DisableUsB = DisableUsB + joinOffset; + EnablePir = EnablePir + joinOffset; + DisablePir = DisablePir + joinOffset; + IncrementUsInOccupiedState = IncrementUsInOccupiedState + joinOffset; + DecrementUsInOccupiedState = DecrementUsInOccupiedState + joinOffset; + IncrementUsInVacantState = IncrementUsInVacantState + joinOffset; + DecrementUsInVacantState = DecrementUsInVacantState + joinOffset; + IncrementPirInOccupiedState = IncrementPirInOccupiedState + joinOffset; + DecrementPirInOccupiedState = DecrementPirInOccupiedState + joinOffset; + IncrementPirInVacantState = IncrementPirInVacantState + joinOffset; + DecrementPirInVacantState = DecrementPirInVacantState + joinOffset; + + Timeout = Timeout + joinOffset; + TimeoutLocalFeedback = TimeoutLocalFeedback + joinOffset; + InternalPhotoSensorValue = InternalPhotoSensorValue + joinOffset; + ExternalPhotoSensorValue = ExternalPhotoSensorValue + joinOffset; + UsSensitivityInOccupiedState = UsSensitivityInOccupiedState + joinOffset; + UsSensitivityInVacantState = UsSensitivityInVacantState + joinOffset; + PirSensitivityInOccupiedState = PirSensitivityInOccupiedState + joinOffset; + PirSensitivityInVacantState = PirSensitivityInVacantState + joinOffset; + + Name = Name + joinOffset; + } + } + +} diff --git a/PepperDashEssentials/Bridges/JoinMaps/HdMdxxxCEControllerJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/HdMdxxxCEControllerJoinMap.cs new file mode 100644 index 00000000..e88980fe --- /dev/null +++ b/PepperDashEssentials/Bridges/JoinMaps/HdMdxxxCEControllerJoinMap.cs @@ -0,0 +1,119 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Bridges +{ + public class HdMdxxxCEControllerJoinMap : JoinMapBase + { + #region Digitals + /// + /// High when the pair is online + /// + public uint IsOnline { get; set; } + + /// + /// High when the remote end device is online + /// + public uint RemoteEndDetected { get; set; } + + /// + /// Sets Auto Route On and provides feedback + /// + public uint AutoRouteOn { get; set; } + + /// + /// Sets Auto Route Off and provides feedback + /// + public uint AutoRouteOff { get; set; } + + /// + /// Sets Priority Routing On and provides feedback + /// + public uint PriorityRoutingOn { get; set; } + + /// + /// Sets Priority Routing Off and provides feedback + /// + public uint PriorityRoutingOff { get; set; } + + /// + /// Enables OSD and provides feedback + /// + public uint InputOnScreenDisplayEnabled { get; set; } + + /// + /// Disables OSD and provides feedback + /// + public uint InputOnScreenDisplayDisabled { get; set; } + + /// + /// Provides Video Sync Detected feedback for each input + /// + public uint SyncDetected { get; set; } + #endregion + + #region Analogs + /// + /// Sets the video source for the receiver's HDMI out and provides feedback + /// + public uint VideoSource { get; set; } + + /// + /// Indicates the number of sources supported by the Tx/Rx pair + /// + public uint SourceCount { get; set; } + #endregion + + #region Serials + /// + /// Indicates the name of each input port + /// + public uint SourceNames { get; set; } + #endregion + + public HdMdxxxCEControllerJoinMap() + { + //Digital + IsOnline = 1; + RemoteEndDetected = 2; + AutoRouteOn = 3; + AutoRouteOff = 4; + PriorityRoutingOn = 5; + PriorityRoutingOff = 6; + InputOnScreenDisplayEnabled = 7; + InputOnScreenDisplayDisabled = 8; + SyncDetected = 10; // 11-15 + + //Analog + VideoSource = 1; + SourceCount = 2; + + //Serials + SourceNames = 10; // 11-15 + } + + public override void OffsetJoinNumbers(uint joinStart) + { + var joinOffset = joinStart - 1; + + IsOnline = IsOnline + joinOffset; + RemoteEndDetected = RemoteEndDetected + joinOffset; + AutoRouteOn = AutoRouteOn + joinOffset; + AutoRouteOff = AutoRouteOff + joinOffset; + PriorityRoutingOn = PriorityRoutingOn + joinOffset; + PriorityRoutingOff = PriorityRoutingOff + joinOffset; + InputOnScreenDisplayEnabled = InputOnScreenDisplayEnabled + joinOffset; + InputOnScreenDisplayDisabled = InputOnScreenDisplayDisabled + joinOffset; + SyncDetected = SyncDetected + joinOffset; + + VideoSource = VideoSource + joinOffset; + SourceCount = SourceCount + joinOffset; + + SourceNames = SourceNames + joinOffset; + } + } +} \ No newline at end of file diff --git a/PepperDashEssentials/Bridges/JoinMaps/IBasicCommunicationJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/IBasicCommunicationJoinMap.cs new file mode 100644 index 00000000..953bae37 --- /dev/null +++ b/PepperDashEssentials/Bridges/JoinMaps/IBasicCommunicationJoinMap.cs @@ -0,0 +1,67 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Bridges +{ + public class IBasicCommunicationJoinMap : JoinMapBase + { + #region Digitals + /// + /// Set High to connect, Low to disconnect + /// + public uint Connect { get; set; } + /// + /// Reports Connected State (High = Connected) + /// + public uint Connected { get; set; } + #endregion + + #region Analogs + /// + /// Reports the connections status value + /// + public uint Status { get; set; } + #endregion + + #region Serials + /// + /// Data back from port + /// + public uint TextReceived { get; set; } + /// + /// Sends data to the port + /// + public uint SendText { get; set; } + /// + /// Takes a JSON serialized string that sets a COM port's parameters + /// + public uint SetPortConfig { get; set; } + #endregion + + public IBasicCommunicationJoinMap() + { + TextReceived = 1; + SendText = 1; + SetPortConfig = 2; + Connect = 1; + Connected = 1; + Status = 1; + } + + public override void OffsetJoinNumbers(uint joinStart) + { + var joinOffset = joinStart - 1; + + TextReceived = TextReceived + joinOffset; + SendText = SendText + joinOffset; + SetPortConfig = SetPortConfig + joinOffset; + Connect = Connect + joinOffset; + Connected = Connected + joinOffset; + Status = Status + joinOffset; + } + } +} \ No newline at end of file diff --git a/PepperDashEssentials/Bridges/JoinMaps/IDigitalInputJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/IDigitalInputJoinMap.cs new file mode 100644 index 00000000..65d4ada4 --- /dev/null +++ b/PepperDashEssentials/Bridges/JoinMaps/IDigitalInputJoinMap.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Bridges +{ + public class IDigitalInputJoinMap : JoinMapBase + { + #region Digitals + /// + /// Reports the state of the digital input + /// + public uint InputState { get; set; } + #endregion + + public IDigitalInputJoinMap() + { + InputState = 1; + } + + public override void OffsetJoinNumbers(uint joinStart) + { + var joinOffset = joinStart - 1; + + InputState = InputState + joinOffset; + } + } +} \ No newline at end of file diff --git a/PepperDashEssentials/Bridges/JoinMaps/SetTopBoxControllerJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/SetTopBoxControllerJoinMap.cs new file mode 100644 index 00000000..36e5b2da --- /dev/null +++ b/PepperDashEssentials/Bridges/JoinMaps/SetTopBoxControllerJoinMap.cs @@ -0,0 +1,212 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using PepperDash.Essentials.Core; +using Crestron.SimplSharp.Reflection; + + +namespace PepperDash.Essentials.Bridges +{ + public class SetTopBoxControllerJoinMap : JoinMapBase + { + #region Digitals + public uint DvrList { get; set; } // + public uint Replay { get; set; } + public uint Up { get; set; } // + public uint Down { get; set; } // + public uint Left { get; set; } // + public uint Right { get; set; } // + public uint Select { get; set; } // + public uint Menu { get; set; } // + public uint Exit { get; set; } // + public uint Digit0 { get; set; } // + public uint Digit1 { get; set; } // + public uint Digit2 { get; set; } // + public uint Digit3 { get; set; } // + public uint Digit4 { get; set; } // + public uint Digit5 { get; set; } // + public uint Digit6 { get; set; } // + public uint Digit7 { get; set; } // + public uint Digit8 { get; set; } // + public uint Digit9 { get; set; } // + public uint Dash { get; set; } // + public uint KeypadEnter { get; set; } // + public uint ChannelUp { get; set; } // + public uint ChannelDown { get; set; } // + public uint LastChannel { get; set; } // + public uint Guide { get; set; } // + public uint Info { get; set; } // + public uint Red { get; set; } // + public uint Green { get; set; } // + public uint Yellow { get; set; } // + public uint Blue { get; set; } // + public uint ChapMinus { get; set; } + public uint ChapPlus { get; set; } + public uint FFwd { get; set; } // + public uint Pause { get; set; } // + public uint Play { get; set; } // + public uint Record { get; set; } + public uint Rewind { get; set; } // + public uint Stop { get; set; } // + + public uint PowerOn { get; set; } // + public uint PowerOff { get; set; } // + public uint PowerToggle { get; set; } // + + public uint HasKeypadAccessoryButton1 { get; set; } + public uint HasKeypadAccessoryButton2 { get; set; } + + public uint KeypadAccessoryButton1Press { get; set; } + public uint KeypadAccessoryButton2Press { get; set; } + + + public uint HasDvr { get; set; } + public uint HasPresets { get; set; } + public uint HasNumeric { get; set; } + public uint HasDpad { get; set; } + + + #endregion + + #region Analogs + + #endregion + + #region Strings + public uint Name { get; set; } + public uint LoadPresets { get; set; } + public uint KeypadAccessoryButton1Label { get; set; } + public uint KeypadAccessoryButton2Label { get; set; } + + #endregion + + public SetTopBoxControllerJoinMap() + { + PowerOn = 1; + PowerOff = 2; + PowerToggle = 3; + + HasDpad = 4; + Up = 4; + Down = 5; + Left = 6; + Right = 7; + Select = 8; + Menu = 9; + Exit = 10; + + HasNumeric = 11; + Digit0 = 11; + Digit1 = 12; + Digit2 = 13; + Digit3 = 14; + Digit4 = 15; + Digit5 = 16; + Digit6 = 17; + Digit7 = 18; + Digit8 = 19; + Digit9 = 20; + Dash = 21; + KeypadEnter = 22; + ChannelUp = 23; + ChannelDown = 24; + LastChannel = 25; + + Guide = 26; + Info = 27; + Red = 28; + Green = 29; + Yellow = 30; + Blue = 31; + + HasDvr = 32; + DvrList = 32; + Play = 33; + Pause = 34; + Stop = 35; + FFwd = 36; + Rewind = 37; + ChapPlus = 38; + ChapMinus = 39; + Replay = 40; + Record = 41; + HasKeypadAccessoryButton1 = 42; + KeypadAccessoryButton1Press = 42; + HasKeypadAccessoryButton2 = 43; + KeypadAccessoryButton2Press = 43; + + Name = 1; + KeypadAccessoryButton1Label = 42; + KeypadAccessoryButton2Label = 43; + + LoadPresets = 50; + } + + public override void OffsetJoinNumbers(uint joinStart) + { + var joinOffset = joinStart - 1; + + PowerOn += joinOffset; + PowerOff += joinOffset; + PowerToggle += joinOffset; + + HasDpad += joinOffset; + Up += joinOffset; + Down += joinOffset; + Left += joinOffset; + Right += joinOffset; + Select += joinOffset; + Menu += joinOffset; + Exit += joinOffset; + + HasNumeric += joinOffset; + Digit0 += joinOffset; + Digit1 += joinOffset; + Digit2 += joinOffset; + Digit3 += joinOffset; + Digit4 += joinOffset; + Digit5 += joinOffset; + Digit6 += joinOffset; + Digit7 += joinOffset; + Digit8 += joinOffset; + Digit9 += joinOffset; + Dash += joinOffset; + KeypadEnter += joinOffset; + ChannelUp += joinOffset; + ChannelDown += joinOffset; + LastChannel += joinOffset; + + Guide += joinOffset; + Info += joinOffset; + Red += joinOffset; + Green += joinOffset; + Yellow += joinOffset; + Blue += joinOffset; + + HasDvr += joinOffset; + DvrList += joinOffset; + Play += joinOffset; + Pause += joinOffset; + Stop += joinOffset; + FFwd += joinOffset; + Rewind += joinOffset; + ChapPlus += joinOffset; + ChapMinus += joinOffset; + Replay += joinOffset; + Record += joinOffset; + HasKeypadAccessoryButton1 += joinOffset; + KeypadAccessoryButton1Press += joinOffset; + HasKeypadAccessoryButton2 += joinOffset; + KeypadAccessoryButton2Press += joinOffset; + + Name += joinOffset; + KeypadAccessoryButton1Label += joinOffset; + KeypadAccessoryButton2Label += joinOffset; + + LoadPresets += joinOffset; + } + + } +} \ No newline at end of file diff --git a/PepperDashEssentials/Bridges/JoinMaps/StatusSignControllerJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/StatusSignControllerJoinMap.cs new file mode 100644 index 00000000..ad8f1577 --- /dev/null +++ b/PepperDashEssentials/Bridges/JoinMaps/StatusSignControllerJoinMap.cs @@ -0,0 +1,49 @@ +using System.Linq; +using Crestron.SimplSharp.Reflection; +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Bridges +{ + public class StatusSignControllerJoinMap:JoinMapBase + { + public uint IsOnline { get; set; } + public uint Name { get; set; } + public uint RedLed { get; set; } + public uint GreenLed { get; set; } + public uint BlueLed { get; set; } + public uint RedControl { get; set; } + public uint GreenControl { get; set; } + public uint BlueControl { get; set; } + + public StatusSignControllerJoinMap() + { + //digital + IsOnline = 1; + RedControl = 2; + GreenControl = 3; + BlueControl = 4; + + //Analog + RedLed = 2; + GreenLed = 3; + BlueLed = 4; + + //string + Name = 1; + + + } + + public override void OffsetJoinNumbers(uint joinStart) + { + var joinOffset = joinStart - 1; + var properties = + GetType().GetCType().GetProperties().Where(p => p.PropertyType == typeof (uint)).ToList(); + + foreach (var propertyInfo in properties) + { + propertyInfo.SetValue(this, (uint) propertyInfo.GetValue(this, null) + joinOffset, null); + } + } + } +} \ No newline at end of file diff --git a/PepperDashEssentials/Bridges/JoinMaps/SystemMonitorJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/SystemMonitorJoinMap.cs new file mode 100644 index 00000000..b2b66263 --- /dev/null +++ b/PepperDashEssentials/Bridges/JoinMaps/SystemMonitorJoinMap.cs @@ -0,0 +1,225 @@ +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Bridges +{ + public class SystemMonitorJoinMap : JoinMapBase + { + /// + /// Offset to indicate where the range of iterated program joins will start + /// + public uint ProgramStartJoin { get; set; } + + /// + /// Offset to indicate where the range of iterated Ethernet joins will start + /// + public uint EthernetStartJoin { get; set; } + + /// + /// Offset between each program join set + /// + public uint ProgramOffsetJoin { get; set; } + + /// + /// Offset between each Ethernet Interface join set + /// + public uint EthernetOffsetJoin { get; set; } + + #region Digitals + /// + /// Range Sets and reports whether the corresponding program slot is started + /// + public uint ProgramStart { get; set; } + /// + /// Range Sets and reports whether the corresponding program slot is stopped + /// + public uint ProgramStop { get; set; } + /// + /// Range Sets and reports whether the corresponding program is registered + /// + public uint ProgramRegister { get; set; } + /// + /// Range Sets and reports whether the corresponding program is unregistered + /// + public uint ProgramUnregister { get; set; } + #endregion + + #region Analogs + /// + /// Sets and reports the time zone + /// + public uint TimeZone { get; set; } + #endregion + + #region Serials + /// + /// Reports the time zone name + /// + public uint TimeZoneName { get; set; } + /// + /// Reports the IO Controller Version + /// + public uint IOControllerVersion { get; set; } + /// + /// Reports the SNMP App Version + /// + public uint SnmpAppVersion { get; set; } + /// + /// Reports the BACnet App Version + /// + public uint BACnetAppVersion { get; set; } + /// + /// Reports the firmware version + /// + public uint ControllerVersion { get; set; } + + /// + /// Reports the name of the corresponding program + /// + public uint ProgramName { get; set; } + /// + /// Reports the compile time of the corresponding program + /// + public uint ProgramCompiledTime { get; set; } + /// + /// Reports the Crestron Database version of the corresponding program + /// + public uint ProgramCrestronDatabaseVersion { get; set; } + /// + /// Reports the Environment Version of the corresponding program + /// + public uint ProgramEnvironmentVersion { get; set; } + /// + /// Serialized JSON output that aggregates the program info of the corresponding program + /// + public uint AggregatedProgramInfo { get; set; } + /// + /// Reports the controller serial number + /// + public uint SerialNumber { get; set; } + /// + /// Reports the controller model + /// + public uint Model { get; set; } + /// + /// Reports the Host name set on the corresponding interface + /// + public uint HostName { get; set; } + /// + /// Reports the Current IP address set on the corresponding interface. If DHCP is enabled, this will be the DHCP assigned address. + /// + public uint CurrentIpAddress { get; set; } + /// + /// Reporst the Current Default Gateway set on the corresponding interface. If DHCP is enabled, this will be the DHCP assigned gateway + /// + public uint CurrentDefaultGateway { get; set; } + /// + /// Reports the Current Subnet Mask set on the corresponding interface. If DHCP is enabled, this will be the DHCP assigned subnet mask + /// + public uint CurrentSubnetMask { get; set; } + /// + /// Reports the Static IP address set on the corresponding interface. If DHCP is disabled, this will match the Current IP address + /// + public uint StaticIpAddress { get; set; } + /// + /// Reporst the Static Default Gateway set on the corresponding interface. If DHCP is disabled, this will match the Current gateway + /// + public uint StaticDefaultGateway { get; set; } + /// + /// Reports the Current Subnet Mask set on the corresponding interface. If DHCP is enabled, this will be the DHCP assigned subnet mask + /// + public uint StaticSubnetMask { get; set; } + /// + /// Reports the current DomainFeedback on the corresponding interface + /// + public uint Domain { get; set; } + /// + /// Reports the current DNS Servers on the corresponding interface + /// + public uint DnsServer { get; set; } + /// + /// Reports the MAC Address of the corresponding interface + /// + public uint MacAddress { get; set; } + /// + /// Reports the DHCP Status of the corresponding interface + /// + public uint DhcpStatus { get; set; } + + /// + /// Reports the current uptime. Updated in 5 minute intervals. + /// + public uint Uptime { get; set; } + + /// + /// Reports the date of the last boot + /// + public uint LastBoot { get; set; } + #endregion + + public SystemMonitorJoinMap() + { + TimeZone = 1; + + TimeZoneName = 1; + IOControllerVersion = 2; + SnmpAppVersion = 3; + BACnetAppVersion = 4; + ControllerVersion = 5; + SerialNumber = 6; + Model = 7; + Uptime = 8; + LastBoot = 9; + + + ProgramStartJoin = 10; + + ProgramOffsetJoin = 5; + + // Offset in groups of 5 joins + ProgramStart = 1; + ProgramStop = 2; + ProgramRegister = 3; + ProgramUnregister = 4; + + ProgramName = 1; + ProgramCompiledTime = 2; + ProgramCrestronDatabaseVersion = 3; + ProgramEnvironmentVersion = 4; + AggregatedProgramInfo = 5; + + EthernetStartJoin = 75; + + EthernetOffsetJoin = 15; + + // Offset in groups of 15 + HostName = 1; + CurrentIpAddress = 2; + CurrentSubnetMask = 3; + CurrentDefaultGateway = 4; + StaticIpAddress = 5; + StaticSubnetMask = 6; + StaticDefaultGateway = 7; + Domain = 8; + DnsServer = 9; + MacAddress = 10; + DhcpStatus = 11; + } + + public override void OffsetJoinNumbers(uint joinStart) + { + var joinOffset = joinStart - 1; + + TimeZone = TimeZone + joinOffset; + + TimeZoneName = TimeZoneName + joinOffset; + IOControllerVersion = IOControllerVersion + joinOffset; + SnmpAppVersion = SnmpAppVersion + joinOffset; + BACnetAppVersion = BACnetAppVersion + joinOffset; + ControllerVersion = ControllerVersion + joinOffset; + + // Sets the initial join value where the iterated program joins will begin + ProgramStartJoin = ProgramStartJoin + joinOffset; + EthernetStartJoin = EthernetStartJoin + joinOffset; + } + } +} \ No newline at end of file diff --git a/PepperDashEssentials/PepperDashEssentials.csproj b/PepperDashEssentials/PepperDashEssentials.csproj index c403d1c3..62cae03f 100644 --- a/PepperDashEssentials/PepperDashEssentials.csproj +++ b/PepperDashEssentials/PepperDashEssentials.csproj @@ -124,8 +124,30 @@ + + + + + + + + + + + + + + + + + + + + + + From 35b5e6dfc5d21defd61b208ed3e23a00a6370031 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 20 Apr 2020 09:34:07 -0600 Subject: [PATCH 048/156] changes new EiscApi to EiscApiAdvanced --- .../Bridges/BridgeBase.cs | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs index 330cb9fb..60781e38 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs @@ -7,6 +7,7 @@ using Crestron.SimplSharpPro.EthernetCommunication; using Newtonsoft.Json; using PepperDash.Core; +using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Config; //using PepperDash.Essentials.Devices.Common.Cameras; @@ -24,11 +25,11 @@ namespace PepperDash.Essentials.Core.Bridges var bridgeKey = targets[0].Trim(); - var bridge = DeviceManager.GetDeviceForKey(bridgeKey) as EiscApi; + var bridge = DeviceManager.GetDeviceForKey(bridgeKey) as EiscApiAdvanced; if (bridge == null) { - Debug.Console(0, "Unable to find bridge with key: '{0}'", bridgeKey); + Debug.Console(0, "Unable to find advanced bridge with key: '{0}'", bridgeKey); return; } @@ -76,7 +77,7 @@ namespace PepperDash.Essentials.Core.Bridges /// /// Bridge API using EISC /// - public class EiscApi : BridgeApi + public class EiscApiAdvanced : BridgeApi { public EiscApiPropertiesConfig PropertiesConfig { get; private set; } @@ -84,7 +85,7 @@ namespace PepperDash.Essentials.Core.Bridges public ThreeSeriesTcpIpEthernetIntersystemCommunications Eisc { get; private set; } - public EiscApi(DeviceConfig dc) : + public EiscApiAdvanced(DeviceConfig dc) : base(dc.Key) { JoinMaps = new Dictionary(); @@ -109,16 +110,17 @@ namespace PepperDash.Essentials.Core.Bridges if (device == null) continue; Debug.Console(1, this, "Linking Device: '{0}'", device.Key); - if (device is IBridge) // Check for this first to allow bridges in plugins to override existing bridges that apply to the same type. + /*if (device is IBridge) // Check for this first to allow bridges in plugins to override existing bridges that apply to the same type. { Debug.Console(2, this, "'{0}' is IBridge", device.Key); - (device as IBridge).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - } - else if (device is IBridgeAdvanced) - { - Debug.Console(2, this, "'{0}' is IBridgeAdvanced", device.Key); - (device as IBridgeAdvanced).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey, this); - } + + var dev = device as IBridge; + + dev.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + }*/ + if (!(device is IBridgeAdvanced)) continue; + Debug.Console(2, this, "'{0}' is IBridgeAdvanced", device.Key); + (device as IBridgeAdvanced).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey, this); //if (device.GetType().GetCType().IsAssignableFrom(typeof (IBridge))) //{ // var bridge = device as IBridge; @@ -366,7 +368,7 @@ namespace PepperDash.Essentials.Core.Bridges try { if (Debug.Level >= 1) - Debug.Console(1, this, "EiscApi change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue); + Debug.Console(1, this, "EiscApiAdvanced change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue); var uo = args.Sig.UserObject; if (uo == null) return; From 6b65db55c1133304683789460bcc8a5506a402ba Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 20 Apr 2020 10:10:50 -0600 Subject: [PATCH 049/156] Changes EiscApi to EiscApiAdvanced for internal devices --- .../AppServer/Messengers/SIMPLCameraMessenger.cs | 2 +- .../AppServer/Messengers/SimplMessengerPropertiesConfig.cs | 1 + .../Bridges/JoinMaps/DmTxControllerJoinMap.cs | 4 +++- .../Config/Comm and IR/GenericComm.cs | 4 +--- .../Crestron IO/C2nRts/C2nRthsController.cs | 2 +- .../Crestron IO/Inputs/GenericDigitalInputDevice.cs | 2 +- .../Crestron IO/Relay/GenericRelayDevice.cs | 2 +- .../Crestron IO/StatusSign/StatusSignController.cs | 2 +- .../Crestron/CrestronGenericBaseDevice.cs | 2 +- .../Devices/EssentialsBridgeableDevice.cs | 2 +- .../PepperDashEssentialsBase/Devices/ReconfigurableDevice.cs | 2 +- .../PepperDashEssentialsBase/Display/BasicIrDisplay.cs | 2 +- .../PepperDashEssentialsBase/Display/DisplayBase.cs | 2 +- .../PepperDashEssentialsBase/Display/MockDisplay.cs | 2 +- .../PepperDashEssentialsBase/Lighting/LightingBase.cs | 2 +- .../Monitoring/SystemMonitorController.cs | 2 +- .../Essentials_DM/AirMedia/AirMediaController.cs | 2 +- .../Essentials_DM/Chassis/DmBladeChassisController.cs | 2 +- .../Essentials_DM/Chassis/DmChassisController.cs | 2 +- .../Essentials_DM/Chassis/DmpsAudioOutputController.cs | 2 +- .../Essentials_DM/Chassis/DmpsRoutingController.cs | 2 +- .../Essentials DM/Essentials_DM/DmLite/HdMdxxxCEController.cs | 2 +- .../Essentials_DM/Endpoints/Receivers/DmRmc100SController.cs | 2 +- .../Essentials_DM/Endpoints/Receivers/DmRmc150SController.cs | 2 +- .../Essentials_DM/Endpoints/Receivers/DmRmc200CController.cs | 2 +- .../Essentials_DM/Endpoints/Receivers/DmRmc200S2Controller.cs | 2 +- .../Essentials_DM/Endpoints/Receivers/DmRmc200SController.cs | 2 +- .../Endpoints/Receivers/DmRmc4KScalerCController.cs | 2 +- .../Endpoints/Receivers/DmRmc4kScalerCDspController.cs | 2 +- .../Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs | 2 +- .../Endpoints/Receivers/DmRmcScalerCController.cs | 2 +- .../Endpoints/Receivers/DmRmcScalerS2Controller.cs | 2 +- .../Endpoints/Receivers/DmRmcScalerSController.cs | 2 +- .../Essentials_DM/Endpoints/Receivers/DmRmcX100CController.cs | 2 +- .../Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs | 2 +- .../Endpoints/Transmitters/DmTx201CController.cs | 2 +- .../Endpoints/Transmitters/DmTx401CController.cs | 2 +- .../Endpoints/Transmitters/DmTx4k100Controller.cs | 2 +- .../Endpoints/Transmitters/DmTx4k202CController.cs | 2 +- .../Endpoints/Transmitters/DmTx4k302CController.cs | 2 +- .../Endpoints/Transmitters/DmTx4kz302CController.cs | 2 +- .../Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs | 2 +- .../Essentials Devices Common/Cameras/CameraBase.cs | 2 +- .../Essentials Devices Common/Cameras/CameraVisca.cs | 2 +- .../Essentials Devices Common/Display/AvocorVTFDisplay.cs | 2 +- .../Essentials Devices Common/Display/NECPSXMDisplay.cs | 2 +- .../Essentials Devices Common/Display/NecPaSeriesProjector.cs | 2 +- .../Essentials Devices Common/Display/PanasonicThDisplay.cs | 2 +- .../Essentials Devices Common/Display/SamsungMDCDisplay.cs | 2 +- .../Environment/Lutron/LutronQuantum.cs | 2 +- .../Occupancy/GlsOccupancySensorBaseController.cs | 4 ++-- .../Occupancy/GlsOdtOccupancySensorController.cs | 2 +- .../Power Controllers/Digitallogger.cs | 2 +- .../Essentials Devices Common/SetTopBox/IRSetTopBoxBase.cs | 2 +- .../Essentials Devices Common/Streaming/AppleTV.cs | 2 +- .../VideoCodec/CiscoCodec/CiscoCamera.cs | 4 ++-- .../VideoCodec/MockVC/MockVCCamera.cs | 4 ++-- .../VideoCodec/ZoomRoom/ZoomRoomCamera.cs | 2 +- 58 files changed, 63 insertions(+), 62 deletions(-) diff --git a/PepperDashEssentials/AppServer/Messengers/SIMPLCameraMessenger.cs b/PepperDashEssentials/AppServer/Messengers/SIMPLCameraMessenger.cs index 1d2914dc..9cf6456f 100644 --- a/PepperDashEssentials/AppServer/Messengers/SIMPLCameraMessenger.cs +++ b/PepperDashEssentials/AppServer/Messengers/SIMPLCameraMessenger.cs @@ -8,7 +8,7 @@ using Crestron.SimplSharpPro.EthernetCommunication; using PepperDash.Core; using PepperDash.Essentials.Core; -using PepperDash.Essentials.Core.Bridges; +using PepperDash.Essentials.Bridges; using PepperDash.Essentials.Devices.Common.Cameras; namespace PepperDash.Essentials.AppServer.Messengers diff --git a/PepperDashEssentials/AppServer/Messengers/SimplMessengerPropertiesConfig.cs b/PepperDashEssentials/AppServer/Messengers/SimplMessengerPropertiesConfig.cs index 9ced28dd..4438c457 100644 --- a/PepperDashEssentials/AppServer/Messengers/SimplMessengerPropertiesConfig.cs +++ b/PepperDashEssentials/AppServer/Messengers/SimplMessengerPropertiesConfig.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using Crestron.SimplSharp; +using PepperDash.Essentials.Bridges; using PepperDash.Essentials.Core.Bridges; namespace PepperDash.Essentials.AppServer.Messengers diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmTxControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmTxControllerJoinMap.cs index 49bd7ac5..b01da694 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmTxControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmTxControllerJoinMap.cs @@ -1,4 +1,6 @@ -namespace PepperDash.Essentials.Core.Bridges +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Core.Bridges { public class DmTxControllerJoinMap : JoinMapBase { diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericComm.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericComm.cs index 83861dc8..0b33e619 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericComm.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericComm.cs @@ -1,7 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Text; using Crestron.SimplSharp.CrestronSockets; using Crestron.SimplSharpPro.DeviceSupport; using Newtonsoft.Json; @@ -59,7 +57,7 @@ namespace PepperDash.Essentials.Core ConfigWriter.UpdateDeviceConfig(config); } - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new IBasicCommunicationJoinMap(); diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/C2nRts/C2nRthsController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/C2nRts/C2nRthsController.cs index 43684eb2..d090c3bf 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/C2nRts/C2nRthsController.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/C2nRts/C2nRthsController.cs @@ -42,7 +42,7 @@ namespace PepperDash.Essentials.Core.CrestronIO _device.TemperatureFormat.BoolValue = setToC; } - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new C2nRthsControllerJoinMap(); diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericDigitalInputDevice.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericDigitalInputDevice.cs index feefeaf5..70921314 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericDigitalInputDevice.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericDigitalInputDevice.cs @@ -41,7 +41,7 @@ namespace PepperDash.Essentials.Core.CrestronIO InputStateFeedback.FireUpdate(); } - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new IDigitalInputJoinMap(); diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Relay/GenericRelayDevice.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Relay/GenericRelayDevice.cs index 9db3443e..39a6786b 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Relay/GenericRelayDevice.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Relay/GenericRelayDevice.cs @@ -68,7 +68,7 @@ namespace PepperDash.Essentials.Core.CrestronIO #endregion - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new GenericRelayControllerJoinMap(); diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/StatusSign/StatusSignController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/StatusSign/StatusSignController.cs index 7835db7e..75e24d34 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/StatusSign/StatusSignController.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/StatusSign/StatusSignController.cs @@ -106,7 +106,7 @@ namespace PepperDash.Essentials.Core.CrestronIO } } - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new StatusSignControllerJoinMap(); diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron/CrestronGenericBaseDevice.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron/CrestronGenericBaseDevice.cs index d074a2d4..7866075f 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron/CrestronGenericBaseDevice.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron/CrestronGenericBaseDevice.cs @@ -136,7 +136,7 @@ namespace PepperDash.Essentials.Core } - public abstract void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge); + public abstract void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge); } diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/EssentialsBridgeableDevice.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/EssentialsBridgeableDevice.cs index a4c4ca10..0812ca4e 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/EssentialsBridgeableDevice.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/EssentialsBridgeableDevice.cs @@ -13,6 +13,6 @@ namespace PepperDash.Essentials.Core { } - public abstract void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge); + public abstract void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge); } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/ReconfigurableDevice.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/ReconfigurableDevice.cs index 6719ae06..7b4f1c99 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/ReconfigurableDevice.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/ReconfigurableDevice.cs @@ -68,6 +68,6 @@ namespace PepperDash.Essentials.Core.Devices { } - public abstract void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge); + public abstract void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge); } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/BasicIrDisplay.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/BasicIrDisplay.cs index 740c241d..29dcdd55 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/BasicIrDisplay.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/BasicIrDisplay.cs @@ -203,7 +203,7 @@ namespace PepperDash.Essentials.Core #endregion - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { LinkDisplayToApi(this, trilist, joinStart, joinMapKey, bridge); } diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs index 26fbb2b6..415eed5b 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs @@ -116,7 +116,7 @@ namespace PepperDash.Essentials.Core public abstract void ExecuteSwitch(object selector); protected void LinkDisplayToApi(DisplayBase displayDevice, BasicTriList trilist, uint joinStart, string joinMapKey, - EiscApi bridge) + EiscApiAdvanced bridge) { var inputNumber = 0; var inputKeys = new List(); diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/MockDisplay.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/MockDisplay.cs index fc43174c..8c188997 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/MockDisplay.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/MockDisplay.cs @@ -177,7 +177,7 @@ namespace PepperDash.Essentials.Core #endregion - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { LinkDisplayToApi(this, trilist, joinStart, joinMapKey, bridge); } diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Lighting/LightingBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Lighting/LightingBase.cs index dafe0518..c22745c0 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Lighting/LightingBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Lighting/LightingBase.cs @@ -71,7 +71,7 @@ namespace PepperDash.Essentials.Core.Lighting } protected GenericLightingJoinMap LinkLightingToApi(LightingBase lightingDevice, BasicTriList trilist, uint joinStart, - string joinMapKey, EiscApi bridge) + string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new GenericLightingJoinMap(); diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Monitoring/SystemMonitorController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Monitoring/SystemMonitorController.cs index 2ad8c1b5..3f791467 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Monitoring/SystemMonitorController.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Monitoring/SystemMonitorController.cs @@ -200,7 +200,7 @@ namespace PepperDash.Essentials.Core.Monitoring return base.CustomActivate(); } - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new SystemMonitorJoinMap(); diff --git a/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs b/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs index ad2309c0..1e795857 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs @@ -101,7 +101,7 @@ namespace PepperDash.Essentials.DM.AirMedia return base.CustomActivate(); } - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new AirMediaControllerJoinMap(); diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmBladeChassisController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmBladeChassisController.cs index 15860c90..5ce95c93 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmBladeChassisController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmBladeChassisController.cs @@ -571,7 +571,7 @@ namespace PepperDash.Essentials.DM { #endregion - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new DmBladeChassisControllerJoinMap(); diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs index e546b842..745cdda5 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs @@ -990,7 +990,7 @@ namespace PepperDash.Essentials.DM } #endregion - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new DmChassisControllerJoinMap(); diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsAudioOutputController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsAudioOutputController.cs index 939cb0dc..d330d650 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsAudioOutputController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsAudioOutputController.cs @@ -102,7 +102,7 @@ namespace PepperDash.Essentials.DM } } - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new DmpsAudioOutputControllerJoinMap(); diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs index 499474ac..4c4b256d 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs @@ -154,7 +154,7 @@ namespace PepperDash.Essentials.DM return base.CustomActivate(); } - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new DmpsRoutingControllerJoinMap(); diff --git a/essentials-framework/Essentials DM/Essentials_DM/DmLite/HdMdxxxCEController.cs b/essentials-framework/Essentials DM/Essentials_DM/DmLite/HdMdxxxCEController.cs index 0d002dbf..48074ab9 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/DmLite/HdMdxxxCEController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/DmLite/HdMdxxxCEController.cs @@ -219,7 +219,7 @@ namespace PepperDash.Essentials.DM //public CrestronCollection ComPorts { get { return TxRxPair.ComPorts as CrestronCollection; } } //public int NumberOfComPorts { get { return 1; } } //#endregion - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new HdMdxxxCEControllerJoinMap(); diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc100SController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc100SController.cs index 3ce6dee0..ef70e4f7 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc100SController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc100SController.cs @@ -58,7 +58,7 @@ namespace PepperDash.Essentials.DM return base.CustomActivate(); } - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { LinkDmRmcToApi(this, trilist, joinStart, joinMapKey, bridge); } diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc150SController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc150SController.cs index ea17b8aa..faff23d4 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc150SController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc150SController.cs @@ -97,7 +97,7 @@ namespace PepperDash.Essentials.DM return base.CustomActivate(); } - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { LinkDmRmcToApi(this, trilist, joinStart, joinMapKey, bridge); } diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200CController.cs index a5e977c7..44b1af6c 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200CController.cs @@ -97,7 +97,7 @@ namespace PepperDash.Essentials.DM return base.CustomActivate(); } - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { LinkDmRmcToApi(this, trilist, joinStart, joinMapKey, bridge); } diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200S2Controller.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200S2Controller.cs index 8ac18c49..c30b680f 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200S2Controller.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200S2Controller.cs @@ -97,7 +97,7 @@ namespace PepperDash.Essentials.DM return base.CustomActivate(); } - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { LinkDmRmcToApi(this, trilist, joinStart, joinMapKey, bridge); } diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200SController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200SController.cs index 957efb56..c48850c8 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200SController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200SController.cs @@ -97,7 +97,7 @@ namespace PepperDash.Essentials.DM return base.CustomActivate(); } - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { LinkDmRmcToApi(this, trilist, joinStart, joinMapKey, bridge); } diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4KScalerCController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4KScalerCController.cs index b9d61e34..6595c6e3 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4KScalerCController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4KScalerCController.cs @@ -104,7 +104,7 @@ namespace PepperDash.Essentials.DM return base.CustomActivate(); } - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { LinkDmRmcToApi(this, trilist, joinStart, joinMapKey, bridge); } diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kScalerCDspController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kScalerCDspController.cs index 5be4ab41..8e52822b 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kScalerCDspController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kScalerCDspController.cs @@ -104,7 +104,7 @@ namespace PepperDash.Essentials.DM return base.CustomActivate(); } - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { LinkDmRmcToApi(this, trilist, joinStart, joinMapKey, bridge); } diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs index 09ace234..582234b3 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs @@ -35,7 +35,7 @@ namespace PepperDash.Essentials.DM AddToFeedbackList(VideoOutputResolutionFeedback, EdidManufacturerFeedback, EdidSerialNumberFeedback, EdidNameFeedback, EdidPreferredTimingFeedback); } - protected void LinkDmRmcToApi(DmRmcControllerBase rmc, BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + protected void LinkDmRmcToApi(DmRmcControllerBase rmc, BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new DmRmcControllerJoinMap(); diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerCController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerCController.cs index a43c7ec7..32044d48 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerCController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerCController.cs @@ -97,7 +97,7 @@ namespace PepperDash.Essentials.DM return base.CustomActivate(); } - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { LinkDmRmcToApi(this, trilist, joinStart, joinMapKey, bridge); } diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerS2Controller.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerS2Controller.cs index e85a7c0a..60c3ca07 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerS2Controller.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerS2Controller.cs @@ -97,7 +97,7 @@ namespace PepperDash.Essentials.DM return base.CustomActivate(); } - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { LinkDmRmcToApi(this, trilist, joinStart, joinMapKey, bridge); } diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerSController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerSController.cs index 7da65899..e7b5a132 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerSController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerSController.cs @@ -97,7 +97,7 @@ namespace PepperDash.Essentials.DM return base.CustomActivate(); } - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { LinkDmRmcToApi(this, trilist, joinStart, joinMapKey, bridge); } diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcX100CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcX100CController.cs index ad77df49..a7260813 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcX100CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcX100CController.cs @@ -58,7 +58,7 @@ namespace PepperDash.Essentials.DM return base.CustomActivate(); } - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { LinkDmRmcToApi(this, trilist, joinStart, joinMapKey, bridge); } diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs index 4c2e4ef9..923a7600 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs @@ -218,7 +218,7 @@ namespace PepperDash.Essentials.DM return base.CustomActivate(); } - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { LinkDmTxToApi(this, trilist, joinStart, joinMapKey, bridge); } diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs index 2231494b..e68a6fc5 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs @@ -220,7 +220,7 @@ namespace PepperDash.Essentials.DM return base.CustomActivate(); } - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { LinkDmTxToApi(this, trilist, joinStart, joinMapKey, bridge); } diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs index 8765fd73..25c16281 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs @@ -217,7 +217,7 @@ namespace PepperDash.Essentials.DM return base.CustomActivate(); } - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { LinkDmTxToApi(this, trilist, joinStart, joinMapKey, bridge); } diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k100Controller.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k100Controller.cs index dcd2c4e0..c62d0adf 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k100Controller.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k100Controller.cs @@ -70,7 +70,7 @@ namespace PepperDash.Essentials.DM } - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { LinkDmTxToApi(this, trilist, joinStart, joinMapKey, bridge); } diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k202CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k202CController.cs index 073807b6..1b5ecf6d 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k202CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k202CController.cs @@ -188,7 +188,7 @@ namespace PepperDash.Essentials.DM return base.CustomActivate(); } - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { LinkDmTxToApi(this, trilist, joinStart, joinMapKey, bridge); } diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k302CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k302CController.cs index 010fd06b..5d00a32d 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k302CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k302CController.cs @@ -225,7 +225,7 @@ namespace PepperDash.Essentials.DM return base.CustomActivate(); } - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { LinkDmTxToApi(this, trilist, joinStart, joinMapKey, bridge); } diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz302CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz302CController.cs index 541b9fe8..27340407 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz302CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz302CController.cs @@ -201,7 +201,7 @@ namespace PepperDash.Essentials.DM return base.CustomActivate(); } - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { LinkDmTxToApi(this, trilist, joinStart, joinMapKey, bridge); } diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs index 6a648ea3..ed90ba7f 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs @@ -169,7 +169,7 @@ namespace PepperDash.Essentials.DM } protected void LinkDmTxToApi(DmTxControllerBase tx, BasicTriList trilist, uint joinStart, string joinMapKey, - EiscApi bridge) + EiscApiAdvanced bridge) { var joinMap = new DmTxControllerJoinMap(); diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Cameras/CameraBase.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Cameras/CameraBase.cs index c32bef7d..bb7636db 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Cameras/CameraBase.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Cameras/CameraBase.cs @@ -79,7 +79,7 @@ namespace PepperDash.Essentials.Devices.Common.Cameras } protected void LinkCameraToApi(CameraBase cameraDevice, BasicTriList trilist, uint joinStart, string joinMapKey, - EiscApi bridge) + EiscApiAdvanced bridge) { CameraControllerJoinMap joinMap = new CameraControllerJoinMap(joinStart); diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Cameras/CameraVisca.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Cameras/CameraVisca.cs index 7d5fa182..d95a14cc 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Cameras/CameraVisca.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Cameras/CameraVisca.cs @@ -81,7 +81,7 @@ namespace PepperDash.Essentials.Devices.Common.Cameras return true; } - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { LinkCameraToApi(this, trilist, joinStart, joinMapKey, bridge); } diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/AvocorVTFDisplay.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/AvocorVTFDisplay.cs index 805a3a12..71d8e149 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/AvocorVTFDisplay.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/AvocorVTFDisplay.cs @@ -202,7 +202,7 @@ namespace PepperDash.Essentials.Devices.Displays return true; } - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { LinkDisplayToApi(this, trilist, joinStart, joinMapKey, bridge); } diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/NECPSXMDisplay.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/NECPSXMDisplay.cs index 316d0ed7..b147dcc1 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/NECPSXMDisplay.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/NECPSXMDisplay.cs @@ -153,7 +153,7 @@ namespace PepperDash.Essentials.Devices.Displays return true; } - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { LinkDisplayToApi(this, trilist, joinStart, joinMapKey, bridge); } diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/NecPaSeriesProjector.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/NecPaSeriesProjector.cs index 919b0e94..ae2bf760 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/NecPaSeriesProjector.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/NecPaSeriesProjector.cs @@ -219,7 +219,7 @@ namespace PepperDash.Essentials.Devices.Displays } - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { LinkDisplayToApi(this, trilist, joinStart, joinMapKey, bridge); } diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/PanasonicThDisplay.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/PanasonicThDisplay.cs index a493b517..24ea0841 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/PanasonicThDisplay.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/PanasonicThDisplay.cs @@ -145,7 +145,7 @@ namespace PepperDash.Essentials.Devices.Displays return true; } - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { LinkDisplayToApi(this, trilist, joinStart, joinMapKey, bridge); } diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/SamsungMDCDisplay.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/SamsungMDCDisplay.cs index 4fbce220..111e119e 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/SamsungMDCDisplay.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/SamsungMDCDisplay.cs @@ -149,7 +149,7 @@ namespace PepperDash.Essentials.Devices.Displays return true; } - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { LinkDisplayToApi(this, trilist, joinStart, joinMapKey, bridge); } diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Environment/Lutron/LutronQuantum.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Environment/Lutron/LutronQuantum.cs index a752a5b4..9facbf56 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Environment/Lutron/LutronQuantum.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Environment/Lutron/LutronQuantum.cs @@ -80,7 +80,7 @@ namespace PepperDash.Essentials.Devices.Common.Environment.Lutron return true; } - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = LinkLightingToApi(this, trilist, joinStart, joinMapKey, bridge); diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOccupancySensorBaseController.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOccupancySensorBaseController.cs index 5fe0c8df..5bf35247 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOccupancySensorBaseController.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOccupancySensorBaseController.cs @@ -257,7 +257,7 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy protected void LinkOccSensorToApi(GlsOccupancySensorBaseController occController, BasicTriList trilist, - uint joinStart, string joinMapKey, EiscApi bridge) + uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new GlsOccupancySensorBaseJoinMap(); @@ -360,7 +360,7 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy #endregion } - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { LinkOccSensorToApi(this, trilist, joinStart, joinMapKey, bridge); } diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOdtOccupancySensorController.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOdtOccupancySensorController.cs index 37a2acb4..0134a3d4 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOdtOccupancySensorController.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOdtOccupancySensorController.cs @@ -154,7 +154,7 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy OccSensor.DecrementUsSensitivityInVacantState.BoolValue = pressRelease; } - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { LinkOccSensorToApi(this, trilist, joinStart, joinMapKey, bridge); } diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Power Controllers/Digitallogger.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Power Controllers/Digitallogger.cs index e6ab1fc3..42666045 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Power Controllers/Digitallogger.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Power Controllers/Digitallogger.cs @@ -136,7 +136,7 @@ namespace PepperDash.Essentials.Devices.Common return true; } - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new DigitalLoggerJoinMap(); diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/SetTopBox/IRSetTopBoxBase.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/SetTopBox/IRSetTopBoxBase.cs index 10435180..e5678620 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/SetTopBox/IRSetTopBoxBase.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/SetTopBox/IRSetTopBoxBase.cs @@ -370,7 +370,7 @@ namespace PepperDash.Essentials.Devices.Common #endregion - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new SetTopBoxControllerJoinMap(); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Streaming/AppleTV.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Streaming/AppleTV.cs index 4d17c089..db729ce7 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Streaming/AppleTV.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Streaming/AppleTV.cs @@ -143,7 +143,7 @@ namespace PepperDash.Essentials.Devices.Common #endregion - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new AppleTvJoinMap(); diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoCamera.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoCamera.cs index 0faa5934..20035579 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoCamera.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoCamera.cs @@ -100,7 +100,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco ParentCodec.SendText(string.Format("xCommand Call FarEndControl Camera Stop CallId: {0}", CallId)); } - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { LinkCameraToApi(this, trilist, joinStart, joinMapKey, bridge); } @@ -315,7 +315,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco #endregion - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { LinkCameraToApi(this, trilist, joinStart, joinMapKey, bridge); } diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/MockVC/MockVCCamera.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/MockVC/MockVCCamera.cs index 8bd444ee..23a5c9f5 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/MockVC/MockVCCamera.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/MockVC/MockVCCamera.cs @@ -113,7 +113,7 @@ namespace PepperDash.Essentials.Devices.Common.Cameras #endregion - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { LinkCameraToApi(this, trilist, joinStart, joinMapKey, bridge); } @@ -198,7 +198,7 @@ namespace PepperDash.Essentials.Devices.Common.Cameras #endregion - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { LinkCameraToApi(this, trilist, joinStart, joinMapKey, bridge); } diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ZoomRoomCamera.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ZoomRoomCamera.cs index 037b5104..9ad0936b 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ZoomRoomCamera.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ZoomRoomCamera.cs @@ -200,7 +200,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom #endregion - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge) + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { LinkCameraToApi(this, trilist, joinStart, joinMapKey, bridge); } From 44793f037533a06b53506b91bf9261fc50abfa9b Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 20 Apr 2020 10:11:35 -0600 Subject: [PATCH 050/156] removes IBridge from Essentials Core --- .../PepperDashEssentialsBase/Bridges/IBridge.cs | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/IBridge.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/IBridge.cs index 0a4450d0..1f10e554 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/IBridge.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/IBridge.cs @@ -8,15 +8,6 @@ namespace PepperDash.Essentials.Core.Bridges /// public interface IBridgeAdvanced { - void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApi bridge); - } - - /// - /// Defines a device that uses the legacy JoinMapBase for its join map - /// - [Obsolete("IBridgeAdvanced should be used going forward with JoinMapBaseAdvanced")] - public interface IBridge - { - void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey); + void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge); } } \ No newline at end of file From 204b3a4d4de9de7c05f2f5f9ce8ef8d37632078b Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 20 Apr 2020 10:12:09 -0600 Subject: [PATCH 051/156] adds type for EiscApiAdvanced and builder for EiscApi --- PepperDashEssentials/Bridges/BridgeFactory.cs | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/PepperDashEssentials/Bridges/BridgeFactory.cs b/PepperDashEssentials/Bridges/BridgeFactory.cs index d9b34755..e3fc14f3 100644 --- a/PepperDashEssentials/Bridges/BridgeFactory.cs +++ b/PepperDashEssentials/Bridges/BridgeFactory.cs @@ -6,10 +6,11 @@ using Crestron.SimplSharp; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Config; using PepperDash.Core; using PepperDash.Essentials.Core.Routing; -using PepperDash.Essentials.Core.Bridges; +using PepperDash.Essentials.Bridges; using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.EthernetCommunication; @@ -21,23 +22,16 @@ namespace PepperDash.Essentials { // ? why is this static JTA 2018-06-13? - var key = dc.Key; - var name = dc.Name; - var type = dc.Type; - var properties = dc.Properties; - var propAnon = new { }; - var typeName = dc.Type.ToLower(); - var groupName = dc.Group.ToLower(); //Debug.Console(2, "Name {0}, Key {1}, Type {2}, Properties {3}", name, key, type, properties.ToString()); - if (typeName == "eiscapi") + if (typeName == "eiscapiadv" || typeName == "eiscapiadvanced") { - return new EiscApi(dc); + return new EiscApiAdvanced(dc); } - return null; + return typeName == "eiscapi" ? new EiscApi(dc) : null; } } From 7bfc3b35f6400a8d0f70e1b0377f6de9f5c1127c Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 20 Apr 2020 10:12:23 -0600 Subject: [PATCH 052/156] Moves original EiscApi back to Essentials --- PepperDashEssentials/Bridges/EiscBridge.cs | 326 +++++++++++++++++++++ 1 file changed, 326 insertions(+) create mode 100644 PepperDashEssentials/Bridges/EiscBridge.cs diff --git a/PepperDashEssentials/Bridges/EiscBridge.cs b/PepperDashEssentials/Bridges/EiscBridge.cs new file mode 100644 index 00000000..ed28bbfe --- /dev/null +++ b/PepperDashEssentials/Bridges/EiscBridge.cs @@ -0,0 +1,326 @@ +using System; +using System.Collections.Generic; +using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro.EthernetCommunication; +using PepperDash.Core; +using PepperDash.Essentials.Bridges; +using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; +using PepperDash.Essentials.Core.Config; + +namespace PepperDash.Essentials.Bridges +{ + [Obsolete("Please use 'eiscapiadvanced' in configurations going forward")] + public class EiscApi : BridgeApi + { + public EiscApiPropertiesConfig PropertiesConfig { get; private set; } + + protected Dictionary JoinMaps { get; private set; } + + public ThreeSeriesTcpIpEthernetIntersystemCommunications Eisc { get; private set; } + + public EiscApi(DeviceConfig dc) : + base(dc.Key) + { + JoinMaps = new Dictionary(); + + PropertiesConfig = dc.Properties.ToObject(); + //PropertiesConfig = JsonConvert.DeserializeObject(dc.Properties.ToString()); + + Eisc = new ThreeSeriesTcpIpEthernetIntersystemCommunications(PropertiesConfig.Control.IpIdInt, PropertiesConfig.Control.TcpSshProperties.Address, Global.ControlSystem); + + Eisc.SigChange += Eisc_SigChange; + + Eisc.Register(); + + AddPostActivationAction(() => + { + Debug.Console(1, this, "Linking Devices..."); + + foreach (var d in PropertiesConfig.Devices) + { + var device = DeviceManager.GetDeviceForKey(d.DeviceKey); + + if (device == null) continue; + + Debug.Console(1, this, "Linking Device: '{0}'", device.Key); + if (device is IBridge) // Check for this first to allow bridges in plugins to override existing bridges that apply to the same type. + { + Debug.Console(2, this, "'{0}' is IBridge", device.Key); + + var dev = device as IBridge; + + dev.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + } + if (!(device is IBridgeAdvanced)) continue; + Debug.Console(2, this, "'{0}' is IBridgeAdvanced", device.Key); + + var advDev = device as IBridgeAdvanced; + advDev.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey, null); + //if (device.GetType().GetCType().IsAssignableFrom(typeof (IBridge))) + //{ + // var bridge = device as IBridge; + + // if (bridge == null) + // continue; + // Debug.Console(2, this, "Linking device {0} as IBridge"); + // bridge.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + // continue; + //} + + //if (!device.GetType().GetCType().IsAssignableFrom(typeof (IBridgeAdvanced))) continue; + + //var bridgeAdvanced = device as IBridgeAdvanced; + + //if (bridgeAdvanced == null) continue; + //Debug.Console(2, this, "Linking device {0} as IBridgeAdvanced"); + //bridgeAdvanced.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey, this); + } + Debug.Console(1, this, "Devices Linked."); + // + //else if (device is PepperDash.Essentials.Core.Monitoring.SystemMonitorController) + //{ + // (device as PepperDash.Essentials.Core.Monitoring.SystemMonitorController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + // continue; + //} + //else if (device is GenericComm) + //{ + // (device as GenericComm).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + // continue; + //} + //else if (device is CameraBase) + //{ + // (device as CameraBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey, this); + // continue; + //} + //else if (device is PepperDash.Essentials.Core.DisplayBase) + //{ + // (device as DisplayBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + // continue; + //} + //else if (device is DmChassisController) + //{ + // (device as DmChassisController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + // continue; + //} + //else if (device is DmBladeChassisController) + //{ + // (device as DmBladeChassisController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + // continue; + //} + //else if (device is DmpsRoutingController) + //{ + // (device as DmpsRoutingController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + // continue; + //} + //else if (device is DmpsAudioOutputController) + //{ + // (device as DmpsAudioOutputController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + // continue; + //} + //else if (device is DmTxControllerBase) + //{ + // (device as DmTxControllerBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + // continue; + //} + //else if (device is DmRmcControllerBase) + //{ + // (device as DmRmcControllerBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + // continue; + //} + //else if (device is GenericRelayDevice) + //{ + // (device as GenericRelayDevice).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + // continue; + //} + //else if (device is IRSetTopBoxBase) + //{ + // (device as IRSetTopBoxBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + // continue; + //} + //else if (device is IDigitalInput) + //{ + // (device as IDigitalInput).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + // continue; + //} + //else if (device is AppleTV) + //{ + // (device as AppleTV).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + // continue; + //} + //else if (device is HdMdxxxCEController) + //{ + // (device as HdMdxxxCEController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + // continue; + //} + //else if (device is LightingBase) + //{ + // (device as LightingBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + // continue; + //} + //else if (device is DigitalLogger) + //{ + // (device as DigitalLogger).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + // continue; + //} + //else if (device is PepperDash.Essentials.Devices.Common.Occupancy.GlsOccupancySensorBaseController) + //{ + // (device as PepperDash.Essentials.Devices.Common.Occupancy.GlsOccupancySensorBaseController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + // continue; + //} + //else if (device is StatusSignController) + //{ + // (device as StatusSignController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + // continue; + //} + //else if (device is C2nRthsController) + //{ + // (device as C2nRthsController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + // continue; + //} + //} + + + }); + } + + /// + /// Adds a join map + /// + /// + /// + public void AddJoinMap(string deviceKey, JoinMapBaseAdvanced joinMap) + { + if (!JoinMaps.ContainsKey(deviceKey)) + { + JoinMaps.Add(deviceKey, joinMap); + } + else + { + Debug.Console(2, this, "Unable to add join map with key '{0}'. Key already exists in JoinMaps dictionary", deviceKey); + } + } + + /// + /// Prints all the join maps on this bridge + /// + public void PrintJoinMaps() + { + Debug.Console(0, this, "Join Maps for EISC IPID: {0}", Eisc.ID.ToString("X")); + + foreach (var joinMap in JoinMaps) + { + Debug.Console(0, "Join map for device '{0}':", joinMap.Key); + joinMap.Value.PrintJoinMapInfo(); + } + } + + /// + /// Prints the join map for a device by key + /// + /// + public void PrintJoinMapForDevice(string deviceKey) + { + var joinMap = JoinMaps[deviceKey]; + + if (joinMap == null) + { + Debug.Console(0, this, "Unable to find joinMap for device with key: '{0}'", deviceKey); + return; + } + + Debug.Console(0, "Join map for device '{0}' on EISC '{1}':", deviceKey, Key); + joinMap.PrintJoinMapInfo(); + } + + /// + /// Used for debugging to trigger an action based on a join number and type + /// + /// + /// + /// + public void ExecuteJoinAction(uint join, string type, object state) + { + try + { + switch (type.ToLower()) + { + case "digital": + { + var uo = Eisc.BooleanOutput[join].UserObject as Action; + if (uo != null) + { + Debug.Console(1, this, "Executing Action: {0}", uo.ToString()); + uo(Convert.ToBoolean(state)); + } + else + Debug.Console(1, this, "User Action is null. Nothing to Execute"); + break; + } + case "analog": + { + var uo = Eisc.BooleanOutput[join].UserObject as Action; + if (uo != null) + { + Debug.Console(1, this, "Executing Action: {0}", uo.ToString()); + uo(Convert.ToUInt16(state)); + } + else + Debug.Console(1, this, "User Action is null. Nothing to Execute"); break; + } + case "serial": + { + var uo = Eisc.BooleanOutput[join].UserObject as Action; + if (uo != null) + { + Debug.Console(1, this, "Executing Action: {0}", uo.ToString()); + uo(Convert.ToString(state)); + } + else + Debug.Console(1, this, "User Action is null. Nothing to Execute"); + break; + } + default: + { + Debug.Console(1, "Unknown join type. Use digital/serial/analog"); + break; + } + } + } + catch (Exception e) + { + Debug.Console(1, this, "Error: {0}", e); + } + + } + + /// + /// Handles incoming sig changes + /// + /// + /// + void Eisc_SigChange(object currentDevice, SigEventArgs args) + { + try + { + if (Debug.Level >= 1) + Debug.Console(1, this, "EiscApiAdvanced change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue); + var uo = args.Sig.UserObject; + + if (uo == null) return; + + Debug.Console(1, this, "Executing Action: {0}", uo.ToString()); + if (uo is Action) + (uo as Action)(args.Sig.BoolValue); + else if (uo is Action) + (uo as Action)(args.Sig.UShortValue); + else if (uo is Action) + (uo as Action)(args.Sig.StringValue); + } + catch (Exception e) + { + Debug.Console(2, this, "Error in Eisc_SigChange handler: {0}", e); + } + } + } +} \ No newline at end of file From 072618f981daefb9f37a2c41aa34065ad7d4c829 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 20 Apr 2020 10:12:33 -0600 Subject: [PATCH 053/156] moves IBridge back to Essentials --- PepperDashEssentials/Bridges/IBridge.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/PepperDashEssentials/Bridges/IBridge.cs b/PepperDashEssentials/Bridges/IBridge.cs index a8b0a893..497985c7 100644 --- a/PepperDashEssentials/Bridges/IBridge.cs +++ b/PepperDashEssentials/Bridges/IBridge.cs @@ -1,4 +1,5 @@ using System; +using Crestron.SimplSharpPro.DeviceSupport; namespace PepperDash.Essentials.Bridges { @@ -6,7 +7,8 @@ namespace PepperDash.Essentials.Bridges /// Defines a device that uses the legacy JoinMapBase for its join map /// [Obsolete("IBridgeAdvanced should be used going forward with JoinMapBaseAdvanced")] - public interface IBridge: Core.Bridges.IBridge + public interface IBridge { + void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey); } } \ No newline at end of file From 91963ea39bee23391216a0546bcef30efc143b43 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 20 Apr 2020 10:13:08 -0600 Subject: [PATCH 054/156] duplicated join maps in Essentials and marks the duplicates in Essentials as Obsolete --- .../JoinMaps/AirMediaControllerJoinMap.cs | 1 + .../Bridges/JoinMaps/AppleTvJoinMap.cs | 68 +++++++++++++++++++ .../JoinMaps/C2nRthsControllerJoinMap.cs | 45 ++++++++++++ .../JoinMaps/CameraControllerJoinMap.cs | 2 + .../Bridges/JoinMaps/DigitalLoggerJoinMap.cs | 1 + .../JoinMaps/DisplayControllerJoinMap.cs | 1 + .../DmBladeChassisControllerJoinMap.cs | 1 + .../JoinMaps/DmChassisControllerJoinMap.cs | 1 + .../JoinMaps/DmRmcControllerJoinMap.cs | 1 + .../Bridges/JoinMaps/DmTxControllerJoinMap.cs | 4 +- .../DmpsAudioOutputControllerJoinMap.cs | 1 + .../JoinMaps/DmpsRoutingControllerJoinMap.cs | 1 + .../JoinMaps/GenericLightingJoinMap.cs | 1 + .../JoinMaps/GenericRelayControllerJoinMap.cs | 1 + .../JoinMaps/GlsOccupancySensorBaseJoinMap.cs | 1 + .../JoinMaps/HdMdxxxCEControllerJoinMap.cs | 1 + .../JoinMaps/IBasicCommunicationJoinMap.cs | 1 + .../Bridges/JoinMaps/IDigitalInputJoinMap.cs | 1 + .../JoinMaps/SetTopBoxControllerJoinMap.cs | 1 + .../JoinMaps/StatusSignControllerJoinMap.cs | 4 +- .../Bridges/JoinMaps/SystemMonitorJoinMap.cs | 4 +- 21 files changed, 139 insertions(+), 3 deletions(-) create mode 100644 PepperDashEssentials/Bridges/JoinMaps/AppleTvJoinMap.cs create mode 100644 PepperDashEssentials/Bridges/JoinMaps/C2nRthsControllerJoinMap.cs diff --git a/PepperDashEssentials/Bridges/JoinMaps/AirMediaControllerJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/AirMediaControllerJoinMap.cs index 042a3bf3..5b02c05b 100644 --- a/PepperDashEssentials/Bridges/JoinMaps/AirMediaControllerJoinMap.cs +++ b/PepperDashEssentials/Bridges/JoinMaps/AirMediaControllerJoinMap.cs @@ -7,6 +7,7 @@ using PepperDash.Essentials.Core; namespace PepperDash.Essentials.Bridges { + [Obsolete("Please use version PepperDash.Essentials.Core.Bridges")] public class AirMediaControllerJoinMap : JoinMapBase { #region Digitals diff --git a/PepperDashEssentials/Bridges/JoinMaps/AppleTvJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/AppleTvJoinMap.cs new file mode 100644 index 00000000..ac84ee31 --- /dev/null +++ b/PepperDashEssentials/Bridges/JoinMaps/AppleTvJoinMap.cs @@ -0,0 +1,68 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Bridges +{ + [Obsolete("Please use version PepperDash.Essentials.Core.Bridges")] + public class AppleTvJoinMap : JoinMapBase + { + #region Digitals + /// + /// Sends up arrow command while high + /// + public uint UpArrow { get; set; } + /// + /// Sends down arrow command while high + /// + public uint DnArrow { get; set; } + /// + /// Sends left arrow command while high + /// + public uint LeftArrow { get; set; } + /// + /// Sends right arrow command while high + /// + public uint RightArrow { get; set; } + /// + /// Sends menu command + /// + public uint Menu { get; set; } + /// + /// Sends select command + /// + public uint Select { get; set; } + /// + /// Sends play/pause command + /// + public uint PlayPause { get; set; } + #endregion + + public AppleTvJoinMap() + { + UpArrow = 1; + DnArrow = 2; + LeftArrow = 3; + RightArrow = 4; + Menu = 5; + Select = 6; + PlayPause = 7; + } + + public override void OffsetJoinNumbers(uint joinStart) + { + var joinOffset = joinStart - 1; + + UpArrow = UpArrow + joinOffset; + DnArrow = DnArrow + joinOffset; + LeftArrow = LeftArrow + joinOffset; + RightArrow = RightArrow + joinOffset; + Menu = Menu + joinOffset; + Select = Select + joinOffset; + PlayPause = PlayPause + joinOffset; + } + } +} \ No newline at end of file diff --git a/PepperDashEssentials/Bridges/JoinMaps/C2nRthsControllerJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/C2nRthsControllerJoinMap.cs new file mode 100644 index 00000000..bbf8268d --- /dev/null +++ b/PepperDashEssentials/Bridges/JoinMaps/C2nRthsControllerJoinMap.cs @@ -0,0 +1,45 @@ +using System; +using System.Linq; +using Crestron.SimplSharp.Reflection; +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Bridges +{ + [Obsolete("Please use version PepperDash.Essentials.Core.Bridges")] + public class C2nRthsControllerJoinMap:JoinMapBase + { + public uint IsOnline { get; set; } + public uint Name { get; set; } + public uint Temperature { get; set; } + public uint Humidity { get; set; } + public uint TemperatureFormat { get; set; } + + public C2nRthsControllerJoinMap() + { + //digital + IsOnline = 1; + TemperatureFormat = 2; + + //Analog + Temperature = 2; + Humidity = 3; + + //serial + Name = 1; + + + } + + public override void OffsetJoinNumbers(uint joinStart) + { + var joinOffset = joinStart - 1; + var properties = + GetType().GetCType().GetProperties().Where(p => p.PropertyType == typeof(uint)).ToList(); + + foreach (var propertyInfo in properties) + { + propertyInfo.SetValue(this, (uint)propertyInfo.GetValue(this, null) + joinOffset, null); + } + } + } +} \ No newline at end of file diff --git a/PepperDashEssentials/Bridges/JoinMaps/CameraControllerJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/CameraControllerJoinMap.cs index 5a37892f..1546ff23 100644 --- a/PepperDashEssentials/Bridges/JoinMaps/CameraControllerJoinMap.cs +++ b/PepperDashEssentials/Bridges/JoinMaps/CameraControllerJoinMap.cs @@ -11,6 +11,8 @@ namespace PepperDash.Essentials.Bridges /// /// Join map for CameraBase devices /// + /// + [Obsolete("Please use version PepperDash.Essentials.Core.Bridges")] public class CameraControllerJoinMap : JoinMapBaseAdvanced { [JoinName("TiltUp")] diff --git a/PepperDashEssentials/Bridges/JoinMaps/DigitalLoggerJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/DigitalLoggerJoinMap.cs index 2b0a1c15..3f4c8c43 100644 --- a/PepperDashEssentials/Bridges/JoinMaps/DigitalLoggerJoinMap.cs +++ b/PepperDashEssentials/Bridges/JoinMaps/DigitalLoggerJoinMap.cs @@ -8,6 +8,7 @@ using PepperDash.Essentials.Core; namespace PepperDash.Essentials.Bridges { + [Obsolete("Please use version PepperDash.Essentials.Core.Bridges")] public class DigitalLoggerJoinMap : JoinMapBase { public uint IsOnline { get; set; } diff --git a/PepperDashEssentials/Bridges/JoinMaps/DisplayControllerJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/DisplayControllerJoinMap.cs index ddbec182..48671d24 100644 --- a/PepperDashEssentials/Bridges/JoinMaps/DisplayControllerJoinMap.cs +++ b/PepperDashEssentials/Bridges/JoinMaps/DisplayControllerJoinMap.cs @@ -7,6 +7,7 @@ using PepperDash.Essentials.Core; namespace PepperDash.Essentials.Bridges { + [Obsolete("Please use version PepperDash.Essentials.Core.Bridges")] public class DisplayControllerJoinMap : JoinMapBase { #region Digitals diff --git a/PepperDashEssentials/Bridges/JoinMaps/DmBladeChassisControllerJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/DmBladeChassisControllerJoinMap.cs index 8a245ad2..0779523a 100644 --- a/PepperDashEssentials/Bridges/JoinMaps/DmBladeChassisControllerJoinMap.cs +++ b/PepperDashEssentials/Bridges/JoinMaps/DmBladeChassisControllerJoinMap.cs @@ -6,6 +6,7 @@ using Crestron.SimplSharp; using PepperDash.Essentials.Core; namespace PepperDash.Essentials.Bridges { + [Obsolete("Please use version PepperDash.Essentials.Core.Bridges")] public class DmBladeChassisControllerJoinMap : JoinMapBase { #region Digital/Analogs #endregion diff --git a/PepperDashEssentials/Bridges/JoinMaps/DmChassisControllerJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/DmChassisControllerJoinMap.cs index ff6a42d9..2e1b8394 100644 --- a/PepperDashEssentials/Bridges/JoinMaps/DmChassisControllerJoinMap.cs +++ b/PepperDashEssentials/Bridges/JoinMaps/DmChassisControllerJoinMap.cs @@ -7,6 +7,7 @@ using PepperDash.Essentials.Core; namespace PepperDash.Essentials.Bridges { + [Obsolete("Please use version PepperDash.Essentials.Core.Bridges")] public class DmChassisControllerJoinMap : JoinMapBase { #region Digital/Analogs diff --git a/PepperDashEssentials/Bridges/JoinMaps/DmRmcControllerJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/DmRmcControllerJoinMap.cs index 7aa8081a..7e1534bf 100644 --- a/PepperDashEssentials/Bridges/JoinMaps/DmRmcControllerJoinMap.cs +++ b/PepperDashEssentials/Bridges/JoinMaps/DmRmcControllerJoinMap.cs @@ -7,6 +7,7 @@ using PepperDash.Essentials.Core; namespace PepperDash.Essentials.Bridges { + [Obsolete("Please use version PepperDash.Essentials.Core.Bridges")] public class DmRmcControllerJoinMap : JoinMapBase { #region Digitals diff --git a/PepperDashEssentials/Bridges/JoinMaps/DmTxControllerJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/DmTxControllerJoinMap.cs index 6d5c2775..f84134a1 100644 --- a/PepperDashEssentials/Bridges/JoinMaps/DmTxControllerJoinMap.cs +++ b/PepperDashEssentials/Bridges/JoinMaps/DmTxControllerJoinMap.cs @@ -1,7 +1,9 @@ -using PepperDash.Essentials.Core; +using System; +using PepperDash.Essentials.Core; namespace PepperDash.Essentials.Bridges { + [Obsolete("Please use version PepperDash.Essentials.Core.Bridges")] public class DmTxControllerJoinMap : JoinMapBase { #region Digitals diff --git a/PepperDashEssentials/Bridges/JoinMaps/DmpsAudioOutputControllerJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/DmpsAudioOutputControllerJoinMap.cs index faa30775..47c7d50d 100644 --- a/PepperDashEssentials/Bridges/JoinMaps/DmpsAudioOutputControllerJoinMap.cs +++ b/PepperDashEssentials/Bridges/JoinMaps/DmpsAudioOutputControllerJoinMap.cs @@ -7,6 +7,7 @@ using PepperDash.Essentials.Core; namespace PepperDash.Essentials.Bridges { + [Obsolete("Please use version PepperDash.Essentials.Core.Bridges")] public class DmpsAudioOutputControllerJoinMap : JoinMapBase { #region Digital/Analog diff --git a/PepperDashEssentials/Bridges/JoinMaps/DmpsRoutingControllerJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/DmpsRoutingControllerJoinMap.cs index ba3a8cd0..308dddf0 100644 --- a/PepperDashEssentials/Bridges/JoinMaps/DmpsRoutingControllerJoinMap.cs +++ b/PepperDashEssentials/Bridges/JoinMaps/DmpsRoutingControllerJoinMap.cs @@ -7,6 +7,7 @@ using PepperDash.Essentials.Core; namespace PepperDash.Essentials.Bridges { + [Obsolete("Please use version PepperDash.Essentials.Core.Bridges")] public class DmpsRoutingControllerJoinMap : JoinMapBase { #region Digitals diff --git a/PepperDashEssentials/Bridges/JoinMaps/GenericLightingJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/GenericLightingJoinMap.cs index df5606d0..3bc9b19a 100644 --- a/PepperDashEssentials/Bridges/JoinMaps/GenericLightingJoinMap.cs +++ b/PepperDashEssentials/Bridges/JoinMaps/GenericLightingJoinMap.cs @@ -9,6 +9,7 @@ using PepperDash.Essentials.Core; namespace PepperDash.Essentials.Bridges { + [Obsolete("Please use version PepperDash.Essentials.Core.Bridges")] public class GenericLightingJoinMap : JoinMapBase { public uint IsOnline { get; set; } diff --git a/PepperDashEssentials/Bridges/JoinMaps/GenericRelayControllerJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/GenericRelayControllerJoinMap.cs index 5c91a358..56b50724 100644 --- a/PepperDashEssentials/Bridges/JoinMaps/GenericRelayControllerJoinMap.cs +++ b/PepperDashEssentials/Bridges/JoinMaps/GenericRelayControllerJoinMap.cs @@ -7,6 +7,7 @@ using PepperDash.Essentials.Core; namespace PepperDash.Essentials.Bridges { + [Obsolete("Please use version PepperDash.Essentials.Core.Bridges")] public class GenericRelayControllerJoinMap : JoinMapBase { #region Digitals diff --git a/PepperDashEssentials/Bridges/JoinMaps/GlsOccupancySensorBaseJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/GlsOccupancySensorBaseJoinMap.cs index a40913ee..800f516c 100644 --- a/PepperDashEssentials/Bridges/JoinMaps/GlsOccupancySensorBaseJoinMap.cs +++ b/PepperDashEssentials/Bridges/JoinMaps/GlsOccupancySensorBaseJoinMap.cs @@ -7,6 +7,7 @@ using PepperDash.Essentials.Core; namespace PepperDash.Essentials.Bridges { + [Obsolete("Please use version PepperDash.Essentials.Core.Bridges")] public class GlsOccupancySensorBaseJoinMap : JoinMapBase { #region Digitals diff --git a/PepperDashEssentials/Bridges/JoinMaps/HdMdxxxCEControllerJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/HdMdxxxCEControllerJoinMap.cs index e88980fe..d9fad27e 100644 --- a/PepperDashEssentials/Bridges/JoinMaps/HdMdxxxCEControllerJoinMap.cs +++ b/PepperDashEssentials/Bridges/JoinMaps/HdMdxxxCEControllerJoinMap.cs @@ -7,6 +7,7 @@ using PepperDash.Essentials.Core; namespace PepperDash.Essentials.Bridges { + [Obsolete("Please use version PepperDash.Essentials.Core.Bridges")] public class HdMdxxxCEControllerJoinMap : JoinMapBase { #region Digitals diff --git a/PepperDashEssentials/Bridges/JoinMaps/IBasicCommunicationJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/IBasicCommunicationJoinMap.cs index 953bae37..c8939ef8 100644 --- a/PepperDashEssentials/Bridges/JoinMaps/IBasicCommunicationJoinMap.cs +++ b/PepperDashEssentials/Bridges/JoinMaps/IBasicCommunicationJoinMap.cs @@ -7,6 +7,7 @@ using PepperDash.Essentials.Core; namespace PepperDash.Essentials.Bridges { + [Obsolete("Please use version PepperDash.Essentials.Core.Bridges")] public class IBasicCommunicationJoinMap : JoinMapBase { #region Digitals diff --git a/PepperDashEssentials/Bridges/JoinMaps/IDigitalInputJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/IDigitalInputJoinMap.cs index 65d4ada4..a4c4aaa9 100644 --- a/PepperDashEssentials/Bridges/JoinMaps/IDigitalInputJoinMap.cs +++ b/PepperDashEssentials/Bridges/JoinMaps/IDigitalInputJoinMap.cs @@ -7,6 +7,7 @@ using PepperDash.Essentials.Core; namespace PepperDash.Essentials.Bridges { + [Obsolete("Please use version PepperDash.Essentials.Core.Bridges")] public class IDigitalInputJoinMap : JoinMapBase { #region Digitals diff --git a/PepperDashEssentials/Bridges/JoinMaps/SetTopBoxControllerJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/SetTopBoxControllerJoinMap.cs index 36e5b2da..20b0d9a9 100644 --- a/PepperDashEssentials/Bridges/JoinMaps/SetTopBoxControllerJoinMap.cs +++ b/PepperDashEssentials/Bridges/JoinMaps/SetTopBoxControllerJoinMap.cs @@ -9,6 +9,7 @@ using Crestron.SimplSharp.Reflection; namespace PepperDash.Essentials.Bridges { + [Obsolete("Please use version PepperDash.Essentials.Core.Bridges")] public class SetTopBoxControllerJoinMap : JoinMapBase { #region Digitals diff --git a/PepperDashEssentials/Bridges/JoinMaps/StatusSignControllerJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/StatusSignControllerJoinMap.cs index ad8f1577..3d8916a7 100644 --- a/PepperDashEssentials/Bridges/JoinMaps/StatusSignControllerJoinMap.cs +++ b/PepperDashEssentials/Bridges/JoinMaps/StatusSignControllerJoinMap.cs @@ -1,9 +1,11 @@ -using System.Linq; +using System; +using System.Linq; using Crestron.SimplSharp.Reflection; using PepperDash.Essentials.Core; namespace PepperDash.Essentials.Bridges { + [Obsolete("Please use version PepperDash.Essentials.Core.Bridges")] public class StatusSignControllerJoinMap:JoinMapBase { public uint IsOnline { get; set; } diff --git a/PepperDashEssentials/Bridges/JoinMaps/SystemMonitorJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/SystemMonitorJoinMap.cs index b2b66263..fe59416a 100644 --- a/PepperDashEssentials/Bridges/JoinMaps/SystemMonitorJoinMap.cs +++ b/PepperDashEssentials/Bridges/JoinMaps/SystemMonitorJoinMap.cs @@ -1,7 +1,9 @@ -using PepperDash.Essentials.Core; +using System; +using PepperDash.Essentials.Core; namespace PepperDash.Essentials.Bridges { + [Obsolete("Please use version PepperDash.Essentials.Core.Bridges")] public class SystemMonitorJoinMap : JoinMapBase { /// From c7e33b5682a529cb0814c8df52490ab23e33670e Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 20 Apr 2020 10:13:23 -0600 Subject: [PATCH 055/156] fixes namespaces in ControlSystem.cs --- PepperDashEssentials/ControlSystem.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/PepperDashEssentials/ControlSystem.cs b/PepperDashEssentials/ControlSystem.cs index 3b603038..3357a464 100644 --- a/PepperDashEssentials/ControlSystem.cs +++ b/PepperDashEssentials/ControlSystem.cs @@ -10,6 +10,7 @@ using Crestron.SimplSharp.Reflection; using PepperDash.Core; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Devices.Common; using PepperDash.Essentials.DM; @@ -51,7 +52,7 @@ namespace PepperDash.Essentials CrestronConsole.AddNewConsoleCommand(PepperDash.Essentials.Core.DeviceFactory.GetDeviceFactoryTypes, "gettypes", "Gets the device types that can be built. Accepts a filter string.", ConsoleAccessLevelEnum.AccessOperator); - CrestronConsole.AddNewConsoleCommand(Core.Bridges.BridgeHelper.PrintJoinMap, "getjoinmap", "map(s) for bridge or device on bridge [brKey [devKey]]", ConsoleAccessLevelEnum.AccessOperator); + CrestronConsole.AddNewConsoleCommand(BridgeHelper.PrintJoinMap, "getjoinmap", "map(s) for bridge or device on bridge [brKey [devKey]]", ConsoleAccessLevelEnum.AccessOperator); CrestronConsole.AddNewConsoleCommand(s => { From 563f690277674b19e90f94697ad1c7c0ef9332ef Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 20 Apr 2020 12:21:18 -0600 Subject: [PATCH 056/156] adds try/catch for Null Reference Exceptions --- PepperDashEssentials/Bridges/EiscBridge.cs | 11 ++++++++++- .../PepperDashEssentialsBase/Plugins/PluginLoader.cs | 3 ++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/PepperDashEssentials/Bridges/EiscBridge.cs b/PepperDashEssentials/Bridges/EiscBridge.cs index ed28bbfe..fe592e45 100644 --- a/PepperDashEssentials/Bridges/EiscBridge.cs +++ b/PepperDashEssentials/Bridges/EiscBridge.cs @@ -56,7 +56,16 @@ namespace PepperDash.Essentials.Bridges Debug.Console(2, this, "'{0}' is IBridgeAdvanced", device.Key); var advDev = device as IBridgeAdvanced; - advDev.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey, null); + + try + { + advDev.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey, null); + } + catch (NullReferenceException) + { + Debug.ConsoleWithLog(0, this, + "Please update the bridge config to use EiscBridgeAdvanced with this device: {0}", device.Key); + } //if (device.GetType().GetCType().IsAssignableFrom(typeof (IBridge))) //{ // var bridge = device as IBridge; diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Plugins/PluginLoader.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Plugins/PluginLoader.cs index c0d84714..3e08d698 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Plugins/PluginLoader.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Plugins/PluginLoader.cs @@ -360,7 +360,8 @@ namespace PepperDash.Essentials } catch (Exception e) { - Debug.Console(2, "Load Plugin not found. {0} is not a plugin assembly. Exception: {1}", loadedAssembly.Name, e); + Debug.Console(2, "Load Plugin not found. {0}.{2} is not a plugin factory. Exception: {1}", + loadedAssembly.Name, e, type.Name); continue; } From c5232ca6b8ae992e65e2ffe85abfbaecbbad3343 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Wed, 15 Apr 2020 18:07:22 -0600 Subject: [PATCH 057/156] Updates device factory methodology for Essentials Core and Essential DM libraries --- PepperDashEssentials/ControlSystem.cs | 3 +- .../Crestron IO/C2nRts/C2nRthsController.cs | 25 +++++- .../Inputs/CenIoDigIn104Controller.cs | 23 ++++- .../StatusSign/StatusSignController.cs | 22 ++++- .../Devices/EssentialsDevice.cs | 2 +- .../Factory/DeviceFactory.cs | 44 +++------ .../AirMedia/AirMediaController.cs | 25 ++++++ .../Chassis/DmChassisController.cs | 40 ++++++++- .../Essentials_DM/Config/DeviceFactory.cs | 90 ++++--------------- .../DmLite/HdMdxxxCEController.cs | 37 ++++++++ .../Endpoints/Receivers/DmRmcHelper.cs | 22 +++++ .../Endpoints/Transmitters/DmTxHelpers.cs | 33 +++++-- 12 files changed, 242 insertions(+), 124 deletions(-) diff --git a/PepperDashEssentials/ControlSystem.cs b/PepperDashEssentials/ControlSystem.cs index 3357a464..db10c959 100644 --- a/PepperDashEssentials/ControlSystem.cs +++ b/PepperDashEssentials/ControlSystem.cs @@ -365,10 +365,9 @@ namespace PepperDash.Essentials // Then associated library factories if (newDev == null) newDev = PepperDash.Essentials.Core.DeviceFactory.GetDevice(devConf); + if (newDev == null) newDev = PepperDash.Essentials.Devices.Common.DeviceFactory.GetDevice(devConf); - if (newDev == null) - newDev = PepperDash.Essentials.DM.DeviceFactory.GetDevice(devConf); if (newDev == null) newDev = PepperDash.Essentials.Devices.Displays.DisplayDeviceFactory.GetDevice(devConf); diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/C2nRts/C2nRthsController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/C2nRts/C2nRthsController.cs index d090c3bf..c764a5f7 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/C2nRts/C2nRthsController.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/C2nRts/C2nRthsController.cs @@ -1,13 +1,16 @@ -using Crestron.SimplSharpPro; +using System.Collections.Generic; +using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.GeneralIO; using Newtonsoft.Json; using PepperDash.Core; using PepperDash.Essentials.Core.Bridges; +using PepperDash.Essentials.Core.Config; + namespace PepperDash.Essentials.Core.CrestronIO { - public class C2nRthsController:CrestronGenericBridgeableBaseDevice + public class C2nRthsController : CrestronGenericBridgeableBaseDevice { private readonly C2nRths _device; @@ -65,4 +68,22 @@ namespace PepperDash.Essentials.Core.CrestronIO trilist.StringInput[joinMap.Name].StringValue = Name; } } + + public class C2nRthsControllerFactory : EssentialsDeviceFactory + { + public C2nRthsControllerFactory() + { + TypeNames = new List() { "c2nrths" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new C2N-RTHS Device"); + + var control = CommFactory.GetControlPropertiesConfig(dc); + var cresnetId = control.CresnetIdInt; + + return new C2nRthsController(dc.Key, dc.Name, new C2nRths(cresnetId, Global.ControlSystem)); + } + } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/CenIoDigIn104Controller.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/CenIoDigIn104Controller.cs index 6bdfc25c..1ac8d0e3 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/CenIoDigIn104Controller.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/CenIoDigIn104Controller.cs @@ -5,6 +5,8 @@ using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.GeneralIO; +using PepperDash.Essentials.Core.Config; + using PepperDash.Core; @@ -13,7 +15,7 @@ namespace PepperDash.Essentials.Core /// /// Wrapper class for CEN-IO-DIGIN-104 digital input module /// - public class CenIoDigIn104Controller : Device, IDigitalInputPorts + public class CenIoDigIn104Controller : EssentialsDevice, IDigitalInputPorts { public CenIoDi104 Di104 { get; private set; } @@ -37,4 +39,23 @@ namespace PepperDash.Essentials.Core #endregion } + + public class CenIoDigIn104ControllerFactory : EssentialsDeviceFactory + { + public CenIoDigIn104ControllerFactory() + { + TypeNames = new List() { "ceniodigin104" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new CEN-DIGIN-104 Device"); + + var control = CommFactory.GetControlPropertiesConfig(dc); + var ipid = control.IpIdInt; + + return new CenIoDigIn104Controller(dc.Key, dc.Name, new Crestron.SimplSharpPro.GeneralIO.CenIoDi104(ipid, Global.ControlSystem)); + } + } + } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/StatusSign/StatusSignController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/StatusSign/StatusSignController.cs index 75e24d34..efdf9b7d 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/StatusSign/StatusSignController.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/StatusSign/StatusSignController.cs @@ -1,14 +1,16 @@ using System; +using System.Collections.Generic; using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.GeneralIO; using Newtonsoft.Json; using PepperDash.Core; using PepperDash.Essentials.Core.Bridges; +using PepperDash.Essentials.Core.Config; namespace PepperDash.Essentials.Core.CrestronIO { - public class StatusSignController:CrestronGenericBridgeableBaseDevice + public class StatusSignController : CrestronGenericBridgeableBaseDevice { private readonly StatusSign _device; @@ -158,4 +160,22 @@ namespace PepperDash.Essentials.Core.CrestronIO device.SetColor(redBrightness, greenBrightness, blueBrightness); } } + + public class StatusSignControllerFactory : EssentialsDeviceFactory + { + public StatusSignControllerFactory() + { + TypeNames = new List() { "statussign" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new StatusSign Device"); + + var control = CommFactory.GetControlPropertiesConfig(dc); + var cresnetId = control.CresnetIdInt; + + return new StatusSignController(dc.Key, dc.Name, new StatusSign(cresnetId, Global.ControlSystem)); + } + } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/EssentialsDevice.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/EssentialsDevice.cs index 18b187b7..4e144ff0 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/EssentialsDevice.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/EssentialsDevice.cs @@ -46,7 +46,7 @@ namespace PepperDash.Essentials.Core { foreach (var typeName in TypeNames) { - DeviceFactory.AddFactoryForType(typeName, BuildDevice); + DeviceFactory.AddFactoryForType(typeName.ToLower(), BuildDevice); } } diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/DeviceFactory.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/DeviceFactory.cs index 201675d0..c4698736 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/DeviceFactory.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/DeviceFactory.cs @@ -55,34 +55,6 @@ namespace PepperDash.Essentials.Core return FactoryMethods[typeName](dc); } - // Check "core" types - //if (typeName == "genericcomm") - //{ - // Debug.Console(1, "Factory Attempting to create new Generic Comm Device"); - // return new GenericComm(dc); - //} - if (typeName == "ceniodigin104") - { - var control = CommFactory.GetControlPropertiesConfig(dc); - var ipid = control.IpIdInt; - - return new CenIoDigIn104Controller(key, name, new Crestron.SimplSharpPro.GeneralIO.CenIoDi104(ipid, Global.ControlSystem)); - } - if (typeName == "statussign") - { - var control = CommFactory.GetControlPropertiesConfig(dc); - var cresnetId = control.CresnetIdInt; - - return new StatusSignController(key, name, new StatusSign(cresnetId, Global.ControlSystem)); - } - if (typeName == "c2nrths") - { - var control = CommFactory.GetControlPropertiesConfig(dc); - var cresnetId = control.CresnetIdInt; - - return new C2nRthsController(key, name, new C2nRths(cresnetId, Global.ControlSystem)); - } - return null; } @@ -112,16 +84,24 @@ namespace PepperDash.Essentials.Core } } - /// - /// Responsible for loading all of the device types + /// Responsible for loading all of the device types for this library /// public class CoreDeviceFactory { public CoreDeviceFactory() { - var genComm = new GenericCommFactory() as IDeviceFactory; - genComm.LoadTypeFactories(); + var genCommFactory = new GenericCommFactory() as IDeviceFactory; + genCommFactory.LoadTypeFactories(); + + var c2nRthsFactory = new C2nRthsControllerFactory() as IDeviceFactory; + c2nRthsFactory.LoadTypeFactories(); + + var statusSignFactory = new StatusSignControllerFactory() as IDeviceFactory; + statusSignFactory.LoadTypeFactories(); + + var cenIoControllerFactory = new CenIoDigIn104ControllerFactory() as IDeviceFactory; + cenIoControllerFactory.LoadTypeFactories(); } } } \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs b/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs index 1e795857..0108c65f 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs @@ -260,4 +260,29 @@ namespace PepperDash.Essentials.DM.AirMedia } + + 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/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs index 745cdda5..8fa8696f 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs @@ -11,6 +11,7 @@ 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 { @@ -1275,4 +1276,41 @@ namespace PepperDash.Essentials.DM } } -} \ No newline at end of file + 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 PepperDash.Essentials.DM.DmChassisController. + GetDmChassisController(dc.Key, dc.Name, type, props); + } + else if (type.StartsWith("dmmd128x") || type.StartsWith("dmmd64x")) + { + var props = JsonConvert.DeserializeObject + (dc.Properties.ToString()); + return PepperDash.Essentials.DM.DmBladeChassisController. + GetDmChassisController(dc.Key, dc.Name, type, props); + } + + return null; + } + } + +} + diff --git a/essentials-framework/Essentials DM/Essentials_DM/Config/DeviceFactory.cs b/essentials-framework/Essentials DM/Essentials_DM/Config/DeviceFactory.cs index 2417ce7e..3dcfb6b6 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Config/DeviceFactory.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Config/DeviceFactory.cs @@ -17,85 +17,25 @@ using PepperDash.Essentials.DM.Endpoints.DGEs; namespace PepperDash.Essentials.DM { - public class DeviceFactory + /// + /// Responsible for loading the type factories for this library + /// + public class DmDeviceFactory { - public static IKeyed GetDevice(DeviceConfig dc) - { - var key = dc.Key; - var name = dc.Name; - var type = dc.Type; - var properties = dc.Properties; + public DmDeviceFactory() + { + var dmChassisFactory = new DmChassisControllerFactory() as IDeviceFactory; + dmChassisFactory.LoadTypeFactories(); - var typeName = dc.Type.ToLower(); + var dmTxFactory = new DmTxControllerFactory() as IDeviceFactory; + dmTxFactory.LoadTypeFactories(); - if (typeName.StartsWith("am")) - { - if (typeName == "am200" || typeName == "am300") - { - var props = JsonConvert.DeserializeObject(properties.ToString()); - AmX00 amDevice = null; - if (typeName == "am200") - amDevice = new Crestron.SimplSharpPro.DM.AirMedia.Am200(props.Control.IpIdInt, Global.ControlSystem); - else if (typeName == "am300") - amDevice = new Crestron.SimplSharpPro.DM.AirMedia.Am300(props.Control.IpIdInt, Global.ControlSystem); - - return new AirMediaController(key, name, amDevice, dc, props); - } - } - else if (typeName.StartsWith("dmmd8x") || typeName.StartsWith("dmmd16x") || typeName.StartsWith("dmmd32x")) - { - var props = JsonConvert.DeserializeObject - (properties.ToString()); - return PepperDash.Essentials.DM.DmChassisController. - GetDmChassisController(key, name, type, props); - } - else if (typeName.StartsWith("dmmd128x") || typeName.StartsWith("dmmd64x")) { - var props = JsonConvert.DeserializeObject - (properties.ToString()); - return PepperDash.Essentials.DM.DmBladeChassisController. - GetDmChassisController(key, name, type, props); - } - // Hand off to DmTxHelper class - else if (typeName.StartsWith("dmtx")) { - var props = JsonConvert.DeserializeObject - (properties.ToString()); - return PepperDash.Essentials.DM.DmTxHelper.GetDmTxController(key, name, type, props); - } - - // Hand off to DmRmcHelper class - else if (typeName.StartsWith("dmrmc")) { - var props = JsonConvert.DeserializeObject - (properties.ToString()); - return PepperDash.Essentials.DM.DmRmcHelper.GetDmRmcController(key, name, type, props); - } - - else if (typeName.Equals("hdmd4x14ke")) { - var props = JsonConvert.DeserializeObject - (properties.ToString()); - return PepperDash.Essentials.DM.Chassis.HdMdNxM4kEController.GetController(key, name, type, props); - } - - else if (typeName.Equals("hdmd400ce") || typeName.Equals("hdmd300ce") || typeName.Equals("hdmd200ce") || typeName.Equals("hdmd200c1ge")) { - var props = JsonConvert.DeserializeObject - (properties.ToString()); - - if (typeName.Equals("hdmd400ce")) - return new PepperDash.Essentials.DM.HdMdxxxCEController(key, name, - new HdMd400CE(props.Control.IpIdInt, props.Control.TcpSshProperties.Address, Global.ControlSystem)); - else if (typeName.Equals("hdmd300ce")) - return new PepperDash.Essentials.DM.HdMdxxxCEController(key, name, - new HdMd300CE(props.Control.IpIdInt, props.Control.TcpSshProperties.Address, Global.ControlSystem)); - else if (typeName.Equals("hdmd200ce")) - return new PepperDash.Essentials.DM.HdMdxxxCEController(key, name, - new HdMd200CE(props.Control.IpIdInt, props.Control.TcpSshProperties.Address, Global.ControlSystem)); - else if (typeName.Equals("hdmd200c1ge")) - return new PepperDash.Essentials.DM.HdMdxxxCEController(key, name, - new HdMd200C1GE(props.Control.IpIdInt, props.Control.TcpSshProperties.Address, Global.ControlSystem)); - } - - return null; - } + var dmRxFactory = new DmRmcControllerFactory() as IDeviceFactory; + dmRxFactory.LoadTypeFactories(); + var hdMdFactory = new HdMdxxxCEControllerFactory() as IDeviceFactory; + hdMdFactory.LoadTypeFactories(); + } } diff --git a/essentials-framework/Essentials DM/Essentials_DM/DmLite/HdMdxxxCEController.cs b/essentials-framework/Essentials DM/Essentials_DM/DmLite/HdMdxxxCEController.cs index 48074ab9..63929938 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/DmLite/HdMdxxxCEController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/DmLite/HdMdxxxCEController.cs @@ -12,6 +12,7 @@ using Newtonsoft.Json; using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Bridges; +using PepperDash.Essentials.Core.Config; namespace PepperDash.Essentials.DM { @@ -268,4 +269,40 @@ namespace PepperDash.Essentials.DM { public ControlPropertiesConfig Control { get; set; } } + + public class HdMdxxxCEControllerFactory : EssentialsDeviceFactory + { + public HdMdxxxCEControllerFactory() + { + TypeNames = new List() { "hdmd400ce", "hdmd300ce", "hdmd200ce", "hdmd200c1ge"}; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + var typeName = dc.Type.ToLower(); + var key = dc.Key; + var name = dc.Name; + + Debug.Console(1, "Factory Attempting to create new HD-MD Device"); + + var props = JsonConvert.DeserializeObject + (dc.Properties.ToString()); + + if (typeName.Equals("hdmd400ce")) + return new PepperDash.Essentials.DM.HdMdxxxCEController(key, name, + new HdMd400CE(props.Control.IpIdInt, props.Control.TcpSshProperties.Address, Global.ControlSystem)); + else if (typeName.Equals("hdmd300ce")) + return new PepperDash.Essentials.DM.HdMdxxxCEController(key, name, + new HdMd300CE(props.Control.IpIdInt, props.Control.TcpSshProperties.Address, Global.ControlSystem)); + else if (typeName.Equals("hdmd200ce")) + return new PepperDash.Essentials.DM.HdMdxxxCEController(key, name, + new HdMd200CE(props.Control.IpIdInt, props.Control.TcpSshProperties.Address, Global.ControlSystem)); + else if (typeName.Equals("hdmd200c1ge")) + return new PepperDash.Essentials.DM.HdMdxxxCEController(key, name, + new HdMd200C1GE(props.Control.IpIdInt, props.Control.TcpSshProperties.Address, Global.ControlSystem)); + else + return null; + } + } + } \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs index 582234b3..08708d97 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs @@ -13,6 +13,7 @@ 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 { @@ -281,4 +282,25 @@ namespace PepperDash.Essentials.DM } } + public class DmRmcControllerFactory : EssentialsDeviceFactory + { + public DmRmcControllerFactory() + { + TypeNames = new List() { "hdbasetrx", "dmrmc4k100c1g", "dmrmc100c", "dmrmc100s", "dmrmc4k100c", "dmrmc150s", + "dmrmc200c", "dmrmc200s", "dmrmc200s2", "dmrmcscalerc", "dmrmcscalers", "dmrmcscalers2", "dmrmc4kscalerc", "dmrmc4kscalercdsp" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + var type = dc.Type.ToLower(); + + Debug.Console(1, "Factory Attempting to create new DM-RMC Device"); + + var props = JsonConvert.DeserializeObject + (dc.Properties.ToString()); + return PepperDash.Essentials.DM.DmRmcHelper.GetDmRmcController(dc.Key, dc.Name, type, props); + + } + } + } \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs index ed90ba7f..b741dfe5 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs @@ -13,6 +13,8 @@ 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 { @@ -319,12 +321,25 @@ namespace PepperDash.Essentials.DM } } } - //public enum ePdtHdcpSupport - //{ - // HdcpOff = 0, - // Hdcp1 = 1, - // Hdcp2 = 2, - // Hdcp2_2= 3, - // Auto = 99 - //} -} \ No newline at end of file + + public class DmTxControllerFactory : EssentialsDeviceFactory + { + public DmTxControllerFactory() + { + TypeNames = new List() { "dmtx200c", "dmtx201c", "dmtx201s", "dmtx4k100c", "dmtx4k202c", "dmtx4kz202c", "dmtx4k302c", "dmtx4kz302c", "dmtx401c", "dmtx401s" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + var type = dc.Type.ToLower(); + + Debug.Console(1, "Factory Attempting to create new DM-TX Device"); + + var props = JsonConvert.DeserializeObject + (dc.Properties.ToString()); + return PepperDash.Essentials.DM.DmTxHelper.GetDmTxController(dc.Key, dc.Name, type, props); + } + } + +} + From ae23eec005d74c128f14fbf4c27a11e4ed95d05f Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Thu, 16 Apr 2020 21:10:45 -0600 Subject: [PATCH 058/156] Progress on adding Description attribute and printing types at runtime --- PepperDashEssentials/ControlSystem.cs | 15 ++++- .../Config/Comm and IR/GenericComm.cs | 1 + .../Crestron IO/C2nRts/C2nRthsController.cs | 1 + .../Inputs/CenIoDigIn104Controller.cs | 1 + .../StatusSign/StatusSignController.cs | 1 + .../Devices/EssentialsDevice.cs | 41 +++++++++++- .../Factory/DeviceFactory.cs | 65 +++++++++++++++---- .../Factory/IDeviceFactory.cs | 3 +- .../Chassis/DmChassisController.cs | 1 + .../Essentials_DM/Config/DeviceFactory.cs | 2 + .../DmLite/HdMdxxxCEController.cs | 1 + .../Endpoints/Receivers/DmRmcHelper.cs | 1 + .../Endpoints/Transmitters/DmTxHelpers.cs | 1 + 13 files changed, 117 insertions(+), 17 deletions(-) diff --git a/PepperDashEssentials/ControlSystem.cs b/PepperDashEssentials/ControlSystem.cs index db10c959..04f60378 100644 --- a/PepperDashEssentials/ControlSystem.cs +++ b/PepperDashEssentials/ControlSystem.cs @@ -81,10 +81,22 @@ namespace PepperDash.Essentials "Template URL: {1}", ConfigReader.ConfigObject.SystemUrl, ConfigReader.ConfigObject.TemplateUrl); }, "portalinfo", "Shows portal URLS from configuration", ConsoleAccessLevelEnum.AccessOperator); + LoadDeviceTypesFromFactories(); + if (!Debug.DoNotLoadOnNextBoot) GoWithLoad(); } + /// + /// Instantiates each of the device factories to load thier device types + /// + void LoadDeviceTypesFromFactories() + { + // Instantiate the Device Factories + new CoreDeviceFactory(); + new DmDeviceFactory(); + } + /// @@ -291,9 +303,6 @@ namespace PepperDash.Essentials /// public void LoadDevices() { - // Instantiate the Device Factories - new CoreDeviceFactory(); - // Build the processor wrapper class DeviceManager.AddDevice(new PepperDash.Essentials.Core.Devices.CrestronProcessor("processor")); diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericComm.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericComm.cs index 0b33e619..41438832 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericComm.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericComm.cs @@ -15,6 +15,7 @@ namespace PepperDash.Essentials.Core /// /// Serves as a generic wrapper class for all styles of IBasicCommuncation ports /// + [Description("Generic communication wrapper class for any IBasicCommunication type")] public class GenericComm : ReconfigurableBridgableDevice { EssentialsControlPropertiesConfig PropertiesConfig; diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/C2nRts/C2nRthsController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/C2nRts/C2nRthsController.cs index c764a5f7..214c5ecf 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/C2nRts/C2nRthsController.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/C2nRts/C2nRthsController.cs @@ -10,6 +10,7 @@ using PepperDash.Essentials.Core.Config; namespace PepperDash.Essentials.Core.CrestronIO { + [Description("Wrapper class for the C2N-RTHS sensor")] public class C2nRthsController : CrestronGenericBridgeableBaseDevice { private readonly C2nRths _device; diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/CenIoDigIn104Controller.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/CenIoDigIn104Controller.cs index 1ac8d0e3..8510dd9d 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/CenIoDigIn104Controller.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/CenIoDigIn104Controller.cs @@ -15,6 +15,7 @@ namespace PepperDash.Essentials.Core /// /// Wrapper class for CEN-IO-DIGIN-104 digital input module /// + [Description("Wrapper class for the CEN-IO-DIGIN-104 diginal input module")] public class CenIoDigIn104Controller : EssentialsDevice, IDigitalInputPorts { public CenIoDi104 Di104 { get; private set; } diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/StatusSign/StatusSignController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/StatusSign/StatusSignController.cs index efdf9b7d..10a18372 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/StatusSign/StatusSignController.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/StatusSign/StatusSignController.cs @@ -10,6 +10,7 @@ using PepperDash.Essentials.Core.Config; namespace PepperDash.Essentials.Core.CrestronIO { + [Description("Wrapper class for the Crestron StatusSign device")] public class StatusSignController : CrestronGenericBridgeableBaseDevice { private readonly StatusSign _device; diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/EssentialsDevice.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/EssentialsDevice.cs index 4e144ff0..410c7a48 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/EssentialsDevice.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/EssentialsDevice.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using Crestron.SimplSharp; +using Crestron.SimplSharp.Reflection; using PepperDash.Core; using PepperDash.Essentials.Core.Config; @@ -12,6 +13,7 @@ namespace PepperDash.Essentials.Core /// /// Defines the basic needs for an EssentialsDevice to enable it to be build by an IDeviceFactory class /// + [Description("The base Essentials Device Class")] public abstract class EssentialsDevice : Device { protected EssentialsDevice(string key) @@ -27,6 +29,40 @@ namespace PepperDash.Essentials.Core } } + [AttributeUsage(AttributeTargets.Class, Inherited = true, AllowMultiple = true)] + public class DescriptionAttribute : Attribute + { + private string _Description; + + public DescriptionAttribute(string description) + { + Debug.Console(2, "Setting Description: {0}", description); + _Description = description; + } + + public string Description + { + get { return _Description; } + } + } + + [AttributeUsage(AttributeTargets.Class, Inherited = true, AllowMultiple = true)] + public class ConfigSnippetAttribute : Attribute + { + private string _ConfigSnippet; + + public ConfigSnippetAttribute(string configSnippet) + { + Debug.Console(2, "Setting Description {0}", configSnippet); + _ConfigSnippet = configSnippet; + } + + public string ConfigSnippet + { + get { return _ConfigSnippet; } + } + } + /// /// Devices the basic needs for a Device Factory /// @@ -46,7 +82,10 @@ namespace PepperDash.Essentials.Core { foreach (var typeName in TypeNames) { - DeviceFactory.AddFactoryForType(typeName.ToLower(), BuildDevice); + Debug.Console(2, "Getting Description Attribute from class: '{0}'", typeof(T).FullName); + var attributes = typeof(T).GetCustomAttributes(typeof(DescriptionAttribute), true) as DescriptionAttribute[]; + string description = attributes[0].Description; + DeviceFactory.AddFactoryForType(typeName.ToLower(), description, typeof(T), BuildDevice); } } diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/DeviceFactory.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/DeviceFactory.cs index c4698736..15188965 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/DeviceFactory.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/DeviceFactory.cs @@ -5,6 +5,7 @@ using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.GeneralIO; +using Crestron.SimplSharp.Reflection; using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Config; @@ -13,26 +14,53 @@ using PepperDash.Essentials.Core.Touchpanels; namespace PepperDash.Essentials.Core { + public class DeviceFactoryWrapper + { + public CType CType { get; set; } + public string Description { get; set; } + public Func FactoryMethod { get; set; } + + public DeviceFactoryWrapper() + { + CType = null; + Description = "Not Available"; + } + } + public class DeviceFactory { /// /// 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> FactoryMethods = - new Dictionary>(StringComparer.OrdinalIgnoreCase); + static Dictionary FactoryMethods = + new Dictionary(StringComparer.OrdinalIgnoreCase); /// /// Adds a plugin factory method /// /// /// - public static void AddFactoryForType(string type, Func method) + public static void AddFactoryForType(string typeName, Func method) { - Debug.Console(0, Debug.ErrorLogLevel.Notice, "Adding factory method for type '{0}'", type); - DeviceFactory.FactoryMethods.Add(type, method); + Debug.Console(0, Debug.ErrorLogLevel.Notice, "Adding factory method for type '{0}'", typeName); + DeviceFactory.FactoryMethods.Add(typeName, new DeviceFactoryWrapper() { FactoryMethod = method}); } + public static void AddFactoryForType(string typeName, string description, CType cType, Func method) + { + Debug.Console(0, Debug.ErrorLogLevel.Notice, "Adding factory method for type '{0}'", typeName); + + if(FactoryMethods.ContainsKey(typeName)) + { + Debug.Console(0, Debug.ErrorLogLevel.Error, "Unable to add type: '{0}'. Already exists in DeviceFactory", typeName); + return; + } + + var wrapper = new DeviceFactoryWrapper() { CType = cType, Description = description, FactoryMethod = method }; + DeviceFactory.FactoryMethods.Add(typeName, wrapper); + } + /// /// The factory method for Core "things". Also iterates the Factory methods that have /// been loaded from plugins @@ -52,34 +80,45 @@ namespace PepperDash.Essentials.Core if (FactoryMethods.ContainsKey(typeName)) { Debug.Console(0, Debug.ErrorLogLevel.Notice, "Loading '{0}' from plugin", dc.Type); - return FactoryMethods[typeName](dc); + return FactoryMethods[typeName].FactoryMethod(dc); } return null; } /// - /// Prints the type names fromt the FactoryMethods collection. + /// Prints the type names and associated metadata from the FactoryMethods collection. /// /// public static void GetDeviceFactoryTypes(string filter) { - List typeNames = new List(); + Dictionary types = new Dictionary(); if (!string.IsNullOrEmpty(filter)) { - typeNames = FactoryMethods.Keys.Where(k => k.Contains(filter)).ToList(); + types = FactoryMethods.Where(k => k.Key.Contains(filter)).ToDictionary(k => k.Key, k => k.Value); } else { - typeNames = FactoryMethods.Keys.ToList(); + types = FactoryMethods; } Debug.Console(0, "Device Types:"); - foreach (var type in typeNames) + foreach (var type in types) { - Debug.Console(0, "type: '{0}'", type); + var description = type.Value.Description; + var cType = "Not Specified by Plugin"; + + if(type.Value.CType != null) + { + cType = type.Value.CType.FullName; + } + + Debug.Console(0, + @"Type: '{0}' + CType: '{1}' + Description: {2}", type.Key, cType, description); } } } @@ -91,6 +130,8 @@ namespace PepperDash.Essentials.Core { public CoreDeviceFactory() { + Debug.Console(1, "Essentials.Core Factory Adding Types..."); + var genCommFactory = new GenericCommFactory() as IDeviceFactory; genCommFactory.LoadTypeFactories(); diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/IDeviceFactory.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/IDeviceFactory.cs index ef792868..91e073f2 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/IDeviceFactory.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/IDeviceFactory.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using Crestron.SimplSharp; +using Crestron.SimplSharp.Reflection; using PepperDash.Core; using PepperDash.Essentials.Core.Config; @@ -15,7 +16,7 @@ namespace PepperDash.Essentials.Core public interface IDeviceFactory { /// - /// Will be called when the plugin is loaded by Essentials. Must add any new types to the DeviceFactory using DeviceFactory.AddFactoryForType() for each new type + /// Loads all the types to the DeviceFactory /// void LoadTypeFactories(); } diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs index 8fa8696f..bc39e51a 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs @@ -19,6 +19,7 @@ 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 128x128")] public class DmChassisController : CrestronGenericBridgeableBaseDevice, IDmSwitch, IRoutingInputsOutputs, IRouting, IHasFeedback { public DMChassisPropertiesConfig PropertiesConfig { get; set; } diff --git a/essentials-framework/Essentials DM/Essentials_DM/Config/DeviceFactory.cs b/essentials-framework/Essentials DM/Essentials_DM/Config/DeviceFactory.cs index 3dcfb6b6..6e10ae61 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Config/DeviceFactory.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Config/DeviceFactory.cs @@ -24,6 +24,8 @@ namespace PepperDash.Essentials.DM { public DmDeviceFactory() { + Debug.Console(1, "Essentials.DM Factory Adding Types..."); + var dmChassisFactory = new DmChassisControllerFactory() as IDeviceFactory; dmChassisFactory.LoadTypeFactories(); diff --git a/essentials-framework/Essentials DM/Essentials_DM/DmLite/HdMdxxxCEController.cs b/essentials-framework/Essentials DM/Essentials_DM/DmLite/HdMdxxxCEController.cs index 63929938..000202dc 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/DmLite/HdMdxxxCEController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/DmLite/HdMdxxxCEController.cs @@ -19,6 +19,7 @@ namespace PepperDash.Essentials.DM /// /// Represent both a transmitter and receiver pair of the HD-MD-400-C-E / HD-MD-300-C-E / HD-MD-200-C-E kits /// + [Description("Wrapper class for all HD-MD variants")] public class HdMdxxxCEController : CrestronGenericBridgeableBaseDevice, IRouting//, IComPorts { /// diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs index 08708d97..f36b513e 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs @@ -17,6 +17,7 @@ using PepperDash.Essentials.Core.Config; namespace PepperDash.Essentials.DM { + [Description("Wrapper class for all DM-RMC variants")] public abstract class DmRmcControllerBase : CrestronGenericBridgeableBaseDevice { public virtual StringFeedback VideoOutputResolutionFeedback { get; protected set; } diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs index b741dfe5..f5d59354 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs @@ -148,6 +148,7 @@ namespace PepperDash.Essentials.DM /// /// /// + [Description("Wrapper class for all DM-TX variants")] public abstract class DmTxControllerBase : CrestronGenericBridgeableBaseDevice { public virtual void SetPortHdcpCapability(eHdcpCapabilityType hdcpMode, uint port) { } From e55a647854050c92698192d9123b709b018a41cc Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Fri, 17 Apr 2020 09:24:09 -0600 Subject: [PATCH 059/156] fixes types for base device Generic types --- .../Crestron IO/C2nRts/C2nRthsController.cs | 2 +- .../Crestron IO/Inputs/CenIoDigIn104Controller.cs | 2 +- .../Crestron IO/StatusSign/StatusSignController.cs | 2 +- .../PepperDashEssentialsBase/Factory/DeviceFactory.cs | 1 + 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/C2nRts/C2nRthsController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/C2nRts/C2nRthsController.cs index 214c5ecf..0bc48d80 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/C2nRts/C2nRthsController.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/C2nRts/C2nRthsController.cs @@ -70,7 +70,7 @@ namespace PepperDash.Essentials.Core.CrestronIO } } - public class C2nRthsControllerFactory : EssentialsDeviceFactory + public class C2nRthsControllerFactory : EssentialsDeviceFactory { public C2nRthsControllerFactory() { diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/CenIoDigIn104Controller.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/CenIoDigIn104Controller.cs index 8510dd9d..5112f3aa 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/CenIoDigIn104Controller.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/CenIoDigIn104Controller.cs @@ -41,7 +41,7 @@ namespace PepperDash.Essentials.Core #endregion } - public class CenIoDigIn104ControllerFactory : EssentialsDeviceFactory + public class CenIoDigIn104ControllerFactory : EssentialsDeviceFactory { public CenIoDigIn104ControllerFactory() { diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/StatusSign/StatusSignController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/StatusSign/StatusSignController.cs index 10a18372..ca679bce 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/StatusSign/StatusSignController.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/StatusSign/StatusSignController.cs @@ -162,7 +162,7 @@ namespace PepperDash.Essentials.Core.CrestronIO } } - public class StatusSignControllerFactory : EssentialsDeviceFactory + public class StatusSignControllerFactory : EssentialsDeviceFactory { public StatusSignControllerFactory() { diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/DeviceFactory.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/DeviceFactory.cs index 15188965..80725cc3 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/DeviceFactory.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/DeviceFactory.cs @@ -132,6 +132,7 @@ namespace PepperDash.Essentials.Core { Debug.Console(1, "Essentials.Core Factory Adding Types..."); + //cast to IDeviceFactory isn't explicitly required here...but will be when instantiating using reflection, which I'm assuming is the next step var genCommFactory = new GenericCommFactory() as IDeviceFactory; genCommFactory.LoadTypeFactories(); From 902a94a82cd8109b5f1a963c6d29203603d3cf62 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Mon, 20 Apr 2020 10:32:25 -0600 Subject: [PATCH 060/156] fixes incorrect type definitions in Device Factories. --- .../Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs | 2 +- .../Essentials DM/Essentials_DM/Chassis/DmChassisController.cs | 2 +- .../Essentials DM/Essentials_DM/DmLite/HdMdxxxCEController.cs | 2 +- .../Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs | 2 +- .../Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs b/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs index 0108c65f..8823ae75 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs @@ -261,7 +261,7 @@ namespace PepperDash.Essentials.DM.AirMedia } - public class AirMediaControllerFactory : EssentialsDeviceFactory + public class AirMediaControllerFactory : EssentialsDeviceFactory { public AirMediaControllerFactory() { diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs index bc39e51a..7313aece 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs @@ -1277,7 +1277,7 @@ namespace PepperDash.Essentials.DM } } - public class DmChassisControllerFactory : EssentialsDeviceFactory + public class DmChassisControllerFactory : EssentialsDeviceFactory { public DmChassisControllerFactory() { diff --git a/essentials-framework/Essentials DM/Essentials_DM/DmLite/HdMdxxxCEController.cs b/essentials-framework/Essentials DM/Essentials_DM/DmLite/HdMdxxxCEController.cs index 000202dc..59a318cd 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/DmLite/HdMdxxxCEController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/DmLite/HdMdxxxCEController.cs @@ -271,7 +271,7 @@ namespace PepperDash.Essentials.DM public ControlPropertiesConfig Control { get; set; } } - public class HdMdxxxCEControllerFactory : EssentialsDeviceFactory + public class HdMdxxxCEControllerFactory : EssentialsDeviceFactory { public HdMdxxxCEControllerFactory() { diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs index f36b513e..da3e587a 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs @@ -283,7 +283,7 @@ namespace PepperDash.Essentials.DM } } - public class DmRmcControllerFactory : EssentialsDeviceFactory + public class DmRmcControllerFactory : EssentialsDeviceFactory { public DmRmcControllerFactory() { diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs index f5d59354..81a56008 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs @@ -323,7 +323,7 @@ namespace PepperDash.Essentials.DM } } - public class DmTxControllerFactory : EssentialsDeviceFactory + public class DmTxControllerFactory : EssentialsDeviceFactory { public DmTxControllerFactory() { From 2170a793993bc20eac281442cc2c0e639d6380fa Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Mon, 20 Apr 2020 23:12:27 -0600 Subject: [PATCH 061/156] Updating more device factories in Essentials and Devices.Common --- .../MobileControlSystemController.cs | 18 +- .../RoomBridges/MobileControlBridgeBase.cs | 2 +- .../MobileControlSIMPLRoomBridge.cs | 31 ++++ PepperDashEssentials/Bridges/BridgeFactory.cs | 21 +-- PepperDashEssentials/Bridges/EiscBridge.cs | 137 ++------------ PepperDashEssentials/ControlSystem.cs | 30 +-- PepperDashEssentials/Devices/Amplifier.cs | 17 +- PepperDashEssentials/Factory/DeviceFactory.cs | 94 ++-------- .../Factory/UiDeviceFactory.cs | 171 +----------------- .../UI/EssentialsTouchpanelController.cs | 131 +++++++++++++- .../Bridges/BridgeBase.cs | 154 +++------------- .../Comm and IR/ConsoleCommMockDevice.cs | 21 ++- .../Devices/PC/InRoomPc.cs | 18 +- .../Devices/PC/Laptop.cs | 17 +- .../Display/BasicIrDisplay.cs | 24 +++ .../Display/MockDisplay.cs | 17 +- .../RoomOnToDefaultSourceWhenOccupied.cs | 15 ++ .../Endpoints/DGEs/DgeController.cs | 33 ++++ .../Audio/GenericAudioOut.cs | 20 +- .../Cameras/CameraVisca.cs | 19 ++ .../Crestron/Gateways/CenRfgwController.cs | 18 ++ .../DSP/BiampTesira/BiampTesiraForteDsp.cs | 19 ++ .../Essentials Devices Common/DSP/DspBase.cs | 2 +- .../DiscPlayer/IRDiscPlayerBase.cs | 33 +++- .../Factory/DeviceFactory.cs | 139 +++++--------- .../Generic/GenericSource.cs | 18 +- .../AnalogWay/AnalongWayLiveCore.cs | 21 ++- .../Power Controllers/Digitallogger.cs | 17 ++ .../Streaming/AppleTV.cs | 17 ++ 29 files changed, 645 insertions(+), 629 deletions(-) diff --git a/PepperDashEssentials/AppServer/MobileControlSystemController.cs b/PepperDashEssentials/AppServer/MobileControlSystemController.cs index b29ca61d..cc18ba55 100644 --- a/PepperDashEssentials/AppServer/MobileControlSystemController.cs +++ b/PepperDashEssentials/AppServer/MobileControlSystemController.cs @@ -21,7 +21,7 @@ using PepperDash.Essentials.AppServer.Messengers; namespace PepperDash.Essentials { - public class MobileControlSystemController : Device + public class MobileControlSystemController : EssentialsDevice { WebSocketClient WSClient; @@ -865,4 +865,20 @@ namespace PepperDash.Essentials CrestronConsole.ConsoleCommandResponse("Usage: mobilehttprequest:N get/post url\r"); } } + + public class MobileControlSystemControllerFactory : EssentialsDeviceFactory + { + public MobileControlSystemControllerFactory() + { + TypeNames = new List() { "appserver" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new MobileControlSystemController Device"); + var props = JsonConvert.DeserializeObject(dc.Properties.ToString()); + return new MobileControlSystemController(dc.Key, dc.Name, props); + } + } + } \ No newline at end of file diff --git a/PepperDashEssentials/AppServer/RoomBridges/MobileControlBridgeBase.cs b/PepperDashEssentials/AppServer/RoomBridges/MobileControlBridgeBase.cs index d7258070..fa5cb93d 100644 --- a/PepperDashEssentials/AppServer/RoomBridges/MobileControlBridgeBase.cs +++ b/PepperDashEssentials/AppServer/RoomBridges/MobileControlBridgeBase.cs @@ -12,7 +12,7 @@ namespace PepperDash.Essentials /// /// /// - public abstract class MobileControlBridgeBase: Device + public abstract class MobileControlBridgeBase: EssentialsDevice { public MobileControlSystemController Parent { get; private set; } diff --git a/PepperDashEssentials/AppServer/RoomBridges/MobileControlSIMPLRoomBridge.cs b/PepperDashEssentials/AppServer/RoomBridges/MobileControlSIMPLRoomBridge.cs index a8589b92..25eebf42 100644 --- a/PepperDashEssentials/AppServer/RoomBridges/MobileControlSIMPLRoomBridge.cs +++ b/PepperDashEssentials/AppServer/RoomBridges/MobileControlSIMPLRoomBridge.cs @@ -825,4 +825,35 @@ namespace PepperDash.Essentials.Room.MobileControl EISC.StringInput[JoinMap.ServerUrl.JoinNumber].StringValue = Parent.Config.ClientAppUrl; } } + + public class MobileControlSIMPLRoomBridgeFactory : EssentialsDeviceFactory + { + public MobileControlSIMPLRoomBridgeFactory() + { + TypeNames = new List() { "mobilecontrolbridge-ddvc01", "mobilecontrolbridge-simpl" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new MobileControlSIMPLRoomBridge Device"); + + var comm = CommFactory.GetControlPropertiesConfig(dc); + + var bridge = new PepperDash.Essentials.Room.MobileControl.MobileControlSIMPLRoomBridge(dc.Key, dc.Name, comm.IpIdInt); + bridge.AddPreActivationAction(() => + { + var parent = DeviceManager.AllDevices.FirstOrDefault(d => d.Key == "appServer") as MobileControlSystemController; + if (parent == null) + { + Debug.Console(0, bridge, "ERROR: Cannot connect bridge. System controller not present"); + } + Debug.Console(0, bridge, "Linking to parent controller"); + bridge.AddParent(parent); + parent.AddBridge(bridge); + }); + + return bridge; + } + } + } \ No newline at end of file diff --git a/PepperDashEssentials/Bridges/BridgeFactory.cs b/PepperDashEssentials/Bridges/BridgeFactory.cs index e3fc14f3..21d3a346 100644 --- a/PepperDashEssentials/Bridges/BridgeFactory.cs +++ b/PepperDashEssentials/Bridges/BridgeFactory.cs @@ -16,23 +16,20 @@ using Crestron.SimplSharpPro.EthernetCommunication; namespace PepperDash.Essentials { + /// + /// Responsible for loading all of the device types for this library + /// public class BridgeFactory { - public static IKeyed GetDevice(DeviceConfig dc) + public BridgeFactory() { - // ? why is this static JTA 2018-06-13? + var eiscApiAdvancedFactory = new EiscApiAdvancedFactory() as IDeviceFactory; + eiscApiAdvancedFactory.LoadTypeFactories(); - var typeName = dc.Type.ToLower(); - - //Debug.Console(2, "Name {0}, Key {1}, Type {2}, Properties {3}", name, key, type, properties.ToString()); - - if (typeName == "eiscapiadv" || typeName == "eiscapiadvanced") - { - return new EiscApiAdvanced(dc); - } - - return typeName == "eiscapi" ? new EiscApi(dc) : null; + var eiscApiFactory = new EiscApiFactory() as IDeviceFactory; + eiscApiFactory.LoadTypeFactories(); } + } diff --git a/PepperDashEssentials/Bridges/EiscBridge.cs b/PepperDashEssentials/Bridges/EiscBridge.cs index fe592e45..4c999f20 100644 --- a/PepperDashEssentials/Bridges/EiscBridge.cs +++ b/PepperDashEssentials/Bridges/EiscBridge.cs @@ -66,129 +66,10 @@ namespace PepperDash.Essentials.Bridges Debug.ConsoleWithLog(0, this, "Please update the bridge config to use EiscBridgeAdvanced with this device: {0}", device.Key); } - //if (device.GetType().GetCType().IsAssignableFrom(typeof (IBridge))) - //{ - // var bridge = device as IBridge; - // if (bridge == null) - // continue; - // Debug.Console(2, this, "Linking device {0} as IBridge"); - // bridge.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - // continue; - //} - - //if (!device.GetType().GetCType().IsAssignableFrom(typeof (IBridgeAdvanced))) continue; - - //var bridgeAdvanced = device as IBridgeAdvanced; - - //if (bridgeAdvanced == null) continue; - //Debug.Console(2, this, "Linking device {0} as IBridgeAdvanced"); - //bridgeAdvanced.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey, this); } Debug.Console(1, this, "Devices Linked."); - // - //else if (device is PepperDash.Essentials.Core.Monitoring.SystemMonitorController) - //{ - // (device as PepperDash.Essentials.Core.Monitoring.SystemMonitorController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - // continue; - //} - //else if (device is GenericComm) - //{ - // (device as GenericComm).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - // continue; - //} - //else if (device is CameraBase) - //{ - // (device as CameraBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey, this); - // continue; - //} - //else if (device is PepperDash.Essentials.Core.DisplayBase) - //{ - // (device as DisplayBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - // continue; - //} - //else if (device is DmChassisController) - //{ - // (device as DmChassisController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - // continue; - //} - //else if (device is DmBladeChassisController) - //{ - // (device as DmBladeChassisController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - // continue; - //} - //else if (device is DmpsRoutingController) - //{ - // (device as DmpsRoutingController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - // continue; - //} - //else if (device is DmpsAudioOutputController) - //{ - // (device as DmpsAudioOutputController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - // continue; - //} - //else if (device is DmTxControllerBase) - //{ - // (device as DmTxControllerBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - // continue; - //} - //else if (device is DmRmcControllerBase) - //{ - // (device as DmRmcControllerBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - // continue; - //} - //else if (device is GenericRelayDevice) - //{ - // (device as GenericRelayDevice).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - // continue; - //} - //else if (device is IRSetTopBoxBase) - //{ - // (device as IRSetTopBoxBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - // continue; - //} - //else if (device is IDigitalInput) - //{ - // (device as IDigitalInput).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - // continue; - //} - //else if (device is AppleTV) - //{ - // (device as AppleTV).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - // continue; - //} - //else if (device is HdMdxxxCEController) - //{ - // (device as HdMdxxxCEController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - // continue; - //} - //else if (device is LightingBase) - //{ - // (device as LightingBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - // continue; - //} - //else if (device is DigitalLogger) - //{ - // (device as DigitalLogger).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - // continue; - //} - //else if (device is PepperDash.Essentials.Devices.Common.Occupancy.GlsOccupancySensorBaseController) - //{ - // (device as PepperDash.Essentials.Devices.Common.Occupancy.GlsOccupancySensorBaseController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - // continue; - //} - //else if (device is StatusSignController) - //{ - // (device as StatusSignController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - // continue; - //} - //else if (device is C2nRthsController) - //{ - // (device as C2nRthsController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - // continue; - //} - //} - + }); } @@ -332,4 +213,20 @@ namespace PepperDash.Essentials.Bridges } } } + + public class EiscApiFactory : EssentialsDeviceFactory + { + public EiscApiFactory() + { + TypeNames = new List() { "eiscapi" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new EiscApi Device"); + + return new EiscApi(dc); + } + } + } \ No newline at end of file diff --git a/PepperDashEssentials/ControlSystem.cs b/PepperDashEssentials/ControlSystem.cs index 04f60378..3e6654b2 100644 --- a/PepperDashEssentials/ControlSystem.cs +++ b/PepperDashEssentials/ControlSystem.cs @@ -95,6 +95,13 @@ namespace PepperDash.Essentials // Instantiate the Device Factories new CoreDeviceFactory(); new DmDeviceFactory(); + new UiDeviceFactory(); + + new DeviceFactory(); + new BridgeFactory(); + + new PepperDash.Essentials.Devices.Common.DeviceFactory(); + } @@ -366,32 +373,15 @@ namespace PepperDash.Essentials } // Try local factories first - var newDev = DeviceFactory.GetDevice(devConf); + IKeyed newDev = null; - if (newDev == null) - newDev = BridgeFactory.GetDevice(devConf); - - // Then associated library factories if (newDev == null) newDev = PepperDash.Essentials.Core.DeviceFactory.GetDevice(devConf); - if (newDev == null) - newDev = PepperDash.Essentials.Devices.Common.DeviceFactory.GetDevice(devConf); + // if (newDev == null) newDev = PepperDash.Essentials.Devices.Displays.DisplayDeviceFactory.GetDevice(devConf); - - //if (newDev == null) // might want to consider the ability to override an essentials "type" - //{ - // // iterate plugin factories - // foreach (var f in FactoryObjects) - // { - // var cresFactory = f as IGetCrestronDevice; - // if (cresFactory != null) - // { - // newDev = cresFactory.GetDevice(devConf, this); - // } - // } - //} + // if (newDev != null) DeviceManager.AddDevice(newDev); diff --git a/PepperDashEssentials/Devices/Amplifier.cs b/PepperDashEssentials/Devices/Amplifier.cs index 20d8efa0..b2725109 100644 --- a/PepperDashEssentials/Devices/Amplifier.cs +++ b/PepperDashEssentials/Devices/Amplifier.cs @@ -6,11 +6,12 @@ using Crestron.SimplSharp; using PepperDash.Core; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.Routing; namespace PepperDash.Essentials { - public class Amplifier : Device, IRoutingSinkNoSwitching + public class Amplifier : EssentialsDevice, IRoutingSinkNoSwitching { public event SourceInfoChangeHandler CurrentSourceChange; @@ -54,4 +55,18 @@ namespace PepperDash.Essentials #endregion } + + public class AmplifierFactory : EssentialsDeviceFactory + { + public AmplifierFactory() + { + TypeNames = new List() { "amplifier" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new Amplifier Device"); + return new Amplifier(dc.Key, dc.Name); + } + } } \ No newline at end of file diff --git a/PepperDashEssentials/Factory/DeviceFactory.cs b/PepperDashEssentials/Factory/DeviceFactory.cs index 1e0e8ffb..944a9b2f 100644 --- a/PepperDashEssentials/Factory/DeviceFactory.cs +++ b/PepperDashEssentials/Factory/DeviceFactory.cs @@ -10,88 +10,34 @@ using Newtonsoft.Json.Linq; using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Config; +using PepperDash.Essentials.Room.MobileControl; namespace PepperDash.Essentials { - public class DeviceFactory + /// + /// Responsible for loading all of the device types for this library + /// + public class DeviceFactory { - public static IKeyed GetDevice(DeviceConfig dc) - { - var key = dc.Key; - var name = dc.Name; - var type = dc.Type; - var properties = dc.Properties; + public DeviceFactory() + { + var ampFactory = new AmplifierFactory() as IDeviceFactory; + ampFactory.LoadTypeFactories(); - var typeName = dc.Type.ToLower(); + var mockDisplayFactory = new MockDisplayFactory() as IDeviceFactory; + mockDisplayFactory.LoadTypeFactories(); - if (typeName == "amplifier") - { - return new Amplifier(dc.Key, dc.Name); - } - else if (dc.Group.ToLower() == "touchpanel") // typeName.StartsWith("tsw")) - { - return UiDeviceFactory.GetUiDevice(dc); - } + var consoleCommMockFactroy = new ConsoleCommMockDeviceFactory() as IDeviceFactory; + consoleCommMockFactroy.LoadTypeFactories(); - else if (typeName == "mockdisplay") - { - return new MockDisplay(key, name); - } + var mcSystemControllerFactory = new MobileControlSystemControllerFactory() as IDeviceFactory; + mcSystemControllerFactory.LoadTypeFactories(); - else if (typeName == "generic") - { - return new Device(key, name); - } + var mcSIMPLRoomBridgeFactory = new MobileControlSIMPLRoomBridgeFactory() as IDeviceFactory; + mcSIMPLRoomBridgeFactory.LoadTypeFactories(); - //// MOVE into something else??? - //else if (typeName == "basicirdisplay") - //{ - // var ir = IRPortHelper.GetIrPort(properties); - // if (ir != null) - // return new BasicIrDisplay(key, name, ir.Port, ir.FileName); - //} - - else if (typeName == "commmock") - { - var comm = CommFactory.CreateCommForDevice(dc); - var props = JsonConvert.DeserializeObject( - properties.ToString()); - return new ConsoleCommMockDevice(key, name, props, comm); - } - - else if (typeName == "appserver") - { - var props = JsonConvert.DeserializeObject(properties.ToString()); - return new MobileControlSystemController(key, name, props); - } - - else if (typeName == "mobilecontrolbridge-ddvc01") - { - var comm = CommFactory.GetControlPropertiesConfig(dc); - - var bridge = new PepperDash.Essentials.Room.MobileControl.MobileControlSIMPLRoomBridge(key, name, comm.IpIdInt); - bridge.AddPreActivationAction(() => - { - var parent = DeviceManager.AllDevices.FirstOrDefault(d => d.Key == "appServer") as MobileControlSystemController; - if (parent == null) - { - Debug.Console(0, bridge, "ERROR: Cannot connect bridge. System controller not present"); - } - Debug.Console(0, bridge, "Linking to parent controller"); - bridge.AddParent(parent); - parent.AddBridge(bridge); - }); - - return bridge; - } - - else if (typeName == "roomonwhenoccupancydetectedfeature") - { - return new RoomOnToDefaultSourceWhenOccupied(dc); - } - - return null; - } + var roomOnToDefSourceWhenOcc = new RoomOnToDefaultSourceWhenOccupiedFactory() as IDeviceFactory; + roomOnToDefSourceWhenOcc.LoadTypeFactories(); + } } - } diff --git a/PepperDashEssentials/Factory/UiDeviceFactory.cs b/PepperDashEssentials/Factory/UiDeviceFactory.cs index 6176b6d1..fad8026f 100644 --- a/PepperDashEssentials/Factory/UiDeviceFactory.cs +++ b/PepperDashEssentials/Factory/UiDeviceFactory.cs @@ -18,173 +18,18 @@ using PepperDash.Essentials.DM.Endpoints.DGEs; namespace PepperDash.Essentials { + /// + /// Responsible for loading all of the UI device types for this library + /// public class UiDeviceFactory { - public static IKeyed GetUiDevice(DeviceConfig config) + public UiDeviceFactory() { - var comm = CommFactory.GetControlPropertiesConfig(config); + var dgeControllerFactory = new DgeControllerFactory() as IDeviceFactory; + dgeControllerFactory.LoadTypeFactories(); - var typeName = config.Type.ToLower(); - - EssentialsTouchpanelController panelController = null; - - var props = JsonConvert.DeserializeObject(config.Properties.ToString()); - - if (typeName.Contains("dge")) - { - Dge100 dgeDevice = null; - if (typeName == "dge100") - dgeDevice = new Dge100(comm.IpIdInt, Global.ControlSystem); - else if (typeName == "dmdge200c") - dgeDevice = new DmDge200C(comm.IpIdInt, Global.ControlSystem); - - if (dgeDevice == null) - { - Debug.Console(1, "Unable to create DGE device"); - return null; - } - - var dgeController = new DgeController(config.Key + "-comPorts", config.Name, dgeDevice, config, props); - - DeviceManager.AddDevice(dgeController); - - panelController = new EssentialsTouchpanelController(config.Key, config.Name, dgeController.DigitalGraphicsEngine, - props.ProjectName, props.SgdFile); - } - else - { - panelController = new EssentialsTouchpanelController(config.Key, config.Name, config.Type, props, comm.IpIdInt); - } - - panelController.AddPostActivationAction(() => - { - var mainDriver = new EssentialsPanelMainInterfaceDriver(panelController.Panel, props); - // Then the sub drivers - - // spin up different room drivers depending on room type - var room = DeviceManager.GetDeviceForKey(props.DefaultRoomKey); - if (room is EssentialsHuddleSpaceRoom) - { - - // Header Driver - Debug.Console(0, panelController, "Adding header driver"); - mainDriver.HeaderDriver = new EssentialsHeaderDriver(mainDriver, props); - - // AV Driver - Debug.Console(0, panelController, "Adding huddle space AV driver"); - var avDriver = new EssentialsHuddlePanelAvFunctionsDriver(mainDriver, props); - avDriver.DefaultRoomKey = props.DefaultRoomKey; - mainDriver.AvDriver = avDriver; - avDriver.CurrentRoom = room as EssentialsHuddleSpaceRoom; - - // Environment Driver - if (avDriver.CurrentRoom.PropertiesConfig.Environment != null && avDriver.CurrentRoom.PropertiesConfig.Environment.DeviceKeys.Count > 0) - { - Debug.Console(0, panelController, "Adding environment driver"); - mainDriver.EnvironmentDriver = new EssentialsEnvironmentDriver(mainDriver, props); - - mainDriver.EnvironmentDriver.GetDevicesFromConfig(avDriver.CurrentRoom.PropertiesConfig.Environment); - } - - mainDriver.HeaderDriver.SetupHeaderButtons(avDriver, avDriver.CurrentRoom); - - panelController.LoadAndShowDriver(mainDriver); // This is a little convoluted. - - if (panelController.Panel is TswFt5ButtonSystem) - { - var tsw = panelController.Panel as TswFt5ButtonSystem; - // Wire up hard keys - tsw.Power.UserObject = new Action(b => { if (!b) avDriver.PowerButtonPressed(); }); - //tsw.Home.UserObject = new Action(b => { if (!b) HomePressed(); }); - if(mainDriver.EnvironmentDriver != null) - tsw.Lights.UserObject = new Action(b => - { - if (!b) - { - //mainDriver.AvDriver.PopupInterlock.ShowInterlockedWithToggle(mainDriver.EnvironmentDriver.BackgroundSubpageJoin); - mainDriver.EnvironmentDriver.Toggle(); - } - }); - tsw.Up.UserObject = new Action(avDriver.VolumeUpPress); - tsw.Down.UserObject = new Action(avDriver.VolumeDownPress); - } - } - //else if (room is EssentialsPresentationRoom) - //{ - // Debug.Console(0, panelController, "Adding presentation room driver"); - // var avDriver = new EssentialsPresentationPanelAvFunctionsDriver(mainDriver, props); - // avDriver.CurrentRoom = room as EssentialsPresentationRoom; - // avDriver.DefaultRoomKey = props.DefaultRoomKey; - // mainDriver.AvDriver = avDriver ; - // mainDriver.HeaderDriver = new EssentialsHeaderDriver(mainDriver, props); - // panelController.LoadAndShowDriver(mainDriver); - - // if (panelController.Panel is TswFt5ButtonSystem) - // { - // var tsw = panelController.Panel as TswFt5ButtonSystem; - // // Wire up hard keys - // tsw.Power.UserObject = new Action(b => { if (!b) avDriver.PowerButtonPressed(); }); - // //tsw.Home.UserObject = new Action(b => { if (!b) HomePressed(); }); - // tsw.Up.UserObject = new Action(avDriver.VolumeUpPress); - // tsw.Down.UserObject = new Action(avDriver.VolumeDownPress); - // } - //} - else if (room is EssentialsHuddleVtc1Room) - { - Debug.Console(0, panelController, "Adding huddle space VTC AV driver"); - - // Header Driver - mainDriver.HeaderDriver = new EssentialsHeaderDriver(mainDriver, props); - - // AV Driver - var avDriver = new EssentialsHuddleVtc1PanelAvFunctionsDriver(mainDriver, props); - - var codecDriver = new PepperDash.Essentials.UIDrivers.VC.EssentialsVideoCodecUiDriver(panelController.Panel, avDriver, - (room as EssentialsHuddleVtc1Room).VideoCodec, mainDriver.HeaderDriver); - avDriver.SetVideoCodecDriver(codecDriver); - avDriver.DefaultRoomKey = props.DefaultRoomKey; - mainDriver.AvDriver = avDriver; - avDriver.CurrentRoom = room as EssentialsHuddleVtc1Room; - - // Environment Driver - if (avDriver.CurrentRoom.PropertiesConfig.Environment != null && avDriver.CurrentRoom.PropertiesConfig.Environment.DeviceKeys.Count > 0) - { - Debug.Console(0, panelController, "Adding environment driver"); - mainDriver.EnvironmentDriver = new EssentialsEnvironmentDriver(mainDriver, props); - - mainDriver.EnvironmentDriver.GetDevicesFromConfig(avDriver.CurrentRoom.PropertiesConfig.Environment); - } - - mainDriver.HeaderDriver.SetupHeaderButtons(avDriver, avDriver.CurrentRoom); - - panelController.LoadAndShowDriver(mainDriver); // This is a little convoluted. - - if (panelController.Panel is TswFt5ButtonSystem) - { - var tsw = panelController.Panel as TswFt5ButtonSystem; - // Wire up hard keys - tsw.Power.UserObject = new Action(b => { if (!b) avDriver.EndMeetingPress(); }); - //tsw.Home.UserObject = new Action(b => { if (!b) HomePressed(); }); - if (mainDriver.EnvironmentDriver != null) - tsw.Lights.UserObject = new Action(b => - { - if (!b) - { - //mainDriver.AvDriver.PopupInterlock.ShowInterlockedWithToggle(mainDriver.EnvironmentDriver.BackgroundSubpageJoin); - mainDriver.EnvironmentDriver.Toggle(); - } - }); - tsw.Up.UserObject = new Action(avDriver.VolumeUpPress); - tsw.Down.UserObject = new Action(avDriver.VolumeDownPress); - } - } - else - { - Debug.Console(0, panelController, "ERROR: Cannot load AvFunctionsDriver for room '{0}'", props.DefaultRoomKey); - } - }); - - return panelController; + var essentialsTouchpanelControllerFactory = new EssentialsTouchpanelControllerFactory() as IDeviceFactory; + essentialsTouchpanelControllerFactory.LoadTypeFactories(); } } diff --git a/PepperDashEssentials/UI/EssentialsTouchpanelController.cs b/PepperDashEssentials/UI/EssentialsTouchpanelController.cs index df1ecdce..d008eee0 100644 --- a/PepperDashEssentials/UI/EssentialsTouchpanelController.cs +++ b/PepperDashEssentials/UI/EssentialsTouchpanelController.cs @@ -9,11 +9,12 @@ using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.UI; using PepperDash.Core; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.PageManagers; namespace PepperDash.Essentials { - public class EssentialsTouchpanelController : Device, IHasBasicTriListWithSmartObject + public class EssentialsTouchpanelController : EssentialsDevice, IHasBasicTriListWithSmartObject { public BasicTriListWithSmartObject Panel { get; private set; } @@ -197,4 +198,132 @@ namespace PepperDash.Essentials (uo as Action)(args.Button.State == eButtonState.Pressed); } } + + public class EssentialsTouchpanelControllerFactory : EssentialsDeviceFactory + { + public EssentialsTouchpanelControllerFactory() + { + TypeNames = new List() { "tsw550", "tsw750", "tsw1050", "tsw560", "tsw760", "tsw1060", "xpanel" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + var comm = CommFactory.GetControlPropertiesConfig(dc); + var props = Newtonsoft.Json.JsonConvert.DeserializeObject(dc.Properties.ToString()); + + Debug.Console(1, "Factory Attempting to create new Generic Comm Device"); + + var panelController = new EssentialsTouchpanelController(dc.Key, dc.Name, dc.Type, props, comm.IpIdInt); + + panelController.AddPostActivationAction(() => + { + var mainDriver = new EssentialsPanelMainInterfaceDriver(panelController.Panel, props); + // Then the sub drivers + + // spin up different room drivers depending on room type + var room = DeviceManager.GetDeviceForKey(props.DefaultRoomKey); + if (room is EssentialsHuddleSpaceRoom) + { + + // Header Driver + Debug.Console(0, panelController, "Adding header driver"); + mainDriver.HeaderDriver = new EssentialsHeaderDriver(mainDriver, props); + + // AV Driver + Debug.Console(0, panelController, "Adding huddle space AV driver"); + var avDriver = new EssentialsHuddlePanelAvFunctionsDriver(mainDriver, props); + avDriver.DefaultRoomKey = props.DefaultRoomKey; + mainDriver.AvDriver = avDriver; + avDriver.CurrentRoom = room as EssentialsHuddleSpaceRoom; + + // Environment Driver + if (avDriver.CurrentRoom.PropertiesConfig.Environment != null && avDriver.CurrentRoom.PropertiesConfig.Environment.DeviceKeys.Count > 0) + { + Debug.Console(0, panelController, "Adding environment driver"); + mainDriver.EnvironmentDriver = new EssentialsEnvironmentDriver(mainDriver, props); + + mainDriver.EnvironmentDriver.GetDevicesFromConfig(avDriver.CurrentRoom.PropertiesConfig.Environment); + } + + mainDriver.HeaderDriver.SetupHeaderButtons(avDriver, avDriver.CurrentRoom); + + panelController.LoadAndShowDriver(mainDriver); // This is a little convoluted. + + if (panelController.Panel is TswFt5ButtonSystem) + { + var tsw = panelController.Panel as TswFt5ButtonSystem; + // Wire up hard keys + tsw.Power.UserObject = new Action(b => { if (!b) avDriver.PowerButtonPressed(); }); + //tsw.Home.UserObject = new Action(b => { if (!b) HomePressed(); }); + if (mainDriver.EnvironmentDriver != null) + tsw.Lights.UserObject = new Action(b => + { + if (!b) + { + //mainDriver.AvDriver.PopupInterlock.ShowInterlockedWithToggle(mainDriver.EnvironmentDriver.BackgroundSubpageJoin); + mainDriver.EnvironmentDriver.Toggle(); + } + }); + tsw.Up.UserObject = new Action(avDriver.VolumeUpPress); + tsw.Down.UserObject = new Action(avDriver.VolumeDownPress); + } + } + else if (room is EssentialsHuddleVtc1Room) + { + Debug.Console(0, panelController, "Adding huddle space VTC AV driver"); + + // Header Driver + mainDriver.HeaderDriver = new EssentialsHeaderDriver(mainDriver, props); + + // AV Driver + var avDriver = new EssentialsHuddleVtc1PanelAvFunctionsDriver(mainDriver, props); + + var codecDriver = new PepperDash.Essentials.UIDrivers.VC.EssentialsVideoCodecUiDriver(panelController.Panel, avDriver, + (room as EssentialsHuddleVtc1Room).VideoCodec, mainDriver.HeaderDriver); + avDriver.SetVideoCodecDriver(codecDriver); + avDriver.DefaultRoomKey = props.DefaultRoomKey; + mainDriver.AvDriver = avDriver; + avDriver.CurrentRoom = room as EssentialsHuddleVtc1Room; + + // Environment Driver + if (avDriver.CurrentRoom.PropertiesConfig.Environment != null && avDriver.CurrentRoom.PropertiesConfig.Environment.DeviceKeys.Count > 0) + { + Debug.Console(0, panelController, "Adding environment driver"); + mainDriver.EnvironmentDriver = new EssentialsEnvironmentDriver(mainDriver, props); + + mainDriver.EnvironmentDriver.GetDevicesFromConfig(avDriver.CurrentRoom.PropertiesConfig.Environment); + } + + mainDriver.HeaderDriver.SetupHeaderButtons(avDriver, avDriver.CurrentRoom); + + panelController.LoadAndShowDriver(mainDriver); // This is a little convoluted. + + if (panelController.Panel is TswFt5ButtonSystem) + { + var tsw = panelController.Panel as TswFt5ButtonSystem; + // Wire up hard keys + tsw.Power.UserObject = new Action(b => { if (!b) avDriver.EndMeetingPress(); }); + //tsw.Home.UserObject = new Action(b => { if (!b) HomePressed(); }); + if (mainDriver.EnvironmentDriver != null) + tsw.Lights.UserObject = new Action(b => + { + if (!b) + { + //mainDriver.AvDriver.PopupInterlock.ShowInterlockedWithToggle(mainDriver.EnvironmentDriver.BackgroundSubpageJoin); + mainDriver.EnvironmentDriver.Toggle(); + } + }); + tsw.Up.UserObject = new Action(avDriver.VolumeUpPress); + tsw.Down.UserObject = new Action(avDriver.VolumeDownPress); + } + } + else + { + Debug.Console(0, panelController, "ERROR: Cannot load AvFunctionsDriver for room '{0}'", props.DefaultRoomKey); + } + }); + + return panelController; + } + } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs index 60781e38..ecb53ffc 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs @@ -110,139 +110,16 @@ namespace PepperDash.Essentials.Core.Bridges if (device == null) continue; Debug.Console(1, this, "Linking Device: '{0}'", device.Key); - /*if (device is IBridge) // Check for this first to allow bridges in plugins to override existing bridges that apply to the same type. + //if (device is IBridge) // Check for this first to allow bridges in plugins to override existing bridges that apply to the same type. + //{ + // Debug.Console(2, this, "'{0}' is IBridge", device.Key); + //} + if (device.GetType().GetCType().IsAssignableFrom(typeof (IBridgeAdvanced))) { - Debug.Console(2, this, "'{0}' is IBridge", device.Key); - - var dev = device as IBridge; - - dev.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - }*/ - if (!(device is IBridgeAdvanced)) continue; - Debug.Console(2, this, "'{0}' is IBridgeAdvanced", device.Key); - (device as IBridgeAdvanced).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey, this); - //if (device.GetType().GetCType().IsAssignableFrom(typeof (IBridge))) - //{ - // var bridge = device as IBridge; - - // if (bridge == null) - // continue; - // Debug.Console(2, this, "Linking device {0} as IBridge"); - // bridge.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - // continue; - //} - - //if (!device.GetType().GetCType().IsAssignableFrom(typeof (IBridgeAdvanced))) continue; - - //var bridgeAdvanced = device as IBridgeAdvanced; - - //if (bridgeAdvanced == null) continue; - //Debug.Console(2, this, "Linking device {0} as IBridgeAdvanced"); - //bridgeAdvanced.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey, this); + var bridge = device as IBridgeAdvanced; + if (bridge != null) bridge.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey, this); + } } - Debug.Console(1, this, "Devices Linked."); - // - //else if (device is PepperDash.Essentials.Core.Monitoring.SystemMonitorController) - //{ - // (device as PepperDash.Essentials.Core.Monitoring.SystemMonitorController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - // continue; - //} - //else if (device is GenericComm) - //{ - // (device as GenericComm).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - // continue; - //} - //else if (device is CameraBase) - //{ - // (device as CameraBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey, this); - // continue; - //} - //else if (device is PepperDash.Essentials.Core.DisplayBase) - //{ - // (device as DisplayBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - // continue; - //} - //else if (device is DmChassisController) - //{ - // (device as DmChassisController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - // continue; - //} - //else if (device is DmBladeChassisController) - //{ - // (device as DmBladeChassisController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - // continue; - //} - //else if (device is DmpsRoutingController) - //{ - // (device as DmpsRoutingController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - // continue; - //} - //else if (device is DmpsAudioOutputController) - //{ - // (device as DmpsAudioOutputController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - // continue; - //} - //else if (device is DmTxControllerBase) - //{ - // (device as DmTxControllerBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - // continue; - //} - //else if (device is DmRmcControllerBase) - //{ - // (device as DmRmcControllerBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - // continue; - //} - //else if (device is GenericRelayDevice) - //{ - // (device as GenericRelayDevice).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - // continue; - //} - //else if (device is IRSetTopBoxBase) - //{ - // (device as IRSetTopBoxBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - // continue; - //} - //else if (device is IDigitalInput) - //{ - // (device as IDigitalInput).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - // continue; - //} - //else if (device is AppleTV) - //{ - // (device as AppleTV).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - // continue; - //} - //else if (device is HdMdxxxCEController) - //{ - // (device as HdMdxxxCEController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - // continue; - //} - //else if (device is LightingBase) - //{ - // (device as LightingBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - // continue; - //} - //else if (device is DigitalLogger) - //{ - // (device as DigitalLogger).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - // continue; - //} - //else if (device is PepperDash.Essentials.Devices.Common.Occupancy.GlsOccupancySensorBaseController) - //{ - // (device as PepperDash.Essentials.Devices.Common.Occupancy.GlsOccupancySensorBaseController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - // continue; - //} - //else if (device is StatusSignController) - //{ - // (device as StatusSignController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - // continue; - //} - //else if (device is C2nRthsController) - //{ - // (device as C2nRthsController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - // continue; - //} - //} }); @@ -411,5 +288,20 @@ namespace PepperDash.Essentials.Core.Bridges } + public class EiscApiAdvancedFactory : EssentialsDeviceFactory + { + public EiscApiAdvancedFactory() + { + TypeNames = new List() { "eiscapiadv", "eiscapiadvanced" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new EiscApiAdvanced Device"); + + return new EiscApiAdvanced(dc); + + } + } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/ConsoleCommMockDevice.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/ConsoleCommMockDevice.cs index d833aafa..f360e52b 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/ConsoleCommMockDevice.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/ConsoleCommMockDevice.cs @@ -5,10 +5,12 @@ using System.Text; using Crestron.SimplSharp; using PepperDash.Core; +using PepperDash.Essentials.Core.Config; + namespace PepperDash.Essentials.Core { - public class ConsoleCommMockDevice : Device, ICommunicationMonitor + public class ConsoleCommMockDevice : EssentialsDevice, ICommunicationMonitor { public IBasicCommunication Communication { get; private set; } public CommunicationGather PortGather { get; private set; } @@ -71,4 +73,21 @@ namespace PepperDash.Essentials.Core } } + public class ConsoleCommMockDeviceFactory : EssentialsDeviceFactory + { + public ConsoleCommMockDeviceFactory() + { + TypeNames = new List() { "commmock" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new Comm Mock Device"); + var comm = CommFactory.CreateCommForDevice(dc); + var props = Newtonsoft.Json.JsonConvert.DeserializeObject( + dc.Properties.ToString()); + return new ConsoleCommMockDevice(dc.Key, dc.Name, props, comm); + } + } + } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/PC/InRoomPc.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/PC/InRoomPc.cs index 9a13106f..03e884f0 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/PC/InRoomPc.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/PC/InRoomPc.cs @@ -4,6 +4,7 @@ using System.Linq; using Crestron.SimplSharpPro; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.Routing; using PepperDash.Core; @@ -12,7 +13,7 @@ namespace PepperDash.Essentials.Core.Devices /// /// This DVD class should cover most IR, one-way DVD and Bluray fuctions /// - public class InRoomPc : Device, IHasFeedback, IRoutingOutputs, IAttachVideoStatus, IUiDisplayInfo, IUsageTracking + public class InRoomPc : EssentialsDevice, IHasFeedback, IRoutingOutputs, IAttachVideoStatus, IUiDisplayInfo, IUsageTracking { public uint DisplayUiType { get { return DisplayUiConstants.TypeLaptop; } } public string IconName { get; set; } @@ -63,4 +64,19 @@ namespace PepperDash.Essentials.Core.Devices #endregion } + + public class InRoomPcFactory : EssentialsDeviceFactory + { + public InRoomPcFactory() + { + TypeNames = new List() { "inroompc" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new InRoomPc Device"); + return new InRoomPc(dc.Key, dc.Name); + } + } + } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/PC/Laptop.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/PC/Laptop.cs index a1a8b30b..a2864d77 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/PC/Laptop.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/PC/Laptop.cs @@ -4,6 +4,7 @@ using System.Linq; using Crestron.SimplSharpPro; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.Routing; using PepperDash.Core; @@ -12,7 +13,7 @@ namespace PepperDash.Essentials.Core.Devices /// /// This DVD class should cover most IR, one-way DVD and Bluray fuctions /// - public class Laptop : Device, IHasFeedback, IRoutingOutputs, IAttachVideoStatus, IUiDisplayInfo, IUsageTracking + public class Laptop : EssentialsDevice, IHasFeedback, IRoutingOutputs, IAttachVideoStatus, IUiDisplayInfo, IUsageTracking { public uint DisplayUiType { get { return DisplayUiConstants.TypeLaptop; } } public string IconName { get; set; } @@ -63,4 +64,18 @@ namespace PepperDash.Essentials.Core.Devices #endregion } + + public class LaptopFactory : EssentialsDeviceFactory + { + public LaptopFactory() + { + TypeNames = new List() { "laptop" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new Laptop Device"); + return new Core.Devices.Laptop(dc.Key, dc.Name); + } + } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/BasicIrDisplay.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/BasicIrDisplay.cs index 29dcdd55..95628e4e 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/BasicIrDisplay.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/BasicIrDisplay.cs @@ -8,6 +8,7 @@ using Crestron.SimplSharpPro.DeviceSupport; using PepperDash.Core; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Routing; @@ -208,4 +209,27 @@ namespace PepperDash.Essentials.Core LinkDisplayToApi(this, trilist, joinStart, joinMapKey, bridge); } } + + public class BasicIrDisplayFactory : EssentialsDeviceFactory + { + public BasicIrDisplayFactory() + { + TypeNames = new List() { "basicirdisplay" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new BasicIrDisplay Device"); + var ir = IRPortHelper.GetIrPort(dc.Properties); + if (ir != null) + { + var display = new BasicIrDisplay(dc.Key, dc.Name, ir.Port, ir.FileName); + display.IrPulseTime = 200; // Set default pulse time for IR commands. + return display; + } + + return null; + } + } + } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/MockDisplay.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/MockDisplay.cs index 8c188997..e6db4316 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/MockDisplay.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/MockDisplay.cs @@ -12,7 +12,7 @@ using Crestron.SimplSharpPro.DM.Endpoints.Transmitters; using PepperDash.Core; using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Routing; - +using PepperDash.Essentials.Core.Config; namespace PepperDash.Essentials.Core { @@ -182,4 +182,19 @@ namespace PepperDash.Essentials.Core LinkDisplayToApi(this, trilist, joinStart, joinMapKey, bridge); } } + + public class MockDisplayFactory : EssentialsDeviceFactory + { + public MockDisplayFactory() + { + TypeNames = new List() { "mockdisplay" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new Mock Display Device"); + return new MockDisplay(dc.Key, dc.Name); + } + } + } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/Behaviours/RoomOnToDefaultSourceWhenOccupied.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/Behaviours/RoomOnToDefaultSourceWhenOccupied.cs index fcb04420..11debb03 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/Behaviours/RoomOnToDefaultSourceWhenOccupied.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/Behaviours/RoomOnToDefaultSourceWhenOccupied.cs @@ -522,4 +522,19 @@ namespace PepperDash.Essentials.Core [JsonProperty("enableSaturday")] public bool EnableSaturday { get; set; } } + + public class RoomOnToDefaultSourceWhenOccupiedFactory : EssentialsDeviceFactory + { + public RoomOnToDefaultSourceWhenOccupiedFactory() + { + TypeNames = new List() { "roomonwhenoccupancydetectedfeature" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new RoomOnToDefaultSourceWhenOccupied Device"); + return new RoomOnToDefaultSourceWhenOccupied(dc); + } + } + } \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DgeController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DgeController.cs index 0fc00323..6b586ac3 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DgeController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DgeController.cs @@ -63,4 +63,37 @@ namespace PepperDash.Essentials.DM.Endpoints.DGEs #endregion } + + public class DgeControllerFactory : EssentialsDeviceFactory + { + public DgeControllerFactory() + { + TypeNames = new List() { "dge100", "dmdge200c" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + var typeName = dc.Type.ToLower(); + var comm = CommFactory.GetControlPropertiesConfig(dc); + var props = JsonConvert.DeserializeObject(dc.Properties.ToString()); + + Debug.Console(1, "Factory Attempting to create new DgeControllerm Device"); + + Dge100 dgeDevice = null; + if (typeName == "dge100") + dgeDevice = new Dge100(comm.IpIdInt, Global.ControlSystem); + else if (typeName == "dmdge200c") + dgeDevice = new DmDge200C(comm.IpIdInt, Global.ControlSystem); + + if (dgeDevice == null) + { + Debug.Console(1, "Unable to create DGE device"); + return null; + } + + var dgeController = new DgeController(dc.Key + "-comPorts", dc.Name, dgeDevice, dc, props); + + return dgeController; + } + } } \ No newline at end of file diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Audio/GenericAudioOut.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Audio/GenericAudioOut.cs index d89a36fc..70596904 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Audio/GenericAudioOut.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Audio/GenericAudioOut.cs @@ -6,6 +6,8 @@ using Crestron.SimplSharp; using PepperDash.Core; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Config; + using PepperDash.Essentials.Core.Routing; namespace PepperDash.Essentials.Devices.Common @@ -13,7 +15,7 @@ namespace PepperDash.Essentials.Devices.Common /// /// Represents and audio endpoint /// - public class GenericAudioOut : Device, IRoutingSinkNoSwitching + public class GenericAudioOut : EssentialsDevice, IRoutingSinkNoSwitching { public event SourceInfoChangeHandler CurrentSourceChange; @@ -98,4 +100,20 @@ namespace PepperDash.Essentials.Devices.Common } + public class GenericAudioOutWithVolumeFactory : EssentialsDeviceFactory + { + public GenericAudioOutWithVolumeFactory() + { + TypeNames = new List() { "genericaudiooutwithvolume" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new GenericAudioOutWithVolumeFactory Device"); + var zone = dc.Properties.Value("zone"); + return new GenericAudioOutWithVolume(dc.Key, dc.Name, + dc.Properties.Value("volumeDeviceKey"), zone); + } + } + } \ No newline at end of file diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Cameras/CameraVisca.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Cameras/CameraVisca.cs index d95a14cc..bb6758b6 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Cameras/CameraVisca.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Cameras/CameraVisca.cs @@ -7,6 +7,7 @@ using Crestron.SimplSharpPro.DeviceSupport; using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Bridges; +using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Devices.Common.Codec; using System.Text.RegularExpressions; using Crestron.SimplSharp.Reflection; @@ -244,4 +245,22 @@ namespace PepperDash.Essentials.Devices.Common.Cameras #endregion } + + public class CameraViscaFactory : EssentialsDeviceFactory + { + public CameraViscaFactory() + { + TypeNames = new List() { "cameravisca" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new CameraVisca Device"); + var comm = CommFactory.CreateCommForDevice(dc); + var props = Newtonsoft.Json.JsonConvert.DeserializeObject( + dc.Properties.ToString()); + return new Cameras.CameraVisca(dc.Key, dc.Name, comm, props); + } + } + } \ No newline at end of file diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Crestron/Gateways/CenRfgwController.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Crestron/Gateways/CenRfgwController.cs index ee37674a..04f6eb17 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Crestron/Gateways/CenRfgwController.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Crestron/Gateways/CenRfgwController.cs @@ -8,6 +8,8 @@ using Crestron.SimplSharpPro.Gateways; using PepperDash.Core; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Config; + namespace PepperDash.Essentials.Devices.Common { @@ -112,4 +114,20 @@ namespace PepperDash.Essentials.Devices.Common { Ethernet, EthernetShared, Cresnet } + + public class CenRfgwControllerFactory : EssentialsDeviceFactory + { + public CenRfgwControllerFactory() + { + TypeNames = new List() { "cenrfgwex", "cenerfgwpoe" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new CEN-GWEXER Device"); + return CenRfgwController.GetNewExGatewayController(dc.Key, dc.Name, + dc.Properties.Value("id"), dc.Properties.Value("gatewayType")); + } + } + } \ No newline at end of file diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/DSP/BiampTesira/BiampTesiraForteDsp.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/DSP/BiampTesira/BiampTesiraForteDsp.cs index 27a29145..86850fea 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/DSP/BiampTesira/BiampTesiraForteDsp.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/DSP/BiampTesira/BiampTesiraForteDsp.cs @@ -5,6 +5,7 @@ using System.Text; using Crestron.SimplSharp; using PepperDash.Core; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Config; using System.Text.RegularExpressions; @@ -373,4 +374,22 @@ namespace PepperDash.Essentials.Devices.Common.DSP public TesiraForteControlPoint ControlPoint { get; set; } } } + + public class BiampTesiraForteDspFactory : EssentialsDeviceFactory + { + public BiampTesiraForteDspFactory() + { + TypeNames = new List() { "biamptesira" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new BiampTesira Device"); + var comm = CommFactory.CreateCommForDevice(dc); + var props = Newtonsoft.Json.JsonConvert.DeserializeObject( + dc.Properties.ToString()); + return new BiampTesiraForteDsp(dc.Key, dc.Name, comm, props); + } + } + } \ No newline at end of file diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/DSP/DspBase.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/DSP/DspBase.cs index 0f572642..cad57761 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/DSP/DspBase.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/DSP/DspBase.cs @@ -9,7 +9,7 @@ using PepperDash.Essentials.Core; namespace PepperDash.Essentials.Devices.Common.DSP { - public abstract class DspBase : Device + public abstract class DspBase : EssentialsDevice { public Dictionary LevelControlPoints { get; private set; } diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/DiscPlayer/IRDiscPlayerBase.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/DiscPlayer/IRDiscPlayerBase.cs index 0f4a65ac..581ea3b5 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/DiscPlayer/IRDiscPlayerBase.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/DiscPlayer/IRDiscPlayerBase.cs @@ -5,13 +5,18 @@ using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharpPro; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + + using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Routing; +using PepperDash.Essentials.Core.Config; namespace PepperDash.Essentials.Devices.Common { - public class IRBlurayBase : Device, IDiscPlayerControls, IUiDisplayInfo, IRoutingOutputs, IUsageTracking + public class IRBlurayBase : EssentialsDevice, IDiscPlayerControls, IUiDisplayInfo, IRoutingOutputs, IUsageTracking { public IrOutputPortController IrPort { get; private set; } @@ -311,4 +316,30 @@ namespace PepperDash.Essentials.Devices.Common #endregion } + + public class IRBlurayBaseFactory : EssentialsDeviceFactory + { + public IRBlurayBaseFactory() + { + TypeNames = new List() { "discplayer", "bluray" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new IRBlurayPlayer Device"); + + if (dc.Properties["control"]["method"].Value() == "ir") + { + var irCont = IRPortHelper.GetIrOutputPortController(dc); + return new IRBlurayBase(dc.Key, dc.Name, irCont); + } + else if (dc.Properties["control"]["method"].Value() == "com") + { + Debug.Console(0, "[{0}] COM Device type not implemented YET!", dc.Key); + } + + return null; + } + } + } \ No newline at end of file diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Factory/DeviceFactory.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Factory/DeviceFactory.cs index 58f97b03..fc07a6dc 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Factory/DeviceFactory.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Factory/DeviceFactory.cs @@ -18,12 +18,51 @@ using PepperDash.Essentials.Devices.Common.VideoCodec; using PepperDash.Essentials.Devices.Common.Occupancy; using PepperDash.Essentials.Devices.Common.Environment; - - namespace PepperDash.Essentials.Devices.Common { public class DeviceFactory { + public DeviceFactory() + { + var appleTVFactory = new AppleTVFactory() as IDeviceFactory; + appleTVFactory.LoadTypeFactories(); + + var analogWayLCFactory = new AnalogWayLiveCoreFactory() as IDeviceFactory; + analogWayLCFactory.LoadTypeFactories(); + + var basicIrDisplayFactory = new BasicIrDisplayFactory() as IDeviceFactory; + basicIrDisplayFactory.LoadTypeFactories(); + + var biampTesiraFactory = new BiampTesiraForteDspFactory() as IDeviceFactory; + biampTesiraFactory.LoadTypeFactories(); + + var cameraViscaFactory = new Cameras.CameraViscaFactory() as IDeviceFactory; + cameraViscaFactory.LoadTypeFactories(); + + var cenRfGwFactory = new CenRfgwControllerFactory() as IDeviceFactory; + cenRfGwFactory.LoadTypeFactories(); + + var irBlurayFactory = new IRBlurayBaseFactory() as IDeviceFactory; + irBlurayFactory.LoadTypeFactories(); + + var digitalLoggerFactory = new DigitalLoggerFactory() as IDeviceFactory; + digitalLoggerFactory.LoadTypeFactories(); + + var genericAudioOutFactory = new GenericAudioOutWithVolumeFactory() as IDeviceFactory; + genericAudioOutFactory.LoadTypeFactories(); + + var genericSourceFactory = new GenericSourceFactory() as IDeviceFactory; + genericSourceFactory.LoadTypeFactories(); + + var inRoomPcFactory = new Core.Devices.InRoomPcFactory() as IDeviceFactory; + inRoomPcFactory.LoadTypeFactories(); + + var laptopFactory = new Core.Devices.LaptopFactory() as IDeviceFactory; + laptopFactory.LoadTypeFactories(); + + + } + public static IKeyed GetDevice(DeviceConfig dc) { var key = dc.Key; @@ -36,100 +75,8 @@ namespace PepperDash.Essentials.Devices.Common var typeName = dc.Type.ToLower(); var groupName = dc.Group.ToLower(); - if (typeName == "appletv") - { - var irCont = IRPortHelper.GetIrOutputPortController(dc); - return new AppleTV(key, name, irCont); - } - else if (typeName == "analogwaylivecore") - { - var comm = CommFactory.CreateCommForDevice(dc); - var props = JsonConvert.DeserializeObject( - properties.ToString()); - return new AnalogWayLiveCore(key, name, comm, props); - } - else if (typeName == "basicirdisplay") - { - var ir = IRPortHelper.GetIrPort(properties); - if (ir != null) - { - var display = new BasicIrDisplay(key, name, ir.Port, ir.FileName); - display.IrPulseTime = 200; // Set default pulse time for IR commands. - return display; - } - } - - else if (typeName == "biamptesira") - { - var comm = CommFactory.CreateCommForDevice(dc); - var props = JsonConvert.DeserializeObject( - properties.ToString()); - return new BiampTesiraForteDsp(key, name, comm, props); - } - - - else if (typeName == "cameravisca") - { - var comm = CommFactory.CreateCommForDevice(dc); - var props = JsonConvert.DeserializeObject( - properties.ToString()); - return new Cameras.CameraVisca(key, name, comm, props); - } - - else if (typeName == "cenrfgwex") - { - return CenRfgwController.GetNewExGatewayController(key, name, - properties.Value("id"), properties.Value("gatewayType")); - } - - else if (typeName == "cenerfgwpoe") - { - return CenRfgwController.GetNewErGatewayController(key, name, - properties.Value("id"), properties.Value("gatewayType")); - } - - else if (groupName == "discplayer") // (typeName == "irbluray") - { - if (properties["control"]["method"].Value() == "ir") - { - var irCont = IRPortHelper.GetIrOutputPortController(dc); - return new IRBlurayBase(key, name, irCont); - } - else if (properties["control"]["method"].Value() == "com") - { - Debug.Console(0, "[{0}] COM Device type not implemented YET!", key); - } - } - else if (typeName == "digitallogger") - { - // var comm = CommFactory.CreateCommForDevice(dc); - var props = JsonConvert.DeserializeObject( - properties.ToString()); - return new DigitalLogger(key, name, props); - } - else if (typeName == "genericaudiooutwithvolume") - { - var zone = dc.Properties.Value("zone"); - return new GenericAudioOutWithVolume(key, name, - dc.Properties.Value("volumeDeviceKey"), zone); - } - - else if (groupName == "genericsource") - { - return new GenericSource(key, name); - } - - else if (typeName == "inroompc") - { - return new Core.Devices.InRoomPc(key, name); - } - - else if (typeName == "laptop") - { - return new Core.Devices.Laptop(key, name); - } - - else if (typeName == "bluejeanspc") + // TODO: Continue from here + if (typeName == "bluejeanspc") { return new SoftCodec.BlueJeansPc(key, name); } diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Generic/GenericSource.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Generic/GenericSource.cs index 4627fd7b..697639e5 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Generic/GenericSource.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Generic/GenericSource.cs @@ -8,11 +8,12 @@ using Crestron.SimplSharpPro.DeviceSupport; using PepperDash.Core; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.Routing; namespace PepperDash.Essentials.Devices.Common { - public class GenericSource : Device, IUiDisplayInfo, IRoutingOutputs, IUsageTracking + public class GenericSource : EssentialsDevice, IUiDisplayInfo, IRoutingOutputs, IUsageTracking { public uint DisplayUiType { get { return DisplayUiConstants.TypeNoControls; } } @@ -39,4 +40,19 @@ namespace PepperDash.Essentials.Devices.Common #endregion } + + public class GenericSourceFactory : EssentialsDeviceFactory + { + public GenericSourceFactory() + { + TypeNames = new List() { "genericsource" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new Generic Source Device"); + return new GenericSource(dc.Key, dc.Name); + } + } + } \ No newline at end of file diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/ImageProcessors/AnalogWay/AnalongWayLiveCore.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/ImageProcessors/AnalogWay/AnalongWayLiveCore.cs index c2178bdb..97d8a8dd 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/ImageProcessors/AnalogWay/AnalongWayLiveCore.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/ImageProcessors/AnalogWay/AnalongWayLiveCore.cs @@ -5,13 +5,14 @@ using System.Text; using Crestron.SimplSharp; using PepperDash.Core; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Config; using System.Text.RegularExpressions; namespace PepperDash.Essentials.Devices.Common { - public class AnalogWayLiveCore : Device + public class AnalogWayLiveCore : EssentialsDevice { public IBasicCommunication Communication { get; private set; } public CommunicationGather PortGather { get; private set; } @@ -238,4 +239,22 @@ namespace PepperDash.Essentials.Devices.Common // public QscDspControlPoint ControlPoint { get; set; } } } + + public class AnalogWayLiveCoreFactory : EssentialsDeviceFactory + { + public AnalogWayLiveCoreFactory() + { + TypeNames = new List() { "analogwaylivecore" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new AnalogWayLiveCore Device"); + var comm = CommFactory.CreateCommForDevice(dc); + var props = Newtonsoft.Json.JsonConvert.DeserializeObject( + dc.Properties.ToString()); + return new AnalogWayLiveCore(dc.Key, dc.Name, comm, props); + } + } + } \ No newline at end of file diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Power Controllers/Digitallogger.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Power Controllers/Digitallogger.cs index 42666045..11a96537 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Power Controllers/Digitallogger.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Power Controllers/Digitallogger.cs @@ -11,6 +11,7 @@ using Crestron.SimplSharp.Net.Http; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using PepperDash.Essentials.Core.Bridges; +using PepperDash.Essentials.Core.Config; namespace PepperDash.Essentials.Devices.Common @@ -337,4 +338,20 @@ namespace PepperDash.Essentials.Devices.Common } } + + public class DigitalLoggerFactory : EssentialsDeviceFactory + { + public DigitalLoggerFactory() + { + TypeNames = new List() { "digitallogger" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new DigitalLogger Device"); + var props = JsonConvert.DeserializeObject( + dc.Properties.ToString()); + return new DigitalLogger(dc.Key, dc.Name, props); + } + } } \ No newline at end of file diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Streaming/AppleTV.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Streaming/AppleTV.cs index db729ce7..1182d312 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Streaming/AppleTV.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Streaming/AppleTV.cs @@ -8,6 +8,7 @@ using Crestron.SimplSharpPro.DeviceSupport; using Newtonsoft.Json; using PepperDash.Core; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Routing; @@ -166,4 +167,20 @@ namespace PepperDash.Essentials.Devices.Common trilist.SetBoolSigAction(joinMap.PlayPause, Play); } } + + public class AppleTVFactory : EssentialsDeviceFactory + { + public AppleTVFactory() + { + TypeNames = new List() { "appletv" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new AppleTV Device"); + var irCont = IRPortHelper.GetIrOutputPortController(dc); + return new AppleTV(dc.Key, dc.Name, irCont); + } + } + } \ No newline at end of file From 4f6ae386b4009047eab90d879e639dc86d1a1903 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Wed, 22 Apr 2020 16:17:07 -0600 Subject: [PATCH 062/156] Finishes converting all existing types to new DeviceFactory mechanism. #106 --- PepperDashEssentials/Bridges/BridgeFactory.cs | 1 - PepperDashEssentials/ControlSystem.cs | 6 +- .../Inputs/GenericDigitalInputDevice.cs | 93 +++++ .../Inputs/GenericVersiportInputDevice.cs | 2 +- .../Crestron IO/Relay/GenericRelayDevice.cs | 72 ++++ .../Factory/DeviceFactory.cs | 2 +- .../MicrophonePrivacyController.cs | 20 +- .../Shades/ShadeBase.cs | 2 +- .../Shades/ShadeController.cs | 20 +- .../AudioCodec/AudioCodecBase.cs | 2 +- .../AudioCodec/MockAC/MockAC.cs | 17 + .../Display/AvocorVTFDisplay.cs | 21 ++ .../Display/DeviceFactory.cs | 55 +-- .../Display/NECPSXMDisplay.cs | 20 ++ .../Display/PanasonicThDisplay.cs | 30 +- .../Display/SamsungMDCDisplay.cs | 22 ++ .../Environment/Crestron Lighting/Din8sw8.cs | 20 +- .../Environment/Lutron/LutronQuantum.cs | 20 ++ .../Environment/Somfy/RelayControlledShade.cs | 18 + .../Factory/DeviceFactory.cs | 322 +++--------------- .../ImageProcessors/TVOneCorio.cs | 21 +- .../GlsOccupancySensorBaseController.cs | 35 ++ .../GlsOdtOccupancySensorController.cs | 34 ++ .../SetTopBox/IRSetTopBoxBase.cs | 24 ++ .../SoftCodec/BlueJeansPc.cs | 15 + .../Streaming/Roku.cs | 20 +- .../VideoCodec/CiscoCodec/CiscoSparkCodec.cs | 15 + .../VideoCodec/MockVC/MockVC.cs | 15 + .../VideoCodec/ZoomRoom/ZoomRoom.cs | 16 + 29 files changed, 626 insertions(+), 334 deletions(-) diff --git a/PepperDashEssentials/Bridges/BridgeFactory.cs b/PepperDashEssentials/Bridges/BridgeFactory.cs index 21d3a346..c17d4642 100644 --- a/PepperDashEssentials/Bridges/BridgeFactory.cs +++ b/PepperDashEssentials/Bridges/BridgeFactory.cs @@ -32,7 +32,6 @@ namespace PepperDash.Essentials } - public class CommBridge : Device { public CommBridgeProperties Properties { get; private set; } diff --git a/PepperDashEssentials/ControlSystem.cs b/PepperDashEssentials/ControlSystem.cs index 3e6654b2..b7ce9288 100644 --- a/PepperDashEssentials/ControlSystem.cs +++ b/PepperDashEssentials/ControlSystem.cs @@ -101,7 +101,7 @@ namespace PepperDash.Essentials new BridgeFactory(); new PepperDash.Essentials.Devices.Common.DeviceFactory(); - + new PepperDash.Essentials.Devices.Displays.DisplayDeviceFactory(); } @@ -379,8 +379,8 @@ namespace PepperDash.Essentials newDev = PepperDash.Essentials.Core.DeviceFactory.GetDevice(devConf); // - if (newDev == null) - newDev = PepperDash.Essentials.Devices.Displays.DisplayDeviceFactory.GetDevice(devConf); + //if (newDev == null) + // newDev = PepperDash.Essentials.Devices.Displays.DisplayDeviceFactory.GetDevice(devConf); // if (newDev != null) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericDigitalInputDevice.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericDigitalInputDevice.cs index 70921314..33cb0ae6 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericDigitalInputDevice.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericDigitalInputDevice.cs @@ -8,6 +8,8 @@ using Crestron.SimplSharpPro.DeviceSupport; using Newtonsoft.Json; using PepperDash.Core; using PepperDash.Essentials.Core.Bridges; +using PepperDash.Essentials.Core.Config; +using PepperDash_Essentials_Core.Devices; namespace PepperDash.Essentials.Core.CrestronIO { @@ -66,4 +68,95 @@ namespace PepperDash.Essentials.Core.CrestronIO } } } + + public class GenericDigitalInputDeviceFactory : EssentialsDeviceFactory + { + public GenericDigitalInputDeviceFactory() + { + TypeNames = new List() { "digitalinput" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new Digtal Input Device"); + + var props = JsonConvert.DeserializeObject(dc.Properties.ToString()); + + IDigitalInputPorts portDevice; + + if (props.PortDeviceKey == "processor") + portDevice = Global.ControlSystem as IDigitalInputPorts; + else + portDevice = DeviceManager.GetDeviceForKey(props.PortDeviceKey) as IDigitalInputPorts; + + if (portDevice == null) + Debug.Console(0, "ERROR: Unable to add digital input device with key '{0}'. Port Device does not support digital inputs", dc.Key); + else + { + var cs = (portDevice as CrestronControlSystem); + if (cs == null) + { + Debug.Console(0, "ERROR: Port device for [{0}] is not control system", props.PortDeviceKey); + return null; + } + + if (cs.SupportsVersiport) + { + Debug.Console(1, "Attempting to add Digital Input device to Versiport port '{0}'", props.PortNumber); + + if (props.PortNumber > cs.NumberOfVersiPorts) + { + Debug.Console(0, "WARNING: Cannot add Vesiport {0} on {1}. Out of range", + props.PortNumber, props.PortDeviceKey); + return null; + } + + Versiport vp = cs.VersiPorts[props.PortNumber]; + + if (!vp.Registered) + { + var regSuccess = vp.Register(); + if (regSuccess == eDeviceRegistrationUnRegistrationResponse.Success) + { + Debug.Console(1, "Successfully Created Digital Input Device on Versiport"); + return new GenericVersiportDigitalInputDevice(dc.Key, vp, props); + } + else + { + Debug.Console(0, "WARNING: Attempt to register versiport {0} on device with key '{1}' failed: {2}", + props.PortNumber, props.PortDeviceKey, regSuccess); + return null; + } + } + } + else if (cs.SupportsDigitalInput) + { + Debug.Console(1, "Attempting to add Digital Input device to Digital Input port '{0}'", props.PortNumber); + + if (props.PortNumber > cs.NumberOfDigitalInputPorts) + { + Debug.Console(0, "WARNING: Cannot register DIO port {0} on {1}. Out of range", + props.PortNumber, props.PortDeviceKey); + return null; + } + + DigitalInput digitalInput = cs.DigitalInputPorts[props.PortNumber]; + + if (!digitalInput.Registered) + { + if (digitalInput.Register() == eDeviceRegistrationUnRegistrationResponse.Success) + { + Debug.Console(1, "Successfully Created Digital Input Device on Digital Input"); + return new GenericDigitalInputDevice(dc.Key, digitalInput); + } + else + Debug.Console(0, "WARNING: Attempt to register digital input {0} on device with key '{1}' failed.", + props.PortNumber, props.PortDeviceKey); + } + } + } + return null; + } + } + } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericVersiportInputDevice.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericVersiportInputDevice.cs index 4c5359b9..90ff4fa0 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericVersiportInputDevice.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericVersiportInputDevice.cs @@ -12,7 +12,7 @@ namespace PepperDash.Essentials.Core.CrestronIO /// /// Represents a generic digital input deviced tied to a versiport /// - public class GenericVersiportDigitalInputDevice : Device, IDigitalInput + public class GenericVersiportDigitalInputDevice : EssentialsDevice, IDigitalInput { public Versiport InputPort { get; private set; } diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Relay/GenericRelayDevice.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Relay/GenericRelayDevice.cs index 39a6786b..3e3b0576 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Relay/GenericRelayDevice.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Relay/GenericRelayDevice.cs @@ -8,6 +8,8 @@ using Crestron.SimplSharpPro.DeviceSupport; using Newtonsoft.Json; using PepperDash.Core; using PepperDash.Essentials.Core.Bridges; +using PepperDash.Essentials.Core.Config; +using PepperDash_Essentials_Core.Devices; namespace PepperDash.Essentials.Core.CrestronIO { @@ -100,4 +102,74 @@ namespace PepperDash.Essentials.Core.CrestronIO OutputIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Relay]); } } + + public class GenericRelayDeviceFactory : EssentialsDeviceFactory + { + public GenericRelayDeviceFactory() + { + TypeNames = new List() { "relayoutput" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new Generic Relay Device"); + + var props = JsonConvert.DeserializeObject(dc.Properties.ToString()); + var key = dc.Key; + + IRelayPorts portDevice; + + if (props.PortDeviceKey == "processor") + portDevice = Global.ControlSystem as IRelayPorts; + else + portDevice = DeviceManager.GetDeviceForKey(props.PortDeviceKey) as IRelayPorts; + + if (portDevice == null) + Debug.Console(0, "Unable to add relay device with key '{0}'. Port Device does not support relays", key); + else + { + var cs = (portDevice as CrestronControlSystem); + + if (cs != null) + { + // The relay is on a control system processor + if (!cs.SupportsRelay || props.PortNumber > cs.NumberOfRelayPorts) + { + Debug.Console(0, "Port Device: {0} does not support relays or does not have enough relays"); + return null; + } + } + else + { + // The relay is on another device type + + if (props.PortNumber > portDevice.NumberOfRelayPorts) + { + Debug.Console(0, "Port Device: {0} does not have enough relays"); + return null; + } + } + + Relay relay = portDevice.RelayPorts[props.PortNumber]; + + if (!relay.Registered) + { + if (relay.Register() == eDeviceRegistrationUnRegistrationResponse.Success) + return new GenericRelayDevice(key, relay); + else + Debug.Console(0, "Attempt to register relay {0} on device with key '{1}' failed.", props.PortNumber, props.PortDeviceKey); + } + else + { + return new GenericRelayDevice(key, relay); + } + + // Future: Check if portDevice is 3-series card or other non control system that supports versiports + } + + return null; + + } + } + } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/DeviceFactory.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/DeviceFactory.cs index 80725cc3..4e12ab05 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/DeviceFactory.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/DeviceFactory.cs @@ -105,7 +105,7 @@ namespace PepperDash.Essentials.Core Debug.Console(0, "Device Types:"); - foreach (var type in types) + foreach (var type in types.OrderBy(t => t.Key)) { var description = type.Value.Description; var cType = "Not Specified by Plugin"; diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Microphone Privacy/MicrophonePrivacyController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Microphone Privacy/MicrophonePrivacyController.cs index e238c40e..ece2c65f 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Microphone Privacy/MicrophonePrivacyController.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Microphone Privacy/MicrophonePrivacyController.cs @@ -6,6 +6,7 @@ using Crestron.SimplSharp; using PepperDash.Core; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.CrestronIO; @@ -15,7 +16,7 @@ namespace PepperDash.Essentials.Core.Privacy /// Used for applications where one or more microphones with momentary contact closure outputs are used to /// toggle the privacy state of the room. Privacy state feedback is represented /// - public class MicrophonePrivacyController : Device + public class MicrophonePrivacyController : EssentialsDevice { MicrophonePrivacyControllerConfig Config; @@ -225,4 +226,21 @@ namespace PepperDash.Essentials.Core.Privacy } } } + + public class MicrophonePrivacyControllerFactory : EssentialsDeviceFactory + { + public MicrophonePrivacyControllerFactory() + { + TypeNames = new List() { "microphoneprivacycontroller" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new MIcrophonePrivacyController Device"); + var props = Newtonsoft.Json.JsonConvert.DeserializeObject(dc.Properties.ToString()); + + return new Core.Privacy.MicrophonePrivacyController(dc.Key, props); + } + } + } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Shades/ShadeBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Shades/ShadeBase.cs index 636a5440..d30b716a 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Shades/ShadeBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Shades/ShadeBase.cs @@ -12,7 +12,7 @@ namespace PepperDash.Essentials.Core.Shades /// /// Base class for a shade device /// - public abstract class ShadeBase : Device, IShadesOpenClose + public abstract class ShadeBase : EssentialsDevice, IShadesOpenClose { public ShadeBase(string key, string name) : base(key, name) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Shades/ShadeController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Shades/ShadeController.cs index b226af05..fc50f631 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Shades/ShadeController.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Shades/ShadeController.cs @@ -5,13 +5,14 @@ using System.Text; using Crestron.SimplSharp; using PepperDash.Core; +using PepperDash.Essentials.Core.Config; namespace PepperDash.Essentials.Core.Shades { /// /// Class that contains the shades to be controlled in a room /// - public class ShadeController : Device, IShades + public class ShadeController : EssentialsDevice, IShades { ShadeControllerConfigProperties Config; @@ -55,4 +56,21 @@ namespace PepperDash.Essentials.Core.Shades public string Key { get; set; } } } + + public class ShadeControllerFactory : EssentialsDeviceFactory + { + public ShadeControllerFactory() + { + TypeNames = new List() { "shadecontroller" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new ShadeController Device"); + var props = Newtonsoft.Json.JsonConvert.DeserializeObject(dc.Properties.ToString()); + + return new Core.Shades.ShadeController(dc.Key, dc.Name, props); + } + } + } \ No newline at end of file diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/AudioCodec/AudioCodecBase.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/AudioCodec/AudioCodecBase.cs index 15a998a4..56998d46 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/AudioCodec/AudioCodecBase.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/AudioCodec/AudioCodecBase.cs @@ -10,7 +10,7 @@ using PepperDash.Essentials.Devices.Common.Codec; namespace PepperDash.Essentials.Devices.Common.AudioCodec { - public abstract class AudioCodecBase : Device, IHasDialer, IUsageTracking, IAudioCodecInfo + public abstract class AudioCodecBase : EssentialsDevice, IHasDialer, IUsageTracking, IAudioCodecInfo { public event EventHandler CallStatusChange; diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/AudioCodec/MockAC/MockAC.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/AudioCodec/MockAC/MockAC.cs index e0645624..84880654 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/AudioCodec/MockAC/MockAC.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/AudioCodec/MockAC/MockAC.cs @@ -6,6 +6,7 @@ using Crestron.SimplSharp; using PepperDash.Core; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Devices.Common.Codec; namespace PepperDash.Essentials.Devices.Common.AudioCodec @@ -111,4 +112,20 @@ namespace PepperDash.Essentials.Devices.Common.AudioCodec } } } + + public class MockACFactory : EssentialsDeviceFactory + { + public MockACFactory() + { + TypeNames = new List() { "mockac" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new MockAc Device"); + var props = Newtonsoft.Json.JsonConvert.DeserializeObject(dc.Properties.ToString()); + return new AudioCodec.MockAC(dc.Key, dc.Name, props); + } + } + } \ No newline at end of file diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/AvocorVTFDisplay.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/AvocorVTFDisplay.cs index 71d8e149..19482029 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/AvocorVTFDisplay.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/AvocorVTFDisplay.cs @@ -9,6 +9,7 @@ using Crestron.SimplSharpPro.DeviceSupport; using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Bridges; +using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.Routing; using Feedback = PepperDash.Essentials.Core.Feedback; @@ -725,4 +726,24 @@ namespace PepperDash.Essentials.Devices.Displays #endregion } + + public class AvocorDisplayFactory : EssentialsDeviceFactory + { + public AvocorDisplayFactory() + { + TypeNames = new List() { "avocorvtf" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new Generic Comm Device"); + var comm = CommFactory.CreateCommForDevice(dc); + if (comm != null) + return new AvocorDisplay(dc.Key, dc.Name, comm, null); + else + return null; + + } + } + } \ No newline at end of file diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/DeviceFactory.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/DeviceFactory.cs index 8b4941d7..099e1204 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/DeviceFactory.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/DeviceFactory.cs @@ -14,51 +14,20 @@ namespace PepperDash.Essentials.Devices.Displays { public class DisplayDeviceFactory { - public static IKeyed GetDevice(DeviceConfig dc) - { - var key = dc.Key; - var name = dc.Name; - var type = dc.Type; - var properties = dc.Properties; + public DisplayDeviceFactory() + { + var necFactory = new NecPSXMDisplayFactory() as IDeviceFactory; + necFactory.LoadTypeFactories(); - var typeName = dc.Type.ToLower(); + var panasonicThFactory = new PanasonicThDisplayFactory() as IDeviceFactory; + panasonicThFactory.LoadTypeFactories(); - try - { - if (typeName == "necmpsx") - { - var comm = CommFactory.CreateCommForDevice(dc); - if (comm != null) - return new NecPSXMDisplay(dc.Key, dc.Name, comm); - } - if (typeName == "panasonicthef") - { - var comm = CommFactory.CreateCommForDevice(dc); - if (comm != null) - return new PanasonicThefDisplay(dc.Key, dc.Name, comm); - } - else if(typeName == "samsungmdc") - { - var comm = CommFactory.CreateCommForDevice(dc); - if (comm != null) - return new SamsungMDC(dc.Key, dc.Name, comm, dc.Properties["id"].Value()); - } - if (typeName == "avocorvtf") - { - var comm = CommFactory.CreateCommForDevice(dc); - if (comm != null) - return new AvocorDisplay(dc.Key, dc.Name, comm, null); - } - - } - catch (Exception e) - { - Debug.Console(0, "Displays factory: Exception creating device type {0}, key {1}: \nCONFIG JSON: {2} \nERROR: {3}\n\n", - dc.Type, dc.Key, JsonConvert.SerializeObject(dc), e); - return null; - } + var samsungMdcFactory = new SamsungMDCFactory() as IDeviceFactory; + samsungMdcFactory.LoadTypeFactories(); + + var avocorFactory = new AvocorDisplayFactory() as IDeviceFactory; + avocorFactory.LoadTypeFactories(); + } - return null; - } } } \ No newline at end of file diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/NECPSXMDisplay.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/NECPSXMDisplay.cs index b147dcc1..72311c7e 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/NECPSXMDisplay.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/NECPSXMDisplay.cs @@ -7,6 +7,7 @@ using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.DeviceSupport; using PepperDash.Core; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Routing; using Feedback = PepperDash.Essentials.Core.Feedback; @@ -361,4 +362,23 @@ namespace PepperDash.Essentials.Devices.Displays #endregion } + + public class NecPSXMDisplayFactory : EssentialsDeviceFactory + { + public NecPSXMDisplayFactory() + { + TypeNames = new List() { "necmpsx" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new Generic Comm Device"); + var comm = CommFactory.CreateCommForDevice(dc); + if (comm != null) + return new NecPSXMDisplay(dc.Key, dc.Name, comm); + else + return null; + } + } + } \ No newline at end of file diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/PanasonicThDisplay.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/PanasonicThDisplay.cs index 24ea0841..3ac01d66 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/PanasonicThDisplay.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/PanasonicThDisplay.cs @@ -7,6 +7,7 @@ using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.DeviceSupport; using PepperDash.Core; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Routing; using Feedback = PepperDash.Essentials.Core.Feedback; @@ -16,7 +17,7 @@ namespace PepperDash.Essentials.Devices.Displays /// /// /// - public class PanasonicThefDisplay : TwoWayDisplayBase, IBasicVolumeWithFeedback, ICommunicationMonitor + public class PanasonicThDisplay : TwoWayDisplayBase, IBasicVolumeWithFeedback, ICommunicationMonitor { public IBasicCommunication Communication { get; private set; } public CommunicationGather PortGather { get; private set; } @@ -73,7 +74,7 @@ namespace PepperDash.Essentials.Devices.Displays /// /// Constructor for IBasicCommunication /// - public PanasonicThefDisplay(string key, string name, IBasicCommunication comm) + public PanasonicThDisplay(string key, string name, IBasicCommunication comm) : base(key, name) { Communication = comm; @@ -82,7 +83,7 @@ namespace PepperDash.Essentials.Devices.Displays /// /// Constructor for TCP /// - public PanasonicThefDisplay(string key, string name, string hostname, int port) + public PanasonicThDisplay(string key, string name, string hostname, int port) : base(key, name) { Communication = new GenericTcpIpClient(key + "-tcp", hostname, port, 5000); @@ -93,7 +94,7 @@ namespace PepperDash.Essentials.Devices.Displays /// /// Constructor for COM /// - public PanasonicThefDisplay(string key, string name, ComPort port, ComPort.ComPortSpec spec) + public PanasonicThDisplay(string key, string name, ComPort port, ComPort.ComPortSpec spec) : base(key, name) { Communication = new ComPortController(key + "-com", port, spec); @@ -132,7 +133,7 @@ namespace PepperDash.Essentials.Devices.Displays //}; } - ~PanasonicThefDisplay() + ~PanasonicThDisplay() { PortGather = null; } @@ -343,4 +344,23 @@ namespace PepperDash.Essentials.Devices.Displays #endregion } + + public class PanasonicThDisplayFactory : EssentialsDeviceFactory + { + public PanasonicThDisplayFactory() + { + TypeNames = new List() { "panasonicthef" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new Generic Comm Device"); + var comm = CommFactory.CreateCommForDevice(dc); + if (comm != null) + return new PanasonicThDisplay(dc.Key, dc.Name, comm); + else + return null; + } + } + } \ No newline at end of file diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/SamsungMDCDisplay.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/SamsungMDCDisplay.cs index 111e119e..d56360f5 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/SamsungMDCDisplay.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/SamsungMDCDisplay.cs @@ -9,9 +9,12 @@ using Crestron.SimplSharpPro.DeviceSupport; using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Bridges; +using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.Routing; using Feedback = PepperDash.Essentials.Core.Feedback; +using Newtonsoft.Json.Linq; + namespace PepperDash.Essentials.Devices.Displays { /// @@ -637,4 +640,23 @@ namespace PepperDash.Essentials.Devices.Displays #endregion } + + public class SamsungMDCFactory : EssentialsDeviceFactory + { + public SamsungMDCFactory() + { + TypeNames = new List() { "samsungmdc" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new Generic Comm Device"); + var comm = CommFactory.CreateCommForDevice(dc); + if (comm != null) + return new SamsungMDC(dc.Key, dc.Name, comm, dc.Properties["id"].Value()); + else + return null; + } + } + } \ No newline at end of file diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Environment/Crestron Lighting/Din8sw8.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Environment/Crestron Lighting/Din8sw8.cs index e371d2d1..b262ef84 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Environment/Crestron Lighting/Din8sw8.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Environment/Crestron Lighting/Din8sw8.cs @@ -9,11 +9,12 @@ using Crestron.SimplSharpPro.Lighting; using PepperDash.Core; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.CrestronIO; namespace PepperDash.Essentials.Devices.Common.Environment.Lighting { - public class Din8sw8Controller : Device, ISwitchedOutputCollection + public class Din8sw8Controller : EssentialsDevice, ISwitchedOutputCollection { // Need to figure out some sort of interface to make these switched outputs behave like processor relays so they can be used interchangably @@ -85,4 +86,21 @@ namespace PepperDash.Essentials.Devices.Common.Environment.Lighting } } + public class Din8sw8ControllerFactory : EssentialsDeviceFactory + { + public Din8sw8ControllerFactory() + { + TypeNames = new List() { "din8sw8" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new Din8sw8Controller Device"); + var comm = CommFactory.GetControlPropertiesConfig(dc); + + return new Din8sw8Controller(dc.Key, comm.CresnetIdInt); + + } + } + } \ No newline at end of file diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Environment/Lutron/LutronQuantum.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Environment/Lutron/LutronQuantum.cs index 9facbf56..84cf46c2 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Environment/Lutron/LutronQuantum.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Environment/Lutron/LutronQuantum.cs @@ -6,6 +6,7 @@ using Crestron.SimplSharp; using Crestron.SimplSharpPro.DeviceSupport; using PepperDash.Core; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Lighting; using LightingBase = PepperDash.Essentials.Core.Lighting.LightingBase; @@ -264,4 +265,23 @@ namespace PepperDash.Essentials.Devices.Common.Environment.Lutron // public string Username { get; set; } // public string Password { get; set; } } + + public class LutronQuantumAreaFactory : EssentialsDeviceFactory + { + public LutronQuantumAreaFactory() + { + TypeNames = new List() { "lutronqs" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new LutronQuantumArea Device"); + var comm = CommFactory.CreateCommForDevice(dc); + + var props = Newtonsoft.Json.JsonConvert.DeserializeObject(dc.Properties.ToString()); + + return new LutronQuantumArea(dc.Key, dc.Name, comm, props); + } + } + } \ No newline at end of file diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Environment/Somfy/RelayControlledShade.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Environment/Somfy/RelayControlledShade.cs index 22e06d03..a78e5045 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Environment/Somfy/RelayControlledShade.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Environment/Somfy/RelayControlledShade.cs @@ -6,6 +6,7 @@ using Crestron.SimplSharp; using PepperDash.Core; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.CrestronIO; using PepperDash.Essentials.Core.Shades; @@ -110,4 +111,21 @@ namespace PepperDash.Essentials.Devices.Common.Environment.Somfy public IOPortConfig Close { get; set; } } } + + public class RelayControlledShadeFactory : EssentialsDeviceFactory + { + public RelayControlledShadeFactory() + { + TypeNames = new List() { "relaycontrolledshade" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new Generic Comm Device"); + var props = Newtonsoft.Json.JsonConvert.DeserializeObject(dc.Properties.ToString()); + + return new Environment.Somfy.RelayControlledShade(dc.Key, dc.Name, props); + } + } + } \ No newline at end of file diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Factory/DeviceFactory.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Factory/DeviceFactory.cs index fc07a6dc..8904b8c3 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Factory/DeviceFactory.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Factory/DeviceFactory.cs @@ -60,280 +60,56 @@ namespace PepperDash.Essentials.Devices.Common var laptopFactory = new Core.Devices.LaptopFactory() as IDeviceFactory; laptopFactory.LoadTypeFactories(); + var blueJeansPcFactory = new SoftCodec.BlueJeansPcFactory() as IDeviceFactory; + blueJeansPcFactory.LoadTypeFactories(); + var mockAcFactory = new AudioCodec.MockACFactory() as IDeviceFactory; + mockAcFactory.LoadTypeFactories(); + + var mockVcFactory = new VideoCodec.MockVCFactory() as IDeviceFactory; + mockVcFactory.LoadTypeFactories(); + + var ciscoCodecFactory = new VideoCodec.Cisco.CiscoSparkCodecFactory() as IDeviceFactory; + ciscoCodecFactory.LoadTypeFactories(); + + var zoomRoomFactory = new VideoCodec.ZoomRoom.ZoomRoomFactory() as IDeviceFactory; + zoomRoomFactory.LoadTypeFactories(); + + var digitalInputFactory = new GenericDigitalInputDeviceFactory() as IDeviceFactory; + digitalInputFactory.LoadTypeFactories(); + + var relayFactory = new GenericRelayDeviceFactory() as IDeviceFactory; + relayFactory.LoadTypeFactories(); + + var micPrivacyFactory = new Core.Privacy.MicrophonePrivacyControllerFactory() as IDeviceFactory; + micPrivacyFactory.LoadTypeFactories(); + + var rokuFactory = new Roku2Factory() as IDeviceFactory; + rokuFactory.LoadTypeFactories(); + + var setTopBoxFactory = new IRSetTopBoxBaseFactory() as IDeviceFactory; + setTopBoxFactory.LoadTypeFactories(); + + var tvOneCorioFactory = new TVOneCorioFactory() as IDeviceFactory; + tvOneCorioFactory.LoadTypeFactories(); + + var glsOccSensorBaseFactory = new GlsOccupancySensorBaseControllerFactory() as IDeviceFactory; + glsOccSensorBaseFactory.LoadTypeFactories(); + + var glsOdtOccSensorFactory = new GlsOdtOccupancySensorControllerFactory() as IDeviceFactory; + glsOdtOccSensorFactory.LoadTypeFactories(); + + var lutronQuantumFactory = new Environment.Lutron.LutronQuantumAreaFactory() as IDeviceFactory; + lutronQuantumFactory.LoadTypeFactories(); + + var din8sw8ControllerFactory = new Environment.Lighting.Din8sw8ControllerFactory() as IDeviceFactory; + din8sw8ControllerFactory.LoadTypeFactories(); + + var shadeControllerFactory = new Core.Shades.ShadeControllerFactory() as IDeviceFactory; + shadeControllerFactory.LoadTypeFactories(); + + var relayControlledShadeFactory = new Environment.Somfy.RelayControlledShadeFactory() as IDeviceFactory; + relayControlledShadeFactory.LoadTypeFactories(); } - - public static IKeyed GetDevice(DeviceConfig dc) - { - var key = dc.Key; - var name = dc.Name; - var type = dc.Type; - var properties = dc.Properties; - var propAnon = new {}; - JsonConvert.DeserializeAnonymousType(dc.Properties.ToString(), propAnon); - - var typeName = dc.Type.ToLower(); - var groupName = dc.Group.ToLower(); - - // TODO: Continue from here - if (typeName == "bluejeanspc") - { - return new SoftCodec.BlueJeansPc(key, name); - } - - else if (typeName == "mockvc") - { - return new VideoCodec.MockVC(dc); - } - - else if (typeName == "mockac") - { - var props = JsonConvert.DeserializeObject(properties.ToString()); - return new AudioCodec.MockAC(key, name, props); - } - - else if (typeName.StartsWith("ciscospark")) - { - var comm = CommFactory.CreateCommForDevice(dc); - return new VideoCodec.Cisco.CiscoSparkCodec(dc, comm); - } - - else if (typeName == "zoomroom") - { - var comm = CommFactory.CreateCommForDevice(dc); - return new VideoCodec.ZoomRoom.ZoomRoom(dc, comm); - } - - else if (typeName == "digitalinput") - { - var props = JsonConvert.DeserializeObject(properties.ToString()); - - IDigitalInputPorts portDevice; - - if (props.PortDeviceKey == "processor") - portDevice = Global.ControlSystem as IDigitalInputPorts; - else - portDevice = DeviceManager.GetDeviceForKey(props.PortDeviceKey) as IDigitalInputPorts; - - if (portDevice == null) - Debug.Console(0, "ERROR: Unable to add digital input device with key '{0}'. Port Device does not support digital inputs", key); - else - { - var cs = (portDevice as CrestronControlSystem); - if (cs == null) - { - Debug.Console(0, "ERROR: Port device for [{0}] is not control system", props.PortDeviceKey); - return null; - } - - if (cs.SupportsVersiport) - { - Debug.Console(1, "Attempting to add Digital Input device to Versiport port '{0}'", props.PortNumber); - - if (props.PortNumber > cs.NumberOfVersiPorts) - { - Debug.Console(0, "WARNING: Cannot add Vesiport {0} on {1}. Out of range", - props.PortNumber, props.PortDeviceKey); - return null; - } - - Versiport vp = cs.VersiPorts[props.PortNumber]; - - if (!vp.Registered) - { - var regSuccess = vp.Register(); - if (regSuccess == eDeviceRegistrationUnRegistrationResponse.Success) - { - Debug.Console(1, "Successfully Created Digital Input Device on Versiport"); - return new GenericVersiportDigitalInputDevice(key, vp, props); - } - else - { - Debug.Console(0, "WARNING: Attempt to register versiport {0} on device with key '{1}' failed: {2}", - props.PortNumber, props.PortDeviceKey, regSuccess); - return null; - } - } - } - else if (cs.SupportsDigitalInput) - { - Debug.Console(1, "Attempting to add Digital Input device to Digital Input port '{0}'", props.PortNumber); - - if (props.PortNumber > cs.NumberOfDigitalInputPorts) - { - Debug.Console(0, "WARNING: Cannot register DIO port {0} on {1}. Out of range", - props.PortNumber, props.PortDeviceKey); - return null; - } - - DigitalInput digitalInput = cs.DigitalInputPorts[props.PortNumber]; - - if (!digitalInput.Registered) - { - if (digitalInput.Register() == eDeviceRegistrationUnRegistrationResponse.Success) - { - Debug.Console(1, "Successfully Created Digital Input Device on Digital Input"); - return new GenericDigitalInputDevice(key, digitalInput); - } - else - Debug.Console(0, "WARNING: Attempt to register digital input {0} on device with key '{1}' failed.", - props.PortNumber, props.PortDeviceKey); - } - } - } - } - - else if (typeName == "relayoutput") - { - var props = JsonConvert.DeserializeObject(properties.ToString()); - - IRelayPorts portDevice; - - if (props.PortDeviceKey == "processor") - portDevice = Global.ControlSystem as IRelayPorts; - else - portDevice = DeviceManager.GetDeviceForKey(props.PortDeviceKey) as IRelayPorts; - - if (portDevice == null) - Debug.Console(0, "Unable to add relay device with key '{0}'. Port Device does not support relays", key); - else - { - var cs = (portDevice as CrestronControlSystem); - - if (cs != null) - { - // The relay is on a control system processor - if (!cs.SupportsRelay || props.PortNumber > cs.NumberOfRelayPorts) - { - Debug.Console(0, "Port Device: {0} does not support relays or does not have enough relays"); - return null; - } - } - else - { - // The relay is on another device type - - if (props.PortNumber > portDevice.NumberOfRelayPorts) - { - Debug.Console(0, "Port Device: {0} does not have enough relays"); - return null; - } - } - - Relay relay = portDevice.RelayPorts[props.PortNumber]; - - if (!relay.Registered) - { - if (relay.Register() == eDeviceRegistrationUnRegistrationResponse.Success) - return new GenericRelayDevice(key, relay); - else - Debug.Console(0, "Attempt to register relay {0} on device with key '{1}' failed.", props.PortNumber, props.PortDeviceKey); - } - else - { - return new GenericRelayDevice(key, relay); - } - - // Future: Check if portDevice is 3-series card or other non control system that supports versiports - } - } - - else if (typeName == "microphoneprivacycontroller") - { - var props = JsonConvert.DeserializeObject(properties.ToString()); - - return new Core.Privacy.MicrophonePrivacyController(key, props); - } - else if (typeName == "roku") - { - var irCont = IRPortHelper.GetIrOutputPortController(dc); - return new Roku2(key, name, irCont); - } - - else if (groupName == "settopbox") //(typeName == "irstbbase") - { - var irCont = IRPortHelper.GetIrOutputPortController(dc); - var config = dc.Properties.ToObject(); - var stb = new IRSetTopBoxBase(key, name, irCont, config); - - //stb.HasDvr = properties.Value("hasDvr"); - var listName = properties.Value("presetsList"); - if (listName != null) - stb.LoadPresets(listName); - return stb; - } - else if (typeName == "tvonecorio") - { - var comm = CommFactory.CreateCommForDevice(dc); - var props = JsonConvert.DeserializeObject( - properties.ToString()); - return new TVOneCorio(key, name, comm, props); - } - - - else if (typeName == "glsoirccn") - { - var comm = CommFactory.GetControlPropertiesConfig(dc); - - GlsOccupancySensorBase occSensor = null; - - occSensor = new GlsOirCCn(comm.CresnetIdInt, Global.ControlSystem); - - if (occSensor != null) - return new GlsOccupancySensorBaseController(key, name, occSensor); - else - Debug.Console(0, "ERROR: Unable to create Occupancy Sensor Device. Key: '{0}'", key); - } - - else if (typeName == "glsodtccn") - { - var comm = CommFactory.GetControlPropertiesConfig(dc); - - var occSensor = new GlsOdtCCn(comm.CresnetIdInt, Global.ControlSystem); - - if (occSensor != null) - return new GlsOdtOccupancySensorController(key, name, occSensor); - else - Debug.Console(0, "ERROR: Unable to create Occupancy Sensor Device. Key: '{0}'", key); - } - - else if (groupName == "lighting") - { - if (typeName == "lutronqs") - { - var comm = CommFactory.CreateCommForDevice(dc); - - var props = JsonConvert.DeserializeObject(properties.ToString()); - - return new Environment.Lutron.LutronQuantumArea(key, name, comm, props); - } - else if (typeName == "din8sw8") - { - var comm = CommFactory.GetControlPropertiesConfig(dc); - - return new Environment.Lighting.Din8sw8Controller(key, comm.CresnetIdInt); - } - - } - - else if (groupName == "environment") - { - if (typeName == "shadecontroller") - { - var props = JsonConvert.DeserializeObject(properties.ToString()); - - return new Core.Shades.ShadeController(key, name, props); - } - else if (typeName == "relaycontrolledshade") - { - var props = JsonConvert.DeserializeObject(properties.ToString()); - - return new Environment.Somfy.RelayControlledShade(key, name, props); - } - - } - - return null; - } } } \ No newline at end of file diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/ImageProcessors/TVOneCorio.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/ImageProcessors/TVOneCorio.cs index a3dd9745..b5a1004f 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/ImageProcessors/TVOneCorio.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/ImageProcessors/TVOneCorio.cs @@ -5,13 +5,14 @@ using System.Text; using Crestron.SimplSharp; using PepperDash.Core; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Config; using System.Text.RegularExpressions; namespace PepperDash.Essentials.Devices.Common { - public class TVOneCorio : Device + public class TVOneCorio : EssentialsDevice { public IBasicCommunication Communication { get; private set; } public CommunicationGather PortGather { get; private set; } @@ -238,4 +239,22 @@ namespace PepperDash.Essentials.Devices.Common // public QscDspControlPoint ControlPoint { get; set; } } } + + public class TVOneCorioFactory : EssentialsDeviceFactory + { + public TVOneCorioFactory() + { + TypeNames = new List() { "tvonecorio" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new TVOneCorio Device"); + var comm = CommFactory.CreateCommForDevice(dc); + var props = Newtonsoft.Json.JsonConvert.DeserializeObject( + dc.Properties.ToString()); + return new TVOneCorio(dc.Key, dc.Name, comm, props); + } + } + } \ No newline at end of file diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOccupancySensorBaseController.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOccupancySensorBaseController.cs index 5bf35247..18bdb1be 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOccupancySensorBaseController.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOccupancySensorBaseController.cs @@ -8,6 +8,7 @@ using Crestron.SimplSharpPro.GeneralIO; using Newtonsoft.Json; using PepperDash.Core; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.Bridges; namespace PepperDash.Essentials.Devices.Common.Occupancy @@ -365,4 +366,38 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy LinkOccSensorToApi(this, trilist, joinStart, joinMapKey, bridge); } } + + public class GlsOccupancySensorBaseControllerFactory : EssentialsDeviceFactory + { + public GlsOccupancySensorBaseControllerFactory() + { + TypeNames = new List() { "glsoirccn" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new GlsOccupancySensorBaseController Device"); + + var typeName = dc.Type.ToLower(); + var key = dc.Key; + var name = dc.Name; + var comm = CommFactory.GetControlPropertiesConfig(dc); + + GlsOccupancySensorBase occSensor = null; + + occSensor = new GlsOirCCn(comm.CresnetIdInt, Global.ControlSystem); + + if (occSensor != null) + { + return new GlsOccupancySensorBaseController(key, name, occSensor); + } + else + { + Debug.Console(0, "ERROR: Unable to create Occupancy Sensor Device. Key: '{0}'", key); + return null; + } + + } + } + } \ No newline at end of file diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOdtOccupancySensorController.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOdtOccupancySensorController.cs index 0134a3d4..f7d9943a 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOdtOccupancySensorController.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOdtOccupancySensorController.cs @@ -8,6 +8,7 @@ using Crestron.SimplSharpPro.GeneralIO; using PepperDash.Core; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.Bridges; namespace PepperDash.Essentials.Devices.Common.Occupancy @@ -159,4 +160,37 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy LinkOccSensorToApi(this, trilist, joinStart, joinMapKey, bridge); } } + + public class GlsOdtOccupancySensorControllerFactory : EssentialsDeviceFactory + { + public GlsOdtOccupancySensorControllerFactory() + { + TypeNames = new List() { "glsodtccn" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new GlsOccupancySensorBaseController Device"); + + var typeName = dc.Type.ToLower(); + var key = dc.Key; + var name = dc.Name; + var comm = CommFactory.GetControlPropertiesConfig(dc); + + var occSensor = new GlsOdtCCn(comm.CresnetIdInt, Global.ControlSystem); + + if (occSensor != null) + { + return new GlsOdtOccupancySensorController(key, name, occSensor); + } + else + { + Debug.Console(0, "ERROR: Unable to create Occupancy Sensor Device. Key: '{0}'", key); + return null; + } + + + } + } + } \ No newline at end of file diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/SetTopBox/IRSetTopBoxBase.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/SetTopBox/IRSetTopBoxBase.cs index e5678620..25d17eb4 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/SetTopBox/IRSetTopBoxBase.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/SetTopBox/IRSetTopBoxBase.cs @@ -9,6 +9,7 @@ using Newtonsoft.Json; using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Bridges; +using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.Presets; using PepperDash.Essentials.Core.Routing; @@ -461,4 +462,27 @@ namespace PepperDash.Essentials.Devices.Common trilist.SetBoolSigAction(joinMap.Record, stbTransport.Record); } } + + public class IRSetTopBoxBaseFactory : EssentialsDeviceFactory + { + public IRSetTopBoxBaseFactory() + { + TypeNames = new List() { "settopbox" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new SetTopBox Device"); + var irCont = IRPortHelper.GetIrOutputPortController(dc); + var config = dc.Properties.ToObject(); + var stb = new IRSetTopBoxBase(dc.Key, dc.Name, irCont, config); + + var listName = dc.Properties.Value("presetsList"); + if (listName != null) + stb.LoadPresets(listName); + return stb; + + } + } + } \ No newline at end of file diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/SoftCodec/BlueJeansPc.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/SoftCodec/BlueJeansPc.cs index 462ae5cb..78043111 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/SoftCodec/BlueJeansPc.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/SoftCodec/BlueJeansPc.cs @@ -161,4 +161,19 @@ namespace PepperDash.Essentials.Devices.Common.SoftCodec #endregion } + + public class BlueJeansPcFactory : EssentialsDeviceFactory + { + public BlueJeansPcFactory() + { + TypeNames = new List() { "mockvc" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new BlueJeansPc Device"); + return new SoftCodec.BlueJeansPc(dc.Key, dc.Name); + } + } + } \ No newline at end of file diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Streaming/Roku.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Streaming/Roku.cs index 1c162040..49f96c31 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Streaming/Roku.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Streaming/Roku.cs @@ -8,11 +8,12 @@ using Crestron.SimplSharpPro.DeviceSupport; using PepperDash.Core; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.Routing; namespace PepperDash.Essentials.Devices.Common { - public class Roku2 : Device, IDPad, ITransport, IUiDisplayInfo, IRoutingOutputs + public class Roku2 : EssentialsDevice, IDPad, ITransport, IUiDisplayInfo, IRoutingOutputs { [Api] public IrOutputPortController IrPort { get; private set; } @@ -145,4 +146,21 @@ namespace PepperDash.Essentials.Devices.Common #endregion } + + public class Roku2Factory : EssentialsDeviceFactory + { + public Roku2Factory() + { + TypeNames = new List() { "roku" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new Roku Device"); + var irCont = IRPortHelper.GetIrOutputPortController(dc); + return new Roku2(dc.Key, dc.Name, irCont); + + } + } + } \ No newline at end of file diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoSparkCodec.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoSparkCodec.cs index f8f7b298..cad7a18c 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoSparkCodec.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoSparkCodec.cs @@ -1843,4 +1843,19 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco } } + public class CiscoSparkCodecFactory : EssentialsDeviceFactory + { + public CiscoSparkCodecFactory() + { + TypeNames = new List() { "ciscospark", "ciscowebex", "ciscowebexpro", "ciscoroomkit" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new Cisco Codec Device"); + var comm = CommFactory.CreateCommForDevice(dc); + return new VideoCodec.Cisco.CiscoSparkCodec(dc, comm); + } + } + } \ No newline at end of file diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/MockVC/MockVC.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/MockVC/MockVC.cs index d6580b67..dc32ecd8 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/MockVC/MockVC.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/MockVC/MockVC.cs @@ -770,4 +770,19 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec _AutoAnswerEnabled = value; } } + + public class MockVCFactory : EssentialsDeviceFactory + { + public MockVCFactory() + { + TypeNames = new List() { "mockvc" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new MockVC Device"); + return new VideoCodec.MockVC(dc); + } + } + } \ No newline at end of file diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ZoomRoom.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ZoomRoom.cs index 84881df3..13fa895d 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ZoomRoom.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ZoomRoom.cs @@ -1676,4 +1676,20 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom InitialSyncComplete = false; } } + + public class ZoomRoomFactory : EssentialsDeviceFactory + { + public ZoomRoomFactory() + { + TypeNames = new List() { "zoomroom" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new ZoomRoom Device"); + var comm = CommFactory.CreateCommForDevice(dc); + return new VideoCodec.ZoomRoom.ZoomRoom(dc, comm); + } + } + } \ No newline at end of file From 911bd8daba787e98da28143a41823fab5cf86c66 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Wed, 22 Apr 2020 17:20:29 -0600 Subject: [PATCH 063/156] Moves to reflection based mechanism for loading device factories at boot (not working) --- PepperDashEssentials/ControlSystem.cs | 49 +++++++++++++------ .../Plugins/PluginLoader.cs | 17 ++++++- .../SoftCodec/BlueJeansPc.cs | 2 +- 3 files changed, 51 insertions(+), 17 deletions(-) diff --git a/PepperDashEssentials/ControlSystem.cs b/PepperDashEssentials/ControlSystem.cs index b7ce9288..e4d4cbc0 100644 --- a/PepperDashEssentials/ControlSystem.cs +++ b/PepperDashEssentials/ControlSystem.cs @@ -81,31 +81,52 @@ namespace PepperDash.Essentials "Template URL: {1}", ConfigReader.ConfigObject.SystemUrl, ConfigReader.ConfigObject.TemplateUrl); }, "portalinfo", "Shows portal URLS from configuration", ConsoleAccessLevelEnum.AccessOperator); - LoadDeviceTypesFromFactories(); if (!Debug.DoNotLoadOnNextBoot) GoWithLoad(); } /// - /// Instantiates each of the device factories to load thier device types + /// Instantiates each of the device factories to load their device types /// void LoadDeviceTypesFromFactories() { - // Instantiate the Device Factories - new CoreDeviceFactory(); - new DmDeviceFactory(); - new UiDeviceFactory(); + PluginLoader.AddProgramAssemblies(); - new DeviceFactory(); - new BridgeFactory(); - new PepperDash.Essentials.Devices.Common.DeviceFactory(); - new PepperDash.Essentials.Devices.Displays.DisplayDeviceFactory(); + foreach (var assembly in PluginLoader.LoadedAssemblies) + { + if (!assembly.Name.Contains("Essentials")) + { + continue; + } + else + { + var assy = assembly.Assembly; + var types = assy.GetTypes(); + + if (types != null) + { + foreach (var type in types) + { + try + { + if (typeof(IDeviceFactory).IsAssignableFrom(type)) + { + var factory = (IDeviceFactory)Crestron.SimplSharp.Reflection.Activator.CreateInstance(type); + factory.LoadTypeFactories(); + } + } + catch (Exception e) + { + Debug.Console(0, Debug.ErrorLogLevel.Error, "Unable to load DeviceFactory: {0}", e); + } + } + } + } + } } - - /// /// Determines if the program is running on a processor (appliance) or server (VC-4). /// @@ -184,9 +205,9 @@ namespace PepperDash.Essentials { Debug.SetDoNotLoadOnNextBoot(false); - Debug.Console(0, Debug.ErrorLogLevel.Notice, "Starting Essentials load from configuration"); + LoadDeviceTypesFromFactories(); - PluginLoader.AddProgramAssemblies(); + Debug.Console(0, Debug.ErrorLogLevel.Notice, "Starting Essentials load from configuration"); var filesReady = SetupFilesystem(); if (filesReady) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Plugins/PluginLoader.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Plugins/PluginLoader.cs index 3e08d698..d32e9efa 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Plugins/PluginLoader.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Plugins/PluginLoader.cs @@ -71,9 +71,22 @@ namespace PepperDash.Essentials assembly = Assembly.GetExecutingAssembly(); break; } - case ("PepperDashEssentialsBase.dll"): + case ("PepperDash_Essential_Core.dll"): { - + version = Global.AssemblyVersion; + assembly = System.Reflection + break; + } + case ("PepperDash_Essentials_DM.dll"): + { + version = Global.AssemblyVersion; + assembly = Assembly.GetExecutingAssembly(); + break; + } + case ("Essentials Devices Common.dll"): + { + version = Global.AssemblyVersion; + assembly = Assembly.GetExecutingAssembly(); break; } case ("PepperDash_Core.dll"): diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/SoftCodec/BlueJeansPc.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/SoftCodec/BlueJeansPc.cs index 78043111..735df48c 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/SoftCodec/BlueJeansPc.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/SoftCodec/BlueJeansPc.cs @@ -166,7 +166,7 @@ namespace PepperDash.Essentials.Devices.Common.SoftCodec { public BlueJeansPcFactory() { - TypeNames = new List() { "mockvc" }; + TypeNames = new List() { "bluejeanspc" }; } public override EssentialsDevice BuildDevice(DeviceConfig dc) From 96adbdb76a8fff0df93fb9a4498de22b6b692977 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Thu, 23 Apr 2020 09:55:33 -0600 Subject: [PATCH 064/156] Adds Template UI submodule --- .gitmodules | 3 +++ Essentials-Template-UI | 1 + 2 files changed, 4 insertions(+) create mode 160000 Essentials-Template-UI diff --git a/.gitmodules b/.gitmodules index 2ce66ffc..0abbfb4e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "essentials-framework/pepperdashcore-builds"] path = essentials-framework/pepperdashcore-builds url = https://github.com/ndorin/PepperDashCore-Builds.git +[submodule "Essentials-Template-UI"] + path = Essentials-Template-UI + url = https://github.com/PepperDash/Essentials-Template-UI.git diff --git a/Essentials-Template-UI b/Essentials-Template-UI new file mode 160000 index 00000000..8eaf8879 --- /dev/null +++ b/Essentials-Template-UI @@ -0,0 +1 @@ +Subproject commit 8eaf88791b42318fbe7c64402af46d747516e4fa From a93ded8c7940374491be549507bb3c5d172acc42 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Thu, 23 Apr 2020 14:59:54 -0600 Subject: [PATCH 065/156] New device loading methodology working via reflection --- PepperDashEssentials/ControlSystem.cs | 50 ++------ PepperDashEssentials/Factory/DeviceFactory.cs | 39 +++--- .../Factory/UiDeviceFactory.cs | 36 ------ .../PepperDashEssentials.csproj | 1 - .../Inputs/GenericDigitalInputDevice.cs | 2 +- .../Crestron IO/Relay/GenericRelayDevice.cs | 1 - .../Factory/DeviceFactory.cs | 48 ++++---- .../Plugins/PluginLoader.cs | 22 +++- .../Essentials_DM/Config/DeviceFactory.cs | 43 ++++--- .../Display/DeviceFactory.cs | 33 ----- .../Essentials Devices Common.csproj | 1 - .../Factory/DeviceFactory.cs | 113 ++++-------------- 12 files changed, 121 insertions(+), 268 deletions(-) delete mode 100644 PepperDashEssentials/Factory/UiDeviceFactory.cs delete mode 100644 essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/DeviceFactory.cs diff --git a/PepperDashEssentials/ControlSystem.cs b/PepperDashEssentials/ControlSystem.cs index e4d4cbc0..f0cdc9d5 100644 --- a/PepperDashEssentials/ControlSystem.cs +++ b/PepperDashEssentials/ControlSystem.cs @@ -86,47 +86,6 @@ namespace PepperDash.Essentials GoWithLoad(); } - /// - /// Instantiates each of the device factories to load their device types - /// - void LoadDeviceTypesFromFactories() - { - PluginLoader.AddProgramAssemblies(); - - - foreach (var assembly in PluginLoader.LoadedAssemblies) - { - if (!assembly.Name.Contains("Essentials")) - { - continue; - } - else - { - var assy = assembly.Assembly; - var types = assy.GetTypes(); - - if (types != null) - { - foreach (var type in types) - { - try - { - if (typeof(IDeviceFactory).IsAssignableFrom(type)) - { - var factory = (IDeviceFactory)Crestron.SimplSharp.Reflection.Activator.CreateInstance(type); - factory.LoadTypeFactories(); - } - } - catch (Exception e) - { - Debug.Console(0, Debug.ErrorLogLevel.Error, "Unable to load DeviceFactory: {0}", e); - } - } - } - } - } - } - /// /// Determines if the program is running on a processor (appliance) or server (VC-4). /// @@ -202,10 +161,15 @@ namespace PepperDash.Essentials public void GoWithLoad() { try - { + { Debug.SetDoNotLoadOnNextBoot(false); - LoadDeviceTypesFromFactories(); + PluginLoader.AddProgramAssemblies(); + + new Core.DeviceFactory(); + new Devices.Common.DeviceFactory(); + new DM.DeviceFactory(); + new DeviceFactory(); Debug.Console(0, Debug.ErrorLogLevel.Notice, "Starting Essentials load from configuration"); diff --git a/PepperDashEssentials/Factory/DeviceFactory.cs b/PepperDashEssentials/Factory/DeviceFactory.cs index 944a9b2f..5b15f28c 100644 --- a/PepperDashEssentials/Factory/DeviceFactory.cs +++ b/PepperDashEssentials/Factory/DeviceFactory.cs @@ -4,6 +4,7 @@ using System.Linq; using Crestron.SimplSharp; using Crestron.SimplSharp.CrestronIO; using Crestron.SimplSharpPro; +using Crestron.SimplSharp.Reflection; using Newtonsoft.Json; using Newtonsoft.Json.Linq; @@ -18,26 +19,30 @@ namespace PepperDash.Essentials /// Responsible for loading all of the device types for this library /// public class DeviceFactory - { + { + public DeviceFactory() { - var ampFactory = new AmplifierFactory() as IDeviceFactory; - ampFactory.LoadTypeFactories(); + var assy = Assembly.GetExecutingAssembly(); + PluginLoader.SetEssentialsAssembly(assy.GetName().Name, assy); - var mockDisplayFactory = new MockDisplayFactory() as IDeviceFactory; - mockDisplayFactory.LoadTypeFactories(); + var types = assy.GetTypes().Where(ct => typeof(IDeviceFactory).IsAssignableFrom(ct) && !ct.IsInterface && !ct.IsAbstract); - var consoleCommMockFactroy = new ConsoleCommMockDeviceFactory() as IDeviceFactory; - consoleCommMockFactroy.LoadTypeFactories(); - - var mcSystemControllerFactory = new MobileControlSystemControllerFactory() as IDeviceFactory; - mcSystemControllerFactory.LoadTypeFactories(); - - var mcSIMPLRoomBridgeFactory = new MobileControlSIMPLRoomBridgeFactory() as IDeviceFactory; - mcSIMPLRoomBridgeFactory.LoadTypeFactories(); - - var roomOnToDefSourceWhenOcc = new RoomOnToDefaultSourceWhenOccupiedFactory() as IDeviceFactory; - roomOnToDefSourceWhenOcc.LoadTypeFactories(); + if (types != null) + { + foreach (var type in types) + { + try + { + var factory = (IDeviceFactory)Crestron.SimplSharp.Reflection.Activator.CreateInstance(type); + factory.LoadTypeFactories(); + } + catch (Exception e) + { + Debug.Console(0, Debug.ErrorLogLevel.Error, "Unable to load type: '{1}' DeviceFactory: {0}", e, type.Name); + } + } + } } - } + } } diff --git a/PepperDashEssentials/Factory/UiDeviceFactory.cs b/PepperDashEssentials/Factory/UiDeviceFactory.cs deleted file mode 100644 index fad8026f..00000000 --- a/PepperDashEssentials/Factory/UiDeviceFactory.cs +++ /dev/null @@ -1,36 +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 Crestron.SimplSharpPro.UI; - -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; -using PepperDash.Core; -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Core.Config; -using PepperDash.Essentials.Core.PageManagers; -using PepperDash.Essentials.DM.Endpoints.DGEs; - - -namespace PepperDash.Essentials -{ - /// - /// Responsible for loading all of the UI device types for this library - /// - public class UiDeviceFactory - { - public UiDeviceFactory() - { - var dgeControllerFactory = new DgeControllerFactory() as IDeviceFactory; - dgeControllerFactory.LoadTypeFactories(); - - var essentialsTouchpanelControllerFactory = new EssentialsTouchpanelControllerFactory() as IDeviceFactory; - essentialsTouchpanelControllerFactory.LoadTypeFactories(); - } - - } -} \ No newline at end of file diff --git a/PepperDashEssentials/PepperDashEssentials.csproj b/PepperDashEssentials/PepperDashEssentials.csproj index 62cae03f..6c606273 100644 --- a/PepperDashEssentials/PepperDashEssentials.csproj +++ b/PepperDashEssentials/PepperDashEssentials.csproj @@ -151,7 +151,6 @@ - diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericDigitalInputDevice.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericDigitalInputDevice.cs index 33cb0ae6..3d3383e9 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericDigitalInputDevice.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericDigitalInputDevice.cs @@ -9,7 +9,7 @@ using Newtonsoft.Json; using PepperDash.Core; using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Config; -using PepperDash_Essentials_Core.Devices; + namespace PepperDash.Essentials.Core.CrestronIO { diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Relay/GenericRelayDevice.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Relay/GenericRelayDevice.cs index 3e3b0576..aac9de44 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Relay/GenericRelayDevice.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Relay/GenericRelayDevice.cs @@ -9,7 +9,6 @@ using Newtonsoft.Json; using PepperDash.Core; using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Config; -using PepperDash_Essentials_Core.Devices; namespace PepperDash.Essentials.Core.CrestronIO { diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/DeviceFactory.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/DeviceFactory.cs index 4e12ab05..1904867d 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/DeviceFactory.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/DeviceFactory.cs @@ -29,6 +29,30 @@ namespace PepperDash.Essentials.Core public class DeviceFactory { + public DeviceFactory() + { + var assy = Assembly.GetExecutingAssembly(); + PluginLoader.SetEssentialsAssembly(assy.GetName().Name, assy); + + var types = assy.GetTypes().Where(ct => typeof(IDeviceFactory).IsAssignableFrom(ct) && !ct.IsInterface && !ct.IsAbstract); + + if (types != null) + { + foreach (var type in types) + { + try + { + var factory = (IDeviceFactory)Crestron.SimplSharp.Reflection.Activator.CreateInstance(type); + factory.LoadTypeFactories(); + } + catch (Exception e) + { + Debug.Console(0, Debug.ErrorLogLevel.Error, "Unable to load type: '{1}' DeviceFactory: {0}", e, type.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. @@ -122,28 +146,4 @@ namespace PepperDash.Essentials.Core } } } - - /// - /// Responsible for loading all of the device types for this library - /// - public class CoreDeviceFactory - { - public CoreDeviceFactory() - { - Debug.Console(1, "Essentials.Core Factory Adding Types..."); - - //cast to IDeviceFactory isn't explicitly required here...but will be when instantiating using reflection, which I'm assuming is the next step - var genCommFactory = new GenericCommFactory() as IDeviceFactory; - genCommFactory.LoadTypeFactories(); - - var c2nRthsFactory = new C2nRthsControllerFactory() as IDeviceFactory; - c2nRthsFactory.LoadTypeFactories(); - - var statusSignFactory = new StatusSignControllerFactory() as IDeviceFactory; - statusSignFactory.LoadTypeFactories(); - - var cenIoControllerFactory = new CenIoDigIn104ControllerFactory() as IDeviceFactory; - cenIoControllerFactory.LoadTypeFactories(); - } - } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Plugins/PluginLoader.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Plugins/PluginLoader.cs index d32e9efa..5c66ab8f 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Plugins/PluginLoader.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Plugins/PluginLoader.cs @@ -68,25 +68,21 @@ namespace PepperDash.Essentials case ("PepperDashEssentials.dll"): { version = Global.AssemblyVersion; - assembly = Assembly.GetExecutingAssembly(); break; } - case ("PepperDash_Essential_Core.dll"): + case ("PepperDash_Essentials_Core.dll"): { version = Global.AssemblyVersion; - assembly = System.Reflection break; } case ("PepperDash_Essentials_DM.dll"): { version = Global.AssemblyVersion; - assembly = Assembly.GetExecutingAssembly(); break; } case ("Essentials Devices Common.dll"): { version = Global.AssemblyVersion; - assembly = Assembly.GetExecutingAssembly(); break; } case ("PepperDash_Core.dll"): @@ -110,6 +106,17 @@ namespace PepperDash.Essentials } } + + public static void SetEssentialsAssembly(string name, Assembly assembly) + { + var loadedAssembly = LoadedAssemblies.FirstOrDefault(la => la.Name.Equals(name)); + + if (loadedAssembly != null) + { + loadedAssembly.SetAssembly(assembly); + } + } + /// /// Loads an assembly via Reflection and adds it to the list of loaded assemblies /// @@ -503,5 +510,10 @@ namespace PepperDash.Essentials Version = version; Assembly = assembly; } + + public void SetAssembly(Assembly assembly) + { + Assembly = assembly; + } } } \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Config/DeviceFactory.cs b/essentials-framework/Essentials DM/Essentials_DM/Config/DeviceFactory.cs index 6e10ae61..5c532ac5 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Config/DeviceFactory.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Config/DeviceFactory.cs @@ -1,4 +1,5 @@ using System; +using System.Linq; using System.Collections.Generic; using Crestron.SimplSharp; using Crestron.SimplSharp.CrestronIO; @@ -6,6 +7,7 @@ using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.DM; using Crestron.SimplSharpPro.DM.AirMedia; using Crestron.SimplSharpPro.UI; +using Crestron.SimplSharp.Reflection; using Newtonsoft.Json; using Newtonsoft.Json.Linq; @@ -20,25 +22,30 @@ namespace PepperDash.Essentials.DM /// /// Responsible for loading the type factories for this library /// - public class DmDeviceFactory - { - public DmDeviceFactory() + public class DeviceFactory + { + public DeviceFactory() { - Debug.Console(1, "Essentials.DM Factory Adding Types..."); + var assy = Assembly.GetExecutingAssembly(); + PluginLoader.SetEssentialsAssembly(assy.GetName().Name, assy); + + var types = assy.GetTypes().Where(ct => typeof(IDeviceFactory).IsAssignableFrom(ct) && !ct.IsInterface && !ct.IsAbstract); - var dmChassisFactory = new DmChassisControllerFactory() as IDeviceFactory; - dmChassisFactory.LoadTypeFactories(); - - var dmTxFactory = new DmTxControllerFactory() as IDeviceFactory; - dmTxFactory.LoadTypeFactories(); - - var dmRxFactory = new DmRmcControllerFactory() as IDeviceFactory; - dmRxFactory.LoadTypeFactories(); - - var hdMdFactory = new HdMdxxxCEControllerFactory() as IDeviceFactory; - hdMdFactory.LoadTypeFactories(); + if (types != null) + { + foreach (var type in types) + { + try + { + var factory = (IDeviceFactory)Crestron.SimplSharp.Reflection.Activator.CreateInstance(type); + factory.LoadTypeFactories(); + } + catch (Exception e) + { + Debug.Console(0, Debug.ErrorLogLevel.Error, "Unable to load type: '{1}' DeviceFactory: {0}", e, type.Name); + } + } + } } - - } - + } } \ No newline at end of file diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/DeviceFactory.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/DeviceFactory.cs deleted file mode 100644 index 099e1204..00000000 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/DeviceFactory.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; -using System.Collections.Generic; -using Crestron.SimplSharp; -using Crestron.SimplSharp.CrestronIO; -using Crestron.SimplSharpPro; - -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; -using PepperDash.Core; -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Core.Config; - -namespace PepperDash.Essentials.Devices.Displays -{ - public class DisplayDeviceFactory - { - public DisplayDeviceFactory() - { - var necFactory = new NecPSXMDisplayFactory() as IDeviceFactory; - necFactory.LoadTypeFactories(); - - var panasonicThFactory = new PanasonicThDisplayFactory() as IDeviceFactory; - panasonicThFactory.LoadTypeFactories(); - - var samsungMdcFactory = new SamsungMDCFactory() as IDeviceFactory; - samsungMdcFactory.LoadTypeFactories(); - - var avocorFactory = new AvocorDisplayFactory() as IDeviceFactory; - avocorFactory.LoadTypeFactories(); - } - - } -} \ No newline at end of file diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Essentials Devices Common.csproj b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Essentials Devices Common.csproj index 6585b074..147ace5b 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Essentials Devices Common.csproj +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Essentials Devices Common.csproj @@ -132,7 +132,6 @@ - diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Factory/DeviceFactory.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Factory/DeviceFactory.cs index 8904b8c3..c860d0cb 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Factory/DeviceFactory.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Factory/DeviceFactory.cs @@ -1,9 +1,11 @@ using System; +using System.Linq; using System.Collections.Generic; using Crestron.SimplSharp; using Crestron.SimplSharp.CrestronIO; using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.GeneralIO; +using Crestron.SimplSharp.Reflection; using Newtonsoft.Json; using Newtonsoft.Json.Linq; @@ -20,96 +22,31 @@ using PepperDash.Essentials.Devices.Common.Environment; namespace PepperDash.Essentials.Devices.Common { - public class DeviceFactory - { + public class DeviceFactory + { + public DeviceFactory() { - var appleTVFactory = new AppleTVFactory() as IDeviceFactory; - appleTVFactory.LoadTypeFactories(); + var assy = Assembly.GetExecutingAssembly(); + PluginLoader.SetEssentialsAssembly(assy.GetName().Name, assy); + + var types = assy.GetTypes().Where(ct => typeof(IDeviceFactory).IsAssignableFrom(ct) && !ct.IsInterface && !ct.IsAbstract); - var analogWayLCFactory = new AnalogWayLiveCoreFactory() as IDeviceFactory; - analogWayLCFactory.LoadTypeFactories(); - - var basicIrDisplayFactory = new BasicIrDisplayFactory() as IDeviceFactory; - basicIrDisplayFactory.LoadTypeFactories(); - - var biampTesiraFactory = new BiampTesiraForteDspFactory() as IDeviceFactory; - biampTesiraFactory.LoadTypeFactories(); - - var cameraViscaFactory = new Cameras.CameraViscaFactory() as IDeviceFactory; - cameraViscaFactory.LoadTypeFactories(); - - var cenRfGwFactory = new CenRfgwControllerFactory() as IDeviceFactory; - cenRfGwFactory.LoadTypeFactories(); - - var irBlurayFactory = new IRBlurayBaseFactory() as IDeviceFactory; - irBlurayFactory.LoadTypeFactories(); - - var digitalLoggerFactory = new DigitalLoggerFactory() as IDeviceFactory; - digitalLoggerFactory.LoadTypeFactories(); - - var genericAudioOutFactory = new GenericAudioOutWithVolumeFactory() as IDeviceFactory; - genericAudioOutFactory.LoadTypeFactories(); - - var genericSourceFactory = new GenericSourceFactory() as IDeviceFactory; - genericSourceFactory.LoadTypeFactories(); - - var inRoomPcFactory = new Core.Devices.InRoomPcFactory() as IDeviceFactory; - inRoomPcFactory.LoadTypeFactories(); - - var laptopFactory = new Core.Devices.LaptopFactory() as IDeviceFactory; - laptopFactory.LoadTypeFactories(); - - var blueJeansPcFactory = new SoftCodec.BlueJeansPcFactory() as IDeviceFactory; - blueJeansPcFactory.LoadTypeFactories(); - - var mockAcFactory = new AudioCodec.MockACFactory() as IDeviceFactory; - mockAcFactory.LoadTypeFactories(); - - var mockVcFactory = new VideoCodec.MockVCFactory() as IDeviceFactory; - mockVcFactory.LoadTypeFactories(); - - var ciscoCodecFactory = new VideoCodec.Cisco.CiscoSparkCodecFactory() as IDeviceFactory; - ciscoCodecFactory.LoadTypeFactories(); - - var zoomRoomFactory = new VideoCodec.ZoomRoom.ZoomRoomFactory() as IDeviceFactory; - zoomRoomFactory.LoadTypeFactories(); - - var digitalInputFactory = new GenericDigitalInputDeviceFactory() as IDeviceFactory; - digitalInputFactory.LoadTypeFactories(); - - var relayFactory = new GenericRelayDeviceFactory() as IDeviceFactory; - relayFactory.LoadTypeFactories(); - - var micPrivacyFactory = new Core.Privacy.MicrophonePrivacyControllerFactory() as IDeviceFactory; - micPrivacyFactory.LoadTypeFactories(); - - var rokuFactory = new Roku2Factory() as IDeviceFactory; - rokuFactory.LoadTypeFactories(); - - var setTopBoxFactory = new IRSetTopBoxBaseFactory() as IDeviceFactory; - setTopBoxFactory.LoadTypeFactories(); - - var tvOneCorioFactory = new TVOneCorioFactory() as IDeviceFactory; - tvOneCorioFactory.LoadTypeFactories(); - - var glsOccSensorBaseFactory = new GlsOccupancySensorBaseControllerFactory() as IDeviceFactory; - glsOccSensorBaseFactory.LoadTypeFactories(); - - var glsOdtOccSensorFactory = new GlsOdtOccupancySensorControllerFactory() as IDeviceFactory; - glsOdtOccSensorFactory.LoadTypeFactories(); - - var lutronQuantumFactory = new Environment.Lutron.LutronQuantumAreaFactory() as IDeviceFactory; - lutronQuantumFactory.LoadTypeFactories(); - - var din8sw8ControllerFactory = new Environment.Lighting.Din8sw8ControllerFactory() as IDeviceFactory; - din8sw8ControllerFactory.LoadTypeFactories(); - - var shadeControllerFactory = new Core.Shades.ShadeControllerFactory() as IDeviceFactory; - shadeControllerFactory.LoadTypeFactories(); - - var relayControlledShadeFactory = new Environment.Somfy.RelayControlledShadeFactory() as IDeviceFactory; - relayControlledShadeFactory.LoadTypeFactories(); + if (types != null) + { + foreach (var type in types) + { + try + { + var factory = (IDeviceFactory)Crestron.SimplSharp.Reflection.Activator.CreateInstance(type); + factory.LoadTypeFactories(); + } + catch (Exception e) + { + Debug.Console(0, Debug.ErrorLogLevel.Error, "Unable to load type: '{1}' DeviceFactory: {0}", e, type.Name); + } + } + } } - } + } } \ No newline at end of file From fcdfaca6a82ee17dda06dcf9d0f52fb717d18675 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Thu, 23 Apr 2020 15:05:20 -0600 Subject: [PATCH 066/156] Adds Essentials UI Template submodule. Updates PepperDash.Core to v1.0.35 --- .gitmodules | 3 +++ Essentials-Template-UI | 1 + essentials-framework/pepperdashcore-builds | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) create mode 160000 Essentials-Template-UI diff --git a/.gitmodules b/.gitmodules index 2ce66ffc..0abbfb4e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "essentials-framework/pepperdashcore-builds"] path = essentials-framework/pepperdashcore-builds url = https://github.com/ndorin/PepperDashCore-Builds.git +[submodule "Essentials-Template-UI"] + path = Essentials-Template-UI + url = https://github.com/PepperDash/Essentials-Template-UI.git diff --git a/Essentials-Template-UI b/Essentials-Template-UI new file mode 160000 index 00000000..8eaf8879 --- /dev/null +++ b/Essentials-Template-UI @@ -0,0 +1 @@ +Subproject commit 8eaf88791b42318fbe7c64402af46d747516e4fa diff --git a/essentials-framework/pepperdashcore-builds b/essentials-framework/pepperdashcore-builds index acebe6b4..15206840 160000 --- a/essentials-framework/pepperdashcore-builds +++ b/essentials-framework/pepperdashcore-builds @@ -1 +1 @@ -Subproject commit acebe6b43b28cc3a93f899e9714292a0cc1ab2cc +Subproject commit 15206840b3e6338f695e4ffba634a72e51ea1be5 From 282ea62f83c459e2fd32a26bfe3b134807536a19 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 27 Apr 2020 18:21:55 -0600 Subject: [PATCH 067/156] adds new ctor to add post activation action for ComPortController --- .../Config/Comm and IR/ComPortController.cs | 34 ++++++++++++++----- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/ComPortController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/ComPortController.cs index a5a5b14f..07260c7e 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/ComPortController.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/ComPortController.cs @@ -21,6 +21,19 @@ namespace PepperDash.Essentials.Core ComPort Port; ComPort.ComPortSpec Spec; + public ComPortController(string key, Func postActivationFunc, + ComPort.ComPortSpec spec, EssentialsControlPropertiesConfig config) : base(key) + { + Spec = spec; + + AddPostActivationAction(() => + { + Port = postActivationFunc(config); + + ConfigureComPort(); + }); + } + public ComPortController(string key, ComPort port, ComPort.ComPortSpec spec) : base(key) { @@ -45,16 +58,21 @@ namespace PepperDash.Essentials.Core return; // false } } - var specResult = Port.SetComPortSpec(Spec); - if (specResult != 0) - { - Debug.Console(0, this, "WARNING: Cannot set comspec"); - return; // false - } - Port.SerialDataReceived += new ComPortDataReceivedEvent(Port_SerialDataReceived); + ConfigureComPort(); } - ~ComPortController() + private void ConfigureComPort() + { + var specResult = Port.SetComPortSpec(Spec); + if (specResult != 0) + { + Debug.Console(0, this, "WARNING: Cannot set comspec"); + return; + } + Port.SerialDataReceived += Port_SerialDataReceived; + } + + ~ComPortController() { Port.SerialDataReceived -= Port_SerialDataReceived; } From d6d0e3cfda20ee2e2a4d771dfb230a56fb2d0c48 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 27 Apr 2020 18:22:23 -0600 Subject: [PATCH 068/156] adds new ctor to CecPortController to add post activation func --- .../Config/Comm and IR/CecPortController.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/CecPortController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/CecPortController.cs index a2493e3c..1ab38d89 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/CecPortController.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/CecPortController.cs @@ -20,6 +20,17 @@ namespace PepperDash.Essentials.Core ICec Port; + public CecPortController(string key, Func postActivationFunc, + EssentialsControlPropertiesConfig config):base(key) + { + AddPostActivationAction(() => + { + Port = postActivationFunc(config); + + Port.StreamCec.CecChange += StreamCec_CecChange; + }); + } + public CecPortController(string key, ICec port) : base(key) { From 0d33354f0838ebc8644a2104a79418de5f0ad976 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 27 Apr 2020 18:22:47 -0600 Subject: [PATCH 069/156] updates CommFactory to use new ctors for ComPortController and CecPortController --- .../Config/Comm and IR/CommFactory.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/CommFactory.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/CommFactory.cs index 23aea272..94110fd7 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/CommFactory.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/CommFactory.cs @@ -48,10 +48,10 @@ namespace PepperDash.Essentials.Core switch (controlConfig.Method) { case eControlMethod.Com: - comm = new ComPortController(deviceConfig.Key + "-com", GetComPort(controlConfig), controlConfig.ComParams); + comm = new ComPortController(deviceConfig.Key + "-com", GetComPort, controlConfig.ComParams, controlConfig); break; case eControlMethod.Cec: - comm = new CecPortController(deviceConfig.Key + "-cec", GetCecPort(controlConfig)); + comm = new CecPortController(deviceConfig.Key + "-cec", GetCecPort, controlConfig); break; case eControlMethod.IR: break; From 671d506b457d5bcc2699768e743832c64ee7c1a9 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 28 Apr 2020 08:54:38 -0600 Subject: [PATCH 070/156] moves Port registration for controller ports to ConfigureComPort ...and renames method to RegisterAndConfigureComPort --- .../Config/Comm and IR/ComPortController.cs | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/ComPortController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/ComPortController.cs index 07260c7e..2ca07749 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/ComPortController.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/ComPortController.cs @@ -47,22 +47,24 @@ namespace PepperDash.Essentials.Core Spec = spec; //IsConnected = new BoolFeedback(CommonBoolCue.IsConnected, () => true); - if (Port.Parent is CrestronControlSystem) - { - - var result = Port.Register(); - if (result != eDeviceRegistrationUnRegistrationResponse.Success) - { - Debug.Console(0, this, "ERROR: Cannot register Com port: {0}", result); - return; // false - } - } ConfigureComPort(); } private void ConfigureComPort() { + if (Port.Parent is CrestronControlSystem) + { + + + var result = Port.Register(); + if (result != eDeviceRegistrationUnRegistrationResponse.Success) + { + Debug.Console(0, this, "ERROR: Cannot register Com port: {0}", result); + return; // false + } + } + var specResult = Port.SetComPortSpec(Spec); if (specResult != 0) { From 4d433ebf22314bfdec9aaa7c492156d774e5175f Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Tue, 28 Apr 2020 12:19:23 -0500 Subject: [PATCH 071/156] resolve #130 Add new interface IRmcRouting add DmRmc4kZScalerC endpoint and associated changes to bridge and joinmap add DmRmc4kZScalerCController --- .../Routing/RoutingInterfaces.cs | 7 + .../Receivers/DmRmc4kZScalerCController.cs | 151 ++++++++++++++++++ .../Endpoints/Receivers/DmRmcHelper.cs | 27 +++- 3 files changed, 181 insertions(+), 4 deletions(-) create mode 100644 essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZScalerCController.cs diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingInterfaces.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingInterfaces.cs index 0c642d5c..6c3707a7 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingInterfaces.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingInterfaces.cs @@ -89,6 +89,13 @@ namespace PepperDash.Essentials.Core IntFeedback VideoSourceNumericFeedback { get; } IntFeedback AudioSourceNumericFeedback { get; } void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type); + } + + public interface IRmcRouting : IRouting + { + IntFeedback AudioVideoSourceNumericFeedback { get; } + void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type); + } /// diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZScalerCController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZScalerCController.cs new file mode 100644 index 00000000..72845c70 --- /dev/null +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZScalerCController.cs @@ -0,0 +1,151 @@ +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.Endpoints; +using Crestron.SimplSharpPro.DM.Endpoints.Receivers; + +using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; +using PepperDash.Core; + +namespace PepperDash.Essentials.DM +{ + public class DmRmc4kZScalerCController : DmRmcControllerBase, IRmcRouting, + IIRInputPort, IComPorts, ICec + { + DmRmc4kzScalerC Rmc { get; private set; } + + public RoutingInputPort DmIn { get; private set; } + public RoutingInputPort HdmiIn { get; private set; } + public RoutingOutputPort HdmiOut { get; private set; } + + /// + /// The value of the current video source for the HDMI output on the receiver + /// + public IntFeedback AudioVideoSourceNumericFeedback { get; private set; } + + public RoutingPortCollection InputPorts + { + get { return new RoutingPortCollection { DmIn, HdmiIn }; } + } + + public RoutingPortCollection OutputPorts + { + get { return new RoutingPortCollection { HdmiOut }; } + } + + public DmRmc4kZScalerCController(string key, string name, DmRmc4kzScalerC rmc) + : base(key, name, rmc) + { + Rmc = rmc; + DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.DmCat, 0, this); + HdmiIn = new RoutingInputPort(DmPortName.HdmiIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.Hdmi, 0, this); + HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.Hdmi, null, this); + + EdidManufacturerFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.Manufacturer.StringValue); + EdidNameFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.Name.StringValue); + EdidPreferredTimingFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.PreferredTiming.StringValue); + EdidSerialNumberFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.SerialNumber.StringValue); + + VideoOutputResolutionFeedback = new StringFeedback(() => Rmc.HdmiOutput.GetVideoResolutionString()); + + Rmc.HdmiOutput.OutputStreamChange += HdmiOutput_OutputStreamChange; + Rmc.HdmiOutput.ConnectedDevice.DeviceInformationChange += ConnectedDevice_DeviceInformationChange; + + // Set Ports for CEC + HdmiOut.Port = Rmc.HdmiOutput; + + AudioVideoSourceNumericFeedback = new IntFeedback(() => (ushort)(Rmc.SelectedSourceFeedback)); + } + + void HdmiOutput_OutputStreamChange(EndpointOutputStream outputStream, EndpointOutputStreamEventArgs args) + { + if (args.EventId == EndpointOutputStreamEventIds.HorizontalResolutionFeedbackEventId || args.EventId == EndpointOutputStreamEventIds.VerticalResolutionFeedbackEventId || + args.EventId == EndpointOutputStreamEventIds.FramesPerSecondFeedbackEventId) + { + VideoOutputResolutionFeedback.FireUpdate(); + } + + if (args.EventId == EndpointOutputStreamEventIds.SelectedSourceFeedbackEventId) + { + AudioVideoSourceNumericFeedback.FireUpdate(); + } + } + + void ConnectedDevice_DeviceInformationChange(ConnectedDeviceInformation connectedDevice, ConnectedDeviceEventArgs args) + { + if (args.EventId == ConnectedDeviceEventIds.ManufacturerEventId) + { + EdidManufacturerFeedback.FireUpdate(); + } + else if (args.EventId == ConnectedDeviceEventIds.NameEventId) + { + EdidNameFeedback.FireUpdate(); + } + else if (args.EventId == ConnectedDeviceEventIds.PreferredTimingEventId) + { + EdidPreferredTimingFeedback.FireUpdate(); + } + else if (args.EventId == ConnectedDeviceEventIds.SerialNumberEventId) + { + EdidSerialNumberFeedback.FireUpdate(); + } + } + + public override bool CustomActivate() + { + // Base does register and sets up comm monitoring. + return base.CustomActivate(); + } + + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) + { + LinkDmRmcToApi(this, trilist, joinStart, joinMapKey, bridge); + } + + #region IIROutputPorts Members + public CrestronCollection IROutputPorts { get { return Rmc.IROutputPorts; } } + public int NumberOfIROutputPorts { get { return Rmc.NumberOfIROutputPorts; } } + #endregion + + #region IComPorts Members + public CrestronCollection ComPorts { get { return Rmc.ComPorts; } } + public int NumberOfComPorts { get { return Rmc.NumberOfComPorts; } } + #endregion + + #region ICec Members + /// + /// Gets the CEC stream directly from the HDMI port. + /// + public Cec StreamCec { get { return Rmc.HdmiOutput.StreamCec; } } + #endregion + + + #region IRmcRouting Members + public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType) + { + Debug.Console(2, this, "Attempting a route from input {0} to HDMI Output", inputSelector); + + var number = Convert.ToUInt16(inputSelector); + + Rmc.AudioVideoSource = (DmRmc4kzScalerC.eAudioVideoSource)number; + } + + public void ExecuteNumericSwitch(uint inputSelector, uint outputSelector, eRoutingSignalType signalType) + { + Debug.Console(2, this, "Attempting a route from input {0} to HDMI Output", inputSelector); + + Rmc.AudioVideoSource = (DmRmc4kzScalerC.eAudioVideoSource)inputSelector; + } + #endregion + + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs index da3e587a..ad65b285 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs @@ -37,8 +37,8 @@ namespace PepperDash.Essentials.DM AddToFeedbackList(VideoOutputResolutionFeedback, EdidManufacturerFeedback, EdidSerialNumberFeedback, EdidNameFeedback, EdidPreferredTimingFeedback); } - protected void LinkDmRmcToApi(DmRmcControllerBase rmc, BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) - { + protected void LinkDmRmcToApi(DmRmcControllerBase rmc, BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) + { var joinMap = new DmRmcControllerJoinMap(); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); @@ -61,7 +61,18 @@ namespace PepperDash.Essentials.DM rmc.EdidPreferredTimingFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidPrefferedTiming]); if (rmc.EdidSerialNumberFeedback != null) rmc.EdidSerialNumberFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidSerialNumber]); - } + + //If the device is an DM-RMC-4K-Z-SCALER-C + var routing = rmc as IRmcRouting; + + if (routing != null) + { + if (routing.AudioVideoSourceNumericFeedback != null) + routing.AudioVideoSourceNumericFeedback.LinkInputSig(trilist.UShortInput[joinMap.AudioVideoSource]); + + trilist.SetUShortSigAction(joinMap.AudioVideoSource, (a) => routing.ExecuteNumericSwitch(a, 1, eRoutingSignalType.AudioVideo)); + } + } } public abstract class DmHdBaseTControllerBase : CrestronGenericBaseDevice @@ -165,6 +176,8 @@ namespace PepperDash.Essentials.DM return new DmRmc4kScalerCController(key, name, new DmRmc4kScalerC(ipid, Global.ControlSystem)); if (typeName.StartsWith("dmrmc4kscalercdsp")) return new DmRmc4kScalerCDspController(key, name, new DmRmc4kScalerCDsp(ipid, Global.ControlSystem)); + if (typeName.StartsWith("dmrmc4kzscalerc")) + return new DmRmc4kZScalerCController(key, name, new DmRmc4kzScalerC(ipid, Global.ControlSystem)); } catch (Exception e) { @@ -238,6 +251,8 @@ namespace PepperDash.Essentials.DM return new DmRmc4kScalerCController(key, name, new DmRmc4kScalerC(chassis.Outputs[num])); if (typeName.StartsWith("dmrmc4kscalercdsp")) return new DmRmc4kScalerCDspController(key, name, new DmRmc4kScalerCDsp(chassis.Outputs[num])); + if (typeName.StartsWith("dmrmc4kzscalerc")) + return new DmRmc4kZScalerCController(key, name, new DmRmc4kzScalerC(chassis.Outputs[num])); } else { @@ -271,6 +286,9 @@ namespace PepperDash.Essentials.DM return new DmRmc4kScalerCController(key, name, new DmRmc4kScalerC(ipid, chassis.Outputs[num])); if (typeName.StartsWith("dmrmc4kscalercdsp")) return new DmRmc4kScalerCDspController(key, name, new DmRmc4kScalerCDsp(ipid, chassis.Outputs[num])); + if (typeName.StartsWith("dmrmc4kzscalerc")) + return new DmRmc4kZScalerCController(key, name, new DmRmc4kzScalerC(chassis.Outputs[num])); + } } catch (Exception e) @@ -288,7 +306,8 @@ namespace PepperDash.Essentials.DM public DmRmcControllerFactory() { TypeNames = new List() { "hdbasetrx", "dmrmc4k100c1g", "dmrmc100c", "dmrmc100s", "dmrmc4k100c", "dmrmc150s", - "dmrmc200c", "dmrmc200s", "dmrmc200s2", "dmrmcscalerc", "dmrmcscalers", "dmrmcscalers2", "dmrmc4kscalerc", "dmrmc4kscalercdsp" }; + "dmrmc200c", "dmrmc200s", "dmrmc200s2", "dmrmcscalerc", "dmrmcscalers", "dmrmcscalers2", "dmrmc4kscalerc", "dmrmc4kscalercdsp", + "dmrmc4kzscalerc" }; } public override EssentialsDevice BuildDevice(DeviceConfig dc) From 79253c6b31ca7a887b2c41b01ba75876b86d92a7 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Tue, 28 Apr 2020 12:27:06 -0500 Subject: [PATCH 072/156] Fixed minor Interface Implementation Issues --- .../JoinMaps/DmRmcControllerJoinMap.cs | 14 +- .../JoinMaps/DmRmcControllerJoinMap.cs | 60 ++-- .../Routing/RoutingInterfaces.cs | 6 +- .../Receivers/DmRmc4kZScalerCController.cs | 6 +- .../PepperDash_Essentials_DM.csproj | 317 +++++++++--------- 5 files changed, 211 insertions(+), 192 deletions(-) diff --git a/PepperDashEssentials/Bridges/JoinMaps/DmRmcControllerJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/DmRmcControllerJoinMap.cs index 7e1534bf..3d7cec8d 100644 --- a/PepperDashEssentials/Bridges/JoinMaps/DmRmcControllerJoinMap.cs +++ b/PepperDashEssentials/Bridges/JoinMaps/DmRmcControllerJoinMap.cs @@ -38,8 +38,12 @@ namespace PepperDash.Essentials.Bridges /// Reports the EDID serial number value /// public uint EdidSerialNumber { get; set; } - #endregion - + #endregion + + #region Analogs + public uint AudioVideoSource { get; set; } + #endregion + public DmRmcControllerJoinMap() { // Digital @@ -51,6 +55,9 @@ namespace PepperDash.Essentials.Bridges EdidName = 3; EdidPrefferedTiming = 4; EdidSerialNumber = 5; + + //Analog + AudioVideoSource = 1; } public override void OffsetJoinNumbers(uint joinStart) @@ -62,7 +69,8 @@ namespace PepperDash.Essentials.Bridges EdidManufacturer = EdidManufacturer + joinOffset; EdidName = EdidName + joinOffset; EdidPrefferedTiming = EdidPrefferedTiming + joinOffset; - EdidSerialNumber = EdidSerialNumber + joinOffset; + EdidSerialNumber = EdidSerialNumber + joinOffset; + AudioVideoSource = AudioVideoSource + joinOffset; } } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmRmcControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmRmcControllerJoinMap.cs index 0bdedbbf..94b9396b 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmRmcControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmRmcControllerJoinMap.cs @@ -37,31 +37,39 @@ namespace PepperDash.Essentials.Core.Bridges /// Reports the EDID serial number value /// public uint EdidSerialNumber { get; set; } - #endregion - - public DmRmcControllerJoinMap() - { - // Digital - IsOnline = 1; - - // Serial - CurrentOutputResolution = 1; - EdidManufacturer = 2; - EdidName = 3; - EdidPrefferedTiming = 4; - EdidSerialNumber = 5; - } - - public override void OffsetJoinNumbers(uint joinStart) - { - var joinOffset = joinStart - 1; - - IsOnline = IsOnline + joinOffset; - CurrentOutputResolution = CurrentOutputResolution + joinOffset; - EdidManufacturer = EdidManufacturer + joinOffset; - EdidName = EdidName + joinOffset; - EdidPrefferedTiming = EdidPrefferedTiming + joinOffset; - EdidSerialNumber = EdidSerialNumber + joinOffset; - } + #endregion + + #region Analogs + public uint AudioVideoSource { get; set; } + #endregion + + public DmRmcControllerJoinMap() + { + // Digital + IsOnline = 1; + + // Serial + CurrentOutputResolution = 1; + EdidManufacturer = 2; + EdidName = 3; + EdidPrefferedTiming = 4; + EdidSerialNumber = 5; + + //Analog + AudioVideoSource = 1; + } + + public override void OffsetJoinNumbers(uint joinStart) + { + var joinOffset = joinStart - 1; + + IsOnline = IsOnline + joinOffset; + CurrentOutputResolution = CurrentOutputResolution + joinOffset; + EdidManufacturer = EdidManufacturer + joinOffset; + EdidName = EdidName + joinOffset; + EdidPrefferedTiming = EdidPrefferedTiming + joinOffset; + EdidSerialNumber = EdidSerialNumber + joinOffset; + AudioVideoSource = AudioVideoSource + joinOffset; + } } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingInterfaces.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingInterfaces.cs index 6c3707a7..3b288290 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingInterfaces.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingInterfaces.cs @@ -91,11 +91,13 @@ namespace PepperDash.Essentials.Core void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type); } + /// + /// Defines a receiver that has internal routing (DM-RMC-4K-Z-SCALER-C) + /// public interface IRmcRouting : IRouting { IntFeedback AudioVideoSourceNumericFeedback { get; } - void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type); - + void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type); } /// diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZScalerCController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZScalerCController.cs index 72845c70..a42b6771 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZScalerCController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZScalerCController.cs @@ -16,9 +16,9 @@ using PepperDash.Core; namespace PepperDash.Essentials.DM { public class DmRmc4kZScalerCController : DmRmcControllerBase, IRmcRouting, - IIRInputPort, IComPorts, ICec + IIROutputPorts, IComPorts, ICec { - DmRmc4kzScalerC Rmc { get; private set; } + public DmRmc4kzScalerC Rmc { get; private set; } public RoutingInputPort DmIn { get; private set; } public RoutingInputPort HdmiIn { get; private set; } @@ -139,7 +139,7 @@ namespace PepperDash.Essentials.DM Rmc.AudioVideoSource = (DmRmc4kzScalerC.eAudioVideoSource)number; } - public void ExecuteNumericSwitch(uint inputSelector, uint outputSelector, eRoutingSignalType signalType) + public void ExecuteNumericSwitch(ushort inputSelector, ushort outputSelector, eRoutingSignalType signalType) { Debug.Console(2, this, "Attempting a route from input {0} to HDMI Output", inputSelector); diff --git a/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj b/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj index f8ea57a9..c32d3597 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj +++ b/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj @@ -1,159 +1,160 @@ - - - Release - AnyCPU - 9.0.30729 - 2.0 - {9199CE8A-0C9F-4952-8672-3EED798B284F} - Library - Properties - PepperDash_Essentials_DM - PepperDash_Essentials_DM - {0B4745B0-194B-4BB6-8E21-E9057CA92300};{4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - WindowsCE - E2BECB1F-8C8C-41ba-B736-9BE7D946A398 - 5.0 - SmartDeviceProject1 - v3.5 - Windows CE - - - - - .allowedReferenceRelatedFileExtensions - true - full - false - bin\ - DEBUG;TRACE; - prompt - 4 - 512 - true - true - off - - - .allowedReferenceRelatedFileExtensions - none - true - bin\ - prompt - 4 - 512 - true - true - off - - - - False - ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.DeviceSupport.dll - - - False - ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.DM.dll - - - False - ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.UI.dll - - - - False - ..\..\pepperdashcore-builds\PepperDash_Core.dll - - - False - ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpCustomAttributesInterface.dll - False - - - False - ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpHelperInterface.dll - False - - - False - ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpNewtonsoft.dll - - - False - ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpPro.exe - False - - - False - ..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpReflectionInterface.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5} - PepperDash_Essentials_Core - - - - - - - - - rem S# Pro preparation will execute after these operations - + + + Release + AnyCPU + 9.0.30729 + 2.0 + {9199CE8A-0C9F-4952-8672-3EED798B284F} + Library + Properties + PepperDash_Essentials_DM + PepperDash_Essentials_DM + {0B4745B0-194B-4BB6-8E21-E9057CA92300};{4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + WindowsCE + E2BECB1F-8C8C-41ba-B736-9BE7D946A398 + 5.0 + SmartDeviceProject1 + v3.5 + Windows CE + + + + + .allowedReferenceRelatedFileExtensions + true + full + false + bin\ + DEBUG;TRACE; + prompt + 4 + 512 + true + true + off + + + .allowedReferenceRelatedFileExtensions + none + true + bin\ + prompt + 4 + 512 + true + true + off + + + + False + ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.DeviceSupport.dll + + + False + ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.DM.dll + + + False + ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.UI.dll + + + + False + ..\..\pepperdashcore-builds\PepperDash_Core.dll + + + False + ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpCustomAttributesInterface.dll + False + + + False + ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpHelperInterface.dll + False + + + False + ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpNewtonsoft.dll + + + False + ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpPro.exe + False + + + False + ..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpReflectionInterface.dll + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5} + PepperDash_Essentials_Core + + + + + + + + + rem S# Pro preparation will execute after these operations + \ No newline at end of file From 44fcbf98f2dbbf16684d78ecad5933da8939d9a0 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 28 Apr 2020 12:13:35 -0600 Subject: [PATCH 073/156] rename ConfigureComPort to RegisterAndConfigureComPort --- .../Config/Comm and IR/ComPortController.cs | 9 +++------ .../VideoCodec/MockVC/MockVCCamera.cs | 8 ++++---- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/ComPortController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/ComPortController.cs index 2ca07749..3fbfb43d 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/ComPortController.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/ComPortController.cs @@ -30,7 +30,7 @@ namespace PepperDash.Essentials.Core { Port = postActivationFunc(config); - ConfigureComPort(); + RegisterAndConfigureComPort(); }); } @@ -47,16 +47,13 @@ namespace PepperDash.Essentials.Core Spec = spec; //IsConnected = new BoolFeedback(CommonBoolCue.IsConnected, () => true); - - ConfigureComPort(); + RegisterAndConfigureComPort(); } - private void ConfigureComPort() + private void RegisterAndConfigureComPort() { if (Port.Parent is CrestronControlSystem) { - - var result = Port.Register(); if (result != eDeviceRegistrationUnRegistrationResponse.Success) { diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/MockVC/MockVCCamera.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/MockVC/MockVCCamera.cs index 23a5c9f5..0c008849 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/MockVC/MockVCCamera.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/MockVC/MockVCCamera.cs @@ -10,7 +10,7 @@ using PepperDash.Essentials.Devices.Common.VideoCodec; namespace PepperDash.Essentials.Devices.Common.Cameras { - public class MockVCCamera : CameraBase, IHasCameraPtzControl, IHasCameraFocusControl + public class MockVCCamera : CameraBase, IHasCameraPtzControl, IHasCameraFocusControl, IBridgeAdvanced { protected VideoCodecBase ParentCodec { get; private set; } @@ -113,13 +113,13 @@ namespace PepperDash.Essentials.Devices.Common.Cameras #endregion - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) + public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { LinkCameraToApi(this, trilist, joinStart, joinMapKey, bridge); } } - public class MockFarEndVCCamera : CameraBase, IHasCameraPtzControl, IAmFarEndCamera + public class MockFarEndVCCamera : CameraBase, IHasCameraPtzControl, IAmFarEndCamera, IBridgeAdvanced { protected VideoCodecBase ParentCodec { get; private set; } @@ -198,7 +198,7 @@ namespace PepperDash.Essentials.Devices.Common.Cameras #endregion - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) + public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { LinkCameraToApi(this, trilist, joinStart, joinMapKey, bridge); } From 90c443525314da02a5d064dcb9fc9997641d24d5 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 28 Apr 2020 12:14:08 -0600 Subject: [PATCH 074/156] fix condition for determining if type is IBridgeAdvanced --- .../PepperDashEssentialsBase/Bridges/BridgeBase.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs index ecb53ffc..5bde418f 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs @@ -114,11 +114,13 @@ namespace PepperDash.Essentials.Core.Bridges //{ // Debug.Console(2, this, "'{0}' is IBridge", device.Key); //} - if (device.GetType().GetCType().IsAssignableFrom(typeof (IBridgeAdvanced))) + if (!typeof (IBridgeAdvanced).IsAssignableFrom(device.GetType().GetCType())) { - var bridge = device as IBridgeAdvanced; - if (bridge != null) bridge.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey, this); + continue; } + + var bridge = device as IBridgeAdvanced; + if (bridge != null) bridge.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey, this); } From 51dc2155045af66bb9af5b1ffabab3707fa56e52 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 28 Apr 2020 12:16:24 -0600 Subject: [PATCH 075/156] change CameraBase to EssentialsDevice All internal types that derive from CameraBase now implement IBridgeAdvanced and call the protected method LinkCameraToApi for bridging --- .../Essentials Devices Common/Cameras/CameraBase.cs | 2 +- .../Essentials Devices Common/Cameras/CameraVisca.cs | 4 ++-- .../VideoCodec/CiscoCodec/CiscoCamera.cs | 8 ++++---- .../VideoCodec/ZoomRoom/ZoomRoomCamera.cs | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Cameras/CameraBase.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Cameras/CameraBase.cs index bb7636db..960b8355 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Cameras/CameraBase.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Cameras/CameraBase.cs @@ -25,7 +25,7 @@ namespace PepperDash.Essentials.Devices.Common.Cameras Focus = 8 } - public abstract class CameraBase : EssentialsBridgeableDevice, IRoutingOutputs + public abstract class CameraBase : EssentialsDevice, IRoutingOutputs { public eCameraControlMode ControlMode { get; protected set; } diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Cameras/CameraVisca.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Cameras/CameraVisca.cs index bb6758b6..4393229c 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Cameras/CameraVisca.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Cameras/CameraVisca.cs @@ -14,7 +14,7 @@ using Crestron.SimplSharp.Reflection; namespace PepperDash.Essentials.Devices.Common.Cameras { - public class CameraVisca : CameraBase, IHasCameraPtzControl, ICommunicationMonitor, IHasCameraPresets, IPower + public class CameraVisca : CameraBase, IHasCameraPtzControl, ICommunicationMonitor, IHasCameraPresets, IPower, IBridgeAdvanced { public IBasicCommunication Communication { get; private set; } public CommunicationGather PortGather { get; private set; } @@ -82,7 +82,7 @@ namespace PepperDash.Essentials.Devices.Common.Cameras return true; } - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) + public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { LinkCameraToApi(this, trilist, joinStart, joinMapKey, bridge); } diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoCamera.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoCamera.cs index 20035579..6f68b369 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoCamera.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoCamera.cs @@ -9,7 +9,7 @@ using PepperDash.Essentials.Devices.Common.Cameras; namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco { - public class CiscoFarEndCamera : CameraBase, IHasCameraPtzControl, IAmFarEndCamera + public class CiscoFarEndCamera : CameraBase, IHasCameraPtzControl, IAmFarEndCamera, IBridgeAdvanced { protected CiscoSparkCodec ParentCodec { get; private set; } @@ -100,13 +100,13 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco ParentCodec.SendText(string.Format("xCommand Call FarEndControl Camera Stop CallId: {0}", CallId)); } - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) + public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { LinkCameraToApi(this, trilist, joinStart, joinMapKey, bridge); } } - public class CiscoSparkCamera : CameraBase, IHasCameraPtzControl, IHasCameraFocusControl + public class CiscoSparkCamera : CameraBase, IHasCameraPtzControl, IHasCameraFocusControl, IBridgeAdvanced { /// /// The codec this camera belongs to @@ -315,7 +315,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco #endregion - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) + public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { LinkCameraToApi(this, trilist, joinStart, joinMapKey, bridge); } diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ZoomRoomCamera.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ZoomRoomCamera.cs index 9ad0936b..4fa377ae 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ZoomRoomCamera.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ZoomRoomCamera.cs @@ -30,7 +30,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom } - public class ZoomRoomCamera : CameraBase, IHasCameraPtzControl + public class ZoomRoomCamera : CameraBase, IHasCameraPtzControl, IBridgeAdvanced { protected ZoomRoom ParentCodec { get; private set; } @@ -200,7 +200,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom #endregion - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) + public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { LinkCameraToApi(this, trilist, joinStart, joinMapKey, bridge); } From 15b65fb9a903626a18200b6edfb27d172a8c8ac2 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 28 Apr 2020 13:55:14 -0600 Subject: [PATCH 076/156] changes DisplayBase to inherit from EssentialsDevice --- .../PepperDashEssentialsBase/Display/DisplayBase.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs index 415eed5b..cf317f40 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs @@ -18,7 +18,7 @@ namespace PepperDash.Essentials.Core /// /// /// - public abstract class DisplayBase : EssentialsBridgeableDevice, IHasFeedback, IRoutingSinkWithSwitching, IPower, IWarmingCooling, IUsageTracking + public abstract class DisplayBase : EssentialsDevice, IHasFeedback, IRoutingSinkWithSwitching, IPower, IWarmingCooling, IUsageTracking { public event SourceInfoChangeHandler CurrentSourceChange; From d0e357f4b7eaf26e3920dcca7a7de70e2ad2fd18 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 28 Apr 2020 14:01:59 -0600 Subject: [PATCH 077/156] adds IBridgeAdvanced at actual device level --- .../PepperDashEssentialsBase/Display/BasicIrDisplay.cs | 4 ++-- .../PepperDashEssentialsBase/Display/MockDisplay.cs | 4 ++-- .../Essentials Devices Common/Display/AvocorVTFDisplay.cs | 4 ++-- .../Essentials Devices Common/Display/NECPSXMDisplay.cs | 4 ++-- .../Essentials Devices Common/Display/NecPaSeriesProjector.cs | 4 ++-- .../Essentials Devices Common/Display/PanasonicThDisplay.cs | 4 ++-- .../Essentials Devices Common/Display/SamsungMDCDisplay.cs | 4 ++-- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/BasicIrDisplay.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/BasicIrDisplay.cs index 95628e4e..fd83f2a2 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/BasicIrDisplay.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/BasicIrDisplay.cs @@ -14,7 +14,7 @@ using PepperDash.Essentials.Core.Routing; namespace PepperDash.Essentials.Core { - public class BasicIrDisplay : DisplayBase, IBasicVolumeControls, IPower, IWarmingCooling + public class BasicIrDisplay : DisplayBase, IBasicVolumeControls, IBridgeAdvanced { public IrOutputPortController IrPort { get; private set; } public ushort IrPulseTime { get; set; } @@ -204,7 +204,7 @@ namespace PepperDash.Essentials.Core #endregion - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) + public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { LinkDisplayToApi(this, trilist, joinStart, joinMapKey, bridge); } diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/MockDisplay.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/MockDisplay.cs index e6db4316..dcdba6d8 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/MockDisplay.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/MockDisplay.cs @@ -19,7 +19,7 @@ namespace PepperDash.Essentials.Core /// /// /// - public class MockDisplay : TwoWayDisplayBase, IBasicVolumeWithFeedback + public class MockDisplay : TwoWayDisplayBase, IBasicVolumeWithFeedback, IBridgeAdvanced { public RoutingInputPort HdmiIn1 { get; private set; } @@ -177,7 +177,7 @@ namespace PepperDash.Essentials.Core #endregion - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) + public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { LinkDisplayToApi(this, trilist, joinStart, joinMapKey, bridge); } diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/AvocorVTFDisplay.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/AvocorVTFDisplay.cs index 19482029..20d9fbec 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/AvocorVTFDisplay.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/AvocorVTFDisplay.cs @@ -19,7 +19,7 @@ namespace PepperDash.Essentials.Devices.Displays /// /// public class AvocorDisplay : TwoWayDisplayBase, IBasicVolumeWithFeedback, ICommunicationMonitor, IInputDisplayPort1, - IInputHdmi1, IInputHdmi2, IInputHdmi3, IInputHdmi4, IInputVga1 + IInputHdmi1, IInputHdmi2, IInputHdmi3, IInputHdmi4, IInputVga1, IBridgeAdvanced { public IBasicCommunication Communication { get; private set; } public CommunicationGather PortGather { get; private set; } @@ -203,7 +203,7 @@ namespace PepperDash.Essentials.Devices.Displays return true; } - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) + public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { LinkDisplayToApi(this, trilist, joinStart, joinMapKey, bridge); } diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/NECPSXMDisplay.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/NECPSXMDisplay.cs index 72311c7e..176f28ac 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/NECPSXMDisplay.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/NECPSXMDisplay.cs @@ -17,7 +17,7 @@ namespace PepperDash.Essentials.Devices.Displays /// /// /// - public class NecPSXMDisplay : TwoWayDisplayBase, IBasicVolumeWithFeedback, ICommunicationMonitor + public class NecPSXMDisplay : TwoWayDisplayBase, IBasicVolumeWithFeedback, ICommunicationMonitor, IBridgeAdvanced { public IBasicCommunication Communication { get; private set; } public CommunicationGather PortGather { get; private set; } @@ -154,7 +154,7 @@ namespace PepperDash.Essentials.Devices.Displays return true; } - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) + public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { LinkDisplayToApi(this, trilist, joinStart, joinMapKey, bridge); } diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/NecPaSeriesProjector.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/NecPaSeriesProjector.cs index ae2bf760..86c8ddaa 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/NecPaSeriesProjector.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/NecPaSeriesProjector.cs @@ -11,7 +11,7 @@ using PepperDash.Essentials.Core.Bridges; namespace PepperDash.Essentials.Devices.Displays { - public class NecPaSeriesProjector : ComTcpDisplayBase + public class NecPaSeriesProjector : ComTcpDisplayBase, IBridgeAdvanced { public readonly IntFeedback Lamp1RemainingPercent; int _Lamp1RemainingPercent; @@ -219,7 +219,7 @@ namespace PepperDash.Essentials.Devices.Displays } - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) + public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { LinkDisplayToApi(this, trilist, joinStart, joinMapKey, bridge); } diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/PanasonicThDisplay.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/PanasonicThDisplay.cs index 3ac01d66..b8d33bd1 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/PanasonicThDisplay.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/PanasonicThDisplay.cs @@ -17,7 +17,7 @@ namespace PepperDash.Essentials.Devices.Displays /// /// /// - public class PanasonicThDisplay : TwoWayDisplayBase, IBasicVolumeWithFeedback, ICommunicationMonitor + public class PanasonicThDisplay : TwoWayDisplayBase, IBasicVolumeWithFeedback, ICommunicationMonitor, IBridgeAdvanced { public IBasicCommunication Communication { get; private set; } public CommunicationGather PortGather { get; private set; } @@ -146,7 +146,7 @@ namespace PepperDash.Essentials.Devices.Displays return true; } - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) + public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { LinkDisplayToApi(this, trilist, joinStart, joinMapKey, bridge); } diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/SamsungMDCDisplay.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/SamsungMDCDisplay.cs index d56360f5..b2de0f8f 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/SamsungMDCDisplay.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/SamsungMDCDisplay.cs @@ -21,7 +21,7 @@ namespace PepperDash.Essentials.Devices.Displays /// /// public class SamsungMDC : TwoWayDisplayBase, IBasicVolumeWithFeedback, ICommunicationMonitor, IInputDisplayPort1, IInputDisplayPort2, - IInputHdmi1, IInputHdmi2, IInputHdmi3, IInputHdmi4 + IInputHdmi1, IInputHdmi2, IInputHdmi3, IInputHdmi4, IBridgeAdvanced { public IBasicCommunication Communication { get; private set; } @@ -152,7 +152,7 @@ namespace PepperDash.Essentials.Devices.Displays return true; } - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) + public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { LinkDisplayToApi(this, trilist, joinStart, joinMapKey, bridge); } From c06184d973706177efdd70783599ee793865146c Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 28 Apr 2020 15:59:31 -0600 Subject: [PATCH 078/156] fixes version comparison for plugin minimum versions --- .../PepperDashEssentialsBase/Global/Global.cs | 35 +++++++++++++++---- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Global/Global.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Global/Global.cs index de533ebb..2f3e1823 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Global/Global.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Global/Global.cs @@ -98,25 +98,47 @@ namespace PepperDash.Essentials.Core { Debug.Console(2, "Comparing running version '{0}' to minimum version '{1}'", AssemblyVersion, minimumVersion); + if (String.IsNullOrEmpty(minimumVersion)) + { + Debug.Console(0,"Plugin does not specify a minimum version. Loading plugin may not work as expected. Proceeding with loading plugin"); + return true; + } + var runtimeVersion = Regex.Match(AssemblyVersion, @"^(\d*).(\d*).(\d*).*"); var runtimeVersionMajor = Int16.Parse(runtimeVersion.Groups[1].Value); var runtimeVersionMinor = Int16.Parse(runtimeVersion.Groups[2].Value); var runtimeVersionBuild = Int16.Parse(runtimeVersion.Groups[3].Value); - // Check for beta build version - if (runtimeVersionMajor == 0) + var runtimeVer = new Version(runtimeVersionMajor, runtimeVersionMinor, runtimeVersionBuild); + + Version minimumVer; + try { - Debug.Console(2, "Running Local Build. Bypassing Dependency Check."); - return true; + minimumVer = new Version(minimumVersion); + } + catch + { + Debug.Console(2, "unable to parse minimum version {0}. Bypassing plugin load.", minimumVersion); + return false; } + + // Check for beta build version + if (runtimeVer.Major != 0) + { + return runtimeVer.CompareTo(minimumVer) >= 0; + } + + Debug.Console(2, "Running Local Build. Bypassing Dependency Check."); + return true; + + /* var minVersion = Regex.Match(minimumVersion, @"^(\d*).(\d*).(\d*)$"); if(!minVersion.Success) { - Debug.Console(2, "minimumVersion String does not match format xx.yy.zz"); - return false; + } var minVersionMajor = Int16.Parse(minVersion.Groups[1].Value); @@ -135,6 +157,7 @@ namespace PepperDash.Essentials.Core return false; return true; + */ } static Global() From 531c37c7528e463b8ebcbca34cb65e193e006f85 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Tue, 28 Apr 2020 17:15:38 -0500 Subject: [PATCH 079/156] resolves #135 - Adds new controller class for DM-RMC-4K-Z-100-C Extends existing controller class for RmcX100C devices and gives it additional connection metadata to report --- .../Receivers/DmRmc4kZScalerCController.cs | 151 +++++++++ .../Endpoints/Receivers/DmRmcHelper.cs | 9 +- .../Receivers/RmRmc4kZ100CController.cs | 95 ++++++ .../PepperDash_Essentials_DM.csproj | 317 +++++++++--------- 4 files changed, 410 insertions(+), 162 deletions(-) create mode 100644 essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZScalerCController.cs create mode 100644 essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/RmRmc4kZ100CController.cs diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZScalerCController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZScalerCController.cs new file mode 100644 index 00000000..a42b6771 --- /dev/null +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZScalerCController.cs @@ -0,0 +1,151 @@ +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.Endpoints; +using Crestron.SimplSharpPro.DM.Endpoints.Receivers; + +using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; +using PepperDash.Core; + +namespace PepperDash.Essentials.DM +{ + public class DmRmc4kZScalerCController : DmRmcControllerBase, IRmcRouting, + IIROutputPorts, IComPorts, ICec + { + public DmRmc4kzScalerC Rmc { get; private set; } + + public RoutingInputPort DmIn { get; private set; } + public RoutingInputPort HdmiIn { get; private set; } + public RoutingOutputPort HdmiOut { get; private set; } + + /// + /// The value of the current video source for the HDMI output on the receiver + /// + public IntFeedback AudioVideoSourceNumericFeedback { get; private set; } + + public RoutingPortCollection InputPorts + { + get { return new RoutingPortCollection { DmIn, HdmiIn }; } + } + + public RoutingPortCollection OutputPorts + { + get { return new RoutingPortCollection { HdmiOut }; } + } + + public DmRmc4kZScalerCController(string key, string name, DmRmc4kzScalerC rmc) + : base(key, name, rmc) + { + Rmc = rmc; + DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.DmCat, 0, this); + HdmiIn = new RoutingInputPort(DmPortName.HdmiIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.Hdmi, 0, this); + HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.Hdmi, null, this); + + EdidManufacturerFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.Manufacturer.StringValue); + EdidNameFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.Name.StringValue); + EdidPreferredTimingFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.PreferredTiming.StringValue); + EdidSerialNumberFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.SerialNumber.StringValue); + + VideoOutputResolutionFeedback = new StringFeedback(() => Rmc.HdmiOutput.GetVideoResolutionString()); + + Rmc.HdmiOutput.OutputStreamChange += HdmiOutput_OutputStreamChange; + Rmc.HdmiOutput.ConnectedDevice.DeviceInformationChange += ConnectedDevice_DeviceInformationChange; + + // Set Ports for CEC + HdmiOut.Port = Rmc.HdmiOutput; + + AudioVideoSourceNumericFeedback = new IntFeedback(() => (ushort)(Rmc.SelectedSourceFeedback)); + } + + void HdmiOutput_OutputStreamChange(EndpointOutputStream outputStream, EndpointOutputStreamEventArgs args) + { + if (args.EventId == EndpointOutputStreamEventIds.HorizontalResolutionFeedbackEventId || args.EventId == EndpointOutputStreamEventIds.VerticalResolutionFeedbackEventId || + args.EventId == EndpointOutputStreamEventIds.FramesPerSecondFeedbackEventId) + { + VideoOutputResolutionFeedback.FireUpdate(); + } + + if (args.EventId == EndpointOutputStreamEventIds.SelectedSourceFeedbackEventId) + { + AudioVideoSourceNumericFeedback.FireUpdate(); + } + } + + void ConnectedDevice_DeviceInformationChange(ConnectedDeviceInformation connectedDevice, ConnectedDeviceEventArgs args) + { + if (args.EventId == ConnectedDeviceEventIds.ManufacturerEventId) + { + EdidManufacturerFeedback.FireUpdate(); + } + else if (args.EventId == ConnectedDeviceEventIds.NameEventId) + { + EdidNameFeedback.FireUpdate(); + } + else if (args.EventId == ConnectedDeviceEventIds.PreferredTimingEventId) + { + EdidPreferredTimingFeedback.FireUpdate(); + } + else if (args.EventId == ConnectedDeviceEventIds.SerialNumberEventId) + { + EdidSerialNumberFeedback.FireUpdate(); + } + } + + public override bool CustomActivate() + { + // Base does register and sets up comm monitoring. + return base.CustomActivate(); + } + + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) + { + LinkDmRmcToApi(this, trilist, joinStart, joinMapKey, bridge); + } + + #region IIROutputPorts Members + public CrestronCollection IROutputPorts { get { return Rmc.IROutputPorts; } } + public int NumberOfIROutputPorts { get { return Rmc.NumberOfIROutputPorts; } } + #endregion + + #region IComPorts Members + public CrestronCollection ComPorts { get { return Rmc.ComPorts; } } + public int NumberOfComPorts { get { return Rmc.NumberOfComPorts; } } + #endregion + + #region ICec Members + /// + /// Gets the CEC stream directly from the HDMI port. + /// + public Cec StreamCec { get { return Rmc.HdmiOutput.StreamCec; } } + #endregion + + + #region IRmcRouting Members + public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType) + { + Debug.Console(2, this, "Attempting a route from input {0} to HDMI Output", inputSelector); + + var number = Convert.ToUInt16(inputSelector); + + Rmc.AudioVideoSource = (DmRmc4kzScalerC.eAudioVideoSource)number; + } + + public void ExecuteNumericSwitch(ushort inputSelector, ushort outputSelector, eRoutingSignalType signalType) + { + Debug.Console(2, this, "Attempting a route from input {0} to HDMI Output", inputSelector); + + Rmc.AudioVideoSource = (DmRmc4kzScalerC.eAudioVideoSource)inputSelector; + } + #endregion + + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs index da3e587a..64b84fe9 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs @@ -146,7 +146,7 @@ namespace PepperDash.Essentials.DM if (typeName.StartsWith("dmrmc4k100c")) return new DmRmcX100CController(key, name, new DmRmc4k100C(ipid, Global.ControlSystem)); if (typeName.StartsWith("dmrmc4kz100c")) - return new DmRmcX100CController(key, name, new DmRmc4kz100C(ipid, Global.ControlSystem)); + return new RmRmc4kZ100CController(key, name, new DmRmc4kz100C(ipid, Global.ControlSystem)); if (typeName.StartsWith("dmrmc150s")) return new DmRmc150SController(key, name, new DmRmc150S(ipid, Global.ControlSystem)); if (typeName.StartsWith("dmrmc200c")) @@ -219,7 +219,7 @@ namespace PepperDash.Essentials.DM if (typeName.StartsWith("dmrmc4k100c")) return new DmRmcX100CController(key, name, new DmRmc4k100C(chassis.Outputs[num])); if (typeName.StartsWith("dmrmc4kz100c")) - return new DmRmcX100CController(key, name, new DmRmc4kz100C(chassis.Outputs[num])); + return new RmRmc4kZ100CController(key, name, new DmRmc4kz100C(chassis.Outputs[num])); if (typeName.StartsWith("dmrmc150s")) return new DmRmc150SController(key, name, new DmRmc150S(chassis.Outputs[num])); if (typeName.StartsWith("dmrmc200c")) @@ -252,7 +252,7 @@ namespace PepperDash.Essentials.DM if (typeName.StartsWith("dmrmc4k100c")) return new DmRmcX100CController(key, name, new DmRmc4k100C(ipid, chassis.Outputs[num])); if (typeName.StartsWith("dmrmc4kz100c")) - return new DmRmcX100CController(key, name, new DmRmc4kz100C(ipid, chassis.Outputs[num])); + return new RmRmc4kZ100CController(key, name, new DmRmc4kz100C(ipid, chassis.Outputs[num])); if (typeName.StartsWith("dmrmc150s")) return new DmRmc150SController(key, name, new DmRmc150S(ipid, chassis.Outputs[num])); if (typeName.StartsWith("dmrmc200c")) @@ -288,7 +288,8 @@ namespace PepperDash.Essentials.DM public DmRmcControllerFactory() { TypeNames = new List() { "hdbasetrx", "dmrmc4k100c1g", "dmrmc100c", "dmrmc100s", "dmrmc4k100c", "dmrmc150s", - "dmrmc200c", "dmrmc200s", "dmrmc200s2", "dmrmcscalerc", "dmrmcscalers", "dmrmcscalers2", "dmrmc4kscalerc", "dmrmc4kscalercdsp" }; + "dmrmc200c", "dmrmc200s", "dmrmc200s2", "dmrmcscalerc", "dmrmcscalers", "dmrmcscalers2", "dmrmc4kscalerc", "dmrmc4kscalercdsp", + "dmrmc4kz100c" }; } public override EssentialsDevice BuildDevice(DeviceConfig dc) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/RmRmc4kZ100CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/RmRmc4kZ100CController.cs new file mode 100644 index 00000000..1ff5ec80 --- /dev/null +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/RmRmc4kZ100CController.cs @@ -0,0 +1,95 @@ +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.Endpoints; +using Crestron.SimplSharpPro.DM.Endpoints.Receivers; + +using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; + +namespace PepperDash.Essentials.DM +{ + public class RmRmc4kZ100CController : DmRmcX100CController + { + public new DmRmc4kz100C Rmc { get; private set; } + + public RoutingInputPort DmIn { get; private set; } + public RoutingOutputPort HdmiOut { get; private set; } + + public RoutingPortCollection InputPorts + { + get { return new RoutingPortCollection { DmIn }; } + } + + public RoutingPortCollection OutputPorts + { + get { return new RoutingPortCollection { HdmiOut }; } + } + + public RmRmc4kZ100CController(string key, string name, DmRmc4kz100C rmc) + : base(key, name, rmc) + { + Rmc = rmc; + DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.DmCat, 0, this); + HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.Hdmi, null, this); + + // Set Ports for CEC + HdmiOut.Port = Rmc; // Unique case, this class has no HdmiOutput port and ICec is implemented on the receiver class itself + + EdidManufacturerFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.Manufacturer.StringValue); + EdidNameFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.Name.StringValue); + EdidPreferredTimingFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.PreferredTiming.StringValue); + EdidSerialNumberFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.SerialNumber.StringValue); + + Rmc.HdmiOutput.OutputStreamChange += HdmiOutput_OutputStreamChange; + Rmc.HdmiOutput.ConnectedDevice.DeviceInformationChange += ConnectedDevice_DeviceInformationChange; + } + + void HdmiOutput_OutputStreamChange(EndpointOutputStream outputStream, EndpointOutputStreamEventArgs args) + { + if (args.EventId == EndpointOutputStreamEventIds.HorizontalResolutionFeedbackEventId || args.EventId == EndpointOutputStreamEventIds.VerticalResolutionFeedbackEventId || + args.EventId == EndpointOutputStreamEventIds.FramesPerSecondFeedbackEventId) + { + VideoOutputResolutionFeedback.FireUpdate(); + } + } + + void ConnectedDevice_DeviceInformationChange(ConnectedDeviceInformation connectedDevice, ConnectedDeviceEventArgs args) + { + if (args.EventId == ConnectedDeviceEventIds.ManufacturerEventId) + { + EdidManufacturerFeedback.FireUpdate(); + } + else if (args.EventId == ConnectedDeviceEventIds.NameEventId) + { + EdidNameFeedback.FireUpdate(); + } + else if (args.EventId == ConnectedDeviceEventIds.PreferredTimingEventId) + { + EdidPreferredTimingFeedback.FireUpdate(); + } + else if (args.EventId == ConnectedDeviceEventIds.SerialNumberEventId) + { + EdidSerialNumberFeedback.FireUpdate(); + } + } + + public override bool CustomActivate() + { + // Base does register and sets up comm monitoring. + return base.CustomActivate(); + } + + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) + { + LinkDmRmcToApi(this, trilist, joinStart, joinMapKey, bridge); + } + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj b/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj index f8ea57a9..bb165f92 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj +++ b/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj @@ -1,159 +1,160 @@ - - - Release - AnyCPU - 9.0.30729 - 2.0 - {9199CE8A-0C9F-4952-8672-3EED798B284F} - Library - Properties - PepperDash_Essentials_DM - PepperDash_Essentials_DM - {0B4745B0-194B-4BB6-8E21-E9057CA92300};{4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - WindowsCE - E2BECB1F-8C8C-41ba-B736-9BE7D946A398 - 5.0 - SmartDeviceProject1 - v3.5 - Windows CE - - - - - .allowedReferenceRelatedFileExtensions - true - full - false - bin\ - DEBUG;TRACE; - prompt - 4 - 512 - true - true - off - - - .allowedReferenceRelatedFileExtensions - none - true - bin\ - prompt - 4 - 512 - true - true - off - - - - False - ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.DeviceSupport.dll - - - False - ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.DM.dll - - - False - ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.UI.dll - - - - False - ..\..\pepperdashcore-builds\PepperDash_Core.dll - - - False - ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpCustomAttributesInterface.dll - False - - - False - ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpHelperInterface.dll - False - - - False - ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpNewtonsoft.dll - - - False - ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpPro.exe - False - - - False - ..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpReflectionInterface.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5} - PepperDash_Essentials_Core - - - - - - - - - rem S# Pro preparation will execute after these operations - + + + Release + AnyCPU + 9.0.30729 + 2.0 + {9199CE8A-0C9F-4952-8672-3EED798B284F} + Library + Properties + PepperDash_Essentials_DM + PepperDash_Essentials_DM + {0B4745B0-194B-4BB6-8E21-E9057CA92300};{4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + WindowsCE + E2BECB1F-8C8C-41ba-B736-9BE7D946A398 + 5.0 + SmartDeviceProject1 + v3.5 + Windows CE + + + + + .allowedReferenceRelatedFileExtensions + true + full + false + bin\ + DEBUG;TRACE; + prompt + 4 + 512 + true + true + off + + + .allowedReferenceRelatedFileExtensions + none + true + bin\ + prompt + 4 + 512 + true + true + off + + + + False + ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.DeviceSupport.dll + + + False + ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.DM.dll + + + False + ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.UI.dll + + + + False + ..\..\pepperdashcore-builds\PepperDash_Core.dll + + + False + ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpCustomAttributesInterface.dll + False + + + False + ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpHelperInterface.dll + False + + + False + ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpNewtonsoft.dll + + + False + ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpPro.exe + False + + + False + ..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpReflectionInterface.dll + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5} + PepperDash_Essentials_Core + + + + + + + + + rem S# Pro preparation will execute after these operations + \ No newline at end of file From 618fa680000b8661c912445d9b654800cd90ecba Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 28 Apr 2020 21:00:50 -0600 Subject: [PATCH 080/156] removes properties in inherited class --- ...ontroller.cs => DmRmc4kZ100CController.cs} | 156 ++++++++---------- .../Endpoints/Receivers/DmRmcHelper.cs | 2 +- .../Receivers/DmRmcX100CController.cs | 6 +- 3 files changed, 72 insertions(+), 92 deletions(-) rename essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/{RmRmc4kZ100CController.cs => DmRmc4kZ100CController.cs} (61%) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/RmRmc4kZ100CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZ100CController.cs similarity index 61% rename from essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/RmRmc4kZ100CController.cs rename to essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZ100CController.cs index 1ff5ec80..bc1829a3 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/RmRmc4kZ100CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZ100CController.cs @@ -1,95 +1,75 @@ -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.Endpoints; -using Crestron.SimplSharpPro.DM.Endpoints.Receivers; - -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Core.Bridges; - -namespace PepperDash.Essentials.DM -{ - public class RmRmc4kZ100CController : DmRmcX100CController - { - public new DmRmc4kz100C Rmc { get; private set; } - - public RoutingInputPort DmIn { get; private set; } - public RoutingOutputPort HdmiOut { get; private set; } - - public RoutingPortCollection InputPorts - { - get { return new RoutingPortCollection { DmIn }; } - } - - public RoutingPortCollection OutputPorts - { - get { return new RoutingPortCollection { HdmiOut }; } - } - - public RmRmc4kZ100CController(string key, string name, DmRmc4kz100C rmc) +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.Endpoints; +using Crestron.SimplSharpPro.DM.Endpoints.Receivers; + +using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; + +namespace PepperDash.Essentials.DM +{ + public class DmRmc4kZ100CController : DmRmcX100CController + { + private readonly DmRmc4kz100C _rmc; + + public DmRmc4kZ100CController(string key, string name, DmRmc4kz100C rmc) : base(key, name, rmc) - { - Rmc = rmc; + { + _rmc = rmc; DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmCat, 0, this); HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, - eRoutingPortConnectionType.Hdmi, null, this); + eRoutingPortConnectionType.Hdmi, null, this) {Port = _rmc}; // Set Ports for CEC - HdmiOut.Port = Rmc; // Unique case, this class has no HdmiOutput port and ICec is implemented on the receiver class itself - - EdidManufacturerFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.Manufacturer.StringValue); - EdidNameFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.Name.StringValue); - EdidPreferredTimingFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.PreferredTiming.StringValue); - EdidSerialNumberFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.SerialNumber.StringValue); - - Rmc.HdmiOutput.OutputStreamChange += HdmiOutput_OutputStreamChange; - Rmc.HdmiOutput.ConnectedDevice.DeviceInformationChange += ConnectedDevice_DeviceInformationChange; - } - - void HdmiOutput_OutputStreamChange(EndpointOutputStream outputStream, EndpointOutputStreamEventArgs args) - { - if (args.EventId == EndpointOutputStreamEventIds.HorizontalResolutionFeedbackEventId || args.EventId == EndpointOutputStreamEventIds.VerticalResolutionFeedbackEventId || - args.EventId == EndpointOutputStreamEventIds.FramesPerSecondFeedbackEventId) - { - VideoOutputResolutionFeedback.FireUpdate(); - } - } - - void ConnectedDevice_DeviceInformationChange(ConnectedDeviceInformation connectedDevice, ConnectedDeviceEventArgs args) - { - if (args.EventId == ConnectedDeviceEventIds.ManufacturerEventId) - { - EdidManufacturerFeedback.FireUpdate(); - } - else if (args.EventId == ConnectedDeviceEventIds.NameEventId) - { - EdidNameFeedback.FireUpdate(); - } - else if (args.EventId == ConnectedDeviceEventIds.PreferredTimingEventId) - { - EdidPreferredTimingFeedback.FireUpdate(); - } - else if (args.EventId == ConnectedDeviceEventIds.SerialNumberEventId) - { - EdidSerialNumberFeedback.FireUpdate(); - } - } - - public override bool CustomActivate() - { - // Base does register and sets up comm monitoring. - return base.CustomActivate(); - } - - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) - { - LinkDmRmcToApi(this, trilist, joinStart, joinMapKey, bridge); - } - } + + EdidManufacturerFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.Manufacturer.StringValue); + EdidNameFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.Name.StringValue); + EdidPreferredTimingFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.PreferredTiming.StringValue); + EdidSerialNumberFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.SerialNumber.StringValue); + + _rmc.HdmiOutput.OutputStreamChange += HdmiOutput_OutputStreamChange; + _rmc.HdmiOutput.ConnectedDevice.DeviceInformationChange += ConnectedDevice_DeviceInformationChange; + } + + void HdmiOutput_OutputStreamChange(EndpointOutputStream outputStream, EndpointOutputStreamEventArgs args) + { + if (args.EventId == EndpointOutputStreamEventIds.HorizontalResolutionFeedbackEventId || args.EventId == EndpointOutputStreamEventIds.VerticalResolutionFeedbackEventId || + args.EventId == EndpointOutputStreamEventIds.FramesPerSecondFeedbackEventId) + { + VideoOutputResolutionFeedback.FireUpdate(); + } + } + + void ConnectedDevice_DeviceInformationChange(ConnectedDeviceInformation connectedDevice, ConnectedDeviceEventArgs args) + { + if (args.EventId == ConnectedDeviceEventIds.ManufacturerEventId) + { + EdidManufacturerFeedback.FireUpdate(); + } + else if (args.EventId == ConnectedDeviceEventIds.NameEventId) + { + EdidNameFeedback.FireUpdate(); + } + else if (args.EventId == ConnectedDeviceEventIds.PreferredTimingEventId) + { + EdidPreferredTimingFeedback.FireUpdate(); + } + else if (args.EventId == ConnectedDeviceEventIds.SerialNumberEventId) + { + EdidSerialNumberFeedback.FireUpdate(); + } + } + + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) + { + LinkDmRmcToApi(this, trilist, joinStart, joinMapKey, bridge); + } + } } \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs index 64b84fe9..2c0a3134 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs @@ -26,7 +26,7 @@ namespace PepperDash.Essentials.DM public virtual StringFeedback EdidPreferredTimingFeedback { get; protected set; } public virtual StringFeedback EdidSerialNumberFeedback { get; protected set; } - public DmRmcControllerBase(string key, string name, EndpointReceiverBase device) + protected DmRmcControllerBase(string key, string name, EndpointReceiverBase device) : base(key, name, device) { // if wired to a chassis, skip registration step in base class diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcX100CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcX100CController.cs index a7260813..16526bc0 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcX100CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcX100CController.cs @@ -21,10 +21,10 @@ namespace PepperDash.Essentials.DM public class DmRmcX100CController : DmRmcControllerBase, IRoutingInputsOutputs, IIROutputPorts, IComPorts, ICec { - public DmRmc100C Rmc { get; private set; } + public DmRmc100C Rmc { get; protected set; } - public RoutingInputPort DmIn { get; private set; } - public RoutingOutputPort HdmiOut { get; private set; } + public RoutingInputPort DmIn { get; protected set; } + public RoutingOutputPort HdmiOut { get; protected set; } public RoutingPortCollection InputPorts { From d2c8da68a51621d6a9ff4eb1835729f70913a28d Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 28 Apr 2020 21:02:34 -0600 Subject: [PATCH 081/156] adds todo for examining class inheritance design --- .../Essentials_DM/Endpoints/Receivers/DmRmc4kZ100CController.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZ100CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZ100CController.cs index bc1829a3..e476ef78 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZ100CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZ100CController.cs @@ -29,6 +29,7 @@ namespace PepperDash.Essentials.DM // Set Ports for CEC + //TODO: We need to look at this class inheritance design...not so sure these properties need to be virtual and/or abstract. EdidManufacturerFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.Manufacturer.StringValue); EdidNameFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.Name.StringValue); EdidPreferredTimingFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.PreferredTiming.StringValue); From ef8a61c3ebf64edce11b06238cc06fbce62d9634 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 28 Apr 2020 21:12:52 -0600 Subject: [PATCH 082/156] removed duplicated logic from constructor --- .../Endpoints/Receivers/DmRmc4kZ100CController.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZ100CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZ100CController.cs index e476ef78..33705c0a 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZ100CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZ100CController.cs @@ -22,10 +22,13 @@ namespace PepperDash.Essentials.DM : base(key, name, rmc) { _rmc = rmc; + + /* removed this logic because it's done in the base constructor and doesn't need to be duplicated here DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmCat, 0, this); HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, null, this) {Port = _rmc}; + */ // Set Ports for CEC From b993419c3d2bd6f7aeaafac4f86d1cff07a24c12 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 28 Apr 2020 21:20:56 -0600 Subject: [PATCH 083/156] fixes file name for 4kz100C everywhere --- .../Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs | 2 +- .../Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs index 2c0a3134..7ff33957 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs @@ -146,7 +146,7 @@ namespace PepperDash.Essentials.DM if (typeName.StartsWith("dmrmc4k100c")) return new DmRmcX100CController(key, name, new DmRmc4k100C(ipid, Global.ControlSystem)); if (typeName.StartsWith("dmrmc4kz100c")) - return new RmRmc4kZ100CController(key, name, new DmRmc4kz100C(ipid, Global.ControlSystem)); + return new DmRmc4kZ100CController(key, name, new DmRmc4kz100C(ipid, Global.ControlSystem)); if (typeName.StartsWith("dmrmc150s")) return new DmRmc150SController(key, name, new DmRmc150S(ipid, Global.ControlSystem)); if (typeName.StartsWith("dmrmc200c")) diff --git a/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj b/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj index bb165f92..96533e96 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj +++ b/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj @@ -100,7 +100,7 @@ - + From 02c71f709c097e9bbbc4790ced56871712069407 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 28 Apr 2020 21:35:52 -0600 Subject: [PATCH 084/156] replaces 2 more occasions of Rm with Dm --- .../Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs index 7ff33957..1a5fe034 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs @@ -219,7 +219,7 @@ namespace PepperDash.Essentials.DM if (typeName.StartsWith("dmrmc4k100c")) return new DmRmcX100CController(key, name, new DmRmc4k100C(chassis.Outputs[num])); if (typeName.StartsWith("dmrmc4kz100c")) - return new RmRmc4kZ100CController(key, name, new DmRmc4kz100C(chassis.Outputs[num])); + return new DmRmc4kZ100CController(key, name, new DmRmc4kz100C(chassis.Outputs[num])); if (typeName.StartsWith("dmrmc150s")) return new DmRmc150SController(key, name, new DmRmc150S(chassis.Outputs[num])); if (typeName.StartsWith("dmrmc200c")) @@ -252,7 +252,7 @@ namespace PepperDash.Essentials.DM if (typeName.StartsWith("dmrmc4k100c")) return new DmRmcX100CController(key, name, new DmRmc4k100C(ipid, chassis.Outputs[num])); if (typeName.StartsWith("dmrmc4kz100c")) - return new RmRmc4kZ100CController(key, name, new DmRmc4kz100C(ipid, chassis.Outputs[num])); + return new DmRmc4kZ100CController(key, name, new DmRmc4kz100C(ipid, chassis.Outputs[num])); if (typeName.StartsWith("dmrmc150s")) return new DmRmc150SController(key, name, new DmRmc150S(ipid, chassis.Outputs[num])); if (typeName.StartsWith("dmrmc200c")) From 18c35b103e4ab038f5abe4ba82920801e0d95460 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Tue, 5 May 2020 12:09:53 -0500 Subject: [PATCH 085/156] resolves #143 - Joinmap and Bridge updated --- .../JoinMaps/DisplayControllerJoinMap.cs | 162 +++++++----------- .../Display/DisplayBase.cs | 67 ++++---- 2 files changed, 96 insertions(+), 133 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DisplayControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DisplayControllerJoinMap.cs index c2fe8573..c50321dc 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DisplayControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DisplayControllerJoinMap.cs @@ -7,111 +7,71 @@ using PepperDash.Essentials.Core; namespace PepperDash.Essentials.Core.Bridges { - public class DisplayControllerJoinMap : JoinMapBase - { - #region Digitals - /// - /// Turns the display off and reports power off feedback - /// - public uint PowerOff { get; set; } - /// - /// Turns the display on and repots power on feedback - /// - public uint PowerOn { get; set; } - /// - /// Indicates that the display device supports two way communication when high - /// - public uint IsTwoWayDisplay { get; set; } - /// - /// Increments the volume while high - /// - public uint VolumeUp { get; set; } - /// - /// Decrements teh volume while high - /// - public uint VolumeDown { get; set; } - /// - /// Toggles the mute state. Feedback is high when volume is muted - /// - public uint VolumeMute { get; set; } - /// - /// Range of digital joins to select inputs and report current input as feedback - /// - public uint InputSelectOffset { get; set; } - /// - /// Range of digital joins to report visibility for input buttons - /// - public uint ButtonVisibilityOffset { get; set; } - /// - /// High if the device is online - /// - public uint IsOnline { get; set; } - #endregion + public class DisplayControllerJoinMap : JoinMapBaseAdvanced + { + [JoinName("Name")] + public JoinDataComplete Name = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); - #region Analogs - /// - /// Analog join to set the input and report current input as feedback - /// - public uint InputSelect { get; set; } - /// - /// Sets the volume level and reports the current level as feedback - /// - public uint VolumeLevel { get; set; } - #endregion + [JoinName("PowerOff")] + public JoinDataComplete PowerOff = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "Power Off", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); - #region Serials - /// - /// Reports the name of the display as defined in config as feedback - /// - public uint Name { get; set; } - /// - /// Range of serial joins that reports the names of the inputs as feedback - /// - public uint InputNamesOffset { get; set; } - #endregion + [JoinName("PowerOn")] + public JoinDataComplete PowerOn = new JoinDataComplete(new JoinData() { JoinNumber = 2, JoinSpan = 1 }, + new JoinMetadata() { Label = "Power On", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); - public DisplayControllerJoinMap() + [JoinName("IsTwoWayDisplay")] + public JoinDataComplete IsTwoWayDisplay = new JoinDataComplete(new JoinData() { JoinNumber = 3, JoinSpan = 1 }, + new JoinMetadata() { Label = "Is Two Way Display", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("VolumeUp")] + public JoinDataComplete VolumeUp = new JoinDataComplete(new JoinData() { JoinNumber = 5, JoinSpan = 1 }, + new JoinMetadata() { Label = "Volume Up", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("VolumeLevel")] + public JoinDataComplete VolumeLevel = new JoinDataComplete(new JoinData() { JoinNumber = 5, JoinSpan = 1 }, + new JoinMetadata() { Label = "Volume Level", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("VolumeDown")] + public JoinDataComplete VolumeDown = new JoinDataComplete(new JoinData() { JoinNumber = 6, JoinSpan = 1 }, + new JoinMetadata() { Label = "Volume Down", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("VolumeMute")] + public JoinDataComplete VolumeMute = new JoinDataComplete(new JoinData() { JoinNumber = 7, JoinSpan = 1 }, + new JoinMetadata() { Label = "Volume Mute", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("VolumeMuteOn")] + public JoinDataComplete VolumeMuteOn = new JoinDataComplete(new JoinData() { JoinNumber = 8, JoinSpan = 1 }, + new JoinMetadata() { Label = "Volume Mute On", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("VolumeMuteOff")] + public JoinDataComplete VolumeMuteOff = new JoinDataComplete(new JoinData() { JoinNumber = 9, JoinSpan = 1 }, + new JoinMetadata() { Label = "Volume Mute Off", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("InputSelectOffset")] + public JoinDataComplete InputSelectOffset = new JoinDataComplete(new JoinData() { JoinNumber = 11, JoinSpan = 10 }, + new JoinMetadata() { Label = "Input Select", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("InputNamesOffset")] + public JoinDataComplete InputNamesOffset = new JoinDataComplete(new JoinData() { JoinNumber = 11, JoinSpan = 10 }, + new JoinMetadata() { Label = "Input Names Offset", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("InputSelect")] + public JoinDataComplete InputSelect = new JoinDataComplete(new JoinData() { JoinNumber = 11, JoinSpan = 1 }, + new JoinMetadata() { Label = "Input Select", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("ButtonVisibilityOffset")] + public JoinDataComplete ButtonVisibilityOffset = new JoinDataComplete(new JoinData() { JoinNumber = 41, JoinSpan = 10 }, + new JoinMetadata() { Label = "Button Visibility Offset", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.DigitalSerial }); + + [JoinName("IsOnline")] + public JoinDataComplete IsOnline = new JoinDataComplete(new JoinData() { JoinNumber = 50, JoinSpan = 1 }, + new JoinMetadata() { Label = "Is Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + public DisplayControllerJoinMap(uint joinStart) + : base(joinStart, typeof(CameraControllerJoinMap)) { - // Digital - IsOnline = 50; - PowerOff = 1; - PowerOn = 2; - IsTwoWayDisplay = 3; - VolumeUp = 5; - VolumeDown = 6; - VolumeMute = 7; - - ButtonVisibilityOffset = 40; - InputSelectOffset = 10; - - // Analog - InputSelect = 11; - VolumeLevel = 5; - - // Serial - Name = 1; - InputNamesOffset = 10; - } - - public override void OffsetJoinNumbers(uint joinStart) - { - var joinOffset = joinStart - 1; - - IsOnline = IsOnline + joinOffset; - PowerOff = PowerOff + joinOffset; - PowerOn = PowerOn + joinOffset; - IsTwoWayDisplay = IsTwoWayDisplay + joinOffset; - ButtonVisibilityOffset = ButtonVisibilityOffset + joinOffset; - Name = Name + joinOffset; - InputNamesOffset = InputNamesOffset + joinOffset; - InputSelectOffset = InputSelectOffset + joinOffset; - - InputSelect = InputSelect + joinOffset; - - VolumeUp = VolumeUp + joinOffset; - VolumeDown = VolumeDown + joinOffset; - VolumeMute = VolumeMute + joinOffset; - VolumeLevel = VolumeLevel + joinOffset; } } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs index 415eed5b..b4f4fddf 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs @@ -119,26 +119,24 @@ namespace PepperDash.Essentials.Core EiscApiAdvanced bridge) { var inputNumber = 0; - var inputKeys = new List(); - - var joinMap = new DisplayControllerJoinMap(); + var inputKeys = new List(); + + var joinMap = new DisplayControllerJoinMap(joinStart); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - joinMap.OffsetJoinNumbers(joinStart); - Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); Debug.Console(0, "Linking to Display: {0}", displayDevice.Name); - trilist.StringInput[joinMap.Name].StringValue = displayDevice.Name; + trilist.StringInput[joinMap.Name.JoinNumber].StringValue = displayDevice.Name; var commMonitor = displayDevice as ICommunicationMonitor; if (commMonitor != null) - { - commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); + { + commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]); } var inputNumberFeedback = new IntFeedback(() => inputNumber); @@ -147,17 +145,17 @@ namespace PepperDash.Essentials.Core var twoWayDisplay = displayDevice as TwoWayDisplayBase; if (twoWayDisplay != null) - { - trilist.SetBool(joinMap.IsTwoWayDisplay, true); + { + trilist.SetBool(joinMap.IsTwoWayDisplay.JoinNumber, true); - twoWayDisplay.CurrentInputFeedback.OutputChange += (o, a) => Debug.Console(0, "CurrentInputFeedback_OutputChange {0}", a.StringValue); - - - inputNumberFeedback.LinkInputSig(trilist.UShortInput[joinMap.InputSelect]); + twoWayDisplay.CurrentInputFeedback.OutputChange += (o, a) => Debug.Console(0, "CurrentInputFeedback_OutputChange {0}", a.StringValue); + + + inputNumberFeedback.LinkInputSig(trilist.UShortInput[joinMap.InputSelect.JoinNumber]); } - // Power Off - trilist.SetSigTrueAction(joinMap.PowerOff, () => + // Power Off + trilist.SetSigTrueAction(joinMap.PowerOff.JoinNumber, () => { inputNumber = 102; inputNumberFeedback.FireUpdate(); @@ -179,10 +177,10 @@ namespace PepperDash.Essentials.Core } }; - displayDevice.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.PowerOff]); + displayDevice.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.PowerOff.JoinNumber]); // PowerOn - trilist.SetSigTrueAction(joinMap.PowerOn, () => + trilist.SetSigTrueAction(joinMap.PowerOn.JoinNumber, () => { inputNumber = 0; inputNumberFeedback.FireUpdate(); @@ -190,21 +188,21 @@ namespace PepperDash.Essentials.Core }); - displayDevice.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PowerOn]); + displayDevice.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PowerOn.JoinNumber]); - var count = 1; + var count = 0; foreach (var input in displayDevice.InputPorts) { inputKeys.Add(input.Key); var tempKey = inputKeys.ElementAt(count - 1); - trilist.SetSigTrueAction((ushort)(joinMap.InputSelectOffset + count), () => displayDevice.ExecuteSwitch(displayDevice.InputPorts[tempKey].Selector)); - Debug.Console(2, displayDevice, "Setting Input Select Action on Digital Join {0} to Input: {1}", joinMap.InputSelectOffset + count, displayDevice.InputPorts[tempKey].Key.ToString()); - trilist.StringInput[(ushort)(joinMap.InputNamesOffset + count)].StringValue = input.Key.ToString(); + trilist.SetSigTrueAction((ushort)(joinMap.InputSelectOffset.JoinNumber + count), () => displayDevice.ExecuteSwitch(displayDevice.InputPorts[tempKey].Selector)); + Debug.Console(2, displayDevice, "Setting Input Select Action on Digital Join {0} to Input: {1}", joinMap.InputSelectOffset.JoinNumber + count, displayDevice.InputPorts[tempKey].Key.ToString()); + trilist.StringInput[(ushort)(joinMap.InputNamesOffset.JoinNumber + count)].StringValue = input.Key.ToString(); count++; } Debug.Console(2, displayDevice, "Setting Input Select Action on Analog Join {0}", joinMap.InputSelect); - trilist.SetUShortSigAction(joinMap.InputSelect, (a) => + trilist.SetUShortSigAction(joinMap.InputSelect.JoinNumber, (a) => { if (a == 0) { @@ -229,17 +227,22 @@ namespace PepperDash.Essentials.Core var volumeDisplay = displayDevice as IBasicVolumeControls; if (volumeDisplay == null) return; - trilist.SetBoolSigAction(joinMap.VolumeUp, volumeDisplay.VolumeUp); - trilist.SetBoolSigAction(joinMap.VolumeDown, volumeDisplay.VolumeDown); - trilist.SetSigTrueAction(joinMap.VolumeMute, volumeDisplay.MuteToggle); + trilist.SetBoolSigAction(joinMap.VolumeUp.JoinNumber, volumeDisplay.VolumeUp); + trilist.SetBoolSigAction(joinMap.VolumeDown.JoinNumber, volumeDisplay.VolumeDown); + trilist.SetSigTrueAction(joinMap.VolumeMute.JoinNumber, volumeDisplay.MuteToggle); var volumeDisplayWithFeedback = volumeDisplay as IBasicVolumeWithFeedback; - if (volumeDisplayWithFeedback == null) return; - - trilist.SetUShortSigAction(joinMap.VolumeLevel, volumeDisplayWithFeedback.SetVolume); - volumeDisplayWithFeedback.VolumeLevelFeedback.LinkInputSig(trilist.UShortInput[joinMap.VolumeLevel]); - volumeDisplayWithFeedback.MuteFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VolumeMute]); + if (volumeDisplayWithFeedback == null) return; + trilist.SetSigTrueAction(joinMap.VolumeMuteOn.JoinNumber, volumeDisplayWithFeedback.MuteOn); + trilist.SetSigTrueAction(joinMap.VolumeMuteOff.JoinNumber, volumeDisplayWithFeedback.MuteOff); + + + trilist.SetUShortSigAction(joinMap.VolumeLevel.JoinNumber, volumeDisplayWithFeedback.SetVolume); + volumeDisplayWithFeedback.VolumeLevelFeedback.LinkInputSig(trilist.UShortInput[joinMap.VolumeLevel.JoinNumber]); + volumeDisplayWithFeedback.MuteFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VolumeMute.JoinNumber]); + volumeDisplayWithFeedback.MuteFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VolumeMuteOn.JoinNumber]); + volumeDisplayWithFeedback.MuteFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.VolumeMuteOff.JoinNumber]); } } From 0b660966ac88b0e6373e808c084d7595ea633c10 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Tue, 5 May 2020 12:35:01 -0500 Subject: [PATCH 086/156] resolves #145 - Updated IBasicCommunicationJoinMap --- .../JoinMaps/IBasicCommunicationJoinMap.cs | 89 +++++++------------ .../Config/Comm and IR/GenericComm.cs | 25 +++--- 2 files changed, 44 insertions(+), 70 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/IBasicCommunicationJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/IBasicCommunicationJoinMap.cs index 3669738e..d9b361b4 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/IBasicCommunicationJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/IBasicCommunicationJoinMap.cs @@ -6,62 +6,37 @@ using Crestron.SimplSharp; using PepperDash.Essentials.Core; namespace PepperDash.Essentials.Core.Bridges -{ - public class IBasicCommunicationJoinMap : JoinMapBase - { - #region Digitals - /// - /// Set High to connect, Low to disconnect - /// - public uint Connect { get; set; } - /// - /// Reports Connected State (High = Connected) - /// - public uint Connected { get; set; } - #endregion - - #region Analogs - /// - /// Reports the connections status value - /// - public uint Status { get; set; } - #endregion - - #region Serials - /// - /// Data back from port - /// - public uint TextReceived { get; set; } - /// - /// Sends data to the port - /// - public uint SendText { get; set; } - /// - /// Takes a JSON serialized string that sets a COM port's parameters - /// - public uint SetPortConfig { get; set; } - #endregion - - public IBasicCommunicationJoinMap() - { - TextReceived = 1; - SendText = 1; - SetPortConfig = 2; - Connect = 1; - Connected = 1; - Status = 1; - } - - public override void OffsetJoinNumbers(uint joinStart) - { - var joinOffset = joinStart - 1; - - TextReceived = TextReceived + joinOffset; - SendText = SendText + joinOffset; - SetPortConfig = SetPortConfig + joinOffset; - Connect = Connect + joinOffset; - Connected = Connected + joinOffset; - Status = Status + joinOffset; - } +{ + public class IBasicCommunicationJoinMap : JoinMapBaseAdvanced + { + [JoinName("TextReceived")] + public JoinDataComplete TextReceived = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "Text Received From Remote Device", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("SendText")] + public JoinDataComplete SendText = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "Text Sent To Remote Device", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("SetPortConfig")] + public JoinDataComplete SetPortConfig = new JoinDataComplete(new JoinData() { JoinNumber = 2, JoinSpan = 1 }, + new JoinMetadata() { Label = "Set Port Config", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("Connect")] + public JoinDataComplete Connect = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "Connect", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Connected")] + public JoinDataComplete Connected = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "Connected", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Status")] + public JoinDataComplete Status = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "Status", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog }); + + + public IBasicCommunicationJoinMap(uint joinStart) + : base(joinStart, typeof(IBasicCommunicationJoinMap)) + { + } } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericComm.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericComm.cs index 41438832..b1dd55ee 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericComm.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericComm.cs @@ -59,14 +59,13 @@ namespace PepperDash.Essentials.Core } public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) - { - var joinMap = new IBasicCommunicationJoinMap(); + { + var joinMap = new IBasicCommunicationJoinMap(joinStart); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - joinMap.OffsetJoinNumbers(joinStart); if (CommPort == null) { @@ -80,22 +79,22 @@ namespace PepperDash.Essentials.Core CommPort.TextReceived += (s, a) => { Debug.Console(2, this, "RX: {0}", a.Text); - trilist.SetString(joinMap.TextReceived, a.Text); - }; - trilist.SetStringSigAction(joinMap.SendText, s => CommPort.SendText(s)); - trilist.SetStringSigAction(joinMap.SetPortConfig, SetPortConfig); + trilist.SetString(joinMap.TextReceived.JoinNumber, a.Text); + }; + trilist.SetStringSigAction(joinMap.SendText.JoinNumber, s => CommPort.SendText(s)); + trilist.SetStringSigAction(joinMap.SetPortConfig.JoinNumber, SetPortConfig); var sComm = this as ISocketStatus; if (sComm == null) return; sComm.ConnectionChange += (s, a) => - { - trilist.SetUshort(joinMap.Status, (ushort)(a.Client.ClientStatus)); - trilist.SetBool(joinMap.Connected, a.Client.ClientStatus == + { + trilist.SetUshort(joinMap.Status.JoinNumber, (ushort)(a.Client.ClientStatus)); + trilist.SetBool(joinMap.Connected.JoinNumber, a.Client.ClientStatus == SocketStatus.SOCKET_STATUS_CONNECTED); - }; - - trilist.SetBoolSigAction(joinMap.Connect, b => + }; + + trilist.SetBoolSigAction(joinMap.Connect.JoinNumber, b => { if (b) { From 64b5bc8cb8279248751eea09364975636eacd751 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Tue, 5 May 2020 15:04:55 -0500 Subject: [PATCH 087/156] Added a check to verify that the number of inputs on a display is not greater than the size of the joinspan --- .../JoinMaps/DisplayControllerJoinMap.cs | 102 ++-- .../Display/DisplayBase.cs | 529 +++++++++--------- 2 files changed, 317 insertions(+), 314 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DisplayControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DisplayControllerJoinMap.cs index c50321dc..a57c35e8 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DisplayControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DisplayControllerJoinMap.cs @@ -1,77 +1,77 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using PepperDash.Essentials.Core; - -namespace PepperDash.Essentials.Core.Bridges -{ - public class DisplayControllerJoinMap : JoinMapBaseAdvanced +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Core.Bridges +{ + public class DisplayControllerJoinMap : JoinMapBaseAdvanced { [JoinName("Name")] public JoinDataComplete Name = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, - new JoinMetadata() { Label = "Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); - + new JoinMetadata() { Label = "Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + [JoinName("PowerOff")] - public JoinDataComplete PowerOff = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, - new JoinMetadata() { Label = "Power Off", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); - + public JoinDataComplete PowerOff = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "Power Off", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + [JoinName("PowerOn")] - public JoinDataComplete PowerOn = new JoinDataComplete(new JoinData() { JoinNumber = 2, JoinSpan = 1 }, - new JoinMetadata() { Label = "Power On", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); - + public JoinDataComplete PowerOn = new JoinDataComplete(new JoinData() { JoinNumber = 2, JoinSpan = 1 }, + new JoinMetadata() { Label = "Power On", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + [JoinName("IsTwoWayDisplay")] - public JoinDataComplete IsTwoWayDisplay = new JoinDataComplete(new JoinData() { JoinNumber = 3, JoinSpan = 1 }, - new JoinMetadata() { Label = "Is Two Way Display", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); - + public JoinDataComplete IsTwoWayDisplay = new JoinDataComplete(new JoinData() { JoinNumber = 3, JoinSpan = 1 }, + new JoinMetadata() { Label = "Is Two Way Display", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + [JoinName("VolumeUp")] - public JoinDataComplete VolumeUp = new JoinDataComplete(new JoinData() { JoinNumber = 5, JoinSpan = 1 }, + public JoinDataComplete VolumeUp = new JoinDataComplete(new JoinData() { JoinNumber = 5, JoinSpan = 1 }, new JoinMetadata() { Label = "Volume Up", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); [JoinName("VolumeLevel")] public JoinDataComplete VolumeLevel = new JoinDataComplete(new JoinData() { JoinNumber = 5, JoinSpan = 1 }, - new JoinMetadata() { Label = "Volume Level", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog }); - + new JoinMetadata() { Label = "Volume Level", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog }); + [JoinName("VolumeDown")] - public JoinDataComplete VolumeDown = new JoinDataComplete(new JoinData() { JoinNumber = 6, JoinSpan = 1 }, - new JoinMetadata() { Label = "Volume Down", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); - + public JoinDataComplete VolumeDown = new JoinDataComplete(new JoinData() { JoinNumber = 6, JoinSpan = 1 }, + new JoinMetadata() { Label = "Volume Down", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + [JoinName("VolumeMute")] - public JoinDataComplete VolumeMute = new JoinDataComplete(new JoinData() { JoinNumber = 7, JoinSpan = 1 }, - new JoinMetadata() { Label = "Volume Mute", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); - + public JoinDataComplete VolumeMute = new JoinDataComplete(new JoinData() { JoinNumber = 7, JoinSpan = 1 }, + new JoinMetadata() { Label = "Volume Mute", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + [JoinName("VolumeMuteOn")] - public JoinDataComplete VolumeMuteOn = new JoinDataComplete(new JoinData() { JoinNumber = 8, JoinSpan = 1 }, - new JoinMetadata() { Label = "Volume Mute On", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); - + public JoinDataComplete VolumeMuteOn = new JoinDataComplete(new JoinData() { JoinNumber = 8, JoinSpan = 1 }, + new JoinMetadata() { Label = "Volume Mute On", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + [JoinName("VolumeMuteOff")] - public JoinDataComplete VolumeMuteOff = new JoinDataComplete(new JoinData() { JoinNumber = 9, JoinSpan = 1 }, - new JoinMetadata() { Label = "Volume Mute Off", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); - + public JoinDataComplete VolumeMuteOff = new JoinDataComplete(new JoinData() { JoinNumber = 9, JoinSpan = 1 }, + new JoinMetadata() { Label = "Volume Mute Off", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + [JoinName("InputSelectOffset")] - public JoinDataComplete InputSelectOffset = new JoinDataComplete(new JoinData() { JoinNumber = 11, JoinSpan = 10 }, - new JoinMetadata() { Label = "Input Select", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); - + public JoinDataComplete InputSelectOffset = new JoinDataComplete(new JoinData() { JoinNumber = 11, JoinSpan = 10 }, + new JoinMetadata() { Label = "Input Select", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + [JoinName("InputNamesOffset")] - public JoinDataComplete InputNamesOffset = new JoinDataComplete(new JoinData() { JoinNumber = 11, JoinSpan = 10 }, + public JoinDataComplete InputNamesOffset = new JoinDataComplete(new JoinData() { JoinNumber = 11, JoinSpan = 10 }, new JoinMetadata() { Label = "Input Names Offset", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); [JoinName("InputSelect")] public JoinDataComplete InputSelect = new JoinDataComplete(new JoinData() { JoinNumber = 11, JoinSpan = 1 }, - new JoinMetadata() { Label = "Input Select", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog }); - + new JoinMetadata() { Label = "Input Select", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog }); + [JoinName("ButtonVisibilityOffset")] - public JoinDataComplete ButtonVisibilityOffset = new JoinDataComplete(new JoinData() { JoinNumber = 41, JoinSpan = 10 }, - new JoinMetadata() { Label = "Button Visibility Offset", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.DigitalSerial }); - + public JoinDataComplete ButtonVisibilityOffset = new JoinDataComplete(new JoinData() { JoinNumber = 41, JoinSpan = 10 }, + new JoinMetadata() { Label = "Button Visibility Offset", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.DigitalSerial }); + [JoinName("IsOnline")] - public JoinDataComplete IsOnline = new JoinDataComplete(new JoinData() { JoinNumber = 50, JoinSpan = 1 }, + public JoinDataComplete IsOnline = new JoinDataComplete(new JoinData() { JoinNumber = 50, JoinSpan = 1 }, new JoinMetadata() { Label = "Is Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); - public DisplayControllerJoinMap(uint joinStart) - : base(joinStart, typeof(CameraControllerJoinMap)) - { - } - } + public DisplayControllerJoinMap(uint joinStart) + : base(joinStart, typeof(CameraControllerJoinMap)) + { + } + } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs index b4f4fddf..dd008b08 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs @@ -1,238 +1,241 @@ -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.Endpoints; -using Crestron.SimplSharpPro.DM.Endpoints.Transmitters; -using Newtonsoft.Json; -using PepperDash.Core; -using PepperDash.Essentials.Core.Bridges; - - -namespace PepperDash.Essentials.Core -{ - /// - /// - /// - public abstract class DisplayBase : EssentialsBridgeableDevice, IHasFeedback, IRoutingSinkWithSwitching, IPower, IWarmingCooling, IUsageTracking - { - public event SourceInfoChangeHandler CurrentSourceChange; - - public string CurrentSourceInfoKey { get; set; } - public SourceListItem CurrentSourceInfo - { - get - { - return _CurrentSourceInfo; - } - set - { - if (value == _CurrentSourceInfo) return; - - var handler = CurrentSourceChange; - - if (handler != null) - handler(_CurrentSourceInfo, ChangeType.WillChange); - - _CurrentSourceInfo = value; - - if (handler != null) - handler(_CurrentSourceInfo, ChangeType.DidChange); - } - } - SourceListItem _CurrentSourceInfo; - - public BoolFeedback PowerIsOnFeedback { get; protected set; } - public BoolFeedback IsCoolingDownFeedback { get; protected set; } - public BoolFeedback IsWarmingUpFeedback { get; private set; } - - public UsageTracking UsageTracker { get; set; } - - public uint WarmupTime { get; set; } - public uint CooldownTime { get; set; } - - /// - /// Bool Func that will provide a value for the PowerIsOn Output. Must be implemented - /// by concrete sub-classes - /// - abstract protected Func PowerIsOnFeedbackFunc { get; } - abstract protected Func IsCoolingDownFeedbackFunc { get; } - abstract protected Func IsWarmingUpFeedbackFunc { get; } - - - protected CTimer WarmupTimer; - protected CTimer CooldownTimer; - - #region IRoutingInputs Members - - public RoutingPortCollection InputPorts { get; private set; } - - #endregion - - protected DisplayBase(string key, string name) - : base(key, name) - { - PowerIsOnFeedback = new BoolFeedback("PowerOnFeedback", PowerIsOnFeedbackFunc); - IsCoolingDownFeedback = new BoolFeedback("IsCoolingDown", IsCoolingDownFeedbackFunc); - IsWarmingUpFeedback = new BoolFeedback("IsWarmingUp", IsWarmingUpFeedbackFunc); - - InputPorts = new RoutingPortCollection(); - - PowerIsOnFeedback.OutputChange += PowerIsOnFeedback_OutputChange; - } - - void PowerIsOnFeedback_OutputChange(object sender, EventArgs e) - { - if (UsageTracker != null) - { - if (PowerIsOnFeedback.BoolValue) - UsageTracker.StartDeviceUsage(); - else - UsageTracker.EndDeviceUsage(); - } - } - - public abstract void PowerOn(); - public abstract void PowerOff(); - public abstract void PowerToggle(); - - public virtual FeedbackCollection Feedbacks - { - get - { - return new FeedbackCollection - { - PowerIsOnFeedback, - IsCoolingDownFeedback, - IsWarmingUpFeedback - }; - } - } - - public abstract void ExecuteSwitch(object selector); - - protected void LinkDisplayToApi(DisplayBase displayDevice, BasicTriList trilist, uint joinStart, string joinMapKey, - EiscApiAdvanced bridge) - { - var inputNumber = 0; +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.Endpoints; +using Crestron.SimplSharpPro.DM.Endpoints.Transmitters; +using Newtonsoft.Json; +using PepperDash.Core; +using PepperDash.Essentials.Core.Bridges; + + +namespace PepperDash.Essentials.Core +{ + /// + /// + /// + public abstract class DisplayBase : EssentialsBridgeableDevice, IHasFeedback, IRoutingSinkWithSwitching, IPower, IWarmingCooling, IUsageTracking + { + public event SourceInfoChangeHandler CurrentSourceChange; + + public string CurrentSourceInfoKey { get; set; } + public SourceListItem CurrentSourceInfo + { + get + { + return _CurrentSourceInfo; + } + set + { + if (value == _CurrentSourceInfo) return; + + var handler = CurrentSourceChange; + + if (handler != null) + handler(_CurrentSourceInfo, ChangeType.WillChange); + + _CurrentSourceInfo = value; + + if (handler != null) + handler(_CurrentSourceInfo, ChangeType.DidChange); + } + } + SourceListItem _CurrentSourceInfo; + + public BoolFeedback PowerIsOnFeedback { get; protected set; } + public BoolFeedback IsCoolingDownFeedback { get; protected set; } + public BoolFeedback IsWarmingUpFeedback { get; private set; } + + public UsageTracking UsageTracker { get; set; } + + public uint WarmupTime { get; set; } + public uint CooldownTime { get; set; } + + /// + /// Bool Func that will provide a value for the PowerIsOn Output. Must be implemented + /// by concrete sub-classes + /// + abstract protected Func PowerIsOnFeedbackFunc { get; } + abstract protected Func IsCoolingDownFeedbackFunc { get; } + abstract protected Func IsWarmingUpFeedbackFunc { get; } + + + protected CTimer WarmupTimer; + protected CTimer CooldownTimer; + + #region IRoutingInputs Members + + public RoutingPortCollection InputPorts { get; private set; } + + #endregion + + protected DisplayBase(string key, string name) + : base(key, name) + { + PowerIsOnFeedback = new BoolFeedback("PowerOnFeedback", PowerIsOnFeedbackFunc); + IsCoolingDownFeedback = new BoolFeedback("IsCoolingDown", IsCoolingDownFeedbackFunc); + IsWarmingUpFeedback = new BoolFeedback("IsWarmingUp", IsWarmingUpFeedbackFunc); + + InputPorts = new RoutingPortCollection(); + + PowerIsOnFeedback.OutputChange += PowerIsOnFeedback_OutputChange; + } + + void PowerIsOnFeedback_OutputChange(object sender, EventArgs e) + { + if (UsageTracker != null) + { + if (PowerIsOnFeedback.BoolValue) + UsageTracker.StartDeviceUsage(); + else + UsageTracker.EndDeviceUsage(); + } + } + + public abstract void PowerOn(); + public abstract void PowerOff(); + public abstract void PowerToggle(); + + public virtual FeedbackCollection Feedbacks + { + get + { + return new FeedbackCollection + { + PowerIsOnFeedback, + IsCoolingDownFeedback, + IsWarmingUpFeedback + }; + } + } + + public abstract void ExecuteSwitch(object selector); + + protected void LinkDisplayToApi(DisplayBase displayDevice, BasicTriList trilist, uint joinStart, string joinMapKey, + EiscApiAdvanced bridge) + { + var inputNumber = 0; var inputKeys = new List(); - var joinMap = new DisplayControllerJoinMap(joinStart); - - var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); - - if (!string.IsNullOrEmpty(joinMapSerialized)) - joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - - Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); - Debug.Console(0, "Linking to Display: {0}", displayDevice.Name); - - trilist.StringInput[joinMap.Name.JoinNumber].StringValue = displayDevice.Name; - - var commMonitor = displayDevice as ICommunicationMonitor; - if (commMonitor != null) + var joinMap = new DisplayControllerJoinMap(joinStart); + + var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); + + if (!string.IsNullOrEmpty(joinMapSerialized)) + joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + + Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); + Debug.Console(0, "Linking to Display: {0}", displayDevice.Name); + + trilist.StringInput[joinMap.Name.JoinNumber].StringValue = displayDevice.Name; + + var commMonitor = displayDevice as ICommunicationMonitor; + if (commMonitor != null) { - commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]); - } - - var inputNumberFeedback = new IntFeedback(() => inputNumber); - - // Two way feedbacks - var twoWayDisplay = displayDevice as TwoWayDisplayBase; - - if (twoWayDisplay != null) + commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]); + } + + var inputNumberFeedback = new IntFeedback(() => inputNumber); + + // Two way feedbacks + var twoWayDisplay = displayDevice as TwoWayDisplayBase; + + if (twoWayDisplay != null) { - trilist.SetBool(joinMap.IsTwoWayDisplay.JoinNumber, true); - + trilist.SetBool(joinMap.IsTwoWayDisplay.JoinNumber, true); + twoWayDisplay.CurrentInputFeedback.OutputChange += (o, a) => Debug.Console(0, "CurrentInputFeedback_OutputChange {0}", a.StringValue); - inputNumberFeedback.LinkInputSig(trilist.UShortInput[joinMap.InputSelect.JoinNumber]); - } - + inputNumberFeedback.LinkInputSig(trilist.UShortInput[joinMap.InputSelect.JoinNumber]); + } + // Power Off - trilist.SetSigTrueAction(joinMap.PowerOff.JoinNumber, () => - { - inputNumber = 102; - inputNumberFeedback.FireUpdate(); - displayDevice.PowerOff(); - }); - - displayDevice.PowerIsOnFeedback.OutputChange += (o, a) => - { - if (!a.BoolValue) - { - inputNumber = 102; - inputNumberFeedback.FireUpdate(); - - } - else - { - inputNumber = 0; - inputNumberFeedback.FireUpdate(); - } - }; - - displayDevice.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.PowerOff.JoinNumber]); - - // PowerOn - trilist.SetSigTrueAction(joinMap.PowerOn.JoinNumber, () => - { - inputNumber = 0; - inputNumberFeedback.FireUpdate(); - displayDevice.PowerOn(); - }); - - - displayDevice.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PowerOn.JoinNumber]); - - var count = 0; - foreach (var input in displayDevice.InputPorts) - { - inputKeys.Add(input.Key); - var tempKey = inputKeys.ElementAt(count - 1); - trilist.SetSigTrueAction((ushort)(joinMap.InputSelectOffset.JoinNumber + count), () => displayDevice.ExecuteSwitch(displayDevice.InputPorts[tempKey].Selector)); - Debug.Console(2, displayDevice, "Setting Input Select Action on Digital Join {0} to Input: {1}", joinMap.InputSelectOffset.JoinNumber + count, displayDevice.InputPorts[tempKey].Key.ToString()); - trilist.StringInput[(ushort)(joinMap.InputNamesOffset.JoinNumber + count)].StringValue = input.Key.ToString(); - count++; - } - - Debug.Console(2, displayDevice, "Setting Input Select Action on Analog Join {0}", joinMap.InputSelect); - trilist.SetUShortSigAction(joinMap.InputSelect.JoinNumber, (a) => - { - if (a == 0) - { - displayDevice.PowerOff(); - inputNumber = 0; - } - else if (a > 0 && a < displayDevice.InputPorts.Count && a != inputNumber) - { - displayDevice.ExecuteSwitch(displayDevice.InputPorts.ElementAt(a - 1).Selector); - inputNumber = a; - } - else if (a == 102) - { - displayDevice.PowerToggle(); - - } - if (twoWayDisplay != null) - inputNumberFeedback.FireUpdate(); - }); - - - var volumeDisplay = displayDevice as IBasicVolumeControls; - if (volumeDisplay == null) return; - + trilist.SetSigTrueAction(joinMap.PowerOff.JoinNumber, () => + { + inputNumber = 102; + inputNumberFeedback.FireUpdate(); + displayDevice.PowerOff(); + }); + + displayDevice.PowerIsOnFeedback.OutputChange += (o, a) => + { + if (!a.BoolValue) + { + inputNumber = 102; + inputNumberFeedback.FireUpdate(); + + } + else + { + inputNumber = 0; + inputNumberFeedback.FireUpdate(); + } + }; + + displayDevice.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.PowerOff.JoinNumber]); + + // PowerOn + trilist.SetSigTrueAction(joinMap.PowerOn.JoinNumber, () => + { + inputNumber = 0; + inputNumberFeedback.FireUpdate(); + displayDevice.PowerOn(); + }); + + + displayDevice.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PowerOn.JoinNumber]); + + var count = 0; + foreach (var input in displayDevice.InputPorts) + { + if (count < joinMap.InputSelectOffset.JoinSpan) + { + inputKeys.Add(input.Key); + var tempKey = inputKeys.ElementAt(count - 1); + trilist.SetSigTrueAction((ushort)(joinMap.InputSelectOffset.JoinNumber + count), () => displayDevice.ExecuteSwitch(displayDevice.InputPorts[tempKey].Selector)); + Debug.Console(2, displayDevice, "Setting Input Select Action on Digital Join {0} to Input: {1}", joinMap.InputSelectOffset.JoinNumber + count, displayDevice.InputPorts[tempKey].Key.ToString()); + trilist.StringInput[(ushort)(joinMap.InputNamesOffset.JoinNumber + count)].StringValue = input.Key.ToString(); + count++; + } + } + + Debug.Console(2, displayDevice, "Setting Input Select Action on Analog Join {0}", joinMap.InputSelect); + trilist.SetUShortSigAction(joinMap.InputSelect.JoinNumber, (a) => + { + if (a == 0) + { + displayDevice.PowerOff(); + inputNumber = 0; + } + else if (a > 0 && a < displayDevice.InputPorts.Count && a != inputNumber) + { + displayDevice.ExecuteSwitch(displayDevice.InputPorts.ElementAt(a - 1).Selector); + inputNumber = a; + } + else if (a == 102) + { + displayDevice.PowerToggle(); + + } + if (twoWayDisplay != null) + inputNumberFeedback.FireUpdate(); + }); + + + var volumeDisplay = displayDevice as IBasicVolumeControls; + if (volumeDisplay == null) return; + trilist.SetBoolSigAction(joinMap.VolumeUp.JoinNumber, volumeDisplay.VolumeUp); trilist.SetBoolSigAction(joinMap.VolumeDown.JoinNumber, volumeDisplay.VolumeDown); trilist.SetSigTrueAction(joinMap.VolumeMute.JoinNumber, volumeDisplay.MuteToggle); - - var volumeDisplayWithFeedback = volumeDisplay as IBasicVolumeWithFeedback; - + + var volumeDisplayWithFeedback = volumeDisplay as IBasicVolumeWithFeedback; + if (volumeDisplayWithFeedback == null) return; trilist.SetSigTrueAction(joinMap.VolumeMuteOn.JoinNumber, volumeDisplayWithFeedback.MuteOn); trilist.SetSigTrueAction(joinMap.VolumeMuteOff.JoinNumber, volumeDisplayWithFeedback.MuteOff); @@ -242,43 +245,43 @@ namespace PepperDash.Essentials.Core volumeDisplayWithFeedback.VolumeLevelFeedback.LinkInputSig(trilist.UShortInput[joinMap.VolumeLevel.JoinNumber]); volumeDisplayWithFeedback.MuteFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VolumeMute.JoinNumber]); volumeDisplayWithFeedback.MuteFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VolumeMuteOn.JoinNumber]); - volumeDisplayWithFeedback.MuteFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.VolumeMuteOff.JoinNumber]); - } - } - - /// - /// - /// - public abstract class TwoWayDisplayBase : DisplayBase - { - public StringFeedback CurrentInputFeedback { get; private set; } - - abstract protected Func CurrentInputFeedbackFunc { get; } - - - public static MockDisplay DefaultDisplay - { - get - { - if (_DefaultDisplay == null) - _DefaultDisplay = new MockDisplay("default", "Default Display"); - return _DefaultDisplay; - } - } - static MockDisplay _DefaultDisplay; - - public TwoWayDisplayBase(string key, string name) - : base(key, name) - { - CurrentInputFeedback = new StringFeedback(CurrentInputFeedbackFunc); - - WarmupTime = 7000; - CooldownTime = 15000; - - Feedbacks.Add(CurrentInputFeedback); - - - } - - } + volumeDisplayWithFeedback.MuteFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.VolumeMuteOff.JoinNumber]); + } + } + + /// + /// + /// + public abstract class TwoWayDisplayBase : DisplayBase + { + public StringFeedback CurrentInputFeedback { get; private set; } + + abstract protected Func CurrentInputFeedbackFunc { get; } + + + public static MockDisplay DefaultDisplay + { + get + { + if (_DefaultDisplay == null) + _DefaultDisplay = new MockDisplay("default", "Default Display"); + return _DefaultDisplay; + } + } + static MockDisplay _DefaultDisplay; + + public TwoWayDisplayBase(string key, string name) + : base(key, name) + { + CurrentInputFeedback = new StringFeedback(CurrentInputFeedbackFunc); + + WarmupTime = 7000; + CooldownTime = 15000; + + Feedbacks.Add(CurrentInputFeedback); + + + } + + } } \ No newline at end of file From 250f62d79cfc742b41346b2849fe87b5e5758285 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Tue, 5 May 2020 15:14:53 -0500 Subject: [PATCH 088/156] Changed displayDevice.InputPorts API Linking to for loop --- .../Display/DisplayBase.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs index dd008b08..03068a15 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs @@ -190,17 +190,17 @@ namespace PepperDash.Essentials.Core displayDevice.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PowerOn.JoinNumber]); - var count = 0; - foreach (var input in displayDevice.InputPorts) + for (int i = 0; i < displayDevice.InputPorts.Count; i++) { - if (count < joinMap.InputSelectOffset.JoinSpan) + if (i < joinMap.InputNamesOffset.JoinSpan) { - inputKeys.Add(input.Key); - var tempKey = inputKeys.ElementAt(count - 1); - trilist.SetSigTrueAction((ushort)(joinMap.InputSelectOffset.JoinNumber + count), () => displayDevice.ExecuteSwitch(displayDevice.InputPorts[tempKey].Selector)); - Debug.Console(2, displayDevice, "Setting Input Select Action on Digital Join {0} to Input: {1}", joinMap.InputSelectOffset.JoinNumber + count, displayDevice.InputPorts[tempKey].Key.ToString()); - trilist.StringInput[(ushort)(joinMap.InputNamesOffset.JoinNumber + count)].StringValue = input.Key.ToString(); - count++; + inputKeys.Add(displayDevice.InputPorts[i].Key); + var tempKey = inputKeys.ElementAt(i); + trilist.SetSigTrueAction((ushort)(joinMap.InputSelectOffset.JoinNumber + i), + () => displayDevice.ExecuteSwitch(displayDevice.InputPorts[tempKey].Selector)); + Debug.Console(2, displayDevice, "Setting Input Select Action on Digital Join {0} to Input: {1}", + joinMap.InputSelectOffset.JoinNumber + i, displayDevice.InputPorts[tempKey].Key.ToString()); + trilist.StringInput[(ushort)(joinMap.InputNamesOffset.JoinNumber + i)].StringValue = displayDevice.InputPorts[i].Key.ToString(); } } From b3821e90d13a38967ea16ebe03e69f362470b15a Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Tue, 5 May 2020 16:49:50 -0500 Subject: [PATCH 089/156] Added debug statement if there are more inputs than allowed bu the joinspan. --- .../JoinMaps/IBasicCommunicationJoinMap.cs | 18 +- .../Config/Comm and IR/GenericComm.cs | 232 +++++++++--------- .../Display/DisplayBase.cs | 5 +- 3 files changed, 129 insertions(+), 126 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/IBasicCommunicationJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/IBasicCommunicationJoinMap.cs index d9b361b4..612ace4f 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/IBasicCommunicationJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/IBasicCommunicationJoinMap.cs @@ -1,11 +1,11 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using PepperDash.Essentials.Core; - -namespace PepperDash.Essentials.Core.Bridges +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Core.Bridges { public class IBasicCommunicationJoinMap : JoinMapBaseAdvanced { @@ -38,5 +38,5 @@ namespace PepperDash.Essentials.Core.Bridges : base(joinStart, typeof(IBasicCommunicationJoinMap)) { } - } + } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericComm.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericComm.cs index b1dd55ee..523ffb78 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericComm.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericComm.cs @@ -1,124 +1,124 @@ -using System; -using System.Collections.Generic; -using Crestron.SimplSharp.CrestronSockets; -using Crestron.SimplSharpPro.DeviceSupport; -using Newtonsoft.Json; - -using PepperDash.Core; -using PepperDash.Essentials.Core.Bridges; -using PepperDash.Essentials.Core.Devices; -using PepperDash.Essentials.Core.Config; - - -namespace PepperDash.Essentials.Core -{ - /// - /// Serves as a generic wrapper class for all styles of IBasicCommuncation ports - /// - [Description("Generic communication wrapper class for any IBasicCommunication type")] - public class GenericComm : ReconfigurableBridgableDevice - { - EssentialsControlPropertiesConfig PropertiesConfig; - - public IBasicCommunication CommPort { get; private set; } - - public GenericComm(DeviceConfig config) - : base(config) - { - PropertiesConfig = CommFactory.GetControlPropertiesConfig(config); - - CommPort = CommFactory.CreateCommForDevice(config); - - } - - public static IKeyed BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "Factory Attempting to create new Generic Comm Device"); - return new GenericComm(dc); - } - - public void SetPortConfig(string portConfig) - { - // TODO: Deserialize new EssentialsControlPropertiesConfig and handle as necessary - try - { - PropertiesConfig = JsonConvert.DeserializeObject - (portConfig); - } - catch (Exception e) - { - Debug.Console(2, this, "Error deserializing port config: {0}", e); - } - } - - protected override void CustomSetConfig(DeviceConfig config) - { - PropertiesConfig = CommFactory.GetControlPropertiesConfig(config); - - ConfigWriter.UpdateDeviceConfig(config); - } - - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) +using System; +using System.Collections.Generic; +using Crestron.SimplSharp.CrestronSockets; +using Crestron.SimplSharpPro.DeviceSupport; +using Newtonsoft.Json; + +using PepperDash.Core; +using PepperDash.Essentials.Core.Bridges; +using PepperDash.Essentials.Core.Devices; +using PepperDash.Essentials.Core.Config; + + +namespace PepperDash.Essentials.Core +{ + /// + /// Serves as a generic wrapper class for all styles of IBasicCommuncation ports + /// + [Description("Generic communication wrapper class for any IBasicCommunication type")] + public class GenericComm : ReconfigurableBridgableDevice + { + EssentialsControlPropertiesConfig PropertiesConfig; + + public IBasicCommunication CommPort { get; private set; } + + public GenericComm(DeviceConfig config) + : base(config) { - var joinMap = new IBasicCommunicationJoinMap(joinStart); - - var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); - - if (!string.IsNullOrEmpty(joinMapSerialized)) - joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - - if (CommPort == null) - { - Debug.Console(1, this, "Unable to link device '{0}'. CommPort is null", Key); - return; - } - - Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); - - // this is a permanent event handler. This cannot be -= from event - CommPort.TextReceived += (s, a) => - { - Debug.Console(2, this, "RX: {0}", a.Text); - trilist.SetString(joinMap.TextReceived.JoinNumber, a.Text); + PropertiesConfig = CommFactory.GetControlPropertiesConfig(config); + + CommPort = CommFactory.CreateCommForDevice(config); + + } + + public static IKeyed BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new Generic Comm Device"); + return new GenericComm(dc); + } + + public void SetPortConfig(string portConfig) + { + // TODO: Deserialize new EssentialsControlPropertiesConfig and handle as necessary + try + { + PropertiesConfig = JsonConvert.DeserializeObject + (portConfig); + } + catch (Exception e) + { + Debug.Console(2, this, "Error deserializing port config: {0}", e); + } + } + + protected override void CustomSetConfig(DeviceConfig config) + { + PropertiesConfig = CommFactory.GetControlPropertiesConfig(config); + + ConfigWriter.UpdateDeviceConfig(config); + } + + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) + { + var joinMap = new IBasicCommunicationJoinMap(joinStart); + + var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); + + if (!string.IsNullOrEmpty(joinMapSerialized)) + joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + + if (CommPort == null) + { + Debug.Console(1, this, "Unable to link device '{0}'. CommPort is null", Key); + return; + } + + Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); + + // this is a permanent event handler. This cannot be -= from event + CommPort.TextReceived += (s, a) => + { + Debug.Console(2, this, "RX: {0}", a.Text); + trilist.SetString(joinMap.TextReceived.JoinNumber, a.Text); }; trilist.SetStringSigAction(joinMap.SendText.JoinNumber, s => CommPort.SendText(s)); - trilist.SetStringSigAction(joinMap.SetPortConfig.JoinNumber, SetPortConfig); - - - var sComm = this as ISocketStatus; - if (sComm == null) return; - sComm.ConnectionChange += (s, a) => + trilist.SetStringSigAction(joinMap.SetPortConfig.JoinNumber, SetPortConfig); + + + var sComm = this as ISocketStatus; + if (sComm == null) return; + sComm.ConnectionChange += (s, a) => { trilist.SetUshort(joinMap.Status.JoinNumber, (ushort)(a.Client.ClientStatus)); - trilist.SetBool(joinMap.Connected.JoinNumber, a.Client.ClientStatus == - SocketStatus.SOCKET_STATUS_CONNECTED); + trilist.SetBool(joinMap.Connected.JoinNumber, a.Client.ClientStatus == + SocketStatus.SOCKET_STATUS_CONNECTED); }; - trilist.SetBoolSigAction(joinMap.Connect.JoinNumber, b => - { - if (b) - { - sComm.Connect(); - } - else - { - sComm.Disconnect(); - } - }); - } - } - - public class GenericCommFactory : EssentialsDeviceFactory - { - public GenericCommFactory() - { - TypeNames = new List() { "genericComm" }; - } - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "Factory Attempting to create new Generic Comm Device"); - return new GenericComm(dc); - } - } + trilist.SetBoolSigAction(joinMap.Connect.JoinNumber, b => + { + if (b) + { + sComm.Connect(); + } + else + { + sComm.Disconnect(); + } + }); + } + } + + public class GenericCommFactory : EssentialsDeviceFactory + { + public GenericCommFactory() + { + TypeNames = new List() { "genericComm" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new Generic Comm Device"); + return new GenericComm(dc); + } + } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs index 03068a15..9d3bed17 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs @@ -198,10 +198,13 @@ namespace PepperDash.Essentials.Core var tempKey = inputKeys.ElementAt(i); trilist.SetSigTrueAction((ushort)(joinMap.InputSelectOffset.JoinNumber + i), () => displayDevice.ExecuteSwitch(displayDevice.InputPorts[tempKey].Selector)); - Debug.Console(2, displayDevice, "Setting Input Select Action on Digital Join {0} to Input: {1}", + Debug.Console(2, displayDevice, "Setting Input Select Action on Digital Join {0} to Input: {1}", joinMap.InputSelectOffset.JoinNumber + i, displayDevice.InputPorts[tempKey].Key.ToString()); trilist.StringInput[(ushort)(joinMap.InputNamesOffset.JoinNumber + i)].StringValue = displayDevice.InputPorts[i].Key.ToString(); } + else + Debug.Console(2, displayDevice, "Device has {0} inputs. The Join Map allows up to {1} inputs. Discarding inputs {2} - {3} from bridge.", + displayDevice.InputPorts.Count, joinMap.InputNamesOffset.JoinSpan, i + 1, displayDevice.InputPorts.Count); } Debug.Console(2, displayDevice, "Setting Input Select Action on Analog Join {0}", joinMap.InputSelect); From e90436081a6d3f9b81305a3a602c0b177647f9c9 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Tue, 5 May 2020 17:32:31 -0500 Subject: [PATCH 090/156] Fixes to Logging related to DisplayBase input joinmap --- .../PepperDashEssentialsBase/Display/DisplayBase.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs index 9d3bed17..c8d46377 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs @@ -203,7 +203,7 @@ namespace PepperDash.Essentials.Core trilist.StringInput[(ushort)(joinMap.InputNamesOffset.JoinNumber + i)].StringValue = displayDevice.InputPorts[i].Key.ToString(); } else - Debug.Console(2, displayDevice, "Device has {0} inputs. The Join Map allows up to {1} inputs. Discarding inputs {2} - {3} from bridge.", + Debug.Console(0, displayDevice, Debug.ErrorLogLevel.Warning, "Device has {0} inputs. The Join Map allows up to {1} inputs. Discarding inputs {2} - {3} from bridge.", displayDevice.InputPorts.Count, joinMap.InputNamesOffset.JoinSpan, i + 1, displayDevice.InputPorts.Count); } From 4cd01aa4280b991961ac4019e5a58783a879f1aa Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Wed, 6 May 2020 12:30:13 -0600 Subject: [PATCH 091/156] Revert "Merge branch 'development' into release/v1.5.0" This reverts commit 98c8a42d97d7b05f796961054a1fc0a52c673ebf, reversing changes made to dc760caf7174423c6b90c2c4ba0b956c02cba72b. --- .../JoinMaps/DmRmcControllerJoinMap.cs | 14 +- .../JoinMaps/DisplayControllerJoinMap.cs | 192 +++--- .../JoinMaps/DmRmcControllerJoinMap.cs | 60 +- .../JoinMaps/IBasicCommunicationJoinMap.cs | 107 +-- .../Config/Comm and IR/GenericComm.cs | 247 +++---- .../Display/DisplayBase.cs | 63 +- .../Routing/RoutingInterfaces.cs | 9 - .../Receivers/DmRmc4kZ100CController.cs | 79 --- .../Receivers/DmRmc4kZScalerCController.cs | 151 ----- .../Endpoints/Receivers/DmRmcHelper.cs | 631 +++++++++--------- .../Receivers/DmRmcX100CController.cs | 6 +- .../PepperDash_Essentials_DM.csproj | 2 - 12 files changed, 671 insertions(+), 890 deletions(-) delete mode 100644 essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZ100CController.cs delete mode 100644 essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZScalerCController.cs diff --git a/PepperDashEssentials/Bridges/JoinMaps/DmRmcControllerJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/DmRmcControllerJoinMap.cs index 3d7cec8d..7e1534bf 100644 --- a/PepperDashEssentials/Bridges/JoinMaps/DmRmcControllerJoinMap.cs +++ b/PepperDashEssentials/Bridges/JoinMaps/DmRmcControllerJoinMap.cs @@ -38,12 +38,8 @@ namespace PepperDash.Essentials.Bridges /// Reports the EDID serial number value /// public uint EdidSerialNumber { get; set; } - #endregion - - #region Analogs - public uint AudioVideoSource { get; set; } - #endregion - + #endregion + public DmRmcControllerJoinMap() { // Digital @@ -55,9 +51,6 @@ namespace PepperDash.Essentials.Bridges EdidName = 3; EdidPrefferedTiming = 4; EdidSerialNumber = 5; - - //Analog - AudioVideoSource = 1; } public override void OffsetJoinNumbers(uint joinStart) @@ -69,8 +62,7 @@ namespace PepperDash.Essentials.Bridges EdidManufacturer = EdidManufacturer + joinOffset; EdidName = EdidName + joinOffset; EdidPrefferedTiming = EdidPrefferedTiming + joinOffset; - EdidSerialNumber = EdidSerialNumber + joinOffset; - AudioVideoSource = AudioVideoSource + joinOffset; + EdidSerialNumber = EdidSerialNumber + joinOffset; } } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DisplayControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DisplayControllerJoinMap.cs index a57c35e8..c2fe8573 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DisplayControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DisplayControllerJoinMap.cs @@ -1,77 +1,117 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using PepperDash.Essentials.Core; - -namespace PepperDash.Essentials.Core.Bridges -{ - public class DisplayControllerJoinMap : JoinMapBaseAdvanced - { - [JoinName("Name")] - public JoinDataComplete Name = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, - new JoinMetadata() { Label = "Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); - - [JoinName("PowerOff")] - public JoinDataComplete PowerOff = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, - new JoinMetadata() { Label = "Power Off", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); - - [JoinName("PowerOn")] - public JoinDataComplete PowerOn = new JoinDataComplete(new JoinData() { JoinNumber = 2, JoinSpan = 1 }, - new JoinMetadata() { Label = "Power On", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); - - [JoinName("IsTwoWayDisplay")] - public JoinDataComplete IsTwoWayDisplay = new JoinDataComplete(new JoinData() { JoinNumber = 3, JoinSpan = 1 }, - new JoinMetadata() { Label = "Is Two Way Display", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); - - [JoinName("VolumeUp")] - public JoinDataComplete VolumeUp = new JoinDataComplete(new JoinData() { JoinNumber = 5, JoinSpan = 1 }, - new JoinMetadata() { Label = "Volume Up", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); - - [JoinName("VolumeLevel")] - public JoinDataComplete VolumeLevel = new JoinDataComplete(new JoinData() { JoinNumber = 5, JoinSpan = 1 }, - new JoinMetadata() { Label = "Volume Level", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog }); - - [JoinName("VolumeDown")] - public JoinDataComplete VolumeDown = new JoinDataComplete(new JoinData() { JoinNumber = 6, JoinSpan = 1 }, - new JoinMetadata() { Label = "Volume Down", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); - - [JoinName("VolumeMute")] - public JoinDataComplete VolumeMute = new JoinDataComplete(new JoinData() { JoinNumber = 7, JoinSpan = 1 }, - new JoinMetadata() { Label = "Volume Mute", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); - - [JoinName("VolumeMuteOn")] - public JoinDataComplete VolumeMuteOn = new JoinDataComplete(new JoinData() { JoinNumber = 8, JoinSpan = 1 }, - new JoinMetadata() { Label = "Volume Mute On", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); - - [JoinName("VolumeMuteOff")] - public JoinDataComplete VolumeMuteOff = new JoinDataComplete(new JoinData() { JoinNumber = 9, JoinSpan = 1 }, - new JoinMetadata() { Label = "Volume Mute Off", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); - - [JoinName("InputSelectOffset")] - public JoinDataComplete InputSelectOffset = new JoinDataComplete(new JoinData() { JoinNumber = 11, JoinSpan = 10 }, - new JoinMetadata() { Label = "Input Select", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); - - [JoinName("InputNamesOffset")] - public JoinDataComplete InputNamesOffset = new JoinDataComplete(new JoinData() { JoinNumber = 11, JoinSpan = 10 }, - new JoinMetadata() { Label = "Input Names Offset", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); - - [JoinName("InputSelect")] - public JoinDataComplete InputSelect = new JoinDataComplete(new JoinData() { JoinNumber = 11, JoinSpan = 1 }, - new JoinMetadata() { Label = "Input Select", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog }); - - [JoinName("ButtonVisibilityOffset")] - public JoinDataComplete ButtonVisibilityOffset = new JoinDataComplete(new JoinData() { JoinNumber = 41, JoinSpan = 10 }, - new JoinMetadata() { Label = "Button Visibility Offset", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.DigitalSerial }); - - [JoinName("IsOnline")] - public JoinDataComplete IsOnline = new JoinDataComplete(new JoinData() { JoinNumber = 50, JoinSpan = 1 }, - new JoinMetadata() { Label = "Is Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); - - public DisplayControllerJoinMap(uint joinStart) - : base(joinStart, typeof(CameraControllerJoinMap)) - { - } - } +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Core.Bridges +{ + public class DisplayControllerJoinMap : JoinMapBase + { + #region Digitals + /// + /// Turns the display off and reports power off feedback + /// + public uint PowerOff { get; set; } + /// + /// Turns the display on and repots power on feedback + /// + public uint PowerOn { get; set; } + /// + /// Indicates that the display device supports two way communication when high + /// + public uint IsTwoWayDisplay { get; set; } + /// + /// Increments the volume while high + /// + public uint VolumeUp { get; set; } + /// + /// Decrements teh volume while high + /// + public uint VolumeDown { get; set; } + /// + /// Toggles the mute state. Feedback is high when volume is muted + /// + public uint VolumeMute { get; set; } + /// + /// Range of digital joins to select inputs and report current input as feedback + /// + public uint InputSelectOffset { get; set; } + /// + /// Range of digital joins to report visibility for input buttons + /// + public uint ButtonVisibilityOffset { get; set; } + /// + /// High if the device is online + /// + public uint IsOnline { get; set; } + #endregion + + #region Analogs + /// + /// Analog join to set the input and report current input as feedback + /// + public uint InputSelect { get; set; } + /// + /// Sets the volume level and reports the current level as feedback + /// + public uint VolumeLevel { get; set; } + #endregion + + #region Serials + /// + /// Reports the name of the display as defined in config as feedback + /// + public uint Name { get; set; } + /// + /// Range of serial joins that reports the names of the inputs as feedback + /// + public uint InputNamesOffset { get; set; } + #endregion + + public DisplayControllerJoinMap() + { + // Digital + IsOnline = 50; + PowerOff = 1; + PowerOn = 2; + IsTwoWayDisplay = 3; + VolumeUp = 5; + VolumeDown = 6; + VolumeMute = 7; + + ButtonVisibilityOffset = 40; + InputSelectOffset = 10; + + // Analog + InputSelect = 11; + VolumeLevel = 5; + + // Serial + Name = 1; + InputNamesOffset = 10; + } + + public override void OffsetJoinNumbers(uint joinStart) + { + var joinOffset = joinStart - 1; + + IsOnline = IsOnline + joinOffset; + PowerOff = PowerOff + joinOffset; + PowerOn = PowerOn + joinOffset; + IsTwoWayDisplay = IsTwoWayDisplay + joinOffset; + ButtonVisibilityOffset = ButtonVisibilityOffset + joinOffset; + Name = Name + joinOffset; + InputNamesOffset = InputNamesOffset + joinOffset; + InputSelectOffset = InputSelectOffset + joinOffset; + + InputSelect = InputSelect + joinOffset; + + VolumeUp = VolumeUp + joinOffset; + VolumeDown = VolumeDown + joinOffset; + VolumeMute = VolumeMute + joinOffset; + VolumeLevel = VolumeLevel + joinOffset; + } + } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmRmcControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmRmcControllerJoinMap.cs index 94b9396b..0bdedbbf 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmRmcControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmRmcControllerJoinMap.cs @@ -37,39 +37,31 @@ namespace PepperDash.Essentials.Core.Bridges /// Reports the EDID serial number value /// public uint EdidSerialNumber { get; set; } - #endregion - - #region Analogs - public uint AudioVideoSource { get; set; } - #endregion - - public DmRmcControllerJoinMap() - { - // Digital - IsOnline = 1; - - // Serial - CurrentOutputResolution = 1; - EdidManufacturer = 2; - EdidName = 3; - EdidPrefferedTiming = 4; - EdidSerialNumber = 5; - - //Analog - AudioVideoSource = 1; - } - - public override void OffsetJoinNumbers(uint joinStart) - { - var joinOffset = joinStart - 1; - - IsOnline = IsOnline + joinOffset; - CurrentOutputResolution = CurrentOutputResolution + joinOffset; - EdidManufacturer = EdidManufacturer + joinOffset; - EdidName = EdidName + joinOffset; - EdidPrefferedTiming = EdidPrefferedTiming + joinOffset; - EdidSerialNumber = EdidSerialNumber + joinOffset; - AudioVideoSource = AudioVideoSource + joinOffset; - } + #endregion + + public DmRmcControllerJoinMap() + { + // Digital + IsOnline = 1; + + // Serial + CurrentOutputResolution = 1; + EdidManufacturer = 2; + EdidName = 3; + EdidPrefferedTiming = 4; + EdidSerialNumber = 5; + } + + public override void OffsetJoinNumbers(uint joinStart) + { + var joinOffset = joinStart - 1; + + IsOnline = IsOnline + joinOffset; + CurrentOutputResolution = CurrentOutputResolution + joinOffset; + EdidManufacturer = EdidManufacturer + joinOffset; + EdidName = EdidName + joinOffset; + EdidPrefferedTiming = EdidPrefferedTiming + joinOffset; + EdidSerialNumber = EdidSerialNumber + joinOffset; + } } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/IBasicCommunicationJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/IBasicCommunicationJoinMap.cs index 612ace4f..3669738e 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/IBasicCommunicationJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/IBasicCommunicationJoinMap.cs @@ -1,42 +1,67 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using PepperDash.Essentials.Core; - -namespace PepperDash.Essentials.Core.Bridges -{ - public class IBasicCommunicationJoinMap : JoinMapBaseAdvanced - { - [JoinName("TextReceived")] - public JoinDataComplete TextReceived = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, - new JoinMetadata() { Label = "Text Received From Remote Device", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); - - [JoinName("SendText")] - public JoinDataComplete SendText = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, - new JoinMetadata() { Label = "Text Sent To Remote Device", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Serial }); - - [JoinName("SetPortConfig")] - public JoinDataComplete SetPortConfig = new JoinDataComplete(new JoinData() { JoinNumber = 2, JoinSpan = 1 }, - new JoinMetadata() { Label = "Set Port Config", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Serial }); - - [JoinName("Connect")] - public JoinDataComplete Connect = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, - new JoinMetadata() { Label = "Connect", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); - - [JoinName("Connected")] - public JoinDataComplete Connected = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, - new JoinMetadata() { Label = "Connected", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); - - [JoinName("Status")] - public JoinDataComplete Status = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, - new JoinMetadata() { Label = "Status", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog }); - - - public IBasicCommunicationJoinMap(uint joinStart) - : base(joinStart, typeof(IBasicCommunicationJoinMap)) - { - } - } +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Core.Bridges +{ + public class IBasicCommunicationJoinMap : JoinMapBase + { + #region Digitals + /// + /// Set High to connect, Low to disconnect + /// + public uint Connect { get; set; } + /// + /// Reports Connected State (High = Connected) + /// + public uint Connected { get; set; } + #endregion + + #region Analogs + /// + /// Reports the connections status value + /// + public uint Status { get; set; } + #endregion + + #region Serials + /// + /// Data back from port + /// + public uint TextReceived { get; set; } + /// + /// Sends data to the port + /// + public uint SendText { get; set; } + /// + /// Takes a JSON serialized string that sets a COM port's parameters + /// + public uint SetPortConfig { get; set; } + #endregion + + public IBasicCommunicationJoinMap() + { + TextReceived = 1; + SendText = 1; + SetPortConfig = 2; + Connect = 1; + Connected = 1; + Status = 1; + } + + public override void OffsetJoinNumbers(uint joinStart) + { + var joinOffset = joinStart - 1; + + TextReceived = TextReceived + joinOffset; + SendText = SendText + joinOffset; + SetPortConfig = SetPortConfig + joinOffset; + Connect = Connect + joinOffset; + Connected = Connected + joinOffset; + Status = Status + joinOffset; + } + } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericComm.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericComm.cs index 523ffb78..41438832 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericComm.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericComm.cs @@ -1,124 +1,125 @@ -using System; -using System.Collections.Generic; -using Crestron.SimplSharp.CrestronSockets; -using Crestron.SimplSharpPro.DeviceSupport; -using Newtonsoft.Json; - -using PepperDash.Core; -using PepperDash.Essentials.Core.Bridges; -using PepperDash.Essentials.Core.Devices; -using PepperDash.Essentials.Core.Config; - - -namespace PepperDash.Essentials.Core -{ - /// - /// Serves as a generic wrapper class for all styles of IBasicCommuncation ports - /// - [Description("Generic communication wrapper class for any IBasicCommunication type")] - public class GenericComm : ReconfigurableBridgableDevice - { - EssentialsControlPropertiesConfig PropertiesConfig; - - public IBasicCommunication CommPort { get; private set; } - - public GenericComm(DeviceConfig config) - : base(config) - { - PropertiesConfig = CommFactory.GetControlPropertiesConfig(config); - - CommPort = CommFactory.CreateCommForDevice(config); - - } - - public static IKeyed BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "Factory Attempting to create new Generic Comm Device"); - return new GenericComm(dc); - } - - public void SetPortConfig(string portConfig) - { - // TODO: Deserialize new EssentialsControlPropertiesConfig and handle as necessary - try - { - PropertiesConfig = JsonConvert.DeserializeObject - (portConfig); - } - catch (Exception e) - { - Debug.Console(2, this, "Error deserializing port config: {0}", e); - } - } - - protected override void CustomSetConfig(DeviceConfig config) - { - PropertiesConfig = CommFactory.GetControlPropertiesConfig(config); - - ConfigWriter.UpdateDeviceConfig(config); - } - - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) - { - var joinMap = new IBasicCommunicationJoinMap(joinStart); - - var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); - - if (!string.IsNullOrEmpty(joinMapSerialized)) - joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - - if (CommPort == null) - { - Debug.Console(1, this, "Unable to link device '{0}'. CommPort is null", Key); - return; - } - - Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); - - // this is a permanent event handler. This cannot be -= from event - CommPort.TextReceived += (s, a) => - { - Debug.Console(2, this, "RX: {0}", a.Text); - trilist.SetString(joinMap.TextReceived.JoinNumber, a.Text); - }; - trilist.SetStringSigAction(joinMap.SendText.JoinNumber, s => CommPort.SendText(s)); - trilist.SetStringSigAction(joinMap.SetPortConfig.JoinNumber, SetPortConfig); - - - var sComm = this as ISocketStatus; - if (sComm == null) return; - sComm.ConnectionChange += (s, a) => - { - trilist.SetUshort(joinMap.Status.JoinNumber, (ushort)(a.Client.ClientStatus)); - trilist.SetBool(joinMap.Connected.JoinNumber, a.Client.ClientStatus == - SocketStatus.SOCKET_STATUS_CONNECTED); - }; - - trilist.SetBoolSigAction(joinMap.Connect.JoinNumber, b => - { - if (b) - { - sComm.Connect(); - } - else - { - sComm.Disconnect(); - } - }); - } - } - - public class GenericCommFactory : EssentialsDeviceFactory - { - public GenericCommFactory() - { - TypeNames = new List() { "genericComm" }; - } - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "Factory Attempting to create new Generic Comm Device"); - return new GenericComm(dc); - } - } +using System; +using System.Collections.Generic; +using Crestron.SimplSharp.CrestronSockets; +using Crestron.SimplSharpPro.DeviceSupport; +using Newtonsoft.Json; + +using PepperDash.Core; +using PepperDash.Essentials.Core.Bridges; +using PepperDash.Essentials.Core.Devices; +using PepperDash.Essentials.Core.Config; + + +namespace PepperDash.Essentials.Core +{ + /// + /// Serves as a generic wrapper class for all styles of IBasicCommuncation ports + /// + [Description("Generic communication wrapper class for any IBasicCommunication type")] + public class GenericComm : ReconfigurableBridgableDevice + { + EssentialsControlPropertiesConfig PropertiesConfig; + + public IBasicCommunication CommPort { get; private set; } + + public GenericComm(DeviceConfig config) + : base(config) + { + PropertiesConfig = CommFactory.GetControlPropertiesConfig(config); + + CommPort = CommFactory.CreateCommForDevice(config); + + } + + public static IKeyed BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new Generic Comm Device"); + return new GenericComm(dc); + } + + public void SetPortConfig(string portConfig) + { + // TODO: Deserialize new EssentialsControlPropertiesConfig and handle as necessary + try + { + PropertiesConfig = JsonConvert.DeserializeObject + (portConfig); + } + catch (Exception e) + { + Debug.Console(2, this, "Error deserializing port config: {0}", e); + } + } + + protected override void CustomSetConfig(DeviceConfig config) + { + PropertiesConfig = CommFactory.GetControlPropertiesConfig(config); + + ConfigWriter.UpdateDeviceConfig(config); + } + + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) + { + var joinMap = new IBasicCommunicationJoinMap(); + + var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); + + if (!string.IsNullOrEmpty(joinMapSerialized)) + joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + joinMap.OffsetJoinNumbers(joinStart); + + if (CommPort == null) + { + Debug.Console(1, this, "Unable to link device '{0}'. CommPort is null", Key); + return; + } + + Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); + + // this is a permanent event handler. This cannot be -= from event + CommPort.TextReceived += (s, a) => + { + Debug.Console(2, this, "RX: {0}", a.Text); + trilist.SetString(joinMap.TextReceived, a.Text); + }; + trilist.SetStringSigAction(joinMap.SendText, s => CommPort.SendText(s)); + trilist.SetStringSigAction(joinMap.SetPortConfig, SetPortConfig); + + + var sComm = this as ISocketStatus; + if (sComm == null) return; + sComm.ConnectionChange += (s, a) => + { + trilist.SetUshort(joinMap.Status, (ushort)(a.Client.ClientStatus)); + trilist.SetBool(joinMap.Connected, a.Client.ClientStatus == + SocketStatus.SOCKET_STATUS_CONNECTED); + }; + + trilist.SetBoolSigAction(joinMap.Connect, b => + { + if (b) + { + sComm.Connect(); + } + else + { + sComm.Disconnect(); + } + }); + } + } + + public class GenericCommFactory : EssentialsDeviceFactory + { + public GenericCommFactory() + { + TypeNames = new List() { "genericComm" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new Generic Comm Device"); + return new GenericComm(dc); + } + } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs index 2dd72340..cf317f40 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs @@ -18,7 +18,7 @@ namespace PepperDash.Essentials.Core /// /// /// - public abstract class DisplayBase : EssentialsBridgeableDevice, IHasFeedback, IRoutingSinkWithSwitching, IPower, IWarmingCooling, IUsageTracking + public abstract class DisplayBase : EssentialsDevice, IHasFeedback, IRoutingSinkWithSwitching, IPower, IWarmingCooling, IUsageTracking { public event SourceInfoChangeHandler CurrentSourceChange; @@ -121,22 +121,24 @@ namespace PepperDash.Essentials.Core var inputNumber = 0; var inputKeys = new List(); - var joinMap = new DisplayControllerJoinMap(joinStart); + var joinMap = new DisplayControllerJoinMap(); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + joinMap.OffsetJoinNumbers(joinStart); + Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); Debug.Console(0, "Linking to Display: {0}", displayDevice.Name); - trilist.StringInput[joinMap.Name.JoinNumber].StringValue = displayDevice.Name; + trilist.StringInput[joinMap.Name].StringValue = displayDevice.Name; var commMonitor = displayDevice as ICommunicationMonitor; if (commMonitor != null) { - commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]); + commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); } var inputNumberFeedback = new IntFeedback(() => inputNumber); @@ -146,16 +148,16 @@ namespace PepperDash.Essentials.Core if (twoWayDisplay != null) { - trilist.SetBool(joinMap.IsTwoWayDisplay.JoinNumber, true); + trilist.SetBool(joinMap.IsTwoWayDisplay, true); twoWayDisplay.CurrentInputFeedback.OutputChange += (o, a) => Debug.Console(0, "CurrentInputFeedback_OutputChange {0}", a.StringValue); - inputNumberFeedback.LinkInputSig(trilist.UShortInput[joinMap.InputSelect.JoinNumber]); + inputNumberFeedback.LinkInputSig(trilist.UShortInput[joinMap.InputSelect]); } // Power Off - trilist.SetSigTrueAction(joinMap.PowerOff.JoinNumber, () => + trilist.SetSigTrueAction(joinMap.PowerOff, () => { inputNumber = 102; inputNumberFeedback.FireUpdate(); @@ -177,10 +179,10 @@ namespace PepperDash.Essentials.Core } }; - displayDevice.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.PowerOff.JoinNumber]); + displayDevice.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.PowerOff]); // PowerOn - trilist.SetSigTrueAction(joinMap.PowerOn.JoinNumber, () => + trilist.SetSigTrueAction(joinMap.PowerOn, () => { inputNumber = 0; inputNumberFeedback.FireUpdate(); @@ -188,27 +190,21 @@ namespace PepperDash.Essentials.Core }); - displayDevice.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PowerOn.JoinNumber]); + displayDevice.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PowerOn]); - for (int i = 0; i < displayDevice.InputPorts.Count; i++) + var count = 1; + foreach (var input in displayDevice.InputPorts) { - if (i < joinMap.InputNamesOffset.JoinSpan) - { - inputKeys.Add(displayDevice.InputPorts[i].Key); - var tempKey = inputKeys.ElementAt(i); - trilist.SetSigTrueAction((ushort)(joinMap.InputSelectOffset.JoinNumber + i), - () => displayDevice.ExecuteSwitch(displayDevice.InputPorts[tempKey].Selector)); - Debug.Console(2, displayDevice, "Setting Input Select Action on Digital Join {0} to Input: {1}", - joinMap.InputSelectOffset.JoinNumber + i, displayDevice.InputPorts[tempKey].Key.ToString()); - trilist.StringInput[(ushort)(joinMap.InputNamesOffset.JoinNumber + i)].StringValue = displayDevice.InputPorts[i].Key.ToString(); - } - else - Debug.Console(0, displayDevice, Debug.ErrorLogLevel.Warning, "Device has {0} inputs. The Join Map allows up to {1} inputs. Discarding inputs {2} - {3} from bridge.", - displayDevice.InputPorts.Count, joinMap.InputNamesOffset.JoinSpan, i + 1, displayDevice.InputPorts.Count); + inputKeys.Add(input.Key); + var tempKey = inputKeys.ElementAt(count - 1); + trilist.SetSigTrueAction((ushort)(joinMap.InputSelectOffset + count), () => displayDevice.ExecuteSwitch(displayDevice.InputPorts[tempKey].Selector)); + Debug.Console(2, displayDevice, "Setting Input Select Action on Digital Join {0} to Input: {1}", joinMap.InputSelectOffset + count, displayDevice.InputPorts[tempKey].Key.ToString()); + trilist.StringInput[(ushort)(joinMap.InputNamesOffset + count)].StringValue = input.Key.ToString(); + count++; } Debug.Console(2, displayDevice, "Setting Input Select Action on Analog Join {0}", joinMap.InputSelect); - trilist.SetUShortSigAction(joinMap.InputSelect.JoinNumber, (a) => + trilist.SetUShortSigAction(joinMap.InputSelect, (a) => { if (a == 0) { @@ -233,22 +229,17 @@ namespace PepperDash.Essentials.Core var volumeDisplay = displayDevice as IBasicVolumeControls; if (volumeDisplay == null) return; - trilist.SetBoolSigAction(joinMap.VolumeUp.JoinNumber, volumeDisplay.VolumeUp); - trilist.SetBoolSigAction(joinMap.VolumeDown.JoinNumber, volumeDisplay.VolumeDown); - trilist.SetSigTrueAction(joinMap.VolumeMute.JoinNumber, volumeDisplay.MuteToggle); + trilist.SetBoolSigAction(joinMap.VolumeUp, volumeDisplay.VolumeUp); + trilist.SetBoolSigAction(joinMap.VolumeDown, volumeDisplay.VolumeDown); + trilist.SetSigTrueAction(joinMap.VolumeMute, volumeDisplay.MuteToggle); var volumeDisplayWithFeedback = volumeDisplay as IBasicVolumeWithFeedback; if (volumeDisplayWithFeedback == null) return; - trilist.SetSigTrueAction(joinMap.VolumeMuteOn.JoinNumber, volumeDisplayWithFeedback.MuteOn); - trilist.SetSigTrueAction(joinMap.VolumeMuteOff.JoinNumber, volumeDisplayWithFeedback.MuteOff); - - trilist.SetUShortSigAction(joinMap.VolumeLevel.JoinNumber, volumeDisplayWithFeedback.SetVolume); - volumeDisplayWithFeedback.VolumeLevelFeedback.LinkInputSig(trilist.UShortInput[joinMap.VolumeLevel.JoinNumber]); - volumeDisplayWithFeedback.MuteFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VolumeMute.JoinNumber]); - volumeDisplayWithFeedback.MuteFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VolumeMuteOn.JoinNumber]); - volumeDisplayWithFeedback.MuteFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.VolumeMuteOff.JoinNumber]); + trilist.SetUShortSigAction(joinMap.VolumeLevel, volumeDisplayWithFeedback.SetVolume); + volumeDisplayWithFeedback.VolumeLevelFeedback.LinkInputSig(trilist.UShortInput[joinMap.VolumeLevel]); + volumeDisplayWithFeedback.MuteFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VolumeMute]); } } diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingInterfaces.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingInterfaces.cs index 3b288290..0c642d5c 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingInterfaces.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingInterfaces.cs @@ -89,15 +89,6 @@ namespace PepperDash.Essentials.Core IntFeedback VideoSourceNumericFeedback { get; } IntFeedback AudioSourceNumericFeedback { get; } void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type); - } - - /// - /// Defines a receiver that has internal routing (DM-RMC-4K-Z-SCALER-C) - /// - public interface IRmcRouting : IRouting - { - IntFeedback AudioVideoSourceNumericFeedback { get; } - void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type); } /// diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZ100CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZ100CController.cs deleted file mode 100644 index 33705c0a..00000000 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZ100CController.cs +++ /dev/null @@ -1,79 +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 Crestron.SimplSharpPro.DM; -using Crestron.SimplSharpPro.DM.Endpoints; -using Crestron.SimplSharpPro.DM.Endpoints.Receivers; - -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Core.Bridges; - -namespace PepperDash.Essentials.DM -{ - public class DmRmc4kZ100CController : DmRmcX100CController - { - private readonly DmRmc4kz100C _rmc; - - public DmRmc4kZ100CController(string key, string name, DmRmc4kz100C rmc) - : base(key, name, rmc) - { - _rmc = rmc; - - /* removed this logic because it's done in the base constructor and doesn't need to be duplicated here - DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, - eRoutingPortConnectionType.DmCat, 0, this); - HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, - eRoutingPortConnectionType.Hdmi, null, this) {Port = _rmc}; - */ - - // Set Ports for CEC - - //TODO: We need to look at this class inheritance design...not so sure these properties need to be virtual and/or abstract. - EdidManufacturerFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.Manufacturer.StringValue); - EdidNameFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.Name.StringValue); - EdidPreferredTimingFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.PreferredTiming.StringValue); - EdidSerialNumberFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.SerialNumber.StringValue); - - _rmc.HdmiOutput.OutputStreamChange += HdmiOutput_OutputStreamChange; - _rmc.HdmiOutput.ConnectedDevice.DeviceInformationChange += ConnectedDevice_DeviceInformationChange; - } - - void HdmiOutput_OutputStreamChange(EndpointOutputStream outputStream, EndpointOutputStreamEventArgs args) - { - if (args.EventId == EndpointOutputStreamEventIds.HorizontalResolutionFeedbackEventId || args.EventId == EndpointOutputStreamEventIds.VerticalResolutionFeedbackEventId || - args.EventId == EndpointOutputStreamEventIds.FramesPerSecondFeedbackEventId) - { - VideoOutputResolutionFeedback.FireUpdate(); - } - } - - void ConnectedDevice_DeviceInformationChange(ConnectedDeviceInformation connectedDevice, ConnectedDeviceEventArgs args) - { - if (args.EventId == ConnectedDeviceEventIds.ManufacturerEventId) - { - EdidManufacturerFeedback.FireUpdate(); - } - else if (args.EventId == ConnectedDeviceEventIds.NameEventId) - { - EdidNameFeedback.FireUpdate(); - } - else if (args.EventId == ConnectedDeviceEventIds.PreferredTimingEventId) - { - EdidPreferredTimingFeedback.FireUpdate(); - } - else if (args.EventId == ConnectedDeviceEventIds.SerialNumberEventId) - { - EdidSerialNumberFeedback.FireUpdate(); - } - } - - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) - { - LinkDmRmcToApi(this, trilist, joinStart, joinMapKey, bridge); - } - } -} \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZScalerCController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZScalerCController.cs deleted file mode 100644 index a42b6771..00000000 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZScalerCController.cs +++ /dev/null @@ -1,151 +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 Crestron.SimplSharpPro.DM; -using Crestron.SimplSharpPro.DM.Endpoints; -using Crestron.SimplSharpPro.DM.Endpoints.Receivers; - -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Core.Bridges; -using PepperDash.Core; - -namespace PepperDash.Essentials.DM -{ - public class DmRmc4kZScalerCController : DmRmcControllerBase, IRmcRouting, - IIROutputPorts, IComPorts, ICec - { - public DmRmc4kzScalerC Rmc { get; private set; } - - public RoutingInputPort DmIn { get; private set; } - public RoutingInputPort HdmiIn { get; private set; } - public RoutingOutputPort HdmiOut { get; private set; } - - /// - /// The value of the current video source for the HDMI output on the receiver - /// - public IntFeedback AudioVideoSourceNumericFeedback { get; private set; } - - public RoutingPortCollection InputPorts - { - get { return new RoutingPortCollection { DmIn, HdmiIn }; } - } - - public RoutingPortCollection OutputPorts - { - get { return new RoutingPortCollection { HdmiOut }; } - } - - public DmRmc4kZScalerCController(string key, string name, DmRmc4kzScalerC rmc) - : base(key, name, rmc) - { - Rmc = rmc; - DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, - eRoutingPortConnectionType.DmCat, 0, this); - HdmiIn = new RoutingInputPort(DmPortName.HdmiIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, - eRoutingPortConnectionType.Hdmi, 0, this); - HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, - eRoutingPortConnectionType.Hdmi, null, this); - - EdidManufacturerFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.Manufacturer.StringValue); - EdidNameFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.Name.StringValue); - EdidPreferredTimingFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.PreferredTiming.StringValue); - EdidSerialNumberFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.SerialNumber.StringValue); - - VideoOutputResolutionFeedback = new StringFeedback(() => Rmc.HdmiOutput.GetVideoResolutionString()); - - Rmc.HdmiOutput.OutputStreamChange += HdmiOutput_OutputStreamChange; - Rmc.HdmiOutput.ConnectedDevice.DeviceInformationChange += ConnectedDevice_DeviceInformationChange; - - // Set Ports for CEC - HdmiOut.Port = Rmc.HdmiOutput; - - AudioVideoSourceNumericFeedback = new IntFeedback(() => (ushort)(Rmc.SelectedSourceFeedback)); - } - - void HdmiOutput_OutputStreamChange(EndpointOutputStream outputStream, EndpointOutputStreamEventArgs args) - { - if (args.EventId == EndpointOutputStreamEventIds.HorizontalResolutionFeedbackEventId || args.EventId == EndpointOutputStreamEventIds.VerticalResolutionFeedbackEventId || - args.EventId == EndpointOutputStreamEventIds.FramesPerSecondFeedbackEventId) - { - VideoOutputResolutionFeedback.FireUpdate(); - } - - if (args.EventId == EndpointOutputStreamEventIds.SelectedSourceFeedbackEventId) - { - AudioVideoSourceNumericFeedback.FireUpdate(); - } - } - - void ConnectedDevice_DeviceInformationChange(ConnectedDeviceInformation connectedDevice, ConnectedDeviceEventArgs args) - { - if (args.EventId == ConnectedDeviceEventIds.ManufacturerEventId) - { - EdidManufacturerFeedback.FireUpdate(); - } - else if (args.EventId == ConnectedDeviceEventIds.NameEventId) - { - EdidNameFeedback.FireUpdate(); - } - else if (args.EventId == ConnectedDeviceEventIds.PreferredTimingEventId) - { - EdidPreferredTimingFeedback.FireUpdate(); - } - else if (args.EventId == ConnectedDeviceEventIds.SerialNumberEventId) - { - EdidSerialNumberFeedback.FireUpdate(); - } - } - - public override bool CustomActivate() - { - // Base does register and sets up comm monitoring. - return base.CustomActivate(); - } - - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) - { - LinkDmRmcToApi(this, trilist, joinStart, joinMapKey, bridge); - } - - #region IIROutputPorts Members - public CrestronCollection IROutputPorts { get { return Rmc.IROutputPorts; } } - public int NumberOfIROutputPorts { get { return Rmc.NumberOfIROutputPorts; } } - #endregion - - #region IComPorts Members - public CrestronCollection ComPorts { get { return Rmc.ComPorts; } } - public int NumberOfComPorts { get { return Rmc.NumberOfComPorts; } } - #endregion - - #region ICec Members - /// - /// Gets the CEC stream directly from the HDMI port. - /// - public Cec StreamCec { get { return Rmc.HdmiOutput.StreamCec; } } - #endregion - - - #region IRmcRouting Members - public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType) - { - Debug.Console(2, this, "Attempting a route from input {0} to HDMI Output", inputSelector); - - var number = Convert.ToUInt16(inputSelector); - - Rmc.AudioVideoSource = (DmRmc4kzScalerC.eAudioVideoSource)number; - } - - public void ExecuteNumericSwitch(ushort inputSelector, ushort outputSelector, eRoutingSignalType signalType) - { - Debug.Console(2, this, "Attempting a route from input {0} to HDMI Output", inputSelector); - - Rmc.AudioVideoSource = (DmRmc4kzScalerC.eAudioVideoSource)inputSelector; - } - #endregion - - } -} \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs index 91085fca..da3e587a 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs @@ -1,326 +1,307 @@ -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.Endpoints; -using Crestron.SimplSharpPro.DM.Endpoints.Receivers; -using 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 -{ - [Description("Wrapper class for all DM-RMC variants")] - public abstract class DmRmcControllerBase : CrestronGenericBridgeableBaseDevice - { - public virtual StringFeedback VideoOutputResolutionFeedback { get; protected set; } - public virtual StringFeedback EdidManufacturerFeedback { get; protected set; } - public virtual StringFeedback EdidNameFeedback { get; protected set; } - public virtual StringFeedback EdidPreferredTimingFeedback { get; protected set; } - public virtual StringFeedback EdidSerialNumberFeedback { get; protected set; } - - protected DmRmcControllerBase(string key, string name, EndpointReceiverBase device) - : base(key, name, device) - { - // if wired to a chassis, skip registration step in base class - if (device.DMOutput != null) - { - this.PreventRegistration = true; - } - AddToFeedbackList(VideoOutputResolutionFeedback, EdidManufacturerFeedback, EdidSerialNumberFeedback, EdidNameFeedback, EdidPreferredTimingFeedback); - } - - protected void LinkDmRmcToApi(DmRmcControllerBase rmc, BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) - { - var joinMap = new DmRmcControllerJoinMap(); - - var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); - - if (!string.IsNullOrEmpty(joinMapSerialized)) - joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - - joinMap.OffsetJoinNumbers(joinStart); - - Debug.Console(1, rmc, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); - - rmc.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); - if (rmc.VideoOutputResolutionFeedback != null) - rmc.VideoOutputResolutionFeedback.LinkInputSig(trilist.StringInput[joinMap.CurrentOutputResolution]); - if (rmc.EdidManufacturerFeedback != null) - rmc.EdidManufacturerFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidManufacturer]); - if (rmc.EdidNameFeedback != null) - rmc.EdidNameFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidName]); - if (rmc.EdidPreferredTimingFeedback != null) - rmc.EdidPreferredTimingFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidPrefferedTiming]); - if (rmc.EdidSerialNumberFeedback != null) - rmc.EdidSerialNumberFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidSerialNumber]); - - //If the device is an DM-RMC-4K-Z-SCALER-C - var routing = rmc as IRmcRouting; - - if (routing != null) - { - if (routing.AudioVideoSourceNumericFeedback != null) - routing.AudioVideoSourceNumericFeedback.LinkInputSig(trilist.UShortInput[joinMap.AudioVideoSource]); - - trilist.SetUShortSigAction(joinMap.AudioVideoSource, (a) => routing.ExecuteNumericSwitch(a, 1, eRoutingSignalType.AudioVideo)); - } - } - } - - public abstract class DmHdBaseTControllerBase : CrestronGenericBaseDevice - { - public HDBaseTBase Rmc { get; protected set; } - - /// - /// Make a Crestron RMC and put it in here - /// - public DmHdBaseTControllerBase(string key, string name, HDBaseTBase rmc) - : base(key, name, rmc) - { - - } - } - - public class DmRmcHelper - { - /// - /// A factory method for various DmTxControllers - /// - /// - /// - /// - /// - public static CrestronGenericBaseDevice GetDmRmcController(string key, string name, string typeName, DmRmcPropertiesConfig props) - { - // switch on type name... later... - - typeName = typeName.ToLower(); - uint ipid = props.Control.IpIdInt; // Convert.ToUInt16(props.Id, 16); - - - - // right here, we need to grab the tie line that associates this - // RMC with a chassis or processor. If the RMC input's tie line is not - // connected to a chassis, then it's parent is the processor. - // If the RMC is connected to a chassis, then we need to grab the - // output number from the tie line and use that to plug it in. - // Example of chassis-connected: - //{ - // "sourceKey": "dmMd8x8-1", - // "sourcePort": "anyOut2", - // "destinationKey": "dmRmc100C-2", - // "destinationPort": "DmIn" - //} - - // Tx -> RMC link: - //{ - // "sourceKey": "dmTx201C-1", - // "sourcePort": "DmOut", - // "destinationKey": "dmRmc100C-2", - // "destinationPort": "DmIn" - //} - - var tlc = TieLineCollection.Default; - // grab the tie line that has this key as - // THIS DOESN'T WORK BECAUSE THE RMC THAT WE NEED (THIS) HASN'T BEEN MADE - // YET AND THUS WILL NOT HAVE A TIE LINE... - var inputTieLine = tlc.FirstOrDefault(t => - { - var d = t.DestinationPort.ParentDevice; - return d.Key.Equals(key, StringComparison.OrdinalIgnoreCase) - && d is DmChassisController; - }); - - var pKey = props.ParentDeviceKey.ToLower(); - - - - - // Non-DM-chassis endpoints - if (pKey == "processor") - { - // Catch constructor failures, mainly dues to IPID - try - { - if (typeName.StartsWith("dmrmc100c")) - return new DmRmcX100CController(key, name, new DmRmc100C(ipid, Global.ControlSystem)); - if (typeName.StartsWith("dmrmc100s")) - return new DmRmc100SController(key, name, new DmRmc100S(ipid, Global.ControlSystem)); - if (typeName.StartsWith("dmrmc4k100c")) - return new DmRmcX100CController(key, name, new DmRmc4k100C(ipid, Global.ControlSystem)); - if (typeName.StartsWith("dmrmc4kz100c")) - return new DmRmc4kZ100CController(key, name, new DmRmc4kz100C(ipid, Global.ControlSystem)); - if (typeName.StartsWith("dmrmc150s")) - return new DmRmc150SController(key, name, new DmRmc150S(ipid, Global.ControlSystem)); - if (typeName.StartsWith("dmrmc200c")) - return new DmRmc200CController(key, name, new DmRmc200C(ipid, Global.ControlSystem)); - if (typeName.StartsWith("dmrmc200s")) - return new DmRmc200SController(key, name, new DmRmc200S(ipid, Global.ControlSystem)); - if (typeName.StartsWith("dmrmc200s2")) - return new DmRmc200S2Controller(key, name, new DmRmc200S2(ipid, Global.ControlSystem)); - if (typeName.StartsWith("dmrmcscalerc")) - return new DmRmcScalerCController(key, name, new DmRmcScalerC(ipid, Global.ControlSystem)); - if (typeName.StartsWith("dmrmcscalers")) - return new DmRmcScalerSController(key, name, new DmRmcScalerS(ipid, Global.ControlSystem)); - if (typeName.StartsWith("dmrmcscalers2")) - return new DmRmcScalerS2Controller(key, name, new DmRmcScalerS2(ipid, Global.ControlSystem)); - if (typeName.StartsWith("dmrmc4kscalerc")) - return new DmRmc4kScalerCController(key, name, new DmRmc4kScalerC(ipid, Global.ControlSystem)); - if (typeName.StartsWith("dmrmc4kscalercdsp")) - return new DmRmc4kScalerCDspController(key, name, new DmRmc4kScalerCDsp(ipid, Global.ControlSystem)); - if (typeName.StartsWith("dmrmc4kzscalerc")) - return new DmRmc4kZScalerCController(key, name, new DmRmc4kzScalerC(ipid, Global.ControlSystem)); - } - catch (Exception e) - { - Debug.Console(0, "[{0}] WARNING: Cannot create DM-RMC device: {1}", key, e.Message); - } - - - Debug.Console(0, "Cannot create DM-RMC of type: '{0}'", typeName); - } - // Endpoints attached to DM Chassis - else - { - var parentDev = DeviceManager.GetDeviceForKey(pKey); - if (!(parentDev is IDmSwitch)) - { - Debug.Console(0, "Cannot create DM device '{0}'. '{1}' is not a DM Chassis.", - key, pKey); - return null; - } - - var chassis = (parentDev as IDmSwitch).Chassis; - var num = props.ParentOutputNumber; - if (num <= 0 || num > chassis.NumberOfOutputs) - { - Debug.Console(0, "Cannot create DM device '{0}'. Output number '{1}' is out of range", - key, num); - return null; - } - else - { - var controller = (parentDev as IDmSwitch); - controller.RxDictionary.Add(num, key); - } - // Catch constructor failures, mainly dues to IPID - try - { - - // Must use different constructor for CPU3 chassis types. No IPID - if (chassis is DmMd8x8Cpu3 || chassis is DmMd16x16Cpu3 || - chassis is DmMd32x32Cpu3 || chassis is DmMd8x8Cpu3rps || - chassis is DmMd16x16Cpu3rps || chassis is DmMd32x32Cpu3rps || - chassis is DmMd128x128 || chassis is DmMd64x64) - { - if (typeName.StartsWith("hdbasetrx")) - return new HDBaseTRxController(key, name, new HDRx3CB(chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc4k100c1g")) - return new DmRmc4k100C1GController(key, name, new DmRmc4K100C1G(chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc100c")) - return new DmRmcX100CController(key, name, new DmRmc100C(chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc100s")) - return new DmRmc100SController(key, name, new DmRmc100S(chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc4k100c")) - return new DmRmcX100CController(key, name, new DmRmc4k100C(chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc4kz100c")) - return new DmRmc4kZ100CController(key, name, new DmRmc4kz100C(chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc150s")) - return new DmRmc150SController(key, name, new DmRmc150S(chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc200c")) - return new DmRmc200CController(key, name, new DmRmc200C(chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc200s")) - return new DmRmc200SController(key, name, new DmRmc200S(chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc200s2")) - return new DmRmc200S2Controller(key, name, new DmRmc200S2(chassis.Outputs[num])); - if (typeName.StartsWith("dmrmcscalerc")) - return new DmRmcScalerCController(key, name, new DmRmcScalerC(chassis.Outputs[num])); - if (typeName.StartsWith("dmrmcscalers")) - return new DmRmcScalerSController(key, name, new DmRmcScalerS(chassis.Outputs[num])); - if (typeName.StartsWith("dmrmcscalers2")) - return new DmRmcScalerS2Controller(key, name, new DmRmcScalerS2(chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc4kscalerc")) - return new DmRmc4kScalerCController(key, name, new DmRmc4kScalerC(chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc4kscalercdsp")) - return new DmRmc4kScalerCDspController(key, name, new DmRmc4kScalerCDsp(chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc4kzscalerc")) - return new DmRmc4kZScalerCController(key, name, new DmRmc4kzScalerC(chassis.Outputs[num])); - } - else - { - if (typeName.StartsWith("hdbasetrx")) - return new HDBaseTRxController(key, name, new HDRx3CB(ipid, chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc4k100c1g")) - return new DmRmc4k100C1GController(key, name, new DmRmc4K100C1G(ipid, chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc100c")) - return new DmRmcX100CController(key, name, new DmRmc100C(ipid, chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc100s")) - return new DmRmc100SController(key, name, new DmRmc100S(ipid, chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc4k100c")) - return new DmRmcX100CController(key, name, new DmRmc4k100C(ipid, chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc4kz100c")) - return new DmRmc4kZ100CController(key, name, new DmRmc4kz100C(ipid, chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc150s")) - return new DmRmc150SController(key, name, new DmRmc150S(ipid, chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc200c")) - return new DmRmc200CController(key, name, new DmRmc200C(ipid, chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc200s")) - return new DmRmc200SController(key, name, new DmRmc200S(ipid, chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc200s2")) - return new DmRmc200S2Controller(key, name, new DmRmc200S2(ipid, chassis.Outputs[num])); - if (typeName.StartsWith("dmrmcscalerc")) - return new DmRmcScalerCController(key, name, new DmRmcScalerC(ipid, chassis.Outputs[num])); - if (typeName.StartsWith("dmrmcscalers")) - return new DmRmcScalerSController(key, name, new DmRmcScalerS(ipid, chassis.Outputs[num])); - if (typeName.StartsWith("dmrmcscalers2")) - return new DmRmcScalerS2Controller(key, name, new DmRmcScalerS2(ipid, chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc4kscalerc")) - return new DmRmc4kScalerCController(key, name, new DmRmc4kScalerC(ipid, chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc4kscalercdsp")) - return new DmRmc4kScalerCDspController(key, name, new DmRmc4kScalerCDsp(ipid, chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc4kzscalerc")) - return new DmRmc4kZScalerCController(key, name, new DmRmc4kzScalerC(chassis.Outputs[num])); - - } - } - catch (Exception e) - { - Debug.Console(0, "[{0}] WARNING: Cannot create DM-RMC device: {1}", key, e.Message); - } - } - - return null; - } - } - - public class DmRmcControllerFactory : EssentialsDeviceFactory - { - public DmRmcControllerFactory() - { - TypeNames = new List() { "hdbasetrx", "dmrmc4k100c1g", "dmrmc100c", "dmrmc100s", "dmrmc4k100c", "dmrmc150s", - "dmrmc200c", "dmrmc200s", "dmrmc200s2", "dmrmcscalerc", "dmrmcscalers", "dmrmcscalers2", "dmrmc4kscalerc", "dmrmc4kscalercdsp", - "dmrmc4kz100c", "dmrmckzscalerc" }; - } - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - var type = dc.Type.ToLower(); - - Debug.Console(1, "Factory Attempting to create new DM-RMC Device"); - - var props = JsonConvert.DeserializeObject - (dc.Properties.ToString()); - return PepperDash.Essentials.DM.DmRmcHelper.GetDmRmcController(dc.Key, dc.Name, type, props); - - } - } - +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.Endpoints; +using Crestron.SimplSharpPro.DM.Endpoints.Receivers; +using 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 +{ + [Description("Wrapper class for all DM-RMC variants")] + public abstract class DmRmcControllerBase : CrestronGenericBridgeableBaseDevice + { + public virtual StringFeedback VideoOutputResolutionFeedback { get; protected set; } + public virtual StringFeedback EdidManufacturerFeedback { get; protected set; } + public virtual StringFeedback EdidNameFeedback { get; protected set; } + public virtual StringFeedback EdidPreferredTimingFeedback { get; protected set; } + public virtual StringFeedback EdidSerialNumberFeedback { get; protected set; } + + public DmRmcControllerBase(string key, string name, EndpointReceiverBase device) + : base(key, name, device) + { + // if wired to a chassis, skip registration step in base class + if (device.DMOutput != null) + { + this.PreventRegistration = true; + } + AddToFeedbackList(VideoOutputResolutionFeedback, EdidManufacturerFeedback, EdidSerialNumberFeedback, EdidNameFeedback, EdidPreferredTimingFeedback); + } + + protected void LinkDmRmcToApi(DmRmcControllerBase rmc, BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) + { + var joinMap = new DmRmcControllerJoinMap(); + + var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); + + if (!string.IsNullOrEmpty(joinMapSerialized)) + joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + + joinMap.OffsetJoinNumbers(joinStart); + + Debug.Console(1, rmc, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); + + rmc.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); + if (rmc.VideoOutputResolutionFeedback != null) + rmc.VideoOutputResolutionFeedback.LinkInputSig(trilist.StringInput[joinMap.CurrentOutputResolution]); + if (rmc.EdidManufacturerFeedback != null) + rmc.EdidManufacturerFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidManufacturer]); + if (rmc.EdidNameFeedback != null) + rmc.EdidNameFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidName]); + if (rmc.EdidPreferredTimingFeedback != null) + rmc.EdidPreferredTimingFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidPrefferedTiming]); + if (rmc.EdidSerialNumberFeedback != null) + rmc.EdidSerialNumberFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidSerialNumber]); + } + } + + public abstract class DmHdBaseTControllerBase : CrestronGenericBaseDevice + { + public HDBaseTBase Rmc { get; protected set; } + + /// + /// Make a Crestron RMC and put it in here + /// + public DmHdBaseTControllerBase(string key, string name, HDBaseTBase rmc) + : base(key, name, rmc) + { + + } + } + + public class DmRmcHelper + { + /// + /// A factory method for various DmTxControllers + /// + /// + /// + /// + /// + public static CrestronGenericBaseDevice GetDmRmcController(string key, string name, string typeName, DmRmcPropertiesConfig props) + { + // switch on type name... later... + + typeName = typeName.ToLower(); + uint ipid = props.Control.IpIdInt; // Convert.ToUInt16(props.Id, 16); + + + + // right here, we need to grab the tie line that associates this + // RMC with a chassis or processor. If the RMC input's tie line is not + // connected to a chassis, then it's parent is the processor. + // If the RMC is connected to a chassis, then we need to grab the + // output number from the tie line and use that to plug it in. + // Example of chassis-connected: + //{ + // "sourceKey": "dmMd8x8-1", + // "sourcePort": "anyOut2", + // "destinationKey": "dmRmc100C-2", + // "destinationPort": "DmIn" + //} + + // Tx -> RMC link: + //{ + // "sourceKey": "dmTx201C-1", + // "sourcePort": "DmOut", + // "destinationKey": "dmRmc100C-2", + // "destinationPort": "DmIn" + //} + + var tlc = TieLineCollection.Default; + // grab the tie line that has this key as + // THIS DOESN'T WORK BECAUSE THE RMC THAT WE NEED (THIS) HASN'T BEEN MADE + // YET AND THUS WILL NOT HAVE A TIE LINE... + var inputTieLine = tlc.FirstOrDefault(t => + { + var d = t.DestinationPort.ParentDevice; + return d.Key.Equals(key, StringComparison.OrdinalIgnoreCase) + && d is DmChassisController; + }); + + var pKey = props.ParentDeviceKey.ToLower(); + + + + + // Non-DM-chassis endpoints + if (pKey == "processor") + { + // Catch constructor failures, mainly dues to IPID + try + { + if (typeName.StartsWith("dmrmc100c")) + return new DmRmcX100CController(key, name, new DmRmc100C(ipid, Global.ControlSystem)); + if (typeName.StartsWith("dmrmc100s")) + return new DmRmc100SController(key, name, new DmRmc100S(ipid, Global.ControlSystem)); + if (typeName.StartsWith("dmrmc4k100c")) + return new DmRmcX100CController(key, name, new DmRmc4k100C(ipid, Global.ControlSystem)); + if (typeName.StartsWith("dmrmc4kz100c")) + return new DmRmcX100CController(key, name, new DmRmc4kz100C(ipid, Global.ControlSystem)); + if (typeName.StartsWith("dmrmc150s")) + return new DmRmc150SController(key, name, new DmRmc150S(ipid, Global.ControlSystem)); + if (typeName.StartsWith("dmrmc200c")) + return new DmRmc200CController(key, name, new DmRmc200C(ipid, Global.ControlSystem)); + if (typeName.StartsWith("dmrmc200s")) + return new DmRmc200SController(key, name, new DmRmc200S(ipid, Global.ControlSystem)); + if (typeName.StartsWith("dmrmc200s2")) + return new DmRmc200S2Controller(key, name, new DmRmc200S2(ipid, Global.ControlSystem)); + if (typeName.StartsWith("dmrmcscalerc")) + return new DmRmcScalerCController(key, name, new DmRmcScalerC(ipid, Global.ControlSystem)); + if (typeName.StartsWith("dmrmcscalers")) + return new DmRmcScalerSController(key, name, new DmRmcScalerS(ipid, Global.ControlSystem)); + if (typeName.StartsWith("dmrmcscalers2")) + return new DmRmcScalerS2Controller(key, name, new DmRmcScalerS2(ipid, Global.ControlSystem)); + if (typeName.StartsWith("dmrmc4kscalerc")) + return new DmRmc4kScalerCController(key, name, new DmRmc4kScalerC(ipid, Global.ControlSystem)); + if (typeName.StartsWith("dmrmc4kscalercdsp")) + return new DmRmc4kScalerCDspController(key, name, new DmRmc4kScalerCDsp(ipid, Global.ControlSystem)); + } + catch (Exception e) + { + Debug.Console(0, "[{0}] WARNING: Cannot create DM-RMC device: {1}", key, e.Message); + } + + + Debug.Console(0, "Cannot create DM-RMC of type: '{0}'", typeName); + } + // Endpoints attached to DM Chassis + else + { + var parentDev = DeviceManager.GetDeviceForKey(pKey); + if (!(parentDev is IDmSwitch)) + { + Debug.Console(0, "Cannot create DM device '{0}'. '{1}' is not a DM Chassis.", + key, pKey); + return null; + } + + var chassis = (parentDev as IDmSwitch).Chassis; + var num = props.ParentOutputNumber; + if (num <= 0 || num > chassis.NumberOfOutputs) + { + Debug.Console(0, "Cannot create DM device '{0}'. Output number '{1}' is out of range", + key, num); + return null; + } + else + { + var controller = (parentDev as IDmSwitch); + controller.RxDictionary.Add(num, key); + } + // Catch constructor failures, mainly dues to IPID + try + { + + // Must use different constructor for CPU3 chassis types. No IPID + if (chassis is DmMd8x8Cpu3 || chassis is DmMd16x16Cpu3 || + chassis is DmMd32x32Cpu3 || chassis is DmMd8x8Cpu3rps || + chassis is DmMd16x16Cpu3rps || chassis is DmMd32x32Cpu3rps || + chassis is DmMd128x128 || chassis is DmMd64x64) + { + if (typeName.StartsWith("hdbasetrx")) + return new HDBaseTRxController(key, name, new HDRx3CB(chassis.Outputs[num])); + if (typeName.StartsWith("dmrmc4k100c1g")) + return new DmRmc4k100C1GController(key, name, new DmRmc4K100C1G(chassis.Outputs[num])); + if (typeName.StartsWith("dmrmc100c")) + return new DmRmcX100CController(key, name, new DmRmc100C(chassis.Outputs[num])); + if (typeName.StartsWith("dmrmc100s")) + return new DmRmc100SController(key, name, new DmRmc100S(chassis.Outputs[num])); + if (typeName.StartsWith("dmrmc4k100c")) + return new DmRmcX100CController(key, name, new DmRmc4k100C(chassis.Outputs[num])); + if (typeName.StartsWith("dmrmc4kz100c")) + return new DmRmcX100CController(key, name, new DmRmc4kz100C(chassis.Outputs[num])); + if (typeName.StartsWith("dmrmc150s")) + return new DmRmc150SController(key, name, new DmRmc150S(chassis.Outputs[num])); + if (typeName.StartsWith("dmrmc200c")) + return new DmRmc200CController(key, name, new DmRmc200C(chassis.Outputs[num])); + if (typeName.StartsWith("dmrmc200s")) + return new DmRmc200SController(key, name, new DmRmc200S(chassis.Outputs[num])); + if (typeName.StartsWith("dmrmc200s2")) + return new DmRmc200S2Controller(key, name, new DmRmc200S2(chassis.Outputs[num])); + if (typeName.StartsWith("dmrmcscalerc")) + return new DmRmcScalerCController(key, name, new DmRmcScalerC(chassis.Outputs[num])); + if (typeName.StartsWith("dmrmcscalers")) + return new DmRmcScalerSController(key, name, new DmRmcScalerS(chassis.Outputs[num])); + if (typeName.StartsWith("dmrmcscalers2")) + return new DmRmcScalerS2Controller(key, name, new DmRmcScalerS2(chassis.Outputs[num])); + if (typeName.StartsWith("dmrmc4kscalerc")) + return new DmRmc4kScalerCController(key, name, new DmRmc4kScalerC(chassis.Outputs[num])); + if (typeName.StartsWith("dmrmc4kscalercdsp")) + return new DmRmc4kScalerCDspController(key, name, new DmRmc4kScalerCDsp(chassis.Outputs[num])); + } + else + { + if (typeName.StartsWith("hdbasetrx")) + return new HDBaseTRxController(key, name, new HDRx3CB(ipid, chassis.Outputs[num])); + if (typeName.StartsWith("dmrmc4k100c1g")) + return new DmRmc4k100C1GController(key, name, new DmRmc4K100C1G(ipid, chassis.Outputs[num])); + if (typeName.StartsWith("dmrmc100c")) + return new DmRmcX100CController(key, name, new DmRmc100C(ipid, chassis.Outputs[num])); + if (typeName.StartsWith("dmrmc100s")) + return new DmRmc100SController(key, name, new DmRmc100S(ipid, chassis.Outputs[num])); + if (typeName.StartsWith("dmrmc4k100c")) + return new DmRmcX100CController(key, name, new DmRmc4k100C(ipid, chassis.Outputs[num])); + if (typeName.StartsWith("dmrmc4kz100c")) + return new DmRmcX100CController(key, name, new DmRmc4kz100C(ipid, chassis.Outputs[num])); + if (typeName.StartsWith("dmrmc150s")) + return new DmRmc150SController(key, name, new DmRmc150S(ipid, chassis.Outputs[num])); + if (typeName.StartsWith("dmrmc200c")) + return new DmRmc200CController(key, name, new DmRmc200C(ipid, chassis.Outputs[num])); + if (typeName.StartsWith("dmrmc200s")) + return new DmRmc200SController(key, name, new DmRmc200S(ipid, chassis.Outputs[num])); + if (typeName.StartsWith("dmrmc200s2")) + return new DmRmc200S2Controller(key, name, new DmRmc200S2(ipid, chassis.Outputs[num])); + if (typeName.StartsWith("dmrmcscalerc")) + return new DmRmcScalerCController(key, name, new DmRmcScalerC(ipid, chassis.Outputs[num])); + if (typeName.StartsWith("dmrmcscalers")) + return new DmRmcScalerSController(key, name, new DmRmcScalerS(ipid, chassis.Outputs[num])); + if (typeName.StartsWith("dmrmcscalers2")) + return new DmRmcScalerS2Controller(key, name, new DmRmcScalerS2(ipid, chassis.Outputs[num])); + if (typeName.StartsWith("dmrmc4kscalerc")) + return new DmRmc4kScalerCController(key, name, new DmRmc4kScalerC(ipid, chassis.Outputs[num])); + if (typeName.StartsWith("dmrmc4kscalercdsp")) + return new DmRmc4kScalerCDspController(key, name, new DmRmc4kScalerCDsp(ipid, chassis.Outputs[num])); + } + } + catch (Exception e) + { + Debug.Console(0, "[{0}] WARNING: Cannot create DM-RMC device: {1}", key, e.Message); + } + } + + return null; + } + } + + public class DmRmcControllerFactory : EssentialsDeviceFactory + { + public DmRmcControllerFactory() + { + TypeNames = new List() { "hdbasetrx", "dmrmc4k100c1g", "dmrmc100c", "dmrmc100s", "dmrmc4k100c", "dmrmc150s", + "dmrmc200c", "dmrmc200s", "dmrmc200s2", "dmrmcscalerc", "dmrmcscalers", "dmrmcscalers2", "dmrmc4kscalerc", "dmrmc4kscalercdsp" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + var type = dc.Type.ToLower(); + + Debug.Console(1, "Factory Attempting to create new DM-RMC Device"); + + var props = JsonConvert.DeserializeObject + (dc.Properties.ToString()); + return PepperDash.Essentials.DM.DmRmcHelper.GetDmRmcController(dc.Key, dc.Name, type, props); + + } + } + } \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcX100CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcX100CController.cs index 16526bc0..a7260813 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcX100CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcX100CController.cs @@ -21,10 +21,10 @@ namespace PepperDash.Essentials.DM public class DmRmcX100CController : DmRmcControllerBase, IRoutingInputsOutputs, IIROutputPorts, IComPorts, ICec { - public DmRmc100C Rmc { get; protected set; } + public DmRmc100C Rmc { get; private set; } - public RoutingInputPort DmIn { get; protected set; } - public RoutingOutputPort HdmiOut { get; protected set; } + public RoutingInputPort DmIn { get; private set; } + public RoutingOutputPort HdmiOut { get; private set; } public RoutingPortCollection InputPorts { diff --git a/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj b/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj index e08b30f6..7ab8a5a9 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj +++ b/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj @@ -100,8 +100,6 @@ - - From bfa1fee522e805a914cc71dfe76c408e664c4958 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Wed, 6 May 2020 12:33:32 -0600 Subject: [PATCH 092/156] Revert "Revert "Merge branch 'development' into release/v1.5.0"" This reverts commit 4cd01aa4280b991961ac4019e5a58783a879f1aa. --- .../JoinMaps/DmRmcControllerJoinMap.cs | 14 +- .../JoinMaps/DisplayControllerJoinMap.cs | 192 +++--- .../JoinMaps/DmRmcControllerJoinMap.cs | 60 +- .../JoinMaps/IBasicCommunicationJoinMap.cs | 107 ++- .../Config/Comm and IR/GenericComm.cs | 247 ++++--- .../Display/DisplayBase.cs | 63 +- .../Routing/RoutingInterfaces.cs | 9 + .../Receivers/DmRmc4kZ100CController.cs | 79 +++ .../Receivers/DmRmc4kZScalerCController.cs | 151 +++++ .../Endpoints/Receivers/DmRmcHelper.cs | 631 +++++++++--------- .../Receivers/DmRmcX100CController.cs | 6 +- .../PepperDash_Essentials_DM.csproj | 2 + 12 files changed, 890 insertions(+), 671 deletions(-) create mode 100644 essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZ100CController.cs create mode 100644 essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZScalerCController.cs diff --git a/PepperDashEssentials/Bridges/JoinMaps/DmRmcControllerJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/DmRmcControllerJoinMap.cs index 7e1534bf..3d7cec8d 100644 --- a/PepperDashEssentials/Bridges/JoinMaps/DmRmcControllerJoinMap.cs +++ b/PepperDashEssentials/Bridges/JoinMaps/DmRmcControllerJoinMap.cs @@ -38,8 +38,12 @@ namespace PepperDash.Essentials.Bridges /// Reports the EDID serial number value /// public uint EdidSerialNumber { get; set; } - #endregion - + #endregion + + #region Analogs + public uint AudioVideoSource { get; set; } + #endregion + public DmRmcControllerJoinMap() { // Digital @@ -51,6 +55,9 @@ namespace PepperDash.Essentials.Bridges EdidName = 3; EdidPrefferedTiming = 4; EdidSerialNumber = 5; + + //Analog + AudioVideoSource = 1; } public override void OffsetJoinNumbers(uint joinStart) @@ -62,7 +69,8 @@ namespace PepperDash.Essentials.Bridges EdidManufacturer = EdidManufacturer + joinOffset; EdidName = EdidName + joinOffset; EdidPrefferedTiming = EdidPrefferedTiming + joinOffset; - EdidSerialNumber = EdidSerialNumber + joinOffset; + EdidSerialNumber = EdidSerialNumber + joinOffset; + AudioVideoSource = AudioVideoSource + joinOffset; } } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DisplayControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DisplayControllerJoinMap.cs index c2fe8573..a57c35e8 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DisplayControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DisplayControllerJoinMap.cs @@ -1,117 +1,77 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using PepperDash.Essentials.Core; - -namespace PepperDash.Essentials.Core.Bridges -{ - public class DisplayControllerJoinMap : JoinMapBase - { - #region Digitals - /// - /// Turns the display off and reports power off feedback - /// - public uint PowerOff { get; set; } - /// - /// Turns the display on and repots power on feedback - /// - public uint PowerOn { get; set; } - /// - /// Indicates that the display device supports two way communication when high - /// - public uint IsTwoWayDisplay { get; set; } - /// - /// Increments the volume while high - /// - public uint VolumeUp { get; set; } - /// - /// Decrements teh volume while high - /// - public uint VolumeDown { get; set; } - /// - /// Toggles the mute state. Feedback is high when volume is muted - /// - public uint VolumeMute { get; set; } - /// - /// Range of digital joins to select inputs and report current input as feedback - /// - public uint InputSelectOffset { get; set; } - /// - /// Range of digital joins to report visibility for input buttons - /// - public uint ButtonVisibilityOffset { get; set; } - /// - /// High if the device is online - /// - public uint IsOnline { get; set; } - #endregion - - #region Analogs - /// - /// Analog join to set the input and report current input as feedback - /// - public uint InputSelect { get; set; } - /// - /// Sets the volume level and reports the current level as feedback - /// - public uint VolumeLevel { get; set; } - #endregion - - #region Serials - /// - /// Reports the name of the display as defined in config as feedback - /// - public uint Name { get; set; } - /// - /// Range of serial joins that reports the names of the inputs as feedback - /// - public uint InputNamesOffset { get; set; } - #endregion - - public DisplayControllerJoinMap() - { - // Digital - IsOnline = 50; - PowerOff = 1; - PowerOn = 2; - IsTwoWayDisplay = 3; - VolumeUp = 5; - VolumeDown = 6; - VolumeMute = 7; - - ButtonVisibilityOffset = 40; - InputSelectOffset = 10; - - // Analog - InputSelect = 11; - VolumeLevel = 5; - - // Serial - Name = 1; - InputNamesOffset = 10; - } - - public override void OffsetJoinNumbers(uint joinStart) - { - var joinOffset = joinStart - 1; - - IsOnline = IsOnline + joinOffset; - PowerOff = PowerOff + joinOffset; - PowerOn = PowerOn + joinOffset; - IsTwoWayDisplay = IsTwoWayDisplay + joinOffset; - ButtonVisibilityOffset = ButtonVisibilityOffset + joinOffset; - Name = Name + joinOffset; - InputNamesOffset = InputNamesOffset + joinOffset; - InputSelectOffset = InputSelectOffset + joinOffset; - - InputSelect = InputSelect + joinOffset; - - VolumeUp = VolumeUp + joinOffset; - VolumeDown = VolumeDown + joinOffset; - VolumeMute = VolumeMute + joinOffset; - VolumeLevel = VolumeLevel + joinOffset; - } - } +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Core.Bridges +{ + public class DisplayControllerJoinMap : JoinMapBaseAdvanced + { + [JoinName("Name")] + public JoinDataComplete Name = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("PowerOff")] + public JoinDataComplete PowerOff = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "Power Off", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("PowerOn")] + public JoinDataComplete PowerOn = new JoinDataComplete(new JoinData() { JoinNumber = 2, JoinSpan = 1 }, + new JoinMetadata() { Label = "Power On", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("IsTwoWayDisplay")] + public JoinDataComplete IsTwoWayDisplay = new JoinDataComplete(new JoinData() { JoinNumber = 3, JoinSpan = 1 }, + new JoinMetadata() { Label = "Is Two Way Display", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("VolumeUp")] + public JoinDataComplete VolumeUp = new JoinDataComplete(new JoinData() { JoinNumber = 5, JoinSpan = 1 }, + new JoinMetadata() { Label = "Volume Up", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("VolumeLevel")] + public JoinDataComplete VolumeLevel = new JoinDataComplete(new JoinData() { JoinNumber = 5, JoinSpan = 1 }, + new JoinMetadata() { Label = "Volume Level", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("VolumeDown")] + public JoinDataComplete VolumeDown = new JoinDataComplete(new JoinData() { JoinNumber = 6, JoinSpan = 1 }, + new JoinMetadata() { Label = "Volume Down", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("VolumeMute")] + public JoinDataComplete VolumeMute = new JoinDataComplete(new JoinData() { JoinNumber = 7, JoinSpan = 1 }, + new JoinMetadata() { Label = "Volume Mute", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("VolumeMuteOn")] + public JoinDataComplete VolumeMuteOn = new JoinDataComplete(new JoinData() { JoinNumber = 8, JoinSpan = 1 }, + new JoinMetadata() { Label = "Volume Mute On", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("VolumeMuteOff")] + public JoinDataComplete VolumeMuteOff = new JoinDataComplete(new JoinData() { JoinNumber = 9, JoinSpan = 1 }, + new JoinMetadata() { Label = "Volume Mute Off", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("InputSelectOffset")] + public JoinDataComplete InputSelectOffset = new JoinDataComplete(new JoinData() { JoinNumber = 11, JoinSpan = 10 }, + new JoinMetadata() { Label = "Input Select", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("InputNamesOffset")] + public JoinDataComplete InputNamesOffset = new JoinDataComplete(new JoinData() { JoinNumber = 11, JoinSpan = 10 }, + new JoinMetadata() { Label = "Input Names Offset", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("InputSelect")] + public JoinDataComplete InputSelect = new JoinDataComplete(new JoinData() { JoinNumber = 11, JoinSpan = 1 }, + new JoinMetadata() { Label = "Input Select", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("ButtonVisibilityOffset")] + public JoinDataComplete ButtonVisibilityOffset = new JoinDataComplete(new JoinData() { JoinNumber = 41, JoinSpan = 10 }, + new JoinMetadata() { Label = "Button Visibility Offset", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.DigitalSerial }); + + [JoinName("IsOnline")] + public JoinDataComplete IsOnline = new JoinDataComplete(new JoinData() { JoinNumber = 50, JoinSpan = 1 }, + new JoinMetadata() { Label = "Is Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + public DisplayControllerJoinMap(uint joinStart) + : base(joinStart, typeof(CameraControllerJoinMap)) + { + } + } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmRmcControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmRmcControllerJoinMap.cs index 0bdedbbf..94b9396b 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmRmcControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmRmcControllerJoinMap.cs @@ -37,31 +37,39 @@ namespace PepperDash.Essentials.Core.Bridges /// Reports the EDID serial number value /// public uint EdidSerialNumber { get; set; } - #endregion - - public DmRmcControllerJoinMap() - { - // Digital - IsOnline = 1; - - // Serial - CurrentOutputResolution = 1; - EdidManufacturer = 2; - EdidName = 3; - EdidPrefferedTiming = 4; - EdidSerialNumber = 5; - } - - public override void OffsetJoinNumbers(uint joinStart) - { - var joinOffset = joinStart - 1; - - IsOnline = IsOnline + joinOffset; - CurrentOutputResolution = CurrentOutputResolution + joinOffset; - EdidManufacturer = EdidManufacturer + joinOffset; - EdidName = EdidName + joinOffset; - EdidPrefferedTiming = EdidPrefferedTiming + joinOffset; - EdidSerialNumber = EdidSerialNumber + joinOffset; - } + #endregion + + #region Analogs + public uint AudioVideoSource { get; set; } + #endregion + + public DmRmcControllerJoinMap() + { + // Digital + IsOnline = 1; + + // Serial + CurrentOutputResolution = 1; + EdidManufacturer = 2; + EdidName = 3; + EdidPrefferedTiming = 4; + EdidSerialNumber = 5; + + //Analog + AudioVideoSource = 1; + } + + public override void OffsetJoinNumbers(uint joinStart) + { + var joinOffset = joinStart - 1; + + IsOnline = IsOnline + joinOffset; + CurrentOutputResolution = CurrentOutputResolution + joinOffset; + EdidManufacturer = EdidManufacturer + joinOffset; + EdidName = EdidName + joinOffset; + EdidPrefferedTiming = EdidPrefferedTiming + joinOffset; + EdidSerialNumber = EdidSerialNumber + joinOffset; + AudioVideoSource = AudioVideoSource + joinOffset; + } } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/IBasicCommunicationJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/IBasicCommunicationJoinMap.cs index 3669738e..612ace4f 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/IBasicCommunicationJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/IBasicCommunicationJoinMap.cs @@ -1,67 +1,42 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using PepperDash.Essentials.Core; - -namespace PepperDash.Essentials.Core.Bridges -{ - public class IBasicCommunicationJoinMap : JoinMapBase - { - #region Digitals - /// - /// Set High to connect, Low to disconnect - /// - public uint Connect { get; set; } - /// - /// Reports Connected State (High = Connected) - /// - public uint Connected { get; set; } - #endregion - - #region Analogs - /// - /// Reports the connections status value - /// - public uint Status { get; set; } - #endregion - - #region Serials - /// - /// Data back from port - /// - public uint TextReceived { get; set; } - /// - /// Sends data to the port - /// - public uint SendText { get; set; } - /// - /// Takes a JSON serialized string that sets a COM port's parameters - /// - public uint SetPortConfig { get; set; } - #endregion - - public IBasicCommunicationJoinMap() - { - TextReceived = 1; - SendText = 1; - SetPortConfig = 2; - Connect = 1; - Connected = 1; - Status = 1; - } - - public override void OffsetJoinNumbers(uint joinStart) - { - var joinOffset = joinStart - 1; - - TextReceived = TextReceived + joinOffset; - SendText = SendText + joinOffset; - SetPortConfig = SetPortConfig + joinOffset; - Connect = Connect + joinOffset; - Connected = Connected + joinOffset; - Status = Status + joinOffset; - } - } +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Core.Bridges +{ + public class IBasicCommunicationJoinMap : JoinMapBaseAdvanced + { + [JoinName("TextReceived")] + public JoinDataComplete TextReceived = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "Text Received From Remote Device", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("SendText")] + public JoinDataComplete SendText = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "Text Sent To Remote Device", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("SetPortConfig")] + public JoinDataComplete SetPortConfig = new JoinDataComplete(new JoinData() { JoinNumber = 2, JoinSpan = 1 }, + new JoinMetadata() { Label = "Set Port Config", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("Connect")] + public JoinDataComplete Connect = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "Connect", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Connected")] + public JoinDataComplete Connected = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "Connected", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Status")] + public JoinDataComplete Status = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "Status", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog }); + + + public IBasicCommunicationJoinMap(uint joinStart) + : base(joinStart, typeof(IBasicCommunicationJoinMap)) + { + } + } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericComm.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericComm.cs index 41438832..523ffb78 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericComm.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericComm.cs @@ -1,125 +1,124 @@ -using System; -using System.Collections.Generic; -using Crestron.SimplSharp.CrestronSockets; -using Crestron.SimplSharpPro.DeviceSupport; -using Newtonsoft.Json; - -using PepperDash.Core; -using PepperDash.Essentials.Core.Bridges; -using PepperDash.Essentials.Core.Devices; -using PepperDash.Essentials.Core.Config; - - -namespace PepperDash.Essentials.Core -{ - /// - /// Serves as a generic wrapper class for all styles of IBasicCommuncation ports - /// - [Description("Generic communication wrapper class for any IBasicCommunication type")] - public class GenericComm : ReconfigurableBridgableDevice - { - EssentialsControlPropertiesConfig PropertiesConfig; - - public IBasicCommunication CommPort { get; private set; } - - public GenericComm(DeviceConfig config) - : base(config) - { - PropertiesConfig = CommFactory.GetControlPropertiesConfig(config); - - CommPort = CommFactory.CreateCommForDevice(config); - - } - - public static IKeyed BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "Factory Attempting to create new Generic Comm Device"); - return new GenericComm(dc); - } - - public void SetPortConfig(string portConfig) - { - // TODO: Deserialize new EssentialsControlPropertiesConfig and handle as necessary - try - { - PropertiesConfig = JsonConvert.DeserializeObject - (portConfig); - } - catch (Exception e) - { - Debug.Console(2, this, "Error deserializing port config: {0}", e); - } - } - - protected override void CustomSetConfig(DeviceConfig config) - { - PropertiesConfig = CommFactory.GetControlPropertiesConfig(config); - - ConfigWriter.UpdateDeviceConfig(config); - } - - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) - { - var joinMap = new IBasicCommunicationJoinMap(); - - var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); - - if (!string.IsNullOrEmpty(joinMapSerialized)) - joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - joinMap.OffsetJoinNumbers(joinStart); - - if (CommPort == null) - { - Debug.Console(1, this, "Unable to link device '{0}'. CommPort is null", Key); - return; - } - - Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); - - // this is a permanent event handler. This cannot be -= from event - CommPort.TextReceived += (s, a) => - { - Debug.Console(2, this, "RX: {0}", a.Text); - trilist.SetString(joinMap.TextReceived, a.Text); - }; - trilist.SetStringSigAction(joinMap.SendText, s => CommPort.SendText(s)); - trilist.SetStringSigAction(joinMap.SetPortConfig, SetPortConfig); - - - var sComm = this as ISocketStatus; - if (sComm == null) return; - sComm.ConnectionChange += (s, a) => - { - trilist.SetUshort(joinMap.Status, (ushort)(a.Client.ClientStatus)); - trilist.SetBool(joinMap.Connected, a.Client.ClientStatus == - SocketStatus.SOCKET_STATUS_CONNECTED); - }; - - trilist.SetBoolSigAction(joinMap.Connect, b => - { - if (b) - { - sComm.Connect(); - } - else - { - sComm.Disconnect(); - } - }); - } - } - - public class GenericCommFactory : EssentialsDeviceFactory - { - public GenericCommFactory() - { - TypeNames = new List() { "genericComm" }; - } - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "Factory Attempting to create new Generic Comm Device"); - return new GenericComm(dc); - } - } +using System; +using System.Collections.Generic; +using Crestron.SimplSharp.CrestronSockets; +using Crestron.SimplSharpPro.DeviceSupport; +using Newtonsoft.Json; + +using PepperDash.Core; +using PepperDash.Essentials.Core.Bridges; +using PepperDash.Essentials.Core.Devices; +using PepperDash.Essentials.Core.Config; + + +namespace PepperDash.Essentials.Core +{ + /// + /// Serves as a generic wrapper class for all styles of IBasicCommuncation ports + /// + [Description("Generic communication wrapper class for any IBasicCommunication type")] + public class GenericComm : ReconfigurableBridgableDevice + { + EssentialsControlPropertiesConfig PropertiesConfig; + + public IBasicCommunication CommPort { get; private set; } + + public GenericComm(DeviceConfig config) + : base(config) + { + PropertiesConfig = CommFactory.GetControlPropertiesConfig(config); + + CommPort = CommFactory.CreateCommForDevice(config); + + } + + public static IKeyed BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new Generic Comm Device"); + return new GenericComm(dc); + } + + public void SetPortConfig(string portConfig) + { + // TODO: Deserialize new EssentialsControlPropertiesConfig and handle as necessary + try + { + PropertiesConfig = JsonConvert.DeserializeObject + (portConfig); + } + catch (Exception e) + { + Debug.Console(2, this, "Error deserializing port config: {0}", e); + } + } + + protected override void CustomSetConfig(DeviceConfig config) + { + PropertiesConfig = CommFactory.GetControlPropertiesConfig(config); + + ConfigWriter.UpdateDeviceConfig(config); + } + + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) + { + var joinMap = new IBasicCommunicationJoinMap(joinStart); + + var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); + + if (!string.IsNullOrEmpty(joinMapSerialized)) + joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + + if (CommPort == null) + { + Debug.Console(1, this, "Unable to link device '{0}'. CommPort is null", Key); + return; + } + + Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); + + // this is a permanent event handler. This cannot be -= from event + CommPort.TextReceived += (s, a) => + { + Debug.Console(2, this, "RX: {0}", a.Text); + trilist.SetString(joinMap.TextReceived.JoinNumber, a.Text); + }; + trilist.SetStringSigAction(joinMap.SendText.JoinNumber, s => CommPort.SendText(s)); + trilist.SetStringSigAction(joinMap.SetPortConfig.JoinNumber, SetPortConfig); + + + var sComm = this as ISocketStatus; + if (sComm == null) return; + sComm.ConnectionChange += (s, a) => + { + trilist.SetUshort(joinMap.Status.JoinNumber, (ushort)(a.Client.ClientStatus)); + trilist.SetBool(joinMap.Connected.JoinNumber, a.Client.ClientStatus == + SocketStatus.SOCKET_STATUS_CONNECTED); + }; + + trilist.SetBoolSigAction(joinMap.Connect.JoinNumber, b => + { + if (b) + { + sComm.Connect(); + } + else + { + sComm.Disconnect(); + } + }); + } + } + + public class GenericCommFactory : EssentialsDeviceFactory + { + public GenericCommFactory() + { + TypeNames = new List() { "genericComm" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new Generic Comm Device"); + return new GenericComm(dc); + } + } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs index cf317f40..2dd72340 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs @@ -18,7 +18,7 @@ namespace PepperDash.Essentials.Core /// /// /// - public abstract class DisplayBase : EssentialsDevice, IHasFeedback, IRoutingSinkWithSwitching, IPower, IWarmingCooling, IUsageTracking + public abstract class DisplayBase : EssentialsBridgeableDevice, IHasFeedback, IRoutingSinkWithSwitching, IPower, IWarmingCooling, IUsageTracking { public event SourceInfoChangeHandler CurrentSourceChange; @@ -121,24 +121,22 @@ namespace PepperDash.Essentials.Core var inputNumber = 0; var inputKeys = new List(); - var joinMap = new DisplayControllerJoinMap(); + var joinMap = new DisplayControllerJoinMap(joinStart); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - joinMap.OffsetJoinNumbers(joinStart); - Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); Debug.Console(0, "Linking to Display: {0}", displayDevice.Name); - trilist.StringInput[joinMap.Name].StringValue = displayDevice.Name; + trilist.StringInput[joinMap.Name.JoinNumber].StringValue = displayDevice.Name; var commMonitor = displayDevice as ICommunicationMonitor; if (commMonitor != null) { - commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); + commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]); } var inputNumberFeedback = new IntFeedback(() => inputNumber); @@ -148,16 +146,16 @@ namespace PepperDash.Essentials.Core if (twoWayDisplay != null) { - trilist.SetBool(joinMap.IsTwoWayDisplay, true); + trilist.SetBool(joinMap.IsTwoWayDisplay.JoinNumber, true); twoWayDisplay.CurrentInputFeedback.OutputChange += (o, a) => Debug.Console(0, "CurrentInputFeedback_OutputChange {0}", a.StringValue); - inputNumberFeedback.LinkInputSig(trilist.UShortInput[joinMap.InputSelect]); + inputNumberFeedback.LinkInputSig(trilist.UShortInput[joinMap.InputSelect.JoinNumber]); } // Power Off - trilist.SetSigTrueAction(joinMap.PowerOff, () => + trilist.SetSigTrueAction(joinMap.PowerOff.JoinNumber, () => { inputNumber = 102; inputNumberFeedback.FireUpdate(); @@ -179,10 +177,10 @@ namespace PepperDash.Essentials.Core } }; - displayDevice.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.PowerOff]); + displayDevice.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.PowerOff.JoinNumber]); // PowerOn - trilist.SetSigTrueAction(joinMap.PowerOn, () => + trilist.SetSigTrueAction(joinMap.PowerOn.JoinNumber, () => { inputNumber = 0; inputNumberFeedback.FireUpdate(); @@ -190,21 +188,27 @@ namespace PepperDash.Essentials.Core }); - displayDevice.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PowerOn]); + displayDevice.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PowerOn.JoinNumber]); - var count = 1; - foreach (var input in displayDevice.InputPorts) + for (int i = 0; i < displayDevice.InputPorts.Count; i++) { - inputKeys.Add(input.Key); - var tempKey = inputKeys.ElementAt(count - 1); - trilist.SetSigTrueAction((ushort)(joinMap.InputSelectOffset + count), () => displayDevice.ExecuteSwitch(displayDevice.InputPorts[tempKey].Selector)); - Debug.Console(2, displayDevice, "Setting Input Select Action on Digital Join {0} to Input: {1}", joinMap.InputSelectOffset + count, displayDevice.InputPorts[tempKey].Key.ToString()); - trilist.StringInput[(ushort)(joinMap.InputNamesOffset + count)].StringValue = input.Key.ToString(); - count++; + if (i < joinMap.InputNamesOffset.JoinSpan) + { + inputKeys.Add(displayDevice.InputPorts[i].Key); + var tempKey = inputKeys.ElementAt(i); + trilist.SetSigTrueAction((ushort)(joinMap.InputSelectOffset.JoinNumber + i), + () => displayDevice.ExecuteSwitch(displayDevice.InputPorts[tempKey].Selector)); + Debug.Console(2, displayDevice, "Setting Input Select Action on Digital Join {0} to Input: {1}", + joinMap.InputSelectOffset.JoinNumber + i, displayDevice.InputPorts[tempKey].Key.ToString()); + trilist.StringInput[(ushort)(joinMap.InputNamesOffset.JoinNumber + i)].StringValue = displayDevice.InputPorts[i].Key.ToString(); + } + else + Debug.Console(0, displayDevice, Debug.ErrorLogLevel.Warning, "Device has {0} inputs. The Join Map allows up to {1} inputs. Discarding inputs {2} - {3} from bridge.", + displayDevice.InputPorts.Count, joinMap.InputNamesOffset.JoinSpan, i + 1, displayDevice.InputPorts.Count); } Debug.Console(2, displayDevice, "Setting Input Select Action on Analog Join {0}", joinMap.InputSelect); - trilist.SetUShortSigAction(joinMap.InputSelect, (a) => + trilist.SetUShortSigAction(joinMap.InputSelect.JoinNumber, (a) => { if (a == 0) { @@ -229,17 +233,22 @@ namespace PepperDash.Essentials.Core var volumeDisplay = displayDevice as IBasicVolumeControls; if (volumeDisplay == null) return; - trilist.SetBoolSigAction(joinMap.VolumeUp, volumeDisplay.VolumeUp); - trilist.SetBoolSigAction(joinMap.VolumeDown, volumeDisplay.VolumeDown); - trilist.SetSigTrueAction(joinMap.VolumeMute, volumeDisplay.MuteToggle); + trilist.SetBoolSigAction(joinMap.VolumeUp.JoinNumber, volumeDisplay.VolumeUp); + trilist.SetBoolSigAction(joinMap.VolumeDown.JoinNumber, volumeDisplay.VolumeDown); + trilist.SetSigTrueAction(joinMap.VolumeMute.JoinNumber, volumeDisplay.MuteToggle); var volumeDisplayWithFeedback = volumeDisplay as IBasicVolumeWithFeedback; if (volumeDisplayWithFeedback == null) return; + trilist.SetSigTrueAction(joinMap.VolumeMuteOn.JoinNumber, volumeDisplayWithFeedback.MuteOn); + trilist.SetSigTrueAction(joinMap.VolumeMuteOff.JoinNumber, volumeDisplayWithFeedback.MuteOff); - trilist.SetUShortSigAction(joinMap.VolumeLevel, volumeDisplayWithFeedback.SetVolume); - volumeDisplayWithFeedback.VolumeLevelFeedback.LinkInputSig(trilist.UShortInput[joinMap.VolumeLevel]); - volumeDisplayWithFeedback.MuteFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VolumeMute]); + + trilist.SetUShortSigAction(joinMap.VolumeLevel.JoinNumber, volumeDisplayWithFeedback.SetVolume); + volumeDisplayWithFeedback.VolumeLevelFeedback.LinkInputSig(trilist.UShortInput[joinMap.VolumeLevel.JoinNumber]); + volumeDisplayWithFeedback.MuteFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VolumeMute.JoinNumber]); + volumeDisplayWithFeedback.MuteFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VolumeMuteOn.JoinNumber]); + volumeDisplayWithFeedback.MuteFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.VolumeMuteOff.JoinNumber]); } } diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingInterfaces.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingInterfaces.cs index 0c642d5c..3b288290 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingInterfaces.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingInterfaces.cs @@ -89,6 +89,15 @@ namespace PepperDash.Essentials.Core IntFeedback VideoSourceNumericFeedback { get; } IntFeedback AudioSourceNumericFeedback { get; } void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type); + } + + /// + /// Defines a receiver that has internal routing (DM-RMC-4K-Z-SCALER-C) + /// + public interface IRmcRouting : IRouting + { + IntFeedback AudioVideoSourceNumericFeedback { get; } + void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type); } /// diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZ100CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZ100CController.cs new file mode 100644 index 00000000..33705c0a --- /dev/null +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZ100CController.cs @@ -0,0 +1,79 @@ +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.Endpoints; +using Crestron.SimplSharpPro.DM.Endpoints.Receivers; + +using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; + +namespace PepperDash.Essentials.DM +{ + public class DmRmc4kZ100CController : DmRmcX100CController + { + private readonly DmRmc4kz100C _rmc; + + public DmRmc4kZ100CController(string key, string name, DmRmc4kz100C rmc) + : base(key, name, rmc) + { + _rmc = rmc; + + /* removed this logic because it's done in the base constructor and doesn't need to be duplicated here + DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.DmCat, 0, this); + HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.Hdmi, null, this) {Port = _rmc}; + */ + + // Set Ports for CEC + + //TODO: We need to look at this class inheritance design...not so sure these properties need to be virtual and/or abstract. + EdidManufacturerFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.Manufacturer.StringValue); + EdidNameFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.Name.StringValue); + EdidPreferredTimingFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.PreferredTiming.StringValue); + EdidSerialNumberFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.SerialNumber.StringValue); + + _rmc.HdmiOutput.OutputStreamChange += HdmiOutput_OutputStreamChange; + _rmc.HdmiOutput.ConnectedDevice.DeviceInformationChange += ConnectedDevice_DeviceInformationChange; + } + + void HdmiOutput_OutputStreamChange(EndpointOutputStream outputStream, EndpointOutputStreamEventArgs args) + { + if (args.EventId == EndpointOutputStreamEventIds.HorizontalResolutionFeedbackEventId || args.EventId == EndpointOutputStreamEventIds.VerticalResolutionFeedbackEventId || + args.EventId == EndpointOutputStreamEventIds.FramesPerSecondFeedbackEventId) + { + VideoOutputResolutionFeedback.FireUpdate(); + } + } + + void ConnectedDevice_DeviceInformationChange(ConnectedDeviceInformation connectedDevice, ConnectedDeviceEventArgs args) + { + if (args.EventId == ConnectedDeviceEventIds.ManufacturerEventId) + { + EdidManufacturerFeedback.FireUpdate(); + } + else if (args.EventId == ConnectedDeviceEventIds.NameEventId) + { + EdidNameFeedback.FireUpdate(); + } + else if (args.EventId == ConnectedDeviceEventIds.PreferredTimingEventId) + { + EdidPreferredTimingFeedback.FireUpdate(); + } + else if (args.EventId == ConnectedDeviceEventIds.SerialNumberEventId) + { + EdidSerialNumberFeedback.FireUpdate(); + } + } + + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) + { + LinkDmRmcToApi(this, trilist, joinStart, joinMapKey, bridge); + } + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZScalerCController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZScalerCController.cs new file mode 100644 index 00000000..a42b6771 --- /dev/null +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZScalerCController.cs @@ -0,0 +1,151 @@ +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.Endpoints; +using Crestron.SimplSharpPro.DM.Endpoints.Receivers; + +using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; +using PepperDash.Core; + +namespace PepperDash.Essentials.DM +{ + public class DmRmc4kZScalerCController : DmRmcControllerBase, IRmcRouting, + IIROutputPorts, IComPorts, ICec + { + public DmRmc4kzScalerC Rmc { get; private set; } + + public RoutingInputPort DmIn { get; private set; } + public RoutingInputPort HdmiIn { get; private set; } + public RoutingOutputPort HdmiOut { get; private set; } + + /// + /// The value of the current video source for the HDMI output on the receiver + /// + public IntFeedback AudioVideoSourceNumericFeedback { get; private set; } + + public RoutingPortCollection InputPorts + { + get { return new RoutingPortCollection { DmIn, HdmiIn }; } + } + + public RoutingPortCollection OutputPorts + { + get { return new RoutingPortCollection { HdmiOut }; } + } + + public DmRmc4kZScalerCController(string key, string name, DmRmc4kzScalerC rmc) + : base(key, name, rmc) + { + Rmc = rmc; + DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.DmCat, 0, this); + HdmiIn = new RoutingInputPort(DmPortName.HdmiIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.Hdmi, 0, this); + HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.Hdmi, null, this); + + EdidManufacturerFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.Manufacturer.StringValue); + EdidNameFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.Name.StringValue); + EdidPreferredTimingFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.PreferredTiming.StringValue); + EdidSerialNumberFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.SerialNumber.StringValue); + + VideoOutputResolutionFeedback = new StringFeedback(() => Rmc.HdmiOutput.GetVideoResolutionString()); + + Rmc.HdmiOutput.OutputStreamChange += HdmiOutput_OutputStreamChange; + Rmc.HdmiOutput.ConnectedDevice.DeviceInformationChange += ConnectedDevice_DeviceInformationChange; + + // Set Ports for CEC + HdmiOut.Port = Rmc.HdmiOutput; + + AudioVideoSourceNumericFeedback = new IntFeedback(() => (ushort)(Rmc.SelectedSourceFeedback)); + } + + void HdmiOutput_OutputStreamChange(EndpointOutputStream outputStream, EndpointOutputStreamEventArgs args) + { + if (args.EventId == EndpointOutputStreamEventIds.HorizontalResolutionFeedbackEventId || args.EventId == EndpointOutputStreamEventIds.VerticalResolutionFeedbackEventId || + args.EventId == EndpointOutputStreamEventIds.FramesPerSecondFeedbackEventId) + { + VideoOutputResolutionFeedback.FireUpdate(); + } + + if (args.EventId == EndpointOutputStreamEventIds.SelectedSourceFeedbackEventId) + { + AudioVideoSourceNumericFeedback.FireUpdate(); + } + } + + void ConnectedDevice_DeviceInformationChange(ConnectedDeviceInformation connectedDevice, ConnectedDeviceEventArgs args) + { + if (args.EventId == ConnectedDeviceEventIds.ManufacturerEventId) + { + EdidManufacturerFeedback.FireUpdate(); + } + else if (args.EventId == ConnectedDeviceEventIds.NameEventId) + { + EdidNameFeedback.FireUpdate(); + } + else if (args.EventId == ConnectedDeviceEventIds.PreferredTimingEventId) + { + EdidPreferredTimingFeedback.FireUpdate(); + } + else if (args.EventId == ConnectedDeviceEventIds.SerialNumberEventId) + { + EdidSerialNumberFeedback.FireUpdate(); + } + } + + public override bool CustomActivate() + { + // Base does register and sets up comm monitoring. + return base.CustomActivate(); + } + + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) + { + LinkDmRmcToApi(this, trilist, joinStart, joinMapKey, bridge); + } + + #region IIROutputPorts Members + public CrestronCollection IROutputPorts { get { return Rmc.IROutputPorts; } } + public int NumberOfIROutputPorts { get { return Rmc.NumberOfIROutputPorts; } } + #endregion + + #region IComPorts Members + public CrestronCollection ComPorts { get { return Rmc.ComPorts; } } + public int NumberOfComPorts { get { return Rmc.NumberOfComPorts; } } + #endregion + + #region ICec Members + /// + /// Gets the CEC stream directly from the HDMI port. + /// + public Cec StreamCec { get { return Rmc.HdmiOutput.StreamCec; } } + #endregion + + + #region IRmcRouting Members + public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType) + { + Debug.Console(2, this, "Attempting a route from input {0} to HDMI Output", inputSelector); + + var number = Convert.ToUInt16(inputSelector); + + Rmc.AudioVideoSource = (DmRmc4kzScalerC.eAudioVideoSource)number; + } + + public void ExecuteNumericSwitch(ushort inputSelector, ushort outputSelector, eRoutingSignalType signalType) + { + Debug.Console(2, this, "Attempting a route from input {0} to HDMI Output", inputSelector); + + Rmc.AudioVideoSource = (DmRmc4kzScalerC.eAudioVideoSource)inputSelector; + } + #endregion + + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs index da3e587a..91085fca 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs @@ -1,307 +1,326 @@ -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.Endpoints; -using Crestron.SimplSharpPro.DM.Endpoints.Receivers; -using 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 -{ - [Description("Wrapper class for all DM-RMC variants")] - public abstract class DmRmcControllerBase : CrestronGenericBridgeableBaseDevice - { - public virtual StringFeedback VideoOutputResolutionFeedback { get; protected set; } - public virtual StringFeedback EdidManufacturerFeedback { get; protected set; } - public virtual StringFeedback EdidNameFeedback { get; protected set; } - public virtual StringFeedback EdidPreferredTimingFeedback { get; protected set; } - public virtual StringFeedback EdidSerialNumberFeedback { get; protected set; } - - public DmRmcControllerBase(string key, string name, EndpointReceiverBase device) - : base(key, name, device) - { - // if wired to a chassis, skip registration step in base class - if (device.DMOutput != null) - { - this.PreventRegistration = true; - } - AddToFeedbackList(VideoOutputResolutionFeedback, EdidManufacturerFeedback, EdidSerialNumberFeedback, EdidNameFeedback, EdidPreferredTimingFeedback); - } - - protected void LinkDmRmcToApi(DmRmcControllerBase rmc, BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) - { - var joinMap = new DmRmcControllerJoinMap(); - - var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); - - if (!string.IsNullOrEmpty(joinMapSerialized)) - joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - - joinMap.OffsetJoinNumbers(joinStart); - - Debug.Console(1, rmc, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); - - rmc.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); - if (rmc.VideoOutputResolutionFeedback != null) - rmc.VideoOutputResolutionFeedback.LinkInputSig(trilist.StringInput[joinMap.CurrentOutputResolution]); - if (rmc.EdidManufacturerFeedback != null) - rmc.EdidManufacturerFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidManufacturer]); - if (rmc.EdidNameFeedback != null) - rmc.EdidNameFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidName]); - if (rmc.EdidPreferredTimingFeedback != null) - rmc.EdidPreferredTimingFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidPrefferedTiming]); - if (rmc.EdidSerialNumberFeedback != null) - rmc.EdidSerialNumberFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidSerialNumber]); - } - } - - public abstract class DmHdBaseTControllerBase : CrestronGenericBaseDevice - { - public HDBaseTBase Rmc { get; protected set; } - - /// - /// Make a Crestron RMC and put it in here - /// - public DmHdBaseTControllerBase(string key, string name, HDBaseTBase rmc) - : base(key, name, rmc) - { - - } - } - - public class DmRmcHelper - { - /// - /// A factory method for various DmTxControllers - /// - /// - /// - /// - /// - public static CrestronGenericBaseDevice GetDmRmcController(string key, string name, string typeName, DmRmcPropertiesConfig props) - { - // switch on type name... later... - - typeName = typeName.ToLower(); - uint ipid = props.Control.IpIdInt; // Convert.ToUInt16(props.Id, 16); - - - - // right here, we need to grab the tie line that associates this - // RMC with a chassis or processor. If the RMC input's tie line is not - // connected to a chassis, then it's parent is the processor. - // If the RMC is connected to a chassis, then we need to grab the - // output number from the tie line and use that to plug it in. - // Example of chassis-connected: - //{ - // "sourceKey": "dmMd8x8-1", - // "sourcePort": "anyOut2", - // "destinationKey": "dmRmc100C-2", - // "destinationPort": "DmIn" - //} - - // Tx -> RMC link: - //{ - // "sourceKey": "dmTx201C-1", - // "sourcePort": "DmOut", - // "destinationKey": "dmRmc100C-2", - // "destinationPort": "DmIn" - //} - - var tlc = TieLineCollection.Default; - // grab the tie line that has this key as - // THIS DOESN'T WORK BECAUSE THE RMC THAT WE NEED (THIS) HASN'T BEEN MADE - // YET AND THUS WILL NOT HAVE A TIE LINE... - var inputTieLine = tlc.FirstOrDefault(t => - { - var d = t.DestinationPort.ParentDevice; - return d.Key.Equals(key, StringComparison.OrdinalIgnoreCase) - && d is DmChassisController; - }); - - var pKey = props.ParentDeviceKey.ToLower(); - - - - - // Non-DM-chassis endpoints - if (pKey == "processor") - { - // Catch constructor failures, mainly dues to IPID - try - { - if (typeName.StartsWith("dmrmc100c")) - return new DmRmcX100CController(key, name, new DmRmc100C(ipid, Global.ControlSystem)); - if (typeName.StartsWith("dmrmc100s")) - return new DmRmc100SController(key, name, new DmRmc100S(ipid, Global.ControlSystem)); - if (typeName.StartsWith("dmrmc4k100c")) - return new DmRmcX100CController(key, name, new DmRmc4k100C(ipid, Global.ControlSystem)); - if (typeName.StartsWith("dmrmc4kz100c")) - return new DmRmcX100CController(key, name, new DmRmc4kz100C(ipid, Global.ControlSystem)); - if (typeName.StartsWith("dmrmc150s")) - return new DmRmc150SController(key, name, new DmRmc150S(ipid, Global.ControlSystem)); - if (typeName.StartsWith("dmrmc200c")) - return new DmRmc200CController(key, name, new DmRmc200C(ipid, Global.ControlSystem)); - if (typeName.StartsWith("dmrmc200s")) - return new DmRmc200SController(key, name, new DmRmc200S(ipid, Global.ControlSystem)); - if (typeName.StartsWith("dmrmc200s2")) - return new DmRmc200S2Controller(key, name, new DmRmc200S2(ipid, Global.ControlSystem)); - if (typeName.StartsWith("dmrmcscalerc")) - return new DmRmcScalerCController(key, name, new DmRmcScalerC(ipid, Global.ControlSystem)); - if (typeName.StartsWith("dmrmcscalers")) - return new DmRmcScalerSController(key, name, new DmRmcScalerS(ipid, Global.ControlSystem)); - if (typeName.StartsWith("dmrmcscalers2")) - return new DmRmcScalerS2Controller(key, name, new DmRmcScalerS2(ipid, Global.ControlSystem)); - if (typeName.StartsWith("dmrmc4kscalerc")) - return new DmRmc4kScalerCController(key, name, new DmRmc4kScalerC(ipid, Global.ControlSystem)); - if (typeName.StartsWith("dmrmc4kscalercdsp")) - return new DmRmc4kScalerCDspController(key, name, new DmRmc4kScalerCDsp(ipid, Global.ControlSystem)); - } - catch (Exception e) - { - Debug.Console(0, "[{0}] WARNING: Cannot create DM-RMC device: {1}", key, e.Message); - } - - - Debug.Console(0, "Cannot create DM-RMC of type: '{0}'", typeName); - } - // Endpoints attached to DM Chassis - else - { - var parentDev = DeviceManager.GetDeviceForKey(pKey); - if (!(parentDev is IDmSwitch)) - { - Debug.Console(0, "Cannot create DM device '{0}'. '{1}' is not a DM Chassis.", - key, pKey); - return null; - } - - var chassis = (parentDev as IDmSwitch).Chassis; - var num = props.ParentOutputNumber; - if (num <= 0 || num > chassis.NumberOfOutputs) - { - Debug.Console(0, "Cannot create DM device '{0}'. Output number '{1}' is out of range", - key, num); - return null; - } - else - { - var controller = (parentDev as IDmSwitch); - controller.RxDictionary.Add(num, key); - } - // Catch constructor failures, mainly dues to IPID - try - { - - // Must use different constructor for CPU3 chassis types. No IPID - if (chassis is DmMd8x8Cpu3 || chassis is DmMd16x16Cpu3 || - chassis is DmMd32x32Cpu3 || chassis is DmMd8x8Cpu3rps || - chassis is DmMd16x16Cpu3rps || chassis is DmMd32x32Cpu3rps || - chassis is DmMd128x128 || chassis is DmMd64x64) - { - if (typeName.StartsWith("hdbasetrx")) - return new HDBaseTRxController(key, name, new HDRx3CB(chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc4k100c1g")) - return new DmRmc4k100C1GController(key, name, new DmRmc4K100C1G(chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc100c")) - return new DmRmcX100CController(key, name, new DmRmc100C(chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc100s")) - return new DmRmc100SController(key, name, new DmRmc100S(chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc4k100c")) - return new DmRmcX100CController(key, name, new DmRmc4k100C(chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc4kz100c")) - return new DmRmcX100CController(key, name, new DmRmc4kz100C(chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc150s")) - return new DmRmc150SController(key, name, new DmRmc150S(chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc200c")) - return new DmRmc200CController(key, name, new DmRmc200C(chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc200s")) - return new DmRmc200SController(key, name, new DmRmc200S(chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc200s2")) - return new DmRmc200S2Controller(key, name, new DmRmc200S2(chassis.Outputs[num])); - if (typeName.StartsWith("dmrmcscalerc")) - return new DmRmcScalerCController(key, name, new DmRmcScalerC(chassis.Outputs[num])); - if (typeName.StartsWith("dmrmcscalers")) - return new DmRmcScalerSController(key, name, new DmRmcScalerS(chassis.Outputs[num])); - if (typeName.StartsWith("dmrmcscalers2")) - return new DmRmcScalerS2Controller(key, name, new DmRmcScalerS2(chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc4kscalerc")) - return new DmRmc4kScalerCController(key, name, new DmRmc4kScalerC(chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc4kscalercdsp")) - return new DmRmc4kScalerCDspController(key, name, new DmRmc4kScalerCDsp(chassis.Outputs[num])); - } - else - { - if (typeName.StartsWith("hdbasetrx")) - return new HDBaseTRxController(key, name, new HDRx3CB(ipid, chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc4k100c1g")) - return new DmRmc4k100C1GController(key, name, new DmRmc4K100C1G(ipid, chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc100c")) - return new DmRmcX100CController(key, name, new DmRmc100C(ipid, chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc100s")) - return new DmRmc100SController(key, name, new DmRmc100S(ipid, chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc4k100c")) - return new DmRmcX100CController(key, name, new DmRmc4k100C(ipid, chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc4kz100c")) - return new DmRmcX100CController(key, name, new DmRmc4kz100C(ipid, chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc150s")) - return new DmRmc150SController(key, name, new DmRmc150S(ipid, chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc200c")) - return new DmRmc200CController(key, name, new DmRmc200C(ipid, chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc200s")) - return new DmRmc200SController(key, name, new DmRmc200S(ipid, chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc200s2")) - return new DmRmc200S2Controller(key, name, new DmRmc200S2(ipid, chassis.Outputs[num])); - if (typeName.StartsWith("dmrmcscalerc")) - return new DmRmcScalerCController(key, name, new DmRmcScalerC(ipid, chassis.Outputs[num])); - if (typeName.StartsWith("dmrmcscalers")) - return new DmRmcScalerSController(key, name, new DmRmcScalerS(ipid, chassis.Outputs[num])); - if (typeName.StartsWith("dmrmcscalers2")) - return new DmRmcScalerS2Controller(key, name, new DmRmcScalerS2(ipid, chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc4kscalerc")) - return new DmRmc4kScalerCController(key, name, new DmRmc4kScalerC(ipid, chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc4kscalercdsp")) - return new DmRmc4kScalerCDspController(key, name, new DmRmc4kScalerCDsp(ipid, chassis.Outputs[num])); - } - } - catch (Exception e) - { - Debug.Console(0, "[{0}] WARNING: Cannot create DM-RMC device: {1}", key, e.Message); - } - } - - return null; - } - } - - public class DmRmcControllerFactory : EssentialsDeviceFactory - { - public DmRmcControllerFactory() - { - TypeNames = new List() { "hdbasetrx", "dmrmc4k100c1g", "dmrmc100c", "dmrmc100s", "dmrmc4k100c", "dmrmc150s", - "dmrmc200c", "dmrmc200s", "dmrmc200s2", "dmrmcscalerc", "dmrmcscalers", "dmrmcscalers2", "dmrmc4kscalerc", "dmrmc4kscalercdsp" }; - } - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - var type = dc.Type.ToLower(); - - Debug.Console(1, "Factory Attempting to create new DM-RMC Device"); - - var props = JsonConvert.DeserializeObject - (dc.Properties.ToString()); - return PepperDash.Essentials.DM.DmRmcHelper.GetDmRmcController(dc.Key, dc.Name, type, props); - - } - } - +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.Endpoints; +using Crestron.SimplSharpPro.DM.Endpoints.Receivers; +using 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 +{ + [Description("Wrapper class for all DM-RMC variants")] + public abstract class DmRmcControllerBase : CrestronGenericBridgeableBaseDevice + { + public virtual StringFeedback VideoOutputResolutionFeedback { get; protected set; } + public virtual StringFeedback EdidManufacturerFeedback { get; protected set; } + public virtual StringFeedback EdidNameFeedback { get; protected set; } + public virtual StringFeedback EdidPreferredTimingFeedback { get; protected set; } + public virtual StringFeedback EdidSerialNumberFeedback { get; protected set; } + + protected DmRmcControllerBase(string key, string name, EndpointReceiverBase device) + : base(key, name, device) + { + // if wired to a chassis, skip registration step in base class + if (device.DMOutput != null) + { + this.PreventRegistration = true; + } + AddToFeedbackList(VideoOutputResolutionFeedback, EdidManufacturerFeedback, EdidSerialNumberFeedback, EdidNameFeedback, EdidPreferredTimingFeedback); + } + + protected void LinkDmRmcToApi(DmRmcControllerBase rmc, BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) + { + var joinMap = new DmRmcControllerJoinMap(); + + var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); + + if (!string.IsNullOrEmpty(joinMapSerialized)) + joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + + joinMap.OffsetJoinNumbers(joinStart); + + Debug.Console(1, rmc, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); + + rmc.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); + if (rmc.VideoOutputResolutionFeedback != null) + rmc.VideoOutputResolutionFeedback.LinkInputSig(trilist.StringInput[joinMap.CurrentOutputResolution]); + if (rmc.EdidManufacturerFeedback != null) + rmc.EdidManufacturerFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidManufacturer]); + if (rmc.EdidNameFeedback != null) + rmc.EdidNameFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidName]); + if (rmc.EdidPreferredTimingFeedback != null) + rmc.EdidPreferredTimingFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidPrefferedTiming]); + if (rmc.EdidSerialNumberFeedback != null) + rmc.EdidSerialNumberFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidSerialNumber]); + + //If the device is an DM-RMC-4K-Z-SCALER-C + var routing = rmc as IRmcRouting; + + if (routing != null) + { + if (routing.AudioVideoSourceNumericFeedback != null) + routing.AudioVideoSourceNumericFeedback.LinkInputSig(trilist.UShortInput[joinMap.AudioVideoSource]); + + trilist.SetUShortSigAction(joinMap.AudioVideoSource, (a) => routing.ExecuteNumericSwitch(a, 1, eRoutingSignalType.AudioVideo)); + } + } + } + + public abstract class DmHdBaseTControllerBase : CrestronGenericBaseDevice + { + public HDBaseTBase Rmc { get; protected set; } + + /// + /// Make a Crestron RMC and put it in here + /// + public DmHdBaseTControllerBase(string key, string name, HDBaseTBase rmc) + : base(key, name, rmc) + { + + } + } + + public class DmRmcHelper + { + /// + /// A factory method for various DmTxControllers + /// + /// + /// + /// + /// + public static CrestronGenericBaseDevice GetDmRmcController(string key, string name, string typeName, DmRmcPropertiesConfig props) + { + // switch on type name... later... + + typeName = typeName.ToLower(); + uint ipid = props.Control.IpIdInt; // Convert.ToUInt16(props.Id, 16); + + + + // right here, we need to grab the tie line that associates this + // RMC with a chassis or processor. If the RMC input's tie line is not + // connected to a chassis, then it's parent is the processor. + // If the RMC is connected to a chassis, then we need to grab the + // output number from the tie line and use that to plug it in. + // Example of chassis-connected: + //{ + // "sourceKey": "dmMd8x8-1", + // "sourcePort": "anyOut2", + // "destinationKey": "dmRmc100C-2", + // "destinationPort": "DmIn" + //} + + // Tx -> RMC link: + //{ + // "sourceKey": "dmTx201C-1", + // "sourcePort": "DmOut", + // "destinationKey": "dmRmc100C-2", + // "destinationPort": "DmIn" + //} + + var tlc = TieLineCollection.Default; + // grab the tie line that has this key as + // THIS DOESN'T WORK BECAUSE THE RMC THAT WE NEED (THIS) HASN'T BEEN MADE + // YET AND THUS WILL NOT HAVE A TIE LINE... + var inputTieLine = tlc.FirstOrDefault(t => + { + var d = t.DestinationPort.ParentDevice; + return d.Key.Equals(key, StringComparison.OrdinalIgnoreCase) + && d is DmChassisController; + }); + + var pKey = props.ParentDeviceKey.ToLower(); + + + + + // Non-DM-chassis endpoints + if (pKey == "processor") + { + // Catch constructor failures, mainly dues to IPID + try + { + if (typeName.StartsWith("dmrmc100c")) + return new DmRmcX100CController(key, name, new DmRmc100C(ipid, Global.ControlSystem)); + if (typeName.StartsWith("dmrmc100s")) + return new DmRmc100SController(key, name, new DmRmc100S(ipid, Global.ControlSystem)); + if (typeName.StartsWith("dmrmc4k100c")) + return new DmRmcX100CController(key, name, new DmRmc4k100C(ipid, Global.ControlSystem)); + if (typeName.StartsWith("dmrmc4kz100c")) + return new DmRmc4kZ100CController(key, name, new DmRmc4kz100C(ipid, Global.ControlSystem)); + if (typeName.StartsWith("dmrmc150s")) + return new DmRmc150SController(key, name, new DmRmc150S(ipid, Global.ControlSystem)); + if (typeName.StartsWith("dmrmc200c")) + return new DmRmc200CController(key, name, new DmRmc200C(ipid, Global.ControlSystem)); + if (typeName.StartsWith("dmrmc200s")) + return new DmRmc200SController(key, name, new DmRmc200S(ipid, Global.ControlSystem)); + if (typeName.StartsWith("dmrmc200s2")) + return new DmRmc200S2Controller(key, name, new DmRmc200S2(ipid, Global.ControlSystem)); + if (typeName.StartsWith("dmrmcscalerc")) + return new DmRmcScalerCController(key, name, new DmRmcScalerC(ipid, Global.ControlSystem)); + if (typeName.StartsWith("dmrmcscalers")) + return new DmRmcScalerSController(key, name, new DmRmcScalerS(ipid, Global.ControlSystem)); + if (typeName.StartsWith("dmrmcscalers2")) + return new DmRmcScalerS2Controller(key, name, new DmRmcScalerS2(ipid, Global.ControlSystem)); + if (typeName.StartsWith("dmrmc4kscalerc")) + return new DmRmc4kScalerCController(key, name, new DmRmc4kScalerC(ipid, Global.ControlSystem)); + if (typeName.StartsWith("dmrmc4kscalercdsp")) + return new DmRmc4kScalerCDspController(key, name, new DmRmc4kScalerCDsp(ipid, Global.ControlSystem)); + if (typeName.StartsWith("dmrmc4kzscalerc")) + return new DmRmc4kZScalerCController(key, name, new DmRmc4kzScalerC(ipid, Global.ControlSystem)); + } + catch (Exception e) + { + Debug.Console(0, "[{0}] WARNING: Cannot create DM-RMC device: {1}", key, e.Message); + } + + + Debug.Console(0, "Cannot create DM-RMC of type: '{0}'", typeName); + } + // Endpoints attached to DM Chassis + else + { + var parentDev = DeviceManager.GetDeviceForKey(pKey); + if (!(parentDev is IDmSwitch)) + { + Debug.Console(0, "Cannot create DM device '{0}'. '{1}' is not a DM Chassis.", + key, pKey); + return null; + } + + var chassis = (parentDev as IDmSwitch).Chassis; + var num = props.ParentOutputNumber; + if (num <= 0 || num > chassis.NumberOfOutputs) + { + Debug.Console(0, "Cannot create DM device '{0}'. Output number '{1}' is out of range", + key, num); + return null; + } + else + { + var controller = (parentDev as IDmSwitch); + controller.RxDictionary.Add(num, key); + } + // Catch constructor failures, mainly dues to IPID + try + { + + // Must use different constructor for CPU3 chassis types. No IPID + if (chassis is DmMd8x8Cpu3 || chassis is DmMd16x16Cpu3 || + chassis is DmMd32x32Cpu3 || chassis is DmMd8x8Cpu3rps || + chassis is DmMd16x16Cpu3rps || chassis is DmMd32x32Cpu3rps || + chassis is DmMd128x128 || chassis is DmMd64x64) + { + if (typeName.StartsWith("hdbasetrx")) + return new HDBaseTRxController(key, name, new HDRx3CB(chassis.Outputs[num])); + if (typeName.StartsWith("dmrmc4k100c1g")) + return new DmRmc4k100C1GController(key, name, new DmRmc4K100C1G(chassis.Outputs[num])); + if (typeName.StartsWith("dmrmc100c")) + return new DmRmcX100CController(key, name, new DmRmc100C(chassis.Outputs[num])); + if (typeName.StartsWith("dmrmc100s")) + return new DmRmc100SController(key, name, new DmRmc100S(chassis.Outputs[num])); + if (typeName.StartsWith("dmrmc4k100c")) + return new DmRmcX100CController(key, name, new DmRmc4k100C(chassis.Outputs[num])); + if (typeName.StartsWith("dmrmc4kz100c")) + return new DmRmc4kZ100CController(key, name, new DmRmc4kz100C(chassis.Outputs[num])); + if (typeName.StartsWith("dmrmc150s")) + return new DmRmc150SController(key, name, new DmRmc150S(chassis.Outputs[num])); + if (typeName.StartsWith("dmrmc200c")) + return new DmRmc200CController(key, name, new DmRmc200C(chassis.Outputs[num])); + if (typeName.StartsWith("dmrmc200s")) + return new DmRmc200SController(key, name, new DmRmc200S(chassis.Outputs[num])); + if (typeName.StartsWith("dmrmc200s2")) + return new DmRmc200S2Controller(key, name, new DmRmc200S2(chassis.Outputs[num])); + if (typeName.StartsWith("dmrmcscalerc")) + return new DmRmcScalerCController(key, name, new DmRmcScalerC(chassis.Outputs[num])); + if (typeName.StartsWith("dmrmcscalers")) + return new DmRmcScalerSController(key, name, new DmRmcScalerS(chassis.Outputs[num])); + if (typeName.StartsWith("dmrmcscalers2")) + return new DmRmcScalerS2Controller(key, name, new DmRmcScalerS2(chassis.Outputs[num])); + if (typeName.StartsWith("dmrmc4kscalerc")) + return new DmRmc4kScalerCController(key, name, new DmRmc4kScalerC(chassis.Outputs[num])); + if (typeName.StartsWith("dmrmc4kscalercdsp")) + return new DmRmc4kScalerCDspController(key, name, new DmRmc4kScalerCDsp(chassis.Outputs[num])); + if (typeName.StartsWith("dmrmc4kzscalerc")) + return new DmRmc4kZScalerCController(key, name, new DmRmc4kzScalerC(chassis.Outputs[num])); + } + else + { + if (typeName.StartsWith("hdbasetrx")) + return new HDBaseTRxController(key, name, new HDRx3CB(ipid, chassis.Outputs[num])); + if (typeName.StartsWith("dmrmc4k100c1g")) + return new DmRmc4k100C1GController(key, name, new DmRmc4K100C1G(ipid, chassis.Outputs[num])); + if (typeName.StartsWith("dmrmc100c")) + return new DmRmcX100CController(key, name, new DmRmc100C(ipid, chassis.Outputs[num])); + if (typeName.StartsWith("dmrmc100s")) + return new DmRmc100SController(key, name, new DmRmc100S(ipid, chassis.Outputs[num])); + if (typeName.StartsWith("dmrmc4k100c")) + return new DmRmcX100CController(key, name, new DmRmc4k100C(ipid, chassis.Outputs[num])); + if (typeName.StartsWith("dmrmc4kz100c")) + return new DmRmc4kZ100CController(key, name, new DmRmc4kz100C(ipid, chassis.Outputs[num])); + if (typeName.StartsWith("dmrmc150s")) + return new DmRmc150SController(key, name, new DmRmc150S(ipid, chassis.Outputs[num])); + if (typeName.StartsWith("dmrmc200c")) + return new DmRmc200CController(key, name, new DmRmc200C(ipid, chassis.Outputs[num])); + if (typeName.StartsWith("dmrmc200s")) + return new DmRmc200SController(key, name, new DmRmc200S(ipid, chassis.Outputs[num])); + if (typeName.StartsWith("dmrmc200s2")) + return new DmRmc200S2Controller(key, name, new DmRmc200S2(ipid, chassis.Outputs[num])); + if (typeName.StartsWith("dmrmcscalerc")) + return new DmRmcScalerCController(key, name, new DmRmcScalerC(ipid, chassis.Outputs[num])); + if (typeName.StartsWith("dmrmcscalers")) + return new DmRmcScalerSController(key, name, new DmRmcScalerS(ipid, chassis.Outputs[num])); + if (typeName.StartsWith("dmrmcscalers2")) + return new DmRmcScalerS2Controller(key, name, new DmRmcScalerS2(ipid, chassis.Outputs[num])); + if (typeName.StartsWith("dmrmc4kscalerc")) + return new DmRmc4kScalerCController(key, name, new DmRmc4kScalerC(ipid, chassis.Outputs[num])); + if (typeName.StartsWith("dmrmc4kscalercdsp")) + return new DmRmc4kScalerCDspController(key, name, new DmRmc4kScalerCDsp(ipid, chassis.Outputs[num])); + if (typeName.StartsWith("dmrmc4kzscalerc")) + return new DmRmc4kZScalerCController(key, name, new DmRmc4kzScalerC(chassis.Outputs[num])); + + } + } + catch (Exception e) + { + Debug.Console(0, "[{0}] WARNING: Cannot create DM-RMC device: {1}", key, e.Message); + } + } + + return null; + } + } + + public class DmRmcControllerFactory : EssentialsDeviceFactory + { + public DmRmcControllerFactory() + { + TypeNames = new List() { "hdbasetrx", "dmrmc4k100c1g", "dmrmc100c", "dmrmc100s", "dmrmc4k100c", "dmrmc150s", + "dmrmc200c", "dmrmc200s", "dmrmc200s2", "dmrmcscalerc", "dmrmcscalers", "dmrmcscalers2", "dmrmc4kscalerc", "dmrmc4kscalercdsp", + "dmrmc4kz100c", "dmrmckzscalerc" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + var type = dc.Type.ToLower(); + + Debug.Console(1, "Factory Attempting to create new DM-RMC Device"); + + var props = JsonConvert.DeserializeObject + (dc.Properties.ToString()); + return PepperDash.Essentials.DM.DmRmcHelper.GetDmRmcController(dc.Key, dc.Name, type, props); + + } + } + } \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcX100CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcX100CController.cs index a7260813..16526bc0 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcX100CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcX100CController.cs @@ -21,10 +21,10 @@ namespace PepperDash.Essentials.DM public class DmRmcX100CController : DmRmcControllerBase, IRoutingInputsOutputs, IIROutputPorts, IComPorts, ICec { - public DmRmc100C Rmc { get; private set; } + public DmRmc100C Rmc { get; protected set; } - public RoutingInputPort DmIn { get; private set; } - public RoutingOutputPort HdmiOut { get; private set; } + public RoutingInputPort DmIn { get; protected set; } + public RoutingOutputPort HdmiOut { get; protected set; } public RoutingPortCollection InputPorts { diff --git a/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj b/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj index 7ab8a5a9..e08b30f6 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj +++ b/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj @@ -100,6 +100,8 @@ + + From 12f8cc1c0c805196c5dc7af4f55c6ab7e2027e82 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Wed, 6 May 2020 12:34:37 -0600 Subject: [PATCH 093/156] fixes issue with merging release/v1.5.0 into develop --- .../PepperDashEssentialsBase/Display/DisplayBase.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs index 2dd72340..9f528322 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs @@ -18,7 +18,7 @@ namespace PepperDash.Essentials.Core /// /// /// - public abstract class DisplayBase : EssentialsBridgeableDevice, IHasFeedback, IRoutingSinkWithSwitching, IPower, IWarmingCooling, IUsageTracking + public abstract class DisplayBase : EssentialsDevice, IHasFeedback, IRoutingSinkWithSwitching, IPower, IWarmingCooling, IUsageTracking { public event SourceInfoChangeHandler CurrentSourceChange; From 8499338facf2f62caa143c90fdcd49157cd32ee2 Mon Sep 17 00:00:00 2001 From: ajohnson_pd Date: Wed, 6 May 2020 20:03:07 -0400 Subject: [PATCH 094/156] Adds new feedback type to link Dm-Tx input video sync to generic "input1", "input2", "input3" video sync feedbacks for passing to SIMPL. Updates join map for DmTxController --- .../Bridges/JoinMaps/DmTxControllerJoinMap.cs | 18 +++++++++++++ .../Transmitters/DmTx200Controller.cs | 15 ++++++++++- .../Transmitters/DmTx201CController.cs | 15 ++++++++++- .../Transmitters/DmTx401CController.cs | 21 ++++++++++++++- .../Transmitters/DmTx4k202CController.cs | 15 ++++++++++- .../Transmitters/DmTx4k302CController.cs | 21 ++++++++++++++- .../Transmitters/DmTx4kz302CController.cs | 21 ++++++++++++++- .../Endpoints/Transmitters/DmTxHelpers.cs | 26 +++++++++++++++++++ 8 files changed, 146 insertions(+), 6 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmTxControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmTxControllerJoinMap.cs index b01da694..4818ef80 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmTxControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmTxControllerJoinMap.cs @@ -17,6 +17,18 @@ namespace PepperDash.Essentials.Core.Bridges /// /// public uint FreeRunEnabled { get; set; } + /// + /// High when video sync is detected on input 1 of a multi-input tx + /// + public uint Input1VideoSyncStatus { get; set; } + /// + /// High when video sync is detected on input 2 of a multi-input tx + /// + public uint Input2VideoSyncStatus { get; set; } + /// + /// High when video sync is detected on input 3 of a multi-input tx + /// + public uint Input3VideoSyncStatus { get; set; } #endregion #region Analogs @@ -66,6 +78,9 @@ namespace PepperDash.Essentials.Core.Bridges IsOnline = 1; VideoSyncStatus = 2; FreeRunEnabled = 3; + Input1VideoSyncStatus = 4; + Input2VideoSyncStatus = 5; + Input3VideoSyncStatus = 6; // Serial CurrentInputResolution = 1; // Analog @@ -85,6 +100,9 @@ namespace PepperDash.Essentials.Core.Bridges IsOnline = IsOnline + joinOffset; VideoSyncStatus = VideoSyncStatus + joinOffset; FreeRunEnabled = FreeRunEnabled + joinOffset; + Input1VideoSyncStatus = Input1VideoSyncStatus + joinOffset; + Input2VideoSyncStatus = Input2VideoSyncStatus + joinOffset; + Input3VideoSyncStatus = Input3VideoSyncStatus + joinOffset; CurrentInputResolution = CurrentInputResolution + joinOffset; VideoInput = VideoInput + joinOffset; AudioInput = AudioInput + joinOffset; diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs index 923a7600..7a48e68e 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs @@ -33,6 +33,8 @@ namespace PepperDash.Essentials.DM public IntFeedback VideoSourceNumericFeedback { get; protected set; } public IntFeedback AudioSourceNumericFeedback { get; protected set; } public IntFeedback HdmiInHdcpCapabilityFeedback { get; protected set; } + public BoolFeedback In1VideoSyncFeedback { get; protected set; } + public BoolFeedback In2VideoSyncFeedback { get; protected set; } public BoolFeedback FreeRunEnabledFeedback { get; protected set; } @@ -127,6 +129,16 @@ namespace PepperDash.Essentials.DM HdcpSupportCapability = eHdcpCapabilityType.HdcpAutoSupport; + In1VideoSyncFeedback = new BoolFeedback("In1VideoSync", () => + { + return (bool)tx.HdmiInput.SyncDetectedFeedback.BoolValue; + }); + + In2VideoSyncFeedback = new BoolFeedback("In2VideoSync", () => + { + return (bool)tx.VgaInput.SyncDetectedFeedback.BoolValue; + }); + FreeRunEnabledFeedback = new BoolFeedback(() => tx.VgaInput.FreeRunFeedback == eDmFreeRunSetting.Enabled); VgaBrightnessFeedback = new IntFeedback(() => tx.VgaInput.VideoControls.BrightnessFeedback.UShortValue); @@ -174,7 +186,8 @@ namespace PepperDash.Essentials.DM AddToFeedbackList(ActiveVideoInputFeedback, VideoSourceNumericFeedback, AudioSourceNumericFeedback, AnyVideoInput.VideoStatus.HasVideoStatusFeedback, AnyVideoInput.VideoStatus.HdcpActiveFeedback, AnyVideoInput.VideoStatus.HdcpStateFeedback, AnyVideoInput.VideoStatus.VideoResolutionFeedback, - AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiInHdcpCapabilityFeedback); + AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiInHdcpCapabilityFeedback, In1VideoSyncFeedback, + In2VideoSyncFeedback); // Set Ports for CEC HdmiInput.Port = Tx.HdmiInput; diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs index e68a6fc5..5ea68369 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs @@ -34,6 +34,8 @@ namespace PepperDash.Essentials.DM public IntFeedback VideoSourceNumericFeedback { get; protected set; } public IntFeedback AudioSourceNumericFeedback { get; protected set; } public IntFeedback HdmiInHdcpCapabilityFeedback { get; protected set; } + public BoolFeedback In1VideoSyncFeedback { get; protected set; } + public BoolFeedback In2VideoSyncFeedback { get; protected set; } public BoolFeedback FreeRunEnabledFeedback { get; protected set; } @@ -126,6 +128,16 @@ namespace PepperDash.Essentials.DM return 0; }); + In1VideoSyncFeedback = new BoolFeedback("In1VideoSync", () => + { + return (bool)tx.HdmiInput.SyncDetectedFeedback.BoolValue; + }); + + In2VideoSyncFeedback = new BoolFeedback("In2VideoSync", () => + { + return (bool)tx.VgaInput.SyncDetectedFeedback.BoolValue; + }); + FreeRunEnabledFeedback = new BoolFeedback(() => tx.VgaInput.FreeRunFeedback == eDmFreeRunSetting.Enabled); VgaBrightnessFeedback = new IntFeedback(() => tx.VgaInput.VideoControls.BrightnessFeedback.UShortValue); @@ -176,7 +188,8 @@ namespace PepperDash.Essentials.DM AddToFeedbackList(ActiveVideoInputFeedback, VideoSourceNumericFeedback, AudioSourceNumericFeedback, AnyVideoInput.VideoStatus.HasVideoStatusFeedback, AnyVideoInput.VideoStatus.HdcpActiveFeedback, AnyVideoInput.VideoStatus.HdcpStateFeedback, AnyVideoInput.VideoStatus.VideoResolutionFeedback, - AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiInHdcpCapabilityFeedback); + AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiInHdcpCapabilityFeedback, In1VideoSyncFeedback, + In2VideoSyncFeedback); // Set Ports for CEC HdmiInput.Port = Tx.HdmiInput; diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs index 25c16281..38e97eb8 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs @@ -35,6 +35,9 @@ namespace PepperDash.Essentials.DM public IntFeedback VideoSourceNumericFeedback { get; protected set; } public IntFeedback AudioSourceNumericFeedback { get; protected set; } public IntFeedback HdmiInHdcpCapabilityFeedback { get; protected set; } + public BoolFeedback In1VideoSyncFeedback { get; protected set; } + public BoolFeedback In2VideoSyncFeedback { get; protected set; } + public BoolFeedback In3VideoSyncFeedback { get; protected set; } public BoolFeedback FreeRunEnabledFeedback { get; protected set; } @@ -137,6 +140,21 @@ namespace PepperDash.Essentials.DM HdcpSupportCapability = eHdcpCapabilityType.HdcpAutoSupport; + In1VideoSyncFeedback = new BoolFeedback("In1VideoSync", () => + { + return (bool)tx.HdmiInput.SyncDetectedFeedback.BoolValue; + }); + + In2VideoSyncFeedback = new BoolFeedback("In2VideoSync", () => + { + return (bool)tx.DisplayPortInput.SyncDetectedFeedback.BoolValue; + }); + + In3VideoSyncFeedback = new BoolFeedback("In3VideoSync", () => + { + return (bool)tx.VgaInput.SyncDetectedFeedback.BoolValue; + }); + FreeRunEnabledFeedback = new BoolFeedback(() => tx.VgaInput.FreeRunFeedback == eDmFreeRunSetting.Enabled); VgaBrightnessFeedback = new IntFeedback(() => tx.VgaInput.VideoControls.BrightnessFeedback.UShortValue); @@ -193,7 +211,8 @@ namespace PepperDash.Essentials.DM AddToFeedbackList(ActiveVideoInputFeedback, VideoSourceNumericFeedback, AudioSourceNumericFeedback, AnyVideoInput.VideoStatus.HasVideoStatusFeedback, AnyVideoInput.VideoStatus.HdcpActiveFeedback, AnyVideoInput.VideoStatus.HdcpStateFeedback, AnyVideoInput.VideoStatus.VideoResolutionFeedback, - AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiInHdcpCapabilityFeedback); + AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiInHdcpCapabilityFeedback, In1VideoSyncFeedback, + In2VideoSyncFeedback, In3VideoSyncFeedback); // Set Ports for CEC DisplayPortIn.Port = Tx.DisplayPortInput; diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k202CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k202CController.cs index 1b5ecf6d..4acc4085 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k202CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k202CController.cs @@ -35,6 +35,8 @@ namespace PepperDash.Essentials.DM public IntFeedback AudioSourceNumericFeedback { get; protected set; } public IntFeedback HdmiIn1HdcpCapabilityFeedback { get; protected set; } public IntFeedback HdmiIn2HdcpCapabilityFeedback { get; protected set; } + public BoolFeedback In1VideoSyncFeedback { get; protected set; } + public BoolFeedback In2VideoSyncFeedback { get; protected set; } //public override IntFeedback HdcpSupportAllFeedback { get; protected set; } //public override ushort HdcpSupportCapability { get; protected set; } @@ -119,6 +121,16 @@ namespace PepperDash.Essentials.DM HdcpSupportCapability = eHdcpCapabilityType.Hdcp2_2Support; + In1VideoSyncFeedback = new BoolFeedback("In1VideoSync", () => + { + return (bool)tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue; + }); + + In2VideoSyncFeedback = new BoolFeedback("In2VideoSync", () => + { + return (bool)tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue; + }); + var combinedFuncs = new VideoStatusFuncsWrapper { HdcpActiveFeedbackFunc = () => @@ -164,7 +176,8 @@ namespace PepperDash.Essentials.DM AddToFeedbackList(ActiveVideoInputFeedback, VideoSourceNumericFeedback, AudioSourceNumericFeedback, AnyVideoInput.VideoStatus.HasVideoStatusFeedback, AnyVideoInput.VideoStatus.HdcpActiveFeedback, AnyVideoInput.VideoStatus.HdcpStateFeedback, AnyVideoInput.VideoStatus.VideoResolutionFeedback, - AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiIn1HdcpCapabilityFeedback, HdmiIn2HdcpCapabilityFeedback); + AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiIn1HdcpCapabilityFeedback, HdmiIn2HdcpCapabilityFeedback, + In1VideoSyncFeedback, In2VideoSyncFeedback); // Set Ports for CEC HdmiIn1.Port = Tx.HdmiInputs[1]; diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k302CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k302CController.cs index 5d00a32d..42d47877 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k302CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k302CController.cs @@ -36,6 +36,9 @@ namespace PepperDash.Essentials.DM public IntFeedback AudioSourceNumericFeedback { get; protected set; } public IntFeedback HdmiIn1HdcpCapabilityFeedback { get; protected set; } public IntFeedback HdmiIn2HdcpCapabilityFeedback { get; protected set; } + public BoolFeedback In1VideoSyncFeedback { get; protected set; } + public BoolFeedback In2VideoSyncFeedback { get; protected set; } + public BoolFeedback In3VideoSyncFeedback { get; protected set; } public BoolFeedback FreeRunEnabledFeedback { get; protected set; } @@ -126,6 +129,21 @@ namespace PepperDash.Essentials.DM HdcpSupportCapability = eHdcpCapabilityType.Hdcp2_2Support; + In1VideoSyncFeedback = new BoolFeedback("In1VideoSync", () => + { + return (bool)tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue; + }); + + In2VideoSyncFeedback = new BoolFeedback("In2VideoSync", () => + { + return (bool)tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue; + }); + + In3VideoSyncFeedback = new BoolFeedback("In3VideoSync", () => + { + return (bool)tx.VgaInput.SyncDetectedFeedback.BoolValue; + }); + FreeRunEnabledFeedback = new BoolFeedback(() => tx.VgaInput.FreeRunFeedback == eDmFreeRunSetting.Enabled); VgaBrightnessFeedback = new IntFeedback(() => tx.VgaInput.VideoControls.BrightnessFeedback.UShortValue); @@ -183,7 +201,8 @@ namespace PepperDash.Essentials.DM AddToFeedbackList(ActiveVideoInputFeedback, VideoSourceNumericFeedback, AudioSourceNumericFeedback, AnyVideoInput.VideoStatus.HasVideoStatusFeedback, AnyVideoInput.VideoStatus.HdcpActiveFeedback, AnyVideoInput.VideoStatus.HdcpStateFeedback, AnyVideoInput.VideoStatus.VideoResolutionFeedback, - AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiIn1HdcpCapabilityFeedback, HdmiIn2HdcpCapabilityFeedback); + AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiIn1HdcpCapabilityFeedback, HdmiIn2HdcpCapabilityFeedback, + In1VideoSyncFeedback, In2VideoSyncFeedback, In3VideoSyncFeedback); // Set Ports for CEC HdmiIn1.Port = Tx.HdmiInputs[1]; diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz302CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz302CController.cs index 27340407..640ae40e 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz302CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz302CController.cs @@ -36,6 +36,9 @@ namespace PepperDash.Essentials.DM public IntFeedback AudioSourceNumericFeedback { get; protected set; } public IntFeedback HdmiIn1HdcpCapabilityFeedback { get; protected set; } public IntFeedback HdmiIn2HdcpCapabilityFeedback { get; protected set; } + public BoolFeedback In1VideoSyncFeedback { get; protected set; } + public BoolFeedback In2VideoSyncFeedback { get; protected set; } + public BoolFeedback In3VideoSyncFeedback { get; protected set; } //public override IntFeedback HdcpSupportAllFeedback { get; protected set; } //public override ushort HdcpSupportCapability { get; protected set; } @@ -124,6 +127,21 @@ namespace PepperDash.Essentials.DM HdcpSupportCapability = eHdcpCapabilityType.Hdcp2_2Support; + In1VideoSyncFeedback = new BoolFeedback("In1VideoSync", () => + { + return (bool)tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue; + }); + + In2VideoSyncFeedback = new BoolFeedback("In2VideoSync", () => + { + return (bool)tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue; + }); + + In3VideoSyncFeedback = new BoolFeedback("In3VideoSync", () => + { + return (bool)tx.DisplayPortInput.SyncDetectedFeedback.BoolValue; + }); + var combinedFuncs = new VideoStatusFuncsWrapper { @@ -174,7 +192,8 @@ namespace PepperDash.Essentials.DM AddToFeedbackList(ActiveVideoInputFeedback, VideoSourceNumericFeedback, AudioSourceNumericFeedback, AnyVideoInput.VideoStatus.HasVideoStatusFeedback, AnyVideoInput.VideoStatus.HdcpActiveFeedback, AnyVideoInput.VideoStatus.HdcpStateFeedback, AnyVideoInput.VideoStatus.VideoResolutionFeedback, - AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiIn1HdcpCapabilityFeedback, HdmiIn2HdcpCapabilityFeedback); + AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiIn1HdcpCapabilityFeedback, HdmiIn2HdcpCapabilityFeedback, + In1VideoSyncFeedback, In2VideoSyncFeedback, In3VideoSyncFeedback); // Set Ports for CEC HdmiIn1.Port = Tx.HdmiInputs[1]; diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs index 81a56008..5895b6fe 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs @@ -217,6 +217,25 @@ namespace PepperDash.Essentials.DM trilist.UShortInput[joinMap.HdcpSupportCapability].UShortValue = (ushort)tx.HdcpSupportCapability; + if (tx.Feedbacks["In1VideoSyncFeedback"] != null) + { + var boolFeedback = tx.Feedbacks["In1VideoSyncFeedback"] as BoolFeedback; + if (boolFeedback != null) + boolFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input1VideoSyncStatus]); + } + if (tx.Feedbacks["In2VideoSyncFeedback"] != null) + { + var boolFeedback = tx.Feedbacks["In1VideoSyncFeedback"] as BoolFeedback; + if (boolFeedback != null) + boolFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input2VideoSyncStatus]); + } + if (tx.Feedbacks["In3VideoSyncFeedback"] != null) + { + var boolFeedback = tx.Feedbacks["In1VideoSyncFeedback"] as BoolFeedback; + if (boolFeedback != null) + boolFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input3VideoSyncStatus]); + } + if (txR.InputPorts[DmPortName.HdmiIn] != null) { var inputPort = txR.InputPorts[DmPortName.HdmiIn]; @@ -228,6 +247,13 @@ namespace PepperDash.Essentials.DM intFeedback.LinkInputSig(trilist.UShortInput[joinMap.Port1HdcpState]); } + if (tx.Feedbacks["HdmiInHdcpCapability"] != null) + { + var intFeedback = tx.Feedbacks["HdmiInHdcpCapability"] as IntFeedback; + if (intFeedback != null) + intFeedback.LinkInputSig(trilist.UShortInput[joinMap.Port1HdcpState]); + } + if (inputPort.ConnectionType == eRoutingPortConnectionType.Hdmi && inputPort.Port != null) { var port = inputPort.Port as EndpointHdmiInput; From 31536e7f9790fec6d5f7dfa6e689e18bb2832e4e Mon Sep 17 00:00:00 2001 From: Alex Johnson Date: Wed, 6 May 2020 21:28:38 -0400 Subject: [PATCH 095/156] Removes accidental duplication of code --- .../Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs index 5895b6fe..ee9a18e9 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs @@ -247,13 +247,6 @@ namespace PepperDash.Essentials.DM intFeedback.LinkInputSig(trilist.UShortInput[joinMap.Port1HdcpState]); } - if (tx.Feedbacks["HdmiInHdcpCapability"] != null) - { - var intFeedback = tx.Feedbacks["HdmiInHdcpCapability"] as IntFeedback; - if (intFeedback != null) - intFeedback.LinkInputSig(trilist.UShortInput[joinMap.Port1HdcpState]); - } - if (inputPort.ConnectionType == eRoutingPortConnectionType.Hdmi && inputPort.Port != null) { var port = inputPort.Port as EndpointHdmiInput; From 8f440c3cb9beb21702bb05ba5de44018fed223f8 Mon Sep 17 00:00:00 2001 From: Alex Johnson Date: Thu, 7 May 2020 11:27:07 -0400 Subject: [PATCH 096/156] Fixes mapping for DM-TX-401 where displayport=1 and hdmi=2 --- .../Endpoints/Transmitters/DmTx401CController.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs index 38e97eb8..c0c2b47e 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs @@ -142,12 +142,12 @@ namespace PepperDash.Essentials.DM In1VideoSyncFeedback = new BoolFeedback("In1VideoSync", () => { - return (bool)tx.HdmiInput.SyncDetectedFeedback.BoolValue; + return (bool)tx.DisplayPortInput.SyncDetectedFeedback.BoolValue; }); In2VideoSyncFeedback = new BoolFeedback("In2VideoSync", () => { - return (bool)tx.DisplayPortInput.SyncDetectedFeedback.BoolValue; + return (bool)tx.HdmiInput.SyncDetectedFeedback.BoolValue; }); In3VideoSyncFeedback = new BoolFeedback("In3VideoSync", () => From b9bc3bd0f324498c5608d77041a56b2d0580e5ab Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Thu, 7 May 2020 11:19:55 -0500 Subject: [PATCH 097/156] Updated AirMediaController and AirMediaControllerJoinMap --- .../JoinMaps/AirMediaControllerJoinMap.cs | 156 +++------ .../AirMedia/AirMediaController.cs | 36 +- .../PepperDash_Essentials_DM.csproj | 320 +++++++++--------- 3 files changed, 233 insertions(+), 279 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/AirMediaControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/AirMediaControllerJoinMap.cs index 1c091233..9a9c56d2 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/AirMediaControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/AirMediaControllerJoinMap.cs @@ -6,105 +6,61 @@ using Crestron.SimplSharp; using PepperDash.Essentials.Core; namespace PepperDash.Essentials.Core.Bridges -{ - public class AirMediaControllerJoinMap : JoinMapBase - { - #region Digitals - /// - /// Indicates that the device is online when high - /// - public uint IsOnline { get; set; } - /// - /// Indicates that the device is in session when high - /// - public uint IsInSession { get; set; } - /// - /// Indicates sync detected on HDMI input when high - /// - public uint HdmiVideoSync { get; set; } - /// - /// Set High to enable automatic input routing and low to disable. Feedback high when enabled - /// - public uint AutomaticInputRoutingEnabled { get; set; } - #endregion - - #region Analogs - /// - /// Selects source and provides feedback - /// - public uint VideoOut { get; set; } - /// - /// Provided error feedback - /// - public uint ErrorFB { get; set; } - /// - /// Indicates the number of connected users as feedback - /// - public uint NumberOfUsersConnectedFB { get; set; } - /// - /// Sets the login code and provides the current code as feedback - /// - public uint LoginCode { get; set; } - #endregion - - #region Serials - /// - /// Provides the name defined in config as feedback - /// - public uint Name { get; set; } - /// - /// Provides the connection address as feedback - /// - public uint ConnectionAddressFB { get; set; } - /// - /// Provides the hostname as feedback - /// - public uint HostnameFB { get; set; } - /// - /// Provides the serial number as feedback - /// - public uint SerialNumberFeedback { get; set; } - #endregion - - public AirMediaControllerJoinMap() - { - // Digital - IsOnline = 1; - IsInSession = 2; - HdmiVideoSync = 3; - AutomaticInputRoutingEnabled = 4; - - // Analog - VideoOut = 1; - ErrorFB = 2; - NumberOfUsersConnectedFB = 3; - LoginCode = 4; - - // Serial - Name = 1; - ConnectionAddressFB = 2; - HostnameFB = 3; - SerialNumberFeedback = 4; - } - - public override void OffsetJoinNumbers(uint joinStart) - { - var joinOffset = joinStart - 1; - - IsOnline = IsOnline + joinOffset; - IsInSession = IsInSession + joinOffset; - HdmiVideoSync = HdmiVideoSync + joinOffset; - AutomaticInputRoutingEnabled = AutomaticInputRoutingEnabled + joinOffset; - - VideoOut = VideoOut + joinOffset; - ErrorFB = ErrorFB + joinOffset; - NumberOfUsersConnectedFB = NumberOfUsersConnectedFB + joinOffset; - LoginCode = LoginCode + joinOffset; - - Name = Name + joinOffset; - ConnectionAddressFB = ConnectionAddressFB + joinOffset; - HostnameFB = HostnameFB + joinOffset; - SerialNumberFeedback = SerialNumberFeedback + joinOffset; - } +{ + public class AirMediaControllerJoinMap : JoinMapBaseAdvanced + { + [JoinName("IsOnline")] + public JoinDataComplete IsOnline = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "Air Media Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("IsInSession")] + public JoinDataComplete IsInSession = new JoinDataComplete(new JoinData() { JoinNumber = 2, JoinSpan = 1 }, + new JoinMetadata() { Label = "Air Media In Sharing Session", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("HdmiVideoSync")] + public JoinDataComplete HdmiVideoSync = new JoinDataComplete(new JoinData() { JoinNumber = 3, JoinSpan = 1 }, + new JoinMetadata() { Label = "Air Media Has HDMI Video Sync", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("AutomaticInputRoutingEnabled")] + public JoinDataComplete AutomaticInputRoutingEnabled = new JoinDataComplete(new JoinData() { JoinNumber = 4, JoinSpan = 1 }, + new JoinMetadata() { Label = "Air Media Automatic Input Routing Enable(d)", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("VideoOut")] + public JoinDataComplete VideoOut = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "Air Media Video Route Select / Feedback", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("ErrorFB")] + public JoinDataComplete ErrorFB = new JoinDataComplete(new JoinData() { JoinNumber = 2, JoinSpan = 1 }, + new JoinMetadata() { Label = "Air Media Error Status", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("NumberOfUsersConnectedFB")] + public JoinDataComplete NumberOfUsersConnectedFB = new JoinDataComplete(new JoinData() { JoinNumber = 3, JoinSpan = 1 }, + new JoinMetadata() { Label = "Air Media Number of Users Connected", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("LoginCode")] + public JoinDataComplete LoginCode = new JoinDataComplete(new JoinData() { JoinNumber = 4, JoinSpan = 1 }, + new JoinMetadata() { Label = "Air Media Login Code Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("Name")] + public JoinDataComplete Name = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "Air Media Device Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("ConnectionAddressFB")] + public JoinDataComplete ConnectionAddressFB = new JoinDataComplete(new JoinData() { JoinNumber = 2, JoinSpan = 1 }, + new JoinMetadata() { Label = "Air Media IP Address", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("HostnameFB")] + public JoinDataComplete HostnameFB = new JoinDataComplete(new JoinData() { JoinNumber = 3, JoinSpan = 1 }, + new JoinMetadata() { Label = "Air Media Hostname", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("SerialNumberFeedback")] + public JoinDataComplete SerialNumberFeedback = new JoinDataComplete(new JoinData() { JoinNumber = 4, JoinSpan = 1 }, + new JoinMetadata() { Label = "Air Media Serial Number", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + public AirMediaControllerJoinMap(uint joinStart) + : base(joinStart, typeof(AirMediaControllerJoinMap)) + { + } + } } \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs b/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs index 8823ae75..7dbacb84 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs @@ -103,43 +103,41 @@ namespace PepperDash.Essentials.DM.AirMedia public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { - var joinMap = new AirMediaControllerJoinMap(); + var joinMap = new AirMediaControllerJoinMap(joinStart); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - joinMap.OffsetJoinNumbers(joinStart); - Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); Debug.Console(0, "Linking to Airmedia: {0}", Name); - trilist.StringInput[joinMap.Name].StringValue = Name; + trilist.StringInput[joinMap.Name.JoinNumber].StringValue = Name; var commMonitor = this as ICommunicationMonitor; - commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); + commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]); - IsInSessionFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsInSession]); - HdmiVideoSyncDetectedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.HdmiVideoSync]); + IsInSessionFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsInSession.JoinNumber]); + HdmiVideoSyncDetectedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.HdmiVideoSync.JoinNumber]); - trilist.SetSigTrueAction(joinMap.AutomaticInputRoutingEnabled, AirMedia.DisplayControl.EnableAutomaticRouting); - trilist.SetSigFalseAction(joinMap.AutomaticInputRoutingEnabled, AirMedia.DisplayControl.DisableAutomaticRouting); - AutomaticInputRoutingEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.AutomaticInputRoutingEnabled]); + 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, (u) => SelectVideoOut(u)); + trilist.SetUShortSigAction(joinMap.VideoOut.JoinNumber, (u) => SelectVideoOut(u)); - VideoOutFeedback.LinkInputSig(trilist.UShortInput[joinMap.VideoOut]); - ErrorFeedback.LinkInputSig(trilist.UShortInput[joinMap.ErrorFB]); - NumberOfUsersConnectedFeedback.LinkInputSig(trilist.UShortInput[joinMap.NumberOfUsersConnectedFB]); + 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, (u) => AirMedia.AirMedia.LoginCode.UShortValue = u); - LoginCodeFeedback.LinkInputSig(trilist.UShortInput[joinMap.LoginCode]); + trilist.SetUShortSigAction(joinMap.LoginCode.JoinNumber, (u) => AirMedia.AirMedia.LoginCode.UShortValue = u); + LoginCodeFeedback.LinkInputSig(trilist.UShortInput[joinMap.LoginCode.JoinNumber]); - ConnectionAddressFeedback.LinkInputSig(trilist.StringInput[joinMap.ConnectionAddressFB]); - HostnameFeedback.LinkInputSig(trilist.StringInput[joinMap.HostnameFB]); - SerialNumberFeedback.LinkInputSig(trilist.StringInput[joinMap.SerialNumberFeedback]); + ConnectionAddressFeedback.LinkInputSig(trilist.StringInput[joinMap.ConnectionAddressFB.JoinNumber]); + HostnameFeedback.LinkInputSig(trilist.StringInput[joinMap.HostnameFB.JoinNumber]); + SerialNumberFeedback.LinkInputSig(trilist.StringInput[joinMap.SerialNumberFeedback.JoinNumber]); } void AirMedia_AirMediaChange(object sender, Crestron.SimplSharpPro.DeviceSupport.GenericEventArgs args) diff --git a/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj b/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj index e08b30f6..8467f92a 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj +++ b/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj @@ -1,161 +1,161 @@ - - - Release - AnyCPU - 9.0.30729 - 2.0 - {9199CE8A-0C9F-4952-8672-3EED798B284F} - Library - Properties - PepperDash_Essentials_DM - PepperDash_Essentials_DM - {0B4745B0-194B-4BB6-8E21-E9057CA92300};{4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - WindowsCE - E2BECB1F-8C8C-41ba-B736-9BE7D946A398 - 5.0 - SmartDeviceProject1 - v3.5 - Windows CE - - - - - .allowedReferenceRelatedFileExtensions - true - full - false - bin\ - DEBUG;TRACE; - prompt - 4 - 512 - true - true - off - - - .allowedReferenceRelatedFileExtensions - none - true - bin\ - prompt - 4 - 512 - true - true - off - - - - False - ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.DeviceSupport.dll - - - False - ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.DM.dll - - - False - ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.UI.dll - - - - False - ..\..\pepperdashcore-builds\PepperDash_Core.dll - - - False - ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpCustomAttributesInterface.dll - False - - - False - ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpHelperInterface.dll - False - - - False - ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpNewtonsoft.dll - - - False - ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpPro.exe - False - - - False - ..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpReflectionInterface.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5} - PepperDash_Essentials_Core - - - - - - - - - rem S# Pro preparation will execute after these operations - + + + Release + AnyCPU + 9.0.30729 + 2.0 + {9199CE8A-0C9F-4952-8672-3EED798B284F} + Library + Properties + PepperDash_Essentials_DM + PepperDash_Essentials_DM + {0B4745B0-194B-4BB6-8E21-E9057CA92300};{4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + WindowsCE + E2BECB1F-8C8C-41ba-B736-9BE7D946A398 + 5.0 + SmartDeviceProject1 + v3.5 + Windows CE + + + + + .allowedReferenceRelatedFileExtensions + true + full + false + bin\ + DEBUG;TRACE; + prompt + 4 + 512 + true + true + off + + + .allowedReferenceRelatedFileExtensions + none + true + bin\ + prompt + 4 + 512 + true + true + off + + + + False + ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.DeviceSupport.dll + + + False + ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.DM.dll + + + False + ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.UI.dll + + + + False + ..\..\pepperdashcore-builds\PepperDash_Core.dll + + + False + ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpCustomAttributesInterface.dll + False + + + False + ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpHelperInterface.dll + False + + + False + ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpNewtonsoft.dll + + + False + ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpPro.exe + False + + + False + ..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpReflectionInterface.dll + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5} + PepperDash_Essentials_Core + + + + + + + + + rem S# Pro preparation will execute after these operations + \ No newline at end of file From 72ec4de9125267ae16ba51a18ef7124e37231e99 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Thu, 7 May 2020 11:28:08 -0500 Subject: [PATCH 098/156] Updated AppleTv and AppleTvJoinMap --- .../Bridges/JoinMaps/AppleTvJoinMap.cs | 87 +++++++------------ .../Streaming/AppleTV.cs | 20 ++--- 2 files changed, 42 insertions(+), 65 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/AppleTvJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/AppleTvJoinMap.cs index aae9e37b..1b11ebd8 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/AppleTvJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/AppleTvJoinMap.cs @@ -7,61 +7,40 @@ using PepperDash.Essentials.Core; namespace PepperDash.Essentials.Core.Bridges { - public class AppleTvJoinMap : JoinMapBase - { - #region Digitals - /// - /// Sends up arrow command while high - /// - public uint UpArrow { get; set; } - /// - /// Sends down arrow command while high - /// - public uint DnArrow { get; set; } - /// - /// Sends left arrow command while high - /// - public uint LeftArrow { get; set; } - /// - /// Sends right arrow command while high - /// - public uint RightArrow { get; set; } - /// - /// Sends menu command - /// - public uint Menu { get; set; } - /// - /// Sends select command - /// - public uint Select { get; set; } - /// - /// Sends play/pause command - /// - public uint PlayPause { get; set; } - #endregion - - public AppleTvJoinMap() - { - UpArrow = 1; - DnArrow = 2; - LeftArrow = 3; - RightArrow = 4; - Menu = 5; - Select = 6; - PlayPause = 7; + public class AppleTvJoinMap : JoinMapBaseAdvanced + { + [JoinName("UpArrow")] + public JoinDataComplete UpArrow = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "AppleTv Nav Up", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("DnArrow")] + public JoinDataComplete DnArrow = new JoinDataComplete(new JoinData() { JoinNumber = 2, JoinSpan = 1 }, + new JoinMetadata() { Label = "AppleTv Nav Down", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("LeftArrow")] + public JoinDataComplete LeftArrow = new JoinDataComplete(new JoinData() { JoinNumber = 3, JoinSpan = 1 }, + new JoinMetadata() { Label = "AppleTv Nav Left", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("RightArrow")] + public JoinDataComplete RightArrow = new JoinDataComplete(new JoinData() { JoinNumber = 4, JoinSpan = 1 }, + new JoinMetadata() { Label = "AppleTv Nav Right", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Menu")] + public JoinDataComplete Menu = new JoinDataComplete(new JoinData() { JoinNumber = 5, JoinSpan = 1 }, + new JoinMetadata() { Label = "AppleTv Menu", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Select")] + public JoinDataComplete Select = new JoinDataComplete(new JoinData() { JoinNumber = 6, JoinSpan = 1 }, + new JoinMetadata() { Label = "AppleTv Select", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("PlayPause")] + public JoinDataComplete PlayPause = new JoinDataComplete(new JoinData() { JoinNumber = 7, JoinSpan = 1 }, + new JoinMetadata() { Label = "AppleTv Play/Pause", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + public AppleTvJoinMap(uint joinStart) + : base(joinStart, typeof(AppleTvJoinMap)) + { } - public override void OffsetJoinNumbers(uint joinStart) - { - var joinOffset = joinStart - 1; - - UpArrow = UpArrow + joinOffset; - DnArrow = DnArrow + joinOffset; - LeftArrow = LeftArrow + joinOffset; - RightArrow = RightArrow + joinOffset; - Menu = Menu + joinOffset; - Select = Select + joinOffset; - PlayPause = PlayPause + joinOffset; - } } } \ No newline at end of file diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Streaming/AppleTV.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Streaming/AppleTV.cs index 1182d312..89850376 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Streaming/AppleTV.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Streaming/AppleTV.cs @@ -145,26 +145,24 @@ namespace PepperDash.Essentials.Devices.Common #endregion public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) - { - var joinMap = new AppleTvJoinMap(); + { + var joinMap = new AppleTvJoinMap(joinStart); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - joinMap.OffsetJoinNumbers(joinStart); - Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); Debug.Console(0, "Linking to Bridge Type {0}", GetType().Name); - trilist.SetBoolSigAction(joinMap.UpArrow, Up); - trilist.SetBoolSigAction(joinMap.DnArrow, Down); - trilist.SetBoolSigAction(joinMap.LeftArrow, Left); - trilist.SetBoolSigAction(joinMap.RightArrow, Right); - trilist.SetBoolSigAction(joinMap.Select, Select); - trilist.SetBoolSigAction(joinMap.Menu, Menu); - trilist.SetBoolSigAction(joinMap.PlayPause, Play); + trilist.SetBoolSigAction(joinMap.UpArrow.JoinNumber, Up); + trilist.SetBoolSigAction(joinMap.DnArrow.JoinNumber, Down); + trilist.SetBoolSigAction(joinMap.LeftArrow.JoinNumber, Left); + trilist.SetBoolSigAction(joinMap.RightArrow.JoinNumber, Right); + trilist.SetBoolSigAction(joinMap.Select.JoinNumber, Select); + trilist.SetBoolSigAction(joinMap.Menu.JoinNumber, Menu); + trilist.SetBoolSigAction(joinMap.PlayPause.JoinNumber, Play); } } From d8671ea73f762743f67aab33a0a5b8170fa88f9d Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Thu, 7 May 2020 11:38:41 -0500 Subject: [PATCH 099/156] Updated C2nRthsController and C2nRthsControllerJoinMap --- .../JoinMaps/C2nRthsControllerJoinMap.cs | 59 ++++++++----------- .../Crestron IO/C2nRts/C2nRthsController.cs | 21 +++---- 2 files changed, 36 insertions(+), 44 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/C2nRthsControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/C2nRthsControllerJoinMap.cs index 2ef315b5..29e37906 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/C2nRthsControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/C2nRthsControllerJoinMap.cs @@ -4,40 +4,31 @@ using PepperDash.Essentials.Core; namespace PepperDash.Essentials.Core.Bridges { - public class C2nRthsControllerJoinMap:JoinMapBase - { - public uint IsOnline { get; set; } - public uint Name { get; set; } - public uint Temperature { get; set; } - public uint Humidity { get; set; } - public uint TemperatureFormat { get; set; } - - public C2nRthsControllerJoinMap() - { - //digital - IsOnline = 1; - TemperatureFormat = 2; - - //Analog - Temperature = 2; - Humidity = 3; - - //serial - Name = 1; - - - } - - public override void OffsetJoinNumbers(uint joinStart) - { - var joinOffset = joinStart - 1; - var properties = - GetType().GetCType().GetProperties().Where(p => p.PropertyType == typeof(uint)).ToList(); - - foreach (var propertyInfo in properties) - { - propertyInfo.SetValue(this, (uint)propertyInfo.GetValue(this, null) + joinOffset, null); - } + public class C2nRthsControllerJoinMap : JoinMapBaseAdvanced + { + [JoinName("IsOnline")] + public JoinDataComplete IsOnline = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "Temp Sensor Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("TemperatureFormat")] + public JoinDataComplete TemperatureFormat = new JoinDataComplete(new JoinData() { JoinNumber = 2, JoinSpan = 1 }, + new JoinMetadata() { Label = "Temp Sensor Unit Format", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Temperature")] + public JoinDataComplete Temperature = new JoinDataComplete(new JoinData() { JoinNumber = 2, JoinSpan = 1 }, + new JoinMetadata() { Label = "Temp Sensor Temperature Feedback", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("Humidity")] + public JoinDataComplete Humidity = new JoinDataComplete(new JoinData() { JoinNumber = 3, JoinSpan = 1 }, + new JoinMetadata() { Label = "Temp Sensor Humidity Feedback", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("Name")] + public JoinDataComplete Name = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "Temp Sensor Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + public C2nRthsControllerJoinMap(uint joinStart) + : base(joinStart, typeof(C2nRthsControllerJoinMap)) + { } } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/C2nRts/C2nRthsController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/C2nRts/C2nRthsController.cs index 0bc48d80..01f1ae8d 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/C2nRts/C2nRthsController.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/C2nRts/C2nRthsController.cs @@ -47,26 +47,27 @@ namespace PepperDash.Essentials.Core.CrestronIO } public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) - { - var joinMap = new C2nRthsControllerJoinMap(); + { + var joinMap = new C2nRthsControllerJoinMap(joinStart); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - joinMap.OffsetJoinNumbers(joinStart); Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); - trilist.SetBoolSigAction(joinMap.TemperatureFormat, SetTemperatureFormat); - - IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); - TemperatureFeedback.LinkInputSig(trilist.UShortInput[joinMap.Temperature]); - HumidityFeedback.LinkInputSig(trilist.UShortInput[joinMap.Humidity]); - - trilist.StringInput[joinMap.Name].StringValue = Name; + trilist.SetBoolSigAction(joinMap.TemperatureFormat.JoinNumber, SetTemperatureFormat); + + + + IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]); + TemperatureFeedback.LinkInputSig(trilist.UShortInput[joinMap.Temperature.JoinNumber]); + HumidityFeedback.LinkInputSig(trilist.UShortInput[joinMap.Humidity.JoinNumber]); + + trilist.StringInput[joinMap.Name.JoinNumber].StringValue = Name; } } From f91930930b1f8dfeeb7d763d01ea1369463cd5c1 Mon Sep 17 00:00:00 2001 From: Alex Johnson Date: Thu, 7 May 2020 13:23:20 -0400 Subject: [PATCH 100/156] Changes Dm-Tx video sync feedback to be specific to port type (hdmi, dp, vga). Moves linking to Api join map into the tx specific LinkToApi() --- .../Transmitters/DmTx200Controller.cs | 25 ++++++++++----- .../Transmitters/DmTx201CController.cs | 25 ++++++++++----- .../Transmitters/DmTx401CController.cs | 29 +++++++++++------ .../Transmitters/DmTx4k100Controller.cs | 4 ++- .../Transmitters/DmTx4k202CController.cs | 23 ++++++++++---- .../Transmitters/DmTx4k302CController.cs | 31 ++++++++++++++----- .../Transmitters/DmTx4kz302CController.cs | 31 ++++++++++++++----- .../Endpoints/Transmitters/DmTxHelpers.cs | 29 +++++------------ 8 files changed, 129 insertions(+), 68 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs index 7a48e68e..13963fa4 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs @@ -33,8 +33,8 @@ namespace PepperDash.Essentials.DM public IntFeedback VideoSourceNumericFeedback { get; protected set; } public IntFeedback AudioSourceNumericFeedback { get; protected set; } public IntFeedback HdmiInHdcpCapabilityFeedback { get; protected set; } - public BoolFeedback In1VideoSyncFeedback { get; protected set; } - public BoolFeedback In2VideoSyncFeedback { get; protected set; } + public BoolFeedback HdmiVideoSyncFeedback { get; protected set; } + public BoolFeedback VgaVideoSyncFeedback { get; protected set; } public BoolFeedback FreeRunEnabledFeedback { get; protected set; } @@ -129,12 +129,12 @@ namespace PepperDash.Essentials.DM HdcpSupportCapability = eHdcpCapabilityType.HdcpAutoSupport; - In1VideoSyncFeedback = new BoolFeedback("In1VideoSync", () => + HdmiVideoSyncFeedback = new BoolFeedback(() => { return (bool)tx.HdmiInput.SyncDetectedFeedback.BoolValue; }); - In2VideoSyncFeedback = new BoolFeedback("In2VideoSync", () => + VgaVideoSyncFeedback = new BoolFeedback(() => { return (bool)tx.VgaInput.SyncDetectedFeedback.BoolValue; }); @@ -186,8 +186,8 @@ namespace PepperDash.Essentials.DM AddToFeedbackList(ActiveVideoInputFeedback, VideoSourceNumericFeedback, AudioSourceNumericFeedback, AnyVideoInput.VideoStatus.HasVideoStatusFeedback, AnyVideoInput.VideoStatus.HdcpActiveFeedback, AnyVideoInput.VideoStatus.HdcpStateFeedback, AnyVideoInput.VideoStatus.VideoResolutionFeedback, - AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiInHdcpCapabilityFeedback, In1VideoSyncFeedback, - In2VideoSyncFeedback); + AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiInHdcpCapabilityFeedback, HdmiVideoSyncFeedback, + VgaVideoSyncFeedback); // Set Ports for CEC HdmiInput.Port = Tx.HdmiInput; @@ -233,7 +233,18 @@ namespace PepperDash.Essentials.DM public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { - LinkDmTxToApi(this, trilist, joinStart, joinMapKey, bridge); + DmTxControllerJoinMap joinMap = GetDmTxJoinMap(joinStart, joinMapKey); + + if (HdmiVideoSyncFeedback != null) + { + HdmiVideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input1VideoSyncStatus]); + } + if (VgaVideoSyncFeedback != null) + { + VgaVideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input2VideoSyncStatus]); + } + + LinkDmTxToApi(this, trilist, joinMap, bridge); } /// diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs index 5ea68369..ceebb32a 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs @@ -34,8 +34,8 @@ namespace PepperDash.Essentials.DM public IntFeedback VideoSourceNumericFeedback { get; protected set; } public IntFeedback AudioSourceNumericFeedback { get; protected set; } public IntFeedback HdmiInHdcpCapabilityFeedback { get; protected set; } - public BoolFeedback In1VideoSyncFeedback { get; protected set; } - public BoolFeedback In2VideoSyncFeedback { get; protected set; } + public BoolFeedback HdmiVideoSyncFeedback { get; protected set; } + public BoolFeedback VgaVideoSyncFeedback { get; protected set; } public BoolFeedback FreeRunEnabledFeedback { get; protected set; } @@ -128,12 +128,12 @@ namespace PepperDash.Essentials.DM return 0; }); - In1VideoSyncFeedback = new BoolFeedback("In1VideoSync", () => + HdmiVideoSyncFeedback = new BoolFeedback(() => { return (bool)tx.HdmiInput.SyncDetectedFeedback.BoolValue; }); - In2VideoSyncFeedback = new BoolFeedback("In2VideoSync", () => + VgaVideoSyncFeedback = new BoolFeedback(() => { return (bool)tx.VgaInput.SyncDetectedFeedback.BoolValue; }); @@ -188,8 +188,8 @@ namespace PepperDash.Essentials.DM AddToFeedbackList(ActiveVideoInputFeedback, VideoSourceNumericFeedback, AudioSourceNumericFeedback, AnyVideoInput.VideoStatus.HasVideoStatusFeedback, AnyVideoInput.VideoStatus.HdcpActiveFeedback, AnyVideoInput.VideoStatus.HdcpStateFeedback, AnyVideoInput.VideoStatus.VideoResolutionFeedback, - AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiInHdcpCapabilityFeedback, In1VideoSyncFeedback, - In2VideoSyncFeedback); + AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiInHdcpCapabilityFeedback, HdmiVideoSyncFeedback, + VgaVideoSyncFeedback); // Set Ports for CEC HdmiInput.Port = Tx.HdmiInput; @@ -235,7 +235,18 @@ namespace PepperDash.Essentials.DM public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { - LinkDmTxToApi(this, trilist, joinStart, joinMapKey, bridge); + DmTxControllerJoinMap joinMap = GetDmTxJoinMap(joinStart, joinMapKey); + + if (HdmiVideoSyncFeedback != null) + { + HdmiVideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input1VideoSyncStatus]); + } + if (VgaVideoSyncFeedback != null) + { + VgaVideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input2VideoSyncStatus]); + } + + LinkDmTxToApi(this, trilist, joinMap, bridge); } /// diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs index c0c2b47e..ac65e90e 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs @@ -35,9 +35,9 @@ namespace PepperDash.Essentials.DM public IntFeedback VideoSourceNumericFeedback { get; protected set; } public IntFeedback AudioSourceNumericFeedback { get; protected set; } public IntFeedback HdmiInHdcpCapabilityFeedback { get; protected set; } - public BoolFeedback In1VideoSyncFeedback { get; protected set; } - public BoolFeedback In2VideoSyncFeedback { get; protected set; } - public BoolFeedback In3VideoSyncFeedback { get; protected set; } + public BoolFeedback DisplayPortVideoSyncFeedback { get; protected set; } + public BoolFeedback HdmiVideoSyncFeedback { get; protected set; } + public BoolFeedback VgaVideoSyncFeedback { get; protected set; } public BoolFeedback FreeRunEnabledFeedback { get; protected set; } @@ -140,17 +140,17 @@ namespace PepperDash.Essentials.DM HdcpSupportCapability = eHdcpCapabilityType.HdcpAutoSupport; - In1VideoSyncFeedback = new BoolFeedback("In1VideoSync", () => + DisplayPortVideoSyncFeedback = new BoolFeedback("DisplayPortVideoSync", () => { return (bool)tx.DisplayPortInput.SyncDetectedFeedback.BoolValue; }); - In2VideoSyncFeedback = new BoolFeedback("In2VideoSync", () => + HdmiVideoSyncFeedback = new BoolFeedback(() => { return (bool)tx.HdmiInput.SyncDetectedFeedback.BoolValue; }); - In3VideoSyncFeedback = new BoolFeedback("In3VideoSync", () => + VgaVideoSyncFeedback = new BoolFeedback(() => { return (bool)tx.VgaInput.SyncDetectedFeedback.BoolValue; }); @@ -211,8 +211,8 @@ namespace PepperDash.Essentials.DM AddToFeedbackList(ActiveVideoInputFeedback, VideoSourceNumericFeedback, AudioSourceNumericFeedback, AnyVideoInput.VideoStatus.HasVideoStatusFeedback, AnyVideoInput.VideoStatus.HdcpActiveFeedback, AnyVideoInput.VideoStatus.HdcpStateFeedback, AnyVideoInput.VideoStatus.VideoResolutionFeedback, - AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiInHdcpCapabilityFeedback, In1VideoSyncFeedback, - In2VideoSyncFeedback, In3VideoSyncFeedback); + AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiInHdcpCapabilityFeedback, DisplayPortVideoSyncFeedback, + HdmiVideoSyncFeedback, VgaVideoSyncFeedback); // Set Ports for CEC DisplayPortIn.Port = Tx.DisplayPortInput; @@ -238,7 +238,18 @@ namespace PepperDash.Essentials.DM public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { - LinkDmTxToApi(this, trilist, joinStart, joinMapKey, bridge); + DmTxControllerJoinMap joinMap = GetDmTxJoinMap(joinStart, joinMapKey); + + if (HdmiVideoSyncFeedback != null) + { + HdmiVideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input1VideoSyncStatus]); + } + if (VgaVideoSyncFeedback != null) + { + VgaVideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input2VideoSyncStatus]); + } + + LinkDmTxToApi(this, trilist, joinMap, bridge); } public void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k100Controller.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k100Controller.cs index c62d0adf..12889528 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k100Controller.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k100Controller.cs @@ -72,7 +72,9 @@ namespace PepperDash.Essentials.DM public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { - LinkDmTxToApi(this, trilist, joinStart, joinMapKey, bridge); + DmTxControllerJoinMap joinMap = GetDmTxJoinMap(joinStart, joinMapKey); + + LinkDmTxToApi(this, trilist, joinMap, bridge); } #region IIROutputPorts Members diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k202CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k202CController.cs index 4acc4085..2121d2bb 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k202CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k202CController.cs @@ -35,8 +35,8 @@ namespace PepperDash.Essentials.DM public IntFeedback AudioSourceNumericFeedback { get; protected set; } public IntFeedback HdmiIn1HdcpCapabilityFeedback { get; protected set; } public IntFeedback HdmiIn2HdcpCapabilityFeedback { get; protected set; } - public BoolFeedback In1VideoSyncFeedback { get; protected set; } - public BoolFeedback In2VideoSyncFeedback { get; protected set; } + public BoolFeedback Hdmi1VideoSyncFeedback { get; protected set; } + public BoolFeedback Hdmi2VideoSyncFeedback { get; protected set; } //public override IntFeedback HdcpSupportAllFeedback { get; protected set; } //public override ushort HdcpSupportCapability { get; protected set; } @@ -121,12 +121,12 @@ namespace PepperDash.Essentials.DM HdcpSupportCapability = eHdcpCapabilityType.Hdcp2_2Support; - In1VideoSyncFeedback = new BoolFeedback("In1VideoSync", () => + Hdmi1VideoSyncFeedback = new BoolFeedback(() => { return (bool)tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue; }); - In2VideoSyncFeedback = new BoolFeedback("In2VideoSync", () => + Hdmi2VideoSyncFeedback = new BoolFeedback(() => { return (bool)tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue; }); @@ -177,7 +177,7 @@ namespace PepperDash.Essentials.DM AnyVideoInput.VideoStatus.HasVideoStatusFeedback, AnyVideoInput.VideoStatus.HdcpActiveFeedback, AnyVideoInput.VideoStatus.HdcpStateFeedback, AnyVideoInput.VideoStatus.VideoResolutionFeedback, AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiIn1HdcpCapabilityFeedback, HdmiIn2HdcpCapabilityFeedback, - In1VideoSyncFeedback, In2VideoSyncFeedback); + Hdmi1VideoSyncFeedback, Hdmi2VideoSyncFeedback); // Set Ports for CEC HdmiIn1.Port = Tx.HdmiInputs[1]; @@ -203,7 +203,18 @@ namespace PepperDash.Essentials.DM public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { - LinkDmTxToApi(this, trilist, joinStart, joinMapKey, bridge); + DmTxControllerJoinMap joinMap = GetDmTxJoinMap(joinStart, joinMapKey); + + if (Hdmi1VideoSyncFeedback != null) + { + Hdmi1VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input1VideoSyncStatus]); + } + if (Hdmi2VideoSyncFeedback != null) + { + Hdmi2VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input2VideoSyncStatus]); + } + + LinkDmTxToApi(this, trilist, joinMap, bridge); } public void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k302CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k302CController.cs index 42d47877..58e8e301 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k302CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k302CController.cs @@ -36,9 +36,9 @@ namespace PepperDash.Essentials.DM public IntFeedback AudioSourceNumericFeedback { get; protected set; } public IntFeedback HdmiIn1HdcpCapabilityFeedback { get; protected set; } public IntFeedback HdmiIn2HdcpCapabilityFeedback { get; protected set; } - public BoolFeedback In1VideoSyncFeedback { get; protected set; } - public BoolFeedback In2VideoSyncFeedback { get; protected set; } - public BoolFeedback In3VideoSyncFeedback { get; protected set; } + public BoolFeedback Hdmi1VideoSyncFeedback { get; protected set; } + public BoolFeedback Hdmi2VideoSyncFeedback { get; protected set; } + public BoolFeedback VgaVideoSyncFeedback { get; protected set; } public BoolFeedback FreeRunEnabledFeedback { get; protected set; } @@ -129,17 +129,17 @@ namespace PepperDash.Essentials.DM HdcpSupportCapability = eHdcpCapabilityType.Hdcp2_2Support; - In1VideoSyncFeedback = new BoolFeedback("In1VideoSync", () => + Hdmi1VideoSyncFeedback = new BoolFeedback(() => { return (bool)tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue; }); - In2VideoSyncFeedback = new BoolFeedback("In2VideoSync", () => + Hdmi2VideoSyncFeedback = new BoolFeedback(() => { return (bool)tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue; }); - In3VideoSyncFeedback = new BoolFeedback("In3VideoSync", () => + VgaVideoSyncFeedback = new BoolFeedback(() => { return (bool)tx.VgaInput.SyncDetectedFeedback.BoolValue; }); @@ -202,7 +202,7 @@ namespace PepperDash.Essentials.DM AnyVideoInput.VideoStatus.HasVideoStatusFeedback, AnyVideoInput.VideoStatus.HdcpActiveFeedback, AnyVideoInput.VideoStatus.HdcpStateFeedback, AnyVideoInput.VideoStatus.VideoResolutionFeedback, AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiIn1HdcpCapabilityFeedback, HdmiIn2HdcpCapabilityFeedback, - In1VideoSyncFeedback, In2VideoSyncFeedback, In3VideoSyncFeedback); + Hdmi1VideoSyncFeedback, Hdmi2VideoSyncFeedback, VgaVideoSyncFeedback); // Set Ports for CEC HdmiIn1.Port = Tx.HdmiInputs[1]; @@ -246,7 +246,22 @@ namespace PepperDash.Essentials.DM public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { - LinkDmTxToApi(this, trilist, joinStart, joinMapKey, bridge); + DmTxControllerJoinMap joinMap = GetDmTxJoinMap(joinStart, joinMapKey); + + if (Hdmi1VideoSyncFeedback != null) + { + Hdmi1VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input1VideoSyncStatus]); + } + if (Hdmi2VideoSyncFeedback != null) + { + Hdmi2VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input2VideoSyncStatus]); + } + if (VgaVideoSyncFeedback != null) + { + VgaVideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input3VideoSyncStatus]); + } + + LinkDmTxToApi(this, trilist, joinMap, bridge); } /// diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz302CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz302CController.cs index 640ae40e..38810eed 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz302CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz302CController.cs @@ -36,9 +36,9 @@ namespace PepperDash.Essentials.DM public IntFeedback AudioSourceNumericFeedback { get; protected set; } public IntFeedback HdmiIn1HdcpCapabilityFeedback { get; protected set; } public IntFeedback HdmiIn2HdcpCapabilityFeedback { get; protected set; } - public BoolFeedback In1VideoSyncFeedback { get; protected set; } - public BoolFeedback In2VideoSyncFeedback { get; protected set; } - public BoolFeedback In3VideoSyncFeedback { get; protected set; } + public BoolFeedback Hdmi1VideoSyncFeedback { get; protected set; } + public BoolFeedback Hdmi2VideoSyncFeedback { get; protected set; } + public BoolFeedback DisplayPortVideoSyncFeedback { get; protected set; } //public override IntFeedback HdcpSupportAllFeedback { get; protected set; } //public override ushort HdcpSupportCapability { get; protected set; } @@ -127,17 +127,17 @@ namespace PepperDash.Essentials.DM HdcpSupportCapability = eHdcpCapabilityType.Hdcp2_2Support; - In1VideoSyncFeedback = new BoolFeedback("In1VideoSync", () => + Hdmi1VideoSyncFeedback = new BoolFeedback(() => { return (bool)tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue; }); - In2VideoSyncFeedback = new BoolFeedback("In2VideoSync", () => + Hdmi2VideoSyncFeedback = new BoolFeedback(() => { return (bool)tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue; }); - In3VideoSyncFeedback = new BoolFeedback("In3VideoSync", () => + DisplayPortVideoSyncFeedback = new BoolFeedback(() => { return (bool)tx.DisplayPortInput.SyncDetectedFeedback.BoolValue; }); @@ -193,7 +193,7 @@ namespace PepperDash.Essentials.DM AnyVideoInput.VideoStatus.HasVideoStatusFeedback, AnyVideoInput.VideoStatus.HdcpActiveFeedback, AnyVideoInput.VideoStatus.HdcpStateFeedback, AnyVideoInput.VideoStatus.VideoResolutionFeedback, AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiIn1HdcpCapabilityFeedback, HdmiIn2HdcpCapabilityFeedback, - In1VideoSyncFeedback, In2VideoSyncFeedback, In3VideoSyncFeedback); + Hdmi1VideoSyncFeedback, Hdmi2VideoSyncFeedback, DisplayPortVideoSyncFeedback); // Set Ports for CEC HdmiIn1.Port = Tx.HdmiInputs[1]; @@ -222,7 +222,22 @@ namespace PepperDash.Essentials.DM public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { - LinkDmTxToApi(this, trilist, joinStart, joinMapKey, bridge); + DmTxControllerJoinMap joinMap = GetDmTxJoinMap(joinStart, joinMapKey); + + if (Hdmi1VideoSyncFeedback != null) + { + Hdmi1VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input1VideoSyncStatus]); + } + if (Hdmi2VideoSyncFeedback != null) + { + Hdmi2VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input2VideoSyncStatus]); + } + if (DisplayPortVideoSyncFeedback != null) + { + DisplayPortVideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input3VideoSyncStatus]); + } + + LinkDmTxToApi(this, trilist, joinMap, bridge); } public void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs index ee9a18e9..d9f156bd 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs @@ -171,9 +171,8 @@ namespace PepperDash.Essentials.DM { } - protected void LinkDmTxToApi(DmTxControllerBase tx, BasicTriList trilist, uint joinStart, string joinMapKey, - EiscApiAdvanced bridge) - { + protected DmTxControllerJoinMap GetDmTxJoinMap(uint joinStart, string joinMapKey) + { var joinMap = new DmTxControllerJoinMap(); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); @@ -183,6 +182,11 @@ namespace PepperDash.Essentials.DM joinMap.OffsetJoinNumbers(joinStart); + return joinMap; + } + + protected void LinkDmTxToApi(DmTxControllerBase tx, BasicTriList trilist, DmTxControllerJoinMap joinMap, EiscApiAdvanced bridge) + { if (tx.Hardware is DmHDBasedTEndPoint) { Debug.Console(1, tx, "No properties to link. Skipping device {0}", tx.Name); @@ -217,25 +221,6 @@ namespace PepperDash.Essentials.DM trilist.UShortInput[joinMap.HdcpSupportCapability].UShortValue = (ushort)tx.HdcpSupportCapability; - if (tx.Feedbacks["In1VideoSyncFeedback"] != null) - { - var boolFeedback = tx.Feedbacks["In1VideoSyncFeedback"] as BoolFeedback; - if (boolFeedback != null) - boolFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input1VideoSyncStatus]); - } - if (tx.Feedbacks["In2VideoSyncFeedback"] != null) - { - var boolFeedback = tx.Feedbacks["In1VideoSyncFeedback"] as BoolFeedback; - if (boolFeedback != null) - boolFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input2VideoSyncStatus]); - } - if (tx.Feedbacks["In3VideoSyncFeedback"] != null) - { - var boolFeedback = tx.Feedbacks["In1VideoSyncFeedback"] as BoolFeedback; - if (boolFeedback != null) - boolFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input3VideoSyncStatus]); - } - if (txR.InputPorts[DmPortName.HdmiIn] != null) { var inputPort = txR.InputPorts[DmPortName.HdmiIn]; From 3a03fa31e832ac8cbc6e47ca80b73adcd660f3aa Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Thu, 7 May 2020 12:30:22 -0500 Subject: [PATCH 101/156] Added [Obsolete] flag to Digitallogger and DigitalLoggerJoinMap. At direction of Jason A, it will be moved into a plugin and removed from essentials entirely in a future update. --- .../Bridges/JoinMaps/DigitalLoggerJoinMap.cs | 93 +++++++++---------- .../Power Controllers/Digitallogger.cs | 8 +- 2 files changed, 51 insertions(+), 50 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DigitalLoggerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DigitalLoggerJoinMap.cs index df90a18b..13123ca0 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DigitalLoggerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DigitalLoggerJoinMap.cs @@ -1,48 +1,47 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; - -using PepperDash.Essentials.Core; - -namespace PepperDash.Essentials.Core.Bridges -{ - public class DigitalLoggerJoinMap : JoinMapBase - { - public uint IsOnline { get; set; } - public uint CircuitNames { get; set; } - public uint CircuitState { get; set; } - public uint CircuitCycle { get; set; } - public uint CircuitIsCritical { get; set; } - public uint CircuitOnCmd { get; set; } - public uint CircuitOffCmd { get; set; } - - public DigitalLoggerJoinMap() - { - // Digital - IsOnline = 9; - CircuitState = 0; - CircuitCycle = 0; - CircuitIsCritical = 10; - CircuitOnCmd = 10; - CircuitOffCmd = 20; - // Serial - CircuitNames = 0; - // Analog - } - - public override void OffsetJoinNumbers(uint joinStart) - { - var joinOffset = joinStart - 1; - - IsOnline = IsOnline + joinOffset; - CircuitNames = CircuitNames + joinOffset; - CircuitState = CircuitState + joinOffset; - CircuitCycle = CircuitCycle + joinOffset; - CircuitIsCritical = CircuitIsCritical + joinOffset; - CircuitOnCmd = CircuitOnCmd + joinOffset; - CircuitOffCmd = CircuitOffCmd + joinOffset; - } - } +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; + +namespace PepperDash.Essentials.Core.Bridges +{ + [Obsolete("This Device will be moved to a plugin in a future update")] + public class DigitalLoggerJoinMap : JoinMapBase + { + public uint IsOnline { get; set; } + public uint CircuitNames { get; set; } + public uint CircuitState { get; set; } + public uint CircuitCycle { get; set; } + public uint CircuitIsCritical { get; set; } + public uint CircuitOnCmd { get; set; } + public uint CircuitOffCmd { get; set; } + + public DigitalLoggerJoinMap() + { + // Digital + IsOnline = 9; + CircuitState = 0; + CircuitCycle = 0; + CircuitIsCritical = 10; + CircuitOnCmd = 10; + CircuitOffCmd = 20; + // Serial + CircuitNames = 0; + // Analog + } + + public override void OffsetJoinNumbers(uint joinStart) + { + var joinOffset = joinStart - 1; + + IsOnline = IsOnline + joinOffset; + CircuitNames = CircuitNames + joinOffset; + CircuitState = CircuitState + joinOffset; + CircuitCycle = CircuitCycle + joinOffset; + CircuitIsCritical = CircuitIsCritical + joinOffset; + CircuitOnCmd = CircuitOnCmd + joinOffset; + CircuitOffCmd = CircuitOffCmd + joinOffset; + } + } } \ No newline at end of file diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Power Controllers/Digitallogger.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Power Controllers/Digitallogger.cs index 11a96537..2a079c97 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Power Controllers/Digitallogger.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Power Controllers/Digitallogger.cs @@ -11,12 +11,14 @@ using Crestron.SimplSharp.Net.Http; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using PepperDash.Essentials.Core.Bridges; -using PepperDash.Essentials.Core.Config; +using PepperDash.Essentials.Core.Config; +using PepperDash.Essentials; + namespace PepperDash.Essentials.Devices.Common -{ - +{ + [Obsolete("This Device will be moved to a plugin in a future update")] public class DigitalLogger : EssentialsBridgeableDevice { public IBasicCommunication Communication { get; private set; } From ff7a1838aa7d131a249f4b57935983c8b352dd6b Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Thu, 7 May 2020 12:59:33 -0500 Subject: [PATCH 102/156] Updated DmBladeChassisController and DmBladeChassisControllerJoinMap; Slightly changed DmBladeChassisController Bridge to account for new offsets using span property --- .../DmBladeChassisControllerJoinMap.cs | 152 +++++++----------- .../Chassis/DmBladeChassisController.cs | 52 +++--- 2 files changed, 80 insertions(+), 124 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmBladeChassisControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmBladeChassisControllerJoinMap.cs index 001d6f94..170eafc9 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmBladeChassisControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmBladeChassisControllerJoinMap.cs @@ -6,104 +6,60 @@ using Crestron.SimplSharp; using PepperDash.Essentials.Core; namespace PepperDash.Essentials.Core.Bridges { - public class DmBladeChassisControllerJoinMap : JoinMapBase { - #region Digital/Analogs - #endregion - - #region Digitals - /// - /// High when device is online - /// - public uint IsOnline { get; set; } - /// - /// Range reports video sync feedback for each input - /// - public uint VideoSyncStatus { get; set; } - /// - /// Range reports high if corresponding input's endpoint is online - /// - public uint InputEndpointOnline { get; set; } - /// - /// Range reports high if corresponding output's endpoint is online - /// - public uint OutputEndpointOnline { get; set; } - /// - /// Range reports high if corresponding input's transmitter supports bridging as a separate device for detailed AV switching, HDCP control, etc. - /// - public uint TxAdvancedIsPresent { get; set; } // indicates that there is an attached transmitter that should be bridged to be interacted with - #endregion - - #region Analogs - /// - /// Range sets and reports the current video source for the corresponding output - /// - public uint OutputVideo { get; set; } - /// - /// Range sets and reports the current HDCP state for the corresponding input card - /// - public uint HdcpSupportState { get; set; } - /// - /// Range reports the highest supported HDCP state level for the corresponding input card - /// - public uint HdcpSupportCapability { get; set; } - #endregion - - #region Serials - /// - /// Range sets and reports the name for the corresponding input card - /// - public uint InputNames { get; set; } - /// - /// Range sets and reports the name for the corresponding output card - /// - public uint OutputNames { get; set; } - /// - /// Range reports the name of the current video source for the corresponding output card - /// - public uint OutputCurrentVideoInputNames { get; set; } - /// - /// Range reports the current input resolution for each corresponding input card - /// - public uint InputCurrentResolution { get; set; } - #endregion - - public DmBladeChassisControllerJoinMap() { - //Digital/Analog - - //Digital - IsOnline = 11; - VideoSyncStatus = 100; //101-299 - InputEndpointOnline = 500; //501-699 - OutputEndpointOnline = 700; //701-899 - TxAdvancedIsPresent = 1000; //1001-1199 - - //Analog - OutputVideo = 100; //101-299 - HdcpSupportState = 1000; //1001-1199 - HdcpSupportCapability = 1200; //1201-1399 - - - //Serial - InputNames = 100; //101-299 - OutputNames = 300; //301-499 - OutputCurrentVideoInputNames = 2000; //2001-2199 - InputCurrentResolution = 2400; // 2401-2599 - } - - public override void OffsetJoinNumbers(uint joinStart) { - var joinOffset = joinStart - 1; - - IsOnline = IsOnline + joinOffset; - OutputVideo = OutputVideo + joinOffset; - VideoSyncStatus = VideoSyncStatus + joinOffset; - InputNames = InputNames + joinOffset; - OutputNames = OutputNames + joinOffset; - OutputCurrentVideoInputNames = OutputCurrentVideoInputNames + joinOffset; - InputCurrentResolution = InputCurrentResolution + joinOffset; - InputEndpointOnline = InputEndpointOnline + joinOffset; - OutputEndpointOnline = OutputEndpointOnline + joinOffset; - HdcpSupportState = HdcpSupportState + joinOffset; - HdcpSupportCapability = HdcpSupportCapability + joinOffset; + public class DmBladeChassisControllerJoinMap : JoinMapBaseAdvanced { + + [JoinName("IsOnline")] + public JoinDataComplete IsOnline = new JoinDataComplete(new JoinData() { JoinNumber = 11, JoinSpan = 1 }, + new JoinMetadata() { Label = "DM Blade Chassis Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("VideoSyncStatus")] + public JoinDataComplete VideoSyncStatus = new JoinDataComplete(new JoinData() { JoinNumber = 101, JoinSpan = 128 }, + new JoinMetadata() { Label = "DM Blade Input Video Sync", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("InputEndpointOnline")] + public JoinDataComplete InputEndpointOnline = new JoinDataComplete(new JoinData() { JoinNumber = 501, JoinSpan = 128 }, + new JoinMetadata() { Label = "DM Blade Chassis Input Endpoint Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("OutputEndpointOnline")] + public JoinDataComplete OutputEndpointOnline = new JoinDataComplete(new JoinData() { JoinNumber = 701, JoinSpan = 128 }, + new JoinMetadata() { Label = "DM Blade Chassis Output Endpoint Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("TxAdvancedIsPresent")] + public JoinDataComplete TxAdvancedIsPresent = new JoinDataComplete(new JoinData() { JoinNumber = 1001, JoinSpan = 128 }, + new JoinMetadata() { Label = "DM Blade Chassis Tx Advanced Is Present", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("OutputVideo")] + public JoinDataComplete OutputVideo = new JoinDataComplete(new JoinData() { JoinNumber = 101, JoinSpan = 128 }, + new JoinMetadata() { Label = "DM Blade Chassis Output Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("HdcpSupportState")] + public JoinDataComplete HdcpSupportState = new JoinDataComplete(new JoinData() { JoinNumber = 1001, JoinSpan = 128 }, + new JoinMetadata() { Label = "DM Blade Chassis Input HDCP Support State", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("HdcpSupportCapability")] + public JoinDataComplete HdcpSupportCapability = new JoinDataComplete(new JoinData() { JoinNumber = 1201, JoinSpan = 128 }, + new JoinMetadata() { Label = "DM Blade Chassis Input HDCP Support Capability", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("InputNames")] + public JoinDataComplete InputNames = new JoinDataComplete(new JoinData() { JoinNumber = 101, JoinSpan = 128 }, + new JoinMetadata() { Label = "DM Blade Chassis Input Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("OutputNames")] + public JoinDataComplete OutputNames = new JoinDataComplete(new JoinData() { JoinNumber = 301, JoinSpan = 128 }, + new JoinMetadata() { Label = "DM Blade Chassis Output Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("OutputCurrentVideoInputNames")] + public JoinDataComplete OutputCurrentVideoInputNames = new JoinDataComplete(new JoinData() { JoinNumber = 2001, JoinSpan = 128 }, + new JoinMetadata() { Label = "DM Blade Chassis Video Output Currently Routed Video Input Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("InputCurrentResolution")] + public JoinDataComplete InputCurrentResolution = new JoinDataComplete(new JoinData() { JoinNumber = 2401, JoinSpan = 128 }, + new JoinMetadata() { Label = "DM Blade Chassis Input Current Resolution", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + public DmBladeChassisControllerJoinMap(uint joinStart) + : base(joinStart, typeof(DmBladeChassisControllerJoinMap)) + { } + } } diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmBladeChassisController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmBladeChassisController.cs index 5ce95c93..2637332f 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmBladeChassisController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmBladeChassisController.cs @@ -573,7 +573,7 @@ namespace PepperDash.Essentials.DM { public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { - var joinMap = new DmBladeChassisControllerJoinMap(); + var joinMap = new DmBladeChassisControllerJoinMap(joinStart); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); @@ -581,19 +581,19 @@ namespace PepperDash.Essentials.DM { joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - joinMap.OffsetJoinNumbers(joinStart); Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); - IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); + 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 + ioSlot, o => ExecuteSwitch(o, ioSlot, eRoutingSignalType.Video)); + trilist.SetUShortSigAction(joinMap.OutputVideo.JoinNumber + ioSlotJoin, o => ExecuteSwitch(o, ioSlot, eRoutingSignalType.Video)); if (TxDictionary.ContainsKey(ioSlot)) { @@ -605,33 +605,33 @@ namespace PepperDash.Essentials.DM { if (Chassis is DmMd128x128 || Chassis is DmMd64x64) { - InputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]); + InputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline.JoinNumber + ioSlotJoin]); } else { if (advancedTxDevice != null) { - advancedTxDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]); + 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 + ioSlot]); + InputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline.JoinNumber + ioSlotJoin]); } } if (basicTxDevice != null && advancedTxDevice == null) - trilist.BooleanInput[joinMap.TxAdvancedIsPresent + ioSlot].BoolValue = true; + trilist.BooleanInput[joinMap.TxAdvancedIsPresent.JoinNumber + ioSlotJoin].BoolValue = true; if (advancedTxDevice != null) { - advancedTxDevice.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus + ioSlot]); + 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 + ioSlot]); + VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus.JoinNumber + ioSlotJoin]); var inputPort = InputPorts[string.Format("inputCard{0}--hdmiIn", ioSlot)]; if (inputPort != null) @@ -649,15 +649,15 @@ namespace PepperDash.Essentials.DM { if (hdmiInPortWCec.HdcpSupportedLevel != eHdcpSupportedLevel.Unknown) { - SetHdcpStateAction(true, hdmiInPortWCec, joinMap.HdcpSupportState + ioSlot, trilist); + SetHdcpStateAction(true, hdmiInPortWCec, joinMap.HdcpSupportState.JoinNumber + ioSlotJoin, trilist); } - InputCardHdcpCapabilityFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.HdcpSupportState + ioSlot]); + InputCardHdcpCapabilityFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.HdcpSupportState.JoinNumber + ioSlotJoin]); if (InputCardHdcpCapabilityTypes.ContainsKey(ioSlot)) - trilist.UShortInput[joinMap.HdcpSupportCapability + ioSlot].UShortValue = (ushort)InputCardHdcpCapabilityTypes[ioSlot]; + trilist.UShortInput[joinMap.HdcpSupportCapability.JoinNumber + ioSlotJoin].UShortValue = (ushort)InputCardHdcpCapabilityTypes[ioSlot]; else - trilist.UShortInput[joinMap.HdcpSupportCapability + ioSlot].UShortValue = 1; + trilist.UShortInput[joinMap.HdcpSupportCapability.JoinNumber + ioSlotJoin].UShortValue = 1; } } } @@ -675,14 +675,14 @@ namespace PepperDash.Essentials.DM { var dmInPortWCec = port as DMInputPortWithCec; - SetHdcpStateAction(PropertiesConfig.InputSlotSupportsHdcp2[ioSlot], dmInPortWCec, joinMap.HdcpSupportState + ioSlot, trilist); + SetHdcpStateAction(PropertiesConfig.InputSlotSupportsHdcp2[ioSlot], dmInPortWCec, joinMap.HdcpSupportState.JoinNumber + ioSlotJoin, trilist); - InputCardHdcpCapabilityFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.HdcpSupportState + ioSlot]); + InputCardHdcpCapabilityFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.HdcpSupportState.JoinNumber + ioSlotJoin]); if (InputCardHdcpCapabilityTypes.ContainsKey(ioSlot)) - trilist.UShortInput[joinMap.HdcpSupportCapability + ioSlot].UShortValue = (ushort)InputCardHdcpCapabilityTypes[ioSlot]; + trilist.UShortInput[joinMap.HdcpSupportCapability.JoinNumber + ioSlotJoin].UShortValue = (ushort)InputCardHdcpCapabilityTypes[ioSlot]; else - trilist.UShortInput[joinMap.HdcpSupportCapability + ioSlot].UShortValue = 1; + trilist.UShortInput[joinMap.HdcpSupportCapability.JoinNumber + ioSlotJoin].UShortValue = 1; } } } @@ -690,7 +690,7 @@ namespace PepperDash.Essentials.DM { } else { - VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus + ioSlot]); + VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus.JoinNumber + ioSlotJoin]); var inputPort = InputPorts[string.Format("inputCard{0}--hdmiIn", ioSlot)]; if (inputPort != null) @@ -699,8 +699,8 @@ namespace PepperDash.Essentials.DM { if (hdmiPort != null) { - SetHdcpStateAction(true, hdmiPort, joinMap.HdcpSupportState + ioSlot, trilist); - InputCardHdcpCapabilityFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.HdcpSupportState + ioSlot]); + SetHdcpStateAction(true, hdmiPort, joinMap.HdcpSupportState.JoinNumber + ioSlotJoin, trilist); + InputCardHdcpCapabilityFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.HdcpSupportState.JoinNumber + ioSlotJoin]); } } } @@ -711,7 +711,7 @@ namespace PepperDash.Essentials.DM { //var rxDevice = DeviceManager.GetDeviceForKey(rxKey) as DmRmcControllerBase; //var hdBaseTDevice = DeviceManager.GetDeviceForKey(rxKey) as DmHdBaseTControllerBase; //if (hdBaseTDevice != null) { - OutputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline + ioSlot]); + OutputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline.JoinNumber + ioSlotJoin]); //} //else if (rxDevice != null) { // rxDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline + ioSlot]); @@ -719,12 +719,12 @@ namespace PepperDash.Essentials.DM { } // Feedback - VideoOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputVideo + ioSlot]); + VideoOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputVideo.JoinNumber + ioSlotJoin]); - OutputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputNames + ioSlot]); - InputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.InputNames + ioSlot]); - OutputVideoRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentVideoInputNames + ioSlot]); + 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]); } } From 3a3ccb0acd31745405560d4739d8882b2b8dc726 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Thu, 7 May 2020 13:29:21 -0500 Subject: [PATCH 103/156] Updated DmChassisController and DmChassisControllerJoinMap; Slightly changed DmChassisController Bridge to account for new offsets using the span property. --- .../Bridges/JoinMaps/AppleTvJoinMap.cs | 26 +- .../DmBladeChassisControllerJoinMap.cs | 26 +- .../JoinMaps/DmChassisControllerJoinMap.cs | 229 +++++++----------- .../Chassis/DmChassisController.cs | 147 ++++++----- .../Essentials Devices Common.csproj | 10 +- 5 files changed, 187 insertions(+), 251 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/AppleTvJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/AppleTvJoinMap.cs index 1b11ebd8..03abf902 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/AppleTvJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/AppleTvJoinMap.cs @@ -1,13 +1,13 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using PepperDash.Essentials.Core; - -namespace PepperDash.Essentials.Core.Bridges -{ - public class AppleTvJoinMap : JoinMapBaseAdvanced +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Core.Bridges +{ + public class AppleTvJoinMap : JoinMapBaseAdvanced { [JoinName("UpArrow")] public JoinDataComplete UpArrow = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, @@ -40,7 +40,7 @@ namespace PepperDash.Essentials.Core.Bridges public AppleTvJoinMap(uint joinStart) : base(joinStart, typeof(AppleTvJoinMap)) { - } - - } + } + + } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmBladeChassisControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmBladeChassisControllerJoinMap.cs index 170eafc9..63e3041e 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmBladeChassisControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmBladeChassisControllerJoinMap.cs @@ -1,12 +1,12 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using PepperDash.Essentials.Core; - -namespace PepperDash.Essentials.Core.Bridges { - public class DmBladeChassisControllerJoinMap : JoinMapBaseAdvanced { +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Core.Bridges { + public class DmBladeChassisControllerJoinMap : JoinMapBaseAdvanced { [JoinName("IsOnline")] public JoinDataComplete IsOnline = new JoinDataComplete(new JoinData() { JoinNumber = 11, JoinSpan = 1 }, @@ -59,7 +59,7 @@ namespace PepperDash.Essentials.Core.Bridges { public DmBladeChassisControllerJoinMap(uint joinStart) : base(joinStart, typeof(DmBladeChassisControllerJoinMap)) { - } - - } -} + } + + } +} diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmChassisControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmChassisControllerJoinMap.cs index 5059333f..fe3933b0 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmChassisControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmChassisControllerJoinMap.cs @@ -3,149 +3,88 @@ using System.Collections.Generic; using System.Linq; using System.Text; using Crestron.SimplSharp; -using PepperDash.Essentials.Core; - -namespace PepperDash.Essentials.Core.Bridges -{ - public class DmChassisControllerJoinMap : JoinMapBase - { -#region Digital/Analogs - /// - /// Analog input sets System ID, output reports current ID as feedback. - /// Digital input applies System ID, output is high when applying busy. - /// - public uint SystemId { get; set; } -#endregion - -#region Digitals - /// - /// High when device is online - /// - public uint IsOnline { get; set; } - /// - /// Range reports video sync feedback for each input - /// - public uint VideoSyncStatus { get; set; } - /// - /// Range reports high if corresponding input's endpoint is online - /// - public uint InputEndpointOnline { get; set; } - /// - /// Range reports high if corresponding output's endpoint is online - /// - public uint OutputEndpointOnline { get; set; } - /// - /// Range reports high if corresponding input's transmitter supports bridging as a separate device for detailed AV switching, HDCP control, etc. - /// - public uint TxAdvancedIsPresent { get; set; } // indicates that there is an attached transmitter that should be bridged to be interacted with - /// - /// Range reports high if corresponding output is disabled by HDCP. - /// - public uint OutputDisabledByHdcp { get; set; } // indicates that there is an attached transmitter that should be bridged to be interacted with -#endregion - -#region Analogs - /// - /// Range sets and reports the current video source for the corresponding output - /// - public uint OutputVideo { get; set; } - /// - /// Range sets and reports the current audio source for the corresponding output - /// - public uint OutputAudio { get; set; } - /// - /// Range sets and reports the current Usb source for the corresponding output - /// - public uint OutputUsb { get; set; } - /// - /// Range sets and reports the current Usb source for the corresponding input - /// - public uint InputUsb { get; set; } - /// - /// Range sets and reports the current HDCP state for the corresponding input card - /// - public uint HdcpSupportState { get; set; } - /// - /// Range reports the highest supported HDCP state level for the corresponding input card - /// - public uint HdcpSupportCapability { get; set; } -#endregion - -#region Serials - /// - /// Range sets and reports the name for the corresponding input card - /// - public uint InputNames { get; set; } - /// - /// Range sets and reports the name for the corresponding output card - /// - public uint OutputNames { get; set; } - /// - /// Range reports the name of the current video source for the corresponding output card - /// - public uint OutputCurrentVideoInputNames { get; set; } - /// - /// Range reports the name of the current audio source for the corresponding output card - /// - public uint OutputCurrentAudioInputNames { get; set; } - /// - /// Range reports the current input resolution for each corresponding input card - /// - public uint InputCurrentResolution { get; set; } -#endregion - - public DmChassisControllerJoinMap() - { - //Digital/Analog - SystemId = 10; // Analog sets/gets SystemId, digital input applies and provides feedback of ID change busy - - //Digital - IsOnline = 11; - VideoSyncStatus = 100; //101-299 - InputEndpointOnline = 500; //501-699 - OutputEndpointOnline = 700; //701-899 - TxAdvancedIsPresent = 1000; //1001-1199 - OutputDisabledByHdcp = 1200; //1201-1399 - - //Analog - OutputVideo = 100; //101-299 - OutputAudio = 300; //301-499 - OutputUsb = 500; //501-699 - InputUsb = 700; //701-899 - HdcpSupportState = 1000; //1001-1199 - HdcpSupportCapability = 1200; //1201-1399 - - - //Serial - InputNames = 100; //101-299 - OutputNames = 300; //301-499 - OutputCurrentVideoInputNames = 2000; //2001-2199 - OutputCurrentAudioInputNames = 2200; //2201-2399 - InputCurrentResolution = 2400; // 2401-2599 - } - - public override void OffsetJoinNumbers(uint joinStart) - { - var joinOffset = joinStart - 1; - - SystemId = SystemId + joinOffset; - IsOnline = IsOnline + joinOffset; - OutputVideo = OutputVideo + joinOffset; - OutputAudio = OutputAudio + joinOffset; - OutputUsb = OutputUsb + joinOffset; - InputUsb = InputUsb + joinOffset; - VideoSyncStatus = VideoSyncStatus + joinOffset; - InputNames = InputNames + joinOffset; - OutputNames = OutputNames + joinOffset; - OutputCurrentVideoInputNames = OutputCurrentVideoInputNames + joinOffset; - OutputCurrentAudioInputNames = OutputCurrentAudioInputNames + joinOffset; - InputCurrentResolution = InputCurrentResolution + joinOffset; - InputEndpointOnline = InputEndpointOnline + joinOffset; - OutputEndpointOnline = OutputEndpointOnline + joinOffset; - HdcpSupportState = HdcpSupportState + joinOffset; - HdcpSupportCapability = HdcpSupportCapability + joinOffset; - OutputDisabledByHdcp = OutputDisabledByHdcp + joinOffset; - TxAdvancedIsPresent = TxAdvancedIsPresent + joinOffset; - } - } +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Core.Bridges +{ + public class DmChassisControllerJoinMap : JoinMapBaseAdvanced + { + + [JoinName("SystemId")] + public JoinDataComplete SystemId = new JoinDataComplete(new JoinData() { JoinNumber = 10, JoinSpan = 1 }, + new JoinMetadata() { Label = "DM Chassis SystemId Get/Set/Trigger/", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.DigitalAnalog }); + + [JoinName("IsOnline")] + public JoinDataComplete IsOnline = new JoinDataComplete(new JoinData() { JoinNumber = 11, JoinSpan = 1 }, + new JoinMetadata() { Label = "DM Chassis Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("VideoSyncStatus")] + public JoinDataComplete VideoSyncStatus = new JoinDataComplete(new JoinData() { JoinNumber = 101, JoinSpan = 32 }, + new JoinMetadata() { Label = "DM Input Video Sync", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("InputEndpointOnline")] + public JoinDataComplete InputEndpointOnline = new JoinDataComplete(new JoinData() { JoinNumber = 501, JoinSpan = 32 }, + new JoinMetadata() { Label = "DM Chassis Input Endpoint Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("OutputEndpointOnline")] + public JoinDataComplete OutputEndpointOnline = new JoinDataComplete(new JoinData() { JoinNumber = 701, JoinSpan = 32 }, + new JoinMetadata() { Label = "DM Chassis Output Endpoint Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("TxAdvancedIsPresent")] + public JoinDataComplete TxAdvancedIsPresent = new JoinDataComplete(new JoinData() { JoinNumber = 1001, JoinSpan = 32 }, + new JoinMetadata() { Label = "DM Chassis Tx Advanced Is Present", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("OutputDisabledByHdcp")] + public JoinDataComplete OutputDisabledByHdcp = new JoinDataComplete(new JoinData() { JoinNumber = 1201, JoinSpan = 32 }, + new JoinMetadata() { Label = "DM Chassis Output Disabled by HDCP", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("OutputVideo")] + public JoinDataComplete OutputVideo = new JoinDataComplete(new JoinData() { JoinNumber = 101, JoinSpan = 32 }, + new JoinMetadata() { Label = "DM Chassis Output Video Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("OutputAudio")] + public JoinDataComplete OutputAudio = new JoinDataComplete(new JoinData() { JoinNumber = 301, JoinSpan = 32 }, + new JoinMetadata() { Label = "DM Chassis Output Audio Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("OutputUsb")] + public JoinDataComplete OutputUsb = new JoinDataComplete(new JoinData() { JoinNumber = 501, JoinSpan = 32 }, + new JoinMetadata() { Label = "DM Chassis Output USB Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("InputUsb")] + public JoinDataComplete InputUsb = new JoinDataComplete(new JoinData() { JoinNumber = 701, JoinSpan = 32 }, + new JoinMetadata() { Label = "DM Chassis Input Usb Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("HdcpSupportState")] + public JoinDataComplete HdcpSupportState = new JoinDataComplete(new JoinData() { JoinNumber = 1001, JoinSpan = 32 }, + new JoinMetadata() { Label = "DM Chassis Input HDCP Support State", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("HdcpSupportCapability")] + public JoinDataComplete HdcpSupportCapability = new JoinDataComplete(new JoinData() { JoinNumber = 1201, JoinSpan = 32 }, + new JoinMetadata() { Label = "DM Chassis Input HDCP Support Capability", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("InputNames")] + public JoinDataComplete InputNames = new JoinDataComplete(new JoinData() { JoinNumber = 101, JoinSpan = 32 }, + new JoinMetadata() { Label = "DM Chassis Input Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("OutputNames")] + public JoinDataComplete OutputNames = new JoinDataComplete(new JoinData() { JoinNumber = 301, JoinSpan = 32 }, + new JoinMetadata() { Label = "DM Chassis Output Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("OutputCurrentVideoInputNames")] + public JoinDataComplete OutputCurrentVideoInputNames = new JoinDataComplete(new JoinData() { JoinNumber = 2001, JoinSpan = 32 }, + new JoinMetadata() { Label = "DM Chassis Video Output Currently Routed Video Input Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("OutputCurrentAudioInputNames")] + public JoinDataComplete OutputCurrentAudioInputNames = new JoinDataComplete(new JoinData() { JoinNumber = 2201, JoinSpan = 32 }, + new JoinMetadata() { Label = "DM Chassis Audio Output Currently Routed Video Input Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("InputCurrentResolution")] + public JoinDataComplete InputCurrentResolution = new JoinDataComplete(new JoinData() { JoinNumber = 2401, JoinSpan = 32 }, + new JoinMetadata() { Label = "DM Chassis Input Current Resolution", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + public DmChassisControllerJoinMap(uint joinStart) + : base(joinStart, typeof(DmChassisControllerJoinMap)) + { + } + } } diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs index 7313aece..83d097e7 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs @@ -7,7 +7,7 @@ using Crestron.SimplSharpPro.DM; using Crestron.SimplSharpPro.DM.Cards; using Crestron.SimplSharpPro.DM.Endpoints; using Newtonsoft.Json; -using PepperDash.Core; +using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.DM.Config; @@ -19,7 +19,7 @@ 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 128x128")] + [Description("Wrapper class for all DM-MD chassis variants from 8x8 to 32x32")] public class DmChassisController : CrestronGenericBridgeableBaseDevice, IDmSwitch, IRoutingInputsOutputs, IRouting, IHasFeedback { public DMChassisPropertiesConfig PropertiesConfig { get; set; } @@ -993,46 +993,45 @@ namespace PepperDash.Essentials.DM #endregion public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) - { - var joinMap = new DmChassisControllerJoinMap(); + { + var joinMap = new DmChassisControllerJoinMap(joinStart); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - - joinMap.OffsetJoinNumbers(joinStart); - Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); var chassis = Chassis as DmMDMnxn; - IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); - - trilist.SetUShortSigAction(joinMap.SystemId, o => + IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]); + + trilist.SetUShortSigAction(joinMap.SystemId.JoinNumber, o => { if (chassis != null) chassis.SystemId.UShortValue = o; - }); - - trilist.SetSigTrueAction(joinMap.SystemId, () => { + }); + + trilist.SetSigTrueAction(joinMap.SystemId.JoinNumber, () => + { if (chassis != null) chassis.ApplySystemId(); - }); - - SystemIdFeebdack.LinkInputSig(trilist.UShortInput[joinMap.SystemId]); - SystemIdBusyFeedback.LinkInputSig(trilist.BooleanInput[joinMap.SystemId]); + }); + + SystemIdFeebdack.LinkInputSig(trilist.UShortInput[joinMap.SystemId.JoinNumber]); + SystemIdBusyFeedback.LinkInputSig(trilist.BooleanInput[joinMap.SystemId.JoinNumber]); // Link up outputs for (uint i = 1; i <= Chassis.NumberOfOutputs; i++) { - var ioSlot = i; + var ioSlot = i; + var ioSlotJoin = ioSlot - 1; - // Control - trilist.SetUShortSigAction(joinMap.OutputVideo + ioSlot, o => ExecuteSwitch(o, ioSlot, eRoutingSignalType.Video)); - trilist.SetUShortSigAction(joinMap.OutputAudio + ioSlot, o => ExecuteSwitch(o, ioSlot, eRoutingSignalType.Audio)); - trilist.SetUShortSigAction(joinMap.OutputUsb + ioSlot, o => ExecuteSwitch(o, ioSlot, eRoutingSignalType.UsbOutput)); - trilist.SetUShortSigAction(joinMap.InputUsb + ioSlot, o => ExecuteSwitch(o, ioSlot, eRoutingSignalType.UsbInput)); + // Control + trilist.SetUShortSigAction(joinMap.OutputVideo.JoinNumber + ioSlotJoin, o => ExecuteSwitch(o, ioSlot, eRoutingSignalType.Video)); + trilist.SetUShortSigAction(joinMap.OutputAudio.JoinNumber + ioSlotJoin, o => ExecuteSwitch(o, ioSlot, eRoutingSignalType.Audio)); + trilist.SetUShortSigAction(joinMap.OutputUsb.JoinNumber + ioSlotJoin, o => ExecuteSwitch(o, ioSlot, eRoutingSignalType.UsbOutput)); + trilist.SetUShortSigAction(joinMap.InputUsb.JoinNumber + ioSlotJoin, o => ExecuteSwitch(o, ioSlot, eRoutingSignalType.UsbInput)); if (TxDictionary.ContainsKey(ioSlot)) { @@ -1045,34 +1044,34 @@ namespace PepperDash.Essentials.DM if (Chassis is DmMd8x8Cpu3 || Chassis is DmMd8x8Cpu3rps || Chassis is DmMd16x16Cpu3 || Chassis is DmMd16x16Cpu3rps || Chassis is DmMd32x32Cpu3 || Chassis is DmMd32x32Cpu3rps) - { - InputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]); + { + InputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline.JoinNumber + ioSlotJoin]); } else { if (advancedTxDevice != null) - { - advancedTxDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]); + { + 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 + ioSlot]); + 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 + ioSlot].BoolValue = true; + 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 + ioSlot]); + { + advancedTxDevice.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus.JoinNumber + ioSlotJoin]); } else if (advancedTxDevice == null || basicTxDevice != null) { - Debug.Console(1, "Setting up actions and feedbacks on input card {0}", ioSlot); - VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus + ioSlot]); + 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) @@ -1089,16 +1088,16 @@ namespace PepperDash.Essentials.DM var hdmiInPortWCec = port as HdmiInputWithCEC; if (hdmiInPortWCec.HdcpSupportedLevel != eHdcpSupportedLevel.Unknown) - { - SetHdcpStateAction(true, hdmiInPortWCec, joinMap.HdcpSupportState + ioSlot, trilist); - } + { + SetHdcpStateAction(true, hdmiInPortWCec, joinMap.HdcpSupportState.JoinNumber + ioSlotJoin, trilist); + } + + InputCardHdcpCapabilityFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.HdcpSupportState.JoinNumber + ioSlotJoin]); - InputCardHdcpCapabilityFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.HdcpSupportState + ioSlot]); - - if (InputCardHdcpCapabilityTypes.ContainsKey(ioSlot)) - trilist.UShortInput[joinMap.HdcpSupportCapability + ioSlot].UShortValue = (ushort)InputCardHdcpCapabilityTypes[ioSlot]; - else - trilist.UShortInput[joinMap.HdcpSupportCapability + ioSlot].UShortValue = 1; + if (InputCardHdcpCapabilityTypes.ContainsKey(ioSlot)) + trilist.UShortInput[joinMap.HdcpSupportCapability.JoinNumber + ioSlotJoin].UShortValue = (ushort)InputCardHdcpCapabilityTypes[ioSlot]; + else + trilist.UShortInput[joinMap.HdcpSupportCapability.JoinNumber + ioSlotJoin].UShortValue = 1; } } } @@ -1117,24 +1116,24 @@ namespace PepperDash.Essentials.DM var dmInPortWCec = port as DMInputPortWithCec; if (dmInPortWCec != null) - { - SetHdcpStateAction(PropertiesConfig.InputSlotSupportsHdcp2[ioSlot], dmInPortWCec, joinMap.HdcpSupportState + ioSlot, trilist); - } + { + SetHdcpStateAction(PropertiesConfig.InputSlotSupportsHdcp2[ioSlot], dmInPortWCec, joinMap.HdcpSupportState.JoinNumber + ioSlotJoin, trilist); + } + + InputCardHdcpCapabilityFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.HdcpSupportState.JoinNumber + ioSlotJoin]); - InputCardHdcpCapabilityFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.HdcpSupportState + ioSlot]); - - if (InputCardHdcpCapabilityTypes.ContainsKey(ioSlot)) - trilist.UShortInput[joinMap.HdcpSupportCapability + ioSlot].UShortValue = (ushort)InputCardHdcpCapabilityTypes[ioSlot]; - else - trilist.UShortInput[joinMap.HdcpSupportCapability + ioSlot].UShortValue = 1; + 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 + ioSlot]); + { + VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus.JoinNumber + ioSlotJoin]); var inputPort = InputPorts[string.Format("inputCard{0}--hdmiIn", ioSlot)]; if (inputPort != null) @@ -1142,9 +1141,9 @@ namespace PepperDash.Essentials.DM var hdmiPort = inputPort.Port as EndpointHdmiInput; if (hdmiPort != null) - { - SetHdcpStateAction(true, hdmiPort, joinMap.HdcpSupportState + ioSlot, trilist); - InputCardHdcpCapabilityFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.HdcpSupportState + ioSlot]); + { + SetHdcpStateAction(true, hdmiPort, joinMap.HdcpSupportState.JoinNumber + ioSlotJoin, trilist); + InputCardHdcpCapabilityFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.HdcpSupportState.JoinNumber + ioSlotJoin]); } } } @@ -1158,27 +1157,27 @@ namespace PepperDash.Essentials.DM 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 + ioSlot]); + { + OutputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline.JoinNumber + ioSlotJoin]); } else if (rxDevice != null) - { - rxDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline + ioSlot]); + { + rxDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline.JoinNumber + ioSlotJoin]); } } - // Feedback - VideoOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputVideo + ioSlot]); - AudioOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputAudio + ioSlot]); - UsbOutputRoutedToFeebacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputUsb + ioSlot]); - UsbInputRoutedToFeebacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.InputUsb + ioSlot]); - - OutputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputNames + ioSlot]); - InputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.InputNames + ioSlot]); - OutputVideoRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentVideoInputNames + ioSlot]); - OutputAudioRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentAudioInputNames + ioSlot]); - - OutputDisabledByHdcpFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.OutputDisabledByHdcp + ioSlot]); + // Feedback + 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]); } } diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Essentials Devices Common.csproj b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Essentials Devices Common.csproj index 147ace5b..fc1e9a84 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Essentials Devices Common.csproj +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Essentials Devices Common.csproj @@ -67,6 +67,10 @@ False ..\..\pepperdashcore-builds\PepperDash_Core.dll + + False + ..\..\Essentials Core\PepperDashEssentialsBase\bin\PepperDash_Essentials_Core.dll + False ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpCustomAttributesInterface.dll @@ -180,12 +184,6 @@ - - - {A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5} - PepperDash_Essentials_Core - - From 49fcb9e39402566334fbf897f800bcf674260ce9 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Thu, 7 May 2020 13:52:00 -0500 Subject: [PATCH 104/156] Updated DmpsAudioOutputController and DmpsAudioOutputControllerJoinMap --- .../DmpsAudioOutputControllerJoinMap.cs | 141 +++++++++++------- .../Chassis/DmpsAudioOutputController.cs | 13 +- 2 files changed, 92 insertions(+), 62 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmpsAudioOutputControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmpsAudioOutputControllerJoinMap.cs index 125700b2..7d2e9cda 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmpsAudioOutputControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmpsAudioOutputControllerJoinMap.cs @@ -7,63 +7,94 @@ using PepperDash.Essentials.Core; namespace PepperDash.Essentials.Core.Bridges { - public class DmpsAudioOutputControllerJoinMap : JoinMapBase + public class DmpsAudioOutputControllerJoinMap : JoinMapBaseAdvanced { - #region Digital/Analog - /// - /// Range of joins for Master Volume - /// Analog join 1 is volume level and feedback - /// Digital join 1 is Mute on and feedback - /// Digital join 2 is Mute off and feedback - /// Digital join 3 is volume up - /// Digital join 4 is volume down - /// - public uint MasterVolume { get; set; } - /// - /// Range of joins for Source Volume - /// Analog join 11 is volume level and feedback - /// Digital join 11 is Mute on and feedback - /// Digital join 12 is Mute off and feedback - /// Digital join 13 is volume up - /// Digital join 14 is volume down - /// - public uint SourceVolume { get; set; } - /// - /// Range of joins for Codec1 Volume (if applicable) - /// Analog join 21 is volume level and feedback - /// Digital join 21 is Mute on and feedback - /// Digital join 22 is Mute off and feedback - /// Digital join 23 is volume up - /// Digital join 24 is volume down - /// - public uint Codec1Volume { get; set; } - /// - /// Range of joins for Codec2 Volume (if applicable) - /// Analog join 31 is volume level and feedback - /// Digital join 31 is Mute on and feedback - /// Digital join 32 is Mute off and feedback - /// Digital join 33 is volume up - /// Digital join 34 is volume down - /// - public uint Codec2Volume { get; set; } - #endregion - public DmpsAudioOutputControllerJoinMap() - { - MasterVolume = 1; // 1-10 - SourceVolume = 11; // 11-20 - Codec1Volume = 21; // 21-30 - Codec2Volume = 31; // 31-40 - } - - public override void OffsetJoinNumbers(uint joinStart) - { - var joinOffset = joinStart; - - MasterVolume = MasterVolume + joinOffset; - SourceVolume = SourceVolume + joinOffset; - Codec1Volume = Codec1Volume + joinOffset; - Codec2Volume = Codec2Volume + joinOffset; + [JoinName("MasterVolumeLevel")] + public JoinDataComplete MasterVolumeLevel = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "Master Volume Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("MasterVolumeMuteOn")] + public JoinDataComplete MasterVolumeMuteOn = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "Master Volume Mute On Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("MasterVolumeMuteOff")] + public JoinDataComplete MasterVolumeMuteOff = new JoinDataComplete(new JoinData() { JoinNumber = 2, JoinSpan = 1 }, + new JoinMetadata() { Label = "Master Volume Mute Off Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("MasterVolumeUp")] + public JoinDataComplete MasterVolumeUp = new JoinDataComplete(new JoinData() { JoinNumber = 3, JoinSpan = 1 }, + new JoinMetadata() { Label = "Master Volume Level Up", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("MasterVolumeDown")] + public JoinDataComplete MasterVolumeDown = new JoinDataComplete(new JoinData() { JoinNumber = 4, JoinSpan = 1 }, + new JoinMetadata() { Label = "Master Volume Mute Level Down", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("SourceVolumeLevel")] + public JoinDataComplete SourceVolumeLevel = new JoinDataComplete(new JoinData() { JoinNumber = 11, JoinSpan = 1 }, + new JoinMetadata() { Label = "Source Volume Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("SourceVolumeMuteOn")] + public JoinDataComplete SourceVolumeMuteOn = new JoinDataComplete(new JoinData() { JoinNumber = 11, JoinSpan = 1 }, + new JoinMetadata() { Label = "Source Volume Mute On Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("SourceVolumeMuteOff")] + public JoinDataComplete SourceVolumeMuteOff = new JoinDataComplete(new JoinData() { JoinNumber = 12, JoinSpan = 1 }, + new JoinMetadata() { Label = "Source Volume Mute Off Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("SourceVolumeUp")] + public JoinDataComplete SourceVolumeUp = new JoinDataComplete(new JoinData() { JoinNumber = 13, JoinSpan = 1 }, + new JoinMetadata() { Label = "Source Volume Level Up", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("SourceVolumeDown")] + public JoinDataComplete SourceVolumeDown = new JoinDataComplete(new JoinData() { JoinNumber = 14, JoinSpan = 1 }, + new JoinMetadata() { Label = "Source Volume Mute Level Down", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Codec1VolumeLevel")] + public JoinDataComplete Codec1VolumeLevel = new JoinDataComplete(new JoinData() { JoinNumber = 21, JoinSpan = 1 }, + new JoinMetadata() { Label = "Codec1 Volume Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("Codec1VolumeMuteOn")] + public JoinDataComplete Codec1VolumeMuteOn = new JoinDataComplete(new JoinData() { JoinNumber = 21, JoinSpan = 1 }, + new JoinMetadata() { Label = "Codec1 Volume Mute On Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Codec1VolumeMuteOff")] + public JoinDataComplete Codec1VolumeMuteOff = new JoinDataComplete(new JoinData() { JoinNumber = 22, JoinSpan = 1 }, + new JoinMetadata() { Label = "Codec1 Volume Mute Off Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Codec1VolumeUp")] + public JoinDataComplete Codec1VolumeUp = new JoinDataComplete(new JoinData() { JoinNumber = 23, JoinSpan = 1 }, + new JoinMetadata() { Label = "Codec1 Volume Level Up", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Codec1VolumeDown")] + public JoinDataComplete Codec1VolumeDown = new JoinDataComplete(new JoinData() { JoinNumber = 24, JoinSpan = 1 }, + new JoinMetadata() { Label = "Codec1 Volume Mute Level Down", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Codec2VolumeLevel")] + public JoinDataComplete Codec2VolumeLevel = new JoinDataComplete(new JoinData() { JoinNumber = 31, JoinSpan = 1 }, + new JoinMetadata() { Label = "Codec2 Volume Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("Codec2VolumeMuteOn")] + public JoinDataComplete Codec2VolumeMuteOn = new JoinDataComplete(new JoinData() { JoinNumber = 31, JoinSpan = 1 }, + new JoinMetadata() { Label = "Codec2 Volume Mute On Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Codec2VolumeMuteOff")] + public JoinDataComplete Codec2VolumeMuteOff = new JoinDataComplete(new JoinData() { JoinNumber = 32, JoinSpan = 1 }, + new JoinMetadata() { Label = "Codec2 Volume Mute Off Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Codec2VolumeUp")] + public JoinDataComplete Codec2VolumeUp = new JoinDataComplete(new JoinData() { JoinNumber = 33, JoinSpan = 1 }, + new JoinMetadata() { Label = "Codec2 Volume Level Up", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Codec2VolumeDown")] + public JoinDataComplete Codec2VolumeDown = new JoinDataComplete(new JoinData() { JoinNumber = 34, JoinSpan = 1 }, + new JoinMetadata() { Label = "Codec2 Volume Mute Level Down", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + + + public DmpsAudioOutputControllerJoinMap(uint joinStart) + : base(joinStart, typeof(DmpsAudioOutputControllerJoinMap)) + { } } } \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsAudioOutputController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsAudioOutputController.cs index d330d650..0f2d6593 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsAudioOutputController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsAudioOutputController.cs @@ -103,36 +103,35 @@ namespace PepperDash.Essentials.DM } public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) - { - var joinMap = new DmpsAudioOutputControllerJoinMap(); + { + var joinMap = new DmpsAudioOutputControllerJoinMap(joinStart); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - joinMap.OffsetJoinNumbers(joinStart); Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); if (MasterVolumeLevel != null) { - SetUpDmpsAudioOutputJoins(trilist, MasterVolumeLevel, joinMap.MasterVolume); + SetUpDmpsAudioOutputJoins(trilist, MasterVolumeLevel, joinMap.MasterVolumeLevel.JoinNumber); } if (SourceVolumeLevel != null) { - SetUpDmpsAudioOutputJoins(trilist, SourceVolumeLevel, joinMap.SourceVolume); + SetUpDmpsAudioOutputJoins(trilist, SourceVolumeLevel, joinMap.SourceVolumeLevel.JoinNumber); } if (Codec1VolumeLevel != null) { - SetUpDmpsAudioOutputJoins(trilist, Codec1VolumeLevel, joinMap.Codec1Volume); + SetUpDmpsAudioOutputJoins(trilist, Codec1VolumeLevel, joinMap.Codec1VolumeLevel.JoinNumber); } if (Codec2VolumeLevel != null) { - SetUpDmpsAudioOutputJoins(trilist, Codec2VolumeLevel, joinMap.Codec2Volume); + SetUpDmpsAudioOutputJoins(trilist, Codec2VolumeLevel, joinMap.Codec2VolumeLevel.JoinNumber); } } From 30c1b2755e58ec9edfa1053094b230bc66266ce4 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Thu, 7 May 2020 14:21:39 -0500 Subject: [PATCH 105/156] Updated DmpsRoutingController and DmpsRoutingControllerJoinMap; Minor Edits to DmpsRoutingController to accomodate new joinmap span property --- .../JoinMaps/DmChassisControllerJoinMap.cs | 12 +- .../JoinMaps/DmpsRoutingControllerJoinMap.cs | 158 +++++------------- .../Chassis/DmpsRoutingController.cs | 61 +++---- 3 files changed, 81 insertions(+), 150 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmChassisControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmChassisControllerJoinMap.cs index fe3933b0..9406678a 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmChassisControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmChassisControllerJoinMap.cs @@ -1,8 +1,8 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; using PepperDash.Essentials.Core; namespace PepperDash.Essentials.Core.Bridges @@ -87,4 +87,4 @@ namespace PepperDash.Essentials.Core.Bridges { } } -} +} diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmpsRoutingControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmpsRoutingControllerJoinMap.cs index b58611fe..dc0d6fba 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmpsRoutingControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmpsRoutingControllerJoinMap.cs @@ -7,121 +7,51 @@ using PepperDash.Essentials.Core; namespace PepperDash.Essentials.Core.Bridges { - public class DmpsRoutingControllerJoinMap : JoinMapBase + public class DmpsRoutingControllerJoinMap : JoinMapBaseAdvanced { - #region Digitals - /// - /// Range reports video sync feedback for each input - /// - public uint VideoSyncStatus { get; set; } - /// - /// Range reports high if corresponding input's endpoint is online - /// - public uint InputEndpointOnline { get; set; } - /// - /// Range reports high if corresponding output's endpoint is online - /// - public uint OutputEndpointOnline { get; set; } - #endregion - - - #region Analogs - /// - /// Range sets and reports the current video source for the corresponding output - /// - public uint OutputVideo { get; set; } - /// - /// Range sets and reports the current audio source for the corresponding output - /// - public uint OutputAudio { get; set; } - /// - /// Range sets and reports the current Usb source for the corresponding output - /// - //public uint OutputUsb { get; set; } - ///// - ///// Range sets and reports the current Usb source for the corresponding input - ///// - //public uint InputUsb { get; set; } - ///// - ///// Range sets and reports the current HDCP state for the corresponding input card - ///// - //public uint HdcpSupportState { get; set; } - ///// - ///// Range reports the highest supported HDCP state level for the corresponding input card - ///// - //public uint HdcpSupportCapability { get; set; } - #endregion - - #region Serials - /// - /// Range sets and reports the name for the corresponding input card - /// - public uint InputNames { get; set; } - /// - /// Range sets and reports the name for the corresponding output card - /// - public uint OutputNames { get; set; } - /// - /// Range reports the name of the current video source for the corresponding output card - /// - public uint OutputCurrentVideoInputNames { get; set; } - /// - /// Range reports the name of the current audio source for the corresponding output card - /// - public uint OutputCurrentAudioInputNames { get; set; } - /// - /// Range reports the current input resolution for each corresponding input card - /// - public uint InputCurrentResolution { get; set; } - #endregion - - - public DmpsRoutingControllerJoinMap() - { - //Digital - VideoSyncStatus = 100; //101-299 - InputEndpointOnline = 500; //501-699 - OutputEndpointOnline = 700; //701-899 - - //Analog - OutputVideo = 100; //101-299 - OutputAudio = 300; //301-499 - //OutputUsb = 500; //501-699 - //InputUsb = 700; //701-899 - VideoSyncStatus = 100; //101-299 - //HdcpSupportState = 1000; //1001-1199 - //HdcpSupportCapability = 1200; //1201-1399 - - - //Serial - InputNames = 100; //101-299 - OutputNames = 300; //301-499 - OutputCurrentVideoInputNames = 2000; //2001-2199 - OutputCurrentAudioInputNames = 2200; //2201-2399 - InputCurrentResolution = 2400; // 2401-2599 - InputEndpointOnline = 500; //501-699 - OutputEndpointOnline = 700; //701-899 - - } - - public override void OffsetJoinNumbers(uint joinStart) - { - var joinOffset = joinStart - 1; - - OutputVideo = OutputVideo + joinOffset; - OutputAudio = OutputAudio + joinOffset; - //OutputUsb = OutputUsb + joinOffset; - //InputUsb = InputUsb + joinOffset; - VideoSyncStatus = VideoSyncStatus + joinOffset; - InputNames = InputNames + joinOffset; - OutputNames = OutputNames + joinOffset; - OutputCurrentVideoInputNames = OutputCurrentVideoInputNames + joinOffset; - OutputCurrentAudioInputNames = OutputCurrentAudioInputNames + joinOffset; - InputCurrentResolution = InputCurrentResolution + joinOffset; - InputEndpointOnline = InputEndpointOnline + joinOffset; - OutputEndpointOnline = OutputEndpointOnline + joinOffset; - //HdcpSupportState = HdcpSupportState + joinOffset; - //HdcpSupportCapability = HdcpSupportCapability + joinOffset; + [JoinName("VideoSyncStatus")] + public JoinDataComplete VideoSyncStatus = new JoinDataComplete(new JoinData() { JoinNumber = 101, JoinSpan = 32 }, + new JoinMetadata() { Label = "DM Input Video Sync", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("InputEndpointOnline")] + public JoinDataComplete InputEndpointOnline = new JoinDataComplete(new JoinData() { JoinNumber = 501, JoinSpan = 32 }, + new JoinMetadata() { Label = "DM Chassis Input Endpoint Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("OutputEndpointOnline")] + public JoinDataComplete OutputEndpointOnline = new JoinDataComplete(new JoinData() { JoinNumber = 701, JoinSpan = 32 }, + new JoinMetadata() { Label = "DM Chassis Output Endpoint Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("OutputVideo")] + public JoinDataComplete OutputVideo = new JoinDataComplete(new JoinData() { JoinNumber = 101, JoinSpan = 32 }, + new JoinMetadata() { Label = "DM Chassis Output Video Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("OutputAudio")] + public JoinDataComplete OutputAudio = new JoinDataComplete(new JoinData() { JoinNumber = 301, JoinSpan = 32 }, + new JoinMetadata() { Label = "DM Chassis Output Audio Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("InputNames")] + public JoinDataComplete InputNames = new JoinDataComplete(new JoinData() { JoinNumber = 101, JoinSpan = 32 }, + new JoinMetadata() { Label = "DM Chassis Input Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("OutputNames")] + public JoinDataComplete OutputNames = new JoinDataComplete(new JoinData() { JoinNumber = 301, JoinSpan = 32 }, + new JoinMetadata() { Label = "DM Chassis Output Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("OutputCurrentVideoInputNames")] + public JoinDataComplete OutputCurrentVideoInputNames = new JoinDataComplete(new JoinData() { JoinNumber = 2001, JoinSpan = 32 }, + new JoinMetadata() { Label = "DM Chassis Video Output Currently Routed Video Input Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("OutputCurrentAudioInputNames")] + public JoinDataComplete OutputCurrentAudioInputNames = new JoinDataComplete(new JoinData() { JoinNumber = 2201, JoinSpan = 32 }, + new JoinMetadata() { Label = "DM Chassis Audio Output Currently Routed Video Input Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("InputCurrentResolution")] + public JoinDataComplete InputCurrentResolution = new JoinDataComplete(new JoinData() { JoinNumber = 2401, JoinSpan = 32 }, + new JoinMetadata() { Label = "DM Chassis Input Current Resolution", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + public DmpsRoutingControllerJoinMap(uint joinStart) + : base(joinStart, typeof(DmpsRoutingControllerJoinMap)) + { } } } \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs index 4c4b256d..fd667ca3 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs @@ -155,16 +155,14 @@ namespace PepperDash.Essentials.DM } public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) - { - var joinMap = new DmpsRoutingControllerJoinMap(); + { + var joinMap = new DmpsRoutingControllerJoinMap(joinStart); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - joinMap.OffsetJoinNumbers(joinStart); - Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); // Link up outputs @@ -172,7 +170,8 @@ namespace PepperDash.Essentials.DM { Debug.Console(2, this, "Linking Input Card {0}", i); - var ioSlot = i; + var ioSlot = i; + var ioSlotJoin = ioSlot - 1; //if (TxDictionary.ContainsKey(ioSlot)) //{ @@ -190,13 +189,13 @@ namespace PepperDash.Essentials.DM // // dmChassis.VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[ApiMap.TxVideoSyncStatus[ioSlot]]); //} - if (VideoInputSyncFeedbacks[ioSlot] != null) - VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus + ioSlot]); + if (VideoInputSyncFeedbacks[ioSlot] != null) + VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus.JoinNumber + ioSlotJoin]); - if (InputNameFeedbacks[ioSlot] != null) - InputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.InputNames + ioSlot]); - - trilist.SetStringSigAction(joinMap.InputNames + ioSlot, new Action(s => + if (InputNameFeedbacks[ioSlot] != null) + InputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.InputNames.JoinNumber + ioSlotJoin]); + + trilist.SetStringSigAction(joinMap.InputNames.JoinNumber + ioSlotJoin, new Action(s => { var inputCard = Dmps.SwitcherInputs[ioSlot] as DMInput; @@ -209,20 +208,22 @@ namespace PepperDash.Essentials.DM })); - if (InputEndpointOnlineFeedbacks[ioSlot] != null) - InputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]); + if (InputEndpointOnlineFeedbacks[ioSlot] != null) + InputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline.JoinNumber + ioSlotJoin]); } for (uint i = 1; i <= Dmps.NumberOfSwitcherOutputs; i++) { Debug.Console(2, this, "Linking Output Card {0}", i); - var ioSlot = i; - // Control - trilist.SetUShortSigAction(joinMap.OutputVideo + ioSlot, o => ExecuteSwitch(o, ioSlot, eRoutingSignalType.Video)); - trilist.SetUShortSigAction(joinMap.OutputAudio + ioSlot, o => ExecuteSwitch(o, ioSlot, eRoutingSignalType.Audio)); + var ioSlot = i; + var ioSlotJoin = ioSlot - 1; - trilist.SetStringSigAction(joinMap.OutputNames + ioSlot, s => + // Control + trilist.SetUShortSigAction(joinMap.OutputVideo.JoinNumber + ioSlotJoin, o => ExecuteSwitch(o, ioSlot, eRoutingSignalType.Video)); + trilist.SetUShortSigAction(joinMap.OutputAudio.JoinNumber + ioSlotJoin, o => ExecuteSwitch(o, ioSlot, eRoutingSignalType.Audio)); + + trilist.SetStringSigAction(joinMap.OutputNames.JoinNumber + ioSlotJoin, s => { var outputCard = Dmps.SwitcherOutputs[ioSlot] as DMOutput; @@ -248,18 +249,18 @@ namespace PepperDash.Essentials.DM }); // Feedback - if (VideoOutputFeedbacks[ioSlot] != null) - VideoOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputVideo + ioSlot]); - if (AudioOutputFeedbacks[ioSlot] != null) - AudioOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputAudio + ioSlot]); - if (OutputNameFeedbacks[ioSlot] != null) - OutputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputNames + ioSlot]); - if (OutputVideoRouteNameFeedbacks[ioSlot] != null) - OutputVideoRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentVideoInputNames + ioSlot]); - if (OutputAudioRouteNameFeedbacks[ioSlot] != null) - OutputAudioRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentAudioInputNames + ioSlot]); - if (OutputEndpointOnlineFeedbacks[ioSlot] != null) - OutputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline + ioSlot]); + 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) + OutputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputNames.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]); } } From 5c560ae82fe57aa16d95d5416cd5b24aafc4c177 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Thu, 7 May 2020 14:29:45 -0500 Subject: [PATCH 106/156] Updated DmRmcControllerJoinMap and DmRmcHelper --- .../JoinMaps/DmRmcControllerJoinMap.cs | 111 +++++++----------- .../Endpoints/Receivers/DmRmcHelper.cs | 22 ++-- 2 files changed, 51 insertions(+), 82 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmRmcControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmRmcControllerJoinMap.cs index 94b9396b..537be416 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmRmcControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmRmcControllerJoinMap.cs @@ -1,75 +1,46 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using PepperDash.Essentials.Core; - -namespace PepperDash.Essentials.Core.Bridges -{ - public class DmRmcControllerJoinMap : JoinMapBase - { - #region Digitals - /// - /// High when device is online (if not attached to a DMP3 or DM chassis with a CPU3 card - /// - public uint IsOnline { get; set; } - #endregion - - #region Serials - /// - /// Reports the current output resolution - /// - public uint CurrentOutputResolution { get; set; } - /// - /// Reports the EDID manufacturer value - /// - public uint EdidManufacturer { get; set; } - /// - /// Reports the EDID Name value - /// - public uint EdidName { get; set; } - /// - /// Reports the EDID preffered timing value - /// - public uint EdidPrefferedTiming { get; set; } - /// - /// Reports the EDID serial number value - /// - public uint EdidSerialNumber { get; set; } - #endregion +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using PepperDash.Essentials.Core; - #region Analogs - public uint AudioVideoSource { get; set; } - #endregion +namespace PepperDash.Essentials.Core.Bridges +{ + public class DmRmcControllerJoinMap : JoinMapBaseAdvanced + { + [JoinName("IsOnline")] + public JoinDataComplete IsOnline = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "DM RMC Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); - public DmRmcControllerJoinMap() + [JoinName("CurrentOutputResolution")] + public JoinDataComplete CurrentOutputResolution = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "DM RMC Current Output Resolution", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("EdidManufacturer")] + public JoinDataComplete EdidManufacturer = new JoinDataComplete(new JoinData() { JoinNumber = 2, JoinSpan = 1 }, + new JoinMetadata() { Label = "DM RMC EDID Manufacturer", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("EdidName")] + public JoinDataComplete EdidName = new JoinDataComplete(new JoinData() { JoinNumber = 3, JoinSpan = 1 }, + new JoinMetadata() { Label = "DM RMC EDID Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("EdidPrefferedTiming")] + public JoinDataComplete EdidPrefferedTiming = new JoinDataComplete(new JoinData() { JoinNumber = 4, JoinSpan = 1 }, + new JoinMetadata() { Label = "DM RMC EDID Preferred Timing", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("EdidSerialNumber")] + public JoinDataComplete EdidSerialNumber = new JoinDataComplete(new JoinData() { JoinNumber = 5, JoinSpan = 1 }, + new JoinMetadata() { Label = "DM RMC EDID Serial Number", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("AudioVideoSource")] + public JoinDataComplete AudioVideoSource = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "DM RMC Audio Video Source Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog }); + + + public DmRmcControllerJoinMap(uint joinStart) + : base(joinStart, typeof(DmRmcControllerJoinMap)) { - // Digital - IsOnline = 1; - - // Serial - CurrentOutputResolution = 1; - EdidManufacturer = 2; - EdidName = 3; - EdidPrefferedTiming = 4; - EdidSerialNumber = 5; - - //Analog - AudioVideoSource = 1; } - - public override void OffsetJoinNumbers(uint joinStart) - { - var joinOffset = joinStart - 1; - - IsOnline = IsOnline + joinOffset; - CurrentOutputResolution = CurrentOutputResolution + joinOffset; - EdidManufacturer = EdidManufacturer + joinOffset; - EdidName = EdidName + joinOffset; - EdidPrefferedTiming = EdidPrefferedTiming + joinOffset; - EdidSerialNumber = EdidSerialNumber + joinOffset; - AudioVideoSource = AudioVideoSource + joinOffset; - } - } + } } \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs index 91085fca..fe71599e 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs @@ -38,29 +38,27 @@ namespace PepperDash.Essentials.DM } protected void LinkDmRmcToApi(DmRmcControllerBase rmc, BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) - { - var joinMap = new DmRmcControllerJoinMap(); + { + var joinMap = new DmRmcControllerJoinMap(joinStart); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - joinMap.OffsetJoinNumbers(joinStart); - Debug.Console(1, rmc, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); - rmc.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); + rmc.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]); if (rmc.VideoOutputResolutionFeedback != null) - rmc.VideoOutputResolutionFeedback.LinkInputSig(trilist.StringInput[joinMap.CurrentOutputResolution]); + rmc.VideoOutputResolutionFeedback.LinkInputSig(trilist.StringInput[joinMap.CurrentOutputResolution.JoinNumber]); if (rmc.EdidManufacturerFeedback != null) - rmc.EdidManufacturerFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidManufacturer]); + rmc.EdidManufacturerFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidManufacturer.JoinNumber]); if (rmc.EdidNameFeedback != null) - rmc.EdidNameFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidName]); + rmc.EdidNameFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidName.JoinNumber]); if (rmc.EdidPreferredTimingFeedback != null) - rmc.EdidPreferredTimingFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidPrefferedTiming]); + rmc.EdidPreferredTimingFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidPrefferedTiming.JoinNumber]); if (rmc.EdidSerialNumberFeedback != null) - rmc.EdidSerialNumberFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidSerialNumber]); + rmc.EdidSerialNumberFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidSerialNumber.JoinNumber]); //If the device is an DM-RMC-4K-Z-SCALER-C var routing = rmc as IRmcRouting; @@ -68,9 +66,9 @@ namespace PepperDash.Essentials.DM if (routing != null) { if (routing.AudioVideoSourceNumericFeedback != null) - routing.AudioVideoSourceNumericFeedback.LinkInputSig(trilist.UShortInput[joinMap.AudioVideoSource]); + routing.AudioVideoSourceNumericFeedback.LinkInputSig(trilist.UShortInput[joinMap.AudioVideoSource.JoinNumber]); - trilist.SetUShortSigAction(joinMap.AudioVideoSource, (a) => routing.ExecuteNumericSwitch(a, 1, eRoutingSignalType.AudioVideo)); + trilist.SetUShortSigAction(joinMap.AudioVideoSource.JoinNumber, (a) => routing.ExecuteNumericSwitch(a, 1, eRoutingSignalType.AudioVideo)); } } } From 6530856d28a2bfe825edf4a2fa60c40666193772 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Thu, 7 May 2020 15:17:22 -0500 Subject: [PATCH 107/156] Updated DmTxControllerJoinMap and DmTxControllerHelpers --- .../Bridges/JoinMaps/DmTxControllerJoinMap.cs | 139 +++++++----------- .../Endpoints/Transmitters/DmTxHelpers.cs | 46 +++--- 2 files changed, 72 insertions(+), 113 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmTxControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmTxControllerJoinMap.cs index b01da694..7032bad7 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmTxControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmTxControllerJoinMap.cs @@ -2,97 +2,58 @@ namespace PepperDash.Essentials.Core.Bridges { - public class DmTxControllerJoinMap : JoinMapBase + public class DmTxControllerJoinMap : JoinMapBaseAdvanced { - #region Digitals - /// - /// High when device is online (if not attached to a DMP3 or DM chassis with a CPU3 card - /// - public uint IsOnline { get; set; } - /// - /// High when video sync is detected - /// - public uint VideoSyncStatus { get; set; } - /// - /// - /// - public uint FreeRunEnabled { get; set; } - #endregion - - #region Analogs - /// - /// Sets and reports the video source - /// - public uint VideoInput { get; set; } - /// - /// Sets and reports the audio source - /// - public uint AudioInput { get; set; } - /// - /// Reports the highest supported HDCP state level for the corresponding input card - /// - public uint HdcpSupportCapability { get; set; } - /// - /// Sets and reports the current HDCP state for the corresponding input port - /// - public uint Port1HdcpState { get; set; } - /// - /// Sets and reports the current HDCP state for the corresponding input port - /// - public uint Port2HdcpState { get; set; } - - /// - /// Sets and reports the current VGA Brightness level - /// - public uint VgaBrightness { get; set; } - - /// - /// Sets and reports the current VGA Contrast level - /// - public uint VgaContrast { get; set; } - #endregion - - #region Serials - /// - /// Reports the current input resolution - /// - public uint CurrentInputResolution { get; set; } - #endregion + [JoinName("IsOnline")] + public JoinDataComplete IsOnline = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "DM TX Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("VideoSyncStatus")] + public JoinDataComplete VideoSyncStatus = new JoinDataComplete(new JoinData() { JoinNumber = 2, JoinSpan = 1 }, + new JoinMetadata() { Label = "DM TX Video Sync", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("FreeRunEnabled")] + public JoinDataComplete FreeRunEnabled = new JoinDataComplete(new JoinData() { JoinNumber = 3, JoinSpan = 1 }, + new JoinMetadata() { Label = "DM TX Enable Free Run Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("CurrentInputResolution")] + public JoinDataComplete CurrentInputResolution = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "DM TX Current Input Resolution", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("VideoInput")] + public JoinDataComplete VideoInput = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "DM TX Video Input Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("AudioInput")] + public JoinDataComplete AudioInput = new JoinDataComplete(new JoinData() { JoinNumber = 2, JoinSpan = 1 }, + new JoinMetadata() { Label = "DM TX Audio Input Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("HdcpSupportCapability")] + public JoinDataComplete HdcpSupportCapability = new JoinDataComplete(new JoinData() { JoinNumber = 3, JoinSpan = 1 }, + new JoinMetadata() { Label = "DM TX HDCP Support Capability", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("Port1HdcpState")] + public JoinDataComplete Port1HdcpState = new JoinDataComplete(new JoinData() { JoinNumber = 4, JoinSpan = 1 }, + new JoinMetadata() { Label = "DM TX Port 1 HDCP State Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("Port2HdcpState")] + public JoinDataComplete Port2HdcpState = new JoinDataComplete(new JoinData() { JoinNumber = 5, JoinSpan = 1 }, + new JoinMetadata() { Label = "DM TX Port 2 HDCP State Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("VgaBrightness")] + public JoinDataComplete VgaBrightness = new JoinDataComplete(new JoinData() { JoinNumber = 6, JoinSpan = 1 }, + new JoinMetadata() { Label = "DM TX VGA Brightness", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("VgaContrast")] + public JoinDataComplete VgaContrast = new JoinDataComplete(new JoinData() { JoinNumber = 7, JoinSpan = 1 }, + new JoinMetadata() { Label = "DM TX Online", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog }); + + + public DmTxControllerJoinMap(uint joinStart) + : base(joinStart, typeof(DmTxControllerJoinMap)) + { + } - public DmTxControllerJoinMap() - { - // Digital - IsOnline = 1; - VideoSyncStatus = 2; - FreeRunEnabled = 3; - // Serial - CurrentInputResolution = 1; - // Analog - VideoInput = 1; - AudioInput = 2; - HdcpSupportCapability = 3; - Port1HdcpState = 4; - Port2HdcpState = 5; - VgaBrightness = 6; - VgaContrast = 7; - } - - public override void OffsetJoinNumbers(uint joinStart) - { - var joinOffset = joinStart - 1; - - IsOnline = IsOnline + joinOffset; - VideoSyncStatus = VideoSyncStatus + joinOffset; - FreeRunEnabled = FreeRunEnabled + joinOffset; - CurrentInputResolution = CurrentInputResolution + joinOffset; - VideoInput = VideoInput + joinOffset; - AudioInput = AudioInput + joinOffset; - HdcpSupportCapability = HdcpSupportCapability + joinOffset; - Port1HdcpState = Port1HdcpState + joinOffset; - Port2HdcpState = Port2HdcpState + joinOffset; - VgaBrightness = VgaBrightness + joinOffset; - VgaContrast = VgaContrast + joinOffset; - } } } \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs index 81a56008..de2946a9 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs @@ -174,15 +174,13 @@ namespace PepperDash.Essentials.DM protected void LinkDmTxToApi(DmTxControllerBase tx, BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { - var joinMap = new DmTxControllerJoinMap(); + var joinMap = new DmTxControllerJoinMap(joinStart); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - joinMap.OffsetJoinNumbers(joinStart); - if (tx.Hardware is DmHDBasedTEndPoint) { Debug.Console(1, tx, "No properties to link. Skipping device {0}", tx.Name); @@ -191,10 +189,10 @@ namespace PepperDash.Essentials.DM Debug.Console(1, tx, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); - tx.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); - tx.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus]); - tx.AnyVideoInput.VideoStatus.VideoResolutionFeedback.LinkInputSig(trilist.StringInput[joinMap.CurrentInputResolution]); - trilist.UShortInput[joinMap.HdcpSupportCapability].UShortValue = (ushort)tx.HdcpSupportCapability; + tx.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]); + tx.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus.JoinNumber]); + tx.AnyVideoInput.VideoStatus.VideoResolutionFeedback.LinkInputSig(trilist.StringInput[joinMap.CurrentInputResolution.JoinNumber]); + trilist.UShortInput[joinMap.HdcpSupportCapability.JoinNumber].UShortValue = (ushort)tx.HdcpSupportCapability; bool hdcpTypeSimple; @@ -207,15 +205,15 @@ namespace PepperDash.Essentials.DM { var txR = tx as ITxRouting; - trilist.SetUShortSigAction(joinMap.VideoInput, + trilist.SetUShortSigAction(joinMap.VideoInput.JoinNumber, i => txR.ExecuteNumericSwitch(i, 0, eRoutingSignalType.Video)); - trilist.SetUShortSigAction(joinMap.AudioInput, + trilist.SetUShortSigAction(joinMap.AudioInput.JoinNumber, i => txR.ExecuteNumericSwitch(i, 0, eRoutingSignalType.Audio)); - txR.VideoSourceNumericFeedback.LinkInputSig(trilist.UShortInput[joinMap.VideoInput]); - txR.AudioSourceNumericFeedback.LinkInputSig(trilist.UShortInput[joinMap.AudioInput]); + txR.VideoSourceNumericFeedback.LinkInputSig(trilist.UShortInput[joinMap.VideoInput.JoinNumber]); + txR.AudioSourceNumericFeedback.LinkInputSig(trilist.UShortInput[joinMap.AudioInput.JoinNumber]); - trilist.UShortInput[joinMap.HdcpSupportCapability].UShortValue = (ushort)tx.HdcpSupportCapability; + trilist.UShortInput[joinMap.HdcpSupportCapability.JoinNumber].UShortValue = (ushort)tx.HdcpSupportCapability; if (txR.InputPorts[DmPortName.HdmiIn] != null) { @@ -225,14 +223,14 @@ namespace PepperDash.Essentials.DM { var intFeedback = tx.Feedbacks["HdmiInHdcpCapability"] as IntFeedback; if (intFeedback != null) - intFeedback.LinkInputSig(trilist.UShortInput[joinMap.Port1HdcpState]); + intFeedback.LinkInputSig(trilist.UShortInput[joinMap.Port1HdcpState.JoinNumber]); } if (inputPort.ConnectionType == eRoutingPortConnectionType.Hdmi && inputPort.Port != null) { var port = inputPort.Port as EndpointHdmiInput; - SetHdcpCapabilityAction(hdcpTypeSimple, port, joinMap.Port1HdcpState, trilist); + SetHdcpCapabilityAction(hdcpTypeSimple, port, joinMap.Port1HdcpState.JoinNumber, trilist); } } @@ -244,14 +242,14 @@ namespace PepperDash.Essentials.DM { var intFeedback = tx.Feedbacks["HdmiIn1HdcpCapability"] as IntFeedback; if (intFeedback != null) - intFeedback.LinkInputSig(trilist.UShortInput[joinMap.Port1HdcpState]); + intFeedback.LinkInputSig(trilist.UShortInput[joinMap.Port1HdcpState.JoinNumber]); } if (inputPort.ConnectionType == eRoutingPortConnectionType.Hdmi && inputPort.Port != null) { var port = inputPort.Port as EndpointHdmiInput; - SetHdcpCapabilityAction(hdcpTypeSimple, port, joinMap.Port1HdcpState, trilist); + SetHdcpCapabilityAction(hdcpTypeSimple, port, joinMap.Port1HdcpState.JoinNumber, trilist); } } @@ -263,14 +261,14 @@ namespace PepperDash.Essentials.DM { var intFeedback = tx.Feedbacks["HdmiIn2HdcpCapability"] as IntFeedback; if (intFeedback != null) - intFeedback.LinkInputSig(trilist.UShortInput[joinMap.Port1HdcpState]); + intFeedback.LinkInputSig(trilist.UShortInput[joinMap.Port1HdcpState.JoinNumber]); } if (inputPort.ConnectionType == eRoutingPortConnectionType.Hdmi && inputPort.Port != null) { var port = inputPort.Port as EndpointHdmiInput; - SetHdcpCapabilityAction(hdcpTypeSimple, port, joinMap.Port2HdcpState, trilist); + SetHdcpCapabilityAction(hdcpTypeSimple, port, joinMap.Port2HdcpState.JoinNumber, trilist); } } @@ -279,19 +277,19 @@ namespace PepperDash.Essentials.DM var txFreeRun = tx as IHasFreeRun; if (txFreeRun != null) { - txFreeRun.FreeRunEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.FreeRunEnabled]); - trilist.SetBoolSigAction(joinMap.FreeRunEnabled, new Action(txFreeRun.SetFreeRunEnabled)); + txFreeRun.FreeRunEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.FreeRunEnabled.JoinNumber]); + trilist.SetBoolSigAction(joinMap.FreeRunEnabled.JoinNumber, new Action(txFreeRun.SetFreeRunEnabled)); } var txVga = tx as IVgaBrightnessContrastControls; { if (txVga == null) return; - txVga.VgaBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.VgaBrightness]); - txVga.VgaContrastFeedback.LinkInputSig(trilist.UShortInput[joinMap.VgaContrast]); + txVga.VgaBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.VgaBrightness.JoinNumber]); + txVga.VgaContrastFeedback.LinkInputSig(trilist.UShortInput[joinMap.VgaContrast.JoinNumber]); - trilist.SetUShortSigAction(joinMap.VgaBrightness, txVga.SetVgaBrightness); - trilist.SetUShortSigAction(joinMap.VgaContrast, txVga.SetVgaContrast); + trilist.SetUShortSigAction(joinMap.VgaBrightness.JoinNumber, txVga.SetVgaBrightness); + trilist.SetUShortSigAction(joinMap.VgaContrast.JoinNumber, txVga.SetVgaContrast); } } From 230f29d3f88eb5404f22a86ae6061a891b08d62b Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Thu, 7 May 2020 15:42:46 -0500 Subject: [PATCH 108/156] Updated GenericLightingJoinMap, LightingBase, and LutronQuantum --- .../JoinMaps/GenericLightingJoinMap.cs | 56 ++++++++++--------- .../Lighting/LightingBase.cs | 25 ++++----- .../Environment/Lutron/LutronQuantum.cs | 4 +- 3 files changed, 41 insertions(+), 44 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/GenericLightingJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/GenericLightingJoinMap.cs index 242be651..f639cff0 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/GenericLightingJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/GenericLightingJoinMap.cs @@ -9,33 +9,35 @@ using PepperDash.Essentials.Core; namespace PepperDash.Essentials.Core.Bridges { - public class GenericLightingJoinMap : JoinMapBase - { - public uint IsOnline { get; set; } - public uint SelectScene { get; set; } - public uint LightingSceneOffset { get; set; } - public uint ButtonVisibilityOffset { get; set; } - public uint IntegrationIdSet { get; set; } - - public GenericLightingJoinMap() - { - // Digital - IsOnline = 1; - SelectScene = 1; - IntegrationIdSet = 1; - LightingSceneOffset = 10; - ButtonVisibilityOffset = 40; - // Analog - } - - public override void OffsetJoinNumbers(uint joinStart) - { - var joinOffset = joinStart - 1; - - IsOnline = IsOnline + joinOffset; - SelectScene = SelectScene + joinOffset; - LightingSceneOffset = LightingSceneOffset + joinOffset; - ButtonVisibilityOffset = ButtonVisibilityOffset + joinOffset; + public class GenericLightingJoinMap : JoinMapBaseAdvanced + { + + [JoinName("IsOnline")] + public JoinDataComplete IsOnline = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "Lighting Controller Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("SelectScene")] + public JoinDataComplete SelectScene = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "Lighting Controller Select Scene By Index", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("SelectSceneDirect")] + public JoinDataComplete SelectSceneDirect = new JoinDataComplete(new JoinData() { JoinNumber = 11, JoinSpan = 10 }, + new JoinMetadata() { Label = "Lighting Controller Select Scene", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.DigitalSerial }); + + [JoinName("ButtonVisibility")] + public JoinDataComplete ButtonVisibility = new JoinDataComplete(new JoinData() { JoinNumber = 41, JoinSpan = 10 }, + new JoinMetadata() { Label = "Lighting Controller Button Visibility", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("IntegrationIdSet")] + public JoinDataComplete IntegrationIdSet = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "Lighting Controller Set Integration Id", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Serial }); + + + + + public GenericLightingJoinMap(uint joinStart) + : base(joinStart, typeof(GenericLightingJoinMap)) + { } } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Lighting/LightingBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Lighting/LightingBase.cs index c22745c0..d649565d 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Lighting/LightingBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Lighting/LightingBase.cs @@ -72,36 +72,31 @@ namespace PepperDash.Essentials.Core.Lighting protected GenericLightingJoinMap LinkLightingToApi(LightingBase lightingDevice, BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) - { - var joinMap = new GenericLightingJoinMap(); + { + var joinMap = new GenericLightingJoinMap(joinStart); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - joinMap.OffsetJoinNumbers(joinStart); - Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); Debug.Console(0, "Linking to Lighting Type {0}", lightingDevice.GetType().Name.ToString()); - // GenericLighitng Actions & FeedBack - trilist.SetUShortSigAction(joinMap.SelectScene, u => lightingDevice.SelectScene(lightingDevice.LightingScenes[u])); + // GenericLighitng Actions & FeedBack + trilist.SetUShortSigAction(joinMap.SelectScene.JoinNumber, u => lightingDevice.SelectScene(lightingDevice.LightingScenes[u])); - var sceneIndex = 1; + var sceneIndex = 0; foreach (var scene in lightingDevice.LightingScenes) - { - var tempIndex = sceneIndex - 1; - trilist.SetSigTrueAction((uint)(joinMap.LightingSceneOffset + sceneIndex), () => lightingDevice.SelectScene(lightingDevice.LightingScenes[tempIndex])); - scene.IsActiveFeedback.LinkInputSig(trilist.BooleanInput[(uint)(joinMap.LightingSceneOffset + sceneIndex)]); - trilist.StringInput[(uint)(joinMap.LightingSceneOffset + sceneIndex)].StringValue = scene.Name; - trilist.BooleanInput[(uint)(joinMap.ButtonVisibilityOffset + sceneIndex)].BoolValue = true; + { + trilist.SetSigTrueAction((uint)(joinMap.SelectSceneDirect.JoinNumber + sceneIndex), () => lightingDevice.SelectScene(lightingDevice.LightingScenes[sceneIndex])); + scene.IsActiveFeedback.LinkInputSig(trilist.BooleanInput[(uint)(joinMap.SelectSceneDirect.JoinNumber + sceneIndex)]); + trilist.StringInput[(uint)(joinMap.SelectSceneDirect.JoinNumber + sceneIndex)].StringValue = scene.Name; + trilist.BooleanInput[(uint)(joinMap.ButtonVisibility.JoinNumber + sceneIndex)].BoolValue = true; sceneIndex++; } - - return joinMap; } diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Environment/Lutron/LutronQuantum.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Environment/Lutron/LutronQuantum.cs index 84cf46c2..23bbc913 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Environment/Lutron/LutronQuantum.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Environment/Lutron/LutronQuantum.cs @@ -85,8 +85,8 @@ namespace PepperDash.Essentials.Devices.Common.Environment.Lutron { var joinMap = LinkLightingToApi(this, trilist, joinStart, joinMapKey, bridge); - CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); - trilist.SetStringSigAction(joinMap.IntegrationIdSet, s => IntegrationId = s); + CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]); + trilist.SetStringSigAction(joinMap.IntegrationIdSet.JoinNumber , s => IntegrationId = s); } void socket_ConnectionChange(object sender, GenericSocketStatusChageEventArgs e) From adbb76b87cbc46ab9c28d98b357a907f93ef8d8e Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Thu, 7 May 2020 15:54:47 -0500 Subject: [PATCH 109/156] Updated GenericRelayControllerJoinMap and GenericRelayDevice --- .../JoinMaps/GenericRelayControllerJoinMap.cs | 26 +++++++------------ .../Crestron IO/Relay/GenericRelayDevice.cs | 10 +++---- 2 files changed, 13 insertions(+), 23 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/GenericRelayControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/GenericRelayControllerJoinMap.cs index e4ccdfbd..894b7fd3 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/GenericRelayControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/GenericRelayControllerJoinMap.cs @@ -7,25 +7,17 @@ using PepperDash.Essentials.Core; namespace PepperDash.Essentials.Core.Bridges { - public class GenericRelayControllerJoinMap : JoinMapBase + public class GenericRelayControllerJoinMap : JoinMapBaseAdvanced { - #region Digitals - /// - /// Sets and reports the state of the relay (High = closed, Low = Open) - /// - public uint Relay { get; set; } - #endregion - public GenericRelayControllerJoinMap() - { - Relay = 1; - } - - public override void OffsetJoinNumbers(uint joinStart) - { - var joinOffset = joinStart - 1; - - Relay = Relay + joinOffset; + [JoinName("Relay")] + public JoinDataComplete Relay = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "Device Relay State Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + + public GenericRelayControllerJoinMap(uint joinStart) + : base(joinStart, typeof(GenericRelayControllerJoinMap)) + { } } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Relay/GenericRelayDevice.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Relay/GenericRelayDevice.cs index aac9de44..5f03c27d 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Relay/GenericRelayDevice.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Relay/GenericRelayDevice.cs @@ -70,16 +70,14 @@ namespace PepperDash.Essentials.Core.CrestronIO #endregion public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) - { - var joinMap = new GenericRelayControllerJoinMap(); + { + var joinMap = new GenericRelayControllerJoinMap(joinStart); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - joinMap.OffsetJoinNumbers(joinStart); - if (RelayOutput == null) { Debug.Console(1, this, "Unable to link device '{0}'. Relay is null", Key); @@ -88,7 +86,7 @@ namespace PepperDash.Essentials.Core.CrestronIO Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); - trilist.SetBoolSigAction(joinMap.Relay, b => + trilist.SetBoolSigAction(joinMap.Relay.JoinNumber, b => { if (b) CloseRelay(); @@ -98,7 +96,7 @@ namespace PepperDash.Essentials.Core.CrestronIO // feedback for relay state - OutputIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Relay]); + OutputIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Relay.JoinNumber]); } } From e387a5534b05111db0bcd8a2c6e19994a0c160dd Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 5 May 2020 15:41:46 -0600 Subject: [PATCH 110/156] removes unnecessary things and removes virtual keyword on properties --- .../Endpoints/Receivers/DmRmcHelper.cs | 83 ++++++++----------- 1 file changed, 34 insertions(+), 49 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs index 91085fca..0315ee1e 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs @@ -1,12 +1,7 @@ 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.Endpoints; using Crestron.SimplSharpPro.DM.Endpoints.Receivers; using Newtonsoft.Json; using PepperDash.Core; @@ -20,20 +15,18 @@ namespace PepperDash.Essentials.DM [Description("Wrapper class for all DM-RMC variants")] public abstract class DmRmcControllerBase : CrestronGenericBridgeableBaseDevice { - public virtual StringFeedback VideoOutputResolutionFeedback { get; protected set; } - public virtual StringFeedback EdidManufacturerFeedback { get; protected set; } - public virtual StringFeedback EdidNameFeedback { get; protected set; } - public virtual StringFeedback EdidPreferredTimingFeedback { get; protected set; } - public virtual StringFeedback EdidSerialNumberFeedback { get; protected set; } + public StringFeedback VideoOutputResolutionFeedback { get; protected set; } + public StringFeedback EdidManufacturerFeedback { get; protected set; } + public StringFeedback EdidNameFeedback { get; protected set; } + public StringFeedback EdidPreferredTimingFeedback { get; protected set; } + public StringFeedback EdidSerialNumberFeedback { get; protected set; } protected DmRmcControllerBase(string key, string name, EndpointReceiverBase device) : base(key, name, device) { // if wired to a chassis, skip registration step in base class - if (device.DMOutput != null) - { - this.PreventRegistration = true; - } + PreventRegistration = device.DMOutput != null; + AddToFeedbackList(VideoOutputResolutionFeedback, EdidManufacturerFeedback, EdidSerialNumberFeedback, EdidNameFeedback, EdidPreferredTimingFeedback); } @@ -65,13 +58,15 @@ namespace PepperDash.Essentials.DM //If the device is an DM-RMC-4K-Z-SCALER-C var routing = rmc as IRmcRouting; - if (routing != null) + if (routing == null) { - if (routing.AudioVideoSourceNumericFeedback != null) - routing.AudioVideoSourceNumericFeedback.LinkInputSig(trilist.UShortInput[joinMap.AudioVideoSource]); - - trilist.SetUShortSigAction(joinMap.AudioVideoSource, (a) => routing.ExecuteNumericSwitch(a, 1, eRoutingSignalType.AudioVideo)); + return; } + + if (routing.AudioVideoSourceNumericFeedback != null) + routing.AudioVideoSourceNumericFeedback.LinkInputSig(trilist.UShortInput[joinMap.AudioVideoSource]); + + trilist.SetUShortSigAction(joinMap.AudioVideoSource, a => routing.ExecuteNumericSwitch(a, 1, eRoutingSignalType.AudioVideo)); } } @@ -82,7 +77,7 @@ namespace PepperDash.Essentials.DM /// /// Make a Crestron RMC and put it in here /// - public DmHdBaseTControllerBase(string key, string name, HDBaseTBase rmc) + protected DmHdBaseTControllerBase(string key, string name, HDBaseTBase rmc) : base(key, name, rmc) { @@ -91,14 +86,15 @@ namespace PepperDash.Essentials.DM public class DmRmcHelper { - /// - /// A factory method for various DmTxControllers - /// - /// - /// - /// - /// - public static CrestronGenericBaseDevice GetDmRmcController(string key, string name, string typeName, DmRmcPropertiesConfig props) + /// + /// A factory method for various DmRmcControllers + /// + /// device key. Used to uniquely identify device + /// device name + /// device type name. Used to retrived the correct device + /// Config from config file + /// + public static CrestronGenericBaseDevice GetDmRmcController(string key, string name, string typeName, DmRmcPropertiesConfig props) { // switch on type name... later... @@ -128,22 +124,11 @@ namespace PepperDash.Essentials.DM // "destinationPort": "DmIn" //} - var tlc = TieLineCollection.Default; - // grab the tie line that has this key as + // grab the tie line that has this key as // THIS DOESN'T WORK BECAUSE THE RMC THAT WE NEED (THIS) HASN'T BEEN MADE // YET AND THUS WILL NOT HAVE A TIE LINE... - var inputTieLine = tlc.FirstOrDefault(t => - { - var d = t.DestinationPort.ParentDevice; - return d.Key.Equals(key, StringComparison.OrdinalIgnoreCase) - && d is DmChassisController; - }); - var pKey = props.ParentDeviceKey.ToLower(); - - - // Non-DM-chassis endpoints if (pKey == "processor") { @@ -200,18 +185,17 @@ namespace PepperDash.Essentials.DM var chassis = (parentDev as IDmSwitch).Chassis; var num = props.ParentOutputNumber; + if (num <= 0 || num > chassis.NumberOfOutputs) { Debug.Console(0, "Cannot create DM device '{0}'. Output number '{1}' is out of range", key, num); return null; } - else - { - var controller = (parentDev as IDmSwitch); - controller.RxDictionary.Add(num, key); - } - // Catch constructor failures, mainly dues to IPID + + var controller = (parentDev as IDmSwitch); + controller.RxDictionary.Add(num, key); + // Catch constructor failures, mainly dues to IPID try { @@ -305,7 +289,8 @@ namespace PepperDash.Essentials.DM { public DmRmcControllerFactory() { - TypeNames = new List() { "hdbasetrx", "dmrmc4k100c1g", "dmrmc100c", "dmrmc100s", "dmrmc4k100c", "dmrmc150s", + TypeNames = new List + { "hdbasetrx", "dmrmc4k100c1g", "dmrmc100c", "dmrmc100s", "dmrmc4k100c", "dmrmc150s", "dmrmc200c", "dmrmc200s", "dmrmc200s2", "dmrmcscalerc", "dmrmcscalers", "dmrmcscalers2", "dmrmc4kscalerc", "dmrmc4kscalercdsp", "dmrmc4kz100c", "dmrmckzscalerc" }; } @@ -317,8 +302,8 @@ namespace PepperDash.Essentials.DM Debug.Console(1, "Factory Attempting to create new DM-RMC Device"); var props = JsonConvert.DeserializeObject - (dc.Properties.ToString()); - return PepperDash.Essentials.DM.DmRmcHelper.GetDmRmcController(dc.Key, dc.Name, type, props); + (dc.Properties.ToString()); + return DmRmcHelper.GetDmRmcController(dc.Key, dc.Name, type, props); } } From acfd82fa827bb2fda9d2e16810b2d8022e76cd12 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 5 May 2020 16:47:57 -0600 Subject: [PATCH 111/156] updates DmRmcHelper to use dicts uses dicts for type lookups to make things more readable --- .../Endpoints/Receivers/DmRmcHelper.cs | 374 +++++++++--------- 1 file changed, 193 insertions(+), 181 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs index 0315ee1e..ce04146e 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs @@ -86,6 +86,108 @@ namespace PepperDash.Essentials.DM public class DmRmcHelper { + private static readonly Dictionary> ProcessorFactoryDict; + private static readonly Dictionary> ChassisCpu3Dict; + + private static readonly Dictionary> + ChassisDict; + + static DmRmcHelper() + { + ProcessorFactoryDict = new Dictionary> + { + {"dmrmc100c", (k, n, i) => new DmRmcX100CController(k, n, new DmRmc100C(i, Global.ControlSystem))}, + {"dmrmc100s", (k, n, i) => new DmRmc100SController(k, n, new DmRmc100S(i, Global.ControlSystem))}, + {"dmrmc4k100c", (k, n, i) => new DmRmcX100CController(k, n, new DmRmc4k100C(i, Global.ControlSystem))}, + {"dmrmc4kz100c", (k, n, i) => new DmRmc4kZ100CController(k, n, new DmRmc4kz100C(i, Global.ControlSystem))}, + {"dmrmc150s", (k, n, i) => new DmRmc150SController(k, n, new DmRmc150S(i, Global.ControlSystem))}, + {"dmrmc200c", (k, n, i) => new DmRmc200CController(k, n, new DmRmc200C(i, Global.ControlSystem))}, + {"dmrmc200s", (k, n, i) => new DmRmc200SController(k, n, new DmRmc200S(i, Global.ControlSystem))}, + {"dmrmc200s2", (k, n, i) => new DmRmc200S2Controller(k, n, new DmRmc200S2(i, Global.ControlSystem))}, + {"dmrmcscalerc", (k, n, i) => new DmRmcScalerCController(k, n, new DmRmcScalerC(i, Global.ControlSystem))}, + {"dmrmcscalers", (k, n, i) => new DmRmcScalerSController(k, n, new DmRmcScalerS(i, Global.ControlSystem))}, + { + "dmrmcscalers2", + (k, n, i) => new DmRmcScalerS2Controller(k, n, new DmRmcScalerS2(i, Global.ControlSystem)) + }, + { + "dmrmc4kscalerc", + (k, n, i) => new DmRmc4kScalerCController(k, n, new DmRmc4kScalerC(i, Global.ControlSystem)) + }, + { + "dmrmc4kscalercdsp", + (k, n, i) => new DmRmc4kScalerCDspController(k, n, new DmRmc4kScalerCDsp(i, Global.ControlSystem)) + }, + { + "dmrmc4kzscalerc", + (k, n, i) => new DmRmc4kZScalerCController(k, n, new DmRmc4kzScalerC(i, Global.ControlSystem)) + } + }; + + ChassisCpu3Dict = new Dictionary> + { + {"dmrmc100c", (k, n, d) => new DmRmcX100CController(k, n, new DmRmc100C(d))}, + {"dmrmc100s", (k, n, d) => new DmRmc100SController(k, n, new DmRmc100S(d))}, + {"dmrmc4k100c", (k, n, d) => new DmRmcX100CController(k, n, new DmRmc4k100C(d))}, + {"dmrmc4kz100c", (k, n, d) => new DmRmc4kZ100CController(k, n, new DmRmc4kz100C(d))}, + {"dmrmc150s", (k, n, d) => new DmRmc150SController(k, n, new DmRmc150S(d))}, + {"dmrmc200c", (k, n, d) => new DmRmc200CController(k, n, new DmRmc200C(d))}, + {"dmrmc200s", (k, n, d) => new DmRmc200SController(k, n, new DmRmc200S(d))}, + {"dmrmc200s2", (k, n, d) => new DmRmc200S2Controller(k, n, new DmRmc200S2(d))}, + {"dmrmcscalerc", (k, n, d) => new DmRmcScalerCController(k, n, new DmRmcScalerC(d))}, + {"dmrmcscalers", (k, n, d) => new DmRmcScalerSController(k, n, new DmRmcScalerS(d))}, + { + "dmrmcscalers2", + (k, n, d) => new DmRmcScalerS2Controller(k, n, new DmRmcScalerS2(d)) + }, + { + "dmrmc4kscalerc", + (k, n, d) => new DmRmc4kScalerCController(k, n, new DmRmc4kScalerC(d)) + }, + { + "dmrmc4kscalercdsp", + (k, n, d) => new DmRmc4kScalerCDspController(k, n, new DmRmc4kScalerCDsp(d)) + }, + { + "dmrmc4kzscalerc", + (k, n, d) => new DmRmc4kZScalerCController(k, n, new DmRmc4kzScalerC(d)) + }, + {"hdbasetrx", (k,n,d) => new HDBaseTRxController(k,n, new HDRx3CB(d))}, + {"dmrmc4k100c1g", (k,n,d) => new DmRmc4k100C1GController(k,n, new DmRmc4K100C1G(d))} + }; + + ChassisDict = new Dictionary> + { + {"dmrmc100c", (k, n, i, d) => new DmRmcX100CController(k, n, new DmRmc100C(i,d))}, + {"dmrmc100s", (k, n,i, d) => new DmRmc100SController(k, n, new DmRmc100S(i,d))}, + {"dmrmc4k100c", (k, n,i, d) => new DmRmcX100CController(k, n, new DmRmc4k100C(i,d))}, + {"dmrmc4kz100c", (k, n,i, d) => new DmRmc4kZ100CController(k, n, new DmRmc4kz100C(i,d))}, + {"dmrmc150s", (k, n,i, d) => new DmRmc150SController(k, n, new DmRmc150S(i,d))}, + {"dmrmc200c", (k, n,i, d) => new DmRmc200CController(k, n, new DmRmc200C(i,d))}, + {"dmrmc200s", (k, n,i, d) => new DmRmc200SController(k, n, new DmRmc200S(i,d))}, + {"dmrmc200s2", (k, n,i, d) => new DmRmc200S2Controller(k, n, new DmRmc200S2(i,d))}, + {"dmrmcscalerc", (k, n,i, d) => new DmRmcScalerCController(k, n, new DmRmcScalerC(i,d))}, + {"dmrmcscalers", (k, n,i, d) => new DmRmcScalerSController(k, n, new DmRmcScalerS(i,d))}, + { + "dmrmcscalers2", + (k, n,i, d) => new DmRmcScalerS2Controller(k, n, new DmRmcScalerS2(d)) + }, + { + "dmrmc4kscalerc", + (k, n,i, d) => new DmRmc4kScalerCController(k, n, new DmRmc4kScalerC(d)) + }, + { + "dmrmc4kscalercdsp", + (k, n,i, d) => new DmRmc4kScalerCDspController(k, n, new DmRmc4kScalerCDsp(d)) + }, + { + "dmrmc4kzscalerc", + (k, n,i, d) => new DmRmc4kZScalerCController(k, n, new DmRmc4kzScalerC(d)) + }, + {"hdbasetrx", (k,n,i,d) => new HDBaseTRxController(k,n, new HDRx3CB(d))}, + {"dmrmc4k100c1g", (k,n,i,d) => new DmRmc4k100C1GController(k,n, new DmRmc4K100C1G(d))} + }; + } /// /// A factory method for various DmRmcControllers /// @@ -96,193 +198,103 @@ namespace PepperDash.Essentials.DM /// public static CrestronGenericBaseDevice GetDmRmcController(string key, string name, string typeName, DmRmcPropertiesConfig props) { - // switch on type name... later... - typeName = typeName.ToLower(); - uint ipid = props.Control.IpIdInt; // Convert.ToUInt16(props.Id, 16); + var ipid = props.Control.IpIdInt; - - - // right here, we need to grab the tie line that associates this - // RMC with a chassis or processor. If the RMC input's tie line is not - // connected to a chassis, then it's parent is the processor. - // If the RMC is connected to a chassis, then we need to grab the - // output number from the tie line and use that to plug it in. - // Example of chassis-connected: - //{ - // "sourceKey": "dmMd8x8-1", - // "sourcePort": "anyOut2", - // "destinationKey": "dmRmc100C-2", - // "destinationPort": "DmIn" - //} - - // Tx -> RMC link: - //{ - // "sourceKey": "dmTx201C-1", - // "sourcePort": "DmOut", - // "destinationKey": "dmRmc100C-2", - // "destinationPort": "DmIn" - //} - - // grab the tie line that has this key as - // THIS DOESN'T WORK BECAUSE THE RMC THAT WE NEED (THIS) HASN'T BEEN MADE - // YET AND THUS WILL NOT HAVE A TIE LINE... var pKey = props.ParentDeviceKey.ToLower(); // Non-DM-chassis endpoints - if (pKey == "processor") - { - // Catch constructor failures, mainly dues to IPID - try - { - if (typeName.StartsWith("dmrmc100c")) - return new DmRmcX100CController(key, name, new DmRmc100C(ipid, Global.ControlSystem)); - if (typeName.StartsWith("dmrmc100s")) - return new DmRmc100SController(key, name, new DmRmc100S(ipid, Global.ControlSystem)); - if (typeName.StartsWith("dmrmc4k100c")) - return new DmRmcX100CController(key, name, new DmRmc4k100C(ipid, Global.ControlSystem)); - if (typeName.StartsWith("dmrmc4kz100c")) - return new DmRmc4kZ100CController(key, name, new DmRmc4kz100C(ipid, Global.ControlSystem)); - if (typeName.StartsWith("dmrmc150s")) - return new DmRmc150SController(key, name, new DmRmc150S(ipid, Global.ControlSystem)); - if (typeName.StartsWith("dmrmc200c")) - return new DmRmc200CController(key, name, new DmRmc200C(ipid, Global.ControlSystem)); - if (typeName.StartsWith("dmrmc200s")) - return new DmRmc200SController(key, name, new DmRmc200S(ipid, Global.ControlSystem)); - if (typeName.StartsWith("dmrmc200s2")) - return new DmRmc200S2Controller(key, name, new DmRmc200S2(ipid, Global.ControlSystem)); - if (typeName.StartsWith("dmrmcscalerc")) - return new DmRmcScalerCController(key, name, new DmRmcScalerC(ipid, Global.ControlSystem)); - if (typeName.StartsWith("dmrmcscalers")) - return new DmRmcScalerSController(key, name, new DmRmcScalerS(ipid, Global.ControlSystem)); - if (typeName.StartsWith("dmrmcscalers2")) - return new DmRmcScalerS2Controller(key, name, new DmRmcScalerS2(ipid, Global.ControlSystem)); - if (typeName.StartsWith("dmrmc4kscalerc")) - return new DmRmc4kScalerCController(key, name, new DmRmc4kScalerC(ipid, Global.ControlSystem)); - if (typeName.StartsWith("dmrmc4kscalercdsp")) - return new DmRmc4kScalerCDspController(key, name, new DmRmc4kScalerCDsp(ipid, Global.ControlSystem)); - if (typeName.StartsWith("dmrmc4kzscalerc")) - return new DmRmc4kZScalerCController(key, name, new DmRmc4kzScalerC(ipid, Global.ControlSystem)); - } - catch (Exception e) - { - Debug.Console(0, "[{0}] WARNING: Cannot create DM-RMC device: {1}", key, e.Message); - } - - - Debug.Console(0, "Cannot create DM-RMC of type: '{0}'", typeName); - } - // Endpoints attached to DM Chassis - else - { - var parentDev = DeviceManager.GetDeviceForKey(pKey); - if (!(parentDev is IDmSwitch)) - { - Debug.Console(0, "Cannot create DM device '{0}'. '{1}' is not a DM Chassis.", - key, pKey); - return null; - } - - var chassis = (parentDev as IDmSwitch).Chassis; - var num = props.ParentOutputNumber; - - if (num <= 0 || num > chassis.NumberOfOutputs) - { - Debug.Console(0, "Cannot create DM device '{0}'. Output number '{1}' is out of range", - key, num); - return null; - } - - var controller = (parentDev as IDmSwitch); - controller.RxDictionary.Add(num, key); - // Catch constructor failures, mainly dues to IPID - try - { - - // Must use different constructor for CPU3 chassis types. No IPID - if (chassis is DmMd8x8Cpu3 || chassis is DmMd16x16Cpu3 || - chassis is DmMd32x32Cpu3 || chassis is DmMd8x8Cpu3rps || - chassis is DmMd16x16Cpu3rps || chassis is DmMd32x32Cpu3rps || - chassis is DmMd128x128 || chassis is DmMd64x64) - { - if (typeName.StartsWith("hdbasetrx")) - return new HDBaseTRxController(key, name, new HDRx3CB(chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc4k100c1g")) - return new DmRmc4k100C1GController(key, name, new DmRmc4K100C1G(chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc100c")) - return new DmRmcX100CController(key, name, new DmRmc100C(chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc100s")) - return new DmRmc100SController(key, name, new DmRmc100S(chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc4k100c")) - return new DmRmcX100CController(key, name, new DmRmc4k100C(chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc4kz100c")) - return new DmRmc4kZ100CController(key, name, new DmRmc4kz100C(chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc150s")) - return new DmRmc150SController(key, name, new DmRmc150S(chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc200c")) - return new DmRmc200CController(key, name, new DmRmc200C(chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc200s")) - return new DmRmc200SController(key, name, new DmRmc200S(chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc200s2")) - return new DmRmc200S2Controller(key, name, new DmRmc200S2(chassis.Outputs[num])); - if (typeName.StartsWith("dmrmcscalerc")) - return new DmRmcScalerCController(key, name, new DmRmcScalerC(chassis.Outputs[num])); - if (typeName.StartsWith("dmrmcscalers")) - return new DmRmcScalerSController(key, name, new DmRmcScalerS(chassis.Outputs[num])); - if (typeName.StartsWith("dmrmcscalers2")) - return new DmRmcScalerS2Controller(key, name, new DmRmcScalerS2(chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc4kscalerc")) - return new DmRmc4kScalerCController(key, name, new DmRmc4kScalerC(chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc4kscalercdsp")) - return new DmRmc4kScalerCDspController(key, name, new DmRmc4kScalerCDsp(chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc4kzscalerc")) - return new DmRmc4kZScalerCController(key, name, new DmRmc4kzScalerC(chassis.Outputs[num])); - } - else - { - if (typeName.StartsWith("hdbasetrx")) - return new HDBaseTRxController(key, name, new HDRx3CB(ipid, chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc4k100c1g")) - return new DmRmc4k100C1GController(key, name, new DmRmc4K100C1G(ipid, chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc100c")) - return new DmRmcX100CController(key, name, new DmRmc100C(ipid, chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc100s")) - return new DmRmc100SController(key, name, new DmRmc100S(ipid, chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc4k100c")) - return new DmRmcX100CController(key, name, new DmRmc4k100C(ipid, chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc4kz100c")) - return new DmRmc4kZ100CController(key, name, new DmRmc4kz100C(ipid, chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc150s")) - return new DmRmc150SController(key, name, new DmRmc150S(ipid, chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc200c")) - return new DmRmc200CController(key, name, new DmRmc200C(ipid, chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc200s")) - return new DmRmc200SController(key, name, new DmRmc200S(ipid, chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc200s2")) - return new DmRmc200S2Controller(key, name, new DmRmc200S2(ipid, chassis.Outputs[num])); - if (typeName.StartsWith("dmrmcscalerc")) - return new DmRmcScalerCController(key, name, new DmRmcScalerC(ipid, chassis.Outputs[num])); - if (typeName.StartsWith("dmrmcscalers")) - return new DmRmcScalerSController(key, name, new DmRmcScalerS(ipid, chassis.Outputs[num])); - if (typeName.StartsWith("dmrmcscalers2")) - return new DmRmcScalerS2Controller(key, name, new DmRmcScalerS2(ipid, chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc4kscalerc")) - return new DmRmc4kScalerCController(key, name, new DmRmc4kScalerC(ipid, chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc4kscalercdsp")) - return new DmRmc4kScalerCDspController(key, name, new DmRmc4kScalerCDsp(ipid, chassis.Outputs[num])); - if (typeName.StartsWith("dmrmc4kzscalerc")) - return new DmRmc4kZScalerCController(key, name, new DmRmc4kzScalerC(chassis.Outputs[num])); - - } - } - catch (Exception e) - { - Debug.Console(0, "[{0}] WARNING: Cannot create DM-RMC device: {1}", key, e.Message); - } - } - - return null; + return pKey == "processor" ? GetDmRmcControllerForProcessor(key, name, typeName, ipid) : GetDmRmcControllerForChassis(key, name, typeName, props, pKey, ipid); } + + private static CrestronGenericBaseDevice GetDmRmcControllerForChassis(string key, string name, string typeName, + DmRmcPropertiesConfig props, string pKey, uint ipid) + { + var parentDev = DeviceManager.GetDeviceForKey(pKey); + if (!(parentDev is IDmSwitch)) + { + Debug.Console(0, "Cannot create DM device '{0}'. '{1}' is not a DM Chassis.", + key, pKey); + return null; + } + + var chassis = (parentDev as IDmSwitch).Chassis; + var num = props.ParentOutputNumber; + + if (num <= 0 || num > chassis.NumberOfOutputs) + { + Debug.Console(0, "Cannot create DM device '{0}'. Output number '{1}' is out of range", + key, num); + return null; + } + + var controller = parentDev as IDmSwitch; + controller.RxDictionary.Add(num, key); + // Catch constructor failures, mainly dues to IPID + try + { + // Must use different constructor for CPU3 chassis types. No IPID + if (chassis is DmMd8x8Cpu3 || chassis is DmMd16x16Cpu3 || + chassis is DmMd32x32Cpu3 || chassis is DmMd8x8Cpu3rps || + chassis is DmMd16x16Cpu3rps || chassis is DmMd32x32Cpu3rps || + chassis is DmMd128x128 || chassis is DmMd64x64) + { + return GetDmRmcControllerForCpu3Chassis(key, name, typeName, chassis, num, parentDev); + } + + return GetDmRmcControllerForCpu2Chassis(key, name, typeName, ipid, chassis, num, parentDev); + } + catch (Exception e) + { + Debug.Console(0, "[{0}] WARNING: Cannot create DM-RMC device: {1}", key, e.Message); + return null; + } + } + + private static CrestronGenericBaseDevice GetDmRmcControllerForCpu2Chassis(string key, string name, string typeName, + uint ipid, Switch chassis, uint num, IKeyed parentDev) + { + Func handler; + if (ChassisDict.TryGetValue(typeName.ToLower(), out handler)) + { + return handler(key, name, ipid, chassis.Outputs[num]); + } + Debug.Console(0, "Cannot create DM-RMC of type '{0}' with parent device {1}", typeName, parentDev.Key); + return null; + } + + private static CrestronGenericBaseDevice GetDmRmcControllerForCpu3Chassis(string key, string name, string typeName, + Switch chassis, uint num, IKeyed parentDev) + { + Func cpu3Handler; + if (ChassisCpu3Dict.TryGetValue(typeName.ToLower(), out cpu3Handler)) + { + return cpu3Handler(key, name, chassis.Outputs[num]); + } + Debug.Console(0, "Cannot create DM-RMC of type '{0}' with parent device {1}", typeName, parentDev.Key); + return null; + } + + private static CrestronGenericBaseDevice GetDmRmcControllerForProcessor(string key, string name, string typeName, uint ipid) + { + try + { + Func handler; + + if (ProcessorFactoryDict.TryGetValue(typeName.ToLower(), out handler)) + { + return handler(key, name, ipid); + } + Debug.Console(0, "Cannot create DM-RMC of type: '{0}'", typeName); + + return null; + } + catch (Exception e) + { + Debug.Console(0, "[{0}] WARNING: Cannot create DM-RMC device: {1}", key, e.Message); + return null; + } + } } public class DmRmcControllerFactory : EssentialsDeviceFactory From 404f5c921b734c76d2920241827ec87e4f76143a Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 5 May 2020 16:49:44 -0600 Subject: [PATCH 112/156] removes unnecessary usings --- .../Receivers/DmHdBaseTEndpointController.cs | 9 +-- .../Receivers/DmRmc100SController.cs | 8 +-- .../Receivers/DmRmc150SController.cs | 8 +-- .../Receivers/DmRmc200CController.cs | 7 +-- .../Receivers/DmRmc200S2Controller.cs | 7 +-- .../Receivers/DmRmc200SController.cs | 7 +-- .../Receivers/DmRmc4KScalerCController.cs | 7 +-- .../Receivers/DmRmc4k100C1GController.cs | 8 +-- .../Receivers/DmRmc4kScalerCDspController.cs | 7 +-- .../Receivers/DmRmc4kZ100CController.cs | 8 +-- .../Receivers/DmRmc4kZScalerCController.cs | 60 +++++++++---------- .../Receivers/DmRmcScalerCController.cs | 7 +-- .../Receivers/DmRmcScalerS2Controller.cs | 7 +-- .../Receivers/DmRmcScalerSController.cs | 7 +-- .../Receivers/DmRmcX100CController.cs | 8 +-- 15 files changed, 42 insertions(+), 123 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmHdBaseTEndpointController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmHdBaseTEndpointController.cs index 43ac9fc2..6332b853 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmHdBaseTEndpointController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmHdBaseTEndpointController.cs @@ -1,11 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.DM; -using Crestron.SimplSharpPro.DM.Endpoints; +using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.DM.Endpoints.Receivers; using PepperDash.Essentials.Core; diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc100SController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc100SController.cs index ef70e4f7..d3aed367 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc100SController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc100SController.cs @@ -1,12 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DM; -using Crestron.SimplSharpPro.DM.Endpoints; using Crestron.SimplSharpPro.DM.Endpoints.Receivers; using PepperDash.Essentials.Core; diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc150SController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc150SController.cs index faff23d4..4f4a5413 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc150SController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc150SController.cs @@ -1,12 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DM; -using Crestron.SimplSharpPro.DM.Endpoints; using Crestron.SimplSharpPro.DM.Endpoints.Receivers; using PepperDash.Essentials.Core; diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200CController.cs index 44b1af6c..e8449560 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200CController.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DM; using Crestron.SimplSharpPro.DM.Endpoints; diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200S2Controller.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200S2Controller.cs index c30b680f..4da83f1b 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200S2Controller.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200S2Controller.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DM; using Crestron.SimplSharpPro.DM.Endpoints; diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200SController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200SController.cs index c48850c8..238f00af 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200SController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200SController.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DM; using Crestron.SimplSharpPro.DM.Endpoints; diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4KScalerCController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4KScalerCController.cs index 6595c6e3..2a81ff87 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4KScalerCController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4KScalerCController.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DM; using Crestron.SimplSharpPro.DM.Endpoints; diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4k100C1GController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4k100C1GController.cs index 1ed8eb26..0b5d6df1 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4k100C1GController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4k100C1GController.cs @@ -1,11 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.DM; -using Crestron.SimplSharpPro.DM.Endpoints; using Crestron.SimplSharpPro.DM.Endpoints.Receivers; using PepperDash.Essentials.Core; diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kScalerCDspController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kScalerCDspController.cs index 8e52822b..3a8afd8c 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kScalerCDspController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kScalerCDspController.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DM; using Crestron.SimplSharpPro.DM.Endpoints; diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZ100CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZ100CController.cs index 33705c0a..e12c70df 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZ100CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZ100CController.cs @@ -1,10 +1,4 @@ -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.DeviceSupport; using Crestron.SimplSharpPro.DM; using Crestron.SimplSharpPro.DM.Endpoints; using Crestron.SimplSharpPro.DM.Endpoints.Receivers; diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZScalerCController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZScalerCController.cs index a42b6771..b3ca0695 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZScalerCController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZScalerCController.cs @@ -1,8 +1,4 @@ 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; @@ -24,8 +20,8 @@ namespace PepperDash.Essentials.DM public RoutingInputPort HdmiIn { get; private set; } public RoutingOutputPort HdmiOut { get; private set; } - /// - /// The value of the current video source for the HDMI output on the receiver + /// + /// The value of the current video source for the HDMI output on the receiver /// public IntFeedback AudioVideoSourceNumericFeedback { get; private set; } @@ -67,37 +63,37 @@ namespace PepperDash.Essentials.DM } void HdmiOutput_OutputStreamChange(EndpointOutputStream outputStream, EndpointOutputStreamEventArgs args) - { - if (args.EventId == EndpointOutputStreamEventIds.HorizontalResolutionFeedbackEventId || args.EventId == EndpointOutputStreamEventIds.VerticalResolutionFeedbackEventId || - args.EventId == EndpointOutputStreamEventIds.FramesPerSecondFeedbackEventId) - { - VideoOutputResolutionFeedback.FireUpdate(); + { + if (args.EventId == EndpointOutputStreamEventIds.HorizontalResolutionFeedbackEventId || args.EventId == EndpointOutputStreamEventIds.VerticalResolutionFeedbackEventId || + args.EventId == EndpointOutputStreamEventIds.FramesPerSecondFeedbackEventId) + { + VideoOutputResolutionFeedback.FireUpdate(); } if (args.EventId == EndpointOutputStreamEventIds.SelectedSourceFeedbackEventId) { AudioVideoSourceNumericFeedback.FireUpdate(); - } - } - - void ConnectedDevice_DeviceInformationChange(ConnectedDeviceInformation connectedDevice, ConnectedDeviceEventArgs args) - { - if (args.EventId == ConnectedDeviceEventIds.ManufacturerEventId) - { - EdidManufacturerFeedback.FireUpdate(); - } - else if (args.EventId == ConnectedDeviceEventIds.NameEventId) - { - EdidNameFeedback.FireUpdate(); - } - else if (args.EventId == ConnectedDeviceEventIds.PreferredTimingEventId) - { - EdidPreferredTimingFeedback.FireUpdate(); - } - else if (args.EventId == ConnectedDeviceEventIds.SerialNumberEventId) - { - EdidSerialNumberFeedback.FireUpdate(); - } + } + } + + void ConnectedDevice_DeviceInformationChange(ConnectedDeviceInformation connectedDevice, ConnectedDeviceEventArgs args) + { + if (args.EventId == ConnectedDeviceEventIds.ManufacturerEventId) + { + EdidManufacturerFeedback.FireUpdate(); + } + else if (args.EventId == ConnectedDeviceEventIds.NameEventId) + { + EdidNameFeedback.FireUpdate(); + } + else if (args.EventId == ConnectedDeviceEventIds.PreferredTimingEventId) + { + EdidPreferredTimingFeedback.FireUpdate(); + } + else if (args.EventId == ConnectedDeviceEventIds.SerialNumberEventId) + { + EdidSerialNumberFeedback.FireUpdate(); + } } public override bool CustomActivate() diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerCController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerCController.cs index 32044d48..235cc1ae 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerCController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerCController.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DM; using Crestron.SimplSharpPro.DM.Endpoints; diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerS2Controller.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerS2Controller.cs index 60c3ca07..73e321c1 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerS2Controller.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerS2Controller.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DM; using Crestron.SimplSharpPro.DM.Endpoints; diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerSController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerSController.cs index e7b5a132..e1a2a4d0 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerSController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerSController.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DM; using Crestron.SimplSharpPro.DM.Endpoints; diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcX100CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcX100CController.cs index 16526bc0..c4d15ffb 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcX100CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcX100CController.cs @@ -1,12 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DM; -using Crestron.SimplSharpPro.DM.Endpoints; using Crestron.SimplSharpPro.DM.Endpoints.Receivers; using PepperDash.Essentials.Core; From 41e9bead0b56164b87994c3685bdddca7388fbbf Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 5 May 2020 17:07:36 -0600 Subject: [PATCH 113/156] adds Flags Attribute to eRoutingSignalType --- .../PepperDashEssentialsBase/Routing/RoutingPort.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingPort.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingPort.cs index 12edb104..5f8bcef3 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingPort.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingPort.cs @@ -29,6 +29,7 @@ namespace PepperDash.Essentials.Core } } + [Flags] public enum eRoutingSignalType { Audio = 1, From b321fc7b76d777279c1b1049bd9a2897924ab287 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 5 May 2020 17:09:09 -0600 Subject: [PATCH 114/156] removes virtual modifier on properties updates DmHdBaseTControllerBase to use a protected field and sets the reference in the constructor adds protected field for rmc device to DmRmcControllerBase and sets it in the constructor --- .../Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs index ce04146e..21a65f17 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs @@ -14,7 +14,8 @@ namespace PepperDash.Essentials.DM { [Description("Wrapper class for all DM-RMC variants")] public abstract class DmRmcControllerBase : CrestronGenericBridgeableBaseDevice - { + { + protected EndpointReceiverBase Rmc; public StringFeedback VideoOutputResolutionFeedback { get; protected set; } public StringFeedback EdidManufacturerFeedback { get; protected set; } public StringFeedback EdidNameFeedback { get; protected set; } @@ -23,7 +24,8 @@ namespace PepperDash.Essentials.DM protected DmRmcControllerBase(string key, string name, EndpointReceiverBase device) : base(key, name, device) - { + { + Rmc = device; // if wired to a chassis, skip registration step in base class PreventRegistration = device.DMOutput != null; @@ -72,7 +74,7 @@ namespace PepperDash.Essentials.DM public abstract class DmHdBaseTControllerBase : CrestronGenericBaseDevice { - public HDBaseTBase Rmc { get; protected set; } + protected HDBaseTBase Rmc; /// /// Make a Crestron RMC and put it in here @@ -80,7 +82,7 @@ namespace PepperDash.Essentials.DM protected DmHdBaseTControllerBase(string key, string name, HDBaseTBase rmc) : base(key, name, rmc) { - + Rmc = rmc; } } From 4b37d68c0ec5c76d3da9fcceece8d43bfc48843a Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 5 May 2020 17:12:49 -0600 Subject: [PATCH 115/156] Refactors HDBaseTRxController chagnes InputPorts and OutputPorts to not return a new collection every time they are accessed --- .../Receivers/DmHdBaseTEndpointController.cs | 26 +++++++------------ 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmHdBaseTEndpointController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmHdBaseTEndpointController.cs index 6332b853..3af4f0fe 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmHdBaseTEndpointController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmHdBaseTEndpointController.cs @@ -1,4 +1,5 @@ -using Crestron.SimplSharpPro; +using Crestron.SimplSharp.Ssh; +using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.DM.Endpoints.Receivers; using PepperDash.Essentials.Core; @@ -6,32 +7,25 @@ using PepperDash.Essentials.Core; namespace PepperDash.Essentials.DM { public class HDBaseTRxController : DmHdBaseTControllerBase, IRoutingInputsOutputs, - IComPorts + IComPorts { public RoutingInputPort DmIn { get; private set; } public RoutingOutputPort HDBaseTSink { get; private set; } - public RoutingPortCollection InputPorts - { - get { return new RoutingPortCollection { DmIn }; } - } + public RoutingPortCollection InputPorts { get; private set; } - public RoutingPortCollection OutputPorts - { - get { return new RoutingPortCollection { HDBaseTSink }; } - } + public RoutingPortCollection OutputPorts { get; private set; } public HDBaseTRxController(string key, string name, HDRx3CB rmc) : base(key, name, rmc) { - Rmc = rmc; - DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, + DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.DmCat, 0, this); - HDBaseTSink = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, - eRoutingPortConnectionType.Hdmi, null, this); + HDBaseTSink = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.AudioVideo, + eRoutingPortConnectionType.Hdmi, null, this) {Port = Rmc}; - // Set Ports for CEC - HDBaseTSink.Port = Rmc; // Unique case, this class has no HdmiOutput port and ICec is implemented on the receiver class itself + InputPorts = new RoutingPortCollection {DmIn}; + OutputPorts = new RoutingPortCollection {HDBaseTSink}; } #region IComPorts Members From 42b94e3a472cc8ba77eaf0383cc7096c22149f4a Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 5 May 2020 17:13:11 -0600 Subject: [PATCH 116/156] lots of refactoring --- .../Receivers/DmRmc100SController.cs | 41 +++++++------------ 1 file changed, 15 insertions(+), 26 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc100SController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc100SController.cs index d3aed367..d91f663e 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc100SController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc100SController.cs @@ -15,20 +15,14 @@ namespace PepperDash.Essentials.DM public class DmRmc100SController : DmRmcControllerBase, IRoutingInputsOutputs, IIROutputPorts, IComPorts, ICec { - public DmRmc100S Rmc { get; private set; } + private readonly DmRmc100S _rmc; public RoutingInputPort DmIn { get; private set; } public RoutingOutputPort HdmiOut { get; private set; } - public RoutingPortCollection InputPorts - { - get { return new RoutingPortCollection { DmIn }; } - } + public RoutingPortCollection InputPorts { get; private set; } - public RoutingPortCollection OutputPorts - { - get { return new RoutingPortCollection { HdmiOut }; } - } + public RoutingPortCollection OutputPorts { get; private set; } /// /// Make a Crestron RMC and put it in here @@ -36,20 +30,15 @@ namespace PepperDash.Essentials.DM public DmRmc100SController(string key, string name, DmRmc100S rmc) : base(key, name, rmc) { - Rmc = rmc; - DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, + _rmc = rmc; + + DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.DmCat, 0, this); - HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, - eRoutingPortConnectionType.Hdmi, null, this); + HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.AudioVideo, + eRoutingPortConnectionType.Hdmi, null, this) {Port = Rmc}; - // Set Ports for CEC - HdmiOut.Port = Rmc; // Unique case, this class has no HdmiOutput port and ICec is implemented on the receiver class itself - } - - public override bool CustomActivate() - { - // Base does register and sets up comm monitoring. - return base.CustomActivate(); + InputPorts = new RoutingPortCollection {DmIn}; + OutputPorts = new RoutingPortCollection {HdmiOut}; } public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) @@ -58,17 +47,17 @@ namespace PepperDash.Essentials.DM } #region IIROutputPorts Members - public CrestronCollection IROutputPorts { get { return Rmc.IROutputPorts; } } - public int NumberOfIROutputPorts { get { return Rmc.NumberOfIROutputPorts; } } + public CrestronCollection IROutputPorts { get { return _rmc.IROutputPorts; } } + public int NumberOfIROutputPorts { get { return _rmc.NumberOfIROutputPorts; } } #endregion #region IComPorts Members - public CrestronCollection ComPorts { get { return Rmc.ComPorts; } } - public int NumberOfComPorts { get { return Rmc.NumberOfComPorts; } } + public CrestronCollection ComPorts { get { return _rmc.ComPorts; } } + public int NumberOfComPorts { get { return _rmc.NumberOfComPorts; } } #endregion #region ICec Members - public Cec StreamCec { get { return Rmc.HdmiOutput.StreamCec; } } + public Cec StreamCec { get { return _rmc.HdmiOutput.StreamCec; } } #endregion } } \ No newline at end of file From 53d92555c804914cfd9318d1447476d450c0e648 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Wed, 6 May 2020 08:33:56 -0600 Subject: [PATCH 117/156] refactors several RMC controller Classes --- .../Receivers/DmRmc150SController.cs | 81 ++++++++----------- .../Receivers/DmRmc200CController.cs | 74 ++++++++--------- .../Receivers/DmRmc200S2Controller.cs | 76 ++++++++--------- .../Receivers/DmRmc200SController.cs | 30 +++---- .../Endpoints/Receivers/DmRmcHelper.cs | 1 + 5 files changed, 117 insertions(+), 145 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc150SController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc150SController.cs index 4f4a5413..9803b5b8 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc150SController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc150SController.cs @@ -15,19 +15,20 @@ namespace PepperDash.Essentials.DM public class DmRmc150SController : DmRmcControllerBase, IRoutingInputsOutputs, IIROutputPorts, IComPorts, ICec { - public DmRmc150S Rmc { get; private set; } + private readonly DmRmc150S _rmc; public RoutingInputPort DmIn { get; private set; } public RoutingOutputPort HdmiOut { get; private set; } public RoutingPortCollection InputPorts { - get { return new RoutingPortCollection { DmIn }; } + get; private set; } public RoutingPortCollection OutputPorts { - get { return new RoutingPortCollection { HdmiOut }; } + get; + private set ; } /// @@ -36,59 +37,43 @@ namespace PepperDash.Essentials.DM public DmRmc150SController(string key, string name, DmRmc150S rmc) : base(key, name, rmc) { - Rmc = rmc; - DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, + _rmc = rmc; + DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.DmCat, 0, this); - HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, + HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, null, this); - EdidManufacturerFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.Manufacturer.StringValue); - EdidNameFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.Name.StringValue); - EdidPreferredTimingFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.PreferredTiming.StringValue); - EdidSerialNumberFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.SerialNumber.StringValue); + EdidManufacturerFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.Manufacturer.StringValue); + EdidNameFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.Name.StringValue); + EdidPreferredTimingFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.PreferredTiming.StringValue); + EdidSerialNumberFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.SerialNumber.StringValue); - //VideoOutputResolutionFeedback = new StringFeedback(() => Rmc.HdmiOutput.GetVideoResolutionString()); + InputPorts = new RoutingPortCollection {DmIn}; + OutputPorts = new RoutingPortCollection {HdmiOut}; - //Rmc.HdmiOutput.OutputStreamChange += HdmiOutput_OutputStreamChange; - Rmc.HdmiOutput.ConnectedDevice.DeviceInformationChange += ConnectedDevice_DeviceInformationChange; + _rmc.HdmiOutput.ConnectedDevice.DeviceInformationChange += ConnectedDevice_DeviceInformationChange; // Set Ports for CEC - HdmiOut.Port = Rmc.HdmiOutput; + HdmiOut.Port = _rmc.HdmiOutput; } - //void HdmiOutput_OutputStreamChange(EndpointOutputStream outputStream, EndpointOutputStreamEventArgs args) - //{ - // if (args.EventId == EndpointOutputStreamEventIds.HorizontalResolutionFeedbackEventId || args.EventId == EndpointOutputStreamEventIds.VerticalResolutionFeedbackEventId || - // args.EventId == EndpointOutputStreamEventIds.FramesPerSecondFeedbackEventId) - // { - // VideoOutputResolutionFeedback.FireUpdate(); - // } - //} - void ConnectedDevice_DeviceInformationChange(ConnectedDeviceInformation connectedDevice, ConnectedDeviceEventArgs args) { - if (args.EventId == ConnectedDeviceEventIds.ManufacturerEventId) + switch (args.EventId) { - EdidManufacturerFeedback.FireUpdate(); + case ConnectedDeviceEventIds.ManufacturerEventId: + EdidManufacturerFeedback.FireUpdate(); + break; + case ConnectedDeviceEventIds.NameEventId: + EdidNameFeedback.FireUpdate(); + break; + case ConnectedDeviceEventIds.PreferredTimingEventId: + EdidPreferredTimingFeedback.FireUpdate(); + break; + case ConnectedDeviceEventIds.SerialNumberEventId: + EdidSerialNumberFeedback.FireUpdate(); + break; } - else if (args.EventId == ConnectedDeviceEventIds.NameEventId) - { - EdidNameFeedback.FireUpdate(); - } - else if (args.EventId == ConnectedDeviceEventIds.PreferredTimingEventId) - { - EdidPreferredTimingFeedback.FireUpdate(); - } - else if (args.EventId == ConnectedDeviceEventIds.SerialNumberEventId) - { - EdidSerialNumberFeedback.FireUpdate(); - } - } - - public override bool CustomActivate() - { - // Base does register and sets up comm monitoring. - return base.CustomActivate(); } public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) @@ -97,17 +82,17 @@ namespace PepperDash.Essentials.DM } #region IIROutputPorts Members - public CrestronCollection IROutputPorts { get { return Rmc.IROutputPorts; } } - public int NumberOfIROutputPorts { get { return Rmc.NumberOfIROutputPorts; } } + public CrestronCollection IROutputPorts { get { return _rmc.IROutputPorts; } } + public int NumberOfIROutputPorts { get { return _rmc.NumberOfIROutputPorts; } } #endregion #region IComPorts Members - public CrestronCollection ComPorts { get { return Rmc.ComPorts; } } - public int NumberOfComPorts { get { return Rmc.NumberOfComPorts; } } + public CrestronCollection ComPorts { get { return _rmc.ComPorts; } } + public int NumberOfComPorts { get { return _rmc.NumberOfComPorts; } } #endregion #region ICec Members - public Cec StreamCec { get { return Rmc.HdmiOutput.StreamCec; } } + public Cec StreamCec { get { return _rmc.HdmiOutput.StreamCec; } } #endregion } } \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200CController.cs index e8449560..9beaaf42 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200CController.cs @@ -16,19 +16,19 @@ namespace PepperDash.Essentials.DM public class DmRmc200CController : DmRmcControllerBase, IRoutingInputsOutputs, IIROutputPorts, IComPorts, ICec { - public DmRmc200C Rmc { get; private set; } + private readonly DmRmc200C _rmc; public RoutingInputPort DmIn { get; private set; } public RoutingOutputPort HdmiOut { get; private set; } public RoutingPortCollection InputPorts { - get { return new RoutingPortCollection { DmIn }; } + get; private set; } public RoutingPortCollection OutputPorts { - get { return new RoutingPortCollection { HdmiOut }; } + get; private set; } /// @@ -37,24 +37,27 @@ namespace PepperDash.Essentials.DM public DmRmc200CController(string key, string name, DmRmc200C rmc) : base(key, name, rmc) { - Rmc = rmc; - DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, + _rmc = rmc; + DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.DmCat, 0, this); - HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, + HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, null, this); - EdidManufacturerFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.Manufacturer.StringValue); - EdidNameFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.Name.StringValue); - EdidPreferredTimingFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.PreferredTiming.StringValue); - EdidSerialNumberFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.SerialNumber.StringValue); + EdidManufacturerFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.Manufacturer.StringValue); + EdidNameFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.Name.StringValue); + EdidPreferredTimingFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.PreferredTiming.StringValue); + EdidSerialNumberFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.SerialNumber.StringValue); - VideoOutputResolutionFeedback = new StringFeedback(() => Rmc.HdmiOutput.GetVideoResolutionString()); + VideoOutputResolutionFeedback = new StringFeedback(() => _rmc.HdmiOutput.GetVideoResolutionString()); - Rmc.HdmiOutput.OutputStreamChange += HdmiOutput_OutputStreamChange; - Rmc.HdmiOutput.ConnectedDevice.DeviceInformationChange += ConnectedDevice_DeviceInformationChange; + _rmc.HdmiOutput.OutputStreamChange += HdmiOutput_OutputStreamChange; + _rmc.HdmiOutput.ConnectedDevice.DeviceInformationChange += ConnectedDevice_DeviceInformationChange; + + InputPorts = new RoutingPortCollection {DmIn}; + OutputPorts = new RoutingPortCollection {HdmiOut}; // Set Ports for CEC - HdmiOut.Port = Rmc.HdmiOutput; + HdmiOut.Port = _rmc.HdmiOutput; } void HdmiOutput_OutputStreamChange(EndpointOutputStream outputStream, EndpointOutputStreamEventArgs args) @@ -68,47 +71,40 @@ namespace PepperDash.Essentials.DM void ConnectedDevice_DeviceInformationChange(ConnectedDeviceInformation connectedDevice, ConnectedDeviceEventArgs args) { - if (args.EventId == ConnectedDeviceEventIds.ManufacturerEventId) + switch (args.EventId) { - EdidManufacturerFeedback.FireUpdate(); - } - else if (args.EventId == ConnectedDeviceEventIds.NameEventId) - { - EdidNameFeedback.FireUpdate(); - } - else if (args.EventId == ConnectedDeviceEventIds.PreferredTimingEventId) - { - EdidPreferredTimingFeedback.FireUpdate(); - } - else if (args.EventId == ConnectedDeviceEventIds.SerialNumberEventId) - { - EdidSerialNumberFeedback.FireUpdate(); + case ConnectedDeviceEventIds.ManufacturerEventId: + EdidManufacturerFeedback.FireUpdate(); + break; + case ConnectedDeviceEventIds.NameEventId: + EdidNameFeedback.FireUpdate(); + break; + case ConnectedDeviceEventIds.PreferredTimingEventId: + EdidPreferredTimingFeedback.FireUpdate(); + break; + case ConnectedDeviceEventIds.SerialNumberEventId: + EdidSerialNumberFeedback.FireUpdate(); + break; } } - public override bool CustomActivate() - { - // Base does register and sets up comm monitoring. - return base.CustomActivate(); - } - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { LinkDmRmcToApi(this, trilist, joinStart, joinMapKey, bridge); } #region IIROutputPorts Members - public CrestronCollection IROutputPorts { get { return Rmc.IROutputPorts; } } - public int NumberOfIROutputPorts { get { return Rmc.NumberOfIROutputPorts; } } + public CrestronCollection IROutputPorts { get { return _rmc.IROutputPorts; } } + public int NumberOfIROutputPorts { get { return _rmc.NumberOfIROutputPorts; } } #endregion #region IComPorts Members - public CrestronCollection ComPorts { get { return Rmc.ComPorts; } } - public int NumberOfComPorts { get { return Rmc.NumberOfComPorts; } } + public CrestronCollection ComPorts { get { return _rmc.ComPorts; } } + public int NumberOfComPorts { get { return _rmc.NumberOfComPorts; } } #endregion #region ICec Members - public Cec StreamCec { get { return Rmc.HdmiOutput.StreamCec; } } + public Cec StreamCec { get { return _rmc.HdmiOutput.StreamCec; } } #endregion } } \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200S2Controller.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200S2Controller.cs index 4da83f1b..9b29c1b7 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200S2Controller.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200S2Controller.cs @@ -16,20 +16,14 @@ namespace PepperDash.Essentials.DM public class DmRmc200S2Controller : DmRmcControllerBase, IRoutingInputsOutputs, IIROutputPorts, IComPorts, ICec { - public DmRmc200S2 Rmc { get; private set; } + private readonly DmRmc200S2 _rmc; public RoutingInputPort DmIn { get; private set; } public RoutingOutputPort HdmiOut { get; private set; } - public RoutingPortCollection InputPorts - { - get { return new RoutingPortCollection { DmIn }; } - } + public RoutingPortCollection InputPorts { get; private set; } - public RoutingPortCollection OutputPorts - { - get { return new RoutingPortCollection { HdmiOut }; } - } + public RoutingPortCollection OutputPorts { get; private set; } /// /// Make a Crestron RMC and put it in here @@ -37,24 +31,27 @@ namespace PepperDash.Essentials.DM public DmRmc200S2Controller(string key, string name, DmRmc200S2 rmc) : base(key, name, rmc) { - Rmc = rmc; + _rmc = rmc; DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmCat, 0, this); HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, null, this); - EdidManufacturerFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.Manufacturer.StringValue); - EdidNameFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.Name.StringValue); - EdidPreferredTimingFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.PreferredTiming.StringValue); - EdidSerialNumberFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.SerialNumber.StringValue); + EdidManufacturerFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.Manufacturer.StringValue); + EdidNameFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.Name.StringValue); + EdidPreferredTimingFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.PreferredTiming.StringValue); + EdidSerialNumberFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.SerialNumber.StringValue); - VideoOutputResolutionFeedback = new StringFeedback(() => Rmc.HdmiOutput.GetVideoResolutionString()); + VideoOutputResolutionFeedback = new StringFeedback(() => _rmc.HdmiOutput.GetVideoResolutionString()); - Rmc.HdmiOutput.OutputStreamChange += HdmiOutput_OutputStreamChange; - Rmc.HdmiOutput.ConnectedDevice.DeviceInformationChange += ConnectedDevice_DeviceInformationChange; + _rmc.HdmiOutput.OutputStreamChange += HdmiOutput_OutputStreamChange; + _rmc.HdmiOutput.ConnectedDevice.DeviceInformationChange += ConnectedDevice_DeviceInformationChange; + + InputPorts = new RoutingPortCollection {DmIn}; + OutputPorts = new RoutingPortCollection {HdmiOut}; // Set Ports for CEC - HdmiOut.Port = Rmc.HdmiOutput; + HdmiOut.Port = _rmc.HdmiOutput; } void HdmiOutput_OutputStreamChange(EndpointOutputStream outputStream, EndpointOutputStreamEventArgs args) @@ -68,28 +65,21 @@ namespace PepperDash.Essentials.DM void ConnectedDevice_DeviceInformationChange(ConnectedDeviceInformation connectedDevice, ConnectedDeviceEventArgs args) { - if (args.EventId == ConnectedDeviceEventIds.ManufacturerEventId) + switch (args.EventId) { - EdidManufacturerFeedback.FireUpdate(); + case ConnectedDeviceEventIds.ManufacturerEventId: + EdidManufacturerFeedback.FireUpdate(); + break; + case ConnectedDeviceEventIds.NameEventId: + EdidNameFeedback.FireUpdate(); + break; + case ConnectedDeviceEventIds.PreferredTimingEventId: + EdidPreferredTimingFeedback.FireUpdate(); + break; + case ConnectedDeviceEventIds.SerialNumberEventId: + EdidSerialNumberFeedback.FireUpdate(); + break; } - else if (args.EventId == ConnectedDeviceEventIds.NameEventId) - { - EdidNameFeedback.FireUpdate(); - } - else if (args.EventId == ConnectedDeviceEventIds.PreferredTimingEventId) - { - EdidPreferredTimingFeedback.FireUpdate(); - } - else if (args.EventId == ConnectedDeviceEventIds.SerialNumberEventId) - { - EdidSerialNumberFeedback.FireUpdate(); - } - } - - public override bool CustomActivate() - { - // Base does register and sets up comm monitoring. - return base.CustomActivate(); } public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) @@ -98,17 +88,17 @@ namespace PepperDash.Essentials.DM } #region IIROutputPorts Members - public CrestronCollection IROutputPorts { get { return Rmc.IROutputPorts; } } - public int NumberOfIROutputPorts { get { return Rmc.NumberOfIROutputPorts; } } + public CrestronCollection IROutputPorts { get { return _rmc.IROutputPorts; } } + public int NumberOfIROutputPorts { get { return _rmc.NumberOfIROutputPorts; } } #endregion #region IComPorts Members - public CrestronCollection ComPorts { get { return Rmc.ComPorts; } } - public int NumberOfComPorts { get { return Rmc.NumberOfComPorts; } } + public CrestronCollection ComPorts { get { return _rmc.ComPorts; } } + public int NumberOfComPorts { get { return _rmc.NumberOfComPorts; } } #endregion #region ICec Members - public Cec StreamCec { get { return Rmc.HdmiOutput.StreamCec; } } + public Cec StreamCec { get { return _rmc.HdmiOutput.StreamCec; } } #endregion } } \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200SController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200SController.cs index 238f00af..0a0ecc28 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200SController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200SController.cs @@ -16,7 +16,7 @@ namespace PepperDash.Essentials.DM public class DmRmc200SController : DmRmcControllerBase, IRoutingInputsOutputs, IIROutputPorts, IComPorts, ICec { - public DmRmc200S Rmc { get; private set; } + private readonly DmRmc200S _rmc; public RoutingInputPort DmIn { get; private set; } public RoutingOutputPort HdmiOut { get; private set; } @@ -37,24 +37,24 @@ namespace PepperDash.Essentials.DM public DmRmc200SController(string key, string name, DmRmc200S rmc) : base(key, name, rmc) { - Rmc = rmc; + _rmc = rmc; DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmCat, 0, this); HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, null, this); - EdidManufacturerFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.Manufacturer.StringValue); - EdidNameFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.Name.StringValue); - EdidPreferredTimingFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.PreferredTiming.StringValue); - EdidSerialNumberFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.SerialNumber.StringValue); + EdidManufacturerFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.Manufacturer.StringValue); + EdidNameFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.Name.StringValue); + EdidPreferredTimingFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.PreferredTiming.StringValue); + EdidSerialNumberFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.SerialNumber.StringValue); - VideoOutputResolutionFeedback = new StringFeedback(() => Rmc.HdmiOutput.GetVideoResolutionString()); + VideoOutputResolutionFeedback = new StringFeedback(() => _rmc.HdmiOutput.GetVideoResolutionString()); - Rmc.HdmiOutput.OutputStreamChange += HdmiOutput_OutputStreamChange; - Rmc.HdmiOutput.ConnectedDevice.DeviceInformationChange += ConnectedDevice_DeviceInformationChange; + _rmc.HdmiOutput.OutputStreamChange += HdmiOutput_OutputStreamChange; + _rmc.HdmiOutput.ConnectedDevice.DeviceInformationChange += ConnectedDevice_DeviceInformationChange; // Set Ports for CEC - HdmiOut.Port = Rmc.HdmiOutput; + HdmiOut.Port = _rmc.HdmiOutput; } void HdmiOutput_OutputStreamChange(EndpointOutputStream outputStream, EndpointOutputStreamEventArgs args) @@ -98,17 +98,17 @@ namespace PepperDash.Essentials.DM } #region IIROutputPorts Members - public CrestronCollection IROutputPorts { get { return Rmc.IROutputPorts; } } - public int NumberOfIROutputPorts { get { return Rmc.NumberOfIROutputPorts; } } + public CrestronCollection IROutputPorts { get { return _rmc.IROutputPorts; } } + public int NumberOfIROutputPorts { get { return _rmc.NumberOfIROutputPorts; } } #endregion #region IComPorts Members - public CrestronCollection ComPorts { get { return Rmc.ComPorts; } } - public int NumberOfComPorts { get { return Rmc.NumberOfComPorts; } } + public CrestronCollection ComPorts { get { return _rmc.ComPorts; } } + public int NumberOfComPorts { get { return _rmc.NumberOfComPorts; } } #endregion #region ICec Members - public Cec StreamCec { get { return Rmc.HdmiOutput.StreamCec; } } + public Cec StreamCec { get { return _rmc.HdmiOutput.StreamCec; } } #endregion } } \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs index 21a65f17..979bf495 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs @@ -26,6 +26,7 @@ namespace PepperDash.Essentials.DM : base(key, name, device) { Rmc = device; + // if wired to a chassis, skip registration step in base class PreventRegistration = device.DMOutput != null; From 5ec96310c62a01197e020deab496a4bfaa2eb727 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Thu, 7 May 2020 12:44:52 -0600 Subject: [PATCH 118/156] Updates eRoutingSignalType AudioVideo --- .../PepperDashEssentialsBase/Routing/RoutingPort.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingPort.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingPort.cs index 5f8bcef3..cfd6f09e 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingPort.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingPort.cs @@ -34,7 +34,7 @@ namespace PepperDash.Essentials.Core { Audio = 1, Video = 2, - AudioVideo = 4, + AudioVideo = Audio | Video, UsbOutput = 8, UsbInput = 16 } From fc8b4120c74a8af5c12fe0050e8b2ec2f60ad907 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Thu, 7 May 2020 12:45:17 -0600 Subject: [PATCH 119/156] updates all DM Fiber Receiver Classes --- .../Receivers/DmRmc100SController.cs | 2 +- .../Receivers/DmRmc200S2Controller.cs | 4 +- .../Receivers/DmRmc200SController.cs | 47 +++++------ .../Receivers/DmRmcScalerS2Controller.cs | 79 ++++++++---------- .../Receivers/DmRmcScalerSController.cs | 80 ++++++++----------- 5 files changed, 93 insertions(+), 119 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc100SController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc100SController.cs index d91f663e..876880d1 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc100SController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc100SController.cs @@ -35,7 +35,7 @@ namespace PepperDash.Essentials.DM DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.DmCat, 0, this); HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.AudioVideo, - eRoutingPortConnectionType.Hdmi, null, this) {Port = Rmc}; + eRoutingPortConnectionType.Hdmi, null, this) {Port = _rmc}; InputPorts = new RoutingPortCollection {DmIn}; OutputPorts = new RoutingPortCollection {HdmiOut}; diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200S2Controller.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200S2Controller.cs index 9b29c1b7..c909098f 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200S2Controller.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200S2Controller.cs @@ -32,9 +32,9 @@ namespace PepperDash.Essentials.DM : base(key, name, rmc) { _rmc = rmc; - DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, + DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.DmCat, 0, this); - HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, + HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, null, this); EdidManufacturerFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.Manufacturer.StringValue); diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200SController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200SController.cs index 0a0ecc28..8d53964b 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200SController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200SController.cs @@ -21,14 +21,11 @@ namespace PepperDash.Essentials.DM public RoutingInputPort DmIn { get; private set; } public RoutingOutputPort HdmiOut { get; private set; } - public RoutingPortCollection InputPorts - { - get { return new RoutingPortCollection { DmIn }; } - } + public RoutingPortCollection InputPorts { get; private set; } public RoutingPortCollection OutputPorts { - get { return new RoutingPortCollection { HdmiOut }; } + get; private set; } /// @@ -38,9 +35,9 @@ namespace PepperDash.Essentials.DM : base(key, name, rmc) { _rmc = rmc; - DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, + DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.DmCat, 0, this); - HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, + HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, null, this); EdidManufacturerFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.Manufacturer.StringValue); @@ -50,6 +47,9 @@ namespace PepperDash.Essentials.DM VideoOutputResolutionFeedback = new StringFeedback(() => _rmc.HdmiOutput.GetVideoResolutionString()); + InputPorts = new RoutingPortCollection {DmIn}; + OutputPorts = new RoutingPortCollection {HdmiOut}; + _rmc.HdmiOutput.OutputStreamChange += HdmiOutput_OutputStreamChange; _rmc.HdmiOutput.ConnectedDevice.DeviceInformationChange += ConnectedDevice_DeviceInformationChange; @@ -68,30 +68,23 @@ namespace PepperDash.Essentials.DM void ConnectedDevice_DeviceInformationChange(ConnectedDeviceInformation connectedDevice, ConnectedDeviceEventArgs args) { - if (args.EventId == ConnectedDeviceEventIds.ManufacturerEventId) + switch (args.EventId) { - EdidManufacturerFeedback.FireUpdate(); - } - else if (args.EventId == ConnectedDeviceEventIds.NameEventId) - { - EdidNameFeedback.FireUpdate(); - } - else if (args.EventId == ConnectedDeviceEventIds.PreferredTimingEventId) - { - EdidPreferredTimingFeedback.FireUpdate(); - } - else if (args.EventId == ConnectedDeviceEventIds.SerialNumberEventId) - { - EdidSerialNumberFeedback.FireUpdate(); + case ConnectedDeviceEventIds.ManufacturerEventId: + EdidManufacturerFeedback.FireUpdate(); + break; + case ConnectedDeviceEventIds.NameEventId: + EdidNameFeedback.FireUpdate(); + break; + case ConnectedDeviceEventIds.PreferredTimingEventId: + EdidPreferredTimingFeedback.FireUpdate(); + break; + case ConnectedDeviceEventIds.SerialNumberEventId: + EdidSerialNumberFeedback.FireUpdate(); + break; } } - public override bool CustomActivate() - { - // Base does register and sets up comm monitoring. - return base.CustomActivate(); - } - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { LinkDmRmcToApi(this, trilist, joinStart, joinMapKey, bridge); diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerS2Controller.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerS2Controller.cs index 73e321c1..1e014063 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerS2Controller.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerS2Controller.cs @@ -16,20 +16,14 @@ namespace PepperDash.Essentials.DM public class DmRmcScalerS2Controller : DmRmcControllerBase, IRoutingInputsOutputs, IIROutputPorts, IComPorts, ICec { - public DmRmcScalerS2 Rmc { get; private set; } + private readonly DmRmcScalerS2 _rmc; public RoutingInputPort DmIn { get; private set; } public RoutingOutputPort HdmiOut { get; private set; } - public RoutingPortCollection InputPorts - { - get { return new RoutingPortCollection { DmIn }; } - } + public RoutingPortCollection InputPorts { get; private set; } - public RoutingPortCollection OutputPorts - { - get { return new RoutingPortCollection { HdmiOut }; } - } + public RoutingPortCollection OutputPorts { get; private set; } /// /// Make a Crestron RMC and put it in here @@ -37,24 +31,27 @@ namespace PepperDash.Essentials.DM public DmRmcScalerS2Controller(string key, string name, DmRmcScalerS2 rmc) : base(key, name, rmc) { - Rmc = rmc; - DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, + _rmc = rmc; + DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.DmCat, 0, this); - HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, + HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, null, this); - EdidManufacturerFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.Manufacturer.StringValue); - EdidNameFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.Name.StringValue); - EdidPreferredTimingFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.PreferredTiming.StringValue); - EdidSerialNumberFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.SerialNumber.StringValue); + EdidManufacturerFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.Manufacturer.StringValue); + EdidNameFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.Name.StringValue); + EdidPreferredTimingFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.PreferredTiming.StringValue); + EdidSerialNumberFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.SerialNumber.StringValue); - VideoOutputResolutionFeedback = new StringFeedback(() => Rmc.HdmiOutput.GetVideoResolutionString()); + VideoOutputResolutionFeedback = new StringFeedback(() => _rmc.HdmiOutput.GetVideoResolutionString()); - Rmc.HdmiOutput.OutputStreamChange += HdmiOutput_OutputStreamChange; - Rmc.HdmiOutput.ConnectedDevice.DeviceInformationChange += ConnectedDevice_DeviceInformationChange; + _rmc.HdmiOutput.OutputStreamChange += HdmiOutput_OutputStreamChange; + _rmc.HdmiOutput.ConnectedDevice.DeviceInformationChange += ConnectedDevice_DeviceInformationChange; + + InputPorts = new RoutingPortCollection {DmIn}; + OutputPorts = new RoutingPortCollection {HdmiOut}; // Set Ports for CEC - HdmiOut.Port = Rmc.HdmiOutput; + HdmiOut.Port = _rmc.HdmiOutput; } void HdmiOutput_OutputStreamChange(EndpointOutputStream outputStream, EndpointOutputStreamEventArgs args) @@ -68,29 +65,23 @@ namespace PepperDash.Essentials.DM void ConnectedDevice_DeviceInformationChange(ConnectedDeviceInformation connectedDevice, ConnectedDeviceEventArgs args) { - if (args.EventId == ConnectedDeviceEventIds.ManufacturerEventId) + switch (args.EventId) { - EdidManufacturerFeedback.FireUpdate(); - } - else if (args.EventId == ConnectedDeviceEventIds.NameEventId) - { - EdidNameFeedback.FireUpdate(); - } - else if (args.EventId == ConnectedDeviceEventIds.PreferredTimingEventId) - { - EdidPreferredTimingFeedback.FireUpdate(); - } - else if (args.EventId == ConnectedDeviceEventIds.SerialNumberEventId) - { - EdidSerialNumberFeedback.FireUpdate(); + case ConnectedDeviceEventIds.ManufacturerEventId: + EdidManufacturerFeedback.FireUpdate(); + break; + case ConnectedDeviceEventIds.NameEventId: + EdidNameFeedback.FireUpdate(); + break; + case ConnectedDeviceEventIds.PreferredTimingEventId: + EdidPreferredTimingFeedback.FireUpdate(); + break; + case ConnectedDeviceEventIds.SerialNumberEventId: + EdidSerialNumberFeedback.FireUpdate(); + break; } } - public override bool CustomActivate() - { - // Base does register and sets up comm monitoring. - return base.CustomActivate(); - } public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { @@ -98,20 +89,20 @@ namespace PepperDash.Essentials.DM } #region IIROutputPorts Members - public CrestronCollection IROutputPorts { get { return Rmc.IROutputPorts; } } - public int NumberOfIROutputPorts { get { return Rmc.NumberOfIROutputPorts; } } + public CrestronCollection IROutputPorts { get { return _rmc.IROutputPorts; } } + public int NumberOfIROutputPorts { get { return _rmc.NumberOfIROutputPorts; } } #endregion #region IComPorts Members - public CrestronCollection ComPorts { get { return Rmc.ComPorts; } } - public int NumberOfComPorts { get { return Rmc.NumberOfComPorts; } } + public CrestronCollection ComPorts { get { return _rmc.ComPorts; } } + public int NumberOfComPorts { get { return _rmc.NumberOfComPorts; } } #endregion #region ICec Members /// /// Gets the CEC stream directly from the HDMI port. /// - public Cec StreamCec { get { return Rmc.HdmiOutput.StreamCec; } } + public Cec StreamCec { get { return _rmc.HdmiOutput.StreamCec; } } #endregion } } \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerSController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerSController.cs index e1a2a4d0..ba0f1ad7 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerSController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerSController.cs @@ -16,20 +16,14 @@ namespace PepperDash.Essentials.DM public class DmRmcScalerSController : DmRmcControllerBase, IRoutingInputsOutputs, IIROutputPorts, IComPorts, ICec { - public DmRmcScalerS Rmc { get; private set; } + private readonly DmRmcScalerS _rmc; public RoutingInputPort DmIn { get; private set; } public RoutingOutputPort HdmiOut { get; private set; } - public RoutingPortCollection InputPorts - { - get { return new RoutingPortCollection { DmIn }; } - } + public RoutingPortCollection InputPorts { get; private set; } - public RoutingPortCollection OutputPorts - { - get { return new RoutingPortCollection { HdmiOut }; } - } + public RoutingPortCollection OutputPorts { get; private set; } /// /// Make a Crestron RMC and put it in here @@ -37,24 +31,27 @@ namespace PepperDash.Essentials.DM public DmRmcScalerSController(string key, string name, DmRmcScalerS rmc) : base(key, name, rmc) { - Rmc = rmc; - DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, + _rmc = rmc; + DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.DmCat, 0, this); - HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, + HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, null, this); - EdidManufacturerFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.Manufacturer.StringValue); - EdidNameFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.Name.StringValue); - EdidPreferredTimingFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.PreferredTiming.StringValue); - EdidSerialNumberFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.SerialNumber.StringValue); + EdidManufacturerFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.Manufacturer.StringValue); + EdidNameFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.Name.StringValue); + EdidPreferredTimingFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.PreferredTiming.StringValue); + EdidSerialNumberFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.SerialNumber.StringValue); - VideoOutputResolutionFeedback = new StringFeedback(() => Rmc.HdmiOutput.GetVideoResolutionString()); + VideoOutputResolutionFeedback = new StringFeedback(() => _rmc.HdmiOutput.GetVideoResolutionString()); - Rmc.HdmiOutput.OutputStreamChange += HdmiOutput_OutputStreamChange; - Rmc.HdmiOutput.ConnectedDevice.DeviceInformationChange += ConnectedDevice_DeviceInformationChange; + _rmc.HdmiOutput.OutputStreamChange += HdmiOutput_OutputStreamChange; + _rmc.HdmiOutput.ConnectedDevice.DeviceInformationChange += ConnectedDevice_DeviceInformationChange; + + InputPorts = new RoutingPortCollection {DmIn}; + OutputPorts = new RoutingPortCollection {HdmiOut}; // Set Ports for CEC - HdmiOut.Port = Rmc.HdmiOutput; + HdmiOut.Port = _rmc.HdmiOutput; } void HdmiOutput_OutputStreamChange(EndpointOutputStream outputStream, EndpointOutputStreamEventArgs args) @@ -68,28 +65,21 @@ namespace PepperDash.Essentials.DM void ConnectedDevice_DeviceInformationChange(ConnectedDeviceInformation connectedDevice, ConnectedDeviceEventArgs args) { - if (args.EventId == ConnectedDeviceEventIds.ManufacturerEventId) + switch (args.EventId) { - EdidManufacturerFeedback.FireUpdate(); + case ConnectedDeviceEventIds.ManufacturerEventId: + EdidManufacturerFeedback.FireUpdate(); + break; + case ConnectedDeviceEventIds.NameEventId: + EdidNameFeedback.FireUpdate(); + break; + case ConnectedDeviceEventIds.PreferredTimingEventId: + EdidPreferredTimingFeedback.FireUpdate(); + break; + case ConnectedDeviceEventIds.SerialNumberEventId: + EdidSerialNumberFeedback.FireUpdate(); + break; } - else if (args.EventId == ConnectedDeviceEventIds.NameEventId) - { - EdidNameFeedback.FireUpdate(); - } - else if (args.EventId == ConnectedDeviceEventIds.PreferredTimingEventId) - { - EdidPreferredTimingFeedback.FireUpdate(); - } - else if (args.EventId == ConnectedDeviceEventIds.SerialNumberEventId) - { - EdidSerialNumberFeedback.FireUpdate(); - } - } - - public override bool CustomActivate() - { - // Base does register and sets up comm monitoring. - return base.CustomActivate(); } public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) @@ -98,20 +88,20 @@ namespace PepperDash.Essentials.DM } #region IIROutputPorts Members - public CrestronCollection IROutputPorts { get { return Rmc.IROutputPorts; } } - public int NumberOfIROutputPorts { get { return Rmc.NumberOfIROutputPorts; } } + public CrestronCollection IROutputPorts { get { return _rmc.IROutputPorts; } } + public int NumberOfIROutputPorts { get { return _rmc.NumberOfIROutputPorts; } } #endregion #region IComPorts Members - public CrestronCollection ComPorts { get { return Rmc.ComPorts; } } - public int NumberOfComPorts { get { return Rmc.NumberOfComPorts; } } + public CrestronCollection ComPorts { get { return _rmc.ComPorts; } } + public int NumberOfComPorts { get { return _rmc.NumberOfComPorts; } } #endregion #region ICec Members /// /// Gets the CEC stream directly from the HDMI port. /// - public Cec StreamCec { get { return Rmc.HdmiOutput.StreamCec; } } + public Cec StreamCec { get { return _rmc.HdmiOutput.StreamCec; } } #endregion } } \ No newline at end of file From 03cebb75ceec896e5efa119b754a136f0cf8bc6f Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Thu, 7 May 2020 12:45:55 -0600 Subject: [PATCH 120/156] udpates all DM 8G Receiver classes --- .../Receivers/DmRmc4KScalerCController.cs | 101 +++++++++--------- .../Receivers/DmRmc4k100C1GController.cs | 33 +++--- .../Receivers/DmRmc4kScalerCDspController.cs | 100 ++++++++--------- .../Receivers/DmRmc4kZ100CController.cs | 37 +++---- .../Receivers/DmRmc4kZScalerCController.cs | 88 +++++++-------- .../Receivers/DmRmcScalerCController.cs | 80 ++++++-------- .../Receivers/DmRmcX100CController.cs | 40 +++---- 7 files changed, 210 insertions(+), 269 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4KScalerCController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4KScalerCController.cs index 2a81ff87..850f7458 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4KScalerCController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4KScalerCController.cs @@ -3,7 +3,7 @@ using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DM; using Crestron.SimplSharpPro.DM.Endpoints; using Crestron.SimplSharpPro.DM.Endpoints.Receivers; - +using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Bridges; @@ -16,21 +16,15 @@ namespace PepperDash.Essentials.DM public class DmRmc4kScalerCController : DmRmcControllerBase, IRoutingInputsOutputs, IBasicVolumeWithFeedback, IIROutputPorts, IComPorts, ICec, IRelayPorts { - public DmRmc4kScalerC Rmc { get; private set; } + private readonly DmRmc4kScalerC _rmc; public RoutingInputPort DmIn { get; private set; } public RoutingOutputPort HdmiOut { get; private set; } public RoutingOutputPort BalancedAudioOut { get; private set; } - public RoutingPortCollection InputPorts - { - get { return new RoutingPortCollection { DmIn }; } - } + public RoutingPortCollection InputPorts { get; private set; } - public RoutingPortCollection OutputPorts - { - get { return new RoutingPortCollection { HdmiOut, BalancedAudioOut }; } - } + public RoutingPortCollection OutputPorts { get; private set; } /// /// Make a Crestron RMC and put it in here @@ -38,30 +32,35 @@ namespace PepperDash.Essentials.DM public DmRmc4kScalerCController(string key, string name, DmRmc4kScalerC rmc) : base(key, name, rmc) { - Rmc = rmc; - DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, + _rmc = rmc; + + DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.DmCat, 0, this); - HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, + HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, null, this); BalancedAudioOut = new RoutingOutputPort(DmPortName.BalancedAudioOut, eRoutingSignalType.Audio, eRoutingPortConnectionType.LineAudio, null, this); MuteFeedback = new BoolFeedback(() => false); + VolumeLevelFeedback = new IntFeedback("MainVolumeLevelFeedback", () => rmc.AudioOutput.VolumeFeedback.UShortValue); - EdidManufacturerFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.Manufacturer.StringValue); - EdidNameFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.Name.StringValue); - EdidPreferredTimingFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.PreferredTiming.StringValue); - EdidSerialNumberFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.SerialNumber.StringValue); + EdidManufacturerFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.Manufacturer.StringValue); + EdidNameFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.Name.StringValue); + EdidPreferredTimingFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.PreferredTiming.StringValue); + EdidSerialNumberFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.SerialNumber.StringValue); - VideoOutputResolutionFeedback = new StringFeedback(() => Rmc.HdmiOutput.GetVideoResolutionString()); + InputPorts = new RoutingPortCollection {DmIn}; + OutputPorts = new RoutingPortCollection {HdmiOut, BalancedAudioOut}; - Rmc.HdmiOutput.OutputStreamChange += HdmiOutput_OutputStreamChange; - Rmc.HdmiOutput.ConnectedDevice.DeviceInformationChange += ConnectedDevice_DeviceInformationChange; + VideoOutputResolutionFeedback = new StringFeedback(() => _rmc.HdmiOutput.GetVideoResolutionString()); + + _rmc.HdmiOutput.OutputStreamChange += HdmiOutput_OutputStreamChange; + _rmc.HdmiOutput.ConnectedDevice.DeviceInformationChange += ConnectedDevice_DeviceInformationChange; // Set Ports for CEC - HdmiOut.Port = Rmc.HdmiOutput; + HdmiOut.Port = _rmc.HdmiOutput; } void HdmiOutput_OutputStreamChange(EndpointOutputStream outputStream, EndpointOutputStreamEventArgs args) @@ -75,62 +74,55 @@ namespace PepperDash.Essentials.DM void ConnectedDevice_DeviceInformationChange(ConnectedDeviceInformation connectedDevice, ConnectedDeviceEventArgs args) { - if (args.EventId == ConnectedDeviceEventIds.ManufacturerEventId) + switch (args.EventId) { - EdidManufacturerFeedback.FireUpdate(); - } - else if (args.EventId == ConnectedDeviceEventIds.NameEventId) - { - EdidNameFeedback.FireUpdate(); - } - else if (args.EventId == ConnectedDeviceEventIds.PreferredTimingEventId) - { - EdidPreferredTimingFeedback.FireUpdate(); - } - else if (args.EventId == ConnectedDeviceEventIds.SerialNumberEventId) - { - EdidSerialNumberFeedback.FireUpdate(); + case ConnectedDeviceEventIds.ManufacturerEventId: + EdidManufacturerFeedback.FireUpdate(); + break; + case ConnectedDeviceEventIds.NameEventId: + EdidNameFeedback.FireUpdate(); + break; + case ConnectedDeviceEventIds.PreferredTimingEventId: + EdidPreferredTimingFeedback.FireUpdate(); + break; + case ConnectedDeviceEventIds.SerialNumberEventId: + EdidSerialNumberFeedback.FireUpdate(); + break; } } - public override bool CustomActivate() - { - // Base does register and sets up comm monitoring. - return base.CustomActivate(); - } - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { LinkDmRmcToApi(this, trilist, joinStart, joinMapKey, bridge); } #region IIROutputPorts Members - public CrestronCollection IROutputPorts { get { return Rmc.IROutputPorts; } } - public int NumberOfIROutputPorts { get { return Rmc.NumberOfIROutputPorts; } } + public CrestronCollection IROutputPorts { get { return _rmc.IROutputPorts; } } + public int NumberOfIROutputPorts { get { return _rmc.NumberOfIROutputPorts; } } #endregion #region IComPorts Members - public CrestronCollection ComPorts { get { return Rmc.ComPorts; } } - public int NumberOfComPorts { get { return Rmc.NumberOfComPorts; } } + public CrestronCollection ComPorts { get { return _rmc.ComPorts; } } + public int NumberOfComPorts { get { return _rmc.NumberOfComPorts; } } #endregion #region ICec Members /// /// Gets the CEC stream directly from the HDMI port. /// - public Cec StreamCec { get { return Rmc.HdmiOutput.StreamCec; } } + public Cec StreamCec { get { return _rmc.HdmiOutput.StreamCec; } } #endregion #region IRelayPorts Members public int NumberOfRelayPorts { - get { return Rmc.NumberOfRelayPorts; } + get { return _rmc.NumberOfRelayPorts; } } public CrestronCollection RelayPorts { - get { return Rmc.RelayPorts; } + get { return _rmc.RelayPorts; } } #endregion @@ -148,6 +140,7 @@ namespace PepperDash.Essentials.DM /// public void MuteOff() { + Debug.Console(2, this, "DM Endpoint {0} does not have a mute function", Key); } /// @@ -155,11 +148,12 @@ namespace PepperDash.Essentials.DM /// public void MuteOn() { + Debug.Console(2, this, "DM Endpoint {0} does not have a mute function", Key); } public void SetVolume(ushort level) { - Rmc.AudioOutput.Volume.UShortValue = level; + _rmc.AudioOutput.Volume.UShortValue = level; } public IntFeedback VolumeLevelFeedback @@ -177,22 +171,23 @@ namespace PepperDash.Essentials.DM /// public void MuteToggle() { + Debug.Console(2, this, "DM Endpoint {0} does not have a mute function", Key); } public void VolumeDown(bool pressRelease) { if (pressRelease) - SigHelper.RampTimeScaled(Rmc.AudioOutput.Volume, 0, 4000); + SigHelper.RampTimeScaled(_rmc.AudioOutput.Volume, 0, 4000); else - Rmc.AudioOutput.Volume.StopRamp(); + _rmc.AudioOutput.Volume.StopRamp(); } public void VolumeUp(bool pressRelease) { if (pressRelease) - SigHelper.RampTimeScaled(Rmc.AudioOutput.Volume, 65535, 4000); + SigHelper.RampTimeScaled(_rmc.AudioOutput.Volume, 65535, 4000); else - Rmc.AudioOutput.Volume.StopRamp(); + _rmc.AudioOutput.Volume.StopRamp(); } #endregion diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4k100C1GController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4k100C1GController.cs index 0b5d6df1..b2762c97 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4k100C1GController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4k100C1GController.cs @@ -10,44 +10,39 @@ namespace PepperDash.Essentials.DM public class DmRmc4k100C1GController : DmHdBaseTControllerBase, IRoutingInputsOutputs, IIROutputPorts, IComPorts, ICec { + private readonly DmRmc4K100C1G _rmc; public RoutingInputPort DmIn { get; private set; } public RoutingOutputPort HdmiOut { get; private set; } - public RoutingPortCollection InputPorts - { - get { return new RoutingPortCollection { DmIn }; } - } + public RoutingPortCollection InputPorts { get; private set; } - public RoutingPortCollection OutputPorts - { - get { return new RoutingPortCollection { HdmiOut }; } - } + public RoutingPortCollection OutputPorts { get; private set; } public DmRmc4k100C1GController(string key, string name, DmRmc4K100C1G rmc) : base(key, name, rmc) { - Rmc = rmc; - DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, + _rmc = rmc; + DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.DmCat, 0, this); - HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, - eRoutingPortConnectionType.Hdmi, null, this); + HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.AudioVideo, + eRoutingPortConnectionType.Hdmi, null, this) {Port = _rmc}; - // Set Ports for CEC - HdmiOut.Port = Rmc; // Unique case, this class has no HdmiOutput port and ICec is implemented on the receiver class itself + InputPorts = new RoutingPortCollection {DmIn}; + OutputPorts = new RoutingPortCollection {HdmiOut}; } #region IIROutputPorts Members - public CrestronCollection IROutputPorts { get { return (Rmc as DmRmc4K100C1G).IROutputPorts; } } - public int NumberOfIROutputPorts { get { return (Rmc as DmRmc4K100C1G).NumberOfIROutputPorts; } } + public CrestronCollection IROutputPorts { get { return _rmc.IROutputPorts; } } + public int NumberOfIROutputPorts { get { return _rmc.NumberOfIROutputPorts; } } #endregion #region IComPorts Members - public CrestronCollection ComPorts { get { return Rmc.ComPorts; } } - public int NumberOfComPorts { get { return Rmc.NumberOfComPorts; } } + public CrestronCollection ComPorts { get { return _rmc.ComPorts; } } + public int NumberOfComPorts { get { return _rmc.NumberOfComPorts; } } #endregion #region ICec Members - public Cec StreamCec { get { return (Rmc as DmRmc4K100C1G).StreamCec; } } + public Cec StreamCec { get { return _rmc.StreamCec; } } #endregion } } \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kScalerCDspController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kScalerCDspController.cs index 3a8afd8c..e63ad5de 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kScalerCDspController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kScalerCDspController.cs @@ -3,7 +3,7 @@ using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DM; using Crestron.SimplSharpPro.DM.Endpoints; using Crestron.SimplSharpPro.DM.Endpoints.Receivers; - +using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Bridges; @@ -16,21 +16,15 @@ namespace PepperDash.Essentials.DM public class DmRmc4kScalerCDspController : DmRmcControllerBase, IRoutingInputsOutputs, IBasicVolumeWithFeedback, IIROutputPorts, IComPorts, ICec, IRelayPorts { - public DmRmc4kScalerCDsp Rmc { get; private set; } + private readonly DmRmc4kScalerCDsp _rmc; public RoutingInputPort DmIn { get; private set; } public RoutingOutputPort HdmiOut { get; private set; } public RoutingOutputPort BalancedAudioOut { get; private set; } - public RoutingPortCollection InputPorts - { - get { return new RoutingPortCollection { DmIn }; } - } + public RoutingPortCollection InputPorts { get; private set; } - public RoutingPortCollection OutputPorts - { - get { return new RoutingPortCollection { HdmiOut, BalancedAudioOut }; } - } + public RoutingPortCollection OutputPorts { get; private set; } /// /// Make a Crestron RMC and put it in here @@ -38,10 +32,11 @@ namespace PepperDash.Essentials.DM public DmRmc4kScalerCDspController(string key, string name, DmRmc4kScalerCDsp rmc) : base(key, name, rmc) { - Rmc = rmc; - DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, + _rmc = rmc; + + DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.DmCat, 0, this); - HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, + HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, null, this); BalancedAudioOut = new RoutingOutputPort(DmPortName.BalancedAudioOut, eRoutingSignalType.Audio, eRoutingPortConnectionType.LineAudio, null, this); @@ -50,18 +45,21 @@ namespace PepperDash.Essentials.DM VolumeLevelFeedback = new IntFeedback("MainVolumeLevelFeedback", () => rmc.AudioOutput.VolumeFeedback.UShortValue); - EdidManufacturerFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.Manufacturer.StringValue); - EdidNameFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.Name.StringValue); - EdidPreferredTimingFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.PreferredTiming.StringValue); - EdidSerialNumberFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.SerialNumber.StringValue); + EdidManufacturerFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.Manufacturer.StringValue); + EdidNameFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.Name.StringValue); + EdidPreferredTimingFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.PreferredTiming.StringValue); + EdidSerialNumberFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.SerialNumber.StringValue); - VideoOutputResolutionFeedback = new StringFeedback(() => Rmc.HdmiOutput.GetVideoResolutionString()); + VideoOutputResolutionFeedback = new StringFeedback(() => _rmc.HdmiOutput.GetVideoResolutionString()); - Rmc.HdmiOutput.OutputStreamChange += HdmiOutput_OutputStreamChange; - Rmc.HdmiOutput.ConnectedDevice.DeviceInformationChange += ConnectedDevice_DeviceInformationChange; + InputPorts = new RoutingPortCollection {DmIn}; + OutputPorts = new RoutingPortCollection {HdmiOut, BalancedAudioOut}; + + _rmc.HdmiOutput.OutputStreamChange += HdmiOutput_OutputStreamChange; + _rmc.HdmiOutput.ConnectedDevice.DeviceInformationChange += ConnectedDevice_DeviceInformationChange; // Set Ports for CEC - HdmiOut.Port = Rmc.HdmiOutput; + HdmiOut.Port = _rmc.HdmiOutput; } void HdmiOutput_OutputStreamChange(EndpointOutputStream outputStream, EndpointOutputStreamEventArgs args) @@ -75,28 +73,21 @@ namespace PepperDash.Essentials.DM void ConnectedDevice_DeviceInformationChange(ConnectedDeviceInformation connectedDevice, ConnectedDeviceEventArgs args) { - if (args.EventId == ConnectedDeviceEventIds.ManufacturerEventId) + switch (args.EventId) { - EdidManufacturerFeedback.FireUpdate(); + case ConnectedDeviceEventIds.ManufacturerEventId: + EdidManufacturerFeedback.FireUpdate(); + break; + case ConnectedDeviceEventIds.NameEventId: + EdidNameFeedback.FireUpdate(); + break; + case ConnectedDeviceEventIds.PreferredTimingEventId: + EdidPreferredTimingFeedback.FireUpdate(); + break; + case ConnectedDeviceEventIds.SerialNumberEventId: + EdidSerialNumberFeedback.FireUpdate(); + break; } - else if (args.EventId == ConnectedDeviceEventIds.NameEventId) - { - EdidNameFeedback.FireUpdate(); - } - else if (args.EventId == ConnectedDeviceEventIds.PreferredTimingEventId) - { - EdidPreferredTimingFeedback.FireUpdate(); - } - else if (args.EventId == ConnectedDeviceEventIds.SerialNumberEventId) - { - EdidSerialNumberFeedback.FireUpdate(); - } - } - - public override bool CustomActivate() - { - // Base does register and sets up comm monitoring. - return base.CustomActivate(); } public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) @@ -105,32 +96,32 @@ namespace PepperDash.Essentials.DM } #region IIROutputPorts Members - public CrestronCollection IROutputPorts { get { return Rmc.IROutputPorts; } } - public int NumberOfIROutputPorts { get { return Rmc.NumberOfIROutputPorts; } } + public CrestronCollection IROutputPorts { get { return _rmc.IROutputPorts; } } + public int NumberOfIROutputPorts { get { return _rmc.NumberOfIROutputPorts; } } #endregion #region IComPorts Members - public CrestronCollection ComPorts { get { return Rmc.ComPorts; } } - public int NumberOfComPorts { get { return Rmc.NumberOfComPorts; } } + public CrestronCollection ComPorts { get { return _rmc.ComPorts; } } + public int NumberOfComPorts { get { return _rmc.NumberOfComPorts; } } #endregion #region ICec Members /// /// Gets the CEC stream directly from the HDMI port. /// - public Cec StreamCec { get { return Rmc.HdmiOutput.StreamCec; } } + public Cec StreamCec { get { return _rmc.HdmiOutput.StreamCec; } } #endregion #region IRelayPorts Members public int NumberOfRelayPorts { - get { return Rmc.NumberOfRelayPorts; } + get { return _rmc.NumberOfRelayPorts; } } public CrestronCollection RelayPorts { - get { return Rmc.RelayPorts; } + get { return _rmc.RelayPorts; } } #endregion @@ -148,6 +139,7 @@ namespace PepperDash.Essentials.DM /// public void MuteOff() { + Debug.Console(2, this, "DM Endpoint {0} does not have a mute function", Key); } /// @@ -155,11 +147,12 @@ namespace PepperDash.Essentials.DM /// public void MuteOn() { + Debug.Console(2, this, "DM Endpoint {0} does not have a mute function", Key); } public void SetVolume(ushort level) { - Rmc.AudioOutput.Volume.UShortValue = level; + _rmc.AudioOutput.Volume.UShortValue = level; } public IntFeedback VolumeLevelFeedback @@ -177,22 +170,23 @@ namespace PepperDash.Essentials.DM /// public void MuteToggle() { + Debug.Console(2, this, "DM Endpoint {0} does not have a mute function", Key); } public void VolumeDown(bool pressRelease) { if (pressRelease) - SigHelper.RampTimeScaled(Rmc.AudioOutput.Volume, 0, 4000); + SigHelper.RampTimeScaled(_rmc.AudioOutput.Volume, 0, 4000); else - Rmc.AudioOutput.Volume.StopRamp(); + _rmc.AudioOutput.Volume.StopRamp(); } public void VolumeUp(bool pressRelease) { if (pressRelease) - SigHelper.RampTimeScaled(Rmc.AudioOutput.Volume, 65535, 4000); + SigHelper.RampTimeScaled(_rmc.AudioOutput.Volume, 65535, 4000); else - Rmc.AudioOutput.Volume.StopRamp(); + _rmc.AudioOutput.Volume.StopRamp(); } #endregion diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZ100CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZ100CController.cs index e12c70df..946613a8 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZ100CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZ100CController.cs @@ -17,16 +17,6 @@ namespace PepperDash.Essentials.DM { _rmc = rmc; - /* removed this logic because it's done in the base constructor and doesn't need to be duplicated here - DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, - eRoutingPortConnectionType.DmCat, 0, this); - HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, - eRoutingPortConnectionType.Hdmi, null, this) {Port = _rmc}; - */ - - // Set Ports for CEC - - //TODO: We need to look at this class inheritance design...not so sure these properties need to be virtual and/or abstract. EdidManufacturerFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.Manufacturer.StringValue); EdidNameFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.Name.StringValue); EdidPreferredTimingFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.PreferredTiming.StringValue); @@ -47,21 +37,20 @@ namespace PepperDash.Essentials.DM void ConnectedDevice_DeviceInformationChange(ConnectedDeviceInformation connectedDevice, ConnectedDeviceEventArgs args) { - if (args.EventId == ConnectedDeviceEventIds.ManufacturerEventId) + switch (args.EventId) { - EdidManufacturerFeedback.FireUpdate(); - } - else if (args.EventId == ConnectedDeviceEventIds.NameEventId) - { - EdidNameFeedback.FireUpdate(); - } - else if (args.EventId == ConnectedDeviceEventIds.PreferredTimingEventId) - { - EdidPreferredTimingFeedback.FireUpdate(); - } - else if (args.EventId == ConnectedDeviceEventIds.SerialNumberEventId) - { - EdidSerialNumberFeedback.FireUpdate(); + case ConnectedDeviceEventIds.ManufacturerEventId: + EdidManufacturerFeedback.FireUpdate(); + break; + case ConnectedDeviceEventIds.NameEventId: + EdidNameFeedback.FireUpdate(); + break; + case ConnectedDeviceEventIds.PreferredTimingEventId: + EdidPreferredTimingFeedback.FireUpdate(); + break; + case ConnectedDeviceEventIds.SerialNumberEventId: + EdidSerialNumberFeedback.FireUpdate(); + break; } } diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZScalerCController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZScalerCController.cs index b3ca0695..81fcf69b 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZScalerCController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZScalerCController.cs @@ -14,7 +14,7 @@ namespace PepperDash.Essentials.DM public class DmRmc4kZScalerCController : DmRmcControllerBase, IRmcRouting, IIROutputPorts, IComPorts, ICec { - public DmRmc4kzScalerC Rmc { get; private set; } + private readonly DmRmc4kzScalerC _rmc; public RoutingInputPort DmIn { get; private set; } public RoutingInputPort HdmiIn { get; private set; } @@ -25,41 +25,38 @@ namespace PepperDash.Essentials.DM /// public IntFeedback AudioVideoSourceNumericFeedback { get; private set; } - public RoutingPortCollection InputPorts - { - get { return new RoutingPortCollection { DmIn, HdmiIn }; } - } + public RoutingPortCollection InputPorts { get; private set; } - public RoutingPortCollection OutputPorts - { - get { return new RoutingPortCollection { HdmiOut }; } - } + public RoutingPortCollection OutputPorts { get; private set; } public DmRmc4kZScalerCController(string key, string name, DmRmc4kzScalerC rmc) : base(key, name, rmc) { - Rmc = rmc; - DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, + _rmc = rmc; + DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.DmCat, 0, this); - HdmiIn = new RoutingInputPort(DmPortName.HdmiIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, + HdmiIn = new RoutingInputPort(DmPortName.HdmiIn, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, 0, this); - HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, + HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, null, this); - EdidManufacturerFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.Manufacturer.StringValue); - EdidNameFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.Name.StringValue); - EdidPreferredTimingFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.PreferredTiming.StringValue); - EdidSerialNumberFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.SerialNumber.StringValue); + EdidManufacturerFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.Manufacturer.StringValue); + EdidNameFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.Name.StringValue); + EdidPreferredTimingFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.PreferredTiming.StringValue); + EdidSerialNumberFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.SerialNumber.StringValue); - VideoOutputResolutionFeedback = new StringFeedback(() => Rmc.HdmiOutput.GetVideoResolutionString()); + VideoOutputResolutionFeedback = new StringFeedback(() => _rmc.HdmiOutput.GetVideoResolutionString()); - Rmc.HdmiOutput.OutputStreamChange += HdmiOutput_OutputStreamChange; - Rmc.HdmiOutput.ConnectedDevice.DeviceInformationChange += ConnectedDevice_DeviceInformationChange; + InputPorts = new RoutingPortCollection {DmIn, HdmiIn}; + OutputPorts = new RoutingPortCollection {HdmiOut}; + + _rmc.HdmiOutput.OutputStreamChange += HdmiOutput_OutputStreamChange; + _rmc.HdmiOutput.ConnectedDevice.DeviceInformationChange += ConnectedDevice_DeviceInformationChange; // Set Ports for CEC - HdmiOut.Port = Rmc.HdmiOutput; + HdmiOut.Port = _rmc.HdmiOutput; - AudioVideoSourceNumericFeedback = new IntFeedback(() => (ushort)(Rmc.SelectedSourceFeedback)); + AudioVideoSourceNumericFeedback = new IntFeedback(() => (ushort)(_rmc.SelectedSourceFeedback)); } void HdmiOutput_OutputStreamChange(EndpointOutputStream outputStream, EndpointOutputStreamEventArgs args) @@ -78,28 +75,21 @@ namespace PepperDash.Essentials.DM void ConnectedDevice_DeviceInformationChange(ConnectedDeviceInformation connectedDevice, ConnectedDeviceEventArgs args) { - if (args.EventId == ConnectedDeviceEventIds.ManufacturerEventId) + switch (args.EventId) { - EdidManufacturerFeedback.FireUpdate(); + case ConnectedDeviceEventIds.ManufacturerEventId: + EdidManufacturerFeedback.FireUpdate(); + break; + case ConnectedDeviceEventIds.NameEventId: + EdidNameFeedback.FireUpdate(); + break; + case ConnectedDeviceEventIds.PreferredTimingEventId: + EdidPreferredTimingFeedback.FireUpdate(); + break; + case ConnectedDeviceEventIds.SerialNumberEventId: + EdidSerialNumberFeedback.FireUpdate(); + break; } - else if (args.EventId == ConnectedDeviceEventIds.NameEventId) - { - EdidNameFeedback.FireUpdate(); - } - else if (args.EventId == ConnectedDeviceEventIds.PreferredTimingEventId) - { - EdidPreferredTimingFeedback.FireUpdate(); - } - else if (args.EventId == ConnectedDeviceEventIds.SerialNumberEventId) - { - EdidSerialNumberFeedback.FireUpdate(); - } - } - - public override bool CustomActivate() - { - // Base does register and sets up comm monitoring. - return base.CustomActivate(); } public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) @@ -108,20 +98,20 @@ namespace PepperDash.Essentials.DM } #region IIROutputPorts Members - public CrestronCollection IROutputPorts { get { return Rmc.IROutputPorts; } } - public int NumberOfIROutputPorts { get { return Rmc.NumberOfIROutputPorts; } } + public CrestronCollection IROutputPorts { get { return _rmc.IROutputPorts; } } + public int NumberOfIROutputPorts { get { return _rmc.NumberOfIROutputPorts; } } #endregion #region IComPorts Members - public CrestronCollection ComPorts { get { return Rmc.ComPorts; } } - public int NumberOfComPorts { get { return Rmc.NumberOfComPorts; } } + public CrestronCollection ComPorts { get { return _rmc.ComPorts; } } + public int NumberOfComPorts { get { return _rmc.NumberOfComPorts; } } #endregion #region ICec Members /// /// Gets the CEC stream directly from the HDMI port. /// - public Cec StreamCec { get { return Rmc.HdmiOutput.StreamCec; } } + public Cec StreamCec { get { return _rmc.HdmiOutput.StreamCec; } } #endregion @@ -132,14 +122,14 @@ namespace PepperDash.Essentials.DM var number = Convert.ToUInt16(inputSelector); - Rmc.AudioVideoSource = (DmRmc4kzScalerC.eAudioVideoSource)number; + _rmc.AudioVideoSource = (DmRmc4kzScalerC.eAudioVideoSource)number; } public void ExecuteNumericSwitch(ushort inputSelector, ushort outputSelector, eRoutingSignalType signalType) { Debug.Console(2, this, "Attempting a route from input {0} to HDMI Output", inputSelector); - Rmc.AudioVideoSource = (DmRmc4kzScalerC.eAudioVideoSource)inputSelector; + _rmc.AudioVideoSource = (DmRmc4kzScalerC.eAudioVideoSource)inputSelector; } #endregion diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerCController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerCController.cs index 235cc1ae..8b2c1e98 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerCController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerCController.cs @@ -16,20 +16,14 @@ namespace PepperDash.Essentials.DM public class DmRmcScalerCController : DmRmcControllerBase, IRoutingInputsOutputs, IIROutputPorts, IComPorts, ICec { - public DmRmcScalerC Rmc { get; private set; } + private readonly DmRmcScalerC _rmc; public RoutingInputPort DmIn { get; private set; } public RoutingOutputPort HdmiOut { get; private set; } - public RoutingPortCollection InputPorts - { - get { return new RoutingPortCollection { DmIn }; } - } + public RoutingPortCollection InputPorts { get; private set; } - public RoutingPortCollection OutputPorts - { - get { return new RoutingPortCollection { HdmiOut }; } - } + public RoutingPortCollection OutputPorts { get; private set; } /// /// Make a Crestron RMC and put it in here @@ -37,24 +31,27 @@ namespace PepperDash.Essentials.DM public DmRmcScalerCController(string key, string name, DmRmcScalerC rmc) : base(key, name, rmc) { - Rmc = rmc; - DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, + _rmc = rmc; + DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.DmCat, 0, this); - HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, + HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, null, this); - EdidManufacturerFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.Manufacturer.StringValue); - EdidNameFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.Name.StringValue); - EdidPreferredTimingFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.PreferredTiming.StringValue); - EdidSerialNumberFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.SerialNumber.StringValue); + EdidManufacturerFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.Manufacturer.StringValue); + EdidNameFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.Name.StringValue); + EdidPreferredTimingFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.PreferredTiming.StringValue); + EdidSerialNumberFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.SerialNumber.StringValue); - VideoOutputResolutionFeedback = new StringFeedback(() => Rmc.HdmiOutput.GetVideoResolutionString()); + VideoOutputResolutionFeedback = new StringFeedback(() => _rmc.HdmiOutput.GetVideoResolutionString()); - Rmc.HdmiOutput.OutputStreamChange += HdmiOutput_OutputStreamChange; - Rmc.HdmiOutput.ConnectedDevice.DeviceInformationChange += ConnectedDevice_DeviceInformationChange; + _rmc.HdmiOutput.OutputStreamChange += HdmiOutput_OutputStreamChange; + _rmc.HdmiOutput.ConnectedDevice.DeviceInformationChange += ConnectedDevice_DeviceInformationChange; + + InputPorts = new RoutingPortCollection {DmIn}; + OutputPorts = new RoutingPortCollection {HdmiOut}; // Set Ports for CEC - HdmiOut.Port = Rmc.HdmiOutput; + HdmiOut.Port = _rmc.HdmiOutput; } void HdmiOutput_OutputStreamChange(EndpointOutputStream outputStream, EndpointOutputStreamEventArgs args) @@ -68,50 +65,43 @@ namespace PepperDash.Essentials.DM void ConnectedDevice_DeviceInformationChange(ConnectedDeviceInformation connectedDevice, ConnectedDeviceEventArgs args) { - if (args.EventId == ConnectedDeviceEventIds.ManufacturerEventId) + switch (args.EventId) { - EdidManufacturerFeedback.FireUpdate(); - } - else if (args.EventId == ConnectedDeviceEventIds.NameEventId) - { - EdidNameFeedback.FireUpdate(); - } - else if (args.EventId == ConnectedDeviceEventIds.PreferredTimingEventId) - { - EdidPreferredTimingFeedback.FireUpdate(); - } - else if (args.EventId == ConnectedDeviceEventIds.SerialNumberEventId) - { - EdidSerialNumberFeedback.FireUpdate(); + case ConnectedDeviceEventIds.ManufacturerEventId: + EdidManufacturerFeedback.FireUpdate(); + break; + case ConnectedDeviceEventIds.NameEventId: + EdidNameFeedback.FireUpdate(); + break; + case ConnectedDeviceEventIds.PreferredTimingEventId: + EdidPreferredTimingFeedback.FireUpdate(); + break; + case ConnectedDeviceEventIds.SerialNumberEventId: + EdidSerialNumberFeedback.FireUpdate(); + break; } } - public override bool CustomActivate() - { - // Base does register and sets up comm monitoring. - return base.CustomActivate(); - } - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { LinkDmRmcToApi(this, trilist, joinStart, joinMapKey, bridge); } #region IIROutputPorts Members - public CrestronCollection IROutputPorts { get { return Rmc.IROutputPorts; } } - public int NumberOfIROutputPorts { get { return Rmc.NumberOfIROutputPorts; } } + public CrestronCollection IROutputPorts { get { return _rmc.IROutputPorts; } } + public int NumberOfIROutputPorts { get { return _rmc.NumberOfIROutputPorts; } } #endregion #region IComPorts Members - public CrestronCollection ComPorts { get { return Rmc.ComPorts; } } - public int NumberOfComPorts { get { return Rmc.NumberOfComPorts; } } + public CrestronCollection ComPorts { get { return _rmc.ComPorts; } } + public int NumberOfComPorts { get { return _rmc.NumberOfComPorts; } } #endregion #region ICec Members /// /// Gets the CEC stream directly from the HDMI port. /// - public Cec StreamCec { get { return Rmc.HdmiOutput.StreamCec; } } + public Cec StreamCec { get { return _rmc.HdmiOutput.StreamCec; } } #endregion } } \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcX100CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcX100CController.cs index c4d15ffb..6fa713ad 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcX100CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcX100CController.cs @@ -15,20 +15,14 @@ namespace PepperDash.Essentials.DM public class DmRmcX100CController : DmRmcControllerBase, IRoutingInputsOutputs, IIROutputPorts, IComPorts, ICec { - public DmRmc100C Rmc { get; protected set; } + private readonly DmRmc100C _rmc; public RoutingInputPort DmIn { get; protected set; } public RoutingOutputPort HdmiOut { get; protected set; } - public RoutingPortCollection InputPorts - { - get { return new RoutingPortCollection { DmIn }; } - } + public RoutingPortCollection InputPorts { get; protected set; } - public RoutingPortCollection OutputPorts - { - get { return new RoutingPortCollection { HdmiOut }; } - } + public RoutingPortCollection OutputPorts { get; protected set; } /// /// Make a Crestron RMC and put it in here @@ -36,20 +30,14 @@ namespace PepperDash.Essentials.DM public DmRmcX100CController(string key, string name, DmRmc100C rmc) : base(key, name, rmc) { - Rmc = rmc; - DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, + _rmc = rmc; + DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.DmCat, 0, this); - HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, - eRoutingPortConnectionType.Hdmi, null, this); + HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.AudioVideo, + eRoutingPortConnectionType.Hdmi, null, this) {Port = _rmc}; - // Set Ports for CEC - HdmiOut.Port = Rmc; // Unique case, this class has no HdmiOutput port and ICec is implemented on the receiver class itself - } - - public override bool CustomActivate() - { - // Base does register and sets up comm monitoring. - return base.CustomActivate(); + InputPorts = new RoutingPortCollection {DmIn}; + OutputPorts = new RoutingPortCollection {HdmiOut}; } public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) @@ -58,17 +46,17 @@ namespace PepperDash.Essentials.DM } #region IIROutputPorts Members - public CrestronCollection IROutputPorts { get { return Rmc.IROutputPorts; } } - public int NumberOfIROutputPorts { get { return Rmc.NumberOfIROutputPorts; } } + public CrestronCollection IROutputPorts { get { return _rmc.IROutputPorts; } } + public int NumberOfIROutputPorts { get { return _rmc.NumberOfIROutputPorts; } } #endregion #region IComPorts Members - public CrestronCollection ComPorts { get { return Rmc.ComPorts; } } - public int NumberOfComPorts { get { return Rmc.NumberOfComPorts; } } + public CrestronCollection ComPorts { get { return _rmc.ComPorts; } } + public int NumberOfComPorts { get { return _rmc.NumberOfComPorts; } } #endregion #region ICec Members - public Cec StreamCec { get { return Rmc.StreamCec; } } + public Cec StreamCec { get { return _rmc.StreamCec; } } #endregion } } \ No newline at end of file From 53fa0c0865b0ab3f363fa5e92763292f2d55299a Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Thu, 7 May 2020 12:46:49 -0600 Subject: [PATCH 121/156] updates DmRmcControllerBase --- .../Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs index 979bf495..8c46c69c 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs @@ -15,7 +15,8 @@ namespace PepperDash.Essentials.DM [Description("Wrapper class for all DM-RMC variants")] public abstract class DmRmcControllerBase : CrestronGenericBridgeableBaseDevice { - protected EndpointReceiverBase Rmc; + private readonly EndpointReceiverBase _rmc; //kept here just in case. Only property or method on this class that's not device-specific is the DMOutput that it's attached to. + public StringFeedback VideoOutputResolutionFeedback { get; protected set; } public StringFeedback EdidManufacturerFeedback { get; protected set; } public StringFeedback EdidNameFeedback { get; protected set; } @@ -25,10 +26,9 @@ namespace PepperDash.Essentials.DM protected DmRmcControllerBase(string key, string name, EndpointReceiverBase device) : base(key, name, device) { - Rmc = device; - + _rmc = device; // if wired to a chassis, skip registration step in base class - PreventRegistration = device.DMOutput != null; + PreventRegistration = _rmc.DMOutput != null; AddToFeedbackList(VideoOutputResolutionFeedback, EdidManufacturerFeedback, EdidSerialNumberFeedback, EdidNameFeedback, EdidPreferredTimingFeedback); } From 8da86c360c60ff8c40af06f4d0b154c6ae0d39c7 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Thu, 7 May 2020 16:30:01 -0500 Subject: [PATCH 122/156] Updated GlsOccupancySensorBaseController and GlsOccupancySensorBaseJoinMap --- .../JoinMaps/GlsOccupancySensorBaseJoinMap.cs | 414 ++++++++---------- .../GlsOccupancySensorBaseController.cs | 126 +++--- 2 files changed, 238 insertions(+), 302 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/GlsOccupancySensorBaseJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/GlsOccupancySensorBaseJoinMap.cs index 6e2cd175..15b927b2 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/GlsOccupancySensorBaseJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/GlsOccupancySensorBaseJoinMap.cs @@ -1,238 +1,176 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using PepperDash.Essentials.Core; - -namespace PepperDash.Essentials.Core.Bridges -{ - public class GlsOccupancySensorBaseJoinMap : JoinMapBase - { - #region Digitals - - /// - /// High when device is online - /// - public uint IsOnline { get; set; } - /// - /// Forces the device to report occupied status - /// - public uint ForceOccupied { get; set; } - /// - /// Forces the device to report vacant status - /// - public uint ForceVacant { get; set; } - /// - /// Enables raw status reporting - /// - public uint EnableRawStates { get; set; } - /// - /// High when raw occupancy is detected - /// - public uint RawOccupancyFeedback { get; set; } - /// - /// High when PIR sensor detects motion - /// - public uint RawOccupancyPirFeedback { get; set; } - /// - /// High when US sensor detects motion - /// - public uint RawOccupancyUsFeedback { get; set; } - /// - /// High when occupancy is detected - /// - public uint RoomOccupiedFeedback { get; set; } - /// - /// Hich when occupancy is detected in the grace period - /// - public uint GraceOccupancyDetectedFeedback { get; set; } - /// - /// High when vacancy is detected - /// - public uint RoomVacantFeedback { get; set; } - - /// - /// Enables the LED Flash when set high - /// - public uint EnableLedFlash { get; set; } - /// - /// Disables the LED flash when set high - /// - public uint DisableLedFlash { get; set; } - /// - /// Enables the Short Timeout - /// - public uint EnableShortTimeout { get; set; } - /// - /// Disables the Short Timout - /// - public uint DisableShortTimeout { get; set; } - /// - /// Set high to enable one technology to trigger occupancy - /// - public uint OrWhenVacated { get; set; } - /// - /// Set high to require both technologies to trigger occupancy - /// - public uint AndWhenVacated { get; set; } - /// - /// Enables Ultrasonic Sensor A - /// - public uint EnableUsA { get; set; } - /// - /// Disables Ultrasonic Sensor A - /// - public uint DisableUsA { get; set; } - /// - /// Enables Ultrasonic Sensor B - /// - public uint EnableUsB { get; set; } - /// - /// Disables Ultrasonic Sensor B - /// - public uint DisableUsB { get; set; } - /// - /// Enables Pir - /// - public uint EnablePir { get; set; } - /// - /// Disables Pir - /// - public uint DisablePir { get; set; } - public uint IncrementUsInOccupiedState { get; set; } - public uint DecrementUsInOccupiedState { get; set; } - public uint IncrementUsInVacantState { get; set; } - public uint DecrementUsInVacantState { get; set; } - public uint IncrementPirInOccupiedState { get; set; } - public uint DecrementPirInOccupiedState { get; set; } - public uint IncrementPirInVacantState { get; set; } - public uint DecrementPirInVacantState { get; set; } - #endregion - - #region Analogs - /// - /// Sets adn reports the remote timeout value - /// - public uint Timeout { get; set; } - /// - /// Reports the local timeout value - /// - public uint TimeoutLocalFeedback { get; set; } - /// - /// Sets the minimum internal photo sensor value and reports the current level - /// - public uint InternalPhotoSensorValue { get; set; } - /// - /// Sets the minimum external photo sensor value and reports the current level - /// - public uint ExternalPhotoSensorValue { get; set; } - - public uint UsSensitivityInOccupiedState { get; set; } - - public uint UsSensitivityInVacantState { get; set; } - - public uint PirSensitivityInOccupiedState { get; set; } - - public uint PirSensitivityInVacantState { get; set; } - #endregion - - #region Serial - public uint Name { get; set; } - #endregion - - public GlsOccupancySensorBaseJoinMap() - { - IsOnline = 1; - ForceOccupied = 2; - ForceVacant = 3; - EnableRawStates = 4; - RoomOccupiedFeedback = 2; - GraceOccupancyDetectedFeedback = 3; - RoomVacantFeedback = 4; - RawOccupancyFeedback = 5; - RawOccupancyPirFeedback = 6; - RawOccupancyUsFeedback = 7; - EnableLedFlash = 11; - DisableLedFlash = 12; - EnableShortTimeout = 13; - DisableShortTimeout = 14; - OrWhenVacated = 15; - AndWhenVacated = 16; - EnableUsA = 17; - DisableUsA = 18; - EnableUsB = 19; - DisableUsB = 20; - EnablePir = 21; - DisablePir = 22; - IncrementUsInOccupiedState = 23; - DecrementUsInOccupiedState = 24; - IncrementUsInVacantState = 25; - DecrementUsInVacantState = 26; - IncrementPirInOccupiedState = 27; - DecrementPirInOccupiedState = 28; - IncrementPirInVacantState = 29; - DecrementPirInVacantState = 30; - - Timeout = 1; - TimeoutLocalFeedback = 2; - InternalPhotoSensorValue = 3; - ExternalPhotoSensorValue = 4; - UsSensitivityInOccupiedState = 5; - UsSensitivityInVacantState = 6; - PirSensitivityInOccupiedState = 7; - PirSensitivityInVacantState = 8; - - Name = 1; - - } - - public override void OffsetJoinNumbers(uint joinStart) - { - var joinOffset = joinStart - 1; - - IsOnline = IsOnline + joinOffset; - ForceOccupied = ForceOccupied + joinOffset; - ForceVacant = ForceVacant + joinOffset; - EnableRawStates = EnableRawStates + joinOffset; - RoomOccupiedFeedback = RoomOccupiedFeedback + joinOffset; - GraceOccupancyDetectedFeedback = GraceOccupancyDetectedFeedback + joinOffset; - RoomVacantFeedback = RoomVacantFeedback + joinOffset; - RawOccupancyFeedback = RawOccupancyFeedback + joinOffset; - RawOccupancyPirFeedback = RawOccupancyPirFeedback + joinOffset; - RawOccupancyUsFeedback = RawOccupancyUsFeedback + joinOffset; - EnableLedFlash = EnableLedFlash + joinOffset; - DisableLedFlash = DisableLedFlash + joinOffset; - EnableShortTimeout = EnableShortTimeout + joinOffset; - DisableShortTimeout = DisableShortTimeout + joinOffset; - OrWhenVacated = OrWhenVacated + joinOffset; - AndWhenVacated = AndWhenVacated + joinOffset; - EnableUsA = EnableUsA + joinOffset; - DisableUsA = DisableUsA + joinOffset; - EnableUsB = EnableUsB + joinOffset; - DisableUsB = DisableUsB + joinOffset; - EnablePir = EnablePir + joinOffset; - DisablePir = DisablePir + joinOffset; - IncrementUsInOccupiedState = IncrementUsInOccupiedState + joinOffset; - DecrementUsInOccupiedState = DecrementUsInOccupiedState + joinOffset; - IncrementUsInVacantState = IncrementUsInVacantState + joinOffset; - DecrementUsInVacantState = DecrementUsInVacantState + joinOffset; - IncrementPirInOccupiedState = IncrementPirInOccupiedState + joinOffset; - DecrementPirInOccupiedState = DecrementPirInOccupiedState + joinOffset; - IncrementPirInVacantState = IncrementPirInVacantState + joinOffset; - DecrementPirInVacantState = DecrementPirInVacantState + joinOffset; - - Timeout = Timeout + joinOffset; - TimeoutLocalFeedback = TimeoutLocalFeedback + joinOffset; - InternalPhotoSensorValue = InternalPhotoSensorValue + joinOffset; - ExternalPhotoSensorValue = ExternalPhotoSensorValue + joinOffset; - UsSensitivityInOccupiedState = UsSensitivityInOccupiedState + joinOffset; - UsSensitivityInVacantState = UsSensitivityInVacantState + joinOffset; - PirSensitivityInOccupiedState = PirSensitivityInOccupiedState + joinOffset; - PirSensitivityInVacantState = PirSensitivityInVacantState + joinOffset; - - Name = Name + joinOffset; - } - } - -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Core.Bridges +{ + public class GlsOccupancySensorBaseJoinMap : JoinMapBaseAdvanced + { + [JoinName("IsOnline")] + public JoinDataComplete IsOnline = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "Occ Sensor Is Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("ForceOccupied")] + public JoinDataComplete ForceOccupied = new JoinDataComplete(new JoinData() { JoinNumber = 2, JoinSpan = 1 }, + new JoinMetadata() { Label = "Occ Sensor Set to Occupied", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("ForceVacant")] + public JoinDataComplete ForceVacant = new JoinDataComplete(new JoinData() { JoinNumber = 3, JoinSpan = 1 }, + new JoinMetadata() { Label = "Occ Sensor Set to Vacant", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("EnableRawStates")] + public JoinDataComplete EnableRawStates = new JoinDataComplete(new JoinData() { JoinNumber = 4, JoinSpan = 1 }, + new JoinMetadata() { Label = "Occ Sensor Enable Raw", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("RoomOccupiedFeedback")] + public JoinDataComplete RoomOccupiedFeedback = new JoinDataComplete(new JoinData() { JoinNumber = 2, JoinSpan = 1 }, + new JoinMetadata() { Label = "Occ Sensor Room Is Occupied", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("GraceOccupancyDetectedFeedback")] + public JoinDataComplete GraceOccupancyDetectedFeedback = new JoinDataComplete(new JoinData() { JoinNumber = 3, JoinSpan = 1 }, + new JoinMetadata() { Label = "Occ Sensor Grace Occupancy Detected", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("RoomVacantFeedback")] + public JoinDataComplete RoomVacantFeedback = new JoinDataComplete(new JoinData() { JoinNumber = 4, JoinSpan = 1 }, + new JoinMetadata() { Label = "Occ Sensor Room Is Vacant", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("RawOccupancyFeedback")] + public JoinDataComplete RawOccupancyFeedback = new JoinDataComplete(new JoinData() { JoinNumber = 5, JoinSpan = 1 }, + new JoinMetadata() { Label = "Occ Sensor Raw Occupancy Detected", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("RawOccupancyPirFeedback")] + public JoinDataComplete RawOccupancyPirFeedback = new JoinDataComplete(new JoinData() { JoinNumber = 6, JoinSpan = 1 }, + new JoinMetadata() { Label = "Occ Sensor Raw PIR Occupancy Detected", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("RawOccupancyUsFeedback")] + public JoinDataComplete RawOccupancyUsFeedback = new JoinDataComplete(new JoinData() { JoinNumber = 7, JoinSpan = 1 }, + new JoinMetadata() { Label = "Occ Sensor Raw US Occupancy Detected", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("EnableLedFlash")] + public JoinDataComplete EnableLedFlash = new JoinDataComplete(new JoinData() { JoinNumber = 11, JoinSpan = 1 }, + new JoinMetadata() { Label = "Occ Sensor Enable LED Flash", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("DisableLedFlash")] + public JoinDataComplete DisableLedFlash = new JoinDataComplete(new JoinData() { JoinNumber = 12, JoinSpan = 1 }, + new JoinMetadata() { Label = "Occ Sensor Disable LED Flash", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("EnableShortTimeout")] + public JoinDataComplete EnableShortTimeout = new JoinDataComplete(new JoinData() { JoinNumber = 13, JoinSpan = 1 }, + new JoinMetadata() { Label = "Occ Sensor Enable Short Timeout", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("DisableShortTimeout")] + public JoinDataComplete DisableShortTimeout = new JoinDataComplete(new JoinData() { JoinNumber = 14, JoinSpan = 1 }, + new JoinMetadata() { Label = "Occ Sensor Disable Short Timeout", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("OrWhenVacated")] + public JoinDataComplete OrWhenVacated = new JoinDataComplete(new JoinData() { JoinNumber = 15, JoinSpan = 1 }, + new JoinMetadata() { Label = "Occ Sensor Set To Vacant when Either Sensor is Vacant", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("AndWhenVacated")] + public JoinDataComplete AndWhenVacated = new JoinDataComplete(new JoinData() { JoinNumber = 16, JoinSpan = 1 }, + new JoinMetadata() { Label = "Occ Sensor Set To Vacant when Both Sensors are Vacant", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("EnableUsA")] + public JoinDataComplete EnableUsA = new JoinDataComplete(new JoinData() { JoinNumber = 17, JoinSpan = 1 }, + new JoinMetadata() { Label = "Occ Sensor Enable Ultrasonic Sensor A", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("DisableUsA")] + public JoinDataComplete DisableUsA = new JoinDataComplete(new JoinData() { JoinNumber = 18, JoinSpan = 1 }, + new JoinMetadata() { Label = "Occ Sensor Disable Ultrasonic Sensor A", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("EnableUsB")] + public JoinDataComplete EnableUsB = new JoinDataComplete(new JoinData() { JoinNumber = 19, JoinSpan = 1 }, + new JoinMetadata() { Label = "Occ Sensor Enable Ultrasonic Sensor B", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("DisableUsB")] + public JoinDataComplete DisableUsB = new JoinDataComplete(new JoinData() { JoinNumber = 20, JoinSpan = 1 }, + new JoinMetadata() { Label = "Occ Sensor Disable Ultrasonic Sensor B", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("EnablePir")] + public JoinDataComplete EnablePir = new JoinDataComplete(new JoinData() { JoinNumber = 21, JoinSpan = 1 }, + new JoinMetadata() { Label = "Occ Sensor Enable IR Sensor", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("DisablePir")] + public JoinDataComplete DisablePir = new JoinDataComplete(new JoinData() { JoinNumber = 22, JoinSpan = 1 }, + new JoinMetadata() { Label = "Occ Sensor Disable IR Sensor", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("IncrementUsInOccupiedState")] + public JoinDataComplete IncrementUsInOccupiedState = new JoinDataComplete(new JoinData() { JoinNumber = 23, JoinSpan = 1 }, + new JoinMetadata() { Label = "Occ Sensor Increment US Occupied State Sensitivity", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("DecrementUsInOccupiedState")] + public JoinDataComplete DecrementUsInOccupiedState = new JoinDataComplete(new JoinData() { JoinNumber = 24, JoinSpan = 1 }, + new JoinMetadata() { Label = "Occ Sensor Decrement US Occupied State Sensitivity", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("IncrementUsInVacantState")] + public JoinDataComplete IncrementUsInVacantState = new JoinDataComplete(new JoinData() { JoinNumber = 25, JoinSpan = 1 }, + new JoinMetadata() { Label = "Occ Sensor Increment US Vacant State Sensitivity", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("DecrementUsInVacantState")] + public JoinDataComplete DecrementUsInVacantState = new JoinDataComplete(new JoinData() { JoinNumber = 26, JoinSpan = 1 }, + new JoinMetadata() { Label = "Occ Sensor Decrement US Vacant State Sensitivity", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("IncrementPirInOccupiedState")] + public JoinDataComplete IncrementPirInOccupiedState = new JoinDataComplete(new JoinData() { JoinNumber = 27, JoinSpan = 1 }, + new JoinMetadata() { Label = "Occ Sensor Increment IR Occupied State Sensitivity", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("DecrementPirInOccupiedState")] + public JoinDataComplete DecrementPirInOccupiedState = new JoinDataComplete(new JoinData() { JoinNumber = 28, JoinSpan = 1 }, + new JoinMetadata() { Label = "Occ Sensor Decrement IR Occupied State Sensitivity", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("IncrementPirInVacantState")] + public JoinDataComplete IncrementPirInVacantState = new JoinDataComplete(new JoinData() { JoinNumber = 29, JoinSpan = 1 }, + new JoinMetadata() { Label = "Occ Sensor Increment IR Vacant State Sensitivity", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("DecrementPirInVacantState")] + public JoinDataComplete DecrementPirInVacantState = new JoinDataComplete(new JoinData() { JoinNumber = 30, JoinSpan = 1 }, + new JoinMetadata() { Label = "Occ Sensor Decrement IR Vacant State Sensitivity", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Timeout")] + public JoinDataComplete Timeout = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "Occ Sensor Timeout Value", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("TimeoutLocalFeedback")] + public JoinDataComplete TimeoutLocalFeedback = new JoinDataComplete(new JoinData() { JoinNumber = 2, JoinSpan = 1 }, + new JoinMetadata() { Label = "Occ Sensor Local Timeout Value", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("InternalPhotoSensorValue")] + public JoinDataComplete InternalPhotoSensorValue = new JoinDataComplete(new JoinData() { JoinNumber = 3, JoinSpan = 1 }, + new JoinMetadata() { Label = "Occ Sensor Internal PhotoSensor Value", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("ExternalPhotoSensorValue")] + public JoinDataComplete ExternalPhotoSensorValue = new JoinDataComplete(new JoinData() { JoinNumber = 4, JoinSpan = 1 }, + new JoinMetadata() { Label = "Occ Sensor External PhotoSensor Value", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("UsSensitivityInOccupiedState")] + public JoinDataComplete UsSensitivityInOccupiedState = new JoinDataComplete(new JoinData() { JoinNumber = 5, JoinSpan = 1 }, + new JoinMetadata() { Label = "Occ Sensor Ultrasonic Sensitivity in Occupied State", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("UsSensitivityInVacantState")] + public JoinDataComplete UsSensitivityInVacantState = new JoinDataComplete(new JoinData() { JoinNumber = 6, JoinSpan = 1 }, + new JoinMetadata() { Label = "Occ Sensor Ultrasonic Sensitivity in Vacant State", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("PirSensitivityInOccupiedState")] + public JoinDataComplete PirSensitivityInOccupiedState = new JoinDataComplete(new JoinData() { JoinNumber = 7, JoinSpan = 1 }, + new JoinMetadata() { Label = "Occ Sensor PIR Sensitivity in Occupied State", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("PirSensitivityInVacantState")] + public JoinDataComplete PirSensitivityInVacantState = new JoinDataComplete(new JoinData() { JoinNumber = 8, JoinSpan = 1 }, + new JoinMetadata() { Label = "Occ Sensor Ultrasonic Sensitivity in Vacant State", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("Name")] + public JoinDataComplete Name = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "Occ Sensor Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + + + public GlsOccupancySensorBaseJoinMap(uint joinStart) + : base(joinStart, typeof(GlsOccupancySensorBaseJoinMap)) + { + } + + } +} diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOccupancySensorBaseController.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOccupancySensorBaseController.cs index 18bdb1be..52194927 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOccupancySensorBaseController.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOccupancySensorBaseController.cs @@ -259,104 +259,102 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy protected void LinkOccSensorToApi(GlsOccupancySensorBaseController occController, BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) - { - var joinMap = new GlsOccupancySensorBaseJoinMap(); + { + var joinMap = new GlsOccupancySensorBaseJoinMap(joinStart); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - joinMap.OffsetJoinNumbers(joinStart); - Debug.Console(1, occController, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); #region Single and Dual Sensor Stuff - occController.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); - trilist.StringInput[joinMap.Name].StringValue = occController.Name; + occController.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]); + trilist.StringInput[joinMap.Name.JoinNumber].StringValue = occController.Name; trilist.OnlineStatusChange += (d, args) => { if (args.DeviceOnLine) - { - trilist.StringInput[joinMap.Name].StringValue = occController.Name; + { + trilist.StringInput[joinMap.Name.JoinNumber].StringValue = occController.Name; } }; - // Occupied status - trilist.SetSigTrueAction(joinMap.ForceOccupied, occController.ForceOccupied); - trilist.SetSigTrueAction(joinMap.ForceVacant, occController.ForceVacant); - occController.RoomIsOccupiedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RoomOccupiedFeedback]); - occController.RoomIsOccupiedFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.RoomVacantFeedback]); - occController.RawOccupancyFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyFeedback]); - trilist.SetBoolSigAction(joinMap.EnableRawStates, occController.EnableRawStates); + // Occupied status + trilist.SetSigTrueAction(joinMap.ForceOccupied.JoinNumber, occController.ForceOccupied); + trilist.SetSigTrueAction(joinMap.ForceVacant.JoinNumber, occController.ForceVacant); + occController.RoomIsOccupiedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RoomOccupiedFeedback.JoinNumber]); + occController.RoomIsOccupiedFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.RoomVacantFeedback.JoinNumber]); + occController.RawOccupancyFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyFeedback.JoinNumber]); + trilist.SetBoolSigAction(joinMap.EnableRawStates.JoinNumber, occController.EnableRawStates); - // Timouts - trilist.SetUShortSigAction(joinMap.Timeout, occController.SetRemoteTimeout); - occController.CurrentTimeoutFeedback.LinkInputSig(trilist.UShortInput[joinMap.Timeout]); - occController.LocalTimoutFeedback.LinkInputSig(trilist.UShortInput[joinMap.TimeoutLocalFeedback]); + // Timouts + trilist.SetUShortSigAction(joinMap.Timeout.JoinNumber, occController.SetRemoteTimeout); + occController.CurrentTimeoutFeedback.LinkInputSig(trilist.UShortInput[joinMap.Timeout.JoinNumber]); + occController.LocalTimoutFeedback.LinkInputSig(trilist.UShortInput[joinMap.TimeoutLocalFeedback.JoinNumber]); - // LED Flash - trilist.SetSigTrueAction(joinMap.EnableLedFlash, () => occController.SetLedFlashEnable(true)); - trilist.SetSigTrueAction(joinMap.DisableLedFlash, () => occController.SetLedFlashEnable(false)); - occController.LedFlashEnabledFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.EnableLedFlash]); + // LED Flash + trilist.SetSigTrueAction(joinMap.EnableLedFlash.JoinNumber, () => occController.SetLedFlashEnable(true)); + trilist.SetSigTrueAction(joinMap.DisableLedFlash.JoinNumber, () => occController.SetLedFlashEnable(false)); + occController.LedFlashEnabledFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.EnableLedFlash.JoinNumber]); - // Short Timeout - trilist.SetSigTrueAction(joinMap.EnableShortTimeout, () => occController.SetShortTimeoutState(true)); - trilist.SetSigTrueAction(joinMap.DisableShortTimeout, () => occController.SetShortTimeoutState(false)); - occController.ShortTimeoutEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableShortTimeout]); + // Short Timeout + trilist.SetSigTrueAction(joinMap.EnableShortTimeout.JoinNumber, () => occController.SetShortTimeoutState(true)); + trilist.SetSigTrueAction(joinMap.DisableShortTimeout.JoinNumber, () => occController.SetShortTimeoutState(false)); + occController.ShortTimeoutEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableShortTimeout.JoinNumber]); - // PIR Sensor - trilist.SetSigTrueAction(joinMap.EnablePir, () => occController.SetPirEnable(true)); - trilist.SetSigTrueAction(joinMap.DisablePir, () => occController.SetPirEnable(false)); - occController.PirSensorEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnablePir]); + // PIR Sensor + trilist.SetSigTrueAction(joinMap.EnablePir.JoinNumber, () => occController.SetPirEnable(true)); + trilist.SetSigTrueAction(joinMap.DisablePir.JoinNumber, () => occController.SetPirEnable(false)); + occController.PirSensorEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnablePir.JoinNumber]); - // PIR Sensitivity in Occupied State - trilist.SetBoolSigAction(joinMap.IncrementPirInOccupiedState, occController.IncrementPirSensitivityInOccupiedState); - trilist.SetBoolSigAction(joinMap.DecrementPirInOccupiedState, occController.DecrementPirSensitivityInOccupiedState); - occController.PirSensitivityInOccupiedStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.PirSensitivityInOccupiedState]); + // PIR Sensitivity in Occupied State + trilist.SetBoolSigAction(joinMap.IncrementPirInOccupiedState.JoinNumber, occController.IncrementPirSensitivityInOccupiedState); + trilist.SetBoolSigAction(joinMap.DecrementPirInOccupiedState.JoinNumber, occController.DecrementPirSensitivityInOccupiedState); + occController.PirSensitivityInOccupiedStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.PirSensitivityInOccupiedState.JoinNumber]); - // PIR Sensitivity in Vacant State - trilist.SetBoolSigAction(joinMap.IncrementPirInVacantState, occController.IncrementPirSensitivityInVacantState); - trilist.SetBoolSigAction(joinMap.DecrementPirInVacantState, occController.DecrementPirSensitivityInVacantState); - occController.PirSensitivityInVacantStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.PirSensitivityInVacantState]); + // PIR Sensitivity in Vacant State + trilist.SetBoolSigAction(joinMap.IncrementPirInVacantState.JoinNumber, occController.IncrementPirSensitivityInVacantState); + trilist.SetBoolSigAction(joinMap.DecrementPirInVacantState.JoinNumber, occController.DecrementPirSensitivityInVacantState); + occController.PirSensitivityInVacantStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.PirSensitivityInVacantState.JoinNumber]); #endregion #region Dual Technology Sensor Stuff var odtOccController = occController as GlsOdtOccupancySensorController; if (odtOccController == null) return; - // OR When Vacated - trilist.SetBoolSigAction(joinMap.OrWhenVacated, odtOccController.SetOrWhenVacatedState); - odtOccController.OrWhenVacatedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.OrWhenVacated]); + // OR When Vacated + trilist.SetBoolSigAction(joinMap.OrWhenVacated.JoinNumber, odtOccController.SetOrWhenVacatedState); + odtOccController.OrWhenVacatedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.OrWhenVacated.JoinNumber]); - // AND When Vacated - trilist.SetBoolSigAction(joinMap.AndWhenVacated, odtOccController.SetAndWhenVacatedState); - odtOccController.AndWhenVacatedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.AndWhenVacated]); + // AND When Vacated + trilist.SetBoolSigAction(joinMap.AndWhenVacated.JoinNumber, odtOccController.SetAndWhenVacatedState); + odtOccController.AndWhenVacatedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.AndWhenVacated.JoinNumber]); - // Ultrasonic A Sensor - trilist.SetSigTrueAction(joinMap.EnableUsA, () => odtOccController.SetUsAEnable(true)); - trilist.SetSigTrueAction(joinMap.DisableUsA, () => odtOccController.SetUsAEnable(false)); - odtOccController.UltrasonicAEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableUsA]); + // Ultrasonic A Sensor + trilist.SetSigTrueAction(joinMap.EnableUsA.JoinNumber, () => odtOccController.SetUsAEnable(true)); + trilist.SetSigTrueAction(joinMap.DisableUsA.JoinNumber, () => odtOccController.SetUsAEnable(false)); + odtOccController.UltrasonicAEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableUsA.JoinNumber]); - // Ultrasonic B Sensor - trilist.SetSigTrueAction(joinMap.EnableUsB, () => odtOccController.SetUsBEnable(true)); - trilist.SetSigTrueAction(joinMap.DisableUsB, () => odtOccController.SetUsBEnable(false)); - odtOccController.UltrasonicAEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableUsB]); + // Ultrasonic B Sensor + trilist.SetSigTrueAction(joinMap.EnableUsB.JoinNumber, () => odtOccController.SetUsBEnable(true)); + trilist.SetSigTrueAction(joinMap.DisableUsB.JoinNumber, () => odtOccController.SetUsBEnable(false)); + odtOccController.UltrasonicAEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableUsB.JoinNumber]); - // US Sensitivity in Occupied State - trilist.SetBoolSigAction(joinMap.IncrementUsInOccupiedState, odtOccController.IncrementUsSensitivityInOccupiedState); - trilist.SetBoolSigAction(joinMap.DecrementUsInOccupiedState, odtOccController.DecrementUsSensitivityInOccupiedState); - odtOccController.UltrasonicSensitivityInOccupiedStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.UsSensitivityInOccupiedState]); + // US Sensitivity in Occupied State + trilist.SetBoolSigAction(joinMap.IncrementUsInOccupiedState.JoinNumber, odtOccController.IncrementUsSensitivityInOccupiedState); + trilist.SetBoolSigAction(joinMap.DecrementUsInOccupiedState.JoinNumber, odtOccController.DecrementUsSensitivityInOccupiedState); + odtOccController.UltrasonicSensitivityInOccupiedStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.UsSensitivityInOccupiedState.JoinNumber]); - // US Sensitivity in Vacant State - trilist.SetBoolSigAction(joinMap.IncrementUsInVacantState, odtOccController.IncrementUsSensitivityInVacantState); - trilist.SetBoolSigAction(joinMap.DecrementUsInVacantState, odtOccController.DecrementUsSensitivityInVacantState); - odtOccController.UltrasonicSensitivityInVacantStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.UsSensitivityInVacantState]); + // US Sensitivity in Vacant State + trilist.SetBoolSigAction(joinMap.IncrementUsInVacantState.JoinNumber, odtOccController.IncrementUsSensitivityInVacantState); + trilist.SetBoolSigAction(joinMap.DecrementUsInVacantState.JoinNumber, odtOccController.DecrementUsSensitivityInVacantState); + odtOccController.UltrasonicSensitivityInVacantStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.UsSensitivityInVacantState.JoinNumber]); - //Sensor Raw States - odtOccController.RawOccupancyPirFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyPirFeedback]); - odtOccController.RawOccupancyUsFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyUsFeedback]); + //Sensor Raw States + odtOccController.RawOccupancyPirFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyPirFeedback.JoinNumber]); + odtOccController.RawOccupancyUsFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyUsFeedback.JoinNumber]); #endregion } From cde25c56e2d773cbd9f80be3bdc7e33aa2867542 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Thu, 7 May 2020 16:41:43 -0500 Subject: [PATCH 123/156] Updated MdMdxxxCEController and HdMdxxxCEControllerJoinMap --- .../JoinMaps/HdMdxxxCEControllerJoinMap.cs | 159 ++++++------------ .../DmLite/HdMdxxxCEController.cs | 57 +++---- 2 files changed, 82 insertions(+), 134 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/HdMdxxxCEControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/HdMdxxxCEControllerJoinMap.cs index d3769838..825fc946 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/HdMdxxxCEControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/HdMdxxxCEControllerJoinMap.cs @@ -7,113 +7,62 @@ using PepperDash.Essentials.Core; namespace PepperDash.Essentials.Core.Bridges { - public class HdMdxxxCEControllerJoinMap : JoinMapBase + public class HdMdxxxCEControllerJoinMap : JoinMapBaseAdvanced { - #region Digitals - /// - /// High when the pair is online - /// - public uint IsOnline { get; set; } - /// - /// High when the remote end device is online - /// - public uint RemoteEndDetected { get; set; } - - /// - /// Sets Auto Route On and provides feedback - /// - public uint AutoRouteOn { get; set; } - - /// - /// Sets Auto Route Off and provides feedback - /// - public uint AutoRouteOff { get; set; } - - /// - /// Sets Priority Routing On and provides feedback - /// - public uint PriorityRoutingOn { get; set; } - - /// - /// Sets Priority Routing Off and provides feedback - /// - public uint PriorityRoutingOff { get; set; } - - /// - /// Enables OSD and provides feedback - /// - public uint InputOnScreenDisplayEnabled { get; set; } - - /// - /// Disables OSD and provides feedback - /// - public uint InputOnScreenDisplayDisabled { get; set; } - - /// - /// Provides Video Sync Detected feedback for each input - /// - public uint SyncDetected { get; set; } - #endregion - - #region Analogs - /// - /// Sets the video source for the receiver's HDMI out and provides feedback - /// - public uint VideoSource { get; set; } - - /// - /// Indicates the number of sources supported by the Tx/Rx pair - /// - public uint SourceCount { get; set; } - #endregion - - #region Serials - /// - /// Indicates the name of each input port - /// - public uint SourceNames { get; set; } - #endregion - - public HdMdxxxCEControllerJoinMap() - { - //Digital - IsOnline = 1; - RemoteEndDetected = 2; - AutoRouteOn = 3; - AutoRouteOff = 4; - PriorityRoutingOn = 5; - PriorityRoutingOff = 6; - InputOnScreenDisplayEnabled = 7; - InputOnScreenDisplayDisabled = 8; - SyncDetected = 10; // 11-15 - - //Analog - VideoSource = 1; - SourceCount = 2; - - //Serials - SourceNames = 10; // 11-15 - } - - public override void OffsetJoinNumbers(uint joinStart) - { - var joinOffset = joinStart - 1; - - IsOnline = IsOnline + joinOffset; - RemoteEndDetected = RemoteEndDetected + joinOffset; - AutoRouteOn = AutoRouteOn + joinOffset; - AutoRouteOff = AutoRouteOff + joinOffset; - PriorityRoutingOn = PriorityRoutingOn + joinOffset; - PriorityRoutingOff = PriorityRoutingOff + joinOffset; - InputOnScreenDisplayEnabled = InputOnScreenDisplayEnabled + joinOffset; - InputOnScreenDisplayDisabled = InputOnScreenDisplayDisabled + joinOffset; - SyncDetected = SyncDetected + joinOffset; - - VideoSource = VideoSource + joinOffset; - SourceCount = SourceCount + joinOffset; - - SourceNames = SourceNames + joinOffset; + [JoinName("IsOnline")] + public JoinDataComplete IsOnline = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "Device Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("RemoteEndDetected")] + public JoinDataComplete RemoteEndDetected = new JoinDataComplete(new JoinData() { JoinNumber = 2, JoinSpan = 1 }, + new JoinMetadata() { Label = "Device Remote End Detected", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("AutoRouteOn")] + public JoinDataComplete AutoRouteOn = new JoinDataComplete(new JoinData() { JoinNumber = 3, JoinSpan = 1 }, + new JoinMetadata() { Label = "Device Auto Route On", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("AutoRouteOff")] + public JoinDataComplete AutoRouteOff = new JoinDataComplete(new JoinData() { JoinNumber = 4, JoinSpan = 1 }, + new JoinMetadata() { Label = "Device Auto Route Off", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("PriorityRoutingOn")] + public JoinDataComplete PriorityRoutingOn = new JoinDataComplete(new JoinData() { JoinNumber = 5, JoinSpan = 1 }, + new JoinMetadata() { Label = "Device Priority Routing On", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("PriorityRoutingOff")] + public JoinDataComplete PriorityRoutingOff = new JoinDataComplete(new JoinData() { JoinNumber = 6, JoinSpan = 1 }, + new JoinMetadata() { Label = "Device Priority Routing Off", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("InputOnScreenDisplayEnabled")] + public JoinDataComplete InputOnScreenDisplayEnabled = new JoinDataComplete(new JoinData() { JoinNumber = 7, JoinSpan = 1 }, + new JoinMetadata() { Label = "Device Input OSD Enabled", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("InputOnScreenDisplayDisabled")] + public JoinDataComplete InputOnScreenDisplayDisabled = new JoinDataComplete(new JoinData() { JoinNumber = 8, JoinSpan = 1 }, + new JoinMetadata() { Label = "Device Input OSD Disabled", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("SyncDetected")] + public JoinDataComplete SyncDetected = new JoinDataComplete(new JoinData() { JoinNumber = 11, JoinSpan = 5 }, + new JoinMetadata() { Label = "Device Sync Detected", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("VideoSource")] + public JoinDataComplete VideoSource = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 5 }, + new JoinMetadata() { Label = "Device Video Source Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("SourceCount")] + public JoinDataComplete SourceCount = new JoinDataComplete(new JoinData() { JoinNumber = 2, JoinSpan = 5 }, + new JoinMetadata() { Label = "Device Video Source Count", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("SourceNames")] + public JoinDataComplete SourceNames = new JoinDataComplete(new JoinData() { JoinNumber = 11, JoinSpan = 5 }, + new JoinMetadata() { Label = "Device Video Source Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + + + public HdMdxxxCEControllerJoinMap(uint joinStart) + : base(joinStart, typeof(HdMdxxxCEControllerJoinMap)) + { } } } \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/DmLite/HdMdxxxCEController.cs b/essentials-framework/Essentials DM/Essentials_DM/DmLite/HdMdxxxCEController.cs index 59a318cd..94af8bc9 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/DmLite/HdMdxxxCEController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/DmLite/HdMdxxxCEController.cs @@ -222,46 +222,45 @@ namespace PepperDash.Essentials.DM //public int NumberOfComPorts { get { return 1; } } //#endregion public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) - { - var joinMap = new HdMdxxxCEControllerJoinMap(); + { + var joinMap = new HdMdxxxCEControllerJoinMap(joinStart); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - joinMap.OffsetJoinNumbers(joinStart); - Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); - IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); - RemoteEndDetectedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RemoteEndDetected]); - - trilist.SetSigTrueAction(joinMap.AutoRouteOn, AutoRouteOn); - AutoRouteOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.AutoRouteOn]); - trilist.SetSigTrueAction(joinMap.AutoRouteOff, AutoRouteOff); - AutoRouteOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.AutoRouteOff]); - - trilist.SetSigTrueAction(joinMap.PriorityRoutingOn, PriorityRouteOn); - PriorityRoutingOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PriorityRoutingOn]); - trilist.SetSigTrueAction(joinMap.PriorityRoutingOff, PriorityRouteOff); - PriorityRoutingOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.PriorityRoutingOff]); - - trilist.SetSigTrueAction(joinMap.InputOnScreenDisplayEnabled, OnScreenDisplayEnable); - InputOnScreenDisplayEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.InputOnScreenDisplayEnabled]); - trilist.SetSigTrueAction(joinMap.AutoRouteOff, OnScreenDisplayDisable); - InputOnScreenDisplayEnabledFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.InputOnScreenDisplayDisabled]); - - trilist.SetUShortSigAction(joinMap.VideoSource, (i) => ExecuteSwitch(i, null, eRoutingSignalType.Video | eRoutingSignalType.Audio)); - VideoSourceFeedback.LinkInputSig(trilist.UShortInput[joinMap.VideoSource]); - - trilist.UShortInput[joinMap.SourceCount].UShortValue = (ushort)InputPorts.Count; + IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]); + RemoteEndDetectedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RemoteEndDetected.JoinNumber]); + + trilist.SetSigTrueAction(joinMap.AutoRouteOn.JoinNumber, AutoRouteOn); + AutoRouteOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.AutoRouteOn.JoinNumber]); + trilist.SetSigTrueAction(joinMap.AutoRouteOff.JoinNumber, AutoRouteOff); + AutoRouteOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.AutoRouteOff.JoinNumber]); + + trilist.SetSigTrueAction(joinMap.PriorityRoutingOn.JoinNumber, PriorityRouteOn); + PriorityRoutingOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PriorityRoutingOn.JoinNumber]); + trilist.SetSigTrueAction(joinMap.PriorityRoutingOff.JoinNumber, PriorityRouteOff); + PriorityRoutingOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.PriorityRoutingOff.JoinNumber]); + + trilist.SetSigTrueAction(joinMap.InputOnScreenDisplayEnabled.JoinNumber, OnScreenDisplayEnable); + InputOnScreenDisplayEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.InputOnScreenDisplayEnabled.JoinNumber]); + trilist.SetSigTrueAction(joinMap.AutoRouteOff.JoinNumber, OnScreenDisplayDisable); + InputOnScreenDisplayEnabledFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.InputOnScreenDisplayDisabled.JoinNumber]); + + trilist.SetUShortSigAction(joinMap.VideoSource.JoinNumber, (i) => ExecuteSwitch(i, null, eRoutingSignalType.Video | eRoutingSignalType.Audio)); + VideoSourceFeedback.LinkInputSig(trilist.UShortInput[joinMap.VideoSource.JoinNumber]); + + trilist.UShortInput[joinMap.SourceCount.JoinNumber].UShortValue = (ushort)InputPorts.Count; foreach (var input in InputPorts) { - var number = Convert.ToUInt16(input.Selector); - SyncDetectedFeedbacks[number].LinkInputSig(trilist.BooleanInput[joinMap.SyncDetected + number]); - trilist.StringInput[joinMap.SourceNames + number].StringValue = input.Key; + var number = Convert.ToUInt16(input.Selector); + var numberJoin = (UInt16)(number - 1); + SyncDetectedFeedbacks[number].LinkInputSig(trilist.BooleanInput[joinMap.SyncDetected.JoinNumber + numberJoin]); + trilist.StringInput[joinMap.SourceNames.JoinNumber + numberJoin].StringValue = input.Key; } } } From 1d47a60695a962789c8ef3ec22c6828e61c2c66e Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Thu, 7 May 2020 16:44:35 -0500 Subject: [PATCH 124/156] Updated GenericDigitalInputDevice IDigitalInputJoinMap --- .../Bridges/JoinMaps/IDigitalInputJoinMap.cs | 26 +++++++------------ .../Inputs/GenericDigitalInputDevice.cs | 8 +++--- 2 files changed, 12 insertions(+), 22 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/IDigitalInputJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/IDigitalInputJoinMap.cs index ba9bcc0f..a9e4ca6b 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/IDigitalInputJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/IDigitalInputJoinMap.cs @@ -7,25 +7,17 @@ using PepperDash.Essentials.Core; namespace PepperDash.Essentials.Core.Bridges { - public class IDigitalInputJoinMap : JoinMapBase + public class IDigitalInputJoinMap : JoinMapBaseAdvanced { - #region Digitals - /// - /// Reports the state of the digital input - /// - public uint InputState { get; set; } - #endregion - public IDigitalInputJoinMap() - { - InputState = 1; - } - - public override void OffsetJoinNumbers(uint joinStart) - { - var joinOffset = joinStart - 1; - - InputState = InputState + joinOffset; + [JoinName("InputState")] + public JoinDataComplete InputState = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "Room Email Url", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + + public IDigitalInputJoinMap(uint joinStart) + : base(joinStart, typeof(IDigitalInputJoinMap)) + { } } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericDigitalInputDevice.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericDigitalInputDevice.cs index 3d3383e9..542bd8a6 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericDigitalInputDevice.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericDigitalInputDevice.cs @@ -44,22 +44,20 @@ namespace PepperDash.Essentials.Core.CrestronIO } public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) - { - var joinMap = new IDigitalInputJoinMap(); + { + var joinMap = new IDigitalInputJoinMap(joinStart); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - joinMap.OffsetJoinNumbers(joinStart); - try { Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); // Link feedback for input state - InputStateFeedback.LinkInputSig(trilist.BooleanInput[joinMap.InputState]); + InputStateFeedback.LinkInputSig(trilist.BooleanInput[joinMap.InputState.JoinNumber]); } catch (Exception e) { From 99c4dc2266b09b0ef0fb7b9e9ad30c31b462912d Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Thu, 7 May 2020 17:14:48 -0500 Subject: [PATCH 125/156] Updated IRSetTopBoxBase and SetTopBoxControllerJoinMap --- .../JoinMaps/SetTopBoxControllerJoinMap.cs | 417 +++++++++--------- .../SetTopBox/IRSetTopBoxBase.cs | 112 +++-- 2 files changed, 274 insertions(+), 255 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/SetTopBoxControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/SetTopBoxControllerJoinMap.cs index dc634ab3..d2058a2d 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/SetTopBoxControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/SetTopBoxControllerJoinMap.cs @@ -9,204 +9,225 @@ using Crestron.SimplSharp.Reflection; namespace PepperDash.Essentials.Core.Bridges { - public class SetTopBoxControllerJoinMap : JoinMapBase + public class SetTopBoxControllerJoinMap : JoinMapBaseAdvanced { - #region Digitals - public uint DvrList { get; set; } // - public uint Replay { get; set; } - public uint Up { get; set; } // - public uint Down { get; set; } // - public uint Left { get; set; } // - public uint Right { get; set; } // - public uint Select { get; set; } // - public uint Menu { get; set; } // - public uint Exit { get; set; } // - public uint Digit0 { get; set; } // - public uint Digit1 { get; set; } // - public uint Digit2 { get; set; } // - public uint Digit3 { get; set; } // - public uint Digit4 { get; set; } // - public uint Digit5 { get; set; } // - public uint Digit6 { get; set; } // - public uint Digit7 { get; set; } // - public uint Digit8 { get; set; } // - public uint Digit9 { get; set; } // - public uint Dash { get; set; } // - public uint KeypadEnter { get; set; } // - public uint ChannelUp { get; set; } // - public uint ChannelDown { get; set; } // - public uint LastChannel { get; set; } // - public uint Guide { get; set; } // - public uint Info { get; set; } // - public uint Red { get; set; } // - public uint Green { get; set; } // - public uint Yellow { get; set; } // - public uint Blue { get; set; } // - public uint ChapMinus { get; set; } - public uint ChapPlus { get; set; } - public uint FFwd { get; set; } // - public uint Pause { get; set; } // - public uint Play { get; set; } // - public uint Record { get; set; } - public uint Rewind { get; set; } // - public uint Stop { get; set; } // - - public uint PowerOn { get; set; } // - public uint PowerOff { get; set; } // - public uint PowerToggle { get; set; } // - - public uint HasKeypadAccessoryButton1 { get; set; } - public uint HasKeypadAccessoryButton2 { get; set; } - - public uint KeypadAccessoryButton1Press { get; set; } - public uint KeypadAccessoryButton2Press { get; set; } - - - public uint HasDvr { get; set; } - public uint HasPresets { get; set; } - public uint HasNumeric { get; set; } - public uint HasDpad { get; set; } - - - #endregion - - #region Analogs - - #endregion - - #region Strings - public uint Name { get; set; } - public uint LoadPresets { get; set; } - public uint KeypadAccessoryButton1Label { get; set; } - public uint KeypadAccessoryButton2Label { get; set; } - - #endregion - - public SetTopBoxControllerJoinMap() - { - PowerOn = 1; - PowerOff = 2; - PowerToggle = 3; - - HasDpad = 4; - Up = 4; - Down = 5; - Left = 6; - Right = 7; - Select = 8; - Menu = 9; - Exit = 10; - - HasNumeric = 11; - Digit0 = 11; - Digit1 = 12; - Digit2 = 13; - Digit3 = 14; - Digit4 = 15; - Digit5 = 16; - Digit6 = 17; - Digit7 = 18; - Digit8 = 19; - Digit9 = 20; - Dash = 21; - KeypadEnter = 22; - ChannelUp = 23; - ChannelDown = 24; - LastChannel = 25; - - Guide = 26; - Info = 27; - Red = 28; - Green = 29; - Yellow = 30; - Blue = 31; - - HasDvr = 32; - DvrList = 32; - Play = 33; - Pause = 34; - Stop = 35; - FFwd = 36; - Rewind = 37; - ChapPlus = 38; - ChapMinus = 39; - Replay = 40; - Record = 41; - HasKeypadAccessoryButton1 = 42; - KeypadAccessoryButton1Press = 42; - HasKeypadAccessoryButton2 = 43; - KeypadAccessoryButton2Press = 43; - - Name = 1; - KeypadAccessoryButton1Label = 42; - KeypadAccessoryButton2Label = 43; - - LoadPresets = 50; - } - - public override void OffsetJoinNumbers(uint joinStart) - { - var joinOffset = joinStart - 1; - - PowerOn += joinOffset; - PowerOff += joinOffset; - PowerToggle += joinOffset; - - HasDpad += joinOffset; - Up += joinOffset; - Down += joinOffset; - Left += joinOffset; - Right += joinOffset; - Select += joinOffset; - Menu += joinOffset; - Exit += joinOffset; - - HasNumeric += joinOffset; - Digit0 += joinOffset; - Digit1 += joinOffset; - Digit2 += joinOffset; - Digit3 += joinOffset; - Digit4 += joinOffset; - Digit5 += joinOffset; - Digit6 += joinOffset; - Digit7 += joinOffset; - Digit8 += joinOffset; - Digit9 += joinOffset; - Dash += joinOffset; - KeypadEnter += joinOffset; - ChannelUp += joinOffset; - ChannelDown += joinOffset; - LastChannel += joinOffset; - - Guide += joinOffset; - Info += joinOffset; - Red += joinOffset; - Green += joinOffset; - Yellow += joinOffset; - Blue += joinOffset; - - HasDvr += joinOffset; - DvrList += joinOffset; - Play += joinOffset; - Pause += joinOffset; - Stop += joinOffset; - FFwd += joinOffset; - Rewind += joinOffset; - ChapPlus += joinOffset; - ChapMinus += joinOffset; - Replay += joinOffset; - Record += joinOffset; - HasKeypadAccessoryButton1 += joinOffset; - KeypadAccessoryButton1Press += joinOffset; - HasKeypadAccessoryButton2 += joinOffset; - KeypadAccessoryButton2Press += joinOffset; - - Name += joinOffset; - KeypadAccessoryButton1Label += joinOffset; - KeypadAccessoryButton2Label += joinOffset; - - LoadPresets += joinOffset; - } - + [JoinName("PowerOn")] + public JoinDataComplete PowerOn = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "STB Power On", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("PowerOff")] + public JoinDataComplete PowerOff = new JoinDataComplete(new JoinData() { JoinNumber = 2, JoinSpan = 1 }, + new JoinMetadata() { Label = "STB Power Off", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("PowerToggle")] + public JoinDataComplete PowerToggle = new JoinDataComplete(new JoinData() { JoinNumber = 3, JoinSpan = 1 }, + new JoinMetadata() { Label = "STB Power Toggle", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("HasDpad")] + public JoinDataComplete HasDpad = new JoinDataComplete(new JoinData() { JoinNumber = 4, JoinSpan = 1 }, + new JoinMetadata() { Label = "STB Has DPad", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Up")] + public JoinDataComplete Up = new JoinDataComplete(new JoinData() { JoinNumber = 4, JoinSpan = 1 }, + new JoinMetadata() { Label = "STB Nav Up", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Down")] + public JoinDataComplete Down = new JoinDataComplete(new JoinData() { JoinNumber = 5, JoinSpan = 1 }, + new JoinMetadata() { Label = "STB Nav Down", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Left")] + public JoinDataComplete Left = new JoinDataComplete(new JoinData() { JoinNumber = 6, JoinSpan = 1 }, + new JoinMetadata() { Label = "STB Nav Left", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Right")] + public JoinDataComplete Right = new JoinDataComplete(new JoinData() { JoinNumber = 7, JoinSpan = 1 }, + new JoinMetadata() { Label = "STB Nav Right", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Select")] + public JoinDataComplete Select = new JoinDataComplete(new JoinData() { JoinNumber = 8, JoinSpan = 1 }, + new JoinMetadata() { Label = "STB Select", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Menu")] + public JoinDataComplete Menu = new JoinDataComplete(new JoinData() { JoinNumber = 9, JoinSpan = 1 }, + new JoinMetadata() { Label = "STB Menu", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Exit")] + public JoinDataComplete Exit = new JoinDataComplete(new JoinData() { JoinNumber = 10, JoinSpan = 1 }, + new JoinMetadata() { Label = "STB Exit", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("HasNumeric")] + public JoinDataComplete HasNumeric = new JoinDataComplete(new JoinData() { JoinNumber = 11, JoinSpan = 1 }, + new JoinMetadata() { Label = "STB Has Numeric", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Digit0")] + public JoinDataComplete Digit0 = new JoinDataComplete(new JoinData() { JoinNumber = 11, JoinSpan = 1 }, + new JoinMetadata() { Label = "STB Digit 0", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Digit1")] + public JoinDataComplete Digit1 = new JoinDataComplete(new JoinData() { JoinNumber = 12, JoinSpan = 1 }, + new JoinMetadata() { Label = "STB Digit 1", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Digit2")] + public JoinDataComplete Digit2 = new JoinDataComplete(new JoinData() { JoinNumber = 13, JoinSpan = 1 }, + new JoinMetadata() { Label = "STB Digit 2", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Digit3")] + public JoinDataComplete Digit3 = new JoinDataComplete(new JoinData() { JoinNumber = 14, JoinSpan = 1 }, + new JoinMetadata() { Label = "STB Digit 3", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Digit4")] + public JoinDataComplete Digit4 = new JoinDataComplete(new JoinData() { JoinNumber = 15, JoinSpan = 1 }, + new JoinMetadata() { Label = "STB Digit 4", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Digit5")] + public JoinDataComplete Digit5 = new JoinDataComplete(new JoinData() { JoinNumber = 16, JoinSpan = 1 }, + new JoinMetadata() { Label = "STB Digit 5", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Digit6")] + public JoinDataComplete Digit6 = new JoinDataComplete(new JoinData() { JoinNumber = 17, JoinSpan = 1 }, + new JoinMetadata() { Label = "STB Digit 6", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Digit7")] + public JoinDataComplete Digit7 = new JoinDataComplete(new JoinData() { JoinNumber = 18, JoinSpan = 1 }, + new JoinMetadata() { Label = "STB Digit 7", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Digit8")] + public JoinDataComplete Digit8 = new JoinDataComplete(new JoinData() { JoinNumber = 19, JoinSpan = 1 }, + new JoinMetadata() { Label = "STB Digit 8", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Digit9")] + public JoinDataComplete Digit9 = new JoinDataComplete(new JoinData() { JoinNumber = 20, JoinSpan = 1 }, + new JoinMetadata() { Label = "STB Digit 9", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Dash")] + public JoinDataComplete Dash = new JoinDataComplete(new JoinData() { JoinNumber = 21, JoinSpan = 1 }, + new JoinMetadata() { Label = "STB Dash", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("KeypadEnter")] + public JoinDataComplete KeypadEnter = new JoinDataComplete(new JoinData() { JoinNumber = 22, JoinSpan = 1 }, + new JoinMetadata() { Label = "STB Keypad Enter", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("ChannelUp")] + public JoinDataComplete ChannelUp = new JoinDataComplete(new JoinData() { JoinNumber = 23, JoinSpan = 1 }, + new JoinMetadata() { Label = "STB Channel Up", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("ChannelDown")] + public JoinDataComplete ChannelDown = new JoinDataComplete(new JoinData() { JoinNumber = 24, JoinSpan = 1 }, + new JoinMetadata() { Label = "STB Channel Down", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("LastChannel")] + public JoinDataComplete LastChannel = new JoinDataComplete(new JoinData() { JoinNumber = 25, JoinSpan = 1 }, + new JoinMetadata() { Label = "STB Last Channel", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Guide")] + public JoinDataComplete Guide = new JoinDataComplete(new JoinData() { JoinNumber = 26, JoinSpan = 1 }, + new JoinMetadata() { Label = "STB Guide", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Info")] + public JoinDataComplete Info = new JoinDataComplete(new JoinData() { JoinNumber = 27, JoinSpan = 1 }, + new JoinMetadata() { Label = "STB Info", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Red")] + public JoinDataComplete Red = new JoinDataComplete(new JoinData() { JoinNumber = 28, JoinSpan = 1 }, + new JoinMetadata() { Label = "STB Red", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Green")] + public JoinDataComplete Green = new JoinDataComplete(new JoinData() { JoinNumber = 29, JoinSpan = 1 }, + new JoinMetadata() { Label = "STB Green", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Yellow")] + public JoinDataComplete Yellow = new JoinDataComplete(new JoinData() { JoinNumber = 30, JoinSpan = 1 }, + new JoinMetadata() { Label = "STB Yellow", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Blue")] + public JoinDataComplete Blue = new JoinDataComplete(new JoinData() { JoinNumber = 31, JoinSpan = 1 }, + new JoinMetadata() { Label = "STB Blue", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("HasDvr")] + public JoinDataComplete HasDvr = new JoinDataComplete(new JoinData() { JoinNumber = 32, JoinSpan = 1 }, + new JoinMetadata() { Label = "STB Has DVR", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("DvrList")] + public JoinDataComplete DvrList = new JoinDataComplete(new JoinData() { JoinNumber = 32, JoinSpan = 1 }, + new JoinMetadata() { Label = "STB DvrList", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Play")] + public JoinDataComplete Play = new JoinDataComplete(new JoinData() { JoinNumber = 33, JoinSpan = 1 }, + new JoinMetadata() { Label = "STB Play", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Pause")] + public JoinDataComplete Pause = new JoinDataComplete(new JoinData() { JoinNumber = 34, JoinSpan = 1 }, + new JoinMetadata() { Label = "STB Pause", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Stop")] + public JoinDataComplete Stop = new JoinDataComplete(new JoinData() { JoinNumber = 35, JoinSpan = 1 }, + new JoinMetadata() { Label = "STB Stop", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("FFwd")] + public JoinDataComplete FFwd = new JoinDataComplete(new JoinData() { JoinNumber = 36, JoinSpan = 1 }, + new JoinMetadata() { Label = "STB FFwd", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Rewind")] + public JoinDataComplete Rewind = new JoinDataComplete(new JoinData() { JoinNumber = 37, JoinSpan = 1 }, + new JoinMetadata() { Label = "STB Rewind", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("ChapPlus")] + public JoinDataComplete ChapPlus = new JoinDataComplete(new JoinData() { JoinNumber = 38, JoinSpan = 1 }, + new JoinMetadata() { Label = "STB Chapter Plus", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("ChapMinus")] + public JoinDataComplete ChapMinus = new JoinDataComplete(new JoinData() { JoinNumber = 39, JoinSpan = 1 }, + new JoinMetadata() { Label = "STB Chapter Minus", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Replay")] + public JoinDataComplete Replay = new JoinDataComplete(new JoinData() { JoinNumber = 40, JoinSpan = 1 }, + new JoinMetadata() { Label = "STB Replay", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Record")] + public JoinDataComplete Record = new JoinDataComplete(new JoinData() { JoinNumber = 41, JoinSpan = 1 }, + new JoinMetadata() { Label = "STB Record", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("HasKeypadAccessoryButton1")] + public JoinDataComplete HasKeypadAccessoryButton1 = new JoinDataComplete(new JoinData() { JoinNumber = 42, JoinSpan = 1 }, + new JoinMetadata() { Label = "STB Has Keypad Accessory Button 1", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("HasKeypadAccessoryButton2")] + public JoinDataComplete HasKeypadAccessoryButton2 = new JoinDataComplete(new JoinData() { JoinNumber = 43, JoinSpan = 1 }, + new JoinMetadata() { Label = "STB Has Keypad Accessory Button 2", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("KeypadAccessoryButton1Press")] + public JoinDataComplete KeypadAccessoryButton1Press = new JoinDataComplete(new JoinData() { JoinNumber = 42, JoinSpan = 2 }, + new JoinMetadata() { Label = "STB Keypad Accessory Button 1 Press", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("KeypadAccessoryButton2Press")] + public JoinDataComplete KeypadAccessoryButton2Press = new JoinDataComplete(new JoinData() { JoinNumber = 43, JoinSpan = 2 }, + new JoinMetadata() { Label = "STB Keypad Accessory Button 2 Press", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Name")] + public JoinDataComplete Name = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "STB Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("KeypadAccessoryButton1Label")] + public JoinDataComplete KeypadAccessoryButton1Label = new JoinDataComplete(new JoinData() { JoinNumber = 42, JoinSpan = 1 }, + new JoinMetadata() { Label = "STB Keypad Accessory Button 1 Label", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("KeypadAccessoryButton2Label")] + public JoinDataComplete KeypadAccessoryButton2Label = new JoinDataComplete(new JoinData() { JoinNumber = 43, JoinSpan = 1 }, + new JoinMetadata() { Label = "STB Keypad Accessory Button 1 Label", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("LoadPresets")] + public JoinDataComplete LoadPresets = new JoinDataComplete(new JoinData() { JoinNumber = 50, JoinSpan = 1 }, + new JoinMetadata() { Label = "STB Load Presets", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("HasPresets")] + public JoinDataComplete HasPresets = new JoinDataComplete(new JoinData() { JoinNumber = 50, JoinSpan = 1 }, + new JoinMetadata() { Label = "STB Load Presets", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + + + public SetTopBoxControllerJoinMap(uint joinStart) + : base(joinStart, typeof(SetTopBoxControllerJoinMap)) + { + } } } \ No newline at end of file diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/SetTopBox/IRSetTopBoxBase.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/SetTopBox/IRSetTopBoxBase.cs index 25d17eb4..cee6178e 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/SetTopBox/IRSetTopBoxBase.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/SetTopBox/IRSetTopBoxBase.cs @@ -373,93 +373,91 @@ namespace PepperDash.Essentials.Devices.Common public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { - var joinMap = new SetTopBoxControllerJoinMap(); + var joinMap = new SetTopBoxControllerJoinMap(joinStart); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - joinMap.OffsetJoinNumbers(joinStart); - Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); Debug.Console(0, "Linking to Display: {0}", Name); - trilist.StringInput[joinMap.Name].StringValue = Name; + trilist.StringInput[joinMap.Name.JoinNumber].StringValue = Name; var stbBase = this as ISetTopBoxControls; - trilist.BooleanInput[joinMap.HasDpad].BoolValue = stbBase.HasDpad; - trilist.BooleanInput[joinMap.HasNumeric].BoolValue = stbBase.HasNumeric; - trilist.BooleanInput[joinMap.HasDvr].BoolValue = stbBase.HasDvr; - trilist.BooleanInput[joinMap.HasPresets].BoolValue = stbBase.HasPresets; + trilist.BooleanInput[joinMap.HasDpad.JoinNumber].BoolValue = stbBase.HasDpad; + trilist.BooleanInput[joinMap.HasNumeric.JoinNumber].BoolValue = stbBase.HasNumeric; + trilist.BooleanInput[joinMap.HasDvr.JoinNumber].BoolValue = stbBase.HasDvr; + trilist.BooleanInput[joinMap.HasPresets.JoinNumber].BoolValue = stbBase.HasPresets; - trilist.SetBoolSigAction(joinMap.DvrList, stbBase.DvrList); - trilist.SetBoolSigAction(joinMap.Replay, stbBase.Replay); + trilist.SetBoolSigAction(joinMap.DvrList.JoinNumber, stbBase.DvrList); + trilist.SetBoolSigAction(joinMap.Replay.JoinNumber, stbBase.Replay); - trilist.SetStringSigAction(joinMap.LoadPresets, stbBase.LoadPresets); + trilist.SetStringSigAction(joinMap.LoadPresets.JoinNumber, stbBase.LoadPresets); var stbPower = this as IPower; - trilist.SetSigTrueAction(joinMap.PowerOn, stbPower.PowerOn); - trilist.SetSigTrueAction(joinMap.PowerOff, stbPower.PowerOff); - trilist.SetSigTrueAction(joinMap.PowerToggle, stbPower.PowerToggle); + trilist.SetSigTrueAction(joinMap.PowerOn.JoinNumber, stbPower.PowerOn); + trilist.SetSigTrueAction(joinMap.PowerOff.JoinNumber, stbPower.PowerOff); + trilist.SetSigTrueAction(joinMap.PowerToggle.JoinNumber, stbPower.PowerToggle); var stbDPad = this as IDPad; - trilist.SetBoolSigAction(joinMap.Up, stbDPad.Up); - trilist.SetBoolSigAction(joinMap.Down, stbDPad.Down); - trilist.SetBoolSigAction(joinMap.Left, stbDPad.Left); - trilist.SetBoolSigAction(joinMap.Right, stbDPad.Right); - trilist.SetBoolSigAction(joinMap.Select, stbDPad.Select); - trilist.SetBoolSigAction(joinMap.Menu, stbDPad.Menu); - trilist.SetBoolSigAction(joinMap.Exit, stbDPad.Exit); + trilist.SetBoolSigAction(joinMap.Up.JoinNumber, stbDPad.Up); + trilist.SetBoolSigAction(joinMap.Down.JoinNumber, stbDPad.Down); + trilist.SetBoolSigAction(joinMap.Left.JoinNumber, stbDPad.Left); + trilist.SetBoolSigAction(joinMap.Right.JoinNumber, stbDPad.Right); + trilist.SetBoolSigAction(joinMap.Select.JoinNumber, stbDPad.Select); + trilist.SetBoolSigAction(joinMap.Menu.JoinNumber, stbDPad.Menu); + trilist.SetBoolSigAction(joinMap.Exit.JoinNumber, stbDPad.Exit); var stbChannel = this as IChannel; - trilist.SetBoolSigAction(joinMap.ChannelUp, stbChannel.ChannelUp); - trilist.SetBoolSigAction(joinMap.ChannelDown, stbChannel.ChannelDown); - trilist.SetBoolSigAction(joinMap.LastChannel, stbChannel.LastChannel); - trilist.SetBoolSigAction(joinMap.Guide, stbChannel.Guide); - trilist.SetBoolSigAction(joinMap.Info, stbChannel.Info); - trilist.SetBoolSigAction(joinMap.Exit, stbChannel.Exit); + trilist.SetBoolSigAction(joinMap.ChannelUp.JoinNumber, stbChannel.ChannelUp); + trilist.SetBoolSigAction(joinMap.ChannelDown.JoinNumber, stbChannel.ChannelDown); + trilist.SetBoolSigAction(joinMap.LastChannel.JoinNumber, stbChannel.LastChannel); + trilist.SetBoolSigAction(joinMap.Guide.JoinNumber, stbChannel.Guide); + trilist.SetBoolSigAction(joinMap.Info.JoinNumber, stbChannel.Info); + trilist.SetBoolSigAction(joinMap.Exit.JoinNumber, stbChannel.Exit); var stbColor = this as IColor; - trilist.SetBoolSigAction(joinMap.Red, stbColor.Red); - trilist.SetBoolSigAction(joinMap.Green, stbColor.Green); - trilist.SetBoolSigAction(joinMap.Yellow, stbColor.Yellow); - trilist.SetBoolSigAction(joinMap.Blue, stbColor.Blue); + trilist.SetBoolSigAction(joinMap.Red.JoinNumber, stbColor.Red); + trilist.SetBoolSigAction(joinMap.Green.JoinNumber, stbColor.Green); + trilist.SetBoolSigAction(joinMap.Yellow.JoinNumber, stbColor.Yellow); + trilist.SetBoolSigAction(joinMap.Blue.JoinNumber, stbColor.Blue); var stbKeypad = this as ISetTopBoxNumericKeypad; - trilist.StringInput[joinMap.KeypadAccessoryButton1Label].StringValue = stbKeypad.KeypadAccessoryButton1Label; - trilist.StringInput[joinMap.KeypadAccessoryButton2Label].StringValue = stbKeypad.KeypadAccessoryButton2Label; + trilist.StringInput[joinMap.KeypadAccessoryButton1Label.JoinNumber].StringValue = stbKeypad.KeypadAccessoryButton1Label; + trilist.StringInput[joinMap.KeypadAccessoryButton2Label.JoinNumber].StringValue = stbKeypad.KeypadAccessoryButton2Label; - trilist.BooleanInput[joinMap.HasKeypadAccessoryButton1].BoolValue = stbKeypad.HasKeypadAccessoryButton1; - trilist.BooleanInput[joinMap.HasKeypadAccessoryButton2].BoolValue = stbKeypad.HasKeypadAccessoryButton2; + trilist.BooleanInput[joinMap.HasKeypadAccessoryButton1.JoinNumber].BoolValue = stbKeypad.HasKeypadAccessoryButton1; + trilist.BooleanInput[joinMap.HasKeypadAccessoryButton2.JoinNumber].BoolValue = stbKeypad.HasKeypadAccessoryButton2; - trilist.SetBoolSigAction(joinMap.Digit0, stbKeypad.Digit0); - trilist.SetBoolSigAction(joinMap.Digit1, stbKeypad.Digit1); - trilist.SetBoolSigAction(joinMap.Digit2, stbKeypad.Digit2); - trilist.SetBoolSigAction(joinMap.Digit3, stbKeypad.Digit3); - trilist.SetBoolSigAction(joinMap.Digit4, stbKeypad.Digit4); - trilist.SetBoolSigAction(joinMap.Digit5, stbKeypad.Digit5); - trilist.SetBoolSigAction(joinMap.Digit6, stbKeypad.Digit6); - trilist.SetBoolSigAction(joinMap.Digit7, stbKeypad.Digit7); - trilist.SetBoolSigAction(joinMap.Digit8, stbKeypad.Digit8); - trilist.SetBoolSigAction(joinMap.Digit9, stbKeypad.Digit9); - trilist.SetBoolSigAction(joinMap.KeypadAccessoryButton1Press, stbKeypad.KeypadAccessoryButton1); - trilist.SetBoolSigAction(joinMap.KeypadAccessoryButton2Press, stbKeypad.KeypadAccessoryButton1); - trilist.SetBoolSigAction(joinMap.Dash, stbKeypad.Dash); - trilist.SetBoolSigAction(joinMap.KeypadEnter, stbKeypad.KeypadEnter); + trilist.SetBoolSigAction(joinMap.Digit0.JoinNumber, stbKeypad.Digit0); + trilist.SetBoolSigAction(joinMap.Digit1.JoinNumber, stbKeypad.Digit1); + trilist.SetBoolSigAction(joinMap.Digit2.JoinNumber, stbKeypad.Digit2); + trilist.SetBoolSigAction(joinMap.Digit3.JoinNumber, stbKeypad.Digit3); + trilist.SetBoolSigAction(joinMap.Digit4.JoinNumber, stbKeypad.Digit4); + trilist.SetBoolSigAction(joinMap.Digit5.JoinNumber, stbKeypad.Digit5); + trilist.SetBoolSigAction(joinMap.Digit6.JoinNumber, stbKeypad.Digit6); + trilist.SetBoolSigAction(joinMap.Digit7.JoinNumber, stbKeypad.Digit7); + trilist.SetBoolSigAction(joinMap.Digit8.JoinNumber, stbKeypad.Digit8); + trilist.SetBoolSigAction(joinMap.Digit9.JoinNumber, stbKeypad.Digit9); + trilist.SetBoolSigAction(joinMap.KeypadAccessoryButton1Press.JoinNumber, stbKeypad.KeypadAccessoryButton1); + trilist.SetBoolSigAction(joinMap.KeypadAccessoryButton2Press.JoinNumber, stbKeypad.KeypadAccessoryButton1); + trilist.SetBoolSigAction(joinMap.Dash.JoinNumber, stbKeypad.Dash); + trilist.SetBoolSigAction(joinMap.KeypadEnter.JoinNumber, stbKeypad.KeypadEnter); var stbTransport = this as ITransport; - trilist.SetBoolSigAction(joinMap.Play, stbTransport.Play); - trilist.SetBoolSigAction(joinMap.Pause, stbTransport.Pause); - trilist.SetBoolSigAction(joinMap.Rewind, stbTransport.Rewind); - trilist.SetBoolSigAction(joinMap.FFwd, stbTransport.FFwd); - trilist.SetBoolSigAction(joinMap.ChapMinus, stbTransport.ChapMinus); - trilist.SetBoolSigAction(joinMap.ChapPlus, stbTransport.ChapPlus); - trilist.SetBoolSigAction(joinMap.Stop, stbTransport.Stop); - trilist.SetBoolSigAction(joinMap.Record, stbTransport.Record); + trilist.SetBoolSigAction(joinMap.Play.JoinNumber, stbTransport.Play); + trilist.SetBoolSigAction(joinMap.Pause.JoinNumber, stbTransport.Pause); + trilist.SetBoolSigAction(joinMap.Rewind.JoinNumber, stbTransport.Rewind); + trilist.SetBoolSigAction(joinMap.FFwd.JoinNumber, stbTransport.FFwd); + trilist.SetBoolSigAction(joinMap.ChapMinus.JoinNumber, stbTransport.ChapMinus); + trilist.SetBoolSigAction(joinMap.ChapPlus.JoinNumber, stbTransport.ChapPlus); + trilist.SetBoolSigAction(joinMap.Stop.JoinNumber, stbTransport.Stop); + trilist.SetBoolSigAction(joinMap.Record.JoinNumber, stbTransport.Record); } } From caf5a6812b53d533507f0edf1fc89fb8dd60da87 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Thu, 7 May 2020 17:22:54 -0500 Subject: [PATCH 126/156] Updated StatusSignController and StatusSignControllerJoinMap --- .../JoinMaps/StatusSignControllerJoinMap.cs | 75 +++++++++---------- .../StatusSign/StatusSignController.cs | 58 +++++++------- 2 files changed, 65 insertions(+), 68 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/StatusSignControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/StatusSignControllerJoinMap.cs index 7efd049b..fc699c02 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/StatusSignControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/StatusSignControllerJoinMap.cs @@ -4,46 +4,45 @@ using PepperDash.Essentials.Core; namespace PepperDash.Essentials.Core.Bridges { - public class StatusSignControllerJoinMap:JoinMapBase + public class StatusSignControllerJoinMap : JoinMapBaseAdvanced { - public uint IsOnline { get; set; } - public uint Name { get; set; } - public uint RedLed { get; set; } - public uint GreenLed { get; set; } - public uint BlueLed { get; set; } - public uint RedControl { get; set; } - public uint GreenControl { get; set; } - public uint BlueControl { get; set; } - - public StatusSignControllerJoinMap() - { - //digital - IsOnline = 1; - RedControl = 2; - GreenControl = 3; - BlueControl = 4; - - //Analog - RedLed = 2; - GreenLed = 3; - BlueLed = 4; - - //string - Name = 1; - - + [JoinName("IsOnline")] + public JoinDataComplete IsOnline = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "Status Sign Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Name")] + public JoinDataComplete Name = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "Status Sign Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("RedControl")] + public JoinDataComplete RedControl = new JoinDataComplete(new JoinData() { JoinNumber = 2, JoinSpan = 1 }, + new JoinMetadata() { Label = "Status Red LED Enable / Disable", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("RedLed")] + public JoinDataComplete RedLed = new JoinDataComplete(new JoinData() { JoinNumber = 2, JoinSpan = 1 }, + new JoinMetadata() { Label = "Status Red LED Intensity", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("GreenControl")] + public JoinDataComplete GreenControl = new JoinDataComplete(new JoinData() { JoinNumber = 3, JoinSpan = 1 }, + new JoinMetadata() { Label = "Status Green LED Enable / Disable", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("GreenLed")] + public JoinDataComplete GreenLed = new JoinDataComplete(new JoinData() { JoinNumber = 3, JoinSpan = 1 }, + new JoinMetadata() { Label = "Status Green LED Intensity", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("BlueControl")] + public JoinDataComplete BlueControl = new JoinDataComplete(new JoinData() { JoinNumber = 4, JoinSpan = 1 }, + new JoinMetadata() { Label = "Status Blue LED Enable / Disable", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("BlueLed")] + public JoinDataComplete BlueLed = new JoinDataComplete(new JoinData() { JoinNumber = 4, JoinSpan = 1 }, + new JoinMetadata() { Label = "Status Blue LED Intensity", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog }); + + + public StatusSignControllerJoinMap(uint joinStart) + : base(joinStart, typeof(StatusSignControllerJoinMap)) + { } - public override void OffsetJoinNumbers(uint joinStart) - { - var joinOffset = joinStart - 1; - var properties = - GetType().GetCType().GetProperties().Where(p => p.PropertyType == typeof (uint)).ToList(); - - foreach (var propertyInfo in properties) - { - propertyInfo.SetValue(this, (uint) propertyInfo.GetValue(this, null) + joinOffset, null); - } - } } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/StatusSign/StatusSignController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/StatusSign/StatusSignController.cs index ca679bce..0582be76 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/StatusSign/StatusSignController.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/StatusSign/StatusSignController.cs @@ -110,53 +110,51 @@ namespace PepperDash.Essentials.Core.CrestronIO } public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) - { - var joinMap = new StatusSignControllerJoinMap(); + { + var joinMap = new StatusSignControllerJoinMap(joinStart); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - joinMap.OffsetJoinNumbers(joinStart); - Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); - trilist.SetBoolSigAction(joinMap.RedControl, b => EnableControl(trilist, joinMap, this)); - trilist.SetBoolSigAction(joinMap.GreenControl, b => EnableControl(trilist, joinMap, this)); - trilist.SetBoolSigAction(joinMap.BlueControl, b => EnableControl(trilist, joinMap, this)); - - trilist.SetUShortSigAction(joinMap.RedLed, u => SetColor(trilist, joinMap, this)); - trilist.SetUShortSigAction(joinMap.GreenLed, u => SetColor(trilist, joinMap, this)); - trilist.SetUShortSigAction(joinMap.BlueLed, u => SetColor(trilist, joinMap, this)); - - trilist.StringInput[joinMap.Name].StringValue = Name; - - IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); - RedLedEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RedControl]); - BlueLedEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.BlueControl]); - GreenLedEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.GreenControl]); - - RedLedBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.RedLed]); - BlueLedBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.BlueLed]); - GreenLedBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.GreenLed]); + trilist.SetBoolSigAction(joinMap.RedControl.JoinNumber, b => EnableControl(trilist, joinMap, this)); + trilist.SetBoolSigAction(joinMap.GreenControl.JoinNumber, b => EnableControl(trilist, joinMap, this)); + trilist.SetBoolSigAction(joinMap.BlueControl.JoinNumber, b => EnableControl(trilist, joinMap, this)); + + trilist.SetUShortSigAction(joinMap.RedLed.JoinNumber, u => SetColor(trilist, joinMap, this)); + trilist.SetUShortSigAction(joinMap.GreenLed.JoinNumber, u => SetColor(trilist, joinMap, this)); + trilist.SetUShortSigAction(joinMap.BlueLed.JoinNumber, u => SetColor(trilist, joinMap, this)); + + trilist.StringInput[joinMap.Name.JoinNumber].StringValue = Name; + + IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]); + RedLedEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RedControl.JoinNumber]); + BlueLedEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.BlueControl.JoinNumber]); + GreenLedEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.GreenControl.JoinNumber]); + + RedLedBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.RedLed.JoinNumber]); + BlueLedBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.BlueLed.JoinNumber]); + GreenLedBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.GreenLed.JoinNumber]); } private static void EnableControl(BasicTriList triList, StatusSignControllerJoinMap joinMap, StatusSignController device) - { - var redEnable = triList.BooleanOutput[joinMap.RedControl].BoolValue; - var greenEnable = triList.BooleanOutput[joinMap.GreenControl].BoolValue; - var blueEnable = triList.BooleanOutput[joinMap.BlueControl].BoolValue; + { + var redEnable = triList.BooleanOutput[joinMap.RedControl.JoinNumber].BoolValue; + var greenEnable = triList.BooleanOutput[joinMap.GreenControl.JoinNumber].BoolValue; + var blueEnable = triList.BooleanOutput[joinMap.BlueControl.JoinNumber].BoolValue; device.EnableLedControl(redEnable, greenEnable, blueEnable); } private static void SetColor(BasicTriList triList, StatusSignControllerJoinMap joinMap, StatusSignController device) - { - var redBrightness = triList.UShortOutput[joinMap.RedLed].UShortValue; - var greenBrightness = triList.UShortOutput[joinMap.GreenLed].UShortValue; - var blueBrightness = triList.UShortOutput[joinMap.BlueLed].UShortValue; + { + var redBrightness = triList.UShortOutput[joinMap.RedLed.JoinNumber].UShortValue; + var greenBrightness = triList.UShortOutput[joinMap.GreenLed.JoinNumber].UShortValue; + var blueBrightness = triList.UShortOutput[joinMap.BlueLed.JoinNumber].UShortValue; device.SetColor(redBrightness, greenBrightness, blueBrightness); } From 35effa5e823ddb3168302085801e49ef14b09f19 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Thu, 7 May 2020 21:18:47 -0500 Subject: [PATCH 127/156] Updated SystemMonitorController and System Monitor JoinMap; resolves #162 --- .../Bridges/JoinMaps/SystemMonitorJoinMap.cs | 364 +++++++----------- .../Monitoring/SystemMonitorController.cs | 121 +++--- 2 files changed, 199 insertions(+), 286 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/SystemMonitorJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/SystemMonitorJoinMap.cs index b2fd3dfd..a021eaaa 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/SystemMonitorJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/SystemMonitorJoinMap.cs @@ -1,225 +1,141 @@ -using PepperDash.Essentials.Core; - -namespace PepperDash.Essentials.Core.Bridges -{ - public class SystemMonitorJoinMap : JoinMapBase - { - /// - /// Offset to indicate where the range of iterated program joins will start - /// - public uint ProgramStartJoin { get; set; } - - /// - /// Offset to indicate where the range of iterated Ethernet joins will start - /// - public uint EthernetStartJoin { get; set; } - - /// - /// Offset between each program join set - /// - public uint ProgramOffsetJoin { get; set; } - - /// - /// Offset between each Ethernet Interface join set - /// - public uint EthernetOffsetJoin { get; set; } - - #region Digitals - /// - /// Range Sets and reports whether the corresponding program slot is started - /// - public uint ProgramStart { get; set; } - /// - /// Range Sets and reports whether the corresponding program slot is stopped - /// - public uint ProgramStop { get; set; } - /// - /// Range Sets and reports whether the corresponding program is registered - /// - public uint ProgramRegister { get; set; } - /// - /// Range Sets and reports whether the corresponding program is unregistered - /// - public uint ProgramUnregister { get; set; } - #endregion - - #region Analogs - /// - /// Sets and reports the time zone - /// - public uint TimeZone { get; set; } - #endregion - - #region Serials - /// - /// Reports the time zone name - /// - public uint TimeZoneName { get; set; } - /// - /// Reports the IO Controller Version - /// - public uint IOControllerVersion { get; set; } - /// - /// Reports the SNMP App Version - /// - public uint SnmpAppVersion { get; set; } - /// - /// Reports the BACnet App Version - /// - public uint BACnetAppVersion { get; set; } - /// - /// Reports the firmware version - /// - public uint ControllerVersion { get; set; } - - /// - /// Reports the name of the corresponding program - /// - public uint ProgramName { get; set; } - /// - /// Reports the compile time of the corresponding program - /// - public uint ProgramCompiledTime { get; set; } - /// - /// Reports the Crestron Database version of the corresponding program - /// - public uint ProgramCrestronDatabaseVersion { get; set; } - /// - /// Reports the Environment Version of the corresponding program - /// - public uint ProgramEnvironmentVersion { get; set; } - /// - /// Serialized JSON output that aggregates the program info of the corresponding program - /// - public uint AggregatedProgramInfo { get; set; } - /// - /// Reports the controller serial number - /// - public uint SerialNumber { get; set; } - /// - /// Reports the controller model - /// - public uint Model { get; set; } - /// - /// Reports the Host name set on the corresponding interface - /// - public uint HostName { get; set; } - /// - /// Reports the Current IP address set on the corresponding interface. If DHCP is enabled, this will be the DHCP assigned address. - /// - public uint CurrentIpAddress { get; set; } - /// - /// Reporst the Current Default Gateway set on the corresponding interface. If DHCP is enabled, this will be the DHCP assigned gateway - /// - public uint CurrentDefaultGateway { get; set; } - /// - /// Reports the Current Subnet Mask set on the corresponding interface. If DHCP is enabled, this will be the DHCP assigned subnet mask - /// - public uint CurrentSubnetMask { get; set; } - /// - /// Reports the Static IP address set on the corresponding interface. If DHCP is disabled, this will match the Current IP address - /// - public uint StaticIpAddress { get; set; } - /// - /// Reporst the Static Default Gateway set on the corresponding interface. If DHCP is disabled, this will match the Current gateway - /// - public uint StaticDefaultGateway { get; set; } - /// - /// Reports the Current Subnet Mask set on the corresponding interface. If DHCP is enabled, this will be the DHCP assigned subnet mask - /// - public uint StaticSubnetMask { get; set; } - /// - /// Reports the current DomainFeedback on the corresponding interface - /// - public uint Domain { get; set; } - /// - /// Reports the current DNS Servers on the corresponding interface - /// - public uint DnsServer { get; set; } - /// - /// Reports the MAC Address of the corresponding interface - /// - public uint MacAddress { get; set; } - /// - /// Reports the DHCP Status of the corresponding interface - /// - public uint DhcpStatus { get; set; } - - /// - /// Reports the current uptime. Updated in 5 minute intervals. - /// - public uint Uptime { get; set; } - - /// - /// Reports the date of the last boot - /// - public uint LastBoot { get; set; } - #endregion - - public SystemMonitorJoinMap() - { - TimeZone = 1; - - TimeZoneName = 1; - IOControllerVersion = 2; - SnmpAppVersion = 3; - BACnetAppVersion = 4; - ControllerVersion = 5; - SerialNumber = 6; - Model = 7; - Uptime = 8; - LastBoot = 9; - - - ProgramStartJoin = 10; - - ProgramOffsetJoin = 5; - - // Offset in groups of 5 joins - ProgramStart = 1; - ProgramStop = 2; - ProgramRegister = 3; - ProgramUnregister = 4; - - ProgramName = 1; - ProgramCompiledTime = 2; - ProgramCrestronDatabaseVersion = 3; - ProgramEnvironmentVersion = 4; - AggregatedProgramInfo = 5; - - EthernetStartJoin = 75; - - EthernetOffsetJoin = 15; - - // Offset in groups of 15 - HostName = 1; - CurrentIpAddress = 2; - CurrentSubnetMask = 3; - CurrentDefaultGateway = 4; - StaticIpAddress = 5; - StaticSubnetMask = 6; - StaticDefaultGateway = 7; - Domain = 8; - DnsServer = 9; - MacAddress = 10; - DhcpStatus = 11; - } - - public override void OffsetJoinNumbers(uint joinStart) - { - var joinOffset = joinStart - 1; - - TimeZone = TimeZone + joinOffset; - - TimeZoneName = TimeZoneName + joinOffset; - IOControllerVersion = IOControllerVersion + joinOffset; - SnmpAppVersion = SnmpAppVersion + joinOffset; - BACnetAppVersion = BACnetAppVersion + joinOffset; - ControllerVersion = ControllerVersion + joinOffset; - - // Sets the initial join value where the iterated program joins will begin - ProgramStartJoin = ProgramStartJoin + joinOffset; - EthernetStartJoin = EthernetStartJoin + joinOffset; - } - } +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Core.Bridges +{ + public class SystemMonitorJoinMap : JoinMapBaseAdvanced + { + [JoinName("TimeZone")] + public JoinDataComplete TimeZone = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "Processor Timezone", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("TimeZoneName")] + public JoinDataComplete TimeZoneName = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "Processor Timezone Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("IOControllerVersion")] + public JoinDataComplete IOControllerVersion = new JoinDataComplete(new JoinData() { JoinNumber = 2, JoinSpan = 1 }, + new JoinMetadata() { Label = "Processor IO Controller Version", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("SnmpAppVersion")] + public JoinDataComplete SnmpAppVersion = new JoinDataComplete(new JoinData() { JoinNumber = 3, JoinSpan = 1 }, + new JoinMetadata() { Label = "Processor SNMP App Version", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("BACnetAppVersion")] + public JoinDataComplete BACnetAppVersion = new JoinDataComplete(new JoinData() { JoinNumber = 4, JoinSpan = 1 }, + new JoinMetadata() { Label = "Processor BACNet App Version", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("ControllerVersion")] + public JoinDataComplete ControllerVersion = new JoinDataComplete(new JoinData() { JoinNumber = 5, JoinSpan = 1 }, + new JoinMetadata() { Label = "Processor Controller Version", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("SerialNumber")] + public JoinDataComplete SerialNumber = new JoinDataComplete(new JoinData() { JoinNumber = 6, JoinSpan = 1 }, + new JoinMetadata() { Label = "Processor Serial Number", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("Model")] + public JoinDataComplete Model = new JoinDataComplete(new JoinData() { JoinNumber = 7, JoinSpan = 1 }, + new JoinMetadata() { Label = "Processor Model", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("Uptime")] + public JoinDataComplete Uptime = new JoinDataComplete(new JoinData() { JoinNumber = 8, JoinSpan = 1 }, + new JoinMetadata() { Label = "Processor Uptime", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("LastBoot")] + public JoinDataComplete LastBoot = new JoinDataComplete(new JoinData() { JoinNumber = 9, JoinSpan = 1 }, + new JoinMetadata() { Label = "Processor Last Boot", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("ProgramOffsetJoin")] + public JoinDataComplete ProgramOffsetJoin = new JoinDataComplete(new JoinData() { JoinNumber = 5, JoinSpan = 1 }, + new JoinMetadata() { Label = "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() { Label = "Processor Program Start / Fb", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("ProgramStop")] + public JoinDataComplete ProgramStop = new JoinDataComplete(new JoinData() { JoinNumber = 12, JoinSpan = 1 }, + new JoinMetadata() { Label = "Processor Program Stop / Fb", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("ProgramRegister")] + public JoinDataComplete ProgramRegister = new JoinDataComplete(new JoinData() { JoinNumber = 13, JoinSpan = 1 }, + new JoinMetadata() { Label = "Processor Program Register / Fb", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("ProgramUnregister")] + public JoinDataComplete ProgramUnregister = new JoinDataComplete(new JoinData() { JoinNumber = 14, JoinSpan = 1 }, + new JoinMetadata() { Label = "Processor Program UnRegister / Fb", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("ProgramName")] + public JoinDataComplete ProgramName = new JoinDataComplete(new JoinData() { JoinNumber = 11, JoinSpan = 1 }, + new JoinMetadata() { Label = "Processor Program Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("ProgramCompiledTime")] + public JoinDataComplete ProgramCompiledTime = new JoinDataComplete(new JoinData() { JoinNumber = 12, JoinSpan = 1 }, + new JoinMetadata() { Label = "Processor Program Compile Time", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("ProgramCrestronDatabaseVersion")] + public JoinDataComplete ProgramCrestronDatabaseVersion = new JoinDataComplete(new JoinData() { JoinNumber = 13, JoinSpan = 1 }, + new JoinMetadata() { Label = "Processor Program Database Version", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("ProgramEnvironmentVersion")] + public JoinDataComplete ProgramEnvironmentVersion = new JoinDataComplete(new JoinData() { JoinNumber = 14, JoinSpan = 1 }, + new JoinMetadata() { Label = "Processor Program Environment Version", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("AggregatedProgramInfo")] + public JoinDataComplete AggregatedProgramInfo = new JoinDataComplete(new JoinData() { JoinNumber = 15, JoinSpan = 1 }, + new JoinMetadata() { Label = "Processor Program Aggregate Info Json", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("EthernetOffsetJoin")] + public JoinDataComplete EthernetOffsetJoin = new JoinDataComplete(new JoinData() { JoinNumber = 15, JoinSpan = 1 }, + new JoinMetadata() { Label = "All Ethernet Data is offset between Nics by 5 - First Joins Start at 76", JoinCapabilities = eJoinCapabilities.None, JoinType = eJoinType.None }); + + [JoinName("HostName")] + public JoinDataComplete HostName = new JoinDataComplete(new JoinData() { JoinNumber = 76, JoinSpan = 1 }, + new JoinMetadata() { Label = "Processor Ethernet Hostname", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("CurrentIpAddress")] + public JoinDataComplete CurrentIpAddress = new JoinDataComplete(new JoinData() { JoinNumber = 77, JoinSpan = 1 }, + new JoinMetadata() { Label = "Processor Ethernet Current Ip Address", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("CurrentSubnetMask")] + public JoinDataComplete CurrentSubnetMask = new JoinDataComplete(new JoinData() { JoinNumber = 78, JoinSpan = 1 }, + new JoinMetadata() { Label = "Processor Ethernet Current Subnet Mask", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("CurrentDefaultGateway")] + public JoinDataComplete CurrentDefaultGateway = new JoinDataComplete(new JoinData() { JoinNumber = 79, JoinSpan = 1 }, + new JoinMetadata() { Label = "Processor Ethernet Current Default Gateway", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("StaticIpAddress")] + public JoinDataComplete StaticIpAddress = new JoinDataComplete(new JoinData() { JoinNumber = 80, JoinSpan = 1 }, + new JoinMetadata() { Label = "Processor Ethernet Static Ip Address", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("StaticSubnetMask")] + public JoinDataComplete StaticSubnetMask = new JoinDataComplete(new JoinData() { JoinNumber = 81, JoinSpan = 1 }, + new JoinMetadata() { Label = "Processor Ethernet Static Subnet Mask", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("StaticDefaultGateway")] + public JoinDataComplete StaticDefaultGateway = new JoinDataComplete(new JoinData() { JoinNumber = 82, JoinSpan = 1 }, + new JoinMetadata() { Label = "Processor Ethernet Static Default Gateway", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("Domain")] + public JoinDataComplete Domain = new JoinDataComplete(new JoinData() { JoinNumber = 83, JoinSpan = 1 }, + new JoinMetadata() { Label = "Processor Ethernet Domain", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("DnsServer")] + public JoinDataComplete DnsServer = new JoinDataComplete(new JoinData() { JoinNumber = 84, JoinSpan = 1 }, + new JoinMetadata() { Label = "Processor Ethernet Dns Server", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("MacAddress")] + public JoinDataComplete MacAddress = new JoinDataComplete(new JoinData() { JoinNumber = 85, JoinSpan = 1 }, + new JoinMetadata() { Label = "Processor Ethernet Mac Address", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("DhcpStatus")] + public JoinDataComplete DhcpStatus = new JoinDataComplete(new JoinData() { JoinNumber = 86, JoinSpan = 1 }, + new JoinMetadata() { Label = "Processor Ethernet Dhcp Status", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + + public SystemMonitorJoinMap(uint joinStart) + : base(joinStart, typeof(SystemMonitorJoinMap)) + { + } + } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Monitoring/SystemMonitorController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Monitoring/SystemMonitorController.cs index 3f791467..292d120c 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Monitoring/SystemMonitorController.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Monitoring/SystemMonitorController.cs @@ -201,30 +201,28 @@ namespace PepperDash.Essentials.Core.Monitoring } public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) - { - var joinMap = new SystemMonitorJoinMap(); + { + var joinMap = new SystemMonitorJoinMap(joinStart); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - joinMap.OffsetJoinNumbers(joinStart); - Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); Debug.Console(2, this, "Linking API starting at join: {0}", joinStart); - TimeZoneFeedback.LinkInputSig(trilist.UShortInput[joinMap.TimeZone]); - TimeZoneTextFeedback.LinkInputSig(trilist.StringInput[joinMap.TimeZoneName]); - - IoControllerVersionFeedback.LinkInputSig(trilist.StringInput[joinMap.IOControllerVersion]); - SnmpVersionFeedback.LinkInputSig(trilist.StringInput[joinMap.SnmpAppVersion]); - BaCnetAppVersionFeedback.LinkInputSig(trilist.StringInput[joinMap.BACnetAppVersion]); - ControllerVersionFeedback.LinkInputSig(trilist.StringInput[joinMap.ControllerVersion]); - SerialNumberFeedback.LinkInputSig(trilist.StringInput[joinMap.SerialNumber]); - ModelFeedback.LinkInputSig(trilist.StringInput[joinMap.Model]); - UptimeFeedback.LinkInputSig(trilist.StringInput[joinMap.Uptime]); - LastStartFeedback.LinkInputSig(trilist.StringInput[joinMap.LastBoot]); + TimeZoneFeedback.LinkInputSig(trilist.UShortInput[joinMap.TimeZone.JoinNumber]); + TimeZoneTextFeedback.LinkInputSig(trilist.StringInput[joinMap.TimeZoneName.JoinNumber]); + + IoControllerVersionFeedback.LinkInputSig(trilist.StringInput[joinMap.IOControllerVersion.JoinNumber]); + SnmpVersionFeedback.LinkInputSig(trilist.StringInput[joinMap.SnmpAppVersion.JoinNumber]); + BaCnetAppVersionFeedback.LinkInputSig(trilist.StringInput[joinMap.BACnetAppVersion.JoinNumber]); + ControllerVersionFeedback.LinkInputSig(trilist.StringInput[joinMap.ControllerVersion.JoinNumber]); + SerialNumberFeedback.LinkInputSig(trilist.StringInput[joinMap.SerialNumber.JoinNumber]); + ModelFeedback.LinkInputSig(trilist.StringInput[joinMap.Model.JoinNumber]); + UptimeFeedback.LinkInputSig(trilist.StringInput[joinMap.Uptime.JoinNumber]); + LastStartFeedback.LinkInputSig(trilist.StringInput[joinMap.LastBoot.JoinNumber]); // iterate the program status feedback collection and map all the joins LinkProgramInfoJoins(this, trilist, joinMap); @@ -233,65 +231,64 @@ namespace PepperDash.Essentials.Core.Monitoring } private static void LinkEthernetInfoJoins(SystemMonitorController systemMonitorController, BasicTriList trilist, SystemMonitorJoinMap joinMap) - { - var ethernetSlotJoinStart = joinMap.EthernetStartJoin; - + { + uint ethernetSlotJoinStart = 0; foreach (var fb in systemMonitorController.EthernetStatusFeedbackCollection) - { - fb.Value.CurrentIpAddressFeedback.LinkInputSig(trilist.StringInput[ethernetSlotJoinStart + joinMap.CurrentIpAddress]); - fb.Value.CurrentSubnetMaskFeedback.LinkInputSig(trilist.StringInput[ethernetSlotJoinStart + joinMap.CurrentSubnetMask]); - fb.Value.CurrentDefaultGatewayFeedback.LinkInputSig(trilist.StringInput[ethernetSlotJoinStart + joinMap.CurrentDefaultGateway]); - fb.Value.StaticIpAddressFeedback.LinkInputSig(trilist.StringInput[ethernetSlotJoinStart + joinMap.StaticIpAddress]); - fb.Value.StaticSubnetMaskFeedback.LinkInputSig(trilist.StringInput[ethernetSlotJoinStart + joinMap.StaticSubnetMask]); - fb.Value.StaticDefaultGatewayFeedback.LinkInputSig(trilist.StringInput[ethernetSlotJoinStart + joinMap.StaticDefaultGateway]); - fb.Value.HostNameFeedback.LinkInputSig(trilist.StringInput[ethernetSlotJoinStart + joinMap.HostName]); - fb.Value.MacAddressFeedback.LinkInputSig(trilist.StringInput[ethernetSlotJoinStart + joinMap.MacAddress]); - fb.Value.DomainFeedback.LinkInputSig(trilist.StringInput[ethernetSlotJoinStart + joinMap.Domain]); - fb.Value.DnsServerFeedback.LinkInputSig(trilist.StringInput[ethernetSlotJoinStart + joinMap.DnsServer]); - fb.Value.DhcpStatusFeedback.LinkInputSig(trilist.StringInput[ethernetSlotJoinStart + joinMap.DhcpStatus]); + { + fb.Value.CurrentIpAddressFeedback.LinkInputSig(trilist.StringInput[ethernetSlotJoinStart + joinMap.CurrentIpAddress.JoinNumber]); + fb.Value.CurrentSubnetMaskFeedback.LinkInputSig(trilist.StringInput[ethernetSlotJoinStart + joinMap.CurrentSubnetMask.JoinNumber]); + fb.Value.CurrentDefaultGatewayFeedback.LinkInputSig(trilist.StringInput[ethernetSlotJoinStart + joinMap.CurrentDefaultGateway.JoinNumber]); + fb.Value.StaticIpAddressFeedback.LinkInputSig(trilist.StringInput[ethernetSlotJoinStart + joinMap.StaticIpAddress.JoinNumber]); + fb.Value.StaticSubnetMaskFeedback.LinkInputSig(trilist.StringInput[ethernetSlotJoinStart + joinMap.StaticSubnetMask.JoinNumber]); + fb.Value.StaticDefaultGatewayFeedback.LinkInputSig(trilist.StringInput[ethernetSlotJoinStart + joinMap.StaticDefaultGateway.JoinNumber]); + fb.Value.HostNameFeedback.LinkInputSig(trilist.StringInput[ethernetSlotJoinStart + joinMap.HostName.JoinNumber]); + fb.Value.MacAddressFeedback.LinkInputSig(trilist.StringInput[ethernetSlotJoinStart + joinMap.MacAddress.JoinNumber]); + fb.Value.DomainFeedback.LinkInputSig(trilist.StringInput[ethernetSlotJoinStart + joinMap.Domain.JoinNumber]); + fb.Value.DnsServerFeedback.LinkInputSig(trilist.StringInput[ethernetSlotJoinStart + joinMap.DnsServer.JoinNumber]); + fb.Value.DhcpStatusFeedback.LinkInputSig(trilist.StringInput[ethernetSlotJoinStart + joinMap.DhcpStatus.JoinNumber]); - ethernetSlotJoinStart += joinMap.EthernetOffsetJoin; + ethernetSlotJoinStart += joinMap.EthernetOffsetJoin.JoinNumber; } } private static void LinkProgramInfoJoins(SystemMonitorController systemMonitorController, BasicTriList trilist, SystemMonitorJoinMap joinMap) - { - var programSlotJoinStart = joinMap.ProgramStartJoin; + { + uint programSlotJoinStart = 0; foreach (var p in systemMonitorController.ProgramStatusFeedbackCollection) { - var programNumber = p.Value.Program.Number; - - trilist.SetBoolSigAction(programSlotJoinStart + joinMap.ProgramStart, - b => SystemMonitor.ProgramCollection[programNumber].OperatingState = eProgramOperatingState.Start); - p.Value.ProgramStartedFeedback.LinkInputSig(trilist.BooleanInput[programSlotJoinStart + joinMap.ProgramStart]); - - trilist.SetBoolSigAction(programSlotJoinStart + joinMap.ProgramStop, - b => SystemMonitor.ProgramCollection[programNumber].OperatingState = eProgramOperatingState.Stop); - p.Value.ProgramStoppedFeedback.LinkInputSig(trilist.BooleanInput[programSlotJoinStart + joinMap.ProgramStop]); - - trilist.SetBoolSigAction(programSlotJoinStart + joinMap.ProgramRegister, + var programNumber = p.Value.Program.Number; + + trilist.SetBoolSigAction(programSlotJoinStart + joinMap.ProgramStart.JoinNumber, + b => SystemMonitor.ProgramCollection[programNumber].OperatingState = eProgramOperatingState.Start); + p.Value.ProgramStartedFeedback.LinkInputSig(trilist.BooleanInput[programSlotJoinStart + joinMap.ProgramStart.JoinNumber]); + + trilist.SetBoolSigAction(programSlotJoinStart + joinMap.ProgramStop.JoinNumber, + b => SystemMonitor.ProgramCollection[programNumber].OperatingState = eProgramOperatingState.Stop); + p.Value.ProgramStoppedFeedback.LinkInputSig(trilist.BooleanInput[programSlotJoinStart + joinMap.ProgramStop.JoinNumber]); + + trilist.SetBoolSigAction(programSlotJoinStart + joinMap.ProgramRegister.JoinNumber, b => SystemMonitor.ProgramCollection[programNumber].RegistrationState = eProgramRegistrationState.Register); - p.Value.ProgramRegisteredFeedback.LinkInputSig( - trilist.BooleanInput[programSlotJoinStart + joinMap.ProgramRegister]); - - trilist.SetBoolSigAction(programSlotJoinStart + joinMap.ProgramUnregister, + p.Value.ProgramRegisteredFeedback.LinkInputSig( + trilist.BooleanInput[programSlotJoinStart + joinMap.ProgramRegister.JoinNumber]); + + trilist.SetBoolSigAction(programSlotJoinStart + joinMap.ProgramUnregister.JoinNumber, b => SystemMonitor.ProgramCollection[programNumber].RegistrationState = eProgramRegistrationState.Unregister); - p.Value.ProgramUnregisteredFeedback.LinkInputSig( - trilist.BooleanInput[programSlotJoinStart + joinMap.ProgramUnregister]); - - p.Value.ProgramNameFeedback.LinkInputSig(trilist.StringInput[programSlotJoinStart + joinMap.ProgramName]); - p.Value.ProgramCompileTimeFeedback.LinkInputSig( - trilist.StringInput[programSlotJoinStart + joinMap.ProgramCompiledTime]); - p.Value.CrestronDataBaseVersionFeedback.LinkInputSig( - trilist.StringInput[programSlotJoinStart + joinMap.ProgramCrestronDatabaseVersion]); - p.Value.EnvironmentVersionFeedback.LinkInputSig( - trilist.StringInput[programSlotJoinStart + joinMap.ProgramEnvironmentVersion]); - p.Value.AggregatedProgramInfoFeedback.LinkInputSig( - trilist.StringInput[programSlotJoinStart + joinMap.AggregatedProgramInfo]); - - programSlotJoinStart = programSlotJoinStart + joinMap.ProgramOffsetJoin; + p.Value.ProgramUnregisteredFeedback.LinkInputSig( + trilist.BooleanInput[programSlotJoinStart + joinMap.ProgramUnregister.JoinNumber]); + + p.Value.ProgramNameFeedback.LinkInputSig(trilist.StringInput[programSlotJoinStart + joinMap.ProgramName.JoinNumber]); + p.Value.ProgramCompileTimeFeedback.LinkInputSig( + trilist.StringInput[programSlotJoinStart + joinMap.ProgramCompiledTime.JoinNumber]); + p.Value.CrestronDataBaseVersionFeedback.LinkInputSig( + trilist.StringInput[programSlotJoinStart + joinMap.ProgramCrestronDatabaseVersion.JoinNumber]); + p.Value.EnvironmentVersionFeedback.LinkInputSig( + trilist.StringInput[programSlotJoinStart + joinMap.ProgramEnvironmentVersion.JoinNumber]); + p.Value.AggregatedProgramInfoFeedback.LinkInputSig( + trilist.StringInput[programSlotJoinStart + joinMap.AggregatedProgramInfo.JoinNumber]); + + programSlotJoinStart = programSlotJoinStart + joinMap.ProgramOffsetJoin.JoinNumber; } } From 93d6bf607b70095ec25ca370ee6b6a23c4d9d01b Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Thu, 7 May 2020 22:20:38 -0500 Subject: [PATCH 128/156] Added CenOdtOccupancySensorBaseController; Added CenOdtOccupancySensorBaseJoinMap resolves #142 --- .../CenOdtOccupancySensorBaseJoinMap.cs | 182 ++++++ .../PepperDash_Essentials_Core.csproj | 1 + .../Essentials Devices Common.csproj | 1 + .../CenOdtOccupancySensorBaseController.cs | 564 ++++++++++++++++++ 4 files changed, 748 insertions(+) create mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/CenOdtOccupancySensorBaseJoinMap.cs create mode 100644 essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/CenOdtOccupancySensorBaseController.cs diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/CenOdtOccupancySensorBaseJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/CenOdtOccupancySensorBaseJoinMap.cs new file mode 100644 index 00000000..1548f834 --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/CenOdtOccupancySensorBaseJoinMap.cs @@ -0,0 +1,182 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Core.Bridges +{ + public class CenOdtOccupancySensorBaseJoinMap : JoinMapBaseAdvanced + { + #region Digitals + + [JoinName("Online")] + public JoinDataComplete Online = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("ForceOccupied")] + public JoinDataComplete ForceOccupied = new JoinDataComplete(new JoinData() { JoinNumber = 2, JoinSpan = 1 }, + new JoinMetadata() { Label = "Force Occupied", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("ForceVacant")] + public JoinDataComplete ForceVacant = new JoinDataComplete(new JoinData() { JoinNumber = 3, JoinSpan = 1 }, + new JoinMetadata() { Label = "Force Vacant", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("EnableRawStates")] + public JoinDataComplete EnableRawStates = new JoinDataComplete(new JoinData() { JoinNumber = 4, JoinSpan = 1 }, + new JoinMetadata() { Label = "Enable Raw States", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("RoomOccupiedFeedback")] + public JoinDataComplete RoomOccupiedFeedback = new JoinDataComplete(new JoinData() { JoinNumber = 2, JoinSpan = 1 }, + new JoinMetadata() { Label = "Room Occupied Feedback", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("GraceOccupancyDetectedFeedback")] + public JoinDataComplete GraceOccupancyDetectedFeedback = new JoinDataComplete(new JoinData() { JoinNumber = 3, JoinSpan = 1 }, + new JoinMetadata() { Label = "Grace Occupancy Detected Feedback", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("RoomVacantFeedback")] + public JoinDataComplete RoomVacantFeedback = new JoinDataComplete(new JoinData() { JoinNumber = 4, JoinSpan = 1 }, + new JoinMetadata() { Label = "Room Vacant Feedback", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("RawOccupancyFeedback")] + public JoinDataComplete RawOccupancyFeedback = new JoinDataComplete(new JoinData() { JoinNumber = 5, JoinSpan = 1 }, + new JoinMetadata() { Label = "Raw Occupancy Feedback", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("RawOccupancyPirFeedback")] + public JoinDataComplete RawOccupancyPirFeedback = new JoinDataComplete(new JoinData() { JoinNumber = 6, JoinSpan = 1 }, + new JoinMetadata() { Label = "Raw Occupancy Pir Feedback", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("RawOccupancyUsFeedback")] + public JoinDataComplete RawOccupancyUsFeedback = new JoinDataComplete(new JoinData() { JoinNumber = 7, JoinSpan = 1 }, + new JoinMetadata() { Label = "Raw Occupancy Us Feedback", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("EnableLedFlash")] + public JoinDataComplete EnableLedFlash = new JoinDataComplete(new JoinData() { JoinNumber = 11, JoinSpan = 1 }, + new JoinMetadata() { Label = "Enable Led Flash", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("DisableLedFlash")] + public JoinDataComplete DisableLedFlash = new JoinDataComplete(new JoinData() { JoinNumber = 12, JoinSpan = 1 }, + new JoinMetadata() { Label = "Disable Led Flash", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("EnableShortTimeout")] + public JoinDataComplete EnableShortTimeout = new JoinDataComplete(new JoinData() { JoinNumber = 13, JoinSpan = 1 }, + new JoinMetadata() { Label = "Enable Short Timeout", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("DisableShortTimeout")] + public JoinDataComplete DisableShortTimeout = new JoinDataComplete(new JoinData() { JoinNumber = 14, JoinSpan = 1 }, + new JoinMetadata() { Label = "Disable Short Timeout", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("OrWhenVacated")] + public JoinDataComplete OrWhenVacated = new JoinDataComplete(new JoinData() { JoinNumber = 15, JoinSpan = 1 }, + new JoinMetadata() { Label = "Or When Vacated", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("AndWhenVacated")] + public JoinDataComplete AndWhenVacated = new JoinDataComplete(new JoinData() { JoinNumber = 16, JoinSpan = 1 }, + new JoinMetadata() { Label = "AndWhenVacated", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("EnableUsA")] + public JoinDataComplete EnableUsA = new JoinDataComplete(new JoinData() { JoinNumber = 17, JoinSpan = 1 }, + new JoinMetadata() { Label = "Enable Us A", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("DisableUsA")] + public JoinDataComplete DisableUsA = new JoinDataComplete(new JoinData() { JoinNumber = 18, JoinSpan = 1 }, + new JoinMetadata() { Label = "Disable Us A", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("EnableUsB")] + public JoinDataComplete EnableUsB = new JoinDataComplete(new JoinData() { JoinNumber = 19, JoinSpan = 1 }, + new JoinMetadata() { Label = "Enable Us B", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("DisableUsB")] + public JoinDataComplete DisableUsB = new JoinDataComplete(new JoinData() { JoinNumber = 20, JoinSpan = 1 }, + new JoinMetadata() { Label = "Disable Us B", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("EnablePir")] + public JoinDataComplete EnablePir = new JoinDataComplete(new JoinData() { JoinNumber = 21, JoinSpan = 1 }, + new JoinMetadata() { Label = "Enable Pir", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("DisablePir")] + public JoinDataComplete DisablePir = new JoinDataComplete(new JoinData() { JoinNumber = 22, JoinSpan = 1 }, + new JoinMetadata() { Label = "Disable Pir", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("IncrementUsInOccupiedState")] + public JoinDataComplete IncrementUsInOccupiedState = new JoinDataComplete(new JoinData() { JoinNumber = 23, JoinSpan = 1 }, + new JoinMetadata() { Label = "Increment Us In OccupiedState", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("DecrementUsInOccupiedState")] + public JoinDataComplete DecrementUsInOccupiedState = new JoinDataComplete(new JoinData() { JoinNumber = 24, JoinSpan = 1 }, + new JoinMetadata() { Label = "Dencrement Us In Occupied State", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("IncrementUsInVacantState")] + public JoinDataComplete IncrementUsInVacantState = new JoinDataComplete(new JoinData() { JoinNumber = 25, JoinSpan = 1 }, + new JoinMetadata() { Label = "Increment Us In VacantState", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("DecrementUsInVacantState")] + public JoinDataComplete DecrementUsInVacantState = new JoinDataComplete(new JoinData() { JoinNumber = 26, JoinSpan = 1 }, + new JoinMetadata() { Label = "Decrement Us In VacantState", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("IncrementPirInOccupiedState")] + public JoinDataComplete IncrementPirInOccupiedState = new JoinDataComplete(new JoinData() { JoinNumber = 27, JoinSpan = 1 }, + new JoinMetadata() { Label = "Increment Pir In Occupied State", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("DecrementPirInOccupiedState")] + public JoinDataComplete DecrementPirInOccupiedState = new JoinDataComplete(new JoinData() { JoinNumber = 28, JoinSpan = 1 }, + new JoinMetadata() { Label = "Decrement Pir In OccupiedState", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("IncrementPirInVacantState")] + public JoinDataComplete IncrementPirInVacantState = new JoinDataComplete(new JoinData() { JoinNumber = 29, JoinSpan = 1 }, + new JoinMetadata() { Label = "Increment Pir In Vacant State", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("DecrementPirInVacantState")] + public JoinDataComplete DecrementPirInVacantState = new JoinDataComplete(new JoinData() { JoinNumber = 30, JoinSpan = 1 }, + new JoinMetadata() { Label = "Decrement Pir In Vacant State", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + #endregion + + #region Analog + + [JoinName("Timeout")] + public JoinDataComplete Timeout = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "Timeout", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("TimeoutLocalFeedback")] + public JoinDataComplete TimeoutLocalFeedback = new JoinDataComplete(new JoinData() { JoinNumber = 2, JoinSpan = 1 }, + new JoinMetadata() { Label = "Timeout Local Feedback", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("InternalPhotoSensorValue")] + public JoinDataComplete InternalPhotoSensorValue = new JoinDataComplete(new JoinData() { JoinNumber = 3, JoinSpan = 1 }, + new JoinMetadata() { Label = "Internal PhotoSensor Value", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("UsSensitivityInOccupiedState")] + public JoinDataComplete UsSensitivityInOccupiedState = new JoinDataComplete(new JoinData() { JoinNumber = 5, JoinSpan = 1 }, + new JoinMetadata() { Label = "Us Sensitivity In Occupied State", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("UsSensitivityInVacantState")] + public JoinDataComplete UsSensitivityInVacantState = new JoinDataComplete(new JoinData() { JoinNumber = 6, JoinSpan = 1 }, + new JoinMetadata() { Label = "Us Sensitivity In Vacant State", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("PirSensitivityInOccupiedState")] + public JoinDataComplete PirSensitivityInOccupiedState = new JoinDataComplete(new JoinData() { JoinNumber = 7, JoinSpan = 1 }, + new JoinMetadata() { Label = "Pir Sensitivity In Occupied State", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("PirSensitivityInVacantState")] + public JoinDataComplete PirSensitivityInVacantState = new JoinDataComplete(new JoinData() { JoinNumber = 8, JoinSpan = 1 }, + new JoinMetadata() { Label = "Pir Sensitivity In Vacant State", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog }); + + #endregion + + #region Serial + + [JoinName("Name")] + public JoinDataComplete Name = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + #endregion + + public CenOdtOccupancySensorBaseJoinMap(uint joinStart) + : base(joinStart, typeof(CenOdtOccupancySensorBaseJoinMap)) + { + } + } + +} diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj index e7a5a8ac..4e3e1b41 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj @@ -117,6 +117,7 @@ + diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Essentials Devices Common.csproj b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Essentials Devices Common.csproj index 147ace5b..4b24607c 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Essentials Devices Common.csproj +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Essentials Devices Common.csproj @@ -110,6 +110,7 @@ + diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/CenOdtOccupancySensorBaseController.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/CenOdtOccupancySensorBaseController.cs new file mode 100644 index 00000000..58126fbd --- /dev/null +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/CenOdtOccupancySensorBaseController.cs @@ -0,0 +1,564 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using Crestron.SimplSharpPro.DeviceSupport; +using Crestron.SimplSharpPro.GeneralIO; +using Newtonsoft.Json; +using PepperDash.Core; +using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Config; +using PepperDash.Essentials.Core.Bridges; + +namespace PepperDash.Essentials.Devices.Common.Occupancy +{ + public class CenOdtOccupancySensorBaseController : CrestronGenericBridgeableBaseDevice, IOccupancyStatusProvider + { + public CenOdtCPoe OccSensor { get; private set; } + + public BoolFeedback RoomIsOccupiedFeedback { get; private set; } + + public BoolFeedback GraceOccupancyDetectedFeedback { get; private set; } + + public BoolFeedback RawOccupancyFeedback { get; private set; } + + public BoolFeedback PirSensorEnabledFeedback { get; private set; } + + public BoolFeedback LedFlashEnabledFeedback { get; private set; } + + public BoolFeedback ShortTimeoutEnabledFeedback { get; private set; } + + public IntFeedback PirSensitivityInVacantStateFeedback { get; private set; } + + public IntFeedback PirSensitivityInOccupiedStateFeedback { get; private set; } + + public IntFeedback CurrentTimeoutFeedback { get; private set; } + + public IntFeedback RemoteTimeoutFeedback { get; private set; } + + public IntFeedback InternalPhotoSensorValue { get; set; } + + public IntFeedback ExternalPhotoSensorValue { get; set; } + + public BoolFeedback OrWhenVacatedFeedback { get; private set; } + + public BoolFeedback AndWhenVacatedFeedback { get; private set; } + + public BoolFeedback UltrasonicAEnabledFeedback { get; private set; } + + public BoolFeedback UltrasonicBEnabledFeedback { get; private set; } + + public IntFeedback UltrasonicSensitivityInVacantStateFeedback { get; private set; } + + public IntFeedback UltrasonicSensitivityInOccupiedStateFeedback { get; private set; } + + public BoolFeedback RawOccupancyPirFeedback { get; private set; } + + public BoolFeedback RawOccupancyUsFeedback { get; private set; } + + // Debug properties + public bool InTestMode { get; private set; } + + public bool TestRoomIsOccupiedFeedback { get; private set; } + + public Func RoomIsOccupiedFeedbackFunc + { + get + { + return () => InTestMode ? TestRoomIsOccupiedFeedback : OccSensor.OccupancyDetectedFeedback.BoolValue; + } + } + + public CenOdtOccupancySensorBaseController(string key, string name, CenOdtCPoe sensor) + : base(key, name, sensor) + { + OccSensor = sensor; + + RoomIsOccupiedFeedback = new BoolFeedback(RoomIsOccupiedFeedbackFunc); + + PirSensorEnabledFeedback = new BoolFeedback(() => OccSensor.PassiveInfraredSensorEnabledFeedback.BoolValue); + + LedFlashEnabledFeedback = new BoolFeedback(() => OccSensor.LedFlashEnabledFeedback.BoolValue); + + ShortTimeoutEnabledFeedback = new BoolFeedback(() => OccSensor.ShortTimeoutEnabledFeedback.BoolValue); + + PirSensitivityInVacantStateFeedback = new IntFeedback(() => (int)OccSensor.PassiveInfraredSensorSensitivityInVacantStateFeedback); + + PirSensitivityInOccupiedStateFeedback = new IntFeedback(() => (int)OccSensor.PassiveInfraredSensorSensitivityInOccupiedStateFeedback); + + CurrentTimeoutFeedback = new IntFeedback(() => OccSensor.CurrentTimeoutFeedback.UShortValue); + + RemoteTimeoutFeedback = new IntFeedback(() => OccSensor.RemoteTimeout.UShortValue); + + GraceOccupancyDetectedFeedback = new BoolFeedback(() => OccSensor.GraceOccupancyDetectedFeedback.BoolValue); + + RawOccupancyFeedback = new BoolFeedback(() => OccSensor.RawOccupancyDetectedFeedback.BoolValue); + + InternalPhotoSensorValue = new IntFeedback(() => OccSensor.InternalPhotoSensorValueFeedback.UShortValue); + + //ExternalPhotoSensorValue = new IntFeedback(() => OccSensor.ex.UShortValue); + + AndWhenVacatedFeedback = new BoolFeedback(() => OccSensor.AndWhenVacatedFeedback.BoolValue); + + OrWhenVacatedFeedback = new BoolFeedback(() => OccSensor.OrWhenVacatedFeedback.BoolValue); + + UltrasonicAEnabledFeedback = new BoolFeedback(() => OccSensor.UltrasonicSensorSideAEnabledFeedback.BoolValue); + + UltrasonicBEnabledFeedback = new BoolFeedback(() => OccSensor.UltrasonicSensorSideBEnabledFeedback.BoolValue); + + RawOccupancyPirFeedback = new BoolFeedback(() => OccSensor.RawOccupancyDetectedByPassiveInfraredSensorFeedback.BoolValue); + + RawOccupancyUsFeedback = new BoolFeedback(() => OccSensor.RawOccupancyDetectedByUltrasonicSensorFeedback.BoolValue); + + UltrasonicSensitivityInVacantStateFeedback = new IntFeedback(() => (int)OccSensor.UltrasonicSensorSensitivityInVacantStateFeedback); + + UltrasonicSensitivityInOccupiedStateFeedback = new IntFeedback(() => (int)OccSensor.UltrasonicSensorSensitivityInOccupiedStateFeedback); + + OccSensor.BaseEvent += new Crestron.SimplSharpPro.BaseEventHandler(OccSensor_BaseEvent); + + OccSensor.CenOccupancySensorChange += new GenericEventHandler(OccSensor_CenOccupancySensorChange); + + } + + + + + + + /// + /// Catches events for feedbacks on the base class. Any extending wrapper class should call this delegate after it checks for it's own event IDs. + /// + /// + /// + protected virtual void OccSensor_CenOccupancySensorChange(object device, GenericEventArgs args) + { + if (args.EventId == GlsOccupancySensorBase.PirEnabledFeedbackEventId) + PirSensorEnabledFeedback.FireUpdate(); + else if (args.EventId == GlsOccupancySensorBase.LedFlashEnabledFeedbackEventId) + LedFlashEnabledFeedback.FireUpdate(); + else if (args.EventId == GlsOccupancySensorBase.ShortTimeoutEnabledFeedbackEventId) + ShortTimeoutEnabledFeedback.FireUpdate(); + else if (args.EventId == GlsOccupancySensorBase.PirSensitivityInOccupiedStateFeedbackEventId) + PirSensitivityInOccupiedStateFeedback.FireUpdate(); + else if (args.EventId == GlsOccupancySensorBase.PirSensitivityInVacantStateFeedbackEventId) + PirSensitivityInVacantStateFeedback.FireUpdate(); + else if (args.EventId == GlsOccupancySensorBase.RawOccupancyPirFeedbackEventId) + RawOccupancyPirFeedback.FireUpdate(); + else if (args.EventId == GlsOccupancySensorBase.RawOccupancyUsFeedbackEventId) + RawOccupancyUsFeedback.FireUpdate(); + } + + protected virtual void OccSensor_BaseEvent(Crestron.SimplSharpPro.GenericBase device, Crestron.SimplSharpPro.BaseEventArgs args) + { + Debug.Console(2, this, "PoEOccupancySensorChange EventId: {0}", args.EventId); + + if (args.EventId == Crestron.SimplSharpPro.GeneralIO.GlsOccupancySensorBase.RoomOccupiedFeedbackEventId + || args.EventId == Crestron.SimplSharpPro.GeneralIO.GlsOccupancySensorBase.RoomVacantFeedbackEventId) + { + Debug.Console(1, this, "Occupancy State: {0}", OccSensor.OccupancyDetectedFeedback.BoolValue); + RoomIsOccupiedFeedback.FireUpdate(); + } + else if (args.EventId == GlsOccupancySensorBase.TimeoutFeedbackEventId) + CurrentTimeoutFeedback.FireUpdate(); + else if (args.EventId == GlsOccupancySensorBase.TimeoutLocalFeedbackEventId) + RemoteTimeoutFeedback.FireUpdate(); + else if (args.EventId == GlsOccupancySensorBase.GraceOccupancyDetectedFeedbackEventId) + GraceOccupancyDetectedFeedback.FireUpdate(); + else if (args.EventId == GlsOccupancySensorBase.RawOccupancyFeedbackEventId) + RawOccupancyFeedback.FireUpdate(); + else if (args.EventId == GlsOccupancySensorBase.InternalPhotoSensorValueFeedbackEventId) + InternalPhotoSensorValue.FireUpdate(); + else if (args.EventId == GlsOccupancySensorBase.ExternalPhotoSensorValueFeedbackEventId) + ExternalPhotoSensorValue.FireUpdate(); + else if (args.EventId == GlsOccupancySensorBase.AndWhenVacatedFeedbackEventId) + AndWhenVacatedFeedback.FireUpdate(); + else if (args.EventId == GlsOccupancySensorBase.OrWhenVacatedFeedbackEventId) + OrWhenVacatedFeedback.FireUpdate(); + else if (args.EventId == GlsOccupancySensorBase.UsAEnabledFeedbackEventId) + UltrasonicAEnabledFeedback.FireUpdate(); + else if (args.EventId == GlsOccupancySensorBase.UsBEnabledFeedbackEventId) + UltrasonicBEnabledFeedback.FireUpdate(); + else if (args.EventId == GlsOccupancySensorBase.UsSensitivityInOccupiedStateFeedbackEventId) + UltrasonicSensitivityInOccupiedStateFeedback.FireUpdate(); + else if (args.EventId == GlsOccupancySensorBase.UsSensitivityInVacantStateFeedbackEventId) + UltrasonicSensitivityInVacantStateFeedback.FireUpdate(); + } + + public void SetTestMode(bool mode) + { + InTestMode = mode; + + Debug.Console(1, this, "In Mock Mode: '{0}'", InTestMode); + } + + public void SetTestOccupiedState(bool state) + { + if (!InTestMode) + Debug.Console(1, "Mock mode not enabled"); + else + { + TestRoomIsOccupiedFeedback = state; + + RoomIsOccupiedFeedback.FireUpdate(); + } + } + + /// + /// Enables or disables the PIR sensor + /// + /// + public void SetPirEnable(bool state) + { + if (state) + { + OccSensor.EnablePassiveInfraredSensor(); + } + else + { + OccSensor.DisablePassiveInfraredSensor(); + } + } + + /// + /// Enables or disables the LED Flash + /// + /// + public void SetLedFlashEnable(bool state) + { + if (state) + { + OccSensor.EnableLedFlash(); + } + else + { + OccSensor.DisableLedFlash(); + } + } + + /// + /// Enables or disables short timeout based on state + /// + /// + public void SetShortTimeoutState(bool state) + { + if (state) + { + OccSensor.EnableShortTimeout(); + } + else + { + OccSensor.DisableShortTimeout(); + } + } + + public void IncrementPirSensitivityInOccupiedState(bool pressRelease) + { + if ((int)OccSensor.PassiveInfraredSensorSensitivityInOccupiedStateFeedback != 3) + { + OccSensor.PassiveInfraredSensorSensitivityInOccupiedState = OccSensor.PassiveInfraredSensorSensitivityInOccupiedStateFeedback + 1; + } + } + + public void DecrementPirSensitivityInOccupiedState(bool pressRelease) + { + if ((int)OccSensor.PassiveInfraredSensorSensitivityInOccupiedStateFeedback != 0) + { + OccSensor.PassiveInfraredSensorSensitivityInOccupiedState = OccSensor.PassiveInfraredSensorSensitivityInOccupiedStateFeedback - 1; + } + } + + public void IncrementPirSensitivityInVacantState(bool pressRelease) + { + if ((int)OccSensor.PassiveInfraredSensorSensitivityInVacantStateFeedback != 3) + { + OccSensor.PassiveInfraredSensorSensitivityInVacantState = OccSensor.PassiveInfraredSensorSensitivityInVacantStateFeedback + 1; + } + } + + public void DecrementPirSensitivityInVacantState(bool pressRelease) + { + if ((int)OccSensor.PassiveInfraredSensorSensitivityInVacantStateFeedback != 0) + { + OccSensor.PassiveInfraredSensorSensitivityInVacantState = OccSensor.PassiveInfraredSensorSensitivityInVacantStateFeedback - 1; + } + } + + public void IncrementUsSensitivityInOccupiedState(bool pressRelease) + { + if ((int)OccSensor.UltrasonicSensorSensitivityInOccupiedStateFeedback < 3) + { + OccSensor.UltrasonicSensorSensitivityInOccupiedState = OccSensor.UltrasonicSensorSensitivityInOccupiedStateFeedback + 1; + } + else if ((int)OccSensor.UltrasonicSensorSensitivityInOccupiedStateFeedback > 4) + { + OccSensor.UltrasonicSensorSensitivityInOccupiedState = OccSensor.UltrasonicSensorSensitivityInOccupiedStateFeedback - 1; + } + else if ((int)OccSensor.UltrasonicSensorSensitivityInOccupiedStateFeedback == 4) + { + OccSensor.UltrasonicSensorSensitivityInOccupiedState = 0; + } + } + + public void DecrementUsSensitivityInOccupiedState(bool pressRelease) + { + if ((int)OccSensor.UltrasonicSensorSensitivityInOccupiedStateFeedback > 0 + && (int)OccSensor.UltrasonicSensorSensitivityInOccupiedStateFeedback < 4) + { + OccSensor.UltrasonicSensorSensitivityInOccupiedState = OccSensor.UltrasonicSensorSensitivityInOccupiedStateFeedback - 1; + } + else if ((int)OccSensor.UltrasonicSensorSensitivityInOccupiedStateFeedback > 3 + && (int)OccSensor.UltrasonicSensorSensitivityInOccupiedStateFeedback < 7) + { + OccSensor.UltrasonicSensorSensitivityInOccupiedState = OccSensor.UltrasonicSensorSensitivityInOccupiedStateFeedback + 1; + } + } + + public void IncrementUsSensitivityInVacantState(bool pressRelease) + { + if ((int)OccSensor.UltrasonicSensorSensitivityInVacantStateFeedback < 3) + { + OccSensor.UltrasonicSensorSensitivityInVacantState = OccSensor.UltrasonicSensorSensitivityInVacantStateFeedback + 1; + } + else if ((int)OccSensor.UltrasonicSensorSensitivityInVacantStateFeedback > 4) + { + OccSensor.UltrasonicSensorSensitivityInVacantState = OccSensor.UltrasonicSensorSensitivityInVacantStateFeedback - 1; + } + else if ((int)OccSensor.UltrasonicSensorSensitivityInVacantStateFeedback == 4) + { + OccSensor.UltrasonicSensorSensitivityInVacantState = 0; + } + } + + public void DecrementUsSensitivityInVacantState(bool pressRelease) + { + if ((int)OccSensor.UltrasonicSensorSensitivityInVacantStateFeedback > 0 + && (int)OccSensor.UltrasonicSensorSensitivityInVacantStateFeedback < 4) + { + OccSensor.UltrasonicSensorSensitivityInVacantState = OccSensor.UltrasonicSensorSensitivityInVacantStateFeedback - 1; + } + else if ((int)OccSensor.UltrasonicSensorSensitivityInVacantStateFeedback > 3 + && (int)OccSensor.UltrasonicSensorSensitivityInVacantStateFeedback < 7) + { + OccSensor.UltrasonicSensorSensitivityInVacantState = OccSensor.UltrasonicSensorSensitivityInVacantStateFeedback + 1; + } + } + + public void ForceOccupied() + { + OccSensor.ForceOccupied(); + } + + public void ForceVacant() + { + OccSensor.ForceVacant(); + } + + public void EnableRawStates(bool state) + { + if (state) + { + OccSensor.EnableRawStates(); + } + else + OccSensor.DisableRawStates(); + } + + public void SetRemoteTimeout(ushort time) + { + OccSensor.RemoteTimeout.UShortValue = time; + } + + public void SetInternalPhotoSensorMinChange(ushort value) + { + OccSensor.InternalPhotoSensorMinimumChange.UShortValue = value; + } + + /// + /// Sets the OrWhenVacated state + /// + /// + public void SetOrWhenVacatedState(bool state) + { + if (state) + { + OccSensor.OrWhenVacated(); + } + } + + /// + /// Sets the AndWhenVacated state + /// + /// + public void SetAndWhenVacatedState(bool state) + { + if (state) + { + OccSensor.AndWhenVacated(); + } + } + + /// + /// Enables or disables the Ultrasonic A sensor + /// + /// + public void SetUsAEnable(bool state) + { + if (state) + { + OccSensor.EnableUltrasonicSensorSideA(); + } + else + { + OccSensor.DisableUltrasonicSensorSideA(); + } + } + + + /// + /// Enables or disables the Ultrasonic B sensor + /// + /// + public void SetUsBEnable(bool state) + { + if (state) + { + OccSensor.EnableUltrasonicSensorSideB(); + } + else + { + OccSensor.DisableUltrasonicSensorSideB(); + } + } + + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) + { + LinkOccSensorToApi(this, trilist, joinStart, joinMapKey, bridge); + } + + protected void LinkOccSensorToApi(CenOdtOccupancySensorBaseController occController, + BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) + { + CenOdtOccupancySensorBaseJoinMap joinMap = new CenOdtOccupancySensorBaseJoinMap(joinStart); + + var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); + + if (!string.IsNullOrEmpty(joinMapSerialized)) + joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + + + Debug.Console(1, occController, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); + + occController.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.Online.JoinNumber]); + trilist.StringInput[joinMap.Name.JoinNumber].StringValue = occController.Name; + + trilist.OnlineStatusChange += new Crestron.SimplSharpPro.OnlineStatusChangeEventHandler((d, args) => + { + if (args.DeviceOnLine) + { + trilist.StringInput[joinMap.Name.JoinNumber].StringValue = occController.Name; + } + } + ); + + // Occupied status + trilist.SetSigTrueAction(joinMap.ForceOccupied.JoinNumber, new Action(() => occController.ForceOccupied())); + trilist.SetSigTrueAction(joinMap.ForceVacant.JoinNumber, new Action(() => occController.ForceVacant())); + occController.RoomIsOccupiedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RoomOccupiedFeedback.JoinNumber]); + occController.RoomIsOccupiedFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.RoomVacantFeedback.JoinNumber]); + occController.RawOccupancyFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyFeedback.JoinNumber]); + trilist.SetBoolSigAction(joinMap.EnableRawStates.JoinNumber, new Action((b) => occController.EnableRawStates(b))); + + // Timouts + trilist.SetUShortSigAction(joinMap.Timeout.JoinNumber, new Action((u) => occController.SetRemoteTimeout(u))); + occController.CurrentTimeoutFeedback.LinkInputSig(trilist.UShortInput[joinMap.Timeout.JoinNumber]); + occController.RemoteTimeoutFeedback.LinkInputSig(trilist.UShortInput[joinMap.TimeoutLocalFeedback.JoinNumber]); + + // LED Flash + trilist.SetSigTrueAction(joinMap.EnableLedFlash.JoinNumber, new Action(() => occController.SetLedFlashEnable(true))); + trilist.SetSigTrueAction(joinMap.DisableLedFlash.JoinNumber, new Action(() => occController.SetLedFlashEnable(false))); + occController.LedFlashEnabledFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.EnableLedFlash.JoinNumber]); + + // Short Timeout + trilist.SetSigTrueAction(joinMap.EnableShortTimeout.JoinNumber, new Action(() => occController.SetShortTimeoutState(true))); + trilist.SetSigTrueAction(joinMap.DisableShortTimeout.JoinNumber, new Action(() => occController.SetShortTimeoutState(false))); + occController.ShortTimeoutEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableShortTimeout.JoinNumber]); + + // PIR Sensor + trilist.SetSigTrueAction(joinMap.EnablePir.JoinNumber, new Action(() => occController.SetPirEnable(true))); + trilist.SetSigTrueAction(joinMap.DisablePir.JoinNumber, new Action(() => occController.SetPirEnable(false))); + occController.PirSensorEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnablePir.JoinNumber]); + + // PIR Sensitivity in Occupied State + trilist.SetBoolSigAction(joinMap.IncrementPirInOccupiedState.JoinNumber, new Action((b) => occController.IncrementPirSensitivityInOccupiedState(b))); + trilist.SetBoolSigAction(joinMap.DecrementPirInOccupiedState.JoinNumber, new Action((b) => occController.DecrementPirSensitivityInOccupiedState(b))); + occController.PirSensitivityInOccupiedStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.PirSensitivityInOccupiedState.JoinNumber]); + + // PIR Sensitivity in Vacant State + trilist.SetBoolSigAction(joinMap.IncrementPirInVacantState.JoinNumber, new Action((b) => occController.IncrementPirSensitivityInVacantState(b))); + trilist.SetBoolSigAction(joinMap.DecrementPirInVacantState.JoinNumber, new Action((b) => occController.DecrementPirSensitivityInVacantState(b))); + occController.PirSensitivityInVacantStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.PirSensitivityInVacantState.JoinNumber]); + + // OR When Vacated + trilist.SetBoolSigAction(joinMap.OrWhenVacated.JoinNumber, new Action((b) => occController.SetOrWhenVacatedState(b))); + occController.OrWhenVacatedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.OrWhenVacated.JoinNumber]); + + // AND When Vacated + trilist.SetBoolSigAction(joinMap.AndWhenVacated.JoinNumber, new Action((b) => occController.SetAndWhenVacatedState(b))); + occController.AndWhenVacatedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.AndWhenVacated.JoinNumber]); + + // Ultrasonic A Sensor + trilist.SetSigTrueAction(joinMap.EnableUsA.JoinNumber, new Action(() => occController.SetUsAEnable(true))); + trilist.SetSigTrueAction(joinMap.DisableUsA.JoinNumber, new Action(() => occController.SetUsAEnable(false))); + occController.UltrasonicAEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableUsA.JoinNumber]); + + // Ultrasonic B Sensor + trilist.SetSigTrueAction(joinMap.EnableUsB.JoinNumber, new Action(() => occController.SetUsBEnable(true))); + trilist.SetSigTrueAction(joinMap.DisableUsB.JoinNumber, new Action(() => occController.SetUsBEnable(false))); + occController.UltrasonicAEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableUsB.JoinNumber]); + + // US Sensitivity in Occupied State + trilist.SetBoolSigAction(joinMap.IncrementUsInOccupiedState.JoinNumber, new Action((b) => occController.IncrementUsSensitivityInOccupiedState(b))); + trilist.SetBoolSigAction(joinMap.DecrementUsInOccupiedState.JoinNumber, new Action((b) => occController.DecrementUsSensitivityInOccupiedState(b))); + occController.UltrasonicSensitivityInOccupiedStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.UsSensitivityInOccupiedState.JoinNumber]); + + // US Sensitivity in Vacant State + trilist.SetBoolSigAction(joinMap.IncrementUsInVacantState.JoinNumber, new Action((b) => occController.IncrementUsSensitivityInVacantState(b))); + trilist.SetBoolSigAction(joinMap.DecrementUsInVacantState.JoinNumber, new Action((b) => occController.DecrementUsSensitivityInVacantState(b))); + occController.UltrasonicSensitivityInVacantStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.UsSensitivityInVacantState.JoinNumber]); + + //Sensor Raw States + occController.RawOccupancyPirFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyPirFeedback.JoinNumber]); + occController.RawOccupancyUsFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyUsFeedback.JoinNumber]); + + } + + public class CenOdtOccupancySensorBaseControllerFactory : EssentialsDeviceFactory + { + public CenOdtOccupancySensorBaseControllerFactory() + { + TypeNames = new List() { "cenodtcpoe", "cenodtocc" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new GlsOccupancySensorBaseController Device"); + + var typeName = dc.Type.ToLower(); + var key = dc.Key; + var name = dc.Name; + var comm = CommFactory.GetControlPropertiesConfig(dc); + + var occSensor = new CenOdtCPoe(comm.IpIdInt, Global.ControlSystem); + + if (occSensor == null) + { + Debug.Console(0, "ERROR: Unable to create Occupancy Sensor Device. Key: '{0}'", key); + return null; + } + + return new CenOdtOccupancySensorBaseController(key, name, occSensor); + } + } + } +} \ No newline at end of file From 072c13459cb63ced7e1b5dba2e2bd6416644103e Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Thu, 7 May 2020 22:20:38 -0500 Subject: [PATCH 129/156] Added CenOdtOccupancySensorBaseController; Added CenOdtOccupancySensorBaseJoinMap resolves #92 --- .../CenOdtOccupancySensorBaseJoinMap.cs | 182 ++++++ .../PepperDash_Essentials_Core.csproj | 1 + .../Essentials Devices Common.csproj | 1 + .../CenOdtOccupancySensorBaseController.cs | 564 ++++++++++++++++++ 4 files changed, 748 insertions(+) create mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/CenOdtOccupancySensorBaseJoinMap.cs create mode 100644 essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/CenOdtOccupancySensorBaseController.cs diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/CenOdtOccupancySensorBaseJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/CenOdtOccupancySensorBaseJoinMap.cs new file mode 100644 index 00000000..1548f834 --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/CenOdtOccupancySensorBaseJoinMap.cs @@ -0,0 +1,182 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Core.Bridges +{ + public class CenOdtOccupancySensorBaseJoinMap : JoinMapBaseAdvanced + { + #region Digitals + + [JoinName("Online")] + public JoinDataComplete Online = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("ForceOccupied")] + public JoinDataComplete ForceOccupied = new JoinDataComplete(new JoinData() { JoinNumber = 2, JoinSpan = 1 }, + new JoinMetadata() { Label = "Force Occupied", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("ForceVacant")] + public JoinDataComplete ForceVacant = new JoinDataComplete(new JoinData() { JoinNumber = 3, JoinSpan = 1 }, + new JoinMetadata() { Label = "Force Vacant", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("EnableRawStates")] + public JoinDataComplete EnableRawStates = new JoinDataComplete(new JoinData() { JoinNumber = 4, JoinSpan = 1 }, + new JoinMetadata() { Label = "Enable Raw States", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("RoomOccupiedFeedback")] + public JoinDataComplete RoomOccupiedFeedback = new JoinDataComplete(new JoinData() { JoinNumber = 2, JoinSpan = 1 }, + new JoinMetadata() { Label = "Room Occupied Feedback", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("GraceOccupancyDetectedFeedback")] + public JoinDataComplete GraceOccupancyDetectedFeedback = new JoinDataComplete(new JoinData() { JoinNumber = 3, JoinSpan = 1 }, + new JoinMetadata() { Label = "Grace Occupancy Detected Feedback", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("RoomVacantFeedback")] + public JoinDataComplete RoomVacantFeedback = new JoinDataComplete(new JoinData() { JoinNumber = 4, JoinSpan = 1 }, + new JoinMetadata() { Label = "Room Vacant Feedback", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("RawOccupancyFeedback")] + public JoinDataComplete RawOccupancyFeedback = new JoinDataComplete(new JoinData() { JoinNumber = 5, JoinSpan = 1 }, + new JoinMetadata() { Label = "Raw Occupancy Feedback", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("RawOccupancyPirFeedback")] + public JoinDataComplete RawOccupancyPirFeedback = new JoinDataComplete(new JoinData() { JoinNumber = 6, JoinSpan = 1 }, + new JoinMetadata() { Label = "Raw Occupancy Pir Feedback", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("RawOccupancyUsFeedback")] + public JoinDataComplete RawOccupancyUsFeedback = new JoinDataComplete(new JoinData() { JoinNumber = 7, JoinSpan = 1 }, + new JoinMetadata() { Label = "Raw Occupancy Us Feedback", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("EnableLedFlash")] + public JoinDataComplete EnableLedFlash = new JoinDataComplete(new JoinData() { JoinNumber = 11, JoinSpan = 1 }, + new JoinMetadata() { Label = "Enable Led Flash", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("DisableLedFlash")] + public JoinDataComplete DisableLedFlash = new JoinDataComplete(new JoinData() { JoinNumber = 12, JoinSpan = 1 }, + new JoinMetadata() { Label = "Disable Led Flash", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("EnableShortTimeout")] + public JoinDataComplete EnableShortTimeout = new JoinDataComplete(new JoinData() { JoinNumber = 13, JoinSpan = 1 }, + new JoinMetadata() { Label = "Enable Short Timeout", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("DisableShortTimeout")] + public JoinDataComplete DisableShortTimeout = new JoinDataComplete(new JoinData() { JoinNumber = 14, JoinSpan = 1 }, + new JoinMetadata() { Label = "Disable Short Timeout", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("OrWhenVacated")] + public JoinDataComplete OrWhenVacated = new JoinDataComplete(new JoinData() { JoinNumber = 15, JoinSpan = 1 }, + new JoinMetadata() { Label = "Or When Vacated", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("AndWhenVacated")] + public JoinDataComplete AndWhenVacated = new JoinDataComplete(new JoinData() { JoinNumber = 16, JoinSpan = 1 }, + new JoinMetadata() { Label = "AndWhenVacated", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("EnableUsA")] + public JoinDataComplete EnableUsA = new JoinDataComplete(new JoinData() { JoinNumber = 17, JoinSpan = 1 }, + new JoinMetadata() { Label = "Enable Us A", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("DisableUsA")] + public JoinDataComplete DisableUsA = new JoinDataComplete(new JoinData() { JoinNumber = 18, JoinSpan = 1 }, + new JoinMetadata() { Label = "Disable Us A", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("EnableUsB")] + public JoinDataComplete EnableUsB = new JoinDataComplete(new JoinData() { JoinNumber = 19, JoinSpan = 1 }, + new JoinMetadata() { Label = "Enable Us B", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("DisableUsB")] + public JoinDataComplete DisableUsB = new JoinDataComplete(new JoinData() { JoinNumber = 20, JoinSpan = 1 }, + new JoinMetadata() { Label = "Disable Us B", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("EnablePir")] + public JoinDataComplete EnablePir = new JoinDataComplete(new JoinData() { JoinNumber = 21, JoinSpan = 1 }, + new JoinMetadata() { Label = "Enable Pir", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("DisablePir")] + public JoinDataComplete DisablePir = new JoinDataComplete(new JoinData() { JoinNumber = 22, JoinSpan = 1 }, + new JoinMetadata() { Label = "Disable Pir", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("IncrementUsInOccupiedState")] + public JoinDataComplete IncrementUsInOccupiedState = new JoinDataComplete(new JoinData() { JoinNumber = 23, JoinSpan = 1 }, + new JoinMetadata() { Label = "Increment Us In OccupiedState", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("DecrementUsInOccupiedState")] + public JoinDataComplete DecrementUsInOccupiedState = new JoinDataComplete(new JoinData() { JoinNumber = 24, JoinSpan = 1 }, + new JoinMetadata() { Label = "Dencrement Us In Occupied State", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("IncrementUsInVacantState")] + public JoinDataComplete IncrementUsInVacantState = new JoinDataComplete(new JoinData() { JoinNumber = 25, JoinSpan = 1 }, + new JoinMetadata() { Label = "Increment Us In VacantState", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("DecrementUsInVacantState")] + public JoinDataComplete DecrementUsInVacantState = new JoinDataComplete(new JoinData() { JoinNumber = 26, JoinSpan = 1 }, + new JoinMetadata() { Label = "Decrement Us In VacantState", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("IncrementPirInOccupiedState")] + public JoinDataComplete IncrementPirInOccupiedState = new JoinDataComplete(new JoinData() { JoinNumber = 27, JoinSpan = 1 }, + new JoinMetadata() { Label = "Increment Pir In Occupied State", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("DecrementPirInOccupiedState")] + public JoinDataComplete DecrementPirInOccupiedState = new JoinDataComplete(new JoinData() { JoinNumber = 28, JoinSpan = 1 }, + new JoinMetadata() { Label = "Decrement Pir In OccupiedState", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("IncrementPirInVacantState")] + public JoinDataComplete IncrementPirInVacantState = new JoinDataComplete(new JoinData() { JoinNumber = 29, JoinSpan = 1 }, + new JoinMetadata() { Label = "Increment Pir In Vacant State", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("DecrementPirInVacantState")] + public JoinDataComplete DecrementPirInVacantState = new JoinDataComplete(new JoinData() { JoinNumber = 30, JoinSpan = 1 }, + new JoinMetadata() { Label = "Decrement Pir In Vacant State", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); + + #endregion + + #region Analog + + [JoinName("Timeout")] + public JoinDataComplete Timeout = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "Timeout", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("TimeoutLocalFeedback")] + public JoinDataComplete TimeoutLocalFeedback = new JoinDataComplete(new JoinData() { JoinNumber = 2, JoinSpan = 1 }, + new JoinMetadata() { Label = "Timeout Local Feedback", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("InternalPhotoSensorValue")] + public JoinDataComplete InternalPhotoSensorValue = new JoinDataComplete(new JoinData() { JoinNumber = 3, JoinSpan = 1 }, + new JoinMetadata() { Label = "Internal PhotoSensor Value", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("UsSensitivityInOccupiedState")] + public JoinDataComplete UsSensitivityInOccupiedState = new JoinDataComplete(new JoinData() { JoinNumber = 5, JoinSpan = 1 }, + new JoinMetadata() { Label = "Us Sensitivity In Occupied State", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("UsSensitivityInVacantState")] + public JoinDataComplete UsSensitivityInVacantState = new JoinDataComplete(new JoinData() { JoinNumber = 6, JoinSpan = 1 }, + new JoinMetadata() { Label = "Us Sensitivity In Vacant State", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("PirSensitivityInOccupiedState")] + public JoinDataComplete PirSensitivityInOccupiedState = new JoinDataComplete(new JoinData() { JoinNumber = 7, JoinSpan = 1 }, + new JoinMetadata() { Label = "Pir Sensitivity In Occupied State", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("PirSensitivityInVacantState")] + public JoinDataComplete PirSensitivityInVacantState = new JoinDataComplete(new JoinData() { JoinNumber = 8, JoinSpan = 1 }, + new JoinMetadata() { Label = "Pir Sensitivity In Vacant State", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog }); + + #endregion + + #region Serial + + [JoinName("Name")] + public JoinDataComplete Name = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + #endregion + + public CenOdtOccupancySensorBaseJoinMap(uint joinStart) + : base(joinStart, typeof(CenOdtOccupancySensorBaseJoinMap)) + { + } + } + +} diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj index e7a5a8ac..4e3e1b41 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj @@ -117,6 +117,7 @@ + diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Essentials Devices Common.csproj b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Essentials Devices Common.csproj index 147ace5b..4b24607c 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Essentials Devices Common.csproj +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Essentials Devices Common.csproj @@ -110,6 +110,7 @@ + diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/CenOdtOccupancySensorBaseController.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/CenOdtOccupancySensorBaseController.cs new file mode 100644 index 00000000..58126fbd --- /dev/null +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/CenOdtOccupancySensorBaseController.cs @@ -0,0 +1,564 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using Crestron.SimplSharpPro.DeviceSupport; +using Crestron.SimplSharpPro.GeneralIO; +using Newtonsoft.Json; +using PepperDash.Core; +using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Config; +using PepperDash.Essentials.Core.Bridges; + +namespace PepperDash.Essentials.Devices.Common.Occupancy +{ + public class CenOdtOccupancySensorBaseController : CrestronGenericBridgeableBaseDevice, IOccupancyStatusProvider + { + public CenOdtCPoe OccSensor { get; private set; } + + public BoolFeedback RoomIsOccupiedFeedback { get; private set; } + + public BoolFeedback GraceOccupancyDetectedFeedback { get; private set; } + + public BoolFeedback RawOccupancyFeedback { get; private set; } + + public BoolFeedback PirSensorEnabledFeedback { get; private set; } + + public BoolFeedback LedFlashEnabledFeedback { get; private set; } + + public BoolFeedback ShortTimeoutEnabledFeedback { get; private set; } + + public IntFeedback PirSensitivityInVacantStateFeedback { get; private set; } + + public IntFeedback PirSensitivityInOccupiedStateFeedback { get; private set; } + + public IntFeedback CurrentTimeoutFeedback { get; private set; } + + public IntFeedback RemoteTimeoutFeedback { get; private set; } + + public IntFeedback InternalPhotoSensorValue { get; set; } + + public IntFeedback ExternalPhotoSensorValue { get; set; } + + public BoolFeedback OrWhenVacatedFeedback { get; private set; } + + public BoolFeedback AndWhenVacatedFeedback { get; private set; } + + public BoolFeedback UltrasonicAEnabledFeedback { get; private set; } + + public BoolFeedback UltrasonicBEnabledFeedback { get; private set; } + + public IntFeedback UltrasonicSensitivityInVacantStateFeedback { get; private set; } + + public IntFeedback UltrasonicSensitivityInOccupiedStateFeedback { get; private set; } + + public BoolFeedback RawOccupancyPirFeedback { get; private set; } + + public BoolFeedback RawOccupancyUsFeedback { get; private set; } + + // Debug properties + public bool InTestMode { get; private set; } + + public bool TestRoomIsOccupiedFeedback { get; private set; } + + public Func RoomIsOccupiedFeedbackFunc + { + get + { + return () => InTestMode ? TestRoomIsOccupiedFeedback : OccSensor.OccupancyDetectedFeedback.BoolValue; + } + } + + public CenOdtOccupancySensorBaseController(string key, string name, CenOdtCPoe sensor) + : base(key, name, sensor) + { + OccSensor = sensor; + + RoomIsOccupiedFeedback = new BoolFeedback(RoomIsOccupiedFeedbackFunc); + + PirSensorEnabledFeedback = new BoolFeedback(() => OccSensor.PassiveInfraredSensorEnabledFeedback.BoolValue); + + LedFlashEnabledFeedback = new BoolFeedback(() => OccSensor.LedFlashEnabledFeedback.BoolValue); + + ShortTimeoutEnabledFeedback = new BoolFeedback(() => OccSensor.ShortTimeoutEnabledFeedback.BoolValue); + + PirSensitivityInVacantStateFeedback = new IntFeedback(() => (int)OccSensor.PassiveInfraredSensorSensitivityInVacantStateFeedback); + + PirSensitivityInOccupiedStateFeedback = new IntFeedback(() => (int)OccSensor.PassiveInfraredSensorSensitivityInOccupiedStateFeedback); + + CurrentTimeoutFeedback = new IntFeedback(() => OccSensor.CurrentTimeoutFeedback.UShortValue); + + RemoteTimeoutFeedback = new IntFeedback(() => OccSensor.RemoteTimeout.UShortValue); + + GraceOccupancyDetectedFeedback = new BoolFeedback(() => OccSensor.GraceOccupancyDetectedFeedback.BoolValue); + + RawOccupancyFeedback = new BoolFeedback(() => OccSensor.RawOccupancyDetectedFeedback.BoolValue); + + InternalPhotoSensorValue = new IntFeedback(() => OccSensor.InternalPhotoSensorValueFeedback.UShortValue); + + //ExternalPhotoSensorValue = new IntFeedback(() => OccSensor.ex.UShortValue); + + AndWhenVacatedFeedback = new BoolFeedback(() => OccSensor.AndWhenVacatedFeedback.BoolValue); + + OrWhenVacatedFeedback = new BoolFeedback(() => OccSensor.OrWhenVacatedFeedback.BoolValue); + + UltrasonicAEnabledFeedback = new BoolFeedback(() => OccSensor.UltrasonicSensorSideAEnabledFeedback.BoolValue); + + UltrasonicBEnabledFeedback = new BoolFeedback(() => OccSensor.UltrasonicSensorSideBEnabledFeedback.BoolValue); + + RawOccupancyPirFeedback = new BoolFeedback(() => OccSensor.RawOccupancyDetectedByPassiveInfraredSensorFeedback.BoolValue); + + RawOccupancyUsFeedback = new BoolFeedback(() => OccSensor.RawOccupancyDetectedByUltrasonicSensorFeedback.BoolValue); + + UltrasonicSensitivityInVacantStateFeedback = new IntFeedback(() => (int)OccSensor.UltrasonicSensorSensitivityInVacantStateFeedback); + + UltrasonicSensitivityInOccupiedStateFeedback = new IntFeedback(() => (int)OccSensor.UltrasonicSensorSensitivityInOccupiedStateFeedback); + + OccSensor.BaseEvent += new Crestron.SimplSharpPro.BaseEventHandler(OccSensor_BaseEvent); + + OccSensor.CenOccupancySensorChange += new GenericEventHandler(OccSensor_CenOccupancySensorChange); + + } + + + + + + + /// + /// Catches events for feedbacks on the base class. Any extending wrapper class should call this delegate after it checks for it's own event IDs. + /// + /// + /// + protected virtual void OccSensor_CenOccupancySensorChange(object device, GenericEventArgs args) + { + if (args.EventId == GlsOccupancySensorBase.PirEnabledFeedbackEventId) + PirSensorEnabledFeedback.FireUpdate(); + else if (args.EventId == GlsOccupancySensorBase.LedFlashEnabledFeedbackEventId) + LedFlashEnabledFeedback.FireUpdate(); + else if (args.EventId == GlsOccupancySensorBase.ShortTimeoutEnabledFeedbackEventId) + ShortTimeoutEnabledFeedback.FireUpdate(); + else if (args.EventId == GlsOccupancySensorBase.PirSensitivityInOccupiedStateFeedbackEventId) + PirSensitivityInOccupiedStateFeedback.FireUpdate(); + else if (args.EventId == GlsOccupancySensorBase.PirSensitivityInVacantStateFeedbackEventId) + PirSensitivityInVacantStateFeedback.FireUpdate(); + else if (args.EventId == GlsOccupancySensorBase.RawOccupancyPirFeedbackEventId) + RawOccupancyPirFeedback.FireUpdate(); + else if (args.EventId == GlsOccupancySensorBase.RawOccupancyUsFeedbackEventId) + RawOccupancyUsFeedback.FireUpdate(); + } + + protected virtual void OccSensor_BaseEvent(Crestron.SimplSharpPro.GenericBase device, Crestron.SimplSharpPro.BaseEventArgs args) + { + Debug.Console(2, this, "PoEOccupancySensorChange EventId: {0}", args.EventId); + + if (args.EventId == Crestron.SimplSharpPro.GeneralIO.GlsOccupancySensorBase.RoomOccupiedFeedbackEventId + || args.EventId == Crestron.SimplSharpPro.GeneralIO.GlsOccupancySensorBase.RoomVacantFeedbackEventId) + { + Debug.Console(1, this, "Occupancy State: {0}", OccSensor.OccupancyDetectedFeedback.BoolValue); + RoomIsOccupiedFeedback.FireUpdate(); + } + else if (args.EventId == GlsOccupancySensorBase.TimeoutFeedbackEventId) + CurrentTimeoutFeedback.FireUpdate(); + else if (args.EventId == GlsOccupancySensorBase.TimeoutLocalFeedbackEventId) + RemoteTimeoutFeedback.FireUpdate(); + else if (args.EventId == GlsOccupancySensorBase.GraceOccupancyDetectedFeedbackEventId) + GraceOccupancyDetectedFeedback.FireUpdate(); + else if (args.EventId == GlsOccupancySensorBase.RawOccupancyFeedbackEventId) + RawOccupancyFeedback.FireUpdate(); + else if (args.EventId == GlsOccupancySensorBase.InternalPhotoSensorValueFeedbackEventId) + InternalPhotoSensorValue.FireUpdate(); + else if (args.EventId == GlsOccupancySensorBase.ExternalPhotoSensorValueFeedbackEventId) + ExternalPhotoSensorValue.FireUpdate(); + else if (args.EventId == GlsOccupancySensorBase.AndWhenVacatedFeedbackEventId) + AndWhenVacatedFeedback.FireUpdate(); + else if (args.EventId == GlsOccupancySensorBase.OrWhenVacatedFeedbackEventId) + OrWhenVacatedFeedback.FireUpdate(); + else if (args.EventId == GlsOccupancySensorBase.UsAEnabledFeedbackEventId) + UltrasonicAEnabledFeedback.FireUpdate(); + else if (args.EventId == GlsOccupancySensorBase.UsBEnabledFeedbackEventId) + UltrasonicBEnabledFeedback.FireUpdate(); + else if (args.EventId == GlsOccupancySensorBase.UsSensitivityInOccupiedStateFeedbackEventId) + UltrasonicSensitivityInOccupiedStateFeedback.FireUpdate(); + else if (args.EventId == GlsOccupancySensorBase.UsSensitivityInVacantStateFeedbackEventId) + UltrasonicSensitivityInVacantStateFeedback.FireUpdate(); + } + + public void SetTestMode(bool mode) + { + InTestMode = mode; + + Debug.Console(1, this, "In Mock Mode: '{0}'", InTestMode); + } + + public void SetTestOccupiedState(bool state) + { + if (!InTestMode) + Debug.Console(1, "Mock mode not enabled"); + else + { + TestRoomIsOccupiedFeedback = state; + + RoomIsOccupiedFeedback.FireUpdate(); + } + } + + /// + /// Enables or disables the PIR sensor + /// + /// + public void SetPirEnable(bool state) + { + if (state) + { + OccSensor.EnablePassiveInfraredSensor(); + } + else + { + OccSensor.DisablePassiveInfraredSensor(); + } + } + + /// + /// Enables or disables the LED Flash + /// + /// + public void SetLedFlashEnable(bool state) + { + if (state) + { + OccSensor.EnableLedFlash(); + } + else + { + OccSensor.DisableLedFlash(); + } + } + + /// + /// Enables or disables short timeout based on state + /// + /// + public void SetShortTimeoutState(bool state) + { + if (state) + { + OccSensor.EnableShortTimeout(); + } + else + { + OccSensor.DisableShortTimeout(); + } + } + + public void IncrementPirSensitivityInOccupiedState(bool pressRelease) + { + if ((int)OccSensor.PassiveInfraredSensorSensitivityInOccupiedStateFeedback != 3) + { + OccSensor.PassiveInfraredSensorSensitivityInOccupiedState = OccSensor.PassiveInfraredSensorSensitivityInOccupiedStateFeedback + 1; + } + } + + public void DecrementPirSensitivityInOccupiedState(bool pressRelease) + { + if ((int)OccSensor.PassiveInfraredSensorSensitivityInOccupiedStateFeedback != 0) + { + OccSensor.PassiveInfraredSensorSensitivityInOccupiedState = OccSensor.PassiveInfraredSensorSensitivityInOccupiedStateFeedback - 1; + } + } + + public void IncrementPirSensitivityInVacantState(bool pressRelease) + { + if ((int)OccSensor.PassiveInfraredSensorSensitivityInVacantStateFeedback != 3) + { + OccSensor.PassiveInfraredSensorSensitivityInVacantState = OccSensor.PassiveInfraredSensorSensitivityInVacantStateFeedback + 1; + } + } + + public void DecrementPirSensitivityInVacantState(bool pressRelease) + { + if ((int)OccSensor.PassiveInfraredSensorSensitivityInVacantStateFeedback != 0) + { + OccSensor.PassiveInfraredSensorSensitivityInVacantState = OccSensor.PassiveInfraredSensorSensitivityInVacantStateFeedback - 1; + } + } + + public void IncrementUsSensitivityInOccupiedState(bool pressRelease) + { + if ((int)OccSensor.UltrasonicSensorSensitivityInOccupiedStateFeedback < 3) + { + OccSensor.UltrasonicSensorSensitivityInOccupiedState = OccSensor.UltrasonicSensorSensitivityInOccupiedStateFeedback + 1; + } + else if ((int)OccSensor.UltrasonicSensorSensitivityInOccupiedStateFeedback > 4) + { + OccSensor.UltrasonicSensorSensitivityInOccupiedState = OccSensor.UltrasonicSensorSensitivityInOccupiedStateFeedback - 1; + } + else if ((int)OccSensor.UltrasonicSensorSensitivityInOccupiedStateFeedback == 4) + { + OccSensor.UltrasonicSensorSensitivityInOccupiedState = 0; + } + } + + public void DecrementUsSensitivityInOccupiedState(bool pressRelease) + { + if ((int)OccSensor.UltrasonicSensorSensitivityInOccupiedStateFeedback > 0 + && (int)OccSensor.UltrasonicSensorSensitivityInOccupiedStateFeedback < 4) + { + OccSensor.UltrasonicSensorSensitivityInOccupiedState = OccSensor.UltrasonicSensorSensitivityInOccupiedStateFeedback - 1; + } + else if ((int)OccSensor.UltrasonicSensorSensitivityInOccupiedStateFeedback > 3 + && (int)OccSensor.UltrasonicSensorSensitivityInOccupiedStateFeedback < 7) + { + OccSensor.UltrasonicSensorSensitivityInOccupiedState = OccSensor.UltrasonicSensorSensitivityInOccupiedStateFeedback + 1; + } + } + + public void IncrementUsSensitivityInVacantState(bool pressRelease) + { + if ((int)OccSensor.UltrasonicSensorSensitivityInVacantStateFeedback < 3) + { + OccSensor.UltrasonicSensorSensitivityInVacantState = OccSensor.UltrasonicSensorSensitivityInVacantStateFeedback + 1; + } + else if ((int)OccSensor.UltrasonicSensorSensitivityInVacantStateFeedback > 4) + { + OccSensor.UltrasonicSensorSensitivityInVacantState = OccSensor.UltrasonicSensorSensitivityInVacantStateFeedback - 1; + } + else if ((int)OccSensor.UltrasonicSensorSensitivityInVacantStateFeedback == 4) + { + OccSensor.UltrasonicSensorSensitivityInVacantState = 0; + } + } + + public void DecrementUsSensitivityInVacantState(bool pressRelease) + { + if ((int)OccSensor.UltrasonicSensorSensitivityInVacantStateFeedback > 0 + && (int)OccSensor.UltrasonicSensorSensitivityInVacantStateFeedback < 4) + { + OccSensor.UltrasonicSensorSensitivityInVacantState = OccSensor.UltrasonicSensorSensitivityInVacantStateFeedback - 1; + } + else if ((int)OccSensor.UltrasonicSensorSensitivityInVacantStateFeedback > 3 + && (int)OccSensor.UltrasonicSensorSensitivityInVacantStateFeedback < 7) + { + OccSensor.UltrasonicSensorSensitivityInVacantState = OccSensor.UltrasonicSensorSensitivityInVacantStateFeedback + 1; + } + } + + public void ForceOccupied() + { + OccSensor.ForceOccupied(); + } + + public void ForceVacant() + { + OccSensor.ForceVacant(); + } + + public void EnableRawStates(bool state) + { + if (state) + { + OccSensor.EnableRawStates(); + } + else + OccSensor.DisableRawStates(); + } + + public void SetRemoteTimeout(ushort time) + { + OccSensor.RemoteTimeout.UShortValue = time; + } + + public void SetInternalPhotoSensorMinChange(ushort value) + { + OccSensor.InternalPhotoSensorMinimumChange.UShortValue = value; + } + + /// + /// Sets the OrWhenVacated state + /// + /// + public void SetOrWhenVacatedState(bool state) + { + if (state) + { + OccSensor.OrWhenVacated(); + } + } + + /// + /// Sets the AndWhenVacated state + /// + /// + public void SetAndWhenVacatedState(bool state) + { + if (state) + { + OccSensor.AndWhenVacated(); + } + } + + /// + /// Enables or disables the Ultrasonic A sensor + /// + /// + public void SetUsAEnable(bool state) + { + if (state) + { + OccSensor.EnableUltrasonicSensorSideA(); + } + else + { + OccSensor.DisableUltrasonicSensorSideA(); + } + } + + + /// + /// Enables or disables the Ultrasonic B sensor + /// + /// + public void SetUsBEnable(bool state) + { + if (state) + { + OccSensor.EnableUltrasonicSensorSideB(); + } + else + { + OccSensor.DisableUltrasonicSensorSideB(); + } + } + + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) + { + LinkOccSensorToApi(this, trilist, joinStart, joinMapKey, bridge); + } + + protected void LinkOccSensorToApi(CenOdtOccupancySensorBaseController occController, + BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) + { + CenOdtOccupancySensorBaseJoinMap joinMap = new CenOdtOccupancySensorBaseJoinMap(joinStart); + + var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); + + if (!string.IsNullOrEmpty(joinMapSerialized)) + joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + + + Debug.Console(1, occController, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); + + occController.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.Online.JoinNumber]); + trilist.StringInput[joinMap.Name.JoinNumber].StringValue = occController.Name; + + trilist.OnlineStatusChange += new Crestron.SimplSharpPro.OnlineStatusChangeEventHandler((d, args) => + { + if (args.DeviceOnLine) + { + trilist.StringInput[joinMap.Name.JoinNumber].StringValue = occController.Name; + } + } + ); + + // Occupied status + trilist.SetSigTrueAction(joinMap.ForceOccupied.JoinNumber, new Action(() => occController.ForceOccupied())); + trilist.SetSigTrueAction(joinMap.ForceVacant.JoinNumber, new Action(() => occController.ForceVacant())); + occController.RoomIsOccupiedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RoomOccupiedFeedback.JoinNumber]); + occController.RoomIsOccupiedFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.RoomVacantFeedback.JoinNumber]); + occController.RawOccupancyFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyFeedback.JoinNumber]); + trilist.SetBoolSigAction(joinMap.EnableRawStates.JoinNumber, new Action((b) => occController.EnableRawStates(b))); + + // Timouts + trilist.SetUShortSigAction(joinMap.Timeout.JoinNumber, new Action((u) => occController.SetRemoteTimeout(u))); + occController.CurrentTimeoutFeedback.LinkInputSig(trilist.UShortInput[joinMap.Timeout.JoinNumber]); + occController.RemoteTimeoutFeedback.LinkInputSig(trilist.UShortInput[joinMap.TimeoutLocalFeedback.JoinNumber]); + + // LED Flash + trilist.SetSigTrueAction(joinMap.EnableLedFlash.JoinNumber, new Action(() => occController.SetLedFlashEnable(true))); + trilist.SetSigTrueAction(joinMap.DisableLedFlash.JoinNumber, new Action(() => occController.SetLedFlashEnable(false))); + occController.LedFlashEnabledFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.EnableLedFlash.JoinNumber]); + + // Short Timeout + trilist.SetSigTrueAction(joinMap.EnableShortTimeout.JoinNumber, new Action(() => occController.SetShortTimeoutState(true))); + trilist.SetSigTrueAction(joinMap.DisableShortTimeout.JoinNumber, new Action(() => occController.SetShortTimeoutState(false))); + occController.ShortTimeoutEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableShortTimeout.JoinNumber]); + + // PIR Sensor + trilist.SetSigTrueAction(joinMap.EnablePir.JoinNumber, new Action(() => occController.SetPirEnable(true))); + trilist.SetSigTrueAction(joinMap.DisablePir.JoinNumber, new Action(() => occController.SetPirEnable(false))); + occController.PirSensorEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnablePir.JoinNumber]); + + // PIR Sensitivity in Occupied State + trilist.SetBoolSigAction(joinMap.IncrementPirInOccupiedState.JoinNumber, new Action((b) => occController.IncrementPirSensitivityInOccupiedState(b))); + trilist.SetBoolSigAction(joinMap.DecrementPirInOccupiedState.JoinNumber, new Action((b) => occController.DecrementPirSensitivityInOccupiedState(b))); + occController.PirSensitivityInOccupiedStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.PirSensitivityInOccupiedState.JoinNumber]); + + // PIR Sensitivity in Vacant State + trilist.SetBoolSigAction(joinMap.IncrementPirInVacantState.JoinNumber, new Action((b) => occController.IncrementPirSensitivityInVacantState(b))); + trilist.SetBoolSigAction(joinMap.DecrementPirInVacantState.JoinNumber, new Action((b) => occController.DecrementPirSensitivityInVacantState(b))); + occController.PirSensitivityInVacantStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.PirSensitivityInVacantState.JoinNumber]); + + // OR When Vacated + trilist.SetBoolSigAction(joinMap.OrWhenVacated.JoinNumber, new Action((b) => occController.SetOrWhenVacatedState(b))); + occController.OrWhenVacatedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.OrWhenVacated.JoinNumber]); + + // AND When Vacated + trilist.SetBoolSigAction(joinMap.AndWhenVacated.JoinNumber, new Action((b) => occController.SetAndWhenVacatedState(b))); + occController.AndWhenVacatedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.AndWhenVacated.JoinNumber]); + + // Ultrasonic A Sensor + trilist.SetSigTrueAction(joinMap.EnableUsA.JoinNumber, new Action(() => occController.SetUsAEnable(true))); + trilist.SetSigTrueAction(joinMap.DisableUsA.JoinNumber, new Action(() => occController.SetUsAEnable(false))); + occController.UltrasonicAEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableUsA.JoinNumber]); + + // Ultrasonic B Sensor + trilist.SetSigTrueAction(joinMap.EnableUsB.JoinNumber, new Action(() => occController.SetUsBEnable(true))); + trilist.SetSigTrueAction(joinMap.DisableUsB.JoinNumber, new Action(() => occController.SetUsBEnable(false))); + occController.UltrasonicAEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableUsB.JoinNumber]); + + // US Sensitivity in Occupied State + trilist.SetBoolSigAction(joinMap.IncrementUsInOccupiedState.JoinNumber, new Action((b) => occController.IncrementUsSensitivityInOccupiedState(b))); + trilist.SetBoolSigAction(joinMap.DecrementUsInOccupiedState.JoinNumber, new Action((b) => occController.DecrementUsSensitivityInOccupiedState(b))); + occController.UltrasonicSensitivityInOccupiedStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.UsSensitivityInOccupiedState.JoinNumber]); + + // US Sensitivity in Vacant State + trilist.SetBoolSigAction(joinMap.IncrementUsInVacantState.JoinNumber, new Action((b) => occController.IncrementUsSensitivityInVacantState(b))); + trilist.SetBoolSigAction(joinMap.DecrementUsInVacantState.JoinNumber, new Action((b) => occController.DecrementUsSensitivityInVacantState(b))); + occController.UltrasonicSensitivityInVacantStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.UsSensitivityInVacantState.JoinNumber]); + + //Sensor Raw States + occController.RawOccupancyPirFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyPirFeedback.JoinNumber]); + occController.RawOccupancyUsFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyUsFeedback.JoinNumber]); + + } + + public class CenOdtOccupancySensorBaseControllerFactory : EssentialsDeviceFactory + { + public CenOdtOccupancySensorBaseControllerFactory() + { + TypeNames = new List() { "cenodtcpoe", "cenodtocc" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new GlsOccupancySensorBaseController Device"); + + var typeName = dc.Type.ToLower(); + var key = dc.Key; + var name = dc.Name; + var comm = CommFactory.GetControlPropertiesConfig(dc); + + var occSensor = new CenOdtCPoe(comm.IpIdInt, Global.ControlSystem); + + if (occSensor == null) + { + Debug.Console(0, "ERROR: Unable to create Occupancy Sensor Device. Key: '{0}'", key); + return null; + } + + return new CenOdtOccupancySensorBaseController(key, name, occSensor); + } + } + } +} \ No newline at end of file From c6e511131b9b6591619789d469056955d90fdd43 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Fri, 8 May 2020 09:03:32 -0600 Subject: [PATCH 130/156] removes fetch tags step for Master branch workflow --- .github/workflows/master.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index a362ea47..87da915e 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -32,9 +32,6 @@ jobs: auth_header="$(git config --local --get http.https://github.com/.extraheader)" git submodule sync --recursive git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1 - # Fetch all tags - - name: Fetch tags - run: git fetch --tags # Generate the appropriate version number - name: Set Version Number shell: powershell From 281bfc4147f3d0571bdd60a26b1891d1ae1c0792 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Fri, 8 May 2020 09:04:54 -0600 Subject: [PATCH 131/156] Adds *.dll to the initial file search This is to allow for capturing Crestron .dlls and including them to make adding references from the build repo easier. --- .github/scripts/ZipBuildOutput.ps1 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/scripts/ZipBuildOutput.ps1 b/.github/scripts/ZipBuildOutput.ps1 index ac87aeb7..5ca867ef 100644 --- a/.github/scripts/ZipBuildOutput.ps1 +++ b/.github/scripts/ZipBuildOutput.ps1 @@ -10,7 +10,7 @@ Get-ChildItem ($destination) $exclusions = @(git submodule foreach --quiet 'echo $name') # Trying to get any .json schema files (not currently working) # Gets any files with the listed extensions. -Get-ChildItem -recurse -Path "$($Env:GITHUB_WORKSPACE)" -include "*.clz", "*.cpz", "*.cplz" | ForEach-Object { +Get-ChildItem -recurse -Path "$($Env:GITHUB_WORKSPACE)" -include "*.clz", "*.cpz", "*.cplz", "*.dll" | ForEach-Object { $allowed = $true; # Exclude any files in submodules foreach ($exclude in $exclusions) { @@ -28,7 +28,8 @@ Write-Host "Getting matching files..." # Get any files from the output folder that match the following extensions Get-ChildItem -Path $destination | Where-Object { ($_.Extension -eq ".clz") -or ($_.Extension -eq ".cpz" -or ($_.Extension -eq ".cplz")) } | ForEach-Object { # Replace the extensions with dll and xml and create an array - $filenames = @($($_ -replace "cpz|clz|cplz", "dll"), $($_ -replace "cpz|clz|cplz", "xml")) + # Removed dll file capture, as previous step should capture all of them. Add if needed-> $($_ -replace "cpz|clz|cplz", "dll"), + $filenames = @($($_ -replace "cpz|clz|cplz", "xml")) Write-Host "Filenames:" Write-Host $filenames if ($filenames.length -gt 0) { From 04e159c1d10603c46f6cab7bf5c0c9b95bde3ce8 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Fri, 8 May 2020 10:46:23 -0500 Subject: [PATCH 132/156] Added bridge.AddJoinMap(Key, joinMap); to each LinkToApi method --- .../JoinMaps/AirMediaControllerJoinMap.cs | 18 +- .../JoinMaps/C2nRthsControllerJoinMap.cs | 18 +- .../DmpsAudioOutputControllerJoinMap.cs | 28 +- .../Config/Comm and IR/GenericComm.cs | 2 + .../Crestron IO/C2nRts/C2nRthsController.cs | 163 +- .../Inputs/GenericDigitalInputDevice.cs | 4 +- .../Crestron IO/Relay/GenericRelayDevice.cs | 4 +- .../StatusSign/StatusSignController.cs | 4 +- .../Display/DisplayBase.cs | 4 +- .../Lighting/LightingBase.cs | 4 +- .../Monitoring/SystemMonitorController.cs | 4 +- .../AirMedia/AirMediaController.cs | 2 + .../Chassis/DmBladeChassisController.cs | 2 +- .../Chassis/DmChassisController.cs | 2570 +++++++++-------- .../Chassis/DmpsAudioOutputController.cs | 5 +- .../Chassis/DmpsRoutingController.cs | 4 +- .../DmLite/HdMdxxxCEController.cs | 4 +- .../Endpoints/Receivers/DmRmcHelper.cs | 4 +- .../Endpoints/Transmitters/DmTxHelpers.cs | 2 + .../GlsOccupancySensorBaseController.cs | 4 +- .../SetTopBox/IRSetTopBoxBase.cs | 2 + .../Streaming/AppleTV.cs | 354 +-- 22 files changed, 1620 insertions(+), 1586 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/AirMediaControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/AirMediaControllerJoinMap.cs index 9a9c56d2..c9a6c2b2 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/AirMediaControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/AirMediaControllerJoinMap.cs @@ -1,11 +1,11 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using PepperDash.Essentials.Core; - -namespace PepperDash.Essentials.Core.Bridges +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Core.Bridges { public class AirMediaControllerJoinMap : JoinMapBaseAdvanced { @@ -62,5 +62,5 @@ namespace PepperDash.Essentials.Core.Bridges { } - } + } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/C2nRthsControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/C2nRthsControllerJoinMap.cs index 29e37906..50429332 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/C2nRthsControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/C2nRthsControllerJoinMap.cs @@ -1,10 +1,10 @@ -using System.Linq; -using Crestron.SimplSharp.Reflection; -using PepperDash.Essentials.Core; - -namespace PepperDash.Essentials.Core.Bridges -{ - public class C2nRthsControllerJoinMap : JoinMapBaseAdvanced +using System.Linq; +using Crestron.SimplSharp.Reflection; +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Core.Bridges +{ + public class C2nRthsControllerJoinMap : JoinMapBaseAdvanced { [JoinName("IsOnline")] public JoinDataComplete IsOnline = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, @@ -29,6 +29,6 @@ namespace PepperDash.Essentials.Core.Bridges public C2nRthsControllerJoinMap(uint joinStart) : base(joinStart, typeof(C2nRthsControllerJoinMap)) { - } - } + } + } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmpsAudioOutputControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmpsAudioOutputControllerJoinMap.cs index 7d2e9cda..89686765 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmpsAudioOutputControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmpsAudioOutputControllerJoinMap.cs @@ -1,15 +1,15 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using PepperDash.Essentials.Core; - -namespace PepperDash.Essentials.Core.Bridges -{ - public class DmpsAudioOutputControllerJoinMap : JoinMapBaseAdvanced - { - +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Core.Bridges +{ + public class DmpsAudioOutputControllerJoinMap : JoinMapBaseAdvanced + { + [JoinName("MasterVolumeLevel")] public JoinDataComplete MasterVolumeLevel = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, new JoinMetadata() { Label = "Master Volume Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog }); @@ -95,6 +95,6 @@ namespace PepperDash.Essentials.Core.Bridges public DmpsAudioOutputControllerJoinMap(uint joinStart) : base(joinStart, typeof(DmpsAudioOutputControllerJoinMap)) { - } - } + } + } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericComm.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericComm.cs index 523ffb78..86e59be2 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericComm.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericComm.cs @@ -67,6 +67,8 @@ namespace PepperDash.Essentials.Core if (!string.IsNullOrEmpty(joinMapSerialized)) joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + bridge.AddJoinMap(Key, joinMap); + if (CommPort == null) { Debug.Console(1, this, "Unable to link device '{0}'. CommPort is null", Key); diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/C2nRts/C2nRthsController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/C2nRts/C2nRthsController.cs index 01f1ae8d..728b2487 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/C2nRts/C2nRthsController.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/C2nRts/C2nRthsController.cs @@ -1,64 +1,65 @@ -using System.Collections.Generic; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.DeviceSupport; -using Crestron.SimplSharpPro.GeneralIO; -using Newtonsoft.Json; -using PepperDash.Core; -using PepperDash.Essentials.Core.Bridges; -using PepperDash.Essentials.Core.Config; - - -namespace PepperDash.Essentials.Core.CrestronIO -{ - [Description("Wrapper class for the C2N-RTHS sensor")] - public class C2nRthsController : CrestronGenericBridgeableBaseDevice - { - private readonly C2nRths _device; - - public IntFeedback TemperatureFeedback { get; private set; } - public IntFeedback HumidityFeedback { get; private set; } - - public C2nRthsController(string key, string name, GenericBase hardware) : base(key, name, hardware) - { - _device = hardware as C2nRths; - - TemperatureFeedback = new IntFeedback(() => _device.TemperatureFeedback.UShortValue); - HumidityFeedback = new IntFeedback(() => _device.HumidityFeedback.UShortValue); - - if (_device != null) _device.BaseEvent += DeviceOnBaseEvent; - } - - private void DeviceOnBaseEvent(GenericBase device, BaseEventArgs args) - { - switch (args.EventId) - { - case C2nRths.TemperatureFeedbackEventId: - TemperatureFeedback.FireUpdate(); - break; - case C2nRths.HumidityFeedbackEventId: - HumidityFeedback.FireUpdate(); - break; - } - } - - public void SetTemperatureFormat(bool setToC) - { - _device.TemperatureFormat.BoolValue = setToC; - } - - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) +using System.Collections.Generic; +using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro.DeviceSupport; +using Crestron.SimplSharpPro.GeneralIO; +using Newtonsoft.Json; +using PepperDash.Core; +using PepperDash.Essentials.Core.Bridges; +using PepperDash.Essentials.Core.Config; + + +namespace PepperDash.Essentials.Core.CrestronIO +{ + [Description("Wrapper class for the C2N-RTHS sensor")] + public class C2nRthsController : CrestronGenericBridgeableBaseDevice + { + private readonly C2nRths _device; + + public IntFeedback TemperatureFeedback { get; private set; } + public IntFeedback HumidityFeedback { get; private set; } + + public C2nRthsController(string key, string name, GenericBase hardware) : base(key, name, hardware) { - var joinMap = new C2nRthsControllerJoinMap(joinStart); - - var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); - - if (!string.IsNullOrEmpty(joinMapSerialized)) - joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - - - Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); - - + _device = hardware as C2nRths; + + TemperatureFeedback = new IntFeedback(() => _device.TemperatureFeedback.UShortValue); + HumidityFeedback = new IntFeedback(() => _device.HumidityFeedback.UShortValue); + + if (_device != null) _device.BaseEvent += DeviceOnBaseEvent; + } + + private void DeviceOnBaseEvent(GenericBase device, BaseEventArgs args) + { + switch (args.EventId) + { + case C2nRths.TemperatureFeedbackEventId: + TemperatureFeedback.FireUpdate(); + break; + case C2nRths.HumidityFeedbackEventId: + HumidityFeedback.FireUpdate(); + break; + } + } + + public void SetTemperatureFormat(bool setToC) + { + _device.TemperatureFormat.BoolValue = setToC; + } + + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) + { + var joinMap = new C2nRthsControllerJoinMap(joinStart); + + var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); + + if (!string.IsNullOrEmpty(joinMapSerialized)) + joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + + bridge.AddJoinMap(Key, joinMap); + + Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); + + trilist.SetBoolSigAction(joinMap.TemperatureFormat.JoinNumber, SetTemperatureFormat); @@ -67,25 +68,25 @@ namespace PepperDash.Essentials.Core.CrestronIO TemperatureFeedback.LinkInputSig(trilist.UShortInput[joinMap.Temperature.JoinNumber]); HumidityFeedback.LinkInputSig(trilist.UShortInput[joinMap.Humidity.JoinNumber]); - trilist.StringInput[joinMap.Name.JoinNumber].StringValue = Name; - } - } - - public class C2nRthsControllerFactory : EssentialsDeviceFactory - { - public C2nRthsControllerFactory() - { - TypeNames = new List() { "c2nrths" }; - } - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "Factory Attempting to create new C2N-RTHS Device"); - - var control = CommFactory.GetControlPropertiesConfig(dc); - var cresnetId = control.CresnetIdInt; - - return new C2nRthsController(dc.Key, dc.Name, new C2nRths(cresnetId, Global.ControlSystem)); - } - } + trilist.StringInput[joinMap.Name.JoinNumber].StringValue = Name; + } + } + + public class C2nRthsControllerFactory : EssentialsDeviceFactory + { + public C2nRthsControllerFactory() + { + TypeNames = new List() { "c2nrths" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new C2N-RTHS Device"); + + var control = CommFactory.GetControlPropertiesConfig(dc); + var cresnetId = control.CresnetIdInt; + + return new C2nRthsController(dc.Key, dc.Name, new C2nRths(cresnetId, Global.ControlSystem)); + } + } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericDigitalInputDevice.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericDigitalInputDevice.cs index 542bd8a6..774c7490 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericDigitalInputDevice.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericDigitalInputDevice.cs @@ -50,7 +50,9 @@ namespace PepperDash.Essentials.Core.CrestronIO var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) - joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + + bridge.AddJoinMap(Key, joinMap); try { diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Relay/GenericRelayDevice.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Relay/GenericRelayDevice.cs index 5f03c27d..b79a8253 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Relay/GenericRelayDevice.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Relay/GenericRelayDevice.cs @@ -76,7 +76,9 @@ namespace PepperDash.Essentials.Core.CrestronIO var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) - joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + + bridge.AddJoinMap(Key, joinMap); if (RelayOutput == null) { diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/StatusSign/StatusSignController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/StatusSign/StatusSignController.cs index 0582be76..df8f778a 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/StatusSign/StatusSignController.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/StatusSign/StatusSignController.cs @@ -116,7 +116,9 @@ namespace PepperDash.Essentials.Core.CrestronIO var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) - joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + + bridge.AddJoinMap(Key, joinMap); Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs index 9f528322..90ca9e05 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs @@ -126,7 +126,9 @@ namespace PepperDash.Essentials.Core var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) - joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + + bridge.AddJoinMap(Key, joinMap); Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); Debug.Console(0, "Linking to Display: {0}", displayDevice.Name); diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Lighting/LightingBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Lighting/LightingBase.cs index d649565d..66e90d97 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Lighting/LightingBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Lighting/LightingBase.cs @@ -78,7 +78,9 @@ namespace PepperDash.Essentials.Core.Lighting var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) - joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + + bridge.AddJoinMap(Key, joinMap); Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Monitoring/SystemMonitorController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Monitoring/SystemMonitorController.cs index 292d120c..e9d06304 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Monitoring/SystemMonitorController.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Monitoring/SystemMonitorController.cs @@ -207,7 +207,9 @@ namespace PepperDash.Essentials.Core.Monitoring var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) - joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + + bridge.AddJoinMap(Key, joinMap); Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); Debug.Console(2, this, "Linking API starting at join: {0}", joinStart); diff --git a/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs b/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs index 7dbacb84..72b4bc4c 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs @@ -110,6 +110,8 @@ namespace PepperDash.Essentials.DM.AirMedia if (!string.IsNullOrEmpty(joinMapSerialized)) joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + bridge.AddJoinMap(Key, joinMap); + Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); Debug.Console(0, "Linking to Airmedia: {0}", Name); diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmBladeChassisController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmBladeChassisController.cs index 2637332f..5e9c3151 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmBladeChassisController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmBladeChassisController.cs @@ -580,7 +580,7 @@ namespace PepperDash.Essentials.DM { if (!string.IsNullOrEmpty(joinMapSerialized)) joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - + bridge.AddJoinMap(Key, joinMap); Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs index 83d097e7..0af41f48 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs @@ -1,1171 +1,1173 @@ - -using System; -using System.Collections.Generic; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro.DeviceSupport; -using Crestron.SimplSharpPro.DM; -using Crestron.SimplSharpPro.DM.Cards; -using Crestron.SimplSharpPro.DM.Endpoints; -using Newtonsoft.Json; + +using System; +using System.Collections.Generic; +using Crestron.SimplSharp; +using Crestron.SimplSharpPro.DeviceSupport; +using Crestron.SimplSharpPro.DM; +using Crestron.SimplSharpPro.DM.Cards; +using Crestron.SimplSharpPro.DM.Endpoints; +using 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, IRoutingInputsOutputs, IRouting, IHasFeedback - { - public DMChassisPropertiesConfig PropertiesConfig { get; set; } - - public Switch Chassis { 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 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 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(); - - /// - /// 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); - - // 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); - 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; }); - 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; - - 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; - }); - } - - 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; }); - - InputCardHdcpCapabilityFeedbacks[tempX] = new IntFeedback(() => { - 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 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; - }); - } - } - } - - /// - /// - /// - /// - /// - public void AddInputCard(string type, uint number) - { - Debug.Console(2, this, "Adding input card '{0}', slot {1}", type, number); - - type = type.ToLower(); - - if (type == "dmchd") - { - var inputCard = new DmcHd(number, this.Chassis); - var cecPort = inputCard.HdmiInput as ICec; - AddHdmiInCardPorts(number, cecPort); - } - else if (type == "dmchddsp") - { - var inputCard = new DmcHdDsp(number, this.Chassis); - var cecPort = inputCard.HdmiInput as ICec; - AddHdmiInCardPorts(number, cecPort); - } - else if (type == "dmc4khd") - { - var inputCard = new Dmc4kHd(number, this.Chassis); - var cecPort = inputCard.HdmiInput as ICec; - AddHdmiInCardPorts(number, cecPort); - } - else if (type == "dmc4khddsp") - { - var inputCard = new Dmc4kHdDsp(number, this.Chassis); - var cecPort = inputCard.HdmiInput as ICec; - AddHdmiInCardPorts(number, cecPort); - } - else if (type == "dmc4kzhd") - { - var inputCard = new Dmc4kzHd(number, this.Chassis); - var cecPort = inputCard.HdmiInput as ICec; - AddHdmiInCardPorts(number, cecPort); - } - else if (type == "dmc4kzhddsp") - { - var inputCard = new Dmc4kzHdDsp(number, this.Chassis); - var cecPort = inputCard.HdmiInput as ICec; - AddHdmiInCardPorts(number, cecPort); - } - else if (type == "dmcc") - { - var inputCard = new DmcC(number, this.Chassis); - var cecPort = inputCard.DmInput as ICec; - AddDmInCardPorts(number, cecPort); - } - else if (type == "dmccdsp") - { - var inputCard = new DmcCDsp(number, this.Chassis); - var cecPort = inputCard.DmInput as ICec; - AddDmInCardPorts(number, cecPort); - } - else if (type == "dmc4kc") - { - var inputCard = new Dmc4kC(number, this.Chassis); - var cecPort = inputCard.DmInput as ICec; - AddDmInCardPorts(number, cecPort); - } - else if (type == "dmc4kcdsp") - { - var inputCard = new Dmc4kCDsp(number, this.Chassis); - var cecPort = inputCard.DmInput as ICec; - AddDmInCardPorts(number, cecPort); - } - else if (type == "dmc4kzc") - { - var inputCard = new Dmc4kzC(number, this.Chassis); - var cecPort = inputCard.DmInput as ICec; - AddDmInCardPorts(number, cecPort); - } - else if (type == "dmc4kzcdsp") - { - var inputCard = new Dmc4kzCDsp(number, this.Chassis); - var cecPort = inputCard.DmInput as ICec; - AddDmInCardPorts(number, cecPort); - } - else if (type == "dmccat") - { - new DmcCat(number, this.Chassis); - AddDmInCardPorts(number); - } - else if (type == "dmccatdsp") - { - new DmcCatDsp(number, this.Chassis); - AddDmInCardPorts(number); - } - else if (type == "dmcs") - { - new DmcS(number, Chassis); - AddInputPortWithDebug(number, "dmIn", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmMmFiber); - AddInCardHdmiAndAudioLoopPorts(number); - } - else if (type == "dmcsdsp") - { - new DmcSDsp(number, Chassis); - AddInputPortWithDebug(number, "dmIn", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmMmFiber); - AddInCardHdmiAndAudioLoopPorts(number); - } - else if (type == "dmcs2") - { - new DmcS2(number, Chassis); - AddInputPortWithDebug(number, "dmIn", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmSmFiber); - AddInCardHdmiAndAudioLoopPorts(number); - } - else if (type == "dmcs2dsp") - { - new DmcS2Dsp(number, Chassis); - AddInputPortWithDebug(number, "dmIn", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmSmFiber); - AddInCardHdmiAndAudioLoopPorts(number); - } - else if (type == "dmcsdi") - { - new DmcSdi(number, Chassis); - AddInputPortWithDebug(number, "sdiIn", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Sdi); - AddOutputPortWithDebug(string.Format("inputCard{0}", number), "sdiOut", eRoutingSignalType.Audio | eRoutingSignalType.Video, - eRoutingPortConnectionType.Sdi, null); - AddInCardHdmiAndAudioLoopPorts(number); - } - else if (type == "dmcdvi") - { - new DmcDvi(number, Chassis); - AddInputPortWithDebug(number, "dviIn", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Dvi); - AddInputPortWithDebug(number, "audioIn", eRoutingSignalType.Audio, eRoutingPortConnectionType.LineAudio); - AddInCardHdmiLoopPort(number); - } - else if (type == "dmcvga") - { - new DmcVga(number, Chassis); - AddInputPortWithDebug(number, "vgaIn", eRoutingSignalType.Video, eRoutingPortConnectionType.Vga); - AddInputPortWithDebug(number, "audioIn", eRoutingSignalType.Audio, eRoutingPortConnectionType.LineAudio); - AddInCardHdmiLoopPort(number); - } - else if (type == "dmcvidbnc") - { - new DmcVidBnc(number, Chassis); - AddInputPortWithDebug(number, "componentIn", eRoutingSignalType.Video, eRoutingPortConnectionType.Component); - AddInputPortWithDebug(number, "audioIn", eRoutingSignalType.Audio, eRoutingPortConnectionType.LineAudio); - AddInCardHdmiLoopPort(number); - } - else if (type == "dmcvidrcaa") - { - new DmcVidRcaA(number, Chassis); - AddInputPortWithDebug(number, "componentIn", eRoutingSignalType.Video, eRoutingPortConnectionType.Component); - AddInputPortWithDebug(number, "audioIn", eRoutingSignalType.Audio, eRoutingPortConnectionType.LineAudio); - AddInCardHdmiLoopPort(number); - } - else if (type == "dmcvidrcad") - { - new DmcVidRcaD(number, Chassis); - AddInputPortWithDebug(number, "componentIn", eRoutingSignalType.Video, eRoutingPortConnectionType.Component); - AddInputPortWithDebug(number, "audioIn", eRoutingSignalType.Audio, eRoutingPortConnectionType.DigitalAudio); - AddInCardHdmiLoopPort(number); - } - else if (type == "dmcvid4") - { - 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); - } - else if (type == "dmcstr") - { - new DmcStr(number, Chassis); - AddInputPortWithDebug(number, "streamIn", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Streaming); - AddInCardHdmiAndAudioLoopPorts(number); - } - } - - 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 AddHdmiInCardPorts(uint number, ICec cecPort) - { - AddInputPortWithDebug(number, "hdmiIn", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, cecPort); - 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); - if (type == "dmc4khdo") - { - var outputCard = new Dmc4kHdoSingle(number, Chassis); - var cecPort1 = outputCard.Card1.HdmiOutput; - var cecPort2 = outputCard.Card2.HdmiOutput; - AddDmcHdoPorts(number, cecPort1, cecPort2); - } - else if (type == "dmchdo") - { - var outputCard = new DmcHdoSingle(number, Chassis); - var cecPort1 = outputCard.Card1.HdmiOutput; - var cecPort2 = outputCard.Card2.HdmiOutput; - AddDmcHdoPorts(number, cecPort1, cecPort2); - } - else if (type == "dmc4kcohd") - { - var outputCard = new Dmc4kCoHdSingle(number, Chassis); - var cecPort1 = outputCard.Card1.HdmiOutput; - AddDmcCoPorts(number, cecPort1); - } - else if (type == "dmc4kzcohd") - { - var outputCard = new Dmc4kzCoHdSingle(number, Chassis); - var cecPort1 = outputCard.Card1.HdmiOutput; - AddDmcCoPorts(number, cecPort1); - } - else if (type == "dmccohd") - { - var outputCard = new DmcCoHdSingle(number, Chassis); - var cecPort1 = outputCard.Card1.HdmiOutput; - AddDmcCoPorts(number, cecPort1); - } - else if (type == "dmccatohd") - { - var outputCard = new DmcCatoHdSingle(number, Chassis); - var cecPort1 = outputCard.Card1.HdmiOutput; - AddDmcCoPorts(number, cecPort1); - } - else if (type == "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, 2 * (number - 1) + 1); - AddOutputPortWithDebug(string.Format("outputCard{0}", number), "hdmiOut1", eRoutingSignalType.Audio | eRoutingSignalType.Video, - eRoutingPortConnectionType.Hdmi, 2 * (number - 1) + 1, cecPort1); - AddOutputPortWithDebug(string.Format("outputCard{0}", number), "dmOut2", eRoutingSignalType.Audio | eRoutingSignalType.Video, - eRoutingPortConnectionType.DmMmFiber, 2 * (number - 1) + 2); - } - else if (type == "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, 2 * (number - 1) + 1); - AddOutputPortWithDebug(string.Format("outputCard{0}", number), "hdmiOut1", eRoutingSignalType.Audio | eRoutingSignalType.Video, - eRoutingPortConnectionType.Hdmi, 2 * (number - 1) + 1, cecPort1); - AddOutputPortWithDebug(string.Format("outputCard{0}", number), "dmOut2", eRoutingSignalType.Audio | eRoutingSignalType.Video, - eRoutingPortConnectionType.DmSmFiber, 2 * (number - 1) + 2); - } - else if (type == "dmcstro") - { - var outputCard = new DmcStroSingle(number, Chassis); - AddOutputPortWithDebug(string.Format("outputCard{0}", number), "streamOut", eRoutingSignalType.Audio | eRoutingSignalType.Video, - eRoutingPortConnectionType.Streaming, 2 * (number - 1) + 1); - } - - else - Debug.Console(1, this, " WARNING: Output card type '{0}' is not available", type); - } - - void AddDmcHdoPorts(uint number, ICec cecPort1, ICec cecPort2) - { - AddOutputPortWithDebug(string.Format("outputCard{0}", number), "hdmiOut1", eRoutingSignalType.Audio | eRoutingSignalType.Video, - eRoutingPortConnectionType.Hdmi, 2 * (number - 1) + 1, cecPort1); - AddOutputPortWithDebug(string.Format("outputCard{0}", number), "audioOut1", eRoutingSignalType.Audio, eRoutingPortConnectionType.LineAudio, - 2 * (number - 1) + 1); - AddOutputPortWithDebug(string.Format("outputCard{0}", number), "hdmiOut2", eRoutingSignalType.Audio | eRoutingSignalType.Video, - eRoutingPortConnectionType.Hdmi, 2 * (number - 1) + 2, cecPort2); - AddOutputPortWithDebug(string.Format("outputCard{0}", number), "audioOut2", eRoutingSignalType.Audio, eRoutingPortConnectionType.LineAudio, - 2 * (number - 1) + 2); - } - - void AddDmcCoPorts(uint number, ICec cecPort1) - { - AddOutputPortWithDebug(string.Format("outputCard{0}", number), "dmOut1", eRoutingSignalType.Audio | eRoutingSignalType.Video, - eRoutingPortConnectionType.DmCat, 2 * (number - 1) + 1); - AddOutputPortWithDebug(string.Format("outputCard{0}", number), "hdmiOut1", eRoutingSignalType.Audio | eRoutingSignalType.Video, - eRoutingPortConnectionType.Hdmi, 2 * (number - 1) + 1, cecPort1); - AddOutputPortWithDebug(string.Format("outputCard{0}", number), "dmOut2", eRoutingSignalType.Audio | eRoutingSignalType.Video, - eRoutingPortConnectionType.DmCat, 2 * (number - 1) + 2); - } - - /// - /// Adds InputPort - /// - void AddInputPortWithDebug(uint cardNum, string portName, eRoutingSignalType sigType, eRoutingPortConnectionType portType) - { - 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, cardNum, this); - - InputPorts.Add(inputPort); - } - - /// - /// 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, cardNum, this); - - if (cecPort != null) - inputPort.Port = cecPort; - - InputPorts.Add(inputPort); - } - - /// - /// Adds OutputPort - /// - 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)); - } - - /// - /// 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 (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; - } - } - } - - 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.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 (InputCardHdcpCapabilityFeedbacks[args.Number] != null) - InputCardHdcpCapabilityFeedbacks[args.Number].FireUpdate(); - else - Debug.Console(1, this, "No index of {0} found in InputCardHdcpCapabilityFeedbacks"); - break; - } - default: - { - Debug.Console(2, this, "DMInputChange fired for Input {0} with Unhandled EventId: {1}", args.Number, args.EventId); - break; - } - } - } - - /// - /// - 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: - { - if (Chassis.Outputs[output].VideoOutFeedback != null) - Debug.Console(2, this, "DMSwitchVideo:{0} Routed Input:{1} Output:{2}'", this.Name, Chassis.Outputs[output].VideoOutFeedback.Number, output); - - if (VideoOutputFeedbacks.ContainsKey(output)) - VideoOutputFeedbacks[output].FireUpdate(); - - if (OutputVideoRouteNameFeedbacks.ContainsKey(output)) - OutputVideoRouteNameFeedbacks[output].FireUpdate(); - - break; - } - case DMOutputEventIds.AudioOutEventId: - { - if (Chassis.Outputs[output].AudioOutFeedback != null) - Debug.Console(2, this, "DMSwitchAudio:{0} Routed Input:{1} Output:{2}'", this.Name, Chassis.Outputs[output].AudioOutFeedback.Number, output); - - if (AudioOutputFeedbacks.ContainsKey(output)) - AudioOutputFeedbacks[output].FireUpdate(); - - 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; - } - 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(0, pnt.Number, 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; - - 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 = Convert.ToUInt32(inputSelector); // Cast can sometimes fail - var output = Convert.ToUInt32(outputSelector); - - // Check to see if there's an off timer waiting on this and if so, cancel - var key = new PortNumberType(output, sigType); - if (input == 0) - { - 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; - Chassis.Outputs[output].VideoOut = inCard; - } - - if ((sigType | eRoutingSignalType.Audio) == eRoutingSignalType.Audio) - { - (Chassis as DmMDMnxn).AudioEnter.BoolValue = true; - Chassis.Outputs[output].AudioOut = inCard; - } - - if ((sigType | eRoutingSignalType.UsbOutput) == eRoutingSignalType.UsbOutput) - { - Chassis.USBEnter.BoolValue = true; - if (Chassis.Outputs[output] != null) - Chassis.Outputs[output].USBRoutedTo = inCard; - } - - if ((sigType | eRoutingSignalType.UsbInput) == eRoutingSignalType.UsbInput) - { - Chassis.USBEnter.BoolValue = true; - if (Chassis.Inputs[input] != null) - Chassis.Inputs[input].USBRoutedTo = outCard; - } - } - #endregion - - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) +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, IRoutingInputsOutputs, IRouting, IHasFeedback + { + public DMChassisPropertiesConfig PropertiesConfig { get; set; } + + public Switch Chassis { 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 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 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(); + + /// + /// 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) { - var joinMap = new DmChassisControllerJoinMap(joinStart); - - var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); - - if (!string.IsNullOrEmpty(joinMapSerialized)) - joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - - Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); - - var chassis = Chassis as DmMDMnxn; - + 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); + + // 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); + 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; }); + 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; + + 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; + }); + } + + 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; }); + + InputCardHdcpCapabilityFeedbacks[tempX] = new IntFeedback(() => { + 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 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; + }); + } + } + } + + /// + /// + /// + /// + /// + public void AddInputCard(string type, uint number) + { + Debug.Console(2, this, "Adding input card '{0}', slot {1}", type, number); + + type = type.ToLower(); + + if (type == "dmchd") + { + var inputCard = new DmcHd(number, this.Chassis); + var cecPort = inputCard.HdmiInput as ICec; + AddHdmiInCardPorts(number, cecPort); + } + else if (type == "dmchddsp") + { + var inputCard = new DmcHdDsp(number, this.Chassis); + var cecPort = inputCard.HdmiInput as ICec; + AddHdmiInCardPorts(number, cecPort); + } + else if (type == "dmc4khd") + { + var inputCard = new Dmc4kHd(number, this.Chassis); + var cecPort = inputCard.HdmiInput as ICec; + AddHdmiInCardPorts(number, cecPort); + } + else if (type == "dmc4khddsp") + { + var inputCard = new Dmc4kHdDsp(number, this.Chassis); + var cecPort = inputCard.HdmiInput as ICec; + AddHdmiInCardPorts(number, cecPort); + } + else if (type == "dmc4kzhd") + { + var inputCard = new Dmc4kzHd(number, this.Chassis); + var cecPort = inputCard.HdmiInput as ICec; + AddHdmiInCardPorts(number, cecPort); + } + else if (type == "dmc4kzhddsp") + { + var inputCard = new Dmc4kzHdDsp(number, this.Chassis); + var cecPort = inputCard.HdmiInput as ICec; + AddHdmiInCardPorts(number, cecPort); + } + else if (type == "dmcc") + { + var inputCard = new DmcC(number, this.Chassis); + var cecPort = inputCard.DmInput as ICec; + AddDmInCardPorts(number, cecPort); + } + else if (type == "dmccdsp") + { + var inputCard = new DmcCDsp(number, this.Chassis); + var cecPort = inputCard.DmInput as ICec; + AddDmInCardPorts(number, cecPort); + } + else if (type == "dmc4kc") + { + var inputCard = new Dmc4kC(number, this.Chassis); + var cecPort = inputCard.DmInput as ICec; + AddDmInCardPorts(number, cecPort); + } + else if (type == "dmc4kcdsp") + { + var inputCard = new Dmc4kCDsp(number, this.Chassis); + var cecPort = inputCard.DmInput as ICec; + AddDmInCardPorts(number, cecPort); + } + else if (type == "dmc4kzc") + { + var inputCard = new Dmc4kzC(number, this.Chassis); + var cecPort = inputCard.DmInput as ICec; + AddDmInCardPorts(number, cecPort); + } + else if (type == "dmc4kzcdsp") + { + var inputCard = new Dmc4kzCDsp(number, this.Chassis); + var cecPort = inputCard.DmInput as ICec; + AddDmInCardPorts(number, cecPort); + } + else if (type == "dmccat") + { + new DmcCat(number, this.Chassis); + AddDmInCardPorts(number); + } + else if (type == "dmccatdsp") + { + new DmcCatDsp(number, this.Chassis); + AddDmInCardPorts(number); + } + else if (type == "dmcs") + { + new DmcS(number, Chassis); + AddInputPortWithDebug(number, "dmIn", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmMmFiber); + AddInCardHdmiAndAudioLoopPorts(number); + } + else if (type == "dmcsdsp") + { + new DmcSDsp(number, Chassis); + AddInputPortWithDebug(number, "dmIn", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmMmFiber); + AddInCardHdmiAndAudioLoopPorts(number); + } + else if (type == "dmcs2") + { + new DmcS2(number, Chassis); + AddInputPortWithDebug(number, "dmIn", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmSmFiber); + AddInCardHdmiAndAudioLoopPorts(number); + } + else if (type == "dmcs2dsp") + { + new DmcS2Dsp(number, Chassis); + AddInputPortWithDebug(number, "dmIn", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmSmFiber); + AddInCardHdmiAndAudioLoopPorts(number); + } + else if (type == "dmcsdi") + { + new DmcSdi(number, Chassis); + AddInputPortWithDebug(number, "sdiIn", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Sdi); + AddOutputPortWithDebug(string.Format("inputCard{0}", number), "sdiOut", eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.Sdi, null); + AddInCardHdmiAndAudioLoopPorts(number); + } + else if (type == "dmcdvi") + { + new DmcDvi(number, Chassis); + AddInputPortWithDebug(number, "dviIn", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Dvi); + AddInputPortWithDebug(number, "audioIn", eRoutingSignalType.Audio, eRoutingPortConnectionType.LineAudio); + AddInCardHdmiLoopPort(number); + } + else if (type == "dmcvga") + { + new DmcVga(number, Chassis); + AddInputPortWithDebug(number, "vgaIn", eRoutingSignalType.Video, eRoutingPortConnectionType.Vga); + AddInputPortWithDebug(number, "audioIn", eRoutingSignalType.Audio, eRoutingPortConnectionType.LineAudio); + AddInCardHdmiLoopPort(number); + } + else if (type == "dmcvidbnc") + { + new DmcVidBnc(number, Chassis); + AddInputPortWithDebug(number, "componentIn", eRoutingSignalType.Video, eRoutingPortConnectionType.Component); + AddInputPortWithDebug(number, "audioIn", eRoutingSignalType.Audio, eRoutingPortConnectionType.LineAudio); + AddInCardHdmiLoopPort(number); + } + else if (type == "dmcvidrcaa") + { + new DmcVidRcaA(number, Chassis); + AddInputPortWithDebug(number, "componentIn", eRoutingSignalType.Video, eRoutingPortConnectionType.Component); + AddInputPortWithDebug(number, "audioIn", eRoutingSignalType.Audio, eRoutingPortConnectionType.LineAudio); + AddInCardHdmiLoopPort(number); + } + else if (type == "dmcvidrcad") + { + new DmcVidRcaD(number, Chassis); + AddInputPortWithDebug(number, "componentIn", eRoutingSignalType.Video, eRoutingPortConnectionType.Component); + AddInputPortWithDebug(number, "audioIn", eRoutingSignalType.Audio, eRoutingPortConnectionType.DigitalAudio); + AddInCardHdmiLoopPort(number); + } + else if (type == "dmcvid4") + { + 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); + } + else if (type == "dmcstr") + { + new DmcStr(number, Chassis); + AddInputPortWithDebug(number, "streamIn", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Streaming); + AddInCardHdmiAndAudioLoopPorts(number); + } + } + + 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 AddHdmiInCardPorts(uint number, ICec cecPort) + { + AddInputPortWithDebug(number, "hdmiIn", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, cecPort); + 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); + if (type == "dmc4khdo") + { + var outputCard = new Dmc4kHdoSingle(number, Chassis); + var cecPort1 = outputCard.Card1.HdmiOutput; + var cecPort2 = outputCard.Card2.HdmiOutput; + AddDmcHdoPorts(number, cecPort1, cecPort2); + } + else if (type == "dmchdo") + { + var outputCard = new DmcHdoSingle(number, Chassis); + var cecPort1 = outputCard.Card1.HdmiOutput; + var cecPort2 = outputCard.Card2.HdmiOutput; + AddDmcHdoPorts(number, cecPort1, cecPort2); + } + else if (type == "dmc4kcohd") + { + var outputCard = new Dmc4kCoHdSingle(number, Chassis); + var cecPort1 = outputCard.Card1.HdmiOutput; + AddDmcCoPorts(number, cecPort1); + } + else if (type == "dmc4kzcohd") + { + var outputCard = new Dmc4kzCoHdSingle(number, Chassis); + var cecPort1 = outputCard.Card1.HdmiOutput; + AddDmcCoPorts(number, cecPort1); + } + else if (type == "dmccohd") + { + var outputCard = new DmcCoHdSingle(number, Chassis); + var cecPort1 = outputCard.Card1.HdmiOutput; + AddDmcCoPorts(number, cecPort1); + } + else if (type == "dmccatohd") + { + var outputCard = new DmcCatoHdSingle(number, Chassis); + var cecPort1 = outputCard.Card1.HdmiOutput; + AddDmcCoPorts(number, cecPort1); + } + else if (type == "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, 2 * (number - 1) + 1); + AddOutputPortWithDebug(string.Format("outputCard{0}", number), "hdmiOut1", eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.Hdmi, 2 * (number - 1) + 1, cecPort1); + AddOutputPortWithDebug(string.Format("outputCard{0}", number), "dmOut2", eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.DmMmFiber, 2 * (number - 1) + 2); + } + else if (type == "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, 2 * (number - 1) + 1); + AddOutputPortWithDebug(string.Format("outputCard{0}", number), "hdmiOut1", eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.Hdmi, 2 * (number - 1) + 1, cecPort1); + AddOutputPortWithDebug(string.Format("outputCard{0}", number), "dmOut2", eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.DmSmFiber, 2 * (number - 1) + 2); + } + else if (type == "dmcstro") + { + var outputCard = new DmcStroSingle(number, Chassis); + AddOutputPortWithDebug(string.Format("outputCard{0}", number), "streamOut", eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.Streaming, 2 * (number - 1) + 1); + } + + else + Debug.Console(1, this, " WARNING: Output card type '{0}' is not available", type); + } + + void AddDmcHdoPorts(uint number, ICec cecPort1, ICec cecPort2) + { + AddOutputPortWithDebug(string.Format("outputCard{0}", number), "hdmiOut1", eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.Hdmi, 2 * (number - 1) + 1, cecPort1); + AddOutputPortWithDebug(string.Format("outputCard{0}", number), "audioOut1", eRoutingSignalType.Audio, eRoutingPortConnectionType.LineAudio, + 2 * (number - 1) + 1); + AddOutputPortWithDebug(string.Format("outputCard{0}", number), "hdmiOut2", eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.Hdmi, 2 * (number - 1) + 2, cecPort2); + AddOutputPortWithDebug(string.Format("outputCard{0}", number), "audioOut2", eRoutingSignalType.Audio, eRoutingPortConnectionType.LineAudio, + 2 * (number - 1) + 2); + } + + void AddDmcCoPorts(uint number, ICec cecPort1) + { + AddOutputPortWithDebug(string.Format("outputCard{0}", number), "dmOut1", eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.DmCat, 2 * (number - 1) + 1); + AddOutputPortWithDebug(string.Format("outputCard{0}", number), "hdmiOut1", eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.Hdmi, 2 * (number - 1) + 1, cecPort1); + AddOutputPortWithDebug(string.Format("outputCard{0}", number), "dmOut2", eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.DmCat, 2 * (number - 1) + 2); + } + + /// + /// Adds InputPort + /// + void AddInputPortWithDebug(uint cardNum, string portName, eRoutingSignalType sigType, eRoutingPortConnectionType portType) + { + 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, cardNum, this); + + InputPorts.Add(inputPort); + } + + /// + /// 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, cardNum, this); + + if (cecPort != null) + inputPort.Port = cecPort; + + InputPorts.Add(inputPort); + } + + /// + /// Adds OutputPort + /// + 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)); + } + + /// + /// 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 (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; + } + } + } + + 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.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 (InputCardHdcpCapabilityFeedbacks[args.Number] != null) + InputCardHdcpCapabilityFeedbacks[args.Number].FireUpdate(); + else + Debug.Console(1, this, "No index of {0} found in InputCardHdcpCapabilityFeedbacks"); + break; + } + default: + { + Debug.Console(2, this, "DMInputChange fired for Input {0} with Unhandled EventId: {1}", args.Number, args.EventId); + break; + } + } + } + + /// + /// + 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: + { + if (Chassis.Outputs[output].VideoOutFeedback != null) + Debug.Console(2, this, "DMSwitchVideo:{0} Routed Input:{1} Output:{2}'", this.Name, Chassis.Outputs[output].VideoOutFeedback.Number, output); + + if (VideoOutputFeedbacks.ContainsKey(output)) + VideoOutputFeedbacks[output].FireUpdate(); + + if (OutputVideoRouteNameFeedbacks.ContainsKey(output)) + OutputVideoRouteNameFeedbacks[output].FireUpdate(); + + break; + } + case DMOutputEventIds.AudioOutEventId: + { + if (Chassis.Outputs[output].AudioOutFeedback != null) + Debug.Console(2, this, "DMSwitchAudio:{0} Routed Input:{1} Output:{2}'", this.Name, Chassis.Outputs[output].AudioOutFeedback.Number, output); + + if (AudioOutputFeedbacks.ContainsKey(output)) + AudioOutputFeedbacks[output].FireUpdate(); + + 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; + } + 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(0, pnt.Number, 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; + + 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 = Convert.ToUInt32(inputSelector); // Cast can sometimes fail + var output = Convert.ToUInt32(outputSelector); + + // Check to see if there's an off timer waiting on this and if so, cancel + var key = new PortNumberType(output, sigType); + if (input == 0) + { + 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; + Chassis.Outputs[output].VideoOut = inCard; + } + + if ((sigType | eRoutingSignalType.Audio) == eRoutingSignalType.Audio) + { + (Chassis as DmMDMnxn).AudioEnter.BoolValue = true; + Chassis.Outputs[output].AudioOut = inCard; + } + + if ((sigType | eRoutingSignalType.UsbOutput) == eRoutingSignalType.UsbOutput) + { + Chassis.USBEnter.BoolValue = true; + if (Chassis.Outputs[output] != null) + Chassis.Outputs[output].USBRoutedTo = inCard; + } + + if ((sigType | eRoutingSignalType.UsbInput) == eRoutingSignalType.UsbInput) + { + Chassis.USBEnter.BoolValue = true; + if (Chassis.Inputs[input] != null) + Chassis.Inputs[input].USBRoutedTo = outCard; + } + } + #endregion + + 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); + + bridge.AddJoinMap(Key, joinMap); + + Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); + + 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.SetUShortSigAction(joinMap.SystemId.JoinNumber, o => + { + if (chassis != null) + chassis.SystemId.UShortValue = o; }); trilist.SetSigTrueAction(joinMap.SystemId.JoinNumber, () => - { - if (chassis != null) chassis.ApplySystemId(); + { + if (chassis != null) chassis.ApplySystemId(); }); SystemIdFeebdack.LinkInputSig(trilist.UShortInput[joinMap.SystemId.JoinNumber]); - SystemIdBusyFeedback.LinkInputSig(trilist.BooleanInput[joinMap.SystemId.JoinNumber]); - - // Link up outputs - for (uint i = 1; i <= Chassis.NumberOfOutputs; i++) - { + SystemIdBusyFeedback.LinkInputSig(trilist.BooleanInput[joinMap.SystemId.JoinNumber]); + + // Link up outputs + for (uint i = 1; i <= Chassis.NumberOfOutputs; i++) + { var ioSlot = i; - var ioSlotJoin = ioSlot - 1; - + var ioSlotJoin = ioSlot - 1; + // Control trilist.SetUShortSigAction(joinMap.OutputVideo.JoinNumber + ioSlotJoin, o => ExecuteSwitch(o, ioSlot, eRoutingSignalType.Video)); trilist.SetUShortSigAction(joinMap.OutputAudio.JoinNumber + ioSlotJoin, o => ExecuteSwitch(o, ioSlot, eRoutingSignalType.Audio)); trilist.SetUShortSigAction(joinMap.OutputUsb.JoinNumber + ioSlotJoin, o => ExecuteSwitch(o, ioSlot, eRoutingSignalType.UsbOutput)); - trilist.SetUShortSigAction(joinMap.InputUsb.JoinNumber + ioSlotJoin, o => ExecuteSwitch(o, ioSlot, eRoutingSignalType.UsbInput)); - - if (TxDictionary.ContainsKey(ioSlot)) - { - Debug.Console(2, "Creating Tx Feedbacks {0}", ioSlot); - var txKey = TxDictionary[ioSlot]; - var basicTxDevice = DeviceManager.GetDeviceForKey(txKey) as DmTxControllerBase; - - var advancedTxDevice = basicTxDevice; - - if (Chassis is DmMd8x8Cpu3 || Chassis is DmMd8x8Cpu3rps - || Chassis is DmMd16x16Cpu3 || Chassis is DmMd16x16Cpu3rps - || Chassis is DmMd32x32Cpu3 || Chassis is DmMd32x32Cpu3rps) - { - 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 if (advancedTxDevice == null || basicTxDevice != null) - { - 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); - } + trilist.SetUShortSigAction(joinMap.InputUsb.JoinNumber + ioSlotJoin, o => ExecuteSwitch(o, ioSlot, eRoutingSignalType.UsbInput)); - 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; - - if (dmInPortWCec != null) - { - 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 + if (TxDictionary.ContainsKey(ioSlot)) { - 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) + Debug.Console(2, "Creating Tx Feedbacks {0}", ioSlot); + var txKey = TxDictionary[ioSlot]; + var basicTxDevice = DeviceManager.GetDeviceForKey(txKey) as DmTxControllerBase; + + var advancedTxDevice = basicTxDevice; + + if (Chassis is DmMd8x8Cpu3 || Chassis is DmMd8x8Cpu3rps + || Chassis is DmMd16x16Cpu3 || Chassis is DmMd16x16Cpu3rps + || Chassis is DmMd32x32Cpu3 || Chassis is DmMd32x32Cpu3rps) + { + 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 if (advancedTxDevice == null || basicTxDevice != null) + { + 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; + + if (dmInPortWCec != null) + { + 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 (Chassis is DmMd8x8Cpu3 || Chassis is DmMd8x8Cpu3rps - || Chassis is DmMd16x16Cpu3 || Chassis is DmMd16x16Cpu3rps - || Chassis is DmMd32x32Cpu3 || Chassis is DmMd32x32Cpu3rps || hdBaseTDevice != null) + 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 (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) + OutputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline.JoinNumber + ioSlotJoin]); + } + else if (rxDevice != null) { - rxDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline.JoinNumber + ioSlotJoin]); - } - } - + rxDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline.JoinNumber + ioSlotJoin]); + } + } + // Feedback VideoOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputVideo.JoinNumber + ioSlotJoin]); AudioOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputAudio.JoinNumber + ioSlotJoin]); @@ -1177,140 +1179,140 @@ namespace PepperDash.Essentials.DM 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 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; - } - } - - 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 PepperDash.Essentials.DM.DmChassisController. - GetDmChassisController(dc.Key, dc.Name, type, props); - } - else if (type.StartsWith("dmmd128x") || type.StartsWith("dmmd64x")) - { - var props = JsonConvert.DeserializeObject - (dc.Properties.ToString()); - return PepperDash.Essentials.DM.DmBladeChassisController. - GetDmChassisController(dc.Key, dc.Name, type, props); - } - - return null; - } - } - -} - + OutputDisabledByHdcpFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.OutputDisabledByHdcp.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; + } + } + + 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 PepperDash.Essentials.DM.DmChassisController. + GetDmChassisController(dc.Key, dc.Name, type, props); + } + else if (type.StartsWith("dmmd128x") || type.StartsWith("dmmd64x")) + { + var props = JsonConvert.DeserializeObject + (dc.Properties.ToString()); + return PepperDash.Essentials.DM.DmBladeChassisController. + GetDmChassisController(dc.Key, dc.Name, type, props); + } + + return null; + } + } + +} + diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsAudioOutputController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsAudioOutputController.cs index 0f2d6593..cc7fd7e4 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsAudioOutputController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsAudioOutputController.cs @@ -109,8 +109,9 @@ namespace PepperDash.Essentials.DM var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) - joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - + joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + + bridge.AddJoinMap(Key, joinMap); Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs index fd667ca3..7d8ba747 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs @@ -161,7 +161,9 @@ namespace PepperDash.Essentials.DM var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) - joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + + bridge.AddJoinMap(Key, joinMap); Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); diff --git a/essentials-framework/Essentials DM/Essentials_DM/DmLite/HdMdxxxCEController.cs b/essentials-framework/Essentials DM/Essentials_DM/DmLite/HdMdxxxCEController.cs index 94af8bc9..4007e9f5 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/DmLite/HdMdxxxCEController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/DmLite/HdMdxxxCEController.cs @@ -228,7 +228,9 @@ namespace PepperDash.Essentials.DM var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) - joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + + bridge.AddJoinMap(Key, joinMap); Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs index fe71599e..2f7f878c 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs @@ -44,7 +44,9 @@ namespace PepperDash.Essentials.DM var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) - joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + + bridge.AddJoinMap(Key, joinMap); Debug.Console(1, rmc, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs index de2946a9..d8a49717 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs @@ -181,6 +181,8 @@ namespace PepperDash.Essentials.DM if (!string.IsNullOrEmpty(joinMapSerialized)) joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + bridge.AddJoinMap(Key, joinMap); + if (tx.Hardware is DmHDBasedTEndPoint) { Debug.Console(1, tx, "No properties to link. Skipping device {0}", tx.Name); diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOccupancySensorBaseController.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOccupancySensorBaseController.cs index 52194927..e494ab3b 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOccupancySensorBaseController.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOccupancySensorBaseController.cs @@ -265,7 +265,9 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) - joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + + bridge.AddJoinMap(Key, joinMap); Debug.Console(1, occController, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/SetTopBox/IRSetTopBoxBase.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/SetTopBox/IRSetTopBoxBase.cs index cee6178e..8bf690a6 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/SetTopBox/IRSetTopBoxBase.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/SetTopBox/IRSetTopBoxBase.cs @@ -379,6 +379,8 @@ namespace PepperDash.Essentials.Devices.Common if (!string.IsNullOrEmpty(joinMapSerialized)) joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + bridge.AddJoinMap(Key, joinMap); + Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); Debug.Console(0, "Linking to Display: {0}", Name); diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Streaming/AppleTV.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Streaming/AppleTV.cs index 89850376..5d01ccc7 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Streaming/AppleTV.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Streaming/AppleTV.cs @@ -1,184 +1,186 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.DeviceSupport; -using Newtonsoft.Json; -using PepperDash.Core; -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Core.Config; -using PepperDash.Essentials.Core.Bridges; -using PepperDash.Essentials.Core.Routing; - -namespace PepperDash.Essentials.Devices.Common -{ - public class AppleTV : EssentialsBridgeableDevice, IDPad, ITransport, IUiDisplayInfo, IRoutingOutputs - { - - public IrOutputPortController IrPort { get; private set; } - public const string StandardDriverName = "Apple AppleTV-v2.ir"; - public uint DisplayUiType { get { return DisplayUiConstants.TypeAppleTv; } } - - public AppleTV(string key, string name, IrOutputPortController portCont) - : base(key, name) - { - IrPort = portCont; - DeviceManager.AddDevice(portCont); - - HdmiOut = new RoutingOutputPort(RoutingPortNames.HdmiOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, - eRoutingPortConnectionType.Hdmi, null, this); - AnyAudioOut = new RoutingOutputPort(RoutingPortNames.AnyAudioOut, eRoutingSignalType.Audio, - eRoutingPortConnectionType.DigitalAudio, null, this); - OutputPorts = new RoutingPortCollection { HdmiOut, AnyAudioOut }; - } - - - #region IDPad Members - - public void Up(bool pressRelease) - { - IrPort.PressRelease("+", pressRelease); - } - - public void Down(bool pressRelease) - { - IrPort.PressRelease("-", pressRelease); - } - - public void Left(bool pressRelease) - { - IrPort.PressRelease(IROutputStandardCommands.IROut_TRACK_MINUS, pressRelease); - } - - public void Right(bool pressRelease) - { - IrPort.PressRelease(IROutputStandardCommands.IROut_TRACK_PLUS, pressRelease); - } - - public void Select(bool pressRelease) - { - IrPort.PressRelease(IROutputStandardCommands.IROut_ENTER, pressRelease); - } - - public void Menu(bool pressRelease) - { - IrPort.PressRelease("Menu", pressRelease); - } - - public void Exit(bool pressRelease) - { - - } - - #endregion - - #region ITransport Members - - public void Play(bool pressRelease) - { - IrPort.PressRelease("PLAY/PAUSE", pressRelease); - } - - public void Pause(bool pressRelease) - { - IrPort.PressRelease("PLAY/PAUSE", pressRelease); - } - - /// - /// Not implemented - /// - /// - public void Rewind(bool pressRelease) - { - } - - /// - /// Not implemented - /// - /// - public void FFwd(bool pressRelease) - { - } - - /// - /// Not implemented - /// - /// - public void ChapMinus(bool pressRelease) - { - } - - /// - /// Not implemented - /// - /// - public void ChapPlus(bool pressRelease) - { - } - - /// - /// Not implemented - /// - /// - public void Stop(bool pressRelease) - { - } - - /// - /// Not implemented - /// - /// - public void Record(bool pressRelease) - { - } - - #endregion - - #region IRoutingOutputs Members - - public RoutingOutputPort HdmiOut { get; private set; } - public RoutingOutputPort AnyAudioOut { get; private set; } - public RoutingPortCollection OutputPorts { get; private set; } - - #endregion - - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro.DeviceSupport; +using Newtonsoft.Json; +using PepperDash.Core; +using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Config; +using PepperDash.Essentials.Core.Bridges; +using PepperDash.Essentials.Core.Routing; + +namespace PepperDash.Essentials.Devices.Common +{ + public class AppleTV : EssentialsBridgeableDevice, IDPad, ITransport, IUiDisplayInfo, IRoutingOutputs + { + + public IrOutputPortController IrPort { get; private set; } + public const string StandardDriverName = "Apple AppleTV-v2.ir"; + public uint DisplayUiType { get { return DisplayUiConstants.TypeAppleTv; } } + + public AppleTV(string key, string name, IrOutputPortController portCont) + : base(key, name) + { + IrPort = portCont; + DeviceManager.AddDevice(portCont); + + HdmiOut = new RoutingOutputPort(RoutingPortNames.HdmiOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.Hdmi, null, this); + AnyAudioOut = new RoutingOutputPort(RoutingPortNames.AnyAudioOut, eRoutingSignalType.Audio, + eRoutingPortConnectionType.DigitalAudio, null, this); + OutputPorts = new RoutingPortCollection { HdmiOut, AnyAudioOut }; + } + + + #region IDPad Members + + public void Up(bool pressRelease) + { + IrPort.PressRelease("+", pressRelease); + } + + public void Down(bool pressRelease) + { + IrPort.PressRelease("-", pressRelease); + } + + public void Left(bool pressRelease) + { + IrPort.PressRelease(IROutputStandardCommands.IROut_TRACK_MINUS, pressRelease); + } + + public void Right(bool pressRelease) + { + IrPort.PressRelease(IROutputStandardCommands.IROut_TRACK_PLUS, pressRelease); + } + + public void Select(bool pressRelease) + { + IrPort.PressRelease(IROutputStandardCommands.IROut_ENTER, pressRelease); + } + + public void Menu(bool pressRelease) + { + IrPort.PressRelease("Menu", pressRelease); + } + + public void Exit(bool pressRelease) + { + + } + + #endregion + + #region ITransport Members + + public void Play(bool pressRelease) + { + IrPort.PressRelease("PLAY/PAUSE", pressRelease); + } + + public void Pause(bool pressRelease) + { + IrPort.PressRelease("PLAY/PAUSE", pressRelease); + } + + /// + /// Not implemented + /// + /// + public void Rewind(bool pressRelease) + { + } + + /// + /// Not implemented + /// + /// + public void FFwd(bool pressRelease) + { + } + + /// + /// Not implemented + /// + /// + public void ChapMinus(bool pressRelease) + { + } + + /// + /// Not implemented + /// + /// + public void ChapPlus(bool pressRelease) + { + } + + /// + /// Not implemented + /// + /// + public void Stop(bool pressRelease) + { + } + + /// + /// Not implemented + /// + /// + public void Record(bool pressRelease) + { + } + + #endregion + + #region IRoutingOutputs Members + + public RoutingOutputPort HdmiOut { get; private set; } + public RoutingOutputPort AnyAudioOut { get; private set; } + public RoutingPortCollection OutputPorts { get; private set; } + + #endregion + + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { - var joinMap = new AppleTvJoinMap(joinStart); - - var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); - - if (!string.IsNullOrEmpty(joinMapSerialized)) - joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - - Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); - Debug.Console(0, "Linking to Bridge Type {0}", GetType().Name); - + var joinMap = new AppleTvJoinMap(joinStart); + + var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); + + if (!string.IsNullOrEmpty(joinMapSerialized)) + joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + + bridge.AddJoinMap(Key, joinMap); + + Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); + Debug.Console(0, "Linking to Bridge Type {0}", GetType().Name); + trilist.SetBoolSigAction(joinMap.UpArrow.JoinNumber, Up); trilist.SetBoolSigAction(joinMap.DnArrow.JoinNumber, Down); trilist.SetBoolSigAction(joinMap.LeftArrow.JoinNumber, Left); trilist.SetBoolSigAction(joinMap.RightArrow.JoinNumber, Right); trilist.SetBoolSigAction(joinMap.Select.JoinNumber, Select); trilist.SetBoolSigAction(joinMap.Menu.JoinNumber, Menu); - trilist.SetBoolSigAction(joinMap.PlayPause.JoinNumber, Play); - } - } - - public class AppleTVFactory : EssentialsDeviceFactory - { - public AppleTVFactory() - { - TypeNames = new List() { "appletv" }; - } - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "Factory Attempting to create new AppleTV Device"); - var irCont = IRPortHelper.GetIrOutputPortController(dc); - return new AppleTV(dc.Key, dc.Name, irCont); - } - } - + trilist.SetBoolSigAction(joinMap.PlayPause.JoinNumber, Play); + } + } + + public class AppleTVFactory : EssentialsDeviceFactory + { + public AppleTVFactory() + { + TypeNames = new List() { "appletv" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new AppleTV Device"); + var irCont = IRPortHelper.GetIrOutputPortController(dc); + return new AppleTV(dc.Key, dc.Name, irCont); + } + } + } \ No newline at end of file From 2cc563167263a0900c865f635507404216286b61 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Fri, 8 May 2020 11:23:47 -0500 Subject: [PATCH 133/156] Added AddJoinMap to CenOdtOccupancySensorBaseController resolves #167 --- .../CenOdtOccupancySensorBaseController.cs | 1 + .../GlsOccupancySensorBaseController.cs | 710 +++++++++--------- 2 files changed, 356 insertions(+), 355 deletions(-) diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/CenOdtOccupancySensorBaseController.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/CenOdtOccupancySensorBaseController.cs index 58126fbd..eb3172d9 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/CenOdtOccupancySensorBaseController.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/CenOdtOccupancySensorBaseController.cs @@ -446,6 +446,7 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy if (!string.IsNullOrEmpty(joinMapSerialized)) joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + bridge.AddJoinMap(Key, joinMap); Debug.Console(1, occController, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOccupancySensorBaseController.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOccupancySensorBaseController.cs index e494ab3b..907e8461 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOccupancySensorBaseController.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOccupancySensorBaseController.cs @@ -1,403 +1,403 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro.DeviceSupport; -using Crestron.SimplSharpPro.GeneralIO; -using Newtonsoft.Json; -using PepperDash.Core; -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Core.Config; -using PepperDash.Essentials.Core.Bridges; - -namespace PepperDash.Essentials.Devices.Common.Occupancy -{ - public class GlsOccupancySensorBaseController : CrestronGenericBridgeableBaseDevice, IOccupancyStatusProvider - { - public GlsOccupancySensorBase OccSensor { get; private set; } - - public BoolFeedback RoomIsOccupiedFeedback { get; private set; } - - public BoolFeedback GraceOccupancyDetectedFeedback { get; private set; } - - public BoolFeedback RawOccupancyFeedback { get; private set; } - - public BoolFeedback PirSensorEnabledFeedback { get; private set; } - - public BoolFeedback LedFlashEnabledFeedback { get; private set; } - - public BoolFeedback ShortTimeoutEnabledFeedback { get; private set; } - - public IntFeedback PirSensitivityInVacantStateFeedback { get; private set; } - - public IntFeedback PirSensitivityInOccupiedStateFeedback { get; private set; } - - public IntFeedback CurrentTimeoutFeedback { get; private set; } - - public IntFeedback LocalTimoutFeedback { get; private set; } - - public IntFeedback InternalPhotoSensorValue { get; set; } - - public IntFeedback ExternalPhotoSensorValue { get; set; } - - // Debug properties - public bool InTestMode { get; private set; } - - public bool TestRoomIsOccupiedFeedback { get; private set; } - - public Func RoomIsOccupiedFeedbackFunc - { - get - { - return () => InTestMode ? TestRoomIsOccupiedFeedback : OccSensor.OccupancyDetectedFeedback.BoolValue; - } - } - - public GlsOccupancySensorBaseController(string key, string name, GlsOccupancySensorBase sensor) - : base(key, name, sensor) - { - OccSensor = sensor; - - RoomIsOccupiedFeedback = new BoolFeedback(RoomIsOccupiedFeedbackFunc); - - PirSensorEnabledFeedback = new BoolFeedback(() => OccSensor.PirEnabledFeedback.BoolValue); - - LedFlashEnabledFeedback = new BoolFeedback(() => OccSensor.LedFlashEnabledFeedback.BoolValue); - - ShortTimeoutEnabledFeedback = new BoolFeedback(() => OccSensor.ShortTimeoutEnabledFeedback.BoolValue); - - PirSensitivityInVacantStateFeedback = new IntFeedback(() => OccSensor.PirSensitivityInVacantStateFeedback.UShortValue); - - PirSensitivityInOccupiedStateFeedback = new IntFeedback(() => OccSensor.PirSensitivityInOccupiedStateFeedback.UShortValue); - - CurrentTimeoutFeedback = new IntFeedback(() => OccSensor.CurrentTimeoutFeedback.UShortValue); - - LocalTimoutFeedback = new IntFeedback(() => OccSensor.LocalTimeoutFeedback.UShortValue); - - GraceOccupancyDetectedFeedback = new BoolFeedback(() => OccSensor.GraceOccupancyDetectedFeedback.BoolValue); - - RawOccupancyFeedback = new BoolFeedback(() => OccSensor.RawOccupancyFeedback.BoolValue); - - InternalPhotoSensorValue = new IntFeedback(() => OccSensor.InternalPhotoSensorValueFeedback.UShortValue); - - ExternalPhotoSensorValue = new IntFeedback(() => OccSensor.ExternalPhotoSensorValueFeedback.UShortValue); - - OccSensor.BaseEvent += new Crestron.SimplSharpPro.BaseEventHandler(OccSensor_BaseEvent); - - OccSensor.GlsOccupancySensorChange += new GlsOccupancySensorChangeEventHandler(OccSensor_GlsOccupancySensorChange); - } - - - /// - /// Catches events for feedbacks on the base class. Any extending wrapper class should call this delegate after it checks for it's own event IDs. - /// - /// - /// - protected virtual void OccSensor_GlsOccupancySensorChange(GlsOccupancySensorBase device, GlsOccupancySensorChangeEventArgs args) - { - if (args.EventId == GlsOccupancySensorBase.PirEnabledFeedbackEventId) - PirSensorEnabledFeedback.FireUpdate(); - else if (args.EventId == GlsOccupancySensorBase.LedFlashEnabledFeedbackEventId) - LedFlashEnabledFeedback.FireUpdate(); - else if (args.EventId == GlsOccupancySensorBase.ShortTimeoutEnabledFeedbackEventId) - ShortTimeoutEnabledFeedback.FireUpdate(); - else if (args.EventId == GlsOccupancySensorBase.PirSensitivityInOccupiedStateFeedbackEventId) - PirSensitivityInOccupiedStateFeedback.FireUpdate(); - else if (args.EventId == GlsOccupancySensorBase.PirSensitivityInVacantStateFeedbackEventId) - PirSensitivityInVacantStateFeedback.FireUpdate(); - } - - protected virtual void OccSensor_BaseEvent(Crestron.SimplSharpPro.GenericBase device, Crestron.SimplSharpPro.BaseEventArgs args) - { - Debug.Console(2, this, "GlsOccupancySensorChange EventId: {0}", args.EventId); - - if (args.EventId == Crestron.SimplSharpPro.GeneralIO.GlsOccupancySensorBase.RoomOccupiedFeedbackEventId - || args.EventId == Crestron.SimplSharpPro.GeneralIO.GlsOccupancySensorBase.RoomVacantFeedbackEventId) - { - Debug.Console(1, this, "Occupancy State: {0}", OccSensor.OccupancyDetectedFeedback.BoolValue); - RoomIsOccupiedFeedback.FireUpdate(); - } - else if (args.EventId == GlsOccupancySensorBase.TimeoutFeedbackEventId) - CurrentTimeoutFeedback.FireUpdate(); - else if (args.EventId == GlsOccupancySensorBase.TimeoutLocalFeedbackEventId) - LocalTimoutFeedback.FireUpdate(); - else if (args.EventId == GlsOccupancySensorBase.GraceOccupancyDetectedFeedbackEventId) - GraceOccupancyDetectedFeedback.FireUpdate(); - else if (args.EventId == GlsOccupancySensorBase.RawOccupancyFeedbackEventId) - RawOccupancyFeedback.FireUpdate(); - else if (args.EventId == GlsOccupancySensorBase.InternalPhotoSensorValueFeedbackEventId) - InternalPhotoSensorValue.FireUpdate(); - else if (args.EventId == GlsOccupancySensorBase.ExternalPhotoSensorValueFeedbackEventId) - ExternalPhotoSensorValue.FireUpdate(); - } - - public void SetTestMode(bool mode) - { - InTestMode = mode; - - Debug.Console(1, this, "In Mock Mode: '{0}'", InTestMode); - } - - public void SetTestOccupiedState(bool state) - { - if (!InTestMode) - Debug.Console(1, "Mock mode not enabled"); - else - { - TestRoomIsOccupiedFeedback = state; - - RoomIsOccupiedFeedback.FireUpdate(); - } - } - - /// - /// Enables or disables the PIR sensor - /// - /// - public void SetPirEnable(bool state) - { - if (state) - { - OccSensor.EnablePir.BoolValue = state; - OccSensor.DisablePir.BoolValue = !state; - } - else - { - OccSensor.EnablePir.BoolValue = state; - OccSensor.DisablePir.BoolValue = !state; - } - } - - /// - /// Enables or disables the LED Flash - /// - /// - public void SetLedFlashEnable(bool state) - { - if (state) - { - OccSensor.EnableLedFlash.BoolValue = state; - OccSensor.DisableLedFlash.BoolValue = !state; - } - else - { - OccSensor.EnableLedFlash.BoolValue = state; - OccSensor.DisableLedFlash.BoolValue = !state; - } - } - - /// - /// Enables or disables short timeout based on state - /// - /// - public void SetShortTimeoutState(bool state) - { - if (state) - { - OccSensor.EnableShortTimeout.BoolValue = state; - OccSensor.DisableShortTimeout.BoolValue = !state; - } - else - { - OccSensor.EnableShortTimeout.BoolValue = state; - OccSensor.DisableShortTimeout.BoolValue = !state; - } - } - - public void IncrementPirSensitivityInOccupiedState(bool pressRelease) - { - OccSensor.IncrementPirSensitivityInOccupiedState.BoolValue = pressRelease; - } - - public void DecrementPirSensitivityInOccupiedState(bool pressRelease) - { - OccSensor.DecrementPirSensitivityInOccupiedState.BoolValue = pressRelease; - } - - public void IncrementPirSensitivityInVacantState(bool pressRelease) - { - OccSensor.IncrementPirSensitivityInVacantState.BoolValue = pressRelease; - } - - public void DecrementPirSensitivityInVacantState(bool pressRelease) - { - OccSensor.DecrementPirSensitivityInVacantState.BoolValue = pressRelease; - } - - public void ForceOccupied() - { - OccSensor.ForceOccupied.BoolValue = true; - } - - public void ForceVacant() - { - OccSensor.ForceVacant.BoolValue = true; - } - - public void EnableRawStates(bool state) - { - OccSensor.EnableRawStates.BoolValue = state; - } - - public void SetRemoteTimeout(ushort time) - { - OccSensor.RemoteTimeout.UShortValue = time; - } - - public void SetInternalPhotoSensorMinChange(ushort value) - { - OccSensor.InternalPhotoSensorMinimumChange.UShortValue = value; - } - - public void SetExternalPhotoSensorMinChange(ushort value) - { - OccSensor.ExternalPhotoSensorMinimumChange.UShortValue = value; - } - - - - protected void LinkOccSensorToApi(GlsOccupancySensorBaseController occController, BasicTriList trilist, - uint joinStart, string joinMapKey, EiscApiAdvanced bridge) +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using Crestron.SimplSharpPro.DeviceSupport; +using Crestron.SimplSharpPro.GeneralIO; +using Newtonsoft.Json; +using PepperDash.Core; +using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Config; +using PepperDash.Essentials.Core.Bridges; + +namespace PepperDash.Essentials.Devices.Common.Occupancy +{ + public class GlsOccupancySensorBaseController : CrestronGenericBridgeableBaseDevice, IOccupancyStatusProvider + { + public GlsOccupancySensorBase OccSensor { get; private set; } + + public BoolFeedback RoomIsOccupiedFeedback { get; private set; } + + public BoolFeedback GraceOccupancyDetectedFeedback { get; private set; } + + public BoolFeedback RawOccupancyFeedback { get; private set; } + + public BoolFeedback PirSensorEnabledFeedback { get; private set; } + + public BoolFeedback LedFlashEnabledFeedback { get; private set; } + + public BoolFeedback ShortTimeoutEnabledFeedback { get; private set; } + + public IntFeedback PirSensitivityInVacantStateFeedback { get; private set; } + + public IntFeedback PirSensitivityInOccupiedStateFeedback { get; private set; } + + public IntFeedback CurrentTimeoutFeedback { get; private set; } + + public IntFeedback LocalTimoutFeedback { get; private set; } + + public IntFeedback InternalPhotoSensorValue { get; set; } + + public IntFeedback ExternalPhotoSensorValue { get; set; } + + // Debug properties + public bool InTestMode { get; private set; } + + public bool TestRoomIsOccupiedFeedback { get; private set; } + + public Func RoomIsOccupiedFeedbackFunc { - var joinMap = new GlsOccupancySensorBaseJoinMap(joinStart); - - var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); - - if (!string.IsNullOrEmpty(joinMapSerialized)) + get + { + return () => InTestMode ? TestRoomIsOccupiedFeedback : OccSensor.OccupancyDetectedFeedback.BoolValue; + } + } + + public GlsOccupancySensorBaseController(string key, string name, GlsOccupancySensorBase sensor) + : base(key, name, sensor) + { + OccSensor = sensor; + + RoomIsOccupiedFeedback = new BoolFeedback(RoomIsOccupiedFeedbackFunc); + + PirSensorEnabledFeedback = new BoolFeedback(() => OccSensor.PirEnabledFeedback.BoolValue); + + LedFlashEnabledFeedback = new BoolFeedback(() => OccSensor.LedFlashEnabledFeedback.BoolValue); + + ShortTimeoutEnabledFeedback = new BoolFeedback(() => OccSensor.ShortTimeoutEnabledFeedback.BoolValue); + + PirSensitivityInVacantStateFeedback = new IntFeedback(() => OccSensor.PirSensitivityInVacantStateFeedback.UShortValue); + + PirSensitivityInOccupiedStateFeedback = new IntFeedback(() => OccSensor.PirSensitivityInOccupiedStateFeedback.UShortValue); + + CurrentTimeoutFeedback = new IntFeedback(() => OccSensor.CurrentTimeoutFeedback.UShortValue); + + LocalTimoutFeedback = new IntFeedback(() => OccSensor.LocalTimeoutFeedback.UShortValue); + + GraceOccupancyDetectedFeedback = new BoolFeedback(() => OccSensor.GraceOccupancyDetectedFeedback.BoolValue); + + RawOccupancyFeedback = new BoolFeedback(() => OccSensor.RawOccupancyFeedback.BoolValue); + + InternalPhotoSensorValue = new IntFeedback(() => OccSensor.InternalPhotoSensorValueFeedback.UShortValue); + + ExternalPhotoSensorValue = new IntFeedback(() => OccSensor.ExternalPhotoSensorValueFeedback.UShortValue); + + OccSensor.BaseEvent += new Crestron.SimplSharpPro.BaseEventHandler(OccSensor_BaseEvent); + + OccSensor.GlsOccupancySensorChange += new GlsOccupancySensorChangeEventHandler(OccSensor_GlsOccupancySensorChange); + } + + + /// + /// Catches events for feedbacks on the base class. Any extending wrapper class should call this delegate after it checks for it's own event IDs. + /// + /// + /// + protected virtual void OccSensor_GlsOccupancySensorChange(GlsOccupancySensorBase device, GlsOccupancySensorChangeEventArgs args) + { + if (args.EventId == GlsOccupancySensorBase.PirEnabledFeedbackEventId) + PirSensorEnabledFeedback.FireUpdate(); + else if (args.EventId == GlsOccupancySensorBase.LedFlashEnabledFeedbackEventId) + LedFlashEnabledFeedback.FireUpdate(); + else if (args.EventId == GlsOccupancySensorBase.ShortTimeoutEnabledFeedbackEventId) + ShortTimeoutEnabledFeedback.FireUpdate(); + else if (args.EventId == GlsOccupancySensorBase.PirSensitivityInOccupiedStateFeedbackEventId) + PirSensitivityInOccupiedStateFeedback.FireUpdate(); + else if (args.EventId == GlsOccupancySensorBase.PirSensitivityInVacantStateFeedbackEventId) + PirSensitivityInVacantStateFeedback.FireUpdate(); + } + + protected virtual void OccSensor_BaseEvent(Crestron.SimplSharpPro.GenericBase device, Crestron.SimplSharpPro.BaseEventArgs args) + { + Debug.Console(2, this, "GlsOccupancySensorChange EventId: {0}", args.EventId); + + if (args.EventId == Crestron.SimplSharpPro.GeneralIO.GlsOccupancySensorBase.RoomOccupiedFeedbackEventId + || args.EventId == Crestron.SimplSharpPro.GeneralIO.GlsOccupancySensorBase.RoomVacantFeedbackEventId) + { + Debug.Console(1, this, "Occupancy State: {0}", OccSensor.OccupancyDetectedFeedback.BoolValue); + RoomIsOccupiedFeedback.FireUpdate(); + } + else if (args.EventId == GlsOccupancySensorBase.TimeoutFeedbackEventId) + CurrentTimeoutFeedback.FireUpdate(); + else if (args.EventId == GlsOccupancySensorBase.TimeoutLocalFeedbackEventId) + LocalTimoutFeedback.FireUpdate(); + else if (args.EventId == GlsOccupancySensorBase.GraceOccupancyDetectedFeedbackEventId) + GraceOccupancyDetectedFeedback.FireUpdate(); + else if (args.EventId == GlsOccupancySensorBase.RawOccupancyFeedbackEventId) + RawOccupancyFeedback.FireUpdate(); + else if (args.EventId == GlsOccupancySensorBase.InternalPhotoSensorValueFeedbackEventId) + InternalPhotoSensorValue.FireUpdate(); + else if (args.EventId == GlsOccupancySensorBase.ExternalPhotoSensorValueFeedbackEventId) + ExternalPhotoSensorValue.FireUpdate(); + } + + public void SetTestMode(bool mode) + { + InTestMode = mode; + + Debug.Console(1, this, "In Mock Mode: '{0}'", InTestMode); + } + + public void SetTestOccupiedState(bool state) + { + if (!InTestMode) + Debug.Console(1, "Mock mode not enabled"); + else + { + TestRoomIsOccupiedFeedback = state; + + RoomIsOccupiedFeedback.FireUpdate(); + } + } + + /// + /// Enables or disables the PIR sensor + /// + /// + public void SetPirEnable(bool state) + { + if (state) + { + OccSensor.EnablePir.BoolValue = state; + OccSensor.DisablePir.BoolValue = !state; + } + else + { + OccSensor.EnablePir.BoolValue = state; + OccSensor.DisablePir.BoolValue = !state; + } + } + + /// + /// Enables or disables the LED Flash + /// + /// + public void SetLedFlashEnable(bool state) + { + if (state) + { + OccSensor.EnableLedFlash.BoolValue = state; + OccSensor.DisableLedFlash.BoolValue = !state; + } + else + { + OccSensor.EnableLedFlash.BoolValue = state; + OccSensor.DisableLedFlash.BoolValue = !state; + } + } + + /// + /// Enables or disables short timeout based on state + /// + /// + public void SetShortTimeoutState(bool state) + { + if (state) + { + OccSensor.EnableShortTimeout.BoolValue = state; + OccSensor.DisableShortTimeout.BoolValue = !state; + } + else + { + OccSensor.EnableShortTimeout.BoolValue = state; + OccSensor.DisableShortTimeout.BoolValue = !state; + } + } + + public void IncrementPirSensitivityInOccupiedState(bool pressRelease) + { + OccSensor.IncrementPirSensitivityInOccupiedState.BoolValue = pressRelease; + } + + public void DecrementPirSensitivityInOccupiedState(bool pressRelease) + { + OccSensor.DecrementPirSensitivityInOccupiedState.BoolValue = pressRelease; + } + + public void IncrementPirSensitivityInVacantState(bool pressRelease) + { + OccSensor.IncrementPirSensitivityInVacantState.BoolValue = pressRelease; + } + + public void DecrementPirSensitivityInVacantState(bool pressRelease) + { + OccSensor.DecrementPirSensitivityInVacantState.BoolValue = pressRelease; + } + + public void ForceOccupied() + { + OccSensor.ForceOccupied.BoolValue = true; + } + + public void ForceVacant() + { + OccSensor.ForceVacant.BoolValue = true; + } + + public void EnableRawStates(bool state) + { + OccSensor.EnableRawStates.BoolValue = state; + } + + public void SetRemoteTimeout(ushort time) + { + OccSensor.RemoteTimeout.UShortValue = time; + } + + public void SetInternalPhotoSensorMinChange(ushort value) + { + OccSensor.InternalPhotoSensorMinimumChange.UShortValue = value; + } + + public void SetExternalPhotoSensorMinChange(ushort value) + { + OccSensor.ExternalPhotoSensorMinimumChange.UShortValue = value; + } + + + + protected void LinkOccSensorToApi(GlsOccupancySensorBaseController occController, BasicTriList trilist, + uint joinStart, string joinMapKey, EiscApiAdvanced bridge) + { + var joinMap = new GlsOccupancySensorBaseJoinMap(joinStart); + + var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); + + if (!string.IsNullOrEmpty(joinMapSerialized)) joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - bridge.AddJoinMap(Key, joinMap); - - Debug.Console(1, occController, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); - - #region Single and Dual Sensor Stuff + bridge.AddJoinMap(Key, joinMap); + + Debug.Console(1, occController, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); + + #region Single and Dual Sensor Stuff occController.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]); - trilist.StringInput[joinMap.Name.JoinNumber].StringValue = occController.Name; - - trilist.OnlineStatusChange += (d, args) => - { - if (args.DeviceOnLine) + trilist.StringInput[joinMap.Name.JoinNumber].StringValue = occController.Name; + + trilist.OnlineStatusChange += (d, args) => + { + if (args.DeviceOnLine) { - trilist.StringInput[joinMap.Name.JoinNumber].StringValue = occController.Name; - } - }; - + trilist.StringInput[joinMap.Name.JoinNumber].StringValue = occController.Name; + } + }; + // Occupied status trilist.SetSigTrueAction(joinMap.ForceOccupied.JoinNumber, occController.ForceOccupied); trilist.SetSigTrueAction(joinMap.ForceVacant.JoinNumber, occController.ForceVacant); occController.RoomIsOccupiedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RoomOccupiedFeedback.JoinNumber]); occController.RoomIsOccupiedFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.RoomVacantFeedback.JoinNumber]); occController.RawOccupancyFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyFeedback.JoinNumber]); - trilist.SetBoolSigAction(joinMap.EnableRawStates.JoinNumber, occController.EnableRawStates); - + trilist.SetBoolSigAction(joinMap.EnableRawStates.JoinNumber, occController.EnableRawStates); + // Timouts trilist.SetUShortSigAction(joinMap.Timeout.JoinNumber, occController.SetRemoteTimeout); occController.CurrentTimeoutFeedback.LinkInputSig(trilist.UShortInput[joinMap.Timeout.JoinNumber]); - occController.LocalTimoutFeedback.LinkInputSig(trilist.UShortInput[joinMap.TimeoutLocalFeedback.JoinNumber]); - + occController.LocalTimoutFeedback.LinkInputSig(trilist.UShortInput[joinMap.TimeoutLocalFeedback.JoinNumber]); + // LED Flash trilist.SetSigTrueAction(joinMap.EnableLedFlash.JoinNumber, () => occController.SetLedFlashEnable(true)); trilist.SetSigTrueAction(joinMap.DisableLedFlash.JoinNumber, () => occController.SetLedFlashEnable(false)); - occController.LedFlashEnabledFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.EnableLedFlash.JoinNumber]); - + occController.LedFlashEnabledFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.EnableLedFlash.JoinNumber]); + // Short Timeout trilist.SetSigTrueAction(joinMap.EnableShortTimeout.JoinNumber, () => occController.SetShortTimeoutState(true)); trilist.SetSigTrueAction(joinMap.DisableShortTimeout.JoinNumber, () => occController.SetShortTimeoutState(false)); - occController.ShortTimeoutEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableShortTimeout.JoinNumber]); - + occController.ShortTimeoutEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableShortTimeout.JoinNumber]); + // PIR Sensor trilist.SetSigTrueAction(joinMap.EnablePir.JoinNumber, () => occController.SetPirEnable(true)); trilist.SetSigTrueAction(joinMap.DisablePir.JoinNumber, () => occController.SetPirEnable(false)); - occController.PirSensorEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnablePir.JoinNumber]); - + occController.PirSensorEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnablePir.JoinNumber]); + // PIR Sensitivity in Occupied State trilist.SetBoolSigAction(joinMap.IncrementPirInOccupiedState.JoinNumber, occController.IncrementPirSensitivityInOccupiedState); trilist.SetBoolSigAction(joinMap.DecrementPirInOccupiedState.JoinNumber, occController.DecrementPirSensitivityInOccupiedState); - occController.PirSensitivityInOccupiedStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.PirSensitivityInOccupiedState.JoinNumber]); - + occController.PirSensitivityInOccupiedStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.PirSensitivityInOccupiedState.JoinNumber]); + // PIR Sensitivity in Vacant State trilist.SetBoolSigAction(joinMap.IncrementPirInVacantState.JoinNumber, occController.IncrementPirSensitivityInVacantState); trilist.SetBoolSigAction(joinMap.DecrementPirInVacantState.JoinNumber, occController.DecrementPirSensitivityInVacantState); - occController.PirSensitivityInVacantStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.PirSensitivityInVacantState.JoinNumber]); - #endregion - - #region Dual Technology Sensor Stuff - var odtOccController = occController as GlsOdtOccupancySensorController; - - if (odtOccController == null) return; + occController.PirSensitivityInVacantStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.PirSensitivityInVacantState.JoinNumber]); + #endregion + + #region Dual Technology Sensor Stuff + var odtOccController = occController as GlsOdtOccupancySensorController; + + if (odtOccController == null) return; // OR When Vacated trilist.SetBoolSigAction(joinMap.OrWhenVacated.JoinNumber, odtOccController.SetOrWhenVacatedState); - odtOccController.OrWhenVacatedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.OrWhenVacated.JoinNumber]); - + odtOccController.OrWhenVacatedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.OrWhenVacated.JoinNumber]); + // AND When Vacated trilist.SetBoolSigAction(joinMap.AndWhenVacated.JoinNumber, odtOccController.SetAndWhenVacatedState); - odtOccController.AndWhenVacatedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.AndWhenVacated.JoinNumber]); - + odtOccController.AndWhenVacatedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.AndWhenVacated.JoinNumber]); + // Ultrasonic A Sensor trilist.SetSigTrueAction(joinMap.EnableUsA.JoinNumber, () => odtOccController.SetUsAEnable(true)); trilist.SetSigTrueAction(joinMap.DisableUsA.JoinNumber, () => odtOccController.SetUsAEnable(false)); - odtOccController.UltrasonicAEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableUsA.JoinNumber]); - + odtOccController.UltrasonicAEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableUsA.JoinNumber]); + // Ultrasonic B Sensor trilist.SetSigTrueAction(joinMap.EnableUsB.JoinNumber, () => odtOccController.SetUsBEnable(true)); trilist.SetSigTrueAction(joinMap.DisableUsB.JoinNumber, () => odtOccController.SetUsBEnable(false)); - odtOccController.UltrasonicAEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableUsB.JoinNumber]); - + odtOccController.UltrasonicAEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableUsB.JoinNumber]); + // US Sensitivity in Occupied State trilist.SetBoolSigAction(joinMap.IncrementUsInOccupiedState.JoinNumber, odtOccController.IncrementUsSensitivityInOccupiedState); trilist.SetBoolSigAction(joinMap.DecrementUsInOccupiedState.JoinNumber, odtOccController.DecrementUsSensitivityInOccupiedState); - odtOccController.UltrasonicSensitivityInOccupiedStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.UsSensitivityInOccupiedState.JoinNumber]); - + odtOccController.UltrasonicSensitivityInOccupiedStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.UsSensitivityInOccupiedState.JoinNumber]); + // US Sensitivity in Vacant State trilist.SetBoolSigAction(joinMap.IncrementUsInVacantState.JoinNumber, odtOccController.IncrementUsSensitivityInVacantState); trilist.SetBoolSigAction(joinMap.DecrementUsInVacantState.JoinNumber, odtOccController.DecrementUsSensitivityInVacantState); - odtOccController.UltrasonicSensitivityInVacantStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.UsSensitivityInVacantState.JoinNumber]); - + odtOccController.UltrasonicSensitivityInVacantStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.UsSensitivityInVacantState.JoinNumber]); + //Sensor Raw States odtOccController.RawOccupancyPirFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyPirFeedback.JoinNumber]); - odtOccController.RawOccupancyUsFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyUsFeedback.JoinNumber]); - - #endregion - } - - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) - { - LinkOccSensorToApi(this, trilist, joinStart, joinMapKey, bridge); - } - } - - public class GlsOccupancySensorBaseControllerFactory : EssentialsDeviceFactory - { - public GlsOccupancySensorBaseControllerFactory() - { - TypeNames = new List() { "glsoirccn" }; - } - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "Factory Attempting to create new GlsOccupancySensorBaseController Device"); - - var typeName = dc.Type.ToLower(); - var key = dc.Key; - var name = dc.Name; - var comm = CommFactory.GetControlPropertiesConfig(dc); - - GlsOccupancySensorBase occSensor = null; - - occSensor = new GlsOirCCn(comm.CresnetIdInt, Global.ControlSystem); - - if (occSensor != null) - { - return new GlsOccupancySensorBaseController(key, name, occSensor); - } - else - { - Debug.Console(0, "ERROR: Unable to create Occupancy Sensor Device. Key: '{0}'", key); - return null; - } - - } - } - + odtOccController.RawOccupancyUsFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyUsFeedback.JoinNumber]); + + #endregion + } + + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) + { + LinkOccSensorToApi(this, trilist, joinStart, joinMapKey, bridge); + } + } + + public class GlsOccupancySensorBaseControllerFactory : EssentialsDeviceFactory + { + public GlsOccupancySensorBaseControllerFactory() + { + TypeNames = new List() { "glsoirccn" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new GlsOccupancySensorBaseController Device"); + + var typeName = dc.Type.ToLower(); + var key = dc.Key; + var name = dc.Name; + var comm = CommFactory.GetControlPropertiesConfig(dc); + + GlsOccupancySensorBase occSensor = null; + + occSensor = new GlsOirCCn(comm.CresnetIdInt, Global.ControlSystem); + + if (occSensor != null) + { + return new GlsOccupancySensorBaseController(key, name, occSensor); + } + else + { + Debug.Console(0, "ERROR: Unable to create Occupancy Sensor Device. Key: '{0}'", key); + return null; + } + + } + } + } \ No newline at end of file From 6e741c4d44e7a670239a203bbdabb008ee7c5143 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Fri, 8 May 2020 13:57:43 -0500 Subject: [PATCH 134/156] Updated Joinmaps to JoinMapBaseAdvanced --- .../Bridges/JoinMaps/DmTxControllerJoinMap.cs | 119 +++--------------- .../Transmitters/DmTx200Controller.cs | 4 +- .../Transmitters/DmTx201CController.cs | 4 +- .../Transmitters/DmTx401CController.cs | 6 +- .../Transmitters/DmTx4k202CController.cs | 8 +- .../Transmitters/DmTx4k302CController.cs | 12 +- .../Transmitters/DmTx4kz302CController.cs | 12 +- .../Endpoints/Transmitters/DmTxHelpers.cs | 8 +- 8 files changed, 44 insertions(+), 129 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmTxControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmTxControllerJoinMap.cs index d8fe0c76..8b59bd42 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmTxControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmTxControllerJoinMap.cs @@ -1,37 +1,9 @@ -using PepperDash.Essentials.Core; - -namespace PepperDash.Essentials.Core.Bridges -{ - public class DmTxControllerJoinMap : JoinMapBaseAdvanced - { -<<<<<<< HEAD - #region Digitals - /// - /// High when device is online (if not attached to a DMP3 or DM chassis with a CPU3 card - /// - public uint IsOnline { get; set; } - /// - /// High when video sync is detected - /// - public uint VideoSyncStatus { get; set; } - /// - /// - /// - public uint FreeRunEnabled { get; set; } - /// - /// High when video sync is detected on input 1 of a multi-input tx - /// - public uint Input1VideoSyncStatus { get; set; } - /// - /// High when video sync is detected on input 2 of a multi-input tx - /// - public uint Input2VideoSyncStatus { get; set; } - /// - /// High when video sync is detected on input 3 of a multi-input tx - /// - public uint Input3VideoSyncStatus { get; set; } - #endregion -======= +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Core.Bridges +{ + public class DmTxControllerJoinMap : JoinMapBaseAdvanced + { [JoinName("IsOnline")] public JoinDataComplete IsOnline = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, new JoinMetadata() { Label = "DM TX Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); @@ -44,6 +16,18 @@ namespace PepperDash.Essentials.Core.Bridges public JoinDataComplete FreeRunEnabled = new JoinDataComplete(new JoinData() { JoinNumber = 3, JoinSpan = 1 }, new JoinMetadata() { Label = "DM TX Enable Free Run Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + [JoinName("Input1VideoSyncStatus")] + public JoinDataComplete Input1VideoSyncStatus = new JoinDataComplete(new JoinData() { JoinNumber = 4, JoinSpan = 1 }, + new JoinMetadata() { Label = "Input 1 Video Sync Status", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Input2VideoSyncStatus")] + public JoinDataComplete Input2VideoSyncStatus = new JoinDataComplete(new JoinData() { JoinNumber = 5, JoinSpan = 1 }, + new JoinMetadata() { Label = "Input 2 Video Sync Status", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Input3VideoSyncStatus")] + public JoinDataComplete Input3VideoSyncStatus = new JoinDataComplete(new JoinData() { JoinNumber = 6, JoinSpan = 1 }, + new JoinMetadata() { Label = "Input 3 Video Sync Status", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + [JoinName("CurrentInputResolution")] public JoinDataComplete CurrentInputResolution = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, new JoinMetadata() { Label = "DM TX Current Input Resolution", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); @@ -81,70 +65,5 @@ namespace PepperDash.Essentials.Core.Bridges : base(joinStart, typeof(DmTxControllerJoinMap)) { } ->>>>>>> development - - -<<<<<<< HEAD - /// - /// Sets and reports the current VGA Brightness level - /// - public uint VgaBrightness { get; set; } - - /// - /// Sets and reports the current VGA Contrast level - /// - public uint VgaContrast { get; set; } - #endregion - - #region Serials - /// - /// Reports the current input resolution - /// - public uint CurrentInputResolution { get; set; } - #endregion - - - public DmTxControllerJoinMap() - { - // Digital - IsOnline = 1; - VideoSyncStatus = 2; - FreeRunEnabled = 3; - Input1VideoSyncStatus = 4; - Input2VideoSyncStatus = 5; - Input3VideoSyncStatus = 6; - // Serial - CurrentInputResolution = 1; - // Analog - VideoInput = 1; - AudioInput = 2; - HdcpSupportCapability = 3; - Port1HdcpState = 4; - Port2HdcpState = 5; - VgaBrightness = 6; - VgaContrast = 7; - } - - public override void OffsetJoinNumbers(uint joinStart) - { - var joinOffset = joinStart - 1; - - IsOnline = IsOnline + joinOffset; - VideoSyncStatus = VideoSyncStatus + joinOffset; - FreeRunEnabled = FreeRunEnabled + joinOffset; - Input1VideoSyncStatus = Input1VideoSyncStatus + joinOffset; - Input2VideoSyncStatus = Input2VideoSyncStatus + joinOffset; - Input3VideoSyncStatus = Input3VideoSyncStatus + joinOffset; - CurrentInputResolution = CurrentInputResolution + joinOffset; - VideoInput = VideoInput + joinOffset; - AudioInput = AudioInput + joinOffset; - HdcpSupportCapability = HdcpSupportCapability + joinOffset; - Port1HdcpState = Port1HdcpState + joinOffset; - Port2HdcpState = Port2HdcpState + joinOffset; - VgaBrightness = VgaBrightness + joinOffset; - VgaContrast = VgaContrast + joinOffset; - } -======= ->>>>>>> development - } + } } \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs index 13963fa4..e75a9d55 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs @@ -237,11 +237,11 @@ namespace PepperDash.Essentials.DM if (HdmiVideoSyncFeedback != null) { - HdmiVideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input1VideoSyncStatus]); + HdmiVideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input1VideoSyncStatus.JoinNumber]); } if (VgaVideoSyncFeedback != null) { - VgaVideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input2VideoSyncStatus]); + VgaVideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input2VideoSyncStatus.JoinNumber]); } LinkDmTxToApi(this, trilist, joinMap, bridge); diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs index ceebb32a..54be5720 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs @@ -239,11 +239,11 @@ namespace PepperDash.Essentials.DM if (HdmiVideoSyncFeedback != null) { - HdmiVideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input1VideoSyncStatus]); + HdmiVideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input1VideoSyncStatus.JoinNumber]); } if (VgaVideoSyncFeedback != null) { - VgaVideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input2VideoSyncStatus]); + VgaVideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input2VideoSyncStatus.JoinNumber]); } LinkDmTxToApi(this, trilist, joinMap, bridge); diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs index ac65e90e..46cae247 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs @@ -242,11 +242,11 @@ namespace PepperDash.Essentials.DM if (HdmiVideoSyncFeedback != null) { - HdmiVideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input1VideoSyncStatus]); + HdmiVideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input1VideoSyncStatus.JoinNumber]); } if (VgaVideoSyncFeedback != null) - { - VgaVideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input2VideoSyncStatus]); + { + VgaVideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input2VideoSyncStatus.JoinNumber]); } LinkDmTxToApi(this, trilist, joinMap, bridge); diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k202CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k202CController.cs index 2121d2bb..460876b4 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k202CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k202CController.cs @@ -206,12 +206,12 @@ namespace PepperDash.Essentials.DM DmTxControllerJoinMap joinMap = GetDmTxJoinMap(joinStart, joinMapKey); if (Hdmi1VideoSyncFeedback != null) - { - Hdmi1VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input1VideoSyncStatus]); + { + Hdmi1VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input1VideoSyncStatus.JoinNumber]); } if (Hdmi2VideoSyncFeedback != null) - { - Hdmi2VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input2VideoSyncStatus]); + { + Hdmi2VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input2VideoSyncStatus.JoinNumber]); } LinkDmTxToApi(this, trilist, joinMap, bridge); diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k302CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k302CController.cs index 58e8e301..7d787051 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k302CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k302CController.cs @@ -249,16 +249,16 @@ namespace PepperDash.Essentials.DM DmTxControllerJoinMap joinMap = GetDmTxJoinMap(joinStart, joinMapKey); if (Hdmi1VideoSyncFeedback != null) - { - Hdmi1VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input1VideoSyncStatus]); + { + Hdmi1VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input1VideoSyncStatus.JoinNumber]); } if (Hdmi2VideoSyncFeedback != null) - { - Hdmi2VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input2VideoSyncStatus]); + { + Hdmi2VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input2VideoSyncStatus.JoinNumber]); } if (VgaVideoSyncFeedback != null) - { - VgaVideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input3VideoSyncStatus]); + { + VgaVideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input3VideoSyncStatus.JoinNumber]); } LinkDmTxToApi(this, trilist, joinMap, bridge); diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz302CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz302CController.cs index 38810eed..1c5703a0 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz302CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz302CController.cs @@ -225,16 +225,16 @@ namespace PepperDash.Essentials.DM DmTxControllerJoinMap joinMap = GetDmTxJoinMap(joinStart, joinMapKey); if (Hdmi1VideoSyncFeedback != null) - { - Hdmi1VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input1VideoSyncStatus]); + { + Hdmi1VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input1VideoSyncStatus.JoinNumber]); } if (Hdmi2VideoSyncFeedback != null) - { - Hdmi2VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input2VideoSyncStatus]); + { + Hdmi2VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input2VideoSyncStatus.JoinNumber]); } if (DisplayPortVideoSyncFeedback != null) - { - DisplayPortVideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input3VideoSyncStatus]); + { + DisplayPortVideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input3VideoSyncStatus.JoinNumber]); } LinkDmTxToApi(this, trilist, joinMap, bridge); diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs index c1dc5db6..d5fd9dd2 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs @@ -171,10 +171,8 @@ namespace PepperDash.Essentials.DM { } - - protected void LinkDmTxToApi(DmTxControllerBase tx, BasicTriList trilist, uint joinStart, string joinMapKey, - EiscApiAdvanced bridge) - { + protected DmTxControllerJoinMap GetDmTxJoinMap(uint joinStart, string joinMapKey) + { var joinMap = new DmTxControllerJoinMap(joinStart); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); @@ -182,8 +180,6 @@ namespace PepperDash.Essentials.DM if (!string.IsNullOrEmpty(joinMapSerialized)) joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - bridge.AddJoinMap(Key, joinMap); - return joinMap; } From b76178990de9e37ef84e4df1ed0aca00443c0626 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 11 May 2020 18:06:37 -0600 Subject: [PATCH 135/156] fixes issue with merge commit and conflicts --- .../Endpoints/Receivers/DmRmcHelper.cs | 13 +- .../Transmitters/DmTx4kz302CController.cs | 754 +++++++++--------- 2 files changed, 380 insertions(+), 387 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs index 9d96311c..648909fc 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs @@ -63,20 +63,13 @@ namespace PepperDash.Essentials.DM if (routing == null) { - - - - if (routing.AudioVideoSourceNumericFeedback != null) - routing.AudioVideoSourceNumericFeedback.LinkInputSig(trilist.UShortInput[joinMap.AudioVideoSource.JoinNumber]); - - trilist.SetUShortSigAction(joinMap.AudioVideoSource.JoinNumber, (a) => routing.ExecuteNumericSwitch(a, 1, eRoutingSignalType.AudioVideo)); - + return; } if (routing.AudioVideoSourceNumericFeedback != null) - routing.AudioVideoSourceNumericFeedback.LinkInputSig(trilist.UShortInput[joinMap.AudioVideoSource]); + routing.AudioVideoSourceNumericFeedback.LinkInputSig(trilist.UShortInput[joinMap.AudioVideoSource.JoinNumber]); - trilist.SetUShortSigAction(joinMap.AudioVideoSource, a => routing.ExecuteNumericSwitch(a, 1, eRoutingSignalType.AudioVideo)); + trilist.SetUShortSigAction(joinMap.AudioVideoSource.JoinNumber, a => routing.ExecuteNumericSwitch(a, 1, eRoutingSignalType.AudioVideo)); } } diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz302CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz302CController.cs index 1c5703a0..c0aebfae 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz302CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz302CController.cs @@ -1,381 +1,381 @@ -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.DeviceSupport; -using Crestron.SimplSharpPro.DM; -using Crestron.SimplSharpPro.DM.Endpoints; -using Crestron.SimplSharpPro.DM.Endpoints.Transmitters; - -using PepperDash.Core; -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Core.Bridges; -using PepperDash.Essentials.DM.Config; - -namespace PepperDash.Essentials.DM -{ - using eVst = Crestron.SimplSharpPro.DeviceSupport.eX02VideoSourceType; - using eAst = Crestron.SimplSharpPro.DeviceSupport.eX02AudioSourceType; - - public class DmTx4kz302CController : DmTxControllerBase, ITxRouting, IHasFeedback, - IIROutputPorts, IComPorts - { - public DmTx4kz302C Tx { get; private set; } - - public RoutingInputPortWithVideoStatuses HdmiIn1 { get; private set; } - public RoutingInputPortWithVideoStatuses HdmiIn2 { get; private set; } - public RoutingInputPortWithVideoStatuses DisplayPortIn { get; private set; } - public RoutingOutputPort DmOut { get; private set; } - public RoutingOutputPort HdmiLoopOut { get; private set; } - - public override StringFeedback ActiveVideoInputFeedback { get; protected set; } - public IntFeedback VideoSourceNumericFeedback { get; protected set; } - public IntFeedback AudioSourceNumericFeedback { get; protected set; } - public IntFeedback HdmiIn1HdcpCapabilityFeedback { get; protected set; } - public IntFeedback HdmiIn2HdcpCapabilityFeedback { get; protected set; } - public BoolFeedback Hdmi1VideoSyncFeedback { get; protected set; } - public BoolFeedback Hdmi2VideoSyncFeedback { get; protected set; } - public BoolFeedback DisplayPortVideoSyncFeedback { get; protected set; } - - //public override IntFeedback HdcpSupportAllFeedback { get; protected set; } - //public override ushort HdcpSupportCapability { get; protected set; } - - /// - /// Helps get the "real" inputs, including when in Auto - /// - public Crestron.SimplSharpPro.DeviceSupport.eX02VideoSourceType ActualActiveVideoInput - { - get - { - if (Tx.VideoSourceFeedback != eVst.Auto) - return Tx.VideoSourceFeedback; - else // auto - { - if (Tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue) - return eVst.Hdmi1; - else if (Tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue) - return eVst.Hdmi2; - else if (Tx.DisplayPortInput.SyncDetectedFeedback.BoolValue) - return eVst.Vga; - else - return eVst.AllDisabled; - } - } - } - public RoutingPortCollection InputPorts - { - get - { - return new RoutingPortCollection - { - HdmiIn1, - HdmiIn2, - DisplayPortIn, - AnyVideoInput - }; - } - } - public RoutingPortCollection OutputPorts - { - get - { - return new RoutingPortCollection { DmOut, HdmiLoopOut }; - } - } - public DmTx4kz302CController(string key, string name, DmTx4kz302C tx) - : base(key, name, tx) - { - Tx = tx; - - HdmiIn1 = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn1, - eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eVst.Hdmi1, this, - VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInputs[1])); - HdmiIn2 = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn2, - eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eVst.Hdmi2, this, - VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInputs[2])); - DisplayPortIn = new RoutingInputPortWithVideoStatuses(DmPortName.VgaIn, - eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DisplayPort, eVst.DisplayPort, this, - VideoStatusHelper.GetDisplayPortInputStatusFuncs(tx.DisplayPortInput)); - ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput", - () => ActualActiveVideoInput.ToString()); - - Tx.HdmiInputs[1].InputStreamChange += InputStreamChangeEvent; - Tx.HdmiInputs[2].InputStreamChange += InputStreamChangeEvent; - Tx.BaseEvent += Tx_BaseEvent; - - VideoSourceNumericFeedback = new IntFeedback(() => - { - return (int)Tx.VideoSourceFeedback; - }); - AudioSourceNumericFeedback = new IntFeedback(() => - { - return (int)Tx.AudioSourceFeedback; - }); - - HdmiIn1HdcpCapabilityFeedback = new IntFeedback("HdmiIn1HdcpCapability", () => - { - return (int)tx.HdmiInputs[1].HdcpCapabilityFeedback; - }); - - HdmiIn2HdcpCapabilityFeedback = new IntFeedback("HdmiIn2HdcpCapability", () => - { - return (int)tx.HdmiInputs[2].HdcpCapabilityFeedback; - }); - - HdcpSupportCapability = eHdcpCapabilityType.Hdcp2_2Support; - - Hdmi1VideoSyncFeedback = new BoolFeedback(() => - { - return (bool)tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue; - }); - - Hdmi2VideoSyncFeedback = new BoolFeedback(() => - { - return (bool)tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue; - }); - - DisplayPortVideoSyncFeedback = new BoolFeedback(() => - { - return (bool)tx.DisplayPortInput.SyncDetectedFeedback.BoolValue; - }); - - - var combinedFuncs = new VideoStatusFuncsWrapper - { - HdcpActiveFeedbackFunc = () => - (ActualActiveVideoInput == eVst.Hdmi1 - && tx.HdmiInputs[1].VideoAttributes.HdcpActiveFeedback.BoolValue) - || (ActualActiveVideoInput == eVst.Hdmi2 - && tx.HdmiInputs[2].VideoAttributes.HdcpActiveFeedback.BoolValue), - - HdcpStateFeedbackFunc = () => - { - if (ActualActiveVideoInput == eVst.Hdmi1) - return tx.HdmiInputs[1].VideoAttributes.HdcpStateFeedback.ToString(); - if (ActualActiveVideoInput == eVst.Hdmi2) - return tx.HdmiInputs[2].VideoAttributes.HdcpStateFeedback.ToString(); - return ""; - }, - - VideoResolutionFeedbackFunc = () => - { - if (ActualActiveVideoInput == eVst.Hdmi1) - return tx.HdmiInputs[1].VideoAttributes.GetVideoResolutionString(); - if (ActualActiveVideoInput == eVst.Hdmi2) - return tx.HdmiInputs[2].VideoAttributes.GetVideoResolutionString(); - if (ActualActiveVideoInput == eVst.Vga) - return tx.DisplayPortInput.VideoAttributes.GetVideoResolutionString(); - return ""; - }, - VideoSyncFeedbackFunc = () => - (ActualActiveVideoInput == eVst.Hdmi1 - && tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue) - || (ActualActiveVideoInput == eVst.Hdmi2 - && tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue) - || (ActualActiveVideoInput == eVst.Vga - && tx.DisplayPortInput.SyncDetectedFeedback.BoolValue) - - }; - - AnyVideoInput = new RoutingInputPortWithVideoStatuses(DmPortName.AnyVideoIn, - eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.None, 0, this, combinedFuncs); - - DmOut = new RoutingOutputPort(DmPortName.DmOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, - eRoutingPortConnectionType.DmCat, null, this); - HdmiLoopOut = new RoutingOutputPort(DmPortName.HdmiLoopOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, - eRoutingPortConnectionType.Hdmi, null, this); - - - AddToFeedbackList(ActiveVideoInputFeedback, VideoSourceNumericFeedback, AudioSourceNumericFeedback, - AnyVideoInput.VideoStatus.HasVideoStatusFeedback, AnyVideoInput.VideoStatus.HdcpActiveFeedback, - AnyVideoInput.VideoStatus.HdcpStateFeedback, AnyVideoInput.VideoStatus.VideoResolutionFeedback, - AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiIn1HdcpCapabilityFeedback, HdmiIn2HdcpCapabilityFeedback, - Hdmi1VideoSyncFeedback, Hdmi2VideoSyncFeedback, DisplayPortVideoSyncFeedback); - - // Set Ports for CEC - HdmiIn1.Port = Tx.HdmiInputs[1]; - HdmiIn2.Port = Tx.HdmiInputs[2]; - HdmiLoopOut.Port = Tx.HdmiOutput; - DmOut.Port = Tx.DmOutput; - } - - - - public override bool CustomActivate() - { - // Link up all of these damned events to the various RoutingPorts via a helper handler - Tx.HdmiInputs[1].InputStreamChange += (o, a) => FowardInputStreamChange(HdmiIn1, a.EventId); - Tx.HdmiInputs[1].VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(HdmiIn1, a.EventId); - - Tx.HdmiInputs[2].InputStreamChange += (o, a) => FowardInputStreamChange(HdmiIn2, a.EventId); - Tx.HdmiInputs[2].VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(HdmiIn2, a.EventId); - - Tx.DisplayPortInput.InputStreamChange += (o, a) => FowardInputStreamChange(DisplayPortIn, a.EventId); - Tx.DisplayPortInput.VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(DisplayPortIn, a.EventId); - - // Base does register and sets up comm monitoring. - return base.CustomActivate(); - } - - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) - { - DmTxControllerJoinMap joinMap = GetDmTxJoinMap(joinStart, joinMapKey); - - if (Hdmi1VideoSyncFeedback != null) +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.DeviceSupport; +using Crestron.SimplSharpPro.DM; +using Crestron.SimplSharpPro.DM.Endpoints; +using Crestron.SimplSharpPro.DM.Endpoints.Transmitters; + +using PepperDash.Core; +using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; +using PepperDash.Essentials.DM.Config; + +namespace PepperDash.Essentials.DM +{ + using eVst = Crestron.SimplSharpPro.DeviceSupport.eX02VideoSourceType; + using eAst = Crestron.SimplSharpPro.DeviceSupport.eX02AudioSourceType; + + public class DmTx4kz302CController : DmTxControllerBase, ITxRouting, IHasFeedback, + IIROutputPorts, IComPorts + { + public DmTx4kz302C Tx { get; private set; } + + public RoutingInputPortWithVideoStatuses HdmiIn1 { get; private set; } + public RoutingInputPortWithVideoStatuses HdmiIn2 { get; private set; } + public RoutingInputPortWithVideoStatuses DisplayPortIn { get; private set; } + public RoutingOutputPort DmOut { get; private set; } + public RoutingOutputPort HdmiLoopOut { get; private set; } + + public override StringFeedback ActiveVideoInputFeedback { get; protected set; } + public IntFeedback VideoSourceNumericFeedback { get; protected set; } + public IntFeedback AudioSourceNumericFeedback { get; protected set; } + public IntFeedback HdmiIn1HdcpCapabilityFeedback { get; protected set; } + public IntFeedback HdmiIn2HdcpCapabilityFeedback { get; protected set; } + public BoolFeedback Hdmi1VideoSyncFeedback { get; protected set; } + public BoolFeedback Hdmi2VideoSyncFeedback { get; protected set; } + public BoolFeedback DisplayPortVideoSyncFeedback { get; protected set; } + + //public override IntFeedback HdcpSupportAllFeedback { get; protected set; } + //public override ushort HdcpSupportCapability { get; protected set; } + + /// + /// Helps get the "real" inputs, including when in Auto + /// + public Crestron.SimplSharpPro.DeviceSupport.eX02VideoSourceType ActualActiveVideoInput + { + get { - Hdmi1VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input1VideoSyncStatus.JoinNumber]); - } - if (Hdmi2VideoSyncFeedback != null) + if (Tx.VideoSourceFeedback != eVst.Auto) + return Tx.VideoSourceFeedback; + else // auto + { + if (Tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue) + return eVst.Hdmi1; + else if (Tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue) + return eVst.Hdmi2; + else if (Tx.DisplayPortInput.SyncDetectedFeedback.BoolValue) + return eVst.Vga; + else + return eVst.AllDisabled; + } + } + } + public RoutingPortCollection InputPorts + { + get { - Hdmi2VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input2VideoSyncStatus.JoinNumber]); - } - if (DisplayPortVideoSyncFeedback != null) + return new RoutingPortCollection + { + HdmiIn1, + HdmiIn2, + DisplayPortIn, + AnyVideoInput + }; + } + } + public RoutingPortCollection OutputPorts + { + get { - DisplayPortVideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input3VideoSyncStatus.JoinNumber]); - } - - LinkDmTxToApi(this, trilist, joinMap, bridge); - } - - public void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type) - { - Debug.Console(2, this, "Executing Numeric Switch to input {0}.", input); - - switch (input) - { - case 0: - { - ExecuteSwitch(eVst.Auto, null, eRoutingSignalType.Audio | eRoutingSignalType.Video); - break; - } - case 1: - { - ExecuteSwitch(HdmiIn1.Selector, null, eRoutingSignalType.Audio | eRoutingSignalType.Video); - break; - } - case 2: - { - ExecuteSwitch(HdmiIn2.Selector, null, eRoutingSignalType.Audio | eRoutingSignalType.Video); - break; - } - case 3: - { - ExecuteSwitch(DisplayPortIn.Selector, null, eRoutingSignalType.Audio | eRoutingSignalType.Video); - break; - } - case 4: - { - ExecuteSwitch(eVst.AllDisabled, null, eRoutingSignalType.Audio | eRoutingSignalType.Video); - break; - } - } - - - } - - public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType) - { - if ((signalType | eRoutingSignalType.Video) == eRoutingSignalType.Video) - Tx.VideoSource = (eVst)inputSelector; - - // NOTE: It's possible that this particular TX model may not like the AudioSource property being set. - // The SIMPL definition only shows a single analog for AudioVideo Source - if ((signalType | eRoutingSignalType.Audio) == eRoutingSignalType.Audio) - Tx.AudioSource = (eAst)inputSelector; - } - - void InputStreamChangeEvent(EndpointInputStream inputStream, EndpointInputStreamEventArgs args) - { - Debug.Console(2, "{0} event {1} stream {2}", this.Tx.ToString(), inputStream.ToString(), args.EventId.ToString()); - - if (args.EventId == EndpointInputStreamEventIds.HdcpSupportOffFeedbackEventId) - { - if (inputStream == Tx.HdmiInputs[1]) - HdmiIn1HdcpCapabilityFeedback.FireUpdate(); - else if (inputStream == Tx.HdmiInputs[2]) - HdmiIn2HdcpCapabilityFeedback.FireUpdate(); - } - else if (args.EventId == EndpointInputStreamEventIds.HdcpSupportOnFeedbackEventId) - { - if (inputStream == Tx.HdmiInputs[1]) - HdmiIn1HdcpCapabilityFeedback.FireUpdate(); - else if (inputStream == Tx.HdmiInputs[2]) - HdmiIn2HdcpCapabilityFeedback.FireUpdate(); - } - } - - void Tx_BaseEvent(GenericBase device, BaseEventArgs args) - { - var id = args.EventId; - if (id == EndpointTransmitterBase.VideoSourceFeedbackEventId) - { - Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback); - VideoSourceNumericFeedback.FireUpdate(); - ActiveVideoInputFeedback.FireUpdate(); - } - - // ------------------------------ incomplete ----------------------------------------- - else if (id == EndpointTransmitterBase.AudioSourceFeedbackEventId) - { - Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback); - AudioSourceNumericFeedback.FireUpdate(); - } - } - - /// - /// Relays the input stream change to the appropriate RoutingInputPort. - /// - void FowardInputStreamChange(RoutingInputPortWithVideoStatuses inputPort, int eventId) - { - if (eventId == EndpointInputStreamEventIds.SyncDetectedFeedbackEventId) - { - inputPort.VideoStatus.VideoSyncFeedback.FireUpdate(); - AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate(); - } - } - - /// - /// Relays the VideoAttributes change to a RoutingInputPort - /// - void ForwardVideoAttributeChange(RoutingInputPortWithVideoStatuses inputPort, int eventId) - { - //// LOCATION: Crestron.SimplSharpPro.DM.VideoAttributeEventIds - //Debug.Console(2, this, "VideoAttributes_AttributeChange event id={0} from {1}", - // args.EventId, (sender as VideoAttributesEnhanced).Owner.GetType()); - 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; - } - } - - - #region IIROutputPorts Members - public CrestronCollection IROutputPorts { get { return Tx.IROutputPorts; } } - public int NumberOfIROutputPorts { get { return Tx.NumberOfIROutputPorts; } } - #endregion - - #region IComPorts Members - public CrestronCollection ComPorts { get { return Tx.ComPorts; } } - public int NumberOfComPorts { get { return Tx.NumberOfComPorts; } } - #endregion - } + return new RoutingPortCollection { DmOut, HdmiLoopOut }; + } + } + public DmTx4kz302CController(string key, string name, DmTx4kz302C tx) + : base(key, name, tx) + { + Tx = tx; + + HdmiIn1 = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn1, + eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eVst.Hdmi1, this, + VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInputs[1])); + HdmiIn2 = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn2, + eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eVst.Hdmi2, this, + VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInputs[2])); + DisplayPortIn = new RoutingInputPortWithVideoStatuses(DmPortName.VgaIn, + eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DisplayPort, eVst.DisplayPort, this, + VideoStatusHelper.GetDisplayPortInputStatusFuncs(tx.DisplayPortInput)); + ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput", + () => ActualActiveVideoInput.ToString()); + + Tx.HdmiInputs[1].InputStreamChange += InputStreamChangeEvent; + Tx.HdmiInputs[2].InputStreamChange += InputStreamChangeEvent; + Tx.BaseEvent += Tx_BaseEvent; + + VideoSourceNumericFeedback = new IntFeedback(() => + { + return (int)Tx.VideoSourceFeedback; + }); + AudioSourceNumericFeedback = new IntFeedback(() => + { + return (int)Tx.AudioSourceFeedback; + }); + + HdmiIn1HdcpCapabilityFeedback = new IntFeedback("HdmiIn1HdcpCapability", () => + { + return (int)tx.HdmiInputs[1].HdcpCapabilityFeedback; + }); + + HdmiIn2HdcpCapabilityFeedback = new IntFeedback("HdmiIn2HdcpCapability", () => + { + return (int)tx.HdmiInputs[2].HdcpCapabilityFeedback; + }); + + HdcpSupportCapability = eHdcpCapabilityType.Hdcp2_2Support; + + Hdmi1VideoSyncFeedback = new BoolFeedback(() => + { + return (bool)tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue; + }); + + Hdmi2VideoSyncFeedback = new BoolFeedback(() => + { + return (bool)tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue; + }); + + DisplayPortVideoSyncFeedback = new BoolFeedback(() => + { + return (bool)tx.DisplayPortInput.SyncDetectedFeedback.BoolValue; + }); + + + var combinedFuncs = new VideoStatusFuncsWrapper + { + HdcpActiveFeedbackFunc = () => + (ActualActiveVideoInput == eVst.Hdmi1 + && tx.HdmiInputs[1].VideoAttributes.HdcpActiveFeedback.BoolValue) + || (ActualActiveVideoInput == eVst.Hdmi2 + && tx.HdmiInputs[2].VideoAttributes.HdcpActiveFeedback.BoolValue), + + HdcpStateFeedbackFunc = () => + { + if (ActualActiveVideoInput == eVst.Hdmi1) + return tx.HdmiInputs[1].VideoAttributes.HdcpStateFeedback.ToString(); + if (ActualActiveVideoInput == eVst.Hdmi2) + return tx.HdmiInputs[2].VideoAttributes.HdcpStateFeedback.ToString(); + return ""; + }, + + VideoResolutionFeedbackFunc = () => + { + if (ActualActiveVideoInput == eVst.Hdmi1) + return tx.HdmiInputs[1].VideoAttributes.GetVideoResolutionString(); + if (ActualActiveVideoInput == eVst.Hdmi2) + return tx.HdmiInputs[2].VideoAttributes.GetVideoResolutionString(); + if (ActualActiveVideoInput == eVst.Vga) + return tx.DisplayPortInput.VideoAttributes.GetVideoResolutionString(); + return ""; + }, + VideoSyncFeedbackFunc = () => + (ActualActiveVideoInput == eVst.Hdmi1 + && tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue) + || (ActualActiveVideoInput == eVst.Hdmi2 + && tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue) + || (ActualActiveVideoInput == eVst.Vga + && tx.DisplayPortInput.SyncDetectedFeedback.BoolValue) + + }; + + AnyVideoInput = new RoutingInputPortWithVideoStatuses(DmPortName.AnyVideoIn, + eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.None, 0, this, combinedFuncs); + + DmOut = new RoutingOutputPort(DmPortName.DmOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.DmCat, null, this); + HdmiLoopOut = new RoutingOutputPort(DmPortName.HdmiLoopOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.Hdmi, null, this); + + + AddToFeedbackList(ActiveVideoInputFeedback, VideoSourceNumericFeedback, AudioSourceNumericFeedback, + AnyVideoInput.VideoStatus.HasVideoStatusFeedback, AnyVideoInput.VideoStatus.HdcpActiveFeedback, + AnyVideoInput.VideoStatus.HdcpStateFeedback, AnyVideoInput.VideoStatus.VideoResolutionFeedback, + AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiIn1HdcpCapabilityFeedback, HdmiIn2HdcpCapabilityFeedback, + Hdmi1VideoSyncFeedback, Hdmi2VideoSyncFeedback, DisplayPortVideoSyncFeedback); + + // Set Ports for CEC + HdmiIn1.Port = Tx.HdmiInputs[1]; + HdmiIn2.Port = Tx.HdmiInputs[2]; + HdmiLoopOut.Port = Tx.HdmiOutput; + DmOut.Port = Tx.DmOutput; + } + + + + public override bool CustomActivate() + { + // Link up all of these damned events to the various RoutingPorts via a helper handler + Tx.HdmiInputs[1].InputStreamChange += (o, a) => FowardInputStreamChange(HdmiIn1, a.EventId); + Tx.HdmiInputs[1].VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(HdmiIn1, a.EventId); + + Tx.HdmiInputs[2].InputStreamChange += (o, a) => FowardInputStreamChange(HdmiIn2, a.EventId); + Tx.HdmiInputs[2].VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(HdmiIn2, a.EventId); + + Tx.DisplayPortInput.InputStreamChange += (o, a) => FowardInputStreamChange(DisplayPortIn, a.EventId); + Tx.DisplayPortInput.VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(DisplayPortIn, a.EventId); + + // Base does register and sets up comm monitoring. + return base.CustomActivate(); + } + + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) + { + DmTxControllerJoinMap joinMap = GetDmTxJoinMap(joinStart, joinMapKey); + + if (Hdmi1VideoSyncFeedback != null) + { + Hdmi1VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input1VideoSyncStatus.JoinNumber]); + } + if (Hdmi2VideoSyncFeedback != null) + { + Hdmi2VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input2VideoSyncStatus.JoinNumber]); + } + if (DisplayPortVideoSyncFeedback != null) + { + DisplayPortVideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input3VideoSyncStatus.JoinNumber]); + } + + LinkDmTxToApi(this, trilist, joinMap, bridge); + } + + public void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type) + { + Debug.Console(2, this, "Executing Numeric Switch to input {0}.", input); + + switch (input) + { + case 0: + { + ExecuteSwitch(eVst.Auto, null, eRoutingSignalType.Audio | eRoutingSignalType.Video); + break; + } + case 1: + { + ExecuteSwitch(HdmiIn1.Selector, null, eRoutingSignalType.Audio | eRoutingSignalType.Video); + break; + } + case 2: + { + ExecuteSwitch(HdmiIn2.Selector, null, eRoutingSignalType.Audio | eRoutingSignalType.Video); + break; + } + case 3: + { + ExecuteSwitch(DisplayPortIn.Selector, null, eRoutingSignalType.Audio | eRoutingSignalType.Video); + break; + } + case 4: + { + ExecuteSwitch(eVst.AllDisabled, null, eRoutingSignalType.Audio | eRoutingSignalType.Video); + break; + } + } + + + } + + public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType) + { + if ((signalType | eRoutingSignalType.Video) == eRoutingSignalType.Video) + Tx.VideoSource = (eVst)inputSelector; + + // NOTE: It's possible that this particular TX model may not like the AudioSource property being set. + // The SIMPL definition only shows a single analog for AudioVideo Source + if ((signalType | eRoutingSignalType.Audio) == eRoutingSignalType.Audio) + Tx.AudioSource = (eAst)inputSelector; + } + + void InputStreamChangeEvent(EndpointInputStream inputStream, EndpointInputStreamEventArgs args) + { + Debug.Console(2, "{0} event {1} stream {2}", this.Tx.ToString(), inputStream.ToString(), args.EventId.ToString()); + + if (args.EventId == EndpointInputStreamEventIds.HdcpSupportOffFeedbackEventId) + { + if (inputStream == Tx.HdmiInputs[1]) + HdmiIn1HdcpCapabilityFeedback.FireUpdate(); + else if (inputStream == Tx.HdmiInputs[2]) + HdmiIn2HdcpCapabilityFeedback.FireUpdate(); + } + else if (args.EventId == EndpointInputStreamEventIds.HdcpSupportOnFeedbackEventId) + { + if (inputStream == Tx.HdmiInputs[1]) + HdmiIn1HdcpCapabilityFeedback.FireUpdate(); + else if (inputStream == Tx.HdmiInputs[2]) + HdmiIn2HdcpCapabilityFeedback.FireUpdate(); + } + } + + void Tx_BaseEvent(GenericBase device, BaseEventArgs args) + { + var id = args.EventId; + if (id == EndpointTransmitterBase.VideoSourceFeedbackEventId) + { + Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback); + VideoSourceNumericFeedback.FireUpdate(); + ActiveVideoInputFeedback.FireUpdate(); + } + + // ------------------------------ incomplete ----------------------------------------- + else if (id == EndpointTransmitterBase.AudioSourceFeedbackEventId) + { + Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback); + AudioSourceNumericFeedback.FireUpdate(); + } + } + + /// + /// Relays the input stream change to the appropriate RoutingInputPort. + /// + void FowardInputStreamChange(RoutingInputPortWithVideoStatuses inputPort, int eventId) + { + if (eventId == EndpointInputStreamEventIds.SyncDetectedFeedbackEventId) + { + inputPort.VideoStatus.VideoSyncFeedback.FireUpdate(); + AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate(); + } + } + + /// + /// Relays the VideoAttributes change to a RoutingInputPort + /// + void ForwardVideoAttributeChange(RoutingInputPortWithVideoStatuses inputPort, int eventId) + { + //// LOCATION: Crestron.SimplSharpPro.DM.VideoAttributeEventIds + //Debug.Console(2, this, "VideoAttributes_AttributeChange event id={0} from {1}", + // args.EventId, (sender as VideoAttributesEnhanced).Owner.GetType()); + 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; + } + } + + + #region IIROutputPorts Members + public CrestronCollection IROutputPorts { get { return Tx.IROutputPorts; } } + public int NumberOfIROutputPorts { get { return Tx.NumberOfIROutputPorts; } } + #endregion + + #region IComPorts Members + public CrestronCollection ComPorts { get { return Tx.ComPorts; } } + public int NumberOfComPorts { get { return Tx.NumberOfComPorts; } } + #endregion + } } \ No newline at end of file From 26eedb684a721584cd6fe83fe07c8e883abc9a8b Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Tue, 12 May 2020 09:46:35 -0500 Subject: [PATCH 136/156] resolves #171 - Added DmTx4kz100C1G controller to essentials and added config values to instantiate it --- .../Transmitters/DmTx4kz100Controller.cs | 302 ++++++++++++++++++ .../Endpoints/Transmitters/DmTxHelpers.cs | 6 + .../PepperDash_Essentials_DM.csproj | 1 + 3 files changed, 309 insertions(+) create mode 100644 essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz100Controller.cs diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz100Controller.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz100Controller.cs new file mode 100644 index 00000000..20a6267a --- /dev/null +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz100Controller.cs @@ -0,0 +1,302 @@ +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.Endpoints; +using Crestron.SimplSharpPro.DM.Endpoints.Transmitters; + +using PepperDash.Core; +using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; +using PepperDash.Essentials.DM.Config; + +namespace PepperDash.Essentials.DM +{ + // using eVst = Crestron.SimplSharpPro.DeviceSupport.eX02VideoSourceType; + + /// + /// Controller class for all DM-TX-201C/S/F transmitters + /// + public class DmTx4kz100Controller : DmTxControllerBase, IRoutingInputsOutputs, IHasFeedback + { + public DmTx4kz100C1G Tx { get; private set; } + + public RoutingInputPortWithVideoStatuses HdmiInput { get; private set; } + public RoutingOutputPort DmOutput { get; private set; } + + public override StringFeedback ActiveVideoInputFeedback { get; protected set; } + public IntFeedback HdmiInHdcpCapabilityFeedback { get; protected set; } + public BoolFeedback HdmiVideoSyncFeedback { get; protected set; } + + /// + /// Helps get the "real" inputs, including when in Auto + /// + public DmTx200Base.eSourceSelection ActualActiveVideoInput + { + get + { + if (Tx.VideoSourceFeedback == DmTx200Base.eSourceSelection.Digital || + Tx.VideoSourceFeedback == DmTx200Base.eSourceSelection.Analog || + Tx.VideoSourceFeedback == DmTx200Base.eSourceSelection.Disable) + return Tx.VideoSourceFeedback; + else // auto + { + if (Tx.HdmiInput.SyncDetectedFeedback.BoolValue) + return DmTx200Base.eSourceSelection.Digital; + else if (Tx.VgaInput.SyncDetectedFeedback.BoolValue) + return DmTx200Base.eSourceSelection.Analog; + else + return DmTx200Base.eSourceSelection.Disable; + } + } + } + + public RoutingPortCollection InputPorts + { + get + { + return new RoutingPortCollection + { + HdmiInput + }; + } + } + + public RoutingPortCollection OutputPorts + { + get + { + return new RoutingPortCollection { DmOutput }; + } + } + + /// + /// + /// + /// + /// + /// + public DmTx4kz100Controller(string key, string name, DmTx4kz100C1G tx) + : base(key, name, tx) + { + Tx = tx; + + HdmiInput = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn, + eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, DmTx200Base.eSourceSelection.Digital, this, + VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInput)); + + ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput", + () => ActualActiveVideoInput.ToString()); + + Tx.HdmiInput.InputStreamChange += new EndpointInputStreamChangeEventHandler(InputStreamChangeEvent); + Tx.BaseEvent += Tx_BaseEvent; + Tx.OnlineStatusChange += new OnlineStatusChangeEventHandler(Tx_OnlineStatusChange); + + + HdmiInHdcpCapabilityFeedback = new IntFeedback("HdmiInHdcpCapability", () => + { + if (tx.HdmiInput.HdcpSupportOnFeedback.BoolValue) + return 1; + else + return 0; + }); + + HdcpSupportCapability = eHdcpCapabilityType.HdcpAutoSupport; + + HdmiVideoSyncFeedback = new BoolFeedback(() => + { + return (bool)tx.HdmiInput.SyncDetectedFeedback.BoolValue; + }); + + + var combinedFuncs = new VideoStatusFuncsWrapper + { + HdcpActiveFeedbackFunc = () => + (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital + && tx.HdmiInput.VideoAttributes.HdcpActiveFeedback.BoolValue), + + HdcpStateFeedbackFunc = () => + { + if (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital) + return tx.HdmiInput.VideoAttributes.HdcpStateFeedback.ToString(); + return ""; + }, + + VideoResolutionFeedbackFunc = () => + { + if (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital) + return tx.HdmiInput.VideoAttributes.GetVideoResolutionString(); + if (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Analog) + return tx.VgaInput.VideoAttributes.GetVideoResolutionString(); + return ""; + }, + VideoSyncFeedbackFunc = () => + (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital + && tx.HdmiInput.SyncDetectedFeedback.BoolValue) + || (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Analog + && tx.VgaInput.SyncDetectedFeedback.BoolValue) + || (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Auto + && (tx.VgaInput.SyncDetectedFeedback.BoolValue || tx.HdmiInput.SyncDetectedFeedback.BoolValue)) + + }; + + AnyVideoInput = new RoutingInputPortWithVideoStatuses(DmPortName.AnyVideoIn, + eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.None, 0, this, combinedFuncs); + + DmOutput = new RoutingOutputPort(DmPortName.DmOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmCat, null, this); + + AddToFeedbackList(ActiveVideoInputFeedback, + AnyVideoInput.VideoStatus.HasVideoStatusFeedback, AnyVideoInput.VideoStatus.HdcpActiveFeedback, + AnyVideoInput.VideoStatus.HdcpStateFeedback, AnyVideoInput.VideoStatus.VideoResolutionFeedback, + AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiInHdcpCapabilityFeedback, HdmiVideoSyncFeedback + ); + + // Set Ports for CEC + HdmiInput.Port = Tx.HdmiInput; + DmOutput.Port = Tx.DmOutput; + } + + + void Tx_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args) + { + ActiveVideoInputFeedback.FireUpdate(); + HdmiVideoSyncFeedback.FireUpdate(); + } + + public override bool CustomActivate() + { + + Tx.HdmiInput.InputStreamChange += (o, a) => FowardInputStreamChange(HdmiInput, a.EventId); + Tx.HdmiInput.VideoAttributes.AttributeChange += (o, a) => FireVideoAttributeChange(HdmiInput, a.EventId); + + // Base does register and sets up comm monitoring. + return base.CustomActivate(); + } + + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) + { + DmTxControllerJoinMap joinMap = GetDmTxJoinMap(joinStart, joinMapKey); + + if (HdmiVideoSyncFeedback != null) + { + HdmiVideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input1VideoSyncStatus.JoinNumber]); + } + + LinkDmTxToApi(this, trilist, joinMap, bridge); + } + + /// + /// Enables or disables free run + /// + /// + public void SetFreeRunEnabled(bool enable) + { + if (enable) + { + Tx.VgaInput.FreeRun = eDmFreeRunSetting.Enabled; + } + else + { + Tx.VgaInput.FreeRun = eDmFreeRunSetting.Disabled; + } + } + + /// + /// Sets the VGA brightness level + /// + /// + public void SetVgaBrightness(ushort level) + { + Tx.VgaInput.VideoControls.Brightness.UShortValue = level; + } + + /// + /// Sets the VGA contrast level + /// + /// + public void SetVgaContrast(ushort level) + { + Tx.VgaInput.VideoControls.Contrast.UShortValue = level; + } + + + void Tx_BaseEvent(GenericBase device, BaseEventArgs args) + { + var id = args.EventId; + Debug.Console(2, this, "EventId {0}", args.EventId); + + if (id == EndpointTransmitterBase.VideoSourceFeedbackEventId) + { + Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback); + ActiveVideoInputFeedback.FireUpdate(); + } + + // ------------------------------ incomplete ----------------------------------------- + else if (id == EndpointTransmitterBase.AudioSourceFeedbackEventId) + { + Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback); + } + } + + void InputStreamChangeEvent(EndpointInputStream inputStream, EndpointInputStreamEventArgs args) + { + Debug.Console(2, "{0} event {1} stream {2}", this.Tx.ToString(), inputStream.ToString(), args.EventId.ToString()); + + if (args.EventId == EndpointInputStreamEventIds.HdcpSupportOffFeedbackEventId) + { + HdmiInHdcpCapabilityFeedback.FireUpdate(); + } + else if (args.EventId == EndpointInputStreamEventIds.HdcpSupportOnFeedbackEventId) + { + HdmiInHdcpCapabilityFeedback.FireUpdate(); + } + } + + /// + /// Relays the input stream change to the appropriate RoutingInputPort. + /// + void FowardInputStreamChange(RoutingInputPortWithVideoStatuses inputPort, int eventId) + { + if (eventId == EndpointInputStreamEventIds.SyncDetectedFeedbackEventId) + { + inputPort.VideoStatus.VideoSyncFeedback.FireUpdate(); + AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate(); + } + } + + /// + /// Relays the VideoAttributes change to a RoutingInputPort + /// + void FireVideoAttributeChange(RoutingInputPortWithVideoStatuses inputPort, int eventId) + { + //// LOCATION: Crestron.SimplSharpPro.DM.VideoAttributeEventIds + //Debug.Console(2, this, "VideoAttributes_AttributeChange event id={0} from {1}", + // args.EventId, (sender as VideoAttributesEnhanced).Owner.GetType()); + 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; + } + } + + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs index d5fd9dd2..d5d44567 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs @@ -43,6 +43,8 @@ namespace PepperDash.Essentials.DM { if(typeName.StartsWith("dmtx200")) return new DmTx200Controller(key, name, new DmTx200C2G(ipid, Global.ControlSystem)); + if (typeName.StartsWith("dmtx4kz100")) + return new DmTx4kz100Controller(key, name, new DmTx4kz100C1G(ipid, Global.ControlSystem)); if (typeName.StartsWith("dmtx201")) return new DmTx201XController(key, name, new DmTx201S(ipid, Global.ControlSystem)); if (typeName.StartsWith("dmtx4k202")) @@ -104,6 +106,8 @@ namespace PepperDash.Essentials.DM return new DmTx201XController(key, name, new DmTx201C(chassis.Inputs[num])); if (typeName.StartsWith("dmtx4k100")) return new DmTx4k100Controller(key, name, new DmTx4K100C1G(chassis.Inputs[num])); + if (typeName.StartsWith("dmtx4kz100")) + return new DmTx4kz100Controller(key, name, new DmTx4kz100C1G(chassis.Inputs[num])); if (typeName.StartsWith("dmtx4k202")) return new DmTx4k202CController(key, name, new DmTx4k202C(chassis.Inputs[num])); if (typeName.StartsWith("dmtx4kz202")) @@ -123,6 +127,8 @@ namespace PepperDash.Essentials.DM return new DmTx201XController(key, name, new DmTx201C(ipid, chassis.Inputs[num])); if (typeName.StartsWith("dmtx4k100")) return new DmTx4k100Controller(key, name, new DmTx4K100C1G(ipid, chassis.Inputs[num])); + if (typeName.StartsWith("dmtx4kz100")) + return new DmTx4kz100Controller(key, name, new DmTx4kz100C1G(ipid, chassis.Inputs[num])); if (typeName.StartsWith("dmtx4k202")) return new DmTx4k202CController(key, name, new DmTx4k202C(ipid, chassis.Inputs[num])); if (typeName.StartsWith("dmtx4kz202")) diff --git a/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj b/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj index 8467f92a..2c245384 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj +++ b/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj @@ -102,6 +102,7 @@ + From b671f4c77e1f8c9fa04091a1569f6d0630b89077 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Tue, 12 May 2020 10:12:06 -0500 Subject: [PATCH 137/156] Added CEC, Comports, and IR to DmTx4kz100Controller --- .../Transmitters/DmTx4kz100Controller.cs | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz100Controller.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz100Controller.cs index 20a6267a..036602d3 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz100Controller.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz100Controller.cs @@ -21,7 +21,8 @@ namespace PepperDash.Essentials.DM /// /// Controller class for all DM-TX-201C/S/F transmitters /// - public class DmTx4kz100Controller : DmTxControllerBase, IRoutingInputsOutputs, IHasFeedback + public class DmTx4kz100Controller : DmTxControllerBase, IRoutingInputsOutputs, IHasFeedback, + IIROutputPorts, IComPorts, ICec { public DmTx4kz100C1G Tx { get; private set; } @@ -297,6 +298,23 @@ namespace PepperDash.Essentials.DM break; } } + #region IIROutputPorts Members + public CrestronCollection IROutputPorts { get { return Tx.IROutputPorts; } } + public int NumberOfIROutputPorts { get { return Tx.NumberOfIROutputPorts; } } + #endregion + + #region IComPorts Members + public CrestronCollection ComPorts { get { return Tx.ComPorts; } } + public int NumberOfComPorts { get { return Tx.NumberOfComPorts; } } + #endregion + + #region ICec Members + /// + /// Gets the CEC stream directly from the HDMI port. + /// + public Cec StreamCec { get { return Tx.HdmiInput.StreamCec; } } + #endregion + } } \ No newline at end of file From 75e74aa06b31fc50b33a2d53cdf9e53ce2aa1987 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Tue, 12 May 2020 10:22:58 -0500 Subject: [PATCH 138/156] Added dmtx4k100c1g and dmtx4kz100c1g to TypeNames --- .../Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs index d5d44567..4fcc4742 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs @@ -335,7 +335,8 @@ namespace PepperDash.Essentials.DM { public DmTxControllerFactory() { - TypeNames = new List() { "dmtx200c", "dmtx201c", "dmtx201s", "dmtx4k100c", "dmtx4k202c", "dmtx4kz202c", "dmtx4k302c", "dmtx4kz302c", "dmtx401c", "dmtx401s" }; + TypeNames = new List() { "dmtx200c", "dmtx201c", "dmtx201s", "dmtx4k100c", "dmtx4k202c", "dmtx4kz202c", "dmtx4k302c", "dmtx4kz302c", + "dmtx401c", "dmtx401s", "dmtx4k100c1g", "dmtx4kz100c1g" }; } public override EssentialsDevice BuildDevice(DeviceConfig dc) From 966a6c194fd40f575838a3be067362b451898b53 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Wed, 6 May 2020 08:45:20 -0600 Subject: [PATCH 139/156] Adds CCriticalSection and try/finally for all Device Dictionary accesses --- .../Devices/DeviceManager.cs | 274 +++++++++++------- 1 file changed, 174 insertions(+), 100 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/DeviceManager.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/DeviceManager.cs index 6fa1f558..2f37b016 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/DeviceManager.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/DeviceManager.cs @@ -17,6 +17,7 @@ namespace PepperDash.Essentials.Core { public static class DeviceManager { + private static readonly CCriticalSection DeviceCriticalSection = new CCriticalSection(); //public static List Devices { get { return _Devices; } } //static List _Devices = new List(); @@ -58,47 +59,55 @@ namespace PepperDash.Essentials.Core /// public static void ActivateAll() { - // PreActivate all devices - foreach (var d in Devices.Values) - { - try - { - if (d is Device) - (d as Device).PreActivate(); - } - catch (Exception e) - { - Debug.Console(0, d, "ERROR: Device PreActivation failure:\r{0}", e); - } - } + try + { + DeviceCriticalSection.Enter(); + // PreActivate all devices + foreach (var d in Devices.Values) + { + try + { + if (d is Device) + (d as Device).PreActivate(); + } + catch (Exception e) + { + Debug.Console(0, d, "ERROR: Device PreActivation failure:\r{0}", e); + } + } - // Activate all devices - foreach (var d in Devices.Values) - { - try - { - if (d is Device) - (d as Device).Activate(); - } - catch (Exception e) - { - Debug.Console(0, d, "ERROR: Device Activation failure:\r{0}", e); - } - } + // Activate all devices + foreach (var d in Devices.Values) + { + try + { + if (d is Device) + (d as Device).Activate(); + } + catch (Exception e) + { + Debug.Console(0, d, "ERROR: Device Activation failure:\r{0}", e); + } + } - // PostActivate all devices - foreach (var d in Devices.Values) - { - try - { - if (d is Device) - (d as Device).PostActivate(); - } - catch (Exception e) - { - Debug.Console(0, d, "ERROR: Device PostActivation failure:\r{0}", e); - } - } + // PostActivate all devices + foreach (var d in Devices.Values) + { + try + { + if (d is Device) + (d as Device).PostActivate(); + } + catch (Exception e) + { + Debug.Console(0, d, "ERROR: Device PostActivation failure:\r{0}", e); + } + } + } + finally + { + DeviceCriticalSection.Leave(); + } } /// @@ -106,11 +115,19 @@ namespace PepperDash.Essentials.Core /// public static void DeactivateAll() { - foreach (var d in Devices.Values) - { - if (d is Device) - (d as Device).Deactivate(); - } + try + { + DeviceCriticalSection.Enter(); + foreach (var d in Devices.Values) + { + if (d is Device) + (d as Device).Deactivate(); + } + } + finally + { + DeviceCriticalSection.Leave(); + } } //static void ListMethods(string devKey) @@ -136,32 +153,45 @@ namespace PepperDash.Essentials.Core static void ListDevices(string s) { - Debug.Console(0, "{0} Devices registered with Device Mangager:",Devices.Count); - var sorted = Devices.Values.ToList(); - sorted.Sort((a, b) => a.Key.CompareTo(b.Key)); + try + { + DeviceCriticalSection.Enter(); + Debug.Console(0, "{0} Devices registered with Device Manager:", Devices.Count); + var sorted = Devices.Values.ToList(); + sorted.Sort((a, b) => a.Key.CompareTo(b.Key)); - foreach (var d in sorted) - { - var name = d is IKeyName ? (d as IKeyName).Name : "---"; - Debug.Console(0, " [{0}] {1}", d.Key, name); - } + foreach (var d in sorted) + { + var name = d is IKeyName ? (d as IKeyName).Name : "---"; + Debug.Console(0, " [{0}] {1}", d.Key, name); + } + } + finally {DeviceCriticalSection.Leave();} } static void ListDeviceFeedbacks(string devKey) { - var dev = GetDeviceForKey(devKey); - if(dev == null) - { - Debug.Console(0, "Device '{0}' not found", devKey); - return; - } - var statusDev = dev as IHasFeedback; - if(statusDev == null) - { - Debug.Console(0, "Device '{0}' does not have visible feedbacks", devKey); - return; - } - statusDev.DumpFeedbacksToConsole(true); + try + { + DeviceCriticalSection.Enter(); + var dev = GetDeviceForKey(devKey); + if (dev == null) + { + Debug.Console(0, "Device '{0}' not found", devKey); + return; + } + var statusDev = dev as IHasFeedback; + if (statusDev == null) + { + Debug.Console(0, "Device '{0}' does not have visible feedbacks", devKey); + return; + } + statusDev.DumpFeedbacksToConsole(true); + } + finally + { + DeviceCriticalSection.Leave(); + } } //static void ListDeviceCommands(string devKey) @@ -177,13 +207,23 @@ namespace PepperDash.Essentials.Core static void ListDeviceCommStatuses(string input) { - var sb = new StringBuilder(); - foreach (var dev in Devices.Values) - { - if (dev is ICommunicationMonitor) - sb.Append(string.Format("{0}: {1}\r", dev.Key, (dev as ICommunicationMonitor).CommunicationMonitor.Status)); - } - CrestronConsole.ConsoleCommandResponse(sb.ToString()); + try + { + DeviceCriticalSection.Enter(); + + var sb = new StringBuilder(); + foreach (var dev in Devices.Values) + { + if (dev is ICommunicationMonitor) + sb.Append(string.Format("{0}: {1}\r", dev.Key, + (dev as ICommunicationMonitor).CommunicationMonitor.Status)); + } + CrestronConsole.ConsoleCommandResponse(sb.ToString()); + } + finally + { + DeviceCriticalSection.Leave(); + } } @@ -194,51 +234,85 @@ namespace PepperDash.Essentials.Core public static void AddDevice(IKeyed newDev) { - // Check for device with same key - //var existingDevice = _Devices.FirstOrDefault(d => d.Key.Equals(newDev.Key, StringComparison.OrdinalIgnoreCase)); - ////// If it exists, remove or warn?? - //if (existingDevice != null) - if(Devices.ContainsKey(newDev.Key)) - { - Debug.Console(0, newDev, "WARNING: A device with this key already exists. Not added to manager"); - return; - } - Devices.Add(newDev.Key, newDev); - //if (!(_Devices.Contains(newDev))) - // _Devices.Add(newDev); + try + { + DeviceCriticalSection.Enter(); + // Check for device with same key + //var existingDevice = _Devices.FirstOrDefault(d => d.Key.Equals(newDev.Key, StringComparison.OrdinalIgnoreCase)); + ////// If it exists, remove or warn?? + //if (existingDevice != null) + if (Devices.ContainsKey(newDev.Key)) + { + Debug.Console(0, newDev, "WARNING: A device with this key already exists. Not added to manager"); + return; + } + Devices.Add(newDev.Key, newDev); + //if (!(_Devices.Contains(newDev))) + // _Devices.Add(newDev); + } + finally {DeviceCriticalSection.Leave();} } public static void RemoveDevice(IKeyed newDev) { - if(newDev == null) - return; - if (Devices.ContainsKey(newDev.Key)) - Devices.Remove(newDev.Key); - //if (_Devices.Contains(newDev)) - // _Devices.Remove(newDev); - else - Debug.Console(0, "Device manager: Device '{0}' does not exist in manager. Cannot remove", newDev.Key); + try + { + DeviceCriticalSection.Enter(); + if (newDev == null) + return; + if (Devices.ContainsKey(newDev.Key)) + Devices.Remove(newDev.Key); + //if (_Devices.Contains(newDev)) + // _Devices.Remove(newDev); + else + Debug.Console(0, "Device manager: Device '{0}' does not exist in manager. Cannot remove", newDev.Key); + } + finally + { + DeviceCriticalSection.Leave(); + } } public static IEnumerable GetDeviceKeys() { - //return _Devices.Select(d => d.Key).ToList(); - return Devices.Keys; + try + { + DeviceCriticalSection.Enter(); + //return _Devices.Select(d => d.Key).ToList(); + return Devices.Keys; + } + finally + { + DeviceCriticalSection.Leave(); + } } public static IEnumerable GetDevices() { - //return _Devices.Select(d => d.Key).ToList(); - return Devices.Values; + try + { + DeviceCriticalSection.Enter(); + //return _Devices.Select(d => d.Key).ToList(); + return Devices.Values; + } + finally {DeviceCriticalSection.Leave();} } public static IKeyed GetDeviceForKey(string key) { - //return _Devices.FirstOrDefault(d => d.Key.Equals(key, StringComparison.OrdinalIgnoreCase)); - if (key != null && Devices.ContainsKey(key)) - return Devices[key]; + try + { + DeviceCriticalSection.Enter(); + //return _Devices.FirstOrDefault(d => d.Key.Equals(key, StringComparison.OrdinalIgnoreCase)); + if (key != null && Devices.ContainsKey(key)) + return Devices[key]; - return null; + return null; + } + finally + { + DeviceCriticalSection.Leave(); + } } /// From fd7f708a83fcef687150002f5e19ab1c778d62c2 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Wed, 6 May 2020 09:51:25 -0600 Subject: [PATCH 140/156] adds protections for devices doing things they shouldn't... --- PepperDashEssentials/ControlSystem.cs | 17 +- .../Devices/DeviceManager.cs | 173 +++++++----------- 2 files changed, 79 insertions(+), 111 deletions(-) diff --git a/PepperDashEssentials/ControlSystem.cs b/PepperDashEssentials/ControlSystem.cs index f0cdc9d5..00748815 100644 --- a/PepperDashEssentials/ControlSystem.cs +++ b/PepperDashEssentials/ControlSystem.cs @@ -26,6 +26,8 @@ namespace PepperDash.Essentials { HttpLogoServer LogoServer; + private CTimer _startTimer; + private const long StartupTime = 500; public ControlSystem() : base() @@ -39,6 +41,11 @@ namespace PepperDash.Essentials /// Entry point for the program /// public override void InitializeSystem() + { + _startTimer = new CTimer(StartSystem,StartupTime); + } + + private void StartSystem(object obj) { DeterminePlatform(); @@ -75,11 +82,11 @@ namespace PepperDash.Essentials }, "showconfig", "Shows the current running merged config", ConsoleAccessLevelEnum.AccessOperator); CrestronConsole.AddNewConsoleCommand(s => - { - CrestronConsole.ConsoleCommandResponse("This system can be found at the following URLs:\r" + - "System URL: {0}\r" + - "Template URL: {1}", ConfigReader.ConfigObject.SystemUrl, ConfigReader.ConfigObject.TemplateUrl); - }, "portalinfo", "Shows portal URLS from configuration", ConsoleAccessLevelEnum.AccessOperator); + { + CrestronConsole.ConsoleCommandResponse("This system can be found at the following URLs:\r" + + "System URL: {0}\r" + + "Template URL: {1}", ConfigReader.ConfigObject.SystemUrl, ConfigReader.ConfigObject.TemplateUrl); + }, "portalinfo", "Shows portal URLS from configuration", ConsoleAccessLevelEnum.AccessOperator); if (!Debug.DoNotLoadOnNextBoot) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/DeviceManager.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/DeviceManager.cs index 2f37b016..01563db7 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/DeviceManager.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/DeviceManager.cs @@ -5,10 +5,6 @@ using System.Text; using System.Text.RegularExpressions; using Crestron.SimplSharp; using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.DeviceSupport; -using Crestron.SimplSharpPro.EthernetCommunication; -using Crestron.SimplSharpPro.UI; -using Crestron.SimplSharp.Reflection; using PepperDash.Core; @@ -18,18 +14,22 @@ namespace PepperDash.Essentials.Core public static class DeviceManager { private static readonly CCriticalSection DeviceCriticalSection = new CCriticalSection(); + private static readonly CEvent AllowAddDevicesCEvent = new CEvent(false, true); //public static List Devices { get { return _Devices; } } //static List _Devices = new List(); - static Dictionary Devices = new Dictionary(StringComparer.OrdinalIgnoreCase); + static readonly Dictionary Devices = new Dictionary(StringComparer.OrdinalIgnoreCase); /// /// Returns a copy of all the devices in a list /// public static List AllDevices { get { return new List(Devices.Values); } } + public static bool AddDeviceEnabled; + public static void Initialize(CrestronControlSystem cs) { + AddDeviceEnabled = true; CrestronConsole.AddNewConsoleCommand(ListDeviceCommStatuses, "devcommstatus", "Lists the communication status of all devices", ConsoleAccessLevelEnum.AccessOperator); CrestronConsole.AddNewConsoleCommand(ListDeviceFeedbacks, "devfb", "Lists current feedbacks", @@ -38,18 +38,9 @@ namespace PepperDash.Essentials.Core ConsoleAccessLevelEnum.AccessOperator); CrestronConsole.AddNewConsoleCommand(DeviceJsonApi.DoDeviceActionWithJson, "devjson", "", ConsoleAccessLevelEnum.AccessOperator); - CrestronConsole.AddNewConsoleCommand(s => - { - CrestronConsole.ConsoleCommandResponse(DeviceJsonApi.GetProperties(s)); - }, "devprops", "", ConsoleAccessLevelEnum.AccessOperator); - CrestronConsole.AddNewConsoleCommand(s => - { - CrestronConsole.ConsoleCommandResponse(DeviceJsonApi.GetMethods(s)); - }, "devmethods", "", ConsoleAccessLevelEnum.AccessOperator); - CrestronConsole.AddNewConsoleCommand(s => - { - CrestronConsole.ConsoleCommandResponse(DeviceJsonApi.GetApiMethods(s)); - }, "apimethods", "", ConsoleAccessLevelEnum.AccessOperator); + CrestronConsole.AddNewConsoleCommand(s => CrestronConsole.ConsoleCommandResponse(DeviceJsonApi.GetProperties(s)), "devprops", "", ConsoleAccessLevelEnum.AccessOperator); + CrestronConsole.AddNewConsoleCommand(s => CrestronConsole.ConsoleCommandResponse(DeviceJsonApi.GetMethods(s)), "devmethods", "", ConsoleAccessLevelEnum.AccessOperator); + CrestronConsole.AddNewConsoleCommand(s => CrestronConsole.ConsoleCommandResponse(DeviceJsonApi.GetApiMethods(s)), "apimethods", "", ConsoleAccessLevelEnum.AccessOperator); CrestronConsole.AddNewConsoleCommand(SimulateComReceiveOnDevice, "devsimreceive", "Simulates incoming data on a com device", ConsoleAccessLevelEnum.AccessOperator); } @@ -62,6 +53,7 @@ namespace PepperDash.Essentials.Core try { DeviceCriticalSection.Enter(); + AddDeviceEnabled = false; // PreActivate all devices foreach (var d in Devices.Values) { @@ -118,10 +110,9 @@ namespace PepperDash.Essentials.Core try { DeviceCriticalSection.Enter(); - foreach (var d in Devices.Values) + foreach (var d in Devices.Values.OfType()) { - if (d is Device) - (d as Device).Deactivate(); + d.Deactivate(); } } finally @@ -151,50 +142,37 @@ namespace PepperDash.Essentials.Core // } //} - static void ListDevices(string s) - { - try - { - DeviceCriticalSection.Enter(); - Debug.Console(0, "{0} Devices registered with Device Manager:", Devices.Count); - var sorted = Devices.Values.ToList(); - sorted.Sort((a, b) => a.Key.CompareTo(b.Key)); + private static void ListDevices(string s) + { + Debug.Console(0, "{0} Devices registered with Device Manager:", Devices.Count); + var sorted = Devices.Values.ToList(); + sorted.Sort((a, b) => a.Key.CompareTo(b.Key)); - foreach (var d in sorted) - { - var name = d is IKeyName ? (d as IKeyName).Name : "---"; - Debug.Console(0, " [{0}] {1}", d.Key, name); - } - } - finally {DeviceCriticalSection.Leave();} - } + foreach (var d in sorted) + { + var name = d is IKeyName ? (d as IKeyName).Name : "---"; + Debug.Console(0, " [{0}] {1}", d.Key, name); + } + } - static void ListDeviceFeedbacks(string devKey) - { - try - { - DeviceCriticalSection.Enter(); - var dev = GetDeviceForKey(devKey); - if (dev == null) - { - Debug.Console(0, "Device '{0}' not found", devKey); - return; - } - var statusDev = dev as IHasFeedback; - if (statusDev == null) - { - Debug.Console(0, "Device '{0}' does not have visible feedbacks", devKey); - return; - } - statusDev.DumpFeedbacksToConsole(true); - } - finally - { - DeviceCriticalSection.Leave(); - } - } + private static void ListDeviceFeedbacks(string devKey) + { + var dev = GetDeviceForKey(devKey); + if (dev == null) + { + Debug.Console(0, "Device '{0}' not found", devKey); + return; + } + var statusDev = dev as IHasFeedback; + if (statusDev == null) + { + Debug.Console(0, "Device '{0}' does not have visible feedbacks", devKey); + return; + } + statusDev.DumpFeedbacksToConsole(true); + } - //static void ListDeviceCommands(string devKey) + //static void ListDeviceCommands(string devKey) //{ // var dev = GetDeviceForKey(devKey); // if (dev == null) @@ -205,29 +183,19 @@ namespace PepperDash.Essentials.Core // Debug.Console(0, "This needs to be reworked. Stay tuned.", devKey); //} - static void ListDeviceCommStatuses(string input) - { - try - { - DeviceCriticalSection.Enter(); - - var sb = new StringBuilder(); - foreach (var dev in Devices.Values) - { - if (dev is ICommunicationMonitor) - sb.Append(string.Format("{0}: {1}\r", dev.Key, - (dev as ICommunicationMonitor).CommunicationMonitor.Status)); - } - CrestronConsole.ConsoleCommandResponse(sb.ToString()); - } - finally - { - DeviceCriticalSection.Leave(); - } - } + private static void ListDeviceCommStatuses(string input) + { + var sb = new StringBuilder(); + foreach (var dev in Devices.Values.OfType()) + { + sb.Append(string.Format("{0}: {1}\r", dev, + dev.CommunicationMonitor.Status)); + } + CrestronConsole.ConsoleCommandResponse(sb.ToString()); + } - //static void DoDeviceCommand(string command) + //static void DoDeviceCommand(string command) //{ // Debug.Console(0, "Not yet implemented. Stay tuned"); //} @@ -236,11 +204,22 @@ namespace PepperDash.Essentials.Core { try { - DeviceCriticalSection.Enter(); + if (!DeviceCriticalSection.TryEnter()) + { + Debug.Console(0, Debug.ErrorLogLevel.Error, "Currently unable to add devices to Device Manager. Please try again"); + return; + } // Check for device with same key //var existingDevice = _Devices.FirstOrDefault(d => d.Key.Equals(newDev.Key, StringComparison.OrdinalIgnoreCase)); ////// If it exists, remove or warn?? //if (existingDevice != null) + + if (!AddDeviceEnabled) + { + Debug.Console(0, Debug.ErrorLogLevel.Error, "All devices have been activated. Adding new devices is not allowed."); + return; + } + if (Devices.ContainsKey(newDev.Key)) { Debug.Console(0, newDev, "WARNING: A device with this key already exists. Not added to manager"); @@ -250,7 +229,10 @@ namespace PepperDash.Essentials.Core //if (!(_Devices.Contains(newDev))) // _Devices.Add(newDev); } - finally {DeviceCriticalSection.Leave();} + finally + { + DeviceCriticalSection.Leave(); + } } public static void RemoveDevice(IKeyed newDev) @@ -275,44 +257,23 @@ namespace PepperDash.Essentials.Core public static IEnumerable GetDeviceKeys() { - try - { - DeviceCriticalSection.Enter(); //return _Devices.Select(d => d.Key).ToList(); return Devices.Keys; - } - finally - { - DeviceCriticalSection.Leave(); - } } public static IEnumerable GetDevices() { - try - { - DeviceCriticalSection.Enter(); //return _Devices.Select(d => d.Key).ToList(); return Devices.Values; - } - finally {DeviceCriticalSection.Leave();} } public static IKeyed GetDeviceForKey(string key) { - try - { - DeviceCriticalSection.Enter(); //return _Devices.FirstOrDefault(d => d.Key.Equals(key, StringComparison.OrdinalIgnoreCase)); if (key != null && Devices.ContainsKey(key)) return Devices[key]; return null; - } - finally - { - DeviceCriticalSection.Leave(); - } } /// @@ -330,7 +291,7 @@ namespace PepperDash.Essentials.Core } //Debug.Console(2, "**** {0} - {1} ****", match.Groups[1].Value, match.Groups[2].Value); - ComPortController com = GetDeviceForKey(match.Groups[1].Value) as ComPortController; + var com = GetDeviceForKey(match.Groups[1].Value) as ComPortController; if (com == null) { CrestronConsole.ConsoleCommandResponse("'{0}' is not a comm port device", match.Groups[1].Value); From ba5ab18fadcd31dcf598936f7009d66e25d7122d Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Tue, 12 May 2020 12:13:08 -0500 Subject: [PATCH 141/156] resolves #174 - fixed constructor issue --- .../Bridges/JoinMaps/DisplayControllerJoinMap.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DisplayControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DisplayControllerJoinMap.cs index a57c35e8..e0b13688 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DisplayControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DisplayControllerJoinMap.cs @@ -70,7 +70,7 @@ namespace PepperDash.Essentials.Core.Bridges new JoinMetadata() { Label = "Is Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); public DisplayControllerJoinMap(uint joinStart) - : base(joinStart, typeof(CameraControllerJoinMap)) + : base(joinStart, typeof(DisplayControllerJoinMap)) { } } From fd3e8d81f8de22fc1dd34a36e2000fff871893fd Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Tue, 12 May 2020 13:28:55 -0500 Subject: [PATCH 142/156] resolves #176 - Added IHasBasicTriListWithSmartObject to DgeController --- .../Endpoints/DGEs/DgeController.cs | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DgeController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DgeController.cs index 6b586ac3..86d05ba8 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DgeController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DgeController.cs @@ -11,26 +11,29 @@ using Newtonsoft.Json; using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Config; +using Crestron.SimplSharpPro.DeviceSupport; namespace PepperDash.Essentials.DM.Endpoints.DGEs { /// /// Wrapper class for DGE-100 and DM-DGE-200-C /// - public class DgeController : CrestronGenericBaseDevice, IComPorts, IIROutputPorts - { - public Dge100 DigitalGraphicsEngine { get; private set; } - - public DeviceConfig DeviceConfig { get; private set; } + public class DgeController : CrestronGenericBaseDevice, IComPorts, IIROutputPorts, IHasBasicTriListWithSmartObject + { + private readonly Dge100 _dge; + + public BasicTriListWithSmartObject Panel { get { return _dge; } } + + public DeviceConfig _dc; CrestronTouchpanelPropertiesConfig PropertiesConfig; public DgeController(string key, string name, Dge100 device, DeviceConfig dc, CrestronTouchpanelPropertiesConfig props) :base(key, name, device) { - DigitalGraphicsEngine = device; + _dge = device; - DeviceConfig = dc; + _dc = dc; PropertiesConfig = props; } @@ -39,12 +42,12 @@ namespace PepperDash.Essentials.DM.Endpoints.DGEs public CrestronCollection ComPorts { - get { return DigitalGraphicsEngine.ComPorts; } + get { return _dge.ComPorts; } } public int NumberOfComPorts { - get { return DigitalGraphicsEngine.NumberOfComPorts; } + get { return _dge.NumberOfComPorts; } } #endregion @@ -53,12 +56,12 @@ namespace PepperDash.Essentials.DM.Endpoints.DGEs public CrestronCollection IROutputPorts { - get { return DigitalGraphicsEngine.IROutputPorts; } + get { return _dge.IROutputPorts; } } public int NumberOfIROutputPorts { - get { return DigitalGraphicsEngine.NumberOfIROutputPorts; } + get { return _dge.NumberOfIROutputPorts; } } #endregion From 0b59dbe20de8b3640692319f260dbdd506c2044e Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Tue, 12 May 2020 14:20:15 -0500 Subject: [PATCH 143/156] Differentiation between Dge100 and DmDge200C --- .../{DgeController.cs => Dge100Controller.cs} | 14 +- .../Endpoints/DGEs/DmDge200CController.cs | 131 ++++++ .../Receivers/DmRmc200CController.cs | 2 +- .../Transmitters/DmTx201CController.cs | 6 +- .../Transmitters/DmTx201SController.cs | 411 ++++++++++++++++++ .../Endpoints/Transmitters/DmTxHelpers.cs | 18 +- .../PepperDash_Essentials_DM.csproj | 4 +- 7 files changed, 567 insertions(+), 19 deletions(-) rename essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/{DgeController.cs => Dge100Controller.cs} (76%) create mode 100644 essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DmDge200CController.cs create mode 100644 essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201SController.cs diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DgeController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/Dge100Controller.cs similarity index 76% rename from essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DgeController.cs rename to essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/Dge100Controller.cs index 86d05ba8..f157f92d 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DgeController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/Dge100Controller.cs @@ -18,7 +18,7 @@ namespace PepperDash.Essentials.DM.Endpoints.DGEs /// /// Wrapper class for DGE-100 and DM-DGE-200-C /// - public class DgeController : CrestronGenericBaseDevice, IComPorts, IIROutputPorts, IHasBasicTriListWithSmartObject + public class Dge100Controller : CrestronGenericBaseDevice, IComPorts, IIROutputPorts, IHasBasicTriListWithSmartObject { private readonly Dge100 _dge; @@ -28,7 +28,7 @@ namespace PepperDash.Essentials.DM.Endpoints.DGEs CrestronTouchpanelPropertiesConfig PropertiesConfig; - public DgeController(string key, string name, Dge100 device, DeviceConfig dc, CrestronTouchpanelPropertiesConfig props) + public Dge100Controller(string key, string name, Dge100 device, DeviceConfig dc, CrestronTouchpanelPropertiesConfig props) :base(key, name, device) { _dge = device; @@ -67,11 +67,11 @@ namespace PepperDash.Essentials.DM.Endpoints.DGEs #endregion } - public class DgeControllerFactory : EssentialsDeviceFactory + public class Dge100ControllerFactory : EssentialsDeviceFactory { - public DgeControllerFactory() + public Dge100ControllerFactory() { - TypeNames = new List() { "dge100", "dmdge200c" }; + TypeNames = new List() { "dge100" }; } public override EssentialsDevice BuildDevice(DeviceConfig dc) @@ -85,8 +85,6 @@ namespace PepperDash.Essentials.DM.Endpoints.DGEs Dge100 dgeDevice = null; if (typeName == "dge100") dgeDevice = new Dge100(comm.IpIdInt, Global.ControlSystem); - else if (typeName == "dmdge200c") - dgeDevice = new DmDge200C(comm.IpIdInt, Global.ControlSystem); if (dgeDevice == null) { @@ -94,7 +92,7 @@ namespace PepperDash.Essentials.DM.Endpoints.DGEs return null; } - var dgeController = new DgeController(dc.Key + "-comPorts", dc.Name, dgeDevice, dc, props); + var dgeController = new Dge100Controller(dc.Key + "-comPorts", dc.Name, dgeDevice, dc, props); return dgeController; } diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DmDge200CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DmDge200CController.cs new file mode 100644 index 00000000..26c1af03 --- /dev/null +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DmDge200CController.cs @@ -0,0 +1,131 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro.UI; + +using Newtonsoft.Json; + +using PepperDash.Core; +using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Config; +using Crestron.SimplSharpPro.DeviceSupport; + +namespace PepperDash.Essentials.DM.Endpoints.DGEs +{ + /// + /// Wrapper class for DGE-100 and DM-DGE-200-C + /// + public class DmDge200CController : CrestronGenericBaseDevice, IComPorts, IIROutputPorts, + IHasBasicTriListWithSmartObject, IRoutingInputsOutputs + { + private readonly DmDge200C _dge; + + public BasicTriListWithSmartObject Panel { get { return _dge; } } + public RoutingInputPort DmIn { get; private set; } + public RoutingOutputPort HdmiOut { get; private set; } + + public RoutingPortCollection InputPorts + { + get; + private set; + } + + public RoutingPortCollection OutputPorts + { + get; + private set; + } + + + public DeviceConfig _dc; + + CrestronTouchpanelPropertiesConfig PropertiesConfig; + + public DmDge200CController(string key, string name, DmDge200C device, DeviceConfig dc, CrestronTouchpanelPropertiesConfig props) + : base(key, name, device) + { + _dge = device; + + _dc = dc; + + PropertiesConfig = props; + + DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.AudioVideo, + eRoutingPortConnectionType.DmCat, 0, this); + HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.AudioVideo, + eRoutingPortConnectionType.Hdmi, null, this); + + + InputPorts = new RoutingPortCollection { DmIn }; + OutputPorts = new RoutingPortCollection { HdmiOut }; + + // Set Ports for CEC + HdmiOut.Port = _dge.HdmiOut; ; + + } + + #region IComPorts Members + + public CrestronCollection ComPorts + { + get { return _dge.ComPorts; } + } + + public int NumberOfComPorts + { + get { return _dge.NumberOfComPorts; } + } + + #endregion + + #region IIROutputPorts Members + + public CrestronCollection IROutputPorts + { + get { return _dge.IROutputPorts; } + } + + public int NumberOfIROutputPorts + { + get { return _dge.NumberOfIROutputPorts; } + } + + #endregion + + } + + public class DmDge200CControllerFactory : EssentialsDeviceFactory + { + public DmDge200CControllerFactory() + { + TypeNames = new List() { "dmdge200c" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + var typeName = dc.Type.ToLower(); + var comm = CommFactory.GetControlPropertiesConfig(dc); + var props = JsonConvert.DeserializeObject(dc.Properties.ToString()); + + Debug.Console(1, "Factory Attempting to create new DgeControllerm Device"); + + DmDge200C dgeDevice = null; + + if (typeName == "dmdge200c") + dgeDevice = new DmDge200C(comm.IpIdInt, Global.ControlSystem); + + if (dgeDevice == null) + { + Debug.Console(1, "Unable to create DGE device"); + return null; + } + + var dgeController = new DmDge200CController(dc.Key + "-comPorts", dc.Name, dgeDevice, dc, props); + + return dgeController; + } + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200CController.cs index 9beaaf42..27187bcd 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200CController.cs @@ -19,7 +19,7 @@ namespace PepperDash.Essentials.DM private readonly DmRmc200C _rmc; public RoutingInputPort DmIn { get; private set; } - public RoutingOutputPort HdmiOut { get; private set; } + public RoutingOutputPort HdmiOut { get; private set; } public RoutingPortCollection InputPorts { diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs index 54be5720..ed614829 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs @@ -21,9 +21,9 @@ namespace PepperDash.Essentials.DM /// /// Controller class for all DM-TX-201C/S/F transmitters /// - public class DmTx201XController : DmTxControllerBase, ITxRouting, IHasFeedback, IHasFreeRun, IVgaBrightnessContrastControls + public class DmTx201CController : DmTxControllerBase, ITxRouting, IHasFeedback, IHasFreeRun, IVgaBrightnessContrastControls { - public DmTx201S Tx { get; private set; } // uses the 201S class as it is the base class for the 201C + public DmTx201C Tx { get; private set; } // uses the 201S class as it is the base class for the 201C public RoutingInputPortWithVideoStatuses HdmiInput { get; private set; } public RoutingInputPortWithVideoStatuses VgaInput { get; private set; } @@ -92,7 +92,7 @@ namespace PepperDash.Essentials.DM /// /// /// - public DmTx201XController(string key, string name, DmTx201S tx) + public DmTx201CController(string key, string name, DmTx201C tx) : base(key, name, tx) { Tx = tx; diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201SController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201SController.cs new file mode 100644 index 00000000..23e93b5d --- /dev/null +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201SController.cs @@ -0,0 +1,411 @@ +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.Endpoints; +using Crestron.SimplSharpPro.DM.Endpoints.Transmitters; + +using PepperDash.Core; +using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; +using PepperDash.Essentials.DM.Config; + +namespace PepperDash.Essentials.DM +{ + // using eVst = Crestron.SimplSharpPro.DeviceSupport.eX02VideoSourceType; + + /// + /// Controller class for all DM-TX-201C/S/F transmitters + /// + public class DmTx201SController : DmTxControllerBase, ITxRouting, IHasFeedback, IHasFreeRun, IVgaBrightnessContrastControls + { + public DmTx201S Tx { get; private set; } // uses the 201S class as it is the base class for the 201C + + public RoutingInputPortWithVideoStatuses HdmiInput { get; private set; } + public RoutingInputPortWithVideoStatuses VgaInput { get; private set; } + public RoutingOutputPort DmOutput { get; private set; } + public RoutingOutputPort HdmiLoopOut { get; private set; } + + public override StringFeedback ActiveVideoInputFeedback { get; protected set; } + public IntFeedback VideoSourceNumericFeedback { get; protected set; } + public IntFeedback AudioSourceNumericFeedback { get; protected set; } + public IntFeedback HdmiInHdcpCapabilityFeedback { get; protected set; } + public BoolFeedback HdmiVideoSyncFeedback { get; protected set; } + public BoolFeedback VgaVideoSyncFeedback { get; protected set; } + + public BoolFeedback FreeRunEnabledFeedback { get; protected set; } + + public IntFeedback VgaBrightnessFeedback { get; protected set; } + public IntFeedback VgaContrastFeedback { get; protected set; } + + /// + /// Helps get the "real" inputs, including when in Auto + /// + public DmTx200Base.eSourceSelection ActualActiveVideoInput + { + get + { + if (Tx.VideoSourceFeedback == DmTx200Base.eSourceSelection.Digital || + Tx.VideoSourceFeedback == DmTx200Base.eSourceSelection.Analog || + Tx.VideoSourceFeedback == DmTx200Base.eSourceSelection.Disable) + return Tx.VideoSourceFeedback; + else // auto + { + if (Tx.HdmiInput.SyncDetectedFeedback.BoolValue) + return DmTx200Base.eSourceSelection.Digital; + else if (Tx.VgaInput.SyncDetectedFeedback.BoolValue) + return DmTx200Base.eSourceSelection.Analog; + else + return DmTx200Base.eSourceSelection.Disable; + } + } + } + + public RoutingPortCollection InputPorts + { + get + { + return new RoutingPortCollection + { + HdmiInput, + VgaInput, + AnyVideoInput + }; + } + } + + public RoutingPortCollection OutputPorts + { + get + { + return new RoutingPortCollection { DmOutput, HdmiLoopOut }; + } + } + + /// + /// + /// + /// + /// + /// + public DmTx201SController(string key, string name, DmTx201S tx) + : base(key, name, tx) + { + Tx = tx; + + HdmiInput = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn, + eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, DmTx200Base.eSourceSelection.Digital, this, + VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInput)); + VgaInput = new RoutingInputPortWithVideoStatuses(DmPortName.VgaIn, + eRoutingSignalType.Video, eRoutingPortConnectionType.Vga, DmTx200Base.eSourceSelection.Analog, this, + VideoStatusHelper.GetVgaInputStatusFuncs(tx.VgaInput)); + + ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput", + () => ActualActiveVideoInput.ToString()); + + Tx.HdmiInput.InputStreamChange += new EndpointInputStreamChangeEventHandler(InputStreamChangeEvent); + Tx.BaseEvent += Tx_BaseEvent; + Tx.OnlineStatusChange += new OnlineStatusChangeEventHandler(Tx_OnlineStatusChange); + + VideoSourceNumericFeedback = new IntFeedback(() => + { + return (int)Tx.VideoSourceFeedback; + }); + AudioSourceNumericFeedback = new IntFeedback(() => + { + return (int)Tx.AudioSourceFeedback; + }); + + HdmiInHdcpCapabilityFeedback = new IntFeedback("HdmiInHdcpCapability", () => + { + if (tx.HdmiInput.HdcpSupportOnFeedback.BoolValue) + return 1; + else + return 0; + }); + + HdmiVideoSyncFeedback = new BoolFeedback(() => + { + return (bool)tx.HdmiInput.SyncDetectedFeedback.BoolValue; + }); + + VgaVideoSyncFeedback = new BoolFeedback(() => + { + return (bool)tx.VgaInput.SyncDetectedFeedback.BoolValue; + }); + + FreeRunEnabledFeedback = new BoolFeedback(() => tx.VgaInput.FreeRunFeedback == eDmFreeRunSetting.Enabled); + + VgaBrightnessFeedback = new IntFeedback(() => tx.VgaInput.VideoControls.BrightnessFeedback.UShortValue); + VgaContrastFeedback = new IntFeedback(() => tx.VgaInput.VideoControls.ContrastFeedback.UShortValue); + + tx.VgaInput.VideoControls.ControlChange += new Crestron.SimplSharpPro.DeviceSupport.GenericEventHandler(VideoControls_ControlChange); + + HdcpSupportCapability = eHdcpCapabilityType.HdcpAutoSupport; + + var combinedFuncs = new VideoStatusFuncsWrapper + { + HdcpActiveFeedbackFunc = () => + (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital + && tx.HdmiInput.VideoAttributes.HdcpActiveFeedback.BoolValue), + + HdcpStateFeedbackFunc = () => + { + if (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital) + return tx.HdmiInput.VideoAttributes.HdcpStateFeedback.ToString(); + return ""; + }, + + VideoResolutionFeedbackFunc = () => + { + if (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital) + return tx.HdmiInput.VideoAttributes.GetVideoResolutionString(); + if (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Analog) + return tx.VgaInput.VideoAttributes.GetVideoResolutionString(); + return ""; + }, + VideoSyncFeedbackFunc = () => + (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital + && tx.HdmiInput.SyncDetectedFeedback.BoolValue) + || (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Analog + && tx.VgaInput.SyncDetectedFeedback.BoolValue) + || (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Auto + && (tx.VgaInput.SyncDetectedFeedback.BoolValue || tx.HdmiInput.SyncDetectedFeedback.BoolValue)) + + }; + + AnyVideoInput = new RoutingInputPortWithVideoStatuses(DmPortName.AnyVideoIn, + eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.None, 0, this, combinedFuncs); + + DmOutput = new RoutingOutputPort(DmPortName.DmOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmCat, null, this); + HdmiLoopOut = new RoutingOutputPort(DmPortName.HdmiLoopOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.Hdmi, null, this); + + AddToFeedbackList(ActiveVideoInputFeedback, VideoSourceNumericFeedback, AudioSourceNumericFeedback, + AnyVideoInput.VideoStatus.HasVideoStatusFeedback, AnyVideoInput.VideoStatus.HdcpActiveFeedback, + AnyVideoInput.VideoStatus.HdcpStateFeedback, AnyVideoInput.VideoStatus.VideoResolutionFeedback, + AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiInHdcpCapabilityFeedback, HdmiVideoSyncFeedback, + VgaVideoSyncFeedback); + + // Set Ports for CEC + HdmiInput.Port = Tx.HdmiInput; + VgaInput.Port = Tx.VgaInput; + HdmiLoopOut.Port = Tx.HdmiOutput; + DmOutput.Port = Tx.DmOutput; + } + + void VideoControls_ControlChange(object sender, Crestron.SimplSharpPro.DeviceSupport.GenericEventArgs args) + { + var id = args.EventId; + Debug.Console(2, this, "EventId {0}", args.EventId); + + if (id == VideoControlsEventIds.BrightnessFeedbackEventId) + { + VgaBrightnessFeedback.FireUpdate(); + } + else if (id == VideoControlsEventIds.ContrastFeedbackEventId) + { + VgaContrastFeedback.FireUpdate(); + } + } + + void Tx_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args) + { + ActiveVideoInputFeedback.FireUpdate(); + VideoSourceNumericFeedback.FireUpdate(); + AudioSourceNumericFeedback.FireUpdate(); + + } + + public override bool CustomActivate() + { + Tx.HdmiInput.InputStreamChange += (o, a) => FowardInputStreamChange(HdmiInput, a.EventId); + Tx.HdmiInput.VideoAttributes.AttributeChange += (o, a) => FireVideoAttributeChange(HdmiInput, a.EventId); + + Tx.VgaInput.InputStreamChange += (o, a) => FowardInputStreamChange(VgaInput, a.EventId); + Tx.VgaInput.VideoAttributes.AttributeChange += (o, a) => FireVideoAttributeChange(VgaInput, a.EventId); + + // Base does register and sets up comm monitoring. + return base.CustomActivate(); + } + + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) + { + DmTxControllerJoinMap joinMap = GetDmTxJoinMap(joinStart, joinMapKey); + + if (HdmiVideoSyncFeedback != null) + { + HdmiVideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input1VideoSyncStatus.JoinNumber]); + } + if (VgaVideoSyncFeedback != null) + { + VgaVideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input2VideoSyncStatus.JoinNumber]); + } + + LinkDmTxToApi(this, trilist, joinMap, bridge); + } + + /// + /// Enables or disables free run + /// + /// + public void SetFreeRunEnabled(bool enable) + { + if (enable) + { + Tx.VgaInput.FreeRun = eDmFreeRunSetting.Enabled; + } + else + { + Tx.VgaInput.FreeRun = eDmFreeRunSetting.Disabled; + } + } + + /// + /// Sets the VGA brightness level + /// + /// + public void SetVgaBrightness(ushort level) + { + Tx.VgaInput.VideoControls.Brightness.UShortValue = level; + } + + /// + /// Sets the VGA contrast level + /// + /// + public void SetVgaContrast(ushort level) + { + Tx.VgaInput.VideoControls.Contrast.UShortValue = level; + } + + /// + /// Switches the audio/video source based on the integer value (0-Auto, 1-HDMI, 2-VGA, 3-Disable) + /// + /// + /// + /// + public void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type) + { + Debug.Console(2, this, "Executing Numeric Switch to input {0}.", input); + + switch (input) + { + case 0: + { + ExecuteSwitch(DmTx200Base.eSourceSelection.Auto, null, type); + break; + } + case 1: + { + ExecuteSwitch(HdmiInput.Selector, null, type); + break; + } + case 2: + { + ExecuteSwitch(VgaInput.Selector, null, type); + break; + } + case 3: + { + ExecuteSwitch(DmTx200Base.eSourceSelection.Disable, null, type); + break; + } + } + } + + public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType) + { + if ((signalType | eRoutingSignalType.Video) == eRoutingSignalType.Video) + Tx.VideoSource = (DmTx200Base.eSourceSelection)inputSelector; + if ((signalType | eRoutingSignalType.Audio) == eRoutingSignalType.Audio) + Tx.AudioSource = (DmTx200Base.eSourceSelection)inputSelector; + } + + void Tx_BaseEvent(GenericBase device, BaseEventArgs args) + { + var id = args.EventId; + Debug.Console(2, this, "EventId {0}", args.EventId); + + if (id == EndpointTransmitterBase.VideoSourceFeedbackEventId) + { + Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback); + VideoSourceNumericFeedback.FireUpdate(); + ActiveVideoInputFeedback.FireUpdate(); + } + + // ------------------------------ incomplete ----------------------------------------- + else if (id == EndpointTransmitterBase.AudioSourceFeedbackEventId) + { + Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback); + AudioSourceNumericFeedback.FireUpdate(); + } + + } + + void InputStreamChangeEvent(EndpointInputStream inputStream, EndpointInputStreamEventArgs args) + { + Debug.Console(2, "{0} event {1} stream {2}", this.Tx.ToString(), inputStream.ToString(), args.EventId.ToString()); + + if (args.EventId == EndpointInputStreamEventIds.HdcpSupportOffFeedbackEventId) + { + HdmiInHdcpCapabilityFeedback.FireUpdate(); + } + else if (args.EventId == EndpointInputStreamEventIds.HdcpSupportOnFeedbackEventId) + { + HdmiInHdcpCapabilityFeedback.FireUpdate(); + } + else if (args.EventId == EndpointInputStreamEventIds.FreeRunFeedbackEventId) + { + FreeRunEnabledFeedback.FireUpdate(); + } + } + + /// + /// Relays the input stream change to the appropriate RoutingInputPort. + /// + void FowardInputStreamChange(RoutingInputPortWithVideoStatuses inputPort, int eventId) + { + if (eventId == EndpointInputStreamEventIds.SyncDetectedFeedbackEventId) + { + inputPort.VideoStatus.VideoSyncFeedback.FireUpdate(); + AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate(); + } + } + + /// + /// Relays the VideoAttributes change to a RoutingInputPort + /// + void FireVideoAttributeChange(RoutingInputPortWithVideoStatuses inputPort, int eventId) + { + //// LOCATION: Crestron.SimplSharpPro.DM.VideoAttributeEventIds + //Debug.Console(2, this, "VideoAttributes_AttributeChange event id={0} from {1}", + // args.EventId, (sender as VideoAttributesEnhanced).Owner.GetType()); + 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; + } + } + + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs index 4fcc4742..9fe81c92 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs @@ -45,8 +45,10 @@ namespace PepperDash.Essentials.DM return new DmTx200Controller(key, name, new DmTx200C2G(ipid, Global.ControlSystem)); if (typeName.StartsWith("dmtx4kz100")) return new DmTx4kz100Controller(key, name, new DmTx4kz100C1G(ipid, Global.ControlSystem)); - if (typeName.StartsWith("dmtx201")) - return new DmTx201XController(key, name, new DmTx201S(ipid, Global.ControlSystem)); + if (typeName.StartsWith("dmtx201c")) + return new DmTx201CController(key, name, new DmTx201C(ipid, Global.ControlSystem)); + if (typeName.StartsWith("dmtx201s")) + return new DmTx201SController(key, name, new DmTx201S(ipid, Global.ControlSystem)); if (typeName.StartsWith("dmtx4k202")) return new DmTx4k202CController(key, name, new DmTx4k202C(ipid, Global.ControlSystem)); if (typeName.StartsWith("dmtx4kz202")) @@ -102,8 +104,10 @@ namespace PepperDash.Essentials.DM { if (typeName.StartsWith("dmtx200")) return new DmTx200Controller(key, name, new DmTx200C2G(chassis.Inputs[num])); - if (typeName.StartsWith("dmtx201")) - return new DmTx201XController(key, name, new DmTx201C(chassis.Inputs[num])); + if (typeName.StartsWith("dmtx201c")) + return new DmTx201CController(key, name, new DmTx201C(chassis.Inputs[num])); + if (typeName.StartsWith("dmtx201s")) + return new DmTx201SController(key, name, new DmTx201S(chassis.Inputs[num])); if (typeName.StartsWith("dmtx4k100")) return new DmTx4k100Controller(key, name, new DmTx4K100C1G(chassis.Inputs[num])); if (typeName.StartsWith("dmtx4kz100")) @@ -123,8 +127,10 @@ namespace PepperDash.Essentials.DM { if (typeName.StartsWith("dmtx200")) return new DmTx200Controller(key, name, new DmTx200C2G(ipid, chassis.Inputs[num])); - if (typeName.StartsWith("dmtx201")) - return new DmTx201XController(key, name, new DmTx201C(ipid, chassis.Inputs[num])); + if (typeName.StartsWith("dmtx201c")) + return new DmTx201CController(key, name, new DmTx201C(ipid, chassis.Inputs[num])); + if (typeName.StartsWith("dmtx201s")) + return new DmTx201SController(key, name, new DmTx201S(ipid, chassis.Inputs[num])); if (typeName.StartsWith("dmtx4k100")) return new DmTx4k100Controller(key, name, new DmTx4K100C1G(ipid, chassis.Inputs[num])); if (typeName.StartsWith("dmtx4kz100")) diff --git a/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj b/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj index 2c245384..7fc4f24d 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj +++ b/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj @@ -100,8 +100,10 @@ + + @@ -112,7 +114,7 @@ - + From 4c5b60bddb8b2dda7dbf1586d51ebecd80fd7cbd Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Tue, 12 May 2020 14:55:12 -0500 Subject: [PATCH 144/156] Exposed ICEC to DGE Controller Classes --- .../Essentials_DM/Endpoints/DGEs/Dge100Controller.cs | 12 ++++++++++-- .../Endpoints/DGEs/DmDge200CController.cs | 10 ++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/Dge100Controller.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/Dge100Controller.cs index f157f92d..2780b7b1 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/Dge100Controller.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/Dge100Controller.cs @@ -4,7 +4,10 @@ using System.Linq; using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.UI; +using Crestron.SimplSharpPro.UI; + +using Crestron.SimplSharpPro.DM; + using Newtonsoft.Json; @@ -18,7 +21,7 @@ namespace PepperDash.Essentials.DM.Endpoints.DGEs /// /// Wrapper class for DGE-100 and DM-DGE-200-C /// - public class Dge100Controller : CrestronGenericBaseDevice, IComPorts, IIROutputPorts, IHasBasicTriListWithSmartObject + public class Dge100Controller : CrestronGenericBaseDevice, IComPorts, IIROutputPorts, IHasBasicTriListWithSmartObject, ICec { private readonly Dge100 _dge; @@ -64,7 +67,12 @@ namespace PepperDash.Essentials.DM.Endpoints.DGEs get { return _dge.NumberOfIROutputPorts; } } + #endregion + + #region ICec Members + public Cec StreamCec { get { return _dge.HdmiOut.StreamCec; } } #endregion + } public class Dge100ControllerFactory : EssentialsDeviceFactory diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DmDge200CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DmDge200CController.cs index 26c1af03..6aa153c5 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DmDge200CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DmDge200CController.cs @@ -13,13 +13,15 @@ using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Config; using Crestron.SimplSharpPro.DeviceSupport; +using Crestron.SimplSharpPro.DM; + namespace PepperDash.Essentials.DM.Endpoints.DGEs { /// /// Wrapper class for DGE-100 and DM-DGE-200-C /// - public class DmDge200CController : CrestronGenericBaseDevice, IComPorts, IIROutputPorts, - IHasBasicTriListWithSmartObject, IRoutingInputsOutputs + public class DmDge200CController : CrestronGenericBaseDevice, IComPorts, IIROutputPorts, + IHasBasicTriListWithSmartObject, IRoutingInputsOutputs, ICec { private readonly DmDge200C _dge; @@ -95,6 +97,10 @@ namespace PepperDash.Essentials.DM.Endpoints.DGEs #endregion + #region ICec Members + public Cec StreamCec { get { return _dge.HdmiOut.StreamCec; } } + #endregion + } public class DmDge200CControllerFactory : EssentialsDeviceFactory From d11e0db14a95b84e74e79ddd3f36721e1e66700b Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Tue, 12 May 2020 15:28:00 -0500 Subject: [PATCH 145/156] Refactor obsolete comport instantiation method for DGE devices --- .../Config/Comm and IR/GenericComm.cs | 11 ++- .../Endpoints/DGEs/Dge100Controller.cs | 4 +- .../Endpoints/DGEs/DmDge200CController.cs | 95 ++++++------------- 3 files changed, 39 insertions(+), 71 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericComm.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericComm.cs index 86e59be2..74122905 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericComm.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericComm.cs @@ -27,7 +27,16 @@ namespace PepperDash.Essentials.Core { PropertiesConfig = CommFactory.GetControlPropertiesConfig(config); - CommPort = CommFactory.CreateCommForDevice(config); + var commPort = CommFactory.CreateCommForDevice(config); + + //Fixing decision to require '-comPorts' in delcaration for DGE in order to get a device with comports included + if (commPort == null) + { + config.Key = config.Key + "-comPorts"; + commPort = CommFactory.CreateCommForDevice(config); + } + + CommPort = commPort; } diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/Dge100Controller.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/Dge100Controller.cs index 2780b7b1..19aba276 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/Dge100Controller.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/Dge100Controller.cs @@ -88,7 +88,7 @@ namespace PepperDash.Essentials.DM.Endpoints.DGEs var comm = CommFactory.GetControlPropertiesConfig(dc); var props = JsonConvert.DeserializeObject(dc.Properties.ToString()); - Debug.Console(1, "Factory Attempting to create new DgeControllerm Device"); + Debug.Console(1, "Factory Attempting to create new DgeController Device"); Dge100 dgeDevice = null; if (typeName == "dge100") @@ -100,7 +100,7 @@ namespace PepperDash.Essentials.DM.Endpoints.DGEs return null; } - var dgeController = new Dge100Controller(dc.Key + "-comPorts", dc.Name, dgeDevice, dc, props); + var dgeController = new Dge100Controller(dc.Key, dc.Name, dgeDevice, dc, props); return dgeController; } diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DmDge200CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DmDge200CController.cs index 6aa153c5..26f6fc39 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DmDge200CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DmDge200CController.cs @@ -20,12 +20,10 @@ namespace PepperDash.Essentials.DM.Endpoints.DGEs /// /// Wrapper class for DGE-100 and DM-DGE-200-C /// - public class DmDge200CController : CrestronGenericBaseDevice, IComPorts, IIROutputPorts, - IHasBasicTriListWithSmartObject, IRoutingInputsOutputs, ICec + public class DmDge200CController : Dge100Controller, IRoutingInputsOutputs { private readonly DmDge200C _dge; - public BasicTriListWithSmartObject Panel { get { return _dge; } } public RoutingInputPort DmIn { get; private set; } public RoutingOutputPort HdmiOut { get; private set; } @@ -42,19 +40,13 @@ namespace PepperDash.Essentials.DM.Endpoints.DGEs } - public DeviceConfig _dc; - CrestronTouchpanelPropertiesConfig PropertiesConfig; public DmDge200CController(string key, string name, DmDge200C device, DeviceConfig dc, CrestronTouchpanelPropertiesConfig props) - : base(key, name, device) + : base(key, name, device, dc, props) { _dge = device; - _dc = dc; - - PropertiesConfig = props; - DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.DmCat, 0, this); HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.AudioVideo, @@ -69,69 +61,36 @@ namespace PepperDash.Essentials.DM.Endpoints.DGEs } - #region IComPorts Members - - public CrestronCollection ComPorts + public class DmDge200CControllerFactory : EssentialsDeviceFactory { - get { return _dge.ComPorts; } - } - - public int NumberOfComPorts - { - get { return _dge.NumberOfComPorts; } - } - - #endregion - - #region IIROutputPorts Members - - public CrestronCollection IROutputPorts - { - get { return _dge.IROutputPorts; } - } - - public int NumberOfIROutputPorts - { - get { return _dge.NumberOfIROutputPorts; } - } - - #endregion - - #region ICec Members - public Cec StreamCec { get { return _dge.HdmiOut.StreamCec; } } - #endregion - - } - - public class DmDge200CControllerFactory : EssentialsDeviceFactory - { - public DmDge200CControllerFactory() - { - TypeNames = new List() { "dmdge200c" }; - } - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - var typeName = dc.Type.ToLower(); - var comm = CommFactory.GetControlPropertiesConfig(dc); - var props = JsonConvert.DeserializeObject(dc.Properties.ToString()); - - Debug.Console(1, "Factory Attempting to create new DgeControllerm Device"); - - DmDge200C dgeDevice = null; - - if (typeName == "dmdge200c") - dgeDevice = new DmDge200C(comm.IpIdInt, Global.ControlSystem); - - if (dgeDevice == null) + public DmDge200CControllerFactory() { - Debug.Console(1, "Unable to create DGE device"); - return null; + TypeNames = new List() { "dmdge200c" }; } - var dgeController = new DmDge200CController(dc.Key + "-comPorts", dc.Name, dgeDevice, dc, props); + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + var typeName = dc.Type.ToLower(); + var comm = CommFactory.GetControlPropertiesConfig(dc); + var props = JsonConvert.DeserializeObject(dc.Properties.ToString()); - return dgeController; + Debug.Console(1, "Factory Attempting to create new DgeController Device"); + + DmDge200C dgeDevice = null; + + if (typeName == "dmdge200c") + dgeDevice = new DmDge200C(comm.IpIdInt, Global.ControlSystem); + + if (dgeDevice == null) + { + Debug.Console(1, "Unable to create DGE device"); + return null; + } + + var dgeController = new DmDge200CController(dc.Key , dc.Name, dgeDevice, dc, props); + + return dgeController; + } } } } \ No newline at end of file From e581219e325c2af23453dbd34ee72c8640f85d80 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Tue, 12 May 2020 15:29:34 -0500 Subject: [PATCH 146/156] --amend --- .../Essentials_DM/Endpoints/DGEs/DmDge200CController.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DmDge200CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DmDge200CController.cs index 26f6fc39..d4539e53 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DmDge200CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DmDge200CController.cs @@ -39,9 +39,6 @@ namespace PepperDash.Essentials.DM.Endpoints.DGEs private set; } - - CrestronTouchpanelPropertiesConfig PropertiesConfig; - public DmDge200CController(string key, string name, DmDge200C device, DeviceConfig dc, CrestronTouchpanelPropertiesConfig props) : base(key, name, device, dc, props) { From 4ef8e8cf1412e07853da62c4a66e58e8075b26bf Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Tue, 12 May 2020 15:31:03 -0500 Subject: [PATCH 147/156] --amend --- .../Essentials_DM/Endpoints/DGEs/Dge100Controller.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/Dge100Controller.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/Dge100Controller.cs index 19aba276..4a335c39 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/Dge100Controller.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/Dge100Controller.cs @@ -27,7 +27,7 @@ namespace PepperDash.Essentials.DM.Endpoints.DGEs public BasicTriListWithSmartObject Panel { get { return _dge; } } - public DeviceConfig _dc; + private DeviceConfig _dc; CrestronTouchpanelPropertiesConfig PropertiesConfig; From 3bf3ac2ccea86e5ecad4727e765fda379d2dbf52 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Wed, 13 May 2020 09:35:56 -0500 Subject: [PATCH 148/156] resolves #178 - Addedd Requested Interface IHasVideoMute --- .../UI/EssentialsTouchpanelController.cs | 2 +- .../Devices/IProjectorInterfaces.cs | 17 +++++++++++++++++ .../PepperDash_Essentials_Core.csproj | 1 + .../Display/InputInterfaces.cs | 7 ++++--- 4 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/IProjectorInterfaces.cs diff --git a/PepperDashEssentials/UI/EssentialsTouchpanelController.cs b/PepperDashEssentials/UI/EssentialsTouchpanelController.cs index d008eee0..eade64bd 100644 --- a/PepperDashEssentials/UI/EssentialsTouchpanelController.cs +++ b/PepperDashEssentials/UI/EssentialsTouchpanelController.cs @@ -211,7 +211,7 @@ namespace PepperDash.Essentials var comm = CommFactory.GetControlPropertiesConfig(dc); var props = Newtonsoft.Json.JsonConvert.DeserializeObject(dc.Properties.ToString()); - Debug.Console(1, "Factory Attempting to create new Generic Comm Device"); + Debug.Console(1, "Factory Attempting to create new EssentialsTouchpanelController"); var panelController = new EssentialsTouchpanelController(dc.Key, dc.Name, dc.Type, props, comm.IpIdInt); diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/IProjectorInterfaces.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/IProjectorInterfaces.cs new file mode 100644 index 00000000..9c8d4529 --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/IProjectorInterfaces.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; + +namespace PepperDash.Essentials.Core +{ + public interface IHasVideoMute + { + BoolFeedback VideoMuteIsOn { get; } + + void VideoMuteOn(bool pressRelease); + void VideoMuteOff(bool pressRelease); + void VideoMuteToggle(bool pressRelease); + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj index 4e3e1b41..00db3b08 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj @@ -158,6 +158,7 @@ + diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/InputInterfaces.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/InputInterfaces.cs index ce7113e1..fa9f103d 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/InputInterfaces.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/InputInterfaces.cs @@ -2,7 +2,9 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using Crestron.SimplSharp; +using Crestron.SimplSharp; +using PepperDash.Essentials.Core; + namespace PepperDash.Essentials.Devices.Displays { @@ -12,6 +14,5 @@ namespace PepperDash.Essentials.Devices.Displays public interface IInputHdmi4 { void InputHdmi4(); } public interface IInputDisplayPort1 { void InputDisplayPort1(); } public interface IInputDisplayPort2 { void InputDisplayPort2(); } - public interface IInputVga1 { void InputVga1(); } - + public interface IInputVga1 { void InputVga1(); } } \ No newline at end of file From f2cb95af960abf435c3859fc37a04b0fe223921e Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Wed, 13 May 2020 09:40:45 -0500 Subject: [PATCH 149/156] removed some unintentionally added text from InputInterfaces.cs --- .../Essentials Devices Common/Display/InputInterfaces.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/InputInterfaces.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/InputInterfaces.cs index fa9f103d..d984f523 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/InputInterfaces.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/InputInterfaces.cs @@ -2,9 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using Crestron.SimplSharp; -using PepperDash.Essentials.Core; - +using Crestron.SimplSharp; namespace PepperDash.Essentials.Devices.Displays { @@ -15,4 +13,5 @@ namespace PepperDash.Essentials.Devices.Displays public interface IInputDisplayPort1 { void InputDisplayPort1(); } public interface IInputDisplayPort2 { void InputDisplayPort2(); } public interface IInputVga1 { void InputVga1(); } + } \ No newline at end of file From efe8b1576375b004b95ae73ce89c3c54e4861e4a Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Wed, 13 May 2020 10:32:01 -0500 Subject: [PATCH 150/156] Updated Interfaces to be more granular --- .../Devices/IProjectorInterfaces.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/IProjectorInterfaces.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/IProjectorInterfaces.cs index 9c8d4529..6efb7776 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/IProjectorInterfaces.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/IProjectorInterfaces.cs @@ -6,12 +6,17 @@ using Crestron.SimplSharp; namespace PepperDash.Essentials.Core { - public interface IHasVideoMute + public interface IBasicVideoMute + { + void VideoMuteToggle(); + } + + public interface IBasicVideoMuteWithFeedback : IBasicVideoMute { BoolFeedback VideoMuteIsOn { get; } - void VideoMuteOn(bool pressRelease); - void VideoMuteOff(bool pressRelease); - void VideoMuteToggle(bool pressRelease); + void VideoMuteOn(); + void VideoMuteOff(); + } } \ No newline at end of file From 2085e14f24c1f5021d0d49475248d90d88d23176 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Wed, 13 May 2020 10:39:56 -0600 Subject: [PATCH 151/156] updates workflow to only create releases for rc builds --- .github/workflows/docker.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 839ae827..8a46caf3 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -11,7 +11,7 @@ on: env: # solution path doesn't need slashes unless there it is multiple folders deep - # solution name does not include extension. .sln is assumed + # solution name does not include extension. .sln is assumed SOLUTION_PATH: PepperDashEssentials SOLUTION_FILE: PepperDashEssentials # Do not edit this, we're just creating it here @@ -77,8 +77,14 @@ jobs: name: Version path: ${{env.GITHUB_HOME}}\output\version.txt # Create the release on the source repo + - name: Create tag for non-rc builds + if: ${{contains('alpha', env.VERSION) || contains('beta', env.VERSION)}} + run: | + git tag $($Env:VERSION) + git push --tags origin - name: Create Release id: create_release + if: ${{contains('rc' env.VERSION)}} # using contributor's version to allow for pointing at the right commit uses: fleskesvor/create-release@feature/support-target-commitish with: @@ -89,6 +95,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Upload the build package to the release - name: Upload Release Package + if: ${{contains('rc' env.VERSION)}} id: upload_release uses: actions/upload-release-asset@v1 with: From 45b6a090678f9f3f0dbc71f8c89d95c27e672613 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Wed, 13 May 2020 10:41:27 -0600 Subject: [PATCH 152/156] fixes contain statement - missed a comma --- .github/workflows/docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 8a46caf3..31cbd799 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -84,8 +84,8 @@ jobs: git push --tags origin - name: Create Release id: create_release - if: ${{contains('rc' env.VERSION)}} # using contributor's version to allow for pointing at the right commit + if: ${{contains('rc', env.VERSION)}} uses: fleskesvor/create-release@feature/support-target-commitish with: tag_name: ${{ env.VERSION }} From 06cc871432258e6abdce9169723cacad20833ed0 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Wed, 13 May 2020 10:45:54 -0600 Subject: [PATCH 153/156] fixes other comma issue... --- .github/workflows/docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 31cbd799..cf01982f 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -95,7 +95,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Upload the build package to the release - name: Upload Release Package - if: ${{contains('rc' env.VERSION)}} + if: ${{contains('rc', env.VERSION)}} id: upload_release uses: actions/upload-release-asset@v1 with: From a4339bf5a4ebdf7dabfc4fcd0eac783fb8425e5d Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Wed, 13 May 2020 11:20:36 -0600 Subject: [PATCH 154/156] adjust conditions to NOT use expression syntax --- .github/workflows/docker.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index cf01982f..a43ebf50 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -78,14 +78,14 @@ jobs: path: ${{env.GITHUB_HOME}}\output\version.txt # Create the release on the source repo - name: Create tag for non-rc builds - if: ${{contains('alpha', env.VERSION) || contains('beta', env.VERSION)}} + if: contains('-alpha-', env.VERSION) || contains('-beta-', env.VERSION) run: | git tag $($Env:VERSION) git push --tags origin - name: Create Release id: create_release # using contributor's version to allow for pointing at the right commit - if: ${{contains('rc', env.VERSION)}} + if: contains('-rc-', env.VERSION) || contains('-hotfix-', env.VERSION) uses: fleskesvor/create-release@feature/support-target-commitish with: tag_name: ${{ env.VERSION }} @@ -95,7 +95,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Upload the build package to the release - name: Upload Release Package - if: ${{contains('rc', env.VERSION)}} + if: contains('-rc-', env.VERSION) || contains('-hotfix-', env.VERSION) id: upload_release uses: actions/upload-release-asset@v1 with: From b0a21a1c2f3975340edd8c106ac7b15b22eb5712 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Wed, 13 May 2020 11:42:18 -0600 Subject: [PATCH 155/156] fixes order of operations for contains statement --- .github/workflows/docker.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index a43ebf50..54d3c1b2 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -78,14 +78,14 @@ jobs: path: ${{env.GITHUB_HOME}}\output\version.txt # Create the release on the source repo - name: Create tag for non-rc builds - if: contains('-alpha-', env.VERSION) || contains('-beta-', env.VERSION) + if: contains(env.VERSION, 'alpha') || contains(env.VERSION, 'beta') run: | git tag $($Env:VERSION) git push --tags origin - name: Create Release id: create_release # using contributor's version to allow for pointing at the right commit - if: contains('-rc-', env.VERSION) || contains('-hotfix-', env.VERSION) + if: contains(env.VERSION,'-rc-') || contains(env.VERSION,'-hotfix-') uses: fleskesvor/create-release@feature/support-target-commitish with: tag_name: ${{ env.VERSION }} @@ -95,7 +95,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Upload the build package to the release - name: Upload Release Package - if: contains('-rc-', env.VERSION) || contains('-hotfix-', env.VERSION) + if: contains(env.VERSION,'-rc-') || contains(env.VERSION,'-hotfix-') id: upload_release uses: actions/upload-release-asset@v1 with: @@ -110,6 +110,8 @@ jobs: needs: Build_Project runs-on: windows-latest steps: + - name: check Github ref + run: ${{toJson(github.ref)}} # Checkout the repo - name: Checkout Builds Repo uses: actions/checkout@v2 @@ -188,6 +190,8 @@ jobs: if: contains(github.ref, 'master') || contains(github.ref, 'release') steps: # Checkout the repo + - name: check Github ref + run: ${{toJson(github.ref)}} - name: Checkout Builds Repo uses: actions/checkout@v2 with: From f9ca609c1e59f79aee86584efc4402b9c69b2778 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Wed, 13 May 2020 11:56:53 -0600 Subject: [PATCH 156/156] fix to prevent branches with 'release' in the name from triggering the public repo push --- .github/workflows/docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 54d3c1b2..ac1c58be 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -187,7 +187,7 @@ jobs: Public_Push_Output: needs: Build_Project runs-on: windows-latest - if: contains(github.ref, 'master') || contains(github.ref, 'release') + if: contains(github.ref, 'master') || contains(github.ref, '/release/') steps: # Checkout the repo - name: check Github ref