Compare commits

..

600 Commits
v1.0.0 ... rm

Author SHA1 Message Date
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
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
Neil Dorin
2121456d50 Adds fake directory to MockVC with full features 2019-03-08 16:56:37 -07:00
Neil Dorin
3a99c3bb30 Adds PrefixDictionaryFolderItems method to add "[+] " prefix to folder names for MC. 2019-03-07 16:31:56 -07:00
Neil Dorin
52ac57c080 fixed vc directory browsing to properly sync between MC and Essentials UIs 2019-03-07 15:20:24 -07:00
Neil Dorin
84ee743ff5 Moved Directory browsing logic from VideoCodecUiDriver down to IHasDirectory Interface to sync better with VideoCodecBaseMessenger for MC 2019-03-06 16:33:00 -07:00
Neil Dorin
24fb74701a Working on moving codec browsing data from UI into codec class 2019-03-05 16:31:13 -07:00
Neil Dorin
1c9aa1eaf6 Moves setting program initialization value out of InitializeSystem() to SystemMonitorController class 2019-03-05 11:33:39 -07:00
Heath Volmer
7c88843f50 Changed one directory message path for mobile control 2019-03-05 10:08:04 -07:00
Heath Volmer
7a3ce5fcf1 Added interface to huddle room to enable volume controls 2019-03-04 11:56:55 -07:00
Neil Dorin
3049e5a041 Merge branch 'feature/ecs-963' into HEAD 2019-02-27 14:27:44 -07:00
Heath Volmer
59234274dc Source-none confirmed; camera selects and FB 2019-02-25 17:51:17 -07:00
Heath Volmer
120dae2e63 Changed SourceNone to Source-None 2019-02-25 12:08:35 -07:00
Heath Volmer
e4317825d3 Create 'none' source 2019-01-30 17:23:57 -07:00
Neil Dorin
bf6971a52d Adds ability to have configuration filenames with prefixes or suffixes. 2019-01-29 17:50:46 -07:00
Heath Volmer
ef0a8dd3b9 Don't know, screw this 2019-01-29 15:09:45 -07:00
Heath Volmer
ca42d744cf Directory browsing largely alive for Weil 2019-01-29 09:33:01 -07:00
Neil Dorin
ffa4de49e9 Changes default folder to user/programX. Will fail back to nvram/programX if found, otherwise if no default folder found, will create user/programX. 2019-01-28 16:18:06 -07:00
Heath Volmer
3c5c157a70 Framework-sub changes 2019-01-28 11:09:43 -07:00
Heath Volmer
8ef58359e7 Added directory browsing things for DDVC01 2019-01-26 15:54:24 -07:00
Heath Volmer
530e1ebcb8 Smash system monitor bug 2019-01-24 11:20:24 -07:00
Heath Volmer
8d03bef34f Added missing join constants in Ddvc01RoomBridge 2019-01-24 09:20:29 -07:00
Heath Volmer
a870418f96 Added Ddvc01VtcMessenger; added to bridge; basic functions and feedbacks 2019-01-22 12:00:50 -07:00
Jason Alborough
37e2dfd11f Merged in JTA and about 1000 other things! (pull request #5)
JTA
2019-01-21 18:20:55 +00:00
Jason T Alborough
6c02423a1c Adds DisplayControllerBRidge 2019-01-21 11:42:47 -05:00
Jason T Alborough
6ea966ec6c Adds the CameraCOntroller to the BridgeFactory 2019-01-21 11:40:48 -05:00
Jason T Alborough
6e9b24576e Fixes issue in the DmChassisControllerBRidge wher ethe Tx input sysnc was not getting properly connected. 2019-01-21 11:34:37 -05:00
Jason T Alborough
ad04235061 Adds CameraContorllerBridge 2019-01-21 10:57:11 -05:00
Jason T Alborough
34f3e543f2 Adds Display Controller base with some basic functioanlity. 2019-01-11 20:22:23 -05:00
Jason T Alborough
e145bfbaee Merge remote-tracking branch 'origin/feature/ecs-994' into JTA 2019-01-10 10:51:38 -05:00
Jason T Alborough
4f726007b8 Adds merged Essentials core 2019-01-10 10:51:18 -05:00
Jason T Alborough
d62b5b7e0c Starts DisplayControllerBridge
Starts DspControllerBridge.
Note these are not yet functional.
2019-01-10 10:49:08 -05:00
Neil Dorin
967d281b62 Includes essentials-framework commit that adds ability for a DM-RMC-4KZ-100-C to be created. 2019-01-08 14:29:53 -07:00
Jason T Alborough
be9fd5e8d1 Adds IsOnline FB to GenericLightingBridge 2019-01-03 17:27:07 -05:00
Jason T Alborough
f25d05edc2 Adds GenericLightingBridge 2019-01-02 12:52:30 -05:00
Neil Dorin
c3d6890a4c Minor updates from testing MC 2018-12-21 16:12:43 -07:00
Neil Dorin
ff6184c241 Adds AudioCodecBaseMessenger and includes updates for Audio Codec on EssentialsHuddleVtc1Room type and for use in Mobile Control 2018-12-20 17:01:34 -07:00
Neil Dorin
034c6913f7 Adds call history messages to VideoCodecBaseMessenger. Removes all call related messages from CotijaEssentialsHuddleSpaceRoomBridge 2018-12-19 16:03:08 -07:00
Joshua Gutenplan
03da699a36 pull essentials updates into vance sub mod 2018-12-18 19:07:44 -08:00
Neil Dorin
3a3f6db692 Updates to fix issues with sending individual program status messages to the app server. Minor updates to AtcDdvc01Messenger based on testing MC with Heath 2018-12-18 17:22:33 -07:00
Neil Dorin
87a449d1ee Silenced AppServer heartbeat console messages. Added isInCall property to Atc status message in AtcDdvc01Messenger SendFullStatus() 2018-12-17 16:28:19 -07:00
Jason T Alborough
1d6a835323 CHanges submodule to merged commit 2018-12-17 11:12:33 -05:00
Jason T Alborough
6bbad2e0f9 Merge remote-tracking branch 'origin/feature/ecs-967' into JTA
# Conflicts:
#	PepperDashEssentials/AppServer/CotijaSystemController.cs
#	PepperDashEssentials/Bridges/BridgeBase.cs
#	PepperDashEssentials/Bridges/IBasicCommunicationBridge.cs
#	PepperDashEssentials/PepperDashEssentials.csproj
#	Release Package/PepperDashEssentials.cpz
#	Release Package/PepperDashEssentials.dll
#	essentials-framework
2018-12-17 11:11:14 -05:00
Neil Dorin
821f2a6d60 Updates from testing System Monitor messaging with AppServer 2018-12-14 16:56:17 -07:00
Neil Dorin
f6136a8c77 Adds SystemMonitroMessenger to bridge between SystemMonitorController and AppServer (untested) 2018-12-12 16:23:17 -07:00
Neil Dorin
676526ed48 Merge remote-tracking branch 'origin/bugfix/mob-470' into feature/ecs-967
# Conflicts:
#	PepperDashEssentials/AppServer/CotijaSystemController.cs
#	PepperDashEssentials/AppServer/RoomBridges/CotijaDdvc01RoomBridge.cs
#	PepperDashEssentials/ControlSystem.cs
#	PepperDashEssentials/OTHER/Fusion/EssentialsHuddleSpaceFusionSystemControllerBase.cs
#	PepperDashEssentials/OTHER/Fusion/EssentialsHuddleVtc1FusionController.cs
#	PepperDashEssentials/Properties/AssemblyInfo.cs
#	PepperDashEssentials/UIDrivers/EssentialsHuddle/EssentialsHuddlePanelAvFunctionsDriver.cs
#	devjson commands.json
2018-12-12 13:34:32 -07:00
Neil Dorin
a8ffe2d09f Adds merged essentials-framework branch 2018-12-12 13:13:34 -07:00
Neil Dorin
541fbbbb2d Testing SytemMonitorBridge 2018-12-12 12:59:00 -07:00
Neil Dorin
3a5686c27a Testing SystemMonitorBridge 2018-12-11 17:58:52 -07:00
Neil Dorin
531e7186f2 Added feedback/action linking to SystemMonitorBridge 2018-12-10 16:33:24 -07:00
Neil Dorin
9bc0269e78 Updates to SystemMonitorBridge 2018-12-07 17:30:51 -07:00
Neil Dorin
0df53facb1 Starting on SystemMonitorBridge 2018-12-06 17:24:55 -07:00
Neil Dorin
2ee77f1bca Adds System Monitor program initialization feedback to startup procedure. Adds bridges for GenericRelayDevice and IDigitalInput device tyeps. 2018-12-06 14:43:38 -07:00
Jason T Alborough
9a56f5bb49 Adds control for DigitalLogger PDU Device
Adds EiscBridge for DigitalLogger PDU Device.
2018-12-03 22:47:49 -05:00
Jason T Alborough
895f49b888 Adds some DigitalLogger funcitonality and begins merge process with new Bridge concepts. 2018-12-03 12:42:17 -05:00
Neil Dorin
e51e1930d9 Minor updates to essentials-framework 2018-11-26 12:37:47 -07:00
Neil Dorin
d245f36cf3 adds framework commit 2018-11-26 11:59:28 -07:00
Heath Volmer
47675f12b4 Added CsmQmtdc2504CnController, incomplete 2018-11-26 09:03:23 -07:00
Neil Dorin
a7c920b780 Added Hdcp actions and feedbacks 2018-10-08 16:55:35 -06:00
Neil Dorin
3a91a895e6 Removed Cue from Feedback 2018-10-08 15:49:21 -06:00
Heath Volmer
397b0b4d9c DDVC01 bridge, repaired device controls 2018-10-08 15:17:02 -06:00
Neil Dorin
b793c04ad3 Merge branch 'bugfix/ecs-895' into feature/ecs-877
# Conflicts:
#	PepperDashEssentials/Properties/AssemblyInfo.cs
#	PepperDashEssentials/Room/Config/EssentialsRoomConfig.cs
#	Release Package/PepperDashEssentials.cpz
#	Release Package/PepperDashEssentials.dll
2018-10-08 13:30:18 -06:00
Neil Dorin
bd31831a9b Fixes issue with TimeoutMinutes property being mispelled in EssentialsRoomConfig. Adds additional debug messages to assist with vacancy timeout testing 2018-10-08 13:18:50 -06:00
Neil Dorin
3d9070dc4f Updates to get Tx Hdcp support working 2018-10-05 17:20:07 -06:00
Neil Dorin
3f82eaeb66 Adds CEC support for all DM TX/RX and input/output cards 2018-10-04 17:00:44 -06:00
Heath Volmer
3cbf784417 Added messaging for code prompt login methods 2018-10-03 18:17:12 -06:00
Neil Dorin
3d6ce7534f Adds Edid and video resolution support for Dm Rmc over EiscApi bridge. Beginnings of Cec control 2018-10-03 17:49:08 -06:00
Heath Volmer
28d694d0b4 Reset of connected simpl program will no longer add duplicate audioCodec and videoCodec devices to output config 2018-10-02 13:02:46 -06:00
Neil Dorin
a320eff13c Updated join map to fix issue with audio/video source selection and feedback 2018-10-01 19:34:53 -06:00
Neil Dorin
f7db0ef36c Working on implementing video and audio source control/feedback for TXs 2018-09-28 17:08:21 -06:00
Heath Volmer
184144dc3c Touchups to ddvc mob codec messages 2018-09-27 17:50:04 -06:00
Neil Dorin
dfd7cb4411 Adds DmTxControllerBridge 2018-09-27 17:27:35 -06:00
Heath Volmer
5014343fa3 DDVC01 - MOB ATC messaging changes 2018-09-27 10:50:23 -06:00
Neil Dorin
f2bfeda074 Tested DmChassisController over EiscApi bridge. So far, no issues found 2018-09-26 16:09:43 -06:00
Neil Dorin
339a4f8a62 Adds DmChassicControllerBridge. Created JoinMapBase base class 2018-09-25 17:19:53 -06:00
Heath Volmer
78668e8abb Added config construction for audio conf in DDVC MOB bridge 2018-09-25 14:36:38 -06:00
Heath Volmer
101d1b5625 Added handler for phone call activity, DDVC bridge 2018-09-24 15:01:02 -06:00
Neil Dorin
780f7bc249 Added joinmap for IBasicCommunication and testet Com, Tcp, Ssh 2018-09-24 10:39:55 -06:00
Neil Dorin
6ec0295aba Progress on comm bridge 2018-09-20 17:13:54 -06:00
Neil Dorin
f4d2ad86f5 fixes ecs-861. Wrong event was being registered on GlsOccupancySensorBase 2018-09-20 15:48:23 -06:00
Neil Dorin
d98b7e837a Commit before switching branches 2018-09-20 14:14:59 -06:00
Heath Volmer
99da6debdc Switched Websocket to synchronous Send method. Seems to prevent data loss 2018-09-19 11:46:52 -06:00
Neil Dorin
c2665f0225 Added first set of interface extension methods for linking devices to EISC sigs 2018-09-18 17:54:45 -06:00
Neil Dorin
0406361d75 Updates from testing UI reconnecting to room after room properties update from Fusion 2018-09-18 17:53:33 -06:00
Neil Dorin
182326b3c5 Updated EssentialsRoomBase and both extented types to use ReconfigurableDevice. Tested Fusion Custom Properties successfully updating room name and help message. 2018-09-14 21:26:25 -06:00
Jason T Alborough
4a69207038 ECS-838 Add method to set lighting integrationID from Bridge. 2018-09-14 16:55:22 -04:00
Jason T Alborough
7b4aad3516 Modifications to EssentialsDsp Bridge
As installed in Wharton HH.8th floor 2018-09-14
2018-09-14 09:12:47 -04:00
Neil Dorin
8dabe732ec Renamed Config in Essentials room type classes to PropertiesConfig and modified EssentialsRoomBase to derive from ReconfigurableDevice 2018-09-13 16:50:08 -06:00
Jason T Alborough
410cf1b4ad ECS-839 Add autoAnswer Support to QscDialer and Bridge
ECS-836 Add DigitalLogger PowerController to Devices with Temp Bridge. This is just stared. Not yet complete
2018-09-12 18:54:33 -04:00
Neil Dorin
fbb4951548 Merged in feature/ecs-829 (pull request #3)
Feature/ecs 829

Approved-by: HeathV <hvolmer@ddsys.co>
2018-09-12 20:11:38 +00:00
Neil Dorin
065075aabd Fixed issue with creating events in edge scenarios when properties change from Fusion 2018-09-12 13:57:15 -06:00
Heath Volmer
ee6293fa75 Added MessengerBase class to app server stuff 2018-09-12 13:53:35 -06:00
Neil Dorin
7112c50f5a Adds Fusion Custom Properties support and bridge to pass values from custom properties to devices 2018-09-11 19:36:10 -06:00
Heath Volmer
873fd81b5c Added debug command to log marker in log 2018-09-11 10:04:41 -06:00
Heath Volmer
a2a3f4caed Clean up extra verbose logging after solidifying reconnection 2018-09-11 08:13:14 -06:00
Heath Volmer
1df658b7eb Added close handlers to catch legit shutdowns from servers 2018-09-10 20:23:57 -06:00
Heath Volmer
1c9061cc28 Strengthened reconnect behavior with both app server and IIS outages 2018-09-10 13:49:56 -06:00
Heath Volmer
a0a83a1af7 Removed HTTP join procedure; rehashed reconnects 2018-09-10 13:00:03 -06:00
Heath Volmer
f17b62844d Attempting to prevent deadlock/multiple connection attempts on reconnect 2018-09-10 07:48:14 -06:00
Heath Volmer
5f8170fb66 Commit of framework 2018-09-07 18:15:39 -06:00
Heath Volmer
42086f650d Weil-related changes; app server, many websocket and http client related changes to imrpove connection resilience; Added newer pd.core 1.0.9 2018-09-07 18:09:59 -06:00
Neil Dorin
6a8ae5b244 Fixes bug that caused exceptions in Fusion GetProcessorEthernetValues() when ethernet link status came up. Adds logic for Fusion custom properties. 2018-09-07 16:01:23 -06:00
Neil Dorin
30506419df Moved config reader/writer classes to essentials core. refactored as a result 2018-09-07 15:58:03 -06:00
Jason T Alborough
a84084b273 Adds Online to EssentialsDsp 2018-09-06 20:08:00 -04:00
Heath Volmer
5ed8ff6dac Fixed scope issue joining sources to EISC 2018-09-04 15:39:58 -06:00
Heath Volmer
b295f931a3 ? 2018-09-04 14:31:29 -06:00
Neil Dorin
0487099ee4 Added logic to read local config if found, instead of Portal config by default 2018-09-04 14:28:16 -06:00
Jason T Alborough
bff8529c9f Changes to QscDialer 2018-09-03 15:33:13 -04:00
Neil Dorin
c3bea683fc Added ConfigWriter class. Updated AV Funciton Driver UI classes to show shutdown prompt when room about to shut down for vacancy. 2018-08-31 18:06:43 -06:00
Jason T Alborough
f819d0d743 QscAtc Work form live test at Wharton HH.830. Needs more vetting. 2018-08-29 17:32:23 -04:00
Neil Dorin
6afe1729bf Updated UI drivers to make sure modal shutdown warning is shown when vacancy shutdown is triggered 2018-08-29 11:56:41 -06:00
Neil Dorin
d563a6224b sub module updates 2018-08-28 17:03:38 -06:00
Neil Dorin
7ba2429cbf Updates from bench testing RoomOnToDefaultSourceWhenOccupied. Now tested and working using config file values. 2018-08-28 17:03:07 -06:00
Jason T Alborough
1534433949 Ecs-823 Implement Essentials Light Bridge
WHAR-1441 Add Lutron Temp Bridge
WHAR-1401 Finish testing Lighting Controls
2018-08-27 17:24:53 -04:00
Jason T Alborough
daf44ae797 Started the EssentialsLightBridge class 2018-08-25 07:28:40 -04:00
Neil Dorin
bd31d76e8b New Room on to default source feature working using scheduled events and built in scheduler based on config values 2018-08-24 18:08:25 -06:00
Jason T Alborough
759635b364 WHAR-1436 - Add Vol control up/down buttons on the user page 2018-08-24 14:12:53 -04:00
Neil Dorin
c0c90f926e Updates to add necessary functionality for occupancy sensors to trigger room to power on to default source during specific hours on certain days. 2018-08-21 18:23:31 -06:00
Jason T Alborough
96e60f6eaf Adds Hdcp Support for Tx30X and Tx201 2018-08-15 18:38:21 -04:00
Jason T Alborough
a13428fb4e Commented out a read-only property. Merge Issue mabey 2018-08-14 09:45:41 -04:00
Jason T Alborough
818d6c9ca5 Adds HdcpSupport for Tx to EssentialsDM Bridge 2018-08-14 09:44:50 -04:00
Jason T Alborough
a6df8f908b Merge branch 'development' into JTAChanges
# Conflicts:
#	essentials-framework
2018-08-13 14:51:55 -04:00
Jason T Alborough
0d5c93bbde WHAR-1397 Removes extraneous debug traces 2018-08-13 13:51:23 -04:00
Jason T Alborough
40dcca0e8d Minor changes for HDCP support. Not yet complete. 2018-08-10 18:56:09 -04:00
Jason T Alborough
ef443bdfb0 Created a device for TVOneCorio with online status and preset recall/FB
Created a temp bridge for EiscApi
2018-08-10 12:29:15 -04:00
Heath Volmer
c839cea495 Added JSON property converter to sourceListItem type; commands to start room from call button 2018-08-09 16:46:05 -06:00
Heath Volmer
768bbf9298 Initial implmentation of directory search 2018-08-08 17:35:21 -06:00
Heath Volmer
999982f789 Restructured directory message 2018-08-08 11:19:39 -06:00
Heath Volmer
ad48b1ebac Added starter method for directory root:good; adding json props and converters to directory classes 2018-08-08 10:34:40 -06:00
Heath Volmer
e196ff1627 Adding VTC device messaging; full status; isReady check 2018-08-06 17:19:45 -06:00
Jason T Alborough
a900a08095 Merge branch 'Feature/QSC' of https://bitbucket.org/Pepperdash_Products/essentials into Feature/QSC 2018-08-06 11:29:06 -04:00
Jason T Alborough
fa94b83d63 Changes from Staging HH.8 2018-08-06 11:28:00 -04:00
Heath Volmer
d70d8b58dd Added new Messenger for video codec 2018-08-03 16:42:36 -06:00
Heath Volmer
1b942918d7 Moved cotija classes into appserver folder; adding VideoCodecBaseMessenger class 2018-08-03 15:50:20 -06:00
Heath Volmer
ccfcd95508 Added codec dial and end commands 2018-08-03 14:17:45 -06:00
Alex Johnson
5f119690c2 Commit for essentials-framework submodule update 2018-08-03 10:23:52 -04:00
Heath Volmer
3778314d51 Added messages for share state to essentials MC bridge 2018-08-02 17:06:10 -06:00
Heath Volmer
163f6e6941 Various cleanup; added messaging for codec status events; added initial state of codec to fullstatus message 2018-08-01 16:59:09 -06:00
Heath Volmer
7e8cdd738f Fixed where system won't register if no uuid in config (from manual config) 2018-08-01 15:30:10 -06:00
Heath Volmer
1371c728c5 Merge and a whole bunch of work before committing merge, moron 2018-08-01 14:23:58 -06:00
Heath Volmer
d1d8e29be2 Preparing essentials message changes, noticed that 754 has not been merged 2018-08-01 11:38:39 -06:00
Alex Johnson
43071a4d91 Recommit 2018-07-31 17:20:03 -04:00
Alex Johnson
4d4d50bc92 Update to framework submodule for Tx and Rx dictionary creation 2018-07-31 17:17:14 -04:00
Heath Volmer
9eb9485bba Recommit after merging framework sub 2018-07-27 07:36:09 -06:00
Heath Volmer
c447875baf post conflict resolution 2018-07-25 11:01:10 -06:00
Neil Dorin
f1feaaae90 Merged in bugfix/ecs-756 (pull request #1)
Bugfix/ecs 756
2018-07-25 16:54:14 +00:00
Neil Dorin
b989b07d78 Updates as per Heath to volumes object in SendFullStatus(). Fixed issue with populating SourceDeviceMapDictionary in constructor. 2018-07-24 15:11:48 -06:00
Heath Volmer
3841a9bad1 Added power-on semaphore to Sammy display to prevent power on glitches 2018-07-20 15:44:59 -06:00
Neil Dorin
9ad2fef94a Updates as per request from Heath 2018-07-19 17:04:23 -06:00
Neil Dorin
f09ccda33c sub-module updates 2018-07-19 11:16:27 -06:00
Neil Dorin
4e45103080 resolves ecs-797/770/755 Updates Interface extension classes and SourceDeviceMapDictionary to us consistent names 2018-07-19 11:16:09 -06:00
Neil Dorin
c2e82e9cb9 Commit framework changes 2018-07-18 15:04:57 -06:00
Neil Dorin
b16d61f64c Updatest to CotjaDdvc01RoomBridge to enable source control joins on EISC (need to update API words in dictionary to match existing interface extensions) 2018-07-18 15:04:39 -06:00
Jason T Alborough
2e566b41a0 Removed release cpz for script compatibility. 2018-07-18 16:07:45 -04:00
Jason T Alborough
be5b23e9d1 Qsc and EssentialsDspBridge with Functional vol, mute, and preset control...still needs more work though 2018-07-18 12:13:35 -04:00
Neil Dorin
385686e7e0 Added Bridge classes back in from on prem repo 2018-07-17 11:32:38 -06:00
Jason T Alborough
448b408f94 Merges Essentials bridges proof of concept work into new BB.org repo 2018-07-17 08:05:02 -04:00
Jason T Alborough
e1422d8653 Changes essentials-framework branch to essentialsBridges 2018-07-17 07:12:49 -04:00
Jason T Alborough
b353b93458 Adds essentials-framework commit 2018-07-16 19:50:34 -04:00
Jason T Alborough
55f9dc4c1f .gitmodules removed @ in URL
.gitmodules removed @ in URL
2018-07-16 19:49:45 -04:00
Neil Dorin
e7adaabb87 Fixed .gitmodules to use URL withouth hvolmer prefix 2018-07-16 15:06:43 -06:00
Neil Dorin
0f25d9ed4b include updates to essentials-framework 2018-07-12 16:56:12 -06:00
Neil Dorin
5cefba4934 Brings in changes from On Prem BB repo. Resolves ecs-756/757/758/759 2018-07-12 16:55:49 -06:00
Heath Volmer
0e9d1e4c35 cleaned out framework files; added framework submodule; referneced p.core to reference in framework; moved essentials.sln; changed paths in sln to match; test build 2018-06-28 13:59:14 -06:00
Neil Dorin
058ea730ed Recompiled after merge and test. 2018-06-27 14:37:42 -06:00
Neil Dorin
9945f36c90 Merge remote-tracking branch 'origin/development' into HEAD
Conflicts:
	Release Package/PepperDashEssentials.cpz
	Release Package/PepperDashEssentials.dll
2018-06-27 14:28:52 -06:00
Neil Dorin
8490f2d722 Updates to Feedback logic for use in bridge classes, refactored into separate files. Added SerialFeedback class for use with serial stream data that doesn't use Funcs to compute value on update. 2018-06-27 14:27:05 -06:00
Heath Volmer
ca9da1ef79 Merge pull request #7 in PEC/essentials from feature/ecs-747 to development
* commit 'e0bfb8f0915de0597a05bc658bf9b9a235566b38':
  Fixed issue preventing lighting scene feedback from updating correctly.
  Bug fix for LutronQuantumArea class that caused crash when debug level was set to 2 and data was received from device.  Updates EssentialsEnvironmentDriver to only include environment devices in UI container columns if a matching UI driver can be constructed (ignores DIN8SW8)
2018-06-26 14:51:18 -04:00
Neil Dorin
e0bfb8f091 Fixed issue preventing lighting scene feedback from updating correctly. 2018-06-26 11:53:18 -06:00
Neil Dorin
97db1f35a1 Bug fix for LutronQuantumArea class that caused crash when debug level was set to 2 and data was received from device. Updates EssentialsEnvironmentDriver to only include environment devices in UI container columns if a matching UI driver can be constructed (ignores DIN8SW8) 2018-06-26 10:41:43 -06:00
Heath Volmer
f5b589bc2e FeedbackEventArgs; various test things; few handler changes 2018-06-25 11:28:56 -06:00
Heath Volmer
2b6a13271f Renabled GoWithLoad, lost in merge 2018-06-15 15:34:52 -06:00
Heath Volmer
4686799371 Compiled, for review 2018-06-15 14:30:34 -06:00
Heath Volmer
cb750a2fd0 Merge branch 'development' of http://code.pepperdash.net/scm/pec/essentials into development 2018-06-15 14:11:17 -06:00
Heath Volmer
6d81e8d21e Merge branch 'feature/ecs-684' into development 2018-06-15 14:05:00 -06:00
Heath Volmer
600b9f11ff Merge pull request #6 in PEC/essentials from feature/ecs-711 to development
* commit 'c20036cfe95f0940d378dfa6db402cd61a48b54e':
  Updates to add IncludeInFusionRoomHealth config property for UI devices to allow them to be excluded from the Fusion error rollup.  Implement ICommunicationMonitor on EssentialsTouchpanelControler class. Updated Fusion class to better handle mapping digital online joins to ICommunicationMonitor classes.
2018-06-15 15:42:47 -04:00
Neil Dorin
c20036cfe9 Updates to add IncludeInFusionRoomHealth config property for UI devices to allow them to be excluded from the Fusion error rollup. Implement ICommunicationMonitor on EssentialsTouchpanelControler class. Updated Fusion class to better handle mapping digital online joins to ICommunicationMonitor classes. 2018-06-07 16:00:53 -06:00
Heath Volmer
005b3f0843 v 1.1.8; mob-303, fixed swapped template and system uuid fields in server delivered config 2018-06-06 11:09:58 -06:00
Neil Dorin
fbe5df84be Updated to allow for middle shade button to have label driven from config. 2018-06-05 16:47:07 -06:00
Heath Volmer
8e4c84dd02 Ignore tie lines if none present in config 2018-06-01 11:48:27 -06:00
Heath Volmer
dace2a57c2 1.1.7. Changed app server device types to match config tool: appServer, mobileControlBridge-ddvc01 2018-06-01 09:29:06 -06:00
Neil Dorin
3cf188f820 Completed Environment UI effort. Tested with EssentialsHuddleRoom type 2018-05-24 09:44:13 -06:00
Neil Dorin
80377a41d0 Environment Driver now showing and correct background subpage is appearing 2018-05-22 23:15:08 -06:00
Neil Dorin
a0ebc08838 Corrected issue in ShowSetupButtons method. Environment icon is displaying correctly when config defined. 2018-05-21 22:13:07 -06:00
Neil Dorin
0de4fbb69c Strange issue in HeaderDriver.SetupHeaderButtons with avDriver being null. Need to investigate further 2018-05-17 14:42:57 -06:00
Neil Dorin
c88b259c71 Significant refactoring of DeviceFactory for touchpanel device building. Moved SetupHeaderButtons() out of AV driver classes and into new EssentialsHeaderDriver class. 2018-05-17 12:33:20 -06:00
Heath Volmer
20660c561a v 1.1.6 2018-05-14 12:36:56 -06:00
Neil Dorin
b44613b91f Refactored method names for better consistency. Built out Din8sw8 and Din8sw8Output classes. Added logic for RelayControlledShade class to operate relays based on open/close/stop method calls 2018-05-03 10:23:30 -06:00
Heath Volmer
58de8ce8ad Will now identify in console when auth fails due to UUID or code 2018-05-01 21:06:59 -06:00
Neil Dorin
33f0a1fe32 More progress on relay based shade control 2018-05-01 16:45:18 -06:00
Heath Volmer
4b0f8abd9f 1.1.6 Added TryEnter to VTC room routing to prevent multiple source routes from accidentally running simultaneously (NYU bug); Restructuring MOBILEHTTPREQUEST to do post and get 2018-05-01 10:27:16 -06:00
Heath Volmer
4defea55f0 1.1.4, added clientAppUrl property to config, passed through to DDVC01 EISC 2018-04-27 14:44:54 -06:00
Neil Dorin
9c8f85555e Adds initial Shade interfaces and Shade Base Class 2018-04-27 10:28:41 -06:00
Heath Volmer
62e2c3d19f 1.1.1 Added MOBILEHTTPDEBUG command to help track failed http requests 2018-04-26 12:29:15 -06:00
Heath Volmer
e1c8b54434 1.1.0 Added verbose logging to http failure on MC initial connect 2018-04-26 09:46:15 -06:00
Neil Dorin
6d913e8a72 Updates to LutronQuantum.cs 2018-04-05 17:08:42 -06:00
Neil Dorin
afa1cff0e0 v1.0.48 - Updates all code that uses file paths to work on windows or linux platforms. Updates to add compatability for running on XiO Edge platform. 2018-03-29 10:36:22 -06:00
Neil Dorin
ce6cecbb79 Refactored how configuration, IR and SGD file path prefixes are handled, in order to be able to handle a different file structure if running on XiO Edge 2018-03-27 16:39:23 -06:00
Heath Volmer
69314bb1f1 Changed websocket sendAysnc to send in order to allow rapid messages to go out. Not sure if this is a valid fix, but it works 2018-03-22 16:45:14 -06:00
Neil Dorin
fb19b5894b Added lighting interfaces and base class 2018-03-22 16:07:18 -06:00
Neil Dorin
82fad55c1e Removed all HTTP Post logic from CotijaSystemController and switched to websockets for sending data to server 2018-03-21 12:59:41 -06:00
Heath Volmer
8d03e81431 Not sure of modification 2018-03-21 10:18:05 -06:00
Heath Volmer
fa8ea4cef6 Added mobileinfo command to help with mobile control debugging 2018-03-16 14:46:52 -06:00
Heath Volmer
97a44ffa4f 1.0.46 2018-03-13 18:34:05 -06:00
Heath Volmer
ee55be86e0 Fixed startup crash when device has out-of-range com port 2018-03-13 18:33:16 -06:00
Heath Volmer
ced1efdb47 Remove 'v' from assemblyVersion info object
, cotija
2018-03-12 16:21:41 -06:00
Neil Dorin
5129b19748 Adds RuntimeInfo class to InfoConfig and populates values when CotijaController class calls RegisterSystemToServer() 2018-03-12 15:19:31 -06:00
Heath Volmer
525881ebe1 Bugfixes: HDMD4k4x1 code around toggle-switching; add source list evaluation when pressing share 2018-03-09 15:40:02 -07:00
Heath Volmer
856a81ded4 Hotfix for TD - Null ref in incoming call. Thought this was fixed. 2018-03-09 09:10:25 -07:00
Heath Volmer
ef8298ccd6 Added Event locking to system registration to help prevent multiple registrations when network lost or dns changed. 2018-03-08 13:55:21 -07:00
Heath Volmer
cdbab152f6 System - server reconnecting ! 2018-03-07 14:09:37 -07:00
Heath Volmer
359bd508e5 Attached Parse method to websocket receive 2018-03-07 12:44:58 -07:00
Heath Volmer
62e5e6f176 Getting websocket -> cotija going 2018-03-07 12:33:10 -07:00
Heath Volmer
2d375ed2d7 Fixed null ref when in call changed and system is off 2018-03-05 09:55:27 -07:00
Heath Volmer
2e78191e33 Messages in SSE receive to help debug missing data - no progress yet 2018-03-02 13:32:48 -07:00
Heath Volmer
45ac17622a cotija fixes 2018-02-21 13:56:06 -07:00
Heath Volmer
e7e6ae98cf Added server URL and mobile user code 2018-02-16 14:20:02 -07:00
Heath Volmer
2fbd645bf0 Re-enabled cotija for huddle room: 2018-02-14 08:52:47 -07:00
Heath Volmer
2a4ed67bee DDVC bridge 2018-02-13 17:42:28 -07:00
Heath Volmer
17c448e309 Pulling in 670 branch changes 2018-02-08 12:35:08 -07:00
Heath Volmer
5afa626fb3 Removed thread/timer from touchpanel creation. Hopefully will fix disappearing panels 2018-02-07 16:29:06 -07:00
Heath Volmer
ba1e8646e5 HDCP disables from config on HDMD4x1. Appears to be working 2018-02-07 16:17:41 -07:00
Heath Volmer
88e82fb398 HDCP Disable in from config 2018-02-07 13:55:56 -07:00
Heath Volmer
53ee87c9be Initial successful tests of non-sharable source derouting and redraw of source list when in/out of call 2018-02-07 09:59:12 -07:00
Heath Volmer
032bb2b8e5 Added in source list filtering based on in-call and current mode of UI driver (call or present) 2018-02-06 17:03:11 -07:00
Heath Volmer
6ee56dd66c Loaded new PD.Core with proper cresnet and ipidTcp comm enums; Loaded spark room with HDMI4x1. Testing forthcoming: 2018-02-06 13:23:40 -07:00
Heath Volmer
d887b448c9 Added Crestron HDMD4x14kE switcher. Awaiting testing 2018-02-06 09:48:29 -07:00
Heath Volmer
f099c88352 Added framework classes for 4x1 2018-02-05 14:40:25 -07:00
Heath Volmer
f98a429b55 Building config from DDVC but no values are present... 2018-02-02 15:53:26 -07:00
Heath Volmer
645816c75f Trying to force config values to load in lieu of proper signalling from Simpl code 2018-02-02 15:34:37 -07:00
Heath Volmer
491fff2793 Rearranged how cotija bridge are brought up in relation to parent; adding ddvd01 bridge 2018-02-02 13:37:48 -07:00
Heath Volmer
952e7f4083 Trying to make bridge base happy with DDVC01 2018-02-01 15:41:36 -07:00
Heath Volmer
56c418580c Have multi-volume with recall ready for test. Pausing dependent on conversation with NYU 2018-01-31 12:36:57 -07:00
Heath Volmer
4134622b28 Added volume control switching to VTC1 class. Added volume zero/restore code to VTC1 and base classes. Related config 2018-01-31 10:58:43 -07:00
Heath Volmer
09b3f7c5e7 Preparing DDVCO1 cotija bridge to send configuration - incomplete 2018-01-30 09:19:51 -07:00
Heath Volmer
9fa2b22448 Adding ddvc01 properties from EISC into config objects 2018-01-29 19:22:08 -07:00
Heath Volmer
62d8190eef Restored missing release package cpz 2018-01-26 09:55:05 -07:00
Heath Volmer
19284b171a Post-merge 344, compile and warning cleanup 2018-01-26 09:46:53 -07:00
Neil Dorin
29c60548cc v1.0.34.* Updated Device Factory to consume portal generated config format 2018-01-23 16:12:38 -07:00
Heath Volmer
17f147b5e0 Added cresnet to comm config 2018-01-23 13:21:50 -07:00
Heath Volmer
7aa3d50cd6 Merge of ecs-342-neil, v.33 2018-01-23 10:14:35 -07:00
Neil Dorin
b85abe1b79 v1.0.33.* -Fixed issues with versiport configuration for pull up resistor based on feedback from Alex onsite. Corrected issue with RoomIsOccupiedFeedback_OutputChange method in EssentialsRoomBase. Updated Fusion Remote Occ sensor logic. 2018-01-22 16:37:27 -07:00
Heath Volmer
b7bab6cfd1 Added Activate cycle try/catch for individual devices; added test abilities to feedbacks 2018-01-22 14:53:09 -07:00
Neil Dorin
b83b3737e9 Committing missed file 2018-01-22 14:25:58 -07:00
Neil Dorin
42c4c705c9 Added ability to disable pull up resistor on versiports from config. 2018-01-22 14:25:37 -07:00
Heath Volmer
cb41b31018 Wrap up Friday - null ref in RoomBase on Occ sensor event 2018-01-22 11:31:23 -07:00
Heath Volmer
6f028c06ae Debugging on privacy buttons 2018-01-19 15:44:14 -07:00
Heath Volmer
bc25c31860 Added versiport creation to factory; rearrange success/failure cases to be more descriptive and easier to follow in code 2018-01-18 15:52:51 -07:00
Heath Volmer
32b548eba0 Room off timing on spark room; debug on load failures; testing on occ sensor and mics 2018-01-18 14:35:39 -07:00
Heath Volmer
f83e64ee7e Merge ecs-665 2018-01-18 11:09:40 -07:00
Neil Dorin
2ee365447c Added occupacy debug console messages and linked crestron sensor event to generic interface event 2018-01-18 06:51:27 -07:00
Heath Volmer
e5ac725b85 Compile for release v -> 1.0.18 2018-01-17 15:24:10 -07:00
Heath Volmer
d0cbb8d096 Join changes on DDVC 2018-01-17 15:21:42 -07:00
Heath Volmer
91f6235441 Merge pull request #4 in PEC/essentials from feature/ecs-665 to development
* commit '3c256564c6b333dc232c1fb67040d2bbc39471ac':
  Added code to Device Factory to build Cresnet Occupancy Sensors from config.
2018-01-17 17:19:19 -05:00
Neil Dorin
3c256564c6 Added code to Device Factory to build Cresnet Occupancy Sensors from config. 2018-01-17 14:54:35 -07:00
Heath Volmer
53de4f32eb Merge of mob-136 2018-01-17 11:57:34 -07:00
Heath Volmer
9effa78fdf Tested basic messaging with Simpl code; worked out join ranges for most messages; adding config data 2018-01-15 15:53:32 -07:00
Heath Volmer
ba5036e400 Fixed SetStringSigAction stack overflow ;-); Added DDVC room bridge class with basic actions attached and messages prepared 2018-01-15 11:35:04 -07:00
Heath Volmer
cd747a01ea v1.0.17 - initial setup of file system 2018-01-09 16:00:49 -07:00
Heath Volmer
ac4ef972fe Added initial filesystem set up that puts all folders in place on initial run 2018-01-09 15:58:38 -07:00
Heath Volmer
857d10f0b2 Added shutdown-related api to CotijaRoomController 2018-01-04 17:28:38 -07:00
Heath Volmer
b45fb57cb2 1.0.15; Huddle space end meeting display power fixes 2018-01-04 11:12:34 -07:00
Heath Volmer
e1e2627f56 added further delay to end meeting steps to allow for default source restoration and power off 2018-01-04 11:00:09 -07:00
Heath Volmer
d1646f8216 1.0.14 Removed extra volume set from cooldown; removed room-on/source-on check from RunDefaultRoute in HuddleRoom 2018-01-04 10:47:50 -07:00
Heath Volmer
02cfc46f90 Added Async fire to Feedbacks; fixed mock display to use async feedback 2018-01-03 16:19:06 -07:00
Heath Volmer
0fb946c7d5 Added CEvent semaphore to PostToServer to sequence posts 2018-01-02 19:58:39 -07:00
Heath Volmer
026ab438ad Fixed unknown_error http post problems with retry on new client; working on mutex around post to handle simultaneous posts 2018-01-02 18:16:41 -07:00
Heath Volmer
51afb966d5 Re-added api for volume and mute 2018-01-01 05:00:33 -07:00
Heath Volmer
68fb82f801 Manual add IHasCodecLayouts 2017-12-29 10:35:02 -07:00
Heath Volmer
0830fb8943 Finishing troublesome merge from development 2017-12-29 10:25:51 -07:00
Heath Volmer
2ed63e7c84 Manual copy of cisco codec from developmet 2017-12-29 10:23:44 -07:00
Heath Volmer
08a4497f2c Moved VCDriver manually from development 2017-12-29 10:16:30 -07:00
Heath Volmer
85d79c5265 Merge, compile for release 2017-12-22 12:45:37 -07:00
Heath Volmer
fe76b257b2 v -> v1.0.10; fixes on remote view button 2017-12-22 12:13:32 -07:00
Heath Volmer
800de511ce Merge remote-tracking branch 'origin/feature/ecs-663' into feature/mob-108 2017-12-22 10:07:11 -07:00
Neil Dorin
82784f00a4 Coded changes as per email 2017-12-21 15:35:17 -07:00
Heath Volmer
289a33451f Relay warming, cooling and shutdown messages 2017-12-13 14:36:13 -07:00
Heath Volmer
ae496f556b Changed incoming messages for a few features. Added default source select 2017-12-12 11:11:33 -07:00
Heath Volmer
762f13c708 Build after merge 2017-12-07 15:47:44 -07:00
Heath Volmer
a61bfc4173 Cisco codec layout and min/max buttons for single display. v1.0.7 2017-12-07 15:45:54 -07:00
Heath Volmer
c3d455a7c2 Heartbeat problem resolved; much logging 2017-12-05 16:53:20 -07:00
Heath Volmer
864e65fe92 SO join; closing for weekend 2017-11-22 14:41:02 -07:00
Heath Volmer
385dd8a482 Meeting popup fixes; calendar list event and update fixes 2017-11-22 14:01:01 -07:00
Heath Volmer
19860be486 ecs-649, exceptions on boot with call connected 2017-11-20 16:07:45 -07:00
Neil Dorin
4d6a680f23 ecs-646 Daily Fusion server time query. 2017-11-15 15:59:35 -07:00
Neil Dorin
f9cb4e8a34 Added default source and volume levels recall to EndShutdown() methods in huddle and huddleVtc1 room types. Added mute control and feedback to Avocor display driver (using volume level discrete commands, no mute available in API). 2017-11-15 15:20:25 -07:00
Neil Dorin
07e77f2ce4 EOD Commit. Updates to Avocor display class. Fixes to Tech Page Driver to add feedback for display power status 2017-11-10 15:10:23 -07:00
Neil Dorin
6dbc152810 Adds Avocor Display driver class 2017-11-09 16:13:03 -07:00
Neil Dorin
a3580ca15c Fixes ecs-638 (Default Volume recall in huddle room) 2017-11-08 20:02:55 -07:00
Neil Dorin
7a1ead7b56 Fixed bug with InputStateFeedback event handler in MicrophonePrivacyController. Tested OK with Digital Inputs on RMC3 triggering privacy toggle 2017-11-08 10:33:30 -07:00
Neil Dorin
f9d1a737c4 Added behaviour options for MicrophonePrivacyController to track either room power state or room call state from config 2017-11-06 15:20:50 -07:00
Neil Dorin
d9013157ad MIcrophone Privacy feature tested and working as far as relay switching. Needs someone to short the digital inputs on the office RMC and load to PRO3 or other versiport compatible processor to test mic button contact closure input. 2017-11-03 17:13:44 -06:00
Neil Dorin
43f0ae0533 Merge branch 'bugfix/ecs-629' into feature/ecs-497
Conflicts:
	Essentials Devices Common/Essentials Devices Common/Display/SamsungMDCDisplay.cs
	Essentials Devices Common/Essentials Devices Common/Essentials Devices Common.csproj
	Release Package/PepperDashEssentials.cpz
	Release Package/PepperDashEssentials.dll
2017-11-03 13:04:11 -06:00
Neil Dorin
6d66c7d896 Updated SamsungMDC driver to default to 0x21/0x23 for Hdmi1 and Hdmi2 commands and added Hdmi1PC and Hdmi2PC (0x22/0x24) as new input options.
Remapped DisplayPort command on tech driver display control SRL to match UI buttons
2017-11-03 11:45:50 -06:00
Neil Dorin
f327ab1590 Temp commit to capture progress on MicrophonePrivacy before switching branches to help debug Samsung MDC driver 2017-11-03 09:50:44 -06:00
Neil Dorin
47fc2f3371 Updates to how the EssentialsVideoCodecUIDriver retrieves the codec phone number/SIP URI from the CodecInfo object. It now attempts to get the values from the SIP registration, if present. If not, it pulls them from the H323 configuration (E.164 alias and H323 ID). 2017-11-02 11:20:14 -06:00
Neil Dorin
d1197329f3 Temp commit to save progress before switching branches to debug NYU items. 2017-11-02 10:54:15 -06:00
Neil Dorin
a0817307b1 Moved MicrophonePrivacyController to Devices Common. Fixed references 2017-11-01 14:20:13 -06:00
Neil Dorin
43c3b83637 Updated warmup timer for SamsungMDC back to 10s 2017-11-01 10:30:42 -06:00
Neil Dorin
2a485e36c8 updatest to deal with ecs.629 by adding delay in SamsungMDC to commands sent after volume 2017-11-01 09:50:05 -06:00
Neil Dorin
bc47c65e48 MicrophonePrivacyController progress 2017-10-31 13:17:00 -06:00
Heath Volmer
1ad5bc68e5 Merge pull request #2 in PEC/essentials from feature/ecs-497 to development
* commit '8a9a8ac6a77201784c96996a5de1149ac589cb5f':
  Updated AssemblyVersion to 1.0.2.*
  Prep for merge into development for NYU deployment
  Updated PhoneNumber property name to SipPhoneNumber
  General code cleanup and updates to Huddle UI drivers to comply with Vtc1 changes
2017-10-31 14:02:36 -04:00
Neil Dorin
8a9a8ac6a7 Updated AssemblyVersion to 1.0.2.* 2017-10-31 12:01:24 -06:00
Neil Dorin
b1742675c2 Prep for merge into development for NYU deployment 2017-10-31 11:57:01 -06:00
Neil Dorin
f564a2f554 Updated PhoneNumber property name to SipPhoneNumber 2017-10-30 11:57:13 -06:00
Neil Dorin
0ede2e9973 General code cleanup and updates to Huddle UI drivers to comply with Vtc1 changes 2017-10-30 11:50:22 -06:00
Neil Dorin
5f5c963fa4 Fixes StartSharing() method in CiscoSparkCodec to only execute if the PresentationSource is > 0
Fixes ecs-612 by adding property to UsageTracking object to determing if the usage tracker is already running.
2017-10-24 15:45:05 -06:00
Neil Dorin
3d7fb1a804 resolves ecs-611 and all other known bugs from onsite testing at NYU 2017-10-24 14:55:15 -06:00
Neil Dorin
dc36386c0d Update debug messages for SIP phone number extraction 2017-10-24 13:00:46 -06:00
Neil Dorin
88a60b06e6 Added objects back to xStatus lost in merge and fixed regex pattern for extracting phone number.
Added formatting call to room phone number when displayed on header
2017-10-24 12:35:29 -06:00
Neil Dorin
7273646be0 Merge remote-tracking branch 'origin/bugfix/ecs-610' into bugfix/ecs-541-1
Conflicts:
	Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/xConfiguration.cs
	Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/xStatus.cs
2017-10-24 11:59:29 -06:00
Heath Volmer
61883e5d4a Additional fix to top next meeting warning popups when room is on 2017-10-24 11:57:20 -06:00
Neil Dorin
90c12a97fa Updated getters for SIP URI and phone number to use correct status properties. Updates to xConfiguration and xStatus classes to address differences between Spark and Spark Plus 2017-10-24 11:56:28 -06:00
Neil Dorin
17fd9488f2 Fixed Stop Sharing button method to use the room route action method to sync source fb. Updated xStatus, xConfiguration, booking and phonebook deserialization classes in codec to match onsite return results from NYU room kit plus codec 2017-10-24 10:16:28 -06:00
Neil Dorin
84262c782d Merge remote-tracking branch 'origin/release' into bugfix/ecs-541-1
Conflicts:
	Essentials/PepperDashEssentials/UIDrivers/EssentialsHuddleVTC/EssentialsHuddleVtc1PanelAvFunctionsDriver.cs

Fixed Presentation source selection on Spark codec to use original Source 1/2 values rather than connectorId
2017-10-23 15:53:46 -06:00
Neil Dorin
8dbb3fd898 Resolved ecs-582,602,608 2017-10-23 15:34:28 -06:00
Heath Volmer
01d462d553 Release 1.0.1 for NYU deploy 2017-10-23 07:30:46 -06:00
Heath Volmer
1d8924bc48 Merge remote-tracking branch 'origin/bugfix/ecs-541-1' into bugfix/ecs-535 2017-10-23 07:26:06 -06:00
Heath Volmer
0ac439be14 Cleaning up debug messages 2017-10-23 07:26:01 -06:00
Neil Dorin
23fb8311fe Added try/catch to VideoCodecUiDriver constructor. Seems to resolve errant NullRef 2017-10-23 07:16:53 -06:00
Neil Dorin
65adc5de1c Fixed bug with NullRef in ComputeHeaderCallStatus() method. However, some unknown Null Ref in the EssentialsVideoCodecUiDriver Constructor is preventing the UI from loading. 2017-10-23 00:02:13 -06:00
Neil Dorin
13a8876a61 Merge remote-tracking branch 'origin/bugfix/ecs-535' into bugfix/ecs-541-1 2017-10-22 12:40:09 -06:00
Neil Dorin
3897a41dd1 Fixed Stop Sharing button visible feedback on call list 2017-10-22 12:39:57 -06:00
Heath Volmer
8c47c5ed65 ecs-582, cancel incoming dialog 2017-10-22 11:11:42 -06:00
Neil Dorin
3e39210cc0 Merge remote-tracking branch 'origin/bugfix/ecs-535' into bugfix/ecs-541-1 2017-10-22 10:05:55 -06:00
Neil Dorin
2e98e8d146 Rebuit Changes from dead ecs-541 branch 2017-10-22 10:05:26 -06:00
Heath Volmer
1aea817f93 Working on next meeting notification 2017-10-22 10:05:24 -06:00
Heath Volmer
897d568032 Fixing header list icons 2017-10-20 11:24:44 -06:00
Heath Volmer
a16ea3f034 Merge remote-tracking branch 'origin/bugfix/ecs-541' into bugfix/ecs-535 2017-10-20 08:20:29 -06:00
Heath Volmer
c959f20204 TONS of UI misbehaviors. Lost track of issues 2017-10-19 20:00:10 -06:00
Heath Volmer
8dfa05293c ecs-600; ecs-601; ecs-573 2017-10-19 16:58:55 -06:00
Neil Dorin
4685850eff Merge remote-tracking branch 'origin/bugfix/ecs-535' into bugfix/ecs-541 2017-10-19 15:12:55 -06:00
Neil Dorin
dc53b293f1 Added Fusion support for EssentialsHuddleVtc1Room (Cisco Spark) 2017-10-19 15:12:25 -06:00
Heath Volmer
1d9490c46f ecs-567, 595 2017-10-19 14:59:18 -06:00
Neil Dorin
b301df6910 Merge remote-tracking branch 'origin/bugfix/ecs-535' into bugfix/ecs-541 2017-10-19 09:59:59 -06:00
Neil Dorin
50a6bde4f2 Fixed call status header icon mode to black phone down. Fixed issue with keyboard not launching on keypad w/ favorites icon. 2017-10-19 09:59:24 -06:00
Heath Volmer
dd5253301b ecs 561, 593, 594 2017-10-19 09:59:22 -06:00
Neil Dorin
b423d1cb58 Various bug fixes 2017-10-18 22:25:02 -06:00
Heath Volmer
91cc452e03 esc-544, initial fixes to routing and de-routing 2017-10-18 10:25:06 -06:00
Heath Volmer
07168f0f5b Merge remote-tracking branch 'origin/bugfix/ecs-541' into bugfix/ecs-535 2017-10-18 08:22:09 -06:00
Neil Dorin
08e528220c Bug fixing... 2017-10-17 22:19:34 -06:00
Neil Dorin
f5626fcd8b Commit before merging in Heath's branch 2017-10-17 21:10:23 -06:00
Heath Volmer
6482bbe6f4 ecs-542, 545, 547, 548 2017-10-17 18:09:45 -06:00
Neil Dorin
b9fceb830f Fixed bug with directory browsing not returning to root from 2 layers deep. Added message to first item of meetings SRL to indicate no meeting that day. 2017-10-17 10:46:45 -06:00
Neil Dorin
f37d1e18b2 fixes ecs-521 ecs-522 ecs-526 2017-10-13 16:09:22 -06:00
Neil Dorin
bff6d9e68d Progress on header call status label 2017-10-13 13:13:04 -06:00
Neil Dorin
41b42dbc8f Added Directory Search, bug fixes and updates to recents and meeting list. Made Meeting list modal/srl reusable for directory dial contact method modal. 2017-10-12 17:51:04 -06:00
Neil Dorin
fb0a91b454 Worked on VC directory and favorites. Fixed various bugs. 2017-10-11 21:43:14 -06:00
Heath Volmer
2def648596 It's Tuesday morning and I don't know what I'm doing. 2017-10-10 10:23:15 -06:00
Heath Volmer
dc04e04f96 Recent calls fixes; Directory browsing work 2017-10-09 16:38:42 -06:00
Neil Dorin
6f5d74a44e Fixed bug where booking results from Cisco Codec were being converted to generic meeting but never added to the list. 2017-10-06 15:33:03 -06:00
Heath Volmer
ce4f3dfff1 post 342 merge 2017-10-06 13:49:47 -06:00
Neil Dorin
cae86d1943 Tied in Room Occupancy Timer to Shutdown timer in EssentialsRoomBase 2017-10-06 12:53:34 -06:00
Heath Volmer
0196997a4e Tech PIN from config 2017-10-06 10:19:01 -06:00
Heath Volmer
f9d320e2b2 Changes for layout and selfview 2017-10-05 17:43:10 -06:00
Heath Volmer
af33aa41bf Merge remote-tracking branch 'origin/feature/ecs-342' into feature/ecs-500 2017-10-05 16:18:47 -06:00
Heath Volmer
f682793bbb Buttons for self view layout 2017-10-05 16:16:11 -06:00
Neil Dorin
3c3fca7766 Updates to Room Occupancy and added additional interfaces for codec layouts, selfview 2017-10-05 16:04:45 -06:00
Heath Volmer
4efc4d4e6e Merge remote-tracking branch 'origin/feature/cisco-spark-2' into feature/ecs-407 2017-10-05 15:55:29 -06:00
Heath Volmer
d52c629085 Starting self-view/layout controls 2017-10-05 15:55:12 -06:00
Heath Volmer
3e923ff41f favorites through to UI: 2017-10-05 13:29:48 -06:00
Heath Volmer
54f23eeb9f Call favorites start on mock; Fixed OBTP dialogs to match NYU 2017-10-05 12:10:51 -06:00
Neil Dorin
c3c7948990 Started working on Room Occupancy 2017-10-03 23:34:23 -06:00
Heath Volmer
c7cfcbe69e Short start on directory browsing 2017-10-03 17:59:00 -06:00
Heath Volmer
01a9503f47 Calendar; ribbon with meeting info; fire up from either 2017-10-03 17:38:41 -06:00
Neil Dorin
e6eafdaf14 Merge branch 'feature/ecs-407' of http://code.pepperdash.net/scm/pec/essentials into feature/cisco-spark-2
Conflicts:
	Essentials Devices Common/Essentials Devices Common/Codec/iHasScheduleAwareness.cs
2017-10-03 15:09:31 -06:00
Heath Volmer
c53a14f05e Meetings list on-screen with Mock VC 2017-10-03 14:47:37 -06:00
Heath Volmer
db4b5e863b Restructured header into icon list depending on features available 2017-10-03 11:49:56 -06:00
Neil Dorin
b929113ea6 Added mechanism for Meetings list to notify UI layer of meeting events 2017-10-02 16:24:36 -06:00
Heath Volmer
183112987e ecs-464 recent calls list, no deletion or confirmation 2017-10-02 16:10:46 -06:00
Heath Volmer
6bbd11c59b Merge remote-tracking branch 'origin/feature/cisco-spark-2' into feature/ecs-407 2017-10-02 15:28:15 -06:00
Heath Volmer
1274c74807 Premerge call history 2017-10-02 15:26:12 -06:00
Neil Dorin
412dca0459 Updated interface name case to have capital I prefix for consistency 2017-10-02 14:04:05 -06:00
Heath Volmer
ae2725f6d1 ecs-482 address; ecs-415 shutdown on contact; ecs-484 displays on tech 2017-10-02 10:51:00 -06:00
Heath Volmer
6b9b6bbd68 PIN dialog for tech page 2017-09-29 19:43:56 -06:00
Neil Dorin
a8e5e2f763 Added generic meeting classes to convert from deserialized Cisco booking data to generic meetings 2017-09-29 16:47:03 -06:00
Heath Volmer
bdde968c61 ecs-397, default volume on power up 2017-09-29 10:39:46 -06:00
Heath Volmer
5d2022549d ecs-481 swapped call/share; ecs-483 phone number and address text code (with backing codec modifications) 2017-09-29 10:12:09 -06:00
Neil Dorin
3e6f345b8b Fixed issue with corporate phonebook contact entries missing some properties 2017-09-28 16:14:24 -06:00
Neil Dorin
bde56a22d1 Merge remote-tracking branch 'origin/feature/ecs-407' into feature/cisco-spark-2 2017-09-28 15:26:28 -06:00
Neil Dorin
0bcb776ac5 Fixed incoming call popup issue with CiscoCodec call direction value not being stored to ActiveCallItem 2017-09-28 14:05:13 -06:00
Heath Volmer
0f41f3ce50 Added none source to share list 2017-09-28 13:53:16 -06:00
Neil Dorin
46cce6559c Added CodecInfo object to VideoCodecBase 2017-09-28 13:42:41 -06:00
Heath Volmer
b57582feea Various tech page framework items 2017-09-27 20:19:28 -06:00
Neil Dorin
13d15388f0 codec phonebook logic working and printing to console. Fixed bug wtih call status and tested with UI 2017-09-27 17:44:31 -06:00
Heath Volmer
58d22abd5a ecs-427 logo server on cs 2017-09-27 13:38:17 -06:00
Neil Dorin
214a740345 Merge branch 'feature/ecs-407' of http://code.pepperdash.net/scm/pec/essentials into feature/cisco-spark-2
Conflicts:
	Essentials Devices Common/Essentials Devices Common/VideoCodec/VideoCodecBase.cs
2017-09-27 12:37:53 -06:00
Heath Volmer
a5eb61ef0e ecs-444, 458, 474, 475, 477 2017-09-27 12:26:36 -06:00
Neil Dorin
12683551a4 Phonebook results successfully converted to flat list and printed to console for Root, folder contents and search results 2017-09-27 12:23:32 -06:00
Neil Dorin
68427af337 Merge branch 'feature/ecs-407' of http://code.pepperdash.net/scm/pec/essentials into feature/cisco-spark-2 2017-09-26 23:56:55 -06:00
Neil Dorin
33ceff861f updates to phonebook search methods 2017-09-26 23:55:10 -06:00
Neil Dorin
a2d42dc77b Added booking class and phonebook sync logic 2017-09-26 09:17:47 -06:00
Heath Volmer
1abf56474e Notification ribbon; keyboard touchups 2017-09-25 18:01:13 -06:00
Heath Volmer
a262dfdf5b Extensive keyboard development 2017-09-25 17:23:04 -06:00
Neil Dorin
26907acb56 Added generic codec directory interface and cisco specific phonebook classes for deserialization 2017-09-22 17:30:10 -06:00
Neil Dorin
0ee35dfbd9 Merge remote-tracking branch 'origin/feature/ecs-407' into feature/cisco-spark-2 2017-09-22 15:44:00 -06:00
Neil Dorin
a71e991383 set up program to load Cisco Codec from config, not just manually 2017-09-22 15:40:08 -06:00
Heath Volmer
1c63e506b8 Fixed end all not working - many hours chasing error 2017-09-22 13:20:50 -06:00
Heath Volmer
f498d55dd6 ecs-411: Most of keyboard driver 2017-09-21 21:23:48 -06:00
Neil Dorin
1d46f8520d Updates to call status tracking and Call History. Added CiscoCodecPropertiesConfig class 2017-09-21 18:00:43 -06:00
Neil Dorin
3b3ea98dea Merge remote-tracking branch 'origin/feature/ecs-407' into feature/cisco-spark-2
Conflicts:
	Essentials Devices Common/Essentials Devices Common/Codec/CodecActiveCallItem.cs
	Essentials Devices Common/Essentials Devices Common/Codec/eCodecCallStatus.cs
	Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoCodec.cs
	Essentials Devices Common/Essentials Devices Common/VideoCodec/VideoCodecBase.cs
2017-09-21 11:57:48 -06:00
Neil Dorin
75ff8ea88a updates to iCallHistory and changed CallHIstoryEntry to extend CodecActiveCallItem 2017-09-21 11:53:13 -06:00
Heath Volmer
69e76bdb3a Moved ListCalls into VideoCodecBase 2017-09-21 11:29:13 -06:00
Heath Volmer
639e1810db Fixed connected enum; Call status header button 2017-09-21 10:56:37 -06:00
Neil Dorin
ff5fab4984 Merge remote-tracking branch 'origin/feature/ecs-407' into feature/cisco-spark-2
Conflicts:
	Essentials Devices Common/Essentials Devices Common/Codec/CodecActiveCallItem.cs
2017-09-20 18:19:03 -06:00
Heath Volmer
ca3f6d4d14 Tuning up InCall statuses, removed ActiveCallCountFB 2017-09-20 16:57:49 -06:00
Neil Dorin
c045c8e7a6 Minor updates to Codec Interfaces 2017-09-20 09:55:18 -06:00
Heath Volmer
82465e8789 Moved some enums into separate files; modifying simulation methods on MockVC; Added Connecting state to eCodecStatus; ... 2017-09-20 09:51:48 -06:00
Neil Dorin
c0d3c92495 Merge remote-tracking branch 'origin/feature/ecs-407' into feature/cisco-spark-2
Conflicts:
	Essentials Devices Common/Essentials Devices Common/Codec/CodecActiveCallItem.cs
2017-09-19 18:13:58 -06:00
Neil Dorin
5c6ba60d51 Updated enum values in CodecActiveCallItem 2017-09-19 18:06:30 -06:00
Heath Volmer
f13978368f merge cisco-spark-2, see previous commit note 2017-09-19 17:54:21 -06:00
Neil Dorin
3d811c6979 Commit before merge with Heath 2017-09-19 17:50:06 -06:00
Heath Volmer
a6f0163264 Moved around base class items and interfaces. Added CodecStatusItems to many methods. 2017-09-19 17:49:25 -06:00
Heath Volmer
b33273e6d3 Fixing up basic UI switchs 2017-09-19 12:09:20 -06:00
Heath Volmer
fed06bc025 cisco-spark-2 merge 2017-09-18 17:42:18 -06:00
Heath Volmer
cc6e555f25 ? 2017-09-18 17:38:05 -06:00
Neil Dorin
b0fd837cdc Updates to codec interfaces to handle active calls 2017-09-18 17:23:05 -06:00
Heath Volmer
95a6f3948f Replaced incallfeedback with activecallcount.... 2017-09-18 14:27:49 -06:00
Heath Volmer
8df353ab75 Fixed wrecked merge by sleepy fool 2017-09-18 13:38:05 -06:00
Heath Volmer
535fce5f33 Merge with o/f/cisco-spark 2017-09-18 10:45:29 -06:00
Heath Volmer
b588a8c325 Not clear change 2017-09-18 10:42:48 -06:00
Neil Dorin
253095cb93 EOD commit. Working on integrating Crestron OBTP library 2017-09-15 17:02:22 -06:00
Neil Dorin
9b85456f2e Updated ICodecAudio interface to break out individual functions to their own interfaces and not assume all to be applied to VideoCodecBase. Updated affected classes as a result. 2017-09-15 11:47:45 -06:00
Neil Dorin
f6a9ecca03 Merge remote-tracking branch 'origin/feature/ecs-407' into feature/cisco-spark 2017-09-15 11:30:04 -06:00
Neil Dorin
2028fa308a Updates to xStatus an CiscoCodec to remove compile errors (duplicate objects, InputPort actions) 2017-09-15 11:13:59 -06:00
Heath Volmer
a63e8b394f merge ecs-407 2017-09-15 10:06:21 -06:00
Heath Volmer
16e1185fdf Very elusive null ref in routing/usage tracking; adding bits and pieces to codecs 2017-09-15 10:01:18 -06:00
Neil Dorin
9e4f34acd5 Added command for CiscoCodec methods implemented by standard interfaces. Renamed data class files. 2017-09-14 23:05:33 -06:00
Heath Volmer
dc3cc1d4eb Added various things to mock. Trying to find exception in routing 2017-09-14 20:29:15 -06:00
Heath Volmer
e8a9282180 Merge remote-tracking branch 'origin/feature/cisco-spark' into feature/ecs-407 2017-09-14 10:52:42 -06:00
Neil Dorin
58ed6b450f Added References to Crestron Cisco Classes 2017-09-14 10:50:40 -06:00
Heath Volmer
741d6a4a87 Merge remote-tracking branch 'origin/feature/cisco-spark' into feature/ecs-407 2017-09-14 10:23:15 -06:00
Heath Volmer
d2680298ff Further mock testing into UI 2017-09-14 10:22:35 -06:00
Neil Dorin
1ad1c5404f Started working on property feedback mechansism to trigger codec feedbacks automatically when feedback values are deserialized 2017-09-14 10:21:29 -06:00
Neil Dorin
a9424cde22 JSON feedback deserialization working 2017-09-14 09:16:18 -06:00
Neil Dorin
9b145d6dfc Merge remote-tracking branch 'origin/feature/ecs-407' into feature/cisco-spark
Conflicts:
	Essentials Devices Common/Essentials Devices Common/VC/MockVC/MockVC.cs
2017-09-13 16:07:15 -06:00
Neil Dorin
b6965fac0b Re-added VC/CiscoCodec classes 2017-09-13 16:05:19 -06:00
Neil Dorin
57dee6153b Merge remote-tracking branch 'origin/feature/ecs-407' into feature/cisco-spark
Conflicts:
	Essentials Devices Common/Essentials Devices Common/VC/VideoCodecBase.cs
2017-09-13 14:07:56 -06:00
Heath Volmer
d65ff7add0 Mock testing: Connect/End UI behavior start 2017-09-13 11:39:22 -06:00
Neil Dorin
849675c539 Updates to Video Codec Interfaces 2017-09-12 14:04:20 -06:00
Heath Volmer
fd14eeb9a7 Added VC Mock and some interaction in UI layer 2017-09-12 13:52:25 -06:00
Heath Volmer
2196f5e67a Merge with feature/cisco-spark 2017-09-12 11:12:52 -06:00
Neil Dorin
830093da3b Push before merge with Heath 2017-09-12 11:09:27 -06:00
Heath Volmer
fb70dac224 Trying to fix broken routing on hud-vtc 2017-09-12 11:08:35 -06:00
Heath Volmer
2180521004 Basic scaffold of VC driver. 2017-09-11 20:37:38 -06:00
Heath Volmer
682c21f37c Added Huddle-vtc room; Adding hud-vtc driver; adding vc driver 2017-09-11 19:57:03 -06:00
Heath Volmer
b81c667e5f Added many UI Joins. 2017-09-11 16:08:55 -06:00
Neil Dorin
4b4bf1a1c8 Working HTTP Server and Client communicating with codec. Need to fix issue with deserializing configuration.xml upon connection (null ref exception). 2017-09-08 15:00:16 -06:00
Neil Dorin
65819cf723 Added HTTP server for receiving feedback from Cisco codec. Added data classes for desiralization of responses from codec. 2017-09-07 17:58:44 -06:00
Heath Volmer
cb5dcc5088 PageDriver for VtcHuddle AV funcs; PageDriver for Spark 2017-09-06 18:07:37 -06:00
Neil Dorin
0d071e6e82 Updated class names to not use VC abbreviation. Defined additional interfaces 2017-09-06 08:52:53 -06:00
Heath Volmer
9aad840a78 NYU AV Driver start 2017-09-05 18:51:15 -06:00
Neil Dorin
617e2bdc4f Defined VcCodecBase, new Vc interfaces and started CiscoCodec class 2017-08-31 18:12:52 -06:00
Neil Dorin
88de2a2ee0 Updates to Fusion SetUpCommunicationMonitors() method to properly link TPs vs Xpanels by base class type. 2017-08-31 16:41:31 -06:00
Heath Volmer
f502432fcc Merge from feature/fusion-nyc 2017-08-28 15:02:11 -05:00
Neil Dorin
a052700934 Updates to source switching digitals and added processor reboot attribute to Fusion 2017-08-28 13:37:43 -06:00
Heath Volmer
74d48a0427 Default volume; hide setup gear for ipad 2017-08-28 14:26:41 -05:00
Neil Dorin
e344e05857 Bug fixes to device usage string syntax. Tested and working with Fusion Reporting. 2017-08-25 18:05:19 -06:00
Neil Dorin
0b5681842e Device Usage working when switching sources 2017-08-25 17:00:58 -06:00
Heath Volmer
6ab5f06fc9 Minor friday afternoon changes 2017-08-25 15:50:17 -06:00
Heath Volmer
d55d30be3f Fixed share button sync issues around power off dialogs 2017-08-25 15:16:21 -06:00
Heath Volmer
efd630c8f1 Hopefully fixed standby/power off glitch on Sammy; Removed some debugging; Removed duplicate routing on huddle room 2017-08-25 10:03:35 -06:00
Heath Volmer
2a1c9dbaf6 Added code to ignore power off state on general status messages when input is <10 2017-08-24 21:56:57 -06:00
Heath Volmer
7801a980b5 Testing ANOTHER power off/standby catch 2017-08-24 21:28:27 -06:00
Heath Volmer
0d42a41af3 Try catch on some Fusion usage bugs; Fixed press-hold on TriListExtensions 2017-08-24 20:29:30 -06:00
Neil Dorin
ba6fdb83ae Removes .projectinfo files for cleaner merges 2017-08-24 16:25:38 -06:00
Heath Volmer
12d9ad1183 Test removing projectinfo 2017-08-24 16:24:34 -06:00
Heath Volmer
75fb5bc9d6 Merged in ecs-355-neil 2017-08-24 16:10:46 -06:00
Heath Volmer
841af73248 Logo loading; troublshooting power/sleep hiccuo 2017-08-24 16:03:45 -06:00
Neil Dorin
2fd4bbc8b3 Commit before merge. Updates to source device usage triggers based on room source routing 2017-08-24 15:43:12 -06:00
Heath Volmer
6aad62ee6b Changed back temporary gear join after UI fix 2017-08-24 10:00:47 -06:00
Heath Volmer
de8c7477b8 Countdown timer seconds on modal 390; 359 auto-on source 2017-08-23 22:41:01 -06:00
Heath Volmer
057d8ac5f5 Added sig held helper function 2017-08-23 22:03:54 -06:00
Heath Volmer
d5dddade85 press with hold on gear button 2017-08-23 21:46:23 -06:00
Heath Volmer
78529a4d56 Gear button and setup page 2017-08-23 21:28:33 -06:00
Heath Volmer
f87e0a7888 376, 377, 383. Resolving multi UI-sync issues 2017-08-23 20:14:23 -06:00
Heath Volmer
2c8259e350 Warming, cooling synced with display. 2017-08-23 15:43:30 -06:00
Heath Volmer
19f3b10f90 Adding warming and cooling modal. Warming seems to occasionally not happen 2017-08-23 14:14:35 -06:00
Heath Volmer
85c2c448d1 Finished merge with 307 2017-08-22 10:48:27 -06:00
Neil Dorin
2b29bf6aa5 Minor updates to Fusion Occ before merge 2017-08-22 10:28:00 -06:00
Heath Volmer
87e5e9bbe0 projectinfos 2017-08-22 10:26:20 -06:00
Neil Dorin
ce3de2baeb Added DeviceUsage logic. Requires testing on NYC program with real hardware. Ready for Merge. 2017-08-21 18:04:47 -06:00
Heath Volmer
f10e20b78a Lots of f-words 2017-08-21 16:41:18 -06:00
Heath Volmer
6656e67085 Refining power off dialog; added helpers to TPController for console-signal debugging 2017-08-21 14:22:59 -06:00
Heath Volmer
5c08c7d65e Fixing shutdown timers; removing Timer from ModalDialog 2017-08-21 12:46:09 -06:00
Heath Volmer
0becff5320 Working on adding shutdown timing to room, not UI 2017-08-19 11:41:30 -06:00
Heath Volmer
4cda13f004 Added countdown timer. Currently counts seconds from n to 0 with various events and callbacks 2017-08-18 16:55:54 -06:00
Neil Dorin
710bfa3e8f Implemented Device Usage feature for Fusion. 2017-08-18 12:37:09 -06:00
Heath Volmer
25122abed1 Fixed volume up/down; Working on linking display power fb to room on fb 2017-08-18 12:20:22 -06:00
Neil Dorin
1d54214c55 Working Fusion Time Sync feature 2017-08-17 18:03:56 -06:00
Neil Dorin
0f449801e4 Updates to Fusion classes to support NYU deployment 2017-08-17 00:39:11 -06:00
Heath Volmer
394be710a4 Fixed Touchpanel controller to spin up a 560 2017-08-16 15:54:39 -06:00
Heath Volmer
85683ea9fa esc-337, found errant timer resets on comm monitor and Sammy display 2017-08-16 15:26:46 -06:00
Heath Volmer
17b0373c73 Saved same commands 2017-08-16 14:04:13 -06:00
Heath Volmer
7320f47d60 Added Simulate receive on com port 2017-08-16 11:15:49 -06:00
Heath Volmer
667c511515 Touching up comms on Sammy MDC 2017-08-15 19:30:48 -06:00
Heath Volmer
8586796a6d Added properties and feedbacks debugging; Working on buffering socket on Sammy 2017-08-14 18:19:49 -06:00
Heath Volmer
a3d499accf End of friday compile 2017-08-14 09:44:29 -06:00
Heath Volmer
9e9b8628a4 Heavy touch ups to comms (324); Fixed source display on turn-on (322); Added gear visibility in code (336) 2017-08-11 15:14:38 -06:00
Heath Volmer
efd5b59bda Moving commands into byte representations. Working on Volume 2017-08-10 15:29:53 -06:00
Neil Dorin
6d21950180 Uncommnedt GoWithLoad() in ControlSystem.cs 2017-07-27 14:34:35 -06:00
Neil Dorin
5d0f50677a Updates to complete SamsungMDC driver addition 2017-07-27 14:33:06 -06:00
Neil Dorin
7abccd8865 Continued work on SamsungMDC Display driver class 2017-07-26 23:17:41 -06:00
Neil Dorin
c2d961505e Started on Samsung MDC driver 2017-07-25 17:41:52 -06:00
586 changed files with 167758 additions and 21205 deletions

4
.gitignore vendored
View File

@@ -19,4 +19,6 @@ Thumbs.db
obj/
[Rr]elease*/
_ReSharper*/
SIMPLSharpLogs/
SIMPLSharpLogs/
*.projectinfo
essentials-framework/EssentialDMTestConfig/

View File

@@ -1,26 +0,0 @@
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
{
//public class ComPortConfig
//{
// //public string ContolPortDevKey { get; set; }
// //public uint ControlPortNumber { get; set; }
// [JsonConverter(typeof(ComSpecJsonConverter))]
// public ComPort.ComPortSpec ComParams { get; set; }
//}
}

View File

@@ -1,36 +0,0 @@
using System;
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("comment")]
public string Comment { get; set; }
public InfoConfig()
{
Name = "";
Date = DateTime.Now;
Type = "";
Version = "";
Comment = "";
}
}
}

View File

@@ -1,142 +0,0 @@
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using Crestron.SimplSharp;
//using Crestron.SimplSharp.CrestronDataStore;
//using Crestron.SimplSharpPro;
//namespace PepperDash.Essentials.Core
//{
// public class Debug
// {
// public static uint Level { get; private set; }
// /// <summary>
// /// This should called from the ControlSystem Initiailize method.
// /// </summary>
// public static void Initialize()
// {
// // Add command to console
// CrestronConsole.AddNewConsoleCommand(SetDebugFromConsole, "appdebug",
// "appdebug:P [0-2]: Sets the application's console debug message level",
// ConsoleAccessLevelEnum.AccessOperator);
// uint level = 0;
// var err = CrestronDataStoreStatic.GetGlobalUintValue("DebugLevel", out level);
// if (err == CrestronDataStore.CDS_ERROR.CDS_SUCCESS)
// SetDebugLevel(level);
// else if (err == CrestronDataStore.CDS_ERROR.CDS_RECORD_NOT_FOUND)
// CrestronDataStoreStatic.SetGlobalUintValue("DebugLevel", 0);
// else
// CrestronConsole.PrintLine("Error restoring console debug level setting: {0}", err);
// }
// /// <summary>
// /// Callback for console command
// /// </summary>
// /// <param name="levelString"></param>
// public static void SetDebugFromConsole(string levelString)
// {
// try
// {
// if (string.IsNullOrEmpty(levelString.Trim()))
// {
// CrestronConsole.PrintLine("AppDebug level = {0}", Level);
// return;
// }
// SetDebugLevel(Convert.ToUInt32(levelString));
// }
// catch
// {
// CrestronConsole.PrintLine("Usage: appdebug:P [0-2]");
// }
// }
// /// <summary>
// /// Sets the debug level
// /// </summary>
// /// <param name="level"> Valid values 0 (no debug), 1 (critical), 2 (all messages)</param>
// public static void SetDebugLevel(uint level)
// {
// if (level <= 2)
// {
// Level = 2;
// CrestronConsole.PrintLine("[Application {0}], Debug level set to {1}",
// InitialParametersClass.ApplicationNumber, level);
// var err = CrestronDataStoreStatic.SetGlobalUintValue("DebugLevel", level);
// if(err != CrestronDataStore.CDS_ERROR.CDS_SUCCESS)
// CrestronConsole.PrintLine("Error saving console debug level setting: {0}", err);
// }
// }
// /// <summary>
// /// Prints message to console if current debug level is equal to or higher than the level of this message.
// /// Uses CrestronConsole.PrintLine.
// /// </summary>
// /// <param name="level"></param>
// /// <param name="format">Console format string</param>
// /// <param name="items">Object parameters</param>
// public static void Console(uint level, string format, params object[] items)
// {
// if (Level >= level)
// CrestronConsole.PrintLine("App {0}:{1}", InitialParametersClass.ApplicationNumber,
// string.Format(format, items));
// }
// /// <summary>
// /// Appends a device Key to the beginning of a message
// /// </summary>
// public static void Console(uint level, IKeyed dev, string format, params object[] items)
// {
// if (Level >= level)
// Console(level, "[{0}] {1}", dev.Key, string.Format(format, items));
// }
// public static void Console(uint level, IKeyed dev, ErrorLogLevel errorLogLevel,
// string format, params object[] items)
// {
// if (Level >= level)
// {
// var str = string.Format("[{0}] {1}", dev.Key, string.Format(format, items));
// Console(level, str);
// LogError(errorLogLevel, str);
// }
// }
// public static void Console(uint level, ErrorLogLevel errorLogLevel,
// string format, params object[] items)
// {
// if (Level >= level)
// {
// var str = string.Format(format, items);
// Console(level, str);
// LogError(errorLogLevel, str);
// }
// }
// public static void LogError(ErrorLogLevel errorLogLevel, string str)
// {
// string msg = string.Format("App {0}:{1}", InitialParametersClass.ApplicationNumber, str);
// switch (errorLogLevel)
// {
// case ErrorLogLevel.Error:
// ErrorLog.Error(msg);
// break;
// case ErrorLogLevel.Warning:
// ErrorLog.Warn(msg);
// break;
// case ErrorLogLevel.Notice:
// ErrorLog.Notice(msg);
// break;
// }
// }
// public enum ErrorLogLevel
// {
// Error, Warning, Notice, None
// }
// }
//}

View File

@@ -1,56 +0,0 @@
using System.Collections.Generic;
using System.Linq;
using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Core;
namespace PepperDash.Essentials.Core
{
public interface IHasFeedback : IKeyed
{
/// <summary>
/// This method shall return a list of all Output objects on a device,
/// including all "aggregate" devices.
/// </summary>
List<Feedback> Feedbacks { get; }
}
public static class IHasFeedbackExtensions
{
public static void DumpFeedbacksToConsole(this IHasFeedback source, bool getCurrentStates)
{
var outputs = source.Feedbacks.OrderBy(x => x.Type);
if (outputs != null)
{
Debug.Console(0, source, "\n\nAvailable outputs:");
foreach (var o in outputs)
{
string val = "";
if (getCurrentStates)
{
switch (o.Type)
{
case eCueType.Bool:
val = " = " + o.BoolValue;
break;
case eCueType.Int:
val = " = " + o.IntValue;
break;
case eCueType.String:
val = " = " + o.StringValue;
break;
//case eOutputType.Other:
// break;
}
}
Debug.Console(0, "{0,-8} {1,5} {2}{3}", o.Type, o.Cue.Number,
(string.IsNullOrEmpty(o.Cue.Name) ? "-none-" : o.Cue.Name), val);
}
}
else
Debug.Console(0, source, "No available outputs:");
}
}
}

View File

@@ -1,92 +0,0 @@
//using System;
//using System.Collections.Generic;
//using System.Linq;
//namespace PepperDash.Essentials.Core
//{
// //*********************************************************************************************************
// /// <summary>
// /// The core event and status-bearing class that most if not all device and connectors can derive from.
// /// </summary>
// public class Device : IKeyed
// {
// public string Key { get; protected set; }
// public string Name { get; protected set; }
// public bool Enabled { get; protected set; }
// List<Action> _PreActivationActions;
// List<Action> _PostActivationActions;
// public static Device DefaultDevice { get { return _DefaultDevice; } }
// static Device _DefaultDevice = new Device("Default", "Default");
// /// <summary>
// /// Base constructor for all Devices.
// /// </summary>
// /// <param name="key"></param>
// public Device(string key)
// {
// Key = key;
// if (key.Contains('.')) Debug.Console(0, this, "WARNING: Device name's should not include '.'");
// Name = "";
// }
// public Device(string key, string name) : this(key)
// {
// Name = name;
// }
// public void AddPreActivationAction(Action act)
// {
// if (_PreActivationActions == null)
// _PreActivationActions = new List<Action>();
// _PreActivationActions.Add(act);
// }
// public void AddPostActivationAction(Action act)
// {
// if (_PostActivationActions == null)
// _PostActivationActions = new List<Action>();
// _PostActivationActions.Add(act);
// }
// /// <summary>
// /// Gets this device ready to be used in the system. Runs any added pre-activation items, and
// /// all post-activation at end. Classes needing additional logic to
// /// run should override CustomActivate()
// /// </summary>
// public bool Activate()
// {
// if (_PreActivationActions != null)
// _PreActivationActions.ForEach(a => a.Invoke());
// var result = CustomActivate();
// if(result && _PostActivationActions != null)
// _PostActivationActions.ForEach(a => a.Invoke());
// return result;
// }
// /// <summary>
// /// Called in between Pre and PostActivationActions when Activate() is called.
// /// Override to provide addtitional setup when calling activation. Overriding classes
// /// do not need to call base.CustomActivate()
// /// </summary>
// /// <returns>true if device activated successfully.</returns>
// public virtual bool CustomActivate() { return true; }
// /// <summary>
// /// Call to deactivate device - unlink events, etc. Overriding classes do not
// /// need to call base.Deactivate()
// /// </summary>
// /// <returns></returns>
// public virtual bool Deactivate() { return true; }
// /// <summary>
// /// Helper method to check object for bool value false and fire an Action method
// /// </summary>
// /// <param name="o">Should be of type bool, others will be ignored</param>
// /// <param name="a">Action to be run when o is false</param>
// public void OnFalse(object o, Action a)
// {
// if (o is bool && !(bool)o) a();
// }
// }
//}

View File

@@ -1,44 +0,0 @@
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using Crestron.SimplSharp;
//using Crestron.SimplSharpPro;
//using Crestron.SimplSharpPro.DeviceSupport;
//using Crestron.SimplSharpPro.EthernetCommunication;
//using Crestron.SimplSharpPro.UI;
//using PepperDash.Core;
//namespace PepperDash.Essentials.Core
//{
//[Obsolete]
// public class PresentationDevice : Device, IPresentationSource
// {
// public PresentationSourceType Type { get; protected set; }
// public string IconName { get { return "Blank"; } set { } }
// public BoolFeedback HasPowerOnFeedback { get; protected set; }
// PresentationDevice()
// : base("Default", "Default")
// {
// HasPowerOnFeedback = new BoolFeedback(CommonBoolCue.HasPowerFeedback, () => false);
// Type = PresentationSourceType.None;
// }
// /// <summary>
// /// Returns a "default" presentation device, with no abilities.
// /// </summary>
// public static IPresentationSource Default
// {
// get
// {
// if (_Default == null)
// _Default = new PresentationDevice();
// return _Default;
// }
// }
// static IPresentationSource _Default;
// }
//}

View File

@@ -1,52 +0,0 @@
//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;
//namespace PepperDash.Essentials.Core
//{
// public class DeviceConfig
// {
// public string Key { get; set; }
// public string Name { get; set; }
// public string Type { get; set; }
// [JsonConverter(typeof(DevicePropertiesJsonConverter))]
// public JToken Properties { get; set; }
// }
// /// <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
// /// </summary>
// public class DevicePropertiesJsonConverter : JsonConverter
// {
// public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
// {
// return JObject.Load(reader);
// }
// /// <summary>
// /// This will be hit with every value in the ComPortConfig class. We only need to
// /// do custom conversion on the comspec items.
// /// </summary>
// public override bool CanConvert(Type objectType)
// {
// return true;
// }
// public override bool CanRead { get { return true; } }
// public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
// {
// throw new NotImplementedException();
// }
// }
//}

View File

@@ -1,50 +0,0 @@
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using Crestron.SimplSharp;
//using Crestron.SimplSharpPro;
//using Crestron.SimplSharpPro.DeviceSupport;
//using PepperDash.Core;
//namespace PepperDash.Essentials.Core
//{
// public abstract class DvdDeviceBase : Device, IPresentationSource, IHasCueActionList
// {
// public DvdDeviceBase(string key, string name)
// : base(key, name)
// {
// HasPowerOnFeedback = new BoolFeedback(() => false);
// }
// #region IPresentationSource Members
// PresentationSourceType IPresentationSource.Type
// {
// get { return PresentationSourceType.Dvd; }
// }
// public string IconName
// {
// get
// {
// return "DVD";
// }
// set { }
// }
// public virtual BoolFeedback HasPowerOnFeedback { get; private set; }
// #endregion
// #region IFunctionList Members
// public abstract List<CueActionPair> CueActionList { get; }
// #endregion
// }
//}

View File

@@ -1,130 +0,0 @@
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using Crestron.SimplSharpPro;
//using PepperDash.Essentials.Core;
//using PepperDash.Core;
//namespace PepperDash.Essentials.Core
//{
// /// <summary>
// /// This DVD class should cover most IR, one-way DVD and Bluray fuctions
// /// </summary>
// public class IrDvdBase : Device, IHasCueActionList,
// IPresentationSource, IAttachVideoStatus, IHasFeedback, IRoutingOutputs
// {
// public PresentationSourceType Type { get; protected set; }
// public string IconName { get; set; }
// public BoolFeedback HasPowerOnFeedback { get; private set; }
// public IrOutputPortController IrPort { get; private set; }
// public RoutingOutputPort HdmiOut { get; private set; }
// #region IRoutingOutputs Members
// /// <summary>
// /// Options: hdmi
// /// </summary>
// public RoutingPortCollection<RoutingOutputPort> OutputPorts { get; private set; }
// #endregion
// public IrDvdBase(string key, string name, IROutputPort port, IrDriverInfo driverInfo)
// : base(key, name)
// {
// IrPort = new IrOutputPortController("ir-" + key, port, driverInfo.FileName);
// Type = PresentationSourceType.Dvd;
// IconName = "Bluray";
// HasPowerOnFeedback = new BoolFeedback(CommonBoolCue.HasPowerFeedback, () => false);
// HdmiOut = new RoutingOutputPort("HDMI", eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, 0, this);
// OutputPorts = new RoutingPortCollection<RoutingOutputPort>()
// {
// HdmiOut
// };
// CueActionList = IrPort.GetUOsForIrCommands(driverInfo.IrMap);
// }
// public IrDvdBase(string key, string name, IROutputPort port, string irDriverFilepath)
// : base(key, name)
// {
// IrPort = new IrOutputPortController("ir-" + key, port, irDriverFilepath);
// Type = PresentationSourceType.Dvd;
// IconName = "Bluray";
// HasPowerOnFeedback = new BoolFeedback(CommonBoolCue.HasPowerFeedback, () => false);
// HdmiOut = new RoutingOutputPort("HDMI", eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, 0, this);
// OutputPorts = new RoutingPortCollection<RoutingOutputPort>()
// {
// HdmiOut
// };
// var numToIr = new Dictionary<Cue, string>
// {
// { CommonBoolCue.Power, IROutputStandardCommands.IROut_POWER },
// { CommonBoolCue.PowerOff, IROutputStandardCommands.IROut_POWER_OFF },
// { CommonBoolCue.PowerOn, IROutputStandardCommands.IROut_POWER_ON },
// { CommonBoolCue.Replay, IROutputStandardCommands.IROut_REPLAY },
// { CommonBoolCue.Play, IROutputStandardCommands.IROut_PLAY },
// { CommonBoolCue.Pause, IROutputStandardCommands.IROut_PAUSE },
// { CommonBoolCue.Stop, IROutputStandardCommands.IROut_STOP },
// { CommonBoolCue.ChapPrevious, IROutputStandardCommands.IROut_TRACK_MINUS },
// { CommonBoolCue.ChapNext, IROutputStandardCommands.IROut_TRACK_PLUS },
// { CommonBoolCue.Rewind, IROutputStandardCommands.IROut_RSCAN },
// { CommonBoolCue.Ffwd, IROutputStandardCommands.IROut_FSCAN },
// { CommonBoolCue.RStep, IROutputStandardCommands.IROut_R_STEP },
// { CommonBoolCue.FStep, IROutputStandardCommands.IROut_F_STEP },
// { CommonBoolCue.Exit, IROutputStandardCommands.IROut_EXIT },
// { CommonBoolCue.Home, IROutputStandardCommands.IROut_HOME },
// { CommonBoolCue.Menu, IROutputStandardCommands.IROut_MENU },
// { CommonBoolCue.PopUp, IROutputStandardCommands.IROut_POPUPMENU },
// { CommonBoolCue.Up, IROutputStandardCommands.IROut_UP_ARROW },
// { CommonBoolCue.Down, IROutputStandardCommands.IROut_DN_ARROW },
// { CommonBoolCue.Left, IROutputStandardCommands.IROut_LEFT_ARROW },
// { CommonBoolCue.Right, IROutputStandardCommands.IROut_RIGHT_ARROW },
// { CommonBoolCue.Select, IROutputStandardCommands.IROut_ENTER },
// { CommonBoolCue.Info, IROutputStandardCommands.IROut_INFO },
// { CommonBoolCue.Red, IROutputStandardCommands.IROut_RED },
// { CommonBoolCue.Green, IROutputStandardCommands.IROut_GREEN },
// { CommonBoolCue.Yellow, IROutputStandardCommands.IROut_YELLOW },
// { CommonBoolCue.Blue, IROutputStandardCommands.IROut_BLUE },
// { CommonBoolCue.Digit0, IROutputStandardCommands.IROut_0 },
// { CommonBoolCue.Digit1, IROutputStandardCommands.IROut_1 },
// { CommonBoolCue.Digit2, IROutputStandardCommands.IROut_2 },
// { CommonBoolCue.Digit3, IROutputStandardCommands.IROut_3 },
// { CommonBoolCue.Digit4, IROutputStandardCommands.IROut_4 },
// { CommonBoolCue.Digit5, IROutputStandardCommands.IROut_5 },
// { CommonBoolCue.Digit6, IROutputStandardCommands.IROut_6 },
// { CommonBoolCue.Digit7, IROutputStandardCommands.IROut_7 },
// { CommonBoolCue.Digit8, IROutputStandardCommands.IROut_8 },
// { CommonBoolCue.Digit9, IROutputStandardCommands.IROut_9 },
// { CommonBoolCue.Audio, "AUDIO" },
// { CommonBoolCue.Subtitle, "SUBTITLE" },
// { CommonBoolCue.Setup, "SETUP" },
// };
// CueActionList = IrPort.GetUOsForIrCommands(numToIr);
// }
// public List<Feedback> Feedbacks
// {
// get { return this.GetVideoStatuses().ToList(); }
// }
// #region IFunctionList Members
// public List<CueActionPair> CueActionList { get; set; }
// #endregion
// }
// public class IrDriverInfo
// {
// public Dictionary<Cue, string> IrMap { get; set; }
// public string FileName { get; set; }
// }
//}

View File

@@ -1,143 +0,0 @@
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using Crestron.SimplSharpPro;
//using PepperDash.Essentials.Core;
//using PepperDash.Essentials.Core.Presets;
//using PepperDash.Core;
//namespace PepperDash.Essentials.Core
//{
// /// <summary>
// /// This DVD class should cover most IR, one-way DVD and Bluray fuctions
// /// </summary>
// public class IrSetTopBoxBase : Device, IHasCueActionList,
// IPresentationSource, IAttachVideoStatus, IHasFeedback, IRoutingOutputs, IHasSetTopBoxProperties
// {
// public PresentationSourceType Type { get; protected set; }
// public string IconName { get; set; }
// public BoolFeedback HasPowerOnFeedback { get; private set; }
// public IrOutputPortController IrPort { get; private set; }
// public DevicePresetsModel PresetsModel { get; private set; }
// #region IRoutingOutputs Members
// /// <summary>
// /// Options: hdmi
// /// </summary>
// public RoutingPortCollection<RoutingOutputPort> OutputPorts { get; private set; }
// #endregion
// public IrSetTopBoxBase(string key, string name, IROutputPort port, string irDriverFilepath)
// : base(key, name)
// {
// IrPort = new IrOutputPortController("ir-" + key, port, irDriverFilepath);
// Type = PresentationSourceType.SetTopBox;
// IconName = "TV";
// HasPowerOnFeedback = new BoolFeedback(CommonBoolCue.HasPowerFeedback, () => false);
// OutputPorts = new RoutingPortCollection<RoutingOutputPort>()
// {
// new RoutingOutputPort("HDMI", eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, 0, this)
// };
// }
// public void LoadPresets(string filePath)
// {
// //PresetsModel = new DevicePresetsModel(Key + "-presets", this, filePath);
// //DeviceManager.AddDevice(PresetsModel);
// }
// #region IDeviceWithOutputs Members
// public List<Feedback> Feedbacks
// {
// get { return this.GetVideoStatuses().ToList(); }
// }
// #endregion
// #region IFunctionList Members
// public List<CueActionPair> CueActionList
// {
// get
// {
// // This might be the best way to get the words back into functions
// new BoolCueActionPair(CommonBoolCue.Power, b => IrPort.PressRelease(IROutputStandardCommands.IROut_POWER, b));
// new BoolCueActionPair(CommonBoolCue.PowerOn, b => IrPort.PressRelease(IROutputStandardCommands.IROut_POWER_ON, b));
// new BoolCueActionPair(CommonBoolCue.PowerOff, b => IrPort.PressRelease(IROutputStandardCommands.IROut_POWER_OFF, b));
// new BoolCueActionPair(CommonBoolCue.ChannelUp, b => IrPort.PressRelease(IROutputStandardCommands.IROut_CH_PLUS, b));
// var numToIr = new Dictionary<Cue, string>
// {
// { CommonBoolCue.Power, IROutputStandardCommands.IROut_POWER },
// { CommonBoolCue.PowerOn, IROutputStandardCommands.IROut_POWER_ON },
// { CommonBoolCue.PowerOff, IROutputStandardCommands.IROut_POWER_OFF },
// { CommonBoolCue.ChannelUp, IROutputStandardCommands.IROut_CH_PLUS },
// { CommonBoolCue.ChannelDown, IROutputStandardCommands.IROut_CH_MINUS },
// { CommonBoolCue.Last, IROutputStandardCommands.IROut_LAST },
// { CommonBoolCue.Play, IROutputStandardCommands.IROut_PLAY },
// { CommonBoolCue.Pause, IROutputStandardCommands.IROut_PAUSE },
// { CommonBoolCue.Stop, IROutputStandardCommands.IROut_STOP },
// { CommonBoolCue.ChapPrevious, IROutputStandardCommands.IROut_TRACK_MINUS },
// { CommonBoolCue.ChapNext, IROutputStandardCommands.IROut_TRACK_PLUS },
// { CommonBoolCue.Rewind, IROutputStandardCommands.IROut_RSCAN },
// { CommonBoolCue.Ffwd, IROutputStandardCommands.IROut_FSCAN },
// { CommonBoolCue.Replay, IROutputStandardCommands.IROut_REPLAY },
// { CommonBoolCue.Advance, "ADVANCE" },
// { CommonBoolCue.Record, IROutputStandardCommands.IROut_RECORD },
// { CommonBoolCue.Exit, IROutputStandardCommands.IROut_EXIT },
// { CommonBoolCue.Menu, IROutputStandardCommands.IROut_MENU },
// { CommonBoolCue.List, IROutputStandardCommands.IROut_DVR },
// { CommonBoolCue.Dvr, IROutputStandardCommands.IROut_DVR },
// { CommonBoolCue.Back, IROutputStandardCommands.IROut_BACK },
// { CommonBoolCue.Up, IROutputStandardCommands.IROut_UP_ARROW },
// { CommonBoolCue.Down, IROutputStandardCommands.IROut_DN_ARROW },
// { CommonBoolCue.Left, IROutputStandardCommands.IROut_LEFT_ARROW },
// { CommonBoolCue.Right, IROutputStandardCommands.IROut_RIGHT_ARROW },
// { CommonBoolCue.Select, IROutputStandardCommands.IROut_ENTER },
// { CommonBoolCue.Guide, IROutputStandardCommands.IROut_GUIDE },
// { CommonBoolCue.PageUp, IROutputStandardCommands.IROut_PAGE_UP },
// { CommonBoolCue.PageDown, IROutputStandardCommands.IROut_PAGE_DOWN },
// { CommonBoolCue.Info, IROutputStandardCommands.IROut_INFO },
// { CommonBoolCue.Red, IROutputStandardCommands.IROut_RED },
// { CommonBoolCue.Green, IROutputStandardCommands.IROut_GREEN },
// { CommonBoolCue.Yellow, IROutputStandardCommands.IROut_YELLOW },
// { CommonBoolCue.Blue, IROutputStandardCommands.IROut_BLUE },
// { CommonBoolCue.Digit0, IROutputStandardCommands.IROut_0 },
// { CommonBoolCue.Digit1, IROutputStandardCommands.IROut_1 },
// { CommonBoolCue.Digit2, IROutputStandardCommands.IROut_2 },
// { CommonBoolCue.Digit3, IROutputStandardCommands.IROut_3 },
// { CommonBoolCue.Digit4, IROutputStandardCommands.IROut_4 },
// { CommonBoolCue.Digit5, IROutputStandardCommands.IROut_5 },
// { CommonBoolCue.Digit6, IROutputStandardCommands.IROut_6 },
// { CommonBoolCue.Digit7, IROutputStandardCommands.IROut_7 },
// { CommonBoolCue.Digit8, IROutputStandardCommands.IROut_8 },
// { CommonBoolCue.Digit9, IROutputStandardCommands.IROut_9 },
// { CommonBoolCue.Dash, "DASH" },
// };
// return IrPort.GetUOsForIrCommands(numToIr);
// }
// }
// #endregion
// #region IHasSetTopBoxProperties Members
// public bool HasDpad { get; set; }
// public bool HasPreset { get; set; }
// public bool HasDvr { get; set; }
// public bool HasNumbers { get; set; }
// #endregion
// }
//}

View File

@@ -1,220 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
namespace PepperDash.Essentials.Core
{
public abstract class Feedback
{
public event EventHandler<EventArgs> OutputChange;
public virtual bool BoolValue { get { return false; } }
public virtual int IntValue { get { return 0; } }
public virtual string StringValue { get { return ""; } }
public Cue Cue { get; private set; }
public abstract eCueType Type { get; }
protected Feedback()
{
}
protected Feedback(Cue cue)
{
Cue = cue;
}
public abstract void FireUpdate();
protected void OnOutputChange()
{
if (OutputChange != null) OutputChange(this, EventArgs.Empty);
}
}
/// <summary>
/// A Feedback whose output is derived from the return value of a provided Func.
/// </summary>
public class BoolFeedback : Feedback
{
/// <summary>
/// Returns the current value of the feedback, derived from the ValueFunc
/// </summary>
public override bool BoolValue { get { return _BoolValue; } }
bool _BoolValue;
public override eCueType Type { get { return eCueType.Bool; } }
public Func<bool> ValueFunc { get; private set; }
/// <summary>
/// The last value delivered on FireUpdate
/// </summary>
//public bool PreviousValue { get; private set; }
List<BoolInputSig> LinkedInputSigs = new List<BoolInputSig>();
List<BoolInputSig> LinkedComplementInputSigs = new List<BoolInputSig>();
public BoolFeedback(Func<bool> valueFunc)
: this(Cue.DefaultBoolCue, valueFunc)
{
}
public BoolFeedback(Cue cue, Func<bool> valueFunc)
: base(cue)
{
if (cue == null) throw new ArgumentNullException("cue");
ValueFunc = valueFunc;
}
public override void FireUpdate()
{
var newValue = ValueFunc.Invoke();
if (newValue != _BoolValue)
{
_BoolValue = newValue;
LinkedInputSigs.ForEach(s => UpdateSig(s));
LinkedComplementInputSigs.ForEach(s => UpdateComplementSig(s));
OnOutputChange();
}
}
public void LinkInputSig(BoolInputSig sig)
{
LinkedInputSigs.Add(sig);
UpdateSig(sig);
}
public void UnlinkInputSig(BoolInputSig sig)
{
LinkedInputSigs.Remove(sig);
}
public void LinkComplementInputSig(BoolInputSig sig)
{
LinkedComplementInputSigs.Add(sig);
UpdateComplementSig(sig);
}
public void UnlinkComplementInputSig(BoolInputSig sig)
{
LinkedComplementInputSigs.Remove(sig);
}
void UpdateSig(BoolInputSig sig)
{
sig.BoolValue = _BoolValue;
}
void UpdateComplementSig(BoolInputSig sig)
{
sig.BoolValue = !_BoolValue;
}
}
//******************************************************************************
public class IntFeedback : Feedback
{
public override int IntValue { get { return _IntValue; } } // ValueFunc.Invoke(); } }
int _IntValue;
public ushort UShortValue { get { return (ushort)_IntValue; } }
public override eCueType Type { get { return eCueType.Int; } }
//public int PreviousValue { get; private set; }
Func<int> ValueFunc;
List<UShortInputSig> LinkedInputSigs = new List<UShortInputSig>();
public IntFeedback(Func<int> valueFunc)
: this(Cue.DefaultIntCue, valueFunc)
{
}
public IntFeedback(Cue cue, Func<int> valueFunc)
: base(cue)
{
if (cue == null) throw new ArgumentNullException("cue");
ValueFunc = valueFunc;
}
public override void FireUpdate()
{
var newValue = ValueFunc.Invoke();
if (newValue != _IntValue)
{
_IntValue = newValue;
LinkedInputSigs.ForEach(s => UpdateSig(s));
OnOutputChange();
}
}
public void LinkInputSig(UShortInputSig sig)
{
LinkedInputSigs.Add(sig);
UpdateSig(sig);
}
public void UnlinkInputSig(UShortInputSig sig)
{
LinkedInputSigs.Remove(sig);
}
void UpdateSig(UShortInputSig sig)
{
sig.UShortValue = UShortValue;
}
}
//******************************************************************************
public class StringFeedback : Feedback
{
public override string StringValue { get { return _StringValue; } } // ValueFunc.Invoke(); } }
string _StringValue;
public override eCueType Type { get { return eCueType.String; } }
//public string PreviousValue { get; private set; }
public Func<string> ValueFunc { get; private set; }
List<StringInputSig> LinkedInputSigs = new List<StringInputSig>();
public StringFeedback(Func<string> valueFunc)
: this(Cue.DefaultStringCue, valueFunc)
{
}
public StringFeedback(Cue cue, Func<string> valueFunc)
: base(cue)
{
if (cue == null) throw new ArgumentNullException("cue");
ValueFunc = valueFunc;
}
public override void FireUpdate()
{
var newValue = ValueFunc.Invoke();
if (newValue != _StringValue)
{
_StringValue = newValue;
LinkedInputSigs.ForEach(s => UpdateSig(s));
OnOutputChange();
}
}
public void LinkInputSig(StringInputSig sig)
{
LinkedInputSigs.Add(sig);
UpdateSig(sig);
}
public void UnlinkInputSig(StringInputSig sig)
{
LinkedInputSigs.Remove(sig);
}
void UpdateSig(StringInputSig sig)
{
sig.StringValue = _StringValue;
}
}
}

View File

@@ -1,42 +0,0 @@
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronDataStore;
using Crestron.SimplSharpPro;
//using PepperDash.Essentials.Core.Http;
using PepperDash.Essentials.License;
namespace PepperDash.Essentials.Core
{
public static class Global
{
public static CrestronControlSystem ControlSystem { get; set; }
public static LicenseManager LicenseManager { get; set; }
//public static EssentialsHttpServer HttpConfigServer
//{
// get
// {
// if (_HttpConfigServer == null)
// _HttpConfigServer = new EssentialsHttpServer();
// return _HttpConfigServer;
// }
//}
//static EssentialsHttpServer _HttpConfigServer;
static Global()
{
// Fire up CrestronDataStoreStatic
var err = CrestronDataStoreStatic.InitCrestronDataStore();
if (err != CrestronDataStore.CDS_ERROR.CDS_SUCCESS)
{
CrestronConsole.PrintLine("Error starting CrestronDataStoreStatic: {0}", err);
return;
}
}
}
}

View File

@@ -1,8 +0,0 @@
using System.Reflection;
[assembly: AssemblyTitle("PepperDashEssentialsBase")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PepperDashEssentialsBase")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyVersion("1.0.0.*")]

View File

@@ -1,46 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
namespace PepperDash.Essentials.Core.Routing
{
/// <summary>
/// These should correspond directly with the portNames var in the config tool.
/// </summary>
public class RoutingPortNames
{
public const string AntennaIn = "antennaIn";
public const string AnyAudioIn = "anyAudioIn";
public const string AnyAudioOut = "anyAudioOut";
public const string AnyOut = "anyOut";
public const string AnyVideoIn = "anyVideoIn";
public const string AnyVideoOut = "anyVideoOut";
public const string BalancedAudioOut = "balancedAudioOut";
public const string ComponentIn = "componentIn";
public const string ComponentOut = "componentOut";
public const string CompositeIn = "compositeIn";
public const string CompositeOut = "compositeOut";
public const string DisplayPortIn = "displayPortIn";
public const string DisplayPortIn1 = "displayPortIn1";
public const string DisplayPortIn2 = "displayPortIn2";
public const string DisplayPortIn3 = "displayPortIn3";
public const string DisplayPortOut = "displayPortOut";
public const string DmIn = "dmIn";
public const string DmOut = "dmOut";
public const string DviIn = "dviIn";
public const string DviOut = "dviOut";
public const string HdmiIn = "hdmiIn";
public const string HdmiIn1 = "hdmiIn1";
public const string HdmiIn2 = "hdmiIn2";
public const string HdmiIn3 = "hdmiIn3";
public const string HdmiIn4 = "hdmiIn4";
public const string HdmiIn5 = "hdmiIn5";
public const string HdmiIn6 = "hdmiIn6";
public const string HdmiOut = "hdmiOut";
public const string RgbIn = "rgbIn";
public const string VgaIn = "vgaIn";
public const string VgaOut = "vgaOut";
}
}

View File

@@ -1,161 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using PepperDash.Core;
namespace PepperDash.Essentials.Core
{
/// <summary>
/// Helper class for various Sig events
/// </summary>
public class SigHelper
{
/// <summary>
/// Runs action when Sig is pressed
/// </summary>
/// <param name="sig"></param>
public static void Pressed(Sig sig, Action act) { if (sig.BoolValue) act(); }
/// <summary>
/// Runs action when Sig is released
/// </summary>
public static void Released(Sig sig, Action act) { if (!sig.BoolValue) act(); }
/// <summary>
/// Safely sets an action to non-null sig
/// </summary>
public static void SetBoolOutAction(BoolOutputSig sig, Action<bool> a)
{
if (sig != null)
sig.UserObject = a;
}
/// <summary>
/// Safely clears action of non-null sig.
/// </summary>
public static void ClearBoolOutAction(BoolOutputSig sig)
{
if (sig != null)
sig.UserObject = null;
}
/// <summary>
/// Does a timed ramp, where the time is scaled proportional to the
/// remaining range to cover
/// </summary>
/// <param name="sig">Ushort sig to scale</param>
/// <param name="newLevel">Level to go to</param>
/// <param name="time">In ms (not hundredths like Crestron Sig ramp function)</param>
public static void RampTimeScaled(Sig sig, ushort newLevel, uint time)
{
ushort level = sig.UShortValue;
int diff = Math.Abs(level - newLevel);
uint scaledTime = (uint)(diff * time / 65535);
Ramp(sig, newLevel, scaledTime);
}
/// <summary>
/// Ramps signal
/// </summary>
/// <param name="sig"></param>
/// <param name="level"></param>
/// <param name="time">In ms (not hundredths like Crestron Sig ramp function)</param>
public static void Ramp(Sig sig, ushort level, uint time)
{
sig.CreateRamp(level, time / 10);
}
}
/// <summary>
/// Attaches to UShortInputSig and does incremental ramping of the signal
/// </summary>
public class UshortSigIncrementer
{
UShortInputSig TheSig;
public ushort ChangeAmount { get; set; }
public int MaxValue { get; set; }
public int MinValue { get; set; }
public uint RepeatDelay { get; set; }
public uint RepeatTime { get; set; }
bool SignedMode;
CTimer Timer;
public UshortSigIncrementer(UShortInputSig sig, ushort changeAmount, int minValue, int maxValue, uint repeatDelay, uint repeatTime)
{
TheSig = sig;
ChangeAmount = changeAmount;
MaxValue = maxValue;
MinValue = minValue;
if (MinValue < 0 || MaxValue < 0) SignedMode = true;
RepeatDelay = repeatDelay;
RepeatTime = repeatTime;
if (SignedMode && (MinValue < -32768 || MaxValue > 32767))
Debug.Console(1, "UshortSigIncrementer has signed values that exceed range of -32768, 32767");
}
public void StartUp()
{
if (Timer != null) return;
Go(ChangeAmount);
}
public void StartDown()
{
if (Timer != null) return;
Go(-ChangeAmount);
}
void Go(int change)
{
int level;
if (SignedMode) level = TheSig.ShortValue;
else level = TheSig.UShortValue;
// Fire once then pause
int newLevel = level + change;
bool atLimit = CheckLevel(newLevel, out newLevel);
SetValue((ushort)newLevel);
if (atLimit) // Don't go past end
Stop();
else if (Timer == null) // Only enter the timer if it's not already running
Timer = new CTimer(o => { Go(change); }, null, RepeatDelay, RepeatTime);
}
bool CheckLevel(int levelIn, out int levelOut)
{
bool IsAtLimit = false;
if (levelIn > MaxValue)
{
levelOut = MaxValue;
IsAtLimit = true;
}
else if (levelIn < MinValue)
{
levelOut = MinValue;
IsAtLimit = true;
}
else
levelOut = levelIn;
return IsAtLimit;
}
public void Stop()
{
if (Timer != null)
Timer.Stop();
Timer = null;
}
void SetValue(ushort value)
{
//CrestronConsole.PrintLine("Increment level:{0} / {1}", value, (short)value);
TheSig.UShortValue = value;
}
}
}

View File

@@ -1,111 +0,0 @@
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using Crestron.SimplSharp;
//using Crestron.SimplSharpPro;
//using Crestron.SimplSharpPro.UI;
//namespace PepperDash.Essentials.Core
//{
// /// <summary>
// /// Controls the device/tech status list - links in to the first 10, 1, 5 statuses in an item's StatusProperties
// /// </summary>
// public class DeviceStatusListController : SubpageReferenceListController
// {
// Dictionary<uint, Device> Items = new Dictionary<uint, Device>();
// public DeviceStatusListController(SmartObject list)
// {
// TheList = new SubpageReferenceList(list, 10, 1, 5);
// }
// /// <summary>
// /// Attaches an item's StatusProperties to the list item.
// /// THIS METHOD MAY BE BETTER ABSORBED INTO SOME OTHER CONTROLLER CLASS AS A
// /// PSIG -> LIST ITEM ADAPTER
// /// </summary>
// /// <param name="index">List position</param>
// /// <param name="device"></param>
// public void AddItem(uint listIndex, Device device)
// {
// if (device == null) throw new ArgumentNullException("device");
// Items[listIndex] = device;
// // Feedback - read the status properties and if there is room for them on the list sigs
// // link them up.
// //foreach (PValue statusPsig in device.StatusProperties)
// //{
// // uint num = statusPsig.Number;
// // Sig listSig = null;
// // switch (statusPsig.Type) // Switch on the PSig type and whether the PSig number is within the increment range
// // {
// // case eSigType.Bool:
// // if (num > TheList.BoolIncrement) return;
// // listSig = TheList.BoolInputSig(listIndex, num); // Pull the appropriate list sig.
// // break;
// // case eSigType.String:
// // if (num > TheList.StringIncrement) return;
// // listSig = TheList.StringInputSig(listIndex, num);
// // break;
// // case eSigType.UShort:
// // if (num > TheList.UShortIncrement) return;
// // listSig = TheList.UShortInputSig(listIndex, num);
// // break;
// // default:
// // return;
// // }
// // if (listSig != null) // If we got a sig, plug it into the PSig for updates.
// // statusPsig.AddLinkedSig(listSig, true);
// //}
// // Press/other handlers - read the Commands and if there is room, add them as Sig handlers.
// //foreach (var id in device.Commands.Keys)
// //{
// // var pValueNumber = id.Number;
// // Sig listSig = null;
// // // Switch on type of a command and if it's in range, get it's list Sig.
// // switch (id.Type)
// // {
// // case eSigType.Bool:
// // if (pValueNumber > TheList.BoolIncrement) return;
// // listSig = TheList.BoolFeedbackSig(listIndex, pValueNumber);
// // break;
// // case eSigType.String:
// // if (pValueNumber > TheList.StringIncrement) return;
// // listSig = TheList.StringOutputSig(listIndex, pValueNumber);
// // break;
// // case eSigType.UShort:
// // if (pValueNumber > TheList.UShortIncrement) return;
// // listSig = TheList.UShortOutputSig(listIndex, pValueNumber);
// // break;
// // default:
// // return;
// // }
// // if (listSig != null) // If we got a sig, add the command to its ChangeAction
// // SigToAction.GetSigToActionUserObjectForSig(listSig).SigChangeAction += device.Commands[id];
// // // This will need to be undone when detached MAKE A HELPER!!!!
// //}
// // "Custom things" below
// // Set the name on sig 1 - just an assignment. Don't
// var nameSig = TheList.StringInputSig(listIndex, 1);
// if (nameSig != null)
// nameSig.StringValue = device.Key;
// // Map IsOnline bool to a 0 / 1 state analog icon
// // Add an action to the online PValue that maps to a ushort sig on the list POTENTIAL LEAK HERE IF
// // this isn't cleaned up on disconnect
// var onlineSig = TheList.UShortInputSig(listIndex, 1);
// //var onlinePValue = device.StatusProperties[Device.JoinIsOnline];
// //if (onlineSig != null && onlinePValue != null)
// // onlinePValue.AddChangeAction(pv => onlineSig.UShortValue = (ushort)(onlinePValue.BoolValue ? 1 : 0));
// // //OR onlinePValue.AddLinkedSig(onlineSig, true);
// // Set the list length based on largest key
// TheList.Count = (ushort)Items.Keys.DefaultIfEmpty().Max(); // The count will be the largest key or 0
// }
// }
//}

View File

@@ -1,112 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
namespace PepperDash.Essentials.Core
{
/// <summary>
/// Extensions used for more-clear attachment of Actions to user objects on sigs
/// </summary>
public static class SigAndTriListExtensions
{
/// <summary>
/// Attaches Action to Sig's user object and returns the same Sig.
/// </summary>
/// <param name="sig">The BoolOutputSig to attach the Action to</param>
/// <param name="a">An action to run when sig is pressed and when released</param>
/// <returns>The Sig, sig</returns>
public static BoolOutputSig SetBoolSigAction(this BoolOutputSig sig, Action<bool> a)
{
sig.UserObject = a;
return sig;
}
/// <summary>
/// Attaches Action to Sig's user object and returns the same Sig.
/// </summary>
/// <param name="tl"></param>
/// <param name="sigNum"></param>
/// <param name="a"></param>
/// <returns></returns>
public static BoolOutputSig SetBoolSigAction(this BasicTriList tl, uint sigNum, Action<bool> a)
{
return tl.BooleanOutput[sigNum].SetBoolSigAction(a);
}
public static BoolOutputSig SetSigTrueAction(this BasicTriList tl, uint sigNum, Action a)
{
return tl.BooleanOutput[sigNum].SetBoolSigAction(b => { if(b) a(); });
}
/// <summary>
/// Attaches a void Action to a TriList's output sig's UserObject, to be run on release
/// </summary>
/// <returns>The sig</returns>
public static BoolOutputSig SetSigFalseAction(this BasicTriList tl, uint sigNum, Action a)
{
return tl.BooleanOutput[sigNum].SetBoolSigAction(b => { if (!b) a(); });
}
/// <summary>
/// Attaches a void Action to an output sig's UserObject, to be run on release
/// </summary>
/// <returns>The Sig</returns>
public static BoolOutputSig SetSigFalseAction(this BoolOutputSig sig, Action a)
{
return sig.SetBoolSigAction(b => { if (!b) a(); });
}
/// <summary>
///
/// </summary>
/// <param name="sig"></param>
/// <param name="a"></param>
/// <returns>The Sig</returns>
public static UShortOutputSig SetUShortSigAction(this UShortOutputSig sig, Action<ushort> a)
{
sig.UserObject = a;
return sig;
}
public static UShortOutputSig SetUShortSigAction(this BasicTriList tl, uint sigNum, Action<ushort> a)
{
return tl.UShortOutput[sigNum].SetUShortSigAction(a);
}
public static StringOutputSig SetStringSigAction(this StringOutputSig sig, Action<string> a)
{
sig.UserObject = a;
return sig;
}
public static StringOutputSig SetStringSigAction(this BasicTriList tl, uint sigNum, Action<string> a)
{
return tl.SetStringSigAction(sigNum, a);
}
public static Sig ClearSigAction(this Sig sig)
{
sig.UserObject = null;
return sig;
}
public static BoolOutputSig ClearBoolSigAction(this BasicTriList tl, uint sigNum)
{
return ClearSigAction(tl.BooleanOutput[sigNum]) as BoolOutputSig;
}
public static UShortOutputSig ClearUShortSigAction(this BasicTriList tl, uint sigNum)
{
return ClearSigAction(tl.UShortOutput[sigNum]) as UShortOutputSig;
}
public static StringOutputSig ClearStringSigAction(this BasicTriList tl, uint sigNum)
{
return ClearSigAction(tl.StringOutput[sigNum]) as StringOutputSig;
}
}
}

View File

@@ -1,569 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DM;
using Crestron.SimplSharpPro.DM.Cards;
using Crestron.SimplSharpPro.DM.Endpoints;
using Crestron.SimplSharpPro.DM.Endpoints.Receivers;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.DM.Cards;
using PepperDash.Essentials.DM.Config;
namespace PepperDash.Essentials.DM
{
/// <summary>
/// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions
///
/// </summary>
public class DmChassisController : CrestronGenericBaseDevice, IRoutingInputsOutputs, IRouting//, ICardPortsDevice
{
public DmMDMnxn Chassis { get; private set; }
// Need a couple Lists of generic Backplane ports
public RoutingPortCollection<RoutingInputPort> InputPorts { get; private set; }
public RoutingPortCollection<RoutingOutputPort> OutputPorts { get; private set; }
//public Dictionary<uint, DmInputCardControllerBase> InputCards { get; private set; }
//public Dictionary<uint, DmSingleOutputCardControllerBase> OutputCards { get; private set; }
public Dictionary<uint, string> InputNames { get; set; }
public Dictionary<uint, string> OutputNames { get; set; }
public Dictionary<uint, DmCardAudioOutputController> VolumeControls { get; private set; }
public const int RouteOffTime = 500;
Dictionary<PortNumberType, CTimer> RouteOffTimers = new Dictionary<PortNumberType, CTimer>();
/// <summary>
/// Factory method to create a new chassis controller from config data. Limited to 8x8 right now
/// </summary>
public static DmChassisController GetDmChassisController(string key, string name,
string type, DMChassisPropertiesConfig properties)
{
try
{
type = type.ToLower();
uint ipid = properties.Control.IpIdInt; // Convert.ToUInt16(properties.Id, 16);
DmChassisController controller = null;
if (type == "dmmd8x8")
{
controller = new DmChassisController(key, name, new DmMd8x8(ipid, Global.ControlSystem));
// add the cards and port names
foreach (var kvp in properties.InputSlots)
controller.AddInputCard(kvp.Value, kvp.Key);
foreach (var kvp in properties.OutputSlots)
controller.AddOutputCard(kvp.Value, kvp.Key);
foreach (var kvp in properties.VolumeControls)
{
// get the card
// check it for an audio-compatible type
// make a something-something that will make it work
// retire to mountain village
var outNum = kvp.Key;
var card = controller.Chassis.Outputs[outNum].Card;
Audio.Output audio = null;
if (card is DmcHdo)
audio = (card as DmcHdo).Audio;
else if (card is Dmc4kHdo)
audio = (card as Dmc4kHdo).Audio;
if (audio == null)
continue;
// wire up the audio to something here...
controller.AddVolumeControl(outNum, audio);
}
controller.InputNames = properties.InputNames;
controller.OutputNames = properties.OutputNames;
return controller;
}
}
catch (System.Exception e)
{
Debug.Console(0, "Error creating DM chassis:\r{0}", e);
}
return null;
}
/// <summary>
///
/// </summary>
/// <param name="key"></param>
/// <param name="name"></param>
/// <param name="chassis"></param>
public DmChassisController(string key, string name, DmMDMnxn chassis)
: base(key, name, chassis)
{
Chassis = chassis;
InputPorts = new RoutingPortCollection<RoutingInputPort>();
OutputPorts = new RoutingPortCollection<RoutingOutputPort>();
VolumeControls = new Dictionary<uint, DmCardAudioOutputController>();
IsOnline.OutputChange += new EventHandler<EventArgs>(IsOnline_OutputChange);
Chassis.DMOutputChange += new DMOutputEventHandler(Chassis_DMOutputChange);
}
/// <summary>
///
/// </summary>
/// <param name="type"></param>
/// <param name="number"></param>
public void AddInputCard(string type, uint number)
{
Debug.Console(2, this, "Adding input card '{0}', slot {1}", type, number);
if (type == "dmc4kHd")
{
new Dmc4kHd(number, this.Chassis);
AddHdmiInCardPorts(number);
}
else if (type == "dmc4kHdDsp")
{
new Dmc4kHdDsp(number, this.Chassis);
AddHdmiInCardPorts(number);
}
else if (type == "dmc4kC")
{
new Dmc4kC(number, this.Chassis);
AddDmInCardPorts(number);
}
else if (type == "dmc4kCDsp")
{
new Dmc4kCDsp(number, this.Chassis);
AddDmInCardPorts(number);
}
else if (type == "dmcHd")
{
new DmcHd(number, this.Chassis);
AddHdmiInCardPorts(number);
}
else if (type == "dmcHdDsp")
{
new DmcHdDsp(number, this.Chassis);
AddHdmiInCardPorts(number);
}
else if (type == "dmcC")
{
new DmcC(number, this.Chassis);
AddDmInCardPorts(number);
}
else if (type == "dmcCDsp")
{
new DmcCDsp(number, this.Chassis);
AddDmInCardPorts(number);
}
else if (type == "dmcS")
{
new DmcS(number, Chassis);
AddInputPortWithDebug(number, "dmIn", eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.DmMmFiber);
AddInCardLoopPorts(number);
}
else if (type == "dmcSDsp")
{
new DmcSDsp(number, Chassis);
AddInputPortWithDebug(number, "dmIn", eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.DmMmFiber);
AddInCardLoopPorts(number);
}
else if (type == "dmcS2")
{
new DmcS2(number, Chassis);
AddInputPortWithDebug(number, "dmIn", eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.DmSmFiber);
AddInCardLoopPorts(number);
}
else if (type == "dmcS2Dsp")
{
new DmcS2Dsp(number, Chassis);
AddInputPortWithDebug(number, "dmIn", eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.DmSmFiber);
AddInCardLoopPorts(number);
}
else if (type == "dmcSdi")
{
new DmcSdi(number, Chassis);
AddInputPortWithDebug(number, "sdiIn", eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Sdi);
AddOutputPortWithDebug(number, "sdiOut", eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Sdi, null);
AddInCardLoopPorts(number);
}
}
void AddDmInCardPorts(uint number)
{
AddInputPortWithDebug(number, "dmIn", eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.DmCat);
AddInCardLoopPorts(number);
}
void AddHdmiInCardPorts(uint number)
{
AddInputPortWithDebug(number, "hdmiIn", eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi);
AddInCardLoopPorts(number);
}
void AddInCardLoopPorts(uint number)
{
AddOutputPortWithDebug(number, "hdmiLoopOut", eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, null);
AddOutputPortWithDebug(number, "audioLoopOut", eRoutingSignalType.Audio, eRoutingPortConnectionType.Hdmi, null);
}
/// <summary>
///
/// </summary>
/// <param name="type"></param>
/// <param name="number"></param>
public void AddOutputCard(string type, uint number)
{
Debug.Console(2, this, "Adding output card '{0}', slot {1}", type, number);
if (type == "dmc4kHdo")
{
new Dmc4kHdoSingle(number, Chassis);
AddDmcHdoPorts(number);
}
else if (type == "dmcHdo")
{
new DmcHdoSingle(number, Chassis);
AddDmcHdoPorts(number);
}
else if (type == "dmc4kCoHd")
{
new Dmc4kCoHdSingle(number, Chassis);
AddDmcCoPorts(number);
}
else if (type == "dmcCoHd")
{
new DmcCoHdSingle(number, Chassis);
AddDmcCoPorts(number);
}
else if (type == "dmcSoHd")
{
new DmcSoHdSingle(number, Chassis);
AddOutputPortWithDebug(number, "dmOut1", eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.DmMmFiber, 2 * (number - 1) + 1);
AddOutputPortWithDebug(number, "hdmiOut1", eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, 2 * (number - 1) + 1);
AddOutputPortWithDebug(number, "dmOut2", eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.DmMmFiber, 2 * (number - 1) + 2);
}
else if (type == "dmcS2oHd")
{
new DmcS2oHdSingle(number, Chassis);
AddOutputPortWithDebug(number, "dmOut1", eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.DmSmFiber, 2 * (number - 1) + 1);
AddOutputPortWithDebug(number, "hdmiOut1", eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, 2 * (number - 1) + 1);
AddOutputPortWithDebug(number, "dmOut2", eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.DmSmFiber, 2 * (number - 1) + 2);
}
else
Debug.Console(1, this, " WARNING: Output card type '{0}' is not available", type);
}
void AddDmcHdoPorts(uint number)
{
AddOutputPortWithDebug(number, "hdmiOut1", eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, 2 * (number - 1) + 1);
AddOutputPortWithDebug(number, "audioOut1", eRoutingSignalType.Audio, eRoutingPortConnectionType.LineAudio, 2 * (number - 1) + 1);
AddOutputPortWithDebug(number, "hdmiOut2", eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, 2 * (number - 1) + 2);
AddOutputPortWithDebug(number, "audioOut2", eRoutingSignalType.Audio, eRoutingPortConnectionType.LineAudio, 2 * (number - 1) + 2);
}
void AddDmcCoPorts(uint number)
{
AddOutputPortWithDebug(number, "dmOut1", eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.DmCat, 2 * (number - 1) + 1);
AddOutputPortWithDebug(number, "hdmiOut1", eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, 2 * (number - 1) + 1);
AddOutputPortWithDebug(number, "dmOut2", eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.DmCat, 2 * (number - 1) + 2);
}
/// <summary>
///
/// </summary>
void AddInputPortWithDebug(uint cardNum, string portName, eRoutingSignalType sigType, eRoutingPortConnectionType portType)
{
Debug.Console(2, this, " Adding input port '{0}'", portName);
InputPorts.Add(new RoutingInputPort(string.Format("card{0}--{1}", cardNum, portName),
sigType, portType, cardNum, this));
}
/// <summary>
///
/// </summary>
void AddOutputPortWithDebug(uint cardNum, string portName, eRoutingSignalType sigType, eRoutingPortConnectionType portType, object selector)
{
Debug.Console(2, this, " Adding output port '{0}'", portName);
OutputPorts.Add(new RoutingOutputPort(string.Format("card{0}--{1}", cardNum, portName),
sigType, portType, selector, this));
}
/// <summary>
///
/// </summary>
void AddVolumeControl(uint number, Audio.Output audio)
{
VolumeControls.Add(number, new DmCardAudioOutputController(audio));
}
/// <summary>
///
/// </summary>
void Chassis_DMOutputChange(Switch device, DMOutputEventArgs args)
{
if (args.EventId == DMOutputEventIds.VolumeEventId &&
VolumeControls.ContainsKey(args.Number))
VolumeControls[args.Number].VolumeEventFromChassis();
}
/// <summary>
///
/// </summary>
/// <param name="pnt"></param>
void StartOffTimer(PortNumberType pnt)
{
if (RouteOffTimers.ContainsKey(pnt))
return;
RouteOffTimers[pnt] = new CTimer(o =>
{
ExecuteSwitch(0, pnt.Number, pnt.Type);
}, RouteOffTime);
}
// Send out sigs when coming online
void IsOnline_OutputChange(object sender, EventArgs e)
{
if (IsOnline.BoolValue)
{
if (InputNames != null)
foreach (var kvp in InputNames)
Chassis.Inputs[kvp.Key].Name.StringValue = kvp.Value;
if (OutputNames != null)
foreach(var kvp in OutputNames)
Chassis.Outputs[kvp.Key].Name.StringValue = kvp.Value;
}
}
#region IRouting Members
public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType sigType)
{
Debug.Console(0, this, "Making an awesome DM route from {0} to {1} {2}", inputSelector, outputSelector, sigType);
var input = Convert.ToUInt32(inputSelector); // Cast can sometimes fail
var output = Convert.ToUInt32(outputSelector);
// Check to see if there's an off timer waiting on this and if so, cancel
var key = new PortNumberType(output, sigType);
if (input == 0)
{
StartOffTimer(key);
}
else
{
if(RouteOffTimers.ContainsKey(key))
{
Debug.Console(2, this, "{0} cancelling route off due to new source", output);
RouteOffTimers[key].Stop();
RouteOffTimers.Remove(key);
}
}
Card.DMICard inCard = input == 0 ? null : Chassis.Inputs[input];
// NOTE THAT THESE ARE NOTS - TO CATCH THE AudioVideo TYPE
if (sigType != eRoutingSignalType.Audio)
{
Chassis.VideoEnter.BoolValue = true;
Chassis.Outputs[output].VideoOut = inCard;
}
if (sigType != eRoutingSignalType.Video)
{
Chassis.AudioEnter.BoolValue = true;
Chassis.Outputs[output].AudioOut = inCard;
}
}
#endregion
// void AddInUseTrackerToPort(RoutingOutputPort port, eRoutingSignalType sigType)
// {
// port.InUseTracker.InUseFeedback.OutputChange += (o, a) =>
// {
//#warning Can we add something here that will de-route based on breakaway, or does it even matter?
// if (!port.InUseTracker.InUseFeedback.BoolValue)
// this.ExecuteSwitch(0, port.Selector, sigType);
// };
// }
//[Obsolete]
//public void AddInputCard(uint slot, eDmInputCardType type)
//{
// var cardKey = Key + "-inputCard" + slot;
// switch (type)
// {
// case eDmInputCardType.Dmc4kHd:
// InputCards[slot] = new Dmc4kHdController(cardKey,
// new Dmc4kHd(slot, this.Chassis), slot);
// break;
// case eDmInputCardType.Dmc4kHdDsp:
// InputCards[slot] = new Dmc4kHdDspController(cardKey,
// new Dmc4kHdDsp(slot, this.Chassis), slot);
// break;
// case eDmInputCardType.Dmc4kC:
// InputCards[slot] = new Dmc4kCController(cardKey,
// new Dmc4kC(slot, this.Chassis), slot);
// break;
// case eDmInputCardType.Dmc4kCDsp:
// InputCards[slot] = new Dmc4kCDspController(cardKey,
// new Dmc4kCDsp(slot, this.Chassis), slot);
// break;
// }
//}
//[Obsolete]
//public void AddOutputCard(uint cardSlot, eDmOutputCardType type)
//{
// var cardKey = Key + "-outputCard" + cardSlot;
// switch (type)
// {
// case eDmOutputCardType.Dmc4kCoHd:
// OutputCards[cardSlot] = new Dmc4kCoHdSingleOutputCard(cardKey,
// new Dmc4kCoHdSingle(cardSlot, this.Chassis), cardSlot);
// break;
// case eDmOutputCardType.DmcCoHd:
// OutputCards[cardSlot] = new Dmc4kHdoSingleOutputCard(cardKey,
// new Dmc4kHdoSingle(cardSlot, this.Chassis), cardSlot);
// break;
// default:
// break;
// }
//}
///// <summary>
///// Helper to get a specific port from a given attached card
///// </summary>
///// <param name="card">Named 'input-N' ('output-N' is not valid, as output cards have no inputs)</param>
///// <param name="port">The port name on the card, for example 'hdmiOut'</param>
///// <returns>Returns port or null if doesn't exist</returns>
//public RoutingInputPort GetChildInputPort(string card, string port)
//{
// return GetChildPort(card, port, false) as RoutingInputPort;
//}
///// <summary>
///// Helper to get a specific port from a given attached card
///// </summary>
///// <param name="card">Named 'input-N' or 'output-N'</param>
///// <param name="port">The port name on the card, for example 'hdmiOut'</param>
///// <returns>Returns port or null if doesn't exist</returns>
//public RoutingOutputPort GetChildOutputPort(string card, string port)
//{
// return GetChildPort(card, port, true) as RoutingOutputPort;
//}
///// <summary>
///// Helper for above methods
///// </summary>
//RoutingPort GetChildPort(string cardKey, string portKey, bool portIsOutput)
//{
// var cardTokens = cardKey.Split('-');
// if (cardTokens.Length != 2)
// {
// Debug.Console(0, this, "WARNING: GetChildPort cannot get port. Card parameter must be 'input-N' or 'output-N'");
// return null;
// }
// try
// {
// uint slotNum = Convert.ToUInt32(cardTokens[1]);
// var cardType = cardTokens[0].ToLower();
// if (cardType == "input" && InputCards.ContainsKey(slotNum))
// {
// var card = InputCards[slotNum];
// if (portIsOutput)
// return card.GetOutputPort(portKey);
// else
// return card.GetInputPort(portKey);
// }
// if (cardType == "output" && OutputCards.ContainsKey(slotNum))
// {
// var card = OutputCards[slotNum];
// return card.GetOutputPort(portKey);
// }
// }
// catch (Exception)
// {
// Debug.Console(0, this, "WARNING: GetChildPort cannot get port. Only integer card numbers are valid.");
// }
// return null;
//}
//public override bool CustomActivate()
//{
// var tlc = TieLineCollection.Default;
// // Take all cards and TieLine them together with the internal ports
// for (uint i = 1; i <= Chassis.NumberOfInputs; i++)
// {
// // If there's a matching input card for a given input number...
// // This test *shouldn't* be necessary if data is consistent
// if (InputCards.ContainsKey(i))
// {
// // Get the ports to link
// var cardAudio = InputCards[i].BackplaneAudioOut;
// var chassisAudio = InputPorts.FirstOrDefault(p =>
// (uint)p.Selector == i && p.Type == eRoutingSignalType.Audio);
// if (chassisAudio != null)
// tlc.Add(new TieLine(cardAudio, chassisAudio));
// else
// Debug.Console(0, this, Debug.ErrorLogLevel.Warning,
// "Backplane audio tie line creation for input card {0} failed", i);
// // Repeat for video link
// var cardVideo = InputCards[i].BackplaneVideoOut;
// var chassisVideo = InputPorts.FirstOrDefault(p =>
// (uint)p.Selector == i && p.Type == eRoutingSignalType.Video);
// if (cardVideo != null)
// tlc.Add(new TieLine(cardVideo, chassisVideo));
// else
// Debug.Console(0, this, Debug.ErrorLogLevel.Warning,
// "Backplane video tie line creation for input card {0} failed", i);
// }
// }
// // Loop through outputs and do it again - in pairs, because FYC
// for (uint i = 1; i <= Chassis.NumberOfOutputs / 2; i += 1)
// {
// if (OutputCards.ContainsKey(i))
// {
// //Debug.Console(0, this, "Adding internal TieLines on output card {0}", OutputCards[i].Key);
// // Left side of card
// uint a = i * 2 - 1;
// tlc.Add(new TieLine(
// OutputPorts.First(p => (uint)p.Selector == a && p.Type == eRoutingSignalType.Audio),
// OutputCards[i].BackplaneAudioIn1));
// tlc.Add(new TieLine(
// OutputPorts.First(p => (uint)p.Selector == a && p.Type == eRoutingSignalType.Video),
// OutputCards[i].BackplaneVideoIn1));
// // Right side of card
// uint b = i * 2;
// tlc.Add(new TieLine(
// OutputPorts.First(p => (uint)p.Selector == b && p.Type == eRoutingSignalType.Audio),
// OutputCards[i].BackplaneAudioIn2));
// tlc.Add(new TieLine(
// OutputPorts.First(p => (uint)p.Selector == b && p.Type == eRoutingSignalType.Video),
// OutputCards[i].BackplaneVideoIn2));
// }
// }
// // Base does register and sets up comm monitoring.
// return base.CustomActivate();
//}
}
public struct PortNumberType
{
public uint Number { get; private set; }
public eRoutingSignalType Type { get; private set; }
public PortNumberType(uint number, eRoutingSignalType type) : this()
{
Number = number;
Type = type;
}
}
}

View File

@@ -1,138 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DM;
using Crestron.SimplSharpPro.DM.Endpoints;
using Crestron.SimplSharpPro.DM.Endpoints.Receivers;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.DM.Config;
namespace PepperDash.Essentials.DM
{
public abstract class DmRmcControllerBase : CrestronGenericBaseDevice
{
public DmRmcControllerBase(string key, string name, EndpointReceiverBase device)
: base(key, name, device)
{ }
}
public class DmRmcHelper
{
/// <summary>
/// A factory method for various DmTxControllers
/// </summary>
/// <param name="key"></param>
/// <param name="name"></param>
/// <param name="props"></param>
/// <returns></returns>
public static DmRmcControllerBase GetDmRmcController(string key, string name, string typeName, DmRmcPropertiesConfig props)
{
// switch on type name... later...
typeName = typeName.ToLower();
uint ipid = props.Control.IpIdInt; // Convert.ToUInt16(props.Id, 16);
// right here, we need to grab the tie line that associates this
// RMC with a chassis or processor. If the RMC input's tie line is not
// connected to a chassis, then it's parent is the processor.
// If the RMC is connected to a chassis, then we need to grab the
// output number from the tie line and use that to plug it in.
// Example of chassis-connected:
//{
// "sourceKey": "dmMd8x8-1",
// "sourcePort": "anyOut2",
// "destinationKey": "dmRmc100C-2",
// "destinationPort": "DmIn"
//}
// Tx -> RMC link:
//{
// "sourceKey": "dmTx201C-1",
// "sourcePort": "DmOut",
// "destinationKey": "dmRmc100C-2",
// "destinationPort": "DmIn"
//}
var tlc = TieLineCollection.Default;
// grab the tie line that has this key as
// THIS DOESN'T WORK BECAUSE THE RMC THAT WE NEED (THIS) HASN'T BEEN MADE
// YET AND THUS WILL NOT HAVE A TIE LINE...
var inputTieLine = tlc.FirstOrDefault(t =>
{
var d = t.DestinationPort.ParentDevice;
return d.Key.Equals(key, StringComparison.OrdinalIgnoreCase)
&& d is DmChassisController;
});
var pKey = props.ParentDeviceKey.ToLower();
// Non-DM-chassis endpoints
if (pKey == "processor")
{
// Catch constructor failures, mainly dues to IPID
try
{
if (typeName.StartsWith("dmrmc100c"))
return new DmRmc100CController(key, name, new DmRmc100C(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmrmcscalerc"))
return new DmRmcScalerCController(key, name, new DmRmcScalerC(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmrmc4kscalerc"))
return new DmRmc4kScalerCController(key, name, new DmRmc4kScalerC(ipid, Global.ControlSystem));
}
catch (Exception e)
{
Debug.Console(0, "[{0}] WARNING: Cannot create DM-RMC device: {1}", key, e.Message);
}
Debug.Console(0, "Cannot create DM-RMC of type: '{0}'", typeName);
}
// Endpoints attached to DM Chassis
else
{
var parentDev = DeviceManager.GetDeviceForKey(pKey);
if (!(parentDev is DmChassisController))
{
Debug.Console(0, "Cannot create DM device '{0}'. '{1}' is not a DM Chassis.",
key, pKey);
return null;
}
var chassis = (parentDev as DmChassisController).Chassis;
var num = props.ParentOutputNumber;
if (num <= 0 || num > chassis.NumberOfOutputs)
{
Debug.Console(0, "Cannot create DM device '{0}'. Output number '{1}' is out of range",
key, num);
return null;
}
try
{
if (typeName.StartsWith("dmrmc100c"))
return new DmRmc100CController(key, name, new DmRmc100C(ipid, chassis.Outputs[num]));
if (typeName.StartsWith("dmrmcscalerc"))
return new DmRmcScalerCController(key, name, new DmRmcScalerC(ipid, chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc4kscalerc"))
return new DmRmc4kScalerCController(key, name, new DmRmc4kScalerC(ipid, chassis.Outputs[num]));
}
catch (Exception e)
{
Debug.Console(0, "[{0}] WARNING: Cannot create DM-RMC device: {1}", key, e.Message);
}
}
return null;
}
}
}

View File

@@ -1,73 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DM;
using Crestron.SimplSharpPro.DM.Endpoints;
using Crestron.SimplSharpPro.DM.Endpoints.Receivers;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.DM
{
/// <summary>
/// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions
///
/// </summary>
public class DmRmcScalerCController : DmRmcControllerBase, IRoutingInputsOutputs,
IIROutputPorts, IComPorts, ICec
{
public DmRmcScalerC Rmc { get; private set; }
public RoutingInputPort DmIn { get; private set; }
public RoutingOutputPort HdmiOut { get; private set; }
public RoutingPortCollection<RoutingInputPort> InputPorts
{
get { return new RoutingPortCollection<RoutingInputPort> { DmIn }; }
}
public RoutingPortCollection<RoutingOutputPort> OutputPorts
{
get { return new RoutingPortCollection<RoutingOutputPort> { HdmiOut }; }
}
/// <summary>
/// Make a Crestron RMC and put it in here
/// </summary>
public DmRmcScalerCController(string key, string name, DmRmcScalerC rmc)
: base(key, name, rmc)
{
Rmc = rmc;
DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.AudioVideo,
eRoutingPortConnectionType.DmCat, 0, this);
HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.AudioVideo,
eRoutingPortConnectionType.Hdmi, null, this);
}
public override bool CustomActivate()
{
// Base does register and sets up comm monitoring.
return base.CustomActivate();
}
#region IIROutputPorts Members
public CrestronCollection<IROutputPort> IROutputPorts { get { return Rmc.IROutputPorts; } }
public int NumberOfIROutputPorts { get { return Rmc.NumberOfIROutputPorts; } }
#endregion
#region IComPorts Members
public CrestronCollection<ComPort> ComPorts { get { return Rmc.ComPorts; } }
public int NumberOfComPorts { get { return Rmc.NumberOfComPorts; } }
#endregion
#region ICec Members
/// <summary>
/// Gets the CEC stream directly from the HDMI port.
/// </summary>
public Cec StreamCec { get { return Rmc.HdmiOutput.StreamCec; } }
#endregion
}
}

View File

@@ -1,196 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DM;
using Crestron.SimplSharpPro.DM.Endpoints;
using Crestron.SimplSharpPro.DM.Endpoints.Transmitters;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.DM.Config;
namespace PepperDash.Essentials.DM
{
public class DmTx201SBasicController : DmTxControllerBase, IRoutingInputsOutputs, IHasFeedback
{
public DmTx201S Tx { get; private set; }
public RoutingInputPortWithVideoStatuses AnyVideoInput { get; private set; }
public RoutingInputPortWithVideoStatuses HdmiInput { get; private set; }
public RoutingInputPortWithVideoStatuses VgaInput { get; private set; }
public RoutingOutputPort DmOutput { get; private set; }
public StringFeedback ActiveVideoInputFeedback { get; private set; }
/// <summary>
/// Helps get the "real" inputs, including when in Auto
/// </summary>
public DmTx200Base.eSourceSelection ActualVideoInput
{
get
{
if (Tx.VideoSourceFeedback == DmTx200Base.eSourceSelection.Digital ||
Tx.VideoSourceFeedback == DmTx200Base.eSourceSelection.Analog ||
Tx.VideoSourceFeedback == DmTx200Base.eSourceSelection.Disable)
return Tx.VideoSourceFeedback;
else // auto
{
if (Tx.HdmiInput.SyncDetectedFeedback.BoolValue)
return DmTx200Base.eSourceSelection.Digital;
else if (Tx.VgaInput.SyncDetectedFeedback.BoolValue)
return DmTx200Base.eSourceSelection.Analog;
else
return DmTx200Base.eSourceSelection.Disable;
}
}
}
public RoutingPortCollection<RoutingInputPort> InputPorts
{
get
{
return new RoutingPortCollection<RoutingInputPort>
{
HdmiInput,
VgaInput,
AnyVideoInput
};
}
}
public RoutingPortCollection<RoutingOutputPort> OutputPorts
{
get
{
return new RoutingPortCollection<RoutingOutputPort> { DmOutput };
}
}
/// <summary>
///
/// </summary>
/// <param name="key"></param>
/// <param name="name"></param>
/// <param name="tx"></param>
public DmTx201SBasicController(string key, string name, DmTx201S tx)
: base(key, name, tx)
{
Tx = tx;
//Can this be combined into helper somehow??
var combinedFuncs = new VideoStatusFuncsWrapper
{
HdcpActiveFeedbackFunc = () =>
ActualVideoInput == DmTx200Base.eSourceSelection.Digital
&& tx.HdmiInput.VideoAttributes.HdcpActiveFeedback.BoolValue,
HdcpStateFeedbackFunc = () =>
ActualVideoInput == DmTx200Base.eSourceSelection.Digital
? tx.HdmiInput.VideoAttributes.HdcpStateFeedback.ToString()
: "",
VideoResolutionFeedbackFunc = () =>
ActualVideoInput == DmTx200Base.eSourceSelection.Digital
? Tx.HdmiInput.VideoAttributes.GetVideoResolutionString()
: Tx.VgaInput.VideoAttributes.GetVideoResolutionString(),
VideoSyncFeedbackFunc = () =>
ActualVideoInput == DmTx200Base.eSourceSelection.Digital
? HdmiInput.VideoStatus.VideoSyncFeedback.BoolValue
: VgaInput.VideoStatus.VideoSyncFeedback.BoolValue
};
HdmiInput = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn,
eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, 1, this,
VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInput));
VgaInput = new RoutingInputPortWithVideoStatuses(DmPortName.VgaIn,
eRoutingSignalType.Video, eRoutingPortConnectionType.Vga, 2, this,
VideoStatusHelper.GetVgaInputStatusFuncs(tx.VgaInput));
AnyVideoInput = new RoutingInputPortWithVideoStatuses(DmPortName.AnyVideoIn,
eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.None, 0, this, combinedFuncs);
DmOutput = new RoutingOutputPort(DmPortName.DmOut, eRoutingSignalType.AudioVideo,
eRoutingPortConnectionType.DmCat, null, this);
ActiveVideoInputFeedback = new StringFeedback(new Cue("ActiveVideoInput", 0, eCueType.String),
() => ActualVideoInput.ToString());
}
public override bool CustomActivate()
{
Tx.HdmiInput.InputStreamChange += (o, a) => FireInputStreamChange(HdmiInput, a.EventId);
Tx.HdmiInput.VideoAttributes.AttributeChange += (o, a) => FireVideoAttributeChange(HdmiInput, a.EventId);
Tx.VgaInput.InputStreamChange += (o, a) => FireInputStreamChange(VgaInput, a.EventId);
Tx.VgaInput.VideoAttributes.AttributeChange += (o, a) => FireVideoAttributeChange(VgaInput, a.EventId);
// Base does register and sets up comm monitoring.
return base.CustomActivate();
}
void Tx_BaseEvent(GenericBase device, BaseEventArgs args)
{
var id = args.EventId;
if (id == DmTx201S.VideoSourceFeedbackEventID)
{
Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback);
}
// ------------------------------ incomplete -----------------------------------------
else if (id == DmTx201S.AudioSourceFeedbackEventID)
{
Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback);
}
}
/// <summary>
/// Relays the input stream change to the appropriate RoutingInputPort.
/// </summary>
void FireInputStreamChange(RoutingInputPortWithVideoStatuses inputPort, int eventId)
{
if (eventId == EndpointInputStreamEventIds.SyncDetectedFeedbackEventId)
{
inputPort.VideoStatus.VideoSyncFeedback.FireUpdate();
AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate();
}
}
/// <summary>
/// Relays the VideoAttributes change to a RoutingInputPort
/// </summary>
void FireVideoAttributeChange(RoutingInputPortWithVideoStatuses inputPort, int eventId)
{
//// LOCATION: Crestron.SimplSharpPro.DM.VideoAttributeEventIds
//Debug.Console(2, this, "VideoAttributes_AttributeChange event id={0} from {1}",
// args.EventId, (sender as VideoAttributesEnhanced).Owner.GetType());
switch (eventId)
{
case VideoAttributeEventIds.HdcpActiveFeedbackEventId:
inputPort.VideoStatus.HdcpActiveFeedback.FireUpdate();
AnyVideoInput.VideoStatus.HdcpActiveFeedback.FireUpdate();
break;
case VideoAttributeEventIds.HdcpStateFeedbackEventId:
inputPort.VideoStatus.HdcpStateFeedback.FireUpdate();
AnyVideoInput.VideoStatus.HdcpStateFeedback.FireUpdate();
break;
case VideoAttributeEventIds.HorizontalResolutionFeedbackEventId:
case VideoAttributeEventIds.VerticalResolutionFeedbackEventId:
inputPort.VideoStatus.VideoResolutionFeedback.FireUpdate();
AnyVideoInput.VideoStatus.VideoResolutionFeedback.FireUpdate();
break;
}
}
public override List<Feedback> Feedbacks
{
get
{
List<Feedback> list = AnyVideoInput.VideoStatus.ToList();
list.AddRange(base.Feedbacks);
list.Add(ActiveVideoInputFeedback);
return list;
}
}
}
}

View File

@@ -1,237 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
//using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.DM;
using Crestron.SimplSharpPro.DM.Endpoints;
using Crestron.SimplSharpPro.DM.Endpoints.Transmitters;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.DM.Config;
namespace PepperDash.Essentials.DM
{
using eVst = Crestron.SimplSharpPro.DeviceSupport.eX02VideoSourceType;
public class DmTx4k302CController : DmTxControllerBase, IRoutingInputsOutputs, IHasFeedback,
IIROutputPorts, IComPorts
{
public DmTx4k302C Tx { get; private set; }
public RoutingInputPortWithVideoStatuses AnyVideoInput { get; private set; }
public RoutingInputPortWithVideoStatuses HdmiIn1 { get; private set; }
public RoutingInputPortWithVideoStatuses HdmiIn2 { get; private set; }
public RoutingInputPortWithVideoStatuses VgaIn { get; private set; }
public RoutingOutputPort DmOut { get; private set; }
public RoutingOutputPort HdmiLoopOut { get; private set; }
public StringFeedback ActiveVideoInputFeedback { get; private set; }
/// <summary>
/// Helps get the "real" inputs, including when in Auto
/// </summary>
public Crestron.SimplSharpPro.DeviceSupport.eX02VideoSourceType ActualActiveVideoInput
{
get
{
if (Tx.VideoSourceFeedback != eVst.Auto)
return Tx.VideoSourceFeedback;
else // auto
{
if (Tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue)
return eVst.Hdmi1;
else if (Tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue)
return eVst.Hdmi2;
else if (Tx.VgaInput.SyncDetectedFeedback.BoolValue)
return eVst.Vga;
else
return eVst.AllDisabled;
}
}
}
public RoutingPortCollection<RoutingInputPort> InputPorts
{
get
{
return new RoutingPortCollection<RoutingInputPort>
{
HdmiIn1,
HdmiIn2,
VgaIn,
AnyVideoInput
};
}
}
public RoutingPortCollection<RoutingOutputPort> OutputPorts
{
get
{
return new RoutingPortCollection<RoutingOutputPort> { DmOut, HdmiLoopOut };
}
}
/// <summary>
///
/// </summary>
/// <param name="key"></param>
/// <param name="name"></param>
/// <param name="tx"></param>
public DmTx4k302CController(string key, string name, DmTx4k302C tx)
: base(key, name, tx)
{
Tx = tx;
HdmiIn1 = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn1,
eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, 1, this,
VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInputs[1]));
HdmiIn2 = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn2,
eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, 2, this,
VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInputs[2]));
VgaIn = new RoutingInputPortWithVideoStatuses(DmPortName.VgaIn,
eRoutingSignalType.Video, eRoutingPortConnectionType.Vga, 3, this,
VideoStatusHelper.GetVgaInputStatusFuncs(tx.VgaInput));
ActiveVideoInputFeedback = new StringFeedback(new Cue("ActiveVideoInput", 0, eCueType.String),
() => ActualActiveVideoInput.ToString());
var combinedFuncs = new VideoStatusFuncsWrapper
{
HdcpActiveFeedbackFunc = () =>
(ActualActiveVideoInput == eVst.Hdmi1
&& tx.HdmiInputs[1].VideoAttributes.HdcpActiveFeedback.BoolValue)
|| (ActualActiveVideoInput == eVst.Hdmi2
&& tx.HdmiInputs[2].VideoAttributes.HdcpActiveFeedback.BoolValue),
HdcpStateFeedbackFunc = () =>
{
if (ActualActiveVideoInput == eVst.Hdmi1)
return tx.HdmiInputs[1].VideoAttributes.HdcpStateFeedback.ToString();
if (ActualActiveVideoInput == eVst.Hdmi2)
return tx.HdmiInputs[2].VideoAttributes.HdcpStateFeedback.ToString();
return "";
},
VideoResolutionFeedbackFunc = () =>
{
if (ActualActiveVideoInput == eVst.Hdmi1)
return tx.HdmiInputs[1].VideoAttributes.GetVideoResolutionString();
if (ActualActiveVideoInput == eVst.Hdmi2)
return tx.HdmiInputs[2].VideoAttributes.GetVideoResolutionString();
if (ActualActiveVideoInput == eVst.Vga)
return tx.VgaInput.VideoAttributes.GetVideoResolutionString();
return "";
},
VideoSyncFeedbackFunc = () =>
(ActualActiveVideoInput == eVst.Hdmi1
&& tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue)
|| (ActualActiveVideoInput == eVst.Hdmi2
&& tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue)
|| (ActualActiveVideoInput == eVst.Vga
&& tx.VgaInput.SyncDetectedFeedback.BoolValue)
};
AnyVideoInput = new RoutingInputPortWithVideoStatuses(DmPortName.AnyVideoIn,
eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.None, 0, this, combinedFuncs);
DmOut = new RoutingOutputPort(DmPortName.DmOut, eRoutingSignalType.AudioVideo,
eRoutingPortConnectionType.DmCat, null, this);
HdmiLoopOut = new RoutingOutputPort(DmPortName.HdmiLoopOut, eRoutingSignalType.AudioVideo,
eRoutingPortConnectionType.Hdmi, null, this);
}
public override bool CustomActivate()
{
// Link up all of these damned events to the various RoutingPorts via a helper handler
Tx.HdmiInputs[1].InputStreamChange += (o, a) => FowardInputStreamChange(HdmiIn1, a.EventId);
Tx.HdmiInputs[1].VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(HdmiIn1, a.EventId);
Tx.HdmiInputs[2].InputStreamChange += (o, a) => FowardInputStreamChange(HdmiIn2, a.EventId);
Tx.HdmiInputs[2].VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(HdmiIn2, a.EventId);
Tx.VgaInput.InputStreamChange += (o, a) => FowardInputStreamChange(VgaIn, a.EventId);
Tx.VgaInput.VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(VgaIn, a.EventId);
// Base does register and sets up comm monitoring.
return base.CustomActivate();
}
void Tx_BaseEvent(GenericBase device, BaseEventArgs args)
{
var id = args.EventId;
if (id == DmTx4k302C.VideoSourceFeedbackEventId)
{
Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback);
}
// ------------------------------ incomplete -----------------------------------------
else if (id == DmTx4k302C.AudioSourceFeedbackEventId)
{
Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback);
}
}
/// <summary>
/// Relays the input stream change to the appropriate RoutingInputPort.
/// </summary>
void FowardInputStreamChange(RoutingInputPortWithVideoStatuses inputPort, int eventId)
{
if (eventId == EndpointInputStreamEventIds.SyncDetectedFeedbackEventId)
{
inputPort.VideoStatus.VideoSyncFeedback.FireUpdate();
AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate();
}
}
/// <summary>
/// Relays the VideoAttributes change to a RoutingInputPort
/// </summary>
void ForwardVideoAttributeChange(RoutingInputPortWithVideoStatuses inputPort, int eventId)
{
//// LOCATION: Crestron.SimplSharpPro.DM.VideoAttributeEventIds
//Debug.Console(2, this, "VideoAttributes_AttributeChange event id={0} from {1}",
// args.EventId, (sender as VideoAttributesEnhanced).Owner.GetType());
switch (eventId)
{
case VideoAttributeEventIds.HdcpActiveFeedbackEventId:
inputPort.VideoStatus.HdcpActiveFeedback.FireUpdate();
AnyVideoInput.VideoStatus.HdcpActiveFeedback.FireUpdate();
break;
case VideoAttributeEventIds.HdcpStateFeedbackEventId:
inputPort.VideoStatus.HdcpStateFeedback.FireUpdate();
AnyVideoInput.VideoStatus.HdcpStateFeedback.FireUpdate();
break;
case VideoAttributeEventIds.HorizontalResolutionFeedbackEventId:
case VideoAttributeEventIds.VerticalResolutionFeedbackEventId:
inputPort.VideoStatus.VideoResolutionFeedback.FireUpdate();
AnyVideoInput.VideoStatus.VideoResolutionFeedback.FireUpdate();
break;
}
}
public override List<Feedback> Feedbacks
{
get
{
List<Feedback> list = AnyVideoInput.VideoStatus.ToList();
list.AddRange(base.Feedbacks);
list.Add(ActiveVideoInputFeedback);
return list;
}
}
#region IIROutputPorts Members
public CrestronCollection<IROutputPort> IROutputPorts { get { return Tx.IROutputPorts; } }
public int NumberOfIROutputPorts { get { return Tx.NumberOfIROutputPorts; } }
#endregion
#region IComPorts Members
public CrestronCollection<ComPort> ComPorts { get { return Tx.ComPorts; } }
public int NumberOfComPorts { get { return Tx.NumberOfComPorts; } }
#endregion
}
}

View File

@@ -1,105 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DM;
using Crestron.SimplSharpPro.DM.Endpoints;
using Crestron.SimplSharpPro.DM.Endpoints.Transmitters;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.DM.Config;
namespace PepperDash.Essentials.DM
{
public class DmTxHelper
{
/// <summary>
/// A factory method for various DmTxControllers
/// </summary>
/// <param name="key"></param>
/// <param name="name"></param>
/// <param name="props"></param>
/// <returns></returns>
public static DmTxControllerBase GetDmTxController(string key, string name, string typeName, DmTxPropertiesConfig props)
{
// switch on type name... later...
typeName = typeName.ToLower();
//uint ipid = Convert.ToUInt16(props.Id, 16);
var ipid = props.Control.IpIdInt;
var pKey = props.ParentDeviceKey.ToLower();
if (pKey == "processor")
{
// Catch constructor failures, mainly dues to IPID
try
{
if (typeName.StartsWith("dmtx201"))
return new DmTx201SBasicController(key, name, new DmTx201C(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx4k302"))
return new DmTx4k302CController(key, name, new DmTx4k302C(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx401"))
return new DmTx401CController(key, name, new DmTx401C(ipid, Global.ControlSystem));
Debug.Console(0, "{1} WARNING: Cannot create DM-TX of type: '{0}'", typeName, key);
}
catch (Exception e)
{
Debug.Console(0, "[{0}] WARNING: Cannot create DM-TX device: {1}", key, e.Message);
}
}
else
{
var parentDev = DeviceManager.GetDeviceForKey(pKey);
if (!(parentDev is DmChassisController))
{
Debug.Console(0, "Cannot create DM device '{0}'. '{1}' is not a DM Chassis.",
key, pKey);
return null;
}
// Get the Crestron chassis and link stuff up
var switchDev = parentDev as DmChassisController;
var chassis = switchDev.Chassis;
var num = props.ParentInputNumber;
if (num <= 0 || num > chassis.NumberOfInputs)
{
Debug.Console(0, "Cannot create DM device '{0}'. Input number '{1}' is out of range",
key, num);
return null;
}
// Catch constructor failures, mainly dues to IPID
try
{
if (typeName.StartsWith("dmtx201"))
return new DmTx201SBasicController(key, name, new DmTx201S(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4k302"))
return new DmTx4k302CController(key, name, new DmTx4k302C(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx401"))
return new DmTx401CController(key, name, new DmTx401C(ipid, chassis.Inputs[num]));
}
catch (Exception e)
{
Debug.Console(0, "[{0}] WARNING: Cannot create DM-TX device: {1}", key, e.Message);
}
}
return null;
}
}
/// <summary>
///
/// </summary>
public abstract class DmTxControllerBase : CrestronGenericBaseDevice
{
public DmTxControllerBase(string key, string name, EndpointTransmitterBase hardware)
: base(key, name, hardware) { }
}
}

View File

@@ -1,27 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.DM;
using Crestron.SimplSharpPro.DM.Cards;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.DM
{
public static class VideoAttributesBasicExtensions
{
public static string GetVideoResolutionString(this VideoAttributesBasic va)
{
ushort h = va.HorizontalResolutionFeedback.UShortValue;
ushort v = va.VerticalResolutionFeedback.UShortValue;
if (h == 0 || v == 0)
return "n/a";
else
return string.Format("{0}x{1}", h, v);
}
}
}

View File

@@ -1,8 +0,0 @@
using System.Reflection;
[assembly: AssemblyTitle("Essentials_DM")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Essentials_DM")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyVersion("1.0.0.*")]

View File

@@ -1,124 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Core;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Devices.Common.DSP
{
public abstract class DspBase : Device
{
public Dictionary<string, DspControlPoint> LevelControlPoints { get; private set; }
public Dictionary<string, DspControlPoint> DialerControlPoints { get; private set; }
public Dictionary<string, DspControlPoint> SwitcherControlPoints { get; private set; }
public abstract void RunPreset(string name);
public DspBase(string key, string name) :
base(key, name) { }
// in audio call feedback
// VOIP
// Phone dialer
}
// Fusion
// Privacy state
// Online state
// level/mutes ?
// AC Log call stats
// Typical presets:
// call default preset to restore levels and mutes
public abstract class DspControlPoint
{
//string Key { get; protected set; }
}
// Main program
// VTC
// ATC
// Mics, unusual
public interface IDspLevelControl : IBasicVolumeWithFeedback
{
/// <summary>
/// In BiAmp: Instance Tag, QSC: Named Control, Polycom:
/// </summary>
string ControlPointTag { get; }
int Index1 { get; }
int Index2 { get; }
bool HasMute { get; }
bool HasLevel { get; }
bool AutomaticUnmuteOnVolumeUp { get; }
}
//public abstract class DspLevelControl : DspControlPoint, IBasicVolumeWithFeedback
//{
// protected abstract Func<bool> MuteFeedbackFunc { get; }
// protected abstract Func<int> VolumeLevelFeedbackFunc { get; }
// public DspLevelControl(string id)
// {
// MuteFeedback = new BoolFeedback(MuteFeedbackFunc);
// VolumeLevelFeedback = new IntFeedback(VolumeLevelFeedbackFunc);
// }
// // Poll and listen for these
// // Max value
// // Min value
// #region IBasicVolumeWithFeedback Members
// public BoolFeedback MuteFeedback { get; private set; }
// public abstract void MuteOff();
// public abstract void MuteOn();
// public abstract void SetVolume(ushort level);
// public IntFeedback VolumeLevelFeedback { get; private set; }
// #endregion
// #region IBasicVolumeControls Members
// public abstract void MuteToggle();
// public abstract void VolumeDown(bool pressRelease);
// public abstract void VolumeUp(bool pressRelease);
// #endregion
//}
// Privacy mute
public abstract class DspMuteControl : DspControlPoint
{
protected abstract Func<bool> MuteFeedbackFunc { get; }
public DspMuteControl(string id)
{
MuteFeedback = new BoolFeedback(MuteFeedbackFunc);
}
public BoolFeedback MuteFeedback { get; private set; }
public abstract void MuteOff();
public abstract void MuteOn();
public abstract void MuteToggle();
}
}

View File

@@ -1,126 +0,0 @@
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{892B761C-E479-44CE-BD74-243E9214AF13}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>PepperDash.Essentials.Devices.Common</RootNamespace>
<AssemblyName>Essentials Devices Common</AssemblyName>
<ProjectTypeGuids>{0B4745B0-194B-4BB6-8E21-E9057CA92300};{4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<PlatformFamilyName>WindowsCE</PlatformFamilyName>
<PlatformID>E2BECB1F-8C8C-41ba-B736-9BE7D946A398</PlatformID>
<OSVersion>5.0</OSVersion>
<DeployDirSuffix>SmartDeviceProject1</DeployDirSuffix>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<NativePlatformName>Windows CE</NativePlatformName>
<FormFactorID>
</FormFactorID>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<AllowedReferenceRelatedFileExtensions>.allowedReferenceRelatedFileExtensions</AllowedReferenceRelatedFileExtensions>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>DEBUG;TRACE;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<FileAlignment>512</FileAlignment>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
<GenerateSerializationAssemblies>off</GenerateSerializationAssemblies>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<AllowedReferenceRelatedFileExtensions>.allowedReferenceRelatedFileExtensions</AllowedReferenceRelatedFileExtensions>
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<FileAlignment>512</FileAlignment>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
<GenerateSerializationAssemblies>off</GenerateSerializationAssemblies>
</PropertyGroup>
<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>
</Reference>
<Reference Include="Crestron.SimplSharpPro.Gateways, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Gateways.dll</HintPath>
</Reference>
<Reference Include="mscorlib" />
<Reference Include="PepperDash_Core, Version=1.0.6284.20368, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\PepperDash.Core\Pepperdash Core\Pepperdash Core\bin\PepperDash_Core.dll</HintPath>
</Reference>
<Reference Include="PepperDash_Essentials_Core, Version=1.0.0.14500, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\Essentials Core\PepperDashEssentialsBase\bin\PepperDash_Essentials_Core.dll</HintPath>
</Reference>
<Reference Include="SimplSharpCustomAttributesInterface, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpCustomAttributesInterface.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="SimplSharpHelperInterface, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpHelperInterface.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="SimplSharpNewtonsoft, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpNewtonsoft.dll</HintPath>
</Reference>
<Reference Include="SimplSharpPro, Version=1.5.2.4, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpPro.exe</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="SimplSharpReflectionInterface, Version=1.0.5583.25238, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpReflectionInterface.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data" />
</ItemGroup>
<ItemGroup>
<Compile Include="Crestron\Gateways\CenRfgwController.cs" />
<Compile Include="Display\ComTcpDisplayBase.cs" />
<Compile Include="Display\DeviceFactory.cs" />
<Compile Include="Display\NecPaSeriesProjector.cs" />
<Compile Include="Display\NECPSXMDisplay.cs" />
<Compile Include="DSP\BiampTesira\BiampTesiraForteDspLevel.cs" />
<Compile Include="DSP\BiampTesira\TesiraForteControlPoint.cs" />
<Compile Include="DSP\BiampTesira\TesiraForteMuteControl.cs" />
<Compile Include="DSP\DspBase.cs" />
<Compile Include="DSP\BiampTesira\BiampTesiraForteDsp.cs" />
<Compile Include="DSP\BiampTesira\BiampTesiraFortePropertiesConfig.cs" />
<Compile Include="DSP\PolycomSoundStructure\SoundStructureBasics.cs" />
<Compile Include="Factory\DeviceFactory.cs" />
<Compile Include="PC\InRoomPc.cs" />
<Compile Include="PC\Laptop.cs" />
<Compile Include="SetTopBox\SetTopBoxPropertiesConfig.cs" />
<Compile Include="Streaming\AppleTV.cs" />
<Compile Include="Audio\GenericAudioOut.cs" />
<Compile Include="DiscPlayer\IRDiscPlayerBase.cs" />
<Compile Include="SetTopBox\IRSetTopBoxBase.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Streaming\Roku.cs" />
<None Include="Properties\ControlSystem.cfg" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
</VisualStudio>
</ProjectExtensions>
<PropertyGroup>
<PostBuildEvent>rem S# Pro preparation will execute after these operations</PostBuildEvent>
</PropertyGroup>
</Project>

View File

@@ -1,129 +0,0 @@
using System;
using System.Collections.Generic;
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Crestron.SimplSharpPro;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Devices.Common.DSP;
using PepperDash.Essentials.Devices.Common;
namespace PepperDash.Essentials.Devices.Common
{
public class DeviceFactory
{
public static IKeyed GetDevice(DeviceConfig dc)
{
var key = dc.Key;
var name = dc.Name;
var type = dc.Type;
var properties = dc.Properties;
var typeName = dc.Type.ToLower();
var groupName = dc.Group.ToLower();
if (typeName == "appletv")
{
//var ir = IRPortHelper.GetIrPort(properties);
//if (ir != null)
// return new AppleTV(key, name, ir.Port, ir.FileName);
var irCont = IRPortHelper.GetIrOutputPortController(dc);
return new AppleTV(key, name, irCont);
}
else if (typeName == "basicirdisplay")
{
var ir = IRPortHelper.GetIrPort(properties);
if (ir != null)
return new BasicIrDisplay(key, name, ir.Port, ir.FileName);
}
else if (typeName == "cenrfgwex")
{
return CenRfgwController.GetNewExGatewayController(key, name,
properties.Value<string>("id"), properties.Value<string>("gatewayType"));
}
else if (typeName == "cenerfgwpoe")
{
return CenRfgwController.GetNewErGatewayController(key, name,
properties.Value<string>("id"), properties.Value<string>("gatewayType"));
}
else if (typeName == "genericaudiooutwithvolume")
{
var zone = dc.Properties.Value<uint>("zone");
return new GenericAudioOutWithVolume(key, name,
dc.Properties.Value<string>("volumeDeviceKey"), zone);
}
else if (groupName == "discplayer") // (typeName == "irbluray")
{
if (properties["control"]["method"].Value<string>() == "ir")
{
var irCont = IRPortHelper.GetIrOutputPortController(dc);
return new IRBlurayBase(key, name, irCont);
//var ir = IRPortHelper.GetIrPort(properties);
//if (ir != null)
// return new IRBlurayBase(key, name, ir.Port, ir.FileName);
}
else if (properties["control"]["method"].Value<string>() == "com")
{
Debug.Console(0, "[{0}] COM Device type not implemented YET!", key);
}
}
else if (groupName == "settopbox") //(typeName == "irstbbase")
{
var irCont = IRPortHelper.GetIrOutputPortController(dc);
var config = dc.Properties.ToObject<SetTopBoxPropertiesConfig>();
var stb = new IRSetTopBoxBase(key, name, irCont, config);
//stb.HasDvr = properties.Value<bool>("hasDvr");
var listName = properties.Value<string>("presetsList");
if (listName != null)
stb.LoadPresets(listName);
return stb;
}
else if (typeName == "laptop")
{
return new Laptop(key, name);
}
else if (typeName == "inroompc")
{
return new InRoomPc(key, name);
}
else if (typeName == "roku")
{
var irCont = IRPortHelper.GetIrOutputPortController(dc);
return new Roku2(key, name, irCont);
//var ir = IRPortHelper.GetIrPort(properties);
//if (ir != null)
// return new Roku2(key, name, ir.Port, ir.FileName);
}
else if (typeName == "biamptesira")
{
var comm = CommFactory.CreateCommForDevice(dc);
var props = JsonConvert.DeserializeObject<BiampTesiraFortePropertiesConfig>(
properties.ToString());
return new BiampTesiraForteDsp(key, name, comm, props);
}
return null;
}
}
}

View File

@@ -1,8 +0,0 @@
using System.Reflection;
[assembly: AssemblyTitle("Essentials_Devices_Common")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Essentials_Devices_Common")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyVersion("1.0.0.*")]

View File

@@ -1,152 +0,0 @@
using System;
using System.Linq;
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials
{
/// <summary>
/// Loads the ConfigObject from the file
/// </summary>
public class ConfigReader
{
public static EssentialsConfig ConfigObject { get; private set; }
public static void LoadConfig2()
{
Debug.Console(0, "Using unmerged system/template configs.");
try
{
using (StreamReader fs = new StreamReader(string.Format(@"\NVRAM\program{0}\ConfigurationFile.json", InitialParametersClass.ApplicationNumber)))
{
var doubleObj = JObject.Parse(fs.ReadToEnd());
ConfigObject = MergeConfigs(doubleObj).ToObject<EssentialsConfig>();
// Extract SystemUrl and TemplateUrl
if (doubleObj["system_url"] != null)
{
ConfigObject.SystemUrl = doubleObj["system_url"].Value<string>();
}
if (doubleObj["template_url"] != null)
{
ConfigObject.TemplateUrl= doubleObj["template_url"].Value<string>();
}
}
}
catch (Exception e)
{
Debug.Console(0, "Config failed: \r{0}", e);
}
}
static JObject MergeConfigs(JObject doubleConfig)
{
var system = JObject.FromObject(doubleConfig["system"]);
var template = JObject.FromObject(doubleConfig["template"]);
var merged = new JObject();
// Put together top-level objects
if (system["info"] != null)
merged.Add("info", Merge(template["info"], system["info"]));
else
merged.Add("info", template["info"]);
merged.Add("devices", MergeArraysOnTopLevelProperty(template["devices"] as JArray, system["devices"] as JArray, "uid"));
if (system["rooms"] == null)
merged.Add("rooms", template["rooms"]);
else
merged.Add("rooms", MergeArraysOnTopLevelProperty(template["rooms"] as JArray, system["rooms"] as JArray, "key"));
if (system["sourceLists"] == null)
merged.Add("sourceLists", template["sourceLists"]);
else
merged.Add("sourceLists", Merge(template["sourceLists"], system["sourceLists"]));
#warning Make tie lines merge appropriately
if (template["tieLines"] != null)
merged.Add("tieLines", template["tieLines"]);
else if (system["tieLines"] != null)
merged.Add("tieLines", system["tieLines"]);
else
merged.Add("tieLines", new JArray());
Debug.Console(0, "MERGED RESULT: \x0d\x0a{0}", merged);
return merged;
}
/// <summary>
/// Merges the contents of a base and a delta array, matching the entries on a top-level property
/// given by propertyName. Returns a merge of them. Items in the delta array that do not have
/// a matched item in base array will not be merged.
/// </summary>
static JArray MergeArraysOnTopLevelProperty(JArray a1, JArray a2, string propertyName)
{
var result = new JArray();
if (a2 == null)
result = a1;
else if (a1 != null)
{
for (int i = 0; i < a1.Count(); i++)
{
var a1Dev = a1[i];
// Try to get a system device and if found, merge it onto template
var a2Match = a2.FirstOrDefault(t => t[propertyName].Equals(a1Dev[propertyName]));// t.Value<int>("uid") == tmplDev.Value<int>("uid"));
if (a2Match != null)
{
var mergedItem = Merge(a1Dev, a2Match);// Merge(JObject.FromObject(a1Dev), JObject.FromObject(a2Match));
result.Add(mergedItem);
}
else
result.Add(a1Dev);
}
}
return result;
}
/// <summary>
/// Helper for using with JTokens. Converts to JObject
/// </summary>
static JObject Merge(JToken t1, JToken t2)
{
return Merge(JObject.FromObject(t1), JObject.FromObject(t2));
}
/// <summary>
/// Merge b ONTO a
/// </summary>
/// <param name="a"></param>
/// <param name="b"></param>
static JObject Merge(JObject o1, JObject o2)
{
//Console.WriteLine("Merging {0}\ronto {1}", o2, o1);
foreach (var o2Prop in o2)
{
var o1Value = o1[o2Prop.Key];
if (o1Value == null)
o1.Add(o2Prop.Key, o2Prop.Value);
else
{
JToken replacement = null;
if (o2Prop.Value.HasValues && o1Value.HasValues) // Drill down
replacement = Merge(JObject.FromObject(o1Value), JObject.FromObject(o2Prop.Value));
else
replacement = o2Prop.Value;
o1[o2Prop.Key].Replace(replacement);
}
}
return o1;
}
}
}

View File

@@ -1,192 +0,0 @@
using System;
using System.Linq;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.CrestronThread;
using PepperDash.Core;
using PepperDash.Core.PortalSync;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Devices.Common;
using PepperDash.Essentials.DM;
using PepperDash.Essentials.Fusion;
namespace PepperDash.Essentials
{
public class ControlSystem : CrestronControlSystem
{
PepperDashPortalSyncClient PortalSync;
public ControlSystem()
: base()
{
Thread.MaxNumberOfUserThreads = 400;
Global.ControlSystem = this;
DeviceManager.Initialize(this);
}
/// <summary>
/// Git 'er goin'
/// </summary>
public override void InitializeSystem()
{
//CrestronConsole.AddNewConsoleCommand(s => GoWithLoad(), "go", "Reloads configuration file",
// ConsoleAccessLevelEnum.AccessOperator);
//CrestronConsole.AddNewConsoleCommand(s => TearDown(), "ungo", "Reloads configuration file",
// ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(s =>
{
foreach (var tl in TieLineCollection.Default)
CrestronConsole.ConsoleCommandResponse(" {0}\r", tl);
},
"listtielines", "Prints out all tie lines", ConsoleAccessLevelEnum.AccessOperator);
GoWithLoad();
}
/// <summary>
/// Do it, yo
/// </summary>
public void GoWithLoad()
{
// var thread = new Thread(o =>
// {
try
{
CrestronConsole.AddNewConsoleCommand(EnablePortalSync, "portalsync", "Loads Portal Sync",
ConsoleAccessLevelEnum.AccessOperator);
//PortalSync = new PepperDashPortalSyncClient();
Debug.Console(0, "Starting Essentials load from configuration");
ConfigReader.LoadConfig2();
LoadDevices();
LoadTieLines();
LoadRooms();
// FUSION - should go per room I believe. See CreateSystems in original Configuration.cs
// ???
//Temp Cotija testing
//CotijaSystemController CotijaInterface = new CotijaSystemController("WebClient1");
DeviceManager.ActivateAll();
Debug.Console(0, "Essentials load complete\r" +
"-------------------------------------------------------------");
}
catch (Exception e)
{
Debug.Console(0, "FATAL INITIALIZE ERROR. System is in an inconsistent state:\r{0}", e);
}
// return null;
// }, null);
}
public void EnablePortalSync(string s)
{
if (s.ToLower() == "enable")
{
CrestronConsole.ConsoleCommandResponse("Portal Sync features enabled");
PortalSync = new PepperDashPortalSyncClient();
}
}
public void TearDown()
{
Debug.Console(0, "Tearing down existing system");
DeviceManager.DeactivateAll();
TieLineCollection.Default.Clear();
foreach (var key in DeviceManager.GetDevices())
DeviceManager.RemoveDevice(key);
Debug.Console(0, "Tear down COMPLETE");
}
/// <summary>
/// Reads all devices from config and adds them to DeviceManager
/// </summary>
public void LoadDevices()
{
foreach (var devConf in ConfigReader.ConfigObject.Devices)
{
Debug.Console(0, "Creating device '{0}'", devConf.Key);
// Skip this to prevent unnecessary warnings
if (devConf.Key == "processor")
continue;
// Try local factory first
var newDev = DeviceFactory.GetDevice(devConf);
// Then associated library factories
if (newDev == null)
newDev = PepperDash.Essentials.Devices.Common.DeviceFactory.GetDevice(devConf);
if (newDev == null)
newDev = PepperDash.Essentials.DM.DeviceFactory.GetDevice(devConf);
if (newDev == null)
newDev = PepperDash.Essentials.Devices.Displays.DisplayDeviceFactory.GetDevice(devConf);
if (newDev != null)
DeviceManager.AddDevice(newDev);
else
Debug.Console(0, "WARNING: Cannot load unknown device type '{0}', key '{1}'.", devConf.Type, devConf.Key);
}
}
/// <summary>
/// Helper method to load tie lines. This should run after devices have loaded
/// </summary>
public void LoadTieLines()
{
// Make this reusable by clearing the TieLineCollection
var tlc = TieLineCollection.Default;
tlc.Clear();
foreach (var tieLineConfig in ConfigReader.ConfigObject.TieLines)
{
var newTL = tieLineConfig.GetTieLine();
if (newTL != null)
tlc.Add(newTL);
}
}
/// <summary>
/// Reads all rooms from config and adds them to DeviceManager
/// </summary>
public void LoadRooms()
{
foreach (var roomConfig in ConfigReader.ConfigObject.Rooms)
{
var room = roomConfig.GetRoomObject();
if (room != null)
{
if (room is EssentialsHuddleSpaceRoom)
{
DeviceManager.AddDevice(room);
Debug.Console(1, "Room is EssentialsHuddleSpaceRoom, attempting to add to DeviceManager with Fusion");
DeviceManager.AddDevice(new EssentialsHuddleSpaceFusionSystemController((EssentialsHuddleSpaceRoom)room, 0xf1));
var cotija = DeviceManager.GetDeviceForKey("cotijaServer") as CotijaSystemController;
if (cotija != null)
{
cotija.CotijaRooms.Add(new CotijaEssentialsHuddleSpaceRoomBridge(cotija, room as EssentialsHuddleSpaceRoom));
}
}
else
{
Debug.Console(1, "Room is NOT EssentialsHuddleSpaceRoom, attempting to add to DeviceManager w/o Fusion");
DeviceManager.AddDevice(room);
}
#warning Add Fusion connector to room factory?
}
else
Debug.Console(0, "WARNING: Cannot create room from config, key '{0}'", roomConfig.Key);
}
}
}
}

View File

@@ -1,84 +0,0 @@
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using Crestron.SimplSharp;
//using Crestron.SimplSharpPro;
//using PepperDash.Core;
//using PepperDash.Essentials.Core;
//namespace PepperDash.Essentials
//{
// //***************************************************************************************************
// public abstract class EssentialsRoom : Room
// {
// public event EventHandler<EssentialsRoomSourceChangeEventArgs> PresentationSourceChange;
// public event EventHandler<EssentialsRoomAudioDeviceChangeEventArgs> AudioDeviceWillChange;
// public Dictionary<uint, Device> Sources { get; protected set; }
// public abstract BoolFeedback RoomIsOnStandby { get; protected set; }
// public abstract BoolFeedback RoomIsOccupied { get; protected set; }
// public uint UnattendedShutdownTimeMs { get; set; }
// /// <summary>
// /// For use when turning on room without a source selection - e.g. from
// /// wake-on signal or occ sensor
// /// </summary>
// public SourceListItem DefaultPresentationSource { get; set; }
//#warning This might need more "guts" and shouldn't be public
// public SourceListItem CurrentPresentationSourceInfo { get; set; }
// //public IPresentationSource CurrentPresentationSource { get; protected set; }
// //{
// // get
// // {
// // if (_CurrentPresentationSource == null)
// // _CurrentPresentationSource = PresentationDevice.Default;
// // return _CurrentPresentationSource;
// // }
// // protected set { _CurrentPresentationSource = value; }
// //}
// //IPresentationSource _CurrentPresentationSource;
// /// <summary>
// /// The volume control device for this room - changing it will trigger event
// /// </summary>
// public IBasicVolumeControls CurrentAudioDevice
// {
// get { return _CurrentAudioDevice; }
// protected set
// {
// if (value != _CurrentAudioDevice)
// if (AudioDeviceWillChange != null)
// AudioDeviceWillChange(this,
// new EssentialsRoomAudioDeviceChangeEventArgs(this, _CurrentAudioDevice, value));
// _CurrentAudioDevice = value;
// }
// }
// IBasicVolumeControls _CurrentAudioDevice;
// public EssentialsRoom(string key, string name)
// : base(key, name)
// {
// }
// public virtual void SelectSource(uint sourceNum) { }
// public virtual void SelectSource(IPresentationSource newSrc) { }
// /// <summary>
// /// Make sure that this is called before changing the source
// /// </summary>
// protected void OnPresentationSourceChange(SourceListItem currentSource, SourceListItem newSource)
// {
// var handler = PresentationSourceChange;
// if (handler != null)
// PresentationSourceChange(this,
// new EssentialsRoomSourceChangeEventArgs(this, currentSource, newSource));
// }
// }
//}

View File

@@ -1,378 +0,0 @@
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using Crestron.SimplSharp;
//using Crestron.SimplSharpPro;
//using PepperDash.Core;
//using PepperDash.Essentials.Core;
//namespace PepperDash.Essentials
//{
// //***************************************************************************************************
// public class HuddleSpaceRoom : EssentialsRoom
// {
// public override BoolFeedback RoomIsOnFeedback { get; protected set; }
// public override BoolFeedback IsWarmingUpFeedback { get; protected set; }
// public override BoolFeedback IsCoolingDownFeedback { get; protected set; }
// public override BoolFeedback RoomIsOnStandby { get; protected set; }
// public override BoolFeedback RoomIsOccupied { get; protected set; }
// public override uint WarmupTime
// {
// get
// {
// if (_Display != null)
// return _Display.WarmupTime;
// return base.WarmupTime;
// }
// }
// public override uint CooldownTime
// {
// get
// {
// if (_Display != null)
// return _Display.CooldownTime;
// return base.CooldownTime;
// }
// }
// bool NoDisplayRoomIsOn = false;
// public DisplayBase DefaultDisplay // PROTECT ---------------------------------------------
// {
// get
// {
// if (_Display == null)
// _Display = TwoWayDisplayBase.DefaultDisplay;
// return _Display;
// }
// set
// {
// // Disconnect current display
// if (_Display != null)
// {
// _Display.PowerIsOnFeedback.OutputChange -= Display_Various_OutputChange;
// _Display.IsCoolingDownFeedback.OutputChange -= Display_Various_OutputChange;
// _Display.IsWarmingUpFeedback.OutputChange -= Display_Various_OutputChange;
// }
// _Display = value;
// if (value != null)
// {
// _Display.PowerIsOnFeedback.OutputChange += Display_Various_OutputChange;
// _Display.IsCoolingDownFeedback.OutputChange += Display_Various_OutputChange;
// _Display.IsWarmingUpFeedback.OutputChange += Display_Various_OutputChange;
// }
// CurrentAudioDevice = (value as IBasicVolumeControls);
// }
// }
// DisplayBase _Display;
// public IBasicVolumeControls DefaultVolumeControls
// {
// get { return DefaultDisplay as IBasicVolumeControls; }
// }
// public IntFeedback SourcesCount { get; private set; }
// public StringFeedback CurrentSourceName { get; private set; }
// public string SourceListKey { get; set; }
// string LastSourceKey;
// public HuddleSpaceRoom(string key, string name)
// : base(key, name)
// {
// // Return the state of the display, unless no display, then return
// // a local or default state.
// RoomIsOnFeedback = new BoolFeedback(RoomCue.RoomIsOn,
// () => DefaultDisplay != null ? DefaultDisplay.PowerIsOnFeedback.BoolValue : NoDisplayRoomIsOn);
// IsWarmingUpFeedback = new BoolFeedback(RoomCue.RoomIsWarmingUp,
// () => DefaultDisplay != null ? DefaultDisplay.IsWarmingUpFeedback.BoolValue : false);
// IsCoolingDownFeedback = new BoolFeedback(RoomCue.RoomIsCoolingDown,
// () => DefaultDisplay != null ? DefaultDisplay.IsCoolingDownFeedback.BoolValue : false);
// RoomIsOnStandby = new BoolFeedback(RoomCue.RoomIsOnStandby,
// () => false);
// RoomIsOccupied = new BoolFeedback(RoomCue.RoomIsOccupied,
// () => true);
// Sources = new Dictionary<uint, Device>();
// SourcesCount = new IntFeedback(RoomCue.SourcesCount,
// () => Sources.Count);
// CurrentSourceName = new StringFeedback(() => CurrentPresentationSourceInfo.PreferredName);// CurrentPresentationSource.Name);
// //CurrentSourceType = new IntOutput(RoomCue.CurrentSourceType,
// // () => CurrentPresentationSource.Type);
// UnattendedShutdownTimeMs = 60000;
// }
// public override void RoomOn()
// {
// Debug.Console(0, this, "Room on");
// if (IsCoolingDownFeedback.BoolValue || IsWarmingUpFeedback.BoolValue)
// {
// Debug.Console(2, this, "Room is warming or cooling. Ignoring room on");
// return;
// }
// if (!RoomIsOnFeedback.BoolValue)
// {
// // Setup callback when powerOn happens
// EventHandler<EventArgs> oneTimeHandler = null;
// oneTimeHandler = (o, a) =>
// {
// Debug.Console(0, this, "RoomOn received display power on: {0}",
// DefaultDisplay.PowerIsOnFeedback.BoolValue);
// // if it's power on
// if (DefaultDisplay.PowerIsOnFeedback.BoolValue)
// {
// (DefaultDisplay as TwoWayDisplayBase).PowerIsOnFeedback.OutputChange -= oneTimeHandler;
// Debug.Console(1, this, "Display has powered on");
// RoomIsOnFeedback.FireUpdate();
// //if (callback != null)
// // callback();
// }
// };
// DefaultDisplay.PowerIsOnFeedback.OutputChange += oneTimeHandler;
// DefaultDisplay.PowerOn();
// }
// }
// public override void RoomOff()
// {
// if (!RoomIsOnFeedback.BoolValue)
// {
// Debug.Console(2, this, "Room is already off");
// return;
// }
// Debug.Console(0, this, "Room off");
// DefaultDisplay.PowerOff();
// //RoomIsOn.FireUpdate(); ---Display will provide this in huddle
// //OnPresentationSourceChange(null);
// //CurrentPresentationSource = null;
// }
// public override void SelectSource(uint sourceNum)
// {
// // Run this on a separate thread
// new CTimer(o =>
// {
// var routeKey = "source-" + sourceNum;
// Debug.Console(1, this, "Run room action '{0}'", routeKey);
// if (string.IsNullOrEmpty(SourceListKey))
// {
// Debug.Console(1, this, "WARNING: No source/action list defined for this room");
// return;
// }
// // Try to get the list from the config object, using SourceListKey string
// if (!ConfigReader.ConfigObject.SourceLists.ContainsKey(SourceListKey))
// {
// Debug.Console(1, this, "WARNING: Config source list '{0}' not found", SourceListKey);
// return;
// }
// var list = ConfigReader.ConfigObject.SourceLists[SourceListKey];
// // Try to get the list item by it's string key
// if (!list.ContainsKey(routeKey))
// {
// Debug.Console(1, this, "WARNING: No item '{0}' found on config list '{1}'",
// routeKey, SourceListKey);
// return;
// }
// var item = list[routeKey];
// Debug.Console(2, this, "Action {0} has {1} steps",
// item.SourceKey, item.RouteList.Count);
// // Let's run it
// if (routeKey.ToLower() != "roomoff")
// LastSourceKey = routeKey;
// foreach (var route in item.RouteList)
// {
// // if there is a $defaultAll on route, run two separate
// if (route.DestinationKey.Equals("$defaultAll", StringComparison.OrdinalIgnoreCase))
// {
// var tempAudio = new SourceRouteListItem
// {
// DestinationKey = "$defaultDisplay",
// SourceKey = route.SourceKey,
// Type = eRoutingSignalType.Video
// };
// DoRoute(tempAudio);
// var tempVideo = new SourceRouteListItem
// {
// DestinationKey = "$defaultAudio",
// SourceKey = route.SourceKey,
// Type = eRoutingSignalType.Audio
// };
// DoRoute(tempVideo);
// continue;
// }
// else
// DoRoute(route);
// }
// // Set volume control on room, 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;
// else if (item.VolumeControlKey.Equals("$defaultDisplay", StringComparison.OrdinalIgnoreCase))
// volDev = DefaultDisplay as IBasicVolumeControls;
// // 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;
// }
// CurrentAudioDevice = volDev;
// // store the name and UI info for routes
// if (item.SourceKey != null)
// CurrentPresentationSourceInfo = item;
// // And finally, set the "control". This will trigger event
// //CurrentControlDevice = DeviceManager.GetDeviceForKey(item.SourceKey) as Device;
// RoomIsOnFeedback.FireUpdate();
// }, 0); // end of CTimer
// //Debug.Console(1, this, "Checking for source {0}", sourceNum);
// //if (Sources.ContainsKey(sourceNum))
// //{
// // var newSrc = Sources[sourceNum];
// // if (!RoomIsOn.BoolValue)
// // {
// // EventHandler<EventArgs> oneTimeHandler = null;
// // oneTimeHandler = (o, a) =>
// // {
// // RoomIsOn.OutputChange -= oneTimeHandler;
// // FinishSourceSelection(newSrc);
// // };
// // RoomIsOn.OutputChange -= oneTimeHandler;
// // RoomIsOn.OutputChange += oneTimeHandler;
// // RoomOn();
// // }
// // else FinishSourceSelection(newSrc);
// //}
// }
// /// <summary>
// ///
// /// </summary>
// /// <param name="route"></param>
// /// <returns></returns>
// bool DoRoute(SourceRouteListItem route)
// {
// IRoutingSinkNoSwitching dest = null;
// if (route.DestinationKey.Equals("$defaultDisplay", StringComparison.OrdinalIgnoreCase))
// dest = DefaultDisplay;
// 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);
// }
// return true;
// }
// ///// <summary>
// /////
// ///// </summary>
// ///// <param name="newSrc"></param>
// //public override void SelectSource(IPresentationSource newSrc)
// //{
// // if (Sources.ContainsValue(newSrc))
// // {
// // if (!RoomIsOn.BoolValue)
// // {
// // EventHandler<EventArgs> oneTimeHandler = null;
// // oneTimeHandler = (o, a) =>
// // {
// // RoomIsOn.OutputChange -= oneTimeHandler;
// // FinishSourceSelection(newSrc);
// // };
// // RoomIsOn.OutputChange -= oneTimeHandler;
// // RoomIsOn.OutputChange += oneTimeHandler;
// // RoomOn();
// // }
// // else FinishSourceSelection(newSrc);
// // }
// //}
// void Display_Various_OutputChange(object sender, EventArgs e)
// {
// // Bounce through the output changes
// if (sender == DefaultDisplay.PowerIsOnFeedback)
// this.RoomIsOnFeedback.FireUpdate();
// else if (sender == DefaultDisplay.IsCoolingDownFeedback)
// this.IsCoolingDownFeedback.FireUpdate();
// else if (sender == DefaultDisplay.IsWarmingUpFeedback)
// this.IsWarmingUpFeedback.FireUpdate();
// }
//// void FinishSourceSelection(IPresentationSource newSource)
//// {
//// Debug.Console(1, this, "Selecting source {0}", newSource.Key);
//// // Notify anyone watching source that it's leaving
//// OnPresentationSourceChange(newSource);
//// CurrentPresentationSource = newSource;
//// var routeableSource = CurrentPresentationSource as IRoutingOutputs;
//// if (routeableSource != null)
////#warning source route type will need clarification
//// DefaultDisplay.GetRouteToSource(routeableSource, eRoutingSignalType.AudioVideo);
//// else
//// Debug.Console(1, this, "New selected source {0} is not routeable", CurrentPresentationSource);
//// CurrentSourceName.FireUpdate();
//// //CurrentSourceType.FireUpdate();
//// }
// public override List<Feedback> Feedbacks
// {
// get
// {
// var feedbacks = new List<Feedback>
// {
// SourcesCount,
// CurrentSourceName,
// //CurrentSourceType,
// };
// feedbacks.AddRange(base.Feedbacks);
// return feedbacks;
// }
// }
// }
//}

View File

@@ -1,45 +0,0 @@
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using Crestron.SimplSharp;
//using Crestron.SimplSharpPro;
//using PepperDash.Core;
//using PepperDash.Essentials.Core;
//namespace PepperDash.Essentials
//{
// public class EssentialsRoomSourceChangeEventArgs : EventArgs
// {
// public EssentialsRoom Room { get; private set; }
// public SourceListItem OldSource { get; private set; }
// public SourceListItem NewSource { get; private set; }
// public EssentialsRoomSourceChangeEventArgs(EssentialsRoom room,
// SourceListItem oldSource, SourceListItem newSource)
// {
// Room = room;
// OldSource = oldSource;
// NewSource = newSource;
// }
// }
// public class EssentialsRoomAudioDeviceChangeEventArgs : EventArgs
// {
// public EssentialsRoom Room { get; private set; }
// public IBasicVolumeControls OldDevice { get; private set; }
// public IBasicVolumeControls NewDevice { get; private set; }
// public EssentialsRoomAudioDeviceChangeEventArgs(EssentialsRoom room,
// IBasicVolumeControls oldDevice, IBasicVolumeControls newDevice)
// {
// Room = room;
// OldDevice = oldDevice;
// NewDevice = newDevice;
// }
// }
//}

View File

@@ -1,8 +0,0 @@
using System.Reflection;
[assembly: AssemblyTitle("PepperDashEssentials")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PepperDashEssentials")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyVersion("1.0.0.*")]

View File

@@ -1,14 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials
{
public class CotijaConfig : DeviceConfig
{
public string serverUrl { get; set; }
}
}

View File

@@ -1,256 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Room.Cotija;
namespace PepperDash.Essentials
{
public class CotijaEssentialsHuddleSpaceRoomBridge
{
CotijaSystemController Parent;
public EssentialsHuddleSpaceRoom Room { get; private set; }
public CotijaEssentialsHuddleSpaceRoomBridge(CotijaSystemController parent, EssentialsHuddleSpaceRoom room)
{
Parent = parent;
Room = room;
// Source Changes and room off
Parent.AddAction(string.Format(@"/room/{0}/status",Room.Key), new Action(() => Room_RoomFullStatus(Room)));
Parent.AddAction(string.Format(@"/room/{0}/source", Room.Key), new Action<SourceSelectMessageContent>(c => room.RunRouteAction(c.SourceSelect)));
Parent.AddAction(string.Format(@"/room/{0}/event/masterVolumeUpBtn", Room.Key), new PressAndHoldAction(b => room.CurrentVolumeControls.VolumeUp(b)));
Parent.AddAction(string.Format(@"/room/{0}/event/masterVolumeDownBtn", Room.Key), new PressAndHoldAction(b => room.CurrentVolumeControls.VolumeDown(b)));
Parent.AddAction(string.Format(@"/room/{0}/event/muteToggle", Room.Key), new Action(() => room.CurrentVolumeControls.MuteToggle()));
Room.CurrentSingleSourceChange += new SourceInfoChangeHandler(Room_CurrentSingleSourceChange);
Room.CurrentVolumeDeviceChange += new EventHandler<VolumeDeviceChangeEventArgs>(Room_CurrentVolumeDeviceChange);
Room.OnFeedback.OutputChange += new EventHandler<EventArgs>(OnFeedback_OutputChange);
// Registers for initial volume events, if possible
var currentVolumeDevice = Room.CurrentVolumeControls;
if (currentVolumeDevice != null)
{
if (currentVolumeDevice is IBasicVolumeWithFeedback)
{
var newDev = currentVolumeDevice as IBasicVolumeWithFeedback;
newDev.MuteFeedback.OutputChange += new EventHandler<EventArgs>(VolumeLevelFeedback_OutputChange);
newDev.VolumeLevelFeedback.OutputChange += new EventHandler<EventArgs>(VolumeLevelFeedback_OutputChange);
}
}
}
void OnFeedback_OutputChange(object sender, EventArgs e)
{
/* Example message
* {
"type":"/room/status",
"content": {
"isOn": false
}
}
*/
JObject roomStatus = new JObject();
roomStatus.Add("isOn", (sender as BoolFeedback).BoolValue);
JObject message = new JObject();
message.Add("type", "/room/status/");
message.Add("content", roomStatus);
Parent.PostToServer(Room, message);
}
void Room_CurrentVolumeDeviceChange(object sender, VolumeDeviceChangeEventArgs e)
{
if (e.OldDev is IBasicVolumeWithFeedback)
{
var oldDev = e.OldDev as IBasicVolumeWithFeedback;
oldDev.MuteFeedback.OutputChange -= VolumeLevelFeedback_OutputChange;
oldDev.VolumeLevelFeedback.OutputChange -= VolumeLevelFeedback_OutputChange;
}
if (e.NewDev is IBasicVolumeWithFeedback)
{
var newDev = e.NewDev as IBasicVolumeWithFeedback;
newDev.MuteFeedback.OutputChange += new EventHandler<EventArgs>(VolumeLevelFeedback_OutputChange);
newDev.VolumeLevelFeedback.OutputChange += new EventHandler<EventArgs>(VolumeLevelFeedback_OutputChange);
}
}
void VolumeLevelFeedback_OutputChange(object sender, EventArgs e)
{
/* Example message
* {
"type":"/room/status",
"content": {
"masterVolumeLevel": 12345,
"masterVolumeMuteState": false
}
}
*/
var huddleRoom = Room as EssentialsHuddleSpaceRoom;
if(huddleRoom.CurrentVolumeControls is IBasicVolumeWithFeedback)
{
JObject roomStatus = new JObject();
if (huddleRoom.CurrentVolumeControls is IBasicVolumeWithFeedback)
{
var currentVolumeConstrols = huddleRoom.CurrentVolumeControls as IBasicVolumeWithFeedback;
roomStatus.Add("masterVolumeLevel", currentVolumeConstrols.VolumeLevelFeedback.IntValue);
roomStatus.Add("masterVolumeMuteState", currentVolumeConstrols.MuteFeedback.BoolValue);
}
JObject message = new JObject();
message.Add("type", "/room/status/");
message.Add("content", roomStatus);
Parent.PostToServer(Room, message);
}
}
void Room_CurrentSingleSourceChange(EssentialsRoomBase room, PepperDash.Essentials.Core.SourceListItem info, ChangeType type)
{
/* Example message
* {
"type":"/room/status",
"content": {
"selectedSourceKey": "off",
}
}
*/
if (type == ChangeType.WillChange)
{
// Disconnect from previous source
if (info != null)
{
var previousDev = info.SourceDevice;
// device type interfaces
if (previousDev is ISetTopBoxControls)
(previousDev as ISetTopBoxControls).UnlinkActions(Parent);
// common interfaces
if (previousDev is IChannel)
(previousDev as IChannel).UnlinkActions(Parent);
if (previousDev is IColor)
(previousDev as IColor).UnlinkActions(Parent);
if (previousDev is IDPad)
(previousDev as IDPad).UnlinkActions(Parent);
if (previousDev is IDvr)
(previousDev as IDvr).UnlinkActions(Parent);
if (previousDev is INumericKeypad)
(previousDev as INumericKeypad).UnlinkActions(Parent);
if (previousDev is IPower)
(previousDev as IPower).UnlinkActions(Parent);
if (previousDev is ITransport)
(previousDev as ITransport).UnlinkActions(Parent);
}
JObject roomStatus = new JObject();
var huddleRoom = room as EssentialsHuddleSpaceRoom;
roomStatus.Add("selectedSourceKey", huddleRoom.CurrentSourceInfoKey);
JObject message = new JObject();
message.Add("type", "/room/status/");
message.Add("content", roomStatus);
Parent.PostToServer(Room, message);
}
else
{
if (info != null)
{
var dev = info.SourceDevice;
if (dev is ISetTopBoxControls)
(dev as ISetTopBoxControls).LinkActions(Parent);
if (dev is IChannel)
(dev as IChannel).LinkActions(Parent);
if (dev is IColor)
(dev as IColor).LinkActions(Parent);
if (dev is IDPad)
(dev as IDPad).LinkActions(Parent);
if (dev is IDvr)
(dev as IDvr).LinkActions(Parent);
if (dev is INumericKeypad)
(dev as INumericKeypad).LinkActions(Parent);
if (dev is IPower)
(dev as IPower).LinkActions(Parent);
if (dev is ITransport)
(dev as ITransport).LinkActions(Parent);
}
}
}
/// <summary>
/// Posts the full status of the room to the server
/// </summary>
/// <param name="room"></param>
void Room_RoomFullStatus(EssentialsRoomBase room)
{
/* Example message
* {
"type":"/room/status",
"content": {
"selectedSourceKey": "off",
"isOn": false,
"masterVolumeLevel": 50,
"masterVolumeMuteState": false
}
}
*/
JObject roomStatus = new JObject();
var huddleRoom = room as EssentialsHuddleSpaceRoom;
roomStatus.Add("isOn", huddleRoom.OnFeedback.BoolValue);
roomStatus.Add("selectedSourceKey", huddleRoom.CurrentSourceInfoKey);
if(huddleRoom.CurrentVolumeControls is IBasicVolumeWithFeedback)
{
var currentVolumeConstrols = huddleRoom.CurrentVolumeControls as IBasicVolumeWithFeedback;
roomStatus.Add("masterVolumeLevel", currentVolumeConstrols.VolumeLevelFeedback.IntValue);
roomStatus.Add("masterVolumeMuteState", currentVolumeConstrols.MuteFeedback.BoolValue);
}
JObject message = new JObject();
message.Add("type", "/room/status/");
message.Add("content", roomStatus);
Parent.PostToServer(Room, message);
}
}
public class SourceSelectMessageContent
{
public string Destination { get; set; }
public string SourceSelect { get; set; }
}
public delegate void PressAndHoldAction(bool b);
}

View File

@@ -1,445 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Crestron.SimplSharpPro;
using Crestron.SimplSharp.Net.Http;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials
{
public class CotijaSystemController : Device
{
GenericHttpSseClient SseClient;
CCriticalSection FileLock;
CotijaConfig Config;
HttpClient Client;
Dictionary<string, Object> ActionDictionary = new Dictionary<string, Object>(StringComparer.InvariantCultureIgnoreCase);
Dictionary<string, CTimer> PushedActions = new Dictionary<string, CTimer>();
CTimer ServerHeartbeat;
long ServerHeartbeatInterval = 20000;
CTimer ServerReconnect;
long ServerReconnectInterval = 5000;
string SystemUuid;
public List<CotijaEssentialsHuddleSpaceRoomBridge> CotijaRooms { get; private set; }
long ButtonHeartbeatInterval = 1000;
public CotijaSystemController(string key, string name, CotijaConfig config) : base(key, name)
{
Config = config;
CotijaRooms = new List<CotijaEssentialsHuddleSpaceRoomBridge>();
CrestronConsole.AddNewConsoleCommand(RegisterSystemToServer, "InitializeHttpClient", "Initializes a new HTTP client connection to a specified URL", ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(DisconnectSseClient, "CloseHttpClient", "Closes the active HTTP client", ConsoleAccessLevelEnum.AccessOperator);
AddPostActivationAction(() => RegisterSystemToServer(null));
}
/// <summary>
/// Adds an action to the dictionary
/// </summary>
/// <param name="key">The path of the API command</param>
/// <param name="action">The action to be triggered by the commmand</param>
public void AddAction(string key, object action)
{
if (!ActionDictionary.ContainsKey(key))
{
ActionDictionary.Add(key, action);
}
else
{
Debug.Console(1, this, "Cannot add action with key '{0}' because key already exists in ActionDictionary.");
}
}
/// <summary>
/// Removes and action from the dictionary
/// </summary>
/// <param name="key"></param>
public void RemoveAction(string key)
{
if (ActionDictionary.ContainsKey(key))
ActionDictionary.Remove(key);
}
void ReconnectToServer(object o)
{
RegisterSystemToServer(null);
}
/// <summary>
/// Registers the room with the server
/// </summary>
/// <param name="url">URL of the server, including the port number, if not 80. Format: "serverUrlOrIp:port"</param>
void RegisterSystemToServer(string command)
{
try
{
string filePath = string.Format(@"\NVRAM\Program{0}\configurationFile.json", Global.ControlSystem.ProgramNumber);
string postBody = null;
if (string.IsNullOrEmpty(filePath))
{
Debug.Console(0, this, "Error reading file. No path specified.");
return;
}
FileLock = new CCriticalSection();
if (FileLock.TryEnter())
{
Debug.Console(1, this, "Reading configuration file to extract system UUID...");
postBody = File.ReadToEnd(filePath, Encoding.ASCII);
Debug.Console(2, this, "{0}", postBody);
FileLock.Leave();
}
if (string.IsNullOrEmpty(postBody))
{
Debug.Console(1, "Post Body is null or empty");
}
else
{
Client = new HttpClient();
HttpClientRequest request = new HttpClientRequest();
Client.Verbose = true;
Client.KeepAlive = true;
SystemUuid = Essentials.ConfigReader.ConfigObject.SystemUuid;
string url = string.Format("http://{0}/api/system/join/{1}", Config.serverUrl, SystemUuid);
request.Url.Parse(url);
request.RequestType = RequestType.Post;
request.Header.SetHeaderValue("Content-Type", "application/json");
request.ContentString = postBody;
Client.DispatchAsync(request, PostConnectionCallback);
}
}
catch (Exception e)
{
Debug.Console(0, this, "Error Initilizing Room: {0}", e);
}
}
/// <summary>
/// Posts a message to the server from a room
/// </summary>
/// <param name="room">room from which the message originates</param>
/// <param name="o">object to be serialized and sent in post body</param>
public void PostToServer(EssentialsRoomBase room, JObject o)
{
try
{
if (Client == null)
Client = new HttpClient();
//HttpClient client = new HttpClient();
HttpClientRequest request = new HttpClientRequest();
Client.Verbose = true;
Client.KeepAlive = true;
string url = string.Format("http://{0}/api/room/{1}/status", Config.serverUrl, string.Format("{0}--{1}", SystemUuid, room.Key));
request.Url.Parse(url);
request.RequestType = RequestType.Post;
request.Header.SetHeaderValue("Content-Type", "application/json");
request.KeepAlive = true;
// Ignore any null objects when serializing and remove formatting
string ignored = JsonConvert.SerializeObject(o, Formatting.None, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
request.ContentString = ignored;
Debug.Console(1, this, "Posting to '{0}':\n{1}", url, request.ContentString);
Client.DispatchAsync(request, (r, err) => { if (r != null) { Debug.Console(1, this, "Status Response Code: {0}", r.Code); } });
StartReconnectTimer(ServerReconnectInterval, ServerReconnectInterval);
}
catch(Exception e)
{
Debug.Console(1, this, "Error Posting to Server: {0}", e);
}
}
/// <summary>
/// Disconnects the SSE Client and stops the heartbeat timer
/// </summary>
/// <param name="command"></param>
void DisconnectSseClient(string command)
{
if(SseClient != null)
SseClient.Disconnect();
if (ServerHeartbeat != null)
{
ServerHeartbeat.Stop();
ServerHeartbeat = null;
}
}
/// <summary>
/// The callback that fires when we get a response from our registration attempt
/// </summary>
/// <param name="resp"></param>
/// <param name="err"></param>
void PostConnectionCallback(HttpClientResponse resp, HTTP_CALLBACK_ERROR err)
{
try
{
if (resp != null && resp.Code == 200)
{
if(ServerReconnect != null)
{
ServerReconnect.Stop();
ServerReconnect = null;
}
if (SseClient == null)
{
ConnectSseClient(null);
}
}
else
{
if (resp != null)
Debug.Console(1, this, "Response from server: {0}\n{1}", resp.Code, err);
else
Debug.Console(1, this, "Null response received from server.");
}
}
catch (Exception e)
{
Debug.Console(1, this, "Error Initializing SSE Client: {0}", e);
}
}
/// <summary>
/// Executes when we don't get a heartbeat message in time. Triggers reconnect.
/// </summary>
/// <param name="o"></param>
void HeartbeatExpired(object o)
{
if (ServerHeartbeat != null)
{
Debug.Console(1, this, "Heartbeat Timer Expired.");
ServerHeartbeat.Stop();
ServerHeartbeat = null;
}
StartReconnectTimer(ServerReconnectInterval, ServerReconnectInterval);
}
void StartReconnectTimer(long dueTime, long repeatTime)
{
// Start the reconnect timer
ServerReconnect = new CTimer(ReconnectToServer, null, dueTime, repeatTime);
ServerReconnect.Reset(dueTime, repeatTime);
}
void StartHearbeatTimer(long dueTime, long repeatTime)
{
if (ServerHeartbeat == null)
{
ServerHeartbeat = new CTimer(HeartbeatExpired, null, dueTime, repeatTime);
Debug.Console(2, this, "Heartbeat Timer Started.");
}
ServerHeartbeat.Reset(dueTime, repeatTime);
Debug.Console(2, this, "Heartbeat Timer Reset.");
}
/// <summary>
/// Connects the SSE Client
/// </summary>
/// <param name="o"></param>
void ConnectSseClient(object o)
{
Debug.Console(0, this, "Initializing SSE Client.");
if (SseClient == null)
{
SseClient = new GenericHttpSseClient(string.Format("{0}-SseClient", Key), Name);
CommunicationGather LineGathered = new CommunicationGather(SseClient, "\x0d\x0a");
LineGathered.LineReceived += new EventHandler<GenericCommMethodReceiveTextArgs>(LineGathered_LineReceived);
}
else
{
if (SseClient.IsConnected)
{
SseClient.Disconnect();
}
}
string uuid = Essentials.ConfigReader.ConfigObject.SystemUuid;
SseClient.Url = string.Format("http://{0}/api/system/stream/{1}", Config.serverUrl, uuid);
SseClient.Connect();
}
void LineGathered_LineReceived(object sender, GenericCommMethodReceiveTextArgs e)
{
//Debug.Console(1, this, "Received from Server: '{0}'", e.Text);
if(e.Text.IndexOf("data:") > -1)
{
var message = e.Text.Substring(6);
Debug.Console(1, this, "Message: '{0}'", message);
try
{
var messageObj = JObject.Parse(message);
var type = messageObj["type"].Value<string>();
if (type == "hello")
{
StartHearbeatTimer(ServerHeartbeatInterval, ServerHeartbeatInterval);
}
else if (type == "/system/heartbeat")
{
StartHearbeatTimer(ServerHeartbeatInterval, ServerHeartbeatInterval);
}
else if (type == "close")
{
SseClient.Disconnect();
// Start the reconnect timer
ServerReconnect = new CTimer(ConnectSseClient, null, ServerReconnectInterval, ServerReconnectInterval);
ServerReconnect.Reset(ServerReconnectInterval, ServerReconnectInterval);
}
else
{
// Check path against Action dictionary
if (ActionDictionary.ContainsKey(type))
{
var action = ActionDictionary[type];
if (action is Action)
{
(action as Action)();
}
else if (action is PressAndHoldAction)
{
var stateString = messageObj["content"]["state"].Value<string>();
// Look for a button press event
if (!string.IsNullOrEmpty(stateString))
{
switch (stateString)
{
case "true":
{
if (!PushedActions.ContainsKey(type))
{
PushedActions.Add(type, new CTimer(o =>
{
(action as PressAndHoldAction)(false);
PushedActions.Remove(type);
}, null, ButtonHeartbeatInterval, ButtonHeartbeatInterval));
}
// Maybe add an else to reset the timer
break;
}
case "held":
{
if (!PushedActions.ContainsKey(type))
{
PushedActions[type].Reset(ButtonHeartbeatInterval, ButtonHeartbeatInterval);
}
return;
}
case "false":
{
if (PushedActions.ContainsKey(type))
{
PushedActions[type].Stop();
PushedActions.Remove(type);
}
break;
}
}
(action as PressAndHoldAction)(stateString == "true");
}
}
else if (action is Action<bool>)
{
var stateString = messageObj["content"]["state"].Value<string>();
if (!string.IsNullOrEmpty(stateString))
{
(action as Action<bool>)(stateString == "true");
}
}
else if (action is Action<ushort>)
{
(action as Action<ushort>)(messageObj["content"]["value"].Value<ushort>());
}
else if (action is Action<string>)
{
(action as Action<string>)(messageObj["content"]["value"].Value<string>());
}
else if (action is Action<SourceSelectMessageContent>)
{
(action as Action<SourceSelectMessageContent>)(messageObj["content"]
.ToObject<SourceSelectMessageContent>());
}
}
}
}
catch (Exception err)
{
Debug.Console(1, this, "Unable to parse message: {0}", err);
}
}
}
}
}

View File

@@ -1,296 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Core;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials
{
public class EssentialsHuddleSpaceRoom : EssentialsRoomBase, IHasCurrentSourceInfoChange
{
public event EventHandler<VolumeDeviceChangeEventArgs> CurrentVolumeDeviceChange;
public event SourceInfoChangeHandler CurrentSingleSourceChange;
public EssentialsRoomPropertiesConfig Config { get; private set; }
public IRoutingSinkWithSwitching DefaultDisplay { get; private set; }
public IRoutingSinkNoSwitching DefaultAudioDevice { get; private set; }
public IBasicVolumeControls DefaultVolumeControls { get; private set; }
public bool ExcludeFromGlobalFunctions { get; set; }
/// <summary>
/// The config name of the source list
/// </summary>
public string SourceListKey { get; set; }
/// <summary>
/// If room is off, enables power on to last source. Default true
/// </summary>
public bool EnablePowerOnToLastSource { get; set; }
string LastSourceKey;
/// <summary>
///
/// </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>
/// The SourceListItem last run - containing names and icons
/// </summary>
public SourceListItem CurrentSourceInfo
{
get { return _CurrentSourceInfo; }
private set
{
if (value == _CurrentSourceInfo) return;
var handler = CurrentSingleSourceChange;
// 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);
_CurrentSourceInfo = value;
// add to in-use tracking
if (_CurrentSourceInfo != null && _CurrentSourceInfo.SourceDevice is IInUseTracking)
(_CurrentSourceInfo.SourceDevice as IInUseTracking).InUseTracker.AddUser(this, "control");
if (handler != null)
handler(this, _CurrentSourceInfo, ChangeType.DidChange);
}
}
SourceListItem _CurrentSourceInfo;
public string CurrentSourceInfoKey { get; private set; }
/// <summary>
///
/// </summary>
public BoolFeedback OnFeedback { get; private set; }
/// <summary>
///
/// </summary>
/// <param name="key"></param>
/// <param name="name"></param>
public EssentialsHuddleSpaceRoom(string key, string name, IRoutingSinkWithSwitching defaultDisplay,
IRoutingSinkNoSwitching defaultAudio, EssentialsRoomPropertiesConfig config)
: base(key, name)
{
Config = config;
DefaultDisplay = defaultDisplay;
DefaultAudioDevice = defaultAudio;
if (defaultAudio is IBasicVolumeControls)
DefaultVolumeControls = defaultAudio as IBasicVolumeControls;
else if (defaultAudio is IHasVolumeDevice)
DefaultVolumeControls = (defaultAudio as IHasVolumeDevice).VolumeDevice;
CurrentVolumeControls = DefaultVolumeControls;
OnFeedback = new BoolFeedback(() =>
{ return CurrentSourceInfo != null
&& CurrentSourceInfo.Type == eSourceListItemType.Route; });
SourceListKey = "default";
EnablePowerOnToLastSource = true;
}
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 =>
{
Debug.Console(1, this, "Run room 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;
}
var item = dict[routeKey];
Debug.Console(2, this, "Action {0} has {1} steps",
item.SourceKey, item.RouteList.Count);
// Let's run it
if (routeKey.ToLower() != "roomoff")
{
LastSourceKey = routeKey;
}
else
{
CurrentSourceInfoKey = null;
}
foreach (var route in item.RouteList)
{
// if there is a $defaultAll on route, run two separate
if (route.DestinationKey.Equals("$defaultAll", StringComparison.OrdinalIgnoreCase))
{
var tempAudio = new SourceRouteListItem
{
DestinationKey = "$defaultDisplay",
SourceKey = route.SourceKey,
Type = eRoutingSignalType.Video
};
DoRoute(tempAudio);
var tempVideo = new SourceRouteListItem
{
DestinationKey = "$defaultAudio",
SourceKey = route.SourceKey,
Type = eRoutingSignalType.Audio
};
DoRoute(tempVideo);
continue;
}
else
DoRoute(route);
}
// Set volume control on room, 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;
else if (item.VolumeControlKey.Equals("$defaultDisplay", StringComparison.OrdinalIgnoreCase))
volDev = DefaultDisplay as IBasicVolumeControls;
// 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;
}
CurrentVolumeControls = volDev;
// store the name and UI info for routes
if (item.SourceKey != null)
{
CurrentSourceInfoKey = routeKey;
CurrentSourceInfo = item;
}
// And finally, set the "control". This will trigger event
//CurrentControlDevice = DeviceManager.GetDeviceForKey(item.SourceKey) as Device;
OnFeedback.FireUpdate();
// report back when done
if (successCallback != null)
successCallback();
#warning Need to again handle special commands in here.
}, 0); // end of CTimer
}
/// <summary>
/// Will power the room on with the last-used source
/// </summary>
public void PowerOnToDefaultOrLastSource()
{
if (!EnablePowerOnToLastSource || LastSourceKey == null)
return;
RunRouteAction(LastSourceKey);
}
/// <summary>
///
/// </summary>
/// <param name="route"></param>
/// <returns></returns>
bool DoRoute(SourceRouteListItem route)
{
IRoutingSinkNoSwitching dest = null;
if (route.DestinationKey.Equals("$defaultaudio", StringComparison.OrdinalIgnoreCase))
dest = DefaultAudioDevice;
else if (route.DestinationKey.Equals("$defaultDisplay", StringComparison.OrdinalIgnoreCase))
dest = DefaultDisplay;
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);
}
return true;
}
/// <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");
}
}
}

View File

@@ -1,414 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Core;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials
{
public class EssentialsPresentationRoom : EssentialsRoomBase, IHasCurrentSourceInfoChange
{
public event EventHandler<VolumeDeviceChangeEventArgs> CurrentVolumeDeviceChange;
public event SourceInfoChangeHandler CurrentSingleSourceChange;
public event SourceInfoChangeHandler CurrentDisplay1SourceChange;
public event SourceInfoChangeHandler CurrentDisplay2SourceChange;
public EssentialsPresentationRoomPropertiesConfig Config { get; private set; }
public Dictionary<uint, IRoutingSinkNoSwitching> Displays { get; private set; }
public IRoutingSinkNoSwitching DefaultAudioDevice { get; private set; }
public IBasicVolumeControls DefaultVolumeControls { get; private set; }
/// <summary>
/// The config name of the source list
/// </summary>
public string SourceListKey { get; set; }
/// <summary>
/// If room is off, enables power on to last source. Default true
/// </summary>
public bool EnablePowerOnToLastSource { get; set; }
string LastSourceKey;
public enum eVideoRoutingMode
{
SelectSourceSelectDisplay, SourceToAllDisplays
}
public eVideoRoutingMode VideoRoutingMode { get; set; }
public enum eAudioRoutingMode
{
AudioFollowsLastVideo, SelectAudioFromDisplay
}
/// <summary>
///
/// </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>
/// The SourceListItem last run - containing names and icons. The complex setter is
/// to add/remove this room to the source's InUseTracking, if it is capable
/// </summary>
public SourceListItem CurrentSingleSourceInfo
{
get { return _CurrentSingleSourceInfo; }
private set
{
if (value == _CurrentSingleSourceInfo) return;
var handler = CurrentSingleSourceChange;
// remove from in-use tracker, if so equipped
if(_CurrentSingleSourceInfo != null && _CurrentSingleSourceInfo.SourceDevice is IInUseTracking)
(_CurrentSingleSourceInfo.SourceDevice as IInUseTracking).InUseTracker.RemoveUser(this, "control");
if (handler != null)
handler(this, _CurrentSingleSourceInfo, ChangeType.WillChange);
_CurrentSingleSourceInfo = value;
// add to in-use tracking
if (_CurrentSingleSourceInfo != null && _CurrentSingleSourceInfo.SourceDevice is IInUseTracking)
(_CurrentSingleSourceInfo.SourceDevice as IInUseTracking).InUseTracker.AddUser(this, "control");
if (handler != null)
handler(this, _CurrentSingleSourceInfo, ChangeType.DidChange);
}
}
SourceListItem _CurrentSingleSourceInfo;
public SourceListItem Display1SourceInfo
{
get { return _Display1SourceInfo; }
set
{
if (value == _Display1SourceInfo) return;
var handler = CurrentDisplay1SourceChange;
if (handler != null)
handler(this, _Display1SourceInfo, ChangeType.WillChange);
_Display1SourceInfo = value;
if (handler != null)
handler(this, _Display1SourceInfo, ChangeType.DidChange);
}
}
SourceListItem _Display1SourceInfo;
public SourceListItem Display2SourceInfo
{
get { return _Display2SourceInfo; }
set
{
if (value == _Display2SourceInfo) return;
var handler = CurrentDisplay2SourceChange;
if (handler != null)
handler(this, _Display2SourceInfo, ChangeType.WillChange);
_Display2SourceInfo = value;
if (handler != null)
handler(this, _Display2SourceInfo, ChangeType.DidChange);
}
}
SourceListItem _Display2SourceInfo;
/// <summary>
///
/// </summary>
public BoolFeedback OnFeedback { get; private set; }
/// <summary>
/// If an audio dialer is available for this room
/// </summary>
public bool HasAudioDialer { get { return false; } }
/// <summary>
///
/// </summary>
/// <param name="key"></param>
/// <param name="name"></param>
public EssentialsPresentationRoom(string key, string name,
Dictionary<uint, IRoutingSinkNoSwitching> displays,
IBasicVolumeWithFeedback defaultVolume, EssentialsPresentationRoomPropertiesConfig config)
: base(key, name)
{
Config = config;
Displays = displays;
DefaultVolumeControls = defaultVolume;
CurrentVolumeControls = defaultVolume;
//DefaultAudioDevice = defaultAudio;
//if (defaultAudio is IBasicVolumeControls)
// DefaultVolumeControls = defaultAudio as IBasicVolumeControls;
//else if (defaultAudio is IHasVolumeDevice)
// DefaultVolumeControls = (defaultAudio as IHasVolumeDevice).VolumeDevice;
OnFeedback = new BoolFeedback(() =>
{ return (CurrentSingleSourceInfo != null
&& CurrentSingleSourceInfo.Type != eSourceListItemType.Off)
|| (Display1SourceInfo != null
&& Display1SourceInfo.Type != eSourceListItemType.Off)
|| (Display2SourceInfo != null
&& Display2SourceInfo.Type != eSourceListItemType.Off);
});
SourceListKey = "default";
EnablePowerOnToLastSource = true;
}
/// <summary>
/// Run the same source to all destinations
/// </summary>
/// <param name="sourceItem"></param>
public void RouteSourceToAllDestinations(SourceListItem sourceItem)
{
if (Config.Volumes.Master != null)
{
var audioDev = DeviceManager.GetDeviceForKey(Config.Volumes.Master.DeviceKey);
if (audioDev is IBasicVolumeWithFeedback)
{
}
}
foreach (var display in Displays.Values)
{
if (sourceItem != null)
DoVideoRoute(sourceItem.SourceKey, display.Key);
else
DoVideoRoute("$off", display.Key);
}
Display1SourceInfo = sourceItem;
Display2SourceInfo = sourceItem;
CurrentSingleSourceInfo = sourceItem;
OnFeedback.FireUpdate();
}
public void SourceToDisplay1(SourceListItem sourceItem)
{
DoVideoRoute(sourceItem.SourceKey, Displays[1].Key);
Display1SourceInfo = sourceItem;
OnFeedback.FireUpdate();
}
public void SourceToDisplay2(SourceListItem sourceItem)
{
DoVideoRoute(sourceItem.SourceKey, Displays[2].Key);
Display2SourceInfo = sourceItem;
OnFeedback.FireUpdate();
}
/// <summary>
/// Basic source -> destination routing
/// </summary>
void DoVideoRoute(string sourceKey, string destinationKey)
{
new CTimer(o =>
{
var dest = DeviceManager.GetDeviceForKey(destinationKey) as IRoutingSinkNoSwitching;
if (dest == null)
{
Debug.Console(1, this, "Cannot route. Destination '{0}' not found", destinationKey);
return;
}
// off is special case
if (sourceKey.Equals("$off", StringComparison.OrdinalIgnoreCase))
{
dest.ReleaseRoute();
if (dest is IPower)
(dest as IPower).PowerOff();
return;
}
var source = DeviceManager.GetDeviceForKey(sourceKey) as IRoutingOutputs;
if (source == null)
{
Debug.Console(1, this, "Cannot route. Source '{0}' not found", sourceKey);
return;
}
dest.ReleaseAndMakeRoute(source, eRoutingSignalType.Video);
}, 0);
}
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 =>
{
Debug.Console(1, this, "Run room 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;
}
var item = dict[routeKey];
Debug.Console(2, this, "Action {0} has {1} steps",
item.SourceKey, item.RouteList.Count);
// Let's run it
if (routeKey.ToLower() != "roomoff")
LastSourceKey = routeKey;
foreach (var route in item.RouteList)
{
// if there is a $defaultAll on route, run two separate
if (route.DestinationKey.Equals("$defaultAll", StringComparison.OrdinalIgnoreCase))
{
var tempAudio = new SourceRouteListItem
{
DestinationKey = "$defaultDisplay",
SourceKey = route.SourceKey,
Type = eRoutingSignalType.Video
};
DoRoute(tempAudio);
var tempVideo = new SourceRouteListItem
{
DestinationKey = "$defaultAudio",
SourceKey = route.SourceKey,
Type = eRoutingSignalType.Audio
};
DoRoute(tempVideo);
continue;
}
else
DoRoute(route);
}
// Set volume control on room, 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;
//else if (item.VolumeControlKey.Equals("$defaultDisplay", StringComparison.OrdinalIgnoreCase))
// volDev = DefaultDisplay as IBasicVolumeControls;
// 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;
}
CurrentVolumeControls = volDev;
// store the name and UI info for routes
if (item.SourceKey != null)
CurrentSingleSourceInfo = item;
// And finally, set the "control". This will trigger event
//CurrentControlDevice = DeviceManager.GetDeviceForKey(item.SourceKey) as Device;
OnFeedback.FireUpdate();
// report back when done
if (successCallback != null)
successCallback();
}, 0); // end of CTimer
}
/// <summary>
/// Will power the room on with the last-used source
/// </summary>
public void PowerOnToDefaultOrLastSource()
{
if (!EnablePowerOnToLastSource || LastSourceKey == null)
return;
RunRouteAction(LastSourceKey);
}
/// <summary>
///
/// </summary>
/// <param name="route"></param>
/// <returns></returns>
bool DoRoute(SourceRouteListItem route)
{
IRoutingSinkNoSwitching dest = null;
if (route.DestinationKey.Equals("$defaultaudio", StringComparison.OrdinalIgnoreCase))
dest = DefaultAudioDevice;
//else if (route.DestinationKey.Equals("$defaultDisplay", StringComparison.OrdinalIgnoreCase))
// dest = DefaultDisplay;
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);
}
return true;
}
}
}

View File

@@ -1,30 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Core;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials
{
/// <summary>
///
/// </summary>
public interface IHasCurrentSourceInfoChange
{
event SourceInfoChangeHandler CurrentSingleSourceChange;
}
/// <summary>
///
/// </summary>
public class EssentialsRoomBase : Device
{
public EssentialsRoomBase(string key, string name) : base(key, name)
{
}
}
}

View File

@@ -1,96 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using Crestron.SimplSharp;
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.DM;
namespace PepperDash.Essentials
{
public class EssentialsRoomConfig : DeviceConfig
{
/// <summary>
/// Returns a room object from this config data
/// </summary>
/// <returns></returns>
public Device GetRoomObject()
{
var typeName = Type.ToLower();
if (typeName == "huddle")
{
var props = JsonConvert.DeserializeObject<EssentialsHuddleRoomPropertiesConfig>
(this.Properties.ToString());
var disp = DeviceManager.GetDeviceForKey(props.DefaultDisplayKey) as IRoutingSinkWithSwitching;
var audio = DeviceManager.GetDeviceForKey(props.DefaultAudioKey) as IRoutingSinkNoSwitching;
var huddle = new EssentialsHuddleSpaceRoom(Key, Name, disp, audio, props);
huddle.SourceListKey = props.SourceListKey;
return huddle;
}
else if (typeName == "presentation")
{
var props = JsonConvert.DeserializeObject<EssentialsPresentationRoomPropertiesConfig>
(this.Properties.ToString());
var displaysDict = new Dictionary<uint, IRoutingSinkNoSwitching>();
uint i = 1;
foreach (var dispKey in props.DisplayKeys) // read in the ordered displays list
{
var disp = DeviceManager.GetDeviceForKey(dispKey) as IRoutingSinkWithSwitching;
displaysDict.Add(i++, disp);
}
// Get the master volume control
IBasicVolumeWithFeedback masterVolumeControlDev = props.Volumes.Master.GetDevice();
#warning Will need to define audio routing somewhere as well
var presRoom = new EssentialsPresentationRoom(Key, Name, displaysDict, masterVolumeControlDev, props);
return presRoom;
}
return null;
}
}
/// <summary>
///
/// </summary>
public class EssentialsRoomPropertiesConfig
{
public string HelpMessage { get; set; }
public string Description { get; set; }
}
/// <summary>
///
/// </summary>
public class EssentialsHuddleRoomPropertiesConfig : EssentialsRoomPropertiesConfig
{
public string DefaultDisplayKey { get; set; }
public string DefaultAudioKey { get; set; }
public string SourceListKey { get; set; }
}
/// <summary>
///
/// </summary>
public class EssentialsPresentationRoomPropertiesConfig : EssentialsRoomPropertiesConfig
{
public string DefaultAudioBehavior { get; set; }
public string DefaultAudioKey { get; set; }
public string DefaultVideoBehavior { get; set; }
public List<string> DisplayKeys { get; set; }
public string SourceListKey { get; set; }
public bool HasDsp { get; set; }
public EssentialsPresentationVolumesConfig Volumes { get; set; }
public EssentialsPresentationRoomPropertiesConfig()
{
DisplayKeys = new List<string>();
}
}
}

View File

@@ -1,41 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Core;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials
{
/// <summary>
///
/// </summary>
public class VolumeDeviceChangeEventArgs : EventArgs
{
public IBasicVolumeControls OldDev { get; private set; }
public IBasicVolumeControls NewDev { get; private set; }
public ChangeType Type { get; private set; }
public VolumeDeviceChangeEventArgs(IBasicVolumeControls oldDev, IBasicVolumeControls newDev, ChangeType type)
{
OldDev = oldDev;
NewDev = newDev;
Type = type;
}
}
/// <summary>
/// The handler type for a Room's SourceInfoChange
/// </summary>
public delegate void SourceInfoChangeHandler(EssentialsRoomBase room, SourceListItem info, ChangeType type);
/// <summary>
///
/// </summary>
public enum ChangeType
{
WillChange, DidChange
}
}

View File

@@ -1,353 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
namespace PepperDash.Essentials
{
/// <summary>
/// Where all UI element common joins are defined
/// </summary>
public class UIBoolJoin
{
/// <summary>
/// 901
/// </summary>
public const uint VolumeUpPress = 901;
/// <summary>
/// 902
/// </summary>
public const uint VolumeDownPress = 902;
/// <summary>
/// 3811
/// </summary>
public const uint VolumeSingleMute1Visible = 3811;
/// <summary>
/// 3812
/// </summary>
public const uint VolumeSlider1Press = 3812;
/// <summary>
/// 3813
/// </summary>
public const uint Volume1ProgramMutePressAndFB = 3813;
/// <summary>
/// 3871
/// </summary>
public const uint VolumeDualMute1Visible = 3871;
/// <summary>
/// 3874
/// </summary>
public const uint Volume1SpeechMutePressAndFB = 3874;
/// <summary>
/// 3875
/// </summary>
public const uint Volume1BackerVisibility = 3875;
/// <summary>
/// 3821
/// </summary>
public const uint Volume2Visible = 3821;
/// <summary>
/// 3822
/// </summary>
public const uint VolumeSlider2Press = 3822;
/// <summary>
/// 3823
/// </summary>
public const uint Volume2MutePressAndFB = 3823;
/// <summary>
/// 3831
/// </summary>
public const uint Volume3Visible = 3831;
/// <summary>
/// 3832
/// </summary>
public const uint VolumeSlider3Press = 3832;
/// <summary>
/// 3833
/// </summary>
public const uint Volume3MutePressAndFB = 3833;
/// <summary>
/// 3841
/// </summary>
public const uint Volume4Visible = 3841;
/// <summary>
/// 3842
/// </summary>
public const uint VolumeSlider4Press = 3842;
/// <summary>
/// 3843
/// </summary>
public const uint Volume4MutePressAndFB = 3843;
/// <summary>
/// 3851
/// </summary>
public const uint Volume5Visible = 3851;
/// <summary>
/// 3852
/// </summary>
public const uint VolumeSlider5Press = 3852;
/// <summary>
/// 3853
/// </summary>
public const uint Volume5MutePressAndFB = 3853;
/// <summary>
/// 3861
/// </summary>
public const uint Volume6Visible = 3861;
/// <summary>
/// 3862
/// </summary>
public const uint VolumeSlider6Press = 3862;
/// <summary>
/// 3863
/// </summary>
public const uint Volume6MutePressAndFB = 3863;
/// <summary>
/// 3870
/// </summary>
public const uint VolumesPageVisible = 3870;
/// <summary>
/// 3999
/// </summary>
public const uint GenericModalVisible = 3999;
/// <summary>
/// 12345
/// </summary>
public const uint AvNoControlsSubVisible = 12345;
/// <summary>
/// 15001
/// </summary>
public const uint StartPageVisible = 15001;
/// <summary>
/// 15002 Shows the start page in the source controls area of the screen
/// </summary>
public const uint TapToBeginVisible = 15002;
/// <summary>
/// 15003 Message text when no source is showing
/// </summary>
public const uint SelectASourceVisible = 15003;
/// <summary>
/// 15004
/// </summary>
public const uint RoomIsOn = 15004;
/// <summary>
/// 15005 Shows always-on volume control subpage with only audio mute
/// </summary>
public const uint VolumeControlsSingleMuteVisible = 15005;
/// <summary>
/// 15006 Shows always-on volume control subpage with mic and audio mutes
/// </summary>
public const uint VolumeControlsDualMuteVisible = 15006;
/// <summary>
/// 15010
/// </summary>
public const uint ShowPanelSetupPress = 15010;
/// <summary>
/// 15011
/// </summary>
public const uint TopBarVisible = 15011;
/// <summary>
/// 15012
/// </summary>
public const uint StagingPageVisible = 15012;
/// <summary>
/// 15013
/// </summary>
public const uint PowerOffStep1Visible = 15013;
/// <summary>
/// 15014
/// </summary>
public const uint PowerOffStep2Visible = 15014;
/// <summary>
/// 15015
/// </summary>
public const uint ShowPowerOffPress = 15015;
/// <summary>
/// 15016
/// </summary>
public const uint PowerOffMorePress = 15016;
/// <summary>
/// 15017
/// </summary>
public const uint StagingPageAdditionalArrowsVisible = 15017;
/// <summary>
/// 15020
/// </summary>
public const uint PanelSetupVisible = 15020;
/// <summary>
/// 15021
/// </summary>
public const uint SourceWaitOverlayVisible = 15021;
/// <summary>
/// 15022
/// </summary>
public const uint ActivityFooterVisible = 15022;
/// <summary>
/// 15023
/// </summary>
public const uint LightsHeaderButtonVisible = 15023;
/// <summary>
/// 15024
/// </summary>
public const uint CallRightHeaderButtonVisible = 15024;
/// <summary>
/// 15025
/// </summary>
public const uint CallLeftHeaderButtonVisible = 15025;
/// <summary>
/// 15026
/// </summary>
public const uint LightsHeaderButtonPress = 15026;
/// <summary>
/// 15027
/// </summary>
public const uint CallHeaderButtonPress = 15027;
/// <summary>
/// 15028 The gear button in header
/// </summary>
public const uint GearHeaderButtonPress = 15028;
/// <summary>
/// 15029 the room button in header
/// </summary>
public const uint RoomHeaderButtonPress = 15029;
/// <summary>
/// 15030 Visibility for room data popup
/// </summary>
public const uint RoomHeaderPageVisible = 15030;
/// <summary>
/// 15031
/// </summary>
public const uint AllRoomsOffPress = 15031;
/// <summary>
/// 15032
/// </summary>
public const uint DisplayPowerTogglePress = 15032;
/// <summary>
/// 15033
/// </summary>
public const uint PowerOffCancelPress = 15033;
/// <summary>
/// 15034
/// </summary>
public const uint PowerOffConfirmPress = 15034;
/// <summary>
/// 15035
/// </summary>
public const uint VolumeButtonPopupPress = 15035;
/// <summary>
/// 15035
/// </summary>
public const uint VolumeButtonPopupVisible = 15035;
/// <summary>
/// 15036
/// </summary>
public const uint VolumeGaugePopupVisible = 15036;
/// <summary>
/// 15040
/// </summary>
public const uint CallStatusPageVisible = 15040;
/// <summary>
/// 15041
/// </summary>
public const uint LightsPageVisible = 15041;
/// <summary>
/// 15042 Closes whichever interlocked modal is open
/// </summary>
public const uint InterlockedModalClosePress = 15042;
/// <summary>
/// 15043 Vis for modal backer for full-screen source
/// </summary>
public const uint SourceBackgroundOverlayVisible = 15043;
/// <summary>
/// 15044 Close button for source modal overlay
/// </summary>
public const uint SourceBackgroundOverlayClosePress = 15044;
/// <summary>
/// 15051
/// </summary>
public const uint Display1SelectPressAndFb = 15051;
/// <summary>
/// 15052
/// </summary>
public const uint Display1ControlButtonEnable = 15052;
/// <summary>
/// 15053
/// </summary>
public const uint Display1ControlButtonPress = 15053;
/// <summary>
/// 15054
/// </summary>
public const uint Display1AudioButtonEnable = 15054;
/// <summary>
/// 15055
/// </summary>
public const uint Display1AudioButtonPressAndFb = 15055;
/// <summary>
/// 15056
/// </summary>
public const uint Display2SelectPressAndFb = 15056;
/// <summary>
/// 15057
/// </summary>
public const uint Display2ControlButtonEnable = 15057;
/// <summary>
/// 15058
/// </summary>
public const uint Display2ControlButtonPress = 15058;
/// <summary>
/// 15059
/// </summary>
public const uint Display2AudioButtonEnable = 15059;
/// <summary>
/// 15060
/// </summary>
public const uint Display2AudioButtonPressAndFb = 15060;
/// <summary>
/// 15061 Reveals the dual-display subpage
/// </summary>
public const uint DualDisplayPageVisible = 15061;
/// <summary>
/// 15062 Reveals the toggle switch for the sharing mode
/// </summary>
public const uint ToggleSharingModeVisible = 15062;
/// <summary>
/// 15063 Press for the toggle mode switch
/// </summary>
public const uint ToggleSharingModePress = 15063;
/// <summary>
/// 15085 Visibility join for help subpage
/// </summary>
public const uint HelpPageVisible = 15085;
/// <summary>
/// 15086 Press for help header button
/// </summary>
public const uint HelpPress = 15086;
/// <summary>
/// 15088
/// </summary>
public const uint DateOnlyVisible = 15088;
/// <summary>
/// 15089
/// </summary>
public const uint TimeOnlyVisible = 15089;
/// <summary>
/// 15090
/// </summary>
public const uint DateAndTimeVisible = 15090;
/// <summary>
/// 15091
/// </summary>
public const uint SetupFullDistrib = 15091;
}
}

View File

@@ -1,14 +0,0 @@
namespace PepperDash.Essentials
{
public class UISmartObjectJoin
{
/// <summary>
/// 3200 The staging, source-select list
/// </summary>
public const uint StagingListSRL = 3200;
/// <summary>
/// 15022 The main activity footer
/// </summary>
public const uint ActivityFooterSRL = 15022;
}
}

View File

@@ -1,92 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
namespace PepperDash.Essentials
{
/// <summary>
///
/// </summary>
public class UIStringJoin
{
/// <summary>
/// 3812
/// </summary>
public const uint AdvancedVolumeSlider1Text = 3812;
/// <summary>
/// 3822
/// </summary>
public const uint AdvancedVolumeSlider2Text = 3822;
/// <summary>
/// 3832
/// </summary>
public const uint AdvancedVolumeSlider3Text = 3832;
/// <summary>
/// 3842
/// </summary>
public const uint AdvancedVolumeSlider4Text = 3842;
/// <summary>
/// 3852
/// </summary>
public const uint AdvancedVolumeSlider5Text = 3852;
/// <summary>
/// 3862
/// </summary>
public const uint AdvancedVolumeSlider6Text = 3862;
/// <summary>
/// 3901
/// </summary>
public const uint CurrentRoomName = 3901;
/// <summary>
/// 3902
/// </summary>
public const uint CurrentSourceName = 3902;
/// <summary>
/// 3903
/// </summary>
public const uint CurrentSourceIcon = 3903;
/// <summary>
/// 3911
/// </summary>
public const uint PowerOffMessage = 3911;
/// <summary>
/// 3912
/// </summary>
public const uint StartPageMessage = 3912;
/// <summary>
/// 3913
/// </summary>
public const uint StartActivityText = 3913;
/// <summary>
/// 3914 Title bar label for source overlay
/// </summary>
public const uint SourceBackgroundOverlayTitle = 3914;
/// <summary>
/// 3922
/// </summary>
public const uint HelpMessage = 3922;
/// <summary>
/// 3961 Name of source on display 1
/// </summary>
public const uint Display1SourceLabel = 3961;
/// <summary>
/// 3962 Title above display 1
/// </summary>
public const uint Display1TitleLabel = 3962;
/// <summary>
/// 3964 Name of source on display 2
/// </summary>
public const uint Display2SourceLabel = 3964;
/// <summary>
/// 3965 Title above display 2
/// </summary>
public const uint Display2TitleLabel = 3965;
}
}

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 Core\PepperDashEssentialsBase\PepperDash_Essentials_Core.csproj", "{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Essentials Devices Common", "..\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 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

@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Essentials.Core.Config;
using Newtonsoft.Json;
namespace PepperDash.Essentials
{
/// <summary>
///
/// </summary>
public class CotijaConfig
{
[JsonProperty("serverUrl")]
public string ServerUrl { get; set; }
[JsonProperty("clientAppUrl")]
public string ClientAppUrl { get; set; }
}
/// <summary>
///
/// </summary>
public class CotijaDdvc01RoomBridgePropertiesConfig
{
[JsonProperty("eiscId")]
public string EiscId { get; set; }
}
}

View File

@@ -0,0 +1,148 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro.EthernetCommunication;
using PepperDash.Core;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Room.Cotija
{
/// <summary>
/// Represents a generic device connection through to and EISC for DDVC01
/// </summary>
public class CotijaDdvc01DeviceBridge : Device, IChannel, INumericKeypad
{
/// <summary>
/// EISC used to talk to Simpl
/// </summary>
ThreeSeriesTcpIpEthernetIntersystemCommunications EISC;
public CotijaDdvc01DeviceBridge(string key, string name, ThreeSeriesTcpIpEthernetIntersystemCommunications eisc)
: base(key, name)
{
EISC = eisc;
}
#region IChannel Members
public void ChannelUp(bool pressRelease)
{
EISC.SetBool(1111, pressRelease);
}
public void ChannelDown(bool pressRelease)
{
EISC.SetBool(1111, pressRelease);
}
public void LastChannel(bool pressRelease)
{
EISC.SetBool(1111, pressRelease);
}
public void Guide(bool pressRelease)
{
EISC.SetBool(1111, pressRelease);
}
public void Info(bool pressRelease)
{
EISC.SetBool(1111, pressRelease);
}
public void Exit(bool pressRelease)
{
EISC.SetBool(1111, pressRelease);
}
#endregion
#region INumericKeypad Members
public void Digit0(bool pressRelease)
{
EISC.SetBool(1111, pressRelease);
}
public void Digit1(bool pressRelease)
{
EISC.SetBool(1111, pressRelease);
}
public void Digit2(bool pressRelease)
{
EISC.SetBool(1111, pressRelease);
}
public void Digit3(bool pressRelease)
{
EISC.SetBool(1111, pressRelease);
}
public void Digit4(bool pressRelease)
{
EISC.SetBool(1111, pressRelease);
}
public void Digit5(bool pressRelease)
{
EISC.SetBool(1111, pressRelease);
}
public void Digit6(bool pressRelease)
{
EISC.SetBool(1111, pressRelease);
}
public void Digit7(bool pressRelease)
{
EISC.SetBool(1111, pressRelease);
}
public void Digit8(bool pressRelease)
{
EISC.SetBool(1111, pressRelease);
}
public void Digit9(bool pressRelease)
{
EISC.SetBool(1111, pressRelease);
}
public bool HasKeypadAccessoryButton1
{
get { throw new NotImplementedException(); }
}
public string KeypadAccessoryButton1Label
{
get { throw new NotImplementedException(); }
}
public void KeypadAccessoryButton1(bool pressRelease)
{
throw new NotImplementedException();
}
public bool HasKeypadAccessoryButton2
{
get { throw new NotImplementedException(); }
}
public string KeypadAccessoryButton2Label
{
get { throw new NotImplementedException(); }
}
public void KeypadAccessoryButton2(bool pressRelease)
{
throw new NotImplementedException();
}
#endregion
}
}

View File

@@ -0,0 +1,864 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Crestron.SimplSharp.Reflection;
using Crestron.SimplSharpPro.CrestronThread;
using Crestron.SimplSharp.CrestronWebSocketClient;
using Crestron.SimplSharpPro;
using Crestron.SimplSharp.Net.Http;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
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
{
public class CotijaSystemController : Device
{
WebSocketClient WSClient;
//bool LinkUp;
/// <summary>
/// Prevents post operations from stomping on each other and getting lost
/// </summary>
CEvent PostLockEvent = new CEvent(true, true);
CEvent RegisterLockEvent = new CEvent(true, true);
public CotijaConfig Config { get; private set; }
Dictionary<string, Object> ActionDictionary = new Dictionary<string, Object>(StringComparer.InvariantCultureIgnoreCase);
Dictionary<string, CTimer> PushedActions = new Dictionary<string, CTimer>();
public ConfigMessenger ConfigMessenger { get; private set; }
CTimer ServerHeartbeatCheckTimer;
long ServerHeartbeatInterval = 20000;
CTimer ServerReconnectTimer;
long ServerReconnectInterval = 5000;
DateTime LastAckMessage;
public string SystemUuid;
List<CotijaBridgeBase> RoomBridges = new List<CotijaBridgeBase>();
long ButtonHeartbeatInterval = 1000;
/// <summary>
/// Used for tracking HTTP debugging
/// </summary>
bool HttpDebugEnabled;
/// <summary>
///
/// </summary>
/// <param name="key"></param>
/// <param name="name"></param>
/// <param name="config"></param>
public CotijaSystemController(string key, string name, CotijaConfig config) : base(key, name)
{
Config = config;
SystemUuid = ConfigReader.ConfigObject.SystemUuid;
Debug.Console(0, this, "Mobile UI controller initializing for server:{0}", config.ServerUrl);
CrestronConsole.AddNewConsoleCommand(AuthorizeSystem,
"mobileauth", "Authorizes system to talk to cotija server", ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(s => ShowInfo(),
"mobileinfo", "Shows information for current mobile control session", ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(s => {
s = s.Trim();
if(!string.IsNullOrEmpty(s))
{
HttpDebugEnabled = (s.Trim() != "0");
}
CrestronConsole.ConsoleCommandResponse("HTTP Debug {0}", HttpDebugEnabled ? "Enabled" : "Disabled");
},
"mobilehttpdebug", "1 enables more verbose HTTP response debugging", ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(TestHttpRequest,
"mobilehttprequest", "Tests an HTTP get to URL given", ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(PrintActionDictionaryPaths, "mobileshowactionpaths",
"Prints the paths in the Action Dictionary", ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(s => ConnectWebsocketClient(), "mobileconnect",
"Forces connect of websocket", ConsoleAccessLevelEnum.AccessOperator);
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>
/// If config rooms is empty or null then go
/// </summary>
/// <returns></returns>
public override bool CustomActivate()
{
if (ConfigReader.ConfigObject.Rooms == null || ConfigReader.ConfigObject.Rooms.Count == 0)
{
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "Config contains no rooms. Registering with Server.");
RegisterSystemToServer();
}
return base.CustomActivate();
}
/// <summary>
///
/// </summary>
/// <param name="ethernetEventArgs"></param>
void CrestronEnvironment_EthernetEventHandler(EthernetEventArgs args)
{
Debug.Console(1, this, Debug.ErrorLogLevel.Warning, "Ethernet status change, port {0}: {1}",
args.EthernetAdapter, args.EthernetEventType);
if (args.EthernetEventType == eEthernetEventType.LinkDown && WSClient != null && args.EthernetAdapter == WSClient.EthernetAdapter)
{
CleanUpWebsocketClient();
}
}
/// <summary>
/// Sends message to server to indicate the system is shutting down
/// </summary>
/// <param name="programEventType"></param>
void CrestronEnvironment_ProgramStatusEventHandler(eProgramStatusEventType programEventType)
{
if (programEventType == eProgramStatusEventType.Stopping
&& WSClient != null
&& WSClient.Connected)
{
CleanUpWebsocketClient();
}
}
public void PrintActionDictionaryPaths(object o)
{
Debug.Console(0, this, "ActionDictionary Contents:");
foreach (var item in ActionDictionary)
{
Debug.Console(0, this, "{0}", item.Key);
}
}
/// <summary>
/// Adds an action to the dictionary
/// </summary>
/// <param name="key">The path of the API command</param>
/// <param name="action">The action to be triggered by the commmand</param>
public void AddAction(string key, object action)
{
if (!ActionDictionary.ContainsKey(key))
{
ActionDictionary.Add(key, action);
}
else
{
Debug.Console(1, this, "Cannot add action with key '{0}' because key already exists in ActionDictionary.", key);
}
}
/// <summary>
/// Removes an action from the dictionary
/// </summary>
/// <param name="key"></param>
public void RemoveAction(string key)
{
if (ActionDictionary.ContainsKey(key))
ActionDictionary.Remove(key);
}
/// <summary>
///
/// </summary>
/// <param name="bridge"></param>
public void AddBridge(CotijaBridgeBase bridge)
{
RoomBridges.Add(bridge);
var b = bridge as IDelayedConfiguration;
if (b != null)
{
Debug.Console(0, this, "Adding room bridge with delayed configuration");
b.ConfigurationIsReady += new EventHandler<EventArgs>(bridge_ConfigurationIsReady);
}
else
{
Debug.Console(0, this, "Adding room bridge and sending configuration");
//SystemUuid = ConfigReader.ConfigObject.SystemUuid;
RegisterSystemToServer();
}
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void bridge_ConfigurationIsReady(object sender, EventArgs e)
{
Debug.Console(1, this, "Bridge ready. Registering");
//SystemUuid = ConfigReader.ConfigObject.SystemUuid;
// send the configuration object to the server
RegisterSystemToServer();
}
/// <summary>
///
/// </summary>
/// <param name="o"></param>
void ReconnectToServerTimerCallback(object o)
{
RegisterSystemToServer();
}
/// <summary>
/// Verifies system connection with servers
/// </summary>
/// <param name="command"></param>
void AuthorizeSystem(string code)
{
//SystemUuid = ConfigReader.ConfigObject.SystemUuid;
if (string.IsNullOrEmpty(SystemUuid))
{
CrestronConsole.ConsoleCommandResponse("System does not have a UUID. Please ensure proper portal-format configuration is loaded and restart.");
return;
}
if (string.IsNullOrEmpty(code))
{
CrestronConsole.ConsoleCommandResponse("Please enter a user code to authorize a system");
return;
}
var req = new HttpClientRequest();
string url = string.Format("http://{0}/api/system/grantcode/{1}/{2}", Config.ServerUrl, code, SystemUuid);
Debug.Console(0, this, "Authorizing to: {0}", url);
if (string.IsNullOrEmpty(Config.ServerUrl))
{
CrestronConsole.ConsoleCommandResponse("Config URL address is not set. Check portal configuration");
return;
}
try
{
req.Url.Parse(url);
new HttpClient().DispatchAsync(req, (r, e) =>
{
CheckHttpDebug(r, e);
if (e == HTTP_CALLBACK_ERROR.COMPLETED)
{
if (r.Code == 200)
{
Debug.Console(0, "System authorized, sending config.");
#warning This registration may need to wait for config ready. Maybe.
RegisterSystemToServer();
}
else if (r.Code == 404)
{
if (r.ContentString.Contains("codeNotFound"))
{
Debug.Console(0, "Authorization failed, code not found for system UUID {0}", SystemUuid);
}
else if (r.ContentString.Contains("uuidNotFound"))
{
Debug.Console(0, "Authorization failed, uuid {0} not found. Check Essentials configuration is correct",
SystemUuid);
}
}
}
else
Debug.Console(0, this, "Error {0} in authorizing system", e);
});
}
catch (Exception e)
{
Debug.Console(0, this, "Error in authorizing: {0}", e);
}
}
/// <summary>
/// Dumps info in response to console command.
/// </summary>
void ShowInfo()
{
var url = Config != null ? Config.ServerUrl : "No config";
string name;
string code;
if (RoomBridges != null && RoomBridges.Count > 0)
{
name = RoomBridges[0].RoomName;
code = RoomBridges[0].UserCode;
}
else
{
name = "No config";
code = "Not available";
}
var conn = WSClient == null ? "No client" : (WSClient.Connected ? "Yes" : "No");
var secSinceLastAck = DateTime.Now - LastAckMessage;
CrestronConsole.ConsoleCommandResponse(@"Mobile Control Information:
Server address: {0}
System Name: {1}
System URL: {2}
System UUID: {3}
System User code: {4}
Connected?: {5}
Seconds Since Last Ack: {6}"
, url, name, ConfigReader.ConfigObject.SystemUrl, SystemUuid,
code, conn, secSinceLastAck.Seconds);
}
/// <summary>
/// Registers the room with the server
/// </summary>
/// <param name="url">URL of the server, including the port number, if not 80. Format: "serverUrlOrIp:port"</param>
void RegisterSystemToServer()
{
ConnectWebsocketClient();
}
/// <summary>
/// Connects the Websocket Client
/// </summary>
/// <param name="o"></param>
void ConnectWebsocketClient()
{
Debug.Console(1, this, "Initializing Stream client to server.");
if (WSClient != null)
{
Debug.Console(1, this, "Cleaning up previous socket");
CleanUpWebsocketClient();
}
WSClient = new WebSocketClient();
WSClient.URL = string.Format("wss://{0}/system/join/{1}", Config.ServerUrl, this.SystemUuid);
WSClient.ConnectionCallBack = Websocket_ConnectCallback;
WSClient.ConnectAsync();
}
/// <summary>
///
/// </summary>
/// <param name="code"></param>
/// <returns></returns>
int Websocket_ConnectCallback(WebSocketClient.WEBSOCKET_RESULT_CODES code)
{
if (code == WebSocketClient.WEBSOCKET_RESULT_CODES.WEBSOCKET_CLIENT_SUCCESS)
{
StopServerReconnectTimer();
Debug.Console(1, this, "Websocket connected");
WSClient.DisconnectCallBack = Websocket_DisconnectCallback;
WSClient.SendCallBack = Websocket_SendCallback;
WSClient.ReceiveCallBack = Websocket_ReceiveCallback;
WSClient.ReceiveAsync();
SendMessageObjectToServer(new
{
type = "hello"
});
}
else
{
if (code == WebSocketClient.WEBSOCKET_RESULT_CODES.WEBSOCKET_CLIENT_HTTP_HANDSHAKE_TOKEN_ERROR)
{
// This is the case when app server is running behind a websever and app server is down
Debug.Console(1, this, Debug.ErrorLogLevel.Warning, "Web socket connection failed. Check that app server is running behind web server");
}
else if (code == WebSocketClient.WEBSOCKET_RESULT_CODES.WEBSOCKET_CLIENT_SOCKET_CONNECTION_FAILED)
{
// this will be the case when webserver is unreachable
Debug.Console(1, this, Debug.ErrorLogLevel.Warning, "Web socket connection failed");
}
else
{
Debug.Console(1, this, Debug.ErrorLogLevel.Warning, "Web socket connection failure: {0}", code);
}
StartServerReconnectTimer();
}
return 0;
}
/// <summary>
/// After a "hello" from the server, sends config and stuff
/// </summary>
void SendInitialMessage()
{
Debug.Console(1, this, "Sending initial join message");
var confObject = ConfigReader.ConfigObject;
confObject.Info.RuntimeInfo.AppName = Assembly.GetExecutingAssembly().GetName().Name;
var version = Assembly.GetExecutingAssembly().GetName().Version;
confObject.Info.RuntimeInfo.AssemblyVersion = string.Format("{0}.{1}.{2}", version.Major, version.Minor, version.Build);
var msg = new
{
type = "join",
content = new
{
config = confObject
}
};
SendMessageObjectToServer(msg);
}
/// <summary>
/// Sends any object type to server
/// </summary>
/// <param name="o"></param>
public void SendMessageObjectToServer(object o)
{
SendMessageToServer(JObject.FromObject(o));
}
/// <summary>
/// Sends a message to the server from a room
/// </summary>
/// <param name="room">room from which the message originates</param>
/// <param name="o">object to be serialized and sent in post body</param>
public void SendMessageToServer(JObject o)
{
if (WSClient != null && WSClient.Connected)
{
string message = JsonConvert.SerializeObject(o, Formatting.None, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
if (!message.Contains("/system/heartbeat"))
Debug.Console(1, this, "Message TX: {0}", message);
//else
// Debug.Console(1, this, "TX messages contains /system/heartbeat");
var messageBytes = System.Text.Encoding.UTF8.GetBytes(message);
var result = WSClient.Send(messageBytes, (uint)messageBytes.Length, WebSocketClient.WEBSOCKET_PACKET_TYPES.LWS_WS_OPCODE_07__TEXT_FRAME);
if (result != WebSocketClient.WEBSOCKET_RESULT_CODES.WEBSOCKET_CLIENT_SUCCESS)
{
Debug.Console(1, this, "Socket send result error: {0}", result);
}
}
else if (WSClient == null)
{
Debug.Console(1, this, "Cannot send. Not connected.");
}
}
/// <summary>
/// Disconnects the SSE Client and stops the heartbeat timer
/// </summary>
/// <param name="command"></param>
void CleanUpWebsocketClient()
{
Debug.Console(1, this, "Disconnecting websocket");
if (WSClient != null)
{
WSClient.SendCallBack = null;
WSClient.ReceiveCallBack = null;
WSClient.ConnectionCallBack = null;
WSClient.DisconnectCallBack = null;
if (WSClient.Connected)
{
WSClient.Disconnect();
}
WSClient = null;
}
}
/// <summary>
///
/// </summary>
/// <param name="dueTime"></param>
/// <param name="repeatTime"></param>
void StartServerReconnectTimer()
{
StopServerReconnectTimer();
ServerReconnectTimer = new CTimer(ReconnectToServerTimerCallback, ServerReconnectInterval);
Debug.Console(1, this, "Reconnect Timer Started.");
}
/// <summary>
/// Does what it says
/// </summary>
void StopServerReconnectTimer()
{
if (ServerReconnectTimer != null)
{
ServerReconnectTimer.Stop();
ServerReconnectTimer = null;
}
}
/// <summary>
/// Executes when we don't get a heartbeat message in time. Triggers reconnect.
/// </summary>
/// <param name="o">For CTimer callback. Not used</param>
void HeartbeatExpiredTimerCallback(object o)
{
Debug.Console(1, this, "Heartbeat Timer Expired.");
if (ServerHeartbeatCheckTimer != null)
{
ServerHeartbeatCheckTimer.Stop();
ServerHeartbeatCheckTimer = null;
}
CleanUpWebsocketClient();
StartServerReconnectTimer();
}
/// <summary>
///
/// </summary>
/// <param name="dueTime"></param>
/// <param name="repeatTime"></param>
void ResetOrStartHearbeatTimer()
{
if (ServerHeartbeatCheckTimer == null)
{
ServerHeartbeatCheckTimer = new CTimer(HeartbeatExpiredTimerCallback, null, ServerHeartbeatInterval, ServerHeartbeatInterval);
Debug.Console(1, this, "Heartbeat Timer Started.");
}
else
{
ServerHeartbeatCheckTimer.Reset(ServerHeartbeatInterval, ServerHeartbeatInterval);
}
}
/// <summary>
/// Waits two and goes again
/// </summary>
void ReconnectStreamClient()
{
new CTimer(o => ConnectWebsocketClient(), 2000);
}
/// <summary>
///
/// </summary>
/// <param name="code"></param>
/// <returns></returns>
int Websocket_DisconnectCallback(WebSocketClient.WEBSOCKET_RESULT_CODES code, object o)
{
Debug.Console(1, this, Debug.ErrorLogLevel.Warning, "Websocket disconnected with code: {0}", code);
if (ServerHeartbeatCheckTimer != null)
ServerHeartbeatCheckTimer.Stop();
// Start the reconnect timer
StartServerReconnectTimer();
return 0;
}
/// <summary>
/// Resets reconnect timer and updates usercode
/// </summary>
/// <param name="content"></param>
void HandleHeartBeat(JToken content)
{
SendMessageToServer(JObject.FromObject(new
{
type = "/system/heartbeatAck"
}));
var code = content["userCode"];
if(code != null)
{
foreach (var b in RoomBridges)
{
b.SetUserCode(code.Value<string>());
}
}
ResetOrStartHearbeatTimer();
}
/// <summary>
/// Outputs debug info when enabled
/// </summary>
/// <param name="req"></param>
/// <param name="r"></param>
/// <param name="e"></param>
void CheckHttpDebug(HttpClientResponse r, HTTP_CALLBACK_ERROR e)
{
if (HttpDebugEnabled)
{
try
{
Debug.Console(0, this, "------ Begin HTTP Debug ---------------------------------------");
if (r != null)
{
Debug.Console(0, this, "HTTP Response URL: {0}", r.ResponseUrl != null ? r.ResponseUrl.ToString() : "NONE");
Debug.Console(0, this, "HTTP Response code: {0}", r.Code);
Debug.Console(0, this, "HTTP Response content: \r{0}", r.ContentString);
}
else
{
Debug.Console(0, this, "No HTTP response");
}
Debug.Console(0, this, "HTTP Response 'error' {0}", e);
Debug.Console(0, this, "------ End HTTP Debug -----------------------------------------");
}
catch (Exception ex)
{
Debug.Console(0, this, "HttpDebugError: {0}", ex);
}
}
}
/// <summary>
///
/// </summary>
/// <param name="data"></param>
/// <param name="length"></param>
/// <param name="opcode"></param>
/// <param name="err"></param>
int Websocket_ReceiveCallback(byte[] data, uint length, WebSocketClient.WEBSOCKET_PACKET_TYPES opcode,
WebSocketClient.WEBSOCKET_RESULT_CODES err)
{
if (opcode == WebSocketClient.WEBSOCKET_PACKET_TYPES.LWS_WS_OPCODE_07__TEXT_FRAME)
{
var rx = System.Text.Encoding.UTF8.GetString(data, 0, (int)length);
if (rx.Length > 0)
ParseStreamRx(rx);
WSClient.ReceiveAsync();
}
else if (opcode == WebSocketClient.WEBSOCKET_PACKET_TYPES.LWS_WS_OPCODE_07__CLOSE)
{
Debug.Console(1, this, "Websocket disconnect received from remote");
CleanUpWebsocketClient();
}
else
{
Debug.Console(1, this, "websocket rx opcode/err {0}/{1}", opcode, err);
WSClient.ReceiveAsync();
}
return 0;
}
/// <summary>
/// Callback to catch possible errors in sending via the websocket
/// </summary>
/// <param name="result"></param>
/// <returns></returns>
int Websocket_SendCallback(Crestron.SimplSharp.CrestronWebSocketClient.WebSocketClient.WEBSOCKET_RESULT_CODES result)
{
if(result != WebSocketClient.WEBSOCKET_RESULT_CODES.WEBSOCKET_CLIENT_SUCCESS)
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "SendCallback questionable result: {0}", result);
return 1;
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void ParseStreamRx(string message)
{
if(string.IsNullOrEmpty(message))
return;
if (!message.Contains("/system/heartbeat"))
{
Debug.Console(1, this, "Message RX: {0}", message);
}
else
{
LastAckMessage = DateTime.Now;
}
try
{
var messageObj = JObject.Parse(message);
var type = messageObj["type"].Value<string>();
if (type == "hello")
{
SendInitialMessage();
ResetOrStartHearbeatTimer();
}
else if (type == "/system/heartbeat")
{
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.");
// DisconnectWebsocketClient();
if (ServerHeartbeatCheckTimer != null)
ServerHeartbeatCheckTimer.Stop();
}
else
{
// Check path against Action dictionary
if (ActionDictionary.ContainsKey(type))
{
var action = ActionDictionary[type];
if (action is Action)
{
(action as Action)();
}
else if (action is PressAndHoldAction)
{
var stateString = messageObj["content"]["state"].Value<string>();
// Look for a button press event
if (!string.IsNullOrEmpty(stateString))
{
switch (stateString)
{
case "true":
{
if (!PushedActions.ContainsKey(type))
{
PushedActions.Add(type, new CTimer(o =>
{
(action as PressAndHoldAction)(false);
PushedActions.Remove(type);
}, null, ButtonHeartbeatInterval, ButtonHeartbeatInterval));
}
// Maybe add an else to reset the timer
break;
}
case "held":
{
if (PushedActions.ContainsKey(type))
{
PushedActions[type].Reset(ButtonHeartbeatInterval, ButtonHeartbeatInterval);
}
return;
}
case "false":
{
if (PushedActions.ContainsKey(type))
{
PushedActions[type].Stop();
PushedActions.Remove(type);
}
break;
}
}
(action as PressAndHoldAction)(stateString == "true");
}
}
else if (action is Action<bool>)
{
var stateString = messageObj["content"]["state"].Value<string>();
if (!string.IsNullOrEmpty(stateString))
{
(action as Action<bool>)(stateString == "true");
}
}
else if (action is Action<ushort>)
{
(action as Action<ushort>)(messageObj["content"]["value"].Value<ushort>());
}
else if (action is Action<string>)
{
(action as Action<string>)(messageObj["content"]["value"].Value<string>());
}
else if (action is Action<SourceSelectMessageContent>)
{
(action as Action<SourceSelectMessageContent>)(messageObj["content"]
.ToObject<SourceSelectMessageContent>());
}
}
else
{
Debug.Console(1, this, "-- Warning: Incoming message has no registered handler");
}
}
}
catch (Exception err)
{
//Debug.Console(1, "SseMessageLengthBeforeFailureCount: {0}", SseMessageLengthBeforeFailureCount);
//SseMessageLengthBeforeFailureCount = 0;
Debug.Console(1, this, "Unable to parse message: {0}", err);
}
}
void TestHttpRequest(string s)
{
{
s = s.Trim();
if (string.IsNullOrEmpty(s))
{
PrintTestHttpRequestUsage();
return;
}
var tokens = s.Split(' ');
if (tokens.Length < 2)
{
CrestronConsole.ConsoleCommandResponse("Too few paramaters\r");
PrintTestHttpRequestUsage();
return;
}
try
{
var url = tokens[1];
if (tokens[0].ToLower() == "get")
{
var resp = new HttpClient().Get(url);
CrestronConsole.ConsoleCommandResponse("RESPONSE:\r{0}\r\r", resp);
}
else if (tokens[0].ToLower() == "post")
{
var resp = new HttpClient().Post(url, new byte[] { });
CrestronConsole.ConsoleCommandResponse("RESPONSE:\r{0}\r\r", resp);
}
else
{
CrestronConsole.ConsoleCommandResponse("Only get or post supported\r");
PrintTestHttpRequestUsage();
}
}
catch (HttpException e)
{
CrestronConsole.ConsoleCommandResponse("Exception in request:\r");
CrestronConsole.ConsoleCommandResponse("Response URL: {0}\r", e.Response.ResponseUrl);
CrestronConsole.ConsoleCommandResponse("Response Error Code: {0}\r", e.Response.Code);
CrestronConsole.ConsoleCommandResponse("Response body: {0}\r", e.Response.ContentString);
}
}
}
void PrintTestHttpRequestUsage()
{
CrestronConsole.ConsoleCommandResponse("Usage: mobilehttprequest:N get/post url\r");
}
}
}

View File

@@ -1,37 +1,37 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
using PepperDash.Core;
namespace PepperDash.Essentials.Room.Cotija
{
public static class IChannelExtensions
{
public static void LinkActions(this IChannel dev, CotijaSystemController controller)
{
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
controller.AddAction(prefix + "chanup", new PressAndHoldAction(dev.ChannelUp));
controller.AddAction(prefix + "chandown", new PressAndHoldAction(dev.ChannelDown));
controller.AddAction(prefix + "lastchan", new PressAndHoldAction(dev.LastChannel));
controller.AddAction(prefix + "guide", new PressAndHoldAction(dev.Guide));
controller.AddAction(prefix + "info", new PressAndHoldAction(dev.Info));
controller.AddAction(prefix + "exit", new PressAndHoldAction(dev.Exit));
}
public static void UnlinkActions(this IChannel dev, CotijaSystemController controller)
{
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
controller.RemoveAction(prefix + "chanup");
controller.RemoveAction(prefix + "chandown");
controller.RemoveAction(prefix + "lastchan");
controller.RemoveAction(prefix + "guide");
controller.RemoveAction(prefix + "info");
controller.RemoveAction(prefix + "exit");
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
using PepperDash.Core;
namespace PepperDash.Essentials.Room.Cotija
{
public static class IChannelExtensions
{
public static void LinkActions(this IChannel dev, CotijaSystemController controller)
{
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
controller.AddAction(prefix + "chanUp", new PressAndHoldAction(dev.ChannelUp));
controller.AddAction(prefix + "chanDown", new PressAndHoldAction(dev.ChannelDown));
controller.AddAction(prefix + "lastChan", new PressAndHoldAction(dev.LastChannel));
controller.AddAction(prefix + "guide", new PressAndHoldAction(dev.Guide));
controller.AddAction(prefix + "info", new PressAndHoldAction(dev.Info));
controller.AddAction(prefix + "exit", new PressAndHoldAction(dev.Exit));
}
public static void UnlinkActions(this IChannel dev, CotijaSystemController controller)
{
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
controller.RemoveAction(prefix + "chanUp");
controller.RemoveAction(prefix + "chanDown");
controller.RemoveAction(prefix + "lastChan");
controller.RemoveAction(prefix + "guide");
controller.RemoveAction(prefix + "info");
controller.RemoveAction(prefix + "exit");
}
}
}

View File

@@ -1,33 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
using PepperDash.Core;
namespace PepperDash.Essentials.Room.Cotija
{
public static class IColorExtensions
{
public static void LinkActions(this IColor dev, CotijaSystemController controller)
{
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
controller.AddAction(prefix + "red", new PressAndHoldAction(dev.Red));
controller.AddAction(prefix + "green", new PressAndHoldAction(dev.Green));
controller.AddAction(prefix + "yellow", new PressAndHoldAction(dev.Yellow));
controller.AddAction(prefix + "blue", new PressAndHoldAction(dev.Blue));
}
public static void UnlinkActions(this IColor dev, CotijaSystemController controller)
{
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
controller.RemoveAction(prefix + "red");
controller.RemoveAction(prefix + "green");
controller.RemoveAction(prefix + "yellow");
controller.RemoveAction(prefix + "blue");
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
using PepperDash.Core;
namespace PepperDash.Essentials.Room.Cotija
{
public static class IColorExtensions
{
public static void LinkActions(this IColor dev, CotijaSystemController controller)
{
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
controller.AddAction(prefix + "red", new PressAndHoldAction(dev.Red));
controller.AddAction(prefix + "green", new PressAndHoldAction(dev.Green));
controller.AddAction(prefix + "yellow", new PressAndHoldAction(dev.Yellow));
controller.AddAction(prefix + "blue", new PressAndHoldAction(dev.Blue));
}
public static void UnlinkActions(this IColor dev, CotijaSystemController controller)
{
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
controller.RemoveAction(prefix + "red");
controller.RemoveAction(prefix + "green");
controller.RemoveAction(prefix + "yellow");
controller.RemoveAction(prefix + "blue");
}
}
}

View File

@@ -1,39 +1,39 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
using PepperDash.Core;
namespace PepperDash.Essentials.Room.Cotija
{
public static class IDPadExtensions
{
public static void LinkActions(this IDPad dev, CotijaSystemController controller)
{
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
controller.AddAction(prefix + "up", new PressAndHoldAction(dev.Up));
controller.AddAction(prefix + "down", new PressAndHoldAction(dev.Down));
controller.AddAction(prefix + "left", new PressAndHoldAction(dev.Left));
controller.AddAction(prefix + "right", new PressAndHoldAction(dev.Right));
controller.AddAction(prefix + "select", new PressAndHoldAction(dev.Select));
controller.AddAction(prefix + "menu", new PressAndHoldAction(dev.Menu));
controller.AddAction(prefix + "exit", new PressAndHoldAction(dev.Exit));
}
public static void UnlinkActions(this IDPad dev, CotijaSystemController controller)
{
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
controller.RemoveAction(prefix + "up");
controller.RemoveAction(prefix + "down");
controller.RemoveAction(prefix + "left");
controller.RemoveAction(prefix + "right");
controller.RemoveAction(prefix + "select");
controller.RemoveAction(prefix + "menu");
controller.RemoveAction(prefix + "exit");
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
using PepperDash.Core;
namespace PepperDash.Essentials.Room.Cotija
{
public static class IDPadExtensions
{
public static void LinkActions(this IDPad dev, CotijaSystemController controller)
{
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
controller.AddAction(prefix + "up", new PressAndHoldAction(dev.Up));
controller.AddAction(prefix + "down", new PressAndHoldAction(dev.Down));
controller.AddAction(prefix + "left", new PressAndHoldAction(dev.Left));
controller.AddAction(prefix + "right", new PressAndHoldAction(dev.Right));
controller.AddAction(prefix + "select", new PressAndHoldAction(dev.Select));
controller.AddAction(prefix + "menu", new PressAndHoldAction(dev.Menu));
controller.AddAction(prefix + "exit", new PressAndHoldAction(dev.Exit));
}
public static void UnlinkActions(this IDPad dev, CotijaSystemController controller)
{
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
controller.RemoveAction(prefix + "up");
controller.RemoveAction(prefix + "down");
controller.RemoveAction(prefix + "left");
controller.RemoveAction(prefix + "right");
controller.RemoveAction(prefix + "select");
controller.RemoveAction(prefix + "menu");
controller.RemoveAction(prefix + "exit");
}
}
}

View File

@@ -1,29 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
using PepperDash.Core;
namespace PepperDash.Essentials.Room.Cotija
{
public static class IDvrExtensions
{
public static void LinkActions(this IDvr dev, CotijaSystemController controller)
{
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
controller.AddAction(prefix + "dvrlist", new PressAndHoldAction(dev.DvrList));
controller.AddAction(prefix + "record", new PressAndHoldAction(dev.Record));
}
public static void UnlinkActions(this IDvr dev, CotijaSystemController controller)
{
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
controller.RemoveAction(prefix + "dvrlist");
controller.RemoveAction(prefix + "record");
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
using PepperDash.Core;
namespace PepperDash.Essentials.Room.Cotija
{
public static class IDvrExtensions
{
public static void LinkActions(this IDvr dev, CotijaSystemController controller)
{
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
controller.AddAction(prefix + "dvrlist", new PressAndHoldAction(dev.DvrList));
controller.AddAction(prefix + "record", new PressAndHoldAction(dev.Record));
}
public static void UnlinkActions(this IDvr dev, CotijaSystemController controller)
{
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
controller.RemoveAction(prefix + "dvrlist");
controller.RemoveAction(prefix + "record");
}
}
}

View File

@@ -1,50 +1,50 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
using PepperDash.Core;
namespace PepperDash.Essentials.Room.Cotija
{
public static class INumericExtensions
{
public static void LinkActions(this INumericKeypad dev, CotijaSystemController controller)
{
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
controller.AddAction(prefix + "num0", new PressAndHoldAction(dev.Digit0));
controller.AddAction(prefix + "num1", new PressAndHoldAction(dev.Digit1));
controller.AddAction(prefix + "num2", new PressAndHoldAction(dev.Digit2));
controller.AddAction(prefix + "num3", new PressAndHoldAction(dev.Digit3));
controller.AddAction(prefix + "num4", new PressAndHoldAction(dev.Digit4));
controller.AddAction(prefix + "num5", new PressAndHoldAction(dev.Digit5));
controller.AddAction(prefix + "num6", new PressAndHoldAction(dev.Digit6));
controller.AddAction(prefix + "num7", new PressAndHoldAction(dev.Digit0));
controller.AddAction(prefix + "num8", new PressAndHoldAction(dev.Digit0));
controller.AddAction(prefix + "num9", new PressAndHoldAction(dev.Digit0));
controller.AddAction(prefix + "dash", new PressAndHoldAction(dev.KeypadAccessoryButton1));
controller.AddAction(prefix + "enter", new PressAndHoldAction(dev.KeypadAccessoryButton2));
#warning Deal with the Accessory functions on the numpad later
}
public static void UnlinkActions(this INumericKeypad dev, CotijaSystemController controller)
{
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
controller.RemoveAction(prefix + "num0");
controller.RemoveAction(prefix + "num1");
controller.RemoveAction(prefix + "num2");
controller.RemoveAction(prefix + "num3");
controller.RemoveAction(prefix + "num4");
controller.RemoveAction(prefix + "num5");
controller.RemoveAction(prefix + "num6");
controller.RemoveAction(prefix + "num7");
controller.RemoveAction(prefix + "num8");
controller.RemoveAction(prefix + "num9");
controller.RemoveAction(prefix + "dash");
controller.RemoveAction(prefix + "enter");
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
using PepperDash.Core;
namespace PepperDash.Essentials.Room.Cotija
{
public static class INumericExtensions
{
public static void LinkActions(this INumericKeypad dev, CotijaSystemController controller)
{
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
controller.AddAction(prefix + "num0", new PressAndHoldAction(dev.Digit0));
controller.AddAction(prefix + "num1", new PressAndHoldAction(dev.Digit1));
controller.AddAction(prefix + "num2", new PressAndHoldAction(dev.Digit2));
controller.AddAction(prefix + "num3", new PressAndHoldAction(dev.Digit3));
controller.AddAction(prefix + "num4", new PressAndHoldAction(dev.Digit4));
controller.AddAction(prefix + "num5", new PressAndHoldAction(dev.Digit5));
controller.AddAction(prefix + "num6", new PressAndHoldAction(dev.Digit6));
controller.AddAction(prefix + "num7", new PressAndHoldAction(dev.Digit0));
controller.AddAction(prefix + "num8", new PressAndHoldAction(dev.Digit0));
controller.AddAction(prefix + "num9", new PressAndHoldAction(dev.Digit0));
controller.AddAction(prefix + "numDash", new PressAndHoldAction(dev.KeypadAccessoryButton1));
controller.AddAction(prefix + "numEnter", new PressAndHoldAction(dev.KeypadAccessoryButton2));
// Deal with the Accessory functions on the numpad later
}
public static void UnlinkActions(this INumericKeypad dev, CotijaSystemController controller)
{
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
controller.RemoveAction(prefix + "num0");
controller.RemoveAction(prefix + "num1");
controller.RemoveAction(prefix + "num2");
controller.RemoveAction(prefix + "num3");
controller.RemoveAction(prefix + "num4");
controller.RemoveAction(prefix + "num5");
controller.RemoveAction(prefix + "num6");
controller.RemoveAction(prefix + "num7");
controller.RemoveAction(prefix + "num8");
controller.RemoveAction(prefix + "num9");
controller.RemoveAction(prefix + "numDash");
controller.RemoveAction(prefix + "numEnter");
}
}
}

View File

@@ -1,32 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
using PepperDash.Core;
namespace PepperDash.Essentials.Room.Cotija
{
public static class IPowerExtensions
{
public static void LinkActions(this IPower dev, CotijaSystemController controller)
{
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
controller.AddAction(prefix + "poweron", new Action(dev.PowerOn));
controller.AddAction(prefix + "poweroff", new Action(dev.PowerOff));
controller.AddAction(prefix + "powertoggle", new Action(dev.PowerToggle));
}
public static void UnlinkActions(this IPower dev, CotijaSystemController controller)
{
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
controller.RemoveAction(prefix + "poweron");
controller.RemoveAction(prefix + "poweroff");
controller.RemoveAction(prefix + "powertoggle");
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
using PepperDash.Core;
namespace PepperDash.Essentials.Room.Cotija
{
public static class IPowerExtensions
{
public static void LinkActions(this IPower dev, CotijaSystemController controller)
{
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
controller.AddAction(prefix + "powerOn", new Action(dev.PowerOn));
controller.AddAction(prefix + "powerOff", new Action(dev.PowerOff));
controller.AddAction(prefix + "powerToggle", new Action(dev.PowerToggle));
}
public static void UnlinkActions(this IPower dev, CotijaSystemController controller)
{
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
controller.RemoveAction(prefix + "powerOn");
controller.RemoveAction(prefix + "powerOff");
controller.RemoveAction(prefix + "powerToggle");
}
}
}

View File

@@ -1,29 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
using PepperDash.Core;
namespace PepperDash.Essentials.Room.Cotija
{
public static class ISetTopBoxControlsExtensions
{
public static void LinkActions(this ISetTopBoxControls dev, CotijaSystemController controller)
{
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
controller.AddAction(prefix + "dvrlist", new PressAndHoldAction(dev.DvrList));
controller.AddAction(prefix + "replay", new PressAndHoldAction(dev.Replay));
}
public static void UnlinkActions(this ISetTopBoxControls dev, CotijaSystemController controller)
{
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
controller.RemoveAction(prefix + "dvrlist");
controller.RemoveAction(prefix + "replay");
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
using PepperDash.Core;
namespace PepperDash.Essentials.Room.Cotija
{
public static class ISetTopBoxControlsExtensions
{
public static void LinkActions(this ISetTopBoxControls dev, CotijaSystemController controller)
{
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
controller.AddAction(prefix + "dvrList", new PressAndHoldAction(dev.DvrList));
controller.AddAction(prefix + "replay", new PressAndHoldAction(dev.Replay));
}
public static void UnlinkActions(this ISetTopBoxControls dev, CotijaSystemController controller)
{
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
controller.RemoveAction(prefix + "dvrList");
controller.RemoveAction(prefix + "replay");
}
}
}

View File

@@ -1,41 +1,41 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
using PepperDash.Core;
namespace PepperDash.Essentials.Room.Cotija
{
public static class ITransportExtensions
{
public static void LinkActions(this ITransport dev, CotijaSystemController controller)
{
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
controller.AddAction(prefix + "play", new PressAndHoldAction(dev.Play));
controller.AddAction(prefix + "pause", new PressAndHoldAction(dev.Pause));
controller.AddAction(prefix + "stop", new PressAndHoldAction(dev.Stop));
controller.AddAction(prefix + "prevtrack", new PressAndHoldAction(dev.ChapPlus));
controller.AddAction(prefix + "nexttrack", new PressAndHoldAction(dev.ChapMinus));
controller.AddAction(prefix + "rewind", new PressAndHoldAction(dev.Rewind));
controller.AddAction(prefix + "ffwd", new PressAndHoldAction(dev.FFwd));
controller.AddAction(prefix + "record", new PressAndHoldAction(dev.Record));
}
public static void UnlinkActions(this ITransport dev, CotijaSystemController controller)
{
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
controller.RemoveAction(prefix + "play");
controller.RemoveAction(prefix + "pause");
controller.RemoveAction(prefix + "stop");
controller.RemoveAction(prefix + "prevtrack");
controller.RemoveAction(prefix + "nexttrack");
controller.RemoveAction(prefix + "rewind");
controller.RemoveAction(prefix + "ffwd");
controller.RemoveAction(prefix + "record");
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
using PepperDash.Core;
namespace PepperDash.Essentials.Room.Cotija
{
public static class ITransportExtensions
{
public static void LinkActions(this ITransport dev, CotijaSystemController controller)
{
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
controller.AddAction(prefix + "play", new PressAndHoldAction(dev.Play));
controller.AddAction(prefix + "pause", new PressAndHoldAction(dev.Pause));
controller.AddAction(prefix + "stop", new PressAndHoldAction(dev.Stop));
controller.AddAction(prefix + "prevTrack", new PressAndHoldAction(dev.ChapPlus));
controller.AddAction(prefix + "nextTrack", new PressAndHoldAction(dev.ChapMinus));
controller.AddAction(prefix + "rewind", new PressAndHoldAction(dev.Rewind));
controller.AddAction(prefix + "ffwd", new PressAndHoldAction(dev.FFwd));
controller.AddAction(prefix + "record", new PressAndHoldAction(dev.Record));
}
public static void UnlinkActions(this ITransport dev, CotijaSystemController controller)
{
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
controller.RemoveAction(prefix + "play");
controller.RemoveAction(prefix + "pause");
controller.RemoveAction(prefix + "stop");
controller.RemoveAction(prefix + "prevTrack");
controller.RemoveAction(prefix + "nextTrack");
controller.RemoveAction(prefix + "rewind");
controller.RemoveAction(prefix + "ffwd");
controller.RemoveAction(prefix + "record");
}
}
}

View File

@@ -0,0 +1,60 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Room.Cotija
{
/// <summary>
/// Represents a room whose configuration is derived from runtime data,
/// perhaps from another program, and that the data may not be fully
/// available at startup.
/// </summary>
public interface IDelayedConfiguration
{
event EventHandler<EventArgs> ConfigurationIsReady;
}
}
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,102 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Essentials.Devices.Common.Codec;
using PepperDash.Essentials.Devices.Common.AudioCodec;
namespace PepperDash.Essentials.AppServer.Messengers
{
/// <summary>
/// Provides a messaging bridge for an AudioCodecBase device
/// </summary>
public class AudioCodecBaseMessenger : MessengerBase
{
/// <summary>
/// Device being bridged
/// </summary>
public AudioCodecBase Codec { get; set; }
/// <summary>
/// Constuctor
/// </summary>
/// <param name="key"></param>
/// <param name="codec"></param>
/// <param name="messagePath"></param>
public AudioCodecBaseMessenger(string key, AudioCodecBase codec, string messagePath)
: base(key, messagePath)
{
if (codec == null)
throw new ArgumentNullException("codec");
Codec = codec;
codec.CallStatusChange += new EventHandler<CodecCallStatusItemChangeEventArgs>(codec_CallStatusChange);
}
protected override void CustomRegisterWithAppServer(CotijaSystemController appServerController)
{
appServerController.AddAction(MessagePath + "/fullStatus", new Action(SendAtcFullMessageObject));
appServerController.AddAction(MessagePath + "/dial", new Action<string>(s => Codec.Dial(s)));
appServerController.AddAction(MessagePath + "/endCallById", new Action<string>(s =>
{
var call = GetCallWithId(s);
if (call != null)
Codec.EndCall(call);
}));
appServerController.AddAction(MessagePath + "/endAllCalls", new Action(Codec.EndAllCalls));
appServerController.AddAction(MessagePath + "/dtmf", new Action<string>(s => Codec.SendDtmf(s)));
appServerController.AddAction(MessagePath + "/rejectById", new Action<string>(s =>
{
var call = GetCallWithId(s);
if (call != null)
Codec.RejectCall(call);
}));
appServerController.AddAction(MessagePath + "/acceptById", new Action<string>(s =>
{
var call = GetCallWithId(s);
if (call != null)
Codec.AcceptCall(call);
}));
}
/// <summary>
/// Helper to grab a call with string ID
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
CodecActiveCallItem GetCallWithId(string id)
{
return Codec.ActiveCalls.FirstOrDefault(c => c.Id == id);
}
void codec_CallStatusChange(object sender, CodecCallStatusItemChangeEventArgs e)
{
SendAtcFullMessageObject();
}
/// <summary>
/// Helper method to build call status for vtc
/// </summary>
/// <returns></returns>
void SendAtcFullMessageObject()
{
var info = Codec.CodecInfo;
PostStatusMessage(new
{
isInCall = Codec.IsInCall,
calls = Codec.ActiveCalls,
info = new
{
phoneNumber = info.PhoneNumber
}
});
}
}
}

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

@@ -0,0 +1,216 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.EthernetCommunication;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Devices.Common.Codec;
namespace PepperDash.Essentials.AppServer.Messengers
{
public class Ddvc01AtcMessenger : MessengerBase
{
BasicTriList EISC;
/// <summary>
/// 221
/// </summary>
const uint BDialHangupOnHook = 221;
/// <summary>
/// 251
/// </summary>
const uint BIncomingAnswer = 251;
/// <summary>
/// 252
/// </summary>
const uint BIncomingReject = 252;
/// <summary>
/// 241
/// </summary>
const uint BSpeedDial1 = 241;
/// <summary>
/// 242
/// </summary>
const uint BSpeedDial2 = 242;
/// <summary>
/// 243
/// </summary>
const uint BSpeedDial3 = 243;
/// <summary>
/// 244
/// </summary>
const uint BSpeedDial4 = 244;
/// <summary>
/// 201
/// </summary>
const uint SCurrentDialString = 201;
/// <summary>
/// 211
/// </summary>
const uint SCurrentCallNumber = 211;
/// <summary>
/// 212
/// </summary>
const uint SCurrentCallName = 212;
/// <summary>
/// 221
/// </summary>
const uint SHookState = 221;
/// <summary>
/// 222
/// </summary>
const uint SCallDirection = 222;
/// <summary>
/// 201-212 0-9*#
/// </summary>
Dictionary<string, uint> DTMFMap = new Dictionary<string, uint>
{
{ "1", 201 },
{ "2", 202 },
{ "3", 203 },
{ "4", 204 },
{ "5", 205 },
{ "6", 206 },
{ "7", 207 },
{ "8", 208 },
{ "9", 209 },
{ "0", 210 },
{ "*", 211 },
{ "#", 212 },
};
/// <summary>
///
/// </summary>
CodecActiveCallItem CurrentCallItem;
/// <summary>
///
/// </summary>
/// <param name="eisc"></param>
/// <param name="messagePath"></param>
public Ddvc01AtcMessenger(string key, BasicTriList eisc, string messagePath)
: base(key, messagePath)
{
EISC = eisc;
CurrentCallItem = new CodecActiveCallItem();
CurrentCallItem.Type = eCodecCallType.Audio;
CurrentCallItem.Id = "-audio-";
}
/// <summary>
///
/// </summary>
void SendFullStatus()
{
this.PostStatusMessage(new
{
calls = GetCurrentCallList(),
currentCallString = EISC.GetString(SCurrentCallNumber),
currentDialString = EISC.GetString(SCurrentDialString),
isInCall = EISC.GetString(SHookState) == "Connected"
});
}
/// <summary>
///
/// </summary>
/// <param name="appServerController"></param>
protected override void CustomRegisterWithAppServer(CotijaSystemController appServerController)
{
//EISC.SetStringSigAction(SCurrentDialString, s => PostStatusMessage(new { currentDialString = s }));
EISC.SetStringSigAction(SHookState, s =>
{
CurrentCallItem.Status = (eCodecCallStatus)Enum.Parse(typeof(eCodecCallStatus), s, true);
//GetCurrentCallList();
SendFullStatus();
});
EISC.SetStringSigAction(SCurrentCallNumber, s =>
{
CurrentCallItem.Number = s;
SendCallsList();
});
EISC.SetStringSigAction(SCurrentCallName, s =>
{
CurrentCallItem.Name = s;
SendCallsList();
});
EISC.SetStringSigAction(SCallDirection, s =>
{
CurrentCallItem.Direction = (eCodecCallDirection)Enum.Parse(typeof(eCodecCallDirection), s, true);
SendCallsList();
});
// Add press and holds using helper
Action<string, uint> addPHAction = (s, u) =>
AppServerController.AddAction(MessagePath + s, new PressAndHoldAction(b => EISC.SetBool(u, b)));
// Add straight pulse calls
Action<string, uint> addAction = (s, u) =>
AppServerController.AddAction(MessagePath + s, new Action(() => EISC.PulseBool(u, 100)));
addAction("/endCallById", BDialHangupOnHook);
addAction("/endAllCalls", BDialHangupOnHook);
addAction("/acceptById", BIncomingAnswer);
addAction("/rejectById", BIncomingReject);
addAction("/speedDial1", BSpeedDial1);
addAction("/speedDial2", BSpeedDial2);
addAction("/speedDial3", BSpeedDial3);
addAction("/speedDial4", BSpeedDial4);
// Get status
AppServerController.AddAction(MessagePath + "/fullStatus", new Action(SendFullStatus));
// Dial on string
AppServerController.AddAction(MessagePath + "/dial", new Action<string>(s => EISC.SetString(SCurrentDialString, s)));
// Pulse DTMF
AppServerController.AddAction(MessagePath + "/dtmf", new Action<string>(s =>
{
if (DTMFMap.ContainsKey(s))
{
EISC.PulseBool(DTMFMap[s], 100);
}
}));
}
/// <summary>
///
/// </summary>
void SendCallsList()
{
PostStatusMessage(new
{
calls = GetCurrentCallList(),
});
}
/// <summary>
/// Turns the
/// </summary>
/// <returns></returns>
List<CodecActiveCallItem> GetCurrentCallList()
{
if (CurrentCallItem.Status == eCodecCallStatus.Disconnected)
{
return new List<CodecActiveCallItem>();
}
else
{
return new List<CodecActiveCallItem>() { CurrentCallItem };
}
}
}
}

View File

@@ -0,0 +1,623 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.EthernetCommunication;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Devices.Common.Codec;
namespace PepperDash.Essentials.AppServer.Messengers
{
public class Ddvc01VtcMessenger : MessengerBase
{
BasicTriList EISC;
/********* Bools *********/
/// <summary>
/// 724
/// </summary>
const uint BDialHangup = 724;
/// <summary>
/// 750
/// </summary>
const uint BCallIncoming = 750;
/// <summary>
/// 751
/// </summary>
const uint BIncomingAnswer = 751;
/// <summary>
/// 752
/// </summary>
const uint BIncomingReject = 752;
/// <summary>
/// 741
/// </summary>
const uint BSpeedDial1 = 741;
/// <summary>
/// 742
/// </summary>
const uint BSpeedDial2 = 742;
/// <summary>
/// 743
/// </summary>
const uint BSpeedDial3 = 743;
/// <summary>
/// 744
/// </summary>
const uint BSpeedDial4 = 744;
/// <summary>
/// 800
/// </summary>
const uint BDirectorySearchBusy = 800;
/// <summary>
/// 801
/// </summary>
const uint BDirectoryLineSelected = 801;
/// <summary>
/// 801 when selected entry is a contact
/// </summary>
const uint BDirectoryEntryIsContact = 801;
/// <summary>
/// 802 To show/hide back button
/// </summary>
const uint BDirectoryIsRoot = 802;
/// <summary>
/// 803 Pulse from system to inform us when directory is ready
/// </summary>
const uint DDirectoryHasChanged = 803;
/// <summary>
/// 804
/// </summary>
const uint BDirectoryRoot = 804;
/// <summary>
/// 805
/// </summary>
const uint BDirectoryFolderBack = 805;
/// <summary>
/// 806
/// </summary>
const uint BDirectoryDialSelectedLine = 806;
/// <summary>
/// 811
/// </summary>
const uint BCameraControlUp = 811;
/// <summary>
/// 812
/// </summary>
const uint BCameraControlDown = 812;
/// <summary>
/// 813
/// </summary>
const uint BCameraControlLeft = 813;
/// <summary>
/// 814
/// </summary>
const uint BCameraControlRight = 814;
/// <summary>
/// 815
/// </summary>
const uint BCameraControlZoomIn = 815;
/// <summary>
/// 816
/// </summary>
const uint BCameraControlZoomOut = 816;
/// <summary>
/// 821 - 826
/// </summary>
const uint BCameraPresetStart = 821;
/// <summary>
/// 831
/// </summary>
const uint BCameraModeAuto = 831;
/// <summary>
/// 832
/// </summary>
const uint BCameraModeManual = 832;
/// <summary>
/// 833
/// </summary>
const uint BCameraModeOff = 833;
/// <summary>
/// 841
/// </summary>
const uint BCameraSelfView = 841;
/// <summary>
/// 842
/// </summary>
const uint BCameraLayout = 842;
/********* Ushorts *********/
/// <summary>
/// 760
/// </summary>
const uint UCameraNumberSelect = 760;
/// <summary>
/// 801
/// </summary>
const uint UDirectorySelectRow = 801;
/// <summary>
/// 801
/// </summary>
const uint UDirectoryRowCount = 801;
/********* Strings *********/
/// <summary>
/// 701
/// </summary>
const uint SCurrentDialString = 701;
/// <summary>
/// 702
/// </summary>
const uint SCurrentCallName = 702;
/// <summary>
/// 703
/// </summary>
const uint SCurrentCallNumber = 703;
/// <summary>
/// 731
/// </summary>
const uint SHookState = 731;
/// <summary>
/// 722
/// </summary>
const uint SCallDirection = 722;
/// <summary>
/// 751
/// </summary>
const uint SIncomingCallName = 751;
/// <summary>
/// 752
/// </summary>
const uint SIncomingCallNumber = 752;
/// <summary>
/// 800
/// </summary>
const uint SDirectorySearchString = 800;
/// <summary>
/// 801-1055
/// </summary>
const uint SDirectoryEntriesStart = 801;
/// <summary>
/// 1056
/// </summary>
const uint SDirectoryEntrySelectedName = 1056;
/// <summary>
/// 1057
/// </summary>
const uint SDirectoryEntrySelectedNumber = 1057;
/// <summary>
/// 1058
/// </summary>
const uint SDirectorySelectedFolderName = 1058;
/// <summary>
/// 701-712 0-9*#
/// </summary>
Dictionary<string, uint> DTMFMap = new Dictionary<string, uint>
{
{ "1", 701 },
{ "2", 702 },
{ "3", 703 },
{ "4", 704 },
{ "5", 705 },
{ "6", 706 },
{ "7", 707 },
{ "8", 708 },
{ "9", 709 },
{ "0", 710 },
{ "*", 711 },
{ "#", 712 },
};
CodecActiveCallItem CurrentCallItem;
CodecActiveCallItem IncomingCallItem;
ushort PreviousDirectoryLength = 0;
/// <summary>
///
/// </summary>
/// <param name="eisc"></param>
/// <param name="messagePath"></param>
public Ddvc01VtcMessenger(string key, BasicTriList eisc, string messagePath)
: base(key, messagePath)
{
EISC = eisc;
CurrentCallItem = new CodecActiveCallItem();
CurrentCallItem.Type = eCodecCallType.Video;
CurrentCallItem.Id = "-video-";
}
/// <summary>
///
/// </summary>
/// <param name="appServerController"></param>
protected override void CustomRegisterWithAppServer(CotijaSystemController appServerController)
{
var asc = appServerController;
EISC.SetStringSigAction(SHookState, s =>
{
CurrentCallItem.Status = (eCodecCallStatus)Enum.Parse(typeof(eCodecCallStatus), s, true);
PostFullStatus(); // SendCallsList();
});
EISC.SetStringSigAction(SCurrentCallNumber, s =>
{
CurrentCallItem.Number = s;
PostCallsList();
});
EISC.SetStringSigAction(SCurrentCallName, s =>
{
CurrentCallItem.Name = s;
PostCallsList();
});
EISC.SetStringSigAction(SCallDirection, s =>
{
CurrentCallItem.Direction = (eCodecCallDirection)Enum.Parse(typeof(eCodecCallDirection), s, true);
PostCallsList();
});
EISC.SetBoolSigAction(BCallIncoming, b =>
{
if (b)
{
var ica = new CodecActiveCallItem()
{
Direction = eCodecCallDirection.Incoming,
Id = "-video-incoming",
Name = EISC.GetString(SIncomingCallName),
Number = EISC.GetString(SIncomingCallNumber),
Status = eCodecCallStatus.Ringing,
Type = eCodecCallType.Video
};
IncomingCallItem = ica;
}
else
{
IncomingCallItem = null;
}
PostCallsList();
});
// Directory insanity
EISC.SetUShortSigAction(UDirectoryRowCount, u =>
{
// The length of the list comes in before the list does.
// Splice the sig change operation onto the last string sig that will be changing
// when the directory entries make it through.
if (PreviousDirectoryLength > 0)
{
EISC.ClearStringSigAction(SDirectoryEntriesStart + PreviousDirectoryLength - 1);
}
EISC.SetStringSigAction(SDirectoryEntriesStart + u - 1, s => PostDirectory());
PreviousDirectoryLength = u;
});
EISC.SetStringSigAction(SDirectoryEntrySelectedName, s =>
{
PostStatusMessage(new
{
directoryContactSelected = new
{
name = EISC.GetString(SDirectoryEntrySelectedName),
}
});
});
EISC.SetStringSigAction(SDirectoryEntrySelectedNumber, s =>
{
PostStatusMessage(new
{
directoryContactSelected = new
{
number = EISC.GetString(SDirectoryEntrySelectedNumber),
}
});
});
EISC.SetStringSigAction(SDirectorySelectedFolderName, s => PostStatusMessage(new
{
directorySelectedFolderName = EISC.GetString(SDirectorySelectedFolderName)
}));
EISC.SetSigTrueAction(BCameraModeAuto, () => PostCameraMode());
EISC.SetSigTrueAction(BCameraModeManual, () => PostCameraMode());
EISC.SetSigTrueAction(BCameraModeOff, () => PostCameraMode());
EISC.SetBoolSigAction(BCameraSelfView, b => PostStatusMessage(new
{
cameraSelfView = b
}));
EISC.SetUShortSigAction(UCameraNumberSelect, (u) => PostSelectedCamera());
// Add press and holds using helper action
Action<string, uint> addPHAction = (s, u) =>
AppServerController.AddAction(MessagePath + s, new PressAndHoldAction(b => EISC.SetBool(u, b)));
addPHAction("/cameraUp", BCameraControlUp);
addPHAction("/cameraDown", BCameraControlDown);
addPHAction("/cameraLeft", BCameraControlLeft);
addPHAction("/cameraRight", BCameraControlRight);
addPHAction("/cameraZoomIn", BCameraControlZoomIn);
addPHAction("/cameraZoomOut", BCameraControlZoomOut);
// Add straight pulse calls using helper action
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);
addAction("/speedDial2", BSpeedDial2);
addAction("/speedDial3", BSpeedDial3);
addAction("/speedDial4", BSpeedDial4);
addAction("/cameraModeAuto", BCameraModeAuto);
addAction("/cameraModeManual", BCameraModeManual);
addAction("/cameraModeOff", BCameraModeOff);
addAction("/cameraSelfView", BCameraSelfView);
addAction("/cameraLayout", BCameraLayout);
asc.AddAction("/cameraSelect", new Action<string>(SelectCamera));
// camera presets
for(uint i = 0; i < 6; i++)
{
addAction("/cameraPreset" + (i + 1), BCameraPresetStart + i);
}
asc.AddAction(MessagePath + "/isReady", new Action(PostIsReady));
// Get status
asc.AddAction(MessagePath + "/fullStatus", new Action(PostFullStatus));
// Dial on string
asc.AddAction(MessagePath + "/dial", new Action<string>(s =>
EISC.SetString(SCurrentDialString, s)));
// Pulse DTMF
asc.AddAction(MessagePath + "/dtmf", new Action<string>(s =>
{
if (DTMFMap.ContainsKey(s))
{
EISC.PulseBool(DTMFMap[s], 100);
}
}));
// Directory madness
asc.AddAction(MessagePath + "/directoryRoot", new Action(() => EISC.PulseBool(BDirectoryRoot)));
asc.AddAction(MessagePath + "/directoryBack", new Action(() => EISC.PulseBool(BDirectoryFolderBack)));
asc.AddAction(MessagePath + "/directoryById", new Action<string>(s =>
{
// the id should contain the line number to forward to simpl
try
{
var u = ushort.Parse(s);
EISC.SetUshort(UDirectorySelectRow, u);
EISC.PulseBool(BDirectoryLineSelected);
}
catch (Exception)
{
Debug.Console(1, this, Debug.ErrorLogLevel.Warning,
"/directoryById request contains non-numeric ID incompatible with DDVC bridge");
}
}));
asc.AddAction(MessagePath + "/directorySelectContact", new Action<string>(s =>
{
try
{
var u = ushort.Parse(s);
EISC.SetUshort(UDirectorySelectRow, u);
EISC.PulseBool(BDirectoryLineSelected);
}
catch
{
}
}));
asc.AddAction(MessagePath + "/directoryDialContact", new Action(() => {
EISC.PulseBool(BDirectoryDialSelectedLine);
}));
asc.AddAction(MessagePath + "/getDirectory", new Action(() =>
{
if (EISC.GetUshort(UDirectoryRowCount) > 0)
{
PostDirectory();
}
else
{
EISC.PulseBool(BDirectoryRoot);
}
}));
}
/// <summary>
///
/// </summary>
void PostFullStatus()
{
this.PostStatusMessage(new
{
calls = GetCurrentCallList(),
cameraMode = GetCameraMode(),
cameraSelfView = EISC.GetBool(BCameraSelfView),
currentCallString = EISC.GetString(SCurrentCallNumber),
currentDialString = EISC.GetString(SCurrentDialString),
directoryContactSelected = new
{
name = EISC.GetString(SDirectoryEntrySelectedName),
number = EISC.GetString(SDirectoryEntrySelectedNumber)
},
directorySelectedFolderName = EISC.GetString(SDirectorySelectedFolderName),
isInCall = EISC.GetString(SHookState) == "Connected",
hasDirectory = true,
hasDirectorySearch = false,
hasRecents = !EISC.BooleanOutput[502].BoolValue,
hasCameras = true,
showCamerasWhenNotInCall = EISC.BooleanOutput[503].BoolValue,
selectedCamera = GetSelectedCamera(),
});
}
/// <summary>
///
/// </summary>
void PostDirectory()
{
var u = EISC.GetUshort(UDirectoryRowCount);
var items = new List<object>();
for (uint i = 0; i < u; i++)
{
var name = EISC.GetString(SDirectoryEntriesStart + i);
var id = (i + 1).ToString();
// is folder or contact?
if (name.StartsWith("[+]"))
{
items.Add(new
{
folderId = id,
name = name
});
}
else
{
items.Add(new
{
contactId = id,
name = name
});
}
}
var directoryMessage = new
{
currentDirectory = new
{
isRootDirectory = EISC.GetBool(BDirectoryIsRoot),
directoryResults = items
}
};
PostStatusMessage(directoryMessage);
}
/// <summary>
///
/// </summary>
void PostCameraMode()
{
PostStatusMessage(new
{
cameraMode = GetCameraMode()
});
}
/// <summary>
///
/// </summary>
/// <param name="mode"></param>
string GetCameraMode()
{
string m;
if (EISC.GetBool(BCameraModeAuto)) m = "auto";
else if (EISC.GetBool(BCameraModeManual)) m = "manual";
else m = "off";
return m;
}
void PostSelectedCamera()
{
PostStatusMessage(new
{
selectedCamera = GetSelectedCamera()
});
}
/// <summary>
///
/// </summary>
string GetSelectedCamera()
{
var num = EISC.GetUshort(UCameraNumberSelect);
string m;
if (num == 100)
{
m = "cameraFar";
}
else
{
m = "camera" + num;
}
return m;
}
/// <summary>
///
/// </summary>
void PostIsReady()
{
PostStatusMessage(new
{
isReady = true
});
}
/// <summary>
///
/// </summary>
void PostCallsList()
{
PostStatusMessage(new
{
calls = GetCurrentCallList(),
});
}
/// <summary>
///
/// </summary>
/// <param name="s"></param>
void SelectCamera(string s)
{
var cam = s.Substring(6);
if (cam.ToLower() == "far")
{
EISC.SetUshort(UCameraNumberSelect, 100);
}
else
{
EISC.SetUshort(UCameraNumberSelect, UInt16.Parse(cam));
}
}
/// <summary>
/// Turns the
/// </summary>
/// <returns></returns>
List<CodecActiveCallItem> GetCurrentCallList()
{
var list = new List<CodecActiveCallItem>();
if (CurrentCallItem.Status != eCodecCallStatus.Disconnected)
{
list.Add(CurrentCallItem);
}
if (EISC.GetBool(BCallIncoming)) {
}
return list;
}
}
}

View File

@@ -0,0 +1,81 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Essentials.Devices.Common.Codec;
using PepperDash.Essentials.Devices.Common.VideoCodec;
namespace PepperDash.Essentials.AppServer.Messengers
{
/// <summary>
/// Provides a messaging bridge for a VideoCodecBase
/// </summary>
public abstract class MessengerBase : IKeyed
{
public string Key { get; private set; }
/// <summary>
///
/// </summary>
public CotijaSystemController AppServerController { get; private set; }
public string MessagePath { get; private set; }
/// <summary>
///
/// </summary>
/// <param name="codec"></param>
public MessengerBase(string key, string messagePath)
{
Key = key;
if (string.IsNullOrEmpty(messagePath))
throw new ArgumentException("messagePath must not be empty or null");
MessagePath = messagePath;
}
/// <summary>
/// Registers this messenger with appserver controller
/// </summary>
/// <param name="appServerController"></param>
public void RegisterWithAppServer(CotijaSystemController appServerController)
{
if (appServerController == null)
throw new ArgumentNullException("appServerController");
AppServerController = appServerController;
CustomRegisterWithAppServer(AppServerController);
}
/// <summary>
/// Implemented in extending classes. Wire up API calls and feedback here
/// </summary>
/// <param name="appServerController"></param>
abstract protected void CustomRegisterWithAppServer(CotijaSystemController appServerController);
/// <summary>
/// Helper for posting status message
/// </summary>
/// <param name="contentObject">The contents of the content object</param>
protected void PostStatusMessage(object contentObject)
{
if (AppServerController != null)
{
AppServerController.SendMessageToServer(JObject.FromObject(new
{
type = MessagePath,
content = contentObject
}));
}
}
}
}

View File

@@ -0,0 +1,95 @@
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.Monitoring;
namespace PepperDash.Essentials.AppServer.Messengers
{
public class SystemMonitorMessenger : MessengerBase
{
public SystemMonitorController SysMon { get; private set; }
public SystemMonitorMessenger(string key, SystemMonitorController sysMon, string messagePath)
: base(key, messagePath)
{
if (sysMon == null)
throw new ArgumentNullException("sysMon");
SysMon = sysMon;
SysMon.SystemMonitorPropertiesChanged += new EventHandler<EventArgs>(SysMon_SystemMonitorPropertiesChanged);
foreach (var p in SysMon.ProgramStatusFeedbackCollection)
{
p.Value.ProgramInfoChanged += new EventHandler<ProgramInfoEventArgs>(ProgramInfoChanged);
}
CrestronConsole.AddNewConsoleCommand(s => SendFullStatusMessage(), "SendFullSysMonStatus", "Sends the full System Monitor Status", ConsoleAccessLevelEnum.AccessOperator);
}
/// <summary>
/// Posts the program information message
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void ProgramInfoChanged(object sender, ProgramInfoEventArgs e)
{
if (e.ProgramInfo != null)
{
//Debug.Console(1, "Posting Status Message: {0}", e.ProgramInfo.ToString());
PostStatusMessage(e.ProgramInfo);
}
}
/// <summary>
/// Posts the system monitor properties
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void SysMon_SystemMonitorPropertiesChanged(object sender, EventArgs e)
{
SendSystemMonitorStatusMessage();
}
void SendFullStatusMessage()
{
SendSystemMonitorStatusMessage();
foreach (var p in SysMon.ProgramStatusFeedbackCollection)
{
PostStatusMessage(p.Value.ProgramInfo);
}
}
void SendSystemMonitorStatusMessage()
{
Debug.Console(1, "Posting System Monitor Status Message.");
// This takes a while, launch a new thread
CrestronInvoke.BeginInvoke((o) =>
{
PostStatusMessage(new
{
timeZone = SysMon.TimeZoneFeedback.IntValue,
timeZoneName = SysMon.TimeZoneTextFeedback.StringValue,
ioControllerVersion = SysMon.IOControllerVersionFeedback.StringValue,
snmpVersion = SysMon.SnmpVersionFeedback.StringValue,
bacnetVersion = SysMon.BACnetAppVersionFeedback.StringValue,
controllerVersion = SysMon.ControllerVersionFeedback.StringValue
});
});
}
protected override void CustomRegisterWithAppServer(CotijaSystemController appServerController)
{
AppServerController.AddAction(MessagePath + "/fullStatus", new Action(SendFullStatusMessage));
}
}
}

View File

@@ -0,0 +1,373 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
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
{
/// <summary>
/// Provides a messaging bridge for a VideoCodecBase device
/// </summary>
public class VideoCodecBaseMessenger : MessengerBase
{
/// <summary>
///
/// </summary>
public VideoCodecBase Codec { get; private set; }
/// <summary>
///
/// </summary>
/// <param name="codec"></param>
public VideoCodecBaseMessenger(string key, VideoCodecBase codec, string messagePath)
: base(key, messagePath)
{
if (codec == null)
throw new ArgumentNullException("codec");
Codec = codec;
codec.CallStatusChange += new EventHandler<CodecCallStatusItemChangeEventArgs>(codec_CallStatusChange);
codec.IsReadyChange += new EventHandler<EventArgs>(codec_IsReadyChange);
var dirCodec = codec as IHasDirectory;
if (dirCodec != null)
{
dirCodec.DirectoryResultReturned += new EventHandler<DirectoryEventArgs>(dirCodec_DirectoryResultReturned);
}
var recCodec = codec as IHasCallHistory;
if (recCodec != null)
{
recCodec.CallHistory.RecentCallsListHasChanged += new EventHandler<EventArgs>(CallHistory_RecentCallsListHasChanged);
}
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void CallHistory_RecentCallsListHasChanged(object sender, EventArgs e)
{
var recents = (sender as CodecCallHistory).RecentCalls;
if (recents != null)
{
PostStatusMessage(new
{
recentCalls = recents
});
}
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void dirCodec_DirectoryResultReturned(object sender, DirectoryEventArgs e)
{
SendDirectory((Codec as IHasDirectory).CurrentDirectoryResult, e.DirectoryIsOnRoot);
}
/// <summary>
/// Posts the current directory
/// </summary>
void SendDirectory(CodecDirectory directory, bool isRoot)
{
var dirCodec = Codec as IHasDirectory;
if (dirCodec != null)
{
var prefixedDirectoryResults = PrefixDirectoryFolderItems(directory);
var directoryMessage = new
{
currentDirectory = new
{
directoryResults = prefixedDirectoryResults,
isRootDirectory = isRoot
}
};
PostStatusMessage(directoryMessage);
}
}
/// <summary>
/// Iterates a directory object and prefixes any folder items with "[+] "
/// </summary>
/// <param name="directory"></param>
/// <returns></returns>
List<DirectoryItem> PrefixDirectoryFolderItems (CodecDirectory directory)
{
var tempDirectoryList = new List<DirectoryItem>();
if (directory.CurrentDirectoryResults.Count > 0)
{
foreach (var item in directory.CurrentDirectoryResults)
{
if (item is DirectoryFolder)
{
var newFolder = new DirectoryFolder();
newFolder = (DirectoryFolder)item.Clone();
string prefixName = "[+] " + newFolder.Name;
newFolder.Name = prefixName;
tempDirectoryList.Add(newFolder);
}
else
{
tempDirectoryList.Add(item);
}
}
}
//else
//{
// DirectoryItem noResults = new DirectoryItem() { Name = "No Results Found" };
// tempDirectoryList.Add(noResults);
//}
return tempDirectoryList;
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void codec_IsReadyChange(object sender, EventArgs e)
{
PostStatusMessage(new
{
isReady = true
});
}
/// <summary>
/// Called from base's RegisterWithAppServer method
/// </summary>
/// <param name="appServerController"></param>
protected override void CustomRegisterWithAppServer(CotijaSystemController appServerController)
{
appServerController.AddAction("/device/videoCodec/isReady", new Action(SendIsReady));
appServerController.AddAction("/device/videoCodec/fullStatus", new Action(SendVtcFullMessageObject));
appServerController.AddAction("/device/videoCodec/dial", new Action<string>(s => Codec.Dial(s)));
appServerController.AddAction("/device/videoCodec/endCallById", new Action<string>(s =>
{
var call = GetCallWithId(s);
if (call != null)
Codec.EndCall(call);
}));
appServerController.AddAction(MessagePath + "/endAllCalls", new Action(Codec.EndAllCalls));
appServerController.AddAction(MessagePath + "/dtmf", new Action<string>(s => Codec.SendDtmf(s)));
appServerController.AddAction(MessagePath + "/rejectById", new Action<string>(s =>
{
var call = GetCallWithId(s);
if (call != null)
Codec.RejectCall(call);
}));
appServerController.AddAction(MessagePath + "/acceptById", new Action<string>(s =>
{
var call = GetCallWithId(s);
if (call != null)
Codec.AcceptCall(call);
}));
// Directory actions
var dirCodec = Codec as IHasDirectory;
if (dirCodec != null)
{
appServerController.AddAction(MessagePath + "/getDirectory", new Action(GetDirectoryRoot));
appServerController.AddAction(MessagePath + "/directoryById", new Action<string>(s => GetDirectory(s)));
appServerController.AddAction(MessagePath + "/directorySearch", new Action<string>(s => DirectorySearch(s)));
appServerController.AddAction(MessagePath + "/directoryBack", new Action(GetPreviousDirectory));
}
// History actions
var recCodec = Codec as IHasCallHistory;
if (recCodec != null)
{
appServerController.AddAction(MessagePath + "/getCallHistory", new Action(GetCallHistory));
}
appServerController.AddAction(MessagePath + "/privacyModeOn", new Action(Codec.PrivacyModeOn));
appServerController.AddAction(MessagePath + "/privacyModeOff", new Action(Codec.PrivacyModeOff));
appServerController.AddAction(MessagePath + "/privacyModeToggle", new Action(Codec.PrivacyModeToggle));
appServerController.AddAction(MessagePath + "/sharingStart", new Action(Codec.StartSharing));
appServerController.AddAction(MessagePath + "/sharingStop", new Action(Codec.StopSharing));
appServerController.AddAction(MessagePath + "/standbyOn", new Action(Codec.StandbyActivate));
appServerController.AddAction(MessagePath + "/standbyOff", new Action(Codec.StandbyDeactivate));
}
void GetCallHistory()
{
var codec = (Codec as IHasCallHistory);
if (codec != null)
{
var recents = codec.CallHistory.RecentCalls;
if (recents != null)
{
PostStatusMessage(new
{
recentCalls = recents
});
}
}
}
public void GetFullStatusMessage()
{
}
/// <summary>
/// Helper to grab a call with string ID
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
CodecActiveCallItem GetCallWithId(string id)
{
return Codec.ActiveCalls.FirstOrDefault(c => c.Id == id);
}
/// <summary>
///
/// </summary>
/// <param name="s"></param>
void DirectorySearch(string s)
{
var dirCodec = Codec as IHasDirectory;
if (dirCodec != null)
{
dirCodec.SearchDirectory(s);
}
}
/// <summary>
///
/// </summary>
/// <param name="id"></param>
void GetDirectory(string id)
{
var dirCodec = Codec as IHasDirectory;
if(dirCodec == null)
{
return;
}
dirCodec.GetDirectoryFolderContents(id);
}
/// <summary>
///
/// </summary>
void GetDirectoryRoot()
{
var dirCodec = Codec as IHasDirectory;
if (dirCodec == null)
{
// do something else?
return;
}
if (!dirCodec.PhonebookSyncState.InitialSyncComplete)
{
PostStatusMessage(new
{
initialSyncComplete = false
});
return;
}
dirCodec.SetCurrentDirectoryToRoot();
//PostStatusMessage(new
//{
// currentDirectory = dirCodec.DirectoryRoot
//});
}
/// <summary>
/// Requests the parent folder contents
/// </summary>
void GetPreviousDirectory()
{
var dirCodec = Codec as IHasDirectory;
if (dirCodec == null)
{
return;
}
dirCodec.GetDirectoryParentFolderContents();
}
/// <summary>
/// Handler for codec changes
/// </summary>
void codec_CallStatusChange(object sender, CodecCallStatusItemChangeEventArgs e)
{
SendVtcFullMessageObject();
}
/// <summary>
///
/// </summary>
void SendIsReady()
{
PostStatusMessage(new
{
isReady = Codec.IsReady
});
}
/// <summary>
/// Helper method to build call status for vtc
/// </summary>
/// <returns></returns>
void SendVtcFullMessageObject()
{
if (!Codec.IsReady)
{
return;
}
var info = Codec.CodecInfo;
PostStatusMessage(new
{
isInCall = Codec.IsInCall,
privacyModeIsOn = Codec.PrivacyModeIsOnFeedback.BoolValue,
sharingContentIsOn = Codec.SharingContentIsOnFeedback.BoolValue,
sharingSource = Codec.SharingSourceFeedback.StringValue,
standbyIsOn = Codec.StandbyIsOnFeedback.StringValue,
calls = Codec.ActiveCalls,
info = new
{
autoAnswerEnabled = info.AutoAnswerEnabled,
e164Alias = info.E164Alias,
h323Id = info.H323Id,
ipAddress = info.IpAddress,
sipPhoneNumber = info.SipPhoneNumber,
sipURI = info.SipUri
},
showSelfViewByDefault = Codec.ShowSelfViewByDefault,
hasDirectory = Codec is IHasDirectory,
hasDirectorySearch = true,
hasRecents = Codec is IHasCallHistory,
hasCameras = Codec is IHasCodecCameras
});
}
}
}

View File

@@ -0,0 +1,62 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Core;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials
{
/// <summary>
///
/// </summary>
public abstract class CotijaBridgeBase: Device
{
public CotijaSystemController Parent { get; private set; }
public string UserCode { get; private set; }
public abstract string RoomName { get; }
public CotijaBridgeBase(string key, string name)
: base(key, name)
{
}
/// <summary>
/// Set the parent. Does nothing else. Override to add functionality such
/// as adding actions to parent
/// </summary>
/// <param name="parent"></param>
public virtual void AddParent(CotijaSystemController parent)
{
Parent = parent;
}
/// <summary>
/// Sets the UserCode on the bridge object. Called from controller. A changed code will
/// fire method UserCodeChange. Override that to handle changes
/// </summary>
/// <param name="code"></param>
public void SetUserCode(string code)
{
var changed = UserCode != code;
UserCode = code;
if (changed)
{
UserCodeChange();
}
}
/// <summary>
/// Empty method in base class. Override this to add functionality
/// when code changes
/// </summary>
protected virtual void UserCodeChange()
{
}
}
}

View File

@@ -0,0 +1,882 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharp.Reflection;
using Crestron.SimplSharpPro.EthernetCommunication;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Essentials.AppServer.Messengers;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Room.Config;
namespace PepperDash.Essentials.Room.Cotija
{
public class CotijaDdvc01RoomBridge : CotijaBridgeBase, IDelayedConfiguration
{
public class BoolJoin
{
/// <summary>
/// 301
/// </summary>
public const uint RoomIsOn = 301;
/// <summary>
/// 12
/// </summary>
public const uint PrivacyMute = 12;
/// <summary>
/// 41
/// </summary>
public const uint PromptForCode = 41;
/// <summary>
/// 42
/// </summary>
public const uint ClientJoined = 42;
/// <summary>
/// 51
/// </summary>
public const uint ActivityShare = 51;
/// <summary>
/// 52
/// </summary>
public const uint ActivityPhoneCall = 52;
/// <summary>
/// 53
/// </summary>
public const uint ActivityVideoCall = 53;
/// <summary>
/// 1
/// </summary>
public const uint MasterVolumeIsMuted = 1;
/// <summary>
/// 1
/// </summary>
public const uint MasterVolumeMuteToggle = 1;
/// <summary>
/// 1
/// </summary>
public const uint VolumeMutesJoinStart = 1;
/// <summary>
/// 61
/// </summary>
public const uint ShutdownCancel = 61;
/// <summary>
/// 62
/// </summary>
public const uint ShutdownEnd = 62;
/// <summary>
/// 63
/// </summary>
public const uint ShutdownStart = 63;
/// <summary>
/// 72
/// </summary>
public const uint SourceHasChanged = 71;
/// <summary>
/// 261 - The start of the range of speed dial visibles
/// </summary>
public const uint SpeedDialVisibleStartJoin = 261;
/// <summary>
/// 501
/// </summary>
public const uint ConfigIsReady = 501;
/// <summary>
/// 502
/// </summary>
public const uint HideVideoConfRecents = 502;
/// <summary>
/// 503
/// </summary>
public const uint ShowCameraWhenNotInCall = 503;
/// <summary>
/// 601
/// </summary>
public const uint SourceShareDisableStartJoin = 601;
}
public class UshortJoin
{
/// <summary>
/// 1
/// </summary>
public const uint MasterVolumeLevel = 1;
/// <summary>
/// 1
/// </summary>
public const uint VolumeSlidersJoinStart = 1;
/// <summary>
/// 61
/// </summary>
public const uint ShutdownPromptDuration = 61;
/// <summary>
/// 101
/// </summary>
public const uint VolumeSliderCount = 101;
}
public class StringJoin
{
/// <summary>
/// 1
/// </summary>
public const uint VolumeSliderNamesJoinStart = 1;
/// <summary>
/// 71
/// </summary>
public const uint SelectedSourceKey = 71;
/// <summary>
/// 241
/// </summary>
public const uint SpeedDialNameStartJoin = 241;
/// <summary>
/// 251
/// </summary>
public const uint SpeedDialNumberStartJoin = 251;
/// <summary>
/// 501
/// </summary>
public const uint ConfigRoomName = 501;
/// <summary>
/// 502
/// </summary>
public const uint ConfigHelpMessage = 502;
/// <summary>
/// 503
/// </summary>
public const uint ConfigHelpNumber = 503;
/// <summary>
/// 504
/// </summary>
public const uint ConfigRoomPhoneNumber = 504;
/// <summary>
/// 505
/// </summary>
public const uint ConfigRoomURI = 505;
/// <summary>
/// 401
/// </summary>
public const uint UserCodeToSystem = 401;
/// <summary>
/// 402
/// </summary>
public const uint ServerUrl = 402;
/// <summary>
/// 512
/// </summary>
public const uint RoomSpeedDialNamesJoinStart = 512;
/// <summary>
/// 516
/// </summary>
public const uint RoomSpeedDialNumberssJoinStart = 516;
/// <summary>
/// 601
/// </summary>
public const uint SourceNameJoinStart = 601;
/// <summary>
/// 621
/// </summary>
public const uint SourceIconJoinStart = 621;
/// <summary>
/// 641
/// </summary>
public const uint SourceKeyJoinStart = 641;
/// <summary>
/// 661
/// </summary>
public const uint SourceTypeJoinStart = 661;
/// <summary>
/// 761
/// </summary>
public const uint CameraNearNameStart = 761;
/// <summary>
/// 770 - presence of this name on the input will cause the camera to be added
/// </summary>
public const uint CameraFarName = 770;
}
/// <summary>
/// Fires when config is ready to go
/// </summary>
public event EventHandler<EventArgs> ConfigurationIsReady;
public ThreeSeriesTcpIpEthernetIntersystemCommunications EISC { get; private set; }
/// <summary>
///
/// </summary>
public bool ConfigIsLoaded { get; private set; }
public override string RoomName
{
get {
var name = EISC.StringOutput[StringJoin.ConfigRoomName].StringValue;
return string.IsNullOrEmpty(name) ? "Not Loaded" : name;
}
}
CotijaDdvc01DeviceBridge SourceBridge;
Ddvc01AtcMessenger AtcMessenger;
Ddvc01VtcMessenger VtcMessenger;
/// <summary>
///
/// </summary>
/// <param name="key"></param>
/// <param name="name"></param>
/// <param name="ipId"></param>
public CotijaDdvc01RoomBridge(string key, string name, uint ipId)
: base(key, name)
{
try
{
EISC = new ThreeSeriesTcpIpEthernetIntersystemCommunications(ipId, "127.0.0.2", Global.ControlSystem);
var reg = EISC.Register();
if (reg != Crestron.SimplSharpPro.eDeviceRegistrationUnRegistrationResponse.Success)
Debug.Console(0, this, "Cannot connect EISC at IPID {0}: \r{1}", ipId, reg);
SourceBridge = new CotijaDdvc01DeviceBridge(key + "-sourceBridge", "DDVC01 source bridge", EISC);
DeviceManager.AddDevice(SourceBridge);
}
catch (Exception)
{
throw;
}
}
/// <summary>
/// Finish wiring up everything after all devices are created. The base class will hunt down the related
/// parent controller and link them up.
/// </summary>
/// <returns></returns>
public override bool CustomActivate()
{
Debug.Console(0, this, "Final activation. Setting up actions and feedbacks");
SetupFunctions();
SetupFeedbacks();
var atcKey = string.Format("atc-{0}-{1}", this.Key, Parent.Key);
AtcMessenger = new Ddvc01AtcMessenger(atcKey, EISC, "/device/audioCodec");
AtcMessenger.RegisterWithAppServer(Parent);
var vtcKey = string.Format("atc-{0}-{1}", this.Key, Parent.Key);
VtcMessenger = new Ddvc01VtcMessenger(vtcKey, EISC, "/device/videoCodec");
VtcMessenger.RegisterWithAppServer(Parent);
EISC.SigChange += EISC_SigChange;
EISC.OnlineStatusChange += (o, a) =>
{
Debug.Console(1, this, "DDVC EISC online={0}. Config is ready={1}", a.DeviceOnLine, EISC.BooleanOutput[BoolJoin.ConfigIsReady].BoolValue);
if (a.DeviceOnLine && EISC.BooleanOutput[BoolJoin.ConfigIsReady].BoolValue)
LoadConfigValues();
};
// load config if it's already there
if (EISC.IsOnline && EISC.BooleanOutput[BoolJoin.ConfigIsReady].BoolValue) // || EISC.BooleanInput[BoolJoin.ConfigIsReady].BoolValue)
LoadConfigValues();
CrestronConsole.AddNewConsoleCommand(s =>
{
for (uint i = 1; i < 1000; i++)
{
if (s.ToLower().Equals("b"))
{
CrestronConsole.ConsoleCommandResponse("D{0,6} {1} - ", i, EISC.BooleanOutput[i].BoolValue);
}
else if (s.ToLower().Equals("u"))
{
CrestronConsole.ConsoleCommandResponse("U{0,6} {1,8} - ", i, EISC.UShortOutput[i].UShortValue);
}
else if (s.ToLower().Equals("s"))
{
var val = EISC.StringOutput[i].StringValue;
if(!string.IsNullOrEmpty(val))
CrestronConsole.ConsoleCommandResponse("S{0,6} {1}\r", i, EISC.StringOutput[i].StringValue);
}
}
}, "mobilebridgedump", "Dumps DDVC01 bridge EISC data b,u,s", ConsoleAccessLevelEnum.AccessOperator);
return base.CustomActivate();
}
/// <summary>
/// Setup the actions to take place on various incoming API calls
/// </summary>
void SetupFunctions()
{
Parent.AddAction(@"/room/room1/promptForCode", new Action(() => EISC.PulseBool(BoolJoin.PromptForCode)));
Parent.AddAction(@"/room/room1/clientJoined", new Action(() => EISC.PulseBool(BoolJoin.ClientJoined)));
Parent.AddAction(@"/room/room1/status", new Action(SendFullStatus));
Parent.AddAction(@"/room/room1/source", new Action<SourceSelectMessageContent>(c =>
{
EISC.SetString(StringJoin.SelectedSourceKey, c.SourceListItem);
EISC.PulseBool(BoolJoin.SourceHasChanged);
}));
Parent.AddAction(@"/room/room1/defaultsource", new Action(() =>
EISC.PulseBool(BoolJoin.ActivityShare)));
Parent.AddAction(@"/room/room1/activityPhone", new Action(() =>
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)));
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)));
Parent.AddAction(@"/room/room1/shutdownEnd", new Action(() =>
EISC.PulseBool(BoolJoin.ShutdownEnd)));
Parent.AddAction(@"/room/room1/shutdownCancel", new Action(() =>
EISC.PulseBool(BoolJoin.ShutdownCancel)));
}
/// <summary>
///
/// </summary>
/// <param name="devKey"></param>
void SetupSourceFunctions(string devKey)
{
SourceDeviceMapDictionary sourceJoinMap = new SourceDeviceMapDictionary();
var prefix = string.Format("/device/{0}/", devKey);
foreach (var item in sourceJoinMap)
{
var join = item.Value;
Parent.AddAction(string.Format("{0}{1}", prefix, item.Key), new PressAndHoldAction(b => EISC.SetBool(join, b)));
}
}
/// <summary>
/// Links feedbacks to whatever is gonna happen!
/// </summary>
void SetupFeedbacks()
{
// Power
EISC.SetBoolSigAction(BoolJoin.RoomIsOn, b =>
PostStatusMessage(new
{
isOn = b
}));
// Source change things
EISC.SetSigTrueAction(BoolJoin.SourceHasChanged, () =>
PostStatusMessage(new
{
selectedSourceKey = EISC.StringOutput[StringJoin.SelectedSourceKey].StringValue
}));
// Volume things
EISC.SetUShortSigAction(UshortJoin.MasterVolumeLevel, u =>
PostStatusMessage(new
{
volumes = new
{
master = new
{
level = u
}
}
}));
EISC.SetBoolSigAction(BoolJoin.MasterVolumeIsMuted, b =>
PostStatusMessage(new
{
volumes = new
{
master = new
{
muted = b
}
}
}));
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,
}
});
});
}
// shutdown things
EISC.SetSigTrueAction(BoolJoin.ShutdownCancel, new Action(() =>
PostMessage("/room/shutdown/", new
{
state = "wasCancelled"
})));
EISC.SetSigTrueAction(BoolJoin.ShutdownEnd, new Action(() =>
PostMessage("/room/shutdown/", new
{
state = "hasFinished"
})));
EISC.SetSigTrueAction(BoolJoin.ShutdownStart, new Action(() =>
PostMessage("/room/shutdown/", new
{
state = "hasStarted",
duration = EISC.UShortOutput[UshortJoin.ShutdownPromptDuration].UShortValue
})));
// 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>
/// Reads in config values when the Simpl program is ready
/// </summary>
void LoadConfigValues()
{
Debug.Console(1, this, "Loading configuration from DDVC01 EISC bridge");
ConfigIsLoaded = false;
var co = ConfigReader.ConfigObject;
co.Info.RuntimeInfo.AppName = Assembly.GetExecutingAssembly().GetName().Name;
var version = Assembly.GetExecutingAssembly().GetName().Version;
co.Info.RuntimeInfo.AssemblyVersion = string.Format("{0}.{1}.{2}", version.Major, version.Minor, version.Build);
//Room
//if (co.Rooms == null)
// always start fresh in case simpl changed
co.Rooms = new List<DeviceConfig>();
var rm = new DeviceConfig();
if (co.Rooms.Count == 0)
{
Debug.Console(0, this, "Adding room to config");
co.Rooms.Add(rm);
}
else
{
Debug.Console(0, this, "Replacing Room[0] in config");
co.Rooms[0] = rm;
}
rm.Name = EISC.StringOutput[StringJoin.ConfigRoomName].StringValue;
rm.Key = "room1";
rm.Type = "ddvc01";
DDVC01RoomPropertiesConfig rmProps;
if (rm.Properties == null)
rmProps = new DDVC01RoomPropertiesConfig();
else
rmProps = JsonConvert.DeserializeObject<DDVC01RoomPropertiesConfig>(rm.Properties.ToString());
rmProps.Help = new EssentialsHelpPropertiesConfig();
rmProps.Help.CallButtonText = EISC.StringOutput[StringJoin.ConfigHelpNumber].StringValue;
rmProps.Help.Message = EISC.StringOutput[StringJoin.ConfigHelpMessage].StringValue;
rmProps.Environment = new EssentialsEnvironmentPropertiesConfig(); // enabled defaults to false
rmProps.RoomPhoneNumber = EISC.StringOutput[StringJoin.ConfigRoomPhoneNumber].StringValue;
rmProps.RoomURI = EISC.StringOutput[StringJoin.ConfigRoomURI].StringValue;
rmProps.SpeedDials = new List<DDVC01SpeedDial>();
// This MAY need a check
rmProps.AudioCodecKey = "audioCodec";
rmProps.VideoCodecKey = "videoCodec";
// volume control names
var volCount = EISC.UShortOutput[UshortJoin.VolumeSliderCount].UShortValue;
//// use Volumes object or?
//rmProps.VolumeSliderNames = new List<string>();
//for(uint i = 701; i <= 700 + volCount; i++)
//{
// rmProps.VolumeSliderNames.Add(EISC.StringInput[i].StringValue);
//}
// There should be cotija devices in here, I think...
if(co.Devices == null)
co.Devices = new List<DeviceConfig>();
// clear out previous DDVC devices
co.Devices.RemoveAll(d =>
d.Key.StartsWith("source-", StringComparison.OrdinalIgnoreCase)
|| d.Key.Equals("audioCodec", StringComparison.OrdinalIgnoreCase)
|| d.Key.Equals("videoCodec", StringComparison.OrdinalIgnoreCase));
rmProps.SourceListKey = "default";
rm.Properties = JToken.FromObject(rmProps);
// Source list! This might be brutal!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
var groupMap = GetSourceGroupDictionary();
co.SourceLists = new Dictionary<string,Dictionary<string,SourceListItem>>();
var newSl = new Dictionary<string, SourceListItem>();
// add "none" source if VTC present
if (!string.IsNullOrEmpty(rmProps.VideoCodecKey))
{
var codecOsd = new SourceListItem()
{
Name = "None",
IncludeInSourceList = true,
Order = 1,
Type = eSourceListItemType.Route,
SourceKey = ""
};
newSl.Add("Source-None", codecOsd);
}
// add sources...
for (uint i = 0; i <= 19; i++)
{
var name = EISC.StringOutput[StringJoin.SourceNameJoinStart + i].StringValue;
if(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;
Debug.Console(0, this, "Adding source {0} '{1}'", key, name);
var newSLI = new SourceListItem{
Icon = icon,
Name = name,
Order = (int)i + 10,
SourceKey = key,
Type = eSourceListItemType.Route,
DisableCodecSharing = disableShare,
};
newSl.Add(key, newSLI);
string group = "genericsource";
if (groupMap.ContainsKey(type))
{
group = groupMap[type];
}
// add dev to devices list
var devConf = new DeviceConfig {
Group = group,
Key = key,
Name = name,
Type = type
};
co.Devices.Add(devConf);
if (group.ToLower().StartsWith("settopbox")) // Add others here as needed
{
SetupSourceFunctions(key);
}
}
co.SourceLists.Add("default", newSl);
// Build "audioCodec" config if we need
if (!string.IsNullOrEmpty(rmProps.AudioCodecKey))
{
var acFavs = new List<PepperDash.Essentials.Devices.Common.Codec.CodecActiveCallItem>();
for (uint i = 0; i < 4; i++)
{
if (!EISC.GetBool(BoolJoin.SpeedDialVisibleStartJoin + i))
{
break;
}
acFavs.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
});
}
var acProps = new
{
favorites = acFavs
};
var acStr = "audioCodec";
var acConf = new DeviceConfig()
{
Group = acStr,
Key = acStr,
Name = acStr,
Type = acStr,
Properties = JToken.FromObject(acProps)
};
co.Devices.Add(acConf);
}
// Build Video codec config
if (!string.IsNullOrEmpty(rmProps.VideoCodecKey))
{
// No favorites, for now?
var favs = new List<PepperDash.Essentials.Devices.Common.Codec.CodecActiveCallItem>();
// cameras
var camsProps = new List<object>();
for (uint i = 0; i < 9; i++)
{
var name = EISC.GetString(i + StringJoin.CameraNearNameStart);
if (!string.IsNullOrEmpty(name))
{
camsProps.Add(new
{
name = name,
selector = "camera" + (i + 1),
});
}
}
var farName = EISC.GetString(StringJoin.CameraFarName);
if (!string.IsNullOrEmpty(farName))
{
camsProps.Add(new
{
name = farName,
selector = "cameraFar",
});
}
var props = new
{
favorites = favs,
cameras = camsProps,
};
var str = "videoCodec";
var conf = new DeviceConfig()
{
Group = str,
Key = str,
Name = str,
Type = str,
Properties = JToken.FromObject(props)
};
co.Devices.Add(conf);
}
Debug.Console(0, this, "******* CONFIG FROM DDVC: \r{0}", JsonConvert.SerializeObject(ConfigReader.ConfigObject, Formatting.Indented));
var handler = ConfigurationIsReady;
if (handler != null)
{
handler(this, new EventArgs());
}
ConfigIsLoaded = true;
}
/// <summary>
///
/// </summary>
void SendFullStatus()
{
if (ConfigIsLoaded)
{
var count = EISC.UShortOutput[101].UShortValue;
Debug.Console(1, this, "The Fader Count is : {0}", count);
// build volumes object, serialize and put in content of method below
// Create auxFaders
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[1].StringValue,
true,
"something.png");
volumes.Master.HasPrivacyMute = true;
volumes.Master.PrivacyMuted = EISC.BooleanOutput[BoolJoin.PrivacyMute].BoolValue;
volumes.AuxFaders = auxFaderDict;
PostStatusMessage(new
{
activityMode = GetActivityMode(),
isOn = EISC.BooleanOutput[BoolJoin.RoomIsOn].BoolValue,
selectedSourceKey = EISC.StringOutput[StringJoin.SelectedSourceKey].StringValue,
volumes = volumes
});
}
else
{
PostStatusMessage(new
{
error = "systemNotReady"
});
}
}
/// <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>
/// <param name="contentObject">The contents of the content object</param>
void PostStatusMessage(object contentObject)
{
Parent.SendMessageToServer(JObject.FromObject(new
{
type = "/room/status/",
content = contentObject
}));
}
/// <summary>
///
/// </summary>
/// <param name="messageType"></param>
/// <param name="contentObject"></param>
void PostMessage(string messageType, object contentObject)
{
Parent.SendMessageToServer(JObject.FromObject(new
{
type = messageType,
content = contentObject
}));
}
/// <summary>
///
/// </summary>
/// <param name="currentDevice"></param>
/// <param name="args"></param>
void EISC_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args)
{
if (Debug.Level >= 1)
Debug.Console(1, this, "DDVC EISC 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);
}
/// <summary>
/// Returns the mapping of types to groups, for setting up devices.
/// </summary>
/// <returns></returns>
Dictionary<string, string> GetSourceGroupDictionary()
{
//type, group
var d = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
{
{ "laptop", "pc" },
{ "wireless", "genericsource" },
{ "iptv", "settopbox" }
};
return d;
}
/// <summary>
/// updates the usercode from server
/// </summary>
protected override void UserCodeChange()
{
Debug.Console(1, this, "Server user code changed: {0}", UserCode);
EISC.StringInput[StringJoin.UserCodeToSystem].StringValue = UserCode;
EISC.StringInput[StringJoin.ServerUrl].StringValue = Parent.Config.ClientAppUrl;
}
}
}

View File

@@ -0,0 +1,490 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Essentials.AppServer.Messengers;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Room.Cotija;
using PepperDash.Essentials.Devices.Common.Codec;
using PepperDash.Essentials.Devices.Common.VideoCodec;
using PepperDash.Essentials.Devices.Common.AudioCodec;
namespace PepperDash.Essentials
{
public class CotijaEssentialsHuddleSpaceRoomBridge : CotijaBridgeBase
{
public EssentialsRoomBase Room { get; private set; }
public VideoCodecBaseMessenger VCMessenger { get; private set; }
public AudioCodecBaseMessenger ACMessenger { get; private set; }
/// <summary>
///
/// </summary>
public override string RoomName
{
get
{
return Room.Name;
}
}
/// <summary>
///
/// </summary>
/// <param name="parent"></param>
/// <param name="room"></param>
public CotijaEssentialsHuddleSpaceRoomBridge(EssentialsRoomBase room):
base("mobileControlBridge-essentialsHuddle", "Essentials Mobile Control Bridge-Huddle")
{
Room = room;
}
/// <summary>
/// Override of base: calls base to add parent and then registers actions and events.
/// </summary>
/// <param name="parent"></param>
public override void AddParent(CotijaSystemController parent)
{
base.AddParent(parent);
// we add actions to the messaging system with a path, and a related action. Custom action
// content objects can be handled in the controller's LineReceived method - and perhaps other
// sub-controller parsing could be attached to these classes, so that the systemController
// doesn't need to know about everything.
// Source Changes and room off
Parent.AddAction(string.Format(@"/room/{0}/status", Room.Key), new Action(() => SendFullStatus(Room)));
var routeRoom = Room as IRunRouteAction;
if(routeRoom != null)
Parent.AddAction(string.Format(@"/room/{0}/source", Room.Key), new Action<SourceSelectMessageContent>(c =>
routeRoom.RunRouteAction(c.SourceListItem)));
var defaultRoom = Room as IRunDefaultPresentRoute;
if(defaultRoom != null)
Parent.AddAction(string.Format(@"/room/{0}/defaultsource", Room.Key), new Action(() => defaultRoom.RunDefaultPresentRoute()));
var volumeRoom = Room as IHasCurrentVolumeControls;
if (volumeRoom != null)
{
Parent.AddAction(string.Format(@"/room/{0}/volumes/master/level", Room.Key), new Action<ushort>(u =>
(volumeRoom.CurrentVolumeControls as IBasicVolumeWithFeedback).SetVolume(u)));
Parent.AddAction(string.Format(@"/room/{0}/volumes/master/muteToggle", Room.Key), new Action(() =>
volumeRoom.CurrentVolumeControls.MuteToggle()));
volumeRoom.CurrentVolumeDeviceChange += new EventHandler<VolumeDeviceChangeEventArgs>(Room_CurrentVolumeDeviceChange);
// Registers for initial volume events, if possible
var currentVolumeDevice = volumeRoom.CurrentVolumeControls as IBasicVolumeWithFeedback;
if (currentVolumeDevice != null)
{
currentVolumeDevice.MuteFeedback.OutputChange += MuteFeedback_OutputChange;
currentVolumeDevice.VolumeLevelFeedback.OutputChange += VolumeLevelFeedback_OutputChange;
}
}
var sscRoom = Room as IHasCurrentSourceInfoChange;
if(sscRoom != null)
sscRoom.CurrentSingleSourceChange += new SourceInfoChangeHandler(Room_CurrentSingleSourceChange);
var vcRoom = Room as IHasVideoCodec;
if (vcRoom != null && vcRoom.VideoCodec != null)
{
var codec = vcRoom.VideoCodec;
var key = vcRoom.VideoCodec.Key + "-" + parent.Key;
VCMessenger = new VideoCodecBaseMessenger(key, vcRoom.VideoCodec, "/device/videoCodec");
VCMessenger.RegisterWithAppServer(Parent);
vcRoom.IsSharingFeedback.OutputChange += new EventHandler<FeedbackEventArgs>(IsSharingFeedback_OutputChange);
}
var acRoom = Room as IHasAudioCodec;
if (acRoom != null && acRoom.AudioCodec != null)
{
var codec = acRoom.AudioCodec;
var key = acRoom.AudioCodec.Key + "-" + parent.Key;
ACMessenger = new AudioCodecBaseMessenger(key, acRoom.AudioCodec, "/device/audioCodec");
ACMessenger.RegisterWithAppServer(Parent);
}
var defCallRm = Room as IRunDefaultCallRoute;
if (defCallRm != null)
{
Parent.AddAction(string.Format(@"/room/{0}/activityVideo", Room.Key), new Action(()=>defCallRm.RunDefaultCallRoute()));
}
Parent.AddAction(string.Format(@"/room/{0}/shutdownStart", Room.Key), new Action(() => Room.StartShutdown(eShutdownType.Manual)));
Parent.AddAction(string.Format(@"/room/{0}/shutdownEnd", Room.Key), new Action(() => Room.ShutdownPromptTimer.Finish()));
Parent.AddAction(string.Format(@"/room/{0}/shutdownCancel", Room.Key), new Action(() => Room.ShutdownPromptTimer.Cancel()));
Room.OnFeedback.OutputChange += OnFeedback_OutputChange;
Room.IsCoolingDownFeedback.OutputChange += IsCoolingDownFeedback_OutputChange;
Room.IsWarmingUpFeedback.OutputChange += IsWarmingUpFeedback_OutputChange;
Room.ShutdownPromptTimer.HasStarted += ShutdownPromptTimer_HasStarted;
Room.ShutdownPromptTimer.HasFinished += ShutdownPromptTimer_HasFinished;
Room.ShutdownPromptTimer.WasCancelled += ShutdownPromptTimer_WasCancelled;
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void IsSharingFeedback_OutputChange(object sender, FeedbackEventArgs e)
{
// sharing source
string shareText;
bool isSharing;
#warning This share update needs to happen on source change as well!
var vcRoom = Room as IHasVideoCodec;
var srcInfoRoom = Room as IHasCurrentSourceInfoChange;
if (vcRoom.VideoCodec.SharingContentIsOnFeedback.BoolValue && srcInfoRoom.CurrentSourceInfo != null)
{
shareText = srcInfoRoom.CurrentSourceInfo.PreferredName;
isSharing = true;
}
else
{
shareText = "None";
isSharing = false;
}
PostStatusMessage(new
{
share = new
{
currentShareText = shareText,
isSharing = isSharing
}
});
}
///// <summary>
///// Handler for codec changes
///// </summary>
//void codec_CallStatusChange(object sender, CodecCallStatusItemChangeEventArgs e)
//{
// PostStatusMessage(new
// {
// calls = GetCallsMessageObject(),
// //vtc = GetVtcCallsMessageObject()
// });
//}
/// <summary>
/// Helper for posting status message
/// </summary>
/// <param name="contentObject">The contents of the content object</param>
void PostStatusMessage(object contentObject)
{
Parent.SendMessageToServer(JObject.FromObject(new
{
type = "/room/status/",
content = contentObject
}));
}
/// <summary>
/// Handler for cancelled shutdown
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void ShutdownPromptTimer_WasCancelled(object sender, EventArgs e)
{
JObject roomStatus = new JObject();
roomStatus.Add("state", "wasCancelled");
JObject message = new JObject();
message.Add("type", "/room/shutdown/");
message.Add("content", roomStatus);
Parent.SendMessageToServer(message);
}
/// <summary>
/// Handler for when shutdown finishes
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void ShutdownPromptTimer_HasFinished(object sender, EventArgs e)
{
JObject roomStatus = new JObject();
roomStatus.Add("state", "hasFinished");
JObject message = new JObject();
message.Add("type", "/room/shutdown/");
message.Add("content", roomStatus);
Parent.SendMessageToServer(message);
}
/// <summary>
/// Handler for when shutdown starts
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void ShutdownPromptTimer_HasStarted(object sender, EventArgs e)
{
JObject roomStatus = new JObject();
roomStatus.Add("state", "hasStarted");
roomStatus.Add("duration", Room.ShutdownPromptTimer.SecondsToCount);
JObject message = new JObject();
message.Add("type", "/room/shutdown/");
message.Add("content", roomStatus);
Parent.SendMessageToServer(message);
// equivalent JS message:
// Post( { type: '/room/status/', content: { shutdown: 'hasStarted', duration: Room.ShutdownPromptTimer.SecondsToCount })
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void IsWarmingUpFeedback_OutputChange(object sender, FeedbackEventArgs e)
{
PostStatusMessage(new
{
isWarmingUp = e.BoolValue
});
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void IsCoolingDownFeedback_OutputChange(object sender, FeedbackEventArgs e)
{
PostStatusMessage(new
{
isCoolingDown = e.BoolValue
});
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void OnFeedback_OutputChange(object sender, FeedbackEventArgs e)
{
PostStatusMessage(new
{
isOn = e.BoolValue
});
}
void Room_CurrentVolumeDeviceChange(object sender, VolumeDeviceChangeEventArgs e)
{
if (e.OldDev is IBasicVolumeWithFeedback)
{
var oldDev = e.OldDev as IBasicVolumeWithFeedback;
oldDev.MuteFeedback.OutputChange -= MuteFeedback_OutputChange;
oldDev.VolumeLevelFeedback.OutputChange -= VolumeLevelFeedback_OutputChange;
}
if (e.NewDev is IBasicVolumeWithFeedback)
{
var newDev = e.NewDev as IBasicVolumeWithFeedback;
newDev.MuteFeedback.OutputChange += MuteFeedback_OutputChange;
newDev.VolumeLevelFeedback.OutputChange += VolumeLevelFeedback_OutputChange;
}
}
/// <summary>
/// Event handler for mute changes
/// </summary>
void MuteFeedback_OutputChange(object sender, FeedbackEventArgs e)
{
PostStatusMessage(new
{
volumes = new
{
master = new
{
muted = e.BoolValue
}
}
});
}
/// <summary>
/// Handles Volume changes on room
/// </summary>
void VolumeLevelFeedback_OutputChange(object sender, FeedbackEventArgs e)
{
PostStatusMessage(new
{
volumes = new
{
master = new
{
level = e.IntValue
}
}
});
}
void Room_CurrentSingleSourceChange(EssentialsRoomBase room, PepperDash.Essentials.Core.SourceListItem info, ChangeType type)
{
/* Example message
* {
"type":"/room/status",
"content": {
"selectedSourceKey": "off",
}
}
*/
if (type == ChangeType.WillChange)
{
// Disconnect from previous source
if (info != null)
{
var previousDev = info.SourceDevice;
// device type interfaces
if (previousDev is ISetTopBoxControls)
(previousDev as ISetTopBoxControls).UnlinkActions(Parent);
// common interfaces
if (previousDev is IChannel)
(previousDev as IChannel).UnlinkActions(Parent);
if (previousDev is IColor)
(previousDev as IColor).UnlinkActions(Parent);
if (previousDev is IDPad)
(previousDev as IDPad).UnlinkActions(Parent);
if (previousDev is IDvr)
(previousDev as IDvr).UnlinkActions(Parent);
if (previousDev is INumericKeypad)
(previousDev as INumericKeypad).UnlinkActions(Parent);
if (previousDev is IPower)
(previousDev as IPower).UnlinkActions(Parent);
if (previousDev is ITransport)
(previousDev as ITransport).UnlinkActions(Parent);
}
}
else // did change
{
if (info != null)
{
var dev = info.SourceDevice;
if (dev is ISetTopBoxControls)
(dev as ISetTopBoxControls).LinkActions(Parent);
if (dev is IChannel)
(dev as IChannel).LinkActions(Parent);
if (dev is IColor)
(dev as IColor).LinkActions(Parent);
if (dev is IDPad)
(dev as IDPad).LinkActions(Parent);
if (dev is IDvr)
(dev as IDvr).LinkActions(Parent);
if (dev is INumericKeypad)
(dev as INumericKeypad).LinkActions(Parent);
if (dev is IPower)
(dev as IPower).LinkActions(Parent);
if (dev is ITransport)
(dev as ITransport).LinkActions(Parent);
var srcRm = room as IHasCurrentSourceInfoChange;
PostStatusMessage(new
{
selectedSourceKey = srcRm.CurrentSourceInfoKey
});
}
}
}
/// <summary>
/// Posts the full status of the room to the server
/// </summary>
/// <param name="room"></param>
void SendFullStatus(EssentialsRoomBase room)
{
var sourceKey = room is IHasCurrentSourceInfoChange ? (room as IHasCurrentSourceInfoChange).CurrentSourceInfoKey : null;
var rmVc = room as IHasCurrentVolumeControls;
var volumes = new Volumes();
if (rmVc != null)
{
var vc = rmVc.CurrentVolumeControls as IBasicVolumeWithFeedback;
if (vc != null)
{
volumes.Master = new Volume("master", vc.VolumeLevelFeedback.UShortValue, vc.MuteFeedback.BoolValue, "Volume", true, "");
}
}
PostStatusMessage(new
{
//calls = GetCallsMessageObject(),
isOn = room.OnFeedback.BoolValue,
selectedSourceKey = sourceKey,
//vtc = GetVtcCallsMessageObject(),
volumes = volumes
});
}
///// <summary>
///// Helper to return a anonymous object with the call data for JSON message
///// </summary>
///// <returns></returns>
//object GetCallsMessageObject()
//{
// var callRm = Room as IHasVideoCodec;
// if (callRm == null)
// return null;
// return new
// {
// activeCalls = callRm.VideoCodec.ActiveCalls,
// callType = callRm.CallTypeFeedback.IntValue,
// inCall = callRm.InCallFeedback.BoolValue,
// isSharing = callRm.IsSharingFeedback.BoolValue,
// privacyModeIsOn = callRm.PrivacyModeIsOnFeedback.BoolValue
// };
//}
///// <summary>
///// Helper method to build call status for vtc
///// </summary>
///// <returns></returns>
//object GetVtcCallsMessageObject()
//{
// var callRm = Room as IHasVideoCodec;
// object vtc = null;
// if (callRm != null)
// {
// var codec = callRm.VideoCodec;
// vtc = new
// {
// isInCall = codec.IsInCall,
// calls = codec.ActiveCalls
// };
// }
// return vtc;
//}
}
/// <summary>
///
/// </summary>
public class SourceSelectMessageContent
{
public string SourceListItem { get; set; }
}
/// <summary>
///
/// </summary>
/// <param name="b"></param>
public delegate void PressAndHoldAction(bool b);
}

View File

@@ -0,0 +1,104 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
namespace PepperDash.Essentials.Room.Cotija
{
/// <summary>
/// Contains all of the default joins that map to API funtions
/// </summary>
public class SourceDeviceMapDictionary : Dictionary<string, uint>
{
public SourceDeviceMapDictionary(): base()
{
var dictionary = new Dictionary<string, uint>
{
{"preset01", 101},
{"preset02", 102},
{"preset03", 103},
{"preset04", 104},
{"preset05", 105},
{"preset06", 106},
{"preset07", 107},
{"preset08", 108},
{"preset09", 109},
{"preset10", 110},
{"preset11", 111},
{"preset12", 112},
{"preset13", 113},
{"preset14", 114},
{"preset15", 115},
{"preset16", 116},
{"preset17", 117},
{"preset18", 118},
{"preset19", 119},
{"preset20", 120},
{"preset21", 121},
{"preset22", 122},
{"preset23", 123},
{"preset24", 124},
{"num0", 130},
{"num1", 131},
{"num2", 132},
{"num3", 133},
{"num4", 134},
{"num5", 135},
{"num6", 136},
{"num7", 137},
{"num8", 138},
{"num9", 139},
{"numDash", 140},
{"numEnter", 141},
{"chanUp", 142},
{"chanDown", 143},
{"lastChan", 144},
{"exit", 145},
{"powerToggle", 146},
{"red", 147},
{"green", 148},
{"yellow", 149},
{"blue", 150},
{"video", 151},
{"previous", 152},
{"next", 153},
{"rewind", 154},
{"ffwd", 155},
{"closedCaption", 156},
{"stop", 157},
{"pause", 158},
{"up", 159},
{"down", 160},
{"left", 161},
{"right", 162},
{"settings", 163},
{"info", 164},
{"return", 165},
{"guide", 166},
{"reboot", 167},
{"dvrList", 168},
{"replay", 169},
{"play", 170},
{"select", 171},
{"record", 172},
{"menu", 173},
{"topMenu", 174},
{"prevTrack", 175},
{"nextTrack", 176},
{"powerOn", 177},
{"powerOff", 178},
{"dot", 179}
};
foreach (var item in dictionary)
{
this.Add(item.Key, item.Value);
}
}
}
}

View File

@@ -0,0 +1,62 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Newtonsoft.Json;
namespace PepperDash.Essentials.Room.Cotija
{
public class Volumes
{
[JsonProperty("master")]
public Volume Master { get; set; }
[JsonProperty("auxFaders")]
public Dictionary<string, Volume> AuxFaders { get; set; }
public Volumes()
{
AuxFaders = new Dictionary<string, Volume>();
}
}
public class Volume
{
[JsonProperty("key")]
public string Key { get; set; }
[JsonProperty("level")]
public ushort Level { get; set; }
[JsonProperty("muted")]
public bool Muted { get; set; }
[JsonProperty("label")]
public string Label { get; set; }
[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; }
public Volume(string key, ushort level, bool muted, string label, bool hasMute, string muteIcon)
{
Key = key;
Level = level;
Muted = muted;
Label = label;
HasMute = hasMute;
MuteIcon = muteIcon;
}
}
}

View File

@@ -17,7 +17,7 @@ namespace PepperDash.Essentials
/// <summary>
///
/// </summary>
public class EssentialsPresentationVolumesConfig
public class EssentialsRoomVolumesConfig
{
public EssentialsVolumeLevelConfig Master { get; set; }
public EssentialsVolumeLevelConfig Program { get; set; }
@@ -25,7 +25,6 @@ namespace PepperDash.Essentials
public EssentialsVolumeLevelConfig AudioCallTx { get; set; }
}
/// <summary>
///
/// </summary>

View File

@@ -0,0 +1,122 @@
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;
namespace PepperDash.Essentials.Bridges
{
public static class AirMediaControllerApiExtensions
{
public static void LinkToApi(this AirMediaController airMedia, BasicTriList trilist, uint joinStart, string joinMapKey)
{
var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as AirMediaControllerJoinMap;
if (joinMap == null)
{
joinMap = new AirMediaControllerJoinMap();
}
joinMap.OffsetJoinNumbers(joinStart);
Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
Debug.Console(0, "Linking to Bridge Type {0}", airMedia.GetType().Name.ToString());
trilist.StringInput[joinMap.Name].StringValue = airMedia.GetType().Name.ToString();
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]);
}
}
public class AirMediaControllerJoinMap : JoinMapBase
{
// Digital
public uint IsOnline { get; set; }
public uint IsInSession { get; set; }
public uint HdmiVideoSync { get; set; }
public uint AutomaticInputRoutingEnabled { get; set; }
// Analog
public uint VideoOut { get; set; }
public uint ErrorFB { get; set; }
public uint NumberOfUsersConnectedFB { get; set; }
public uint LoginCode { get; set; }
// Serial
public uint Name { get; set; }
public uint ConnectionAddressFB { get; set; }
public uint HostnameFB { get; set; }
public uint SerialNumberFeedback { get; set; }
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,75 @@
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 AppleTvApiExtensions
{
public static void LinkToApi(this AppleTV appleTv, BasicTriList trilist, uint joinStart, string joinMapKey)
{
var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as AppleTvJoinMap;
if (joinMap == null)
{
joinMap = new AppleTvJoinMap();
}
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));
}
}
public class AppleTvJoinMap : JoinMapBase
{
// Digital
public uint UpArrow { get; set; }
public uint DnArrow { get; set; }
public uint LeftArrow { get; set; }
public uint RightArrow { get; set; }
public uint Menu { get; set; }
public uint Select { get; set; }
public uint PlayPause { get; set; }
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,271 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro.EthernetCommunication;
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Lighting;
using PepperDash.Essentials.Core.Devices;
using PepperDash.Essentials.Devices.Common;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.CrestronIO;
using PepperDash.Essentials.DM;
//using PepperDash.Essentials.Devices.Common.Cameras;
namespace PepperDash.Essentials.Bridges
{
/// <summary>
/// Base class for all bridge class variants
/// </summary>
public class BridgeBase : Device
{
public BridgeApi Api { get; private set; }
public BridgeBase(string key) :
base(key)
{
}
}
/// <summary>
/// Base class for bridge API variants
/// </summary>
public abstract class BridgeApi : Device
{
public BridgeApi(string key) :
base(key)
{
}
}
/// <summary>
/// Bridge API using EISC
/// </summary>
public class EiscApi : BridgeApi
{
public EiscApiPropertiesConfig PropertiesConfig { get; private set; }
public ThreeSeriesTcpIpEthernetIntersystemCommunications Eisc { get; private set; }
public EiscApi(DeviceConfig dc) :
base(dc.Key)
{
PropertiesConfig = JsonConvert.DeserializeObject<EiscApiPropertiesConfig>(dc.Properties.ToString());
Eisc = new ThreeSeriesTcpIpEthernetIntersystemCommunications(PropertiesConfig.Control.IpIdInt, PropertiesConfig.Control.TcpSshProperties.Address, Global.ControlSystem);
Eisc.SigChange += new Crestron.SimplSharpPro.DeviceSupport.SigEventHandler(Eisc_SigChange);
Eisc.Register();
AddPostActivationAction( () =>
{
Debug.Console(1, this, "Linking Devices...");
foreach (var d in PropertiesConfig.Devices)
{
var device = DeviceManager.GetDeviceForKey(d.DeviceKey);
if (device != null)
{
if (device is PepperDash.Essentials.Core.Monitoring.SystemMonitorController)
{
(device as PepperDash.Essentials.Core.Monitoring.SystemMonitorController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
continue;
}
else if (device is GenericComm)
{
(device as GenericComm).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
continue;
}
//else if (device is CameraBase)
//{
// (device as CameraBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
// 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 DmTxControllerBase)
{
(device as DmTxControllerBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
continue;
}
else if (device is DmRmcControllerBase)
{
(device as DmRmcControllerBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
continue;
}
else if (device is GenericRelayDevice)
{
(device as GenericRelayDevice).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
continue;
}
else if (device is IDigitalInput)
{
(device as IDigitalInput).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
continue;
}
else if (device is AppleTV)
{
(device as AppleTV).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
continue;
}
else if (device is IBridge)
{
(device as IBridge).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;
//}
}
}
Debug.Console(1, this, "Devices Linked.");
});
}
/// <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>
/// <param name="currentDevice"></param>
/// <param name="args"></param>
void Eisc_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args)
{
try
{
if (Debug.Level >= 1)
Debug.Console(1, this, "EiscApi change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
var uo = args.Sig.UserObject;
if (uo != null)
{
Debug.Console(1, this, "Executing Action: {0}", uo.ToString());
if (uo is Action<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);
}
}
}
public class EiscApiPropertiesConfig
{
[JsonProperty("control")]
public EssentialsControlPropertiesConfig Control { get; set; }
[JsonProperty("devices")]
public List<ApiDevice> Devices { get; set; }
public class ApiDevice
{
[JsonProperty("deviceKey")]
public string DeviceKey { get; set; }
[JsonProperty("joinStart")]
public uint JoinStart { get; set; }
[JsonProperty("joinMapKey")]
public string JoinMapKey { get; set; }
}
}
}

View File

@@ -0,0 +1,139 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
using PepperDash.Core;
using PepperDash.Essentials.Core.Routing;
using PepperDash.Essentials.Bridges;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.EthernetCommunication;
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();
//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);
}
}
}

View File

@@ -0,0 +1,90 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
using PepperDash.Core;
using PepperDash.Essentials.Core.Routing;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.EthernetCommunication;
using PepperDash.Essentials.Bridges;
namespace PepperDash.Essentials {
public class BridgeFactory {
public static IKeyed GetDevice(PepperDash.Essentials.Core.Config.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 { };
JsonConvert.DeserializeAnonymousType(dc.Properties.ToString(), propAnon);
var typeName = dc.Type.ToLower();
var groupName = dc.Group.ToLower();
Debug.Console(2, "Name {0}, Key {1}, Type {2}, Properties {3}", name, key, type, properties.ToString());
if (typeName == "essentialdm")
{
return new EssentialDM(key, name, properties);
}
else if (typeName == "essentialcomm")
{
Debug.Console(2, "Launch Essential Comm");
return new EssentialComm(key, name, properties);
}
else if (typeName == "essentialdsp")
{
Debug.Console(2, "Launch EssentialDsp");
return new EssentialDsp(key, name, properties);
}
else if (typeName == "essentialstvone")
{
Debug.Console(2, "Launch essentialstvone");
return new EssentialsTVOne(key, name, properties);
}
else if (typeName == "essentialslighting")
{
Debug.Console(2, "Launch essentialslighting");
return new EssentialsLightsBridge(key, name, properties);
}
else if (typeName == "eiscapi")
{
return new EiscApi(dc);
}
return null;
}
}
public class BridgeApiEisc {
public uint Ipid;
public ThreeSeriesTcpIpEthernetIntersystemCommunications Eisc;
public BridgeApiEisc(string ipid) {
Ipid = (UInt32)int.Parse(ipid, System.Globalization.NumberStyles.HexNumber);
Eisc = new ThreeSeriesTcpIpEthernetIntersystemCommunications(Ipid, "127.0.0.2", Global.ControlSystem);
Eisc.Register();
Eisc.SigChange += Eisc_SigChange;
Debug.Console(2, "BridgeApiEisc Created at Ipid {0}", ipid);
}
void Eisc_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args) {
if (Debug.Level >= 1)
Debug.Console(2, "DDVC EISC 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

@@ -0,0 +1,187 @@
//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 CameraControllerApiExtensions
// {
// 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());
// var commMonitor = cameraDevice as ICommunicationMonitor;
// commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[JoinMap.IsOnline]);
// trilist.SetBoolSigAction(JoinMap.Left, (b) =>
// {
// if (b)
// {
// cameraDevice.PanLeft();
// }
// else
// {
// cameraDevice.Stop();
// }
// });
// trilist.SetBoolSigAction(JoinMap.Right, (b) =>
// {
// if (b)
// {
// cameraDevice.PanRight();
// }
// else
// {
// cameraDevice.Stop();
// }
// });
// trilist.SetBoolSigAction(JoinMap.Up, (b) =>
// {
// if (b)
// {
// cameraDevice.TiltUp();
// }
// else
// {
// cameraDevice.Stop();
// }
// });
// trilist.SetBoolSigAction(JoinMap.Down, (b) =>
// {
// if (b)
// {
// cameraDevice.TiltDown();
// }
// else
// {
// cameraDevice.Stop();
// }
// });
// trilist.SetBoolSigAction(JoinMap.ZoomIn, (b) =>
// {
// if (b)
// {
// cameraDevice.ZoomIn();
// }
// else
// {
// cameraDevice.Stop();
// }
// });
// trilist.SetBoolSigAction(JoinMap.ZoomOut, (b) =>
// {
// if (b)
// {
// cameraDevice.ZoomOut();
// }
// else
// {
// cameraDevice.Stop();
// }
// });
// 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());
// viscaCamera.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[JoinMap.PowerOn]);
// viscaCamera.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[JoinMap.PowerOff]);
// 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 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,77 @@
//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;
// if (joinMap == null)
// 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));
// }
// }
// }
// 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,222 @@
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
{
public static int InputNumber;
public static IntFeedback InputNumberFeedback;
public static List<string> InputKeys = new List<string>();
public static void LinkToApi(this PepperDash.Essentials.Core.DisplayBase displayDevice, BasicTriList trilist, uint joinStart, string joinMapKey)
{
var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as DisplayControllerJoinMap;
if (joinMap == null)
{
joinMap = new DisplayControllerJoinMap();
}
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());
trilist.StringInput[joinMap.Name].StringValue = displayDevice.GetType().Name.ToString();
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>(PowerIsOnFeedback_OutputChange);
displayDevice.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.PowerOff]);
// PowerOn
trilist.SetSigTrueAction(joinMap.PowerOn, () =>
{
InputNumber = 0;
InputNumberFeedback.FireUpdate();
displayDevice.PowerOn();
});
displayDevice.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PowerOn]);
int count = 1;
foreach (var input in displayDevice.InputPorts)
{
InputKeys.Add(input.Key.ToString());
var tempKey = InputKeys.ElementAt(count - 1);
trilist.SetSigTrueAction((ushort)(joinMap.InputSelectOffset + count), () => { displayDevice.ExecuteSwitch(displayDevice.InputPorts[tempKey].Selector); });
Debug.Console(2, displayDevice, "Setting Input Select Action on Digital Join {0} to Input: {1}", joinMap.InputSelectOffset + count, displayDevice.InputPorts[tempKey].Key.ToString());
trilist.StringInput[(ushort)(joinMap.InputNamesOffset + count)].StringValue = input.Key.ToString();
count++;
}
Debug.Console(2, displayDevice, "Setting Input Select Action on Analog Join {0}", joinMap.InputSelect);
trilist.SetUShortSigAction(joinMap.InputSelect, (a) =>
{
if (a == 0)
{
displayDevice.PowerOff();
InputNumber = 0;
}
else if (a > 0 && a < displayDevice.InputPorts.Count && a != InputNumber)
{
displayDevice.ExecuteSwitch(displayDevice.InputPorts.ElementAt(a - 1).Selector);
InputNumber = a;
}
else if (a == 102)
{
displayDevice.PowerToggle();
}
if (twoWayDisplay != null)
InputNumberFeedback.FireUpdate();
});
var volumeDisplay = displayDevice as IBasicVolumeControls;
if (volumeDisplay != null)
{
trilist.SetBoolSigAction(joinMap.VolumeUp, (b) => volumeDisplay.VolumeUp(b));
trilist.SetBoolSigAction(joinMap.VolumeDown, (b) => volumeDisplay.VolumeDown(b));
trilist.SetSigTrueAction(joinMap.VolumeMute, () => volumeDisplay.MuteToggle());
var volumeDisplayWithFeedback = volumeDisplay as IBasicVolumeWithFeedback;
if(volumeDisplayWithFeedback != null)
{
volumeDisplayWithFeedback.VolumeLevelFeedback.LinkInputSig(trilist.UShortInput[joinMap.VolumeLevelFB]);
volumeDisplayWithFeedback.MuteFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VolumeMute]);
}
}
}
static void CurrentInputFeedback_OutputChange(object sender, FeedbackEventArgs e)
{
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
{
// Digital
public uint PowerOff { get; set; }
public uint PowerOn { get; set; }
public uint IsTwoWayDisplay { get; set; }
public uint VolumeUp { get; set; }
public uint VolumeDown { get; set; }
public uint VolumeMute { get; set; }
public uint InputSelectOffset { get; set; }
public uint ButtonVisibilityOffset { get; set; }
public uint IsOnline { get; set; }
// Analog
public uint InputSelect { get; set; }
public uint VolumeLevelFB { get; set; }
// Serial
public uint Name { get; set; }
public uint InputNamesOffset { get; set; }
public DisplayControllerJoinMap()
{
// Digital
IsOnline = 50;
PowerOff = 1;
PowerOn = 2;
IsTwoWayDisplay = 3;
VolumeUp = 5;
VolumeDown = 6;
VolumeMute = 7;
ButtonVisibilityOffset = 40;
InputSelectOffset = 10;
// Analog
InputSelect = 11;
VolumeLevelFB = 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;
VolumeLevelFB = VolumeLevelFB + joinOffset;
}
}
}

View File

@@ -0,0 +1,285 @@
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;
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]);
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)));
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 txDevice = 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 (txDevice != null)
{
txDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]);
}
}
if(basicTxDevice != null && txDevice == null)
trilist.BooleanInput[joinMap.TxAdvancedIsPresent + ioSlot].BoolValue = true;
if (txDevice != null)
{
txDevice.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]);
}
else
{
var inputPort = dmChassis.InputPorts[string.Format("inputCard{0}--hdmiIn", ioSlot)];
if(inputPort != null)
{
var hdmiInPort = inputPort.Port;
if (hdmiInPort != null)
{
if (hdmiInPort is HdmiInputWithCEC)
{
var hdmiInPortWCec = hdmiInPort as HdmiInputWithCEC;
if (hdmiInPortWCec.HdcpSupportedLevel != eHdcpSupportedLevel.Unknown)
{
SetHdcpCapabilityAction(true, hdmiInPortWCec, joinMap.HdcpSupportState + ioSlot, trilist);
}
dmChassis.InputCardHdcpCapabilityFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.HdcpSupportState + ioSlot]);
trilist.UShortInput[joinMap.HdcpSupportCapability + ioSlot].UShortValue = (ushort)dmChassis.InputCardHdcpCapabilityTypes[ioSlot];
}
}
}
}
}
else
{
dmChassis.VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus + ioSlot]);
var inputPort = dmChassis.InputPorts[string.Format("inputCard{0}-hdmiIn", ioSlot)].Port as EndpointHdmiInput;
if (inputPort != null)
{
//trilist.SetUShortSigAction((joinMap.HdcpSupport + ioSlot), u =>
}
}
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;
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.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.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]);
}
}
static void SetHdcpCapabilityAction(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>(s =>
{
port.HdcpReceiveCapability = (eHdcpCapabilityType)s;
}));
}
}
static void SetHdcpCapabilityAction(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>(s =>
{
port.HdcpCapability = (eHdcpCapabilityType)s;
}));
}
}
public class DmChassisControllerJoinMap : JoinMapBase
{
//Digital
public uint SystemId { get; set; }
public uint IsOnline { get; set; }
public uint OutputUsb { get; set; }
public uint InputUsb { get; set; }
public uint VideoSyncStatus { get; set; }
public uint InputEndpointOnline { get; set; }
public uint OutputEndpointOnline { get; set; }
public uint TxAdvancedIsPresent { get; set; } // indicates that there is an attached transmitter that should be bridged to be interacted with
//Analog
public uint OutputVideo { get; set; }
public uint OutputAudio { get; set; }
public uint HdcpSupportState { get; set; }
public uint HdcpSupportCapability { get; set; }
//SErial
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 DmChassisControllerJoinMap()
{
SystemId = 10;
//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
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
HdcpSupportState = 1000; //1001-1199
HdcpSupportCapability = 1200; //1201-1399
}
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,75 @@
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 DmRmcControllerApiExtensions
{
public static void LinkToApi(this DmRmcControllerBase rmc, BasicTriList trilist, uint joinStart, string joinMapKey)
{
var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as DmRmcControllerJoinMap;
if (joinMap == null)
joinMap = new DmRmcControllerJoinMap();
joinMap.OffsetJoinNumbers(joinStart);
Debug.Console(1, rmc, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
rmc.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]);
if(rmc.VideoOutputResolutionFeedback != null)
rmc.VideoOutputResolutionFeedback.LinkInputSig(trilist.StringInput[joinMap.CurrentOutputResolution]);
if(rmc.EdidManufacturerFeedback != null)
rmc.EdidManufacturerFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidManufacturer]);
if(rmc.EdidNameFeedback != null)
rmc.EdidNameFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidName]);
if(rmc.EdidPreferredTimingFeedback != null)
rmc.EdidPreferredTimingFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidPrefferedTiming]);
if(rmc.EdidSerialNumberFeedback != null)
rmc.EdidSerialNumberFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidSerialNumber]);
}
public 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

@@ -0,0 +1,173 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro.DM;
using Crestron.SimplSharpPro.DM.Endpoints;
using Crestron.SimplSharpPro.DM.Endpoints.Transmitters;
using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.DM;
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;
if (joinMap == null)
joinMap = new DmTxControllerJoinMap();
joinMap.OffsetJoinNumbers(joinStart);
Debug.Console(1, tx, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
tx.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]);
tx.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus]);
tx.AnyVideoInput.VideoStatus.VideoResolutionFeedback.LinkInputSig(trilist.StringInput[joinMap.CurrentInputResolution]);
trilist.UShortInput[joinMap.HdcpSupportCapability].UShortValue = (ushort)tx.HdcpSupportCapability;
bool hdcpTypeSimple;
if (tx.Hardware is DmTx4kX02CBase || tx.Hardware is DmTx4kzX02CBase)
hdcpTypeSimple = false;
else
hdcpTypeSimple = true;
if (tx is ITxRouting)
{
var txR = tx as ITxRouting;
trilist.SetUShortSigAction(joinMap.VideoInput,
new Action<ushort>(i => txR.ExecuteNumericSwitch(i, 0, eRoutingSignalType.Video)));
trilist.SetUShortSigAction(joinMap.AudioInput,
new Action<ushort>(i => txR.ExecuteNumericSwitch(i, 0, eRoutingSignalType.Audio)));
txR.VideoSourceNumericFeedback.LinkInputSig(trilist.UShortInput[joinMap.VideoInput]);
txR.AudioSourceNumericFeedback.LinkInputSig(trilist.UShortInput[joinMap.AudioInput]);
trilist.UShortInput[joinMap.HdcpSupportCapability].UShortValue = (ushort)tx.HdcpSupportCapability;
if(txR.InputPorts[DmPortName.HdmiIn] != null)
{
var inputPort = txR.InputPorts[DmPortName.HdmiIn];
if (tx.Feedbacks["HdmiInHdcpCapability"] != null)
(tx.Feedbacks["HdmiInHdcpCapability"] as IntFeedback).LinkInputSig(trilist.UShortInput[joinMap.Port1HdcpState]);
if (inputPort.ConnectionType == eRoutingPortConnectionType.Hdmi && inputPort.Port != null)
{
var port = inputPort.Port as EndpointHdmiInput;
SetHdcpCapabilityAction(hdcpTypeSimple, port, joinMap.Port1HdcpState, trilist);
}
}
if (txR.InputPorts[DmPortName.HdmiIn1] != null)
{
var inputPort = txR.InputPorts[DmPortName.HdmiIn1];
if (tx.Feedbacks["HdmiIn1HdcpCapability"] != null)
(tx.Feedbacks["HdmiIn1HdcpCapability"] as IntFeedback).LinkInputSig(trilist.UShortInput[joinMap.Port1HdcpState]);
if (inputPort.ConnectionType == eRoutingPortConnectionType.Hdmi && inputPort.Port != null)
{
var port = inputPort.Port as EndpointHdmiInput;
SetHdcpCapabilityAction(hdcpTypeSimple, port, joinMap.Port1HdcpState, trilist);
}
}
if (txR.InputPorts[DmPortName.HdmiIn2] != null)
{
var inputPort = txR.InputPorts[DmPortName.HdmiIn2];
if (tx.Feedbacks["HdmiIn2HdcpCapability"] != null)
(tx.Feedbacks["HdmiIn2HdcpCapability"] as IntFeedback).LinkInputSig(trilist.UShortInput[joinMap.Port1HdcpState]);
if (inputPort.ConnectionType == eRoutingPortConnectionType.Hdmi && inputPort.Port != null)
{
var port = inputPort.Port as EndpointHdmiInput;
SetHdcpCapabilityAction(hdcpTypeSimple, port, joinMap.Port2HdcpState, trilist);
}
}
}
}
static void SetHdcpCapabilityAction(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>(s =>
{
port.HdcpCapability = (eHdcpCapabilityType)s;
}));
}
}
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,177 @@
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;
namespace PepperDash.Essentials.Bridges
{
public static class DmpsRoutingControllerApiExtentions
{
public static void LinkToApi(this DmpsRoutingController dmpsRouter, BasicTriList trilist, uint joinStart, string joinMapKey)
{
var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as DmpsRoutingControllerJoinMap;
if (joinMap == null)
joinMap = new DmpsRoutingControllerJoinMap();
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]);
}
}
public class DmpsRoutingControllerJoinMap : JoinMapBase
{
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 DmpsRoutingControllerJoinMap()
{;
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;
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;
}
}
}
}

View File

@@ -0,0 +1,120 @@
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 SamsungDisplayControllerApiExtensions
{
public static void LinkToApi(this PepperDash.Essentials.Core.TwoWayDisplayBase displayDevice, BasicTriList trilist, uint joinStart, string joinMapKey)
{
var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as DisplayControllerJoinMap;
if (joinMap == null)
{
joinMap = new DisplayControllerJoinMap();
}
joinMap.OffsetJoinNumbers(joinStart);
Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
Debug.Console(0, "Linking to lighting Type {0}", displayDevice.GetType().Name.ToString());
var commMonitor = displayDevice as ICommunicationMonitor;
commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]);
// Poewer Off
trilist.SetSigTrueAction(joinMap.PowerOff, () => displayDevice.PowerOff());
displayDevice.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.PowerOff]);
// Poewer On
trilist.SetSigTrueAction(joinMap.PowerOn, () => displayDevice.PowerOn());
displayDevice.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PowerOn]);
// GenericLighitng Actions & FeedBack
// int sceneIndex = 1;
/*
foreach (var scene in displayDevice.LightingScenes)
{
var tempIndex = sceneIndex - 1;
//trilist.SetSigTrueAction((uint)(joinMap.LightingSceneOffset + sceneIndex), () => displayDevice.SelectScene(displayDevice.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 (displayDevice.GetType().Name.ToString() == "LutronQuantumArea")
{
var lutronDevice = displayDevice 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 = displayDevice 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 DisplayControllerJoinMap : JoinMapBase
{
public uint IsOnline { get; set; }
public uint PowerOff { 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 = 1;
PowerOff = 1;
PowerOn = 2;
SelectScene = 1;
IntegrationIdSet = 1;
LightingSceneOffset = 10;
ButtonVisibilityOffset = 40;
// 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;
}
}
}

View File

@@ -0,0 +1,144 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
using PepperDash.Core;
using PepperDash.Essentials.Core.Routing;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.EthernetCommunication;
using Crestron.SimplSharpPro.CrestronThread;
namespace PepperDash.Essentials {
public class EssentialCommConfig {
public string[] EiscApiIpids;
public EssentialCommCommConnectionConfigs[] CommConnections;
}
public class EssentialCommCommConnectionConfigs {
public uint joinNumber {get; set; }
public EssentialsControlPropertiesConfig control { get; set; }
}
public class EssentialCommsPort {
public IBasicCommunication Comm;
public IntFeedback StatusFeedback;
public BoolFeedback ConnectedFeedback;
public List<EssentialComApiMap> Outputs = new List<EssentialComApiMap>();
public String RxBuffer;
public EssentialCommsPort(EssentialsControlPropertiesConfig config, string keyPrefix) {
Comm = CommFactory.CreateCommForConfig(config, keyPrefix);
// var PortGather = new CommunicationGather(Comm, config.EndOfLineChar);
Comm.TextReceived += new EventHandler<GenericCommMethodReceiveTextArgs>(Communication_TextReceived);
var socket = Comm as ISocketStatus;
StatusFeedback = new IntFeedback(() => { return (int)socket.ClientStatus; });
ConnectedFeedback = new BoolFeedback(() => { return Comm.IsConnected; });
if (socket != null) {
socket.ConnectionChange += new EventHandler<GenericSocketStatusChageEventArgs>(socket_ConnectionChange);
} else {
}
}
void socket_ConnectionChange(object sender, GenericSocketStatusChageEventArgs e) {
StatusFeedback.FireUpdate();
ConnectedFeedback.FireUpdate();
if (e.Client.IsConnected) {
// Tasks on connect
} else {
// Cleanup items from this session
}
}
void Communication_TextReceived(object sender, GenericCommMethodReceiveTextArgs args) {
try {
foreach (var Output in Outputs) {
Output.Api.Eisc.StringInput[Output.Join].StringValue = args.Text;
}
}
catch (Exception) {
throw new FormatException(string.Format("ERROR:{0}"));
}
}
}
public class EssentialComm : Device {
public EssentialCommConfig Properties;
public CommunicationGather PortGather { get; private set; }
public List<BridgeApiEisc> Apis {get; set;}
public Dictionary<string, StringFeedback> CommFeedbacks {get; private set; }
public StatusMonitorBase CommunicationMonitor { get; private set; }
public Dictionary<uint, EssentialCommsPort> CommDictionary { get; private set; }
public EssentialComm(string key, string name, JToken properties) : base(key, name) {
Properties = JsonConvert.DeserializeObject<EssentialCommConfig>(properties.ToString());
CommFeedbacks = new Dictionary<string, StringFeedback>();
CommDictionary = new Dictionary<uint, EssentialCommsPort>();
Apis = new List<BridgeApiEisc>();
int commNumber = 1;
foreach (var commConfig in Properties.CommConnections) {
var commPort = new EssentialCommsPort(commConfig.control, string.Format("{0}-{1}", this.Key, commConfig.joinNumber));
CommDictionary.Add(commConfig.joinNumber, commPort);
commNumber++;
}
foreach (var Ipid in Properties.EiscApiIpids) {
var ApiEisc = new BridgeApiEisc(Ipid);
Apis.Add(ApiEisc);
foreach (var commConnection in CommDictionary) {
Debug.Console(2, "Joining Api{0} to comm {1}", Ipid, commConnection.Key);
var tempComm = commConnection.Value;
var tempJoin = (uint)commConnection.Key;
EssentialComApiMap ApiMap = new EssentialComApiMap(ApiEisc, (uint)tempJoin);
tempComm.Outputs.Add(ApiMap);
// Check for ApiMap Overide Values here
ApiEisc.Eisc.SetBoolSigAction(tempJoin, b => {if (b) { tempComm.Comm.Connect(); } else { tempComm.Comm.Disconnect(); }});
ApiEisc.Eisc.SetStringSigAction(tempJoin, s => tempComm.Comm.SendText(s));
tempComm.StatusFeedback.LinkInputSig(ApiEisc.Eisc.UShortInput[tempJoin]);
tempComm.ConnectedFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[tempJoin]);
}
ApiEisc.Eisc.Register();
}
}
public override bool CustomActivate()
{
try {
Debug.Console(2, "Name {0} Activated", this.Name);
return true;
}
catch (Exception e) {
Debug.Console(0, "Bridge {0}", e);
return false;
}
}
}
public class EssentialComApiMap {
public uint Join;
public BridgeApiEisc Api;
public uint connectJoin;
public EssentialComApiMap(BridgeApiEisc api, uint join) {
Join = join;
Api = api;
}
}
}

View File

@@ -0,0 +1,150 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.DM;
using PepperDash.Core;
using PepperDash.Essentials.Core.Routing;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.EthernetCommunication;
using Crestron.SimplSharpPro.DM;
namespace PepperDash.Essentials {
public class EssentialDM : PepperDash.Core.Device {
public EssentialDMProperties Properties;
public List<BridgeApiEisc> BridgeApiEiscs;
private PepperDash.Essentials.DM.DmChassisController DmSwitch;
private EssentialDMApiMap ApiMap = new EssentialDMApiMap();
public EssentialDM(string key, string name, JToken properties)
: base(key, name) {
Properties = JsonConvert.DeserializeObject<EssentialDMProperties>(properties.ToString());
}
public override bool CustomActivate() {
// Create EiscApis
try {
foreach (var device in DeviceManager.AllDevices) {
if (device.Key == this.Properties.connectionDeviceKey) {
Debug.Console(2, "deviceKey {0} Matches", device.Key);
DmSwitch = DeviceManager.GetDeviceForKey(device.Key) as PepperDash.Essentials.DM.DmChassisController;
}
else {
Debug.Console(2, "deviceKey {0} doesn't match", device.Key);
}
}
if (Properties.EiscApiIpids != null) {
foreach (string Ipid in Properties.EiscApiIpids) {
var ApiEisc = new BridgeApiEisc(Ipid);
for (uint x = 1; x <= DmSwitch.Chassis.NumberOfInputs;x++ ) {
uint tempX = x;
Debug.Console(2, "Creating EiscActions {0}", tempX);
ApiEisc.Eisc.SetUShortSigAction(ApiMap.OutputVideoRoutes[tempX], u => DmSwitch.ExecuteSwitch(u, tempX, eRoutingSignalType.Video));
ApiEisc.Eisc.SetUShortSigAction(ApiMap.OutputAudioRoutes[tempX], u => DmSwitch.ExecuteSwitch(u, tempX, eRoutingSignalType.Audio));
if (DmSwitch.TxDictionary.ContainsKey(tempX)) {
Debug.Console(2, "Creating Tx Feedbacks {0}", tempX);
var TxKey = DmSwitch.TxDictionary[tempX];
var TxDevice = DeviceManager.GetDeviceForKey(TxKey) as DmTxControllerBase;
TxDevice.IsOnline.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.TxOnlineStatus[tempX]]);
TxDevice.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.TxVideoSyncStatus[tempX]]);
ApiEisc.Eisc.SetUShortSigAction((ApiMap.HdcpSupport[tempX]), u => TxDevice.SetHdcpSupportAll((ePdtHdcpSupport)(u)));
TxDevice.HdcpSupportAllFeedback.LinkInputSig(ApiEisc.Eisc.UShortInput[ApiMap.HdcpSupport[tempX]]);
ApiEisc.Eisc.UShortInput[ApiMap.HdcpSupportCapability[tempX]].UShortValue = TxDevice.HdcpSupportCapability;
}
else {
DmSwitch.VideoInputSyncFeedbacks[tempX].LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.TxVideoSyncStatus[tempX]]);
}
if (DmSwitch.RxDictionary.ContainsKey(tempX)) {
Debug.Console(2, "Creating Rx Feedbacks {0}", tempX);
var RxKey = DmSwitch.RxDictionary[tempX];
var RxDevice = DeviceManager.GetDeviceForKey(RxKey) as DmRmcControllerBase;
RxDevice.IsOnline.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.RxOnlineStatus[tempX]]);
}
// DmSwitch.InputEndpointOnlineFeedbacks[(ushort)tempOutputNum].LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.OutputVideoRoutes[tempOutputNum]]);
DmSwitch.VideoOutputFeedbacks[(ushort)tempX].LinkInputSig(ApiEisc.Eisc.UShortInput[ApiMap.OutputVideoRoutes[tempX]]);
DmSwitch.AudioOutputFeedbacks[(ushort)tempX].LinkInputSig(ApiEisc.Eisc.UShortInput[ApiMap.OutputAudioRoutes[tempX]]);
DmSwitch.InputNameFeedbacks[(ushort)tempX].LinkInputSig(ApiEisc.Eisc.StringInput[ApiMap.InputNames[tempX]]);
DmSwitch.OutputNameFeedbacks[(ushort)tempX].LinkInputSig(ApiEisc.Eisc.StringInput[ApiMap.OutputNames[tempX]]);
DmSwitch.OutputRouteNameFeedbacks[(ushort)tempX].LinkInputSig(ApiEisc.Eisc.StringInput[ApiMap.OutputRouteNames[tempX]]);
}
DmSwitch.IsOnline.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.ChassisOnline]);
ApiEisc.Eisc.Register();
}
}
Debug.Console(2, "Name {0} Activated", this.Name);
return true;
}
catch (Exception e) {
Debug.Console(2, "BRidge {0}", e);
return false;
}
}
}
public class EssentialDMProperties {
public string connectionDeviceKey;
public string[] EiscApiIpids;
}
public class EssentialDMApiMap {
public ushort ChassisOnline = 11;
public Dictionary<uint, ushort> OutputVideoRoutes;
public Dictionary<uint, ushort> OutputAudioRoutes;
public Dictionary<uint, ushort> TxOnlineStatus;
public Dictionary<uint, ushort> RxOnlineStatus;
public Dictionary<uint, ushort> TxVideoSyncStatus;
public Dictionary<uint, ushort> InputNames;
public Dictionary<uint, ushort> OutputNames;
public Dictionary<uint, ushort> OutputRouteNames;
public Dictionary<uint, ushort> HdcpSupport;
public Dictionary<uint, ushort> HdcpSupportCapability;
public EssentialDMApiMap() {
OutputVideoRoutes = new Dictionary<uint, ushort>();
OutputAudioRoutes = new Dictionary<uint, ushort>();
TxOnlineStatus = new Dictionary<uint, ushort>();
RxOnlineStatus = new Dictionary<uint, ushort>();
TxVideoSyncStatus = new Dictionary<uint, ushort>();
InputNames = new Dictionary<uint, ushort>();
OutputNames = new Dictionary<uint, ushort>();
OutputRouteNames = new Dictionary<uint, ushort>();
HdcpSupport = new Dictionary<uint, ushort>();
HdcpSupportCapability = new Dictionary<uint, ushort>();
for (uint x = 1; x <= 200; x++) {
// Debug.Console(0, "Init Value {0}", x);
uint tempNum = x;
HdcpSupportCapability[tempNum] = (ushort)(tempNum + 1200);
HdcpSupport[tempNum] = (ushort)(tempNum + 1000);
OutputVideoRoutes[tempNum] = (ushort)(tempNum + 100);
OutputAudioRoutes[tempNum] = (ushort)(tempNum + 300);
TxOnlineStatus[tempNum] = (ushort)(tempNum + 500);
RxOnlineStatus[tempNum] = (ushort)(tempNum + 700);
TxVideoSyncStatus[tempNum] = (ushort)(tempNum + 100);
InputNames[tempNum] = (ushort)(tempNum + 100);
OutputNames[tempNum] = (ushort)(tempNum + 300);
OutputRouteNames[tempNum] = (ushort)(tempNum + 2000);
}
}
}
}

View File

@@ -0,0 +1,217 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.DM;
using PepperDash.Core;
using PepperDash.Essentials.Core.Routing;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.EthernetCommunication;
using Crestron.SimplSharpPro.DM;
namespace PepperDash.Essentials {
public class EssentialDsp : PepperDash.Core.Device {
public EssentialDspProperties Properties;
public List<BridgeApiEisc> BridgeApiEiscs;
private PepperDash.Essentials.Devices.Common.DSP.QscDsp Dsp;
private EssentialDspApiMap ApiMap = new EssentialDspApiMap();
public EssentialDsp(string key, string name, JToken properties)
: base(key, name) {
Properties = JsonConvert.DeserializeObject<EssentialDspProperties>(properties.ToString());
}
public override bool CustomActivate() {
// Create EiscApis
try
{
ICommunicationMonitor comm = null;
foreach (var device in DeviceManager.AllDevices)
{
if (device.Key == this.Properties.connectionDeviceKey)
{
if (!(device is ICommunicationMonitor))
{
comm = device as ICommunicationMonitor;
}
Debug.Console(2, "deviceKey {0} Matches", device.Key);
Dsp = DeviceManager.GetDeviceForKey(device.Key) as PepperDash.Essentials.Devices.Common.DSP.QscDsp;
break;
}
else
{
Debug.Console(2, "deviceKey {0} doesn't match", device.Key);
}
}
if (Properties.EiscApiIpids != null && Dsp != null)
{
foreach (string Ipid in Properties.EiscApiIpids)
{
var ApiEisc = new BridgeApiEisc(Ipid);
Debug.Console(2, "Connecting EiscApi {0} to {1}", ApiEisc.Ipid, Dsp.Name);
ushort x = 1;
if (comm != null)
{
comm.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.Online]);
}
foreach (var channel in Dsp.LevelControlPoints)
{
//var QscChannel = channel.Value as PepperDash.Essentials.Devices.Common.DSP.QscDspLevelControl;
Debug.Console(2, "QscChannel {0} connect", x);
var genericChannel = channel.Value as IBasicVolumeWithFeedback;
if (channel.Value.Enabled)
{
ApiEisc.Eisc.StringInput[ApiMap.channelName[x]].StringValue = channel.Value.LevelCustomName;
ApiEisc.Eisc.UShortInput[ApiMap.channelType[x]].UShortValue = (ushort)channel.Value.Type;
genericChannel.MuteFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.channelMuteToggle[x]]);
genericChannel.VolumeLevelFeedback.LinkInputSig(ApiEisc.Eisc.UShortInput[ApiMap.channelVolume[x]]);
ApiEisc.Eisc.SetSigTrueAction(ApiMap.channelMuteToggle[x], () => genericChannel.MuteToggle());
ApiEisc.Eisc.SetSigTrueAction(ApiMap.channelMuteOn[x], () => genericChannel.MuteOn());
ApiEisc.Eisc.SetSigTrueAction(ApiMap.channelMuteOff[x], () => genericChannel.MuteOff());
ApiEisc.Eisc.SetBoolSigAction(ApiMap.channelVolumeUp[x], b => genericChannel.VolumeUp(b));
ApiEisc.Eisc.SetBoolSigAction(ApiMap.channelVolumeDown[x], b => genericChannel.VolumeDown(b));
ApiEisc.Eisc.SetUShortSigAction(ApiMap.channelVolume[x], u => genericChannel.SetVolume(u));
ApiEisc.Eisc.SetStringSigAction(ApiMap.presetString, s => Dsp.RunPreset(s));
}
x++;
}
x = 1;
foreach (var preset in Dsp.PresetList)
{
ApiEisc.Eisc.StringInput[ApiMap.presets[x]].StringValue = preset.label;
ApiEisc.Eisc.SetSigTrueAction(ApiMap.presets[x], () => Dsp.RunPresetNumber(x));
x++;
}
foreach (var dialer in Dsp.Dialers)
{
ApiEisc.Eisc.SetSigTrueAction(ApiMap.Keypad0, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num0));
ApiEisc.Eisc.SetSigTrueAction(ApiMap.Keypad1, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num1));
ApiEisc.Eisc.SetSigTrueAction(ApiMap.Keypad2, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num2));
ApiEisc.Eisc.SetSigTrueAction(ApiMap.Keypad3, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num3));
ApiEisc.Eisc.SetSigTrueAction(ApiMap.Keypad4, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num4));
ApiEisc.Eisc.SetSigTrueAction(ApiMap.Keypad5, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num5));
ApiEisc.Eisc.SetSigTrueAction(ApiMap.Keypad6, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num6));
ApiEisc.Eisc.SetSigTrueAction(ApiMap.Keypad7, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num7));
ApiEisc.Eisc.SetSigTrueAction(ApiMap.Keypad8, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num8));
ApiEisc.Eisc.SetSigTrueAction(ApiMap.Keypad9, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num9));
ApiEisc.Eisc.SetSigTrueAction(ApiMap.KeypadStar, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Star));
ApiEisc.Eisc.SetSigTrueAction(ApiMap.KeypadPound, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Pound));
ApiEisc.Eisc.SetSigTrueAction(ApiMap.KeypadClear, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Clear));
ApiEisc.Eisc.SetSigTrueAction(ApiMap.KeypadBackspace, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Backspace));
ApiEisc.Eisc.SetSigTrueAction(ApiMap.Dial, () => dialer.Value.Dial());
ApiEisc.Eisc.SetSigTrueAction(ApiMap.DoNotDisturbToggle, () => dialer.Value.DoNotDisturbToggle());
ApiEisc.Eisc.SetSigTrueAction(ApiMap.DoNotDisturbOn, () => dialer.Value.DoNotDisturbOn());
ApiEisc.Eisc.SetSigTrueAction(ApiMap.DoNotDisturbOff, () => dialer.Value.DoNotDisturbOff());
ApiEisc.Eisc.SetSigTrueAction(ApiMap.AutoAnswerToggle, () => dialer.Value.AutoAnswerToggle());
ApiEisc.Eisc.SetSigTrueAction(ApiMap.AutoAnswerOn, () => dialer.Value.AutoAnswerOn());
ApiEisc.Eisc.SetSigTrueAction(ApiMap.AutoAnswerOff, () => dialer.Value.AutoAnswerOff());
dialer.Value.DoNotDisturbFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.DoNotDisturbToggle]);
dialer.Value.DoNotDisturbFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.DoNotDisturbOn]);
dialer.Value.DoNotDisturbFeedback.LinkComplementInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.DoNotDisturbOff]);
dialer.Value.AutoAnswerFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.AutoAnswerToggle]);
dialer.Value.AutoAnswerFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.AutoAnswerOn]);
dialer.Value.AutoAnswerFeedback.LinkComplementInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.AutoAnswerOff]);
dialer.Value.OffHookFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.Dial]);
dialer.Value.DialStringFeedback.LinkInputSig(ApiEisc.Eisc.StringInput[ApiMap.DialString]);
}
}
}
Debug.Console(2, "Name {0} Activated", this.Name);
return true;
}
catch (Exception e) {
Debug.Console(0, "Bridge {0}", e);
return false;
}
}
}
public class EssentialDspProperties {
public string connectionDeviceKey;
public string[] EiscApiIpids;
}
public class EssentialDspApiMap {
public ushort Online = 1;
public ushort presetString = 2000;
public Dictionary<uint, ushort> channelMuteToggle;
public Dictionary<uint, ushort> channelMuteOn;
public Dictionary<uint, ushort> channelMuteOff;
public Dictionary<uint, ushort> channelVolume;
public Dictionary<uint, ushort> channelType;
public Dictionary<uint, ushort> channelName;
public Dictionary<uint, ushort> channelVolumeUp;
public Dictionary<uint, ushort> channelVolumeDown;
public Dictionary<uint, ushort> presets;
public ushort DialString = 3100;
public ushort Keypad0 = 3110;
public ushort Keypad1 = 3111;
public ushort Keypad2 = 3112;
public ushort Keypad3 = 3113;
public ushort Keypad4 = 3114;
public ushort Keypad5 = 3115;
public ushort Keypad6 = 3116;
public ushort Keypad7 = 3117;
public ushort Keypad8 = 3118;
public ushort Keypad9 = 3119;
public ushort KeypadStar = 3120;
public ushort KeypadPound = 3121;
public ushort KeypadClear = 3122;
public ushort KeypadBackspace = 3123;
public ushort Dial = 3124;
public ushort DoNotDisturbToggle = 3132;
public ushort DoNotDisturbOn = 3133;
public ushort DoNotDisturbOff = 3134;
public ushort AutoAnswerToggle = 3127;
public ushort AutoAnswerOn = 3125;
public ushort AutoAnswerOff = 3126;
public EssentialDspApiMap() {
channelMuteToggle = new Dictionary<uint, ushort>();
channelMuteOn = new Dictionary<uint, ushort>();
channelMuteOff = new Dictionary<uint, ushort>();
channelVolume = new Dictionary<uint, ushort>();
channelName = new Dictionary<uint, ushort>();
channelType = new Dictionary<uint, ushort>();
presets = new Dictionary<uint, ushort>();
channelVolumeUp = new Dictionary<uint, ushort>();
channelVolumeDown = new Dictionary<uint, ushort>();
for (uint x = 1; x <= 100; x++) {
uint tempNum = x;
presets[tempNum] = (ushort)(tempNum + 100);
channelMuteToggle[tempNum] = (ushort)(tempNum + 400);
channelMuteOn[tempNum] = (ushort)(tempNum + 600);
channelMuteOff[tempNum] = (ushort)(tempNum + 800);
channelVolume[tempNum] = (ushort)(tempNum + 200);
channelName[tempNum] = (ushort)(tempNum + 200);
channelType[tempNum] = (ushort)(tempNum + 400);
channelVolumeUp[tempNum] = (ushort)(tempNum + 1000);
channelVolumeDown[tempNum] = (ushort)(tempNum + 1200);
}
}
}
}

View File

@@ -0,0 +1,98 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.DM;
using PepperDash.Core;
using PepperDash.Essentials.Core.Routing;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.EthernetCommunication;
using Crestron.SimplSharpPro.DM;
namespace PepperDash.Essentials
{
public class EssentialsTVOne : PepperDash.Core.Device
{
public EssentialTVOneProperties Properties;
public List<BridgeApiEisc> BridgeApiEiscs;
private PepperDash.Essentials.Devices.Common.TVOneCorio TVOneCorio;
private EssentialsTVOneApiMap ApiMap = new EssentialsTVOneApiMap();
public EssentialsTVOne(string key, string name, JToken properties)
: base(key, name)
{
Properties = JsonConvert.DeserializeObject<EssentialTVOneProperties>(properties.ToString());
}
public override bool CustomActivate() {
// Create EiscApis
try
{
foreach (var device in DeviceManager.AllDevices)
{
if (device.Key == this.Properties.connectionDeviceKey)
{
Debug.Console(2, "deviceKey {0} Matches", device.Key);
TVOneCorio = DeviceManager.GetDeviceForKey(device.Key) as PepperDash.Essentials.Devices.Common.TVOneCorio;
break;
}
else
{
Debug.Console(2, "deviceKey {0} doesn't match", device.Key);
}
}
if (Properties.EiscApiIpids != null && TVOneCorio != null)
{
foreach (string Ipid in Properties.EiscApiIpids)
{
var ApiEisc = new BridgeApiEisc(Ipid);
Debug.Console(2, "Connecting EiscApi {0} to {1}", ApiEisc.Ipid, TVOneCorio.Name);
ushort x = 1;
TVOneCorio.OnlineFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.Online]);
ApiEisc.Eisc.SetUShortSigAction(ApiMap.CallPreset, u => TVOneCorio.CallPreset(u));
TVOneCorio.PresetFeedback.LinkInputSig(ApiEisc.Eisc.UShortInput[ApiMap.PresetFeedback]);
}
}
Debug.Console(2, "Name {0} Activated", this.Name);
return true;
}
catch (Exception e) {
Debug.Console(0, "Bridge {0}", e);
return false;
}
}
}
public class EssentialTVOneProperties
{
public string connectionDeviceKey;
public string[] EiscApiIpids;
}
public class EssentialsTVOneApiMap
{
public ushort CallPreset = 1;
public ushort PresetFeedback = 1;
public ushort Online = 1;
public EssentialsTVOneApiMap()
{
}
}
}

View File

@@ -0,0 +1,103 @@
//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;
// if (joinMap == null)
// joinMap = new GenericLightingJoinMap();
// 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));
// }
// */
// }
// }
// 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,66 @@
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.Core.CrestronIO;
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;
if (joinMap == null)
joinMap = new GenericRelayControllerJoinMap();
joinMap.OffsetJoinNumbers(joinStart);
if (relay.RelayOutput == null)
{
Debug.Console(1, relay, "Unable to link device '{0}'. Relay is null", relay.Key);
return;
}
Debug.Console(1, relay, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
trilist.SetBoolSigAction(joinMap.Relay, new Action<bool>(b =>
{
if (b)
relay.CloseRelay();
else
relay.OpenRelay();
}));
// feedback for relay state
relay.OutputIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Relay]);
}
}
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;
}
}
}

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