Compare commits

..

145 Commits

Author SHA1 Message Date
Neil Dorin
ed468add2c Refactored for source change handler updates 2019-11-08 12:30:49 -07:00
Neil Dorin
c22e95cad2 Added remaining methods for EssentialsDualDisplayRoom. Added IHasInCallFeedback interface to be applied to rooms with conferencing 2019-10-25 16:08:55 -06:00
Neil Dorin
59b2e9a8d6 Refactor complete 2019-10-24 11:28:13 -06:00
Neil Dorin
13132c29fc Mega refactor in progress 2019-10-23 22:29:04 -06:00
Neil Dorin
407a354cfe Merge remote-tracking branch 'origin/development' into feature/ecs-1116
# Conflicts:
#	PepperDashEssentials/Room/Config/EssentialsNDisplayRoomPropertiesConfig.cs
2019-10-17 15:46:40 -06:00
Neil Dorin
2fe1ac0e75 Merged in maintenance/pd-core-submodule (pull request #35)
Maintenance/pd core submodule

Approved-by: Neil Dorin <ndorin@pepperdash.com>
2019-10-17 15:53:13 +00:00
Neil Dorin
fcfec55b20 Removes PepperDash_Core.dll static reference and replaces it with submodule for pepperdashcore-builds 2019-10-16 15:58:14 -06:00
Neil Dorin
ae87498c0b Adds HDCP support for DM 8G+ input card types 2019-10-11 17:13:56 -06:00
Neil Dorin
5b05e8bb48 Adds config object for NDisplayRoom 2019-10-11 10:07:35 -06:00
Neil Dorin
96d48c9d56 Adds HDCP support for DMInput on 8G+ input cards (requires addtional config info on DmChassisController device config to tell if input cards support HDCP2 or not). 2019-10-09 15:55:59 -06:00
Neil Dorin
d21f6798fd Better handling for HdBaseT style TX units on non CPU3 DM Chassis 2019-10-09 12:32:58 -06:00
Neil Dorin
ac93081278 Merge remote-tracking branch 'origin/development' into bugfix/ecs-1168 2019-10-09 10:23:30 -06:00
Neil Dorin
690ba92773 Adds condition to DmChassisControllerBridge to use the endpoint online feedback from the input card when a basic HDBaseT transmitter is found. 2019-10-09 10:22:59 -06:00
Heath Volmer
115745467a Merged in feature/ecs-1162 (pull request #34)
ecs-1162: Messaging changes for Weil
2019-10-04 15:31:40 +00:00
Heath Volmer
0bb107f5ef ecs-1162: Messaging changes for Weil 2019-10-04 09:30:53 -06:00
Neil Dorin
3887a07d55 Fixed duplicate assignment statements 2019-09-26 11:31:03 -06:00
Neil Dorin
da832a7da1 Merged in bugfix/ecs-1160 (pull request #33)
Bugfix/ecs 1160

Approved-by: Neil Dorin <ndorin@pepperdash.com>
2019-09-17 18:32:14 +00:00
Neil Dorin
0e80c6f54d fixes output card HDMI port naming issue and type case sensitivity issue for two affected input card types. 2019-09-17 12:31:24 -06:00
Neil Dorin
c7b813447c Finished GlsOccupancySensorBaseControllerBridge to handle both single and dual technology sensors. 2019-09-17 11:12:00 -06:00
Neil Dorin
1257dde4ce Continued work on bridge 2019-09-16 16:36:24 -06:00
Neil Dorin
af7d97efef Updates to GlsOccupancySensorBaseController and created new GlsOdtOccupancySensorController. Added JoinMap class and started on bridge. 2019-09-16 16:20:03 -06:00
Neil Dorin
ce782c1cd3 Merged in maintenance/pr-3 (pull request #32)
Maintenance/pr 3

Approved-by: Neil Dorin <ndorin@pepperdash.com>
2019-09-11 22:35:27 +00:00
Neil Dorin
f93287641f Merge remote-tracking branch 'origin/feature/ecs-1154' into maintenance/pr-3 2019-09-11 16:33:30 -06:00
Neil Dorin
d2e9c2e238 Merge branch 'bugfix/ecs-1157' into maintenance/pr-3 2019-09-11 16:33:20 -06:00
Jason T Alborough
4b926c10f6 ECS-1158 Fixes issue where iBasicCommunicationBridge will toss an exception when it receives data. 2019-09-11 15:44:19 -04:00
Neil Dorin
7e9256187a corrects issues with VideoSyncStatus feedback 2019-09-11 13:16:23 -06:00
Neil Dorin
061d95e2b1 Moves IBridge condition to the top of the list to allow plugin bridges to override existing ones. 2019-09-09 16:13:25 -06:00
Neil Dorin
78fe799afc Updates all Bridge types to properly support custom join maps from config. Corrects issues in DisplayControllerBridge due to static properties outside of LinkToApi method. (ECS-1153) 2019-09-09 16:11:20 -06:00
Neil Dorin
596b8bf29a Merged in feature/ecs-1145 (pull request #31)
Feature/ecs 1145

Approved-by: Neil Dorin <ndorin@pepperdash.com>
2019-09-05 23:37:40 +00:00
Neil Dorin
87de4a4bf0 Documents all join maps and moves them to their own files for easier linking in Confluence documentation. 2019-09-05 17:36:08 -06:00
Neil Dorin
52343ddf7b Fixes value for name serial output to use name value from config instead of class name 2019-09-05 09:21:22 -06:00
Neil Dorin
854c2bcb6f Merged in feature/ecs-1148 (pull request #30)
Feature/ecs 1148

Approved-by: Neil Dorin <ndorin@pepperdash.com>
2019-09-04 20:33:23 +00:00
Neil Dorin
0b9ed462b4 Tested working onsite with Trevor Payne 2019-09-04 14:28:50 -06:00
Neil Dorin
4dafa34b2e Renamed file to match product SKU 2019-09-04 10:17:35 -06:00
Neil Dorin
f1611da74c Adds device support for HdMdxxxCE family of Tx/Rx pairs. 2019-09-03 16:43:07 -06:00
Neil Dorin
d588757eb6 Adds conditional statments in DmRmcHelper to construct the DM-RMC-100-S 2019-09-03 13:14:34 -06:00
Neil Dorin
5bb5c9e07f Commit before switching branches (no significant change 2019-09-03 13:09:13 -06:00
Neil Dorin
176c9d9835 Tested DmpsAudioOutputController and matching bridge on processor successfully 2019-08-29 17:34:19 -06:00
Neil Dorin
6726e989a7 Sets up actions and feedback for each level on a DMPS audio output 2019-08-29 14:04:21 -06:00
Neil Dorin
77fbee78a8 working on DmpsAudioOutputControllerBridge 2019-08-28 17:07:18 -06:00
Neil Dorin
172e2fb744 Adds feedbacks to DmpsAudioOutputController 2019-08-28 11:45:03 -06:00
Neil Dorin
f2b2825220 Merge remote-tracking branch 'origin/development' into feature/ecs-1127 2019-08-27 12:18:49 -06:00
Neil Dorin
1b832409e4 Merged in bugfix/ecs-1144 (pull request #29)
Addresses exceptions in DmTx401CController constructor

Approved-by: Neil Dorin <ndorin@pepperdash.com>
2019-08-26 21:35:32 +00:00
Neil Dorin
969ba3c87c Addresses exceptions in DmTx401CController constructor 2019-08-26 15:28:02 -06:00
Neil Dorin
d93a563cd8 Merged in feature/ecs-1140 (pull request #28)
Feature/ecs 1140

Approved-by: Neil Dorin <ndorin@pepperdash.com>
2019-08-16 05:29:06 +00:00
Neil Dorin
63f81456e8 Merge branch 'feature/ecs-1139' into feature/ecs-1140
# Conflicts:
#	PepperDashEssentials/Bridges/DmChassisControllerBridge.cs
#	essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs
2019-08-15 21:07:16 -06:00
Neil Dorin
764d8d2b48 Tested working with USB routing and SystemId setting on DmChassisController and DmChassisControllerBridge 2019-08-15 20:56:03 -06:00
Neil Dorin
1ae6069ac2 Adds USB routing to DmChassisController and DmChassisControllerBridge.
Major update to remove eRoutingSignalType.AudioVideo in favor of bitmasked values and adding UsbOutput and UsbInput types.  Updated all affected routing ports and ExecuteSwitch method calls.
Need to review and test routing to ensure bitwise operators are all correct.
2019-08-15 14:07:10 -06:00
Neil Dorin
7eccc82541 Adds HDCP Capability type values 2019-08-14 17:16:17 -06:00
Neil Dorin
b2dbd3c377 Built HDCP Capability feedbacks for input card HDMI ports 2019-08-14 16:48:15 -06:00
Neil Dorin
47e47ec272 Merged in bugfix/ecs-1138a (pull request #27)
Minor correction to EventId
2019-08-14 20:13:32 +00:00
Neil Dorin
c392ac6b06 Minor correction to EventId 2019-08-14 14:13:00 -06:00
Neil Dorin
af2fe7e54e Merged in bugfix/ecs-1138a (pull request #26)
Fixed EventIds for EndpointOnlineFeedback in DMInput/Output change handlers

Approved-by: Neil Dorin <ndorin@pepperdash.com>
2019-08-14 20:11:27 +00:00
Neil Dorin
3f68a84fe8 Fixed EventIds for EndpointOnlineFeedback in DMInput/Output change handlers 2019-08-14 14:09:11 -06:00
Neil Dorin
5d93a5177c Start adding HDCP state feedback collection 2019-08-14 13:46:28 -06:00
Neil Dorin
f83a7aecf2 Updates eventIds for EndpointOnlineFeedabck 2019-08-14 13:29:04 -06:00
Neil Dorin
6b21b37aef First attempt to address HDCP setting on input cards/TXs on DmChassisControllerBridge 2019-08-13 21:40:22 -06:00
Neil Dorin
b1459da2ba Merged in maintenance/ecs-1138 (pull request #25)
Fixes issue with missing DmpsAudioController.cs file

Approved-by: Neil Dorin <ndorin@pepperdash.com>
2019-08-01 20:03:48 +00:00
Neil Dorin
82e2f1e959 Fixes issue with missing DmpsAudioController.cs file 2019-08-01 14:03:01 -06:00
Neil Dorin
c329e31802 Merged in bugfix/ecs-1138 (pull request #24)
Attemtping to debug issue with EndpointOnlineFeedback on output cards

Approved-by: Neil Dorin <ndorin@pepperdash.com>
2019-08-01 19:52:27 +00:00
Neil Dorin
2b9615ad94 Adds devjson command 2019-08-01 13:47:18 -06:00
Neil Dorin
71098ca65d Adding DmpsAudioOutputController 2019-07-31 15:32:59 -06:00
Neil Dorin
b917ff980a Attemtping to debug issue with EndpointOnlineFeedback on output cards 2019-07-31 15:31:40 -06:00
Neil Dorin
c3c9c584ae Merged in feature/ecs-1125 (pull request #23)
Feature/ecs 1125

Approved-by: Neil Dorin <ndorin@pepperdash.com>
2019-07-30 20:24:25 +00:00
Neil Dorin
b6f6c72c92 Merge remote-tracking branch 'origin/development' into feature/ecs-1125
# Conflicts:
#	PepperDashEssentials/Bridges/DmChassisControllerBridge.cs
2019-07-30 14:24:02 -06:00
Neil Dorin
59b2995a1b Fixes exceptions in Eisc_SigChange by checking uo for null first. Then fixes issue where if output card is Card.Dmps3CodecOutput the NameFeedback property throws a null ref exception, even if you first check it for null. 2019-07-30 14:19:01 -06:00
Neil Dorin
bdf3e2054f Efforts to debug exceptions thrown on bridge string sigs 101-108 and 301-308 2019-07-29 16:32:39 -06:00
Neil Dorin
1acb3a20c5 Routing tested and working with EfS bridge 2019-07-26 16:53:52 -06:00
Neil Dorin
2c98fc4545 Merged in bugfix/ecs-1134 (pull request #22)
Switches to using input/output enpoint online feedback collections on chassis rather than IsOnline feedback from individual endpoints.

Approved-by: Neil Dorin <ndorin@pepperdash.com>
2019-07-25 16:13:35 +00:00
Neil Dorin
05c9dd3c69 Switches to using input/output enpoint online feedback collections on chassis rather than IsOnline feedback from individual endpoints. 2019-07-25 10:01:04 -06:00
Neil Dorin
5de8b703dd Adds attemps to hanlde output card types. 2019-07-25 09:54:06 -06:00
Neil Dorin
a3887510df Additional progress after initial testing. Having issues iterating CrestronControlSystem.SwitcherInputs/Outputs collections. 2019-07-24 22:44:39 -06:00
Neil Dorin
dc8d0e25d5 Adds Virtual Dm Tx Controller classes to handle Dmps inputs with mutliple connectors and auto switching. Completes DmpsRoutingController (requires testing) 2019-07-22 17:04:41 -06:00
Neil Dorin
028e411ffe Started DmpsRoutingController 2019-07-18 16:46:01 -06:00
Neil Dorin
5aed3c4480 Merged in bugfix/ecs-1131 (pull request #21)
Bugfix/ecs 1131

Approved-by: Neil Dorin <ndorin@pepperdash.com>
2019-07-18 20:16:48 +00:00
Neil Dorin
ddfd1d0586 Corrected case of dmTx to dmtx on dmtx200 2019-07-18 14:13:43 -06:00
Neil Dorin
77d5438063 Updates to script file 2019-07-12 11:37:16 -06:00
Neil Dorin
42a79f0e1e Merged in testing/jenkinsCI-1 (pull request #20)
Testing/jenkinsCI-1

Approved-by: Neil Dorin <ndorin@pepperdash.com>
2019-07-11 23:34:17 +00:00
Neil Dorin
f8a6ef8c41 Updated readme 2019-07-11 17:13:11 -06:00
Neil Dorin
af1489d511 reset revision number for assembly version to allow CI process to set it. 2019-07-11 16:35:36 -06:00
Neil Dorin
aa2b5b9ab4 Fixes double quotes in script 2019-07-11 12:26:56 -06:00
Neil Dorin
fd2fe8fa6e Comments out set-ExecutionPolicy RemoteSigned from script 2019-07-11 12:22:42 -06:00
Neil Dorin
15c6da43eb Adds PowerShell Script for updating assembly version number 2019-07-11 12:04:37 -06:00
Neil Dorin
6725266ad9 Set SGD files to copy to output directory 2019-07-10 12:01:11 -06:00
Neil Dorin
8f564a82d4 copies Crestron.SimplSharpPro.UI hint path from Essentials Core.csproj which works 2019-07-10 11:55:23 -06:00
Neil Dorin
6f6ff28784 Merged in maintenance/remove-essentials-framework-submodule (pull request #19)
Updates Assembly version to 1.4.12

Approved-by: Neil Dorin <ndorin@pepperdash.com>
2019-07-10 17:28:52 +00:00
Neil Dorin
0a0bfc018d Updates Assembly version to 1.4.12 2019-07-10 11:27:18 -06:00
Neil Dorin
bd5a69a83c Merged in maintenance/remove-essentials-framework-submodule (pull request #18)
Removes essentials-framework as a submodule and brings the files back into the main repo

Approved-by: Neil Dorin <ndorin@pepperdash.com>
2019-07-09 23:23:10 +00:00
Neil Dorin
48c6bb78bc Removes essentials-framework as a submodule and brings the files back into the main repo 2019-07-09 17:21:53 -06:00
Neil Dorin
2cd68d40dc Merged in feature/ecs-1123 (pull request #17)
Feature/ecs 1123

Approved-by: Neil Dorin <ndorin@pepperdash.com>
2019-07-09 22:53:53 +00:00
Neil Dorin
43281f0db6 Merge remote-tracking branch 'origin/bugfix/weil20190610' into feature/ecs-1123
# Conflicts:
#	PepperDashEssentials/ControlSystem.cs
#	PepperDashEssentials/Properties/AssemblyInfo.cs
2019-07-09 16:52:23 -06:00
Neil Dorin
fa141c6207 Merge remote-tracking branch 'origin/maintenance/KPMG' into feature/ecs-1123
# Conflicts:
#	PepperDashEssentials/Bridges/BridgeBase.cs
#	PepperDashEssentials/ControlSystem.cs
2019-07-09 16:49:37 -06:00
Neil Dorin
07d6fcef1c Merge branch 'feature/ecs-1079' into feature/ecs-1123 2019-07-09 16:38:51 -06:00
Neil Dorin
a5ea9bb1eb Merge branch 'feature/ecs-1120' into feature/ecs-1123 2019-07-09 16:38:09 -06:00
Neil Dorin
90c122d966 Committing framework submodule before removing submodule reference 2019-07-09 16:30:50 -06:00
Neil Dorin
634b07dc12 Adds AppleTvBridge. Untested so far. 2019-07-03 15:28:34 -06:00
Neil Dorin
699900518a Moved CrestronTouchpanelPropertiesConfig down to Essentials.Core so that the DgeController can use it from Essentials.DM. Modified EssentialsTouchpanelController to be able to use a dge100 as a panel. Added UiDeviceFactory condition to build dge100/dmdge200c 2019-06-30 10:58:11 -06:00
Neil Dorin
ea2d573ab3 Started on DgeController 2019-06-28 08:20:06 -06:00
Neil Dorin
5c923e66ec Adds necessary framework commit 2019-06-27 14:21:48 -06:00
Neil Dorin
7958c64e67 Adds support for AirMediaControllerBridge 2019-06-27 14:21:09 -06:00
Neil Dorin
410ffd2f19 Assembly Version incremented to 1.4.11. Fixes issues with DisplayControllerBridge join mapping. Adds volume controls and ensures all input selection joins start at joinstart + 10. 2019-06-26 12:56:53 -06:00
Neil Dorin
53e0599e2a Resolves ecs-1117. Tested at Einstein 2019-06-25 13:43:21 -06:00
Neil Dorin
af12a81c00 Updates DisplayControllerBridge to support BasicIrDisplay types, adds Samsung IR driver file, updates SetupFileSystem in ControlSystem.cs to build plugin folder 2019-06-24 15:16:20 -06:00
Jason T Alborough
2a9e7c81eb Merge branch 'JAG-Add_IBridge' into JTA/KPMG
# Conflicts:
#	essentials-framework
2019-06-24 15:51:58 -04:00
Neil Dorin
c15adea02e Updates assembly version to include bugfix for ecs-1115 2019-06-21 11:17:55 -06:00
Neil Dorin
935f2c4bf4 Increments Assembly version and includes bugfix to set DmChassisController.EnableAudioBreakaway.BoolValue to true. 2019-06-20 15:25:13 -06:00
Joshua Gutenplan
327a9a5f6b Update compile to include pdc feature/MultipleServerUpdates 2019-06-18 16:56:51 -07:00
Neil Dorin
b7ed1d8238 Updates Assembly version number to 1.4.7 2019-06-18 14:04:00 -06:00
Joshua Gutenplan
aff4e5a61f update core ref 2019-06-14 19:18:50 -07:00
Joshua Gutenplan
fe172098b9 updated core 2019-06-14 15:50:21 -07:00
Joshua Gutenplan
f2c2cd423d Remove the crestron invoke from the eisc change event. Not good as it could spool a lot of threads 2019-06-14 15:23:05 -07:00
Joshua Gutenplan
22722fca21 update core ref to add PDC-14 and 15 features for testing kpmg 2019-06-13 20:06:43 -07:00
Joshua Gutenplan
6efec400b8 add invoke to bridgeapieisc 2019-06-13 20:05:38 -07:00
Joshua Gutenplan
f82816729b DID Not commit separately but also made bridge eisc uo actions use a threadpool thread. Fix the load plugin to load dlls before calling the load plugin method. Also added capability to place a cplz and unzip and load. The crestron dlls will throw exceptions so catching them and printing to console if debug is enabled to hide the messages from log and user as they can look like a problem when they are not. IMPORTANT we may need to add some logic to deal with multiple cplz's unzipping as the files will auto overwrite. See JIRA ticket ECS-1113 2019-06-13 19:44:14 -07:00
Neil Dorin
1b599ff863 Updated Assembly version to 1.4.6 2019-06-11 22:10:46 -06:00
Neil Dorin
ae23e48fd0 Resolves issue with GenericRelay factory not returning device if portDeviceKey maps to a device that is not of type CrestronControlSystem 2019-06-11 22:09:20 -06:00
Neil Dorin
a8f1f77d48 Adds README.md with basic process instructions for repo maintenance cycle 2019-06-11 11:58:57 -06:00
Heath Volmer
68064c7194 Various fixes 2019-06-11 10:15:38 -06:00
Heath Volmer
3ceecd3fbe Modified volumes format; added config for VC cameras and recents 2019-06-10 11:59:09 -06:00
Heath Volmer
8585977f71 ECS-1108, ECS-1109. Added construction for endpoints on CPU3 chassis 2019-06-06 15:51:17 -06:00
Heath Volmer
288c9bb04c Added ALL 8x8 - 32x32 chassis varieties 2019-06-06 11:31:17 -06:00
Joshua Gutenplan
47fb805766 Added IBridge to make it easier to deal with calling the linkToApi method. Added as an else if in EiscApI to ensure backwards compatibility. 2019-05-28 19:25:18 -07:00
Neil Dorin
31b0683cdf Merged in feature/ecs-1079 (pull request #13)
Feature/ecs 1079

Approved-by: Neil Dorin <ndorin@pepperdash.com>
2019-05-23 22:21:11 +00:00
Neil Dorin
04194da31c Merge remote-tracking branch 'origin/development' into HEAD 2019-05-23 16:18:22 -06:00
Heath Volmer
09bdc49c15 Merged in feature/heath-shades (pull request #12)
esc-1103: Plugins - (heath shades)
2019-05-22 15:33:24 +00:00
Heath Volmer
e36b2b97d2 Merge fixup 2019-05-22 09:32:48 -06:00
Heath Volmer
d705525a45 Framework at development after merges 2019-05-22 09:27:17 -06:00
Heath Volmer
ecce6e2be9 Framework... 2019-05-21 15:26:43 -06:00
Heath Volmer
95c0f57000 Plugin loading! 2019-05-21 13:58:57 -06:00
Heath Volmer
697b9109a3 Modifications to plugin load and factories 2019-05-17 09:14:18 -06:00
Heath Volmer
727367c061 Changes for PoC plugin loading... 2019-05-16 17:29:38 -06:00
Heath Volmer
f26ff0b767 Merge branch 'feature/mob-506' into feature/heath-shades 2019-05-16 13:01:47 -06:00
Heath Volmer
44b72dcfe5 Volume control fix 2019-05-16 13:00:48 -06:00
Jason Alborough
937f3f3dc0 # ECS-1079_AddDisplayControlBridge
- Adds in the Essentials Framework commit which includes an required feature feature/ECS-1080 AddIsOnlineFBtoStatusMonitor
2019-05-03 16:05:36 -04:00
Jason Alborough
17bf6e3f0a # ECS-1079_AddDisplayControlBridge
- Adds DisplayController Eisc Bride for a TwoWayDispalyDevice
2019-05-03 12:51:12 -04:00
Neil Dorin
e7253b4acc Merged in bugfix/ecs-1062 (pull request #8)
Bugfix/ecs 1062

Approved-by: Neil Dorin <ndorin@pepperdash.com>
2019-04-02 22:19:37 +00:00
Neil Dorin
71a27027e7 Updates framework commit to development branch 2019-04-02 16:04:46 -06:00
Neil Dorin
2655b8f7b8 Resolves issue with HuddleVtc1Room adding Emergency device in CustomActivate() which would throw an exception in DeviceManager.ActivateAll() when attempting to iterate the modified devices dictionary 2019-04-02 15:58:12 -06:00
Neil Dorin
3adee8bc30 Resolves ecs-1042 2019-03-18 11:25:46 -06:00
Neil Dorin
e3a3a2cd2d Attempting to resolve exception in CotijaSystemController when SystemMonitor tries to notify AppServer of program start before WSClient is *really* connected. 2019-03-15 14:42:47 -06:00
Neil Dorin
6235b44d89 Updates to delete any existing archived configs during update process to prevent name conflicts 2019-03-15 12:16:01 -06:00
Neil Dorin
90bbd65fdc Add lastest essentials framework 2019-03-14 10:41:07 -06:00
Neil Dorin
43fd263ea1 Config Update Working 2019-03-13 16:33:51 -06:00
Neil Dorin
038e23289e Adds inital ConfigMessenger 2019-03-12 11:08:32 -06:00
Heath Volmer
47675f12b4 Added CsmQmtdc2504CnController, incomplete 2018-11-26 09:03:23 -07:00
454 changed files with 62308 additions and 2624 deletions

3
.gitignore vendored
View File

@@ -20,4 +20,5 @@ obj/
[Rr]elease*/
_ReSharper*/
SIMPLSharpLogs/
*.projectinfo
*.projectinfo
essentials-framework/EssentialDMTestConfig/

7
.gitmodules vendored
View File

@@ -1,3 +1,4 @@
[submodule "essentials-framework"]
path = essentials-framework
url = https://bitbucket.org/Pepperdash_Products/essentials-framework.git
[submodule "essentials-framework/pepperdashcore-builds"]
path = essentials-framework/pepperdashcore-builds
url = https://ndorin@bitbucket.org/Pepperdash_Products/pepperdashcore-builds.git
branch = development

Binary file not shown.

View File

@@ -1,49 +1,49 @@
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PepperDashEssentials", ".\PepperDashEssentials\PepperDashEssentials.csproj", "{1BED5BA9-88C4-4365-9362-6F4B128071D3}"
ProjectSection(ProjectDependencies) = postProject
{892B761C-E479-44CE-BD74-243E9214AF13} = {892B761C-E479-44CE-BD74-243E9214AF13}
{9199CE8A-0C9F-4952-8672-3EED798B284F} = {9199CE8A-0C9F-4952-8672-3EED798B284F}
{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5} = {A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PepperDash_Essentials_Core", ".\essentials-framework\Essentials Core\PepperDashEssentialsBase\PepperDash_Essentials_Core.csproj", "{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Essentials Devices Common", ".\essentials-framework\Essentials Devices Common\Essentials Devices Common\Essentials Devices Common.csproj", "{892B761C-E479-44CE-BD74-243E9214AF13}"
ProjectSection(ProjectDependencies) = postProject
{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5} = {A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Essentials_DM", ".\essentials-framework\Essentials DM\Essentials_DM\Essentials_DM.csproj", "{9199CE8A-0C9F-4952-8672-3EED798B284F}"
ProjectSection(ProjectDependencies) = postProject
{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5} = {A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1BED5BA9-88C4-4365-9362-6F4B128071D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1BED5BA9-88C4-4365-9362-6F4B128071D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1BED5BA9-88C4-4365-9362-6F4B128071D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1BED5BA9-88C4-4365-9362-6F4B128071D3}.Release|Any CPU.Build.0 = Release|Any CPU
{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}.Release|Any CPU.Build.0 = Release|Any CPU
{892B761C-E479-44CE-BD74-243E9214AF13}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{892B761C-E479-44CE-BD74-243E9214AF13}.Debug|Any CPU.Build.0 = Debug|Any CPU
{892B761C-E479-44CE-BD74-243E9214AF13}.Release|Any CPU.ActiveCfg = Release|Any CPU
{892B761C-E479-44CE-BD74-243E9214AF13}.Release|Any CPU.Build.0 = Release|Any CPU
{9199CE8A-0C9F-4952-8672-3EED798B284F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9199CE8A-0C9F-4952-8672-3EED798B284F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9199CE8A-0C9F-4952-8672-3EED798B284F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9199CE8A-0C9F-4952-8672-3EED798B284F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PepperDashEssentials", ".\PepperDashEssentials\PepperDashEssentials.csproj", "{1BED5BA9-88C4-4365-9362-6F4B128071D3}"
ProjectSection(ProjectDependencies) = postProject
{892B761C-E479-44CE-BD74-243E9214AF13} = {892B761C-E479-44CE-BD74-243E9214AF13}
{9199CE8A-0C9F-4952-8672-3EED798B284F} = {9199CE8A-0C9F-4952-8672-3EED798B284F}
{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5} = {A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PepperDash_Essentials_Core", ".\essentials-framework\Essentials Core\PepperDashEssentialsBase\PepperDash_Essentials_Core.csproj", "{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Essentials Devices Common", ".\essentials-framework\Essentials Devices Common\Essentials Devices Common\Essentials Devices Common.csproj", "{892B761C-E479-44CE-BD74-243E9214AF13}"
ProjectSection(ProjectDependencies) = postProject
{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5} = {A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Essentials_DM", ".\essentials-framework\Essentials DM\Essentials_DM\Essentials_DM.csproj", "{9199CE8A-0C9F-4952-8672-3EED798B284F}"
ProjectSection(ProjectDependencies) = postProject
{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5} = {A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1BED5BA9-88C4-4365-9362-6F4B128071D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1BED5BA9-88C4-4365-9362-6F4B128071D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1BED5BA9-88C4-4365-9362-6F4B128071D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1BED5BA9-88C4-4365-9362-6F4B128071D3}.Release|Any CPU.Build.0 = Release|Any CPU
{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}.Release|Any CPU.Build.0 = Release|Any CPU
{892B761C-E479-44CE-BD74-243E9214AF13}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{892B761C-E479-44CE-BD74-243E9214AF13}.Debug|Any CPU.Build.0 = Debug|Any CPU
{892B761C-E479-44CE-BD74-243E9214AF13}.Release|Any CPU.ActiveCfg = Release|Any CPU
{892B761C-E479-44CE-BD74-243E9214AF13}.Release|Any CPU.Build.0 = Release|Any CPU
{9199CE8A-0C9F-4952-8672-3EED798B284F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9199CE8A-0C9F-4952-8672-3EED798B284F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9199CE8A-0C9F-4952-8672-3EED798B284F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9199CE8A-0C9F-4952-8672-3EED798B284F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -17,6 +17,7 @@ using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Room.Cotija;
using PepperDash.Essentials.AppServer.Messengers;
namespace PepperDash.Essentials
{
@@ -39,6 +40,8 @@ namespace PepperDash.Essentials
Dictionary<string, CTimer> PushedActions = new Dictionary<string, CTimer>();
public ConfigMessenger ConfigMessenger { get; private set; }
CTimer ServerHeartbeatCheckTimer;
long ServerHeartbeatInterval = 20000;
@@ -49,7 +52,7 @@ namespace PepperDash.Essentials
DateTime LastAckMessage;
string SystemUuid;
public string SystemUuid;
List<CotijaBridgeBase> RoomBridges = new List<CotijaBridgeBase>();
@@ -97,9 +100,15 @@ namespace PepperDash.Essentials
CrestronConsole.AddNewConsoleCommand(s => CleanUpWebsocketClient(), "mobiledisco",
"Disconnects websocket", ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(s => ParseStreamRx(s), "mobilesimulateaction", "Simulates a message from the server", ConsoleAccessLevelEnum.AccessOperator);
CrestronEnvironment.ProgramStatusEventHandler += new ProgramStatusEventHandler(CrestronEnvironment_ProgramStatusEventHandler);
CrestronEnvironment.EthernetEventHandler += new EthernetEventHandler(CrestronEnvironment_EthernetEventHandler);
// Config Messenger
var cmKey = Key + "-config";
ConfigMessenger = new ConfigMessenger(cmKey, "/config");
ConfigMessenger.RegisterWithAppServer(this);
}
/// <summary>
@@ -452,9 +461,9 @@ namespace PepperDash.Essentials
Debug.Console(1, this, "Socket send result error: {0}", result);
}
}
else if (!WSClient.Connected)
else if (WSClient == null)
{
Debug.Console(1, this, "Cannot send. Not connected {0}");
Debug.Console(1, this, "Cannot send. Not connected.");
}
}
@@ -670,13 +679,14 @@ namespace PepperDash.Essentials
if(string.IsNullOrEmpty(message))
return;
if (!message.Contains("/system/heartbeat"))
Debug.Console(1, this, "Message RX: {0}", message);
else
{
LastAckMessage = DateTime.Now;
//Debug.Console(1, this, "RX message contains /system/heartbeat");
}
if (!message.Contains("/system/heartbeat"))
{
Debug.Console(1, this, "Message RX: {0}", message);
}
else
{
LastAckMessage = DateTime.Now;
}
try
{
@@ -693,6 +703,11 @@ namespace PepperDash.Essentials
{
HandleHeartBeat(messageObj["content"]);
}
else if (type == "raw")
{
var wrapper = messageObj["content"].ToObject<DeviceActionWrapper>();
DeviceJsonApi.DoDeviceAction(wrapper);
}
else if (type == "close")
{
Debug.Console(1, this, "Received close message from server.");

View File

@@ -19,42 +19,3 @@ namespace PepperDash.Essentials.Room.Cotija
}
}
namespace PepperDash.Essentials
{
/// <summary>
/// For rooms with a single presentation source, change event
/// </summary>
public interface IHasCurrentSourceInfoChange
{
string CurrentSourceInfoKey { get; }
SourceListItem CurrentSourceInfo { get; }
event SourceInfoChangeHandler CurrentSingleSourceChange;
}
/// <summary>
/// For rooms with routing
/// </summary>
public interface IRunRouteAction
{
void RunRouteAction(string routeKey);
void RunRouteAction(string routeKey, Action successCallback);
}
/// <summary>
/// For rooms that default presentation only routing
/// </summary>
public interface IRunDefaultPresentRoute
{
bool RunDefaultPresentRoute();
}
/// <summary>
/// For rooms that have default presentation and calling routes
/// </summary>
public interface IRunDefaultCallRoute : IRunDefaultPresentRoute
{
bool RunDefaultCallRoute();
}
}

View File

@@ -0,0 +1,75 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Core;
using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.AppServer.Messengers
{
/// <summary>
/// Handles interactions with the app server to update the config
/// </summary>
public class ConfigMessenger : MessengerBase
{
public ConfigMessenger(string key, string messagePath)
: base(key, messagePath)
{
ConfigUpdater.ConfigStatusChanged -= ConfigUpdater_ConfigStatusChanged;
ConfigUpdater.ConfigStatusChanged += new EventHandler<ConfigStatusEventArgs>(ConfigUpdater_ConfigStatusChanged);
}
void ConfigUpdater_ConfigStatusChanged(object sender, ConfigStatusEventArgs e)
{
PostUpdateStatus(e.UpdateStatus.ToString());
}
protected override void CustomRegisterWithAppServer(CotijaSystemController appServerController)
{
appServerController.AddAction(MessagePath + "/updateConfig", new Action<string>(s => GetConfigFile(s)));
}
/// <summary>
/// Generates or passes the URL to make the request to GET the config from a server
/// </summary>
/// <param name="url"></param>
void GetConfigFile(string url)
{
try
{
// Attempt to parse the URL
var parser = new Crestron.SimplSharp.Net.Http.UrlParser(url);
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Successfully parsed URL from AppServer message: {0}", parser.Url);
}
catch (Exception e)
{
// If unable to parse the URL, generate it from config data
Debug.Console(2, "Error parsing URL: {0}", e);
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Unable to parse URL from AppServer message. Generating URL from config data");
url = string.Format("http://{0}/api/system/{1}/config", AppServerController.Config.ServerUrl, AppServerController.SystemUuid);
}
ConfigUpdater.GetConfigFromServer(url);
}
/// <summary>
/// Posts a message with the current status of the config update
/// </summary>
/// <param name="status"></param>
void PostUpdateStatus(string status)
{
PostStatusMessage(new
{
updateStatus = status
});
}
}
}

View File

@@ -19,7 +19,8 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// <summary>
/// 221
/// </summary>
const uint BDialHangup = 221;
const uint BDialHangupOnHook = 221;
/// <summary>
/// 251
/// </summary>
@@ -134,7 +135,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
{
CurrentCallItem.Status = (eCodecCallStatus)Enum.Parse(typeof(eCodecCallStatus), s, true);
//GetCurrentCallList();
SendCallsList();
SendFullStatus();
});
EISC.SetStringSigAction(SCurrentCallNumber, s =>
@@ -162,7 +163,8 @@ namespace PepperDash.Essentials.AppServer.Messengers
// Add straight pulse calls
Action<string, uint> addAction = (s, u) =>
AppServerController.AddAction(MessagePath + s, new Action(() => EISC.PulseBool(u, 100)));
addAction("/endCallById", BDialHangup);
addAction("/endCallById", BDialHangupOnHook);
addAction("/endAllCalls", BDialHangupOnHook);
addAction("/acceptById", BIncomingAnswer);
addAction("/rejectById", BIncomingReject);
addAction("/speedDial1", BSpeedDial1);

View File

@@ -123,6 +123,23 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// </summary>
const uint BCameraModeOff = 833;
/// <summary>
/// 841
/// </summary>
const uint BCameraSelfView = 841;
/// <summary>
/// 842
/// </summary>
const uint BCameraLayout = 842;
/// <summary>
/// 843
/// </summary>
const uint BCameraSupportsAutoMode = 843;
/// <summary>
/// 844
/// </summary>
const uint BCameraSupportsOffMode = 844;
/********* Ushorts *********/
@@ -285,6 +302,21 @@ namespace PepperDash.Essentials.AppServer.Messengers
PostCallsList();
});
EISC.SetBoolSigAction(BCameraSupportsAutoMode, b =>
{
PostStatusMessage(new
{
cameraSupportsAutoMode = b
});
});
EISC.SetBoolSigAction(BCameraSupportsOffMode, b =>
{
PostStatusMessage(new
{
cameraSupportsOffMode = b
});
});
// Directory insanity
EISC.SetUShortSigAction(UDirectoryRowCount, u =>
{
@@ -330,6 +362,11 @@ namespace PepperDash.Essentials.AppServer.Messengers
EISC.SetSigTrueAction(BCameraModeManual, () => PostCameraMode());
EISC.SetSigTrueAction(BCameraModeOff, () => PostCameraMode());
EISC.SetBoolSigAction(BCameraSelfView, b => PostStatusMessage(new
{
cameraSelfView = b
}));
EISC.SetUShortSigAction(UCameraNumberSelect, (u) => PostSelectedCamera());
@@ -347,6 +384,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
Action<string, uint> addAction = (s, u) =>
AppServerController.AddAction(MessagePath + s, new Action(() => EISC.PulseBool(u, 100)));
addAction("/endCallById", BDialHangup);
addAction("/endAllCalls", BDialHangup);
addAction("/acceptById", BIncomingAnswer);
addAction("/rejectById", BIncomingReject);
addAction("/speedDial1", BSpeedDial1);
@@ -356,6 +394,8 @@ namespace PepperDash.Essentials.AppServer.Messengers
addAction("/cameraModeAuto", BCameraModeAuto);
addAction("/cameraModeManual", BCameraModeManual);
addAction("/cameraModeOff", BCameraModeOff);
addAction("/cameraSelfView", BCameraSelfView);
addAction("/cameraLayout", BCameraLayout);
asc.AddAction("/cameraSelect", new Action<string>(SelectCamera));
@@ -437,6 +477,9 @@ namespace PepperDash.Essentials.AppServer.Messengers
{
calls = GetCurrentCallList(),
cameraMode = GetCameraMode(),
cameraSelfView = EISC.GetBool(BCameraSelfView),
cameraSupportsAutoMode = EISC.GetBool(BCameraSupportsAutoMode),
cameraSupportsOffMode = EISC.GetBool(BCameraSupportsOffMode),
currentCallString = EISC.GetString(SCurrentCallNumber),
currentDialString = EISC.GetString(SCurrentDialString),
directoryContactSelected = new
@@ -448,8 +491,9 @@ namespace PepperDash.Essentials.AppServer.Messengers
isInCall = EISC.GetString(SHookState) == "Connected",
hasDirectory = true,
hasDirectorySearch = false,
hasRecents = true,
hasRecents = !EISC.BooleanOutput[502].BoolValue,
hasCameras = true,
showCamerasWhenNotInCall = EISC.BooleanOutput[503].BoolValue,
selectedCamera = GetSelectedCamera(),
});
}

View File

@@ -40,8 +40,11 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// <param name="e"></param>
void ProgramInfoChanged(object sender, ProgramInfoEventArgs e)
{
Debug.Console(1, "Posting Status Message: {0}", e.ProgramInfo.ToString());
PostStatusMessage(e.ProgramInfo);
if (e.ProgramInfo != null)
{
//Debug.Console(1, "Posting Status Message: {0}", e.ProgramInfo.ToString());
PostStatusMessage(e.ProgramInfo);
}
}
/// <summary>

View File

@@ -8,6 +8,7 @@ using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Essentials.Devices.Common.Codec;
using PepperDash.Essentials.Devices.Common.Cameras;
using PepperDash.Essentials.Devices.Common.VideoCodec;
namespace PepperDash.Essentials.AppServer.Messengers
@@ -365,7 +366,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
hasDirectory = Codec is IHasDirectory,
hasDirectorySearch = true,
hasRecents = Codec is IHasCallHistory,
hasCameras = Codec is IHasCameraControl
hasCameras = Codec is IHasCodecCameras
});
}
}

View File

@@ -27,6 +27,11 @@ namespace PepperDash.Essentials.Room.Cotija
/// </summary>
public const uint RoomIsOn = 301;
/// <summary>
/// 12
/// </summary>
public const uint PrivacyMute = 12;
/// <summary>
/// 41
/// </summary>
@@ -38,15 +43,15 @@ namespace PepperDash.Essentials.Room.Cotija
/// <summary>
/// 51
/// </summary>
public const uint ActivitySharePress = 51;
public const uint ActivityShare = 51;
/// <summary>
/// 52
/// </summary>
public const uint ActivityPhoneCallPress = 52;
public const uint ActivityPhoneCall = 52;
/// <summary>
/// 53
/// </summary>
public const uint ActivityVideoCallPress = 53;
public const uint ActivityVideoCall = 53;
/// <summary>
/// 1
@@ -76,6 +81,7 @@ namespace PepperDash.Essentials.Room.Cotija
/// 72
/// </summary>
public const uint SourceHasChanged = 71;
/// <summary>
/// 261 - The start of the range of speed dial visibles
/// </summary>
@@ -85,9 +91,25 @@ namespace PepperDash.Essentials.Room.Cotija
/// </summary>
public const uint ConfigIsReady = 501;
/// <summary>
/// 502
/// </summary>
public const uint HideVideoConfRecents = 502;
/// <summary>
/// 503
/// </summary>
public const uint ShowCameraWhenNotInCall = 503;
/// <summary>
/// 504
/// </summary>
public const uint UseSourceEnabled = 504;
/// <summary>
/// 601
/// </summary>
public const uint SourceShareDisableStartJoin = 601;
public const uint SourceShareDisableJoinStart = 601;
/// <summary>
/// 621
/// </summary>
public const uint SourceIsEnabledJoinStart = 621;
}
@@ -108,7 +130,7 @@ namespace PepperDash.Essentials.Room.Cotija
/// <summary>
/// 101
/// </summary>
public const uint VolumeSliderCount = 101;
public const uint NumberOfAuxFaders = 101;
}
public class StringJoin
@@ -319,16 +341,30 @@ namespace PepperDash.Essentials.Room.Cotija
}));
Parent.AddAction(@"/room/room1/defaultsource", new Action(() =>
EISC.PulseBool(BoolJoin.ActivitySharePress)));
Parent.AddAction(@"/room/room1/activityVideo", new Action(() =>
EISC.PulseBool(BoolJoin.ActivityVideoCallPress)));
EISC.PulseBool(BoolJoin.ActivityShare)));
Parent.AddAction(@"/room/room1/activityPhone", new Action(() =>
EISC.PulseBool(BoolJoin.ActivityPhoneCallPress)));
EISC.PulseBool(BoolJoin.ActivityPhoneCall)));
Parent.AddAction(@"/room/room1/activityVideo", new Action(() =>
EISC.PulseBool(BoolJoin.ActivityVideoCall)));
Parent.AddAction(@"/room/room1/volumes/master/level", new Action<ushort>(u =>
EISC.SetUshort(UshortJoin.MasterVolumeLevel, u)));
Parent.AddAction(@"/room/room1/volumes/master/muteToggle", new Action(() =>
EISC.PulseBool(BoolJoin.MasterVolumeIsMuted)));
Parent.AddAction(@"/room/room1/volumes/master/privacyMuteToggle", new Action(() =>
EISC.PulseBool(BoolJoin.PrivacyMute)));
// /xyzxyz/volumes/master/muteToggle ---> BoolInput[1]
for (uint i = 2; i <= 7; i++)
{
var index = i;
Parent.AddAction(string.Format(@"/room/room1/volumes/level-{0}/level", index), new Action<ushort>(u =>
EISC.SetUshort(index, u)));
Parent.AddAction(string.Format(@"/room/room1/volumes/level-{0}/muteToggle", index), new Action(() =>
EISC.PulseBool(index)));
}
Parent.AddAction(@"/room/room1/shutdownStart", new Action(() =>
EISC.PulseBool(BoolJoin.ShutdownStart)));
@@ -388,6 +424,9 @@ namespace PepperDash.Essentials.Room.Cotija
}
}));
// map MasterVolumeIsMuted join -> status/volumes/master/muted
//
EISC.SetBoolSigAction(BoolJoin.MasterVolumeIsMuted, b =>
PostStatusMessage(new
{
@@ -399,7 +438,55 @@ namespace PepperDash.Essentials.Room.Cotija
}
}
}));
EISC.SetBoolSigAction(BoolJoin.PrivacyMute, b =>
PostStatusMessage(new
{
volumes = new
{
master = new
{
privacyMuted = b
}
}
}));
for (uint i = 2; i <= 7; i++)
{
var index = i; // local scope for lambdas
EISC.SetUShortSigAction(index, u => // start at join 2
{
// need a dict in order to create the level-n property on auxFaders
var dict = new Dictionary<string, object>();
dict.Add("level-" + index, new { level = u });
PostStatusMessage(new
{
volumes = new
{
auxFaders = dict,
}
});
});
EISC.SetBoolSigAction(index, b =>
{
// need a dict in order to create the level-n property on auxFaders
var dict = new Dictionary<string, object>();
dict.Add("level-" + index, new { muted = b });
PostStatusMessage(new
{
volumes = new
{
auxFaders = dict,
}
});
});
}
EISC.SetUShortSigAction(UshortJoin.NumberOfAuxFaders, u =>
PostStatusMessage(new {
volumes = new {
numberOfAuxFaders = u,
}
}));
// shutdown things
EISC.SetSigTrueAction(BoolJoin.ShutdownCancel, new Action(() =>
@@ -421,6 +508,23 @@ namespace PepperDash.Essentials.Room.Cotija
// Config things
EISC.SetSigTrueAction(BoolJoin.ConfigIsReady, LoadConfigValues);
// Activity modes
EISC.SetSigTrueAction(BoolJoin.ActivityShare, () => UpdateActivity(1));
EISC.SetSigTrueAction(BoolJoin.ActivityPhoneCall, () => UpdateActivity(2));
EISC.SetSigTrueAction(BoolJoin.ActivityVideoCall, () => UpdateActivity(3));
}
/// <summary>
/// Updates activity states
/// </summary>
void UpdateActivity(int mode)
{
PostStatusMessage(new
{
activityMode = mode,
});
}
/// <summary>
@@ -471,24 +575,13 @@ namespace PepperDash.Essentials.Room.Cotija
rmProps.RoomPhoneNumber = EISC.StringOutput[StringJoin.ConfigRoomPhoneNumber].StringValue;
rmProps.RoomURI = EISC.StringOutput[StringJoin.ConfigRoomURI].StringValue;
rmProps.SpeedDials = new List<DDVC01SpeedDial>();
// add speed dials as long as there are more - up to 4
#warning fix speed dials - 512-515 names, 516-519 numbers
for (uint i = 512; i <= 519; i = i + 2)
{
var num = EISC.StringOutput[i].StringValue;
if (string.IsNullOrEmpty(num))
break;
var name = EISC.StringOutput[i + 1].StringValue;
rmProps.SpeedDials.Add(new DDVC01SpeedDial { Number = num, Name = name});
}
// This MAY need a check
rmProps.AudioCodecKey = "audioCodec";
rmProps.VideoCodecKey = "videoCodec";
// volume control names
var volCount = EISC.UShortOutput[UshortJoin.VolumeSliderCount].UShortValue;
var volCount = EISC.UShortOutput[UshortJoin.NumberOfAuxFaders].UShortValue;
//// use Volumes object or?
//rmProps.VolumeSliderNames = new List<string>();
@@ -534,12 +627,17 @@ namespace PepperDash.Essentials.Room.Cotija
for (uint i = 0; i <= 19; i++)
{
var name = EISC.StringOutput[StringJoin.SourceNameJoinStart + i].StringValue;
if(string.IsNullOrEmpty(name))
if (EISC.BooleanOutput[BoolJoin.UseSourceEnabled].BoolValue
&& !EISC.BooleanOutput[BoolJoin.SourceIsEnabledJoinStart + i].BoolValue)
{
continue;
}
else if(!EISC.BooleanOutput[BoolJoin.UseSourceEnabled].BoolValue && string.IsNullOrEmpty(name))
break;
var icon = EISC.StringOutput[StringJoin.SourceIconJoinStart + i].StringValue;
var key = EISC.StringOutput[StringJoin.SourceKeyJoinStart + i].StringValue;
var type = EISC.StringOutput[StringJoin.SourceTypeJoinStart + i].StringValue;
var disableShare = EISC.BooleanOutput[BoolJoin.SourceShareDisableStartJoin + i].BoolValue;
var disableShare = EISC.BooleanOutput[BoolJoin.SourceShareDisableJoinStart + i].BoolValue;
Debug.Console(0, this, "Adding source {0} '{1}'", key, name);
var newSLI = new SourceListItem{
@@ -575,7 +673,7 @@ namespace PepperDash.Essentials.Room.Cotija
co.SourceLists.Add("default", newSl);
// build "audioCodec" config if we need
// Build "audioCodec" config if we need
if (!string.IsNullOrEmpty(rmProps.AudioCodecKey))
{
var acFavs = new List<PepperDash.Essentials.Devices.Common.Codec.CodecActiveCallItem>();
@@ -610,25 +708,11 @@ namespace PepperDash.Essentials.Room.Cotija
co.Devices.Add(acConf);
}
// Build Video codec config
if (!string.IsNullOrEmpty(rmProps.VideoCodecKey))
{
#warning Break out these video codec favs
// No favorites, for now?
var favs = new List<PepperDash.Essentials.Devices.Common.Codec.CodecActiveCallItem>();
for (uint i = 0; i < 4; i++)
{
if (!EISC.GetBool(BoolJoin.SpeedDialVisibleStartJoin + i))
{
break;
}
favs.Add(new PepperDash.Essentials.Devices.Common.Codec.CodecActiveCallItem()
{
Name = EISC.GetString(StringJoin.SpeedDialNameStartJoin + i),
Number = EISC.GetString(StringJoin.SpeedDialNumberStartJoin + i),
Type = PepperDash.Essentials.Devices.Common.Codec.eCodecCallType.Audio
});
}
// cameras
var camsProps = new List<object>();
@@ -689,39 +773,42 @@ namespace PepperDash.Essentials.Room.Cotija
{
if (ConfigIsLoaded)
{
var count = EISC.UShortOutput[801].UShortValue;
var count = EISC.UShortOutput[UshortJoin.NumberOfAuxFaders].UShortValue;
Debug.Console(1, this, "The Fader Count is : {0}", count);
// build volumes object, serialize and put in content of method below
var auxFaders = new List<Volume>();
// Create auxFaders
for (uint i = 2; i <= count; i++)
{
auxFaders.Add(
new Volume(string.Format("level-{0}", i),
EISC.UShortOutput[i].UShortValue,
EISC.BooleanOutput[i].BoolValue,
EISC.StringOutput[800 + i].StringValue,
true,
"someting.png"));
}
var auxFaderDict = new Dictionary<string, Volume>();
for (uint i = 2; i <= count; i++)
{
auxFaderDict.Add("level-" + i,
new Volume("level-" + i,
EISC.UShortOutput[i].UShortValue,
EISC.BooleanOutput[i].BoolValue,
EISC.StringOutput[i].StringValue,
true,
"someting.png"));
}
var volumes = new Volumes();
volumes.Master = new Volume("master",
EISC.UShortOutput[UshortJoin.MasterVolumeLevel].UShortValue,
EISC.BooleanOutput[BoolJoin.MasterVolumeIsMuted].BoolValue,
EISC.StringOutput[801].StringValue,
EISC.StringOutput[1].StringValue,
true,
"something.png");
volumes.Master.HasPrivacyMute = true;
volumes.Master.PrivacyMuted = EISC.BooleanOutput[BoolJoin.PrivacyMute].BoolValue;
volumes.AuxFaders = auxFaders;
volumes.AuxFaders = auxFaderDict;
volumes.NumberOfAuxFaders = EISC.UShortInput[UshortJoin.NumberOfAuxFaders].UShortValue;
PostStatusMessage(new
{
activityMode = GetActivityMode(),
isOn = EISC.BooleanOutput[BoolJoin.RoomIsOn].BoolValue,
selectedSourceKey = EISC.StringOutput[StringJoin.SelectedSourceKey].StringValue,
volumes = volumes
@@ -736,6 +823,18 @@ namespace PepperDash.Essentials.Room.Cotija
}
}
/// <summary>
/// Returns the activity mode int
/// </summary>
/// <returns></returns>
int GetActivityMode()
{
if (EISC.BooleanOutput[BoolJoin.ActivityPhoneCall].BoolValue) return 2;
else if (EISC.BooleanOutput[BoolJoin.ActivityShare].BoolValue) return 1;
else if (EISC.BooleanOutput[BoolJoin.ActivityVideoCall].BoolValue) return 3;
return 0;
}
/// <summary>
/// Helper for posting status message
/// </summary>
@@ -792,6 +891,7 @@ namespace PepperDash.Essentials.Room.Cotija
var d = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
{
{ "laptop", "pc" },
{ "pc", "pc" },
{ "wireless", "genericsource" },
{ "iptv", "settopbox" }

View File

@@ -25,6 +25,7 @@ namespace PepperDash.Essentials
public AudioCodecBaseMessenger ACMessenger { get; private set; }
/// <summary>
///
/// </summary>
@@ -92,7 +93,7 @@ namespace PepperDash.Essentials
var sscRoom = Room as IHasCurrentSourceInfoChange;
if(sscRoom != null)
sscRoom.CurrentSingleSourceChange += new SourceInfoChangeHandler(Room_CurrentSingleSourceChange);
sscRoom.CurrentSourceChange += new SourceInfoChangeHandler(Room_CurrentSingleSourceChange);
var vcRoom = Room as IHasVideoCodec;
if (vcRoom != null && vcRoom.VideoCodec != null)
@@ -333,7 +334,7 @@ namespace PepperDash.Essentials
}
void Room_CurrentSingleSourceChange(EssentialsRoomBase room, PepperDash.Essentials.Core.SourceListItem info, ChangeType type)
void Room_CurrentSingleSourceChange(PepperDash.Essentials.Core.SourceListItem info, ChangeType type)
{
/* Example message
* {
@@ -394,11 +395,14 @@ namespace PepperDash.Essentials
if (dev is ITransport)
(dev as ITransport).LinkActions(Parent);
var srcRm = room as IHasCurrentSourceInfoChange;
PostStatusMessage(new
{
selectedSourceKey = srcRm.CurrentSourceInfoKey
});
var srcRm = Room as IHasCurrentSourceInfoChange;
if (srcRm != null)
{
PostStatusMessage(new
{
selectedSourceKey = srcRm.CurrentSourceInfoKey
});
}
}
}
}
@@ -416,7 +420,7 @@ namespace PepperDash.Essentials
if (rmVc != null)
{
var vc = rmVc.CurrentVolumeControls as IBasicVolumeWithFeedback;
if (rmVc != null)
if (vc != null)
{
volumes.Master = new Volume("master", vc.VolumeLevelFeedback.UShortValue, vc.MuteFeedback.BoolValue, "Volume", true, "");
}

View File

@@ -14,11 +14,14 @@ namespace PepperDash.Essentials.Room.Cotija
public Volume Master { get; set; }
[JsonProperty("auxFaders")]
public List<Volume> AuxFaders { get; set; }
public Dictionary<string, Volume> AuxFaders { get; set; }
[JsonProperty("numberOfAuxFaders")]
public int NumberOfAuxFaders { get; set; }
public Volumes()
{
AuxFaders = new List<Volume>();
AuxFaders = new Dictionary<string, Volume>();
}
}
@@ -39,6 +42,13 @@ namespace PepperDash.Essentials.Room.Cotija
[JsonProperty("hasMute")]
public bool HasMute { get; set; }
[JsonProperty("hasPrivacyMute")]
public bool HasPrivacyMute { get; set; }
[JsonProperty("privacyMuted")]
public bool PrivacyMuted { get; set; }
[JsonProperty("muteIcon")]
public string MuteIcon { get; set; }

View File

@@ -0,0 +1,61 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Devices.Common;
using PepperDash.Essentials.DM.AirMedia;
using Newtonsoft.Json;
namespace PepperDash.Essentials.Bridges
{
public static class AirMediaControllerApiExtensions
{
public static void LinkToApi(this AirMediaController airMedia, BasicTriList trilist, uint joinStart, string joinMapKey)
{
AirMediaControllerJoinMap joinMap = new AirMediaControllerJoinMap();
var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey);
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<AirMediaControllerJoinMap>(joinMapSerialized);
joinMap.OffsetJoinNumbers(joinStart);
Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
Debug.Console(0, "Linking to Airmedia: {0}", airMedia.Name);
trilist.StringInput[joinMap.Name].StringValue = airMedia.Name;
var commMonitor = airMedia as ICommunicationMonitor;
if (commMonitor != null)
{
commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]);
}
airMedia.IsInSessionFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsInSession]);
airMedia.HdmiVideoSyncDetectedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.HdmiVideoSync]);
trilist.SetSigTrueAction(joinMap.AutomaticInputRoutingEnabled, new Action( airMedia.AirMedia.DisplayControl.EnableAutomaticRouting));
trilist.SetSigFalseAction(joinMap.AutomaticInputRoutingEnabled, new Action( airMedia.AirMedia.DisplayControl.DisableAutomaticRouting));
airMedia.AutomaticInputRoutingEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.AutomaticInputRoutingEnabled]);
trilist.SetUShortSigAction(joinMap.VideoOut, new Action<ushort>((u) => airMedia.SelectVideoOut(u)));
airMedia.VideoOutFeedback.LinkInputSig(trilist.UShortInput[joinMap.VideoOut]);
airMedia.ErrorFeedback.LinkInputSig(trilist.UShortInput[joinMap.ErrorFB]);
airMedia.NumberOfUsersConnectedFeedback.LinkInputSig(trilist.UShortInput[joinMap.NumberOfUsersConnectedFB]);
trilist.SetUShortSigAction(joinMap.LoginCode, new Action<ushort>((u) => airMedia.AirMedia.AirMedia.LoginCode.UShortValue = u));
airMedia.LoginCodeFeedback.LinkInputSig(trilist.UShortInput[joinMap.LoginCode]);
airMedia.ConnectionAddressFeedback.LinkInputSig(trilist.StringInput[joinMap.ConnectionAddressFB]);
airMedia.HostnameFeedback.LinkInputSig(trilist.StringInput[joinMap.HostnameFB]);
airMedia.SerialNumberFeedback.LinkInputSig(trilist.StringInput[joinMap.SerialNumberFeedback]);
}
}
}

View File

@@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Devices.Common;
using Newtonsoft.Json;
namespace PepperDash.Essentials.Bridges
{
public static class AppleTvApiExtensions
{
public static void LinkToApi(this AppleTV appleTv, BasicTriList trilist, uint joinStart, string joinMapKey)
{
AppleTvJoinMap joinMap = new AppleTvJoinMap();
var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey);
if(!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<AppleTvJoinMap>(joinMapSerialized);
joinMap.OffsetJoinNumbers(joinStart);
Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
Debug.Console(0, "Linking to Bridge Type {0}", appleTv.GetType().Name.ToString());
trilist.SetBoolSigAction(joinMap.UpArrow, (b) => appleTv.Up(b));
trilist.SetBoolSigAction(joinMap.DnArrow, (b) => appleTv.Down(b));
trilist.SetBoolSigAction(joinMap.LeftArrow, (b) => appleTv.Left(b));
trilist.SetBoolSigAction(joinMap.RightArrow, (b) => appleTv.Right(b));
trilist.SetBoolSigAction(joinMap.Select, (b) => appleTv.Select(b));
trilist.SetBoolSigAction(joinMap.Menu, (b) => appleTv.Menu(b));
trilist.SetBoolSigAction(joinMap.PlayPause, (b) => appleTv.Play(b));
}
}
}

View File

@@ -12,6 +12,7 @@ using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Lighting;
using PepperDash.Essentials.Core.Devices;
using PepperDash.Essentials.Devices.Common;
using PepperDash.Essentials.Devices.Common.Cameras;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.CrestronIO;
using PepperDash.Essentials.DM;
@@ -56,7 +57,6 @@ namespace PepperDash.Essentials.Bridges
public ThreeSeriesTcpIpEthernetIntersystemCommunications Eisc { get; private set; }
public EiscApi(DeviceConfig dc) :
base(dc.Key)
{
@@ -78,7 +78,12 @@ namespace PepperDash.Essentials.Bridges
if (device != null)
{
if (device is PepperDash.Essentials.Core.Monitoring.SystemMonitorController)
if (device is IBridge) // Check for this first to allow bridges in plugins to override existing bridges that apply to the same type.
{
(device as IBridge).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
continue;
}
else if (device is PepperDash.Essentials.Core.Monitoring.SystemMonitorController)
{
(device as PepperDash.Essentials.Core.Monitoring.SystemMonitorController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
continue;
@@ -88,22 +93,31 @@ namespace PepperDash.Essentials.Bridges
(device as GenericComm).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
continue;
}
//else if (device is CameraBase)
//{
// (device as CameraBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
// continue;
//}
//else if (device is PepperDash.Essentials.Core.TwoWayDisplayBase)
//{
// (device as TwoWayDisplayBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
// continue;
//}
else if (device is CameraBase)
{
(device as CameraBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
continue;
}
else if (device is PepperDash.Essentials.Core.DisplayBase)
{
(device as DisplayBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
continue;
}
else if (device is DmChassisController)
{
(device as DmChassisController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
continue;
}
else if (device is DmpsRoutingController)
{
(device as DmpsRoutingController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
continue;
}
else if (device is DmpsAudioOutputController)
{
(device as DmpsAudioOutputController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
continue;
}
else if (device is DmTxControllerBase)
{
(device as DmTxControllerBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
@@ -124,16 +138,31 @@ namespace PepperDash.Essentials.Bridges
(device as IDigitalInput).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
continue;
}
//else if (device is LightingBase)
//{
// (device as LightingBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
// continue;
//}
//else if (device is DigitalLogger)
//{
// (device as DigitalLogger).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
// continue;
//}
else if (device is AppleTV)
{
(device as AppleTV).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
continue;
}
else if (device is HdMdxxxCEController)
{
(device as HdMdxxxCEController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
continue;
}
else if (device is LightingBase)
{
(device as LightingBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
continue;
}
else if (device is DigitalLogger)
{
(device as DigitalLogger).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
continue;
}
else if (device is PepperDash.Essentials.Devices.Common.Occupancy.GlsOccupancySensorBaseController)
{
(device as PepperDash.Essentials.Devices.Common.Occupancy.GlsOccupancySensorBaseController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
continue;
}
}
}
@@ -141,6 +170,66 @@ namespace PepperDash.Essentials.Bridges
});
}
/// <summary>
/// Used for debugging to trigger an action based on a join number and type
/// </summary>
/// <param name="join"></param>
/// <param name="type"></param>
public void ExecuteJoinAction(uint join, string type, object state)
{
try
{
switch (type.ToLower())
{
case "digital":
{
var uo = Eisc.BooleanOutput[join].UserObject as Action<bool>;
if (uo != null)
{
Debug.Console(1, this, "Executing Action: {0}", uo.ToString());
uo(Convert.ToBoolean(state));
}
else
Debug.Console(1, this, "User Action is null. Nothing to Execute");
break;
}
case "analog":
{
var uo = Eisc.BooleanOutput[join].UserObject as Action<ushort>;
if (uo != null)
{
Debug.Console(1, this, "Executing Action: {0}", uo.ToString());
uo(Convert.ToUInt16(state));
}
else
Debug.Console(1, this, "User Action is null. Nothing to Execute"); break;
}
case "serial":
{
var uo = Eisc.BooleanOutput[join].UserObject as Action<string>;
if (uo != null)
{
Debug.Console(1, this, "Executing Action: {0}", uo.ToString());
uo(Convert.ToString(state));
}
else
Debug.Console(1, this, "User Action is null. Nothing to Execute");
break;
}
default:
{
Debug.Console(1, "Unknown join type. Use digital/serial/analog");
break;
}
}
}
catch (Exception e)
{
Debug.Console(1, this, "Error: {0}", e);
}
}
/// <summary>
/// Handles incoming sig changes
/// </summary>
@@ -148,15 +237,26 @@ namespace PepperDash.Essentials.Bridges
/// <param name="args"></param>
void Eisc_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args)
{
if (Debug.Level >= 1)
Debug.Console(1, this, "EiscApi change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
var uo = args.Sig.UserObject;
if (uo is Action<bool>)
(uo as Action<bool>)(args.Sig.BoolValue);
else if (uo is Action<ushort>)
(uo as Action<ushort>)(args.Sig.UShortValue);
else if (uo is Action<string>)
(uo as Action<string>)(args.Sig.StringValue);
try
{
if (Debug.Level >= 1)
Debug.Console(1, this, "EiscApi change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
var uo = args.Sig.UserObject;
if (uo != null)
{
Debug.Console(1, this, "Executing Action: {0}", uo.ToString());
if (uo is Action<bool>)
(uo as Action<bool>)(args.Sig.BoolValue);
else if (uo is Action<ushort>)
(uo as Action<ushort>)(args.Sig.UShortValue);
else if (uo is Action<string>)
(uo as Action<string>)(args.Sig.StringValue);
}
}
catch (Exception e)
{
Debug.Console(2, this, "Error in Eisc_SigChange handler: {0}", e);
}
}
}

View File

@@ -13,129 +13,127 @@ using PepperDash.Essentials.Bridges;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.EthernetCommunication;
namespace PepperDash.Essentials
namespace PepperDash.Essentials
{
public class BridgeFactory
{
public static IKeyed GetDevice(DeviceConfig dc)
{
// ? why is this static JTA 2018-06-13?
var key = dc.Key;
var name = dc.Name;
var type = dc.Type;
var properties = dc.Properties;
var propAnon = new { };
var typeName = dc.Type.ToLower();
var groupName = dc.Group.ToLower();
public class BridgeFactory
{
public static IKeyed GetDevice(DeviceConfig dc)
{
// ? why is this static JTA 2018-06-13?
//Debug.Console(2, "Name {0}, Key {1}, Type {2}, Properties {3}", name, key, type, properties.ToString());
var key = dc.Key;
var name = dc.Name;
var type = dc.Type;
var properties = dc.Properties;
var propAnon = new { };
if (typeName == "eiscapi")
{
return new EiscApi(dc);
}
var typeName = dc.Type.ToLower();
var groupName = dc.Group.ToLower();
return null;
}
//Debug.Console(2, "Name {0}, Key {1}, Type {2}, Properties {3}", name, key, type, properties.ToString());
if (typeName == "eiscapi")
{
return new EiscApi(dc);
}
return null;
}
}
public class CommBridge : Device
{
public CommBridgeProperties Properties { get; private set; }
public List<IBasicCommunication> CommDevices { get; private set; }
public CommBridge(string key, string name, JToken properties)
: base(key, name)
{
Properties = JsonConvert.DeserializeObject<CommBridgeProperties>(properties.ToString());
}
public override bool CustomActivate()
{
// Create EiscApis
if (Properties.Eiscs != null)
{
foreach (var eisc in Properties.Eiscs)
{
var ApiEisc = new BridgeApiEisc(eisc.IpId, eisc.Hostname);
}
}
foreach (var deviceKey in Properties.CommDevices)
{
var device = DeviceManager.GetDeviceForKey(deviceKey);
if (device != null)
{
Debug.Console(0, "deviceKey {0} Found in Device Manager", device.Key);
CommDevices.Add(device as IBasicCommunication);
}
else
{
Debug.Console(0, "deviceKey {0} Not Found in Device Manager", deviceKey);
}
}
// Iterate through all the CommDevices and link up their Actions and Feedbacks
Debug.Console(0, "Bridge {0} Activated", this.Name);
return true;
}
}
public class EiscBridgeProperties
{
public string ParentDeviceKey { get; set; }
public eApiType ApiType { get; set; }
public List<EiscProperties> Eiscs { get; set; }
public string ApiOverrideFilePath { get; set; }
public class EiscProperties
{
public string IpId { get; set; }
public string Hostname { get; set; }
}
}
public class CommBridgeProperties : EiscBridgeProperties
{
public List<string> CommDevices { get; set; }
}
public enum eApiType { Eisc = 0 }
public class BridgeApiEisc
{
public uint Ipid { get; private set; }
public ThreeSeriesTcpIpEthernetIntersystemCommunications Eisc { get; private set; }
public BridgeApiEisc(string ipid, string hostname)
{
Ipid = (UInt32)int.Parse(ipid, System.Globalization.NumberStyles.HexNumber);
Eisc = new ThreeSeriesTcpIpEthernetIntersystemCommunications(Ipid, hostname, Global.ControlSystem);
Eisc.Register();
Eisc.SigChange += Eisc_SigChange;
Debug.Console(0, "BridgeApiEisc Created at Ipid {0}", ipid);
}
void Eisc_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args)
{
if (Debug.Level >= 1)
Debug.Console(1, "BridgeApiEisc change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
var uo = args.Sig.UserObject;
if (uo is Action<bool>)
(uo as Action<bool>)(args.Sig.BoolValue);
else if (uo is Action<ushort>)
(uo as Action<ushort>)(args.Sig.UShortValue);
else if (uo is Action<string>)
(uo as Action<string>)(args.Sig.StringValue);
}
}
}
public class CommBridge : Device
{
public CommBridgeProperties Properties { get; private set; }
public List<IBasicCommunication> CommDevices { get; private set; }
public CommBridge(string key, string name, JToken properties)
: base(key, name)
{
Properties = JsonConvert.DeserializeObject<CommBridgeProperties>(properties.ToString());
}
public override bool CustomActivate()
{
// Create EiscApis
if (Properties.Eiscs != null)
{
foreach (var eisc in Properties.Eiscs)
{
var ApiEisc = new BridgeApiEisc(eisc.IpId, eisc.Hostname);
}
}
foreach (var deviceKey in Properties.CommDevices)
{
var device = DeviceManager.GetDeviceForKey(deviceKey);
if (device != null)
{
Debug.Console(0, "deviceKey {0} Found in Device Manager", device.Key);
CommDevices.Add(device as IBasicCommunication);
}
else
{
Debug.Console(0, "deviceKey {0} Not Found in Device Manager", deviceKey);
}
}
// Iterate through all the CommDevices and link up their Actions and Feedbacks
Debug.Console(0, "Bridge {0} Activated", this.Name);
return true;
}
}
public class EiscBridgeProperties
{
public string ParentDeviceKey { get; set; }
public eApiType ApiType { get; set; }
public List<EiscProperties> Eiscs { get; set; }
public string ApiOverrideFilePath { get; set; }
public class EiscProperties
{
public string IpId { get; set; }
public string Hostname { get; set; }
}
}
public class CommBridgeProperties : EiscBridgeProperties
{
public List<string> CommDevices { get; set; }
}
public enum eApiType { Eisc = 0 }
public class BridgeApiEisc
{
public uint Ipid { get; private set; }
public ThreeSeriesTcpIpEthernetIntersystemCommunications Eisc { get; private set; }
public BridgeApiEisc(string ipid, string hostname)
{
Ipid = (UInt32)int.Parse(ipid, System.Globalization.NumberStyles.HexNumber);
Eisc = new ThreeSeriesTcpIpEthernetIntersystemCommunications(Ipid, hostname, Global.ControlSystem);
Eisc.Register();
Eisc.SigChange += Eisc_SigChange;
Debug.Console(0, "BridgeApiEisc Created at Ipid {0}", ipid);
}
void Eisc_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args)
{
if (Debug.Level >= 1)
Debug.Console(1, "BridgeApiEisc change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
var uo = args.Sig.UserObject;
if (uo is Action<bool>)
(uo as Action<bool>)(args.Sig.BoolValue);
else if (uo is Action<ushort>)
(uo as Action<ushort>)(args.Sig.UShortValue);
else if (uo is Action<string>)
(uo as Action<string>)(args.Sig.StringValue);
}
}
}

View File

@@ -1,187 +1,137 @@
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using Crestron.SimplSharp;
//using Crestron.SimplSharpPro.DeviceSupport;
//using PepperDash.Core;
//using PepperDash.Essentials.Core;
//using PepperDash.Essentials.Devices.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Devices.Common;
using PepperDash.Essentials.Devices.Common.Cameras;
//namespace PepperDash.Essentials.Bridges
//{
// public static class CameraControllerApiExtensions
// {
using Newtonsoft.Json;
// public static BasicTriList _TriList;
// public static CameraControllerJoinMap JoinMap;
// public static void LinkToApi(this PepperDash.Essentials.Devices.Common.Cameras.CameraBase cameraDevice, BasicTriList trilist, uint joinStart, string joinMapKey)
// {
// JoinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as CameraControllerJoinMap;
// _TriList = trilist;
// if (JoinMap == null)
// {
// JoinMap = new CameraControllerJoinMap();
// }
// JoinMap.OffsetJoinNumbers(joinStart);
// Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
// Debug.Console(0, "Linking to Bridge Type {0}", cameraDevice.GetType().Name.ToString());
namespace PepperDash.Essentials.Bridges
{
public static class CameraControllerApiExtensions
{
// var commMonitor = cameraDevice as ICommunicationMonitor;
// commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[JoinMap.IsOnline]);
public static void LinkToApi(this PepperDash.Essentials.Devices.Common.Cameras.CameraBase cameraDevice, BasicTriList trilist, uint joinStart, string joinMapKey)
{
CameraControllerJoinMap joinMap = new CameraControllerJoinMap();
var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey);
// trilist.SetBoolSigAction(JoinMap.Left, (b) =>
// {
// if (b)
// {
// cameraDevice.PanLeft();
// }
// else
// {
// cameraDevice.Stop();
// }
// });
// trilist.SetBoolSigAction(JoinMap.Right, (b) =>
// {
// if (b)
// {
// cameraDevice.PanRight();
// }
// else
// {
// cameraDevice.Stop();
// }
// });
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<CameraControllerJoinMap>(joinMapSerialized);
// trilist.SetBoolSigAction(JoinMap.Up, (b) =>
// {
// if (b)
// {
// cameraDevice.TiltUp();
// }
// else
// {
// cameraDevice.Stop();
// }
// });
// trilist.SetBoolSigAction(JoinMap.Down, (b) =>
// {
// if (b)
// {
// cameraDevice.TiltDown();
// }
// else
// {
// cameraDevice.Stop();
// }
// });
joinMap.OffsetJoinNumbers(joinStart);
// trilist.SetBoolSigAction(JoinMap.ZoomIn, (b) =>
// {
// if (b)
// {
// cameraDevice.ZoomIn();
// }
// else
// {
// cameraDevice.Stop();
// }
// });
Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
Debug.Console(0, "Linking to Bridge Type {0}", cameraDevice.GetType().Name.ToString());
// trilist.SetBoolSigAction(JoinMap.ZoomOut, (b) =>
// {
// if (b)
// {
// cameraDevice.ZoomOut();
// }
// else
// {
// cameraDevice.Stop();
// }
// });
var commMonitor = cameraDevice as ICommunicationMonitor;
commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]);
var ptzCamera = cameraDevice as IHasCameraPtzControl;
// if (cameraDevice.GetType().Name.ToString().ToLower() == "cameravisca")
// {
// var viscaCamera = cameraDevice as PepperDash.Essentials.Devices.Common.Cameras.CameraVisca;
// trilist.SetSigTrueAction(JoinMap.PowerOn, () => viscaCamera.PowerOn());
// trilist.SetSigTrueAction(JoinMap.PowerOff, () => viscaCamera.PowerOff());
if (ptzCamera != null)
{
trilist.SetBoolSigAction(joinMap.Left, (b) =>
{
if (b)
{
ptzCamera.PanLeft();
}
else
{
ptzCamera.PanStop();
}
});
trilist.SetBoolSigAction(joinMap.Right, (b) =>
{
if (b)
{
ptzCamera.PanRight();
}
else
{
ptzCamera.PanStop();
}
});
// viscaCamera.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[JoinMap.PowerOn]);
// viscaCamera.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[JoinMap.PowerOff]);
trilist.SetBoolSigAction(joinMap.Up, (b) =>
{
if (b)
{
ptzCamera.TiltUp();
}
else
{
ptzCamera.TiltStop();
}
});
trilist.SetBoolSigAction(joinMap.Down, (b) =>
{
if (b)
{
ptzCamera.TiltDown();
}
else
{
ptzCamera.TiltStop();
}
});
// viscaCamera.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[JoinMap.IsOnline]);
// for (int i = 0; i < JoinMap.NumberOfPresets; i++)
// {
// int tempNum = i;
// trilist.SetSigTrueAction((ushort)(JoinMap.PresetRecallOffset + tempNum), () =>
// {
// viscaCamera.RecallPreset(tempNum);
// });
// trilist.SetSigTrueAction((ushort)(JoinMap.PresetSaveOffset + tempNum), () =>
// {
// viscaCamera.SavePreset(tempNum);
// });
// }
// }
trilist.SetBoolSigAction(joinMap.ZoomIn, (b) =>
{
if (b)
{
ptzCamera.ZoomIn();
}
else
{
ptzCamera.ZoomStop();
}
});
// }
trilist.SetBoolSigAction(joinMap.ZoomOut, (b) =>
{
if (b)
{
ptzCamera.ZoomOut();
}
else
{
ptzCamera.ZoomStop();
}
});
}
if (cameraDevice.GetType().Name.ToString().ToLower() == "cameravisca")
{
var viscaCamera = cameraDevice as PepperDash.Essentials.Devices.Common.Cameras.CameraVisca;
trilist.SetSigTrueAction(joinMap.PowerOn, () => viscaCamera.PowerOn());
trilist.SetSigTrueAction(joinMap.PowerOff, () => viscaCamera.PowerOff());
// }
// public class CameraControllerJoinMap : JoinMapBase
// {
// public uint IsOnline { get; set; }
// public uint PowerOff { get; set; }
// public uint PowerOn { get; set; }
// public uint Up { get; set; }
// public uint Down { get; set; }
// public uint Left { get; set; }
// public uint Right { get; set; }
// public uint ZoomIn { get; set; }
// public uint ZoomOut { get; set; }
// public uint PresetRecallOffset { get; set; }
// public uint PresetSaveOffset { get; set; }
// public uint NumberOfPresets { get; set; }
viscaCamera.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PowerOn]);
viscaCamera.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.PowerOff]);
// public CameraControllerJoinMap()
// {
// // Digital
// IsOnline = 9;
// PowerOff = 8;
// PowerOn = 7;
// Up = 1;
// Down = 2;
// Left = 3;
// Right = 4;
// ZoomIn = 5;
// ZoomOut = 6;
// PresetRecallOffset = 10;
// PresetSaveOffset = 30;
// NumberOfPresets = 5;
// // Analog
// }
viscaCamera.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]);
for (int i = 0; i < joinMap.NumberOfPresets; i++)
{
int tempNum = i;
trilist.SetSigTrueAction((ushort)(joinMap.PresetRecallOffset + tempNum), () =>
{
viscaCamera.RecallPreset(tempNum);
});
trilist.SetSigTrueAction((ushort)(joinMap.PresetSaveOffset + tempNum), () =>
{
viscaCamera.SavePreset(tempNum);
});
}
}
}
}
// public override void OffsetJoinNumbers(uint joinStart)
// {
// var joinOffset = joinStart - 1;
// IsOnline = IsOnline + joinOffset;
// PowerOff = PowerOff + joinOffset;
// PowerOn = PowerOn + joinOffset;
// Up = Up + joinOffset;
// Down = Down + joinOffset;
// Left = Left + joinOffset;
// Right = Right + joinOffset;
// ZoomIn = ZoomIn + joinOffset;
// ZoomOut = ZoomOut + joinOffset;
// PresetRecallOffset = PresetRecallOffset + joinOffset;
// PresetSaveOffset = PresetSaveOffset + joinOffset;
// }
// }
//}
}

View File

@@ -1,77 +1,42 @@
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using Crestron.SimplSharp;
//using Crestron.SimplSharpPro.DeviceSupport;
//using PepperDash.Core;
//using PepperDash.Essentials.Core;
//using PepperDash.Essentials.Devices.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Devices.Common;
//namespace PepperDash.Essentials.Bridges
//{
// public static class DigitalLoggerApiExtensions
// {
// public static void LinkToApi(this DigitalLogger DigitalLogger, BasicTriList trilist, uint joinStart, string joinMapKey)
// {
// var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as DigitalLoggerJoinMap;
using Newtonsoft.Json;
// if (joinMap == null)
// joinMap = new DigitalLoggerJoinMap();
namespace PepperDash.Essentials.Bridges
{
public static class DigitalLoggerApiExtensions
{
public static void LinkToApi(this DigitalLogger DigitalLogger, BasicTriList trilist, uint joinStart, string joinMapKey)
{
DigitalLoggerJoinMap joinMap = new DigitalLoggerJoinMap();
// joinMap.OffsetJoinNumbers(joinStart);
// Debug.Console(1, DigitalLogger, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
// for (uint i = 1; i <= DigitalLogger.CircuitCount; i++)
// {
// var circuit = i;
// DigitalLogger.CircuitNameFeedbacks[circuit - 1].LinkInputSig(trilist.StringInput[joinMap.CircuitNames + circuit]);
// DigitalLogger.CircuitIsCritical[circuit - 1].LinkInputSig(trilist.BooleanInput[joinMap.CircuitIsCritical + circuit]);
// DigitalLogger.CircuitState[circuit - 1].LinkInputSig(trilist.BooleanInput[joinMap.CircuitState + circuit]);
// trilist.SetSigTrueAction(joinMap.CircuitCycle + circuit, () => DigitalLogger.CycleCircuit(circuit - 1));
// trilist.SetSigTrueAction(joinMap.CircuitOnCmd + circuit, () => DigitalLogger.TurnOnCircuit(circuit - 1));
// trilist.SetSigTrueAction(joinMap.CircuitOffCmd + circuit, () => DigitalLogger.TurnOffCircuit(circuit - 1));
var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey);
// }
// }
// }
// public class DigitalLoggerJoinMap : JoinMapBase
// {
// public uint IsOnline { get; set; }
// public uint CircuitNames { get; set; }
// public uint CircuitState { get; set; }
// public uint CircuitCycle { get; set; }
// public uint CircuitIsCritical { get; set; }
// public uint CircuitOnCmd { get; set; }
// public uint CircuitOffCmd { get; set; }
// public DigitalLoggerJoinMap()
// {
// // Digital
// IsOnline = 9;
// CircuitState = 0;
// CircuitCycle = 0;
// CircuitIsCritical = 10;
// CircuitOnCmd = 10;
// CircuitOffCmd = 20;
// // Serial
// CircuitNames = 0;
// // Analog
// }
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<DigitalLoggerJoinMap>(joinMapSerialized);
// public override void OffsetJoinNumbers(uint joinStart)
// {
// var joinOffset = joinStart - 1;
joinMap.OffsetJoinNumbers(joinStart);
// IsOnline = IsOnline + joinOffset;
// CircuitNames = CircuitNames + joinOffset;
// CircuitState = CircuitState + joinOffset;
// CircuitCycle = CircuitCycle + joinOffset;
// CircuitIsCritical = CircuitIsCritical + joinOffset;
// CircuitOnCmd = CircuitOnCmd + joinOffset;
// CircuitOffCmd = CircuitOffCmd + joinOffset;
Debug.Console(1, DigitalLogger, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
for (uint i = 1; i <= DigitalLogger.CircuitCount; i++)
{
var circuit = i;
DigitalLogger.CircuitNameFeedbacks[circuit - 1].LinkInputSig(trilist.StringInput[joinMap.CircuitNames + circuit]);
DigitalLogger.CircuitIsCritical[circuit - 1].LinkInputSig(trilist.BooleanInput[joinMap.CircuitIsCritical + circuit]);
DigitalLogger.CircuitState[circuit - 1].LinkInputSig(trilist.BooleanInput[joinMap.CircuitState + circuit]);
trilist.SetSigTrueAction(joinMap.CircuitCycle + circuit, () => DigitalLogger.CycleCircuit(circuit - 1));
trilist.SetSigTrueAction(joinMap.CircuitOnCmd + circuit, () => DigitalLogger.TurnOnCircuit(circuit - 1));
trilist.SetSigTrueAction(joinMap.CircuitOffCmd + circuit, () => DigitalLogger.TurnOffCircuit(circuit - 1));
// }
// }
//}
}
}
}
}

View File

@@ -1,171 +1,153 @@
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using Crestron.SimplSharp;
//using Crestron.SimplSharpPro.DeviceSupport;
//using PepperDash.Core;
//using PepperDash.Essentials.Core;
//using PepperDash.Essentials.Devices.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Devices.Common;
//namespace PepperDash.Essentials.Bridges
//{
// public static class DisplayControllerApiExtensions
// {
using Newtonsoft.Json;
// public static BasicTriList _TriList;
// public static DisplayControllerJoinMap JoinMap;
// public static int InputNumber;
// public static IntFeedback InputNumberFeedback;
// public static List<string> InputKeys = new List<string>();
// public static void LinkToApi(this PepperDash.Essentials.Core.TwoWayDisplayBase displayDevice, BasicTriList trilist, uint joinStart, string joinMapKey)
// {
// JoinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as DisplayControllerJoinMap;
// _TriList = trilist;
// if (JoinMap == null)
// {
// JoinMap = new DisplayControllerJoinMap();
// }
namespace PepperDash.Essentials.Bridges
{
public static class DisplayControllerApiExtensions
{
public static void LinkToApi(this PepperDash.Essentials.Core.DisplayBase displayDevice, BasicTriList trilist, uint joinStart, string joinMapKey)
{
int inputNumber = 0;
IntFeedback inputNumberFeedback;
List<string> inputKeys = new List<string>();
DisplayControllerJoinMap joinMap = new DisplayControllerJoinMap();
var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey);
if(!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<DisplayControllerJoinMap>(joinMapSerialized);
joinMap.OffsetJoinNumbers(joinStart);
Debug.Console(1, "Linking to Trilist '{0}'",trilist.ID.ToString("X"));
Debug.Console(0, "Linking to Display: {0}", displayDevice.Name);
trilist.StringInput[joinMap.Name].StringValue = displayDevice.Name;
var commMonitor = displayDevice as ICommunicationMonitor;
if (commMonitor != null)
{
commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]);
}
inputNumberFeedback = new IntFeedback(() => { return inputNumber; });
// Two way feedbacks
var twoWayDisplay = displayDevice as PepperDash.Essentials.Core.TwoWayDisplayBase;
if (twoWayDisplay != null)
{
trilist.SetBool(joinMap.IsTwoWayDisplay, true);
twoWayDisplay.CurrentInputFeedback.OutputChange += new EventHandler<FeedbackEventArgs>(CurrentInputFeedback_OutputChange);
inputNumberFeedback.LinkInputSig(trilist.UShortInput[joinMap.InputSelect]);
}
// Power Off
trilist.SetSigTrueAction(joinMap.PowerOff, () =>
{
inputNumber = 102;
inputNumberFeedback.FireUpdate();
displayDevice.PowerOff();
});
displayDevice.PowerIsOnFeedback.OutputChange += new EventHandler<FeedbackEventArgs>( (o,a) => {
if (!a.BoolValue)
{
inputNumber = 102;
inputNumberFeedback.FireUpdate();
}
else
{
inputNumber = 0;
inputNumberFeedback.FireUpdate();
}
});
displayDevice.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.PowerOff]);
// PowerOn
trilist.SetSigTrueAction(joinMap.PowerOn, () =>
{
inputNumber = 0;
inputNumberFeedback.FireUpdate();
displayDevice.PowerOn();
});
// JoinMap.OffsetJoinNumbers(joinStart);
// Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
// Debug.Console(0, "Linking to Bridge Type {0}", displayDevice.GetType().Name.ToString());
displayDevice.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PowerOn]);
// trilist.StringInput[JoinMap.Name].StringValue = displayDevice.GetType().Name.ToString();
int count = 1;
foreach (var input in displayDevice.InputPorts)
{
inputKeys.Add(input.Key.ToString());
var tempKey = inputKeys.ElementAt(count - 1);
trilist.SetSigTrueAction((ushort)(joinMap.InputSelectOffset + count), () => { displayDevice.ExecuteSwitch(displayDevice.InputPorts[tempKey].Selector); });
Debug.Console(2, displayDevice, "Setting Input Select Action on Digital Join {0} to Input: {1}", joinMap.InputSelectOffset + count, displayDevice.InputPorts[tempKey].Key.ToString());
trilist.StringInput[(ushort)(joinMap.InputNamesOffset + count)].StringValue = input.Key.ToString();
count++;
}
// InputNumberFeedback = new IntFeedback(() => { return InputNumber;});
// InputNumberFeedback.LinkInputSig(trilist.UShortInput[JoinMap.InputSelect]);
// var commMonitor = displayDevice as ICommunicationMonitor;
// commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[JoinMap.IsOnline]);
// // Poewer Off
// trilist.SetSigTrueAction(JoinMap.PowerOff, () =>
// {
// InputNumber = 102;
// InputNumberFeedback.FireUpdate();
// displayDevice.PowerOff();
// });
Debug.Console(2, displayDevice, "Setting Input Select Action on Analog Join {0}", joinMap.InputSelect);
trilist.SetUShortSigAction(joinMap.InputSelect, (a) =>
{
if (a == 0)
{
displayDevice.PowerOff();
inputNumber = 0;
}
else if (a > 0 && a < displayDevice.InputPorts.Count && a != inputNumber)
{
displayDevice.ExecuteSwitch(displayDevice.InputPorts.ElementAt(a - 1).Selector);
inputNumber = a;
}
else if (a == 102)
{
displayDevice.PowerToggle();
// displayDevice.PowerIsOnFeedback.OutputChange += new EventHandler<FeedbackEventArgs>(PowerIsOnFeedback_OutputChange);
// displayDevice.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[JoinMap.PowerOff]);
// // Poewer On
// trilist.SetSigTrueAction(JoinMap.PowerOn, () =>
// {
// InputNumber = 0;
// InputNumberFeedback.FireUpdate();
// displayDevice.PowerOn();
// });
}
if (twoWayDisplay != null)
inputNumberFeedback.FireUpdate();
});
// displayDevice.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[JoinMap.PowerOn]);
// int count = 1;
// foreach (var input in displayDevice.InputPorts)
// {
// InputKeys.Add(input.Key.ToString());
// var tempKey = InputKeys.ElementAt(count - 1);
// trilist.SetSigTrueAction((ushort)(JoinMap.InputSelectOffset + count), () => { displayDevice.ExecuteSwitch(displayDevice.InputPorts[tempKey].Selector); });
// trilist.StringInput[(ushort)(JoinMap.InputNamesOffset + count)].StringValue = input.Key.ToString();
// count++;
// }
var volumeDisplay = displayDevice as IBasicVolumeControls;
if (volumeDisplay != null)
{
trilist.SetBoolSigAction(joinMap.VolumeUp, (b) => volumeDisplay.VolumeUp(b));
trilist.SetBoolSigAction(joinMap.VolumeDown, (b) => volumeDisplay.VolumeDown(b));
trilist.SetSigTrueAction(joinMap.VolumeMute, () => volumeDisplay.MuteToggle());
// displayDevice.CurrentInputFeedback.OutputChange += new EventHandler<FeedbackEventArgs>(CurrentInputFeedback_OutputChange);
// trilist.SetUShortSigAction(JoinMap.InputSelect, (a) =>
// {
// if (a == 0)
// {
// displayDevice.PowerOff();
// InputNumber = 0;
// }
// else if (a > 0 && a < displayDevice.InputPorts.Count && a != InputNumber)
// {
// displayDevice.ExecuteSwitch(displayDevice.InputPorts.ElementAt(a - 1).Selector);
// InputNumber = a;
// }
// else if (a == 102)
// {
// displayDevice.PowerToggle();
// }
// InputNumberFeedback.FireUpdate();
// });
// }
var volumeDisplayWithFeedback = volumeDisplay as IBasicVolumeWithFeedback;
if(volumeDisplayWithFeedback != null)
{
trilist.SetUShortSigAction(joinMap.VolumeLevel, new Action<ushort>((u) => volumeDisplayWithFeedback.SetVolume(u)));
volumeDisplayWithFeedback.VolumeLevelFeedback.LinkInputSig(trilist.UShortInput[joinMap.VolumeLevel]);
volumeDisplayWithFeedback.MuteFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VolumeMute]);
}
}
}
// static void CurrentInputFeedback_OutputChange(object sender, FeedbackEventArgs e)
// {
static void CurrentInputFeedback_OutputChange(object sender, FeedbackEventArgs e)
{
// Debug.Console(0, "CurrentInputFeedback_OutputChange {0}", e.StringValue);
Debug.Console(0, "CurrentInputFeedback_OutputChange {0}", e.StringValue);
// }
}
// static void PowerIsOnFeedback_OutputChange(object sender, FeedbackEventArgs e)
// {
// // Debug.Console(0, "PowerIsOnFeedback_OutputChange {0}", e.BoolValue);
// if (!e.BoolValue)
// {
// InputNumber = 102;
// InputNumberFeedback.FireUpdate();
// }
// else
// {
// InputNumber = 0;
// InputNumberFeedback.FireUpdate();
// }
// }
// }
// public class DisplayControllerJoinMap : JoinMapBase
// {
// public uint Name { get; set; }
// public uint InputNamesOffset { get; set; }
// public uint InputSelectOffset { get; set; }
// public uint IsOnline { get; set; }
// public uint PowerOff { get; set; }
// public uint InputSelect { get; set; }
// public uint PowerOn { get; set; }
// public uint SelectScene { get; set; }
// public uint LightingSceneOffset { get; set; }
// public uint ButtonVisibilityOffset { get; set; }
// public uint IntegrationIdSet { get; set; }
// public DisplayControllerJoinMap()
// {
// // Digital
// IsOnline = 50;
// PowerOff = 1;
// PowerOn = 2;
// InputSelect = 4;
// IntegrationIdSet = 1;
// LightingSceneOffset = 10;
// ButtonVisibilityOffset = 40;
// Name = 1;
// InputNamesOffset = 10;
// InputSelectOffset = 4;
// // Analog
// }
// public override void OffsetJoinNumbers(uint joinStart)
// {
// var joinOffset = joinStart - 1;
// IsOnline = IsOnline + joinOffset;
// PowerOff = PowerOff + joinOffset;
// PowerOn = PowerOn + joinOffset;
// SelectScene = SelectScene + joinOffset;
// LightingSceneOffset = LightingSceneOffset + joinOffset;
// ButtonVisibilityOffset = ButtonVisibilityOffset + joinOffset;
// Name = Name + joinOffset;
// InputNamesOffset = InputNamesOffset + joinOffset;
// InputSelectOffset = InputSelectOffset + joinOffset;
// }
// }
//}
}
}

View File

@@ -1,130 +1,282 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.DM;
namespace PepperDash.Essentials.Bridges
{
public static class DmChassisControllerApiExtentions
{
public static void LinkToApi(this DmChassisController dmChassis, BasicTriList trilist, uint joinStart, string joinMapKey)
{
var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as DmChassisControllerJoinMap;
if (joinMap == null)
joinMap = new DmChassisControllerJoinMap();
joinMap.OffsetJoinNumbers(joinStart);
Debug.Console(1, dmChassis, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
dmChassis.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]);
// Link up outputs
for (uint i = 1; i <= dmChassis.Chassis.NumberOfOutputs - 1; i++)
{
var ioSlot = i;
// Control
trilist.SetUShortSigAction(joinMap.OutputVideo + ioSlot, new Action<ushort>(o => dmChassis.ExecuteSwitch(o, ioSlot, eRoutingSignalType.Video)));
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.DM;
using Crestron.SimplSharpPro.DM.Endpoints;
using Crestron.SimplSharpPro.DM.Endpoints.Transmitters;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.DM;
using Newtonsoft.Json;
namespace PepperDash.Essentials.Bridges
{
public static class DmChassisControllerApiExtentions
{
public static void LinkToApi(this DmChassisController dmChassis, BasicTriList trilist, uint joinStart, string joinMapKey)
{
DmChassisControllerJoinMap joinMap = new DmChassisControllerJoinMap();
var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey);
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<DmChassisControllerJoinMap>(joinMapSerialized);
joinMap.OffsetJoinNumbers(joinStart);
Debug.Console(1, dmChassis, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
dmChassis.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]);
trilist.SetUShortSigAction(joinMap.SystemId, new Action<ushort>(o => dmChassis.Chassis.SystemId.UShortValue = o));
trilist.SetSigTrueAction(joinMap.SystemId, new Action(() => dmChassis.Chassis.ApplySystemId()));
dmChassis.SystemIdFeebdack.LinkInputSig(trilist.UShortInput[joinMap.SystemId]);
dmChassis.SystemIdBusyFeedback.LinkInputSig(trilist.BooleanInput[joinMap.SystemId]);
// Link up outputs
for (uint i = 1; i <= dmChassis.Chassis.NumberOfOutputs; i++)
{
var ioSlot = i;
// Control
trilist.SetUShortSigAction(joinMap.OutputVideo + ioSlot, new Action<ushort>(o => dmChassis.ExecuteSwitch(o, ioSlot, eRoutingSignalType.Video)));
trilist.SetUShortSigAction(joinMap.OutputAudio + ioSlot, new Action<ushort>(o => dmChassis.ExecuteSwitch(o, ioSlot, eRoutingSignalType.Audio)));
if (dmChassis.TxDictionary.ContainsKey(ioSlot))
{
Debug.Console(2, "Creating Tx Feedbacks {0}", ioSlot);
var TxKey = dmChassis.TxDictionary[ioSlot];
var TxDevice = DeviceManager.GetDeviceForKey(TxKey) as DmTxControllerBase;
TxDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]);
// TxDevice.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]);
// trilist.SetUShortSigAction((ApiMap.HdcpSupport[ioSlot]), u => TxDevice.SetHdcpSupportAll((ePdtHdcpSupport)(u)));
// TxDevice.HdcpSupportAllFeedback.LinkInputSig(trilist.UShortInput[joinMap. + ioSlot]);
// trilist.UShortInput[ApiMap.HdcpSupportCapability[ioSlot]].UShortValue = TxDevice.HdcpSupportCapability;
}
else
{
// dmChassis.VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[ApiMap.TxVideoSyncStatus[ioSlot]]);
}
if (dmChassis.RxDictionary.ContainsKey(ioSlot))
{
Debug.Console(2, "Creating Rx Feedbacks {0}", ioSlot);
var RxKey = dmChassis.RxDictionary[ioSlot];
var RxDevice = DeviceManager.GetDeviceForKey(RxKey) as DmRmcControllerBase;
RxDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline + ioSlot]);
}
// Feedback
dmChassis.VideoOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputVideo + ioSlot]);
dmChassis.AudioOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputAudio + ioSlot]);
dmChassis.VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus + ioSlot]);
dmChassis.OutputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputNames + ioSlot]);
dmChassis.InputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.InputNames + ioSlot]);
dmChassis.OutputVideoRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentVideoInputNames + ioSlot]);
dmChassis.OutputAudioRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentAudioInputNames + ioSlot]);
// dmChassis.InputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]);
// dmChassis.OutputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline + ioSlot]);
}
}
public class DmChassisControllerJoinMap : JoinMapBase
{
public uint IsOnline { get; set; }
public uint OutputVideo { get; set; }
public uint OutputAudio { get; set; }
public uint VideoSyncStatus { get; set; }
public uint InputNames { get; set; }
public uint OutputNames { get; set; }
public uint OutputCurrentVideoInputNames { get; set; }
public uint OutputCurrentAudioInputNames { get; set; }
public uint InputCurrentResolution { get; set; }
public uint InputEndpointOnline { get; set; }
public uint OutputEndpointOnline { get; set; }
//public uint HdcpSupport { get; set; }
//public uint HdcpSupportCapability { get; set; }
public DmChassisControllerJoinMap()
{
IsOnline = 11;
OutputVideo = 100; //101-299
OutputAudio = 300; //301-499
VideoSyncStatus = 100; //101-299
InputNames = 100; //101-299
OutputNames = 300; //301-499
OutputCurrentVideoInputNames = 2000; //2001-2199
OutputCurrentAudioInputNames = 2200; //2201-2399
InputCurrentResolution = 2400; // 2401-2599
InputEndpointOnline = 500;
OutputEndpointOnline = 700;
//HdcpSupport = 1000; //1001-1199
//HdcpSupportCapability = 1200; //1201-1399
}
public override void OffsetJoinNumbers(uint joinStart)
{
var joinOffset = joinStart - 1;
IsOnline = IsOnline + joinOffset;
OutputVideo = OutputVideo + joinOffset;
OutputAudio = OutputAudio + joinOffset;
VideoSyncStatus = VideoSyncStatus + joinOffset;
InputNames = InputNames + joinOffset;
OutputNames = OutputNames + joinOffset;
OutputCurrentVideoInputNames = OutputCurrentVideoInputNames + joinOffset;
OutputCurrentAudioInputNames = OutputCurrentAudioInputNames + joinOffset;
InputCurrentResolution = InputCurrentResolution + joinOffset;
InputEndpointOnline = InputEndpointOnline + joinOffset;
OutputEndpointOnline = OutputEndpointOnline + joinOffset;
//HdcpSupport = HdcpSupport + joinOffset;
//HdcpSupportCapability = HdcpSupportCapability + joinOffset;
}
}
}
trilist.SetUShortSigAction(joinMap.OutputUsb + ioSlot, new Action<ushort>(o => dmChassis.ExecuteSwitch(o, ioSlot, eRoutingSignalType.UsbOutput)));
trilist.SetUShortSigAction(joinMap.InputUsb + ioSlot, new Action<ushort>(o => dmChassis.ExecuteSwitch(o, ioSlot, eRoutingSignalType.UsbInput)));
if (dmChassis.TxDictionary.ContainsKey(ioSlot))
{
Debug.Console(2, "Creating Tx Feedbacks {0}", ioSlot);
var txKey = dmChassis.TxDictionary[ioSlot];
var basicTxDevice = DeviceManager.GetDeviceForKey(txKey) as BasicDmTxControllerBase;
var advancedTxDevice = basicTxDevice as DmTxControllerBase;
if (dmChassis.Chassis is DmMd8x8Cpu3 || dmChassis.Chassis is DmMd8x8Cpu3rps
|| dmChassis.Chassis is DmMd16x16Cpu3 || dmChassis.Chassis is DmMd16x16Cpu3rps
|| dmChassis.Chassis is DmMd32x32Cpu3 || dmChassis.Chassis is DmMd32x32Cpu3rps)
{
dmChassis.InputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]);
}
else
{
if (advancedTxDevice != null)
{
advancedTxDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]);
Debug.Console(2, "Linking Tx Online Feedback from Advanced Transmitter at input {0}", ioSlot);
}
else if (dmChassis.InputEndpointOnlineFeedbacks[ioSlot] != null)
{
Debug.Console(2, "Linking Tx Online Feedback from Input Card {0}", ioSlot);
dmChassis.InputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]);
}
}
if (basicTxDevice != null && advancedTxDevice == null)
trilist.BooleanInput[joinMap.TxAdvancedIsPresent + ioSlot].BoolValue = true;
if (advancedTxDevice != null)
{
advancedTxDevice.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus + ioSlot]);
}
else if(advancedTxDevice == null || basicTxDevice != null)
{
Debug.Console(1, "Setting up actions and feedbacks on input card {0}", ioSlot);
dmChassis.VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus + ioSlot]);
var inputPort = dmChassis.InputPorts[string.Format("inputCard{0}--hdmiIn", ioSlot)];
if (inputPort != null)
{
Debug.Console(1, "Port value for input card {0} is set", ioSlot);
var port = inputPort.Port;
if (port != null)
{
if (port is HdmiInputWithCEC)
{
Debug.Console(1, "Port is HdmiInputWithCec");
var hdmiInPortWCec = port as HdmiInputWithCEC;
if (hdmiInPortWCec.HdcpSupportedLevel != eHdcpSupportedLevel.Unknown)
{
SetHdcpStateAction(true, hdmiInPortWCec, joinMap.HdcpSupportState + ioSlot, trilist);
}
dmChassis.InputCardHdcpCapabilityFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.HdcpSupportState + ioSlot]);
if(dmChassis.InputCardHdcpCapabilityTypes.ContainsKey(ioSlot))
trilist.UShortInput[joinMap.HdcpSupportCapability + ioSlot].UShortValue = (ushort)dmChassis.InputCardHdcpCapabilityTypes[ioSlot];
else
trilist.UShortInput[joinMap.HdcpSupportCapability + ioSlot].UShortValue = 1;
}
}
}
else
{
inputPort = dmChassis.InputPorts[string.Format("inputCard{0}--dmIn", ioSlot)];
if(inputPort != null)
{
var port = inputPort.Port;
if (port is DMInputPortWithCec)
{
Debug.Console(1, "Port is DMInputPortWithCec");
var dmInPortWCec = port as DMInputPortWithCec;
if (dmInPortWCec != null)
{
SetHdcpStateAction(dmChassis.PropertiesConfig.InputSlotSupportsHdcp2[ioSlot], dmInPortWCec, joinMap.HdcpSupportState + ioSlot, trilist);
}
dmChassis.InputCardHdcpCapabilityFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.HdcpSupportState + ioSlot]);
if (dmChassis.InputCardHdcpCapabilityTypes.ContainsKey(ioSlot))
trilist.UShortInput[joinMap.HdcpSupportCapability + ioSlot].UShortValue = (ushort)dmChassis.InputCardHdcpCapabilityTypes[ioSlot];
else
trilist.UShortInput[joinMap.HdcpSupportCapability + ioSlot].UShortValue = 1;
}
}
}
}
}
else
{
dmChassis.VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus + ioSlot]);
var inputPort = dmChassis.InputPorts[string.Format("inputCard{0}--hdmiIn", ioSlot)];
if (inputPort != null)
{
var hdmiPort = inputPort.Port as EndpointHdmiInput;
if (hdmiPort != null)
{
SetHdcpStateAction(true, hdmiPort, joinMap.HdcpSupportState + ioSlot, trilist);
dmChassis.InputCardHdcpCapabilityFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.HdcpSupportState + ioSlot]);
}
}
}
if (dmChassis.RxDictionary.ContainsKey(ioSlot))
{
Debug.Console(2, "Creating Rx Feedbacks {0}", ioSlot);
var rxKey = dmChassis.RxDictionary[ioSlot];
var rxDevice = DeviceManager.GetDeviceForKey(rxKey) as DmRmcControllerBase;
var hdBaseTDevice = DeviceManager.GetDeviceForKey(rxKey) as DmHdBaseTControllerBase;
if (dmChassis.Chassis is DmMd8x8Cpu3 || dmChassis.Chassis is DmMd8x8Cpu3rps
|| dmChassis.Chassis is DmMd16x16Cpu3 || dmChassis.Chassis is DmMd16x16Cpu3rps
|| dmChassis.Chassis is DmMd32x32Cpu3 || dmChassis.Chassis is DmMd32x32Cpu3rps || hdBaseTDevice != null)
{
dmChassis.OutputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline + ioSlot]);
}
else if (rxDevice != null)
{
rxDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline + ioSlot]);
}
}
// Feedback
dmChassis.VideoOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputVideo + ioSlot]);
dmChassis.AudioOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputAudio + ioSlot]);
dmChassis.UsbOutputRoutedToFeebacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputUsb + ioSlot]);
dmChassis.UsbInputRoutedToFeebacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.InputUsb + ioSlot]);
dmChassis.OutputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputNames + ioSlot]);
dmChassis.InputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.InputNames + ioSlot]);
dmChassis.OutputVideoRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentVideoInputNames + ioSlot]);
dmChassis.OutputAudioRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentAudioInputNames + ioSlot]);
}
}
static void SetHdcpStateAction(bool hdcpTypeSimple, HdmiInputWithCEC port, uint join, BasicTriList trilist)
{
if (hdcpTypeSimple)
{
trilist.SetUShortSigAction(join,
new Action<ushort>(s =>
{
if (s == 0)
{
port.HdcpSupportOff();
}
else if (s > 0)
{
port.HdcpSupportOn();
}
}));
}
else
{
trilist.SetUShortSigAction(join,
new Action<ushort>(u =>
{
port.HdcpReceiveCapability = (eHdcpCapabilityType)u;
}));
}
}
static void SetHdcpStateAction(bool hdcpTypeSimple, EndpointHdmiInput port, uint join, BasicTriList trilist)
{
if (hdcpTypeSimple)
{
trilist.SetUShortSigAction(join,
new Action<ushort>(s =>
{
if (s == 0)
{
port.HdcpSupportOff();
}
else if (s > 0)
{
port.HdcpSupportOn();
}
}));
}
else
{
trilist.SetUShortSigAction(join,
new Action<ushort>(u =>
{
port.HdcpCapability = (eHdcpCapabilityType)u;
}));
}
}
static void SetHdcpStateAction(bool supportsHdcp2, DMInputPortWithCec port, uint join, BasicTriList trilist)
{
if (!supportsHdcp2)
{
trilist.SetUShortSigAction(join,
new Action<ushort>(s =>
{
if (s == 0)
{
port.HdcpSupportOff();
}
else if (s > 0)
{
port.HdcpSupportOn();
}
}));
}
else
{
trilist.SetUShortSigAction(join,
new Action<ushort>(u =>
{
port.HdcpReceiveCapability = (eHdcpCapabilityType)u;
}));
}
}
}
}

View File

@@ -9,16 +9,20 @@ using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.DM;
using Newtonsoft.Json;
namespace PepperDash.Essentials.Bridges
{
public static class DmRmcControllerApiExtensions
{
public static void LinkToApi(this DmRmcControllerBase rmc, BasicTriList trilist, uint joinStart, string joinMapKey)
{
var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as DmRmcControllerJoinMap;
DmRmcControllerJoinMap joinMap = new DmRmcControllerJoinMap();
if (joinMap == null)
joinMap = new DmRmcControllerJoinMap();
var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey);
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<DmRmcControllerJoinMap>(joinMapSerialized);
joinMap.OffsetJoinNumbers(joinStart);
@@ -36,40 +40,5 @@ namespace PepperDash.Essentials.Bridges
if(rmc.EdidSerialNumberFeedback != null)
rmc.EdidSerialNumberFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidSerialNumber]);
}
public class DmRmcControllerJoinMap : JoinMapBase
{
public uint IsOnline { get; set; }
public uint CurrentOutputResolution { get; set; }
public uint EdidManufacturer { get; set; }
public uint EdidName { get; set; }
public uint EdidPrefferedTiming { get; set; }
public uint EdidSerialNumber { get; set; }
public DmRmcControllerJoinMap()
{
// Digital
IsOnline = 1;
// Serial
CurrentOutputResolution = 1;
EdidManufacturer = 2;
EdidName = 3;
EdidPrefferedTiming = 4;
EdidSerialNumber = 5;
}
public override void OffsetJoinNumbers(uint joinStart)
{
var joinOffset = joinStart - 1;
IsOnline = IsOnline + joinOffset;
CurrentOutputResolution = CurrentOutputResolution + joinOffset;
EdidManufacturer = EdidManufacturer + joinOffset;
EdidName = EdidName + joinOffset;
EdidPrefferedTiming = EdidPrefferedTiming + joinOffset;
EdidSerialNumber = EdidSerialNumber + joinOffset;
}
}
}
}

View File

@@ -12,16 +12,20 @@ using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.DM;
using Newtonsoft.Json;
namespace PepperDash.Essentials.Bridges
{
public static class DmTxControllerApiExtensions
{
public static void LinkToApi(this DmTxControllerBase tx, BasicTriList trilist, uint joinStart, string joinMapKey)
{
var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as DmTxControllerJoinMap;
DmTxControllerJoinMap joinMap = new DmTxControllerJoinMap();
if (joinMap == null)
joinMap = new DmTxControllerJoinMap();
var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey);
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<DmTxControllerJoinMap>(joinMapSerialized);
joinMap.OffsetJoinNumbers(joinStart);
@@ -30,7 +34,7 @@ namespace PepperDash.Essentials.Bridges
tx.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]);
tx.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus]);
tx.AnyVideoInput.VideoStatus.VideoResolutionFeedback.LinkInputSig(trilist.StringInput[joinMap.CurrentInputResolution]);
//tx.HdcpSupportAllFeedback.LinkInputSig(trilist.UShortInput[joinMap.HdcpSupportCapability]);
trilist.UShortInput[joinMap.HdcpSupportCapability].UShortValue = (ushort)tx.HdcpSupportCapability;
bool hdcpTypeSimple;
@@ -128,46 +132,6 @@ namespace PepperDash.Essentials.Bridges
}
}
public class DmTxControllerJoinMap : JoinMapBase
{
public uint IsOnline { get; set; }
public uint VideoSyncStatus { get; set; }
public uint CurrentInputResolution { get; set; }
public uint HdcpSupportCapability { get; set; }
public uint VideoInput { get; set; }
public uint AudioInput { get; set; }
public uint Port1HdcpState { get; set; }
public uint Port2HdcpState { get; set; }
public DmTxControllerJoinMap()
{
// Digital
IsOnline = 1;
VideoSyncStatus = 2;
// Serial
CurrentInputResolution = 1;
// Analog
VideoInput = 1;
AudioInput = 2;
HdcpSupportCapability = 3;
Port1HdcpState = 4;
Port2HdcpState = 5;
}
public override void OffsetJoinNumbers(uint joinStart)
{
var joinOffset = joinStart - 1;
IsOnline = IsOnline + joinOffset;
VideoSyncStatus = VideoSyncStatus + joinOffset;
CurrentInputResolution = CurrentInputResolution + joinOffset;
VideoInput = VideoInput + joinOffset;
AudioInput = AudioInput + joinOffset;
HdcpSupportCapability = HdcpSupportCapability + joinOffset;
Port1HdcpState = Port1HdcpState + joinOffset;
Port2HdcpState = Port2HdcpState + joinOffset;
}
}
}
}

View File

@@ -0,0 +1,75 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.DM;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.DM;
using Newtonsoft.Json;
namespace PepperDash.Essentials.Bridges
{
public static class DmpsAudioOutputControllerApiExtensions
{
public static void LinkToApi(this DmpsAudioOutputController dmAudioOutputController, BasicTriList trilist, uint joinStart, string joinMapKey)
{
DmpsAudioOutputControllerJoinMap joinMap = new DmpsAudioOutputControllerJoinMap();
var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey);
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<DmpsAudioOutputControllerJoinMap>(joinMapSerialized);
joinMap.OffsetJoinNumbers(joinStart);
Debug.Console(1, dmAudioOutputController, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
if (dmAudioOutputController.MasterVolumeLevel != null)
{
SetUpDmpsAudioOutputJoins(trilist, dmAudioOutputController.MasterVolumeLevel, joinMap.MasterVolume);
}
if (dmAudioOutputController.SourceVolumeLevel != null)
{
SetUpDmpsAudioOutputJoins(trilist, dmAudioOutputController.SourceVolumeLevel, joinMap.SourceVolume);
}
if (dmAudioOutputController.Codec1VolumeLevel != null)
{
SetUpDmpsAudioOutputJoins(trilist, dmAudioOutputController.Codec1VolumeLevel, joinMap.Codec1Volume);
}
if (dmAudioOutputController.Codec2VolumeLevel != null)
{
SetUpDmpsAudioOutputJoins(trilist, dmAudioOutputController.Codec2VolumeLevel, joinMap.Codec2Volume);
}
}
static void SetUpDmpsAudioOutputJoins(BasicTriList trilist, DmpsAudioOutput output, uint joinStart)
{
var volumeLevelJoin = joinStart;
var muteOnJoin = joinStart;
var muteOffJoin = joinStart + 1;
var volumeUpJoin = joinStart + 2;
var volumeDownJoin = joinStart + 3;
trilist.SetUShortSigAction(volumeLevelJoin, new Action<ushort>(o => output.SetVolume(o)));
output.VolumeLevelFeedback.LinkInputSig(trilist.UShortInput[volumeLevelJoin]);
trilist.SetSigTrueAction(muteOnJoin, new Action(output.MuteOn));
output.MuteFeedback.LinkInputSig(trilist.BooleanInput[muteOnJoin]);
trilist.SetSigTrueAction(muteOffJoin, new Action(output.MuteOff));
output.MuteFeedback.LinkComplementInputSig(trilist.BooleanInput[muteOffJoin]);
trilist.SetBoolSigAction(volumeUpJoin, new Action<bool>(b => output.VolumeUp(b)));
trilist.SetBoolSigAction(volumeDownJoin, new Action<bool>(b => output.VolumeDown(b)));
}
}
}

View File

@@ -0,0 +1,128 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.DM;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.DM;
using Newtonsoft.Json;
namespace PepperDash.Essentials.Bridges
{
public static class DmpsRoutingControllerApiExtentions
{
public static void LinkToApi(this DmpsRoutingController dmpsRouter, BasicTriList trilist, uint joinStart, string joinMapKey)
{
DmpsRoutingControllerJoinMap joinMap = new DmpsRoutingControllerJoinMap();
var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey);
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<DmpsRoutingControllerJoinMap>(joinMapSerialized);
joinMap.OffsetJoinNumbers(joinStart);
Debug.Console(1, dmpsRouter, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
// Link up outputs
for (uint i = 1; i <= dmpsRouter.Dmps.NumberOfSwitcherInputs; i++)
{
Debug.Console(2, dmpsRouter, "Linking Input Card {0}", i);
var ioSlot = i;
//if (dmpsRouter.TxDictionary.ContainsKey(ioSlot))
//{
// Debug.Console(2, "Creating Tx Feedbacks {0}", ioSlot);
// var TxKey = dmpsRouter.TxDictionary[ioSlot];
// var TxDevice = DeviceManager.GetDeviceForKey(TxKey) as DmTxControllerBase;
// //TxDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]);
// // TxDevice.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]);
// // trilist.SetUShortSigAction((ApiMap.HdcpSupport[ioSlot]), u => TxDevice.SetHdcpSupportAll((ePdtHdcpSupport)(u)));
// // TxDevice.HdcpSupportAllFeedback.LinkInputSig(trilist.UShortInput[joinMap. + ioSlot]);
// // trilist.UShortInput[ApiMap.HdcpSupportCapability[ioSlot]].UShortValue = TxDevice.HdcpSupportCapability;
//}
//else
//{
// // dmChassis.VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[ApiMap.TxVideoSyncStatus[ioSlot]]);
//}
if(dmpsRouter.VideoInputSyncFeedbacks[ioSlot] != null)
dmpsRouter.VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus + ioSlot]);
if (dmpsRouter.InputNameFeedbacks[ioSlot] != null)
dmpsRouter.InputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.InputNames + ioSlot]);
trilist.SetStringSigAction(joinMap.InputNames + ioSlot, new Action<string>(s =>
{
var inputCard = dmpsRouter.Dmps.SwitcherInputs[ioSlot] as DMInput;
if (inputCard != null)
{
if (inputCard.NameFeedback != null && !string.IsNullOrEmpty(inputCard.NameFeedback.StringValue) && inputCard.NameFeedback.StringValue != s)
if(inputCard.Name != null)
inputCard.Name.StringValue = s;
}
}));
if(dmpsRouter.InputEndpointOnlineFeedbacks[ioSlot] != null)
dmpsRouter.InputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]);
}
for (uint i = 1; i <= dmpsRouter.Dmps.NumberOfSwitcherOutputs; i++)
{
Debug.Console(2, dmpsRouter, "Linking Output Card {0}", i);
var ioSlot = i;
// Control
trilist.SetUShortSigAction(joinMap.OutputVideo + ioSlot, new Action<ushort>(o => dmpsRouter.ExecuteSwitch(o, ioSlot, eRoutingSignalType.Video)));
trilist.SetUShortSigAction(joinMap.OutputAudio + ioSlot, new Action<ushort>(o => dmpsRouter.ExecuteSwitch(o, ioSlot, eRoutingSignalType.Audio)));
trilist.SetStringSigAction(joinMap.OutputNames + ioSlot, new Action<string>(s =>
{
var outputCard = dmpsRouter.Dmps.SwitcherOutputs[ioSlot] as DMOutput;
//Debug.Console(2, dmpsRouter, "Output Name String Sig Action for Output Card {0}", ioSlot);
if (outputCard != null)
{
//Debug.Console(2, dmpsRouter, "Card Type: {0}", outputCard.CardInputOutputType);
if (!(outputCard is Crestron.SimplSharpPro.DM.Cards.Card.Dmps3CodecOutput) && outputCard.NameFeedback != null)
{
if (!string.IsNullOrEmpty(outputCard.NameFeedback.StringValue))
{
//Debug.Console(2, dmpsRouter, "NameFeedabck: {0}", outputCard.NameFeedback.StringValue);
if (outputCard.NameFeedback.StringValue != s && outputCard.Name != null)
{
outputCard.Name.StringValue = s;
}
}
}
}
}));
// Feedback
if(dmpsRouter.VideoOutputFeedbacks[ioSlot] != null)
dmpsRouter.VideoOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputVideo + ioSlot]);
if (dmpsRouter.AudioOutputFeedbacks[ioSlot] != null)
dmpsRouter.AudioOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputAudio + ioSlot]);
if (dmpsRouter.OutputNameFeedbacks[ioSlot] != null)
dmpsRouter.OutputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputNames + ioSlot]);
if (dmpsRouter.OutputVideoRouteNameFeedbacks[ioSlot] != null)
dmpsRouter.OutputVideoRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentVideoInputNames + ioSlot]);
if (dmpsRouter.OutputAudioRouteNameFeedbacks[ioSlot] != null)
dmpsRouter.OutputAudioRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentAudioInputNames + ioSlot]);
if (dmpsRouter.OutputEndpointOnlineFeedbacks[ioSlot] != null)
dmpsRouter.OutputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline + ioSlot]);
}
}
}
}

View File

@@ -1,103 +1,74 @@
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using Crestron.SimplSharp;
//using Crestron.SimplSharpPro.DeviceSupport;
//using PepperDash.Core;
//using PepperDash.Essentials.Core;
//using PepperDash.Essentials.Devices.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Devices.Common;
//namespace PepperDash.Essentials.Bridges
//{
// public static class GenericLightingApiExtensions
// {
// public static void LinkToApi(this PepperDash.Essentials.Core.Lighting.LightingBase lightingDevice, BasicTriList trilist, uint joinStart, string joinMapKey)
// {
// var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as GenericLightingJoinMap;
using Newtonsoft.Json;
// if (joinMap == null)
// joinMap = new GenericLightingJoinMap();
namespace PepperDash.Essentials.Bridges
{
public static class GenericLightingApiExtensions
{
public static void LinkToApi(this PepperDash.Essentials.Core.Lighting.LightingBase lightingDevice, BasicTriList trilist, uint joinStart, string joinMapKey)
{
GenericLightingJoinMap joinMap = new GenericLightingJoinMap();
// joinMap.OffsetJoinNumbers(joinStart);
// Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey);
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<GenericLightingJoinMap>(joinMapSerialized);
joinMap.OffsetJoinNumbers(joinStart);
Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
Debug.Console(0, "Linking to Lighting Type {0}", lightingDevice.GetType().Name.ToString());
// GenericLighitng Actions & FeedBack
trilist.SetUShortSigAction(joinMap.SelectScene, u => lightingDevice.SelectScene(lightingDevice.LightingScenes[u]));
int sceneIndex = 1;
foreach (var scene in lightingDevice.LightingScenes)
{
var tempIndex = sceneIndex - 1;
trilist.SetSigTrueAction((uint)(joinMap.LightingSceneOffset + sceneIndex), () => lightingDevice.SelectScene(lightingDevice.LightingScenes[tempIndex]));
scene.IsActiveFeedback.LinkInputSig(trilist.BooleanInput[(uint)(joinMap.LightingSceneOffset + sceneIndex)]);
trilist.StringInput[(uint)(joinMap.LightingSceneOffset + sceneIndex)].StringValue = scene.Name;
trilist.BooleanInput[(uint)(joinMap.ButtonVisibilityOffset + sceneIndex)].BoolValue = true;
sceneIndex++;
}
if (lightingDevice.GetType().Name.ToString() == "LutronQuantumArea")
{
var lutronDevice = lightingDevice as PepperDash.Essentials.Devices.Common.Environment.Lutron.LutronQuantumArea;
lutronDevice.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]);
trilist.SetStringSigAction(joinMap.IntegrationIdSet, s => lutronDevice.IntegrationId = s);
}
//ApiEisc.Eisc.SetStringSigAction(ApiMap.integrationID, (s) => { lutronLights.IntegrationId = s; });
/*
var lutronLights = lightingDevice as PepperDash.Essentials.Devices.Common.Environment.Lutron.LutronQuantumArea;
for (uint i = 1; i <= lightingBase.CircuitCount; i++)
{
var circuit = i;
lightingBase.CircuitNameFeedbacks[circuit - 1].LinkInputSig(trilist.StringInput[joinMap.CircuitNames + circuit]);
lightingBase.CircuitIsCritical[circuit - 1].LinkInputSig(trilist.BooleanInput[joinMap.CircuitIsCritical + circuit]);
lightingBase.CircuitState[circuit - 1].LinkInputSig(trilist.BooleanInput[joinMap.CircuitState + circuit]);
trilist.SetSigTrueAction(joinMap.CircuitCycle + circuit, () => lightingBase.CycleCircuit(circuit - 1));
trilist.SetSigTrueAction(joinMap.CircuitOnCmd + circuit, () => lightingBase.TurnOnCircuit(circuit - 1));
trilist.SetSigTrueAction(joinMap.CircuitOffCmd + circuit, () => lightingBase.TurnOffCircuit(circuit - 1));
// Debug.Console(0, "Linking to lighting Type {0}", lightingDevice.GetType().Name.ToString());
// // GenericLighitng Actions & FeedBack
// trilist.SetUShortSigAction(joinMap.SelectScene, u => lightingDevice.SelectScene(lightingDevice.LightingScenes[u]));
// int sceneIndex = 1;
// foreach (var scene in lightingDevice.LightingScenes)
// {
// var tempIndex = sceneIndex - 1;
// trilist.SetSigTrueAction((uint)(joinMap.LightingSceneOffset + sceneIndex), () => lightingDevice.SelectScene(lightingDevice.LightingScenes[tempIndex]));
// scene.IsActiveFeedback.LinkInputSig(trilist.BooleanInput[(uint)(joinMap.LightingSceneOffset + sceneIndex)]);
// trilist.StringInput[(uint)(joinMap.LightingSceneOffset + sceneIndex)].StringValue = scene.Name;
// trilist.BooleanInput[(uint)(joinMap.ButtonVisibilityOffset + sceneIndex)].BoolValue = true;
// sceneIndex++;
// }
// if (lightingDevice.GetType().Name.ToString() == "LutronQuantumArea")
// {
// var lutronDevice = lightingDevice as PepperDash.Essentials.Devices.Common.Environment.Lutron.LutronQuantumArea;
// lutronDevice.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]);
// trilist.SetStringSigAction(joinMap.IntegrationIdSet, s => lutronDevice.IntegrationId = s);
// }
// //ApiEisc.Eisc.SetStringSigAction(ApiMap.integrationID, (s) => { lutronLights.IntegrationId = s; });
// /*
// var lutronLights = lightingDevice as PepperDash.Essentials.Devices.Common.Environment.Lutron.LutronQuantumArea;
// for (uint i = 1; i <= lightingBase.CircuitCount; i++)
// {
// var circuit = i;
// lightingBase.CircuitNameFeedbacks[circuit - 1].LinkInputSig(trilist.StringInput[joinMap.CircuitNames + circuit]);
// lightingBase.CircuitIsCritical[circuit - 1].LinkInputSig(trilist.BooleanInput[joinMap.CircuitIsCritical + circuit]);
// lightingBase.CircuitState[circuit - 1].LinkInputSig(trilist.BooleanInput[joinMap.CircuitState + circuit]);
// trilist.SetSigTrueAction(joinMap.CircuitCycle + circuit, () => lightingBase.CycleCircuit(circuit - 1));
// trilist.SetSigTrueAction(joinMap.CircuitOnCmd + circuit, () => lightingBase.TurnOnCircuit(circuit - 1));
// trilist.SetSigTrueAction(joinMap.CircuitOffCmd + circuit, () => lightingBase.TurnOffCircuit(circuit - 1));
// }
// */
// }
// }
// public class GenericLightingJoinMap : JoinMapBase
// {
// public uint IsOnline { get; set; }
// public uint SelectScene { get; set; }
// public uint LightingSceneOffset { get; set; }
// public uint ButtonVisibilityOffset { get; set; }
// public uint IntegrationIdSet { get; set; }
// public GenericLightingJoinMap()
// {
// // Digital
// IsOnline = 1;
// SelectScene = 1;
// IntegrationIdSet = 1;
// LightingSceneOffset = 10;
// ButtonVisibilityOffset = 40;
// // Analog
// }
// public override void OffsetJoinNumbers(uint joinStart)
// {
// var joinOffset = joinStart - 1;
// IsOnline = IsOnline + joinOffset;
// SelectScene = SelectScene + joinOffset;
// LightingSceneOffset = LightingSceneOffset + joinOffset;
// ButtonVisibilityOffset = ButtonVisibilityOffset + joinOffset;
// }
// }
//}
}
*/
}
}
}

View File

@@ -5,21 +5,24 @@ using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.CrestronIO;
using Newtonsoft.Json;
namespace PepperDash.Essentials.Bridges
{
public static class GenericRelayDeviceApiExtensions
{
public static void LinkToApi(this GenericRelayDevice relay, BasicTriList trilist, uint joinStart, string joinMapKey)
{
var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as GenericRelayControllerJoinMap;
GenericRelayControllerJoinMap joinMap = new GenericRelayControllerJoinMap();
if (joinMap == null)
joinMap = new GenericRelayControllerJoinMap();
var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey);
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<GenericRelayControllerJoinMap>(joinMapSerialized);
joinMap.OffsetJoinNumbers(joinStart);
@@ -45,22 +48,4 @@ namespace PepperDash.Essentials.Bridges
}
}
public class GenericRelayControllerJoinMap : JoinMapBase
{
//Digital
public uint Relay { get; set; }
public GenericRelayControllerJoinMap()
{
Relay = 1;
}
public override void OffsetJoinNumbers(uint joinStart)
{
var joinOffset = joinStart - 1;
Relay = Relay + joinOffset;
}
}
}

View File

@@ -0,0 +1,110 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Essentials.Devices.Common.Occupancy;
using PepperDash.Essentials.Core;
using PepperDash.Core;
using Newtonsoft.Json;
namespace PepperDash.Essentials.Bridges
{
public static class GlsOccupancySensorBaseControllerApiExtensions
{
public static void LinkToApi(this GlsOccupancySensorBaseController occController, BasicTriList trilist, uint joinStart, string joinMapKey)
{
GlsOccupancySensorBaseJoinMap joinMap = new GlsOccupancySensorBaseJoinMap();
var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey);
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<GlsOccupancySensorBaseJoinMap>(joinMapSerialized);
joinMap.OffsetJoinNumbers(joinStart);
Debug.Console(1, occController, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
#region Single and Dual Sensor Stuff
occController.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]);
// Occupied status
trilist.SetSigTrueAction(joinMap.ForceOccupied, new Action(() => occController.ForceOccupied()));
trilist.SetSigTrueAction(joinMap.ForceVacant, new Action(() => occController.ForceVacant()));
occController.RoomIsOccupiedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RoomOccupiedFeedback]);
occController.RoomIsOccupiedFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.RoomVacantFeedback]);
occController.RawOccupancyFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyFeedback]);
// Timouts
trilist.SetUShortSigAction(joinMap.Timeout, new Action<ushort>((u) => occController.SetRemoteTimeout(u)));
occController.CurrentTimeoutFeedback.LinkInputSig(trilist.UShortInput[joinMap.Timeout]);
occController.LocalTimoutFeedback.LinkInputSig(trilist.UShortInput[joinMap.TimeoutLocalFeedback]);
// LED Flash
trilist.SetSigTrueAction(joinMap.EnableLedFlash, new Action(() => occController.SetLedFlashEnable(true)));
trilist.SetSigTrueAction(joinMap.DisableLedFlash, new Action(() => occController.SetLedFlashEnable(false)));
occController.LedFlashEnabledFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.EnableLedFlash]);
// Short Timeout
trilist.SetSigTrueAction(joinMap.EnableShortTimeout, new Action(() => occController.SetShortTimeoutState(true)));
trilist.SetSigTrueAction(joinMap.DisableShortTimeout, new Action(() => occController.SetShortTimeoutState(false)));
occController.ShortTimeoutEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableShortTimeout]);
// PIR Sensor
trilist.SetSigTrueAction(joinMap.EnablePir, new Action(() => occController.SetPirEnable(true)));
trilist.SetSigTrueAction(joinMap.DisablePir, new Action(() => occController.SetPirEnable(false)));
occController.PirSensorEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnablePir]);
// PIR Sensitivity in Occupied State
trilist.SetBoolSigAction(joinMap.IncrementPirInOccupiedState, new Action<bool>((b) => occController.IncrementPirSensitivityInOccupiedState(b)));
trilist.SetBoolSigAction(joinMap.DecrementPirInOccupiedState, new Action<bool>((b) => occController.DecrementPirSensitivityInOccupiedState(b)));
occController.PirSensitivityInOccupiedStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.PirSensitivityInOccupiedState]);
// PIR Sensitivity in Vacant State
trilist.SetBoolSigAction(joinMap.IncrementPirInVacantState, new Action<bool>((b) => occController.IncrementPirSensitivityInVacantState(b)));
trilist.SetBoolSigAction(joinMap.DecrementPirInVacantState, new Action<bool>((b) => occController.DecrementPirSensitivityInVacantState(b)));
occController.PirSensitivityInVacantStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.PirSensitivityInVacantState]);
#endregion
#region Dual Technology Sensor Stuff
var odtOccController = occController as GlsOdtOccupancySensorController;
if (odtOccController != null)
{
// OR When Vacated
trilist.SetBoolSigAction(joinMap.OrWhenVacated, new Action<bool>((b) => odtOccController.SetOrWhenVacatedState(b)));
odtOccController.OrWhenVacatedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.OrWhenVacated]);
// AND When Vacated
trilist.SetBoolSigAction(joinMap.AndWhenVacated, new Action<bool>((b) => odtOccController.SetAndWhenVacatedState(b)));
odtOccController.AndWhenVacatedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.AndWhenVacated]);
// Ultrasonic A Sensor
trilist.SetSigTrueAction(joinMap.EnableUsA, new Action(() => odtOccController.SetUsAEnable(true)));
trilist.SetSigTrueAction(joinMap.DisableUsA, new Action(() => odtOccController.SetUsAEnable(false)));
odtOccController.UltrasonicAEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableUsA]);
// Ultrasonic B Sensor
trilist.SetSigTrueAction(joinMap.EnableUsB, new Action(() => odtOccController.SetUsBEnable(true)));
trilist.SetSigTrueAction(joinMap.DisableUsB, new Action(() => odtOccController.SetUsBEnable(false)));
odtOccController.UltrasonicAEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableUsB]);
// US Sensitivity in Occupied State
trilist.SetBoolSigAction(joinMap.IncrementUsInOccupiedState, new Action<bool>((b) => odtOccController.IncrementUsSensitivityInOccupiedState(b)));
trilist.SetBoolSigAction(joinMap.DecrementUsInOccupiedState, new Action<bool>((b) => odtOccController.DecrementUsSensitivityInOccupiedState(b)));
odtOccController.UltrasonicSensitivityInOccupiedStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.UsSensitivityInOccupiedState]);
// US Sensitivity in Vacant State
trilist.SetBoolSigAction(joinMap.IncrementUsInVacantState, new Action<bool>((b) => odtOccController.IncrementUsSensitivityInVacantState(b)));
trilist.SetBoolSigAction(joinMap.DecrementUsInVacantState, new Action<bool>((b) => odtOccController.DecrementUsSensitivityInVacantState(b)));
odtOccController.UltrasonicSensitivityInVacantStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.UsSensitivityInVacantState]);
}
#endregion
}
}
}

View File

@@ -0,0 +1,66 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.DM;
using Crestron.SimplSharpPro.DM.Endpoints;
using Crestron.SimplSharpPro.DM.Endpoints.Receivers;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.DM;
using Newtonsoft.Json;
namespace PepperDash.Essentials.Bridges
{
public static class HdMdxxxCEControllerApiExtensions
{
public static void LinkToApi(this HdMdxxxCEController hdMdPair, BasicTriList trilist, uint joinStart, string joinMapKey)
{
HdMdxxxCEControllerJoinMap joinMap = new HdMdxxxCEControllerJoinMap();
var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey);
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<HdMdxxxCEControllerJoinMap>(joinMapSerialized);
joinMap.OffsetJoinNumbers(joinStart);
Debug.Console(1, hdMdPair, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
hdMdPair.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]);
hdMdPair.RemoteEndDetectedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RemoteEndDetected]);
trilist.SetSigTrueAction(joinMap.AutoRouteOn, new Action(() => hdMdPair.AutoRouteOn()));
hdMdPair.AutoRouteOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.AutoRouteOn]);
trilist.SetSigTrueAction(joinMap.AutoRouteOff, new Action(() => hdMdPair.AutoRouteOff()));
hdMdPair.AutoRouteOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.AutoRouteOff]);
trilist.SetSigTrueAction(joinMap.PriorityRoutingOn, new Action(() => hdMdPair.PriorityRouteOn()));
hdMdPair.PriorityRoutingOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PriorityRoutingOn]);
trilist.SetSigTrueAction(joinMap.PriorityRoutingOff, new Action(() => hdMdPair.PriorityRouteOff()));
hdMdPair.PriorityRoutingOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.PriorityRoutingOff]);
trilist.SetSigTrueAction(joinMap.InputOnScreenDisplayEnabled, new Action(() => hdMdPair.OnScreenDisplayEnable()));
hdMdPair.InputOnScreenDisplayEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.InputOnScreenDisplayEnabled]);
trilist.SetSigTrueAction(joinMap.AutoRouteOff, new Action(() => hdMdPair.OnScreenDisplayDisable()));
hdMdPair.InputOnScreenDisplayEnabledFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.InputOnScreenDisplayDisabled]);
trilist.SetUShortSigAction(joinMap.VideoSource, new Action<ushort>((i) => hdMdPair.ExecuteSwitch(i, null, eRoutingSignalType.Video | eRoutingSignalType.Audio)));
hdMdPair.VideoSourceFeedback.LinkInputSig(trilist.UShortInput[joinMap.VideoSource]);
trilist.UShortInput[joinMap.SourceCount].UShortValue = (ushort)hdMdPair.InputPorts.Count;
foreach (var input in hdMdPair.InputPorts)
{
var number = Convert.ToUInt16(input.Selector);
hdMdPair.SyncDetectedFeedbacks[number].LinkInputSig(trilist.BooleanInput[joinMap.SyncDetected + number]);
trilist.StringInput[joinMap.SourceNames + number].StringValue = input.Key;
}
}
}
}

View File

@@ -8,17 +8,20 @@ using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using Newtonsoft.Json;
namespace PepperDash.Essentials.Bridges
{
public static class IBasicCommunicationApiExtensions
{
public static void LinkToApi(this GenericComm comm, BasicTriList trilist, uint joinStart, string joinMapKey)
{
var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as IBasicCommunicationJoinMap;
IBasicCommunicationJoinMap joinMap = new IBasicCommunicationJoinMap();
if (joinMap == null)
joinMap = new IBasicCommunicationJoinMap();
var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey);
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<IBasicCommunicationJoinMap>(joinMapSerialized);
joinMap.OffsetJoinNumbers(joinStart);
if (comm.CommPort == null)
@@ -30,14 +33,14 @@ namespace PepperDash.Essentials.Bridges
Debug.Console(1, comm, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
// this is a permanent event handler. This cannot be -= from event
comm.CommPort.TextReceived += (s, a) =>
{
Debug.Console(2, comm, "RX: {0}", a.Text);
trilist.SetString(joinMap.TextReceived, a.Text);
};
comm.CommPort.TextReceived += (s, a) =>
{
Debug.Console(2, comm, "RX: {0}", a.Text);
trilist.SetString(joinMap.TextReceived, a.Text);
};
trilist.SetStringSigAction(joinMap.SendText, new Action<string>(s => comm.CommPort.SendText(s)));
trilist.SetStringSigAction(joinMap.SetPortConfig + 1, new Action<string>(s => comm.SetPortConfig(s)));
trilist.SetStringSigAction(joinMap.SetPortConfig, new Action<string>(s => comm.SetPortConfig(s)));
var sComm = comm.CommPort as ISocketStatus;
if (sComm != null)
@@ -62,46 +65,5 @@ namespace PepperDash.Essentials.Bridges
}));
}
}
public class IBasicCommunicationJoinMap : JoinMapBase
{
//Digital
public uint Connect { get; set; }
public uint Connected { get; set; }
//Analog
public uint Status { get; set; }
// Serial
public uint TextReceived { get; set; }
public uint SendText { get; set; }
public uint SetPortConfig { get; set; }
public IBasicCommunicationJoinMap()
{
TextReceived = 1;
SendText = 1;
SetPortConfig = 2;
Connect = 1;
Connected = 1;
Status = 1;
}
public override void OffsetJoinNumbers(uint joinStart)
{
var joinOffset = joinStart - 1;
TextReceived = TextReceived + joinOffset;
SendText = SendText + joinOffset;
SetPortConfig = SetPortConfig + joinOffset;
Connect = Connect + joinOffset;
Connected = Connected + joinOffset;
Status = Status + joinOffset;
}
}
}
}

View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro.DeviceSupport;
namespace PepperDash.Essentials.Bridges
{
public interface IBridge
{
void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey);
}
}

View File

@@ -6,18 +6,23 @@ using Crestron.SimplSharp;
using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.CrestronIO;
using Newtonsoft.Json;
namespace PepperDash.Essentials.Bridges
{
public static class IDigitalInputApiExtenstions
{
public static void LinkToApi(this IDigitalInput input, BasicTriList trilist, uint joinStart, string joinMapKey)
{
var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as IDigitalInputApiJoinMap;
IDigitalInputJoinMap joinMap = new IDigitalInputJoinMap();
if (joinMap == null)
joinMap = new IDigitalInputApiJoinMap();
var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey);
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<IDigitalInputJoinMap>(joinMapSerialized);
joinMap.OffsetJoinNumbers(joinStart);
@@ -35,25 +40,5 @@ namespace PepperDash.Essentials.Bridges
return;
}
}
}
public class IDigitalInputApiJoinMap : JoinMapBase
{
//Digital
public uint InputState { get; set; }
public IDigitalInputApiJoinMap()
{
InputState = 1;
}
public override void OffsetJoinNumbers(uint joinStart)
{
var joinOffset = joinStart - 1;
InputState = InputState + joinOffset;
}
}
}
}

View File

@@ -0,0 +1,110 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Bridges
{
public class AirMediaControllerJoinMap : JoinMapBase
{
#region Digitals
/// <summary>
/// Indicates that the device is online when high
/// </summary>
public uint IsOnline { get; set; }
/// <summary>
/// Indicates that the device is in session when high
/// </summary>
public uint IsInSession { get; set; }
/// <summary>
/// Indicates sync detected on HDMI input when high
/// </summary>
public uint HdmiVideoSync { get; set; }
/// <summary>
/// Set High to enable automatic input routing and low to disable. Feedback high when enabled
/// </summary>
public uint AutomaticInputRoutingEnabled { get; set; }
#endregion
#region Analogs
/// <summary>
/// Selects source and provides feedback
/// </summary>
public uint VideoOut { get; set; }
/// <summary>
/// Provided error feedback
/// </summary>
public uint ErrorFB { get; set; }
/// <summary>
/// Indicates the number of connected users as feedback
/// </summary>
public uint NumberOfUsersConnectedFB { get; set; }
/// <summary>
/// Sets the login code and provides the current code as feedback
/// </summary>
public uint LoginCode { get; set; }
#endregion
#region Serials
/// <summary>
/// Provides the name defined in config as feedback
/// </summary>
public uint Name { get; set; }
/// <summary>
/// Provides the connection address as feedback
/// </summary>
public uint ConnectionAddressFB { get; set; }
/// <summary>
/// Provides the hostname as feedback
/// </summary>
public uint HostnameFB { get; set; }
/// <summary>
/// Provides the serial number as feedback
/// </summary>
public uint SerialNumberFeedback { get; set; }
#endregion
public AirMediaControllerJoinMap()
{
// Digital
IsOnline = 1;
IsInSession = 2;
HdmiVideoSync = 3;
AutomaticInputRoutingEnabled = 4;
// Analog
VideoOut = 1;
ErrorFB = 2;
NumberOfUsersConnectedFB = 3;
LoginCode = 4;
// Serial
Name = 1;
ConnectionAddressFB = 2;
HostnameFB = 3;
SerialNumberFeedback = 4;
}
public override void OffsetJoinNumbers(uint joinStart)
{
var joinOffset = joinStart - 1;
IsOnline = IsOnline + joinOffset;
IsInSession = IsInSession + joinOffset;
HdmiVideoSync = HdmiVideoSync + joinOffset;
AutomaticInputRoutingEnabled = AutomaticInputRoutingEnabled + joinOffset;
VideoOut = VideoOut + joinOffset;
ErrorFB = ErrorFB + joinOffset;
NumberOfUsersConnectedFB = NumberOfUsersConnectedFB + joinOffset;
LoginCode = LoginCode + joinOffset;
Name = Name + joinOffset;
ConnectionAddressFB = ConnectionAddressFB + joinOffset;
HostnameFB = HostnameFB + joinOffset;
SerialNumberFeedback = SerialNumberFeedback + joinOffset;
}
}
}

View File

@@ -0,0 +1,67 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Bridges
{
public class AppleTvJoinMap : JoinMapBase
{
#region Digitals
/// <summary>
/// Sends up arrow command while high
/// </summary>
public uint UpArrow { get; set; }
/// <summary>
/// Sends down arrow command while high
/// </summary>
public uint DnArrow { get; set; }
/// <summary>
/// Sends left arrow command while high
/// </summary>
public uint LeftArrow { get; set; }
/// <summary>
/// Sends right arrow command while high
/// </summary>
public uint RightArrow { get; set; }
/// <summary>
/// Sends menu command
/// </summary>
public uint Menu { get; set; }
/// <summary>
/// Sends select command
/// </summary>
public uint Select { get; set; }
/// <summary>
/// Sends play/pause command
/// </summary>
public uint PlayPause { get; set; }
#endregion
public AppleTvJoinMap()
{
UpArrow = 1;
DnArrow = 2;
LeftArrow = 3;
RightArrow = 4;
Menu = 5;
Select = 6;
PlayPause = 7;
}
public override void OffsetJoinNumbers(uint joinStart)
{
var joinOffset = joinStart - 1;
UpArrow = UpArrow + joinOffset;
DnArrow = DnArrow + joinOffset;
LeftArrow = LeftArrow + joinOffset;
RightArrow = RightArrow + joinOffset;
Menu = Menu + joinOffset;
Select = Select + joinOffset;
PlayPause = PlayPause + joinOffset;
}
}
}

View File

@@ -0,0 +1,61 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Bridges
{
public class CameraControllerJoinMap : JoinMapBase
{
public uint IsOnline { get; set; }
public uint PowerOff { get; set; }
public uint PowerOn { get; set; }
public uint Up { get; set; }
public uint Down { get; set; }
public uint Left { get; set; }
public uint Right { get; set; }
public uint ZoomIn { get; set; }
public uint ZoomOut { get; set; }
public uint PresetRecallOffset { get; set; }
public uint PresetSaveOffset { get; set; }
public uint NumberOfPresets { get; set; }
public CameraControllerJoinMap()
{
// Digital
IsOnline = 9;
PowerOff = 8;
PowerOn = 7;
Up = 1;
Down = 2;
Left = 3;
Right = 4;
ZoomIn = 5;
ZoomOut = 6;
PresetRecallOffset = 10;
PresetSaveOffset = 30;
NumberOfPresets = 5;
// Analog
}
public override void OffsetJoinNumbers(uint joinStart)
{
var joinOffset = joinStart - 1;
IsOnline = IsOnline + joinOffset;
PowerOff = PowerOff + joinOffset;
PowerOn = PowerOn + joinOffset;
Up = Up + joinOffset;
Down = Down + joinOffset;
Left = Left + joinOffset;
Right = Right + joinOffset;
ZoomIn = ZoomIn + joinOffset;
ZoomOut = ZoomOut + joinOffset;
PresetRecallOffset = PresetRecallOffset + joinOffset;
PresetSaveOffset = PresetSaveOffset + joinOffset;
}
}
}

View File

@@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Bridges
{
public class DigitalLoggerJoinMap : JoinMapBase
{
public uint IsOnline { get; set; }
public uint CircuitNames { get; set; }
public uint CircuitState { get; set; }
public uint CircuitCycle { get; set; }
public uint CircuitIsCritical { get; set; }
public uint CircuitOnCmd { get; set; }
public uint CircuitOffCmd { get; set; }
public DigitalLoggerJoinMap()
{
// Digital
IsOnline = 9;
CircuitState = 0;
CircuitCycle = 0;
CircuitIsCritical = 10;
CircuitOnCmd = 10;
CircuitOffCmd = 20;
// Serial
CircuitNames = 0;
// Analog
}
public override void OffsetJoinNumbers(uint joinStart)
{
var joinOffset = joinStart - 1;
IsOnline = IsOnline + joinOffset;
CircuitNames = CircuitNames + joinOffset;
CircuitState = CircuitState + joinOffset;
CircuitCycle = CircuitCycle + joinOffset;
CircuitIsCritical = CircuitIsCritical + joinOffset;
CircuitOnCmd = CircuitOnCmd + joinOffset;
CircuitOffCmd = CircuitOffCmd + joinOffset;
}
}
}

View File

@@ -0,0 +1,117 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Bridges
{
public class DisplayControllerJoinMap : JoinMapBase
{
#region Digitals
/// <summary>
/// Turns the display off and reports power off feedback
/// </summary>
public uint PowerOff { get; set; }
/// <summary>
/// Turns the display on and repots power on feedback
/// </summary>
public uint PowerOn { get; set; }
/// <summary>
/// Indicates that the display device supports two way communication when high
/// </summary>
public uint IsTwoWayDisplay { get; set; }
/// <summary>
/// Increments the volume while high
/// </summary>
public uint VolumeUp { get; set; }
/// <summary>
/// Decrements teh volume while high
/// </summary>
public uint VolumeDown { get; set; }
/// <summary>
/// Toggles the mute state. Feedback is high when volume is muted
/// </summary>
public uint VolumeMute { get; set; }
/// <summary>
/// Range of digital joins to select inputs and report current input as feedback
/// </summary>
public uint InputSelectOffset { get; set; }
/// <summary>
/// Range of digital joins to report visibility for input buttons
/// </summary>
public uint ButtonVisibilityOffset { get; set; }
/// <summary>
/// High if the device is online
/// </summary>
public uint IsOnline { get; set; }
#endregion
#region Analogs
/// <summary>
/// Analog join to set the input and report current input as feedback
/// </summary>
public uint InputSelect { get; set; }
/// <summary>
/// Sets the volume level and reports the current level as feedback
/// </summary>
public uint VolumeLevel { get; set; }
#endregion
#region Serials
/// <summary>
/// Reports the name of the display as defined in config as feedback
/// </summary>
public uint Name { get; set; }
/// <summary>
/// Range of serial joins that reports the names of the inputs as feedback
/// </summary>
public uint InputNamesOffset { get; set; }
#endregion
public DisplayControllerJoinMap()
{
// Digital
IsOnline = 50;
PowerOff = 1;
PowerOn = 2;
IsTwoWayDisplay = 3;
VolumeUp = 5;
VolumeDown = 6;
VolumeMute = 7;
ButtonVisibilityOffset = 40;
InputSelectOffset = 10;
// Analog
InputSelect = 11;
VolumeLevel = 5;
// Serial
Name = 1;
InputNamesOffset = 10;
}
public override void OffsetJoinNumbers(uint joinStart)
{
var joinOffset = joinStart - 1;
IsOnline = IsOnline + joinOffset;
PowerOff = PowerOff + joinOffset;
PowerOn = PowerOn + joinOffset;
IsTwoWayDisplay = IsTwoWayDisplay + joinOffset;
ButtonVisibilityOffset = ButtonVisibilityOffset + joinOffset;
Name = Name + joinOffset;
InputNamesOffset = InputNamesOffset + joinOffset;
InputSelectOffset = InputSelectOffset + joinOffset;
InputSelect = InputSelect + joinOffset;
VolumeUp = VolumeUp + joinOffset;
VolumeDown = VolumeDown + joinOffset;
VolumeMute = VolumeMute + joinOffset;
VolumeLevel = VolumeLevel + joinOffset;
}
}
}

View File

@@ -0,0 +1,144 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Bridges
{
public class DmChassisControllerJoinMap : JoinMapBase
{
#region Digital/Analogs
/// <summary>
/// Analog input sets System ID, output reports current ID as feedback.
/// Digital input applies System ID, output is high when applying busy.
/// </summary>
public uint SystemId { get; set; }
#endregion
#region Digitals
/// <summary>
/// High when device is online
/// </summary>
public uint IsOnline { get; set; }
/// <summary>
/// Range reports video sync feedback for each input
/// </summary>
public uint VideoSyncStatus { get; set; }
/// <summary>
/// Range reports high if corresponding input's endpoint is online
/// </summary>
public uint InputEndpointOnline { get; set; }
/// <summary>
/// Range reports high if corresponding output's endpoint is online
/// </summary>
public uint OutputEndpointOnline { get; set; }
/// <summary>
/// Range reports high if corresponding input's transmitter supports bridging as a separate device for detailed AV switching, HDCP control, etc.
/// </summary>
public uint TxAdvancedIsPresent { get; set; } // indicates that there is an attached transmitter that should be bridged to be interacted with
#endregion
#region Analogs
/// <summary>
/// Range sets and reports the current video source for the corresponding output
/// </summary>
public uint OutputVideo { get; set; }
/// <summary>
/// Range sets and reports the current audio source for the corresponding output
/// </summary>
public uint OutputAudio { get; set; }
/// <summary>
/// Range sets and reports the current Usb source for the corresponding output
/// </summary>
public uint OutputUsb { get; set; }
/// <summary>
/// Range sets and reports the current Usb source for the corresponding input
/// </summary>
public uint InputUsb { get; set; }
/// <summary>
/// Range sets and reports the current HDCP state for the corresponding input card
/// </summary>
public uint HdcpSupportState { get; set; }
/// <summary>
/// Range reports the highest supported HDCP state level for the corresponding input card
/// </summary>
public uint HdcpSupportCapability { get; set; }
#endregion
#region Serials
/// <summary>
/// Range sets and reports the name for the corresponding input card
/// </summary>
public uint InputNames { get; set; }
/// <summary>
/// Range sets and reports the name for the corresponding output card
/// </summary>
public uint OutputNames { get; set; }
/// <summary>
/// Range reports the name of the current video source for the corresponding output card
/// </summary>
public uint OutputCurrentVideoInputNames { get; set; }
/// <summary>
/// Range reports the name of the current audio source for the corresponding output card
/// </summary>
public uint OutputCurrentAudioInputNames { get; set; }
/// <summary>
/// Range reports the current input resolution for each corresponding input card
/// </summary>
public uint InputCurrentResolution { get; set; }
#endregion
public DmChassisControllerJoinMap()
{
//Digital/Analog
SystemId = 10; // Analog sets/gets SystemId, digital input applies and provides feedback of ID change busy
//Digital
IsOnline = 11;
VideoSyncStatus = 100; //101-299
InputEndpointOnline = 500; //501-699
OutputEndpointOnline = 700; //701-899
TxAdvancedIsPresent = 1000; //1001-1199
//Analog
OutputVideo = 100; //101-299
OutputAudio = 300; //301-499
OutputUsb = 500; //501-699
InputUsb = 700; //701-899
HdcpSupportState = 1000; //1001-1199
HdcpSupportCapability = 1200; //1201-1399
//Serial
InputNames = 100; //101-299
OutputNames = 300; //301-499
OutputCurrentVideoInputNames = 2000; //2001-2199
OutputCurrentAudioInputNames = 2200; //2201-2399
InputCurrentResolution = 2400; // 2401-2599
}
public override void OffsetJoinNumbers(uint joinStart)
{
var joinOffset = joinStart - 1;
SystemId = SystemId + joinOffset;
IsOnline = IsOnline + joinOffset;
OutputVideo = OutputVideo + joinOffset;
OutputAudio = OutputAudio + joinOffset;
OutputUsb = OutputUsb + joinOffset;
InputUsb = InputUsb + joinOffset;
VideoSyncStatus = VideoSyncStatus + joinOffset;
InputNames = InputNames + joinOffset;
OutputNames = OutputNames + joinOffset;
OutputCurrentVideoInputNames = OutputCurrentVideoInputNames + joinOffset;
OutputCurrentAudioInputNames = OutputCurrentAudioInputNames + joinOffset;
InputCurrentResolution = InputCurrentResolution + joinOffset;
InputEndpointOnline = InputEndpointOnline + joinOffset;
OutputEndpointOnline = OutputEndpointOnline + joinOffset;
HdcpSupportState = HdcpSupportState + joinOffset;
HdcpSupportCapability = HdcpSupportCapability + joinOffset;
}
}
}

View File

@@ -0,0 +1,67 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Bridges
{
public class DmRmcControllerJoinMap : JoinMapBase
{
#region Digitals
/// <summary>
/// High when device is online (if not attached to a DMP3 or DM chassis with a CPU3 card
/// </summary>
public uint IsOnline { get; set; }
#endregion
#region Serials
/// <summary>
/// Reports the current output resolution
/// </summary>
public uint CurrentOutputResolution { get; set; }
/// <summary>
/// Reports the EDID manufacturer value
/// </summary>
public uint EdidManufacturer { get; set; }
/// <summary>
/// Reports the EDID Name value
/// </summary>
public uint EdidName { get; set; }
/// <summary>
/// Reports the EDID preffered timing value
/// </summary>
public uint EdidPrefferedTiming { get; set; }
/// <summary>
/// Reports the EDID serial number value
/// </summary>
public uint EdidSerialNumber { get; set; }
#endregion
public DmRmcControllerJoinMap()
{
// Digital
IsOnline = 1;
// Serial
CurrentOutputResolution = 1;
EdidManufacturer = 2;
EdidName = 3;
EdidPrefferedTiming = 4;
EdidSerialNumber = 5;
}
public override void OffsetJoinNumbers(uint joinStart)
{
var joinOffset = joinStart - 1;
IsOnline = IsOnline + joinOffset;
CurrentOutputResolution = CurrentOutputResolution + joinOffset;
EdidManufacturer = EdidManufacturer + joinOffset;
EdidName = EdidName + joinOffset;
EdidPrefferedTiming = EdidPrefferedTiming + joinOffset;
EdidSerialNumber = EdidSerialNumber + joinOffset;
}
}
}

View File

@@ -0,0 +1,83 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Bridges
{
public class DmTxControllerJoinMap : JoinMapBase
{
#region Digitals
/// <summary>
/// High when device is online (if not attached to a DMP3 or DM chassis with a CPU3 card
/// </summary>
public uint IsOnline { get; set; }
/// <summary>
/// High when video sync is detected
/// </summary>
public uint VideoSyncStatus { get; set; }
#endregion
#region Analogs
/// <summary>
/// Sets and reports the video source
/// </summary>
public uint VideoInput { get; set; }
/// <summary>
/// Sets and reports the audio source
/// </summary>
public uint AudioInput { get; set; }
/// <summary>
/// Reports the highest supported HDCP state level for the corresponding input card
/// </summary>
public uint HdcpSupportCapability { get; set; }
/// <summary>
/// Sets and reports the current HDCP state for the corresponding input port
/// </summary>
public uint Port1HdcpState { get; set; }
/// <summary>
/// Sets and reports the current HDCP state for the corresponding input port
/// </summary>
public uint Port2HdcpState { get; set; }
#endregion
#region Serials
/// <summary>
/// Reports the current input resolution
/// </summary>
public uint CurrentInputResolution { get; set; }
#endregion
public DmTxControllerJoinMap()
{
// Digital
IsOnline = 1;
VideoSyncStatus = 2;
// Serial
CurrentInputResolution = 1;
// Analog
VideoInput = 1;
AudioInput = 2;
HdcpSupportCapability = 3;
Port1HdcpState = 4;
Port2HdcpState = 5;
}
public override void OffsetJoinNumbers(uint joinStart)
{
var joinOffset = joinStart - 1;
IsOnline = IsOnline + joinOffset;
VideoSyncStatus = VideoSyncStatus + joinOffset;
CurrentInputResolution = CurrentInputResolution + joinOffset;
VideoInput = VideoInput + joinOffset;
AudioInput = AudioInput + joinOffset;
HdcpSupportCapability = HdcpSupportCapability + joinOffset;
Port1HdcpState = Port1HdcpState + joinOffset;
Port2HdcpState = Port2HdcpState + joinOffset;
}
}
}

View File

@@ -0,0 +1,69 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Bridges
{
public class DmpsAudioOutputControllerJoinMap : JoinMapBase
{
#region Digital/Analog
/// <summary>
/// Range of joins for Master Volume
/// Analog join 1 is volume level and feedback
/// Digital join 1 is Mute on and feedback
/// Digital join 2 is Mute off and feedback
/// Digital join 3 is volume up
/// Digital join 4 is volume down
/// </summary>
public uint MasterVolume { get; set; }
/// <summary>
/// Range of joins for Source Volume
/// Analog join 11 is volume level and feedback
/// Digital join 11 is Mute on and feedback
/// Digital join 12 is Mute off and feedback
/// Digital join 13 is volume up
/// Digital join 14 is volume down
/// </summary>
public uint SourceVolume { get; set; }
/// <summary>
/// Range of joins for Codec1 Volume (if applicable)
/// Analog join 21 is volume level and feedback
/// Digital join 21 is Mute on and feedback
/// Digital join 22 is Mute off and feedback
/// Digital join 23 is volume up
/// Digital join 24 is volume down
/// </summary>
public uint Codec1Volume { get; set; }
/// <summary>
/// Range of joins for Codec2 Volume (if applicable)
/// Analog join 31 is volume level and feedback
/// Digital join 31 is Mute on and feedback
/// Digital join 32 is Mute off and feedback
/// Digital join 33 is volume up
/// Digital join 34 is volume down
/// </summary>
public uint Codec2Volume { get; set; }
#endregion
public DmpsAudioOutputControllerJoinMap()
{
MasterVolume = 1; // 1-10
SourceVolume = 11; // 11-20
Codec1Volume = 21; // 21-30
Codec2Volume = 31; // 31-40
}
public override void OffsetJoinNumbers(uint joinStart)
{
var joinOffset = joinStart;
MasterVolume = MasterVolume + joinOffset;
SourceVolume = SourceVolume + joinOffset;
Codec1Volume = Codec1Volume + joinOffset;
Codec2Volume = Codec2Volume + joinOffset;
}
}
}

View File

@@ -0,0 +1,127 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Bridges
{
public class DmpsRoutingControllerJoinMap : JoinMapBase
{
#region Digitals
/// <summary>
/// Range reports video sync feedback for each input
/// </summary>
public uint VideoSyncStatus { get; set; }
/// <summary>
/// Range reports high if corresponding input's endpoint is online
/// </summary>
public uint InputEndpointOnline { get; set; }
/// <summary>
/// Range reports high if corresponding output's endpoint is online
/// </summary>
public uint OutputEndpointOnline { get; set; }
#endregion
#region Analogs
/// <summary>
/// Range sets and reports the current video source for the corresponding output
/// </summary>
public uint OutputVideo { get; set; }
/// <summary>
/// Range sets and reports the current audio source for the corresponding output
/// </summary>
public uint OutputAudio { get; set; }
/// <summary>
/// Range sets and reports the current Usb source for the corresponding output
/// </summary>
//public uint OutputUsb { get; set; }
///// <summary>
///// Range sets and reports the current Usb source for the corresponding input
///// </summary>
//public uint InputUsb { get; set; }
///// <summary>
///// Range sets and reports the current HDCP state for the corresponding input card
///// </summary>
//public uint HdcpSupportState { get; set; }
///// <summary>
///// Range reports the highest supported HDCP state level for the corresponding input card
///// </summary>
//public uint HdcpSupportCapability { get; set; }
#endregion
#region Serials
/// <summary>
/// Range sets and reports the name for the corresponding input card
/// </summary>
public uint InputNames { get; set; }
/// <summary>
/// Range sets and reports the name for the corresponding output card
/// </summary>
public uint OutputNames { get; set; }
/// <summary>
/// Range reports the name of the current video source for the corresponding output card
/// </summary>
public uint OutputCurrentVideoInputNames { get; set; }
/// <summary>
/// Range reports the name of the current audio source for the corresponding output card
/// </summary>
public uint OutputCurrentAudioInputNames { get; set; }
/// <summary>
/// Range reports the current input resolution for each corresponding input card
/// </summary>
public uint InputCurrentResolution { get; set; }
#endregion
public DmpsRoutingControllerJoinMap()
{
//Digital
VideoSyncStatus = 100; //101-299
InputEndpointOnline = 500; //501-699
OutputEndpointOnline = 700; //701-899
//Analog
OutputVideo = 100; //101-299
OutputAudio = 300; //301-499
//OutputUsb = 500; //501-699
//InputUsb = 700; //701-899
VideoSyncStatus = 100; //101-299
//HdcpSupportState = 1000; //1001-1199
//HdcpSupportCapability = 1200; //1201-1399
//Serial
InputNames = 100; //101-299
OutputNames = 300; //301-499
OutputCurrentVideoInputNames = 2000; //2001-2199
OutputCurrentAudioInputNames = 2200; //2201-2399
InputCurrentResolution = 2400; // 2401-2599
InputEndpointOnline = 500; //501-699
OutputEndpointOnline = 700; //701-899
}
public override void OffsetJoinNumbers(uint joinStart)
{
var joinOffset = joinStart - 1;
OutputVideo = OutputVideo + joinOffset;
OutputAudio = OutputAudio + joinOffset;
//OutputUsb = OutputUsb + joinOffset;
//InputUsb = InputUsb + joinOffset;
VideoSyncStatus = VideoSyncStatus + joinOffset;
InputNames = InputNames + joinOffset;
OutputNames = OutputNames + joinOffset;
OutputCurrentVideoInputNames = OutputCurrentVideoInputNames + joinOffset;
OutputCurrentAudioInputNames = OutputCurrentAudioInputNames + joinOffset;
InputCurrentResolution = InputCurrentResolution + joinOffset;
InputEndpointOnline = InputEndpointOnline + joinOffset;
OutputEndpointOnline = OutputEndpointOnline + joinOffset;
//HdcpSupportState = HdcpSupportState + joinOffset;
//HdcpSupportCapability = HdcpSupportCapability + joinOffset;
}
}
}

View File

@@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Bridges
{
public class GenericLightingJoinMap : JoinMapBase
{
public uint IsOnline { get; set; }
public uint SelectScene { get; set; }
public uint LightingSceneOffset { get; set; }
public uint ButtonVisibilityOffset { get; set; }
public uint IntegrationIdSet { get; set; }
public GenericLightingJoinMap()
{
// Digital
IsOnline = 1;
SelectScene = 1;
IntegrationIdSet = 1;
LightingSceneOffset = 10;
ButtonVisibilityOffset = 40;
// Analog
}
public override void OffsetJoinNumbers(uint joinStart)
{
var joinOffset = joinStart - 1;
IsOnline = IsOnline + joinOffset;
SelectScene = SelectScene + joinOffset;
LightingSceneOffset = LightingSceneOffset + joinOffset;
ButtonVisibilityOffset = ButtonVisibilityOffset + joinOffset;
}
}
}

View File

@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Bridges
{
public class GenericRelayControllerJoinMap : JoinMapBase
{
#region Digitals
/// <summary>
/// Sets and reports the state of the relay (High = closed, Low = Open)
/// </summary>
public uint Relay { get; set; }
#endregion
public GenericRelayControllerJoinMap()
{
Relay = 1;
}
public override void OffsetJoinNumbers(uint joinStart)
{
var joinOffset = joinStart - 1;
Relay = Relay + joinOffset;
}
}
}

View File

@@ -0,0 +1,219 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Bridges
{
public class GlsOccupancySensorBaseJoinMap : JoinMapBase
{
#region Digitals
/// <summary>
/// High when device is online
/// </summary>
public uint IsOnline { get; set; }
/// <summary>
/// Forces the device to report occupied status
/// </summary>
public uint ForceOccupied { get; set; }
/// <summary>
/// Forces the device to report vacant status
/// </summary>
public uint ForceVacant { get; set; }
/// <summary>
/// Enables raw status reporting
/// </summary>
public uint EnableRawStates { get; set; }
/// <summary>
/// High when raw occupancy is detected
/// </summary>
public uint RawOccupancyFeedback { get; set; }
/// <summary>
/// High when occupancy is detected
/// </summary>
public uint RoomOccupiedFeedback { get; set; }
/// <summary>
/// Hich when occupancy is detected in the grace period
/// </summary>
public uint GraceOccupancyDetectedFeedback { get; set; }
/// <summary>
/// High when vacancy is detected
/// </summary>
public uint RoomVacantFeedback { get; set; }
/// <summary>
/// Enables the LED Flash when set high
/// </summary>
public uint EnableLedFlash { get; set; }
/// <summary>
/// Disables the LED flash when set high
/// </summary>
public uint DisableLedFlash { get; set; }
/// <summary>
/// Enables the Short Timeout
/// </summary>
public uint EnableShortTimeout { get; set; }
/// <summary>
/// Disables the Short Timout
/// </summary>
public uint DisableShortTimeout { get; set; }
/// <summary>
/// Set high to enable one technology to trigger occupancy
/// </summary>
public uint OrWhenVacated { get; set; }
/// <summary>
/// Set high to require both technologies to trigger occupancy
/// </summary>
public uint AndWhenVacated { get; set; }
/// <summary>
/// Enables Ultrasonic Sensor A
/// </summary>
public uint EnableUsA { get; set; }
/// <summary>
/// Disables Ultrasonic Sensor A
/// </summary>
public uint DisableUsA { get; set; }
/// <summary>
/// Enables Ultrasonic Sensor B
/// </summary>
public uint EnableUsB { get; set; }
/// <summary>
/// Disables Ultrasonic Sensor B
/// </summary>
public uint DisableUsB { get; set; }
/// <summary>
/// Enables Pir
/// </summary>
public uint EnablePir { get; set; }
/// <summary>
/// Disables Pir
/// </summary>
public uint DisablePir { get; set; }
public uint IncrementUsInOccupiedState { get; set; }
public uint DecrementUsInOccupiedState { get; set; }
public uint IncrementUsInVacantState { get; set; }
public uint DecrementUsInVacantState { get; set; }
public uint IncrementPirInOccupiedState { get; set; }
public uint DecrementPirInOccupiedState { get; set; }
public uint IncrementPirInVacantState { get; set; }
public uint DecrementPirInVacantState { get; set; }
#endregion
#region Analogs
/// <summary>
/// Sets adn reports the remote timeout value
/// </summary>
public uint Timeout { get; set; }
/// <summary>
/// Reports the local timeout value
/// </summary>
public uint TimeoutLocalFeedback { get; set; }
/// <summary>
/// Sets the minimum internal photo sensor value and reports the current level
/// </summary>
public uint InternalPhotoSensorValue { get; set; }
/// <summary>
/// Sets the minimum external photo sensor value and reports the current level
/// </summary>
public uint ExternalPhotoSensorValue { get; set; }
public uint UsSensitivityInOccupiedState { get; set; }
public uint UsSensitivityInVacantState { get; set; }
public uint PirSensitivityInOccupiedState { get; set; }
public uint PirSensitivityInVacantState { get; set; }
#endregion
public GlsOccupancySensorBaseJoinMap()
{
IsOnline = 1;
ForceOccupied = 2;
ForceVacant = 3;
EnableRawStates = 4;
RoomOccupiedFeedback = 2;
GraceOccupancyDetectedFeedback = 3;
RoomVacantFeedback = 4;
RawOccupancyFeedback = 5;
EnableLedFlash = 11;
DisableLedFlash = 12;
EnableShortTimeout = 13;
DisableShortTimeout = 14;
OrWhenVacated = 15;
AndWhenVacated = 16;
EnableUsA = 17;
DisableUsA = 18;
EnableUsB = 19;
DisableUsB = 20;
EnablePir = 21;
DisablePir = 22;
DisablePir = 23;
IncrementUsInOccupiedState = 24;
DecrementUsInOccupiedState = 25;
IncrementUsInVacantState = 26;
DecrementUsInVacantState = 27;
IncrementPirInOccupiedState = 28;
DecrementPirInOccupiedState = 29;
IncrementPirInVacantState = 30;
DecrementPirInVacantState = 31;
Timeout = 1;
TimeoutLocalFeedback = 2;
InternalPhotoSensorValue = 3;
ExternalPhotoSensorValue = 4;
UsSensitivityInOccupiedState = 5;
UsSensitivityInVacantState = 6;
PirSensitivityInOccupiedState = 7;
PirSensitivityInVacantState = 8;
}
public override void OffsetJoinNumbers(uint joinStart)
{
var joinOffset = joinStart - 1;
IsOnline = IsOnline + joinOffset;
ForceOccupied = ForceOccupied + joinOffset;
ForceVacant = ForceVacant + joinOffset;
EnableRawStates = EnableRawStates + joinOffset;
RoomOccupiedFeedback = RoomOccupiedFeedback + joinOffset;
GraceOccupancyDetectedFeedback = GraceOccupancyDetectedFeedback + joinOffset;
RoomVacantFeedback = RoomVacantFeedback + joinOffset;
RawOccupancyFeedback = RawOccupancyFeedback + joinOffset;
EnableLedFlash = EnableLedFlash + joinOffset;
DisableLedFlash = DisableLedFlash + joinOffset;
EnableShortTimeout = EnableShortTimeout + joinOffset;
DisableShortTimeout = DisableShortTimeout + joinOffset;
OrWhenVacated = OrWhenVacated + joinOffset;
AndWhenVacated = AndWhenVacated + joinOffset;
EnableUsA = EnableUsA + joinOffset;
DisableUsA = DisableUsA + joinOffset;
EnableUsB = EnableUsB + joinOffset;
DisableUsB = DisableUsB + joinOffset;
EnablePir = EnablePir + joinOffset;
DisablePir = DisablePir + joinOffset;
DisablePir = DisablePir + joinOffset;
IncrementUsInOccupiedState = IncrementUsInOccupiedState + joinOffset;
DecrementUsInOccupiedState = DecrementUsInOccupiedState + joinOffset;
IncrementUsInVacantState = IncrementUsInVacantState + joinOffset;
DecrementUsInVacantState = DecrementUsInVacantState + joinOffset;
IncrementPirInOccupiedState = IncrementPirInOccupiedState + joinOffset;
DecrementPirInOccupiedState = DecrementPirInOccupiedState + joinOffset;
IncrementPirInVacantState = IncrementPirInVacantState + joinOffset;
DecrementPirInVacantState = DecrementPirInVacantState + joinOffset;
Timeout = Timeout + joinOffset;
TimeoutLocalFeedback = TimeoutLocalFeedback + joinOffset;
InternalPhotoSensorValue = InternalPhotoSensorValue + joinOffset;
ExternalPhotoSensorValue = ExternalPhotoSensorValue + joinOffset;
UsSensitivityInOccupiedState = UsSensitivityInOccupiedState + joinOffset;
UsSensitivityInVacantState = UsSensitivityInVacantState + joinOffset;
PirSensitivityInOccupiedState = PirSensitivityInOccupiedState + joinOffset;
PirSensitivityInVacantState = PirSensitivityInVacantState + joinOffset;
}
}
}

View File

@@ -0,0 +1,119 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Bridges
{
public class HdMdxxxCEControllerJoinMap : JoinMapBase
{
#region Digitals
/// <summary>
/// High when the pair is online
/// </summary>
public uint IsOnline { get; set; }
/// <summary>
/// High when the remote end device is online
/// </summary>
public uint RemoteEndDetected { get; set; }
/// <summary>
/// Sets Auto Route On and provides feedback
/// </summary>
public uint AutoRouteOn { get; set; }
/// <summary>
/// Sets Auto Route Off and provides feedback
/// </summary>
public uint AutoRouteOff { get; set; }
/// <summary>
/// Sets Priority Routing On and provides feedback
/// </summary>
public uint PriorityRoutingOn { get; set; }
/// <summary>
/// Sets Priority Routing Off and provides feedback
/// </summary>
public uint PriorityRoutingOff { get; set; }
/// <summary>
/// Enables OSD and provides feedback
/// </summary>
public uint InputOnScreenDisplayEnabled { get; set; }
/// <summary>
/// Disables OSD and provides feedback
/// </summary>
public uint InputOnScreenDisplayDisabled { get; set; }
/// <summary>
/// Provides Video Sync Detected feedback for each input
/// </summary>
public uint SyncDetected { get; set; }
#endregion
#region Analogs
/// <summary>
/// Sets the video source for the receiver's HDMI out and provides feedback
/// </summary>
public uint VideoSource { get; set; }
/// <summary>
/// Indicates the number of sources supported by the Tx/Rx pair
/// </summary>
public uint SourceCount { get; set; }
#endregion
#region Serials
/// <summary>
/// Indicates the name of each input port
/// </summary>
public uint SourceNames { get; set; }
#endregion
public HdMdxxxCEControllerJoinMap()
{
//Digital
IsOnline = 1;
RemoteEndDetected = 2;
AutoRouteOn = 3;
AutoRouteOff = 4;
PriorityRoutingOn = 5;
PriorityRoutingOff = 6;
InputOnScreenDisplayEnabled = 7;
InputOnScreenDisplayDisabled = 8;
SyncDetected = 10; // 11-15
//Analog
VideoSource = 1;
SourceCount = 2;
//Serials
SourceNames = 10; // 11-15
}
public override void OffsetJoinNumbers(uint joinStart)
{
var joinOffset = joinStart - 1;
IsOnline = IsOnline + joinOffset;
RemoteEndDetected = RemoteEndDetected + joinOffset;
AutoRouteOn = AutoRouteOn + joinOffset;
AutoRouteOff = AutoRouteOff + joinOffset;
PriorityRoutingOn = PriorityRoutingOn + joinOffset;
PriorityRoutingOff = PriorityRoutingOff + joinOffset;
InputOnScreenDisplayEnabled = InputOnScreenDisplayEnabled + joinOffset;
InputOnScreenDisplayDisabled = InputOnScreenDisplayDisabled + joinOffset;
SyncDetected = SyncDetected + joinOffset;
VideoSource = VideoSource + joinOffset;
SourceCount = SourceCount + joinOffset;
SourceNames = SourceNames + joinOffset;
}
}
}

View File

@@ -0,0 +1,67 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Bridges
{
public class IBasicCommunicationJoinMap : JoinMapBase
{
#region Digitals
/// <summary>
/// Set High to connect, Low to disconnect
/// </summary>
public uint Connect { get; set; }
/// <summary>
/// Reports Connected State (High = Connected)
/// </summary>
public uint Connected { get; set; }
#endregion
#region Analogs
/// <summary>
/// Reports the connections status value
/// </summary>
public uint Status { get; set; }
#endregion
#region Serials
/// <summary>
/// Data back from port
/// </summary>
public uint TextReceived { get; set; }
/// <summary>
/// Sends data to the port
/// </summary>
public uint SendText { get; set; }
/// <summary>
/// Takes a JSON serialized string that sets a COM port's parameters
/// </summary>
public uint SetPortConfig { get; set; }
#endregion
public IBasicCommunicationJoinMap()
{
TextReceived = 1;
SendText = 1;
SetPortConfig = 2;
Connect = 1;
Connected = 1;
Status = 1;
}
public override void OffsetJoinNumbers(uint joinStart)
{
var joinOffset = joinStart - 1;
TextReceived = TextReceived + joinOffset;
SendText = SendText + joinOffset;
SetPortConfig = SetPortConfig + joinOffset;
Connect = Connect + joinOffset;
Connected = Connected + joinOffset;
Status = Status + joinOffset;
}
}
}

View File

@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Bridges
{
public class IDigitalInputJoinMap : JoinMapBase
{
#region Digitals
/// <summary>
/// Reports the state of the digital input
/// </summary>
public uint InputState { get; set; }
#endregion
public IDigitalInputJoinMap()
{
InputState = 1;
}
public override void OffsetJoinNumbers(uint joinStart)
{
var joinOffset = joinStart - 1;
InputState = InputState + joinOffset;
}
}
}

View File

@@ -0,0 +1,136 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Bridges
{
public class SystemMonitorJoinMap : JoinMapBase
{
/// <summary>
/// Offset to indicate where the range of iterated program joins will start
/// </summary>
public uint ProgramStartJoin { get; set; }
/// <summary>
/// Offset between each program join set
/// </summary>
public uint ProgramOffsetJoin { get; set; }
#region Digitals
/// <summary>
/// Range Sets and reports whether the corresponding program slot is started
/// </summary>
public uint ProgramStart { get; set; }
/// <summary>
/// Range Sets and reports whether the corresponding program slot is stopped
/// </summary>
public uint ProgramStop { get; set; }
/// <summary>
/// Range Sets and reports whether the corresponding program is registered
/// </summary>
public uint ProgramRegister { get; set; }
/// <summary>
/// Range Sets and reports whether the corresponding program is unregistered
/// </summary>
public uint ProgramUnregister { get; set; }
#endregion
#region Analogs
/// <summary>
/// Sets and reports the time zone
/// </summary>
public uint TimeZone { get; set; }
#endregion
#region Serials
/// <summary>
/// Reports the time zone name
/// </summary>
public uint TimeZoneName { get; set; }
/// <summary>
/// Reports the IO Controller Version
/// </summary>
public uint IOControllerVersion { get; set; }
/// <summary>
/// Reports the SNMP App Version
/// </summary>
public uint SnmpAppVersion { get; set; }
/// <summary>
/// Reports the BACnet App Version
/// </summary>
public uint BACnetAppVersion { get; set; }
/// <summary>
/// Reports the firmware version
/// </summary>
public uint ControllerVersion { get; set; }
/// <summary>
/// Reports the name of the corresponding program
/// </summary>
public uint ProgramName { get; set; }
/// <summary>
/// Reports the compile time of the corresponding program
/// </summary>
public uint ProgramCompiledTime { get; set; }
/// <summary>
/// Reports the Crestron Database version of the corresponding program
/// </summary>
public uint ProgramCrestronDatabaseVersion { get; set; }
/// <summary>
/// Reports the Environment Version of the corresponding program
/// </summary>
public uint ProgramEnvironmentVersion { get; set; }
/// <summary>
/// Serialized JSON output that aggregates the program info of the corresponding program
/// </summary>
public uint AggregatedProgramInfo { get; set; }
#endregion
public SystemMonitorJoinMap()
{
TimeZone = 1;
TimeZoneName = 1;
IOControllerVersion = 2;
SnmpAppVersion = 3;
BACnetAppVersion = 4;
ControllerVersion = 5;
ProgramStartJoin = 10;
ProgramOffsetJoin = 5;
// Offset in groups of 5 joins
ProgramStart = 1;
ProgramStop = 2;
ProgramRegister = 3;
ProgramUnregister = 4;
ProgramName = 1;
ProgramCompiledTime = 2;
ProgramCrestronDatabaseVersion = 3;
ProgramEnvironmentVersion = 4;
AggregatedProgramInfo = 5;
}
public override void OffsetJoinNumbers(uint joinStart)
{
var joinOffset = joinStart - 1;
TimeZone = TimeZone + joinOffset;
TimeZoneName = TimeZoneName + joinOffset;
IOControllerVersion = IOControllerVersion + joinOffset;
SnmpAppVersion = SnmpAppVersion + joinOffset;
BACnetAppVersion = BACnetAppVersion + joinOffset;
ControllerVersion = ControllerVersion + joinOffset;
// Sets the initial join value where the iterated program joins will begin
ProgramStartJoin = ProgramStartJoin + joinOffset;
}
}
}

View File

@@ -9,20 +9,25 @@ using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Monitoring;
using Newtonsoft.Json;
namespace PepperDash.Essentials.Bridges
{
public static class SystemMonitorBridge
{
public static void LinkToApi(this SystemMonitorController systemMonitorController, BasicTriList trilist, uint joinStart, string joinMapKey)
{
var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as SystemMonitorJoinMap;
SystemMonitorJoinMap joinMap = new SystemMonitorJoinMap();
if (joinMap == null)
joinMap = new SystemMonitorJoinMap();
var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey);
if(!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<SystemMonitorJoinMap>(joinMapSerialized);
joinMap.OffsetJoinNumbers(joinStart);
//Debug.Console(1, systemMonitorController, "Linking API starting at join: {0}", joinStart);
Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
Debug.Console(2, systemMonitorController, "Linking API starting at join: {0}", joinStart);
systemMonitorController.TimeZoneFeedback.LinkInputSig(trilist.UShortInput[joinMap.TimeZone]);
//trilist.SetUShortSigAction(joinMap.TimeZone, new Action<ushort>(u => systemMonitorController.SetTimeZone(u)));
@@ -33,18 +38,13 @@ namespace PepperDash.Essentials.Bridges
systemMonitorController.BACnetAppVersionFeedback.LinkInputSig(trilist.StringInput[joinMap.BACnetAppVersion]);
systemMonitorController.ControllerVersionFeedback.LinkInputSig(trilist.StringInput[joinMap.ControllerVersion]);
// iterate the program status feedback collection and map all the joins
var programSlotJoinStart = joinMap.ProgramStartJoin;
foreach (var p in systemMonitorController.ProgramStatusFeedbackCollection)
{
// TODO: link feedbacks for each program slot
var programNumber = p.Value.Program.Number;
//Debug.Console(1, systemMonitorController, "Linking API for Program Slot: {0} starting at join: {1}", programNumber, programSlotJoinStart);
trilist.SetBoolSigAction(programSlotJoinStart + joinMap.ProgramStart, new Action<bool>
(b => SystemMonitor.ProgramCollection[programNumber].OperatingState = eProgramOperatingState.Start));
p.Value.ProgramStartedFeedback.LinkInputSig(trilist.BooleanInput[programSlotJoinStart + joinMap.ProgramStart]);
@@ -63,88 +63,6 @@ namespace PepperDash.Essentials.Bridges
programSlotJoinStart = programSlotJoinStart + joinMap.ProgramOffsetJoin;
}
}
}
public class SystemMonitorJoinMap : JoinMapBase
{
/// <summary>
/// Offset to indicate where the range of iterated program joins will start
/// </summary>
public uint ProgramStartJoin { get; set; }
/// <summary>
/// Offset between each program join set
/// </summary>
public uint ProgramOffsetJoin { get; set; }
//Digital
public uint ProgramStart { get; set; }
public uint ProgramStop { get; set; }
public uint ProgramRegister { get; set; }
public uint ProgramUnregister { get; set; }
//Analog
public uint TimeZone { get; set; }
//Serial
public uint TimeZoneName { get; set; }
public uint IOControllerVersion { get; set; }
public uint SnmpAppVersion { get; set; }
public uint BACnetAppVersion { get; set; }
public uint ControllerVersion { get; set; }
public uint ProgramName { get; set; }
public uint ProgramCompiledTime { get; set; }
public uint ProgramCrestronDatabaseVersion { get; set; }
public uint ProgramEnvironmentVersion { get; set; }
public uint AggregatedProgramInfo { get; set; }
public SystemMonitorJoinMap()
{
TimeZone = 1;
TimeZoneName = 1;
IOControllerVersion = 2;
SnmpAppVersion = 3;
BACnetAppVersion = 4;
ControllerVersion = 5;
ProgramStartJoin = 10;
ProgramOffsetJoin = 5;
// Offset in groups of 5 joins
ProgramStart = 1;
ProgramStop = 2;
ProgramRegister = 3;
ProgramUnregister = 4;
ProgramName = 1;
ProgramCompiledTime = 2;
ProgramCrestronDatabaseVersion = 3;
ProgramEnvironmentVersion = 4;
AggregatedProgramInfo = 5;
}
public override void OffsetJoinNumbers(uint joinStart)
{
var joinOffset = joinStart - 1;
TimeZone = TimeZone + joinOffset;
TimeZoneName = TimeZoneName + joinOffset;
IOControllerVersion = IOControllerVersion + joinOffset;
SnmpAppVersion = SnmpAppVersion + joinOffset;
BACnetAppVersion = BACnetAppVersion + joinOffset;
ControllerVersion = ControllerVersion + joinOffset;
// Sets the initial join value where the iterated program joins will begin
ProgramStartJoin = ProgramStartJoin + joinOffset;
}
}
}

View File

@@ -1,10 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.CrestronThread;
using Crestron.SimplSharpPro.Diagnostics;
using Crestron.SimplSharp.Reflection;
using PepperDash.Core;
using PepperDash.Essentials.Core;
@@ -17,33 +19,35 @@ using PepperDash.Essentials.Room.Cotija;
namespace PepperDash.Essentials
{
public class ControlSystem : CrestronControlSystem
{
public class ControlSystem : CrestronControlSystem
{
HttpLogoServer LogoServer;
public ControlSystem()
: base()
{
Thread.MaxNumberOfUserThreads = 400;
Global.ControlSystem = this;
DeviceManager.Initialize(this);
}
List<object> FactoryObjects = new List<object>();
/// <summary>
/// Git 'er goin'
/// </summary>
public override void InitializeSystem()
{
public ControlSystem()
: base()
{
Thread.MaxNumberOfUserThreads = 400;
Global.ControlSystem = this;
DeviceManager.Initialize(this);
}
/// <summary>
/// Git 'er goin'
/// </summary>
public override void InitializeSystem()
{
DeterminePlatform();
//CrestronConsole.AddNewConsoleCommand(s => GoWithLoad(), "go", "Loads configuration file",
// ConsoleAccessLevelEnum.AccessOperator);
// CrestronConsole.AddNewConsoleCommand(S => { ConfigWriter.WriteConfigFile(null); }, "writeconfig", "writes the current config to a file", ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(s =>
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "CONSOLE MESSAGE: {0}", s);
}, "appdebugmessage", "Writes message to log", ConsoleAccessLevelEnum.AccessOperator);
// CrestronConsole.AddNewConsoleCommand(S => { ConfigWriter.WriteConfigFile(null); }, "writeconfig", "writes the current config to a file", ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(s =>
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "CONSOLE MESSAGE: {0}", s);
}, "appdebugmessage", "Writes message to log", ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(s =>
{
@@ -52,26 +56,26 @@ namespace PepperDash.Essentials
},
"listtielines", "Prints out all tie lines", ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(s =>
{
CrestronConsole.ConsoleCommandResponse
("Current running configuration. This is the merged system and template configuration");
CrestronConsole.ConsoleCommandResponse(Newtonsoft.Json.JsonConvert.SerializeObject
(ConfigReader.ConfigObject, Newtonsoft.Json.Formatting.Indented));
}, "showconfig", "Shows the current running merged config", ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(s =>
{
CrestronConsole.ConsoleCommandResponse
("Current running configuration. This is the merged system and template configuration");
CrestronConsole.ConsoleCommandResponse(Newtonsoft.Json.JsonConvert.SerializeObject
(ConfigReader.ConfigObject, Newtonsoft.Json.Formatting.Indented));
}, "showconfig", "Shows the current running merged config", ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(s =>
{
CrestronConsole.ConsoleCommandResponse("This system can be found at the following URLs:\r" +
"System URL: {0}\r" +
"Template URL: {1}", ConfigReader.ConfigObject.SystemUrl, ConfigReader.ConfigObject.TemplateUrl);
}, "portalinfo", "Shows portal URLS from configuration", ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(s =>
{
CrestronConsole.ConsoleCommandResponse("This system can be found at the following URLs:\r" +
"System URL: {0}\r" +
"Template URL: {1}", ConfigReader.ConfigObject.SystemUrl, ConfigReader.ConfigObject.TemplateUrl);
}, "portalinfo", "Shows portal URLS from configuration", ConsoleAccessLevelEnum.AccessOperator);
GoWithLoad();
}
}
/// <summary>
/// Determines if the program is running on a processor (appliance) or server (XiO Edge).
/// Determines if the program is running on a processor (appliance) or server (VC-4).
///
/// Sets Global.FilePathPrefix based on platform
/// </summary>
@@ -96,11 +100,11 @@ namespace PepperDash.Essentials
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Starting Essentials v{0} on 3-series Appliance", versionString);
// Check if User/ProgramX exists
if(Directory.Exists(directoryPrefix + dirSeparator + "User"
if (Directory.Exists(directoryPrefix + dirSeparator + "User"
+ dirSeparator + string.Format("program{0}", InitialParametersClass.ApplicationNumber)))
{
Debug.Console(0, @"User/program{0} directory found", InitialParametersClass.ApplicationNumber);
filePathPrefix = directoryPrefix + dirSeparator + "User"
filePathPrefix = directoryPrefix + dirSeparator + "User"
+ dirSeparator + string.Format("program{0}", InitialParametersClass.ApplicationNumber) + dirSeparator;
}
// Check if Nvram/Programx exists
@@ -130,87 +134,175 @@ namespace PepperDash.Essentials
Global.SetFilePathPrefix(filePathPrefix);
}
/// <summary>
/// Do it, yo
/// </summary>
public void GoWithLoad()
{
try
{
CrestronConsole.AddNewConsoleCommand(EnablePortalSync, "portalsync", "Loads Portal Sync",
ConsoleAccessLevelEnum.AccessOperator);
//PortalSync = new PepperDashPortalSyncClient();
/// <summary>
/// Do it, yo
/// </summary>
public void GoWithLoad()
{
try
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Starting Essentials load from configuration");
var filesReady = SetupFilesystem();
if (filesReady)
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Folder structure verified. Loading config...");
if (!ConfigReader.LoadConfig2())
return;
var filesReady = SetupFilesystem();
if (filesReady)
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Checking for plugins");
LoadPlugins();
Load();
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Folder structure verified. Loading config...");
if (!ConfigReader.LoadConfig2())
return;
Load();
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Essentials load complete\r" +
"-------------------------------------------------------------");
}
else
{
Debug.Console(0,
"------------------------------------------------\r" +
"------------------------------------------------\r" +
"------------------------------------------------\r" +
"Essentials file structure setup completed.\r" +
"Please load config, sgd and ir files and\r" +
"restart program.\r" +
"------------------------------------------------\r" +
"------------------------------------------------\r" +
"------------------------------------------------");
}
"-------------------------------------------------------------");
}
else
{
Debug.Console(0,
"------------------------------------------------\r" +
"------------------------------------------------\r" +
"------------------------------------------------\r" +
"Essentials file structure setup completed.\r" +
"Please load config, sgd and ir files and\r" +
"restart program.\r" +
"------------------------------------------------\r" +
"------------------------------------------------\r" +
"------------------------------------------------");
}
}
catch (Exception e)
{
Debug.Console(0, "FATAL INITIALIZE ERROR. System is in an inconsistent state:\r{0}", e);
catch (Exception e)
{
Debug.Console(0, "FATAL INITIALIZE ERROR. System is in an inconsistent state:\r{0}", e);
}
}
// Notify the
// Notify the OS that the program intitialization has completed
SystemMonitor.ProgramInitialization.ProgramInitializationComplete = true;
}
}
/// <summary>
/// Verifies filesystem is set up. IR, SGD, and programX folders
/// </summary>
bool SetupFilesystem()
{
Debug.Console(0, "Verifying and/or creating folder structure");
var configDir = Global.FilePathPrefix;
var configExists = Directory.Exists(configDir);
if (!configExists)
Directory.Create(configDir);
/// <summary>
/// Initial simple implementation. Reads user/programN/plugins folder and
/// use
/// </summary>
void LoadPlugins()
{
var dir = Global.FilePathPrefix + "plugins";
if (Directory.Exists(dir))
{
// TODO Clear out or create localPlugins folder (maybe in program slot folder)
var irDir = Global.FilePathPrefix + "ir";
if (!Directory.Exists(irDir))
Directory.Create(irDir);
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Plugins directory found, checking for factory plugins");
var di = new DirectoryInfo(dir);
var zFiles = di.GetFiles("*.cplz");
foreach (var fi in zFiles)
{
Debug.Console(0, "Found cplz: {0}. Unzipping into plugins directory", fi.Name);
var result = CrestronZIP.Unzip(fi.FullName, di.FullName);
Debug.Console(0, "UnZip Result: {0}", result.ToString());
fi.Delete();
}
var files = di.GetFiles("*.dll");
Dictionary<string, Assembly> assyList = new Dictionary<string, Assembly>();
foreach (FileInfo fi in files)
{
// TODO COPY plugin to loadedPlugins folder
// TODO LOAD that loadedPlugins dll file
try
{
var assy = Assembly.LoadFrom(fi.FullName);
var ver = assy.GetName().Version;
var verStr = string.Format("{0}.{1}.{2}.{3}", ver.Major, ver.Minor, ver.Build, ver.Revision);
assyList.Add(fi.FullName, assy);
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Loaded plugin file '{0}', version {1}", fi.FullName, verStr);
}
catch
{
Debug.Console(2, "Assembly {0} is not a custom assembly", fi.FullName);
continue; //catching any load issues and continuing. There will be exceptions loading Crestron .dlls from the cplz Probably should do something different here
}
}
foreach (var assy in assyList)
{
// iteratate this assembly's classes, looking for "LoadPlugin()" methods
try
{
var types = assy.Value.GetTypes();
foreach (var type in types)
{
try
{
var methods = type.GetMethods(BindingFlags.Public | BindingFlags.Static);
var loadPlugin = methods.FirstOrDefault(m => m.Name.Equals("LoadPlugin"));
if (loadPlugin != null)
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Adding type {0}", assy.Key, type.FullName);
loadPlugin.Invoke(null, null);
}
}
catch
{
Debug.Console(2, "Load Plugin not found. {0} is not a plugin assembly", assy.Value.FullName);
continue;
}
}
}
catch
{
Debug.Console(2, "Assembly {0} is not a custom assembly. Types cannot be loaded.", assy.Value.FullName);
continue;
}
}
// plugin dll will be loaded. Any classes in plugin should have a static constructor
// that registers that class with the Core.DeviceFactory
}
}
/// <summary>
/// Verifies filesystem is set up. IR, SGD, and programX folders
/// </summary>
bool SetupFilesystem()
{
Debug.Console(0, "Verifying and/or creating folder structure");
var configDir = Global.FilePathPrefix;
var configExists = Directory.Exists(configDir);
if (!configExists)
Directory.Create(configDir);
var irDir = Global.FilePathPrefix + "ir";
if (!Directory.Exists(irDir))
Directory.Create(irDir);
var sgdDir = Global.FilePathPrefix + "sgd";
if (!Directory.Exists(sgdDir))
Directory.Create(sgdDir);
var pluginDir = Global.FilePathPrefix + "plugins";
if (!Directory.Exists(pluginDir))
Directory.Create(pluginDir);
return configExists;
}
public void EnablePortalSync(string s)
{
if (s.ToLower() == "enable")
{
CrestronConsole.ConsoleCommandResponse("Portal Sync features enabled");
}
}
///// <summary>
/////
///// </summary>
///// <param name="s"></param>
//public void EnablePortalSync(string s)
//{
// if (s.ToLower() == "enable")
// {
// CrestronConsole.ConsoleCommandResponse("Portal Sync features enabled");
// }
//}
/// <summary>
///
/// </summary>
public void TearDown()
{
Debug.Console(0, "Tearing down existing system");
@@ -237,7 +329,7 @@ namespace PepperDash.Essentials
DeviceManager.ActivateAll();
LinkSystemMonitorToAppServer();
}
}
void LinkSystemMonitorToAppServer()
{
@@ -254,45 +346,62 @@ namespace PepperDash.Essentials
messenger.RegisterWithAppServer(appServer);
DeviceManager.AddDevice(messenger);
DeviceManager.AddDevice(messenger);
}
}
/// <summary>
/// Reads all devices from config and adds them to DeviceManager
/// </summary>
public void LoadDevices()
{
// Build the processor wrapper class
DeviceManager.AddDevice(new PepperDash.Essentials.Core.Devices.CrestronProcessor("processor"));
/// <summary>
/// Reads all devices from config and adds them to DeviceManager
/// </summary>
public void LoadDevices()
{
// Build the processor wrapper class
DeviceManager.AddDevice(new PepperDash.Essentials.Core.Devices.CrestronProcessor("processor"));
// Check if the processor is a DMPS model
if (this.ControllerPrompt.IndexOf("dmps", StringComparison.OrdinalIgnoreCase) > -1)
{
Debug.Console(2, "Adding DmpsRoutingController for {0} to Device Manager.", this.ControllerPrompt);
var dmpsRoutingController = DmpsRoutingController.GetDmpsRoutingController("processor-avRouting", this.ControllerPrompt, new DM.Config.DmpsRoutingPropertiesConfig());
DeviceManager.AddDevice(dmpsRoutingController);
}
else
{
Debug.Console(2, "************Processor is not DMPS type***************");
}
// Add global System Monitor device
DeviceManager.AddDevice(new PepperDash.Essentials.Core.Monitoring.SystemMonitorController("systemMonitor"));
foreach (var devConf in ConfigReader.ConfigObject.Devices)
{
foreach (var devConf in ConfigReader.ConfigObject.Devices)
{
try
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Creating device '{0}'", devConf.Key);
// Skip this to prevent unnecessary warnings
try
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Creating device '{0}', type '{1}'", devConf.Key, devConf.Type);
// Skip this to prevent unnecessary warnings
if (devConf.Key == "processor")
{
if (devConf.Type.ToLower() != Global.ControlSystem.ControllerPrompt.ToLower())
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());
devConf.Type.ToUpper(), Global.ControlSystem.ControllerPrompt.ToUpper());
continue;
}
// Try local factories first
var newDev = DeviceFactory.GetDevice(devConf);
// Try local factories first
var newDev = DeviceFactory.GetDevice(devConf);
if (newDev == null)
newDev = BridgeFactory.GetDevice(devConf);
// Then associated library factories
// Then associated library factories
if (newDev == null)
newDev = PepperDash.Essentials.Core.DeviceFactory.GetDevice(devConf);
if (newDev == null)
@@ -301,78 +410,90 @@ namespace PepperDash.Essentials
newDev = PepperDash.Essentials.DM.DeviceFactory.GetDevice(devConf);
if (newDev == null)
newDev = PepperDash.Essentials.Devices.Displays.DisplayDeviceFactory.GetDevice(devConf);
if (newDev == null)
newDev = PepperDash.Essentials.BridgeFactory.GetDevice(devConf);
//if (newDev == null) // might want to consider the ability to override an essentials "type"
//{
// // iterate plugin factories
// foreach (var f in FactoryObjects)
// {
// var cresFactory = f as IGetCrestronDevice;
// if (cresFactory != null)
// {
// newDev = cresFactory.GetDevice(devConf, this);
// }
// }
//}
if (newDev != null)
DeviceManager.AddDevice(newDev);
else
Debug.Console(0, Debug.ErrorLogLevel.Notice, "ERROR: Cannot load unknown device type '{0}', key '{1}'.", devConf.Type, devConf.Key);
}
catch (Exception e)
{
}
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.Notice, "All Devices Loaded.");
}
}
/// <summary>
/// Helper method to load tie lines. This should run after devices have loaded
/// </summary>
public void LoadTieLines()
{
// In the future, we can't necessarily just clear here because devices
// might be making their own internal sources/tie lines
/// <summary>
/// Helper method to load tie lines. This should run after devices have loaded
/// </summary>
public void LoadTieLines()
{
// In the future, we can't necessarily just clear here because devices
// might be making their own internal sources/tie lines
var tlc = TieLineCollection.Default;
//tlc.Clear();
if (ConfigReader.ConfigObject.TieLines == null)
{
return;
}
var tlc = TieLineCollection.Default;
//tlc.Clear();
if (ConfigReader.ConfigObject.TieLines == null)
{
return;
}
foreach (var tieLineConfig in ConfigReader.ConfigObject.TieLines)
{
var newTL = tieLineConfig.GetTieLine();
if (newTL != null)
tlc.Add(newTL);
}
foreach (var tieLineConfig in ConfigReader.ConfigObject.TieLines)
{
var newTL = tieLineConfig.GetTieLine();
if (newTL != null)
tlc.Add(newTL);
}
Debug.Console(0, Debug.ErrorLogLevel.Notice, "All Tie Lines Loaded.");
}
}
/// <summary>
/// Reads all rooms from config and adds them to DeviceManager
/// </summary>
public void LoadRooms()
{
if (ConfigReader.ConfigObject.Rooms == null)
{
Debug.Console(0, Debug.ErrorLogLevel.Warning, "WARNING: Configuration contains no rooms");
return;
}
/// <summary>
/// Reads all rooms from config and adds them to DeviceManager
/// </summary>
public void LoadRooms()
{
if (ConfigReader.ConfigObject.Rooms == null)
{
Debug.Console(0, Debug.ErrorLogLevel.Warning, "WARNING: Configuration contains no rooms");
return;
}
foreach (var roomConfig in ConfigReader.ConfigObject.Rooms)
{
foreach (var roomConfig in ConfigReader.ConfigObject.Rooms)
{
var room = EssentialsRoomConfigHelper.GetRoomObject(roomConfig) as EssentialsRoomBase;
if (room != null)
{
if (room != null)
{
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 EssentialsHuddleSpaceFusionSystemControllerBase((EssentialsHuddleSpaceRoom)room, 0xf1));
DeviceManager.AddDevice(new Core.Fusion.EssentialsHuddleSpaceFusionSystemControllerBase((EssentialsHuddleSpaceRoom)room, 0xf1));
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Cotija Bridge...");
// Cotija bridge
var bridge = new CotijaEssentialsHuddleSpaceRoomBridge(room as EssentialsHuddleSpaceRoom);
AddBridgePostActivationHelper(bridge); // Lets things happen later when all devices are present
DeviceManager.AddDevice(bridge);
// Cotija bridge
var bridge = new CotijaEssentialsHuddleSpaceRoomBridge(room as EssentialsHuddleSpaceRoom);
AddBridgePostActivationHelper(bridge); // Lets things happen later when all devices are present
DeviceManager.AddDevice(bridge);
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Cotija Bridge Added...");
}
@@ -383,60 +504,60 @@ namespace PepperDash.Essentials
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Room is EssentialsHuddleVtc1Room, attempting to add to DeviceManager with Fusion");
DeviceManager.AddDevice(new EssentialsHuddleVtc1FusionController((EssentialsHuddleVtc1Room)room, 0xf1));
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Cotija Bridge...");
// Cotija bridge
var bridge = new CotijaEssentialsHuddleSpaceRoomBridge(room);
AddBridgePostActivationHelper(bridge); // Lets things happen later when all devices are present
DeviceManager.AddDevice(bridge);
}
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Cotija Bridge...");
// Cotija bridge
var bridge = new CotijaEssentialsHuddleSpaceRoomBridge(room);
AddBridgePostActivationHelper(bridge); // Lets things happen later when all devices are present
DeviceManager.AddDevice(bridge);
}
else
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Room is NOT EssentialsRoom, attempting to add to DeviceManager w/o Fusion");
DeviceManager.AddDevice(room);
}
}
else
}
else
Debug.Console(0, Debug.ErrorLogLevel.Notice, "WARNING: Cannot create room from config, key '{0}'", roomConfig.Key);
}
}
Debug.Console(0, Debug.ErrorLogLevel.Notice, "All Rooms Loaded.");
}
}
/// <summary>
/// Helps add the post activation steps that link bridges to main controller
/// </summary>
/// <param name="bridge"></param>
void AddBridgePostActivationHelper(CotijaBridgeBase bridge)
{
bridge.AddPostActivationAction(() =>
{
var parent = DeviceManager.AllDevices.FirstOrDefault(d => d.Key == "appServer") as CotijaSystemController;
if (parent == null)
{
Debug.Console(0, bridge, "ERROR: Cannot connect app server room bridge. System controller not present");
return;
}
Debug.Console(0, bridge, "Linking to parent controller");
bridge.AddParent(parent);
parent.AddBridge(bridge);
});
}
/// <summary>
/// Helps add the post activation steps that link bridges to main controller
/// </summary>
/// <param name="bridge"></param>
void AddBridgePostActivationHelper(CotijaBridgeBase bridge)
{
bridge.AddPostActivationAction(() =>
{
var parent = DeviceManager.AllDevices.FirstOrDefault(d => d.Key == "appServer") as CotijaSystemController;
if (parent == null)
{
Debug.Console(0, bridge, "ERROR: Cannot connect app server room bridge. System controller not present");
return;
}
Debug.Console(0, bridge, "Linking to parent controller");
bridge.AddParent(parent);
parent.AddBridge(bridge);
});
}
/// <summary>
/// Fires up a logo server if not already running
/// </summary>
void LoadLogoServer()
{
try
{
/// <summary>
/// Fires up a logo server if not already running
/// </summary>
void LoadLogoServer()
{
try
{
LogoServer = new HttpLogoServer(8080, Global.DirectorySeparator + "html" + Global.DirectorySeparator + "logo");
}
catch (Exception)
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "NOTICE: Logo server cannot be started. Likely already running in another program");
}
}
}
catch (Exception)
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "NOTICE: Logo server cannot be started. Likely already running in another program");
}
}
}
}

View File

@@ -12,6 +12,32 @@ namespace PepperDash.Essentials
{
public class Amplifier : Device, IRoutingSinkNoSwitching
{
public event SourceInfoChangeHandler CurrentSourceChange;
public string CurrentSourceInfoKey { get; set; }
public SourceListItem CurrentSourceInfo
{
get
{
return _CurrentSourceInfo;
}
set
{
if (value == _CurrentSourceInfo) return;
var handler = CurrentSourceChange;
if (handler != null)
handler(_CurrentSourceInfo, ChangeType.WillChange);
_CurrentSourceInfo = value;
if (handler != null)
handler(_CurrentSourceInfo, ChangeType.DidChange);
}
}
SourceListItem _CurrentSourceInfo;
public RoutingInputPort AudioIn { get; private set; }
public Amplifier(string key, string name)

View File

@@ -43,13 +43,13 @@ namespace PepperDash.Essentials
return new Device(key, name);
}
// MOVE into something else???
else if (typeName == "basicirdisplay")
{
var ir = IRPortHelper.GetIrPort(properties);
if (ir != null)
return new BasicIrDisplay(key, name, ir.Port, ir.FileName);
}
//// MOVE into something else???
//else if (typeName == "basicirdisplay")
//{
// var ir = IRPortHelper.GetIrPort(properties);
// if (ir != null)
// return new BasicIrDisplay(key, name, ir.Port, ir.FileName);
//}
else if (typeName == "commmock")
{
@@ -87,7 +87,7 @@ namespace PepperDash.Essentials
else if (typeName == "roomonwhenoccupancydetectedfeature")
{
return new Room.Behaviours.RoomOnToDefaultSourceWhenOccupied(dc);
return new RoomOnToDefaultSourceWhenOccupied(dc);
}
return null;

View File

@@ -1,162 +1,185 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.UI;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.PageManagers;
namespace PepperDash.Essentials
{
public class UiDeviceFactory
{
public static IKeyed GetUiDevice(DeviceConfig config)
{
var comm = CommFactory.GetControlPropertiesConfig(config);
var props = JsonConvert.DeserializeObject<CrestronTouchpanelPropertiesConfig>(config.Properties.ToString());
EssentialsTouchpanelController panelController = new EssentialsTouchpanelController(config.Key, config.Name, config.Type, props, comm.IpIdInt);
panelController.AddPostActivationAction(() =>
{
var mainDriver = new EssentialsPanelMainInterfaceDriver(panelController.Panel, props);
// Then the sub drivers
// spin up different room drivers depending on room type
var room = DeviceManager.GetDeviceForKey(props.DefaultRoomKey);
if (room is EssentialsHuddleSpaceRoom)
{
// Header Driver
Debug.Console(0, panelController, "Adding header driver");
mainDriver.HeaderDriver = new EssentialsHeaderDriver(mainDriver, props);
// AV Driver
Debug.Console(0, panelController, "Adding huddle space AV driver");
var avDriver = new EssentialsHuddlePanelAvFunctionsDriver(mainDriver, props);
avDriver.DefaultRoomKey = props.DefaultRoomKey;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.UI;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.PageManagers;
using PepperDash.Essentials.DM.Endpoints.DGEs;
namespace PepperDash.Essentials
{
public class UiDeviceFactory
{
public static IKeyed GetUiDevice(DeviceConfig config)
{
var comm = CommFactory.GetControlPropertiesConfig(config);
var typeName = config.Type.ToLower();
EssentialsTouchpanelController panelController = null;
var props = JsonConvert.DeserializeObject<CrestronTouchpanelPropertiesConfig>(config.Properties.ToString());
if (typeName.Contains("dge"))
{
Dge100 dgeDevice = null;
if (typeName == "dge100")
dgeDevice = new Dge100(comm.IpIdInt, Global.ControlSystem);
else if (typeName == "dmdge200c")
dgeDevice = new DmDge200C(comm.IpIdInt, Global.ControlSystem);
var dgeController = new DgeController(config.Key, config.Name, dgeDevice, config, props);
DeviceManager.AddDevice(dgeController);
panelController = new EssentialsTouchpanelController(config.Key, config.Name, dgeController.DigitalGraphicsEngine,
props.ProjectName, props.SgdFile);
}
else
{
panelController = new EssentialsTouchpanelController(config.Key, config.Name, config.Type, props, comm.IpIdInt);
}
panelController.AddPostActivationAction(() =>
{
var mainDriver = new EssentialsPanelMainInterfaceDriver(panelController.Panel, props);
// Then the sub drivers
// spin up different room drivers depending on room type
var room = DeviceManager.GetDeviceForKey(props.DefaultRoomKey);
if (room is EssentialsHuddleSpaceRoom)
{
// Header Driver
Debug.Console(0, panelController, "Adding header driver");
mainDriver.HeaderDriver = new EssentialsHeaderDriver(mainDriver, props);
// AV Driver
Debug.Console(0, panelController, "Adding huddle space AV driver");
var avDriver = new EssentialsHuddlePanelAvFunctionsDriver(mainDriver, props);
avDriver.DefaultRoomKey = props.DefaultRoomKey;
mainDriver.AvDriver = avDriver;
avDriver.CurrentRoom = room as EssentialsHuddleSpaceRoom;
// Environment Driver
if (avDriver.CurrentRoom.PropertiesConfig.Environment != null && avDriver.CurrentRoom.PropertiesConfig.Environment.DeviceKeys.Count > 0)
{
Debug.Console(0, panelController, "Adding environment driver");
mainDriver.EnvironmentDriver = new EssentialsEnvironmentDriver(mainDriver, props);
mainDriver.EnvironmentDriver.GetDevicesFromConfig(avDriver.CurrentRoom.PropertiesConfig.Environment);
}
mainDriver.HeaderDriver.SetupHeaderButtons(avDriver, avDriver.CurrentRoom);
panelController.LoadAndShowDriver(mainDriver); // This is a little convoluted.
if (panelController.Panel is TswFt5ButtonSystem)
{
var tsw = panelController.Panel as TswFt5ButtonSystem;
// Wire up hard keys
tsw.Power.UserObject = new Action<bool>(b => { if (!b) avDriver.PowerButtonPressed(); });
//tsw.Home.UserObject = new Action<bool>(b => { if (!b) HomePressed(); });
if(mainDriver.EnvironmentDriver != null)
tsw.Lights.UserObject = new Action<bool>(b =>
{
if (!b)
{
//mainDriver.AvDriver.PopupInterlock.ShowInterlockedWithToggle(mainDriver.EnvironmentDriver.BackgroundSubpageJoin);
mainDriver.EnvironmentDriver.Toggle();
}
});
tsw.Up.UserObject = new Action<bool>(avDriver.VolumeUpPress);
tsw.Down.UserObject = new Action<bool>(avDriver.VolumeDownPress);
}
}
//else if (room is EssentialsPresentationRoom)
//{
// Debug.Console(0, panelController, "Adding presentation room driver");
// var avDriver = new EssentialsPresentationPanelAvFunctionsDriver(mainDriver, props);
// avDriver.CurrentRoom = room as EssentialsPresentationRoom;
// avDriver.DefaultRoomKey = props.DefaultRoomKey;
// mainDriver.AvDriver = avDriver ;
// mainDriver.HeaderDriver = new EssentialsHeaderDriver(mainDriver, props);
// panelController.LoadAndShowDriver(mainDriver);
// if (panelController.Panel is TswFt5ButtonSystem)
// {
// var tsw = panelController.Panel as TswFt5ButtonSystem;
// // Wire up hard keys
// tsw.Power.UserObject = new Action<bool>(b => { if (!b) avDriver.PowerButtonPressed(); });
// //tsw.Home.UserObject = new Action<bool>(b => { if (!b) HomePressed(); });
// tsw.Up.UserObject = new Action<bool>(avDriver.VolumeUpPress);
// tsw.Down.UserObject = new Action<bool>(avDriver.VolumeDownPress);
// }
//}
else if (room is EssentialsHuddleVtc1Room)
{
Debug.Console(0, panelController, "Adding huddle space VTC AV driver");
// Header Driver
mainDriver.HeaderDriver = new EssentialsHeaderDriver(mainDriver, props);
// AV Driver
var avDriver = new EssentialsHuddleVtc1PanelAvFunctionsDriver(mainDriver, props);
var codecDriver = new PepperDash.Essentials.UIDrivers.VC.EssentialsVideoCodecUiDriver(panelController.Panel, avDriver,
(room as EssentialsHuddleVtc1Room).VideoCodec, mainDriver.HeaderDriver);
avDriver.SetVideoCodecDriver(codecDriver);
avDriver.DefaultRoomKey = props.DefaultRoomKey;
// Environment Driver
if (avDriver.CurrentRoom.PropertiesConfig.Environment != null && avDriver.CurrentRoom.PropertiesConfig.Environment.DeviceKeys.Count > 0)
{
Debug.Console(0, panelController, "Adding environment driver");
mainDriver.EnvironmentDriver = new EssentialsEnvironmentDriver(mainDriver, props);
mainDriver.EnvironmentDriver.GetDevicesFromConfig(avDriver.CurrentRoom.PropertiesConfig.Environment);
}
mainDriver.HeaderDriver.SetupHeaderButtons(avDriver, avDriver.CurrentRoom);
panelController.LoadAndShowDriver(mainDriver); // This is a little convoluted.
if (panelController.Panel is TswFt5ButtonSystem)
{
var tsw = panelController.Panel as TswFt5ButtonSystem;
// Wire up hard keys
tsw.Power.UserObject = new Action<bool>(b => { if (!b) avDriver.PowerButtonPressed(); });
//tsw.Home.UserObject = new Action<bool>(b => { if (!b) HomePressed(); });
if(mainDriver.EnvironmentDriver != null)
tsw.Lights.UserObject = new Action<bool>(b =>
{
if (!b)
{
//mainDriver.AvDriver.PopupInterlock.ShowInterlockedWithToggle(mainDriver.EnvironmentDriver.BackgroundSubpageJoin);
mainDriver.EnvironmentDriver.Toggle();
}
});
tsw.Up.UserObject = new Action<bool>(avDriver.VolumeUpPress);
tsw.Down.UserObject = new Action<bool>(avDriver.VolumeDownPress);
}
}
//else if (room is EssentialsPresentationRoom)
//{
// Debug.Console(0, panelController, "Adding presentation room driver");
// var avDriver = new EssentialsPresentationPanelAvFunctionsDriver(mainDriver, props);
// avDriver.CurrentRoom = room as EssentialsPresentationRoom;
// avDriver.DefaultRoomKey = props.DefaultRoomKey;
// mainDriver.AvDriver = avDriver ;
// mainDriver.HeaderDriver = new EssentialsHeaderDriver(mainDriver, props);
// panelController.LoadAndShowDriver(mainDriver);
// if (panelController.Panel is TswFt5ButtonSystem)
// {
// var tsw = panelController.Panel as TswFt5ButtonSystem;
// // Wire up hard keys
// tsw.Power.UserObject = new Action<bool>(b => { if (!b) avDriver.PowerButtonPressed(); });
// //tsw.Home.UserObject = new Action<bool>(b => { if (!b) HomePressed(); });
// tsw.Up.UserObject = new Action<bool>(avDriver.VolumeUpPress);
// tsw.Down.UserObject = new Action<bool>(avDriver.VolumeDownPress);
// }
//}
else if (room is EssentialsHuddleVtc1Room)
{
Debug.Console(0, panelController, "Adding huddle space VTC AV driver");
// Header Driver
mainDriver.HeaderDriver = new EssentialsHeaderDriver(mainDriver, props);
// AV Driver
var avDriver = new EssentialsHuddleVtc1PanelAvFunctionsDriver(mainDriver, props);
var codecDriver = new PepperDash.Essentials.UIDrivers.VC.EssentialsVideoCodecUiDriver(panelController.Panel, avDriver,
(room as EssentialsHuddleVtc1Room).VideoCodec, mainDriver.HeaderDriver);
avDriver.SetVideoCodecDriver(codecDriver);
avDriver.DefaultRoomKey = props.DefaultRoomKey;
mainDriver.AvDriver = avDriver;
avDriver.CurrentRoom = room as EssentialsHuddleVtc1Room;
// Environment Driver
if (avDriver.CurrentRoom.PropertiesConfig.Environment != null && avDriver.CurrentRoom.PropertiesConfig.Environment.DeviceKeys.Count > 0)
{
Debug.Console(0, panelController, "Adding environment driver");
mainDriver.EnvironmentDriver = new EssentialsEnvironmentDriver(mainDriver, props);
mainDriver.EnvironmentDriver.GetDevicesFromConfig(avDriver.CurrentRoom.PropertiesConfig.Environment);
}
mainDriver.HeaderDriver.SetupHeaderButtons(avDriver, avDriver.CurrentRoom);
panelController.LoadAndShowDriver(mainDriver); // This is a little convoluted.
if (panelController.Panel is TswFt5ButtonSystem)
{
var tsw = panelController.Panel as TswFt5ButtonSystem;
// Wire up hard keys
tsw.Power.UserObject = new Action<bool>(b => { if (!b) avDriver.EndMeetingPress(); });
//tsw.Home.UserObject = new Action<bool>(b => { if (!b) HomePressed(); });
if (mainDriver.EnvironmentDriver != null)
tsw.Lights.UserObject = new Action<bool>(b =>
{
if (!b)
{
//mainDriver.AvDriver.PopupInterlock.ShowInterlockedWithToggle(mainDriver.EnvironmentDriver.BackgroundSubpageJoin);
mainDriver.EnvironmentDriver.Toggle();
}
});
tsw.Up.UserObject = new Action<bool>(avDriver.VolumeUpPress);
tsw.Down.UserObject = new Action<bool>(avDriver.VolumeDownPress);
}
}
else
{
Debug.Console(0, panelController, "ERROR: Cannot load AvFunctionsDriver for room '{0}'", props.DefaultRoomKey);
}
});
return panelController;
}
}
avDriver.CurrentRoom = room as EssentialsHuddleVtc1Room;
// Environment Driver
if (avDriver.CurrentRoom.PropertiesConfig.Environment != null && avDriver.CurrentRoom.PropertiesConfig.Environment.DeviceKeys.Count > 0)
{
Debug.Console(0, panelController, "Adding environment driver");
mainDriver.EnvironmentDriver = new EssentialsEnvironmentDriver(mainDriver, props);
mainDriver.EnvironmentDriver.GetDevicesFromConfig(avDriver.CurrentRoom.PropertiesConfig.Environment);
}
mainDriver.HeaderDriver.SetupHeaderButtons(avDriver, avDriver.CurrentRoom);
panelController.LoadAndShowDriver(mainDriver); // This is a little convoluted.
if (panelController.Panel is TswFt5ButtonSystem)
{
var tsw = panelController.Panel as TswFt5ButtonSystem;
// Wire up hard keys
tsw.Power.UserObject = new Action<bool>(b => { if (!b) avDriver.EndMeetingPress(); });
//tsw.Home.UserObject = new Action<bool>(b => { if (!b) HomePressed(); });
if (mainDriver.EnvironmentDriver != null)
tsw.Lights.UserObject = new Action<bool>(b =>
{
if (!b)
{
//mainDriver.AvDriver.PopupInterlock.ShowInterlockedWithToggle(mainDriver.EnvironmentDriver.BackgroundSubpageJoin);
mainDriver.EnvironmentDriver.Toggle();
}
});
tsw.Up.UserObject = new Action<bool>(avDriver.VolumeUpPress);
tsw.Down.UserObject = new Action<bool>(avDriver.VolumeDownPress);
}
}
else
{
Debug.Console(0, panelController, "ERROR: Cannot load AvFunctionsDriver for room '{0}'", props.DefaultRoomKey);
}
});
return panelController;
}
}
}

View File

@@ -14,6 +14,7 @@ using PepperDash.Core;
using PepperDash.Essentials;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.Fusion;
using PepperDash.Essentials.Devices.Common;
using PepperDash.Essentials.Devices.Common.Occupancy;
@@ -181,7 +182,7 @@ namespace PepperDash.Essentials.Fusion
// Moved to
CurrentRoomSourceNameSig = FusionRoom.CreateOffsetStringSig(84, "Display 1 - Current Source", eSigIoMask.InputSigOnly);
// Don't think we need to get current status of this as nothing should be alive yet.
(Room as EssentialsHuddleVtc1Room).CurrentSingleSourceChange += Room_CurrentSourceInfoChange;
(Room as EssentialsHuddleVtc1Room).CurrentSourceChange += Room_CurrentSourceInfoChange;
FusionRoom.SystemPowerOn.OutputSig.SetSigFalseAction((Room as EssentialsHuddleVtc1Room).PowerOnToDefaultOrLastSource);
@@ -220,7 +221,7 @@ namespace PepperDash.Essentials.Fusion
break;
}
var laptops = dict.Where(d => d.Value.SourceDevice is Laptop);
var laptops = dict.Where(d => d.Value.SourceDevice is Core.Devices.Laptop);
i = 1;
foreach (var kvp in laptops)
{

View File

@@ -48,32 +48,32 @@
<ItemGroup>
<Reference Include="Crestron.SimplSharpPro.DeviceSupport, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.DeviceSupport.dll</HintPath>
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.DeviceSupport.dll</HintPath>
</Reference>
<Reference Include="Crestron.SimplSharpPro.DM, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.DM.dll</HintPath>
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.DM.dll</HintPath>
</Reference>
<Reference Include="Crestron.SimplSharpPro.EthernetCommunications, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.EthernetCommunications.dll</HintPath>
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.EthernetCommunications.dll</HintPath>
</Reference>
<Reference Include="Crestron.SimplSharpPro.Fusion, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Fusion.dll</HintPath>
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Fusion.dll</HintPath>
</Reference>
<Reference Include="Crestron.SimplSharpPro.Remotes, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Remotes.dll</HintPath>
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Remotes.dll</HintPath>
</Reference>
<Reference Include="Crestron.SimplSharpPro.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.UI.dll</HintPath>
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.UI.dll</HintPath>
</Reference>
<Reference Include="mscorlib" />
<Reference Include="PepperDash_Core, Version=1.0.3.27452, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="PepperDash_Core, Version=1.0.26.30384, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\essentials-framework\references\PepperDash_Core.dll</HintPath>
<HintPath>..\essentials-framework\pepperdashcore-builds\PepperDash_Core.dll</HintPath>
</Reference>
<Reference Include="PepperDash_Essentials_DM, Version=1.0.0.19343, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
@@ -81,33 +81,34 @@
</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>
</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>
</Reference>
<Reference Include="SimplSharpNewtonsoft, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpNewtonsoft.dll</HintPath>
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpNewtonsoft.dll</HintPath>
</Reference>
<Reference Include="SimplSharpPro, Version=1.5.2.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<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>
</Reference>
<Reference Include="SimplSharpReflectionInterface, Version=1.0.5583.25238, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpReflectionInterface.dll</HintPath>
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpReflectionInterface.dll</HintPath>
</Reference>
<Reference Include="SimplSharpTimerEventInterface, Version=1.0.6197.20052, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpTimerEventInterface.dll</HintPath>
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpTimerEventInterface.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data" />
</ItemGroup>
<ItemGroup>
<Compile Include="AppServer\Messengers\ConfigMessenger.cs" />
<Compile Include="AppServer\Messengers\Ddvc01AtcMessenger.cs" />
<Compile Include="AppServer\Messengers\AudioCodecBaseMessenger.cs" />
<Compile Include="AppServer\Messengers\Ddvc01VtcMessenger.cs" />
@@ -115,19 +116,42 @@
<Compile Include="AppServer\Messengers\SystemMonitorMessenger.cs" />
<Compile Include="AppServer\Messengers\VideoCodecBaseMessenger.cs" />
<Compile Include="Audio\EssentialsVolumeLevelConfig.cs" />
<Compile Include="Bridges\AppleTvBridge.cs" />
<Compile Include="Bridges\BridgeBase.cs" />
<Compile Include="Bridges\BridgeFactory.cs" />
<Compile Include="Bridges\CameraControllerBridge.cs" />
<Compile Include="Bridges\AirMediaControllerBridge.cs" />
<Compile Include="Bridges\DmpsAudioOutputControllerBridge.cs" />
<Compile Include="Bridges\DmpsRoutingControllerBridge.cs" />
<Compile Include="Bridges\DisplayControllerBridge.cs" />
<Compile Include="Bridges\DigitalLoggerBridge.cs" />
<Compile Include="Bridges\DmChassisControllerBridge.cs" />
<Compile Include="Bridges\DmTxControllerBridge.cs" />
<Compile Include="Bridges\GenericLightingBridge.cs" />
<Compile Include="Bridges\GenericRelayDeviceBridge.cs" />
<Compile Include="Bridges\GlsOccupancySensorBaseControllerBridge.cs" />
<Compile Include="Bridges\HdMdxxxCEControllerBridge.cs" />
<Compile Include="Bridges\IBasicCommunicationBridge.cs" />
<Compile Include="Bridges\DmRmcControllerBridge.cs" />
<Compile Include="Bridges\IBridge.cs" />
<Compile Include="Bridges\IDigitalInputBridge.cs" />
<Compile Include="Bridges\JoinMapBase.cs" />
<Compile Include="Bridges\JoinMaps\AirMediaControllerJoinMap.cs" />
<Compile Include="Bridges\JoinMaps\AppleTvJoinMap.cs" />
<Compile Include="Bridges\JoinMaps\CameraControllerJoinMap.cs" />
<Compile Include="Bridges\JoinMaps\DigitalLoggerJoinMap.cs" />
<Compile Include="Bridges\JoinMaps\DisplayControllerJoinMap.cs" />
<Compile Include="Bridges\JoinMaps\DmChassisControllerJoinMap.cs" />
<Compile Include="Bridges\JoinMaps\DmpsAudioOutputControllerJoinMap.cs" />
<Compile Include="Bridges\JoinMaps\DmpsRoutingControllerJoinMap.cs" />
<Compile Include="Bridges\JoinMaps\DmRmcControllerJoinMap.cs" />
<Compile Include="Bridges\JoinMaps\DmTxControllerJoinMap.cs" />
<Compile Include="Bridges\JoinMaps\GenericLightingJoinMap.cs" />
<Compile Include="Bridges\JoinMaps\GenericRelayControllerJoinMap.cs" />
<Compile Include="Bridges\JoinMaps\HdMdxxxCEControllerJoinMap.cs" />
<Compile Include="Bridges\JoinMaps\IBasicCommunicationJoinMap.cs" />
<Compile Include="Bridges\JoinMaps\IDigitalInputJoinMap.cs" />
<Compile Include="Bridges\JoinMaps\GlsOccupancySensorBaseJoinMap.cs" />
<Compile Include="Bridges\JoinMaps\SystemMonitorJoinMap.cs" />
<Compile Include="Bridges\SystemMonitorBridge.cs" />
<Compile Include="Configuration ORIGINAL\Builders\TPConfig.cs" />
<Compile Include="Configuration ORIGINAL\Configuration.cs" />
@@ -149,16 +173,12 @@
<Compile Include="Devices\NUMERIC AppleTV.cs" />
<Compile Include="ControlSystem.cs" />
<Compile Include="Factory\UiDeviceFactory.cs" />
<Compile Include="FOR REFERENCE UI\OTHER\Fusion\EssentialsHuddleVtc1FusionController.cs" />
<Compile Include="FOR REFERENCE UI\OTHER\Fusion\FusionCustomPropertiesBridge.cs" />
<Compile Include="FOR REFERENCE UI\OTHER\Fusion\FusionEventHandlers.cs" />
<Compile Include="FOR REFERENCE UI\OTHER\Fusion\FusionProcessorQueries.cs" />
<Compile Include="FOR REFERENCE UI\OTHER\Fusion\FusionRviDataClasses.cs" />
<Compile Include="Fusion\EssentialsHuddleVtc1FusionController.cs" />
<Compile Include="REMOVE EssentialsApp.cs" />
<Compile Include="FOR REFERENCE UI\OTHER\Fusion\EssentialsHuddleSpaceFusionSystemControllerBase.cs" />
<Compile Include="HttpApiHandler.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Room\Behaviours\RoomOnToDefaultSourceWhenOccupied.cs" />
<Compile Include="Room\Config\EssentialsDualDisplayRoomPropertiesConfig.cs" />
<Compile Include="Room\Config\EssentialsNDisplayRoomPropertiesConfig.cs" />
<Compile Include="Room\Config\DDVC01RoomPropertiesConfig.cs" />
<Compile Include="Room\Config\EssentialsPresentationPropertiesConfig.cs" />
<Compile Include="Room\Config\EssentialsHuddleRoomPropertiesConfig.cs" />
@@ -181,9 +201,10 @@
<Compile Include="AppServer\RoomBridges\SourceDeviceMapDictionary.cs" />
<Compile Include="AppServer\Volumes.cs" />
<Compile Include="Room\Emergency\EsentialsRoomEmergencyContactClosure.cs" />
<Compile Include="Room\Types\EssentialsDualDisplayRoom.cs" />
<Compile Include="Room\Types\EssentialsHuddleVtc1Room.cs" />
<Compile Include="Room\Types\EssentialsNDisplayRoomBase.cs" />
<Compile Include="Room\Types\EssentialsPresentationRoom.cs" />
<Compile Include="Room\Types\EssentialsRoomBase.cs" />
<Compile Include="Room\Config\EssentialsRoomConfig.cs" />
<Compile Include="FOR REFERENCE UI\PageControllers\DevicePageControllerBase.cs" />
<Compile Include="FOR REFERENCE UI\PageControllers\PageControllerLaptop.cs" />
@@ -220,7 +241,6 @@
<Compile Include="AppServer\CotijaSystemController.cs" />
<Compile Include="UI\DualDisplaySourceSRLController.cs" />
<Compile Include="UI\SubpageReferenceListActivityItem.cs" />
<Compile Include="UI\CrestronTouchpanelPropertiesConfig.cs" />
<Compile Include="FOR REFERENCE UI\Panels\REMOVE UiCue.cs" />
<Compile Include="FOR REFERENCE UI\SRL\SourceListSubpageReferenceList.cs" />
<Compile Include="Room\Types\EssentialsHuddleSpaceRoom.cs" />
@@ -228,9 +248,15 @@
<Compile Include="UI\SubpageReferenceListSourceItem.cs" />
<None Include="app.config" />
<None Include="Properties\ControlSystem.cfg" />
<EmbeddedResource Include="SGD\PepperDash Essentials iPad.sgd" />
<EmbeddedResource Include="SGD\PepperDash Essentials TSW-560.sgd" />
<EmbeddedResource Include="SGD\PepperDash Essentials TSW-760.sgd" />
<EmbeddedResource Include="SGD\PepperDash Essentials iPad.sgd">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="SGD\PepperDash Essentials TSW-560.sgd">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="SGD\PepperDash Essentials TSW-760.sgd">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\essentials-framework\Essentials Core\PepperDashEssentialsBase\PepperDash_Essentials_Core.csproj">
@@ -242,6 +268,9 @@
<Name>Essentials Devices Common</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="FOR REFERENCE UI\OTHER\" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>

View File

@@ -4,5 +4,5 @@
[assembly: AssemblyCompany("PepperDash Technology Corp")]
[assembly: AssemblyProduct("PepperDashEssentials")]
[assembly: AssemblyCopyright("Copyright © PepperDash Technology Corp 2018")]
[assembly: AssemblyVersion("1.3.2.*")]
[assembly: AssemblyVersion("1.4.0.*")]

View File

@@ -0,0 +1,35 @@
function Update-SourceVersion
{
Param ([string]$Version)
$NewVersion = AssemblyVersion(" + $Version + .*");
foreach ($o in $input)
{
Write-output $o.FullName
$TmpFile = $o.FullName + .tmp
get-content $o.FullName |
%{$_ -replace AssemblyVersion\("(\d+\.\d+\.\d+)\.\*"\), $NewVersion } > $TmpFile
move-item $TmpFile $o.FullName -force
}
}
function Update-AllAssemblyInfoFiles ( $version )
{
foreach ($file in AssemblyInfo.cs, AssemblyInfo.vb )
{
get-childitem -recurse |? {$_.Name -eq $file} | Update-SourceVersion $version ;
}
}
# validate arguments
$r= [System.Text.RegularExpressions.Regex]::Match($args[0], "^\d+\.\d+\.\d+$");
if ($r.Success)
{
Update-AllAssemblyInfoFiles $args[0];
}
else
{
echo ;
echo Error: Input version does not match x.y.z format!
echo ;
echo "Unable to apply version to AssemblyInfo.cs files";
}

View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Newtonsoft.Json;
namespace PepperDash.Essentials.Room.Config
{
public class EssentialsDualDisplayRoomPropertiesConfig : EssentialsNDisplayRoomPropertiesConfig
{
}
}

View File

@@ -8,19 +8,10 @@ using Newtonsoft.Json;
namespace PepperDash.Essentials.Room.Config
{
public class EssentialsHuddleVtc1PropertiesConfig : EssentialsRoomPropertiesConfig
public class EssentialsHuddleVtc1PropertiesConfig : EssentialsConferenceRoomPropertiesConfig
{
[JsonProperty("defaultDisplayKey")]
public string DefaultDisplayKey { get; set; }
[JsonProperty("defaultAudioKey")]
public string DefaultAudioKey { get; set; }
[JsonProperty("sourceListKey")]
public string SourceListKey { get; set; }
[JsonProperty("defaultSourceItem")]
public string DefaultSourceItem { get; set; }
[JsonProperty("videoCodecKey")]
public string VideoCodecKey { get; set; }
[JsonProperty("audioCodecKey")]
public string AudioCodecKey { get; set; }
}
}

View File

@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using Newtonsoft.Json;
namespace PepperDash.Essentials.Room.Config
{
/// <summary>
///
/// </summary>
public class EssentialsNDisplayRoomPropertiesConfig : EssentialsConferenceRoomPropertiesConfig
{
[JsonProperty("defaultAudioBehavior")]
public string DefaultAudioBehavior { get; set; }
[JsonProperty("defaultVideoBehavior")]
public string DefaultVideoBehavior { get; set; }
[JsonProperty("displays")]
public Dictionary<eSourceListItemDestinationTypes, DisplayItem> Displays { get; set; }
public EssentialsNDisplayRoomPropertiesConfig()
{
Displays = new Dictionary<eSourceListItemDestinationTypes, DisplayItem>();
}
}
public class DisplayItem : IKeyName
{
public string Key { get; set; }
public string Name { get; set; }
}
}

View File

@@ -65,18 +65,18 @@ namespace PepperDash.Essentials.Room.Config
/// <param name="props"></param>
/// <param name="room"></param>
/// <returns></returns>
public static PepperDash.Essentials.Devices.Common.Microphones.MicrophonePrivacyController GetMicrophonePrivacy(
EssentialsRoomPropertiesConfig props, EssentialsHuddleVtc1Room room)
public static Core.Privacy.MicrophonePrivacyController GetMicrophonePrivacy(
EssentialsRoomPropertiesConfig props, IPrivacy room)
{
var microphonePrivacy = props.MicrophonePrivacy;
if (microphonePrivacy == null)
{
Debug.Console(0, "ERROR: Cannot create microphone privacy with null properties");
Debug.Console(0, "Cannot create microphone privacy with null properties");
return null;
}
// Get the MicrophonePrivacy device from the device manager
var mP = (DeviceManager.GetDeviceForKey(props.MicrophonePrivacy.DeviceKey) as
PepperDash.Essentials.Devices.Common.Microphones.MicrophonePrivacyController);
Core.Privacy.MicrophonePrivacyController);
// Set this room as the IPrivacy device
if (mP == null)
{
@@ -95,28 +95,30 @@ namespace PepperDash.Essentials.Room.Config
if (behaviour == "trackroomstate")
{
// Tie LED enable to room power state
room.OnFeedback.OutputChange += (o, a) =>
var essRoom = room as EssentialsRoomBase;
essRoom.OnFeedback.OutputChange += (o, a) =>
{
if (room.OnFeedback.BoolValue)
if (essRoom.OnFeedback.BoolValue)
mP.EnableLeds = true;
else
mP.EnableLeds = false;
};
mP.EnableLeds = room.OnFeedback.BoolValue;
mP.EnableLeds = essRoom.OnFeedback.BoolValue;
}
else if (behaviour == "trackcallstate")
{
// Tie LED enable to room power state
room.InCallFeedback.OutputChange += (o, a) =>
var inCallRoom = room as IHasInCallFeedback;
inCallRoom.InCallFeedback.OutputChange += (o, a) =>
{
if (room.InCallFeedback.BoolValue)
if (inCallRoom.InCallFeedback.BoolValue)
mP.EnableLeds = true;
else
mP.EnableLeds = false;
};
mP.EnableLeds = room.InCallFeedback.BoolValue;
mP.EnableLeds = inCallRoom.InCallFeedback.BoolValue;
}
return mP;
@@ -175,6 +177,25 @@ namespace PepperDash.Essentials.Room.Config
public bool ZeroVolumeWhenSwtichingVolumeDevices { get; set; }
}
public class EssentialsAvRoomPropertiesConfig : EssentialsRoomPropertiesConfig
{
[JsonProperty("defaultAudioKey")]
public string DefaultAudioKey { get; set; }
[JsonProperty("sourceListKey")]
public string SourceListKey { get; set; }
[JsonProperty("defaultSourceItem")]
public string DefaultSourceItem { get; set; }
}
public class EssentialsConferenceRoomPropertiesConfig : EssentialsAvRoomPropertiesConfig
{
[JsonProperty("videoCodecKey")]
public string VideoCodecKey { get; set; }
[JsonProperty("audioCodecKey")]
public string AudioCodecKey { get; set; }
}
public class EssentialsEnvironmentPropertiesConfig
{
public bool Enabled { get; set; }

View File

@@ -12,15 +12,7 @@ using PepperDash.Essentials.Room.Config;
namespace PepperDash.Essentials.Room
{
public abstract class EssentialsRoomEmergencyBase : IKeyed
{
public string Key { get; private set; }
public EssentialsRoomEmergencyBase(string key)
{
Key = key;
}
}
public class EssentialsRoomEmergencyContactClosure : EssentialsRoomEmergencyBase

View File

@@ -0,0 +1,652 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Devices;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Room.Config;
using PepperDash.Essentials.Devices.Common.Codec;
using PepperDash.Essentials.Devices.Common.VideoCodec;
using PepperDash.Essentials.Devices.Common.AudioCodec;
namespace PepperDash.Essentials.Room.Types
{
public class EssentialsDualDisplayRoom : EssentialsNDisplayRoomBase, IHasCurrentVolumeControls,
IRunRouteAction, IPrivacy, IRunDefaultCallRoute, IHasVideoCodec, IHasAudioCodec, IHasInCallFeedback
{
public event EventHandler<VolumeDeviceChangeEventArgs> CurrentVolumeDeviceChange;
public EssentialsDualDisplayRoomPropertiesConfig PropertiesConfig { get; private set; }
//************************
// Call-related stuff
public BoolFeedback InCallFeedback { get; private set; }
/// <summary>
/// States: 0 for on hook, 1 for video, 2 for audio, 3 for telekenesis
/// </summary>
public IntFeedback CallTypeFeedback { get; private set; }
/// <summary>
///
/// </summary>
public BoolFeedback PrivacyModeIsOnFeedback { get; private set; }
/// <summary>
/// When something in the room is sharing with the far end or through other means
/// </summary>
public BoolFeedback IsSharingFeedback { get; private set; }
public IRoutingSinkWithSwitching LeftDisplay { get; private set; }
public IRoutingSinkWithSwitching RightDisplay { get; private set; }
protected override Func<bool> OnFeedbackFunc
{
get
{
return () =>
{
var leftDisp = LeftDisplay as DisplayBase;
var rightDisp = RightDisplay as DisplayBase;
var val = leftDisp != null && leftDisp.CurrentSourceInfo != null
&& leftDisp.CurrentSourceInfo.Type == eSourceListItemType.Route
&& rightDisp != null && rightDisp.CurrentSourceInfo != null
&& rightDisp.CurrentSourceInfo.Type == eSourceListItemType.Route;
return val;
};
}
}
/// <summary>
///
/// </summary>
protected override Func<bool> IsWarmingFeedbackFunc
{
get
{
return () =>
{
var leftDisp = LeftDisplay as DisplayBase;
var rightDisp = RightDisplay as DisplayBase;
if (leftDisp != null && RightDisplay != null)
return leftDisp.IsWarmingUpFeedback.BoolValue || rightDisp.IsWarmingUpFeedback.BoolValue;
else
return false;
};
}
}
/// <summary>
///
/// </summary>
protected override Func<bool> IsCoolingFeedbackFunc
{
get
{
return () =>
{
var leftDisp = LeftDisplay as DisplayBase;
var rightDisp = RightDisplay as DisplayBase;
if (leftDisp != null && RightDisplay != null)
return leftDisp.IsCoolingDownFeedback.BoolValue || rightDisp.IsCoolingDownFeedback.BoolValue;
else
return false;
};
}
}
public IBasicVolumeControls DefaultAudioDevice { get; private set; }
public IBasicVolumeControls DefaultVolumeControls { get; private set; }
public VideoCodecBase VideoCodec { get; private set; }
public AudioCodecBase AudioCodec { get; private set; }
public bool ExcludeFromGlobalFunctions { get; set; }
public string DefaultSourceItem { get; set; }
public ushort DefaultVolume { get; set; }
/// <summary>
/// If room is off, enables power on to last source. Default true
/// </summary>
public bool EnablePowerOnToLastSource { get; set; }
string LastSourceKey;
/// <summary>
/// Sets the volume control device, and attaches/removes InUseTrackers with "audio"
/// tag to device.
/// </summary>
public IBasicVolumeControls CurrentVolumeControls
{
get { return _CurrentAudioDevice; }
set
{
if (value == _CurrentAudioDevice) return;
var oldDev = _CurrentAudioDevice;
// derigister this room from the device, if it can
if (oldDev is IInUseTracking)
(oldDev as IInUseTracking).InUseTracker.RemoveUser(this, "audio");
var handler = CurrentVolumeDeviceChange;
if (handler != null)
CurrentVolumeDeviceChange(this, new VolumeDeviceChangeEventArgs(oldDev, value, ChangeType.WillChange));
_CurrentAudioDevice = value;
if (handler != null)
CurrentVolumeDeviceChange(this, new VolumeDeviceChangeEventArgs(oldDev, value, ChangeType.DidChange));
// register this room with new device, if it can
if (_CurrentAudioDevice is IInUseTracking)
(_CurrentAudioDevice as IInUseTracking).InUseTracker.AddUser(this, "audio");
}
}
IBasicVolumeControls _CurrentAudioDevice;
/// <summary>
/// "codecOsd"
/// </summary>
public string DefaultCodecRouteString { get { return "codecOsd"; } }
/// <summary>
/// Temporary implementation. Returns the schedule-ready object or null if none. Fow now,
/// always returns the VideoCodec if it is capable
/// </summary>
public IHasScheduleAwareness ScheduleSource { get { return VideoCodec as IHasScheduleAwareness; } }
CCriticalSection SourceSelectLock = new CCriticalSection();
public EssentialsDualDisplayRoom(DeviceConfig config)
: base(config)
{
try
{
PropertiesConfig = JsonConvert.DeserializeObject<EssentialsDualDisplayRoomPropertiesConfig>
(config.Properties.ToString());
var leftDisp = PropertiesConfig.Displays[eSourceListItemDestinationTypes.leftDisplay];
if (leftDisp != null)
{
if (!string.IsNullOrEmpty(leftDisp.Key))
LeftDisplay = DeviceManager.GetDeviceForKey(leftDisp.Key) as IRoutingSinkWithSwitching;
else
Debug.Console(0, this, "Unable to get LeftDisplay for Room");
}
var rightDisp = PropertiesConfig.Displays[eSourceListItemDestinationTypes.rightDisplay];
if (rightDisp != null)
{
if (!string.IsNullOrEmpty(rightDisp.Key))
LeftDisplay = DeviceManager.GetDeviceForKey(rightDisp.Key) as IRoutingSinkWithSwitching;
else
Debug.Console(0, this, "Unable to get LeftDisplay for Room");
}
VideoCodec = DeviceManager.GetDeviceForKey(PropertiesConfig.VideoCodecKey) as
PepperDash.Essentials.Devices.Common.VideoCodec.VideoCodecBase;
if (VideoCodec == null)
throw new ArgumentNullException("codec cannot be null");
AudioCodec = DeviceManager.GetDeviceForKey(PropertiesConfig.AudioCodecKey) as
PepperDash.Essentials.Devices.Common.AudioCodec.AudioCodecBase;
if (AudioCodec == null)
Debug.Console(0, this, "No Audio Codec Found");
DefaultAudioDevice = DeviceManager.GetDeviceForKey(PropertiesConfig.DefaultAudioKey) as IBasicVolumeControls;
Initialize();
}
catch (Exception e)
{
Debug.Console(1, this, "Error building room \n{0}", e);
}
}
void Initialize()
{
if (DefaultAudioDevice is IBasicVolumeControls)
DefaultVolumeControls = DefaultAudioDevice as IBasicVolumeControls;
else if (DefaultAudioDevice is IHasVolumeDevice)
DefaultVolumeControls = (DefaultAudioDevice as IHasVolumeDevice).VolumeDevice;
CurrentVolumeControls = DefaultVolumeControls;
var leftDisp = LeftDisplay as DisplayBase;
if (leftDisp != null)
InitializeDisplay(leftDisp);
var rightDisp = RightDisplay as DisplayBase;
if (rightDisp != null)
InitializeDisplay(rightDisp);
// Get Microphone Privacy object, if any
this.MicrophonePrivacy = EssentialsRoomConfigHelper.GetMicrophonePrivacy(PropertiesConfig, this);
Debug.Console(2, this, "Microphone Privacy Config evaluated.");
// Get emergency object, if any
this.Emergency = EssentialsRoomConfigHelper.GetEmergency(PropertiesConfig, this);
Debug.Console(2, this, "Emergency Config evaluated.");
// Combines call feedback from both codecs if available
InCallFeedback = new BoolFeedback(() =>
{
bool inAudioCall = false;
bool inVideoCall = false;
if (AudioCodec != null)
inAudioCall = AudioCodec.IsInCall;
if (VideoCodec != null)
inVideoCall = VideoCodec.IsInCall;
if (inAudioCall || inVideoCall)
return true;
else
return false;
});
VideoCodec.CallStatusChange += (o, a) => this.InCallFeedback.FireUpdate();
if (AudioCodec != null)
AudioCodec.CallStatusChange += (o, a) => this.InCallFeedback.FireUpdate();
IsSharingFeedback = new BoolFeedback(() => VideoCodec.SharingContentIsOnFeedback.BoolValue);
VideoCodec.SharingContentIsOnFeedback.OutputChange += (o, a) => this.IsSharingFeedback.FireUpdate();
// link privacy to VC (for now?)
PrivacyModeIsOnFeedback = new BoolFeedback(() => VideoCodec.PrivacyModeIsOnFeedback.BoolValue);
VideoCodec.PrivacyModeIsOnFeedback.OutputChange += (o, a) => this.PrivacyModeIsOnFeedback.FireUpdate();
CallTypeFeedback = new IntFeedback(() => 0);
SourceListKey = "default";
EnablePowerOnToLastSource = true;
}
void InitializeDisplay(DisplayBase disp)
{
if (disp != null)
{
// Link power, warming, cooling to display
disp.PowerIsOnFeedback.OutputChange += (o, a) =>
{
if (disp.PowerIsOnFeedback.BoolValue != OnFeedback.BoolValue)
{
if (!disp.PowerIsOnFeedback.BoolValue)
disp.CurrentSourceInfo = null;
OnFeedback.FireUpdate();
}
if (disp.PowerIsOnFeedback.BoolValue)
{
SetDefaultLevels();
}
};
disp.IsWarmingUpFeedback.OutputChange += (o, a) =>
{
IsWarmingUpFeedback.FireUpdate();
if (!IsWarmingUpFeedback.BoolValue)
(CurrentVolumeControls as IBasicVolumeWithFeedback).SetVolume(DefaultVolume);
};
disp.IsCoolingDownFeedback.OutputChange += (o, a) =>
{
IsCoolingDownFeedback.FireUpdate();
};
}
}
protected override void CustomSetConfig(DeviceConfig config)
{
var newPropertiesConfig = JsonConvert.DeserializeObject<EssentialsDualDisplayRoomPropertiesConfig>(config.Properties.ToString());
if (newPropertiesConfig != null)
PropertiesConfig = newPropertiesConfig;
ConfigWriter.UpdateRoomConfig(config);
}
public override bool CustomActivate()
{
// Add Occupancy object from config
if (PropertiesConfig.Occupancy != null)
this.SetRoomOccupancy(DeviceManager.GetDeviceForKey(PropertiesConfig.Occupancy.DeviceKey) as
IOccupancyStatusProvider, PropertiesConfig.Occupancy.TimeoutMinutes);
this.LogoUrl = PropertiesConfig.Logo.GetUrl();
this.SourceListKey = PropertiesConfig.SourceListKey;
this.DefaultSourceItem = PropertiesConfig.DefaultSourceItem;
this.DefaultVolume = (ushort)(PropertiesConfig.Volumes.Master.Level * 65535 / 100);
return base.CustomActivate();
}
/// <summary>
///
/// </summary>
protected override void EndShutdown()
{
VideoCodec.EndAllCalls();
SetDefaultLevels();
RunDefaultPresentRoute();
CrestronEnvironment.Sleep(1000);
RunRouteAction("roomOff");
}
/// <summary>
/// Routes the default source item, if any. Returns true when default route exists
/// </summary>
public override bool RunDefaultPresentRoute()
{
if (DefaultSourceItem != null)
RunRouteAction(DefaultSourceItem);
return DefaultSourceItem != null;
}
/// <summary>
/// Sets up the room when started into call mode without presenting a source
/// </summary>
/// <returns></returns>
public bool RunDefaultCallRoute()
{
RunRouteAction(DefaultCodecRouteString);
return true;
}
/// <summary>
///
/// </summary>
/// <param name="routeKey"></param>
public void RunRouteAction(string routeKey)
{
RunRouteAction(routeKey, null);
}
/// <summary>
/// Gets a source from config list SourceListKey and dynamically build and executes the
/// route or commands
/// </summary>
/// <param name="name"></param>
public void RunRouteAction(string routeKey, Action successCallback)
{
// Run this on a separate thread
new CTimer(o =>
{
// try to prevent multiple simultaneous selections
SourceSelectLock.TryEnter();
try
{
Debug.Console(1, this, "Run route action '{0}'", routeKey);
var dict = ConfigReader.ConfigObject.GetSourceListForKey(SourceListKey);
if (dict == null)
{
Debug.Console(1, this, "WARNING: Config source list '{0}' not found", SourceListKey);
return;
}
// Try to get the list item by it's string key
if (!dict.ContainsKey(routeKey))
{
Debug.Console(1, this, "WARNING: No item '{0}' found on config list '{1}'",
routeKey, SourceListKey);
return;
}
// End usage timer on last source
if (!string.IsNullOrEmpty(LastSourceKey))
{
var usageLastSource = dict[LastSourceKey].SourceDevice as IUsageTracking;
if (usageLastSource != null && usageLastSource.UsageTracker != null)
{
try
{
// There MAY have been failures in here. Protect
usageLastSource.UsageTracker.EndDeviceUsage();
}
catch (Exception e)
{
Debug.Console(1, this, "*#* EXCEPTION in end usage tracking:\r{0}", e);
}
}
}
// Let's run it
var item = dict[routeKey];
if (routeKey.ToLower() != "roomoff")
{
LastSourceKey = routeKey;
}
//else
// CurrentSourceInfoKey = null;
// hand off the individual routes to this helper
foreach (var route in item.RouteList)
DoRouteItem(route, item, routeKey);
// Start usage timer on routed source
var usageNewSource = item.SourceDevice as IUsageTracking;
if (usageNewSource != null && usageNewSource.UsageTracker != null) // Have to make sure there is a usage tracker!
{
(item.SourceDevice as IUsageTracking).UsageTracker.StartDeviceUsage();
}
// See if this can be moved into common, base-class method -------------
// Set volume control, using default if non provided
IBasicVolumeControls volDev = null;
// Handle special cases for volume control
if (string.IsNullOrEmpty(item.VolumeControlKey)
|| item.VolumeControlKey.Equals("$defaultAudio", StringComparison.OrdinalIgnoreCase))
volDev = DefaultVolumeControls;
// Or a specific device, probably rarely used.
else
{
var dev = DeviceManager.GetDeviceForKey(item.VolumeControlKey);
if (dev is IBasicVolumeControls)
volDev = dev as IBasicVolumeControls;
else if (dev is IHasVolumeDevice)
volDev = (dev as IHasVolumeDevice).VolumeDevice;
}
if (volDev != CurrentVolumeControls)
{
// zero the volume on the device we are leaving.
// Set the volume to default on device we are entering
if (ZeroVolumeWhenSwtichingVolumeDevices && CurrentVolumeControls is IBasicVolumeWithFeedback)
{
var vd = CurrentVolumeControls as IBasicVolumeWithFeedback;
SavedVolumeLevels[vd] = (uint)vd.VolumeLevelFeedback.IntValue;
vd.SetVolume(0);
}
CurrentVolumeControls = volDev;
if (ZeroVolumeWhenSwtichingVolumeDevices && CurrentVolumeControls is IBasicVolumeWithFeedback)
{
var vd = CurrentVolumeControls as IBasicVolumeWithFeedback;
ushort vol = (SavedVolumeLevels.ContainsKey(vd) ? (ushort)SavedVolumeLevels[vd] : DefaultVolume);
vd.SetVolume(vol);
}
}
// -----------------------------------------------------------------------
// store the name and UI info for routes
if (item.SourceKey == "$off")
{
LeftDisplay.CurrentSourceInfoKey = routeKey;
LeftDisplay.CurrentSourceInfo = null;
RightDisplay.CurrentSourceInfoKey = routeKey;
RightDisplay.CurrentSourceInfo = null;
}
//else if (item.SourceKey != null)
//{
// if(item.RouteList
// CurrentSourceInfoKey = routeKey;
// CurrentSourceInfo = item;
//}
OnFeedback.FireUpdate();
// report back when done
if (successCallback != null)
successCallback();
}
catch (Exception e)
{
Debug.Console(1, this, "ERROR in routing: {0}", e);
}
SourceSelectLock.Leave();
}, 0); // end of CTimer
}
/// <summary>
///
/// </summary>
/// <param name="route"></param>
void DoRouteItem(SourceRouteListItem route, SourceListItem sourceItem, string sourceItemKey)
{
// if there is a $defaultAll on route, run two separate
if (route.DestinationKey.Equals("$defaultAll", StringComparison.OrdinalIgnoreCase))
{
// Going to assume a single-path route for now
var tempVideo = new SourceRouteListItem
{
DestinationKey = "$defaultDisplay",
SourceKey = route.SourceKey,
Type = eRoutingSignalType.Video
};
DoRoute(tempVideo, sourceItem, sourceItemKey);
}
else
DoRoute(route, sourceItem, sourceItemKey);
}
/// <summary>
///
/// </summary>
/// <param name="route"></param>
/// <returns></returns>
bool DoRoute(SourceRouteListItem route, SourceListItem sourceItem, string sourceItemKey)
{
IRoutingSinkNoSwitching dest = null;
if (route.DestinationKey.Equals("$defaultaudio", StringComparison.OrdinalIgnoreCase))
dest = DefaultAudioDevice as IRoutingSinkNoSwitching;
else if (route.DestinationKey.Equals(LeftDisplay.Key, StringComparison.OrdinalIgnoreCase))
dest = LeftDisplay;
else if (route.DestinationKey.Equals(RightDisplay.Key, StringComparison.OrdinalIgnoreCase))
dest = RightDisplay;
else
dest = DeviceManager.GetDeviceForKey(route.DestinationKey) as IRoutingSinkNoSwitching;
if (dest == null)
{
Debug.Console(1, this, "Cannot route, unknown destination '{0}'", route.DestinationKey);
return false;
}
if (route.SourceKey.Equals("$off", StringComparison.OrdinalIgnoreCase))
{
dest.ReleaseRoute();
if (dest is IPower)
(dest as IPower).PowerOff();
}
else
{
var source = DeviceManager.GetDeviceForKey(route.SourceKey) as IRoutingOutputs;
if (source == null)
{
Debug.Console(1, this, "Cannot route unknown source '{0}' to {1}", route.SourceKey, route.DestinationKey);
return false;
}
dest.ReleaseAndMakeRoute(source, route.Type);
dest.CurrentSourceInfoKey = sourceItemKey;
dest.CurrentSourceInfo = sourceItem;
}
return true;
}
public override void RoomVacatedForTimeoutPeriod(object o)
{
//Implement this
}
/// <summary>
/// Does what it says
/// </summary>
public override void SetDefaultLevels()
{
Debug.Console(1, this, "Restoring default levels");
var vc = CurrentVolumeControls as IBasicVolumeWithFeedback;
if (vc != null)
vc.SetVolume(DefaultVolume);
}
/// <summary>
/// Will power the room on with the last-used source
/// </summary>
public override void PowerOnToDefaultOrLastSource()
{
if (!EnablePowerOnToLastSource || LastSourceKey == null)
return;
RunRouteAction(LastSourceKey);
}
/// <summary>
/// Runs "roomOff" action on all rooms not set to ExcludeFromGlobalFunctions
/// </summary>
public static void AllRoomsOff()
{
var allRooms = DeviceManager.AllDevices.Where(d =>
d is EssentialsHuddleSpaceRoom && !(d as EssentialsHuddleSpaceRoom).ExcludeFromGlobalFunctions);
foreach (var room in allRooms)
(room as EssentialsHuddleSpaceRoom).RunRouteAction("roomOff");
}
#region IPrivacy Members
public void PrivacyModeOff()
{
VideoCodec.PrivacyModeOff();
}
public void PrivacyModeOn()
{
VideoCodec.PrivacyModeOn();
}
public void PrivacyModeToggle()
{
VideoCodec.PrivacyModeToggle();
}
#endregion
}
}

View File

@@ -13,10 +13,10 @@ using PepperDash.Essentials.Room.Config;
namespace PepperDash.Essentials
{
public class EssentialsHuddleSpaceRoom : EssentialsRoomBase, IHasCurrentSourceInfoChange, IRunRouteAction, IRunDefaultPresentRoute, IHasCurrentVolumeControls
public class EssentialsHuddleSpaceRoom : EssentialsRoomBase, IHasCurrentSourceInfoChange, IRunRouteAction, IRunDefaultPresentRoute, IHasCurrentVolumeControls, IHasDefaultDisplay
{
public event EventHandler<VolumeDeviceChangeEventArgs> CurrentVolumeDeviceChange;
public event SourceInfoChangeHandler CurrentSingleSourceChange;
public event SourceInfoChangeHandler CurrentSourceChange;
protected override Func<bool> OnFeedbackFunc
{
@@ -76,11 +76,6 @@ namespace PepperDash.Essentials
public bool ExcludeFromGlobalFunctions { get; set; }
/// <summary>
/// The config name of the source list
/// </summary>
public string SourceListKey { get; set; }
public string DefaultSourceItem { get; set; }
public ushort DefaultVolume { get; set; }
@@ -124,17 +119,17 @@ namespace PepperDash.Essentials
public SourceListItem CurrentSourceInfo
{
get { return _CurrentSourceInfo; }
private set
set
{
if (value == _CurrentSourceInfo) return;
var handler = CurrentSingleSourceChange;
var handler = CurrentSourceChange;
// remove from in-use tracker, if so equipped
if(_CurrentSourceInfo != null && _CurrentSourceInfo.SourceDevice is IInUseTracking)
(_CurrentSourceInfo.SourceDevice as IInUseTracking).InUseTracker.RemoveUser(this, "control");
if (handler != null)
handler(this, _CurrentSourceInfo, ChangeType.WillChange);
handler(_CurrentSourceInfo, ChangeType.WillChange);
_CurrentSourceInfo = value;
@@ -142,12 +137,12 @@ namespace PepperDash.Essentials
if (_CurrentSourceInfo != null && _CurrentSourceInfo.SourceDevice is IInUseTracking)
(_CurrentSourceInfo.SourceDevice as IInUseTracking).InUseTracker.AddUser(this, "control");
if (handler != null)
handler(this, _CurrentSourceInfo, ChangeType.DidChange);
handler( _CurrentSourceInfo, ChangeType.DidChange);
}
}
SourceListItem _CurrentSourceInfo;
public string CurrentSourceInfoKey { get; private set; }
public string CurrentSourceInfoKey { get; set; }
public EssentialsHuddleSpaceRoom(DeviceConfig config)
: base(config)
@@ -251,7 +246,7 @@ namespace PepperDash.Essentials
// Add Occupancy object from config
if (PropertiesConfig.Occupancy != null)
this.SetRoomOccupancy(DeviceManager.GetDeviceForKey(PropertiesConfig.Occupancy.DeviceKey) as
PepperDash.Essentials.Devices.Common.Occupancy.IOccupancyStatusProvider, PropertiesConfig.Occupancy.TimeoutMinutes);
IOccupancyStatusProvider, PropertiesConfig.Occupancy.TimeoutMinutes);
this.LogoUrl = PropertiesConfig.Logo.GetUrl();
this.SourceListKey = PropertiesConfig.SourceListKey;

View File

@@ -16,11 +16,11 @@ using PepperDash.Essentials.Devices.Common.AudioCodec;
namespace PepperDash.Essentials
{
public class EssentialsHuddleVtc1Room : EssentialsRoomBase, IHasCurrentSourceInfoChange,
IPrivacy, IHasCurrentVolumeControls, IRunRouteAction, IRunDefaultCallRoute, IHasVideoCodec, IHasAudioCodec
public class EssentialsHuddleVtc1Room : EssentialsRoomBase, IHasCurrentSourceInfoChange,
IPrivacy, IHasCurrentVolumeControls, IRunRouteAction, IRunDefaultCallRoute, IHasVideoCodec, IHasAudioCodec, IHasDefaultDisplay, IHasInCallFeedback
{
public event EventHandler<VolumeDeviceChangeEventArgs> CurrentVolumeDeviceChange;
public event SourceInfoChangeHandler CurrentSingleSourceChange;
public event SourceInfoChangeHandler CurrentSourceChange;
//************************
@@ -112,11 +112,6 @@ namespace PepperDash.Essentials
public AudioCodecBase AudioCodec { get; private set; }
public bool ExcludeFromGlobalFunctions { get; set; }
/// <summary>
/// The config name of the source list
/// </summary>
public string SourceListKey { get; set; }
public string DefaultSourceItem { get; set; }
@@ -162,17 +157,17 @@ namespace PepperDash.Essentials
public SourceListItem CurrentSourceInfo
{
get { return _CurrentSourceInfo; }
private set
set
{
if (value == _CurrentSourceInfo) return;
var handler = CurrentSingleSourceChange;
var handler = CurrentSourceChange;
// remove from in-use tracker, if so equipped
if(_CurrentSourceInfo != null && _CurrentSourceInfo.SourceDevice is IInUseTracking)
(_CurrentSourceInfo.SourceDevice as IInUseTracking).InUseTracker.RemoveUser(this, "control");
if (handler != null)
handler(this, _CurrentSourceInfo, ChangeType.WillChange);
handler(_CurrentSourceInfo, ChangeType.WillChange);
_CurrentSourceInfo = value;
@@ -180,12 +175,12 @@ namespace PepperDash.Essentials
if (_CurrentSourceInfo != null && _CurrentSourceInfo.SourceDevice is IInUseTracking)
(_CurrentSourceInfo.SourceDevice as IInUseTracking).InUseTracker.AddUser(this, "control");
if (handler != null)
handler(this, _CurrentSourceInfo, ChangeType.DidChange);
handler(_CurrentSourceInfo, ChangeType.DidChange);
}
}
SourceListItem _CurrentSourceInfo;
public string CurrentSourceInfoKey { get; private set; }
public string CurrentSourceInfoKey { get; set; }
/// <summary>
/// "codecOsd"
@@ -256,19 +251,28 @@ namespace PepperDash.Essentials
}
};
disp.IsWarmingUpFeedback.OutputChange += (o, a) =>
{
disp.IsWarmingUpFeedback.OutputChange += (o, a) =>
{
IsWarmingUpFeedback.FireUpdate();
if (!IsWarmingUpFeedback.BoolValue)
(CurrentVolumeControls as IBasicVolumeWithFeedback).SetVolume(DefaultVolume);
};
disp.IsCoolingDownFeedback.OutputChange += (o, a) =>
disp.IsCoolingDownFeedback.OutputChange += (o, a) =>
{
IsCoolingDownFeedback.FireUpdate();
IsCoolingDownFeedback.FireUpdate();
};
}
// Get Microphone Privacy object, if any
this.MicrophonePrivacy = EssentialsRoomConfigHelper.GetMicrophonePrivacy(PropertiesConfig, this);
Debug.Console(2, this, "Microphone Privacy Config evaluated.");
// Get emergency object, if any
this.Emergency = EssentialsRoomConfigHelper.GetEmergency(PropertiesConfig, this);
Debug.Console(2, this, "Emergency Config evaluated.");
// Combines call feedback from both codecs if available
InCallFeedback = new BoolFeedback(() =>
{
@@ -320,19 +324,13 @@ namespace PepperDash.Essentials
// Add Occupancy object from config
if (PropertiesConfig.Occupancy != null)
this.SetRoomOccupancy(DeviceManager.GetDeviceForKey(PropertiesConfig.Occupancy.DeviceKey) as
PepperDash.Essentials.Devices.Common.Occupancy.IOccupancyStatusProvider, PropertiesConfig.Occupancy.TimeoutMinutes);
IOccupancyStatusProvider, PropertiesConfig.Occupancy.TimeoutMinutes);
this.LogoUrl = PropertiesConfig.Logo.GetUrl();
this.SourceListKey = PropertiesConfig.SourceListKey;
this.DefaultSourceItem = PropertiesConfig.DefaultSourceItem;
this.DefaultVolume = (ushort)(PropertiesConfig.Volumes.Master.Level * 65535 / 100);
// Get Microphone Privacy object, if any
this.MicrophonePrivacy = EssentialsRoomConfigHelper.GetMicrophonePrivacy(PropertiesConfig, this);
// Get emergency object, if any
this.Emergency = EssentialsRoomConfigHelper.GetEmergency(PropertiesConfig, this);
return base.CustomActivate();
}

View File

@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Devices;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Room.Config;
namespace PepperDash.Essentials.Room.Types
{
/// <summary>
/// Base class for rooms with more than a single display
/// </summary>
public abstract class EssentialsNDisplayRoomBase : EssentialsRoomBase
{
//public event SourceInfoChangeHandler CurrentSingleSourceChange;
public EssentialsNDisplayRoomBase(DeviceConfig config)
: base (config)
{
var propertiesConfig = JsonConvert.DeserializeObject<EssentialsNDisplayRoomPropertiesConfig>(config.Properties.ToString());
}
}
}

View File

@@ -33,7 +33,7 @@
// public Dictionary<uint, IRoutingSinkNoSwitching> Displays { get; private set; }
// public IRoutingSinkNoSwitching DefaultAudioDevice { get; private set; }
// public IBasicVolumeControls DefaultVolumeControls { get; private set; }
// public IBasicVolumeControls DefaultVolumeControls { get; private set; }C:\Working Directories\PD\essentials\PepperDashEssentials\Room\Types\EssentialsPresentationRoom.cs
// /// <summary>
// /// The config name of the source list

View File

@@ -1,48 +0,0 @@
namespace PepperDash.Essentials
{
public class CrestronTouchpanelPropertiesConfig
{
public string IpId { get; set; }
public string DefaultRoomKey { get; set; }
public string RoomListKey { get; set; }
public string SgdFile { get; set; }
public string ProjectName { get; set; }
public bool ShowVolumeGauge { get; set; }
public bool UsesSplashPage { get; set; }
public bool ShowDate { get; set; }
public bool ShowTime { get; set; }
public UiSetupPropertiesConfig Setup { get; set; }
public string HeaderStyle { get; set; }
public bool IncludeInFusionRoomHealth { get; set; }
/// <summary>
/// The count of sources that will trigger the "additional" arrows to show on the SRL.
/// Defaults to 5
/// </summary>
public int SourcesOverflowCount { get; set; }
public CrestronTouchpanelPropertiesConfig()
{
SourcesOverflowCount = 5;
HeaderStyle = CrestronTouchpanelPropertiesConfig.Habanero;
}
/// <summary>
/// "habanero"
/// </summary>
public const string Habanero = "habanero";
/// <summary>
/// "verbose"
/// </summary>
public const string Verbose = "verbose";
}
/// <summary>
///
/// </summary>
public class UiSetupPropertiesConfig
{
public bool IsVisible { get; set; }
}
}

View File

@@ -13,7 +13,7 @@ using PepperDash.Essentials.Core.PageManagers;
namespace PepperDash.Essentials
{
public class EssentialsTouchpanelController : Device
public class EssentialsTouchpanelController : Device, IHasBasicTriListWithSmartObject
{
public BasicTriListWithSmartObject Panel { get; private set; }
@@ -27,9 +27,17 @@ namespace PepperDash.Essentials
{
Panel = tsw;
tsw.LoadSmartObjects(sgdPath);
tsw.SigChange += new Crestron.SimplSharpPro.DeviceSupport.SigEventHandler(Tsw_SigChange);
tsw.SigChange += Panel_SigChange;
}
public EssentialsTouchpanelController(string key, string name, Dge100 panel, string projectName, string sgdPath)
: base(key, name)
{
Panel = panel;
panel.LoadSmartObjects(sgdPath);
panel.SigChange += Panel_SigChange;
}
/// <summary>
/// Config constructor
/// </summary>
@@ -102,7 +110,7 @@ namespace PepperDash.Essentials
}
Panel.LoadSmartObjects(sgdName);
Panel.SigChange += Tsw_SigChange;
Panel.SigChange += Panel_SigChange;
}
@@ -158,7 +166,7 @@ namespace PepperDash.Essentials
}
}
void Tsw_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args)
void Panel_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args)
{
if (Debug.Level == 2)
Debug.Console(2, this, "Sig change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);

View File

@@ -25,11 +25,11 @@ namespace PepperDash.Essentials
public void RegisterForSourceChange(IHasCurrentSourceInfoChange room)
{
room.CurrentSingleSourceChange -= room_CurrentSourceInfoChange;
room.CurrentSingleSourceChange += room_CurrentSourceInfoChange;
room.CurrentSourceChange -= room_CurrentSourceInfoChange;
room.CurrentSourceChange += room_CurrentSourceInfoChange;
}
void room_CurrentSourceInfoChange(EssentialsRoomBase room, SourceListItem info, ChangeType type)
void room_CurrentSourceInfoChange(SourceListItem info, ChangeType type)
{
if (type == ChangeType.WillChange && info == SourceItem)
ClearFeedback();

View File

@@ -733,7 +733,7 @@ namespace PepperDash.Essentials
// Disconnect current room
_CurrentRoom.CurrentVolumeDeviceChange -= this.CurrentRoom_CurrentAudioDeviceChange;
ClearAudioDeviceConnections();
_CurrentRoom.CurrentSingleSourceChange -= this.CurrentRoom_SourceInfoChange;
_CurrentRoom.CurrentSourceChange -= this.CurrentRoom_SourceInfoChange;
DisconnectSource(_CurrentRoom.CurrentSourceInfo);
_CurrentRoom.ShutdownPromptTimer.HasStarted -= ShutdownPromptTimer_HasStarted;
_CurrentRoom.ShutdownPromptTimer.HasFinished -= ShutdownPromptTimer_HasFinished;
@@ -803,7 +803,7 @@ namespace PepperDash.Essentials
_CurrentRoom.CurrentVolumeDeviceChange += CurrentRoom_CurrentAudioDeviceChange;
RefreshAudioDeviceConnections();
_CurrentRoom.CurrentSingleSourceChange += CurrentRoom_SourceInfoChange;
_CurrentRoom.CurrentSourceChange += CurrentRoom_SourceInfoChange;
RefreshSourceInfo();
(Parent as EssentialsPanelMainInterfaceDriver).HeaderDriver.SetupHeaderButtons(this, CurrentRoom);
@@ -1064,8 +1064,7 @@ namespace PepperDash.Essentials
/// <summary>
/// Handles source change
/// </summary>
void CurrentRoom_SourceInfoChange(EssentialsRoomBase room,
SourceListItem info, ChangeType change)
void CurrentRoom_SourceInfoChange(SourceListItem info, ChangeType change)
{
if (change == ChangeType.WillChange)
DisconnectSource(info);

View File

@@ -885,7 +885,7 @@ namespace PepperDash.Essentials
// Disconnect current room
_CurrentRoom.CurrentVolumeDeviceChange -= this.CurrentRoom_CurrentAudioDeviceChange;
ClearAudioDeviceConnections();
_CurrentRoom.CurrentSingleSourceChange -= this.CurrentRoom_SourceInfoChange;
_CurrentRoom.CurrentSourceChange -= this.CurrentRoom_SourceInfoChange;
DisconnectSource(_CurrentRoom.CurrentSourceInfo);
_CurrentRoom.ShutdownPromptTimer.HasStarted -= ShutdownPromptTimer_HasStarted;
_CurrentRoom.ShutdownPromptTimer.HasFinished -= ShutdownPromptTimer_HasFinished;
@@ -924,7 +924,7 @@ namespace PepperDash.Essentials
_CurrentRoom.CurrentVolumeDeviceChange += CurrentRoom_CurrentAudioDeviceChange;
RefreshAudioDeviceConnections();
_CurrentRoom.CurrentSingleSourceChange += CurrentRoom_SourceInfoChange;
_CurrentRoom.CurrentSourceChange += CurrentRoom_SourceInfoChange;
RefreshSourceInfo();
if (_CurrentRoom.VideoCodec is IHasScheduleAwareness)
@@ -939,7 +939,7 @@ namespace PepperDash.Essentials
SetActiveCallListSharingContentStatus();
if (_CurrentRoom != null)
_CurrentRoom.CurrentSingleSourceChange += new SourceInfoChangeHandler(CurrentRoom_CurrentSingleSourceChange);
_CurrentRoom.CurrentSourceChange += new SourceInfoChangeHandler(CurrentRoom_CurrentSingleSourceChange);
TriList.SetSigFalseAction(UIBoolJoin.CallStopSharingPress, () => _CurrentRoom.RunRouteAction("codecOsd"));
@@ -1050,7 +1050,7 @@ namespace PepperDash.Essentials
/// <param name="room"></param>
/// <param name="info"></param>
/// <param name="type"></param>
void CurrentRoom_CurrentSingleSourceChange(EssentialsRoomBase room, SourceListItem info, ChangeType type)
void CurrentRoom_CurrentSingleSourceChange(SourceListItem info, ChangeType type)
{
if (_CurrentRoom.VideoCodec.SharingContentIsOnFeedback.BoolValue && _CurrentRoom.CurrentSourceInfo != null)
TriList.StringInput[UIStringJoin.CallSharedSourceNameText].StringValue = _CurrentRoom.CurrentSourceInfo.PreferredName;
@@ -1363,8 +1363,7 @@ namespace PepperDash.Essentials
/// <summary>
/// Handles source change
/// </summary>
void CurrentRoom_SourceInfoChange(EssentialsRoomBase room,
SourceListItem info, ChangeType change)
void CurrentRoom_SourceInfoChange(SourceListItem info, ChangeType change)
{
if (change == ChangeType.WillChange)
DisconnectSource(info);

View File

@@ -64,11 +64,11 @@ namespace PepperDash.Essentials
parent.SetItemMainText(index, room.Name);
UpdateItem(room.CurrentSourceInfo);
// Watch for later changes
room.CurrentSingleSourceChange += new SourceInfoChangeHandler(room_CurrentSourceInfoChange);
room.CurrentSourceChange += new SourceInfoChangeHandler(room_CurrentSourceInfoChange);
parent.SetItemButtonAction(index, buttonAction);
}
void room_CurrentSourceInfoChange(EssentialsRoomBase room, SourceListItem info, ChangeType type)
void room_CurrentSourceInfoChange(SourceListItem info, ChangeType type)
{
UpdateItem(info);
}

View File

@@ -9,8 +9,8 @@ using PepperDash.Essentials.Core;
namespace PepperDash.Essentials
{
/// <summary>
/// The handler type for a Room's SourceInfoChange
/// </summary>
public delegate void SourceInfoChangeHandler(EssentialsRoomBase room, SourceListItem info, ChangeType type);
///// <summary>
///// The handler type for a Room's SourceInfoChange
///// </summary>
//public delegate void SourceInfoChangeHandler(EssentialsRoomBase room, SourceListItem info, ChangeType type);
}

View File

@@ -102,7 +102,6 @@ namespace PepperDash.Essentials.UIDrivers.VC
SetupCallStagingPopover();
SetupDialKeypad();
ActiveCallsSRL = new SubpageReferenceList(triList, UISmartObjectJoin.CodecActiveCallsHeaderList, 5,5,5);
SetupDirectoryList();
SetupRecentCallsList();
SetupFavorites();
SetupLayoutControls();
@@ -160,6 +159,8 @@ namespace PepperDash.Essentials.UIDrivers.VC
});
SearchStringFeedback.LinkInputSig(triList.StringInput[UIStringJoin.CodecDirectorySearchEntryText]);
SetupDirectoryList();
SearchStringBackspaceVisibleFeedback = new BoolFeedback(() => SearchStringBuilder.Length > 0);
SearchStringBackspaceVisibleFeedback.LinkInputSig(triList.BooleanInput[UIBoolJoin.VCDirectoryBackspaceVisible]);
@@ -711,10 +712,10 @@ namespace PepperDash.Essentials.UIDrivers.VC
void SetupLayoutControls()
{
TriList.SetSigFalseAction(UIBoolJoin.VCStagingSelfViewLayoutPress, this.ShowSelfViewLayout);
var svc = Codec as IHasCodecSelfview;
var svc = Codec as IHasCodecSelfView;
if (svc != null)
{
TriList.SetSigFalseAction(UIBoolJoin.VCSelfViewTogglePress, svc.SelfviewModeToggle);
TriList.SetSigFalseAction(UIBoolJoin.VCSelfViewTogglePress, svc.SelfViewModeToggle);
svc.SelfviewIsOnFeedback.LinkInputSig(TriList.BooleanInput[UIBoolJoin.VCSelfViewTogglePress]);
}
var lc = Codec as IHasCodecLayouts;
@@ -1065,19 +1066,12 @@ namespace PepperDash.Essentials.UIDrivers.VC
/// </summary>
void SearchKeypadClear()
{
try
{
SearchStringBuilder.Remove(0, SearchStringBuilder.Length);
SearchStringFeedback.FireUpdate();
SearchStringKeypadCheckEnables();
SearchStringBuilder.Remove(0, SearchStringBuilder.Length);
SearchStringFeedback.FireUpdate();
SearchStringKeypadCheckEnables();
if ((Codec as IHasDirectory).CurrentDirectoryResultIsNotDirectoryRoot.BoolValue)
SetCurrentDirectoryToRoot();
}
catch (Exception e)
{
Debug.Console(1, "SearchKeypadClear() blew up!: {0}", e);
}
if ((Codec as IHasDirectory).CurrentDirectoryResultIsNotDirectoryRoot.BoolValue)
SetCurrentDirectoryToRoot();
}
/// <summary>

13
README.md Normal file
View File

@@ -0,0 +1,13 @@
# Pepperdash Essentials
## RELEASE PROCESS CONTROLLED BY JENKINS CI PROCESS
#### How to merge
- Make changes
- Build
- Test on your system
- Commit and push to essentials
- Curse a whole lot when you try to figure out how to then get developments all synced up

View File

@@ -34,4 +34,10 @@ devjson:3 {"deviceKey":"room1.RoomOccupancy.RoomIsOccupiedFeedback","methodName"
devjson:2 {"deviceKey":"codec-comms-ssh", "methodName":"SendText", "params": ["xcommand dial number: 10.11.50.211\r"]}
devjson:2 {"deviceKey":"codec-comms-ssh", "methodName":"Connect", "params": []}
devjson:2 {"deviceKey":"codec-comms-ssh", "methodName":"Connect", "params": []}
devjson:1 {"deviceKey":"commBridge", "methodName":"ExecuteJoinAction", "params":[ 301, "digital", true ]}
devjson:2 {"deviceKey":"display01Comm-com", "methodName":"SendText", "params": [ "I'M GETTING TIRED OF THIS" ]}
devjson:10 {"deviceKey":"dmLink-ssh", "methodName":"Connect", "params": []}

View File

@@ -0,0 +1,20 @@
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PepperDash_Essentials_Core", "PepperDashEssentialsBase\PepperDash_Essentials_Core.csproj", "{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,100 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DM;
using PepperDash.Core;
namespace PepperDash.Essentials.Core
{
public class CecPortController : Device, IBasicCommunication
{
public event EventHandler<GenericCommMethodReceiveBytesArgs> BytesReceived;
public event EventHandler<GenericCommMethodReceiveTextArgs> TextReceived;
public bool IsConnected { get { return true; } }
ICec Port;
public CecPortController(string key, ICec port)
: base(key)
{
Port = port;
Port.StreamCec.CecChange += new CecChangeEventHandler(StreamCec_CecChange);
}
void StreamCec_CecChange(Cec cecDevice, CecEventArgs args)
{
if (args.EventId == CecEventIds.CecMessageReceivedEventId)
OnDataReceived(cecDevice.Received.StringValue);
else if (args.EventId == CecEventIds.ErrorFeedbackEventId)
if(cecDevice.ErrorFeedback.BoolValue)
Debug.Console(2, this, "CEC NAK Error");
}
void OnDataReceived(string s)
{
var bytesHandler = BytesReceived;
if (bytesHandler != null)
{
var bytes = Encoding.GetEncoding(28591).GetBytes(s);
bytesHandler(this, new GenericCommMethodReceiveBytesArgs(bytes));
}
var textHandler = TextReceived;
if (textHandler != null)
textHandler(this, new GenericCommMethodReceiveTextArgs(s));
}
#region IBasicCommunication Members
public void SendText(string text)
{
if (Port == null)
return;
Port.StreamCec.Send.StringValue = text;
}
public void SendBytes(byte[] bytes)
{
if (Port == null)
return;
var text = Encoding.GetEncoding(28591).GetString(bytes, 0, bytes.Length);
Port.StreamCec.Send.StringValue = text;
}
public void Connect()
{
}
public void Disconnect()
{
}
#endregion
/// <summary>
///
/// </summary>
/// <param name="s"></param>
public void SimulateReceive(string s)
{
// split out hex chars and build string
var split = Regex.Split(s, @"(\\[Xx][0-9a-fA-F][0-9a-fA-F])");
StringBuilder b = new StringBuilder();
foreach (var t in split)
{
if (t.StartsWith(@"\") && t.Length == 4)
b.Append((char)(Convert.ToByte(t.Substring(2, 2), 16)));
else
b.Append(t);
}
OnDataReceived(b.ToString());
}
}
}

View File

@@ -0,0 +1,132 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using PepperDash.Core;
namespace PepperDash.Essentials.Core
{
public class ComPortController : Device, IBasicCommunication
{
public event EventHandler<GenericCommMethodReceiveBytesArgs> BytesReceived;
public event EventHandler<GenericCommMethodReceiveTextArgs> TextReceived;
public bool IsConnected { get { return true; } }
ComPort Port;
ComPort.ComPortSpec Spec;
public ComPortController(string key, ComPort port, ComPort.ComPortSpec spec)
: base(key)
{
if (port == null)
{
Debug.Console(0, this, "ERROR: Invalid com port, continuing but comms will not function");
return;
}
Port = port;
Spec = spec;
//IsConnected = new BoolFeedback(CommonBoolCue.IsConnected, () => true);
if (Port.Parent is CrestronControlSystem)
{
var result = Port.Register();
if (result != eDeviceRegistrationUnRegistrationResponse.Success)
{
Debug.Console(0, this, "ERROR: Cannot register Com port: {0}", result);
return; // false
}
}
var specResult = Port.SetComPortSpec(Spec);
if (specResult != 0)
{
Debug.Console(0, this, "WARNING: Cannot set comspec");
return; // false
}
Port.SerialDataReceived += new ComPortDataReceivedEvent(Port_SerialDataReceived);
}
~ComPortController()
{
Port.SerialDataReceived -= Port_SerialDataReceived;
}
void Port_SerialDataReceived(ComPort ReceivingComPort, ComPortSerialDataEventArgs args)
{
OnDataReceived(args.SerialData);
}
void OnDataReceived(string s)
{
var bytesHandler = BytesReceived;
if (bytesHandler != null)
{
var bytes = Encoding.GetEncoding(28591).GetBytes(s);
bytesHandler(this, new GenericCommMethodReceiveBytesArgs(bytes));
}
var textHandler = TextReceived;
if (textHandler != null)
textHandler(this, new GenericCommMethodReceiveTextArgs(s));
}
public override bool Deactivate()
{
return Port.UnRegister() == eDeviceRegistrationUnRegistrationResponse.Success;
}
#region IBasicCommunication Members
public void SendText(string text)
{
if (Port == null)
return;
Port.Send(text);
}
public void SendBytes(byte[] bytes)
{
if (Port == null)
return;
var text = Encoding.GetEncoding(28591).GetString(bytes, 0, bytes.Length);
Port.Send(text);
}
public void Connect()
{
}
public void Disconnect()
{
}
#endregion
/// <summary>
///
/// </summary>
/// <param name="s"></param>
public void SimulateReceive(string s)
{
// split out hex chars and build string
var split = Regex.Split(s, @"(\\[Xx][0-9a-fA-F][0-9a-fA-F])");
StringBuilder b = new StringBuilder();
foreach (var t in split)
{
if (t.StartsWith(@"\") && t.Length == 4)
b.Append((char)(Convert.ToByte(t.Substring(2, 2), 16)));
else
b.Append(t);
}
OnDataReceived(b.ToString());
}
}
}

View File

@@ -0,0 +1,102 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
namespace PepperDash.Essentials.Core
{
/// <summary>
/// This converter creates a proper ComPort.ComPortSpec struct from more-friendly JSON values. It uses
/// ComSpecPropsJsonConverter to finish the individual properties.
/// </summary>
public class ComSpecJsonConverter : JsonConverter
{
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
if (objectType == typeof(ComPort.ComPortSpec))
{
var newSer = new JsonSerializer();
newSer.Converters.Add(new ComSpecPropsJsonConverter());
newSer.ObjectCreationHandling = ObjectCreationHandling.Replace;
return newSer.Deserialize<ComPort.ComPortSpec>(reader);
}
return null;
}
/// <summary>
///
/// </summary>
public override bool CanConvert(Type objectType)
{
return objectType == typeof(ComPort.ComPortSpec);
}
public override bool CanRead { get { return true; } }
/// <summary>
/// This converter will not be used for writing
/// </summary>
public override bool CanWrite { get { return false; } }
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
throw new NotImplementedException();
}
}
/// <summary>
/// The gist of this converter: The comspec JSON comes in with normal values that need to be converted
/// into enum names. This converter takes the value and applies the appropriate enum's name prefix to the value
/// and then returns the enum value using Enum.Parse. NOTE: Does not write
/// </summary>
public class ComSpecPropsJsonConverter : JsonConverter
{
public override bool CanConvert(Type objectType)
{
return objectType == typeof(ComPort.eComBaudRates)
|| objectType == typeof(ComPort.eComDataBits)
|| objectType == typeof(ComPort.eComParityType)
|| objectType == typeof(ComPort.eComHardwareHandshakeType)
|| objectType == typeof(ComPort.eComSoftwareHandshakeType)
|| objectType == typeof(ComPort.eComProtocolType)
|| objectType == typeof(ComPort.eComStopBits);
}
public override bool CanRead { get { return true; } }
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
//Debug.Console(2, "ReadJson type: " + objectType.Name);
if (objectType == typeof(ComPort.eComBaudRates))
return Enum.Parse(typeof(ComPort.eComBaudRates), "ComspecBaudRate" + reader.Value, false);
else if (objectType == typeof(ComPort.eComDataBits))
return Enum.Parse(typeof(ComPort.eComDataBits), "ComspecDataBits" + reader.Value, true);
else if (objectType == typeof(ComPort.eComHardwareHandshakeType))
return Enum.Parse(typeof(ComPort.eComHardwareHandshakeType), "ComspecHardwareHandshake" + reader.Value, true);
else if (objectType == typeof(ComPort.eComParityType))
return Enum.Parse(typeof(ComPort.eComParityType), "ComspecParity" + reader.Value, true);
else if (objectType == typeof(ComPort.eComProtocolType))
return Enum.Parse(typeof(ComPort.eComProtocolType), "ComspecProtocol" + reader.Value, true);
else if (objectType == typeof(ComPort.eComSoftwareHandshakeType))
return Enum.Parse(typeof(ComPort.eComSoftwareHandshakeType), "ComspecSoftwareHandshake" + reader.Value, true);
else if (objectType == typeof(ComPort.eComStopBits))
return Enum.Parse(typeof(ComPort.eComStopBits), "ComspecStopBits" + reader.Value, true);
return null;
}
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
throw new NotImplementedException();
}
}
}

View File

@@ -0,0 +1,196 @@
using System;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DM;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.Core
{
/// <summary>
///
/// </summary>
public class CommFactory
{
public static EssentialsControlPropertiesConfig GetControlPropertiesConfig(DeviceConfig deviceConfig)
{
try
{
return JsonConvert.DeserializeObject<EssentialsControlPropertiesConfig>
(deviceConfig.Properties["control"].ToString());
//Debug.Console(2, "Control TEST: {0}", JsonConvert.SerializeObject(controlConfig));
}
catch (Exception e)
{
Debug.Console(0, "ERROR: [{0}] Control properties deserialize failed:\r{1}", deviceConfig.Key, e);
return null;
}
}
/// <summary>
/// Returns a comm method of either com port, TCP, SSH, and puts this into the DeviceManager
/// </summary>
/// <param name="deviceConfig">The Device config object</param>
public static IBasicCommunication CreateCommForDevice(DeviceConfig deviceConfig)
{
EssentialsControlPropertiesConfig controlConfig = GetControlPropertiesConfig(deviceConfig);
if (controlConfig == null)
return null;
IBasicCommunication comm = null;
try
{
var c = controlConfig.TcpSshProperties;
switch (controlConfig.Method)
{
case eControlMethod.Com:
comm = new ComPortController(deviceConfig.Key + "-com", GetComPort(controlConfig), controlConfig.ComParams);
break;
case eControlMethod.Cec:
comm = new CecPortController(deviceConfig.Key + "-cec", GetCecPort(controlConfig));
break;
case eControlMethod.IR:
break;
case eControlMethod.Ssh:
{
var ssh = new GenericSshClient(deviceConfig.Key + "-ssh", c.Address, c.Port, c.Username, c.Password);
ssh.AutoReconnect = c.AutoReconnect;
if(ssh.AutoReconnect)
ssh.AutoReconnectIntervalMs = c.AutoReconnectIntervalMs;
comm = ssh;
break;
}
case eControlMethod.Tcpip:
{
var tcp = new GenericTcpIpClient(deviceConfig.Key + "-tcp", c.Address, c.Port, c.BufferSize);
tcp.AutoReconnect = c.AutoReconnect;
if (tcp.AutoReconnect)
tcp.AutoReconnectIntervalMs = c.AutoReconnectIntervalMs;
comm = tcp;
break;
}
case eControlMethod.Udp:
{
var udp = new GenericUdpServer(deviceConfig.Key + "-udp", c.Address, c.Port, c.BufferSize);
comm = udp;
break;
}
case eControlMethod.Telnet:
break;
default:
break;
}
}
catch (Exception e)
{
Debug.Console(0, "Cannot create communication from JSON:\r{0}\r\rException:\r{1}",
deviceConfig.Properties.ToString(), e);
}
// put it in the device manager if it's the right flavor
var comDev = comm as Device;
if (comDev != null)
DeviceManager.AddDevice(comDev);
return comm;
}
public static ComPort GetComPort(EssentialsControlPropertiesConfig config)
{
var comPar = config.ComParams;
var dev = GetIComPortsDeviceFromManagedDevice(config.ControlPortDevKey);
if (dev != null && config.ControlPortNumber <= dev.NumberOfComPorts)
return dev.ComPorts[config.ControlPortNumber];
Debug.Console(0, "GetComPort: Device '{0}' does not have com port {1}", config.ControlPortDevKey, config.ControlPortNumber);
return null;
}
/// <summary>
/// Gets an ICec port from a RoutingInput or RoutingOutput on a device
/// </summary>
/// <param name="config"></param>
/// <returns></returns>
public static ICec GetCecPort(ControlPropertiesConfig config)
{
var dev = DeviceManager.GetDeviceForKey(config.ControlPortDevKey);
if (dev != null)
{
var inputPort = (dev as IRoutingInputsOutputs).InputPorts[config.ControlPortName];
if (inputPort != null)
if (inputPort.Port is ICec)
return inputPort.Port as ICec;
var outputPort = (dev as IRoutingInputsOutputs).OutputPorts[config.ControlPortName];
if (outputPort != null)
if (outputPort.Port is ICec)
return outputPort.Port as ICec;
}
Debug.Console(0, "GetCecPort: Device '{0}' does not have a CEC port called: '{1}'", config.ControlPortDevKey, config.ControlPortName);
return null;
}
/// <summary>
/// Helper to grab the IComPorts device for this PortDeviceKey. Key "controlSystem" will
/// return the ControlSystem object from the Global class.
/// </summary>
/// <returns>IComPorts device or null if the device is not found or does not implement IComPorts</returns>
public static IComPorts GetIComPortsDeviceFromManagedDevice(string ComPortDevKey)
{
if ((ComPortDevKey.Equals("controlSystem", System.StringComparison.OrdinalIgnoreCase)
|| ComPortDevKey.Equals("processor", System.StringComparison.OrdinalIgnoreCase))
&& Global.ControlSystem is IComPorts)
return Global.ControlSystem;
else
{
var dev = DeviceManager.GetDeviceForKey(ComPortDevKey) as IComPorts;
if (dev == null)
Debug.Console(0, "ComPortConfig: Cannot find com port device '{0}'", ComPortDevKey);
return dev;
}
}
}
/// <summary>
///
/// </summary>
public class EssentialsControlPropertiesConfig :
PepperDash.Core.ControlPropertiesConfig
{
[JsonConverter(typeof(ComSpecJsonConverter))]
public ComPort.ComPortSpec ComParams { get; set; }
public string CresnetId { get; set; }
/// <summary>
/// Attempts to provide uint conversion of string CresnetId
/// </summary>
public uint CresnetIdInt
{
get
{
try
{
return Convert.ToUInt32(CresnetId, 16);
}
catch (Exception)
{
throw new FormatException(string.Format("ERROR:Unable to convert Cresnet ID: {0} to hex. Error:\n{1}", CresnetId));
}
}
}
}
public class IrControlSpec
{
public string PortDeviceKey { get; set; }
public uint PortNumber { get; set; }
public string File { get; set; }
}
}

View File

@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
namespace PepperDash.Essentials.Core
{
/// <summary>
///
/// </summary>
public interface IComPortsDevice
{
IComPorts Device { get; }
}
}

View File

@@ -0,0 +1,74 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Core;
namespace PepperDash.Essentials.Core
{
public class ConsoleCommMockDevice : Device, ICommunicationMonitor
{
public IBasicCommunication Communication { get; private set; }
public CommunicationGather PortGather { get; private set; }
public StatusMonitorBase CommunicationMonitor { get; private set; }
/// <summary>
/// Defaults to \x0a
/// </summary>
public string LineEnding { get; set; }
/// <summary>
/// Set to true to show responses in full hex
/// </summary>
public bool ShowHexResponse { get; set; }
public ConsoleCommMockDevice(string key, string name, ConsoleCommMockDevicePropertiesConfig props, IBasicCommunication comm)
:base(key, name)
{
Communication = comm;
PortGather = new CommunicationGather(Communication, '\x0d');
PortGather.LineReceived += this.Port_LineReceived;
CommunicationMonitor = new GenericCommunicationMonitor(this, Communication, props.CommunicationMonitorProperties);
LineEnding = props.LineEnding;
}
public override bool CustomActivate()
{
Communication.Connect();
CommunicationMonitor.StatusChange += (o, a) => { Debug.Console(2, this, "Communication monitor state: {0}", CommunicationMonitor.Status); };
CommunicationMonitor.Start();
CrestronConsole.AddNewConsoleCommand(SendLine, "send" + Key, "", ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(s => Communication.Connect(), "con" + Key, "", ConsoleAccessLevelEnum.AccessOperator);
return true;
}
void Port_LineReceived(object dev, GenericCommMethodReceiveTextArgs args)
{
if (Debug.Level == 2)
Debug.Console(2, this, "RX: '{0}'",
ShowHexResponse ? ComTextHelper.GetEscapedText(args.Text) : args.Text);
}
void SendLine(string s)
{
//if (Debug.Level == 2)
// Debug.Console(2, this, " Send '{0}'", ComTextHelper.GetEscapedText(s));
Communication.SendText(s + LineEnding);
}
}
public class ConsoleCommMockDevicePropertiesConfig
{
public string LineEnding { get; set; }
public CommunicationMonitorConfig CommunicationMonitorProperties { get; set; }
public ConsoleCommMockDevicePropertiesConfig()
{
LineEnding = "\x0a";
}
}
}

View File

@@ -0,0 +1,105 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Newtonsoft.Json;
namespace PepperDash.Essentials.Core
{
public class ComPortController : Device, IBasicCommunication
{
public event EventHandler<GenericCommMethodReceiveBytesArgs> BytesReceived;
public event EventHandler<GenericCommMethodReceiveTextArgs> TextReceived;
ComPort Port;
ComPort.ComPortSpec Spec;
public ComPortController(string key, IComPorts ComDevice, uint comPortNum, ComPort.ComPortSpec spec)
: base(key)
{
Port = ComDevice.ComPorts[comPortNum];
Spec = spec;
Debug.Console(2, "Creating com port '{0}'", key);
Debug.Console(2, "Com port spec:\r{0}", JsonConvert.SerializeObject(spec));
}
/// <summary>
/// Creates a ComPort if the parameters are correct. Returns and logs errors if not
/// </summary>
public static ComPortController GetComPortController(string key,
IComPorts comDevice, uint comPortNum, ComPort.ComPortSpec spec)
{
Debug.Console(1, "Creating com port '{0}'", key);
if (comDevice == null)
throw new ArgumentNullException("comDevice");
if (string.IsNullOrEmpty(key))
throw new ArgumentNullException("key");
if (comPortNum > comDevice.NumberOfComPorts)
{
Debug.Console(0, "[{0}] Com port {1} out of range on {2}",
key, comPortNum, comDevice.GetType().Name);
return null;
}
var port = new ComPortController(key, comDevice, comPortNum, spec);
return port;
}
/// <summary>
/// Registers port and sends ComSpec
/// </summary>
/// <returns>false if either register or comspec fails</returns>
public override bool CustomActivate()
{
var result = Port.Register();
if (result != eDeviceRegistrationUnRegistrationResponse.Success)
{
Debug.Console(0, this, "Cannot register Com port: {0}", result);
return false;
}
var specResult = Port.SetComPortSpec(Spec);
if (specResult != 0)
{
Debug.Console(0, this, "Cannot set comspec");
return false;
}
Port.SerialDataReceived += new ComPortDataReceivedEvent(Port_SerialDataReceived);
return true;
}
void Port_SerialDataReceived(ComPort ReceivingComPort, ComPortSerialDataEventArgs args)
{
if (BytesReceived != null)
{
var bytes = Encoding.GetEncoding(28591).GetBytes(args.SerialData);
BytesReceived(this, new GenericCommMethodReceiveBytesArgs(bytes));
}
if(TextReceived != null)
TextReceived(this, new GenericCommMethodReceiveTextArgs(args.SerialData));
}
public override bool Deactivate()
{
return Port.UnRegister() == eDeviceRegistrationUnRegistrationResponse.Success;
}
#region IBasicCommunication Members
public void SendText(string text)
{
Port.Send(text);
}
public void SendBytes(byte[] bytes)
{
var text = Encoding.GetEncoding(28591).GetString(bytes, 0, bytes.Length);
Port.Send(text);
}
#endregion
}
}

View File

@@ -0,0 +1,56 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core.Devices;
using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.Core
{
/// <summary>
/// Serves as a generic wrapper class for all styles of IBasicCommuncation ports
/// </summary>
public class
GenericComm : ReconfigurableDevice
{
EssentialsControlPropertiesConfig PropertiesConfig;
public IBasicCommunication CommPort { get; private set; }
public GenericComm(DeviceConfig config)
: base(config)
{
PropertiesConfig = CommFactory.GetControlPropertiesConfig(config);
CommPort = CommFactory.CreateCommForDevice(config);
}
public void SetPortConfig(string portConfig)
{
// TODO: Deserialize new EssentialsControlPropertiesConfig and handle as necessary
try
{
PropertiesConfig = JsonConvert.DeserializeObject<EssentialsControlPropertiesConfig>
(portConfig.ToString());
}
catch (Exception e)
{
Debug.Console(2, this, "Error deserializing port config: {0}", e);
}
}
protected override void CustomSetConfig(DeviceConfig config)
{
PropertiesConfig = CommFactory.GetControlPropertiesConfig(config);
ConfigWriter.UpdateDeviceConfig(config);
}
}
}

View File

@@ -0,0 +1,160 @@
using System;
using System.Collections.Generic;
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Crestron.SimplSharpPro;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.Core
{
/// <summary>
///
/// </summary>
public static class IRPortHelper
{
public static string IrDriverPathPrefix
{
get
{
return Global.FilePathPrefix + "IR" + Global.DirectorySeparator;
}
}
/// <summary>
/// Finds either the ControlSystem or a device controller that contains IR ports and
/// returns a port from the hardware device
/// </summary>
/// <param name="propsToken"></param>
/// <returns>IrPortConfig object. The port and or filename will be empty/null
/// if valid values don't exist on config</returns>
public static IrOutPortConfig GetIrPort(JToken propsToken)
{
var control = propsToken["control"];
if (control == null)
return null;
if (control["method"].Value<string>() != "ir")
{
Debug.Console(0, "IRPortHelper called with non-IR properties");
return null;
}
var port = new IrOutPortConfig();
var portDevKey = control.Value<string>("controlPortDevKey");
var portNum = control.Value<uint>("controlPortNumber");
if (portDevKey == null || portNum == 0)
{
Debug.Console(1, "WARNING: Properties is missing port device or port number");
return port;
}
IIROutputPorts irDev = null;
if (portDevKey.Equals("controlSystem", StringComparison.OrdinalIgnoreCase)
|| portDevKey.Equals("processor", StringComparison.OrdinalIgnoreCase))
irDev = Global.ControlSystem;
else
irDev = DeviceManager.GetDeviceForKey(portDevKey) as IIROutputPorts;
if (irDev == null)
{
Debug.Console(1, "[Config] Error, device with IR ports '{0}' not found", portDevKey);
return port;
}
if (portNum <= irDev.NumberOfIROutputPorts) // success!
{
var file = IrDriverPathPrefix + control["irFile"].Value<string>();
port.Port = irDev.IROutputPorts[portNum];
port.FileName = file;
return port; // new IrOutPortConfig { Port = irDev.IROutputPorts[portNum], FileName = file };
}
else
{
Debug.Console(1, "[Config] Error, device '{0}' IR port {1} out of range",
portDevKey, portNum);
return port;
}
}
/// <summary>
/// Returns a ready-to-go IrOutputPortController from a DeviceConfig object.
/// </summary>
public static IrOutputPortController GetIrOutputPortController(DeviceConfig devConf)
{
var irControllerKey = devConf.Key + "-ir";
if (devConf.Properties == null)
{
Debug.Console(0, "[{0}] WARNING: Device config does not include properties. IR will not function.", devConf.Key);
return new IrOutputPortController(irControllerKey, null, "");
}
var control = devConf.Properties["control"];
if (control == null)
{
var c = new IrOutputPortController(irControllerKey, null, "");
Debug.Console(0, c, "WARNING: Device config does not include control properties. IR will not function");
return c;
}
var portDevKey = control.Value<string>("controlPortDevKey");
var portNum = control.Value<uint>("controlPortNumber");
IIROutputPorts irDev = null;
if (portDevKey == null)
{
var c = new IrOutputPortController(irControllerKey, null, "");
Debug.Console(0, c, "WARNING: control properties is missing ir device");
return c;
}
if (portNum == 0)
{
var c = new IrOutputPortController(irControllerKey, null, "");
Debug.Console(0, c, "WARNING: control properties is missing ir port number");
return c;
}
if (portDevKey.Equals("controlSystem", StringComparison.OrdinalIgnoreCase)
|| portDevKey.Equals("processor", StringComparison.OrdinalIgnoreCase))
irDev = Global.ControlSystem;
else
irDev = DeviceManager.GetDeviceForKey(portDevKey) as IIROutputPorts;
if (irDev == null)
{
var c = new IrOutputPortController(irControllerKey, null, "");
Debug.Console(0, c, "WARNING: device with IR ports '{0}' not found", portDevKey);
return c;
}
if (portNum <= irDev.NumberOfIROutputPorts) // success!
return new IrOutputPortController(irControllerKey, irDev.IROutputPorts[portNum],
IrDriverPathPrefix + control["irFile"].Value<string>());
else
{
var c = new IrOutputPortController(irControllerKey, null, "");
Debug.Console(0, c, "WARNING: device '{0}' IR port {1} out of range",
portDevKey, portNum);
return c;
}
}
}
/// <summary>
/// Wrapper to help in IR port creation
/// </summary>
public class IrOutPortConfig
{
public IROutputPort Port { get; set; }
public string FileName { get; set; }
public IrOutPortConfig()
{
FileName = "";
}
}
}

View File

@@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Core.Config
{
/// <summary>
/// Override this and splice on specific room type behavior, as well as other properties
/// </summary>
public class BasicConfig
{
[JsonProperty("info")]
public InfoConfig Info { get; set; }
[JsonProperty("devices")]
public List<DeviceConfig> Devices { get; set; }
[JsonProperty("sourceLists")]
public Dictionary<string, Dictionary<string, SourceListItem>> SourceLists { get; set; }
[JsonProperty("tieLines")]
public List<TieLineConfig> TieLines { get; set; }
[JsonProperty("joinMaps")]
public Dictionary<string, string> JoinMaps { get; set; }
/// <summary>
/// Checks SourceLists for a given list and returns it if found. Otherwise, returns null
/// </summary>
public Dictionary<string, SourceListItem> GetSourceListForKey(string key)
{
if (string.IsNullOrEmpty(key) || !SourceLists.ContainsKey(key))
return null;
return SourceLists[key];
}
}
}

View File

@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
using PepperDash.Core;
using Newtonsoft.Json.Linq;
namespace PepperDash.Essentials.Core.Config
{
public class ConfigPropertiesHelpers
{
/// <summary>
/// Returns the value of properties.hasAudio, or false if not defined
/// </summary>
public static bool GetHasAudio(DeviceConfig deviceConfig)
{
return deviceConfig.Properties.Value<bool>("hasAudio");
}
/// <summary>
/// Returns the value of properties.hasControls, or false if not defined
/// </summary>
public static bool GetHasControls(DeviceConfig deviceConfig)
{
return deviceConfig.Properties.Value<bool>("hasControls");
}
}
}

View File

@@ -0,0 +1,65 @@
using System;
using System.Collections.Generic;
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Crestron.SimplSharpPro;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Core.Config
{
public class DeviceConfig
{
[JsonProperty("key")]
public string Key { get; set; }
[JsonProperty("uid")]
public int Uid { get; set; }
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("group")]
public string Group { get; set; }
[JsonProperty("type")]
public string Type { get; set; }
[JsonProperty("properties")]
[JsonConverter(typeof(DevicePropertiesConverter))]
public JToken Properties { get; set; }
}
/// <summary>
///
/// </summary>
public class DevicePropertiesConverter : JsonConverter
{
public override bool CanConvert(Type objectType)
{
return objectType == typeof(JToken);
}
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
return JToken.ReadFrom(reader);
}
public override bool CanWrite
{
get
{
return false;
}
}
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
throw new NotImplementedException("SOD OFF HOSER");
}
}
}

View File

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

View File

@@ -0,0 +1,223 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Crestron.SimplSharp.Net.Http;
using Crestron.SimplSharpPro.Diagnostics;
using PepperDash.Core;
namespace PepperDash.Essentials.Core.Config
{
public static class ConfigUpdater
{
public static event EventHandler<ConfigStatusEventArgs> ConfigStatusChanged;
public static void GetConfigFromServer(string url)
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to get new config from '{0}'", url);
// HTTP GET
var req = new HttpClientRequest();
try
{
req.RequestType = RequestType.Get;
req.Url.Parse(url);
new HttpClient().DispatchAsync(req, (r, e) =>
{
if (e == HTTP_CALLBACK_ERROR.COMPLETED)
{
if (r.Code == 200)
{
var newConfig = r.ContentString;
OnStatusUpdate(eUpdateStatus.ConfigFileReceived);
ArchiveExistingPortalConfigs();
CheckForLocalConfigAndDelete();
WriteConfigToFile(newConfig);
RestartProgram();
}
else
{
Debug.Console(0, Debug.ErrorLogLevel.Error, "Config Update Process Stopped. Failed to get config file from server: {0}", r.Code);
OnStatusUpdate(eUpdateStatus.UpdateFailed);
}
}
else
Debug.Console(0, Debug.ErrorLogLevel.Error, "Request for config from Server Failed: {0}", e);
});
}
catch (Exception e)
{
Debug.Console(1, "Error Getting Config from Server: {0}", e);
}
}
static void OnStatusUpdate(eUpdateStatus status)
{
var handler = ConfigStatusChanged;
if(handler != null)
{
handler(typeof(ConfigUpdater), new ConfigStatusEventArgs(status));
}
}
static void WriteConfigToFile(string configData)
{
var filePath = Global.FilePathPrefix+ "configurationFile-updated.json";
try
{
var config = JObject.Parse(configData).ToObject<EssentialsConfig>();
ConfigWriter.WriteFile(filePath, configData);
OnStatusUpdate(eUpdateStatus.WritingConfigFile);
}
catch (Exception e)
{
Debug.Console(1, "Error parsing new config: {0}", e);
OnStatusUpdate(eUpdateStatus.UpdateFailed);
}
}
/// <summary>
/// Checks for any existing portal config files and archives them
/// </summary>
static void ArchiveExistingPortalConfigs()
{
var filePath = Global.FilePathPrefix + Global.ConfigFileName;
var configFiles = ConfigReader.GetConfigFiles(filePath);
if (configFiles != null)
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Existing config files found. Moving to Archive folder.");
OnStatusUpdate(eUpdateStatus.ArchivingConfigs);
MoveFilesToArchiveFolder(configFiles);
}
else
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "No Existing config files found in '{0}'. Nothing to archive", filePath);
}
}
/// <summary>
/// Checks for presence of archive folder and if found deletes contents.
/// Moves any config files to the archive folder and adds a .bak suffix
/// </summary>
/// <param name="files"></param>
static void MoveFilesToArchiveFolder(FileInfo[] files)
{
string archiveDirectoryPath = Global.FilePathPrefix + "archive";
if (!Directory.Exists(archiveDirectoryPath))
{
// Directory does not exist, create it
Directory.Create(archiveDirectoryPath);
}
else
{
// Directory exists, first clear any contents
var archivedConfigFiles = ConfigReader.GetConfigFiles(archiveDirectoryPath + Global.DirectorySeparator + Global.ConfigFileName + ".bak");
if(archivedConfigFiles != null || archivedConfigFiles.Length > 0)
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "{0} Existing files found in archive folder. Deleting.", archivedConfigFiles.Length);
for (int i = 0; i < archivedConfigFiles.Length; i++ )
{
var file = archivedConfigFiles[i];
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Deleting archived file: '{0}'", file.FullName);
file.Delete();
}
}
}
// Move any files from the program folder to the archive folder
foreach (var file in files)
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Moving config file '{0}' to archive folder", file.FullName);
// Moves the file and appends the .bak extension
var fileDest = archiveDirectoryPath + "/" + file.Name + ".bak";
if(!File.Exists(fileDest))
{
file.MoveTo(fileDest);
}
else
Debug.Console(0, Debug.ErrorLogLevel.Warning, "Cannot move file to archive folder. Existing file already exists with same name: '{0}'", fileDest);
}
}
/// <summary>
/// Checks for LocalConfig folder in file system and deletes if found
/// </summary>
static void CheckForLocalConfigAndDelete()
{
var folderPath = Global.FilePathPrefix + ConfigWriter.LocalConfigFolder;
if (Directory.Exists(folderPath))
{
OnStatusUpdate(eUpdateStatus.DeletingLocalConfig);
Directory.Delete(folderPath);
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Local Config Found in '{0}'. Deleting.", folderPath);
}
}
/// <summary>
/// Connects to the processor via SSH and restarts the program
/// </summary>
static void RestartProgram()
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to Reset Program");
OnStatusUpdate(eUpdateStatus.RestartingProgram);
string response = string.Empty;
CrestronConsole.SendControlSystemCommand(string.Format("progreset -p:{0}", InitialParametersClass.ApplicationNumber), ref response);
Debug.Console(1, "Console Response: {0}", response);
}
}
public enum eUpdateStatus
{
UpdateStarted,
ConfigFileReceived,
ArchivingConfigs,
DeletingLocalConfig,
WritingConfigFile,
RestartingProgram,
UpdateSucceeded,
UpdateFailed
}
public class ConfigStatusEventArgs : EventArgs
{
public eUpdateStatus UpdateStatus { get; private set; }
public ConfigStatusEventArgs(eUpdateStatus status)
{
UpdateStatus = status;
}
}
}

View File

@@ -0,0 +1,163 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
namespace PepperDash.Essentials.Core.Config
{
/// <summary>
/// Responsible for updating config at runtime, and writing the updates out to a local file
/// </summary>
public class ConfigWriter
{
public const string LocalConfigFolder = "LocalConfig";
public const long WriteTimeout = 30000;
public static CTimer WriteTimer;
/// <summary>
/// Updates the config properties of a device
/// </summary>
/// <param name="deviceKey"></param>
/// <param name="properties"></param>
/// <returns></returns>
public static bool UpdateDeviceProperties(string deviceKey, JToken properties)
{
bool success = false;
// Get the current device config
var deviceConfig = ConfigReader.ConfigObject.Devices.FirstOrDefault(d => d.Key.Equals(deviceKey));
if (deviceConfig != null)
{
// Replace the current properties JToken with the new one passed into this method
deviceConfig.Properties = properties;
Debug.Console(1, "Updated properties of device: '{0}'", deviceKey);
success = true;
}
ResetTimer();
return success;
}
public static bool UpdateDeviceConfig(DeviceConfig config)
{
bool success = false;
var deviceConfig = ConfigReader.ConfigObject.Devices.FirstOrDefault(d => d.Key.Equals(config.Key));
if (deviceConfig != null)
{
deviceConfig = config;
Debug.Console(1, "Updated config of device: '{0}'", config.Key);
success = true;
}
ResetTimer();
return success;
}
public static bool UpdateRoomConfig(DeviceConfig config)
{
bool success = false;
var deviceConfig = ConfigReader.ConfigObject.Rooms.FirstOrDefault(d => d.Key.Equals(config.Key));
if (deviceConfig != null)
{
deviceConfig = config;
Debug.Console(1, "Updated config of device: '{0}'", config.Key);
success = true;
}
ResetTimer();
return success;
}
/// <summary>
/// Resets (or starts) the write timer
/// </summary>
static void ResetTimer()
{
if (WriteTimer == null)
WriteTimer = new CTimer(WriteConfigFile, WriteTimeout);
WriteTimer.Reset(WriteTimeout);
Debug.Console(1, "Config File write timer has been reset.");
}
/// <summary>
/// Writes the current config to a file in the LocalConfig subfolder
/// </summary>
/// <returns></returns>
private static void WriteConfigFile(object o)
{
var filePath = Global.FilePathPrefix + LocalConfigFolder + Global.DirectorySeparator + "configurationFile.json";
var configData = JsonConvert.SerializeObject(ConfigReader.ConfigObject);
WriteFile(filePath, configData);
}
/// <summary>
/// Writes
/// </summary>
/// <param name="filepath"></param>
/// <param name="o"></param>
public static void WriteFile(string filePath, string configData)
{
if (WriteTimer != null)
WriteTimer.Stop();
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Writing Configuration to file");
var fileLock = new CCriticalSection();
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to write config file: '{0}'", filePath);
try
{
if (fileLock.TryEnter())
{
using (StreamWriter sw = new StreamWriter(filePath))
{
sw.Write(configData);
sw.Flush();
}
}
else
{
Debug.Console(0, Debug.ErrorLogLevel.Error, "Unable to enter FileLock");
}
}
catch (Exception e)
{
Debug.Console(0, Debug.ErrorLogLevel.Error, "Error: Config write failed: \r{0}", e);
}
finally
{
if (fileLock != null && !fileLock.Disposed)
fileLock.Leave();
}
}
}
}

View File

@@ -0,0 +1,67 @@
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using Crestron.SimplSharp.CrestronIO;
using Newtonsoft.Json;
using PepperDash.Core;
namespace PepperDash.Essentials.Core.Config
{
/// <summary>
/// Loads the ConfigObject from the file
/// </summary>
public class EssentialsConfig : BasicConfig
{
[JsonProperty("system_url")]
public string SystemUrl { get; set; }
[JsonProperty("template_url")]
public string TemplateUrl { get; set; }
//public CotijaConfig Cotija { get; private set; }
[JsonProperty("systemUuid")]
public string SystemUuid
{
get
{
if (string.IsNullOrEmpty(SystemUrl))
return "missing url";
var result = Regex.Match(SystemUrl, @"https?:\/\/.*\/systems\/(.*)\/#.*");
string uuid = result.Groups[1].Value;
return uuid;
}
}
[JsonProperty("templateUuid")]
public string TemplateUuid
{
get
{
if (string.IsNullOrEmpty(TemplateUrl))
return "missing template url";
var result = Regex.Match(TemplateUrl, @"https?:\/\/.*\/templates\/(.*)\/#.*");
string uuid = result.Groups[1].Value;
return uuid;
}
}
[JsonProperty("rooms")]
public List<DeviceConfig> Rooms { get; set; }
}
/// <summary>
///
/// </summary>
public class SystemTemplateConfigs
{
public EssentialsConfig System { get; set; }
public EssentialsConfig Template { get; set; }
}
}

View File

@@ -0,0 +1,96 @@
using System;
using Crestron.SimplSharp;
using Crestron.SimplSharp.Reflection;
using Newtonsoft.Json;
namespace PepperDash.Essentials.Core.Config
{
/// <summary>
/// Represents the info section of a Config file
/// </summary>
public class InfoConfig
{
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("date")]
public DateTime Date { get; set; }
[JsonProperty("type")]
public string Type { get; set; }
[JsonProperty("version")]
public string Version { get; set; }
[JsonProperty("runtimeInfo")]
public RuntimeInfo RuntimeInfo { get; set; }
[JsonProperty("comment")]
public string Comment { get; set; }
[JsonProperty("hostname")]
public string HostName { get; set; }
[JsonProperty("appNumber")]
public uint AppNumber { get; set; }
public InfoConfig()
{
Name = "";
Date = DateTime.Now;
Type = "";
Version = "";
Comment = "";
HostName = CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_HOSTNAME, 0);
AppNumber = InitialParametersClass.ApplicationNumber;
RuntimeInfo = new RuntimeInfo();
}
}
/// <summary>
/// Represents runtime information about the program/processor
/// </summary>
public class RuntimeInfo
{
/// <summary>
/// The name of the running application
/// </summary>
[JsonProperty("appName")]
public string AppName {get; set;}
//{
// get
// {
// return Assembly.GetExecutingAssembly().GetName().Name;
// }
//}
/// <summary>
/// The Assembly version of the running application
/// </summary>
[JsonProperty("assemblyVersion")]
public string AssemblyVersion {get; set;}
//{
// get
// {
// var version = Assembly.GetExecutingAssembly().GetName().Version;
// return string.Format("{0}.{1}.{2}", version.Major, version.Minor, version.Build);
// }
//}
/// <summary>
/// The OS Version of the processor (Firmware Version)
/// </summary>
[JsonProperty("osVersion")]
public string OsVersion {get; set;}
//{
// get
// {
// return Crestron.SimplSharp.CrestronEnvironment.OSVersion.Firmware;
// }
//}
}
}

View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
namespace PepperDash.Essentials.Core.Config
{
public class SourceDevicePropertiesConfigBase
{
public bool DisableSharing { get; set; }
}
}

Some files were not shown because too many files have changed in this diff Show More