Compare commits

..

21 Commits

Author SHA1 Message Date
Nick Genovese
383af5dc53 ci(force-patch): force build 2025-09-04 15:42:31 -04:00
Andrew Welker
c224b4dfaf build: remove unneeded references from PD Core project 2025-08-14 08:55:32 -05:00
Andrew Welker
e1e32cea6f fix: use correct line endings for verbatim strings 2025-08-06 08:55:08 -05:00
Andrew Welker
e31df338d6 chore: remove duplication namespace declaration
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-07 10:06:59 -05:00
Andrew Welker
d14058fc32 chore: update local build version 2025-07-04 16:23:02 -05:00
Andrew Welker
04d6508c80 feat: modify factory loading
Updating IDeviceFactory to resolve [FEATURE]-Refactor Plugin loading mechanism  #1065.
This change should be backwards-compatible with existing plugins that use the EssentialsPluginDeviceFactory<T> class,
as the interfaces are implemented by the various base classes.

In addition, the correct assembly name is now printed when a type is loaded.
2025-07-04 16:07:45 -05:00
Andrew Welker
1cbc8194ec feat: remove context file for storing values 2025-07-04 16:03:00 -05:00
Andrew Welker
6d2cd75cbe chore: move all files to file-scoped namespace 2025-07-04 16:02:32 -05:00
Andrew Welker
8b873b7248 feat: modify plugin loading process 2025-07-04 13:33:56 -05:00
Andrew Welker
58a2a5c008 docs: update XML docs 2025-07-04 13:07:21 -05:00
Andrew Welker
cc7e2ab675 chore: fix issues related to remving crestron usings 2025-07-04 12:46:08 -05:00
Andrew Welker
dc900f3f31 docs: add XML comments 2025-07-04 12:37:41 -05:00
Andrew Welker
562f0ba793 wip: package updates 2025-07-04 12:37:41 -05:00
jtalborough
9c3c924a29 fix: adjust installation steps for prerequisites based on environment detection 2025-07-04 12:37:41 -05:00
jtalborough
9b5af60a46 fix: update condition for CPZ copy target and remove obsolete workflows 2025-07-04 12:37:41 -05:00
jtalborough
a99b0a1fac feat: enhance plugin dependency management in PluginLoader 2025-07-04 12:37:41 -05:00
jtalborough
7591913a9c wip: address performance issues in plugin loading and versioning 2025-07-04 12:37:41 -05:00
jtalborough
66a6612b65 fix: update target framework to net8 and bump PepperDashCore version to 2.0.0-alpha-462
BREAKING CHANGE: Target Framework is now .NET 8:
2025-07-04 12:37:21 -05:00
jtalborough
688cf34153 feat: implement WebSocket classes and update culture settings; bump PepperDashCore version 2025-07-04 11:53:02 -05:00
jtalborough
0c59237232 fix: update target frameworks and package references; change culture to InvariantCulture 2025-07-04 11:52:43 -05:00
jtalborough
88eec9a3f1 fix: update package references and clean up unused imports 2025-07-04 11:52:01 -05:00
610 changed files with 50799 additions and 59607 deletions

View File

@@ -0,0 +1,247 @@
name: Essentials v3 Development Build
on:
push:
branches:
- feature-3.0.0/*
- hotfix-3.0.0/*
- release-3.0.0/*
- development-3.0.0
env:
SOLUTION_PATH: .
SOLUTION_FILE: PepperDash.Essentials
VERSION: 0.0.0-buildtype-buildnumber
BUILD_TYPE: Debug
RELEASE_BRANCH: main
jobs:
Build_Project_4-Series:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# Detect environment (Act vs GitHub)
- name: Detect environment
id: detect_env
run: |
if [ -n "$ACT" ]; then
echo "is_local=true" >> $GITHUB_OUTPUT
else
echo "is_local=false" >> $GITHUB_OUTPUT
fi
- name: Install prerequisites
run: |
if [ "${{ steps.detect_env.outputs.is_local }}" == "true" ]; then
# For Act - no sudo needed
apt-get update
apt-get install -y curl wget libicu-dev git unzip
else
# For GitHub runners - sudo required
sudo apt-get update
sudo apt-get install -y curl wget libicu-dev git unzip
fi
- name: Set Version Number
id: setVersion
shell: bash
run: |
latestVersion="3.0.0"
newVersion=$latestVersion
phase=""
newVersionString=""
if [[ $GITHUB_REF =~ ^refs/pull/.* ]]; then
phase="beta"
newVersionString="${newVersion}-${phase}-${GITHUB_RUN_NUMBER}"
elif [[ $GITHUB_REF =~ ^refs/heads/hotfix-3.0.0/.* ]]; then
phase="hotfix"
newVersionString="${newVersion}-${phase}-${GITHUB_RUN_NUMBER}"
elif [[ $GITHUB_REF =~ ^refs/heads/feature-3.0.0/.* ]]; then
phase="alpha"
newVersionString="${newVersion}-${phase}-${GITHUB_RUN_NUMBER}"
elif [[ $GITHUB_REF == "refs/heads/development-3.0.0" ]]; then
phase="beta"
newVersionString="${newVersion}-${phase}-${GITHUB_RUN_NUMBER}"
elif [[ $GITHUB_REF =~ ^refs/heads/release-3.0.0/.* ]]; then
version=$(echo $GITHUB_REF | awk -F '/' '{print $NF}' | sed 's/v//')
phase="rc"
newVersionString="${version}-${phase}-${GITHUB_RUN_NUMBER}"
else
# For local builds or unrecognized branches
newVersionString="${newVersion}-local"
fi
echo "version=$newVersionString" >> $GITHUB_OUTPUT
# Create Build Properties file
- name: Create Build Properties
run: |
cat > Directory.Build.props << EOF
<Project>
<PropertyGroup>
<Version>${{ steps.setVersion.outputs.version }}</Version>
<AssemblyVersion>${{ steps.setVersion.outputs.version }}</AssemblyVersion>
<FileVersion>${{ steps.setVersion.outputs.version }}</FileVersion>
<InformationalVersion>${{ steps.setVersion.outputs.version }}</InformationalVersion>
<PackageVersion>${{ steps.setVersion.outputs.version }}</PackageVersion>
<NuGetVersion>${{ steps.setVersion.outputs.version }}</NuGetVersion>
</PropertyGroup>
</Project>
EOF
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
- name: Restore NuGet Packages
run: dotnet restore ${SOLUTION_FILE}.sln
- name: Build Solution
run: dotnet build ${SOLUTION_FILE}.sln --configuration ${BUILD_TYPE} --no-restore
# Copy the CPZ file to the output directory with version in the filename
- name: Copy and Rename CPZ Files
run: |
mkdir -p ./output/cpz
# Find the main CPZ file in the build output
if [ -f "./src/PepperDash.Essentials/bin/${BUILD_TYPE}/net8/PepperDashEssentials.cpz" ]; then
cp "./src/PepperDash.Essentials/bin/${BUILD_TYPE}/net8/PepperDashEssentials.cpz" "./output/cpz/PepperDashEssentials.${{ steps.setVersion.outputs.version }}.cpz"
echo "Main CPZ file copied and renamed successfully."
else
echo "Warning: Main CPZ file not found at expected location."
find ./src -name "*.cpz" | xargs -I {} cp {} ./output/cpz/
fi
- name: Pack Solution
run: dotnet pack ${SOLUTION_FILE}.sln --configuration ${BUILD_TYPE} --output ./output/nuget --no-build
# List build artifacts (runs in both environments)
- name: List Build Artifacts
run: |
echo "=== Build Artifacts ==="
echo "NuGet Packages:"
find ./output/nuget -type f | sort
echo ""
echo "CPZ/CPLZ Files:"
find ./output -name "*.cpz" -o -name "*.cplz" | sort
echo "======================="
# Enhanced package inspection for local runs
- name: Inspect NuGet Packages
if: steps.detect_env.outputs.is_local == 'true'
run: |
echo "=== NuGet Package Details ==="
for pkg in $(find ./output/nuget -name "*.nupkg"); do
echo "Package: $(basename "$pkg")"
echo "Size: $(du -h "$pkg" | cut -f1)"
# Extract and show package contents
echo "Contents:"
unzip -l "$pkg" | tail -n +4 | head -n -2
echo "--------------------------"
# Try to extract and show the nuspec file (contains metadata)
echo "Metadata:"
unzip -p "$pkg" "*.nuspec" 2>/dev/null | grep -E "(<id>|<version>|<description>|<authors>|<dependencies>)" || echo "Metadata extraction failed"
echo "--------------------------"
done
echo "==========================="
# Tag creation - GitHub version
- name: Create tag for non-rc builds (GitHub)
if: ${{ !contains(steps.setVersion.outputs.version, 'rc') && steps.detect_env.outputs.is_local == 'false' }}
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"
git tag ${{ steps.setVersion.outputs.version }}
git push --tags origin
# Tag creation - Act mock version
- name: Create tag for non-rc builds (Act Mock)
if: ${{ !contains(steps.setVersion.outputs.version, 'rc') && steps.detect_env.outputs.is_local == 'true' }}
run: |
echo "Would create git tag: ${{ steps.setVersion.outputs.version }}"
echo "Would push tag to: origin"
# Release creation - GitHub version
- name: Create Release (GitHub)
if: steps.detect_env.outputs.is_local == 'false'
id: create_release
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: 'output/cpz/*,output/**/*.cplz'
generateReleaseNotes: true
prerelease: ${{contains('debug', env.BUILD_TYPE)}}
tag: ${{ steps.setVersion.outputs.version }}
# Release creation - Act mock version with enhanced output
- name: Create Release (Act Mock)
if: steps.detect_env.outputs.is_local == 'true'
run: |
echo "=== Mock Release Creation ==="
echo "Would create release with:"
echo "- Tag: ${{ steps.setVersion.outputs.version }}"
echo "- Prerelease: ${{contains('debug', env.BUILD_TYPE)}}"
echo "- Artifacts matching pattern: output/cpz/*,output/**/*.cplz"
echo ""
echo "Matching artifacts:"
find ./output/cpz -type f
find ./output -name "*.cplz"
# Detailed info about release artifacts
echo ""
echo "Artifact Details:"
for artifact in $(find ./output/cpz -type f; find ./output -name "*.cplz"); do
echo "File: $(basename "$artifact")"
echo "Size: $(du -h "$artifact" | cut -f1)"
echo "Created: $(stat -c %y "$artifact")"
echo "MD5: $(md5sum "$artifact" | cut -d' ' -f1)"
echo "--------------------------"
done
echo "============================"
# NuGet setup - GitHub version
- name: Setup NuGet (GitHub)
if: steps.detect_env.outputs.is_local == 'false'
run: |
dotnet nuget add source https://nuget.pkg.github.com/pepperdash/index.json -n github -u pepperdash -p ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text
# NuGet setup - Act mock version
- name: Setup NuGet (Act Mock)
if: steps.detect_env.outputs.is_local == 'true'
run: |
echo "=== Mock NuGet Setup ==="
echo "Would add GitHub NuGet source: https://nuget.pkg.github.com/pepperdash/index.json"
echo "======================="
# Publish to NuGet - GitHub version
- name: Publish to Nuget (GitHub)
if: steps.detect_env.outputs.is_local == 'false'
run: dotnet nuget push ./output/nuget/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }}
# Publish to NuGet - Act mock version
- name: Publish to Nuget (Act Mock)
if: steps.detect_env.outputs.is_local == 'true'
run: |
echo "=== Mock Publish to NuGet ==="
echo "Would publish the following packages to https://api.nuget.org/v3/index.json:"
find ./output/nuget -name "*.nupkg" | sort
echo "============================="
# Publish to GitHub NuGet - GitHub version
- name: Publish to Github Nuget (GitHub)
if: steps.detect_env.outputs.is_local == 'false'
run: dotnet nuget push ./output/nuget/*.nupkg --source github --api-key ${{ secrets.GITHUB_TOKEN }}
# Publish to GitHub NuGet - Act mock version
- name: Publish to Github Nuget (Act Mock)
if: steps.detect_env.outputs.is_local == 'true'
run: |
echo "=== Mock Publish to GitHub NuGet ==="
echo "Would publish the following packages to the GitHub NuGet registry:"
find ./output/nuget -name "*.nupkg" | sort
echo "=================================="

2
.gitignore vendored
View File

@@ -394,5 +394,3 @@ essentials-framework/Essentials Interfaces/PepperDash_Essentials_Interfaces/Pepp
.vscode/settings.json
_site/
api/
*.DS_Store
/._PepperDash.Essentials.4Series.sln

View File

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

View File

@@ -1,282 +0,0 @@
# 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)*

7
runtimeconfig.json Normal file
View File

@@ -0,0 +1,7 @@
{
"runtimeOptions": {
"configProperties": {
"System.Globalization.Invariant": false
}
}
}

View File

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

View File

@@ -8,8 +8,8 @@ using Crestron.SimplSharp;
using PepperDash.Core;
namespace PepperDash.Core
{
namespace PepperDash.Core;
/// <summary>
/// Defines the string event handler for line events on the gather
/// </summary>
@@ -85,7 +85,8 @@ namespace PepperDash.Core
}
/// <summary>
/// Stop method
/// Disconnects this gather from the Port's TextReceived event. This will not fire LineReceived
/// after the this call.
/// </summary>
public void Stop()
{
@@ -175,4 +176,3 @@ namespace PepperDash.Core
Stop();
}
}
}

View File

@@ -5,8 +5,8 @@ using System.Text;
using Crestron.SimplSharp;
using PepperDash.Core;
namespace PepperDash.Core
{
namespace PepperDash.Core;
/// <summary>
/// Controls the ability to disable/enable debugging of TX/RX data sent to/from a device with a built in timer to disable
/// </summary>
@@ -23,7 +23,7 @@ namespace PepperDash.Core
private CTimer DebugExpiryPeriod;
/// <summary>
/// Gets or sets the DebugSetting
/// The current debug setting
/// </summary>
public eStreamDebuggingSetting DebugSetting { get; private set; }
@@ -42,7 +42,7 @@ namespace PepperDash.Core
}
/// <summary>
/// Gets or sets the RxStreamDebuggingIsEnabled
/// Indicates that receive stream debugging is enabled
/// </summary>
public bool RxStreamDebuggingIsEnabled{ get; private set; }
@@ -65,9 +65,6 @@ 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)
@@ -84,9 +81,6 @@ 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)
@@ -141,9 +135,6 @@ namespace PepperDash.Core
/// The available settings for stream debugging
/// </summary>
[Flags]
/// <summary>
/// Enumeration of eStreamDebuggingSetting values
/// </summary>
public enum eStreamDebuggingSetting
{
/// <summary>
@@ -183,4 +174,3 @@ namespace PepperDash.Core
/// </summary>
Both = Bytes | Text,
}
}

View File

@@ -3,10 +3,10 @@ using Crestron.SimplSharp;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace PepperDash.Core
{
namespace PepperDash.Core;
/// <summary>
/// Represents a ControlPropertiesConfig
/// Config properties that indicate how to communicate with a device for control
/// </summary>
public class ControlPropertiesConfig
{
@@ -90,4 +90,3 @@ namespace PepperDash.Core
{
}
}
}

View File

@@ -16,8 +16,8 @@ using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronSockets;
namespace PepperDash.Core
{
namespace PepperDash.Core;
/// <summary>
/// Delegate for notifying of socket status changes
/// </summary>
@@ -30,7 +30,7 @@ namespace PepperDash.Core
public class GenericSocketStatusChageEventArgs : EventArgs
{
/// <summary>
/// Gets or sets the Client
///
/// </summary>
public ISocketStatus Client { get; private set; }
@@ -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; }
@@ -246,6 +246,3 @@ namespace PepperDash.Core
}
}

View File

@@ -7,8 +7,8 @@ using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronSockets;
using PepperDash.Core.Logging;
namespace PepperDash.Core
{
namespace PepperDash.Core;
/// <summary>
/// A class to handle secure TCP/IP communications with a server
/// </summary>
@@ -79,7 +79,7 @@ namespace PepperDash.Core
}
/// <summary>
/// Gets or sets the Port
/// Port on server
/// </summary>
public int Port { get; set; }
@@ -149,7 +149,7 @@ namespace PepperDash.Core
public string ConnectionFailure { get { return ClientStatus.ToString(); } }
/// <summary>
/// Gets or sets the AutoReconnect
/// bool to track if auto reconnect should be set on the socket
/// </summary>
public bool AutoReconnect { get; set; }
@@ -188,7 +188,7 @@ namespace PepperDash.Core
#region GenericSecureTcpIpClient properties
/// <summary>
/// Gets or sets the SharedKeyRequired
/// Bool to show whether the server requires a preshared key. This is used in the DynamicTCPServer class
/// </summary>
public bool SharedKeyRequired { get; set; }
@@ -207,7 +207,7 @@ namespace PepperDash.Core
}
/// <summary>
/// Gets or sets the SharedKey
/// 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
/// </summary>
public string SharedKey { get; set; }
@@ -222,7 +222,7 @@ namespace PepperDash.Core
bool IsTryingToConnect;
/// <summary>
/// Gets or sets the IsReadyForCommunication
/// Bool showing if socket is ready for communication after shared key exchange
/// </summary>
public bool IsReadyForCommunication { get; set; }
@@ -342,7 +342,7 @@ namespace PepperDash.Core
}
/// <summary>
/// Initialize method
/// Just to help S+ set the key
/// </summary>
public void Initialize(string key)
{
@@ -421,9 +421,6 @@ namespace PepperDash.Core
/// Deactivate the client
/// </summary>
/// <returns></returns>
/// <summary>
/// Deactivate method
/// </summary>
public override bool Deactivate()
{
if (_client != null)
@@ -435,7 +432,7 @@ namespace PepperDash.Core
}
/// <summary>
/// Connect method
/// Connect Method. Will return if already connected. Will write errors if missing address, port, or unique key/name.
/// </summary>
public void Connect()
{
@@ -566,7 +563,7 @@ namespace PepperDash.Core
}
/// <summary>
/// Disconnect method
///
/// </summary>
public void Disconnect()
{
@@ -589,7 +586,7 @@ namespace PepperDash.Core
}
/// <summary>
/// DisconnectClient method
/// Does the actual disconnect business
/// </summary>
public void DisconnectClient()
{
@@ -849,7 +846,7 @@ namespace PepperDash.Core
}
/// <summary>
/// SendText method
/// General send method
/// </summary>
public void SendText(string text)
{
@@ -878,7 +875,7 @@ namespace PepperDash.Core
}
/// <summary>
/// SendBytes method
///
/// </summary>
public void SendBytes(byte[] bytes)
{
@@ -954,5 +951,3 @@ namespace PepperDash.Core
}
#endregion
}
}

View File

@@ -19,8 +19,8 @@ using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronSockets;
using PepperDash.Core.Logging;
namespace PepperDash.Core
{
namespace PepperDash.Core;
/// <summary>
/// Generic secure TCP/IP client for server
/// </summary>
@@ -80,7 +80,7 @@ namespace PepperDash.Core
public string Hostname { get; set; }
/// <summary>
/// Gets or sets the Port
/// Port on server
/// </summary>
public int Port { get; set; }
@@ -113,7 +113,7 @@ namespace PepperDash.Core
}
/// <summary>
/// Gets or sets the SharedKey
/// 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
/// </summary>
public string SharedKey { get; set; }
@@ -123,7 +123,7 @@ namespace PepperDash.Core
private bool WaitingForSharedKeyResponse { get; set; }
/// <summary>
/// Gets or sets the BufferSize
/// Defaults to 2000
/// </summary>
public int BufferSize { get; set; }
@@ -336,7 +336,7 @@ namespace PepperDash.Core
#region Methods
/// <summary>
/// Initialize method
/// Just to help S+ set the key
/// </summary>
public void Initialize(string key)
{
@@ -395,7 +395,7 @@ namespace PepperDash.Core
}
/// <summary>
/// Connect method
/// Connect Method. Will return if already connected. Will write errors if missing address, port, or unique key/name.
/// </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>
/// SendText method
/// General send method
/// </summary>
public void SendText(string text)
{
@@ -833,7 +833,7 @@ namespace PepperDash.Core
}
/// <summary>
/// SendBytes method
///
/// </summary>
public void SendBytes(byte[] bytes)
{
@@ -905,5 +905,3 @@ namespace PepperDash.Core
}
#endregion
}
}

View File

@@ -17,8 +17,8 @@ using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronSockets;
using PepperDash.Core.Logging;
namespace PepperDash.Core
{
namespace PepperDash.Core;
/// <summary>
/// Generic secure TCP/IP server
/// </summary>
@@ -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>
/// Gets or sets the MonitorClientMaxFailureCount
/// 3 by default
/// </summary>
public int MonitorClientMaxFailureCount { get; set; }
@@ -190,7 +190,7 @@ namespace PepperDash.Core
}
/// <summary>
/// Gets or sets the Port
/// Port Server should listen on
/// </summary>
public int Port { get; set; }
@@ -223,7 +223,8 @@ namespace PepperDash.Core
}
/// <summary>
/// Gets or sets the SharedKey
/// 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
/// </summary>
public string SharedKey { get; set; }
@@ -247,7 +248,7 @@ namespace PepperDash.Core
}
/// <summary>
/// Gets or sets the HeartbeatRequiredIntervalMs
/// Milliseconds before server expects another heartbeat. Set by property HeartbeatRequiredIntervalInSeconds which is driven from S+
/// </summary>
public int HeartbeatRequiredIntervalMs { get; set; }
@@ -257,7 +258,7 @@ namespace PepperDash.Core
public ushort HeartbeatRequiredIntervalInSeconds { set { HeartbeatRequiredIntervalMs = (value * 1000); } }
/// <summary>
/// Gets or sets the HeartbeatStringToMatch
/// String to Match for heartbeat. If null or empty any string will reset heartbeat timer
/// </summary>
public string HeartbeatStringToMatch { get; set; }
@@ -275,7 +276,7 @@ namespace PepperDash.Core
public List<uint> ConnectedClientsIndexes = new List<uint>();
/// <summary>
/// Gets or sets the BufferSize
/// Defaults to 2000
/// </summary>
public int BufferSize { get; set; }
@@ -338,7 +339,7 @@ namespace PepperDash.Core
#region Methods - Server Actions
/// <summary>
/// KillServer method
/// Disconnects all clients and stops the server
/// </summary>
public void KillServer()
{
@@ -355,9 +356,6 @@ 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;
@@ -397,7 +395,7 @@ namespace PepperDash.Core
}
/// <summary>
/// Listen method
/// Start listening on the specified port
/// </summary>
public void Listen()
{
@@ -455,7 +453,7 @@ namespace PepperDash.Core
}
/// <summary>
/// StopListening method
/// Stop Listeneing
/// </summary>
public void StopListening()
{
@@ -480,9 +478,6 @@ namespace PepperDash.Core
/// Disconnects Client
/// </summary>
/// <param name="client"></param>
/// <summary>
/// DisconnectClient method
/// </summary>
public void DisconnectClient(uint client)
{
try
@@ -496,7 +491,7 @@ namespace PepperDash.Core
}
}
/// <summary>
/// DisconnectAllClientsForShutdown method
/// Disconnect All Clients
/// </summary>
public void DisconnectAllClientsForShutdown()
{
@@ -538,9 +533,6 @@ 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();
@@ -574,9 +566,6 @@ namespace PepperDash.Core
/// </summary>
/// <param name="text"></param>
/// <param name="clientIndex"></param>
/// <summary>
/// SendTextToClient method
/// </summary>
public void SendTextToClient(string text, uint clientIndex)
{
try
@@ -645,9 +634,6 @@ 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);
@@ -1095,4 +1081,3 @@ namespace PepperDash.Core
}
#endregion
}
}

View File

@@ -8,8 +8,8 @@ using PepperDash.Core.Logging;
using Renci.SshNet;
using Renci.SshNet.Common;
namespace PepperDash.Core
{
namespace PepperDash.Core;
/// <summary>
///
/// </summary>
@@ -36,13 +36,13 @@ namespace PepperDash.Core
/// </summary>
public event EventHandler<GenericSocketStatusChageEventArgs> ConnectionChange;
/// <summary>
///// <summary>
/////
///// </summary>
//public event GenericSocketStatusChangeEventDelegate SocketStatusChange;
/// <summary>
/// Gets or sets the Hostname
/// Address of server
/// </summary>
public string Hostname { get; set; }
@@ -52,12 +52,12 @@ namespace PepperDash.Core
public int Port { get; set; }
/// <summary>
/// Gets or sets the Username
/// Username for server
/// </summary>
public string Username { get; set; }
/// <summary>
/// Gets or sets the Password
/// And... Password for server. That was worth documenting!
/// </summary>
public string Password { get; set; }
@@ -79,7 +79,7 @@ namespace PepperDash.Core
}
/// <summary>
/// Socket status change event
///
/// </summary>
public SocketStatus ClientStatus
{
@@ -123,7 +123,8 @@ namespace PepperDash.Core
}
/// <summary>
/// Gets or sets the AutoReconnectIntervalMs
/// Millisecond value, determines the timeout period in between reconnect attempts.
/// Set to 5000 by default
/// </summary>
public int AutoReconnectIntervalMs { get; set; }
@@ -197,7 +198,7 @@ namespace PepperDash.Core
}
/// <summary>
/// Connect method
/// Connect to the server, using the provided properties.
/// </summary>
public void Connect()
{
@@ -223,7 +224,10 @@ namespace PepperDash.Core
this.LogDebug("Attempting connect");
// Cancel reconnect if running.
ReconnectTimer?.Stop();
if (ReconnectTimer != null)
{
ReconnectTimer.Stop();
}
// Cleanup the old client if it already exists
if (Client != null)
@@ -265,26 +269,20 @@ namespace PepperDash.Core
if (ie is SocketException)
{
this.LogError("CONNECTION failure: Cannot reach host");
this.LogVerbose(ie, "Exception details: ");
this.LogException(ie, "CONNECTION failure: Cannot reach host");
}
if (ie is System.Net.Sockets.SocketException socketException)
{
this.LogError("Connection failure: Cannot reach {host} on {port}",
this.LogException(ie, "Connection failure: Cannot reach {host} on {port}",
Hostname, Port);
this.LogVerbose(socketException, "SocketException details: ");
}
if (ie is SshAuthenticationException)
{
this.LogError("Authentication failure for username {userName}", Username);
this.LogVerbose(ie, "AuthenticationException details: ");
this.LogException(ie, "Authentication failure for username {userName}", Username);
}
else
{
this.LogError("Error on connect: {error}", ie.Message);
this.LogVerbose(ie, "Exception details: ");
}
this.LogException(ie, "Error on connect");
DisconnectLogged = true;
KillClient(SocketStatus.SOCKET_STATUS_CONNECT_FAILED);
@@ -309,8 +307,7 @@ namespace PepperDash.Core
catch (Exception e)
{
var errorLogLevel = DisconnectLogged == true ? Debug.ErrorLogLevel.None : Debug.ErrorLogLevel.Error;
this.LogError("Unhandled exception on connect: {error}", e.Message);
this.LogVerbose(e, "Exception details: ");
this.LogException(e, "Unhandled exception on connect");
DisconnectLogged = true;
KillClient(SocketStatus.SOCKET_STATUS_CONNECT_FAILED);
if (AutoReconnect)
@@ -328,7 +325,7 @@ namespace PepperDash.Core
}
/// <summary>
/// Disconnect method
/// Disconnect the clients and put away it's resources.
/// </summary>
public void Disconnect()
{
@@ -469,7 +466,8 @@ namespace PepperDash.Core
/// </summary>
void OnConnectionChange()
{
ConnectionChange?.Invoke(this, new GenericSocketStatusChageEventArgs(this));
if (ConnectionChange != null)
ConnectionChange(this, new GenericSocketStatusChageEventArgs(this));
}
#region IBasicCommunication Members
@@ -477,7 +475,7 @@ namespace PepperDash.Core
/// <summary>
/// Sends text to the server
/// </summary>
/// <param name="text">The text to send</param>
/// <param name="text"></param>
public void SendText(string text)
{
try
@@ -514,7 +512,7 @@ namespace PepperDash.Core
/// <summary>
/// Sends Bytes to the server
/// </summary>
/// <param name="bytes">The bytes to send</param>
/// <param name="bytes"></param>
public void SendBytes(byte[] bytes)
{
try
@@ -551,7 +549,7 @@ namespace PepperDash.Core
//*****************************************************************************************************
//*****************************************************************************************************
/// <summary>
/// Represents a SshConnectionChangeEventArgs
/// Fired when connection changes
/// </summary>
public class SshConnectionChangeEventArgs : EventArgs
{
@@ -561,17 +559,17 @@ namespace PepperDash.Core
public bool IsConnected { get; private set; }
/// <summary>
/// Gets or sets the UIsConnected
/// Connection Status represented as a ushort
/// </summary>
public ushort UIsConnected { get { return (ushort)(Client.IsConnected ? 1 : 0); } }
/// <summary>
/// Gets or sets the Client
/// The client
/// </summary>
public GenericSshClient Client { get; private set; }
/// <summary>
/// Gets or sets the Status
/// Socket Status as represented by
/// </summary>
public ushort Status { get { return Client.UStatus; } }
@@ -591,4 +589,3 @@ namespace PepperDash.Core
Client = client;
}
}
}

View File

@@ -6,8 +6,8 @@ using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronSockets;
using Newtonsoft.Json;
namespace PepperDash.Core
{
namespace PepperDash.Core;
/// <summary>
/// A class to handle basic TCP/IP communications with a server
/// </summary>
@@ -59,7 +59,7 @@ namespace PepperDash.Core
}
/// <summary>
/// Gets or sets the Port
/// Port on server
/// </summary>
public int Port { get; set; }
@@ -136,7 +136,7 @@ namespace PepperDash.Core
public string ConnectionFailure { get { return ClientStatus.ToString(); } }
/// <summary>
/// Gets or sets the AutoReconnect
/// bool to track if auto reconnect should be set on the socket
/// </summary>
public bool AutoReconnect { get; set; }
@@ -232,7 +232,7 @@ namespace PepperDash.Core
}
/// <summary>
/// Initialize method
/// Just to help S+ set the key
/// </summary>
public void Initialize(string key)
{
@@ -255,9 +255,6 @@ namespace PepperDash.Core
///
/// </summary>
/// <returns></returns>
/// <summary>
/// Deactivate method
/// </summary>
public override bool Deactivate()
{
RetryTimer.Stop();
@@ -271,7 +268,7 @@ namespace PepperDash.Core
}
/// <summary>
/// Connect method
/// Attempts to connect to the server
/// </summary>
public void Connect()
{
@@ -338,7 +335,7 @@ namespace PepperDash.Core
}
/// <summary>
/// Disconnect method
/// Attempts to disconnect the client
/// </summary>
public void Disconnect()
{
@@ -358,7 +355,7 @@ namespace PepperDash.Core
}
/// <summary>
/// DisconnectClient method
/// Does the actual disconnect business
/// </summary>
public void DisconnectClient()
{
@@ -450,7 +447,7 @@ namespace PepperDash.Core
}
/// <summary>
/// SendText method
/// General send method
/// </summary>
public void SendText(string text)
{
@@ -463,7 +460,7 @@ namespace PepperDash.Core
}
/// <summary>
/// SendEscapedText method
/// This is useful from console and...?
/// </summary>
public void SendEscapedText(string text)
{
@@ -479,9 +476,6 @@ 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)
@@ -515,7 +509,7 @@ namespace PepperDash.Core
}
/// <summary>
/// Represents a TcpSshPropertiesConfig
/// Configuration properties for TCP/SSH Connections
/// </summary>
public class TcpSshPropertiesConfig
{
@@ -536,7 +530,7 @@ namespace PepperDash.Core
/// </summary>
public string Username { get; set; }
/// <summary>
/// Gets or sets the Password
/// Passord credential
/// </summary>
public string Password { get; set; }
@@ -546,12 +540,12 @@ namespace PepperDash.Core
public int BufferSize { get; set; }
/// <summary>
/// Gets or sets the AutoReconnect
/// Defaults to true
/// </summary>
public bool AutoReconnect { get; set; }
/// <summary>
/// Gets or sets the AutoReconnectIntervalMs
/// Defaults to 5000ms
/// </summary>
public int AutoReconnectIntervalMs { get; set; }
@@ -568,5 +562,3 @@ namespace PepperDash.Core
}
}
}

View File

@@ -19,8 +19,8 @@ using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronSockets;
using PepperDash.Core.Logging;
namespace PepperDash.Core
{
namespace PepperDash.Core;
/// <summary>
/// Generic TCP/IP client for server
/// </summary>
@@ -69,7 +69,7 @@ namespace PepperDash.Core
public string Hostname { get; set; }
/// <summary>
/// Gets or sets the Port
/// Port on server
/// </summary>
public int Port { get; set; }
@@ -102,7 +102,7 @@ namespace PepperDash.Core
}
/// <summary>
/// Gets or sets the SharedKey
/// 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
/// </summary>
public string SharedKey { get; set; }
@@ -112,7 +112,7 @@ namespace PepperDash.Core
private bool WaitingForSharedKeyResponse { get; set; }
/// <summary>
/// Gets or sets the BufferSize
/// Defaults to 2000
/// </summary>
public int BufferSize { get; set; }
@@ -289,7 +289,7 @@ namespace PepperDash.Core
#region Methods
/// <summary>
/// Initialize method
/// Just to help S+ set the key
/// </summary>
public void Initialize(string key)
{
@@ -311,7 +311,7 @@ namespace PepperDash.Core
}
/// <summary>
/// Connect method
/// Connect Method. Will return if already connected. Will write errors if missing address, port, or unique key/name.
/// </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>
/// SendText method
/// General send method
/// </summary>
public void SendText(string text)
{
@@ -698,7 +698,7 @@ namespace PepperDash.Core
}
/// <summary>
/// SendBytes method
///
/// </summary>
public void SendBytes(byte[] bytes)
{
@@ -771,5 +771,3 @@ namespace PepperDash.Core
}
#endregion
}
}

View File

@@ -17,8 +17,8 @@ using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronSockets;
using PepperDash.Core.Logging;
namespace PepperDash.Core
{
namespace PepperDash.Core;
/// <summary>
/// Generic TCP/IP server device
/// </summary>
@@ -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>
/// Gets or sets the MonitorClientMaxFailureCount
/// 3 by default
/// </summary>
public int MonitorClientMaxFailureCount { get; set; }
@@ -171,7 +171,7 @@ namespace PepperDash.Core
}
/// <summary>
/// Gets or sets the Port
/// Port Server should listen on
/// </summary>
public int Port { get; set; }
@@ -204,7 +204,8 @@ namespace PepperDash.Core
}
/// <summary>
/// Gets or sets the SharedKey
/// 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
/// </summary>
public string SharedKey { get; set; }
@@ -228,7 +229,7 @@ namespace PepperDash.Core
}
/// <summary>
/// Gets or sets the HeartbeatRequiredIntervalMs
/// Milliseconds before server expects another heartbeat. Set by property HeartbeatRequiredIntervalInSeconds which is driven from S+
/// </summary>
public int HeartbeatRequiredIntervalMs { get; set; }
@@ -238,7 +239,7 @@ namespace PepperDash.Core
public ushort HeartbeatRequiredIntervalInSeconds { set { HeartbeatRequiredIntervalMs = (value * 1000); } }
/// <summary>
/// Gets or sets the HeartbeatStringToMatch
/// String to Match for heartbeat. If null or empty any string will reset heartbeat timer
/// </summary>
public string HeartbeatStringToMatch { get; set; }
@@ -256,7 +257,7 @@ namespace PepperDash.Core
public List<uint> ConnectedClientsIndexes = new List<uint>();
/// <summary>
/// Gets or sets the BufferSize
/// Defaults to 2000
/// </summary>
public int BufferSize { get; set; }
@@ -319,7 +320,7 @@ namespace PepperDash.Core
#region Methods - Server Actions
/// <summary>
/// KillServer method
/// Disconnects all clients and stops the server
/// </summary>
public void KillServer()
{
@@ -336,9 +337,6 @@ 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;
@@ -377,7 +375,7 @@ namespace PepperDash.Core
}
/// <summary>
/// Listen method
/// Start listening on the specified port
/// </summary>
public void Listen()
{
@@ -434,7 +432,7 @@ namespace PepperDash.Core
}
/// <summary>
/// StopListening method
/// Stop Listening
/// </summary>
public void StopListening()
{
@@ -459,9 +457,6 @@ namespace PepperDash.Core
/// Disconnects Client
/// </summary>
/// <param name="client"></param>
/// <summary>
/// DisconnectClient method
/// </summary>
public void DisconnectClient(uint client)
{
try
@@ -475,7 +470,7 @@ namespace PepperDash.Core
}
}
/// <summary>
/// DisconnectAllClientsForShutdown method
/// Disconnect All Clients
/// </summary>
public void DisconnectAllClientsForShutdown()
{
@@ -517,9 +512,6 @@ 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();
@@ -553,9 +545,6 @@ namespace PepperDash.Core
/// </summary>
/// <param name="text"></param>
/// <param name="clientIndex"></param>
/// <summary>
/// SendTextToClient method
/// </summary>
public void SendTextToClient(string text, uint clientIndex)
{
try
@@ -624,9 +613,6 @@ 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);
@@ -1022,4 +1008,3 @@ namespace PepperDash.Core
}
#endregion
}
}

View File

@@ -8,8 +8,8 @@ using Crestron.SimplSharp.CrestronSockets;
using Newtonsoft.Json;
using PepperDash.Core.Logging;
namespace PepperDash.Core
{
namespace PepperDash.Core;
/// <summary>
/// Generic UDP Server device
/// </summary>
@@ -150,9 +150,6 @@ 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;
@@ -188,7 +185,7 @@ namespace PepperDash.Core
}
/// <summary>
/// Connect method
/// Enables the UDP Server
/// </summary>
public void Connect()
{
@@ -225,7 +222,7 @@ namespace PepperDash.Core
}
/// <summary>
/// Disconnect method
/// Disabled the UDP Server
/// </summary>
public void Disconnect()
{
@@ -295,9 +292,6 @@ 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);
@@ -315,9 +309,6 @@ namespace PepperDash.Core
///
/// </summary>
/// <param name="bytes"></param>
/// <summary>
/// SendBytes method
/// </summary>
public void SendBytes(byte[] bytes)
{
if (StreamDebugging.TxStreamDebuggingIsEnabled)
@@ -330,7 +321,7 @@ namespace PepperDash.Core
}
/// <summary>
/// Represents a GenericUdpReceiveTextExtraArgs
///
/// </summary>
public class GenericUdpReceiveTextExtraArgs : EventArgs
{
@@ -402,4 +393,3 @@ namespace PepperDash.Core
BufferSize = 32768;
}
}
}

View File

@@ -1,9 +1,9 @@
using Newtonsoft.Json;
namespace PepperDash.Core
{
namespace PepperDash.Core;
/// <summary>
/// Represents a TcpClientConfigObject
/// Client config object for TCP client with server that inherits from TcpSshPropertiesConfig and adds properties for shared key and heartbeat
/// </summary>
public class TcpClientConfigObject
{
@@ -56,4 +56,3 @@ namespace PepperDash.Core
[JsonProperty("receiveQueueSize")]
public int ReceiveQueueSize { get; set; }
}
}

View File

@@ -4,8 +4,8 @@ using System.Linq;
using System.Text;
using Crestron.SimplSharp;
namespace PepperDash.Core
{
namespace PepperDash.Core;
/// <summary>
/// Tcp Server Config object with properties for a tcp server with shared key and heartbeat capabilities
/// </summary>
@@ -57,4 +57,3 @@ namespace PepperDash.Core
/// </summary>
public int ReceiveQueueSize { get; set; }
}
}

View File

@@ -4,8 +4,8 @@ using System.Linq;
using System.Text;
using Crestron.SimplSharp;
namespace PepperDash.Core
{
namespace PepperDash.Core;
/// <summary>
/// Crestron Control Methods for a comm object
/// </summary>
@@ -74,10 +74,5 @@ namespace PepperDash.Core
/// <summary>
/// Secure TCP/IP
/// </summary>
SecureTcpIp,
/// <summary>
/// Used when comms needs to be handled in SIMPL and bridged opposite the normal direction
/// </summary>
ComBridge
}
SecureTcpIp
}

View File

@@ -7,8 +7,8 @@ using Crestron.SimplSharp.CrestronSockets;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
namespace PepperDash.Core
{
namespace PepperDash.Core;
/// <summary>
/// An incoming communication stream
/// </summary>
@@ -39,7 +39,7 @@ namespace PepperDash.Core
}
/// <summary>
/// Defines the contract for IBasicCommunication
/// Represents a device that uses basic connection
/// </summary>
public interface IBasicCommunication : ICommunicationReceiver
{
@@ -148,7 +148,7 @@ namespace PepperDash.Core
public class GenericCommMethodReceiveBytesArgs : EventArgs
{
/// <summary>
/// Gets or sets the Bytes
///
/// </summary>
public byte[] Bytes { get; private set; }
@@ -228,9 +228,6 @@ 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);
@@ -242,12 +239,8 @@ 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

@@ -7,8 +7,8 @@ using Newtonsoft.Json.Linq;
using PepperDash.Core;
using Serilog.Events;
namespace PepperDash.Core.Config
{
namespace PepperDash.Core.Config;
/// <summary>
/// Reads a Portal formatted config file
/// </summary>
@@ -67,9 +67,6 @@ 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"]);
@@ -235,4 +232,3 @@ namespace PepperDash.Core.Config
return o1;
}
}
}

View File

@@ -4,28 +4,18 @@ using System.Linq;
using System.Text;
using Crestron.SimplSharp;
namespace PepperDash.Core
{
/// <summary>
/// Represents a EncodingHelper
/// </summary>
namespace PepperDash.Core;
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

@@ -6,15 +6,15 @@ using Crestron.SimplSharp;
using Newtonsoft.Json;
using Serilog;
namespace PepperDash.Core
{
namespace PepperDash.Core;
/// <summary>
/// Unique key interface to require a unique key for the class
/// </summary>
public interface IKeyed
{
/// <summary>
/// Unique Key
/// Gets the unique key associated with the object.
/// </summary>
[JsonProperty("key")]
string Key { get; }
@@ -26,10 +26,8 @@ namespace PepperDash.Core
public interface IKeyName : IKeyed
{
/// <summary>
/// Isn't it obvious :)
/// Gets the name associated with the current object.
/// </summary>
[JsonProperty("name")]
string Name { get; }
}
}

View File

@@ -2,11 +2,11 @@
using System.Collections.Generic;
using Serilog.Events;
namespace PepperDash.Core
{
namespace PepperDash.Core;
//*********************************************************************************************************
/// <summary>
/// Represents a Device
/// The core event and status-bearing class that most if not all device and connectors can derive from.
/// </summary>
public class Device : IKeyName
{
@@ -16,7 +16,7 @@ namespace PepperDash.Core
/// </summary>
public string Key { get; protected set; }
/// <summary>
/// Gets or sets the Name
/// Name of the devie
/// </summary>
public string Name { get; protected set; }
/// <summary>
@@ -24,14 +24,14 @@ namespace PepperDash.Core
/// </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,9 +86,6 @@ 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)
@@ -97,7 +94,7 @@ namespace PepperDash.Core
}
/// <summary>
/// PreActivate method
/// Executes the preactivation actions
/// </summary>
public void PreActivate()
{
@@ -116,7 +113,9 @@ namespace PepperDash.Core
}
/// <summary>
/// Activate method
/// Gets this device ready to be used in the system. Runs any added pre-activation items, and
/// all post-activation at end. Classes needing additional logic to
/// run should override CustomActivate()
/// </summary>
public bool Activate()
{
@@ -129,7 +128,7 @@ namespace PepperDash.Core
}
/// <summary>
/// PostActivate method
/// Executes the postactivation actions
/// </summary>
public void PostActivate()
{
@@ -153,9 +152,6 @@ 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>
@@ -188,12 +184,8 @@ namespace PepperDash.Core
/// <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

@@ -2,10 +2,10 @@
using Newtonsoft.Json;
using Serilog.Events;
namespace PepperDash.Core
{
namespace PepperDash.Core;
/// <summary>
/// Represents a EthernetHelper
/// Class to help with accessing values from the CrestronEthernetHelper class
/// </summary>
public class EthernetHelper
{
@@ -25,7 +25,7 @@ namespace PepperDash.Core
// ADD OTHER HELPERS HERE
/// <summary>
/// Gets or sets the PortNumber
///
/// </summary>
public int PortNumber { get; private set; }
@@ -114,4 +114,3 @@ namespace PepperDash.Core
}
}
}
}

View File

@@ -4,8 +4,8 @@ using System.Linq;
using System.Text;
using Crestron.SimplSharp;
namespace PepperDash.Core
{
namespace PepperDash.Core;
/// <summary>
/// Bool change event args
/// </summary>
@@ -17,17 +17,17 @@ namespace PepperDash.Core
public bool State { get; set; }
/// <summary>
/// Gets or sets the IntValue
/// Boolean ushort value property
/// </summary>
public ushort IntValue { get { return (ushort)(State ? 1 : 0); } }
/// <summary>
/// Gets or sets the Type
/// Boolean change event args type
/// </summary>
public ushort Type { get; set; }
/// <summary>
/// Gets or sets the Index
/// Boolean change event args index
/// </summary>
public ushort Index { get; set; }
@@ -65,7 +65,7 @@ namespace PepperDash.Core
}
/// <summary>
/// Represents a UshrtChangeEventArgs
/// Ushort change event args
/// </summary>
public class UshrtChangeEventArgs : EventArgs
{
@@ -75,12 +75,12 @@ namespace PepperDash.Core
public ushort IntValue { get; set; }
/// <summary>
/// Gets or sets the Type
/// Ushort change event args type
/// </summary>
public ushort Type { get; set; }
/// <summary>
/// Gets or sets the Index
/// Ushort change event args index
/// </summary>
public ushort Index { get; set; }
@@ -118,7 +118,7 @@ namespace PepperDash.Core
}
/// <summary>
/// Represents a StringChangeEventArgs
/// String change event args
/// </summary>
public class StringChangeEventArgs : EventArgs
{
@@ -128,12 +128,12 @@ namespace PepperDash.Core
public string StringValue { get; set; }
/// <summary>
/// Gets or sets the Type
/// String change event args type
/// </summary>
public ushort Type { get; set; }
/// <summary>
/// Gets or sets the Index
/// string change event args index
/// </summary>
public ushort Index { get; set; }
@@ -169,4 +169,3 @@ namespace PepperDash.Core
Index = index;
}
}
}

View File

@@ -4,8 +4,8 @@ using System.Linq;
using System.Text;
using Crestron.SimplSharp;
namespace PepperDash.Core.GenericRESTfulCommunications
{
namespace PepperDash.Core.GenericRESTfulCommunications;
/// <summary>
/// Constants
/// </summary>
@@ -36,4 +36,3 @@ namespace PepperDash.Core.GenericRESTfulCommunications
/// </summary>
public const ushort ErrorStringChange = 203;
}
}

View File

@@ -6,8 +6,8 @@ using Crestron.SimplSharp;
using Crestron.SimplSharp.Net.Http;
using Crestron.SimplSharp.Net.Https;
namespace PepperDash.Core.GenericRESTfulCommunications
{
namespace PepperDash.Core.GenericRESTfulCommunications;
/// <summary>
/// Generic RESTful communication class
/// </summary>
@@ -253,4 +253,3 @@ namespace PepperDash.Core.GenericRESTfulCommunications
}
}
}
}

View File

@@ -4,8 +4,8 @@ using System.Linq;
using System.Text;
using Crestron.SimplSharp;
namespace PepperDash.Core.JsonStandardObjects
{
namespace PepperDash.Core.JsonStandardObjects;
/// <summary>
/// Constants for simpl modules
/// </summary>
@@ -33,12 +33,12 @@ namespace PepperDash.Core.JsonStandardObjects
public DeviceConfig Device { get; set; }
/// <summary>
/// Gets or sets the Type
/// Device change event args type
/// </summary>
public ushort Type { get; set; }
/// <summary>
/// Gets or sets the Index
/// Device change event args index
/// </summary>
public ushort Index { get; set; }
@@ -74,4 +74,3 @@ namespace PepperDash.Core.JsonStandardObjects
Index = index;
}
}
}

View File

@@ -4,8 +4,8 @@ using Crestron.SimplSharp;
using PepperDash.Core.JsonToSimpl;
using Serilog.Events;
namespace PepperDash.Core.JsonStandardObjects
{
namespace PepperDash.Core.JsonStandardObjects;
/// <summary>
/// Device class
/// </summary>
@@ -58,9 +58,6 @@ 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
@@ -183,4 +180,3 @@ namespace PepperDash.Core.JsonStandardObjects
#endregion EventHandler Helpers
}
}

View File

@@ -4,8 +4,8 @@ using System.Linq;
using System.Text;
using Crestron.SimplSharp;
namespace PepperDash.Core.JsonStandardObjects
{
namespace PepperDash.Core.JsonStandardObjects;
/*
Convert JSON snippt to C#: http://json2csharp.com/#
@@ -48,12 +48,12 @@ namespace PepperDash.Core.JsonStandardObjects
}
*/
/// <summary>
/// Represents a ComParamsConfig
/// Device communication parameter class
/// </summary>
public class ComParamsConfig
{
/// <summary>
/// Gets or sets the baudRate
///
/// </summary>
public int baudRate { get; set; }
/// <summary>
@@ -87,11 +87,11 @@ namespace PepperDash.Core.JsonStandardObjects
// convert properties for simpl
/// <summary>
/// Gets or sets the simplBaudRate
///
/// </summary>
public ushort simplBaudRate { get { return Convert.ToUInt16(baudRate); } }
/// <summary>
/// Gets or sets the simplDataBits
///
/// </summary>
public ushort simplDataBits { get { return Convert.ToUInt16(dataBits); } }
/// <summary>
@@ -144,11 +144,11 @@ namespace PepperDash.Core.JsonStandardObjects
// convert properties for simpl
/// <summary>
/// Gets or sets the simplPort
///
/// </summary>
public ushort simplPort { get { return Convert.ToUInt16(port); } }
/// <summary>
/// Gets or sets the simplAutoReconnect
///
/// </summary>
public ushort simplAutoReconnect { get { return (ushort)(autoReconnect ? 1 : 0); } }
/// <summary>
@@ -193,7 +193,7 @@ namespace PepperDash.Core.JsonStandardObjects
// convert properties for simpl
/// <summary>
/// Gets or sets the simplControlPortNumber
///
/// </summary>
public ushort simplControlPortNumber { get { return Convert.ToUInt16(controlPortNumber); } }
@@ -208,7 +208,7 @@ namespace PepperDash.Core.JsonStandardObjects
}
/// <summary>
/// Represents a PropertiesConfig
/// Device properties class
/// </summary>
public class PropertiesConfig
{
@@ -227,11 +227,11 @@ namespace PepperDash.Core.JsonStandardObjects
// convert properties for simpl
/// <summary>
/// Gets or sets the simplDeviceId
///
/// </summary>
public ushort simplDeviceId { get { return Convert.ToUInt16(deviceId); } }
/// <summary>
/// Gets or sets the simplEnabled
///
/// </summary>
public ushort simplEnabled { get { return (ushort)(enabled ? 1 : 0); } }
@@ -254,4 +254,3 @@ namespace PepperDash.Core.JsonStandardObjects
/// </summary>
public List<DeviceConfig> devices { get; set; }
}
}

View File

@@ -4,8 +4,8 @@ using System.Linq;
using System.Text;
using Crestron.SimplSharp;
namespace PepperDash.Core.JsonToSimpl
{
namespace PepperDash.Core.JsonToSimpl;
/// <summary>
/// Constants for Simpl modules
/// </summary>
@@ -89,7 +89,7 @@ namespace PepperDash.Core.JsonToSimpl
public class SPlusValueWrapper
{
/// <summary>
/// Gets or sets the ValueType
///
/// </summary>
public SPlusType ValueType { get; private set; }
/// <summary>
@@ -123,7 +123,7 @@ namespace PepperDash.Core.JsonToSimpl
}
/// <summary>
/// Enumeration of SPlusType values
/// S+ types enum
/// </summary>
public enum SPlusType
{
@@ -140,4 +140,3 @@ namespace PepperDash.Core.JsonToSimpl
/// </summary>
String
}
}

View File

@@ -7,8 +7,8 @@ using Serilog.Events;
//using PepperDash.Core;
namespace PepperDash.Core.JsonToSimpl
{
namespace PepperDash.Core.JsonToSimpl;
/// <summary>
/// The global class to manage all the instances of JsonToSimplMaster
/// </summary>
@@ -23,9 +23,6 @@ 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)
@@ -53,11 +50,10 @@ namespace PepperDash.Core.JsonToSimpl
}
/// <summary>
/// GetMasterByFile method
/// Gets a master by its key. Case-insensitive
/// </summary>
public static JsonToSimplMaster GetMasterByFile(string file)
{
return Masters.FirstOrDefault(m => m.UniqueID.Equals(file, StringComparison.OrdinalIgnoreCase));
}
}
}

View File

@@ -3,10 +3,10 @@ using System.Linq;
using Newtonsoft.Json.Linq;
using Serilog.Events;
namespace PepperDash.Core.JsonToSimpl
{
namespace PepperDash.Core.JsonToSimpl;
/// <summary>
/// Represents a JsonToSimplArrayLookupChild
/// Used to interact with an array of values with the S+ modules
/// </summary>
public class JsonToSimplArrayLookupChild : JsonToSimplChildObjectBase
{
@@ -77,9 +77,8 @@ namespace PepperDash.Core.JsonToSimpl
}
/// <summary>
/// ProcessAll method
/// Process all values
/// </summary>
/// <inheritdoc />
public override void ProcessAll()
{
if (FindInArray())
@@ -160,4 +159,3 @@ namespace PepperDash.Core.JsonToSimpl
return false;
}
}
}

View File

@@ -3,8 +3,8 @@ using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json.Linq;
namespace PepperDash.Core.JsonToSimpl
{
namespace PepperDash.Core.JsonToSimpl;
/// <summary>
/// Base class for JSON objects
/// </summary>
@@ -29,12 +29,12 @@ namespace PepperDash.Core.JsonToSimpl
public SPlusValuesDelegate GetAllValuesDelegate { get; set; }
/// <summary>
/// Gets or sets the SetAllPathsDelegate
/// Use a callback to reduce task switch/threading
/// </summary>
public SPlusValuesDelegate SetAllPathsDelegate { get; set; }
/// <summary>
/// Gets or sets the Key
/// Unique identifier for instance
/// </summary>
public string Key { get; protected set; }
@@ -50,7 +50,7 @@ namespace PepperDash.Core.JsonToSimpl
public string PathSuffix { get; protected set; }
/// <summary>
/// Gets or sets the LinkedToObject
/// Indicates if the instance is linked to an object
/// </summary>
public bool LinkedToObject { get; protected set; }
@@ -96,9 +96,6 @@ 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;
@@ -114,7 +111,7 @@ namespace PepperDash.Core.JsonToSimpl
}
/// <summary>
/// SetUshortPath method
/// Set the JPath for a ushort out index.
/// </summary>
public void SetUshortPath(ushort index, string path)
{
@@ -124,7 +121,7 @@ namespace PepperDash.Core.JsonToSimpl
}
/// <summary>
/// SetStringPath method
/// Set the JPath for a string output index.
/// </summary>
public void SetStringPath(ushort index, string path)
{
@@ -134,9 +131,9 @@ namespace PepperDash.Core.JsonToSimpl
}
/// <summary>
/// ProcessAll method
/// Evalutates all outputs with defined paths. called by S+ when paths are ready to process
/// and by Master when file is read.
/// </summary>
/// <inheritdoc />
public virtual void ProcessAll()
{
if (!LinkedToObject)
@@ -280,9 +277,6 @@ 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);
@@ -293,9 +287,6 @@ 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))
@@ -307,9 +298,6 @@ 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))
@@ -321,9 +309,6 @@ 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))
@@ -335,9 +320,6 @@ 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);
@@ -419,4 +401,3 @@ namespace PepperDash.Core.JsonToSimpl
}
}
}
}

View File

@@ -7,8 +7,8 @@ using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Newtonsoft.Json.Linq;
namespace PepperDash.Core.JsonToSimpl
{
namespace PepperDash.Core.JsonToSimpl;
/// <summary>
/// Represents a JSON file that can be read and written to
/// </summary>
@@ -20,12 +20,12 @@ namespace PepperDash.Core.JsonToSimpl
public string Filepath { get; private set; }
/// <summary>
/// Gets or sets the ActualFilePath
/// Filepath to the actual file that will be read (Portal or local)
/// </summary>
public string ActualFilePath { get; private set; }
/// <summary>
/// Gets or sets the Filename
///
/// </summary>
public string Filename { get; private set; }
/// <summary>
@@ -194,9 +194,6 @@ 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);
@@ -289,4 +286,3 @@ namespace PepperDash.Core.JsonToSimpl
}
}
}
}

View File

@@ -1,9 +1,9 @@
namespace PepperDash.Core.JsonToSimpl
{
namespace PepperDash.Core.JsonToSimpl;
/// <summary>
/// Represents a JsonToSimplFixedPathObject
///
/// </summary>
public class JsonToSimplFixedPathObject : JsonToSimplChildObjectBase
{
@@ -15,4 +15,3 @@ namespace PepperDash.Core.JsonToSimpl
this.LinkedToObject = true;
}
}
}

View File

@@ -3,10 +3,10 @@ using System.Collections.Generic;
using Crestron.SimplSharp;
using Newtonsoft.Json.Linq;
namespace PepperDash.Core.JsonToSimpl
{
namespace PepperDash.Core.JsonToSimpl;
/// <summary>
/// Represents a JsonToSimplGenericMaster
/// Generic Master
/// </summary>
public class JsonToSimplGenericMaster : JsonToSimplMaster
{
@@ -21,7 +21,7 @@ namespace PepperDash.Core.JsonToSimpl
static object WriteLock = new object();
/// <summary>
/// Gets or sets the SaveCallback
/// Callback action for saving
/// </summary>
public Action<string> SaveCallback { get; set; }
@@ -60,9 +60,6 @@ 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
@@ -76,9 +73,8 @@ namespace PepperDash.Core.JsonToSimpl
}
/// <summary>
/// Save method
///
/// </summary>
/// <inheritdoc />
public override void Save()
{
// this code is duplicated in the other masters!!!!!!!!!!!!!
@@ -119,4 +115,3 @@ namespace PepperDash.Core.JsonToSimpl
Debug.Console(0, this, "WARNING: No save callback defined.");
}
}
}

View File

@@ -2,12 +2,11 @@ using System;
using System.Collections.Generic;
using System.IO;
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace PepperDash.Core.JsonToSimpl
{
namespace PepperDash.Core.JsonToSimpl;
/// <summary>
/// Abstract base class for JsonToSimpl interactions
/// </summary>
@@ -39,7 +38,7 @@ namespace PepperDash.Core.JsonToSimpl
public string Key { get { return UniqueID; } }
/// <summary>
/// Gets or sets the UniqueID
/// A unique ID
/// </summary>
public string UniqueID { get; protected set; }
@@ -54,7 +53,8 @@ namespace PepperDash.Core.JsonToSimpl
string _DebugName = "";
/// <summary>
/// Gets or sets the PathPrefix
/// This will be prepended to all paths to allow path swapping or for more organized
/// sub-paths
/// </summary>
public string PathPrefix { get; set; }
@@ -83,7 +83,7 @@ namespace PepperDash.Core.JsonToSimpl
}
/// <summary>
/// Gets or sets the JsonObject
///
/// </summary>
public JObject JsonObject { get; protected set; }
@@ -119,9 +119,6 @@ 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))
@@ -131,7 +128,7 @@ namespace PepperDash.Core.JsonToSimpl
}
/// <summary>
/// AddUnsavedValue method
/// Called from the child to add changed or new values for saving
/// </summary>
public void AddUnsavedValue(string path, JValue value)
{
@@ -162,11 +159,7 @@ namespace PepperDash.Core.JsonToSimpl
/// <returns></returns>
public static JObject ParseObject(string json)
{
#if NET6_0
using (var reader = new JsonTextReader(new System.IO.StringReader(json)))
#else
using (var reader = new JsonTextReader(new Crestron.SimplSharp.CrestronIO.StringReader(json)))
#endif
using (var reader = new JsonTextReader(new StringReader(json)))
{
var startDepth = reader.Depth;
var obj = JObject.Load(reader);
@@ -181,16 +174,10 @@ namespace PepperDash.Core.JsonToSimpl
/// </summary>
/// <param name="json"></param>
/// <returns></returns>
/// <summary>
/// ParseArray method
/// </summary>
public static JArray ParseArray(string json)
{
#if NET6_0
using (var reader = new JsonTextReader(new System.IO.StringReader(json)))
#else
using (var reader = new JsonTextReader(new Crestron.SimplSharp.CrestronIO.StringReader(json)))
#endif
using (var reader = new JsonTextReader(new StringReader(json)))
{
var startDepth = reader.Depth;
var obj = JArray.Load(reader);
@@ -249,4 +236,3 @@ namespace PepperDash.Core.JsonToSimpl
}
}
}
}

View File

@@ -6,8 +6,8 @@ using Crestron.SimplSharp.CrestronIO;
using Newtonsoft.Json.Linq;
using PepperDash.Core.Config;
namespace PepperDash.Core.JsonToSimpl
{
namespace PepperDash.Core.JsonToSimpl;
/// <summary>
/// Portal File Master
/// </summary>
@@ -19,7 +19,7 @@ namespace PepperDash.Core.JsonToSimpl
public string PortalFilepath { get; private set; }
/// <summary>
/// Gets or sets the ActualFilePath
/// File path of the actual file being read (Portal or local)
/// </summary>
public string ActualFilePath { get; private set; }
@@ -128,9 +128,6 @@ namespace PepperDash.Core.JsonToSimpl
///
/// </summary>
/// <param name="level"></param>
/// <summary>
/// setDebugLevel method
/// </summary>
public void setDebugLevel(uint level)
{
Debug.SetDebugLevel(level);
@@ -191,4 +188,3 @@ namespace PepperDash.Core.JsonToSimpl
}
}
}
}

View File

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

View File

@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Net;
using System.Reflection;
using System.Text.RegularExpressions;
using Crestron.SimplSharp;
@@ -17,9 +16,10 @@ using Serilog.Formatting.Compact;
using Serilog.Formatting.Json;
using Serilog.Templates;
namespace PepperDash.Core
{
namespace PepperDash.Core;
/// <summary>
/// Contains debug commands for use in various situations
/// </summary>
public static class Debug
{
@@ -27,6 +27,7 @@ namespace PepperDash.Core
private static readonly string WebSocketLevelStoreKey = "WebsocketDebugLevel";
private static readonly string ErrorLogLevelStoreKey = "ErrorLogDebugLevel";
private static readonly string FileLevelStoreKey = "FileDebugLevel";
private static readonly string DoNotLoadOnNextBootKey = "DoNotLoadOnNextBoot";
private static readonly Dictionary<uint, LogEventLevel> _logLevels = new Dictionary<uint, LogEventLevel>()
{
@@ -48,9 +49,6 @@ namespace PepperDash.Core
private static readonly LoggingLevelSwitch _fileLevelSwitch;
/// <summary>
/// Gets the minimum log level for the websocket sink.
/// </summary>
public static LogEventLevel WebsocketMinimumLogLevel
{
get { return _websocketLoggingLevelSwitch.MinimumLevel; }
@@ -58,9 +56,6 @@ namespace PepperDash.Core
private static readonly DebugWebsocketSink _websocketSink;
/// <summary>
/// Gets the websocket sink for debug logging.
/// </summary>
public static DebugWebsocketSink WebsocketSink
{
get { return _websocketSink; }
@@ -84,12 +79,12 @@ namespace PepperDash.Core
public static string FileName = string.Format(@"app{0}Debug.json", InitialParametersClass.ApplicationNumber);
/// <summary>
/// Gets or sets the Level
/// Debug level to set for a given program.
/// </summary>
public static int Level { get; private set; }
/// <summary>
/// Gets or sets the DoNotLoadConfigOnNextBoot
/// When this is true, the configuration file will NOT be loaded until triggered by either a console command or a signal
/// </summary>
public static bool DoNotLoadConfigOnNextBoot { get; private set; }
@@ -97,13 +92,10 @@ namespace PepperDash.Core
private const int SaveTimeoutMs = 30000;
/// <summary>
/// Indicates whether the system is running on an appliance.
/// </summary>
public static bool IsRunningOnAppliance = CrestronEnvironment.DevicePlatform == eDevicePlatform.Appliance;
/// <summary>
/// Gets or sets the PepperDashCoreVersion
/// Version for the currently loaded PepperDashCore dll
/// </summary>
public static string PepperDashCoreVersion { get; private set; }
@@ -115,18 +107,19 @@ namespace PepperDash.Core
/// </summary>
private static bool _excludeAllMode;
//static bool ExcludeNoKeyMessages;
private static readonly Dictionary<string, object> IncludedExcludedKeys;
private static readonly LoggerConfiguration _defaultLoggerConfiguration;
private static LoggerConfiguration _loggerConfiguration;
/// <summary>
/// Gets the logger configuration for the debug logging.
/// </summary>
public static LoggerConfiguration LoggerConfiguration => _loggerConfiguration;
static Debug()
{
try
{
CrestronDataStoreStatic.InitCrestronDataStore();
@@ -172,21 +165,6 @@ namespace PepperDash.Core
levelSwitch: _fileLevelSwitch
);
try
{
if (InitialParametersClass.NumberOfRemovableDrives > 0)
{
CrestronConsole.PrintLine("{0} RM Drive(s) Present. Initializing CrestronLogger", InitialParametersClass.NumberOfRemovableDrives);
_defaultLoggerConfiguration.WriteTo.Sink(new DebugCrestronLoggerSink());
}
else
CrestronConsole.PrintLine("No RM Drive(s) Present. Not using Crestron Logger");
}
catch (Exception e)
{
CrestronConsole.PrintLine("Initializing of CrestronLogger failed: {0}", e);
}
// Instantiate the root logger
_loggerConfiguration = _defaultLoggerConfiguration;
@@ -228,11 +206,7 @@ namespace PepperDash.Core
CrestronEnvironment.ProgramStatusEventHandler += CrestronEnvironment_ProgramStatusEventHandler;
LoadMemory();
var context = _contexts.GetOrCreateItem("DEFAULT");
Level = context.Level;
DoNotLoadConfigOnNextBoot = context.DoNotLoadOnNextBoot;
DoNotLoadConfigOnNextBoot = GetDoNotLoadOnNextBoot();
if (DoNotLoadConfigOnNextBoot)
CrestronConsole.PrintLine(string.Format("Program {0} will not load config after next boot. Use console command go:{0} to load the config manually", InitialParametersClass.ApplicationNumber));
@@ -242,10 +216,25 @@ namespace PepperDash.Core
LogMessage(LogEventLevel.Information, "Console debug level set to {minimumLevel}", _consoleLoggingLevelSwitch.MinimumLevel);
};
}
catch (Exception ex)
{
LogError(ex, "Exception in Debug static constructor: {message}", ex.Message);
}
}
private static bool GetDoNotLoadOnNextBoot()
{
var err = CrestronDataStoreStatic.GetLocalBoolValue(DoNotLoadOnNextBootKey, out var doNotLoad);
if (err != CrestronDataStore.CDS_ERROR.CDS_SUCCESS)
{
LogError("Error retrieving DoNotLoadOnNextBoot value: {err}", err);
doNotLoad = false;
}
return doNotLoad;
}
/// <summary>
/// UpdateLoggerConfiguration method
/// </summary>
public static void UpdateLoggerConfiguration(LoggerConfiguration config)
{
_loggerConfiguration = config;
@@ -253,9 +242,6 @@ namespace PepperDash.Core
_logger = config.CreateLogger();
}
/// <summary>
/// ResetLoggerConfiguration method
/// </summary>
public static void ResetLoggerConfiguration()
{
_loggerConfiguration = _defaultLoggerConfiguration;
@@ -272,9 +258,6 @@ namespace PepperDash.Core
if (result != CrestronDataStore.CDS_ERROR.CDS_SUCCESS)
{
CrestronConsole.Print($"Unable to retrieve stored log level for {levelStoreKey}.\r\nError: {result}.\r\nSetting level to {LogEventLevel.Information}\r\n");
CrestronDataStoreStatic.SetLocalIntValue(levelStoreKey, (int)LogEventLevel.Information);
return LogEventLevel.Information;
}
@@ -339,9 +322,6 @@ namespace PepperDash.Core
/// Callback for console command
/// </summary>
/// <param name="levelString"></param>
/// <summary>
/// SetDebugFromConsole method
/// </summary>
public static void SetDebugFromConsole(string levelString)
{
try
@@ -376,7 +356,7 @@ namespace PepperDash.Core
return;
}
if (Enum.TryParse<LogEventLevel>(levelString, true, out var levelEnum))
if (Enum.TryParse<LogEventLevel>(levelString, out var levelEnum))
{
SetDebugLevel(levelEnum);
return;
@@ -394,9 +374,6 @@ namespace PepperDash.Core
/// Sets the debug level
/// </summary>
/// <param name="level"> Valid values 0-5</param>
/// <summary>
/// SetDebugLevel method
/// </summary>
public static void SetDebugLevel(uint level)
{
if (!_logLevels.TryGetValue(level, out var logLevel))
@@ -411,9 +388,6 @@ namespace PepperDash.Core
SetDebugLevel(logLevel);
}
/// <summary>
/// SetDebugLevel method
/// </summary>
public static void SetDebugLevel(LogEventLevel level)
{
_consoleLoggingLevelSwitch.MinimumLevel = level;
@@ -431,9 +405,6 @@ namespace PepperDash.Core
CrestronConsole.PrintLine($"Error saving console debug level setting: {err}");
}
/// <summary>
/// SetWebSocketMinimumDebugLevel method
/// </summary>
public static void SetWebSocketMinimumDebugLevel(LogEventLevel level)
{
_websocketLoggingLevelSwitch.MinimumLevel = level;
@@ -446,9 +417,6 @@ namespace PepperDash.Core
LogMessage(LogEventLevel.Information, "Websocket debug level set to {0}", _websocketLoggingLevelSwitch.MinimumLevel);
}
/// <summary>
/// SetErrorLogMinimumDebugLevel method
/// </summary>
public static void SetErrorLogMinimumDebugLevel(LogEventLevel level)
{
_errorLogLevelSwitch.MinimumLevel = level;
@@ -461,9 +429,6 @@ namespace PepperDash.Core
LogMessage(LogEventLevel.Information, "Error log debug level set to {0}", _websocketLoggingLevelSwitch.MinimumLevel);
}
/// <summary>
/// SetFileMinimumDebugLevel method
/// </summary>
public static void SetFileMinimumDebugLevel(LogEventLevel level)
{
_errorLogLevelSwitch.MinimumLevel = level;
@@ -480,9 +445,6 @@ namespace PepperDash.Core
/// Callback for console command
/// </summary>
/// <param name="stateString"></param>
/// <summary>
/// SetDoNotLoadOnNextBootFromConsole method
/// </summary>
public static void SetDoNotLoadOnNextBootFromConsole(string stateString)
{
try
@@ -505,9 +467,6 @@ namespace PepperDash.Core
/// Callback for console command
/// </summary>
/// <param name="items"></param>
/// <summary>
/// SetDebugFilterFromConsole method
/// </summary>
public static void SetDebugFilterFromConsole(string items)
{
var str = items.Trim();
@@ -603,9 +562,6 @@ namespace PepperDash.Core
/// </summary>
/// <param name="deviceKey"></param>
/// <returns></returns>
/// <summary>
/// GetDeviceDebugSettingsForKey method
/// </summary>
public static object GetDeviceDebugSettingsForKey(string deviceKey)
{
return _contexts.GetDebugSettingsForKey(deviceKey);
@@ -618,15 +574,17 @@ namespace PepperDash.Core
public static void SetDoNotLoadConfigOnNextBoot(bool state)
{
DoNotLoadConfigOnNextBoot = state;
_contexts.GetOrCreateItem("DEFAULT").DoNotLoadOnNextBoot = state;
SaveMemoryOnTimeout();
CrestronConsole.ConsoleCommandResponse("[Application {0}], Do Not Load Config on Next Boot set to {1}",
InitialParametersClass.ApplicationNumber, DoNotLoadConfigOnNextBoot);
var err = CrestronDataStoreStatic.SetLocalBoolValue(DoNotLoadOnNextBootKey, state);
if (err != CrestronDataStore.CDS_ERROR.CDS_SUCCESS)
LogError("Error saving console debug level setting: {err}", err);
LogInformation("Do Not Load Config on Next Boot set to {state}", DoNotLoadConfigOnNextBoot);
}
/// <summary>
/// ShowDebugLog method
///
/// </summary>
public static void ShowDebugLog(string s)
{
@@ -642,9 +600,6 @@ namespace PepperDash.Core
/// <param name="message">Message template</param>
/// <param name="device">Optional IKeyed device. If provided, the Key of the device will be added to the log message</param>
/// <param name="args">Args to put into message template</param>
/// <summary>
/// LogMessage method
/// </summary>
public static void LogMessage(Exception ex, string message, IKeyed device = null, params object[] args)
{
using (LogContext.PushProperty("Key", device?.Key))
@@ -668,36 +623,21 @@ namespace PepperDash.Core
}
}
/// <summary>
/// Logs a message at the specified log level.
/// </summary>
/// <param name="level">Level to log at</param>
/// <param name="message">Message template</param>
/// <param name="args">Args to put into message template</param>
public static void LogMessage(LogEventLevel level, string message, params object[] args)
{
_logger.Write(level, message, args);
}
/// <summary>
/// LogMessage method
/// </summary>
public static void LogMessage(LogEventLevel level, Exception ex, string message, params object[] args)
{
_logger.Write(level, ex, message, args);
}
/// <summary>
/// LogMessage method
/// </summary>
public static void LogMessage(LogEventLevel level, IKeyed keyed, string message, params object[] args)
{
LogMessage(level, message, keyed, args);
}
/// <summary>
/// LogMessage method
/// </summary>
public static void LogMessage(LogEventLevel level, Exception ex, IKeyed device, string message, params object[] args)
{
using (LogContext.PushProperty("Key", device?.Key))
@@ -707,9 +647,6 @@ namespace PepperDash.Core
}
#region Explicit methods for logging levels
/// <summary>
/// LogVerbose method
/// </summary>
public static void LogVerbose(IKeyed keyed, string message, params object[] args)
{
using (LogContext.PushProperty("Key", keyed?.Key))
@@ -718,9 +655,6 @@ namespace PepperDash.Core
}
}
/// <summary>
/// LogVerbose method
/// </summary>
public static void LogVerbose(Exception ex, IKeyed keyed, string message, params object[] args)
{
using (LogContext.PushProperty("Key", keyed?.Key))
@@ -729,25 +663,16 @@ namespace PepperDash.Core
}
}
/// <summary>
/// LogVerbose method
/// </summary>
public static void LogVerbose(string message, params object[] args)
{
_logger.Write(LogEventLevel.Verbose, message, args);
}
/// <summary>
/// LogVerbose method
/// </summary>
public static void LogVerbose(Exception ex, string message, params object[] args)
{
_logger.Write(LogEventLevel.Verbose, ex, message, args);
_logger.Write(LogEventLevel.Verbose, ex, null, message, args);
}
/// <summary>
/// LogDebug method
/// </summary>
public static void LogDebug(IKeyed keyed, string message, params object[] args)
{
using (LogContext.PushProperty("Key", keyed?.Key))
@@ -756,9 +681,6 @@ namespace PepperDash.Core
}
}
/// <summary>
/// LogDebug method
/// </summary>
public static void LogDebug(Exception ex, IKeyed keyed, string message, params object[] args)
{
using (LogContext.PushProperty("Key", keyed?.Key))
@@ -767,25 +689,16 @@ namespace PepperDash.Core
}
}
/// <summary>
/// LogDebug method
/// </summary>
public static void LogDebug(string message, params object[] args)
{
_logger.Write(LogEventLevel.Debug, message, args);
}
/// <summary>
/// LogDebug method
/// </summary>
public static void LogDebug(Exception ex, string message, params object[] args)
{
_logger.Write(LogEventLevel.Debug, ex, null, message, args);
}
/// <summary>
/// LogInformation method
/// </summary>
public static void LogInformation(IKeyed keyed, string message, params object[] args)
{
using (LogContext.PushProperty("Key", keyed?.Key))
@@ -794,9 +707,6 @@ namespace PepperDash.Core
}
}
/// <summary>
/// LogInformation method
/// </summary>
public static void LogInformation(Exception ex, IKeyed keyed, string message, params object[] args)
{
using (LogContext.PushProperty("Key", keyed?.Key))
@@ -805,25 +715,16 @@ namespace PepperDash.Core
}
}
/// <summary>
/// LogInformation method
/// </summary>
public static void LogInformation(string message, params object[] args)
{
_logger.Write(LogEventLevel.Information, message, args);
}
/// <summary>
/// LogInformation method
/// </summary>
public static void LogInformation(Exception ex, string message, params object[] args)
{
_logger.Write(LogEventLevel.Information, ex, message, args);
_logger.Write(LogEventLevel.Information, ex, null, message, args);
}
/// <summary>
/// LogWarning method
/// </summary>
public static void LogWarning(IKeyed keyed, string message, params object[] args)
{
using (LogContext.PushProperty("Key", keyed?.Key))
@@ -832,9 +733,6 @@ namespace PepperDash.Core
}
}
/// <summary>
/// LogWarning method
/// </summary>
public static void LogWarning(Exception ex, IKeyed keyed, string message, params object[] args)
{
using (LogContext.PushProperty("Key", keyed?.Key))
@@ -843,25 +741,16 @@ namespace PepperDash.Core
}
}
/// <summary>
/// LogWarning method
/// </summary>
public static void LogWarning(string message, params object[] args)
{
_logger.Write(LogEventLevel.Warning, message, args);
}
/// <summary>
/// LogWarning method
/// </summary>
public static void LogWarning(Exception ex, string message, params object[] args)
{
_logger.Write(LogEventLevel.Warning, ex, message, args);
_logger.Write(LogEventLevel.Warning, ex, null, message, args);
}
/// <summary>
/// LogError method
/// </summary>
public static void LogError(IKeyed keyed, string message, params object[] args)
{
using (LogContext.PushProperty("Key", keyed?.Key))
@@ -870,9 +759,6 @@ namespace PepperDash.Core
}
}
/// <summary>
/// LogError method
/// </summary>
public static void LogError(Exception ex, IKeyed keyed, string message, params object[] args)
{
using (LogContext.PushProperty("Key", keyed?.Key))
@@ -881,25 +767,16 @@ namespace PepperDash.Core
}
}
/// <summary>
/// LogError method
/// </summary>
public static void LogError(string message, params object[] args)
{
_logger.Write(LogEventLevel.Error, message, args);
}
/// <summary>
/// LogError method
/// </summary>
public static void LogError(Exception ex, string message, params object[] args)
{
_logger.Write(LogEventLevel.Error, ex, message, args);
_logger.Write(LogEventLevel.Error, ex, null, message, args);
}
/// <summary>
/// LogFatal method
/// </summary>
public static void LogFatal(IKeyed keyed, string message, params object[] args)
{
using (LogContext.PushProperty("Key", keyed?.Key))
@@ -908,9 +785,6 @@ namespace PepperDash.Core
}
}
/// <summary>
/// LogFatal method
/// </summary>
public static void LogFatal(Exception ex, IKeyed keyed, string message, params object[] args)
{
using (LogContext.PushProperty("Key", keyed?.Key))
@@ -919,20 +793,14 @@ namespace PepperDash.Core
}
}
/// <summary>
/// LogFatal method
/// </summary>
public static void LogFatal(string message, params object[] args)
{
_logger.Write(LogEventLevel.Fatal, message, args);
}
/// <summary>
/// LogFatal method
/// </summary>
public static void LogFatal(Exception ex, string message, params object[] args)
{
_logger.Write(LogEventLevel.Fatal, ex, message, args);
_logger.Write(LogEventLevel.Fatal, ex, null, message, args);
}
#endregion
@@ -1006,9 +874,6 @@ namespace PepperDash.Core
/// Logs to Console when at-level, and all messages to error log
/// </summary>
[Obsolete("Use LogMessage methods, Will be removed in 2.2.0 and later versions")]
/// <summary>
/// Console method
/// </summary>
public static void Console(uint level, ErrorLogLevel errorLogLevel,
string format, params object[] items)
{
@@ -1021,9 +886,6 @@ namespace PepperDash.Core
/// it will only be written to the log.
/// </summary>
[Obsolete("Use LogMessage methods, Will be removed in 2.2.0 and later versions")]
/// <summary>
/// ConsoleWithLog method
/// </summary>
public static void ConsoleWithLog(uint level, string format, params object[] items)
{
LogMessage(level, format, items);
@@ -1146,7 +1008,7 @@ namespace PepperDash.Core
}
/// <summary>
/// Enumeration of ErrorLogLevel values
/// Error level to for message to be logged at
/// </summary>
public enum ErrorLogLevel
{
@@ -1168,4 +1030,3 @@ namespace PepperDash.Core
None,
}
}
}

View File

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

View File

@@ -6,8 +6,8 @@ using Crestron.SimplSharp.CrestronIO;
using Newtonsoft.Json;
namespace PepperDash.Core
{
namespace PepperDash.Core;
/// <summary>
/// Represents a debugging context
/// </summary>
@@ -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,9 +38,6 @@ 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));
@@ -95,9 +92,6 @@ namespace PepperDash.Core
/// Callback for console command
/// </summary>
/// <param name="levelString"></param>
/// <summary>
/// SetDebugFromConsole method
/// </summary>
public void SetDebugFromConsole(string levelString)
{
try
@@ -120,9 +114,6 @@ 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)
@@ -150,7 +141,7 @@ namespace PepperDash.Core
}
/// <summary>
/// Console method
/// Appends a device Key to the beginning of a message
/// </summary>
public void Console(uint level, IKeyed dev, string format, params object[] items)
{
@@ -200,9 +191,6 @@ 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);
@@ -290,4 +278,3 @@ namespace PepperDash.Core
/// </summary>
public int Level { get; set; }
}
}

View File

@@ -3,16 +3,10 @@ using Crestron.SimplSharp.CrestronLogger;
using Serilog.Core;
using Serilog.Events;
namespace PepperDash.Core.Logging
{
/// <summary>
/// Represents a DebugCrestronLoggerSink
/// </summary>
namespace PepperDash.Core.Logging;
public class DebugCrestronLoggerSink : ILogEventSink
{
/// <summary>
/// Emit method
/// </summary>
public void Emit(LogEvent logEvent)
{
if (!Debug.IsRunningOnAppliance) return;
@@ -32,4 +26,3 @@ namespace PepperDash.Core.Logging
CrestronLogger.Initialize(1, LoggerModeEnum.RM);
}
}
}

View File

@@ -9,11 +9,8 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PepperDash.Core.Logging
{
/// <summary>
/// Represents a DebugErrorLogSink
/// </summary>
namespace PepperDash.Core.Logging;
public class DebugErrorLogSink : ILogEventSink
{
private ITextFormatter _formatter;
@@ -27,9 +24,6 @@ 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;
@@ -68,4 +62,3 @@ namespace PepperDash.Core.Logging
_formatter = formatter;
}
}
}

View File

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

View File

@@ -2,10 +2,10 @@
using Crestron.SimplSharp;
using Newtonsoft.Json;
namespace PepperDash.Core.Logging
{
namespace PepperDash.Core.Logging;
/// <summary>
/// Represents a DebugContextCollection
/// Class to persist current Debug settings across program restarts
/// </summary>
public class DebugContextCollection
{
@@ -39,9 +39,6 @@ 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)
@@ -54,9 +51,6 @@ namespace PepperDash.Core.Logging
/// </summary>
/// <param name="contextKey"></param>
/// <returns></returns>
/// <summary>
/// GetOrCreateItem method
/// </summary>
public DebugContextItem GetOrCreateItem(string contextKey)
{
if (!_items.ContainsKey(contextKey))
@@ -71,9 +65,6 @@ 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
@@ -98,9 +89,6 @@ namespace PepperDash.Core.Logging
/// </summary>
/// <param name="deviceKey"></param>
/// <returns></returns>
/// <summary>
/// GetDebugSettingsForKey method
/// </summary>
public object GetDebugSettingsForKey(string deviceKey)
{
return DeviceDebugSettings[deviceKey];
@@ -124,4 +112,3 @@ namespace PepperDash.Core.Logging
[JsonProperty("doNotLoadOnNextBoot")]
public bool DoNotLoadOnNextBoot { get; set; }
}
}

View File

@@ -1,37 +1,38 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Crestron.SimplSharp;
using Org.BouncyCastle.Asn1.X509;
using Serilog;
using Serilog.Configuration;
using Serilog.Core;
using Serilog.Events;
using Serilog.Configuration;
using WebSocketSharp.Server;
using Crestron.SimplSharp;
using WebSocketSharp;
using System.Security.Authentication;
using WebSocketSharp.Net;
using X509Certificate2 = System.Security.Cryptography.X509Certificates.X509Certificate2;
using System.IO;
using Org.BouncyCastle.Asn1.X509;
using Serilog.Formatting;
using Newtonsoft.Json.Linq;
using Serilog.Formatting.Json;
using System;
using System.IO;
using System.Security.Authentication;
using WebSocketSharp;
using WebSocketSharp.Server;
using X509Certificate2 = System.Security.Cryptography.X509Certificates.X509Certificate2;
namespace PepperDash.Core;
namespace PepperDash.Core
{
/// <summary>
/// Represents a DebugWebsocketSink
/// Provides a WebSocket-based logging sink for debugging purposes, allowing log events to be broadcast to connected
/// WebSocket clients.
/// </summary>
public class DebugWebsocketSink : ILogEventSink
/// <remarks>This class implements the <see cref="ILogEventSink"/> interface and is designed to send
/// formatted log events to WebSocket clients connected to a secure WebSocket server. The server is hosted locally
/// and uses a self-signed certificate for SSL/TLS encryption.</remarks>
public class DebugWebsocketSink : ILogEventSink, IKeyed
{
private HttpServer _httpsServer;
private string _path = "/debug/join/";
private readonly string _path = "/debug/join/";
private const string _certificateName = "selfCres";
private const string _certificatePassword = "cres12345";
/// <summary>
/// Gets the port number on which the HTTPS server is currently running.
/// </summary>
public int Port
{ get
{
@@ -41,6 +42,11 @@ namespace PepperDash.Core
}
}
/// <summary>
/// Gets the WebSocket URL for the current server instance.
/// </summary>
/// <remarks>The URL is dynamically constructed based on the server's current IP address, port,
/// and WebSocket path.</remarks>
public string Url
{
get
@@ -51,20 +57,30 @@ namespace PepperDash.Core
}
/// <summary>
/// Gets or sets the IsRunning
/// Gets a value indicating whether the HTTPS server is currently listening for incoming connections.
/// </summary>
public bool IsRunning { get => _httpsServer?.IsListening ?? false; }
/// <inheritdoc/>
public string Key => "DebugWebsocketSink";
private readonly ITextFormatter _textFormatter;
/// <summary>
/// Initializes a new instance of the <see cref="DebugWebsocketSink"/> class with the specified text formatter.
/// </summary>
/// <remarks>This constructor initializes the WebSocket sink and ensures that a certificate is
/// available for secure communication. If the required certificate does not exist, it will be created
/// automatically. Additionally, the sink is configured to stop the server when the program is
/// stopping.</remarks>
/// <param name="formatProvider">The text formatter used to format log messages. If null, a default JSON formatter is used.</param>
public DebugWebsocketSink(ITextFormatter formatProvider)
{
_textFormatter = formatProvider ?? new JsonFormatter();
if (!File.Exists($"\\user\\{_certificateName}.pfx"))
CreateCert(null);
CreateCert();
CrestronEnvironment.ProgramStatusEventHandler += type =>
{
@@ -75,45 +91,41 @@ namespace PepperDash.Core
};
}
private void CreateCert(string[] args)
private static void CreateCert()
{
try
{
//Debug.Console(0,"CreateCert Creating Utility");
CrestronConsole.PrintLine("CreateCert Creating Utility");
//var utility = new CertificateUtility();
var utility = new BouncyCertificate();
//Debug.Console(0, "CreateCert Calling CreateCert");
CrestronConsole.PrintLine("CreateCert Calling CreateCert");
//utility.CreateCert();
var ipAddress = CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_ADDRESS, 0);
var hostName = CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_HOSTNAME, 0);
var domainName = CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_DOMAIN_NAME, 0);
//Debug.Console(0, "DomainName: {0} | HostName: {1} | {1}.{0}@{2}", domainName, hostName, ipAddress);
CrestronConsole.PrintLine(string.Format("DomainName: {0} | HostName: {1} | {1}.{0}@{2}", domainName, hostName, ipAddress));
var certificate = utility.CreateSelfSignedCertificate(string.Format("CN={0}.{1}", hostName, domainName), new[] { string.Format("{0}.{1}", hostName, domainName), ipAddress }, new[] { KeyPurposeID.id_kp_serverAuth, KeyPurposeID.id_kp_clientAuth });
var certificate = utility.CreateSelfSignedCertificate(string.Format("CN={0}.{1}", hostName, domainName), [string.Format("{0}.{1}", hostName, domainName), ipAddress], [KeyPurposeID.id_kp_serverAuth, KeyPurposeID.id_kp_clientAuth]);
//Crestron fails to let us do this...perhaps it should be done through their Dll's but haven't tested
//Debug.Print($"CreateCert Storing Certificate To My.LocalMachine");
//utility.AddCertToStore(certificate, StoreName.My, StoreLocation.LocalMachine);
//Debug.Console(0, "CreateCert Saving Cert to \\user\\");
CrestronConsole.PrintLine("CreateCert Saving Cert to \\user\\");
var separator = Path.DirectorySeparatorChar;
utility.CertificatePassword = _certificatePassword;
utility.WriteCertificate(certificate, @"\user\", _certificateName);
//Debug.Console(0, "CreateCert Ending CreateCert");
CrestronConsole.PrintLine("CreateCert Ending CreateCert");
utility.WriteCertificate(certificate, @$"{separator}user{separator}", _certificateName);
}
catch (Exception ex)
{
//Debug.Console(0, "WSS CreateCert Failed\r\n{0}\r\n{1}", ex.Message, ex.StackTrace);
CrestronConsole.PrintLine(string.Format("WSS CreateCert Failed\r\n{0}\r\n{1}", ex.Message, ex.StackTrace));
CrestronConsole.PrintLine("WSS CreateCert Failed\r\n{0}\r\n{1}", ex.Message, ex.StackTrace);
}
}
/// <summary>
/// Emit method
/// Sends a log event to all connected WebSocket clients.
/// </summary>
/// <remarks>The log event is formatted using the configured text formatter and then broadcasted
/// to all clients connected to the WebSocket server. If the WebSocket server is not initialized or not
/// listening, the method exits without performing any action.</remarks>
/// <param name="logEvent">The log event to be formatted and broadcasted. Cannot be null.</param>
public void Emit(LogEvent logEvent)
{
if (_httpsServer == null || !_httpsServer.IsListening) return;
@@ -121,13 +133,16 @@ namespace PepperDash.Core
var sw = new StringWriter();
_textFormatter.Format(logEvent, sw);
_httpsServer.WebSocketServices.Broadcast(sw.ToString());
_httpsServer.WebSocketServices[_path].Sessions.Broadcast(sw.ToString());
}
/// <summary>
/// StartServerAndSetPort method
/// Starts the WebSocket server on the specified port and configures it with the appropriate certificate.
/// </summary>
/// <remarks>This method initializes the WebSocket server and binds it to the specified port. It
/// also applies the server's certificate for secure communication. Ensure that the port is not already in use
/// and that the certificate file is accessible.</remarks>
/// <param name="port">The port number on which the WebSocket server will listen. Must be a valid, non-negative port number.</param>
public void StartServerAndSetPort(int port)
{
Debug.Console(0, "Starting Websocket Server on port: {0}", port);
@@ -142,21 +157,19 @@ namespace PepperDash.Core
{
_httpsServer = new HttpServer(port, true);
if (!string.IsNullOrWhiteSpace(certPath))
{
Debug.Console(0, "Assigning SSL Configuration");
_httpsServer.SslConfiguration = new ServerSslConfiguration(new X509Certificate2(certPath, certPassword))
{
ClientCertificateRequired = false,
CheckCertificateRevocation = false,
EnabledSslProtocols = SslProtocols.Tls12 | SslProtocols.Tls11 | SslProtocols.Tls,
_httpsServer.SslConfiguration.ServerCertificate = new X509Certificate2(certPath, certPassword);
_httpsServer.SslConfiguration.ClientCertificateRequired = false;
_httpsServer.SslConfiguration.CheckCertificateRevocation = false;
_httpsServer.SslConfiguration.EnabledSslProtocols = SslProtocols.Tls12;
//this is just to test, you might want to actually validate
ClientCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) =>
_httpsServer.SslConfiguration.ClientCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) =>
{
Debug.Console(0, "HTTPS ClientCerticateValidation Callback triggered");
return true;
}
};
}
Debug.Console(0, "Adding Debug Client Service");
@@ -206,8 +219,10 @@ namespace PepperDash.Core
}
/// <summary>
/// StopServer method
/// Stops the WebSocket server if it is currently running.
/// </summary>
/// <remarks>This method halts the WebSocket server and releases any associated resources. After
/// calling this method, the server will no longer accept or process incoming connections.</remarks>
public void StopServer()
{
Debug.Console(0, "Stopping Websocket Server");
@@ -217,11 +232,21 @@ namespace PepperDash.Core
}
}
/// <summary>
/// Configures the logger to write log events to a debug WebSocket sink.
/// </summary>
/// <remarks>This extension method allows you to direct log events to a WebSocket sink for debugging
/// purposes.</remarks>
public static class DebugWebsocketSinkExtensions
{
/// <summary>
/// DebugWebsocketSink method
/// Configures a logger to write log events to a debug WebSocket sink.
/// </summary>
/// <remarks>This method adds a sink that writes log events to a WebSocket for debugging purposes.
/// It is typically used during development to stream log events in real-time.</remarks>
/// <param name="loggerConfiguration">The logger sink configuration to apply the WebSocket sink to.</param>
/// <param name="formatProvider">An optional text formatter to format the log events. If not provided, a default formatter will be used.</param>
/// <returns>A <see cref="LoggerConfiguration"/> object that can be used to further configure the logger.</returns>
public static LoggerConfiguration DebugWebsocketSink(
this LoggerSinkConfiguration loggerConfiguration,
ITextFormatter formatProvider = null)
@@ -231,12 +256,19 @@ namespace PepperDash.Core
}
/// <summary>
/// Represents a DebugClient
/// Represents a WebSocket client for debugging purposes, providing connection lifecycle management and message
/// handling functionality.
/// </summary>
/// <remarks>The <see cref="DebugClient"/> class extends <see cref="WebSocketBehavior"/> to handle
/// WebSocket connections, including events for opening, closing, receiving messages, and errors. It tracks the
/// duration of the connection and logs relevant events for debugging.</remarks>
public class DebugClient : WebSocketBehavior
{
private DateTime _connectionTime;
/// <summary>
/// Gets the duration of time the WebSocket connection has been active.
/// </summary>
public TimeSpan ConnectedDuration
{
get
@@ -252,11 +284,17 @@ namespace PepperDash.Core
}
}
/// <summary>
/// Initializes a new instance of the <see cref="DebugClient"/> class.
/// </summary>
/// <remarks>This constructor creates a new <see cref="DebugClient"/> instance and logs its
/// creation using the <see cref="Debug.Console(int, string)"/> method with a debug level of 0.</remarks>
public DebugClient()
{
Debug.Console(0, "DebugClient Created");
}
/// <inheritdoc/>
protected override void OnOpen()
{
base.OnOpen();
@@ -267,6 +305,7 @@ namespace PepperDash.Core
_connectionTime = DateTime.Now;
}
/// <inheritdoc/>
protected override void OnMessage(MessageEventArgs e)
{
base.OnMessage(e);
@@ -274,6 +313,7 @@ namespace PepperDash.Core
Debug.Console(0, "WebSocket UiClient Message: {0}", e.Data);
}
/// <inheritdoc/>
protected override void OnClose(CloseEventArgs e)
{
base.OnClose(e);
@@ -282,6 +322,7 @@ namespace PepperDash.Core
}
/// <inheritdoc/>
protected override void OnError(WebSocketSharp.ErrorEventArgs e)
{
base.OnError(e);
@@ -289,4 +330,3 @@ namespace PepperDash.Core
Debug.Console(2, Debug.ErrorLogLevel.Notice, "WebSocket UiClient Error: {0} message: {1}", e.Exception, e.Message);
}
}
}

View File

@@ -4,8 +4,8 @@ using System.Linq;
using System.Text;
using Crestron.SimplSharp;
namespace PepperDash.Core
{
namespace PepperDash.Core;
/// <summary>
/// Not in use
/// </summary>
@@ -18,5 +18,3 @@ namespace PepperDash.Core
{
}
}
}

View File

@@ -4,8 +4,8 @@ using System.Linq;
using System.Text;
using Crestron.SimplSharp;
namespace PepperDash.Core.PasswordManagement
{
namespace PepperDash.Core.PasswordManagement;
/// <summary>
/// JSON password configuration
/// </summary>
@@ -23,4 +23,3 @@ namespace PepperDash.Core.PasswordManagement
}
}
}

View File

@@ -4,8 +4,8 @@ using System.Linq;
using System.Text;
using Crestron.SimplSharp;
namespace PepperDash.Core.PasswordManagement
{
namespace PepperDash.Core.PasswordManagement;
/// <summary>
/// Constants
/// </summary>
@@ -54,4 +54,3 @@ namespace PepperDash.Core.PasswordManagement
/// </summary>
public const ushort StringValueChange = 201;
}
}

View File

@@ -1,9 +1,9 @@
using System;
namespace PepperDash.Core.PasswordManagement
{
namespace PepperDash.Core.PasswordManagement;
/// <summary>
/// Represents a PasswordClient
/// A class to allow user interaction with the PasswordManager
/// </summary>
public class PasswordClient
{
@@ -59,9 +59,6 @@ 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);
@@ -84,9 +81,6 @@ 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))
@@ -105,9 +99,6 @@ 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);
@@ -118,7 +109,7 @@ namespace PepperDash.Core.PasswordManagement
}
/// <summary>
/// ClearPassword method
/// Clears the user entered password and resets the LEDs
/// </summary>
public void ClearPassword()
{
@@ -193,4 +184,3 @@ namespace PepperDash.Core.PasswordManagement
}
}
}
}

View File

@@ -2,10 +2,10 @@
using System.Collections.Generic;
using Crestron.SimplSharp;
namespace PepperDash.Core.PasswordManagement
{
namespace PepperDash.Core.PasswordManagement;
/// <summary>
/// Represents a PasswordManager
/// Allows passwords to be stored and managed
/// </summary>
public class PasswordManager
{
@@ -71,9 +71,6 @@ 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
@@ -155,9 +152,6 @@ 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);
@@ -244,4 +238,3 @@ namespace PepperDash.Core.PasswordManagement
}
}
}
}

View File

@@ -5,7 +5,7 @@
<PropertyGroup>
<RootNamespace>PepperDash.Core</RootNamespace>
<AssemblyName>PepperDashCore</AssemblyName>
<TargetFramework>net472</TargetFramework>
<TargetFramework>net8</TargetFramework>
<Deterministic>true</Deterministic>
<NeutralLanguage>en</NeutralLanguage>
<OutputPath>bin\$(Configuration)\</OutputPath>
@@ -37,20 +37,16 @@
<None Remove="Properties\**" />
</ItemGroup>
<ItemGroup>
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Net.Http" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="BouncyCastle.Cryptography" Version="2.4.0" />
<PackageReference Include="Crestron.SimplSharp.SDK.Library" Version="2.21.90" />
<PackageReference Include="Serilog" Version="3.1.1" />
<PackageReference Include="Serilog.Expressions" Version="4.0.0" />
<PackageReference Include="Serilog.Formatting.Compact" Version="2.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.1" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="SSH.NET" Version="2024.2.0" />
<PackageReference Include="WebSocketSharp" Version="1.0.3-rc11" />
<PackageReference Include="BouncyCastle.Cryptography" Version="2.6.1" />
<PackageReference Include="Crestron.SimplSharp.SDK.Library" Version="2.21.128" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Serilog" Version="4.3.0" />
<PackageReference Include="Serilog.Expressions" Version="5.0.0" />
<PackageReference Include="Serilog.Formatting.Compact" Version="3.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
<PackageReference Include="Serilog.Sinks.File" Version="7.0.0" />
<PackageReference Include="SSH.NET" Version="2025.0.0" />
<PackageReference Include="WebSocketSharp-netstandard" Version="1.0.1" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net6'">
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />

View File

@@ -4,8 +4,8 @@ using System.Linq;
using System.Text;
using Crestron.SimplSharp;
namespace PepperDash.Core.SystemInfo
{
namespace PepperDash.Core.SystemInfo;
/// <summary>
/// Constants
/// </summary>
@@ -69,7 +69,7 @@ namespace PepperDash.Core.SystemInfo
}
/// <summary>
/// Represents a ProcessorChangeEventArgs
/// Processor Change Event Args Class
/// </summary>
public class ProcessorChangeEventArgs : EventArgs
{
@@ -115,7 +115,7 @@ namespace PepperDash.Core.SystemInfo
}
/// <summary>
/// Represents a EthernetChangeEventArgs
/// Ethernet Change Event Args Class
/// </summary>
public class EthernetChangeEventArgs : EventArgs
{
@@ -166,7 +166,7 @@ namespace PepperDash.Core.SystemInfo
}
/// <summary>
/// Represents a ControlSubnetChangeEventArgs
/// Control Subnet Chage Event Args Class
/// </summary>
public class ControlSubnetChangeEventArgs : EventArgs
{
@@ -212,7 +212,7 @@ namespace PepperDash.Core.SystemInfo
}
/// <summary>
/// Represents a ProgramChangeEventArgs
/// Program Change Event Args Class
/// </summary>
public class ProgramChangeEventArgs : EventArgs
{
@@ -261,4 +261,3 @@ namespace PepperDash.Core.SystemInfo
Index = index;
}
}
}

View File

@@ -4,8 +4,8 @@ using System.Linq;
using System.Text;
using Crestron.SimplSharp;
namespace PepperDash.Core.SystemInfo
{
namespace PepperDash.Core.SystemInfo;
/// <summary>
/// Processor info class
/// </summary>
@@ -201,4 +201,3 @@ namespace PepperDash.Core.SystemInfo
}
}
}

View File

@@ -4,8 +4,8 @@ using System.Linq;
using System.Text;
using Crestron.SimplSharp;
namespace PepperDash.Core.SystemInfo
{
namespace PepperDash.Core.SystemInfo;
/// <summary>
/// System Info class
/// </summary>
@@ -101,7 +101,7 @@ namespace PepperDash.Core.SystemInfo
}
/// <summary>
/// GetEthernetInfo method
/// Gets the current ethernet info
/// </summary>
public void GetEthernetInfo()
{
@@ -162,7 +162,7 @@ namespace PepperDash.Core.SystemInfo
}
/// <summary>
/// GetControlSubnetInfo method
/// Gets the current control subnet info
/// </summary>
public void GetControlSubnetInfo()
{
@@ -206,9 +206,6 @@ 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)
@@ -267,7 +264,7 @@ namespace PepperDash.Core.SystemInfo
}
/// <summary>
/// RefreshProcessorUptime method
/// Gets the processor uptime and passes it to S+
/// </summary>
public void RefreshProcessorUptime()
{
@@ -290,9 +287,6 @@ 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
@@ -314,9 +308,6 @@ 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))
@@ -468,4 +459,3 @@ namespace PepperDash.Core.SystemInfo
}
}
}
}

View File

@@ -20,8 +20,8 @@ using Org.BouncyCastle.Crypto.Operators;
using BigInteger = Org.BouncyCastle.Math.BigInteger;
using X509Certificate = Org.BouncyCastle.X509.X509Certificate;
namespace PepperDash.Core
{
namespace PepperDash.Core;
/// <summary>
/// Taken From https://github.com/rlipscombe/bouncy-castle-csharp/
/// </summary>
@@ -35,9 +35,6 @@ 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.
@@ -59,9 +56,6 @@ 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.
@@ -84,9 +78,6 @@ 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.
@@ -314,9 +305,6 @@ 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.
@@ -344,9 +332,6 @@ 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;
@@ -368,4 +353,3 @@ namespace PepperDash.Core
return bRet;
}
}
}

View File

@@ -1,9 +1,9 @@
using Crestron.SimplSharp.WebScripting;
namespace PepperDash.Core.Web.RequestHandlers
{
namespace PepperDash.Core.Web.RequestHandlers;
/// <summary>
/// Represents a DefaultRequestHandler
/// Web API default request handler
/// </summary>
public class DefaultRequestHandler : WebApiBaseRequestHandler
{
@@ -14,4 +14,3 @@ namespace PepperDash.Core.Web.RequestHandlers
: base(true)
{ }
}
}

View File

@@ -3,8 +3,8 @@ using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace PepperDash.Core.Web.RequestHandlers
{
namespace PepperDash.Core.Web.RequestHandlers;
public abstract class WebApiBaseRequestAsyncHandler:IHttpCwsHandler
{
private readonly Dictionary<string, Func<HttpCwsContext, Task>> _handlers;
@@ -142,9 +142,6 @@ 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))
@@ -163,4 +160,3 @@ namespace PepperDash.Core.Web.RequestHandlers
handlerTask.GetAwaiter().GetResult();
}
}
}

View File

@@ -2,8 +2,8 @@
using System.Collections.Generic;
using Crestron.SimplSharp.WebScripting;
namespace PepperDash.Core.Web.RequestHandlers
{
namespace PepperDash.Core.Web.RequestHandlers;
/// <summary>
/// CWS Base Handler, implements IHttpCwsHandler
/// </summary>
@@ -144,9 +144,6 @@ namespace PepperDash.Core.Web.RequestHandlers
/// Process request
/// </summary>
/// <param name="context"></param>
/// <summary>
/// ProcessRequest method
/// </summary>
public void ProcessRequest(HttpCwsContext context)
{
Action<HttpCwsContext> handler;
@@ -165,4 +162,3 @@ namespace PepperDash.Core.Web.RequestHandlers
handler(context);
}
}
}

View File

@@ -7,8 +7,8 @@ using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core.Web.RequestHandlers;
namespace PepperDash.Core.Web
{
namespace PepperDash.Core.Web;
/// <summary>
/// Web API server
/// </summary>
@@ -26,22 +26,22 @@ namespace PepperDash.Core.Web
private HttpCwsServer _server;
/// <summary>
/// Gets or sets the Key
/// Web API server key
/// </summary>
public string Key { get; private set; }
/// <summary>
/// Gets or sets the Name
/// Web API server name
/// </summary>
public string Name { get; private set; }
/// <summary>
/// Gets or sets the BasePath
/// CWS base path, will default to "/api" if not set via initialize method
/// </summary>
public string BasePath { get; private set; }
/// <summary>
/// Gets or sets the IsRegistered
/// Indicates CWS is registered with base path
/// </summary>
public bool IsRegistered { get; private set; }
@@ -138,7 +138,7 @@ namespace PepperDash.Core.Web
}
/// <summary>
/// Initialize method
/// Initializes CWS class
/// </summary>
public void Initialize(string key, string basePath)
{
@@ -165,9 +165,6 @@ 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)
@@ -180,7 +177,7 @@ namespace PepperDash.Core.Web
}
/// <summary>
/// GetRouteCollection method
/// Returns a list of the current routes
/// </summary>
public HttpCwsRouteCollection GetRouteCollection()
{
@@ -226,7 +223,7 @@ namespace PepperDash.Core.Web
}
/// <summary>
/// Stop method
/// Stop CWS instance
/// </summary>
public void Stop()
{
@@ -284,4 +281,3 @@ namespace PepperDash.Core.Web
}
}
}
}

View File

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

View File

@@ -4,8 +4,8 @@ using System.Linq;
using System.Text;
using Crestron.SimplSharp;
namespace PepperDash.Core.WebApi.Presets
{
namespace PepperDash.Core.WebApi.Presets;
/// <summary>
///
/// </summary>
@@ -17,17 +17,17 @@ namespace PepperDash.Core.WebApi.Presets
public int Id { get; set; }
/// <summary>
/// Gets or sets the ExternalId
///
/// </summary>
public string ExternalId { get; set; }
/// <summary>
/// Gets or sets the FirstName
///
/// </summary>
public string FirstName { get; set; }
/// <summary>
/// Gets or sets the LastName
///
/// </summary>
public string LastName { get; set; }
}
@@ -44,12 +44,12 @@ namespace PepperDash.Core.WebApi.Presets
public bool LookupSuccess { get; private set; }
/// <summary>
/// Gets or sets the ULookupSuccess
/// For stupid S+
/// </summary>
public ushort ULookupSuccess { get { return (ushort)(LookupSuccess ? 1 : 0); } }
/// <summary>
/// Gets or sets the User
///
/// </summary>
public User User { get; private set; }
@@ -71,7 +71,7 @@ namespace PepperDash.Core.WebApi.Presets
}
/// <summary>
/// Represents a UserAndRoomMessage
///
/// </summary>
public class UserAndRoomMessage
{
@@ -81,13 +81,12 @@ namespace PepperDash.Core.WebApi.Presets
public int UserId { get; set; }
/// <summary>
/// Gets or sets the RoomTypeId
///
/// </summary>
public int RoomTypeId { get; set; }
/// <summary>
/// Gets or sets the PresetNumber
///
/// </summary>
public int PresetNumber { get; set; }
}
}

View File

@@ -8,8 +8,8 @@ using Newtonsoft.Json.Linq;
using PepperDash.Core.JsonToSimpl;
namespace PepperDash.Core.WebApi.Presets
{
namespace PepperDash.Core.WebApi.Presets;
/// <summary>
/// Passcode client for the WebApi
/// </summary>
@@ -26,7 +26,7 @@ namespace PepperDash.Core.WebApi.Presets
public event EventHandler<PresetReceivedEventArgs> PresetReceived;
/// <summary>
/// Gets or sets the Key
/// Unique identifier for this instance
/// </summary>
public string Key { get; private set; }
@@ -77,9 +77,6 @@ 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
@@ -118,9 +115,6 @@ 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)
@@ -218,9 +212,6 @@ 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)
@@ -279,4 +270,3 @@ namespace PepperDash.Core.WebApi.Presets
}
}
}
}

View File

@@ -1,8 +1,8 @@
using System.Collections.Generic;
using PepperDash.Core.Intersystem.Tokens;
namespace PepperDash.Core.Intersystem.Serialization
{
namespace PepperDash.Core.Intersystem.Serialization;
/// <summary>
/// Interface to determine XSig serialization for an object.
/// </summary>
@@ -22,4 +22,3 @@ namespace PepperDash.Core.Intersystem.Serialization
/// <returns></returns>
T Deserialize<T>(IEnumerable<XSigToken> tokens) where T : class, IXSigSerialization;
}
}

View File

@@ -1,7 +1,7 @@
using System;
namespace PepperDash.Core.Intersystem.Serialization
{
namespace PepperDash.Core.Intersystem.Serialization;
/// <summary>
/// Class to handle this specific exception type
/// </summary>
@@ -25,4 +25,3 @@ namespace PepperDash.Core.Intersystem.Serialization
/// <param name="inner"></param>
public XSigSerializationException(string message, Exception inner) : base(message, inner) { }
}
}

View File

@@ -1,7 +1,7 @@
using System;
namespace PepperDash.Core.Intersystem.Tokens
{
namespace PepperDash.Core.Intersystem.Tokens;
/// <summary>
/// Represents an XSigAnalogToken
/// </summary>
@@ -59,9 +59,6 @@ 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;
@@ -72,10 +69,6 @@ namespace PepperDash.Core.Intersystem.Tokens
///
/// </summary>
/// <returns></returns>
/// <summary>
/// ToString method
/// </summary>
/// <inheritdoc />
public override string ToString()
{
return Index + " = 0x" + Value.ToString("X4");
@@ -87,12 +80,8 @@ 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

@@ -1,7 +1,7 @@
using System;
namespace PepperDash.Core.Intersystem.Tokens
{
namespace PepperDash.Core.Intersystem.Tokens;
/// <summary>
/// Represents an XSigDigitalToken
/// </summary>
@@ -57,9 +57,6 @@ 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;
@@ -70,10 +67,6 @@ namespace PepperDash.Core.Intersystem.Tokens
///
/// </summary>
/// <returns></returns>
/// <summary>
/// ToString method
/// </summary>
/// <inheritdoc />
public override string ToString()
{
return Index + " = " + (Value ? "High" : "Low");
@@ -84,12 +77,8 @@ 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

@@ -1,8 +1,8 @@
using System;
using System.Text;
namespace PepperDash.Core.Intersystem.Tokens
{
namespace PepperDash.Core.Intersystem.Tokens;
/// <summary>
/// Represents an XSigSerialToken
/// </summary>
@@ -63,9 +63,6 @@ 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;
@@ -76,13 +73,8 @@ namespace PepperDash.Core.Intersystem.Tokens
///
/// </summary>
/// <returns></returns>
/// <summary>
/// ToString method
/// </summary>
/// <inheritdoc />
public override string ToString()
{
return Index + " = \"" + Value + "\"";
}
}
}

View File

@@ -1,5 +1,5 @@
namespace PepperDash.Core.Intersystem.Tokens
{
namespace PepperDash.Core.Intersystem.Tokens;
/// <summary>
/// Represents the base class for all XSig datatypes.
/// </summary>
@@ -42,4 +42,3 @@ namespace PepperDash.Core.Intersystem.Tokens
/// <returns>XSigToken</returns>
public abstract XSigToken GetTokenWithOffset(int offset);
}
}

View File

@@ -1,5 +1,5 @@
namespace PepperDash.Core.Intersystem.Tokens
{
namespace PepperDash.Core.Intersystem.Tokens;
/// <summary>
/// XSig token types.
/// </summary>
@@ -20,4 +20,3 @@ namespace PepperDash.Core.Intersystem.Tokens
/// </summary>
Serial
}
}

View File

@@ -18,8 +18,8 @@ using PepperDash.Core.Intersystem.Tokens;
11111111 <- denotes end of data
*/
namespace PepperDash.Core.Intersystem
{
namespace PepperDash.Core.Intersystem;
/// <summary>
/// Helper methods for creating XSig byte sequences compatible with the Intersystem Communications (ISC) symbol.
/// </summary>
@@ -52,9 +52,6 @@ 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);
@@ -66,9 +63,6 @@ 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();
@@ -88,9 +82,6 @@ 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);
@@ -103,9 +94,6 @@ 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();
@@ -117,9 +105,6 @@ 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);
@@ -132,9 +117,6 @@ 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
@@ -152,9 +134,6 @@ 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);
@@ -167,9 +146,6 @@ 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();
@@ -181,9 +157,6 @@ 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);
@@ -196,9 +169,6 @@ 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
@@ -216,9 +186,6 @@ 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);
@@ -231,9 +198,6 @@ 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();
@@ -245,9 +209,6 @@ 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);
@@ -260,9 +221,6 @@ 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
@@ -278,4 +236,3 @@ namespace PepperDash.Core.Intersystem
return bytes;
}
}
}

View File

@@ -4,8 +4,8 @@ using Crestron.SimplSharp.CrestronIO;
using PepperDash.Core.Intersystem.Serialization;
using PepperDash.Core.Intersystem.Tokens;
namespace PepperDash.Core.Intersystem
{
namespace PepperDash.Core.Intersystem;
/// <summary>
/// XSigToken stream reader.
/// </summary>
@@ -48,9 +48,6 @@ 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;
@@ -68,9 +65,6 @@ 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;
@@ -120,9 +114,6 @@ 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>();
@@ -153,4 +144,3 @@ namespace PepperDash.Core.Intersystem
_stream.Dispose();
}
}
}

View File

@@ -5,8 +5,8 @@ using Crestron.SimplSharp.CrestronIO;
using PepperDash.Core.Intersystem.Serialization;
using PepperDash.Core.Intersystem.Tokens;
namespace PepperDash.Core.Intersystem
{
namespace PepperDash.Core.Intersystem;
/// <summary>
/// XSigToken stream writer.
/// </summary>
@@ -47,9 +47,6 @@ 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);
@@ -60,9 +57,6 @@ 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)
@@ -76,9 +70,6 @@ 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);
@@ -89,9 +80,6 @@ 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);
@@ -120,9 +108,6 @@ 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)
@@ -140,7 +125,7 @@ namespace PepperDash.Core.Intersystem
}
/// <summary>
/// Dispose method
/// Disposes of the internal stream if specified to not leave open.
/// </summary>
public void Dispose()
{
@@ -148,4 +133,3 @@ namespace PepperDash.Core.Intersystem
_stream.Dispose();
}
}
}

View File

@@ -2,20 +2,22 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using Crestron.SimplSharp;
using System.Reflection;
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;
//using PepperDash.Essentials.Devices.Common.Cameras;
namespace PepperDash.Essentials.Core.Bridges
{
namespace PepperDash.Essentials.Core.Bridges;
/// <summary>
/// Base class for bridge API variants
/// </summary>
@@ -29,7 +31,7 @@ namespace PepperDash.Essentials.Core.Bridges
}
/// <summary>
/// Represents a EiscApiAdvanced
/// Bridge API using EISC
/// </summary>
public class EiscApiAdvanced : BridgeApi, ICommunicationMonitor
{
@@ -58,19 +60,12 @@ 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();
@@ -128,9 +123,6 @@ 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...");
@@ -161,9 +153,6 @@ 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))
@@ -177,9 +166,8 @@ namespace PepperDash.Essentials.Core.Bridges
}
/// <summary>
/// PrintJoinMaps method
/// Prints all the join maps on this bridge
/// </summary>
/// <inheritdoc />
public virtual void PrintJoinMaps()
{
CrestronConsole.ConsoleCommandResponse("Join Maps for EISC IPID: {0}\r\n", Eisc.ID.ToString("X"));
@@ -191,9 +179,8 @@ namespace PepperDash.Essentials.Core.Bridges
}
}
/// <summary>
/// MarkdownForBridge method
/// Generates markdown for all join maps on this bridge
/// </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"));
@@ -209,9 +196,6 @@ 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];
@@ -229,9 +213,6 @@ 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];
@@ -252,9 +233,6 @@ 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
@@ -340,91 +318,49 @@ 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()
@@ -432,10 +368,6 @@ 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");
@@ -489,5 +421,3 @@ namespace PepperDash.Essentials.Core.Bridges
return new EiscApiAdvanced(dc, eisc);
}
}
}

View File

@@ -3,8 +3,8 @@ using Serilog.Events;
//using PepperDash.Essentials.Devices.Common.Cameras;
namespace PepperDash.Essentials.Core.Bridges
{
namespace PepperDash.Essentials.Core.Bridges;
/// <summary>
/// Helper methods for bridges
/// </summary>
@@ -34,9 +34,6 @@ namespace PepperDash.Essentials.Core.Bridges
bridge.PrintJoinMaps();
}
}
/// <summary>
/// JoinmapMarkdown method
/// </summary>
public static void JoinmapMarkdown(string command)
{
var targets = command.Split(' ');
@@ -65,5 +62,3 @@ namespace PepperDash.Essentials.Core.Bridges
}
}
}
}

View File

@@ -1,19 +1,11 @@
using Crestron.SimplSharpPro.DeviceSupport;
namespace PepperDash.Essentials.Core.Bridges
{
namespace PepperDash.Essentials.Core.Bridges;
/// <summary>
/// Defines the contract for IBridgeAdvanced
/// Defines a device that uses JoinMapBaseAdvanced for its join map
/// </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

@@ -1,10 +1,7 @@
using System;
namespace PepperDash.Essentials.Core.Bridges
{
/// <summary>
/// Represents a AirMediaControllerJoinMap
/// </summary>
namespace PepperDash.Essentials.Core.Bridges;
public class AirMediaControllerJoinMap : JoinMapBaseAdvanced
{
[JoinName("IsOnline")]
@@ -71,4 +68,3 @@ namespace PepperDash.Essentials.Core.Bridges
/// <param name="type">Type of the child join map</param>
protected AirMediaControllerJoinMap(uint joinStart, Type type) : base(joinStart, type){}
}
}

View File

@@ -1,10 +1,7 @@
using System;
namespace PepperDash.Essentials.Core.Bridges
{
/// <summary>
/// Represents a AppleTvJoinMap
/// </summary>
namespace PepperDash.Essentials.Core.Bridges;
public class AppleTvJoinMap : JoinMapBaseAdvanced
{
[JoinName("UpArrow")]
@@ -53,4 +50,3 @@ namespace PepperDash.Essentials.Core.Bridges
{
}
}
}

View File

@@ -1,10 +1,7 @@
using System;
namespace PepperDash.Essentials.Core.Bridges
{
/// <summary>
/// Represents a C2nRthsControllerJoinMap
/// </summary>
namespace PepperDash.Essentials.Core.Bridges;
public class C2nRthsControllerJoinMap : JoinMapBaseAdvanced
{
[JoinName("IsOnline")]
@@ -45,4 +42,3 @@ namespace PepperDash.Essentials.Core.Bridges
{
}
}
}

View File

@@ -1,9 +1,9 @@
using System;
namespace PepperDash.Essentials.Core.Bridges
{
namespace PepperDash.Essentials.Core.Bridges;
/// <summary>
/// Represents a CameraControllerJoinMap
/// Join map for CameraBase devices
/// </summary>
public class CameraControllerJoinMap : JoinMapBaseAdvanced
{
@@ -66,4 +66,3 @@ namespace PepperDash.Essentials.Core.Bridges
/// <param name="type">Type of the child join map</param>
protected CameraControllerJoinMap(uint joinStart, Type type) : base(joinStart, type){}
}
}

View File

@@ -1,10 +1,7 @@
using System;
namespace PepperDash.Essentials.Core.Bridges
{
/// <summary>
/// Represents a CenOdtOccupancySensorBaseJoinMap
/// </summary>
namespace PepperDash.Essentials.Core.Bridges;
public class CenOdtOccupancySensorBaseJoinMap : JoinMapBaseAdvanced
{
#region Digitals
@@ -197,5 +194,3 @@ namespace PepperDash.Essentials.Core.Bridges
{
}
}
}

View File

@@ -1,10 +1,7 @@
using System;
namespace PepperDash.Essentials.Core.Bridges
{
/// <summary>
/// Represents a DisplayControllerJoinMap
/// </summary>
namespace PepperDash.Essentials.Core.Bridges;
public class DisplayControllerJoinMap : JoinMapBaseAdvanced
{
[JoinName("Name")]
@@ -85,4 +82,3 @@ namespace PepperDash.Essentials.Core.Bridges
{
}
}
}

View File

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

View File

@@ -1,10 +1,7 @@
using System;
namespace PepperDash.Essentials.Core.Bridges
{
/// <summary>
/// Represents a DmChassisControllerJoinMap
/// </summary>
namespace PepperDash.Essentials.Core.Bridges;
public class DmChassisControllerJoinMap : JoinMapBaseAdvanced
{
[JoinName("EnableAudioBreakaway")]
@@ -170,4 +167,3 @@ namespace PepperDash.Essentials.Core.Bridges
{
}
}
}

View File

@@ -1,10 +1,7 @@
using System;
namespace PepperDash.Essentials.Core.Bridges
{
/// <summary>
/// Represents a DmRmcControllerJoinMap
/// </summary>
namespace PepperDash.Essentials.Core.Bridges;
public class DmRmcControllerJoinMap : JoinMapBaseAdvanced
{
[JoinName("IsOnline")]
@@ -92,4 +89,3 @@ namespace PepperDash.Essentials.Core.Bridges
{
}
}
}

View File

@@ -1,10 +1,7 @@
using System;
namespace PepperDash.Essentials.Core.Bridges
{
/// <summary>
/// Represents a DmTxControllerJoinMap
/// </summary>
namespace PepperDash.Essentials.Core.Bridges;
public class DmTxControllerJoinMap : JoinMapBaseAdvanced
{
[JoinName("IsOnline")]
@@ -96,4 +93,3 @@ namespace PepperDash.Essentials.Core.Bridges
{
}
}
}

View File

@@ -1,10 +1,7 @@
using System;
namespace PepperDash.Essentials.Core.Bridges
{
/// <summary>
/// Represents a DmpsAudioOutputControllerJoinMap
/// </summary>
namespace PepperDash.Essentials.Core.Bridges;
public class DmpsAudioOutputControllerJoinMap : JoinMapBaseAdvanced
{
@@ -174,4 +171,3 @@ namespace PepperDash.Essentials.Core.Bridges
{
}
}
}

View File

@@ -1,10 +1,7 @@
using System;
namespace PepperDash.Essentials.Core.Bridges
{
/// <summary>
/// Represents a DmpsMicrophoneControllerJoinMap
/// </summary>
namespace PepperDash.Essentials.Core.Bridges;
public class DmpsMicrophoneControllerJoinMap : JoinMapBaseAdvanced
{
[JoinName("MicGain")]
@@ -50,4 +47,3 @@ namespace PepperDash.Essentials.Core.Bridges
{
}
}
}

View File

@@ -1,10 +1,7 @@
using System;
namespace PepperDash.Essentials.Core.Bridges
{
/// <summary>
/// Represents a DmpsRoutingControllerJoinMap
/// </summary>
namespace PepperDash.Essentials.Core.Bridges;
public class DmpsRoutingControllerJoinMap : JoinMapBaseAdvanced
{
[JoinName("EnableRouting")]
@@ -123,4 +120,3 @@ namespace PepperDash.Essentials.Core.Bridges
{
}
}
}

View File

@@ -1,7 +1,7 @@
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
{
namespace PepperDash.Essentials.Core.Bridges.JoinMaps;
public sealed class GenericIrControllerJoinMap : JoinMapBaseAdvanced
{
[JoinName("PLAY")]
@@ -824,4 +824,3 @@ namespace PepperDash.Essentials.Core.Bridges.JoinMaps
{
}
}
}

View File

@@ -1,11 +1,8 @@
using System;
namespace PepperDash.Essentials.Core.Bridges
{
/// <summary>
/// Represents a GenericLightingJoinMap
/// </summary>
namespace PepperDash.Essentials.Core.Bridges;
public class GenericLightingJoinMap : JoinMapBaseAdvanced
{
@@ -49,4 +46,3 @@ namespace PepperDash.Essentials.Core.Bridges
{
}
}
}

View File

@@ -1,10 +1,7 @@
using System;
namespace PepperDash.Essentials.Core.Bridges
{
/// <summary>
/// Represents a GenericRelayControllerJoinMap
/// </summary>
namespace PepperDash.Essentials.Core.Bridges;
public class GenericRelayControllerJoinMap : JoinMapBaseAdvanced
{
@@ -31,4 +28,3 @@ namespace PepperDash.Essentials.Core.Bridges
}
}
}

View File

@@ -1,10 +1,7 @@
using System;
namespace PepperDash.Essentials.Core.Bridges
{
/// <summary>
/// Represents a GlsOccupancySensorBaseJoinMap
/// </summary>
namespace PepperDash.Essentials.Core.Bridges;
public class GlsOccupancySensorBaseJoinMap : JoinMapBaseAdvanced
{
[JoinName("IsOnline")]
@@ -184,4 +181,4 @@ namespace PepperDash.Essentials.Core.Bridges
}
}
}

View File

@@ -1,11 +1,8 @@
using System;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
{
/// <summary>
/// Represents a GlsPartitionSensorJoinMap
/// </summary>
namespace PepperDash.Essentials.Core.Bridges.JoinMaps;
public class GlsPartitionSensorJoinMap : JoinMapBaseAdvanced
{
@@ -157,4 +154,3 @@ namespace PepperDash.Essentials.Core.Bridges.JoinMaps
}
}
}

View File

@@ -1,10 +1,7 @@
using System;
namespace PepperDash.Essentials.Core.Bridges
{
/// <summary>
/// Represents a HdMdNxM4kEControllerJoinMap
/// </summary>
namespace PepperDash.Essentials.Core.Bridges;
public class HdMdNxM4kEControllerJoinMap : JoinMapBaseAdvanced
{
[JoinName("Name")]
@@ -66,4 +63,3 @@ namespace PepperDash.Essentials.Core.Bridges
{
}
}
}

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