Compare commits

...

484 Commits
v1.0.0 ... JTA

Author SHA1 Message Date
Jason T Alborough
5a2b1f431f Changes to essentials framework 2019-03-07 12:09:03 -05:00
Jason T Alborough
6253d4becf Generic LightingBRidge. Adds a check for 0 values. Now recalls Analog scene value - 1 2019-03-06 15:49:20 -05:00
Jason T Alborough
1bb9bfab70 Adds QscDsp Eiscbridge 2019-03-06 15:28:35 -05:00
Jason T Alborough
6aae1c6613 Adds TvOne Eisc Bridge.
Fixes line endings on the DmChassisControllerBridge (per prompt)
2019-03-06 13:01:35 -05:00
Jason T Alborough
72477a9a24 Changes to EssentialsFramework 2019-03-06 09:06:41 -05: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
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
379 changed files with 122339 additions and 33246 deletions

3
.gitignore vendored
View File

@@ -19,4 +19,5 @@ Thumbs.db
obj/
[Rr]elease*/
_ReSharper*/
SIMPLSharpLogs/
SIMPLSharpLogs/
*.projectinfo

3
.gitmodules vendored Normal file
View File

@@ -0,0 +1,3 @@
[submodule "essentials-framework"]
path = essentials-framework
url = https://bitbucket.org/Pepperdash_Products/essentials-framework.git

View File

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

View File

@@ -1,98 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Newtonsoft.Json;
using PepperDash.Core;
namespace PepperDash.Essentials.Core
{
public class ComPortController : Device, IBasicCommunication
{
public event EventHandler<GenericCommMethodReceiveBytesArgs> BytesReceived;
public event EventHandler<GenericCommMethodReceiveTextArgs> TextReceived;
public bool IsConnected { get { return true; } }
ComPort Port;
ComPort.ComPortSpec Spec;
public ComPortController(string key, ComPort port, ComPort.ComPortSpec spec)
: base(key)
{
Port = port;
Spec = spec;
//IsConnected = new BoolFeedback(CommonBoolCue.IsConnected, () => true);
if (Port.Parent is CrestronControlSystem)
{
var result = Port.Register();
if (result != eDeviceRegistrationUnRegistrationResponse.Success)
{
Debug.Console(0, this, "WARNING: Cannot register Com port: {0}", result);
return; // false
}
}
var specResult = Port.SetComPortSpec(Spec);
if (specResult != 0)
{
Debug.Console(0, this, "WARNING: Cannot set comspec");
return; // false
}
Port.SerialDataReceived += new ComPortDataReceivedEvent(Port_SerialDataReceived);
}
~ComPortController()
{
Port.SerialDataReceived -= Port_SerialDataReceived;
}
void Port_SerialDataReceived(ComPort ReceivingComPort, ComPortSerialDataEventArgs args)
{
var bytesHandler = BytesReceived;
if (bytesHandler != null)
{
var bytes = Encoding.GetEncoding(28591).GetBytes(args.SerialData);
bytesHandler(this, new GenericCommMethodReceiveBytesArgs(bytes));
}
var textHandler = TextReceived;
if (textHandler != null)
textHandler(this, new GenericCommMethodReceiveTextArgs(args.SerialData));
}
public override bool Deactivate()
{
return Port.UnRegister() == eDeviceRegistrationUnRegistrationResponse.Success;
}
#region IBasicCommunication Members
public void SendText(string text)
{
Port.Send(text);
}
public void SendBytes(byte[] bytes)
{
var text = Encoding.GetEncoding(28591).GetString(bytes, 0, bytes.Length);
Port.Send(text);
}
//public BoolFeedback IsConnected { get; private set; }
public void Connect()
{
}
public void Disconnect()
{
}
#endregion
}
}

View File

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

View File

@@ -1,178 +0,0 @@
using System;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.Core
{
/// <summary>
///
/// </summary>
public class CommFactory
{
public static EssentialsControlPropertiesConfig GetControlPropertiesConfig(DeviceConfig deviceConfig)
{
try
{
return JsonConvert.DeserializeObject<EssentialsControlPropertiesConfig>
(deviceConfig.Properties["control"].ToString());
//Debug.Console(2, "Control TEST: {0}", JsonConvert.SerializeObject(controlConfig));
}
catch (Exception e)
{
Debug.Console(0, "ERROR: [{0}] Control properties deserialize failed:\r{1}", deviceConfig.Key, e);
return null;
}
}
/// <summary>
/// Returns a comm method of either com port, TCP, SSH
/// </summary>
/// <param name="deviceConfig">The Device config object</param>
public static IBasicCommunication CreateCommForDevice(DeviceConfig deviceConfig)
{
EssentialsControlPropertiesConfig controlConfig = GetControlPropertiesConfig(deviceConfig);
if (controlConfig == null)
return null;
IBasicCommunication comm = null;
try
{
var c = controlConfig.TcpSshProperties;
switch (controlConfig.Method)
{
case eControlMethod.Com:
comm = new ComPortController(deviceConfig.Key + "-com", GetComPort(controlConfig), controlConfig.ComParams);
break;
case eControlMethod.IR:
break;
case eControlMethod.Ssh:
{
var ssh = new GenericSshClient(deviceConfig.Key + "-ssh", c.Address, c.Port, c.Username, c.Password);
ssh.AutoReconnect = c.AutoReconnect;
if(ssh.AutoReconnect)
ssh.AutoReconnectIntervalMs = c.AutoReconnectIntervalMs;
comm = ssh;
break;
}
case eControlMethod.Tcpip:
{
var tcp = new GenericTcpIpClient(deviceConfig.Key + "-tcp", c.Address, c.Port, c.BufferSize);
tcp.AutoReconnect = c.AutoReconnect;
if (tcp.AutoReconnect)
tcp.AutoReconnectIntervalMs = c.AutoReconnectIntervalMs;
comm = tcp;
break;
}
case eControlMethod.Telnet:
break;
default:
break;
}
}
catch (Exception e)
{
Debug.Console(0, "Cannot create communication from JSON:\r{0}\r\rException:\r{1}",
deviceConfig.Properties.ToString(), e);
}
// put it in the device manager if it's the right flavor
var comDev = comm as Device;
if (comDev != null)
DeviceManager.AddDevice(comDev);
return comm;
}
public static ComPort GetComPort(EssentialsControlPropertiesConfig config)
{
var comPar = config.ComParams;
var dev = GetIComPortsDeviceFromManagedDevice(config.ControlPortDevKey);
if (dev != null && config.ControlPortNumber <= dev.NumberOfComPorts)
return dev.ComPorts[config.ControlPortNumber];
Debug.Console(0, "GetComPort: Device '{0}' does not have com port {1}", config.ControlPortDevKey, config.ControlPortNumber);
return null;
}
/// <summary>
/// Helper to grab the IComPorts device for this PortDeviceKey. Key "controlSystem" will
/// return the ControlSystem object from the Global class.
/// </summary>
/// <returns>IComPorts device or null if the device is not found or does not implement IComPorts</returns>
public static IComPorts GetIComPortsDeviceFromManagedDevice(string ComPortDevKey)
{
if ((ComPortDevKey.Equals("controlSystem", System.StringComparison.OrdinalIgnoreCase)
|| ComPortDevKey.Equals("processor", System.StringComparison.OrdinalIgnoreCase))
&& Global.ControlSystem is IComPorts)
return Global.ControlSystem;
else
{
var dev = DeviceManager.GetDeviceForKey(ComPortDevKey) as IComPorts;
if (dev == null)
Debug.Console(0, "ComPortConfig: Cannot find com port device '{0}'", ComPortDevKey);
return dev;
}
}
}
/// <summary>
///
/// </summary>
public class EssentialsControlPropertiesConfig :
PepperDash.Core.ControlPropertiesConfig
{
// ****** All of these things, except for #Pro-specific com stuff, were
// moved into PepperDash.Core to help non-pro PortalSync.
//public eControlMethod Method { get; set; }
//public string ControlPortDevKey { get; set; }
//[JsonProperty(NullValueHandling = NullValueHandling.Ignore)] // In case "null" is present in config on this value
//public uint ControlPortNumber { get; set; }
//public TcpSshPropertiesConfig TcpSshProperties { get; set; }
//public string IrFile { get; set; }
//public ComPortConfig ComParams { get; set; }
[JsonConverter(typeof(ComSpecJsonConverter))]
public ComPort.ComPortSpec ComParams { get; set; }
//public string IpId { get; set; }
//[JsonIgnore]
//public uint IpIdInt { get { return Convert.ToUInt32(IpId, 16); } }
//public char EndOfLineChar { get; set; }
///// <summary>
///// Defaults to Environment.NewLine;
///// </summary>
//public string EndOfLineString { get; set; }
//public string DeviceReadyResponsePattern { get; set; }
//public EssentialsControlPropertiesConfig()
//{
// EndOfLineString = CrestronEnvironment.NewLine;
//}
}
public class IrControlSpec
{
public string PortDeviceKey { get; set; }
public uint PortNumber { get; set; }
public string File { get; set; }
}
//public enum eControlMethod
//{
// None = 0, Com, IpId, IR, Ssh, Tcpip, Telnet
//}
}

View File

@@ -1,23 +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
{
/// <summary>
///
/// </summary>
public interface IComPortsDevice
{
IComPorts Device { get; }
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,62 +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;
namespace PepperDash.Essentials.Core.Config
{
public class DeviceConfig
{
[JsonProperty("key")]
public string Key { get; set; }
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("group")]
public string Group { get; set; }
[JsonProperty("type")]
public string Type { get; set; }
[JsonProperty("properties")]
[JsonConverter(typeof(DevicePropertiesConverter))]
public JToken Properties { get; set; }
}
/// <summary>
///
/// </summary>
public class DevicePropertiesConverter : JsonConverter
{
public override bool CanConvert(Type objectType)
{
return objectType == typeof(JToken);
}
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
return JToken.ReadFrom(reader);
}
public override bool CanWrite
{
get
{
return false;
}
}
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
throw new NotImplementedException("SOD OFF HOSER");
}
}
}

View File

@@ -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,128 +0,0 @@
using Crestron.SimplSharpPro;
namespace PepperDash.Essentials.Core
{
public static class CommonBoolCue
{
public static readonly Cue Power = new Cue("Power", 101, eCueType.Bool);
public static readonly Cue PowerOn = new Cue("PowerOn", 102, eCueType.Bool);
public static readonly Cue PowerOff = new Cue("PowerOff", 103, eCueType.Bool);
public static readonly Cue HasPowerFeedback = new Cue("HasPowerFeedback", 101, eCueType.Bool);
public static readonly Cue PowerOnFeedback = new Cue("PowerOnFeedback", 102, eCueType.Bool);
public static readonly Cue IsOnlineFeedback = new Cue("IsOnlineFeedback", 104, eCueType.Bool);
public static readonly Cue IsWarmingUp = new Cue("IsWarmingUp", 105, eCueType.Bool);
public static readonly Cue IsCoolingDown = new Cue("IsCoolingDown", 106, eCueType.Bool);
public static readonly Cue Dash = new Cue("Dash", 109, eCueType.Bool);
public static readonly Cue Digit0 = new Cue("Digit0", 110, eCueType.Bool);
public static readonly Cue Digit1 = new Cue("Digit1", 111, eCueType.Bool);
public static readonly Cue Digit2 = new Cue("Digit2", 112, eCueType.Bool);
public static readonly Cue Digit3 = new Cue("Digit3", 113, eCueType.Bool);
public static readonly Cue Digit4 = new Cue("Digit4", 114, eCueType.Bool);
public static readonly Cue Digit5 = new Cue("Digit5", 115, eCueType.Bool);
public static readonly Cue Digit6 = new Cue("Digit6", 116, eCueType.Bool);
public static readonly Cue Digit7 = new Cue("Digit7", 117, eCueType.Bool);
public static readonly Cue Digit8 = new Cue("Digit8", 118, eCueType.Bool);
public static readonly Cue Digit9 = new Cue("Digit9", 119, eCueType.Bool);
public static readonly Cue KeypadMisc1 = new Cue("KeypadMisc1", 120, eCueType.Bool);
public static readonly Cue KeypadMisc2 = new Cue("KeypadMisc2", 121, eCueType.Bool);
public static readonly Cue NumericEnter = new Cue("Enter", 122, eCueType.Bool);
public static readonly Cue ChannelUp = new Cue("ChannelUp", 123, eCueType.Bool);
public static readonly Cue ChannelDown = new Cue("ChannelDown", 124, eCueType.Bool);
public static readonly Cue Last = new Cue("Last", 125, eCueType.Bool);
public static readonly Cue OpenClose = new Cue("OpenClose", 126, eCueType.Bool);
public static readonly Cue Subtitle = new Cue("Subtitle", 127, eCueType.Bool);
public static readonly Cue Audio = new Cue("Audio", 128, eCueType.Bool);
public static readonly Cue Info = new Cue("Info", 129, eCueType.Bool);
public static readonly Cue Menu = new Cue("Menu", 130, eCueType.Bool);
public static readonly Cue DeviceMenu = new Cue("DeviceMenu", 131, eCueType.Bool);
public static readonly Cue Return = new Cue("Return", 132, eCueType.Bool);
public static readonly Cue Back = new Cue("Back", 133, eCueType.Bool);
public static readonly Cue Exit = new Cue("Exit", 134, eCueType.Bool);
public static readonly Cue Clear = new Cue("Clear", 135, eCueType.Bool);
public static readonly Cue List = new Cue("List", 136, eCueType.Bool);
public static readonly Cue Guide = new Cue("Guide", 137, eCueType.Bool);
public static readonly Cue Am = new Cue("Am", 136, eCueType.Bool);
public static readonly Cue Fm = new Cue("Fm", 137, eCueType.Bool);
public static readonly Cue Up = new Cue("Up", 138, eCueType.Bool);
public static readonly Cue Down = new Cue("Down", 139, eCueType.Bool);
public static readonly Cue Left = new Cue("Left", 140, eCueType.Bool);
public static readonly Cue Right = new Cue("Right", 141, eCueType.Bool);
public static readonly Cue Select = new Cue("Select", 142, eCueType.Bool);
public static readonly Cue SmartApps = new Cue("SmartApps", 143, eCueType.Bool);
public static readonly Cue Dvr = new Cue("Dvr", 144, eCueType.Bool);
public static readonly Cue Play = new Cue("Play", 145, eCueType.Bool);
public static readonly Cue Pause = new Cue("Pause", 146, eCueType.Bool);
public static readonly Cue Stop = new Cue("Stop", 147, eCueType.Bool);
public static readonly Cue ChapNext = new Cue("ChapNext", 148, eCueType.Bool);
public static readonly Cue ChapPrevious = new Cue("ChapPrevious", 149, eCueType.Bool);
public static readonly Cue Rewind = new Cue("Rewind", 150, eCueType.Bool);
public static readonly Cue Ffwd = new Cue("Ffwd", 151, eCueType.Bool);
public static readonly Cue Replay = new Cue("Replay", 152, eCueType.Bool);
public static readonly Cue Advance = new Cue("Advance", 153, eCueType.Bool);
public static readonly Cue Record = new Cue("Record", 154, eCueType.Bool);
public static readonly Cue Red = new Cue("Red", 155, eCueType.Bool);
public static readonly Cue Green = new Cue("Green", 156, eCueType.Bool);
public static readonly Cue Yellow = new Cue("Yellow", 157, eCueType.Bool);
public static readonly Cue Blue = new Cue("Blue", 158, eCueType.Bool);
public static readonly Cue Home = new Cue("Home", 159, eCueType.Bool);
public static readonly Cue PopUp = new Cue("PopUp", 160, eCueType.Bool);
public static readonly Cue PageUp = new Cue("PageUp", 161, eCueType.Bool);
public static readonly Cue PageDown = new Cue("PageDown", 162, eCueType.Bool);
public static readonly Cue Search = new Cue("Search", 163, eCueType.Bool);
public static readonly Cue Setup = new Cue("Setup", 164, eCueType.Bool);
public static readonly Cue RStep = new Cue("RStep", 165, eCueType.Bool);
public static readonly Cue FStep = new Cue("FStep", 166, eCueType.Bool);
public static readonly Cue IsConnected = new Cue("IsConnected", 281, eCueType.Bool);
public static readonly Cue IsOk = new Cue("IsOk", 282, eCueType.Bool);
public static readonly Cue InWarning = new Cue("InWarning", 283, eCueType.Bool);
public static readonly Cue InError = new Cue("InError", 284, eCueType.Bool);
public static readonly Cue StatusUnknown = new Cue("StatusUnknown", 285, eCueType.Bool);
public static readonly Cue VolumeUp = new Cue("VolumeUp", 401, eCueType.Bool);
public static readonly Cue VolumeDown = new Cue("VolumeDown", 402, eCueType.Bool);
public static readonly Cue MuteOn = new Cue("MuteOn", 403, eCueType.Bool);
public static readonly Cue MuteOff = new Cue("MuteOff", 404, eCueType.Bool);
public static readonly Cue MuteToggle = new Cue("MuteToggle", 405, eCueType.Bool);
public static readonly Cue ShowVolumeButtons = new Cue("ShowVolumeButtons", 406, eCueType.Bool);
public static readonly Cue ShowVolumeSlider = new Cue("ShowVolumeSlider", 407, eCueType.Bool);
public static readonly Cue Hdmi1 = new Cue("Hdmi1", 451, eCueType.Bool);
public static readonly Cue Hdmi2 = new Cue("Hdmi2", 452, eCueType.Bool);
public static readonly Cue Hdmi3 = new Cue("Hdmi3", 453, eCueType.Bool);
public static readonly Cue Hdmi4 = new Cue("Hdmi4", 454, eCueType.Bool);
public static readonly Cue Hdmi5 = new Cue("Hdmi5", 455, eCueType.Bool);
public static readonly Cue Hdmi6 = new Cue("Hdmi6", 456, eCueType.Bool);
public static readonly Cue DisplayPort1 = new Cue("DisplayPort1", 457, eCueType.Bool);
public static readonly Cue DisplayPort2 = new Cue("DisplayPort2", 458, eCueType.Bool);
public static readonly Cue Dvi1 = new Cue("Dvi1", 459, eCueType.Bool);
public static readonly Cue Dvi2 = new Cue("Dvi2", 460, eCueType.Bool);
public static readonly Cue Video1 = new Cue("Video1", 461, eCueType.Bool);
public static readonly Cue Video2 = new Cue("Video2", 462, eCueType.Bool);
public static readonly Cue Component1 = new Cue("Component1", 463, eCueType.Bool);
public static readonly Cue Component2 = new Cue("Component2", 464, eCueType.Bool);
public static readonly Cue Vga1 = new Cue("Vga1", 465, eCueType.Bool);
public static readonly Cue Vga2 = new Cue("Vga2", 466, eCueType.Bool);
public static readonly Cue Rgb1 = new Cue("Rgb1", 467, eCueType.Bool);
public static readonly Cue Rgb2 = new Cue("Rgb2", 468, eCueType.Bool);
public static readonly Cue Antenna = new Cue("Antenna", 469, eCueType.Bool);
}
public static class CommonIntCue
{
public static readonly Cue MainVolumeLevel = new Cue("MainVolumeLevel", 401, eCueType.Int);
public static readonly Cue MainVolumeLevelFeedback = new Cue("MainVolumeLevelFeedback", 401, eCueType.Int);
}
public static class CommonStringCue
{
public static readonly Cue IpConnectionsText = new Cue("IpConnectionsText", 9999, eCueType.String);
}
}

View File

@@ -1,116 +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
{
/// <summary>
/// A bridge class to cover the basic features of GenericBase hardware
/// </summary>
public class CrestronGenericBaseDevice : Device, IOnline, IHasFeedback, ICommunicationMonitor
{
public virtual GenericBase Hardware { get; protected set; }
public BoolFeedback IsOnline { get; private set; }
public BoolFeedback IsRegistered { get; private set; }
public StringFeedback IpConnectionsText { get; private set; }
public CrestronGenericBaseDevice(string key, string name, GenericBase hardware)
: base(key, name)
{
Hardware = hardware;
IsOnline = new BoolFeedback(CommonBoolCue.IsOnlineFeedback, () => Hardware.IsOnline);
IsRegistered = new BoolFeedback(new Cue("IsRegistered", 0, eCueType.Bool), () => Hardware.Registered);
IpConnectionsText = new StringFeedback(CommonStringCue.IpConnectionsText, () =>
string.Join(",", Hardware.ConnectedIpList.Select(cip => cip.DeviceIpAddress).ToArray()));
CommunicationMonitor = new CrestronGenericBaseCommunicationMonitor(this, hardware, 120000, 300000);
}
/// <summary>
/// Make sure that overriding classes call this!
/// Registers the Crestron device, connects up to the base events, starts communication monitor
/// </summary>
public override bool CustomActivate()
{
new CTimer(o =>
{
Debug.Console(1, this, "Activating");
var response = Hardware.RegisterWithLogging(Key);
if (response == eDeviceRegistrationUnRegistrationResponse.Success)
{
Hardware.OnlineStatusChange += new OnlineStatusChangeEventHandler(Hardware_OnlineStatusChange);
CommunicationMonitor.Start();
}
}, 0);
return true;
}
/// <summary>
/// This disconnects events and unregisters the base hardware device.
/// </summary>
/// <returns></returns>
public override bool Deactivate()
{
CommunicationMonitor.Stop();
Hardware.OnlineStatusChange -= Hardware_OnlineStatusChange;
return Hardware.UnRegister() == eDeviceRegistrationUnRegistrationResponse.Success;
}
/// <summary>
/// Returns a list containing the Outputs that we want to expose.
/// </summary>
public virtual List<Feedback> Feedbacks
{
get
{
return new List<Feedback>
{
IsOnline,
IsRegistered,
IpConnectionsText
};
}
}
void Hardware_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args)
{
IsOnline.FireUpdate();
}
#region IStatusMonitor Members
public StatusMonitorBase CommunicationMonitor { get; private set; }
#endregion
}
//***********************************************************************************
public class CrestronGenericBaseDeviceEventIds
{
public const uint IsOnline = 1;
public const uint IpConnectionsText =2;
}
/// <summary>
/// Adds logging to Register() failure
/// </summary>
public static class GenericBaseExtensions
{
public static eDeviceRegistrationUnRegistrationResponse RegisterWithLogging(this GenericBase device, string key)
{
var result = device.Register();
if (result != eDeviceRegistrationUnRegistrationResponse.Success)
{
Debug.Console(0, Debug.ErrorLogLevel.Error, "Cannot register device '{0}': {1}", key, result);
}
return result;
}
}
}

View File

@@ -1,98 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
namespace PepperDash.Essentials.Core
{
/// <summary>
/// Encapsulates a string-named, joined and typed command to a device
/// </summary>
[Obsolete()]
public class DevAction
{
public Cue Cue { get; private set; }
public Action<object> Action { get; private set; }
public DevAction(Cue cue, Action<object> action)
{
Cue = cue;
Action = action;
}
}
public enum eCueType
{
Bool, Int, String, Void, Other
}
/// <summary>
/// The Cue class is a container to represent a name / join number / type for simplifying
/// commands coming into devices.
/// </summary>
public class Cue
{
public string Name { get; private set; }
public uint Number { get; private set; }
public eCueType Type { get; private set; }
public Cue(string name, uint join, eCueType type)
{
Name = name;
Number = join;
Type = type;
}
/// <summary>
/// Override that prints out the cue's data
/// </summary>
public override string ToString()
{
return string.Format("{0} Cue '{1}'-{2}", Type, Name, Number);
}
///// <summary>
///// Returns a new Cue with JoinNumber offset
///// </summary>
//public Cue GetOffsetCopy(uint offset)
//{
// return new Cue(Name, Number + offset, Type);
//}
/// <summary>
/// Helper method to create a Cue of Bool type
/// </summary>
/// <returns>Cue</returns>
public static Cue BoolCue(string name, uint join)
{
return new Cue(name, join, eCueType.Bool);
}
/// <summary>
/// Helper method to create a Cue of ushort type
/// </summary>
/// <returns>Cue</returns>
public static Cue UShortCue(string name, uint join)
{
return new Cue(name, join, eCueType.Int);
}
/// <summary>
/// Helper method to create a Cue of string type
/// </summary>
/// <returns>Cue</returns>
public static Cue StringCue(string name, uint join)
{
return new Cue(name, join, eCueType.String);
}
public static readonly Cue DefaultBoolCue = new Cue("-none-", 0, eCueType.Bool);
public static readonly Cue DefaultIntCue = new Cue("-none-", 0, eCueType.Int);
public static readonly Cue DefaultStringCue = new Cue("-none-", 0, eCueType.String);
}
}

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,19 +0,0 @@
//using System;
//using System.Collections.Generic;
//using Crestron.SimplSharpPro;
//using Crestron.SimplSharpPro.DeviceSupport;
//using PepperDash.Core;
//namespace PepperDash.Essentials.Core
//{
// public interface IPresentationSource : IKeyed
// {
// string Name { get; }
// PresentationSourceType Type { get; }
// string IconName { get; set; }
// BoolFeedback HasPowerOnFeedback { get; }
// }
//}

View File

@@ -1,47 +0,0 @@
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.SmartObjects;
namespace PepperDash.Essentials.Core
{
/// <summary>
///
/// </summary>
public interface IChannel
{
void ChannelUp(bool pressRelease);
void ChannelDown(bool pressRelease);
void LastChannel(bool pressRelease);
void Guide(bool pressRelease);
void Info(bool pressRelease);
void Exit(bool pressRelease);
}
/// <summary>
///
/// </summary>
public static class IChannelExtensions
{
public static void LinkButtons(this IChannel dev, BasicTriList triList)
{
triList.SetBoolSigAction(123, dev.ChannelUp);
triList.SetBoolSigAction(124, dev.ChannelDown);
triList.SetBoolSigAction(125, dev.LastChannel);
triList.SetBoolSigAction(137, dev.Guide);
triList.SetBoolSigAction(129, dev.Info);
triList.SetBoolSigAction(134, dev.Exit);
}
public static void UnlinkButtons(this IChannel dev, BasicTriList triList)
{
triList.ClearBoolSigAction(123);
triList.ClearBoolSigAction(124);
triList.ClearBoolSigAction(125);
triList.ClearBoolSigAction(137);
triList.ClearBoolSigAction(129);
triList.ClearBoolSigAction(134);
}
}
}

View File

@@ -1,41 +0,0 @@
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.SmartObjects;
namespace PepperDash.Essentials.Core
{
/// <summary>
///
/// </summary>
public interface IColor
{
void Red(bool pressRelease);
void Green(bool pressRelease);
void Yellow(bool pressRelease);
void Blue(bool pressRelease);
}
/// <summary>
///
/// </summary>
public static class IColorExtensions
{
public static void LinkButtons(this IColor dev, BasicTriList TriList)
{
TriList.SetBoolSigAction(155, dev.Red);
TriList.SetBoolSigAction(156, dev.Green);
TriList.SetBoolSigAction(157, dev.Yellow);
TriList.SetBoolSigAction(158, dev.Blue);
}
public static void UnlinkButtons(this IColor dev, BasicTriList triList)
{
triList.ClearBoolSigAction(155);
triList.ClearBoolSigAction(156);
triList.ClearBoolSigAction(157);
triList.ClearBoolSigAction(158);
}
}
}

View File

@@ -1,50 +0,0 @@
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.SmartObjects;
namespace PepperDash.Essentials.Core
{
/// <summary>
///
/// </summary>
public interface IDPad
{
void Up(bool pressRelease);
void Down(bool pressRelease);
void Left(bool pressRelease);
void Right(bool pressRelease);
void Select(bool pressRelease);
void Menu(bool pressRelease);
void Exit(bool pressRelease);
}
/// <summary>
///
/// </summary>
public static class IDPadExtensions
{
public static void LinkButtons(this IDPad dev, BasicTriList triList)
{
triList.SetBoolSigAction(138, dev.Up);
triList.SetBoolSigAction(139, dev.Down);
triList.SetBoolSigAction(140, dev.Left);
triList.SetBoolSigAction(141, dev.Right);
triList.SetBoolSigAction(142, dev.Select);
triList.SetBoolSigAction(130, dev.Menu);
triList.SetBoolSigAction(134, dev.Exit);
}
public static void UnlinkButtons(this IDPad dev, BasicTriList triList)
{
triList.ClearBoolSigAction(138);
triList.ClearBoolSigAction(139);
triList.ClearBoolSigAction(140);
triList.ClearBoolSigAction(141);
triList.ClearBoolSigAction(142);
triList.ClearBoolSigAction(130);
triList.ClearBoolSigAction(134);
}
}
}

View File

@@ -1,13 +0,0 @@
using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.SmartObjects;
namespace PepperDash.Essentials.Core
{
public interface IDiscPlayerControls : IColor, IDPad, INumericKeypad, IPower, ITransport, IUiDisplayInfo
{
}
}

View File

@@ -1,22 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
namespace PepperDash.Essentials.Core.Devices.DeviceTypeInterfaces
{
public interface IDisplayBasic
{
void InputHdmi1();
void InputHdmi2();
void InputHdmi3();
void InputHdmi4();
void InputDisplayPort1();
void InputDvi1();
void InputVideo1();
void InputVga1();
void InputVga2();
void InputRgb1();
}
}

View File

@@ -1,12 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
namespace PepperDash.Essentials.Core
{
public interface IDumbSource
{
}
}

View File

@@ -1,40 +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.Essentials.Core;
using PepperDash.Essentials.Core.SmartObjects;
namespace PepperDash.Essentials.Core
{
/// <summary>
///
/// </summary>
public interface IDvr : IDPad
{
void DvrList(bool pressRelease);
void Record(bool pressRelease);
}
/// <summary>
///
/// </summary>
public static class IDvrExtensions
{
public static void LinkButtons(this IDvr dev, BasicTriList triList)
{
triList.SetBoolSigAction(136, dev.DvrList);
triList.SetBoolSigAction(152, dev.Record);
}
public static void UnlinkButtons(this IDvr dev, BasicTriList triList)
{
triList.ClearBoolSigAction(136);
triList.ClearBoolSigAction(152);
}
}
}

View File

@@ -1,84 +0,0 @@
using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.SmartObjects;
namespace PepperDash.Essentials.Core
{
/// <summary>
///
/// </summary>
public interface INumericKeypad
{
void Digit0(bool pressRelease);
void Digit1(bool pressRelease);
void Digit2(bool pressRelease);
void Digit3(bool pressRelease);
void Digit4(bool pressRelease);
void Digit5(bool pressRelease);
void Digit6(bool pressRelease);
void Digit7(bool pressRelease);
void Digit8(bool pressRelease);
void Digit9(bool pressRelease);
/// <summary>
/// Used to hide/show the button and/or text on the left-hand keypad button
/// </summary>
bool HasKeypadAccessoryButton1 { get; }
string KeypadAccessoryButton1Label { get; }
void KeypadAccessoryButton1(bool pressRelease);
bool HasKeypadAccessoryButton2 { get; }
string KeypadAccessoryButton2Label { get; }
void KeypadAccessoryButton2(bool pressRelease);
}
public interface ISetTopBoxNumericKeypad : INumericKeypad
{
void Dash(bool pressRelease);
void KeypadEnter(bool pressRelease);
}
/// <summary>
///
/// </summary>
public static class INumericExtensions
{
/// <summary>
/// Links to the smart object, and sets the misc button's labels on joins x and y
/// </summary>
public static void LinkButtons(this INumericKeypad dev, BasicTriList trilist)
{
trilist.SetBoolSigAction(110, dev.Digit0);
trilist.SetBoolSigAction(111, dev.Digit1);
trilist.SetBoolSigAction(112, dev.Digit2);
trilist.SetBoolSigAction(113, dev.Digit3);
trilist.SetBoolSigAction(114, dev.Digit4);
trilist.SetBoolSigAction(115, dev.Digit5);
trilist.SetBoolSigAction(116, dev.Digit6);
trilist.SetBoolSigAction(117, dev.Digit7);
trilist.SetBoolSigAction(118, dev.Digit8);
trilist.SetBoolSigAction(119, dev.Digit9);
trilist.SetBoolSigAction(120, dev.KeypadAccessoryButton1);
trilist.SetBoolSigAction(121, dev.KeypadAccessoryButton2);
trilist.StringInput[111].StringValue = dev.KeypadAccessoryButton1Label;
trilist.StringInput[111].StringValue = dev.KeypadAccessoryButton2Label;
}
public static void UnlinkButtons(this INumericKeypad dev, BasicTriList trilist)
{
trilist.ClearBoolSigAction(110);
trilist.ClearBoolSigAction(111);
trilist.ClearBoolSigAction(112);
trilist.ClearBoolSigAction(113);
trilist.ClearBoolSigAction(114);
trilist.ClearBoolSigAction(115);
trilist.ClearBoolSigAction(116);
trilist.ClearBoolSigAction(117);
trilist.ClearBoolSigAction(118);
trilist.ClearBoolSigAction(119);
trilist.ClearBoolSigAction(120);
trilist.ClearBoolSigAction(121);
}
}
}

View File

@@ -1,46 +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.Essentials.Core;
using PepperDash.Essentials.Core.SmartObjects;
namespace PepperDash.Essentials.Core
{
/// <summary>
///
/// </summary>
public interface IPower
{
void PowerOn();
void PowerOff();
void PowerToggle();
BoolFeedback PowerIsOnFeedback { get; }
}
/// <summary>
///
/// </summary>
public static class IPowerExtensions
{
public static void LinkButtons(this IPower dev, BasicTriList triList)
{
triList.SetSigFalseAction(101, dev.PowerOn);
triList.SetSigFalseAction(102, dev.PowerOff);
triList.SetSigFalseAction(103, dev.PowerToggle);
dev.PowerIsOnFeedback.LinkInputSig(triList.BooleanInput[101]);
}
public static void UnlinkButtons(this IPower dev, BasicTriList triList)
{
triList.ClearBoolSigAction(101);
triList.ClearBoolSigAction(102);
triList.ClearBoolSigAction(103);
dev.PowerIsOnFeedback.UnlinkInputSig(triList.BooleanInput[101]);
}
}
}

View File

@@ -1,55 +0,0 @@
using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.SmartObjects;
namespace PepperDash.Essentials.Core
{
/// <summary>
///
/// </summary>
public interface ISetTopBoxControls : IChannel, IColor, IDPad, ISetTopBoxNumericKeypad,
ITransport, IUiDisplayInfo
{
/// <summary>
/// Show DVR controls?
/// </summary>
bool HasDvr { get; }
/// <summary>
/// Show presets controls?
/// </summary>
bool HasPresets { get; }
/// <summary>
/// Show number pad controls?
/// </summary>
bool HasNumeric { get; }
/// <summary>
/// Show D-pad controls?
/// </summary>
bool HasDpad { get; }
PepperDash.Essentials.Core.Presets.DevicePresetsModel PresetsModel { get; }
void LoadPresets(string filePath);
void DvrList(bool pressRelease);
void Replay(bool pressRelease);
}
public static class ISetTopBoxControlsExtensions
{
public static void LinkButtons(this ISetTopBoxControls dev, BasicTriList triList)
{
triList.SetBoolSigAction(136, dev.DvrList);
triList.SetBoolSigAction(152, dev.Replay);
}
public static void UnlinkButtons(this ISetTopBoxControls dev, BasicTriList triList)
{
triList.ClearBoolSigAction(136);
triList.ClearBoolSigAction(152);
}
}
}

View File

@@ -1,53 +0,0 @@
using Crestron.SimplSharpPro.DeviceSupport;
namespace PepperDash.Essentials.Core
{
/// <summary>
///
/// </summary>
public interface ITransport
{
void Play(bool pressRelease);
void Pause(bool pressRelease);
void Rewind(bool pressRelease);
void FFwd(bool pressRelease);
void ChapMinus(bool pressRelease);
void ChapPlus(bool pressRelease);
void Stop(bool pressRelease);
void Record(bool pressRelease);
}
/// <summary>
///
/// </summary>
public static class ITransportExtensions
{
/// <summary>
/// Attaches to trilist joins: Play:145, Pause:146, Stop:147, ChapPlus:148, ChapMinus:149, Rewind:150, Ffwd:151, Record:154
///
/// </summary>
public static void LinkButtons(this ITransport dev, BasicTriList triList)
{
triList.SetBoolSigAction(145, dev.Play);
triList.SetBoolSigAction(146, dev.Pause);
triList.SetBoolSigAction(147, dev.Stop);
triList.SetBoolSigAction(148, dev.ChapPlus);
triList.SetBoolSigAction(149, dev.ChapMinus);
triList.SetBoolSigAction(150, dev.Rewind);
triList.SetBoolSigAction(151, dev.FFwd);
triList.SetBoolSigAction(154, dev.Record);
}
public static void UnlinkButtons(this ITransport dev, BasicTriList triList)
{
triList.ClearBoolSigAction(145);
triList.ClearBoolSigAction(146);
triList.ClearBoolSigAction(147);
triList.ClearBoolSigAction(148);
triList.ClearBoolSigAction(149);
triList.ClearBoolSigAction(150);
triList.ClearBoolSigAction(151);
triList.ClearBoolSigAction(154);
}
}
}

View File

@@ -1,12 +0,0 @@
using PepperDash.Core;
namespace PepperDash.Essentials.Core
{
/// <summary>
/// Describes things needed to show on UI
/// </summary>
public interface IUiDisplayInfo : IKeyed
{
uint DisplayUiType { get; }
}
}

View File

@@ -1,17 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
namespace PepperDash.Essentials.Core
{
/// <summary>
/// Defines a class that has warm up and cool down
/// </summary>
public interface IWarmingCooling
{
BoolFeedback IsWarmingUpFeedback { get; }
BoolFeedback IsCoolingDownFeedback { get; }
}
}

View File

@@ -1,9 +0,0 @@
using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.SmartObjects;
namespace PepperDash.Essentials.Core
{
}

View File

@@ -1,250 +0,0 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharp.Reflection;
using Newtonsoft.Json;
using PepperDash.Core;
namespace PepperDash.Essentials.Core
{
public class DeviceJsonApi
{
/// <summary>
///
/// </summary>
/// <param name="json"></param>
public static void DoDeviceActionWithJson(string json)
{
var action = JsonConvert.DeserializeObject<DeviceActionWrapper>(json);
DoDeviceAction(action);
}
/// <summary>
///
/// </summary>
/// <param name="action"></param>
public static void DoDeviceAction(DeviceActionWrapper action)
{
var key = action.DeviceKey;
var obj = FindObjectOnPath(key);
if (obj == null)
return;
CType t = obj.GetType();
var method = t.GetMethod(action.MethodName);
if (method == null)
{
Debug.Console(0, "Method '{0}' not found", action.MethodName);
return;
}
var mParams = method.GetParameters();
// Add empty params if not provided
if (action.Params == null) action.Params = new object[0];
if (mParams.Length > action.Params.Length)
{
Debug.Console(0, "Method '{0}' requires {1} params", action.MethodName, mParams.Length);
return;
}
object[] convertedParams = mParams
.Select((p, i) => Convert.ChangeType(action.Params[i], p.ParameterType,
System.Globalization.CultureInfo.InvariantCulture))
.ToArray();
object ret = method.Invoke(obj, convertedParams);
//Debug.Console(0, JsonConvert.SerializeObject(ret));
// return something?
}
/// <summary>
///
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
public static string GetProperties(string deviceObjectPath)
{
var obj = FindObjectOnPath(deviceObjectPath);
if (obj == null)
return "{ \"error\":\"No Device\"}";
CType t = obj.GetType();
// get the properties and set them into a new collection of NameType wrappers
var props = t.GetProperties().Select(p => new PropertyNameType(p));
return JsonConvert.SerializeObject(props, Formatting.Indented);
}
/// <summary>
///
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
public static string GetMethods(string deviceObjectPath)
{
var obj = FindObjectOnPath(deviceObjectPath);
if (obj == null)
return "{ \"error\":\"No Device\"}";
// Package up method names using helper objects
CType t = obj.GetType();
var methods = t.GetMethods()
.Where(m => !m.IsSpecialName)
.Select(p => new MethodNameParams(p));
return JsonConvert.SerializeObject(methods, Formatting.Indented);
}
public static string GetApiMethods(string deviceObjectPath)
{
var obj = FindObjectOnPath(deviceObjectPath);
if (obj == null)
return "{ \"error\":\"No Device\"}";
// Package up method names using helper objects
CType t = obj.GetType();
var methods = t.GetMethods()
.Where(m => !m.IsSpecialName)
.Where(m => m.GetCustomAttributes(typeof(ApiAttribute), true).Any())
.Select(p => new MethodNameParams(p));
return JsonConvert.SerializeObject(methods, Formatting.Indented);
}
/// <summary>
/// Walks down a dotted object path, starting with a Device, and returns the object
/// at the end of the path
/// </summary>
public static object FindObjectOnPath(string deviceObjectPath)
{
var path = deviceObjectPath.Split('.');
var dev = DeviceManager.GetDeviceForKey(path[0]);
if (dev == null)
{
Debug.Console(0, "Device {0} not found", path[0]);
return null;
}
// loop through any dotted properties
object obj = dev;
if (path.Length > 1)
{
for (int i = 1; i < path.Length; i++)
{
var objName = path[i];
string indexStr = null;
var indexOpen = objName.IndexOf('[');
if (indexOpen != -1)
{
var indexClose = objName.IndexOf(']');
if (indexClose == -1)
{
Debug.Console(0, dev, "ERROR Unmatched index brackets");
return null;
}
// Get the index and strip quotes if any
indexStr = objName.Substring(indexOpen + 1, indexClose - indexOpen - 1).Replace("\"", "");
objName = objName.Substring(0, indexOpen);
Debug.Console(0, dev, " Checking for collection '{0}', index '{1}'", objName, indexStr);
}
CType oType = obj.GetType();
var prop = oType.GetProperty(objName);
if (prop == null)
{
Debug.Console(0, dev, "Property {0} not found on {1}", objName, path[i - 1]);
return null;
}
// if there's an index, try to get the property
if (indexStr != null)
{
if (!typeof(ICollection).IsAssignableFrom(prop.PropertyType))
{
Debug.Console(0, dev, "Property {0} is not collection", objName);
return null;
}
var collection = prop.GetValue(obj, null) as ICollection;
// Get the indexed items "property"
var indexedPropInfo = prop.PropertyType.GetProperty("Item");
// These are the parameters for the indexing. Only care about one
var indexParams = indexedPropInfo.GetIndexParameters();
if (indexParams.Length > 0)
{
Debug.Console(0, " Indexed, param type: {0}", indexParams[0].ParameterType.Name);
var properParam = Convert.ChangeType(indexStr, indexParams[0].ParameterType,
System.Globalization.CultureInfo.InvariantCulture);
try
{
obj = indexedPropInfo.GetValue(collection, new object[] { properParam });
}
// if the index is bad, catch it here.
catch (Crestron.SimplSharp.Reflection.TargetInvocationException e)
{
if (e.InnerException is ArgumentOutOfRangeException)
Debug.Console(0, " Index Out of range");
else if (e.InnerException is KeyNotFoundException)
Debug.Console(0, " Key not found");
return null;
}
}
}
else
obj = prop.GetValue(obj, null);
}
}
return obj;
}
}
public class DeviceActionWrapper
{
public string DeviceKey { get; set; }
public string MethodName { get; set; }
public object[] Params { get; set; }
}
public class PropertyNameType
{
[JsonIgnore]
public PropertyInfo PropInfo { get; private set; }
public string Name { get { return PropInfo.Name; } }
public string Type { get { return PropInfo.PropertyType.Name; } }
public PropertyNameType(PropertyInfo info)
{
PropInfo = info;
}
}
public class MethodNameParams
{
[JsonIgnore]
public MethodInfo MethodInfo { get; private set; }
public string Name { get { return MethodInfo.Name; } }
public IEnumerable<NameType> Params { get {
return MethodInfo.GetParameters().Select(p =>
new NameType { Name = p.Name, Type = p.ParameterType.Name });
} }
public MethodNameParams(MethodInfo info)
{
MethodInfo = info;
}
}
public class NameType
{
public string Name { get; set; }
public string Type { get; set; }
}
[AttributeUsage(AttributeTargets.All)]
public class ApiAttribute : CAttribute
{
}
}

View File

@@ -1,211 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.EthernetCommunication;
using Crestron.SimplSharpPro.UI;
using Crestron.SimplSharp.Reflection;
using PepperDash.Core;
namespace PepperDash.Essentials.Core
{
public static class DeviceManager
{
//public static List<Device> Devices { get { return _Devices; } }
//static List<Device> _Devices = new List<Device>();
static Dictionary<string, IKeyed> Devices = new Dictionary<string, IKeyed>(StringComparer.OrdinalIgnoreCase);
/// <summary>
/// Returns a copy of all the devices in a list
/// </summary>
public static List<IKeyed> AllDevices { get { return new List<IKeyed>(Devices.Values); } }
public static void Initialize(CrestronControlSystem cs)
{
CrestronConsole.AddNewConsoleCommand(ListDeviceCommands, "devcmdlist", "Lists commands",
ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(DoDeviceCommand, "devcmd", "Runs a command on device - key Name value",
ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(ListDeviceCommStatuses, "devcommstatus", "Lists the communication status of all devices",
ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(ListDeviceFeedbacks, "devfb", "Lists current feedbacks",
ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(ListDevices, "devlist", "Lists current managed devices",
ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(DeviceJsonApi.DoDeviceActionWithJson, "devjson", "",
ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(s =>
{
CrestronConsole.ConsoleCommandResponse(DeviceJsonApi.GetProperties(s));
}, "devprops", "", ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(s =>
{
CrestronConsole.ConsoleCommandResponse(DeviceJsonApi.GetMethods(s));
}, "devmethods", "", ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(s =>
{
CrestronConsole.ConsoleCommandResponse(DeviceJsonApi.GetApiMethods(s));
}, "apimethods", "", ConsoleAccessLevelEnum.AccessOperator);
}
/// <summary>
/// Calls activate on all Device class items
/// </summary>
public static void ActivateAll()
{
foreach (var d in Devices.Values)
{
if (d is Device)
(d as Device).Activate();
}
}
/// <summary>
/// Calls activate on all Device class items
/// </summary>
public static void DeactivateAll()
{
foreach (var d in Devices.Values)
{
if (d is Device)
(d as Device).Deactivate();
}
}
//static void ListMethods(string devKey)
//{
// var dev = GetDeviceForKey(devKey);
// if(dev != null)
// {
// var type = dev.GetType().GetCType();
// var methods = type.GetMethods(BindingFlags.Public|BindingFlags.Instance);
// var sb = new StringBuilder();
// sb.AppendLine(string.Format("{2} methods on [{0}] ({1}):", dev.Key, type.Name, methods.Length));
// foreach (var m in methods)
// {
// sb.Append(string.Format("{0}(", m.Name));
// var pars = m.GetParameters();
// foreach (var p in pars)
// sb.Append(string.Format("({1}){0} ", p.Name, p.ParameterType.Name));
// sb.AppendLine(")");
// }
// CrestronConsole.ConsoleCommandResponse(sb.ToString());
// }
//}
static void ListDevices(string s)
{
Debug.Console(0, "{0} Devices registered with Device Mangager:",Devices.Count);
var sorted = Devices.Values.ToList();
sorted.Sort((a, b) => a.Key.CompareTo(b.Key));
//var devs = Devices.Values.Where(d => d is IKeyed).Select(d => d as IKeyed);
foreach (var d in sorted)
{
var name = d is IKeyName ? (d as IKeyName).Name : "---";
Debug.Console(0, " [{0}] {1}", d.Key, name);
}
}
static void ListDeviceFeedbacks(string devKey)
{
var dev = GetDeviceForKey(devKey);
if(dev == null)
{
Debug.Console(0, "Device '{0}' not found", devKey);
return;
}
var statusDev = dev as IHasFeedback;
if(statusDev == null)
{
Debug.Console(0, "Device '{0}' does not have visible feedbacks", devKey);
return;
}
statusDev.DumpFeedbacksToConsole(true);
}
static void ListDeviceCommands(string devKey)
{
var dev = GetDeviceForKey(devKey);
if (dev == null)
{
Debug.Console(0, "Device '{0}' not found", devKey);
return;
}
Debug.Console(0, "This needs to be reworked. Stay tuned.", devKey);
}
static void ListDeviceCommStatuses(string input)
{
var sb = new StringBuilder();
foreach (var dev in Devices.Values)
{
if (dev is ICommunicationMonitor)
sb.Append(string.Format("{0}: {1}\r", dev.Key, (dev as ICommunicationMonitor).CommunicationMonitor.Status));
}
CrestronConsole.ConsoleCommandResponse(sb.ToString());
}
static void DoDeviceCommand(string command)
{
Debug.Console(0, "Not yet implemented. Stay tuned");
}
public static void AddDevice(IKeyed newDev)
{
// Check for device with same key
//var existingDevice = _Devices.FirstOrDefault(d => d.Key.Equals(newDev.Key, StringComparison.OrdinalIgnoreCase));
////// If it exists, remove or warn??
//if (existingDevice != null)
if(Devices.ContainsKey(newDev.Key))
{
Debug.Console(0, newDev, "A device with this key already exists. Not added to manager");
return;
}
Devices.Add(newDev.Key, newDev);
//if (!(_Devices.Contains(newDev)))
// _Devices.Add(newDev);
}
public static void RemoveDevice(IKeyed newDev)
{
if(newDev == null)
return;
if (Devices.ContainsKey(newDev.Key))
Devices.Remove(newDev.Key);
//if (_Devices.Contains(newDev))
// _Devices.Remove(newDev);
else
Debug.Console(0, "Device manager: Device '{0}' does not exist in manager. Cannot remove", newDev.Key);
}
public static IEnumerable<string> GetDeviceKeys()
{
//return _Devices.Select(d => d.Key).ToList();
return Devices.Keys;
}
public static IEnumerable<IKeyed> GetDevices()
{
//return _Devices.Select(d => d.Key).ToList();
return Devices.Values;
}
public static IKeyed GetDeviceForKey(string key)
{
//return _Devices.FirstOrDefault(d => d.Key.Equals(key, StringComparison.OrdinalIgnoreCase));
if (key != null && Devices.ContainsKey(key))
return Devices[key];
return null;
}
}
}

View File

@@ -1,28 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
namespace PepperDash.Essentials.Core
{
/// <summary>
/// Integers that represent the "source type number" for given sources.
/// Primarily used by the UI to calculate subpage join offsets
/// Note, for UI, only values 1-49 are valid.
/// </summary>
public class DisplayUiConstants
{
public const uint TypeRadio = 1;
public const uint TypeDirecTv = 9;
public const uint TypeBluray = 13;
public const uint TypeChromeTv = 15;
public const uint TypeFireTv = 16;
public const uint TypeAppleTv = 17;
public const uint TypeRoku = 18;
public const uint TypeLaptop = 31;
public const uint TypePc = 32;
public const uint TypeNoControls = 49;
}
}

View File

@@ -1,56 +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 interface IOnline
{
BoolFeedback IsOnline { get; }
}
///// <summary>
///// ** WANT THIS AND ALL ITS FRIENDS TO GO AWAY **
///// Defines a class that has a list of CueAction objects, typically
///// for linking functions to user interfaces or API calls
///// </summary>
//public interface IHasCueActionList
//{
// List<CueActionPair> CueActionList { get; }
//}
//public interface IHasComPortsHardware
//{
// IComPorts ComPortsDevice { get; }
//}
/// <summary>
/// Describes a device that can have a video sync providing device attached to it
/// </summary>
public interface IAttachVideoStatus : IKeyed
{
// Extension methods will depend on this
}
/// <summary>
/// For display classes that can provide usage data
/// </summary>
public interface IDisplayUsage
{
IntFeedback LampHours { get; }
}
public interface IMakeModel : IKeyed
{
string DeviceMake { get; }
string DeviceModel { get; }
}
}

View File

@@ -1,79 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Core;
namespace PepperDash.Essentials.Core.Devices
{
public class GenericCommunicationMonitoredDevice : Device, ICommunicationMonitor
{
IBasicCommunication Client;
public StatusMonitorBase CommunicationMonitor { get; private set; }
public GenericCommunicationMonitoredDevice(string key, string name, IBasicCommunication comm, string pollString,
long pollTime, long warningTime, long errorTime)
: base(key, name)
{
Client = comm;
CommunicationMonitor = new GenericCommunicationMonitor(this, Client, pollTime, warningTime, errorTime, pollString);
// ------------------------------------------------------DELETE THIS
CommunicationMonitor.StatusChange += (o, a) =>
{
Debug.Console(2, this, "Communication monitor status change: {0}", a.Status);
};
}
public GenericCommunicationMonitoredDevice(string key, string name, IBasicCommunication comm, string pollString)
: this(key, name, comm, pollString, 30000, 120000, 300000)
{
}
/// <summary>
/// Generic monitor for TCP reachability. Default with 30s poll, 120s warning and 300s error times
/// </summary>
[Obsolete]
public GenericCommunicationMonitoredDevice(string key, string name, string hostname, int port, string pollString)
: this(key, name, hostname, port, pollString, 30000, 120000, 300000)
{
}
/// <summary>
/// Monitor for TCP reachability
/// </summary>
[Obsolete]
public GenericCommunicationMonitoredDevice(string key, string name, string hostname, int port, string pollString,
long pollTime, long warningTime, long errorTime)
: base(key, name)
{
Client = new GenericTcpIpClient(key + "-tcp", hostname, port, 512);
CommunicationMonitor = new GenericCommunicationMonitor(this, Client, pollTime, warningTime, errorTime, pollString);
// ------------------------------------------------------DELETE THIS
CommunicationMonitor.StatusChange += (o, a) =>
{
Debug.Console(2, this, "Communication monitor status change: {0}", a.Status);
};
}
public override bool CustomActivate()
{
CommunicationMonitor.Start();
return true;
}
public override bool Deactivate()
{
CommunicationMonitor.Stop();
return true;
}
}
}

View File

@@ -1,39 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
namespace PepperDash.Essentials.Core
{
public static class IAttachVideoStatusExtensions
{
/// <summary>
/// Gets the VideoStatusOutputs for the device
/// </summary>
/// <param name="attachDev"></param>
/// <returns>Attached VideoStatusOutputs or the default if none attached</returns>
public static VideoStatusOutputs GetVideoStatuses(this IAttachVideoStatus attachedDev)
{
// See if this device is connected to a status-providing port
var tl = TieLineCollection.Default.FirstOrDefault(t =>
t.SourcePort.ParentDevice == attachedDev
&& t.DestinationPort is RoutingInputPortWithVideoStatuses);
if (tl != null)
{
// if so, and it's got status, return it -- or null
var port = tl.DestinationPort as RoutingInputPortWithVideoStatuses;
if (port != null)
return port.VideoStatus;
}
return VideoStatusOutputs.NoStatus;
}
public static bool HasVideoStatuses(this IAttachVideoStatus attachedDev)
{
return TieLineCollection.Default.FirstOrDefault(t =>
t.SourcePort.ParentDevice == attachedDev
&& t.DestinationPort is RoutingInputPortWithVideoStatuses) != null;
}
}
}

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,98 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
namespace PepperDash.Essentials.Core
{
/// <summary>
/// Defines minimal volume control methods
/// </summary>
public interface IBasicVolumeControls
{
void VolumeUp(bool pressRelease);
void VolumeDown(bool pressRelease);
void MuteToggle();
}
/// <summary>
/// Adds feedback and direct volume level set to IBasicVolumeControls
/// </summary>
public interface IBasicVolumeWithFeedback : IBasicVolumeControls
{
void SetVolume(ushort level);
void MuteOn();
void MuteOff();
IntFeedback VolumeLevelFeedback { get; }
BoolFeedback MuteFeedback { get; }
}
/// <summary>
///
/// </summary>
public interface IFullAudioSettings : IBasicVolumeWithFeedback
{
void SetBalance(ushort level);
void BalanceLeft(bool pressRelease);
void BalanceRight(bool pressRelease);
void SetBass(ushort level);
void BassUp(bool pressRelease);
void BassDown(bool pressRelease);
void SetTreble(ushort level);
void TrebleUp(bool pressRelease);
void TrebleDown(bool pressRelease);
bool hasMaxVolume { get; }
void SetMaxVolume(ushort level);
void MaxVolumeUp(bool pressRelease);
void MaxVolumeDown(bool pressRelease);
bool hasDefaultVolume { get; }
void SetDefaultVolume(ushort level);
void DefaultVolumeUp(bool pressRelease);
void DefaultVolumeDown(bool pressRelease);
void LoudnessToggle();
void MonoToggle();
BoolFeedback LoudnessFeedback { get; }
BoolFeedback MonoFeedback { get; }
IntFeedback BalanceFeedback { get; }
IntFeedback BassFeedback { get; }
IntFeedback TrebleFeedback { get; }
IntFeedback MaxVolumeFeedback { get; }
IntFeedback DefaultVolumeFeedback { get; }
}
/// <summary>
/// A class that implements this, contains a reference to an IBasicVolumeControls device.
/// For example, speakers attached to an audio zone. The speakers can provide reference
/// to their linked volume control.
/// </summary>
public interface IHasVolumeDevice
{
IBasicVolumeControls VolumeDevice { get; }
}
/// <summary>
/// Identifies a device that contains audio zones
/// </summary>
public interface IAudioZones : IRouting
{
Dictionary<uint, IAudioZone> Zone { get; }
}
/// <summary>
/// Defines minimum functionality for an audio zone
/// </summary>
public interface IAudioZone : IBasicVolumeWithFeedback
{
void SelectInput(ushort input);
}
}

View File

@@ -1,145 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Core;
namespace PepperDash.Essentials.Core
{
/// <summary>
/// IR port wrapper. May act standalone
/// </summary>
public class IrOutputPortController : Device
{
uint IrPortUid;
IROutputPort IrPort;
public ushort StandardIrPulseTime { get; set; }
public string DriverFilepath { get; private set; }
public bool DriverIsLoaded { get; private set; }
/// <summary>
/// Constructor for IrDevice base class. If a null port is provided, this class will
/// still function without trying to talk to a port.
/// </summary>
public IrOutputPortController(string key, IROutputPort port, string irDriverFilepath)
: base(key)
{
//if (port == null) throw new ArgumentNullException("port");
IrPort = port;
if (port == null)
{
Debug.Console(0, this, "WARNING No valid IR Port assigned to controller. IR will not function");
return;
}
LoadDriver(irDriverFilepath);
}
/// <summary>
/// Loads the IR driver at path
/// </summary>
/// <param name="path"></param>
public void LoadDriver(string path)
{
if (string.IsNullOrEmpty(path)) path = DriverFilepath;
try
{
IrPortUid = IrPort.LoadIRDriver(path);
DriverFilepath = path;
StandardIrPulseTime = 200;
DriverIsLoaded = true;
}
catch
{
DriverIsLoaded = false;
var message = string.Format("WARNING IR Driver '{0}' failed to load", path);
Debug.Console(0, this, message);
ErrorLog.Error(message);
}
}
/// <summary>
/// Starts and stops IR command on driver. Safe for missing commands
/// </summary>
public virtual void PressRelease(string command, bool state)
{
Debug.Console(2, this, "IR:'{0}'={1}", command, state);
if (IrPort == null)
{
Debug.Console(2, this, "WARNING No IR Port assigned to controller");
return;
}
if (!DriverIsLoaded)
{
Debug.Console(2, this, "WARNING IR driver is not loaded");
return;
}
if (state)
{
if (IrPort.IsIRCommandAvailable(IrPortUid, command))
IrPort.Press(IrPortUid, command);
else
NoIrCommandError(command);
}
else
IrPort.Release();
}
/// <summary>
/// Pulses a command on driver. Safe for missing commands
/// </summary>
public virtual void Pulse(string command, ushort time)
{
if (IrPort == null)
{
Debug.Console(2, this, "WARNING No IR Port assigned to controller");
return;
}
if (!DriverIsLoaded)
{
Debug.Console(2, this, "WARNING IR driver is not loaded");
return;
}
if (IrPort.IsIRCommandAvailable(IrPortUid, command))
IrPort.PressAndRelease(IrPortUid, command, time);
else
NoIrCommandError(command);
}
/// <summary>
/// Notifies the console when a bad command is used.
/// </summary>
protected void NoIrCommandError(string command)
{
Debug.Console(2, this, "Device {0}: IR Driver {1} does not contain command {2}",
Key, IrPort.IRDriverFileNameByIRDriverId(IrPortUid), command);
}
///// <summary>
///// When fed a dictionary of uint, string, will return UOs for each item,
///// attached to this IrOutputPort
///// </summary>
///// <param name="numStringDict"></param>
///// <returns></returns>
//public List<CueActionPair> GetUOsForIrCommands(Dictionary<Cue, string> numStringDict)
//{
// var funcs = new List<CueActionPair>(numStringDict.Count);
// foreach (var kvp in numStringDict)
// {
// // Have to assign these locally because of kvp's scope
// var cue = kvp.Key;
// var command = kvp.Value;
// funcs.Add(new BoolCueActionPair(cue, b => this.PressRelease(command, b)));
// }
// return funcs;
//}
}
}

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,56 +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.Core
{
//public interface IVolumeFunctions
//{
// BoolCueActionPair VolumeUpCueActionPair { get; }
// BoolCueActionPair VolumeDownCueActionPair { get; }
// BoolCueActionPair MuteToggleCueActionPair { get; }
//}
//public interface IVolumeTwoWay : IVolumeFunctions
//{
// IntFeedback VolumeLevelFeedback { get; }
// UShortCueActionPair VolumeLevelCueActionPair { get; }
// BoolFeedback IsMutedFeedback { get; }
//}
///// <summary>
/////
///// </summary>
//public static class IFunctionListExtensions
//{
// public static string GetFunctionsConsoleList(this IHasCueActionList device)
// {
// var sb = new StringBuilder();
// var list = device.CueActionList;
// foreach (var cap in list)
// sb.AppendFormat("{0,-15} {1,4} {2}\r", cap.Cue.Name, cap.Cue.Number, cap.GetType().Name);
// return sb.ToString();
// }
//}
public enum AudioChangeType
{
Mute, Volume
}
public class AudioChangeEventArgs
{
public AudioChangeType ChangeType { get; private set; }
public IBasicVolumeControls AudioDevice { get; private set; }
public AudioChangeEventArgs(IBasicVolumeControls device, AudioChangeType changeType)
{
ChangeType = changeType;
AudioDevice = device;
}
}
}

View File

@@ -1,28 +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;
namespace PepperDash.Essentials.Core
{
//[Obsolete]
//public class PresentationDeviceType
//{
// public const ushort Default = 1;
// public const ushort CableSetTopBox = 2;
// public const ushort SatelliteSetTopBox = 3;
// public const ushort Dvd = 4;
// public const ushort Bluray = 5;
// public const ushort PC = 9;
// public const ushort Laptop = 10;
//}
public enum PresentationSourceType
{
None, Dvd, Laptop, PC, SetTopBox, VCR
}
}

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,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,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,11 +0,0 @@
namespace PepperDash.Essentials.Core
{
public class SmartObjectJoinOffsets
{
public const ushort Dpad = 1;
public const ushort Numpad = 2;
public const ushort PresetList = 6;
}
}

View File

@@ -1,89 +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;
namespace PepperDash.Essentials.Core
{
/// <summary>
///
/// </summary>
public enum eSourceListItemType
{
Route, Off, Other, SomethingAwesomerThanThese
}
/// <summary>
/// Represents an item in a source list - can be deserialized into.
/// </summary>
public class SourceListItem
{
public string SourceKey { get; set; }
/// <summary>
/// Returns the source Device for this, if it exists in DeviceManager
/// </summary>
[JsonIgnore]
public Device SourceDevice
{
get
{
if (_SourceDevice == null)
_SourceDevice = DeviceManager.GetDeviceForKey(SourceKey) as Device;
return _SourceDevice;
}
}
Device _SourceDevice;
/// <summary>
/// Gets either the source's Name or this AlternateName property, if
/// defined. If source doesn't exist, returns "Missing source"
/// </summary>
public string PreferredName
{
get
{
if (string.IsNullOrEmpty(Name))
{
if (SourceDevice == null)
return "---";
return SourceDevice.Name;
}
return Name;
}
}
/// <summary>
/// A name that will override the source's name on the UI
/// </summary>
public string Name { get; set; }
public string Icon { get; set; }
public string AltIcon { get; set; }
public bool IncludeInSourceList { get; set; }
public int Order { get; set; }
public string VolumeControlKey { get; set; }
public eSourceListItemType Type { get; set; }
public List<SourceRouteListItem> RouteList { get; set; }
public SourceListItem()
{
Icon = "Blank";
}
}
public class SourceRouteListItem
{
[JsonProperty("sourceKey")]
public string SourceKey { get; set; }
[JsonProperty("destinationKey")]
public string DestinationKey { get; set; }
[JsonProperty("type")]
public eRoutingSignalType Type { get; set; }
}
}

View File

@@ -1,204 +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;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Routing;
namespace PepperDash.Essentials.Core
{
public class BasicIrDisplay : DisplayBase, IBasicVolumeControls, IPower, IWarmingCooling, IRoutingSinkWithSwitching
{
public IrOutputPortController IrPort { get; private set; }
public ushort IrPulseTime { get; set; }
protected override Func<bool> PowerIsOnFeedbackFunc
{
get { return () => _PowerIsOn; }
}
protected override Func<bool> IsCoolingDownFeedbackFunc
{
get { return () => _IsCoolingDown; }
}
protected override Func<bool> IsWarmingUpFeedbackFunc
{
get { return () => _IsWarmingUp; }
}
bool _PowerIsOn;
bool _IsWarmingUp;
bool _IsCoolingDown;
public BasicIrDisplay(string key, string name, IROutputPort port, string irDriverFilepath)
: base(key, name)
{
IrPort = new IrOutputPortController(key + "-ir", port, irDriverFilepath);
DeviceManager.AddDevice(IrPort);
PowerIsOnFeedback.OutputChange += (o, a) => {
Debug.Console(2, this, "Power on={0}", _PowerIsOn);
if (_PowerIsOn) StartWarmingTimer();
else StartCoolingTimer();
};
IsWarmingUpFeedback.OutputChange += (o, a) => Debug.Console(2, this, "Warming up={0}", _IsWarmingUp);
IsCoolingDownFeedback.OutputChange += (o, a) => Debug.Console(2, this, "Cooling down={0}", _IsCoolingDown);
InputPorts.AddRange(new RoutingPortCollection<RoutingInputPort>
{
new RoutingInputPort(RoutingPortNames.HdmiIn1, eRoutingSignalType.AudioVideo,
eRoutingPortConnectionType.Hdmi, new Action(Hdmi1), this, false),
new RoutingInputPort(RoutingPortNames.HdmiIn2, eRoutingSignalType.AudioVideo,
eRoutingPortConnectionType.Hdmi, new Action(Hdmi2), this, false),
new RoutingInputPort(RoutingPortNames.HdmiIn3, eRoutingSignalType.AudioVideo,
eRoutingPortConnectionType.Hdmi, new Action(Hdmi3), this, false),
new RoutingInputPort(RoutingPortNames.HdmiIn4, eRoutingSignalType.AudioVideo,
eRoutingPortConnectionType.Hdmi, new Action(Hdmi4), this, false),
new RoutingInputPort(RoutingPortNames.ComponentIn, eRoutingSignalType.AudioVideo,
eRoutingPortConnectionType.Hdmi, new Action(Component1), this, false),
new RoutingInputPort(RoutingPortNames.CompositeIn, eRoutingSignalType.AudioVideo,
eRoutingPortConnectionType.Hdmi, new Action(Video1), this, false),
new RoutingInputPort(RoutingPortNames.AntennaIn, eRoutingSignalType.AudioVideo,
eRoutingPortConnectionType.Hdmi, new Action(Antenna), this, false),
});
}
public void Hdmi1()
{
IrPort.Pulse(IROutputStandardCommands.IROut_HDMI_1, IrPulseTime);
}
public void Hdmi2()
{
IrPort.Pulse(IROutputStandardCommands.IROut_HDMI_2, IrPulseTime);
}
public void Hdmi3()
{
IrPort.Pulse(IROutputStandardCommands.IROut_HDMI_3, IrPulseTime);
}
public void Hdmi4()
{
IrPort.Pulse(IROutputStandardCommands.IROut_HDMI_4, IrPulseTime);
}
public void Component1()
{
IrPort.Pulse(IROutputStandardCommands.IROut_COMPONENT_1, IrPulseTime);
}
public void Video1()
{
IrPort.Pulse(IROutputStandardCommands.IROut_VIDEO_1, IrPulseTime);
}
public void Antenna()
{
IrPort.Pulse(IROutputStandardCommands.IROut_ANTENNA, IrPulseTime);
}
#region IPower Members
public override void PowerOn()
{
IrPort.Pulse(IROutputStandardCommands.IROut_POWER_ON, IrPulseTime);
_PowerIsOn = true;
PowerIsOnFeedback.FireUpdate();
}
public override void PowerOff()
{
_PowerIsOn = false;
PowerIsOnFeedback.FireUpdate();
IrPort.Pulse(IROutputStandardCommands.IROut_POWER_OFF, IrPulseTime);
}
public override void PowerToggle()
{
_PowerIsOn = false;
PowerIsOnFeedback.FireUpdate();
IrPort.Pulse(IROutputStandardCommands.IROut_POWER, IrPulseTime);
}
#endregion
#region IBasicVolumeControls Members
public void VolumeUp(bool pressRelease)
{
IrPort.PressRelease(IROutputStandardCommands.IROut_VOL_PLUS, pressRelease);
}
public void VolumeDown(bool pressRelease)
{
IrPort.PressRelease(IROutputStandardCommands.IROut_VOL_MINUS, pressRelease);
}
public void MuteToggle()
{
IrPort.Pulse(IROutputStandardCommands.IROut_MUTE, 200);
}
#endregion
void StartWarmingTimer()
{
_IsWarmingUp = true;
IsWarmingUpFeedback.FireUpdate();
new CTimer(o => {
_IsWarmingUp = false;
IsWarmingUpFeedback.FireUpdate();
}, 10000);
}
void StartCoolingTimer()
{
_IsCoolingDown = true;
IsCoolingDownFeedback.FireUpdate();
new CTimer(o =>
{
_IsCoolingDown = false;
IsCoolingDownFeedback.FireUpdate();
}, 7000);
}
#region IRoutingSink Members
/// <summary>
/// Typically called by the discovery routing algorithm.
/// </summary>
/// <param name="inputSelector">A delegate containing the input selector method to call</param>
public override void ExecuteSwitch(object inputSelector)
{
Action finishSwitch = () =>
{
var action = inputSelector as Action;
if (action != null)
action();
};
if (!PowerIsOnFeedback.BoolValue)
{
PowerOn();
EventHandler<EventArgs> oneTimer = null;
oneTimer = (o, a) =>
{
if (IsWarmingUpFeedback.BoolValue) return; // Only catch done warming
IsWarmingUpFeedback.OutputChange -= oneTimer;
finishSwitch();
};
IsWarmingUpFeedback.OutputChange += oneTimer;
}
else // Do it!
finishSwitch();
}
#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;
//namespace PepperDash.Essentials.Core
//{
// public abstract class IRDisplayBase : DisplayBase, IHasCueActionList
// {
// public IrOutputPortController IrPort { get; private set; }
// /// <summary>
// /// Default to 200ms
// /// </summary>
// public ushort IrPulseTime { get; set; }
// bool _PowerIsOn;
// bool _IsWarmingUp;
// bool _IsCoolingDown;
// /// <summary>
// /// FunctionList is pre-defined to have power commands.
// /// </summary>
// public IRDisplayBase(string key, string name, IROutputPort port, string irDriverFilepath)
// : base(key, name)
// {
// IrPort = new IrOutputPortController("ir-" + key, port, irDriverFilepath);
// IrPulseTime = 200;
// WarmupTime = 7000;
// CooldownTime = 10000;
// CueActionList = new List<CueActionPair>
// {
// new BoolCueActionPair(CommonBoolCue.Power, b=> PowerToggle()),
// new BoolCueActionPair(CommonBoolCue.PowerOn, b=> PowerOn()),
// new BoolCueActionPair(CommonBoolCue.PowerOff, b=> PowerOff()),
// };
// }
// public override void PowerOn()
// {
// if (!PowerIsOnFeedback.BoolValue && !_IsWarmingUp && !_IsCoolingDown)
// {
// _IsWarmingUp = true;
// IsWarmingUpFeedback.FireUpdate();
// // Fake power-up cycle
// WarmupTimer = new CTimer(o =>
// {
// _IsWarmingUp = false;
// _PowerIsOn = true;
// IsWarmingUpFeedback.FireUpdate();
// PowerIsOnFeedback.FireUpdate();
// }, WarmupTime);
// }
// IrPort.Pulse(IROutputStandardCommands.IROut_POWER_ON, IrPulseTime);
// }
// public override void PowerOff()
// {
// // If a display has unreliable-power off feedback, just override this and
// // remove this check.
// if (PowerIsOnFeedback.BoolValue && !_IsWarmingUp && !_IsCoolingDown)
// {
// _IsCoolingDown = true;
// _PowerIsOn = false;
// PowerIsOnFeedback.FireUpdate();
// IsCoolingDownFeedback.FireUpdate();
// // Fake cool-down cycle
// CooldownTimer = new CTimer(o =>
// {
// _IsCoolingDown = false;
// IsCoolingDownFeedback.FireUpdate();
// }, CooldownTime);
// }
// IrPort.Pulse(IROutputStandardCommands.IROut_POWER_OFF, IrPulseTime);
// }
// public override void PowerToggle()
// {
// // Not sure how to handle the feedback, but we should default to power off fb.
// // Does this need to trigger feedback??
// _PowerIsOn = false;
// IrPort.Pulse(IROutputStandardCommands.IROut_POWER, IrPulseTime);
// }
// #region IFunctionList Members
// public List<CueActionPair> CueActionList
// {
// get;
// private set;
// }
// #endregion
// protected override Func<bool> PowerIsOnOutputFunc { get { return () => _PowerIsOn; } }
// protected override Func<bool> IsCoolingDownOutputFunc { get { return () => _IsCoolingDown; } }
// protected override Func<bool> IsWarmingUpOutputFunc { get { return () => _IsWarmingUp; } }
// public override void ExecuteSwitch(object selector)
// {
// IrPort.Pulse((string)selector, IrPulseTime);
// }
// }
//}

View File

@@ -1,99 +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;
namespace PepperDash.Essentials.Core
{
/// <summary>
///
/// </summary>
public abstract class DisplayBase : Device, IHasFeedback, IRoutingSinkWithSwitching, IPower, IWarmingCooling
{
public BoolFeedback PowerIsOnFeedback { get; protected set; }
public BoolFeedback IsCoolingDownFeedback { get; protected set; }
public BoolFeedback IsWarmingUpFeedback { get; private set; }
public uint WarmupTime { get; set; }
public uint CooldownTime { get; set; }
/// <summary>
/// Bool Func that will provide a value for the PowerIsOn Output. Must be implemented
/// by concrete sub-classes
/// </summary>
abstract protected Func<bool> PowerIsOnFeedbackFunc { get; }
abstract protected Func<bool> IsCoolingDownFeedbackFunc { get; }
abstract protected Func<bool> IsWarmingUpFeedbackFunc { get; }
protected CTimer WarmupTimer;
protected CTimer CooldownTimer;
#region IRoutingInputs Members
public RoutingPortCollection<RoutingInputPort> InputPorts { get; private set; }
#endregion
public DisplayBase(string key, string name)
: base(key, name)
{
PowerIsOnFeedback = new BoolFeedback(CommonBoolCue.PowerOnFeedback, PowerIsOnFeedbackFunc);
IsCoolingDownFeedback = new BoolFeedback(CommonBoolCue.IsCoolingDown, IsCoolingDownFeedbackFunc);
IsWarmingUpFeedback = new BoolFeedback(CommonBoolCue.IsWarmingUp, IsWarmingUpFeedbackFunc);
InputPorts = new RoutingPortCollection<RoutingInputPort>();
}
public abstract void PowerOn();
public abstract void PowerOff();
public abstract void PowerToggle();
public virtual List<Feedback> Feedbacks
{
get
{
return new List<Feedback>
{
PowerIsOnFeedback,
IsCoolingDownFeedback,
IsWarmingUpFeedback
};
}
}
public abstract void ExecuteSwitch(object selector);
}
/// <summary>
///
/// </summary>
public abstract class TwoWayDisplayBase : DisplayBase
{
public static MockDisplay DefaultDisplay {
get
{
if (_DefaultDisplay == null)
_DefaultDisplay = new MockDisplay("default", "Default Display");
return _DefaultDisplay;
}
}
static MockDisplay _DefaultDisplay;
public TwoWayDisplayBase(string key, string name)
: base(key, name)
{
WarmupTime = 7000;
CooldownTime = 15000;
}
}
}

View File

@@ -1,177 +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.Routing;
namespace PepperDash.Essentials.Core
{
/// <summary>
///
/// </summary>
public class MockDisplay : TwoWayDisplayBase, IBasicVolumeWithFeedback
{
public RoutingInputPort HdmiIn1 { get; private set; }
public RoutingInputPort HdmiIn2 { get; private set; }
public RoutingInputPort HdmiIn3 { get; private set; }
public RoutingInputPort ComponentIn1 { get; private set; }
public RoutingInputPort VgaIn1 { get; private set; }
bool _PowerIsOn;
bool _IsWarmingUp;
bool _IsCoolingDown;
protected override Func<bool> PowerIsOnFeedbackFunc { get { return () => _PowerIsOn; } }
protected override Func<bool> IsCoolingDownFeedbackFunc { get { return () => _IsCoolingDown; } }
protected override Func<bool> IsWarmingUpFeedbackFunc { get { return () => _IsWarmingUp; } }
int VolumeHeldRepeatInterval = 200;
ushort VolumeInterval = 655;
ushort _FakeVolumeLevel = 31768;
bool _IsMuted;
public MockDisplay(string key, string name)
: base(key, name)
{
HdmiIn1 = new RoutingInputPort(RoutingPortNames.HdmiIn1, eRoutingSignalType.AudioVideo,
eRoutingPortConnectionType.Hdmi, null, this);
HdmiIn2 = new RoutingInputPort(RoutingPortNames.HdmiIn2, eRoutingSignalType.AudioVideo,
eRoutingPortConnectionType.Hdmi, null, this);
HdmiIn3 = new RoutingInputPort(RoutingPortNames.HdmiIn3, eRoutingSignalType.AudioVideo,
eRoutingPortConnectionType.Hdmi, null, this);
ComponentIn1 = new RoutingInputPort(RoutingPortNames.ComponentIn, eRoutingSignalType.Video,
eRoutingPortConnectionType.Component, null, this);
VgaIn1 = new RoutingInputPort(RoutingPortNames.VgaIn, eRoutingSignalType.Video,
eRoutingPortConnectionType.Composite, null, this);
InputPorts.AddRange(new[] { HdmiIn1, HdmiIn2, HdmiIn3, ComponentIn1, VgaIn1 });
VolumeLevelFeedback = new IntFeedback(() => { return _FakeVolumeLevel; });
MuteFeedback = new BoolFeedback(CommonBoolCue.MuteOn, () => _IsMuted);
}
public override void PowerOn()
{
if (!PowerIsOnFeedback.BoolValue && !_IsWarmingUp && !_IsCoolingDown)
{
_IsWarmingUp = true;
IsWarmingUpFeedback.FireUpdate();
// Fake power-up cycle
WarmupTimer = new CTimer(o =>
{
_IsWarmingUp = false;
_PowerIsOn = true;
IsWarmingUpFeedback.FireUpdate();
PowerIsOnFeedback.FireUpdate();
}, WarmupTime);
}
}
public override void PowerOff()
{
// If a display has unreliable-power off feedback, just override this and
// remove this check.
if (PowerIsOnFeedback.BoolValue && !_IsWarmingUp && !_IsCoolingDown)
{
_IsCoolingDown = true;
_PowerIsOn = false;
PowerIsOnFeedback.FireUpdate();
IsCoolingDownFeedback.FireUpdate();
// Fake cool-down cycle
CooldownTimer = new CTimer(o =>
{
Debug.Console(2, this, "Cooldown timer ending");
_IsCoolingDown = false;
IsCoolingDownFeedback.FireUpdate();
}, CooldownTime);
}
}
public override void PowerToggle()
{
if (PowerIsOnFeedback.BoolValue && !IsWarmingUpFeedback.BoolValue)
PowerOff();
else if (!PowerIsOnFeedback.BoolValue && !IsCoolingDownFeedback.BoolValue)
PowerOn();
}
public override void ExecuteSwitch(object selector)
{
Debug.Console(2, this, "ExecuteSwitch: {0}", selector);
}
#region IBasicVolumeWithFeedback Members
public IntFeedback VolumeLevelFeedback { get; private set; }
public void SetVolume(ushort level)
{
_FakeVolumeLevel = level;
VolumeLevelFeedback.FireUpdate();
}
public void MuteOn()
{
_IsMuted = true;
MuteFeedback.FireUpdate();
}
public void MuteOff()
{
_IsMuted = false;
MuteFeedback.FireUpdate();
}
public BoolFeedback MuteFeedback { get; private set; }
#endregion
#region IBasicVolumeControls Members
public void VolumeUp(bool pressRelease)
{
//while (pressRelease)
//{
Debug.Console(2, this, "Volume Down {0}", pressRelease);
if (pressRelease)
{
var newLevel = _FakeVolumeLevel + VolumeInterval;
SetVolume((ushort)newLevel);
CrestronEnvironment.Sleep(VolumeHeldRepeatInterval);
}
//}
}
public void VolumeDown(bool pressRelease)
{
//while (pressRelease)
//{
Debug.Console(2, this, "Volume Up {0}", pressRelease);
if (pressRelease)
{
var newLevel = _FakeVolumeLevel - VolumeInterval;
SetVolume((ushort)newLevel);
CrestronEnvironment.Sleep(VolumeHeldRepeatInterval);
}
//}
}
public void MuteToggle()
{
_IsMuted = !_IsMuted;
MuteFeedback.FireUpdate();
}
#endregion
}
}

View File

@@ -1,44 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Core.Ethernet
{
public static class EthernetSettings
{
public static readonly BoolFeedback LinkActive = new BoolFeedback(EthernetCue.LinkActive,
() => true);
public static readonly BoolFeedback DhcpActive = new BoolFeedback(EthernetCue.DhcpActive,
() => CrestronEthernetHelper.GetEthernetParameter(
CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_DHCP_STATE, 0) == "ON");
public static readonly StringFeedback Hostname = new StringFeedback(EthernetCue.Hostname,
() => CrestronEthernetHelper.GetEthernetParameter(
CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_HOSTNAME, 0));
public static readonly StringFeedback IpAddress0 = new StringFeedback(EthernetCue.IpAddress0,
() => CrestronEthernetHelper.GetEthernetParameter(
CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_ADDRESS, 0));
public static readonly StringFeedback SubnetMask0 = new StringFeedback(EthernetCue.SubnetMask0,
() => CrestronEthernetHelper.GetEthernetParameter(
CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_MASK, 0));
public static readonly StringFeedback DefaultGateway0 = new StringFeedback(EthernetCue.DefaultGateway0,
() => CrestronEthernetHelper.GetEthernetParameter(
CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_ROUTER, 0));
}
public static class EthernetCue
{
public static readonly Cue LinkActive = Cue.BoolCue("LinkActive", 1);
public static readonly Cue DhcpActive = Cue.BoolCue("DhcpActive", 2);
public static readonly Cue Hostname = Cue.StringCue("Hostname", 1);
public static readonly Cue IpAddress0 = Cue.StringCue("IpAddress0", 2);
public static readonly Cue SubnetMask0 = Cue.StringCue("SubnetMask0", 3);
public static readonly Cue DefaultGateway0 = Cue.StringCue("DefaultGateway0", 4);
}
}

View File

@@ -1,69 +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 class BoolFeedbackPulse
{
public uint TimeoutMs { get; set; }
/// <summary>
/// Defaults to false
/// </summary>
public bool CanRetrigger { get; set; }
public BoolFeedback Feedback { get; private set; }
CTimer Timer;
bool _BoolValue;
/// <summary>
/// Creates a non-retriggering one shot
/// </summary>
public BoolFeedbackPulse(uint timeoutMs)
: this(timeoutMs, false)
{
}
/// <summary>
/// Create a retriggerable one shot by setting canRetrigger true
/// </summary>
public BoolFeedbackPulse(uint timeoutMs, bool canRetrigger)
{
TimeoutMs = timeoutMs;
CanRetrigger = canRetrigger;
Feedback = new BoolFeedback(() => _BoolValue);
}
/// <summary>
/// Starts the
/// </summary>
/// <param name="timeout"></param>
public void Start()
{
if (Timer == null)
{
_BoolValue = true;
Feedback.FireUpdate();
Timer = new CTimer(o =>
{
_BoolValue = false;
Feedback.FireUpdate();
Timer = null;
}, TimeoutMs);
}
// Timer is running, if retrigger is set, reset it.
else if (CanRetrigger)
Timer.Reset(TimeoutMs);
}
public void Cancel()
{
if(Timer != null)
Timer.Reset(0);
}
}
}

View File

@@ -1,78 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
namespace PepperDash.Essentials.Core
{
/// <summary>
/// A class that wraps a BoolFeedback with logic that extends it's true state for
/// a time period after the value goes false.
/// </summary>
public class BoolFeedbackPulseExtender
{
public uint TimeoutMs { get; set; }
public BoolFeedback Feedback { get; private set; }
CTimer Timer;
/// <summary>
/// When set to true, will cause Feedback to go high, and cancel the timer.
/// When false, will start the timer, and after timeout, will go low and
/// feedback will go low.
/// </summary>
public bool BoolValue
{
get { return _BoolValue; }
set
{
if (value)
{ // if Timer is running and the value goes high, cancel it.
if (Timer != null)
{
Timer.Stop();
Timer = null;
}
// if it's already true, don't fire again
if (_BoolValue == true)
return;
_BoolValue = true;
Feedback.FireUpdate();
}
else
{
if (Timer == null)
Timer = new CTimer(o => ClearFeedback(), TimeoutMs);
}
}
}
bool _BoolValue;
/// <summary>
/// Constructor
/// </summary>
/// <param name="timeoutMs">The time which the true state will be extended after set to false</param>
public BoolFeedbackPulseExtender(uint timeoutMs)
{
TimeoutMs = timeoutMs;
Feedback = new BoolFeedback(() => this.BoolValue);
}
/// <summary>
/// Forces the feedback to false regardless of timeout
/// </summary>
public void ClearNow()
{
if (Timer != null)
Timer.Stop();
ClearFeedback();
}
void ClearFeedback()
{
_BoolValue = false;
Feedback.FireUpdate();
Timer = null;
}
}
}

View File

@@ -1,131 +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 BoolFeedbackLogic
{
/// <summary>
/// Output representing the "and" value of all connected inputs
/// </summary>
public BoolFeedback Output { get; private set; }
/// <summary>
/// List of all connected outputs
/// </summary>
protected List<BoolFeedback> OutputsIn = new List<BoolFeedback>();
protected bool ComputedValue;
public BoolFeedbackLogic()
{
Output = new BoolFeedback(() => ComputedValue);
}
public void AddOutputIn(BoolFeedback output)
{
// Don't double up outputs
if(OutputsIn.Contains(output)) return;
OutputsIn.Add(output);
output.OutputChange += AnyInput_OutputChange;
Evaluate();
}
public void AddOutputsIn(List<BoolFeedback> outputs)
{
foreach (var o in outputs)
{
// skip existing
if (OutputsIn.Contains(o)) continue;
OutputsIn.Add(o);
o.OutputChange += AnyInput_OutputChange;
}
Evaluate();
}
public void RemoveOutputIn(BoolFeedback output)
{
// Don't double up outputs
if (OutputsIn.Contains(output)) return;
OutputsIn.Remove(output);
output.OutputChange -= AnyInput_OutputChange;
Evaluate();
}
public void RemoveOutputsIn(List<BoolFeedback> outputs)
{
foreach (var o in outputs)
{
OutputsIn.Remove(o);
o.OutputChange -= AnyInput_OutputChange;
}
Evaluate();
}
void AnyInput_OutputChange(object sender, EventArgs e)
{
Evaluate();
}
protected abstract void Evaluate();
}
public class BoolFeedbackAnd : BoolFeedbackLogic
{
protected override void Evaluate()
{
var prevValue = ComputedValue;
var newValue = OutputsIn.All(o => o.BoolValue);
if (newValue != prevValue)
{
ComputedValue = newValue;
Output.FireUpdate();
}
}
}
public class BoolFeedbackOr : BoolFeedbackLogic
{
protected override void Evaluate()
{
var prevValue = ComputedValue;
var newValue = OutputsIn.Any(o => o.BoolValue);
if (newValue != prevValue)
{
ComputedValue = newValue;
Output.FireUpdate();
}
}
}
public class BoolFeedbackLinq : BoolFeedbackLogic
{
Func<IEnumerable<BoolFeedback>, bool> Predicate;
public BoolFeedbackLinq(Func<IEnumerable<BoolFeedback>, bool> predicate)
: base()
{
Predicate = predicate;
}
protected override void Evaluate()
{
var prevValue = ComputedValue;
var newValue = Predicate(OutputsIn);
if (newValue != prevValue)
{
ComputedValue = newValue;
Output.FireUpdate();
}
}
}
}

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,377 +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.Fusion;
//using PepperDash.Essentials.Core;
//using PepperDash.Core;
//namespace PepperDash.Essentials.Core.Fusion
//{
// public class EssentialsHuddleSpaceFusionSystemController : Device
// {
// FusionRoom FusionRoom;
// Room Room;
// Dictionary<IPresentationSource, BoolInputSig> SourceToFeedbackSigs = new Dictionary<IPresentationSource, BoolInputSig>();
// StatusMonitorCollection ErrorMessageRollUp;
// public EssentialsHuddleSpaceFusionSystemController(HuddleSpaceRoom room, uint ipId)
// : base(room.Key + "-fusion")
// {
// Room = room;
// FusionRoom = new FusionRoom(ipId, Global.ControlSystem, room.Name, "awesomeGuid-" + room.Key);
// FusionRoom.Register();
// FusionRoom.FusionStateChange += new FusionStateEventHandler(FusionRoom_FusionStateChange);
// // Room to fusion room
// room.RoomIsOn.LinkInputSig(FusionRoom.SystemPowerOn.InputSig);
// var srcName = FusionRoom.CreateOffsetStringSig(50, "Source - Name", eSigIoMask.InputSigOnly);
// room.CurrentSourceName.LinkInputSig(srcName.InputSig);
// FusionRoom.SystemPowerOn.OutputSig.UserObject = new Action<bool>(b => { if (b) room.RoomOn(null); });
// FusionRoom.SystemPowerOff.OutputSig.UserObject = new Action<bool>(b => { if (b) room.RoomOff(); });
// // NO!! room.RoomIsOn.LinkComplementInputSig(FusionRoom.SystemPowerOff.InputSig);
// FusionRoom.ErrorMessage.InputSig.StringValue = "3: 7 Errors: This is a really long error message;This is a really long error message;This is a really long error message;This is a really long error message;This is a really long error message;This is a really long error message;This is a really long error message;";
// // Sources
// foreach (var src in room.Sources)
// {
// var srcNum = src.Key;
// var pSrc = src.Value as IPresentationSource;
// var keyNum = ExtractNumberFromKey(pSrc.Key);
// if (keyNum == -1)
// {
// Debug.Console(1, this, "WARNING: Cannot link source '{0}' to numbered Fusion attributes", pSrc.Key);
// continue;
// }
// string attrName = null;
// uint attrNum = Convert.ToUInt32(keyNum);
// switch (pSrc.Type)
// {
// case PresentationSourceType.None:
// break;
// case PresentationSourceType.SetTopBox:
// attrName = "Source - TV " + keyNum;
// attrNum += 115; // TV starts at 116
// break;
// case PresentationSourceType.Dvd:
// attrName = "Source - DVD " + keyNum;
// attrNum += 120; // DVD starts at 121
// break;
// case PresentationSourceType.PC:
// attrName = "Source - PC " + keyNum;
// attrNum += 110; // PC starts at 111
// break;
// case PresentationSourceType.Laptop:
// attrName = "Source - Laptop " + keyNum;
// attrNum += 100; // Laptops start at 101
// break;
// case PresentationSourceType.VCR:
// attrName = "Source - VCR " + keyNum;
// attrNum += 125; // VCRs start at 126
// break;
// }
// if (attrName == null)
// {
// Debug.Console(1, this, "Source type {0} does not have corresponsing Fusion attribute type, skipping", pSrc.Type);
// continue;
// }
// Debug.Console(2, this, "Creating attribute '{0}' with join {1} for source {2}", attrName, attrNum, pSrc.Key);
// var sigD = FusionRoom.CreateOffsetBoolSig(attrNum, attrName, eSigIoMask.InputOutputSig);
// // Need feedback when this source is selected
// // Event handler, added below, will compare source changes with this sig dict
// SourceToFeedbackSigs.Add(pSrc, sigD.InputSig);
// // And respond to selection in Fusion
// sigD.OutputSig.UserObject = new Action<bool>(b => { if(b) room.SelectSource(pSrc); });
// }
// // Attach to all room's devices with monitors.
// //foreach (var dev in DeviceManager.Devices)
// foreach (var dev in DeviceManager.GetDevices())
// {
// if (!(dev is ICommunicationMonitor))
// continue;
// var keyNum = ExtractNumberFromKey(dev.Key);
// if (keyNum == -1)
// {
// Debug.Console(1, this, "WARNING: Cannot link device '{0}' to numbered Fusion monitoring attributes", dev.Key);
// continue;
// }
// string attrName = null;
// uint attrNum = Convert.ToUInt32(keyNum);
// //if (dev is SmartGraphicsTouchpanelControllerBase)
// //{
// // if (attrNum > 10)
// // continue;
// // attrName = "Device Ok - Touch Panel " + attrNum;
// // attrNum += 200;
// //}
// //// add xpanel here
// //else
// if (dev is DisplayBase)
// {
// if (attrNum > 10)
// continue;
// attrName = "Device Ok - Display " + attrNum;
// attrNum += 240;
// }
// //else if (dev is DvdDeviceBase)
// //{
// // if (attrNum > 5)
// // continue;
// // attrName = "Device Ok - DVD " + attrNum;
// // attrNum += 260;
// //}
// // add set top box
// // add Cresnet roll-up
// // add DM-devices roll-up
// if (attrName != null)
// {
// // Link comm status to sig and update
// var sigD = FusionRoom.CreateOffsetBoolSig(attrNum, attrName, eSigIoMask.InputSigOnly);
// var smd = dev as ICommunicationMonitor;
// sigD.InputSig.BoolValue = smd.CommunicationMonitor.Status == MonitorStatus.IsOk;
// smd.CommunicationMonitor.StatusChange += (o, a) => { sigD.InputSig.BoolValue = a.Status == MonitorStatus.IsOk; };
// Debug.Console(0, this, "Linking '{0}' communication monitor to Fusion '{1}'", dev.Key, attrName);
// }
// }
// // Don't think we need to get current status of this as nothing should be alive yet.
// room.PresentationSourceChange += Room_PresentationSourceChange;
// // these get used in multiple places
// var display = room.Display;
// var dispPowerOnAction = new Action<bool>(b => { if (!b) display.PowerOn(); });
// var dispPowerOffAction = new Action<bool>(b => { if (!b) display.PowerOff(); });
// // Display to fusion room sigs
// FusionRoom.DisplayPowerOn.OutputSig.UserObject = dispPowerOnAction;
// FusionRoom.DisplayPowerOff.OutputSig.UserObject = dispPowerOffAction;
// display.PowerIsOnFeedback.LinkInputSig(FusionRoom.DisplayPowerOn.InputSig);
// if (display is IDisplayUsage)
// (display as IDisplayUsage).LampHours.LinkInputSig(FusionRoom.DisplayUsage.InputSig);
// // Roll up ALL device errors
// ErrorMessageRollUp = new StatusMonitorCollection(this);
// foreach (var dev in DeviceManager.GetDevices())
// {
// var md = dev as ICommunicationMonitor;
// if (md != null)
// {
// ErrorMessageRollUp.AddMonitor(md.CommunicationMonitor);
// Debug.Console(2, this, "Adding '{0}' to room's overall error monitor", md.CommunicationMonitor.Parent.Key);
// }
// }
// ErrorMessageRollUp.Start();
// FusionRoom.ErrorMessage.InputSig.StringValue = ErrorMessageRollUp.Message;
// ErrorMessageRollUp.StatusChange += (o, a) => {
// FusionRoom.ErrorMessage.InputSig.StringValue = ErrorMessageRollUp.Message; };
// // static assets --------------- testing
// // test assets --- THESE ARE BOTH WIRED TO AssetUsage somewhere internally.
// var ta1 = FusionRoom.CreateStaticAsset(1, "Test asset 1", "Awesome Asset", "Awesome123");
// ta1.AssetError.InputSig.StringValue = "This should be error";
// var ta2 = FusionRoom.CreateStaticAsset(2, "Test asset 2", "Awesome Asset", "Awesome1232");
// ta2.AssetUsage.InputSig.StringValue = "This should be usage";
// // Make a display asset
// var dispAsset = FusionRoom.CreateStaticAsset(3, display.Name, "Display", "awesomeDisplayId" + room.Key);
// dispAsset.PowerOn.OutputSig.UserObject = dispPowerOnAction;
// dispAsset.PowerOff.OutputSig.UserObject = dispPowerOffAction;
// display.PowerIsOnFeedback.LinkInputSig(dispAsset.PowerOn.InputSig);
// // NO!! display.PowerIsOn.LinkComplementInputSig(dispAsset.PowerOff.InputSig);
// // Use extension methods
// dispAsset.TrySetMakeModel(display);
// dispAsset.TryLinkAssetErrorToCommunication(display);
// // Make it so!
// FusionRVI.GenerateFileForAllFusionDevices();
// }
// /// <summary>
// /// Helper to get the number from the end of a device's key string
// /// </summary>
// /// <returns>-1 if no number matched</returns>
// int ExtractNumberFromKey(string key)
// {
// var capture = System.Text.RegularExpressions.Regex.Match(key, @"\D+(\d+)");
// if (!capture.Success)
// return -1;
// else return Convert.ToInt32(capture.Groups[1].Value);
// }
// void Room_PresentationSourceChange(object sender, EssentialsRoomSourceChangeEventArgs e)
// {
// if (e.OldSource != null)
// {
// if (SourceToFeedbackSigs.ContainsKey(e.OldSource))
// SourceToFeedbackSigs[e.OldSource].BoolValue = false;
// }
// if (e.NewSource != null)
// {
// if (SourceToFeedbackSigs.ContainsKey(e.NewSource))
// SourceToFeedbackSigs[e.NewSource].BoolValue = true;
// }
// }
// void FusionRoom_FusionStateChange(FusionBase device, FusionStateEventArgs args)
// {
// // The sig/UO method: Need separate handlers for fixed and user sigs, all flavors,
// // even though they all contain sigs.
// var sigData = (args.UserConfiguredSigDetail as BooleanSigDataFixedName);
// if (sigData != null)
// {
// var outSig = sigData.OutputSig;
// if (outSig.UserObject is Action<bool>)
// (outSig.UserObject as Action<bool>).Invoke(outSig.BoolValue);
// else if (outSig.UserObject is Action<ushort>)
// (outSig.UserObject as Action<ushort>).Invoke(outSig.UShortValue);
// else if (outSig.UserObject is Action<string>)
// (outSig.UserObject as Action<string>).Invoke(outSig.StringValue);
// return;
// }
// var attrData = (args.UserConfiguredSigDetail as BooleanSigData);
// if (attrData != null)
// {
// var outSig = attrData.OutputSig;
// if (outSig.UserObject is Action<bool>)
// (outSig.UserObject as Action<bool>).Invoke(outSig.BoolValue);
// else if (outSig.UserObject is Action<ushort>)
// (outSig.UserObject as Action<ushort>).Invoke(outSig.UShortValue);
// else if (outSig.UserObject is Action<string>)
// (outSig.UserObject as Action<string>).Invoke(outSig.StringValue);
// return;
// }
// }
// }
// public static class FusionRoomExtensions
// {
// /// <summary>
// /// Creates and returns a fusion attribute. The join number will match the established Simpl
// /// standard of 50+, and will generate a 50+ join in the RVI. It calls
// /// FusionRoom.AddSig with join number - 49
// /// </summary>
// /// <returns>The new attribute</returns>
// public static BooleanSigData CreateOffsetBoolSig(this FusionRoom fr, uint number, string name, eSigIoMask mask)
// {
// if (number < 50) throw new ArgumentOutOfRangeException("number", "Cannot be less than 50");
// number -= 49;
// fr.AddSig(eSigType.Bool, number, name, mask);
// return fr.UserDefinedBooleanSigDetails[number];
// }
// /// <summary>
// /// Creates and returns a fusion attribute. The join number will match the established Simpl
// /// standard of 50+, and will generate a 50+ join in the RVI. It calls
// /// FusionRoom.AddSig with join number - 49
// /// </summary>
// /// <returns>The new attribute</returns>
// public static UShortSigData CreateOffsetUshortSig(this FusionRoom fr, uint number, string name, eSigIoMask mask)
// {
// if (number < 50) throw new ArgumentOutOfRangeException("number", "Cannot be less than 50");
// number -= 49;
// fr.AddSig(eSigType.UShort, number, name, mask);
// return fr.UserDefinedUShortSigDetails[number];
// }
// /// <summary>
// /// Creates and returns a fusion attribute. The join number will match the established Simpl
// /// standard of 50+, and will generate a 50+ join in the RVI. It calls
// /// FusionRoom.AddSig with join number - 49
// /// </summary>
// /// <returns>The new attribute</returns>
// public static StringSigData CreateOffsetStringSig(this FusionRoom fr, uint number, string name, eSigIoMask mask)
// {
// if (number < 50) throw new ArgumentOutOfRangeException("number", "Cannot be less than 50");
// number -= 49;
// fr.AddSig(eSigType.String, number, name, mask);
// return fr.UserDefinedStringSigDetails[number];
// }
// /// <summary>
// /// Creates and returns a static asset
// /// </summary>
// /// <returns>the new asset</returns>
// public static FusionStaticAsset CreateStaticAsset(this FusionRoom fr, uint number, string name, string type, string instanceId)
// {
// fr.AddAsset(eAssetType.StaticAsset, number, name, type, instanceId);
// return fr.UserConfigurableAssetDetails[number].Asset as FusionStaticAsset;
// }
// }
// //************************************************************************************************
// /// <summary>
// /// Extensions to enhance Fusion room, asset and signal creation.
// /// </summary>
// public static class FusionStaticAssetExtensions
// {
// /// <summary>
// /// Tries to set a Fusion asset with the make and model of a device.
// /// If the provided Device is IMakeModel, will set the corresponding parameters on the fusion static asset.
// /// Otherwise, does nothing.
// /// </summary>
// public static void TrySetMakeModel(this FusionStaticAsset asset, Device device)
// {
// var mm = device as IMakeModel;
// if (mm != null)
// {
// asset.ParamMake.Value = mm.DeviceMake;
// asset.ParamModel.Value = mm.DeviceModel;
// }
// }
// /// <summary>
// /// Tries to attach the AssetError input on a Fusion asset to a Device's
// /// CommunicationMonitor.StatusChange event. Does nothing if the device is not
// /// IStatusMonitor
// /// </summary>
// /// <param name="asset"></param>
// /// <param name="device"></param>
// public static void TryLinkAssetErrorToCommunication(this FusionStaticAsset asset, Device device)
// {
// if (device is ICommunicationMonitor)
// {
// var monitor = (device as ICommunicationMonitor).CommunicationMonitor;
// monitor.StatusChange += (o, a) =>
// {
// // Link connected and error inputs on asset
// asset.Connected.InputSig.BoolValue = a.Status == MonitorStatus.IsOk;
// asset.AssetError.InputSig.StringValue = a.Status.ToString();
// };
// // set current value
// asset.Connected.InputSig.BoolValue = monitor.Status == MonitorStatus.IsOk;
// asset.AssetError.InputSig.StringValue = monitor.Status.ToString();
// }
// }
// }
//}

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,16 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
namespace PepperDash.Essentials.Core
{
/// <summary>
/// Defines a class that uses an InUseTracker
/// </summary>
public interface IInUseTracking
{
InUseTracking InUseTracker { get; }
}
}

View File

@@ -1,100 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
namespace PepperDash.Essentials.Core
{
/// <summary>
/// Provides in use tracking. Objects can register with this. InUseFeedback can provide
/// events when usage changes.
/// </summary>
public class InUseTracking
{
/// <summary>
/// Returns a copied list of all users of this tracker.
/// </summary>
public IEnumerable<InUseTrackingObject> Users { get { return new List<InUseTrackingObject>(_Users); } }
List<InUseTrackingObject> _Users = new List<InUseTrackingObject>();
/// <summary>
/// Feedback that changes when this goes in/out of use
/// </summary>
public BoolFeedback InUseFeedback { get; private set; }
/// <summary>
/// Feedback that changes with the count of users
/// </summary>
public IntFeedback InUseCountFeedback { get; private set; }
public InUseTracking()
{
InUseFeedback = new BoolFeedback(() => _Users.Count > 0);
InUseCountFeedback = new IntFeedback(() => _Users.Count);
}
/// <summary>
/// Add a "user" object to this tracker. A user can be added to this tracker
/// multiple times, provided that the label is different
/// </summary>
/// <param name="label">A label to identify the instance of the user. Treated like a "role", etc.</param>
public void AddUser(object objectToAdd, string label)
{
// check if an exact object/label pair exists and ignore if so. No double-registers.
var check = _Users.FirstOrDefault(u => u.Label == label && u.User == objectToAdd);
if (check != null) return;
var prevCount = _Users.Count;
_Users.Add(new InUseTrackingObject(objectToAdd, label));
// if this is the first add, fire an update
if (prevCount == 0 && _Users.Count > 0)
InUseFeedback.FireUpdate();
InUseCountFeedback.FireUpdate();
}
/// <summary>
/// Remove a user object from this tracking
/// </summary>
public void RemoveUser(object objectToRemove, string label)
{
// Find the user object if exists and remove it
var toRemove = _Users.FirstOrDefault(u => u.Label == label && u.User == objectToRemove);
if (toRemove != null)
{
_Users.Remove(toRemove);
if (_Users.Count == 0)
InUseFeedback.FireUpdate();
InUseCountFeedback.FireUpdate();
}
}
}
/// <summary>
/// Wrapper for label/object pair representing in-use status. Allows the same object to
/// register for in-use with different roles.
/// </summary>
public class InUseTrackingObject
{
public string Label { get; private set; }
public object User { get; private set; }
public InUseTrackingObject(object user, string label)
{
User = user;
Label = label;
}
}
//public class InUseEventArgs
//{
// public int EventType { get; private set; }
// public InUseTracking Tracker { get; private set; }
// public InUseEventArgs(InUseTracking tracker, int eventType)
// {
// Tracker = tracker;
// EventType = eventType;
// }
//}
}

View File

@@ -1,98 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronDataStore;
using PepperDash.Essentials.Core;
using PepperDash.Core;
namespace PepperDash.Essentials.License
{
public abstract class LicenseManager
{
public BoolFeedback LicenseIsValid { get; protected set; }
public StringFeedback LicenseMessage { get; protected set; }
public StringFeedback LicenseLog { get; protected set; }
protected LicenseManager()
{
CrestronConsole.AddNewConsoleCommand(
s => CrestronConsole.ConsoleCommandResponse(GetStatusString()),
"licensestatus", "shows license and related data",
ConsoleAccessLevelEnum.AccessOperator);
}
protected abstract string GetStatusString();
}
public class MockEssentialsLicenseManager : LicenseManager
{
/// <summary>
/// Returns the singleton mock license manager for this app
/// </summary>
public static MockEssentialsLicenseManager Manager
{
get
{
if (_Manager == null)
_Manager = new MockEssentialsLicenseManager();
return _Manager;
}
}
static MockEssentialsLicenseManager _Manager;
bool IsValid;
MockEssentialsLicenseManager() : base()
{
LicenseIsValid = new BoolFeedback(LicenseCue.LicenseIsValid,
() => { return IsValid; });
CrestronConsole.AddNewConsoleCommand(
s => SetFromConsole(s.Equals("true", StringComparison.OrdinalIgnoreCase)),
"mocklicense", "true or false for testing", ConsoleAccessLevelEnum.AccessOperator);
bool valid;
var err = CrestronDataStoreStatic.GetGlobalBoolValue("MockLicense", out valid);
if (err == CrestronDataStore.CDS_ERROR.CDS_SUCCESS)
SetIsValid(valid);
else if (err == CrestronDataStore.CDS_ERROR.CDS_RECORD_NOT_FOUND)
CrestronDataStoreStatic.SetGlobalBoolValue("MockLicense", false);
else
CrestronConsole.PrintLine("Error restoring Mock License setting: {0}", err);
}
void SetIsValid(bool isValid)
{
IsValid = isValid;
CrestronDataStoreStatic.SetGlobalBoolValue("MockLicense", isValid);
Debug.Console(0, "Mock License is{0} valid", IsValid ? "" : " not");
LicenseIsValid.FireUpdate();
}
void SetFromConsole(bool isValid)
{
SetIsValid(isValid);
}
protected override string GetStatusString()
{
return string.Format("License Status: {0}", IsValid ? "Valid" : "Not Valid");
}
}
public class EssentialsLicenseManager
{
}
public class LicenseCue
{
public static Cue LicenseIsValid = Cue.BoolCue("LicenseIsValid", 15991);
public static Cue LicenseMessage = Cue.StringCue("LicenseMessage", 15991);
}
}

View File

@@ -1,57 +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 System.ComponentModel;
using PepperDash.Core;
namespace PepperDash.Essentials.Core
{
/// <summary>
///
/// </summary>
public class CrestronGenericBaseCommunicationMonitor : StatusMonitorBase
{
GenericBase Device;
public CrestronGenericBaseCommunicationMonitor(IKeyed parent, GenericBase device, long warningTime, long errorTime)
: base(parent, warningTime, errorTime)
{
Device = device;
}
public override void Start()
{
Device.OnlineStatusChange -= Device_OnlineStatusChange;
Device.OnlineStatusChange += Device_OnlineStatusChange;
GetStatus();
}
public override void Stop()
{
Device.OnlineStatusChange -= Device_OnlineStatusChange;
}
void Device_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args)
{
GetStatus();
}
void GetStatus()
{
if (Device.IsOnline)
{
Status = MonitorStatus.IsOk;
StopErrorTimers();
}
else
StartErrorTimers();
}
}
}

View File

@@ -1,129 +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 System.ComponentModel;
using PepperDash.Core;
namespace PepperDash.Essentials.Core
{
/// <summary>
/// Used for monitoring comms that are IBasicCommunication. Will send a poll string and provide an event when
/// statuses change.
/// </summary>
public class GenericCommunicationMonitor : StatusMonitorBase
{
public IBasicCommunication Client { get; private set; }
long PollTime;
CTimer PollTimer;
string PollString;
/// <summary>
///
/// </summary>
/// <param name="client"></param>
/// <param name="pollTime">in MS, >= 5000</param>
/// <param name="warningTime">in MS, >= 5000</param>
/// <param name="errorTime">in MS, >= 5000</param>
/// <param name="pollString">String to send to comm</param>
public GenericCommunicationMonitor(IKeyed parent, IBasicCommunication client, long pollTime,
long warningTime, long errorTime, string pollString) :
base(parent, warningTime, errorTime)
{
if (pollTime > warningTime || pollTime > errorTime)
throw new ArgumentException("pollTime must be less than warning or errorTime");
if (pollTime < 5000)
throw new ArgumentException("pollTime cannot be less than 5000 ms");
Client = client;
PollTime = pollTime;
PollString = pollString;
}
/// <summary>
/// Build the monitor from a config object
/// </summary>
public GenericCommunicationMonitor(IKeyed parent, IBasicCommunication client,
CommunicationMonitorConfig props) :
this(parent, client, props.PollInterval, props.TimeToWarning, props.TimeToError, props.PollString)
{
}
public override void Start()
{
Client.BytesReceived += Client_BytesReceived;
Poll();
PollTimer = new CTimer(o => Poll(), null, PollTime, PollTime);
}
public override void Stop()
{
Client.BytesReceived -= this.Client_BytesReceived;
PollTimer.Stop();
PollTimer = null;
StopErrorTimers();
}
/// <summary>
/// Upon any receipt of data, set everything to ok!
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void Client_BytesReceived(object sender, GenericCommMethodReceiveBytesArgs e)
{
Status = MonitorStatus.IsOk;
StopErrorTimers();
}
void Poll()
{
StartErrorTimers();
if (Client.IsConnected)
{
Debug.Console(2, Client, "Monitor, Polling");
Client.SendText(PollString);
}
else
{
Debug.Console(2, Client, "Monitor, Comm not connected");
}
}
/// <summary>
/// When the client connects, and we're waiting for it, respond and disconect from event
/// </summary>
void OneTimeConnectHandler(object o, EventArgs a)
{
if (Client.IsConnected)
{
//Client.IsConnected -= OneTimeConnectHandler;
Debug.Console(2, Client, "Monitor, Comm connected");
Poll();
}
}
}
public class CommunicationMonitorConfig
{
public int PollInterval { get; set; }
public int TimeToWarning { get; set; }
public int TimeToError { get; set; }
public string PollString { get; set; }
public CommunicationMonitorConfig()
{
PollInterval = 30000;
TimeToWarning = 120000;
TimeToError = 300000;
PollString = "";
}
}
}

View File

@@ -1,53 +0,0 @@
using System;
using PepperDash.Core;
namespace PepperDash.Essentials.Core
{
public interface IStatusMonitor
{
IKeyed Parent { get; }
event EventHandler<MonitorStatusChangeEventArgs> StatusChange;
MonitorStatus Status { get; }
string Message { get; }
void Start();
void Stop();
}
/// <summary>
/// Represents a class that has a basic communication monitoring
/// </summary>
public interface ICommunicationMonitor
{
StatusMonitorBase CommunicationMonitor { get; }
}
/// <summary>
///
/// </summary>
public enum MonitorStatus
{
IsOk, InWarning, InError, StatusUnknown
}
public class MonitorStatusChangeEventArgs : EventArgs
{
public MonitorStatus Status { get; private set; }
public string Message { get; private set; }
public MonitorStatusChangeEventArgs(MonitorStatus status)
{
Status = status;
Message = status == MonitorStatus.IsOk ? "" : status.ToString();
}
public MonitorStatusChangeEventArgs(MonitorStatus status, string message)
{
Status = status;
Message = message;
}
}
}

View File

@@ -1,100 +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 System.ComponentModel;
using PepperDash.Core;
namespace PepperDash.Essentials.Core
{
public abstract class StatusMonitorBase : IStatusMonitor
{
public event EventHandler<MonitorStatusChangeEventArgs> StatusChange;
public IKeyed Parent { get; private set; }
public MonitorStatus Status
{
get { return _Status; }
protected set
{
if (value != _Status)
{
_Status = value;
OnStatusChange(value);
}
}
}
MonitorStatus _Status;
public string Message
{
get { return _Message; }
set
{
if (value == _Message) return;
_Message = value;
OnStatusChange(Status, value);
}
}
string _Message;
long WarningTime;
long ErrorTime;
CTimer WarningTimer;
CTimer ErrorTimer;
public StatusMonitorBase(IKeyed parent, long warningTime, long errorTime)
{
Parent = parent;
if (warningTime > errorTime)
throw new ArgumentException("warningTime must be less than errorTime");
if (warningTime < 5000 || errorTime < 5000)
throw new ArgumentException("time values cannot be less that 5000 ms");
Status = MonitorStatus.StatusUnknown;
WarningTime = warningTime;
ErrorTime = errorTime;
}
public abstract void Start();
public abstract void Stop();
protected void OnStatusChange(MonitorStatus status)
{
var handler = StatusChange;
if (handler != null)
handler(this, new MonitorStatusChangeEventArgs(status));
}
protected void OnStatusChange(MonitorStatus status, string message)
{
var handler = StatusChange;
if (handler != null)
handler(this, new MonitorStatusChangeEventArgs(status, message));
}
protected void StartErrorTimers()
{
if (WarningTimer == null) WarningTimer = new CTimer(o => { Status = MonitorStatus.InWarning; }, WarningTime);
if (ErrorTimer == null) ErrorTimer = new CTimer(o => { Status = MonitorStatus.InError; }, ErrorTime);
}
protected void StopErrorTimers()
{
if (WarningTimer != null) WarningTimer.Stop();
if (ErrorTimer != null) ErrorTimer.Stop();
WarningTimer = null;
ErrorTimer = null;
}
}
}

View File

@@ -1,123 +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 System.ComponentModel;
using PepperDash.Core;
namespace PepperDash.Essentials.Core
{
/// <summary>
///
/// </summary>
public class StatusMonitorCollection : IStatusMonitor
{
public IKeyed Parent { get; private set; }
List<IStatusMonitor> Monitors = new List<IStatusMonitor>();
#region IStatusMonitor Members
public event EventHandler<MonitorStatusChangeEventArgs> StatusChange;
public MonitorStatus Status { get; protected set; }
public string Message { get; private set; }
public StatusMonitorCollection(IKeyed parent)
{
Parent = parent;
}
public void Start()
{
foreach (var mon in Monitors)
mon.StatusChange += mon_StatusChange;
ProcessStatuses();
}
void ProcessStatuses()
{
var InError = Monitors.Where(m => m.Status == MonitorStatus.InError);
var InWarning = Monitors.Where(m => m.Status == MonitorStatus.InWarning);
var IsOk = Monitors.Where(m => m.Status == MonitorStatus.IsOk);
MonitorStatus initialStatus;
string prefix = "0:";
if (InError.Count() > 0)
{
initialStatus = MonitorStatus.InError;
prefix = "3:";
}
else if (InWarning.Count() > 0)
{
initialStatus = MonitorStatus.InWarning;
prefix = "2:";
}
else if (InWarning.Count() > 0)
initialStatus = MonitorStatus.IsOk;
else
initialStatus = MonitorStatus.StatusUnknown;
// Build the error message string
if (InError.Count() > 0 || InWarning.Count() > 0)
{
StringBuilder sb = new StringBuilder(prefix);
if (InError.Count() > 0)
{
// Do string splits and joins
sb.Append(string.Format("{0} Errors:", InError.Count()));
foreach (var mon in InError)
sb.Append(string.Format("{0}, ", mon.Parent.Key));
}
if (InWarning.Count() > 0)
{
sb.Append(string.Format("{0} Warnings:", InWarning.Count()));
foreach (var mon in InWarning)
sb.Append(string.Format("{0}, ", mon.Parent.Key));
}
Message = sb.ToString();
}
// Want to fire even if status doesn't change because the message may.
Status = initialStatus;
OnStatusChange(initialStatus, Message);
}
void mon_StatusChange(object sender, MonitorStatusChangeEventArgs e)
{
ProcessStatuses();
}
public void Stop()
{
throw new NotImplementedException();
}
#endregion
public void AddMonitor(IStatusMonitor monitor)
{
if (!Monitors.Contains(monitor))
Monitors.Add(monitor);
}
protected void OnStatusChange(MonitorStatus status, string message)
{
var handler = StatusChange;
if (handler != null)
handler(this, new MonitorStatusChangeEventArgs(status, message));
}
}
}

View File

@@ -1,225 +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>{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>PepperDash.Essentials.Core</RootNamespace>
<AssemblyName>PepperDash_Essentials_Core</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.DM, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.DM.dll</HintPath>
</Reference>
<Reference Include="Crestron.SimplSharpPro.EthernetCommunications, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.EthernetCommunications.dll</HintPath>
</Reference>
<Reference Include="Crestron.SimplSharpPro.Remotes, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Remotes.dll</HintPath>
</Reference>
<Reference Include="Crestron.SimplSharpPro.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.UI.dll</HintPath>
</Reference>
<Reference Include="mscorlib" />
<Reference Include="PepperDash_Core, Version=1.0.0.16459, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\PepperDash.Core\Pepperdash Core\Pepperdash Core\bin\PepperDash_Core.dll</HintPath>
</Reference>
<Reference Include="SimplSharpCustomAttributesInterface, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpCustomAttributesInterface.dll</HintPath>
<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.0.7, 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="Comm and IR\CommFactory.cs" />
<Compile Include="Comm and IR\CommunicationExtras.cs" />
<Compile Include="Comm and IR\REMOVE ComPortConfig.cs" />
<Compile Include="Comm and IR\ComSpecJsonConverter.cs" />
<Compile Include="Comm and IR\ConsoleCommMockDevice.cs" />
<Compile Include="Comm and IR\IRPortHelper.cs" />
<Compile Include="Config\BasicConfig.cs" />
<Compile Include="Config\ConfigPropertiesHelpers.cs" />
<Compile Include="Config\InfoConfig.cs" />
<Compile Include="Config\DeviceConfig.cs" />
<Compile Include="Constants\CommonCues.cs" />
<Compile Include="Devices\DisplayUiConstants.cs" />
<Compile Include="Devices\REMOVE DeviceConfig.cs" />
<Compile Include="Devices\DeviceJsonApi.cs" />
<Compile Include="Devices\SourceListItem.cs" />
<Compile Include="DeviceTypeInterfaces\IDisplayBasic.cs" />
<Compile Include="DeviceTypeInterfaces\IDumbSource.cs" />
<Compile Include="DeviceTypeInterfaces\IWarmingCooling.cs" />
<Compile Include="DeviceTypeInterfaces\IDiscPlayerControls.cs" />
<Compile Include="DeviceTypeInterfaces\IPower.cs" />
<Compile Include="DeviceTypeInterfaces\IUiDisplayInfo.cs" />
<Compile Include="DeviceTypeInterfaces\ISetTopBoxControls.cs" />
<Compile Include="DeviceTypeInterfaces\IChannel.cs" />
<Compile Include="DeviceTypeInterfaces\IColorFunctions.cs" />
<Compile Include="DeviceTypeInterfaces\IDPad.cs" />
<Compile Include="DeviceTypeInterfaces\IDvr.cs" />
<Compile Include="DeviceTypeInterfaces\Template.cs" />
<Compile Include="DeviceTypeInterfaces\ITransport.cs" />
<Compile Include="Devices\GenericMonitoredTcpDevice.cs" />
<Compile Include="DeviceTypeInterfaces\INumeric.cs" />
<Compile Include="Devices\IVolumeAndAudioInterfaces.cs" />
<Compile Include="Display\BasicIrDisplay.cs" />
<Compile Include="Feedbacks\BoolFeedbackOneShot.cs" />
<Compile Include="Routing\ICardPortsDevice.cs" />
<Compile Include="InUseTracking\IInUseTracking.cs" />
<Compile Include="InUseTracking\InUseTracking.cs" />
<Compile Include="Routing\IRoutingInputsExtensions.cs" />
<Compile Include="Monitoring\StatusMonitorCollection.cs" />
<Compile Include="Monitoring\CrestronGenericBaseCommunicationMonitor.cs" />
<Compile Include="Monitoring\StatusMonitorBase.cs" />
<Compile Include="Monitoring\Interfaces and things.cs" />
<Compile Include="Monitoring\GenericCommunicationMonitor.cs" />
<Compile Include="Devices\REPLACE IrSetTopBoxBase.cs" />
<Compile Include="Devices\REPLACE IrDvdBase.cs" />
<Compile Include="Devices\NewInterfaces.cs" />
<Compile Include="Devices\REPLACE DvdDeviceBase.cs" />
<Compile Include="Devices\IAttachVideoStatusExtensions.cs" />
<Compile Include="Devices\IHasFeedbacks.cs" />
<Compile Include="Devices\SmartObjectBaseTypes.cs" />
<Compile Include="Devices\PresentationDeviceType.cs" />
<Compile Include="Display\DELETE IRDisplayBase.cs" />
<Compile Include="Display\MockDisplay.cs" />
<Compile Include="Ethernet\EthernetStatistics.cs" />
<Compile Include="Fusion\MOVED FusionSystemController.cs" />
<Compile Include="Global.cs" />
<Compile Include="License\EssentialsLicenseManager.cs" />
<Compile Include="Feedbacks\BoolOutputLogicals.cs" />
<Compile Include="Presets\Interfaces.cs" />
<Compile Include="Presets\PresetsListSubpageReferenceListItem.cs" />
<Compile Include="Presets\DevicePresetsView.cs" />
<Compile Include="Presets\PresetChannel.cs" />
<Compile Include="Presets\DevicePresets.cs" />
<Compile Include="Routing\RoutingInterfaces.cs" />
<Compile Include="Routing\RoutingPort.cs" />
<Compile Include="Routing\RoutingPortCollection.cs" />
<Compile Include="Feedbacks\BoolFeedbackPulseExtender.cs" />
<Compile Include="Routing\RoutingPortNames.cs" />
<Compile Include="Routing\TieLineConfig.cs" />
<Compile Include="SmartObjects\SmartObjectNumeric.cs" />
<Compile Include="SmartObjects\SmartObjectDynamicList.cs" />
<Compile Include="SmartObjects\SmartObjectDPad.cs" />
<Compile Include="SmartObjects\SmartObjectHelper.cs" />
<Compile Include="SmartObjects\SmartObjectHelperBase.cs" />
<Compile Include="Routing\TieLine.cs" />
<Compile Include="Touchpanels\MOVED LargeTouchpanelControllerBase.cs" />
<Compile Include="Touchpanels\TriListExtensions.cs" />
<Compile Include="Touchpanels\MOVED UIControllers\DevicePageControllerBase.cs" />
<Compile Include="UI PageManagers\BlurayPageManager.cs" />
<Compile Include="UI PageManagers\SetTopBoxThreePanelPageManager.cs" />
<Compile Include="UI PageManagers\SinglePageManager.cs" />
<Compile Include="UI PageManagers\PageManager.cs" />
<Compile Include="UI PageManagers\SetTopBoxTwoPanelPageManager.cs" />
<Compile Include="VideoStatus\VideoStatusOutputs.cs" />
<Compile Include="VideoStatus\VideoStatusCues.cs" />
<Compile Include="Cues and DevAction\Cues.cs" />
<Compile Include="Comm and IR\ComPortController.cs" />
<Compile Include="Crestron\CrestronGenericBaseDevice.cs" />
<Compile Include="Debug\Debug.cs" />
<Compile Include="DeviceControlsParentInterfaces\IPresentationSource.cs" />
<Compile Include="Devices\REMOVE DefaultDevice.cs" />
<Compile Include="Devices\MOVED TO CORE Device.cs" />
<Compile Include="Devices\DeviceManager.cs" />
<Compile Include="Devices\IrOutputPortController.cs" />
<Compile Include="Display\DisplayBase.cs" />
<Compile Include="Feedbacks\Feedbacks.cs" />
<Compile Include="Room\Room.cs" />
<Compile Include="Room\RoomCues.cs" />
<Compile Include="Room\MOVED RoomEventArgs.cs" />
<Compile Include="SubpageReferencList\SourceListSubpageReferenceList.cs" />
<Compile Include="Touchpanels\ModalDialog.cs" />
<Compile Include="Touchpanels\SmartGraphicsTouchpanelControllerBase.cs" />
<Compile Include="TriListBridges\HandlerBridge.cs" />
<Compile Include="Devices\FIND HOMES Interfaces.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SigHelper.cs" />
<Compile Include="REMOVE SigId.cs" />
<Compile Include="SubpageReferencList\DeviceStatusListController.cs" />
<Compile Include="SubpageReferencList\SubpageReferenceList.cs" />
<Compile Include="SubpageReferencList\SubpageReferenceListItem.cs" />
<None Include="app.config" />
<None Include="Properties\ControlSystem.cfg" />
</ItemGroup>
<ItemGroup>
<Folder Include="bin\" />
</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,178 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
//using SSMono.IO;
namespace PepperDash.Essentials.Core.Presets
{
/// <summary>
/// Class that represents the model behind presets display
/// </summary>
public class DevicePresetsModel : Device
{
public event EventHandler PresetsLoaded;
public int PulseTime { get; set; }
public int DigitSpacingMS { get; set; }
public bool PresetsAreLoaded { get; private set; }
public List<PresetChannel> PresetsList { get { return _PresetsList.ToList(); } }
List<PresetChannel> _PresetsList;
public int Count { get { return PresetsList != null ? PresetsList.Count : 0; } }
public bool UseLocalImageStorage { get; set; }
public string ImagesLocalHostPrefix { get; set; }
public string ImagesPathPrefix { get; set; }
public string ListPathPrefix { get; set; }
/// <summary>
/// The methods on the STB device to call when dialing
/// </summary>
Dictionary<char, Action<bool>> DialFunctions;
Action<bool> EnterFunction;
bool DialIsRunning;
string FilePath;
bool InitSuccess;
//SSMono.IO.FileSystemWatcher ListWatcher;
public DevicePresetsModel(string key, ISetTopBoxNumericKeypad setTopBox, string fileName)
: base(key)
{
PulseTime = 150;
DigitSpacingMS = 150;
try
{
// Grab the digit functions from the device
// If any fail, the whole thing fails peacefully
DialFunctions = new Dictionary<char, Action<bool>>(10)
{
{ '1', setTopBox.Digit1 },
{ '2', setTopBox.Digit2 },
{ '3', setTopBox.Digit3 },
{ '4', setTopBox.Digit4 },
{ '5', setTopBox.Digit5 },
{ '6', setTopBox.Digit6 },
{ '7', setTopBox.Digit7 },
{ '8', setTopBox.Digit8 },
{ '9', setTopBox.Digit9 },
{ '0', setTopBox.Digit0 },
{ '-', setTopBox.Dash }
};
}
catch
{
Debug.Console(0, "DevicePresets '{0}', not attached to INumericKeypad device. Ignoring", key);
DialFunctions = null;
return;
}
EnterFunction = setTopBox.KeypadEnter;
UseLocalImageStorage = true;
ImagesLocalHostPrefix = "http://" + CrestronEthernetHelper.GetEthernetParameter(
CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_ADDRESS,0);
ImagesPathPrefix = @"/presets/images.zip/";
ListPathPrefix = @"/html/presets/lists/";
SetFileName(fileName);
//ListWatcher = new FileSystemWatcher(@"\HTML\presets\lists");
//ListWatcher.NotifyFilter = NotifyFilters.LastWrite;
//ListWatcher.EnableRaisingEvents = true;
//ListWatcher.Changed += ListWatcher_Changed;
InitSuccess = true;
}
public void SetFileName(string path)
{
FilePath = ListPathPrefix + path;
LoadChannels();
}
public void LoadChannels()
{
PresetsAreLoaded = false;
try
{
var pl = JsonConvert.DeserializeObject<PresetsList>(Crestron.SimplSharp.CrestronIO.File.ReadToEnd(FilePath, Encoding.ASCII));
Name = pl.Name;
_PresetsList = pl.Channels;
}
catch (Exception e)
{
Debug.Console(2, this, "LoadChannels: Error reading presets file. These presets will be empty:\r '{0}'\r Error:{1}", FilePath, e.Message);
// Just save a default empty list
_PresetsList = new List<PresetChannel>();
}
PresetsAreLoaded = true;
var handler = PresetsLoaded;
if (handler != null)
handler(this, EventArgs.Empty);
}
public void Dial(int presetNum)
{
if (presetNum <= _PresetsList.Count)
Dial(_PresetsList[presetNum - 1].Channel);
}
public void Dial(string chanNum)
{
if (DialIsRunning || !InitSuccess) return;
if (DialFunctions == null)
{
Debug.Console(1, "DevicePresets '{0}', not attached to keypad device. Ignoring channel", Key);
return;
}
DialIsRunning = true;
CrestronInvoke.BeginInvoke(o =>
{
foreach (var c in chanNum.ToCharArray())
{
if (DialFunctions.ContainsKey(c))
Pulse(DialFunctions[c]);
CrestronEnvironment.Sleep(DigitSpacingMS);
}
if (EnterFunction != null)
Pulse(EnterFunction);
DialIsRunning = false;
});
}
void Pulse(Action<bool> act)
{
act(true);
CrestronEnvironment.Sleep(PulseTime);
act(false);
}
/// <summary>
/// Event handler for filesystem watcher. When directory changes, this is called
/// </summary>
//void ListWatcher_Changed(object sender, FileSystemEventArgs e)
//{
// Debug.Console(1, this, "folder modified: {0}", e.FullPath);
// if (e.FullPath.Equals(FilePath, StringComparison.OrdinalIgnoreCase))
// {
// Debug.Console(1, this, "File changed: {0}", e.ChangeType);
// LoadChannels();
// }
//}
}
}

View File

@@ -1,60 +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.Core.Presets
{
public class DevicePresetsView
{
public bool ShowNumbers { get; set; }
public bool ShowName { get; set; }
public bool ShowIcon { get; set; }
public SubpageReferenceList SRL { get; private set; }
public DevicePresetsModel Model { get; private set; }
public DevicePresetsView(BasicTriListWithSmartObject tl, DevicePresetsModel model)
{
if (model == null)
{
throw new ArgumentNullException("model", "DevicePresetsView Cannot be instantiated with null model");
}
ShowIcon = true;
ShowName = true;
Model = model;
SRL = new SubpageReferenceList(tl, 10012, 3, 0, 4);
Model.PresetsLoaded += new EventHandler(Model_PresetsLoaded);
}
public void Attach()
{
if (Model.PresetsAreLoaded)
{
uint index = 1;
foreach (var p in Model.PresetsList)
{
SRL.AddItem(new PresetsListSubpageReferenceListItem(p, index, SRL, this));
index++;
}
SRL.Count = (ushort)Model.PresetsList.Count;
}
}
public void Detach()
{
SRL.Clear();
}
void Model_PresetsLoaded(object sender, EventArgs e)
{
Detach();
Attach();
}
}
}

View File

@@ -1,22 +0,0 @@
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using Crestron.SimplSharp;
//namespace PepperDash.Essentials.Core
//{
// public interface IPresetsFileChanged : IKeyed
// {
// public event EventHandler<PresetsFileChangeEventArgs> PresetsFileChanged;
// }
// public class PresetsFileChangeEventArgs : EventArgs
// {
// public string FilePath { get; private set; }
// public PresetsFileChangeEventArgs(string filePath)
// {
// FilePath = filePath;
// }
// }
//}

View File

@@ -1,28 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Newtonsoft.Json;
namespace PepperDash.Essentials.Core.Presets
{
public class PresetChannel
{
[JsonProperty(Required = Required.Always)]
public string Name { get; set; }
[JsonProperty(Required = Required.Always)]
public string IconUrl { get; set; }
[JsonProperty(Required = Required.Always)]
public string Channel { get; set; }
}
public class PresetsList
{
[JsonProperty(Required=Required.Always)]
public string Name { get; set; }
[JsonProperty(Required = Required.Always)]
public List<PresetChannel> Channels { get; set; }
}
}

View File

@@ -1,49 +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.Presets
{
public class PresetsListSubpageReferenceListItem : SubpageReferenceListItem
{
DevicePresetsView View;
PresetChannel Channel;
public PresetsListSubpageReferenceListItem(PresetChannel chan, uint index,
SubpageReferenceList owner, DevicePresetsView view)
: base(index, owner)
{
View = view;
Channel = chan;
owner.GetBoolFeedbackSig(index, 1).UserObject = new Action<bool>(b => { if (!b) view.Model.Dial((int)index); });
Refresh();
}
public override void Clear()
{
Owner.GetBoolFeedbackSig(Index, 1).UserObject = null;
Owner.StringInputSig(Index, 1).StringValue = "";
Owner.StringInputSig(Index, 2).StringValue = "";
Owner.StringInputSig(Index, 3).StringValue = "";
}
public override void Refresh()
{
var name = View.ShowName ? Channel.Name : "";
Owner.StringInputSig(Index, 1).StringValue = name;
var chan = View.ShowNumbers ? Channel.Channel : "";
Owner.StringInputSig(Index, 2).StringValue = chan;
var url = View.Model.ImagesLocalHostPrefix + View.Model.ImagesPathPrefix + Channel.IconUrl;
Debug.Console(2, "icon url={0}", url);
var icon = View.ShowIcon ? url : "";
Owner.StringInputSig(Index, 3).StringValue = icon;
}
}
}

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,37 +0,0 @@
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using Crestron.SimplSharpPro;
//namespace PepperDash.Essentials.Core
//{
// public class SigId
// {
// public uint Number { get; private set; }
// public eSigType Type { get; private set; }
// public SigId(eSigType type, uint number)
// {
// Type = type;
// Number = number;
// }
// public override bool Equals(object id)
// {
// if (id is SigId)
// {
// var sigId = id as SigId;
// return this.Number == sigId.Number && this.Type == sigId.Type;
// }
// else
// return base.Equals(id);
// }
// public override int GetHashCode()
// {
// return base.GetHashCode();
// }
// }
//}

View File

@@ -1,16 +0,0 @@
<ProgramInfo>
<RequiredInfo>
<FriendlyName>SSMonoIOLibrary</FriendlyName>
<SystemName>SSMonoIOLibrary</SystemName>
<EntryPoint>SSMonoIOLibrary</EntryPoint>
<MinFirmwareVersion>1.007.0017</MinFirmwareVersion>
<ProgramTool>SIMPL# Plugin</ProgramTool>
<DesignToolId>5</DesignToolId>
<ProgramToolId>5</ProgramToolId>
<ArchiveName />
</RequiredInfo>
<OptionalInfo>
<CompiledOn>4/6/2016 7:49:24 AM</CompiledOn>
<CompilerRev>1.0.0.14081</CompilerRev>
</OptionalInfo>
</ProgramInfo>

View File

@@ -1,18 +0,0 @@
MainAssembly=SSMonoIOLibrary.dll:6c69af117dca3f74ebca99f7a0e3181c
MainAssemblyMinFirmwareVersion=1.007.0017
ü
DependencySource=SimplSharpCustomAttributesInterface.dll:9c4b4d4c519b655af90016edca2d66b9
DependencyPath=SSMonoIOLibrary.clz:SimplSharpCustomAttributesInterface.dll
DependencyMainAssembly=SimplSharpCustomAttributesInterface.dll:9c4b4d4c519b655af90016edca2d66b9
ü
DependencySource=SimplSharpHelperInterface.dll:aed72eb0e19559a3f56708be76445dcd
DependencyPath=SSMonoIOLibrary.clz:SimplSharpHelperInterface.dll
DependencyMainAssembly=SimplSharpHelperInterface.dll:aed72eb0e19559a3f56708be76445dcd
ü
DependencySource=SimplSharpReflectionInterface.dll:e3ff8edbba84ccd7155b9984e67488b2
DependencyPath=SSMonoIOLibrary.clz:SimplSharpReflectionInterface.dll
DependencyMainAssembly=SimplSharpReflectionInterface.dll:e3ff8edbba84ccd7155b9984e67488b2
ü
DependencySource=SSharpCrestronExtensionsLibrary.dll:655a49edee523f150d1c03bcb5db87d0
DependencyPath=SSMonoIOLibrary.clz:SSharpCrestronExtensionsLibrary.dll
DependencyMainAssembly=SSharpCrestronExtensionsLibrary.dll:655a49edee523f150d1c03bcb5db87d0

View File

@@ -1,16 +0,0 @@
<ProgramInfo>
<RequiredInfo>
<FriendlyName>SSMonoProTaskLibrary</FriendlyName>
<SystemName>SSMonoProTaskLibrary</SystemName>
<EntryPoint>SSMonoProTaskLibrary</EntryPoint>
<MinFirmwareVersion>1.009.0029</MinFirmwareVersion>
<ProgramTool>SIMPL# Plugin</ProgramTool>
<DesignToolId>5</DesignToolId>
<ProgramToolId>5</ProgramToolId>
<ArchiveName />
</RequiredInfo>
<OptionalInfo>
<CompiledOn>4/6/2016 7:55:41 AM</CompiledOn>
<CompilerRev>1.0.0.14269</CompilerRev>
</OptionalInfo>
</ProgramInfo>

View File

@@ -1,30 +0,0 @@
MainAssembly=SSMonoProTaskLibrary.dll:5d3a301400516bd812bf1566c72ccbf2
MainAssemblyMinFirmwareVersion=1.009.0029
ü
DependencySource=SimplSharpReflectionInterface.dll:e3ff8edbba84ccd7155b9984e67488b2
DependencyPath=SSMonoProTaskLibrary.cplz:SimplSharpReflectionInterface.dll
DependencyMainAssembly=SimplSharpReflectionInterface.dll:e3ff8edbba84ccd7155b9984e67488b2
ü
DependencySource=SSharpCrestronExtensionsLibrary.dll:776d0247d8d42164c46c7cc1dfadbd03
DependencyPath=SSMonoProTaskLibrary.cplz:SSharpCrestronExtensionsLibrary.dll
DependencyMainAssembly=SSharpCrestronExtensionsLibrary.dll:776d0247d8d42164c46c7cc1dfadbd03
ü
DependencySource=SSMonoConcurrentCollectionsLibrary.dll:b0afcd989b081899c9eb29f9e4c8b799
DependencyPath=SSMonoProTaskLibrary.cplz:SSMonoConcurrentCollectionsLibrary.dll
DependencyMainAssembly=SSMonoConcurrentCollectionsLibrary.dll:b0afcd989b081899c9eb29f9e4c8b799
ü
DependencySource=SSMonoProConcurrentCollectionsLibrary.dll:8b718ce29f938bbf9cb5b8fc2d89332f
DependencyPath=SSMonoProTaskLibrary.cplz:SSMonoProConcurrentCollectionsLibrary.dll
DependencyMainAssembly=SSMonoProConcurrentCollectionsLibrary.dll:8b718ce29f938bbf9cb5b8fc2d89332f
ü
DependencySource=SSMonoSupportLibrary.dll:59362515f2c1d61583b2e40793987917
DependencyPath=SSMonoProTaskLibrary.cplz:SSMonoSupportLibrary.dll
DependencyMainAssembly=SSMonoSupportLibrary.dll:59362515f2c1d61583b2e40793987917
ü
DependencySource=SSMonoThreadingLibrary.dll:ea2ae2e1d9c425236f39de9192591062
DependencyPath=SSMonoProTaskLibrary.cplz:SSMonoThreadingLibrary.dll
DependencyMainAssembly=SSMonoThreadingLibrary.dll:ea2ae2e1d9c425236f39de9192591062
ü
DependencySource=SSMonoTupleLibrary.dll:2a3b419fff4199838079879053fcb41d
DependencyPath=SSMonoProTaskLibrary.cplz:SSMonoTupleLibrary.dll
DependencyMainAssembly=SSMonoTupleLibrary.dll:2a3b419fff4199838079879053fcb41d

View File

@@ -1,41 +0,0 @@
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using Crestron.SimplSharp;
//namespace PepperDash.Essentials.Core
//{
// public class EssentialsRoomSourceChangeEventArgs : EventArgs
// {
// public EssentialsRoom Room { get; private set; }
// public IPresentationSource OldSource { get; private set; }
// public IPresentationSource NewSource { get; private set; }
// public EssentialsRoomSourceChangeEventArgs(EssentialsRoom room,
// IPresentationSource oldSource, IPresentationSource 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,56 +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
{
//***************************************************************************************************
public abstract class Room : Device, IHasFeedback
{
public abstract BoolFeedback RoomIsOnFeedback { get; protected set; }
public abstract BoolFeedback IsCoolingDownFeedback { get; protected set; }
public abstract BoolFeedback IsWarmingUpFeedback { get; protected set; }
// In concrete classes, these should be computed from the relevant devices
public virtual uint CooldownTime { get { return 10000; } }
public virtual uint WarmupTime { get { return 5000; } }
public string Description { get; set; }
public string HelpMessage { get; set; }
public Room(string key, string name)
: base(key, name)
{
Description = "";
HelpMessage = "";
}
public virtual void RoomOn() { }
public virtual void RoomOff() { }
#region IDeviceWithOutputs Members
public virtual List<Feedback> Feedbacks
{
get
{
return new List<Feedback>
{
RoomIsOnFeedback,
IsCoolingDownFeedback,
IsWarmingUpFeedback
};
}
}
#endregion
}
}

View File

@@ -1,61 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials
{
public static class RoomCue
{
// Commands/
//bools
public static readonly Cue RoomOnToggle = Cue.BoolCue("RoomOnToggle", 2001);
public static readonly Cue RoomOn = Cue.BoolCue("RoomOn", 2002);
public static readonly Cue RoomOff = Cue.BoolCue("RoomOff", 2003);
public static readonly Cue VolumeUp = Cue.BoolCue("VolumeUp", 2011);
public static readonly Cue VolumeDown = Cue.BoolCue("VolumeDown", 2012);
public static readonly Cue VolumeDefault = Cue.BoolCue("VolumeDefault", 2013);
public static readonly Cue MuteToggle = Cue.BoolCue("MuteToggle", 2014);
public static readonly Cue MuteOn = Cue.BoolCue("MuteOn", 2015);
public static readonly Cue MuteOff = Cue.BoolCue("MuteOff", 2016);
//ushorts
public static readonly Cue SelectSourceByNumber = Cue.UShortCue("SelectSourceByNumber", 2001);
public static readonly Cue VolumeLevel = Cue.UShortCue("VolumeLevel", 2011);
public static readonly Cue VolumeLevelPercent = Cue.UShortCue("VolumeLevelPercent", 2012);
//strings
public static readonly Cue SelectSourceByKey = Cue.StringCue("SelectSourceByKey", 2001);
// Outputs
//Bools
public static readonly Cue RoomIsOn = Cue.BoolCue("RoomIsOn", 2002);
public static readonly Cue RoomIsOnStandby = Cue.BoolCue("RoomIsOnStandby", 2003);
public static readonly Cue RoomIsWarmingUp = Cue.BoolCue("RoomIsWarmingUp", 2004);
public static readonly Cue RoomIsCoolingDown = Cue.BoolCue("RoomIsCoolingDown", 2005);
public static readonly Cue RoomIsOccupied = Cue.BoolCue("RoomIsOccupied", 2006);
//Ushorts
public static readonly Cue SourcesCount = Cue.UShortCue("SourcesCount", 2001);
public static readonly Cue CurrentSourceNumber = Cue.UShortCue("CurrentSourceNumber", 2002);
public static readonly Cue CurrentSourceType = Cue.UShortCue("CurrentSourceType", 2003);
//Strings
public static readonly Cue CurrentSourceKey = Cue.StringCue("CurrentSourceKey", 2001);
public static readonly Cue CurrentSourceName = Cue.StringCue("CurrentSourceName", 2002);
public static readonly Cue VolumeLevelText = Cue.StringCue("VolumeLevelText", 2012);
public static readonly Cue Key = Cue.StringCue("RoomKey", 2021);
public static readonly Cue Name = Cue.StringCue("RoomName", 2022);
public static readonly Cue Description = Cue.StringCue("Description", 2023);
public static readonly Cue HelpMessage = Cue.StringCue("HelpMessage", 2024);
//Special
public static readonly Cue Source = new Cue("Source", 0, eCueType.Other);
}
}

View File

@@ -1,300 +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 PepperDash.Core;
namespace PepperDash.Essentials.Core
{
/// <summary>
///
/// </summary>
public static class IRoutingInputsExtensions
{
/// <summary>
/// Gets any existing route for a destination, clears it, and then
/// </summary>
public static void ReleaseAndMakeRoute(this IRoutingInputs destination, IRoutingOutputs source, eRoutingSignalType signalType)
{
var sw = new Stopwatch();
sw.Start();
destination.ReleaseRoute();
if (source == null) return;
var newRoute = destination.GetRouteToSource(source, signalType);
if (newRoute == null) return;
RouteDescriptorCollection.DefaultCollection.AddRouteDescriptor(newRoute);
Debug.Console(2, destination, "Executing new route");
newRoute.ExecuteRoutes();
sw.Stop();
Debug.Console(2, destination, "Route took {0} ms", sw.ElapsedMilliseconds);
}
/// <summary>
/// Will release the existing route on the destination
/// </summary>
/// <param name="destination"></param>
/// <param name="signalType"></param>
public static void ReleaseRoute(this IRoutingInputs destination)
{
var current = RouteDescriptorCollection.DefaultCollection.RemoveRouteDescriptor(destination);
if (current != null)
{
Debug.Console(2, destination, "Releasing current route: {0}", current.Source.Key);
current.ReleaseRoutes();
}
}
/// <summary>
///
/// </summary>
/// <param name="device"></param>
/// <param name="targetSource"></param>
/// <param name="signalType"></param>
/// <returns></returns>
public static RouteDescriptor GetRouteToSource(this IRoutingInputs destination, IRoutingOutputs source, eRoutingSignalType signalType)
{
var routeTable = new RouteDescriptor (source, destination, signalType);
Debug.Console(0, destination, "Attempting to build source route from {0}***", source.Key);
if (!destination.GetRouteToSource(source, null, null, signalType, 0, routeTable))
routeTable = null;
Debug.Console(0, destination, "Route{0} discovered ***", routeTable == null ? " NOT" : "");
return routeTable;
}
/// <summary>
/// The recursive part of this. Will stop on each device, search its inputs for the
/// desired source and if not found, invoke this function for the each input port
/// hoping to find the source.
/// </summary>
/// <param name="destination"></param>
/// <param name="source"></param>
/// <param name="onSuccessOutputPort"></param>
/// <param name="alreadyCheckedDevices"></param>
/// <param name="signalType"></param>
/// <param name="cycle"></param>
/// <param name="routeTable"></param>
/// <returns>true if source is hit</returns>
static bool GetRouteToSource(this IRoutingInputs destination, IRoutingOutputs source,
RoutingOutputPort onSuccessOutputPort, List<IRoutingInputsOutputs> alreadyCheckedDevices,
eRoutingSignalType signalType, int cycle, RouteDescriptor routeTable)
{
cycle++;
Debug.Console(0, destination, "SelectInput-cycle {1}. Finding {2} route back to {0}", source.Key, cycle, signalType);
var destDevInputTies = TieLineCollection.Default.Where(t =>
t.DestinationPort.ParentDevice == destination && (t.Type == signalType || t.Type == eRoutingSignalType.AudioVideo));
// find a direct tie
var directTie = destDevInputTies.FirstOrDefault(
t => !(t.SourcePort.ParentDevice is IRoutingInputsOutputs)
&& t.DestinationPort.ParentDevice == destination
&& t.SourcePort.ParentDevice == source);
RoutingInputPort inputPort = null;
if (directTie != null) // Found a tie directly to the source
{
Debug.Console(0, destination, "Found direct tie to {0}**", source.Key);
inputPort = directTie.DestinationPort;
}
else // no direct-connect. Walk back devices.
{
Debug.Console(0, destination, "is not directly connected to {0}. Walking down tie lines", source.Key);
// No direct tie? Run back out on the inputs' attached devices...
// Only the ones that are routing devices
var attachedMidpoints = destDevInputTies.Where(t => t.SourcePort.ParentDevice is IRoutingInputsOutputs);
foreach (var inputTieToTry in attachedMidpoints)
{
Debug.Console(0, destination, "Trying to find route on {0}", inputTieToTry.SourcePort.ParentDevice.Key);
var upstreamDeviceOutputPort = inputTieToTry.SourcePort;
var upstreamRoutingDevice = upstreamDeviceOutputPort.ParentDevice as IRoutingInputsOutputs;
// Check if this previous device has already been walked
if (!(alreadyCheckedDevices != null && alreadyCheckedDevices.Contains(upstreamRoutingDevice)))
{
// haven't seen this device yet. Do it. Pass the output port to the next
// level to enable switching on success
var upstreamRoutingSuccess = upstreamRoutingDevice.GetRouteToSource(source, upstreamDeviceOutputPort,
alreadyCheckedDevices, signalType, cycle, routeTable);
if (upstreamRoutingSuccess)
{
Debug.Console(0, destination, "Upstream device route found");
inputPort = inputTieToTry.DestinationPort;
break; // Stop looping the inputs in this cycle
}
}
}
}
// we have a route on corresponding inputPort. *** Do the route ***
if (inputPort != null)
{
Debug.Console(0, destination, "adding route:");
if (onSuccessOutputPort == null)
{
// it's a sink device
routeTable.Routes.Add(new RouteSwitchDescriptor(inputPort));
}
else if (destination is IRouting)
{
routeTable.Routes.Add(new RouteSwitchDescriptor (onSuccessOutputPort, inputPort));
}
else // device is merely IRoutingInputOutputs
Debug.Console(0, destination, " No routing. Passthrough device");
Debug.Console(0, destination, "Exiting cycle {0}", cycle);
return true;
}
if(alreadyCheckedDevices == null)
alreadyCheckedDevices = new List<IRoutingInputsOutputs>();
alreadyCheckedDevices.Add(destination as IRoutingInputsOutputs);
Debug.Console(0, destination, "No route found to {0}", source.Key);
return false;
}
}
// MOVE MOVE MOVE MOVE MOVE MOVE MOVE MOVE MOVE MOVE MOVE MOVE MOVE MOVE MOVE MOVE MOVE MOVE MOVE MOVE MOVE
/// <summary>
/// A collection of routes - typically the global DefaultCollection is used
/// </summary>
public class RouteDescriptorCollection
{
public static RouteDescriptorCollection DefaultCollection
{
get
{
if (_DefaultCollection == null)
_DefaultCollection = new RouteDescriptorCollection();
return _DefaultCollection;
}
}
static RouteDescriptorCollection _DefaultCollection;
List<RouteDescriptor> RouteDescriptors = new List<RouteDescriptor>();
public void AddRouteDescriptor(RouteDescriptor descriptor)
{
if (RouteDescriptors.Any(t => t.Destination == descriptor.Destination))
{
Debug.Console(1, descriptor.Destination,
"Route to [{0}] already exists in global routes table", descriptor.Source.Key);
return;
}
RouteDescriptors.Add(descriptor);
}
public RouteDescriptor GetRouteDescriptorForDestination(IRoutingInputs destination)
{
return RouteDescriptors.FirstOrDefault(rd => rd.Destination == destination);
}
/// <summary>
/// Returns the RouteDescriptor for a given destination and removes it from collection.
/// Returns null if no route with the provided destination exists.
/// </summary>
public RouteDescriptor RemoveRouteDescriptor(IRoutingInputs destination)
{
var descr = GetRouteDescriptorForDestination(destination);
if (descr != null)
RouteDescriptors.Remove(descr);
return descr;
}
}
/// <summary>
/// Represents an collection of individual route steps between Source and Destination
/// </summary>
public class RouteDescriptor
{
public IRoutingInputs Destination { get; private set; }
public IRoutingOutputs Source { get; private set; }
public eRoutingSignalType SignalType { get; private set; }
public List<RouteSwitchDescriptor> Routes { get; private set; }
public RouteDescriptor(IRoutingOutputs source, IRoutingInputs destination, eRoutingSignalType signalType)
{
Destination = destination;
Source = source;
SignalType = signalType;
Routes = new List<RouteSwitchDescriptor>();
}
public void ExecuteRoutes()
{
foreach (var route in Routes)
{
Debug.Console(2, route.ToString());
if (route.SwitchingDevice is IRoutingSinkWithSwitching)
(route.SwitchingDevice as IRoutingSinkWithSwitching).ExecuteSwitch(route.InputPort.Selector);
else if (route.SwitchingDevice is IRouting)
{
(route.SwitchingDevice as IRouting).ExecuteSwitch(route.InputPort.Selector, route.OutputPort.Selector, SignalType);
route.OutputPort.InUseTracker.AddUser(Destination, "destination");
}
}
}
public void ReleaseRoutes()
{
foreach (var route in Routes)
{
if (route.SwitchingDevice is IRouting)
{
// Pull the route from the port. Whatever is watching the output's in use tracker is
// responsible for responding appropriately.
route.OutputPort.InUseTracker.RemoveUser(Destination, "destination");
}
}
}
public override string ToString()
{
var routesText = Routes.Select(r => r.ToString()).ToArray();
return string.Format("Route table from {0} to {1}:\r{2}", Source.Key, Destination.Key, string.Join("\r", routesText));
}
}
/// <summary>
/// Represents an individual link for a route
/// </summary>
public class RouteSwitchDescriptor
{
public IRoutingInputs SwitchingDevice { get { return InputPort.ParentDevice; } }
public RoutingOutputPort OutputPort { get; set; }
public RoutingInputPort InputPort { get; set; }
public RouteSwitchDescriptor(RoutingInputPort inputPort)
{
InputPort = inputPort;
}
public RouteSwitchDescriptor(RoutingOutputPort outputPort, RoutingInputPort inputPort)
{
InputPort = inputPort;
OutputPort = outputPort;
}
public override string ToString()
{
if(OutputPort == null) // IRoutingSink
return string.Format("{0} switches to input '{1}'", SwitchingDevice.Key, InputPort.Selector);
return string.Format("{0} switches output '{1}' to input '{2}'", SwitchingDevice.Key, OutputPort.Selector, InputPort.Selector);
}
}
}

View File

@@ -1,57 +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 PepperDash.Core;
namespace PepperDash.Essentials.Core
{
//*******************************************************************************************
// Interfaces
public interface IRoutingInputs : IKeyed
{
RoutingPortCollection<RoutingInputPort> InputPorts { get; }
}
public interface IRoutingOutputs : IKeyed
{
RoutingPortCollection<RoutingOutputPort> OutputPorts { get; }
}
/// <summary>
/// For fixed-source endpoint devices
/// </summary>
public interface IRoutingSinkNoSwitching : IRoutingInputs
{
}
public interface IRoutingSinkWithSwitching : IRoutingSinkNoSwitching
{
//void ClearRoute();
void ExecuteSwitch(object inputSelector);
}
/// <summary>
/// For devices like RMCs, baluns, other devices with no switching.
/// </summary>
public interface IRoutingInputsOutputs : IRoutingInputs, IRoutingOutputs
{
}
public interface IRouting : IRoutingInputsOutputs
{
//void ClearRoute(object outputSelector);
void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType);
}
public interface IRoutingSource : IRoutingOutputs
{
}
}

View File

@@ -1,144 +0,0 @@
using System;
using System.Collections.Generic;
using PepperDash.Core;
namespace PepperDash.Essentials.Core
{
/// <summary>
/// Base class for RoutingInput and Output ports
/// </summary>
public abstract class RoutingPort : IKeyed
{
public string Key { get; private set; }
public eRoutingSignalType Type { get; private set; }
public eRoutingPortConnectionType ConnectionType { get; private set; }
public readonly object Selector;
public bool IsInternal { get; private set; }
public RoutingPort(string key, eRoutingSignalType type, eRoutingPortConnectionType connType, object selector, bool isInternal)
{
Key = key;
Type = type;
ConnectionType = connType;
Selector = selector;
IsInternal = IsInternal;
}
}
public enum eRoutingSignalType
{
Audio,
Video,
AudioVideo
}
public enum eRoutingPortConnectionType
{
None, BackplaneOnly, Hdmi, Rgb, Vga, LineAudio, DigitalAudio, Sdi, Composite, Component, DmCat, DmMmFiber, DmSmFiber
}
/// <summary>
/// Basic RoutingInput with no statuses.
/// </summary>
public class RoutingInputPort : RoutingPort
{
/// <summary>
/// The IRoutingInputs object this lives on
/// </summary>
public IRoutingInputs ParentDevice { get; private set; }
/// <summary>
/// Constructor for a basic RoutingInputPort
/// </summary>
/// <param name="selector">An object used to refer to this port in the IRouting device's ExecuteSwitch method.
/// May be string, number, whatever</param>
/// <param name="parent">The IRoutingInputs object this lives on</param>
public RoutingInputPort(string key, eRoutingSignalType type, eRoutingPortConnectionType connType,
object selector, IRoutingInputs parent)
: this (key, type, connType, selector, parent, false)
{
}
/// <summary>
/// Constructor for a virtual routing input port that lives inside a device. For example
/// the ports that link a DM card to a DM matrix bus
/// </summary>
/// <param name="isInternal">true for internal ports</param>
public RoutingInputPort(string key, eRoutingSignalType type, eRoutingPortConnectionType connType,
object selector, IRoutingInputs parent, bool isInternal)
: base(key, type, connType, selector, isInternal)
{
if (parent == null)
throw new ArgumentNullException("parent");
ParentDevice = parent;
}
}
/// <summary>
/// A RoutingInputPort for devices like DM-TX and DM input cards.
/// Will provide video statistics on connected signals
/// </summary>
public class RoutingInputPortWithVideoStatuses : RoutingInputPort
{
/// <summary>
/// Video statuses attached to this port
/// </summary>
public VideoStatusOutputs VideoStatus { get; private set; }
/// <summary>
/// Constructor
/// </summary>
/// <param name="selector">An object used to refer to this port in the IRouting device's ExecuteSwitch method.
/// May be string, number, whatever</param>
/// <param name="parent">The IRoutingInputs object this lives on</param>
/// <param name="funcs">A VideoStatusFuncsWrapper used to assign the callback funcs that will get
/// the values for the various stats</param>
public RoutingInputPortWithVideoStatuses(string key,
eRoutingSignalType type, eRoutingPortConnectionType connType, object selector,
IRoutingInputs parent, VideoStatusFuncsWrapper funcs) :
base(key, type, connType, selector, parent)
{
VideoStatus = new VideoStatusOutputs(funcs);
}
}
public class RoutingOutputPort : RoutingPort
{
/// <summary>
/// The IRoutingOutputs object this port lives on
/// </summary>
public IRoutingOutputs ParentDevice { get; private set; }
public InUseTracking InUseTracker { get; private set; }
/// <summary>
/// </summary>
/// <param name="selector">An object used to refer to this port in the IRouting device's ExecuteSwitch method.
/// May be string, number, whatever</param>
/// <param name="parent">The IRoutingOutputs object this port lives on</param>
public RoutingOutputPort(string key, eRoutingSignalType type, eRoutingPortConnectionType connType,
object selector, IRoutingOutputs parent)
: this(key, type, connType, selector, parent, false)
{
}
public RoutingOutputPort(string key, eRoutingSignalType type, eRoutingPortConnectionType connType,
object selector, IRoutingOutputs parent, bool isInternal)
: base(key, type, connType, selector, isInternal)
{
if (parent == null)
throw new ArgumentNullException("parent");
ParentDevice = parent;
InUseTracker = new InUseTracking();
}
public override string ToString()
{
return ParentDevice.Key + ":" + Key;
}
}
}

View File

@@ -1,26 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using PepperDash.Core;
namespace PepperDash.Essentials.Core
{
/// <summary>
/// Basically a List , with an indexer to find ports by key name
/// </summary>
public class RoutingPortCollection<T> : List<T> where T: RoutingPort
{
/// <summary>
/// Case-insensitive port lookup linked to ports' keys
/// </summary>
public T this[string key]
{
get
{
return this.FirstOrDefault(i => i.Key.Equals(key, StringComparison.OrdinalIgnoreCase));
}
}
}
}

View File

@@ -1,142 +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 PepperDash.Core;
namespace PepperDash.Essentials.Core
{
public class TieLine
{
public RoutingOutputPort SourcePort { get; private set; }
public RoutingInputPort DestinationPort { get; private set; }
public int InUseCount { get { return DestinationUsingThis.Count; } }
/// <summary>
/// Gets the type of this tie line. Will either be the type of the desination port
/// or the type of OverrideType when it is set.
/// </summary>
public eRoutingSignalType Type
{
get
{
if (OverrideType.HasValue) return OverrideType.Value;
return DestinationPort.Type;
}
}
/// <summary>
/// Use this to override the Type property for the destination port. For example,
/// when the tie line is type AudioVideo, and the signal flow should be limited to
/// Audio-only or Video only, changing this type will alter the signal paths
/// available to the routing algorithm without affecting the actual Type
/// of the destination port.
/// </summary>
public eRoutingSignalType? OverrideType { get; set; }
List<IRoutingInputs> DestinationUsingThis = new List<IRoutingInputs>();
/// <summary>
/// For tie lines that represent internal links, like from cards to the matrix in a DM.
/// This property is true if SourcePort and DestinationPort IsInternal
/// property are both true
/// </summary>
public bool IsInternal { get { return SourcePort.IsInternal && DestinationPort.IsInternal; } }
public bool TypeMismatch { get { return SourcePort.Type != DestinationPort.Type; } }
public bool ConnectionTypeMismatch { get { return SourcePort.ConnectionType != DestinationPort.ConnectionType; } }
public string TypeMismatchNote { get; set; }
/// <summary>
///
/// </summary>
/// <param name="sourcePort"></param>
/// <param name="destinationPort"></param>
public TieLine(RoutingOutputPort sourcePort, RoutingInputPort destinationPort)
{
if (sourcePort == null || destinationPort == null)
throw new ArgumentNullException("source or destination port");
SourcePort = sourcePort;
DestinationPort = destinationPort;
}
/// <summary>
/// Creates a tie line with an overriding Type. See help for OverrideType property for info
/// </summary>
/// <param name="overrideType">The signal type to limit the link to. Overrides DestinationPort.Type</param>
public TieLine(RoutingOutputPort sourcePort, RoutingInputPort destinationPort, eRoutingSignalType overrideType) :
this(sourcePort, destinationPort)
{
OverrideType = overrideType;
}
public static TieLine TieLineFromStrings(string sourceKey, string sourcePortKey, string destinationKey, string destinationPortKey)
{
var sourceDev = DeviceManager.GetDeviceForKey(sourceKey) as IRoutingOutputs;
if (sourceDev == null)
{
Debug.Console(1, "WARNING: Cannot create tie line, routable source '{0}' not found", sourceKey);
return null;
}
var destDev = DeviceManager.GetDeviceForKey(destinationKey) as IRoutingInputs;
if (destDev == null)
{
Debug.Console(1, "WARNING: Cannot create tie line, routable destination '{0}' not found", destinationKey);
return null;
}
var sourcePort = sourceDev.OutputPorts[sourcePortKey];
if (sourcePort == null)
{
Debug.Console(1, "WARNING: Cannot create tie line. Source '{0}' does not contain port '{1}'", sourceKey, sourcePortKey);
return null;
}
var destPort = destDev.InputPorts[destinationPortKey];
if (destPort == null)
{
Debug.Console(1, "WARNING: Cannot create tie line. Destination '{0}' does not contain port '{1}'", destinationKey, destinationPortKey);
return null;
}
return new TieLine(sourcePort, destPort);
}
/// <summary>
/// Will link up video status from supporting inputs to connected outputs
/// </summary>
public void Activate()
{
// Now does nothing
}
public void Deactivate()
{
// Now does nothing
}
public override string ToString()
{
return string.Format("Tie line: [{0}]{1} --> [{2}]{3}", SourcePort.ParentDevice.Key, SourcePort.Key,
DestinationPort.ParentDevice.Key, DestinationPort.Key);
}
}
//********************************************************************************
public class TieLineCollection : List<TieLine>
{
public static TieLineCollection Default
{
get
{
if (_Default == null)
_Default = new TieLineCollection();
return _Default;
}
}
static TieLineCollection _Default;
}
}

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