Compare commits

..

185 Commits
1.7.0 ... 1.8.2

Author SHA1 Message Date
Andrew Welker
d3383db890 Merge pull request #666 from PepperDash/hotfix/generic-queue-disposed-check
added a Disposed check and Debug Message to prevent enqueing messages…
2021-03-29 07:55:29 -06:00
Nick Genovese
139e5370ea added a Disposed check and Debug Message to prevent enqueing messages after the Generic Queue has been disposed; typically happens at program stop 2021-03-29 09:42:31 -04:00
Andrew Welker
bdd17dfa27 Merge pull request #661 from PepperDash/hotfix/scheduler-fixes
Hotfix/scheduler fixes
2021-03-25 15:48:45 -06:00
Andrew Welker
6443e00428 update back to latest builder image 2021-03-22 09:48:23 -06:00
Andrew Welker
008279e867 Initialize some properties that were causing a nullRef 2021-03-22 09:39:08 -06:00
Andrew Welker
c4a6d20791 fixing a nullref issue with cisco spark 2021-03-22 09:23:07 -06:00
Andrew Welker
61b4002e5a Fix to test build image again 2021-03-19 09:22:21 -06:00
Andrew Welker
da63d0917e Updates to test new builder image
this build WILL fail
2021-03-19 09:03:05 -06:00
Andrew Welker
0228fd1c0f fix a ; 2021-03-18 16:27:08 -06:00
Andrew Welker
085ba134c4 Set event to not be acknowledgable
Added logic to acknowledge event
Added debug statement to show that event was being fired
2021-03-18 12:44:20 -06:00
Andrew Welker
a9fce3237c Added check for key to Clear command
If the key was wrong or wasn't in the group, a `KeyNotFoundException` was thrown.

Also added acknowledgment of a successful deletion
2021-03-18 12:43:29 -06:00
Andrew Welker
840fb21e15 Added console command to list events for a group 2021-03-18 12:42:29 -06:00
Andrew Welker
8ed236abae Merge pull request #654 from PepperDash/hotfix/namespace-issues
Fix old/wrong namespace versions to have copies of types that are in the correct one
2021-03-12 16:48:01 -07:00
Andrew Welker
4a9b1514e3 fix old/wrong namespace versions 2021-03-12 15:46:08 -07:00
Andrew Welker
9c7e38b379 Merge pull request #652 from PepperDash/hotfix/techroom-scheduler-event-update
Removes check from scheduler method that was functioning incorrectly.
2021-03-12 15:07:10 -07:00
Neil Dorin
846e905ae1 Removes check from scheduler method that was functioning incorrectly. 2021-03-12 14:18:03 -07:00
Neil Dorin
31f6a4bcfd Merge pull request #643 from PepperDash/release/1.8.0
1.8.0
2021-03-10 15:37:29 -07:00
Andrew Welker
2da8f8c9a8 Merge pull request #640 from PepperDash/feature/update-actions
Feature/update actions
2021-03-03 10:46:48 -07:00
Andrew Welker
743accd980 update actions to remove pushes to build repos 2021-03-03 10:03:42 -07:00
Neil Dorin
b445f68466 Merge pull request #638 from PepperDash/feature/add-tuner-preset-mirror-config
Feature/add tuner preset mirror config
2021-03-02 15:53:35 -07:00
Neil Dorin
847e106b8d Adds some debug statements at level 1 to help confirm joins are mapped correctly 2021-03-02 15:34:35 -07:00
Neil Dorin
57f2d7c938 #637 Updates LinkToApi method to map configured tuners 2021-03-02 15:09:24 -07:00
Neil Dorin
f0415d0d05 Adds new mirroredTuners config property and additional help comments 2021-03-02 11:57:10 -07:00
Neil Dorin
07fbe102bd Merge pull request #636 from PepperDash/feature/DMChassis-updates
Fix dmps off timer
2021-03-01 10:53:26 -07:00
Andrew Welker
319909539c Merge pull request #635 from PepperDash/feature/update-builds
update docker.yml to create a release on all builds
2021-03-01 09:54:24 -07:00
Neil Dorin
00589488ac Adds null check for _worker before checking thread state 2021-02-26 14:16:53 -07:00
Andrew Welker
f25219c20a update docker.yml to create a release on all builds 2021-02-26 12:35:17 -07:00
Andrew Welker
c5aef18943 Merge pull request #630 from PepperDash/bugfix/countdownTimer-fixes
SecondsCountdownTimer fixes
2021-02-24 15:03:58 -07:00
Andrew Welker
70d4a7054f Merge branch 'development' into bugfix/countdownTimer-fixes 2021-02-24 14:28:52 -07:00
Andrew Welker
b20009b247 add Math.Floor calls to ignore milliseconds
Change formatting for timeRemaining
Add logic to prevent initial timeRemaining value from being massive negative value
2021-02-24 14:27:11 -07:00
Neil Dorin
9588564633 Merge pull request #623 from PepperDash/feature/fix-namespaces
Fix Namespace issues
2021-02-24 13:09:55 -07:00
Andrew Welker
eef3b5fb31 updates & fixes for countdown timer 2021-02-23 15:53:07 -07:00
Andrew Welker
7078ba55c7 fix dmps off timer 2021-02-23 13:21:01 -07:00
Andrew Welker
e06be3ebe9 Merge branch 'development' into feature/fix-namespaces 2021-02-22 15:34:22 -07:00
Andrew Welker
10046a9ed4 Merge pull request #627 from PepperDash/feature/DMChassis-updates
Update ExecuteSwitch and ports to use DMInput/DMOutput instead of numbers
2021-02-22 15:34:06 -07:00
Andrew Welker
51f294c37f fix ExecuteSwitchNumeric for 0 2021-02-22 13:27:32 -07:00
Andrew Welker
1990201215 add none ports to DMPS & Blade chassis 2021-02-22 10:11:57 -07:00
Andrew Welker
be78d17af5 update Blade chassis ports 2021-02-22 10:02:34 -07:00
Andrew Welker
8a6d5ebd56 Update port creation for DMPS 2021-02-22 10:00:24 -07:00
Andrew Welker
93c0b33958 Updated dmps & blade chassis to use similar routing 2021-02-22 09:55:09 -07:00
Andrew Welker
dca21aa4dc Fixed some issues discovered during testing 2021-02-19 16:43:18 -07:00
Andrew Welker
ac09267173 Add Clear input port for Essentials Routing 2021-02-19 08:55:34 -07:00
Andrew Welker
ef63c1db02 Updating DM Controller to add DMInput/Output as selector instead of number 2021-02-19 08:51:59 -07:00
Andrew Welker
f828cbecbd fix USB routing 2021-02-18 16:23:48 -07:00
Andrew Welker
890abf4383 initial updates to ExecuteSwitch 2021-02-18 16:19:29 -07:00
Andrew Welker
52c96cc2c3 fix it so that wrong namespace classes inherit from right namespace classes 2021-02-18 15:40:18 -07:00
Andrew Welker
4ab3cdb1ff #451 Fix namespace issues 2021-02-18 13:03:23 -07:00
Neil Dorin
2dfd647f63 Merge pull request #622 from PepperDash/bugfix/occSensor-fixes
#618 Fix issue with wrong field getting sent to a method
2021-02-18 12:10:29 -07:00
Andrew Welker
7f054d5e98 Merge branch 'development' into bugfix/occSensor-fixes 2021-02-18 11:54:50 -07:00
Andrew Welker
43297c0341 #618 Fix issue with wrong field getting sent to a method 2021-02-18 11:53:07 -07:00
Neil Dorin
6280aa90c9 Merge pull request #621 from PepperDash/bugfix/occSensor-fixes
Multiple Occ Sensor Updates
2021-02-18 11:43:39 -07:00
Andrew Welker
ca497c8f47 #620 Fix Join Map Comment 2021-02-18 10:55:01 -07:00
Andrew Welker
1da481a8db #619 Correct feedback for linking to API 2021-02-18 10:53:39 -07:00
Andrew Welker
c04d79931d #617 Fix ForceOccupied/ForceVacant methods 2021-02-18 10:51:48 -07:00
Andrew Welker
dbd3ab2f70 #618 more refactoring 2021-02-18 10:44:21 -07:00
Andrew Welker
36b5faa3d9 #618 Fix Occ sensor inheritance structure 2021-02-18 10:39:05 -07:00
Andrew Welker
07bf74ab19 Merge pull request #616 from PepperDash/feature/add-cameramute-to-ciscosparkcodec
#415 Adds camera mute methods and feedback to CiscoSparkCodec
2021-02-17 18:05:31 -07:00
Neil Dorin
e356f57e1a #415 Adds camera mute methods and feedback to CiscoSparkCodec
Adds new IHasCameraMute to more clearly define functions and implements on CiscoSparkCodec and ZoomRoom
2021-02-17 16:50:18 -07:00
Andrew Welker
86ad88969e Merge pull request #615 from PepperDash/feature/reduce-console-boot-messages
Feature/reduce console boot messages
2021-02-17 13:00:21 -07:00
Neil Dorin
7020480159 Moves console messages about adding factory methods to level 1 2021-02-17 11:44:33 -07:00
Neil Dorin
bc54856392 #542 Updates log level for error messages when constructing devices 2021-02-17 11:27:07 -07:00
Neil Dorin
24a435c965 Prevents join map info from printing on program start (JoinMapBaseAdvanced constructor) unless debug level is > 0 2021-02-17 10:18:19 -07:00
Andrew Welker
2897ec1d83 Merge pull request #614 from PepperDash/feature/add-ibridgeadvanced-to-irbluraybase
#548 Implments IBridgeAdvanced on IRBlurayBase and adds IRBlurayBaseJ…
2021-02-16 20:23:21 -07:00
Neil Dorin
f075412a86 #548 Implments IBridgeAdvanced on IRBlurayBase and adds IRBlurayBaseJoinMap 2021-02-16 16:33:35 -07:00
Neil Dorin
4f5bb4dc46 Merge pull request #613 from PepperDash/bugfix/implement-genericqueue-for-ciscosparkcodec
Bugfix/implement genericqueue for ciscosparkcodec
2021-02-16 16:17:22 -07:00
Neil Dorin
382c35924c #612 Implements VideoCodecBase.LinkVideoCodecToApi() on CiscoSparkCodec 2021-02-16 13:28:52 -07:00
Neil Dorin
88c332729f #584 Implements GenericQueue in place of queue and thread in CiscoSparkCodec 2021-02-15 16:11:47 -07:00
Neil Dorin
e9a6aa641b Merge pull request #611 from PepperDash/feature/add-timer-and-action-sequence
Feature/add timer and action sequence
2021-02-11 16:55:00 -07:00
Neil Dorin
16bc2ca381 Corrects spelling mistake and adds check to see if thread is already running before allowing sequence to start 2021-02-11 16:44:18 -07:00
Neil Dorin
2fc1f45161 Fixes timer from executing immediately on construction. Adds some helpful debug statements 2021-02-11 15:56:43 -07:00
Neil Dorin
ef7eae50e4 #609 #610 Adds new RetriggerableTimer and ActionSequence devices 2021-02-11 15:43:22 -07:00
Andrew Welker
2c50efd4c5 Merge pull request #607 from PepperDash/hotfix/fusion-static-asset-fixes
Hotfix/fusion static asset fixes
2021-02-10 15:56:59 -07:00
Andrew Welker
3ebe44be34 Merge pull request #606 from PepperDash/hotfix/fusion-static-asset-fixes
Hotfix/fusion static asset fixes
2021-02-10 15:56:46 -07:00
Andrew Welker
e7b322c303 add error log for some exceptions 2021-02-10 15:39:37 -07:00
Neil Dorin
08491bdf2a Adds null checks if asset creation fails and returns null 2021-02-10 15:01:40 -07:00
Neil Dorin
f1fa3c07fd #605 Adds try/catch and more meaningful messages when adding static assets fails 2021-02-10 14:15:00 -07:00
Neil Dorin
b19b4ae26e Updated to latest DBs to expose new eCrestronSeries property and adds new property to Global to reflect. Updates startup message to print series 2021-02-09 15:27:32 -07:00
Andrew Welker
7f8215199d update processor type comparisons 2021-02-08 17:29:35 -07:00
Andrew Welker
dd060c4442 Merge pull request #602 from PepperDash/hotfix/various-bugs
Hotfix/various bugs
2021-02-08 16:33:21 -07:00
Andrew Welker
e782339dcc Merge pull request #601 from PepperDash/hotfix/various-bugs
Hotfix/various bugs
2021-02-08 16:32:51 -07:00
Neil Dorin
766ed3ab51 #588 Updates all room classes to properly set SourceListKey based on precedence 2021-02-08 16:15:17 -07:00
Neil Dorin
cd0e3f7001 #599 Updates how feedbacks are fired in Tx_OnlineStatusChange 2021-02-08 16:11:49 -07:00
Neil Dorin
29d5ecb13f #588 Updates how EssentialsHuddleVtc1Room sets SourceListKey 2021-02-08 16:11:04 -07:00
Neil Dorin
2987f600bb #588 Update to how SourceListKey gets set in EssentialsRoomBase 2021-02-08 16:10:39 -07:00
Neil Dorin
5c23aeca48 Adds missing constructor to take both pacing and capacity arguments 2021-02-08 16:10:08 -07:00
Neil Dorin
6ef8ba3639 Removes redundant .FireUpdate() calls in Tx_OnlineStatusChange 2021-02-08 16:09:50 -07:00
Neil Dorin
4f7ad4ccb9 fixes #599 by checking for registration status before updating feedbacks 2021-02-08 15:43:04 -07:00
Neil Dorin
e03b0dc1bb #600 Adds additional properties and constructors to GenericQueue 2021-02-08 15:06:05 -07:00
Andrew Welker
b75153b848 Merge pull request #598 from PepperDash/hotfix/dge-device-info
Hotfix/dge device info
2021-02-04 14:04:49 -07:00
Andrew Welker
d70d33c5e3 Merge pull request #597 from PepperDash/hotfix/occupancy-sensor-debug
Hotfix/occupancy sensor debug
2021-02-04 14:04:25 -07:00
Andrew Welker
7eb6748682 Merge pull request #596 from PepperDash/hotfix/dge-device-info
Hotfix/dge device info
2021-02-04 11:41:31 -07:00
Andrew Welker
c92c750e55 Merge branch 'development' into hotfix/occupancy-sensor-debug 2021-02-04 11:27:01 -07:00
Andrew Welker
225c6281b9 Merge branch 'main' into hotfix/dge-device-info 2021-02-04 11:25:10 -07:00
Andrew Welker
249e9f372e Merge pull request #593 from PepperDash/hotfix/occupancy-sensor-debug
Hotfix/occupancy sensor debug
2021-02-04 11:22:30 -07:00
Andrew Welker
4dfab9a287 got DeviceInfo Parsing working correctly 2021-02-04 11:17:49 -07:00
Neil Dorin
ec43749ba4 Tested working with GLS-ODT-C-CN hardware 2021-02-04 11:01:21 -07:00
Neil Dorin
2e4202ccce adjustments made based on testing with hardware 2021-02-04 10:52:02 -07:00
Neil Dorin
4c16dd07b5 fixes #594 with standby state in CiscoSparkCodec 2021-02-04 10:39:29 -07:00
Neil Dorin
0c4ad1c4df Merge branch 'hotfix/occupancy-sensor-debug' of https://github.com/PepperDash/Essentials into hotfix/occupancy-sensor-debug 2021-02-04 09:31:06 -07:00
Neil Dorin
eb90fb343d adds missing condition to set remoteTimeout from config value 2021-02-04 09:30:45 -07:00
Andrew Welker
2967a0f968 turn on dev info and stream debugging for temp client 2021-02-04 08:50:50 -07:00
Andrew Welker
7b2a8b17b7 Merge branch 'main' into hotfix/occupancy-sensor-debug 2021-02-03 21:32:15 -07:00
Neil Dorin
89ca614d3d Minor updates after testing at runtime. 2021-02-03 21:17:27 -07:00
Neil Dorin
355df1341e #592 Adds properties config class for occ sensors 2021-02-03 16:01:24 -07:00
Andrew Welker
78c17cd729 Merge pull request #591 from PepperDash/hotfix/add-routing-interface
Hotfix/add routing interface
2021-02-03 09:45:43 -07:00
Andrew Welker
504c21204f Merge pull request #590 from PepperDash/hotfix/add-routing-interface
Update RoutingInterfaces.cs
2021-02-03 09:45:24 -07:00
Andrew Welker
8dba5a335b Merge branch 'main' into hotfix/add-routing-interface 2021-02-03 09:15:19 -07:00
Neil Dorin
3d6d578663 Merge pull request #582 from PepperDash/hotfix/stop-internal-samsung-comms-debug
Remove unnecessary debug statements
2021-02-02 16:11:27 -07:00
Neil Dorin
a5e9d7ba55 Merge pull request #585 from PepperDash/hotfix/stop-internal-samsung-comms-debug
Hotfix/stop internal samsung comms debug
2021-02-02 16:10:58 -07:00
Andrew Welker
5eb65fd723 Update RoutingInterfaces.cs 2021-02-02 15:30:43 -07:00
jkdevito
e0dcde5c35 Reviewed with AW, decided best to remove console commands and create a public method that can be called using DEVJSON to print current settiings. 2021-02-01 11:10:33 -06:00
jkdevito
c6cfecdbbb Added console command to print occupancy sensor settings in console. 2021-02-01 08:24:54 -06:00
Andrew Welker
30bdac93ee Merge branch 'main' into hotfix/stop-internal-samsung-comms-debug 2021-01-29 16:00:22 -07:00
Andrew Welker
1228431bc2 remove unnecessary debug statements 2021-01-29 14:18:48 -07:00
Andrew Welker
5a2070de3f Merge pull request #580 from PepperDash/hotfix/IrSetTopBoxBase-must-implement-ITvPresetsProvider
Hotfix/ir set top box base must implement i tv presets provider
2021-01-28 16:13:08 -07:00
Andrew Welker
bc1645065c Merge pull request #579 from PepperDash/hotfix/IrSetTopBoxBase-must-implement-ITvPresetsProvider
Implements ITvPresetsProvider on IrSetTopBoxBase
2021-01-28 16:12:22 -07:00
Neil Dorin
21f9795bcd Implements ITvPresetsProvider on IrSetTopBoxBase 2021-01-28 14:05:59 -07:00
Neil Dorin
a69bc94945 Merge pull request #576 from PepperDash/hotfix/fix-queue-priority
Hotfix/fix queue priority
2021-01-27 12:08:04 -07:00
Andrew Welker
864c8ddf77 Merge pull request #575 from PepperDash/hotfix/fix-queue-priority
Set default queue thread priority to medium
2021-01-27 12:04:29 -07:00
Andrew Welker
5764149306 #560 set default queue thread priority to medium 2021-01-27 10:48:23 -07:00
Andrew Welker
9abd911a95 Merge pull request #573 from PepperDash/release/1.7.3
Release/1.7.3
2021-01-26 15:46:35 -07:00
Andrew Welker
968f85b04e Merge pull request #566 from PepperDash/hotfix/nuspec-core-version
Hotfix/nuspec core version
2021-01-26 14:02:17 -07:00
Andrew Welker
6e09ef35ab Merge branch 'development' into hotfix/nuspec-core-version 2021-01-26 13:39:41 -07:00
Andrew Welker
a36bce4d5e Merge pull request #571 from PepperDash/hotfix/ComsMessageQueue-throws-exception
Hotfix/coms message queue throws exception
2021-01-26 13:39:29 -07:00
Andrew Welker
5374e58197 Merge pull request #565 from PepperDash/hotfix/nuspec-core-version
Update PD Core version in Essentials nuspec
2021-01-26 13:39:03 -07:00
Andrew Welker
cbfa7d869b Merge branch 'main' into hotfix/nuspec-core-version 2021-01-26 13:23:37 -07:00
Andrew Welker
434fb1be59 Merge branch 'development' into hotfix/ComsMessageQueue-throws-exception 2021-01-26 13:12:05 -07:00
Andrew Welker
dbec078dae Merge pull request #568 from PepperDash/hotfix/ComsMessageQueue-throws-exception
Validate method now checks the parameter
2021-01-26 13:11:52 -07:00
Andrew Welker
e9a8e42525 Merge pull request #572 from PepperDash/feature/genericqueue-upgrades
Sets the queue size to 25
2021-01-26 13:11:37 -07:00
Andrew Welker
8ad7b429a2 Merge branch 'development' into feature/genericqueue-upgrades 2021-01-26 12:49:48 -07:00
Andrew Welker
a1c27d64ad Merge pull request #570 from PepperDash/hotfix/fusion-error-rollup
Hotfix/fusion error rollup
2021-01-26 12:47:43 -07:00
Andrew Welker
4814d0f769 Merge branch 'main' into hotfix/ComsMessageQueue-throws-exception 2021-01-26 12:45:14 -07:00
Neil Dorin
b7d7196071 Sets the queue size to 25 2021-01-26 12:32:04 -07:00
Andrew Welker
d8225a80b6 Merge branch 'development' into hotfix/fusion-error-rollup 2021-01-26 12:31:33 -07:00
Andrew Welker
1b0d9ae904 Merge branch 'main' into hotfix/nuspec-core-version 2021-01-26 11:47:09 -07:00
Andrew Welker
7228733aad Merge pull request #569 from PepperDash/hotfix/fusion-error-rollup
Updates to properly clear errors when there are none and set message …
2021-01-26 11:46:49 -07:00
Nick Genovese
809639c3f9 Validate method now checks the parameter 2021-01-26 13:17:55 -05:00
Andrew Welker
24e59e1474 Update PepperDash_Essentials_Core.nuspec 2021-01-26 11:05:42 -07:00
Neil Dorin
42c483f581 Updates to properly clear errors when there are none and set message to "Room Ok." 2021-01-25 17:56:20 -07:00
Andrew Welker
7ba0ecdf5c Merge pull request #556 from PepperDash/feature/add-hdbasettx-support
Feature/add hdbasettx support
2021-01-25 16:56:23 -07:00
Andrew Welker
ece36b4042 Merge branch 'development' into feature/add-hdbasettx-support 2021-01-25 15:19:34 -07:00
Andrew Welker
ca5b35b39c Merge pull request #558 from PepperDash/feature/add-fusion-joinmaps
Feature/add fusion joinmaps
2021-01-25 15:19:17 -07:00
Andrew Welker
8f804766e5 Merge branch 'development' into feature/add-fusion-joinmaps 2021-01-25 12:34:02 -07:00
Neil Dorin
00207d1570 Merge pull request #561 from PepperDash/feature/genericqueue-upgrades
#560 Adds constructors with priority and fixed debug statments to use…
2021-01-25 11:18:46 -07:00
Neil Dorin
65747b6ad2 #560 Adds constructors with priority and fixed debug statments to use error log 2021-01-25 10:55:27 -07:00
Andrew Welker
f7174e2492 Merge branch 'development' into feature/add-fusion-joinmaps 2021-01-22 13:09:08 -07:00
Andrew Welker
5d7cdab933 Merge pull request #557 from PepperDash/feature/add-fusion-joinmaps
Feature/add fusion joinmaps
2021-01-22 13:05:37 -07:00
Neil Dorin
c9fee785f9 Static Assets for displays now tested and working 2021-01-22 11:08:35 -07:00
Neil Dorin
dfc90e58dc Adds EssentialsTechRoomFusionSystemController 2021-01-21 17:19:01 -07:00
Neil Dorin
2a5810b671 Updates PD.Core to 1.0.45 2021-01-21 17:01:43 -07:00
Neil Dorin
9d354fb0ed custom fusion joinmap working. updates to hotfix PD.Core build 2021-01-21 16:46:21 -07:00
Neil Dorin
52494ca13e Changes to correct datatype for joinMaps in config 2021-01-21 15:04:01 -07:00
Andrew Welker
55cbd094be Merge branch 'development' into feature/add-hdbasettx-support 2021-01-20 17:06:20 -07:00
Andrew Welker
da5fd7e743 Merge pull request #555 from PepperDash/hotfix/videocodecbase-incoming-call-popup
Hotfix/videocodecbase incoming call popup
2021-01-20 14:52:05 -07:00
Neil Dorin
f6059e249f Merge branch 'main' into feature/add-fusion-joinmaps 2021-01-20 14:39:37 -07:00
Neil Dorin
8545622c79 Merge branch 'development' into hotfix/videocodecbase-incoming-call-popup 2021-01-20 14:33:01 -07:00
Neil Dorin
cf14706961 Merge pull request #554 from PepperDash/hotfix/videocodecbase-incoming-call-popup
Upadted VideoCodecBase LinkVideoCodecCallControlsToApi
2021-01-20 14:32:34 -07:00
Neil Dorin
2f172c998a Merge pull request #552 from batourin/development
Add hdbasettx device to Essentials DM
2021-01-18 15:28:09 -07:00
jkdevito
7945bce854 Upadted VideoCodecBase LinkVideoCodecCallControlsToApi IncomingCall bridge action to reference "args.CallItem.Status == eCodecCallStatus.Ringing" (previously referencing "args.CallItem.Status != eCodecCallStatus.Disconnected") 2021-01-18 15:37:39 -06:00
Maxim Batourine
6d66c5adee add HDBaseTTxController to project file 2021-01-18 13:16:19 -05:00
Maxim Batourine
8ccbed6d81 Add hdbasettx device 2021-01-16 22:57:45 -05:00
Andrew Welker
c3c58e3201 Merge pull request #551 from PepperDash/hotfix/zoomroom-obtp-dialing
Hotfix/zoomroom obtp dialing
2021-01-15 12:08:45 -07:00
Andrew Welker
f547eb3a09 Merge branch 'development' into hotfix/zoomroom-obtp-dialing 2021-01-15 11:50:35 -07:00
Andrew Welker
44cacc839b Merge pull request #538 from PepperDash/hotfix/zoomroom-obtp-dialing
Hotfix/zoomroom obtp dialing
2021-01-15 11:45:13 -07:00
Andrew Welker
6dbe1b6f31 Merge pull request #547 from PepperDash/feature/merge-into-dev
Feature/merge into dev
2021-01-13 09:14:23 -07:00
Andrew Welker
e15ed3c77f Merge branch 'development' into feature/merge-into-dev 2021-01-13 08:28:15 -07:00
Neil Dorin
435879e19b Merge pull request #541 from batourin/development
[BUG] Add safety check for casting device into interface
2021-01-12 16:57:43 -07:00
Neil Dorin
17ccaecf5e Merge pull request #534 from PepperDash/feature/get-prop-by-name-fixes
Feature/get prop by name fixes
2021-01-12 16:56:12 -07:00
Neil Dorin
dfebd47ef4 Merge branch 'main' into hotfix/zoomroom-obtp-dialing 2021-01-12 15:49:56 -07:00
Neil Dorin
684b8db546 Merge branch 'development' into feature/get-prop-by-name-fixes 2021-01-12 15:49:18 -07:00
Neil Dorin
3c714f724d Merge pull request #546 from PepperDash/hotfix/sys-monitor-not-updating-bridge
fixes a bug where the system monitor bridge wasn't updating
2021-01-12 15:48:43 -07:00
Neil Dorin
03e0dc5208 Merge branch 'main' into hotfix/sys-monitor-not-updating-bridge 2021-01-12 15:34:48 -07:00
Neil Dorin
14991bce95 Merge pull request #544 from PepperDash/release/1.7.0
Release/1.7.0
2021-01-12 11:04:50 -07:00
Nick Genovese
030d69c190 fixes a bug where the system monitor bridge wasn't updating
- fires off all program start/stop/register feedbacks when they are created to set initial state
2021-01-12 09:20:15 -05:00
Maxim Batourine
08fe408dc1 Add safety check for casting device into interface
(device as IRoutingInputsOutputs).InputPorts will throw Exception on accessing InputPorts property if device do not implement such interface.
2021-01-07 19:31:24 -05:00
jkdevito
72197e547f Updated VideoCodecBase.cs and ZoomRooms.cs to resolve an issue with dialing the currently scheduled meetings.
VideoCodecBase.cs changes:
1. Moved the trilist.SetSigFalseActions for DialMeeting 1-3 from the UpdateMeetinsgList mehtod to the LinkVideoCodecScheduleToApi method.
- This was necessary to resolve an issue with dialing current meetings.
- When the SetSigFalseActions where located in the UpdateMeetingsList, they were using the codec.CodecSchedule.Meetings to dial, which was not updated based on the time of day.
2. Turned the local var currentMeetings into a private list, _currentMeetings, that can be updated by UpdateMeetingsList and then used in LinkVideoCodecScheduleToApi when the trilist actions are executed.
3. Added debug statements to help narrow down the issue and verify the data.
ZoomRoom.cs changes:
1. Added debug statement to Dial(Meeting meeting) method to confirm the data passed from LinkVideoCodecScheduleToApi was matching the _currentMeetings list data.
2021-01-06 16:22:54 -06:00
Neil Dorin
9b62849d9d removes old comment 2021-01-06 14:45:40 -07:00
Neil Dorin
d311b6fef9 Adds AttributeName property to JoinData allowing attribute name to be set from config as well 2021-01-05 18:21:32 -07:00
Neil Dorin
4a642b1e36 Adds UserObject for future use purposes 2021-01-04 16:19:08 -07:00
Neil Dorin
de4f003c67 Swapped out hardcoded joins for join map in Vtc1FusionController 2021-01-04 12:10:12 -07:00
Neil Dorin
708ee1a8ff #535 Wraps up EssentialsHuddleSpaceFusionSystemControllerBase. Starts on Vtc1FusionController 2020-12-30 17:01:55 -07:00
Neil Dorin
7196d0aba8 Adds FusionRoomJoinMap and ability to set IPID and JoinMapKey from config 2020-12-29 20:20:49 -07:00
Jason Alborough
0a34f48e0a Fixes for the static GetPropertyByName method in DeviceJsonApi...now returns a property object rather than a PropertyInfo object 2020-12-18 17:07:20 -05:00
Jason Alborough
fc91ba7c1e Fixes Namespace and Implements IKeyed in both interfaces. 2020-12-16 15:00:30 -05:00
Jason Alborough
1cad1976ee #499 Adds interfaces ILogStrings and ILogStringsWithLevel to PepperDash_Essentials_Core.Interfaces 2020-12-16 14:39:53 -05:00
84 changed files with 8913 additions and 5455 deletions

View File

@@ -78,16 +78,9 @@ jobs:
with:
name: Version
path: ${{env.GITHUB_HOME}}\output\version.txt
# Create the release on the source repo
- name: Create tag for non-rc builds
if: contains(env.VERSION, 'alpha') || contains(env.VERSION, 'beta')
run: |
git tag $($Env:VERSION)
git push --tags origin
- name: Create Release
id: create_release
# using contributor's version to allow for pointing at the right commit
if: contains(env.VERSION,'-rc-') || contains(env.VERSION,'-hotfix-')
uses: fleskesvor/create-release@feature/support-target-commitish
with:
tag_name: ${{ env.VERSION }}
@@ -150,160 +143,3 @@ jobs:
run: nuget push **/*.nupkg -source github
- name: Publish nuget package to nuget.org
run: nuget push **/*.nupkg -Source https://api.nuget.org/v3/index.json
# This step always runs and pushes the build to the internal build rep
Internal_Push_Output:
needs: Build_Project
runs-on: windows-latest
steps:
- name: check Github ref
run: ${{toJson(github.ref)}}
# Checkout the repo
- name: Checkout Builds Repo
uses: actions/checkout@v2
with:
token: ${{ secrets.BUILDS_TOKEN }}
repository: PepperDash-Engineering/essentials-builds
ref: ${{ Env.GITHUB_REF }}
# Download the version artifact from the build job
- name: Download Build Version Info
uses: actions/download-artifact@v1
with:
name: Version
- name: Check Directory
run: Get-ChildItem "./"
# Set the version number environment variable from the file we just downloaded
- name: Set Version Number
shell: powershell
run: |
Get-ChildItem "./Version"
$version = Get-Content -Path ./Version/version.txt
Write-Host "Version: $version"
echo "VERSION=$version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
Remove-Item -Path ./Version/version.txt
Remove-Item -Path ./Version
# Checkout/Create the branch
- name: Create new branch
run: git checkout -b $($Env:GITHUB_REF -replace "refs/heads/")
# Download the build output into the repo
- name: Download Build output
uses: actions/download-artifact@v1
with:
name: Build
path: ./
- name: Check directory
run: Get-ChildItem ./
# Unzip the build package file
- name: Unzip Build file
run: |
Get-ChildItem .\*.zip | Expand-Archive -DestinationPath .\
Remove-Item -Path .\*.zip
- name: Check directory again
run: Get-ChildItem ./
# Copy Contents of output folder to root directory
- name: Copy Files to root & delete output directory
run: |
Remove-Item -Path .\* -Include @("*.cpz","*.md","*.cplz","*.json","*.dll","*.clz")
Get-ChildItem -Path .\output\* | Copy-Item -Destination .\
Remove-Item -Path .\output -Recurse
# Commits the build output to the branch and tags it with the version
- name: Commit build output and tag the commit
shell: powershell
run: |
git config user.email "actions@pepperdash.com"
git config user.name "GitHub Actions"
git add .
$commit = "Build $($Env:GITHUB_RUN_NUMBER) from commit: https://github.com/$($Env:GITHUB_REPOSITORY)/commit/$($Env:GITHUB_SHA)"
Write-Host "Commit: $commit"
git commit -m $commit
git tag $($Env:VERSION)
# Push the commit
- name: Push to Builds Repo
shell: powershell
run: |
$branch = $($Env:GITHUB_REF) -replace "refs/heads/"
Write-Host "Branch: $branch"
git push -u origin $($branch) --force
# Push the tags
- name: Push tags
run: git push --tags origin
- name: Check Directory
run: Get-ChildItem ./
# This step only runs if the branch is 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, 'main') || contains(github.ref, '/release/')
steps:
# Checkout the repo
- name: check Github ref
run: ${{toJson(github.ref)}}
- name: Checkout Builds Repo
uses: actions/checkout@v2
with:
token: ${{ secrets.BUILDS_TOKEN }}
repository: PepperDash/Essentials-Builds
ref: ${{ Env.GITHUB_REF }}
# Download the version artifact from the build job
- name: Download Build Version Info
uses: actions/download-artifact@v1
with:
name: Version
- name: Check Directory
run: Get-ChildItem "./"
# Set the version number environment variable from the file we just downloaded
- name: Set Version Number
shell: powershell
run: |
Get-ChildItem "./Version"
$version = Get-Content -Path ./Version/version.txt
Write-Host "Version: $version"
echo "VERSION=$version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
Remove-Item -Path ./Version/version.txt
Remove-Item -Path ./Version
# Checkout/Create the branch
- name: Create new branch
run: git checkout -b $($Env:GITHUB_REF -replace "refs/heads/")
# Download the build output into the repo
- name: Download Build output
uses: actions/download-artifact@v1
with:
name: Build
path: ./
- name: Check directory
run: Get-ChildItem ./
# Unzip the build package file
- name: Unzip Build file
run: |
Get-ChildItem .\*.zip | Expand-Archive -DestinationPath .\
Remove-Item -Path .\*.zip
- name: Check directory again
run: Get-ChildItem ./
# Copy Contents of output folder to root directory
- name: Copy Files to root & delete output directory
run: |
Remove-Item -Path .\* -Include @("*.cpz","*.md","*.cplz","*.json","*.dll","*.clz")
Get-ChildItem -Path .\output\* | Copy-Item -Destination .\
Remove-Item -Path .\output -Recurse
# Commits the build output to the branch and tags it with the version
- name: Commit build output and tag the commit
shell: powershell
run: |
git config user.email "actions@pepperdash.com"
git config user.name "GitHub Actions"
git add .
$commit = "Build $($Env:GITHUB_RUN_NUMBER) from commit: https://github.com/$($Env:GITHUB_REPOSITORY)/commit/$($Env:GITHUB_SHA)"
Write-Host "Commit: $commit"
git commit -m $commit
git tag $($Env:VERSION)
# Push the commit
- name: Push to Builds Repo
shell: powershell
run: |
$branch = $($Env:GITHUB_REF) -replace "refs/heads/"
Write-Host "Branch: $branch"
git push -u origin $($branch) --force
# Push the tags
- name: Push tags
run: git push --tags origin
- name: Check Directory
run: Get-ChildItem ./

View File

@@ -123,148 +123,3 @@ jobs:
run: nuget push **/*.nupkg -source github
- name: Publish nuget package to nuget.org
run: nuget push **/*.nupkg -Source https://api.nuget.org/v3/index.json
Internal_Push_Output:
needs: Build_Project
runs-on: windows-latest
steps:
# Checkout the repo
- name: Checkout Builds Repo
uses: actions/checkout@v2
with:
token: ${{ secrets.BUILDS_TOKEN }}
repository: PepperDash-Engineering/essentials-builds
ref: ${{ Env.GITHUB_REF }}
# Download the version artifact from the build job
- name: Download Build Version Info
uses: actions/download-artifact@v1
with:
name: Version
- name: Check Directory
run: Get-ChildItem "./"
# Set the version number environment variable from the file we just downloaded
- name: Set Version Number
shell: powershell
run: |
Get-ChildItem "./Version"
$version = Get-Content -Path ./Version/version.txt
Write-Host "Version: $version"
echo "VERSION=$version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
Remove-Item -Path ./Version/version.txt
Remove-Item -Path ./Version
# Checkout/Create the branch
- name: Checkout main branch
run: git checkout main
# Download the build output into the repo
- name: Download Build output
uses: actions/download-artifact@v1
with:
name: Build
path: ./
- name: Check directory
run: Get-ChildItem ./
# Unzip the build package file
- name: Unzip Build file
run: |
Get-ChildItem .\*.zip | Expand-Archive -DestinationPath .\
Remove-Item -Path .\*.zip
- name: Check directory again
run: Get-ChildItem ./
# Copy Contents of output folder to root directory
- name: Copy Files to root & delete output directory
run: |
Remove-Item -Path .\* -Include @("*.cpz","*.md","*.cplz","*.json","*.dll","*.clz")
Get-ChildItem -Path .\output\* | Copy-Item -Destination .\
Remove-Item -Path .\output -Recurse
# Commits the build output to the branch and tags it with the version
- name: Commit build output and tag the commit
shell: powershell
run: |
git config user.email "actions@pepperdash.com"
git config user.name "GitHub Actions"
git add .
$commit = "Build $($Env:GITHUB_RUN_NUMBER) from commit: https://github.com/$($Env:GITHUB_REPOSITORY)/commit/$($Env:GITHUB_SHA)"
Write-Host "Commit: $commit"
git commit -m $commit
git tag $($Env:VERSION)
# Push the commit
- name: Push to Builds Repo
shell: powershell
run: git push -u origin 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 main or release/ runs and pushes the build to the public build repo
Public_Push_Output:
needs: Build_Project
runs-on: windows-latest
steps:
# Checkout the repo
- name: Checkout Builds Repo
uses: actions/checkout@v2
with:
token: ${{ secrets.BUILDS_TOKEN }}
repository: PepperDash/Essentials-Builds
ref: ${{ Env.GITHUB_REF }}
# Download the version artifact from the build job
- name: Download Build Version Info
uses: actions/download-artifact@v1
with:
name: Version
- name: Check Directory
run: Get-ChildItem "./"
# Set the version number environment variable from the file we just downloaded
- name: Set Version Number
shell: powershell
run: |
Get-ChildItem "./Version"
$version = Get-Content -Path ./Version/version.txt
Write-Host "Version: $version"
echo "VERSION=$version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
Remove-Item -Path ./Version/version.txt
Remove-Item -Path ./Version
# Checkout main branch
- name: Create new branch
run: git checkout main
# Download the build output into the repo
- name: Download Build output
uses: actions/download-artifact@v1
with:
name: Build
path: ./
- name: Check directory
run: Get-ChildItem ./
# Unzip the build package file
- name: Unzip Build file
run: |
Get-ChildItem .\*.zip | Expand-Archive -DestinationPath .\
Remove-Item -Path .\*.zip
- name: Check directory again
run: Get-ChildItem ./
# Copy Contents of output folder to root directory
- name: Copy Files to root & delete output directory
run: |
Remove-Item -Path .\* -Include @("*.cpz","*.md","*.cplz","*.json","*.dll","*.clz")
Get-ChildItem -Path .\output\* | Copy-Item -Destination .\
Remove-Item -Path .\output -Recurse
# Commits the build output to the branch and tags it with the version
- name: Commit build output and tag the commit
shell: powershell
run: |
git config user.email "actions@pepperdash.com"
git config user.name "GitHub Actions"
git add .
$commit = "Build $($Env:GITHUB_RUN_NUMBER) from commit: https://github.com/$($Env:GITHUB_REPOSITORY)/commit/$($Env:GITHUB_SHA)"
Write-Host "Commit: $commit"
git commit -m $commit
git tag $($Env:VERSION)
# Push the commit
- name: Push to Builds Repo
shell: powershell
run: git push -u origin main --force
# Push the tags
- name: Push tags
run: git push --tags origin
- name: Check Directory
run: Get-ChildItem ./

1
.gitignore vendored
View File

@@ -388,3 +388,4 @@ MigrationBackup/
# Fody - auto-generated XML schema
FodyWeavers.xsd
essentials-framework/Essentials Interfaces/PepperDash_Essentials_Interfaces/PepperDash_Essentials_Interfaces.csproj

View File

@@ -130,7 +130,7 @@ namespace PepperDash.Essentials
if (CrestronEnvironment.DevicePlatform != eDevicePlatform.Server) // Handles 3-series running Windows CE OS
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Starting Essentials v{0} on 3-series Appliance", Global.AssemblyVersion);
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Starting Essentials v{0} on {1} Appliance", Global.AssemblyVersion, Global.ProcessorSeries.ToString());
// Check if User/ProgramX exists
if (Directory.Exists(Global.ApplicationDirectoryPathPrefix + dirSeparator + "User"
@@ -323,7 +323,12 @@ namespace PepperDash.Essentials
// Skip this to prevent unnecessary warnings
if (devConf.Key == "processor")
{
if (devConf.Type.ToLower() != Global.ControlSystem.ControllerPrompt.ToLower())
var prompt = Global.ControlSystem.ControllerPrompt;
var typeMatch = String.Equals(devConf.Type, prompt, StringComparison.OrdinalIgnoreCase) &&
String.Equals(devConf.Type, prompt.Replace("-", ""), StringComparison.OrdinalIgnoreCase);
if (!typeMatch)
Debug.Console(0,
"WARNING: Config file defines processor type as '{0}' but actual processor is '{1}'! Some ports may not be available",
devConf.Type.ToUpper(), Global.ControlSystem.ControllerPrompt.ToUpper());
@@ -378,11 +383,11 @@ namespace PepperDash.Essentials
if (newDev != null)
DeviceManager.AddDevice(newDev);
else
Debug.Console(0, Debug.ErrorLogLevel.Notice, "ERROR: Cannot load unknown device type '{0}', key '{1}'.", devConf.Type, devConf.Key);
Debug.Console(0, Debug.ErrorLogLevel.Error, "ERROR: Cannot load unknown device type '{0}', key '{1}'.", devConf.Type, devConf.Key);
}
catch (Exception e)
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "ERROR: Creating device {0}. Skipping device. \r{1}", devConf.Key, e);
Debug.Console(0, Debug.ErrorLogLevel.Error, "ERROR: Creating device {0}. Skipping device. \r{1}", devConf.Key, e);
}
}
Debug.Console(0, Debug.ErrorLogLevel.Notice, "All Devices Loaded.");
@@ -432,12 +437,31 @@ namespace PepperDash.Essentials
var room = EssentialsRoomConfigHelper.GetRoomObject(roomConfig) as EssentialsRoomBase;
if (room != null)
{
// default IPID
uint fusionIpId = 0xf1;
// default to no join map key
string fusionJoinMapKey = string.Empty;
if (room.Config.Properties["fusion"] != null)
{
Debug.Console(2, "Custom Fusion config found. Using custom values");
var fusionConfig = room.Config.Properties["fusion"].ToObject<EssentialsRoomFusionConfig>();
if (fusionConfig != null)
{
fusionIpId = fusionConfig.IpIdInt;
fusionJoinMapKey = fusionConfig.JoinMapKey;
}
}
if (room is EssentialsHuddleSpaceRoom)
{
DeviceManager.AddDevice(room);
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Room is EssentialsHuddleSpaceRoom, attempting to add to DeviceManager with Fusion");
DeviceManager.AddDevice(new Core.Fusion.EssentialsHuddleSpaceFusionSystemControllerBase(room, 0xf1));
DeviceManager.AddDevice(new Core.Fusion.EssentialsHuddleSpaceFusionSystemControllerBase(room, fusionIpId, fusionJoinMapKey));
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Mobile Control Bridge...");
@@ -449,7 +473,7 @@ namespace PepperDash.Essentials
DeviceManager.AddDevice(room);
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Room is EssentialsHuddleVtc1Room, attempting to add to DeviceManager with Fusion");
DeviceManager.AddDevice(new EssentialsHuddleVtc1FusionController((EssentialsHuddleVtc1Room)room, 0xf1));
DeviceManager.AddDevice(new EssentialsHuddleVtc1FusionController((EssentialsHuddleVtc1Room)room, fusionIpId, fusionJoinMapKey));
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Mobile Control Bridge...");
@@ -461,7 +485,7 @@ namespace PepperDash.Essentials
Debug.Console(0, Debug.ErrorLogLevel.Notice,
"Room is EssentialsTechRoom, Attempting to add to DeviceManager with Fusion");
DeviceManager.AddDevice(new EssentialsHuddleSpaceFusionSystemControllerBase(room, 0xF1));
DeviceManager.AddDevice(new EssentialsTechRoomFusionSystemController((EssentialsTechRoom)room, fusionIpId, fusionJoinMapKey));
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Mobile Control Bridge");
@@ -569,7 +593,7 @@ namespace PepperDash.Essentials
return ((logoDark != null && logoDark == "system") ||
(logoLight != null && logoLight == "system") || (logo != null && logo == "system"));
}
catch (Exception e)
catch
{
Debug.Console(1, Debug.ErrorLogLevel.Notice, "Unable to find logo information in any room config");
return false;

View File

@@ -16,8 +16,8 @@ namespace PepperDash.Essentials.Fusion
{
BooleanSigData CodecIsInCall;
public EssentialsHuddleVtc1FusionController(EssentialsHuddleVtc1Room room, uint ipId)
: base(room, ipId)
public EssentialsHuddleVtc1FusionController(EssentialsHuddleVtc1Room room, uint ipId, string joinMapKey)
: base(room, ipId, joinMapKey)
{
}
@@ -55,25 +55,25 @@ namespace PepperDash.Essentials.Fusion
// Map FusionRoom Attributes:
// Codec volume
var codecVolume = FusionRoom.CreateOffsetUshortSig(50, "Volume - Fader01", eSigIoMask.InputOutputSig);
var codecVolume = FusionRoom.CreateOffsetUshortSig(JoinMap.VolumeFader1.JoinNumber, JoinMap.VolumeFader1.AttributeName, eSigIoMask.InputOutputSig);
codecVolume.OutputSig.UserObject = new Action<ushort>(b => (codec as IBasicVolumeWithFeedback).SetVolume(b));
(codec as IBasicVolumeWithFeedback).VolumeLevelFeedback.LinkInputSig(codecVolume.InputSig);
// In Call Status
CodecIsInCall = FusionRoom.CreateOffsetBoolSig(69, "Conf - VC 1 In Call", eSigIoMask.InputSigOnly);
CodecIsInCall = FusionRoom.CreateOffsetBoolSig(JoinMap.VcCodecInCall.JoinNumber, JoinMap.VcCodecInCall.AttributeName, eSigIoMask.InputSigOnly);
codec.CallStatusChange += new EventHandler<PepperDash.Essentials.Devices.Common.Codec.CodecCallStatusItemChangeEventArgs>(codec_CallStatusChange);
// Online status
if (codec is ICommunicationMonitor)
{
var c = codec as ICommunicationMonitor;
var codecOnline = FusionRoom.CreateOffsetBoolSig(122, "Online - VC 1", eSigIoMask.InputSigOnly);
var codecOnline = FusionRoom.CreateOffsetBoolSig(JoinMap.VcCodecOnline.JoinNumber, JoinMap.VcCodecOnline.AttributeName, eSigIoMask.InputSigOnly);
codecOnline.InputSig.BoolValue = c.CommunicationMonitor.Status == MonitorStatus.IsOk;
c.CommunicationMonitor.StatusChange += (o, a) =>
{
codecOnline.InputSig.BoolValue = a.Status == MonitorStatus.IsOk;
};
Debug.Console(0, this, "Linking '{0}' communication monitor to Fusion '{1}'", codec.Key, "Online - VC 1");
Debug.Console(0, this, "Linking '{0}' communication monitor to Fusion '{1}'", codec.Key, JoinMap.VcCodecOnline.AttributeName);
}
// Codec IP Address
@@ -101,10 +101,10 @@ namespace PepperDash.Essentials.Fusion
if (codecHasIpInfo)
{
codecIpAddressSig = FusionRoom.CreateOffsetStringSig(121, "IP Address - VC", eSigIoMask.InputSigOnly);
codecIpAddressSig = FusionRoom.CreateOffsetStringSig(JoinMap.VcCodecIpAddress.JoinNumber, JoinMap.VcCodecIpAddress.AttributeName, eSigIoMask.InputSigOnly);
codecIpAddressSig.InputSig.StringValue = codecIpAddress;
codecIpPortSig = FusionRoom.CreateOffsetStringSig(150, "IP Port - VC", eSigIoMask.InputSigOnly);
codecIpPortSig = FusionRoom.CreateOffsetStringSig(JoinMap.VcCodecIpPort.JoinNumber, JoinMap.VcCodecIpPort.AttributeName, eSigIoMask.InputSigOnly);
codecIpPortSig.InputSig.StringValue = codecIpPort.ToString();
}
@@ -123,7 +123,7 @@ namespace PepperDash.Essentials.Fusion
FusionStaticAssets.Add(deviceConfig.Uid, tempAsset);
}
var codecAsset = FusionRoom.CreateStaticAsset(tempAsset.SlotNumber, tempAsset.Name, "Display", tempAsset.InstanceId);
var codecAsset = FusionRoom.CreateStaticAsset(tempAsset.SlotNumber, tempAsset.Name, "Codec", tempAsset.InstanceId);
codecAsset.PowerOn.OutputSig.UserObject = codecPowerOnAction;
codecAsset.PowerOff.OutputSig.UserObject = codecPowerOffAction;
codec.StandbyIsOnFeedback.LinkComplementInputSig(codecAsset.PowerOn.InputSig);
@@ -166,20 +166,19 @@ namespace PepperDash.Essentials.Fusion
CrestronConsole.AddNewConsoleCommand(RequestFullRoomSchedule, "FusReqRoomSchedule", "Requests schedule of the room for the next 24 hours", ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(ModifyMeetingEndTimeConsoleHelper, "FusReqRoomSchMod", "Ends or extends a meeting by the specified time", ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(CreateAsHocMeeting, "FusCreateMeeting", "Creates and Ad Hoc meeting for on hour or until the next meeting", ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(CreateAdHocMeeting, "FusCreateMeeting", "Creates and Ad Hoc meeting for on hour or until the next meeting", ConsoleAccessLevelEnum.AccessOperator);
// Room to fusion room
Room.OnFeedback.LinkInputSig(FusionRoom.SystemPowerOn.InputSig);
// Moved to
CurrentRoomSourceNameSig = FusionRoom.CreateOffsetStringSig(84, "Display 1 - Current Source", eSigIoMask.InputSigOnly);
CurrentRoomSourceNameSig = FusionRoom.CreateOffsetStringSig(JoinMap.Display1CurrentSourceName.JoinNumber, JoinMap.Display1CurrentSourceName.AttributeName, eSigIoMask.InputSigOnly);
// Don't think we need to get current status of this as nothing should be alive yet.
(Room as EssentialsHuddleVtc1Room).CurrentSourceChange += Room_CurrentSourceInfoChange;
FusionRoom.SystemPowerOn.OutputSig.SetSigFalseAction((Room as EssentialsHuddleVtc1Room).PowerOnToDefaultOrLastSource);
FusionRoom.SystemPowerOff.OutputSig.SetSigFalseAction(() => (Room as EssentialsHuddleVtc1Room).RunRouteAction("roomOff", Room.SourceListKey));
// NO!! room.RoomIsOn.LinkComplementInputSig(FusionRoom.SystemPowerOff.InputSig);
CrestronEnvironment.EthernetEventHandler += CrestronEnvironment_EthernetEventHandler;
@@ -197,9 +196,9 @@ namespace PepperDash.Essentials.Fusion
uint i = 1;
foreach (var kvp in setTopBoxes)
{
TryAddRouteActionSigs("Display 1 - Source TV " + i, 188 + i, kvp.Key, kvp.Value.SourceDevice);
TryAddRouteActionSigs(JoinMap.Display1DiscPlayerSourceStart.AttributeName + " " + i, JoinMap.Display1DiscPlayerSourceStart.JoinNumber + i, kvp.Key, kvp.Value.SourceDevice);
i++;
if (i > 5) // We only have five spots
if (i > JoinMap.Display1SetTopBoxSourceStart.JoinSpan) // We only have five spots
break;
}
@@ -207,7 +206,7 @@ namespace PepperDash.Essentials.Fusion
i = 1;
foreach (var kvp in discPlayers)
{
TryAddRouteActionSigs("Display 1 - Source DVD " + i, 181 + i, kvp.Key, kvp.Value.SourceDevice);
TryAddRouteActionSigs(JoinMap.Display1DiscPlayerSourceStart.AttributeName + " " + i, JoinMap.Display1DiscPlayerSourceStart.JoinNumber + i, kvp.Key, kvp.Value.SourceDevice);
i++;
if (i > 5) // We only have five spots
break;
@@ -217,9 +216,9 @@ namespace PepperDash.Essentials.Fusion
i = 1;
foreach (var kvp in laptops)
{
TryAddRouteActionSigs("Display 1 - Source Laptop " + i, 166 + i, kvp.Key, kvp.Value.SourceDevice);
TryAddRouteActionSigs(JoinMap.Display1LaptopSourceStart.AttributeName + " " + i, JoinMap.Display1LaptopSourceStart.JoinNumber + i, kvp.Key, kvp.Value.SourceDevice);
i++;
if (i > 10) // We only have ten spots???
if (i > JoinMap.Display1LaptopSourceStart.JoinSpan) // We only have ten spots???
break;
}
@@ -283,7 +282,7 @@ namespace PepperDash.Essentials.Fusion
if (defaultDisplay is IDisplayUsage)
(defaultDisplay as IDisplayUsage).LampHours.LinkInputSig(FusionRoom.DisplayUsage.InputSig);
MapDisplayToRoomJoins(1, 158, defaultDisplay);
MapDisplayToRoomJoins(1, JoinMap.Display1Start.JoinNumber, defaultDisplay);
var deviceConfig = ConfigReader.ConfigObject.Devices.FirstOrDefault(d => d.Key.Equals(defaultDisplay.Key));
@@ -328,7 +327,7 @@ namespace PepperDash.Essentials.Fusion
}
protected override void MapDisplayToRoomJoins(int displayIndex, int joinOffset, DisplayBase display)
protected override void MapDisplayToRoomJoins(int displayIndex, uint joinOffset, DisplayBase display)
{
string displayName = string.Format("Display {0} - ", displayIndex);

View File

@@ -0,0 +1,106 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.Fusion;
namespace PepperDash.Essentials.Fusion
{
public class EssentialsTechRoomFusionSystemController : EssentialsHuddleSpaceFusionSystemControllerBase
{
public EssentialsTechRoomFusionSystemController(EssentialsTechRoom room, uint ipId, string joinMapKey)
: base(room, ipId, joinMapKey)
{
}
protected override void SetUpDisplay()
{
try
{
var displays = (Room as EssentialsTechRoom).Displays;
Debug.Console(1, this, "Setting up Static Assets for {0} Displays", displays.Count);
foreach (var display in displays.Values.Cast<DisplayBase>())
{
var disp = display; // Local scope variable
Debug.Console(2, this, "Setting up Static Asset for {0}", disp.Key);
disp.UsageTracker = new UsageTracking(disp) { UsageIsTracked = true };
disp.UsageTracker.DeviceUsageEnded += UsageTracker_DeviceUsageEnded;
var dispPowerOnAction = new Action<bool>(b =>
{
if (!b)
{
disp.PowerOn();
}
});
var dispPowerOffAction = new Action<bool>(b =>
{
if (!b)
{
disp.PowerOff();
}
});
var deviceConfig = ConfigReader.ConfigObject.GetDeviceForKey(disp.Key);
FusionAsset tempAsset;
if (FusionStaticAssets.ContainsKey(deviceConfig.Uid))
{
// Used existing asset
tempAsset = FusionStaticAssets[deviceConfig.Uid];
}
else
{
// Create a new asset
tempAsset = new FusionAsset(FusionRoomGuids.GetNextAvailableAssetNumber(FusionRoom),
disp.Name, "Display", "");
FusionStaticAssets.Add(deviceConfig.Uid, tempAsset);
}
var dispAsset = FusionRoom.CreateStaticAsset(tempAsset.SlotNumber, tempAsset.Name, "Display",
tempAsset.InstanceId);
if (dispAsset != null)
{
dispAsset.PowerOn.OutputSig.UserObject = dispPowerOnAction;
dispAsset.PowerOff.OutputSig.UserObject = dispPowerOffAction;
// Use extension methods
dispAsset.TrySetMakeModel(disp);
dispAsset.TryLinkAssetErrorToCommunication(disp);
}
var defaultTwoWayDisplay = disp as IHasPowerControlWithFeedback;
if (defaultTwoWayDisplay != null)
{
defaultTwoWayDisplay.PowerIsOnFeedback.LinkInputSig(FusionRoom.DisplayPowerOn.InputSig);
if (disp is IDisplayUsage)
{
(disp as IDisplayUsage).LampHours.LinkInputSig(FusionRoom.DisplayUsage.InputSig);
}
if(dispAsset != null)
defaultTwoWayDisplay.PowerIsOnFeedback.LinkInputSig(dispAsset.PowerOn.InputSig);
}
}
}
catch (Exception e)
{
Debug.Console(1, this, "Error setting up displays in Fusion: {0}", e);
}
}
}
}

View File

@@ -133,6 +133,7 @@
<Compile Include="Devices\Amplifier.cs" />
<Compile Include="ControlSystem.cs" />
<Compile Include="Fusion\EssentialsHuddleVtc1FusionController.cs" />
<Compile Include="Fusion\EssentialsTechRoomFusionSystemController.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Room\Config\EssentialsDualDisplayRoomPropertiesConfig.cs" />
<Compile Include="Room\Config\EssentialsNDisplayRoomPropertiesConfig.cs" />

View File

@@ -177,6 +177,9 @@ namespace PepperDash.Essentials.Room.Config
[JsonProperty("volumes")]
public EssentialsRoomVolumesConfig Volumes { get; set; }
[JsonProperty("fusion")]
public EssentialsRoomFusionConfig Fusion { get; set; }
[JsonProperty("zeroVolumeWhenSwtichingVolumeDevices")]
public bool ZeroVolumeWhenSwtichingVolumeDevices { get; set; }
@@ -220,6 +223,32 @@ namespace PepperDash.Essentials.Room.Config
}
public class EssentialsRoomFusionConfig
{
public uint IpIdInt
{
get
{
try
{
return Convert.ToUInt32(IpId, 16);
}
catch (Exception)
{
throw new FormatException(string.Format("ERROR:Unable to convert IP ID: {0} to hex. Error:\n{1}", IpId));
}
}
}
[JsonProperty("ipId")]
public string IpId { get; set; }
[JsonProperty("joinMapKey")]
public string JoinMapKey { get; set; }
}
public class EssentialsRoomMicrophonePrivacyConfig
{
[JsonProperty("deviceKey")]

View File

@@ -5,30 +5,62 @@ namespace PepperDash.Essentials.Room.Config
{
public class EssentialsTechRoomConfig
{
/// <summary>
/// The key of the dummy device used to enable routing
/// </summary>
[JsonProperty("dummySourceKey")]
public string DummySourceKey { get; set; }
/// <summary>
/// The keys of the displays assigned to this room
/// </summary>
[JsonProperty("displays")]
public List<string> Displays;
public List<string> Displays { get; set; }
/// <summary>
/// The keys of the tuners assinged to this room
/// </summary>
[JsonProperty("tuners")]
public List<string> Tuners;
public List<string> Tuners { get; set; }
/// <summary>
/// PIN to access the room as a normal user
/// </summary>
[JsonProperty("userPin")]
public string UserPin;
public string UserPin { get; set; }
/// <summary>
/// PIN to access the room as a tech user
/// </summary>
[JsonProperty("techPin")]
public string TechPin;
public string TechPin { get; set; }
/// <summary>
/// Name of the presets file. Path prefix is assumed to be /html/presets/lists/
/// </summary>
[JsonProperty("presetsFileName")]
public string PresetsFileName;
public string PresetsFileName { get; set; }
[JsonProperty("scheduledEvents")]
public List<ScheduledEventConfig> ScheduledEvents;
public List<ScheduledEventConfig> ScheduledEvents { get; set; }
[JsonProperty("isPrimary")] public bool IsPrimary;
/// <summary>
/// Indicates that the room is the primary when true
/// </summary>
[JsonProperty("isPrimary")]
public bool IsPrimary { get; set; }
[JsonProperty("isTvPresetsProvider")] public bool IsTvPresetsProvider;
/// <summary>
/// Indicates which tuners should mirror preset recall when two rooms are configured in a primary->secondary scenario
/// </summary>
[JsonProperty("mirroredTuners")]
public Dictionary<uint, string> MirroredTuners { get; set; }
/// <summary>
/// Indicates the room
/// </summary>
[JsonProperty("isTvPresetsProvider")]
public bool IsTvPresetsProvider;
public EssentialsTechRoomConfig()
{

View File

@@ -274,10 +274,23 @@ namespace PepperDash.Essentials
CallTypeFeedback = new IntFeedback(() => 0);
SourceListKey = "default";
SetSourceListKey();
EnablePowerOnToLastSource = true;
}
private void SetSourceListKey()
{
if (!string.IsNullOrEmpty(PropertiesConfig.SourceListKey))
{
SetSourceListKey(PropertiesConfig.SourceListKey);
}
else
{
SetSourceListKey(Key);
}
}
void InitializeDisplay(DisplayBase disp)
{
if (disp != null)
@@ -333,7 +346,6 @@ namespace PepperDash.Essentials
this.LogoUrlLightBkgnd = PropertiesConfig.LogoLight.GetLogoUrlLight();
this.LogoUrlDarkBkgnd = PropertiesConfig.LogoDark.GetLogoUrlDark();
this.SourceListKey = PropertiesConfig.SourceListKey;
this.DefaultSourceItem = PropertiesConfig.DefaultSourceItem;
this.DefaultVolume = (ushort)(PropertiesConfig.Volumes.Master.Level * 65535 / 100);

View File

@@ -201,11 +201,25 @@ namespace PepperDash.Essentials
IsCoolingDownFeedback.FireUpdate();
};
}
SetSourceListKey();
SourceListKey = "default";
EnablePowerOnToLastSource = true;
}
private void SetSourceListKey()
{
if (!string.IsNullOrEmpty(PropertiesConfig.SourceListKey))
{
SetSourceListKey(PropertiesConfig.SourceListKey);
}
else
{
SetSourceListKey(Key);
}
}
protected override void CustomSetConfig(DeviceConfig config)
{
var newPropertiesConfig = JsonConvert.DeserializeObject<EssentialsHuddleRoomPropertiesConfig>(config.Properties.ToString());
@@ -256,7 +270,6 @@ namespace PepperDash.Essentials
this.LogoUrlLightBkgnd = PropertiesConfig.LogoLight.GetLogoUrlLight();
this.LogoUrlDarkBkgnd = PropertiesConfig.LogoDark.GetLogoUrlDark();
this.SourceListKey = PropertiesConfig.SourceListKey;
this.DefaultSourceItem = PropertiesConfig.DefaultSourceItem;
this.DefaultVolume = (ushort)(PropertiesConfig.Volumes.Master.Level * 65535 / 100);

View File

@@ -13,7 +13,7 @@ using PepperDash.Essentials.Room.Config;
using PepperDash.Essentials.Devices.Common.Codec;
using PepperDash.Essentials.Devices.Common.VideoCodec;
using PepperDash.Essentials.Devices.Common.AudioCodec;
using PepperDash_Essentials_Core.DeviceTypeInterfaces;
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
namespace PepperDash.Essentials
{
@@ -51,20 +51,6 @@ namespace PepperDash.Essentials
//************************
public override string SourceListKey
{
get
{
return _SourceListKey;
}
set
{
_SourceListKey = value;
SetCodecExternalSources();
}
}
protected override Func<bool> OnFeedbackFunc
{
get
@@ -338,7 +324,8 @@ namespace PepperDash.Essentials
CallTypeFeedback = new IntFeedback(() => 0);
SourceListKey = "default";
SetSourceListKey();
EnablePowerOnToLastSource = true;
}
catch (Exception e)
@@ -347,6 +334,21 @@ namespace PepperDash.Essentials
}
}
private void SetSourceListKey()
{
if (!string.IsNullOrEmpty(PropertiesConfig.SourceListKey))
{
SetSourceListKey(PropertiesConfig.SourceListKey);
}
else
{
SetSourceListKey(Key);
}
SetCodecExternalSources();
}
protected override void CustomSetConfig(DeviceConfig config)
{
var newPropertiesConfig = JsonConvert.DeserializeObject<EssentialsHuddleVtc1PropertiesConfig>(config.Properties.ToString());
@@ -370,13 +372,14 @@ namespace PepperDash.Essentials
this.LogoUrlLightBkgnd = PropertiesConfig.LogoLight.GetLogoUrlLight();
this.LogoUrlDarkBkgnd = PropertiesConfig.LogoDark.GetLogoUrlDark();
this.SourceListKey = PropertiesConfig.SourceListKey;
this.DefaultSourceItem = PropertiesConfig.DefaultSourceItem;
this.DefaultVolume = (ushort)(PropertiesConfig.Volumes.Master.Level * 65535 / 100);
return base.CustomActivate();
}
/// <summary>
///
/// </summary>
@@ -597,12 +600,21 @@ namespace PepperDash.Essentials
if (VideoCodec.UsageTracker.InUseTracker.InUseFeedback.BoolValue)
{
Debug.Console(1, this, "Video Codec in use, deactivating standby on codec");
VideoCodec.StandbyDeactivate();
}
if (VideoCodec.StandbyIsOnFeedback.BoolValue)
{
VideoCodec.StandbyDeactivate();
}
else
{
Debug.Console(1, this, "Video codec not in standby. No need to wake.");
}
}
else
{
Debug.Console(1, this, "Room OnFeedback state: {0}", OnFeedback.BoolValue);
}
// report back when done

View File

@@ -183,11 +183,12 @@ namespace PepperDash.Essentials
var roomEvent = _roomScheduledEventGroup.ScheduledEvents[scheduledEvent.Key];
if (!SchedulerUtilities.CheckEventTimeForMatch(roomEvent, DateTime.Parse(scheduledEvent.Time)) &&
!SchedulerUtilities.CheckEventRecurrenceForMatch(roomEvent, scheduledEvent.Days))
{
return;
}
//if (SchedulerUtilities.CheckEventTimeForMatch(roomEvent, DateTime.Parse(scheduledEvent.Time)) &&
// SchedulerUtilities.CheckEventRecurrenceForMatch(roomEvent, scheduledEvent.Days))
//{
// Debug.Console(1, this, "Existing event matches new event properties. Nothing to update");
// return;
//}
Debug.Console(1, this,
"Existing event does not match new config properties. Deleting existing event '{0}' and creating new event from configuration",
@@ -373,13 +374,32 @@ Params: {2}"
uint i;
if (_config.IsPrimary)
{
i = 0;
foreach (var feedback in CurrentPresetsFeedbacks)
Debug.Console(1, this, "Linking Primary system Tuner Preset Mirroring");
if (_config.MirroredTuners != null && _config.MirroredTuners.Count > 0)
{
feedback.Value.LinkInputSig(trilist.StringInput[(uint) (joinMap.CurrentPreset.JoinNumber + i)]);
i++;
foreach (var tuner in _config.MirroredTuners)
{
var f = CurrentPresetsFeedbacks[tuner.Value];
if (f == null)
{
Debug.Console(1, this, "Unable to find feedback with key: {0}", tuner.Value);
continue;
}
var join = joinMap.CurrentPreset.JoinNumber + tuner.Key;
f.LinkInputSig(trilist.StringInput[(uint)(join)]);
Debug.Console(1, this, "Linked Current Preset feedback for tuner: {0} to serial join: {1}", tuner.Value, join);
}
}
//i = 0;
//foreach (var feedback in CurrentPresetsFeedbacks)
//{
// feedback.Value.LinkInputSig(trilist.StringInput[(uint) (joinMap.CurrentPreset.JoinNumber + i)]);
// i++;
//}
trilist.OnlineStatusChange += (device, args) =>
{
if (!args.DeviceOnLine)
@@ -395,15 +415,35 @@ Params: {2}"
return;
}
i = 0;
foreach (var setTopBox in _tuners)
else
{
var tuner = setTopBox;
Debug.Console(1, this, "Linking Secondary system Tuner Preset Mirroring");
trilist.SetStringSigAction(joinMap.CurrentPreset.JoinNumber + i, s => _tunerPresets.Dial(s, tuner.Value));
if (_config.MirroredTuners != null && _config.MirroredTuners.Count > 0)
{
foreach (var tuner in _config.MirroredTuners)
{
var t = _tuners[tuner.Value];
i++;
if (t == null)
{
Debug.Console(1, this, "Unable to find tuner with key: {0}", tuner.Value);
continue;
}
var join = joinMap.CurrentPreset.JoinNumber + tuner.Key;
trilist.SetStringSigAction(join, s => _tunerPresets.Dial(s, t));
Debug.Console(1, this, "Linked preset recall action for tuner: {0} to serial join: {1}", tuner.Value, join);
}
//foreach (var setTopBox in _tuners)
//{
// var tuner = setTopBox;
// trilist.SetStringSigAction(joinMap.CurrentPreset.JoinNumber + i, s => _tunerPresets.Dial(s, tuner.Value));
//}
}
}
}

View File

@@ -47,7 +47,7 @@ namespace PepperDash.Essentials.Core.Bridges
/// <param name="joinStart">Join this join map will start at</param>
/// <param name="type">Type of the child join map</param>
public AppleTvJoinMap(uint joinStart, Type type) : base(joinStart, type)
{
}
{
}
}
}

View File

@@ -154,7 +154,7 @@ namespace PepperDash.Essentials.Core.Bridges
[JoinName("PirSensitivityInVacantState")]
public JoinDataComplete PirSensitivityInVacantState = new JoinDataComplete(new JoinData { JoinNumber = 8, JoinSpan = 1 },
new JoinMetadata { Description = "Occ Sensor Ultrasonic Sensitivity in Vacant State", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
new JoinMetadata { Description = "Occ Sensor PIR Sensitivity in Vacant State", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
[JoinName("Name")]
public JoinDataComplete Name = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },

View File

@@ -1,131 +1,274 @@
using System;
using PepperDash.Essentials.Core;
namespace PepperDash_Essentials_Core.Bridges.JoinMaps
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
});
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("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("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("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("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("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("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
});
[JoinName("Sensitivity")]
public JoinDataComplete Sensitivity = new JoinDataComplete(
new JoinData
{
JoinNumber = 2,
JoinSpan = 1
},
new JoinMetadata
{
Description = "Sensor Sensitivity",
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
JoinType = eJoinType.Analog
});
/// <summary>
/// Constructor to use when instantiating this Join Map without inheriting from it
/// </summary>
/// <param name="joinStart">Join this join map will start at</param>
public GlsPartitionSensorJoinMap(uint joinStart)
: this(joinStart, typeof (GlsPartitionSensorJoinMap))
{
public GlsPartitionSensorJoinMap(uint joinStart)
: this(joinStart, typeof(GlsPartitionSensorJoinMap))
{
}
}
/// <summary>
/// Constructor to use when extending this Join map
/// </summary>
/// <param name="joinStart">Join this join map will start at</param>
/// <param name="type">Type of the child join map</param>
protected GlsPartitionSensorJoinMap(uint joinStart, Type type)
: base(joinStart, type)
{
}
}
}
namespace PepperDash_Essentials_Core.Bridges.JoinMaps
{
/// <summary>
///
/// </summary>
[Obsolete("use PepperDash.Essentials.Core.Bridges.JoinMaps version")]
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
});
/// <summary>
/// Constructor to use when instantiating this Join Map without inheriting from it
/// </summary>
/// <param name="joinStart">Join this join map will start at</param>
public GlsPartitionSensorJoinMap(uint joinStart)
: this(joinStart, typeof(GlsPartitionSensorJoinMap))
{
}
/// <summary>
/// Constructor to use when extending this Join map

View File

@@ -0,0 +1,222 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
namespace PepperDash.Essentials.Core.Bridges
{
/// <summary>
/// Join map for IRBlurayBase devices
/// </summary>
public class IRBlurayBaseJoinMap : JoinMapBaseAdvanced
{
[JoinName("PowerOn")]
public JoinDataComplete PowerOn = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
new JoinMetadata { Description = "Power On", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
[JoinName("PowerOff")]
public JoinDataComplete PowerOff = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
new JoinMetadata { Description = "Power Off", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
[JoinName("PowerToggle")]
public JoinDataComplete PowerToggle = new JoinDataComplete(new JoinData { JoinNumber = 3, JoinSpan = 1 },
new JoinMetadata { Description = "Power Toggle", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
[JoinName("Up")]
public JoinDataComplete Up = new JoinDataComplete(new JoinData { JoinNumber = 4, JoinSpan = 1 },
new JoinMetadata { Description = "Nav Up", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
[JoinName("Down")]
public JoinDataComplete Down = new JoinDataComplete(new JoinData { JoinNumber = 5, JoinSpan = 1 },
new JoinMetadata { Description = "Nav Down", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
[JoinName("Left")]
public JoinDataComplete Left = new JoinDataComplete(new JoinData { JoinNumber = 6, JoinSpan = 1 },
new JoinMetadata { Description = "Nav Left", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
[JoinName("Right")]
public JoinDataComplete Right = new JoinDataComplete(new JoinData { JoinNumber = 7, JoinSpan = 1 },
new JoinMetadata { Description = "Nav Right", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
[JoinName("Select")]
public JoinDataComplete Select = new JoinDataComplete(new JoinData { JoinNumber = 8, JoinSpan = 1 },
new JoinMetadata { Description = "Select", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
[JoinName("Menu")]
public JoinDataComplete Menu = new JoinDataComplete(new JoinData { JoinNumber = 9, JoinSpan = 1 },
new JoinMetadata { Description = "Menu", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
[JoinName("Exit")]
public JoinDataComplete Exit = new JoinDataComplete(new JoinData { JoinNumber = 10, JoinSpan = 1 },
new JoinMetadata { Description = "Exit", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
[JoinName("Digit0")]
public JoinDataComplete Digit0 = new JoinDataComplete(new JoinData { JoinNumber = 11, JoinSpan = 1 },
new JoinMetadata { Description = "Digit 0", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
[JoinName("Digit1")]
public JoinDataComplete Digit1 = new JoinDataComplete(new JoinData { JoinNumber = 12, JoinSpan = 1 },
new JoinMetadata { Description = "Digit 1", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
[JoinName("Digit2")]
public JoinDataComplete Digit2 = new JoinDataComplete(new JoinData { JoinNumber = 13, JoinSpan = 1 },
new JoinMetadata { Description = "Digit 2", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
[JoinName("Digit3")]
public JoinDataComplete Digit3 = new JoinDataComplete(new JoinData { JoinNumber = 14, JoinSpan = 1 },
new JoinMetadata { Description = "Digit 3", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
[JoinName("Digit4")]
public JoinDataComplete Digit4 = new JoinDataComplete(new JoinData { JoinNumber = 15, JoinSpan = 1 },
new JoinMetadata { Description = "Digit 4", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
[JoinName("Digit5")]
public JoinDataComplete Digit5 = new JoinDataComplete(new JoinData { JoinNumber = 16, JoinSpan = 1 },
new JoinMetadata { Description = "Digit 5", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
[JoinName("Digit6")]
public JoinDataComplete Digit6 = new JoinDataComplete(new JoinData { JoinNumber = 17, JoinSpan = 1 },
new JoinMetadata { Description = "Digit 6", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
[JoinName("Digit7")]
public JoinDataComplete Digit7 = new JoinDataComplete(new JoinData { JoinNumber = 18, JoinSpan = 1 },
new JoinMetadata { Description = "Digit 7", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
[JoinName("Digit8")]
public JoinDataComplete Digit8 = new JoinDataComplete(new JoinData { JoinNumber = 19, JoinSpan = 1 },
new JoinMetadata { Description = "Digit 8", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
[JoinName("Digit9")]
public JoinDataComplete Digit9 = new JoinDataComplete(new JoinData { JoinNumber = 20, JoinSpan = 1 },
new JoinMetadata { Description = "Digit 9", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
[JoinName("KeypadClear")]
public JoinDataComplete KeypadClear = new JoinDataComplete(new JoinData { JoinNumber = 21, JoinSpan = 1 },
new JoinMetadata { Description = "Keypad Clear", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
[JoinName("KeypadEnter")]
public JoinDataComplete KeypadEnter = new JoinDataComplete(new JoinData { JoinNumber = 22, JoinSpan = 1 },
new JoinMetadata { Description = "Keypad Enter", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
[JoinName("ChannelUp")]
public JoinDataComplete ChannelUp = new JoinDataComplete(new JoinData { JoinNumber = 23, JoinSpan = 1 },
new JoinMetadata { Description = "STB Channel Up", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
[JoinName("ChannelDown")]
public JoinDataComplete ChannelDown = new JoinDataComplete(new JoinData { JoinNumber = 24, JoinSpan = 1 },
new JoinMetadata { Description = "STB Channel Down", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
[JoinName("LastChannel")]
public JoinDataComplete LastChannel = new JoinDataComplete(new JoinData { JoinNumber = 25, JoinSpan = 1 },
new JoinMetadata { Description = "Last Channel", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
[JoinName("Guide")]
public JoinDataComplete Guide = new JoinDataComplete(new JoinData { JoinNumber = 26, JoinSpan = 1 },
new JoinMetadata { Description = "Guide", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
[JoinName("Info")]
public JoinDataComplete Info = new JoinDataComplete(new JoinData { JoinNumber = 27, JoinSpan = 1 },
new JoinMetadata { Description = "Info", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
[JoinName("Red")]
public JoinDataComplete Red = new JoinDataComplete(new JoinData { JoinNumber = 28, JoinSpan = 1 },
new JoinMetadata { Description = "Red", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
[JoinName("Green")]
public JoinDataComplete Green = new JoinDataComplete(new JoinData { JoinNumber = 29, JoinSpan = 1 },
new JoinMetadata { Description = "Green", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
[JoinName("Yellow")]
public JoinDataComplete Yellow = new JoinDataComplete(new JoinData { JoinNumber = 30, JoinSpan = 1 },
new JoinMetadata { Description = "Yellow", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
[JoinName("Blue")]
public JoinDataComplete Blue = new JoinDataComplete(new JoinData { JoinNumber = 31, JoinSpan = 1 },
new JoinMetadata { Description = "Blue", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
[JoinName("Play")]
public JoinDataComplete Play = new JoinDataComplete(new JoinData { JoinNumber = 33, JoinSpan = 1 },
new JoinMetadata { Description = "Play", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
[JoinName("Pause")]
public JoinDataComplete Pause = new JoinDataComplete(new JoinData { JoinNumber = 34, JoinSpan = 1 },
new JoinMetadata { Description = "Pause", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
[JoinName("Stop")]
public JoinDataComplete Stop = new JoinDataComplete(new JoinData { JoinNumber = 35, JoinSpan = 1 },
new JoinMetadata { Description = "Stop", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
[JoinName("FFwd")]
public JoinDataComplete FFwd = new JoinDataComplete(new JoinData { JoinNumber = 36, JoinSpan = 1 },
new JoinMetadata { Description = "FFwd", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
[JoinName("Rewind")]
public JoinDataComplete Rewind = new JoinDataComplete(new JoinData { JoinNumber = 37, JoinSpan = 1 },
new JoinMetadata { Description = "Rewind", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
[JoinName("ChapPlus")]
public JoinDataComplete ChapPlus = new JoinDataComplete(new JoinData { JoinNumber = 38, JoinSpan = 1 },
new JoinMetadata { Description = "Chapter Plus", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
[JoinName("ChapMinus")]
public JoinDataComplete ChapMinus = new JoinDataComplete(new JoinData { JoinNumber = 39, JoinSpan = 1 },
new JoinMetadata { Description = "Chapter Minus", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
[JoinName("Replay")]
public JoinDataComplete Replay = new JoinDataComplete(new JoinData { JoinNumber = 40, JoinSpan = 1 },
new JoinMetadata { Description = "Replay", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
[JoinName("Record")]
public JoinDataComplete Record = new JoinDataComplete(new JoinData { JoinNumber = 41, JoinSpan = 1 },
new JoinMetadata { Description = "Record", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
[JoinName("HasKeypadAccessoryButton1")]
public JoinDataComplete HasKeypadAccessoryButton1 = new JoinDataComplete(new JoinData { JoinNumber = 42, JoinSpan = 1 },
new JoinMetadata { Description = "Has Keypad Accessory Button 1", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("HasKeypadAccessoryButton2")]
public JoinDataComplete HasKeypadAccessoryButton2 = new JoinDataComplete(new JoinData { JoinNumber = 43, JoinSpan = 1 },
new JoinMetadata { Description = "Has Keypad Accessory Button 2", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("KeypadAccessoryButton1Press")]
public JoinDataComplete KeypadAccessoryButton1Press = new JoinDataComplete(new JoinData { JoinNumber = 42, JoinSpan = 2 },
new JoinMetadata { Description = "Keypad Accessory Button 1 Press", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
[JoinName("KeypadAccessoryButton2Press")]
public JoinDataComplete KeypadAccessoryButton2Press = new JoinDataComplete(new JoinData { JoinNumber = 43, JoinSpan = 2 },
new JoinMetadata { Description = "Keypad Accessory Button 2 Press", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
[JoinName("Name")]
public JoinDataComplete Name = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
new JoinMetadata { Description = "Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("KeypadAccessoryButton1Label")]
public JoinDataComplete KeypadAccessoryButton1Label = new JoinDataComplete(new JoinData { JoinNumber = 42, JoinSpan = 1 },
new JoinMetadata { Description = "Keypad Accessory Button 1 Label", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
[JoinName("KeypadAccessoryButton2Label")]
public JoinDataComplete KeypadAccessoryButton2Label = new JoinDataComplete(new JoinData { JoinNumber = 43, JoinSpan = 1 },
new JoinMetadata { Description = "Keypad Accessory Button 1 Label", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
/// <summary>
/// Constructor to use when instantiating this Join Map without inheriting from it
/// </summary>
/// <param name="joinStart">Join this join map will start at</param>
public IRBlurayBaseJoinMap(uint joinStart)
: this(joinStart, typeof(IRBlurayBaseJoinMap))
{
}
/// <summary>
/// Constructor to use when extending this Join map
/// </summary>
/// <param name="joinStart">Join this join map will start at</param>
/// <param name="type">Type of the child join map</param>
protected IRBlurayBaseJoinMap(uint joinStart, Type type)
: base(joinStart, type)
{
}
}
}

View File

@@ -1,10 +1,10 @@
using System;
namespace PepperDash.Essentials.Core.Bridges
{
public class SetTopBoxControllerJoinMap : JoinMapBaseAdvanced
{
namespace PepperDash.Essentials.Core.Bridges
{
public class SetTopBoxControllerJoinMap : JoinMapBaseAdvanced
{
[JoinName("PowerOn")]
public JoinDataComplete PowerOn = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
new JoinMetadata { Description = "STB Power On", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
@@ -236,5 +236,5 @@ namespace PepperDash.Essentials.Core.Bridges
: base(joinStart, type)
{
}
}
}
}

View File

@@ -7,6 +7,8 @@ using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using Newtonsoft.Json.Linq;
namespace PepperDash.Essentials.Core.Config
{
/// <summary>
@@ -27,7 +29,7 @@ namespace PepperDash.Essentials.Core.Config
public List<TieLineConfig> TieLines { get; set; }
[JsonProperty("joinMaps")]
public Dictionary<string, string> JoinMaps { get; set; }
public Dictionary<string, JObject> JoinMaps { get; set; }
/// <summary>
/// Checks SourceLists for a given list and returns it if found. Otherwise, returns null

View File

@@ -1,195 +1,195 @@
using System;
using System;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Core.Config;
namespace PepperDash.Essentials.Core.Config
{
/// <summary>
/// Loads the ConfigObject from the file
/// </summary>
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Core.Config;
namespace PepperDash.Essentials.Core.Config
{
/// <summary>
/// Loads the ConfigObject from the file
/// </summary>
public class ConfigReader
{
public const string LocalConfigPresent =
@"
***************************************************
************* Using Local config file *************
***************************************************";
public static EssentialsConfig ConfigObject { get; private set; }
public static bool LoadConfig2()
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Loading unmerged system/template portal configuration file.");
try
{
// Check for local config file first
var filePath = Global.FilePathPrefix + ConfigWriter.LocalConfigFolder + Global.DirectorySeparator + Global.ConfigFileName;
bool localConfigFound = false;
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to load Local config file: '{0}'", filePath);
// Check for local config directory first
var configFiles = GetConfigFiles(filePath);
if (configFiles != null)
{
if (configFiles.Length > 1)
{
Debug.Console(0, Debug.ErrorLogLevel.Error,
"****Error: Multiple Local Configuration files present. Please ensure only a single file exists and reset program.****");
return false;
}
if(configFiles.Length == 1)
{
***************************************************";
public static EssentialsConfig ConfigObject { get; private set; }
public static bool LoadConfig2()
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Loading unmerged system/template portal configuration file.");
try
{
// Check for local config file first
var filePath = Global.FilePathPrefix + ConfigWriter.LocalConfigFolder + Global.DirectorySeparator + Global.ConfigFileName;
bool localConfigFound = false;
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to load Local config file: '{0}'", filePath);
// Check for local config directory first
var configFiles = GetConfigFiles(filePath);
if (configFiles != null)
{
if (configFiles.Length > 1)
{
Debug.Console(0, Debug.ErrorLogLevel.Error,
"****Error: Multiple Local Configuration files present. Please ensure only a single file exists and reset program.****");
return false;
}
if(configFiles.Length == 1)
{
localConfigFound = true;
}
}
else
{
Debug.Console(0, Debug.ErrorLogLevel.Notice,
"Local Configuration file not present.", filePath);
}
// Check for Portal Config
if(!localConfigFound)
{
filePath = Global.FilePathPrefix + Global.ConfigFileName;
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to load Portal config file: '{0}'", filePath);
configFiles = GetConfigFiles(filePath);
if (configFiles != null)
{
Debug.Console(2, "{0} config files found matching pattern", configFiles.Length);
if (configFiles.Length > 1)
{
Debug.Console(0, Debug.ErrorLogLevel.Error,
"****Error: Multiple Portal Configuration files present. Please ensure only a single file exists and reset program.****");
return false;
}
else if (configFiles.Length == 1)
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Found Portal config file: '{0}'", filePath);
}
else
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "No config file found.");
return false;
}
}
else
{
Debug.Console(0, Debug.ErrorLogLevel.Error,
"ERROR: Portal Configuration file not present. Please load file and reset program.");
return false;
}
}
// Get the actual file path
}
}
else
{
Debug.Console(0, Debug.ErrorLogLevel.Notice,
"Local Configuration file not present.", filePath);
}
// Check for Portal Config
if(!localConfigFound)
{
filePath = Global.FilePathPrefix + Global.ConfigFileName;
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to load Portal config file: '{0}'", filePath);
configFiles = GetConfigFiles(filePath);
if (configFiles != null)
{
Debug.Console(2, "{0} config files found matching pattern", configFiles.Length);
if (configFiles.Length > 1)
{
Debug.Console(0, Debug.ErrorLogLevel.Error,
"****Error: Multiple Portal Configuration files present. Please ensure only a single file exists and reset program.****");
return false;
}
else if (configFiles.Length == 1)
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Found Portal config file: '{0}'", filePath);
}
else
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "No config file found.");
return false;
}
}
else
{
Debug.Console(0, Debug.ErrorLogLevel.Error,
"ERROR: Portal Configuration file not present. Please load file and reset program.");
return false;
}
}
// Get the actual file path
filePath = configFiles[0].FullName;
// Generate debug statement if using a local file.
if (localConfigFound)
{
GetLocalFileMessage(filePath);
}
// Read the file
using (StreamReader fs = new StreamReader(filePath))
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Loading config file: '{0}'", filePath);
if (localConfigFound)
{
ConfigObject = JObject.Parse(fs.ReadToEnd()).ToObject<EssentialsConfig>();
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Successfully Loaded Local Config");
return true;
}
else
{
var doubleObj = JObject.Parse(fs.ReadToEnd());
ConfigObject = PortalConfigReader.MergeConfigs(doubleObj).ToObject<EssentialsConfig>();
// Extract SystemUrl and TemplateUrl into final config output
if (doubleObj["system_url"] != null)
{
ConfigObject.SystemUrl = doubleObj["system_url"].Value<string>();
}
if (doubleObj["template_url"] != null)
{
ConfigObject.TemplateUrl = doubleObj["template_url"].Value<string>();
}
}
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Successfully Loaded Merged Config");
return true;
}
}
catch (Exception e)
{
Debug.Console(0, Debug.ErrorLogLevel.Error, "ERROR: Config load failed: \r{0}", e);
return false;
}
}
/// <summary>
/// Returns all the files from the directory specified.
/// </summary>
/// <param name="filePath"></param>
/// <returns></returns>
public static FileInfo[] GetConfigFiles(string filePath)
{
// Get the directory
var dir = Path.GetDirectoryName(filePath);
if (Directory.Exists(dir))
{
Debug.Console(1, "Searching in Directory '{0}'", dir);
// Get the directory info
var dirInfo = new DirectoryInfo(dir);
// Get the file name
var fileName = Path.GetFileName(filePath);
Debug.Console(1, "For Config Files matching: '{0}'", fileName);
// Get the files that match from the directory
return dirInfo.GetFiles(fileName);
}
else
{
Debug.Console(0, Debug.ErrorLogLevel.Notice,
"Directory not found: ", dir);
return null;
}
}
/// <summary>
/// Returns the group for a given device key in config
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
public static string GetGroupForDeviceKey(string key)
{
var dev = ConfigObject.Devices.FirstOrDefault(d => d.Key.Equals(key, StringComparison.OrdinalIgnoreCase));
return dev == null ? null : dev.Group;
}
// Read the file
using (StreamReader fs = new StreamReader(filePath))
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Loading config file: '{0}'", filePath);
if (localConfigFound)
{
ConfigObject = JObject.Parse(fs.ReadToEnd()).ToObject<EssentialsConfig>();
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Successfully Loaded Local Config");
return true;
}
else
{
var doubleObj = JObject.Parse(fs.ReadToEnd());
ConfigObject = PortalConfigReader.MergeConfigs(doubleObj).ToObject<EssentialsConfig>();
// Extract SystemUrl and TemplateUrl into final config output
if (doubleObj["system_url"] != null)
{
ConfigObject.SystemUrl = doubleObj["system_url"].Value<string>();
}
if (doubleObj["template_url"] != null)
{
ConfigObject.TemplateUrl = doubleObj["template_url"].Value<string>();
}
}
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Successfully Loaded Merged Config");
return true;
}
}
catch (Exception e)
{
Debug.Console(0, Debug.ErrorLogLevel.Error, "ERROR: Config load failed: \r{0}", e);
return false;
}
}
/// <summary>
/// Returns all the files from the directory specified.
/// </summary>
/// <param name="filePath"></param>
/// <returns></returns>
public static FileInfo[] GetConfigFiles(string filePath)
{
// Get the directory
var dir = Path.GetDirectoryName(filePath);
if (Directory.Exists(dir))
{
Debug.Console(1, "Searching in Directory '{0}'", dir);
// Get the directory info
var dirInfo = new DirectoryInfo(dir);
// Get the file name
var fileName = Path.GetFileName(filePath);
Debug.Console(1, "For Config Files matching: '{0}'", fileName);
// Get the files that match from the directory
return dirInfo.GetFiles(fileName);
}
else
{
Debug.Console(0, Debug.ErrorLogLevel.Notice,
"Directory not found: ", dir);
return null;
}
}
/// <summary>
/// Returns the group for a given device key in config
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
public static string GetGroupForDeviceKey(string key)
{
var dev = ConfigObject.Devices.FirstOrDefault(d => d.Key.Equals(key, StringComparison.OrdinalIgnoreCase));
return dev == null ? null : dev.Group;
}
private static void GetLocalFileMessage(string filePath)
@@ -248,7 +248,7 @@ namespace PepperDash.Essentials.Core.Config
Debug.Console(2, Debug.ErrorLogLevel.Notice, "Found Local config file: '{0}'", filePath);
Debug.Console(0, newDebugString.ToString());
}
}
}
}
}

View File

@@ -130,6 +130,12 @@ namespace PepperDash.Essentials.Core
void Hardware_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args)
{
Debug.Console(2, this, "OnlineStatusChange Event. Online = {0}", args.DeviceOnLine);
if (!Hardware.Registered)
{
return; // protects in cases where device has been unregistered and feedbacks would attempt to access null sigs.
}
foreach (var feedback in Feedbacks)
{
if (feedback != null)

View File

@@ -1,8 +1,20 @@
namespace PepperDash_Essentials_Core.DeviceTypeInterfaces
using System;
namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
{
public interface IHasBranding
{
bool BrandingEnabled { get; }
void InitializeBranding(string roomKey);
}
}
namespace PepperDash_Essentials_Core.DeviceTypeInterfaces
{
[Obsolete("Use PepperDash.Essentials.Core.DeviceTypeInterfaces")]
public interface IHasBranding
{
bool BrandingEnabled { get; }
void InitializeBranding(string roomKey);
}
}

View File

@@ -1,6 +1,7 @@
using PepperDash.Essentials.Core;
using System;
using PepperDash.Essentials.Core;
namespace PepperDash_Essentials_Core.DeviceTypeInterfaces
namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
{
public interface IHasPhoneDialing
{
@@ -11,4 +12,18 @@ namespace PepperDash_Essentials_Core.DeviceTypeInterfaces
void EndPhoneCall();
void SendDtmfToPhone(string digit);
}
}
namespace PepperDash_Essentials_Core.DeviceTypeInterfaces
{
[Obsolete("Use PepperDash.Essentials.Core.DeviceTypeInterfaces")]
public interface IHasPhoneDialing
{
BoolFeedback PhoneOffHookFeedback { get; }
StringFeedback CallerIdNameFeedback { get; }
StringFeedback CallerIdNumberFeedback { get; }
void DialPhoneCall(string number);
void EndPhoneCall();
void SendDtmfToPhone(string digit);
}
}

View File

@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
namespace PepperDash_Essentials_Core.DeviceTypeInterfaces
namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
{
public interface ILanguageDefinition
{
@@ -15,4 +15,21 @@ namespace PepperDash_Essentials_Core.DeviceTypeInterfaces
List<LanguageLabel> DestinationGroupNames { get; set; }
List<LanguageLabel> RoomNames { get; set; }
}
}
namespace PepperDash_Essentials_Core.DeviceTypeInterfaces
{
[Obsolete("Use PepperDash.Essentials.Core.DeviceTypeInterfaces")]
public interface ILanguageDefinition
{
string LocaleName { get; set; }
string FriendlyName { get; set; }
bool Enable { get; set; }
List<LanguageLabel> UiLabels { get; set; }
List<LanguageLabel> Sources { get; set; }
List<LanguageLabel> Destinations { get; set; }
List<LanguageLabel> SourceGroupNames { get; set; }
List<LanguageLabel> DestinationGroupNames { get; set; }
List<LanguageLabel> RoomNames { get; set; }
}
}

View File

@@ -1,9 +1,21 @@
using System;
using System.Collections.Generic;
namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
{
public interface ILanguageProvider
{
ILanguageDefinition CurrentLanguage { get; set; }
event EventHandler CurrentLanguageChanged;
}
}
namespace PepperDash_Essentials_Core.DeviceTypeInterfaces
{
public interface ILanguageProvider
[Obsolete("Use PepperDash.Essentials.Core.DeviceTypeInterfaces")]
public interface ILanguageProvider
{
ILanguageDefinition CurrentLanguage { get; set; }

View File

@@ -31,7 +31,7 @@ namespace PepperDash.Essentials.Core
/// </summary>
bool HasDpad { get; }
PepperDash.Essentials.Core.Presets.DevicePresetsModel PresetsModel { get; }
PepperDash.Essentials.Core.Presets.DevicePresetsModel TvPresets { get; }
void LoadPresets(string filePath);
void DvrList(bool pressRelease);

View File

@@ -1,6 +1,7 @@
using PepperDash.Core;
using System;
using PepperDash.Core;
namespace PepperDash_Essentials_Core.DeviceTypeInterfaces
namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
{
public class LanguageLabel
{
@@ -9,4 +10,16 @@ namespace PepperDash_Essentials_Core.DeviceTypeInterfaces
public string DisplayText { get; set; }
public uint JoinNumber { get; set; }
}
}
namespace PepperDash_Essentials_Core.DeviceTypeInterfaces
{
[Obsolete("Use PepperDash.Essentials.Core.DeviceTypeInterfaces")]
public class LanguageLabel
{
public string Key { get; set; }
public string Description { get; set; }
public string DisplayText { get; set; }
public uint JoinNumber { get; set; }
}
}

View File

@@ -83,13 +83,13 @@ namespace PepperDash.Essentials.Core
/// <returns></returns>
public static object GetPropertyByName(string deviceObjectPath, string propertyName)
{
var obj = FindObjectOnPath(deviceObjectPath);
if(obj == null)
var dev = FindObjectOnPath(deviceObjectPath);
if(dev == null)
return "{ \"error\":\"No Device\"}";
object prop = dev.GetType().GetCType().GetProperty(propertyName).GetValue(dev, null);
CType t = obj.GetType();
var prop = t.GetProperty(propertyName);
// var prop = t.GetProperty(propertyName);
if (prop != null)
{
return prop;

View File

@@ -360,9 +360,9 @@ namespace PepperDash.Essentials.Core
{
var device = GetDeviceForKey(s);
if (device == null) return;
var inputPorts = (device as IRoutingInputsOutputs).InputPorts;
var outputPorts = (device as IRoutingInputsOutputs).OutputPorts;
if (device == null) return;
var inputPorts = ((device as IRoutingInputs) != null) ? (device as IRoutingInputs).InputPorts : null;
var outputPorts = ((device as IRoutingOutputs) != null) ? (device as IRoutingOutputs).OutputPorts : null;
if (inputPorts != null)
{
Debug.Console(0, "Device {0} has {1} Input Ports:", s, inputPorts.Count);

View File

@@ -7,7 +7,7 @@ using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.Core.Config;
namespace PepperDash_Essentials_Core.Devices
namespace PepperDash.Essentials.Core.Devices
{
public class GenericIrController: EssentialsBridgeableDevice
{

View File

@@ -67,13 +67,13 @@ namespace PepperDash.Essentials.Core
/// <returns></returns>
public static void AddFactoryForType(string typeName, Func<DeviceConfig, IKeyed> method)
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Adding factory method for type '{0}'", typeName);
Debug.Console(1, Debug.ErrorLogLevel.Notice, "Adding factory method for type '{0}'", typeName);
DeviceFactory.FactoryMethods.Add(typeName, new DeviceFactoryWrapper() { FactoryMethod = method});
}
public static void AddFactoryForType(string typeName, string description, CType cType, Func<DeviceConfig, IKeyed> method)
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Adding factory method for type '{0}'", typeName);
Debug.Console(1, Debug.ErrorLogLevel.Notice, "Adding factory method for type '{0}'", typeName);
if(FactoryMethods.ContainsKey(typeName))
{

View File

@@ -3,8 +3,9 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
namespace PepperDash_Essentials_Core
namespace PepperDash.Essentials.Core
{
public class IsReadyEventArgs : EventArgs
{
@@ -16,6 +17,27 @@ namespace PepperDash_Essentials_Core
}
}
public interface IHasReady
{
event EventHandler<IsReadyEventArgs> IsReadyEvent;
bool IsReady { get; }
}
}
namespace PepperDash_Essentials_Core
{
[Obsolete("Use PepperDash.Essentials.Core")]
public class IsReadyEventArgs : EventArgs
{
public bool IsReady { get; set; }
public IsReadyEventArgs(bool data)
{
IsReady = data;
}
}
[Obsolete("Use PepperDash.Essentials.Core")]
public interface IHasReady
{
event EventHandler<IsReadyEventArgs> IsReadyEvent;

View File

@@ -16,6 +16,8 @@ namespace PepperDash.Essentials.Core.Fusion
{
public class EssentialsHuddleSpaceFusionSystemControllerBase : Device, IOccupancyStatusProvider
{
protected EssentialsHuddleSpaceRoomFusionRoomJoinMap JoinMap;
private const string RemoteOccupancyXml = "<Occupancy><Type>Local</Type><State>{0}</State></Occupancy>";
private readonly bool _guidFileExists;
@@ -84,11 +86,24 @@ namespace PepperDash.Essentials.Core.Fusion
#endregion
public EssentialsHuddleSpaceFusionSystemControllerBase(EssentialsRoomBase room, uint ipId)
public EssentialsHuddleSpaceFusionSystemControllerBase(EssentialsRoomBase room, uint ipId, string joinMapKey)
: base(room.Key + "-fusion")
{
try
{
JoinMap = new EssentialsHuddleSpaceRoomFusionRoomJoinMap(1);
CrestronConsole.AddNewConsoleCommand((o) => JoinMap.PrintJoinMapInfo(), string.Format("ptjnmp-{0}", Key), "Prints Attribute Join Map", ConsoleAccessLevelEnum.AccessOperator);
if (!string.IsNullOrEmpty(joinMapKey))
{
var customJoins = JoinMapHelper.TryGetJoinMapAdvancedForDevice(joinMapKey);
if (customJoins != null)
{
JoinMap.SetCustomJoinData(customJoins);
}
}
Room = room;
_ipId = ipId;
@@ -319,7 +334,7 @@ namespace PepperDash.Essentials.Core.Fusion
"Requests schedule of the room for the next 24 hours", ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(ModifyMeetingEndTimeConsoleHelper, "FusReqRoomSchMod",
"Ends or extends a meeting by the specified time", ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(CreateAsHocMeeting, "FusCreateMeeting",
CrestronConsole.AddNewConsoleCommand(CreateAdHocMeeting, "FusCreateMeeting",
"Creates and Ad Hoc meeting for on hour or until the next meeting",
ConsoleAccessLevelEnum.AccessOperator);
@@ -327,7 +342,7 @@ namespace PepperDash.Essentials.Core.Fusion
Room.OnFeedback.LinkInputSig(FusionRoom.SystemPowerOn.InputSig);
// Moved to
CurrentRoomSourceNameSig = FusionRoom.CreateOffsetStringSig(84, "Display 1 - Current Source",
CurrentRoomSourceNameSig = FusionRoom.CreateOffsetStringSig(JoinMap.Display1CurrentSourceName.JoinNumber, JoinMap.Display1CurrentSourceName.AttributeName,
eSigIoMask.InputSigOnly);
// Don't think we need to get current status of this as nothing should be alive yet.
var hasCurrentSourceInfoChange = Room as IHasCurrentSourceInfoChange;
@@ -377,24 +392,24 @@ namespace PepperDash.Essentials.Core.Fusion
var response = string.Empty;
var systemReboot = FusionRoom.CreateOffsetBoolSig(74, "Processor - Reboot", eSigIoMask.OutputSigOnly);
var systemReboot = FusionRoom.CreateOffsetBoolSig(JoinMap.ProcessorReboot.JoinNumber, JoinMap.ProcessorReboot.AttributeName, eSigIoMask.OutputSigOnly);
systemReboot.OutputSig.SetSigFalseAction(
() => CrestronConsole.SendControlSystemCommand("reboot", ref response));
}
protected void SetUpEthernetValues()
{
_ip1 = FusionRoom.CreateOffsetStringSig(50, "Info - Processor - IP 1", eSigIoMask.InputSigOnly);
_ip2 = FusionRoom.CreateOffsetStringSig(51, "Info - Processor - IP 2", eSigIoMask.InputSigOnly);
_gateway = FusionRoom.CreateOffsetStringSig(52, "Info - Processor - Gateway", eSigIoMask.InputSigOnly);
_hostname = FusionRoom.CreateOffsetStringSig(53, "Info - Processor - Hostname", eSigIoMask.InputSigOnly);
_domain = FusionRoom.CreateOffsetStringSig(54, "Info - Processor - Domain", eSigIoMask.InputSigOnly);
_dns1 = FusionRoom.CreateOffsetStringSig(55, "Info - Processor - DNS 1", eSigIoMask.InputSigOnly);
_dns2 = FusionRoom.CreateOffsetStringSig(56, "Info - Processor - DNS 2", eSigIoMask.InputSigOnly);
_mac1 = FusionRoom.CreateOffsetStringSig(57, "Info - Processor - MAC 1", eSigIoMask.InputSigOnly);
_mac2 = FusionRoom.CreateOffsetStringSig(58, "Info - Processor - MAC 2", eSigIoMask.InputSigOnly);
_netMask1 = FusionRoom.CreateOffsetStringSig(59, "Info - Processor - Net Mask 1", eSigIoMask.InputSigOnly);
_netMask2 = FusionRoom.CreateOffsetStringSig(60, "Info - Processor - Net Mask 2", eSigIoMask.InputSigOnly);
_ip1 = FusionRoom.CreateOffsetStringSig(JoinMap.ProcessorIp1.JoinNumber, JoinMap.ProcessorIp1.AttributeName, eSigIoMask.InputSigOnly);
_ip2 = FusionRoom.CreateOffsetStringSig(JoinMap.ProcessorIp2.JoinNumber, JoinMap.ProcessorIp2.AttributeName, eSigIoMask.InputSigOnly);
_gateway = FusionRoom.CreateOffsetStringSig(JoinMap.ProcessorGateway.JoinNumber, JoinMap.ProcessorGateway.AttributeName, eSigIoMask.InputSigOnly);
_hostname = FusionRoom.CreateOffsetStringSig(JoinMap.ProcessorHostname.JoinNumber, JoinMap.ProcessorHostname.AttributeName, eSigIoMask.InputSigOnly);
_domain = FusionRoom.CreateOffsetStringSig(JoinMap.ProcessorDomain.JoinNumber, JoinMap.ProcessorDomain.AttributeName, eSigIoMask.InputSigOnly);
_dns1 = FusionRoom.CreateOffsetStringSig(JoinMap.ProcessorDns1.JoinNumber, JoinMap.ProcessorDns1.AttributeName, eSigIoMask.InputSigOnly);
_dns2 = FusionRoom.CreateOffsetStringSig(JoinMap.ProcessorDns2.JoinNumber, JoinMap.ProcessorDns2.AttributeName, eSigIoMask.InputSigOnly);
_mac1 = FusionRoom.CreateOffsetStringSig(JoinMap.ProcessorMac1.JoinNumber, JoinMap.ProcessorMac1.AttributeName, eSigIoMask.InputSigOnly);
_mac2 = FusionRoom.CreateOffsetStringSig(JoinMap.ProcessorMac2.JoinNumber, JoinMap.ProcessorMac2.AttributeName, eSigIoMask.InputSigOnly);
_netMask1 = FusionRoom.CreateOffsetStringSig(JoinMap.ProcessorNetMask1.JoinNumber, JoinMap.ProcessorNetMask1.AttributeName, eSigIoMask.InputSigOnly);
_netMask2 = FusionRoom.CreateOffsetStringSig(JoinMap.ProcessorNetMask2.JoinNumber, JoinMap.ProcessorNetMask2.AttributeName, eSigIoMask.InputSigOnly);
}
protected void GetProcessorEthernetValues()
@@ -447,16 +462,16 @@ namespace PepperDash.Essentials.Core.Fusion
protected void GetProcessorInfo()
{
_firmware = FusionRoom.CreateOffsetStringSig(61, "Info - Processor - Firmware", eSigIoMask.InputSigOnly);
_firmware = FusionRoom.CreateOffsetStringSig(JoinMap.ProcessorFirmware.JoinNumber, JoinMap.ProcessorFirmware.AttributeName, eSigIoMask.InputSigOnly);
if (CrestronEnvironment.DevicePlatform != eDevicePlatform.Server)
{
for (var i = 0; i < Global.ControlSystem.NumProgramsSupported; i++)
{
var join = 62 + i;
var join = JoinMap.ProgramNameStart.JoinNumber + i;
var progNum = i + 1;
_program[i] = FusionRoom.CreateOffsetStringSig((uint) join,
string.Format("Info - Processor - Program {0}", progNum), eSigIoMask.InputSigOnly);
string.Format("{0} {1}", JoinMap.ProgramNameStart.AttributeName, progNum), eSigIoMask.InputSigOnly);
}
}
@@ -484,57 +499,60 @@ namespace PepperDash.Essentials.Core.Fusion
{
if (args.DeviceOnLine)
{
CrestronEnvironment.Sleep(200);
// Send Push Notification Action request:
const string requestId = "InitialPushRequest";
var actionRequest =
string.Format("<RequestAction>\n<RequestID>{0}</RequestID>\n", requestId) +
"<ActionID>RegisterPushModel</ActionID>\n" +
"<Parameters>\n" +
"<Parameter ID='Enabled' Value='1' />\n" +
"<Parameter ID='RequestID' Value='PushNotification' />\n" +
"<Parameter ID='Start' Value='00:00:00' />\n" +
"<Parameter ID='HourSpan' Value='24' />\n" +
"<Parameter ID='Field' Value='MeetingID' />\n" +
"<Parameter ID='Field' Value='RVMeetingID' />\n" +
"<Parameter ID='Field' Value='InstanceID' />\n" +
"<Parameter ID='Field' Value='dtStart' />\n" +
"<Parameter ID='Field' Value='dtEnd' />\n" +
"<Parameter ID='Field' Value='Subject' />\n" +
"<Parameter ID='Field' Value='Organizer' />\n" +
"<Parameter ID='Field' Value='IsEvent' />\n" +
"<Parameter ID='Field' Value='IsPrivate' />\n" +
"<Parameter ID='Field' Value='IsExchangePrivate' />\n" +
"<Parameter ID='Field' Value='LiveMeeting' />\n" +
"<Parameter ID='Field' Value='ShareDocPath' />\n" +
"<Parameter ID='Field' Value='PhoneNo' />\n" +
"<Parameter ID='Field' Value='ParticipantCode' />\n" +
"</Parameters>\n" +
"</RequestAction>\n";
Debug.Console(2, this, "Sending Fusion ActionRequest: \n{0}", actionRequest);
FusionRoom.ExtenderFusionRoomDataReservedSigs.ActionQuery.StringValue = actionRequest;
GetCustomProperties();
// Request current Fusion Server Time
RequestLocalDateTime(null);
// Setup timer to request time daily
if (_dailyTimeRequestTimer != null && !_dailyTimeRequestTimer.Disposed)
CrestronInvoke.BeginInvoke( (o) =>
{
_dailyTimeRequestTimer.Stop();
_dailyTimeRequestTimer.Dispose();
}
CrestronEnvironment.Sleep(200);
_dailyTimeRequestTimer = new CTimer(RequestLocalDateTime, null, 86400000, 86400000);
// Send Push Notification Action request:
_dailyTimeRequestTimer.Reset(86400000, 86400000);
const string requestId = "InitialPushRequest";
var actionRequest =
string.Format("<RequestAction>\n<RequestID>{0}</RequestID>\n", requestId) +
"<ActionID>RegisterPushModel</ActionID>\n" +
"<Parameters>\n" +
"<Parameter ID='Enabled' Value='1' />\n" +
"<Parameter ID='RequestID' Value='PushNotification' />\n" +
"<Parameter ID='Start' Value='00:00:00' />\n" +
"<Parameter ID='HourSpan' Value='24' />\n" +
"<Parameter ID='Field' Value='MeetingID' />\n" +
"<Parameter ID='Field' Value='RVMeetingID' />\n" +
"<Parameter ID='Field' Value='InstanceID' />\n" +
"<Parameter ID='Field' Value='dtStart' />\n" +
"<Parameter ID='Field' Value='dtEnd' />\n" +
"<Parameter ID='Field' Value='Subject' />\n" +
"<Parameter ID='Field' Value='Organizer' />\n" +
"<Parameter ID='Field' Value='IsEvent' />\n" +
"<Parameter ID='Field' Value='IsPrivate' />\n" +
"<Parameter ID='Field' Value='IsExchangePrivate' />\n" +
"<Parameter ID='Field' Value='LiveMeeting' />\n" +
"<Parameter ID='Field' Value='ShareDocPath' />\n" +
"<Parameter ID='Field' Value='PhoneNo' />\n" +
"<Parameter ID='Field' Value='ParticipantCode' />\n" +
"</Parameters>\n" +
"</RequestAction>\n";
Debug.Console(2, this, "Sending Fusion ActionRequest: \n{0}", actionRequest);
FusionRoom.ExtenderFusionRoomDataReservedSigs.ActionQuery.StringValue = actionRequest;
GetCustomProperties();
// Request current Fusion Server Time
RequestLocalDateTime(null);
// Setup timer to request time daily
if (_dailyTimeRequestTimer != null && !_dailyTimeRequestTimer.Disposed)
{
_dailyTimeRequestTimer.Stop();
_dailyTimeRequestTimer.Dispose();
}
_dailyTimeRequestTimer = new CTimer(RequestLocalDateTime, null, 86400000, 86400000);
_dailyTimeRequestTimer.Reset(86400000, 86400000);
});
}
}
@@ -641,7 +659,7 @@ namespace PepperDash.Essentials.Core.Fusion
/// <summary>
/// Creates and Ad Hoc meeting with a duration of 1 hour, or until the next meeting if in less than 1 hour.
/// </summary>
public void CreateAsHocMeeting(string command)
public void CreateAdHocMeeting(string command)
{
const string requestId = "CreateAdHocMeeting";
@@ -1031,9 +1049,9 @@ namespace PepperDash.Essentials.Core.Fusion
uint i = 1;
foreach (var kvp in setTopBoxes)
{
TryAddRouteActionSigs("Display 1 - Source TV " + i, 188 + i, kvp.Key, kvp.Value.SourceDevice);
TryAddRouteActionSigs(JoinMap.Display1SetTopBoxSourceStart.AttributeName + " " + i, JoinMap.Display1SetTopBoxSourceStart.JoinNumber + i, kvp.Key, kvp.Value.SourceDevice);
i++;
if (i > 5) // We only have five spots
if (i > JoinMap.Display1SetTopBoxSourceStart.JoinSpan) // We only have five spots
{
break;
}
@@ -1043,9 +1061,9 @@ namespace PepperDash.Essentials.Core.Fusion
i = 1;
foreach (var kvp in discPlayers)
{
TryAddRouteActionSigs("Display 1 - Source DVD " + i, 181 + i, kvp.Key, kvp.Value.SourceDevice);
TryAddRouteActionSigs(JoinMap.Display1DiscPlayerSourceStart.AttributeName + " " + i, JoinMap.Display1DiscPlayerSourceStart.JoinNumber + i, kvp.Key, kvp.Value.SourceDevice);
i++;
if (i > 5) // We only have five spots
if (i > JoinMap.Display1DiscPlayerSourceStart.JoinSpan) // We only have five spots
{
break;
}
@@ -1055,9 +1073,9 @@ namespace PepperDash.Essentials.Core.Fusion
i = 1;
foreach (var kvp in laptops)
{
TryAddRouteActionSigs("Display 1 - Source Laptop " + i, 166 + i, kvp.Key, kvp.Value.SourceDevice);
TryAddRouteActionSigs(JoinMap.Display1LaptopSourceStart.AttributeName + " " + i, JoinMap.Display1LaptopSourceStart.JoinNumber + i, kvp.Key, kvp.Value.SourceDevice);
i++;
if (i > 10) // We only have ten spots???
if (i > JoinMap.Display1LaptopSourceStart.JoinSpan) // We only have ten spots???
{
break;
}
@@ -1180,12 +1198,12 @@ namespace PepperDash.Essentials.Core.Fusion
{
attrNum = attrNum + touchpanelNum;
if (attrNum > 10)
if (attrNum > JoinMap.XpanelOnlineStart.JoinSpan)
{
continue;
}
attrName = "Online - XPanel " + attrNum;
attrNum += 160;
attrName = JoinMap.XpanelOnlineStart.AttributeName + " " + attrNum;
attrNum += JoinMap.XpanelOnlineStart.JoinNumber;
touchpanelNum++;
}
@@ -1193,12 +1211,12 @@ namespace PepperDash.Essentials.Core.Fusion
{
attrNum = attrNum + xpanelNum;
if (attrNum > 10)
if (attrNum > JoinMap.TouchpanelOnlineStart.JoinSpan)
{
continue;
}
attrName = "Online - Touch Panel " + attrNum;
attrNum += 150;
attrName = JoinMap.TouchpanelOnlineStart.AttributeName + " " + attrNum;
attrNum += JoinMap.TouchpanelOnlineStart.JoinNumber;
xpanelNum++;
}
@@ -1208,12 +1226,12 @@ namespace PepperDash.Essentials.Core.Fusion
if (dev is DisplayBase)
{
attrNum = attrNum + displayNum;
if (attrNum > 10)
if (attrNum > JoinMap.DisplayOnlineStart.JoinSpan)
{
continue;
}
attrName = "Online - Display " + attrNum;
attrNum += 170;
attrName = JoinMap.DisplayOnlineStart.AttributeName + " " + attrNum;
attrNum += JoinMap.DisplayOnlineStart.JoinNumber;
displayNum++;
}
@@ -1290,7 +1308,7 @@ namespace PepperDash.Essentials.Core.Fusion
FusionRoom.DisplayPowerOn.OutputSig.UserObject = dispPowerOnAction;
FusionRoom.DisplayPowerOff.OutputSig.UserObject = dispPowerOffAction;
MapDisplayToRoomJoins(1, 158, defaultDisplay);
MapDisplayToRoomJoins(1, JoinMap.Display1Start.JoinNumber, defaultDisplay);
var deviceConfig =
@@ -1346,7 +1364,7 @@ namespace PepperDash.Essentials.Core.Fusion
/// <param name="display"></param>
/// <param name="displayIndex"></param>
/// a
protected virtual void MapDisplayToRoomJoins(int displayIndex, int joinOffset, DisplayBase display)
protected virtual void MapDisplayToRoomJoins(int displayIndex, uint joinOffset, DisplayBase display)
{
var displayName = string.Format("Display {0} - ", displayIndex);
@@ -1357,7 +1375,7 @@ namespace PepperDash.Essentials.Core.Fusion
return;
}
// Display volume
var defaultDisplayVolume = FusionRoom.CreateOffsetUshortSig(50, "Volume - Fader01",
var defaultDisplayVolume = FusionRoom.CreateOffsetUshortSig(JoinMap.VolumeFader1.JoinNumber, JoinMap.VolumeFader1.AttributeName,
eSigIoMask.InputOutputSig);
defaultDisplayVolume.OutputSig.UserObject = new Action<ushort>(b =>
{
@@ -1658,20 +1676,46 @@ namespace PepperDash.Essentials.Core.Fusion
public static FusionStaticAsset CreateStaticAsset(this FusionRoom fr, uint number, string name, string type,
string instanceId)
{
Debug.Console(0, "Adding Fusion Static Asset '{0}' to slot {1} with GUID: '{2}'", name, number, instanceId);
try
{
Debug.Console(0, "Adding Fusion Static Asset '{0}' to slot {1} with GUID: '{2}'", name, number, instanceId);
fr.AddAsset(eAssetType.StaticAsset, number, name, type, instanceId);
return fr.UserConfigurableAssetDetails[number].Asset as FusionStaticAsset;
fr.AddAsset(eAssetType.StaticAsset, number, name, type, instanceId);
return fr.UserConfigurableAssetDetails[number].Asset as FusionStaticAsset;
}
catch (InvalidOperationException ex)
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Error creating Static Asset for device: '{0}'. Check that multiple devices don't have missing or duplicate uid properties in configuration. /r/nError: {1}", name, ex);
return null;
}
catch (Exception e)
{
Debug.Console(2, Debug.ErrorLogLevel.Error, "Error creating Static Asset: {0}", e);
return null;
}
}
public static FusionOccupancySensor CreateOccupancySensorAsset(this FusionRoom fr, uint number, string name,
string type, string instanceId)
{
Debug.Console(0, "Adding Fusion Occupancy Sensor Asset '{0}' to slot {1} with GUID: '{2}'", name, number,
instanceId);
try
{
Debug.Console(0, "Adding Fusion Occupancy Sensor Asset '{0}' to slot {1} with GUID: '{2}'", name, number,
instanceId);
fr.AddAsset(eAssetType.OccupancySensor, number, name, type, instanceId);
return fr.UserConfigurableAssetDetails[number].Asset as FusionOccupancySensor;
fr.AddAsset(eAssetType.OccupancySensor, number, name, type, instanceId);
return fr.UserConfigurableAssetDetails[number].Asset as FusionOccupancySensor;
}
catch (InvalidOperationException ex)
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Error creating Static Asset for device: '{0}'. Check that multiple devices don't have missing or duplicate uid properties in configuration. Error: {1}", name, ex);
return null;
}
catch (Exception e)
{
Debug.Console(2, Debug.ErrorLogLevel.Error, "Error creating Static Asset: {0}", e);
return null;
}
}
}

View File

@@ -0,0 +1,150 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Essentials.Core.Bridges;
namespace PepperDash.Essentials.Core.Fusion
{
public class EssentialsHuddleSpaceRoomFusionRoomJoinMap : JoinMapBaseAdvanced
{
// Processor Attributes
[JoinName("ProcessorIp1")]
public JoinDataComplete ProcessorIp1 = new JoinDataComplete(new JoinData { JoinNumber = 50, JoinSpan = 1, AttributeName = "Info - Processor - IP 1" },
new JoinMetadata { Description = "Info - Processor - IP 1", JoinCapabilities = eJoinCapabilities.ToFusion, JoinType = eJoinType.Serial });
[JoinName("ProcessorIp2")]
public JoinDataComplete ProcessorIp2 = new JoinDataComplete(new JoinData { JoinNumber = 51, JoinSpan = 1, AttributeName = "Info - Processor - IP 2" },
new JoinMetadata { Description = "Info - Processor - IP 2", JoinCapabilities = eJoinCapabilities.ToFusion, JoinType = eJoinType.Serial });
[JoinName("ProcessorGateway")]
public JoinDataComplete ProcessorGateway = new JoinDataComplete(new JoinData { JoinNumber = 52, JoinSpan = 1, AttributeName = "Info - Processor - Gateway" },
new JoinMetadata { Description = "Info - Processor - Gateway", JoinCapabilities = eJoinCapabilities.ToFusion, JoinType = eJoinType.Serial });
[JoinName("ProcessorHostname")]
public JoinDataComplete ProcessorHostname = new JoinDataComplete(new JoinData { JoinNumber = 53, JoinSpan = 1, AttributeName = "Info - Processor - Hostname" },
new JoinMetadata { Description = "Info - Processor - Hostname", JoinCapabilities = eJoinCapabilities.ToFusion, JoinType = eJoinType.Serial });
[JoinName("ProcessorDomain")]
public JoinDataComplete ProcessorDomain = new JoinDataComplete(new JoinData { JoinNumber = 54, JoinSpan = 1, AttributeName = "Info - Processor - Domain" },
new JoinMetadata { Description = "Info - Processor - Domain", JoinCapabilities = eJoinCapabilities.ToFusion, JoinType = eJoinType.Serial });
[JoinName("ProcessorDns1")]
public JoinDataComplete ProcessorDns1 = new JoinDataComplete(new JoinData { JoinNumber = 55, JoinSpan = 1, AttributeName = "Info - Processor - DNS 1" },
new JoinMetadata { Description = "Info - Processor - DNS 1", JoinCapabilities = eJoinCapabilities.ToFusion, JoinType = eJoinType.Serial });
[JoinName("ProcessorDns2")]
public JoinDataComplete ProcessorDns2 = new JoinDataComplete(new JoinData { JoinNumber = 56, JoinSpan = 1, AttributeName = "Info - Processor - DNS 2" },
new JoinMetadata { Description = "Info - Processor - DNS 2", JoinCapabilities = eJoinCapabilities.ToFusion, JoinType = eJoinType.Serial });
[JoinName("ProcessorMac1")]
public JoinDataComplete ProcessorMac1 = new JoinDataComplete(new JoinData { JoinNumber = 57, JoinSpan = 1, AttributeName = "Info - Processor - MAC 1" },
new JoinMetadata { Description = "Info - Processor - MAC 1", JoinCapabilities = eJoinCapabilities.ToFusion, JoinType = eJoinType.Serial });
[JoinName("ProcessorMac2")]
public JoinDataComplete ProcessorMac2 = new JoinDataComplete(new JoinData { JoinNumber = 58, JoinSpan = 1, AttributeName = "Info - Processor - MAC 2" },
new JoinMetadata { Description = "Info - Processor - MAC 2", JoinCapabilities = eJoinCapabilities.ToFusion, JoinType = eJoinType.Serial });
[JoinName("ProcessorNetMask1")]
public JoinDataComplete ProcessorNetMask1 = new JoinDataComplete(new JoinData { JoinNumber = 59, JoinSpan = 1, AttributeName = "Info - Processor - Net Mask 1" },
new JoinMetadata { Description = "Info - Processor - Net Mask 1", JoinCapabilities = eJoinCapabilities.ToFusion, JoinType = eJoinType.Serial });
[JoinName("ProcessorNetMask2")]
public JoinDataComplete ProcessorNetMask2 = new JoinDataComplete(new JoinData { JoinNumber = 60, JoinSpan = 1, AttributeName = "Info - Processor - Net Mask 2" },
new JoinMetadata { Description = "Info - Processor - Net Mask 2", JoinCapabilities = eJoinCapabilities.ToFusion, JoinType = eJoinType.Serial });
[JoinName("ProcessorFirmware")]
public JoinDataComplete ProcessorFirmware = new JoinDataComplete(new JoinData { JoinNumber = 61, JoinSpan = 1, AttributeName = "Info - Processor - Firmware" },
new JoinMetadata { Description = "Info - Processor - Firmware", JoinCapabilities = eJoinCapabilities.ToFusion, JoinType = eJoinType.Serial });
[JoinName("ProgramNameStart")]
public JoinDataComplete ProgramNameStart = new JoinDataComplete(new JoinData { JoinNumber = 62, JoinSpan = 10, AttributeName = "Info - Processor - Program" },
new JoinMetadata { Description = "Info - Processor - Program", JoinCapabilities = eJoinCapabilities.ToFusion, JoinType = eJoinType.Serial });
[JoinName("ProcessorReboot")]
public JoinDataComplete ProcessorReboot = new JoinDataComplete(new JoinData { JoinNumber = 74, JoinSpan = 1, AttributeName = "Processor - Reboot" },
new JoinMetadata { Description = "Processor - Reboot", JoinCapabilities = eJoinCapabilities.FromFusion, JoinType = eJoinType.Digital });
// Volume Controls
[JoinName("VolumeFader1")]
public JoinDataComplete VolumeFader1 = new JoinDataComplete(new JoinData { JoinNumber = 50, JoinSpan = 1, AttributeName = "Volume - Fader01" },
new JoinMetadata { Description = "Volume - Fader01", JoinCapabilities = eJoinCapabilities.ToFromFusion, JoinType = eJoinType.Analog });
// Codec Info
[JoinName("VcCodecInCall")]
public JoinDataComplete VcCodecInCall = new JoinDataComplete(new JoinData { JoinNumber = 69, JoinSpan = 1, AttributeName = "Conf - VC 1 In Call" },
new JoinMetadata { Description = "Conf - VC 1 In Call", JoinCapabilities = eJoinCapabilities.ToFusion, JoinType = eJoinType.Digital });
[JoinName("VcCodecOnline")]
public JoinDataComplete VcCodecOnline = new JoinDataComplete(new JoinData { JoinNumber = 122, JoinSpan = 1, AttributeName = "Online - VC 1" },
new JoinMetadata { Description = "Online - VC 1", JoinCapabilities = eJoinCapabilities.ToFusion, JoinType = eJoinType.Digital });
[JoinName("VcCodecIpAddress")]
public JoinDataComplete VcCodecIpAddress = new JoinDataComplete(new JoinData { JoinNumber = 121, JoinSpan = 1, AttributeName = "IP Address - VC" },
new JoinMetadata { Description = "IP Address - VC", JoinCapabilities = eJoinCapabilities.ToFusion, JoinType = eJoinType.Serial });
[JoinName("VcCodecIpPort")]
public JoinDataComplete VcCodecIpPort = new JoinDataComplete(new JoinData { JoinNumber = 150, JoinSpan = 1, AttributeName = "IP Port - VC" },
new JoinMetadata { Description = "IP Port - VC", JoinCapabilities = eJoinCapabilities.ToFusion, JoinType = eJoinType.Serial });
// Source Attributes
[JoinName("Display1CurrentSourceName")]
public JoinDataComplete Display1CurrentSourceName = new JoinDataComplete(new JoinData { JoinNumber = 84, JoinSpan = 1, AttributeName = "Display 1 - Current Source" },
new JoinMetadata { Description = "Display 1 - Current Source", JoinCapabilities = eJoinCapabilities.ToFusion, JoinType = eJoinType.Serial });
// Device Online Status
[JoinName("TouchpanelOnlineStart")]
public JoinDataComplete TouchpanelOnlineStart = new JoinDataComplete(new JoinData { JoinNumber = 150, JoinSpan = 10, AttributeName = "Online - Touch Panel" },
new JoinMetadata { Description = "Online - Touch Panel", JoinCapabilities = eJoinCapabilities.ToFusion, JoinType = eJoinType.Digital });
[JoinName("XpanelOnlineStart")]
public JoinDataComplete XpanelOnlineStart = new JoinDataComplete(new JoinData { JoinNumber = 160, JoinSpan = 5, AttributeName = "Online - XPanel" },
new JoinMetadata { Description = "Online - XPanel", JoinCapabilities = eJoinCapabilities.ToFusion, JoinType = eJoinType.Digital });
[JoinName("DisplayOnlineStart")]
public JoinDataComplete DisplayOnlineStart = new JoinDataComplete(new JoinData { JoinNumber = 170, JoinSpan = 10, AttributeName = "Online - Display" },
new JoinMetadata { Description = "Online - Display", JoinCapabilities = eJoinCapabilities.ToFusion, JoinType = eJoinType.Digital });
[JoinName("Display1LaptopSourceStart")]
public JoinDataComplete Display1LaptopSourceStart = new JoinDataComplete(new JoinData { JoinNumber = 166, JoinSpan = 5, AttributeName = "Display 1 - Source Laptop" },
new JoinMetadata { Description = "Display 1 - Source Laptop", JoinCapabilities = eJoinCapabilities.ToFromFusion, JoinType = eJoinType.Digital });
[JoinName("Display1DiscPlayerSourceStart")]
public JoinDataComplete Display1DiscPlayerSourceStart = new JoinDataComplete(new JoinData { JoinNumber = 181, JoinSpan = 5, AttributeName = "Display 1 - Source Disc Player" },
new JoinMetadata { Description = "Display 1 - Source Disc Player", JoinCapabilities = eJoinCapabilities.ToFromFusion, JoinType = eJoinType.Digital });
[JoinName("Display1SetTopBoxSourceStart")]
public JoinDataComplete Display1SetTopBoxSourceStart = new JoinDataComplete(new JoinData { JoinNumber = 188, JoinSpan = 5, AttributeName = "Display 1 - Source TV" },
new JoinMetadata { Description = "Display 1 - Source TV", JoinCapabilities = eJoinCapabilities.ToFromFusion, JoinType = eJoinType.Digital });
// Display 1
[JoinName("Display1Start")]
public JoinDataComplete Display1Start = new JoinDataComplete(new JoinData { JoinNumber = 158, JoinSpan = 1 },
new JoinMetadata { Description = "Display 1 Start", JoinCapabilities = eJoinCapabilities.ToFromFusion, JoinType = eJoinType.Digital });
/// <summary>
/// Constructor to use when instantiating this Join Map without inheriting from it
/// </summary>
/// <param name="joinStart">Join this join map will start at</param>
public EssentialsHuddleSpaceRoomFusionRoomJoinMap(uint joinStart)
: base(joinStart, typeof(EssentialsHuddleSpaceRoomFusionRoomJoinMap))
{
}
/// <summary>
/// Constructor to use when extending this Join map
/// </summary>
/// <param name="joinStart">Join this join map will start at</param>
/// <param name="type">Type of the child join map</param>
public EssentialsHuddleSpaceRoomFusionRoomJoinMap(uint joinStart, Type type) : base(joinStart, type)
{
}
}
}

View File

@@ -10,9 +10,7 @@ using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
using PepperDash_Essentials_Core;
namespace PepperDash.Essentials.Core

View File

@@ -26,6 +26,8 @@ namespace PepperDash.Essentials.Core
public static LicenseManager LicenseManager { get; set; }
public static eCrestronSeries ProcessorSeries { get { return CrestronEnvironment.ProgramCompatibility; } }
/// <summary>
/// The file path prefix to the folder containing configuration files
/// </summary>

View File

@@ -24,6 +24,10 @@ namespace PepperDash.Essentials.Core
CrestronConsole.AddNewConsoleCommand(ClearEventsFromGroup, "ClearAllEvents", "Clears all scheduled events for this group", ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(ListAllEventGroups, "ListAllEventGroups", "Lists all the event groups by key", ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(ListAllEventsForGroup, "ListEventsForGroup",
"Lists all events for the given group", ConsoleAccessLevelEnum.AccessOperator);
}
/// <summary>
@@ -32,12 +36,26 @@ namespace PepperDash.Essentials.Core
/// <param name="groupName"></param>
static void ClearEventsFromGroup(string groupName)
{
if (!EventGroups.ContainsKey(groupName))
{
Debug.Console(0,
"[Scheduler]: Unable to delete events from group '{0}'. Group not found in EventGroups dictionary.",
groupName);
return;
}
var group = EventGroups[groupName];
if (group != null)
{
group.ClearAllEvents();
Debug.Console(0, "[Scheduler]: All events deleted from group '{0}'", groupName);
}
else
Debug.Console(0, "[Scheduler]: Unable to delete events from group '{0}'. Group not found in EventGroups dictionary.", groupName);
Debug.Console(0,
"[Scheduler]: Unable to delete events from group '{0}'. Group not found in EventGroups dictionary.",
groupName);
}
static void ListAllEventGroups(string command)
@@ -49,6 +67,33 @@ namespace PepperDash.Essentials.Core
}
}
static void ListAllEventsForGroup(string args)
{
Debug.Console(0, "Getting events for group {0}...", args);
ScheduledEventGroup group;
if (!EventGroups.TryGetValue(args, out group))
{
Debug.Console(0, "Unabled to get event group for key {0}", args);
return;
}
foreach (var evt in group.ScheduledEvents)
{
Debug.Console(0,
@"
****Event key {0}****
Event date/time: {1}
Persistent: {2}
Acknowlegable: {3}
Recurrence: {4}
Recurrence Days: {5}
********************", evt.Key, evt.Value.DateAndTime, evt.Value.Persistent, evt.Value.Acknowledgeable,
evt.Value.Recurrence.Recurrence, evt.Value.Recurrence.RecurrenceDays);
}
}
/// <summary>
/// Adds the event group to the global list
/// </summary>

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Core;
namespace PepperDash.Essentials.Core.Interfaces
{
public interface ILogStrings : IKeyed
{
/// <summary>
/// Defines a class that is capable of logging a string
/// </summary>
void SendToLog(IKeyed device, string logMessage);
}
}

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Core;
namespace PepperDash.Essentials.Core.Interfaces
{
public interface ILogStringsWithLevel : IKeyed
{
/// <summary>
/// Defines a class that is capable of logging a string with an int level
/// </summary>
void SendToLog(IKeyed device, Debug.ErrorLogLevel level,string logMessage);
}
}

View File

@@ -25,7 +25,7 @@ namespace PepperDash.Essentials.Core
var joinMap = ConfigReader.ConfigObject.JoinMaps[joinMapKey];
return joinMap;
return joinMap.ToString();
}
/// <summary>
@@ -45,16 +45,33 @@ namespace PepperDash.Essentials.Core
/// <returns></returns>
public static Dictionary<string, JoinData> TryGetJoinMapAdvancedForDevice(string joinMapKey)
{
if (string.IsNullOrEmpty(joinMapKey))
try
{
if (string.IsNullOrEmpty(joinMapKey))
return null;
if (!ConfigReader.ConfigObject.JoinMaps.ContainsKey(joinMapKey))
{
Debug.Console(2, "No Join Map found in config with key: '{0}'", joinMapKey);
return null;
}
Debug.Console(2, "Attempting to load custom join map with key: {0}", joinMapKey);
var joinMapJToken = ConfigReader.ConfigObject.JoinMaps[joinMapKey];
if (joinMapJToken == null)
return null;
var joinMapData = joinMapJToken.ToObject<Dictionary<string, JoinData>>();
return joinMapData;
}
catch (Exception e)
{
Debug.Console(2, "Error getting join map for key: '{0}'. Error: {1}", joinMapKey, e);
return null;
var joinMapSerialzed = ConfigReader.ConfigObject.JoinMaps[joinMapKey];
if (joinMapSerialzed == null) return null;
var joinMapData = JsonConvert.DeserializeObject<Dictionary<string, JoinData>>(joinMapSerialzed);
return joinMapData;
}
}
}
@@ -216,7 +233,10 @@ namespace PepperDash.Essentials.Core
}
PrintJoinMapInfo();
if (Debug.Level > 0)
{
PrintJoinMapInfo();
}
}
/// <summary>
@@ -266,7 +286,7 @@ namespace PepperDash.Essentials.Core
@"Join Number: {0} | JoinSpan: '{1}' | Description: '{2}' | Type: '{3}' | Capabilities: '{4}'",
join.Value.JoinNumber,
join.Value.JoinSpan,
String.IsNullOrEmpty(join.Value.Metadata.Description) ? join.Value.Metadata.Label: join.Value.Metadata.Description,
String.IsNullOrEmpty(join.Value.AttributeName) ? join.Value.Metadata.Label : join.Value.AttributeName,
join.Value.Metadata.JoinType.ToString(),
join.Value.Metadata.JoinCapabilities.ToString());
}
@@ -288,7 +308,7 @@ namespace PepperDash.Essentials.Core
}
else
{
Debug.Console(2, "No mathcing key found in join map for: '{0}'", customJoinData.Key);
Debug.Console(2, "No matching key found in join map for: '{0}'", customJoinData.Key);
}
}
@@ -327,7 +347,10 @@ namespace PepperDash.Essentials.Core
None = 0,
ToSIMPL = 1,
FromSIMPL = 2,
ToFromSIMPL = ToSIMPL | FromSIMPL
ToFromSIMPL = ToSIMPL | FromSIMPL,
ToFusion = 4,
FromFusion = 8,
ToFromFusion = ToFusion | FromFusion,
}
[Flags]
@@ -340,7 +363,7 @@ namespace PepperDash.Essentials.Core
DigitalAnalog = Digital | Analog,
DigitalSerial = Digital | Serial,
AnalogSerial = Analog | Serial,
DigitalAnalogSerial = Digital | Analog | Serial
DigitalAnalogSerial = Digital | Analog | Serial,
}
/// <summary>
@@ -394,7 +417,7 @@ namespace PepperDash.Essentials.Core
}
/// <summary>
/// Data describing the join. Can be
/// Data describing the join. Can be overridden from configuratino
/// </summary>
public class JoinData
{
@@ -408,6 +431,11 @@ namespace PepperDash.Essentials.Core
/// </summary>
[JsonProperty("joinSpan")]
public uint JoinSpan { get; set; }
/// <summary>
/// Fusion Attribute Name (optional)
/// </summary>
[JsonProperty("attributeName")]
public string AttributeName { get; set; }
}
/// <summary>
@@ -419,6 +447,10 @@ namespace PepperDash.Essentials.Core
private JoinData _data;
public JoinMetadata Metadata { get; set; }
/// <summary>
/// To store some future information as you please
/// </summary>
public object UserObject { get; private set; }
public JoinDataComplete(JoinData data, JoinMetadata metadata)
{
@@ -449,6 +481,11 @@ namespace PepperDash.Essentials.Core
get { return _data.JoinSpan; }
}
public string AttributeName
{
get { return _data.AttributeName; }
}
public void SetCustomJoinData(JoinData customJoinData)
{
_data = customJoinData;

View File

@@ -64,30 +64,34 @@ namespace PepperDash.Essentials.Core
initialStatus = MonitorStatus.InWarning;
prefix = "2:";
}
else if (InWarning.Count() > 0)
else if (IsOk.Count() > 0)
initialStatus = MonitorStatus.IsOk;
else
initialStatus = MonitorStatus.StatusUnknown;
// Build the error message string
if (InError.Count() > 0 || InWarning.Count() > 0)
{
StringBuilder sb = new StringBuilder(prefix);
if (InError.Count() > 0)
{
// Do string splits and joins
sb.Append(string.Format("{0} Errors:", InError.Count()));
foreach (var mon in InError)
sb.Append(string.Format("{0}, ", mon.Parent.Key));
}
if (InWarning.Count() > 0)
{
sb.Append(string.Format("{0} Warnings:", InWarning.Count()));
foreach (var mon in InWarning)
sb.Append(string.Format("{0}, ", mon.Parent.Key));
}
Message = sb.ToString();
}
if (InError.Count() > 0 || InWarning.Count() > 0)
{
StringBuilder sb = new StringBuilder(prefix);
if (InError.Count() > 0)
{
// Do string splits and joins
sb.Append(string.Format("{0} Errors:", InError.Count()));
foreach (var mon in InError)
sb.Append(string.Format("{0}, ", mon.Parent.Key));
}
if (InWarning.Count() > 0)
{
sb.Append(string.Format("{0} Warnings:", InWarning.Count()));
foreach (var mon in InWarning)
sb.Append(string.Format("{0}, ", mon.Parent.Key));
}
Message = sb.ToString();
}
else
{
Message = "Room Ok.";
}
// Want to fire even if status doesn't change because the message may.
Status = initialStatus;

View File

@@ -1,460 +1,539 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.GeneralIO;
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.Bridges;
namespace PepperDash.Essentials.Core
{
[Description("Wrapper class for Single Technology GLS Occupancy Sensors")]
public class GlsOccupancySensorBaseController : CrestronGenericBridgeableBaseDevice, IOccupancyStatusProvider
{
public GlsOccupancySensorBase OccSensor { get; private set; }
[Description("Wrapper class for Single Technology GLS Occupancy Sensors")]
[ConfigSnippet("\"properties\": {\"control\": {\"method\": \"cresnet\",\"cresnetId\": \"97\"},\"enablePir\": true,\"enableLedFlash\": true,\"enableRawStates\":true,\"remoteTimeout\": 30,\"internalPhotoSensorMinChange\": 0,\"externalPhotoSensorMinChange\": 0}")]
public abstract class GlsOccupancySensorBaseController : CrestronGenericBridgeableBaseDevice, IOccupancyStatusProvider
{
public GlsOccupancySensorPropertiesConfig PropertiesConfig { get; private set; }
public BoolFeedback RoomIsOccupiedFeedback { get; private set; }
protected GlsOccupancySensorBase OccSensor;
public BoolFeedback GraceOccupancyDetectedFeedback { get; private set; }
public BoolFeedback RoomIsOccupiedFeedback { get; private set; }
public BoolFeedback RawOccupancyFeedback { get; private set; }
public BoolFeedback GraceOccupancyDetectedFeedback { get; private set; }
public BoolFeedback PirSensorEnabledFeedback { get; private set; }
public BoolFeedback RawOccupancyFeedback { get; private set; }
public BoolFeedback LedFlashEnabledFeedback { get; private set; }
public BoolFeedback PirSensorEnabledFeedback { get; private set; }
public BoolFeedback ShortTimeoutEnabledFeedback { get; private set; }
public BoolFeedback LedFlashEnabledFeedback { get; private set; }
public IntFeedback PirSensitivityInVacantStateFeedback { get; private set; }
public BoolFeedback ShortTimeoutEnabledFeedback { get; private set; }
public IntFeedback PirSensitivityInOccupiedStateFeedback { get; private set; }
public IntFeedback PirSensitivityInVacantStateFeedback { get; private set; }
public IntFeedback CurrentTimeoutFeedback { get; private set; }
public IntFeedback PirSensitivityInOccupiedStateFeedback { get; private set; }
public IntFeedback LocalTimoutFeedback { get; private set; }
public IntFeedback CurrentTimeoutFeedback { get; private set; }
public IntFeedback InternalPhotoSensorValue { get; set; }
public IntFeedback LocalTimoutFeedback { get; private set; }
public IntFeedback ExternalPhotoSensorValue { get; set; }
public IntFeedback InternalPhotoSensorValue { get; set; }
// Debug properties
public bool InTestMode { get; private set; }
public IntFeedback ExternalPhotoSensorValue { get; set; }
public bool TestRoomIsOccupiedFeedback { get; private set; }
// Debug properties
public bool InTestMode { get; private set; }
public Func<bool> RoomIsOccupiedFeedbackFunc
public bool TestRoomIsOccupiedFeedback { get; private set; }
public Func<bool> RoomIsOccupiedFeedbackFunc
{
get
{
return () => InTestMode ? TestRoomIsOccupiedFeedback : OccSensor.OccupancyDetectedFeedback.BoolValue;
}
}
protected GlsOccupancySensorBaseController(string key, DeviceConfig config)
: this(key, config.Name, config)
{
}
protected GlsOccupancySensorBaseController(string key, string name, DeviceConfig config)
: base(key, name)
{
get
var props = config.Properties.ToObject<GlsOccupancySensorPropertiesConfig>();
if (props != null)
{
return () => InTestMode ? TestRoomIsOccupiedFeedback : OccSensor.OccupancyDetectedFeedback.BoolValue;
}
}
public GlsOccupancySensorBaseController(string key, Func<DeviceConfig, GlsOccupancySensorBase> preActivationFunc,
DeviceConfig config)
: base(key, config.Name)
{
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);
LedFlashEnabledFeedback = new BoolFeedback(() => OccSensor.LedFlashEnabledFeedback.BoolValue);
ShortTimeoutEnabledFeedback = new BoolFeedback(() => OccSensor.ShortTimeoutEnabledFeedback.BoolValue);
PirSensitivityInVacantStateFeedback =
new IntFeedback(() => OccSensor.PirSensitivityInVacantStateFeedback.UShortValue);
PirSensitivityInOccupiedStateFeedback =
new IntFeedback(() => OccSensor.PirSensitivityInOccupiedStateFeedback.UShortValue);
CurrentTimeoutFeedback = new IntFeedback(() => OccSensor.CurrentTimeoutFeedback.UShortValue);
LocalTimoutFeedback = new IntFeedback(() => OccSensor.LocalTimeoutFeedback.UShortValue);
GraceOccupancyDetectedFeedback =
new BoolFeedback(() => OccSensor.GraceOccupancyDetectedFeedback.BoolValue);
RawOccupancyFeedback = new BoolFeedback(() => OccSensor.RawOccupancyFeedback.BoolValue);
InternalPhotoSensorValue = new IntFeedback(() => OccSensor.InternalPhotoSensorValueFeedback.UShortValue);
ExternalPhotoSensorValue = new IntFeedback(() => OccSensor.ExternalPhotoSensorValueFeedback.UShortValue);
OccSensor.BaseEvent += OccSensor_BaseEvent;
OccSensor.GlsOccupancySensorChange += OccSensor_GlsOccupancySensorChange;
}
/// <summary>
/// Catches events for feedbacks on the base class. Any extending wrapper class should call this delegate after it checks for it's own event IDs.
/// </summary>
/// <param name="device"></param>
/// <param name="args"></param>
protected virtual void OccSensor_GlsOccupancySensorChange(GlsOccupancySensorBase device, GlsOccupancySensorChangeEventArgs args)
{
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);
switch (args.EventId)
{
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;
}
}
public void SetTestMode(bool mode)
{
InTestMode = mode;
Debug.Console(1, this, "In Mock Mode: '{0}'", InTestMode);
}
public void SetTestOccupiedState(bool state)
{
if (!InTestMode)
Debug.Console(1, "Mock mode not enabled");
else
{
TestRoomIsOccupiedFeedback = state;
RoomIsOccupiedFeedback.FireUpdate();
}
}
/// <summary>
/// Enables or disables the PIR sensor
/// </summary>
/// <param name="state"></param>
public void SetPirEnable(bool state)
{
if (state)
{
OccSensor.EnablePir.BoolValue = state;
OccSensor.DisablePir.BoolValue = !state;
PropertiesConfig = props;
}
else
{
OccSensor.EnablePir.BoolValue = state;
OccSensor.DisablePir.BoolValue = !state;
}
}
/// <summary>
/// Enables or disables the LED Flash
/// </summary>
/// <param name="state"></param>
public void SetLedFlashEnable(bool state)
{
if (state)
{
OccSensor.EnableLedFlash.BoolValue = state;
OccSensor.DisableLedFlash.BoolValue = !state;
}
else
{
OccSensor.EnableLedFlash.BoolValue = state;
OccSensor.DisableLedFlash.BoolValue = !state;
}
}
/// <summary>
/// Enables or disables short timeout based on state
/// </summary>
/// <param name="state"></param>
public void SetShortTimeoutState(bool state)
{
if (state)
{
OccSensor.EnableShortTimeout.BoolValue = state;
OccSensor.DisableShortTimeout.BoolValue = !state;
}
else
{
OccSensor.EnableShortTimeout.BoolValue = state;
OccSensor.DisableShortTimeout.BoolValue = !state;
}
}
public void IncrementPirSensitivityInOccupiedState(bool pressRelease)
{
OccSensor.IncrementPirSensitivityInOccupiedState.BoolValue = pressRelease;
}
public void DecrementPirSensitivityInOccupiedState(bool pressRelease)
{
OccSensor.DecrementPirSensitivityInOccupiedState.BoolValue = pressRelease;
}
public void IncrementPirSensitivityInVacantState(bool pressRelease)
{
OccSensor.IncrementPirSensitivityInVacantState.BoolValue = pressRelease;
}
public void DecrementPirSensitivityInVacantState(bool pressRelease)
{
OccSensor.DecrementPirSensitivityInVacantState.BoolValue = pressRelease;
}
public void ForceOccupied()
{
OccSensor.ForceOccupied.BoolValue = true;
}
public void ForceVacant()
{
OccSensor.ForceVacant.BoolValue = true;
}
public void EnableRawStates(bool state)
{
OccSensor.EnableRawStates.BoolValue = state;
}
public void SetRemoteTimeout(ushort time)
{
OccSensor.RemoteTimeout.UShortValue = time;
}
public void SetInternalPhotoSensorMinChange(ushort value)
{
OccSensor.InternalPhotoSensorMinimumChange.UShortValue = value;
}
public void SetExternalPhotoSensorMinChange(ushort value)
{
OccSensor.ExternalPhotoSensorMinimumChange.UShortValue = value;
}
protected void LinkOccSensorToApi(GlsOccupancySensorBaseController occController, BasicTriList trilist,
uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{
var joinMap = new GlsOccupancySensorBaseJoinMap(joinStart);
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<GlsOccupancySensorBaseJoinMap>(joinMapSerialized);
if (bridge != null)
{
bridge.AddJoinMap(Key, joinMap);
}
else
{
Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
Debug.Console(1, this, "props are null. Unable to deserialize into GlsOccupancySensorPropertiesConfig");
}
Debug.Console(1, occController, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
#region Single and Dual Sensor Stuff
occController.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]);
trilist.StringInput[joinMap.Name.JoinNumber].StringValue = occController.Name;
trilist.OnlineStatusChange += (d, args) =>
{
if (args.DeviceOnLine)
AddPostActivationAction(() =>
{
trilist.StringInput[joinMap.Name.JoinNumber].StringValue = occController.Name;
}
};
OccSensor.OnlineStatusChange += (o, a) =>
{
if (a.DeviceOnLine)
{
ApplySettingsToSensorFromConfig();
}
};
// Occupied status
trilist.SetSigTrueAction(joinMap.ForceOccupied.JoinNumber, occController.ForceOccupied);
trilist.SetSigTrueAction(joinMap.ForceVacant.JoinNumber, occController.ForceVacant);
occController.RoomIsOccupiedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RoomOccupiedFeedback.JoinNumber]);
occController.RoomIsOccupiedFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.RoomVacantFeedback.JoinNumber]);
occController.RawOccupancyFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyFeedback.JoinNumber]);
trilist.SetBoolSigAction(joinMap.EnableRawStates.JoinNumber, occController.EnableRawStates);
if (OccSensor.IsOnline)
{
ApplySettingsToSensorFromConfig();
// Timouts
trilist.SetUShortSigAction(joinMap.Timeout.JoinNumber, occController.SetRemoteTimeout);
occController.CurrentTimeoutFeedback.LinkInputSig(trilist.UShortInput[joinMap.Timeout.JoinNumber]);
occController.LocalTimoutFeedback.LinkInputSig(trilist.UShortInput[joinMap.TimeoutLocalFeedback.JoinNumber]);
// LED Flash
trilist.SetSigTrueAction(joinMap.EnableLedFlash.JoinNumber, () => occController.SetLedFlashEnable(true));
trilist.SetSigTrueAction(joinMap.DisableLedFlash.JoinNumber, () => occController.SetLedFlashEnable(false));
occController.LedFlashEnabledFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.EnableLedFlash.JoinNumber]);
// Short Timeout
trilist.SetSigTrueAction(joinMap.EnableShortTimeout.JoinNumber, () => occController.SetShortTimeoutState(true));
trilist.SetSigTrueAction(joinMap.DisableShortTimeout.JoinNumber, () => occController.SetShortTimeoutState(false));
occController.ShortTimeoutEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableShortTimeout.JoinNumber]);
// PIR Sensor
trilist.SetSigTrueAction(joinMap.EnablePir.JoinNumber, () => occController.SetPirEnable(true));
trilist.SetSigTrueAction(joinMap.DisablePir.JoinNumber, () => occController.SetPirEnable(false));
occController.PirSensorEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnablePir.JoinNumber]);
// PIR Sensitivity in Occupied State
trilist.SetBoolSigAction(joinMap.IncrementPirInOccupiedState.JoinNumber, occController.IncrementPirSensitivityInOccupiedState);
trilist.SetBoolSigAction(joinMap.DecrementPirInOccupiedState.JoinNumber, occController.DecrementPirSensitivityInOccupiedState);
occController.PirSensitivityInOccupiedStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.PirSensitivityInOccupiedState.JoinNumber]);
// PIR Sensitivity in Vacant State
trilist.SetBoolSigAction(joinMap.IncrementPirInVacantState.JoinNumber, occController.IncrementPirSensitivityInVacantState);
trilist.SetBoolSigAction(joinMap.DecrementPirInVacantState.JoinNumber, occController.DecrementPirSensitivityInVacantState);
occController.PirSensitivityInVacantStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.PirSensitivityInVacantState.JoinNumber]);
#endregion
#region Dual Technology Sensor Stuff
var odtOccController = occController as GlsOdtOccupancySensorController;
if (odtOccController == null) return;
// OR When Vacated
trilist.SetBoolSigAction(joinMap.OrWhenVacated.JoinNumber, odtOccController.SetOrWhenVacatedState);
odtOccController.OrWhenVacatedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.OrWhenVacated.JoinNumber]);
// AND When Vacated
trilist.SetBoolSigAction(joinMap.AndWhenVacated.JoinNumber, odtOccController.SetAndWhenVacatedState);
odtOccController.AndWhenVacatedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.AndWhenVacated.JoinNumber]);
// Ultrasonic A Sensor
trilist.SetSigTrueAction(joinMap.EnableUsA.JoinNumber, () => odtOccController.SetUsAEnable(true));
trilist.SetSigTrueAction(joinMap.DisableUsA.JoinNumber, () => odtOccController.SetUsAEnable(false));
odtOccController.UltrasonicAEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableUsA.JoinNumber]);
// Ultrasonic B Sensor
trilist.SetSigTrueAction(joinMap.EnableUsB.JoinNumber, () => odtOccController.SetUsBEnable(true));
trilist.SetSigTrueAction(joinMap.DisableUsB.JoinNumber, () => odtOccController.SetUsBEnable(false));
odtOccController.UltrasonicAEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableUsB.JoinNumber]);
// US Sensitivity in Occupied State
trilist.SetBoolSigAction(joinMap.IncrementUsInOccupiedState.JoinNumber, odtOccController.IncrementUsSensitivityInOccupiedState);
trilist.SetBoolSigAction(joinMap.DecrementUsInOccupiedState.JoinNumber, odtOccController.DecrementUsSensitivityInOccupiedState);
odtOccController.UltrasonicSensitivityInOccupiedStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.UsSensitivityInOccupiedState.JoinNumber]);
// US Sensitivity in Vacant State
trilist.SetBoolSigAction(joinMap.IncrementUsInVacantState.JoinNumber, odtOccController.IncrementUsSensitivityInVacantState);
trilist.SetBoolSigAction(joinMap.DecrementUsInVacantState.JoinNumber, odtOccController.DecrementUsSensitivityInVacantState);
odtOccController.UltrasonicSensitivityInVacantStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.UsSensitivityInVacantState.JoinNumber]);
//Sensor Raw States
odtOccController.RawOccupancyPirFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyPirFeedback.JoinNumber]);
odtOccController.RawOccupancyUsFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyUsFeedback.JoinNumber]);
#endregion
}
});
}
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
/// <summary>
/// Applies any sensor settings defined in config
/// </summary>
protected virtual void ApplySettingsToSensorFromConfig()
{
LinkOccSensorToApi(this, trilist, joinStart, joinMapKey, bridge);
Debug.Console(1, this, "Attempting to apply settings to sensor from config");
if (PropertiesConfig.EnablePir != null)
{
Debug.Console(1, this, "EnablePir found, attempting to set value from config");
SetPirEnable((bool)PropertiesConfig.EnablePir);
}
else
{
Debug.Console(1, this, "EnablePir null, no value specified in config");
}
if (PropertiesConfig.EnableLedFlash != null)
{
Debug.Console(1, this, "EnableLedFlash found, attempting to set value from config");
SetLedFlashEnable((bool)PropertiesConfig.EnableLedFlash);
}
if (PropertiesConfig.RemoteTimeout != null)
{
Debug.Console(1, this, "RemoteTimeout found, attempting to set value from config");
SetRemoteTimeout((ushort)PropertiesConfig.RemoteTimeout);
}
else
{
Debug.Console(1, this, "RemoteTimeout null, no value specified in config");
}
if (PropertiesConfig.ShortTimeoutState != null)
{
SetShortTimeoutState((bool)PropertiesConfig.ShortTimeoutState);
}
if (PropertiesConfig.EnableRawStates != null)
{
EnableRawStates((bool)PropertiesConfig.EnableRawStates);
}
if (PropertiesConfig.InternalPhotoSensorMinChange != null)
{
SetInternalPhotoSensorMinChange((ushort)PropertiesConfig.InternalPhotoSensorMinChange);
}
if (PropertiesConfig.ExternalPhotoSensorMinChange != null)
{
SetExternalPhotoSensorMinChange((ushort)PropertiesConfig.ExternalPhotoSensorMinChange);
}
}
#region PreActivation
protected void RegisterGlsOccupancySensorBaseController(GlsOccupancySensorBase occSensor)
{
OccSensor = occSensor;
private static GlsOirCCn GetGlsOirCCn(DeviceConfig dc)
{
var control = CommFactory.GetControlPropertiesConfig(dc);
var cresnetId = control.CresnetIdInt;
var branchId = control.ControlPortNumber;
var parentKey = string.IsNullOrEmpty(control.ControlPortDevKey) ? "processor" : control.ControlPortDevKey;
RoomIsOccupiedFeedback = new BoolFeedback(RoomIsOccupiedFeedbackFunc);
if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase))
PirSensorEnabledFeedback = new BoolFeedback(() => OccSensor.PirEnabledFeedback.BoolValue);
LedFlashEnabledFeedback = new BoolFeedback(() => OccSensor.LedFlashEnabledFeedback.BoolValue);
ShortTimeoutEnabledFeedback = new BoolFeedback(() => OccSensor.ShortTimeoutEnabledFeedback.BoolValue);
PirSensitivityInVacantStateFeedback =
new IntFeedback(() => OccSensor.PirSensitivityInVacantStateFeedback.UShortValue);
PirSensitivityInOccupiedStateFeedback =
new IntFeedback(() => OccSensor.PirSensitivityInOccupiedStateFeedback.UShortValue);
CurrentTimeoutFeedback = new IntFeedback(() => OccSensor.CurrentTimeoutFeedback.UShortValue);
LocalTimoutFeedback = new IntFeedback(() => OccSensor.LocalTimeoutFeedback.UShortValue);
GraceOccupancyDetectedFeedback =
new BoolFeedback(() => OccSensor.GraceOccupancyDetectedFeedback.BoolValue);
RawOccupancyFeedback = new BoolFeedback(() => OccSensor.RawOccupancyFeedback.BoolValue);
InternalPhotoSensorValue = new IntFeedback(() => OccSensor.InternalPhotoSensorValueFeedback.UShortValue);
ExternalPhotoSensorValue = new IntFeedback(() => OccSensor.ExternalPhotoSensorValueFeedback.UShortValue);
OccSensor.BaseEvent += OccSensor_BaseEvent;
OccSensor.GlsOccupancySensorChange += OccSensor_GlsOccupancySensorChange;
}
/// <summary>
/// Catches events for feedbacks on the base class. Any extending wrapper class should call this delegate after it checks for it's own event IDs.
/// </summary>
/// <param name="device"></param>
/// <param name="args"></param>
protected virtual void OccSensor_GlsOccupancySensorChange(GlsOccupancySensorBase device, GlsOccupancySensorChangeEventArgs args)
{
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);
switch (args.EventId)
{
case GlsOccupancySensorBase.RoomVacantFeedbackEventId:
case 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;
}
}
public void SetTestMode(bool mode)
{
InTestMode = mode;
Debug.Console(1, this, "In Mock Mode: '{0}'", InTestMode);
}
public void SetTestOccupiedState(bool state)
{
if (!InTestMode)
Debug.Console(1, "Mock mode not enabled");
else
{
TestRoomIsOccupiedFeedback = state;
RoomIsOccupiedFeedback.FireUpdate();
}
}
/// <summary>
/// Enables or disables the PIR sensor
/// </summary>
/// <param name="state"></param>
public void SetPirEnable(bool state)
{
Debug.Console(1, this, "Setting EnablePir to: {0}", state);
OccSensor.EnablePir.BoolValue = state;
OccSensor.DisablePir.BoolValue = !state;
}
/// <summary>
/// Enables or disables the LED Flash
/// </summary>
/// <param name="state"></param>
public void SetLedFlashEnable(bool state)
{
OccSensor.EnableLedFlash.BoolValue = state;
OccSensor.DisableLedFlash.BoolValue = !state;
}
/// <summary>
/// Enables or disables short timeout based on state
/// </summary>
/// <param name="state"></param>
public void SetShortTimeoutState(bool state)
{
OccSensor.EnableShortTimeout.BoolValue = state;
OccSensor.DisableShortTimeout.BoolValue = !state;
}
public void IncrementPirSensitivityInOccupiedState(bool pressRelease)
{
OccSensor.IncrementPirSensitivityInOccupiedState.BoolValue = pressRelease;
}
public void DecrementPirSensitivityInOccupiedState(bool pressRelease)
{
OccSensor.DecrementPirSensitivityInOccupiedState.BoolValue = pressRelease;
}
public void IncrementPirSensitivityInVacantState(bool pressRelease)
{
OccSensor.IncrementPirSensitivityInVacantState.BoolValue = pressRelease;
}
public void DecrementPirSensitivityInVacantState(bool pressRelease)
{
OccSensor.DecrementPirSensitivityInVacantState.BoolValue = pressRelease;
}
/// <summary>
/// Pulse ForceOccupied on the sensor for .5 seconds
/// </summary>
public void ForceOccupied()
{
CrestronInvoke.BeginInvoke((o) =>
{
ForceOccupied(true);
CrestronEnvironment.Sleep(500);
ForceOccupied(false);
});
}
public void ForceOccupied(bool value)
{
OccSensor.ForceOccupied.BoolValue = value;
}
/// <summary>
/// Pulse ForceVacant on the sensor for .5 seconds
/// </summary>
public void ForceVacant()
{
CrestronInvoke.BeginInvoke((o) =>
{
Debug.Console(0, "Device {0} is a valid cresnet master - creating new GlsOirCCn", parentKey);
return new GlsOirCCn(cresnetId, Global.ControlSystem);
}
var cresnetBridge = DeviceManager.GetDeviceForKey(parentKey) as IHasCresnetBranches;
ForceVacant(true);
CrestronEnvironment.Sleep(500);
ForceVacant(false);
});
}
if (cresnetBridge != 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 void ForceVacant(bool value)
{
OccSensor.ForceVacant.BoolValue = value;
}
public class GlsOccupancySensorBaseControllerFactory : EssentialsDeviceFactory<GlsOccupancySensorBaseController>
{
public GlsOccupancySensorBaseControllerFactory()
{
TypeNames = new List<string>() { "glsoirccn" };
}
public void EnableRawStates(bool state)
{
OccSensor.EnableRawStates.BoolValue = state;
}
public void SetRemoteTimeout(ushort time)
{
Debug.Console(1, this, "Setting RemoteTimout to: {0}", time);
OccSensor.RemoteTimeout.UShortValue = time;
}
public void SetInternalPhotoSensorMinChange(ushort value)
{
OccSensor.InternalPhotoSensorMinimumChange.UShortValue = value;
}
public void SetExternalPhotoSensorMinChange(ushort value)
{
OccSensor.ExternalPhotoSensorMinimumChange.UShortValue = value;
}
/// <summary>
/// Method to print current occ settings to console.
/// </summary>
public virtual void GetSettings()
{
var dash = new string('*', 50);
CrestronConsole.PrintLine(string.Format("{0}\n", dash));
Debug.Console(0, this, "Vacancy Detected: {0}",
OccSensor.VacancyDetectedFeedback.BoolValue);
Debug.Console(0, this, "Timeout Current: {0} | Local: {1}",
OccSensor.CurrentTimeoutFeedback.UShortValue,
OccSensor.LocalTimeoutFeedback.UShortValue);
Debug.Console(0, this, "Short Timeout Enabled: {0}",
OccSensor.ShortTimeoutEnabledFeedback.BoolValue);
Debug.Console(0, this, "PIR Sensor Enabled: {0} | Sensitivity Occupied: {1} | Sensitivity Vacant: {2}",
OccSensor.PirEnabledFeedback.BoolValue,
OccSensor.PirSensitivityInOccupiedStateFeedback.UShortValue,
OccSensor.PirSensitivityInVacantStateFeedback.UShortValue);
CrestronConsole.PrintLine(string.Format("{0}\n", dash));
}
protected void LinkOccSensorToApi(GlsOccupancySensorBaseController occController, BasicTriList trilist,
uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{
var joinMap = new GlsOccupancySensorBaseJoinMap(joinStart);
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<GlsOccupancySensorBaseJoinMap>(joinMapSerialized);
if (bridge != null)
{
bridge.AddJoinMap(Key, joinMap);
}
else
{
Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
}
Debug.Console(1, occController, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
occController.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]);
trilist.StringInput[joinMap.Name.JoinNumber].StringValue = occController.Name;
trilist.OnlineStatusChange += (d, args) =>
{
if (args.DeviceOnLine)
{
trilist.StringInput[joinMap.Name.JoinNumber].StringValue = occController.Name;
}
};
LinkSingleTechSensorToApi(occController, trilist, joinMap);
LinkDualTechSensorToApi(occController, trilist, joinMap);
}
private static void LinkDualTechSensorToApi(GlsOccupancySensorBaseController occController, BasicTriList trilist,
GlsOccupancySensorBaseJoinMap joinMap)
{
var odtOccController = occController as GlsOdtOccupancySensorController;
if (odtOccController == null)
{
return;
}
// OR When Vacated
trilist.SetBoolSigAction(joinMap.OrWhenVacated.JoinNumber, odtOccController.SetOrWhenVacatedState);
odtOccController.OrWhenVacatedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.OrWhenVacated.JoinNumber]);
// AND When Vacated
trilist.SetBoolSigAction(joinMap.AndWhenVacated.JoinNumber, odtOccController.SetAndWhenVacatedState);
odtOccController.AndWhenVacatedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.AndWhenVacated.JoinNumber]);
// Ultrasonic A Sensor
trilist.SetSigTrueAction(joinMap.EnableUsA.JoinNumber, () => odtOccController.SetUsAEnable(true));
trilist.SetSigTrueAction(joinMap.DisableUsA.JoinNumber, () => odtOccController.SetUsAEnable(false));
odtOccController.UltrasonicAEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableUsA.JoinNumber]);
// Ultrasonic B Sensor
trilist.SetSigTrueAction(joinMap.EnableUsB.JoinNumber, () => odtOccController.SetUsBEnable(true));
trilist.SetSigTrueAction(joinMap.DisableUsB.JoinNumber, () => odtOccController.SetUsBEnable(false));
odtOccController.UltrasonicBEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableUsB.JoinNumber]);
// US Sensitivity in Occupied State
trilist.SetBoolSigAction(joinMap.IncrementUsInOccupiedState.JoinNumber,
odtOccController.IncrementUsSensitivityInOccupiedState);
trilist.SetBoolSigAction(joinMap.DecrementUsInOccupiedState.JoinNumber,
odtOccController.DecrementUsSensitivityInOccupiedState);
odtOccController.UltrasonicSensitivityInOccupiedStateFeedback.LinkInputSig(
trilist.UShortInput[joinMap.UsSensitivityInOccupiedState.JoinNumber]);
// US Sensitivity in Vacant State
trilist.SetBoolSigAction(joinMap.IncrementUsInVacantState.JoinNumber,
odtOccController.IncrementUsSensitivityInVacantState);
trilist.SetBoolSigAction(joinMap.DecrementUsInVacantState.JoinNumber,
odtOccController.DecrementUsSensitivityInVacantState);
odtOccController.UltrasonicSensitivityInVacantStateFeedback.LinkInputSig(
trilist.UShortInput[joinMap.UsSensitivityInVacantState.JoinNumber]);
//Sensor Raw States
odtOccController.RawOccupancyPirFeedback.LinkInputSig(
trilist.BooleanInput[joinMap.RawOccupancyPirFeedback.JoinNumber]);
odtOccController.RawOccupancyUsFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyUsFeedback.JoinNumber]);
}
private static void LinkSingleTechSensorToApi(GlsOccupancySensorBaseController occController, BasicTriList trilist,
GlsOccupancySensorBaseJoinMap joinMap)
{
// Occupied status
trilist.SetBoolSigAction(joinMap.ForceOccupied.JoinNumber, occController.ForceOccupied);
trilist.SetBoolSigAction(joinMap.ForceVacant.JoinNumber, occController.ForceVacant);
occController.RoomIsOccupiedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RoomOccupiedFeedback.JoinNumber]);
occController.RoomIsOccupiedFeedback.LinkComplementInputSig(
trilist.BooleanInput[joinMap.RoomVacantFeedback.JoinNumber]);
occController.RawOccupancyFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyFeedback.JoinNumber]);
trilist.SetBoolSigAction(joinMap.EnableRawStates.JoinNumber, occController.EnableRawStates);
// Timouts
trilist.SetUShortSigAction(joinMap.Timeout.JoinNumber, occController.SetRemoteTimeout);
occController.CurrentTimeoutFeedback.LinkInputSig(trilist.UShortInput[joinMap.Timeout.JoinNumber]);
occController.LocalTimoutFeedback.LinkInputSig(trilist.UShortInput[joinMap.TimeoutLocalFeedback.JoinNumber]);
// LED Flash
trilist.SetSigTrueAction(joinMap.EnableLedFlash.JoinNumber, () => occController.SetLedFlashEnable(true));
trilist.SetSigTrueAction(joinMap.DisableLedFlash.JoinNumber, () => occController.SetLedFlashEnable(false));
occController.LedFlashEnabledFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.EnableLedFlash.JoinNumber]);
// Short Timeout
trilist.SetSigTrueAction(joinMap.EnableShortTimeout.JoinNumber, () => occController.SetShortTimeoutState(true));
trilist.SetSigTrueAction(joinMap.DisableShortTimeout.JoinNumber, () => occController.SetShortTimeoutState(false));
occController.ShortTimeoutEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableShortTimeout.JoinNumber]);
// PIR Sensor
trilist.SetSigTrueAction(joinMap.EnablePir.JoinNumber, () => occController.SetPirEnable(true));
trilist.SetSigTrueAction(joinMap.DisablePir.JoinNumber, () => occController.SetPirEnable(false));
occController.PirSensorEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnablePir.JoinNumber]);
// PIR Sensitivity in Occupied State
trilist.SetBoolSigAction(joinMap.IncrementPirInOccupiedState.JoinNumber,
occController.IncrementPirSensitivityInOccupiedState);
trilist.SetBoolSigAction(joinMap.DecrementPirInOccupiedState.JoinNumber,
occController.DecrementPirSensitivityInOccupiedState);
occController.PirSensitivityInOccupiedStateFeedback.LinkInputSig(
trilist.UShortInput[joinMap.PirSensitivityInOccupiedState.JoinNumber]);
// PIR Sensitivity in Vacant State
trilist.SetBoolSigAction(joinMap.IncrementPirInVacantState.JoinNumber,
occController.IncrementPirSensitivityInVacantState);
trilist.SetBoolSigAction(joinMap.DecrementPirInVacantState.JoinNumber,
occController.DecrementPirSensitivityInVacantState);
occController.PirSensitivityInVacantStateFeedback.LinkInputSig(
trilist.UShortInput[joinMap.PirSensitivityInVacantState.JoinNumber]);
}
}
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

@@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Newtonsoft.Json;
namespace PepperDash.Essentials.Core
{
/// <summary>
/// Defines configuration properties for Crestron GLS series occupancy sensors
/// </summary>
public class GlsOccupancySensorPropertiesConfig
{
// Single Technology Sensors (PIR): GlsOccupancySensorBase
[JsonProperty("enablePir")]
public bool? EnablePir { get; set; }
[JsonProperty("enableLedFlash")]
public bool? EnableLedFlash { get; set; }
[JsonProperty("shortTimeoutState")]
public bool? ShortTimeoutState { get; set; }
[JsonProperty("enableRawStates")]
public bool? EnableRawStates { get; set; }
[JsonProperty("remoteTimeout")]
public ushort? RemoteTimeout { get; set; }
[JsonProperty("internalPhotoSensorMinChange")]
public ushort? InternalPhotoSensorMinChange { get; set; }
[JsonProperty("externalPhotoSensorMinChange")]
public ushort? ExternalPhotoSensorMinChange { get; set; }
// Dual Technology Sensors: GlsOdtCCn
[JsonProperty("enableUsA")]
public bool? EnableUsA { get; set; }
[JsonProperty("enableUsB")]
public bool? EnableUsB { get; set; }
[JsonProperty("orWhenVacatedState")]
public bool? OrWhenVacatedState { get; set; }
[JsonProperty("andWhenVacatedState")]
public bool? AndWhenVacatedState { get; set; }
}
}

View File

@@ -1,183 +1,266 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.GeneralIO;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.Bridges;
namespace PepperDash.Essentials.Core
{
[Description("Wrapper class for Dual Technology GLS Occupancy Sensors")]
[Description("Wrapper class for Dual Technology GLS Occupancy Sensors")]
[ConfigSnippet("\"properties\": {\"control\": {\"method\": \"cresnet\",\"cresnetId\": \"97\"},\"enablePir\": true,\"enableLedFlash\": true,\"enableRawStates\":true,\"remoteTimeout\": 30,\"internalPhotoSensorMinChange\": 0,\"externalPhotoSensorMinChange\": 0,\"enableUsA\": true,\"enableUsB\": true,\"orWhenVacatedState\": true}")]
public class GlsOdtOccupancySensorController : GlsOccupancySensorBaseController
{
public new GlsOdtCCn OccSensor { get; private set; }
{
private GlsOdtCCn _occSensor;
public BoolFeedback OrWhenVacatedFeedback { get; private set; }
public BoolFeedback OrWhenVacatedFeedback { get; private set; }
public BoolFeedback AndWhenVacatedFeedback { get; private set; }
public BoolFeedback AndWhenVacatedFeedback { get; private set; }
public BoolFeedback UltrasonicAEnabledFeedback { get; private set; }
public BoolFeedback UltrasonicAEnabledFeedback { get; private set; }
public BoolFeedback UltrasonicBEnabledFeedback { get; private set; }
public BoolFeedback UltrasonicBEnabledFeedback { get; private set; }
public IntFeedback UltrasonicSensitivityInVacantStateFeedback { get; private set; }
public IntFeedback UltrasonicSensitivityInVacantStateFeedback { get; private set; }
public IntFeedback UltrasonicSensitivityInOccupiedStateFeedback { get; private set; }
public IntFeedback UltrasonicSensitivityInOccupiedStateFeedback { get; private set; }
public BoolFeedback RawOccupancyPirFeedback { get; private set; }
public BoolFeedback RawOccupancyPirFeedback { get; private set; }
public BoolFeedback RawOccupancyUsFeedback { get; private set; }
public BoolFeedback RawOccupancyUsFeedback { get; private set; }
public GlsOdtOccupancySensorController(string key, Func<DeviceConfig, GlsOdtCCn> preActivationFunc,
DeviceConfig config)
: base(key, config.Name)
public GlsOdtOccupancySensorController(string key, Func<DeviceConfig, GlsOdtCCn> preActivationFunc,
DeviceConfig config)
: base(key, config.Name, config)
{
AddPreActivationAction(() =>
{
_occSensor = preActivationFunc(config);
RegisterCrestronGenericBase(_occSensor);
RegisterGlsOccupancySensorBaseController(_occSensor);
AndWhenVacatedFeedback = new BoolFeedback(() => _occSensor.AndWhenVacatedFeedback.BoolValue);
OrWhenVacatedFeedback = new BoolFeedback(() => _occSensor.OrWhenVacatedFeedback.BoolValue);
UltrasonicAEnabledFeedback = new BoolFeedback(() => _occSensor.UsAEnabledFeedback.BoolValue);
UltrasonicBEnabledFeedback = new BoolFeedback(() => _occSensor.UsBEnabledFeedback.BoolValue);
RawOccupancyPirFeedback = new BoolFeedback(() => _occSensor.RawOccupancyPirFeedback.BoolValue);
RawOccupancyUsFeedback = new BoolFeedback(() => _occSensor.RawOccupancyUsFeedback.BoolValue);
UltrasonicSensitivityInVacantStateFeedback = new IntFeedback(() => _occSensor.UsSensitivityInVacantStateFeedback.UShortValue);
UltrasonicSensitivityInOccupiedStateFeedback = new IntFeedback(() => _occSensor.UsSensitivityInOccupiedStateFeedback.UShortValue);
});
}
protected override void ApplySettingsToSensorFromConfig()
{
AddPreActivationAction(() =>
base.ApplySettingsToSensorFromConfig();
if (PropertiesConfig.EnableUsA != null)
{
OccSensor = preActivationFunc(config);
Debug.Console(1, this, "EnableUsA found, attempting to set value from config");
SetUsAEnable((bool)PropertiesConfig.EnableUsA);
}
else
{
Debug.Console(1, this, "EnableUsA null, no value specified in config");
}
RegisterCrestronGenericBase(OccSensor);
RegisterGlsOdtSensorBaseController(OccSensor);
if (PropertiesConfig.EnableUsB != null)
{
Debug.Console(1, this, "EnableUsB found, attempting to set value from config");
SetUsBEnable((bool)PropertiesConfig.EnableUsB);
}
else
{
Debug.Console(1, this, "EnablePir null, no value specified in config");
}
AndWhenVacatedFeedback = new BoolFeedback(() => OccSensor.AndWhenVacatedFeedback.BoolValue);
OrWhenVacatedFeedback = new BoolFeedback(() => OccSensor.OrWhenVacatedFeedback.BoolValue);
if (PropertiesConfig.OrWhenVacatedState != null)
{
SetOrWhenVacatedState((bool)PropertiesConfig.OrWhenVacatedState);
}
UltrasonicAEnabledFeedback = new BoolFeedback(() => OccSensor.UsAEnabledFeedback.BoolValue);
UltrasonicBEnabledFeedback = new BoolFeedback(() => OccSensor.UsBEnabledFeedback.BoolValue);
RawOccupancyPirFeedback = new BoolFeedback(() => OccSensor.RawOccupancyPirFeedback.BoolValue);
RawOccupancyUsFeedback = new BoolFeedback(() => OccSensor.RawOccupancyUsFeedback.BoolValue);
UltrasonicSensitivityInVacantStateFeedback = new IntFeedback(() => OccSensor.UsSensitivityInVacantStateFeedback.UShortValue);
UltrasonicSensitivityInOccupiedStateFeedback = new IntFeedback(() => OccSensor.UsSensitivityInOccupiedStateFeedback.UShortValue);
});
if (PropertiesConfig.AndWhenVacatedState != null)
{
SetAndWhenVacatedState((bool)PropertiesConfig.AndWhenVacatedState);
}
}
/// <summary>
/// Overrides the base class event delegate to fire feedbacks for event IDs that pertain to this extended class.
/// Then calls the base delegate method to ensure any common event IDs are captured.
/// </summary>
/// <param name="device"></param>
/// <param name="args"></param>
protected override void OccSensor_GlsOccupancySensorChange(GlsOccupancySensorBase device, GlsOccupancySensorChangeEventArgs args)
/// <summary>
/// Overrides the base class event delegate to fire feedbacks for event IDs that pertain to this extended class.
/// Then calls the base delegate method to ensure any common event IDs are captured.
/// </summary>
/// <param name="device"></param>
/// <param name="args"></param>
protected override void OccSensor_GlsOccupancySensorChange(GlsOccupancySensorBase device, GlsOccupancySensorChangeEventArgs args)
{
switch (args.EventId)
{
case GlsOccupancySensorBase.AndWhenVacatedFeedbackEventId:
AndWhenVacatedFeedback.FireUpdate();
break;
case GlsOccupancySensorBase.OrWhenVacatedFeedbackEventId:
OrWhenVacatedFeedback.FireUpdate();
break;
case GlsOccupancySensorBase.UsAEnabledFeedbackEventId:
UltrasonicAEnabledFeedback.FireUpdate();
break;
case GlsOccupancySensorBase.UsBEnabledFeedbackEventId:
UltrasonicBEnabledFeedback.FireUpdate();
break;
case GlsOccupancySensorBase.UsSensitivityInOccupiedStateFeedbackEventId:
UltrasonicSensitivityInOccupiedStateFeedback.FireUpdate();
break;
case GlsOccupancySensorBase.UsSensitivityInVacantStateFeedbackEventId:
UltrasonicSensitivityInVacantStateFeedback.FireUpdate();
break;
}
base.OccSensor_GlsOccupancySensorChange(device, args);
}
/// <summary>
/// Overrides the base class event delegate to fire feedbacks for event IDs that pertain to this extended class.
/// Then calls the base delegate method to ensure any common event IDs are captured.
/// </summary>
/// <param name="device"></param>
/// <param name="args"></param>
protected override void OccSensor_BaseEvent(Crestron.SimplSharpPro.GenericBase device, Crestron.SimplSharpPro.BaseEventArgs args)
{
switch (args.EventId)
{
case GlsOccupancySensorBase.RawOccupancyPirFeedbackEventId:
RawOccupancyPirFeedback.FireUpdate();
break;
case GlsOccupancySensorBase.RawOccupancyUsFeedbackEventId:
RawOccupancyUsFeedback.FireUpdate();
break;
}
base.OccSensor_BaseEvent(device, args);
}
/// <summary>
/// Sets the OrWhenVacated state
/// </summary>
/// <param name="state"></param>
public void SetOrWhenVacatedState(bool state)
{
_occSensor.OrWhenVacated.BoolValue = state;
}
/// <summary>
/// Sets the AndWhenVacated state
/// </summary>
/// <param name="state"></param>
public void SetAndWhenVacatedState(bool state)
{
_occSensor.AndWhenVacated.BoolValue = state;
}
/// <summary>
/// Enables or disables the Ultrasonic A sensor
/// </summary>
/// <param name="state"></param>
public void SetUsAEnable(bool state)
{
_occSensor.EnableUsA.BoolValue = state;
_occSensor.DisableUsA.BoolValue = !state;
}
/// <summary>
/// Enables or disables the Ultrasonic B sensor
/// </summary>
/// <param name="state"></param>
public void SetUsBEnable(bool state)
{
_occSensor.EnableUsB.BoolValue = state;
_occSensor.DisableUsB.BoolValue = !state;
}
public void IncrementUsSensitivityInOccupiedState(bool pressRelease)
{
_occSensor.IncrementUsSensitivityInOccupiedState.BoolValue = pressRelease;
}
public void DecrementUsSensitivityInOccupiedState(bool pressRelease)
{
_occSensor.DecrementUsSensitivityInOccupiedState.BoolValue = pressRelease;
}
public void IncrementUsSensitivityInVacantState(bool pressRelease)
{
_occSensor.IncrementUsSensitivityInVacantState.BoolValue = pressRelease;
}
public void DecrementUsSensitivityInVacantState(bool pressRelease)
{
_occSensor.DecrementUsSensitivityInVacantState.BoolValue = pressRelease;
}
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{
LinkOccSensorToApi(this, trilist, joinStart, joinMapKey, bridge);
}
/// <summary>
/// Method to print occ sensor settings to console.
/// </summary>
public override void GetSettings()
{
base.GetSettings();
Debug.Console(0, this, "Ultrasonic Enabled A: {0} | B: {1}",
_occSensor.UsAEnabledFeedback.BoolValue,
_occSensor.UsBEnabledFeedback.BoolValue);
Debug.Console(0, this, "Ultrasonic Sensitivity Occupied: {0} | Vacant: {1}",
_occSensor.UsSensitivityInOccupiedStateFeedback.UShortValue,
_occSensor.UsSensitivityInVacantStateFeedback.UShortValue);
var dash = new string('*', 50);
CrestronConsole.PrintLine(string.Format("{0}\n", dash));
}
}
public class GlsOdtOccupancySensorControllerFactory : EssentialsDeviceFactory<GlsOdtOccupancySensorController>
{
public GlsOdtOccupancySensorControllerFactory()
{
if (args.EventId == GlsOccupancySensorBase.AndWhenVacatedFeedbackEventId)
AndWhenVacatedFeedback.FireUpdate();
else if (args.EventId == GlsOccupancySensorBase.OrWhenVacatedFeedbackEventId)
OrWhenVacatedFeedback.FireUpdate();
else if (args.EventId == GlsOccupancySensorBase.UsAEnabledFeedbackEventId)
UltrasonicAEnabledFeedback.FireUpdate();
else if (args.EventId == GlsOccupancySensorBase.UsBEnabledFeedbackEventId)
UltrasonicBEnabledFeedback.FireUpdate();
else if (args.EventId == GlsOccupancySensorBase.UsSensitivityInOccupiedStateFeedbackEventId)
UltrasonicSensitivityInOccupiedStateFeedback.FireUpdate();
else if (args.EventId == GlsOccupancySensorBase.UsSensitivityInVacantStateFeedbackEventId)
UltrasonicSensitivityInVacantStateFeedback.FireUpdate();
base.OccSensor_GlsOccupancySensorChange(device, args);
TypeNames = new List<string> { "glsodtccn" };
}
/// <summary>
/// Overrides the base class event delegate to fire feedbacks for event IDs that pertain to this extended class.
/// Then calls the base delegate method to ensure any common event IDs are captured.
/// </summary>
/// <param name="device"></param>
/// <param name="args"></param>
protected override void OccSensor_BaseEvent(Crestron.SimplSharpPro.GenericBase device, Crestron.SimplSharpPro.BaseEventArgs args)
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
if (args.EventId == GlsOccupancySensorBase.RawOccupancyPirFeedbackEventId)
RawOccupancyPirFeedback.FireUpdate();
else if (args.EventId == GlsOccupancySensorBase.RawOccupancyUsFeedbackEventId)
RawOccupancyUsFeedback.FireUpdate();
Debug.Console(1, "Factory Attempting to create new GlsOccupancySensorBaseController Device");
base.OccSensor_BaseEvent(device, args);
return new GlsOdtOccupancySensorController(dc.Key, GetGlsOdtCCn, dc);
}
/// <summary>
/// Sets the OrWhenVacated state
/// </summary>
/// <param name="state"></param>
public void SetOrWhenVacatedState(bool state)
{
OccSensor.OrWhenVacated.BoolValue = state;
}
/// <summary>
/// Sets the AndWhenVacated state
/// </summary>
/// <param name="state"></param>
public void SetAndWhenVacatedState(bool state)
{
OccSensor.AndWhenVacated.BoolValue = state;
}
/// <summary>
/// Enables or disables the Ultrasonic A sensor
/// </summary>
/// <param name="state"></param>
public void SetUsAEnable(bool state)
{
OccSensor.EnableUsA.BoolValue = state;
OccSensor.DisableUsA.BoolValue = !state;
}
/// <summary>
/// Enables or disables the Ultrasonic B sensor
/// </summary>
/// <param name="state"></param>
public void SetUsBEnable(bool state)
{
OccSensor.EnableUsB.BoolValue = state;
OccSensor.DisableUsB.BoolValue = !state;
}
public void IncrementUsSensitivityInOccupiedState(bool pressRelease)
{
OccSensor.IncrementUsSensitivityInOccupiedState.BoolValue = pressRelease;
}
public void DecrementUsSensitivityInOccupiedState(bool pressRelease)
{
OccSensor.DecrementUsSensitivityInOccupiedState.BoolValue = pressRelease;
}
public void IncrementUsSensitivityInVacantState(bool pressRelease)
{
OccSensor.IncrementUsSensitivityInVacantState.BoolValue = pressRelease;
}
public void DecrementUsSensitivityInVacantState(bool pressRelease)
{
OccSensor.DecrementUsSensitivityInVacantState.BoolValue = pressRelease;
}
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{
LinkOccSensorToApi(this, trilist, joinStart, joinMapKey, bridge);
}
#region PreActivation
private static GlsOdtCCn GetGlsOdtCCn(DeviceConfig dc)
{
var control = CommFactory.GetControlPropertiesConfig(dc);
var cresnetId = control.CresnetIdInt;
var branchId = control.ControlPortNumber;
var parentKey = string.IsNullOrEmpty(control.ControlPortDevKey) ? "processor" : control.ControlPortDevKey;
var parentKey = String.IsNullOrEmpty(control.ControlPortDevKey) ? "processor" : control.ControlPortDevKey;
if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase))
{
@@ -194,24 +277,6 @@ namespace PepperDash.Essentials.Core
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

@@ -0,0 +1,80 @@
using System;
using System.Collections.Generic;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.GeneralIO;
using PepperDash.Core;
using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.Core
{
public class GlsOirOccupancySensorController:GlsOccupancySensorBaseController
{
private GlsOirCCn _occSensor;
public GlsOirOccupancySensorController(string key, Func<DeviceConfig, GlsOirCCn> preActivationFunc,DeviceConfig config) : this(key,config.Name, preActivationFunc, config)
{
}
public GlsOirOccupancySensorController(string key, string name, Func<DeviceConfig, GlsOirCCn> preActivationFunc, DeviceConfig config) : base(key, name, config)
{
AddPreActivationAction(() =>
{
_occSensor = preActivationFunc(config);
RegisterCrestronGenericBase(_occSensor);
RegisterGlsOccupancySensorBaseController(_occSensor);
});
}
#region Overrides of CrestronGenericBridgeableBaseDevice
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{
LinkOccSensorToApi(this, trilist, joinStart, joinMapKey, bridge);
}
#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 GlsOirOccupancySensorController Device");
return new GlsOirOccupancySensorController(dc.Key, GetGlsOirCCn, dc);
}
private static GlsOirCCn GetGlsOirCCn(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 GlsOirCCn", parentKey);
return new GlsOirCCn(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 GlsOirCCn", parentKey);
return new GlsOirCCn(cresnetId, cresnetBridge.CresnetBranches[branchId]);
}
Debug.Console(0, "Device {0} is not a valid cresnet master", parentKey);
return null;
}
}
}

View File

@@ -4,7 +4,7 @@ using Crestron.SimplSharpPro.GeneralIO;
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core.Bridges;
using PepperDash_Essentials_Core.Bridges.JoinMaps;
using PepperDash.Essentials.Core.Bridges.JoinMaps;
using System;
using System.Collections.Generic;

View File

@@ -143,6 +143,7 @@
<Compile Include="Bridges\JoinMaps\Hrxxx0WirelessRemoteControllerJoinMap.cs" />
<Compile Include="Bridges\JoinMaps\IBasicCommunicationJoinMap.cs" />
<Compile Include="Bridges\JoinMaps\IDigitalInputJoinMap.cs" />
<Compile Include="Bridges\JoinMaps\IRBlurayBaseJoinMap.cs" />
<Compile Include="Bridges\JoinMaps\SetTopBoxControllerJoinMap.cs" />
<Compile Include="Bridges\JoinMaps\StatusSignControllerJoinMap.cs" />
<Compile Include="Bridges\JoinMaps\SystemMonitorJoinMap.cs" />
@@ -220,10 +221,15 @@
<Compile Include="Fusion\FusionCustomPropertiesBridge.cs" />
<Compile Include="Fusion\FusionEventHandlers.cs" />
<Compile Include="Fusion\FusionProcessorQueries.cs" />
<Compile Include="Fusion\EssentialsHuddleSpaceRoomFusionRoomJoinMap.cs" />
<Compile Include="Fusion\FusionRviDataClasses.cs" />
<Compile Include="Gateways\CenRfgwController.cs" />
<Compile Include="Gateways\EssentialsRfGatewayConfig.cs" />
<Compile Include="Global\EthernetAdapterInfo.cs" />
<Compile Include="Interfaces\ILogStrings.cs" />
<Compile Include="Interfaces\ILogStringsWithLevel.cs" />
<Compile Include="Occupancy\GlsOccupancySensorPropertiesConfig.cs" />
<Compile Include="Occupancy\GlsOirOccupancySensorController.cs" />
<Compile Include="Queues\ComsMessage.cs" />
<Compile Include="Queues\ProcessStringMessage.cs" />
<Compile Include="Queues\GenericQueue.cs" />
@@ -323,6 +329,7 @@
<Compile Include="Routing\TieLine.cs" />
<Compile Include="Queues\StringResponseProcessor.cs" />
<Compile Include="Timers\CountdownTimer.cs" />
<Compile Include="Timers\RetriggerableTimer.cs" />
<Compile Include="Touchpanels\CrestronTouchpanelPropertiesConfig.cs" />
<Compile Include="Touchpanels\Interfaces.cs" />
<Compile Include="Touchpanels\Keyboards\HabaneroKeyboardController.cs" />
@@ -333,6 +340,7 @@
<Compile Include="UI PageManagers\SinglePageManager.cs" />
<Compile Include="UI PageManagers\PageManager.cs" />
<Compile Include="UI PageManagers\SetTopBoxTwoPanelPageManager.cs" />
<Compile Include="Utilities\ActionSequence.cs" />
<Compile Include="VideoStatus\VideoStatusOutputs.cs" />
<Compile Include="Crestron\CrestronGenericBaseDevice.cs" />
<Compile Include="DeviceControlsParentInterfaces\IPresentationSource.cs" />

View File

@@ -14,7 +14,7 @@
<tags>crestron 3series 4series</tags>
<repository type="git" url="https://github.com/PepperDash/Essentials"/>
<dependencies>
<dependency id="PepperDashCore" version="[1.0.44, 1.1.0)"/>
<dependency id="PepperDashCore" version="[1.0.45, 1.1.0)"/>
</dependencies>
</metadata>
<files>

View File

@@ -1,7 +1,7 @@
using System;
using PepperDash.Core;
namespace PepperDash_Essentials_Core.Queues
namespace PepperDash.Essentials.Core.Queues
{
/// <summary>
/// IBasicCommunication Message for IQueue
@@ -40,7 +40,79 @@ namespace PepperDash_Essentials_Core.Queues
private void Validate(IBasicCommunication coms, object message)
{
if (_coms == null)
if (coms == null)
throw new ArgumentNullException("coms");
if (message == null)
throw new ArgumentNullException("message");
}
/// <summary>
/// Dispatchs the string/byte[] to the IBasicCommunication specified
/// </summary>
public void Dispatch()
{
if (_isByteMessage)
{
_coms.SendBytes(_bytes);
}
else
{
_coms.SendText(_string);
}
}
/// <summary>
/// Shows either the byte[] or string to be sent
/// </summary>
public override string ToString()
{
return _bytes != null ? _bytes.ToString() : _string;
}
}
}
namespace PepperDash_Essentials_Core.Queues
{
/// <summary>
/// IBasicCommunication Message for IQueue
/// </summary>
[Obsolete("Use PepperDash.Essentials.Core.Queues")]
public class ComsMessage : IQueueMessage
{
private readonly byte[] _bytes;
private readonly IBasicCommunication _coms;
private readonly string _string;
private readonly bool _isByteMessage;
/// <summary>
/// Constructor for a string message
/// </summary>
/// <param name="coms">IBasicCommunication to send the message</param>
/// <param name="message">Message to send</param>
public ComsMessage(IBasicCommunication coms, string message)
{
Validate(coms, message);
_coms = coms;
_string = message;
}
/// <summary>
/// Constructor for a byte message
/// </summary>
/// <param name="coms">IBasicCommunication to send the message</param>
/// <param name="message">Message to send</param>
public ComsMessage(IBasicCommunication coms, byte[] message)
{
Validate(coms, message);
_coms = coms;
_bytes = message;
_isByteMessage = true;
}
private void Validate(IBasicCommunication coms, object message)
{
if (coms == null)
throw new ArgumentNullException("coms");
if (message == null)

View File

@@ -3,7 +3,7 @@ using Crestron.SimplSharp;
using Crestron.SimplSharpPro.CrestronThread;
using PepperDash.Core;
namespace PepperDash_Essentials_Core.Queues
namespace PepperDash.Essentials.Core.Queues
{
/// <summary>
/// Threadsafe processing of queued items with pacing if required
@@ -15,23 +15,140 @@ namespace PepperDash_Essentials_Core.Queues
protected readonly Thread _worker;
protected readonly CEvent _waitHandle = new CEvent();
private readonly bool _delayEnabled;
private readonly int _delayTime;
private bool _delayEnabled;
private int _delayTime;
private const Thread.eThreadPriority _defaultPriority = Thread.eThreadPriority.MediumPriority;
/// <summary>
/// If the instance has been disposed.
/// </summary>
public bool Disposed { get; private set; }
/// <summary>
/// Returns the capacity of the CrestronQueue (fixed Size property)
/// </summary>
public int QueueCapacity
{
get
{
return _queue.Size;
}
}
/// <summary>
/// Returns the number of elements currently in the CrestronQueue
/// </summary>
public int QueueCount
{
get
{
return _queue.Count;
}
}
/// <summary>
/// Constructor with no thread priority
/// </summary>
/// <param name="key"></param>
public GenericQueue(string key)
: this(key, _defaultPriority, 0, 0)
{
}
/// <summary>
/// Constructor with queue size
/// </summary>
/// <param name="key"></param>
/// <param name="capacity">Fixed size for the queue to hold</param>
public GenericQueue(string key, int capacity)
: this(key, _defaultPriority, capacity, 0)
{
}
/// <summary>
/// Constructor for generic queue with no pacing
/// </summary>
/// <param name="key">Key</param>
public GenericQueue(string key)
/// <param name="pacing">Pacing in ms between actions</param>
public GenericQueue(int pacing, string key)
: this(key, _defaultPriority, 0, pacing)
{
}
/// <summary>
/// Constructor with pacing and capacity
/// </summary>
/// <param name="key"></param>
/// <param name="pacing"></param>
/// <param name="capacity"></param>
public GenericQueue(string key, int pacing, int capacity)
: this(key, _defaultPriority, capacity, pacing)
{
}
/// <summary>
/// Constructor with pacing and priority
/// </summary>
/// <param name="key"></param>
/// <param name="pacing"></param>
/// <param name="priority"></param>
public GenericQueue(string key, int pacing, Thread.eThreadPriority priority)
: this(key, priority, 0, pacing)
{
}
/// <summary>
/// Constructor with pacing, priority and capacity
/// </summary>
/// <param name="key"></param>
/// <param name="priority"></param>
/// <param name="capacity"></param>
public GenericQueue(string key, Thread.eThreadPriority priority, int capacity)
: this(key, priority, capacity, 0)
{
}
/// <summary>
/// Constructor with pacing, priority and capacity
/// </summary>
/// <param name="key"></param>
/// <param name="pacing"></param>
/// <param name="priority"></param>
/// <param name="capacity"></param>
public GenericQueue(string key, int pacing, Thread.eThreadPriority priority, int capacity)
: this(key, priority, capacity, pacing)
{
}
/// <summary>
/// Constructor for generic queue with no pacing
/// </summary>
/// <param name="key">Key</param>
/// <param name="priority"></param>
/// <param name="capacity"></param>
/// <param name="pacing"></param>
protected GenericQueue(string key, Thread.eThreadPriority priority, int capacity, int pacing)
{
_key = key;
_queue = new CrestronQueue<IQueueMessage>();
_worker = new Thread(ProcessQueue, null, Thread.eThreadStartOptions.Running);
int cap = 25; // sets default
if (capacity > 0)
{
cap = capacity; // overrides default
}
_queue = new CrestronQueue<IQueueMessage>(cap);
_worker = new Thread(ProcessQueue, null, Thread.eThreadStartOptions.Running)
{
Priority = priority
};
SetDelayValues(pacing);
}
private void SetDelayValues(int pacing)
{
_delayEnabled = pacing > 0;
_delayTime = pacing;
CrestronEnvironment.ProgramStatusEventHandler += programEvent =>
{
@@ -41,17 +158,257 @@ namespace PepperDash_Essentials_Core.Queues
Dispose();
};
}
/// <summary>
/// Thread callback
/// </summary>
/// <param name="obj">The action used to process dequeued items</param>
/// <returns>Null when the thread is exited</returns>
private object ProcessQueue(object obj)
{
while (true)
{
IQueueMessage item = null;
if (_queue.Count > 0)
{
item = _queue.Dequeue();
if (item == null)
break;
}
if (item != null)
{
try
{
Debug.Console(2, this, "Processing queue item: '{0}'", item.ToString());
item.Dispatch();
if (_delayEnabled)
Thread.Sleep(_delayTime);
}
catch (Exception ex)
{
Debug.Console(0, this, Debug.ErrorLogLevel.Error, "Caught an exception in the Queue {0}\r{1}\r{2}", ex.Message, ex.InnerException, ex.StackTrace);
}
}
else _waitHandle.Wait();
}
return null;
}
public void Enqueue(IQueueMessage item)
{
if (Disposed)
{
Debug.Console(1, this, "I've been disposed so you can't enqueue any messages. Are you trying to dispatch a message while the program is stopping?");
return;
}
_queue.Enqueue(item);
_waitHandle.Set();
}
/// <summary>
/// Disposes the thread and cleans up resources. Thread cannot be restarted once
/// disposed.
/// </summary>
public void Dispose()
{
Dispose(true);
CrestronEnvironment.GC.SuppressFinalize(this);
}
/// <summary>
/// Actually does the disposing. If you override this method, be sure to either call the base implementation
/// or clean up all the resources yourself.
/// </summary>
/// <param name="disposing">set to true unless called from finalizer</param>
protected void Dispose(bool disposing)
{
if (Disposed)
return;
if (disposing)
{
Enqueue(null);
_worker.Join();
_waitHandle.Close();
}
Disposed = true;
}
~GenericQueue()
{
Dispose(false);
}
/// <summary>
/// Key
/// </summary>
public string Key
{
get { return _key; }
}
}
}
namespace PepperDash_Essentials_Core.Queues
{
/// <summary>
/// Threadsafe processing of queued items with pacing if required
/// </summary>
[Obsolete("Use PepperDash.Essentials.Core.Queues")]
public class GenericQueue : IQueue<IQueueMessage>
{
private readonly string _key;
protected readonly CrestronQueue<IQueueMessage> _queue;
protected readonly Thread _worker;
protected readonly CEvent _waitHandle = new CEvent();
private bool _delayEnabled;
private int _delayTime;
private const Thread.eThreadPriority _defaultPriority = Thread.eThreadPriority.MediumPriority;
/// <summary>
/// If the instance has been disposed.
/// </summary>
public bool Disposed { get; private set; }
/// <summary>
/// Returns the capacity of the CrestronQueue (fixed Size property)
/// </summary>
public int QueueCapacity
{
get
{
return _queue.Size;
}
}
/// <summary>
/// Returns the number of elements currently in the CrestronQueue
/// </summary>
public int QueueCount
{
get
{
return _queue.Count;
}
}
/// <summary>
/// Constructor with no thread priority
/// </summary>
/// <param name="key"></param>
public GenericQueue(string key)
: this(key, _defaultPriority, 0, 0)
{
}
/// <summary>
/// Constructor with queue size
/// </summary>
/// <param name="key"></param>
/// <param name="capacity">Fixed size for the queue to hold</param>
public GenericQueue(string key, int capacity)
: this(key, _defaultPriority, capacity, 0)
{
}
/// <summary>
/// Constructor for generic queue with no pacing
/// </summary>
/// <param name="key">Key</param>
/// <param name="pacing">Pacing in ms between actions</param>
public GenericQueue(string key, int pacing)
: this(key)
public GenericQueue(int pacing, string key)
: this(key, _defaultPriority, 0, pacing)
{
}
/// <summary>
/// Constructor with pacing and capacity
/// </summary>
/// <param name="key"></param>
/// <param name="pacing"></param>
/// <param name="capacity"></param>
public GenericQueue(string key, int pacing, int capacity)
: this(key, _defaultPriority, capacity, pacing)
{
}
/// <summary>
/// Constructor with pacing and priority
/// </summary>
/// <param name="key"></param>
/// <param name="pacing"></param>
/// <param name="priority"></param>
public GenericQueue(string key, int pacing, Thread.eThreadPriority priority)
: this(key, priority, 0, pacing)
{
}
/// <summary>
/// Constructor with pacing, priority and capacity
/// </summary>
/// <param name="key"></param>
/// <param name="priority"></param>
/// <param name="capacity"></param>
public GenericQueue(string key, Thread.eThreadPriority priority, int capacity)
: this(key, priority, capacity, 0)
{
}
/// <summary>
/// Constructor with pacing, priority and capacity
/// </summary>
/// <param name="key"></param>
/// <param name="pacing"></param>
/// <param name="priority"></param>
/// <param name="capacity"></param>
public GenericQueue(string key, int pacing, Thread.eThreadPriority priority, int capacity)
: this(key, priority, capacity, pacing)
{
}
/// <summary>
/// Constructor for generic queue with no pacing
/// </summary>
/// <param name="key">Key</param>
/// <param name="priority"></param>
/// <param name="capacity"></param>
/// <param name="pacing"></param>
protected GenericQueue(string key, Thread.eThreadPriority priority, int capacity, int pacing)
{
_key = key;
int cap = 25; // sets default
if (capacity > 0)
{
cap = capacity; // overrides default
}
_queue = new CrestronQueue<IQueueMessage>(cap);
_worker = new Thread(ProcessQueue, null, Thread.eThreadStartOptions.Running)
{
Priority = priority
};
SetDelayValues(pacing);
}
private void SetDelayValues(int pacing)
{
_delayEnabled = pacing > 0;
_delayTime = pacing;
CrestronEnvironment.ProgramStatusEventHandler += programEvent =>
{
if (programEvent != eProgramStatusEventType.Stopping)
return;
Dispose();
};
}
/// <summary>
@@ -83,7 +440,7 @@ namespace PepperDash_Essentials_Core.Queues
}
catch (Exception ex)
{
Debug.ConsoleWithLog(0, this, "Caught an exception in the Queue {0}\r{1}\r{2}", ex.Message, ex.InnerException, ex.StackTrace);
Debug.Console(0, this, Debug.ErrorLogLevel.Error, "Caught an exception in the Queue {0}\r{1}\r{2}", ex.Message, ex.InnerException, ex.StackTrace);
}
}
else _waitHandle.Wait();

View File

@@ -5,11 +5,21 @@ using System.Text;
using Crestron.SimplSharp;
using PepperDash.Core;
namespace PepperDash_Essentials_Core.Queues
namespace PepperDash.Essentials.Core.Queues
{
public interface IQueue<T> : IKeyed, IDisposable where T : class
{
void Enqueue(T item);
bool Disposed { get; }
}
}
namespace PepperDash_Essentials_Core.Queues
{
[Obsolete("Use PepperDash.Essentials.Core.Queues")]
public interface IQueue<T> : IKeyed, IDisposable where T : class
{
void Enqueue(T item);
bool Disposed { get; }
}
}

View File

@@ -1,7 +1,18 @@
namespace PepperDash_Essentials_Core.Queues
using System;
namespace PepperDash.Essentials.Core.Queues
{
public interface IQueueMessage
{
void Dispatch();
}
}
namespace PepperDash_Essentials_Core.Queues
{
[Obsolete("Use PepperDash.Essentials.Core.Queues")]
public interface IQueueMessage
{
void Dispatch();
}
}

View File

@@ -1,6 +1,6 @@
using System;
namespace PepperDash_Essentials_Core.Queues
namespace PepperDash.Essentials.Core.Queues
{
/// <summary>
/// Message class for processing strings via an IQueue
@@ -32,6 +32,50 @@ namespace PepperDash_Essentials_Core.Queues
_action(_message);
}
/// <summary>
/// To string
/// </summary>
/// <returns>The current message</returns>
public override string ToString()
{
return _message ?? String.Empty;
}
}
}
namespace PepperDash_Essentials_Core.Queues
{
/// <summary>
/// Message class for processing strings via an IQueue
/// </summary>
[Obsolete("Use PepperDash.Essentials.Core.Queues")]
public class ProcessStringMessage : IQueueMessage
{
private readonly Action<string> _action;
private readonly string _message;
/// <summary>
/// Constructor
/// </summary>
/// <param name="message">Message to be processed</param>
/// <param name="action">Action to invoke on the message</param>
public ProcessStringMessage(string message, Action<string> action)
{
_message = message;
_action = action;
}
/// <summary>
/// Processes the string with the given action
/// </summary>
public void Dispatch()
{
if (_action == null || String.IsNullOrEmpty(_message))
return;
_action(_message);
}
/// <summary>
/// To string
/// </summary>

View File

@@ -2,7 +2,7 @@
using Crestron.SimplSharp;
using PepperDash.Core;
namespace PepperDash_Essentials_Core.Queues
namespace PepperDash.Essentials.Core.Queues
{
public sealed class StringResponseProcessor : IKeyed, IDisposable
{
@@ -98,6 +98,110 @@ namespace PepperDash_Essentials_Core.Queues
/// </summary>
public bool Disposed { get; private set; }
~StringResponseProcessor()
{
Dispose(false);
}
}
}
namespace PepperDash_Essentials_Core.Queues
{
[Obsolete("Use PepperDash.Essentials.Core.Queues")]
public sealed class StringResponseProcessor : IKeyed, IDisposable
{
private readonly Action<string> _processStringAction;
private readonly IQueue<IQueueMessage> _queue;
private readonly IBasicCommunication _coms;
private readonly CommunicationGather _gather;
private StringResponseProcessor(string key, Action<string> processStringAction)
{
_processStringAction = processStringAction;
_queue = new GenericQueue(key);
CrestronEnvironment.ProgramStatusEventHandler += programEvent =>
{
if (programEvent != eProgramStatusEventType.Stopping)
return;
Dispose();
};
}
/// <summary>
/// Constructor that builds an instance and subscribes to coms TextReceived for processing
/// </summary>
/// <param name="coms">Com port to process strings from</param>
/// <param name="processStringAction">Action to process the incoming strings</param>
public StringResponseProcessor(IBasicCommunication coms, Action<string> processStringAction)
: this(coms.Key, processStringAction)
{
_coms = coms;
coms.TextReceived += OnResponseReceived;
}
/// <summary>
/// Constructor that builds an instance and subscribes to gather Line Received for processing
/// </summary>
/// <param name="gather">Gather to process strings from</param>
/// <param name="processStringAction">Action to process the incoming strings</param>
public StringResponseProcessor(CommunicationGather gather, Action<string> processStringAction)
: this(gather.Port.Key, processStringAction)
{
_gather = gather;
gather.LineReceived += OnResponseReceived;
}
private void OnResponseReceived(object sender, GenericCommMethodReceiveTextArgs args)
{
_queue.Enqueue(new ProcessStringMessage(args.Text, _processStringAction));
}
/// <summary>
/// Key
/// </summary>
public string Key
{
get { return _queue.Key; }
}
/// <summary>
/// Disposes the instance and cleans up resources.
/// </summary>
public void Dispose()
{
Dispose(true);
CrestronEnvironment.GC.SuppressFinalize(this);
}
private void Dispose(bool disposing)
{
if (Disposed)
return;
if (disposing)
{
if (_coms != null)
_coms.TextReceived -= OnResponseReceived;
if (_gather != null)
{
_gather.LineReceived -= OnResponseReceived;
_gather.Stop();
}
_queue.Dispose();
}
Disposed = true;
}
/// <summary>
/// If the instance has been disposed or not. If it has, you can not use it anymore
/// </summary>
public bool Disposed { get; private set; }
~StringResponseProcessor()
{
Dispose(false);

View File

@@ -83,7 +83,7 @@ namespace PepperDash.Essentials.Core
}
}
void _gateway_IsReadyEvent(object sender, PepperDash_Essentials_Core.IsReadyEventArgs e)
void _gateway_IsReadyEvent(object sender, IsReadyEventArgs e)
{
if (e.IsReady != true) return;
_remote = GetHr1x0WirelessRemote(_config);

View File

@@ -169,10 +169,15 @@ namespace PepperDash.Essentials.Core
void FeatureEventGroup_UserGroupCallBack(ScheduledEvent SchEvent, ScheduledEventCommon.eCallbackReason type)
{
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "{0}:{1} @ {2}", SchEvent.Name, type, DateTime.Now);
if (type == ScheduledEventCommon.eCallbackReason.NormalExpiration)
{
SchEvent.Acknowledge();
if (SchEvent.Name == FeatureEnableEventName)
{
if (PropertiesConfig.EnableRoomOnWhenOccupied)
FeatureEnabled = true;
@@ -248,9 +253,8 @@ namespace PepperDash.Essentials.Core
schEvent = new ScheduledEvent(name, FeatureEventGroup);
// Set up its initial properties
if(!schEvent.Acknowledgeable)
schEvent.Acknowledgeable = true;
schEvent.Acknowledgeable = false;
if(!schEvent.Persistent)
schEvent.Persistent = true;
@@ -287,7 +291,7 @@ namespace PepperDash.Essentials.Core
Debug.Console(1, this, "Event '{0}' Absolute time set to {1}", schEvent.Name, schEvent.DateAndTime.ToString());
CalculateAndSetAcknowledgeExpirationTimeout(schEvent, FeatureEnabledTime, FeatureDisabledTime);
//CalculateAndSetAcknowledgeExpirationTimeout(schEvent, FeatureEnabledTime, FeatureDisabledTime);
schEvent.Recurrence.Weekly(eventRecurrennce);

View File

@@ -53,18 +53,22 @@ namespace PepperDash.Essentials.Core
/// </summary>
///
protected string _SourceListKey;
public virtual string SourceListKey {
public string SourceListKey {
get
{
return _SourceListKey;
}
set
private set
{
_SourceListKey = value;
if (value != _SourceListKey)
{
_SourceListKey = value;
}
}
}
protected const string _defaultSourceListKey = "default";
/// <summary>
/// Timer used for informing the UIs of a shutdown
/// </summary>
@@ -160,6 +164,22 @@ namespace PepperDash.Essentials.Core
return base.CustomActivate();
}
/// <summary>
/// Sets the SourceListKey property to the passed in value or the default if no value passed in
/// </summary>
/// <param name="sourceListKey"></param>
protected void SetSourceListKey(string sourceListKey)
{
if (!string.IsNullOrEmpty(sourceListKey))
{
SourceListKey = sourceListKey;
}
else
{
sourceListKey = _defaultSourceListKey;
}
}
/// <summary>
/// If mobile control is enabled, sets the appropriate properties
/// </summary>

View File

@@ -92,6 +92,16 @@ namespace PepperDash.Essentials.Core
void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType);
}
public interface IRoutingWithClear : IRouting
{
/// <summary>
/// Clears a route to an output, however a device needs to do that
/// </summary>
/// <param name="outputSelector">Output to clear</param>
/// <param name="signalType">signal type to clear</param>
void ClearRoute(object outputSelector, eRoutingSignalType signalType);
}
public interface IRoutingNumeric : IRouting
{
void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type);

View File

@@ -17,7 +17,7 @@ namespace PepperDash.Essentials.Core
public string Key { get; private set; }
public BoolFeedback IsRunningFeedback { get; private set; }
bool _IsRunning;
bool _isRunning;
public IntFeedback PercentFeedback { get; private set; }
public StringFeedback TimeRemainingFeedback { get; private set; }
@@ -32,7 +32,7 @@ namespace PepperDash.Essentials.Core
public DateTime StartTime { get; private set; }
public DateTime FinishTime { get; private set; }
CTimer SecondTimer;
private CTimer _secondTimer;
/// <summary>
/// Constructor
@@ -41,38 +41,34 @@ namespace PepperDash.Essentials.Core
public SecondsCountdownTimer(string key)
{
Key = key;
IsRunningFeedback = new BoolFeedback(() => _IsRunning);
IsRunningFeedback = new BoolFeedback(() => _isRunning);
TimeRemainingFeedback = new StringFeedback(() =>
{
// Need to handle up and down here.
if (StartTime == null || FinishTime == null)
return "";
var timeSpan = FinishTime - DateTime.Now;
if (timeSpan.TotalSeconds < 60)
Debug.Console(2, this,
"timeSpan.Minutes == {0}, timeSpan.Seconds == {1}, timeSpan.TotalSeconds == {2}",
timeSpan.Minutes, timeSpan.Seconds, timeSpan.TotalSeconds);
if (Math.Floor(timeSpan.TotalSeconds) < 60 && Math.Floor(timeSpan.TotalSeconds) >= 0) //ignore milliseconds
{
return Math.Round(timeSpan.TotalSeconds).ToString();
}
else
{
Debug.Console(2, this, "timeSpan.Minutes == {0}, timeSpan.Seconds == {1}", timeSpan.Minutes, timeSpan.Seconds);
return String.Format("{0:D2}:{1:D2}",
timeSpan.Minutes,
timeSpan.Seconds);
return String.Format("{0:00}", timeSpan.Seconds);
}
return Math.Floor(timeSpan.TotalSeconds) < 0
? "00"
: String.Format("{0:00}:{1:00}", timeSpan.Minutes, timeSpan.Seconds);
});
PercentFeedback = new IntFeedback(() =>
{
if (StartTime == null || FinishTime == null)
return 0;
double percent = (FinishTime - DateTime.Now).TotalSeconds
/ (FinishTime - StartTime).TotalSeconds
* 100;
return (int)percent;
});
PercentFeedback =
new IntFeedback(
() =>
(int)
(Math.Floor((FinishTime - DateTime.Now).TotalSeconds)/
Math.Floor((FinishTime - StartTime).TotalSeconds)*100));
}
/// <summary>
@@ -80,15 +76,15 @@ namespace PepperDash.Essentials.Core
/// </summary>
public void Start()
{
if (_IsRunning)
if (_isRunning)
return;
StartTime = DateTime.Now;
FinishTime = StartTime + TimeSpan.FromSeconds(SecondsToCount);
if (SecondTimer != null)
SecondTimer.Stop();
SecondTimer = new CTimer(SecondElapsedTimerCallback, null, 0, 1000);
_IsRunning = true;
if (_secondTimer != null)
_secondTimer.Stop();
_secondTimer = new CTimer(SecondElapsedTimerCallback, null, 0, 1000);
_isRunning = true;
IsRunningFeedback.FireUpdate();
var handler = HasStarted;
@@ -101,7 +97,7 @@ namespace PepperDash.Essentials.Core
/// </summary>
public void Reset()
{
_IsRunning = false;
_isRunning = false;
Start();
}
@@ -131,19 +127,22 @@ namespace PepperDash.Essentials.Core
void StopHelper()
{
if (SecondTimer != null)
SecondTimer.Stop();
_IsRunning = false;
if (_secondTimer != null)
_secondTimer.Stop();
_isRunning = false;
IsRunningFeedback.FireUpdate();
}
void SecondElapsedTimerCallback(object o)
{
if (DateTime.Now >= FinishTime)
{
Finish();
return;
}
PercentFeedback.FireUpdate();
TimeRemainingFeedback.FireUpdate();
if (DateTime.Now >= FinishTime)
Finish();
}
}
}

View File

@@ -0,0 +1,177 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
using Newtonsoft.Json;
namespace PepperDash.Essentials.Core.Timers
{
/// <summary>
/// A device that runs a retriggerable timer and can execute actions specified in config
/// </summary>
[Description("A retriggerable timer device")]
public class RetriggerableTimer : EssentialsDevice
{
private RetriggerableTimerPropertiesConfig _propertiesConfig;
private CTimer _timer;
private long _timerIntervalMs;
public RetriggerableTimer(string key, DeviceConfig config)
: base(key, config.Name)
{
var props = config.Properties.ToObject<RetriggerableTimerPropertiesConfig>();
_propertiesConfig = props;
if (_propertiesConfig != null)
{
_timerIntervalMs = _propertiesConfig.TimerIntervalMs;
}
}
public override bool CustomActivate()
{
if (_propertiesConfig.StartTimerOnActivation)
{
StartTimer();
}
return base.CustomActivate();
}
private void CleanUpTimer()
{
if (_timer != null)
{
_timer.Stop();
_timer.Dispose();
}
_timer = null;
}
public void StartTimer()
{
CleanUpTimer();
Debug.Console(0, this, "Starting Timer");
_timer = new CTimer(TimerElapsedCallback, GetActionFromConfig(eRetriggerableTimerEvents.Elapsed), _timerIntervalMs, _timerIntervalMs);
}
public void StopTimer()
{
Debug.Console(0, this, "Stopping Timer");
_timer.Stop();
ExecuteAction(GetActionFromConfig(eRetriggerableTimerEvents.Stopped));
}
private DeviceActionWrapper GetActionFromConfig(eRetriggerableTimerEvents eventType)
{
var action = _propertiesConfig.Events[eRetriggerableTimerEvents.Elapsed];
if (action != null)
return action;
else return null;
}
/// <summary>
/// Executes the Elapsed action from confing when the timer elapses
/// </summary>
/// <param name="o"></param>
private void TimerElapsedCallback(object action)
{
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "Timer Elapsed. Executing Action");
if (action == null)
{
Debug.Console(1, this, "Timer elapsed but unable to execute action. Action is null.");
return;
}
var devAction = action as DeviceActionWrapper;
if (devAction != null)
ExecuteAction(devAction);
else
{
Debug.Console(2, this, "Unable to cast action as DeviceActionWrapper. Cannot Execute");
}
}
private void ExecuteAction(DeviceActionWrapper action)
{
if (action == null)
return;
try
{
DeviceJsonApi.DoDeviceAction(action);
}
catch (Exception e)
{
Debug.Console(2, this, "Error Executing Action: {0}", e);
}
//finally // Not sure this is needed
//{
// _Timer.Reset(0, _TimerIntervalMs);
//}
}
}
/// <summary>
/// Configuration Properties for RetriggerableTimer
/// </summary>
public class RetriggerableTimerPropertiesConfig
{
[JsonProperty("startTimerOnActivation")]
public bool StartTimerOnActivation { get; set; }
[JsonProperty("timerIntervalMs")]
public long TimerIntervalMs { get; set; }
[JsonProperty("events")]
public Dictionary<eRetriggerableTimerEvents, DeviceActionWrapper> Events { get; set; }
public RetriggerableTimerPropertiesConfig()
{
Events = new Dictionary<eRetriggerableTimerEvents, DeviceActionWrapper>();
}
}
/// <summary>
/// The set of values describing events on the timer
/// </summary>
public enum eRetriggerableTimerEvents
{
Elapsed,
Stopped,
}
/// <summary>
/// Factory class
/// </summary>
public class RetriggerableTimerFactory : EssentialsDeviceFactory<RetriggerableTimer>
{
public RetriggerableTimerFactory()
{
TypeNames = new List<string>() { "retriggerabletimer" };
}
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory Attempting to create new RetriggerableTimer Device");
return new RetriggerableTimer(dc.Key, dc);
}
}
}

View File

@@ -169,9 +169,9 @@ namespace PepperDash.Essentials.Core.PageManagers
}
// Build presets
if (stb.HasPresets && stb.PresetsModel != null)
if (stb.HasPresets && stb.TvPresets != null)
{
PresetsView = new DevicePresetsView(trilist, stb.PresetsModel);
PresetsView = new DevicePresetsView(trilist, stb.TvPresets);
}
}

View File

@@ -18,8 +18,8 @@ namespace PepperDash.Essentials.Core.PageManagers
{
SetTopBox = stb;
TriList = trilist;
if(stb.PresetsModel != null)
PresetsView = new DevicePresetsView(trilist, stb.PresetsModel);
if(stb.TvPresets != null)
PresetsView = new DevicePresetsView(trilist, stb.TvPresets);
}
public override void Show()

View File

@@ -0,0 +1,159 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro.CrestronThread;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
using Newtonsoft.Json;
namespace PepperDash.Essentials.Core.Utilities
{
/// <summary>
/// A device that executes a sequence of actions with optional delays between actions
/// </summary>
[Description("A device that executes a sequence of actions with optional delays between actions")]
public class ActionSequence : EssentialsDevice
{
private ActionSequencePropertiesConfig _propertiesConfig;
private CrestronQueue<SequencedDeviceActionWrapper> _actionQueue;
private Thread _worker;
private bool _allowActionsToExecute;
public ActionSequence(string key, DeviceConfig config)
: base(key, config.Name)
{
var props = config.Properties.ToObject<ActionSequencePropertiesConfig>();
_propertiesConfig = props;
if (_propertiesConfig != null)
{
if (_propertiesConfig.ActionSequence.Count > 0)
{
_actionQueue = new CrestronQueue<SequencedDeviceActionWrapper>(_propertiesConfig.ActionSequence.Count);
}
}
}
/// <summary>
/// Starts executing the sequenced actions
/// </summary>
public void StartSequence()
{
if (_worker !=null && _worker.ThreadState == Thread.eThreadStates.ThreadRunning)
{
Debug.Console(1, this, "Thread already running. Cannot Start Sequence");
return;
}
Debug.Console(1, this, "Starting Action Sequence");
_allowActionsToExecute = true;
AddActionsToQueue();
_worker = new Thread(ProcessActions, null, Thread.eThreadStartOptions.Running);
}
/// <summary>
/// Stops executing the sequenced actions
/// </summary>
public void StopSequence()
{
Debug.Console(1, this, "Stopping Action Sequence");
_allowActionsToExecute = false;
_worker.Abort();
}
/// <summary>
/// Populates the queue from the configuration information
/// </summary>
private void AddActionsToQueue()
{
Debug.Console(1, this, "Adding {0} actions to queue", _propertiesConfig.ActionSequence.Count);
for (int i = 0; i < _propertiesConfig.ActionSequence.Count; i++)
{
_actionQueue.Enqueue(_propertiesConfig.ActionSequence[i]);
}
}
private object ProcessActions(object obj)
{
while (_allowActionsToExecute && _actionQueue.Count > 0)
{
SequencedDeviceActionWrapper action = null;
action = _actionQueue.Dequeue();
if (action == null)
break;
// Delay before executing
if (action.DelayMs > 0)
Thread.Sleep(action.DelayMs);
ExecuteAction(action);
}
return null;
}
private void ExecuteAction(DeviceActionWrapper action)
{
if (action == null)
return;
try
{
DeviceJsonApi.DoDeviceAction(action);
}
catch (Exception e)
{
Debug.Console(2, this, "Error Executing Action: {0}", e);
}
}
}
/// <summary>
/// Configuration Properties for ActionSequence
/// </summary>
public class ActionSequencePropertiesConfig
{
[JsonProperty("actionSequence")]
public List<SequencedDeviceActionWrapper> ActionSequence { get; set; }
public ActionSequencePropertiesConfig()
{
ActionSequence = new List<SequencedDeviceActionWrapper>();
}
}
public class SequencedDeviceActionWrapper : DeviceActionWrapper
{
[JsonProperty("delayMs")]
public int DelayMs { get; set; }
}
/// <summary>
/// Factory class
/// </summary>
public class ActionSequenceFactory : EssentialsDeviceFactory<ActionSequence>
{
public ActionSequenceFactory()
{
TypeNames = new List<string>() { "actionsequence" };
}
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory Attempting to create new ActionSequence Device");
return new ActionSequence(dc.Key, dc);
}
}
}

View File

@@ -23,6 +23,8 @@ namespace PepperDash.Essentials.DM {
/// </summary>
public class DmBladeChassisController : CrestronGenericBridgeableBaseDevice, IDmSwitch, IRoutingNumericWithFeedback
{
private const string NonePortKey = "inputCard0--None";
public DMChassisPropertiesConfig PropertiesConfig { get; set; }
public Switch Chassis { get; private set; }
@@ -112,6 +114,10 @@ namespace PepperDash.Essentials.DM {
controller.AddVolumeControl(outNum, audio);
}
controller.InputPorts.Add(new RoutingInputPort(NonePortKey, eRoutingSignalType.Video,
eRoutingPortConnectionType.None, null, controller));
controller.InputNames = properties.InputNames;
controller.OutputNames = properties.OutputNames;
controller.PropertiesConfig = properties;
@@ -367,34 +373,28 @@ namespace PepperDash.Essentials.DM {
}
void AddHdmiOutBladePorts(uint number) {
AddOutputPortWithDebug(String.Format("outputBlade{0}", (number / 8 > 0 ? 1 : number / 8)), String.Format("hdmiOut{0}", number) , eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, number);
AddOutputPortWithDebug(String.Format("outputBlade{0}", (number / 8 > 0 ? 1 : number / 8)), String.Format("hdmiOut{0}", number) , eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, Chassis.Outputs[number]);
}
void AddDmOutBladePorts(uint number) {
AddOutputPortWithDebug(String.Format("outputBlade{0}", (number / 8 > 0 ? 1 : number / 8)), String.Format("dmOut{0}", number), eRoutingSignalType.Video, eRoutingPortConnectionType.DmCat, number);
AddOutputPortWithDebug(String.Format("outputBlade{0}", (number / 8 > 0 ? 1 : number / 8)), String.Format("dmOut{0}", number), eRoutingSignalType.Video, eRoutingPortConnectionType.DmCat, Chassis.Outputs[number]);
}
void AddDmOutMmFiberBladePorts(uint number) {
AddOutputPortWithDebug(String.Format("outputBlade{0}", (number / 8 > 0 ? 1 : number / 8)), String.Format("dmOut{0}", number), eRoutingSignalType.Video, eRoutingPortConnectionType.DmMmFiber, number);
AddOutputPortWithDebug(String.Format("outputBlade{0}", (number / 8 > 0 ? 1 : number / 8)), String.Format("dmOut{0}", number), eRoutingSignalType.Video, eRoutingPortConnectionType.DmMmFiber, Chassis.Outputs[number]);
}
void AddDmOutSmFiberBladePorts(uint number) {
AddOutputPortWithDebug(String.Format("outputBlade{0}", (number / 8 > 0 ? 1 : number / 8)), String.Format("dmOut{0}", number), eRoutingSignalType.Video, eRoutingPortConnectionType.DmSmFiber, number);
AddOutputPortWithDebug(String.Format("outputBlade{0}", (number / 8 > 0 ? 1 : number / 8)), String.Format("dmOut{0}", number), eRoutingSignalType.Video, eRoutingPortConnectionType.DmSmFiber, Chassis.Outputs[number]);
}
/// <summary>
/// Adds InputPort
/// </summary>
void AddInputPortWithDebug(uint cardNum, string portName, eRoutingSignalType sigType, eRoutingPortConnectionType portType) {
var portKey = string.Format("inputCard{0}--{1}", cardNum, portName);
Debug.Console(2, this, "Adding input port '{0}'", portKey);
var inputPort = new RoutingInputPort(portKey, sigType, portType, cardNum, this)
{
FeedbackMatchObject = Chassis.Inputs[cardNum]
};
InputPorts.Add(inputPort);
void AddInputPortWithDebug(uint cardNum, string portName, eRoutingSignalType sigType, eRoutingPortConnectionType portType)
{
AddInputPortWithDebug(cardNum, portName, sigType, portType, null);
}
/// <summary>
@@ -405,7 +405,7 @@ namespace PepperDash.Essentials.DM {
{
var portKey = string.Format("inputCard{0}--{1}", cardNum, portName);
Debug.Console(2, this, "Adding input port '{0}'", portKey);
var inputPort = new RoutingInputPort(portKey, sigType, portType, cardNum, this)
var inputPort = new RoutingInputPort(portKey, sigType, portType, Chassis.Inputs[cardNum], this)
{
FeedbackMatchObject = Chassis.Inputs[cardNum]
};
@@ -567,9 +567,7 @@ namespace PepperDash.Essentials.DM {
void StartOffTimer(PortNumberType pnt) {
if (RouteOffTimers.ContainsKey(pnt))
return;
RouteOffTimers[pnt] = new CTimer(o => {
ExecuteSwitch(0, pnt.Number, pnt.Type);
}, RouteOffTime);
RouteOffTimers[pnt] = new CTimer(o => ExecuteSwitch(null, pnt.Selector, pnt.Type), RouteOffTime);
}
@@ -592,11 +590,22 @@ namespace PepperDash.Essentials.DM {
public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType sigType) {
Debug.Console(2, this, "Making an awesome DM route from {0} to {1} {2}", inputSelector, outputSelector, sigType);
var input = Convert.ToUInt32(inputSelector); // Cast can sometimes fail
var output = Convert.ToUInt32(outputSelector);
var input = inputSelector as DMInput; // Cast can sometimes fail
var output = outputSelector as DMOutput;
if (output == null)
{
Debug.Console(0, this, Debug.ErrorLogLevel.Warning,
"Unable to execute switch for inputSelector {0} to outputSelector {1}", inputSelector,
outputSelector);
return;
}
// Check to see if there's an off timer waiting on this and if so, cancel
var key = new PortNumberType(output, sigType);
if (input == 0) {
if (input == null) {
StartOffTimer(key);
}
else {
@@ -609,13 +618,13 @@ namespace PepperDash.Essentials.DM {
var inCard = input == 0 ? null : Chassis.Inputs[input];
var outCard = input == 0 ? null : Chassis.Outputs[output];
/*var inCard = input == 0 ? null : Chassis.Inputs[input];
var outCard = input == 0 ? null : Chassis.Outputs[output];*/
// NOTE THAT BITWISE COMPARISONS - TO CATCH ALL ROUTING TYPES
if ((sigType | eRoutingSignalType.Video) != eRoutingSignalType.Video) return;
if ((sigType & eRoutingSignalType.Video) != eRoutingSignalType.Video) return;
Chassis.VideoEnter.BoolValue = true;
Chassis.Outputs[output].VideoOut = inCard;
output.VideoOut = input;
}
#endregion
@@ -624,7 +633,10 @@ namespace PepperDash.Essentials.DM {
public void ExecuteNumericSwitch(ushort inputSelector, ushort outputSelector, eRoutingSignalType sigType)
{
ExecuteSwitch(inputSelector, outputSelector, sigType);
var input = inputSelector == 0 ? null : Chassis.Inputs[inputSelector];
var output = Chassis.Outputs[outputSelector];
ExecuteSwitch(input, output, sigType);
}
#endregion

View File

@@ -21,8 +21,9 @@ namespace PepperDash.Essentials.DM
///
/// </summary>
[Description("Wrapper class for all DM-MD chassis variants from 8x8 to 32x32")]
public class DmChassisController : CrestronGenericBridgeableBaseDevice, IDmSwitch, IRoutingNumericWithFeedback
{
public class DmChassisController : CrestronGenericBridgeableBaseDevice, IDmSwitch, IRoutingNumericWithFeedback
{
private const string NonePortKey = "inputCard0--None";
public DMChassisPropertiesConfig PropertiesConfig { get; set; }
public Switch Chassis { get; private set; }
@@ -133,6 +134,12 @@ namespace PepperDash.Essentials.DM
var controller = new DmChassisController(key, name, chassis);
//
var clearInputPort = new RoutingInputPort(NonePortKey, eRoutingSignalType.AudioVideo,
eRoutingPortConnectionType.None, null, controller);
controller.InputPorts.Add(clearInputPort);
// add the cards and port names
foreach (var kvp in properties.InputSlots)
controller.AddInputCard(kvp.Value, kvp.Key);
@@ -485,169 +492,170 @@ namespace PepperDash.Essentials.DM
type = type.ToLower();
if (type == "dmchd")
{
var inputCard = new DmcHd(number, this.Chassis);
var cecPort = inputCard.HdmiInput as ICec;
AddHdmiInCardPorts(number, cecPort);
}
else if (type == "dmchddsp")
{
var inputCard = new DmcHdDsp(number, this.Chassis);
var cecPort = inputCard.HdmiInput as ICec;
AddHdmiInCardPorts(number, cecPort);
}
else if (type == "dmc4khd")
{
var inputCard = new Dmc4kHd(number, this.Chassis);
var cecPort = inputCard.HdmiInput as ICec;
AddHdmiInCardPorts(number, cecPort);
}
else if (type == "dmc4khddsp")
{
var inputCard = new Dmc4kHdDsp(number, this.Chassis);
var cecPort = inputCard.HdmiInput as ICec;
AddHdmiInCardPorts(number, cecPort);
}
else if (type == "dmc4kzhd")
{
var inputCard = new Dmc4kzHd(number, this.Chassis);
var cecPort = inputCard.HdmiInput as ICec;
AddHdmiInCardPorts(number, cecPort);
}
else if (type == "dmc4kzhddsp")
{
var inputCard = new Dmc4kzHdDsp(number, this.Chassis);
var cecPort = inputCard.HdmiInput as ICec;
AddHdmiInCardPorts(number, cecPort);
}
else if (type == "dmcc")
{
var inputCard = new DmcC(number, this.Chassis);
var cecPort = inputCard.DmInput as ICec;
AddDmInCardPorts(number, cecPort);
}
else if (type == "dmccdsp")
{
var inputCard = new DmcCDsp(number, this.Chassis);
var cecPort = inputCard.DmInput as ICec;
AddDmInCardPorts(number, cecPort);
}
else if (type == "dmc4kc")
{
var inputCard = new Dmc4kC(number, this.Chassis);
var cecPort = inputCard.DmInput as ICec;
AddDmInCardPorts(number, cecPort);
}
else if (type == "dmc4kcdsp")
{
var inputCard = new Dmc4kCDsp(number, this.Chassis);
var cecPort = inputCard.DmInput as ICec;
AddDmInCardPorts(number, cecPort);
}
else if (type == "dmc4kzc")
{
var inputCard = new Dmc4kzC(number, this.Chassis);
var cecPort = inputCard.DmInput as ICec;
AddDmInCardPorts(number, cecPort);
}
else if (type == "dmc4kzcdsp")
{
var inputCard = new Dmc4kzCDsp(number, this.Chassis);
var cecPort = inputCard.DmInput as ICec;
AddDmInCardPorts(number, cecPort);
}
else if (type == "dmccat")
{
new DmcCat(number, this.Chassis);
AddDmInCardPorts(number);
}
else if (type == "dmccatdsp")
{
new DmcCatDsp(number, this.Chassis);
AddDmInCardPorts(number);
}
else if (type == "dmcs")
{
new DmcS(number, Chassis);
AddInputPortWithDebug(number, "dmIn", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmMmFiber);
AddInCardHdmiAndAudioLoopPorts(number);
}
else if (type == "dmcsdsp")
{
new DmcSDsp(number, Chassis);
AddInputPortWithDebug(number, "dmIn", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmMmFiber);
AddInCardHdmiAndAudioLoopPorts(number);
}
else if (type == "dmcs2")
{
new DmcS2(number, Chassis);
AddInputPortWithDebug(number, "dmIn", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmSmFiber);
AddInCardHdmiAndAudioLoopPorts(number);
}
else if (type == "dmcs2dsp")
{
new DmcS2Dsp(number, Chassis);
AddInputPortWithDebug(number, "dmIn", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmSmFiber);
AddInCardHdmiAndAudioLoopPorts(number);
}
else if (type == "dmcsdi")
{
new DmcSdi(number, Chassis);
AddInputPortWithDebug(number, "sdiIn", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Sdi);
AddOutputPortWithDebug(string.Format("inputCard{0}", number), "sdiOut", eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.Sdi, null);
AddInCardHdmiAndAudioLoopPorts(number);
}
else if (type == "dmcdvi")
{
new DmcDvi(number, Chassis);
AddInputPortWithDebug(number, "dviIn", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Dvi);
AddInputPortWithDebug(number, "audioIn", eRoutingSignalType.Audio, eRoutingPortConnectionType.LineAudio);
AddInCardHdmiLoopPort(number);
}
else if (type == "dmcvga")
{
new DmcVga(number, Chassis);
AddInputPortWithDebug(number, "vgaIn", eRoutingSignalType.Video, eRoutingPortConnectionType.Vga);
AddInputPortWithDebug(number, "audioIn", eRoutingSignalType.Audio, eRoutingPortConnectionType.LineAudio);
AddInCardHdmiLoopPort(number);
}
else if (type == "dmcvidbnc")
{
new DmcVidBnc(number, Chassis);
AddInputPortWithDebug(number, "componentIn", eRoutingSignalType.Video, eRoutingPortConnectionType.Component);
AddInputPortWithDebug(number, "audioIn", eRoutingSignalType.Audio, eRoutingPortConnectionType.LineAudio);
AddInCardHdmiLoopPort(number);
}
else if (type == "dmcvidrcaa")
{
new DmcVidRcaA(number, Chassis);
AddInputPortWithDebug(number, "componentIn", eRoutingSignalType.Video, eRoutingPortConnectionType.Component);
AddInputPortWithDebug(number, "audioIn", eRoutingSignalType.Audio, eRoutingPortConnectionType.LineAudio);
AddInCardHdmiLoopPort(number);
}
else if (type == "dmcvidrcad")
{
new DmcVidRcaD(number, Chassis);
AddInputPortWithDebug(number, "componentIn", eRoutingSignalType.Video, eRoutingPortConnectionType.Component);
AddInputPortWithDebug(number, "audioIn", eRoutingSignalType.Audio, eRoutingPortConnectionType.DigitalAudio);
AddInCardHdmiLoopPort(number);
}
else if (type == "dmcvid4")
{
new DmcVid4(number, Chassis);
AddInputPortWithDebug(number, "compositeIn1", eRoutingSignalType.Video, eRoutingPortConnectionType.Composite);
AddInputPortWithDebug(number, "compositeIn2", eRoutingSignalType.Video, eRoutingPortConnectionType.Composite);
AddInputPortWithDebug(number, "compositeIn3", eRoutingSignalType.Video, eRoutingPortConnectionType.Composite);
AddInputPortWithDebug(number, "compositeIn4", eRoutingSignalType.Video, eRoutingPortConnectionType.Composite);
AddInCardHdmiLoopPort(number);
}
else if (type == "dmcstr")
{
new DmcStr(number, Chassis);
AddInputPortWithDebug(number, "streamIn", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Streaming);
AddInCardHdmiAndAudioLoopPorts(number);
switch (type)
{
case "dmchd":
{
var inputCard = new DmcHd(number, this.Chassis);
var cecPort = inputCard.HdmiInput as ICec;
AddHdmiInCardPorts(number, cecPort);
}
break;
case "dmchddsp":
{
var inputCard = new DmcHdDsp(number, this.Chassis);
var cecPort = inputCard.HdmiInput as ICec;
AddHdmiInCardPorts(number, cecPort);
}
break;
case "dmc4khd":
{
var inputCard = new Dmc4kHd(number, this.Chassis);
var cecPort = inputCard.HdmiInput as ICec;
AddHdmiInCardPorts(number, cecPort);
}
break;
case "dmc4khddsp":
{
var inputCard = new Dmc4kHdDsp(number, this.Chassis);
var cecPort = inputCard.HdmiInput as ICec;
AddHdmiInCardPorts(number, cecPort);
}
break;
case "dmc4kzhd":
{
var inputCard = new Dmc4kzHd(number, this.Chassis);
var cecPort = inputCard.HdmiInput as ICec;
AddHdmiInCardPorts(number, cecPort);
}
break;
case "dmc4kzhddsp":
{
var inputCard = new Dmc4kzHdDsp(number, this.Chassis);
var cecPort = inputCard.HdmiInput as ICec;
AddHdmiInCardPorts(number, cecPort);
}
break;
case "dmcc":
{
var inputCard = new DmcC(number, this.Chassis);
var cecPort = inputCard.DmInput as ICec;
AddDmInCardPorts(number, cecPort);
}
break;
case "dmccdsp":
{
var inputCard = new DmcCDsp(number, this.Chassis);
var cecPort = inputCard.DmInput as ICec;
AddDmInCardPorts(number, cecPort);
}
break;
case "dmc4kc":
{
var inputCard = new Dmc4kC(number, this.Chassis);
var cecPort = inputCard.DmInput as ICec;
AddDmInCardPorts(number, cecPort);
}
break;
case "dmc4kcdsp":
{
var inputCard = new Dmc4kCDsp(number, this.Chassis);
var cecPort = inputCard.DmInput as ICec;
AddDmInCardPorts(number, cecPort);
}
break;
case "dmc4kzc":
{
var inputCard = new Dmc4kzC(number, this.Chassis);
var cecPort = inputCard.DmInput as ICec;
AddDmInCardPorts(number, cecPort);
}
break;
case "dmc4kzcdsp":
{
var inputCard = new Dmc4kzCDsp(number, this.Chassis);
var cecPort = inputCard.DmInput as ICec;
AddDmInCardPorts(number, cecPort);
}
break;
case "dmccat":
new DmcCat(number, this.Chassis);
AddDmInCardPorts(number);
break;
case "dmccatdsp":
new DmcCatDsp(number, this.Chassis);
AddDmInCardPorts(number);
break;
case "dmcs":
new DmcS(number, Chassis);
AddInputPortWithDebug(number, "dmIn", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmMmFiber);
AddInCardHdmiAndAudioLoopPorts(number);
break;
case "dmcsdsp":
new DmcSDsp(number, Chassis);
AddInputPortWithDebug(number, "dmIn", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmMmFiber);
AddInCardHdmiAndAudioLoopPorts(number);
break;
case "dmcs2":
new DmcS2(number, Chassis);
AddInputPortWithDebug(number, "dmIn", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmSmFiber);
AddInCardHdmiAndAudioLoopPorts(number);
break;
case "dmcs2dsp":
new DmcS2Dsp(number, Chassis);
AddInputPortWithDebug(number, "dmIn", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmSmFiber);
AddInCardHdmiAndAudioLoopPorts(number);
break;
case "dmcsdi":
new DmcSdi(number, Chassis);
AddInputPortWithDebug(number, "sdiIn", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Sdi);
AddOutputPortWithDebug(string.Format("inputCard{0}", number), "sdiOut", eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.Sdi, null);
AddInCardHdmiAndAudioLoopPorts(number);
break;
case "dmcdvi":
new DmcDvi(number, Chassis);
AddInputPortWithDebug(number, "dviIn", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Dvi);
AddInputPortWithDebug(number, "audioIn", eRoutingSignalType.Audio, eRoutingPortConnectionType.LineAudio);
AddInCardHdmiLoopPort(number);
break;
case "dmcvga":
new DmcVga(number, Chassis);
AddInputPortWithDebug(number, "vgaIn", eRoutingSignalType.Video, eRoutingPortConnectionType.Vga);
AddInputPortWithDebug(number, "audioIn", eRoutingSignalType.Audio, eRoutingPortConnectionType.LineAudio);
AddInCardHdmiLoopPort(number);
break;
case "dmcvidbnc":
new DmcVidBnc(number, Chassis);
AddInputPortWithDebug(number, "componentIn", eRoutingSignalType.Video, eRoutingPortConnectionType.Component);
AddInputPortWithDebug(number, "audioIn", eRoutingSignalType.Audio, eRoutingPortConnectionType.LineAudio);
AddInCardHdmiLoopPort(number);
break;
case "dmcvidrcaa":
new DmcVidRcaA(number, Chassis);
AddInputPortWithDebug(number, "componentIn", eRoutingSignalType.Video, eRoutingPortConnectionType.Component);
AddInputPortWithDebug(number, "audioIn", eRoutingSignalType.Audio, eRoutingPortConnectionType.LineAudio);
AddInCardHdmiLoopPort(number);
break;
case "dmcvidrcad":
new DmcVidRcaD(number, Chassis);
AddInputPortWithDebug(number, "componentIn", eRoutingSignalType.Video, eRoutingPortConnectionType.Component);
AddInputPortWithDebug(number, "audioIn", eRoutingSignalType.Audio, eRoutingPortConnectionType.DigitalAudio);
AddInCardHdmiLoopPort(number);
break;
case "dmcvid4":
new DmcVid4(number, Chassis);
AddInputPortWithDebug(number, "compositeIn1", eRoutingSignalType.Video, eRoutingPortConnectionType.Composite);
AddInputPortWithDebug(number, "compositeIn2", eRoutingSignalType.Video, eRoutingPortConnectionType.Composite);
AddInputPortWithDebug(number, "compositeIn3", eRoutingSignalType.Video, eRoutingPortConnectionType.Composite);
AddInputPortWithDebug(number, "compositeIn4", eRoutingSignalType.Video, eRoutingPortConnectionType.Composite);
AddInCardHdmiLoopPort(number);
break;
case "dmcstr":
new DmcStr(number, Chassis);
AddInputPortWithDebug(number, "streamIn", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Streaming);
AddInCardHdmiAndAudioLoopPorts(number);
break;
}
}
@@ -692,119 +700,122 @@ namespace PepperDash.Essentials.DM
type = type.ToLower();
Debug.Console(2, this, "Adding output card '{0}', slot {1}", type, number);
if (type == "dmc4khdo")
{
var outputCard = new Dmc4kHdoSingle(number, Chassis);
var cecPort1 = outputCard.Card1.HdmiOutput;
var cecPort2 = outputCard.Card2.HdmiOutput;
AddDmcHdoPorts(number, cecPort1, cecPort2);
switch (type)
{
case "dmc4khdo":
{
var outputCard = new Dmc4kHdoSingle(number, Chassis);
var cecPort1 = outputCard.Card1.HdmiOutput;
var cecPort2 = outputCard.Card2.HdmiOutput;
AddDmcHdoPorts(number, cecPort1, cecPort2);
}
break;
case "dmc4kzhdo":
{
var outputCard = new Dmc4kzHdoSingle(number, Chassis);
var cecPort1 = outputCard.Card1.HdmiOutput;
var cecPort2 = outputCard.Card2.HdmiOutput;
AddDmcHdoPorts(number, cecPort1, cecPort2);
}
break;
case "dmchdo":
{
var outputCard = new DmcHdoSingle(number, Chassis);
var cecPort1 = outputCard.Card1.HdmiOutput;
var cecPort2 = outputCard.Card2.HdmiOutput;
AddDmcHdoPorts(number, cecPort1, cecPort2);
}
break;
case "dmc4kcohd":
{
var outputCard = new Dmc4kCoHdSingle(number, Chassis);
var cecPort1 = outputCard.Card1.HdmiOutput;
AddDmcCoPorts(number, cecPort1);
}
break;
case "dmc4kzcohd":
{
var outputCard = new Dmc4kzCoHdSingle(number, Chassis);
var cecPort1 = outputCard.Card1.HdmiOutput;
AddDmcCoPorts(number, cecPort1);
}
break;
case "dmccohd":
{
var outputCard = new DmcCoHdSingle(number, Chassis);
var cecPort1 = outputCard.Card1.HdmiOutput;
AddDmcCoPorts(number, cecPort1);
}
break;
case "dmccatohd":
{
var outputCard = new DmcCatoHdSingle(number, Chassis);
var cecPort1 = outputCard.Card1.HdmiOutput;
AddDmcCoPorts(number, cecPort1);
}
break;
case "dmcsohd":
{
var outputCard = new DmcSoHdSingle(number, Chassis);
var cecPort1 = outputCard.Card1.HdmiOutput;
AddOutputPortWithDebug(string.Format("outputCard{0}", number), "dmOut1", eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.DmMmFiber, Chassis.Outputs[2 * (number - 1) + 1]);
AddOutputPortWithDebug(string.Format("outputCard{0}", number), "hdmiOut1", eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.Hdmi, Chassis.Outputs[2 * (number - 1) + 1], cecPort1);
AddOutputPortWithDebug(string.Format("outputCard{0}", number), "dmOut2", eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.DmMmFiber, Chassis.Outputs[2 * (number - 1) + 2]);
}
break;
case "dmcs2ohd":
{
var outputCard = new DmcS2oHdSingle(number, Chassis);
var cecPort1 = outputCard.Card1.HdmiOutput;
AddOutputPortWithDebug(string.Format("outputCard{0}", number), "dmOut1", eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.DmSmFiber, Chassis.Outputs[2 * (number - 1) + 1]);
AddOutputPortWithDebug(string.Format("outputCard{0}", number), "hdmiOut1", eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.Hdmi, Chassis.Outputs[2 * (number - 1) + 1], cecPort1);
AddOutputPortWithDebug(string.Format("outputCard{0}", number), "dmOut2", eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.DmSmFiber, Chassis.Outputs[2 * (number - 1) + 2]);
}
break;
case "dmcstro":
AddOutputPortWithDebug(string.Format("outputCard{0}", number), "streamOut", eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.Streaming, Chassis.Outputs[2 * (number - 1) + 1]);
break;
default:
Debug.Console(1, this, " WARNING: Output card type '{0}' is not available", type);
break;
}
else if (type == "dmc4kzhdo")
{
var outputCard = new Dmc4kzHdoSingle(number, Chassis);
var cecPort1 = outputCard.Card1.HdmiOutput;
var cecPort2 = outputCard.Card2.HdmiOutput;
AddDmcHdoPorts(number, cecPort1, cecPort2);
}
else if (type == "dmchdo")
{
var outputCard = new DmcHdoSingle(number, Chassis);
var cecPort1 = outputCard.Card1.HdmiOutput;
var cecPort2 = outputCard.Card2.HdmiOutput;
AddDmcHdoPorts(number, cecPort1, cecPort2);
}
else if (type == "dmc4kcohd")
{
var outputCard = new Dmc4kCoHdSingle(number, Chassis);
var cecPort1 = outputCard.Card1.HdmiOutput;
AddDmcCoPorts(number, cecPort1);
}
else if (type == "dmc4kzcohd")
{
var outputCard = new Dmc4kzCoHdSingle(number, Chassis);
var cecPort1 = outputCard.Card1.HdmiOutput;
AddDmcCoPorts(number, cecPort1);
}
else if (type == "dmccohd")
{
var outputCard = new DmcCoHdSingle(number, Chassis);
var cecPort1 = outputCard.Card1.HdmiOutput;
AddDmcCoPorts(number, cecPort1);
}
else if (type == "dmccatohd")
{
var outputCard = new DmcCatoHdSingle(number, Chassis);
var cecPort1 = outputCard.Card1.HdmiOutput;
AddDmcCoPorts(number, cecPort1);
}
else if (type == "dmcsohd")
{
var outputCard = new DmcSoHdSingle(number, Chassis);
var cecPort1 = outputCard.Card1.HdmiOutput;
AddOutputPortWithDebug(string.Format("outputCard{0}", number), "dmOut1", eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.DmMmFiber, 2 * (number - 1) + 1);
AddOutputPortWithDebug(string.Format("outputCard{0}", number), "hdmiOut1", eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.Hdmi, 2 * (number - 1) + 1, cecPort1);
AddOutputPortWithDebug(string.Format("outputCard{0}", number), "dmOut2", eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.DmMmFiber, 2 * (number - 1) + 2);
}
else if (type == "dmcs2ohd")
{
var outputCard = new DmcS2oHdSingle(number, Chassis);
var cecPort1 = outputCard.Card1.HdmiOutput;
AddOutputPortWithDebug(string.Format("outputCard{0}", number), "dmOut1", eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.DmSmFiber, 2 * (number - 1) + 1);
AddOutputPortWithDebug(string.Format("outputCard{0}", number), "hdmiOut1", eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.Hdmi, 2 * (number - 1) + 1, cecPort1);
AddOutputPortWithDebug(string.Format("outputCard{0}", number), "dmOut2", eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.DmSmFiber, 2 * (number - 1) + 2);
}
else if (type == "dmcstro")
{
var outputCard = new DmcStroSingle(number, Chassis);
AddOutputPortWithDebug(string.Format("outputCard{0}", number), "streamOut", eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.Streaming, 2 * (number - 1) + 1);
}
else
Debug.Console(1, this, " WARNING: Output card type '{0}' is not available", type);
}
void AddDmcHdoPorts(uint number, ICec cecPort1, ICec cecPort2)
{
AddOutputPortWithDebug(string.Format("outputCard{0}", number), "hdmiOut1", eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.Hdmi, 2 * (number - 1) + 1, cecPort1);
eRoutingPortConnectionType.Hdmi, Chassis.Outputs[2 * (number - 1) + 1], cecPort1);
AddOutputPortWithDebug(string.Format("outputCard{0}", number), "audioOut1", eRoutingSignalType.Audio, eRoutingPortConnectionType.LineAudio,
2 * (number - 1) + 1);
Chassis.Outputs[2 * (number - 1) + 1]);
AddOutputPortWithDebug(string.Format("outputCard{0}", number), "hdmiOut2", eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.Hdmi, 2 * (number - 1) + 2, cecPort2);
eRoutingPortConnectionType.Hdmi, Chassis.Outputs[2 * (number - 1) + 2], cecPort2);
AddOutputPortWithDebug(string.Format("outputCard{0}", number), "audioOut2", eRoutingSignalType.Audio, eRoutingPortConnectionType.LineAudio,
2 * (number - 1) + 2);
Chassis.Outputs[2 * (number - 1) + 2]);
}
void AddDmcCoPorts(uint number, ICec cecPort1)
{
AddOutputPortWithDebug(string.Format("outputCard{0}", number), "dmOut1", eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.DmCat, 2 * (number - 1) + 1);
eRoutingPortConnectionType.DmCat, Chassis.Outputs[2 * (number - 1) + 1]);
AddOutputPortWithDebug(string.Format("outputCard{0}", number), "hdmiOut1", eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.Hdmi, 2 * (number - 1) + 1, cecPort1);
eRoutingPortConnectionType.Hdmi, Chassis.Outputs[2 * (number - 1) + 1], cecPort1);
AddOutputPortWithDebug(string.Format("outputCard{0}", number), "dmOut2", eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.DmCat, 2 * (number - 1) + 2);
eRoutingPortConnectionType.DmCat, Chassis.Outputs[2 * (number - 1) + 2]);
}
/// <summary>
/// Adds InputPort
/// </summary>
void AddInputPortWithDebug(uint cardNum, string portName, eRoutingSignalType sigType, eRoutingPortConnectionType portType)
{
var portKey = string.Format("inputCard{0}--{1}", cardNum, portName);
Debug.Console(2, this, "Adding input port '{0}'", portKey);
var inputPort = new RoutingInputPort(portKey, sigType, portType, cardNum, this)
{
FeedbackMatchObject = Chassis.Inputs[cardNum]
};
InputPorts.Add(inputPort);
void AddInputPortWithDebug(uint cardNum, string portName, eRoutingSignalType sigType, eRoutingPortConnectionType portType)
{
AddInputPortWithDebug(cardNum, portName, sigType, portType, null);
}
/// <summary>
@@ -814,7 +825,7 @@ namespace PepperDash.Essentials.DM
{
var portKey = string.Format("inputCard{0}--{1}", cardNum, portName);
Debug.Console(2, this, "Adding input port '{0}'", portKey);
var inputPort = new RoutingInputPort(portKey, sigType, portType, cardNum, this)
var inputPort = new RoutingInputPort(portKey, sigType, portType, Chassis.Inputs[cardNum], this)
{
FeedbackMatchObject = Chassis.Inputs[cardNum]
}; ;
@@ -828,19 +839,9 @@ namespace PepperDash.Essentials.DM
/// <summary>
/// Adds OutputPort
/// </summary>
void AddOutputPortWithDebug(string cardName, string portName, eRoutingSignalType sigType, eRoutingPortConnectionType portType, object selector)
{
var portKey = string.Format("{0}--{1}", cardName, portName);
Debug.Console(2, this, "Adding output port '{0}'", portKey);
var outputPort = new RoutingOutputPort(portKey, sigType, portType, selector, this);
if (portName.IndexOf("Loop", StringComparison.InvariantCultureIgnoreCase) < 0)
{
outputPort.FeedbackMatchObject = Chassis.Outputs[(uint) selector];
}
OutputPorts.Add(outputPort);
void AddOutputPortWithDebug(string cardName, string portName, eRoutingSignalType sigType, eRoutingPortConnectionType portType, object selector)
{
AddOutputPortWithDebug(cardName, portName, sigType, portType, selector, null);
}
/// <summary>
@@ -854,7 +855,7 @@ namespace PepperDash.Essentials.DM
if (portName.IndexOf("Loop", StringComparison.InvariantCultureIgnoreCase) < 0)
{
outputPort.FeedbackMatchObject = Chassis.Outputs[(uint)selector];
outputPort.FeedbackMatchObject = selector;
}
if (cecPort != null)
outputPort.Port = cecPort;
@@ -1144,7 +1145,7 @@ namespace PepperDash.Essentials.DM
{
if (RouteOffTimers.ContainsKey(pnt))
return;
RouteOffTimers[pnt] = new CTimer(o => { ExecuteSwitch(0, pnt.Number, pnt.Type); }, RouteOffTime);
RouteOffTimers[pnt] = new CTimer(o => ExecuteSwitch(null, pnt.Selector, pnt.Type), RouteOffTime);
}
// Send out sigs when coming online
@@ -1171,18 +1172,24 @@ namespace PepperDash.Essentials.DM
#region IRouting Members
public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType sigType)
{
Debug.Console(2, this, "Making an awesome DM route from {0} to {1} {2}", inputSelector, outputSelector, sigType);
var input = Convert.ToUInt32(inputSelector); // Cast can sometimes fail
var output = Convert.ToUInt32(outputSelector);
var chassisSize = (uint) Chassis.NumberOfInputs; //need this to determine USB routing values 8x8 -> 1-8 is inputs 1-8, 17-24 is outputs 1-8
//16x16 1-16 is inputs 1-16, 17-32 is outputs 1-16
//32x32 1-32 is inputs 1-32, 33-64 is outputs 1-32
Debug.Console(2, this, "Making an awesome DM route from {0} to {1} {2}", inputSelector, outputSelector, sigType);
var input = inputSelector as DMInput;//Input Selector could be null...
var output = outputSelector as DMOutput;
if (output == null)
{
Debug.Console(0, this, Debug.ErrorLogLevel.Warning,
"Unable to execute switch for inputSelector {0} to outputSelector {1}", inputSelector,
outputSelector);
return;
}
// Check to see if there's an off timer waiting on this and if so, cancel
var key = new PortNumberType(output, sigType);
if (input == 0)
if (input == null)
{
StartOffTimer(key);
}
@@ -1196,110 +1203,109 @@ namespace PepperDash.Essentials.DM
}
}
var inCard = input == 0 ? null : Chassis.Inputs[input];
var outCard = input == 0 ? null : Chassis.Outputs[output];
//var inCard = input == 0 ? null : Chassis.Inputs[input];
//var outCard = input == 0 ? null : Chassis.Outputs[output];
// NOTE THAT BITWISE COMPARISONS - TO CATCH ALL ROUTING TYPES
if ((sigType & eRoutingSignalType.Video) == eRoutingSignalType.Video)
{
Chassis.VideoEnter.BoolValue = true;
Chassis.Outputs[output].VideoOut = inCard;
Chassis.VideoEnter.BoolValue = true;
output.VideoOut = input; //Chassis.Outputs[output].VideoOut = inCard;
}
if ((sigType & eRoutingSignalType.Audio) == eRoutingSignalType.Audio)
{
(Chassis as DmMDMnxn).AudioEnter.BoolValue = true;
Chassis.Outputs[output].AudioOut = inCard;
if ((sigType & eRoutingSignalType.Audio) == eRoutingSignalType.Audio)
{
var dmMdMnxn = Chassis as DmMDMnxn;
if (dmMdMnxn != null)
{
dmMdMnxn.AudioEnter.BoolValue = true;
}
output.VideoOut = input;
//Chassis.Outputs[output].AudioOut = inCard;
}
if ((sigType & eRoutingSignalType.UsbOutput) == eRoutingSignalType.UsbOutput || (sigType & eRoutingSignalType.UsbInput) == eRoutingSignalType.UsbInput)
{
Chassis.USBEnter.BoolValue = true;
output.USBRoutedTo = input;
}
if ((sigType & eRoutingSignalType.UsbOutput) == eRoutingSignalType.UsbOutput)
{
//using base here because USB can be routed between 2 output cards or 2 input cards
DMInputOutputBase dmCard;
Debug.Console(2, this, "Executing USB Output switch.\r\n in:{0} output: {1}", input, output);
if (input > chassisSize)
{
//wanting to route an output to an output. Subtract chassis size and get output, unless it's 8x8
//need this to determine USB routing values
//8x8 -> 1-8 is inputs 1-8, 17-24 is outputs 1-8
//16x16 1-16 is inputs 1-16, 17-32 is outputs 1-16
//32x32 1-32 is inputs 1-32, 33-64 is outputs 1-32
uint outputIndex;
if (chassisSize == 8)
{
outputIndex = input - 16;
}
else
{
outputIndex = input - chassisSize;
}
dmCard = Chassis.Outputs[outputIndex];
}
else
{
dmCard = inCard;
}
Chassis.USBEnter.BoolValue = true;
if (Chassis.Outputs[output] != null)
{
Debug.Console(2, this, "Routing USB for input {0} to {1}", Chassis.Outputs[input], dmCard);
Chassis.Outputs[output].USBRoutedTo = dmCard;
}
}
if ((sigType & eRoutingSignalType.UsbInput) == eRoutingSignalType.UsbInput)
{
//using base here because USB can be routed between 2 output cards or 2 input cards
DMInputOutputBase dmCard;
Debug.Console(2, this, "Executing USB Input switch.\r\n in:{0} output: {1}", input, output);
if (output > chassisSize)
{
//wanting to route an input to an output. Subtract chassis size and get output, unless it's 8x8
//need this to determine USB routing values
//8x8 -> 1-8 is inputs 1-8, 17-24 is outputs 1-8
//16x16 1-16 is inputs 1-16, 17-32 is outputs 1-16
//32x32 1-32 is inputs 1-32, 33-64 is outputs 1-32
uint outputIndex;
if (chassisSize == 8)
{
outputIndex = input - 16;
}
else
{
outputIndex = input - chassisSize;
}
dmCard = Chassis.Outputs[outputIndex];
}
else
{
dmCard = Chassis.Inputs[input];
}
Chassis.USBEnter.BoolValue = true;
if (Chassis.Inputs[output] == null)
{
return;
}
Debug.Console(2, this, "Routing USB for input {0} to {1}", Chassis.Inputs[output], dmCard);
Chassis.Inputs[output].USBRoutedTo = dmCard;
}
}
#endregion
#region IRoutingNumeric Members
public void ExecuteNumericSwitch(ushort inputSelector, ushort outputSelector, eRoutingSignalType sigType)
{
ExecuteSwitch(inputSelector, outputSelector, sigType);
public void ExecuteNumericSwitch(ushort inputSelector, ushort outputSelector, eRoutingSignalType sigType)
{
var chassisSize = (uint)Chassis.NumberOfInputs; //need this to determine USB routing values 8x8 -> 1-8 is inputs 1-8, 17-24 is outputs 1-8
//16x16 1-16 is inputs 1-16, 17-32 is outputs 1-16
//32x32 1-32 is inputs 1-32, 33-64 is outputs 1-32
DMInputOutputBase dmCard;
if ((sigType & eRoutingSignalType.UsbInput) == eRoutingSignalType.UsbInput)
{
if (outputSelector > chassisSize)
{
uint outputIndex;
if (chassisSize == 8)
{
outputIndex = (uint) inputSelector - 16;
}
else
{
outputIndex = inputSelector - chassisSize;
}
dmCard = Chassis.Outputs[outputIndex];
}
else
{
dmCard = Chassis.Inputs[inputSelector];
}
ExecuteSwitch(dmCard, Chassis.Outputs[outputSelector], sigType);
return;
}
if ((sigType & eRoutingSignalType.UsbOutput) == eRoutingSignalType.UsbOutput)
{
Debug.Console(2, this, "Executing USB Output switch.\r\n in:{0} output: {1}", inputSelector, outputSelector);
if (inputSelector > chassisSize)
{
//wanting to route an output to an output. Subtract chassis size and get output, unless it's 8x8
//need this to determine USB routing values
//8x8 -> 1-8 is inputs 1-8, 17-24 is outputs 1-8
//16x16 1-16 is inputs 1-16, 17-32 is outputs 1-16
//32x32 1-32 is inputs 1-32, 33-64 is outputs 1-32
uint outputIndex;
if (chassisSize == 8)
{
outputIndex = (uint) inputSelector - 16;
}
else
{
outputIndex = inputSelector - chassisSize;
}
dmCard = Chassis.Outputs[outputIndex];
}
else
{
dmCard = Chassis.Inputs[inputSelector];
}
Chassis.USBEnter.BoolValue = true;
Debug.Console(2, this, "Routing USB for input {0} to {1}", inputSelector, dmCard);
ExecuteSwitch(dmCard, Chassis.Outputs[outputSelector], sigType);
return;
}
var inputCard = inputSelector == 0 ? null : Chassis.Inputs[inputSelector];
var outputCard = Chassis.Outputs[outputSelector];
ExecuteSwitch(inputCard, outputCard, sigType);
}
#endregion
@@ -1850,13 +1856,23 @@ namespace PepperDash.Essentials.DM
public struct PortNumberType
{
public uint Number { get; private set; }
public object Selector { get; private set; }
public eRoutingSignalType Type { get; private set; }
public PortNumberType(uint number, eRoutingSignalType type)
public PortNumberType(object selector, eRoutingSignalType type)
: this()
{
Number = number;
Type = type;
Selector = selector;
Type = type;
if (Selector is DMOutput)
{
Number = (selector as DMOutput).Number;
}
else if (Selector is uint)
{
Number = (uint) selector;
}
}
}

View File

@@ -21,6 +21,8 @@ namespace PepperDash.Essentials.DM
{
public class DmpsRoutingController : EssentialsBridgeableDevice, IRoutingNumericWithFeedback, IHasFeedback
{
private const string NonePortKey = "none";
public CrestronControlSystem Dmps { get; set; }
public ISystemControl SystemControl { get; private set; }
@@ -75,20 +77,18 @@ namespace PepperDash.Essentials.DM
{
try
{
ISystemControl systemControl = null;
systemControl = Global.ControlSystem.SystemControl as ISystemControl;
var systemControl = Global.ControlSystem.SystemControl;
if (systemControl == null)
{
return null;
}
var controller = new DmpsRoutingController(key, name, systemControl);
controller.InputNames = properties.InputNames;
controller.OutputNames = properties.OutputNames;
var controller = new DmpsRoutingController(key, name, systemControl)
{
InputNames = properties.InputNames,
OutputNames = properties.OutputNames
};
if (!string.IsNullOrEmpty(properties.NoRouteText))
controller.NoRouteText = properties.NoRouteText;
@@ -96,9 +96,9 @@ namespace PepperDash.Essentials.DM
return controller;
}
catch (System.Exception e)
catch (Exception e)
{
Debug.Console(0, "Error getting DMPS Controller:\r{0}", e);
Debug.Console(0, "Error getting DMPS Controller:\r\n{0}", e);
}
return null;
}
@@ -113,6 +113,7 @@ namespace PepperDash.Essentials.DM
public DmpsRoutingController(string key, string name, ISystemControl systemControl)
: base(key, name)
{
Dmps = Global.ControlSystem;
SystemControl = systemControl;
@@ -427,14 +428,11 @@ namespace PepperDash.Essentials.DM
{
Debug.Console(1, this, "Adding Input Card Number {0} Type: {1}", inputCard.Number, inputCard.CardInputOutputType.ToString());
InputEndpointOnlineFeedbacks[inputCard.Number] = new BoolFeedback(() => { return inputCard.EndpointOnlineFeedback; });
InputEndpointOnlineFeedbacks[inputCard.Number] = new BoolFeedback(() => inputCard.EndpointOnlineFeedback);
if (inputCard.VideoDetectedFeedback != null)
{
VideoInputSyncFeedbacks[inputCard.Number] = new BoolFeedback(() =>
{
return inputCard.VideoDetectedFeedback.BoolValue;
});
VideoInputSyncFeedbacks[inputCard.Number] = new BoolFeedback(() => inputCard.VideoDetectedFeedback.BoolValue);
}
InputNameFeedbacks[inputCard.Number] = new StringFeedback(() =>
@@ -443,13 +441,10 @@ namespace PepperDash.Essentials.DM
{
Debug.Console(2, this, "Input Card {0} Name: {1}", inputCard.Number, inputCard.NameFeedback.StringValue);
return inputCard.NameFeedback.StringValue;
}
}
else
{
Debug.Console(2, this, "Input Card {0} Name is null", inputCard.Number);
return "";
}
Debug.Console(2, this, "Input Card {0} Name is null", inputCard.Number);
return "";
});
AddInputCard(inputCard.Number, inputCard);
@@ -459,6 +454,9 @@ namespace PepperDash.Essentials.DM
Debug.Console(2, this, "***********Input Card of type {0} is cannot be cast as DMInput*************", card.CardInputOutputType);
}
}
InputPorts.Add(new RoutingInputPort(NonePortKey, eRoutingSignalType.AudioVideo,
eRoutingPortConnectionType.None, null, this));
}
/// <summary>
@@ -531,15 +529,7 @@ namespace PepperDash.Essentials.DM
private void AddInputPortWithDebug(uint cardNum, string portName, eRoutingSignalType sigType,
eRoutingPortConnectionType portType)
{
var portKey = string.Format("inputCard{0}--{1}", cardNum, portName);
Debug.Console(2, this, "Adding input port '{0}'", portKey);
var inputPort = new RoutingInputPort(portKey, sigType, portType, cardNum, this)
{
FeedbackMatchObject = Dmps.SwitcherInputs[cardNum]
};
;
InputPorts.Add(inputPort);
AddInputPortWithDebug(cardNum, portName, sigType, portType, null);
}
/// <summary>
@@ -549,11 +539,10 @@ namespace PepperDash.Essentials.DM
{
var portKey = string.Format("inputCard{0}--{1}", cardNum, portName);
Debug.Console(2, this, "Adding input port '{0}'", portKey);
var inputPort = new RoutingInputPort(portKey, sigType, portType, cardNum, this)
var inputPort = new RoutingInputPort(portKey, sigType, portType, Dmps.SwitcherInputs[cardNum], this)
{
FeedbackMatchObject = Dmps.SwitcherInputs[cardNum]
};
;
if (cecPort != null)
inputPort.Port = cecPort;
@@ -672,7 +661,7 @@ namespace PepperDash.Essentials.DM
/// <param name="number"></param>
void AddAudioOnlyOutputPort(uint number, string portName)
{
AddOutputPortWithDebug(number, portName, eRoutingSignalType.Audio, eRoutingPortConnectionType.LineAudio, number);
AddOutputPortWithDebug(number, portName, eRoutingSignalType.Audio, eRoutingPortConnectionType.LineAudio, Dmps.SwitcherOutputs[number]);
}
/// <summary>
@@ -682,7 +671,7 @@ namespace PepperDash.Essentials.DM
/// <param name="cecPort"></param>
void AddHdmiOutputPort(uint number, ICec cecPort)
{
AddOutputPortWithDebug(number, string.Format("hdmiOut{0}", number), eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, number, cecPort);
AddOutputPortWithDebug(number, string.Format("hdmiOut{0}", number), eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, Dmps.SwitcherOutputs[number], cecPort);
}
/// <summary>
@@ -691,7 +680,7 @@ namespace PepperDash.Essentials.DM
/// <param name="number"></param>
void AddDmOutputPort(uint number)
{
AddOutputPortWithDebug(number, string.Format("dmOut{0}", number), eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmCat, number);
AddOutputPortWithDebug(number, string.Format("dmOut{0}", number), eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmCat, Dmps.SwitcherOutputs[number]);
}
/// <summary>
@@ -699,12 +688,7 @@ namespace PepperDash.Essentials.DM
/// </summary>
void AddOutputPortWithDebug(uint cardNum, string portName, eRoutingSignalType sigType, eRoutingPortConnectionType portType, object selector)
{
var portKey = string.Format("outputCard{0}--{1}", cardNum, portName);
Debug.Console(2, this, "Adding output port '{0}'", portKey);
OutputPorts.Add(new RoutingOutputPort(portKey, sigType, portType, selector, this)
{
FeedbackMatchObject = Dmps.SwitcherOutputs[cardNum]
});
AddOutputPortWithDebug(cardNum, portName, sigType, portType, selector, null);
}
/// <summary>
@@ -836,7 +820,7 @@ namespace PepperDash.Essentials.DM
{
if (RouteOffTimers.ContainsKey(pnt))
return;
RouteOffTimers[pnt] = new CTimer(o => ExecuteSwitch(0, pnt.Number, pnt.Type), RouteOffTime);
RouteOffTimers[pnt] = new CTimer(o => ExecuteSwitch(null, pnt.Selector, pnt.Type), RouteOffTime);
}
#region IRouting Members
@@ -848,21 +832,32 @@ namespace PepperDash.Essentials.DM
Debug.Console(2, this, "Attempting a DM route from input {0} to output {1} {2}", inputSelector, outputSelector, sigType);
var input = Convert.ToUInt32(inputSelector); // Cast can sometimes fail
var output = Convert.ToUInt32(outputSelector);
//var input = Convert.ToUInt32(inputSelector); // Cast can sometimes fail
//var output = Convert.ToUInt32(outputSelector);
var input = inputSelector as DMInput;
var output = outputSelector as DMOutput;
if (output == null)
{
Debug.Console(0, this, Debug.ErrorLogLevel.Warning,
"Unable to execute switch for inputSelector {0} to outputSelector {1}", inputSelector,
outputSelector);
return;
}
var sigTypeIsUsbOrVideo = ((sigType & eRoutingSignalType.Video) == eRoutingSignalType.Video) ||
((sigType & eRoutingSignalType.UsbInput) == eRoutingSignalType.UsbInput) ||
((sigType & eRoutingSignalType.UsbOutput) == eRoutingSignalType.UsbOutput);
if ((input <= Dmps.NumberOfSwitcherInputs && output <= Dmps.NumberOfSwitcherOutputs &&
if (input == null || (input.Number <= Dmps.NumberOfSwitcherInputs && output.Number <= Dmps.NumberOfSwitcherOutputs &&
sigTypeIsUsbOrVideo) ||
(input <= Dmps.NumberOfSwitcherInputs + 5 && output <= Dmps.NumberOfSwitcherOutputs &&
(input.Number <= Dmps.NumberOfSwitcherInputs + 5 && output.Number <= Dmps.NumberOfSwitcherOutputs &&
(sigType & eRoutingSignalType.Audio) == eRoutingSignalType.Audio))
{
// Check to see if there's an off timer waiting on this and if so, cancel
var key = new PortNumberType(output, sigType);
if (input == 0)
if (input == null)
{
StartOffTimer(key);
}
@@ -877,60 +872,47 @@ namespace PepperDash.Essentials.DM
}
DMOutput dmOutputCard = output == 0 ? null : Dmps.SwitcherOutputs[output] as DMOutput;
//DMOutput dmOutputCard = output == 0 ? null : Dmps.SwitcherOutputs[output] as DMOutput;
//if (inCard != null)
//{
// NOTE THAT BITWISE COMPARISONS - TO CATCH ALL ROUTING TYPES
if ((sigType & eRoutingSignalType.Video) == eRoutingSignalType.Video)
{
DMInput dmInputCard = input == 0 ? null : Dmps.SwitcherInputs[input] as DMInput;
//SystemControl.VideoEnter.BoolValue = true;
if (dmOutputCard != null)
dmOutputCard.VideoOut = dmInputCard;
output.VideoOut = input;
}
if ((sigType & eRoutingSignalType.Audio) == eRoutingSignalType.Audio)
{
DMInput dmInputCard = null;
if (input <= Dmps.NumberOfSwitcherInputs)
try
{
dmInputCard = input == 0 ? null : Dmps.SwitcherInputs[input] as DMInput;
output.AudioOut = input;
}
catch (NotSupportedException)
{
Debug.Console(1, this, "Routing input {0} audio to output {1}",
(eDmps34KAudioOutSource) (input == null ? 0 : input.Number),
(CrestronControlSystem.eDmps34K350COutputs) output.Number);
if (dmOutputCard != null)
try
{
dmOutputCard.AudioOut = dmInputCard;
}
catch (NotSupportedException)
{
Debug.Console(1, this, "Routing input {0} audio to output {1}",
(eDmps34KAudioOutSource) input, (CrestronControlSystem.eDmps34K350COutputs) output);
dmOutputCard.AudioOutSource = (eDmps34KAudioOutSource) input;
}
output.AudioOutSource = input == null
? eDmps34KAudioOutSource.NoRoute
: (eDmps34KAudioOutSource)input.Number;
}
}
if ((sigType & eRoutingSignalType.UsbOutput) == eRoutingSignalType.UsbOutput)
{
DMInput dmInputCard = input == 0 ? null : Dmps.SwitcherInputs[input] as DMInput;
if (dmOutputCard != null)
dmOutputCard.USBRoutedTo = dmInputCard;
output.USBRoutedTo = input;
}
if ((sigType & eRoutingSignalType.UsbInput) == eRoutingSignalType.UsbInput)
if ((sigType & eRoutingSignalType.UsbInput) != eRoutingSignalType.UsbInput)
{
DMInput dmInputCard = input == 0 ? null : Dmps.SwitcherInputs[input] as DMInput;
if (dmInputCard != null)
dmInputCard.USBRoutedTo = dmOutputCard;
return;
}
//}
//else
//{
// Debug.Console(1, this, "Unable to execute route from input {0} to output {1}. Input card not available", inputSelector, outputSelector);
//}
if (input != null)
input.USBRoutedTo = output;
}
else
{
@@ -950,7 +932,10 @@ namespace PepperDash.Essentials.DM
public void ExecuteNumericSwitch(ushort inputSelector, ushort outputSelector, eRoutingSignalType sigType)
{
ExecuteSwitch(inputSelector, outputSelector, sigType);
var input = inputSelector == 0 ? null : Dmps.SwitcherInputs[inputSelector];
var output = Dmps.SwitcherOutputs[outputSelector];
ExecuteSwitch(input, output, sigType);
}
#endregion

View File

@@ -44,7 +44,7 @@ namespace PepperDash.Essentials.DM.Endpoints.DGEs
DeviceInfo = new DeviceInfo();
//_dge.OnlineStatusChange += (currentDevice, args) => { if (args.DeviceOnLine) UpdateDeviceInfo(); };
_dge.OnlineStatusChange += (currentDevice, args) => { if (args.DeviceOnLine) UpdateDeviceInfo(); };
_dc = dc;
@@ -123,29 +123,56 @@ namespace PepperDash.Essentials.DM.Endpoints.DGEs
gather.LineReceived += (sender, args) =>
{
if (args.Text.ToLower().Contains("host"))
try
{
DeviceInfo.HostName = args.Text.Split(';')[1].Trim();
Debug.Console(1, this, "{0}", args.Text);
tcpClient.Disconnect();
return;
if (args.Text.ToLower().Contains("host"))
{
DeviceInfo.HostName = args.Text.Split(':')[1].Trim();
Debug.Console(1, this, "hostname: {0}", DeviceInfo.HostName);
tcpClient.Disconnect();
return;
}
//ignore console prompt
/*if (args.Text.ToLower().Contains(">"))
{
Debug.Console(1, this, "Ignoring console");
return;
}
if (args.Text.ToLower().Contains("dge"))
{
Debug.Console(1, this, "Ignoring DGE");
return;
}*/
if (!args.Text.Contains('['))
{
return;
}
var splitResponse = args.Text.Split('[');
foreach (string t in splitResponse)
{
Debug.Console(1, this, "{0}", t);
}
DeviceInfo.SerialNumber = splitResponse[1].Split(' ')[4].Replace("#", "");
DeviceInfo.FirmwareVersion = splitResponse[1].Split(' ')[0];
Debug.Console(1, this, "Firmware: {0} SerialNumber: {1}", DeviceInfo.FirmwareVersion,
DeviceInfo.SerialNumber);
tcpClient.SendText("host\r\n");
}
//ignore console prompt
if (args.Text.ToLower().Contains(">"))
catch (Exception ex)
{
return;
Debug.Console(0, this, "Exception getting data: {0}", ex.Message);
Debug.Console(0, this, "response: {0}", args.Text);
}
if (!args.Text.ToLower().Contains("dge"))
{
return;
}
DeviceInfo.SerialNumber = args.Text.Split('[')[1].Split(' ')[4].Replace("#", "");
DeviceInfo.FirmwareVersion = args.Text.Split('[')[1].Split(' ')[1];
tcpClient.SendText("host\r\n");
};
tcpClient.Connect();

View File

@@ -1,46 +1,46 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
//using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.DM;
using Crestron.SimplSharpPro.DM.Endpoints;
using Crestron.SimplSharpPro.DM.Endpoints.Transmitters;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.DM.Config;
namespace PepperDash.Essentials.DM
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
//using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.DM;
using Crestron.SimplSharpPro.DM.Endpoints;
using Crestron.SimplSharpPro.DM.Endpoints.Transmitters;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.DM.Config;
namespace PepperDash.Essentials.DM
{
using eVst = DmTx401C.eSourceSelection;
[Description("Wrapper class for DM-TX-401-C")]
public class DmTx401CController : DmTxControllerBase, ITxRoutingWithFeedback, IIROutputPorts, IComPorts, IHasFreeRun, IVgaBrightnessContrastControls
{
public DmTx401C Tx { get; private set; }
public RoutingInputPortWithVideoStatuses HdmiIn { get; private set; }
public RoutingInputPortWithVideoStatuses DisplayPortIn { get; private set; }
public RoutingInputPortWithVideoStatuses VgaIn { get; private set; }
public RoutingInputPortWithVideoStatuses CompositeIn { get; private set; }
public RoutingOutputPort DmOut { get; private set; }
public override StringFeedback ActiveVideoInputFeedback { get; protected set; }
public IntFeedback VideoSourceNumericFeedback { get; protected set; }
public IntFeedback AudioSourceNumericFeedback { get; protected set; }
public IntFeedback HdmiInHdcpCapabilityFeedback { get; protected set; }
public BoolFeedback DisplayPortVideoSyncFeedback { get; protected set; }
public BoolFeedback HdmiVideoSyncFeedback { get; protected set; }
public BoolFeedback VgaVideoSyncFeedback { get; protected set; }
public BoolFeedback FreeRunEnabledFeedback { get; protected set; }
public IntFeedback VgaBrightnessFeedback { get; protected set; }
public class DmTx401CController : DmTxControllerBase, ITxRoutingWithFeedback, IIROutputPorts, IComPorts, IHasFreeRun, IVgaBrightnessContrastControls
{
public DmTx401C Tx { get; private set; }
public RoutingInputPortWithVideoStatuses HdmiIn { get; private set; }
public RoutingInputPortWithVideoStatuses DisplayPortIn { get; private set; }
public RoutingInputPortWithVideoStatuses VgaIn { get; private set; }
public RoutingInputPortWithVideoStatuses CompositeIn { get; private set; }
public RoutingOutputPort DmOut { get; private set; }
public override StringFeedback ActiveVideoInputFeedback { get; protected set; }
public IntFeedback VideoSourceNumericFeedback { get; protected set; }
public IntFeedback AudioSourceNumericFeedback { get; protected set; }
public IntFeedback HdmiInHdcpCapabilityFeedback { get; protected set; }
public BoolFeedback DisplayPortVideoSyncFeedback { get; protected set; }
public BoolFeedback HdmiVideoSyncFeedback { get; protected set; }
public BoolFeedback VgaVideoSyncFeedback { get; protected set; }
public BoolFeedback FreeRunEnabledFeedback { get; protected set; }
public IntFeedback VgaBrightnessFeedback { get; protected set; }
public IntFeedback VgaContrastFeedback { get; protected set; }
//IroutingNumericEvent
@@ -54,88 +54,88 @@ namespace PepperDash.Essentials.DM
{
var newEvent = NumericSwitchChange;
if (newEvent != null) newEvent(this, e);
}
/// <summary>
/// Helps get the "real" inputs, including when in Auto
/// </summary>
public BaseDmTx401.eSourceSelection ActualVideoInput
{
get
{
if (Tx.VideoSourceFeedback != BaseDmTx401.eSourceSelection.Auto)
return Tx.VideoSourceFeedback;
else // auto
{
if (Tx.HdmiInput.SyncDetectedFeedback.BoolValue)
return BaseDmTx401.eSourceSelection.HDMI;
else if (Tx.VgaInput.SyncDetectedFeedback.BoolValue)
return BaseDmTx401.eSourceSelection.VGA;
else if (Tx.DisplayPortInput.SyncDetectedFeedback.BoolValue)
return BaseDmTx401.eSourceSelection.DisplayPort;
else if (Tx.CvbsInput.SyncDetectedFeedback.BoolValue)
return BaseDmTx401.eSourceSelection.Composite;
else
return BaseDmTx401.eSourceSelection.Disabled;
}
}
}
public RoutingPortCollection<RoutingInputPort> InputPorts
{
get
{
return new RoutingPortCollection<RoutingInputPort>
{
HdmiIn,
DisplayPortIn,
VgaIn,
CompositeIn,
AnyVideoInput
};
}
}
public RoutingPortCollection<RoutingOutputPort> OutputPorts
{
get
{
return new RoutingPortCollection<RoutingOutputPort> { DmOut };
}
}
/// <summary>
///
/// </summary>
/// <param name="key"></param>
/// <param name="name"></param>
/// <param name="tx"></param>
public DmTx401CController(string key, string name, DmTx401C tx)
: base(key, name, tx)
{
Tx = tx;
HdmiIn = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn,
eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eVst.HDMI, this,
}
/// <summary>
/// Helps get the "real" inputs, including when in Auto
/// </summary>
public BaseDmTx401.eSourceSelection ActualVideoInput
{
get
{
if (Tx.VideoSourceFeedback != BaseDmTx401.eSourceSelection.Auto)
return Tx.VideoSourceFeedback;
else // auto
{
if (Tx.HdmiInput.SyncDetectedFeedback.BoolValue)
return BaseDmTx401.eSourceSelection.HDMI;
else if (Tx.VgaInput.SyncDetectedFeedback.BoolValue)
return BaseDmTx401.eSourceSelection.VGA;
else if (Tx.DisplayPortInput.SyncDetectedFeedback.BoolValue)
return BaseDmTx401.eSourceSelection.DisplayPort;
else if (Tx.CvbsInput.SyncDetectedFeedback.BoolValue)
return BaseDmTx401.eSourceSelection.Composite;
else
return BaseDmTx401.eSourceSelection.Disabled;
}
}
}
public RoutingPortCollection<RoutingInputPort> InputPorts
{
get
{
return new RoutingPortCollection<RoutingInputPort>
{
HdmiIn,
DisplayPortIn,
VgaIn,
CompositeIn,
AnyVideoInput
};
}
}
public RoutingPortCollection<RoutingOutputPort> OutputPorts
{
get
{
return new RoutingPortCollection<RoutingOutputPort> { DmOut };
}
}
/// <summary>
///
/// </summary>
/// <param name="key"></param>
/// <param name="name"></param>
/// <param name="tx"></param>
public DmTx401CController(string key, string name, DmTx401C tx)
: base(key, name, tx)
{
Tx = tx;
HdmiIn = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn,
eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eVst.HDMI, this,
VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInput))
{
FeedbackMatchObject = eVst.HDMI
};
DisplayPortIn = new RoutingInputPortWithVideoStatuses(DmPortName.DisplayPortIn,
eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eVst.DisplayPort, this,
};
DisplayPortIn = new RoutingInputPortWithVideoStatuses(DmPortName.DisplayPortIn,
eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eVst.DisplayPort, this,
VideoStatusHelper.GetDisplayPortInputStatusFuncs(tx.DisplayPortInput))
{
FeedbackMatchObject = eVst.DisplayPort
};
VgaIn = new RoutingInputPortWithVideoStatuses(DmPortName.VgaIn,
eRoutingSignalType.Video, eRoutingPortConnectionType.Vga, eVst.VGA, this,
};
VgaIn = new RoutingInputPortWithVideoStatuses(DmPortName.VgaIn,
eRoutingSignalType.Video, eRoutingPortConnectionType.Vga, eVst.VGA, this,
VideoStatusHelper.GetVgaInputStatusFuncs(tx.VgaInput))
{
FeedbackMatchObject = eVst.VGA
};
CompositeIn = new RoutingInputPortWithVideoStatuses(DmPortName.CompositeIn,
eRoutingSignalType.Video, eRoutingPortConnectionType.Composite, eVst.Composite, this,
};
CompositeIn = new RoutingInputPortWithVideoStatuses(DmPortName.CompositeIn,
eRoutingSignalType.Video, eRoutingPortConnectionType.Composite, eVst.Composite, this,
VideoStatusHelper.GetVgaInputStatusFuncs(tx.VgaInput))
{
FeedbackMatchObject = eVst.Composite
@@ -146,185 +146,184 @@ namespace PepperDash.Essentials.DM
Tx.BaseEvent += Tx_BaseEvent;
Tx.OnlineStatusChange += Tx_OnlineStatusChange;
Tx.VgaInput.InputStreamChange += VgaInputOnInputStreamChange;
tx.VgaInput.VideoControls.ControlChange += VideoControls_ControlChange;
ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput",
tx.VgaInput.VideoControls.ControlChange += VideoControls_ControlChange;
ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput",
() => ActualVideoInput.ToString());
VideoSourceNumericFeedback = new IntFeedback(() => (int)Tx.VideoSourceFeedback);
VideoSourceNumericFeedback = new IntFeedback(() => (int)Tx.VideoSourceFeedback);
AudioSourceNumericFeedback = new IntFeedback(() => (int)Tx.AudioSourceFeedback);
HdmiInHdcpCapabilityFeedback = new IntFeedback("HdmiInHdcpCapability", () => tx.HdmiInput.HdcpSupportOnFeedback.BoolValue ? 1 : 0);
HdcpStateFeedback = HdmiInHdcpCapabilityFeedback;
HdcpStateFeedback = HdmiInHdcpCapabilityFeedback;
HdcpSupportCapability = eHdcpCapabilityType.HdcpAutoSupport;
DisplayPortVideoSyncFeedback = new BoolFeedback("DisplayPortVideoSync", () => (bool)tx.DisplayPortInput.SyncDetectedFeedback.BoolValue);
HdmiVideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInput.SyncDetectedFeedback.BoolValue);
VgaVideoSyncFeedback = new BoolFeedback(() => (bool)tx.VgaInput.SyncDetectedFeedback.BoolValue);
FreeRunEnabledFeedback = new BoolFeedback(() => tx.VgaInput.FreeRunFeedback == eDmFreeRunSetting.Enabled);
VgaBrightnessFeedback = new IntFeedback(() => tx.VgaInput.VideoControls.BrightnessFeedback.UShortValue);
VgaContrastFeedback = new IntFeedback(() => tx.VgaInput.VideoControls.ContrastFeedback.UShortValue);
var combinedFuncs = new VideoStatusFuncsWrapper
{
HdcpActiveFeedbackFunc = () =>
(ActualVideoInput == eVst.HDMI
&& tx.HdmiInput.VideoAttributes.HdcpActiveFeedback.BoolValue)
|| (ActualVideoInput == eVst.DisplayPort
&& tx.DisplayPortInput.VideoAttributes.HdcpActiveFeedback.BoolValue),
HdcpStateFeedbackFunc = () =>
{
if (ActualVideoInput == eVst.HDMI)
return tx.HdmiInput.VideoAttributes.HdcpStateFeedback.ToString();
if (ActualVideoInput == eVst.DisplayPort)
return tx.DisplayPortInput.VideoAttributes.HdcpStateFeedback.ToString();
return "";
},
VideoResolutionFeedbackFunc = () =>
{
if (ActualVideoInput == eVst.HDMI)
return tx.HdmiInput.VideoAttributes.GetVideoResolutionString();
if (ActualVideoInput == eVst.DisplayPort)
return tx.DisplayPortInput.VideoAttributes.GetVideoResolutionString();
if (ActualVideoInput == eVst.VGA)
return tx.VgaInput.VideoAttributes.GetVideoResolutionString();
if (ActualVideoInput == eVst.Composite)
return tx.CvbsInput.VideoAttributes.GetVideoResolutionString();
return "";
},
VideoSyncFeedbackFunc = () =>
(ActualVideoInput == eVst.HDMI
&& tx.HdmiInput.SyncDetectedFeedback.BoolValue)
|| (ActualVideoInput == eVst.DisplayPort
&& tx.DisplayPortInput.SyncDetectedFeedback.BoolValue)
|| (ActualVideoInput == eVst.VGA
&& tx.VgaInput.SyncDetectedFeedback.BoolValue)
|| (ActualVideoInput == eVst.Composite
&& tx.CvbsInput.SyncDetectedFeedback.BoolValue)
};
AnyVideoInput = new RoutingInputPortWithVideoStatuses(DmPortName.AnyVideoIn,
eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.None, 0, this, combinedFuncs);
DmOut = new RoutingOutputPort(DmPortName.DmOut, eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.DmCat, null, this);
AddToFeedbackList(ActiveVideoInputFeedback, VideoSourceNumericFeedback, AudioSourceNumericFeedback,
AnyVideoInput.VideoStatus.HasVideoStatusFeedback, AnyVideoInput.VideoStatus.HdcpActiveFeedback,
AnyVideoInput.VideoStatus.HdcpStateFeedback, AnyVideoInput.VideoStatus.VideoResolutionFeedback,
AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiInHdcpCapabilityFeedback, DisplayPortVideoSyncFeedback,
HdmiVideoSyncFeedback, VgaVideoSyncFeedback);
// Set Ports for CEC
DisplayPortIn.Port = Tx.DisplayPortInput;
HdmiIn.Port = Tx.HdmiInput;
DmOut.Port = Tx.DmOutput;
}
public override bool CustomActivate()
{
// Link up all of these damned events to the various RoutingPorts via a helper handler
Tx.HdmiInput.InputStreamChange += (o, a) => FowardInputStreamChange(HdmiIn, a.EventId);
Tx.HdmiInput.VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(HdmiIn, a.EventId);
Tx.DisplayPortInput.InputStreamChange += (o, a) => FowardInputStreamChange(DisplayPortIn, a.EventId);
Tx.DisplayPortInput.VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(DisplayPortIn, a.EventId);
Tx.VgaInput.InputStreamChange += (o, a) => FowardInputStreamChange(VgaIn, a.EventId);
Tx.VgaInput.VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(VgaIn, a.EventId);
// Base does register and sets up comm monitoring.
return base.CustomActivate();
}
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{
var joinMap = GetDmTxJoinMap(joinStart, joinMapKey);
if (HdmiVideoSyncFeedback != null)
{
HdmiVideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input1VideoSyncStatus.JoinNumber]);
}
if (VgaVideoSyncFeedback != null)
VgaVideoSyncFeedback = new BoolFeedback(() => (bool)tx.VgaInput.SyncDetectedFeedback.BoolValue);
FreeRunEnabledFeedback = new BoolFeedback(() => tx.VgaInput.FreeRunFeedback == eDmFreeRunSetting.Enabled);
VgaBrightnessFeedback = new IntFeedback(() => tx.VgaInput.VideoControls.BrightnessFeedback.UShortValue);
VgaContrastFeedback = new IntFeedback(() => tx.VgaInput.VideoControls.ContrastFeedback.UShortValue);
var combinedFuncs = new VideoStatusFuncsWrapper
{
HdcpActiveFeedbackFunc = () =>
(ActualVideoInput == eVst.HDMI
&& tx.HdmiInput.VideoAttributes.HdcpActiveFeedback.BoolValue)
|| (ActualVideoInput == eVst.DisplayPort
&& tx.DisplayPortInput.VideoAttributes.HdcpActiveFeedback.BoolValue),
HdcpStateFeedbackFunc = () =>
{
if (ActualVideoInput == eVst.HDMI)
return tx.HdmiInput.VideoAttributes.HdcpStateFeedback.ToString();
if (ActualVideoInput == eVst.DisplayPort)
return tx.DisplayPortInput.VideoAttributes.HdcpStateFeedback.ToString();
return "";
},
VideoResolutionFeedbackFunc = () =>
{
if (ActualVideoInput == eVst.HDMI)
return tx.HdmiInput.VideoAttributes.GetVideoResolutionString();
if (ActualVideoInput == eVst.DisplayPort)
return tx.DisplayPortInput.VideoAttributes.GetVideoResolutionString();
if (ActualVideoInput == eVst.VGA)
return tx.VgaInput.VideoAttributes.GetVideoResolutionString();
if (ActualVideoInput == eVst.Composite)
return tx.CvbsInput.VideoAttributes.GetVideoResolutionString();
return "";
},
VideoSyncFeedbackFunc = () =>
(ActualVideoInput == eVst.HDMI
&& tx.HdmiInput.SyncDetectedFeedback.BoolValue)
|| (ActualVideoInput == eVst.DisplayPort
&& tx.DisplayPortInput.SyncDetectedFeedback.BoolValue)
|| (ActualVideoInput == eVst.VGA
&& tx.VgaInput.SyncDetectedFeedback.BoolValue)
|| (ActualVideoInput == eVst.Composite
&& tx.CvbsInput.SyncDetectedFeedback.BoolValue)
};
AnyVideoInput = new RoutingInputPortWithVideoStatuses(DmPortName.AnyVideoIn,
eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.None, 0, this, combinedFuncs);
DmOut = new RoutingOutputPort(DmPortName.DmOut, eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.DmCat, null, this);
AddToFeedbackList(ActiveVideoInputFeedback, VideoSourceNumericFeedback, AudioSourceNumericFeedback,
AnyVideoInput.VideoStatus.HasVideoStatusFeedback, AnyVideoInput.VideoStatus.HdcpActiveFeedback,
AnyVideoInput.VideoStatus.HdcpStateFeedback, AnyVideoInput.VideoStatus.VideoResolutionFeedback,
AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiInHdcpCapabilityFeedback, DisplayPortVideoSyncFeedback,
HdmiVideoSyncFeedback, VgaVideoSyncFeedback);
// Set Ports for CEC
DisplayPortIn.Port = Tx.DisplayPortInput;
HdmiIn.Port = Tx.HdmiInput;
DmOut.Port = Tx.DmOutput;
}
public override bool CustomActivate()
{
// Link up all of these damned events to the various RoutingPorts via a helper handler
Tx.HdmiInput.InputStreamChange += (o, a) => FowardInputStreamChange(HdmiIn, a.EventId);
Tx.HdmiInput.VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(HdmiIn, a.EventId);
Tx.DisplayPortInput.InputStreamChange += (o, a) => FowardInputStreamChange(DisplayPortIn, a.EventId);
Tx.DisplayPortInput.VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(DisplayPortIn, a.EventId);
Tx.VgaInput.InputStreamChange += (o, a) => FowardInputStreamChange(VgaIn, a.EventId);
Tx.VgaInput.VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(VgaIn, a.EventId);
// Base does register and sets up comm monitoring.
return base.CustomActivate();
}
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{
var joinMap = GetDmTxJoinMap(joinStart, joinMapKey);
if (HdmiVideoSyncFeedback != null)
{
VgaVideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input2VideoSyncStatus.JoinNumber]);
}
LinkDmTxToApi(this, trilist, joinMap, bridge);
}
public void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type)
{
Debug.Console(2, this, "Executing Numeric Switch to input {0}.", input);
switch (input)
{
case 0:
{
ExecuteSwitch(eVst.Auto, null, type);
break;
}
case 1:
{
ExecuteSwitch(DisplayPortIn.Selector, null, type);
break;
}
case 2:
{
ExecuteSwitch(HdmiIn.Selector, null, type);
break;
}
case 3:
{
ExecuteSwitch(VgaIn.Selector, null, type);
break;
}
case 4:
{
ExecuteSwitch(CompositeIn.Selector, null, type);
break;
}
case 5:
{
ExecuteSwitch(eVst.Disabled, null, type);
break;
}
}
}
public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType)
{
if ((signalType | eRoutingSignalType.Video) == eRoutingSignalType.Video)
Tx.VideoSource = (eVst)inputSelector;
if ((signalType | eRoutingSignalType.Audio) == eRoutingSignalType.Audio)
Tx.AudioSource = (eVst)inputSelector;
HdmiVideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input1VideoSyncStatus.JoinNumber]);
}
if (VgaVideoSyncFeedback != null)
{
VgaVideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input2VideoSyncStatus.JoinNumber]);
}
LinkDmTxToApi(this, trilist, joinMap, bridge);
}
public void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type)
{
Debug.Console(2, this, "Executing Numeric Switch to input {0}.", input);
switch (input)
{
case 0:
{
ExecuteSwitch(eVst.Auto, null, type);
break;
}
case 1:
{
ExecuteSwitch(DisplayPortIn.Selector, null, type);
break;
}
case 2:
{
ExecuteSwitch(HdmiIn.Selector, null, type);
break;
}
case 3:
{
ExecuteSwitch(VgaIn.Selector, null, type);
break;
}
case 4:
{
ExecuteSwitch(CompositeIn.Selector, null, type);
break;
}
case 5:
{
ExecuteSwitch(eVst.Disabled, null, type);
break;
}
}
}
public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType)
{
if ((signalType | eRoutingSignalType.Video) == eRoutingSignalType.Video)
Tx.VideoSource = (eVst)inputSelector;
if ((signalType | eRoutingSignalType.Audio) == eRoutingSignalType.Audio)
Tx.AudioSource = (eVst)inputSelector;
}
void Tx_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args)
{
var localVideoInputPort =
InputPorts.FirstOrDefault(p => (eVst)p.Selector == Tx.VideoSourceFeedback);
var localAudioInputPort =
InputPorts.FirstOrDefault(p => (eVst)p.Selector == Tx.AudioSourceFeedback);
ActiveVideoInputFeedback.FireUpdate();
VideoSourceNumericFeedback.FireUpdate();
AudioSourceNumericFeedback.FireUpdate();
OnSwitchChange(new RoutingNumericEventArgs(1, VideoSourceNumericFeedback.UShortValue, OutputPorts.First(), localVideoInputPort, eRoutingSignalType.Video));
OnSwitchChange(new RoutingNumericEventArgs(1, AudioSourceNumericFeedback.UShortValue, OutputPorts.First(), localAudioInputPort, eRoutingSignalType.Audio));
}
void Tx_BaseEvent(GenericBase device, BaseEventArgs args)
@@ -348,7 +347,7 @@ namespace PepperDash.Essentials.DM
OnSwitchChange(new RoutingNumericEventArgs(1, AudioSourceNumericFeedback.UShortValue, OutputPorts.First(), localInputAudioPort, eRoutingSignalType.Audio));
break;
}
}
}
void VideoControls_ControlChange(object sender, GenericEventArgs args)
{
@@ -364,7 +363,7 @@ namespace PepperDash.Essentials.DM
VgaContrastFeedback.FireUpdate();
break;
}
}
}
/// <summary>
/// Enables or disables free run
@@ -391,10 +390,10 @@ namespace PepperDash.Essentials.DM
public void SetVgaContrast(ushort level)
{
Tx.VgaInput.VideoControls.Contrast.UShortValue = level;
}
/// <summary>
/// Relays the input stream change to the appropriate RoutingInputPort.
}
/// <summary>
/// Relays the input stream change to the appropriate RoutingInputPort.
/// </summary>
void FowardInputStreamChange(RoutingInputPortWithVideoStatuses inputPort, int eventId)
{
@@ -404,36 +403,36 @@ namespace PepperDash.Essentials.DM
}
inputPort.VideoStatus.VideoSyncFeedback.FireUpdate();
AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate();
}
/// <summary>
/// Relays the VideoAttributes change to a RoutingInputPort
/// </summary>
void ForwardVideoAttributeChange(RoutingInputPortWithVideoStatuses inputPort, int eventId)
{
//// LOCATION: Crestron.SimplSharpPro.DM.VideoAttributeEventIds
//Debug.Console(2, this, "VideoAttributes_AttributeChange event id={0} from {1}",
// args.EventId, (sender as VideoAttributesEnhanced).Owner.GetType());
switch (eventId)
{
case VideoAttributeEventIds.HdcpActiveFeedbackEventId:
inputPort.VideoStatus.HdcpActiveFeedback.FireUpdate();
AnyVideoInput.VideoStatus.HdcpActiveFeedback.FireUpdate();
break;
case VideoAttributeEventIds.HdcpStateFeedbackEventId:
inputPort.VideoStatus.HdcpStateFeedback.FireUpdate();
AnyVideoInput.VideoStatus.HdcpStateFeedback.FireUpdate();
break;
case VideoAttributeEventIds.HorizontalResolutionFeedbackEventId:
case VideoAttributeEventIds.VerticalResolutionFeedbackEventId:
inputPort.VideoStatus.VideoResolutionFeedback.FireUpdate();
AnyVideoInput.VideoStatus.VideoResolutionFeedback.FireUpdate();
break;
case VideoAttributeEventIds.FramesPerSecondFeedbackEventId:
inputPort.VideoStatus.VideoResolutionFeedback.FireUpdate();
AnyVideoInput.VideoStatus.VideoResolutionFeedback.FireUpdate();
break;
}
}
/// <summary>
/// Relays the VideoAttributes change to a RoutingInputPort
/// </summary>
void ForwardVideoAttributeChange(RoutingInputPortWithVideoStatuses inputPort, int eventId)
{
//// LOCATION: Crestron.SimplSharpPro.DM.VideoAttributeEventIds
//Debug.Console(2, this, "VideoAttributes_AttributeChange event id={0} from {1}",
// args.EventId, (sender as VideoAttributesEnhanced).Owner.GetType());
switch (eventId)
{
case VideoAttributeEventIds.HdcpActiveFeedbackEventId:
inputPort.VideoStatus.HdcpActiveFeedback.FireUpdate();
AnyVideoInput.VideoStatus.HdcpActiveFeedback.FireUpdate();
break;
case VideoAttributeEventIds.HdcpStateFeedbackEventId:
inputPort.VideoStatus.HdcpStateFeedback.FireUpdate();
AnyVideoInput.VideoStatus.HdcpStateFeedback.FireUpdate();
break;
case VideoAttributeEventIds.HorizontalResolutionFeedbackEventId:
case VideoAttributeEventIds.VerticalResolutionFeedbackEventId:
inputPort.VideoStatus.VideoResolutionFeedback.FireUpdate();
AnyVideoInput.VideoStatus.VideoResolutionFeedback.FireUpdate();
break;
case VideoAttributeEventIds.FramesPerSecondFeedbackEventId:
inputPort.VideoStatus.VideoResolutionFeedback.FireUpdate();
AnyVideoInput.VideoStatus.VideoResolutionFeedback.FireUpdate();
break;
}
}
void HdmiInputStreamChangeEvent(EndpointInputStream inputStream, EndpointInputStreamEventArgs args)
@@ -477,18 +476,18 @@ namespace PepperDash.Essentials.DM
VgaVideoSyncFeedback.FireUpdate();
break;
}
}
#region IIROutputPorts Members
public CrestronCollection<IROutputPort> IROutputPorts { get { return Tx.IROutputPorts; } }
public int NumberOfIROutputPorts { get { return Tx.NumberOfIROutputPorts; } }
#endregion
#region IComPorts Members
public CrestronCollection<ComPort> ComPorts { get { return Tx.ComPorts; } }
public int NumberOfComPorts { get { return Tx.NumberOfComPorts; } }
#endregion
}
}
#region IIROutputPorts Members
public CrestronCollection<IROutputPort> IROutputPorts { get { return Tx.IROutputPorts; } }
public int NumberOfIROutputPorts { get { return Tx.NumberOfIROutputPorts; } }
#endregion
#region IComPorts Members
public CrestronCollection<ComPort> ComPorts { get { return Tx.ComPorts; } }
public int NumberOfComPorts { get { return Tx.NumberOfComPorts; } }
#endregion
}
}

View File

@@ -122,7 +122,9 @@ namespace PepperDash.Essentials.DM
return new DmTx4kz302CController(key, name, new DmTx4kz302C(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx401"))
return new DmTx401CController(key, name, new DmTx401C(chassis.Inputs[num]));
}
if (typeName.StartsWith("hdbasettx"))
return new HDBaseTTxController(key, name, new HDTx3CB(chassis.Inputs[num]));
}
else
{
if (typeName.StartsWith("dmtx200"))
@@ -145,7 +147,9 @@ namespace PepperDash.Essentials.DM
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]));
}
if (typeName.StartsWith("hdbasettx"))
return new HDBaseTTxController(key, name, new HDTx3CB(ipid, chassis.Inputs[num]));
}
}
catch (Exception e)
{
@@ -355,7 +359,7 @@ namespace PepperDash.Essentials.DM
public DmTxControllerFactory()
{
TypeNames = new List<string>() { "dmtx200c", "dmtx201c", "dmtx201s", "dmtx4k100c", "dmtx4k202c", "dmtx4kz202c", "dmtx4k302c", "dmtx4kz302c",
"dmtx401c", "dmtx401s", "dmtx4k100c1g", "dmtx4kz100c1g" };
"dmtx401c", "dmtx401s", "dmtx4k100c1g", "dmtx4kz100c1g", "hdbasettx" };
}
public override EssentialsDevice BuildDevice(DeviceConfig dc)

View File

@@ -0,0 +1,113 @@
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.Endpoints.Transmitters;
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Bridges;
namespace PepperDash.Essentials.DM
{
/// <summary>
/// Controller class for suitable for HDBaseT transmitters
/// </summary>
[Description("Wrapper Class for HDBaseT devices based on HDTx3CB class")]
public class HDBaseTTxController: BasicDmTxControllerBase, IRoutingInputsOutputs, IComPorts
{
public RoutingInputPort HdmiIn { get; private set; }
public RoutingOutputPort DmOut { get; private set; }
public HDBaseTTxController(string key, string name, HDTx3CB tx)
: base(key, name, tx)
{
HdmiIn = new RoutingInputPort(DmPortName.HdmiIn1, eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.Hdmi, null, this) { Port = tx };
DmOut = new RoutingOutputPort(DmPortName.DmOut, eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.DmCat, null, this);
InputPorts = new RoutingPortCollection<RoutingInputPort> { HdmiIn };
OutputPorts = new RoutingPortCollection<RoutingOutputPort> { DmOut };
}
#region IRoutingInputs Members
public RoutingPortCollection<RoutingInputPort> InputPorts { get; private set; }
#endregion
#region IRoutingOutputs Members
public RoutingPortCollection<RoutingOutputPort> OutputPorts { get; private set; }
#endregion
#region IComPorts Members
public CrestronCollection<ComPort> ComPorts { get { return (Hardware as HDTx3CB).ComPorts; } }
public int NumberOfComPorts { get { return (Hardware as HDTx3CB).NumberOfComPorts; } }
#endregion
#region CrestronBridgeableBaseDevice abstract overrides
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{
var joinMap = new HDBaseTTxControllerJoinMap(joinStart);
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<HDBaseTTxControllerJoinMap>(joinMapSerialized);
if (bridge != null)
{
bridge.AddJoinMap(Key, joinMap);
}
else
{
Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
}
Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
this.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]);
}
#endregion
}
public class HDBaseTTxControllerJoinMap : JoinMapBaseAdvanced
{
[JoinName("IsOnline")]
public JoinDataComplete IsOnline = new JoinDataComplete(
new JoinData
{
JoinNumber = 1,
JoinSpan = 1
},
new JoinMetadata
{
Description = "HDBaseT device online feedback",
JoinCapabilities = eJoinCapabilities.ToSIMPL,
JoinType = eJoinType.Digital
});
/// <summary>
/// Plugin device BridgeJoinMap constructor
/// </summary>
/// <param name="joinStart">This will be the join it starts on the EISC bridge</param>
public HDBaseTTxControllerJoinMap(uint joinStart)
: base(joinStart, typeof(HDBaseTTxControllerJoinMap))
{
}
}
}

View File

@@ -65,12 +65,12 @@
</Reference>
<Reference Include="SimplSharpCustomAttributesInterface, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpCustomAttributesInterface.dll</HintPath>
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpCustomAttributesInterface.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="SimplSharpHelperInterface, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpHelperInterface.dll</HintPath>
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpHelperInterface.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="SimplSharpNewtonsoft, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
@@ -79,7 +79,7 @@
</Reference>
<Reference Include="SimplSharpPro, Version=1.5.3.17, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpPro.exe</HintPath>
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpPro.exe</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="SimplSharpReflectionInterface, Version=1.0.5583.25238, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
@@ -108,6 +108,7 @@
<Compile Include="Endpoints\Transmitters\DmTx4kz202CController.cs" />
<Compile Include="Endpoints\Transmitters\DmTx201SController.cs" />
<Compile Include="Endpoints\Transmitters\DmTx4kz100Controller.cs" />
<Compile Include="Endpoints\Transmitters\HDBaseTTxController.cs" />
<Compile Include="Endpoints\Transmitters\TxInterfaces.cs" />
<Compile Include="IDmSwitch.cs" />
<Compile Include="Config\DmpsRoutingConfig.cs" />

View File

@@ -46,6 +46,17 @@ namespace PepperDash.Essentials.Devices.Common.Cameras
void CameraOff();
}
/// <summary>
/// Describes the ability to mute and unmute camera video
/// </summary>
public interface IHasCameraMute
{
BoolFeedback CameraIsMutedFeedback { get; }
void CameraMuteOn();
void CameraMuteOff();
void CameraMuteToggle();
}
public class CameraSelectedEventArgs : EventArgs
{
public CameraBase SelectedCamera { get; private set; }

View File

@@ -4,19 +4,20 @@ using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Routing;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.Bridges;
namespace PepperDash.Essentials.Devices.Common
{
public class IRBlurayBase : EssentialsDevice, IDiscPlayerControls, IUiDisplayInfo, IRoutingOutputs, IUsageTracking
public class IRBlurayBase : EssentialsBridgeableDevice, IDiscPlayerControls, IUiDisplayInfo, IRoutingOutputs, IUsageTracking
{
public IrOutputPortController IrPort { get; private set; }
@@ -45,6 +46,113 @@ namespace PepperDash.Essentials.Devices.Common
OutputPorts = new RoutingPortCollection<RoutingOutputPort> { HdmiOut, AnyAudioOut };
}
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{
var joinMap = new IRBlurayBaseJoinMap(joinStart);
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<IRBlurayBaseJoinMap>(joinMapSerialized);
if (bridge != null)
{
bridge.AddJoinMap(Key, joinMap);
}
else
{
Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
}
Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
Debug.Console(0, "Linking to SetTopBox: {0}", Name);
trilist.OnlineStatusChange += new OnlineStatusChangeEventHandler((o, a) =>
{
if (a.DeviceOnLine)
{
trilist.StringInput[joinMap.Name.JoinNumber].StringValue = Name;
}
});
var powerDev = this as IHasPowerControl;
if (powerDev != null)
{
trilist.SetSigTrueAction(joinMap.PowerOn.JoinNumber, powerDev.PowerOn);
trilist.SetSigTrueAction(joinMap.PowerOff.JoinNumber, powerDev.PowerOff);
trilist.SetSigTrueAction(joinMap.PowerToggle.JoinNumber, powerDev.PowerToggle);
}
var dpadDev = this as IDPad;
if (dpadDev != null)
{
trilist.SetBoolSigAction(joinMap.Up.JoinNumber, dpadDev.Up);
trilist.SetBoolSigAction(joinMap.Down.JoinNumber, dpadDev.Down);
trilist.SetBoolSigAction(joinMap.Left.JoinNumber, dpadDev.Left);
trilist.SetBoolSigAction(joinMap.Right.JoinNumber, dpadDev.Right);
trilist.SetBoolSigAction(joinMap.Select.JoinNumber, dpadDev.Select);
trilist.SetBoolSigAction(joinMap.Menu.JoinNumber, dpadDev.Menu);
trilist.SetBoolSigAction(joinMap.Exit.JoinNumber, dpadDev.Exit);
}
var channelDev = this as IChannel;
if (channelDev != null)
{
trilist.SetBoolSigAction(joinMap.ChannelUp.JoinNumber, channelDev.ChannelUp);
trilist.SetBoolSigAction(joinMap.ChannelDown.JoinNumber, channelDev.ChannelDown);
trilist.SetBoolSigAction(joinMap.LastChannel.JoinNumber, channelDev.LastChannel);
trilist.SetBoolSigAction(joinMap.Guide.JoinNumber, channelDev.Guide);
trilist.SetBoolSigAction(joinMap.Info.JoinNumber, channelDev.Info);
trilist.SetBoolSigAction(joinMap.Exit.JoinNumber, channelDev.Exit);
}
var colorDev = this as IColor;
if (colorDev != null)
{
trilist.SetBoolSigAction(joinMap.Red.JoinNumber, colorDev.Red);
trilist.SetBoolSigAction(joinMap.Green.JoinNumber, colorDev.Green);
trilist.SetBoolSigAction(joinMap.Yellow.JoinNumber, colorDev.Yellow);
trilist.SetBoolSigAction(joinMap.Blue.JoinNumber, colorDev.Blue);
}
var keypadDev = this as ISetTopBoxNumericKeypad;
if (keypadDev != null)
{
trilist.StringInput[joinMap.KeypadAccessoryButton1Label.JoinNumber].StringValue = keypadDev.KeypadAccessoryButton1Label;
trilist.StringInput[joinMap.KeypadAccessoryButton2Label.JoinNumber].StringValue = keypadDev.KeypadAccessoryButton2Label;
trilist.BooleanInput[joinMap.HasKeypadAccessoryButton1.JoinNumber].BoolValue = keypadDev.HasKeypadAccessoryButton1;
trilist.BooleanInput[joinMap.HasKeypadAccessoryButton2.JoinNumber].BoolValue = keypadDev.HasKeypadAccessoryButton2;
trilist.SetBoolSigAction(joinMap.Digit0.JoinNumber, keypadDev.Digit0);
trilist.SetBoolSigAction(joinMap.Digit1.JoinNumber, keypadDev.Digit1);
trilist.SetBoolSigAction(joinMap.Digit2.JoinNumber, keypadDev.Digit2);
trilist.SetBoolSigAction(joinMap.Digit3.JoinNumber, keypadDev.Digit3);
trilist.SetBoolSigAction(joinMap.Digit4.JoinNumber, keypadDev.Digit4);
trilist.SetBoolSigAction(joinMap.Digit5.JoinNumber, keypadDev.Digit5);
trilist.SetBoolSigAction(joinMap.Digit6.JoinNumber, keypadDev.Digit6);
trilist.SetBoolSigAction(joinMap.Digit7.JoinNumber, keypadDev.Digit7);
trilist.SetBoolSigAction(joinMap.Digit8.JoinNumber, keypadDev.Digit8);
trilist.SetBoolSigAction(joinMap.Digit9.JoinNumber, keypadDev.Digit9);
trilist.SetBoolSigAction(joinMap.KeypadAccessoryButton1Press.JoinNumber, keypadDev.KeypadAccessoryButton1);
trilist.SetBoolSigAction(joinMap.KeypadAccessoryButton2Press.JoinNumber, keypadDev.KeypadAccessoryButton1);
trilist.SetBoolSigAction(joinMap.KeypadEnter.JoinNumber, keypadDev.KeypadEnter);
}
var transportDev = this as ITransport;
if (transportDev != null)
{
trilist.SetBoolSigAction(joinMap.Play.JoinNumber, transportDev.Play);
trilist.SetBoolSigAction(joinMap.Pause.JoinNumber, transportDev.Pause);
trilist.SetBoolSigAction(joinMap.Rewind.JoinNumber, transportDev.Rewind);
trilist.SetBoolSigAction(joinMap.FFwd.JoinNumber, transportDev.FFwd);
trilist.SetBoolSigAction(joinMap.ChapMinus.JoinNumber, transportDev.ChapMinus);
trilist.SetBoolSigAction(joinMap.ChapPlus.JoinNumber, transportDev.ChapPlus);
trilist.SetBoolSigAction(joinMap.Stop.JoinNumber, transportDev.Stop);
trilist.SetBoolSigAction(joinMap.Record.JoinNumber, transportDev.Record);
}
}
#region IDPad Members

View File

@@ -149,7 +149,7 @@ namespace PepperDash.Essentials.Devices.Displays
public override bool CustomActivate()
{
Communication.Connect();
CommunicationMonitor.StatusChange += (o, a) => { Debug.Console(2, this, "Communication monitor state: {0}", CommunicationMonitor.Status); };
CommunicationMonitor.StatusChange += (o, a) => Debug.Console(2, this, "Communication monitor state: {0}", CommunicationMonitor.Status);
CommunicationMonitor.Start();
return true;
}
@@ -188,9 +188,6 @@ namespace PepperDash.Essentials.Devices.Displays
IncomingBuffer.CopyTo(newBytes, 0);
e.Bytes.CopyTo(newBytes, IncomingBuffer.Length);
if (Debug.Level == 2) // This check is here to prevent following string format from building unnecessarily on level 0 or 1
Debug.Console(2, this, "Received:{0}", ComTextHelper.GetEscapedText(newBytes));
// Need to find AA FF and have
for (int i = 0; i < newBytes.Length; i++)
{
@@ -364,8 +361,6 @@ namespace PepperDash.Essentials.Devices.Displays
}
checksum = checksum & 0x000000FF; // mask off MSBs
b[b.Length - 1] = (byte)checksum;
if(Debug.Level == 2) // This check is here to prevent following string format from building unnecessarily on level 0 or 1
Debug.Console(2, this, "Sending:{0}", ComTextHelper.GetEscapedText(b));
if (b[1] == 0x12)
LastCommandSentWasVolume = true;

View File

@@ -69,12 +69,12 @@
</Reference>
<Reference Include="SimplSharpCustomAttributesInterface, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpCustomAttributesInterface.dll</HintPath>
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpCustomAttributesInterface.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="SimplSharpHelperInterface, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpHelperInterface.dll</HintPath>
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpHelperInterface.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="SimplSharpNewtonsoft, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
@@ -83,7 +83,7 @@
</Reference>
<Reference Include="SimplSharpPro, Version=1.5.3.17, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpPro.exe</HintPath>
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpPro.exe</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="SimplSharpReflectionInterface, Version=1.0.5583.25238, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">

View File

@@ -12,11 +12,12 @@ using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.Presets;
using PepperDash.Essentials.Core.Routing;
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
namespace PepperDash.Essentials.Devices.Common
{
[Description("Wrapper class for an IR Set Top Box")]
public class IRSetTopBoxBase : EssentialsBridgeableDevice, ISetTopBoxControls, IRoutingOutputs, IUsageTracking, IHasPowerControl
public class IRSetTopBoxBase : EssentialsBridgeableDevice, ISetTopBoxControls, IRoutingOutputs, IUsageTracking, IHasPowerControl, ITvPresetsProvider
{
public IrOutputPortController IrPort { get; private set; }
@@ -28,7 +29,7 @@ namespace PepperDash.Essentials.Devices.Common
public bool HasDpad { get; set; }
public bool HasNumeric { get; set; }
public DevicePresetsModel PresetsModel { get; private set; }
public DevicePresetsModel TvPresets { get; private set; }
public IRSetTopBoxBase(string key, string name, IrOutputPortController portCont,
SetTopBoxPropertiesConfig props)
@@ -66,8 +67,8 @@ namespace PepperDash.Essentials.Devices.Common
public void LoadPresets(string filePath)
{
PresetsModel = new DevicePresetsModel(Key + "-presets", this, filePath);
DeviceManager.AddDevice(PresetsModel);
TvPresets = new DevicePresetsModel(Key + "-presets", this, filePath);
DeviceManager.AddDevice(TvPresets);
}
@@ -387,9 +388,16 @@ namespace PepperDash.Essentials.Devices.Common
}
Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
Debug.Console(0, "Linking to Display: {0}", Name);
Debug.Console(0, "Linking to SetTopBox: {0}", Name);
trilist.OnlineStatusChange += new OnlineStatusChangeEventHandler((o, a) =>
{
if (a.DeviceOnLine)
{
trilist.StringInput[joinMap.Name.JoinNumber].StringValue = Name;
}
});
trilist.StringInput[joinMap.Name.JoinNumber].StringValue = Name;
var stbBase = this as ISetTopBoxControls;
if (stbBase != null)

View File

@@ -18,7 +18,7 @@ using PepperDash.Essentials.Core.Routing;
using PepperDash.Essentials.Devices.Common.Cameras;
using PepperDash.Essentials.Devices.Common.Codec;
using PepperDash.Essentials.Devices.Common.VideoCodec;
using PepperDash_Essentials_Core.DeviceTypeInterfaces;
using PepperDash.Essentials.Core.Queues;
namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
{
@@ -28,7 +28,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
public class CiscoSparkCodec : VideoCodecBase, IHasCallHistory, IHasCallFavorites, IHasDirectory,
IHasScheduleAwareness, IOccupancyStatusProvider, IHasCodecLayouts, IHasCodecSelfView,
ICommunicationMonitor, IRouting, IHasCodecCameras, IHasCameraAutoMode, IHasCodecRoomPresets, IHasExternalSourceSwitching, IHasBranding
ICommunicationMonitor, IRouting, IHasCodecCameras, IHasCameraAutoMode, IHasCodecRoomPresets, IHasExternalSourceSwitching, IHasBranding, IHasCameraOff, IHasCameraMute
{
public event EventHandler<DirectoryEventArgs> DirectoryResultReturned;
@@ -38,9 +38,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
public StatusMonitorBase CommunicationMonitor { get; private set; }
private CrestronQueue<string> ReceiveQueue;
private Thread ReceiveThread;
private GenericQueue ReceiveQueue;
public BoolFeedback PresentationViewMaximizedFeedback { get; private set; }
@@ -302,12 +300,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
}
// The queue that will collect the repsonses in the order they are received
ReceiveQueue = new CrestronQueue<string>(25);
// The thread responsible for dequeuing and processing the messages
ReceiveThread = new Thread((o) => ProcessQueue(), null);
ReceiveThread.Priority = Thread.eThreadPriority.MediumPriority;
ReceiveQueue = new GenericQueue(this.Key + "-rxQueue", 25);
RoomIsOccupiedFeedback = new BoolFeedback(RoomIsOccupiedFeedbackFunc);
PeopleCountFeedback = new IntFeedback(PeopleCountFeedbackFunc);
@@ -317,6 +310,9 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
LocalLayoutFeedback = new StringFeedback(LocalLayoutFeedbackFunc);
LocalLayoutIsProminentFeedback = new BoolFeedback(LocalLayoutIsProminentFeedbackFunc);
FarEndIsSharingContentFeedback = new BoolFeedback(FarEndIsSharingContentFeedbackFunc);
CameraIsOffFeedback = new BoolFeedback(() => CodecStatus.Status.Video.Input.MainVideoMute.BoolValue);
CameraIsMutedFeedback = CameraIsOffFeedback;
PresentationViewMaximizedFeedback = new BoolFeedback(() => CurrentPresentationView == "Maximized");
@@ -372,20 +368,9 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
CodecSchedule = new CodecScheduleAwareness();
//Set Feedback Actions
CodecStatus.Status.Audio.Volume.ValueChangedAction = VolumeLevelFeedback.FireUpdate;
CodecStatus.Status.Audio.VolumeMute.ValueChangedAction = MuteFeedback.FireUpdate;
CodecStatus.Status.Audio.Microphones.Mute.ValueChangedAction = PrivacyModeIsOnFeedback.FireUpdate;
CodecStatus.Status.Standby.State.ValueChangedAction = StandbyIsOnFeedback.FireUpdate;
CodecStatus.Status.RoomAnalytics.PeoplePresence.ValueChangedAction = RoomIsOccupiedFeedback.FireUpdate;
CodecStatus.Status.RoomAnalytics.PeopleCount.Current.ValueChangedAction = PeopleCountFeedback.FireUpdate;
CodecStatus.Status.Cameras.SpeakerTrack.Status.ValueChangedAction = CameraAutoModeIsOnFeedback.FireUpdate;
CodecStatus.Status.Video.Selfview.Mode.ValueChangedAction = SelfviewIsOnFeedback.FireUpdate;
CodecStatus.Status.Video.Selfview.PIPPosition.ValueChangedAction = ComputeSelfviewPipStatus;
CodecStatus.Status.Video.Layout.LayoutFamily.Local.ValueChangedAction = ComputeLocalLayout;
CodecStatus.Status.Conference.Presentation.Mode.ValueChangedAction += SharingContentIsOnFeedback.FireUpdate;
CodecStatus.Status.Conference.Presentation.Mode.ValueChangedAction += FarEndIsSharingContentFeedback.FireUpdate;
SetFeedbackActions();
CodecOsdIn = new RoutingInputPort(RoutingPortNames.CodecOsd, eRoutingSignalType.Audio | eRoutingSignalType.Video,
CodecOsdIn = new RoutingInputPort(RoutingPortNames.CodecOsd, eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.Hdmi, new Action(StopSharing), this);
HdmiIn2 = new RoutingInputPort(RoutingPortNames.HdmiIn2, eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.Hdmi, new Action(SelectPresentationSource1), this);
@@ -421,30 +406,36 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
_brandingUrl = props.UiBranding.BrandingUrl;
}
/// Runs in it's own thread to dequeue messages in the order they were received to be processed
/// </summary>
/// <returns></returns>
object ProcessQueue()
private void SetFeedbackActions()
{
CodecStatus.Status.Audio.Volume.ValueChangedAction = VolumeLevelFeedback.FireUpdate;
CodecStatus.Status.Audio.VolumeMute.ValueChangedAction = MuteFeedback.FireUpdate;
CodecStatus.Status.Audio.Microphones.Mute.ValueChangedAction = PrivacyModeIsOnFeedback.FireUpdate;
CodecStatus.Status.Standby.State.ValueChangedAction = StandbyIsOnFeedback.FireUpdate;
CodecStatus.Status.RoomAnalytics.PeoplePresence.ValueChangedAction = RoomIsOccupiedFeedback.FireUpdate;
CodecStatus.Status.RoomAnalytics.PeopleCount.Current.ValueChangedAction = PeopleCountFeedback.FireUpdate;
CodecStatus.Status.Cameras.SpeakerTrack.Status.ValueChangedAction = CameraAutoModeIsOnFeedback.FireUpdate;
CodecStatus.Status.Video.Selfview.Mode.ValueChangedAction = SelfviewIsOnFeedback.FireUpdate;
CodecStatus.Status.Video.Selfview.PIPPosition.ValueChangedAction = ComputeSelfviewPipStatus;
CodecStatus.Status.Video.Layout.LayoutFamily.Local.ValueChangedAction = ComputeLocalLayout;
CodecStatus.Status.Conference.Presentation.Mode.ValueChangedAction = SharingContentIsOnFeedback.FireUpdate;
CodecStatus.Status.Conference.Presentation.Mode.ValueChangedAction = FarEndIsSharingContentFeedback.FireUpdate;
try
{
while (true)
{
var message = ReceiveQueue.Dequeue();
CodecStatus.Status.Video.Input.MainVideoMute.ValueChangedAction = CameraIsOffFeedback.FireUpdate;
}
catch (Exception ex)
{
Debug.Console(0, this, "Error setting MainVideuMute Action: {0}", ex);
DeserializeResponse(message);
if (ex.InnerException != null)
{
Debug.Console(0, this, "Error setting MainVideuMute Action: {0}", ex);
}
}
catch (Exception e)
{
Debug.Console(1, this, "Error Processing Queue: {0}", e);
}
return null;
}
/// <summary>
/// <summary>
/// Creates the fake OSD source, and connects it's AudioVideo output to the CodecOsdIn input
/// to enable routing
/// </summary>
@@ -687,11 +678,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
// Enqueue the complete message to be deserialized
ReceiveQueue.Enqueue(JsonMessage.ToString());
//DeserializeResponse(JsonMessage.ToString());
if (ReceiveThread.ThreadState != Thread.eThreadStates.ThreadRunning)
ReceiveThread.Start();
ReceiveQueue.Enqueue(new ProcessStringMessage(JsonMessage.ToString(), DeserializeResponse));
return;
}
@@ -1481,7 +1468,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{
throw new NotImplementedException();
LinkVideoCodecToApi(this, trilist, joinStart, joinMapKey, bridge);
}
/// <summary>
@@ -1664,6 +1651,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
public void CameraAutoModeOn()
{
SendText("xCommand Cameras SpeakerTrack Activate");
CameraMuteOff();
}
public void CameraAutoModeOff()
@@ -1739,6 +1727,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
_selectedCamera = value;
SelectedCameraFeedback.FireUpdate();
ControllingFarEndCameraFeedback.FireUpdate();
if (CameraIsOffFeedback.BoolValue)
CameraMuteOff();
var handler = CameraSelected;
if (handler != null)
@@ -2002,7 +1992,47 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
#endregion
}
#region IHasCameraOff Members
public BoolFeedback CameraIsOffFeedback { get; private set; }
public void CameraOff()
{
CameraMuteOn();
}
#endregion
public BoolFeedback CameraIsMutedFeedback { get; private set; }
/// <summary>
/// Mutes the outgoing camera video
/// </summary>
public void CameraMuteOn()
{
SendText("xCommand Video InputMainVideo Mute");
}
/// <summary>
/// Unmutes the outgoing camera video
/// </summary>
public void CameraMuteOff()
{
SendText("xCommand Video InputMainVideo Unmute");
}
/// <summary>
/// Toggles the camera mute state
/// </summary>
public void CameraMuteToggle()
{
if (CameraIsMutedFeedback.BoolValue)
CameraMuteOff();
else
CameraMuteOn();
}
}
/// <summary>

View File

@@ -8,6 +8,7 @@ using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Essentials.Devices.Common.VideoCodec.CiscoCodec;
namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
{
@@ -1369,7 +1370,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
set
{
// If the incoming value is "On" it sets the BoolValue true, otherwise sets it false
BoolValue = value == "On";
BoolValue = value == "On" || value == "Standby";
OnValueChanged();
}
}
@@ -1606,6 +1607,22 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
public string Value { get; set; }
}
public class MainVideoMute : ValueProperty
{
public bool BoolValue { get; private set; }
public string Value
{
set
{
// If the incoming value is "On" it sets the BoolValue true, otherwise sets it false
BoolValue = value == "On";
OnValueChanged();
}
}
}
public class ConnectorId
{
public string Value { get; set; }
@@ -1662,7 +1679,13 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
{
public List<Connector> Connector { get; set; }
public MainVideoSource MainVideoSource { get; set; }
public MainVideoMute MainVideoMute { get; set; }
public List<Source> Source { get; set; }
public Input2()
{
MainVideoMute = new MainVideoMute();
}
}
public class Local : ValueProperty
@@ -1858,6 +1881,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
{
Selfview = new Selfview();
Layout = new Layout();
Input = new Input2();
}
}

View File

@@ -17,13 +17,12 @@ using PepperDash.Essentials.Devices.Common.Cameras;
using PepperDash.Essentials.Devices.Common.Codec;
using PepperDash.Essentials.Devices.Common.VideoCodec.Cisco;
using PepperDash.Essentials.Devices.Common.VideoCodec.Interfaces;
using PepperDash_Essentials_Core.DeviceTypeInterfaces;
namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
{
public class ZoomRoom : VideoCodecBase, IHasCodecSelfView, IHasDirectoryHistoryStack, ICommunicationMonitor,
IRouting,
IHasScheduleAwareness, IHasCodecCameras, IHasParticipants, IHasCameraOff, IHasCameraAutoMode,
IHasScheduleAwareness, IHasCodecCameras, IHasParticipants, IHasCameraOff, IHasCameraMute, IHasCameraAutoMode,
IHasFarEndContentStatus, IHasSelfviewPosition, IHasPhoneDialing
{
private const long MeetingRefreshTimer = 60000;
@@ -98,6 +97,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
CameraIsOffFeedback = new BoolFeedback(CameraIsOffFeedbackFunc);
CameraIsMutedFeedback = CameraIsOffFeedback;
CameraAutoModeIsOnFeedback = new BoolFeedback(CameraAutoModeIsOnFeedbackFunc);
CodecSchedule = new CodecScheduleAwareness(MeetingRefreshTimer);
@@ -1655,6 +1656,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
public override void Dial(Meeting meeting)
{
Debug.Console(1, this,"Dialing meeting.Id: {0} Title: {1}", meeting.Id, meeting.Title);
SendText(string.Format("zCommand Dial Start meetingNumber: {0}", meeting.Id));
}
@@ -1774,16 +1776,37 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
public void CameraOff()
{
SendText("zConfiguration Call Camera Mute: On");
CameraMuteOn();
}
#endregion
public BoolFeedback CameraIsMutedFeedback { get; private set; }
public void CameraMuteOn()
{
SendText("zConfiguration Call Camera Mute: On");
}
public void CameraMuteOff()
{
SendText("zConfiguration Call Camera Mute: Off");
}
public void CameraMuteToggle()
{
if (CameraIsMutedFeedback.BoolValue)
CameraMuteOff();
else
CameraMuteOn();
}
#region Implementation of IHasCameraAutoMode
//Zoom doesn't support camera auto modes. Setting this to just unmute video
public void CameraAutoModeOn()
{
CameraMuteOff();
throw new NotImplementedException("Zoom Room Doesn't support camera auto mode");
}

View File

@@ -1,3 +1,3 @@
<packages>
<package id="PepperDashCore" version="1.0.44" targetFramework="net35" allowedVersions="[1.0,1.1)"/>
<package id="PepperDashCore" version="1.0.45" targetFramework="net35" allowedVersions="[1.0,1.1)"/>
</packages>