Compare commits

...

202 Commits

Author SHA1 Message Date
Andrew Welker
dff5d2d32e Merge pull request #1346 from PepperDash/feature/add-infinetEx-comm-method 2025-10-23 18:50:06 -04:00
Neil Dorin
317bde3814 fix: add InfinetEx to eControlMethods enum 2025-10-23 15:22:46 -06:00
Andrew Welker
bf248fe33e Merge pull request #1343 from PepperDash/device-interface-system
device interface system
2025-10-23 10:40:56 -04:00
cdenig
2f44040e4f Merge pull request #1344 from PepperDash/feature/allow-config-tool-v2-structure
Feature/allow config tool v2 structure
2025-10-23 10:15:03 -04:00
Neil Dorin
10399a1be8 Update src/PepperDash.Core/Config/PortalConfigReader.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-22 13:54:08 -06:00
Neil Dorin
5409db193c Update src/PepperDash.Essentials.Core/Config/Essentials/EssentialsConfig.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-22 13:53:23 -06:00
Neil Dorin
f1ce54a524 Merge branch 'main' into feature/allow-config-tool-v2-structure 2025-10-22 13:48:22 -06:00
Andrew Welker
7c72a0d905 fix: send device interface list on client join
In order to avoid updating the MC Edge API to send device interfaces, one of the responses to the clientJoined message will now be a message with the type `/system/deviceInterfaces`. This has a corresponding handler in the core library to put the interfaces in the correct location.
2025-10-21 18:19:09 -05:00
Andrew Welker
5d5e78629e chore: update local build version to 2.18.2-local 2025-10-21 18:17:25 -05:00
Neil Dorin
dab5484d6e Merge pull request #1342 from PepperDash/wsdebug-persistence
Unique Client IDs
2025-10-15 15:16:46 -04:00
Andrew Welker
5c35a3be45 fix: catch exceptions in handlers directly
Previously, any exceptions that were occuring in a hander's action were being swalled due to being off on another thread. Now, those exceptions are caught and printed out.
2025-10-15 14:03:17 -05:00
Andrew Welker
6cb98e12fa fix: use correct collection for program stop 2025-10-15 14:02:06 -05:00
Andrew Welker
608601990b docs: fix Copilot comments 2025-10-15 12:54:14 -05:00
Andrew Welker
3e0f318f7f fix: update log methods to all be consistent 2025-10-15 12:36:42 -05:00
Andrew Welker
98d0cc8fdc docs: add missing XML comments for Mobile Control Project 2025-10-15 12:26:57 -05:00
Andrew Welker
c557c6cdd6 fix: mobileinfo & CWS info call report the correct data 2025-10-15 11:49:06 -05:00
Andrew Welker
8525134ae7 fix: direct server clients now have unique client IDs
Using the generated security token as an ID was presenting problems with duplicate connections using the same ID and trying to figure out where to send the messages. Now, the clients have a unique ID that's an increasing integer that restarts at 1 when the program restarts.
2025-10-15 09:50:12 -05:00
Andrew Welker
1197b15a33 Merge pull request #1340 from PepperDash/display-bridging
Display bridging, Docs, Appdebug
2025-10-10 10:21:35 -04:00
Andrew Welker
ea6a7568fc Merge remote-tracking branch 'origin/feature/add-IKeyed-to-interfaces' into display-bridging 2025-10-09 16:08:17 -05:00
Andrew Welker
3a2a059ce1 fix: appdebug now has option for setting all sink levels 2025-10-09 16:07:25 -05:00
Andrew Welker
f9d9df9d5c docs: XML comments for Devices.Common 2025-10-09 13:18:36 -05:00
Neil Dorin
c284c4275f feat: Enhance UDPServer initialization in Connect method
Updated the `Connect` method in `GenericUdpServer.cs` to include error handling for hostname parsing. The method now attempts to create a `UDPServer` instance with specified parameters and falls back to default initialization if an error occurs. This improves flexibility and robustness in server setup.
2025-10-09 11:31:38 -06:00
Neil Dorin
0418f8a7cc fix: Fix typos and enhance item selection handling
Corrected parameter name in GenericUdpServer constructor.
Added new action for item selection in ISelectableItemsMessenger
with error handling for missing or invalid keys.
Updated SetItems method to improve clarity and ensure proper
clearing and re-adding of item actions.
2025-10-09 09:40:46 -06:00
Andrew Welker
a5d409e93a fix: analog input check uese correct comparison
input selection coming from SIMPL is 1-based, not 0-based. Comparison to input port array length needs to be <= instead of <
2025-10-09 08:36:26 -05:00
Andrew Welker
59944c0e2f refactor: split up classes to separate files 2025-10-09 08:33:22 -05:00
Neil Dorin
419177ccd5 fix: Add item management and update handling in messenger
Introduces a new private field `_itemKeys` to store item keys. Adds the `SetItems` method to manage item actions and update events, ensuring proper registration and cleanup. The `SendFullStatus` method is now invoked from a dedicated event handler `LocalItem_ItemUpdated`, improving the handling of item updates.
2025-10-08 12:24:17 -06:00
Neil Dorin
bd01e2bacc fix: Add KeyName class and update camera messaging
This commit introduces a new `KeyName` class implementing the `IKeyName` interface, enhancing the representation of camera data. The `CameraController_CameraSelected` and `SendFullStatus` methods are updated to utilize `KeyName` instances for selected and listed cameras, improving data encapsulation and consistency in the `IHasCamerasWithControlsStateMessage`. Additionally, new using directives for logging and core functionalities are added.
2025-10-07 17:10:11 -06:00
Neil Dorin
2928c5cf94 feat: Enhance camera capabilities and messaging structure
- Introduced `ICameraCapabilities` interface and `CameraCapabilities` class for defining camera features like pan, tilt, zoom, and focus.
- Modified `IHasCameras` interface to include a list of `IHasCameraControls` objects for improved camera management.
- Refactored `CameraBaseMessenger` to be generic, enhancing flexibility and type safety.
- Updated `SendCameraFullMessageObject` to include detailed camera capabilities in status messages.
- Added `CameraStateMessage` class to encapsulate camera state, including control support and capabilities.
- Updated `IHasCamerasWithControlMessenger` to use `IKeyName` for camera list and selected camera properties, improving type consistency.
- Enhanced `MobileControlSystemController` to manage devices implementing `IHasCameraControls`, creating appropriate messengers for different device types.
2025-10-07 15:37:31 -06:00
Neil Dorin
82b5dc96c1 feat: Deprecate IHasCamerasMessenger; introduce new controls
Mark IHasCamerasMessenger as obsolete and replace it with
IHasCamerasWithControlMessenger, which adds functionality
for devices with camera controls. A new state message class,
IHasCamerasWithControlsStateMessage, has been added to
encapsulate camera state. Update MobileControlSystemController
to use the new messenger implementation.
2025-10-07 12:00:01 -06:00
Neil Dorin
37cea8a11c fix: Refactor camera control interfaces and event arguments
Significantly restructure camera control interfaces and event arguments.
Removed obsolete interfaces like `IHasCameras` and `CameraSelectedEventArgs`,
and introduced generic event argument classes for improved type safety.
Added `IHasCamerasWithControls` for better management of camera controls.
Corrected the `IHasCameraMuteWithUnmuteReqeust` interface name.
Reintroduced the `eCameraControlMode` enum to define camera control modes.
These changes enhance the organization, clarity, and functionality of the camera control system.
2025-10-07 11:52:07 -06:00
Neil Dorin
a3f0901fa0 Merge pull request #1335 from PepperDash/mc-messenger-improvements
feat: unique status requests for messengers
2025-09-30 14:33:07 -06:00
Neil Dorin
f91f435768 fix: Add null check for CurrentScenario in MobileControlSystem
This change introduces a check for `_roomCombiner.CurrentScenario` being `null`. When it is `null`, a `MobileControlMessage` is created with the type `/system/roomKey`, `clientId`, and `roomKey`, which is then sent to the client. This improves the handling of scenarios without a current scenario by ensuring relevant room key information is communicated.
2025-09-30 12:11:25 -06:00
Andrew Welker
5120b2b574 Merge branch 'main' into mc-messenger-improvements 2025-09-29 11:02:39 -05:00
Andrew Welker
7c90027578 feat: set direct server debug level via console command
The `mobilewsdebug` console command can now be used to set the internal websocket logging level for both the API client and the direct server at the same time.
2025-09-26 21:47:06 -05:00
Andrew Welker
bb694b4200 feat: enable subscription logic for messengers
In order to help control traffic over the websocket, a subscription feature has been added:
* A config option, `enableMessengerSubscriptions` has been added
* When true, the MessengerBase class will assume that any message sent using the `PostStatusMessage` that has a valid client ID wants to send any subsequent unsolicited updates to that same client
* The client's ID will be added a list of subscribed client IDs
* Any subsequent messages sent using the `PostStatusMessage` methods that have a null clientId will ONLY be sent to subscribed clients
* When a client disconnects, it will be removed from the list of subscribed clients

This should cut down drastically on the traffic to the UI, especially when combined with requesting partial status updates from a device rather than the entire state.
2025-09-26 21:31:54 -05:00
Andrew Welker
087d0a1149 chore: move classes and interfaces to individual files 2025-09-26 21:21:01 -05:00
Andrew Welker
4747c16b02 build: delete all local build clzs on build 2025-09-26 21:17:28 -05:00
Andrew Welker
aa4d241dde Merge pull request #1337 from PepperDash/Ibasicvolumecontrols-messenger
fix: modify volume messenger to start with IBasicVolumeControls
2025-09-26 10:40:44 -04:00
Andrew Welker
9fc5586531 fix: use IBasicVolumeControls to build DeviceVolumeMessenger 2025-09-25 15:29:35 -05:00
Andrew Welker
d33fd56529 feat: add method to force panel reload
Other refactorings for factory method and log statements
2025-09-25 14:47:11 -05:00
Neil Dorin
8fc4d21f02 fix: Add DeviceInterfaceSupport property to JoinResponse
This commit introduces a new property, `DeviceInterfaceSupport`,
to the `JoinResponse` class in the `PepperDash.Essentials.WebSocketServer`
namespace. This property is a dictionary that maps strings to
`DeviceInterfaceInfo` objects, enhancing support for device interfaces.
A summary comment has also been added for clarity.
2025-09-25 11:50:42 -06:00
Neil Dorin
6d93662b31 Merge pull request #1338 from PepperDash/io-updates 2025-09-25 09:59:36 -06:00
Andrew Welker
11b190e76f docs: put XML comments on correct thing 2025-09-25 10:51:30 -05:00
Andrew Welker
df03a71cbc chore: fix errors in log statements
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-09-25 09:50:55 -05:00
Andrew Welker
72e67a1c4c fix: implement IHasFeedback for all IO devices and modify logging 2025-09-25 09:47:44 -05:00
Andrew Welker
f8728b6825 docs: update XML comments for EssentialsDeviceFactory 2025-09-25 09:46:55 -05:00
Andrew Welker
d9ef8a2289 docs: add XML comments for IAnalogInput 2025-09-25 09:46:03 -05:00
Andrew Welker
278408a3bc docs: reword XML comments for IHasFeedback Interface 2025-09-25 09:45:42 -05:00
Andrew Welker
fd70377c7f fix: log errors and disconnects for UI Clients 2025-09-25 08:51:11 -05:00
Neil Dorin
06341b14f3 feat: Adds device interface support info to joinroom response in MC websocket server.
Enhance MessengerBase and WebSocketServer functionality

Updated MessengerBase with new methods for action management and message posting, along with improved documentation. Introduced DeviceMessageBase for better message representation.

Enhanced MobileControlWebsocketServer to support device interfaces, adding DeviceInterfaceSupport to JoinResponse and a new DeviceInterfaceInfo class for detailed device information.
2025-09-24 14:49:41 -06:00
Andrew Welker
d7f9c74b2f fix: modify volume messenger to start with IBasicVolumeControls 2025-09-23 13:39:03 -05:00
Andrew Welker
5921b5dbb0 Merge pull request #1336 from PepperDash/hotfix/check-for-cs-lan-on-mctp
Hotfix/check for cs lan on mctp
2025-09-23 13:58:15 -04:00
Neil Dorin
ba0de5128f Update src/PepperDash.Essentials.MobileControl/Touchpanel/MobileControlTouchpanelController.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-09-23 11:56:57 -06:00
Andrew Welker
b0a090062f Merge branch 'hotfix/check-for-cs-lan-on-mctp' into mc-messenger-improvements 2025-09-23 11:25:41 -05:00
Andrew Welker
9c0cab8218 fix: use id parameter and fix some formatting 2025-09-23 11:09:44 -05:00
Andrew Welker
c0af637108 fix: use correct property names 2025-09-23 11:07:24 -05:00
Andrew Welker
9c9eaea928 feat: unique status requests for messengers
UI Applications can now request status for specific feature sets instead of full status for a device. This will hopefully cut down on the traffic and messages required to get the data for the UI.
2025-09-23 10:55:16 -05:00
Neil Dorin
9de94bd65f fix: Update v2 config detection criteria
Changed the logic for identifying v2 configuration files. The check now looks for the presence of a "versions" node instead of the absence of "system" or "template" nodes, reflecting an update in the configuration file structure.
2025-09-22 15:05:06 -06:00
Neil Dorin
ff46fb8f29 feat: Add versioning support to EssentialsConfig
Introduce `Versions` property in `EssentialsConfig` to hold version information.
Add `VersionData` class for Essentials and package versions, and `NugetVersion` class for individual package details.
Retain and document `SystemTemplateConfigs` class.
2025-09-22 14:55:58 -06:00
Neil Dorin
d9243def30 feat: Adds ability to read configs generated from v2 config tool that are pre-merged don't have system or template objects
Refactor config handling and improve documentation

- Updated `PortalConfigReader.cs` to use constants for configuration keys, enhancing maintainability and readability. Improved error logging with `Debug.LogError`.
- Modified `ConfigReader.cs` to handle v2 configuration format, streamlining the loading process and avoiding redundant parsing.
- Added XML documentation comments to properties in `EssentialsConfig.cs`, improving code documentation. Initialized `Rooms` property in the constructor.
- Enhanced `SystemTemplateConfigs` class with XML documentation for better clarity on its properties.
2025-09-22 14:22:57 -06:00
Neil Dorin
258699fbcd fix: Enhance AppUrl change logging
Updated logging to include the new AppUrl value when it changes. This provides better context in the logs, making it easier to track the specific URL that was set.
2025-09-18 18:23:12 -06:00
Neil Dorin
738504e9fc fix: Add error handling for network parameter retrieval
Introduced a try-catch block to handle exceptions when fetching the Crestron Ethernet adapter's ID, subnet mask, and IP address. Added logging for cases where the processor lacks a CS LAN. Also included a new using directive for Serilog.Events.
2025-09-18 14:48:21 -06:00
erikdred
cae1bbd6e6 Merge pull request #1332 from PepperDash/feature/add-hide-property-to-room-combine-scenario
feat: Add HideInUi property to room combiner classes
2025-09-17 18:38:21 -04:00
Neil Dorin
dea4407e3e Update src/PepperDash.Essentials.Core/Room/Combining/IEssentialsRoomCombiner.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-09-17 16:36:33 -06:00
Neil Dorin
ab08a546f7 feat: Add HideInUi property to room combiner classes
- Introduced `HideInUi` property in `EssentialsRoomCombinerPropertiesConfig` to control UI visibility.
- Added `HideInUi` interface property in `IEssentialsRoomCombiner`.
- Implemented `HideInUi` in `RoomCombinationScenario`, along with new `Key` and `Name` properties for improved data representation.
2025-09-17 15:25:23 -06:00
Neil Dorin
ef98d47792 Merge pull request #1331 from PepperDash/dev-list-fix 2025-09-17 08:36:04 -06:00
Andrew Welker
c05976ee60 fix: modify formatting and sorting for devfb response 2025-09-17 09:28:04 -05:00
Andrew Welker
4ca1031bef docs: fix CS1587 errors 2025-09-17 08:52:44 -05:00
Andrew Welker
6d61c4525e fix: use ConsoleCommandResponse for device feedbacks 2025-09-17 08:52:29 -05:00
Andrew Welker
3db274ace5 fix: add line endings for devlist console command 2025-09-17 08:51:45 -05:00
Neil Dorin
f0f708294c Merge pull request #1329 from PepperDash/devlist-fix
fix: print devlist output using ConsoleCommandResponse
2025-09-10 09:58:13 -06:00
Andrew Welker
a00d186c62 fix: print devlist output using ConsoleCommandResponse 2025-09-10 10:45:55 -05:00
Neil Dorin
51da668dfd Merge pull request #1327 from PepperDash/cs-lan-mc-panel
fix: add config property for devices on CS LAN
2025-09-05 16:20:42 -06:00
Andrew Welker
d2b7400039 fix: INvxNetworkPortInformation inherits from IKeyed 2025-09-05 15:55:31 -05:00
Andrew Welker
2424838b7f chore: remove unused using
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-09-02 12:56:14 -05:00
Andrew Welker
9556edc064 fix: add config property for devices on CS LAN 2025-09-02 12:54:51 -05:00
Sumanth Rayancha
f9088691fd Merge pull request #1322 from PepperDash/release
Release
2025-08-26 10:16:18 -04:00
Andrew Welker
e40b6a8b4c Merge pull request #1320 from PepperDash/feature/extract-html-assets
feat: add html assets extraction from zip files in ControlSystem
2025-08-26 09:58:02 -04:00
Erik Meyer
c3b39a87da fix: enhance zip extraction to prevent directory traversal attacks 2025-08-22 15:15:02 -04:00
erikdred
06dc0e947e fix: check for null when getting directory
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-08-22 09:12:20 -04:00
aknous
147997f460 Merge pull request #1321 from PepperDash/IBasicVideoMuteWithFeedbackMessenger
Adds IBasicVideoMuteWithFeedbackMessenger
2025-08-21 14:26:10 -04:00
aknous
49abec5eea Update src/PepperDash.Essentials.MobileControl.Messengers/Messengers/CameraBaseMessenger.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-08-21 13:23:43 -04:00
aknous
6830efe42a fix: fixes CameraBaseMessenger hold timer for PTZ controls, adds storePreset messenger 2025-08-19 18:34:16 -04:00
Neil Dorin
d013068a0c Update src/PepperDash.Essentials/ControlSystem.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-08-19 14:54:11 -06:00
Neil Dorin
52916d29f4 Update src/PepperDash.Essentials/ControlSystem.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-08-19 14:53:06 -06:00
Erik Meyer
19e8489166 feat: add html assets extraction from zip files in ControlSystem 2025-08-19 15:48:43 -04:00
Neil Dorin
fe33443b25 fix: Update IP handling in MobileControlTouchpanelController
Updates logic to handle setting the URL sent to the CH5 wrapper app to use the CS LAN IP based on the actual IpInformationChange event on the panel itself.

- Added `._PepperDash.Essentials.4Series.sln` to .gitignore.
- Introduced new using directives for Regex and Crestron libraries.
- Added `csIpAddress` and `csSubnetMask` fields to store device IP info.
- Modified constructor to retrieve and assign current IP and subnet mask.
- Updated `Panel.IpInformationChange` event handler for logging and URL setting.
- Created `GetUrlWithCorrectIp` method to determine the correct URL based on IP.
- Refactored `SetAppUrl` to utilize the new URL method.
- Commented out old IP determination logic in `MobileControlWebsocketServer.cs` as it was moved to the touchpanel controller.
2025-08-19 13:28:45 -06:00
aknous
8cf195b262 feat: adds IBasicVideoMuteWithFeedbackMessenger 2025-08-19 11:37:39 -04:00
Neil Dorin
40406b797d Merge pull request #1314 from PepperDash/streaming-device-properties 2025-08-15 11:52:20 -06:00
Andrew Welker
65bc408ebf fix: add StreamUrl to baseStreamingDeviceProperties 2025-08-15 12:41:21 -05:00
Neil Dorin
9d49fb8357 Merge pull request #1313 from PepperDash/temp-to-dev
Temp to dev
2025-08-15 09:34:41 -06:00
Neil Dorin
fb7797dac7 Merge pull request #1312 from PepperDash/comm-bridge-add 2025-08-15 09:02:23 -06:00
Andrew Welker
574f5f6dc9 chore: remove unused using directives in CommFactory.cs 2025-08-15 09:51:17 -05:00
Andrew Welker
e49c69a12f feat: add CommBridge class and enhance EssentialsBridgeableDevice with new constructors 2025-08-15 09:48:30 -05:00
Sumanth Rayancha
7889cba196 Merge pull request #1307 from PepperDash/feature/assets-folder
feat: add LoadAssets method to manage asset loading and configuration…
2025-08-13 12:08:14 -04:00
Nick Genovese
033aa1f3dd feat: enhance asset extraction and configuration file handling in ControlSystem 2025-08-12 12:17:58 -04:00
Neil Dorin
9b6c2d80ea Merge pull request #1308 from PepperDash/current-sources 2025-08-11 22:53:11 -06:00
Andrew Welker
a0fc731701 chore: apply copilot suggestions
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-08-11 17:55:02 -05:00
Andrew Welker
f2d0dca7b8 fix: make appdebug case-insensitive
when commands like `appdebug verbose` are used rather than `appdebug 2`, the command would fail because Verbose != verbose. The enum conversion is now case-insensitive.
2025-08-11 17:50:50 -05:00
Andrew Welker
ab4e85d081 fix: use different methods for extensions
The logging extension methods now use the appropriate methods from
the debug class. Previously some messages were not getting handled correctly, and it was causing issues with log statements.
2025-08-11 17:48:46 -05:00
Andrew Welker
47017da527 fix: use correct property names 2025-08-11 17:47:14 -05:00
Andrew Welker
4f0d464ba4 Merge pull request #1306 from PepperDash/fix/remove-unsued-method-in-cs
Fix/remove unsued method in cs
2025-08-11 15:30:04 -05:00
Nick Genovese
0107422507 refactor: remove unused assembly resolution logic from ControlSystem 2025-08-11 16:24:44 -04:00
Nick Genovese
1a366790e7 feat: add LoadAssets method to manage asset loading and configuration file cleanup 2025-08-11 16:23:31 -04:00
Andrew Welker
97448f4f0f Merge branch 'main' into current-sources 2025-08-06 09:01:40 -05:00
Andrew Welker
cf3ece4237 fix: use cr-lf for line endings 2025-08-06 09:00:45 -05:00
Andrew Welker
bb4b2f88b6 Merge pull request #1304 from PepperDash/temp-to-dev
Temp to dev
2025-08-05 16:39:38 -05:00
aknous
808e8042a7 Merge pull request #1305 from PepperDash/default-debug-levels
fix: set default debug levels if not found
2025-08-04 14:47:31 -04:00
Andrew Welker
0bc4388bfd Merge branch 'default-debug-levels' into current-sources 2025-08-04 13:31:26 -05:00
Andrew Welker
dbc132c0da fix: set default debug levels if not found 2025-08-04 13:31:17 -05:00
Andrew Welker
5bb0ab2626 fix: base config properties for use with streaming devices 2025-08-01 21:17:35 -05:00
Andrew Welker
27bf36c58c fix: modify how current sources dictionary gets updated 2025-08-01 09:22:31 -05:00
Andrew Welker
ce886aea63 chore: update local build version 2025-08-01 09:22:31 -05:00
Andrew Welker
ef920bf54c Merge branch 'main' into current-sources 2025-07-31 13:27:43 -05:00
Andrew Welker
88466818ce Merge pull request #1303 from PepperDash/debug-fixes
fix: use correct overload for logging at levels
2025-07-31 13:03:14 -05:00
Andrew Welker
0871a902e1 fix: use correct overload for logging at levels
Some overloads that had the first argument as an Exception were calling the _logger.Write method with a null where the message template should have been, causing messages logged with that overload to be swallowed and not logged.
2025-07-31 12:50:41 -05:00
Andrew Welker
a031424752 fix: add destination & source keys to routelist 2025-07-30 11:20:54 -05:00
Andrew Welker
fd1ba345aa fix: remove StringEnumConverter 2025-07-29 23:01:13 -05:00
Andrew Welker
e03874a7a9 fix: add messenger and event to ICurrentSources 2025-07-29 22:26:07 -05:00
aknous
2efab4f196 Merge pull request #1301 from PepperDash/mc-tp-ip-fix
fix: only adjust IP if processor is a CS processor
2025-07-28 12:57:24 -04:00
Andrew Welker
a41aba1904 Merge pull request #1300 from PepperDash/temp-to-dev
Temp to dev
2025-07-28 11:54:11 -05:00
Andrew Welker
d0ca6721f5 fix: only adjust IP if processor is a CS processor 2025-07-28 11:48:00 -05:00
Andrew Welker
c732eb48f2 Merge pull request #1299 from PepperDash/factory-updates
Multiple Updates
2025-07-25 10:38:15 -05:00
Andrew Welker
efe70208d3 fix: check for null assembly name 2025-07-25 10:32:43 -05:00
Andrew Welker
615f640ebb fix: use continue instead of return
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-25 10:27:50 -05:00
Andrew Welker
ee6f9416a3 chore: remove unused configSnippet 2025-07-25 10:24:32 -05:00
Andrew Welker
4fc6ecbd0b style: switch to auto property for attributes 2025-07-25 09:56:39 -05:00
Andrew Welker
58bcc3315d fix: add changes from code review 2025-07-25 09:51:04 -05:00
Andrew Welker
08cc84a8e8 fix: apply suggestions from code review
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-25 09:28:53 -05:00
Andrew Welker
226014fee0 fix: apply suggestions from code review
- remove commented out debug statements
- null check for description attribute

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-25 09:27:33 -05:00
Andrew Welker
dc7f99e176 fix: mark FeedbackBase default constructor as obsolete
There are situations now where feedbacks in the feedback collection
can be used to update things on UIs. If the feedback doesn't have a key, it can't
be used for this purpose.
2025-07-25 09:18:22 -05:00
Andrew Welker
f0af9f8d19 fix: mark IHasMultipleDisplays and associated enum as obsolete
Fixes #1219
2025-07-25 09:14:45 -05:00
Andrew Welker
31143f56df fix: modify how exceptions are printed to reduce noise
When an exception occurs during the connect method,
only the exception message will be printed at the Error log level.
The entire stack trace will be printed when at the Verbose level.

fixes #1273
2025-07-25 09:13:42 -05:00
Andrew Welker
43989b9588 chore: move interfaces to their own files 2025-07-25 09:12:09 -05:00
Andrew Welker
8db559f197 feat: factory updates & refactoring
This commit introduces significant updates to the device factory system, enhancing the way devices are created and managed within the PepperDash Essentials framework.
The changes include:
- New attributes for device configuration and description.
- Refactoring of the device manager and essentials device classes to support new factory methods.
- modified factory classes for essentials devices, plugin development devices, and processor extension devices.
- The device factory interface has been updated to include a factory method for creating devices.
- Added a wrapper for the device factory to streamline device creation.
- Updated plugin loader to accommodate the new device factory structure.

Fixes #1065
Fixed #1277
2025-07-25 09:05:40 -05:00
Andrew Welker
86f20da116 Merge pull request #1291 from PepperDash/copilot/fix-1290
docs: Add comprehensive XML documentation to all public members
2025-07-25 08:02:37 -05:00
Andrew Welker
0674dbda37 Merge branch 'main' into copilot/fix-1290 2025-07-25 07:48:49 -05:00
Andrew Welker
592607f3c8 Merge pull request #1296 from PepperDash/feature/add-IHasCamerasMessenger 2025-07-24 18:53:05 -05:00
Neil Dorin
ea0a779f8b Merge branch 'feature/add-IHasCamerasMessenger' of https://github.com/PepperDash/Essentials into feature/add-IHasCamerasMessenger 2025-07-24 16:40:06 -06:00
Neil Dorin
86e4d2f7fb feat: Update SendFullStatus to target specific clients
Modified the `SendFullStatus` method to accept a `string clientId` parameter, allowing it to send status messages to specific clients. Updated the action for `"/fullStatus"` to pass the client ID and adjusted the `PostStatusMessage` call accordingly.
2025-07-24 16:39:28 -06:00
Neil Dorin
0069233e13 Update src/PepperDash.Essentials.Devices.Common/Cameras/CameraControl.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-24 16:16:05 -06:00
Neil Dorin
4048efb07e Merge branch 'main' into feature/add-IHasCamerasMessenger 2025-07-24 16:03:41 -06:00
Andrew Welker
b12cdbc75c docs: apply suggestions from copilot
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-23 09:08:10 -05:00
Neil Dorin
b47f1d6b77 Merge pull request #1293 from PepperDash/to-dev 2025-07-23 07:53:44 -06:00
Andrew Welker
1dbac7d1c8 Merge pull request #1292 from PepperDash/portkey-add
feat: add destination and source port key properties for advanced routing
2025-07-22 15:26:44 -05:00
Neil Dorin
799d4c127c Update src/PepperDash.Essentials.Core/Devices/DestinationListItem.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-22 14:02:01 -06:00
Andrew Welker
a6cd9a0571 feat: add destination and source port key properties for advanced routing 2025-07-22 14:56:28 -05:00
copilot-swe-agent[bot]
80da4ad98f docs: fix duplicate and malformed XML documentation tags
Co-authored-by: andrew-welker <1765622+andrew-welker@users.noreply.github.com>
2025-07-22 17:40:17 +00:00
Andrew Welker
b283ed34b4 docs: remove duplicate
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-22 12:08:28 -05:00
Andrew Welker
899f13eadb docs: remove duplicate
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-22 12:08:10 -05:00
Andrew Welker
fc1e29565e docs: remove duplicate
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-22 12:03:33 -05:00
Andrew Welker
f9a74567d2 docs: remove duplicates
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-22 12:03:18 -05:00
Andrew Welker
53b1e5d142 docs: remove duplicates
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-22 12:03:03 -05:00
Andrew Welker
78e9ea8070 docs: duplicate tags
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-22 12:02:38 -05:00
Andrew Welker
df201558a5 docs: update
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-22 12:02:24 -05:00
Andrew Welker
130c874684 docs: fix documentation
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-22 11:37:08 -05:00
Andrew Welker
aee40ffe14 docs: fix duplicate XML tags
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-22 11:36:43 -05:00
Andrew Welker
3ffad13abf docs: remove duplicate
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-22 11:30:04 -05:00
Andrew Welker
5ee7aaa991 docs: revert to old comment
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-22 11:29:25 -05:00
Andrew Welker
4fa8433e73 docs: change wording
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-22 11:19:10 -05:00
Andrew Welker
5fe99518a0 docs: update formatting
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-22 11:18:50 -05:00
Andrew Welker
5a2a2129e6 docs: remove duplicate
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-22 11:13:33 -05:00
Andrew Welker
4fbfda62d6 docs: remove duplicate
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-22 11:13:21 -05:00
Andrew Welker
b8ab54cbe0 docs: remove duplicate
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-22 11:12:55 -05:00
Andrew Welker
f6f1619bc2 docs: remove duplicate
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-22 11:12:38 -05:00
Andrew Welker
41fd4d6adc docs: revert to original documentation
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-22 11:12:25 -05:00
Andrew Welker
5b73f8fbd2 docs: remove duplicate docs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-22 11:12:03 -05:00
Andrew Welker
c70a8edc24 docs: remove duplicate documentation
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-22 11:11:33 -05:00
copilot-swe-agent[bot]
7987eb8f9b docs: complete XML documentation for all projects with inheritdoc tags
Co-authored-by: andrew-welker <1765622+andrew-welker@users.noreply.github.com>
2025-07-22 15:53:01 +00:00
copilot-swe-agent[bot]
260677a37f docs: add XML documentation to PepperDash.Core project
Co-authored-by: andrew-welker <1765622+andrew-welker@users.noreply.github.com>
2025-07-22 15:48:23 +00:00
copilot-swe-agent[bot]
eeb0e84dc7 docs: enable XML documentation generation and add initial documentation
Co-authored-by: andrew-welker <1765622+andrew-welker@users.noreply.github.com>
2025-07-22 15:44:52 +00:00
copilot-swe-agent[bot]
d282487da6 Initial plan 2025-07-22 15:35:41 +00:00
Andrew Welker
da30424657 Merge pull request #1289 from PepperDash/meter-feedback-interface
meter feedback interface
2025-07-21 15:20:29 -05:00
Andrew Welker
311452beac fix: use correct namespaces
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-21 13:30:11 -05:00
Andrew Welker
789113008e docs: update comments
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-21 13:29:11 -05:00
Andrew Welker
660836bd5a docs: remove spaces
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-21 13:28:59 -05:00
Andrew Welker
97b2ffed9c docs: fix comment
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-21 13:28:37 -05:00
Andrew Welker
2bbefa062d docs: fix comments
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-21 13:28:10 -05:00
Andrew Welker
3421b2f28c Merge branch 'main' into meter-feedback-interface 2025-07-17 12:34:16 -05:00
Andrew Welker
1dcd4e328c fix: Destination support for USB 2025-07-17 12:32:26 -05:00
Andrew Welker
e76369726d docs: XML comments for DestinationListItem 2025-07-17 12:25:52 -05:00
Neil Dorin
f8455d4110 feat: Refactor IHasCamerasMessenger constructor parameters
Updated the constructor of `IHasCamerasMessenger` to reorder parameters, placing `IHasCameras cameraController` last. Added logic in `MobileControlSystemController.cs` to instantiate and add `IHasCamerasMessenger` for devices implementing the `IHasCameras` interface.
2025-07-17 11:14:32 -06:00
Andrew Welker
9813673b66 feat: ICurrentSources interface to allow for tracking breakaway routing 2025-07-17 09:15:25 -05:00
Neil Dorin
f006ed0076 feat: Add camera control interfaces and messenger classes
This commit introduces new interfaces in `CameraControl.cs` for various camera functionalities, including muting, panning, tilting, zooming, and auto modes. The `IHasCameras` interface is expanded to manage camera lists and selections, with the addition of `CameraSelectedEventArgs` for event handling.

In `CameraBaseMessenger.cs`, a new `IHasCamerasMessenger` class is created to facilitate communication for devices implementing the `IHasCameras` interface, along with the `IHasCamerasStateMessage` class to represent the state of camera devices. These changes enhance the overall camera control capabilities and improve interaction management within the application.
2025-07-16 16:54:57 -06:00
Andrew Welker
ddbcc13c50 fix: add property for sync device association 2025-07-16 10:41:46 -05:00
Andrew Welker
2a70fc678e fix: add IStateFeedback interface 2025-07-11 13:13:52 -05:00
Andrew Welker
056614cba1 fix: add IMeterFeedback interface 2025-07-09 14:32:01 -05:00
Andrew Welker
fda4a5a816 Merge pull request #1282 from PepperDash/main
Update Dev
2025-07-04 10:45:35 -05:00
Andrew Welker
9f70e3c721 Merge pull request #1276 from PepperDash/temp-to-dev
Temp to dev
2025-06-26 14:16:36 -04:00
Andrew Welker
ec6aeb17f6 Merge pull request #1271 from PepperDash/temp-to-dev
Temp to dev
2025-05-19 16:52:45 -05:00
Neil Dorin
91dc655103 Merge pull request #1269 from PepperDash/camera-preset-fix 2025-05-14 09:42:11 -06:00
Andrew Welker
bf31fb10eb fix: use correct join for preset select 2025-05-14 10:39:42 -05:00
Neil Dorin
5e21bad596 Merge pull request #1266 from PepperDash/temp-to-dev 2025-05-02 12:23:51 -06:00
Neil Dorin
2368f0c8cc Merge pull request #1262 from PepperDash/temp-to-dev 2025-04-28 11:37:01 -06:00
Neil Dorin
be58a0bc29 Merge pull request #1260 from PepperDash/temp-to-dev 2025-04-24 09:32:32 -06:00
Neil Dorin
8406f69e0d Merge pull request #1257 from PepperDash/temp-to-dev 2025-04-18 11:46:18 -06:00
Andrew Welker
116d83394a Merge pull request #1255 from PepperDash/temp-to-dev
Temp to dev
2025-04-14 11:15:27 -05:00
Neil Dorin
9b8e452eb4 Merge pull request #1251 from PepperDash/temp-to-dev 2025-04-11 14:00:02 -06:00
Neil Dorin
c9d86bd5dd Merge pull request #1248 from PepperDash/temp-to-dev 2025-04-11 11:55:35 -06:00
Neil Dorin
b2b257020f Merge pull request #1246 from PepperDash/temp-to-dev 2025-04-08 13:48:10 -06:00
Neil Dorin
6f58e18d14 Merge pull request #1244 from PepperDash/temp-to-dev
Temp to dev
2025-04-04 10:30:10 -06:00
Neil Dorin
60fc0298ec Merge pull request #1242 from PepperDash/temp-to-dev
Temp to dev
2025-04-02 11:14:45 -06:00
635 changed files with 20663 additions and 8602 deletions

1
.gitignore vendored
View File

@@ -395,3 +395,4 @@ essentials-framework/Essentials Interfaces/PepperDash_Essentials_Interfaces/Pepp
_site/
api/
*.DS_Store
/._PepperDash.Essentials.4Series.sln

9
.vscode/extensions.json vendored Normal file
View File

@@ -0,0 +1,9 @@
{
"recommendations": [
"ms-dotnettools.vscode-dotnet-runtime",
"ms-dotnettools.csharp",
"ms-dotnettools.csdevkit",
"vivaxy.vscode-conventional-commits",
"mhutchie.git-graph"
]
}

View File

@@ -0,0 +1,282 @@
# Crestron Library Usage Analysis - PepperDash Essentials
This document provides a comprehensive analysis of Crestron classes and interfaces used throughout the PepperDash Essentials framework, organized by namespace and library component.
## Executive Summary
The PepperDash Essentials framework extensively leverages Crestron SDK components across 100+ files, providing abstractions for:
- Control system hardware (processors, touchpanels, IO devices)
- Communication interfaces (Serial, TCP/IP, SSH, CEC, IR)
- Device management and routing
- User interface components and smart objects
- System monitoring and diagnostics
## 1. Core Crestron Libraries
### 1.1 Crestron.SimplSharp
**Primary Usage**: Foundational framework components, collections, and basic types.
**Key Files**:
- Multiple files across all projects use `Crestron.SimplSharp` namespaces
- Provides basic C# runtime support for Crestron processors
### 1.2 Crestron.SimplSharpPro
**Primary Usage**: Main hardware abstraction layer for Crestron devices.
**Key Classes Used**:
#### CrestronControlSystem
- **File**: `/src/PepperDash.Essentials/ControlSystem.cs`
- **Usage**: Base class for the main control system implementation
- **Implementation**: `public class ControlSystem : CrestronControlSystem, ILoadConfig`
#### Device (Base Class)
- **Files**: 50+ files inherit from or use this class
- **Key Implementations**:
- `/src/PepperDash.Core/Device.cs` - Core device abstraction
- `/src/PepperDash.Essentials.Core/Devices/EssentialsDevice.cs` - Extended device base
- `/src/PepperDash.Essentials.Core/Room/Room.cs` - Room device implementation
- `/src/PepperDash.Essentials.Core/Devices/CrestronProcessor.cs` - Processor device wrapper
#### BasicTriList
- **Files**: 30+ files use this class extensively
- **Primary Usage**: Touchpanel communication and SIMPL bridging
- **Key Files**:
- `/src/PepperDash.Essentials.Core/Touchpanels/TriListExtensions.cs` - Extension methods for signal handling
- `/src/PepperDash.Essentials.Core/Devices/EssentialsBridgeableDevice.cs` - Bridge interface
- `/src/PepperDash.Essentials.Core/Touchpanels/ModalDialog.cs` - UI dialog implementation
#### BasicTriListWithSmartObject
- **Files**: Multiple touchpanel and UI files
- **Usage**: Enhanced touchpanel support with smart object integration
- **Key Files**:
- `/src/PepperDash.Essentials.Core/Touchpanels/Interfaces.cs` - Interface definitions
- `/src/PepperDash.Essentials.Core/SmartObjects/SubpageReferenceList/SubpageReferenceList.cs`
## 2. Communication Hardware
### 2.1 Serial Communication (ComPort)
**Primary Class**: `ComPort`
**Key Files**:
- `/src/PepperDash.Essentials.Core/Comm and IR/ComPortController.cs`
- `/src/PepperDash.Essentials.Core/Comm and IR/CommFactory.cs`
**Usage Pattern**:
```csharp
public class ComPortController : Device, IBasicCommunicationWithStreamDebugging
public static ComPort GetComPort(EssentialsControlPropertiesConfig config)
```
**Interface Support**: `IComPorts` - Used for devices that provide multiple COM ports
### 2.2 IR Communication (IROutputPort)
**Primary Class**: `IROutputPort`
**Key Files**:
- `/src/PepperDash.Essentials.Core/Devices/IrOutputPortController.cs`
- `/src/PepperDash.Essentials.Core/Devices/GenericIRController.cs`
- `/src/PepperDash.Essentials.Core/Comm and IR/IRPortHelper.cs`
**Usage Pattern**:
```csharp
public class IrOutputPortController : Device
IROutputPort IrPort;
public IrOutputPortController(string key, IROutputPort port, string irDriverFilepath)
```
### 2.3 CEC Communication (ICec)
**Primary Interface**: `ICec`
**Key Files**:
- `/src/PepperDash.Essentials.Core/Comm and IR/CecPortController.cs`
- `/src/PepperDash.Essentials.Core/Comm and IR/CommFactory.cs`
**Usage Pattern**:
```csharp
public class CecPortController : Device, IBasicCommunicationWithStreamDebugging
public static ICec GetCecPort(ControlPropertiesConfig config)
```
## 3. Input/Output Hardware
### 3.1 Digital Input
**Primary Interface**: `IDigitalInput`
**Key Files**:
- `/src/PepperDash.Essentials.Core/CrestronIO/GenericDigitalInputDevice.cs`
- `/src/PepperDash.Essentials.Core/Microphone Privacy/MicrophonePrivacyController.cs`
**Usage Pattern**:
```csharp
public List<IDigitalInput> Inputs { get; private set; }
void AddInput(IDigitalInput input)
```
### 3.2 Versiport Support
**Key Files**:
- `/src/PepperDash.Essentials.Core/CrestronIO/GenericVersiportInputDevice.cs`
- `/src/PepperDash.Essentials.Core/CrestronIO/GenericVersiportAnalogInputDevice.cs`
- `/src/PepperDash.Essentials.Core/CrestronIO/GenericVersiportOutputDevice.cs`
**Usage**: Provides flexible I/O port configuration for various signal types
## 4. Touchpanel Hardware
### 4.1 MPC3 Touchpanel
**Primary Class**: `MPC3Basic`
**Key File**: `/src/PepperDash.Essentials.Core/Touchpanels/Mpc3Touchpanel.cs`
**Usage Pattern**:
```csharp
public class Mpc3TouchpanelController : Device
readonly MPC3Basic _touchpanel;
_touchpanel = processor.ControllerTouchScreenSlotDevice as MPC3Basic;
```
### 4.2 TSW Series Support
**Evidence**: References found in messenger files and mobile control components
**Usage**: Integrated through mobile control messaging system for TSW touchpanel features
## 5. Timer and Threading
### 5.1 CTimer
**Primary Class**: `CTimer`
**Key File**: `/src/PepperDash.Core/PasswordManagement/PasswordManager.cs`
**Usage Pattern**:
```csharp
Debug.Console(1, string.Format("PasswordManager.UpdatePassword: CTimer Started"));
Debug.Console(1, string.Format("PasswordManager.UpdatePassword: CTimer Reset"));
```
## 6. Networking and Communication
### 6.1 Ethernet Communication
**Libraries Used**:
- `Crestron.SimplSharpPro.EthernetCommunication`
- `Crestron.SimplSharp.Net.Utilities.EthernetHelper`
**Key Files**:
- `/src/PepperDash.Core/Comm/GenericTcpIpClient.cs`
- `/src/PepperDash.Core/Comm/GenericTcpIpServer.cs`
- `/src/PepperDash.Core/Comm/GenericSecureTcpIpClient.cs`
- `/src/PepperDash.Core/Comm/GenericSshClient.cs`
- `/src/PepperDash.Core/Comm/GenericUdpServer.cs`
**Usage Pattern**:
```csharp
public class GenericTcpIpClient : Device, ISocketStatusWithStreamDebugging, IAutoReconnect
public class GenericSecureTcpIpClient : Device, ISocketStatusWithStreamDebugging, IAutoReconnect
```
## 7. Device Management Libraries
### 7.1 DeviceSupport
**Library**: `Crestron.SimplSharpPro.DeviceSupport`
**Usage**: Core device support infrastructure used throughout the framework
### 7.2 DM (DigitalMedia)
**Library**: `Crestron.SimplSharpPro.DM`
**Usage**: Digital media routing and switching support
**Evidence**: Found in routing configuration and DM output card references
## 8. User Interface Libraries
### 8.1 UI Components
**Library**: `Crestron.SimplSharpPro.UI`
**Usage**: User interface elements and touchpanel controls
### 8.2 Smart Objects
**Key Files**:
- `/src/PepperDash.Essentials.Core/SmartObjects/SmartObjectDynamicList.cs`
- `/src/PepperDash.Essentials.Core/SmartObjects/SubpageReferenceList/SubpageReferenceList.cs`
**Usage**: Advanced UI components with dynamic content
## 9. System Monitoring and Diagnostics
### 9.1 Diagnostics
**Library**: `Crestron.SimplSharpPro.Diagnostics`
**Usage**: System health monitoring and performance tracking
### 9.2 System Information
**Key Files**:
- `/src/PepperDash.Essentials.Core/Monitoring/SystemMonitorController.cs`
**Usage**: Provides system status, Ethernet information, and program details
## 10. Integration Patterns
### 10.1 SIMPL Bridging
**Pattern**: Extensive use of `BasicTriList` for SIMPL integration
**Files**: Bridge classes throughout the framework implement `LinkToApi` methods:
```csharp
public abstract void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge);
```
### 10.2 Device Factory Pattern
**Implementation**: Factory classes create hardware-specific implementations
**Example**: `CommFactory.cs` provides communication device creation
### 10.3 Extension Methods
**Pattern**: Extensive use of extension methods for Crestron classes
**Example**: `TriListExtensions.cs` adds 30+ extension methods to `BasicTriList`
## 11. Signal Processing
### 11.1 Signal Types
**Bool Signals**: Digital control and feedback
**UShort Signals**: Analog values and numeric data
**String Signals**: Text and configuration data
**Implementation**: Comprehensive signal handling in `TriListExtensions.cs`
## 12. Error Handling and Logging
**Pattern**: Consistent use of Crestron's Debug logging throughout
**Examples**:
```csharp
Debug.LogMessage(LogEventLevel.Information, "Device {0} is not a valid device", dc.PortDeviceKey);
Debug.LogMessage(LogEventLevel.Debug, "Error Waking Panel. Maybe testing with Xpanel?");
```
## 13. Threading and Synchronization
**Components**:
- CTimer for time-based operations
- Thread-safe collections and patterns
- Event-driven programming models
## Conclusion
The PepperDash Essentials framework demonstrates sophisticated integration with the Crestron ecosystem, leveraging:
- **Core Infrastructure**: CrestronControlSystem, Device base classes
- **Communication**: COM, IR, CEC, TCP/IP, SSH protocols
- **Hardware Abstraction**: Touchpanels, I/O devices, processors
- **User Interface**: Smart objects, signal processing, SIMPL bridging
- **System Services**: Monitoring, diagnostics, device management
This analysis shows that Essentials serves as a comprehensive middleware layer, abstracting Crestron hardware complexities while providing modern software development patterns and practices.
---
*Generated: [Current Date]*
*Framework Version: PepperDash Essentials (Based on codebase analysis)*

View File

@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Version>2.4.0-local</Version>
<Version>2.18.2-local</Version>
<InformationalVersion>$(Version)</InformationalVersion>
<Authors>PepperDash Technology</Authors>
<Company>PepperDash Technology</Company>

View File

@@ -23,23 +23,32 @@
<FileName>$(TargetDir)$(TargetName).$(Version).$(TargetFramework).cpz</FileName>
</PropertyGroup>
<Target Name="DeleteCLZ" BeforeTargets="PreBuildEvent" Condition="$(ProjectType) == 'Library' And $(TargetDir) != '' And Exists($(FileName))">
<Delete Files="$(TargetDir)$(TargetName).$(Version).$(TargetFramework).clz">
<Target Name="DeleteCLZ" BeforeTargets="CoreBuild" Condition="$(ProjectType) == 'Library' And $(TargetDir) != ''">
<ItemGroup>
<OldCLZFiles Include="$(TargetDir)$(TargetName).*.$(TargetFramework).clz" />
</ItemGroup>
<Delete Files="@(OldCLZFiles)" Condition="@(OldCLZFiles) != ''">
<Output TaskParameter="DeletedFiles" ItemName="DeletedList"/>
</Delete>
<Message Text="Deleted files: '@(DeletedList)'" />
<Message Text="Deleted old CLZ files: '@(DeletedList)'" Condition="@(DeletedList) != ''" />
</Target>
<Target Name="DeleteCPZ" BeforeTargets="PreBuildEvent" Condition="$(ProjectType) == 'Program' And $(TargetDir) != '' And Exists($(FileName))">
<Delete Files="$(TargetDir)$(TargetName).$(Version).$(TargetFramework).cpz">
<Target Name="DeleteCPZ" BeforeTargets="CoreBuild" Condition="$(ProjectType) == 'Program' And $(TargetDir) != ''">
<ItemGroup>
<OldCPZFiles Include="$(TargetDir)$(TargetName).*.$(TargetFramework).cpz" />
</ItemGroup>
<Delete Files="@(OldCPZFiles)" Condition="@(OldCPZFiles) != ''">
<Output TaskParameter="DeletedFiles" ItemName="DeletedList"/>
</Delete>
<Message Text="Deleted files: '@(DeletedList)'" />
<Message Text="Deleted old CPZ files: '@(DeletedList)'" Condition="@(DeletedList) != ''" />
</Target>
<Target Name="DeleteCPLZ" BeforeTargets="PreBuildEvent" Condition="$(ProjectType) == 'ProgramLibrary' And $(TargetDir) != '' And Exists($(FileName))">
<Delete Files="$(TargetDir)$(TargetName).$(Version).$(TargetFramework).cplz">
<Target Name="DeleteCPLZ" BeforeTargets="CoreBuild" Condition="$(ProjectType) == 'ProgramLibrary' And $(TargetDir) != ''">
<ItemGroup>
<OldCPLZFiles Include="$(TargetDir)$(TargetName).*.$(TargetFramework).cplz" />
</ItemGroup>
<Delete Files="@(OldCPLZFiles)" Condition="@(OldCPLZFiles) != ''">
<Output TaskParameter="DeletedFiles" ItemName="DeletedList"/>
</Delete>
<Message Text="Deleted files: '@(DeletedList)'" />
<Message Text="Deleted old CPLZ files: '@(DeletedList)'" Condition="@(DeletedList) != ''" />
</Target>
<Target Name="CreateCPLZ" AfterTargets="Build" Condition="$(ProjectType) == 'ProgramLibrary' And $(TargetDir) != ''" DependsOnTargets="DeleteCPLZ">

View File

@@ -84,10 +84,9 @@ namespace PepperDash.Core
port.TextReceived += Port_TextReceivedStringDelimiter;
}
/// <summary>
/// Disconnects this gather from the Port's TextReceived event. This will not fire LineReceived
/// after the this call.
/// </summary>
/// <summary>
/// Stop method
/// </summary>
public void Stop()
{
Port.TextReceived -= Port_TextReceived;

View File

@@ -23,7 +23,7 @@ namespace PepperDash.Core
private CTimer DebugExpiryPeriod;
/// <summary>
/// The current debug setting
/// Gets or sets the DebugSetting
/// </summary>
public eStreamDebuggingSetting DebugSetting { get; private set; }
@@ -42,7 +42,7 @@ namespace PepperDash.Core
}
/// <summary>
/// Indicates that receive stream debugging is enabled
/// Gets or sets the RxStreamDebuggingIsEnabled
/// </summary>
public bool RxStreamDebuggingIsEnabled{ get; private set; }
@@ -65,6 +65,9 @@ namespace PepperDash.Core
/// Sets the debugging setting and if not setting to off, assumes the default of 30 mintues
/// </summary>
/// <param name="setting"></param>
/// <summary>
/// SetDebuggingWithDefaultTimeout method
/// </summary>
public void SetDebuggingWithDefaultTimeout(eStreamDebuggingSetting setting)
{
if (setting == eStreamDebuggingSetting.Off)
@@ -81,6 +84,9 @@ namespace PepperDash.Core
/// </summary>
/// <param name="setting"></param>
/// <param name="minutes"></param>
/// <summary>
/// SetDebuggingWithSpecificTimeout method
/// </summary>
public void SetDebuggingWithSpecificTimeout(eStreamDebuggingSetting setting, uint minutes)
{
if (setting == eStreamDebuggingSetting.Off)
@@ -135,6 +141,9 @@ namespace PepperDash.Core
/// The available settings for stream debugging
/// </summary>
[Flags]
/// <summary>
/// Enumeration of eStreamDebuggingSetting values
/// </summary>
public enum eStreamDebuggingSetting
{
/// <summary>

View File

@@ -6,7 +6,7 @@ using Newtonsoft.Json.Converters;
namespace PepperDash.Core
{
/// <summary>
/// Config properties that indicate how to communicate with a device for control
/// Represents a ControlPropertiesConfig
/// </summary>
public class ControlPropertiesConfig
{

View File

@@ -29,9 +29,9 @@ namespace PepperDash.Core
/// </summary>
public class GenericSocketStatusChageEventArgs : EventArgs
{
/// <summary>
///
/// </summary>
/// <summary>
/// Gets or sets the Client
/// </summary>
public ISocketStatus Client { get; private set; }
/// <summary>
@@ -60,7 +60,7 @@ namespace PepperDash.Core
public class GenericTcpServerStateChangedEventArgs : EventArgs
{
/// <summary>
///
/// Gets or sets the State
/// </summary>
public ServerState State { get; private set; }
@@ -154,7 +154,7 @@ namespace PepperDash.Core
}
/// <summary>
///
/// Gets or sets the Text
/// </summary>
public string Text { get; private set; }

View File

@@ -79,7 +79,7 @@ namespace PepperDash.Core
}
/// <summary>
/// Port on server
/// Gets or sets the Port
/// </summary>
public int Port { get; set; }
@@ -149,7 +149,7 @@ namespace PepperDash.Core
public string ConnectionFailure { get { return ClientStatus.ToString(); } }
/// <summary>
/// bool to track if auto reconnect should be set on the socket
/// Gets or sets the AutoReconnect
/// </summary>
public bool AutoReconnect { get; set; }
@@ -188,7 +188,7 @@ namespace PepperDash.Core
#region GenericSecureTcpIpClient properties
/// <summary>
/// Bool to show whether the server requires a preshared key. This is used in the DynamicTCPServer class
/// Gets or sets the SharedKeyRequired
/// </summary>
public bool SharedKeyRequired { get; set; }
@@ -207,7 +207,7 @@ namespace PepperDash.Core
}
/// <summary>
/// SharedKey is sent for varification to the server. Shared key can be any text (255 char limit in SIMPL+ Module), but must match the Shared Key on the Server module
/// Gets or sets the SharedKey
/// </summary>
public string SharedKey { get; set; }
@@ -222,7 +222,7 @@ namespace PepperDash.Core
bool IsTryingToConnect;
/// <summary>
/// Bool showing if socket is ready for communication after shared key exchange
/// Gets or sets the IsReadyForCommunication
/// </summary>
public bool IsReadyForCommunication { get; set; }
@@ -342,7 +342,7 @@ namespace PepperDash.Core
}
/// <summary>
/// Just to help S+ set the key
/// Initialize method
/// </summary>
public void Initialize(string key)
{
@@ -421,6 +421,9 @@ namespace PepperDash.Core
/// Deactivate the client
/// </summary>
/// <returns></returns>
/// <summary>
/// Deactivate method
/// </summary>
public override bool Deactivate()
{
if (_client != null)
@@ -432,7 +435,7 @@ namespace PepperDash.Core
}
/// <summary>
/// Connect Method. Will return if already connected. Will write errors if missing address, port, or unique key/name.
/// Connect method
/// </summary>
public void Connect()
{
@@ -563,7 +566,7 @@ namespace PepperDash.Core
}
/// <summary>
///
/// Disconnect method
/// </summary>
public void Disconnect()
{
@@ -586,7 +589,7 @@ namespace PepperDash.Core
}
/// <summary>
/// Does the actual disconnect business
/// DisconnectClient method
/// </summary>
public void DisconnectClient()
{
@@ -846,7 +849,7 @@ namespace PepperDash.Core
}
/// <summary>
/// General send method
/// SendText method
/// </summary>
public void SendText(string text)
{
@@ -875,7 +878,7 @@ namespace PepperDash.Core
}
/// <summary>
///
/// SendBytes method
/// </summary>
public void SendBytes(byte[] bytes)
{

View File

@@ -80,7 +80,7 @@ namespace PepperDash.Core
public string Hostname { get; set; }
/// <summary>
/// Port on server
/// Gets or sets the Port
/// </summary>
public int Port { get; set; }
@@ -113,7 +113,7 @@ namespace PepperDash.Core
}
/// <summary>
/// SharedKey is sent for varification to the server. Shared key can be any text (255 char limit in SIMPL+ Module), but must match the Shared Key on the Server module
/// Gets or sets the SharedKey
/// </summary>
public string SharedKey { get; set; }
@@ -123,7 +123,7 @@ namespace PepperDash.Core
private bool WaitingForSharedKeyResponse { get; set; }
/// <summary>
/// Defaults to 2000
/// Gets or sets the BufferSize
/// </summary>
public int BufferSize { get; set; }
@@ -336,7 +336,7 @@ namespace PepperDash.Core
#region Methods
/// <summary>
/// Just to help S+ set the key
/// Initialize method
/// </summary>
public void Initialize(string key)
{
@@ -395,7 +395,7 @@ namespace PepperDash.Core
}
/// <summary>
/// Connect Method. Will return if already connected. Will write errors if missing address, port, or unique key/name.
/// Connect method
/// </summary>
public void Connect()
{
@@ -526,7 +526,7 @@ namespace PepperDash.Core
}
/// <summary>
///
/// Disconnect method
/// </summary>
public void Disconnect()
{
@@ -804,7 +804,7 @@ namespace PepperDash.Core
}
/// <summary>
/// General send method
/// SendText method
/// </summary>
public void SendText(string text)
{
@@ -833,7 +833,7 @@ namespace PepperDash.Core
}
/// <summary>
///
/// SendBytes method
/// </summary>
public void SendBytes(byte[] bytes)
{

View File

@@ -58,7 +58,7 @@ namespace PepperDash.Core
public ServerHasChokedCallbackDelegate ServerHasChoked { get; set; }
/// <summary>
///
/// Delegate for ServerHasChokedCallbackDelegate
/// </summary>
public delegate void ServerHasChokedCallbackDelegate();
@@ -104,7 +104,7 @@ namespace PepperDash.Core
int MonitorClientFailureCount;
/// <summary>
/// 3 by default
/// Gets or sets the MonitorClientMaxFailureCount
/// </summary>
public int MonitorClientMaxFailureCount { get; set; }
@@ -190,7 +190,7 @@ namespace PepperDash.Core
}
/// <summary>
/// Port Server should listen on
/// Gets or sets the Port
/// </summary>
public int Port { get; set; }
@@ -223,8 +223,7 @@ namespace PepperDash.Core
}
/// <summary>
/// SharedKey is sent for varification to the server. Shared key can be any text (255 char limit in SIMPL+ Module), but must match the Shared Key on the Server module.
/// If SharedKey changes while server is listening or clients are connected, disconnect and stop listening will be called
/// Gets or sets the SharedKey
/// </summary>
public string SharedKey { get; set; }
@@ -248,7 +247,7 @@ namespace PepperDash.Core
}
/// <summary>
/// Milliseconds before server expects another heartbeat. Set by property HeartbeatRequiredIntervalInSeconds which is driven from S+
/// Gets or sets the HeartbeatRequiredIntervalMs
/// </summary>
public int HeartbeatRequiredIntervalMs { get; set; }
@@ -258,7 +257,7 @@ namespace PepperDash.Core
public ushort HeartbeatRequiredIntervalInSeconds { set { HeartbeatRequiredIntervalMs = (value * 1000); } }
/// <summary>
/// String to Match for heartbeat. If null or empty any string will reset heartbeat timer
/// Gets or sets the HeartbeatStringToMatch
/// </summary>
public string HeartbeatStringToMatch { get; set; }
@@ -276,7 +275,7 @@ namespace PepperDash.Core
public List<uint> ConnectedClientsIndexes = new List<uint>();
/// <summary>
/// Defaults to 2000
/// Gets or sets the BufferSize
/// </summary>
public int BufferSize { get; set; }
@@ -339,7 +338,7 @@ namespace PepperDash.Core
#region Methods - Server Actions
/// <summary>
/// Disconnects all clients and stops the server
/// KillServer method
/// </summary>
public void KillServer()
{
@@ -356,6 +355,9 @@ namespace PepperDash.Core
/// Initialize Key for device using client name from SIMPL+. Called on Listen from SIMPL+
/// </summary>
/// <param name="key"></param>
/// <summary>
/// Initialize method
/// </summary>
public void Initialize(string key)
{
Key = key;
@@ -395,7 +397,7 @@ namespace PepperDash.Core
}
/// <summary>
/// Start listening on the specified port
/// Listen method
/// </summary>
public void Listen()
{
@@ -453,7 +455,7 @@ namespace PepperDash.Core
}
/// <summary>
/// Stop Listeneing
/// StopListening method
/// </summary>
public void StopListening()
{
@@ -478,6 +480,9 @@ namespace PepperDash.Core
/// Disconnects Client
/// </summary>
/// <param name="client"></param>
/// <summary>
/// DisconnectClient method
/// </summary>
public void DisconnectClient(uint client)
{
try
@@ -491,7 +496,7 @@ namespace PepperDash.Core
}
}
/// <summary>
/// Disconnect All Clients
/// DisconnectAllClientsForShutdown method
/// </summary>
public void DisconnectAllClientsForShutdown()
{
@@ -533,6 +538,9 @@ namespace PepperDash.Core
/// Broadcast text from server to all connected clients
/// </summary>
/// <param name="text"></param>
/// <summary>
/// BroadcastText method
/// </summary>
public void BroadcastText(string text)
{
CCriticalSection CCBroadcast = new CCriticalSection();
@@ -566,6 +574,9 @@ namespace PepperDash.Core
/// </summary>
/// <param name="text"></param>
/// <param name="clientIndex"></param>
/// <summary>
/// SendTextToClient method
/// </summary>
public void SendTextToClient(string text, uint clientIndex)
{
try
@@ -634,6 +645,9 @@ namespace PepperDash.Core
/// </summary>
/// <param name="clientIndex"></param>
/// <returns></returns>
/// <summary>
/// GetClientIPAddress method
/// </summary>
public string GetClientIPAddress(uint clientIndex)
{
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "GetClientIPAddress Index: {0}", clientIndex);

View File

@@ -36,13 +36,13 @@ namespace PepperDash.Core
/// </summary>
public event EventHandler<GenericSocketStatusChageEventArgs> ConnectionChange;
///// <summary>
/// <summary>
/////
///// </summary>
//public event GenericSocketStatusChangeEventDelegate SocketStatusChange;
/// <summary>
/// Address of server
/// Gets or sets the Hostname
/// </summary>
public string Hostname { get; set; }
@@ -52,12 +52,12 @@ namespace PepperDash.Core
public int Port { get; set; }
/// <summary>
/// Username for server
/// Gets or sets the Username
/// </summary>
public string Username { get; set; }
/// <summary>
/// And... Password for server. That was worth documenting!
/// Gets or sets the Password
/// </summary>
public string Password { get; set; }
@@ -79,7 +79,7 @@ namespace PepperDash.Core
}
/// <summary>
///
/// Socket status change event
/// </summary>
public SocketStatus ClientStatus
{
@@ -123,8 +123,7 @@ namespace PepperDash.Core
}
/// <summary>
/// Millisecond value, determines the timeout period in between reconnect attempts.
/// Set to 5000 by default
/// Gets or sets the AutoReconnectIntervalMs
/// </summary>
public int AutoReconnectIntervalMs { get; set; }
@@ -147,31 +146,31 @@ namespace PepperDash.Core
base(key)
{
StreamDebugging = new CommunicationStreamDebugging(key);
CrestronEnvironment.ProgramStatusEventHandler += new ProgramStatusEventHandler(CrestronEnvironment_ProgramStatusEventHandler);
Key = key;
Hostname = hostname;
Port = port;
Username = username;
Password = password;
AutoReconnectIntervalMs = 5000;
CrestronEnvironment.ProgramStatusEventHandler += new ProgramStatusEventHandler(CrestronEnvironment_ProgramStatusEventHandler);
Key = key;
Hostname = hostname;
Port = port;
Username = username;
Password = password;
AutoReconnectIntervalMs = 5000;
ReconnectTimer = new CTimer(o =>
{
{
if (ConnectEnabled)
{
Connect();
}
}, System.Threading.Timeout.Infinite);
}
}, System.Threading.Timeout.Infinite);
}
/// <summary>
/// S+ Constructor - Must set all properties before calling Connect
/// </summary>
public GenericSshClient()
: base(SPlusKey)
{
CrestronEnvironment.ProgramStatusEventHandler += new ProgramStatusEventHandler(CrestronEnvironment_ProgramStatusEventHandler);
AutoReconnectIntervalMs = 5000;
/// <summary>
/// S+ Constructor - Must set all properties before calling Connect
/// </summary>
public GenericSshClient()
: base(SPlusKey)
{
CrestronEnvironment.ProgramStatusEventHandler += new ProgramStatusEventHandler(CrestronEnvironment_ProgramStatusEventHandler);
AutoReconnectIntervalMs = 5000;
ReconnectTimer = new CTimer(o =>
{
@@ -180,25 +179,25 @@ namespace PepperDash.Core
Connect();
}
}, System.Threading.Timeout.Infinite);
}
}
/// <summary>
/// Handles closing this up when the program shuts down
/// </summary>
void CrestronEnvironment_ProgramStatusEventHandler(eProgramStatusEventType programEventType)
{
if (programEventType == eProgramStatusEventType.Stopping)
{
if (Client != null)
{
this.LogDebug("Program stopping. Closing connection");
/// <summary>
/// Handles closing this up when the program shuts down
/// </summary>
void CrestronEnvironment_ProgramStatusEventHandler(eProgramStatusEventType programEventType)
{
if (programEventType == eProgramStatusEventType.Stopping)
{
if (Client != null)
{
this.LogDebug("Program stopping. Closing connection");
Disconnect();
}
}
}
/// <summary>
/// Connect to the server, using the provided properties.
/// Connect method
/// </summary>
public void Connect()
{
@@ -224,10 +223,7 @@ namespace PepperDash.Core
this.LogDebug("Attempting connect");
// Cancel reconnect if running.
if (ReconnectTimer != null)
{
ReconnectTimer.Stop();
}
ReconnectTimer?.Stop();
// Cleanup the old client if it already exists
if (Client != null)
@@ -269,20 +265,26 @@ namespace PepperDash.Core
if (ie is SocketException)
{
this.LogException(ie, "CONNECTION failure: Cannot reach host");
this.LogError("CONNECTION failure: Cannot reach host");
this.LogVerbose(ie, "Exception details: ");
}
if (ie is System.Net.Sockets.SocketException socketException)
{
this.LogException(ie, "Connection failure: Cannot reach {host} on {port}",
this.LogError("Connection failure: Cannot reach {host} on {port}",
Hostname, Port);
this.LogVerbose(socketException, "SocketException details: ");
}
if (ie is SshAuthenticationException)
{
this.LogException(ie, "Authentication failure for username {userName}", Username);
this.LogError("Authentication failure for username {userName}", Username);
this.LogVerbose(ie, "AuthenticationException details: ");
}
else
this.LogException(ie, "Error on connect");
{
this.LogError("Error on connect: {error}", ie.Message);
this.LogVerbose(ie, "Exception details: ");
}
DisconnectLogged = true;
KillClient(SocketStatus.SOCKET_STATUS_CONNECT_FAILED);
@@ -292,7 +294,7 @@ namespace PepperDash.Core
ReconnectTimer.Reset(AutoReconnectIntervalMs);
}
}
catch(SshOperationTimeoutException ex)
catch (SshOperationTimeoutException ex)
{
this.LogWarning("Connection attempt timed out: {message}", ex.Message);
@@ -307,7 +309,8 @@ namespace PepperDash.Core
catch (Exception e)
{
var errorLogLevel = DisconnectLogged == true ? Debug.ErrorLogLevel.None : Debug.ErrorLogLevel.Error;
this.LogException(e, "Unhandled exception on connect");
this.LogError("Unhandled exception on connect: {error}", e.Message);
this.LogVerbose(e, "Exception details: ");
DisconnectLogged = true;
KillClient(SocketStatus.SOCKET_STATUS_CONNECT_FAILED);
if (AutoReconnect)
@@ -324,18 +327,18 @@ namespace PepperDash.Core
}
}
/// <summary>
/// Disconnect the clients and put away it's resources.
/// </summary>
public void Disconnect()
{
ConnectEnabled = false;
// Stop trying reconnects, if we are
if (ReconnectTimer != null)
{
ReconnectTimer.Stop();
// ReconnectTimer = null;
}
/// <summary>
/// Disconnect method
/// </summary>
public void Disconnect()
{
ConnectEnabled = false;
// Stop trying reconnects, if we are
if (ReconnectTimer != null)
{
ReconnectTimer.Stop();
// ReconnectTimer = null;
}
KillClient(SocketStatus.SOCKET_STATUS_BROKEN_LOCALLY);
}
@@ -361,7 +364,7 @@ namespace PepperDash.Core
}
catch (Exception ex)
{
this.LogException(ex,"Exception in Kill Client");
this.LogException(ex, "Exception in Kill Client");
}
}
@@ -369,7 +372,7 @@ namespace PepperDash.Core
/// Kills the stream
/// </summary>
void KillStream()
{
{
try
{
if (TheStream != null)
@@ -385,59 +388,59 @@ namespace PepperDash.Core
{
this.LogException(ex, "Exception in Kill Stream:{0}");
}
}
}
/// <summary>
/// Handles the keyboard interactive authentication, should it be required.
/// </summary>
void kauth_AuthenticationPrompt(object sender, AuthenticationPromptEventArgs e)
{
foreach (AuthenticationPrompt prompt in e.Prompts)
if (prompt.Request.IndexOf("Password:", StringComparison.InvariantCultureIgnoreCase) != -1)
prompt.Response = Password;
}
/// <summary>
/// Handler for data receive on ShellStream. Passes data across to queue for line parsing.
/// </summary>
void Stream_DataReceived(object sender, ShellDataEventArgs e)
{
/// <summary>
/// Handles the keyboard interactive authentication, should it be required.
/// </summary>
void kauth_AuthenticationPrompt(object sender, AuthenticationPromptEventArgs e)
{
foreach (AuthenticationPrompt prompt in e.Prompts)
if (prompt.Request.IndexOf("Password:", StringComparison.InvariantCultureIgnoreCase) != -1)
prompt.Response = Password;
}
/// <summary>
/// Handler for data receive on ShellStream. Passes data across to queue for line parsing.
/// </summary>
void Stream_DataReceived(object sender, ShellDataEventArgs e)
{
if (((ShellStream)sender).Length <= 0L)
{
return;
}
var response = ((ShellStream)sender).Read();
var bytesHandler = BytesReceived;
if (bytesHandler != null)
{
var response = ((ShellStream)sender).Read();
var bytesHandler = BytesReceived;
if (bytesHandler != null)
{
var bytes = Encoding.UTF8.GetBytes(response);
if (StreamDebugging.RxStreamDebuggingIsEnabled)
{
this.LogInformation("Received {1} bytes: '{0}'", ComTextHelper.GetEscapedText(bytes), bytes.Length);
}
if (StreamDebugging.RxStreamDebuggingIsEnabled)
{
this.LogInformation("Received {1} bytes: '{0}'", ComTextHelper.GetEscapedText(bytes), bytes.Length);
}
bytesHandler(this, new GenericCommMethodReceiveBytesArgs(bytes));
}
var textHandler = TextReceived;
if (textHandler != null)
{
}
var textHandler = TextReceived;
if (textHandler != null)
{
if (StreamDebugging.RxStreamDebuggingIsEnabled)
this.LogInformation("Received: '{0}'", ComTextHelper.GetDebugText(response));
textHandler(this, new GenericCommMethodReceiveTextArgs(response));
}
}
}
/// <summary>
/// Error event handler for client events - disconnect, etc. Will forward those events via ConnectionChange
/// event
/// </summary>
void Client_ErrorOccurred(object sender, ExceptionEventArgs e)
{
/// <summary>
/// Error event handler for client events - disconnect, etc. Will forward those events via ConnectionChange
/// event
/// </summary>
void Client_ErrorOccurred(object sender, ExceptionEventArgs e)
{
CrestronInvoke.BeginInvoke(o =>
{
if (e.Exception is SshConnectionException || e.Exception is System.Net.Sockets.SocketException)
@@ -466,55 +469,54 @@ namespace PepperDash.Core
/// </summary>
void OnConnectionChange()
{
if (ConnectionChange != null)
ConnectionChange(this, new GenericSocketStatusChageEventArgs(this));
ConnectionChange?.Invoke(this, new GenericSocketStatusChageEventArgs(this));
}
#region IBasicCommunication Members
/// <summary>
/// Sends text to the server
/// </summary>
/// <param name="text"></param>
public void SendText(string text)
{
try
{
if (Client != null && TheStream != null && IsConnected)
{
if (StreamDebugging.TxStreamDebuggingIsEnabled)
this.LogInformation(
"Sending {length} characters of text: '{text}'",
text.Length,
ComTextHelper.GetDebugText(text));
TheStream.Write(text);
TheStream.Flush();
}
else
{
this.LogDebug("Client is null or disconnected. Cannot Send Text");
}
}
catch (ObjectDisposedException)
/// <summary>
/// Sends text to the server
/// </summary>
/// <param name="text">The text to send</param>
public void SendText(string text)
{
try
{
this.LogError("ObjectDisposedException sending '{message}'. Restarting connection...", text.Trim());
if (Client != null && TheStream != null && IsConnected)
{
if (StreamDebugging.TxStreamDebuggingIsEnabled)
this.LogInformation(
"Sending {length} characters of text: '{text}'",
text.Length,
ComTextHelper.GetDebugText(text));
TheStream.Write(text);
TheStream.Flush();
}
else
{
this.LogDebug("Client is null or disconnected. Cannot Send Text");
}
}
catch (ObjectDisposedException)
{
this.LogError("ObjectDisposedException sending '{message}'. Restarting connection...", text.Trim());
KillClient(SocketStatus.SOCKET_STATUS_CONNECT_FAILED);
ReconnectTimer.Reset();
}
catch (Exception ex)
{
}
catch (Exception ex)
{
this.LogException(ex, "Exception sending text: '{message}'", text);
}
}
}
}
/// <summary>
/// Sends Bytes to the server
/// </summary>
/// <param name="bytes"></param>
public void SendBytes(byte[] bytes)
{
/// <param name="bytes">The bytes to send</param>
public void SendBytes(byte[] bytes)
{
try
{
if (Client != null && TheStream != null && IsConnected)
@@ -540,38 +542,38 @@ namespace PepperDash.Core
catch (Exception ex)
{
this.LogException(ex, "Exception sending {message}", ComTextHelper.GetEscapedText(bytes));
}
}
#endregion
}
}
#endregion
}
}
//*****************************************************************************************************
//*****************************************************************************************************
/// <summary>
/// Fired when connection changes
/// </summary>
public class SshConnectionChangeEventArgs : EventArgs
{
//*****************************************************************************************************
//*****************************************************************************************************
/// <summary>
/// Represents a SshConnectionChangeEventArgs
/// </summary>
public class SshConnectionChangeEventArgs : EventArgs
{
/// <summary>
/// Connection State
/// </summary>
public bool IsConnected { get; private set; }
/// <summary>
/// Connection Status represented as a ushort
/// Gets or sets the UIsConnected
/// </summary>
public ushort UIsConnected { get { return (ushort)(Client.IsConnected ? 1 : 0); } }
public ushort UIsConnected { get { return (ushort)(Client.IsConnected ? 1 : 0); } }
/// <summary>
/// The client
/// Gets or sets the Client
/// </summary>
public GenericSshClient Client { get; private set; }
public GenericSshClient Client { get; private set; }
/// <summary>
/// Socket Status as represented by
/// Gets or sets the Status
/// </summary>
public ushort Status { get { return Client.UStatus; } }
public ushort Status { get { return Client.UStatus; } }
/// <summary>
/// S+ Constructor

View File

@@ -59,7 +59,7 @@ namespace PepperDash.Core
}
/// <summary>
/// Port on server
/// Gets or sets the Port
/// </summary>
public int Port { get; set; }
@@ -135,9 +135,9 @@ namespace PepperDash.Core
/// </summary>
public string ConnectionFailure { get { return ClientStatus.ToString(); } }
/// <summary>
/// bool to track if auto reconnect should be set on the socket
/// </summary>
/// <summary>
/// Gets or sets the AutoReconnect
/// </summary>
public bool AutoReconnect { get; set; }
/// <summary>
@@ -232,7 +232,7 @@ namespace PepperDash.Core
}
/// <summary>
/// Just to help S+ set the key
/// Initialize method
/// </summary>
public void Initialize(string key)
{
@@ -255,6 +255,9 @@ namespace PepperDash.Core
///
/// </summary>
/// <returns></returns>
/// <summary>
/// Deactivate method
/// </summary>
public override bool Deactivate()
{
RetryTimer.Stop();
@@ -267,9 +270,9 @@ namespace PepperDash.Core
return true;
}
/// <summary>
/// Attempts to connect to the server
/// </summary>
/// <summary>
/// Connect method
/// </summary>
public void Connect()
{
if (string.IsNullOrEmpty(Hostname))
@@ -334,9 +337,9 @@ namespace PepperDash.Core
}
}
/// <summary>
/// Attempts to disconnect the client
/// </summary>
/// <summary>
/// Disconnect method
/// </summary>
public void Disconnect()
{
try
@@ -355,7 +358,7 @@ namespace PepperDash.Core
}
/// <summary>
/// Does the actual disconnect business
/// DisconnectClient method
/// </summary>
public void DisconnectClient()
{
@@ -446,9 +449,9 @@ namespace PepperDash.Core
}
}
/// <summary>
/// General send method
/// </summary>
/// <summary>
/// SendText method
/// </summary>
public void SendText(string text)
{
var bytes = Encoding.GetEncoding(28591).GetBytes(text);
@@ -459,9 +462,9 @@ namespace PepperDash.Core
_client.SendData(bytes, bytes.Length);
}
/// <summary>
/// This is useful from console and...?
/// </summary>
/// <summary>
/// SendEscapedText method
/// </summary>
public void SendEscapedText(string text)
{
var unescapedText = Regex.Replace(text, @"\\x([0-9a-fA-F][0-9a-fA-F])", s =>
@@ -476,6 +479,9 @@ namespace PepperDash.Core
/// Sends Bytes to the server
/// </summary>
/// <param name="bytes"></param>
/// <summary>
/// SendBytes method
/// </summary>
public void SendBytes(byte[] bytes)
{
if (StreamDebugging.TxStreamDebuggingIsEnabled)
@@ -508,9 +514,9 @@ namespace PepperDash.Core
}
}
/// <summary>
/// Configuration properties for TCP/SSH Connections
/// </summary>
/// <summary>
/// Represents a TcpSshPropertiesConfig
/// </summary>
public class TcpSshPropertiesConfig
{
/// <summary>
@@ -529,9 +535,9 @@ namespace PepperDash.Core
/// Username credential
/// </summary>
public string Username { get; set; }
/// <summary>
/// Passord credential
/// </summary>
/// <summary>
/// Gets or sets the Password
/// </summary>
public string Password { get; set; }
/// <summary>
@@ -539,14 +545,14 @@ namespace PepperDash.Core
/// </summary>
public int BufferSize { get; set; }
/// <summary>
/// Defaults to true
/// </summary>
/// <summary>
/// Gets or sets the AutoReconnect
/// </summary>
public bool AutoReconnect { get; set; }
/// <summary>
/// Defaults to 5000ms
/// </summary>
/// <summary>
/// Gets or sets the AutoReconnectIntervalMs
/// </summary>
public int AutoReconnectIntervalMs { get; set; }
/// <summary>

View File

@@ -69,7 +69,7 @@ namespace PepperDash.Core
public string Hostname { get; set; }
/// <summary>
/// Port on server
/// Gets or sets the Port
/// </summary>
public int Port { get; set; }
@@ -102,7 +102,7 @@ namespace PepperDash.Core
}
/// <summary>
/// SharedKey is sent for varification to the server. Shared key can be any text (255 char limit in SIMPL+ Module), but must match the Shared Key on the Server module
/// Gets or sets the SharedKey
/// </summary>
public string SharedKey { get; set; }
@@ -112,7 +112,7 @@ namespace PepperDash.Core
private bool WaitingForSharedKeyResponse { get; set; }
/// <summary>
/// Defaults to 2000
/// Gets or sets the BufferSize
/// </summary>
public int BufferSize { get; set; }
@@ -289,7 +289,7 @@ namespace PepperDash.Core
#region Methods
/// <summary>
/// Just to help S+ set the key
/// Initialize method
/// </summary>
public void Initialize(string key)
{
@@ -311,7 +311,7 @@ namespace PepperDash.Core
}
/// <summary>
/// Connect Method. Will return if already connected. Will write errors if missing address, port, or unique key/name.
/// Connect method
/// </summary>
public void Connect()
{
@@ -442,7 +442,7 @@ namespace PepperDash.Core
}
/// <summary>
///
/// Disconnect method
/// </summary>
public void Disconnect()
{
@@ -669,7 +669,7 @@ namespace PepperDash.Core
}
/// <summary>
/// General send method
/// SendText method
/// </summary>
public void SendText(string text)
{
@@ -698,7 +698,7 @@ namespace PepperDash.Core
}
/// <summary>
///
/// SendBytes method
/// </summary>
public void SendBytes(byte[] bytes)
{

View File

@@ -52,7 +52,7 @@ namespace PepperDash.Core
public ServerHasChokedCallbackDelegate ServerHasChoked { get; set; }
/// <summary>
///
/// Delegate for ServerHasChokedCallbackDelegate
/// </summary>
public delegate void ServerHasChokedCallbackDelegate();
@@ -82,7 +82,7 @@ namespace PepperDash.Core
int MonitorClientFailureCount;
/// <summary>
/// 3 by default
/// Gets or sets the MonitorClientMaxFailureCount
/// </summary>
public int MonitorClientMaxFailureCount { get; set; }
@@ -171,7 +171,7 @@ namespace PepperDash.Core
}
/// <summary>
/// Port Server should listen on
/// Gets or sets the Port
/// </summary>
public int Port { get; set; }
@@ -204,8 +204,7 @@ namespace PepperDash.Core
}
/// <summary>
/// SharedKey is sent for varification to the server. Shared key can be any text (255 char limit in SIMPL+ Module), but must match the Shared Key on the Server module.
/// If SharedKey changes while server is listening or clients are connected, disconnect and stop listening will be called
/// Gets or sets the SharedKey
/// </summary>
public string SharedKey { get; set; }
@@ -229,7 +228,7 @@ namespace PepperDash.Core
}
/// <summary>
/// Milliseconds before server expects another heartbeat. Set by property HeartbeatRequiredIntervalInSeconds which is driven from S+
/// Gets or sets the HeartbeatRequiredIntervalMs
/// </summary>
public int HeartbeatRequiredIntervalMs { get; set; }
@@ -239,7 +238,7 @@ namespace PepperDash.Core
public ushort HeartbeatRequiredIntervalInSeconds { set { HeartbeatRequiredIntervalMs = (value * 1000); } }
/// <summary>
/// String to Match for heartbeat. If null or empty any string will reset heartbeat timer
/// Gets or sets the HeartbeatStringToMatch
/// </summary>
public string HeartbeatStringToMatch { get; set; }
@@ -257,7 +256,7 @@ namespace PepperDash.Core
public List<uint> ConnectedClientsIndexes = new List<uint>();
/// <summary>
/// Defaults to 2000
/// Gets or sets the BufferSize
/// </summary>
public int BufferSize { get; set; }
@@ -320,7 +319,7 @@ namespace PepperDash.Core
#region Methods - Server Actions
/// <summary>
/// Disconnects all clients and stops the server
/// KillServer method
/// </summary>
public void KillServer()
{
@@ -337,6 +336,9 @@ namespace PepperDash.Core
/// Initialize Key for device using client name from SIMPL+. Called on Listen from SIMPL+
/// </summary>
/// <param name="key"></param>
/// <summary>
/// Initialize method
/// </summary>
public void Initialize(string key)
{
Key = key;
@@ -375,7 +377,7 @@ namespace PepperDash.Core
}
/// <summary>
/// Start listening on the specified port
/// Listen method
/// </summary>
public void Listen()
{
@@ -432,7 +434,7 @@ namespace PepperDash.Core
}
/// <summary>
/// Stop Listening
/// StopListening method
/// </summary>
public void StopListening()
{
@@ -457,6 +459,9 @@ namespace PepperDash.Core
/// Disconnects Client
/// </summary>
/// <param name="client"></param>
/// <summary>
/// DisconnectClient method
/// </summary>
public void DisconnectClient(uint client)
{
try
@@ -470,7 +475,7 @@ namespace PepperDash.Core
}
}
/// <summary>
/// Disconnect All Clients
/// DisconnectAllClientsForShutdown method
/// </summary>
public void DisconnectAllClientsForShutdown()
{
@@ -512,6 +517,9 @@ namespace PepperDash.Core
/// Broadcast text from server to all connected clients
/// </summary>
/// <param name="text"></param>
/// <summary>
/// BroadcastText method
/// </summary>
public void BroadcastText(string text)
{
CCriticalSection CCBroadcast = new CCriticalSection();
@@ -545,6 +553,9 @@ namespace PepperDash.Core
/// </summary>
/// <param name="text"></param>
/// <param name="clientIndex"></param>
/// <summary>
/// SendTextToClient method
/// </summary>
public void SendTextToClient(string text, uint clientIndex)
{
try
@@ -613,6 +624,9 @@ namespace PepperDash.Core
/// </summary>
/// <param name="clientIndex"></param>
/// <returns>IP address of the client</returns>
/// <summary>
/// GetClientIPAddress method
/// </summary>
public string GetClientIPAddress(uint clientIndex)
{
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "GetClientIPAddress Index: {0}", clientIndex);

View File

@@ -131,14 +131,14 @@ namespace PepperDash.Core
/// <param name="key"></param>
/// <param name="address"></param>
/// <param name="port"></param>
/// <param name="buffefSize"></param>
public GenericUdpServer(string key, string address, int port, int buffefSize)
/// <param name="bufferSize"></param>
public GenericUdpServer(string key, string address, int port, int bufferSize)
: base(key)
{
StreamDebugging = new CommunicationStreamDebugging(key);
Hostname = address;
Port = port;
BufferSize = buffefSize;
BufferSize = bufferSize;
CrestronEnvironment.ProgramStatusEventHandler += new ProgramStatusEventHandler(CrestronEnvironment_ProgramStatusEventHandler);
CrestronEnvironment.EthernetEventHandler += new EthernetEventHandler(CrestronEnvironment_EthernetEventHandler);
@@ -150,6 +150,9 @@ namespace PepperDash.Core
/// <param name="key"></param>
/// <param name="address"></param>
/// <param name="port"></param>
/// <summary>
/// Initialize method
/// </summary>
public void Initialize(string key, string address, ushort port)
{
Key = key;
@@ -185,13 +188,27 @@ namespace PepperDash.Core
}
/// <summary>
/// Enables the UDP Server
/// Connect method
/// </summary>
public void Connect()
{
if (Server == null)
{
Server = new UDPServer();
try
{
var address = IPAddress.Parse(Hostname);
Server = new UDPServer(address, Port, BufferSize);
}
catch (Exception ex)
{
this.LogError("Error parsing IP Address '{ipAddress}': message: {message}", Hostname, ex.Message);
this.LogInformation("Creating UDPServer with default buffersize");
Server = new UDPServer();
}
}
if (string.IsNullOrEmpty(Hostname))
@@ -222,7 +239,7 @@ namespace PepperDash.Core
}
/// <summary>
/// Disabled the UDP Server
/// Disconnect method
/// </summary>
public void Disconnect()
{
@@ -292,6 +309,9 @@ namespace PepperDash.Core
/// General send method
/// </summary>
/// <param name="text"></param>
/// <summary>
/// SendText method
/// </summary>
public void SendText(string text)
{
var bytes = Encoding.GetEncoding(28591).GetBytes(text);
@@ -309,6 +329,9 @@ namespace PepperDash.Core
///
/// </summary>
/// <param name="bytes"></param>
/// <summary>
/// SendBytes method
/// </summary>
public void SendBytes(byte[] bytes)
{
if (StreamDebugging.TxStreamDebuggingIsEnabled)
@@ -320,9 +343,9 @@ namespace PepperDash.Core
}
/// <summary>
///
/// </summary>
/// <summary>
/// Represents a GenericUdpReceiveTextExtraArgs
/// </summary>
public class GenericUdpReceiveTextExtraArgs : EventArgs
{
/// <summary>

View File

@@ -3,7 +3,7 @@
namespace PepperDash.Core
{
/// <summary>
/// Client config object for TCP client with server that inherits from TcpSshPropertiesConfig and adds properties for shared key and heartbeat
/// Represents a TcpClientConfigObject
/// </summary>
public class TcpClientConfigObject
{

View File

@@ -74,6 +74,14 @@ namespace PepperDash.Core
/// <summary>
/// Secure TCP/IP
/// </summary>
SecureTcpIp
SecureTcpIp,
/// <summary>
/// Used when comms needs to be handled in SIMPL and bridged opposite the normal direction
/// </summary>
ComBridge,
/// <summary>
/// InfinetEX control
/// </summary>
InfinetEx
}
}

View File

@@ -38,9 +38,9 @@ namespace PepperDash.Core
void Disconnect();
}
/// <summary>
/// Represents a device that uses basic connection
/// </summary>
/// <summary>
/// Defines the contract for IBasicCommunication
/// </summary>
public interface IBasicCommunication : ICommunicationReceiver
{
/// <summary>
@@ -147,9 +147,9 @@ namespace PepperDash.Core
/// </summary>
public class GenericCommMethodReceiveBytesArgs : EventArgs
{
/// <summary>
///
/// </summary>
/// <summary>
/// Gets or sets the Bytes
/// </summary>
public byte[] Bytes { get; private set; }
/// <summary>
@@ -228,6 +228,9 @@ namespace PepperDash.Core
/// </summary>
/// <param name="text"></param>
/// <returns></returns>
/// <summary>
/// GetEscapedText method
/// </summary>
public static string GetEscapedText(string text)
{
var bytes = Encoding.GetEncoding(28591).GetBytes(text);
@@ -239,6 +242,9 @@ namespace PepperDash.Core
/// </summary>
/// <param name="text"></param>
/// <returns></returns>
/// <summary>
/// GetDebugText method
/// </summary>
public static string GetDebugText(string text)
{
return Regex.Replace(text, @"[^\u0020-\u007E]", a => GetEscapedText(a.Value));

View File

@@ -9,40 +9,59 @@ using Serilog.Events;
namespace PepperDash.Core.Config
{
/// <summary>
/// Reads a Portal formatted config file
/// </summary>
public class PortalConfigReader
{
/// <summary>
/// Reads the config file, checks if it needs a merge, merges and saves, then returns the merged Object.
/// </summary>
/// <returns>JObject of config file</returns>
public static void ReadAndMergeFileIfNecessary(string filePath, string savePath)
const string template = "template";
const string system = "system";
const string systemUrl = "system_url";
const string templateUrl = "template_url";
const string info = "info";
const string devices = "devices";
const string rooms = "rooms";
const string sourceLists = "sourceLists";
const string destinationLists = "destinationLists";
const string cameraLists = "cameraLists";
const string audioControlPointLists = "audioControlPointLists";
const string tieLines = "tieLines";
const string joinMaps = "joinMaps";
const string global = "global";
/// <summary>
/// Reads the config file, checks if it needs a merge, merges and saves, then returns the merged Object.
/// </summary>
/// <returns>JObject of config file</returns>
public static void ReadAndMergeFileIfNecessary(string filePath, string savePath)
{
try
{
if (!File.Exists(filePath))
{
Debug.Console(1, Debug.ErrorLogLevel.Error,
Debug.LogError(
"ERROR: Configuration file not present. Please load file to {0} and reset program", filePath);
}
using (StreamReader fs = new StreamReader(filePath))
{
var jsonObj = JObject.Parse(fs.ReadToEnd());
if(jsonObj["template"] != null && jsonObj["system"] != null)
if(jsonObj[template] != null && jsonObj[system] != null)
{
// it's a double-config, merge it.
var merged = MergeConfigs(jsonObj);
if (jsonObj["system_url"] != null)
if (jsonObj[systemUrl] != null)
{
merged["systemUrl"] = jsonObj["system_url"].Value<string>();
merged[systemUrl] = jsonObj[systemUrl].Value<string>();
}
if (jsonObj["template_url"] != null)
if (jsonObj[templateUrl] != null)
{
merged["templateUrl"] = jsonObj["template_url"].Value<string>();
merged[templateUrl] = jsonObj[templateUrl].Value<string>();
}
jsonObj = merged;
@@ -67,6 +86,9 @@ namespace PepperDash.Core.Config
/// </summary>
/// <param name="doubleConfig"></param>
/// <returns></returns>
/// <summary>
/// MergeConfigs method
/// </summary>
public static JObject MergeConfigs(JObject doubleConfig)
{
var system = JObject.FromObject(doubleConfig["system"]);
@@ -74,62 +96,62 @@ namespace PepperDash.Core.Config
var merged = new JObject();
// Put together top-level objects
if (system["info"] != null)
merged.Add("info", Merge(template["info"], system["info"], "infO"));
if (system[info] != null)
merged.Add(info, Merge(template[info], system[info], info));
else
merged.Add("info", template["info"]);
merged.Add(info, template[info]);
merged.Add("devices", MergeArraysOnTopLevelProperty(template["devices"] as JArray,
system["devices"] as JArray, "key", "devices"));
merged.Add(devices, MergeArraysOnTopLevelProperty(template[devices] as JArray,
system[devices] as JArray, "key", devices));
if (system["rooms"] == null)
merged.Add("rooms", template["rooms"]);
if (system[rooms] == null)
merged.Add(rooms, template[rooms]);
else
merged.Add("rooms", MergeArraysOnTopLevelProperty(template["rooms"] as JArray,
system["rooms"] as JArray, "key", "rooms"));
merged.Add(rooms, MergeArraysOnTopLevelProperty(template[rooms] as JArray,
system[rooms] as JArray, "key", rooms));
if (system["sourceLists"] == null)
merged.Add("sourceLists", template["sourceLists"]);
if (system[sourceLists] == null)
merged.Add(sourceLists, template[sourceLists]);
else
merged.Add("sourceLists", Merge(template["sourceLists"], system["sourceLists"], "sourceLists"));
merged.Add(sourceLists, Merge(template[sourceLists], system[sourceLists], sourceLists));
if (system["destinationLists"] == null)
merged.Add("destinationLists", template["destinationLists"]);
if (system[destinationLists] == null)
merged.Add(destinationLists, template[destinationLists]);
else
merged.Add("destinationLists",
Merge(template["destinationLists"], system["destinationLists"], "destinationLists"));
merged.Add(destinationLists,
Merge(template[destinationLists], system[destinationLists], destinationLists));
if (system["cameraLists"] == null)
merged.Add("cameraLists", template["cameraLists"]);
if (system[cameraLists] == null)
merged.Add(cameraLists, template[cameraLists]);
else
merged.Add("cameraLists", Merge(template["cameraLists"], system["cameraLists"], "cameraLists"));
merged.Add(cameraLists, Merge(template[cameraLists], system[cameraLists], cameraLists));
if (system["audioControlPointLists"] == null)
merged.Add("audioControlPointLists", template["audioControlPointLists"]);
if (system[audioControlPointLists] == null)
merged.Add(audioControlPointLists, template[audioControlPointLists]);
else
merged.Add("audioControlPointLists",
Merge(template["audioControlPointLists"], system["audioControlPointLists"], "audioControlPointLists"));
merged.Add(audioControlPointLists,
Merge(template[audioControlPointLists], system[audioControlPointLists], audioControlPointLists));
// Template tie lines take precedence. Config tool doesn't do them at system
// level anyway...
if (template["tieLines"] != null)
merged.Add("tieLines", template["tieLines"]);
else if (system["tieLines"] != null)
merged.Add("tieLines", system["tieLines"]);
if (template[tieLines] != null)
merged.Add(tieLines, template[tieLines]);
else if (system[tieLines] != null)
merged.Add(tieLines, system[tieLines]);
else
merged.Add("tieLines", new JArray());
merged.Add(tieLines, new JArray());
if (template["joinMaps"] != null)
merged.Add("joinMaps", template["joinMaps"]);
if (template[joinMaps] != null)
merged.Add(joinMaps, template[joinMaps]);
else
merged.Add("joinMaps", new JObject());
merged.Add(joinMaps, new JObject());
if (system["global"] != null)
merged.Add("global", Merge(template["global"], system["global"], "global"));
if (system[global] != null)
merged.Add(global, Merge(template[global], system[global], global));
else
merged.Add("global", template["global"]);
merged.Add(global, template[global]);
//Debug.Console(2, "MERGED CONFIG RESULT: \x0d\x0a{0}", merged);
return merged;
@@ -225,7 +247,7 @@ namespace PepperDash.Core.Config
}
catch (Exception e)
{
Debug.Console(1, Debug.ErrorLogLevel.Warning, "Cannot merge items at path {0}: \r{1}", propPath, e);
Debug.LogError($"Cannot merge items at path {propPath}: \r{e}");
}
}
}

View File

@@ -6,13 +6,22 @@ using Crestron.SimplSharp;
namespace PepperDash.Core
{
/// <summary>
/// Represents a EncodingHelper
/// </summary>
public class EncodingHelper
{
/// <summary>
/// ConvertUtf8ToAscii method
/// </summary>
public static string ConvertUtf8ToAscii(string utf8String)
{
return Encoding.ASCII.GetString(Encoding.UTF8.GetBytes(utf8String), 0, utf8String.Length);
}
/// <summary>
/// ConvertUtf8ToUtf16 method
/// </summary>
public static string ConvertUtf8ToUtf16(string utf8String)
{
return Encoding.Unicode.GetString(Encoding.UTF8.GetBytes(utf8String), 0, utf8String.Length);

View File

@@ -5,9 +5,9 @@ using Serilog.Events;
namespace PepperDash.Core
{
//*********************************************************************************************************
/// <summary>
/// The core event and status-bearing class that most if not all device and connectors can derive from.
/// </summary>
/// <summary>
/// Represents a Device
/// </summary>
public class Device : IKeyName
{
@@ -15,23 +15,23 @@ namespace PepperDash.Core
/// Unique Key
/// </summary>
public string Key { get; protected set; }
/// <summary>
/// Name of the devie
/// </summary>
/// <summary>
/// Gets or sets the Name
/// </summary>
public string Name { get; protected set; }
/// <summary>
///
/// </summary>
public bool Enabled { get; protected set; }
///// <summary>
///// A place to store reference to the original config object, if any. These values should
///// NOT be used as properties on the device as they are all publicly-settable values.
///// </summary>
/// <summary>
/// A place to store reference to the original config object, if any. These values should
/// NOT be used as properties on the device as they are all publicly-settable values.
/// </summary>
//public DeviceConfig Config { get; private set; }
///// <summary>
///// Helper method to check if Config exists
///// </summary>
/// <summary>
/// Helper method to check if Config exists
/// </summary>
//public bool HasConfig { get { return Config != null; } }
List<Action> _PreActivationActions;
@@ -86,6 +86,9 @@ namespace PepperDash.Core
/// Adds a post activation action
/// </summary>
/// <param name="act"></param>
/// <summary>
/// AddPostActivationAction method
/// </summary>
public void AddPostActivationAction(Action act)
{
if (_PostActivationActions == null)
@@ -93,9 +96,9 @@ namespace PepperDash.Core
_PostActivationActions.Add(act);
}
/// <summary>
/// Executes the preactivation actions
/// </summary>
/// <summary>
/// PreActivate method
/// </summary>
public void PreActivate()
{
if (_PreActivationActions != null)
@@ -112,11 +115,9 @@ namespace PepperDash.Core
});
}
/// <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>
/// <summary>
/// Activate method
/// </summary>
public bool Activate()
{
//if (_PreActivationActions != null)
@@ -127,9 +128,9 @@ namespace PepperDash.Core
return result;
}
/// <summary>
/// Executes the postactivation actions
/// </summary>
/// <summary>
/// PostActivate method
/// </summary>
public void PostActivate()
{
if (_PostActivationActions != null)
@@ -152,6 +153,9 @@ namespace PepperDash.Core
/// do not need to call base.CustomActivate()
/// </summary>
/// <returns>true if device activated successfully.</returns>
/// <summary>
/// CustomActivate method
/// </summary>
public virtual bool CustomActivate() { return true; }
/// <summary>
@@ -178,12 +182,15 @@ namespace PepperDash.Core
if (o is bool && !(bool)o) a();
}
/// <summary>
/// Returns a string representation of the object, including its key and name.
/// </summary>
/// <remarks>The returned string is formatted as "{Key} - {Name}". If the <c>Name</c> property is
/// null or empty, "---" is used in place of the name.</remarks>
/// <summary>
/// Returns a string representation of the object, including its key and name.
/// </summary>
/// <remarks>The returned string is formatted as "{Key} - {Name}". If the <c>Name</c> property is
/// null or empty, "---" is used in place of the name.</remarks>
/// <returns>A string that represents the object, containing the key and name in the format "{Key} - {Name}".</returns>
/// <summary>
/// ToString method
/// </summary>
public override string ToString()
{
return string.Format("{0} - {1}", Key, string.IsNullOrEmpty(Name) ? "---" : Name);

View File

@@ -4,9 +4,9 @@ using Serilog.Events;
namespace PepperDash.Core
{
/// <summary>
/// Class to help with accessing values from the CrestronEthernetHelper class
/// </summary>
/// <summary>
/// Represents a EthernetHelper
/// </summary>
public class EthernetHelper
{
/// <summary>
@@ -24,9 +24,9 @@ namespace PepperDash.Core
// ADD OTHER HELPERS HERE
/// <summary>
///
/// </summary>
/// <summary>
/// Gets or sets the PortNumber
/// </summary>
public int PortNumber { get; private set; }
private EthernetHelper(int portNumber)

View File

@@ -16,19 +16,19 @@ namespace PepperDash.Core
/// </summary>
public bool State { get; set; }
/// <summary>
/// Boolean ushort value property
/// </summary>
/// <summary>
/// Gets or sets the IntValue
/// </summary>
public ushort IntValue { get { return (ushort)(State ? 1 : 0); } }
/// <summary>
/// Boolean change event args type
/// </summary>
/// <summary>
/// Gets or sets the Type
/// </summary>
public ushort Type { get; set; }
/// <summary>
/// Boolean change event args index
/// </summary>
/// <summary>
/// Gets or sets the Index
/// </summary>
public ushort Index { get; set; }
/// <summary>
@@ -64,9 +64,9 @@ namespace PepperDash.Core
}
}
/// <summary>
/// Ushort change event args
/// </summary>
/// <summary>
/// Represents a UshrtChangeEventArgs
/// </summary>
public class UshrtChangeEventArgs : EventArgs
{
/// <summary>
@@ -74,14 +74,14 @@ namespace PepperDash.Core
/// </summary>
public ushort IntValue { get; set; }
/// <summary>
/// Ushort change event args type
/// </summary>
/// <summary>
/// Gets or sets the Type
/// </summary>
public ushort Type { get; set; }
/// <summary>
/// Ushort change event args index
/// </summary>
/// <summary>
/// Gets or sets the Index
/// </summary>
public ushort Index { get; set; }
/// <summary>
@@ -117,9 +117,9 @@ namespace PepperDash.Core
}
}
/// <summary>
/// String change event args
/// </summary>
/// <summary>
/// Represents a StringChangeEventArgs
/// </summary>
public class StringChangeEventArgs : EventArgs
{
/// <summary>
@@ -127,14 +127,14 @@ namespace PepperDash.Core
/// </summary>
public string StringValue { get; set; }
/// <summary>
/// String change event args type
/// </summary>
/// <summary>
/// Gets or sets the Type
/// </summary>
public ushort Type { get; set; }
/// <summary>
/// string change event args index
/// </summary>
/// <summary>
/// Gets or sets the Index
/// </summary>
public ushort Index { get; set; }
/// <summary>

View File

@@ -32,14 +32,14 @@ namespace PepperDash.Core.JsonStandardObjects
/// </summary>
public DeviceConfig Device { get; set; }
/// <summary>
/// Device change event args type
/// </summary>
/// <summary>
/// Gets or sets the Type
/// </summary>
public ushort Type { get; set; }
/// <summary>
/// Device change event args index
/// </summary>
/// <summary>
/// Gets or sets the Index
/// </summary>
public ushort Index { get; set; }
/// <summary>

View File

@@ -58,6 +58,9 @@ namespace PepperDash.Core.JsonStandardObjects
/// </summary>
/// <param name="uniqueID"></param>
/// <param name="deviceKey"></param>
/// <summary>
/// Initialize method
/// </summary>
public void Initialize(string uniqueID, string deviceKey)
{
// S+ set EvaluateFb low

View File

@@ -47,14 +47,14 @@ namespace PepperDash.Core.JsonStandardObjects
]
}
*/
/// <summary>
/// Device communication parameter class
/// </summary>
/// <summary>
/// Represents a ComParamsConfig
/// </summary>
public class ComParamsConfig
{
/// <summary>
///
/// </summary>
/// <summary>
/// Gets or sets the baudRate
/// </summary>
public int baudRate { get; set; }
/// <summary>
///
@@ -86,13 +86,13 @@ namespace PepperDash.Core.JsonStandardObjects
public int pacing { get; set; }
// convert properties for simpl
/// <summary>
///
/// </summary>
/// <summary>
/// Gets or sets the simplBaudRate
/// </summary>
public ushort simplBaudRate { get { return Convert.ToUInt16(baudRate); } }
/// <summary>
///
/// </summary>
/// <summary>
/// Gets or sets the simplDataBits
/// </summary>
public ushort simplDataBits { get { return Convert.ToUInt16(dataBits); } }
/// <summary>
///
@@ -143,13 +143,13 @@ namespace PepperDash.Core.JsonStandardObjects
public int autoReconnectIntervalMs { get; set; }
// convert properties for simpl
/// <summary>
///
/// </summary>
/// <summary>
/// Gets or sets the simplPort
/// </summary>
public ushort simplPort { get { return Convert.ToUInt16(port); } }
/// <summary>
///
/// </summary>
/// <summary>
/// Gets or sets the simplAutoReconnect
/// </summary>
public ushort simplAutoReconnect { get { return (ushort)(autoReconnect ? 1 : 0); } }
/// <summary>
///
@@ -192,9 +192,9 @@ namespace PepperDash.Core.JsonStandardObjects
public TcpSshPropertiesConfig tcpSshProperties { get; set; }
// convert properties for simpl
/// <summary>
///
/// </summary>
/// <summary>
/// Gets or sets the simplControlPortNumber
/// </summary>
public ushort simplControlPortNumber { get { return Convert.ToUInt16(controlPortNumber); } }
/// <summary>
@@ -207,9 +207,9 @@ namespace PepperDash.Core.JsonStandardObjects
}
}
/// <summary>
/// Device properties class
/// </summary>
/// <summary>
/// Represents a PropertiesConfig
/// </summary>
public class PropertiesConfig
{
/// <summary>
@@ -226,13 +226,13 @@ namespace PepperDash.Core.JsonStandardObjects
public ControlConfig control { get; set; }
// convert properties for simpl
/// <summary>
///
/// </summary>
/// <summary>
/// Gets or sets the simplDeviceId
/// </summary>
public ushort simplDeviceId { get { return Convert.ToUInt16(deviceId); } }
/// <summary>
///
/// </summary>
/// <summary>
/// Gets or sets the simplEnabled
/// </summary>
public ushort simplEnabled { get { return (ushort)(enabled ? 1 : 0); } }
/// <summary>

View File

@@ -88,9 +88,9 @@ namespace PepperDash.Core.JsonToSimpl
/// </summary>
public class SPlusValueWrapper
{
/// <summary>
///
/// </summary>
/// <summary>
/// Gets or sets the ValueType
/// </summary>
public SPlusType ValueType { get; private set; }
/// <summary>
///
@@ -122,9 +122,9 @@ namespace PepperDash.Core.JsonToSimpl
}
}
/// <summary>
/// S+ types enum
/// </summary>
/// <summary>
/// Enumeration of SPlusType values
/// </summary>
public enum SPlusType
{
/// <summary>

View File

@@ -23,6 +23,9 @@ namespace PepperDash.Core.JsonToSimpl
/// </summary>
/// <param name="master">New master to add</param>
///
/// <summary>
/// AddMaster method
/// </summary>
public static void AddMaster(JsonToSimplMaster master)
{
if (master == null)
@@ -49,9 +52,9 @@ namespace PepperDash.Core.JsonToSimpl
}
}
/// <summary>
/// Gets a master by its key. Case-insensitive
/// </summary>
/// <summary>
/// GetMasterByFile method
/// </summary>
public static JsonToSimplMaster GetMasterByFile(string file)
{
return Masters.FirstOrDefault(m => m.UniqueID.Equals(file, StringComparison.OrdinalIgnoreCase));

View File

@@ -5,9 +5,9 @@ using Serilog.Events;
namespace PepperDash.Core.JsonToSimpl
{
/// <summary>
/// Used to interact with an array of values with the S+ modules
/// </summary>
/// <summary>
/// Represents a JsonToSimplArrayLookupChild
/// </summary>
public class JsonToSimplArrayLookupChild : JsonToSimplChildObjectBase
{
/// <summary>
@@ -76,9 +76,10 @@ namespace PepperDash.Core.JsonToSimpl
PathSuffix == null ? "" : PathSuffix);
}
/// <summary>
/// Process all values
/// </summary>
/// <summary>
/// ProcessAll method
/// </summary>
/// <inheritdoc />
public override void ProcessAll()
{
if (FindInArray())

View File

@@ -28,14 +28,14 @@ namespace PepperDash.Core.JsonToSimpl
/// </summary>
public SPlusValuesDelegate GetAllValuesDelegate { get; set; }
/// <summary>
/// Use a callback to reduce task switch/threading
/// </summary>
/// <summary>
/// Gets or sets the SetAllPathsDelegate
/// </summary>
public SPlusValuesDelegate SetAllPathsDelegate { get; set; }
/// <summary>
/// Unique identifier for instance
/// </summary>
/// <summary>
/// Gets or sets the Key
/// </summary>
public string Key { get; protected set; }
/// <summary>
@@ -49,9 +49,9 @@ namespace PepperDash.Core.JsonToSimpl
/// </summary>
public string PathSuffix { get; protected set; }
/// <summary>
/// Indicates if the instance is linked to an object
/// </summary>
/// <summary>
/// Gets or sets the LinkedToObject
/// </summary>
public bool LinkedToObject { get; protected set; }
/// <summary>
@@ -96,6 +96,9 @@ namespace PepperDash.Core.JsonToSimpl
/// Sets the path prefix for the object
/// </summary>
/// <param name="pathPrefix"></param>
/// <summary>
/// SetPathPrefix method
/// </summary>
public void SetPathPrefix(string pathPrefix)
{
PathPrefix = pathPrefix;
@@ -110,9 +113,9 @@ namespace PepperDash.Core.JsonToSimpl
BoolPaths[index] = path;
}
/// <summary>
/// Set the JPath for a ushort out index.
/// </summary>
/// <summary>
/// SetUshortPath method
/// </summary>
public void SetUshortPath(ushort index, string path)
{
Debug.Console(1, "JSON Child[{0}] SetUshortPath {1}={2}", Key, index, path);
@@ -120,9 +123,9 @@ namespace PepperDash.Core.JsonToSimpl
UshortPaths[index] = path;
}
/// <summary>
/// Set the JPath for a string output index.
/// </summary>
/// <summary>
/// SetStringPath method
/// </summary>
public void SetStringPath(ushort index, string path)
{
Debug.Console(1, "JSON Child[{0}] SetStringPath {1}={2}", Key, index, path);
@@ -130,10 +133,10 @@ namespace PepperDash.Core.JsonToSimpl
StringPaths[index] = path;
}
/// <summary>
/// Evalutates all outputs with defined paths. called by S+ when paths are ready to process
/// and by Master when file is read.
/// </summary>
/// <summary>
/// ProcessAll method
/// </summary>
/// <inheritdoc />
public virtual void ProcessAll()
{
if (!LinkedToObject)
@@ -277,6 +280,9 @@ namespace PepperDash.Core.JsonToSimpl
/// </summary>
/// <param name="key"></param>
/// <param name="theValue"></param>
/// <summary>
/// USetBoolValue method
/// </summary>
public void USetBoolValue(ushort key, ushort theValue)
{
SetBoolValue(key, theValue == 1);
@@ -287,6 +293,9 @@ namespace PepperDash.Core.JsonToSimpl
/// </summary>
/// <param name="key"></param>
/// <param name="theValue"></param>
/// <summary>
/// SetBoolValue method
/// </summary>
public void SetBoolValue(ushort key, bool theValue)
{
if (BoolPaths.ContainsKey(key))
@@ -298,6 +307,9 @@ namespace PepperDash.Core.JsonToSimpl
/// </summary>
/// <param name="key"></param>
/// <param name="theValue"></param>
/// <summary>
/// SetUShortValue method
/// </summary>
public void SetUShortValue(ushort key, ushort theValue)
{
if (UshortPaths.ContainsKey(key))
@@ -309,6 +321,9 @@ namespace PepperDash.Core.JsonToSimpl
/// </summary>
/// <param name="key"></param>
/// <param name="theValue"></param>
/// <summary>
/// SetStringValue method
/// </summary>
public void SetStringValue(ushort key, string theValue)
{
if (StringPaths.ContainsKey(key))
@@ -320,6 +335,9 @@ namespace PepperDash.Core.JsonToSimpl
/// </summary>
/// <param name="keyPath"></param>
/// <param name="valueToSave"></param>
/// <summary>
/// SetValueOnMaster method
/// </summary>
public void SetValueOnMaster(string keyPath, JValue valueToSave)
{
var path = GetFullPath(keyPath);

View File

@@ -20,12 +20,12 @@ namespace PepperDash.Core.JsonToSimpl
public string Filepath { get; private set; }
/// <summary>
/// Filepath to the actual file that will be read (Portal or local)
/// Gets or sets the ActualFilePath
/// </summary>
public string ActualFilePath { get; private set; }
/// <summary>
///
/// Gets or sets the Filename
/// </summary>
public string Filename { get; private set; }
/// <summary>
@@ -194,6 +194,9 @@ namespace PepperDash.Core.JsonToSimpl
/// Sets the debug level
/// </summary>
/// <param name="level"></param>
/// <summary>
/// setDebugLevel method
/// </summary>
public void setDebugLevel(uint level)
{
Debug.SetDebugLevel(level);

View File

@@ -2,9 +2,9 @@
namespace PepperDash.Core.JsonToSimpl
{
/// <summary>
///
/// </summary>
/// <summary>
/// Represents a JsonToSimplFixedPathObject
/// </summary>
public class JsonToSimplFixedPathObject : JsonToSimplChildObjectBase
{
/// <summary>

View File

@@ -5,9 +5,9 @@ using Newtonsoft.Json.Linq;
namespace PepperDash.Core.JsonToSimpl
{
/// <summary>
/// Generic Master
/// </summary>
/// <summary>
/// Represents a JsonToSimplGenericMaster
/// </summary>
public class JsonToSimplGenericMaster : JsonToSimplMaster
{
/*****************************************************************************************/
@@ -20,9 +20,9 @@ namespace PepperDash.Core.JsonToSimpl
// To prevent multiple same-file access
static object WriteLock = new object();
/// <summary>
/// Callback action for saving
/// </summary>
/// <summary>
/// Gets or sets the SaveCallback
/// </summary>
public Action<string> SaveCallback { get; set; }
/*****************************************************************************************/
@@ -60,6 +60,9 @@ namespace PepperDash.Core.JsonToSimpl
/// Loads JSON into JsonObject, but does not trigger evaluation by children
/// </summary>
/// <param name="json"></param>
/// <summary>
/// SetJsonWithoutEvaluating method
/// </summary>
public void SetJsonWithoutEvaluating(string json)
{
try
@@ -72,9 +75,10 @@ namespace PepperDash.Core.JsonToSimpl
}
}
/// <summary>
///
/// </summary>
/// <summary>
/// Save method
/// </summary>
/// <inheritdoc />
public override void Save()
{
// this code is duplicated in the other masters!!!!!!!!!!!!!

View File

@@ -38,9 +38,9 @@ namespace PepperDash.Core.JsonToSimpl
/// </summary>
public string Key { get { return UniqueID; } }
/// <summary>
/// A unique ID
/// </summary>
/// <summary>
/// Gets or sets the UniqueID
/// </summary>
public string UniqueID { get; protected set; }
/// <summary>
@@ -53,10 +53,9 @@ namespace PepperDash.Core.JsonToSimpl
}
string _DebugName = "";
/// <summary>
/// This will be prepended to all paths to allow path swapping or for more organized
/// sub-paths
/// </summary>
/// <summary>
/// Gets or sets the PathPrefix
/// </summary>
public string PathPrefix { get; set; }
/// <summary>
@@ -83,9 +82,9 @@ namespace PepperDash.Core.JsonToSimpl
}
}
/// <summary>
///
/// </summary>
/// <summary>
/// Gets or sets the JsonObject
/// </summary>
public JObject JsonObject { get; protected set; }
/*****************************************************************************************/
@@ -120,6 +119,9 @@ namespace PepperDash.Core.JsonToSimpl
/// Adds a child "module" to this master
/// </summary>
/// <param name="child"></param>
/// <summary>
/// AddChild method
/// </summary>
public void AddChild(JsonToSimplChildObjectBase child)
{
if (!Children.Contains(child))
@@ -128,9 +130,9 @@ namespace PepperDash.Core.JsonToSimpl
}
}
/// <summary>
/// Called from the child to add changed or new values for saving
/// </summary>
/// <summary>
/// AddUnsavedValue method
/// </summary>
public void AddUnsavedValue(string path, JValue value)
{
if (UnsavedValues.ContainsKey(path))
@@ -179,6 +181,9 @@ namespace PepperDash.Core.JsonToSimpl
/// </summary>
/// <param name="json"></param>
/// <returns></returns>
/// <summary>
/// ParseArray method
/// </summary>
public static JArray ParseArray(string json)
{
#if NET6_0

View File

@@ -19,7 +19,7 @@ namespace PepperDash.Core.JsonToSimpl
public string PortalFilepath { get; private set; }
/// <summary>
/// File path of the actual file being read (Portal or local)
/// Gets or sets the ActualFilePath
/// </summary>
public string ActualFilePath { get; private set; }
@@ -128,6 +128,9 @@ namespace PepperDash.Core.JsonToSimpl
///
/// </summary>
/// <param name="level"></param>
/// <summary>
/// setDebugLevel method
/// </summary>
public void setDebugLevel(uint level)
{
Debug.SetDebugLevel(level);

View File

@@ -9,6 +9,9 @@ using System.Threading.Tasks;
namespace PepperDash.Core.Logging
{
/// <summary>
/// Represents a CrestronEnricher
/// </summary>
public class CrestronEnricher : ILogEventEnricher
{
static readonly string _appName;
@@ -27,6 +30,9 @@ namespace PepperDash.Core.Logging
}
/// <summary>
/// Enrich method
/// </summary>
public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
{
var property = propertyFactory.CreateProperty("App", _appName);

File diff suppressed because it is too large Load Diff

View File

@@ -11,10 +11,16 @@ using System.Text;
namespace PepperDash.Core
{
/// <summary>
/// Represents a DebugConsoleSink
/// </summary>
public class DebugConsoleSink : ILogEventSink
{
private readonly ITextFormatter _textFormatter;
/// <summary>
/// Emit method
/// </summary>
public void Emit(LogEvent logEvent)
{
if (!Debug.IsRunningOnAppliance) return;
@@ -44,6 +50,9 @@ namespace PepperDash.Core
public static class DebugConsoleSinkExtensions
{
/// <summary>
/// DebugConsoleSink method
/// </summary>
public static LoggerConfiguration DebugConsoleSink(
this LoggerSinkConfiguration loggerConfiguration,
ITextFormatter formatProvider = null)

View File

@@ -19,9 +19,9 @@ namespace PepperDash.Core
/// </summary>
public string Key { get; private set; }
///// <summary>
///// The name of the file containing the current debug settings.
///// </summary>
/// <summary>
/// The name of the file containing the current debug settings.
/// </summary>
//string FileName = string.Format(@"\nvram\debug\app{0}Debug.json", InitialParametersClass.ApplicationNumber);
DebugContextSaveData SaveData;
@@ -38,6 +38,9 @@ namespace PepperDash.Core
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
/// <summary>
/// GetDebugContext method
/// </summary>
public static DebugContext GetDebugContext(string key)
{
var context = Contexts.FirstOrDefault(c => c.Key.Equals(key, StringComparison.OrdinalIgnoreCase));
@@ -92,6 +95,9 @@ namespace PepperDash.Core
/// Callback for console command
/// </summary>
/// <param name="levelString"></param>
/// <summary>
/// SetDebugFromConsole method
/// </summary>
public void SetDebugFromConsole(string levelString)
{
try
@@ -114,6 +120,9 @@ namespace PepperDash.Core
/// Sets the debug level
/// </summary>
/// <param name="level"> Valid values 0 (no debug), 1 (critical), 2 (all messages)</param>
/// <summary>
/// SetDebugLevel method
/// </summary>
public void SetDebugLevel(int level)
{
if (level <= 2)
@@ -141,7 +150,7 @@ namespace PepperDash.Core
}
/// <summary>
/// Appends a device Key to the beginning of a message
/// Console method
/// </summary>
public void Console(uint level, IKeyed dev, string format, params object[] items)
{
@@ -191,6 +200,9 @@ namespace PepperDash.Core
/// </summary>
/// <param name="errorLogLevel"></param>
/// <param name="str"></param>
/// <summary>
/// LogError method
/// </summary>
public void LogError(Debug.ErrorLogLevel errorLogLevel, string str)
{
string msg = string.Format("App {0}:{1}", InitialParametersClass.ApplicationNumber, str);

View File

@@ -5,8 +5,14 @@ using Serilog.Events;
namespace PepperDash.Core.Logging
{
/// <summary>
/// Represents a DebugCrestronLoggerSink
/// </summary>
public class DebugCrestronLoggerSink : ILogEventSink
{
/// <summary>
/// Emit method
/// </summary>
public void Emit(LogEvent logEvent)
{
if (!Debug.IsRunningOnAppliance) return;

View File

@@ -11,6 +11,9 @@ using System.Threading.Tasks;
namespace PepperDash.Core.Logging
{
/// <summary>
/// Represents a DebugErrorLogSink
/// </summary>
public class DebugErrorLogSink : ILogEventSink
{
private ITextFormatter _formatter;
@@ -24,6 +27,9 @@ namespace PepperDash.Core.Logging
{LogEventLevel.Error, (msg) => ErrorLog.Error(msg) },
{LogEventLevel.Fatal, (msg) => ErrorLog.Error(msg) }
};
/// <summary>
/// Emit method
/// </summary>
public void Emit(LogEvent logEvent)
{
string message;

View File

@@ -1,74 +1,113 @@
using Serilog.Events;
using System;
using System;
using Serilog.Events;
using Log = PepperDash.Core.Debug;
namespace PepperDash.Core.Logging
{
public static class DebugExtensions
{
/// <summary>
/// LogException method
/// </summary>
public static void LogException(this IKeyed device, Exception ex, string message, params object[] args)
{
Log.LogMessage(ex, message, device, args);
Log.LogMessage(ex, message, device: device, args);
}
/// <summary>
/// LogVerbose method
/// </summary>
public static void LogVerbose(this IKeyed device, Exception ex, string message, params object[] args)
{
Log.LogMessage(LogEventLevel.Verbose, ex, message, device, args);
Log.LogVerbose(ex, device, message, args);
}
/// <summary>
/// LogVerbose method
/// </summary>
public static void LogVerbose(this IKeyed device, string message, params object[] args)
{
Log.LogMessage(LogEventLevel.Verbose, device, message, args);
Log.LogVerbose(device, message, args);
}
/// <summary>
/// LogDebug method
/// </summary>
public static void LogDebug(this IKeyed device, Exception ex, string message, params object[] args)
{
Log.LogMessage(LogEventLevel.Debug, ex, message, device, args);
Log.LogDebug(ex, device, message, args);
}
/// <summary>
/// LogDebug method
/// </summary>
public static void LogDebug(this IKeyed device, string message, params object[] args)
{
Log.LogMessage(LogEventLevel.Debug, device, message, args);
Log.LogDebug(device, message, args);
}
/// <summary>
/// LogInformation method
/// </summary>
public static void LogInformation(this IKeyed device, Exception ex, string message, params object[] args)
{
Log.LogMessage(LogEventLevel.Information, ex, message, device, args);
Log.LogInformation(ex, device, message, args);
}
/// <summary>
/// LogInformation method
/// </summary>
public static void LogInformation(this IKeyed device, string message, params object[] args)
{
Log.LogMessage(LogEventLevel.Information, device, message, args);
Log.LogInformation(device, message, args);
}
/// <summary>
/// LogWarning method
/// </summary>
public static void LogWarning(this IKeyed device, Exception ex, string message, params object[] args)
{
Log.LogMessage(LogEventLevel.Warning, ex, message, device, args);
Log.LogWarning(ex, device, message, args);
}
/// <summary>
/// LogWarning method
/// </summary>
public static void LogWarning(this IKeyed device, string message, params object[] args)
{
Log.LogMessage(LogEventLevel.Warning, device, message, args);
Log.LogWarning(device, message, args);
}
/// <summary>
/// LogError method
/// </summary>
public static void LogError(this IKeyed device, Exception ex, string message, params object[] args)
{
Log.LogMessage(LogEventLevel.Error, ex, message, device, args);
Log.LogError(ex, device, message, args);
}
/// <summary>
/// LogError method
/// </summary>
public static void LogError(this IKeyed device, string message, params object[] args)
{
Log.LogMessage(LogEventLevel.Error, device, message, args);
Log.LogError(device, message, args);
}
/// <summary>
/// LogFatal method
/// </summary>
public static void LogFatal(this IKeyed device, Exception ex, string message, params object[] args)
{
Log.LogMessage(LogEventLevel.Fatal, ex, message, device, args);
Log.LogFatal(ex, device, message, args);
}
/// <summary>
/// LogFatal method
/// </summary>
public static void LogFatal(this IKeyed device, string message, params object[] args)
{
Log.LogMessage(LogEventLevel.Fatal, device, message, args);
Log.LogFatal(device, message, args);
}
}
}

View File

@@ -4,9 +4,9 @@ using Newtonsoft.Json;
namespace PepperDash.Core.Logging
{
/// <summary>
/// Class to persist current Debug settings across program restarts
/// </summary>
/// <summary>
/// Represents a DebugContextCollection
/// </summary>
public class DebugContextCollection
{
/// <summary>
@@ -39,6 +39,9 @@ namespace PepperDash.Core.Logging
/// </summary>
/// <param name="contextKey"></param>
/// <param name="level"></param>
/// <summary>
/// SetLevel method
/// </summary>
public void SetLevel(string contextKey, int level)
{
if (level < 0 || level > 2)
@@ -51,6 +54,9 @@ namespace PepperDash.Core.Logging
/// </summary>
/// <param name="contextKey"></param>
/// <returns></returns>
/// <summary>
/// GetOrCreateItem method
/// </summary>
public DebugContextItem GetOrCreateItem(string contextKey)
{
if (!_items.ContainsKey(contextKey))
@@ -65,6 +71,9 @@ namespace PepperDash.Core.Logging
/// <param name="deviceKey"></param>
/// <param name="settings"></param>
/// <returns></returns>
/// <summary>
/// SetDebugSettingsForKey method
/// </summary>
public void SetDebugSettingsForKey(string deviceKey, object settings)
{
try
@@ -89,6 +98,9 @@ namespace PepperDash.Core.Logging
/// </summary>
/// <param name="deviceKey"></param>
/// <returns></returns>
/// <summary>
/// GetDebugSettingsForKey method
/// </summary>
public object GetDebugSettingsForKey(string deviceKey)
{
return DeviceDebugSettings[deviceKey];

View File

@@ -21,6 +21,9 @@ using Serilog.Formatting.Json;
namespace PepperDash.Core
{
/// <summary>
/// Represents a DebugWebsocketSink
/// </summary>
public class DebugWebsocketSink : ILogEventSink
{
private HttpServer _httpsServer;
@@ -47,6 +50,9 @@ namespace PepperDash.Core
}
}
/// <summary>
/// Gets or sets the IsRunning
/// </summary>
public bool IsRunning { get => _httpsServer?.IsListening ?? false; }
@@ -105,6 +111,9 @@ namespace PepperDash.Core
}
}
/// <summary>
/// Emit method
/// </summary>
public void Emit(LogEvent logEvent)
{
if (_httpsServer == null || !_httpsServer.IsListening) return;
@@ -116,6 +125,9 @@ namespace PepperDash.Core
}
/// <summary>
/// StartServerAndSetPort method
/// </summary>
public void StartServerAndSetPort(int port)
{
Debug.Console(0, "Starting Websocket Server on port: {0}", port);
@@ -193,6 +205,9 @@ namespace PepperDash.Core
}
}
/// <summary>
/// StopServer method
/// </summary>
public void StopServer()
{
Debug.Console(0, "Stopping Websocket Server");
@@ -204,6 +219,9 @@ namespace PepperDash.Core
public static class DebugWebsocketSinkExtensions
{
/// <summary>
/// DebugWebsocketSink method
/// </summary>
public static LoggerConfiguration DebugWebsocketSink(
this LoggerSinkConfiguration loggerConfiguration,
ITextFormatter formatProvider = null)
@@ -212,6 +230,9 @@ namespace PepperDash.Core
}
}
/// <summary>
/// Represents a DebugClient
/// </summary>
public class DebugClient : WebSocketBehavior
{
private DateTime _connectionTime;

View File

@@ -2,9 +2,9 @@
namespace PepperDash.Core.PasswordManagement
{
/// <summary>
/// A class to allow user interaction with the PasswordManager
/// </summary>
/// <summary>
/// Represents a PasswordClient
/// </summary>
public class PasswordClient
{
/// <summary>
@@ -59,6 +59,9 @@ namespace PepperDash.Core.PasswordManagement
/// Retrieve password by index
/// </summary>
/// <param name="key"></param>
/// <summary>
/// GetPasswordByIndex method
/// </summary>
public void GetPasswordByIndex(ushort key)
{
OnUshrtChange((ushort)PasswordManager.Passwords.Count, 0, PasswordManagementConstants.PasswordManagerCountChange);
@@ -81,6 +84,9 @@ namespace PepperDash.Core.PasswordManagement
/// Password validation method
/// </summary>
/// <param name="password"></param>
/// <summary>
/// ValidatePassword method
/// </summary>
public void ValidatePassword(string password)
{
if (string.IsNullOrEmpty(password))
@@ -99,6 +105,9 @@ namespace PepperDash.Core.PasswordManagement
/// password against the selected password when the length of the 2 are equal
/// </summary>
/// <param name="data"></param>
/// <summary>
/// BuildPassword method
/// </summary>
public void BuildPassword(string data)
{
PasswordToValidate = String.Concat(PasswordToValidate, data);
@@ -108,9 +117,9 @@ namespace PepperDash.Core.PasswordManagement
ValidatePassword(PasswordToValidate);
}
/// <summary>
/// Clears the user entered password and resets the LEDs
/// </summary>
/// <summary>
/// ClearPassword method
/// </summary>
public void ClearPassword()
{
PasswordToValidate = "";

View File

@@ -4,9 +4,9 @@ using Crestron.SimplSharp;
namespace PepperDash.Core.PasswordManagement
{
/// <summary>
/// Allows passwords to be stored and managed
/// </summary>
/// <summary>
/// Represents a PasswordManager
/// </summary>
public class PasswordManager
{
/// <summary>
@@ -71,6 +71,9 @@ namespace PepperDash.Core.PasswordManagement
/// </summary>
/// <param name="key"></param>
/// <param name="password"></param>
/// <summary>
/// UpdatePassword method
/// </summary>
public void UpdatePassword(ushort key, string password)
{
// validate the parameters
@@ -152,6 +155,9 @@ namespace PepperDash.Core.PasswordManagement
/// Method to change the default timer value, (default 5000ms/5s)
/// </summary>
/// <param name="time"></param>
/// <summary>
/// PasswordTimerMs method
/// </summary>
public void PasswordTimerMs(ushort time)
{
PasswordTimerElapsedMs = Convert.ToInt64(time);

View File

@@ -68,9 +68,9 @@ namespace PepperDash.Core.SystemInfo
public const ushort ProgramConfigChange = 305;
}
/// <summary>
/// Processor Change Event Args Class
/// </summary>
/// <summary>
/// Represents a ProcessorChangeEventArgs
/// </summary>
public class ProcessorChangeEventArgs : EventArgs
{
/// <summary>
@@ -114,9 +114,9 @@ namespace PepperDash.Core.SystemInfo
}
}
/// <summary>
/// Ethernet Change Event Args Class
/// </summary>
/// <summary>
/// Represents a EthernetChangeEventArgs
/// </summary>
public class EthernetChangeEventArgs : EventArgs
{
/// <summary>
@@ -165,9 +165,9 @@ namespace PepperDash.Core.SystemInfo
}
}
/// <summary>
/// Control Subnet Chage Event Args Class
/// </summary>
/// <summary>
/// Represents a ControlSubnetChangeEventArgs
/// </summary>
public class ControlSubnetChangeEventArgs : EventArgs
{
/// <summary>
@@ -211,9 +211,9 @@ namespace PepperDash.Core.SystemInfo
}
}
/// <summary>
/// Program Change Event Args Class
/// </summary>
/// <summary>
/// Represents a ProgramChangeEventArgs
/// </summary>
public class ProgramChangeEventArgs : EventArgs
{
/// <summary>

View File

@@ -100,9 +100,9 @@ namespace PepperDash.Core.SystemInfo
OnBoolChange(false, 0, SystemInfoConstants.BusyBoolChange);
}
/// <summary>
/// Gets the current ethernet info
/// </summary>
/// <summary>
/// GetEthernetInfo method
/// </summary>
public void GetEthernetInfo()
{
OnBoolChange(true, 0, SystemInfoConstants.BusyBoolChange);
@@ -161,9 +161,9 @@ namespace PepperDash.Core.SystemInfo
OnBoolChange(false, 0, SystemInfoConstants.BusyBoolChange);
}
/// <summary>
/// Gets the current control subnet info
/// </summary>
/// <summary>
/// GetControlSubnetInfo method
/// </summary>
public void GetControlSubnetInfo()
{
OnBoolChange(true, 0, SystemInfoConstants.BusyBoolChange);
@@ -206,6 +206,9 @@ namespace PepperDash.Core.SystemInfo
/// Gets the program info by index
/// </summary>
/// <param name="index"></param>
/// <summary>
/// GetProgramInfoByIndex method
/// </summary>
public void GetProgramInfoByIndex(ushort index)
{
if (index < 1 || index > 10)
@@ -263,9 +266,9 @@ namespace PepperDash.Core.SystemInfo
OnBoolChange(false, 0, SystemInfoConstants.BusyBoolChange);
}
/// <summary>
/// Gets the processor uptime and passes it to S+
/// </summary>
/// <summary>
/// RefreshProcessorUptime method
/// </summary>
public void RefreshProcessorUptime()
{
try
@@ -287,6 +290,9 @@ namespace PepperDash.Core.SystemInfo
/// Gets the program uptime, by index, and passes it to S+
/// </summary>
/// <param name="index"></param>
/// <summary>
/// RefreshProgramUptimeByIndex method
/// </summary>
public void RefreshProgramUptimeByIndex(int index)
{
try
@@ -308,6 +314,9 @@ namespace PepperDash.Core.SystemInfo
/// Sends command to console, passes response back using string change event
/// </summary>
/// <param name="cmd"></param>
/// <summary>
/// SendConsoleCommand method
/// </summary>
public void SendConsoleCommand(string cmd)
{
if (string.IsNullOrEmpty(cmd))

View File

@@ -35,6 +35,9 @@ namespace PepperDash.Core
return issuerCertificate;
}
/// <summary>
/// IssueCertificate method
/// </summary>
public X509Certificate2 IssueCertificate(string subjectName, X509Certificate2 issuerCertificate, string[] subjectAlternativeNames, KeyPurposeID[] usages)
{
// It's self-signed, so these are the same.
@@ -56,6 +59,9 @@ namespace PepperDash.Core
return ConvertCertificate(certificate, subjectKeyPair, random);
}
/// <summary>
/// CreateCertificateAuthorityCertificate method
/// </summary>
public X509Certificate2 CreateCertificateAuthorityCertificate(string subjectName, string[] subjectAlternativeNames, KeyPurposeID[] usages)
{
// It's self-signed, so these are the same.
@@ -78,6 +84,9 @@ namespace PepperDash.Core
return ConvertCertificate(certificate, subjectKeyPair, random);
}
/// <summary>
/// CreateSelfSignedCertificate method
/// </summary>
public X509Certificate2 CreateSelfSignedCertificate(string subjectName, string[] subjectAlternativeNames, KeyPurposeID[] usages)
{
// It's self-signed, so these are the same.
@@ -305,6 +314,9 @@ namespace PepperDash.Core
return convertedCertificate;
}
/// <summary>
/// WriteCertificate method
/// </summary>
public void WriteCertificate(X509Certificate2 certificate, string outputDirectory, string certName)
{
// This password is the one attached to the PFX file. Use 'null' for no password.
@@ -332,6 +344,9 @@ namespace PepperDash.Core
}
}
}
/// <summary>
/// AddCertToStore method
/// </summary>
public bool AddCertToStore(X509Certificate2 cert, System.Security.Cryptography.X509Certificates.StoreName st, System.Security.Cryptography.X509Certificates.StoreLocation sl)
{
bool bRet = false;

View File

@@ -2,9 +2,9 @@
namespace PepperDash.Core.Web.RequestHandlers
{
/// <summary>
/// Web API default request handler
/// </summary>
/// <summary>
/// Represents a DefaultRequestHandler
/// </summary>
public class DefaultRequestHandler : WebApiBaseRequestHandler
{
/// <summary>

View File

@@ -142,6 +142,9 @@ namespace PepperDash.Core.Web.RequestHandlers
/// Process request
/// </summary>
/// <param name="context"></param>
/// <summary>
/// ProcessRequest method
/// </summary>
public void ProcessRequest(HttpCwsContext context)
{
if (!_handlers.TryGetValue(context.Request.HttpMethod, out Func<HttpCwsContext, Task> handler))

View File

@@ -144,6 +144,9 @@ namespace PepperDash.Core.Web.RequestHandlers
/// Process request
/// </summary>
/// <param name="context"></param>
/// <summary>
/// ProcessRequest method
/// </summary>
public void ProcessRequest(HttpCwsContext context)
{
Action<HttpCwsContext> handler;

View File

@@ -25,24 +25,24 @@ namespace PepperDash.Core.Web
private readonly CCriticalSection _serverLock = new CCriticalSection();
private HttpCwsServer _server;
/// <summary>
/// Web API server key
/// </summary>
/// <summary>
/// Gets or sets the Key
/// </summary>
public string Key { get; private set; }
/// <summary>
/// Web API server name
/// </summary>
/// <summary>
/// Gets or sets the Name
/// </summary>
public string Name { get; private set; }
/// <summary>
/// CWS base path, will default to "/api" if not set via initialize method
/// </summary>
/// <summary>
/// Gets or sets the BasePath
/// </summary>
public string BasePath { get; private set; }
/// <summary>
/// Indicates CWS is registered with base path
/// </summary>
/// <summary>
/// Gets or sets the IsRegistered
/// </summary>
public bool IsRegistered { get; private set; }
/// <summary>
@@ -137,9 +137,9 @@ namespace PepperDash.Core.Web
Start();
}
/// <summary>
/// Initializes CWS class
/// </summary>
/// <summary>
/// Initialize method
/// </summary>
public void Initialize(string key, string basePath)
{
Key = key;
@@ -165,6 +165,9 @@ namespace PepperDash.Core.Web
/// Removes a route from CWS
/// </summary>
/// <param name="route"></param>
/// <summary>
/// RemoveRoute method
/// </summary>
public void RemoveRoute(HttpCwsRoute route)
{
if (route == null)
@@ -176,9 +179,9 @@ namespace PepperDash.Core.Web
_server.Routes.Remove(route);
}
/// <summary>
/// Returns a list of the current routes
/// </summary>
/// <summary>
/// GetRouteCollection method
/// </summary>
public HttpCwsRouteCollection GetRouteCollection()
{
return _server.Routes;
@@ -222,9 +225,9 @@ namespace PepperDash.Core.Web
}
}
/// <summary>
/// Stop CWS instance
/// </summary>
/// <summary>
/// Stop method
/// </summary>
public void Stop()
{
try

View File

@@ -2,9 +2,9 @@
namespace PepperDash.Core.WebApi.Presets
{
/// <summary>
/// Represents a preset
/// </summary>
/// <summary>
/// Represents a Preset
/// </summary>
public class Preset
{
/// <summary>
@@ -12,29 +12,29 @@ namespace PepperDash.Core.WebApi.Presets
/// </summary>
public int Id { get; set; }
/// <summary>
/// User ID
/// </summary>
/// <summary>
/// Gets or sets the UserId
/// </summary>
public int UserId { get; set; }
/// <summary>
/// Room Type ID
/// </summary>
/// <summary>
/// Gets or sets the RoomTypeId
/// </summary>
public int RoomTypeId { get; set; }
/// <summary>
/// Preset Name
/// </summary>
/// <summary>
/// Gets or sets the PresetName
/// </summary>
public string PresetName { get; set; }
/// <summary>
/// Preset Number
/// </summary>
/// <summary>
/// Gets or sets the PresetNumber
/// </summary>
public int PresetNumber { get; set; }
/// <summary>
/// Preset Data
/// </summary>
/// <summary>
/// Gets or sets the Data
/// </summary>
public string Data { get; set; }
/// <summary>
@@ -48,9 +48,9 @@ namespace PepperDash.Core.WebApi.Presets
}
}
/// <summary>
///
/// </summary>
/// <summary>
/// Represents a PresetReceivedEventArgs
/// </summary>
public class PresetReceivedEventArgs : EventArgs
{
/// <summary>
@@ -59,12 +59,12 @@ namespace PepperDash.Core.WebApi.Presets
public bool LookupSuccess { get; private set; }
/// <summary>
/// S+ helper
/// Gets or sets the ULookupSuccess
/// </summary>
public ushort ULookupSuccess { get { return (ushort)(LookupSuccess ? 1 : 0); } }
/// <summary>
/// The preset
/// Gets or sets the Preset
/// </summary>
public Preset Preset { get; private set; }

View File

@@ -16,19 +16,19 @@ namespace PepperDash.Core.WebApi.Presets
/// </summary>
public int Id { get; set; }
/// <summary>
///
/// </summary>
/// <summary>
/// Gets or sets the ExternalId
/// </summary>
public string ExternalId { get; set; }
/// <summary>
///
/// </summary>
/// <summary>
/// Gets or sets the FirstName
/// </summary>
public string FirstName { get; set; }
/// <summary>
///
/// </summary>
/// <summary>
/// Gets or sets the LastName
/// </summary>
public string LastName { get; set; }
}
@@ -44,13 +44,13 @@ namespace PepperDash.Core.WebApi.Presets
public bool LookupSuccess { get; private set; }
/// <summary>
/// For stupid S+
/// Gets or sets the ULookupSuccess
/// </summary>
public ushort ULookupSuccess { get { return (ushort)(LookupSuccess ? 1 : 0); } }
/// <summary>
///
/// </summary>
/// <summary>
/// Gets or sets the User
/// </summary>
public User User { get; private set; }
/// <summary>
@@ -70,9 +70,9 @@ namespace PepperDash.Core.WebApi.Presets
}
}
/// <summary>
///
/// </summary>
/// <summary>
/// Represents a UserAndRoomMessage
/// </summary>
public class UserAndRoomMessage
{
/// <summary>
@@ -80,14 +80,14 @@ namespace PepperDash.Core.WebApi.Presets
/// </summary>
public int UserId { get; set; }
/// <summary>
///
/// </summary>
/// <summary>
/// Gets or sets the RoomTypeId
/// </summary>
public int RoomTypeId { get; set; }
/// <summary>
///
/// </summary>
/// <summary>
/// Gets or sets the PresetNumber
/// </summary>
public int PresetNumber { get; set; }
}
}

View File

@@ -25,9 +25,9 @@ namespace PepperDash.Core.WebApi.Presets
/// </summary>
public event EventHandler<PresetReceivedEventArgs> PresetReceived;
/// <summary>
/// Unique identifier for this instance
/// </summary>
/// <summary>
/// Gets or sets the Key
/// </summary>
public string Key { get; private set; }
//string JsonMasterKey;
@@ -77,6 +77,9 @@ namespace PepperDash.Core.WebApi.Presets
/// Gets the user for a passcode
/// </summary>
/// <param name="passcode"></param>
/// <summary>
/// GetUserForPasscode method
/// </summary>
public void GetUserForPasscode(string passcode)
{
// Bullshit duplicate code here... These two cases should be the same
@@ -115,6 +118,9 @@ namespace PepperDash.Core.WebApi.Presets
/// </summary>
/// <param name="roomTypeId"></param>
/// <param name="presetNumber"></param>
/// <summary>
/// GetPresetForThisUser method
/// </summary>
public void GetPresetForThisUser(int roomTypeId, int presetNumber)
{
if (CurrentUser == null)
@@ -212,6 +218,9 @@ namespace PepperDash.Core.WebApi.Presets
/// </summary>
/// <param name="roomTypeId"></param>
/// <param name="presetNumber"></param>
/// <summary>
/// SavePresetForThisUser method
/// </summary>
public void SavePresetForThisUser(int roomTypeId, int presetNumber)
{
if (CurrentPreset == null)

View File

@@ -59,6 +59,9 @@ namespace PepperDash.Core.Intersystem.Tokens
/// </summary>
/// <param name="offset"></param>
/// <returns></returns>
/// <summary>
/// GetTokenWithOffset method
/// </summary>
public override XSigToken GetTokenWithOffset(int offset)
{
if (offset == 0) return this;
@@ -69,6 +72,10 @@ namespace PepperDash.Core.Intersystem.Tokens
///
/// </summary>
/// <returns></returns>
/// <summary>
/// ToString method
/// </summary>
/// <inheritdoc />
public override string ToString()
{
return Index + " = 0x" + Value.ToString("X4");
@@ -80,6 +87,9 @@ namespace PepperDash.Core.Intersystem.Tokens
/// <param name="format"></param>
/// <param name="formatProvider"></param>
/// <returns></returns>
/// <summary>
/// ToString method
/// </summary>
public string ToString(string format, IFormatProvider formatProvider)
{
return Value.ToString(format, formatProvider);

View File

@@ -57,6 +57,9 @@ namespace PepperDash.Core.Intersystem.Tokens
/// </summary>
/// <param name="offset"></param>
/// <returns></returns>
/// <summary>
/// GetTokenWithOffset method
/// </summary>
public override XSigToken GetTokenWithOffset(int offset)
{
if (offset == 0) return this;
@@ -67,6 +70,10 @@ namespace PepperDash.Core.Intersystem.Tokens
///
/// </summary>
/// <returns></returns>
/// <summary>
/// ToString method
/// </summary>
/// <inheritdoc />
public override string ToString()
{
return Index + " = " + (Value ? "High" : "Low");
@@ -77,6 +84,9 @@ namespace PepperDash.Core.Intersystem.Tokens
/// </summary>
/// <param name="formatProvider"></param>
/// <returns></returns>
/// <summary>
/// ToString method
/// </summary>
public string ToString(IFormatProvider formatProvider)
{
return Value.ToString(formatProvider);

View File

@@ -63,6 +63,9 @@ namespace PepperDash.Core.Intersystem.Tokens
/// </summary>
/// <param name="offset"></param>
/// <returns></returns>
/// <summary>
/// GetTokenWithOffset method
/// </summary>
public override XSigToken GetTokenWithOffset(int offset)
{
if (offset == 0) return this;
@@ -73,6 +76,10 @@ namespace PepperDash.Core.Intersystem.Tokens
///
/// </summary>
/// <returns></returns>
/// <summary>
/// ToString method
/// </summary>
/// <inheritdoc />
public override string ToString()
{
return Index + " = \"" + Value + "\"";

View File

@@ -52,6 +52,9 @@ namespace PepperDash.Core.Intersystem
/// </summary>
/// <param name="xSigSerialization">XSig state resolver.</param>
/// <returns>Bytes in XSig format for each token within the state representation.</returns>
/// <summary>
/// GetBytes method
/// </summary>
public static byte[] GetBytes(IXSigSerialization xSigSerialization)
{
return GetBytes(xSigSerialization, 0);
@@ -63,6 +66,9 @@ namespace PepperDash.Core.Intersystem
/// <param name="xSigSerialization">XSig state resolver.</param>
/// <param name="offset">Offset to which the data will be aligned.</param>
/// <returns>Bytes in XSig format for each token within the state representation.</returns>
/// <summary>
/// GetBytes method
/// </summary>
public static byte[] GetBytes(IXSigSerialization xSigSerialization, int offset)
{
var tokens = xSigSerialization.Serialize();
@@ -82,6 +88,9 @@ namespace PepperDash.Core.Intersystem
/// <param name="index">1-based digital index</param>
/// <param name="value">Digital data to be encoded</param>
/// <returns>Bytes in XSig format for digtial information.</returns>
/// <summary>
/// GetBytes method
/// </summary>
public static byte[] GetBytes(int index, bool value)
{
return GetBytes(index, 0, value);
@@ -94,6 +103,9 @@ namespace PepperDash.Core.Intersystem
/// <param name="offset">Index offset.</param>
/// <param name="value">Digital data to be encoded</param>
/// <returns>Bytes in XSig format for digtial information.</returns>
/// <summary>
/// GetBytes method
/// </summary>
public static byte[] GetBytes(int index, int offset, bool value)
{
return new XSigDigitalToken(index + offset, value).GetBytes();
@@ -105,6 +117,9 @@ namespace PepperDash.Core.Intersystem
/// <param name="startIndex">Starting index of the sequence.</param>
/// <param name="values">Digital signal value array.</param>
/// <returns>Byte sequence in XSig format for digital signal information.</returns>
/// <summary>
/// GetBytes method
/// </summary>
public static byte[] GetBytes(int startIndex, bool[] values)
{
return GetBytes(startIndex, 0, values);
@@ -117,6 +132,9 @@ namespace PepperDash.Core.Intersystem
/// <param name="offset">Index offset.</param>
/// <param name="values">Digital signal value array.</param>
/// <returns>Byte sequence in XSig format for digital signal information.</returns>
/// <summary>
/// GetBytes method
/// </summary>
public static byte[] GetBytes(int startIndex, int offset, bool[] values)
{
// Digital XSig data is 2 bytes per value
@@ -134,6 +152,9 @@ namespace PepperDash.Core.Intersystem
/// <param name="index">1-based analog index</param>
/// <param name="value">Analog data to be encoded</param>
/// <returns>Bytes in XSig format for analog signal information.</returns>
/// <summary>
/// GetBytes method
/// </summary>
public static byte[] GetBytes(int index, ushort value)
{
return GetBytes(index, 0, value);
@@ -146,6 +167,9 @@ namespace PepperDash.Core.Intersystem
/// <param name="offset">Index offset.</param>
/// <param name="value">Analog data to be encoded</param>
/// <returns>Bytes in XSig format for analog signal information.</returns>
/// <summary>
/// GetBytes method
/// </summary>
public static byte[] GetBytes(int index, int offset, ushort value)
{
return new XSigAnalogToken(index + offset, value).GetBytes();
@@ -157,6 +181,9 @@ namespace PepperDash.Core.Intersystem
/// <param name="startIndex">Starting index of the sequence.</param>
/// <param name="values">Analog signal value array.</param>
/// <returns>Byte sequence in XSig format for analog signal information.</returns>
/// <summary>
/// GetBytes method
/// </summary>
public static byte[] GetBytes(int startIndex, ushort[] values)
{
return GetBytes(startIndex, 0, values);
@@ -169,6 +196,9 @@ namespace PepperDash.Core.Intersystem
/// <param name="offset">Index offset.</param>
/// <param name="values">Analog signal value array.</param>
/// <returns>Byte sequence in XSig format for analog signal information.</returns>
/// <summary>
/// GetBytes method
/// </summary>
public static byte[] GetBytes(int startIndex, int offset, ushort[] values)
{
// Analog XSig data is 4 bytes per value
@@ -186,6 +216,9 @@ namespace PepperDash.Core.Intersystem
/// <param name="index">1-based serial index</param>
/// <param name="value">Serial data to be encoded</param>
/// <returns>Bytes in XSig format for serial signal information.</returns>
/// <summary>
/// GetBytes method
/// </summary>
public static byte[] GetBytes(int index, string value)
{
return GetBytes(index, 0, value);
@@ -198,6 +231,9 @@ namespace PepperDash.Core.Intersystem
/// <param name="offset">Index offset.</param>
/// <param name="value">Serial data to be encoded</param>
/// <returns>Bytes in XSig format for serial signal information.</returns>
/// <summary>
/// GetBytes method
/// </summary>
public static byte[] GetBytes(int index, int offset, string value)
{
return new XSigSerialToken(index + offset, value).GetBytes();
@@ -209,6 +245,9 @@ namespace PepperDash.Core.Intersystem
/// <param name="startIndex">Starting index of the sequence.</param>
/// <param name="values">Serial signal value array.</param>
/// <returns>Byte sequence in XSig format for serial signal information.</returns>
/// <summary>
/// GetBytes method
/// </summary>
public static byte[] GetBytes(int startIndex, string[] values)
{
return GetBytes(startIndex, 0, values);
@@ -221,6 +260,9 @@ namespace PepperDash.Core.Intersystem
/// <param name="offset">Index offset.</param>
/// <param name="values">Serial signal value array.</param>
/// <returns>Byte sequence in XSig format for serial signal information.</returns>
/// <summary>
/// GetBytes method
/// </summary>
public static byte[] GetBytes(int startIndex, int offset, string[] values)
{
// Serial XSig data is not fixed-length like the other formats

View File

@@ -48,6 +48,9 @@ namespace PepperDash.Core.Intersystem
/// <param name="stream">Input stream</param>
/// <param name="value">Result</param>
/// <returns>True if successful, otherwise false.</returns>
/// <summary>
/// TryReadUInt16BE method
/// </summary>
public static bool TryReadUInt16BE(Stream stream, out ushort value)
{
value = 0;
@@ -65,6 +68,9 @@ namespace PepperDash.Core.Intersystem
/// </summary>
/// <returns>XSigToken</returns>
/// <exception cref="ArgumentOutOfRangeException">Offset is less than 0.</exception>
/// <summary>
/// ReadXSigToken method
/// </summary>
public XSigToken ReadXSigToken()
{
ushort prefix;
@@ -114,6 +120,9 @@ namespace PepperDash.Core.Intersystem
/// Reads all available XSig tokens from the stream.
/// </summary>
/// <returns>XSigToken collection.</returns>
/// <summary>
/// ReadAllXSigTokens method
/// </summary>
public IEnumerable<XSigToken> ReadAllXSigTokens()
{
var tokens = new List<XSigToken>();

View File

@@ -47,6 +47,9 @@ namespace PepperDash.Core.Intersystem
/// Write XSig data gathered from an IXSigStateResolver to the stream.
/// </summary>
/// <param name="xSigSerialization">IXSigStateResolver object.</param>
/// <summary>
/// WriteXSigData method
/// </summary>
public void WriteXSigData(IXSigSerialization xSigSerialization)
{
WriteXSigData(xSigSerialization, 0);
@@ -57,6 +60,9 @@ namespace PepperDash.Core.Intersystem
/// </summary>
/// <param name="xSigSerialization">IXSigStateResolver object.</param>
/// <param name="offset">Index offset for each XSigToken.</param>
/// <summary>
/// WriteXSigData method
/// </summary>
public void WriteXSigData(IXSigSerialization xSigSerialization, int offset)
{
if (xSigSerialization == null)
@@ -70,6 +76,9 @@ namespace PepperDash.Core.Intersystem
/// Write XSigToken to the stream.
/// </summary>
/// <param name="token">XSigToken object.</param>
/// <summary>
/// WriteXSigData method
/// </summary>
public void WriteXSigData(XSigToken token)
{
WriteXSigData(token, 0);
@@ -80,6 +89,9 @@ namespace PepperDash.Core.Intersystem
/// </summary>
/// <param name="token">XSigToken object.</param>
/// <param name="offset">Index offset for each XSigToken.</param>
/// <summary>
/// WriteXSigData method
/// </summary>
public void WriteXSigData(XSigToken token, int offset)
{
WriteXSigData(new[] { token }, offset);
@@ -108,6 +120,9 @@ namespace PepperDash.Core.Intersystem
/// </summary>
/// <param name="tokens">XSigToken objects.</param>
/// <param name="offset">Index offset for each XSigToken.</param>
/// <summary>
/// WriteXSigData method
/// </summary>
public void WriteXSigData(IEnumerable<XSigToken> tokens, int offset)
{
if (offset < 0)
@@ -125,7 +140,7 @@ namespace PepperDash.Core.Intersystem
}
/// <summary>
/// Disposes of the internal stream if specified to not leave open.
/// Dispose method
/// </summary>
public void Dispose()
{

View File

@@ -2,14 +2,12 @@
using System;
using System.Collections.Generic;
using Crestron.SimplSharp;
using System.Reflection;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.EthernetCommunication;
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core.Config;
using Serilog.Events;
@@ -31,7 +29,7 @@ namespace PepperDash.Essentials.Core.Bridges
}
/// <summary>
/// Bridge API using EISC
/// Represents a EiscApiAdvanced
/// </summary>
public class EiscApiAdvanced : BridgeApi, ICommunicationMonitor
{
@@ -60,12 +58,19 @@ namespace PepperDash.Essentials.Core.Bridges
AddPostActivationAction(RegisterEisc);
}
/// <summary>
/// CustomActivate method
/// </summary>
/// <inheritdoc />
public override bool CustomActivate()
{
CommunicationMonitor.Start();
return base.CustomActivate();
}
/// <summary>
/// Deactivate method
/// </summary>
public override bool Deactivate()
{
CommunicationMonitor.Stop();
@@ -123,6 +128,9 @@ namespace PepperDash.Essentials.Core.Bridges
Debug.LogMessage(LogEventLevel.Debug, this, "EISC registration successful");
}
/// <summary>
/// LinkRooms method
/// </summary>
public void LinkRooms()
{
Debug.LogMessage(LogEventLevel.Debug, this, "Linking Rooms...");
@@ -153,6 +161,9 @@ namespace PepperDash.Essentials.Core.Bridges
/// </summary>
/// <param name="deviceKey"></param>
/// <param name="joinMap"></param>
/// <summary>
/// AddJoinMap method
/// </summary>
public void AddJoinMap(string deviceKey, JoinMapBaseAdvanced joinMap)
{
if (!JoinMaps.ContainsKey(deviceKey))
@@ -166,8 +177,9 @@ namespace PepperDash.Essentials.Core.Bridges
}
/// <summary>
/// Prints all the join maps on this bridge
/// PrintJoinMaps method
/// </summary>
/// <inheritdoc />
public virtual void PrintJoinMaps()
{
CrestronConsole.ConsoleCommandResponse("Join Maps for EISC IPID: {0}\r\n", Eisc.ID.ToString("X"));
@@ -179,8 +191,9 @@ namespace PepperDash.Essentials.Core.Bridges
}
}
/// <summary>
/// Generates markdown for all join maps on this bridge
/// MarkdownForBridge method
/// </summary>
/// <inheritdoc />
public virtual void MarkdownForBridge(string bridgeKey)
{
Debug.LogMessage(LogEventLevel.Information, this, "Writing Joinmaps to files for EISC IPID: {0}", Eisc.ID.ToString("X"));
@@ -196,6 +209,9 @@ namespace PepperDash.Essentials.Core.Bridges
/// Prints the join map for a device by key
/// </summary>
/// <param name="deviceKey"></param>
/// <summary>
/// PrintJoinMapForDevice method
/// </summary>
public void PrintJoinMapForDevice(string deviceKey)
{
var joinMap = JoinMaps[deviceKey];
@@ -213,6 +229,9 @@ namespace PepperDash.Essentials.Core.Bridges
/// Prints the join map for a device by key
/// </summary>
/// <param name="deviceKey"></param>
/// <summary>
/// MarkdownJoinMapForDevice method
/// </summary>
public void MarkdownJoinMapForDevice(string deviceKey, string bridgeKey)
{
var joinMap = JoinMaps[deviceKey];
@@ -233,6 +252,9 @@ namespace PepperDash.Essentials.Core.Bridges
/// <param name="join"></param>
/// <param name="type"></param>
/// <param name="state"></param>
/// <summary>
/// ExecuteJoinAction method
/// </summary>
public void ExecuteJoinAction(uint join, string type, object state)
{
try
@@ -318,49 +340,91 @@ namespace PepperDash.Essentials.Core.Bridges
#region Implementation of ICommunicationMonitor
/// <summary>
/// Gets or sets the CommunicationMonitor
/// </summary>
public StatusMonitorBase CommunicationMonitor { get; private set; }
#endregion
}
/// <summary>
/// Represents a EiscApiPropertiesConfig
/// </summary>
public class EiscApiPropertiesConfig
{
/// <summary>
/// Gets or sets the Control
/// </summary>
[JsonProperty("control")]
public EssentialsControlPropertiesConfig Control { get; set; }
/// <summary>
/// Gets or sets the Devices
/// </summary>
[JsonProperty("devices")]
public List<ApiDevicePropertiesConfig> Devices { get; set; }
/// <summary>
/// Gets or sets the Rooms
/// </summary>
[JsonProperty("rooms")]
public List<ApiRoomPropertiesConfig> Rooms { get; set; }
/// <summary>
/// Represents a ApiDevicePropertiesConfig
/// </summary>
public class ApiDevicePropertiesConfig
{
/// <summary>
/// Gets or sets the DeviceKey
/// </summary>
[JsonProperty("deviceKey")]
public string DeviceKey { get; set; }
/// <summary>
/// Gets or sets the JoinStart
/// </summary>
[JsonProperty("joinStart")]
public uint JoinStart { get; set; }
/// <summary>
/// Gets or sets the JoinMapKey
/// </summary>
[JsonProperty("joinMapKey")]
public string JoinMapKey { get; set; }
}
/// <summary>
/// Represents a ApiRoomPropertiesConfig
/// </summary>
public class ApiRoomPropertiesConfig
{
/// <summary>
/// Gets or sets the RoomKey
/// </summary>
[JsonProperty("roomKey")]
public string RoomKey { get; set; }
/// <summary>
/// Gets or sets the JoinStart
/// </summary>
[JsonProperty("joinStart")]
public uint JoinStart { get; set; }
/// <summary>
/// Gets or sets the JoinMapKey
/// </summary>
[JsonProperty("joinMapKey")]
public string JoinMapKey { get; set; }
}
}
/// <summary>
/// Represents a EiscApiAdvancedFactory
/// </summary>
public class EiscApiAdvancedFactory : EssentialsDeviceFactory<EiscApiAdvanced>
{
public EiscApiAdvancedFactory()
@@ -368,6 +432,10 @@ namespace PepperDash.Essentials.Core.Bridges
TypeNames = new List<string> { "eiscapiadv", "eiscapiadvanced", "eiscapiadvancedserver", "eiscapiadvancedclient", "vceiscapiadv", "vceiscapiadvanced" };
}
/// <summary>
/// BuildDevice method
/// </summary>
/// <inheritdoc />
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new EiscApiAdvanced Device");

View File

@@ -34,6 +34,9 @@ namespace PepperDash.Essentials.Core.Bridges
bridge.PrintJoinMaps();
}
}
/// <summary>
/// JoinmapMarkdown method
/// </summary>
public static void JoinmapMarkdown(string command)
{
var targets = command.Split(' ');

View File

@@ -3,10 +3,17 @@
namespace PepperDash.Essentials.Core.Bridges
{
/// <summary>
/// Defines a device that uses JoinMapBaseAdvanced for its join map
/// Defines the contract for IBridgeAdvanced
/// </summary>
public interface IBridgeAdvanced
{
/// <summary>
/// Links the bridge to the API using the provided trilist, join start, join map key, and bridge.
/// </summary>
/// <param name="trilist">The trilist to link to.</param>
/// <param name="joinStart">The starting join number.</param>
/// <param name="joinMapKey">The key for the join map.</param>
/// <param name="bridge">The EISC API bridge.</param>
void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge);
}
}

View File

@@ -2,6 +2,9 @@ using System;
namespace PepperDash.Essentials.Core.Bridges
{
/// <summary>
/// Represents a AirMediaControllerJoinMap
/// </summary>
public class AirMediaControllerJoinMap : JoinMapBaseAdvanced
{
[JoinName("IsOnline")]

View File

@@ -2,6 +2,9 @@
namespace PepperDash.Essentials.Core.Bridges
{
/// <summary>
/// Represents a AppleTvJoinMap
/// </summary>
public class AppleTvJoinMap : JoinMapBaseAdvanced
{
[JoinName("UpArrow")]

View File

@@ -2,6 +2,9 @@
namespace PepperDash.Essentials.Core.Bridges
{
/// <summary>
/// Represents a C2nRthsControllerJoinMap
/// </summary>
public class C2nRthsControllerJoinMap : JoinMapBaseAdvanced
{
[JoinName("IsOnline")]

View File

@@ -3,7 +3,7 @@
namespace PepperDash.Essentials.Core.Bridges
{
/// <summary>
/// Join map for CameraBase devices
/// Represents a CameraControllerJoinMap
/// </summary>
public class CameraControllerJoinMap : JoinMapBaseAdvanced
{

View File

@@ -2,6 +2,9 @@
namespace PepperDash.Essentials.Core.Bridges
{
/// <summary>
/// Represents a CenOdtOccupancySensorBaseJoinMap
/// </summary>
public class CenOdtOccupancySensorBaseJoinMap : JoinMapBaseAdvanced
{
#region Digitals

View File

@@ -2,6 +2,9 @@
namespace PepperDash.Essentials.Core.Bridges
{
/// <summary>
/// Represents a DisplayControllerJoinMap
/// </summary>
public class DisplayControllerJoinMap : JoinMapBaseAdvanced
{
[JoinName("Name")]

View File

@@ -1,6 +1,9 @@
using System;
namespace PepperDash.Essentials.Core.Bridges {
/// <summary>
/// Represents a DmBladeChassisControllerJoinMap
/// </summary>
public class DmBladeChassisControllerJoinMap : JoinMapBaseAdvanced {
[JoinName("IsOnline")]

View File

@@ -2,6 +2,9 @@ using System;
namespace PepperDash.Essentials.Core.Bridges
{
/// <summary>
/// Represents a DmChassisControllerJoinMap
/// </summary>
public class DmChassisControllerJoinMap : JoinMapBaseAdvanced
{
[JoinName("EnableAudioBreakaway")]

View File

@@ -2,6 +2,9 @@ using System;
namespace PepperDash.Essentials.Core.Bridges
{
/// <summary>
/// Represents a DmRmcControllerJoinMap
/// </summary>
public class DmRmcControllerJoinMap : JoinMapBaseAdvanced
{
[JoinName("IsOnline")]

View File

@@ -2,6 +2,9 @@
namespace PepperDash.Essentials.Core.Bridges
{
/// <summary>
/// Represents a DmTxControllerJoinMap
/// </summary>
public class DmTxControllerJoinMap : JoinMapBaseAdvanced
{
[JoinName("IsOnline")]

View File

@@ -2,6 +2,9 @@
namespace PepperDash.Essentials.Core.Bridges
{
/// <summary>
/// Represents a DmpsAudioOutputControllerJoinMap
/// </summary>
public class DmpsAudioOutputControllerJoinMap : JoinMapBaseAdvanced
{

View File

@@ -2,6 +2,9 @@
namespace PepperDash.Essentials.Core.Bridges
{
/// <summary>
/// Represents a DmpsMicrophoneControllerJoinMap
/// </summary>
public class DmpsMicrophoneControllerJoinMap : JoinMapBaseAdvanced
{
[JoinName("MicGain")]

View File

@@ -2,6 +2,9 @@
namespace PepperDash.Essentials.Core.Bridges
{
/// <summary>
/// Represents a DmpsRoutingControllerJoinMap
/// </summary>
public class DmpsRoutingControllerJoinMap : JoinMapBaseAdvanced
{
[JoinName("EnableRouting")]

View File

@@ -3,6 +3,9 @@
namespace PepperDash.Essentials.Core.Bridges
{
/// <summary>
/// Represents a GenericLightingJoinMap
/// </summary>
public class GenericLightingJoinMap : JoinMapBaseAdvanced
{

View File

@@ -2,6 +2,9 @@
namespace PepperDash.Essentials.Core.Bridges
{
/// <summary>
/// Represents a GenericRelayControllerJoinMap
/// </summary>
public class GenericRelayControllerJoinMap : JoinMapBaseAdvanced
{

View File

@@ -2,6 +2,9 @@
namespace PepperDash.Essentials.Core.Bridges
{
/// <summary>
/// Represents a GlsOccupancySensorBaseJoinMap
/// </summary>
public class GlsOccupancySensorBaseJoinMap : JoinMapBaseAdvanced
{
[JoinName("IsOnline")]

View File

@@ -3,6 +3,9 @@ using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
{
/// <summary>
/// Represents a GlsPartitionSensorJoinMap
/// </summary>
public class GlsPartitionSensorJoinMap : JoinMapBaseAdvanced
{

View File

@@ -2,6 +2,9 @@
namespace PepperDash.Essentials.Core.Bridges
{
/// <summary>
/// Represents a HdMdNxM4kEControllerJoinMap
/// </summary>
public class HdMdNxM4kEControllerJoinMap : JoinMapBaseAdvanced
{
[JoinName("Name")]

View File

@@ -2,6 +2,9 @@
namespace PepperDash.Essentials.Core.Bridges
{
/// <summary>
/// Represents a HdMdxxxCEControllerJoinMap
/// </summary>
public class HdMdxxxCEControllerJoinMap : JoinMapBaseAdvanced
{

View File

@@ -3,6 +3,9 @@ using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Core.Bridges
{
/// <summary>
/// Represents a HdPsXxxControllerJoinMap
/// </summary>
public class HdPsXxxControllerJoinMap : JoinMapBaseAdvanced
{

View File

@@ -2,6 +2,9 @@
namespace PepperDash.Essentials.Core.Bridges
{
/// <summary>
/// Represents a Hrxxx0WirelessRemoteControllerJoinMap
/// </summary>
public class Hrxxx0WirelessRemoteControllerJoinMap : JoinMapBaseAdvanced
{
[JoinName("Power")]

View File

@@ -2,6 +2,9 @@
namespace PepperDash.Essentials.Core.Bridges
{
/// <summary>
/// Represents a IAnalogInputJoinMap
/// </summary>
public class IAnalogInputJoinMap : JoinMapBaseAdvanced
{

View File

@@ -2,6 +2,9 @@
namespace PepperDash.Essentials.Core.Bridges
{
/// <summary>
/// Represents a IBasicCommunicationJoinMap
/// </summary>
public class IBasicCommunicationJoinMap : JoinMapBaseAdvanced
{
[JoinName("TextReceived")]

View File

@@ -2,6 +2,9 @@
namespace PepperDash.Essentials.Core.Bridges
{
/// <summary>
/// Represents a IDigitalInputJoinMap
/// </summary>
public class IDigitalInputJoinMap : JoinMapBaseAdvanced
{

View File

@@ -2,6 +2,9 @@
namespace PepperDash.Essentials.Core.Bridges
{
/// <summary>
/// Represents a IDigitalOutputJoinMap
/// </summary>
public class IDigitalOutputJoinMap : JoinMapBaseAdvanced
{

View File

@@ -2,6 +2,9 @@
namespace PepperDash.Essentials.Core.Bridges
{
/// <summary>
/// Represents a PduJoinMapBase
/// </summary>
public class PduJoinMapBase : JoinMapBaseAdvanced
{
[JoinName("Name")]

View File

@@ -3,6 +3,9 @@
namespace PepperDash.Essentials.Core.Bridges
{
/// <summary>
/// Represents a SetTopBoxControllerJoinMap
/// </summary>
public class SetTopBoxControllerJoinMap : JoinMapBaseAdvanced
{
[JoinName("PowerOn")]

View File

@@ -2,6 +2,9 @@
namespace PepperDash.Essentials.Core.Bridges
{
/// <summary>
/// Represents a StatusSignControllerJoinMap
/// </summary>
public class StatusSignControllerJoinMap : JoinMapBaseAdvanced
{
[JoinName("IsOnline")]

View File

@@ -2,6 +2,9 @@
namespace PepperDash.Essentials.Core.Bridges
{
/// <summary>
/// Represents a SystemMonitorJoinMap
/// </summary>
public class SystemMonitorJoinMap : JoinMapBaseAdvanced
{
[JoinName("TimeZone")]

View File

@@ -2,6 +2,9 @@ using System;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
{
/// <summary>
/// Represents a VideoCodecControllerJoinMap
/// </summary>
public class VideoCodecControllerJoinMap : JoinMapBaseAdvanced
{
#region Digital

View File

@@ -12,13 +12,22 @@ using Serilog.Events;
namespace PepperDash.Essentials.Core
{
/// <summary>
/// Represents a CecPortController
/// </summary>
public class CecPortController : Device, IBasicCommunicationWithStreamDebugging
{
/// <summary>
/// Gets or sets the StreamDebugging
/// </summary>
public CommunicationStreamDebugging StreamDebugging { get; private set; }
public event EventHandler<GenericCommMethodReceiveBytesArgs> BytesReceived;
public event EventHandler<GenericCommMethodReceiveTextArgs> TextReceived;
/// <summary>
/// Gets or sets the IsConnected
/// </summary>
public bool IsConnected { get { return true; } }
ICec Port;
@@ -74,6 +83,9 @@ namespace PepperDash.Essentials.Core
#region IBasicCommunication Members
/// <summary>
/// SendText method
/// </summary>
public void SendText(string text)
{
if (Port == null)
@@ -83,6 +95,9 @@ namespace PepperDash.Essentials.Core
Port.StreamCec.Send.StringValue = text;
}
/// <summary>
/// SendBytes method
/// </summary>
public void SendBytes(byte[] bytes)
{
if (Port == null)
@@ -93,10 +108,16 @@ namespace PepperDash.Essentials.Core
Port.StreamCec.Send.StringValue = text;
}
/// <summary>
/// Connect method
/// </summary>
public void Connect()
{
}
/// <summary>
/// Disconnect method
/// </summary>
public void Disconnect()
{
}
@@ -107,6 +128,9 @@ namespace PepperDash.Essentials.Core
///
/// </summary>
/// <param name="s"></param>
/// <summary>
/// SimulateReceive method
/// </summary>
public void SimulateReceive(string s)
{
// split out hex chars and build string

View File

@@ -12,13 +12,22 @@ using Serilog.Events;
namespace PepperDash.Essentials.Core
{
/// <summary>
/// Represents a ComPortController
/// </summary>
public class ComPortController : Device, IBasicCommunicationWithStreamDebugging
{
/// <summary>
/// Gets or sets the StreamDebugging
/// </summary>
public CommunicationStreamDebugging StreamDebugging { get; private set; }
public event EventHandler<GenericCommMethodReceiveBytesArgs> BytesReceived;
public event EventHandler<GenericCommMethodReceiveTextArgs> TextReceived;
/// <summary>
/// Gets or sets the IsConnected
/// </summary>
public bool IsConnected { get { return true; } }
ComPort Port;
@@ -116,6 +125,10 @@ namespace PepperDash.Essentials.Core
if(!eventSubscribed) Debug.LogMessage(LogEventLevel.Warning, this, "Received data but no handler is registered");
}
/// <summary>
/// Deactivate method
/// </summary>
/// <inheritdoc />
public override bool Deactivate()
{
return Port.UnRegister() == eDeviceRegistrationUnRegistrationResponse.Success;
@@ -123,6 +136,9 @@ namespace PepperDash.Essentials.Core
#region IBasicCommunication Members
/// <summary>
/// SendText method
/// </summary>
public void SendText(string text)
{
if (Port == null)
@@ -133,6 +149,9 @@ namespace PepperDash.Essentials.Core
Port.Send(text);
}
/// <summary>
/// SendBytes method
/// </summary>
public void SendBytes(byte[] bytes)
{
if (Port == null)
@@ -144,10 +163,16 @@ namespace PepperDash.Essentials.Core
Port.Send(text);
}
/// <summary>
/// Connect method
/// </summary>
public void Connect()
{
}
/// <summary>
/// Disconnect method
/// </summary>
public void Disconnect()
{
}
@@ -158,6 +183,9 @@ namespace PepperDash.Essentials.Core
///
/// </summary>
/// <param name="s"></param>
/// <summary>
/// SimulateReceive method
/// </summary>
public void SimulateReceive(string s)
{
// split out hex chars and build string

View File

@@ -34,8 +34,9 @@ namespace PepperDash.Essentials.Core
}
/// <summary>
///
/// CanConvert method
/// </summary>
/// <inheritdoc />
public override bool CanConvert(Type objectType)
{
return objectType == typeof(ComPort.ComPortSpec?);
@@ -44,10 +45,15 @@ namespace PepperDash.Essentials.Core
public override bool CanRead { get { return true; } }
/// <summary>
/// This converter will not be used for writing
/// Gets or sets the CanWrite
/// </summary>
/// <inheritdoc />
public override bool CanWrite { get { return false; } }
/// <summary>
/// WriteJson method
/// </summary>
/// <inheritdoc />
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
throw new NotImplementedException();
@@ -55,12 +61,11 @@ namespace PepperDash.Essentials.Core
}
/// <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
/// Represents a ComSpecPropsJsonConverter
/// </summary>
public class ComSpecPropsJsonConverter : JsonConverter
{
/// <inheritdoc />
public override bool CanConvert(Type objectType)
{
return objectType == typeof(ComPort.eComBaudRates)
@@ -72,8 +77,15 @@ namespace PepperDash.Essentials.Core
|| objectType == typeof(ComPort.eComStopBits);
}
/// <summary>
/// Gets or sets the CanRead
/// </summary>
/// <inheritdoc />
public override bool CanRead { get { return true; } }
/// <summary>
/// ReadJson method
/// </summary>
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
//Debug.LogMessage(LogEventLevel.Verbose, "ReadJson type: " + objectType.Name);
@@ -94,6 +106,10 @@ namespace PepperDash.Essentials.Core
return null;
}
/// <summary>
/// WriteJson method
/// </summary>
/// <inheritdoc />
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
throw new NotImplementedException();

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