mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-01-12 03:54:51 +00:00
Compare commits
328 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5d7cdab933 | ||
|
|
c9fee785f9 | ||
|
|
dfc90e58dc | ||
|
|
2a5810b671 | ||
|
|
9d354fb0ed | ||
|
|
52494ca13e | ||
|
|
f6059e249f | ||
|
|
cf14706961 | ||
|
|
7945bce854 | ||
|
|
44cacc839b | ||
|
|
dfebd47ef4 | ||
|
|
3c714f724d | ||
|
|
03e0dc5208 | ||
|
|
50b2c7d3af | ||
|
|
030d69c190 | ||
|
|
bdb007f6ed | ||
|
|
91abe4c09a | ||
|
|
82029894e4 | ||
|
|
3c1ed6e58a | ||
|
|
8999097100 | ||
|
|
72197e547f | ||
|
|
9b62849d9d | ||
|
|
d311b6fef9 | ||
|
|
4a642b1e36 | ||
|
|
de4f003c67 | ||
|
|
708ee1a8ff | ||
|
|
7196d0aba8 | ||
|
|
3b0a5285ab | ||
|
|
ae03b8cd7e | ||
|
|
cc159e306e | ||
|
|
0a43f43f66 | ||
|
|
0f924360c1 | ||
|
|
870f2f8fa6 | ||
|
|
aa61479adc | ||
|
|
522c107ce6 | ||
|
|
cb29775004 | ||
|
|
fccbb55344 | ||
|
|
b2402402d9 | ||
|
|
f0a3b27e3b | ||
|
|
57ebd2b608 | ||
|
|
695ff5487f | ||
|
|
66cd39c013 | ||
|
|
91eec8c258 | ||
|
|
d2c308c009 | ||
|
|
a4a99f4a9b | ||
|
|
eb114b4a95 | ||
|
|
93e8d50e55 | ||
|
|
3c6fc978d4 | ||
|
|
01ddf1721c | ||
|
|
1ee87c0499 | ||
|
|
f8ae6264f7 | ||
|
|
3e56859943 | ||
|
|
945db8a233 | ||
|
|
823f7447c3 | ||
|
|
6e4fa48b9d | ||
|
|
7e8f216afb | ||
|
|
b09c151738 | ||
|
|
56cf54a644 | ||
|
|
169e897748 | ||
|
|
748b1ca147 | ||
|
|
2e636082bb | ||
|
|
9204ad2701 | ||
|
|
8feb7a142c | ||
|
|
d990930b19 | ||
|
|
4d67279827 | ||
|
|
a78b29b0a1 | ||
|
|
2c36c0f2cb | ||
|
|
2eaf21b1e0 | ||
|
|
099e387570 | ||
|
|
c4755f23cd | ||
|
|
9c4650b4af | ||
|
|
43d7fab04d | ||
|
|
d2b7e71c4a | ||
|
|
ab6d44e604 | ||
|
|
0dc2e9d134 | ||
|
|
3a024b8d4c | ||
|
|
05e2422cb4 | ||
|
|
fc5d4f946d | ||
|
|
45c1e25e4f | ||
|
|
f11bdcfd53 | ||
|
|
9888fbf047 | ||
|
|
9171610e34 | ||
|
|
7a8c1f3165 | ||
|
|
008a052045 | ||
|
|
93a5f2e3b2 | ||
|
|
0e4edca08a | ||
|
|
f9925f9ec9 | ||
|
|
f283f82bbc | ||
|
|
ab5dd5f756 | ||
|
|
e22c71853f | ||
|
|
8bf27ecbd9 | ||
|
|
d94d003050 | ||
|
|
25c4d94366 | ||
|
|
91dda3213e | ||
|
|
b41dd23c7f | ||
|
|
14ad0eee48 | ||
|
|
56e106ff32 | ||
|
|
b67424c1e1 | ||
|
|
c366ee9d12 | ||
|
|
5ec97f2e31 | ||
|
|
98c20464d7 | ||
|
|
b1aa9c3306 | ||
|
|
db6ab3ee98 | ||
|
|
2ccf4be559 | ||
|
|
ce86255119 | ||
|
|
d69e81972e | ||
|
|
3f9d306a34 | ||
|
|
14c3914e5c | ||
|
|
b5337572c4 | ||
|
|
1d1b4f0790 | ||
|
|
ccdd8005d0 | ||
|
|
1d184f0f5e | ||
|
|
2ed9e632c6 | ||
|
|
ecba28c9cd | ||
|
|
06e8cac597 | ||
|
|
1dfdd4dd28 | ||
|
|
48585469f6 | ||
|
|
f9ba562b0b | ||
|
|
5c63a49071 | ||
|
|
3d224496a8 | ||
|
|
73addfefe7 | ||
|
|
af0e2180bd | ||
|
|
a431015853 | ||
|
|
788244fbf4 | ||
|
|
282230b28e | ||
|
|
dc010ce28c | ||
|
|
5a3597f2a7 | ||
|
|
5b889ea59c | ||
|
|
faa6e20034 | ||
|
|
82a97f8c1f | ||
|
|
6557d21aa8 | ||
|
|
a733ed69cb | ||
|
|
9877ba93a0 | ||
|
|
669f9e71bc | ||
|
|
5d2f20efd5 | ||
|
|
06dccdd97f | ||
|
|
e705f67333 | ||
|
|
4903b99eb5 | ||
|
|
38ab6626fc | ||
|
|
b44bc8fae3 | ||
|
|
7d72d54862 | ||
|
|
0a218cebb4 | ||
|
|
ed6ad6ae76 | ||
|
|
1689b15d95 | ||
|
|
010fdde45c | ||
|
|
10509991c1 | ||
|
|
c686ee394d | ||
|
|
985902092e | ||
|
|
944b72e2a8 | ||
|
|
d074be323c | ||
|
|
0098401584 | ||
|
|
0d7d5fe380 | ||
|
|
1cb9fb6058 | ||
|
|
5076ba405e | ||
|
|
3c60dfdf7b | ||
|
|
5d44b5f3ef | ||
|
|
40cdd4c1e7 | ||
|
|
f5753109d5 | ||
|
|
51e338749a | ||
|
|
e37fb33afe | ||
|
|
47af06578a | ||
|
|
ad0cbba0b1 | ||
|
|
c7a3282dd9 | ||
|
|
fd593baa07 | ||
|
|
88f1230620 | ||
|
|
cad558980f | ||
|
|
e879aba801 | ||
|
|
114fdb9545 | ||
|
|
1886ddfbaf | ||
|
|
39d2c3aab6 | ||
|
|
3cd8a1f310 | ||
|
|
b457886ee3 | ||
|
|
e27c041256 | ||
|
|
5fcafe0b38 | ||
|
|
8250246f34 | ||
|
|
d9bcaa0b1d | ||
|
|
dd6e26ae4b | ||
|
|
fac1dd3d61 | ||
|
|
e573749aa0 | ||
|
|
f22bf60eb6 | ||
|
|
d1b99fdda3 | ||
|
|
e1a4cfca4e | ||
|
|
8a43824f3d | ||
|
|
b948fc7264 | ||
|
|
d9f891dfb1 | ||
|
|
a9524bcc33 | ||
|
|
4b537cb79d | ||
|
|
1484c26434 | ||
|
|
36e8dc9fa5 | ||
|
|
8feb7037aa | ||
|
|
d8863142c7 | ||
|
|
061109c901 | ||
|
|
f95b50c99d | ||
|
|
def5cc273c | ||
|
|
e01d2c9569 | ||
|
|
415dbbb195 | ||
|
|
765d90214d | ||
|
|
36fd1dcda9 | ||
|
|
812b9b731b | ||
|
|
e80a68485d | ||
|
|
535f4ccb8e | ||
|
|
7bbdf43452 | ||
|
|
59881d6b3b | ||
|
|
085e198409 | ||
|
|
81f27fcbde | ||
|
|
50dae0ef69 | ||
|
|
e0fdefa28e | ||
|
|
f6a826505c | ||
|
|
68ac506a25 | ||
|
|
1150d9e497 | ||
|
|
633a946f26 | ||
|
|
8e01455140 | ||
|
|
b373ab8708 | ||
|
|
cb752850ff | ||
|
|
08c929699f | ||
|
|
1862090a89 | ||
|
|
1ea80c3fab | ||
|
|
1676f5a956 | ||
|
|
cdc9cdbe95 | ||
|
|
28e8a1fb11 | ||
|
|
5f1b92ca62 | ||
|
|
c58a1874ca | ||
|
|
f4fb9cd173 | ||
|
|
ad4a6e9383 | ||
|
|
decdaf9f1f | ||
|
|
27382a6be1 | ||
|
|
34440af1c5 | ||
|
|
c0e3da9214 | ||
|
|
d50ad7345d | ||
|
|
95016c3ec6 | ||
|
|
f8f5c2474c | ||
|
|
b997e9a135 | ||
|
|
c7ccac2fe6 | ||
|
|
05885f568e | ||
|
|
b500b9f6cc | ||
|
|
e784c08f80 | ||
|
|
45ea5cc875 | ||
|
|
a006698bb2 | ||
|
|
e365944dc3 | ||
|
|
c33dcb78d0 | ||
|
|
e48ec3af7c | ||
|
|
4b9d7d1a1f | ||
|
|
d6133905b2 | ||
|
|
741b401d8c | ||
|
|
cb661313c2 | ||
|
|
3c794849bd | ||
|
|
753b4e69ee | ||
|
|
b502007fff | ||
|
|
1e6d65fe53 | ||
|
|
72515a79ca | ||
|
|
b286008403 | ||
|
|
c8e3f752db | ||
|
|
33c3822b7c | ||
|
|
97701ef3c4 | ||
|
|
d2eadcd2f5 | ||
|
|
6589f8c4f4 | ||
|
|
13dabc09c7 | ||
|
|
eb80f38813 | ||
|
|
0fc6a73b30 | ||
|
|
aa38b13adf | ||
|
|
6a79f41367 | ||
|
|
88263ccc77 | ||
|
|
9d15704b78 | ||
|
|
832060e8ad | ||
|
|
5d5652907b | ||
|
|
477d7957e3 | ||
|
|
41b39a5d3b | ||
|
|
6972b544ec | ||
|
|
1bd9eca806 | ||
|
|
a203eef9a6 | ||
|
|
f583b84951 | ||
|
|
8f319a4405 | ||
|
|
862a5ebd12 | ||
|
|
cb89bd3908 | ||
|
|
54dd424b01 | ||
|
|
b6b88086f3 | ||
|
|
b2ec99e663 | ||
|
|
74c101628b | ||
|
|
ea28b8afa4 | ||
|
|
f5d7c90be1 | ||
|
|
62b6c5193a | ||
|
|
6d9ea8a13c | ||
|
|
9abac555c3 | ||
|
|
f742f850eb | ||
|
|
83ca24b32a | ||
|
|
484e7c2102 | ||
|
|
f416e12dac | ||
|
|
1a140ab5c8 | ||
|
|
006c5f8655 | ||
|
|
b0e2985f5e | ||
|
|
cbb57411a0 | ||
|
|
28c1172db3 | ||
|
|
e708946f4c | ||
|
|
b9fff95215 | ||
|
|
7cd3a143a0 | ||
|
|
7248e90762 | ||
|
|
ceef883ad8 | ||
|
|
8a98924ad7 | ||
|
|
9526b9b6fe | ||
|
|
741f694733 | ||
|
|
8f2ef9082b | ||
|
|
e7dcc088d6 | ||
|
|
f036c3f1cc | ||
|
|
d3c64be229 | ||
|
|
5404309193 | ||
|
|
635b4d2432 | ||
|
|
3fc9ff3abf | ||
|
|
41833c8aad | ||
|
|
fdf9778f46 | ||
|
|
1e676f5a6b | ||
|
|
0af944176a | ||
|
|
6fe13b6a92 | ||
|
|
4f562e0d8e | ||
|
|
fdae50a972 | ||
|
|
277886b092 | ||
|
|
75c407ca01 | ||
|
|
2b40c5a55c | ||
|
|
cffe55428a | ||
|
|
f51708e01d | ||
|
|
6194948259 | ||
|
|
2373d0ace7 | ||
|
|
726f2083db | ||
|
|
468aff6e3f | ||
|
|
a30062db71 | ||
|
|
d0a2ccd7d6 | ||
|
|
84099b1d0b | ||
|
|
1b7dd2dd2a | ||
|
|
e5d4ba48fb |
12
.github/workflows/docker.yml
vendored
12
.github/workflows/docker.yml
vendored
@@ -32,7 +32,6 @@ jobs:
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: true
|
||||
# Fetch all tags
|
||||
- name: Fetch tags
|
||||
run: git fetch --tags
|
||||
@@ -41,12 +40,11 @@ jobs:
|
||||
shell: powershell
|
||||
run: |
|
||||
$version = ./.github/scripts/GenerateVersionNumber.ps1
|
||||
Write-Output "::set-env name=VERSION::$version"
|
||||
echo "VERSION=$version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
||||
# Use the version number to set the version of the assemblies
|
||||
- name: Update AssemblyInfo.cs
|
||||
shell: powershell
|
||||
run: |
|
||||
Write-Output ${{ env.VERSION }}
|
||||
./.github/scripts/UpdateAssemblyVersion.ps1 ${{ env.VERSION }}
|
||||
- name: restore Nuget Packages
|
||||
run: nuget install .\packages.config -OutputDirectory .\packages -ExcludeVersion
|
||||
@@ -60,7 +58,7 @@ jobs:
|
||||
- name: Build Solution
|
||||
shell: powershell
|
||||
run: |
|
||||
Invoke-Expression "docker run --rm --mount type=bind,source=""$($Env:GITHUB_WORKSPACE)"",target=""c:/project"" pepperdash/sspbuilder:v1.4.1 c:\cihelpers\vsidebuild.exe -Solution ""c:\project\$($Env:SOLUTION_FILE).sln"" -BuildSolutionConfiguration $($ENV:BUILD_TYPE)"
|
||||
Invoke-Expression "docker run --rm --mount type=bind,source=""$($Env:GITHUB_WORKSPACE)"",target=""c:/project"" pepperdash/sspbuilder c:\cihelpers\vsidebuild.exe -Solution ""c:\project\$($Env:SOLUTION_FILE).sln"" -BuildSolutionConfiguration $($ENV:BUILD_TYPE)"
|
||||
# Zip up the output files as needed
|
||||
- name: Zip Build Output
|
||||
shell: powershell
|
||||
@@ -123,7 +121,7 @@ jobs:
|
||||
Get-ChildItem "./Version"
|
||||
$version = Get-Content -Path ./Version/version.txt
|
||||
Write-Host "Version: $version"
|
||||
Write-Output "::set-env name=VERSION::$version"
|
||||
echo "VERSION=$version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
||||
Remove-Item -Path ./Version/version.txt
|
||||
Remove-Item -Path ./Version
|
||||
- name: Download Build output
|
||||
@@ -180,7 +178,7 @@ jobs:
|
||||
Get-ChildItem "./Version"
|
||||
$version = Get-Content -Path ./Version/version.txt
|
||||
Write-Host "Version: $version"
|
||||
Write-Output "::set-env name=VERSION::$version"
|
||||
echo "VERSION=$version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
||||
Remove-Item -Path ./Version/version.txt
|
||||
Remove-Item -Path ./Version
|
||||
# Checkout/Create the branch
|
||||
@@ -259,7 +257,7 @@ jobs:
|
||||
Get-ChildItem "./Version"
|
||||
$version = Get-Content -Path ./Version/version.txt
|
||||
Write-Host "Version: $version"
|
||||
Write-Output "::set-env name=VERSION::$version"
|
||||
echo "VERSION=$version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
||||
Remove-Item -Path ./Version/version.txt
|
||||
Remove-Item -Path ./Version
|
||||
# Checkout/Create the branch
|
||||
|
||||
19
.github/workflows/main.yml
vendored
19
.github/workflows/main.yml
vendored
@@ -24,25 +24,18 @@ jobs:
|
||||
# First we checkout the source repo
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v2
|
||||
# And any submodules
|
||||
- name: Checkout submodules
|
||||
shell: bash
|
||||
run: |
|
||||
git config --global url."https://github.com/".insteadOf "git@github.com:"
|
||||
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
|
||||
with:
|
||||
fetch-depth: 0
|
||||
# Generate the appropriate version number
|
||||
- name: Set Version Number
|
||||
shell: powershell
|
||||
env:
|
||||
TAG_NAME: ${{ github.event.release.tag_name }}
|
||||
run: Write-Output "::set-env name=VERSION::$($Env:TAG_NAME)"
|
||||
run: echo "VERSION=$($Env:TAG_NAME)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
||||
# Use the version number to set the version of the assemblies
|
||||
- name: Update AssemblyInfo.cs
|
||||
shell: powershell
|
||||
run: |
|
||||
Write-Output ${{ env.VERSION }}
|
||||
./.github/scripts/UpdateAssemblyVersion.ps1 ${{ env.VERSION }}
|
||||
- name: restore Nuget Packages
|
||||
run: nuget install .\packages.config -OutputDirectory .\packages -ExcludeVersion
|
||||
@@ -101,7 +94,7 @@ jobs:
|
||||
Get-ChildItem "./Version"
|
||||
$version = Get-Content -Path ./Version/version.txt
|
||||
Write-Host "Version: $version"
|
||||
Write-Output "::set-env name=VERSION::$version"
|
||||
echo "VERSION=$version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
||||
Remove-Item -Path ./Version/version.txt
|
||||
Remove-Item -Path ./Version
|
||||
- name: Download Build output
|
||||
@@ -155,7 +148,7 @@ jobs:
|
||||
Get-ChildItem "./Version"
|
||||
$version = Get-Content -Path ./Version/version.txt
|
||||
Write-Host "Version: $version"
|
||||
Write-Output "::set-env name=VERSION::$version"
|
||||
echo "VERSION=$version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
||||
Remove-Item -Path ./Version/version.txt
|
||||
Remove-Item -Path ./Version
|
||||
# Checkout/Create the branch
|
||||
@@ -228,7 +221,7 @@ jobs:
|
||||
Get-ChildItem "./Version"
|
||||
$version = Get-Content -Path ./Version/version.txt
|
||||
Write-Host "Version: $version"
|
||||
Write-Output "::set-env name=VERSION::$version"
|
||||
echo "VERSION=$version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
||||
Remove-Item -Path ./Version/version.txt
|
||||
Remove-Item -Path ./Version
|
||||
# Checkout main branch
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -388,3 +388,4 @@ MigrationBackup/
|
||||
|
||||
# Fody - auto-generated XML schema
|
||||
FodyWeavers.xsd
|
||||
essentials-framework/Essentials Interfaces/PepperDash_Essentials_Interfaces/PepperDash_Essentials_Interfaces.csproj
|
||||
|
||||
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -1,6 +1,3 @@
|
||||
[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
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -70,6 +70,14 @@ namespace PepperDash.Essentials.Bridges
|
||||
/// Range reports the highest supported HDCP state level for the corresponding input card
|
||||
/// </summary>
|
||||
public uint HdcpSupportCapability { get; set; }
|
||||
/// <summary>
|
||||
/// DM Chassis Stream Input Start (1), Stop (2), Pause (3) with Feedback
|
||||
/// </summary>
|
||||
public uint InputStreamCardStatus { get; set; }
|
||||
/// <summary>
|
||||
/// DM Chassis Stream Output Start (1), Stop (2), Pause (3) with Feedback
|
||||
/// </summary>
|
||||
public uint OutputStreamCardStatus { get; set; }
|
||||
#endregion
|
||||
|
||||
#region Serials
|
||||
@@ -115,6 +123,8 @@ namespace PepperDash.Essentials.Bridges
|
||||
InputUsb = 700; //701-899
|
||||
HdcpSupportState = 1000; //1001-1199
|
||||
HdcpSupportCapability = 1200; //1201-1399
|
||||
InputStreamCardStatus = 1500; //1501-1532
|
||||
OutputStreamCardStatus = 1600; //1601-1632
|
||||
|
||||
|
||||
//Serial
|
||||
@@ -145,6 +155,8 @@ namespace PepperDash.Essentials.Bridges
|
||||
OutputEndpointOnline = OutputEndpointOnline + joinOffset;
|
||||
HdcpSupportState = HdcpSupportState + joinOffset;
|
||||
HdcpSupportCapability = HdcpSupportCapability + joinOffset;
|
||||
InputStreamCardStatus = InputStreamCardStatus + joinOffset;
|
||||
OutputStreamCardStatus = OutputStreamCardStatus + joinOffset;
|
||||
OutputDisabledByHdcp = OutputDisabledByHdcp + joinOffset;
|
||||
TxAdvancedIsPresent = TxAdvancedIsPresent + joinOffset;
|
||||
}
|
||||
|
||||
@@ -12,11 +12,11 @@ using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Bridges;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.Core.Fusion;
|
||||
using PepperDash.Essentials.Devices.Common;
|
||||
using PepperDash.Essentials.DM;
|
||||
using PepperDash.Essentials.Fusion;
|
||||
using PepperDash.Essentials.Room.Config;
|
||||
//using PepperDash.Essentials.Room.MobileControl;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||
@@ -53,7 +53,7 @@ namespace PepperDash.Essentials
|
||||
|
||||
if (Debug.DoNotLoadOnNextBoot)
|
||||
{
|
||||
CrestronConsole.AddNewConsoleCommand(s => GoWithLoad(), "go", "Loads configuration file",
|
||||
CrestronConsole.AddNewConsoleCommand(s => CrestronInvoke.BeginInvoke((o) => GoWithLoad()), "go", "Loads configuration file",
|
||||
ConsoleAccessLevelEnum.AccessOperator);
|
||||
}
|
||||
|
||||
@@ -290,33 +290,14 @@ namespace PepperDash.Essentials
|
||||
|
||||
DeviceManager.ActivateAll();
|
||||
|
||||
var mobileControl = DeviceManager.GetDeviceForKey("appServer") as IMobileControl;
|
||||
var mobileControl = GetMobileControlDevice();
|
||||
|
||||
if (mobileControl == null) return;
|
||||
|
||||
mobileControl.LinkSystemMonitorToAppServer();
|
||||
//LinkSystemMonitorToAppServer();
|
||||
|
||||
}
|
||||
|
||||
//void LinkSystemMonitorToAppServer()
|
||||
//{
|
||||
// var sysMon = DeviceManager.GetDeviceForKey("systemMonitor") as PepperDash.Essentials.Core.Monitoring.SystemMonitorController;
|
||||
|
||||
// var appServer = DeviceManager.GetDeviceForKey("appServer") as MobileControlSystemController;
|
||||
|
||||
|
||||
// if (sysMon != null && appServer != null)
|
||||
// {
|
||||
// var key = sysMon.Key + "-" + appServer.Key;
|
||||
// var messenger = new PepperDash.Essentials.AppServer.Messengers.SystemMonitorMessenger
|
||||
// (key, sysMon, "/device/systemMonitor");
|
||||
|
||||
// messenger.RegisterWithAppServer(appServer);
|
||||
|
||||
// DeviceManager.AddDevice(messenger);
|
||||
// }
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// Reads all devices from config and adds them to DeviceManager
|
||||
/// </summary>
|
||||
@@ -327,7 +308,11 @@ namespace PepperDash.Essentials
|
||||
DeviceManager.AddDevice(new PepperDash.Essentials.Core.Devices.CrestronProcessor("processor"));
|
||||
|
||||
// Add global System Monitor device
|
||||
DeviceManager.AddDevice(new PepperDash.Essentials.Core.Monitoring.SystemMonitorController("systemMonitor"));
|
||||
if (CrestronEnvironment.DevicePlatform == eDevicePlatform.Appliance)
|
||||
{
|
||||
DeviceManager.AddDevice(
|
||||
new PepperDash.Essentials.Core.Monitoring.SystemMonitorController("systemMonitor"));
|
||||
}
|
||||
|
||||
foreach (var devConf in ConfigReader.ConfigObject.Devices)
|
||||
{
|
||||
@@ -390,11 +375,6 @@ namespace PepperDash.Essentials
|
||||
if (newDev == null)
|
||||
newDev = PepperDash.Essentials.Core.DeviceFactory.GetDevice(devConf);
|
||||
|
||||
//
|
||||
//if (newDev == null)
|
||||
// newDev = PepperDash.Essentials.Devices.Displays.DisplayDeviceFactory.GetDevice(devConf);
|
||||
//
|
||||
|
||||
if (newDev != null)
|
||||
DeviceManager.AddDevice(newDev);
|
||||
else
|
||||
@@ -452,19 +432,34 @@ namespace PepperDash.Essentials
|
||||
var room = EssentialsRoomConfigHelper.GetRoomObject(roomConfig) as EssentialsRoomBase;
|
||||
if (room != null)
|
||||
{
|
||||
// default IPID
|
||||
uint fusionIpId = 0xf1;
|
||||
|
||||
// default to no join map key
|
||||
string fusionJoinMapKey = string.Empty;
|
||||
|
||||
if (room.Config.Properties["fusion"] != null)
|
||||
{
|
||||
Debug.Console(2, "Custom Fusion config found. Using custom values");
|
||||
|
||||
var fusionConfig = room.Config.Properties["fusion"].ToObject<EssentialsRoomFusionConfig>();
|
||||
|
||||
if (fusionConfig != null)
|
||||
{
|
||||
fusionIpId = fusionConfig.IpIdInt;
|
||||
fusionJoinMapKey = fusionConfig.JoinMapKey;
|
||||
}
|
||||
}
|
||||
|
||||
if (room is EssentialsHuddleSpaceRoom)
|
||||
{
|
||||
DeviceManager.AddDevice(room);
|
||||
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Room is EssentialsHuddleSpaceRoom, attempting to add to DeviceManager with Fusion");
|
||||
DeviceManager.AddDevice(new Core.Fusion.EssentialsHuddleSpaceFusionSystemControllerBase((EssentialsHuddleSpaceRoom)room, 0xf1));
|
||||
DeviceManager.AddDevice(new Core.Fusion.EssentialsHuddleSpaceFusionSystemControllerBase(room, fusionIpId, fusionJoinMapKey));
|
||||
|
||||
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Mobile Control Bridge...");
|
||||
// Mobile Control bridge
|
||||
//var bridge = new MobileConrolEssentialsHuddleSpaceRoomBridge(room as EssentialsHuddleSpaceRoom);
|
||||
//AddBridgePostActivationHelper(bridge); // Lets things happen later when all devices are present
|
||||
//DeviceManager.AddDevice(bridge);
|
||||
|
||||
CreateMobileControlBridge(room);
|
||||
}
|
||||
@@ -473,13 +468,21 @@ namespace PepperDash.Essentials
|
||||
DeviceManager.AddDevice(room);
|
||||
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Room is EssentialsHuddleVtc1Room, attempting to add to DeviceManager with Fusion");
|
||||
DeviceManager.AddDevice(new EssentialsHuddleVtc1FusionController((EssentialsHuddleVtc1Room)room, 0xf1));
|
||||
DeviceManager.AddDevice(new EssentialsHuddleVtc1FusionController((EssentialsHuddleVtc1Room)room, fusionIpId, fusionJoinMapKey));
|
||||
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Mobile Control Bridge...");
|
||||
// Mobile Control bridge
|
||||
//var bridge = new MobileConrolEssentialsHuddleSpaceRoomBridge(room);
|
||||
//AddBridgePostActivationHelper(bridge); // Lets things happen later when all devices are present
|
||||
//DeviceManager.AddDevice(bridge);
|
||||
|
||||
CreateMobileControlBridge(room);
|
||||
}
|
||||
else if (room is EssentialsTechRoom)
|
||||
{
|
||||
DeviceManager.AddDevice(room);
|
||||
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice,
|
||||
"Room is EssentialsTechRoom, Attempting to add to DeviceManager with Fusion");
|
||||
DeviceManager.AddDevice(new EssentialsTechRoomFusionSystemController((EssentialsTechRoom)room, fusionIpId, fusionJoinMapKey));
|
||||
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Mobile Control Bridge");
|
||||
|
||||
CreateMobileControlBridge(room);
|
||||
}
|
||||
@@ -500,40 +503,55 @@ namespace PepperDash.Essentials
|
||||
|
||||
private static void CreateMobileControlBridge(EssentialsRoomBase room)
|
||||
{
|
||||
var mobileControl = DeviceManager.GetDeviceForKey("appServer") as IMobileControl;
|
||||
var mobileControl = GetMobileControlDevice();
|
||||
|
||||
if (mobileControl == null) return;
|
||||
|
||||
mobileControl.CreateMobileControlRoomBridge(room);
|
||||
mobileControl.CreateMobileControlRoomBridge(room, mobileControl);
|
||||
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Mobile Control Bridge Added...");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helps add the post activation steps that link bridges to main controller
|
||||
/// </summary>
|
||||
/// <param name="bridge"></param>
|
||||
//void AddBridgePostActivationHelper(MobileControlBridgeBase bridge)
|
||||
//{
|
||||
// bridge.AddPostActivationAction(() =>
|
||||
// {
|
||||
// var parent = DeviceManager.AllDevices.FirstOrDefault(d => d.Key == "appServer") as MobileControlSystemController;
|
||||
// if (parent == null)
|
||||
// {
|
||||
// Debug.Console(0, bridge, "ERROR: Cannot connect app server room bridge. System controller not present");
|
||||
// return;
|
||||
// }
|
||||
// Debug.Console(0, bridge, "Linking to parent controller");
|
||||
// bridge.AddParent(parent);
|
||||
// parent.AddBridge(bridge);
|
||||
// });
|
||||
//}
|
||||
private static IMobileControl GetMobileControlDevice()
|
||||
{
|
||||
var mobileControlList = DeviceManager.AllDevices.OfType<IMobileControl>().ToList();
|
||||
|
||||
if (mobileControlList.Count > 1)
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Warning,
|
||||
"Multiple instances of Mobile Control Server found.");
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
if (mobileControlList.Count > 0)
|
||||
{
|
||||
return mobileControlList[0];
|
||||
}
|
||||
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Mobile Control not enabled for this system");
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fires up a logo server if not already running
|
||||
/// </summary>
|
||||
void LoadLogoServer()
|
||||
{
|
||||
if (ConfigReader.ConfigObject.Rooms == null)
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "No rooms configured. Bypassing Logo server startup.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
!ConfigReader.ConfigObject.Rooms.Any(
|
||||
CheckRoomConfig))
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "No rooms configured to use system Logo server. Bypassing Logo server startup");
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
LogoServer = new HttpLogoServer(8080, Global.DirectorySeparator + "html" + Global.DirectorySeparator + "logo");
|
||||
@@ -543,5 +561,38 @@ namespace PepperDash.Essentials
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "NOTICE: Logo server cannot be started. Likely already running in another program");
|
||||
}
|
||||
}
|
||||
|
||||
private bool CheckRoomConfig(DeviceConfig c)
|
||||
{
|
||||
string logoDark = null;
|
||||
string logoLight = null;
|
||||
string logo = null;
|
||||
|
||||
try
|
||||
{
|
||||
if (c.Properties["logoDark"] != null)
|
||||
{
|
||||
logoDark = c.Properties["logoDark"].Value<string>("type");
|
||||
}
|
||||
|
||||
if (c.Properties["logoLight"] != null)
|
||||
{
|
||||
logoLight = c.Properties["logoLight"].Value<string>("type");
|
||||
}
|
||||
|
||||
if (c.Properties["logo"] != null)
|
||||
{
|
||||
logo = c.Properties["logo"].Value<string>("type");
|
||||
}
|
||||
|
||||
return ((logoDark != null && logoDark == "system") ||
|
||||
(logoLight != null && logoLight == "system") || (logo != null && logo == "system"));
|
||||
}
|
||||
catch
|
||||
{
|
||||
Debug.Console(1, Debug.ErrorLogLevel.Notice, "Unable to find logo information in any room config");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -225,6 +225,14 @@
|
||||
"2": "Output 2",
|
||||
"3": "Output 3",
|
||||
"4": "Output 4"
|
||||
},
|
||||
"inputSlotSupportsHdcp2":{
|
||||
"1": "false",
|
||||
"2": "false",
|
||||
"3": "false",
|
||||
"4": "false",
|
||||
"5": "false",
|
||||
"6": "false"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -16,8 +16,8 @@ namespace PepperDash.Essentials.Fusion
|
||||
{
|
||||
BooleanSigData CodecIsInCall;
|
||||
|
||||
public EssentialsHuddleVtc1FusionController(EssentialsHuddleVtc1Room room, uint ipId)
|
||||
: base(room, ipId)
|
||||
public EssentialsHuddleVtc1FusionController(EssentialsHuddleVtc1Room room, uint ipId, string joinMapKey)
|
||||
: base(room, ipId, joinMapKey)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -55,25 +55,25 @@ namespace PepperDash.Essentials.Fusion
|
||||
// Map FusionRoom Attributes:
|
||||
|
||||
// Codec volume
|
||||
var codecVolume = FusionRoom.CreateOffsetUshortSig(50, "Volume - Fader01", eSigIoMask.InputOutputSig);
|
||||
var codecVolume = FusionRoom.CreateOffsetUshortSig(JoinMap.VolumeFader1.JoinNumber, JoinMap.VolumeFader1.AttributeName, eSigIoMask.InputOutputSig);
|
||||
codecVolume.OutputSig.UserObject = new Action<ushort>(b => (codec as IBasicVolumeWithFeedback).SetVolume(b));
|
||||
(codec as IBasicVolumeWithFeedback).VolumeLevelFeedback.LinkInputSig(codecVolume.InputSig);
|
||||
|
||||
// In Call Status
|
||||
CodecIsInCall = FusionRoom.CreateOffsetBoolSig(69, "Conf - VC 1 In Call", eSigIoMask.InputSigOnly);
|
||||
CodecIsInCall = FusionRoom.CreateOffsetBoolSig(JoinMap.VcCodecInCall.JoinNumber, JoinMap.VcCodecInCall.AttributeName, eSigIoMask.InputSigOnly);
|
||||
codec.CallStatusChange += new EventHandler<PepperDash.Essentials.Devices.Common.Codec.CodecCallStatusItemChangeEventArgs>(codec_CallStatusChange);
|
||||
|
||||
// Online status
|
||||
if (codec is ICommunicationMonitor)
|
||||
{
|
||||
var c = codec as ICommunicationMonitor;
|
||||
var codecOnline = FusionRoom.CreateOffsetBoolSig(122, "Online - VC 1", eSigIoMask.InputSigOnly);
|
||||
var codecOnline = FusionRoom.CreateOffsetBoolSig(JoinMap.VcCodecOnline.JoinNumber, JoinMap.VcCodecOnline.AttributeName, eSigIoMask.InputSigOnly);
|
||||
codecOnline.InputSig.BoolValue = c.CommunicationMonitor.Status == MonitorStatus.IsOk;
|
||||
c.CommunicationMonitor.StatusChange += (o, a) =>
|
||||
{
|
||||
codecOnline.InputSig.BoolValue = a.Status == MonitorStatus.IsOk;
|
||||
};
|
||||
Debug.Console(0, this, "Linking '{0}' communication monitor to Fusion '{1}'", codec.Key, "Online - VC 1");
|
||||
Debug.Console(0, this, "Linking '{0}' communication monitor to Fusion '{1}'", codec.Key, JoinMap.VcCodecOnline.AttributeName);
|
||||
}
|
||||
|
||||
// Codec IP Address
|
||||
@@ -101,10 +101,10 @@ namespace PepperDash.Essentials.Fusion
|
||||
|
||||
if (codecHasIpInfo)
|
||||
{
|
||||
codecIpAddressSig = FusionRoom.CreateOffsetStringSig(121, "IP Address - VC", eSigIoMask.InputSigOnly);
|
||||
codecIpAddressSig = FusionRoom.CreateOffsetStringSig(JoinMap.VcCodecIpAddress.JoinNumber, JoinMap.VcCodecIpAddress.AttributeName, eSigIoMask.InputSigOnly);
|
||||
codecIpAddressSig.InputSig.StringValue = codecIpAddress;
|
||||
|
||||
codecIpPortSig = FusionRoom.CreateOffsetStringSig(150, "IP Port - VC", eSigIoMask.InputSigOnly);
|
||||
codecIpPortSig = FusionRoom.CreateOffsetStringSig(JoinMap.VcCodecIpPort.JoinNumber, JoinMap.VcCodecIpPort.AttributeName, eSigIoMask.InputSigOnly);
|
||||
codecIpPortSig.InputSig.StringValue = codecIpPort.ToString();
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ namespace PepperDash.Essentials.Fusion
|
||||
FusionStaticAssets.Add(deviceConfig.Uid, tempAsset);
|
||||
}
|
||||
|
||||
var codecAsset = FusionRoom.CreateStaticAsset(tempAsset.SlotNumber, tempAsset.Name, "Display", tempAsset.InstanceId);
|
||||
var codecAsset = FusionRoom.CreateStaticAsset(tempAsset.SlotNumber, tempAsset.Name, "Codec", tempAsset.InstanceId);
|
||||
codecAsset.PowerOn.OutputSig.UserObject = codecPowerOnAction;
|
||||
codecAsset.PowerOff.OutputSig.UserObject = codecPowerOffAction;
|
||||
codec.StandbyIsOnFeedback.LinkComplementInputSig(codecAsset.PowerOn.InputSig);
|
||||
@@ -166,20 +166,19 @@ namespace PepperDash.Essentials.Fusion
|
||||
|
||||
CrestronConsole.AddNewConsoleCommand(RequestFullRoomSchedule, "FusReqRoomSchedule", "Requests schedule of the room for the next 24 hours", ConsoleAccessLevelEnum.AccessOperator);
|
||||
CrestronConsole.AddNewConsoleCommand(ModifyMeetingEndTimeConsoleHelper, "FusReqRoomSchMod", "Ends or extends a meeting by the specified time", ConsoleAccessLevelEnum.AccessOperator);
|
||||
CrestronConsole.AddNewConsoleCommand(CreateAsHocMeeting, "FusCreateMeeting", "Creates and Ad Hoc meeting for on hour or until the next meeting", ConsoleAccessLevelEnum.AccessOperator);
|
||||
CrestronConsole.AddNewConsoleCommand(CreateAdHocMeeting, "FusCreateMeeting", "Creates and Ad Hoc meeting for on hour or until the next meeting", ConsoleAccessLevelEnum.AccessOperator);
|
||||
|
||||
// Room to fusion room
|
||||
Room.OnFeedback.LinkInputSig(FusionRoom.SystemPowerOn.InputSig);
|
||||
|
||||
// Moved to
|
||||
CurrentRoomSourceNameSig = FusionRoom.CreateOffsetStringSig(84, "Display 1 - Current Source", eSigIoMask.InputSigOnly);
|
||||
CurrentRoomSourceNameSig = FusionRoom.CreateOffsetStringSig(JoinMap.Display1CurrentSourceName.JoinNumber, JoinMap.Display1CurrentSourceName.AttributeName, eSigIoMask.InputSigOnly);
|
||||
// Don't think we need to get current status of this as nothing should be alive yet.
|
||||
(Room as EssentialsHuddleVtc1Room).CurrentSourceChange += Room_CurrentSourceInfoChange;
|
||||
|
||||
|
||||
FusionRoom.SystemPowerOn.OutputSig.SetSigFalseAction((Room as EssentialsHuddleVtc1Room).PowerOnToDefaultOrLastSource);
|
||||
FusionRoom.SystemPowerOff.OutputSig.SetSigFalseAction(() => (Room as EssentialsHuddleVtc1Room).RunRouteAction("roomOff", Room.SourceListKey));
|
||||
// NO!! room.RoomIsOn.LinkComplementInputSig(FusionRoom.SystemPowerOff.InputSig);
|
||||
|
||||
|
||||
CrestronEnvironment.EthernetEventHandler += CrestronEnvironment_EthernetEventHandler;
|
||||
@@ -197,9 +196,9 @@ namespace PepperDash.Essentials.Fusion
|
||||
uint i = 1;
|
||||
foreach (var kvp in setTopBoxes)
|
||||
{
|
||||
TryAddRouteActionSigs("Display 1 - Source TV " + i, 188 + i, kvp.Key, kvp.Value.SourceDevice);
|
||||
TryAddRouteActionSigs(JoinMap.Display1DiscPlayerSourceStart.AttributeName + " " + i, JoinMap.Display1DiscPlayerSourceStart.JoinNumber + i, kvp.Key, kvp.Value.SourceDevice);
|
||||
i++;
|
||||
if (i > 5) // We only have five spots
|
||||
if (i > JoinMap.Display1SetTopBoxSourceStart.JoinSpan) // We only have five spots
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -207,7 +206,7 @@ namespace PepperDash.Essentials.Fusion
|
||||
i = 1;
|
||||
foreach (var kvp in discPlayers)
|
||||
{
|
||||
TryAddRouteActionSigs("Display 1 - Source DVD " + i, 181 + i, kvp.Key, kvp.Value.SourceDevice);
|
||||
TryAddRouteActionSigs(JoinMap.Display1DiscPlayerSourceStart.AttributeName + " " + i, JoinMap.Display1DiscPlayerSourceStart.JoinNumber + i, kvp.Key, kvp.Value.SourceDevice);
|
||||
i++;
|
||||
if (i > 5) // We only have five spots
|
||||
break;
|
||||
@@ -217,9 +216,9 @@ namespace PepperDash.Essentials.Fusion
|
||||
i = 1;
|
||||
foreach (var kvp in laptops)
|
||||
{
|
||||
TryAddRouteActionSigs("Display 1 - Source Laptop " + i, 166 + i, kvp.Key, kvp.Value.SourceDevice);
|
||||
TryAddRouteActionSigs(JoinMap.Display1LaptopSourceStart.AttributeName + " " + i, JoinMap.Display1LaptopSourceStart.JoinNumber + i, kvp.Key, kvp.Value.SourceDevice);
|
||||
i++;
|
||||
if (i > 10) // We only have ten spots???
|
||||
if (i > JoinMap.Display1LaptopSourceStart.JoinSpan) // We only have ten spots???
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -273,14 +272,17 @@ namespace PepperDash.Essentials.Fusion
|
||||
// Display to fusion room sigs
|
||||
FusionRoom.DisplayPowerOn.OutputSig.UserObject = dispPowerOnAction;
|
||||
FusionRoom.DisplayPowerOff.OutputSig.UserObject = dispPowerOffAction;
|
||||
defaultDisplay.PowerIsOnFeedback.LinkInputSig(FusionRoom.DisplayPowerOn.InputSig);
|
||||
|
||||
var defaultDisplayTwoWay = defaultDisplay as IHasPowerControlWithFeedback;
|
||||
if (defaultDisplayTwoWay != null)
|
||||
{
|
||||
defaultDisplayTwoWay.PowerIsOnFeedback.LinkInputSig(FusionRoom.DisplayPowerOn.InputSig);
|
||||
}
|
||||
|
||||
if (defaultDisplay is IDisplayUsage)
|
||||
(defaultDisplay as IDisplayUsage).LampHours.LinkInputSig(FusionRoom.DisplayUsage.InputSig);
|
||||
|
||||
|
||||
|
||||
MapDisplayToRoomJoins(1, 158, defaultDisplay);
|
||||
|
||||
MapDisplayToRoomJoins(1, JoinMap.Display1Start.JoinNumber, defaultDisplay);
|
||||
|
||||
var deviceConfig = ConfigReader.ConfigObject.Devices.FirstOrDefault(d => d.Key.Equals(defaultDisplay.Key));
|
||||
|
||||
@@ -302,8 +304,18 @@ namespace PepperDash.Essentials.Fusion
|
||||
var dispAsset = FusionRoom.CreateStaticAsset(tempAsset.SlotNumber, tempAsset.Name, "Display", tempAsset.InstanceId);
|
||||
dispAsset.PowerOn.OutputSig.UserObject = dispPowerOnAction;
|
||||
dispAsset.PowerOff.OutputSig.UserObject = dispPowerOffAction;
|
||||
defaultDisplay.PowerIsOnFeedback.LinkInputSig(dispAsset.PowerOn.InputSig);
|
||||
// NO!! display.PowerIsOn.LinkComplementInputSig(dispAsset.PowerOff.InputSig);
|
||||
|
||||
|
||||
var defaultTwoWayDisplay = defaultDisplay as IHasPowerControlWithFeedback;
|
||||
if (defaultTwoWayDisplay != null)
|
||||
{
|
||||
defaultTwoWayDisplay.PowerIsOnFeedback.LinkInputSig(FusionRoom.DisplayPowerOn.InputSig);
|
||||
if (defaultDisplay is IDisplayUsage)
|
||||
(defaultDisplay as IDisplayUsage).LampHours.LinkInputSig(FusionRoom.DisplayUsage.InputSig);
|
||||
|
||||
defaultTwoWayDisplay.PowerIsOnFeedback.LinkInputSig(dispAsset.PowerOn.InputSig);
|
||||
}
|
||||
|
||||
// Use extension methods
|
||||
dispAsset.TrySetMakeModel(defaultDisplay);
|
||||
dispAsset.TryLinkAssetErrorToCommunication(defaultDisplay);
|
||||
@@ -315,7 +327,7 @@ namespace PepperDash.Essentials.Fusion
|
||||
|
||||
}
|
||||
|
||||
protected override void MapDisplayToRoomJoins(int displayIndex, int joinOffset, DisplayBase display)
|
||||
protected override void MapDisplayToRoomJoins(int displayIndex, uint joinOffset, DisplayBase display)
|
||||
{
|
||||
string displayName = string.Format("Display {0} - ", displayIndex);
|
||||
|
||||
@@ -325,12 +337,17 @@ namespace PepperDash.Essentials.Fusion
|
||||
// Power on
|
||||
var defaultDisplayPowerOn = FusionRoom.CreateOffsetBoolSig((uint)joinOffset, displayName + "Power On", eSigIoMask.InputOutputSig);
|
||||
defaultDisplayPowerOn.OutputSig.UserObject = new Action<bool>(b => { if (!b) display.PowerOn(); });
|
||||
display.PowerIsOnFeedback.LinkInputSig(defaultDisplayPowerOn.InputSig);
|
||||
|
||||
// Power Off
|
||||
var defaultDisplayPowerOff = FusionRoom.CreateOffsetBoolSig((uint)joinOffset + 1, displayName + "Power Off", eSigIoMask.InputOutputSig);
|
||||
defaultDisplayPowerOn.OutputSig.UserObject = new Action<bool>(b => { if (!b) display.PowerOff(); }); ;
|
||||
display.PowerIsOnFeedback.LinkInputSig(defaultDisplayPowerOn.InputSig);
|
||||
|
||||
var displayTwoWay = display as IHasPowerControlWithFeedback;
|
||||
if (displayTwoWay != null)
|
||||
{
|
||||
displayTwoWay.PowerIsOnFeedback.LinkInputSig(defaultDisplayPowerOn.InputSig);
|
||||
displayTwoWay.PowerIsOnFeedback.LinkInputSig(defaultDisplayPowerOn.InputSig);
|
||||
}
|
||||
|
||||
// Current Source
|
||||
var defaultDisplaySourceNone = FusionRoom.CreateOffsetBoolSig((uint)joinOffset + 8, displayName + "Source None", eSigIoMask.InputOutputSig);
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.Core.Fusion;
|
||||
|
||||
namespace PepperDash.Essentials.Fusion
|
||||
{
|
||||
public class EssentialsTechRoomFusionSystemController : EssentialsHuddleSpaceFusionSystemControllerBase
|
||||
{
|
||||
public EssentialsTechRoomFusionSystemController(EssentialsTechRoom room, uint ipId, string joinMapKey)
|
||||
: base(room, ipId, joinMapKey)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override void SetUpDisplay()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
var displays = (Room as EssentialsTechRoom).Displays;
|
||||
|
||||
Debug.Console(1, this, "Setting up Static Assets for {0} Displays", displays.Count);
|
||||
|
||||
foreach (var display in displays.Values.Cast<DisplayBase>())
|
||||
{
|
||||
Debug.Console(2, this, "Setting up Static Asset for {0}", display.Key);
|
||||
|
||||
display.UsageTracker = new UsageTracking(display) { UsageIsTracked = true };
|
||||
display.UsageTracker.DeviceUsageEnded += UsageTracker_DeviceUsageEnded;
|
||||
|
||||
var dispPowerOnAction = new Action<bool>(b =>
|
||||
{
|
||||
if (!b)
|
||||
{
|
||||
display.PowerOn();
|
||||
}
|
||||
});
|
||||
var dispPowerOffAction = new Action<bool>(b =>
|
||||
{
|
||||
if (!b)
|
||||
{
|
||||
display.PowerOff();
|
||||
}
|
||||
});
|
||||
|
||||
var deviceConfig = ConfigReader.ConfigObject.GetDeviceForKey(display.Key);
|
||||
|
||||
FusionAsset tempAsset;
|
||||
|
||||
if (FusionStaticAssets.ContainsKey(deviceConfig.Uid))
|
||||
{
|
||||
// Used existing asset
|
||||
tempAsset = FusionStaticAssets[deviceConfig.Uid];
|
||||
}
|
||||
else
|
||||
{
|
||||
// Create a new asset
|
||||
tempAsset = new FusionAsset(FusionRoomGuids.GetNextAvailableAssetNumber(FusionRoom),
|
||||
display.Name, "Display", "");
|
||||
FusionStaticAssets.Add(deviceConfig.Uid, tempAsset);
|
||||
}
|
||||
|
||||
var dispAsset = FusionRoom.CreateStaticAsset(tempAsset.SlotNumber, tempAsset.Name, "Display",
|
||||
tempAsset.InstanceId);
|
||||
dispAsset.PowerOn.OutputSig.UserObject = dispPowerOnAction;
|
||||
dispAsset.PowerOff.OutputSig.UserObject = dispPowerOffAction;
|
||||
|
||||
var defaultTwoWayDisplay = display as IHasPowerControlWithFeedback;
|
||||
if (defaultTwoWayDisplay != null)
|
||||
{
|
||||
defaultTwoWayDisplay.PowerIsOnFeedback.LinkInputSig(FusionRoom.DisplayPowerOn.InputSig);
|
||||
if (display is IDisplayUsage)
|
||||
{
|
||||
(display as IDisplayUsage).LampHours.LinkInputSig(FusionRoom.DisplayUsage.InputSig);
|
||||
}
|
||||
|
||||
defaultTwoWayDisplay.PowerIsOnFeedback.LinkInputSig(dispAsset.PowerOn.InputSig);
|
||||
}
|
||||
|
||||
// Use extension methods
|
||||
dispAsset.TrySetMakeModel(display);
|
||||
dispAsset.TryLinkAssetErrorToCommunication(display);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Console(1, this, "Error setting up displays in Fusion: {0}", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -71,14 +71,10 @@
|
||||
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.UI.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="mscorlib" />
|
||||
<Reference Include="PepperDash_Core, Version=1.0.41.31808, Culture=neutral, processorArchitecture=MSIL">
|
||||
<Reference Include="PepperDash_Core, Version=1.0.42.30563, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\PepperDashCore\lib\net35\PepperDash_Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PepperDash_Essentials_DM, Version=1.0.0.19343, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\essentials-framework\Essentials DM\Essentials_DM\bin\PepperDash_Essentials_DM.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SimplSharpCustomAttributesInterface, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpCustomAttributesInterface.dll</HintPath>
|
||||
@@ -137,6 +133,7 @@
|
||||
<Compile Include="Devices\Amplifier.cs" />
|
||||
<Compile Include="ControlSystem.cs" />
|
||||
<Compile Include="Fusion\EssentialsHuddleVtc1FusionController.cs" />
|
||||
<Compile Include="Fusion\EssentialsTechRoomFusionSystemController.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Room\Config\EssentialsDualDisplayRoomPropertiesConfig.cs" />
|
||||
<Compile Include="Room\Config\EssentialsNDisplayRoomPropertiesConfig.cs" />
|
||||
@@ -145,11 +142,13 @@
|
||||
<Compile Include="Room\Config\EssentialsHuddleRoomPropertiesConfig.cs" />
|
||||
<Compile Include="Room\Config\EssentialsHuddleVtc1PropertiesConfig.cs" />
|
||||
<Compile Include="Room\Config\EssentialsRoomEmergencyConfig.cs" />
|
||||
<Compile Include="Room\Config\EssentialsTechRoomConfig.cs" />
|
||||
<Compile Include="Room\Emergency\EsentialsRoomEmergencyContactClosure.cs" />
|
||||
<Compile Include="Room\Types\EssentialsDualDisplayRoom.cs" />
|
||||
<Compile Include="Room\Types\EssentialsHuddleVtc1Room.cs" />
|
||||
<Compile Include="Room\Types\EssentialsNDisplayRoomBase.cs" />
|
||||
<Compile Include="Room\Config\EssentialsRoomConfig.cs" />
|
||||
<Compile Include="Room\Types\EssentialsTechRoom.cs" />
|
||||
<Compile Include="UIDrivers\Environment Drivers\EssentialsEnvironmentDriver.cs" />
|
||||
<Compile Include="UIDrivers\Environment Drivers\EssentialsLightingDriver.cs" />
|
||||
<Compile Include="UIDrivers\Environment Drivers\EssentialsShadeDriver.cs" />
|
||||
@@ -215,6 +214,10 @@
|
||||
<Project>{892B761C-E479-44CE-BD74-243E9214AF13}</Project>
|
||||
<Name>Essentials Devices Common</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\essentials-framework\Essentials DM\Essentials_DM\PepperDash_Essentials_DM.csproj">
|
||||
<Project>{9199CE8A-0C9F-4952-8672-3EED798B284F}</Project>
|
||||
<Name>PepperDash_Essentials_DM</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" />
|
||||
<ProjectExtensions>
|
||||
|
||||
@@ -22,30 +22,25 @@ namespace PepperDash.Essentials.Room.Config
|
||||
public static Device GetRoomObject(DeviceConfig roomConfig)
|
||||
{
|
||||
var typeName = roomConfig.Type.ToLower();
|
||||
|
||||
if (typeName == "huddle")
|
||||
{
|
||||
var huddle = new EssentialsHuddleSpaceRoom(roomConfig);
|
||||
|
||||
return huddle;
|
||||
return new EssentialsHuddleSpaceRoom(roomConfig);
|
||||
}
|
||||
else if (typeName == "huddlevtc1")
|
||||
{
|
||||
var rm = new EssentialsHuddleVtc1Room(roomConfig);
|
||||
|
||||
return rm;
|
||||
}
|
||||
else if (typeName == "ddvc01Bridge")
|
||||
{
|
||||
return new Device(roomConfig.Key, roomConfig.Name); // placeholder device that does nothing.
|
||||
}
|
||||
else if (typeName == "dualdisplay")
|
||||
{
|
||||
var rm = new EssentialsDualDisplayRoom(roomConfig);
|
||||
if (typeName == "huddlevtc1")
|
||||
{
|
||||
return new EssentialsHuddleVtc1Room(roomConfig);
|
||||
}
|
||||
if (typeName == "ddvc01bridge")
|
||||
{
|
||||
return new Device(roomConfig.Key, roomConfig.Name); // placeholder device that does nothing.
|
||||
}
|
||||
if (typeName == "dualdisplay")
|
||||
{
|
||||
return new EssentialsDualDisplayRoom(roomConfig);
|
||||
}
|
||||
|
||||
return rm;
|
||||
}
|
||||
|
||||
return null;
|
||||
return typeName != "techroom" ? null : new EssentialsTechRoom(roomConfig);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -182,6 +177,9 @@ namespace PepperDash.Essentials.Room.Config
|
||||
[JsonProperty("volumes")]
|
||||
public EssentialsRoomVolumesConfig Volumes { get; set; }
|
||||
|
||||
[JsonProperty("fusion")]
|
||||
public EssentialsRoomFusionConfig Fusion { get; set; }
|
||||
|
||||
[JsonProperty("zeroVolumeWhenSwtichingVolumeDevices")]
|
||||
public bool ZeroVolumeWhenSwtichingVolumeDevices { get; set; }
|
||||
|
||||
@@ -225,6 +223,32 @@ namespace PepperDash.Essentials.Room.Config
|
||||
|
||||
}
|
||||
|
||||
public class EssentialsRoomFusionConfig
|
||||
{
|
||||
public uint IpIdInt
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
return Convert.ToUInt32(IpId, 16);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw new FormatException(string.Format("ERROR:Unable to convert IP ID: {0} to hex. Error:\n{1}", IpId));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
[JsonProperty("ipId")]
|
||||
public string IpId { get; set; }
|
||||
|
||||
[JsonProperty("joinMapKey")]
|
||||
public string JoinMapKey { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class EssentialsRoomMicrophonePrivacyConfig
|
||||
{
|
||||
[JsonProperty("deviceKey")]
|
||||
|
||||
40
PepperDashEssentials/Room/Config/EssentialsTechRoomConfig.cs
Normal file
40
PepperDashEssentials/Room/Config/EssentialsTechRoomConfig.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace PepperDash.Essentials.Room.Config
|
||||
{
|
||||
public class EssentialsTechRoomConfig
|
||||
{
|
||||
[JsonProperty("dummySourceKey")]
|
||||
public string DummySourceKey { get; set; }
|
||||
|
||||
[JsonProperty("displays")]
|
||||
public List<string> Displays;
|
||||
|
||||
[JsonProperty("tuners")]
|
||||
public List<string> Tuners;
|
||||
|
||||
[JsonProperty("userPin")]
|
||||
public string UserPin;
|
||||
|
||||
[JsonProperty("techPin")]
|
||||
public string TechPin;
|
||||
|
||||
[JsonProperty("presetsFileName")]
|
||||
public string PresetsFileName;
|
||||
|
||||
[JsonProperty("scheduledEvents")]
|
||||
public List<ScheduledEventConfig> ScheduledEvents;
|
||||
|
||||
[JsonProperty("isPrimary")] public bool IsPrimary;
|
||||
|
||||
[JsonProperty("isTvPresetsProvider")] public bool IsTvPresetsProvider;
|
||||
|
||||
public EssentialsTechRoomConfig()
|
||||
{
|
||||
Displays = new List<string>();
|
||||
Tuners = new List<string>();
|
||||
ScheduledEvents = new List<ScheduledEventConfig>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -283,19 +283,23 @@ namespace PepperDash.Essentials
|
||||
if (disp != null)
|
||||
{
|
||||
// Link power, warming, cooling to display
|
||||
disp.PowerIsOnFeedback.OutputChange += (o, a) =>
|
||||
{
|
||||
if (disp.PowerIsOnFeedback.BoolValue != OnFeedback.BoolValue)
|
||||
var dispTwoWay = disp as IHasPowerControlWithFeedback;
|
||||
if (dispTwoWay != null)
|
||||
{
|
||||
dispTwoWay.PowerIsOnFeedback.OutputChange += (o, a) =>
|
||||
{
|
||||
if (!disp.PowerIsOnFeedback.BoolValue)
|
||||
disp.CurrentSourceInfo = null;
|
||||
OnFeedback.FireUpdate();
|
||||
}
|
||||
if (disp.PowerIsOnFeedback.BoolValue)
|
||||
{
|
||||
SetDefaultLevels();
|
||||
}
|
||||
};
|
||||
if (dispTwoWay.PowerIsOnFeedback.BoolValue != OnFeedback.BoolValue)
|
||||
{
|
||||
if (!dispTwoWay.PowerIsOnFeedback.BoolValue)
|
||||
disp.CurrentSourceInfo = null;
|
||||
OnFeedback.FireUpdate();
|
||||
}
|
||||
if (dispTwoWay.PowerIsOnFeedback.BoolValue)
|
||||
{
|
||||
SetDefaultLevels();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
disp.IsWarmingUpFeedback.OutputChange += (o, a) =>
|
||||
{
|
||||
@@ -579,8 +583,8 @@ namespace PepperDash.Essentials
|
||||
|
||||
|
||||
|
||||
if (dest is IPower)
|
||||
(dest as IPower).PowerOff();
|
||||
if (dest is IHasPowerControl)
|
||||
(dest as IHasPowerControl).PowerOff();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -176,15 +176,19 @@ namespace PepperDash.Essentials
|
||||
if (disp != null)
|
||||
{
|
||||
// Link power, warming, cooling to display
|
||||
disp.PowerIsOnFeedback.OutputChange += (o, a) =>
|
||||
{
|
||||
if (disp.PowerIsOnFeedback.BoolValue != OnFeedback.BoolValue)
|
||||
{
|
||||
if (!disp.PowerIsOnFeedback.BoolValue)
|
||||
CurrentSourceInfo = null;
|
||||
OnFeedback.FireUpdate();
|
||||
}
|
||||
};
|
||||
var dispTwoWay = disp as IHasPowerControlWithFeedback;
|
||||
if (dispTwoWay != null)
|
||||
{
|
||||
dispTwoWay.PowerIsOnFeedback.OutputChange += (o, a) =>
|
||||
{
|
||||
if (dispTwoWay.PowerIsOnFeedback.BoolValue != OnFeedback.BoolValue)
|
||||
{
|
||||
if (!dispTwoWay.PowerIsOnFeedback.BoolValue)
|
||||
CurrentSourceInfo = null;
|
||||
OnFeedback.FireUpdate();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
disp.IsWarmingUpFeedback.OutputChange += (o, a) =>
|
||||
{
|
||||
@@ -495,8 +499,8 @@ namespace PepperDash.Essentials
|
||||
if (route.SourceKey.Equals("$off", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
dest.ReleaseRoute();
|
||||
if (dest is IPower)
|
||||
(dest as IPower).PowerOff();
|
||||
if (dest is IHasPowerControl)
|
||||
(dest as IHasPowerControl).PowerOff();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -13,6 +13,7 @@ using PepperDash.Essentials.Room.Config;
|
||||
using PepperDash.Essentials.Devices.Common.Codec;
|
||||
using PepperDash.Essentials.Devices.Common.VideoCodec;
|
||||
using PepperDash.Essentials.Devices.Common.AudioCodec;
|
||||
using PepperDash_Essentials_Core.DeviceTypeInterfaces;
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
{
|
||||
@@ -189,6 +190,12 @@ namespace PepperDash.Essentials
|
||||
(_CurrentSourceInfo.SourceDevice as IInUseTracking).InUseTracker.AddUser(this, "control");
|
||||
if (handler != null)
|
||||
handler(_CurrentSourceInfo, ChangeType.DidChange);
|
||||
|
||||
var vc = VideoCodec as IHasExternalSourceSwitching;
|
||||
if (vc != null)
|
||||
{
|
||||
vc.SetSelectedSource(CurrentSourceInfoKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
SourceListItem _CurrentSourceInfo;
|
||||
@@ -272,19 +279,23 @@ namespace PepperDash.Essentials
|
||||
if (disp != null)
|
||||
{
|
||||
// Link power, warming, cooling to display
|
||||
disp.PowerIsOnFeedback.OutputChange += (o, a) =>
|
||||
{
|
||||
if (disp.PowerIsOnFeedback.BoolValue != OnFeedback.BoolValue)
|
||||
var dispTwoWay = disp as IHasPowerControlWithFeedback;
|
||||
if (dispTwoWay != null)
|
||||
{
|
||||
dispTwoWay.PowerIsOnFeedback.OutputChange += (o, a) =>
|
||||
{
|
||||
if (!disp.PowerIsOnFeedback.BoolValue)
|
||||
CurrentSourceInfo = null;
|
||||
OnFeedback.FireUpdate();
|
||||
}
|
||||
if (disp.PowerIsOnFeedback.BoolValue)
|
||||
{
|
||||
SetDefaultLevels();
|
||||
}
|
||||
};
|
||||
if (dispTwoWay.PowerIsOnFeedback.BoolValue != OnFeedback.BoolValue)
|
||||
{
|
||||
if (!dispTwoWay.PowerIsOnFeedback.BoolValue)
|
||||
CurrentSourceInfo = null;
|
||||
OnFeedback.FireUpdate();
|
||||
}
|
||||
if (dispTwoWay.PowerIsOnFeedback.BoolValue)
|
||||
{
|
||||
SetDefaultLevels();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
disp.IsWarmingUpFeedback.OutputChange += (o, a) =>
|
||||
{
|
||||
@@ -313,7 +324,7 @@ namespace PepperDash.Essentials
|
||||
|
||||
|
||||
VideoCodec.CallStatusChange += (o, a) => this.InCallFeedback.FireUpdate();
|
||||
VideoCodec.IsReadyChange += (o, a) => this.SetCodecExternalSources();
|
||||
VideoCodec.IsReadyChange += (o, a) => { this.SetCodecExternalSources(); SetCodecBranding(); };
|
||||
|
||||
if (AudioCodec != null)
|
||||
AudioCodec.CallStatusChange += (o, a) => this.InCallFeedback.FireUpdate();
|
||||
@@ -382,6 +393,8 @@ namespace PepperDash.Essentials
|
||||
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Shutting down room");
|
||||
|
||||
RunRouteAction("roomOff");
|
||||
VideoCodec.StopSharing();
|
||||
VideoCodec.StandbyActivate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -424,10 +437,14 @@ namespace PepperDash.Essentials
|
||||
{
|
||||
if (string.IsNullOrEmpty(sourceListKey))
|
||||
{
|
||||
Debug.Console(1, this, "No sourceListKey present. RunRouteAction assumes default source list.");
|
||||
RunRouteAction(routeKey, new Action(() => { }));
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(1, this, "sourceListKey present but not yet implemented");
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -575,6 +592,19 @@ namespace PepperDash.Essentials
|
||||
|
||||
OnFeedback.FireUpdate();
|
||||
|
||||
if (OnFeedback.BoolValue)
|
||||
{
|
||||
if (VideoCodec.UsageTracker.InUseTracker.InUseFeedback.BoolValue)
|
||||
{
|
||||
Debug.Console(1, this, "Video Codec in use, deactivating standby on codec");
|
||||
}
|
||||
|
||||
if (VideoCodec.StandbyIsOnFeedback.BoolValue)
|
||||
{
|
||||
VideoCodec.StandbyDeactivate();
|
||||
}
|
||||
}
|
||||
|
||||
// report back when done
|
||||
if (successCallback != null)
|
||||
successCallback();
|
||||
@@ -635,8 +665,9 @@ namespace PepperDash.Essentials
|
||||
if (route.SourceKey.Equals("$off", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
dest.ReleaseRoute();
|
||||
if (dest is IPower)
|
||||
(dest as IPower).PowerOff();
|
||||
if (dest is IHasPowerControl)
|
||||
(dest as IHasPowerControl).PowerOff();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -688,40 +719,54 @@ namespace PepperDash.Essentials
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Setup the external sources for the Cisco Touch 10 devices that support IHasExternalSourceSwitch
|
||||
/// </summary>
|
||||
private void SetCodecExternalSources()
|
||||
{
|
||||
var videoCodecWithExternalSwitching = VideoCodec as IHasExternalSourceSwitching;
|
||||
/// <summary>
|
||||
/// Setup the external sources for the Cisco Touch 10 devices that support IHasExternalSourceSwitch
|
||||
/// </summary>
|
||||
private void SetCodecExternalSources()
|
||||
{
|
||||
var videoCodecWithExternalSwitching = VideoCodec as IHasExternalSourceSwitching;
|
||||
|
||||
if (videoCodecWithExternalSwitching == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
string codecTieLine = "";
|
||||
codecTieLine = ConfigReader.ConfigObject.TieLines.SingleOrDefault(x => x.DestinationKey == VideoCodec.Key).DestinationPort;
|
||||
videoCodecWithExternalSwitching.ClearExternalSources();
|
||||
videoCodecWithExternalSwitching.RunRouteAction = RunRouteAction;
|
||||
var srcList = ConfigReader.ConfigObject.SourceLists.SingleOrDefault(x => x.Key == SourceListKey).Value.OrderBy(kv => kv.Value.Order); ;
|
||||
if (videoCodecWithExternalSwitching == null || !videoCodecWithExternalSwitching.ExternalSourceListEnabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var kvp in srcList)
|
||||
{
|
||||
var srcConfig = kvp.Value;
|
||||
try
|
||||
{
|
||||
// Get the tie line that the external switcher is connected to
|
||||
string codecInputConnectorName = ConfigReader.ConfigObject.TieLines.SingleOrDefault(
|
||||
x => x.DestinationKey == VideoCodec.Key && x.DestinationPort == videoCodecWithExternalSwitching.ExternalSourceInputPort).DestinationPort;
|
||||
|
||||
if (kvp.Key != DefaultCodecRouteString && kvp.Key != "roomOff")
|
||||
{
|
||||
videoCodecWithExternalSwitching.ClearExternalSources();
|
||||
videoCodecWithExternalSwitching.RunRouteAction = RunRouteAction;
|
||||
var srcList = ConfigReader.ConfigObject.SourceLists.SingleOrDefault(x => x.Key == SourceListKey).Value.OrderBy(kv => kv.Value.Order); ;
|
||||
|
||||
videoCodecWithExternalSwitching.AddExternalSource(codecTieLine, kvp.Key, srcConfig.PreferredName, PepperDash.Essentials.Devices.Common.VideoCodec.Cisco.eExternalSourceType.desktop);
|
||||
videoCodecWithExternalSwitching.SetExternalSourceState(kvp.Key, PepperDash.Essentials.Devices.Common.VideoCodec.Cisco.eExternalSourceMode.Ready);
|
||||
foreach (var kvp in srcList)
|
||||
{
|
||||
var srcConfig = kvp.Value;
|
||||
|
||||
if (kvp.Key != DefaultCodecRouteString && kvp.Key != "roomOff")
|
||||
{
|
||||
videoCodecWithExternalSwitching.AddExternalSource(codecInputConnectorName, kvp.Key, srcConfig.PreferredName, PepperDash.Essentials.Devices.Common.VideoCodec.Cisco.eExternalSourceType.desktop);
|
||||
videoCodecWithExternalSwitching.SetExternalSourceState(kvp.Key, PepperDash.Essentials.Devices.Common.VideoCodec.Cisco.eExternalSourceMode.Ready);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Console(2, this, "Error setting codec external sources: {0}", e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private void SetCodecBranding()
|
||||
{
|
||||
var vcWithBranding = VideoCodec as IHasBranding;
|
||||
|
||||
if (vcWithBranding == null) return;
|
||||
|
||||
Debug.Console(1, this, "Setting Codec Branding");
|
||||
vcWithBranding.InitializeBranding(Key);
|
||||
}
|
||||
|
||||
#region IPrivacy Members
|
||||
|
||||
|
||||
473
PepperDashEssentials/Room/Types/EssentialsTechRoom.cs
Normal file
473
PepperDashEssentials/Room/Types/EssentialsTechRoom.cs
Normal file
@@ -0,0 +1,473 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharp.Scheduler;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Bridges;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||
using PepperDash.Essentials.Core.Presets;
|
||||
using PepperDash.Essentials.Devices.Common;
|
||||
using PepperDash.Essentials.Room.Config;
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
{
|
||||
public class EssentialsTechRoom : EssentialsRoomBase, ITvPresetsProvider, IBridgeAdvanced, IRunDirectRouteAction
|
||||
{
|
||||
private readonly EssentialsTechRoomConfig _config;
|
||||
private readonly Dictionary<string, TwoWayDisplayBase> _displays;
|
||||
|
||||
private readonly DevicePresetsModel _tunerPresets;
|
||||
private readonly Dictionary<string, IRSetTopBoxBase> _tuners;
|
||||
|
||||
private Dictionary<string, string> _currentPresets;
|
||||
private ScheduledEventGroup _roomScheduledEventGroup;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
protected override Func<bool> IsWarmingFeedbackFunc
|
||||
{
|
||||
get
|
||||
{
|
||||
return () =>
|
||||
{
|
||||
return _displays.All(kv => kv.Value.IsWarmingUpFeedback.BoolValue);
|
||||
};
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
protected override Func<bool> IsCoolingFeedbackFunc
|
||||
{
|
||||
get
|
||||
{
|
||||
return () =>
|
||||
{
|
||||
return _displays.All(kv => kv.Value.IsCoolingDownFeedback.BoolValue);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public EssentialsTechRoom(DeviceConfig config) : base(config)
|
||||
{
|
||||
_config = config.Properties.ToObject<EssentialsTechRoomConfig>();
|
||||
|
||||
_tunerPresets = new DevicePresetsModel(String.Format("{0}-presets", config.Key), _config.PresetsFileName);
|
||||
|
||||
_tunerPresets.SetFileName(_config.PresetsFileName);
|
||||
|
||||
_tunerPresets.PresetRecalled += TunerPresetsOnPresetRecalled;
|
||||
|
||||
_tuners = GetDevices<IRSetTopBoxBase>(_config.Tuners);
|
||||
_displays = GetDevices<TwoWayDisplayBase>(_config.Displays);
|
||||
|
||||
RoomPowerIsOnFeedback = new BoolFeedback(() => RoomPowerIsOn);
|
||||
|
||||
SetUpTunerPresetsFeedback();
|
||||
|
||||
SubscribeToDisplayFeedbacks();
|
||||
|
||||
CreateOrUpdateScheduledEvents();
|
||||
}
|
||||
|
||||
public Dictionary<string, StringFeedback> CurrentPresetsFeedbacks { get; private set; }
|
||||
|
||||
public Dictionary<string, IRSetTopBoxBase> Tuners
|
||||
{
|
||||
get { return _tuners; }
|
||||
}
|
||||
|
||||
public Dictionary<string, TwoWayDisplayBase> Displays
|
||||
{
|
||||
get { return _displays; }
|
||||
}
|
||||
|
||||
public BoolFeedback RoomPowerIsOnFeedback { get; private set; }
|
||||
|
||||
public bool RoomPowerIsOn
|
||||
{
|
||||
get { return _displays.All(kv => kv.Value.PowerIsOnFeedback.BoolValue); }
|
||||
}
|
||||
|
||||
#region ITvPresetsProvider Members
|
||||
|
||||
public DevicePresetsModel TvPresets
|
||||
{
|
||||
get { return _tunerPresets; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void TunerPresetsOnPresetRecalled(ISetTopBoxNumericKeypad device, string channel)
|
||||
{
|
||||
if (!_currentPresets.ContainsKey(device.Key))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_currentPresets[device.Key] = channel;
|
||||
|
||||
if (!CurrentPresetsFeedbacks.ContainsKey(device.Key))
|
||||
{
|
||||
CurrentPresetsFeedbacks[device.Key].FireUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
private void SetUpTunerPresetsFeedback()
|
||||
{
|
||||
_currentPresets = new Dictionary<string, string>();
|
||||
CurrentPresetsFeedbacks = new Dictionary<string, StringFeedback>();
|
||||
|
||||
foreach (var setTopBox in _tuners)
|
||||
{
|
||||
var tuner = setTopBox.Value;
|
||||
_currentPresets.Add(tuner.Key, String.Empty);
|
||||
CurrentPresetsFeedbacks.Add(tuner.Key, new StringFeedback(() => _currentPresets[tuner.Key]));
|
||||
}
|
||||
}
|
||||
|
||||
private void SubscribeToDisplayFeedbacks()
|
||||
{
|
||||
foreach (var display in _displays)
|
||||
{
|
||||
display.Value.PowerIsOnFeedback.OutputChange +=
|
||||
(sender, args) =>
|
||||
{
|
||||
RoomPowerIsOnFeedback.InvokeFireUpdate();
|
||||
IsWarmingUpFeedback.InvokeFireUpdate();
|
||||
IsCoolingDownFeedback.InvokeFireUpdate();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private void CreateOrUpdateScheduledEvents()
|
||||
{
|
||||
var eventsConfig = _config.ScheduledEvents;
|
||||
|
||||
GetOrCreateScheduleGroup();
|
||||
|
||||
foreach (var eventConfig in eventsConfig)
|
||||
{
|
||||
CreateOrUpdateSingleEvent(eventConfig);
|
||||
}
|
||||
|
||||
_roomScheduledEventGroup.UserGroupCallBack += HandleScheduledEvent;
|
||||
}
|
||||
|
||||
private void GetOrCreateScheduleGroup()
|
||||
{
|
||||
if (_roomScheduledEventGroup == null)
|
||||
{
|
||||
_roomScheduledEventGroup = Scheduler.GetEventGroup(Key) ?? new ScheduledEventGroup(Key);
|
||||
|
||||
Scheduler.AddEventGroup(_roomScheduledEventGroup);
|
||||
}
|
||||
|
||||
_roomScheduledEventGroup.RetrieveAllEvents();
|
||||
}
|
||||
|
||||
private void CreateOrUpdateSingleEvent(ScheduledEventConfig scheduledEvent)
|
||||
{
|
||||
if (!_roomScheduledEventGroup.ScheduledEvents.ContainsKey(scheduledEvent.Key))
|
||||
{
|
||||
SchedulerUtilities.CreateEventFromConfig(scheduledEvent, _roomScheduledEventGroup, HandleScheduledEvent);
|
||||
return;
|
||||
}
|
||||
|
||||
var roomEvent = _roomScheduledEventGroup.ScheduledEvents[scheduledEvent.Key];
|
||||
|
||||
if (!SchedulerUtilities.CheckEventTimeForMatch(roomEvent, DateTime.Parse(scheduledEvent.Time)) &&
|
||||
!SchedulerUtilities.CheckEventRecurrenceForMatch(roomEvent, scheduledEvent.Days))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Debug.Console(1, this,
|
||||
"Existing event does not match new config properties. Deleting existing event '{0}' and creating new event from configuration",
|
||||
roomEvent.Name);
|
||||
|
||||
_roomScheduledEventGroup.DeleteEvent(roomEvent);
|
||||
|
||||
SchedulerUtilities.CreateEventFromConfig(scheduledEvent, _roomScheduledEventGroup, HandleScheduledEvent);
|
||||
}
|
||||
|
||||
public void AddOrUpdateScheduledEvent(ScheduledEventConfig scheduledEvent)
|
||||
{
|
||||
//update config based on key of scheduleEvent
|
||||
GetOrCreateScheduleGroup();
|
||||
var existingEventIndex = _config.ScheduledEvents.FindIndex((e) => e.Key == scheduledEvent.Key);
|
||||
|
||||
if (existingEventIndex < 0)
|
||||
{
|
||||
_config.ScheduledEvents.Add(scheduledEvent);
|
||||
}
|
||||
else
|
||||
{
|
||||
_config.ScheduledEvents[existingEventIndex] = scheduledEvent;
|
||||
}
|
||||
|
||||
//create or update event based on config
|
||||
CreateOrUpdateSingleEvent(scheduledEvent);
|
||||
//save config
|
||||
Config.Properties = JToken.FromObject(_config);
|
||||
|
||||
CustomSetConfig(Config);
|
||||
//Fire Event
|
||||
OnScheduledEventUpdate();
|
||||
}
|
||||
|
||||
public List<ScheduledEventConfig> GetScheduledEvents()
|
||||
{
|
||||
return _config.ScheduledEvents ?? new List<ScheduledEventConfig>();
|
||||
}
|
||||
|
||||
private void OnScheduledEventUpdate()
|
||||
{
|
||||
var handler = ScheduledEventsChanged;
|
||||
|
||||
if (handler == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
handler(this, new ScheduledEventEventArgs {ScheduledEvents = _config.ScheduledEvents});
|
||||
}
|
||||
|
||||
public event EventHandler<ScheduledEventEventArgs> ScheduledEventsChanged;
|
||||
|
||||
private void HandleScheduledEvent(ScheduledEvent schevent, ScheduledEventCommon.eCallbackReason type)
|
||||
{
|
||||
var eventConfig = _config.ScheduledEvents.FirstOrDefault(e => e.Key == schevent.Name);
|
||||
|
||||
if (eventConfig == null)
|
||||
{
|
||||
Debug.Console(1, this, "Event with name {0} not found", schevent.Name);
|
||||
return;
|
||||
}
|
||||
|
||||
Debug.Console(1, this, "Running actions for event {0}", schevent.Name);
|
||||
|
||||
if (eventConfig.Acknowledgeable)
|
||||
{
|
||||
schevent.Acknowledge();
|
||||
}
|
||||
|
||||
CrestronInvoke.BeginInvoke((o) =>
|
||||
{
|
||||
Debug.Console(2, this, "There are {0} actions to execute for this event.", eventConfig.Actions.Count);
|
||||
|
||||
foreach (var a in eventConfig.Actions)
|
||||
{
|
||||
Debug.Console(2, this,
|
||||
@"Attempting to run action:
|
||||
DeviceKey: {0}
|
||||
MethodName: {1}
|
||||
Params: {2}"
|
||||
, a.DeviceKey, a.MethodName, a.Params);
|
||||
DeviceJsonApi.DoDeviceAction(a);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void RoomPowerOn()
|
||||
{
|
||||
Debug.Console(2, this, "Room Powering On");
|
||||
|
||||
var dummySource = DeviceManager.GetDeviceForKey(_config.DummySourceKey) as IRoutingOutputs;
|
||||
|
||||
if (dummySource == null)
|
||||
{
|
||||
Debug.Console(1, this, "Unable to get source with key: {0}", _config.DummySourceKey);
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var display in _displays)
|
||||
{
|
||||
RunDirectRoute(dummySource, display.Value);
|
||||
}
|
||||
}
|
||||
|
||||
public void RoomPowerOff()
|
||||
{
|
||||
Debug.Console(2, this, "Room Powering Off");
|
||||
|
||||
foreach (var display in _displays)
|
||||
{
|
||||
display.Value.PowerOff();
|
||||
}
|
||||
}
|
||||
|
||||
private Dictionary<string, T> GetDevices<T>(ICollection<string> config) where T : IKeyed
|
||||
{
|
||||
try
|
||||
{
|
||||
var returnValue = DeviceManager.AllDevices.OfType<T>()
|
||||
.Where(d => config.Contains(d.Key))
|
||||
.ToDictionary(d => d.Key, d => d);
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
catch
|
||||
{
|
||||
Debug.Console(0, this, Debug.ErrorLogLevel.Error,
|
||||
"Error getting devices. Check Essentials Configuration");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
#region Overrides of EssentialsRoomBase
|
||||
|
||||
protected override Func<bool> OnFeedbackFunc
|
||||
{
|
||||
get { return () => RoomPowerIsOn; }
|
||||
}
|
||||
|
||||
protected override void EndShutdown()
|
||||
{
|
||||
}
|
||||
|
||||
public override void SetDefaultLevels()
|
||||
{
|
||||
}
|
||||
|
||||
public override void PowerOnToDefaultOrLastSource()
|
||||
{
|
||||
}
|
||||
|
||||
public override bool RunDefaultPresentRoute()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void RoomVacatedForTimeoutPeriod(object o)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Implementation of IBridgeAdvanced
|
||||
|
||||
public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
|
||||
{
|
||||
|
||||
var joinMap = new EssentialsTechRoomJoinMap(joinStart);
|
||||
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
|
||||
|
||||
if (!String.IsNullOrEmpty(joinMapSerialized))
|
||||
{
|
||||
joinMap = JsonConvert.DeserializeObject<EssentialsTechRoomJoinMap>(joinMapSerialized);
|
||||
}
|
||||
|
||||
if (bridge != null)
|
||||
{
|
||||
bridge.AddJoinMap(Key, joinMap);
|
||||
}
|
||||
uint i;
|
||||
if (_config.IsPrimary)
|
||||
{
|
||||
i = 0;
|
||||
foreach (var feedback in CurrentPresetsFeedbacks)
|
||||
{
|
||||
feedback.Value.LinkInputSig(trilist.StringInput[(uint) (joinMap.CurrentPreset.JoinNumber + i)]);
|
||||
i++;
|
||||
}
|
||||
|
||||
trilist.OnlineStatusChange += (device, args) =>
|
||||
{
|
||||
if (!args.DeviceOnLine)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var feedback in CurrentPresetsFeedbacks)
|
||||
{
|
||||
feedback.Value.FireUpdate();
|
||||
}
|
||||
};
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
i = 0;
|
||||
foreach (var setTopBox in _tuners)
|
||||
{
|
||||
var tuner = setTopBox;
|
||||
|
||||
trilist.SetStringSigAction(joinMap.CurrentPreset.JoinNumber + i, s => _tunerPresets.Dial(s, tuner.Value));
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private class EssentialsTechRoomJoinMap : JoinMapBaseAdvanced
|
||||
{
|
||||
[JoinName("currentPreset")]
|
||||
public JoinDataComplete CurrentPreset = new JoinDataComplete(new JoinData {JoinNumber = 1, JoinSpan = 16},
|
||||
new JoinMetadata {Description = "Current Tuner Preset", JoinType = eJoinType.Serial});
|
||||
|
||||
public EssentialsTechRoomJoinMap(uint joinStart) : base(joinStart, typeof(EssentialsTechRoomJoinMap))
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
#region IRunDirectRouteAction Members
|
||||
|
||||
private void RunDirectRoute(IRoutingOutputs source, IRoutingSink dest)
|
||||
{
|
||||
if (dest == null)
|
||||
{
|
||||
Debug.Console(1, this, "Cannot route, unknown destination '{0}'", dest.Key);
|
||||
return;
|
||||
}
|
||||
|
||||
if (source == null)
|
||||
{
|
||||
dest.ReleaseRoute();
|
||||
if (dest is IHasPowerControl)
|
||||
(dest as IHasPowerControl).PowerOff();
|
||||
}
|
||||
else
|
||||
{
|
||||
dest.ReleaseAndMakeRoute(source, eRoutingSignalType.Video);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to route directly between a source and destination
|
||||
/// </summary>
|
||||
/// <param name="sourceKey"></param>
|
||||
/// <param name="destinationKey"></param>
|
||||
public void RunDirectRoute(string sourceKey, string destinationKey)
|
||||
{
|
||||
IRoutingSink dest = null;
|
||||
|
||||
dest = DeviceManager.GetDeviceForKey(destinationKey) as IRoutingSink;
|
||||
|
||||
var source = DeviceManager.GetDeviceForKey(sourceKey) as IRoutingOutputs;
|
||||
|
||||
if (source == null || dest == null)
|
||||
{
|
||||
Debug.Console(1, this, "Cannot route unknown source or destination '{0}' to {1}", sourceKey, destinationKey);
|
||||
return;
|
||||
}
|
||||
RunDirectRoute(source, dest);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public class ScheduledEventEventArgs : EventArgs
|
||||
{
|
||||
public List<ScheduledEventConfig> ScheduledEvents;
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharp.CrestronIO;
|
||||
using Crestron.SimplSharp.Net.Http;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
{
|
||||
@@ -16,12 +13,12 @@ namespace PepperDash.Essentials
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
HttpServer Server;
|
||||
readonly HttpServer _server;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
string FileDirectory;
|
||||
readonly string _fileDirectory;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -45,18 +42,17 @@ namespace PepperDash.Essentials
|
||||
//{ ".js", "application/javascript" },
|
||||
//{ ".json", "application/json" },
|
||||
//{ ".map", "application/x-navimap" },
|
||||
{ ".pdf", "application.pdf" },
|
||||
{ ".pdf", "application/pdf" },
|
||||
{ ".png", "image/png" },
|
||||
//{ ".txt", "text/plain" },
|
||||
};
|
||||
|
||||
Server = new HttpServer();
|
||||
Server.Port = port;
|
||||
FileDirectory = directory;
|
||||
Server.OnHttpRequest += new OnHttpRequestHandler(Server_OnHttpRequest);
|
||||
Server.Open();
|
||||
_server = new HttpServer {Port = port};
|
||||
_fileDirectory = directory;
|
||||
_server.OnHttpRequest += Server_OnHttpRequest;
|
||||
_server.Open();
|
||||
|
||||
CrestronEnvironment.ProgramStatusEventHandler += new ProgramStatusEventHandler(CrestronEnvironment_ProgramStatusEventHandler);
|
||||
CrestronEnvironment.ProgramStatusEventHandler += CrestronEnvironment_ProgramStatusEventHandler;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -67,27 +63,40 @@ namespace PepperDash.Essentials
|
||||
var path = args.Request.Path;
|
||||
Debug.Console(2, "HTTP Request with path: '{0}'", args.Request.Path);
|
||||
|
||||
if (File.Exists(FileDirectory + path))
|
||||
try
|
||||
{
|
||||
string filePath = path.Replace('/', '\\');
|
||||
string localPath = string.Format(@"{0}{1}", FileDirectory, filePath);
|
||||
|
||||
Debug.Console(2, "HTTP Logo Server attempting to find file: '{0}'", localPath);
|
||||
if (File.Exists(localPath))
|
||||
if (File.Exists(_fileDirectory + path))
|
||||
{
|
||||
args.Response.Header.ContentType = GetContentType(new FileInfo(localPath).Extension);
|
||||
args.Response.ContentStream = new FileStream(localPath, FileMode.Open, FileAccess.Read);
|
||||
var filePath = path.Replace('/', '\\');
|
||||
var localPath = string.Format(@"{0}{1}", _fileDirectory, filePath);
|
||||
|
||||
Debug.Console(2, "HTTP Logo Server attempting to find file: '{0}'", localPath);
|
||||
if (File.Exists(localPath))
|
||||
{
|
||||
args.Response.Header.ContentType = GetContentType(new FileInfo(localPath).Extension);
|
||||
args.Response.ContentStream = new FileStream(localPath, FileMode.Open, FileAccess.Read);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(2, "HTTP Logo Server Cannot find file '{0}'", localPath);
|
||||
args.Response.ContentString = string.Format("Not found: '{0}'", filePath);
|
||||
args.Response.Code = 404;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(2, "HTTP Logo Server Cannot find file '{0}'", localPath);
|
||||
args.Response.ContentString = string.Format("Not found: '{0}'", filePath);
|
||||
Debug.Console(2, "HTTP Logo Server: '{0}' does not exist", _fileDirectory + path);
|
||||
args.Response.ContentString = string.Format("Not found: '{0}'", _fileDirectory + path);
|
||||
args.Response.Code = 404;
|
||||
}
|
||||
}
|
||||
else
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.Console(2, "HTTP Logo Server: '{0}' does not exist", FileDirectory + path);
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Error, "Exception getting file: {0}", ex.Message);
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Error, "Stack Trace: {0}", ex.StackTrace);
|
||||
|
||||
args.Response.Code = 400;
|
||||
args.Response.ContentString = string.Format("invalid request");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,7 +106,7 @@ namespace PepperDash.Essentials
|
||||
void CrestronEnvironment_ProgramStatusEventHandler(eProgramStatusEventType programEventType)
|
||||
{
|
||||
if (programEventType == eProgramStatusEventType.Stopping)
|
||||
Server.Close();
|
||||
_server.Close();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -107,11 +116,7 @@ namespace PepperDash.Essentials
|
||||
/// <returns></returns>
|
||||
public static string GetContentType(string extension)
|
||||
{
|
||||
string type;
|
||||
if (ExtensionContentTypes.ContainsKey(extension))
|
||||
type = ExtensionContentTypes[extension];
|
||||
else
|
||||
type = "text/plain";
|
||||
var type = ExtensionContentTypes.ContainsKey(extension) ? ExtensionContentTypes[extension] : "text/plain";
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -272,6 +272,20 @@ namespace PepperDash.Essentials
|
||||
public const uint VCCameraPreset3 = 1283;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 1291
|
||||
/// </summary>
|
||||
public const uint VCCameraPreset1Visible = 1291;
|
||||
/// <summary>
|
||||
/// 1292
|
||||
/// </summary>
|
||||
public const uint VCCameraPreset2Visible = 1292;
|
||||
/// <summary>
|
||||
/// 1293
|
||||
/// </summary>
|
||||
public const uint VCCameraPreset3Visible = 1293;
|
||||
|
||||
|
||||
// Letter joins start at 2921;
|
||||
|
||||
//******************************************************
|
||||
|
||||
@@ -1,80 +1,81 @@
|
||||
using System;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using Crestron.SimplSharpPro.UI;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.SmartObjects;
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class EssentialsPanelMainInterfaceDriver : PanelDriverBase
|
||||
{
|
||||
CTimer InactivityTimer;
|
||||
|
||||
/// <summary>
|
||||
/// Assign the appropriate A/V driver.
|
||||
/// Want to keep the AvDriver alive, because it may hold states
|
||||
/// </summary>
|
||||
public IAVDriver AvDriver { get; set; }
|
||||
|
||||
public EssentialsHeaderDriver HeaderDriver { get; set; }
|
||||
|
||||
public EssentialsEnvironmentDriver EnvironmentDriver { get; set; }
|
||||
|
||||
public PanelDriverBase CurrentChildDriver { get; private set; }
|
||||
|
||||
using System;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using Crestron.SimplSharpPro.UI;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.SmartObjects;
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class EssentialsPanelMainInterfaceDriver : PanelDriverBase, IHasScreenSaverController
|
||||
{
|
||||
CTimer InactivityTimer;
|
||||
|
||||
/// <summary>
|
||||
/// Assign the appropriate A/V driver.
|
||||
/// Want to keep the AvDriver alive, because it may hold states
|
||||
/// </summary>
|
||||
public IAVDriver AvDriver { get; set;}
|
||||
|
||||
public EssentialsHeaderDriver HeaderDriver { get; set; }
|
||||
|
||||
public EssentialsEnvironmentDriver EnvironmentDriver { get; set; }
|
||||
|
||||
public PanelDriverBase CurrentChildDriver { get; private set; }
|
||||
|
||||
public ScreenSaverController ScreenSaverController { get; set; }
|
||||
|
||||
private readonly long _timeoutMs;
|
||||
|
||||
CrestronTouchpanelPropertiesConfig Config;
|
||||
|
||||
/// <summary>
|
||||
/// The main interlock for popups
|
||||
/// </summary>
|
||||
//public JoinedSigInterlock PopupInterlock { get; private set; }
|
||||
|
||||
public EssentialsPanelMainInterfaceDriver(BasicTriListWithSmartObject trilist,
|
||||
CrestronTouchpanelPropertiesConfig config)
|
||||
: base(trilist)
|
||||
{
|
||||
Config = config;
|
||||
|
||||
_timeoutMs = Config.ScreenSaverTimeoutMin * 60 * 1000;
|
||||
|
||||
var tsx52or60 = trilist as Tswx52ButtonVoiceControl;
|
||||
|
||||
private readonly long _timeoutMs;
|
||||
|
||||
CrestronTouchpanelPropertiesConfig Config;
|
||||
|
||||
/// <summary>
|
||||
/// The main interlock for popups
|
||||
/// </summary>
|
||||
//public JoinedSigInterlock PopupInterlock { get; private set; }
|
||||
|
||||
public EssentialsPanelMainInterfaceDriver(BasicTriListWithSmartObject trilist,
|
||||
CrestronTouchpanelPropertiesConfig config)
|
||||
: base(trilist)
|
||||
{
|
||||
Config = config;
|
||||
|
||||
_timeoutMs = Config.ScreenSaverTimeoutMin * 60 * 1000;
|
||||
|
||||
var tsx52or60 = trilist as Tswx52ButtonVoiceControl;
|
||||
|
||||
if (tsx52or60 != null)
|
||||
{
|
||||
tsx52or60.ExtenderTouchDetectionReservedSigs.Use();
|
||||
tsx52or60.ExtenderTouchDetectionReservedSigs.DeviceExtenderSigChange += ExtenderTouchDetectionReservedSigs_DeviceExtenderSigChange;
|
||||
tsx52or60.ExtenderTouchDetectionReservedSigs.Time.UShortValue = 1;
|
||||
ManageInactivityTimer();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
var tswx70 = trilist as TswX70Base;
|
||||
if (tswx70 != null)
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
var tswx70 = trilist as TswX70Base;
|
||||
if (tswx70 != null)
|
||||
{
|
||||
tswx70.ExtenderTouchDetectionReservedSigs.Use();
|
||||
tswx70.ExtenderTouchDetectionReservedSigs.DeviceExtenderSigChange += ExtenderTouchDetectionReservedSigs_DeviceExtenderSigChange;
|
||||
tswx70.ExtenderTouchDetectionReservedSigs.Time.UShortValue = 1;
|
||||
ManageInactivityTimer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ExtenderTouchDetectionReservedSigs_DeviceExtenderSigChange(Crestron.SimplSharpPro.DeviceExtender currentDeviceExtender, Crestron.SimplSharpPro.SigEventArgs args)
|
||||
{
|
||||
|
||||
ManageInactivityTimer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ExtenderTouchDetectionReservedSigs_DeviceExtenderSigChange(Crestron.SimplSharpPro.DeviceExtender currentDeviceExtender, Crestron.SimplSharpPro.SigEventArgs args)
|
||||
{
|
||||
|
||||
if (args.Sig.BoolValue)
|
||||
{
|
||||
ManageInactivityTimer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ManageInactivityTimer()
|
||||
@@ -87,46 +88,52 @@ namespace PepperDash.Essentials
|
||||
{
|
||||
InactivityTimer = new CTimer((o) => InactivityTimerExpired(), _timeoutMs);
|
||||
}
|
||||
}
|
||||
|
||||
void InactivityTimerExpired()
|
||||
{
|
||||
InactivityTimer.Stop();
|
||||
InactivityTimer.Dispose();
|
||||
InactivityTimer = null;
|
||||
|
||||
ScreenSaverController.Show();
|
||||
}
|
||||
|
||||
public override void Show()
|
||||
{
|
||||
CurrentChildDriver = null;
|
||||
ShowSubDriver(AvDriver as PanelDriverBase);
|
||||
base.Show();
|
||||
}
|
||||
|
||||
public override void Hide()
|
||||
{
|
||||
TriList.BooleanInput[AvDriver.StartPageVisibleJoin].BoolValue = false;
|
||||
base.Hide();
|
||||
}
|
||||
|
||||
void ShowSubDriver(PanelDriverBase driver)
|
||||
{
|
||||
CurrentChildDriver = driver;
|
||||
if (driver == null)
|
||||
return;
|
||||
this.Hide();
|
||||
driver.Show();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public override void BackButtonPressed()
|
||||
{
|
||||
if(CurrentChildDriver != null)
|
||||
CurrentChildDriver.BackButtonPressed();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void InactivityTimerExpired()
|
||||
{
|
||||
InactivityTimer.Stop();
|
||||
InactivityTimer.Dispose();
|
||||
InactivityTimer = null;
|
||||
|
||||
ScreenSaverController.Show();
|
||||
}
|
||||
|
||||
public override void Show()
|
||||
{
|
||||
CurrentChildDriver = null;
|
||||
ShowSubDriver(AvDriver as PanelDriverBase);
|
||||
|
||||
base.Show();
|
||||
}
|
||||
|
||||
public override void Hide()
|
||||
{
|
||||
TriList.BooleanInput[AvDriver.StartPageVisibleJoin].BoolValue = false;
|
||||
base.Hide();
|
||||
}
|
||||
|
||||
void ShowSubDriver(PanelDriverBase driver)
|
||||
{
|
||||
CurrentChildDriver = driver;
|
||||
if (driver == null)
|
||||
return;
|
||||
this.Hide();
|
||||
driver.Show();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public override void BackButtonPressed()
|
||||
{
|
||||
if(CurrentChildDriver != null)
|
||||
CurrentChildDriver.BackButtonPressed();
|
||||
}
|
||||
}
|
||||
|
||||
public interface IHasScreenSaverController
|
||||
{
|
||||
ScreenSaverController ScreenSaverController { get; }
|
||||
}
|
||||
}
|
||||
@@ -114,7 +114,7 @@ namespace PepperDash.Essentials
|
||||
/// <summary>
|
||||
/// The parent driver for this
|
||||
/// </summary>
|
||||
PanelDriverBase Parent;
|
||||
public PanelDriverBase Parent { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// All children attached to this driver. For hiding and showing as a group.
|
||||
@@ -305,9 +305,9 @@ namespace PepperDash.Essentials
|
||||
TriList.SetSigFalseAction(UIBoolJoin.ShowPowerOffPress, EndMeetingPress);
|
||||
|
||||
TriList.SetSigFalseAction(UIBoolJoin.DisplayPowerTogglePress, () =>
|
||||
{
|
||||
if (CurrentRoom != null && CurrentRoom.DefaultDisplay is IPower)
|
||||
(CurrentRoom.DefaultDisplay as IPower).PowerToggle();
|
||||
{
|
||||
if (CurrentRoom != null && CurrentRoom.DefaultDisplay is IHasPowerControl)
|
||||
(CurrentRoom.DefaultDisplay as IHasPowerControl).PowerToggle();
|
||||
});
|
||||
|
||||
base.Show();
|
||||
@@ -984,8 +984,8 @@ namespace PepperDash.Essentials
|
||||
(previousDev as IDvr).UnlinkButtons(TriList);
|
||||
if (previousDev is INumericKeypad)
|
||||
(previousDev as INumericKeypad).UnlinkButtons(TriList);
|
||||
if (previousDev is IPower)
|
||||
(previousDev as IPower).UnlinkButtons(TriList);
|
||||
if (previousDev is IHasPowerControl)
|
||||
(previousDev as IHasPowerControl).UnlinkButtons(TriList);
|
||||
if (previousDev is ITransport)
|
||||
(previousDev as ITransport).UnlinkButtons(TriList);
|
||||
//if (previousDev is IRadio)
|
||||
@@ -1044,8 +1044,8 @@ namespace PepperDash.Essentials
|
||||
(dev as IDvr).LinkButtons(TriList);
|
||||
if (dev is INumericKeypad)
|
||||
(dev as INumericKeypad).LinkButtons(TriList);
|
||||
if (dev is IPower)
|
||||
(dev as IPower).LinkButtons(TriList);
|
||||
if (dev is IHasPowerControl)
|
||||
(dev as IHasPowerControl).LinkButtons(TriList);
|
||||
if (dev is ITransport)
|
||||
(dev as ITransport).LinkButtons(TriList);
|
||||
//if (dev is IRadio)
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace PepperDash.Essentials
|
||||
/// <summary>
|
||||
/// The parent driver for this
|
||||
/// </summary>
|
||||
PanelDriverBase Parent;
|
||||
public PanelDriverBase Parent { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// All children attached to this driver. For hiding and showing as a group.
|
||||
@@ -319,8 +319,8 @@ namespace PepperDash.Essentials
|
||||
|
||||
TriList.SetSigFalseAction(UIBoolJoin.DisplayPowerTogglePress, () =>
|
||||
{
|
||||
if (CurrentRoom != null && CurrentRoom.DefaultDisplay is IPower)
|
||||
(CurrentRoom.DefaultDisplay as IPower).PowerToggle();
|
||||
if (CurrentRoom != null && CurrentRoom.DefaultDisplay is IHasPowerControl)
|
||||
(CurrentRoom.DefaultDisplay as IHasPowerControl).PowerToggle();
|
||||
});
|
||||
|
||||
SetupNextMeetingTimer();
|
||||
@@ -1293,8 +1293,8 @@ namespace PepperDash.Essentials
|
||||
(previousDev as IDvr).UnlinkButtons(TriList);
|
||||
if (previousDev is INumericKeypad)
|
||||
(previousDev as INumericKeypad).UnlinkButtons(TriList);
|
||||
if (previousDev is IPower)
|
||||
(previousDev as IPower).UnlinkButtons(TriList);
|
||||
if (previousDev is IHasPowerControl)
|
||||
(previousDev as IHasPowerControl).UnlinkButtons(TriList);
|
||||
if (previousDev is ITransport)
|
||||
(previousDev as ITransport).UnlinkButtons(TriList);
|
||||
}
|
||||
@@ -1351,8 +1351,8 @@ namespace PepperDash.Essentials
|
||||
(dev as IDvr).LinkButtons(TriList);
|
||||
if (dev is INumericKeypad)
|
||||
(dev as INumericKeypad).LinkButtons(TriList);
|
||||
if (dev is IPower)
|
||||
(dev as IPower).LinkButtons(TriList);
|
||||
if (dev is IHasPowerControl)
|
||||
(dev as IHasPowerControl).LinkButtons(TriList);
|
||||
if (dev is ITransport)
|
||||
(dev as ITransport).LinkButtons(TriList);
|
||||
}
|
||||
@@ -1430,6 +1430,7 @@ namespace PepperDash.Essentials
|
||||
/// </summary>
|
||||
public interface IAVDriver
|
||||
{
|
||||
PanelDriverBase Parent { get; }
|
||||
JoinedSigInterlock PopupInterlock { get; }
|
||||
void ShowNotificationRibbon(string message, int timeout);
|
||||
void HideNotificationRibbon();
|
||||
|
||||
@@ -21,6 +21,8 @@ namespace PepperDash.Essentials
|
||||
private readonly EssentialsPanelMainInterfaceDriver _parent;
|
||||
|
||||
|
||||
private JoinedSigInterlock PositionInterlock;
|
||||
|
||||
CTimer PositionTimer;
|
||||
|
||||
uint PositionTimeoutMs;
|
||||
@@ -38,7 +40,9 @@ namespace PepperDash.Essentials
|
||||
|
||||
PositionJoins = new List<uint>() { UIBoolJoin.MCScreenSaverPosition1Visible, UIBoolJoin.MCScreenSaverPosition2Visible, UIBoolJoin.MCScreenSaverPosition3Visible, UIBoolJoin.MCScreenSaverPosition4Visible };
|
||||
|
||||
var cmdName = String.Format("shwscrsvr-{0}", config.IpId);
|
||||
PositionInterlock = new JoinedSigInterlock(parent.TriList);
|
||||
|
||||
var cmdName = String.Format("shwscrsvr-{0}", parent.TriList.ID);
|
||||
|
||||
CrestronConsole.AddNewConsoleCommand((o) => Show(), cmdName, "Shows Panel Screensaver", ConsoleAccessLevelEnum.AccessOperator);
|
||||
|
||||
@@ -47,10 +51,13 @@ namespace PepperDash.Essentials
|
||||
|
||||
public override void Show()
|
||||
{
|
||||
_parent.AvDriver.PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.MCScreenSaverVisible);
|
||||
if (_parent.AvDriver != null)
|
||||
{
|
||||
_parent.AvDriver.PopupInterlock.ShowInterlocked(UIBoolJoin.MCScreenSaverVisible);
|
||||
}
|
||||
|
||||
CurrentPositionIndex = 0;
|
||||
SetCurrentPosition();
|
||||
ShowCurrentPosition();
|
||||
StartPositionTimer();
|
||||
|
||||
base.Show();
|
||||
@@ -58,6 +65,8 @@ namespace PepperDash.Essentials
|
||||
|
||||
public override void Hide()
|
||||
{
|
||||
Debug.Console(1, "Hiding ScreenSaverController");
|
||||
|
||||
if (PositionTimer != null)
|
||||
{
|
||||
PositionTimer.Stop();
|
||||
@@ -67,7 +76,10 @@ namespace PepperDash.Essentials
|
||||
|
||||
ClearAllPositions();
|
||||
|
||||
_parent.AvDriver.PopupInterlock.HideAndClear();
|
||||
if (_parent.AvDriver != null)
|
||||
{
|
||||
_parent.AvDriver.PopupInterlock.HideAndClear();
|
||||
}
|
||||
|
||||
base.Hide();
|
||||
}
|
||||
@@ -89,7 +101,7 @@ namespace PepperDash.Essentials
|
||||
{
|
||||
IncrementPositionIndex();
|
||||
|
||||
SetCurrentPosition();
|
||||
ShowCurrentPosition();
|
||||
|
||||
StartPositionTimer();
|
||||
}
|
||||
@@ -109,20 +121,16 @@ namespace PepperDash.Essentials
|
||||
}
|
||||
|
||||
//
|
||||
void SetCurrentPosition()
|
||||
void ShowCurrentPosition()
|
||||
{
|
||||
ClearAllPositions();
|
||||
|
||||
// Set based on current index
|
||||
TriList.SetBool(PositionJoins[CurrentPositionIndex], true);
|
||||
PositionInterlock.ShowInterlocked(PositionJoins[CurrentPositionIndex]);
|
||||
}
|
||||
|
||||
void ClearAllPositions()
|
||||
{
|
||||
foreach (var join in PositionJoins)
|
||||
{
|
||||
TriList.SetBool(join, false);
|
||||
}
|
||||
Debug.Console(1, "Hiding all screensaver positions");
|
||||
PositionInterlock.HideAndClear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -398,6 +398,8 @@ namespace PepperDash.Essentials.UIDrivers.VC
|
||||
/// </summary>
|
||||
void ShowIncomingModal(CodecActiveCallItem call)
|
||||
{
|
||||
Debug.Console(1, "Showing Incoming Call Modal");
|
||||
|
||||
(Parent as IAVWithVCDriver).PrepareForCodecIncomingCall();
|
||||
IncomingCallModal = new ModalDialog(TriList);
|
||||
string msg;
|
||||
@@ -413,13 +415,19 @@ namespace PepperDash.Essentials.UIDrivers.VC
|
||||
msg = string.Format("Incoming video call from: {0}", call.Name);
|
||||
}
|
||||
|
||||
if (Parent.PopupInterlock.IsShown)
|
||||
|
||||
// Hide screensaver
|
||||
var screenSaverParent = Parent.Parent as IHasScreenSaverController;
|
||||
|
||||
if (screenSaverParent != null)
|
||||
{
|
||||
if (Parent.PopupInterlock.CurrentJoin == UIBoolJoin.MCScreenSaverVisible)
|
||||
{
|
||||
Parent.PopupInterlock.HideAndClear();
|
||||
}
|
||||
screenSaverParent.ScreenSaverController.Hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(1, "Parent.Parent is null or does not implement IHasScreenSaverController");
|
||||
}
|
||||
|
||||
|
||||
IncomingCallModal.PresentModalDialog(2, "Incoming Call", icon, msg,
|
||||
"Ignore", "Accept", false, false, b =>
|
||||
@@ -709,17 +717,45 @@ namespace PepperDash.Essentials.UIDrivers.VC
|
||||
uint holdTime = 5000;
|
||||
presetsCodec.CodecRoomPresetsListHasChanged += new EventHandler<EventArgs>(presetsCodec_CodecRoomPresetsListHasChanged);
|
||||
|
||||
TriList.BooleanOutput[UIBoolJoin.VCCameraPreset1].SetSigHeldAction(
|
||||
holdTime, () => presetsCodec.CodecRoomPresetStore(1, presetsCodec.NearEndPresets[0].Description), ShowPresetStoreFeedback, () => presetsCodec.CodecRoomPresetSelect(1));
|
||||
TriList.BooleanOutput[UIBoolJoin.VCCameraPreset2].SetSigHeldAction(
|
||||
holdTime, () => presetsCodec.CodecRoomPresetStore(2, presetsCodec.NearEndPresets[1].Description), ShowPresetStoreFeedback, () => presetsCodec.CodecRoomPresetSelect(2));
|
||||
TriList.BooleanOutput[UIBoolJoin.VCCameraPreset3].SetSigHeldAction(
|
||||
holdTime, () => presetsCodec.CodecRoomPresetStore(3, presetsCodec.NearEndPresets[2].Description), ShowPresetStoreFeedback, () => presetsCodec.CodecRoomPresetSelect(3));
|
||||
var preset = 1;
|
||||
if (presetsCodec.NearEndPresets[preset - 1] != null && presetsCodec.NearEndPresets[preset - 1].Defined)
|
||||
{
|
||||
TriList.SetBool(UIBoolJoin.VCCameraPreset1Visible, true);
|
||||
TriList.BooleanOutput[UIBoolJoin.VCCameraPreset1].SetSigHeldAction(
|
||||
holdTime, ShowPresetStoreFeedback,() => presetsCodec.CodecRoomPresetStore(preset, presetsCodec.NearEndPresets[preset - 1].Description),
|
||||
() => presetsCodec.CodecRoomPresetSelect(preset));
|
||||
TriList.StringInput[UIStringJoin.VCCameraPresetLabel1].StringValue = presetsCodec.NearEndPresets[preset - 1].Description;
|
||||
}
|
||||
else
|
||||
{
|
||||
TriList.SetBool(UIBoolJoin.VCCameraPreset1Visible, false);
|
||||
}
|
||||
|
||||
TriList.StringInput[UIStringJoin.VCCameraPresetLabel1].StringValue = presetsCodec.NearEndPresets[0].Description;
|
||||
TriList.StringInput[UIStringJoin.VCCameraPresetLabel2].StringValue = presetsCodec.NearEndPresets[1].Description;
|
||||
TriList.StringInput[UIStringJoin.VCCameraPresetLabel3].StringValue = presetsCodec.NearEndPresets[2].Description;
|
||||
if (presetsCodec.NearEndPresets[1] != null && presetsCodec.NearEndPresets[1].Defined)
|
||||
{
|
||||
TriList.SetBool(UIBoolJoin.VCCameraPreset2Visible, true);
|
||||
TriList.BooleanOutput[UIBoolJoin.VCCameraPreset2].SetSigHeldAction(
|
||||
holdTime, ShowPresetStoreFeedback, () => presetsCodec.CodecRoomPresetStore(preset, presetsCodec.NearEndPresets[preset - 1].Description),
|
||||
() => presetsCodec.CodecRoomPresetSelect(preset));
|
||||
TriList.StringInput[UIStringJoin.VCCameraPresetLabel2].StringValue = presetsCodec.NearEndPresets[1].Description;
|
||||
}
|
||||
else
|
||||
{
|
||||
TriList.SetBool(UIBoolJoin.VCCameraPreset2Visible, false);
|
||||
}
|
||||
|
||||
if (presetsCodec.NearEndPresets[2] != null && presetsCodec.NearEndPresets[2].Defined)
|
||||
{
|
||||
TriList.SetBool(UIBoolJoin.VCCameraPreset3Visible, true);
|
||||
TriList.BooleanOutput[UIBoolJoin.VCCameraPreset3].SetSigHeldAction(
|
||||
holdTime, ShowPresetStoreFeedback, () => presetsCodec.CodecRoomPresetStore(preset, presetsCodec.NearEndPresets[preset - 1].Description),
|
||||
() => presetsCodec.CodecRoomPresetSelect(preset));
|
||||
TriList.StringInput[UIStringJoin.VCCameraPresetLabel3].StringValue = presetsCodec.NearEndPresets[2].Description;
|
||||
}
|
||||
else
|
||||
{
|
||||
TriList.SetBool(UIBoolJoin.VCCameraPreset3Visible, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharp.Reflection;
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using Crestron.SimplSharpPro.EthernetCommunication;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
@@ -76,15 +78,15 @@ namespace PepperDash.Essentials.Core.Bridges
|
||||
/// <summary>
|
||||
/// Bridge API using EISC
|
||||
/// </summary>
|
||||
public class EiscApiAdvanced : BridgeApi
|
||||
public class EiscApiAdvanced : BridgeApi, ICommunicationMonitor
|
||||
{
|
||||
public EiscApiPropertiesConfig PropertiesConfig { get; private set; }
|
||||
|
||||
protected Dictionary<string, JoinMapBaseAdvanced> JoinMaps { get; private set; }
|
||||
|
||||
public ThreeSeriesTcpIpEthernetIntersystemCommunications Eisc { get; private set; }
|
||||
public BasicTriList Eisc { get; private set; }
|
||||
|
||||
public EiscApiAdvanced(DeviceConfig dc) :
|
||||
public EiscApiAdvanced(DeviceConfig dc, BasicTriList eisc) :
|
||||
base(dc.Key)
|
||||
{
|
||||
JoinMaps = new Dictionary<string, JoinMapBaseAdvanced>();
|
||||
@@ -92,44 +94,107 @@ namespace PepperDash.Essentials.Core.Bridges
|
||||
PropertiesConfig = dc.Properties.ToObject<EiscApiPropertiesConfig>();
|
||||
//PropertiesConfig = JsonConvert.DeserializeObject<EiscApiPropertiesConfig>(dc.Properties.ToString());
|
||||
|
||||
Eisc = new ThreeSeriesTcpIpEthernetIntersystemCommunications(PropertiesConfig.Control.IpIdInt, PropertiesConfig.Control.TcpSshProperties.Address, Global.ControlSystem);
|
||||
Eisc = eisc;
|
||||
|
||||
Eisc.SigChange += Eisc_SigChange;
|
||||
|
||||
AddPostActivationAction( () =>
|
||||
CommunicationMonitor = new CrestronGenericBaseCommunicationMonitor(this, Eisc, 120000, 300000);
|
||||
|
||||
AddPostActivationAction(LinkDevices);
|
||||
AddPostActivationAction(LinkRooms);
|
||||
AddPostActivationAction(RegisterEisc);
|
||||
}
|
||||
|
||||
public override bool CustomActivate()
|
||||
{
|
||||
CommunicationMonitor.Start();
|
||||
return base.CustomActivate();
|
||||
}
|
||||
|
||||
public override bool Deactivate()
|
||||
{
|
||||
CommunicationMonitor.Stop();
|
||||
return base.Deactivate();
|
||||
}
|
||||
|
||||
private void LinkDevices()
|
||||
{
|
||||
Debug.Console(1, this, "Linking Devices...");
|
||||
|
||||
if (PropertiesConfig.Devices == null)
|
||||
{
|
||||
Debug.Console(1, this, "Linking Devices...");
|
||||
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "No devices linked to this bridge");
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var d in PropertiesConfig.Devices)
|
||||
foreach (var d in PropertiesConfig.Devices)
|
||||
{
|
||||
var device = DeviceManager.GetDeviceForKey(d.DeviceKey);
|
||||
|
||||
if (device == null)
|
||||
{
|
||||
var device = DeviceManager.GetDeviceForKey(d.DeviceKey);
|
||||
|
||||
if (device == null) continue;
|
||||
|
||||
Debug.Console(1, this, "Linking Device: '{0}'", device.Key);
|
||||
|
||||
if (!typeof (IBridgeAdvanced).IsAssignableFrom(device.GetType().GetCType()))
|
||||
{
|
||||
Debug.Console(0, this, Debug.ErrorLogLevel.Notice,
|
||||
"{0} is not compatible with this bridge type. Please use 'eiscapi' instead, or updae the device.",
|
||||
device.Key);
|
||||
continue;
|
||||
}
|
||||
|
||||
var bridge = device as IBridgeAdvanced;
|
||||
if (bridge != null) bridge.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey, this);
|
||||
continue;
|
||||
}
|
||||
|
||||
var registerResult = Eisc.Register();
|
||||
Debug.Console(1, this, "Linking Device: '{0}'", device.Key);
|
||||
|
||||
if (registerResult != eDeviceRegistrationUnRegistrationResponse.Success)
|
||||
if (!typeof (IBridgeAdvanced).IsAssignableFrom(device.GetType().GetCType()))
|
||||
{
|
||||
Debug.Console(2, this, Debug.ErrorLogLevel.Error, "Registration result: {0}", registerResult);
|
||||
return;
|
||||
Debug.Console(0, this, Debug.ErrorLogLevel.Notice,
|
||||
"{0} is not compatible with this bridge type. Please use 'eiscapi' instead, or updae the device.",
|
||||
device.Key);
|
||||
continue;
|
||||
}
|
||||
|
||||
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "EISC registration successful");
|
||||
});
|
||||
var bridge = device as IBridgeAdvanced;
|
||||
if (bridge != null)
|
||||
{
|
||||
bridge.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void RegisterEisc()
|
||||
{
|
||||
if (Eisc.Registered)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var registerResult = Eisc.Register();
|
||||
|
||||
if (registerResult != eDeviceRegistrationUnRegistrationResponse.Success)
|
||||
{
|
||||
Debug.Console(2, this, Debug.ErrorLogLevel.Error, "Registration result: {0}", registerResult);
|
||||
return;
|
||||
}
|
||||
|
||||
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "EISC registration successful");
|
||||
}
|
||||
|
||||
public void LinkRooms()
|
||||
{
|
||||
Debug.Console(1, this, "Linking Rooms...");
|
||||
|
||||
if (PropertiesConfig.Rooms == null)
|
||||
{
|
||||
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "No rooms linked to this bridge.");
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var room in PropertiesConfig.Rooms)
|
||||
{
|
||||
var rm = DeviceManager.GetDeviceForKey(room.RoomKey) as IBridgeAdvanced;
|
||||
|
||||
if (rm == null)
|
||||
{
|
||||
Debug.Console(1, this, Debug.ErrorLogLevel.Notice,
|
||||
"Room {0} does not implement IBridgeAdvanced. Skipping...", room.RoomKey);
|
||||
continue;
|
||||
}
|
||||
|
||||
rm.LinkToApi(Eisc, room.JoinStart, room.JoinMapKey, this);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -152,7 +217,7 @@ namespace PepperDash.Essentials.Core.Bridges
|
||||
/// <summary>
|
||||
/// Prints all the join maps on this bridge
|
||||
/// </summary>
|
||||
public void PrintJoinMaps()
|
||||
public virtual void PrintJoinMaps()
|
||||
{
|
||||
Debug.Console(0, this, "Join Maps for EISC IPID: {0}", Eisc.ID.ToString("X"));
|
||||
|
||||
@@ -247,7 +312,7 @@ namespace PepperDash.Essentials.Core.Bridges
|
||||
/// </summary>
|
||||
/// <param name="currentDevice"></param>
|
||||
/// <param name="args"></param>
|
||||
void Eisc_SigChange(object currentDevice, SigEventArgs args)
|
||||
protected void Eisc_SigChange(object currentDevice, SigEventArgs args)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -270,6 +335,12 @@ namespace PepperDash.Essentials.Core.Bridges
|
||||
Debug.Console(2, this, "Error in Eisc_SigChange handler: {0}", e);
|
||||
}
|
||||
}
|
||||
|
||||
#region Implementation of ICommunicationMonitor
|
||||
|
||||
public StatusMonitorBase CommunicationMonitor { get; private set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public class EiscApiPropertiesConfig
|
||||
@@ -280,6 +351,9 @@ namespace PepperDash.Essentials.Core.Bridges
|
||||
[JsonProperty("devices")]
|
||||
public List<ApiDevicePropertiesConfig> Devices { get; set; }
|
||||
|
||||
[JsonProperty("rooms")]
|
||||
public List<ApiRoomPropertiesConfig> Rooms { get; set; }
|
||||
|
||||
|
||||
public class ApiDevicePropertiesConfig
|
||||
{
|
||||
@@ -293,21 +367,52 @@ namespace PepperDash.Essentials.Core.Bridges
|
||||
public string JoinMapKey { get; set; }
|
||||
}
|
||||
|
||||
public class ApiRoomPropertiesConfig
|
||||
{
|
||||
[JsonProperty("roomKey")]
|
||||
public string RoomKey { get; set; }
|
||||
|
||||
[JsonProperty("joinStart")]
|
||||
public uint JoinStart { get; set; }
|
||||
|
||||
[JsonProperty("joinMapKey")]
|
||||
public string JoinMapKey { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class EiscApiAdvancedFactory : EssentialsDeviceFactory<EiscApiAdvanced>
|
||||
{
|
||||
public EiscApiAdvancedFactory()
|
||||
{
|
||||
TypeNames = new List<string> { "eiscapiadv", "eiscapiadvanced" };
|
||||
TypeNames = new List<string> { "eiscapiadv", "eiscapiadvanced", "vceiscapiadv", "vceiscapiadvanced" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new EiscApiAdvanced Device");
|
||||
|
||||
return new EiscApiAdvanced(dc);
|
||||
|
||||
var controlProperties = CommFactory.GetControlPropertiesConfig(dc);
|
||||
|
||||
switch (dc.Type.ToLower())
|
||||
{
|
||||
case "eiscapiadv":
|
||||
case "eiscapiadvanced":
|
||||
{
|
||||
var eisc = new ThreeSeriesTcpIpEthernetIntersystemCommunications(controlProperties.IpIdInt,
|
||||
controlProperties.TcpSshProperties.Address, Global.ControlSystem);
|
||||
return new EiscApiAdvanced(dc, eisc);
|
||||
}
|
||||
case "vceiscapiadv":
|
||||
case "vceiscapiadvanced":
|
||||
{
|
||||
var eisc = new VirtualControlEISCClient(controlProperties.IpIdInt, InitialParametersClass.RoomId,
|
||||
Global.ControlSystem);
|
||||
return new EiscApiAdvanced(dc, eisc);
|
||||
}
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace PepperDash.Essentials.Core.Bridges
|
||||
/// <param name="joinStart">Join this join map will start at</param>
|
||||
/// <param name="type">Type of the child join map</param>
|
||||
public AppleTvJoinMap(uint joinStart, Type type) : base(joinStart, type)
|
||||
{
|
||||
}
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -76,6 +76,14 @@ namespace PepperDash.Essentials.Core.Bridges
|
||||
public JoinDataComplete HdcpSupportCapability = new JoinDataComplete(new JoinData { JoinNumber = 1201, JoinSpan = 32 },
|
||||
new JoinMetadata { Description = "DM Chassis Input HDCP Support Capability", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Analog });
|
||||
|
||||
[JoinName("InputStreamCardState")]
|
||||
public JoinDataComplete InputStreamCardState = new JoinDataComplete(new JoinData { JoinNumber = 1501, JoinSpan = 32 },
|
||||
new JoinMetadata { Description = "DM Chassis Stream Input Start (1), Stop (2), Pause (3) with Feedback", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Analog });
|
||||
|
||||
[JoinName("OutputStreamCardState")]
|
||||
public JoinDataComplete OutputStreamCardState = new JoinDataComplete(new JoinData { JoinNumber = 1601, JoinSpan = 32 },
|
||||
new JoinMetadata { Description = "DM Chassis Stream Output Start (1), Stop (2), Pause (3) with Feedback", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Analog });
|
||||
|
||||
[JoinName("InputNames")]
|
||||
public JoinDataComplete InputNames = new JoinDataComplete(new JoinData { JoinNumber = 101, JoinSpan = 32 },
|
||||
new JoinMetadata { Description = "DM Chassis Input Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
||||
|
||||
@@ -0,0 +1,811 @@
|
||||
using System;
|
||||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash_Essentials_Core.Bridges.JoinMaps
|
||||
{
|
||||
public class VideoCodecControllerJoinMap : JoinMapBaseAdvanced
|
||||
{
|
||||
#region Status
|
||||
|
||||
[JoinName("IsOnline")] public JoinDataComplete IsOnline =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 1, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Device is Online",
|
||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
#endregion
|
||||
|
||||
[JoinName("CallDirection")] public JoinDataComplete CallDirection =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 22, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Current Call Direction",
|
||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||
JoinType = eJoinType.Serial
|
||||
});
|
||||
|
||||
[JoinName("CameraLayout")] public JoinDataComplete CameraLayout =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 142, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Camera Layout Toggle",
|
||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("CameraLayoutStringFb")] public JoinDataComplete CameraLayoutStringFb =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 141, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Current Layout Fb",
|
||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||
JoinType = eJoinType.Analog
|
||||
});
|
||||
|
||||
[JoinName("CameraModeAuto")] public JoinDataComplete CameraModeAuto =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 131, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Camera Mode Auto",
|
||||
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("CameraModeManual")] public JoinDataComplete CameraModeManual =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 132, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Camera Mode Manual",
|
||||
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("CameraModeOff")] public JoinDataComplete CameraModeOff =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 133, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Camera Mode Off",
|
||||
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("CameraNumberSelect")] public JoinDataComplete CameraNumberSelect =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 60, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Camera Number Select/FB",
|
||||
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
|
||||
JoinType = eJoinType.Analog
|
||||
});
|
||||
|
||||
[JoinName("CameraPanLeft")] public JoinDataComplete CameraPanLeft =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 113, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Camera Pan Left",
|
||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("CameraPanRight")] public JoinDataComplete CameraPanRight =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 114, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Camera Pan Right",
|
||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("CameraPresetNames")] public JoinDataComplete CameraPresetNames =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 121, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Camera Preset Names - XSIG, max of 15",
|
||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||
JoinType = eJoinType.Serial
|
||||
});
|
||||
|
||||
[JoinName("CameraPresetSelect")] public JoinDataComplete CameraPresetSelect =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 121, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Camera Preset Select",
|
||||
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
|
||||
JoinType = eJoinType.Analog
|
||||
});
|
||||
|
||||
[JoinName("CameraPresetSave")] public JoinDataComplete CameraPresetSave =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 121, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Save Selected Preset",
|
||||
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("CameraSelfView")] public JoinDataComplete CameraSelfView =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 141, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Camera Self View Toggle/FB",
|
||||
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("CameraSupportsAutoMode")] public JoinDataComplete CameraSupportsAutoMode =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 143, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Camera Supports Auto Mode FB",
|
||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("CameraSupportsOffMode")] public JoinDataComplete CameraSupportsOffMode =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 144, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Camera Supports Off Mode FB",
|
||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("CameraTiltDown")] public JoinDataComplete CameraTiltDown =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 112, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Camera Tilt Down",
|
||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("CameraTiltUp")] public JoinDataComplete CameraTiltUp =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 111, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Camera Tilt Up",
|
||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("CameraZoomIn")] public JoinDataComplete CameraZoomIn =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 115, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Camera Zoom In",
|
||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("CameraZoomOut")] public JoinDataComplete CameraZoomOut =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 116, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Camera Zoom Out",
|
||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("CurrentCallName")] public JoinDataComplete CurrentCallData =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 2, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Current Call Data - XSIG",
|
||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||
JoinType = eJoinType.Serial
|
||||
});
|
||||
|
||||
[JoinName("CurrentDialString")] public JoinDataComplete CurrentDialString =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 1, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Current Dial String",
|
||||
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
|
||||
JoinType = eJoinType.Serial
|
||||
});
|
||||
|
||||
[JoinName("CurrentParticipants")] public JoinDataComplete CurrentParticipants =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 151, JoinSpan = 1},
|
||||
new JoinMetadata()
|
||||
{
|
||||
Description = "Current Participants XSig",
|
||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||
JoinType = eJoinType.Serial
|
||||
});
|
||||
|
||||
[JoinName("CurrentSource")] public JoinDataComplete CurrentSource =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 201, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Current Source",
|
||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||
JoinType = eJoinType.Serial
|
||||
});
|
||||
|
||||
[JoinName("DialMeeting1")] public JoinDataComplete DialMeeting1 =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 161, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Join first meeting",
|
||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("DialMeeting2")]
|
||||
public JoinDataComplete DialMeeting2 =
|
||||
new JoinDataComplete(new JoinData { JoinNumber = 162, JoinSpan = 1 },
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Join second meeting",
|
||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("DialMeeting3")]
|
||||
public JoinDataComplete DialMeeting3 =
|
||||
new JoinDataComplete(new JoinData { JoinNumber = 163, JoinSpan = 1 },
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Join third meeting",
|
||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("DirectoryDialSelectedLine")] public JoinDataComplete DirectoryDialSelectedLine =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 106, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Dial selected directory line",
|
||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("DirectoryEntries")] public JoinDataComplete DirectoryEntries =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 101, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Directory Entries - XSig, 255 entries",
|
||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||
JoinType = eJoinType.Serial
|
||||
});
|
||||
|
||||
[JoinName("DirectoryEntryIsContact")] public JoinDataComplete DirectoryEntryIsContact =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 101, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Directory Selected Entry Is Contact FB",
|
||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("DirectoryEntrySelectedName")] public JoinDataComplete DirectoryEntrySelectedName =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 356, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Selected Directory Entry Name",
|
||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||
JoinType = eJoinType.Serial
|
||||
});
|
||||
|
||||
[JoinName("DirectoryEntrySelectedNumber")] public JoinDataComplete DirectoryEntrySelectedNumber =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 357, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Selected Directory Entry Number",
|
||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||
JoinType = eJoinType.Serial
|
||||
});
|
||||
|
||||
[JoinName("DirectoryFolderBack")] public JoinDataComplete DirectoryFolderBack =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 105, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Go back one directory level",
|
||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("DirectoryHasChanged")] public JoinDataComplete DirectoryHasChanged =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 103, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Directory has changed FB",
|
||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("DirectoryIsRoot")] public JoinDataComplete DirectoryIsRoot =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 102, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Directory is on Root FB",
|
||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("DirectoryLineSelected")] public JoinDataComplete DirectoryLineSelected =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 101, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Directory Line Selected FB",
|
||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("DirectoryRoot")] public JoinDataComplete DirectoryRoot =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 104, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Go to Directory Root",
|
||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("DirectoryRowCount")] public JoinDataComplete DirectoryRowCount =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 101, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Directory Row Count FB",
|
||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||
JoinType = eJoinType.Analog
|
||||
});
|
||||
|
||||
[JoinName("DirectorySearchBusy")] public JoinDataComplete DirectorySearchBusy =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 100, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Directory Search Busy FB",
|
||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("DirectorySearchString")] public JoinDataComplete DirectorySearchString =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 100, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Directory Search String",
|
||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||
JoinType = eJoinType.Serial
|
||||
});
|
||||
|
||||
[JoinName("DirectorySelectRow")] public JoinDataComplete DirectorySelectRow =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 101, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Directory Select Row",
|
||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||
JoinType = eJoinType.Analog
|
||||
});
|
||||
|
||||
[JoinName("DirectorySelectedFolderName")] public JoinDataComplete DirectorySelectedFolderName =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 358, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Selected Directory Folder Name",
|
||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||
JoinType = eJoinType.Serial
|
||||
});
|
||||
|
||||
[JoinName("0")] public JoinDataComplete Dtmf0 =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 20, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "DTMF 0",
|
||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("1")] public JoinDataComplete Dtmf1 =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 11, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "DTMF 1",
|
||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("2")] public JoinDataComplete Dtmf2 =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 12, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "DTMF 2",
|
||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("3")] public JoinDataComplete Dtmf3 =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 13, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "DTMF 3",
|
||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("4")] public JoinDataComplete Dtmf4 =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 14, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "DTMF 4",
|
||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("5")] public JoinDataComplete Dtmf5 =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 15, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "DTMF 5",
|
||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("6")] public JoinDataComplete Dtmf6 =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 16, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "DTMF 6",
|
||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("7")] public JoinDataComplete Dtmf7 =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 17, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "DTMF 7",
|
||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("8")] public JoinDataComplete Dtmf8 =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 18, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "DTMF 8",
|
||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("9")] public JoinDataComplete Dtmf9 =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 19, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "DTMF 9",
|
||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("#")] public JoinDataComplete DtmfPound =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 22, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "DTMF #",
|
||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("*")] public JoinDataComplete DtmfStar =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 21, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "DTMF *",
|
||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("EndCall")] public JoinDataComplete EndCall =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 24, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Hang Up",
|
||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("HookState")] public JoinDataComplete HookState =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 31, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Current Hook State",
|
||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("IncomingAnswer")] public JoinDataComplete IncomingAnswer =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 51, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Answer Incoming Call",
|
||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("IncomingCall")] public JoinDataComplete IncomingCall =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 50, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Incoming Call",
|
||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("IncomingCallName")] public JoinDataComplete IncomingCallName =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 51, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Incoming Call Name",
|
||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||
JoinType = eJoinType.Serial
|
||||
});
|
||||
|
||||
[JoinName("IncomingCallNumber")] public JoinDataComplete IncomingCallNumber =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 52, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Incoming Call Number",
|
||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||
JoinType = eJoinType.Serial
|
||||
});
|
||||
|
||||
[JoinName("IncomingReject")] public JoinDataComplete IncomingReject =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 52, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Reject Incoming Call",
|
||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
|
||||
[JoinName("ManualDial")] public JoinDataComplete ManualDial =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 71, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Dial manual string",
|
||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("Meeting Count Fb")] public JoinDataComplete MeetingCount =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 161, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Meeting Count",
|
||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||
JoinType = eJoinType.Analog
|
||||
});
|
||||
|
||||
[JoinName("MicMuteOff")] public JoinDataComplete MicMuteOff =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 172, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Mic Mute Off",
|
||||
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("MicMuteOn")] public JoinDataComplete MicMuteOn =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 171, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Mic Mute On",
|
||||
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("MicMuteToggle")] public JoinDataComplete MicMuteToggle =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 173, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Mic Mute Toggle",
|
||||
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("MinutesBeforeMeetingStart")] public JoinDataComplete MinutesBeforeMeetingStart =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 41, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Minutes before meeting start that a meeting is joinable",
|
||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||
JoinType = eJoinType.Analog
|
||||
});
|
||||
|
||||
[JoinName("ParticipantCount")] public JoinDataComplete ParticipantCount =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 151, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Current Participant Count",
|
||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||
JoinType = eJoinType.Analog
|
||||
});
|
||||
|
||||
[JoinName("Schedule")] public JoinDataComplete Schedule =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 102, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Schedule Data - XSIG",
|
||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||
JoinType = eJoinType.Serial
|
||||
});
|
||||
|
||||
[JoinName("AutoShareWhileInCall")] public JoinDataComplete SourceShareAutoStart =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 203, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "When high, will autostart sharing when a call is joined",
|
||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("SourceShareEnd")] public JoinDataComplete SourceShareEnd =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 202, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Stop Sharing & Feedback",
|
||||
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("SourceShareStart")] public JoinDataComplete SourceShareStart =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 201, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Start Sharing & Feedback",
|
||||
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("RecievingContent")] public JoinDataComplete RecievingContent =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 204, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Recieving content from the far end",
|
||||
JoinType = eJoinType.Digital,
|
||||
JoinCapabilities = eJoinCapabilities.ToSIMPL
|
||||
});
|
||||
|
||||
[JoinName("SelfviewPosition")] public JoinDataComplete SelfviewPosition =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 211, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "advance selfview position",
|
||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("SelfviewPositionFb")]
|
||||
public JoinDataComplete SelfviewPositionFb =
|
||||
new JoinDataComplete(new JoinData { JoinNumber = 211, JoinSpan = 1 },
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "advance selfview position",
|
||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||
JoinType = eJoinType.Serial
|
||||
});
|
||||
|
||||
[JoinName("SpeedDialStart")] public JoinDataComplete SpeedDialStart =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 41, JoinSpan = 4},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Speed Dial",
|
||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("UpdateMeetings")] public JoinDataComplete UpdateMeetings =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 160, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Update Meetings",
|
||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("VolumeDown")] public JoinDataComplete VolumeDown =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 175, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Volume Down",
|
||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("VolumeLevel")] public JoinDataComplete VolumeLevel =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 174, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Volume Level",
|
||||
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
|
||||
JoinType = eJoinType.Analog
|
||||
});
|
||||
|
||||
[JoinName("VolumeMuteOff")] public JoinDataComplete VolumeMuteOff =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 177, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Volume Mute Off",
|
||||
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("VolumeMuteOn")] public JoinDataComplete VolumeMuteOn =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 176, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Volume Mute On",
|
||||
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("VolumeMuteToggle")] public JoinDataComplete VolumeMuteToggle =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 178, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Volume Mute Toggle",
|
||||
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("VolumeUp")] public JoinDataComplete VolumeUp =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 174, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Volume Up",
|
||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("DialPhoneCall")]
|
||||
public JoinDataComplete DialPhone =
|
||||
new JoinDataComplete(new JoinData { JoinNumber = 72, JoinSpan = 1 },
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Dial Phone",
|
||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("PhoneHookState")]
|
||||
public JoinDataComplete PhoneHookState =
|
||||
new JoinDataComplete(new JoinData { JoinNumber = 72, JoinSpan = 1 },
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Dial Phone",
|
||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("EndPhoneCall")]
|
||||
public JoinDataComplete HangUpPhone =
|
||||
new JoinDataComplete(new JoinData { JoinNumber = 73, JoinSpan = 1 },
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Hang Up PHone",
|
||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("PhoneString")]
|
||||
public JoinDataComplete PhoneDialString =
|
||||
new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Phone Dial String",
|
||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||
JoinType = eJoinType.Serial
|
||||
});
|
||||
|
||||
public VideoCodecControllerJoinMap(uint joinStart) : base(joinStart, typeof (VideoCodecControllerJoinMap))
|
||||
{
|
||||
}
|
||||
|
||||
public VideoCodecControllerJoinMap(uint joinStart, Type type) : base(joinStart, type)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -56,6 +56,11 @@ namespace PepperDash.Essentials.Core
|
||||
|
||||
private void RegisterAndConfigureComPort()
|
||||
{
|
||||
if (Port == null)
|
||||
{
|
||||
Debug.Console(0,this,Debug.ErrorLogLevel.Error, "Configured com Port for this device does not exist.");
|
||||
return;
|
||||
}
|
||||
if (Port.Parent is CrestronControlSystem)
|
||||
{
|
||||
var result = Port.Register();
|
||||
|
||||
@@ -1,120 +1,120 @@
|
||||
using System;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.DM;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class CommFactory
|
||||
{
|
||||
public static EssentialsControlPropertiesConfig GetControlPropertiesConfig(DeviceConfig deviceConfig)
|
||||
{
|
||||
try
|
||||
{
|
||||
return JsonConvert.DeserializeObject<EssentialsControlPropertiesConfig>
|
||||
(deviceConfig.Properties["control"].ToString());
|
||||
//Debug.Console(2, "Control TEST: {0}", JsonConvert.SerializeObject(controlConfig));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
Debug.Console(0, "ERROR: [{0}] Control properties deserialize failed:\r{1}", deviceConfig.Key, e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns a comm method of either com port, TCP, SSH, and puts this into the DeviceManager
|
||||
/// </summary>
|
||||
/// <param name="deviceConfig">The Device config object</param>
|
||||
public static IBasicCommunication CreateCommForDevice(DeviceConfig deviceConfig)
|
||||
{
|
||||
EssentialsControlPropertiesConfig controlConfig = GetControlPropertiesConfig(deviceConfig);
|
||||
if (controlConfig == null)
|
||||
return null;
|
||||
|
||||
IBasicCommunication comm = null;
|
||||
try
|
||||
{
|
||||
var c = controlConfig.TcpSshProperties;
|
||||
switch (controlConfig.Method)
|
||||
{
|
||||
case eControlMethod.Com:
|
||||
comm = new ComPortController(deviceConfig.Key + "-com", GetComPort, controlConfig.ComParams, controlConfig);
|
||||
break;
|
||||
case eControlMethod.Cec:
|
||||
comm = new CecPortController(deviceConfig.Key + "-cec", GetCecPort, controlConfig);
|
||||
break;
|
||||
case eControlMethod.IR:
|
||||
break;
|
||||
case eControlMethod.Ssh:
|
||||
{
|
||||
var ssh = new GenericSshClient(deviceConfig.Key + "-ssh", c.Address, c.Port, c.Username, c.Password);
|
||||
ssh.AutoReconnect = c.AutoReconnect;
|
||||
if(ssh.AutoReconnect)
|
||||
ssh.AutoReconnectIntervalMs = c.AutoReconnectIntervalMs;
|
||||
comm = ssh;
|
||||
break;
|
||||
}
|
||||
case eControlMethod.Tcpip:
|
||||
{
|
||||
var tcp = new GenericTcpIpClient(deviceConfig.Key + "-tcp", c.Address, c.Port, c.BufferSize);
|
||||
tcp.AutoReconnect = c.AutoReconnect;
|
||||
if (tcp.AutoReconnect)
|
||||
tcp.AutoReconnectIntervalMs = c.AutoReconnectIntervalMs;
|
||||
comm = tcp;
|
||||
break;
|
||||
}
|
||||
case eControlMethod.Udp:
|
||||
{
|
||||
var udp = new GenericUdpServer(deviceConfig.Key + "-udp", c.Address, c.Port, c.BufferSize);
|
||||
comm = udp;
|
||||
break;
|
||||
}
|
||||
case eControlMethod.Telnet:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Console(0, "Cannot create communication from JSON:\r{0}\r\rException:\r{1}",
|
||||
deviceConfig.Properties.ToString(), e);
|
||||
}
|
||||
|
||||
// put it in the device manager if it's the right flavor
|
||||
var comDev = comm as Device;
|
||||
if (comDev != null)
|
||||
DeviceManager.AddDevice(comDev);
|
||||
return comm;
|
||||
}
|
||||
|
||||
public static ComPort GetComPort(EssentialsControlPropertiesConfig config)
|
||||
{
|
||||
var comPar = config.ComParams;
|
||||
var dev = GetIComPortsDeviceFromManagedDevice(config.ControlPortDevKey);
|
||||
if (dev != null && config.ControlPortNumber <= dev.NumberOfComPorts)
|
||||
return dev.ComPorts[config.ControlPortNumber];
|
||||
Debug.Console(0, "GetComPort: Device '{0}' does not have com port {1}", config.ControlPortDevKey, config.ControlPortNumber);
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets an ICec port from a RoutingInput or RoutingOutput on a device
|
||||
/// </summary>
|
||||
/// <param name="config"></param>
|
||||
/// <returns></returns>
|
||||
public static ICec GetCecPort(ControlPropertiesConfig config)
|
||||
{
|
||||
using System;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.DM;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class CommFactory
|
||||
{
|
||||
public static EssentialsControlPropertiesConfig GetControlPropertiesConfig(DeviceConfig deviceConfig)
|
||||
{
|
||||
try
|
||||
{
|
||||
return JsonConvert.DeserializeObject<EssentialsControlPropertiesConfig>
|
||||
(deviceConfig.Properties["control"].ToString());
|
||||
//Debug.Console(2, "Control TEST: {0}", JsonConvert.SerializeObject(controlConfig));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
Debug.Console(0, "ERROR: [{0}] Control properties deserialize failed:\r{1}", deviceConfig.Key, e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns a comm method of either com port, TCP, SSH, and puts this into the DeviceManager
|
||||
/// </summary>
|
||||
/// <param name="deviceConfig">The Device config object</param>
|
||||
public static IBasicCommunication CreateCommForDevice(DeviceConfig deviceConfig)
|
||||
{
|
||||
EssentialsControlPropertiesConfig controlConfig = GetControlPropertiesConfig(deviceConfig);
|
||||
if (controlConfig == null)
|
||||
return null;
|
||||
|
||||
IBasicCommunication comm = null;
|
||||
try
|
||||
{
|
||||
var c = controlConfig.TcpSshProperties;
|
||||
switch (controlConfig.Method)
|
||||
{
|
||||
case eControlMethod.Com:
|
||||
comm = new ComPortController(deviceConfig.Key + "-com", GetComPort, controlConfig.ComParams, controlConfig);
|
||||
break;
|
||||
case eControlMethod.Cec:
|
||||
comm = new CecPortController(deviceConfig.Key + "-cec", GetCecPort, controlConfig);
|
||||
break;
|
||||
case eControlMethod.IR:
|
||||
break;
|
||||
case eControlMethod.Ssh:
|
||||
{
|
||||
var ssh = new GenericSshClient(deviceConfig.Key + "-ssh", c.Address, c.Port, c.Username, c.Password);
|
||||
ssh.AutoReconnect = c.AutoReconnect;
|
||||
if(ssh.AutoReconnect)
|
||||
ssh.AutoReconnectIntervalMs = c.AutoReconnectIntervalMs;
|
||||
comm = ssh;
|
||||
break;
|
||||
}
|
||||
case eControlMethod.Tcpip:
|
||||
{
|
||||
var tcp = new GenericTcpIpClient(deviceConfig.Key + "-tcp", c.Address, c.Port, c.BufferSize);
|
||||
tcp.AutoReconnect = c.AutoReconnect;
|
||||
if (tcp.AutoReconnect)
|
||||
tcp.AutoReconnectIntervalMs = c.AutoReconnectIntervalMs;
|
||||
comm = tcp;
|
||||
break;
|
||||
}
|
||||
case eControlMethod.Udp:
|
||||
{
|
||||
var udp = new GenericUdpServer(deviceConfig.Key + "-udp", c.Address, c.Port, c.BufferSize);
|
||||
comm = udp;
|
||||
break;
|
||||
}
|
||||
case eControlMethod.Telnet:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Console(0, "Cannot create communication from JSON:\r{0}\r\rException:\r{1}",
|
||||
deviceConfig.Properties.ToString(), e);
|
||||
}
|
||||
|
||||
// put it in the device manager if it's the right flavor
|
||||
var comDev = comm as Device;
|
||||
if (comDev != null)
|
||||
DeviceManager.AddDevice(comDev);
|
||||
return comm;
|
||||
}
|
||||
|
||||
public static ComPort GetComPort(EssentialsControlPropertiesConfig config)
|
||||
{
|
||||
var comPar = config.ComParams;
|
||||
var dev = GetIComPortsDeviceFromManagedDevice(config.ControlPortDevKey);
|
||||
if (dev != null && config.ControlPortNumber <= dev.NumberOfComPorts)
|
||||
return dev.ComPorts[config.ControlPortNumber];
|
||||
Debug.Console(0,Debug.ErrorLogLevel.Notice, "GetComPort: Device '{0}' does not have com port {1}", config.ControlPortDevKey, config.ControlPortNumber);
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets an ICec port from a RoutingInput or RoutingOutput on a device
|
||||
/// </summary>
|
||||
/// <param name="config"></param>
|
||||
/// <returns></returns>
|
||||
public static ICec GetCecPort(ControlPropertiesConfig config)
|
||||
{
|
||||
var dev = DeviceManager.GetDeviceForKey(config.ControlPortDevKey);
|
||||
|
||||
if (dev != null)
|
||||
@@ -147,64 +147,64 @@ namespace PepperDash.Essentials.Core
|
||||
Debug.Console(0, "GetCecPort: '{0}' - Configuration missing 'ControlPortName'", config.ControlPortDevKey);
|
||||
}
|
||||
}
|
||||
Debug.Console(0, "GetCecPort: Device '{0}' is not a valid device.", config.ControlPortDevKey);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper to grab the IComPorts device for this PortDeviceKey. Key "controlSystem" will
|
||||
/// return the ControlSystem object from the Global class.
|
||||
/// </summary>
|
||||
/// <returns>IComPorts device or null if the device is not found or does not implement IComPorts</returns>
|
||||
public static IComPorts GetIComPortsDeviceFromManagedDevice(string ComPortDevKey)
|
||||
{
|
||||
if ((ComPortDevKey.Equals("controlSystem", System.StringComparison.OrdinalIgnoreCase)
|
||||
|| ComPortDevKey.Equals("processor", System.StringComparison.OrdinalIgnoreCase))
|
||||
&& Global.ControlSystem is IComPorts)
|
||||
return Global.ControlSystem;
|
||||
else
|
||||
{
|
||||
var dev = DeviceManager.GetDeviceForKey(ComPortDevKey) as IComPorts;
|
||||
if (dev == null)
|
||||
Debug.Console(0, "ComPortConfig: Cannot find com port device '{0}'", ComPortDevKey);
|
||||
return dev;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class EssentialsControlPropertiesConfig :
|
||||
PepperDash.Core.ControlPropertiesConfig
|
||||
{
|
||||
|
||||
[JsonConverter(typeof(ComSpecJsonConverter))]
|
||||
public ComPort.ComPortSpec ComParams { get; set; }
|
||||
|
||||
public string CresnetId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to provide uint conversion of string CresnetId
|
||||
/// </summary>
|
||||
public uint CresnetIdInt
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
return Convert.ToUInt32(CresnetId, 16);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw new FormatException(string.Format("ERROR:Unable to convert Cresnet ID: {0} to hex. Error:\n{1}", CresnetId));
|
||||
}
|
||||
}
|
||||
Debug.Console(0, "GetCecPort: Device '{0}' is not a valid device.", config.ControlPortDevKey);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public string InfinetId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Helper to grab the IComPorts device for this PortDeviceKey. Key "controlSystem" will
|
||||
/// return the ControlSystem object from the Global class.
|
||||
/// </summary>
|
||||
/// <returns>IComPorts device or null if the device is not found or does not implement IComPorts</returns>
|
||||
public static IComPorts GetIComPortsDeviceFromManagedDevice(string ComPortDevKey)
|
||||
{
|
||||
if ((ComPortDevKey.Equals("controlSystem", System.StringComparison.OrdinalIgnoreCase)
|
||||
|| ComPortDevKey.Equals("processor", System.StringComparison.OrdinalIgnoreCase))
|
||||
&& Global.ControlSystem is IComPorts)
|
||||
return Global.ControlSystem;
|
||||
else
|
||||
{
|
||||
var dev = DeviceManager.GetDeviceForKey(ComPortDevKey) as IComPorts;
|
||||
if (dev == null)
|
||||
Debug.Console(0, "ComPortConfig: Cannot find com port device '{0}'", ComPortDevKey);
|
||||
return dev;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class EssentialsControlPropertiesConfig :
|
||||
PepperDash.Core.ControlPropertiesConfig
|
||||
{
|
||||
|
||||
[JsonConverter(typeof(ComSpecJsonConverter))]
|
||||
public ComPort.ComPortSpec ComParams { get; set; }
|
||||
|
||||
public string CresnetId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to provide uint conversion of string CresnetId
|
||||
/// </summary>
|
||||
public uint CresnetIdInt
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
return Convert.ToUInt32(CresnetId, 16);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw new FormatException(string.Format("ERROR:Unable to convert Cresnet ID: {0} to hex. Error:\n{1}", CresnetId));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string InfinetId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Attepmts to provide uiont conversion of string InifinetId
|
||||
/// </summary>
|
||||
@@ -221,13 +221,13 @@ namespace PepperDash.Essentials.Core
|
||||
throw new FormatException(string.Format("ERROR:Unable to conver Infinet ID: {0} to hex. Error:\n{1}", InfinetId));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class IrControlSpec
|
||||
{
|
||||
public string PortDeviceKey { get; set; }
|
||||
public uint PortNumber { get; set; }
|
||||
public string File { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class IrControlSpec
|
||||
{
|
||||
public string PortDeviceKey { get; set; }
|
||||
public uint PortNumber { get; set; }
|
||||
public string File { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,83 +1,83 @@
|
||||
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.Config;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static class IRPortHelper
|
||||
{
|
||||
public static string IrDriverPathPrefix
|
||||
{
|
||||
get
|
||||
{
|
||||
return Global.FilePathPrefix + "IR" + Global.DirectorySeparator;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Finds either the ControlSystem or a device controller that contains IR ports and
|
||||
/// returns a port from the hardware device
|
||||
/// </summary>
|
||||
/// <param name="propsToken"></param>
|
||||
/// <returns>IrPortConfig object. The port and or filename will be empty/null
|
||||
/// if valid values don't exist on config</returns>
|
||||
public static IrOutPortConfig GetIrPort(JToken propsToken)
|
||||
{
|
||||
var control = propsToken["control"];
|
||||
if (control == null)
|
||||
return null;
|
||||
if (control["method"].Value<string>() != "ir")
|
||||
{
|
||||
Debug.Console(0, "IRPortHelper called with non-IR properties");
|
||||
return null;
|
||||
}
|
||||
|
||||
var port = new IrOutPortConfig();
|
||||
|
||||
var portDevKey = control.Value<string>("controlPortDevKey");
|
||||
var portNum = control.Value<uint>("controlPortNumber");
|
||||
if (portDevKey == null || portNum == 0)
|
||||
{
|
||||
Debug.Console(1, "WARNING: Properties is missing port device or port number");
|
||||
return port;
|
||||
}
|
||||
|
||||
IIROutputPorts irDev = null;
|
||||
if (portDevKey.Equals("controlSystem", StringComparison.OrdinalIgnoreCase)
|
||||
|| portDevKey.Equals("processor", StringComparison.OrdinalIgnoreCase))
|
||||
irDev = Global.ControlSystem;
|
||||
else
|
||||
irDev = DeviceManager.GetDeviceForKey(portDevKey) as IIROutputPorts;
|
||||
|
||||
if (irDev == null)
|
||||
{
|
||||
Debug.Console(1, "[Config] Error, device with IR ports '{0}' not found", portDevKey);
|
||||
return port;
|
||||
}
|
||||
|
||||
if (portNum <= irDev.NumberOfIROutputPorts) // success!
|
||||
{
|
||||
var file = IrDriverPathPrefix + control["irFile"].Value<string>();
|
||||
port.Port = irDev.IROutputPorts[portNum];
|
||||
port.FileName = file;
|
||||
return port; // new IrOutPortConfig { Port = irDev.IROutputPorts[portNum], FileName = file };
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(1, "[Config] Error, device '{0}' IR port {1} out of range",
|
||||
portDevKey, portNum);
|
||||
return port;
|
||||
}
|
||||
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.Config;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static class IRPortHelper
|
||||
{
|
||||
public static string IrDriverPathPrefix
|
||||
{
|
||||
get
|
||||
{
|
||||
return Global.FilePathPrefix + "IR" + Global.DirectorySeparator;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Finds either the ControlSystem or a device controller that contains IR ports and
|
||||
/// returns a port from the hardware device
|
||||
/// </summary>
|
||||
/// <param name="propsToken"></param>
|
||||
/// <returns>IrPortConfig object. The port and or filename will be empty/null
|
||||
/// if valid values don't exist on config</returns>
|
||||
public static IrOutPortConfig GetIrPort(JToken propsToken)
|
||||
{
|
||||
var control = propsToken["control"];
|
||||
if (control == null)
|
||||
return null;
|
||||
if (control["method"].Value<string>() != "ir")
|
||||
{
|
||||
Debug.Console(0, "IRPortHelper called with non-IR properties");
|
||||
return null;
|
||||
}
|
||||
|
||||
var port = new IrOutPortConfig();
|
||||
|
||||
var portDevKey = control.Value<string>("controlPortDevKey");
|
||||
var portNum = control.Value<uint>("controlPortNumber");
|
||||
if (portDevKey == null || portNum == 0)
|
||||
{
|
||||
Debug.Console(1, "WARNING: Properties is missing port device or port number");
|
||||
return port;
|
||||
}
|
||||
|
||||
IIROutputPorts irDev = null;
|
||||
if (portDevKey.Equals("controlSystem", StringComparison.OrdinalIgnoreCase)
|
||||
|| portDevKey.Equals("processor", StringComparison.OrdinalIgnoreCase))
|
||||
irDev = Global.ControlSystem;
|
||||
else
|
||||
irDev = DeviceManager.GetDeviceForKey(portDevKey) as IIROutputPorts;
|
||||
|
||||
if (irDev == null)
|
||||
{
|
||||
Debug.Console(1, "[Config] Error, device with IR ports '{0}' not found", portDevKey);
|
||||
return port;
|
||||
}
|
||||
|
||||
if (portNum <= irDev.NumberOfIROutputPorts) // success!
|
||||
{
|
||||
var file = IrDriverPathPrefix + control["irFile"].Value<string>();
|
||||
port.Port = irDev.IROutputPorts[portNum];
|
||||
port.FileName = file;
|
||||
return port; // new IrOutPortConfig { Port = irDev.IROutputPorts[portNum], FileName = file };
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(1, "[Config] Error, device '{0}' IR port {1} out of range",
|
||||
portDevKey, portNum);
|
||||
return port;
|
||||
}
|
||||
}
|
||||
|
||||
public static IROutputPort GetIrOutputPort(DeviceConfig dc)
|
||||
@@ -124,7 +124,7 @@ namespace PepperDash.Essentials.Core
|
||||
Debug.Console(0, "WARNING: device with IR ports '{0}' not found", portDevKey);
|
||||
return null;
|
||||
}
|
||||
if (portNum >= irDev.NumberOfIROutputPorts)
|
||||
if (portNum > irDev.NumberOfIROutputPorts)
|
||||
{
|
||||
Debug.Console(0, "WARNING: device '{0}' IR port {1} out of range",
|
||||
portDevKey, portNum);
|
||||
@@ -134,10 +134,9 @@ namespace PepperDash.Essentials.Core
|
||||
|
||||
var port = irDev.IROutputPorts[portNum];
|
||||
|
||||
port.LoadIRDriver(Global.FilePathPrefix + "IR" + Global.DirectorySeparator + control["irFile"].Value<string>());
|
||||
|
||||
|
||||
return port;
|
||||
|
||||
}
|
||||
|
||||
public static IrOutputPortController GetIrOutputPortController(DeviceConfig config)
|
||||
@@ -149,87 +148,88 @@ namespace PepperDash.Essentials.Core
|
||||
return null;
|
||||
}
|
||||
|
||||
var irDevice = new IrOutputPortController(config.Key, GetIrOutputPort, config);
|
||||
var postActivationFunc = new Func<DeviceConfig,IROutputPort> (GetIrOutputPort);
|
||||
var irDevice = new IrOutputPortController(config.Key + "-ir", postActivationFunc, config);
|
||||
|
||||
return irDevice;
|
||||
}
|
||||
|
||||
/*
|
||||
/// <summary>
|
||||
/// Returns a ready-to-go IrOutputPortController from a DeviceConfig object.
|
||||
/// </summary>
|
||||
public static IrOutputPortController GetIrOutputPortController(DeviceConfig devConf)
|
||||
{
|
||||
var irControllerKey = devConf.Key + "-ir";
|
||||
if (devConf.Properties == null)
|
||||
{
|
||||
Debug.Console(0, "[{0}] WARNING: Device config does not include properties. IR will not function.", devConf.Key);
|
||||
return new IrOutputPortController(irControllerKey, null, "");
|
||||
}
|
||||
|
||||
var control = devConf.Properties["control"];
|
||||
if (control == null)
|
||||
{
|
||||
var c = new IrOutputPortController(irControllerKey, null, "");
|
||||
Debug.Console(0, c, "WARNING: Device config does not include control properties. IR will not function");
|
||||
return c;
|
||||
}
|
||||
|
||||
var portDevKey = control.Value<string>("controlPortDevKey");
|
||||
var portNum = control.Value<uint>("controlPortNumber");
|
||||
IIROutputPorts irDev = null;
|
||||
|
||||
if (portDevKey == null)
|
||||
{
|
||||
var c = new IrOutputPortController(irControllerKey, null, "");
|
||||
Debug.Console(0, c, "WARNING: control properties is missing ir device");
|
||||
return c;
|
||||
}
|
||||
|
||||
if (portNum == 0)
|
||||
{
|
||||
var c = new IrOutputPortController(irControllerKey, null, "");
|
||||
Debug.Console(0, c, "WARNING: control properties is missing ir port number");
|
||||
return c;
|
||||
}
|
||||
|
||||
if (portDevKey.Equals("controlSystem", StringComparison.OrdinalIgnoreCase)
|
||||
|| portDevKey.Equals("processor", StringComparison.OrdinalIgnoreCase))
|
||||
irDev = Global.ControlSystem;
|
||||
else
|
||||
irDev = DeviceManager.GetDeviceForKey(portDevKey) as IIROutputPorts;
|
||||
|
||||
if (irDev == null)
|
||||
{
|
||||
var c = new IrOutputPortController(irControllerKey, null, "");
|
||||
Debug.Console(0, c, "WARNING: device with IR ports '{0}' not found", portDevKey);
|
||||
return c;
|
||||
}
|
||||
|
||||
if (portNum <= irDev.NumberOfIROutputPorts) // success!
|
||||
return new IrOutputPortController(irControllerKey, irDev.IROutputPorts[portNum],
|
||||
IrDriverPathPrefix + control["irFile"].Value<string>());
|
||||
else
|
||||
{
|
||||
var c = new IrOutputPortController(irControllerKey, null, "");
|
||||
Debug.Console(0, c, "WARNING: device '{0}' IR port {1} out of range",
|
||||
portDevKey, portNum);
|
||||
return c;
|
||||
}
|
||||
/*
|
||||
/// <summary>
|
||||
/// Returns a ready-to-go IrOutputPortController from a DeviceConfig object.
|
||||
/// </summary>
|
||||
public static IrOutputPortController GetIrOutputPortController(DeviceConfig devConf)
|
||||
{
|
||||
var irControllerKey = devConf.Key + "-ir";
|
||||
if (devConf.Properties == null)
|
||||
{
|
||||
Debug.Console(0, "[{0}] WARNING: Device config does not include properties. IR will not function.", devConf.Key);
|
||||
return new IrOutputPortController(irControllerKey, null, "");
|
||||
}
|
||||
|
||||
var control = devConf.Properties["control"];
|
||||
if (control == null)
|
||||
{
|
||||
var c = new IrOutputPortController(irControllerKey, null, "");
|
||||
Debug.Console(0, c, "WARNING: Device config does not include control properties. IR will not function");
|
||||
return c;
|
||||
}
|
||||
|
||||
var portDevKey = control.Value<string>("controlPortDevKey");
|
||||
var portNum = control.Value<uint>("controlPortNumber");
|
||||
IIROutputPorts irDev = null;
|
||||
|
||||
if (portDevKey == null)
|
||||
{
|
||||
var c = new IrOutputPortController(irControllerKey, null, "");
|
||||
Debug.Console(0, c, "WARNING: control properties is missing ir device");
|
||||
return c;
|
||||
}
|
||||
|
||||
if (portNum == 0)
|
||||
{
|
||||
var c = new IrOutputPortController(irControllerKey, null, "");
|
||||
Debug.Console(0, c, "WARNING: control properties is missing ir port number");
|
||||
return c;
|
||||
}
|
||||
|
||||
if (portDevKey.Equals("controlSystem", StringComparison.OrdinalIgnoreCase)
|
||||
|| portDevKey.Equals("processor", StringComparison.OrdinalIgnoreCase))
|
||||
irDev = Global.ControlSystem;
|
||||
else
|
||||
irDev = DeviceManager.GetDeviceForKey(portDevKey) as IIROutputPorts;
|
||||
|
||||
if (irDev == null)
|
||||
{
|
||||
var c = new IrOutputPortController(irControllerKey, null, "");
|
||||
Debug.Console(0, c, "WARNING: device with IR ports '{0}' not found", portDevKey);
|
||||
return c;
|
||||
}
|
||||
|
||||
if (portNum <= irDev.NumberOfIROutputPorts) // success!
|
||||
return new IrOutputPortController(irControllerKey, irDev.IROutputPorts[portNum],
|
||||
IrDriverPathPrefix + control["irFile"].Value<string>());
|
||||
else
|
||||
{
|
||||
var c = new IrOutputPortController(irControllerKey, null, "");
|
||||
Debug.Console(0, c, "WARNING: device '{0}' IR port {1} out of range",
|
||||
portDevKey, portNum);
|
||||
return c;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wrapper to help in IR port creation
|
||||
/// </summary>
|
||||
public class IrOutPortConfig
|
||||
{
|
||||
public IROutputPort Port { get; set; }
|
||||
public string FileName { get; set; }
|
||||
|
||||
public IrOutPortConfig()
|
||||
{
|
||||
FileName = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wrapper to help in IR port creation
|
||||
/// </summary>
|
||||
public class IrOutPortConfig
|
||||
{
|
||||
public IROutputPort Port { get; set; }
|
||||
public string FileName { get; set; }
|
||||
|
||||
public IrOutPortConfig()
|
||||
{
|
||||
FileName = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,8 @@ using Newtonsoft.Json;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Config
|
||||
{
|
||||
/// <summary>
|
||||
@@ -27,7 +29,7 @@ namespace PepperDash.Essentials.Core.Config
|
||||
public List<TieLineConfig> TieLines { get; set; }
|
||||
|
||||
[JsonProperty("joinMaps")]
|
||||
public Dictionary<string, string> JoinMaps { get; set; }
|
||||
public Dictionary<string, JObject> JoinMaps { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Checks SourceLists for a given list and returns it if found. Otherwise, returns null
|
||||
|
||||
@@ -1,183 +1,254 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharp.CrestronIO;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Core.Config;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Config
|
||||
{
|
||||
/// <summary>
|
||||
/// Loads the ConfigObject from the file
|
||||
/// </summary>
|
||||
public class ConfigReader
|
||||
{
|
||||
public static EssentialsConfig ConfigObject { get; private set; }
|
||||
|
||||
public static bool LoadConfig2()
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Loading unmerged system/template portal configuration file.");
|
||||
try
|
||||
{
|
||||
// Check for local config file first
|
||||
var filePath = Global.FilePathPrefix + ConfigWriter.LocalConfigFolder + Global.DirectorySeparator + Global.ConfigFileName;
|
||||
|
||||
bool localConfigFound = false;
|
||||
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to load Local config file: '{0}'", filePath);
|
||||
|
||||
// Check for local config directory first
|
||||
|
||||
var configFiles = GetConfigFiles(filePath);
|
||||
|
||||
if (configFiles != null)
|
||||
{
|
||||
if (configFiles.Length > 1)
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Error,
|
||||
"****Error: Multiple Local Configuration files present. Please ensure only a single file exists and reset program.****");
|
||||
return false;
|
||||
}
|
||||
else if(configFiles.Length == 1)
|
||||
{
|
||||
localConfigFound = true;
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Found Local config file: '{0}'", filePath);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice,
|
||||
"Local Configuration file not present.", filePath);
|
||||
|
||||
}
|
||||
|
||||
// Check for Portal Config
|
||||
if(!localConfigFound)
|
||||
{
|
||||
filePath = Global.FilePathPrefix + Global.ConfigFileName;
|
||||
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to load Portal config file: '{0}'", filePath);
|
||||
|
||||
configFiles = GetConfigFiles(filePath);
|
||||
|
||||
if (configFiles != null)
|
||||
{
|
||||
Debug.Console(2, "{0} config files found matching pattern", configFiles.Length);
|
||||
|
||||
if (configFiles.Length > 1)
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Error,
|
||||
"****Error: Multiple Portal Configuration files present. Please ensure only a single file exists and reset program.****");
|
||||
return false;
|
||||
}
|
||||
else if (configFiles.Length == 1)
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Found Portal config file: '{0}'", filePath);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "No config file found.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Error,
|
||||
"ERROR: Portal Configuration file not present. Please load file and reset program.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Get the actual file path
|
||||
filePath = configFiles[0].FullName;
|
||||
|
||||
// Read the file
|
||||
using (StreamReader fs = new StreamReader(filePath))
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Loading config file: '{0}'", filePath);
|
||||
|
||||
if (localConfigFound)
|
||||
{
|
||||
ConfigObject = JObject.Parse(fs.ReadToEnd()).ToObject<EssentialsConfig>();
|
||||
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Successfully Loaded Local Config");
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
var doubleObj = JObject.Parse(fs.ReadToEnd());
|
||||
ConfigObject = PortalConfigReader.MergeConfigs(doubleObj).ToObject<EssentialsConfig>();
|
||||
|
||||
// Extract SystemUrl and TemplateUrl into final config output
|
||||
|
||||
if (doubleObj["system_url"] != null)
|
||||
{
|
||||
ConfigObject.SystemUrl = doubleObj["system_url"].Value<string>();
|
||||
}
|
||||
|
||||
if (doubleObj["template_url"] != null)
|
||||
{
|
||||
ConfigObject.TemplateUrl = doubleObj["template_url"].Value<string>();
|
||||
}
|
||||
}
|
||||
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Successfully Loaded Merged Config");
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Error, "ERROR: Config load failed: \r{0}", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns all the files from the directory specified.
|
||||
/// </summary>
|
||||
/// <param name="filePath"></param>
|
||||
/// <returns></returns>
|
||||
public static FileInfo[] GetConfigFiles(string filePath)
|
||||
{
|
||||
// Get the directory
|
||||
var dir = Path.GetDirectoryName(filePath);
|
||||
|
||||
if (Directory.Exists(dir))
|
||||
{
|
||||
Debug.Console(1, "Searching in Directory '{0}'", dir);
|
||||
// Get the directory info
|
||||
var dirInfo = new DirectoryInfo(dir);
|
||||
|
||||
// Get the file name
|
||||
var fileName = Path.GetFileName(filePath);
|
||||
Debug.Console(1, "For Config Files matching: '{0}'", fileName);
|
||||
|
||||
// Get the files that match from the directory
|
||||
return dirInfo.GetFiles(fileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice,
|
||||
"Directory not found: ", dir);
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the group for a given device key in config
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetGroupForDeviceKey(string key)
|
||||
{
|
||||
var dev = ConfigObject.Devices.FirstOrDefault(d => d.Key.Equals(key, StringComparison.OrdinalIgnoreCase));
|
||||
return dev == null ? null : dev.Group;
|
||||
}
|
||||
|
||||
}
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharp.CrestronIO;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Core.Config;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Config
|
||||
{
|
||||
/// <summary>
|
||||
/// Loads the ConfigObject from the file
|
||||
/// </summary>
|
||||
public class ConfigReader
|
||||
{
|
||||
public const string LocalConfigPresent =
|
||||
@"
|
||||
***************************************************
|
||||
************* Using Local config file *************
|
||||
***************************************************";
|
||||
|
||||
public static EssentialsConfig ConfigObject { get; private set; }
|
||||
|
||||
public static bool LoadConfig2()
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Loading unmerged system/template portal configuration file.");
|
||||
try
|
||||
{
|
||||
// Check for local config file first
|
||||
var filePath = Global.FilePathPrefix + ConfigWriter.LocalConfigFolder + Global.DirectorySeparator + Global.ConfigFileName;
|
||||
|
||||
bool localConfigFound = false;
|
||||
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to load Local config file: '{0}'", filePath);
|
||||
|
||||
// Check for local config directory first
|
||||
|
||||
var configFiles = GetConfigFiles(filePath);
|
||||
|
||||
if (configFiles != null)
|
||||
{
|
||||
if (configFiles.Length > 1)
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Error,
|
||||
"****Error: Multiple Local Configuration files present. Please ensure only a single file exists and reset program.****");
|
||||
return false;
|
||||
}
|
||||
if(configFiles.Length == 1)
|
||||
{
|
||||
localConfigFound = true;
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice,
|
||||
"Local Configuration file not present.", filePath);
|
||||
|
||||
}
|
||||
|
||||
// Check for Portal Config
|
||||
if(!localConfigFound)
|
||||
{
|
||||
filePath = Global.FilePathPrefix + Global.ConfigFileName;
|
||||
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to load Portal config file: '{0}'", filePath);
|
||||
|
||||
configFiles = GetConfigFiles(filePath);
|
||||
|
||||
if (configFiles != null)
|
||||
{
|
||||
Debug.Console(2, "{0} config files found matching pattern", configFiles.Length);
|
||||
|
||||
if (configFiles.Length > 1)
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Error,
|
||||
"****Error: Multiple Portal Configuration files present. Please ensure only a single file exists and reset program.****");
|
||||
return false;
|
||||
}
|
||||
else if (configFiles.Length == 1)
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Found Portal config file: '{0}'", filePath);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "No config file found.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Error,
|
||||
"ERROR: Portal Configuration file not present. Please load file and reset program.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Get the actual file path
|
||||
filePath = configFiles[0].FullName;
|
||||
|
||||
// Generate debug statement if using a local file.
|
||||
if (localConfigFound)
|
||||
{
|
||||
GetLocalFileMessage(filePath);
|
||||
}
|
||||
|
||||
// Read the file
|
||||
using (StreamReader fs = new StreamReader(filePath))
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Loading config file: '{0}'", filePath);
|
||||
|
||||
if (localConfigFound)
|
||||
{
|
||||
ConfigObject = JObject.Parse(fs.ReadToEnd()).ToObject<EssentialsConfig>();
|
||||
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Successfully Loaded Local Config");
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
var doubleObj = JObject.Parse(fs.ReadToEnd());
|
||||
ConfigObject = PortalConfigReader.MergeConfigs(doubleObj).ToObject<EssentialsConfig>();
|
||||
|
||||
// Extract SystemUrl and TemplateUrl into final config output
|
||||
|
||||
if (doubleObj["system_url"] != null)
|
||||
{
|
||||
ConfigObject.SystemUrl = doubleObj["system_url"].Value<string>();
|
||||
}
|
||||
|
||||
if (doubleObj["template_url"] != null)
|
||||
{
|
||||
ConfigObject.TemplateUrl = doubleObj["template_url"].Value<string>();
|
||||
}
|
||||
}
|
||||
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Successfully Loaded Merged Config");
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Error, "ERROR: Config load failed: \r{0}", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns all the files from the directory specified.
|
||||
/// </summary>
|
||||
/// <param name="filePath"></param>
|
||||
/// <returns></returns>
|
||||
public static FileInfo[] GetConfigFiles(string filePath)
|
||||
{
|
||||
// Get the directory
|
||||
var dir = Path.GetDirectoryName(filePath);
|
||||
|
||||
if (Directory.Exists(dir))
|
||||
{
|
||||
Debug.Console(1, "Searching in Directory '{0}'", dir);
|
||||
// Get the directory info
|
||||
var dirInfo = new DirectoryInfo(dir);
|
||||
|
||||
// Get the file name
|
||||
var fileName = Path.GetFileName(filePath);
|
||||
Debug.Console(1, "For Config Files matching: '{0}'", fileName);
|
||||
|
||||
// Get the files that match from the directory
|
||||
return dirInfo.GetFiles(fileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice,
|
||||
"Directory not found: ", dir);
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the group for a given device key in config
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetGroupForDeviceKey(string key)
|
||||
{
|
||||
var dev = ConfigObject.Devices.FirstOrDefault(d => d.Key.Equals(key, StringComparison.OrdinalIgnoreCase));
|
||||
return dev == null ? null : dev.Group;
|
||||
}
|
||||
|
||||
private static void GetLocalFileMessage(string filePath)
|
||||
{
|
||||
var filePathLength = filePath.Length + 2;
|
||||
var debugStringWidth = filePathLength + 12;
|
||||
|
||||
if (debugStringWidth < 51)
|
||||
{
|
||||
debugStringWidth = 51;
|
||||
}
|
||||
var qualifier = (filePathLength % 2 != 0)
|
||||
? " Using Local Config File "
|
||||
: " Using Local Config File ";
|
||||
var bookend1 = (debugStringWidth - qualifier.Length) / 2;
|
||||
var bookend2 = (debugStringWidth - filePathLength) / 2;
|
||||
|
||||
|
||||
var newDebugString = new StringBuilder()
|
||||
.Append(CrestronEnvironment.NewLine)
|
||||
// Line 1
|
||||
.Append(new string('*', debugStringWidth))
|
||||
.Append(CrestronEnvironment.NewLine)
|
||||
// Line 2
|
||||
.Append(new string('*', debugStringWidth))
|
||||
.Append(CrestronEnvironment.NewLine)
|
||||
// Line 3
|
||||
.Append(new string('*', 2))
|
||||
.Append(new string(' ', debugStringWidth - 4))
|
||||
.Append(new string('*', 2))
|
||||
.Append(CrestronEnvironment.NewLine)
|
||||
// Line 4
|
||||
.Append(new string('*', 2))
|
||||
.Append(new string(' ', bookend1 - 2))
|
||||
.Append(qualifier)
|
||||
.Append(new string(' ', bookend1 - 2))
|
||||
.Append(new string('*', 2))
|
||||
.Append(CrestronEnvironment.NewLine)
|
||||
// Line 5
|
||||
.Append(new string('*', 2))
|
||||
.Append(new string(' ', bookend2 - 2))
|
||||
.Append(" " + filePath + " ")
|
||||
.Append(new string(' ', bookend2 - 2))
|
||||
.Append(new string('*', 2))
|
||||
.Append(CrestronEnvironment.NewLine)
|
||||
// Line 6
|
||||
.Append(new string('*', 2))
|
||||
.Append(new string(' ', debugStringWidth - 4))
|
||||
.Append(new string('*', 2))
|
||||
.Append(CrestronEnvironment.NewLine)
|
||||
// Line 7
|
||||
.Append(new string('*', debugStringWidth))
|
||||
.Append(CrestronEnvironment.NewLine)
|
||||
// Line 8
|
||||
.Append(new string('*', debugStringWidth));
|
||||
|
||||
Debug.Console(2, Debug.ErrorLogLevel.Notice, "Found Local config file: '{0}'", filePath);
|
||||
Debug.Console(0, newDebugString.ToString());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
using System;
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharp.Reflection;
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace PepperDash.Essentials.Core.Config
|
||||
// }
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// <summary>,
|
||||
/// The OS Version of the processor (Firmware Version)
|
||||
/// </summary>
|
||||
[JsonProperty("osVersion")]
|
||||
@@ -92,5 +92,18 @@ namespace PepperDash.Essentials.Core.Config
|
||||
// return Crestron.SimplSharp.CrestronEnvironment.OSVersion.Firmware;
|
||||
// }
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// The information gathered by the processor at runtime about it's NICs and their IP addresses.
|
||||
/// </summary>
|
||||
[JsonProperty("ipInfo")]
|
||||
public Dictionary<short, EthernetAdapterInfo> IpInfo
|
||||
{
|
||||
get
|
||||
{
|
||||
return Global.EthernetAdapterInfoCollection;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -73,21 +73,21 @@ namespace PepperDash.Essentials.Core.CrestronIO.Cards
|
||||
string cardType;
|
||||
if (!_config.Cards.TryGetValue(i, out cardType))
|
||||
{
|
||||
Debug.Console(1, this, "No card found for slot {0}", i);
|
||||
Debug.Console(0, this, "No card found for slot {0}", i);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (String.IsNullOrEmpty(cardType))
|
||||
{
|
||||
Debug.Console(0, this, "No card specified for slot {0}", i);
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
|
||||
Func<uint, C3CardControllerBase> cardBuilder;
|
||||
if (!_cardDict.TryGetValue(cardType.ToLower(), out cardBuilder))
|
||||
{
|
||||
Debug.Console(0, "Unable to find factory for 3-Series card type {0}.", cardType);
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
|
||||
try
|
||||
|
||||
@@ -1,38 +1,39 @@
|
||||
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.Bridges;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.Core.CrestronIO
|
||||
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.Bridges;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.Core.CrestronIO
|
||||
{
|
||||
[Description("Wrapper class for Digital Input")]
|
||||
public class GenericDigitalInputDevice : EssentialsBridgeableDevice, IDigitalInput
|
||||
{
|
||||
public DigitalInput InputPort { get; private set; }
|
||||
|
||||
public BoolFeedback InputStateFeedback { get; private set; }
|
||||
|
||||
Func<bool> InputStateFeedbackFunc
|
||||
{
|
||||
get
|
||||
{
|
||||
return () => InputPort.State;
|
||||
}
|
||||
}
|
||||
public class GenericDigitalInputDevice : EssentialsBridgeableDevice, IDigitalInput
|
||||
{
|
||||
public DigitalInput InputPort { get; private set; }
|
||||
|
||||
public BoolFeedback InputStateFeedback { get; private set; }
|
||||
|
||||
Func<bool> InputStateFeedbackFunc
|
||||
{
|
||||
get
|
||||
{
|
||||
return () => InputPort.State;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public GenericDigitalInputDevice(string key, string name, Func<IOPortConfig, DigitalInput> postActivationFunc,
|
||||
IOPortConfig config)
|
||||
: base(key, name)
|
||||
{
|
||||
InputStateFeedback = new BoolFeedback(InputStateFeedbackFunc);
|
||||
|
||||
AddPostActivationAction(() =>
|
||||
{
|
||||
@@ -40,15 +41,15 @@ namespace PepperDash.Essentials.Core.CrestronIO
|
||||
|
||||
InputPort.Register();
|
||||
|
||||
InputPort.StateChange += InputPort_StateChange;
|
||||
InputPort.StateChange += InputPort_StateChange;
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
#region Events
|
||||
|
||||
void InputPort_StateChange(DigitalInput digitalInput, DigitalInputEventArgs args)
|
||||
{
|
||||
void InputPort_StateChange(DigitalInput digitalInput, DigitalInputEventArgs args)
|
||||
{
|
||||
InputStateFeedback.FireUpdate();
|
||||
}
|
||||
|
||||
@@ -81,7 +82,7 @@ namespace PepperDash.Essentials.Core.CrestronIO
|
||||
}
|
||||
if (ioPortDevice == null)
|
||||
{
|
||||
Debug.Console(0, "GetDigitalInput: Device '0' is not a valid IRelayPorts Device", dc.PortDeviceKey);
|
||||
Debug.Console(0, "GetDigitalInput: Device '0' is not a valid IDigitalInputPorts Device", dc.PortDeviceKey);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -99,13 +100,13 @@ namespace PepperDash.Essentials.Core.CrestronIO
|
||||
|
||||
#region Bridge Linking
|
||||
|
||||
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
|
||||
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
|
||||
{
|
||||
var joinMap = new IDigitalInputJoinMap(joinStart);
|
||||
|
||||
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
|
||||
|
||||
if (!string.IsNullOrEmpty(joinMapSerialized))
|
||||
var joinMap = new IDigitalInputJoinMap(joinStart);
|
||||
|
||||
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
|
||||
|
||||
if (!string.IsNullOrEmpty(joinMapSerialized))
|
||||
joinMap = JsonConvert.DeserializeObject<IDigitalInputJoinMap>(joinMapSerialized);
|
||||
|
||||
if (bridge != null)
|
||||
@@ -115,19 +116,19 @@ namespace PepperDash.Essentials.Core.CrestronIO
|
||||
else
|
||||
{
|
||||
Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||
|
||||
// Link feedback for input state
|
||||
InputStateFeedback.LinkInputSig(trilist.BooleanInput[joinMap.InputState.JoinNumber]);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Console(1, this, "Unable to link device '{0}'. Input is null", Key);
|
||||
Debug.Console(1, this, "Error: {0}", e);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||
|
||||
// Link feedback for input state
|
||||
InputStateFeedback.LinkInputSig(trilist.BooleanInput[joinMap.InputState.JoinNumber]);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Console(1, this, "Unable to link device '{0}'. Input is null", Key);
|
||||
Debug.Console(1, this, "Error: {0}", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,7 +145,7 @@ namespace PepperDash.Essentials.Core.CrestronIO
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new Generic Relay Device");
|
||||
Debug.Console(1, "Factory Attempting to create new Generic Digital Input Device");
|
||||
|
||||
var props = JsonConvert.DeserializeObject<IOPortConfig>(dc.Properties.ToString());
|
||||
|
||||
@@ -158,7 +159,7 @@ namespace PepperDash.Essentials.Core.CrestronIO
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -4,15 +4,21 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.Core.Bridges;
|
||||
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace PepperDash.Essentials.Core.CrestronIO
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a generic digital input deviced tied to a versiport
|
||||
/// </summary>
|
||||
public class GenericVersiportDigitalInputDevice : EssentialsDevice, IDigitalInput
|
||||
public class GenericVersiportDigitalInputDevice : EssentialsBridgeableDevice, IDigitalInput
|
||||
{
|
||||
public Versiport InputPort { get; private set; }
|
||||
|
||||
@@ -26,17 +32,29 @@ namespace PepperDash.Essentials.Core.CrestronIO
|
||||
}
|
||||
}
|
||||
|
||||
public GenericVersiportDigitalInputDevice(string key, Versiport inputPort, IOPortConfig props):
|
||||
base(key)
|
||||
public GenericVersiportDigitalInputDevice(string key, string name, Func<IOPortConfig, Versiport> postActivationFunc, IOPortConfig config) :
|
||||
base(key, name)
|
||||
{
|
||||
InputStateFeedback = new BoolFeedback(InputStateFeedbackFunc);
|
||||
InputPort = inputPort;
|
||||
InputPort.SetVersiportConfiguration(eVersiportConfiguration.DigitalInput);
|
||||
if (props.DisablePullUpResistor)
|
||||
InputPort.DisablePullUpResistor = true;
|
||||
InputPort.VersiportChange += new VersiportEventHandler(InputPort_VersiportChange);
|
||||
|
||||
Debug.Console(1, this, "Created GenericVersiportDigitalInputDevice on port '{0}'. DisablePullUpResistor: '{1}'", props.PortNumber, InputPort.DisablePullUpResistor);
|
||||
AddPostActivationAction(() =>
|
||||
{
|
||||
InputPort = postActivationFunc(config);
|
||||
|
||||
InputPort.Register();
|
||||
|
||||
InputPort.SetVersiportConfiguration(eVersiportConfiguration.DigitalInput);
|
||||
if (config.DisablePullUpResistor)
|
||||
InputPort.DisablePullUpResistor = true;
|
||||
|
||||
InputPort.VersiportChange += InputPort_VersiportChange;
|
||||
|
||||
|
||||
|
||||
Debug.Console(1, this, "Created GenericVersiportDigitalInputDevice on port '{0}'. DisablePullUpResistor: '{1}'", config.PortNumber, InputPort.DisablePullUpResistor);
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
void InputPort_VersiportChange(Versiport port, VersiportEventArgs args)
|
||||
@@ -46,5 +64,105 @@ namespace PepperDash.Essentials.Core.CrestronIO
|
||||
if(args.Event == eVersiportEvent.DigitalInChange)
|
||||
InputStateFeedback.FireUpdate();
|
||||
}
|
||||
|
||||
|
||||
#region Bridge Linking
|
||||
|
||||
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
|
||||
{
|
||||
var joinMap = new IDigitalInputJoinMap(joinStart);
|
||||
|
||||
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
|
||||
|
||||
if (!string.IsNullOrEmpty(joinMapSerialized))
|
||||
joinMap = JsonConvert.DeserializeObject<IDigitalInputJoinMap>(joinMapSerialized);
|
||||
|
||||
if (bridge != null)
|
||||
{
|
||||
bridge.AddJoinMap(Key, joinMap);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||
|
||||
// Link feedback for input state
|
||||
InputStateFeedback.LinkInputSig(trilist.BooleanInput[joinMap.InputState.JoinNumber]);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Console(1, this, "Unable to link device '{0}'. Input is null", Key);
|
||||
Debug.Console(1, this, "Error: {0}", e);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
public static Versiport GetVersiportDigitalInput(IOPortConfig dc)
|
||||
{
|
||||
|
||||
IIOPorts ioPortDevice;
|
||||
|
||||
if (dc.PortDeviceKey.Equals("processor"))
|
||||
{
|
||||
if (!Global.ControlSystem.SupportsVersiport)
|
||||
{
|
||||
Debug.Console(0, "GetVersiportDigitalInput: Processor does not support Versiports");
|
||||
return null;
|
||||
}
|
||||
ioPortDevice = Global.ControlSystem;
|
||||
}
|
||||
else
|
||||
{
|
||||
var ioPortDev = DeviceManager.GetDeviceForKey(dc.PortDeviceKey) as IIOPorts;
|
||||
if (ioPortDev == null)
|
||||
{
|
||||
Debug.Console(0, "GetVersiportDigitalInput: Device {0} is not a valid device", dc.PortDeviceKey);
|
||||
return null;
|
||||
}
|
||||
ioPortDevice = ioPortDev;
|
||||
}
|
||||
if (ioPortDevice == null)
|
||||
{
|
||||
Debug.Console(0, "GetVersiportDigitalInput: Device '0' is not a valid IIOPorts Device", dc.PortDeviceKey);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (dc.PortNumber > ioPortDevice.NumberOfVersiPorts)
|
||||
{
|
||||
Debug.Console(0, "GetVersiportDigitalInput: Device {0} does not contain a port {1}", dc.PortDeviceKey, dc.PortNumber);
|
||||
}
|
||||
|
||||
return ioPortDevice.VersiPorts[dc.PortNumber];
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class GenericVersiportDigitalInputDeviceFactory : EssentialsDeviceFactory<GenericVersiportDigitalInputDevice>
|
||||
{
|
||||
public GenericVersiportDigitalInputDeviceFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "versiportinput" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new Generic Versiport Device");
|
||||
|
||||
var props = JsonConvert.DeserializeObject<IOPortConfig>(dc.Properties.ToString());
|
||||
|
||||
if (props == null) return null;
|
||||
|
||||
var portDevice = new GenericVersiportDigitalInputDevice(dc.Key, dc.Name, GenericVersiportDigitalInputDevice.GetVersiportDigitalInput, props);
|
||||
|
||||
return portDevice;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,25 +1,25 @@
|
||||
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.Bridges;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
|
||||
namespace PepperDash.Essentials.Core.CrestronIO
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a generic device controlled by relays
|
||||
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.Bridges;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
|
||||
namespace PepperDash.Essentials.Core.CrestronIO
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a generic device controlled by relays
|
||||
/// </summary>
|
||||
[Description("Wrapper class for a Relay")]
|
||||
public class GenericRelayDevice : EssentialsBridgeableDevice, ISwitchedOutput
|
||||
{
|
||||
public Relay RelayOutput { get; private set; }
|
||||
|
||||
public class GenericRelayDevice : EssentialsBridgeableDevice, ISwitchedOutput
|
||||
{
|
||||
public Relay RelayOutput { get; private set; }
|
||||
|
||||
public BoolFeedback OutputIsOnFeedback { get; private set; }
|
||||
|
||||
//Maintained for compatibility with PepperDash.Essentials.Core.Devices.CrestronProcessor
|
||||
@@ -94,11 +94,11 @@ namespace PepperDash.Essentials.Core.CrestronIO
|
||||
|
||||
#region Events
|
||||
|
||||
void RelayOutput_StateChange(Relay relay, RelayEventArgs args)
|
||||
{
|
||||
void RelayOutput_StateChange(Relay relay, RelayEventArgs args)
|
||||
{
|
||||
OutputIsOnFeedback.FireUpdate();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
@@ -119,33 +119,33 @@ namespace PepperDash.Essentials.Core.CrestronIO
|
||||
OpenRelay();
|
||||
else
|
||||
CloseRelay();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ISwitchedOutput Members
|
||||
|
||||
void ISwitchedOutput.On()
|
||||
{
|
||||
CloseRelay();
|
||||
}
|
||||
|
||||
void ISwitchedOutput.Off()
|
||||
{
|
||||
OpenRelay();
|
||||
}
|
||||
|
||||
|
||||
#region ISwitchedOutput Members
|
||||
|
||||
void ISwitchedOutput.On()
|
||||
{
|
||||
CloseRelay();
|
||||
}
|
||||
|
||||
void ISwitchedOutput.Off()
|
||||
{
|
||||
OpenRelay();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Bridge Linking
|
||||
|
||||
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
|
||||
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
|
||||
{
|
||||
var joinMap = new GenericRelayControllerJoinMap(joinStart);
|
||||
|
||||
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
|
||||
|
||||
if (!string.IsNullOrEmpty(joinMapSerialized))
|
||||
var joinMap = new GenericRelayControllerJoinMap(joinStart);
|
||||
|
||||
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
|
||||
|
||||
if (!string.IsNullOrEmpty(joinMapSerialized))
|
||||
joinMap = JsonConvert.DeserializeObject<GenericRelayControllerJoinMap>(joinMapSerialized);
|
||||
|
||||
if (bridge != null)
|
||||
@@ -155,26 +155,26 @@ namespace PepperDash.Essentials.Core.CrestronIO
|
||||
else
|
||||
{
|
||||
Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
|
||||
}
|
||||
|
||||
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.JoinNumber, b =>
|
||||
{
|
||||
if (b)
|
||||
CloseRelay();
|
||||
else
|
||||
OpenRelay();
|
||||
});
|
||||
|
||||
// feedback for relay state
|
||||
|
||||
}
|
||||
|
||||
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.JoinNumber, b =>
|
||||
{
|
||||
if (b)
|
||||
CloseRelay();
|
||||
else
|
||||
OpenRelay();
|
||||
});
|
||||
|
||||
// feedback for relay state
|
||||
|
||||
OutputIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Relay.JoinNumber]);
|
||||
}
|
||||
|
||||
@@ -202,54 +202,54 @@ namespace PepperDash.Essentials.Core.CrestronIO
|
||||
return 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
|
||||
}
|
||||
/*
|
||||
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
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
@@ -258,7 +258,7 @@ namespace PepperDash.Essentials.Core.CrestronIO
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -179,7 +179,7 @@ namespace PepperDash.Essentials.Core
|
||||
{
|
||||
public static eDeviceRegistrationUnRegistrationResponse RegisterWithLogging(this GenericBase device, string key)
|
||||
{
|
||||
var result = device.Register();
|
||||
var result = device.Register();
|
||||
var level = result == eDeviceRegistrationUnRegistrationResponse.Success ?
|
||||
Debug.ErrorLogLevel.Notice : Debug.ErrorLogLevel.Error;
|
||||
Debug.Console(0, level, "Register device result: '{0}', type '{1}', result {2}", key, device, result);
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace PepperDash.Essentials.Core.DeviceInfo
|
||||
{
|
||||
public class DeviceInfo
|
||||
{
|
||||
public string HostName { get; set; }
|
||||
public string IpAddress { get; set; }
|
||||
public string MacAddress { get; set; }
|
||||
public string SerialNumber { get; set; }
|
||||
public string FirmwareVersion { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
|
||||
namespace PepperDash.Essentials.Core.DeviceInfo
|
||||
{
|
||||
public class DeviceInfoEventArgs:EventArgs
|
||||
{
|
||||
public DeviceInfo DeviceInfo { get; set; }
|
||||
|
||||
public DeviceInfoEventArgs()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public DeviceInfoEventArgs(DeviceInfo devInfo)
|
||||
{
|
||||
DeviceInfo = devInfo;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Core.DeviceInfo
|
||||
{
|
||||
public interface IDeviceInfoProvider:IKeyed
|
||||
{
|
||||
DeviceInfo DeviceInfo { get; }
|
||||
|
||||
event DeviceInfoChangeHandler DeviceInfoChanged;
|
||||
|
||||
void UpdateDeviceInfo();
|
||||
}
|
||||
|
||||
public delegate void DeviceInfoChangeHandler(IKeyed device, DeviceInfoEventArgs args);
|
||||
}
|
||||
@@ -6,7 +6,7 @@ using PepperDash.Essentials.Core.SmartObjects;
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
|
||||
public interface IDiscPlayerControls : IColor, IDPad, INumericKeypad, IPower, ITransport, IUiDisplayInfo
|
||||
public interface IDiscPlayerControls : IColor, IDPad, INumericKeypad, IHasPowerControl, ITransport, IUiDisplayInfo
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace PepperDash_Essentials_Core.DeviceTypeInterfaces
|
||||
{
|
||||
public interface IHasBranding
|
||||
{
|
||||
bool BrandingEnabled { get; }
|
||||
void InitializeBranding(string roomKey);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
|
||||
{
|
||||
public interface IHasFarEndContentStatus
|
||||
{
|
||||
BoolFeedback ReceivingContent { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash_Essentials_Core.DeviceTypeInterfaces
|
||||
{
|
||||
public interface IHasPhoneDialing
|
||||
{
|
||||
BoolFeedback PhoneOffHookFeedback { get; }
|
||||
StringFeedback CallerIdNameFeedback { get; }
|
||||
StringFeedback CallerIdNumberFeedback { get; }
|
||||
void DialPhoneCall(string number);
|
||||
void EndPhoneCall();
|
||||
void SendDtmfToPhone(string digit);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PepperDash_Essentials_Core.DeviceTypeInterfaces
|
||||
{
|
||||
public interface ILanguageDefinition
|
||||
{
|
||||
string LocaleName { get; set; }
|
||||
string FriendlyName { get; set; }
|
||||
bool Enable { get; set; }
|
||||
List<LanguageLabel> UiLabels { get; set; }
|
||||
List<LanguageLabel> Sources { get; set; }
|
||||
List<LanguageLabel> Destinations { get; set; }
|
||||
List<LanguageLabel> SourceGroupNames { get; set; }
|
||||
List<LanguageLabel> DestinationGroupNames { get; set; }
|
||||
List<LanguageLabel> RoomNames { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PepperDash_Essentials_Core.DeviceTypeInterfaces
|
||||
{
|
||||
public interface ILanguageProvider
|
||||
{
|
||||
ILanguageDefinition CurrentLanguage { get; set; }
|
||||
|
||||
event EventHandler CurrentLanguageChanged;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,11 +8,9 @@ namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
|
||||
/// </summary>
|
||||
public interface IMobileControl : IKeyed
|
||||
{
|
||||
void CreateMobileControlRoomBridge(EssentialsRoomBase room);
|
||||
void CreateMobileControlRoomBridge(EssentialsRoomBase room, IMobileControl parent);
|
||||
|
||||
void LinkSystemMonitorToAppServer();
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -26,6 +24,8 @@ namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
|
||||
|
||||
string QrCodeUrl { get; }
|
||||
|
||||
string QrCodeChecksum { get; }
|
||||
|
||||
string McServerUrl { get; }
|
||||
|
||||
string RoomName { get; }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.SmartObjects;
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace PepperDash.Essentials.Core
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public interface INumericKeypad
|
||||
public interface INumericKeypad:IKeyed
|
||||
{
|
||||
void Digit0(bool pressRelease);
|
||||
void Digit1(bool pressRelease);
|
||||
|
||||
@@ -14,35 +14,64 @@ using PepperDash.Essentials.Core.SmartObjects;
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// Defines the ability to power a device on and off
|
||||
/// </summary>
|
||||
[Obsolete("Will be replaced by IHasPowerControlWithFeedback")]
|
||||
public interface IPower
|
||||
{
|
||||
void PowerOn();
|
||||
void PowerOff();
|
||||
void PowerToggle();
|
||||
BoolFeedback PowerIsOnFeedback { get; }
|
||||
BoolFeedback PowerIsOnFeedback { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds feedback for current power state
|
||||
/// </summary>
|
||||
public interface IHasPowerControlWithFeedback : IHasPowerControl
|
||||
{
|
||||
BoolFeedback PowerIsOnFeedback { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines the ability to power a device on and off
|
||||
/// </summary>
|
||||
public interface IHasPowerControl
|
||||
{
|
||||
void PowerOn();
|
||||
void PowerOff();
|
||||
void PowerToggle();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static class IPowerExtensions
|
||||
public static class IHasPowerControlExtensions
|
||||
{
|
||||
public static void LinkButtons(this IPower dev, BasicTriList triList)
|
||||
public static void LinkButtons(this IHasPowerControl dev, BasicTriList triList)
|
||||
{
|
||||
triList.SetSigFalseAction(101, dev.PowerOn);
|
||||
triList.SetSigFalseAction(102, dev.PowerOff);
|
||||
triList.SetSigFalseAction(103, dev.PowerToggle);
|
||||
dev.PowerIsOnFeedback.LinkInputSig(triList.BooleanInput[101]);
|
||||
|
||||
var fbdev = dev as IHasPowerControlWithFeedback;
|
||||
if (fbdev != null)
|
||||
{
|
||||
fbdev.PowerIsOnFeedback.LinkInputSig(triList.BooleanInput[101]);
|
||||
}
|
||||
}
|
||||
|
||||
public static void UnlinkButtons(this IPower dev, BasicTriList triList)
|
||||
public static void UnlinkButtons(this IHasPowerControl dev, BasicTriList triList)
|
||||
{
|
||||
triList.ClearBoolSigAction(101);
|
||||
triList.ClearBoolSigAction(102);
|
||||
triList.ClearBoolSigAction(103);
|
||||
dev.PowerIsOnFeedback.UnlinkInputSig(triList.BooleanInput[101]);
|
||||
|
||||
var fbdev = dev as IHasPowerControlWithFeedback;
|
||||
if (fbdev != null)
|
||||
{
|
||||
fbdev.PowerIsOnFeedback.UnlinkInputSig(triList.BooleanInput[101]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using PepperDash.Essentials.Core.Presets;
|
||||
|
||||
namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
|
||||
{
|
||||
public interface ITvPresetsProvider
|
||||
{
|
||||
DevicePresetsModel TvPresets { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash_Essentials_Core.DeviceTypeInterfaces
|
||||
{
|
||||
public class LanguageLabel
|
||||
{
|
||||
public string Key { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string DisplayText { get; set; }
|
||||
public uint JoinNumber { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,342 +1,355 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro;
|
||||
|
||||
using PepperDash.Core;
|
||||
|
||||
|
||||
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<Device> Devices { get { return _Devices; } }
|
||||
//static List<Device> _Devices = new List<Device>();
|
||||
|
||||
static readonly Dictionary<string, IKeyed> Devices = new Dictionary<string, IKeyed>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a copy of all the devices in a list
|
||||
/// </summary>
|
||||
public static List<IKeyed> AllDevices { get { return new List<IKeyed>(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",
|
||||
ConsoleAccessLevelEnum.AccessOperator);
|
||||
CrestronConsole.AddNewConsoleCommand(ListDevices, "devlist", "Lists current managed devices",
|
||||
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(SimulateComReceiveOnDevice, "devsimreceive",
|
||||
"Simulates incoming data on a com device", ConsoleAccessLevelEnum.AccessOperator);
|
||||
|
||||
CrestronConsole.AddNewConsoleCommand(s => SetDeviceStreamDebugging(s), "setdevicestreamdebug", "set comm debug [deviceKey] [off/rx/tx/both] ([minutes])", ConsoleAccessLevelEnum.AccessOperator);
|
||||
CrestronConsole.AddNewConsoleCommand(s => DisableAllDeviceStreamDebugging(), "disableallstreamdebug", "disables stream debugging on all devices", ConsoleAccessLevelEnum.AccessOperator);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calls activate steps on all Device class items
|
||||
/// </summary>
|
||||
public static void ActivateAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
DeviceCriticalSection.Enter();
|
||||
AddDeviceEnabled = false;
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
|
||||
// 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();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calls activate on all Device class items
|
||||
/// </summary>
|
||||
public static void DeactivateAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
DeviceCriticalSection.Enter();
|
||||
foreach (var d in Devices.Values.OfType<Device>())
|
||||
{
|
||||
d.Deactivate();
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
DeviceCriticalSection.Leave();
|
||||
}
|
||||
}
|
||||
|
||||
//static void ListMethods(string devKey)
|
||||
//{
|
||||
// var dev = GetDeviceForKey(devKey);
|
||||
// if(dev != null)
|
||||
// {
|
||||
// var type = dev.GetType().GetCType();
|
||||
// var methods = type.GetMethods(BindingFlags.Public|BindingFlags.Instance);
|
||||
// var sb = new StringBuilder();
|
||||
// sb.AppendLine(string.Format("{2} methods on [{0}] ({1}):", dev.Key, type.Name, methods.Length));
|
||||
// foreach (var m in methods)
|
||||
// {
|
||||
// sb.Append(string.Format("{0}(", m.Name));
|
||||
// var pars = m.GetParameters();
|
||||
// foreach (var p in pars)
|
||||
// sb.Append(string.Format("({1}){0} ", p.Name, p.ParameterType.Name));
|
||||
// sb.AppendLine(")");
|
||||
// }
|
||||
// CrestronConsole.ConsoleCommandResponse(sb.ToString());
|
||||
// }
|
||||
//}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
//{
|
||||
// var dev = GetDeviceForKey(devKey);
|
||||
// if (dev == null)
|
||||
// {
|
||||
// Debug.Console(0, "Device '{0}' not found", devKey);
|
||||
// return;
|
||||
// }
|
||||
// Debug.Console(0, "This needs to be reworked. Stay tuned.", devKey);
|
||||
//}
|
||||
|
||||
private static void ListDeviceCommStatuses(string input)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
foreach (var dev in Devices.Values.OfType<ICommunicationMonitor>())
|
||||
{
|
||||
sb.Append(string.Format("{0}: {1}\r", dev,
|
||||
dev.CommunicationMonitor.Status));
|
||||
}
|
||||
CrestronConsole.ConsoleCommandResponse(sb.ToString());
|
||||
}
|
||||
|
||||
|
||||
//static void DoDeviceCommand(string command)
|
||||
//{
|
||||
// Debug.Console(0, "Not yet implemented. Stay tuned");
|
||||
//}
|
||||
|
||||
public static void AddDevice(IKeyed newDev)
|
||||
{
|
||||
try
|
||||
{
|
||||
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");
|
||||
return;
|
||||
}
|
||||
Devices.Add(newDev.Key, newDev);
|
||||
//if (!(_Devices.Contains(newDev)))
|
||||
// _Devices.Add(newDev);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DeviceCriticalSection.Leave();
|
||||
}
|
||||
}
|
||||
|
||||
public static void AddDevice(IEnumerable<IKeyed> devicesToAdd)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!DeviceCriticalSection.TryEnter())
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Error,
|
||||
"Currently unable to add devices to Device Manager. Please try again");
|
||||
return;
|
||||
}
|
||||
if (!AddDeviceEnabled)
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Error,
|
||||
"All devices have been activated. Adding new devices is not allowed.");
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var dev in devicesToAdd)
|
||||
{
|
||||
try
|
||||
{
|
||||
Devices.Add(dev.Key, dev);
|
||||
}
|
||||
catch (ArgumentException ex)
|
||||
{
|
||||
Debug.Console(0, "Error adding device with key {0} to Device Manager: {1}\r\nStack Trace: {2}",
|
||||
dev.Key, ex.Message, ex.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
DeviceCriticalSection.Leave();
|
||||
}
|
||||
}
|
||||
|
||||
public static void RemoveDevice(IKeyed newDev)
|
||||
{
|
||||
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<string> GetDeviceKeys()
|
||||
{
|
||||
//return _Devices.Select(d => d.Key).ToList();
|
||||
return Devices.Keys;
|
||||
}
|
||||
|
||||
public static IEnumerable<IKeyed> GetDevices()
|
||||
{
|
||||
//return _Devices.Select(d => d.Key).ToList();
|
||||
return Devices.Values;
|
||||
}
|
||||
|
||||
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];
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Console handler that simulates com port data receive
|
||||
/// </summary>
|
||||
/// <param name="s"></param>
|
||||
public static void SimulateComReceiveOnDevice(string s)
|
||||
{
|
||||
// devcomsim:1 xyzabc
|
||||
var match = Regex.Match(s, @"(\S*)\s*(.*)");
|
||||
if (match.Groups.Count < 3)
|
||||
{
|
||||
CrestronConsole.ConsoleCommandResponse(" Format: devsimreceive:P <device key> <string to send>");
|
||||
return;
|
||||
}
|
||||
//Debug.Console(2, "**** {0} - {1} ****", match.Groups[1].Value, match.Groups[2].Value);
|
||||
|
||||
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);
|
||||
return;
|
||||
}
|
||||
com.SimulateReceive(match.Groups[2].Value);
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro;
|
||||
|
||||
using PepperDash.Core;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
public static class DeviceManager
|
||||
{
|
||||
public static event EventHandler<EventArgs> AllDevicesActivated;
|
||||
|
||||
private static readonly CCriticalSection DeviceCriticalSection = new CCriticalSection();
|
||||
private static readonly CEvent AllowAddDevicesCEvent = new CEvent(false, true);
|
||||
//public static List<Device> Devices { get { return _Devices; } }
|
||||
//static List<Device> _Devices = new List<Device>();
|
||||
|
||||
static readonly Dictionary<string, IKeyed> Devices = new Dictionary<string, IKeyed>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a copy of all the devices in a list
|
||||
/// </summary>
|
||||
public static List<IKeyed> AllDevices { get { return new List<IKeyed>(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",
|
||||
ConsoleAccessLevelEnum.AccessOperator);
|
||||
CrestronConsole.AddNewConsoleCommand(ListDevices, "devlist", "Lists current managed devices",
|
||||
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(SimulateComReceiveOnDevice, "devsimreceive",
|
||||
"Simulates incoming data on a com device", ConsoleAccessLevelEnum.AccessOperator);
|
||||
|
||||
CrestronConsole.AddNewConsoleCommand(s => SetDeviceStreamDebugging(s), "setdevicestreamdebug", "set comm debug [deviceKey] [off/rx/tx/both] ([minutes])", ConsoleAccessLevelEnum.AccessOperator);
|
||||
CrestronConsole.AddNewConsoleCommand(s => DisableAllDeviceStreamDebugging(), "disableallstreamdebug", "disables stream debugging on all devices", ConsoleAccessLevelEnum.AccessOperator);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calls activate steps on all Device class items
|
||||
/// </summary>
|
||||
public static void ActivateAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
DeviceCriticalSection.Enter();
|
||||
AddDeviceEnabled = false;
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
|
||||
OnAllDevicesActivated();
|
||||
}
|
||||
finally
|
||||
{
|
||||
DeviceCriticalSection.Leave();
|
||||
}
|
||||
}
|
||||
|
||||
private static void OnAllDevicesActivated()
|
||||
{
|
||||
var handler = AllDevicesActivated;
|
||||
if (handler != null)
|
||||
{
|
||||
handler(null, new EventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calls activate on all Device class items
|
||||
/// </summary>
|
||||
public static void DeactivateAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
DeviceCriticalSection.Enter();
|
||||
foreach (var d in Devices.Values.OfType<Device>())
|
||||
{
|
||||
d.Deactivate();
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
DeviceCriticalSection.Leave();
|
||||
}
|
||||
}
|
||||
|
||||
//static void ListMethods(string devKey)
|
||||
//{
|
||||
// var dev = GetDeviceForKey(devKey);
|
||||
// if(dev != null)
|
||||
// {
|
||||
// var type = dev.GetType().GetCType();
|
||||
// var methods = type.GetMethods(BindingFlags.Public|BindingFlags.Instance);
|
||||
// var sb = new StringBuilder();
|
||||
// sb.AppendLine(string.Format("{2} methods on [{0}] ({1}):", dev.Key, type.Name, methods.Length));
|
||||
// foreach (var m in methods)
|
||||
// {
|
||||
// sb.Append(string.Format("{0}(", m.Name));
|
||||
// var pars = m.GetParameters();
|
||||
// foreach (var p in pars)
|
||||
// sb.Append(string.Format("({1}){0} ", p.Name, p.ParameterType.Name));
|
||||
// sb.AppendLine(")");
|
||||
// }
|
||||
// CrestronConsole.ConsoleCommandResponse(sb.ToString());
|
||||
// }
|
||||
//}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
//{
|
||||
// var dev = GetDeviceForKey(devKey);
|
||||
// if (dev == null)
|
||||
// {
|
||||
// Debug.Console(0, "Device '{0}' not found", devKey);
|
||||
// return;
|
||||
// }
|
||||
// Debug.Console(0, "This needs to be reworked. Stay tuned.", devKey);
|
||||
//}
|
||||
|
||||
private static void ListDeviceCommStatuses(string input)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
foreach (var dev in Devices.Values.OfType<ICommunicationMonitor>())
|
||||
{
|
||||
sb.Append(string.Format("{0}: {1}\r", dev,
|
||||
dev.CommunicationMonitor.Status));
|
||||
}
|
||||
CrestronConsole.ConsoleCommandResponse(sb.ToString());
|
||||
}
|
||||
|
||||
|
||||
//static void DoDeviceCommand(string command)
|
||||
//{
|
||||
// Debug.Console(0, "Not yet implemented. Stay tuned");
|
||||
//}
|
||||
|
||||
public static void AddDevice(IKeyed newDev)
|
||||
{
|
||||
try
|
||||
{
|
||||
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");
|
||||
return;
|
||||
}
|
||||
Devices.Add(newDev.Key, newDev);
|
||||
//if (!(_Devices.Contains(newDev)))
|
||||
// _Devices.Add(newDev);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DeviceCriticalSection.Leave();
|
||||
}
|
||||
}
|
||||
|
||||
public static void AddDevice(IEnumerable<IKeyed> devicesToAdd)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!DeviceCriticalSection.TryEnter())
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Error,
|
||||
"Currently unable to add devices to Device Manager. Please try again");
|
||||
return;
|
||||
}
|
||||
if (!AddDeviceEnabled)
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Error,
|
||||
"All devices have been activated. Adding new devices is not allowed.");
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var dev in devicesToAdd)
|
||||
{
|
||||
try
|
||||
{
|
||||
Devices.Add(dev.Key, dev);
|
||||
}
|
||||
catch (ArgumentException ex)
|
||||
{
|
||||
Debug.Console(0, "Error adding device with key {0} to Device Manager: {1}\r\nStack Trace: {2}",
|
||||
dev.Key, ex.Message, ex.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
DeviceCriticalSection.Leave();
|
||||
}
|
||||
}
|
||||
|
||||
public static void RemoveDevice(IKeyed newDev)
|
||||
{
|
||||
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<string> GetDeviceKeys()
|
||||
{
|
||||
//return _Devices.Select(d => d.Key).ToList();
|
||||
return Devices.Keys;
|
||||
}
|
||||
|
||||
public static IEnumerable<IKeyed> GetDevices()
|
||||
{
|
||||
//return _Devices.Select(d => d.Key).ToList();
|
||||
return Devices.Values;
|
||||
}
|
||||
|
||||
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];
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Console handler that simulates com port data receive
|
||||
/// </summary>
|
||||
/// <param name="s"></param>
|
||||
public static void SimulateComReceiveOnDevice(string s)
|
||||
{
|
||||
// devcomsim:1 xyzabc
|
||||
var match = Regex.Match(s, @"(\S*)\s*(.*)");
|
||||
if (match.Groups.Count < 3)
|
||||
{
|
||||
CrestronConsole.ConsoleCommandResponse(" Format: devsimreceive:P <device key> <string to send>");
|
||||
return;
|
||||
}
|
||||
//Debug.Console(2, "**** {0} - {1} ****", match.Groups[1].Value, match.Groups[2].Value);
|
||||
|
||||
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);
|
||||
return;
|
||||
}
|
||||
com.SimulateReceive(match.Groups[2].Value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -366,82 +379,82 @@ namespace PepperDash.Essentials.Core
|
||||
Debug.Console(0, "{0}", routingOutputPort.Key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to set the debug level of a device
|
||||
/// </summary>
|
||||
/// <param name="s"></param>
|
||||
public static void SetDeviceStreamDebugging(string s)
|
||||
{
|
||||
var args = s.Split(' ');
|
||||
|
||||
var deviceKey = args[0];
|
||||
var setting = args[1];
|
||||
|
||||
var timeout= String.Empty;
|
||||
|
||||
if (args.Length >= 3)
|
||||
{
|
||||
timeout = args[2];
|
||||
}
|
||||
|
||||
var device = GetDeviceForKey(deviceKey) as IStreamDebugging;
|
||||
|
||||
if (device == null)
|
||||
{
|
||||
Debug.Console(0, "Unable to get device with key: {0}", deviceKey);
|
||||
return;
|
||||
}
|
||||
|
||||
eStreamDebuggingSetting debugSetting;
|
||||
|
||||
try
|
||||
{
|
||||
debugSetting = (eStreamDebuggingSetting)Enum.Parse(typeof(eStreamDebuggingSetting), setting, true);
|
||||
}
|
||||
catch
|
||||
{
|
||||
Debug.Console(0, "Unable to convert setting value. Please use off/rx/tx/both");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(timeout))
|
||||
{
|
||||
try
|
||||
{
|
||||
var min = Convert.ToUInt32(timeout);
|
||||
|
||||
device.StreamDebugging.SetDebuggingWithSpecificTimeout(debugSetting, min);
|
||||
Debug.Console(0, "Device: '{0}' debug level set to {1) for {2} minutes", deviceKey, debugSetting, min);
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Console(0, "Unable to convert minutes or settings value. Please use an integer value for minutes. Errro: {0}", e);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
device.StreamDebugging.SetDebuggingWithDefaultTimeout(debugSetting);
|
||||
Debug.Console(0, "Device: '{0}' debug level set to {1) for default time (30 minutes)", deviceKey, debugSetting);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets stream debugging settings to off for all devices
|
||||
/// </summary>
|
||||
public static void DisableAllDeviceStreamDebugging()
|
||||
{
|
||||
foreach (var device in AllDevices)
|
||||
{
|
||||
var streamDevice = device as IStreamDebugging;
|
||||
|
||||
if (streamDevice != null)
|
||||
{
|
||||
streamDevice.StreamDebugging.SetDebuggingWithDefaultTimeout(eStreamDebuggingSetting.Off);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to set the debug level of a device
|
||||
/// </summary>
|
||||
/// <param name="s"></param>
|
||||
public static void SetDeviceStreamDebugging(string s)
|
||||
{
|
||||
var args = s.Split(' ');
|
||||
|
||||
var deviceKey = args[0];
|
||||
var setting = args[1];
|
||||
|
||||
var timeout= String.Empty;
|
||||
|
||||
if (args.Length >= 3)
|
||||
{
|
||||
timeout = args[2];
|
||||
}
|
||||
|
||||
var device = GetDeviceForKey(deviceKey) as IStreamDebugging;
|
||||
|
||||
if (device == null)
|
||||
{
|
||||
Debug.Console(0, "Unable to get device with key: {0}", deviceKey);
|
||||
return;
|
||||
}
|
||||
|
||||
eStreamDebuggingSetting debugSetting;
|
||||
|
||||
try
|
||||
{
|
||||
debugSetting = (eStreamDebuggingSetting)Enum.Parse(typeof(eStreamDebuggingSetting), setting, true);
|
||||
}
|
||||
catch
|
||||
{
|
||||
Debug.Console(0, "Unable to convert setting value. Please use off/rx/tx/both");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(timeout))
|
||||
{
|
||||
try
|
||||
{
|
||||
var min = Convert.ToUInt32(timeout);
|
||||
|
||||
device.StreamDebugging.SetDebuggingWithSpecificTimeout(debugSetting, min);
|
||||
Debug.Console(0, "Device: '{0}' debug level set to {1) for {2} minutes", deviceKey, debugSetting, min);
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Console(0, "Unable to convert minutes or settings value. Please use an integer value for minutes. Errro: {0}", e);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
device.StreamDebugging.SetDebuggingWithDefaultTimeout(debugSetting);
|
||||
Debug.Console(0, "Device: '{0}' debug level set to {1) for default time (30 minutes)", deviceKey, debugSetting);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets stream debugging settings to off for all devices
|
||||
/// </summary>
|
||||
public static void DisableAllDeviceStreamDebugging()
|
||||
{
|
||||
foreach (var device in AllDevices)
|
||||
{
|
||||
var streamDevice = device as IStreamDebugging;
|
||||
|
||||
if (streamDevice != null)
|
||||
{
|
||||
streamDevice.StreamDebugging.SetDebuggingWithDefaultTimeout(eStreamDebuggingSetting.Off);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using Newtonsoft.Json;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Bridges;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
|
||||
namespace PepperDash_Essentials_Core.Devices
|
||||
{
|
||||
public class GenericIrController: EssentialsBridgeableDevice
|
||||
{
|
||||
//data storage for bridging
|
||||
private BasicTriList _trilist;
|
||||
private uint _joinStart;
|
||||
private string _joinMapKey;
|
||||
private EiscApiAdvanced _bridge;
|
||||
|
||||
private readonly IrOutputPortController _port;
|
||||
|
||||
public string[] IrCommands {get { return _port.IrFileCommands; }}
|
||||
|
||||
public GenericIrController(string key, string name, IrOutputPortController irPort) : base(key, name)
|
||||
{
|
||||
_port = irPort;
|
||||
|
||||
if (_port == null)
|
||||
{
|
||||
Debug.Console(0, this, Debug.ErrorLogLevel.Error, "IR Port is null, device will not function");
|
||||
return;
|
||||
}
|
||||
DeviceManager.AddDevice(_port);
|
||||
|
||||
_port.DriverLoaded.OutputChange += DriverLoadedOnOutputChange;
|
||||
}
|
||||
|
||||
private void DriverLoadedOnOutputChange(object sender, FeedbackEventArgs args)
|
||||
{
|
||||
if (!args.BoolValue)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_trilist == null || _bridge == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
LinkToApi(_trilist, _joinStart, _joinMapKey, _bridge);
|
||||
}
|
||||
|
||||
#region Overrides of EssentialsBridgeableDevice
|
||||
|
||||
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
|
||||
{
|
||||
//if driver isn't loaded yet, store the variables until it is loaded, then call the LinkToApi method again
|
||||
if (!_port.DriverIsLoaded)
|
||||
{
|
||||
_trilist = trilist;
|
||||
_joinStart = joinStart;
|
||||
_joinMapKey = joinMapKey;
|
||||
_bridge = bridge;
|
||||
return;
|
||||
}
|
||||
|
||||
var joinMap = new GenericIrControllerJoinMap(joinStart);
|
||||
|
||||
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
|
||||
|
||||
if (!string.IsNullOrEmpty(joinMapSerialized))
|
||||
joinMap = JsonConvert.DeserializeObject<GenericIrControllerJoinMap>(joinMapSerialized);
|
||||
|
||||
for (uint i = 0; i < _port.IrFileCommands.Length; i++)
|
||||
{
|
||||
var cmd = _port.IrFileCommands[i];
|
||||
var joinData = new JoinDataComplete(new JoinData {JoinNumber = i, JoinSpan = 1},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = cmd,
|
||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
joinData.SetJoinOffset(joinStart);
|
||||
|
||||
joinMap.Joins.Add(cmd,joinData);
|
||||
|
||||
trilist.SetBoolSigAction(joinData.JoinNumber, (b) => Press(cmd, b));
|
||||
}
|
||||
|
||||
joinMap.PrintJoinMapInfo();
|
||||
|
||||
if (bridge != null)
|
||||
{
|
||||
bridge.AddJoinMap(Key, joinMap);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void Press(string command, bool pressRelease)
|
||||
{
|
||||
_port.PressRelease(command, pressRelease);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class GenericIrControllerJoinMap : JoinMapBaseAdvanced
|
||||
{
|
||||
public GenericIrControllerJoinMap(uint joinStart) : base(joinStart)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class GenericIrControllerFactory : EssentialsDeviceFactory<GenericIrController>
|
||||
{
|
||||
public GenericIrControllerFactory()
|
||||
{
|
||||
TypeNames = new List<string> {"genericIrController"};
|
||||
}
|
||||
#region Overrides of EssentialsDeviceFactory<GenericIRController>
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new Generic IR Controller Device");
|
||||
|
||||
var irPort = IRPortHelper.GetIrOutputPortController(dc);
|
||||
|
||||
return new GenericIrController(dc.Key, dc.Name, irPort);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
public interface IHasDspPresets
|
||||
{
|
||||
List<IDspPreset> Presets { get; }
|
||||
|
||||
void RecallPreset(IDspPreset preset);
|
||||
|
||||
}
|
||||
|
||||
public interface IDspPreset
|
||||
{
|
||||
string Name { get; }
|
||||
}
|
||||
}
|
||||
@@ -21,10 +21,14 @@ namespace PepperDash.Essentials.Core
|
||||
uint IrPortUid;
|
||||
IROutputPort IrPort;
|
||||
|
||||
public BoolFeedback DriverLoaded { get; private set; }
|
||||
|
||||
public ushort StandardIrPulseTime { get; set; }
|
||||
public string DriverFilepath { get; private set; }
|
||||
public bool DriverIsLoaded { get; private set; }
|
||||
|
||||
public string[] IrFileCommands { get { return IrPort.AvailableStandardIRCmds(IrPortUid); } }
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for IrDevice base class. If a null port is provided, this class will
|
||||
/// still function without trying to talk to a port.
|
||||
@@ -33,6 +37,8 @@ namespace PepperDash.Essentials.Core
|
||||
: base(key)
|
||||
{
|
||||
//if (port == null) throw new ArgumentNullException("port");
|
||||
|
||||
DriverLoaded = new BoolFeedback(() => DriverIsLoaded);
|
||||
IrPort = port;
|
||||
if (port == null)
|
||||
{
|
||||
@@ -46,12 +52,34 @@ namespace PepperDash.Essentials.Core
|
||||
DeviceConfig config)
|
||||
: base(key)
|
||||
{
|
||||
DriverLoaded = new BoolFeedback(() => DriverIsLoaded);
|
||||
AddPostActivationAction(() =>
|
||||
{
|
||||
IrPort = postActivationFunc(config);
|
||||
|
||||
if (IrPort == null)
|
||||
{
|
||||
Debug.Console(0, this, "WARNING No valid IR Port assigned to controller. IR will not function");
|
||||
return;
|
||||
}
|
||||
|
||||
var filePath = Global.FilePathPrefix + "ir" + Global.DirectorySeparator + config.Properties["control"]["irFile"].Value<string>();
|
||||
Debug.Console(1, "*************Attempting to load IR file: {0}***************", filePath);
|
||||
|
||||
LoadDriver(filePath);
|
||||
|
||||
PrintAvailableCommands();
|
||||
});
|
||||
}
|
||||
|
||||
public void PrintAvailableCommands()
|
||||
{
|
||||
Debug.Console(2, this, "Available IR Commands in IR File {0}", IrPortUid);
|
||||
foreach (var cmd in IrPort.AvailableIRCmds())
|
||||
{
|
||||
Debug.Console(2, this, "{0}", cmd);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -60,20 +88,23 @@ namespace PepperDash.Essentials.Core
|
||||
/// <param name="path"></param>
|
||||
public void LoadDriver(string path)
|
||||
{
|
||||
Debug.Console(2, this, "***Loading IR File***");
|
||||
if (string.IsNullOrEmpty(path)) path = DriverFilepath;
|
||||
try
|
||||
{
|
||||
IrPortUid = IrPort.LoadIRDriver(path);
|
||||
DriverFilepath = path;
|
||||
StandardIrPulseTime = 200;
|
||||
DriverIsLoaded = true;
|
||||
}
|
||||
try
|
||||
{
|
||||
IrPortUid = IrPort.LoadIRDriver(path);
|
||||
DriverFilepath = path;
|
||||
StandardIrPulseTime = 200;
|
||||
DriverIsLoaded = true;
|
||||
|
||||
DriverLoaded.FireUpdate();
|
||||
}
|
||||
catch
|
||||
{
|
||||
DriverIsLoaded = false;
|
||||
var message = string.Format("WARNING IR Driver '{0}' failed to load", path);
|
||||
Debug.Console(0, this, message);
|
||||
ErrorLog.Error(message);
|
||||
Debug.Console(0, this, Debug.ErrorLogLevel.Error, message);
|
||||
DriverLoaded.FireUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,10 +20,13 @@ namespace PepperDash.Essentials.Core
|
||||
public IrOutputPortController IrPort { get; private set; }
|
||||
public ushort IrPulseTime { get; set; }
|
||||
|
||||
protected override Func<bool> PowerIsOnFeedbackFunc
|
||||
{
|
||||
get { return () => _PowerIsOn; }
|
||||
}
|
||||
[Obsolete("This property will be removed in version 2.0.0")]
|
||||
public override BoolFeedback PowerIsOnFeedback { get; protected set; }
|
||||
|
||||
protected Func<bool> PowerIsOnFeedbackFunc
|
||||
{
|
||||
get { return () => _PowerIsOn; }
|
||||
}
|
||||
protected override Func<bool> IsCoolingDownFeedbackFunc
|
||||
{
|
||||
get { return () => _IsCoolingDown; }
|
||||
@@ -33,7 +36,7 @@ namespace PepperDash.Essentials.Core
|
||||
get { return () => _IsWarmingUp; }
|
||||
}
|
||||
|
||||
bool _PowerIsOn;
|
||||
bool _PowerIsOn;
|
||||
bool _IsWarmingUp;
|
||||
bool _IsCoolingDown;
|
||||
|
||||
@@ -43,11 +46,14 @@ namespace PepperDash.Essentials.Core
|
||||
IrPort = new IrOutputPortController(key + "-ir", port, irDriverFilepath);
|
||||
DeviceManager.AddDevice(IrPort);
|
||||
|
||||
PowerIsOnFeedback.OutputChange += (o, a) => {
|
||||
Debug.Console(2, this, "Power on={0}", _PowerIsOn);
|
||||
if (_PowerIsOn) StartWarmingTimer();
|
||||
else StartCoolingTimer();
|
||||
};
|
||||
PowerIsOnFeedback = new BoolFeedback(PowerIsOnFeedbackFunc);
|
||||
|
||||
PowerIsOnFeedback.OutputChange += (o, a) =>
|
||||
{
|
||||
Debug.Console(2, this, "Power on={0}", _PowerIsOn);
|
||||
if (_PowerIsOn) StartWarmingTimer();
|
||||
else StartCoolingTimer();
|
||||
};
|
||||
IsWarmingUpFeedback.OutputChange += (o, a) => Debug.Console(2, this, "Warming up={0}", _IsWarmingUp);
|
||||
IsCoolingDownFeedback.OutputChange += (o, a) => Debug.Console(2, this, "Cooling down={0}", _IsCoolingDown);
|
||||
|
||||
@@ -110,21 +116,21 @@ namespace PepperDash.Essentials.Core
|
||||
public override void PowerOn()
|
||||
{
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_POWER_ON, IrPulseTime);
|
||||
_PowerIsOn = true;
|
||||
PowerIsOnFeedback.FireUpdate();
|
||||
_PowerIsOn = true;
|
||||
PowerIsOnFeedback.FireUpdate();
|
||||
}
|
||||
|
||||
public override void PowerOff()
|
||||
{
|
||||
_PowerIsOn = false;
|
||||
PowerIsOnFeedback.FireUpdate();
|
||||
_PowerIsOn = false;
|
||||
PowerIsOnFeedback.FireUpdate();
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_POWER_OFF, IrPulseTime);
|
||||
}
|
||||
|
||||
public override void PowerToggle()
|
||||
{
|
||||
_PowerIsOn = false;
|
||||
PowerIsOnFeedback.FireUpdate();
|
||||
_PowerIsOn = false;
|
||||
PowerIsOnFeedback.FireUpdate();
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_POWER, IrPulseTime);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,131 +1,118 @@
|
||||
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
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public abstract class DisplayBase : EssentialsDevice, 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; }
|
||||
|
||||
/// <summary>
|
||||
/// Bool Func that will provide a value for the PowerIsOn Output. Must be implemented
|
||||
/// by concrete sub-classes
|
||||
/// </summary>
|
||||
abstract protected Func<bool> PowerIsOnFeedbackFunc { get; }
|
||||
abstract protected Func<bool> IsCoolingDownFeedbackFunc { get; }
|
||||
abstract protected Func<bool> IsWarmingUpFeedbackFunc { get; }
|
||||
|
||||
|
||||
protected CTimer WarmupTimer;
|
||||
protected CTimer CooldownTimer;
|
||||
|
||||
#region IRoutingInputs Members
|
||||
|
||||
public RoutingPortCollection<RoutingInputPort> 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<RoutingInputPort>();
|
||||
|
||||
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<Feedback> Feedbacks
|
||||
{
|
||||
get
|
||||
{
|
||||
return new FeedbackCollection<Feedback>
|
||||
{
|
||||
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<string>();
|
||||
|
||||
var joinMap = new DisplayControllerJoinMap(joinStart);
|
||||
|
||||
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
|
||||
|
||||
if (!string.IsNullOrEmpty(joinMapSerialized))
|
||||
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
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public abstract class DisplayBase : EssentialsDevice, IHasFeedback, IRoutingSinkWithSwitching, IHasPowerControl, IWarmingCooling, IUsageTracking, IPower
|
||||
{
|
||||
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 IsCoolingDownFeedback { get; protected set; }
|
||||
public BoolFeedback IsWarmingUpFeedback { get; private set; }
|
||||
|
||||
[Obsolete("This property will be removed in version 2.0.0")]
|
||||
public abstract BoolFeedback PowerIsOnFeedback { get; protected set; }
|
||||
|
||||
public UsageTracking UsageTracker { get; set; }
|
||||
|
||||
public uint WarmupTime { get; set; }
|
||||
public uint CooldownTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Bool Func that will provide a value for the PowerIsOn Output. Must be implemented
|
||||
/// by concrete sub-classes
|
||||
/// </summary>
|
||||
abstract protected Func<bool> IsCoolingDownFeedbackFunc { get; }
|
||||
abstract protected Func<bool> IsWarmingUpFeedbackFunc { get; }
|
||||
|
||||
|
||||
protected CTimer WarmupTimer;
|
||||
protected CTimer CooldownTimer;
|
||||
|
||||
#region IRoutingInputs Members
|
||||
|
||||
public RoutingPortCollection<RoutingInputPort> InputPorts { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
protected DisplayBase(string key, string name)
|
||||
: base(key, name)
|
||||
{
|
||||
IsCoolingDownFeedback = new BoolFeedback("IsCoolingDown", IsCoolingDownFeedbackFunc);
|
||||
IsWarmingUpFeedback = new BoolFeedback("IsWarmingUp", IsWarmingUpFeedbackFunc);
|
||||
|
||||
InputPorts = new RoutingPortCollection<RoutingInputPort>();
|
||||
|
||||
}
|
||||
|
||||
public abstract void PowerOn();
|
||||
public abstract void PowerOff();
|
||||
public abstract void PowerToggle();
|
||||
|
||||
public virtual FeedbackCollection<Feedback> Feedbacks
|
||||
{
|
||||
get
|
||||
{
|
||||
return new FeedbackCollection<Feedback>
|
||||
{
|
||||
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<string>();
|
||||
|
||||
var joinMap = new DisplayControllerJoinMap(joinStart);
|
||||
|
||||
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
|
||||
|
||||
if (!string.IsNullOrEmpty(joinMapSerialized))
|
||||
joinMap = JsonConvert.DeserializeObject<DisplayControllerJoinMap>(joinMapSerialized);
|
||||
|
||||
if (bridge != null)
|
||||
@@ -137,163 +124,198 @@ namespace PepperDash.Essentials.Core
|
||||
Debug.Console(0,this,"Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
|
||||
}
|
||||
|
||||
Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||
Debug.Console(0, "Linking to 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)
|
||||
{
|
||||
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]);
|
||||
}
|
||||
|
||||
// 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]);
|
||||
|
||||
for (int i = 0; i < displayDevice.InputPorts.Count; i++)
|
||||
{
|
||||
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.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;
|
||||
|
||||
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]);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public abstract class TwoWayDisplayBase : DisplayBase
|
||||
{
|
||||
public StringFeedback CurrentInputFeedback { get; private set; }
|
||||
|
||||
abstract protected Func<string> 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);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
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)
|
||||
{
|
||||
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]);
|
||||
}
|
||||
|
||||
// Power Off
|
||||
trilist.SetSigTrueAction(joinMap.PowerOff.JoinNumber, () =>
|
||||
{
|
||||
inputNumber = 102;
|
||||
inputNumberFeedback.FireUpdate();
|
||||
displayDevice.PowerOff();
|
||||
});
|
||||
|
||||
var twoWayDisplayDevice = displayDevice as TwoWayDisplayBase;
|
||||
if (twoWayDisplayDevice != null)
|
||||
{
|
||||
twoWayDisplayDevice.PowerIsOnFeedback.OutputChange += (o, a) =>
|
||||
{
|
||||
if (!a.BoolValue)
|
||||
{
|
||||
inputNumber = 102;
|
||||
inputNumberFeedback.FireUpdate();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
inputNumber = 0;
|
||||
inputNumberFeedback.FireUpdate();
|
||||
}
|
||||
};
|
||||
|
||||
twoWayDisplayDevice.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.PowerOff.JoinNumber]);
|
||||
twoWayDisplayDevice.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PowerOn.JoinNumber]);
|
||||
}
|
||||
|
||||
// PowerOn
|
||||
trilist.SetSigTrueAction(joinMap.PowerOn.JoinNumber, () =>
|
||||
{
|
||||
inputNumber = 0;
|
||||
inputNumberFeedback.FireUpdate();
|
||||
displayDevice.PowerOn();
|
||||
});
|
||||
|
||||
|
||||
|
||||
for (int i = 0; i < displayDevice.InputPorts.Count; i++)
|
||||
{
|
||||
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.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;
|
||||
|
||||
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]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public abstract class TwoWayDisplayBase : DisplayBase, IRoutingFeedback, IHasPowerControlWithFeedback
|
||||
{
|
||||
public StringFeedback CurrentInputFeedback { get; private set; }
|
||||
|
||||
abstract protected Func<string> CurrentInputFeedbackFunc { get; }
|
||||
|
||||
public override BoolFeedback PowerIsOnFeedback { get; protected set; }
|
||||
|
||||
abstract protected Func<bool> PowerIsOnFeedbackFunc { 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;
|
||||
|
||||
PowerIsOnFeedback = new BoolFeedback("PowerOnFeedback", PowerIsOnFeedbackFunc);
|
||||
|
||||
Feedbacks.Add(CurrentInputFeedback);
|
||||
Feedbacks.Add(PowerIsOnFeedback);
|
||||
|
||||
PowerIsOnFeedback.OutputChange += PowerIsOnFeedback_OutputChange;
|
||||
|
||||
}
|
||||
|
||||
void PowerIsOnFeedback_OutputChange(object sender, EventArgs e)
|
||||
{
|
||||
if (UsageTracker != null)
|
||||
{
|
||||
if (PowerIsOnFeedback.BoolValue)
|
||||
UsageTracker.StartDeviceUsage();
|
||||
else
|
||||
UsageTracker.EndDeviceUsage();
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler<RoutingNumericEventArgs> NumericSwitchChange;
|
||||
|
||||
/// <summary>
|
||||
/// Raise an event when the status of a switch object changes.
|
||||
/// </summary>
|
||||
/// <param name="e">Arguments defined as IKeyName sender, output, input, and eRoutingSignalType</param>
|
||||
protected void OnSwitchChange(RoutingNumericEventArgs e)
|
||||
{
|
||||
var newEvent = NumericSwitchChange;
|
||||
if (newEvent != null) newEvent(this, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,150 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using PepperDash.Essentials.Core.Bridges;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.Core.Fusion
|
||||
{
|
||||
public class EssentialsHuddleSpaceRoomFusionRoomJoinMap : JoinMapBaseAdvanced
|
||||
{
|
||||
|
||||
// Processor Attributes
|
||||
[JoinName("ProcessorIp1")]
|
||||
public JoinDataComplete ProcessorIp1 = new JoinDataComplete(new JoinData { JoinNumber = 50, JoinSpan = 1, AttributeName = "Info - Processor - IP 1" },
|
||||
new JoinMetadata { Description = "Info - Processor - IP 1", JoinCapabilities = eJoinCapabilities.ToFusion, JoinType = eJoinType.Serial });
|
||||
|
||||
[JoinName("ProcessorIp2")]
|
||||
public JoinDataComplete ProcessorIp2 = new JoinDataComplete(new JoinData { JoinNumber = 51, JoinSpan = 1, AttributeName = "Info - Processor - IP 2" },
|
||||
new JoinMetadata { Description = "Info - Processor - IP 2", JoinCapabilities = eJoinCapabilities.ToFusion, JoinType = eJoinType.Serial });
|
||||
|
||||
[JoinName("ProcessorGateway")]
|
||||
public JoinDataComplete ProcessorGateway = new JoinDataComplete(new JoinData { JoinNumber = 52, JoinSpan = 1, AttributeName = "Info - Processor - Gateway" },
|
||||
new JoinMetadata { Description = "Info - Processor - Gateway", JoinCapabilities = eJoinCapabilities.ToFusion, JoinType = eJoinType.Serial });
|
||||
|
||||
[JoinName("ProcessorHostname")]
|
||||
public JoinDataComplete ProcessorHostname = new JoinDataComplete(new JoinData { JoinNumber = 53, JoinSpan = 1, AttributeName = "Info - Processor - Hostname" },
|
||||
new JoinMetadata { Description = "Info - Processor - Hostname", JoinCapabilities = eJoinCapabilities.ToFusion, JoinType = eJoinType.Serial });
|
||||
|
||||
[JoinName("ProcessorDomain")]
|
||||
public JoinDataComplete ProcessorDomain = new JoinDataComplete(new JoinData { JoinNumber = 54, JoinSpan = 1, AttributeName = "Info - Processor - Domain" },
|
||||
new JoinMetadata { Description = "Info - Processor - Domain", JoinCapabilities = eJoinCapabilities.ToFusion, JoinType = eJoinType.Serial });
|
||||
|
||||
[JoinName("ProcessorDns1")]
|
||||
public JoinDataComplete ProcessorDns1 = new JoinDataComplete(new JoinData { JoinNumber = 55, JoinSpan = 1, AttributeName = "Info - Processor - DNS 1" },
|
||||
new JoinMetadata { Description = "Info - Processor - DNS 1", JoinCapabilities = eJoinCapabilities.ToFusion, JoinType = eJoinType.Serial });
|
||||
|
||||
[JoinName("ProcessorDns2")]
|
||||
public JoinDataComplete ProcessorDns2 = new JoinDataComplete(new JoinData { JoinNumber = 56, JoinSpan = 1, AttributeName = "Info - Processor - DNS 2" },
|
||||
new JoinMetadata { Description = "Info - Processor - DNS 2", JoinCapabilities = eJoinCapabilities.ToFusion, JoinType = eJoinType.Serial });
|
||||
|
||||
[JoinName("ProcessorMac1")]
|
||||
public JoinDataComplete ProcessorMac1 = new JoinDataComplete(new JoinData { JoinNumber = 57, JoinSpan = 1, AttributeName = "Info - Processor - MAC 1" },
|
||||
new JoinMetadata { Description = "Info - Processor - MAC 1", JoinCapabilities = eJoinCapabilities.ToFusion, JoinType = eJoinType.Serial });
|
||||
|
||||
[JoinName("ProcessorMac2")]
|
||||
public JoinDataComplete ProcessorMac2 = new JoinDataComplete(new JoinData { JoinNumber = 58, JoinSpan = 1, AttributeName = "Info - Processor - MAC 2" },
|
||||
new JoinMetadata { Description = "Info - Processor - MAC 2", JoinCapabilities = eJoinCapabilities.ToFusion, JoinType = eJoinType.Serial });
|
||||
|
||||
[JoinName("ProcessorNetMask1")]
|
||||
public JoinDataComplete ProcessorNetMask1 = new JoinDataComplete(new JoinData { JoinNumber = 59, JoinSpan = 1, AttributeName = "Info - Processor - Net Mask 1" },
|
||||
new JoinMetadata { Description = "Info - Processor - Net Mask 1", JoinCapabilities = eJoinCapabilities.ToFusion, JoinType = eJoinType.Serial });
|
||||
|
||||
[JoinName("ProcessorNetMask2")]
|
||||
public JoinDataComplete ProcessorNetMask2 = new JoinDataComplete(new JoinData { JoinNumber = 60, JoinSpan = 1, AttributeName = "Info - Processor - Net Mask 2" },
|
||||
new JoinMetadata { Description = "Info - Processor - Net Mask 2", JoinCapabilities = eJoinCapabilities.ToFusion, JoinType = eJoinType.Serial });
|
||||
|
||||
[JoinName("ProcessorFirmware")]
|
||||
public JoinDataComplete ProcessorFirmware = new JoinDataComplete(new JoinData { JoinNumber = 61, JoinSpan = 1, AttributeName = "Info - Processor - Firmware" },
|
||||
new JoinMetadata { Description = "Info - Processor - Firmware", JoinCapabilities = eJoinCapabilities.ToFusion, JoinType = eJoinType.Serial });
|
||||
|
||||
[JoinName("ProgramNameStart")]
|
||||
public JoinDataComplete ProgramNameStart = new JoinDataComplete(new JoinData { JoinNumber = 62, JoinSpan = 10, AttributeName = "Info - Processor - Program" },
|
||||
new JoinMetadata { Description = "Info - Processor - Program", JoinCapabilities = eJoinCapabilities.ToFusion, JoinType = eJoinType.Serial });
|
||||
|
||||
[JoinName("ProcessorReboot")]
|
||||
public JoinDataComplete ProcessorReboot = new JoinDataComplete(new JoinData { JoinNumber = 74, JoinSpan = 1, AttributeName = "Processor - Reboot" },
|
||||
new JoinMetadata { Description = "Processor - Reboot", JoinCapabilities = eJoinCapabilities.FromFusion, JoinType = eJoinType.Digital });
|
||||
|
||||
// Volume Controls
|
||||
[JoinName("VolumeFader1")]
|
||||
public JoinDataComplete VolumeFader1 = new JoinDataComplete(new JoinData { JoinNumber = 50, JoinSpan = 1, AttributeName = "Volume - Fader01" },
|
||||
new JoinMetadata { Description = "Volume - Fader01", JoinCapabilities = eJoinCapabilities.ToFromFusion, JoinType = eJoinType.Analog });
|
||||
|
||||
// Codec Info
|
||||
[JoinName("VcCodecInCall")]
|
||||
public JoinDataComplete VcCodecInCall = new JoinDataComplete(new JoinData { JoinNumber = 69, JoinSpan = 1, AttributeName = "Conf - VC 1 In Call" },
|
||||
new JoinMetadata { Description = "Conf - VC 1 In Call", JoinCapabilities = eJoinCapabilities.ToFusion, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("VcCodecOnline")]
|
||||
public JoinDataComplete VcCodecOnline = new JoinDataComplete(new JoinData { JoinNumber = 122, JoinSpan = 1, AttributeName = "Online - VC 1" },
|
||||
new JoinMetadata { Description = "Online - VC 1", JoinCapabilities = eJoinCapabilities.ToFusion, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("VcCodecIpAddress")]
|
||||
public JoinDataComplete VcCodecIpAddress = new JoinDataComplete(new JoinData { JoinNumber = 121, JoinSpan = 1, AttributeName = "IP Address - VC" },
|
||||
new JoinMetadata { Description = "IP Address - VC", JoinCapabilities = eJoinCapabilities.ToFusion, JoinType = eJoinType.Serial });
|
||||
|
||||
[JoinName("VcCodecIpPort")]
|
||||
public JoinDataComplete VcCodecIpPort = new JoinDataComplete(new JoinData { JoinNumber = 150, JoinSpan = 1, AttributeName = "IP Port - VC" },
|
||||
new JoinMetadata { Description = "IP Port - VC", JoinCapabilities = eJoinCapabilities.ToFusion, JoinType = eJoinType.Serial });
|
||||
|
||||
// Source Attributes
|
||||
[JoinName("Display1CurrentSourceName")]
|
||||
public JoinDataComplete Display1CurrentSourceName = new JoinDataComplete(new JoinData { JoinNumber = 84, JoinSpan = 1, AttributeName = "Display 1 - Current Source" },
|
||||
new JoinMetadata { Description = "Display 1 - Current Source", JoinCapabilities = eJoinCapabilities.ToFusion, JoinType = eJoinType.Serial });
|
||||
|
||||
|
||||
// Device Online Status
|
||||
[JoinName("TouchpanelOnlineStart")]
|
||||
public JoinDataComplete TouchpanelOnlineStart = new JoinDataComplete(new JoinData { JoinNumber = 150, JoinSpan = 10, AttributeName = "Online - Touch Panel" },
|
||||
new JoinMetadata { Description = "Online - Touch Panel", JoinCapabilities = eJoinCapabilities.ToFusion, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("XpanelOnlineStart")]
|
||||
public JoinDataComplete XpanelOnlineStart = new JoinDataComplete(new JoinData { JoinNumber = 160, JoinSpan = 5, AttributeName = "Online - XPanel" },
|
||||
new JoinMetadata { Description = "Online - XPanel", JoinCapabilities = eJoinCapabilities.ToFusion, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("DisplayOnlineStart")]
|
||||
public JoinDataComplete DisplayOnlineStart = new JoinDataComplete(new JoinData { JoinNumber = 170, JoinSpan = 10, AttributeName = "Online - Display" },
|
||||
new JoinMetadata { Description = "Online - Display", JoinCapabilities = eJoinCapabilities.ToFusion, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Display1LaptopSourceStart")]
|
||||
public JoinDataComplete Display1LaptopSourceStart = new JoinDataComplete(new JoinData { JoinNumber = 166, JoinSpan = 5, AttributeName = "Display 1 - Source Laptop" },
|
||||
new JoinMetadata { Description = "Display 1 - Source Laptop", JoinCapabilities = eJoinCapabilities.ToFromFusion, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Display1DiscPlayerSourceStart")]
|
||||
public JoinDataComplete Display1DiscPlayerSourceStart = new JoinDataComplete(new JoinData { JoinNumber = 181, JoinSpan = 5, AttributeName = "Display 1 - Source Disc Player" },
|
||||
new JoinMetadata { Description = "Display 1 - Source Disc Player", JoinCapabilities = eJoinCapabilities.ToFromFusion, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Display1SetTopBoxSourceStart")]
|
||||
public JoinDataComplete Display1SetTopBoxSourceStart = new JoinDataComplete(new JoinData { JoinNumber = 188, JoinSpan = 5, AttributeName = "Display 1 - Source TV" },
|
||||
new JoinMetadata { Description = "Display 1 - Source TV", JoinCapabilities = eJoinCapabilities.ToFromFusion, JoinType = eJoinType.Digital });
|
||||
|
||||
// Display 1
|
||||
[JoinName("Display1Start")]
|
||||
public JoinDataComplete Display1Start = new JoinDataComplete(new JoinData { JoinNumber = 158, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "Display 1 Start", JoinCapabilities = eJoinCapabilities.ToFromFusion, JoinType = eJoinType.Digital });
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Constructor to use when instantiating this Join Map without inheriting from it
|
||||
/// </summary>
|
||||
/// <param name="joinStart">Join this join map will start at</param>
|
||||
public EssentialsHuddleSpaceRoomFusionRoomJoinMap(uint joinStart)
|
||||
: base(joinStart, typeof(EssentialsHuddleSpaceRoomFusionRoomJoinMap))
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor to use when extending this Join map
|
||||
/// </summary>
|
||||
/// <param name="joinStart">Join this join map will start at</param>
|
||||
/// <param name="type">Type of the child join map</param>
|
||||
public EssentialsHuddleSpaceRoomFusionRoomJoinMap(uint joinStart, Type type) : base(joinStart, type)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
namespace PepperDash_Essentials_Core.Gateways
|
||||
{
|
||||
public class CenCn2Controller
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
public class EthernetAdapterInfo
|
||||
{
|
||||
public EthernetAdapterType Type { get; set; }
|
||||
public bool DhcpIsOn { get; set; }
|
||||
public string Hostname { get; set; }
|
||||
public string MacAddress { get; set; }
|
||||
public string IpAddress { get; set; }
|
||||
public string Subnet { get; set; }
|
||||
public string Gateway { get; set; }
|
||||
public string Dns1 { get; set; }
|
||||
public string Dns2 { get; set; }
|
||||
public string Dns3 { get; set; }
|
||||
public string Domain { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,175 +1,180 @@
|
||||
using System;
|
||||
using System.Text.RegularExpressions;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharp.CrestronIO;
|
||||
using Crestron.SimplSharp.CrestronDataStore;
|
||||
using Crestron.SimplSharpPro;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.License;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json.Schema;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
public static class Global
|
||||
{
|
||||
using System;
|
||||
using System.Text.RegularExpressions;
|
||||
using Crestron.SimplSharp;
|
||||
using System.Collections.Generic;
|
||||
using Crestron.SimplSharp.CrestronIO;
|
||||
using Crestron.SimplSharp.CrestronDataStore;
|
||||
using Crestron.SimplSharpPro;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.License;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json.Schema;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
public static class Global
|
||||
{
|
||||
public static CrestronControlSystem ControlSystem { get; set; }
|
||||
|
||||
public static LicenseManager LicenseManager { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The file path prefix to the folder containing configuration files
|
||||
/// </summary>
|
||||
public static string FilePathPrefix { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The file path prefix to the applciation directory
|
||||
/// </summary>
|
||||
public static string ApplicationDirectoryPathPrefix
|
||||
{
|
||||
get
|
||||
{
|
||||
return Crestron.SimplSharp.CrestronIO.Directory.GetApplicationDirectory();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the directory separator character based on the running OS
|
||||
/// </summary>
|
||||
public static char DirectorySeparator
|
||||
{
|
||||
get
|
||||
{
|
||||
return System.IO.Path.DirectorySeparatorChar;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wildcarded config file name for global reference
|
||||
/// </summary>
|
||||
public const string ConfigFileName = "*configurationFile*.json";
|
||||
|
||||
/// <summary>
|
||||
/// Sets the file path prefix
|
||||
/// </summary>
|
||||
/// <param name="prefix"></param>
|
||||
public static void SetFilePathPrefix(string prefix)
|
||||
{
|
||||
FilePathPrefix = prefix;
|
||||
}
|
||||
|
||||
static string _AssemblyVersion;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Assembly Version of Essentials
|
||||
/// </summary>
|
||||
/// <returns>The Assembly Version at Runtime</returns>
|
||||
public static string AssemblyVersion
|
||||
{
|
||||
get
|
||||
{
|
||||
return _AssemblyVersion;
|
||||
}
|
||||
private set
|
||||
{
|
||||
_AssemblyVersion = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the Assembly version to the version of the Essentials Library
|
||||
/// </summary>
|
||||
/// <param name="assemblyVersion"></param>
|
||||
public static void SetAssemblyVersion(string assemblyVersion)
|
||||
{
|
||||
AssemblyVersion = assemblyVersion;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks to see if the running version meets or exceed the minimum specified version. For beta versions (0.xx.yy), will always return true.
|
||||
/// </summary>
|
||||
/// <param name="minimumVersion">Minimum specified version in format of xx.yy.zz</param>
|
||||
/// <returns>Returns true if the running version meets or exceeds the minimum specified version</returns>
|
||||
public static bool IsRunningMinimumVersionOrHigher(string minimumVersion)
|
||||
{
|
||||
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);
|
||||
|
||||
var runtimeVer = new Version(runtimeVersionMajor, runtimeVersionMinor, runtimeVersionBuild);
|
||||
|
||||
Version minimumVer;
|
||||
try
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
var minVersionMajor = Int16.Parse(minVersion.Groups[1].Value);
|
||||
var minVersionMinor = Int16.Parse(minVersion.Groups[2].Value);
|
||||
var minVersionBuild = Int16.Parse(minVersion.Groups[3].Value);
|
||||
|
||||
|
||||
|
||||
if (minVersionMajor > runtimeVersionMajor)
|
||||
return false;
|
||||
|
||||
if (minVersionMinor > runtimeVersionMinor)
|
||||
return false;
|
||||
|
||||
if (minVersionBuild > runtimeVersionBuild)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
*/
|
||||
}
|
||||
|
||||
static Global()
|
||||
{
|
||||
// Fire up CrestronDataStoreStatic
|
||||
var err = CrestronDataStoreStatic.InitCrestronDataStore();
|
||||
if (err != CrestronDataStore.CDS_ERROR.CDS_SUCCESS)
|
||||
{
|
||||
CrestronConsole.PrintLine("Error starting CrestronDataStoreStatic: {0}", err);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public static eDevicePlatform Platform { get { return CrestronEnvironment.DevicePlatform; } }
|
||||
|
||||
public static Dictionary<short, EthernetAdapterInfo> EthernetAdapterInfoCollection { get; private set; }
|
||||
|
||||
public static LicenseManager LicenseManager { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The file path prefix to the folder containing configuration files
|
||||
/// </summary>
|
||||
public static string FilePathPrefix { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The file path prefix to the applciation directory
|
||||
/// </summary>
|
||||
public static string ApplicationDirectoryPathPrefix
|
||||
{
|
||||
get
|
||||
{
|
||||
return Crestron.SimplSharp.CrestronIO.Directory.GetApplicationDirectory();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the directory separator character based on the running OS
|
||||
/// </summary>
|
||||
public static char DirectorySeparator
|
||||
{
|
||||
get
|
||||
{
|
||||
return System.IO.Path.DirectorySeparatorChar;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wildcarded config file name for global reference
|
||||
/// </summary>
|
||||
public const string ConfigFileName = "*configurationFile*.json";
|
||||
|
||||
/// <summary>
|
||||
/// Sets the file path prefix
|
||||
/// </summary>
|
||||
/// <param name="prefix"></param>
|
||||
public static void SetFilePathPrefix(string prefix)
|
||||
{
|
||||
FilePathPrefix = prefix;
|
||||
}
|
||||
|
||||
static string _AssemblyVersion;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Assembly Version of Essentials
|
||||
/// </summary>
|
||||
/// <returns>The Assembly Version at Runtime</returns>
|
||||
public static string AssemblyVersion
|
||||
{
|
||||
get
|
||||
{
|
||||
return _AssemblyVersion;
|
||||
}
|
||||
private set
|
||||
{
|
||||
_AssemblyVersion = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the Assembly version to the version of the Essentials Library
|
||||
/// </summary>
|
||||
/// <param name="assemblyVersion"></param>
|
||||
public static void SetAssemblyVersion(string assemblyVersion)
|
||||
{
|
||||
AssemblyVersion = assemblyVersion;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks to see if the running version meets or exceed the minimum specified version. For beta versions (0.xx.yy), will always return true.
|
||||
/// </summary>
|
||||
/// <param name="minimumVersion">Minimum specified version in format of xx.yy.zz</param>
|
||||
/// <returns>Returns true if the running version meets or exceeds the minimum specified version</returns>
|
||||
public static bool IsRunningMinimumVersionOrHigher(string minimumVersion)
|
||||
{
|
||||
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);
|
||||
|
||||
var runtimeVer = new Version(runtimeVersionMajor, runtimeVersionMinor, runtimeVersionBuild);
|
||||
|
||||
Version minimumVer;
|
||||
try
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
var minVersionMajor = Int16.Parse(minVersion.Groups[1].Value);
|
||||
var minVersionMinor = Int16.Parse(minVersion.Groups[2].Value);
|
||||
var minVersionBuild = Int16.Parse(minVersion.Groups[3].Value);
|
||||
|
||||
|
||||
|
||||
if (minVersionMajor > runtimeVersionMajor)
|
||||
return false;
|
||||
|
||||
if (minVersionMinor > runtimeVersionMinor)
|
||||
return false;
|
||||
|
||||
if (minVersionBuild > runtimeVersionBuild)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
*/
|
||||
}
|
||||
|
||||
static Global()
|
||||
{
|
||||
// Fire up CrestronDataStoreStatic
|
||||
var err = CrestronDataStoreStatic.InitCrestronDataStore();
|
||||
if (err != CrestronDataStore.CDS_ERROR.CDS_SUCCESS)
|
||||
{
|
||||
CrestronConsole.PrintLine("Error starting CrestronDataStoreStatic: {0}", err);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharp.Reflection;
|
||||
using Crestron.SimplSharp.Scheduler;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.Fusion;
|
||||
using PepperDash.Essentials.Room.Config;
|
||||
using Activator = System.Activator;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
@@ -14,7 +17,7 @@ namespace PepperDash.Essentials.Core
|
||||
/// </summary>
|
||||
public static class Scheduler
|
||||
{
|
||||
private static Dictionary<string, ScheduledEventGroup> EventGroups = new Dictionary<string,ScheduledEventGroup>();
|
||||
private static readonly Dictionary<string, ScheduledEventGroup> EventGroups = new Dictionary<string,ScheduledEventGroup>();
|
||||
|
||||
static Scheduler()
|
||||
{
|
||||
@@ -49,7 +52,6 @@ namespace PepperDash.Essentials.Core
|
||||
/// <summary>
|
||||
/// Adds the event group to the global list
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public static void AddEventGroup(ScheduledEventGroup eventGroup)
|
||||
{
|
||||
@@ -67,6 +69,13 @@ namespace PepperDash.Essentials.Core
|
||||
if(!EventGroups.ContainsKey(eventGroup.Name))
|
||||
EventGroups.Remove(eventGroup.Name);
|
||||
}
|
||||
|
||||
public static ScheduledEventGroup GetEventGroup(string key)
|
||||
{
|
||||
ScheduledEventGroup returnValue;
|
||||
|
||||
return EventGroups.TryGetValue(key, out returnValue) ? returnValue : null;
|
||||
}
|
||||
}
|
||||
|
||||
public static class SchedulerUtilities
|
||||
@@ -135,5 +144,90 @@ namespace PepperDash.Essentials.Core
|
||||
|
||||
return isMatch;
|
||||
}
|
||||
|
||||
public static bool CheckEventTimeForMatch(ScheduledEvent evnt, DateTime time)
|
||||
{
|
||||
return evnt.DateAndTime.Hour == time.Hour && evnt.DateAndTime.Minute == time.Minute;
|
||||
}
|
||||
|
||||
public static bool CheckEventRecurrenceForMatch(ScheduledEvent evnt, ScheduledEventCommon.eWeekDays days)
|
||||
{
|
||||
return evnt.Recurrence.RecurrenceDays == days;
|
||||
}
|
||||
|
||||
public static void CreateEventFromConfig(ScheduledEventConfig config, ScheduledEventGroup group, ScheduledEvent.UserEventCallBack handler)
|
||||
{
|
||||
if (group == null)
|
||||
{
|
||||
Debug.Console(0, "Unable to create event. Group is null");
|
||||
return;
|
||||
}
|
||||
var scheduledEvent = new ScheduledEvent(config.Key, group)
|
||||
{
|
||||
Acknowledgeable = config.Acknowledgeable,
|
||||
Persistent = config.Persistent
|
||||
};
|
||||
|
||||
scheduledEvent.UserCallBack += handler;
|
||||
|
||||
scheduledEvent.DateAndTime.SetFirstDayOfWeek(ScheduledEventCommon.eFirstDayOfWeek.Sunday);
|
||||
|
||||
var eventTime = DateTime.Parse(config.Time);
|
||||
|
||||
if (DateTime.Now > eventTime)
|
||||
{
|
||||
eventTime = eventTime.AddDays(1);
|
||||
}
|
||||
|
||||
Debug.Console(2, "[Scheduler] Current Date day of week: {0} recurrence days: {1}", eventTime.DayOfWeek,
|
||||
config.Days);
|
||||
|
||||
var dayOfWeekConverted = ConvertDayOfWeek(eventTime);
|
||||
|
||||
Debug.Console(1, "[Scheduler] eventTime Day: {0}", dayOfWeekConverted);
|
||||
|
||||
while (!dayOfWeekConverted.IsFlagSet(config.Days))
|
||||
{
|
||||
eventTime = eventTime.AddDays(1);
|
||||
|
||||
dayOfWeekConverted = ConvertDayOfWeek(eventTime);
|
||||
}
|
||||
|
||||
scheduledEvent.DateAndTime.SetAbsoluteEventTime(eventTime);
|
||||
|
||||
scheduledEvent.Recurrence.Weekly(config.Days);
|
||||
|
||||
if (config.Enable)
|
||||
{
|
||||
scheduledEvent.Enable();
|
||||
}
|
||||
else
|
||||
{
|
||||
scheduledEvent.Disable();
|
||||
}
|
||||
}
|
||||
|
||||
private static ScheduledEventCommon.eWeekDays ConvertDayOfWeek(DateTime eventTime)
|
||||
{
|
||||
return (ScheduledEventCommon.eWeekDays) Enum.Parse(typeof(ScheduledEventCommon.eWeekDays), eventTime.DayOfWeek.ToString(), true);
|
||||
}
|
||||
|
||||
private static bool IsFlagSet<T>(this T value, T flag) where T : struct
|
||||
{
|
||||
CheckIsEnum<T>(true);
|
||||
|
||||
var lValue = Convert.ToInt64(value);
|
||||
var lFlag = Convert.ToInt64(flag);
|
||||
|
||||
return (lValue & lFlag) != 0;
|
||||
}
|
||||
|
||||
private static void CheckIsEnum<T>(bool withFlags)
|
||||
{
|
||||
if (!typeof(T).IsEnum)
|
||||
throw new ArgumentException(string.Format("Type '{0}' is not an enum", typeof(T).FullName));
|
||||
if (withFlags && !Attribute.IsDefined(typeof(T), typeof(FlagsAttribute)))
|
||||
throw new ArgumentException(string.Format("Type '{0}' doesn't have the 'Flags' attribute", typeof(T).FullName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@ namespace PepperDash.Essentials.Core
|
||||
|
||||
var joinMap = ConfigReader.ConfigObject.JoinMaps[joinMapKey];
|
||||
|
||||
return joinMap;
|
||||
return joinMap.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -45,16 +45,33 @@ namespace PepperDash.Essentials.Core
|
||||
/// <returns></returns>
|
||||
public static Dictionary<string, JoinData> TryGetJoinMapAdvancedForDevice(string joinMapKey)
|
||||
{
|
||||
if (string.IsNullOrEmpty(joinMapKey))
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(joinMapKey))
|
||||
return null;
|
||||
|
||||
if (!ConfigReader.ConfigObject.JoinMaps.ContainsKey(joinMapKey))
|
||||
{
|
||||
Debug.Console(2, "No Join Map found in config with key: '{0}'", joinMapKey);
|
||||
return null;
|
||||
}
|
||||
|
||||
Debug.Console(2, "Attempting to load custom join map with key: {0}", joinMapKey);
|
||||
|
||||
var joinMapJToken = ConfigReader.ConfigObject.JoinMaps[joinMapKey];
|
||||
|
||||
if (joinMapJToken == null)
|
||||
return null;
|
||||
|
||||
var joinMapData = joinMapJToken.ToObject<Dictionary<string, JoinData>>();
|
||||
|
||||
return joinMapData;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Console(2, "Error getting join map for key: '{0}'. Error: {1}", joinMapKey, e);
|
||||
return null;
|
||||
|
||||
var joinMapSerialzed = ConfigReader.ConfigObject.JoinMaps[joinMapKey];
|
||||
|
||||
if (joinMapSerialzed == null) return null;
|
||||
|
||||
var joinMapData = JsonConvert.DeserializeObject<Dictionary<string, JoinData>>(joinMapSerialzed);
|
||||
|
||||
return joinMapData;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -266,7 +283,7 @@ namespace PepperDash.Essentials.Core
|
||||
@"Join Number: {0} | JoinSpan: '{1}' | Description: '{2}' | Type: '{3}' | Capabilities: '{4}'",
|
||||
join.Value.JoinNumber,
|
||||
join.Value.JoinSpan,
|
||||
String.IsNullOrEmpty(join.Value.Metadata.Description) ? join.Value.Metadata.Label: join.Value.Metadata.Description,
|
||||
String.IsNullOrEmpty(join.Value.AttributeName) ? join.Value.Metadata.Label : join.Value.AttributeName,
|
||||
join.Value.Metadata.JoinType.ToString(),
|
||||
join.Value.Metadata.JoinCapabilities.ToString());
|
||||
}
|
||||
@@ -288,7 +305,7 @@ namespace PepperDash.Essentials.Core
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(2, "No mathcing key found in join map for: '{0}'", customJoinData.Key);
|
||||
Debug.Console(2, "No matching key found in join map for: '{0}'", customJoinData.Key);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -327,7 +344,10 @@ namespace PepperDash.Essentials.Core
|
||||
None = 0,
|
||||
ToSIMPL = 1,
|
||||
FromSIMPL = 2,
|
||||
ToFromSIMPL = ToSIMPL | FromSIMPL
|
||||
ToFromSIMPL = ToSIMPL | FromSIMPL,
|
||||
ToFusion = 4,
|
||||
FromFusion = 8,
|
||||
ToFromFusion = ToFusion | FromFusion,
|
||||
}
|
||||
|
||||
[Flags]
|
||||
@@ -340,7 +360,7 @@ namespace PepperDash.Essentials.Core
|
||||
DigitalAnalog = Digital | Analog,
|
||||
DigitalSerial = Digital | Serial,
|
||||
AnalogSerial = Analog | Serial,
|
||||
DigitalAnalogSerial = Digital | Analog | Serial
|
||||
DigitalAnalogSerial = Digital | Analog | Serial,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -394,7 +414,7 @@ namespace PepperDash.Essentials.Core
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Data describing the join. Can be
|
||||
/// Data describing the join. Can be overridden from configuratino
|
||||
/// </summary>
|
||||
public class JoinData
|
||||
{
|
||||
@@ -408,6 +428,11 @@ namespace PepperDash.Essentials.Core
|
||||
/// </summary>
|
||||
[JsonProperty("joinSpan")]
|
||||
public uint JoinSpan { get; set; }
|
||||
/// <summary>
|
||||
/// Fusion Attribute Name (optional)
|
||||
/// </summary>
|
||||
[JsonProperty("attributeName")]
|
||||
public string AttributeName { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -419,6 +444,10 @@ namespace PepperDash.Essentials.Core
|
||||
|
||||
private JoinData _data;
|
||||
public JoinMetadata Metadata { get; set; }
|
||||
/// <summary>
|
||||
/// To store some future information as you please
|
||||
/// </summary>
|
||||
public object UserObject { get; private set; }
|
||||
|
||||
public JoinDataComplete(JoinData data, JoinMetadata metadata)
|
||||
{
|
||||
@@ -449,6 +478,11 @@ namespace PepperDash.Essentials.Core
|
||||
get { return _data.JoinSpan; }
|
||||
}
|
||||
|
||||
public string AttributeName
|
||||
{
|
||||
get { return _data.AttributeName; }
|
||||
}
|
||||
|
||||
public void SetCustomJoinData(JoinData customJoinData)
|
||||
{
|
||||
_data = customJoinData;
|
||||
|
||||
@@ -88,8 +88,12 @@ namespace PepperDash.Essentials.Core.Privacy
|
||||
else
|
||||
Debug.Console(0, this, "Unable to add Red LED device");
|
||||
|
||||
DeviceManager.AllDevicesActivated += (o, a) =>
|
||||
{
|
||||
CheckPrivacyMode();
|
||||
};
|
||||
|
||||
AddPostActivationAction(() => {
|
||||
CheckPrivacyMode();
|
||||
PrivacyDevice.PrivacyModeIsOnFeedback.OutputChange -= PrivacyModeIsOnFeedback_OutputChange;
|
||||
PrivacyDevice.PrivacyModeIsOnFeedback.OutputChange += PrivacyModeIsOnFeedback_OutputChange;
|
||||
});
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -48,83 +48,71 @@
|
||||
<ItemGroup>
|
||||
<Reference Include="Crestron.SimplSharpPro.DeviceSupport, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.DeviceSupport.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.DeviceSupport.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Crestron.SimplSharpPro.DM, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.DM.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.DM.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Crestron.SimplSharpPro.EthernetCommunications, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.EthernetCommunications.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.EthernetCommunications.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Crestron.SimplSharpPro.Fusion, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Fusion.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Fusion.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Crestron.SimplSharpPro.Gateways, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Gateways.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Gateways.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Crestron.SimplSharpPro.GeneralIO, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.GeneralIO.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.GeneralIO.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Crestron.SimplSharpPro.Remotes, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Remotes.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Remotes.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Crestron.SimplSharpPro.ThreeSeriesCards, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.ThreeSeriesCards.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.ThreeSeriesCards.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Crestron.SimplSharpPro.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.UI.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.UI.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="mscorlib" />
|
||||
<Reference Include="PepperDash_Core, Version=1.0.41.31808, Culture=neutral, processorArchitecture=MSIL">
|
||||
<Reference Include="PepperDash_Core, Version=1.0.42.30563, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\packages\PepperDashCore\lib\net35\PepperDash_Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SimplSharpCustomAttributesInterface, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpCustomAttributesInterface.dll</HintPath>
|
||||
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpCustomAttributesInterface.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="SimplSharpHelperInterface, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpHelperInterface.dll</HintPath>
|
||||
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpHelperInterface.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="SimplSharpNewtonsoft, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\ProgramData\Crestron\SDK\SimplSharpNewtonsoft.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpNewtonsoft.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SimplSharpPro, Version=1.5.3.17, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpPro.exe</HintPath>
|
||||
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpPro.exe</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="SimplSharpReflectionInterface, Version=1.0.5583.25238, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\ProgramData\Crestron\SDK\SimplSharpReflectionInterface.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpReflectionInterface.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SimplSharpTimerEventInterface, Version=1.0.6197.20052, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\ProgramData\Crestron\SDK\SimplSharpTimerEventInterface.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpTimerEventInterface.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
@@ -158,6 +146,7 @@
|
||||
<Compile Include="Bridges\JoinMaps\SetTopBoxControllerJoinMap.cs" />
|
||||
<Compile Include="Bridges\JoinMaps\StatusSignControllerJoinMap.cs" />
|
||||
<Compile Include="Bridges\JoinMaps\SystemMonitorJoinMap.cs" />
|
||||
<Compile Include="Bridges\JoinMaps\VideoCodecControllerJoinMap.cs" />
|
||||
<Compile Include="Comm and IR\CecPortController.cs" />
|
||||
<Compile Include="Comm and IR\CommFactory.cs" />
|
||||
<Compile Include="Comm and IR\CommunicationExtras.cs" />
|
||||
@@ -194,17 +183,29 @@
|
||||
<Compile Include="Crestron IO\Relay\GenericRelayDevice.cs" />
|
||||
<Compile Include="Crestron IO\Relay\ISwitchedOutput.cs" />
|
||||
<Compile Include="Crestron IO\StatusSign\StatusSignController.cs" />
|
||||
<Compile Include="Device Info\DeviceInfo.cs" />
|
||||
<Compile Include="Device Info\DeviceInfoEventArgs.cs" />
|
||||
<Compile Include="Device Info\IDeviceInfoProvider.cs" />
|
||||
<Compile Include="Devices\CodecInterfaces.cs" />
|
||||
<Compile Include="Devices\CrestronProcessor.cs" />
|
||||
<Compile Include="Devices\DeviceApiBase.cs" />
|
||||
<Compile Include="Devices\DeviceFeedbackExtensions.cs" />
|
||||
<Compile Include="Devices\EssentialsBridgeableDevice.cs" />
|
||||
<Compile Include="Devices\EssentialsDevice.cs" />
|
||||
<Compile Include="Devices\GenericIRController.cs" />
|
||||
<Compile Include="Devices\IDspPreset.cs" />
|
||||
<Compile Include="Devices\IProjectorInterfaces.cs" />
|
||||
<Compile Include="Devices\PC\InRoomPc.cs" />
|
||||
<Compile Include="Devices\PC\Laptop.cs" />
|
||||
<Compile Include="Devices\ReconfigurableDevice.cs" />
|
||||
<Compile Include="Devices\VolumeDeviceChangeEventArgs.cs" />
|
||||
<Compile Include="DeviceTypeInterfaces\ITvPresetsProvider.cs" />
|
||||
<Compile Include="DeviceTypeInterfaces\LanguageLabel.cs" />
|
||||
<Compile Include="DeviceTypeInterfaces\ILanguageProvider.cs" />
|
||||
<Compile Include="DeviceTypeInterfaces\IHasBranding.cs" />
|
||||
<Compile Include="DeviceTypeInterfaces\ILanguageDefinition.cs" />
|
||||
<Compile Include="DeviceTypeInterfaces\IHasFarEndContentStatus.cs" />
|
||||
<Compile Include="DeviceTypeInterfaces\IHasPhoneDialing.cs" />
|
||||
<Compile Include="DeviceTypeInterfaces\IMobileControl.cs" />
|
||||
<Compile Include="Factory\DeviceFactory.cs" />
|
||||
<Compile Include="Factory\IDeviceFactory.cs" />
|
||||
@@ -219,11 +220,17 @@
|
||||
<Compile Include="Fusion\FusionCustomPropertiesBridge.cs" />
|
||||
<Compile Include="Fusion\FusionEventHandlers.cs" />
|
||||
<Compile Include="Fusion\FusionProcessorQueries.cs" />
|
||||
<Compile Include="Fusion\EssentialsHuddleSpaceRoomFusionRoomJoinMap.cs" />
|
||||
<Compile Include="Fusion\FusionRviDataClasses.cs" />
|
||||
<Compile Include="Gateways\CenRfgwController.cs" />
|
||||
<Compile Include="Gateways\EssentialsRfGatewayConfig.cs" />
|
||||
<Compile Include="Global\EthernetAdapterInfo.cs" />
|
||||
<Compile Include="Queues\ComsMessage.cs" />
|
||||
<Compile Include="Queues\ProcessStringMessage.cs" />
|
||||
<Compile Include="Queues\GenericQueue.cs" />
|
||||
<Compile Include="Global\JobTimer.cs" />
|
||||
<Compile Include="Global\Scheduler.cs" />
|
||||
<Compile Include="Queues\IQueue.cs" />
|
||||
<Compile Include="JoinMaps\JoinMapBase.cs" />
|
||||
<Compile Include="Lighting\Lighting Interfaces.cs" />
|
||||
<Compile Include="Lighting\LightingBase.cs" />
|
||||
@@ -238,6 +245,7 @@
|
||||
<Compile Include="Plugins\PluginLoader.cs" />
|
||||
<Compile Include="Presets\PresetBase.cs" />
|
||||
<Compile Include="Plugins\IPluginDeviceFactory.cs" />
|
||||
<Compile Include="Queues\IQueueMessage.cs" />
|
||||
<Compile Include="Ramps and Increments\ActionIncrementer.cs" />
|
||||
<Compile Include="Config\BasicConfig.cs" />
|
||||
<Compile Include="Config\ConfigPropertiesHelpers.cs" />
|
||||
@@ -272,6 +280,7 @@
|
||||
<Compile Include="Remotes\Hrxx0WirelessRemoteController.cs" />
|
||||
<Compile Include="Room\Behaviours\RoomOnToDefaultSourceWhenOccupied.cs" />
|
||||
<Compile Include="Room\EssentialsRoomBase.cs" />
|
||||
<Compile Include="Room\Config\EssentialsRoomScheduledEventsConfig.cs" />
|
||||
<Compile Include="Room\Interfaces.cs" />
|
||||
<Compile Include="Room\iOccupancyStatusProvider.cs" />
|
||||
<Compile Include="Routing\DummyRoutingInputsDevice.cs" />
|
||||
@@ -313,6 +322,7 @@
|
||||
<Compile Include="SmartObjects\SmartObjectDPad.cs" />
|
||||
<Compile Include="SmartObjects\SmartObjectHelperBase.cs" />
|
||||
<Compile Include="Routing\TieLine.cs" />
|
||||
<Compile Include="Queues\StringResponseProcessor.cs" />
|
||||
<Compile Include="Timers\CountdownTimer.cs" />
|
||||
<Compile Include="Touchpanels\CrestronTouchpanelPropertiesConfig.cs" />
|
||||
<Compile Include="Touchpanels\Interfaces.cs" />
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<tags>crestron 3series 4series</tags>
|
||||
<repository type="git" url="https://github.com/PepperDash/Essentials"/>
|
||||
<dependencies>
|
||||
<dependency id="PepperDashCore" version="[1.0, 1.1)"/>
|
||||
<dependency id="PepperDashCore" version="[1.0.44, 1.1.0)"/>
|
||||
</dependencies>
|
||||
</metadata>
|
||||
<files>
|
||||
|
||||
@@ -402,13 +402,16 @@ namespace PepperDash.Essentials
|
||||
/// Loads a
|
||||
/// </summary>
|
||||
/// <param name="plugin"></param>
|
||||
/// <param name="loadedAssembly"></param>
|
||||
static void LoadCustomPlugin(IPluginDeviceFactory plugin, LoadedAssembly loadedAssembly)
|
||||
{
|
||||
var passed = Global.IsRunningMinimumVersionOrHigher(plugin.MinimumEssentialsFrameworkVersion);
|
||||
|
||||
if (!passed)
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Error, "Plugin indicates minimum Essentials version {0}. Dependency check failed. Skipping Plugin", plugin.MinimumEssentialsFrameworkVersion);
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Error,
|
||||
"\r\n********************\r\n\tPlugin indicates minimum Essentials version {0}. Dependency check failed. Skipping Plugin {1}\r\n********************",
|
||||
plugin.MinimumEssentialsFrameworkVersion, loadedAssembly.Name);
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,178 +1,300 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharp.CrestronIO;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
using PepperDash.Core;
|
||||
|
||||
//using SSMono.IO;
|
||||
using PepperDash.Core.WebApi.Presets;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Presets
|
||||
{
|
||||
/// <summary>
|
||||
/// Class that represents the model behind presets display
|
||||
/// </summary>
|
||||
public class DevicePresetsModel : Device
|
||||
{
|
||||
public event EventHandler PresetsLoaded;
|
||||
/// <summary>
|
||||
/// Class that represents the model behind presets display
|
||||
/// </summary>
|
||||
public class DevicePresetsModel : Device
|
||||
{
|
||||
public delegate void PresetRecalledCallback(ISetTopBoxNumericKeypad device, string channel);
|
||||
|
||||
public int PulseTime { get; set; }
|
||||
public int DigitSpacingMS { get; set; }
|
||||
public bool PresetsAreLoaded { get; private set; }
|
||||
public delegate void PresetsSavedCallback(List<PresetChannel> presets);
|
||||
|
||||
public List<PresetChannel> PresetsList { get { return _PresetsList.ToList(); } }
|
||||
List<PresetChannel> _PresetsList;
|
||||
public int Count { get { return PresetsList != null ? PresetsList.Count : 0; } }
|
||||
private readonly CCriticalSection _fileOps = new CCriticalSection();
|
||||
private readonly bool _initSuccess;
|
||||
|
||||
public bool UseLocalImageStorage { get; set; }
|
||||
public string ImagesLocalHostPrefix { get; set; }
|
||||
public string ImagesPathPrefix { get; set; }
|
||||
public string ListPathPrefix { get; set; }
|
||||
private readonly ISetTopBoxNumericKeypad _setTopBox;
|
||||
|
||||
/// <summary>
|
||||
/// The methods on the STB device to call when dialing
|
||||
/// </summary>
|
||||
Dictionary<char, Action<bool>> DialFunctions;
|
||||
Action<bool> EnterFunction;
|
||||
/// <summary>
|
||||
/// The methods on the STB device to call when dialing
|
||||
/// </summary>
|
||||
private Dictionary<char, Action<bool>> _dialFunctions;
|
||||
|
||||
bool DialIsRunning;
|
||||
string FilePath;
|
||||
bool InitSuccess;
|
||||
//SSMono.IO.FileSystemWatcher ListWatcher;
|
||||
private bool _dialIsRunning;
|
||||
private Action<bool> _enterFunction;
|
||||
private string _filePath;
|
||||
|
||||
public DevicePresetsModel(string key, ISetTopBoxNumericKeypad setTopBox, string fileName)
|
||||
: base(key)
|
||||
{
|
||||
PulseTime = 150;
|
||||
DigitSpacingMS = 150;
|
||||
public DevicePresetsModel(string key, ISetTopBoxNumericKeypad setTopBox, string fileName)
|
||||
: this(key, fileName)
|
||||
{
|
||||
try
|
||||
{
|
||||
_setTopBox = setTopBox;
|
||||
|
||||
try
|
||||
{
|
||||
// Grab the digit functions from the device
|
||||
// If any fail, the whole thing fails peacefully
|
||||
DialFunctions = new Dictionary<char, Action<bool>>(10)
|
||||
{
|
||||
{ '1', setTopBox.Digit1 },
|
||||
{ '2', setTopBox.Digit2 },
|
||||
{ '3', setTopBox.Digit3 },
|
||||
{ '4', setTopBox.Digit4 },
|
||||
{ '5', setTopBox.Digit5 },
|
||||
{ '6', setTopBox.Digit6 },
|
||||
{ '7', setTopBox.Digit7 },
|
||||
{ '8', setTopBox.Digit8 },
|
||||
{ '9', setTopBox.Digit9 },
|
||||
{ '0', setTopBox.Digit0 },
|
||||
{ '-', setTopBox.Dash }
|
||||
};
|
||||
}
|
||||
catch
|
||||
{
|
||||
Debug.Console(0, "DevicePresets '{0}', not attached to INumericKeypad device. Ignoring", key);
|
||||
DialFunctions = null;
|
||||
return;
|
||||
}
|
||||
// Grab the digit functions from the device
|
||||
// If any fail, the whole thing fails peacefully
|
||||
_dialFunctions = new Dictionary<char, Action<bool>>(10)
|
||||
{
|
||||
{'1', setTopBox.Digit1},
|
||||
{'2', setTopBox.Digit2},
|
||||
{'3', setTopBox.Digit3},
|
||||
{'4', setTopBox.Digit4},
|
||||
{'5', setTopBox.Digit5},
|
||||
{'6', setTopBox.Digit6},
|
||||
{'7', setTopBox.Digit7},
|
||||
{'8', setTopBox.Digit8},
|
||||
{'9', setTopBox.Digit9},
|
||||
{'0', setTopBox.Digit0},
|
||||
{'-', setTopBox.Dash}
|
||||
};
|
||||
}
|
||||
catch
|
||||
{
|
||||
Debug.Console(0, "DevicePresets '{0}', not attached to INumericKeypad device. Ignoring", key);
|
||||
_dialFunctions = null;
|
||||
return;
|
||||
}
|
||||
|
||||
EnterFunction = setTopBox.KeypadEnter;
|
||||
_enterFunction = setTopBox.KeypadEnter;
|
||||
}
|
||||
|
||||
UseLocalImageStorage = true;
|
||||
public DevicePresetsModel(string key, string fileName) : base(key)
|
||||
{
|
||||
PulseTime = 150;
|
||||
DigitSpacingMs = 150;
|
||||
|
||||
ImagesLocalHostPrefix = "http://" + CrestronEthernetHelper.GetEthernetParameter(
|
||||
CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_ADDRESS,0);
|
||||
ImagesPathPrefix = @"/presets/images.zip/";
|
||||
ListPathPrefix = @"/html/presets/lists/";
|
||||
UseLocalImageStorage = true;
|
||||
|
||||
SetFileName(fileName);
|
||||
ImagesLocalHostPrefix = "http://" + CrestronEthernetHelper.GetEthernetParameter(
|
||||
CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_ADDRESS, 0);
|
||||
ImagesPathPrefix = @"/presets/images.zip/";
|
||||
ListPathPrefix = @"/html/presets/lists/";
|
||||
|
||||
//ListWatcher = new FileSystemWatcher(@"\HTML\presets\lists");
|
||||
//ListWatcher.NotifyFilter = NotifyFilters.LastWrite;
|
||||
//ListWatcher.EnableRaisingEvents = true;
|
||||
//ListWatcher.Changed += ListWatcher_Changed;
|
||||
InitSuccess = true;
|
||||
}
|
||||
SetFileName(fileName);
|
||||
|
||||
_initSuccess = true;
|
||||
}
|
||||
|
||||
public event PresetRecalledCallback PresetRecalled;
|
||||
public event PresetsSavedCallback PresetsSaved;
|
||||
|
||||
public int PulseTime { get; set; }
|
||||
public int DigitSpacingMs { get; set; }
|
||||
public bool PresetsAreLoaded { get; private set; }
|
||||
|
||||
public List<PresetChannel> PresetsList { get; private set; }
|
||||
|
||||
public int Count
|
||||
{
|
||||
get { return PresetsList != null ? PresetsList.Count : 0; }
|
||||
}
|
||||
|
||||
public bool UseLocalImageStorage { get; set; }
|
||||
public string ImagesLocalHostPrefix { get; set; }
|
||||
public string ImagesPathPrefix { get; set; }
|
||||
public string ListPathPrefix { get; set; }
|
||||
public event EventHandler PresetsLoaded;
|
||||
|
||||
|
||||
public void SetFileName(string path)
|
||||
{
|
||||
FilePath = ListPathPrefix + path;
|
||||
LoadChannels();
|
||||
}
|
||||
public void SetFileName(string path)
|
||||
{
|
||||
_filePath = ListPathPrefix + path;
|
||||
|
||||
public void LoadChannels()
|
||||
{
|
||||
PresetsAreLoaded = false;
|
||||
try
|
||||
{
|
||||
var pl = JsonConvert.DeserializeObject<PresetsList>(Crestron.SimplSharp.CrestronIO.File.ReadToEnd(FilePath, Encoding.ASCII));
|
||||
Name = pl.Name;
|
||||
_PresetsList = pl.Channels;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Console(2, this, "LoadChannels: Error reading presets file. These presets will be empty:\r '{0}'\r Error:{1}", FilePath, e.Message);
|
||||
// Just save a default empty list
|
||||
_PresetsList = new List<PresetChannel>();
|
||||
}
|
||||
PresetsAreLoaded = true;
|
||||
Debug.Console(2, this, "Setting presets file path to {0}", _filePath);
|
||||
LoadChannels();
|
||||
}
|
||||
|
||||
var handler = PresetsLoaded;
|
||||
if (handler != null)
|
||||
handler(this, EventArgs.Empty);
|
||||
}
|
||||
public void LoadChannels()
|
||||
{
|
||||
try
|
||||
{
|
||||
_fileOps.Enter();
|
||||
|
||||
public void Dial(int presetNum)
|
||||
{
|
||||
if (presetNum <= _PresetsList.Count)
|
||||
Dial(_PresetsList[presetNum - 1].Channel);
|
||||
}
|
||||
Debug.Console(2, this, "Loading presets from {0}", _filePath);
|
||||
PresetsAreLoaded = false;
|
||||
try
|
||||
{
|
||||
var pl = JsonConvert.DeserializeObject<PresetsList>(File.ReadToEnd(_filePath, Encoding.ASCII));
|
||||
Name = pl.Name;
|
||||
PresetsList = pl.Channels;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Console(2, this,
|
||||
"LoadChannels: Error reading presets file. These presets will be empty:\r '{0}'\r Error:{1}",
|
||||
_filePath, e.Message);
|
||||
// Just save a default empty list
|
||||
PresetsList = new List<PresetChannel>();
|
||||
}
|
||||
PresetsAreLoaded = true;
|
||||
|
||||
public void Dial(string chanNum)
|
||||
{
|
||||
if (DialIsRunning || !InitSuccess) return;
|
||||
if (DialFunctions == null)
|
||||
{
|
||||
Debug.Console(1, "DevicePresets '{0}', not attached to keypad device. Ignoring channel", Key);
|
||||
return;
|
||||
}
|
||||
var handler = PresetsLoaded;
|
||||
if (handler != null)
|
||||
{
|
||||
handler(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
_fileOps.Leave();
|
||||
}
|
||||
}
|
||||
|
||||
DialIsRunning = true;
|
||||
CrestronInvoke.BeginInvoke(o =>
|
||||
{
|
||||
foreach (var c in chanNum.ToCharArray())
|
||||
{
|
||||
if (DialFunctions.ContainsKey(c))
|
||||
Pulse(DialFunctions[c]);
|
||||
CrestronEnvironment.Sleep(DigitSpacingMS);
|
||||
}
|
||||
public void Dial(int presetNum)
|
||||
{
|
||||
if (presetNum <= PresetsList.Count)
|
||||
{
|
||||
Dial(PresetsList[presetNum - 1].Channel);
|
||||
}
|
||||
}
|
||||
|
||||
if (EnterFunction != null)
|
||||
Pulse(EnterFunction);
|
||||
DialIsRunning = false;
|
||||
});
|
||||
}
|
||||
public void Dial(string chanNum)
|
||||
{
|
||||
if (_dialIsRunning || !_initSuccess)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (_dialFunctions == null)
|
||||
{
|
||||
Debug.Console(1, "DevicePresets '{0}', not attached to keypad device. Ignoring channel", Key);
|
||||
return;
|
||||
}
|
||||
|
||||
void Pulse(Action<bool> act)
|
||||
{
|
||||
act(true);
|
||||
CrestronEnvironment.Sleep(PulseTime);
|
||||
act(false);
|
||||
}
|
||||
_dialIsRunning = true;
|
||||
CrestronInvoke.BeginInvoke(o =>
|
||||
{
|
||||
foreach (var c in chanNum.ToCharArray())
|
||||
{
|
||||
if (_dialFunctions.ContainsKey(c))
|
||||
{
|
||||
Pulse(_dialFunctions[c]);
|
||||
}
|
||||
CrestronEnvironment.Sleep(DigitSpacingMs);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Event handler for filesystem watcher. When directory changes, this is called
|
||||
/// </summary>
|
||||
//void ListWatcher_Changed(object sender, FileSystemEventArgs e)
|
||||
//{
|
||||
// Debug.Console(1, this, "folder modified: {0}", e.FullPath);
|
||||
// if (e.FullPath.Equals(FilePath, StringComparison.OrdinalIgnoreCase))
|
||||
// {
|
||||
// Debug.Console(1, this, "File changed: {0}", e.ChangeType);
|
||||
// LoadChannels();
|
||||
// }
|
||||
//}
|
||||
}
|
||||
if (_enterFunction != null)
|
||||
{
|
||||
Pulse(_enterFunction);
|
||||
}
|
||||
_dialIsRunning = false;
|
||||
});
|
||||
|
||||
if (_setTopBox == null) return;
|
||||
|
||||
OnPresetRecalled(_setTopBox, chanNum);
|
||||
}
|
||||
|
||||
public void Dial(int presetNum, ISetTopBoxNumericKeypad setTopBox)
|
||||
{
|
||||
if (presetNum <= PresetsList.Count)
|
||||
{
|
||||
Dial(PresetsList[presetNum - 1].Channel, setTopBox);
|
||||
}
|
||||
}
|
||||
|
||||
public void Dial(string chanNum, ISetTopBoxNumericKeypad setTopBox)
|
||||
{
|
||||
_dialFunctions = new Dictionary<char, Action<bool>>(10)
|
||||
{
|
||||
{'1', setTopBox.Digit1},
|
||||
{'2', setTopBox.Digit2},
|
||||
{'3', setTopBox.Digit3},
|
||||
{'4', setTopBox.Digit4},
|
||||
{'5', setTopBox.Digit5},
|
||||
{'6', setTopBox.Digit6},
|
||||
{'7', setTopBox.Digit7},
|
||||
{'8', setTopBox.Digit8},
|
||||
{'9', setTopBox.Digit9},
|
||||
{'0', setTopBox.Digit0},
|
||||
{'-', setTopBox.Dash}
|
||||
};
|
||||
|
||||
_enterFunction = setTopBox.KeypadEnter;
|
||||
|
||||
OnPresetRecalled(setTopBox, chanNum);
|
||||
|
||||
Dial(chanNum);
|
||||
}
|
||||
|
||||
private void OnPresetRecalled(ISetTopBoxNumericKeypad setTopBox, string channel)
|
||||
{
|
||||
var handler = PresetRecalled;
|
||||
|
||||
if (handler == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
handler(setTopBox, channel);
|
||||
}
|
||||
|
||||
public void UpdatePreset(int index, PresetChannel preset)
|
||||
{
|
||||
if (index >= PresetsList.Count)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
PresetsList[index] = preset;
|
||||
|
||||
SavePresets();
|
||||
|
||||
OnPresetsSaved();
|
||||
}
|
||||
|
||||
public void UpdatePresets(List<PresetChannel> presets)
|
||||
{
|
||||
PresetsList = presets;
|
||||
|
||||
SavePresets();
|
||||
|
||||
OnPresetsSaved();
|
||||
}
|
||||
|
||||
private void SavePresets()
|
||||
{
|
||||
try
|
||||
{
|
||||
_fileOps.Enter();
|
||||
var pl = new PresetsList {Channels = PresetsList, Name = Name};
|
||||
var json = JsonConvert.SerializeObject(pl, Formatting.Indented);
|
||||
|
||||
using (var file = File.Open(_filePath, FileMode.Truncate))
|
||||
{
|
||||
file.Write(json, Encoding.UTF8);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
_fileOps.Leave();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void OnPresetsSaved()
|
||||
{
|
||||
var handler = PresetsSaved;
|
||||
|
||||
if (handler == null) return;
|
||||
|
||||
handler(PresetsList);
|
||||
}
|
||||
|
||||
private void Pulse(Action<bool> act)
|
||||
{
|
||||
act(true);
|
||||
CrestronEnvironment.Sleep(PulseTime);
|
||||
act(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,19 +10,22 @@ namespace PepperDash.Essentials.Core.Presets
|
||||
public class PresetChannel
|
||||
{
|
||||
|
||||
[JsonProperty(Required = Required.Always)]
|
||||
[JsonProperty(Required = Required.Always,PropertyName = "name")]
|
||||
public string Name { get; set; }
|
||||
[JsonProperty(Required = Required.Always)]
|
||||
|
||||
[JsonProperty(Required = Required.Always, PropertyName = "iconUrl")]
|
||||
public string IconUrl { get; set; }
|
||||
[JsonProperty(Required = Required.Always)]
|
||||
|
||||
[JsonProperty(Required = Required.Always, PropertyName = "channel")]
|
||||
public string Channel { get; set; }
|
||||
}
|
||||
|
||||
public class PresetsList
|
||||
{
|
||||
[JsonProperty(Required=Required.Always)]
|
||||
[JsonProperty(Required=Required.Always,PropertyName = "name")]
|
||||
public string Name { get; set; }
|
||||
[JsonProperty(Required = Required.Always)]
|
||||
|
||||
[JsonProperty(Required = Required.Always, PropertyName = "channels")]
|
||||
public List<PresetChannel> Channels { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
using System;
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash_Essentials_Core.Queues
|
||||
{
|
||||
/// <summary>
|
||||
/// IBasicCommunication Message for IQueue
|
||||
/// </summary>
|
||||
public class ComsMessage : IQueueMessage
|
||||
{
|
||||
private readonly byte[] _bytes;
|
||||
private readonly IBasicCommunication _coms;
|
||||
private readonly string _string;
|
||||
private readonly bool _isByteMessage;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for a string message
|
||||
/// </summary>
|
||||
/// <param name="coms">IBasicCommunication to send the message</param>
|
||||
/// <param name="message">Message to send</param>
|
||||
public ComsMessage(IBasicCommunication coms, string message)
|
||||
{
|
||||
Validate(coms, message);
|
||||
_coms = coms;
|
||||
_string = message;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for a byte message
|
||||
/// </summary>
|
||||
/// <param name="coms">IBasicCommunication to send the message</param>
|
||||
/// <param name="message">Message to send</param>
|
||||
public ComsMessage(IBasicCommunication coms, byte[] message)
|
||||
{
|
||||
Validate(coms, message);
|
||||
_coms = coms;
|
||||
_bytes = message;
|
||||
_isByteMessage = true;
|
||||
}
|
||||
|
||||
private void Validate(IBasicCommunication coms, object message)
|
||||
{
|
||||
if (_coms == null)
|
||||
throw new ArgumentNullException("coms");
|
||||
|
||||
if (message == null)
|
||||
throw new ArgumentNullException("message");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dispatchs the string/byte[] to the IBasicCommunication specified
|
||||
/// </summary>
|
||||
public void Dispatch()
|
||||
{
|
||||
if (_isByteMessage)
|
||||
{
|
||||
_coms.SendBytes(_bytes);
|
||||
}
|
||||
else
|
||||
{
|
||||
_coms.SendText(_string);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Shows either the byte[] or string to be sent
|
||||
/// </summary>
|
||||
public override string ToString()
|
||||
{
|
||||
return _bytes != null ? _bytes.ToString() : _string;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
using System;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro.CrestronThread;
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash_Essentials_Core.Queues
|
||||
{
|
||||
/// <summary>
|
||||
/// Threadsafe processing of queued items with pacing if required
|
||||
/// </summary>
|
||||
public class GenericQueue : IQueue<IQueueMessage>
|
||||
{
|
||||
private readonly string _key;
|
||||
protected readonly CrestronQueue<IQueueMessage> _queue;
|
||||
protected readonly Thread _worker;
|
||||
protected readonly CEvent _waitHandle = new CEvent();
|
||||
|
||||
private readonly bool _delayEnabled;
|
||||
private readonly int _delayTime;
|
||||
|
||||
/// <summary>
|
||||
/// If the instance has been disposed.
|
||||
/// </summary>
|
||||
public bool Disposed { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for generic queue with no pacing
|
||||
/// </summary>
|
||||
/// <param name="key">Key</param>
|
||||
public GenericQueue(string key)
|
||||
{
|
||||
_key = key;
|
||||
_queue = new CrestronQueue<IQueueMessage>();
|
||||
_worker = new Thread(ProcessQueue, null, Thread.eThreadStartOptions.Running);
|
||||
|
||||
CrestronEnvironment.ProgramStatusEventHandler += programEvent =>
|
||||
{
|
||||
if (programEvent != eProgramStatusEventType.Stopping)
|
||||
return;
|
||||
|
||||
Dispose();
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for generic queue with no pacing
|
||||
/// </summary>
|
||||
/// <param name="key">Key</param>
|
||||
/// <param name="pacing">Pacing in ms between actions</param>
|
||||
public GenericQueue(string key, int pacing)
|
||||
: this(key)
|
||||
{
|
||||
_delayEnabled = pacing > 0;
|
||||
_delayTime = pacing;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Thread callback
|
||||
/// </summary>
|
||||
/// <param name="obj">The action used to process dequeued items</param>
|
||||
/// <returns>Null when the thread is exited</returns>
|
||||
private object ProcessQueue(object obj)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
IQueueMessage item = null;
|
||||
|
||||
if (_queue.Count > 0)
|
||||
{
|
||||
item = _queue.Dequeue();
|
||||
if (item == null)
|
||||
break;
|
||||
}
|
||||
if (item != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
Debug.Console(2, this, "Processing queue item: '{0}'", item.ToString());
|
||||
item.Dispatch();
|
||||
|
||||
if (_delayEnabled)
|
||||
Thread.Sleep(_delayTime);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.ConsoleWithLog(0, this, "Caught an exception in the Queue {0}\r{1}\r{2}", ex.Message, ex.InnerException, ex.StackTrace);
|
||||
}
|
||||
}
|
||||
else _waitHandle.Wait();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void Enqueue(IQueueMessage item)
|
||||
{
|
||||
_queue.Enqueue(item);
|
||||
_waitHandle.Set();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disposes the thread and cleans up resources. Thread cannot be restarted once
|
||||
/// disposed.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
CrestronEnvironment.GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Actually does the disposing. If you override this method, be sure to either call the base implementation
|
||||
/// or clean up all the resources yourself.
|
||||
/// </summary>
|
||||
/// <param name="disposing">set to true unless called from finalizer</param>
|
||||
protected void Dispose(bool disposing)
|
||||
{
|
||||
if (Disposed)
|
||||
return;
|
||||
|
||||
if (disposing)
|
||||
{
|
||||
Enqueue(null);
|
||||
_worker.Join();
|
||||
_waitHandle.Close();
|
||||
}
|
||||
|
||||
Disposed = true;
|
||||
}
|
||||
|
||||
~GenericQueue()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Key
|
||||
/// </summary>
|
||||
public string Key
|
||||
{
|
||||
get { return _key; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash_Essentials_Core.Queues
|
||||
{
|
||||
public interface IQueue<T> : IKeyed, IDisposable where T : class
|
||||
{
|
||||
void Enqueue(T item);
|
||||
bool Disposed { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace PepperDash_Essentials_Core.Queues
|
||||
{
|
||||
public interface IQueueMessage
|
||||
{
|
||||
void Dispatch();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
|
||||
namespace PepperDash_Essentials_Core.Queues
|
||||
{
|
||||
/// <summary>
|
||||
/// Message class for processing strings via an IQueue
|
||||
/// </summary>
|
||||
public class ProcessStringMessage : IQueueMessage
|
||||
{
|
||||
private readonly Action<string> _action;
|
||||
private readonly string _message;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="message">Message to be processed</param>
|
||||
/// <param name="action">Action to invoke on the message</param>
|
||||
public ProcessStringMessage(string message, Action<string> action)
|
||||
{
|
||||
_message = message;
|
||||
_action = action;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes the string with the given action
|
||||
/// </summary>
|
||||
public void Dispatch()
|
||||
{
|
||||
if (_action == null || String.IsNullOrEmpty(_message))
|
||||
return;
|
||||
|
||||
_action(_message);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// To string
|
||||
/// </summary>
|
||||
/// <returns>The current message</returns>
|
||||
public override string ToString()
|
||||
{
|
||||
return _message ?? String.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
using System;
|
||||
using Crestron.SimplSharp;
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash_Essentials_Core.Queues
|
||||
{
|
||||
public sealed class StringResponseProcessor : IKeyed, IDisposable
|
||||
{
|
||||
private readonly Action<string> _processStringAction;
|
||||
private readonly IQueue<IQueueMessage> _queue;
|
||||
private readonly IBasicCommunication _coms;
|
||||
private readonly CommunicationGather _gather;
|
||||
|
||||
private StringResponseProcessor(string key, Action<string> processStringAction)
|
||||
{
|
||||
_processStringAction = processStringAction;
|
||||
_queue = new GenericQueue(key);
|
||||
|
||||
CrestronEnvironment.ProgramStatusEventHandler += programEvent =>
|
||||
{
|
||||
if (programEvent != eProgramStatusEventType.Stopping)
|
||||
return;
|
||||
|
||||
Dispose();
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor that builds an instance and subscribes to coms TextReceived for processing
|
||||
/// </summary>
|
||||
/// <param name="coms">Com port to process strings from</param>
|
||||
/// <param name="processStringAction">Action to process the incoming strings</param>
|
||||
public StringResponseProcessor(IBasicCommunication coms, Action<string> processStringAction)
|
||||
: this(coms.Key, processStringAction)
|
||||
{
|
||||
_coms = coms;
|
||||
coms.TextReceived += OnResponseReceived;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor that builds an instance and subscribes to gather Line Received for processing
|
||||
/// </summary>
|
||||
/// <param name="gather">Gather to process strings from</param>
|
||||
/// <param name="processStringAction">Action to process the incoming strings</param>
|
||||
public StringResponseProcessor(CommunicationGather gather, Action<string> processStringAction)
|
||||
: this(gather.Port.Key, processStringAction)
|
||||
{
|
||||
_gather = gather;
|
||||
gather.LineReceived += OnResponseReceived;
|
||||
}
|
||||
|
||||
private void OnResponseReceived(object sender, GenericCommMethodReceiveTextArgs args)
|
||||
{
|
||||
_queue.Enqueue(new ProcessStringMessage(args.Text, _processStringAction));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Key
|
||||
/// </summary>
|
||||
public string Key
|
||||
{
|
||||
get { return _queue.Key; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disposes the instance and cleans up resources.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
CrestronEnvironment.GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
private void Dispose(bool disposing)
|
||||
{
|
||||
if (Disposed)
|
||||
return;
|
||||
|
||||
if (disposing)
|
||||
{
|
||||
if (_coms != null)
|
||||
_coms.TextReceived -= OnResponseReceived;
|
||||
|
||||
if (_gather != null)
|
||||
{
|
||||
_gather.LineReceived -= OnResponseReceived;
|
||||
_gather.Stop();
|
||||
}
|
||||
|
||||
_queue.Dispose();
|
||||
}
|
||||
|
||||
Disposed = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If the instance has been disposed or not. If it has, you can not use it anymore
|
||||
/// </summary>
|
||||
public bool Disposed { get; private set; }
|
||||
|
||||
~StringResponseProcessor()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,32 +18,29 @@ using PepperDash.Essentials.Core.Bridges;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
[Description("Wrapper class for all HR-Series remotes")]
|
||||
public class Hrxx0WirelessRemoteController : EssentialsBridgeableDevice, IHasFeedback
|
||||
[Description("Wrapper class for all HR-Series remotes")]
|
||||
public class Hrxx0WirelessRemoteController : EssentialsBridgeableDevice, IHasFeedback, IHR52Button
|
||||
{
|
||||
private CenRfgwController _gateway;
|
||||
|
||||
private GatewayBase _gatewayBase;
|
||||
|
||||
|
||||
private Hr1x0WirelessRemoteBase _remote;
|
||||
|
||||
private Hr1x0WirelessRemoteBase _remote;
|
||||
|
||||
public FeedbackCollection<Feedback> Feedbacks { get; set; }
|
||||
|
||||
public CrestronCollection<Button> Buttons { get { return _remote.Button; } }
|
||||
|
||||
private DeviceConfig _config;
|
||||
|
||||
private DeviceConfig _config;
|
||||
|
||||
public Hrxx0WirelessRemoteController(string key, Func<DeviceConfig, Hr1x0WirelessRemoteBase> preActivationFunc,
|
||||
DeviceConfig config)
|
||||
: base(key, config.Name)
|
||||
{
|
||||
Feedbacks = new FeedbackCollection<Feedback>();
|
||||
|
||||
var props = JsonConvert.DeserializeObject<CrestronRemotePropertiesConfig>(config.Properties.ToString());
|
||||
|
||||
var type = config.Type;
|
||||
var rfId = (uint)props.Control.InfinetIdInt;
|
||||
var props = JsonConvert.DeserializeObject<CrestronRemotePropertiesConfig>(config.Properties.ToString());
|
||||
|
||||
_config = config;
|
||||
|
||||
if (props.GatewayDeviceKey == "processor")
|
||||
@@ -128,7 +125,20 @@ namespace PepperDash.Essentials.Core
|
||||
if (handler is Action<bool>)
|
||||
{
|
||||
(handler as Action<bool>)(args.Button.State == eButtonState.Pressed ? true : false);
|
||||
}
|
||||
}
|
||||
|
||||
var newHandler = ButtonStateChange;
|
||||
if (ButtonStateChange != null)
|
||||
{
|
||||
newHandler(device, args);
|
||||
}
|
||||
|
||||
var newerHandler = EssentialsButtonStateChange;
|
||||
if (EssentialsButtonStateChange != null)
|
||||
{
|
||||
newerHandler(this, args);
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -312,6 +322,504 @@ namespace PepperDash.Essentials.Core
|
||||
public void SetTrilistBool(BasicTriList trilist, uint join, bool b)
|
||||
{
|
||||
trilist.BooleanInput[join].BoolValue = b;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#region IHR52Button Members
|
||||
|
||||
public Button Custom9
|
||||
{
|
||||
get
|
||||
{
|
||||
var localRemote = (IHR52Button) _remote;
|
||||
return localRemote == null ? null : localRemote.Custom9;
|
||||
}
|
||||
}
|
||||
|
||||
public Button Favorite
|
||||
{
|
||||
get
|
||||
{
|
||||
var localRemote = (IHR52Button)_remote;
|
||||
return localRemote == null ? null : localRemote.Favorite;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Button Home
|
||||
{
|
||||
get
|
||||
{
|
||||
var localRemote = (IHR52Button)_remote;
|
||||
return localRemote == null ? null : localRemote.Home;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IHR49Button Members
|
||||
|
||||
public Button Clear
|
||||
{
|
||||
get
|
||||
{
|
||||
var localRemote = (IHR49Button)_remote;
|
||||
return localRemote == null ? null : localRemote.Clear;
|
||||
}
|
||||
}
|
||||
|
||||
public Button Custom5
|
||||
{
|
||||
get
|
||||
{
|
||||
var localRemote = (IHR49Button)_remote;
|
||||
return localRemote == null ? null : localRemote.Custom5;
|
||||
}
|
||||
}
|
||||
|
||||
public Button Custom6
|
||||
{
|
||||
get
|
||||
{
|
||||
var localRemote = (IHR49Button)_remote;
|
||||
return localRemote == null ? null : localRemote.Custom6;
|
||||
}
|
||||
}
|
||||
|
||||
public Button Custom7
|
||||
{
|
||||
get
|
||||
{
|
||||
var localRemote = (IHR49Button)_remote;
|
||||
return localRemote == null ? null : localRemote.Custom7;
|
||||
}
|
||||
}
|
||||
|
||||
public Button Custom8
|
||||
{
|
||||
get
|
||||
{
|
||||
var localRemote = (IHR49Button)_remote;
|
||||
return localRemote == null ? null : localRemote.Custom8;
|
||||
}
|
||||
}
|
||||
|
||||
public Button Enter
|
||||
{
|
||||
get
|
||||
{
|
||||
var localRemote = (IHR49Button)_remote;
|
||||
return localRemote == null ? null : localRemote.Enter;
|
||||
}
|
||||
}
|
||||
|
||||
public Button Keypad0
|
||||
{
|
||||
get
|
||||
{
|
||||
var localRemote = (IHR49Button)_remote;
|
||||
return localRemote == null ? null : localRemote.Keypad0;
|
||||
}
|
||||
}
|
||||
|
||||
public Button Keypad1
|
||||
{
|
||||
get
|
||||
{
|
||||
var localRemote = (IHR49Button)_remote;
|
||||
return localRemote == null ? null : localRemote.Keypad1;
|
||||
}
|
||||
}
|
||||
|
||||
public Button Keypad2Abc
|
||||
{
|
||||
get
|
||||
{
|
||||
var localRemote = (IHR49Button)_remote;
|
||||
return localRemote == null ? null : localRemote.Keypad2Abc;
|
||||
}
|
||||
}
|
||||
|
||||
public Button Keypad3Def
|
||||
{
|
||||
get
|
||||
{
|
||||
var localRemote = (IHR49Button)_remote;
|
||||
return localRemote == null ? null : localRemote.Keypad3Def;
|
||||
}
|
||||
}
|
||||
|
||||
public Button Keypad4Ghi
|
||||
{
|
||||
get
|
||||
{
|
||||
var localRemote = (IHR49Button)_remote;
|
||||
return localRemote == null ? null : localRemote.Keypad4Ghi;
|
||||
}
|
||||
}
|
||||
|
||||
public Button Keypad5Jkl
|
||||
{
|
||||
get
|
||||
{
|
||||
var localRemote = (IHR49Button)_remote;
|
||||
return localRemote == null ? null : localRemote.Keypad5Jkl;
|
||||
}
|
||||
}
|
||||
|
||||
public Button Keypad6Mno
|
||||
{
|
||||
get
|
||||
{
|
||||
var localRemote = (IHR49Button)_remote;
|
||||
return localRemote == null ? null : localRemote.Keypad6Mno;
|
||||
}
|
||||
}
|
||||
|
||||
public Button Keypad7Pqrs
|
||||
{
|
||||
get
|
||||
{
|
||||
var localRemote = (IHR49Button)_remote;
|
||||
return localRemote == null ? null : localRemote.Keypad7Pqrs;
|
||||
}
|
||||
}
|
||||
|
||||
public Button Keypad8Tuv
|
||||
{
|
||||
get
|
||||
{
|
||||
var localRemote = (IHR49Button)_remote;
|
||||
return localRemote == null ? null : localRemote.Keypad8Tuv;
|
||||
}
|
||||
}
|
||||
|
||||
public Button Keypad9Wxyz
|
||||
{
|
||||
get
|
||||
{
|
||||
var localRemote = (IHR49Button)_remote;
|
||||
return localRemote == null ? null : localRemote.Keypad9Wxyz;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IHR33Button Members
|
||||
|
||||
public Button Blue
|
||||
{
|
||||
get
|
||||
{
|
||||
var localRemote = (IHR33Button)_remote;
|
||||
return localRemote == null ? null : localRemote.Blue;
|
||||
}
|
||||
}
|
||||
|
||||
public Button ChannelDown
|
||||
{
|
||||
get
|
||||
{
|
||||
var localRemote = (IHR33Button)_remote;
|
||||
return localRemote == null ? null : localRemote.ChannelDown;
|
||||
}
|
||||
}
|
||||
|
||||
public Button ChannelUp
|
||||
{
|
||||
get
|
||||
{
|
||||
var localRemote = (IHR33Button)_remote;
|
||||
return localRemote == null ? null : localRemote.ChannelUp;
|
||||
}
|
||||
}
|
||||
|
||||
public Button Custom1
|
||||
{
|
||||
get
|
||||
{
|
||||
var localRemote = (IHR33Button)_remote;
|
||||
return localRemote == null ? null : localRemote.Custom1;
|
||||
}
|
||||
}
|
||||
|
||||
public Button Custom2
|
||||
{
|
||||
get
|
||||
{
|
||||
var localRemote = (IHR33Button)_remote;
|
||||
return localRemote == null ? null : localRemote.Custom2;
|
||||
}
|
||||
}
|
||||
|
||||
public Button Custom3
|
||||
{
|
||||
get
|
||||
{
|
||||
var localRemote = (IHR33Button)_remote;
|
||||
return localRemote == null ? null : localRemote.Custom3;
|
||||
}
|
||||
}
|
||||
|
||||
public Button Custom4
|
||||
{
|
||||
get
|
||||
{
|
||||
var localRemote = (IHR33Button)_remote;
|
||||
return localRemote == null ? null : localRemote.Custom4;
|
||||
}
|
||||
}
|
||||
|
||||
public Button DialPadDown
|
||||
{
|
||||
get
|
||||
{
|
||||
var localRemote = (IHR33Button)_remote;
|
||||
return localRemote == null ? null : localRemote.DialPadDown;
|
||||
}
|
||||
}
|
||||
|
||||
public Button DialPadEnter
|
||||
{
|
||||
get
|
||||
{
|
||||
var localRemote = (IHR33Button)_remote;
|
||||
return localRemote == null ? null : localRemote.DialPadEnter;
|
||||
}
|
||||
}
|
||||
|
||||
public Button DialPadLeft
|
||||
{
|
||||
get
|
||||
{
|
||||
var localRemote = (IHR33Button)_remote;
|
||||
return localRemote == null ? null : localRemote.DialPadLeft;
|
||||
}
|
||||
}
|
||||
|
||||
public Button DialPadRight
|
||||
{
|
||||
get
|
||||
{
|
||||
var localRemote = (IHR33Button)_remote;
|
||||
return localRemote == null ? null : localRemote.DialPadRight;
|
||||
}
|
||||
}
|
||||
|
||||
public Button DialPadUp
|
||||
{
|
||||
get
|
||||
{
|
||||
var localRemote = (IHR33Button)_remote;
|
||||
return localRemote == null ? null : localRemote.DialPadUp;
|
||||
}
|
||||
}
|
||||
|
||||
public Button Dvr
|
||||
{
|
||||
get
|
||||
{
|
||||
var localRemote = (IHR33Button)_remote;
|
||||
return localRemote == null ? null : localRemote.Dvr;
|
||||
}
|
||||
}
|
||||
|
||||
public Button Exit
|
||||
{
|
||||
get
|
||||
{
|
||||
var localRemote = (IHR33Button)_remote;
|
||||
return localRemote == null ? null : localRemote.Exit;
|
||||
}
|
||||
}
|
||||
|
||||
public Button FastForward
|
||||
{
|
||||
get
|
||||
{
|
||||
var localRemote = (IHR33Button)_remote;
|
||||
return localRemote == null ? null : localRemote.FastForward;
|
||||
}
|
||||
}
|
||||
|
||||
public Button Green
|
||||
{
|
||||
get
|
||||
{
|
||||
var localRemote = (IHR33Button)_remote;
|
||||
return localRemote == null ? null : localRemote.Green;
|
||||
}
|
||||
}
|
||||
|
||||
public Button Guide
|
||||
{
|
||||
get
|
||||
{
|
||||
var localRemote = (IHR33Button)_remote;
|
||||
return localRemote == null ? null : localRemote.Blue;
|
||||
}
|
||||
}
|
||||
|
||||
public Button Information
|
||||
{
|
||||
get
|
||||
{
|
||||
var localRemote = (IHR33Button)_remote;
|
||||
return localRemote == null ? null : localRemote.Information;
|
||||
}
|
||||
}
|
||||
|
||||
public Button Last
|
||||
{
|
||||
get
|
||||
{
|
||||
var localRemote = (IHR33Button)_remote;
|
||||
return localRemote == null ? null : localRemote.Last;
|
||||
}
|
||||
}
|
||||
|
||||
public Button Menu
|
||||
{
|
||||
get
|
||||
{
|
||||
var localRemote = (IHR33Button)_remote;
|
||||
return localRemote == null ? null : localRemote.Menu;
|
||||
}
|
||||
}
|
||||
|
||||
public Button Mute
|
||||
{
|
||||
get
|
||||
{
|
||||
var localRemote = (IHR33Button)_remote;
|
||||
return localRemote == null ? null : localRemote.Mute;
|
||||
}
|
||||
}
|
||||
|
||||
public Button NextTrack
|
||||
{
|
||||
get
|
||||
{
|
||||
var localRemote = (IHR33Button)_remote;
|
||||
return localRemote == null ? null : localRemote.NextTrack;
|
||||
}
|
||||
}
|
||||
|
||||
public Button Pause
|
||||
{
|
||||
get
|
||||
{
|
||||
var localRemote = (IHR33Button)_remote;
|
||||
return localRemote == null ? null : localRemote.Pause;
|
||||
}
|
||||
}
|
||||
|
||||
public Button Play
|
||||
{
|
||||
get
|
||||
{
|
||||
var localRemote = (IHR33Button)_remote;
|
||||
return localRemote == null ? null : localRemote.Play;
|
||||
}
|
||||
}
|
||||
|
||||
public Button Power
|
||||
{
|
||||
get
|
||||
{
|
||||
var localRemote = (IHR33Button)_remote;
|
||||
return localRemote == null ? null : localRemote.Power;
|
||||
}
|
||||
}
|
||||
|
||||
public Button PreviousTrack
|
||||
{
|
||||
get
|
||||
{
|
||||
var localRemote = (IHR33Button)_remote;
|
||||
return localRemote == null ? null : localRemote.PreviousTrack;
|
||||
}
|
||||
}
|
||||
|
||||
public Button Record
|
||||
{
|
||||
get
|
||||
{
|
||||
var localRemote = (IHR33Button)_remote;
|
||||
return localRemote == null ? null : localRemote.Record;
|
||||
}
|
||||
}
|
||||
|
||||
public Button Red
|
||||
{
|
||||
get
|
||||
{
|
||||
var localRemote = (IHR33Button)_remote;
|
||||
return localRemote == null ? null : localRemote.Red;
|
||||
}
|
||||
}
|
||||
|
||||
public Button Rewind
|
||||
{
|
||||
get
|
||||
{
|
||||
var localRemote = (IHR33Button)_remote;
|
||||
return localRemote == null ? null : localRemote.Rewind;
|
||||
}
|
||||
}
|
||||
|
||||
public Button Stop
|
||||
{
|
||||
get
|
||||
{
|
||||
var localRemote = (IHR33Button)_remote;
|
||||
return localRemote == null ? null : localRemote.Stop;
|
||||
}
|
||||
}
|
||||
|
||||
public Button VolumeDown
|
||||
{
|
||||
get
|
||||
{
|
||||
var localRemote = (IHR33Button)_remote;
|
||||
return localRemote == null ? null : localRemote.VolumeDown;
|
||||
}
|
||||
}
|
||||
|
||||
public Button VolumeUp
|
||||
{
|
||||
get
|
||||
{
|
||||
var localRemote = (IHR33Button)_remote;
|
||||
return localRemote == null ? null : localRemote.VolumeUp;
|
||||
}
|
||||
}
|
||||
|
||||
public Button Yellow
|
||||
{
|
||||
get
|
||||
{
|
||||
var localRemote = (IHR33Button)_remote;
|
||||
return localRemote == null ? null : localRemote.Yellow;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IButton Members
|
||||
|
||||
public CrestronCollection<Button> Button
|
||||
{
|
||||
get { return Buttons; }
|
||||
}
|
||||
|
||||
public event ButtonEventHandler ButtonStateChange;
|
||||
|
||||
public delegate void EssentialsButtonEventHandler(EssentialsDevice device, ButtonEventArgs args);
|
||||
|
||||
public event EssentialsButtonEventHandler EssentialsButtonStateChange;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
using System.Collections.Generic;
|
||||
using Crestron.SimplSharp.Scheduler;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Room.Config
|
||||
{
|
||||
public class EssentialsRoomScheduledEventsConfig
|
||||
{
|
||||
[JsonProperty("scheduledEvents")]
|
||||
public List<ScheduledEventConfig> ScheduledEvents;
|
||||
}
|
||||
|
||||
public class ScheduledEventConfig
|
||||
{
|
||||
[JsonProperty("key")]
|
||||
public string Key;
|
||||
|
||||
[JsonProperty("name")]
|
||||
public string Name;
|
||||
|
||||
[JsonProperty("days")]
|
||||
public ScheduledEventCommon.eWeekDays Days;
|
||||
|
||||
[JsonProperty("time")]
|
||||
public string Time;
|
||||
|
||||
[JsonProperty("actions")]
|
||||
public List<DeviceActionWrapper> Actions;
|
||||
|
||||
[JsonProperty("persistent")]
|
||||
public bool Persistent;
|
||||
|
||||
[JsonProperty("acknowledgeable")]
|
||||
public bool Acknowledgeable;
|
||||
|
||||
[JsonProperty("enable")]
|
||||
public bool Enable;
|
||||
}
|
||||
}
|
||||
@@ -1,58 +1,58 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharp.Scheduler;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.Core.Devices;
|
||||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public abstract class EssentialsRoomBase : ReconfigurableDevice
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public BoolFeedback OnFeedback { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Fires when the RoomOccupancy object is set
|
||||
/// </summary>
|
||||
public event EventHandler<EventArgs> RoomOccupancyIsSet;
|
||||
|
||||
public BoolFeedback IsWarmingUpFeedback { get; private set; }
|
||||
public BoolFeedback IsCoolingDownFeedback { get; private set; }
|
||||
|
||||
public IOccupancyStatusProvider RoomOccupancy { get; private set; }
|
||||
|
||||
public bool OccupancyStatusProviderIsRemote { get; private set; }
|
||||
|
||||
protected abstract Func<bool> IsWarmingFeedbackFunc { get; }
|
||||
protected abstract Func<bool> IsCoolingFeedbackFunc { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates if this room is Mobile Control Enabled
|
||||
/// </summary>
|
||||
public bool IsMobileControlEnabled { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The bridge for this room if Mobile Control is enabled
|
||||
/// </summary>
|
||||
public IMobileControlRoomBridge MobileControlRoomBridge { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The config name of the source list
|
||||
/// </summary>
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharp.Scheduler;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.Core.Devices;
|
||||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public abstract class EssentialsRoomBase : ReconfigurableDevice
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public BoolFeedback OnFeedback { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Fires when the RoomOccupancy object is set
|
||||
/// </summary>
|
||||
public event EventHandler<EventArgs> RoomOccupancyIsSet;
|
||||
|
||||
public BoolFeedback IsWarmingUpFeedback { get; private set; }
|
||||
public BoolFeedback IsCoolingDownFeedback { get; private set; }
|
||||
|
||||
public IOccupancyStatusProvider RoomOccupancy { get; private set; }
|
||||
|
||||
public bool OccupancyStatusProviderIsRemote { get; private set; }
|
||||
|
||||
protected abstract Func<bool> IsWarmingFeedbackFunc { get; }
|
||||
protected abstract Func<bool> IsCoolingFeedbackFunc { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates if this room is Mobile Control Enabled
|
||||
/// </summary>
|
||||
public bool IsMobileControlEnabled { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The bridge for this room if Mobile Control is enabled
|
||||
/// </summary>
|
||||
public IMobileControlRoomBridge MobileControlRoomBridge { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The config name of the source list
|
||||
/// </summary>
|
||||
///
|
||||
protected string _SourceListKey;
|
||||
protected string _SourceListKey;
|
||||
public virtual string SourceListKey {
|
||||
get
|
||||
{
|
||||
@@ -63,306 +63,306 @@ namespace PepperDash.Essentials.Core
|
||||
_SourceListKey = value;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Timer used for informing the UIs of a shutdown
|
||||
/// </summary>
|
||||
public SecondsCountdownTimer ShutdownPromptTimer { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public int ShutdownPromptSeconds { get; set; }
|
||||
public int ShutdownVacancySeconds { get; set; }
|
||||
public eShutdownType ShutdownType { get; private set; }
|
||||
|
||||
public EssentialsRoomEmergencyBase Emergency { get; set; }
|
||||
|
||||
public Core.Privacy.MicrophonePrivacyController MicrophonePrivacy { get; set; }
|
||||
|
||||
public string LogoUrlLightBkgnd { get; set; }
|
||||
|
||||
public string LogoUrlDarkBkgnd { get; set; }
|
||||
|
||||
protected SecondsCountdownTimer RoomVacancyShutdownTimer { get; private set; }
|
||||
|
||||
public eVacancyMode VacancyMode { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Seconds after vacancy prompt is displayed until shutdown
|
||||
/// </summary>
|
||||
protected int RoomVacancyShutdownSeconds;
|
||||
|
||||
/// <summary>
|
||||
/// Seconds after vacancy detected until prompt is displayed
|
||||
/// </summary>
|
||||
protected int RoomVacancyShutdownPromptSeconds;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
protected abstract Func<bool> OnFeedbackFunc { get; }
|
||||
|
||||
protected Dictionary<IBasicVolumeWithFeedback, uint> SavedVolumeLevels = new Dictionary<IBasicVolumeWithFeedback, uint>();
|
||||
|
||||
/// <summary>
|
||||
/// When volume control devices change, should we zero the one that we are leaving?
|
||||
/// </summary>
|
||||
public bool ZeroVolumeWhenSwtichingVolumeDevices { get; private set; }
|
||||
|
||||
|
||||
public EssentialsRoomBase(DeviceConfig config)
|
||||
: base(config)
|
||||
{
|
||||
// Setup the ShutdownPromptTimer
|
||||
ShutdownPromptTimer = new SecondsCountdownTimer(Key + "-offTimer");
|
||||
ShutdownPromptTimer.IsRunningFeedback.OutputChange += (o, a) =>
|
||||
{
|
||||
if (!ShutdownPromptTimer.IsRunningFeedback.BoolValue)
|
||||
ShutdownType = eShutdownType.None;
|
||||
};
|
||||
ShutdownPromptTimer.HasFinished += (o, a) => Shutdown(); // Shutdown is triggered
|
||||
|
||||
ShutdownPromptSeconds = 60;
|
||||
ShutdownVacancySeconds = 120;
|
||||
|
||||
ShutdownType = eShutdownType.None;
|
||||
|
||||
RoomVacancyShutdownTimer = new SecondsCountdownTimer(Key + "-vacancyOffTimer");
|
||||
//RoomVacancyShutdownTimer.IsRunningFeedback.OutputChange += (o, a) =>
|
||||
//{
|
||||
// if (!RoomVacancyShutdownTimer.IsRunningFeedback.BoolValue)
|
||||
// ShutdownType = ShutdownType.Vacancy;
|
||||
//};
|
||||
RoomVacancyShutdownTimer.HasFinished += new EventHandler<EventArgs>(RoomVacancyShutdownPromptTimer_HasFinished); // Shutdown is triggered
|
||||
|
||||
RoomVacancyShutdownPromptSeconds = 1500; // 25 min to prompt warning
|
||||
RoomVacancyShutdownSeconds = 240; // 4 min after prompt will trigger shutdown prompt
|
||||
VacancyMode = eVacancyMode.None;
|
||||
|
||||
OnFeedback = new BoolFeedback(OnFeedbackFunc);
|
||||
|
||||
IsWarmingUpFeedback = new BoolFeedback(IsWarmingFeedbackFunc);
|
||||
IsCoolingDownFeedback = new BoolFeedback(IsCoolingFeedbackFunc);
|
||||
|
||||
AddPostActivationAction(() =>
|
||||
{
|
||||
if (RoomOccupancy != null)
|
||||
OnRoomOccupancyIsSet();
|
||||
});
|
||||
}
|
||||
|
||||
public override bool CustomActivate()
|
||||
{
|
||||
SetUpMobileControl();
|
||||
|
||||
return base.CustomActivate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If mobile control is enabled, sets the appropriate properties
|
||||
/// </summary>
|
||||
void SetUpMobileControl()
|
||||
{
|
||||
var mcBridgeKey = string.Format("mobileControlBridge-{0}", Key);
|
||||
var mcBridge = DeviceManager.GetDeviceForKey(mcBridgeKey);
|
||||
if (mcBridge == null)
|
||||
{
|
||||
Debug.Console(1, this, "*********************Mobile Control Bridge Not found for this room.");
|
||||
IsMobileControlEnabled = false;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
MobileControlRoomBridge = mcBridge as IMobileControlRoomBridge;
|
||||
Debug.Console(1, this, "*********************Mobile Control Bridge found and enabled for this room");
|
||||
IsMobileControlEnabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
void RoomVacancyShutdownPromptTimer_HasFinished(object sender, EventArgs e)
|
||||
{
|
||||
switch (VacancyMode)
|
||||
{
|
||||
case eVacancyMode.None:
|
||||
StartRoomVacancyTimer(eVacancyMode.InInitialVacancy);
|
||||
break;
|
||||
case eVacancyMode.InInitialVacancy:
|
||||
StartRoomVacancyTimer(eVacancyMode.InShutdownWarning);
|
||||
break;
|
||||
case eVacancyMode.InShutdownWarning:
|
||||
{
|
||||
StartShutdown(eShutdownType.Vacancy);
|
||||
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Shutting Down due to vacancy.");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
public void StartShutdown(eShutdownType type)
|
||||
{
|
||||
// Check for shutdowns running. Manual should override other shutdowns
|
||||
|
||||
if (type == eShutdownType.Manual)
|
||||
ShutdownPromptTimer.SecondsToCount = ShutdownPromptSeconds;
|
||||
else if (type == eShutdownType.Vacancy)
|
||||
ShutdownPromptTimer.SecondsToCount = ShutdownVacancySeconds;
|
||||
ShutdownType = type;
|
||||
ShutdownPromptTimer.Start();
|
||||
|
||||
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "ShutdownPromptTimer Started. Type: {0}. Seconds: {1}", ShutdownType, ShutdownPromptTimer.SecondsToCount);
|
||||
}
|
||||
|
||||
public void StartRoomVacancyTimer(eVacancyMode mode)
|
||||
{
|
||||
if (mode == eVacancyMode.None)
|
||||
RoomVacancyShutdownTimer.SecondsToCount = RoomVacancyShutdownPromptSeconds;
|
||||
else if (mode == eVacancyMode.InInitialVacancy)
|
||||
RoomVacancyShutdownTimer.SecondsToCount = RoomVacancyShutdownSeconds;
|
||||
else if (mode == eVacancyMode.InShutdownWarning)
|
||||
RoomVacancyShutdownTimer.SecondsToCount = 60;
|
||||
VacancyMode = mode;
|
||||
RoomVacancyShutdownTimer.Start();
|
||||
|
||||
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Vacancy Timer Started. Mode: {0}. Seconds: {1}", VacancyMode, RoomVacancyShutdownTimer.SecondsToCount);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets the vacancy mode and shutsdwon the room
|
||||
/// </summary>
|
||||
public void Shutdown()
|
||||
{
|
||||
VacancyMode = eVacancyMode.None;
|
||||
EndShutdown();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This method is for the derived class to define it's specific shutdown
|
||||
/// requirements but should not be called directly. It is called by Shutdown()
|
||||
/// </summary>
|
||||
protected abstract void EndShutdown();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Override this to implement a default volume level(s) method
|
||||
/// </summary>
|
||||
public abstract void SetDefaultLevels();
|
||||
|
||||
/// <summary>
|
||||
/// Sets the object to be used as the IOccupancyStatusProvider for the room. Can be an Occupancy Aggregator or a specific device
|
||||
/// </summary>
|
||||
/// <param name="statusProvider"></param>
|
||||
public void SetRoomOccupancy(IOccupancyStatusProvider statusProvider, int timeoutMinutes)
|
||||
{
|
||||
if (statusProvider == null)
|
||||
{
|
||||
Debug.Console(0, this, "ERROR: Occupancy sensor device is null");
|
||||
return;
|
||||
}
|
||||
|
||||
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Room Occupancy set to device: '{0}'", (statusProvider as Device).Key);
|
||||
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Timeout Minutes from Config is: {0}", timeoutMinutes);
|
||||
|
||||
// If status provider is fusion, set flag to remote
|
||||
if (statusProvider is Core.Fusion.EssentialsHuddleSpaceFusionSystemControllerBase)
|
||||
OccupancyStatusProviderIsRemote = true;
|
||||
|
||||
if(timeoutMinutes > 0)
|
||||
RoomVacancyShutdownSeconds = timeoutMinutes * 60;
|
||||
|
||||
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "RoomVacancyShutdownSeconds set to {0}", RoomVacancyShutdownSeconds);
|
||||
|
||||
RoomOccupancy = statusProvider;
|
||||
|
||||
RoomOccupancy.RoomIsOccupiedFeedback.OutputChange -= RoomIsOccupiedFeedback_OutputChange;
|
||||
RoomOccupancy.RoomIsOccupiedFeedback.OutputChange += RoomIsOccupiedFeedback_OutputChange;
|
||||
|
||||
OnRoomOccupancyIsSet();
|
||||
}
|
||||
|
||||
void OnRoomOccupancyIsSet()
|
||||
{
|
||||
var handler = RoomOccupancyIsSet;
|
||||
if (handler != null)
|
||||
handler(this, new EventArgs());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// To allow base class to power room on to last source
|
||||
/// </summary>
|
||||
public abstract void PowerOnToDefaultOrLastSource();
|
||||
|
||||
/// <summary>
|
||||
/// To allow base class to power room on to default source
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public abstract bool RunDefaultPresentRoute();
|
||||
|
||||
void RoomIsOccupiedFeedback_OutputChange(object sender, EventArgs e)
|
||||
{
|
||||
if (RoomOccupancy.RoomIsOccupiedFeedback.BoolValue == false)
|
||||
{
|
||||
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "Notice: Vacancy Detected");
|
||||
// Trigger the timer when the room is vacant
|
||||
StartRoomVacancyTimer(eVacancyMode.InInitialVacancy);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "Notice: Occupancy Detected");
|
||||
// Reset the timer when the room is occupied
|
||||
RoomVacancyShutdownTimer.Cancel();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes when RoomVacancyShutdownTimer expires. Used to trigger specific room actions as needed. Must nullify the timer object when executed
|
||||
/// </summary>
|
||||
/// <param name="o"></param>
|
||||
public abstract void RoomVacatedForTimeoutPeriod(object o);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// To describe the various ways a room may be shutting down
|
||||
/// </summary>
|
||||
public enum eShutdownType
|
||||
{
|
||||
None = 0,
|
||||
External,
|
||||
Manual,
|
||||
Vacancy
|
||||
}
|
||||
|
||||
public enum eVacancyMode
|
||||
{
|
||||
None = 0,
|
||||
InInitialVacancy,
|
||||
InShutdownWarning
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public enum eWarmingCoolingMode
|
||||
{
|
||||
None,
|
||||
Warming,
|
||||
Cooling
|
||||
}
|
||||
|
||||
public abstract class EssentialsRoomEmergencyBase : IKeyed
|
||||
{
|
||||
public string Key { get; private set; }
|
||||
|
||||
public EssentialsRoomEmergencyBase(string key)
|
||||
{
|
||||
Key = key;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Timer used for informing the UIs of a shutdown
|
||||
/// </summary>
|
||||
public SecondsCountdownTimer ShutdownPromptTimer { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public int ShutdownPromptSeconds { get; set; }
|
||||
public int ShutdownVacancySeconds { get; set; }
|
||||
public eShutdownType ShutdownType { get; private set; }
|
||||
|
||||
public EssentialsRoomEmergencyBase Emergency { get; set; }
|
||||
|
||||
public Core.Privacy.MicrophonePrivacyController MicrophonePrivacy { get; set; }
|
||||
|
||||
public string LogoUrlLightBkgnd { get; set; }
|
||||
|
||||
public string LogoUrlDarkBkgnd { get; set; }
|
||||
|
||||
protected SecondsCountdownTimer RoomVacancyShutdownTimer { get; private set; }
|
||||
|
||||
public eVacancyMode VacancyMode { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Seconds after vacancy prompt is displayed until shutdown
|
||||
/// </summary>
|
||||
protected int RoomVacancyShutdownSeconds;
|
||||
|
||||
/// <summary>
|
||||
/// Seconds after vacancy detected until prompt is displayed
|
||||
/// </summary>
|
||||
protected int RoomVacancyShutdownPromptSeconds;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
protected abstract Func<bool> OnFeedbackFunc { get; }
|
||||
|
||||
protected Dictionary<IBasicVolumeWithFeedback, uint> SavedVolumeLevels = new Dictionary<IBasicVolumeWithFeedback, uint>();
|
||||
|
||||
/// <summary>
|
||||
/// When volume control devices change, should we zero the one that we are leaving?
|
||||
/// </summary>
|
||||
public bool ZeroVolumeWhenSwtichingVolumeDevices { get; private set; }
|
||||
|
||||
|
||||
public EssentialsRoomBase(DeviceConfig config)
|
||||
: base(config)
|
||||
{
|
||||
// Setup the ShutdownPromptTimer
|
||||
ShutdownPromptTimer = new SecondsCountdownTimer(Key + "-offTimer");
|
||||
ShutdownPromptTimer.IsRunningFeedback.OutputChange += (o, a) =>
|
||||
{
|
||||
if (!ShutdownPromptTimer.IsRunningFeedback.BoolValue)
|
||||
ShutdownType = eShutdownType.None;
|
||||
};
|
||||
ShutdownPromptTimer.HasFinished += (o, a) => Shutdown(); // Shutdown is triggered
|
||||
|
||||
ShutdownPromptSeconds = 60;
|
||||
ShutdownVacancySeconds = 120;
|
||||
|
||||
ShutdownType = eShutdownType.None;
|
||||
|
||||
RoomVacancyShutdownTimer = new SecondsCountdownTimer(Key + "-vacancyOffTimer");
|
||||
//RoomVacancyShutdownTimer.IsRunningFeedback.OutputChange += (o, a) =>
|
||||
//{
|
||||
// if (!RoomVacancyShutdownTimer.IsRunningFeedback.BoolValue)
|
||||
// ShutdownType = ShutdownType.Vacancy;
|
||||
//};
|
||||
RoomVacancyShutdownTimer.HasFinished += new EventHandler<EventArgs>(RoomVacancyShutdownPromptTimer_HasFinished); // Shutdown is triggered
|
||||
|
||||
RoomVacancyShutdownPromptSeconds = 1500; // 25 min to prompt warning
|
||||
RoomVacancyShutdownSeconds = 240; // 4 min after prompt will trigger shutdown prompt
|
||||
VacancyMode = eVacancyMode.None;
|
||||
|
||||
OnFeedback = new BoolFeedback(OnFeedbackFunc);
|
||||
|
||||
IsWarmingUpFeedback = new BoolFeedback(IsWarmingFeedbackFunc);
|
||||
IsCoolingDownFeedback = new BoolFeedback(IsCoolingFeedbackFunc);
|
||||
|
||||
AddPostActivationAction(() =>
|
||||
{
|
||||
if (RoomOccupancy != null)
|
||||
OnRoomOccupancyIsSet();
|
||||
});
|
||||
}
|
||||
|
||||
public override bool CustomActivate()
|
||||
{
|
||||
SetUpMobileControl();
|
||||
|
||||
return base.CustomActivate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If mobile control is enabled, sets the appropriate properties
|
||||
/// </summary>
|
||||
void SetUpMobileControl()
|
||||
{
|
||||
var mcBridgeKey = string.Format("mobileControlBridge-{0}", Key);
|
||||
var mcBridge = DeviceManager.GetDeviceForKey(mcBridgeKey);
|
||||
if (mcBridge == null)
|
||||
{
|
||||
Debug.Console(1, this, "*********************Mobile Control Bridge Not found for this room.");
|
||||
IsMobileControlEnabled = false;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
MobileControlRoomBridge = mcBridge as IMobileControlRoomBridge;
|
||||
Debug.Console(1, this, "*********************Mobile Control Bridge found and enabled for this room");
|
||||
IsMobileControlEnabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
void RoomVacancyShutdownPromptTimer_HasFinished(object sender, EventArgs e)
|
||||
{
|
||||
switch (VacancyMode)
|
||||
{
|
||||
case eVacancyMode.None:
|
||||
StartRoomVacancyTimer(eVacancyMode.InInitialVacancy);
|
||||
break;
|
||||
case eVacancyMode.InInitialVacancy:
|
||||
StartRoomVacancyTimer(eVacancyMode.InShutdownWarning);
|
||||
break;
|
||||
case eVacancyMode.InShutdownWarning:
|
||||
{
|
||||
StartShutdown(eShutdownType.Vacancy);
|
||||
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Shutting Down due to vacancy.");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
public void StartShutdown(eShutdownType type)
|
||||
{
|
||||
// Check for shutdowns running. Manual should override other shutdowns
|
||||
|
||||
if (type == eShutdownType.Manual)
|
||||
ShutdownPromptTimer.SecondsToCount = ShutdownPromptSeconds;
|
||||
else if (type == eShutdownType.Vacancy)
|
||||
ShutdownPromptTimer.SecondsToCount = ShutdownVacancySeconds;
|
||||
ShutdownType = type;
|
||||
ShutdownPromptTimer.Start();
|
||||
|
||||
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "ShutdownPromptTimer Started. Type: {0}. Seconds: {1}", ShutdownType, ShutdownPromptTimer.SecondsToCount);
|
||||
}
|
||||
|
||||
public void StartRoomVacancyTimer(eVacancyMode mode)
|
||||
{
|
||||
if (mode == eVacancyMode.None)
|
||||
RoomVacancyShutdownTimer.SecondsToCount = RoomVacancyShutdownPromptSeconds;
|
||||
else if (mode == eVacancyMode.InInitialVacancy)
|
||||
RoomVacancyShutdownTimer.SecondsToCount = RoomVacancyShutdownSeconds;
|
||||
else if (mode == eVacancyMode.InShutdownWarning)
|
||||
RoomVacancyShutdownTimer.SecondsToCount = 60;
|
||||
VacancyMode = mode;
|
||||
RoomVacancyShutdownTimer.Start();
|
||||
|
||||
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Vacancy Timer Started. Mode: {0}. Seconds: {1}", VacancyMode, RoomVacancyShutdownTimer.SecondsToCount);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets the vacancy mode and shutsdwon the room
|
||||
/// </summary>
|
||||
public void Shutdown()
|
||||
{
|
||||
VacancyMode = eVacancyMode.None;
|
||||
EndShutdown();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This method is for the derived class to define it's specific shutdown
|
||||
/// requirements but should not be called directly. It is called by Shutdown()
|
||||
/// </summary>
|
||||
protected abstract void EndShutdown();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Override this to implement a default volume level(s) method
|
||||
/// </summary>
|
||||
public abstract void SetDefaultLevels();
|
||||
|
||||
/// <summary>
|
||||
/// Sets the object to be used as the IOccupancyStatusProvider for the room. Can be an Occupancy Aggregator or a specific device
|
||||
/// </summary>
|
||||
/// <param name="statusProvider"></param>
|
||||
public void SetRoomOccupancy(IOccupancyStatusProvider statusProvider, int timeoutMinutes)
|
||||
{
|
||||
if (statusProvider == null)
|
||||
{
|
||||
Debug.Console(0, this, "ERROR: Occupancy sensor device is null");
|
||||
return;
|
||||
}
|
||||
|
||||
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Room Occupancy set to device: '{0}'", (statusProvider as Device).Key);
|
||||
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Timeout Minutes from Config is: {0}", timeoutMinutes);
|
||||
|
||||
// If status provider is fusion, set flag to remote
|
||||
if (statusProvider is Core.Fusion.EssentialsHuddleSpaceFusionSystemControllerBase)
|
||||
OccupancyStatusProviderIsRemote = true;
|
||||
|
||||
if(timeoutMinutes > 0)
|
||||
RoomVacancyShutdownSeconds = timeoutMinutes * 60;
|
||||
|
||||
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "RoomVacancyShutdownSeconds set to {0}", RoomVacancyShutdownSeconds);
|
||||
|
||||
RoomOccupancy = statusProvider;
|
||||
|
||||
RoomOccupancy.RoomIsOccupiedFeedback.OutputChange -= RoomIsOccupiedFeedback_OutputChange;
|
||||
RoomOccupancy.RoomIsOccupiedFeedback.OutputChange += RoomIsOccupiedFeedback_OutputChange;
|
||||
|
||||
OnRoomOccupancyIsSet();
|
||||
}
|
||||
|
||||
void OnRoomOccupancyIsSet()
|
||||
{
|
||||
var handler = RoomOccupancyIsSet;
|
||||
if (handler != null)
|
||||
handler(this, new EventArgs());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// To allow base class to power room on to last source
|
||||
/// </summary>
|
||||
public abstract void PowerOnToDefaultOrLastSource();
|
||||
|
||||
/// <summary>
|
||||
/// To allow base class to power room on to default source
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public abstract bool RunDefaultPresentRoute();
|
||||
|
||||
void RoomIsOccupiedFeedback_OutputChange(object sender, EventArgs e)
|
||||
{
|
||||
if (RoomOccupancy.RoomIsOccupiedFeedback.BoolValue == false)
|
||||
{
|
||||
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "Notice: Vacancy Detected");
|
||||
// Trigger the timer when the room is vacant
|
||||
StartRoomVacancyTimer(eVacancyMode.InInitialVacancy);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "Notice: Occupancy Detected");
|
||||
// Reset the timer when the room is occupied
|
||||
RoomVacancyShutdownTimer.Cancel();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes when RoomVacancyShutdownTimer expires. Used to trigger specific room actions as needed. Must nullify the timer object when executed
|
||||
/// </summary>
|
||||
/// <param name="o"></param>
|
||||
public abstract void RoomVacatedForTimeoutPeriod(object o);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// To describe the various ways a room may be shutting down
|
||||
/// </summary>
|
||||
public enum eShutdownType
|
||||
{
|
||||
None = 0,
|
||||
External,
|
||||
Manual,
|
||||
Vacancy
|
||||
}
|
||||
|
||||
public enum eVacancyMode
|
||||
{
|
||||
None = 0,
|
||||
InInitialVacancy,
|
||||
InShutdownWarning
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public enum eWarmingCoolingMode
|
||||
{
|
||||
None,
|
||||
Warming,
|
||||
Cooling
|
||||
}
|
||||
|
||||
public abstract class EssentialsRoomEmergencyBase : IKeyed
|
||||
{
|
||||
public string Key { get; private set; }
|
||||
|
||||
public EssentialsRoomEmergencyBase(string key)
|
||||
{
|
||||
Key = key;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -41,6 +41,14 @@ namespace PepperDash.Essentials.Core
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Simplified routing direct from source to destination
|
||||
/// </summary>
|
||||
public interface IRunDirectRouteAction
|
||||
{
|
||||
void RunDirectRoute(string sourceKey, string destinationKey);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// For rooms that default presentation only routing
|
||||
/// </summary>
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace PepperDash.Essentials.Core
|
||||
/// <summary>
|
||||
/// For fixed-source endpoint devices
|
||||
/// </summary>
|
||||
[Obsolete]
|
||||
[Obsolete("Please switch to IRoutingSink")]
|
||||
public interface IRoutingSinkNoSwitching : IRoutingSink
|
||||
{
|
||||
|
||||
@@ -111,10 +111,87 @@ namespace PepperDash.Essentials.Core
|
||||
IntFeedback AudioVideoSourceNumericFeedback { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
/// <summary>
|
||||
/// Defines an IRmcRouting with a feedback event
|
||||
/// </summary>
|
||||
public interface ITxRoutingWithFeedback : ITxRouting
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines an IRmcRouting with a feedback event
|
||||
/// </summary>
|
||||
public interface IRmcRoutingWithFeedback : IRmcRouting
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines an IRoutingOutputs devices as being a source - the start of the chain
|
||||
/// </summary>
|
||||
public interface IRoutingSource : IRoutingOutputs
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines an event structure for reporting output route data
|
||||
/// </summary>
|
||||
public interface IRoutingFeedback : IKeyName
|
||||
{
|
||||
event EventHandler<RoutingNumericEventArgs> NumericSwitchChange;
|
||||
//void OnSwitchChange(RoutingNumericEventArgs e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines an IRoutingNumeric with a feedback event
|
||||
/// </summary>
|
||||
public interface IRoutingNumericWithFeedback : IRoutingNumeric, IRoutingFeedback
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines an IRouting with a feedback event
|
||||
/// </summary>
|
||||
public interface IRoutingWithFeedback : IRouting, IRoutingFeedback
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class RoutingNumericEventArgs : EventArgs
|
||||
{
|
||||
|
||||
public uint? Output { get; set; }
|
||||
public uint? Input { get; set; }
|
||||
|
||||
public eRoutingSignalType SigType { get; set; }
|
||||
public RoutingInputPort InputPort { get; set; }
|
||||
public RoutingOutputPort OutputPort { get; set; }
|
||||
|
||||
public RoutingNumericEventArgs(uint output, uint input, eRoutingSignalType sigType) : this(output, input, null, null, sigType)
|
||||
{
|
||||
}
|
||||
|
||||
public RoutingNumericEventArgs(RoutingOutputPort outputPort, RoutingInputPort inputPort,
|
||||
eRoutingSignalType sigType)
|
||||
: this(null, null, outputPort, inputPort, sigType)
|
||||
{
|
||||
}
|
||||
|
||||
public RoutingNumericEventArgs()
|
||||
: this(null, null, null, null, 0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public RoutingNumericEventArgs(uint? output, uint? input, RoutingOutputPort outputPort,
|
||||
RoutingInputPort inputPort, eRoutingSignalType sigType)
|
||||
{
|
||||
OutputPort = outputPort;
|
||||
InputPort = inputPort;
|
||||
|
||||
Output = output;
|
||||
Input = input;
|
||||
SigType = sigType;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -251,6 +251,12 @@ namespace PepperDash.Essentials.Core
|
||||
tl.StringInput[sigNum].StringValue = value;
|
||||
}
|
||||
|
||||
public static void SetString(this BasicTriList tl, uint sigNum, string value, eStringEncoding encoding)
|
||||
{
|
||||
tl.StringInput[sigNum].StringEncoding = encoding;
|
||||
tl.StringInput[sigNum].StringValue = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns bool value of trilist sig
|
||||
/// </summary>
|
||||
|
||||
@@ -17,7 +17,7 @@ using PepperDash.Essentials.Core.Config;
|
||||
namespace PepperDash.Essentials.DM.AirMedia
|
||||
{
|
||||
[Description("Wrapper class for an AM-200 or AM-300")]
|
||||
public class AirMediaController : CrestronGenericBridgeableBaseDevice, IRoutingNumeric, IIROutputPorts, IComPorts
|
||||
public class AirMediaController : CrestronGenericBridgeableBaseDevice, IRoutingNumericWithFeedback, IIROutputPorts, IComPorts
|
||||
{
|
||||
public AmX00 AirMedia { get; private set; }
|
||||
|
||||
@@ -29,6 +29,10 @@ namespace PepperDash.Essentials.DM.AirMedia
|
||||
|
||||
public RoutingPortCollection<RoutingOutputPort> OutputPorts { get; private set; }
|
||||
|
||||
|
||||
//IroutingNumericEvent
|
||||
public event EventHandler<RoutingNumericEventArgs> NumericSwitchChange;
|
||||
|
||||
public BoolFeedback IsInSessionFeedback { get; private set; }
|
||||
public IntFeedback ErrorFeedback { get; private set; }
|
||||
public IntFeedback NumberOfUsersConnectedFeedback { get; set; }
|
||||
@@ -43,6 +47,7 @@ namespace PepperDash.Essentials.DM.AirMedia
|
||||
public AirMediaController(string key, string name, AmX00 device, DeviceConfig dc, AirMediaPropertiesConfig props)
|
||||
: base(key, name, device)
|
||||
{
|
||||
|
||||
AirMedia = device;
|
||||
|
||||
DeviceConfig = dc;
|
||||
@@ -53,21 +58,36 @@ namespace PepperDash.Essentials.DM.AirMedia
|
||||
OutputPorts = new RoutingPortCollection<RoutingOutputPort>();
|
||||
|
||||
InputPorts.Add(new RoutingInputPort(DmPortName.Osd, eRoutingSignalType.AudioVideo,
|
||||
eRoutingPortConnectionType.None, new Action(SelectPinPointUxLandingPage), this));
|
||||
eRoutingPortConnectionType.None, new Action(SelectPinPointUxLandingPage), this)
|
||||
{
|
||||
FeedbackMatchObject = 0
|
||||
});
|
||||
|
||||
InputPorts.Add(new RoutingInputPort(DmPortName.AirMediaIn, eRoutingSignalType.AudioVideo,
|
||||
eRoutingPortConnectionType.Streaming, new Action(SelectAirMedia), this));
|
||||
eRoutingPortConnectionType.Streaming, new Action(SelectAirMedia), this)
|
||||
{
|
||||
FeedbackMatchObject = 1
|
||||
});
|
||||
|
||||
InputPorts.Add(new RoutingInputPort(DmPortName.HdmiIn, eRoutingSignalType.AudioVideo,
|
||||
eRoutingPortConnectionType.Hdmi, new Action(SelectHdmiIn), this));
|
||||
eRoutingPortConnectionType.Hdmi, new Action(SelectHdmiIn), this)
|
||||
{
|
||||
FeedbackMatchObject = 2
|
||||
});
|
||||
|
||||
InputPorts.Add(new RoutingInputPort(DmPortName.AirBoardIn, eRoutingSignalType.AudioVideo,
|
||||
eRoutingPortConnectionType.None, new Action(SelectAirboardIn), this));
|
||||
eRoutingPortConnectionType.None, new Action(SelectAirboardIn), this)
|
||||
{
|
||||
FeedbackMatchObject = 4
|
||||
});
|
||||
|
||||
if (AirMedia is Am300)
|
||||
{
|
||||
InputPorts.Add(new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.AudioVideo,
|
||||
eRoutingPortConnectionType.DmCat, new Action(SelectDmIn), this));
|
||||
eRoutingPortConnectionType.DmCat, new Action(SelectDmIn), this)
|
||||
{
|
||||
FeedbackMatchObject = 3
|
||||
});
|
||||
}
|
||||
|
||||
OutputPorts.Add(new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.AudioVideo,
|
||||
@@ -153,6 +173,17 @@ namespace PepperDash.Essentials.DM.AirMedia
|
||||
SerialNumberFeedback.LinkInputSig(trilist.StringInput[joinMap.SerialNumberFeedback.JoinNumber]);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raise an event when the status of a switch object changes.
|
||||
/// </summary>
|
||||
/// <param name="e">Arguments defined as IKeyName sender, output, input, and eRoutingSignalType</param>
|
||||
private void OnSwitchChange(RoutingNumericEventArgs e)
|
||||
{
|
||||
var newEvent = NumericSwitchChange;
|
||||
if (newEvent != null) newEvent(this, e);
|
||||
}
|
||||
|
||||
|
||||
void AirMedia_AirMediaChange(object sender, Crestron.SimplSharpPro.DeviceSupport.GenericEventArgs args)
|
||||
{
|
||||
if (args.EventId == AirMediaInputSlot.AirMediaStatusFeedbackEventId)
|
||||
@@ -172,12 +203,20 @@ namespace PepperDash.Essentials.DM.AirMedia
|
||||
void DisplayControl_DisplayControlChange(object sender, Crestron.SimplSharpPro.DeviceSupport.GenericEventArgs args)
|
||||
{
|
||||
if (args.EventId == AmX00.VideoOutFeedbackEventId)
|
||||
{
|
||||
VideoOutFeedback.FireUpdate();
|
||||
|
||||
var localInputPort =
|
||||
InputPorts.FirstOrDefault(p => (int) p.FeedbackMatchObject == VideoOutFeedback.UShortValue);
|
||||
|
||||
OnSwitchChange(new RoutingNumericEventArgs(1, VideoOutFeedback.UShortValue, OutputPorts.First(),
|
||||
localInputPort, eRoutingSignalType.AudioVideo));
|
||||
}
|
||||
else if (args.EventId == AmX00.EnableAutomaticRoutingFeedbackEventId)
|
||||
AutomaticInputRoutingEnabledFeedback.FireUpdate();
|
||||
}
|
||||
|
||||
void HdmiIn_StreamChange(Crestron.SimplSharpPro.DeviceSupport.Stream stream, Crestron.SimplSharpPro.DeviceSupport.StreamEventArgs args)
|
||||
void HdmiIn_StreamChange(Stream stream, Crestron.SimplSharpPro.DeviceSupport.StreamEventArgs args)
|
||||
{
|
||||
if (args.EventId == DMInputEventIds.SourceSyncEventId)
|
||||
HdmiVideoSyncDetectedFeedback.FireUpdate();
|
||||
|
||||
@@ -21,12 +21,15 @@ namespace PepperDash.Essentials.DM {
|
||||
/// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions
|
||||
///
|
||||
/// </summary>
|
||||
public class DmBladeChassisController : CrestronGenericBridgeableBaseDevice, IDmSwitch, IRoutingNumeric
|
||||
public class DmBladeChassisController : CrestronGenericBridgeableBaseDevice, IDmSwitch, IRoutingNumericWithFeedback
|
||||
{
|
||||
public DMChassisPropertiesConfig PropertiesConfig { get; set; }
|
||||
|
||||
public Switch Chassis { get; private set; }
|
||||
|
||||
//IroutingNumericEvent
|
||||
public event EventHandler<RoutingNumericEventArgs> NumericSwitchChange;
|
||||
|
||||
// Feedbacks for EssentialDM
|
||||
public Dictionary<uint, IntFeedback> VideoOutputFeedbacks { get; private set; }
|
||||
public Dictionary<uint, IntFeedback> AudioOutputFeedbacks { get; private set; }
|
||||
@@ -287,6 +290,15 @@ namespace PepperDash.Essentials.DM {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raise an event when the status of a switch object changes.
|
||||
/// </summary>
|
||||
/// <param name="e">Arguments defined as IKeyName sender, output, input, and eRoutingSignalType</param>
|
||||
private void OnSwitchChange(RoutingNumericEventArgs e)
|
||||
{
|
||||
var newEvent = NumericSwitchChange;
|
||||
if (newEvent != null) newEvent(this, e);
|
||||
}
|
||||
|
||||
|
||||
void AddHdmiInBladePorts(uint number, ICec cecPort) {
|
||||
@@ -377,7 +389,10 @@ namespace PepperDash.Essentials.DM {
|
||||
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);
|
||||
var inputPort = new RoutingInputPort(portKey, sigType, portType, cardNum, this)
|
||||
{
|
||||
FeedbackMatchObject = Chassis.Inputs[cardNum]
|
||||
};
|
||||
|
||||
InputPorts.Add(inputPort);
|
||||
}
|
||||
@@ -385,19 +400,20 @@ namespace PepperDash.Essentials.DM {
|
||||
/// <summary>
|
||||
/// Adds InputPort and sets Port as ICec object
|
||||
/// </summary>
|
||||
void AddInputPortWithDebug(uint cardNum, string portName, eRoutingSignalType sigType, eRoutingPortConnectionType portType, ICec cecPort) {
|
||||
private void AddInputPortWithDebug(uint cardNum, string portName, eRoutingSignalType sigType,
|
||||
eRoutingPortConnectionType portType, ICec cecPort)
|
||||
{
|
||||
var portKey = string.Format("inputCard{0}--{1}", cardNum, portName);
|
||||
Debug.Console(2, this, "Adding input port '{0}'", portKey);
|
||||
var inputPort = new RoutingInputPort(portKey, sigType, portType, cardNum, this);
|
||||
var inputPort = new RoutingInputPort(portKey, sigType, portType, cardNum, this)
|
||||
{
|
||||
FeedbackMatchObject = Chassis.Inputs[cardNum]
|
||||
};
|
||||
|
||||
if (inputPort != null) {
|
||||
if (cecPort != null)
|
||||
inputPort.Port = cecPort;
|
||||
if (cecPort != null)
|
||||
inputPort.Port = cecPort;
|
||||
|
||||
InputPorts.Add(inputPort);
|
||||
}
|
||||
else
|
||||
Debug.Console(2, this, "inputPort is null");
|
||||
InputPorts.Add(inputPort);
|
||||
}
|
||||
|
||||
|
||||
@@ -407,7 +423,10 @@ namespace PepperDash.Essentials.DM {
|
||||
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));
|
||||
OutputPorts.Add(new RoutingOutputPort(portKey, sigType, portType, selector, this)
|
||||
{
|
||||
FeedbackMatchObject = Chassis.Outputs[(uint)selector]
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -458,54 +477,84 @@ namespace PepperDash.Essentials.DM {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// </summary>
|
||||
void Chassis_DMOutputChange(Switch device, DMOutputEventArgs args)
|
||||
private void Chassis_DMOutputChange(Switch device, DMOutputEventArgs args)
|
||||
{
|
||||
var output = args.Number;
|
||||
|
||||
switch (args.EventId) {
|
||||
case DMOutputEventIds.VolumeEventId: {
|
||||
if (VolumeControls.ContainsKey(output)) {
|
||||
VolumeControls[args.Number].VolumeEventFromChassis();
|
||||
}
|
||||
break;
|
||||
switch (args.EventId)
|
||||
{
|
||||
case DMOutputEventIds.VolumeEventId:
|
||||
{
|
||||
if (VolumeControls.ContainsKey(output))
|
||||
{
|
||||
VolumeControls[args.Number].VolumeEventFromChassis();
|
||||
}
|
||||
case DMOutputEventIds.EndpointOnlineEventId: {
|
||||
Debug.Console(2, this, "Output {0} DMOutputEventIds.EndpointOnlineEventId fired. EndpointOnlineFeedback State: {1}", args.Number, Chassis.Outputs[output].EndpointOnlineFeedback);
|
||||
if(Chassis.Outputs[output].Endpoint != null)
|
||||
Debug.Console(2, this, "Output {0} DMOutputEventIds.EndpointOnlineEventId fired. Endpoint.IsOnline State: {1}", args.Number, Chassis.Outputs[output].Endpoint.IsOnline);
|
||||
break;
|
||||
}
|
||||
case DMOutputEventIds.EndpointOnlineEventId:
|
||||
{
|
||||
Debug.Console(2, this,
|
||||
"Output {0} DMOutputEventIds.EndpointOnlineEventId fired. EndpointOnlineFeedback State: {1}",
|
||||
args.Number, Chassis.Outputs[output].EndpointOnlineFeedback);
|
||||
if (Chassis.Outputs[output].Endpoint != null)
|
||||
Debug.Console(2, this,
|
||||
"Output {0} DMOutputEventIds.EndpointOnlineEventId fired. Endpoint.IsOnline State: {1}",
|
||||
args.Number, Chassis.Outputs[output].Endpoint.IsOnline);
|
||||
|
||||
OutputEndpointOnlineFeedbacks[output].FireUpdate();
|
||||
break;
|
||||
}
|
||||
case DMOutputEventIds.OnlineFeedbackEventId: {
|
||||
Debug.Console(2, this, "Output {0} DMInputEventIds.OnlineFeedbackEventId fired. State: {1}", args.Number, Chassis.Outputs[output].EndpointOnlineFeedback);
|
||||
OutputEndpointOnlineFeedbacks[output].FireUpdate();
|
||||
break;
|
||||
}
|
||||
case DMOutputEventIds.VideoOutEventId: {
|
||||
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();
|
||||
OutputEndpointOnlineFeedbacks[output].FireUpdate();
|
||||
break;
|
||||
}
|
||||
case DMOutputEventIds.OnlineFeedbackEventId:
|
||||
{
|
||||
Debug.Console(2, this, "Output {0} DMInputEventIds.OnlineFeedbackEventId fired. State: {1}",
|
||||
args.Number, Chassis.Outputs[output].EndpointOnlineFeedback);
|
||||
OutputEndpointOnlineFeedbacks[output].FireUpdate();
|
||||
break;
|
||||
}
|
||||
case DMOutputEventIds.VideoOutEventId:
|
||||
{
|
||||
|
||||
var inputNumber = Chassis.Outputs[output].VideoOutFeedback == null ? 0 : Chassis.Outputs[output].VideoOutFeedback.Number;
|
||||
|
||||
Debug.Console(2, this, "DMSwitchAudioVideo:{0} Routed Input:{1} Output:{2}'", this.Name,
|
||||
inputNumber, output);
|
||||
|
||||
if (VideoOutputFeedbacks.ContainsKey(output))
|
||||
{
|
||||
var localInputPort = InputPorts.FirstOrDefault(p => (DMInput)p.FeedbackMatchObject == Chassis.Outputs[output].VideoOutFeedback);
|
||||
var localOutputPort =
|
||||
OutputPorts.FirstOrDefault(p => (DMOutput) p.FeedbackMatchObject == Chassis.Outputs[output]);
|
||||
|
||||
|
||||
VideoOutputFeedbacks[output].FireUpdate();
|
||||
OnSwitchChange(new RoutingNumericEventArgs(output,
|
||||
inputNumber,
|
||||
localOutputPort,
|
||||
localInputPort,
|
||||
eRoutingSignalType.AudioVideo));
|
||||
|
||||
}
|
||||
if (OutputVideoRouteNameFeedbacks.ContainsKey(output)) {
|
||||
OutputVideoRouteNameFeedbacks[output].FireUpdate();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DMOutputEventIds.OutputNameEventId: {
|
||||
Debug.Console(2, this, "DM Output {0} NameFeedbackEventId", output);
|
||||
OutputNameFeedbacks[output].FireUpdate();
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
Debug.Console(2, this, "DMOutputChange fired for Output {0} with Unhandled EventId: {1}", args.Number, args.EventId);
|
||||
break;
|
||||
if (OutputVideoRouteNameFeedbacks.ContainsKey(output))
|
||||
{
|
||||
OutputVideoRouteNameFeedbacks[output].FireUpdate();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DMOutputEventIds.OutputNameEventId:
|
||||
{
|
||||
Debug.Console(2, this, "DM Output {0} NameFeedbackEventId", output);
|
||||
OutputNameFeedbacks[output].FireUpdate();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
Debug.Console(2, this, "DMOutputChange fired for Output {0} with Unhandled EventId: {1}",
|
||||
args.Number, args.EventId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,12 +20,15 @@ namespace PepperDash.Essentials.DM
|
||||
/// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions
|
||||
///
|
||||
/// </summary>
|
||||
[Description("Wrapper class for all DM-MD chassis variants from 8x8 to 32x32")]
|
||||
public class DmChassisController : CrestronGenericBridgeableBaseDevice, IDmSwitch, IRoutingNumeric
|
||||
[Description("Wrapper class for all DM-MD chassis variants from 8x8 to 32x32")]
|
||||
public class DmChassisController : CrestronGenericBridgeableBaseDevice, IDmSwitch, IRoutingNumericWithFeedback
|
||||
{
|
||||
public DMChassisPropertiesConfig PropertiesConfig { get; set; }
|
||||
|
||||
public Switch Chassis { get; private set; }
|
||||
public Switch Chassis { get; private set; }
|
||||
|
||||
//IroutingNumericEvent
|
||||
public event EventHandler<RoutingNumericEventArgs> NumericSwitchChange;
|
||||
|
||||
// Feedbacks for EssentialDM
|
||||
public Dictionary<uint, IntFeedback> VideoOutputFeedbacks { get; private set; }
|
||||
@@ -46,7 +49,9 @@ namespace PepperDash.Essentials.DM
|
||||
public BoolFeedback EnableAudioBreakawayFeedback { get; private set; }
|
||||
public BoolFeedback EnableUsbBreakawayFeedback { get; private set; }
|
||||
|
||||
public Dictionary<uint, IntFeedback> InputCardHdcpStateFeedbacks { get; private set; }
|
||||
public Dictionary<uint, IntFeedback> InputCardHdcpStateFeedbacks { get; private set; }
|
||||
public Dictionary<uint, IntFeedback> InputStreamCardStateFeedbacks { get; private set; }
|
||||
public Dictionary<uint, IntFeedback> OutputStreamCardStateFeedbacks { get; private set; }
|
||||
|
||||
public Dictionary<uint, eHdcpCapabilityType> InputCardHdcpCapabilityTypes { get; private set; }
|
||||
|
||||
@@ -187,7 +192,8 @@ namespace PepperDash.Essentials.DM
|
||||
/// <param name="chassis"></param>
|
||||
public DmChassisController(string key, string name, DmMDMnxn chassis)
|
||||
: base(key, name, chassis)
|
||||
{
|
||||
{
|
||||
|
||||
Chassis = chassis;
|
||||
InputPorts = new RoutingPortCollection<RoutingInputPort>();
|
||||
OutputPorts = new RoutingPortCollection<RoutingOutputPort>();
|
||||
@@ -219,7 +225,9 @@ namespace PepperDash.Essentials.DM
|
||||
EnableUsbBreakawayFeedback =
|
||||
new BoolFeedback(() => (Chassis as DmMDMnxn).EnableUSBBreakawayFeedback.BoolValue);
|
||||
|
||||
InputCardHdcpStateFeedbacks = new Dictionary<uint, IntFeedback>();
|
||||
InputCardHdcpStateFeedbacks = new Dictionary<uint, IntFeedback>();
|
||||
InputStreamCardStateFeedbacks = new Dictionary<uint, IntFeedback>();
|
||||
OutputStreamCardStateFeedbacks = new Dictionary<uint, IntFeedback>();
|
||||
InputCardHdcpCapabilityTypes = new Dictionary<uint, eHdcpCapabilityType>();
|
||||
|
||||
for (uint x = 1; x <= Chassis.NumberOfOutputs; x++)
|
||||
@@ -303,6 +311,33 @@ namespace PepperDash.Essentials.DM
|
||||
// return hdMdNxMHdmiOutput.HdmiOutputPort.DisabledByHdcpFeedback.BoolValue;
|
||||
|
||||
return false;
|
||||
});
|
||||
OutputStreamCardStateFeedbacks[tempX] = new IntFeedback(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var outputCard = Chassis.Outputs[tempX];
|
||||
|
||||
if (outputCard.Card is DmcStroAV)
|
||||
{
|
||||
Debug.Console(2, "Found output stream card in slot: {0}.", tempX);
|
||||
var streamCard = outputCard.Card as DmcStroAV;
|
||||
if (streamCard.Control.StartFeedback.BoolValue == true)
|
||||
return 1;
|
||||
else if (streamCard.Control.StopFeedback.BoolValue == true)
|
||||
return 2;
|
||||
else if (streamCard.Control.PauseFeedback.BoolValue == true)
|
||||
return 3;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
catch (InvalidOperationException iopex)
|
||||
{
|
||||
Debug.Console(0, this, Debug.ErrorLogLevel.Warning, "Error adding output stream card in slot: {0}. Error: {1}", tempX, iopex);
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -402,6 +437,33 @@ namespace PepperDash.Essentials.DM
|
||||
Debug.Console(0, this, Debug.ErrorLogLevel.Warning, "The Input Card in slot: {0} supports HDCP 2. Please update the configuration value in the inputCardSupportsHdcp2 object to true. Error: {1}", tempX, iopex);
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
InputStreamCardStateFeedbacks[tempX] = new IntFeedback(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var inputCard = Chassis.Inputs[tempX];
|
||||
|
||||
if (inputCard.Card is DmcStr)
|
||||
{
|
||||
Debug.Console(2, "Found input stream card in slot: {0}.", tempX);
|
||||
var streamCard = inputCard.Card as DmcStr;
|
||||
if (streamCard.Control.StartFeedback.BoolValue == true)
|
||||
return 1;
|
||||
else if (streamCard.Control.StopFeedback.BoolValue == true)
|
||||
return 2;
|
||||
else if (streamCard.Control.PauseFeedback.BoolValue == true)
|
||||
return 3;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
catch (InvalidOperationException iopex)
|
||||
{
|
||||
Debug.Console(0, this, Debug.ErrorLogLevel.Warning, "Error adding input stream card in slot: {0}. Error: {1}", tempX, iopex);
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -737,7 +799,10 @@ namespace PepperDash.Essentials.DM
|
||||
{
|
||||
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);
|
||||
var inputPort = new RoutingInputPort(portKey, sigType, portType, cardNum, this)
|
||||
{
|
||||
FeedbackMatchObject = Chassis.Inputs[cardNum]
|
||||
};
|
||||
|
||||
InputPorts.Add(inputPort);
|
||||
}
|
||||
@@ -749,12 +814,15 @@ namespace PepperDash.Essentials.DM
|
||||
{
|
||||
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);
|
||||
var inputPort = new RoutingInputPort(portKey, sigType, portType, cardNum, this)
|
||||
{
|
||||
FeedbackMatchObject = Chassis.Inputs[cardNum]
|
||||
}; ;
|
||||
|
||||
if (cecPort != null)
|
||||
inputPort.Port = cecPort;
|
||||
|
||||
InputPorts.Add(inputPort);
|
||||
InputPorts.Add(inputPort);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -763,8 +831,16 @@ namespace PepperDash.Essentials.DM
|
||||
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));
|
||||
Debug.Console(2, this, "Adding output port '{0}'", portKey);
|
||||
|
||||
var outputPort = new RoutingOutputPort(portKey, sigType, portType, selector, this);
|
||||
|
||||
if (portName.IndexOf("Loop", StringComparison.InvariantCultureIgnoreCase) < 0)
|
||||
{
|
||||
outputPort.FeedbackMatchObject = Chassis.Outputs[(uint) selector];
|
||||
}
|
||||
|
||||
OutputPorts.Add(outputPort);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -773,13 +849,17 @@ namespace PepperDash.Essentials.DM
|
||||
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);
|
||||
|
||||
Debug.Console(2, this, "Adding output port '{0}'", portKey);
|
||||
var outputPort = new RoutingOutputPort(portKey, sigType, portType, selector, this);
|
||||
|
||||
if (portName.IndexOf("Loop", StringComparison.InvariantCultureIgnoreCase) < 0)
|
||||
{
|
||||
outputPort.FeedbackMatchObject = Chassis.Outputs[(uint)selector];
|
||||
}
|
||||
if (cecPort != null)
|
||||
outputPort.Port = cecPort;
|
||||
|
||||
OutputPorts.Add(outputPort);
|
||||
OutputPorts.Add(outputPort);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -893,6 +973,19 @@ namespace PepperDash.Essentials.DM
|
||||
else
|
||||
Debug.Console(1, this, "No index of {0} found in InputCardHdcpCapabilityFeedbacks");
|
||||
break;
|
||||
}
|
||||
case DMInputEventIds.StartEventId:
|
||||
case DMInputEventIds.StopEventId:
|
||||
case DMInputEventIds.PauseEventId:
|
||||
{
|
||||
Debug.Console(2, this, "DM Input {0} Stream Status EventId", args.Number);
|
||||
if (InputStreamCardStateFeedbacks[args.Number] != null)
|
||||
{
|
||||
InputStreamCardStateFeedbacks[args.Number].FireUpdate();
|
||||
}
|
||||
else
|
||||
Debug.Console(2, this, "No index of {0} found in InputStreamCardStateFeedbacks");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
@@ -905,6 +998,17 @@ namespace PepperDash.Essentials.DM
|
||||
{
|
||||
Debug.Console(2, this, Debug.ErrorLogLevel.Error, "Error in Chassis_DMInputChange: {0}", ex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
/// Raise an event when the status of a switch object changes.
|
||||
/// </summary>
|
||||
/// <param name="e">Arguments defined as IKeyName sender, output, input, and eRoutingSignalType</param>
|
||||
private void OnSwitchChange(RoutingNumericEventArgs e)
|
||||
{
|
||||
var newEvent = NumericSwitchChange;
|
||||
if (newEvent != null) newEvent(this, e);
|
||||
}
|
||||
|
||||
///
|
||||
@@ -938,30 +1042,59 @@ namespace PepperDash.Essentials.DM
|
||||
OutputEndpointOnlineFeedbacks[output].FireUpdate();
|
||||
break;
|
||||
}
|
||||
case DMOutputEventIds.VideoOutEventId:
|
||||
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();
|
||||
|
||||
|
||||
var inputNumber = Chassis.Outputs[output].VideoOutFeedback == null ? 0 : Chassis.
|
||||
Outputs[output].VideoOutFeedback.Number;
|
||||
|
||||
Debug.Console(2, this, "DMSwitchVideo:{0} Routed Input:{1} Output:{2}'", this.Name, inputNumber, output);
|
||||
|
||||
if (VideoOutputFeedbacks.ContainsKey(output))
|
||||
{
|
||||
var localInputPort = InputPorts.FirstOrDefault(p => (DMInput)p.FeedbackMatchObject == Chassis.Outputs[output].VideoOutFeedback);
|
||||
var localOutputPort =
|
||||
OutputPorts.FirstOrDefault(p => (DMOutput) p.FeedbackMatchObject == Chassis.Outputs[output]);
|
||||
|
||||
|
||||
VideoOutputFeedbacks[output].FireUpdate();
|
||||
OnSwitchChange(new RoutingNumericEventArgs(output,
|
||||
inputNumber,
|
||||
localOutputPort,
|
||||
localInputPort,
|
||||
eRoutingSignalType.Video));
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
case DMOutputEventIds.AudioOutEventId:
|
||||
{
|
||||
var inputNumber = Chassis.Outputs[output].AudioOutFeedback == null ? 0 : Chassis.
|
||||
Outputs[output].AudioOutFeedback.Number;
|
||||
|
||||
Debug.Console(2, this, "DMSwitchAudio:{0} Routed Input:{1} Output:{2}'", this.Name, inputNumber, output);
|
||||
|
||||
if (AudioOutputFeedbacks.ContainsKey(output))
|
||||
{
|
||||
var localInputPort = InputPorts.FirstOrDefault(p => (DMInput)p.FeedbackMatchObject == Chassis.Outputs[output].AudioOutFeedback);
|
||||
var localOutputPort =
|
||||
OutputPorts.FirstOrDefault(p => (DMOutput)p.FeedbackMatchObject == Chassis.Outputs[output]);
|
||||
|
||||
|
||||
AudioOutputFeedbacks[output].FireUpdate();
|
||||
OnSwitchChange(new RoutingNumericEventArgs(output,
|
||||
inputNumber,
|
||||
localOutputPort,
|
||||
localInputPort,
|
||||
eRoutingSignalType.Audio));
|
||||
}
|
||||
|
||||
if (OutputAudioRouteNameFeedbacks.ContainsKey(output))
|
||||
OutputAudioRouteNameFeedbacks[output].FireUpdate();
|
||||
|
||||
break;
|
||||
}
|
||||
case DMOutputEventIds.OutputNameEventId:
|
||||
@@ -981,6 +1114,19 @@ namespace PepperDash.Essentials.DM
|
||||
Debug.Console(2, this, "DM Output {0} DisabledByHdcpEventId", args.Number);
|
||||
OutputDisabledByHdcpFeedbacks[args.Number].FireUpdate();
|
||||
break;
|
||||
}
|
||||
case DMOutputEventIds.StartEventId:
|
||||
case DMOutputEventIds.StopEventId:
|
||||
case DMOutputEventIds.PauseEventId:
|
||||
{
|
||||
Debug.Console(2, this, "DM Output {0} Stream Status EventId", args.Number);
|
||||
if (OutputStreamCardStateFeedbacks[args.Number] != null)
|
||||
{
|
||||
OutputStreamCardStateFeedbacks[args.Number].FireUpdate();
|
||||
}
|
||||
else
|
||||
Debug.Console(2, this, "No index of {0} found in OutputStreamCardStateFeedbacks");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
@@ -1180,13 +1326,16 @@ namespace PepperDash.Essentials.DM
|
||||
}
|
||||
else
|
||||
{
|
||||
LinkHdmiInputToApi(trilist, ioSlot, joinMap, ioSlotJoin);
|
||||
}
|
||||
|
||||
if (RxDictionary.ContainsKey(ioSlot))
|
||||
{
|
||||
LinkRxToApi(trilist, ioSlot, joinMap, ioSlotJoin);
|
||||
}
|
||||
LinkHdmiInputToApi(trilist, ioSlot, joinMap, ioSlotJoin);
|
||||
LinkStreamInputToApi(trilist, ioSlot, joinMap, ioSlotJoin);
|
||||
}
|
||||
|
||||
if (RxDictionary.ContainsKey(ioSlot))
|
||||
{
|
||||
LinkRxToApi(trilist, ioSlot, joinMap, ioSlotJoin);
|
||||
}
|
||||
else
|
||||
LinkStreamOutputToApi(trilist, ioSlot, joinMap, ioSlotJoin);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1233,6 +1382,86 @@ namespace PepperDash.Essentials.DM
|
||||
{
|
||||
trilist.UShortInput[joinMap.HdcpSupportCapability.JoinNumber + ioSlotJoin].UShortValue = 1;
|
||||
}
|
||||
}
|
||||
|
||||
private void LinkStreamInputToApi(BasicTriList trilist, uint ioSlot, DmChassisControllerJoinMap joinMap, uint ioSlotJoin)
|
||||
{
|
||||
var inputPort = InputPorts[string.Format("inputCard{0}--streamIn", ioSlot)];
|
||||
if (inputPort == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var streamCard = Chassis.Inputs[ioSlot].Card as DmcStr;
|
||||
var join = joinMap.InputStreamCardState.JoinNumber + ioSlotJoin;
|
||||
|
||||
Debug.Console(1, "Port value for input card {0} is set as a stream card", ioSlot);
|
||||
|
||||
trilist.SetUShortSigAction(join, s =>
|
||||
{
|
||||
if (s == 1)
|
||||
{
|
||||
Debug.Console(2, this, "Join {0} value {1}: Setting stream state to start", join, s);
|
||||
streamCard.Control.Start();
|
||||
}
|
||||
else if (s == 2)
|
||||
{
|
||||
Debug.Console(2, this, "Join {0} value {1}: Setting stream state to stop", join, s);
|
||||
streamCard.Control.Stop();
|
||||
}
|
||||
else if (s == 3)
|
||||
{
|
||||
Debug.Console(2, this, "Join {0} value {1}: Setting stream state to pause", join, s);
|
||||
streamCard.Control.Pause();
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(2, this, "Join {0} value {1}: Ignore stream state", join, s);
|
||||
}
|
||||
});
|
||||
|
||||
InputStreamCardStateFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[join]);
|
||||
|
||||
trilist.UShortInput[join].UShortValue = InputStreamCardStateFeedbacks[ioSlot].UShortValue;
|
||||
}
|
||||
|
||||
private void LinkStreamOutputToApi(BasicTriList trilist, uint ioSlot, DmChassisControllerJoinMap joinMap, uint ioSlotJoin)
|
||||
{
|
||||
var outputPort = OutputPorts[string.Format("outputCard{0}--streamOut", ioSlot)];
|
||||
if (outputPort == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var streamCard = Chassis.Outputs[ioSlot].Card as DmcStroAV;
|
||||
var join = joinMap.OutputStreamCardState.JoinNumber + ioSlotJoin;
|
||||
|
||||
Debug.Console(1, "Port value for output card {0} is set as a stream card", ioSlot);
|
||||
|
||||
trilist.SetUShortSigAction(join, s =>
|
||||
{
|
||||
if (s == 1)
|
||||
{
|
||||
Debug.Console(2, this, "Join {0} value {1}: Setting stream state to start", join, s);
|
||||
streamCard.Control.Start();
|
||||
}
|
||||
else if (s == 2)
|
||||
{
|
||||
Debug.Console(2, this, "Join {0} value {1}: Setting stream state to stop", join, s);
|
||||
streamCard.Control.Stop();
|
||||
}
|
||||
else if (s == 3)
|
||||
{
|
||||
Debug.Console(2, this, "Join {0} value {1}: Setting stream state to pause", join, s);
|
||||
streamCard.Control.Pause();
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(2, this, "Join {0} value {1}: Ignore stream state", join, s);
|
||||
}
|
||||
});
|
||||
|
||||
OutputStreamCardStateFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[join]);
|
||||
|
||||
trilist.UShortInput[join].UShortValue = OutputStreamCardStateFeedbacks[ioSlot].UShortValue;
|
||||
}
|
||||
|
||||
private void LinkRxToApi(BasicTriList trilist, uint ioSlot, DmChassisControllerJoinMap joinMap, uint ioSlotJoin)
|
||||
|
||||
@@ -18,12 +18,15 @@ using PepperDash.Essentials.DM.Config;
|
||||
using Feedback = PepperDash.Essentials.Core.Feedback;
|
||||
|
||||
namespace PepperDash.Essentials.DM
|
||||
{
|
||||
public class DmpsRoutingController : EssentialsBridgeableDevice, IRoutingNumeric, IHasFeedback
|
||||
{
|
||||
public class DmpsRoutingController : EssentialsBridgeableDevice, IRoutingNumericWithFeedback, IHasFeedback
|
||||
{
|
||||
public CrestronControlSystem Dmps { get; set; }
|
||||
public ISystemControl SystemControl { get; private set; }
|
||||
|
||||
//IroutingNumericEvent
|
||||
public event EventHandler<RoutingNumericEventArgs> NumericSwitchChange;
|
||||
|
||||
// Feedbacks for EssentialDM
|
||||
public Dictionary<uint, IntFeedback> VideoOutputFeedbacks { get; private set; }
|
||||
public Dictionary<uint, IntFeedback> AudioOutputFeedbacks { get; private set; }
|
||||
@@ -56,11 +59,23 @@ namespace PepperDash.Essentials.DM
|
||||
/// </summary>
|
||||
public string NoRouteText = "";
|
||||
|
||||
/// <summary>
|
||||
/// Raise an event when the status of a switch object changes.
|
||||
/// </summary>
|
||||
/// <param name="e">Arguments defined as IKeyName sender, output, input, and eRoutingSignalType</param>
|
||||
private void OnSwitchChange(RoutingNumericEventArgs e)
|
||||
{
|
||||
var newEvent = NumericSwitchChange;
|
||||
if (newEvent != null) newEvent(this, e);
|
||||
}
|
||||
|
||||
|
||||
public static DmpsRoutingController GetDmpsRoutingController(string key, string name,
|
||||
DmpsRoutingPropertiesConfig properties)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
ISystemControl systemControl = null;
|
||||
|
||||
systemControl = Global.ControlSystem.SystemControl as ISystemControl;
|
||||
@@ -120,6 +135,9 @@ namespace PepperDash.Essentials.DM
|
||||
Debug.Console(1, this, "{0} Switcher Inputs Present.", Dmps.SwitcherInputs.Count);
|
||||
Debug.Console(1, this, "{0} Switcher Outputs Present.", Dmps.SwitcherOutputs.Count);
|
||||
|
||||
Debug.Console(1, this, "{0} Inputs in ControlSystem", Dmps.NumberOfSwitcherInputs);
|
||||
Debug.Console(1, this, "{0} Outputs in ControlSystem", Dmps.NumberOfSwitcherOutputs);
|
||||
|
||||
SetupOutputCards();
|
||||
|
||||
SetupInputCards();
|
||||
@@ -128,148 +146,197 @@ namespace PepperDash.Essentials.DM
|
||||
public override bool CustomActivate()
|
||||
{
|
||||
// Set input and output names from config
|
||||
if (InputNames != null)
|
||||
{
|
||||
foreach (var kvp in InputNames)
|
||||
{
|
||||
var input = (Dmps.SwitcherInputs[kvp.Key] as DMInput);
|
||||
if (input != null)
|
||||
input.Name.StringValue = kvp.Value;
|
||||
}
|
||||
}
|
||||
if (OutputNames != null)
|
||||
{
|
||||
foreach (var kvp in OutputNames)
|
||||
{
|
||||
var output = (Dmps.SwitcherOutputs[kvp.Key] as DMOutput);
|
||||
if (output != null)
|
||||
output.Name.StringValue = kvp.Value;
|
||||
}
|
||||
}
|
||||
SetInputNames();
|
||||
|
||||
SetOutputNames();
|
||||
|
||||
// Subscribe to events
|
||||
Dmps.DMInputChange += new DMInputEventHandler(Dmps_DMInputChange);
|
||||
Dmps.DMOutputChange += new DMOutputEventHandler(Dmps_DMOutputChange);
|
||||
Dmps.DMInputChange += Dmps_DMInputChange;
|
||||
Dmps.DMOutputChange += Dmps_DMOutputChange;
|
||||
|
||||
return base.CustomActivate();
|
||||
}
|
||||
|
||||
private void SetOutputNames()
|
||||
{
|
||||
if (OutputNames == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var kvp in OutputNames)
|
||||
{
|
||||
var output = (Dmps.SwitcherOutputs[kvp.Key] as DMOutput);
|
||||
if (output != null && output.Name.Type != eSigType.NA)
|
||||
{
|
||||
output.Name.StringValue = kvp.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SetInputNames()
|
||||
{
|
||||
if (InputNames == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
foreach (var kvp in InputNames)
|
||||
{
|
||||
var input = (Dmps.SwitcherInputs[kvp.Key] as DMInput);
|
||||
if (input != null && input.Name.Type != eSigType.NA)
|
||||
{
|
||||
input.Name.StringValue = kvp.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
|
||||
{
|
||||
{
|
||||
var joinMap = new DmpsRoutingControllerJoinMap(joinStart);
|
||||
|
||||
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
|
||||
|
||||
if (!string.IsNullOrEmpty(joinMapSerialized))
|
||||
joinMap = JsonConvert.DeserializeObject<DmpsRoutingControllerJoinMap>(joinMapSerialized);
|
||||
|
||||
if (bridge != null)
|
||||
{
|
||||
bridge.AddJoinMap(Key, joinMap);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
|
||||
joinMap = JsonConvert.DeserializeObject<DmpsRoutingControllerJoinMap>(joinMapSerialized);
|
||||
|
||||
if (bridge != null)
|
||||
{
|
||||
bridge.AddJoinMap(Key, joinMap);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
|
||||
}
|
||||
|
||||
Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||
|
||||
// Link up outputs
|
||||
for (uint i = 1; i <= Dmps.NumberOfSwitcherInputs; i++)
|
||||
{
|
||||
Debug.Console(2, this, "Linking Input Card {0}", i);
|
||||
LinkInputsToApi(trilist, joinMap);
|
||||
|
||||
var ioSlot = i;
|
||||
var ioSlotJoin = ioSlot - 1;
|
||||
LinkOutputsToApi(trilist, joinMap);
|
||||
}
|
||||
|
||||
//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.JoinNumber + ioSlotJoin]);
|
||||
|
||||
if (InputNameFeedbacks[ioSlot] != null)
|
||||
InputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.InputNames.JoinNumber + ioSlotJoin]);
|
||||
|
||||
trilist.SetStringSigAction(joinMap.InputNames.JoinNumber + ioSlotJoin, new Action<string>(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.JoinNumber + ioSlotJoin]);
|
||||
}
|
||||
|
||||
for (uint i = 1; i <= Dmps.NumberOfSwitcherOutputs; i++)
|
||||
private void LinkOutputsToApi(BasicTriList trilist, DmpsRoutingControllerJoinMap joinMap)
|
||||
{
|
||||
for (uint i = 1; i <= Dmps.SwitcherOutputs.Count; i++)
|
||||
{
|
||||
Debug.Console(2, this, "Linking Output Card {0}", i);
|
||||
|
||||
var ioSlot = i;
|
||||
var ioSlot = i;
|
||||
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));
|
||||
|
||||
// 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;
|
||||
|
||||
//Debug.Console(2, dmpsRouter, "Output Name String Sig Action for Output Card {0}", ioSlot);
|
||||
|
||||
if (outputCard != null)
|
||||
if (outputCard == null)
|
||||
{
|
||||
//Debug.Console(2, dmpsRouter, "Card Type: {0}", outputCard.CardInputOutputType);
|
||||
return;
|
||||
}
|
||||
//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 is Card.Dmps3CodecOutput || outputCard.NameFeedback == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(outputCard.NameFeedback.StringValue))
|
||||
{
|
||||
return;
|
||||
}
|
||||
//Debug.Console(2, dmpsRouter, "NameFeedabck: {0}", outputCard.NameFeedback.StringValue);
|
||||
|
||||
if (outputCard.NameFeedback.StringValue != s && outputCard.Name != null)
|
||||
{
|
||||
outputCard.Name.StringValue = s;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (outputCard.NameFeedback.StringValue != s && outputCard.Name != null)
|
||||
{
|
||||
outputCard.Name.StringValue = s;
|
||||
}
|
||||
});
|
||||
|
||||
// Feedback
|
||||
if (VideoOutputFeedbacks[ioSlot] != null)
|
||||
if (VideoOutputFeedbacks[ioSlot] != null)
|
||||
{
|
||||
VideoOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputVideo.JoinNumber + ioSlotJoin]);
|
||||
if (AudioOutputFeedbacks[ioSlot] != null)
|
||||
}
|
||||
if (AudioOutputFeedbacks[ioSlot] != null)
|
||||
{
|
||||
AudioOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputAudio.JoinNumber + ioSlotJoin]);
|
||||
if (OutputNameFeedbacks[ioSlot] != null)
|
||||
}
|
||||
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]);
|
||||
}
|
||||
if (OutputVideoRouteNameFeedbacks[ioSlot] != null)
|
||||
{
|
||||
OutputVideoRouteNameFeedbacks[ioSlot].LinkInputSig(
|
||||
trilist.StringInput[joinMap.OutputCurrentVideoInputNames.JoinNumber + ioSlotJoin]);
|
||||
}
|
||||
if (OutputAudioRouteNameFeedbacks[ioSlot] != null)
|
||||
{
|
||||
OutputAudioRouteNameFeedbacks[ioSlot].LinkInputSig(
|
||||
trilist.StringInput[joinMap.OutputCurrentAudioInputNames.JoinNumber + ioSlotJoin]);
|
||||
}
|
||||
if (OutputEndpointOnlineFeedbacks[ioSlot] != null)
|
||||
{
|
||||
OutputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(
|
||||
trilist.BooleanInput[joinMap.OutputEndpointOnline.JoinNumber + ioSlotJoin]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void LinkInputsToApi(BasicTriList trilist, DmpsRoutingControllerJoinMap joinMap)
|
||||
{
|
||||
for (uint i = 1; i <= Dmps.SwitcherInputs.Count; i++)
|
||||
{
|
||||
Debug.Console(2, this, "Linking Input Card {0}", i);
|
||||
|
||||
var ioSlot = i;
|
||||
var ioSlotJoin = ioSlot - 1;
|
||||
|
||||
if (VideoInputSyncFeedbacks[ioSlot] != null)
|
||||
{
|
||||
VideoInputSyncFeedbacks[ioSlot].LinkInputSig(
|
||||
trilist.BooleanInput[joinMap.VideoSyncStatus.JoinNumber + ioSlotJoin]);
|
||||
}
|
||||
|
||||
if (InputNameFeedbacks[ioSlot] != null)
|
||||
{
|
||||
InputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.InputNames.JoinNumber + ioSlotJoin]);
|
||||
}
|
||||
|
||||
trilist.SetStringSigAction(joinMap.InputNames.JoinNumber + ioSlotJoin, s =>
|
||||
{
|
||||
var inputCard = Dmps.SwitcherInputs[ioSlot] as DMInput;
|
||||
|
||||
if (inputCard == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (inputCard.NameFeedback == null || string.IsNullOrEmpty(inputCard.NameFeedback.StringValue) ||
|
||||
inputCard.NameFeedback.StringValue == s)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (inputCard.Name != null)
|
||||
{
|
||||
inputCard.Name.StringValue = s;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
if (InputEndpointOnlineFeedbacks[ioSlot] != null)
|
||||
{
|
||||
InputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(
|
||||
trilist.BooleanInput[joinMap.InputEndpointOnline.JoinNumber + ioSlotJoin]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -281,65 +348,69 @@ namespace PepperDash.Essentials.DM
|
||||
{
|
||||
foreach (var card in Dmps.SwitcherOutputs)
|
||||
{
|
||||
Debug.Console(1, this, "Output Card Type: {0}", card.CardInputOutputType);
|
||||
|
||||
var outputCard = card as DMOutput;
|
||||
|
||||
Debug.Console(1, this, "Adding Output Card Number {0} Type: {1}", outputCard.Number, outputCard.CardInputOutputType.ToString());
|
||||
|
||||
if (outputCard != null)
|
||||
if (outputCard == null)
|
||||
{
|
||||
VideoOutputFeedbacks[outputCard.Number] = new IntFeedback(() =>
|
||||
{
|
||||
if (outputCard.VideoOutFeedback != null) { return (ushort)outputCard.VideoOutFeedback.Number; }
|
||||
else { return 0; };
|
||||
});
|
||||
AudioOutputFeedbacks[outputCard.Number] = new IntFeedback(() =>
|
||||
{
|
||||
if (outputCard.AudioOutFeedback != null) { return (ushort)outputCard.AudioOutFeedback.Number; }
|
||||
else { return 0; };
|
||||
});
|
||||
|
||||
OutputNameFeedbacks[outputCard.Number] = new StringFeedback(() =>
|
||||
{
|
||||
if (outputCard.NameFeedback != null && !string.IsNullOrEmpty(outputCard.NameFeedback.StringValue))
|
||||
{
|
||||
Debug.Console(2, this, "Output Card {0} Name: {1}", outputCard.Number, outputCard.NameFeedback.StringValue);
|
||||
return outputCard.NameFeedback.StringValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
return "";
|
||||
}
|
||||
});
|
||||
|
||||
OutputVideoRouteNameFeedbacks[outputCard.Number] = new StringFeedback(() =>
|
||||
{
|
||||
if (outputCard.VideoOutFeedback != null && outputCard.VideoOutFeedback.NameFeedback != null)
|
||||
{
|
||||
return outputCard.VideoOutFeedback.NameFeedback.StringValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
return NoRouteText;
|
||||
}
|
||||
});
|
||||
OutputAudioRouteNameFeedbacks[outputCard.Number] = new StringFeedback(() =>
|
||||
{
|
||||
if (outputCard.AudioOutFeedback != null && outputCard.AudioOutFeedback.NameFeedback != null)
|
||||
{
|
||||
return outputCard.AudioOutFeedback.NameFeedback.StringValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
return NoRouteText;
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
OutputEndpointOnlineFeedbacks[outputCard.Number] = new BoolFeedback(() => { return outputCard.EndpointOnlineFeedback; });
|
||||
|
||||
AddOutputCard(outputCard.Number, outputCard);
|
||||
Debug.Console(1, this, "Output card {0} is not a DMOutput", card.CardInputOutputType);
|
||||
continue;
|
||||
}
|
||||
|
||||
Debug.Console(1, this, "Adding Output Card Number {0} Type: {1}", outputCard.Number, outputCard.CardInputOutputType.ToString());
|
||||
VideoOutputFeedbacks[outputCard.Number] = new IntFeedback(() =>
|
||||
{
|
||||
if (outputCard.VideoOutFeedback != null) { return (ushort)outputCard.VideoOutFeedback.Number; }
|
||||
return 0;
|
||||
;
|
||||
});
|
||||
AudioOutputFeedbacks[outputCard.Number] = new IntFeedback(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
if (outputCard.AudioOutFeedback != null)
|
||||
{
|
||||
return (ushort) outputCard.AudioOutFeedback.Number;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
catch (NotSupportedException)
|
||||
{
|
||||
return (ushort) outputCard.AudioOutSourceFeedback;
|
||||
}
|
||||
});
|
||||
|
||||
OutputNameFeedbacks[outputCard.Number] = new StringFeedback(() =>
|
||||
{
|
||||
if (outputCard.NameFeedback != null && !string.IsNullOrEmpty(outputCard.NameFeedback.StringValue))
|
||||
{
|
||||
Debug.Console(2, this, "Output Card {0} Name: {1}", outputCard.Number, outputCard.NameFeedback.StringValue);
|
||||
return outputCard.NameFeedback.StringValue;
|
||||
}
|
||||
return "";
|
||||
});
|
||||
|
||||
OutputVideoRouteNameFeedbacks[outputCard.Number] = new StringFeedback(() =>
|
||||
{
|
||||
if (outputCard.VideoOutFeedback != null && outputCard.VideoOutFeedback.NameFeedback != null)
|
||||
{
|
||||
return outputCard.VideoOutFeedback.NameFeedback.StringValue;
|
||||
}
|
||||
return NoRouteText;
|
||||
});
|
||||
OutputAudioRouteNameFeedbacks[outputCard.Number] = new StringFeedback(() =>
|
||||
{
|
||||
if (outputCard.AudioOutFeedback != null && outputCard.AudioOutFeedback.NameFeedback != null)
|
||||
{
|
||||
return outputCard.AudioOutFeedback.NameFeedback.StringValue;
|
||||
}
|
||||
return NoRouteText;
|
||||
});
|
||||
|
||||
OutputEndpointOnlineFeedbacks[outputCard.Number] = new BoolFeedback(() => outputCard.EndpointOnlineFeedback);
|
||||
|
||||
AddOutputCard(outputCard.Number, outputCard);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -457,11 +528,16 @@ namespace PepperDash.Essentials.DM
|
||||
/// <summary>
|
||||
/// Adds InputPort
|
||||
/// </summary>
|
||||
void AddInputPortWithDebug(uint cardNum, string portName, eRoutingSignalType sigType, eRoutingPortConnectionType portType)
|
||||
private 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);
|
||||
var inputPort = new RoutingInputPort(portKey, sigType, portType, cardNum, this)
|
||||
{
|
||||
FeedbackMatchObject = Dmps.SwitcherInputs[cardNum]
|
||||
};
|
||||
;
|
||||
|
||||
InputPorts.Add(inputPort);
|
||||
}
|
||||
@@ -473,7 +549,11 @@ namespace PepperDash.Essentials.DM
|
||||
{
|
||||
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);
|
||||
var inputPort = new RoutingInputPort(portKey, sigType, portType, cardNum, this)
|
||||
{
|
||||
FeedbackMatchObject = Dmps.SwitcherInputs[cardNum]
|
||||
};
|
||||
;
|
||||
|
||||
if (cecPort != null)
|
||||
inputPort.Port = cecPort;
|
||||
@@ -481,6 +561,7 @@ namespace PepperDash.Essentials.DM
|
||||
InputPorts.Add(inputPort);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Builds the appropriate ports and calls the appropriate add port method
|
||||
/// </summary>
|
||||
@@ -495,17 +576,22 @@ namespace PepperDash.Essentials.DM
|
||||
var cecPort = hdmiOutputCard.HdmiOutputPort;
|
||||
|
||||
AddHdmiOutputPort(number, cecPort);
|
||||
}
|
||||
else if (outputCard is Card.Dmps3HdmiOutputBackend)
|
||||
{
|
||||
var hdmiOutputCard = outputCard as Card.Dmps3HdmiOutputBackend;
|
||||
|
||||
return;
|
||||
var cecPort = hdmiOutputCard.HdmiOutputPort;
|
||||
|
||||
AddHdmiOutputPort(number, cecPort);
|
||||
}
|
||||
else if (outputCard is Card.Dmps3DmOutput)
|
||||
{
|
||||
var dmOutputCard = outputCard as Card.Dmps3DmOutput;
|
||||
|
||||
var cecPort = dmOutputCard.DmOutputPort;
|
||||
|
||||
AddDmOutputPort(number);
|
||||
return;
|
||||
}
|
||||
else if (outputCard is Card.Dmps3DmOutputBackend)
|
||||
{
|
||||
AddDmOutputPort(number);
|
||||
}
|
||||
else if (outputCard is Card.Dmps3ProgramOutput)
|
||||
{
|
||||
@@ -514,49 +600,50 @@ namespace PepperDash.Essentials.DM
|
||||
var programOutput = new DmpsAudioOutputController(string.Format("processor-programAudioOutput"), "Program Audio Output", outputCard as Card.Dmps3OutputBase);
|
||||
|
||||
DeviceManager.AddDevice(programOutput);
|
||||
|
||||
return;
|
||||
}
|
||||
else if (outputCard is Card.Dmps3AuxOutput)
|
||||
{
|
||||
if (outputCard.CardInputOutputType == eCardInputOutputType.Dmps3Aux1Output)
|
||||
switch (outputCard.CardInputOutputType)
|
||||
{
|
||||
AddAudioOnlyOutputPort(number, "Aux1");
|
||||
case eCardInputOutputType.Dmps3Aux1Output:
|
||||
{
|
||||
AddAudioOnlyOutputPort(number, "Aux1");
|
||||
|
||||
var aux1Output = new DmpsAudioOutputController(string.Format("processor-aux1AudioOutput"), "Program Audio Output", outputCard as Card.Dmps3OutputBase);
|
||||
var aux1Output = new DmpsAudioOutputController(string.Format("processor-aux1AudioOutput"), "Program Audio Output", outputCard as Card.Dmps3OutputBase);
|
||||
|
||||
DeviceManager.AddDevice(aux1Output);
|
||||
DeviceManager.AddDevice(aux1Output);
|
||||
}
|
||||
break;
|
||||
case eCardInputOutputType.Dmps3Aux2Output:
|
||||
{
|
||||
AddAudioOnlyOutputPort(number, "Aux2");
|
||||
|
||||
var aux2Output = new DmpsAudioOutputController(string.Format("processor-aux2AudioOutput"), "Program Audio Output", outputCard as Card.Dmps3OutputBase);
|
||||
|
||||
DeviceManager.AddDevice(aux2Output);
|
||||
}
|
||||
break;
|
||||
}
|
||||
else if (outputCard.CardInputOutputType == eCardInputOutputType.Dmps3Aux2Output)
|
||||
{
|
||||
AddAudioOnlyOutputPort(number, "Aux2");
|
||||
|
||||
var aux2Output = new DmpsAudioOutputController(string.Format("processor-aux2AudioOutput"), "Program Audio Output", outputCard as Card.Dmps3OutputBase);
|
||||
|
||||
DeviceManager.AddDevice(aux2Output);
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (outputCard is Card.Dmps3CodecOutput)
|
||||
{
|
||||
if (number == (uint)CrestronControlSystem.eDmps300cOutputs.Codec1
|
||||
|| number == (uint)CrestronControlSystem.eDmps3200cOutputs.Codec1
|
||||
|| number == (uint)CrestronControlSystem.eDmps3300cAecOutputs.Codec1
|
||||
|| number == (uint)CrestronControlSystem.eDmps34K250COutputs.Codec1
|
||||
|| number == (uint)CrestronControlSystem.eDmps34K350COutputs.Codec1)
|
||||
AddAudioOnlyOutputPort(number, CrestronControlSystem.eDmps300cOutputs.Codec1.ToString());
|
||||
else if (number == (uint)CrestronControlSystem.eDmps300cOutputs.Codec2
|
||||
|| number == (uint)CrestronControlSystem.eDmps3200cOutputs.Codec2
|
||||
|| number == (uint)CrestronControlSystem.eDmps3300cAecOutputs.Codec2
|
||||
|| number == (uint)CrestronControlSystem.eDmps34K250COutputs.Codec2
|
||||
|| number == (uint)CrestronControlSystem.eDmps34K350COutputs.Codec2)
|
||||
AddAudioOnlyOutputPort(number, CrestronControlSystem.eDmps300cOutputs.Codec2.ToString());
|
||||
return;
|
||||
switch (number)
|
||||
{
|
||||
case (uint)CrestronControlSystem.eDmps34K350COutputs.Codec1:
|
||||
case (uint)CrestronControlSystem.eDmps34K250COutputs.Codec1:
|
||||
case (uint)CrestronControlSystem.eDmps3300cAecOutputs.Codec1:
|
||||
AddAudioOnlyOutputPort(number, CrestronControlSystem.eDmps300cOutputs.Codec1.ToString());
|
||||
break;
|
||||
case (uint)CrestronControlSystem.eDmps34K350COutputs.Codec2:
|
||||
case (uint)CrestronControlSystem.eDmps34K250COutputs.Codec2:
|
||||
case (uint)CrestronControlSystem.eDmps3300cAecOutputs.Codec2:
|
||||
AddAudioOnlyOutputPort(number, CrestronControlSystem.eDmps300cOutputs.Codec2.ToString());
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (outputCard is Card.Dmps3DialerOutput)
|
||||
{
|
||||
AddAudioOnlyOutputPort(number, "Dialer");
|
||||
return;
|
||||
}
|
||||
else if (outputCard is Card.Dmps3DigitalMixOutput)
|
||||
{
|
||||
@@ -568,12 +655,10 @@ namespace PepperDash.Essentials.DM
|
||||
|| number == (uint)CrestronControlSystem.eDmps34K300COutputs.Mix2
|
||||
|| number == (uint)CrestronControlSystem.eDmps34K350COutputs.Mix2)
|
||||
AddAudioOnlyOutputPort(number, CrestronControlSystem.eDmps34K250COutputs.Mix2.ToString());
|
||||
return;
|
||||
}
|
||||
else if (outputCard is Card.Dmps3AecOutput)
|
||||
{
|
||||
AddAudioOnlyOutputPort(number, "Aec");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -616,7 +701,10 @@ namespace PepperDash.Essentials.DM
|
||||
{
|
||||
var portKey = string.Format("outputCard{0}--{1}", cardNum, portName);
|
||||
Debug.Console(2, this, "Adding output port '{0}'", portKey);
|
||||
OutputPorts.Add(new RoutingOutputPort(portKey, sigType, portType, selector, this));
|
||||
OutputPorts.Add(new RoutingOutputPort(portKey, sigType, portType, selector, this)
|
||||
{
|
||||
FeedbackMatchObject = Dmps.SwitcherOutputs[cardNum]
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -626,7 +714,10 @@ namespace PepperDash.Essentials.DM
|
||||
{
|
||||
var portKey = string.Format("outputCard{0}--{1}", cardNum, portName);
|
||||
Debug.Console(2, this, "Adding output port '{0}'", portKey);
|
||||
var outputPort = new RoutingOutputPort(portKey, sigType, portType, selector, this);
|
||||
var outputPort = new RoutingOutputPort(portKey, sigType, portType, selector, this)
|
||||
{
|
||||
FeedbackMatchObject = Dmps.SwitcherOutputs[cardNum]
|
||||
};
|
||||
|
||||
if (cecPort != null)
|
||||
outputPort.Port = cecPort;
|
||||
@@ -703,13 +794,29 @@ namespace PepperDash.Essentials.DM
|
||||
}
|
||||
else if (args.EventId == DMOutputEventIds.AudioOutEventId)
|
||||
{
|
||||
if (outputCard != null && outputCard.AudioOutFeedback != null)
|
||||
try
|
||||
{
|
||||
Debug.Console(2, this, "DMSwitchAudio:{0} Routed Input:{1} Output:{2}'", this.Name, outputCard.AudioOutFeedback.Number, output);
|
||||
if (outputCard != null && outputCard.AudioOutFeedback != null)
|
||||
{
|
||||
Debug.Console(2, this, "DMSwitchAudio:{0} Routed Input:{1} Output:{2}'", this.Name,
|
||||
outputCard.AudioOutFeedback.Number, output);
|
||||
}
|
||||
if (AudioOutputFeedbacks.ContainsKey(output))
|
||||
{
|
||||
AudioOutputFeedbacks[output].FireUpdate();
|
||||
}
|
||||
}
|
||||
if (AudioOutputFeedbacks.ContainsKey(output))
|
||||
catch (NotSupportedException)
|
||||
{
|
||||
AudioOutputFeedbacks[output].FireUpdate();
|
||||
if (outputCard != null)
|
||||
{
|
||||
Debug.Console(2, this, "DMSwitchAudio:{0} Routed Input:{1} Output:{2}'", Name,
|
||||
outputCard.AudioOutSourceFeedback, output);
|
||||
}
|
||||
if (AudioOutputFeedbacks.ContainsKey(output))
|
||||
{
|
||||
AudioOutputFeedbacks[output].FireUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (args.EventId == DMOutputEventIds.OutputNameEventId
|
||||
@@ -744,7 +851,14 @@ namespace PepperDash.Essentials.DM
|
||||
var input = Convert.ToUInt32(inputSelector); // Cast can sometimes fail
|
||||
var output = Convert.ToUInt32(outputSelector);
|
||||
|
||||
if (input <= Dmps.NumberOfSwitcherInputs && output <= Dmps.NumberOfSwitcherOutputs)
|
||||
var sigTypeIsUsbOrVideo = ((sigType & eRoutingSignalType.Video) == eRoutingSignalType.Video) ||
|
||||
((sigType & eRoutingSignalType.UsbInput) == eRoutingSignalType.UsbInput) ||
|
||||
((sigType & eRoutingSignalType.UsbOutput) == eRoutingSignalType.UsbOutput);
|
||||
|
||||
if ((input <= Dmps.NumberOfSwitcherInputs && output <= Dmps.NumberOfSwitcherOutputs &&
|
||||
sigTypeIsUsbOrVideo) ||
|
||||
(input <= Dmps.NumberOfSwitcherInputs + 5 && output <= Dmps.NumberOfSwitcherOutputs &&
|
||||
(sigType & eRoutingSignalType.Audio) == eRoutingSignalType.Audio))
|
||||
{
|
||||
// Check to see if there's an off timer waiting on this and if so, cancel
|
||||
var key = new PortNumberType(output, sigType);
|
||||
@@ -762,37 +876,55 @@ namespace PepperDash.Essentials.DM
|
||||
}
|
||||
}
|
||||
|
||||
DMInput inCard = input == 0 ? null : Dmps.SwitcherInputs[input] as DMInput;
|
||||
DMOutput outCard = output == 0 ? null : Dmps.SwitcherOutputs[output] as DMOutput;
|
||||
|
||||
DMOutput dmOutputCard = output == 0 ? null : Dmps.SwitcherOutputs[output] as DMOutput;
|
||||
|
||||
//if (inCard != null)
|
||||
//{
|
||||
// NOTE THAT BITWISE COMPARISONS - TO CATCH ALL ROUTING TYPES
|
||||
if ((sigType | eRoutingSignalType.Video) == eRoutingSignalType.Video)
|
||||
{
|
||||
// NOTE THAT BITWISE COMPARISONS - TO CATCH ALL ROUTING TYPES
|
||||
if ((sigType & eRoutingSignalType.Video) == eRoutingSignalType.Video)
|
||||
{
|
||||
DMInput dmInputCard = input == 0 ? null : Dmps.SwitcherInputs[input] as DMInput;
|
||||
//SystemControl.VideoEnter.BoolValue = true;
|
||||
if (dmOutputCard != null)
|
||||
dmOutputCard.VideoOut = dmInputCard;
|
||||
}
|
||||
|
||||
//SystemControl.VideoEnter.BoolValue = true;
|
||||
if (outCard != null)
|
||||
outCard.VideoOut = inCard;
|
||||
if ((sigType & eRoutingSignalType.Audio) == eRoutingSignalType.Audio)
|
||||
{
|
||||
DMInput dmInputCard = null;
|
||||
if (input <= Dmps.NumberOfSwitcherInputs)
|
||||
{
|
||||
dmInputCard = input == 0 ? null : Dmps.SwitcherInputs[input] as DMInput;
|
||||
}
|
||||
|
||||
if ((sigType | eRoutingSignalType.Audio) == eRoutingSignalType.Audio)
|
||||
{
|
||||
if (outCard != null)
|
||||
outCard.AudioOut = inCard;
|
||||
}
|
||||
if (dmOutputCard != null)
|
||||
try
|
||||
{
|
||||
dmOutputCard.AudioOut = dmInputCard;
|
||||
}
|
||||
catch (NotSupportedException)
|
||||
{
|
||||
Debug.Console(1, this, "Routing input {0} audio to output {1}",
|
||||
(eDmps34KAudioOutSource) input, (CrestronControlSystem.eDmps34K350COutputs) output);
|
||||
|
||||
if ((sigType | eRoutingSignalType.UsbOutput) == eRoutingSignalType.UsbOutput)
|
||||
{
|
||||
if (outCard != null)
|
||||
outCard.USBRoutedTo = inCard;
|
||||
}
|
||||
dmOutputCard.AudioOutSource = (eDmps34KAudioOutSource) input;
|
||||
}
|
||||
}
|
||||
|
||||
if ((sigType | eRoutingSignalType.UsbInput) == eRoutingSignalType.UsbInput)
|
||||
{
|
||||
if (inCard != null)
|
||||
inCard.USBRoutedTo = outCard;
|
||||
}
|
||||
if ((sigType & eRoutingSignalType.UsbOutput) == eRoutingSignalType.UsbOutput)
|
||||
{
|
||||
DMInput dmInputCard = input == 0 ? null : Dmps.SwitcherInputs[input] as DMInput;
|
||||
if (dmOutputCard != null)
|
||||
dmOutputCard.USBRoutedTo = dmInputCard;
|
||||
}
|
||||
|
||||
if ((sigType & eRoutingSignalType.UsbInput) == eRoutingSignalType.UsbInput)
|
||||
{
|
||||
DMInput dmInputCard = input == 0 ? null : Dmps.SwitcherInputs[input] as DMInput;
|
||||
if (dmInputCard != null)
|
||||
dmInputCard.USBRoutedTo = dmOutputCard;
|
||||
}
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
@@ -802,7 +934,8 @@ namespace PepperDash.Essentials.DM
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(1, this, "Unable to execute route from input {0} to output {1}", inputSelector, outputSelector);
|
||||
Debug.Console(1, this, "Unable to execute route from input {0} to output {1}", inputSelector,
|
||||
outputSelector);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -811,15 +944,15 @@ namespace PepperDash.Essentials.DM
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IRoutingNumeric Members
|
||||
|
||||
public void ExecuteNumericSwitch(ushort inputSelector, ushort outputSelector, eRoutingSignalType sigType)
|
||||
{
|
||||
ExecuteSwitch(inputSelector, outputSelector, sigType);
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region IRoutingNumeric Members
|
||||
|
||||
public void ExecuteNumericSwitch(ushort inputSelector, ushort outputSelector, eRoutingSignalType sigType)
|
||||
{
|
||||
ExecuteSwitch(inputSelector, outputSelector, sigType);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -16,11 +16,14 @@ using PepperDash.Essentials.Core.Config;
|
||||
namespace PepperDash.Essentials.DM.Chassis
|
||||
{
|
||||
[Description("Wrapper class for all HdMdNxM4E switchers")]
|
||||
public class HdMdNxM4kEBridgeableController : CrestronGenericBridgeableBaseDevice, IRoutingInputsOutputs, IRoutingNumeric, IHasFeedback
|
||||
public class HdMdNxM4kEBridgeableController : CrestronGenericBridgeableBaseDevice, IRoutingNumericWithFeedback, IHasFeedback
|
||||
{
|
||||
private HdMdNxM _Chassis;
|
||||
private HdMd4x14kE _Chassis4x1;
|
||||
|
||||
//IroutingNumericEvent
|
||||
public event EventHandler<RoutingNumericEventArgs> NumericSwitchChange;
|
||||
|
||||
public Dictionary<uint, string> InputNames { get; set; }
|
||||
public Dictionary<uint, string> OutputNames { get; set; }
|
||||
|
||||
@@ -70,26 +73,34 @@ namespace PepperDash.Essentials.DM.Chassis
|
||||
|
||||
for (uint i = 1; i <= _Chassis.NumberOfInputs; i++)
|
||||
{
|
||||
var inputName = InputNames[i];
|
||||
_Chassis.Inputs[i].Name.StringValue = inputName;
|
||||
var index = i;
|
||||
var inputName = InputNames[index];
|
||||
_Chassis.Inputs[index].Name.StringValue = inputName;
|
||||
|
||||
InputPorts.Add(new RoutingInputPort(inputName, eRoutingSignalType.AudioVideo,
|
||||
eRoutingPortConnectionType.Hdmi, i, this));
|
||||
VideoInputSyncFeedbacks.Add(new BoolFeedback(inputName, () => _Chassis.Inputs[i].VideoDetectedFeedback.BoolValue));
|
||||
InputNameFeedbacks.Add(new StringFeedback(inputName, () => _Chassis.Inputs[i].Name.StringValue));
|
||||
InputHdcpEnableFeedback.Add(new BoolFeedback(inputName, () => _Chassis.HdmiInputs[i].HdmiInputPort.HdcpSupportOnFeedback.BoolValue));
|
||||
eRoutingPortConnectionType.Hdmi, index, this)
|
||||
{
|
||||
FeedbackMatchObject = _Chassis.HdmiInputs[index]
|
||||
});
|
||||
VideoInputSyncFeedbacks.Add(new BoolFeedback(inputName, () => _Chassis.Inputs[index].VideoDetectedFeedback.BoolValue));
|
||||
InputNameFeedbacks.Add(new StringFeedback(inputName, () => _Chassis.Inputs[index].Name.StringValue));
|
||||
InputHdcpEnableFeedback.Add(new BoolFeedback(inputName, () => _Chassis.HdmiInputs[index].HdmiInputPort.HdcpSupportOnFeedback.BoolValue));
|
||||
}
|
||||
|
||||
for (uint i = 1; i <= _Chassis.NumberOfOutputs; i++)
|
||||
{
|
||||
var outputName = OutputNames[i];
|
||||
var index = i;
|
||||
var outputName = OutputNames[index];
|
||||
_Chassis.Outputs[i].Name.StringValue = outputName;
|
||||
|
||||
OutputPorts.Add(new RoutingOutputPort(outputName, eRoutingSignalType.AudioVideo,
|
||||
eRoutingPortConnectionType.Hdmi, i, this));
|
||||
VideoOutputRouteFeedbacks.Add(new IntFeedback(outputName, () => (int)_Chassis.Outputs[i].VideoOutFeedback.Number));
|
||||
OutputNameFeedbacks.Add(new StringFeedback(outputName, () => _Chassis.Outputs[i].Name.StringValue));
|
||||
OutputRouteNameFeedbacks.Add(new StringFeedback(outputName, () => _Chassis.Outputs[i].VideoOutFeedback.NameFeedback.StringValue));
|
||||
eRoutingPortConnectionType.Hdmi, index, this)
|
||||
{
|
||||
FeedbackMatchObject = _Chassis.HdmiOutputs[index]
|
||||
});
|
||||
VideoOutputRouteFeedbacks.Add(new IntFeedback(outputName, () => (int)_Chassis.Outputs[index].VideoOutFeedback.Number));
|
||||
OutputNameFeedbacks.Add(new StringFeedback(outputName, () => _Chassis.Outputs[index].Name.StringValue));
|
||||
OutputRouteNameFeedbacks.Add(new StringFeedback(outputName, () => _Chassis.Outputs[index].VideoOutFeedback.NameFeedback.StringValue));
|
||||
}
|
||||
|
||||
_Chassis.DMInputChange += new DMInputEventHandler(Chassis_DMInputChange);
|
||||
@@ -102,6 +113,16 @@ namespace PepperDash.Essentials.DM.Chassis
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
/// Raise an event when the status of a switch object changes.
|
||||
/// </summary>
|
||||
/// <param name="e">Arguments defined as IKeyName sender, output, input, and eRoutingSignalType</param>
|
||||
private void OnSwitchChange(RoutingNumericEventArgs e)
|
||||
{
|
||||
var newEvent = NumericSwitchChange;
|
||||
if (newEvent != null) newEvent(this, e);
|
||||
}
|
||||
|
||||
public void EnableHdcp(uint port)
|
||||
{
|
||||
if (port > _Chassis.NumberOfInputs) return;
|
||||
@@ -328,44 +349,45 @@ namespace PepperDash.Essentials.DM.Chassis
|
||||
|
||||
void Chassis_OnlineStatusChange(Crestron.SimplSharpPro.GenericBase currentDevice, Crestron.SimplSharpPro.OnlineOfflineEventArgs args)
|
||||
{
|
||||
if (args.DeviceOnLine)
|
||||
if (!args.DeviceOnLine) return;
|
||||
for (uint i = 1; i <= _Chassis.NumberOfInputs; i++)
|
||||
{
|
||||
for (uint i = 1; i <= _Chassis.NumberOfInputs; i++)
|
||||
{
|
||||
_Chassis.Inputs[i].Name.StringValue = InputNames[i];
|
||||
}
|
||||
for (uint i = 1; i <= _Chassis.NumberOfOutputs; i++)
|
||||
{
|
||||
_Chassis.Outputs[i].Name.StringValue = OutputNames[i];
|
||||
}
|
||||
|
||||
foreach (var feedback in Feedbacks)
|
||||
{
|
||||
feedback.FireUpdate();
|
||||
}
|
||||
_Chassis.Inputs[i].Name.StringValue = InputNames[i];
|
||||
}
|
||||
for (uint i = 1; i <= _Chassis.NumberOfOutputs; i++)
|
||||
{
|
||||
_Chassis.Outputs[i].Name.StringValue = OutputNames[i];
|
||||
}
|
||||
|
||||
foreach (var feedback in Feedbacks)
|
||||
{
|
||||
feedback.FireUpdate();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Chassis_DMOutputChange(Switch device, DMOutputEventArgs args)
|
||||
{
|
||||
if (args.EventId == DMOutputEventIds.VideoOutEventId)
|
||||
if (args.EventId != DMOutputEventIds.VideoOutEventId) return;
|
||||
|
||||
for (var i = 0; i < VideoOutputRouteFeedbacks.Count; i++)
|
||||
{
|
||||
foreach (var item in VideoOutputRouteFeedbacks)
|
||||
{
|
||||
item.FireUpdate();
|
||||
}
|
||||
var index = i;
|
||||
var localInputPort = InputPorts.FirstOrDefault(p => (DMInput)p.FeedbackMatchObject == _Chassis.HdmiOutputs[(uint)index + 1].VideoOutFeedback);
|
||||
var localOutputPort =
|
||||
OutputPorts.FirstOrDefault(p => (DMOutput)p.FeedbackMatchObject == _Chassis.HdmiOutputs[(uint)index + 1]);
|
||||
|
||||
|
||||
VideoOutputRouteFeedbacks[i].FireUpdate();
|
||||
OnSwitchChange(new RoutingNumericEventArgs((ushort)i, VideoOutputRouteFeedbacks[i].UShortValue, localOutputPort, localInputPort, eRoutingSignalType.AudioVideo));
|
||||
}
|
||||
}
|
||||
|
||||
void Chassis_DMInputChange(Switch device, DMInputEventArgs args)
|
||||
{
|
||||
if (args.EventId == DMInputEventIds.VideoDetectedEventId)
|
||||
if (args.EventId != DMInputEventIds.VideoDetectedEventId) return;
|
||||
foreach (var item in VideoInputSyncFeedbacks)
|
||||
{
|
||||
foreach (var item in VideoInputSyncFeedbacks)
|
||||
{
|
||||
item.FireUpdate();
|
||||
}
|
||||
item.FireUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro;
|
||||
@@ -14,15 +15,19 @@ using Newtonsoft.Json;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using PepperDash.Essentials.Core.DeviceInfo;
|
||||
|
||||
namespace PepperDash.Essentials.DM.Endpoints.DGEs
|
||||
{
|
||||
[Description("Wrapper class for DGE-100")]
|
||||
public class Dge100Controller : CrestronGenericBaseDevice, IComPorts, IIROutputPorts, IHasBasicTriListWithSmartObject, ICec
|
||||
public class Dge100Controller : CrestronGenericBaseDevice, IComPorts, IIROutputPorts, IHasBasicTriListWithSmartObject, ICec, IDeviceInfoProvider
|
||||
{
|
||||
private const int CtpPort = 41795;
|
||||
private readonly Dge100 _dge;
|
||||
|
||||
private readonly TsxCcsUcCodec100EthernetReservedSigs _dgeEthernetInfo;
|
||||
|
||||
public BasicTriListWithSmartObject Panel { get { return _dge; } }
|
||||
|
||||
private DeviceConfig _dc;
|
||||
@@ -32,7 +37,14 @@ namespace PepperDash.Essentials.DM.Endpoints.DGEs
|
||||
public Dge100Controller(string key, string name, Dge100 device, DeviceConfig dc, CrestronTouchpanelPropertiesConfig props)
|
||||
:base(key, name, device)
|
||||
{
|
||||
_dge = device;
|
||||
_dge = device;
|
||||
_dgeEthernetInfo = _dge.ExtenderEthernetReservedSigs;
|
||||
//_dgeEthernetInfo.DeviceExtenderSigChange += (extender, args) => UpdateDeviceInfo();
|
||||
_dgeEthernetInfo.Use();
|
||||
|
||||
DeviceInfo = new DeviceInfo();
|
||||
|
||||
//_dge.OnlineStatusChange += (currentDevice, args) => { if (args.DeviceOnLine) UpdateDeviceInfo(); };
|
||||
|
||||
_dc = dc;
|
||||
|
||||
@@ -69,8 +81,86 @@ namespace PepperDash.Essentials.DM.Endpoints.DGEs
|
||||
|
||||
#region ICec Members
|
||||
public Cec StreamCec { get { return _dge.HdmiOut.StreamCec; } }
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Implementation of IDeviceInfoProvider
|
||||
|
||||
public DeviceInfo DeviceInfo { get; private set; }
|
||||
|
||||
public event DeviceInfoChangeHandler DeviceInfoChanged;
|
||||
|
||||
public void UpdateDeviceInfo()
|
||||
{
|
||||
DeviceInfo.IpAddress = _dgeEthernetInfo.IpAddressFeedback.StringValue;
|
||||
DeviceInfo.MacAddress = _dgeEthernetInfo.MacAddressFeedback.StringValue;
|
||||
|
||||
GetFirmwareAndSerialInfo();
|
||||
|
||||
OnDeviceInfoChange();
|
||||
}
|
||||
|
||||
private void GetFirmwareAndSerialInfo()
|
||||
{
|
||||
if (String.IsNullOrEmpty(_dgeEthernetInfo.IpAddressFeedback.StringValue))
|
||||
{
|
||||
Debug.Console(1, this, "IP Address information not yet received. No device is online");
|
||||
return;
|
||||
}
|
||||
|
||||
var tcpClient = new GenericTcpIpClient("", _dgeEthernetInfo.IpAddressFeedback.StringValue, CtpPort, 1024){AutoReconnect = false};
|
||||
|
||||
var gather = new CommunicationGather(tcpClient, "\r\n\r\n");
|
||||
|
||||
tcpClient.ConnectionChange += (sender, args) =>
|
||||
{
|
||||
if (!args.Client.IsConnected)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
args.Client.SendText("ver\r\n");
|
||||
};
|
||||
|
||||
gather.LineReceived += (sender, args) =>
|
||||
{
|
||||
if (args.Text.ToLower().Contains("host"))
|
||||
{
|
||||
DeviceInfo.HostName = args.Text.Split(';')[1].Trim();
|
||||
|
||||
tcpClient.Disconnect();
|
||||
return;
|
||||
}
|
||||
|
||||
//ignore console prompt
|
||||
if (args.Text.ToLower().Contains(">"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!args.Text.ToLower().Contains("dge"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
DeviceInfo.SerialNumber = args.Text.Split('[')[1].Split(' ')[4].Replace("#", "");
|
||||
DeviceInfo.FirmwareVersion = args.Text.Split('[')[1].Split(' ')[1];
|
||||
|
||||
tcpClient.SendText("host\r\n");
|
||||
};
|
||||
|
||||
tcpClient.Connect();
|
||||
}
|
||||
|
||||
private void OnDeviceInfoChange()
|
||||
{
|
||||
var handler = DeviceInfoChanged;
|
||||
|
||||
if (handler == null) return;
|
||||
|
||||
handler(this, new DeviceInfoEventArgs(DeviceInfo));
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public class Dge100ControllerFactory : EssentialsDeviceFactory<Dge100Controller>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using Crestron.SimplSharpPro.DM;
|
||||
@@ -12,7 +13,7 @@ using PepperDash.Core;
|
||||
namespace PepperDash.Essentials.DM
|
||||
{
|
||||
[Description("Wrapper Class for DM-RMC-4K-Z-SCALER-C")]
|
||||
public class DmRmc4kZScalerCController : DmRmcControllerBase, IRmcRouting,
|
||||
public class DmRmc4kZScalerCController : DmRmcControllerBase, IRmcRoutingWithFeedback,
|
||||
IIROutputPorts, IComPorts, ICec
|
||||
{
|
||||
private readonly DmRmc4kzScalerC _rmc;
|
||||
@@ -30,14 +31,34 @@ namespace PepperDash.Essentials.DM
|
||||
|
||||
public RoutingPortCollection<RoutingOutputPort> OutputPorts { get; private set; }
|
||||
|
||||
//IroutingNumericEvent
|
||||
public event EventHandler<RoutingNumericEventArgs> NumericSwitchChange;
|
||||
|
||||
/// <summary>
|
||||
/// Raise an event when the status of a switch object changes.
|
||||
/// </summary>
|
||||
/// <param name="e">Arguments defined as IKeyName sender, output, input, and eRoutingSignalType</param>
|
||||
private void OnSwitchChange(RoutingNumericEventArgs e)
|
||||
{
|
||||
var newEvent = NumericSwitchChange;
|
||||
if (newEvent != null) newEvent(this, e);
|
||||
}
|
||||
|
||||
|
||||
public DmRmc4kZScalerCController(string key, string name, DmRmc4kzScalerC rmc)
|
||||
: base(key, name, rmc)
|
||||
{
|
||||
_rmc = rmc;
|
||||
DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.AudioVideo,
|
||||
eRoutingPortConnectionType.DmCat, 0, this);
|
||||
eRoutingPortConnectionType.DmCat, 0, this)
|
||||
{
|
||||
FeedbackMatchObject = 1
|
||||
};
|
||||
HdmiIn = new RoutingInputPort(DmPortName.HdmiIn, eRoutingSignalType.AudioVideo,
|
||||
eRoutingPortConnectionType.Hdmi, 0, this);
|
||||
eRoutingPortConnectionType.Hdmi, 0, this)
|
||||
{
|
||||
FeedbackMatchObject = 2
|
||||
};
|
||||
HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.AudioVideo,
|
||||
eRoutingPortConnectionType.Hdmi, null, this);
|
||||
|
||||
@@ -54,12 +75,20 @@ namespace PepperDash.Essentials.DM
|
||||
_rmc.HdmiOutput.OutputStreamChange += HdmiOutput_OutputStreamChange;
|
||||
_rmc.HdmiOutput.ConnectedDevice.DeviceInformationChange += ConnectedDevice_DeviceInformationChange;
|
||||
|
||||
_rmc.OnlineStatusChange += _rmc_OnlineStatusChange;
|
||||
|
||||
// Set Ports for CEC
|
||||
HdmiOut.Port = _rmc.HdmiOutput;
|
||||
|
||||
AudioVideoSourceNumericFeedback = new IntFeedback(() => (ushort)(_rmc.SelectedSourceFeedback));
|
||||
}
|
||||
|
||||
private void _rmc_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args)
|
||||
{
|
||||
AudioVideoSourceNumericFeedback.FireUpdate();
|
||||
OnSwitchChange(new RoutingNumericEventArgs(1, AudioVideoSourceNumericFeedback.UShortValue, eRoutingSignalType.AudioVideo));
|
||||
}
|
||||
|
||||
void HdmiOutput_OutputStreamChange(EndpointOutputStream outputStream, EndpointOutputStreamEventArgs args)
|
||||
{
|
||||
if (args.EventId == EndpointOutputStreamEventIds.HorizontalResolutionFeedbackEventId || args.EventId == EndpointOutputStreamEventIds.VerticalResolutionFeedbackEventId ||
|
||||
@@ -70,7 +99,12 @@ namespace PepperDash.Essentials.DM
|
||||
|
||||
if (args.EventId == EndpointOutputStreamEventIds.SelectedSourceFeedbackEventId)
|
||||
{
|
||||
var localInputPort =
|
||||
InputPorts.FirstOrDefault(p => (int)p.FeedbackMatchObject == AudioVideoSourceNumericFeedback.UShortValue);
|
||||
|
||||
|
||||
AudioVideoSourceNumericFeedback.FireUpdate();
|
||||
OnSwitchChange(new RoutingNumericEventArgs(1, AudioVideoSourceNumericFeedback.UShortValue, OutputPorts.First(), localInputPort, eRoutingSignalType.AudioVideo));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,19 +2,22 @@
|
||||
using System.Collections.Generic;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using Crestron.SimplSharpPro.DM;
|
||||
using Crestron.SimplSharpPro.DM.Cards;
|
||||
using Crestron.SimplSharpPro.DM.Endpoints.Receivers;
|
||||
using Newtonsoft.Json;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Bridges;
|
||||
using PepperDash.Essentials.Core.DeviceInfo;
|
||||
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 abstract class DmRmcControllerBase : CrestronGenericBridgeableBaseDevice, IDeviceInfoProvider
|
||||
{
|
||||
private const int CtpPort = 41795;
|
||||
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; }
|
||||
@@ -31,6 +34,10 @@ namespace PepperDash.Essentials.DM
|
||||
PreventRegistration = _rmc.DMOutput != null;
|
||||
|
||||
AddToFeedbackList(VideoOutputResolutionFeedback, EdidManufacturerFeedback, EdidSerialNumberFeedback, EdidNameFeedback, EdidPreferredTimingFeedback);
|
||||
|
||||
DeviceInfo = new DeviceInfo();
|
||||
|
||||
_rmc.OnlineStatusChange += (currentDevice, args) => { if (args.DeviceOnLine) UpdateDeviceInfo(); };
|
||||
}
|
||||
|
||||
protected void LinkDmRmcToApi(DmRmcControllerBase rmc, BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
|
||||
@@ -78,7 +85,106 @@ namespace PepperDash.Essentials.DM
|
||||
|
||||
trilist.SetUShortSigAction(joinMap.AudioVideoSource.JoinNumber, a => routing.ExecuteNumericSwitch(a, 1, eRoutingSignalType.AudioVideo));
|
||||
}
|
||||
}
|
||||
|
||||
#region Implementation of IDeviceInfoProvider
|
||||
|
||||
public DeviceInfo DeviceInfo { get; private set; }
|
||||
public event DeviceInfoChangeHandler DeviceInfoChanged;
|
||||
|
||||
public void UpdateDeviceInfo()
|
||||
{
|
||||
Debug.Console(1, this, "Updating Device Info");
|
||||
|
||||
if (_rmc.ConnectedIpList.Count == 0)
|
||||
{
|
||||
Debug.Console(1, this, "IP Address information not yet received. No device is online");
|
||||
return;
|
||||
}
|
||||
|
||||
DeviceInfo.IpAddress = _rmc.ConnectedIpList[0].DeviceIpAddress;
|
||||
|
||||
foreach (var ip in _rmc.ConnectedIpList)
|
||||
{
|
||||
Debug.Console(0, this, "Connected IP Address: {0}", ip.DeviceIpAddress);
|
||||
}
|
||||
|
||||
GetFirmwareAndSerialInfo();
|
||||
|
||||
OnDeviceInfoChange();
|
||||
}
|
||||
|
||||
private void GetFirmwareAndSerialInfo()
|
||||
{
|
||||
var tcpClient = new GenericTcpIpClient(String.Format("{0}-devInfoSocket", Key), _rmc.ConnectedIpList[0].DeviceIpAddress, CtpPort, 1024)
|
||||
{
|
||||
AutoReconnect = false,
|
||||
};
|
||||
|
||||
var gather = new CommunicationGather(tcpClient, "\r\n\r\n");
|
||||
|
||||
tcpClient.ConnectionChange += (sender, args) =>
|
||||
{
|
||||
if (!args.Client.IsConnected)
|
||||
{
|
||||
OnDeviceInfoChange();
|
||||
return;
|
||||
}
|
||||
|
||||
args.Client.SendText("ver\r\n");
|
||||
};
|
||||
|
||||
gather.LineReceived += (sender, args) =>
|
||||
{
|
||||
//ignore console prompt
|
||||
if (args.Text.ToLower().Contains(">"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (args.Text.ToLower().Contains("host"))
|
||||
{
|
||||
DeviceInfo.HostName = args.Text.Split(':')[1].Trim();
|
||||
|
||||
tcpClient.SendText("maca\r\n");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.Text.ToLower().Contains("mac"))
|
||||
{
|
||||
DeviceInfo.MacAddress = args.Text.Split(':')[1].Trim().Replace(" ", ":");
|
||||
|
||||
tcpClient.Disconnect();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!args.Text.ToLower().Contains("rmc"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
DeviceInfo.SerialNumber = args.Text.Split('[')[1].Split(' ')[4].Replace("#", "");
|
||||
DeviceInfo.FirmwareVersion = args.Text.Split('[')[1].Split(' ')[1];
|
||||
|
||||
tcpClient.SendText("host\r\n");
|
||||
};
|
||||
|
||||
tcpClient.Connect();
|
||||
}
|
||||
|
||||
private void OnDeviceInfoChange()
|
||||
{
|
||||
var handler = DeviceInfoChanged;
|
||||
|
||||
if (handler == null) return;
|
||||
|
||||
handler(this, new DeviceInfoEventArgs(DeviceInfo));
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public abstract class DmHdBaseTControllerBase : CrestronGenericBaseDevice
|
||||
{
|
||||
@@ -221,6 +327,10 @@ namespace PepperDash.Essentials.DM
|
||||
DmRmcPropertiesConfig props, string pKey, uint ipid)
|
||||
{
|
||||
var parentDev = DeviceManager.GetDeviceForKey(pKey);
|
||||
if (parentDev is DmpsRoutingController)
|
||||
{
|
||||
return GetDmRmcControllerForDmps(key, name, typeName, parentDev as DmpsRoutingController, props.ParentOutputNumber);
|
||||
}
|
||||
if (!(parentDev is IDmSwitch))
|
||||
{
|
||||
Debug.Console(0, "Cannot create DM device '{0}'. '{1}' is not a DM Chassis.",
|
||||
@@ -285,6 +395,28 @@ namespace PepperDash.Essentials.DM
|
||||
return null;
|
||||
}
|
||||
|
||||
private static CrestronGenericBaseDevice GetDmRmcControllerForDmps(string key, string name, string typeName,
|
||||
DmpsRoutingController controller, uint num)
|
||||
{
|
||||
Func<string, string, DMOutput, CrestronGenericBaseDevice> dmpsHandler;
|
||||
if (ChassisCpu3Dict.TryGetValue(typeName.ToLower(), out dmpsHandler))
|
||||
{
|
||||
var output = controller.Dmps.SwitcherOutputs[num] as DMOutput;
|
||||
|
||||
if (output != null)
|
||||
{
|
||||
return dmpsHandler(key, name, output);
|
||||
}
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Error,
|
||||
"Cannot attach DM-RMC of type '{0}' to output {1} on DMPS chassis. Output is not a DM Output.",
|
||||
typeName, num);
|
||||
return null;
|
||||
}
|
||||
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Error, "Cannot create DM-RMC of type '{0}' to output {1} on DMPS chassis", typeName, num);
|
||||
return null;
|
||||
}
|
||||
|
||||
private static CrestronGenericBaseDevice GetDmRmcControllerForProcessor(string key, string name, string typeName, uint ipid)
|
||||
{
|
||||
try
|
||||
@@ -305,6 +437,8 @@ namespace PepperDash.Essentials.DM
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class DmRmcControllerFactory : EssentialsDeviceFactory<DmRmcControllerBase>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using Crestron.SimplSharpPro.DM;
|
||||
@@ -17,7 +18,7 @@ namespace PepperDash.Essentials.DM
|
||||
/// Controller class for all DM-TX-201C/S/F transmitters
|
||||
/// </summary>
|
||||
[Description("Wrapper class for DM-TX-200-C")]
|
||||
public class DmTx200Controller : DmTxControllerBase, ITxRouting, IHasFreeRun, IVgaBrightnessContrastControls
|
||||
public class DmTx200Controller : DmTxControllerBase, ITxRoutingWithFeedback, IHasFreeRun, IVgaBrightnessContrastControls
|
||||
{
|
||||
public DmTx200C2G Tx { get; private set; }
|
||||
|
||||
@@ -35,7 +36,21 @@ namespace PepperDash.Essentials.DM
|
||||
public BoolFeedback FreeRunEnabledFeedback { get; protected set; }
|
||||
|
||||
public IntFeedback VgaBrightnessFeedback { get; protected set; }
|
||||
public IntFeedback VgaContrastFeedback { get; protected set; }
|
||||
public IntFeedback VgaContrastFeedback { get; protected set; }
|
||||
|
||||
//IroutingNumericEvent
|
||||
public event EventHandler<RoutingNumericEventArgs> NumericSwitchChange;
|
||||
|
||||
/// <summary>
|
||||
/// Raise an event when the status of a switch object changes.
|
||||
/// </summary>
|
||||
/// <param name="e">Arguments defined as IKeyName sender, output, input, and eRoutingSignalType</param>
|
||||
private void OnSwitchChange(RoutingNumericEventArgs e)
|
||||
{
|
||||
var newEvent = NumericSwitchChange;
|
||||
if (newEvent != null) newEvent(this, e);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Helps get the "real" inputs, including when in Auto
|
||||
@@ -85,14 +100,22 @@ namespace PepperDash.Essentials.DM
|
||||
public DmTx200Controller(string key, string name, DmTx200C2G 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));
|
||||
Tx = tx;
|
||||
|
||||
HdmiInput = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn,
|
||||
eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi,
|
||||
DmTx200Base.eSourceSelection.Digital, this,
|
||||
VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInput))
|
||||
{
|
||||
FeedbackMatchObject = DmTx200Base.eSourceSelection.Digital
|
||||
};
|
||||
|
||||
VgaInput = new RoutingInputPortWithVideoStatuses(DmPortName.VgaIn,
|
||||
eRoutingSignalType.Video, eRoutingPortConnectionType.Vga, DmTx200Base.eSourceSelection.Analog, this,
|
||||
VideoStatusHelper.GetVgaInputStatusFuncs(tx.VgaInput))
|
||||
{
|
||||
FeedbackMatchObject = DmTx200Base.eSourceSelection.Analog
|
||||
};
|
||||
|
||||
ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput",
|
||||
() => ActualActiveVideoInput.ToString());
|
||||
@@ -195,12 +218,19 @@ namespace PepperDash.Essentials.DM
|
||||
}
|
||||
}
|
||||
|
||||
void Tx_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args)
|
||||
{
|
||||
void Tx_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args)
|
||||
{
|
||||
var localVideoInputPort =
|
||||
InputPorts.FirstOrDefault(p => (DmTx200Base.eSourceSelection) p.Selector == Tx.VideoSourceFeedback);
|
||||
var localAudioInputPort =
|
||||
InputPorts.FirstOrDefault(p => (DmTx200Base.eSourceSelection) p.Selector == Tx.AudioSourceFeedback);
|
||||
|
||||
|
||||
ActiveVideoInputFeedback.FireUpdate();
|
||||
VideoSourceNumericFeedback.FireUpdate();
|
||||
AudioSourceNumericFeedback.FireUpdate();
|
||||
|
||||
AudioSourceNumericFeedback.FireUpdate();
|
||||
OnSwitchChange(new RoutingNumericEventArgs(1, VideoSourceNumericFeedback.UShortValue, OutputPorts.First(), localVideoInputPort, eRoutingSignalType.Video));
|
||||
OnSwitchChange(new RoutingNumericEventArgs(1, AudioSourceNumericFeedback.UShortValue, OutputPorts.First(), localAudioInputPort, eRoutingSignalType.Audio));
|
||||
}
|
||||
|
||||
public override bool CustomActivate()
|
||||
@@ -303,14 +333,18 @@ namespace PepperDash.Essentials.DM
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case EndpointTransmitterBase.VideoSourceFeedbackEventId:
|
||||
case EndpointTransmitterBase.VideoSourceFeedbackEventId:
|
||||
var localVideoInputPort = InputPorts.FirstOrDefault(p => (DmTx200Base.eSourceSelection)p.Selector == Tx.VideoSourceFeedback);
|
||||
Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback);
|
||||
VideoSourceNumericFeedback.FireUpdate();
|
||||
ActiveVideoInputFeedback.FireUpdate();
|
||||
ActiveVideoInputFeedback.FireUpdate();
|
||||
OnSwitchChange(new RoutingNumericEventArgs(1, VideoSourceNumericFeedback.UShortValue, OutputPorts.First(), localVideoInputPort, eRoutingSignalType.Video));
|
||||
break;
|
||||
case EndpointTransmitterBase.AudioSourceFeedbackEventId:
|
||||
case EndpointTransmitterBase.AudioSourceFeedbackEventId:
|
||||
var localInputAudioPort = InputPorts.FirstOrDefault(p => (DmTx200Base.eSourceSelection)p.Selector == Tx.AudioSourceFeedback);
|
||||
Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback);
|
||||
AudioSourceNumericFeedback.FireUpdate();
|
||||
AudioSourceNumericFeedback.FireUpdate();
|
||||
OnSwitchChange(new RoutingNumericEventArgs(1, AudioSourceNumericFeedback.UShortValue, OutputPorts.First(), localInputAudioPort, eRoutingSignalType.Audio));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using Crestron.SimplSharpPro.DM;
|
||||
using Crestron.SimplSharpPro.DM.Endpoints;
|
||||
using Crestron.SimplSharpPro.DM.Endpoints.Transmitters;
|
||||
using System.Linq;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
@@ -14,8 +15,8 @@ namespace PepperDash.Essentials.DM
|
||||
/// <summary>
|
||||
/// Controller class for all DM-TX-201C/S/F transmitters
|
||||
/// </summary>
|
||||
[Description("Wrapper class for DM-TX-201-C")]
|
||||
public class DmTx201CController : DmTxControllerBase, ITxRouting, IHasFreeRun, IVgaBrightnessContrastControls
|
||||
[Description("Wrapper class for DM-TX-201-C")]
|
||||
public class DmTx201CController : DmTxControllerBase, ITxRoutingWithFeedback, IHasFreeRun, IVgaBrightnessContrastControls
|
||||
{
|
||||
public DmTx201C Tx { get; private set; }
|
||||
|
||||
@@ -34,7 +35,20 @@ namespace PepperDash.Essentials.DM
|
||||
public BoolFeedback FreeRunEnabledFeedback { get; protected set; }
|
||||
|
||||
public IntFeedback VgaBrightnessFeedback { get; protected set; }
|
||||
public IntFeedback VgaContrastFeedback { get; protected set; }
|
||||
public IntFeedback VgaContrastFeedback { get; protected set; }
|
||||
|
||||
//IroutingNumericEvent
|
||||
public event EventHandler<RoutingNumericEventArgs> NumericSwitchChange;
|
||||
|
||||
/// <summary>
|
||||
/// Raise an event when the status of a switch object changes.
|
||||
/// </summary>
|
||||
/// <param name="e">Arguments defined as IKeyName sender, output, input, and eRoutingSignalType</param>
|
||||
private void OnSwitchChange(RoutingNumericEventArgs e)
|
||||
{
|
||||
var newEvent = NumericSwitchChange;
|
||||
if (newEvent != null) newEvent(this, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helps get the "real" inputs, including when in Auto
|
||||
@@ -89,14 +103,22 @@ namespace PepperDash.Essentials.DM
|
||||
public DmTx201CController(string key, string name, DmTx201C 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));
|
||||
Tx = tx;
|
||||
|
||||
HdmiInput = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn,
|
||||
eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi,
|
||||
DmTx200Base.eSourceSelection.Digital, this,
|
||||
VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInput))
|
||||
{
|
||||
FeedbackMatchObject = DmTx200Base.eSourceSelection.Digital
|
||||
};
|
||||
|
||||
VgaInput = new RoutingInputPortWithVideoStatuses(DmPortName.VgaIn,
|
||||
eRoutingSignalType.Video, eRoutingPortConnectionType.Vga, DmTx200Base.eSourceSelection.Analog, this,
|
||||
VideoStatusHelper.GetVgaInputStatusFuncs(tx.VgaInput))
|
||||
{
|
||||
FeedbackMatchObject = DmTx200Base.eSourceSelection.Analog
|
||||
};
|
||||
|
||||
ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput",
|
||||
() => ActualActiveVideoInput.ToString());
|
||||
@@ -190,16 +212,23 @@ namespace PepperDash.Essentials.DM
|
||||
VgaContrastFeedback.FireUpdate();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void Tx_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args)
|
||||
{
|
||||
ActiveVideoInputFeedback.FireUpdate();
|
||||
VideoSourceNumericFeedback.FireUpdate();
|
||||
AudioSourceNumericFeedback.FireUpdate();
|
||||
|
||||
}
|
||||
|
||||
void Tx_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args)
|
||||
{
|
||||
var localVideoInputPort =
|
||||
InputPorts.FirstOrDefault(p => (DmTx200Base.eSourceSelection)p.Selector == Tx.VideoSourceFeedback);
|
||||
var localAudioInputPort =
|
||||
InputPorts.FirstOrDefault(p => (DmTx200Base.eSourceSelection)p.Selector == Tx.AudioSourceFeedback);
|
||||
|
||||
|
||||
ActiveVideoInputFeedback.FireUpdate();
|
||||
VideoSourceNumericFeedback.FireUpdate();
|
||||
AudioSourceNumericFeedback.FireUpdate();
|
||||
OnSwitchChange(new RoutingNumericEventArgs(1, VideoSourceNumericFeedback.UShortValue, OutputPorts.First(), localVideoInputPort, eRoutingSignalType.Video));
|
||||
OnSwitchChange(new RoutingNumericEventArgs(1, AudioSourceNumericFeedback.UShortValue, OutputPorts.First(), localAudioInputPort, eRoutingSignalType.Audio));
|
||||
}
|
||||
|
||||
private void VgaInputOnInputStreamChange(EndpointInputStream inputStream, EndpointInputStreamEventArgs args)
|
||||
{
|
||||
switch (args.EventId)
|
||||
@@ -312,23 +341,26 @@ namespace PepperDash.Essentials.DM
|
||||
}
|
||||
|
||||
void Tx_BaseEvent(GenericBase device, BaseEventArgs args)
|
||||
{
|
||||
var id = args.EventId;
|
||||
{
|
||||
var id = args.EventId;
|
||||
Debug.Console(2, this, "EventId {0}", args.EventId);
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case EndpointTransmitterBase.VideoSourceFeedbackEventId:
|
||||
var localVideoInputPort = InputPorts.FirstOrDefault(p => (DmTx200Base.eSourceSelection)p.Selector == Tx.VideoSourceFeedback);
|
||||
Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback);
|
||||
ActiveVideoInputFeedback.FireUpdate();
|
||||
VideoSourceNumericFeedback.FireUpdate();
|
||||
ActiveVideoInputFeedback.FireUpdate();
|
||||
ActiveVideoInputFeedback.FireUpdate();
|
||||
OnSwitchChange(new RoutingNumericEventArgs(1, VideoSourceNumericFeedback.UShortValue, OutputPorts.First(), localVideoInputPort, eRoutingSignalType.Video));
|
||||
break;
|
||||
case EndpointTransmitterBase.AudioSourceFeedbackEventId:
|
||||
Debug.Console(2, this, " Audio Source : {0}", Tx.AudioSourceFeedback);
|
||||
var localInputAudioPort = InputPorts.FirstOrDefault(p => (DmTx200Base.eSourceSelection)p.Selector == Tx.AudioSourceFeedback);
|
||||
Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback);
|
||||
AudioSourceNumericFeedback.FireUpdate();
|
||||
OnSwitchChange(new RoutingNumericEventArgs(1, AudioSourceNumericFeedback.UShortValue, OutputPorts.First(), localInputAudioPort, eRoutingSignalType.Audio));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void InputStreamChangeEvent(EndpointInputStream inputStream, EndpointInputStreamEventArgs args)
|
||||
|
||||
@@ -4,6 +4,7 @@ using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using Crestron.SimplSharpPro.DM;
|
||||
using Crestron.SimplSharpPro.DM.Endpoints;
|
||||
using Crestron.SimplSharpPro.DM.Endpoints.Transmitters;
|
||||
using System.Linq;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
@@ -15,7 +16,7 @@ namespace PepperDash.Essentials.DM
|
||||
/// Controller class for all DM-TX-201S/F transmitters
|
||||
/// </summary>
|
||||
[Description("Wrapper class for DM-TX-201-S/F")]
|
||||
public class DmTx201SController : DmTxControllerBase, ITxRouting, IHasFreeRun, IVgaBrightnessContrastControls
|
||||
public class DmTx201SController : DmTxControllerBase, ITxRoutingWithFeedback, IHasFreeRun, IVgaBrightnessContrastControls
|
||||
{
|
||||
public DmTx201S Tx { get; private set; }
|
||||
|
||||
@@ -36,6 +37,21 @@ namespace PepperDash.Essentials.DM
|
||||
public IntFeedback VgaBrightnessFeedback { get; protected set; }
|
||||
public IntFeedback VgaContrastFeedback { get; protected set; }
|
||||
|
||||
//IroutingNumericEvent
|
||||
public event EventHandler<RoutingNumericEventArgs> NumericSwitchChange;
|
||||
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
/// Raise an event when the status of a switch object changes.
|
||||
/// </summary>
|
||||
/// <param name="e">Arguments defined as IKeyName sender, output, input, and eRoutingSignalType</param>
|
||||
private void OnSwitchChange(RoutingNumericEventArgs e)
|
||||
{
|
||||
var newEvent = NumericSwitchChange;
|
||||
if (newEvent != null) newEvent(this, e);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Helps get the "real" inputs, including when in Auto
|
||||
/// </summary>
|
||||
@@ -92,11 +108,19 @@ namespace PepperDash.Essentials.DM
|
||||
Tx = tx;
|
||||
|
||||
HdmiInput = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn,
|
||||
eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, DmTx200Base.eSourceSelection.Digital, this,
|
||||
VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInput));
|
||||
eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi,
|
||||
DmTx200Base.eSourceSelection.Digital, this,
|
||||
VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInput))
|
||||
{
|
||||
FeedbackMatchObject = DmTx200Base.eSourceSelection.Digital
|
||||
};
|
||||
|
||||
VgaInput = new RoutingInputPortWithVideoStatuses(DmPortName.VgaIn,
|
||||
eRoutingSignalType.Video, eRoutingPortConnectionType.Vga, DmTx200Base.eSourceSelection.Analog, this,
|
||||
VideoStatusHelper.GetVgaInputStatusFuncs(tx.VgaInput));
|
||||
VideoStatusHelper.GetVgaInputStatusFuncs(tx.VgaInput))
|
||||
{
|
||||
FeedbackMatchObject = DmTx200Base.eSourceSelection.Analog
|
||||
};
|
||||
|
||||
ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput",
|
||||
() => ActualActiveVideoInput.ToString());
|
||||
@@ -194,11 +218,18 @@ namespace PepperDash.Essentials.DM
|
||||
|
||||
void Tx_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args)
|
||||
{
|
||||
var localVideoInputPort =
|
||||
InputPorts.FirstOrDefault(p => (DmTx200Base.eSourceSelection)p.Selector == Tx.VideoSourceFeedback);
|
||||
var localAudioInputPort =
|
||||
InputPorts.FirstOrDefault(p => (DmTx200Base.eSourceSelection)p.Selector == Tx.AudioSourceFeedback);
|
||||
|
||||
|
||||
ActiveVideoInputFeedback.FireUpdate();
|
||||
VideoSourceNumericFeedback.FireUpdate();
|
||||
AudioSourceNumericFeedback.FireUpdate();
|
||||
|
||||
}
|
||||
OnSwitchChange(new RoutingNumericEventArgs(1, VideoSourceNumericFeedback.UShortValue, OutputPorts.First(), localVideoInputPort, eRoutingSignalType.Video));
|
||||
OnSwitchChange(new RoutingNumericEventArgs(1, AudioSourceNumericFeedback.UShortValue, OutputPorts.First(), localAudioInputPort, eRoutingSignalType.Audio));
|
||||
}
|
||||
|
||||
private void VgaInputOnInputStreamChange(EndpointInputStream inputStream, EndpointInputStreamEventArgs args)
|
||||
{
|
||||
@@ -319,17 +350,20 @@ namespace PepperDash.Essentials.DM
|
||||
switch (id)
|
||||
{
|
||||
case EndpointTransmitterBase.VideoSourceFeedbackEventId:
|
||||
var localVideoInputPort = InputPorts.FirstOrDefault(p => (DmTx200Base.eSourceSelection)p.Selector == Tx.VideoSourceFeedback);
|
||||
Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback);
|
||||
ActiveVideoInputFeedback.FireUpdate();
|
||||
VideoSourceNumericFeedback.FireUpdate();
|
||||
ActiveVideoInputFeedback.FireUpdate();
|
||||
OnSwitchChange(new RoutingNumericEventArgs(1, VideoSourceNumericFeedback.UShortValue, OutputPorts.First(), localVideoInputPort, eRoutingSignalType.Video));
|
||||
break;
|
||||
case EndpointTransmitterBase.AudioSourceFeedbackEventId:
|
||||
Debug.Console(2, this, " Audio Source : {0}", Tx.AudioSourceFeedback);
|
||||
var localInputAudioPort = InputPorts.FirstOrDefault(p => (DmTx200Base.eSourceSelection)p.Selector == Tx.AudioSourceFeedback);
|
||||
Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback);
|
||||
AudioSourceNumericFeedback.FireUpdate();
|
||||
OnSwitchChange(new RoutingNumericEventArgs(1, AudioSourceNumericFeedback.UShortValue, OutputPorts.First(), localInputAudioPort, eRoutingSignalType.Audio));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void InputStreamChangeEvent(EndpointInputStream inputStream, EndpointInputStreamEventArgs args)
|
||||
{
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace PepperDash.Essentials.DM
|
||||
using eVst = DmTx401C.eSourceSelection;
|
||||
|
||||
[Description("Wrapper class for DM-TX-401-C")]
|
||||
public class DmTx401CController : DmTxControllerBase, ITxRouting, IIROutputPorts, IComPorts, IHasFreeRun, IVgaBrightnessContrastControls
|
||||
public class DmTx401CController : DmTxControllerBase, ITxRoutingWithFeedback, IIROutputPorts, IComPorts, IHasFreeRun, IVgaBrightnessContrastControls
|
||||
{
|
||||
public DmTx401C Tx { get; private set; }
|
||||
|
||||
@@ -41,7 +41,21 @@ namespace PepperDash.Essentials.DM
|
||||
public BoolFeedback FreeRunEnabledFeedback { get; protected set; }
|
||||
|
||||
public IntFeedback VgaBrightnessFeedback { get; protected set; }
|
||||
public IntFeedback VgaContrastFeedback { get; protected set; }
|
||||
public IntFeedback VgaContrastFeedback { get; protected set; }
|
||||
|
||||
//IroutingNumericEvent
|
||||
public event EventHandler<RoutingNumericEventArgs> NumericSwitchChange;
|
||||
|
||||
/// <summary>
|
||||
/// Raise an event when the status of a switch object changes.
|
||||
/// </summary>
|
||||
/// <param name="e">Arguments defined as IKeyName sender, output, input, and eRoutingSignalType</param>
|
||||
private void OnSwitchChange(RoutingNumericEventArgs e)
|
||||
{
|
||||
var newEvent = NumericSwitchChange;
|
||||
if (newEvent != null) newEvent(this, e);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Helps get the "real" inputs, including when in Auto
|
||||
@@ -104,20 +118,33 @@ namespace PepperDash.Essentials.DM
|
||||
|
||||
HdmiIn = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn,
|
||||
eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eVst.HDMI, this,
|
||||
VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInput));
|
||||
VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInput))
|
||||
{
|
||||
FeedbackMatchObject = eVst.HDMI
|
||||
};
|
||||
DisplayPortIn = new RoutingInputPortWithVideoStatuses(DmPortName.DisplayPortIn,
|
||||
eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eVst.DisplayPort, this,
|
||||
VideoStatusHelper.GetDisplayPortInputStatusFuncs(tx.DisplayPortInput));
|
||||
VideoStatusHelper.GetDisplayPortInputStatusFuncs(tx.DisplayPortInput))
|
||||
{
|
||||
FeedbackMatchObject = eVst.DisplayPort
|
||||
};
|
||||
VgaIn = new RoutingInputPortWithVideoStatuses(DmPortName.VgaIn,
|
||||
eRoutingSignalType.Video, eRoutingPortConnectionType.Vga, eVst.VGA, this,
|
||||
VideoStatusHelper.GetVgaInputStatusFuncs(tx.VgaInput));
|
||||
VideoStatusHelper.GetVgaInputStatusFuncs(tx.VgaInput))
|
||||
{
|
||||
FeedbackMatchObject = eVst.VGA
|
||||
};
|
||||
CompositeIn = new RoutingInputPortWithVideoStatuses(DmPortName.CompositeIn,
|
||||
eRoutingSignalType.Video, eRoutingPortConnectionType.Composite, eVst.Composite, this,
|
||||
VideoStatusHelper.GetVgaInputStatusFuncs(tx.VgaInput));
|
||||
VideoStatusHelper.GetVgaInputStatusFuncs(tx.VgaInput))
|
||||
{
|
||||
FeedbackMatchObject = eVst.Composite
|
||||
};
|
||||
|
||||
Tx.HdmiInput.InputStreamChange += HdmiInputStreamChangeEvent;
|
||||
Tx.DisplayPortInput.InputStreamChange += DisplayPortInputStreamChangeEvent;
|
||||
Tx.BaseEvent += Tx_BaseEvent;
|
||||
Tx.OnlineStatusChange += Tx_OnlineStatusChange;
|
||||
Tx.VgaInput.InputStreamChange += VgaInputOnInputStreamChange;
|
||||
tx.VgaInput.VideoControls.ControlChange += VideoControls_ControlChange;
|
||||
|
||||
@@ -286,6 +313,20 @@ namespace PepperDash.Essentials.DM
|
||||
Tx.AudioSource = (eVst)inputSelector;
|
||||
}
|
||||
|
||||
void Tx_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args)
|
||||
{
|
||||
var localVideoInputPort =
|
||||
InputPorts.FirstOrDefault(p => (eVst)p.Selector == Tx.VideoSourceFeedback);
|
||||
var localAudioInputPort =
|
||||
InputPorts.FirstOrDefault(p => (eVst)p.Selector == Tx.AudioSourceFeedback);
|
||||
|
||||
ActiveVideoInputFeedback.FireUpdate();
|
||||
VideoSourceNumericFeedback.FireUpdate();
|
||||
AudioSourceNumericFeedback.FireUpdate();
|
||||
OnSwitchChange(new RoutingNumericEventArgs(1, VideoSourceNumericFeedback.UShortValue, OutputPorts.First(), localVideoInputPort, eRoutingSignalType.Video));
|
||||
OnSwitchChange(new RoutingNumericEventArgs(1, AudioSourceNumericFeedback.UShortValue, OutputPorts.First(), localAudioInputPort, eRoutingSignalType.Audio));
|
||||
}
|
||||
|
||||
void Tx_BaseEvent(GenericBase device, BaseEventArgs args)
|
||||
{
|
||||
var id = args.EventId;
|
||||
@@ -294,16 +335,20 @@ namespace PepperDash.Essentials.DM
|
||||
switch (id)
|
||||
{
|
||||
case EndpointTransmitterBase.VideoSourceFeedbackEventId:
|
||||
var localVideoInputPort = InputPorts.FirstOrDefault(p => (eVst)p.Selector == Tx.VideoSourceFeedback);
|
||||
Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback);
|
||||
VideoSourceNumericFeedback.FireUpdate();
|
||||
ActiveVideoInputFeedback.FireUpdate();
|
||||
OnSwitchChange(new RoutingNumericEventArgs(1, VideoSourceNumericFeedback.UShortValue, OutputPorts.First(), localVideoInputPort, eRoutingSignalType.Video));
|
||||
break;
|
||||
case EndpointTransmitterBase.AudioSourceFeedbackEventId:
|
||||
var localInputAudioPort = InputPorts.FirstOrDefault(p => (eVst)p.Selector == Tx.AudioSourceFeedback);
|
||||
Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback);
|
||||
AudioSourceNumericFeedback.FireUpdate();
|
||||
OnSwitchChange(new RoutingNumericEventArgs(1, AudioSourceNumericFeedback.UShortValue, OutputPorts.First(), localInputAudioPort, eRoutingSignalType.Audio));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VideoControls_ControlChange(object sender, GenericEventArgs args)
|
||||
{
|
||||
|
||||
@@ -20,8 +20,8 @@ namespace PepperDash.Essentials.DM
|
||||
using eVst = Crestron.SimplSharpPro.DeviceSupport.eX02VideoSourceType;
|
||||
using eAst = Crestron.SimplSharpPro.DeviceSupport.eX02AudioSourceType;
|
||||
|
||||
[Description("Wrapper class for DM-TX-4K-202-C")]
|
||||
public class DmTx4k202CController : DmTxControllerBase, ITxRouting, IHasFeedback,
|
||||
[Description("Wrapper class for DM-TX-4K-202-C")]
|
||||
public class DmTx4k202CController : DmTxControllerBase, ITxRoutingWithFeedback, IHasFeedback,
|
||||
IIROutputPorts, IComPorts
|
||||
{
|
||||
public DmTx4k202C Tx { get; private set; }
|
||||
@@ -37,7 +37,21 @@ namespace PepperDash.Essentials.DM
|
||||
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 Hdmi2VideoSyncFeedback { get; protected set; }
|
||||
|
||||
//IroutingNumericEvent
|
||||
public event EventHandler<RoutingNumericEventArgs> NumericSwitchChange;
|
||||
|
||||
/// <summary>
|
||||
/// Raise an event when the status of a switch object changes.
|
||||
/// </summary>
|
||||
/// <param name="e">Arguments defined as IKeyName sender, output, input, and eRoutingSignalType</param>
|
||||
private void OnSwitchChange(RoutingNumericEventArgs e)
|
||||
{
|
||||
var newEvent = NumericSwitchChange;
|
||||
if (newEvent != null) newEvent(this, e);
|
||||
}
|
||||
|
||||
|
||||
//public override IntFeedback HdcpSupportAllFeedback { get; protected set; }
|
||||
//public override ushort HdcpSupportCapability { get; protected set; }
|
||||
@@ -80,106 +94,121 @@ namespace PepperDash.Essentials.DM
|
||||
{
|
||||
return new RoutingPortCollection<RoutingOutputPort> { DmOut, HdmiLoopOut };
|
||||
}
|
||||
}
|
||||
public DmTx4k202CController(string key, string name, DmTx4k202C 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]));
|
||||
ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput",
|
||||
() => ActualActiveVideoInput.ToString());
|
||||
|
||||
|
||||
|
||||
Tx.HdmiInputs[1].InputStreamChange += InputStreamChangeEvent;
|
||||
Tx.HdmiInputs[2].InputStreamChange += InputStreamChangeEvent;
|
||||
|
||||
Tx.BaseEvent += Tx_BaseEvent;
|
||||
|
||||
VideoSourceNumericFeedback = new IntFeedback(() => (int)Tx.VideoSourceFeedback);
|
||||
|
||||
AudioSourceNumericFeedback = new IntFeedback(() => (int)Tx.AudioSourceFeedback);
|
||||
|
||||
HdmiIn1HdcpCapabilityFeedback = new IntFeedback("HdmiIn1HdcpCapability", () => (int)tx.HdmiInputs[1].HdcpCapabilityFeedback);
|
||||
|
||||
HdmiIn2HdcpCapabilityFeedback = new IntFeedback("HdmiIn2HdcpCapability", () => (int)tx.HdmiInputs[2].HdcpCapabilityFeedback);
|
||||
|
||||
HdcpStateFeedback =
|
||||
new IntFeedback(
|
||||
() =>
|
||||
tx.HdmiInputs[1].HdcpCapabilityFeedback > tx.HdmiInputs[2].HdcpCapabilityFeedback
|
||||
? (int) tx.HdmiInputs[1].HdcpCapabilityFeedback
|
||||
: (int) tx.HdmiInputs[2].HdcpCapabilityFeedback);
|
||||
|
||||
HdcpSupportCapability = eHdcpCapabilityType.Hdcp2_2Support;
|
||||
|
||||
Hdmi1VideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue);
|
||||
|
||||
Hdmi2VideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInputs[2].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();
|
||||
return "";
|
||||
},
|
||||
VideoSyncFeedbackFunc = () =>
|
||||
(ActualActiveVideoInput == eVst.Hdmi1
|
||||
&& tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue)
|
||||
|| (ActualActiveVideoInput == eVst.Hdmi2
|
||||
&& tx.HdmiInputs[2].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);
|
||||
|
||||
// Set Ports for CEC
|
||||
HdmiIn1.Port = Tx.HdmiInputs[1];
|
||||
HdmiIn2.Port = Tx.HdmiInputs[2];
|
||||
HdmiLoopOut.Port = Tx.HdmiOutput;
|
||||
DmOut.Port = Tx.DmOutput;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public DmTx4k202CController(string key, string name, DmTx4k202C 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]))
|
||||
{
|
||||
FeedbackMatchObject = eVst.Hdmi1
|
||||
};
|
||||
HdmiIn2 = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn2,
|
||||
eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eVst.Hdmi2, this,
|
||||
VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInputs[2]))
|
||||
{
|
||||
FeedbackMatchObject = eVst.Hdmi2
|
||||
};
|
||||
|
||||
ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput",
|
||||
() => ActualActiveVideoInput.ToString());
|
||||
|
||||
|
||||
|
||||
Tx.HdmiInputs[1].InputStreamChange += InputStreamChangeEvent;
|
||||
Tx.HdmiInputs[2].InputStreamChange += InputStreamChangeEvent;
|
||||
|
||||
Tx.BaseEvent += Tx_BaseEvent;
|
||||
|
||||
Tx.OnlineStatusChange += Tx_OnlineStatusChange;
|
||||
|
||||
VideoSourceNumericFeedback = new IntFeedback(() => (int) Tx.VideoSourceFeedback);
|
||||
|
||||
AudioSourceNumericFeedback = new IntFeedback(() => (int) Tx.AudioSourceFeedback);
|
||||
|
||||
HdmiIn1HdcpCapabilityFeedback = new IntFeedback("HdmiIn1HdcpCapability",
|
||||
() => (int) tx.HdmiInputs[1].HdcpCapabilityFeedback);
|
||||
|
||||
HdmiIn2HdcpCapabilityFeedback = new IntFeedback("HdmiIn2HdcpCapability",
|
||||
() => (int) tx.HdmiInputs[2].HdcpCapabilityFeedback);
|
||||
|
||||
HdcpStateFeedback =
|
||||
new IntFeedback(
|
||||
() =>
|
||||
tx.HdmiInputs[1].HdcpCapabilityFeedback > tx.HdmiInputs[2].HdcpCapabilityFeedback
|
||||
? (int) tx.HdmiInputs[1].HdcpCapabilityFeedback
|
||||
: (int) tx.HdmiInputs[2].HdcpCapabilityFeedback);
|
||||
|
||||
HdcpSupportCapability = eHdcpCapabilityType.Hdcp2_2Support;
|
||||
|
||||
Hdmi1VideoSyncFeedback = new BoolFeedback(() => (bool) tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue);
|
||||
|
||||
Hdmi2VideoSyncFeedback = new BoolFeedback(() => (bool) tx.HdmiInputs[2].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();
|
||||
return "";
|
||||
},
|
||||
VideoSyncFeedbackFunc = () =>
|
||||
(ActualActiveVideoInput == eVst.Hdmi1
|
||||
&& tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue)
|
||||
|| (ActualActiveVideoInput == eVst.Hdmi2
|
||||
&& tx.HdmiInputs[2].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);
|
||||
|
||||
// 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
|
||||
@@ -294,26 +323,43 @@ namespace PepperDash.Essentials.DM
|
||||
if (inputStream == Tx.HdmiInputs[2]) Hdmi2VideoSyncFeedback.FireUpdate();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void Tx_BaseEvent(GenericBase device, BaseEventArgs args)
|
||||
{
|
||||
var id = args.EventId;
|
||||
Debug.Console(2, this, "EventId {0}", args.EventId);
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case EndpointTransmitterBase.VideoSourceFeedbackEventId:
|
||||
Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback);
|
||||
ActiveVideoInputFeedback.FireUpdate();
|
||||
VideoSourceNumericFeedback.FireUpdate();
|
||||
ActiveVideoInputFeedback.FireUpdate();
|
||||
break;
|
||||
case EndpointTransmitterBase.AudioSourceFeedbackEventId:
|
||||
Debug.Console(2, this, " Audio Source : {0}", Tx.AudioSourceFeedback);
|
||||
AudioSourceNumericFeedback.FireUpdate();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void Tx_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args)
|
||||
{
|
||||
var localVideoInputPort =
|
||||
InputPorts.FirstOrDefault(p => (eVst)p.Selector == Tx.VideoSourceFeedback);
|
||||
var localAudioInputPort =
|
||||
InputPorts.FirstOrDefault(p => (eAst)p.Selector == Tx.AudioSourceFeedback);
|
||||
|
||||
ActiveVideoInputFeedback.FireUpdate();
|
||||
VideoSourceNumericFeedback.FireUpdate();
|
||||
AudioSourceNumericFeedback.FireUpdate();
|
||||
OnSwitchChange(new RoutingNumericEventArgs(1, VideoSourceNumericFeedback.UShortValue, OutputPorts.First(), localVideoInputPort, eRoutingSignalType.Video));
|
||||
OnSwitchChange(new RoutingNumericEventArgs(1, AudioSourceNumericFeedback.UShortValue, OutputPorts.First(), localAudioInputPort, eRoutingSignalType.Audio));
|
||||
}
|
||||
|
||||
void Tx_BaseEvent(GenericBase device, BaseEventArgs args)
|
||||
{
|
||||
var id = args.EventId;
|
||||
Debug.Console(2, this, "EventId {0}", args.EventId);
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case EndpointTransmitterBase.VideoSourceFeedbackEventId:
|
||||
var localVideoInputPort = InputPorts.FirstOrDefault(p => (eVst)p.Selector == Tx.VideoSourceFeedback);
|
||||
Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback);
|
||||
VideoSourceNumericFeedback.FireUpdate();
|
||||
ActiveVideoInputFeedback.FireUpdate();
|
||||
OnSwitchChange(new RoutingNumericEventArgs(1, VideoSourceNumericFeedback.UShortValue, OutputPorts.First(), localVideoInputPort, eRoutingSignalType.Video));
|
||||
break;
|
||||
case EndpointTransmitterBase.AudioSourceFeedbackEventId:
|
||||
var localInputAudioPort = InputPorts.FirstOrDefault(p => (eAst)p.Selector == Tx.AudioSourceFeedback);
|
||||
Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback);
|
||||
AudioSourceNumericFeedback.FireUpdate();
|
||||
OnSwitchChange(new RoutingNumericEventArgs(1, AudioSourceNumericFeedback.UShortValue, OutputPorts.First(), localInputAudioPort, eRoutingSignalType.Audio));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace PepperDash.Essentials.DM
|
||||
using eAst = Crestron.SimplSharpPro.DeviceSupport.eX02AudioSourceType;
|
||||
|
||||
[Description("Wrapper class for DM-TX-4K-302-C")]
|
||||
public class DmTx4k302CController : DmTxControllerBase, ITxRouting, IHasFeedback,
|
||||
public class DmTx4k302CController : DmTxControllerBase, ITxRoutingWithFeedback, IHasFeedback,
|
||||
IIROutputPorts, IComPorts, IHasFreeRun, IVgaBrightnessContrastControls
|
||||
{
|
||||
public DmTx4k302C Tx { get; private set; }
|
||||
@@ -44,7 +44,21 @@ namespace PepperDash.Essentials.DM
|
||||
public BoolFeedback FreeRunEnabledFeedback { get; protected set; }
|
||||
|
||||
public IntFeedback VgaBrightnessFeedback { get; protected set; }
|
||||
public IntFeedback VgaContrastFeedback { get; protected set; }
|
||||
public IntFeedback VgaContrastFeedback { get; protected set; }
|
||||
|
||||
//IroutingNumericEvent
|
||||
public event EventHandler<RoutingNumericEventArgs> NumericSwitchChange;
|
||||
|
||||
/// <summary>
|
||||
/// Raise an event when the status of a switch object changes.
|
||||
/// </summary>
|
||||
/// <param name="e">Arguments defined as IKeyName sender, output, input, and eRoutingSignalType</param>
|
||||
private void OnSwitchChange(RoutingNumericEventArgs e)
|
||||
{
|
||||
var newEvent = NumericSwitchChange;
|
||||
if (newEvent != null) newEvent(this, e);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Helps get the "real" inputs, including when in Auto
|
||||
@@ -95,13 +109,24 @@ namespace PepperDash.Essentials.DM
|
||||
|
||||
HdmiIn1 = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn1,
|
||||
eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eVst.Hdmi1, this,
|
||||
VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInputs[1]));
|
||||
VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInputs[1]))
|
||||
{
|
||||
FeedbackMatchObject = eVst.Hdmi1
|
||||
};
|
||||
HdmiIn2 = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn2,
|
||||
eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eVst.Hdmi2, this,
|
||||
VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInputs[2]));
|
||||
VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInputs[2]))
|
||||
{
|
||||
FeedbackMatchObject = eVst.Hdmi2
|
||||
};
|
||||
|
||||
VgaIn = new RoutingInputPortWithVideoStatuses(DmPortName.VgaIn,
|
||||
eRoutingSignalType.Video, eRoutingPortConnectionType.Vga, eVst.Vga, this,
|
||||
VideoStatusHelper.GetVgaInputStatusFuncs(tx.VgaInput));
|
||||
VideoStatusHelper.GetVgaInputStatusFuncs(tx.VgaInput))
|
||||
{
|
||||
FeedbackMatchObject = eVst.Vga
|
||||
};
|
||||
|
||||
ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput",
|
||||
() => ActualActiveVideoInput.ToString());
|
||||
|
||||
@@ -110,6 +135,8 @@ namespace PepperDash.Essentials.DM
|
||||
Tx.VgaInput.InputStreamChange += VgaInputOnInputStreamChange;
|
||||
Tx.BaseEvent += Tx_BaseEvent;
|
||||
|
||||
Tx.OnlineStatusChange += Tx_OnlineStatusChange;
|
||||
|
||||
VideoSourceNumericFeedback = new IntFeedback(() => (int)Tx.VideoSourceFeedback);
|
||||
AudioSourceNumericFeedback = new IntFeedback(() => (int)Tx.AudioSourceFeedback);
|
||||
|
||||
@@ -387,23 +414,42 @@ namespace PepperDash.Essentials.DM
|
||||
break;
|
||||
}
|
||||
}
|
||||
void Tx_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args)
|
||||
{
|
||||
var localVideoInputPort =
|
||||
InputPorts.FirstOrDefault(p => (eVst)p.Selector == Tx.VideoSourceFeedback);
|
||||
var localAudioInputPort =
|
||||
InputPorts.FirstOrDefault(p => (eAst)p.Selector == Tx.AudioSourceFeedback);
|
||||
|
||||
ActiveVideoInputFeedback.FireUpdate();
|
||||
VideoSourceNumericFeedback.FireUpdate();
|
||||
AudioSourceNumericFeedback.FireUpdate();
|
||||
OnSwitchChange(new RoutingNumericEventArgs(1, VideoSourceNumericFeedback.UShortValue, OutputPorts.First(), localVideoInputPort, eRoutingSignalType.Video));
|
||||
OnSwitchChange(new RoutingNumericEventArgs(1, AudioSourceNumericFeedback.UShortValue, OutputPorts.First(), localAudioInputPort, eRoutingSignalType.Audio));
|
||||
}
|
||||
|
||||
void Tx_BaseEvent(GenericBase device, BaseEventArgs args)
|
||||
{
|
||||
var id = args.EventId;
|
||||
Debug.Console(2, this, "EventId {0}", args.EventId);
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case EndpointTransmitterBase.VideoSourceFeedbackEventId:
|
||||
var localVideoInputPort = InputPorts.FirstOrDefault(p => (eVst)p.Selector == Tx.VideoSourceFeedback);
|
||||
Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback);
|
||||
VideoSourceNumericFeedback.FireUpdate();
|
||||
ActiveVideoInputFeedback.FireUpdate();
|
||||
OnSwitchChange(new RoutingNumericEventArgs(1, VideoSourceNumericFeedback.UShortValue, OutputPorts.First(), localVideoInputPort, eRoutingSignalType.Video));
|
||||
break;
|
||||
case EndpointTransmitterBase.AudioSourceFeedbackEventId:
|
||||
var localInputAudioPort = InputPorts.FirstOrDefault(p => (eAst)p.Selector == Tx.AudioSourceFeedback);
|
||||
Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback);
|
||||
AudioSourceNumericFeedback.FireUpdate();
|
||||
OnSwitchChange(new RoutingNumericEventArgs(1, AudioSourceNumericFeedback.UShortValue, OutputPorts.First(), localInputAudioPort, eRoutingSignalType.Audio));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Relays the input stream change to the appropriate RoutingInputPort.
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user