Compare commits

..

138 Commits

Author SHA1 Message Date
Andrew Welker
22453d4786 Merge pull request #319 from PepperDash/release/1.5.7
Release 1.5.7
2020-07-10 08:25:29 -07:00
Andrew Welker
8341631618 Merge branch 'main' into release/1.5.7 2020-07-09 15:04:07 -07:00
Andrew Welker
6a4c7bb65e Merge pull request #317 from PepperDash/hotfix/refactor-dm-bridging
Refactor DM Chassis Bridging
2020-07-09 14:56:09 -07:00
Andrew Welker
276c681b66 Merge branch 'main' into hotfix/refactor-dm-bridging 2020-07-09 14:29:36 -06:00
Andrew Welker
414a4a9564 Remove Check for HdcpSupportedLevel 2020-07-09 14:23:13 -06:00
Andrew Welker
25cb4e8727 change to HdcpSupportedLevelFeedback and...
...added debug statement
2020-07-09 11:24:36 -06:00
Andrew Welker
aff2371a4b Merge pull request #315 from PepperDash/hotfix/dmtx4kz100c-fix
Change base class for DM-TX-4KZ-100-C-1G
2020-07-08 16:28:00 -07:00
Andrew Welker
7a93223678 Change base class for DM-TX-4KZ-100-C-1G 2020-07-08 14:24:45 -06:00
Andrew Welker
5590925774 fix HDCP state feedback to link to endpoint 2020-07-08 13:43:06 -06:00
Andrew Welker
3b73a7d73c Update DM Transmitters to expose...
HDCP State feedback on the base class
2020-07-08 13:42:35 -06:00
Andrew Welker
2f7e6bf778 Merge pull request #307 from PepperDash/hotfix/bridge-registration
Update EISC Registration to happen AFTER devices are linked
2020-07-08 11:32:15 -07:00
Andrew Welker
98d3d8182e Update LinkToApi to correctly link HDCP settings 2020-07-08 12:15:50 -06:00
Andrew Welker
0da38f5fd2 figuring it out... 2020-07-08 12:15:50 -06:00
Andrew Welker
bd4ae16ab7 add some error handling for missing config values 2020-07-08 12:15:50 -06:00
Andrew Welker
1d2722d409 closes #285 refactor LinkToApi method 2020-07-08 12:15:50 -06:00
Andrew Welker
38d6200409 Log error and notices when necessary 2020-07-08 12:06:40 -06:00
Andrew Welker
e8d42b701e Updated logging to write to ErrorLog as well 2020-07-08 12:00:18 -06:00
Andrew Welker
0686e9d054 Merge branch 'main' into hotfix/bridge-registration 2020-07-08 11:59:21 -06:00
Andrew Welker
b917cb552e Merge pull request #310 from PepperDash/hotfix/program-initialization
Update ControlSystem to control program startup for subsequent programs better
2020-07-08 10:54:51 -07:00
Andrew Welker
a1ee157ab8 add debug statement for catching EISC registration result. 2020-07-08 11:47:36 -06:00
Andrew Welker
b1befeb32d Add program init complete logic 2020-07-08 11:38:09 -06:00
Andrew Welker
615c0d1545 move EISC registration 2020-07-07 13:25:26 -06:00
Neil Dorin
a2e041652d Merge pull request #304 from PepperDash/feature/minor-updates
Add bulk device add method and update Eisc
2020-07-06 15:50:30 -06:00
Andrew Welker
76033f53fc Changes Debug statement level 2020-07-06 13:48:52 -06:00
Andrew Welker
fa4d4bbd0f add AddDevice method for bulk adding devices 2020-07-06 13:38:36 -06:00
Andrew Welker
08a0cdfddd update debug statements to be level 2 2020-07-06 13:38:36 -06:00
Andrew Welker
56e4488087 Merge pull request #284 from PepperDash/hotfix/GenericRelay-ctor-issues
Fix GenericRelayDevice Constructor
2020-07-06 13:36:43 -06:00
Neil Dorin
62b57e453d Merge branch 'development' into hotfix/GenericRelay-ctor-issues 2020-07-06 12:07:00 -06:00
Neil Dorin
2a1ff2e32b Merge pull request #283 from PepperDash/hotfix/GenericRelay-ctor-issues
Fix GenericRelayDevice Constructor
2020-07-06 12:06:40 -06:00
Andrew Welker
8ede3a49ae Merge pull request #303 from PepperDash/feature/Add-DinCenCn2
Add support for the DIN-CEN-CN
2020-07-06 09:55:33 -06:00
Trevor Payne
ca75b751a7 Update GlsOccupancyController to use IHasCresnetBranches Interface
Resolves #297
2020-07-02 15:42:14 -05:00
Trevor Payne
7ed4f479a9 Update GlsOccupancyBaseController to use IHasCresnetBranches Interface
InProgress #297
2020-07-02 15:40:11 -05:00
Trevor Payne
3eeca2fbed Update GlsPartitionSensorController to use IHasCresnetBranches Interface
InProgress #297
2020-07-02 15:38:56 -05:00
Trevor Payne
82fb724bdd Update StatusSignController to use IHasCresnetBranches Interface
InProgress #297
2020-07-02 15:37:56 -05:00
Trevor Payne
4360dcdca9 Update C2nRthsController to use IHasCresnetBranches Interface
Inprogress #297
2020-07-02 15:36:59 -05:00
Trevor Payne
bfe87ae090 Added new interface IHasCresnetBranches
Added new CinCenCn2Controller

InProgress #297
2020-07-02 15:35:09 -05:00
Trevor Payne
8497924c85 Merge pull request #299 from PepperDash/feature/Move-OccupancySensors
Move Occupancy Sensors into PepperDash.Essentials.Core
2020-07-02 14:57:40 -05:00
Trevor Payne
52bfbb6dcf Fixed all Merging Conflicts 2020-07-02 13:41:51 -05:00
Trevor Payne
715a8af0a3 Merge Conficts 2020-07-02 13:37:05 -05:00
Andrew Welker
86acda9935 Merge pull request #302 from PepperDash/bugfix/Fix-HdMd4x1-controller
Bugfix/fix hd md4x1 controller
2020-07-02 11:42:49 -06:00
Trevor Payne
12a9146d79 Merge branch 'development' into bugfix/Fix-HdMd4x1-controller 2020-07-02 12:21:45 -05:00
Trevor Payne
4ee9e2aa26 Merge branch 'bugfix/Fix-HdMd4x1-controller' of https://github.com/PepperDash/Essentials into bugfix/Fix-HdMd4x1-controller 2020-07-02 12:10:07 -05:00
Trevor Payne
b65ecddb39 Change base class on HdMdNxM4kEController to be CrestronGenericBaseDevice
Add required Factory class to HdMdNxM4kEController

Fixes #280
2020-07-02 12:08:54 -05:00
Andrew Welker
1c8b44e3d7 Merge pull request #291 from PepperDash/feature/CloudConnected-CiscoSpark
Added a null check to determining SIP information
2020-07-02 10:56:38 -06:00
Andrew Welker
bc94560536 Merge branch 'development' into feature/CloudConnected-CiscoSpark 2020-07-02 10:39:20 -06:00
Andrew Welker
ae424a2a10 Merge pull request #296 from PepperDash/feature/Cresnet-Enhancements
Update Cresnet device classes
2020-07-02 10:38:01 -06:00
Andrew Welker
5b679c1f35 Merge branch 'development' into feature/Cresnet-Enhancements 2020-07-01 19:05:09 -06:00
Andrew Welker
88c4c4ae77 Merge pull request #295 from PepperDash/feature/Add-Dmc4kzHdo
Adds Dmc4kzHdo
2020-07-01 19:03:01 -06:00
Trevor Payne
e705d2191a Moved Occupancy Sensors into PepperDash.Essentials.Core
Resolves #298
2020-07-01 19:30:45 -05:00
Trevor Payne
6a3d11dee1 Added missing RegisterCrestronGenericBase() call into GlsPartitionSensorController
resolves #292
2020-07-01 17:10:47 -05:00
Trevor Payne
0d802bdeed Fixed issues with Debug calls in PreActivation Actions for Cresnet Devices
Fixed issues related to subscribing to GlsOccupancySensorBase Events

Resolves #292
2020-07-01 16:57:42 -05:00
Trevor Payne
00958164ff Move GlsPartitionSensorController into PepperDash.Essentials.Core
Add GlsPartitionSensorControllerFactory to GlsPartitionSensorController

Updates GlsPartitionSensorController to register device in PreActivate

Resolves #292
2020-07-01 16:16:41 -05:00
Trevor Payne
2fea151089 Changes to CrestronGenericBase
Refactor RfGatewayController

new IHasReady interface

Updates to Hrxx0WirelessRemoteController

merge in development

Addresses #292
2020-07-01 16:03:32 -05:00
Trevor Payne
bfa49b4772 Merge branch 'development' into feature/Cresnet-Enhancements 2020-07-01 15:53:26 -05:00
Trevor Payne
9596d0f3c3 Adds Dmc4kzHdo
Resolves #294
2020-07-01 10:44:28 -05:00
Trevor Payne
0a3f2bb524 WIP Cresnet Gateway SUpport 2020-07-01 10:35:57 -05:00
Andrew Welker
38ae5dcd2f Merge pull request #289 from PepperDash/feature/glspartcn-partition-sensor
Add support for GLS-PART-CN Partition Sensor
2020-06-30 17:20:36 -06:00
Jason DeVito
ea86c8b639 Removed funcs and updated feedbacks in constructor 2020-06-30 17:32:50 -05:00
Trevor Payne
ac379763ce Updates to Cresnet OccSensor Classes
Addresses #292
2020-06-30 15:25:20 -05:00
Trevor Payne
b694f7640a Minor Fixes to CrestronGenericBaseDevice
Update StatusSignController constructor and factory to build device in PreActivation phase

Addresses #292
2020-06-30 15:05:42 -05:00
Trevor Payne
f954043981 Updated C2NRthsController Class to build new devices in PreActivate Method
Addresses #292
2020-06-30 14:48:31 -05:00
Trevor Payne
495bf70d3a Changes to CrestronGenericBridgeableBaseDevice and CrestronGenericBaseDevice to allow it to take a func<DeviceConfig, GenericBase> in an overloaded constructor
Addresses #292
2020-06-30 14:46:46 -05:00
Jason DeVito
e1c93cc13a Updates to correct 'hardware' references accidentally changed to 'sensor'. Updated SIMPLBridge example config to include GLS-PART-CN configuration
Resolves #270
2020-06-30 12:03:48 -05:00
Trevor Payne
ce9c8042e4 Merge branch 'development' into feature/CloudConnected-CiscoSpark 2020-06-30 11:07:18 -05:00
Trevor Payne
5d1aa3b024 Added a null check to determining SIP information
Resolves #290
2020-06-30 11:01:46 -05:00
Andrew Welker
f6286cb5c1 Merge pull request #286 from jonavila/bugfix/fix-remote-registration
Resolves #262
2020-06-29 15:27:22 -06:00
Andrew Welker
2d7b2c05c5 Merge branch 'development' into bugfix/fix-remote-registration 2020-06-29 15:05:19 -06:00
Andrew Welker
9f8542049c Merge pull request #288 from PepperDash/feature/action-updates
Update Actions to add a PR-triggered action for Dev only
2020-06-29 15:04:53 -06:00
Andrew Welker
a26c951dba add logic to add pr postfix for pr triggered builds 2020-06-29 14:47:54 -06:00
Andrew Welker
83ca3ee350 printing things in powershell 2020-06-29 14:34:23 -06:00
Andrew Welker
acdff4ad67 add string IsNullOrEmpty check 2020-06-29 14:31:05 -06:00
Andrew Welker
708d4c266e adding some print info back 2020-06-29 14:28:02 -06:00
Andrew Welker
6160580f08 removed submodule checkout and moved it to checkout action 2020-06-29 14:26:43 -06:00
Andrew Welker
c7363c6434 removed print step 2020-06-29 14:20:36 -06:00
Andrew Welker
5f04190e6a removed info print name 2020-06-29 14:19:28 -06:00
Andrew Welker
6b908e18de updating script for forked builds 2020-06-29 14:18:14 -06:00
Andrew Welker
4d4230d9f4 getting all env variables 2020-06-29 14:13:43 -06:00
Andrew Welker
2e788d1917 figuring out what ref to use 2020-06-29 14:05:44 -06:00
Andrew Welker
1f21b573e2 print GITHUB_REF 2020-06-29 13:57:00 -06:00
Andrew Welker
a03e6824c5 trying to get environment variables 2020-06-29 13:55:05 -06:00
Andrew Welker
67cdd8bfa6 add print env step 2020-06-29 13:52:44 -06:00
Andrew Welker
44f6b465d4 really fix expression syntax 2020-06-29 13:49:39 -06:00
Andrew Welker
48220b8fe9 fix expression syntax 2020-06-29 13:47:57 -06:00
Andrew Welker
51f5d7e07b added print info step 2020-06-29 13:46:26 -06:00
Andrew Welker
ea3cb6eb80 added check for GITHUB_REF 2020-06-29 13:42:13 -06:00
Andrew Welker
91464d8ec1 remove new workflow and add pull-request trigger to existing workflow 2020-06-29 13:35:24 -06:00
Andrew Welker
80c98c60ca changed master -> main and added pull-request workflow 2020-06-29 13:22:09 -06:00
Jonathan Avila
8d8899f9ac Resolves #262
Register device when using internal RF gateway
2020-06-27 15:44:51 -04:00
Trevor Payne
001933bac3 Change base class on HdMdNxM4kEController to be CrestronGenericBaseDevice
Add required Factory class to HdMdNxM4kEController

Fixes #280
2020-06-25 10:12:30 -05:00
Andrew Welker
8445656289 fix constructor to initialize feedback 2020-06-25 08:19:08 -06:00
Andrew Welker
e8a8d481aa Merge pull request #278 from PepperDash/feature/Update-CiscoSpark-ce9.13
Update CiscoSpark to work with ce9.13
2020-06-24 10:03:05 -06:00
Trevor Payne
fd1de75a1d Updated CiscoSpark to work with ce9.13
Resolves #277
2020-06-24 10:44:57 -05:00
Andrew Welker
7f08bfc913 Merge pull request #275 from PepperDash/release/1.5.6
Release/1.5.6
2020-06-23 15:14:21 -06:00
Neil Dorin
377cf23bca Merge pull request #274 from PepperDash/release/1.5.6
Release V1.5.6
2020-06-23 14:14:35 -06:00
Andrew Welker
6f16bc3427 Merge branch 'main' into release/1.5.6 2020-06-23 13:56:34 -06:00
Andrew Welker
35ec5e903e Merge pull request #271 from PepperDash/bugfix/eisc-ibridge-fixes
Update bridging to eliminate null references & allow backwards compatibility
2020-06-19 16:25:11 -06:00
Andrew Welker
f98292a4aa add null check to all internal device LinkToApi methods
This allows for backwards compatability with EiscApi bridges.
2020-06-19 15:48:34 -06:00
Andrew Welker
6b6604b7a9 update bridges and interfaces 2020-06-19 15:48:33 -06:00
Andrew Welker
55eb110373 Merge branch 'release/1.5.6' of https://github.com/PepperDash/Essentials into release/1.5.6 2020-06-19 15:48:08 -06:00
Andrew Welker
42418fedb8 Merge pull request #266 from PepperDash/feature/PRO3-card-support
Add 3-series Card Support
2020-06-19 15:31:56 -06:00
Andrew Welker
407fc2e948 Merge pull request #263 from PepperDash/feature/update-PdCore
Update PepperDash Core submodule after branch rename
2020-06-18 18:58:55 -06:00
Andrew Welker
49177da820 add config snippets for external card cages 2020-06-18 18:53:30 -06:00
Andrew Welker
a1809dccb4 add internal card cage support 2020-06-18 18:53:30 -06:00
Andrew Welker
7d97bc118e fix debug message 2020-06-18 18:53:30 -06:00
Andrew Welker
48bc41a69e update key and name for cards 2020-06-18 18:53:30 -06:00
Andrew Welker
e4a8e89135 add Cenci33 controller 2020-06-18 18:53:30 -06:00
Andrew Welker
1bd6825258 create classes for all supported cards 2020-06-18 18:53:30 -06:00
Andrew Welker
e5099e9a2a started support for 3-Series cards 2020-06-18 18:53:30 -06:00
Neil Dorin
ccdaa12f20 Merge pull request #268 from PepperDash/feature/update-dm-join-map
Add in/out AV names to join map
2020-06-18 18:01:23 -06:00
Andrew Welker
60d387c792 add in/out AV names to join map 2020-06-18 16:16:24 -06:00
Andrew Welker
d9b4ca815e Merge pull request #265 from PepperDash/hotfix/add-latest-release-link
Adds latest release link
2020-06-17 22:54:44 -06:00
Neil Dorin
37686044d4 Adds latest release link 2020-06-17 22:15:01 -06:00
Andrew Welker
ef50098460 update PD Core submodule commit 2020-06-17 19:35:35 -06:00
Andrew Welker
f2eff3fdb4 Merge pull request #260 from PepperDash/feature/update-workflows-for-name-change
Update workflows for name change
2020-06-17 12:34:31 -06:00
Andrew Welker
2749fdc2e9 update workflows for name change 2020-06-17 12:10:12 -06:00
Andrew Welker
514fe466fd Merge pull request #254 from PepperDash/hotfix/eiscApiAdvanced-backwards-compatibility
Add backwards compatability with `IBridge` to `EiscApiAdvanced`
2020-06-12 14:00:30 -06:00
Andrew Welker
c77d394e08 Merge branch 'development' into hotfix/eiscApiAdvanced-backwards-compatibility 2020-06-12 13:43:22 -06:00
Andrew Welker
b689a54936 Merge pull request #253 from PepperDash/hotfix/eiscApiAdvanced-backwards-compatibility
Add backwards compatability with `IBridge` to `EiscApiAdvanced`
2020-06-12 13:43:05 -06:00
Andrew Welker
1046672386 Merge branch 'master' into hotfix/eiscApiAdvanced-backwards-compatibility 2020-06-12 13:16:20 -06:00
Andrew Welker
0cfcf4f266 Merge pull request #252 from PepperDash/feature/implement-IStreamDebugging-on-ComPortController
Fix issue with `setdevicestreamdebug` console command and optional parameters
2020-06-12 13:16:04 -06:00
Andrew Welker
d86cc44c3b Merge branch 'development' into feature/implement-IStreamDebugging-on-ComPortController 2020-06-12 08:23:49 -06:00
Andrew Welker
26bd0d624e fixes issue with optional timeout parameter 2020-06-12 08:18:56 -06:00
Andrew Welker
841cb2a83b Merge pull request #250 from PepperDash/hotfix/prevent-dmtx4k100c1g-registration-attempt
Prevent DM-TX-4K-100-C registration
2020-06-12 08:12:18 -06:00
Alex Johnson
b89112bec1 Sets preventRegistration to true for dmTx4k100c1g transmitter type. Otherwise device fails and returns without linking up com port. 2020-06-11 21:29:59 -04:00
Andrew Welker
5920c7c0f0 Merge pull request #242 from PepperDash/hotfix/dm-tx-chassis-bridge-fix
Add BasicDmTxControllerBase back
2020-06-11 09:49:19 -06:00
Andrew Welker
d23ef01281 Merge branch 'development' into hotfix/dm-tx-chassis-bridge-fix 2020-06-11 09:20:58 -06:00
Andrew Welker
c78b305faa Merge branch 'development' into hotfix/dm-tx-chassis-bridge-fix 2020-06-10 16:15:51 -06:00
Andrew Welker
5853dd6617 Merge pull request #241 from PepperDash/hotfix/dm-tx-chassis-bridge-fix
Add BasicDmTxControllerBase back
2020-06-10 16:11:58 -06:00
Andrew Welker
a0ef356bac Fix casts in DmBladeChassisController 2020-06-09 14:40:11 -06:00
Andrew Welker
486d6db7d8 fixes casting issues 2020-06-09 13:06:40 -06:00
Andrew Welker
81d9261a73 Changes base class to BasicDmTxControllerBase 2020-06-09 13:06:25 -06:00
Andrew Welker
2ace6ef6bc adds BasicDmTxControllerBase back in 2020-06-09 13:05:56 -06:00
Andrew Welker
cc6d94b188 Updates EiscApiAdvanced for backwards compatibility 2020-06-09 10:57:42 -06:00
Andrew Welker
0525f76b6b Added IBridge to Core
made existing IBridge inherit from it for backwards compatabilty
2020-06-09 10:57:17 -06:00
Neil Dorin
345442e195 Merge pull request #235 from PepperDash/hotfix/update-readme-to-include-4-series
Hotfix/update readme to include 4 series
2020-06-07 16:53:45 -06:00
Neil Dorin
e94e8b60a6 Bolds 4-series 2020-06-07 16:36:00 -06:00
Neil Dorin
4f4c8cba04 Update README.md 2020-06-07 16:11:17 -06:00
Andrew Welker
0a38442ac5 Merge pull request #224 from PepperDash/hotfix/dm-rmc4kz100-build
Fix issue building DM-RMC-4KZ-100-C & DM-TX-4KZ-202-C
2020-06-01 16:59:04 -06:00
73 changed files with 4677 additions and 2991 deletions

View File

@@ -1,5 +1,8 @@
$latestVersions = $(git tag --merged origin/master)
$latestVersions = $(git tag --merged origin/main)
$latestVersion = [version]"0.0.0"
Write-Host "GITHUB_REF: $($Env:GITHUB_REF)"
Write-Host "GITHUB_HEAD_REF: $($Env:GITHUB_HEAD_REF)"
Write-Host "GITHUB_BASE_REF: $($Env:GITHUB_BASE_REF)"
Foreach ($version in $latestVersions) {
Write-Host $version
try {
@@ -17,8 +20,14 @@ Foreach ($version in $latestVersions) {
$newVersion = [version]$latestVersion
$phase = ""
$newVersionString = ""
switch -regex ($Env:GITHUB_REF) {
'^refs\/heads\/master*.' {
'^refs\/pull\/*.' {
$splitRef = $Env:GITHUB_REF -split "/"
$phase = "pr$($splitRef[2])"
$newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $newVersion.Major, $newVersion.Minor, ($newVersion.Build + 1), $phase, $Env:GITHUB_RUN_NUMBER
}
'^refs\/heads\/main*.' {
$newVersionString = "{0}.{1}.{2}" -f $newVersion.Major, $newVersion.Minor, $newVersion.Build
}
'^refs\/heads\/feature\/*.' {
@@ -43,6 +52,7 @@ switch -regex ($Env:GITHUB_REF) {
$phase = 'hotfix'
$newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $newVersion.Major, $newVersion.Minor, ($newVersion.Build + 1), $phase, $Env:GITHUB_RUN_NUMBER
}
}

View File

@@ -8,6 +8,9 @@ on:
- bugfix/*
- release/*
- development
pull_request:
branches:
- development
env:
# solution path doesn't need slashes unless there it is multiple folders deep
@@ -18,8 +21,8 @@ env:
VERSION: 0.0.0-buildtype-buildnumber
# Defaults to debug for build type
BUILD_TYPE: Debug
# Defaults to master as the release branch. Change as necessary
RELEASE_BRANCH: master
# Defaults to main as the release branch. Change as necessary
RELEASE_BRANCH: main
jobs:
Build_Project:
runs-on: windows-latest
@@ -29,14 +32,7 @@ jobs:
uses: actions/checkout@v2
with:
fetch-depth: 0
# 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
submodules: true
# Fetch all tags
- name: Fetch tags
run: git fetch --tags
@@ -189,11 +185,11 @@ jobs:
run: git push --tags origin
- name: Check Directory
run: Get-ChildItem ./
# This step only runs if the branch is master or release/ runs and pushes the build to the public build repo
# This step only runs if the branch is main or release/ runs and pushes the build to the public build repo
Public_Push_Output:
needs: Build_Project
runs-on: windows-latest
if: contains(github.ref, 'master') || contains(github.ref, '/release/')
if: contains(github.ref, 'main') || contains(github.ref, '/release/')
steps:
# Checkout the repo
- name: check Github ref

View File

@@ -1,11 +1,11 @@
name: Master Build using Docker
name: main Build using Docker
on:
release:
types:
- created
branches:
- master
- main
env:
# solution path doesn't need slashes unless there it is multiple folders deep
# solution name does not include extension. .sln is assumed
@@ -15,8 +15,8 @@ env:
VERSION: 0.0.0-buildtype-buildnumber
# Defaults to debug for build type
BUILD_TYPE: Release
# Defaults to master as the release branch. Change as necessary
RELEASE_BRANCH: master
# Defaults to main as the release branch. Change as necessary
RELEASE_BRANCH: main
jobs:
Build_Project:
runs-on: windows-latest
@@ -114,8 +114,8 @@ jobs:
Remove-Item -Path ./Version/version.txt
Remove-Item -Path ./Version
# Checkout/Create the branch
- name: Checkout Master branch
run: git checkout master
- name: Checkout main branch
run: git checkout main
# Download the build output into the repo
- name: Download Build output
uses: actions/download-artifact@v1
@@ -151,13 +151,13 @@ jobs:
# Push the commit
- name: Push to Builds Repo
shell: powershell
run: git push -u origin master --force
run: git push -u origin main --force
# Push the tags
- name: Push tags
run: git push --tags origin
- name: Check Directory
run: Get-ChildItem ./
# This step only runs if the branch is master or release/ runs and pushes the build to the public build repo
# This step only runs if the branch is main or release/ runs and pushes the build to the public build repo
Public_Push_Output:
needs: Build_Project
runs-on: windows-latest
@@ -186,9 +186,9 @@ jobs:
Write-Output "::set-env name=VERSION::$version"
Remove-Item -Path ./Version/version.txt
Remove-Item -Path ./Version
# Checkout master branch
# Checkout main branch
- name: Create new branch
run: git checkout master
run: git checkout main
# Download the build output into the repo
- name: Download Build output
uses: actions/download-artifact@v1
@@ -224,7 +224,7 @@ jobs:
# Push the commit
- name: Push to Builds Repo
shell: powershell
run: git push -u origin master --force
run: git push -u origin main --force
# Push the tags
- name: Push tags
run: git push --tags origin

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using Crestron.SimplSharp.Reflection;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.EthernetCommunication;
using PepperDash.Core;
@@ -26,8 +27,6 @@ namespace PepperDash.Essentials.Bridges
Eisc.SigChange += Eisc_SigChange;
Eisc.Register();
AddPostActivationAction(() =>
{
Debug.Console(1, this, "Linking Devices...");
@@ -39,19 +38,31 @@ namespace PepperDash.Essentials.Bridges
if (device == null) continue;
Debug.Console(1, this, "Linking Device: '{0}'", device.Key);
if (device is IBridge) // Check for this first to allow bridges in plugins to override existing bridges that apply to the same type.
if (typeof(IBridge).IsAssignableFrom(device.GetType().GetCType())) // Check for this first to allow bridges in plugins to override existing bridges that apply to the same type.
{
Debug.Console(2, this, "'{0}' is IBridge", device.Key);
var dev = device as IBridge;
if (dev == null)
{
Debug.Console(0, this, Debug.ErrorLogLevel.Error, "Cast to IBridge failed for {0}");
continue;
}
dev.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
}
if (!(device is IBridgeAdvanced)) continue;
if (!typeof(IBridgeAdvanced).IsAssignableFrom(device.GetType().GetCType())) continue;
Debug.Console(2, this, "'{0}' is IBridgeAdvanced", device.Key);
var advDev = device as IBridgeAdvanced;
if (advDev == null)
{
Debug.Console(0, this, Debug.ErrorLogLevel.Error, "Cast to IBridgeAdvanced failed for {0}");
continue;
}
try
{
advDev.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey, null);
@@ -61,10 +72,18 @@ namespace PepperDash.Essentials.Bridges
Debug.ConsoleWithLog(0, this,
"Please update the bridge config to use EiscBridgeAdvanced with this device: {0}", device.Key);
}
}
Debug.Console(1, this, "Devices Linked.");
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");
});
}
@@ -139,12 +158,12 @@ namespace PepperDash.Essentials.Bridges
try
{
if (Debug.Level >= 1)
Debug.Console(1, this, "EiscApi change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
Debug.Console(2, this, "EiscApi change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
var uo = args.Sig.UserObject;
if (uo == null) return;
Debug.Console(1, this, "Executing Action: {0}", uo.ToString());
Debug.Console(2, this, "Executing Action: {0}", uo.ToString());
if (uo is Action<bool>)
(uo as Action<bool>)(args.Sig.BoolValue);
else if (uo is Action<ushort>)

View File

@@ -35,6 +35,7 @@ namespace PepperDash.Essentials
Thread.MaxNumberOfUserThreads = 400;
Global.ControlSystem = this;
DeviceManager.Initialize(this);
SystemMonitor.ProgramInitialization.ProgramInitializationUnderUserControl = true;
}
/// <summary>
@@ -90,7 +91,12 @@ namespace PepperDash.Essentials
if (!Debug.DoNotLoadOnNextBoot)
{
GoWithLoad();
return;
}
SystemMonitor.ProgramInitialization.ProgramInitializationComplete = true;
}
/// <summary>
@@ -168,7 +174,7 @@ namespace PepperDash.Essentials
public void GoWithLoad()
{
try
{
{
Debug.SetDoNotLoadOnNextBoot(false);
PluginLoader.AddProgramAssemblies();
@@ -188,11 +194,14 @@ namespace PepperDash.Essentials
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Folder structure verified. Loading config...");
if (!ConfigReader.LoadConfig2())
{
Debug.Console(0, Debug.ErrorLogLevel.Error, "Essentials Load complete with errors");
return;
}
Load();
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Essentials load complete\r" +
"-------------------------------------------------------------");
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Essentials load complete\r\n" +
"-------------------------------------------------------------");
}
else
{
@@ -211,11 +220,13 @@ namespace PepperDash.Essentials
}
catch (Exception e)
{
Debug.Console(0, "FATAL INITIALIZE ERROR. System is in an inconsistent state:\r{0}", e);
Debug.Console(0, "FATAL INITIALIZE ERROR. System is in an inconsistent state:\r\n{0}", e);
}
finally
{
// Notify the OS that the program intitialization has completed
SystemMonitor.ProgramInitialization.ProgramInitializationComplete = true;
}
// Notify the OS that the program intitialization has completed
SystemMonitor.ProgramInitialization.ProgramInitializationComplete = true;
}

View File

@@ -175,6 +175,10 @@
{
"deviceKey": "gls-odt-1",
"joinStart": 2751
},
{
"deviceKey": "gls-part-1",
"joinStart": 2781
}
]
}
@@ -427,6 +431,19 @@
"method": "cresnet"
}
}
},
{
"key": "gls-part-1",
"uid": 19,
"name": "GLS-PART-CN 1",
"type": "glspartcn",
"group": "partition",
"properties": {
"control": {
"cresnetId": "90",
"method": "cresnet"
}
}
}
],
"rooms": [],

View File

@@ -1,23 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using System;
using System.Linq;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.Fusion;
using PepperDash.Core;
using PepperDash.Essentials;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.Fusion;
using PepperDash.Essentials.Devices.Common;
using PepperDash.Essentials.Devices.Common.Occupancy;
using PepperDash.Essentials.Core.Fusion;
namespace PepperDash.Essentials.Fusion
{
public class EssentialsHuddleVtc1FusionController : EssentialsHuddleSpaceFusionSystemControllerBase

View File

@@ -1,6 +1,8 @@
# PepperDash Essentials Framework (c) 2020
## [Latest Release](https://github.com/PepperDash/Essentials/releases/latest)
## License
Provided under MIT license
@@ -10,7 +12,7 @@ PepperDash Essentials is an open source Crestron framework that can be configure
Essentials Framework is a collection of C# / Simpl# Pro libraries that can be utilized in several different manners. It is currently operating as a 100% configuration-driven system, and can be extended to add different workflows and behaviors, either through the addition of further device "types" or via the plug-in mechanism. The framework is a collection of "things" that are all related and interconnected, but in general do not have dependencies on each other.
## Minimum Requirements
- Essentials Framework runs on any Crestron 3-series processor or Crestron's VC-4 platform.
- Essentials Framework runs on any Crestron 3-series processor, **4-series** processor or Crestron's VC-4 platform.
- To edit and compile the source, Microsoft Visual Studio 2008 Professional with SP1 is required.
- Crestron's Simpl# Plugin is also required (must be obtained from Crestron).

View File

@@ -7,7 +7,6 @@ using Crestron.SimplSharpPro.EthernetCommunication;
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
//using PepperDash.Essentials.Devices.Common.Cameras;
@@ -97,8 +96,6 @@ namespace PepperDash.Essentials.Core.Bridges
Eisc.SigChange += Eisc_SigChange;
Eisc.Register();
AddPostActivationAction( () =>
{
Debug.Console(1, this, "Linking Devices...");
@@ -110,12 +107,12 @@ namespace PepperDash.Essentials.Core.Bridges
if (device == null) continue;
Debug.Console(1, this, "Linking Device: '{0}'", device.Key);
//if (device is IBridge) // Check for this first to allow bridges in plugins to override existing bridges that apply to the same type.
//{
// Debug.Console(2, this, "'{0}' is IBridge", 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;
}
@@ -123,7 +120,15 @@ namespace PepperDash.Essentials.Core.Bridges
if (bridge != null) bridge.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey, this);
}
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");
});
}
@@ -193,11 +198,11 @@ namespace PepperDash.Essentials.Core.Bridges
var uo = Eisc.BooleanOutput[join].UserObject as Action<bool>;
if (uo != null)
{
Debug.Console(1, this, "Executing Action: {0}", uo.ToString());
Debug.Console(2, this, "Executing Action: {0}", uo.ToString());
uo(Convert.ToBoolean(state));
}
else
Debug.Console(1, this, "User Action is null. Nothing to Execute");
Debug.Console(2, this, "User Action is null. Nothing to Execute");
break;
}
case "analog":
@@ -205,27 +210,27 @@ namespace PepperDash.Essentials.Core.Bridges
var uo = Eisc.BooleanOutput[join].UserObject as Action<ushort>;
if (uo != null)
{
Debug.Console(1, this, "Executing Action: {0}", uo.ToString());
Debug.Console(2, this, "Executing Action: {0}", uo.ToString());
uo(Convert.ToUInt16(state));
}
else
Debug.Console(1, this, "User Action is null. Nothing to Execute"); break;
Debug.Console(2, this, "User Action is null. Nothing to Execute"); break;
}
case "serial":
{
var uo = Eisc.BooleanOutput[join].UserObject as Action<string>;
if (uo != null)
{
Debug.Console(1, this, "Executing Action: {0}", uo.ToString());
Debug.Console(2, this, "Executing Action: {0}", uo.ToString());
uo(Convert.ToString(state));
}
else
Debug.Console(1, this, "User Action is null. Nothing to Execute");
Debug.Console(2, this, "User Action is null. Nothing to Execute");
break;
}
default:
{
Debug.Console(1, "Unknown join type. Use digital/serial/analog");
Debug.Console(2, "Unknown join type. Use digital/serial/analog");
break;
}
}
@@ -294,7 +299,7 @@ namespace PepperDash.Essentials.Core.Bridges
{
public EiscApiAdvancedFactory()
{
TypeNames = new List<string>() { "eiscapiadv", "eiscapiadvanced" };
TypeNames = new List<string> { "eiscapiadv", "eiscapiadvanced" };
}
public override EssentialsDevice BuildDevice(DeviceConfig dc)

View File

@@ -1,5 +1,4 @@
using System;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.DeviceSupport;
namespace PepperDash.Essentials.Core.Bridges
{

View File

@@ -89,6 +89,43 @@ namespace PepperDash.Essentials.Core.Bridges
public JoinDataComplete OutputNames = new JoinDataComplete(new JoinData() { JoinNumber = 301, JoinSpan = 32 },
new JoinMetadata() { Label = "DM Chassis Output Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
[JoinName("InputVideoNames")] public JoinDataComplete InputVideoNames =
new JoinDataComplete(new JoinData {JoinNumber = 501, JoinSpan = 200},
new JoinMetadata
{
Description = "Video Input Name",
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
JoinType = eJoinType.Serial
});
[JoinName("InputAudioNames")]
public JoinDataComplete InputAudioNames =
new JoinDataComplete(new JoinData { JoinNumber = 701, JoinSpan = 200 },
new JoinMetadata
{
Description = "Video Input Name",
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
JoinType = eJoinType.Serial
});
[JoinName("OutputVideoNames")]
public JoinDataComplete OutputVideoNames =
new JoinDataComplete(new JoinData { JoinNumber = 901, JoinSpan = 200 },
new JoinMetadata
{
Description = "Video Input Name",
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
JoinType = eJoinType.Serial
});
[JoinName("OutputAudioNames")]
public JoinDataComplete OutputAudioNames =
new JoinDataComplete(new JoinData { JoinNumber = 1101, JoinSpan = 200 },
new JoinMetadata
{
Description = "Video Input Name",
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
JoinType = eJoinType.Serial
});
[JoinName("OutputCurrentVideoInputNames")]
public JoinDataComplete OutputCurrentVideoInputNames = new JoinDataComplete(new JoinData() { JoinNumber = 2001, JoinSpan = 32 },
new JoinMetadata() { Label = "DM Chassis Video Output Currently Routed Video Input Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });

View File

@@ -0,0 +1,130 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
namespace PepperDash_Essentials_Core.Bridges.JoinMaps
{
public class GlsPartitionSensorJoinMap : JoinMapBaseAdvanced
{
[JoinName("IsOnline")]
public JoinDataComplete IsOnline = new JoinDataComplete(
new JoinData()
{
JoinNumber = 1,
JoinSpan = 1
},
new JoinMetadata()
{
Description = "Sensor Is Online",
JoinCapabilities = eJoinCapabilities.ToSIMPL,
JoinType = eJoinType.Digital
});
[JoinName("Name")]
public JoinDataComplete Name = new JoinDataComplete(
new JoinData()
{
JoinNumber = 1,
JoinSpan = 1
},
new JoinMetadata()
{
Description = "Sensor Name",
JoinCapabilities = eJoinCapabilities.ToSIMPL,
JoinType = eJoinType.Serial
});
[JoinName("Enable")]
public JoinDataComplete Enable = new JoinDataComplete(
new JoinData()
{
JoinNumber = 2,
JoinSpan = 1
},
new JoinMetadata()
{
Description = "Sensor Enable",
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
JoinType = eJoinType.Digital
});
[JoinName("PartitionSensed")]
public JoinDataComplete PartitionSensed = new JoinDataComplete(
new JoinData()
{
JoinNumber = 3,
JoinSpan = 1
},
new JoinMetadata()
{
Description = "Sensor Partition Sensed",
JoinCapabilities = eJoinCapabilities.ToSIMPL,
JoinType = eJoinType.Digital
});
[JoinName("PartitionNotSensed")]
public JoinDataComplete PartitionNotSensed = new JoinDataComplete(
new JoinData()
{
JoinNumber = 4,
JoinSpan = 1
},
new JoinMetadata()
{
Description = "Sensor Partition Not Sensed",
JoinCapabilities = eJoinCapabilities.ToSIMPL,
JoinType = eJoinType.Digital
});
[JoinName("IncreaseSensitivity")]
public JoinDataComplete IncreaseSensitivity = new JoinDataComplete(
new JoinData()
{
JoinNumber = 6,
JoinSpan = 1
},
new JoinMetadata()
{
Description = "Sensor Increase Sensitivity",
JoinCapabilities = eJoinCapabilities.FromSIMPL,
JoinType = eJoinType.Digital
});
[JoinName("DecreaseSensitivity")]
public JoinDataComplete DecreaseSensitivity = new JoinDataComplete(
new JoinData()
{
JoinNumber = 7,
JoinSpan = 1
},
new JoinMetadata()
{
Description = "Sensor Decrease Sensitivity",
JoinCapabilities = eJoinCapabilities.FromSIMPL,
JoinType = eJoinType.Digital
});
[JoinName("Sensitivity")]
public JoinDataComplete Sensitivity = new JoinDataComplete(
new JoinData()
{
JoinNumber = 2,
JoinSpan = 1
},
new JoinMetadata()
{
Description = "Sensor Sensitivity",
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
JoinType = eJoinType.Analog
});
public GlsPartitionSensorJoinMap(uint joinStart)
: base(joinStart, typeof (GlsPartitionSensorJoinMap))
{
}
}
}

View File

@@ -76,7 +76,14 @@ namespace PepperDash.Essentials.Core
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<IBasicCommunicationJoinMap>(joinMapSerialized);
bridge.AddJoinMap(Key, joinMap);
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.");
}
if (CommPort == null)
{

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.GeneralIO;
@@ -13,21 +14,30 @@ namespace PepperDash.Essentials.Core.CrestronIO
[Description("Wrapper class for the C2N-RTHS sensor")]
public class C2nRthsController : CrestronGenericBridgeableBaseDevice
{
private readonly C2nRths _device;
private C2nRths _device;
public IntFeedback TemperatureFeedback { get; private set; }
public IntFeedback HumidityFeedback { get; private set; }
public C2nRthsController(string key, string name, GenericBase hardware) : base(key, name, hardware)
public C2nRthsController(string key, Func<DeviceConfig, C2nRths> preActivationFunc,
DeviceConfig config)
: base(key, config.Name)
{
_device = hardware as C2nRths;
TemperatureFeedback = new IntFeedback(() => _device.TemperatureFeedback.UShortValue);
HumidityFeedback = new IntFeedback(() => _device.HumidityFeedback.UShortValue);
AddPreActivationAction(() =>
{
_device = preActivationFunc(config);
if (_device != null) _device.BaseEvent += DeviceOnBaseEvent;
RegisterCrestronGenericBase(_device);
TemperatureFeedback = new IntFeedback(() => _device.TemperatureFeedback.UShortValue);
HumidityFeedback = new IntFeedback(() => _device.HumidityFeedback.UShortValue);
if (_device != null) _device.BaseEvent += DeviceOnBaseEvent;
});
}
private void DeviceOnBaseEvent(GenericBase device, BaseEventArgs args)
{
switch (args.EventId)
@@ -55,7 +65,14 @@ namespace PepperDash.Essentials.Core.CrestronIO
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<C2nRthsControllerJoinMap>(joinMapSerialized);
bridge.AddJoinMap(Key, joinMap);
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"));
@@ -69,24 +86,63 @@ namespace PepperDash.Essentials.Core.CrestronIO
HumidityFeedback.LinkInputSig(trilist.UShortInput[joinMap.Humidity.JoinNumber]);
trilist.StringInput[joinMap.Name.JoinNumber].StringValue = Name;
}
}
public class C2nRthsControllerFactory : EssentialsDeviceFactory<C2nRthsController>
{
public C2nRthsControllerFactory()
{
TypeNames = new List<string>() { "c2nrths" };
trilist.OnlineStatusChange += (d, args) =>
{
if (!args.DeviceOnLine) return;
UpdateFeedbacksWhenOnline();
trilist.StringInput[joinMap.Name.JoinNumber].StringValue = Name;
};
}
public override EssentialsDevice BuildDevice(DeviceConfig dc)
private void UpdateFeedbacksWhenOnline()
{
Debug.Console(1, "Factory Attempting to create new C2N-RTHS Device");
IsOnline.FireUpdate();
TemperatureFeedback.FireUpdate();
HumidityFeedback.FireUpdate();
}
#region PreActivation
private static C2nRths GetC2nRthsDevice(DeviceConfig dc)
{
var control = CommFactory.GetControlPropertiesConfig(dc);
var cresnetId = control.CresnetIdInt;
var branchId = control.ControlPortNumber;
var parentKey = string.IsNullOrEmpty(control.ControlPortDevKey) ? "processor" : control.ControlPortDevKey;
return new C2nRthsController(dc.Key, dc.Name, new C2nRths(cresnetId, Global.ControlSystem));
if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase))
{
Debug.Console(0, "Device {0} is a valid cresnet master - creating new C2nRths", parentKey);
return new C2nRths(cresnetId, Global.ControlSystem);
}
var cresnetBridge = DeviceManager.GetDeviceForKey(parentKey) as IHasCresnetBranches;
if (cresnetBridge != null)
{
Debug.Console(0, "Device {0} is a valid cresnet master - creating new C2nRths", parentKey);
return new C2nRths(cresnetId, cresnetBridge.CresnetBranches[branchId]);
}
Debug.Console(0, "Device {0} is not a valid cresnet master", parentKey);
return null;
}
#endregion
public class C2nRthsControllerFactory : EssentialsDeviceFactory<C2nRthsController>
{
public C2nRthsControllerFactory()
{
TypeNames = new List<string>() { "c2nrths" };
}
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory Attempting to create new C2N-RTHS Device");
return new C2nRthsController(dc.Key, GetC2nRthsDevice, dc);
}
}
}
}

View File

@@ -0,0 +1,24 @@
using System;
using Crestron.SimplSharpProInternal;
namespace PepperDash.Essentials.Core.CrestronIO.Cards
{
public class C3CardControllerBase:CrestronGenericBaseDevice
{
private readonly C3Card _card;
public C3CardControllerBase(string key, string name, C3Card hardware) : base(key, name, hardware)
{
_card = hardware;
}
#region Overrides of Object
public override string ToString()
{
return String.Format("{0} {1}", Key, _card.ToString());
}
#endregion
}
}

View File

@@ -0,0 +1,29 @@
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.ThreeSeriesCards;
namespace PepperDash.Essentials.Core.CrestronIO.Cards
{
public class C3Com3Controller:C3CardControllerBase, IComPorts
{
private readonly C3com3 _card;
public C3Com3Controller(string key, string name, C3com3 hardware) : base(key, name, hardware)
{
_card = hardware;
}
#region Implementation of IComPorts
public CrestronCollection<ComPort> ComPorts
{
get { return _card.ComPorts; }
}
public int NumberOfComPorts
{
get { return _card.NumberOfComPorts; }
}
#endregion
}
}

View File

@@ -0,0 +1,29 @@
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.ThreeSeriesCards;
namespace PepperDash.Essentials.Core.CrestronIO.Cards
{
public class C3Io16Controller:C3CardControllerBase,IIOPorts
{
private readonly C3io16 _card;
public C3Io16Controller(string key, string name, C3io16 hardware) : base(key, name, hardware)
{
_card = hardware;
}
#region Implementation of IIOPorts
public CrestronCollection<Versiport> VersiPorts
{
get { return _card.VersiPorts; }
}
public int NumberOfVersiPorts
{
get { return _card.NumberOfVersiPorts; }
}
#endregion
}
}

View File

@@ -0,0 +1,29 @@
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.ThreeSeriesCards;
namespace PepperDash.Essentials.Core.CrestronIO.Cards
{
public class C3Ir8Controller:C3CardControllerBase, IIROutputPorts
{
private readonly C3ir8 _card;
public C3Ir8Controller(string key, string name, C3ir8 hardware) : base(key, name, hardware)
{
_card = hardware;
}
#region Implementation of IIROutputPorts
public CrestronCollection<IROutputPort> IROutputPorts
{
get { return _card.IROutputPorts; }
}
public int NumberOfIROutputPorts
{
get { return _card.NumberOfIROutputPorts; }
}
#endregion
}
}

View File

@@ -0,0 +1,29 @@
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.ThreeSeriesCards;
namespace PepperDash.Essentials.Core.CrestronIO.Cards
{
public class C3Ry16Controller:C3CardControllerBase, IRelayPorts
{
private readonly C3ry16 _card;
public C3Ry16Controller(string key, string name, C3ry16 hardware) : base(key, name, hardware)
{
_card = hardware;
}
#region Implementation of IRelayPorts
public CrestronCollection<Relay> RelayPorts
{
get { return _card.RelayPorts; }
}
public int NumberOfRelayPorts
{
get { return _card.NumberOfRelayPorts; }
}
#endregion
}
}

View File

@@ -0,0 +1,29 @@
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.ThreeSeriesCards;
namespace PepperDash.Essentials.Core.CrestronIO.Cards
{
public class C3Ry8Controller:C3CardControllerBase, IRelayPorts
{
private readonly C3ry8 _card;
public C3Ry8Controller(string key, string name, C3ry8 hardware) : base(key, name, hardware)
{
_card = hardware;
}
#region Implementation of IRelayPorts
public CrestronCollection<Relay> RelayPorts
{
get { return _card.RelayPorts; }
}
public int NumberOfRelayPorts
{
get { return _card.NumberOfRelayPorts; }
}
#endregion
}
}

View File

@@ -0,0 +1,116 @@
using System;
using System.Collections.Generic;
using Crestron.SimplSharpPro.ThreeSeriesCards;
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.Core.CrestronIO.Cards
{
[ConfigSnippet("\"properties\":{\"card\":\"c3com3\"}")]
public class CenCi31Controller : CrestronGenericBaseDevice
{
private const string CardKeyTemplate = "{0}-card";
private const string CardNameTemplate = "{0}:{1}:{2}";
private const uint CardSlot = 1;
private readonly CenCi31 _cardCage;
private readonly CenCi31Configuration _config;
private readonly Dictionary<string, Func<CenCi31, uint, C3CardControllerBase>> _cardDict;
public CenCi31Controller(string key, string name, CenCi31Configuration config, CenCi31 hardware) : base(key, name, hardware)
{
_cardCage = hardware;
_config = config;
_cardDict = new Dictionary<string, Func<CenCi31, uint, C3CardControllerBase>>
{
{
"c3com3",
(c, s) =>
new C3Com3Controller(String.Format(CardKeyTemplate, key),
String.Format(CardNameTemplate, key, s, "C3Com3"), new C3com3(_cardCage))
},
{
"c3io16",
(c, s) =>
new C3Io16Controller(String.Format(CardKeyTemplate, key),
String.Format(CardNameTemplate, key, s,"C3Io16"), new C3io16(_cardCage))
},
{
"c3ir8",
(c, s) =>
new C3Ir8Controller(String.Format(CardKeyTemplate, key),
String.Format(CardNameTemplate, key, s, "C3Ir8"), new C3ir8(_cardCage))
},
{
"c3ry16",
(c, s) =>
new C3Ry16Controller(String.Format(CardKeyTemplate, key),
String.Format(CardNameTemplate, key, s, "C3Ry16"), new C3ry16(_cardCage))
},
{
"c3ry8",
(c, s) =>
new C3Ry8Controller(String.Format(CardKeyTemplate, key),
String.Format(CardNameTemplate, key, s, "C3Ry8"), new C3ry8(_cardCage))
},
};
GetCards();
}
private void GetCards()
{
Func<CenCi31, uint, C3CardControllerBase> cardBuilder;
if (String.IsNullOrEmpty(_config.Card))
{
Debug.Console(0, this, "No card specified");
return;
}
if (!_cardDict.TryGetValue(_config.Card.ToLower(), out cardBuilder))
{
Debug.Console(0, "Unable to find factory for 3-Series card type {0}.", _config.Card);
return;
}
var device = cardBuilder(_cardCage, CardSlot);
DeviceManager.AddDevice(device);
}
}
public class CenCi31Configuration
{
[JsonProperty("card")]
public string Card { get; set; }
}
public class CenCi31ControllerFactory : EssentialsDeviceFactory<CenCi31Controller>
{
public CenCi31ControllerFactory()
{
TypeNames = new List<string> {"cenci31"};
}
#region Overrides of EssentialsDeviceFactory<CenCi31Controller>
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory attempting to build new CEN-CI-1");
var controlProperties = CommFactory.GetControlPropertiesConfig(dc);
var ipId = controlProperties.IpIdInt;
var cardCage = new CenCi31(ipId, Global.ControlSystem);
var config = dc.Properties.ToObject<CenCi31Configuration>();
return new CenCi31Controller(dc.Key, dc.Name, config, cardCage);
}
#endregion
}
}

View File

@@ -0,0 +1,131 @@
using System;
using System.Collections.Generic;
using Crestron.SimplSharpPro.ThreeSeriesCards;
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.Core.CrestronIO.Cards
{
[ConfigSnippet("\"properties\":{\"cards\":{\"1\":\"c3com3\",\"2\":\"c3ry16\",\"3\":\"c3ry8\"}}")]
public class CenCi33Controller : CrestronGenericBaseDevice
{
private const string CardKeyTemplate = "{0}-card{1}";
private const string CardNameTemplate = "{0}:{1}:{2}";
private const uint CardSlots = 3;
private readonly CenCi33 _cardCage;
private readonly CenCi33Configuration _config;
private readonly Dictionary<string, Func<CenCi33, uint, C3CardControllerBase>> _cardDict;
public CenCi33Controller(string key, string name, CenCi33Configuration config, CenCi33 hardware) : base(key, name, hardware)
{
_cardCage = hardware;
_config = config;
_cardDict = new Dictionary<string, Func<CenCi33, uint, C3CardControllerBase>>
{
{
"c3com3",
(c, s) =>
new C3Com3Controller(String.Format(CardKeyTemplate, key, s),
String.Format(CardNameTemplate, key, s, "C3Com3"), new C3com3(s,_cardCage))
},
{
"c3io16",
(c, s) =>
new C3Io16Controller(String.Format(CardKeyTemplate, key, s),
String.Format(CardNameTemplate, key, s, "C3Io16"), new C3io16(s,_cardCage))
},
{
"c3ir8",
(c, s) =>
new C3Ir8Controller(String.Format(CardKeyTemplate, key, s),
String.Format(CardNameTemplate, key, s, "C3Ir8"), new C3ir8(s,_cardCage))
},
{
"c3ry16",
(c, s) =>
new C3Ry16Controller(String.Format(CardKeyTemplate, key, s),
String.Format(CardNameTemplate, key, s, "C3Ry16"), new C3ry16(s,_cardCage))
},
{
"c3ry8",
(c, s) =>
new C3Ry8Controller(String.Format(CardKeyTemplate, key, s),
String.Format(CardNameTemplate, key, s, "C3Ry8"), new C3ry8(s,_cardCage))
},
};
GetCards();
}
private void GetCards()
{
if (_config.Cards == null)
{
Debug.Console(0, this, "No card configuration for this device found");
return;
}
for (uint i = 1; i <= CardSlots; i++)
{
string cardType;
if (!_config.Cards.TryGetValue(i, out cardType))
{
Debug.Console(1, 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;
}
Func<CenCi33, 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;
}
var device = cardBuilder(_cardCage, i);
DeviceManager.AddDevice(device);
}
}
}
public class CenCi33Configuration
{
[JsonProperty("cards")]
public Dictionary<uint, string> Cards { get; set; }
}
public class CenCi33ControllerFactory : EssentialsDeviceFactory<CenCi33Controller>
{
public CenCi33ControllerFactory()
{
TypeNames = new List<string> {"cenci33"};
}
#region Overrides of EssentialsDeviceFactory<CenCi33Controller>
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory attempting to build new CEN-CI-3");
var controlProperties = CommFactory.GetControlPropertiesConfig(dc);
var ipId = controlProperties.IpIdInt;
var cardCage = new CenCi33(ipId, Global.ControlSystem);
var config = dc.Properties.ToObject<CenCi33Configuration>();
return new CenCi33Controller(dc.Key, dc.Name, config, cardCage);
}
#endregion
}
}

View File

@@ -0,0 +1,141 @@
using System;
using System.Collections.Generic;
using Crestron.SimplSharpPro.ThreeSeriesCards;
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.Core.CrestronIO.Cards
{
[ConfigSnippet("\"properties\":{\"cards\":{\"1\":\"c3com3\",\"2\":\"c3ry16\",\"3\":\"c3ry8\"}}")]
public class InternalCardCageController : EssentialsDevice
{
private const string CardKeyTemplate = "{0}-card{1}";
private const string CardNameTemplate = "{0}:{1}:{2}";
private const uint CardSlots = 3;
private readonly InternalCardCageConfiguration _config;
private readonly Dictionary<string, Func<uint, C3CardControllerBase>> _cardDict;
public InternalCardCageController(string key, string name, InternalCardCageConfiguration config) : base(key, name)
{
_config = config;
_cardDict = new Dictionary<string, Func<uint, C3CardControllerBase>>
{
{
"c3com3",
(s) =>
new C3Com3Controller(String.Format(CardKeyTemplate, key, s),
String.Format(CardNameTemplate, key, s, "C3Com3"), new C3com3(s,Global.ControlSystem))
},
{
"c3io16",
(s) =>
new C3Io16Controller(String.Format(CardKeyTemplate, key, s),
String.Format(CardNameTemplate, key, s, "C3Io16"), new C3io16(s,Global.ControlSystem))
},
{
"c3ir8",
(s) =>
new C3Ir8Controller(String.Format(CardKeyTemplate, key, s),
String.Format(CardNameTemplate, key, s, "C3Ir8"), new C3ir8(s,Global.ControlSystem))
},
{
"c3ry16",
(s) =>
new C3Ry16Controller(String.Format(CardKeyTemplate, key, s),
String.Format(CardNameTemplate, key, s, "C3Ry16"), new C3ry16(s,Global.ControlSystem))
},
{
"c3ry8",
(s) =>
new C3Ry8Controller(String.Format(CardKeyTemplate, key, s),
String.Format(CardNameTemplate, key, s, "C3Ry8"), new C3ry8(s,Global.ControlSystem))
},
};
GetCards();
}
private void GetCards()
{
if (_config.Cards == null)
{
Debug.Console(0, this, "No card configuration for this device found");
return;
}
for (uint i = 1; i <= CardSlots; i++)
{
string cardType;
if (!_config.Cards.TryGetValue(i, out cardType))
{
Debug.Console(1, 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;
}
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;
}
try
{
var device = cardBuilder(i);
DeviceManager.AddDevice(device);
}
catch (InvalidOperationException ex)
{
Debug.Console(0, this, Debug.ErrorLogLevel.Error,
"Unable to add card {0} to internal card cage.\r\nError Message: {1}\r\nStack Trace: {2}",
cardType, ex.Message, ex.StackTrace);
}
}
}
}
public class InternalCardCageConfiguration
{
[JsonProperty("cards")]
public Dictionary<uint, string> Cards { get; set; }
}
public class InternalCardCageControllerFactory : EssentialsDeviceFactory<InternalCardCageController>
{
public InternalCardCageControllerFactory()
{
TypeNames = new List<string> {"internalcardcage"};
}
#region Overrides of EssentialsDeviceFactory<InternalCardCageController>
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory attempting to build new Internal Card Cage Controller");
if (!Global.ControlSystem.SupportsThreeSeriesPlugInCards)
{
Debug.Console(0, Debug.ErrorLogLevel.Warning, "Current control system does NOT support 3-Series cards. Everything is NOT awesome.");
return null;
}
var config = dc.Properties.ToObject<InternalCardCageConfiguration>();
return new InternalCardCageController(dc.Key, dc.Name, config);
}
#endregion
}
}

View File

@@ -0,0 +1,51 @@
using System.Collections.Generic;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.GeneralIO;
using PepperDash.Core;
using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.Core
{
public class DinCenCn2Controller : CrestronGenericBaseDevice, IHasCresnetBranches
{
private readonly DinCenCn2 _device;
public CrestronCollection<CresnetBranch> CresnetBranches
{
get {
return _device != null ? _device.Branches : null;
}
}
public DinCenCn2Controller(string key, string name, DinCenCn2 device, DeviceConfig config)
: base(key, name, device)
{
_device = device;
}
public class DinCenCn2ControllerFactory : EssentialsDeviceFactory<DinCenCn2Controller>
{
public DinCenCn2ControllerFactory()
{
TypeNames = new List<string>() { "dincencn2", "dincencn2poe", "din-cencn2", "din-cencn2-poe" };
}
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory Attempting to create new C2N-RTHS Device");
var control = CommFactory.GetControlPropertiesConfig(dc);
var ipid = control.IpIdInt;
if (dc.Type.ToLower().Contains("poe"))
{
return new DinCenCn2Controller(dc.Key, dc.Name, new DinCenCn2Poe(ipid, Global.ControlSystem), dc);
}
return new DinCenCn2Controller(dc.Key, dc.Name, new DinCenCn2(ipid, Global.ControlSystem), dc);
}
}
}
}

View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
namespace PepperDash.Essentials.Core
{
public interface IHasCresnetBranches
{
CrestronCollection<CresnetBranch> CresnetBranches { get; }
}
}

View File

@@ -108,7 +108,14 @@ namespace PepperDash.Essentials.Core.CrestronIO
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<IDigitalInputJoinMap>(joinMapSerialized);
bridge.AddJoinMap(Key, joinMap);
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
{

View File

@@ -31,13 +31,14 @@ namespace PepperDash.Essentials.Core.CrestronIO
RelayOutput = relay;
RelayOutput.Register();
RelayOutput.StateChange += new RelayEventHandler(RelayOutput_StateChange);
RelayOutput.StateChange += RelayOutput_StateChange;
}
public GenericRelayDevice(string key, string name, Func<IOPortConfig, Relay> postActivationFunc,
IOPortConfig config)
: base(key, name)
{
OutputIsOnFeedback = new BoolFeedback(() => RelayOutput.State);
AddPostActivationAction(() =>
{
@@ -46,7 +47,6 @@ namespace PepperDash.Essentials.Core.CrestronIO
RelayOutput.Register();
RelayOutput.StateChange += RelayOutput_StateChange;
});
}
@@ -148,7 +148,14 @@ namespace PepperDash.Essentials.Core.CrestronIO
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<GenericRelayControllerJoinMap>(joinMapSerialized);
bridge.AddJoinMap(Key, joinMap);
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.");
}
if (RelayOutput == null)
{

View File

@@ -13,7 +13,7 @@ namespace PepperDash.Essentials.Core.CrestronIO
[Description("Wrapper class for the Crestron StatusSign device")]
public class StatusSignController : CrestronGenericBridgeableBaseDevice
{
private readonly StatusSign _device;
private StatusSign _device;
public BoolFeedback RedLedEnabledFeedback { get; private set; }
public BoolFeedback GreenLedEnabledFeedback { get; private set; }
@@ -23,34 +23,40 @@ namespace PepperDash.Essentials.Core.CrestronIO
public IntFeedback GreenLedBrightnessFeedback { get; private set; }
public IntFeedback BlueLedBrightnessFeedback { get; private set; }
public StatusSignController(string key, string name, GenericBase hardware) : base(key, name, hardware)
public StatusSignController(string key, Func<DeviceConfig, StatusSign> preActivationFunc, DeviceConfig config) : base(key, config.Name)
{
_device = hardware as StatusSign;
AddPreActivationAction(() =>
{
_device = preActivationFunc(config);
RedLedEnabledFeedback =
RegisterCrestronGenericBase(_device);
RedLedEnabledFeedback =
new BoolFeedback(
() =>
_device.Leds[(uint) StatusSign.Led.eLedColor.Red]
.ControlFeedback.BoolValue);
GreenLedEnabledFeedback =
new BoolFeedback(
() =>
_device.Leds[(uint) StatusSign.Led.eLedColor.Green]
.ControlFeedback.BoolValue);
BlueLedEnabledFeedback =
new BoolFeedback(
() =>
_device.Leds[(uint) StatusSign.Led.eLedColor.Blue]
_device.Leds[(uint)StatusSign.Led.eLedColor.Red]
.ControlFeedback.BoolValue);
GreenLedEnabledFeedback =
new BoolFeedback(
() =>
_device.Leds[(uint)StatusSign.Led.eLedColor.Green]
.ControlFeedback.BoolValue);
BlueLedEnabledFeedback =
new BoolFeedback(
() =>
_device.Leds[(uint)StatusSign.Led.eLedColor.Blue]
.ControlFeedback.BoolValue);
RedLedBrightnessFeedback =
new IntFeedback(() => (int) _device.Leds[(uint) StatusSign.Led.eLedColor.Red].BrightnessFeedback);
GreenLedBrightnessFeedback =
new IntFeedback(() => (int) _device.Leds[(uint) StatusSign.Led.eLedColor.Green].BrightnessFeedback);
BlueLedBrightnessFeedback =
new IntFeedback(() => (int) _device.Leds[(uint) StatusSign.Led.eLedColor.Blue].BrightnessFeedback);
RedLedBrightnessFeedback =
new IntFeedback(() => (int)_device.Leds[(uint)StatusSign.Led.eLedColor.Red].BrightnessFeedback);
GreenLedBrightnessFeedback =
new IntFeedback(() => (int)_device.Leds[(uint)StatusSign.Led.eLedColor.Green].BrightnessFeedback);
BlueLedBrightnessFeedback =
new IntFeedback(() => (int)_device.Leds[(uint)StatusSign.Led.eLedColor.Blue].BrightnessFeedback);
if (_device != null) _device.BaseEvent += _device_BaseEvent;
if (_device != null) _device.BaseEvent += _device_BaseEvent;
});
}
void _device_BaseEvent(GenericBase device, BaseEventArgs args)
@@ -118,7 +124,14 @@ namespace PepperDash.Essentials.Core.CrestronIO
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<StatusSignControllerJoinMap>(joinMapSerialized);
bridge.AddJoinMap(Key, joinMap);
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"));
@@ -160,23 +173,51 @@ namespace PepperDash.Essentials.Core.CrestronIO
device.SetColor(redBrightness, greenBrightness, blueBrightness);
}
}
public class StatusSignControllerFactory : EssentialsDeviceFactory<StatusSignController>
{
public StatusSignControllerFactory()
#region PreActivation
private static StatusSign GetStatusSignDevice(DeviceConfig dc)
{
TypeNames = new List<string>() { "statussign" };
}
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory Attempting to create new StatusSign Device");
var control = CommFactory.GetControlPropertiesConfig(dc);
var cresnetId = control.CresnetIdInt;
var branchId = control.ControlPortNumber;
var parentKey = string.IsNullOrEmpty(control.ControlPortDevKey) ? "processor" : control.ControlPortDevKey;
return new StatusSignController(dc.Key, dc.Name, new StatusSign(cresnetId, Global.ControlSystem));
if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase))
{
Debug.Console(0, "Device {0} is a valid cresnet master - creating new StatusSign", parentKey);
return new StatusSign(cresnetId, Global.ControlSystem);
}
var cresnetBridge = DeviceManager.GetDeviceForKey(parentKey) as IHasCresnetBranches;
if (cresnetBridge != null)
{
Debug.Console(0, "Device {0} is a valid cresnet master - creating new StatusSign", parentKey);
return new StatusSign(cresnetId, cresnetBridge.CresnetBranches[branchId]);
}
Debug.Console(0, "Device {0} is not a valid cresnet master", parentKey);
return null;
}
#endregion
public class StatusSignControllerFactory : EssentialsDeviceFactory<StatusSignController>
{
public StatusSignControllerFactory()
{
TypeNames = new List<string>() { "statussign" };
}
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory Attempting to create new StatusSign Device");
var control = CommFactory.GetControlPropertiesConfig(dc);
var cresnetId = control.CresnetIdInt;
return new StatusSignController(dc.Key, GetStatusSignDevice, dc);
}
}
}
}

View File

@@ -1,7 +1,9 @@
using System.Linq;
using System;
using System.Linq;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Core;
using PepperDash.Core.JsonStandardObjects;
using PepperDash.Essentials.Core.Bridges;
namespace PepperDash.Essentials.Core
@@ -11,7 +13,7 @@ namespace PepperDash.Essentials.Core
/// </summary>
public abstract class CrestronGenericBaseDevice : EssentialsDevice, IOnline, IHasFeedback, ICommunicationMonitor, IUsageTracking
{
public virtual GenericBase Hardware { get; protected set; }
protected GenericBase Hardware;
/// <summary>
/// Returns a list containing the Outputs that we want to expose.
@@ -42,6 +44,24 @@ namespace PepperDash.Essentials.Core
CommunicationMonitor = new CrestronGenericBaseCommunicationMonitor(this, hardware, 120000, 300000);
}
protected CrestronGenericBaseDevice(string key, string name)
: base(key, name)
{
Feedbacks = new FeedbackCollection<Feedback>();
}
protected void RegisterCrestronGenericBase(GenericBase hardware)
{
Hardware = hardware;
IsOnline = new BoolFeedback("IsOnlineFeedback", () => Hardware.IsOnline);
IsRegistered = new BoolFeedback("IsRegistered", () => Hardware.Registered);
IpConnectionsText = new StringFeedback("IpConnectionsText", () => Hardware.ConnectedIpList != null ? string.Join(",", Hardware.ConnectedIpList.Select(cip => cip.DeviceIpAddress).ToArray()) : string.Empty);
AddToFeedbackList(IsOnline, IpConnectionsText);
CommunicationMonitor = new CrestronGenericBaseCommunicationMonitor(this, hardware, 120000, 300000);
}
/// <summary>
/// Make sure that overriding classes call this!
/// Registers the Crestron device, connects up to the base events, starts communication monitor
@@ -135,6 +155,11 @@ namespace PepperDash.Essentials.Core
{
}
protected CrestronGenericBridgeableBaseDevice(string key, string name)
: base(key, name)
{
}
public abstract void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge);
}

View File

@@ -238,6 +238,42 @@ namespace PepperDash.Essentials.Core
}
}
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
@@ -313,7 +349,13 @@ namespace PepperDash.Essentials.Core
var deviceKey = args[0];
var setting = args[1];
var timeout = args[2];
var timeout= String.Empty;
if (args.Length >= 3)
{
timeout = args[2];
}
var device = GetDeviceForKey(deviceKey) as IStreamDebugging;
@@ -322,42 +364,38 @@ namespace PepperDash.Essentials.Core
Debug.Console(0, "Unable to get device with key: {0}", deviceKey);
return;
}
else
{
eStreamDebuggingSetting debugSetting = eStreamDebuggingSetting.Off;
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
{
debugSetting = (eStreamDebuggingSetting)Enum.Parse(typeof(eStreamDebuggingSetting), setting, true);
}
catch
{
Debug.Console(0, "Unable to convert setting value. Please use off/rx/tx/both");
return;
}
var min = Convert.ToUInt32(timeout);
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);
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);
return;
}
}
else
catch (Exception e)
{
device.StreamDebugging.SetDebuggingWithDefaultTimeout(debugSetting);
Debug.Console(0, "Device: '{0}' debug level set to {1) for default time (30 minutes)", deviceKey, debugSetting);
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);
}
}

View File

@@ -128,9 +128,16 @@ namespace PepperDash.Essentials.Core
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<DisplayControllerJoinMap>(joinMapSerialized);
bridge.AddJoinMap(Key, joinMap);
Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
if (bridge != null)
{
bridge.AddJoinMap(Key, joinMap);
}
else
{
Debug.Console(0,this,"Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
}
Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
Debug.Console(0, "Linking to Display: {0}", displayDevice.Name);
trilist.StringInput[joinMap.Name.JoinNumber].StringValue = displayDevice.Name;

View File

@@ -103,7 +103,7 @@ namespace PepperDash.Essentials.Core
// Check for types that have been added by plugin dlls.
if (FactoryMethods.ContainsKey(typeName))
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Loading '{0}' from plugin", dc.Type);
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Loading '{0}' from Essentials Core", dc.Type);
return FactoryMethods[typeName].FactoryMethod(dc);
}

View File

@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
namespace PepperDash_Essentials_Core
{
public class IsReadyEventArgs : EventArgs
{
public bool IsReady { get; set; }
public IsReadyEventArgs(bool data)
{
IsReady = data;
}
}
public interface IHasReady
{
event EventHandler<IsReadyEventArgs> IsReadyEvent;
bool IsReady { get; }
}
}

View File

@@ -6,134 +6,192 @@ using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.Gateways;
using Newtonsoft.Json;
using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
using PepperDash_Essentials_Core;
namespace PepperDash.Essentials.Core
namespace PepperDash.Essentials.Core
{
[Description("Wrapper class for Crestron Infinet-EX Gateways")]
public class CenRfgwController : CrestronGenericBaseDevice
{
private GatewayBase _Gateway;
public GatewayBase GateWay { get { return _Gateway; } }
/// <summary>
/// Constructor for the on-board gateway
/// </summary>
/// <param name="key"></param>
/// <param name="name"></param>
public CenRfgwController(string key, string name, GatewayBase gateway) :
base(key, name, gateway)
{
_Gateway = gateway;
}
public static CenRfgwController GetNewExGatewayController(string key, string name, ushort ipId, ushort cresnetId, string gatewayType)
{
eExGatewayType type = (eExGatewayType)Enum.Parse(typeof(eExGatewayType), gatewayType, true);
try
{
var cs = Global.ControlSystem;
GatewayBase gw = null;
switch (type)
{
case eExGatewayType.Ethernet:
gw = new CenRfgwEx(ipId, cs);
break;
case eExGatewayType.EthernetShared:
gw = new CenRfgwExEthernetSharable(ipId, cs);
break;
case eExGatewayType.Cresnet:
gw = new CenRfgwExCresnet(cresnetId, cs);
break;
}
return new CenRfgwController(key, name, gw);
}
catch (Exception)
{
Debug.Console(0, "ERROR: Cannot create EX Gateway, id {0}, type {1}", type == eExGatewayType.Cresnet ? cresnetId : ipId, gatewayType);
return null;
}
}
public static CenRfgwController GetNewErGatewayController(string key, string name, ushort ipId, ushort cresnetId, string gatewayType)
{
eExGatewayType type = (eExGatewayType)Enum.Parse(typeof(eExGatewayType), gatewayType, true);
try
{
var cs = Global.ControlSystem;
GatewayBase gw = null;
switch (type)
{
case eExGatewayType.Ethernet:
gw = new CenErfgwPoe(ipId, cs);
break;
case eExGatewayType.EthernetShared:
gw = new CenErfgwPoeEthernetSharable(ipId, cs);
break;
case eExGatewayType.Cresnet:
gw = new CenErfgwPoeCresnet(cresnetId, cs);
break;
}
return new CenRfgwController(key, name, gw);
}
catch (Exception)
{
Debug.Console(0, "ERROR: Cannot create ER Gateway, id {0}, type {1}", type== eExGatewayType.Cresnet ? cresnetId : ipId, gatewayType);
return null;
}
}
}
public enum eExGatewayType
{
Ethernet, EthernetShared, Cresnet
}
[Description("Wrapper class for Crestron Infinet-EX Gateways")]
public class CenRfgwController : CrestronGenericBaseDevice, IHasReady
{
public event EventHandler<IsReadyEventArgs> IsReadyEvent;
public bool IsReady { get; private set; }
#region Factory
public class CenRfgwControllerFactory : EssentialsDeviceFactory<CenRfgwController>
{
public CenRfgwControllerFactory()
{
TypeNames = new List<string>() { "cenrfgwex", "cenerfgwpoe" };
}
private GatewayBase _gateway;
public override EssentialsDevice BuildDevice(DeviceConfig dc)
public GatewayBase GateWay
{
Debug.Console(1, "Factory Attempting to create new CEN-GWEXER Device");
var props = JsonConvert.DeserializeObject<EssentialsRfGatewayConfig>(dc.Properties.ToString());
var type = dc.Type.ToLower();
var control = props.Control;
var ipid = control.IpIdInt;
var cresnetId = control.CresnetIdInt;
var gatewayType = props.GatewayType;
switch (type)
{
case ("cenrfgwex"):
return CenRfgwController.GetNewExGatewayController(dc.Key, dc.Name,
(ushort)ipid, (ushort)cresnetId, gatewayType);
case ("cenerfgwpoe"):
return CenRfgwController.GetNewErGatewayController(dc.Key, dc.Name,
(ushort)ipid, (ushort)cresnetId, gatewayType);
default:
return null;
}
get { return _gateway; }
}
/// <summary>
/// Constructor for the on-board gateway
/// </summary>
/// <param name="key"></param>
/// <param name="name"></param>
/// <param name="gateway"></param>
public CenRfgwController(string key, string name, GatewayBase gateway) :
base(key, name, gateway)
{
_gateway = gateway;
IsReady = true;
FireIsReadyEvent(IsReady);
}
public CenRfgwController(string key, Func<DeviceConfig, GatewayBase> preActivationFunc, DeviceConfig config) :
base(key, config.Name)
{
IsReady = false;
FireIsReadyEvent(IsReady);
AddPreActivationAction(() =>
{
_gateway = preActivationFunc(config);
IsReady = true;
RegisterCrestronGenericBase(_gateway);
FireIsReadyEvent(IsReady);
});
}
public static GatewayBase GetNewIpRfGateway(DeviceConfig dc)
{
var control = CommFactory.GetControlPropertiesConfig(dc);
var type = dc.Type;
var ipId = control.IpIdInt;
if (type.Equals("cenrfgwex", StringComparison.InvariantCultureIgnoreCase))
{
return new CenRfgwEx(ipId, Global.ControlSystem);
}
if (type.Equals("cenerfgwpoe", StringComparison.InvariantCultureIgnoreCase))
{
return new CenErfgwPoe(ipId, Global.ControlSystem);
}
return null;
}
private void FireIsReadyEvent(bool data)
{
var handler = IsReadyEvent;
if (handler == null) return;
handler(this, new IsReadyEventArgs(data));
}
public static GatewayBase GetNewSharedIpRfGateway(DeviceConfig dc)
{
var control = CommFactory.GetControlPropertiesConfig(dc);
var ipId = control.IpIdInt;
if (dc.Type.Equals("cenrfgwex", StringComparison.InvariantCultureIgnoreCase))
{
return new CenRfgwExEthernetSharable(ipId, Global.ControlSystem);
}
if (dc.Type.Equals("cenerfgwpoe", StringComparison.InvariantCultureIgnoreCase))
{
return new CenErfgwPoeEthernetSharable(ipId, Global.ControlSystem);
}
return null;
}
public static GatewayBase GetCenRfgwCresnetController(DeviceConfig dc)
{
var control = CommFactory.GetControlPropertiesConfig(dc);
var type = dc.Type;
var cresnetId = control.CresnetIdInt;
var branchId = control.ControlPortNumber;
var parentKey = string.IsNullOrEmpty(control.ControlPortDevKey) ? "processor" : control.ControlPortDevKey;
if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase))
{
Debug.Console(0, "Device {0} is a valid cresnet master - creating new CenRfgw", parentKey);
if (type.Equals("cenerfgwpoe", StringComparison.InvariantCultureIgnoreCase))
{
return new CenErfgwPoeCresnet(cresnetId, Global.ControlSystem);
}
if (type.Equals("cenrfgwex", StringComparison.InvariantCultureIgnoreCase))
{
return new CenRfgwExCresnet(cresnetId, Global.ControlSystem);
}
}
var cresnetBridge = DeviceManager.GetDeviceForKey(parentKey) as ICresnetBridge;
if (cresnetBridge != null)
{
Debug.Console(0, "Device {0} is a valid cresnet master - creating new CenRfgw", parentKey);
if (type.Equals("cenerfgwpoe", StringComparison.InvariantCultureIgnoreCase))
{
return new CenErfgwPoeCresnet(cresnetId, cresnetBridge.Branches[branchId]);
}
if (type.Equals("cenrfgwex", StringComparison.InvariantCultureIgnoreCase))
{
return new CenRfgwExCresnet(cresnetId, cresnetBridge.Branches[branchId]);
}
}
Debug.Console(0, "Device {0} is not a valid cresnet master", parentKey);
return null;
}
public enum EExGatewayType
{
Ethernet,
EthernetShared,
Cresnet
}
#region Factory
public class CenRfgwControllerFactory : EssentialsDeviceFactory<CenRfgwController>
{
public CenRfgwControllerFactory()
{
TypeNames = new List<string> {"cenrfgwex", "cenerfgwpoe"};
}
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory Attempting to create new CEN-GWEXER Device");
var props = JsonConvert.DeserializeObject<EssentialsRfGatewayConfig>(dc.Properties.ToString());
EExGatewayType gatewayType =
(EExGatewayType) Enum.Parse(typeof (EExGatewayType), props.GatewayType, true);
switch (gatewayType)
{
case (EExGatewayType.Ethernet):
return new CenRfgwController(dc.Key, dc.Name, GetNewIpRfGateway(dc));
case (EExGatewayType.EthernetShared):
return new CenRfgwController(dc.Key, dc.Name, GetNewSharedIpRfGateway(dc));
case (EExGatewayType.Cresnet):
return new CenRfgwController(dc.Key, GetCenRfgwCresnetController, dc);
}
return null;
}
}
#endregion
}
#endregion
}
}

View File

@@ -1,488 +1,488 @@
using System;
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using Crestron.SimplSharp.Reflection;
using PepperDash.Core;
using PepperDash.Essentials.Core.Config;
using Newtonsoft.Json;
namespace PepperDash.Essentials.Core
{
public static class JoinMapHelper
{
/// <summary>
/// Attempts to get the serialized join map from config
/// </summary>
/// <param name="joinMapKey"></param>
/// <returns></returns>
public static string GetSerializedJoinMapForDevice(string joinMapKey)
{
if (string.IsNullOrEmpty(joinMapKey))
return null;
var joinMap = ConfigReader.ConfigObject.JoinMaps[joinMapKey];
return joinMap;
}
/// <summary>
/// Attempts to get the serialized join map from config
/// </summary>
/// <param name="joinMapKey"></param>
/// <returns></returns>
public static string GetJoinMapForDevice(string joinMapKey)
{
return GetSerializedJoinMapForDevice(joinMapKey);
}
/// <summary>
/// Attempts to find a custom join map by key and returns it deserialized if found
/// </summary>
/// <param name="joinMapKey"></param>
/// <returns></returns>
public static Dictionary<string, JoinData> TryGetJoinMapAdvancedForDevice(string joinMapKey)
{
if (string.IsNullOrEmpty(joinMapKey))
return null;
var joinMapSerialzed = ConfigReader.ConfigObject.JoinMaps[joinMapKey];
if (joinMapSerialzed == null) return null;
var joinMapData = JsonConvert.DeserializeObject<Dictionary<string, JoinData>>(joinMapSerialzed);
return joinMapData;
}
}
/// <summary>
/// Base class for join maps
/// </summary>
[Obsolete("This is being deprecated in favor of JoinMapBaseAdvanced")]
public abstract class JoinMapBase
{
/// <summary>
/// Modifies all the join numbers by adding the offset. This should never be called twice
/// </summary>
/// <param name="joinStart"></param>
public abstract void OffsetJoinNumbers(uint joinStart);
/// <summary>
/// The collection of joins and associated metadata
/// </summary>
public Dictionary<string, JoinMetadata> Joins = new Dictionary<string, JoinMetadata>();
/// <summary>
/// Prints the join information to console
/// </summary>
public void PrintJoinMapInfo()
{
Debug.Console(0, "{0}:\n", GetType().Name);
// Get the joins of each type and print them
Debug.Console(0, "Digitals:");
var digitals = Joins.Where(j => (j.Value.JoinType & eJoinType.Digital) == eJoinType.Digital).ToDictionary(j => j.Key, j => j.Value);
Debug.Console(2, "Found {0} Digital Joins", digitals.Count);
PrintJoinList(GetSortedJoins(digitals));
Debug.Console(0, "Analogs:");
var analogs = Joins.Where(j => (j.Value.JoinType & eJoinType.Analog) == eJoinType.Analog).ToDictionary(j => j.Key, j => j.Value);
Debug.Console(2, "Found {0} Analog Joins", analogs.Count);
PrintJoinList(GetSortedJoins(analogs));
Debug.Console(0, "Serials:");
var serials = Joins.Where(j => (j.Value.JoinType & eJoinType.Serial) == eJoinType.Serial).ToDictionary(j => j.Key, j => j.Value);
Debug.Console(2, "Found {0} Serial Joins", serials.Count);
PrintJoinList(GetSortedJoins(serials));
}
/// <summary>
/// Returns a sorted list by JoinNumber
/// </summary>
/// <param name="joins"></param>
/// <returns></returns>
List<KeyValuePair<string, JoinMetadata>> GetSortedJoins(Dictionary<string, JoinMetadata> joins)
{
var sortedJoins = joins.ToList();
sortedJoins.Sort((pair1, pair2) => pair1.Value.JoinNumber.CompareTo(pair2.Value.JoinNumber));
return sortedJoins;
}
void PrintJoinList(List<KeyValuePair<string, JoinMetadata>> joins)
{
foreach (var join in joins)
{
Debug.Console(0,
@"Join Number: {0} | Label: '{1}' | JoinSpan: '{2}' | Type: '{3}' | Capabilities: '{4}'",
join.Value.JoinNumber,
join.Value.Label,
join.Value.JoinSpan,
join.Value.JoinType.ToString(),
join.Value.JoinCapabilities.ToString());
}
}
/// <summary>
/// Returns the join number for the join with the specified key
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
public uint GetJoinForKey(string key)
{
return Joins.ContainsKey(key) ? Joins[key].JoinNumber : 0;
}
/// <summary>
/// Returns the join span for the join with the specified key
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
public uint GetJoinSpanForKey(string key)
{
return Joins.ContainsKey(key) ? Joins[key].JoinSpan : 0;
}
}
/// <summary>
/// Base class for join maps
/// </summary>
public abstract class JoinMapBaseAdvanced
{
protected uint JoinOffset;
/// <summary>
/// The collection of joins and associated metadata
/// </summary>
public Dictionary<string, JoinDataComplete> Joins { get; private set; }
protected JoinMapBaseAdvanced(uint joinStart)
{
Joins = new Dictionary<string, JoinDataComplete>();
JoinOffset = joinStart - 1;
}
protected JoinMapBaseAdvanced(uint joinStart, Type type):this(joinStart)
{
AddJoins(type);
}
protected void AddJoins(Type type)
{
// Add all the JoinDataComplete properties to the Joins Dictionary and pass in the offset
//Joins = this.GetType()
// .GetCType()
// .GetFields(BindingFlags.Public | BindingFlags.Instance)
// .Where(field => field.IsDefined(typeof(JoinNameAttribute), true))
// .Select(field => (JoinDataComplete)field.GetValue(this))
// .ToDictionary(join => join.GetNameAttribute(), join =>
// {
// join.SetJoinOffset(_joinOffset);
// return join;
// });
//type = this.GetType(); <- this wasn't working because 'this' was always the base class, never the derived class
var fields =
type.GetCType()
.GetFields(BindingFlags.Public | BindingFlags.Instance)
.Where(f => f.IsDefined(typeof (JoinNameAttribute), true));
foreach (var field in fields)
{
var childClass = Convert.ChangeType(this, type, null);
var value = field.GetValue(childClass) as JoinDataComplete; //this here is JoinMapBaseAdvanced, not the child class. JoinMapBaseAdvanced has no fields.
if (value == null)
{
Debug.Console(0, "Unable to caset base class to {0}", type.Name);
continue;
}
value.SetJoinOffset(JoinOffset);
var joinName = value.GetNameAttribute(field);
if (String.IsNullOrEmpty(joinName)) continue;
Joins.Add(joinName, value);
}
PrintJoinMapInfo();
}
/// <summary>
/// Prints the join information to console
/// </summary>
public void PrintJoinMapInfo()
{
Debug.Console(0, "{0}:\n", GetType().Name);
// Get the joins of each type and print them
Debug.Console(0, "Digitals:");
var digitals = Joins.Where(j => (j.Value.Metadata.JoinType & eJoinType.Digital) == eJoinType.Digital).ToDictionary(j => j.Key, j => j.Value);
Debug.Console(2, "Found {0} Digital Joins", digitals.Count);
PrintJoinList(GetSortedJoins(digitals));
Debug.Console(0, "Analogs:");
var analogs = Joins.Where(j => (j.Value.Metadata.JoinType & eJoinType.Analog) == eJoinType.Analog).ToDictionary(j => j.Key, j => j.Value);
Debug.Console(2, "Found {0} Analog Joins", analogs.Count);
PrintJoinList(GetSortedJoins(analogs));
Debug.Console(0, "Serials:");
var serials = Joins.Where(j => (j.Value.Metadata.JoinType & eJoinType.Serial) == eJoinType.Serial).ToDictionary(j => j.Key, j => j.Value);
Debug.Console(2, "Found {0} Serial Joins", serials.Count);
PrintJoinList(GetSortedJoins(serials));
}
/// <summary>
/// Returns a sorted list by JoinNumber
/// </summary>
/// <param name="joins"></param>
/// <returns></returns>
List<KeyValuePair<string, JoinDataComplete>> GetSortedJoins(Dictionary<string, JoinDataComplete> joins)
{
var sortedJoins = joins.ToList();
sortedJoins.Sort((pair1, pair2) => pair1.Value.JoinNumber.CompareTo(pair2.Value.JoinNumber));
return sortedJoins;
}
void PrintJoinList(List<KeyValuePair<string, JoinDataComplete>> joins)
{
foreach (var join in joins)
{
Debug.Console(0,
@"Join Number: {0} | JoinSpan: '{1}' | Label: '{2}' | Type: '{3}' | Capabilities: '{4}'",
join.Value.JoinNumber,
join.Value.JoinSpan,
join.Value.Metadata.Label,
join.Value.Metadata.JoinType.ToString(),
join.Value.Metadata.JoinCapabilities.ToString());
}
}
/// <summary>
/// Attempts to find the matching key for the custom join and if found overwrites the default JoinData with the custom
/// </summary>
/// <param name="joinData"></param>
public void SetCustomJoinData(Dictionary<string, JoinData> joinData)
{
foreach (var customJoinData in joinData)
{
var join = Joins[customJoinData.Key];
if (join != null)
{
join.SetCustomJoinData(customJoinData.Value);
}
else
{
Debug.Console(2, "No mathcing key found in join map for: '{0}'", customJoinData.Key);
}
}
PrintJoinMapInfo();
}
///// <summary>
///// Returns the join number for the join with the specified key
///// </summary>
///// <param name="key"></param>
///// <returns></returns>
//public uint GetJoinForKey(string key)
//{
// return Joins.ContainsKey(key) ? Joins[key].JoinNumber : 0;
//}
///// <summary>
///// Returns the join span for the join with the specified key
///// </summary>
///// <param name="key"></param>
///// <returns></returns>
//public uint GetJoinSpanForKey(string key)
//{
// return Joins.ContainsKey(key) ? Joins[key].JoinSpan : 0;
//}
}
/// <summary>
/// Read = Provides feedback to SIMPL
/// Write = Responds to sig values from SIMPL
/// </summary>
[Flags]
public enum eJoinCapabilities
{
None = 0,
ToSIMPL = 1,
FromSIMPL = 2,
ToFromSIMPL = ToSIMPL | FromSIMPL
}
[Flags]
public enum eJoinType
{
None = 0,
Digital = 1,
Analog = 2,
Serial = 4,
DigitalAnalog = Digital | Analog,
DigitalSerial = Digital | Serial,
AnalogSerial = Analog | Serial,
DigitalAnalogSerial = Digital | Analog | Serial
}
/// <summary>
/// Metadata describing the join
/// </summary>
public class JoinMetadata
using Crestron.SimplSharp.Reflection;
using PepperDash.Core;
using PepperDash.Essentials.Core.Config;
using Newtonsoft.Json;
namespace PepperDash.Essentials.Core
{
public static class JoinMapHelper
{
private string _description;
/// <summary>
/// Join number (based on join offset value)
/// </summary>
[JsonProperty("joinNumber")]
[Obsolete]
public uint JoinNumber { get; set; }
/// <summary>
/// Join range span. If join indicates the start of a range of joins, this indicated the maximum number of joins in the range
/// </summary>
[Obsolete]
[JsonProperty("joinSpan")]
public uint JoinSpan { get; set; }
/// <summary>
/// A label for the join to better describe its usage
/// </summary>
[Obsolete("Use Description instead")]
[JsonProperty("label")]
public string Label { get { return _description; } set { _description = value; } }
/// <summary>
/// A description for the join to better describe its usage
/// </summary>
[JsonProperty("description")]
public string Description { get { return _description; } set { _description = value; } }
/// <summary>
/// Signal type(s)
/// </summary>
[JsonProperty("joinType")]
public eJoinType JoinType { get; set; }
/// <summary>
/// Indicates whether the join is read and/or write
/// </summary>
[JsonProperty("joinCapabilities")]
public eJoinCapabilities JoinCapabilities { get; set; }
/// <summary>
/// Indicates a set of valid values (particularly if this translates to an enum
/// </summary>
[JsonProperty("validValues")]
public string[] ValidValues { get; set; }
}
/// <summary>
/// Data describing the join. Can be
/// </summary>
public class JoinData
{
/// <summary>
/// Join number (based on join offset value)
/// </summary>
[JsonProperty("joinNumber")]
public uint JoinNumber { get; set; }
/// <summary>
/// Join range span. If join indicates the start of a range of joins, this indicated the maximum number of joins in the range
/// </summary>
[JsonProperty("joinSpan")]
public uint JoinSpan { get; set; }
}
/// <summary>
/// A class to aggregate the JoinData and JoinMetadata for a join
/// </summary>
public class JoinDataComplete
{
private uint _joinOffset;
private JoinData _data;
public JoinMetadata Metadata { get; set; }
public JoinDataComplete(JoinData data, JoinMetadata metadata)
{
_data = data;
Metadata = metadata;
}
/// <summary>
/// Sets the join offset value
/// </summary>
/// <param name="joinOffset"></param>
public void SetJoinOffset(uint joinOffset)
{
_joinOffset = joinOffset;
}
/// <summary>
/// The join number (including the offset)
/// </summary>
public uint JoinNumber
{
get { return _data.JoinNumber+ _joinOffset; }
set { _data.JoinNumber = value; }
}
public uint JoinSpan
{
get { return _data.JoinSpan; }
}
public void SetCustomJoinData(JoinData customJoinData)
{
_data = customJoinData;
}
public string GetNameAttribute(MemberInfo memberInfo)
{
var name = string.Empty;
var attribute = (JoinNameAttribute)CAttribute.GetCustomAttribute(memberInfo, typeof(JoinNameAttribute));
if (attribute == null) return name;
name = attribute.Name;
Debug.Console(2, "JoinName Attribute value: {0}", name);
return name;
/// Attempts to get the serialized join map from config
/// </summary>
/// <param name="joinMapKey"></param>
/// <returns></returns>
public static string GetSerializedJoinMapForDevice(string joinMapKey)
{
if (string.IsNullOrEmpty(joinMapKey))
return null;
var joinMap = ConfigReader.ConfigObject.JoinMaps[joinMapKey];
return joinMap;
}
/// <summary>
/// Attempts to get the serialized join map from config
/// </summary>
/// <param name="joinMapKey"></param>
/// <returns></returns>
public static string GetJoinMapForDevice(string joinMapKey)
{
return GetSerializedJoinMapForDevice(joinMapKey);
}
/// <summary>
/// Attempts to find a custom join map by key and returns it deserialized if found
/// </summary>
/// <param name="joinMapKey"></param>
/// <returns></returns>
public static Dictionary<string, JoinData> TryGetJoinMapAdvancedForDevice(string joinMapKey)
{
if (string.IsNullOrEmpty(joinMapKey))
return null;
var joinMapSerialzed = ConfigReader.ConfigObject.JoinMaps[joinMapKey];
if (joinMapSerialzed == null) return null;
var joinMapData = JsonConvert.DeserializeObject<Dictionary<string, JoinData>>(joinMapSerialzed);
return joinMapData;
}
}
/// <summary>
/// Base class for join maps
/// </summary>
[Obsolete("This is being deprecated in favor of JoinMapBaseAdvanced")]
public abstract class JoinMapBase
{
/// <summary>
/// Modifies all the join numbers by adding the offset. This should never be called twice
/// </summary>
/// <param name="joinStart"></param>
public abstract void OffsetJoinNumbers(uint joinStart);
/// <summary>
/// The collection of joins and associated metadata
/// </summary>
public Dictionary<string, JoinMetadata> Joins = new Dictionary<string, JoinMetadata>();
/// <summary>
/// Prints the join information to console
/// </summary>
public void PrintJoinMapInfo()
{
Debug.Console(0, "{0}:\n", GetType().Name);
// Get the joins of each type and print them
Debug.Console(0, "Digitals:");
var digitals = Joins.Where(j => (j.Value.JoinType & eJoinType.Digital) == eJoinType.Digital).ToDictionary(j => j.Key, j => j.Value);
Debug.Console(2, "Found {0} Digital Joins", digitals.Count);
PrintJoinList(GetSortedJoins(digitals));
Debug.Console(0, "Analogs:");
var analogs = Joins.Where(j => (j.Value.JoinType & eJoinType.Analog) == eJoinType.Analog).ToDictionary(j => j.Key, j => j.Value);
Debug.Console(2, "Found {0} Analog Joins", analogs.Count);
PrintJoinList(GetSortedJoins(analogs));
Debug.Console(0, "Serials:");
var serials = Joins.Where(j => (j.Value.JoinType & eJoinType.Serial) == eJoinType.Serial).ToDictionary(j => j.Key, j => j.Value);
Debug.Console(2, "Found {0} Serial Joins", serials.Count);
PrintJoinList(GetSortedJoins(serials));
}
/// <summary>
/// Returns a sorted list by JoinNumber
/// </summary>
/// <param name="joins"></param>
/// <returns></returns>
List<KeyValuePair<string, JoinMetadata>> GetSortedJoins(Dictionary<string, JoinMetadata> joins)
{
var sortedJoins = joins.ToList();
sortedJoins.Sort((pair1, pair2) => pair1.Value.JoinNumber.CompareTo(pair2.Value.JoinNumber));
return sortedJoins;
}
void PrintJoinList(List<KeyValuePair<string, JoinMetadata>> joins)
{
foreach (var join in joins)
{
Debug.Console(0,
@"Join Number: {0} | Label: '{1}' | JoinSpan: '{2}' | Type: '{3}' | Capabilities: '{4}'",
join.Value.JoinNumber,
join.Value.Label,
join.Value.JoinSpan,
join.Value.JoinType.ToString(),
join.Value.JoinCapabilities.ToString());
}
}
/// <summary>
/// Returns the join number for the join with the specified key
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
public uint GetJoinForKey(string key)
{
return Joins.ContainsKey(key) ? Joins[key].JoinNumber : 0;
}
/// <summary>
/// Returns the join span for the join with the specified key
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
public uint GetJoinSpanForKey(string key)
{
return Joins.ContainsKey(key) ? Joins[key].JoinSpan : 0;
}
}
[AttributeUsage(AttributeTargets.All)]
public class JoinNameAttribute : CAttribute
{
private string _Name;
public JoinNameAttribute(string name)
{
Debug.Console(2, "Setting Attribute Name: {0}", name);
_Name = name;
}
public string Name
{
get { return _Name; }
}
/// <summary>
/// Base class for join maps
/// </summary>
public abstract class JoinMapBaseAdvanced
{
protected uint JoinOffset;
/// <summary>
/// The collection of joins and associated metadata
/// </summary>
public Dictionary<string, JoinDataComplete> Joins { get; private set; }
protected JoinMapBaseAdvanced(uint joinStart)
{
Joins = new Dictionary<string, JoinDataComplete>();
JoinOffset = joinStart - 1;
}
protected JoinMapBaseAdvanced(uint joinStart, Type type):this(joinStart)
{
AddJoins(type);
}
protected void AddJoins(Type type)
{
// Add all the JoinDataComplete properties to the Joins Dictionary and pass in the offset
//Joins = this.GetType()
// .GetCType()
// .GetFields(BindingFlags.Public | BindingFlags.Instance)
// .Where(field => field.IsDefined(typeof(JoinNameAttribute), true))
// .Select(field => (JoinDataComplete)field.GetValue(this))
// .ToDictionary(join => join.GetNameAttribute(), join =>
// {
// join.SetJoinOffset(_joinOffset);
// return join;
// });
//type = this.GetType(); <- this wasn't working because 'this' was always the base class, never the derived class
var fields =
type.GetCType()
.GetFields(BindingFlags.Public | BindingFlags.Instance)
.Where(f => f.IsDefined(typeof (JoinNameAttribute), true));
foreach (var field in fields)
{
var childClass = Convert.ChangeType(this, type, null);
var value = field.GetValue(childClass) as JoinDataComplete; //this here is JoinMapBaseAdvanced, not the child class. JoinMapBaseAdvanced has no fields.
if (value == null)
{
Debug.Console(0, "Unable to caset base class to {0}", type.Name);
continue;
}
value.SetJoinOffset(JoinOffset);
var joinName = value.GetNameAttribute(field);
if (String.IsNullOrEmpty(joinName)) continue;
Joins.Add(joinName, value);
}
PrintJoinMapInfo();
}
/// <summary>
/// Prints the join information to console
/// </summary>
public void PrintJoinMapInfo()
{
Debug.Console(0, "{0}:\n", GetType().Name);
// Get the joins of each type and print them
Debug.Console(0, "Digitals:");
var digitals = Joins.Where(j => (j.Value.Metadata.JoinType & eJoinType.Digital) == eJoinType.Digital).ToDictionary(j => j.Key, j => j.Value);
Debug.Console(2, "Found {0} Digital Joins", digitals.Count);
PrintJoinList(GetSortedJoins(digitals));
Debug.Console(0, "Analogs:");
var analogs = Joins.Where(j => (j.Value.Metadata.JoinType & eJoinType.Analog) == eJoinType.Analog).ToDictionary(j => j.Key, j => j.Value);
Debug.Console(2, "Found {0} Analog Joins", analogs.Count);
PrintJoinList(GetSortedJoins(analogs));
Debug.Console(0, "Serials:");
var serials = Joins.Where(j => (j.Value.Metadata.JoinType & eJoinType.Serial) == eJoinType.Serial).ToDictionary(j => j.Key, j => j.Value);
Debug.Console(2, "Found {0} Serial Joins", serials.Count);
PrintJoinList(GetSortedJoins(serials));
}
/// <summary>
/// Returns a sorted list by JoinNumber
/// </summary>
/// <param name="joins"></param>
/// <returns></returns>
List<KeyValuePair<string, JoinDataComplete>> GetSortedJoins(Dictionary<string, JoinDataComplete> joins)
{
var sortedJoins = joins.ToList();
sortedJoins.Sort((pair1, pair2) => pair1.Value.JoinNumber.CompareTo(pair2.Value.JoinNumber));
return sortedJoins;
}
void PrintJoinList(List<KeyValuePair<string, JoinDataComplete>> joins)
{
foreach (var join in joins)
{
Debug.Console(0,
@"Join Number: {0} | JoinSpan: '{1}' | Label: '{2}' | Type: '{3}' | Capabilities: '{4}'",
join.Value.JoinNumber,
join.Value.JoinSpan,
join.Value.Metadata.Label,
join.Value.Metadata.JoinType.ToString(),
join.Value.Metadata.JoinCapabilities.ToString());
}
}
/// <summary>
/// Attempts to find the matching key for the custom join and if found overwrites the default JoinData with the custom
/// </summary>
/// <param name="joinData"></param>
public void SetCustomJoinData(Dictionary<string, JoinData> joinData)
{
foreach (var customJoinData in joinData)
{
var join = Joins[customJoinData.Key];
if (join != null)
{
join.SetCustomJoinData(customJoinData.Value);
}
else
{
Debug.Console(2, "No mathcing key found in join map for: '{0}'", customJoinData.Key);
}
}
PrintJoinMapInfo();
}
///// <summary>
///// Returns the join number for the join with the specified key
///// </summary>
///// <param name="key"></param>
///// <returns></returns>
//public uint GetJoinForKey(string key)
//{
// return Joins.ContainsKey(key) ? Joins[key].JoinNumber : 0;
//}
///// <summary>
///// Returns the join span for the join with the specified key
///// </summary>
///// <param name="key"></param>
///// <returns></returns>
//public uint GetJoinSpanForKey(string key)
//{
// return Joins.ContainsKey(key) ? Joins[key].JoinSpan : 0;
//}
}
/// <summary>
/// Read = Provides feedback to SIMPL
/// Write = Responds to sig values from SIMPL
/// </summary>
[Flags]
public enum eJoinCapabilities
{
None = 0,
ToSIMPL = 1,
FromSIMPL = 2,
ToFromSIMPL = ToSIMPL | FromSIMPL
}
[Flags]
public enum eJoinType
{
None = 0,
Digital = 1,
Analog = 2,
Serial = 4,
DigitalAnalog = Digital | Analog,
DigitalSerial = Digital | Serial,
AnalogSerial = Analog | Serial,
DigitalAnalogSerial = Digital | Analog | Serial
}
/// <summary>
/// Metadata describing the join
/// </summary>
public class JoinMetadata
{
private string _description;
/// <summary>
/// Join number (based on join offset value)
/// </summary>
[JsonProperty("joinNumber")]
[Obsolete]
public uint JoinNumber { get; set; }
/// <summary>
/// Join range span. If join indicates the start of a range of joins, this indicated the maximum number of joins in the range
/// </summary>
[Obsolete]
[JsonProperty("joinSpan")]
public uint JoinSpan { get; set; }
/// <summary>
/// A label for the join to better describe its usage
/// </summary>
[Obsolete("Use Description instead")]
[JsonProperty("label")]
public string Label { get { return _description; } set { _description = value; } }
/// <summary>
/// A description for the join to better describe its usage
/// </summary>
[JsonProperty("description")]
public string Description { get { return _description; } set { _description = value; } }
/// <summary>
/// Signal type(s)
/// </summary>
[JsonProperty("joinType")]
public eJoinType JoinType { get; set; }
/// <summary>
/// Indicates whether the join is read and/or write
/// </summary>
[JsonProperty("joinCapabilities")]
public eJoinCapabilities JoinCapabilities { get; set; }
/// <summary>
/// Indicates a set of valid values (particularly if this translates to an enum
/// </summary>
[JsonProperty("validValues")]
public string[] ValidValues { get; set; }
}
/// <summary>
/// Data describing the join. Can be
/// </summary>
public class JoinData
{
/// <summary>
/// Join number (based on join offset value)
/// </summary>
[JsonProperty("joinNumber")]
public uint JoinNumber { get; set; }
/// <summary>
/// Join range span. If join indicates the start of a range of joins, this indicated the maximum number of joins in the range
/// </summary>
[JsonProperty("joinSpan")]
public uint JoinSpan { get; set; }
}
/// <summary>
/// A class to aggregate the JoinData and JoinMetadata for a join
/// </summary>
public class JoinDataComplete
{
private uint _joinOffset;
private JoinData _data;
public JoinMetadata Metadata { get; set; }
public JoinDataComplete(JoinData data, JoinMetadata metadata)
{
_data = data;
Metadata = metadata;
}
/// <summary>
/// Sets the join offset value
/// </summary>
/// <param name="joinOffset"></param>
public void SetJoinOffset(uint joinOffset)
{
_joinOffset = joinOffset;
}
/// <summary>
/// The join number (including the offset)
/// </summary>
public uint JoinNumber
{
get { return _data.JoinNumber+ _joinOffset; }
set { _data.JoinNumber = value; }
}
public uint JoinSpan
{
get { return _data.JoinSpan; }
}
public void SetCustomJoinData(JoinData customJoinData)
{
_data = customJoinData;
}
public string GetNameAttribute(MemberInfo memberInfo)
{
var name = string.Empty;
var attribute = (JoinNameAttribute)CAttribute.GetCustomAttribute(memberInfo, typeof(JoinNameAttribute));
if (attribute == null) return name;
name = attribute.Name;
Debug.Console(2, "JoinName Attribute value: {0}", name);
return name;
}
}
[AttributeUsage(AttributeTargets.All)]
public class JoinNameAttribute : CAttribute
{
private string _Name;
public JoinNameAttribute(string name)
{
Debug.Console(2, "Setting Attribute Name: {0}", name);
_Name = name;
}
public string Name
{
get { return _Name; }
}
}
}

View File

@@ -80,7 +80,14 @@ namespace PepperDash.Essentials.Core.Lighting
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<GenericLightingJoinMap>(joinMapSerialized);
bridge.AddJoinMap(Key, joinMap);
if (bridge != null)
{
bridge.AddJoinMap(Key, joinMap);
}
else
{
Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
}
Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));

View File

@@ -209,7 +209,14 @@ namespace PepperDash.Essentials.Core.Monitoring
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<SystemMonitorJoinMap>(joinMapSerialized);
bridge.AddJoinMap(Key, joinMap);
if (bridge != null)
{
bridge.AddJoinMap(Key, joinMap);
}
else
{
Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
}
Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
Debug.Console(2, this, "Linking API starting at join: {0}", joinStart);

View File

@@ -11,7 +11,7 @@ using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.Bridges;
namespace PepperDash.Essentials.Devices.Common.Occupancy
namespace PepperDash.Essentials.Core
{
[Description("Wrapper class for CEN-ODT-C-POE")]
public class CenOdtOccupancySensorBaseController : CrestronGenericBridgeableBaseDevice, IOccupancyStatusProvider
@@ -447,7 +447,14 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<CenOdtOccupancySensorBaseJoinMap>(joinMapSerialized);
bridge.AddJoinMap(Key, joinMap);
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, occController, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));

View File

@@ -11,7 +11,7 @@ using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.Bridges;
namespace PepperDash.Essentials.Devices.Common.Occupancy
namespace PepperDash.Essentials.Core
{
[Description("Wrapper class for Single Technology GLS Occupancy Sensors")]
public class GlsOccupancySensorBaseController : CrestronGenericBridgeableBaseDevice, IOccupancyStatusProvider
@@ -55,11 +55,29 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy
}
}
public GlsOccupancySensorBaseController(string key, string name, GlsOccupancySensorBase sensor)
: base(key, name, sensor)
public GlsOccupancySensorBaseController(string key, Func<DeviceConfig, GlsOccupancySensorBase> preActivationFunc,
DeviceConfig config)
: base(key, config.Name)
{
OccSensor = sensor;
AddPreActivationAction(() =>
{
OccSensor = preActivationFunc(config);
RegisterCrestronGenericBase(OccSensor);
RegisterGlsOdtSensorBaseController(OccSensor);
});
}
public GlsOccupancySensorBaseController(string key, string name) : base(key, name) {}
protected void RegisterGlsOdtSensorBaseController(GlsOccupancySensorBase occSensor)
{
OccSensor = occSensor;
RoomIsOccupiedFeedback = new BoolFeedback(RoomIsOccupiedFeedbackFunc);
PirSensorEnabledFeedback = new BoolFeedback(() => OccSensor.PirEnabledFeedback.BoolValue);
@@ -68,15 +86,18 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy
ShortTimeoutEnabledFeedback = new BoolFeedback(() => OccSensor.ShortTimeoutEnabledFeedback.BoolValue);
PirSensitivityInVacantStateFeedback = new IntFeedback(() => OccSensor.PirSensitivityInVacantStateFeedback.UShortValue);
PirSensitivityInVacantStateFeedback =
new IntFeedback(() => OccSensor.PirSensitivityInVacantStateFeedback.UShortValue);
PirSensitivityInOccupiedStateFeedback = new IntFeedback(() => OccSensor.PirSensitivityInOccupiedStateFeedback.UShortValue);
PirSensitivityInOccupiedStateFeedback =
new IntFeedback(() => OccSensor.PirSensitivityInOccupiedStateFeedback.UShortValue);
CurrentTimeoutFeedback = new IntFeedback(() => OccSensor.CurrentTimeoutFeedback.UShortValue);
LocalTimoutFeedback = new IntFeedback(() => OccSensor.LocalTimeoutFeedback.UShortValue);
GraceOccupancyDetectedFeedback = new BoolFeedback(() => OccSensor.GraceOccupancyDetectedFeedback.BoolValue);
GraceOccupancyDetectedFeedback =
new BoolFeedback(() => OccSensor.GraceOccupancyDetectedFeedback.BoolValue);
RawOccupancyFeedback = new BoolFeedback(() => OccSensor.RawOccupancyFeedback.BoolValue);
@@ -84,9 +105,9 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy
ExternalPhotoSensorValue = new IntFeedback(() => OccSensor.ExternalPhotoSensorValueFeedback.UShortValue);
OccSensor.BaseEvent += new Crestron.SimplSharpPro.BaseEventHandler(OccSensor_BaseEvent);
OccSensor.BaseEvent += OccSensor_BaseEvent;
OccSensor.GlsOccupancySensorChange += new GlsOccupancySensorChangeEventHandler(OccSensor_GlsOccupancySensorChange);
OccSensor.GlsOccupancySensorChange += OccSensor_GlsOccupancySensorChange;
}
@@ -97,40 +118,56 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy
/// <param name="args"></param>
protected virtual void OccSensor_GlsOccupancySensorChange(GlsOccupancySensorBase device, GlsOccupancySensorChangeEventArgs args)
{
if (args.EventId == GlsOccupancySensorBase.PirEnabledFeedbackEventId)
PirSensorEnabledFeedback.FireUpdate();
else if (args.EventId == GlsOccupancySensorBase.LedFlashEnabledFeedbackEventId)
LedFlashEnabledFeedback.FireUpdate();
else if (args.EventId == GlsOccupancySensorBase.ShortTimeoutEnabledFeedbackEventId)
ShortTimeoutEnabledFeedback.FireUpdate();
else if (args.EventId == GlsOccupancySensorBase.PirSensitivityInOccupiedStateFeedbackEventId)
PirSensitivityInOccupiedStateFeedback.FireUpdate();
else if (args.EventId == GlsOccupancySensorBase.PirSensitivityInVacantStateFeedbackEventId)
PirSensitivityInVacantStateFeedback.FireUpdate();
switch (args.EventId)
{
case GlsOccupancySensorBase.PirEnabledFeedbackEventId:
PirSensorEnabledFeedback.FireUpdate();
break;
case GlsOccupancySensorBase.LedFlashEnabledFeedbackEventId:
LedFlashEnabledFeedback.FireUpdate();
break;
case GlsOccupancySensorBase.ShortTimeoutEnabledFeedbackEventId:
ShortTimeoutEnabledFeedback.FireUpdate();
break;
case GlsOccupancySensorBase.PirSensitivityInOccupiedStateFeedbackEventId:
PirSensitivityInOccupiedStateFeedback.FireUpdate();
break;
case GlsOccupancySensorBase.PirSensitivityInVacantStateFeedbackEventId:
PirSensitivityInVacantStateFeedback.FireUpdate();
break;
}
}
protected virtual void OccSensor_BaseEvent(Crestron.SimplSharpPro.GenericBase device, Crestron.SimplSharpPro.BaseEventArgs args)
{
Debug.Console(2, this, "GlsOccupancySensorChange EventId: {0}", args.EventId);
if (args.EventId == Crestron.SimplSharpPro.GeneralIO.GlsOccupancySensorBase.RoomOccupiedFeedbackEventId
|| args.EventId == Crestron.SimplSharpPro.GeneralIO.GlsOccupancySensorBase.RoomVacantFeedbackEventId)
switch (args.EventId)
{
Debug.Console(1, this, "Occupancy State: {0}", OccSensor.OccupancyDetectedFeedback.BoolValue);
RoomIsOccupiedFeedback.FireUpdate();
case Crestron.SimplSharpPro.GeneralIO.GlsOccupancySensorBase.RoomVacantFeedbackEventId:
case Crestron.SimplSharpPro.GeneralIO.GlsOccupancySensorBase.RoomOccupiedFeedbackEventId:
Debug.Console(1, this, "Occupancy State: {0}", OccSensor.OccupancyDetectedFeedback.BoolValue);
RoomIsOccupiedFeedback.FireUpdate();
break;
case GlsOccupancySensorBase.TimeoutFeedbackEventId:
CurrentTimeoutFeedback.FireUpdate();
break;
case GlsOccupancySensorBase.TimeoutLocalFeedbackEventId:
LocalTimoutFeedback.FireUpdate();
break;
case GlsOccupancySensorBase.GraceOccupancyDetectedFeedbackEventId:
GraceOccupancyDetectedFeedback.FireUpdate();
break;
case GlsOccupancySensorBase.RawOccupancyFeedbackEventId:
RawOccupancyFeedback.FireUpdate();
break;
case GlsOccupancySensorBase.InternalPhotoSensorValueFeedbackEventId:
InternalPhotoSensorValue.FireUpdate();
break;
case GlsOccupancySensorBase.ExternalPhotoSensorValueFeedbackEventId:
ExternalPhotoSensorValue.FireUpdate();
break;
}
else if (args.EventId == GlsOccupancySensorBase.TimeoutFeedbackEventId)
CurrentTimeoutFeedback.FireUpdate();
else if (args.EventId == GlsOccupancySensorBase.TimeoutLocalFeedbackEventId)
LocalTimoutFeedback.FireUpdate();
else if (args.EventId == GlsOccupancySensorBase.GraceOccupancyDetectedFeedbackEventId)
GraceOccupancyDetectedFeedback.FireUpdate();
else if (args.EventId == GlsOccupancySensorBase.RawOccupancyFeedbackEventId)
RawOccupancyFeedback.FireUpdate();
else if (args.EventId == GlsOccupancySensorBase.InternalPhotoSensorValueFeedbackEventId)
InternalPhotoSensorValue.FireUpdate();
else if (args.EventId == GlsOccupancySensorBase.ExternalPhotoSensorValueFeedbackEventId)
ExternalPhotoSensorValue.FireUpdate();
}
public void SetTestMode(bool mode)
@@ -268,7 +305,14 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<GlsOccupancySensorBaseJoinMap>(joinMapSerialized);
bridge.AddJoinMap(Key, joinMap);
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, occController, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
@@ -366,39 +410,51 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy
{
LinkOccSensorToApi(this, trilist, joinStart, joinMapKey, bridge);
}
}
public class GlsOccupancySensorBaseControllerFactory : EssentialsDeviceFactory<GlsOccupancySensorBaseController>
{
public GlsOccupancySensorBaseControllerFactory()
#region PreActivation
private static GlsOirCCn GetGlsOirCCn(DeviceConfig dc)
{
TypeNames = new List<string>() { "glsoirccn" };
}
var control = CommFactory.GetControlPropertiesConfig(dc);
var cresnetId = control.CresnetIdInt;
var branchId = control.ControlPortNumber;
var parentKey = string.IsNullOrEmpty(control.ControlPortDevKey) ? "processor" : control.ControlPortDevKey;
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory Attempting to create new GlsOccupancySensorBaseController Device");
var typeName = dc.Type.ToLower();
var key = dc.Key;
var name = dc.Name;
var comm = CommFactory.GetControlPropertiesConfig(dc);
GlsOccupancySensorBase occSensor = null;
occSensor = new GlsOirCCn(comm.CresnetIdInt, Global.ControlSystem);
if (occSensor != null)
if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase))
{
return new GlsOccupancySensorBaseController(key, name, occSensor);
Debug.Console(0, "Device {0} is a valid cresnet master - creating new GlsOirCCn", parentKey);
return new GlsOirCCn(cresnetId, Global.ControlSystem);
}
else
var cresnetBridge = DeviceManager.GetDeviceForKey(parentKey) as IHasCresnetBranches;
if (cresnetBridge != null)
{
Debug.Console(0, "ERROR: Unable to create Occupancy Sensor Device. Key: '{0}'", key);
return null;
Debug.Console(0, "Device {0} is a valid cresnet master - creating new GlsOirCCn", parentKey);
return new GlsOirCCn(cresnetId, cresnetBridge.CresnetBranches[branchId]);
}
Debug.Console(0, "Device {0} is not a valid cresnet master", parentKey);
return null;
}
#endregion
public class GlsOccupancySensorBaseControllerFactory : EssentialsDeviceFactory<GlsOccupancySensorBaseController>
{
public GlsOccupancySensorBaseControllerFactory()
{
TypeNames = new List<string>() { "glsoirccn" };
}
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory Attempting to create new GlsOccupancySensorBaseController Device");
return new GlsOccupancySensorBaseController(dc.Key, GetGlsOirCCn, dc);
}
}
}
}

View File

@@ -11,7 +11,7 @@ using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.Bridges;
namespace PepperDash.Essentials.Devices.Common.Occupancy
namespace PepperDash.Essentials.Core
{
[Description("Wrapper class for Dual Technology GLS Occupancy Sensors")]
public class GlsOdtOccupancySensorController : GlsOccupancySensorBaseController
@@ -35,26 +35,35 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy
public BoolFeedback RawOccupancyUsFeedback { get; private set; }
public GlsOdtOccupancySensorController(string key, string name, GlsOdtCCn sensor)
: base(key, name, sensor)
public GlsOdtOccupancySensorController(string key, Func<DeviceConfig, GlsOdtCCn> preActivationFunc,
DeviceConfig config)
: base(key, config.Name)
{
OccSensor = sensor;
AddPreActivationAction(() =>
{
OccSensor = preActivationFunc(config);
AndWhenVacatedFeedback = new BoolFeedback(() => OccSensor.AndWhenVacatedFeedback.BoolValue);
RegisterCrestronGenericBase(OccSensor);
OrWhenVacatedFeedback = new BoolFeedback(() => OccSensor.OrWhenVacatedFeedback.BoolValue);
RegisterGlsOdtSensorBaseController(OccSensor);
UltrasonicAEnabledFeedback = new BoolFeedback(() => OccSensor.UsAEnabledFeedback.BoolValue);
AndWhenVacatedFeedback = new BoolFeedback(() => OccSensor.AndWhenVacatedFeedback.BoolValue);
UltrasonicBEnabledFeedback = new BoolFeedback(() => OccSensor.UsBEnabledFeedback.BoolValue);
OrWhenVacatedFeedback = new BoolFeedback(() => OccSensor.OrWhenVacatedFeedback.BoolValue);
RawOccupancyPirFeedback = new BoolFeedback(() => OccSensor.RawOccupancyPirFeedback.BoolValue);
UltrasonicAEnabledFeedback = new BoolFeedback(() => OccSensor.UsAEnabledFeedback.BoolValue);
RawOccupancyUsFeedback = new BoolFeedback(() => OccSensor.RawOccupancyUsFeedback.BoolValue);
UltrasonicBEnabledFeedback = new BoolFeedback(() => OccSensor.UsBEnabledFeedback.BoolValue);
UltrasonicSensitivityInVacantStateFeedback = new IntFeedback(() => OccSensor.UsSensitivityInVacantStateFeedback.UShortValue);
RawOccupancyPirFeedback = new BoolFeedback(() => OccSensor.RawOccupancyPirFeedback.BoolValue);
UltrasonicSensitivityInOccupiedStateFeedback = new IntFeedback(() => OccSensor.UsSensitivityInOccupiedStateFeedback.UShortValue);
RawOccupancyUsFeedback = new BoolFeedback(() => OccSensor.RawOccupancyUsFeedback.BoolValue);
UltrasonicSensitivityInVacantStateFeedback = new IntFeedback(() => OccSensor.UsSensitivityInVacantStateFeedback.UShortValue);
UltrasonicSensitivityInOccupiedStateFeedback = new IntFeedback(() => OccSensor.UsSensitivityInOccupiedStateFeedback.UShortValue);
});
}
/// <summary>
@@ -160,38 +169,51 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy
{
LinkOccSensorToApi(this, trilist, joinStart, joinMapKey, bridge);
}
}
public class GlsOdtOccupancySensorControllerFactory : EssentialsDeviceFactory<GlsOdtOccupancySensorController>
{
public GlsOdtOccupancySensorControllerFactory()
#region PreActivation
private static GlsOdtCCn GetGlsOdtCCn(DeviceConfig dc)
{
TypeNames = new List<string>() { "glsodtccn" };
}
var control = CommFactory.GetControlPropertiesConfig(dc);
var cresnetId = control.CresnetIdInt;
var branchId = control.ControlPortNumber;
var parentKey = string.IsNullOrEmpty(control.ControlPortDevKey) ? "processor" : control.ControlPortDevKey;
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory Attempting to create new GlsOccupancySensorBaseController Device");
var typeName = dc.Type.ToLower();
var key = dc.Key;
var name = dc.Name;
var comm = CommFactory.GetControlPropertiesConfig(dc);
var occSensor = new GlsOdtCCn(comm.CresnetIdInt, Global.ControlSystem);
if (occSensor != null)
if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase))
{
return new GlsOdtOccupancySensorController(key, name, occSensor);
Debug.Console(0, "Device {0} is a valid cresnet master - creating new GlsOdtCCn", parentKey);
return new GlsOdtCCn(cresnetId, Global.ControlSystem);
}
else
var cresnetBridge = DeviceManager.GetDeviceForKey(parentKey) as IHasCresnetBranches;
if (cresnetBridge != null)
{
Debug.Console(0, "ERROR: Unable to create Occupancy Sensor Device. Key: '{0}'", key);
return null;
Debug.Console(0, "Device {0} is a valid cresnet master - creating new GlsOdtCCn", parentKey);
return new GlsOdtCCn(cresnetId, cresnetBridge.CresnetBranches[branchId]);
}
Debug.Console(0, "Device {0} is not a valid cresnet master", parentKey);
return null;
}
#endregion
public class GlsOdtOccupancySensorControllerFactory : EssentialsDeviceFactory<GlsOdtOccupancySensorController>
{
public GlsOdtOccupancySensorControllerFactory()
{
TypeNames = new List<string>() { "glsodtccn" };
}
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory Attempting to create new GlsOccupancySensorBaseController Device");
return new GlsOdtOccupancySensorController(dc.Key, GetGlsOdtCCn, dc);
}
}
}
}

View File

@@ -5,9 +5,9 @@ using System.Text;
using Crestron.SimplSharp;
using PepperDash.Core;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Devices.Common.Occupancy
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Core
{
/// <summary>
/// Aggregates the RoomIsOccupied feedbacks of one or more IOccupancyStatusProvider objects

View File

@@ -0,0 +1,280 @@
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.GeneralIO;
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Bridges;
using PepperDash_Essentials_Core.Bridges.JoinMaps;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.Gateways;
using Newtonsoft.Json;
using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
using PepperDash_Essentials_Core;
namespace PepperDash.Essentials.Core
{
[Description("Wrapper class for GLS Cresnet Partition Sensor")]
public class GlsPartitionSensorController : CrestronGenericBridgeableBaseDevice
{
private GlsPartCn _partitionSensor;
public StringFeedback NameFeedback { get; private set; }
public BoolFeedback EnableFeedback { get; private set; }
public BoolFeedback PartitionSensedFeedback { get; private set; }
public BoolFeedback PartitionNotSensedFeedback { get; private set; }
public IntFeedback SensitivityFeedback { get; private set; }
public bool InTestMode { get; private set; }
public bool TestEnableFeedback { get; private set; }
public bool TestPartitionSensedFeedback { get; private set; }
public int TestSensitivityFeedback { get; private set; }
public GlsPartitionSensorController(string key, Func<DeviceConfig, GlsPartCn> preActivationFunc, DeviceConfig config)
: base(key, config.Name)
{
AddPreActivationAction(() =>
{
_partitionSensor = preActivationFunc(config);
RegisterCrestronGenericBase(_partitionSensor);
NameFeedback = new StringFeedback(() => Name);
EnableFeedback = new BoolFeedback(() => _partitionSensor.EnableFeedback.BoolValue);
PartitionSensedFeedback = new BoolFeedback(() => _partitionSensor.PartitionSensedFeedback.BoolValue);
PartitionNotSensedFeedback = new BoolFeedback(() => _partitionSensor.PartitionNotSensedFeedback.BoolValue);
SensitivityFeedback = new IntFeedback(() => _partitionSensor.SensitivityFeedback.UShortValue);
if (_partitionSensor != null) _partitionSensor.BaseEvent += PartitionSensor_BaseEvent;
});
}
private void PartitionSensor_BaseEvent(GenericBase device, BaseEventArgs args)
{
Debug.Console(2, this, "EventId: {0}, Index: {1}", args.EventId, args.Index);
switch (args.EventId)
{
case (GlsPartCn.EnableFeedbackEventId):
{
EnableFeedback.FireUpdate();
break;
}
case (GlsPartCn.PartitionSensedFeedbackEventId):
{
PartitionSensedFeedback.FireUpdate();
break;
}
case (GlsPartCn.PartitionNotSensedFeedbackEventId):
{
PartitionNotSensedFeedback.FireUpdate();
break;
}
case (GlsPartCn.SensitivityFeedbackEventId):
{
SensitivityFeedback.FireUpdate();
break;
}
default:
{
Debug.Console(2, this, "Unhandled args.EventId: {0}", args.EventId);
break;
}
}
}
public void SetTestMode(bool mode)
{
InTestMode = mode;
Debug.Console(1, this, "InTestMode: {0}", InTestMode.ToString());
}
public void SetTestEnableState(bool state)
{
if (InTestMode)
{
TestEnableFeedback = state;
Debug.Console(1, this, "TestEnableFeedback: {0}", TestEnableFeedback.ToString());
return;
}
Debug.Console(1, this, "InTestMode: {0}, unable to set enable state: {1}", InTestMode.ToString(), state.ToString());
}
public void SetTestPartitionSensedState(bool state)
{
if (InTestMode)
{
TestPartitionSensedFeedback = state;
Debug.Console(1, this, "TestPartitionSensedFeedback: {0}", TestPartitionSensedFeedback.ToString());
return;
}
Debug.Console(1, this, "InTestMode: {0}, unable to set partition state: {1}", InTestMode.ToString(), state.ToString());
}
public void SetTestSensitivityValue(int value)
{
if (InTestMode)
{
TestSensitivityFeedback = value;
Debug.Console(1, this, "TestSensitivityFeedback: {0}", TestSensitivityFeedback);
return;
}
Debug.Console(1, this, "InTestMode: {0}, unable to set sensitivity value: {1}", InTestMode.ToString(), value);
}
public void SetEnableState(bool state)
{
if (_partitionSensor == null)
return;
_partitionSensor.Enable.BoolValue = state;
}
public void IncreaseSensitivity()
{
if (_partitionSensor == null)
return;
_partitionSensor.IncreaseSensitivity();
}
public void DecreaseSensitivity()
{
if (_partitionSensor == null)
return;
_partitionSensor.DecreaseSensitivity();
}
public void SetSensitivity(ushort value)
{
if (_partitionSensor == null)
return;
_partitionSensor.Sensitivity.UShortValue = value;
}
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{
var joinMap = new GlsPartitionSensorJoinMap(joinStart);
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<GlsPartitionSensorJoinMap>(joinMapSerialized);
if (bridge != null)
{
bridge.AddJoinMap(Key, joinMap);
}
else
{
Debug.Console(0, this, "Please update config to use 'type': 'EiscApiAdvanced' to get all join map features for this device");
}
Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
Debug.Console(0, this, "Linking to Bridge Type {0}", GetType().Name);
// link input from simpl
trilist.SetSigTrueAction(joinMap.Enable.JoinNumber, () => SetEnableState(true));
trilist.SetSigFalseAction(joinMap.Enable.JoinNumber, () => SetEnableState(false));
trilist.SetSigTrueAction(joinMap.IncreaseSensitivity.JoinNumber, IncreaseSensitivity);
trilist.SetSigTrueAction(joinMap.DecreaseSensitivity.JoinNumber, DecreaseSensitivity);
trilist.SetUShortSigAction(joinMap.Sensitivity.JoinNumber, SetSensitivity);
// link output to simpl
IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]);
EnableFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Enable.JoinNumber]);
PartitionSensedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PartitionSensed.JoinNumber]);
PartitionNotSensedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PartitionNotSensed.JoinNumber]);
SensitivityFeedback.LinkInputSig(trilist.UShortInput[joinMap.Sensitivity.JoinNumber]);
FeedbacksFireUpdates();
// update when device is online
_partitionSensor.OnlineStatusChange += (o, a) =>
{
if (a.DeviceOnLine)
{
FeedbacksFireUpdates();
}
};
// update when trilist is online
trilist.OnlineStatusChange += (o, a) =>
{
if (a.DeviceOnLine)
{
FeedbacksFireUpdates();
}
};
}
private void FeedbacksFireUpdates()
{
IsOnline.FireUpdate();
NameFeedback.FireUpdate();
EnableFeedback.FireUpdate();
PartitionSensedFeedback.FireUpdate();
PartitionNotSensedFeedback.FireUpdate();
SensitivityFeedback.FireUpdate();
}
#region PreActivation
private static GlsPartCn GetGlsPartCnDevice(DeviceConfig dc)
{
var control = CommFactory.GetControlPropertiesConfig(dc);
var cresnetId = control.CresnetIdInt;
var branchId = control.ControlPortNumber;
var parentKey = string.IsNullOrEmpty(control.ControlPortDevKey) ? "processor" : control.ControlPortDevKey;
if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase))
{
Debug.Console(0, "Device {0} is a valid cresnet master - creating new GlsPartCn", parentKey);
return new GlsPartCn(cresnetId, Global.ControlSystem);
}
var cresnetBridge = DeviceManager.GetDeviceForKey(parentKey) as IHasCresnetBranches;
if (cresnetBridge != null)
{
Debug.Console(0, "Device {0} is a valid cresnet master - creating new GlsPartCn", parentKey);
return new GlsPartCn(cresnetId, cresnetBridge.CresnetBranches[branchId]);
}
Debug.Console(0, "Device {0} is not a valid cresnet master", parentKey);
return null;
}
#endregion
public class GlsPartitionSensorControllerFactory : EssentialsDeviceFactory<GlsPartitionSensorController>
{
public GlsPartitionSensorControllerFactory()
{
TypeNames = new List<string>() { "glspartcn" };
}
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory Attempting to create new C2N-RTHS Device");
return new GlsPartitionSensorController(dc.Key, GetGlsPartCnDevice, dc);
}
}
}
}

View File

@@ -64,7 +64,7 @@
</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>
<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>
@@ -74,6 +74,10 @@
<SpecificVersion>False</SpecificVersion>
<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>
</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>
@@ -133,6 +137,7 @@
<Compile Include="Bridges\JoinMaps\GenericLightingJoinMap.cs" />
<Compile Include="Bridges\JoinMaps\GenericRelayControllerJoinMap.cs" />
<Compile Include="Bridges\JoinMaps\GlsOccupancySensorBaseJoinMap.cs" />
<Compile Include="Bridges\JoinMaps\GlsPartitionSensorJoinMap.cs" />
<Compile Include="Bridges\JoinMaps\HdMdNxM4kEControllerJoinMap.cs" />
<Compile Include="Bridges\JoinMaps\HdMdxxxCEControllerJoinMap.cs" />
<Compile Include="Bridges\JoinMaps\Hrxxx0WirelessRemoteControllerJoinMap.cs" />
@@ -156,6 +161,19 @@
<Compile Include="Config\Essentials\EssentialsConfig.cs" />
<Compile Include="Config\SourceDevicePropertiesConfigBase.cs" />
<Compile Include="Crestron IO\C2nRts\C2nRthsController.cs" />
<Compile Include="Crestron IO\Cards\C3CardControllerBase.cs" />
<Compile Include="Crestron IO\Cards\C3Com3Controller.cs" />
<Compile Include="Crestron IO\Cards\C3Io16Controller.cs" />
<Compile Include="Crestron IO\Cards\C3Ir8Controller.cs" />
<Compile Include="Crestron IO\Cards\C3Ry16Controller.cs" />
<Compile Include="Crestron IO\Cards\C3Ry8Controller.cs" />
<Compile Include="Crestron IO\Cards\CenCi31Controller.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Crestron IO\Cards\CenCi33Controller.cs" />
<Compile Include="Crestron IO\Cards\InternalCardCageController.cs" />
<Compile Include="Crestron IO\DinCenCn\DinCenCnController.cs" />
<Compile Include="Crestron IO\DinCenCn\IHasCresnetBranches.cs" />
<Compile Include="Crestron IO\Inputs\CenIoDigIn104Controller.cs" />
<Compile Include="Crestron IO\Inputs\GenericDigitalInputDevice.cs" />
<Compile Include="Crestron IO\Inputs\GenericVersiportInputDevice.cs" />
@@ -177,6 +195,7 @@
<Compile Include="Devices\VolumeDeviceChangeEventArgs.cs" />
<Compile Include="Factory\DeviceFactory.cs" />
<Compile Include="Factory\IDeviceFactory.cs" />
<Compile Include="Factory\ReadyEventArgs.cs" />
<Compile Include="Feedbacks\BoolFeedback.cs" />
<Compile Include="Feedbacks\FeedbackCollection.cs" />
<Compile Include="Feedbacks\FeedbackEventArgs.cs" />
@@ -198,6 +217,11 @@
<Compile Include="Monitoring\SystemMonitorController.cs" />
<Compile Include="Microphone Privacy\MicrophonePrivacyController.cs" />
<Compile Include="Microphone Privacy\MicrophonePrivacyControllerConfig.cs" />
<Compile Include="Occupancy\CenOdtOccupancySensorBaseController.cs" />
<Compile Include="Occupancy\GlsOccupancySensorBaseController.cs" />
<Compile Include="Occupancy\GlsOdtOccupancySensorController.cs" />
<Compile Include="Occupancy\IOccupancyStatusProviderAggregator.cs" />
<Compile Include="PartitionSensor\GlsPartitionSensorController.cs" />
<Compile Include="Plugins\PluginLoader.cs" />
<Compile Include="Presets\PresetBase.cs" />
<Compile Include="Plugins\IPluginDeviceFactory.cs" />

View File

@@ -21,30 +21,70 @@ namespace PepperDash.Essentials.Core
[Description("Wrapper class for all HR-Series remotes")]
public class Hrxx0WirelessRemoteController : EssentialsBridgeableDevice, IHasFeedback
{
private CenRfgwController _gateway;
private Hr1x0WirelessRemoteBase _remote;
public FeedbackCollection<Feedback> Feedbacks { get; set; }
public CrestronCollection<Button> Buttons { get { return _remote.Button; } }
private DeviceConfig _config;
public Hrxx0WirelessRemoteController(string key, Func<DeviceConfig, Hr1x0WirelessRemoteBase> preActivationFunc,
DeviceConfig config)
: base(key, config.Name)
{
Feedbacks = new FeedbackCollection<Feedback>();
AddPreActivationAction(() =>
var props = JsonConvert.DeserializeObject<CrestronRemotePropertiesConfig>(config.Properties.ToString());
var type = config.Type;
var rfId = (uint)props.Control.InfinetIdInt;
_config = config;
GatewayBase gateway;
if (props.GatewayDeviceKey == "processor")
{
_remote = preActivationFunc(config);
gateway = Global.ControlSystem.ControllerRFGatewayDevice;
}
_remote.ButtonStateChange += new ButtonEventHandler(_remote_ButtonStateChange);
else
{
var gatewayDev = DeviceManager.GetDeviceForKey(props.GatewayDeviceKey) as CenRfgwController;
if (gatewayDev == null)
{
Debug.Console(0, "GetHr1x0WirelessRemote: Device '{0}' is not a valid device", props.GatewayDeviceKey);
}
if (gatewayDev != null)
{
Debug.Console(0, "GetHr1x0WirelessRemote: Device '{0}' is a valid device", props.GatewayDeviceKey);
gateway = gatewayDev.GateWay;
_gateway = gatewayDev;
}
}
Feedbacks.Add(new BoolFeedback("BatteryCritical", () => _remote.BatteryCriticalFeedback.BoolValue));
Feedbacks.Add(new BoolFeedback("BatteryLow", () => _remote.BatteryLowFeedback.BoolValue));
Feedbacks.Add(new IntFeedback("BatteryVoltage", () => _remote.BatteryVoltageFeedback.UShortValue));
if (_gateway == null) return;
_remote.BaseEvent += new BaseEventHandler(_remote_BaseEvent);
});
_gateway.IsReadyEvent += _gateway_IsReadyEvent;
if (_gateway.IsReady)
{
AddPreActivationAction(() =>
{
_remote = preActivationFunc(config);
RegisterEvents();
});
}
}
void _gateway_IsReadyEvent(object sender, PepperDash_Essentials_Core.IsReadyEventArgs e)
{
if (e.IsReady != true) return;
_remote = GetHr1x0WirelessRemote(_config);
RegisterEvents();
}
void _remote_BaseEvent(GenericBase device, BaseEventArgs args)
@@ -57,6 +97,17 @@ namespace PepperDash.Essentials.Core
Feedbacks["BatteryVoltage"].FireUpdate();
}
private void RegisterEvents()
{
_remote.ButtonStateChange += _remote_ButtonStateChange;
Feedbacks.Add(new BoolFeedback("BatteryCritical", () => _remote.BatteryCriticalFeedback.BoolValue));
Feedbacks.Add(new BoolFeedback("BatteryLow", () => _remote.BatteryLowFeedback.BoolValue));
Feedbacks.Add(new IntFeedback("BatteryVoltage", () => _remote.BatteryVoltageFeedback.UShortValue));
_remote.BaseEvent += _remote_BaseEvent;
}
void _remote_ButtonStateChange(GenericBase device, ButtonEventArgs args)
{
try
@@ -112,22 +163,29 @@ namespace PepperDash.Essentials.Core
return null;
}
Hr1x0WirelessRemoteBase remoteBase;
switch (type)
{
case ("hr100"):
return new Hr100(rfId, gateway);
remoteBase = new Hr100(rfId, gateway);
break;
case ("hr150"):
return new Hr150(rfId, gateway);
remoteBase = new Hr150(rfId, gateway);
break;
case ("hr310"):
return new Hr310(rfId, gateway);
remoteBase = new Hr310(rfId, gateway);
break;
default:
return null;
}
}
static void gateway_BaseEvent(GenericBase device, BaseEventArgs args)
{
throw new NotImplementedException();
// register the device when using an internal RF gateway
if (props.GatewayDeviceKey == "processor")
{
remoteBase.RegisterWithLogging(config.Key);
}
return remoteBase;
}
#endregion
@@ -158,7 +216,14 @@ namespace PepperDash.Essentials.Core
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<Hrxxx0WirelessRemoteControllerJoinMap>(joinMapSerialized);
bridge.AddJoinMap(Key, joinMap);
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.");
}
//List<string> ExcludedKeys = new List<string>();
foreach (var feedback in Feedbacks)
@@ -242,4 +307,4 @@ namespace PepperDash.Essentials.Core
trilist.BooleanInput[join].BoolValue = b;
}
}
}
}

View File

@@ -114,7 +114,14 @@ namespace PepperDash.Essentials.DM.AirMedia
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<AirMediaControllerJoinMap>(joinMapSerialized);
bridge.AddJoinMap(Key, joinMap);
if (bridge != null)
{
bridge.AddJoinMap(Key, joinMap);
}
else
{
Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
}
Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
Debug.Console(0, "Linking to Airmedia: {0}", Name);

View File

@@ -590,7 +590,14 @@ namespace PepperDash.Essentials.DM {
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<DmBladeChassisControllerJoinMap>(joinMapSerialized);
bridge.AddJoinMap(Key, joinMap);
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"));
@@ -609,7 +616,7 @@ namespace PepperDash.Essentials.DM {
{
Debug.Console(2, "Creating Tx Feedbacks {0}", ioSlot);
var txKey = TxDictionary[ioSlot];
var basicTxDevice = DeviceManager.GetDeviceForKey(txKey) as DmTxControllerBase;
var basicTxDevice = DeviceManager.GetDeviceForKey(txKey) as BasicDmTxControllerBase;
var advancedTxDevice = basicTxDevice as DmTxControllerBase;

View File

@@ -111,7 +111,14 @@ namespace PepperDash.Essentials.DM
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<DmpsAudioOutputControllerJoinMap>(joinMapSerialized);
bridge.AddJoinMap(Key, joinMap);
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"));

View File

@@ -163,7 +163,14 @@ namespace PepperDash.Essentials.DM
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<DmpsRoutingControllerJoinMap>(joinMapSerialized);
bridge.AddJoinMap(Key, joinMap);
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"));

View File

@@ -262,7 +262,14 @@ namespace PepperDash.Essentials.DM.Chassis
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<HdMdNxM4kEControllerJoinMap>(joinMapSerialized);
bridge.AddJoinMap(Key, joinMap);
if (bridge != null)
{
bridge.AddJoinMap(Key, joinMap);
}
else
{
Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
}
IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]);
DeviceNameFeedback[this.Name].LinkInputSig(trilist.StringInput[joinMap.Name.JoinNumber]);

View File

@@ -4,14 +4,16 @@ using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro.DM;
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.DM.Config;
namespace PepperDash.Essentials.DM.Chassis
{
public class HdMdNxM4kEController : Device, IRoutingInputsOutputs, IRouting
public class HdMdNxM4kEController : CrestronGenericBaseDevice, IRoutingInputsOutputs, IRouting
{
public HdMdNxM Chassis { get; private set; }
@@ -27,7 +29,7 @@ namespace PepperDash.Essentials.DM.Chassis
/// <param name="chassis"></param>
public HdMdNxM4kEController(string key, string name, HdMdNxM chassis,
HdMdNxM4kEPropertiesConfig props)
: base(key, name)
: base(key, name, chassis)
{
Chassis = chassis;
@@ -99,6 +101,8 @@ namespace PepperDash.Essentials.DM.Chassis
/// <param name="type"></param>
/// <param name="properties"></param>
/// <returns></returns>
/// /*
/*
public static HdMdNxM4kEController GetController(string key, string name,
string type, HdMdNxM4kEPropertiesConfig properties)
{
@@ -123,6 +127,35 @@ namespace PepperDash.Essentials.DM.Chassis
Debug.Console(0, "ERROR Creating device key {0}: \r{1}", key, e);
return null;
}
}*/
#region Factory
public class HdMdNxM4kEFactory : EssentialsDeviceFactory<HdMdNxM4kEController>
{
public HdMdNxM4kEFactory()
{
TypeNames = new List<string>() {"hdmd4x14ke"};
}
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory Attempting to create new HD-MD-NxM-4K-E Device");
var props = JsonConvert.DeserializeObject<HdMdNxM4kEPropertiesConfig>(dc.Properties.ToString());
var type = dc.Type.ToLower();
var control = props.Control;
var ipid = control.IpIdInt;
var address = control.TcpSshProperties.Address;
return new HdMdNxM4kEController(dc.Key, dc.Name, new HdMd4x14kE(ipid, address, Global.ControlSystem), props);
}
}
#endregion
}
}

View File

@@ -230,7 +230,14 @@ namespace PepperDash.Essentials.DM
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<HdMdxxxCEControllerJoinMap>(joinMapSerialized);
bridge.AddJoinMap(Key, joinMap);
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"));

View File

@@ -42,7 +42,14 @@ namespace PepperDash.Essentials.DM
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<DmRmcControllerJoinMap>(joinMapSerialized);
bridge.AddJoinMap(Key, joinMap);
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, rmc, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));

View File

@@ -28,7 +28,7 @@ namespace PepperDash.Essentials.DM
public override StringFeedback ActiveVideoInputFeedback { get; protected set; }
public IntFeedback VideoSourceNumericFeedback { get; protected set; }
public IntFeedback AudioSourceNumericFeedback { get; protected set; }
public IntFeedback HdmiInHdcpCapabilityFeedback { get; protected set; }
public IntFeedback HdmiInHdcpCapabilityFeedback { get; protected set; } //actually state
public BoolFeedback HdmiVideoSyncFeedback { get; protected set; }
public BoolFeedback VgaVideoSyncFeedback { get; protected set; }
@@ -105,7 +105,10 @@ namespace PepperDash.Essentials.DM
VideoSourceNumericFeedback = new IntFeedback(() => (int)Tx.VideoSourceFeedback);
AudioSourceNumericFeedback = new IntFeedback(() => (int)Tx.AudioSourceFeedback);
HdmiInHdcpCapabilityFeedback = new IntFeedback("HdmiInHdcpCapability", () => tx.HdmiInput.HdcpSupportOnFeedback.BoolValue ? 1 : 0);
HdmiInHdcpCapabilityFeedback = new IntFeedback("HdmiInHdcpCapability", () => tx.HdmiInput.HdcpSupportOnFeedback.BoolValue ? 1 : 0);
//setting this on the base class so that we can get it easily on the chassis.
HdcpStateFeedback = HdmiInHdcpCapabilityFeedback;
HdcpSupportCapability = eHdcpCapabilityType.HdcpAutoSupport;

View File

@@ -111,7 +111,9 @@ namespace PepperDash.Essentials.DM
AudioSourceNumericFeedback = new IntFeedback(() => (int)Tx.AudioSourceFeedback);
HdmiInHdcpCapabilityFeedback = new IntFeedback("HdmiInHdcpCapability", () =>
(tx.HdmiInput.HdcpSupportOnFeedback.BoolValue ? 1 : 0));
(tx.HdmiInput.HdcpSupportOnFeedback.BoolValue ? 1 : 0));
HdcpStateFeedback = HdmiInHdcpCapabilityFeedback;
HdmiVideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInput.SyncDetectedFeedback.BoolValue);

View File

@@ -113,6 +113,8 @@ namespace PepperDash.Essentials.DM
HdmiInHdcpCapabilityFeedback = new IntFeedback("HdmiInHdcpCapability", () =>
(tx.HdmiInput.HdcpSupportOnFeedback.BoolValue ? 1 : 0));
HdcpStateFeedback = HdmiInHdcpCapabilityFeedback;
HdmiVideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInput.SyncDetectedFeedback.BoolValue);
VgaVideoSyncFeedback = new BoolFeedback(() => (bool)tx.VgaInput.SyncDetectedFeedback.BoolValue);

View File

@@ -129,7 +129,9 @@ namespace PepperDash.Essentials.DM
AudioSourceNumericFeedback = new IntFeedback(() => (int)Tx.AudioSourceFeedback);
HdmiInHdcpCapabilityFeedback = new IntFeedback("HdmiInHdcpCapability", () => tx.HdmiInput.HdcpSupportOnFeedback.BoolValue ? 1 : 0);
HdmiInHdcpCapabilityFeedback = new IntFeedback("HdmiInHdcpCapability", () => tx.HdmiInput.HdcpSupportOnFeedback.BoolValue ? 1 : 0);
HdcpStateFeedback = HdmiInHdcpCapabilityFeedback;
HdcpSupportCapability = eHdcpCapabilityType.HdcpAutoSupport;

View File

@@ -3,16 +3,16 @@
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.DM;
using Crestron.SimplSharpPro.DM.Endpoints.Transmitters;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Bridges;
namespace PepperDash.Essentials.DM
{
using eVst = eX02VideoSourceType;
using eAst = eX02AudioSourceType;
[Description("Wrapper class for DM-TX-4K-100-C-1G")]
public class DmTx4k100Controller : DmTxControllerBase, IRoutingInputsOutputs,
using eAst = eX02AudioSourceType;
public class DmTx4k100Controller : BasicDmTxControllerBase, IRoutingInputsOutputs,
IIROutputPorts, IComPorts, ICec
{
public DmTx4K100C1G Tx { get; private set; }
@@ -68,14 +68,13 @@ namespace PepperDash.Essentials.DM
// Set Ports for CEC
HdmiIn.Port = Tx;
}
PreventRegistration = true;
}
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{
DmTxControllerJoinMap joinMap = GetDmTxJoinMap(joinStart, joinMapKey);
LinkDmTxToApi(this, trilist, joinMap, bridge);
Debug.Console(1, this, "No properties to link. Skipping device {0}", Name);
}
#region IIROutputPorts Members
@@ -91,7 +90,5 @@ namespace PepperDash.Essentials.DM
#region ICec Members
public Cec StreamCec { get { return Tx.StreamCec; } }
#endregion
public override StringFeedback ActiveVideoInputFeedback { get; protected set; }
}
}

View File

@@ -110,6 +110,13 @@ namespace PepperDash.Essentials.DM
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);
@@ -276,12 +283,11 @@ namespace PepperDash.Essentials.DM
switch (args.EventId)
{
case EndpointInputStreamEventIds.HdcpSupportOffFeedbackEventId:
if (inputStream == Tx.HdmiInputs[1]) HdmiIn1HdcpCapabilityFeedback.FireUpdate();
if (inputStream == Tx.HdmiInputs[2]) HdmiIn2HdcpCapabilityFeedback.FireUpdate();
break;
case EndpointInputStreamEventIds.HdcpSupportOnFeedbackEventId:
case EndpointInputStreamEventIds.HdcpCapabilityFeedbackEventId:
if (inputStream == Tx.HdmiInputs[1]) HdmiIn1HdcpCapabilityFeedback.FireUpdate();
if (inputStream == Tx.HdmiInputs[2]) HdmiIn2HdcpCapabilityFeedback.FireUpdate();
HdcpStateFeedback.FireUpdate();
break;
case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId:
if (inputStream == Tx.HdmiInputs[1]) Hdmi1VideoSyncFeedback.FireUpdate();

View File

@@ -115,7 +115,14 @@ namespace PepperDash.Essentials.DM
HdmiIn1HdcpCapabilityFeedback = new IntFeedback("HdmiIn1HdcpCapability", () => (int)tx.HdmiInputs[1].HdcpCapabilityFeedback);
HdmiIn2HdcpCapabilityFeedback = new IntFeedback("HdmiIn2HdcpCapability", () => (int)tx.HdmiInputs[2].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;
@@ -368,12 +375,11 @@ namespace PepperDash.Essentials.DM
switch (args.EventId)
{
case EndpointInputStreamEventIds.HdcpSupportOffFeedbackEventId:
if (inputStream == Tx.HdmiInputs[1]) HdmiIn1HdcpCapabilityFeedback.FireUpdate();
if (inputStream == Tx.HdmiInputs[2]) HdmiIn2HdcpCapabilityFeedback.FireUpdate();
break;
case EndpointInputStreamEventIds.HdcpSupportOnFeedbackEventId:
case EndpointInputStreamEventIds.HdcpCapabilityFeedbackEventId:
if (inputStream == Tx.HdmiInputs[1]) HdmiIn1HdcpCapabilityFeedback.FireUpdate();
if (inputStream == Tx.HdmiInputs[2]) HdmiIn2HdcpCapabilityFeedback.FireUpdate();
HdcpStateFeedback.FireUpdate();
break;
case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId:
if (inputStream == Tx.HdmiInputs[1]) Hdmi1VideoSyncFeedback.FireUpdate();

View File

@@ -22,267 +22,63 @@ namespace PepperDash.Essentials.DM
/// Controller class for all DM-TX-201C/S/F transmitters
/// </summary>
[Description("Wrapper class for DM-TX-4K-Z-100-C")]
public class DmTx4kz100Controller : DmTxControllerBase, IRoutingInputsOutputs, IHasFeedback,
public class DmTx4kz100Controller : BasicDmTxControllerBase, IRoutingInputsOutputs, IHasFeedback,
IIROutputPorts, IComPorts, ICec
{
public DmTx4kz100C1G Tx { get; private set; }
public RoutingInputPortWithVideoStatuses HdmiInput { get; private set; }
public RoutingOutputPort DmOutput { get; private set; }
public override StringFeedback ActiveVideoInputFeedback { get; protected set; }
public IntFeedback HdmiInHdcpCapabilityFeedback { get; protected set; }
public BoolFeedback HdmiVideoSyncFeedback { get; protected set; }
public RoutingInputPort HdmiIn { get; private set; }
public RoutingOutputPort DmOut { get; private set; }
/// <summary>
/// Helps get the "real" inputs, including when in Auto
/// </summary>
public DmTx200Base.eSourceSelection ActualActiveVideoInput
public eX02VideoSourceType ActualActiveVideoInput
{
get
{
if (Tx.VideoSourceFeedback == DmTx200Base.eSourceSelection.Digital ||
Tx.VideoSourceFeedback == DmTx200Base.eSourceSelection.Analog ||
Tx.VideoSourceFeedback == DmTx200Base.eSourceSelection.Disable)
return Tx.VideoSourceFeedback;
else // auto
{
if (Tx.HdmiInput.SyncDetectedFeedback.BoolValue)
return DmTx200Base.eSourceSelection.Digital;
else if (Tx.VgaInput.SyncDetectedFeedback.BoolValue)
return DmTx200Base.eSourceSelection.Analog;
else
return DmTx200Base.eSourceSelection.Disable;
return eX02VideoSourceType.Hdmi1;
}
}
}
public RoutingPortCollection<RoutingInputPort> InputPorts
{
get
{
return new RoutingPortCollection<RoutingInputPort>
{
HdmiInput
};
return new RoutingPortCollection<RoutingInputPort>
{
HdmiIn
};
}
}
public RoutingPortCollection<RoutingOutputPort> OutputPorts
{
get
{
return new RoutingPortCollection<RoutingOutputPort> { DmOutput };
return new RoutingPortCollection<RoutingOutputPort> { DmOut };
}
}
/// <summary>
///
/// </summary>
/// <param name="key"></param>
/// <param name="name"></param>
/// <param name="tx"></param>
public DmTx4kz100Controller(string key, string name, DmTx4kz100C1G tx)
: base(key, name, tx)
{
Tx = tx;
HdmiInput = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn,
eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, DmTx200Base.eSourceSelection.Digital, this,
VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInput));
HdmiIn = new RoutingInputPort(DmPortName.HdmiIn1,
eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eX02VideoSourceType.Hdmi1, this);
ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput",
() => ActualActiveVideoInput.ToString());
Tx.HdmiInput.InputStreamChange += InputStreamChangeEvent;
Tx.BaseEvent += Tx_BaseEvent;
Tx.OnlineStatusChange += Tx_OnlineStatusChange;
HdmiInHdcpCapabilityFeedback = new IntFeedback("HdmiInHdcpCapability", () =>
{
if (tx.HdmiInput.HdcpSupportOnFeedback.BoolValue)
return 1;
else
return 0;
});
HdcpSupportCapability = eHdcpCapabilityType.HdcpAutoSupport;
HdmiVideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInput.SyncDetectedFeedback.BoolValue);
var combinedFuncs = new VideoStatusFuncsWrapper
{
HdcpActiveFeedbackFunc = () =>
(ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital
&& tx.HdmiInput.VideoAttributes.HdcpActiveFeedback.BoolValue),
HdcpStateFeedbackFunc = () => ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital ? tx.HdmiInput.VideoAttributes.HdcpStateFeedback.ToString() : "",
VideoResolutionFeedbackFunc = () =>
{
if (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital)
return tx.HdmiInput.VideoAttributes.GetVideoResolutionString();
return ActualActiveVideoInput == DmTx200Base.eSourceSelection.Analog ? tx.VgaInput.VideoAttributes.GetVideoResolutionString() : "";
},
VideoSyncFeedbackFunc = () =>
(ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital
&& tx.HdmiInput.SyncDetectedFeedback.BoolValue)
|| (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Analog
&& tx.VgaInput.SyncDetectedFeedback.BoolValue)
|| (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Auto
&& (tx.VgaInput.SyncDetectedFeedback.BoolValue || tx.HdmiInput.SyncDetectedFeedback.BoolValue))
};
AnyVideoInput = new RoutingInputPortWithVideoStatuses(DmPortName.AnyVideoIn,
eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.None, 0, this, combinedFuncs);
DmOutput = new RoutingOutputPort(DmPortName.DmOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmCat, null, this);
AddToFeedbackList(ActiveVideoInputFeedback,
AnyVideoInput.VideoStatus.HasVideoStatusFeedback, AnyVideoInput.VideoStatus.HdcpActiveFeedback,
AnyVideoInput.VideoStatus.HdcpStateFeedback, AnyVideoInput.VideoStatus.VideoResolutionFeedback,
AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiInHdcpCapabilityFeedback, HdmiVideoSyncFeedback
);
DmOut = new RoutingOutputPort(DmPortName.DmOut, eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.DmCat, null, this);
// Set Ports for CEC
HdmiInput.Port = Tx.HdmiInput;
DmOutput.Port = Tx.DmOutput;
}
HdmiIn.Port = Tx;
void Tx_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args)
{
ActiveVideoInputFeedback.FireUpdate();
HdmiVideoSyncFeedback.FireUpdate();
}
public override bool CustomActivate()
{
Tx.HdmiInput.InputStreamChange += (o, a) => FowardInputStreamChange(HdmiInput, a.EventId);
Tx.HdmiInput.VideoAttributes.AttributeChange += (o, a) => FireVideoAttributeChange(HdmiInput, a.EventId);
// Base does register and sets up comm monitoring.
return base.CustomActivate();
PreventRegistration = true;
}
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{
var joinMap = GetDmTxJoinMap(joinStart, joinMapKey);
if (HdmiVideoSyncFeedback != null)
{
HdmiVideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input1VideoSyncStatus.JoinNumber]);
}
LinkDmTxToApi(this, trilist, joinMap, bridge);
Debug.Console(1, this, "No properties to link. Skipping device {0}", Name);
}
/// <summary>
/// Enables or disables free run
/// </summary>
/// <param name="enable"></param>
public void SetFreeRunEnabled(bool enable)
{
Tx.VgaInput.FreeRun = enable ? eDmFreeRunSetting.Enabled : eDmFreeRunSetting.Disabled;
}
/// <summary>
/// Sets the VGA brightness level
/// </summary>
/// <param name="level"></param>
public void SetVgaBrightness(ushort level)
{
Tx.VgaInput.VideoControls.Brightness.UShortValue = level;
}
/// <summary>
/// Sets the VGA contrast level
/// </summary>
/// <param name="level"></param>
public void SetVgaContrast(ushort level)
{
Tx.VgaInput.VideoControls.Contrast.UShortValue = level;
}
void Tx_BaseEvent(GenericBase device, BaseEventArgs args)
{
var id = args.EventId;
Debug.Console(2, this, "EventId {0}", args.EventId);
switch (id)
{
case EndpointTransmitterBase.VideoSourceFeedbackEventId:
Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback);
ActiveVideoInputFeedback.FireUpdate();
break;
case EndpointTransmitterBase.AudioSourceFeedbackEventId:
Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback);
break;
}
}
void InputStreamChangeEvent(EndpointInputStream inputStream, EndpointInputStreamEventArgs args)
{
Debug.Console(2, "{0} event {1} stream {2}", this.Tx.ToString(), inputStream.ToString(), args.EventId.ToString());
switch (args.EventId)
{
case EndpointInputStreamEventIds.HdcpSupportOffFeedbackEventId:
HdmiInHdcpCapabilityFeedback.FireUpdate();
break;
case EndpointInputStreamEventIds.HdcpSupportOnFeedbackEventId:
HdmiInHdcpCapabilityFeedback.FireUpdate();
break;
case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId:
HdmiVideoSyncFeedback.FireUpdate();
break;
}
}
/// <summary>
/// Relays the input stream change to the appropriate RoutingInputPort.
/// </summary>
void FowardInputStreamChange(RoutingInputPortWithVideoStatuses inputPort, int eventId)
{
if (eventId != EndpointInputStreamEventIds.SyncDetectedFeedbackEventId) return;
inputPort.VideoStatus.VideoSyncFeedback.FireUpdate();
AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate();
}
/// <summary>
/// Relays the VideoAttributes change to a RoutingInputPort
/// </summary>
void FireVideoAttributeChange(RoutingInputPortWithVideoStatuses inputPort, int eventId)
{
//// LOCATION: Crestron.SimplSharpPro.DM.VideoAttributeEventIds
//Debug.Console(2, this, "VideoAttributes_AttributeChange event id={0} from {1}",
// args.EventId, (sender as VideoAttributesEnhanced).Owner.GetType());
switch (eventId)
{
case VideoAttributeEventIds.HdcpActiveFeedbackEventId:
inputPort.VideoStatus.HdcpActiveFeedback.FireUpdate();
AnyVideoInput.VideoStatus.HdcpActiveFeedback.FireUpdate();
break;
case VideoAttributeEventIds.HdcpStateFeedbackEventId:
inputPort.VideoStatus.HdcpStateFeedback.FireUpdate();
AnyVideoInput.VideoStatus.HdcpStateFeedback.FireUpdate();
break;
case VideoAttributeEventIds.HorizontalResolutionFeedbackEventId:
case VideoAttributeEventIds.VerticalResolutionFeedbackEventId:
inputPort.VideoStatus.VideoResolutionFeedback.FireUpdate();
AnyVideoInput.VideoStatus.VideoResolutionFeedback.FireUpdate();
break;
case VideoAttributeEventIds.FramesPerSecondFeedbackEventId:
inputPort.VideoStatus.VideoResolutionFeedback.FireUpdate();
AnyVideoInput.VideoStatus.VideoResolutionFeedback.FireUpdate();
break;
}
}
#region IIROutputPorts Members
public CrestronCollection<IROutputPort> IROutputPorts { get { return Tx.IROutputPorts; } }
public int NumberOfIROutputPorts { get { return Tx.NumberOfIROutputPorts; } }
@@ -294,12 +90,7 @@ namespace PepperDash.Essentials.DM
#endregion
#region ICec Members
/// <summary>
/// Gets the CEC stream directly from the HDMI port.
/// </summary>
public Cec StreamCec { get { return Tx.HdmiInput.StreamCec; } }
#endregion
#endregion
}
}

View File

@@ -99,6 +99,13 @@ namespace PepperDash.Essentials.DM
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);
@@ -265,10 +272,8 @@ namespace PepperDash.Essentials.DM
switch (args.EventId)
{
case EndpointInputStreamEventIds.HdcpSupportOffFeedbackEventId:
if (inputStream == Tx.HdmiInputs[1]) HdmiIn1HdcpCapabilityFeedback.FireUpdate();
if (inputStream == Tx.HdmiInputs[2]) HdmiIn2HdcpCapabilityFeedback.FireUpdate();
break;
case EndpointInputStreamEventIds.HdcpSupportOnFeedbackEventId:
case EndpointInputStreamEventIds.HdcpCapabilityFeedbackEventId:
if (inputStream == Tx.HdmiInputs[1]) HdmiIn1HdcpCapabilityFeedback.FireUpdate();
if (inputStream == Tx.HdmiInputs[2]) HdmiIn2HdcpCapabilityFeedback.FireUpdate();
break;

View File

@@ -105,6 +105,13 @@ namespace PepperDash.Essentials.DM
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);
@@ -275,12 +282,11 @@ namespace PepperDash.Essentials.DM
switch (args.EventId)
{
case EndpointInputStreamEventIds.HdcpSupportOffFeedbackEventId:
if (inputStream == Tx.HdmiInputs[1]) HdmiIn1HdcpCapabilityFeedback.FireUpdate();
if (inputStream == Tx.HdmiInputs[2]) HdmiIn2HdcpCapabilityFeedback.FireUpdate();
break;
case EndpointInputStreamEventIds.HdcpSupportOnFeedbackEventId:
case EndpointInputStreamEventIds.HdcpCapabilityFeedbackEventId:
if (inputStream == Tx.HdmiInputs[1]) HdmiIn1HdcpCapabilityFeedback.FireUpdate();
if (inputStream == Tx.HdmiInputs[2]) HdmiIn2HdcpCapabilityFeedback.FireUpdate();
HdcpStateFeedback.FireUpdate();
break;
case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId:
if (inputStream == Tx.HdmiInputs[1]) Hdmi1VideoSyncFeedback.FireUpdate();

View File

@@ -1,361 +1,374 @@
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;
using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.DM.Config;
using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.DM
{
public class DmTxHelper
{
/// <summary>
/// A factory method for various DmTxControllers
/// </summary>
/// <param name="key"></param>
/// <param name="name"></param>
/// <param name="props"></param>
/// <returns></returns>
public static DmTxControllerBase GetDmTxController(string key, string name, string typeName, DmTxPropertiesConfig props)
{
// switch on type name... later...
typeName = typeName.ToLower();
//uint ipid = Convert.ToUInt16(props.Id, 16);
var ipid = props.Control.IpIdInt;
var pKey = props.ParentDeviceKey.ToLower();
if (pKey == "processor")
{
// Catch constructor failures, mainly dues to IPID
try
{
if(typeName.StartsWith("dmtx200"))
return new DmTx200Controller(key, name, new DmTx200C2G(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx4kz100"))
return new DmTx4kz100Controller(key, name, new DmTx4kz100C1G(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx201c"))
return new DmTx201CController(key, name, new DmTx201C(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx201s"))
return new DmTx201SController(key, name, new DmTx201S(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx4k202"))
return new DmTx4k202CController(key, name, new DmTx4k202C(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx4kz202"))
return new DmTx4kz202CController(key, name, new DmTx4kz202C(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx4k302"))
return new DmTx4k302CController(key, name, new DmTx4k302C(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx4kz302"))
return new DmTx4kz302CController(key, name, new DmTx4kz302C(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx401"))
return new DmTx401CController(key, name, new DmTx401C(ipid, Global.ControlSystem));
Debug.Console(0, "{1} WARNING: Cannot create DM-TX of type: '{0}'", typeName, key);
}
catch (Exception e)
{
Debug.Console(0, "[{0}] WARNING: Cannot create DM-TX device: {1}", key, e);
}
}
else
{
var parentDev = DeviceManager.GetDeviceForKey(pKey);
if (!(parentDev is IDmSwitch))
{
Debug.Console(0, "Cannot create DM device '{0}'. '{1}' is not a DM Chassis.",
key, pKey);
return null;
}
// Get the Crestron chassis and link stuff up
var switchDev = (parentDev as IDmSwitch);
var chassis = switchDev.Chassis;
var num = props.ParentInputNumber;
if (num <= 0 || num > chassis.NumberOfInputs)
{
Debug.Console(0, "Cannot create DM device '{0}'. Input number '{1}' is out of range",
key, num);
return null;
}
else
{
var controller = (parentDev as IDmSwitch);
controller.TxDictionary.Add(num, key);
}
// Catch constructor failures, mainly dues to IPID
try
{
// Must use different constructor for CPU3 chassis types. No IPID
if (chassis is DmMd8x8Cpu3 || chassis is DmMd16x16Cpu3 ||
chassis is DmMd32x32Cpu3 || chassis is DmMd8x8Cpu3rps ||
chassis is DmMd16x16Cpu3rps || chassis is DmMd32x32Cpu3rps||
chassis is DmMd128x128 || chassis is DmMd64x64)
{
if (typeName.StartsWith("dmtx200"))
return new DmTx200Controller(key, name, new DmTx200C2G(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx201c"))
return new DmTx201CController(key, name, new DmTx201C(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx201s"))
return new DmTx201SController(key, name, new DmTx201S(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4k100"))
return new DmTx4k100Controller(key, name, new DmTx4K100C1G(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4kz100"))
return new DmTx4kz100Controller(key, name, new DmTx4kz100C1G(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4k202"))
return new DmTx4k202CController(key, name, new DmTx4k202C(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4kz202"))
return new DmTx4kz202CController(key, name, new DmTx4kz202C(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4k302"))
return new DmTx4k302CController(key, name, new DmTx4k302C(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4kz302"))
return new DmTx4kz302CController(key, name, new DmTx4kz302C(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx401"))
return new DmTx401CController(key, name, new DmTx401C(chassis.Inputs[num]));
}
else
{
if (typeName.StartsWith("dmtx200"))
return new DmTx200Controller(key, name, new DmTx200C2G(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx201c"))
return new DmTx201CController(key, name, new DmTx201C(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx201s"))
return new DmTx201SController(key, name, new DmTx201S(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4k100"))
return new DmTx4k100Controller(key, name, new DmTx4K100C1G(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4kz100"))
return new DmTx4kz100Controller(key, name, new DmTx4kz100C1G(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4k202"))
return new DmTx4k202CController(key, name, new DmTx4k202C(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4kz202"))
return new DmTx4kz202CController(key, name, new DmTx4kz202C(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4k302"))
return new DmTx4k302CController(key, name, new DmTx4k302C(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4kz302"))
return new DmTx4kz302CController(key, name, new DmTx4kz302C(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx401"))
return new DmTx401CController(key, name, new DmTx401C(ipid, chassis.Inputs[num]));
}
}
catch (Exception e)
{
Debug.Console(0, "[{0}] WARNING: Cannot create DM-TX device: {1}", key, e);
}
}
return null;
}
}
/// <summary>
///
/// </summary>
[Description("Wrapper class for all DM-TX variants")]
public abstract class DmTxControllerBase : CrestronGenericBridgeableBaseDevice
{
public virtual void SetPortHdcpCapability(eHdcpCapabilityType hdcpMode, uint port) { }
public virtual eHdcpCapabilityType HdcpSupportCapability { get; protected set; }
public abstract StringFeedback ActiveVideoInputFeedback { get; protected set; }
public RoutingInputPortWithVideoStatuses AnyVideoInput { get; protected set; }
protected DmTxControllerBase(string key, string name, EndpointTransmitterBase hardware)
: base(key, name, hardware)
{
// if wired to a chassis, skip registration step in base class
if (hardware.DMInput != null)
{
this.PreventRegistration = true;
}
AddToFeedbackList(ActiveVideoInputFeedback);
}
protected DmTxControllerBase(string key, string name, DmHDBasedTEndPoint hardware) : base(key, name, hardware)
{
}
protected DmTxControllerJoinMap GetDmTxJoinMap(uint joinStart, string joinMapKey)
{
var joinMap = new DmTxControllerJoinMap(joinStart);
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<DmTxControllerJoinMap>(joinMapSerialized);
return joinMap;
}
protected void LinkDmTxToApi(DmTxControllerBase tx, BasicTriList trilist, DmTxControllerJoinMap joinMap, EiscApiAdvanced bridge)
{
if (tx.Hardware is DmHDBasedTEndPoint)
{
Debug.Console(1, tx, "No properties to link. Skipping device {0}", tx.Name);
return;
}
Debug.Console(1, tx, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
tx.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]);
tx.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus.JoinNumber]);
tx.AnyVideoInput.VideoStatus.VideoResolutionFeedback.LinkInputSig(trilist.StringInput[joinMap.CurrentInputResolution.JoinNumber]);
trilist.UShortInput[joinMap.HdcpSupportCapability.JoinNumber].UShortValue = (ushort)tx.HdcpSupportCapability;
bool hdcpTypeSimple;
if (tx.Hardware is DmTx4kX02CBase)
hdcpTypeSimple = false;
else
hdcpTypeSimple = true;
if (tx is ITxRouting)
{
var txR = tx as ITxRouting;
trilist.SetUShortSigAction(joinMap.VideoInput.JoinNumber,
i => txR.ExecuteNumericSwitch(i, 0, eRoutingSignalType.Video));
trilist.SetUShortSigAction(joinMap.AudioInput.JoinNumber,
i => txR.ExecuteNumericSwitch(i, 0, eRoutingSignalType.Audio));
txR.VideoSourceNumericFeedback.LinkInputSig(trilist.UShortInput[joinMap.VideoInput.JoinNumber]);
txR.AudioSourceNumericFeedback.LinkInputSig(trilist.UShortInput[joinMap.AudioInput.JoinNumber]);
trilist.UShortInput[joinMap.HdcpSupportCapability.JoinNumber].UShortValue = (ushort)tx.HdcpSupportCapability;
if (txR.InputPorts[DmPortName.HdmiIn] != null)
{
var inputPort = txR.InputPorts[DmPortName.HdmiIn];
if (tx.Feedbacks["HdmiInHdcpCapability"] != null)
{
var intFeedback = tx.Feedbacks["HdmiInHdcpCapability"] as IntFeedback;
if (intFeedback != null)
intFeedback.LinkInputSig(trilist.UShortInput[joinMap.Port1HdcpState.JoinNumber]);
}
if (inputPort.ConnectionType == eRoutingPortConnectionType.Hdmi && inputPort.Port != null)
{
var port = inputPort.Port as EndpointHdmiInput;
SetHdcpCapabilityAction(hdcpTypeSimple, port, joinMap.Port1HdcpState.JoinNumber, trilist);
}
}
if (txR.InputPorts[DmPortName.HdmiIn1] != null)
{
var inputPort = txR.InputPorts[DmPortName.HdmiIn1];
if (tx.Feedbacks["HdmiIn1HdcpCapability"] != null)
{
var intFeedback = tx.Feedbacks["HdmiIn1HdcpCapability"] as IntFeedback;
if (intFeedback != null)
intFeedback.LinkInputSig(trilist.UShortInput[joinMap.Port1HdcpState.JoinNumber]);
}
if (inputPort.ConnectionType == eRoutingPortConnectionType.Hdmi && inputPort.Port != null)
{
var port = inputPort.Port as EndpointHdmiInput;
SetHdcpCapabilityAction(hdcpTypeSimple, port, joinMap.Port1HdcpState.JoinNumber, trilist);
}
}
if (txR.InputPorts[DmPortName.HdmiIn2] != null)
{
var inputPort = txR.InputPorts[DmPortName.HdmiIn2];
if (tx.Feedbacks["HdmiIn2HdcpCapability"] != null)
{
var intFeedback = tx.Feedbacks["HdmiIn2HdcpCapability"] as IntFeedback;
if (intFeedback != null)
intFeedback.LinkInputSig(trilist.UShortInput[joinMap.Port1HdcpState.JoinNumber]);
}
if (inputPort.ConnectionType == eRoutingPortConnectionType.Hdmi && inputPort.Port != null)
{
var port = inputPort.Port as EndpointHdmiInput;
SetHdcpCapabilityAction(hdcpTypeSimple, port, joinMap.Port2HdcpState.JoinNumber, trilist);
}
}
}
var txFreeRun = tx as IHasFreeRun;
if (txFreeRun != null)
{
txFreeRun.FreeRunEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.FreeRunEnabled.JoinNumber]);
trilist.SetBoolSigAction(joinMap.FreeRunEnabled.JoinNumber, txFreeRun.SetFreeRunEnabled);
}
var txVga = tx as IVgaBrightnessContrastControls;
{
if (txVga == null) return;
txVga.VgaBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.VgaBrightness.JoinNumber]);
txVga.VgaContrastFeedback.LinkInputSig(trilist.UShortInput[joinMap.VgaContrast.JoinNumber]);
trilist.SetUShortSigAction(joinMap.VgaBrightness.JoinNumber, txVga.SetVgaBrightness);
trilist.SetUShortSigAction(joinMap.VgaContrast.JoinNumber, txVga.SetVgaContrast);
}
}
private void SetHdcpCapabilityAction(bool hdcpTypeSimple, EndpointHdmiInput port, uint join, BasicTriList trilist)
{
if (hdcpTypeSimple)
{
trilist.SetUShortSigAction(join,
s =>
{
if (s == 0)
{
port.HdcpSupportOff();
}
else if (s > 0)
{
port.HdcpSupportOn();
}
});
}
else
{
trilist.SetUShortSigAction(join,
s =>
{
port.HdcpCapability = (eHdcpCapabilityType)s;
});
}
}
}
public class DmTxControllerFactory : EssentialsDeviceFactory<DmTxControllerBase>
{
public DmTxControllerFactory()
{
TypeNames = new List<string>() { "dmtx200c", "dmtx201c", "dmtx201s", "dmtx4k100c", "dmtx4k202c", "dmtx4kz202c", "dmtx4k302c", "dmtx4kz302c",
"dmtx401c", "dmtx401s", "dmtx4k100c1g", "dmtx4kz100c1g" };
}
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
var type = dc.Type.ToLower();
Debug.Console(1, "Factory Attempting to create new DM-TX Device");
var props = JsonConvert.DeserializeObject
<PepperDash.Essentials.DM.Config.DmTxPropertiesConfig>(dc.Properties.ToString());
return PepperDash.Essentials.DM.DmTxHelper.GetDmTxController(dc.Key, dc.Name, type, props);
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.DM;
using Crestron.SimplSharpPro.DM.Endpoints;
using Crestron.SimplSharpPro.DM.Endpoints.Transmitters;
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.DM.Config;
using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.DM
{
public class DmTxHelper
{
/// <summary>
/// A factory method for various DmTxControllers
/// </summary>
/// <param name="key"></param>
/// <param name="name"></param>
/// <param name="props"></param>
/// <returns></returns>
public static BasicDmTxControllerBase GetDmTxController(string key, string name, string typeName, DmTxPropertiesConfig props)
{
// switch on type name... later...
typeName = typeName.ToLower();
//uint ipid = Convert.ToUInt16(props.Id, 16);
var ipid = props.Control.IpIdInt;
var pKey = props.ParentDeviceKey.ToLower();
if (pKey == "processor")
{
// Catch constructor failures, mainly dues to IPID
try
{
if(typeName.StartsWith("dmtx200"))
return new DmTx200Controller(key, name, new DmTx200C2G(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx4kz100"))
return new DmTx4kz100Controller(key, name, new DmTx4kz100C1G(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx201c"))
return new DmTx201CController(key, name, new DmTx201C(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx201s"))
return new DmTx201SController(key, name, new DmTx201S(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx4k202"))
return new DmTx4k202CController(key, name, new DmTx4k202C(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx4kz202"))
return new DmTx4kz202CController(key, name, new DmTx4kz202C(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx4k302"))
return new DmTx4k302CController(key, name, new DmTx4k302C(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx4kz302"))
return new DmTx4kz302CController(key, name, new DmTx4kz302C(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx401"))
return new DmTx401CController(key, name, new DmTx401C(ipid, Global.ControlSystem));
Debug.Console(0, "{1} WARNING: Cannot create DM-TX of type: '{0}'", typeName, key);
}
catch (Exception e)
{
Debug.Console(0, "[{0}] WARNING: Cannot create DM-TX device: {1}", key, e);
}
}
else
{
var parentDev = DeviceManager.GetDeviceForKey(pKey);
if (!(parentDev is IDmSwitch))
{
Debug.Console(0, "Cannot create DM device '{0}'. '{1}' is not a DM Chassis.",
key, pKey);
return null;
}
// Get the Crestron chassis and link stuff up
var switchDev = (parentDev as IDmSwitch);
var chassis = switchDev.Chassis;
var num = props.ParentInputNumber;
if (num <= 0 || num > chassis.NumberOfInputs)
{
Debug.Console(0, "Cannot create DM device '{0}'. Input number '{1}' is out of range",
key, num);
return null;
}
else
{
var controller = (parentDev as IDmSwitch);
controller.TxDictionary.Add(num, key);
}
// Catch constructor failures, mainly dues to IPID
try
{
// Must use different constructor for CPU3 chassis types. No IPID
if (chassis is DmMd8x8Cpu3 || chassis is DmMd16x16Cpu3 ||
chassis is DmMd32x32Cpu3 || chassis is DmMd8x8Cpu3rps ||
chassis is DmMd16x16Cpu3rps || chassis is DmMd32x32Cpu3rps||
chassis is DmMd128x128 || chassis is DmMd64x64)
{
if (typeName.StartsWith("dmtx200"))
return new DmTx200Controller(key, name, new DmTx200C2G(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx201c"))
return new DmTx201CController(key, name, new DmTx201C(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx201s"))
return new DmTx201SController(key, name, new DmTx201S(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4k100"))
return new DmTx4k100Controller(key, name, new DmTx4K100C1G(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4kz100"))
return new DmTx4kz100Controller(key, name, new DmTx4kz100C1G(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4k202"))
return new DmTx4k202CController(key, name, new DmTx4k202C(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4kz202"))
return new DmTx4kz202CController(key, name, new DmTx4kz202C(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4k302"))
return new DmTx4k302CController(key, name, new DmTx4k302C(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4kz302"))
return new DmTx4kz302CController(key, name, new DmTx4kz302C(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx401"))
return new DmTx401CController(key, name, new DmTx401C(chassis.Inputs[num]));
}
else
{
if (typeName.StartsWith("dmtx200"))
return new DmTx200Controller(key, name, new DmTx200C2G(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx201c"))
return new DmTx201CController(key, name, new DmTx201C(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx201s"))
return new DmTx201SController(key, name, new DmTx201S(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4k100"))
return new DmTx4k100Controller(key, name, new DmTx4K100C1G(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4kz100"))
return new DmTx4kz100Controller(key, name, new DmTx4kz100C1G(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4k202"))
return new DmTx4k202CController(key, name, new DmTx4k202C(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4kz202"))
return new DmTx4kz202CController(key, name, new DmTx4kz202C(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4k302"))
return new DmTx4k302CController(key, name, new DmTx4k302C(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4kz302"))
return new DmTx4kz302CController(key, name, new DmTx4kz302C(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx401"))
return new DmTx401CController(key, name, new DmTx401C(ipid, chassis.Inputs[num]));
}
}
catch (Exception e)
{
Debug.Console(0, "[{0}] WARNING: Cannot create DM-TX device: {1}", key, e);
}
}
return null;
}
}
public abstract class BasicDmTxControllerBase : CrestronGenericBridgeableBaseDevice
{
protected BasicDmTxControllerBase(string key, string name, GenericBase hardware)
: base(key, name, hardware)
{
}
}
/// <summary>
///
/// </summary>
[Description("Wrapper class for all DM-TX variants")]
public abstract class DmTxControllerBase : BasicDmTxControllerBase
{
public virtual void SetPortHdcpCapability(eHdcpCapabilityType hdcpMode, uint port) { }
public virtual eHdcpCapabilityType HdcpSupportCapability { get; protected set; }
public abstract StringFeedback ActiveVideoInputFeedback { get; protected set; }
public RoutingInputPortWithVideoStatuses AnyVideoInput { get; protected set; }
public IntFeedback HdcpStateFeedback { get; protected set; }
protected DmTxControllerBase(string key, string name, EndpointTransmitterBase hardware)
: base(key, name, hardware)
{
// if wired to a chassis, skip registration step in base class
if (hardware.DMInput != null)
{
this.PreventRegistration = true;
}
AddToFeedbackList(ActiveVideoInputFeedback);
}
protected DmTxControllerBase(string key, string name, DmHDBasedTEndPoint hardware) : base(key, name, hardware)
{
}
protected DmTxControllerJoinMap GetDmTxJoinMap(uint joinStart, string joinMapKey)
{
var joinMap = new DmTxControllerJoinMap(joinStart);
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<DmTxControllerJoinMap>(joinMapSerialized);
return joinMap;
}
protected void LinkDmTxToApi(DmTxControllerBase tx, BasicTriList trilist, DmTxControllerJoinMap joinMap, EiscApiAdvanced bridge)
{
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, tx, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
tx.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]);
tx.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus.JoinNumber]);
tx.AnyVideoInput.VideoStatus.VideoResolutionFeedback.LinkInputSig(trilist.StringInput[joinMap.CurrentInputResolution.JoinNumber]);
trilist.UShortInput[joinMap.HdcpSupportCapability.JoinNumber].UShortValue = (ushort)tx.HdcpSupportCapability;
bool hdcpTypeSimple;
if (tx.Hardware is DmTx4kX02CBase)
hdcpTypeSimple = false;
else
hdcpTypeSimple = true;
if (tx is ITxRouting)
{
var txR = tx as ITxRouting;
trilist.SetUShortSigAction(joinMap.VideoInput.JoinNumber,
i => txR.ExecuteNumericSwitch(i, 0, eRoutingSignalType.Video));
trilist.SetUShortSigAction(joinMap.AudioInput.JoinNumber,
i => txR.ExecuteNumericSwitch(i, 0, eRoutingSignalType.Audio));
txR.VideoSourceNumericFeedback.LinkInputSig(trilist.UShortInput[joinMap.VideoInput.JoinNumber]);
txR.AudioSourceNumericFeedback.LinkInputSig(trilist.UShortInput[joinMap.AudioInput.JoinNumber]);
trilist.UShortInput[joinMap.HdcpSupportCapability.JoinNumber].UShortValue = (ushort)tx.HdcpSupportCapability;
if (txR.InputPorts[DmPortName.HdmiIn] != null)
{
var inputPort = txR.InputPorts[DmPortName.HdmiIn];
if (tx.Feedbacks["HdmiInHdcpCapability"] != null)
{
var intFeedback = tx.Feedbacks["HdmiInHdcpCapability"] as IntFeedback;
if (intFeedback != null)
intFeedback.LinkInputSig(trilist.UShortInput[joinMap.Port1HdcpState.JoinNumber]);
}
if (inputPort.ConnectionType == eRoutingPortConnectionType.Hdmi && inputPort.Port != null)
{
var port = inputPort.Port as EndpointHdmiInput;
SetHdcpCapabilityAction(hdcpTypeSimple, port, joinMap.Port1HdcpState.JoinNumber, trilist);
}
}
if (txR.InputPorts[DmPortName.HdmiIn1] != null)
{
var inputPort = txR.InputPorts[DmPortName.HdmiIn1];
if (tx.Feedbacks["HdmiIn1HdcpCapability"] != null)
{
var intFeedback = tx.Feedbacks["HdmiIn1HdcpCapability"] as IntFeedback;
if (intFeedback != null)
intFeedback.LinkInputSig(trilist.UShortInput[joinMap.Port1HdcpState.JoinNumber]);
}
if (inputPort.ConnectionType == eRoutingPortConnectionType.Hdmi && inputPort.Port != null)
{
var port = inputPort.Port as EndpointHdmiInput;
SetHdcpCapabilityAction(hdcpTypeSimple, port, joinMap.Port1HdcpState.JoinNumber, trilist);
}
}
if (txR.InputPorts[DmPortName.HdmiIn2] != null)
{
var inputPort = txR.InputPorts[DmPortName.HdmiIn2];
if (tx.Feedbacks["HdmiIn2HdcpCapability"] != null)
{
var intFeedback = tx.Feedbacks["HdmiIn2HdcpCapability"] as IntFeedback;
if (intFeedback != null)
intFeedback.LinkInputSig(trilist.UShortInput[joinMap.Port1HdcpState.JoinNumber]);
}
if (inputPort.ConnectionType == eRoutingPortConnectionType.Hdmi && inputPort.Port != null)
{
var port = inputPort.Port as EndpointHdmiInput;
SetHdcpCapabilityAction(hdcpTypeSimple, port, joinMap.Port2HdcpState.JoinNumber, trilist);
}
}
}
var txFreeRun = tx as IHasFreeRun;
if (txFreeRun != null)
{
txFreeRun.FreeRunEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.FreeRunEnabled.JoinNumber]);
trilist.SetBoolSigAction(joinMap.FreeRunEnabled.JoinNumber, txFreeRun.SetFreeRunEnabled);
}
var txVga = tx as IVgaBrightnessContrastControls;
{
if (txVga == null) return;
txVga.VgaBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.VgaBrightness.JoinNumber]);
txVga.VgaContrastFeedback.LinkInputSig(trilist.UShortInput[joinMap.VgaContrast.JoinNumber]);
trilist.SetUShortSigAction(joinMap.VgaBrightness.JoinNumber, txVga.SetVgaBrightness);
trilist.SetUShortSigAction(joinMap.VgaContrast.JoinNumber, txVga.SetVgaContrast);
}
}
private void SetHdcpCapabilityAction(bool hdcpTypeSimple, EndpointHdmiInput port, uint join, BasicTriList trilist)
{
if (hdcpTypeSimple)
{
trilist.SetUShortSigAction(join,
s =>
{
if (s == 0)
{
port.HdcpSupportOff();
}
else if (s > 0)
{
port.HdcpSupportOn();
}
});
}
else
{
trilist.SetUShortSigAction(join,
s =>
{
port.HdcpCapability = (eHdcpCapabilityType)s;
});
}
}
}
public class DmTxControllerFactory : EssentialsDeviceFactory<DmTxControllerBase>
{
public DmTxControllerFactory()
{
TypeNames = new List<string>() { "dmtx200c", "dmtx201c", "dmtx201s", "dmtx4k100c", "dmtx4k202c", "dmtx4kz202c", "dmtx4k302c", "dmtx4kz302c",
"dmtx401c", "dmtx401s", "dmtx4k100c1g", "dmtx4kz100c1g" };
}
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
var type = dc.Type.ToLower();
Debug.Console(1, "Factory Attempting to create new DM-TX Device");
var props = JsonConvert.DeserializeObject
<PepperDash.Essentials.DM.Config.DmTxPropertiesConfig>(dc.Properties.ToString());
return PepperDash.Essentials.DM.DmTxHelper.GetDmTxController(dc.Key, dc.Name, type, props);
}
}
}

View File

@@ -83,8 +83,14 @@ namespace PepperDash.Essentials.Devices.Common.Cameras
{
CameraControllerJoinMap joinMap = new CameraControllerJoinMap(joinStart);
// Adds the join map to the bridge
bridge.AddJoinMap(cameraDevice.Key, joinMap);
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.");
}
var customJoins = JoinMapHelper.TryGetJoinMapAdvancedForDevice(joinMapKey);

View File

@@ -114,8 +114,6 @@
<Compile Include="Codec\iCodecAudio.cs" />
<Compile Include="ImageProcessors\TVOneCorio.cs" />
<Compile Include="ImageProcessors\TVOneCorioPropertiesConfig.cs" />
<Compile Include="Occupancy\CenOdtOccupancySensorBaseController.cs" />
<Compile Include="Occupancy\GlsOdtOccupancySensorController.cs" />
<Compile Include="Power Controllers\Digitallogger.cs" />
<Compile Include="Power Controllers\DigitalLoggerPropertiesConfig.cs" />
<Compile Include="ImageProcessors\AnalogWay\AnalongWayLiveCore.cs" />
@@ -150,8 +148,6 @@
<Compile Include="Environment\Somfy\RelayControlledShade.cs" />
<Compile Include="Factory\DeviceFactory.cs" />
<Compile Include="Generic\GenericSource.cs" />
<Compile Include="Occupancy\GlsOccupancySensorBaseController.cs" />
<Compile Include="Occupancy\IOccupancyStatusProviderAggregator.cs" />
<Compile Include="SetTopBox\SetTopBoxPropertiesConfig.cs" />
<Compile Include="Streaming\AppleTV.cs" />
<Compile Include="Audio\GenericAudioOut.cs" />

View File

@@ -17,7 +17,7 @@ using PepperDash.Essentials.Core.CrestronIO;
using PepperDash.Essentials.Devices.Common;
using PepperDash.Essentials.Devices.Common.DSP;
using PepperDash.Essentials.Devices.Common.VideoCodec;
using PepperDash.Essentials.Devices.Common.Occupancy;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Devices.Common.Environment;
namespace PepperDash.Essentials.Devices.Common

View File

@@ -380,7 +380,14 @@ namespace PepperDash.Essentials.Devices.Common
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<SetTopBoxControllerJoinMap>(joinMapSerialized);
bridge.AddJoinMap(Key, joinMap);
if (bridge != null)
{
bridge.AddJoinMap(Key, joinMap);
}
else
{
Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
}
Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
Debug.Console(0, "Linking to Display: {0}", Name);

View File

@@ -153,7 +153,14 @@ namespace PepperDash.Essentials.Devices.Common
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<AppleTvJoinMap>(joinMapSerialized);
bridge.AddJoinMap(Key, joinMap);
if (bridge != null)
{
bridge.AddJoinMap(Key, joinMap);
}
else
{
Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
}
Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
Debug.Console(0, "Linking to Bridge Type {0}", GetType().Name);

View File

@@ -13,7 +13,7 @@ using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.Routing;
using PepperDash.Essentials.Devices.Common.Cameras;
using PepperDash.Essentials.Devices.Common.Codec;
using PepperDash.Essentials.Devices.Common.Occupancy;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Devices.Common.VideoCodec;
namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
@@ -601,9 +601,9 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
//JsonSerializerSettings settings = new JsonSerializerSettings();
//settings.NullValueHandling = NullValueHandling.Ignore;
//settings.MissingMemberHandling = MissingMemberHandling.Ignore;
//settings.ObjectCreationHandling = ObjectCreationHandling.Auto;
if (response.IndexOf("\"Status\":{") > -1)
//settings.ObjectCreationHandling = ObjectCreationHandling.Auto;
if (response.IndexOf("\"Status\":{") > -1 || response.IndexOf("\"Status\": {") > -1)
{
// Status Message
@@ -775,8 +775,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
if (!SyncState.InitialConfigurationMessageWasReceived)
SendText("xConfiguration");
}
}
else if (response.IndexOf("\"Configuration\":{") > -1)
}
else if (response.IndexOf("\"Configuration\":{") > -1 || response.IndexOf("\"Configuration\": {") > -1)
{
// Configuration Message
@@ -791,39 +791,39 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
}
}
}
else if (response.IndexOf("\"Event\":{") > -1)
{
if (response.IndexOf("\"CallDisconnect\":{") > -1)
}
else if (response.IndexOf("\"Event\":{") > -1 || response.IndexOf("\"Event\": {") > -1)
{
if (response.IndexOf("\"CallDisconnect\":{") > -1 || response.IndexOf("\"CallDisconnect\": {") > -1)
{
CiscoCodecEvents.RootObject eventReceived = new CiscoCodecEvents.RootObject();
JsonConvert.PopulateObject(response, eventReceived);
EvalutateDisconnectEvent(eventReceived);
}
else if (response.IndexOf("\"Bookings\":{") > -1) // The list has changed, reload it
}
else if (response.IndexOf("\"Bookings\":{") > -1 || response.IndexOf("\"Bookings\": {") > -1) // The list has changed, reload it
{
GetBookings(null);
}
}
else if (response.IndexOf("\"CommandResponse\":{") > -1)
}
else if (response.IndexOf("\"CommandResponse\":{") > -1 || response.IndexOf("\"CommandResponse\": {") > -1)
{
// CommandResponse Message
if (response.IndexOf("\"CallHistoryRecentsResult\":{") > -1)
// CommandResponse Message
if (response.IndexOf("\"CallHistoryRecentsResult\":{") > -1 || response.IndexOf("\"CallHistoryRecentsResult\": {") > -1)
{
var codecCallHistory = new CiscoCallHistory.RootObject();
JsonConvert.PopulateObject(response, codecCallHistory);
CallHistory.ConvertCiscoCallHistoryToGeneric(codecCallHistory.CommandResponse.CallHistoryRecentsResult.Entry);
}
else if (response.IndexOf("\"CallHistoryDeleteEntryResult\":{") > -1)
}
else if (response.IndexOf("\"CallHistoryDeleteEntryResult\":{") > -1 || response.IndexOf("\"CallHistoryDeleteEntryResult\": {") > -1)
{
GetCallHistory();
}
else if (response.IndexOf("\"PhonebookSearchResult\":{") > -1)
}
else if (response.IndexOf("\"PhonebookSearchResult\":{") > -1 || response.IndexOf("\"PhonebookSearchResult\": {") > -1)
{
var codecPhonebookResponse = new CiscoCodecPhonebook.RootObject();
@@ -1658,7 +1658,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
{
get
{
if (CodecStatus.Status.SIP.Registration.Count > 0)
if (CodecStatus.Status.SIP != null && CodecStatus.Status.SIP.Registration.Count > 0)
{
var match = Regex.Match(CodecStatus.Status.SIP.Registration[0].URI.Value, @"(\d+)"); // extract numbers only
if (match.Success)
@@ -1678,17 +1678,26 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
return string.Empty;
}
}
}
public override string SipUri
{
get
{
if (CodecStatus.Status.SIP.AlternateURI.Primary.URI.Value != null)
return CodecStatus.Status.SIP.AlternateURI.Primary.URI.Value;
else
return string.Empty;
}
}
}
public override string SipUri
{
get
{
if (CodecStatus.Status.SIP != null && CodecStatus.Status.SIP.AlternateURI.Primary.URI.Value != null)
{
return CodecStatus.Status.SIP.AlternateURI.Primary.URI.Value;
}
else if (CodecStatus.Status.UserInterface != null &&
CodecStatus.Status.UserInterface.ContactInfo.ContactMethod[0].Number.Value != null)
{
return CodecStatus.Status.UserInterface.ContactInfo.ContactMethod[0].Number.Value;
}
else
return string.Empty;
}
}
public override bool AutoAnswerEnabled
{
get

View File

@@ -13,7 +13,7 @@ using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.Routing;
using PepperDash.Essentials.Devices.Common.Cameras;
using PepperDash.Essentials.Devices.Common.Codec;
using PepperDash.Essentials.Devices.Common.Occupancy;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Devices.Common.VideoCodec;
namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom