mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-18 22:25:00 +00:00
Compare commits
9 Commits
accidental
...
copilot/fi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1c55003a20 | ||
|
|
9c56b9b057 | ||
|
|
95fc8ddfff | ||
|
|
79d07ab7f4 | ||
|
|
213973a323 | ||
|
|
0a85f1706e | ||
|
|
a7267f1df3 | ||
|
|
df61fdfea1 | ||
|
|
db3ceaf0b4 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -395,5 +395,3 @@ essentials-framework/Essentials Interfaces/PepperDash_Essentials_Interfaces/Pepp
|
|||||||
_site/
|
_site/
|
||||||
api/
|
api/
|
||||||
*.DS_Store
|
*.DS_Store
|
||||||
/._PepperDash.Essentials.4Series.sln
|
|
||||||
dotnet
|
|
||||||
|
|||||||
@@ -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)*
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<Project>
|
<Project>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Version>2.19.4-local</Version>
|
<Version>2.4.0-local</Version>
|
||||||
<InformationalVersion>$(Version)</InformationalVersion>
|
<InformationalVersion>$(Version)</InformationalVersion>
|
||||||
<Authors>PepperDash Technology</Authors>
|
<Authors>PepperDash Technology</Authors>
|
||||||
<Company>PepperDash Technology</Company>
|
<Company>PepperDash Technology</Company>
|
||||||
|
|||||||
@@ -23,32 +23,23 @@
|
|||||||
<FileName>$(TargetDir)$(TargetName).$(Version).$(TargetFramework).cpz</FileName>
|
<FileName>$(TargetDir)$(TargetName).$(Version).$(TargetFramework).cpz</FileName>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<Target Name="DeleteCLZ" BeforeTargets="CoreBuild" Condition="$(ProjectType) == 'Library' And $(TargetDir) != ''">
|
<Target Name="DeleteCLZ" BeforeTargets="PreBuildEvent" Condition="$(ProjectType) == 'Library' And $(TargetDir) != '' And Exists($(FileName))">
|
||||||
<ItemGroup>
|
<Delete Files="$(TargetDir)$(TargetName).$(Version).$(TargetFramework).clz">
|
||||||
<OldCLZFiles Include="$(TargetDir)$(TargetName).*.$(TargetFramework).clz" />
|
|
||||||
</ItemGroup>
|
|
||||||
<Delete Files="@(OldCLZFiles)" Condition="@(OldCLZFiles) != ''">
|
|
||||||
<Output TaskParameter="DeletedFiles" ItemName="DeletedList"/>
|
<Output TaskParameter="DeletedFiles" ItemName="DeletedList"/>
|
||||||
</Delete>
|
</Delete>
|
||||||
<Message Text="Deleted old CLZ files: '@(DeletedList)'" Condition="@(DeletedList) != ''" />
|
<Message Text="Deleted files: '@(DeletedList)'" />
|
||||||
</Target>
|
</Target>
|
||||||
<Target Name="DeleteCPZ" BeforeTargets="CoreBuild" Condition="$(ProjectType) == 'Program' And $(TargetDir) != ''">
|
<Target Name="DeleteCPZ" BeforeTargets="PreBuildEvent" Condition="$(ProjectType) == 'Program' And $(TargetDir) != '' And Exists($(FileName))">
|
||||||
<ItemGroup>
|
<Delete Files="$(TargetDir)$(TargetName).$(Version).$(TargetFramework).cpz">
|
||||||
<OldCPZFiles Include="$(TargetDir)$(TargetName).*.$(TargetFramework).cpz" />
|
|
||||||
</ItemGroup>
|
|
||||||
<Delete Files="@(OldCPZFiles)" Condition="@(OldCPZFiles) != ''">
|
|
||||||
<Output TaskParameter="DeletedFiles" ItemName="DeletedList"/>
|
<Output TaskParameter="DeletedFiles" ItemName="DeletedList"/>
|
||||||
</Delete>
|
</Delete>
|
||||||
<Message Text="Deleted old CPZ files: '@(DeletedList)'" Condition="@(DeletedList) != ''" />
|
<Message Text="Deleted files: '@(DeletedList)'" />
|
||||||
</Target>
|
</Target>
|
||||||
<Target Name="DeleteCPLZ" BeforeTargets="CoreBuild" Condition="$(ProjectType) == 'ProgramLibrary' And $(TargetDir) != ''">
|
<Target Name="DeleteCPLZ" BeforeTargets="PreBuildEvent" Condition="$(ProjectType) == 'ProgramLibrary' And $(TargetDir) != '' And Exists($(FileName))">
|
||||||
<ItemGroup>
|
<Delete Files="$(TargetDir)$(TargetName).$(Version).$(TargetFramework).cplz">
|
||||||
<OldCPLZFiles Include="$(TargetDir)$(TargetName).*.$(TargetFramework).cplz" />
|
|
||||||
</ItemGroup>
|
|
||||||
<Delete Files="@(OldCPLZFiles)" Condition="@(OldCPLZFiles) != ''">
|
|
||||||
<Output TaskParameter="DeletedFiles" ItemName="DeletedList"/>
|
<Output TaskParameter="DeletedFiles" ItemName="DeletedList"/>
|
||||||
</Delete>
|
</Delete>
|
||||||
<Message Text="Deleted old CPLZ files: '@(DeletedList)'" Condition="@(DeletedList) != ''" />
|
<Message Text="Deleted files: '@(DeletedList)'" />
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
<Target Name="CreateCPLZ" AfterTargets="Build" Condition="$(ProjectType) == 'ProgramLibrary' And $(TargetDir) != ''" DependsOnTargets="DeleteCPLZ">
|
<Target Name="CreateCPLZ" AfterTargets="Build" Condition="$(ProjectType) == 'ProgramLibrary' And $(TargetDir) != ''" DependsOnTargets="DeleteCPLZ">
|
||||||
|
|||||||
@@ -1,43 +0,0 @@
|
|||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
|
|
||||||
namespace PepperDash.Core
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Helper class for formatting communication text and byte data for debugging purposes.
|
|
||||||
/// </summary>
|
|
||||||
public class ComTextHelper
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Gets escaped text for a byte array
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="bytes"></param>
|
|
||||||
/// <returns>string with all bytes escaped</returns>
|
|
||||||
public static string GetEscapedText(byte[] bytes)
|
|
||||||
{
|
|
||||||
return string.Concat(bytes.Select(b => string.Format(@"[{0:X2}]", (int)b)).ToArray());
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets escaped text for a string
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="text"></param>
|
|
||||||
/// <returns>string with all bytes escaped</returns>
|
|
||||||
public static string GetEscapedText(string text)
|
|
||||||
{
|
|
||||||
var bytes = Encoding.GetEncoding(28591).GetBytes(text);
|
|
||||||
return string.Concat(bytes.Select(b => string.Format(@"[{0:X2}]", (int)b)).ToArray());
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets debug text for a string
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="text"></param>
|
|
||||||
/// <returns>string with all non-printable characters escaped</returns>
|
|
||||||
public static string GetDebugText(string text)
|
|
||||||
{
|
|
||||||
return Regex.Replace(text, @"[^\u0020-\u007E]", a => GetEscapedText(a.Value));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -84,9 +84,10 @@ namespace PepperDash.Core
|
|||||||
port.TextReceived += Port_TextReceivedStringDelimiter;
|
port.TextReceived += Port_TextReceivedStringDelimiter;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stop method
|
/// Disconnects this gather from the Port's TextReceived event. This will not fire LineReceived
|
||||||
/// </summary>
|
/// after the this call.
|
||||||
|
/// </summary>
|
||||||
public void Stop()
|
public void Stop()
|
||||||
{
|
{
|
||||||
Port.TextReceived -= Port_TextReceived;
|
Port.TextReceived -= Port_TextReceived;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.Collections.Generic;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
@@ -22,7 +23,7 @@ namespace PepperDash.Core
|
|||||||
private CTimer DebugExpiryPeriod;
|
private CTimer DebugExpiryPeriod;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the DebugSetting
|
/// The current debug setting
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public eStreamDebuggingSetting DebugSetting { get; private set; }
|
public eStreamDebuggingSetting DebugSetting { get; private set; }
|
||||||
|
|
||||||
@@ -36,14 +37,14 @@ namespace PepperDash.Core
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return _DebugTimeoutInMs / 60000;
|
return _DebugTimeoutInMs/60000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the RxStreamDebuggingIsEnabled
|
/// Indicates that receive stream debugging is enabled
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool RxStreamDebuggingIsEnabled { get; private set; }
|
public bool RxStreamDebuggingIsEnabled{ get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Indicates that transmit stream debugging is enabled
|
/// Indicates that transmit stream debugging is enabled
|
||||||
@@ -64,9 +65,6 @@ namespace PepperDash.Core
|
|||||||
/// Sets the debugging setting and if not setting to off, assumes the default of 30 mintues
|
/// Sets the debugging setting and if not setting to off, assumes the default of 30 mintues
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="setting"></param>
|
/// <param name="setting"></param>
|
||||||
/// <summary>
|
|
||||||
/// SetDebuggingWithDefaultTimeout method
|
|
||||||
/// </summary>
|
|
||||||
public void SetDebuggingWithDefaultTimeout(eStreamDebuggingSetting setting)
|
public void SetDebuggingWithDefaultTimeout(eStreamDebuggingSetting setting)
|
||||||
{
|
{
|
||||||
if (setting == eStreamDebuggingSetting.Off)
|
if (setting == eStreamDebuggingSetting.Off)
|
||||||
@@ -83,9 +81,6 @@ namespace PepperDash.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="setting"></param>
|
/// <param name="setting"></param>
|
||||||
/// <param name="minutes"></param>
|
/// <param name="minutes"></param>
|
||||||
/// <summary>
|
|
||||||
/// SetDebuggingWithSpecificTimeout method
|
|
||||||
/// </summary>
|
|
||||||
public void SetDebuggingWithSpecificTimeout(eStreamDebuggingSetting setting, uint minutes)
|
public void SetDebuggingWithSpecificTimeout(eStreamDebuggingSetting setting, uint minutes)
|
||||||
{
|
{
|
||||||
if (setting == eStreamDebuggingSetting.Off)
|
if (setting == eStreamDebuggingSetting.Off)
|
||||||
@@ -107,7 +102,7 @@ namespace PepperDash.Core
|
|||||||
TxStreamDebuggingIsEnabled = true;
|
TxStreamDebuggingIsEnabled = true;
|
||||||
|
|
||||||
Debug.SetDeviceDebugSettings(ParentDeviceKey, setting);
|
Debug.SetDeviceDebugSettings(ParentDeviceKey, setting);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -135,4 +130,48 @@ namespace PepperDash.Core
|
|||||||
DebugExpiryPeriod = null;
|
DebugExpiryPeriod = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The available settings for stream debugging
|
||||||
|
/// </summary>
|
||||||
|
[Flags]
|
||||||
|
public enum eStreamDebuggingSetting
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Debug off
|
||||||
|
/// </summary>
|
||||||
|
Off = 0,
|
||||||
|
/// <summary>
|
||||||
|
/// Debug received data
|
||||||
|
/// </summary>
|
||||||
|
Rx = 1,
|
||||||
|
/// <summary>
|
||||||
|
/// Debug transmitted data
|
||||||
|
/// </summary>
|
||||||
|
Tx = 2,
|
||||||
|
/// <summary>
|
||||||
|
/// Debug both received and transmitted data
|
||||||
|
/// </summary>
|
||||||
|
Both = Rx | Tx
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The available settings for stream debugging response types
|
||||||
|
/// </summary>
|
||||||
|
[Flags]
|
||||||
|
public enum eStreamDebuggingDataTypeSettings
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Debug data in byte format
|
||||||
|
/// </summary>
|
||||||
|
Bytes = 0,
|
||||||
|
/// <summary>
|
||||||
|
/// Debug data in text format
|
||||||
|
/// </summary>
|
||||||
|
Text = 1,
|
||||||
|
/// <summary>
|
||||||
|
/// Debug data in both byte and text formats
|
||||||
|
/// </summary>
|
||||||
|
Both = Bytes | Text,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ using Newtonsoft.Json.Converters;
|
|||||||
namespace PepperDash.Core
|
namespace PepperDash.Core
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a ControlPropertiesConfig
|
/// Config properties that indicate how to communicate with a device for control
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class ControlPropertiesConfig
|
public class ControlPropertiesConfig
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -29,9 +29,9 @@ namespace PepperDash.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class GenericSocketStatusChageEventArgs : EventArgs
|
public class GenericSocketStatusChageEventArgs : EventArgs
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Client
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ISocketStatus Client { get; private set; }
|
public ISocketStatus Client { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -60,7 +60,7 @@ namespace PepperDash.Core
|
|||||||
public class GenericTcpServerStateChangedEventArgs : EventArgs
|
public class GenericTcpServerStateChangedEventArgs : EventArgs
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the State
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ServerState State { get; private set; }
|
public ServerState State { get; private set; }
|
||||||
|
|
||||||
@@ -154,7 +154,7 @@ namespace PepperDash.Core
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Text
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Text { get; private set; }
|
public string Text { get; private set; }
|
||||||
|
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ namespace PepperDash.Core
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Port
|
/// Port on server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int Port { get; set; }
|
public int Port { get; set; }
|
||||||
|
|
||||||
@@ -149,7 +149,7 @@ namespace PepperDash.Core
|
|||||||
public string ConnectionFailure { get { return ClientStatus.ToString(); } }
|
public string ConnectionFailure { get { return ClientStatus.ToString(); } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the AutoReconnect
|
/// bool to track if auto reconnect should be set on the socket
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool AutoReconnect { get; set; }
|
public bool AutoReconnect { get; set; }
|
||||||
|
|
||||||
@@ -188,7 +188,7 @@ namespace PepperDash.Core
|
|||||||
#region GenericSecureTcpIpClient properties
|
#region GenericSecureTcpIpClient properties
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the SharedKeyRequired
|
/// Bool to show whether the server requires a preshared key. This is used in the DynamicTCPServer class
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool SharedKeyRequired { get; set; }
|
public bool SharedKeyRequired { get; set; }
|
||||||
|
|
||||||
@@ -207,7 +207,7 @@ namespace PepperDash.Core
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <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>
|
/// </summary>
|
||||||
public string SharedKey { get; set; }
|
public string SharedKey { get; set; }
|
||||||
|
|
||||||
@@ -222,7 +222,7 @@ namespace PepperDash.Core
|
|||||||
bool IsTryingToConnect;
|
bool IsTryingToConnect;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the IsReadyForCommunication
|
/// Bool showing if socket is ready for communication after shared key exchange
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsReadyForCommunication { get; set; }
|
public bool IsReadyForCommunication { get; set; }
|
||||||
|
|
||||||
@@ -342,7 +342,7 @@ namespace PepperDash.Core
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initialize method
|
/// Just to help S+ set the key
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Initialize(string key)
|
public void Initialize(string key)
|
||||||
{
|
{
|
||||||
@@ -421,9 +421,6 @@ namespace PepperDash.Core
|
|||||||
/// Deactivate the client
|
/// Deactivate the client
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <summary>
|
|
||||||
/// Deactivate method
|
|
||||||
/// </summary>
|
|
||||||
public override bool Deactivate()
|
public override bool Deactivate()
|
||||||
{
|
{
|
||||||
if (_client != null)
|
if (_client != null)
|
||||||
@@ -435,7 +432,7 @@ namespace PepperDash.Core
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Connect method
|
/// Connect Method. Will return if already connected. Will write errors if missing address, port, or unique key/name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Connect()
|
public void Connect()
|
||||||
{
|
{
|
||||||
@@ -566,7 +563,7 @@ namespace PepperDash.Core
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Disconnect method
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Disconnect()
|
public void Disconnect()
|
||||||
{
|
{
|
||||||
@@ -589,7 +586,7 @@ namespace PepperDash.Core
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// DisconnectClient method
|
/// Does the actual disconnect business
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void DisconnectClient()
|
public void DisconnectClient()
|
||||||
{
|
{
|
||||||
@@ -849,7 +846,7 @@ namespace PepperDash.Core
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// SendText method
|
/// General send method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SendText(string text)
|
public void SendText(string text)
|
||||||
{
|
{
|
||||||
@@ -878,7 +875,7 @@ namespace PepperDash.Core
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// SendBytes method
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SendBytes(byte[] bytes)
|
public void SendBytes(byte[] bytes)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ namespace PepperDash.Core
|
|||||||
public string Hostname { get; set; }
|
public string Hostname { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Port
|
/// Port on server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int Port { get; set; }
|
public int Port { get; set; }
|
||||||
|
|
||||||
@@ -113,7 +113,7 @@ namespace PepperDash.Core
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <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>
|
/// </summary>
|
||||||
public string SharedKey { get; set; }
|
public string SharedKey { get; set; }
|
||||||
|
|
||||||
@@ -123,7 +123,7 @@ namespace PepperDash.Core
|
|||||||
private bool WaitingForSharedKeyResponse { get; set; }
|
private bool WaitingForSharedKeyResponse { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the BufferSize
|
/// Defaults to 2000
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int BufferSize { get; set; }
|
public int BufferSize { get; set; }
|
||||||
|
|
||||||
@@ -336,7 +336,7 @@ namespace PepperDash.Core
|
|||||||
#region Methods
|
#region Methods
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initialize method
|
/// Just to help S+ set the key
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Initialize(string key)
|
public void Initialize(string key)
|
||||||
{
|
{
|
||||||
@@ -395,7 +395,7 @@ namespace PepperDash.Core
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Connect method
|
/// Connect Method. Will return if already connected. Will write errors if missing address, port, or unique key/name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Connect()
|
public void Connect()
|
||||||
{
|
{
|
||||||
@@ -526,7 +526,7 @@ namespace PepperDash.Core
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Disconnect method
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Disconnect()
|
public void Disconnect()
|
||||||
{
|
{
|
||||||
@@ -804,7 +804,7 @@ namespace PepperDash.Core
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// SendText method
|
/// General send method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SendText(string text)
|
public void SendText(string text)
|
||||||
{
|
{
|
||||||
@@ -833,7 +833,7 @@ namespace PepperDash.Core
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// SendBytes method
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SendBytes(byte[] bytes)
|
public void SendBytes(byte[] bytes)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ namespace PepperDash.Core
|
|||||||
public ServerHasChokedCallbackDelegate ServerHasChoked { get; set; }
|
public ServerHasChokedCallbackDelegate ServerHasChoked { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Delegate for ServerHasChokedCallbackDelegate
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public delegate void ServerHasChokedCallbackDelegate();
|
public delegate void ServerHasChokedCallbackDelegate();
|
||||||
|
|
||||||
@@ -104,7 +104,7 @@ namespace PepperDash.Core
|
|||||||
int MonitorClientFailureCount;
|
int MonitorClientFailureCount;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the MonitorClientMaxFailureCount
|
/// 3 by default
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int MonitorClientMaxFailureCount { get; set; }
|
public int MonitorClientMaxFailureCount { get; set; }
|
||||||
|
|
||||||
@@ -190,7 +190,7 @@ namespace PepperDash.Core
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Port
|
/// Port Server should listen on
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int Port { get; set; }
|
public int Port { get; set; }
|
||||||
|
|
||||||
@@ -223,7 +223,8 @@ namespace PepperDash.Core
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <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>
|
/// </summary>
|
||||||
public string SharedKey { get; set; }
|
public string SharedKey { get; set; }
|
||||||
|
|
||||||
@@ -247,7 +248,7 @@ namespace PepperDash.Core
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the HeartbeatRequiredIntervalMs
|
/// Milliseconds before server expects another heartbeat. Set by property HeartbeatRequiredIntervalInSeconds which is driven from S+
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int HeartbeatRequiredIntervalMs { get; set; }
|
public int HeartbeatRequiredIntervalMs { get; set; }
|
||||||
|
|
||||||
@@ -257,7 +258,7 @@ namespace PepperDash.Core
|
|||||||
public ushort HeartbeatRequiredIntervalInSeconds { set { HeartbeatRequiredIntervalMs = (value * 1000); } }
|
public ushort HeartbeatRequiredIntervalInSeconds { set { HeartbeatRequiredIntervalMs = (value * 1000); } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the HeartbeatStringToMatch
|
/// String to Match for heartbeat. If null or empty any string will reset heartbeat timer
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string HeartbeatStringToMatch { get; set; }
|
public string HeartbeatStringToMatch { get; set; }
|
||||||
|
|
||||||
@@ -275,7 +276,7 @@ namespace PepperDash.Core
|
|||||||
public List<uint> ConnectedClientsIndexes = new List<uint>();
|
public List<uint> ConnectedClientsIndexes = new List<uint>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the BufferSize
|
/// Defaults to 2000
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int BufferSize { get; set; }
|
public int BufferSize { get; set; }
|
||||||
|
|
||||||
@@ -338,7 +339,7 @@ namespace PepperDash.Core
|
|||||||
|
|
||||||
#region Methods - Server Actions
|
#region Methods - Server Actions
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// KillServer method
|
/// Disconnects all clients and stops the server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void KillServer()
|
public void KillServer()
|
||||||
{
|
{
|
||||||
@@ -355,9 +356,6 @@ namespace PepperDash.Core
|
|||||||
/// Initialize Key for device using client name from SIMPL+. Called on Listen from SIMPL+
|
/// Initialize Key for device using client name from SIMPL+. Called on Listen from SIMPL+
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="key"></param>
|
/// <param name="key"></param>
|
||||||
/// <summary>
|
|
||||||
/// Initialize method
|
|
||||||
/// </summary>
|
|
||||||
public void Initialize(string key)
|
public void Initialize(string key)
|
||||||
{
|
{
|
||||||
Key = key;
|
Key = key;
|
||||||
@@ -397,7 +395,7 @@ namespace PepperDash.Core
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Listen method
|
/// Start listening on the specified port
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Listen()
|
public void Listen()
|
||||||
{
|
{
|
||||||
@@ -455,7 +453,7 @@ namespace PepperDash.Core
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// StopListening method
|
/// Stop Listeneing
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void StopListening()
|
public void StopListening()
|
||||||
{
|
{
|
||||||
@@ -480,9 +478,6 @@ namespace PepperDash.Core
|
|||||||
/// Disconnects Client
|
/// Disconnects Client
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="client"></param>
|
/// <param name="client"></param>
|
||||||
/// <summary>
|
|
||||||
/// DisconnectClient method
|
|
||||||
/// </summary>
|
|
||||||
public void DisconnectClient(uint client)
|
public void DisconnectClient(uint client)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -496,7 +491,7 @@ namespace PepperDash.Core
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// DisconnectAllClientsForShutdown method
|
/// Disconnect All Clients
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void DisconnectAllClientsForShutdown()
|
public void DisconnectAllClientsForShutdown()
|
||||||
{
|
{
|
||||||
@@ -538,9 +533,6 @@ namespace PepperDash.Core
|
|||||||
/// Broadcast text from server to all connected clients
|
/// Broadcast text from server to all connected clients
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="text"></param>
|
/// <param name="text"></param>
|
||||||
/// <summary>
|
|
||||||
/// BroadcastText method
|
|
||||||
/// </summary>
|
|
||||||
public void BroadcastText(string text)
|
public void BroadcastText(string text)
|
||||||
{
|
{
|
||||||
CCriticalSection CCBroadcast = new CCriticalSection();
|
CCriticalSection CCBroadcast = new CCriticalSection();
|
||||||
@@ -574,9 +566,6 @@ namespace PepperDash.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="text"></param>
|
/// <param name="text"></param>
|
||||||
/// <param name="clientIndex"></param>
|
/// <param name="clientIndex"></param>
|
||||||
/// <summary>
|
|
||||||
/// SendTextToClient method
|
|
||||||
/// </summary>
|
|
||||||
public void SendTextToClient(string text, uint clientIndex)
|
public void SendTextToClient(string text, uint clientIndex)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -645,9 +634,6 @@ namespace PepperDash.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="clientIndex"></param>
|
/// <param name="clientIndex"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <summary>
|
|
||||||
/// GetClientIPAddress method
|
|
||||||
/// </summary>
|
|
||||||
public string GetClientIPAddress(uint clientIndex)
|
public string GetClientIPAddress(uint clientIndex)
|
||||||
{
|
{
|
||||||
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "GetClientIPAddress Index: {0}", clientIndex);
|
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "GetClientIPAddress Index: {0}", clientIndex);
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
@@ -12,12 +11,11 @@ using Renci.SshNet.Common;
|
|||||||
namespace PepperDash.Core
|
namespace PepperDash.Core
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// SSH Client
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class GenericSshClient : Device, ISocketStatusWithStreamDebugging, IAutoReconnect
|
public class GenericSshClient : Device, ISocketStatusWithStreamDebugging, IAutoReconnect
|
||||||
{
|
{
|
||||||
private const string SPlusKey = "Uninitialized SshClient";
|
private const string SPlusKey = "Uninitialized SshClient";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Object to enable stream debugging
|
/// Object to enable stream debugging
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -38,8 +36,13 @@ namespace PepperDash.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public event EventHandler<GenericSocketStatusChageEventArgs> ConnectionChange;
|
public event EventHandler<GenericSocketStatusChageEventArgs> ConnectionChange;
|
||||||
|
|
||||||
|
///// <summary>
|
||||||
|
/////
|
||||||
|
///// </summary>
|
||||||
|
//public event GenericSocketStatusChangeEventDelegate SocketStatusChange;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Hostname
|
/// Address of server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Hostname { get; set; }
|
public string Hostname { get; set; }
|
||||||
|
|
||||||
@@ -49,12 +52,12 @@ namespace PepperDash.Core
|
|||||||
public int Port { get; set; }
|
public int Port { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Username
|
/// Username for server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Username { get; set; }
|
public string Username { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Password
|
/// And... Password for server. That was worth documenting!
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Password { get; set; }
|
public string Password { get; set; }
|
||||||
|
|
||||||
@@ -64,7 +67,7 @@ namespace PepperDash.Core
|
|||||||
public bool IsConnected
|
public bool IsConnected
|
||||||
{
|
{
|
||||||
// returns false if no client or not connected
|
// returns false if no client or not connected
|
||||||
get { return client != null && ClientStatus == SocketStatus.SOCKET_STATUS_CONNECTED; }
|
get { return Client != null && ClientStatus == SocketStatus.SOCKET_STATUS_CONNECTED; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -76,30 +79,20 @@ namespace PepperDash.Core
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Socket status change event
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public SocketStatus ClientStatus
|
public SocketStatus ClientStatus
|
||||||
{
|
{
|
||||||
get { lock (_stateLock) { return _ClientStatus; } }
|
get { return _ClientStatus; }
|
||||||
private set
|
private set
|
||||||
{
|
{
|
||||||
bool shouldFireEvent = false;
|
if (_ClientStatus == value)
|
||||||
lock (_stateLock)
|
return;
|
||||||
{
|
_ClientStatus = value;
|
||||||
if (_ClientStatus != value)
|
OnConnectionChange();
|
||||||
{
|
|
||||||
_ClientStatus = value;
|
|
||||||
shouldFireEvent = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Fire event outside lock to avoid deadlock
|
|
||||||
if (shouldFireEvent)
|
|
||||||
OnConnectionChange();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
SocketStatus _ClientStatus;
|
||||||
private SocketStatus _ClientStatus;
|
|
||||||
private bool _ConnectEnabled;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Contains the familiar Simpl analog status values. This drives the ConnectionChange event
|
/// Contains the familiar Simpl analog status values. This drives the ConnectionChange event
|
||||||
@@ -107,7 +100,7 @@ namespace PepperDash.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public ushort UStatus
|
public ushort UStatus
|
||||||
{
|
{
|
||||||
get { lock (_stateLock) { return (ushort)_ClientStatus; } }
|
get { return (ushort)_ClientStatus; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -118,11 +111,7 @@ namespace PepperDash.Core
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Will be set and unset by connect and disconnect only
|
/// Will be set and unset by connect and disconnect only
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool ConnectEnabled
|
public bool ConnectEnabled { get; private set; }
|
||||||
{
|
|
||||||
get { lock (_stateLock) { return _ConnectEnabled; } }
|
|
||||||
private set { lock (_stateLock) { _ConnectEnabled = value; } }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// S+ helper for AutoReconnect
|
/// S+ helper for AutoReconnect
|
||||||
@@ -134,29 +123,22 @@ namespace PepperDash.Core
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the AutoReconnectIntervalMs
|
/// Millisecond value, determines the timeout period in between reconnect attempts.
|
||||||
|
/// Set to 5000 by default
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int AutoReconnectIntervalMs { get; set; }
|
public int AutoReconnectIntervalMs { get; set; }
|
||||||
|
|
||||||
private SshClient client;
|
SshClient Client;
|
||||||
|
|
||||||
private ShellStream shellStream;
|
ShellStream TheStream;
|
||||||
|
|
||||||
private readonly Timer reconnectTimer;
|
CTimer ReconnectTimer;
|
||||||
|
|
||||||
//Lock object to prevent simulatneous connect/disconnect operations
|
//Lock object to prevent simulatneous connect/disconnect operations
|
||||||
//private CCriticalSection connectLock = new CCriticalSection();
|
//private CCriticalSection connectLock = new CCriticalSection();
|
||||||
private readonly SemaphoreSlim connectLock = new SemaphoreSlim(1);
|
private SemaphoreSlim connectLock = new SemaphoreSlim(1);
|
||||||
|
|
||||||
// Thread-safety lock for state changes
|
private bool DisconnectLogged = false;
|
||||||
private readonly object _stateLock = new object();
|
|
||||||
|
|
||||||
private bool disconnectLogged = false;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// When true, turns off echo for the SSH session
|
|
||||||
/// </summary>
|
|
||||||
public bool DisableEcho { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Typical constructor.
|
/// Typical constructor.
|
||||||
@@ -165,58 +147,58 @@ namespace PepperDash.Core
|
|||||||
base(key)
|
base(key)
|
||||||
{
|
{
|
||||||
StreamDebugging = new CommunicationStreamDebugging(key);
|
StreamDebugging = new CommunicationStreamDebugging(key);
|
||||||
CrestronEnvironment.ProgramStatusEventHandler += new ProgramStatusEventHandler(CrestronEnvironment_ProgramStatusEventHandler);
|
CrestronEnvironment.ProgramStatusEventHandler += new ProgramStatusEventHandler(CrestronEnvironment_ProgramStatusEventHandler);
|
||||||
Key = key;
|
Key = key;
|
||||||
Hostname = hostname;
|
Hostname = hostname;
|
||||||
Port = port;
|
Port = port;
|
||||||
Username = username;
|
Username = username;
|
||||||
Password = password;
|
Password = password;
|
||||||
AutoReconnectIntervalMs = 5000;
|
AutoReconnectIntervalMs = 5000;
|
||||||
|
|
||||||
reconnectTimer = new Timer(o =>
|
ReconnectTimer = new CTimer(o =>
|
||||||
{
|
{
|
||||||
if (ConnectEnabled) // Now thread-safe property access
|
if (ConnectEnabled)
|
||||||
{
|
{
|
||||||
Connect();
|
Connect();
|
||||||
}
|
}
|
||||||
}, null, System.Threading.Timeout.Infinite, System.Threading.Timeout.Infinite);
|
}, System.Threading.Timeout.Infinite);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// S+ Constructor - Must set all properties before calling Connect
|
/// S+ Constructor - Must set all properties before calling Connect
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public GenericSshClient()
|
public GenericSshClient()
|
||||||
: base(SPlusKey)
|
: base(SPlusKey)
|
||||||
{
|
{
|
||||||
CrestronEnvironment.ProgramStatusEventHandler += new ProgramStatusEventHandler(CrestronEnvironment_ProgramStatusEventHandler);
|
CrestronEnvironment.ProgramStatusEventHandler += new ProgramStatusEventHandler(CrestronEnvironment_ProgramStatusEventHandler);
|
||||||
AutoReconnectIntervalMs = 5000;
|
AutoReconnectIntervalMs = 5000;
|
||||||
|
|
||||||
reconnectTimer = new Timer(o =>
|
ReconnectTimer = new CTimer(o =>
|
||||||
{
|
{
|
||||||
if (ConnectEnabled) // Now thread-safe property access
|
if (ConnectEnabled)
|
||||||
{
|
{
|
||||||
Connect();
|
Connect();
|
||||||
}
|
}
|
||||||
}, null, System.Threading.Timeout.Infinite, System.Threading.Timeout.Infinite);
|
}, System.Threading.Timeout.Infinite);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handles closing this up when the program shuts down
|
/// Handles closing this up when the program shuts down
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void CrestronEnvironment_ProgramStatusEventHandler(eProgramStatusEventType programEventType)
|
void CrestronEnvironment_ProgramStatusEventHandler(eProgramStatusEventType programEventType)
|
||||||
{
|
{
|
||||||
if (programEventType == eProgramStatusEventType.Stopping)
|
if (programEventType == eProgramStatusEventType.Stopping)
|
||||||
{
|
{
|
||||||
if (client != null)
|
if (Client != null)
|
||||||
{
|
{
|
||||||
this.LogDebug("Program stopping. Closing connection");
|
this.LogDebug("Program stopping. Closing connection");
|
||||||
Disconnect();
|
Disconnect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Connect method
|
/// Connect to the server, using the provided properties.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Connect()
|
public void Connect()
|
||||||
{
|
{
|
||||||
@@ -242,10 +224,13 @@ namespace PepperDash.Core
|
|||||||
this.LogDebug("Attempting connect");
|
this.LogDebug("Attempting connect");
|
||||||
|
|
||||||
// Cancel reconnect if running.
|
// Cancel reconnect if running.
|
||||||
StopReconnectTimer();
|
if (ReconnectTimer != null)
|
||||||
|
{
|
||||||
|
ReconnectTimer.Stop();
|
||||||
|
}
|
||||||
|
|
||||||
// Cleanup the old client if it already exists
|
// Cleanup the old client if it already exists
|
||||||
if (client != null)
|
if (Client != null)
|
||||||
{
|
{
|
||||||
this.LogDebug("Cleaning up disconnected client");
|
this.LogDebug("Cleaning up disconnected client");
|
||||||
KillClient(SocketStatus.SOCKET_STATUS_BROKEN_LOCALLY);
|
KillClient(SocketStatus.SOCKET_STATUS_BROKEN_LOCALLY);
|
||||||
@@ -258,90 +243,77 @@ namespace PepperDash.Core
|
|||||||
|
|
||||||
this.LogDebug("Creating new SshClient");
|
this.LogDebug("Creating new SshClient");
|
||||||
ConnectionInfo connectionInfo = new ConnectionInfo(Hostname, Port, Username, pauth, kauth);
|
ConnectionInfo connectionInfo = new ConnectionInfo(Hostname, Port, Username, pauth, kauth);
|
||||||
client = new SshClient(connectionInfo);
|
Client = new SshClient(connectionInfo);
|
||||||
client.ErrorOccurred += Client_ErrorOccurred;
|
Client.ErrorOccurred += Client_ErrorOccurred;
|
||||||
|
|
||||||
//Attempt to connect
|
//Attempt to connect
|
||||||
ClientStatus = SocketStatus.SOCKET_STATUS_WAITING;
|
ClientStatus = SocketStatus.SOCKET_STATUS_WAITING;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
client.Connect();
|
Client.Connect();
|
||||||
|
TheStream = Client.CreateShellStream("PDTShell", 0, 0, 0, 0, 65534);
|
||||||
var modes = new Dictionary<TerminalModes, uint>();
|
if (TheStream.DataAvailable)
|
||||||
|
|
||||||
if (DisableEcho)
|
|
||||||
{
|
|
||||||
modes.Add(TerminalModes.ECHO, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
shellStream = client.CreateShellStream("PDTShell", 0, 0, 0, 0, 65534, modes);
|
|
||||||
if (shellStream.DataAvailable)
|
|
||||||
{
|
{
|
||||||
// empty the buffer if there is data
|
// empty the buffer if there is data
|
||||||
shellStream.Read();
|
string str = TheStream.Read();
|
||||||
}
|
}
|
||||||
shellStream.DataReceived += Stream_DataReceived;
|
TheStream.DataReceived += Stream_DataReceived;
|
||||||
this.LogInformation("Connected");
|
this.LogInformation("Connected");
|
||||||
ClientStatus = SocketStatus.SOCKET_STATUS_CONNECTED;
|
ClientStatus = SocketStatus.SOCKET_STATUS_CONNECTED;
|
||||||
disconnectLogged = false;
|
DisconnectLogged = false;
|
||||||
}
|
}
|
||||||
catch (SshConnectionException e)
|
catch (SshConnectionException e)
|
||||||
{
|
{
|
||||||
var ie = e.InnerException; // The details are inside!!
|
var ie = e.InnerException; // The details are inside!!
|
||||||
|
var errorLogLevel = DisconnectLogged == true ? Debug.ErrorLogLevel.None : Debug.ErrorLogLevel.Error;
|
||||||
|
|
||||||
if (ie is SocketException)
|
if (ie is SocketException)
|
||||||
{
|
{
|
||||||
this.LogError("CONNECTION failure: Cannot reach host");
|
this.LogException(ie, "CONNECTION failure: Cannot reach host");
|
||||||
this.LogVerbose(ie, "Exception details: ");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ie is System.Net.Sockets.SocketException socketException)
|
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);
|
Hostname, Port);
|
||||||
this.LogVerbose(socketException, "SocketException details: ");
|
|
||||||
}
|
}
|
||||||
if (ie is SshAuthenticationException)
|
if (ie is SshAuthenticationException)
|
||||||
{
|
{
|
||||||
this.LogError("Authentication failure for username {userName}", Username);
|
this.LogException(ie, "Authentication failure for username {userName}", Username);
|
||||||
this.LogVerbose(ie, "AuthenticationException details: ");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
this.LogException(ie, "Error on connect");
|
||||||
this.LogError("Error on connect: {error}", ie.Message);
|
|
||||||
this.LogVerbose(ie, "Exception details: ");
|
|
||||||
}
|
|
||||||
|
|
||||||
disconnectLogged = true;
|
DisconnectLogged = true;
|
||||||
KillClient(SocketStatus.SOCKET_STATUS_CONNECT_FAILED);
|
KillClient(SocketStatus.SOCKET_STATUS_CONNECT_FAILED);
|
||||||
if (AutoReconnect)
|
if (AutoReconnect)
|
||||||
{
|
{
|
||||||
this.LogDebug("Checking autoreconnect: {autoReconnect}, {autoReconnectInterval}ms", AutoReconnect, AutoReconnectIntervalMs);
|
this.LogDebug("Checking autoreconnect: {autoReconnect}, {autoReconnectInterval}ms", AutoReconnect, AutoReconnectIntervalMs);
|
||||||
StartReconnectTimer();
|
ReconnectTimer.Reset(AutoReconnectIntervalMs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (SshOperationTimeoutException ex)
|
catch(SshOperationTimeoutException ex)
|
||||||
{
|
{
|
||||||
this.LogWarning("Connection attempt timed out: {message}", ex.Message);
|
this.LogWarning("Connection attempt timed out: {message}", ex.Message);
|
||||||
|
|
||||||
disconnectLogged = true;
|
DisconnectLogged = true;
|
||||||
KillClient(SocketStatus.SOCKET_STATUS_CONNECT_FAILED);
|
KillClient(SocketStatus.SOCKET_STATUS_CONNECT_FAILED);
|
||||||
if (AutoReconnect)
|
if (AutoReconnect)
|
||||||
{
|
{
|
||||||
this.LogDebug("Checking autoreconnect: {0}, {1}ms", AutoReconnect, AutoReconnectIntervalMs);
|
this.LogDebug("Checking autoreconnect: {0}, {1}ms", AutoReconnect, AutoReconnectIntervalMs);
|
||||||
StartReconnectTimer();
|
ReconnectTimer.Reset(AutoReconnectIntervalMs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
this.LogError("Unhandled exception on connect: {error}", e.Message);
|
var errorLogLevel = DisconnectLogged == true ? Debug.ErrorLogLevel.None : Debug.ErrorLogLevel.Error;
|
||||||
this.LogVerbose(e, "Exception details: ");
|
this.LogException(e, "Unhandled exception on connect");
|
||||||
disconnectLogged = true;
|
DisconnectLogged = true;
|
||||||
KillClient(SocketStatus.SOCKET_STATUS_CONNECT_FAILED);
|
KillClient(SocketStatus.SOCKET_STATUS_CONNECT_FAILED);
|
||||||
if (AutoReconnect)
|
if (AutoReconnect)
|
||||||
{
|
{
|
||||||
this.LogDebug("Checking autoreconnect: {0}, {1}ms", AutoReconnect, AutoReconnectIntervalMs);
|
this.LogDebug("Checking autoreconnect: {0}, {1}ms", AutoReconnect, AutoReconnectIntervalMs);
|
||||||
StartReconnectTimer();
|
ReconnectTimer.Reset(AutoReconnectIntervalMs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -352,14 +324,18 @@ namespace PepperDash.Core
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Disconnect method
|
/// Disconnect the clients and put away it's resources.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Disconnect()
|
public void Disconnect()
|
||||||
{
|
{
|
||||||
ConnectEnabled = false;
|
ConnectEnabled = false;
|
||||||
// Stop trying reconnects, if we are
|
// Stop trying reconnects, if we are
|
||||||
StopReconnectTimer();
|
if (ReconnectTimer != null)
|
||||||
|
{
|
||||||
|
ReconnectTimer.Stop();
|
||||||
|
// ReconnectTimer = null;
|
||||||
|
}
|
||||||
|
|
||||||
KillClient(SocketStatus.SOCKET_STATUS_BROKEN_LOCALLY);
|
KillClient(SocketStatus.SOCKET_STATUS_BROKEN_LOCALLY);
|
||||||
}
|
}
|
||||||
@@ -373,35 +349,35 @@ namespace PepperDash.Core
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (client != null)
|
if (Client != null)
|
||||||
{
|
{
|
||||||
client.ErrorOccurred -= Client_ErrorOccurred;
|
Client.ErrorOccurred -= Client_ErrorOccurred;
|
||||||
client.Disconnect();
|
Client.Disconnect();
|
||||||
client.Dispose();
|
Client.Dispose();
|
||||||
client = null;
|
Client = null;
|
||||||
ClientStatus = status;
|
ClientStatus = status;
|
||||||
this.LogDebug("Disconnected");
|
this.LogDebug("Disconnected");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
this.LogException(ex, "Exception in Kill Client");
|
this.LogException(ex,"Exception in Kill Client");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Kills the stream
|
/// Kills the stream
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void KillStream()
|
void KillStream()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (shellStream != null)
|
if (TheStream != null)
|
||||||
{
|
{
|
||||||
shellStream.DataReceived -= Stream_DataReceived;
|
TheStream.DataReceived -= Stream_DataReceived;
|
||||||
shellStream.Close();
|
TheStream.Close();
|
||||||
shellStream.Dispose();
|
TheStream.Dispose();
|
||||||
shellStream = null;
|
TheStream = null;
|
||||||
this.LogDebug("Disconnected stream");
|
this.LogDebug("Disconnected stream");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -409,55 +385,59 @@ namespace PepperDash.Core
|
|||||||
{
|
{
|
||||||
this.LogException(ex, "Exception in Kill Stream:{0}");
|
this.LogException(ex, "Exception in Kill Stream:{0}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handles the keyboard interactive authentication, should it be required.
|
/// Handles the keyboard interactive authentication, should it be required.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void kauth_AuthenticationPrompt(object sender, AuthenticationPromptEventArgs e)
|
void kauth_AuthenticationPrompt(object sender, AuthenticationPromptEventArgs e)
|
||||||
{
|
{
|
||||||
foreach (AuthenticationPrompt prompt in e.Prompts)
|
foreach (AuthenticationPrompt prompt in e.Prompts)
|
||||||
if (prompt.Request.IndexOf("Password:", StringComparison.InvariantCultureIgnoreCase) != -1)
|
if (prompt.Request.IndexOf("Password:", StringComparison.InvariantCultureIgnoreCase) != -1)
|
||||||
prompt.Response = Password;
|
prompt.Response = Password;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handler for data receive on ShellStream. Passes data across to queue for line parsing.
|
/// Handler for data receive on ShellStream. Passes data across to queue for line parsing.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void Stream_DataReceived(object sender, ShellDataEventArgs e)
|
void Stream_DataReceived(object sender, ShellDataEventArgs e)
|
||||||
{
|
{
|
||||||
if (((ShellStream)sender).Length <= 0L)
|
if (((ShellStream)sender).Length <= 0L)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var response = ((ShellStream)sender).Read();
|
var response = ((ShellStream)sender).Read();
|
||||||
|
|
||||||
var bytesHandler = BytesReceived;
|
var bytesHandler = BytesReceived;
|
||||||
|
|
||||||
if (bytesHandler != null)
|
if (bytesHandler != null)
|
||||||
{
|
{
|
||||||
var bytes = Encoding.UTF8.GetBytes(response);
|
var bytes = Encoding.UTF8.GetBytes(response);
|
||||||
this.PrintReceivedBytes(bytes);
|
if (StreamDebugging.RxStreamDebuggingIsEnabled)
|
||||||
|
{
|
||||||
|
this.LogInformation("Received {1} bytes: '{0}'", ComTextHelper.GetEscapedText(bytes), bytes.Length);
|
||||||
|
}
|
||||||
bytesHandler(this, new GenericCommMethodReceiveBytesArgs(bytes));
|
bytesHandler(this, new GenericCommMethodReceiveBytesArgs(bytes));
|
||||||
}
|
}
|
||||||
|
|
||||||
var textHandler = TextReceived;
|
var textHandler = TextReceived;
|
||||||
if (textHandler != null)
|
if (textHandler != null)
|
||||||
{
|
{
|
||||||
this.PrintReceivedText(response);
|
if (StreamDebugging.RxStreamDebuggingIsEnabled)
|
||||||
|
this.LogInformation("Received: '{0}'", ComTextHelper.GetDebugText(response));
|
||||||
|
|
||||||
textHandler(this, new GenericCommMethodReceiveTextArgs(response));
|
textHandler(this, new GenericCommMethodReceiveTextArgs(response));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Error event handler for client events - disconnect, etc. Will forward those events via ConnectionChange
|
/// Error event handler for client events - disconnect, etc. Will forward those events via ConnectionChange
|
||||||
/// event
|
/// event
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void Client_ErrorOccurred(object sender, ExceptionEventArgs e)
|
void Client_ErrorOccurred(object sender, ExceptionEventArgs e)
|
||||||
{
|
{
|
||||||
CrestronInvoke.BeginInvoke(o =>
|
CrestronInvoke.BeginInvoke(o =>
|
||||||
{
|
{
|
||||||
if (e.Exception is SshConnectionException || e.Exception is System.Net.Sockets.SocketException)
|
if (e.Exception is SshConnectionException || e.Exception is System.Net.Sockets.SocketException)
|
||||||
@@ -476,7 +456,7 @@ namespace PepperDash.Core
|
|||||||
if (AutoReconnect && ConnectEnabled)
|
if (AutoReconnect && ConnectEnabled)
|
||||||
{
|
{
|
||||||
this.LogDebug("Checking autoreconnect: {0}, {1}ms", AutoReconnect, AutoReconnectIntervalMs);
|
this.LogDebug("Checking autoreconnect: {0}, {1}ms", AutoReconnect, AutoReconnectIntervalMs);
|
||||||
StartReconnectTimer();
|
ReconnectTimer.Reset(AutoReconnectIntervalMs);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -484,60 +464,66 @@ namespace PepperDash.Core
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Helper for ConnectionChange event
|
/// Helper for ConnectionChange event
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void OnConnectionChange()
|
void OnConnectionChange()
|
||||||
{
|
{
|
||||||
ConnectionChange?.Invoke(this, new GenericSocketStatusChageEventArgs(this));
|
if (ConnectionChange != null)
|
||||||
|
ConnectionChange(this, new GenericSocketStatusChageEventArgs(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
#region IBasicCommunication Members
|
#region IBasicCommunication Members
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sends text to the server
|
/// Sends text to the server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="text">The text to send</param>
|
/// <param name="text"></param>
|
||||||
public void SendText(string text)
|
public void SendText(string text)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (client != null && shellStream != null && IsConnected)
|
if (Client != null && TheStream != null && IsConnected)
|
||||||
{
|
{
|
||||||
this.PrintSentText(text);
|
if (StreamDebugging.TxStreamDebuggingIsEnabled)
|
||||||
|
this.LogInformation(
|
||||||
|
"Sending {length} characters of text: '{text}'",
|
||||||
|
text.Length,
|
||||||
|
ComTextHelper.GetDebugText(text));
|
||||||
|
|
||||||
shellStream.Write(text);
|
TheStream.Write(text);
|
||||||
shellStream.Flush();
|
TheStream.Flush();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.LogDebug("Client is null or disconnected. Cannot Send Text");
|
this.LogDebug("Client is null or disconnected. Cannot Send Text");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (ObjectDisposedException)
|
catch (ObjectDisposedException)
|
||||||
{
|
{
|
||||||
this.LogError("ObjectDisposedException sending '{message}'. Restarting connection...", text.Trim());
|
this.LogError("ObjectDisposedException sending '{message}'. Restarting connection...", text.Trim());
|
||||||
|
|
||||||
KillClient(SocketStatus.SOCKET_STATUS_CONNECT_FAILED);
|
KillClient(SocketStatus.SOCKET_STATUS_CONNECT_FAILED);
|
||||||
StartReconnectTimer();
|
ReconnectTimer.Reset();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
this.LogException(ex, "Exception sending text: '{message}'", text);
|
this.LogException(ex, "Exception sending text: '{message}'", text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sends Bytes to the server
|
/// Sends Bytes to the server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="bytes">The bytes to send</param>
|
/// <param name="bytes"></param>
|
||||||
public void SendBytes(byte[] bytes)
|
public void SendBytes(byte[] bytes)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (client != null && shellStream != null && IsConnected)
|
if (Client != null && TheStream != null && IsConnected)
|
||||||
{
|
{
|
||||||
this.PrintSentBytes(bytes);
|
if (StreamDebugging.TxStreamDebuggingIsEnabled)
|
||||||
|
this.LogInformation("Sending {0} bytes: '{1}'", bytes.Length, ComTextHelper.GetEscapedText(bytes));
|
||||||
|
|
||||||
shellStream.Write(bytes, 0, bytes.Length);
|
TheStream.Write(bytes, 0, bytes.Length);
|
||||||
shellStream.Flush();
|
TheStream.Flush();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -549,120 +535,43 @@ namespace PepperDash.Core
|
|||||||
this.LogException(ex, "ObjectDisposedException sending {message}", ComTextHelper.GetEscapedText(bytes));
|
this.LogException(ex, "ObjectDisposedException sending {message}", ComTextHelper.GetEscapedText(bytes));
|
||||||
|
|
||||||
KillClient(SocketStatus.SOCKET_STATUS_CONNECT_FAILED);
|
KillClient(SocketStatus.SOCKET_STATUS_CONNECT_FAILED);
|
||||||
StartReconnectTimer();
|
ReconnectTimer.Reset();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
this.LogException(ex, "Exception sending {message}", ComTextHelper.GetEscapedText(bytes));
|
this.LogException(ex, "Exception sending {message}", ComTextHelper.GetEscapedText(bytes));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
/// <summary>
|
}
|
||||||
/// Safely starts the reconnect timer with exception handling
|
|
||||||
/// </summary>
|
|
||||||
private void StartReconnectTimer()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
reconnectTimer?.Change(AutoReconnectIntervalMs, System.Threading.Timeout.Infinite);
|
|
||||||
}
|
|
||||||
catch (ObjectDisposedException)
|
|
||||||
{
|
|
||||||
// Timer was disposed, ignore
|
|
||||||
this.LogDebug("Attempted to start timer but it was already disposed");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
//*****************************************************************************************************
|
||||||
/// Safely stops the reconnect timer with exception handling
|
//*****************************************************************************************************
|
||||||
/// </summary>
|
/// <summary>
|
||||||
private void StopReconnectTimer()
|
/// Fired when connection changes
|
||||||
{
|
/// </summary>
|
||||||
try
|
public class SshConnectionChangeEventArgs : EventArgs
|
||||||
{
|
{
|
||||||
reconnectTimer?.Change(System.Threading.Timeout.Infinite, System.Threading.Timeout.Infinite);
|
|
||||||
}
|
|
||||||
catch (ObjectDisposedException)
|
|
||||||
{
|
|
||||||
// Timer was disposed, ignore
|
|
||||||
this.LogDebug("Attempted to stop timer but it was already disposed");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Deactivate method - properly dispose of resources
|
|
||||||
/// </summary>
|
|
||||||
public override bool Deactivate()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
this.LogDebug("Deactivating SSH client - disposing resources");
|
|
||||||
|
|
||||||
// Stop trying reconnects
|
|
||||||
ConnectEnabled = false;
|
|
||||||
StopReconnectTimer();
|
|
||||||
|
|
||||||
// Disconnect and cleanup client
|
|
||||||
KillClient(SocketStatus.SOCKET_STATUS_BROKEN_LOCALLY);
|
|
||||||
|
|
||||||
// Dispose timer
|
|
||||||
try
|
|
||||||
{
|
|
||||||
reconnectTimer?.Dispose();
|
|
||||||
}
|
|
||||||
catch (ObjectDisposedException)
|
|
||||||
{
|
|
||||||
// Already disposed, ignore
|
|
||||||
}
|
|
||||||
|
|
||||||
// Dispose semaphore
|
|
||||||
try
|
|
||||||
{
|
|
||||||
connectLock?.Dispose();
|
|
||||||
}
|
|
||||||
catch (ObjectDisposedException)
|
|
||||||
{
|
|
||||||
// Already disposed, ignore
|
|
||||||
}
|
|
||||||
|
|
||||||
return base.Deactivate();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
this.LogException(ex, "Error during SSH client deactivation");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//*****************************************************************************************************
|
|
||||||
//*****************************************************************************************************
|
|
||||||
/// <summary>
|
|
||||||
/// Represents a SshConnectionChangeEventArgs
|
|
||||||
/// </summary>
|
|
||||||
public class SshConnectionChangeEventArgs : EventArgs
|
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Connection State
|
/// Connection State
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsConnected { get; private set; }
|
public bool IsConnected { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the UIsConnected
|
/// Connection Status represented as a ushort
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ushort UIsConnected { get { return (ushort)(Client.IsConnected ? 1 : 0); } }
|
public ushort UIsConnected { get { return (ushort)(Client.IsConnected ? 1 : 0); } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Client
|
/// The client
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public GenericSshClient Client { get; private set; }
|
public GenericSshClient Client { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Status
|
/// Socket Status as represented by
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ushort Status { get { return Client.UStatus; } }
|
public ushort Status { get { return Client.UStatus; } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// S+ Constructor
|
/// S+ Constructor
|
||||||
|
|||||||
@@ -19,47 +19,47 @@ namespace PepperDash.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public CommunicationStreamDebugging StreamDebugging { get; private set; }
|
public CommunicationStreamDebugging StreamDebugging { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fires when data is received from the server and returns it as a Byte array
|
/// Fires when data is received from the server and returns it as a Byte array
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event EventHandler<GenericCommMethodReceiveBytesArgs> BytesReceived;
|
public event EventHandler<GenericCommMethodReceiveBytesArgs> BytesReceived;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fires when data is received from the server and returns it as text
|
/// Fires when data is received from the server and returns it as text
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event EventHandler<GenericCommMethodReceiveTextArgs> TextReceived;
|
public event EventHandler<GenericCommMethodReceiveTextArgs> TextReceived;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
//public event GenericSocketStatusChangeEventDelegate SocketStatusChange;
|
//public event GenericSocketStatusChangeEventDelegate SocketStatusChange;
|
||||||
public event EventHandler<GenericSocketStatusChageEventArgs> ConnectionChange;
|
public event EventHandler<GenericSocketStatusChageEventArgs> ConnectionChange;
|
||||||
|
|
||||||
|
|
||||||
private string _hostname;
|
private string _hostname;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Address of server
|
/// Address of server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Hostname
|
public string Hostname
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return _hostname;
|
return _hostname;
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
_hostname = value;
|
_hostname = value;
|
||||||
if (_client != null)
|
if (_client != null)
|
||||||
{
|
{
|
||||||
_client.AddressClientConnectedTo = _hostname;
|
_client.AddressClientConnectedTo = _hostname;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Port
|
/// Port on server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int Port { get; set; }
|
public int Port { get; set; }
|
||||||
|
|
||||||
@@ -78,19 +78,19 @@ namespace PepperDash.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int BufferSize { get; set; }
|
public int BufferSize { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The actual client class
|
/// The actual client class
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private TCPClient _client;
|
private TCPClient _client;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Bool showing if socket is connected
|
/// Bool showing if socket is connected
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsConnected
|
public bool IsConnected
|
||||||
{
|
{
|
||||||
get { return _client != null && _client.ClientStatus == SocketStatus.SOCKET_STATUS_CONNECTED; }
|
get { return _client != null && _client.ClientStatus == SocketStatus.SOCKET_STATUS_CONNECTED; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// S+ helper for IsConnected
|
/// S+ helper for IsConnected
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -99,15 +99,15 @@ namespace PepperDash.Core
|
|||||||
get { return (ushort)(IsConnected ? 1 : 0); }
|
get { return (ushort)(IsConnected ? 1 : 0); }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// _client socket status Read only
|
/// _client socket status Read only
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public SocketStatus ClientStatus
|
public SocketStatus ClientStatus
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return _client == null ? SocketStatus.SOCKET_STATUS_NO_CONNECT : _client.ClientStatus;
|
return _client == null ? SocketStatus.SOCKET_STATUS_NO_CONNECT : _client.ClientStatus;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -119,26 +119,26 @@ namespace PepperDash.Core
|
|||||||
get { return (ushort)ClientStatus; }
|
get { return (ushort)ClientStatus; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Status text shows the message associated with socket status
|
/// Status text shows the message associated with socket status
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ClientStatusText { get { return ClientStatus.ToString(); } }
|
public string ClientStatusText { get { return ClientStatus.ToString(); } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ushort representation of client status
|
/// Ushort representation of client status
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Obsolete]
|
[Obsolete]
|
||||||
public ushort UClientStatus { get { return (ushort)ClientStatus; } }
|
public ushort UClientStatus { get { return (ushort)ClientStatus; } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Connection failure reason
|
/// Connection failure reason
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ConnectionFailure { get { return ClientStatus.ToString(); } }
|
public string ConnectionFailure { get { return ClientStatus.ToString(); } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the AutoReconnect
|
/// bool to track if auto reconnect should be set on the socket
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool AutoReconnect { get; set; }
|
public bool AutoReconnect { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// S+ helper for AutoReconnect
|
/// S+ helper for AutoReconnect
|
||||||
@@ -149,29 +149,29 @@ namespace PepperDash.Core
|
|||||||
set { AutoReconnect = value == 1; }
|
set { AutoReconnect = value == 1; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Milliseconds to wait before attempting to reconnect. Defaults to 5000
|
/// Milliseconds to wait before attempting to reconnect. Defaults to 5000
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int AutoReconnectIntervalMs { get; set; }
|
public int AutoReconnectIntervalMs { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set only when the disconnect method is called
|
/// Set only when the disconnect method is called
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool DisconnectCalledByUser;
|
bool DisconnectCalledByUser;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool Connected
|
public bool Connected
|
||||||
{
|
{
|
||||||
get { return _client.ClientStatus == SocketStatus.SOCKET_STATUS_CONNECTED; }
|
get { return _client.ClientStatus == SocketStatus.SOCKET_STATUS_CONNECTED; }
|
||||||
}
|
}
|
||||||
|
|
||||||
//Lock object to prevent simulatneous connect/disconnect operations
|
//Lock object to prevent simulatneous connect/disconnect operations
|
||||||
private CCriticalSection connectLock = new CCriticalSection();
|
private CCriticalSection connectLock = new CCriticalSection();
|
||||||
|
|
||||||
// private Timer for auto reconnect
|
// private Timer for auto reconnect
|
||||||
private CTimer RetryTimer;
|
private CTimer RetryTimer;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructor
|
/// Constructor
|
||||||
@@ -181,8 +181,8 @@ namespace PepperDash.Core
|
|||||||
/// <param name="port"></param>
|
/// <param name="port"></param>
|
||||||
/// <param name="bufferSize"></param>
|
/// <param name="bufferSize"></param>
|
||||||
public GenericTcpIpClient(string key, string address, int port, int bufferSize)
|
public GenericTcpIpClient(string key, string address, int port, int bufferSize)
|
||||||
: base(key)
|
: base(key)
|
||||||
{
|
{
|
||||||
StreamDebugging = new CommunicationStreamDebugging(key);
|
StreamDebugging = new CommunicationStreamDebugging(key);
|
||||||
CrestronEnvironment.ProgramStatusEventHandler += new ProgramStatusEventHandler(CrestronEnvironment_ProgramStatusEventHandler);
|
CrestronEnvironment.ProgramStatusEventHandler += new ProgramStatusEventHandler(CrestronEnvironment_ProgramStatusEventHandler);
|
||||||
AutoReconnectIntervalMs = 5000;
|
AutoReconnectIntervalMs = 5000;
|
||||||
@@ -218,21 +218,21 @@ namespace PepperDash.Core
|
|||||||
/// Default constructor for S+
|
/// Default constructor for S+
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public GenericTcpIpClient()
|
public GenericTcpIpClient()
|
||||||
: base(SplusKey)
|
: base(SplusKey)
|
||||||
{
|
{
|
||||||
StreamDebugging = new CommunicationStreamDebugging(SplusKey);
|
StreamDebugging = new CommunicationStreamDebugging(SplusKey);
|
||||||
CrestronEnvironment.ProgramStatusEventHandler += new ProgramStatusEventHandler(CrestronEnvironment_ProgramStatusEventHandler);
|
CrestronEnvironment.ProgramStatusEventHandler += new ProgramStatusEventHandler(CrestronEnvironment_ProgramStatusEventHandler);
|
||||||
AutoReconnectIntervalMs = 5000;
|
AutoReconnectIntervalMs = 5000;
|
||||||
BufferSize = 2000;
|
BufferSize = 2000;
|
||||||
|
|
||||||
RetryTimer = new CTimer(o =>
|
RetryTimer = new CTimer(o =>
|
||||||
{
|
{
|
||||||
Reconnect();
|
Reconnect();
|
||||||
}, Timeout.Infinite);
|
}, Timeout.Infinite);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initialize method
|
/// Just to help S+ set the key
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Initialize(string key)
|
public void Initialize(string key)
|
||||||
{
|
{
|
||||||
@@ -255,26 +255,23 @@ namespace PepperDash.Core
|
|||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <summary>
|
public override bool Deactivate()
|
||||||
/// Deactivate method
|
{
|
||||||
/// </summary>
|
|
||||||
public override bool Deactivate()
|
|
||||||
{
|
|
||||||
RetryTimer.Stop();
|
RetryTimer.Stop();
|
||||||
RetryTimer.Dispose();
|
RetryTimer.Dispose();
|
||||||
if (_client != null)
|
if (_client != null)
|
||||||
{
|
{
|
||||||
_client.SocketStatusChange -= this.Client_SocketStatusChange;
|
_client.SocketStatusChange -= this.Client_SocketStatusChange;
|
||||||
DisconnectClient();
|
DisconnectClient();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Connect method
|
/// Attempts to connect to the server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Connect()
|
public void Connect()
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(Hostname))
|
if (string.IsNullOrEmpty(Hostname))
|
||||||
{
|
{
|
||||||
Debug.Console(1, Debug.ErrorLogLevel.Warning, "GenericTcpIpClient '{0}': No address set", Key);
|
Debug.Console(1, Debug.ErrorLogLevel.Warning, "GenericTcpIpClient '{0}': No address set", Key);
|
||||||
@@ -310,7 +307,7 @@ namespace PepperDash.Core
|
|||||||
{
|
{
|
||||||
connectLock.Leave();
|
connectLock.Leave();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Reconnect()
|
private void Reconnect()
|
||||||
{
|
{
|
||||||
@@ -338,10 +335,10 @@ namespace PepperDash.Core
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Disconnect method
|
/// Attempts to disconnect the client
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Disconnect()
|
public void Disconnect()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
connectLock.Enter();
|
connectLock.Enter();
|
||||||
@@ -355,10 +352,10 @@ namespace PepperDash.Core
|
|||||||
{
|
{
|
||||||
connectLock.Leave();
|
connectLock.Leave();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// DisconnectClient method
|
/// Does the actual disconnect business
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void DisconnectClient()
|
public void DisconnectClient()
|
||||||
{
|
{
|
||||||
@@ -375,7 +372,7 @@ namespace PepperDash.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="c"></param>
|
/// <param name="c"></param>
|
||||||
void ConnectToServerCallback(TCPClient c)
|
void ConnectToServerCallback(TCPClient c)
|
||||||
{
|
{
|
||||||
if (c.ClientStatus != SocketStatus.SOCKET_STATUS_CONNECTED)
|
if (c.ClientStatus != SocketStatus.SOCKET_STATUS_CONNECTED)
|
||||||
{
|
{
|
||||||
Debug.Console(0, this, "Server connection result: {0}", c.ClientStatus);
|
Debug.Console(0, this, "Server connection result: {0}", c.ClientStatus);
|
||||||
@@ -385,13 +382,13 @@ namespace PepperDash.Core
|
|||||||
{
|
{
|
||||||
Debug.Console(1, this, "Server connection result: {0}", c.ClientStatus);
|
Debug.Console(1, this, "Server connection result: {0}", c.ClientStatus);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Disconnects, waits and attemtps to connect again
|
/// Disconnects, waits and attemtps to connect again
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void WaitAndTryReconnect()
|
void WaitAndTryReconnect()
|
||||||
{
|
{
|
||||||
CrestronInvoke.BeginInvoke(o =>
|
CrestronInvoke.BeginInvoke(o =>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -409,7 +406,7 @@ namespace PepperDash.Core
|
|||||||
connectLock.Leave();
|
connectLock.Leave();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Recieves incoming data
|
/// Recieves incoming data
|
||||||
@@ -417,7 +414,7 @@ namespace PepperDash.Core
|
|||||||
/// <param name="client"></param>
|
/// <param name="client"></param>
|
||||||
/// <param name="numBytes"></param>
|
/// <param name="numBytes"></param>
|
||||||
void Receive(TCPClient client, int numBytes)
|
void Receive(TCPClient client, int numBytes)
|
||||||
{
|
{
|
||||||
if (client != null)
|
if (client != null)
|
||||||
{
|
{
|
||||||
if (numBytes > 0)
|
if (numBytes > 0)
|
||||||
@@ -426,7 +423,10 @@ namespace PepperDash.Core
|
|||||||
var bytesHandler = BytesReceived;
|
var bytesHandler = BytesReceived;
|
||||||
if (bytesHandler != null)
|
if (bytesHandler != null)
|
||||||
{
|
{
|
||||||
this.PrintReceivedBytes(bytes);
|
if (StreamDebugging.RxStreamDebuggingIsEnabled)
|
||||||
|
{
|
||||||
|
Debug.Console(0, this, "Received {1} bytes: '{0}'", ComTextHelper.GetEscapedText(bytes), bytes.Length);
|
||||||
|
}
|
||||||
bytesHandler(this, new GenericCommMethodReceiveBytesArgs(bytes));
|
bytesHandler(this, new GenericCommMethodReceiveBytesArgs(bytes));
|
||||||
}
|
}
|
||||||
var textHandler = TextReceived;
|
var textHandler = TextReceived;
|
||||||
@@ -434,53 +434,55 @@ namespace PepperDash.Core
|
|||||||
{
|
{
|
||||||
var str = Encoding.GetEncoding(28591).GetString(bytes, 0, bytes.Length);
|
var str = Encoding.GetEncoding(28591).GetString(bytes, 0, bytes.Length);
|
||||||
|
|
||||||
this.PrintReceivedText(str);
|
if (StreamDebugging.RxStreamDebuggingIsEnabled)
|
||||||
|
{
|
||||||
|
Debug.Console(0, this, "Received {1} characters of text: '{0}'", ComTextHelper.GetDebugText(str), str.Length);
|
||||||
|
}
|
||||||
|
|
||||||
textHandler(this, new GenericCommMethodReceiveTextArgs(str));
|
textHandler(this, new GenericCommMethodReceiveTextArgs(str));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
client.ReceiveDataAsync(Receive);
|
client.ReceiveDataAsync(Receive);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// SendText method
|
/// General send method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SendText(string text)
|
public void SendText(string text)
|
||||||
{
|
{
|
||||||
var bytes = Encoding.GetEncoding(28591).GetBytes(text);
|
var bytes = Encoding.GetEncoding(28591).GetBytes(text);
|
||||||
// Check debug level before processing byte array
|
// Check debug level before processing byte array
|
||||||
this.PrintSentText(text);
|
if (StreamDebugging.TxStreamDebuggingIsEnabled)
|
||||||
|
Debug.Console(0, this, "Sending {0} characters of text: '{1}'", text.Length, ComTextHelper.GetDebugText(text));
|
||||||
if (_client != null)
|
if (_client != null)
|
||||||
_client.SendData(bytes, bytes.Length);
|
_client.SendData(bytes, bytes.Length);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// SendEscapedText method
|
/// This is useful from console and...?
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SendEscapedText(string text)
|
public void SendEscapedText(string text)
|
||||||
{
|
{
|
||||||
var unescapedText = Regex.Replace(text, @"\\x([0-9a-fA-F][0-9a-fA-F])", s =>
|
var unescapedText = Regex.Replace(text, @"\\x([0-9a-fA-F][0-9a-fA-F])", s =>
|
||||||
{
|
{
|
||||||
var hex = s.Groups[1].Value;
|
var hex = s.Groups[1].Value;
|
||||||
return ((char)Convert.ToByte(hex, 16)).ToString();
|
return ((char)Convert.ToByte(hex, 16)).ToString();
|
||||||
});
|
});
|
||||||
SendText(unescapedText);
|
SendText(unescapedText);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sends Bytes to the server
|
/// Sends Bytes to the server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="bytes"></param>
|
/// <param name="bytes"></param>
|
||||||
/// <summary>
|
public void SendBytes(byte[] bytes)
|
||||||
/// SendBytes method
|
{
|
||||||
/// </summary>
|
if (StreamDebugging.TxStreamDebuggingIsEnabled)
|
||||||
public void SendBytes(byte[] bytes)
|
Debug.Console(0, this, "Sending {0} bytes: '{1}'", bytes.Length, ComTextHelper.GetEscapedText(bytes));
|
||||||
{
|
|
||||||
this.PrintSentBytes(bytes);
|
|
||||||
if (_client != null)
|
if (_client != null)
|
||||||
_client.SendData(bytes, bytes.Length);
|
_client.SendData(bytes, bytes.Length);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Socket Status Change Handler
|
/// Socket Status Change Handler
|
||||||
@@ -488,7 +490,7 @@ namespace PepperDash.Core
|
|||||||
/// <param name="client"></param>
|
/// <param name="client"></param>
|
||||||
/// <param name="clientSocketStatus"></param>
|
/// <param name="clientSocketStatus"></param>
|
||||||
void Client_SocketStatusChange(TCPClient client, SocketStatus clientSocketStatus)
|
void Client_SocketStatusChange(TCPClient client, SocketStatus clientSocketStatus)
|
||||||
{
|
{
|
||||||
if (clientSocketStatus != SocketStatus.SOCKET_STATUS_CONNECTED)
|
if (clientSocketStatus != SocketStatus.SOCKET_STATUS_CONNECTED)
|
||||||
{
|
{
|
||||||
Debug.Console(0, this, "Socket status change {0} ({1})", clientSocketStatus, ClientStatusText);
|
Debug.Console(0, this, "Socket status change {0} ({1})", clientSocketStatus, ClientStatusText);
|
||||||
@@ -497,73 +499,68 @@ namespace PepperDash.Core
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
Debug.Console(1, this, "Socket status change {0} ({1})", clientSocketStatus, ClientStatusText);
|
Debug.Console(1, this, "Socket status change {0} ({1})", clientSocketStatus, ClientStatusText);
|
||||||
_client.ReceiveDataAsync(Receive);
|
_client.ReceiveDataAsync(Receive);
|
||||||
}
|
}
|
||||||
|
|
||||||
var handler = ConnectionChange;
|
var handler = ConnectionChange;
|
||||||
if (handler != null)
|
if (handler != null)
|
||||||
ConnectionChange(this, new GenericSocketStatusChageEventArgs(this));
|
ConnectionChange(this, new GenericSocketStatusChageEventArgs(this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a TcpSshPropertiesConfig
|
/// Configuration properties for TCP/SSH Connections
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class TcpSshPropertiesConfig
|
public class TcpSshPropertiesConfig
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Address to connect to
|
/// Address to connect to
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty(Required = Required.Always)]
|
[JsonProperty(Required = Required.Always)]
|
||||||
public string Address { get; set; }
|
public string Address { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Port to connect to
|
/// Port to connect to
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty(Required = Required.Always)]
|
[JsonProperty(Required = Required.Always)]
|
||||||
public int Port { get; set; }
|
public int Port { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Username credential
|
/// Username credential
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Username { get; set; }
|
public string Username { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Password
|
/// Passord credential
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Password { get; set; }
|
public string Password { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defaults to 32768
|
/// Defaults to 32768
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int BufferSize { get; set; }
|
public int BufferSize { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the AutoReconnect
|
/// Defaults to true
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool AutoReconnect { get; set; }
|
public bool AutoReconnect { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the AutoReconnectIntervalMs
|
/// Defaults to 5000ms
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int AutoReconnectIntervalMs { get; set; }
|
public int AutoReconnectIntervalMs { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// When true, turns off echo for the SSH session
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("disableSshEcho")]
|
|
||||||
public bool DisableSshEcho { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Default constructor
|
/// Default constructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public TcpSshPropertiesConfig()
|
public TcpSshPropertiesConfig()
|
||||||
{
|
{
|
||||||
BufferSize = 32768;
|
BufferSize = 32768;
|
||||||
AutoReconnect = true;
|
AutoReconnect = true;
|
||||||
AutoReconnectIntervalMs = 5000;
|
AutoReconnectIntervalMs = 5000;
|
||||||
Username = "";
|
Username = "";
|
||||||
Password = "";
|
Password = "";
|
||||||
DisableSshEcho = false;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ namespace PepperDash.Core
|
|||||||
public string Hostname { get; set; }
|
public string Hostname { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Port
|
/// Port on server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int Port { get; set; }
|
public int Port { get; set; }
|
||||||
|
|
||||||
@@ -102,7 +102,7 @@ namespace PepperDash.Core
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <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>
|
/// </summary>
|
||||||
public string SharedKey { get; set; }
|
public string SharedKey { get; set; }
|
||||||
|
|
||||||
@@ -112,7 +112,7 @@ namespace PepperDash.Core
|
|||||||
private bool WaitingForSharedKeyResponse { get; set; }
|
private bool WaitingForSharedKeyResponse { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the BufferSize
|
/// Defaults to 2000
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int BufferSize { get; set; }
|
public int BufferSize { get; set; }
|
||||||
|
|
||||||
@@ -289,7 +289,7 @@ namespace PepperDash.Core
|
|||||||
#region Methods
|
#region Methods
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initialize method
|
/// Just to help S+ set the key
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Initialize(string key)
|
public void Initialize(string key)
|
||||||
{
|
{
|
||||||
@@ -311,7 +311,7 @@ namespace PepperDash.Core
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Connect method
|
/// Connect Method. Will return if already connected. Will write errors if missing address, port, or unique key/name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Connect()
|
public void Connect()
|
||||||
{
|
{
|
||||||
@@ -442,7 +442,7 @@ namespace PepperDash.Core
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Disconnect method
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Disconnect()
|
public void Disconnect()
|
||||||
{
|
{
|
||||||
@@ -669,7 +669,7 @@ namespace PepperDash.Core
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// SendText method
|
/// General send method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SendText(string text)
|
public void SendText(string text)
|
||||||
{
|
{
|
||||||
@@ -698,7 +698,7 @@ namespace PepperDash.Core
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// SendBytes method
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SendBytes(byte[] bytes)
|
public void SendBytes(byte[] bytes)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ namespace PepperDash.Core
|
|||||||
public ServerHasChokedCallbackDelegate ServerHasChoked { get; set; }
|
public ServerHasChokedCallbackDelegate ServerHasChoked { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Delegate for ServerHasChokedCallbackDelegate
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public delegate void ServerHasChokedCallbackDelegate();
|
public delegate void ServerHasChokedCallbackDelegate();
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ namespace PepperDash.Core
|
|||||||
int MonitorClientFailureCount;
|
int MonitorClientFailureCount;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the MonitorClientMaxFailureCount
|
/// 3 by default
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int MonitorClientMaxFailureCount { get; set; }
|
public int MonitorClientMaxFailureCount { get; set; }
|
||||||
|
|
||||||
@@ -171,7 +171,7 @@ namespace PepperDash.Core
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Port
|
/// Port Server should listen on
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int Port { get; set; }
|
public int Port { get; set; }
|
||||||
|
|
||||||
@@ -204,7 +204,8 @@ namespace PepperDash.Core
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <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>
|
/// </summary>
|
||||||
public string SharedKey { get; set; }
|
public string SharedKey { get; set; }
|
||||||
|
|
||||||
@@ -228,7 +229,7 @@ namespace PepperDash.Core
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the HeartbeatRequiredIntervalMs
|
/// Milliseconds before server expects another heartbeat. Set by property HeartbeatRequiredIntervalInSeconds which is driven from S+
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int HeartbeatRequiredIntervalMs { get; set; }
|
public int HeartbeatRequiredIntervalMs { get; set; }
|
||||||
|
|
||||||
@@ -238,7 +239,7 @@ namespace PepperDash.Core
|
|||||||
public ushort HeartbeatRequiredIntervalInSeconds { set { HeartbeatRequiredIntervalMs = (value * 1000); } }
|
public ushort HeartbeatRequiredIntervalInSeconds { set { HeartbeatRequiredIntervalMs = (value * 1000); } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the HeartbeatStringToMatch
|
/// String to Match for heartbeat. If null or empty any string will reset heartbeat timer
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string HeartbeatStringToMatch { get; set; }
|
public string HeartbeatStringToMatch { get; set; }
|
||||||
|
|
||||||
@@ -256,7 +257,7 @@ namespace PepperDash.Core
|
|||||||
public List<uint> ConnectedClientsIndexes = new List<uint>();
|
public List<uint> ConnectedClientsIndexes = new List<uint>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the BufferSize
|
/// Defaults to 2000
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int BufferSize { get; set; }
|
public int BufferSize { get; set; }
|
||||||
|
|
||||||
@@ -319,7 +320,7 @@ namespace PepperDash.Core
|
|||||||
|
|
||||||
#region Methods - Server Actions
|
#region Methods - Server Actions
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// KillServer method
|
/// Disconnects all clients and stops the server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void KillServer()
|
public void KillServer()
|
||||||
{
|
{
|
||||||
@@ -336,9 +337,6 @@ namespace PepperDash.Core
|
|||||||
/// Initialize Key for device using client name from SIMPL+. Called on Listen from SIMPL+
|
/// Initialize Key for device using client name from SIMPL+. Called on Listen from SIMPL+
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="key"></param>
|
/// <param name="key"></param>
|
||||||
/// <summary>
|
|
||||||
/// Initialize method
|
|
||||||
/// </summary>
|
|
||||||
public void Initialize(string key)
|
public void Initialize(string key)
|
||||||
{
|
{
|
||||||
Key = key;
|
Key = key;
|
||||||
@@ -377,7 +375,7 @@ namespace PepperDash.Core
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Listen method
|
/// Start listening on the specified port
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Listen()
|
public void Listen()
|
||||||
{
|
{
|
||||||
@@ -434,7 +432,7 @@ namespace PepperDash.Core
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// StopListening method
|
/// Stop Listening
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void StopListening()
|
public void StopListening()
|
||||||
{
|
{
|
||||||
@@ -459,9 +457,6 @@ namespace PepperDash.Core
|
|||||||
/// Disconnects Client
|
/// Disconnects Client
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="client"></param>
|
/// <param name="client"></param>
|
||||||
/// <summary>
|
|
||||||
/// DisconnectClient method
|
|
||||||
/// </summary>
|
|
||||||
public void DisconnectClient(uint client)
|
public void DisconnectClient(uint client)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -475,7 +470,7 @@ namespace PepperDash.Core
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// DisconnectAllClientsForShutdown method
|
/// Disconnect All Clients
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void DisconnectAllClientsForShutdown()
|
public void DisconnectAllClientsForShutdown()
|
||||||
{
|
{
|
||||||
@@ -517,9 +512,6 @@ namespace PepperDash.Core
|
|||||||
/// Broadcast text from server to all connected clients
|
/// Broadcast text from server to all connected clients
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="text"></param>
|
/// <param name="text"></param>
|
||||||
/// <summary>
|
|
||||||
/// BroadcastText method
|
|
||||||
/// </summary>
|
|
||||||
public void BroadcastText(string text)
|
public void BroadcastText(string text)
|
||||||
{
|
{
|
||||||
CCriticalSection CCBroadcast = new CCriticalSection();
|
CCriticalSection CCBroadcast = new CCriticalSection();
|
||||||
@@ -553,9 +545,6 @@ namespace PepperDash.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="text"></param>
|
/// <param name="text"></param>
|
||||||
/// <param name="clientIndex"></param>
|
/// <param name="clientIndex"></param>
|
||||||
/// <summary>
|
|
||||||
/// SendTextToClient method
|
|
||||||
/// </summary>
|
|
||||||
public void SendTextToClient(string text, uint clientIndex)
|
public void SendTextToClient(string text, uint clientIndex)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -624,9 +613,6 @@ namespace PepperDash.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="clientIndex"></param>
|
/// <param name="clientIndex"></param>
|
||||||
/// <returns>IP address of the client</returns>
|
/// <returns>IP address of the client</returns>
|
||||||
/// <summary>
|
|
||||||
/// GetClientIPAddress method
|
|
||||||
/// </summary>
|
|
||||||
public string GetClientIPAddress(uint clientIndex)
|
public string GetClientIPAddress(uint clientIndex)
|
||||||
{
|
{
|
||||||
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "GetClientIPAddress Index: {0}", clientIndex);
|
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "GetClientIPAddress Index: {0}", clientIndex);
|
||||||
|
|||||||
@@ -124,21 +124,21 @@ namespace PepperDash.Core
|
|||||||
CrestronEnvironment.ProgramStatusEventHandler += new ProgramStatusEventHandler(CrestronEnvironment_ProgramStatusEventHandler);
|
CrestronEnvironment.ProgramStatusEventHandler += new ProgramStatusEventHandler(CrestronEnvironment_ProgramStatusEventHandler);
|
||||||
CrestronEnvironment.EthernetEventHandler += new EthernetEventHandler(CrestronEnvironment_EthernetEventHandler);
|
CrestronEnvironment.EthernetEventHandler += new EthernetEventHandler(CrestronEnvironment_EthernetEventHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="key"></param>
|
/// <param name="key"></param>
|
||||||
/// <param name="address"></param>
|
/// <param name="address"></param>
|
||||||
/// <param name="port"></param>
|
/// <param name="port"></param>
|
||||||
/// <param name="bufferSize"></param>
|
/// <param name="buffefSize"></param>
|
||||||
public GenericUdpServer(string key, string address, int port, int bufferSize)
|
public GenericUdpServer(string key, string address, int port, int buffefSize)
|
||||||
: base(key)
|
: base(key)
|
||||||
{
|
{
|
||||||
StreamDebugging = new CommunicationStreamDebugging(key);
|
StreamDebugging = new CommunicationStreamDebugging(key);
|
||||||
Hostname = address;
|
Hostname = address;
|
||||||
Port = port;
|
Port = port;
|
||||||
BufferSize = bufferSize;
|
BufferSize = buffefSize;
|
||||||
|
|
||||||
CrestronEnvironment.ProgramStatusEventHandler += new ProgramStatusEventHandler(CrestronEnvironment_ProgramStatusEventHandler);
|
CrestronEnvironment.ProgramStatusEventHandler += new ProgramStatusEventHandler(CrestronEnvironment_ProgramStatusEventHandler);
|
||||||
CrestronEnvironment.EthernetEventHandler += new EthernetEventHandler(CrestronEnvironment_EthernetEventHandler);
|
CrestronEnvironment.EthernetEventHandler += new EthernetEventHandler(CrestronEnvironment_EthernetEventHandler);
|
||||||
@@ -150,9 +150,6 @@ namespace PepperDash.Core
|
|||||||
/// <param name="key"></param>
|
/// <param name="key"></param>
|
||||||
/// <param name="address"></param>
|
/// <param name="address"></param>
|
||||||
/// <param name="port"></param>
|
/// <param name="port"></param>
|
||||||
/// <summary>
|
|
||||||
/// Initialize method
|
|
||||||
/// </summary>
|
|
||||||
public void Initialize(string key, string address, ushort port)
|
public void Initialize(string key, string address, ushort port)
|
||||||
{
|
{
|
||||||
Key = key;
|
Key = key;
|
||||||
@@ -180,7 +177,7 @@ namespace PepperDash.Core
|
|||||||
/// <param name="programEventType"></param>
|
/// <param name="programEventType"></param>
|
||||||
void CrestronEnvironment_ProgramStatusEventHandler(eProgramStatusEventType programEventType)
|
void CrestronEnvironment_ProgramStatusEventHandler(eProgramStatusEventType programEventType)
|
||||||
{
|
{
|
||||||
if (programEventType != eProgramStatusEventType.Stopping)
|
if (programEventType != eProgramStatusEventType.Stopping)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Debug.Console(1, this, "Program stopping. Disabling Server");
|
Debug.Console(1, this, "Program stopping. Disabling Server");
|
||||||
@@ -188,27 +185,13 @@ namespace PepperDash.Core
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Connect method
|
/// Enables the UDP Server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Connect()
|
public void Connect()
|
||||||
{
|
{
|
||||||
if (Server == null)
|
if (Server == null)
|
||||||
{
|
{
|
||||||
try
|
Server = new UDPServer();
|
||||||
{
|
|
||||||
var address = IPAddress.Parse(Hostname);
|
|
||||||
|
|
||||||
Server = new UDPServer(address, Port, BufferSize);
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
this.LogError("Error parsing IP Address '{ipAddress}': message: {message}", Hostname, ex.Message);
|
|
||||||
this.LogInformation("Creating UDPServer with default buffersize");
|
|
||||||
|
|
||||||
Server = new UDPServer();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(Hostname))
|
if (string.IsNullOrEmpty(Hostname))
|
||||||
@@ -239,11 +222,11 @@ namespace PepperDash.Core
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Disconnect method
|
/// Disabled the UDP Server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Disconnect()
|
public void Disconnect()
|
||||||
{
|
{
|
||||||
if (Server != null)
|
if(Server != null)
|
||||||
Server.DisableUDPServer();
|
Server.DisableUDPServer();
|
||||||
|
|
||||||
IsConnected = false;
|
IsConnected = false;
|
||||||
@@ -265,7 +248,7 @@ namespace PepperDash.Core
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (numBytes <= 0)
|
if (numBytes <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var sourceIp = Server.IPAddressLastMessageReceivedFrom;
|
var sourceIp = Server.IPAddressLastMessageReceivedFrom;
|
||||||
@@ -281,13 +264,17 @@ namespace PepperDash.Core
|
|||||||
var bytesHandler = BytesReceived;
|
var bytesHandler = BytesReceived;
|
||||||
if (bytesHandler != null)
|
if (bytesHandler != null)
|
||||||
{
|
{
|
||||||
this.PrintReceivedBytes(bytes);
|
if (StreamDebugging.RxStreamDebuggingIsEnabled)
|
||||||
|
{
|
||||||
|
Debug.Console(0, this, "Received {1} bytes: '{0}'", ComTextHelper.GetEscapedText(bytes), bytes.Length);
|
||||||
|
}
|
||||||
bytesHandler(this, new GenericCommMethodReceiveBytesArgs(bytes));
|
bytesHandler(this, new GenericCommMethodReceiveBytesArgs(bytes));
|
||||||
}
|
}
|
||||||
var textHandler = TextReceived;
|
var textHandler = TextReceived;
|
||||||
if (textHandler != null)
|
if (textHandler != null)
|
||||||
{
|
{
|
||||||
this.PrintReceivedText(str);
|
if (StreamDebugging.RxStreamDebuggingIsEnabled)
|
||||||
|
Debug.Console(0, this, "Received {1} characters of text: '{0}'", ComTextHelper.GetDebugText(str), str.Length);
|
||||||
textHandler(this, new GenericCommMethodReceiveTextArgs(str));
|
textHandler(this, new GenericCommMethodReceiveTextArgs(str));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -305,16 +292,14 @@ namespace PepperDash.Core
|
|||||||
/// General send method
|
/// General send method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="text"></param>
|
/// <param name="text"></param>
|
||||||
/// <summary>
|
|
||||||
/// SendText method
|
|
||||||
/// </summary>
|
|
||||||
public void SendText(string text)
|
public void SendText(string text)
|
||||||
{
|
{
|
||||||
var bytes = Encoding.GetEncoding(28591).GetBytes(text);
|
var bytes = Encoding.GetEncoding(28591).GetBytes(text);
|
||||||
|
|
||||||
if (IsConnected && Server != null)
|
if (IsConnected && Server != null)
|
||||||
{
|
{
|
||||||
this.PrintSentText(text);
|
if (StreamDebugging.TxStreamDebuggingIsEnabled)
|
||||||
|
Debug.Console(0, this, "Sending {0} characters of text: '{1}'", text.Length, ComTextHelper.GetDebugText(text));
|
||||||
|
|
||||||
Server.SendData(bytes, bytes.Length);
|
Server.SendData(bytes, bytes.Length);
|
||||||
}
|
}
|
||||||
@@ -324,12 +309,10 @@ namespace PepperDash.Core
|
|||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="bytes"></param>
|
/// <param name="bytes"></param>
|
||||||
/// <summary>
|
|
||||||
/// SendBytes method
|
|
||||||
/// </summary>
|
|
||||||
public void SendBytes(byte[] bytes)
|
public void SendBytes(byte[] bytes)
|
||||||
{
|
{
|
||||||
this.PrintSentBytes(bytes);
|
if (StreamDebugging.TxStreamDebuggingIsEnabled)
|
||||||
|
Debug.Console(0, this, "Sending {0} bytes: '{1}'", bytes.Length, ComTextHelper.GetEscapedText(bytes));
|
||||||
|
|
||||||
if (IsConnected && Server != null)
|
if (IsConnected && Server != null)
|
||||||
Server.SendData(bytes, bytes.Length);
|
Server.SendData(bytes, bytes.Length);
|
||||||
@@ -338,10 +321,10 @@ namespace PepperDash.Core
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a GenericUdpReceiveTextExtraArgs
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class GenericUdpReceiveTextExtraArgs : EventArgs
|
public class GenericUdpReceiveTextExtraArgs : EventArgs
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -353,7 +336,7 @@ namespace PepperDash.Core
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int Port { get; private set; }
|
public int Port { get; private set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -367,18 +350,18 @@ namespace PepperDash.Core
|
|||||||
/// <param name="port"></param>
|
/// <param name="port"></param>
|
||||||
/// <param name="bytes"></param>
|
/// <param name="bytes"></param>
|
||||||
public GenericUdpReceiveTextExtraArgs(string text, string ipAddress, int port, byte[] bytes)
|
public GenericUdpReceiveTextExtraArgs(string text, string ipAddress, int port, byte[] bytes)
|
||||||
{
|
{
|
||||||
Text = text;
|
Text = text;
|
||||||
IpAddress = ipAddress;
|
IpAddress = ipAddress;
|
||||||
Port = port;
|
Port = port;
|
||||||
Bytes = bytes;
|
Bytes = bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stupid S+ Constructor
|
/// Stupid S+ Constructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public GenericUdpReceiveTextExtraArgs() { }
|
public GenericUdpReceiveTextExtraArgs() { }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -1,69 +0,0 @@
|
|||||||
using System;
|
|
||||||
using Crestron.SimplSharp;
|
|
||||||
|
|
||||||
namespace PepperDash.Core
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Extension methods for stream debugging
|
|
||||||
/// </summary>
|
|
||||||
public static class StreamDebuggingExtensions
|
|
||||||
{
|
|
||||||
private static readonly string app = CrestronEnvironment.DevicePlatform == eDevicePlatform.Appliance ? $"App {InitialParametersClass.ApplicationNumber}" : $"{InitialParametersClass.RoomId}";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Print the sent bytes to the console
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="comms">comms device</param>
|
|
||||||
/// <param name="bytes">bytes to print</param>
|
|
||||||
public static void PrintSentBytes(this IStreamDebugging comms, byte[] bytes)
|
|
||||||
{
|
|
||||||
if (!comms.StreamDebugging.TxStreamDebuggingIsEnabled) return;
|
|
||||||
|
|
||||||
var timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
|
||||||
|
|
||||||
CrestronConsole.PrintLine($"[{timestamp}][{app}][{comms.Key}] Sending {bytes.Length} bytes: '{ComTextHelper.GetEscapedText(bytes)}'");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Print the received bytes to the console
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="comms">comms device</param>
|
|
||||||
/// <param name="bytes">bytes to print</param>
|
|
||||||
public static void PrintReceivedBytes(this IStreamDebugging comms, byte[] bytes)
|
|
||||||
{
|
|
||||||
if (!comms.StreamDebugging.RxStreamDebuggingIsEnabled) return;
|
|
||||||
|
|
||||||
var timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
|
||||||
|
|
||||||
CrestronConsole.PrintLine($"[{timestamp}][{app}][{comms.Key}] Received {bytes.Length} bytes: '{ComTextHelper.GetEscapedText(bytes)}'");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Print the sent text to the console
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="comms">comms device</param>
|
|
||||||
/// <param name="text">text to print</param>
|
|
||||||
public static void PrintSentText(this IStreamDebugging comms, string text)
|
|
||||||
{
|
|
||||||
if (!comms.StreamDebugging.TxStreamDebuggingIsEnabled) return;
|
|
||||||
|
|
||||||
var timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
|
||||||
|
|
||||||
CrestronConsole.PrintLine($"[{timestamp}][{app}][{comms.Key}] Sending Text: '{ComTextHelper.GetDebugText(text)}'");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Print the received text to the console
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="comms">comms device</param>
|
|
||||||
/// <param name="text">text to print</param>
|
|
||||||
public static void PrintReceivedText(this IStreamDebugging comms, string text)
|
|
||||||
{
|
|
||||||
if (!comms.StreamDebugging.RxStreamDebuggingIsEnabled) return;
|
|
||||||
|
|
||||||
var timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
|
||||||
|
|
||||||
CrestronConsole.PrintLine($"[{timestamp}][{app}][{comms.Key}] Received Text: '{ComTextHelper.GetDebugText(text)}'");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
namespace PepperDash.Core
|
namespace PepperDash.Core
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <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>
|
/// </summary>
|
||||||
public class TcpClientConfigObject
|
public class TcpClientConfigObject
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -74,14 +74,6 @@ namespace PepperDash.Core
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Secure TCP/IP
|
/// Secure TCP/IP
|
||||||
/// </summary>
|
/// </summary>
|
||||||
SecureTcpIp,
|
SecureTcpIp
|
||||||
/// <summary>
|
|
||||||
/// Used when comms needs to be handled in SIMPL and bridged opposite the normal direction
|
|
||||||
/// </summary>
|
|
||||||
ComBridge,
|
|
||||||
/// <summary>
|
|
||||||
/// InfinetEX control
|
|
||||||
/// </summary>
|
|
||||||
InfinetEx
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
using System;
|
|
||||||
|
|
||||||
namespace PepperDash.Core
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// The available settings for stream debugging data format types
|
|
||||||
/// </summary>
|
|
||||||
[Flags]
|
|
||||||
public enum eStreamDebuggingDataTypeSettings
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Debug data in byte format
|
|
||||||
/// </summary>
|
|
||||||
Bytes = 0,
|
|
||||||
/// <summary>
|
|
||||||
/// Debug data in text format
|
|
||||||
/// </summary>
|
|
||||||
Text = 1,
|
|
||||||
/// <summary>
|
|
||||||
/// Debug data in both byte and text formats
|
|
||||||
/// </summary>
|
|
||||||
Both = Bytes | Text
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
using System;
|
|
||||||
|
|
||||||
namespace PepperDash.Core
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// The available settings for stream debugging
|
|
||||||
/// </summary>
|
|
||||||
[Flags]
|
|
||||||
public enum eStreamDebuggingSetting
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Debug off
|
|
||||||
/// </summary>
|
|
||||||
Off = 0,
|
|
||||||
/// <summary>
|
|
||||||
/// Debug received data
|
|
||||||
/// </summary>
|
|
||||||
Rx = 1,
|
|
||||||
/// <summary>
|
|
||||||
/// Debug transmitted data
|
|
||||||
/// </summary>
|
|
||||||
Tx = 2,
|
|
||||||
/// <summary>
|
|
||||||
/// Debug both received and transmitted data
|
|
||||||
/// </summary>
|
|
||||||
Both = Rx | Tx
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
using Crestron.SimplSharp.CrestronSockets;
|
using Crestron.SimplSharp.CrestronSockets;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace PepperDash.Core
|
namespace PepperDash.Core
|
||||||
@@ -35,11 +38,11 @@ namespace PepperDash.Core
|
|||||||
void Disconnect();
|
void Disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defines the contract for IBasicCommunication
|
/// Represents a device that uses basic connection
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IBasicCommunication : ICommunicationReceiver
|
public interface IBasicCommunication : ICommunicationReceiver
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Send text to the device
|
/// Send text to the device
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -51,7 +54,7 @@ namespace PepperDash.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="bytes"></param>
|
/// <param name="bytes"></param>
|
||||||
void SendBytes(byte[] bytes);
|
void SendBytes(byte[] bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a device that implements IBasicCommunication and IStreamDebugging
|
/// Represents a device that implements IBasicCommunication and IStreamDebugging
|
||||||
@@ -64,7 +67,7 @@ namespace PepperDash.Core
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a device with stream debugging capablities
|
/// Represents a device with stream debugging capablities
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IStreamDebugging : IKeyed
|
public interface IStreamDebugging
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Object to enable stream debugging
|
/// Object to enable stream debugging
|
||||||
@@ -73,12 +76,12 @@ namespace PepperDash.Core
|
|||||||
CommunicationStreamDebugging StreamDebugging { get; }
|
CommunicationStreamDebugging StreamDebugging { get; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// For IBasicCommunication classes that have SocketStatus. GenericSshClient,
|
/// For IBasicCommunication classes that have SocketStatus. GenericSshClient,
|
||||||
/// GenericTcpIpClient
|
/// GenericTcpIpClient
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface ISocketStatus : IBasicCommunication
|
public interface ISocketStatus : IBasicCommunication
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Notifies of socket status changes
|
/// Notifies of socket status changes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -90,7 +93,7 @@ namespace PepperDash.Core
|
|||||||
[JsonProperty("clientStatus")]
|
[JsonProperty("clientStatus")]
|
||||||
[JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
|
[JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
|
||||||
SocketStatus ClientStatus { get; }
|
SocketStatus ClientStatus { get; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Describes a device that implements ISocketStatus and IStreamDebugging
|
/// Describes a device that implements ISocketStatus and IStreamDebugging
|
||||||
@@ -104,24 +107,24 @@ namespace PepperDash.Core
|
|||||||
/// Describes a device that can automatically attempt to reconnect
|
/// Describes a device that can automatically attempt to reconnect
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IAutoReconnect
|
public interface IAutoReconnect
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Enable automatic recconnect
|
/// Enable automatic recconnect
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("autoReconnect")]
|
[JsonProperty("autoReconnect")]
|
||||||
bool AutoReconnect { get; set; }
|
bool AutoReconnect { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interval in ms to attempt automatic recconnections
|
/// Interval in ms to attempt automatic recconnections
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("autoReconnectIntervalMs")]
|
[JsonProperty("autoReconnectIntervalMs")]
|
||||||
int AutoReconnectIntervalMs { get; set; }
|
int AutoReconnectIntervalMs { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public enum eGenericCommMethodStatusChangeType
|
public enum eGenericCommMethodStatusChangeType
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Connected
|
/// Connected
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -130,45 +133,45 @@ namespace PepperDash.Core
|
|||||||
/// Disconnected
|
/// Disconnected
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Disconnected
|
Disconnected
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This delegate defines handler for IBasicCommunication status changes
|
/// This delegate defines handler for IBasicCommunication status changes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="comm">Device firing the status change</param>
|
/// <param name="comm">Device firing the status change</param>
|
||||||
/// <param name="status"></param>
|
/// <param name="status"></param>
|
||||||
public delegate void GenericCommMethodStatusHandler(IBasicCommunication comm, eGenericCommMethodStatusChangeType status);
|
public delegate void GenericCommMethodStatusHandler(IBasicCommunication comm, eGenericCommMethodStatusChangeType status);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class GenericCommMethodReceiveBytesArgs : EventArgs
|
public class GenericCommMethodReceiveBytesArgs : EventArgs
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Bytes
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public byte[] Bytes { get; private set; }
|
public byte[] Bytes { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="bytes"></param>
|
/// <param name="bytes"></param>
|
||||||
public GenericCommMethodReceiveBytesArgs(byte[] bytes)
|
public GenericCommMethodReceiveBytesArgs(byte[] bytes)
|
||||||
{
|
{
|
||||||
Bytes = bytes;
|
Bytes = bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// S+ Constructor
|
/// S+ Constructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public GenericCommMethodReceiveBytesArgs() { }
|
public GenericCommMethodReceiveBytesArgs() { }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class GenericCommMethodReceiveTextArgs : EventArgs
|
public class GenericCommMethodReceiveTextArgs : EventArgs
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -182,9 +185,9 @@ namespace PepperDash.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="text"></param>
|
/// <param name="text"></param>
|
||||||
public GenericCommMethodReceiveTextArgs(string text)
|
public GenericCommMethodReceiveTextArgs(string text)
|
||||||
{
|
{
|
||||||
Text = text;
|
Text = text;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
@@ -192,14 +195,53 @@ namespace PepperDash.Core
|
|||||||
/// <param name="text"></param>
|
/// <param name="text"></param>
|
||||||
/// <param name="delimiter"></param>
|
/// <param name="delimiter"></param>
|
||||||
public GenericCommMethodReceiveTextArgs(string text, string delimiter)
|
public GenericCommMethodReceiveTextArgs(string text, string delimiter)
|
||||||
: this(text)
|
:this(text)
|
||||||
{
|
{
|
||||||
Delimiter = delimiter;
|
Delimiter = delimiter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// S+ Constructor
|
||||||
|
/// </summary>
|
||||||
|
public GenericCommMethodReceiveTextArgs() { }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public class ComTextHelper
|
||||||
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// S+ Constructor
|
/// Gets escaped text for a byte array
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public GenericCommMethodReceiveTextArgs() { }
|
/// <param name="bytes"></param>
|
||||||
}
|
/// <returns></returns>
|
||||||
|
public static string GetEscapedText(byte[] bytes)
|
||||||
|
{
|
||||||
|
return String.Concat(bytes.Select(b => string.Format(@"[{0:X2}]", (int)b)).ToArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets escaped text for a string
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string GetEscapedText(string text)
|
||||||
|
{
|
||||||
|
var bytes = Encoding.GetEncoding(28591).GetBytes(text);
|
||||||
|
return String.Concat(bytes.Select(b => string.Format(@"[{0:X2}]", (int)b)).ToArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets debug text for a string
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string GetDebugText(string text)
|
||||||
|
{
|
||||||
|
return Regex.Replace(text, @"[^\u0020-\u007E]", a => GetEscapedText(a.Value));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -9,59 +9,40 @@ using Serilog.Events;
|
|||||||
|
|
||||||
namespace PepperDash.Core.Config
|
namespace PepperDash.Core.Config
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reads a Portal formatted config file
|
/// Reads a Portal formatted config file
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class PortalConfigReader
|
public class PortalConfigReader
|
||||||
{
|
{
|
||||||
const string template = "template";
|
/// <summary>
|
||||||
const string system = "system";
|
/// Reads the config file, checks if it needs a merge, merges and saves, then returns the merged Object.
|
||||||
const string systemUrl = "system_url";
|
/// </summary>
|
||||||
const string templateUrl = "template_url";
|
/// <returns>JObject of config file</returns>
|
||||||
const string info = "info";
|
public static void ReadAndMergeFileIfNecessary(string filePath, string savePath)
|
||||||
const string devices = "devices";
|
|
||||||
const string rooms = "rooms";
|
|
||||||
const string sourceLists = "sourceLists";
|
|
||||||
const string destinationLists = "destinationLists";
|
|
||||||
const string cameraLists = "cameraLists";
|
|
||||||
const string audioControlPointLists = "audioControlPointLists";
|
|
||||||
|
|
||||||
const string tieLines = "tieLines";
|
|
||||||
const string joinMaps = "joinMaps";
|
|
||||||
const string global = "global";
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Reads the config file, checks if it needs a merge, merges and saves, then returns the merged Object.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>JObject of config file</returns>
|
|
||||||
public static void ReadAndMergeFileIfNecessary(string filePath, string savePath)
|
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (!File.Exists(filePath))
|
if (!File.Exists(filePath))
|
||||||
{
|
{
|
||||||
Debug.LogError(
|
Debug.Console(1, Debug.ErrorLogLevel.Error,
|
||||||
"ERROR: Configuration file not present. Please load file to {0} and reset program", filePath);
|
"ERROR: Configuration file not present. Please load file to {0} and reset program", filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
using (StreamReader fs = new StreamReader(filePath))
|
using (StreamReader fs = new StreamReader(filePath))
|
||||||
{
|
{
|
||||||
var jsonObj = JObject.Parse(fs.ReadToEnd());
|
var jsonObj = JObject.Parse(fs.ReadToEnd());
|
||||||
if(jsonObj[template] != null && jsonObj[system] != null)
|
if(jsonObj["template"] != null && jsonObj["system"] != null)
|
||||||
{
|
{
|
||||||
// it's a double-config, merge it.
|
// it's a double-config, merge it.
|
||||||
var merged = MergeConfigs(jsonObj);
|
var merged = MergeConfigs(jsonObj);
|
||||||
if (jsonObj[systemUrl] != null)
|
if (jsonObj["system_url"] != null)
|
||||||
{
|
{
|
||||||
merged[systemUrl] = jsonObj[systemUrl].Value<string>();
|
merged["systemUrl"] = jsonObj["system_url"].Value<string>();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (jsonObj[templateUrl] != null)
|
if (jsonObj["template_url"] != null)
|
||||||
{
|
{
|
||||||
merged[templateUrl] = jsonObj[templateUrl].Value<string>();
|
merged["templateUrl"] = jsonObj["template_url"].Value<string>();
|
||||||
}
|
}
|
||||||
|
|
||||||
jsonObj = merged;
|
jsonObj = merged;
|
||||||
@@ -86,9 +67,6 @@ namespace PepperDash.Core.Config
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="doubleConfig"></param>
|
/// <param name="doubleConfig"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <summary>
|
|
||||||
/// MergeConfigs method
|
|
||||||
/// </summary>
|
|
||||||
public static JObject MergeConfigs(JObject doubleConfig)
|
public static JObject MergeConfigs(JObject doubleConfig)
|
||||||
{
|
{
|
||||||
var system = JObject.FromObject(doubleConfig["system"]);
|
var system = JObject.FromObject(doubleConfig["system"]);
|
||||||
@@ -96,62 +74,62 @@ namespace PepperDash.Core.Config
|
|||||||
var merged = new JObject();
|
var merged = new JObject();
|
||||||
|
|
||||||
// Put together top-level objects
|
// Put together top-level objects
|
||||||
if (system[info] != null)
|
if (system["info"] != null)
|
||||||
merged.Add(info, Merge(template[info], system[info], info));
|
merged.Add("info", Merge(template["info"], system["info"], "infO"));
|
||||||
else
|
else
|
||||||
merged.Add(info, template[info]);
|
merged.Add("info", template["info"]);
|
||||||
|
|
||||||
merged.Add(devices, MergeArraysOnTopLevelProperty(template[devices] as JArray,
|
merged.Add("devices", MergeArraysOnTopLevelProperty(template["devices"] as JArray,
|
||||||
system[devices] as JArray, "key", devices));
|
system["devices"] as JArray, "key", "devices"));
|
||||||
|
|
||||||
if (system[rooms] == null)
|
if (system["rooms"] == null)
|
||||||
merged.Add(rooms, template[rooms]);
|
merged.Add("rooms", template["rooms"]);
|
||||||
else
|
else
|
||||||
merged.Add(rooms, MergeArraysOnTopLevelProperty(template[rooms] as JArray,
|
merged.Add("rooms", MergeArraysOnTopLevelProperty(template["rooms"] as JArray,
|
||||||
system[rooms] as JArray, "key", rooms));
|
system["rooms"] as JArray, "key", "rooms"));
|
||||||
|
|
||||||
if (system[sourceLists] == null)
|
if (system["sourceLists"] == null)
|
||||||
merged.Add(sourceLists, template[sourceLists]);
|
merged.Add("sourceLists", template["sourceLists"]);
|
||||||
else
|
else
|
||||||
merged.Add(sourceLists, Merge(template[sourceLists], system[sourceLists], sourceLists));
|
merged.Add("sourceLists", Merge(template["sourceLists"], system["sourceLists"], "sourceLists"));
|
||||||
|
|
||||||
if (system[destinationLists] == null)
|
if (system["destinationLists"] == null)
|
||||||
merged.Add(destinationLists, template[destinationLists]);
|
merged.Add("destinationLists", template["destinationLists"]);
|
||||||
else
|
else
|
||||||
merged.Add(destinationLists,
|
merged.Add("destinationLists",
|
||||||
Merge(template[destinationLists], system[destinationLists], destinationLists));
|
Merge(template["destinationLists"], system["destinationLists"], "destinationLists"));
|
||||||
|
|
||||||
|
|
||||||
if (system[cameraLists] == null)
|
if (system["cameraLists"] == null)
|
||||||
merged.Add(cameraLists, template[cameraLists]);
|
merged.Add("cameraLists", template["cameraLists"]);
|
||||||
else
|
else
|
||||||
merged.Add(cameraLists, Merge(template[cameraLists], system[cameraLists], cameraLists));
|
merged.Add("cameraLists", Merge(template["cameraLists"], system["cameraLists"], "cameraLists"));
|
||||||
|
|
||||||
if (system[audioControlPointLists] == null)
|
if (system["audioControlPointLists"] == null)
|
||||||
merged.Add(audioControlPointLists, template[audioControlPointLists]);
|
merged.Add("audioControlPointLists", template["audioControlPointLists"]);
|
||||||
else
|
else
|
||||||
merged.Add(audioControlPointLists,
|
merged.Add("audioControlPointLists",
|
||||||
Merge(template[audioControlPointLists], system[audioControlPointLists], audioControlPointLists));
|
Merge(template["audioControlPointLists"], system["audioControlPointLists"], "audioControlPointLists"));
|
||||||
|
|
||||||
|
|
||||||
// Template tie lines take precedence. Config tool doesn't do them at system
|
// Template tie lines take precedence. Config tool doesn't do them at system
|
||||||
// level anyway...
|
// level anyway...
|
||||||
if (template[tieLines] != null)
|
if (template["tieLines"] != null)
|
||||||
merged.Add(tieLines, template[tieLines]);
|
merged.Add("tieLines", template["tieLines"]);
|
||||||
else if (system[tieLines] != null)
|
else if (system["tieLines"] != null)
|
||||||
merged.Add(tieLines, system[tieLines]);
|
merged.Add("tieLines", system["tieLines"]);
|
||||||
else
|
else
|
||||||
merged.Add(tieLines, new JArray());
|
merged.Add("tieLines", new JArray());
|
||||||
|
|
||||||
if (template[joinMaps] != null)
|
if (template["joinMaps"] != null)
|
||||||
merged.Add(joinMaps, template[joinMaps]);
|
merged.Add("joinMaps", template["joinMaps"]);
|
||||||
else
|
else
|
||||||
merged.Add(joinMaps, new JObject());
|
merged.Add("joinMaps", new JObject());
|
||||||
|
|
||||||
if (system[global] != null)
|
if (system["global"] != null)
|
||||||
merged.Add(global, Merge(template[global], system[global], global));
|
merged.Add("global", Merge(template["global"], system["global"], "global"));
|
||||||
else
|
else
|
||||||
merged.Add(global, template[global]);
|
merged.Add("global", template["global"]);
|
||||||
|
|
||||||
//Debug.Console(2, "MERGED CONFIG RESULT: \x0d\x0a{0}", merged);
|
//Debug.Console(2, "MERGED CONFIG RESULT: \x0d\x0a{0}", merged);
|
||||||
return merged;
|
return merged;
|
||||||
@@ -247,7 +225,7 @@ namespace PepperDash.Core.Config
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Debug.LogError($"Cannot merge items at path {propPath}: \r{e}");
|
Debug.Console(1, Debug.ErrorLogLevel.Warning, "Cannot merge items at path {0}: \r{1}", propPath, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,22 +6,13 @@ using Crestron.SimplSharp;
|
|||||||
|
|
||||||
namespace PepperDash.Core
|
namespace PepperDash.Core
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Represents a EncodingHelper
|
|
||||||
/// </summary>
|
|
||||||
public class EncodingHelper
|
public class EncodingHelper
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// ConvertUtf8ToAscii method
|
|
||||||
/// </summary>
|
|
||||||
public static string ConvertUtf8ToAscii(string utf8String)
|
public static string ConvertUtf8ToAscii(string utf8String)
|
||||||
{
|
{
|
||||||
return Encoding.ASCII.GetString(Encoding.UTF8.GetBytes(utf8String), 0, utf8String.Length);
|
return Encoding.ASCII.GetString(Encoding.UTF8.GetBytes(utf8String), 0, utf8String.Length);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// ConvertUtf8ToUtf16 method
|
|
||||||
/// </summary>
|
|
||||||
public static string ConvertUtf8ToUtf16(string utf8String)
|
public static string ConvertUtf8ToUtf16(string utf8String)
|
||||||
{
|
{
|
||||||
return Encoding.Unicode.GetString(Encoding.UTF8.GetBytes(utf8String), 0, utf8String.Length);
|
return Encoding.Unicode.GetString(Encoding.UTF8.GetBytes(utf8String), 0, utf8String.Length);
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ using Serilog.Events;
|
|||||||
namespace PepperDash.Core
|
namespace PepperDash.Core
|
||||||
{
|
{
|
||||||
//*********************************************************************************************************
|
//*********************************************************************************************************
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a Device
|
/// The core event and status-bearing class that most if not all device and connectors can derive from.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class Device : IKeyName
|
public class Device : IKeyName
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -15,23 +15,23 @@ namespace PepperDash.Core
|
|||||||
/// Unique Key
|
/// Unique Key
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Key { get; protected set; }
|
public string Key { get; protected set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Name
|
/// Name of the devie
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Name { get; protected set; }
|
public string Name { get; protected set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool Enabled { get; protected set; }
|
public bool Enabled { get; protected set; }
|
||||||
|
|
||||||
/// <summary>
|
///// <summary>
|
||||||
/// A place to store reference to the original config object, if any. These values should
|
///// 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.
|
///// NOT be used as properties on the device as they are all publicly-settable values.
|
||||||
/// </summary>
|
///// </summary>
|
||||||
//public DeviceConfig Config { get; private set; }
|
//public DeviceConfig Config { get; private set; }
|
||||||
/// <summary>
|
///// <summary>
|
||||||
/// Helper method to check if Config exists
|
///// Helper method to check if Config exists
|
||||||
/// </summary>
|
///// </summary>
|
||||||
//public bool HasConfig { get { return Config != null; } }
|
//public bool HasConfig { get { return Config != null; } }
|
||||||
|
|
||||||
List<Action> _PreActivationActions;
|
List<Action> _PreActivationActions;
|
||||||
@@ -86,9 +86,6 @@ namespace PepperDash.Core
|
|||||||
/// Adds a post activation action
|
/// Adds a post activation action
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="act"></param>
|
/// <param name="act"></param>
|
||||||
/// <summary>
|
|
||||||
/// AddPostActivationAction method
|
|
||||||
/// </summary>
|
|
||||||
public void AddPostActivationAction(Action act)
|
public void AddPostActivationAction(Action act)
|
||||||
{
|
{
|
||||||
if (_PostActivationActions == null)
|
if (_PostActivationActions == null)
|
||||||
@@ -96,9 +93,9 @@ namespace PepperDash.Core
|
|||||||
_PostActivationActions.Add(act);
|
_PostActivationActions.Add(act);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// PreActivate method
|
/// Executes the preactivation actions
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void PreActivate()
|
public void PreActivate()
|
||||||
{
|
{
|
||||||
if (_PreActivationActions != null)
|
if (_PreActivationActions != null)
|
||||||
@@ -115,9 +112,11 @@ namespace PepperDash.Core
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Activate method
|
/// Gets this device ready to be used in the system. Runs any added pre-activation items, and
|
||||||
/// </summary>
|
/// all post-activation at end. Classes needing additional logic to
|
||||||
|
/// run should override CustomActivate()
|
||||||
|
/// </summary>
|
||||||
public bool Activate()
|
public bool Activate()
|
||||||
{
|
{
|
||||||
//if (_PreActivationActions != null)
|
//if (_PreActivationActions != null)
|
||||||
@@ -128,9 +127,9 @@ namespace PepperDash.Core
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// PostActivate method
|
/// Executes the postactivation actions
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void PostActivate()
|
public void PostActivate()
|
||||||
{
|
{
|
||||||
if (_PostActivationActions != null)
|
if (_PostActivationActions != null)
|
||||||
@@ -153,9 +152,6 @@ namespace PepperDash.Core
|
|||||||
/// do not need to call base.CustomActivate()
|
/// do not need to call base.CustomActivate()
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>true if device activated successfully.</returns>
|
/// <returns>true if device activated successfully.</returns>
|
||||||
/// <summary>
|
|
||||||
/// CustomActivate method
|
|
||||||
/// </summary>
|
|
||||||
public virtual bool CustomActivate() { return true; }
|
public virtual bool CustomActivate() { return true; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -182,15 +178,12 @@ namespace PepperDash.Core
|
|||||||
if (o is bool && !(bool)o) a();
|
if (o is bool && !(bool)o) a();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a string representation of the object, including its key and name.
|
/// Returns a string representation of the object, including its key and name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>The returned string is formatted as "{Key} - {Name}". If the <c>Name</c> property is
|
/// <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>
|
/// 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>
|
/// <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()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return string.Format("{0} - {1}", Key, string.IsNullOrEmpty(Name) ? "---" : Name);
|
return string.Format("{0} - {1}", Key, string.IsNullOrEmpty(Name) ? "---" : Name);
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ using Serilog.Events;
|
|||||||
|
|
||||||
namespace PepperDash.Core
|
namespace PepperDash.Core
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a EthernetHelper
|
/// Class to help with accessing values from the CrestronEthernetHelper class
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class EthernetHelper
|
public class EthernetHelper
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -24,9 +24,9 @@ namespace PepperDash.Core
|
|||||||
|
|
||||||
// ADD OTHER HELPERS HERE
|
// ADD OTHER HELPERS HERE
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the PortNumber
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int PortNumber { get; private set; }
|
public int PortNumber { get; private set; }
|
||||||
|
|
||||||
private EthernetHelper(int portNumber)
|
private EthernetHelper(int portNumber)
|
||||||
|
|||||||
@@ -16,19 +16,19 @@ namespace PepperDash.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool State { get; set; }
|
public bool State { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the IntValue
|
/// Boolean ushort value property
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ushort IntValue { get { return (ushort)(State ? 1 : 0); } }
|
public ushort IntValue { get { return (ushort)(State ? 1 : 0); } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Type
|
/// Boolean change event args type
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ushort Type { get; set; }
|
public ushort Type { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Index
|
/// Boolean change event args index
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ushort Index { get; set; }
|
public ushort Index { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -64,9 +64,9 @@ namespace PepperDash.Core
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a UshrtChangeEventArgs
|
/// Ushort change event args
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class UshrtChangeEventArgs : EventArgs
|
public class UshrtChangeEventArgs : EventArgs
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -74,14 +74,14 @@ namespace PepperDash.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public ushort IntValue { get; set; }
|
public ushort IntValue { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Type
|
/// Ushort change event args type
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ushort Type { get; set; }
|
public ushort Type { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Index
|
/// Ushort change event args index
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ushort Index { get; set; }
|
public ushort Index { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -117,9 +117,9 @@ namespace PepperDash.Core
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a StringChangeEventArgs
|
/// String change event args
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class StringChangeEventArgs : EventArgs
|
public class StringChangeEventArgs : EventArgs
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -127,14 +127,14 @@ namespace PepperDash.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string StringValue { get; set; }
|
public string StringValue { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Type
|
/// String change event args type
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ushort Type { get; set; }
|
public ushort Type { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Index
|
/// string change event args index
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ushort Index { get; set; }
|
public ushort Index { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -32,14 +32,14 @@ namespace PepperDash.Core.JsonStandardObjects
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public DeviceConfig Device { get; set; }
|
public DeviceConfig Device { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Type
|
/// Device change event args type
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ushort Type { get; set; }
|
public ushort Type { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Index
|
/// Device change event args index
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ushort Index { get; set; }
|
public ushort Index { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -58,9 +58,6 @@ namespace PepperDash.Core.JsonStandardObjects
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="uniqueID"></param>
|
/// <param name="uniqueID"></param>
|
||||||
/// <param name="deviceKey"></param>
|
/// <param name="deviceKey"></param>
|
||||||
/// <summary>
|
|
||||||
/// Initialize method
|
|
||||||
/// </summary>
|
|
||||||
public void Initialize(string uniqueID, string deviceKey)
|
public void Initialize(string uniqueID, string deviceKey)
|
||||||
{
|
{
|
||||||
// S+ set EvaluateFb low
|
// S+ set EvaluateFb low
|
||||||
|
|||||||
@@ -47,14 +47,14 @@ namespace PepperDash.Core.JsonStandardObjects
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a ComParamsConfig
|
/// Device communication parameter class
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class ComParamsConfig
|
public class ComParamsConfig
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the baudRate
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int baudRate { get; set; }
|
public int baudRate { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
@@ -86,13 +86,13 @@ namespace PepperDash.Core.JsonStandardObjects
|
|||||||
public int pacing { get; set; }
|
public int pacing { get; set; }
|
||||||
|
|
||||||
// convert properties for simpl
|
// convert properties for simpl
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the simplBaudRate
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ushort simplBaudRate { get { return Convert.ToUInt16(baudRate); } }
|
public ushort simplBaudRate { get { return Convert.ToUInt16(baudRate); } }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the simplDataBits
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ushort simplDataBits { get { return Convert.ToUInt16(dataBits); } }
|
public ushort simplDataBits { get { return Convert.ToUInt16(dataBits); } }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
@@ -143,13 +143,13 @@ namespace PepperDash.Core.JsonStandardObjects
|
|||||||
public int autoReconnectIntervalMs { get; set; }
|
public int autoReconnectIntervalMs { get; set; }
|
||||||
|
|
||||||
// convert properties for simpl
|
// convert properties for simpl
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the simplPort
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ushort simplPort { get { return Convert.ToUInt16(port); } }
|
public ushort simplPort { get { return Convert.ToUInt16(port); } }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the simplAutoReconnect
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ushort simplAutoReconnect { get { return (ushort)(autoReconnect ? 1 : 0); } }
|
public ushort simplAutoReconnect { get { return (ushort)(autoReconnect ? 1 : 0); } }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
@@ -192,9 +192,9 @@ namespace PepperDash.Core.JsonStandardObjects
|
|||||||
public TcpSshPropertiesConfig tcpSshProperties { get; set; }
|
public TcpSshPropertiesConfig tcpSshProperties { get; set; }
|
||||||
|
|
||||||
// convert properties for simpl
|
// convert properties for simpl
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the simplControlPortNumber
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ushort simplControlPortNumber { get { return Convert.ToUInt16(controlPortNumber); } }
|
public ushort simplControlPortNumber { get { return Convert.ToUInt16(controlPortNumber); } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -207,9 +207,9 @@ namespace PepperDash.Core.JsonStandardObjects
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a PropertiesConfig
|
/// Device properties class
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class PropertiesConfig
|
public class PropertiesConfig
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -226,13 +226,13 @@ namespace PepperDash.Core.JsonStandardObjects
|
|||||||
public ControlConfig control { get; set; }
|
public ControlConfig control { get; set; }
|
||||||
|
|
||||||
// convert properties for simpl
|
// convert properties for simpl
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the simplDeviceId
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ushort simplDeviceId { get { return Convert.ToUInt16(deviceId); } }
|
public ushort simplDeviceId { get { return Convert.ToUInt16(deviceId); } }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the simplEnabled
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ushort simplEnabled { get { return (ushort)(enabled ? 1 : 0); } }
|
public ushort simplEnabled { get { return (ushort)(enabled ? 1 : 0); } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -88,9 +88,9 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class SPlusValueWrapper
|
public class SPlusValueWrapper
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the ValueType
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public SPlusType ValueType { get; private set; }
|
public SPlusType ValueType { get; private set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
@@ -122,9 +122,9 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Enumeration of SPlusType values
|
/// S+ types enum
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public enum SPlusType
|
public enum SPlusType
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -23,9 +23,6 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="master">New master to add</param>
|
/// <param name="master">New master to add</param>
|
||||||
///
|
///
|
||||||
/// <summary>
|
|
||||||
/// AddMaster method
|
|
||||||
/// </summary>
|
|
||||||
public static void AddMaster(JsonToSimplMaster master)
|
public static void AddMaster(JsonToSimplMaster master)
|
||||||
{
|
{
|
||||||
if (master == null)
|
if (master == null)
|
||||||
@@ -52,9 +49,9 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// GetMasterByFile method
|
/// Gets a master by its key. Case-insensitive
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static JsonToSimplMaster GetMasterByFile(string file)
|
public static JsonToSimplMaster GetMasterByFile(string file)
|
||||||
{
|
{
|
||||||
return Masters.FirstOrDefault(m => m.UniqueID.Equals(file, StringComparison.OrdinalIgnoreCase));
|
return Masters.FirstOrDefault(m => m.UniqueID.Equals(file, StringComparison.OrdinalIgnoreCase));
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ using Serilog.Events;
|
|||||||
|
|
||||||
namespace PepperDash.Core.JsonToSimpl
|
namespace PepperDash.Core.JsonToSimpl
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a JsonToSimplArrayLookupChild
|
/// Used to interact with an array of values with the S+ modules
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class JsonToSimplArrayLookupChild : JsonToSimplChildObjectBase
|
public class JsonToSimplArrayLookupChild : JsonToSimplChildObjectBase
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -76,10 +76,9 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
PathSuffix == null ? "" : PathSuffix);
|
PathSuffix == null ? "" : PathSuffix);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ProcessAll method
|
/// Process all values
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <inheritdoc />
|
|
||||||
public override void ProcessAll()
|
public override void ProcessAll()
|
||||||
{
|
{
|
||||||
if (FindInArray())
|
if (FindInArray())
|
||||||
|
|||||||
@@ -28,14 +28,14 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public SPlusValuesDelegate GetAllValuesDelegate { get; set; }
|
public SPlusValuesDelegate GetAllValuesDelegate { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the SetAllPathsDelegate
|
/// Use a callback to reduce task switch/threading
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public SPlusValuesDelegate SetAllPathsDelegate { get; set; }
|
public SPlusValuesDelegate SetAllPathsDelegate { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Key
|
/// Unique identifier for instance
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Key { get; protected set; }
|
public string Key { get; protected set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -49,9 +49,9 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string PathSuffix { get; protected set; }
|
public string PathSuffix { get; protected set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the LinkedToObject
|
/// Indicates if the instance is linked to an object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool LinkedToObject { get; protected set; }
|
public bool LinkedToObject { get; protected set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -96,9 +96,6 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
/// Sets the path prefix for the object
|
/// Sets the path prefix for the object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="pathPrefix"></param>
|
/// <param name="pathPrefix"></param>
|
||||||
/// <summary>
|
|
||||||
/// SetPathPrefix method
|
|
||||||
/// </summary>
|
|
||||||
public void SetPathPrefix(string pathPrefix)
|
public void SetPathPrefix(string pathPrefix)
|
||||||
{
|
{
|
||||||
PathPrefix = pathPrefix;
|
PathPrefix = pathPrefix;
|
||||||
@@ -113,9 +110,9 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
BoolPaths[index] = path;
|
BoolPaths[index] = path;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// SetUshortPath method
|
/// Set the JPath for a ushort out index.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SetUshortPath(ushort index, string path)
|
public void SetUshortPath(ushort index, string path)
|
||||||
{
|
{
|
||||||
Debug.Console(1, "JSON Child[{0}] SetUshortPath {1}={2}", Key, index, path);
|
Debug.Console(1, "JSON Child[{0}] SetUshortPath {1}={2}", Key, index, path);
|
||||||
@@ -123,9 +120,9 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
UshortPaths[index] = path;
|
UshortPaths[index] = path;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// SetStringPath method
|
/// Set the JPath for a string output index.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SetStringPath(ushort index, string path)
|
public void SetStringPath(ushort index, string path)
|
||||||
{
|
{
|
||||||
Debug.Console(1, "JSON Child[{0}] SetStringPath {1}={2}", Key, index, path);
|
Debug.Console(1, "JSON Child[{0}] SetStringPath {1}={2}", Key, index, path);
|
||||||
@@ -133,10 +130,10 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
StringPaths[index] = path;
|
StringPaths[index] = path;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ProcessAll method
|
/// Evalutates all outputs with defined paths. called by S+ when paths are ready to process
|
||||||
/// </summary>
|
/// and by Master when file is read.
|
||||||
/// <inheritdoc />
|
/// </summary>
|
||||||
public virtual void ProcessAll()
|
public virtual void ProcessAll()
|
||||||
{
|
{
|
||||||
if (!LinkedToObject)
|
if (!LinkedToObject)
|
||||||
@@ -280,9 +277,6 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="key"></param>
|
/// <param name="key"></param>
|
||||||
/// <param name="theValue"></param>
|
/// <param name="theValue"></param>
|
||||||
/// <summary>
|
|
||||||
/// USetBoolValue method
|
|
||||||
/// </summary>
|
|
||||||
public void USetBoolValue(ushort key, ushort theValue)
|
public void USetBoolValue(ushort key, ushort theValue)
|
||||||
{
|
{
|
||||||
SetBoolValue(key, theValue == 1);
|
SetBoolValue(key, theValue == 1);
|
||||||
@@ -293,9 +287,6 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="key"></param>
|
/// <param name="key"></param>
|
||||||
/// <param name="theValue"></param>
|
/// <param name="theValue"></param>
|
||||||
/// <summary>
|
|
||||||
/// SetBoolValue method
|
|
||||||
/// </summary>
|
|
||||||
public void SetBoolValue(ushort key, bool theValue)
|
public void SetBoolValue(ushort key, bool theValue)
|
||||||
{
|
{
|
||||||
if (BoolPaths.ContainsKey(key))
|
if (BoolPaths.ContainsKey(key))
|
||||||
@@ -307,9 +298,6 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="key"></param>
|
/// <param name="key"></param>
|
||||||
/// <param name="theValue"></param>
|
/// <param name="theValue"></param>
|
||||||
/// <summary>
|
|
||||||
/// SetUShortValue method
|
|
||||||
/// </summary>
|
|
||||||
public void SetUShortValue(ushort key, ushort theValue)
|
public void SetUShortValue(ushort key, ushort theValue)
|
||||||
{
|
{
|
||||||
if (UshortPaths.ContainsKey(key))
|
if (UshortPaths.ContainsKey(key))
|
||||||
@@ -321,9 +309,6 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="key"></param>
|
/// <param name="key"></param>
|
||||||
/// <param name="theValue"></param>
|
/// <param name="theValue"></param>
|
||||||
/// <summary>
|
|
||||||
/// SetStringValue method
|
|
||||||
/// </summary>
|
|
||||||
public void SetStringValue(ushort key, string theValue)
|
public void SetStringValue(ushort key, string theValue)
|
||||||
{
|
{
|
||||||
if (StringPaths.ContainsKey(key))
|
if (StringPaths.ContainsKey(key))
|
||||||
@@ -335,9 +320,6 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="keyPath"></param>
|
/// <param name="keyPath"></param>
|
||||||
/// <param name="valueToSave"></param>
|
/// <param name="valueToSave"></param>
|
||||||
/// <summary>
|
|
||||||
/// SetValueOnMaster method
|
|
||||||
/// </summary>
|
|
||||||
public void SetValueOnMaster(string keyPath, JValue valueToSave)
|
public void SetValueOnMaster(string keyPath, JValue valueToSave)
|
||||||
{
|
{
|
||||||
var path = GetFullPath(keyPath);
|
var path = GetFullPath(keyPath);
|
||||||
|
|||||||
@@ -20,12 +20,12 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
public string Filepath { get; private set; }
|
public string Filepath { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the ActualFilePath
|
/// Filepath to the actual file that will be read (Portal or local)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ActualFilePath { get; private set; }
|
public string ActualFilePath { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Filename
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Filename { get; private set; }
|
public string Filename { get; private set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -194,9 +194,6 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
/// Sets the debug level
|
/// Sets the debug level
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="level"></param>
|
/// <param name="level"></param>
|
||||||
/// <summary>
|
|
||||||
/// setDebugLevel method
|
|
||||||
/// </summary>
|
|
||||||
public void setDebugLevel(uint level)
|
public void setDebugLevel(uint level)
|
||||||
{
|
{
|
||||||
Debug.SetDebugLevel(level);
|
Debug.SetDebugLevel(level);
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
namespace PepperDash.Core.JsonToSimpl
|
namespace PepperDash.Core.JsonToSimpl
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a JsonToSimplFixedPathObject
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class JsonToSimplFixedPathObject : JsonToSimplChildObjectBase
|
public class JsonToSimplFixedPathObject : JsonToSimplChildObjectBase
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ using Newtonsoft.Json.Linq;
|
|||||||
|
|
||||||
namespace PepperDash.Core.JsonToSimpl
|
namespace PepperDash.Core.JsonToSimpl
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a JsonToSimplGenericMaster
|
/// Generic Master
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class JsonToSimplGenericMaster : JsonToSimplMaster
|
public class JsonToSimplGenericMaster : JsonToSimplMaster
|
||||||
{
|
{
|
||||||
/*****************************************************************************************/
|
/*****************************************************************************************/
|
||||||
@@ -20,9 +20,9 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
// To prevent multiple same-file access
|
// To prevent multiple same-file access
|
||||||
static object WriteLock = new object();
|
static object WriteLock = new object();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the SaveCallback
|
/// Callback action for saving
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Action<string> SaveCallback { get; set; }
|
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
|
/// Loads JSON into JsonObject, but does not trigger evaluation by children
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="json"></param>
|
/// <param name="json"></param>
|
||||||
/// <summary>
|
|
||||||
/// SetJsonWithoutEvaluating method
|
|
||||||
/// </summary>
|
|
||||||
public void SetJsonWithoutEvaluating(string json)
|
public void SetJsonWithoutEvaluating(string json)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -75,10 +72,9 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Save method
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <inheritdoc />
|
|
||||||
public override void Save()
|
public override void Save()
|
||||||
{
|
{
|
||||||
// this code is duplicated in the other masters!!!!!!!!!!!!!
|
// this code is duplicated in the other masters!!!!!!!!!!!!!
|
||||||
|
|||||||
@@ -38,9 +38,9 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string Key { get { return UniqueID; } }
|
public string Key { get { return UniqueID; } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the UniqueID
|
/// A unique ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string UniqueID { get; protected set; }
|
public string UniqueID { get; protected set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -53,9 +53,10 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
}
|
}
|
||||||
string _DebugName = "";
|
string _DebugName = "";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the PathPrefix
|
/// This will be prepended to all paths to allow path swapping or for more organized
|
||||||
/// </summary>
|
/// sub-paths
|
||||||
|
/// </summary>
|
||||||
public string PathPrefix { get; set; }
|
public string PathPrefix { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -82,9 +83,9 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the JsonObject
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public JObject JsonObject { get; protected set; }
|
public JObject JsonObject { get; protected set; }
|
||||||
|
|
||||||
/*****************************************************************************************/
|
/*****************************************************************************************/
|
||||||
@@ -119,9 +120,6 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
/// Adds a child "module" to this master
|
/// Adds a child "module" to this master
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="child"></param>
|
/// <param name="child"></param>
|
||||||
/// <summary>
|
|
||||||
/// AddChild method
|
|
||||||
/// </summary>
|
|
||||||
public void AddChild(JsonToSimplChildObjectBase child)
|
public void AddChild(JsonToSimplChildObjectBase child)
|
||||||
{
|
{
|
||||||
if (!Children.Contains(child))
|
if (!Children.Contains(child))
|
||||||
@@ -130,9 +128,9 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// AddUnsavedValue method
|
/// Called from the child to add changed or new values for saving
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void AddUnsavedValue(string path, JValue value)
|
public void AddUnsavedValue(string path, JValue value)
|
||||||
{
|
{
|
||||||
if (UnsavedValues.ContainsKey(path))
|
if (UnsavedValues.ContainsKey(path))
|
||||||
@@ -181,9 +179,6 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="json"></param>
|
/// <param name="json"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <summary>
|
|
||||||
/// ParseArray method
|
|
||||||
/// </summary>
|
|
||||||
public static JArray ParseArray(string json)
|
public static JArray ParseArray(string json)
|
||||||
{
|
{
|
||||||
#if NET6_0
|
#if NET6_0
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
public string PortalFilepath { get; private set; }
|
public string PortalFilepath { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the ActualFilePath
|
/// File path of the actual file being read (Portal or local)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ActualFilePath { get; private set; }
|
public string ActualFilePath { get; private set; }
|
||||||
|
|
||||||
@@ -128,9 +128,6 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="level"></param>
|
/// <param name="level"></param>
|
||||||
/// <summary>
|
|
||||||
/// setDebugLevel method
|
|
||||||
/// </summary>
|
|
||||||
public void setDebugLevel(uint level)
|
public void setDebugLevel(uint level)
|
||||||
{
|
{
|
||||||
Debug.SetDebugLevel(level);
|
Debug.SetDebugLevel(level);
|
||||||
|
|||||||
@@ -9,9 +9,6 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace PepperDash.Core.Logging
|
namespace PepperDash.Core.Logging
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Represents a CrestronEnricher
|
|
||||||
/// </summary>
|
|
||||||
public class CrestronEnricher : ILogEventEnricher
|
public class CrestronEnricher : ILogEventEnricher
|
||||||
{
|
{
|
||||||
static readonly string _appName;
|
static readonly string _appName;
|
||||||
@@ -30,9 +27,6 @@ namespace PepperDash.Core.Logging
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Enrich method
|
|
||||||
/// </summary>
|
|
||||||
public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
|
public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
|
||||||
{
|
{
|
||||||
var property = propertyFactory.CreateProperty("App", _appName);
|
var property = propertyFactory.CreateProperty("App", _appName);
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -11,16 +11,10 @@ using System.Text;
|
|||||||
|
|
||||||
namespace PepperDash.Core
|
namespace PepperDash.Core
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Represents a DebugConsoleSink
|
|
||||||
/// </summary>
|
|
||||||
public class DebugConsoleSink : ILogEventSink
|
public class DebugConsoleSink : ILogEventSink
|
||||||
{
|
{
|
||||||
private readonly ITextFormatter _textFormatter;
|
private readonly ITextFormatter _textFormatter;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Emit method
|
|
||||||
/// </summary>
|
|
||||||
public void Emit(LogEvent logEvent)
|
public void Emit(LogEvent logEvent)
|
||||||
{
|
{
|
||||||
if (!Debug.IsRunningOnAppliance) return;
|
if (!Debug.IsRunningOnAppliance) return;
|
||||||
@@ -50,9 +44,6 @@ namespace PepperDash.Core
|
|||||||
|
|
||||||
public static class DebugConsoleSinkExtensions
|
public static class DebugConsoleSinkExtensions
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// DebugConsoleSink method
|
|
||||||
/// </summary>
|
|
||||||
public static LoggerConfiguration DebugConsoleSink(
|
public static LoggerConfiguration DebugConsoleSink(
|
||||||
this LoggerSinkConfiguration loggerConfiguration,
|
this LoggerSinkConfiguration loggerConfiguration,
|
||||||
ITextFormatter formatProvider = null)
|
ITextFormatter formatProvider = null)
|
||||||
|
|||||||
@@ -19,9 +19,9 @@ namespace PepperDash.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string Key { get; private set; }
|
public string Key { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
///// <summary>
|
||||||
/// The name of the file containing the current debug settings.
|
///// The name of the file containing the current debug settings.
|
||||||
/// </summary>
|
///// </summary>
|
||||||
//string FileName = string.Format(@"\nvram\debug\app{0}Debug.json", InitialParametersClass.ApplicationNumber);
|
//string FileName = string.Format(@"\nvram\debug\app{0}Debug.json", InitialParametersClass.ApplicationNumber);
|
||||||
|
|
||||||
DebugContextSaveData SaveData;
|
DebugContextSaveData SaveData;
|
||||||
@@ -38,9 +38,6 @@ namespace PepperDash.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="key"></param>
|
/// <param name="key"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <summary>
|
|
||||||
/// GetDebugContext method
|
|
||||||
/// </summary>
|
|
||||||
public static DebugContext GetDebugContext(string key)
|
public static DebugContext GetDebugContext(string key)
|
||||||
{
|
{
|
||||||
var context = Contexts.FirstOrDefault(c => c.Key.Equals(key, StringComparison.OrdinalIgnoreCase));
|
var context = Contexts.FirstOrDefault(c => c.Key.Equals(key, StringComparison.OrdinalIgnoreCase));
|
||||||
@@ -95,9 +92,6 @@ namespace PepperDash.Core
|
|||||||
/// Callback for console command
|
/// Callback for console command
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="levelString"></param>
|
/// <param name="levelString"></param>
|
||||||
/// <summary>
|
|
||||||
/// SetDebugFromConsole method
|
|
||||||
/// </summary>
|
|
||||||
public void SetDebugFromConsole(string levelString)
|
public void SetDebugFromConsole(string levelString)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -120,9 +114,6 @@ namespace PepperDash.Core
|
|||||||
/// Sets the debug level
|
/// Sets the debug level
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="level"> Valid values 0 (no debug), 1 (critical), 2 (all messages)</param>
|
/// <param name="level"> Valid values 0 (no debug), 1 (critical), 2 (all messages)</param>
|
||||||
/// <summary>
|
|
||||||
/// SetDebugLevel method
|
|
||||||
/// </summary>
|
|
||||||
public void SetDebugLevel(int level)
|
public void SetDebugLevel(int level)
|
||||||
{
|
{
|
||||||
if (level <= 2)
|
if (level <= 2)
|
||||||
@@ -150,7 +141,7 @@ namespace PepperDash.Core
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Console method
|
/// Appends a device Key to the beginning of a message
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Console(uint level, IKeyed dev, string format, params object[] items)
|
public void Console(uint level, IKeyed dev, string format, params object[] items)
|
||||||
{
|
{
|
||||||
@@ -200,9 +191,6 @@ namespace PepperDash.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="errorLogLevel"></param>
|
/// <param name="errorLogLevel"></param>
|
||||||
/// <param name="str"></param>
|
/// <param name="str"></param>
|
||||||
/// <summary>
|
|
||||||
/// LogError method
|
|
||||||
/// </summary>
|
|
||||||
public void LogError(Debug.ErrorLogLevel errorLogLevel, string str)
|
public void LogError(Debug.ErrorLogLevel errorLogLevel, string str)
|
||||||
{
|
{
|
||||||
string msg = string.Format("App {0}:{1}", InitialParametersClass.ApplicationNumber, str);
|
string msg = string.Format("App {0}:{1}", InitialParametersClass.ApplicationNumber, str);
|
||||||
|
|||||||
@@ -5,14 +5,8 @@ using Serilog.Events;
|
|||||||
|
|
||||||
namespace PepperDash.Core.Logging
|
namespace PepperDash.Core.Logging
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Represents a DebugCrestronLoggerSink
|
|
||||||
/// </summary>
|
|
||||||
public class DebugCrestronLoggerSink : ILogEventSink
|
public class DebugCrestronLoggerSink : ILogEventSink
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Emit method
|
|
||||||
/// </summary>
|
|
||||||
public void Emit(LogEvent logEvent)
|
public void Emit(LogEvent logEvent)
|
||||||
{
|
{
|
||||||
if (!Debug.IsRunningOnAppliance) return;
|
if (!Debug.IsRunningOnAppliance) return;
|
||||||
|
|||||||
@@ -11,9 +11,6 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace PepperDash.Core.Logging
|
namespace PepperDash.Core.Logging
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Represents a DebugErrorLogSink
|
|
||||||
/// </summary>
|
|
||||||
public class DebugErrorLogSink : ILogEventSink
|
public class DebugErrorLogSink : ILogEventSink
|
||||||
{
|
{
|
||||||
private ITextFormatter _formatter;
|
private ITextFormatter _formatter;
|
||||||
@@ -27,9 +24,6 @@ namespace PepperDash.Core.Logging
|
|||||||
{LogEventLevel.Error, (msg) => ErrorLog.Error(msg) },
|
{LogEventLevel.Error, (msg) => ErrorLog.Error(msg) },
|
||||||
{LogEventLevel.Fatal, (msg) => ErrorLog.Error(msg) }
|
{LogEventLevel.Fatal, (msg) => ErrorLog.Error(msg) }
|
||||||
};
|
};
|
||||||
/// <summary>
|
|
||||||
/// Emit method
|
|
||||||
/// </summary>
|
|
||||||
public void Emit(LogEvent logEvent)
|
public void Emit(LogEvent logEvent)
|
||||||
{
|
{
|
||||||
string message;
|
string message;
|
||||||
|
|||||||
@@ -1,113 +1,74 @@
|
|||||||
using System;
|
using Serilog.Events;
|
||||||
using Serilog.Events;
|
using System;
|
||||||
using Log = PepperDash.Core.Debug;
|
using Log = PepperDash.Core.Debug;
|
||||||
|
|
||||||
namespace PepperDash.Core.Logging
|
namespace PepperDash.Core.Logging
|
||||||
{
|
{
|
||||||
public static class DebugExtensions
|
public static class DebugExtensions
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// LogException method
|
|
||||||
/// </summary>
|
|
||||||
public static void LogException(this IKeyed device, Exception ex, string message, params object[] args)
|
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)
|
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)
|
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)
|
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)
|
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)
|
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)
|
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)
|
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)
|
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)
|
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)
|
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)
|
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)
|
public static void LogFatal(this IKeyed device, string message, params object[] args)
|
||||||
{
|
{
|
||||||
Log.LogFatal(device, message, args);
|
Log.LogMessage(LogEventLevel.Fatal, device, message, args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ using Newtonsoft.Json;
|
|||||||
|
|
||||||
namespace PepperDash.Core.Logging
|
namespace PepperDash.Core.Logging
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a DebugContextCollection
|
/// Class to persist current Debug settings across program restarts
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class DebugContextCollection
|
public class DebugContextCollection
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -39,9 +39,6 @@ namespace PepperDash.Core.Logging
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="contextKey"></param>
|
/// <param name="contextKey"></param>
|
||||||
/// <param name="level"></param>
|
/// <param name="level"></param>
|
||||||
/// <summary>
|
|
||||||
/// SetLevel method
|
|
||||||
/// </summary>
|
|
||||||
public void SetLevel(string contextKey, int level)
|
public void SetLevel(string contextKey, int level)
|
||||||
{
|
{
|
||||||
if (level < 0 || level > 2)
|
if (level < 0 || level > 2)
|
||||||
@@ -54,9 +51,6 @@ namespace PepperDash.Core.Logging
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="contextKey"></param>
|
/// <param name="contextKey"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <summary>
|
|
||||||
/// GetOrCreateItem method
|
|
||||||
/// </summary>
|
|
||||||
public DebugContextItem GetOrCreateItem(string contextKey)
|
public DebugContextItem GetOrCreateItem(string contextKey)
|
||||||
{
|
{
|
||||||
if (!_items.ContainsKey(contextKey))
|
if (!_items.ContainsKey(contextKey))
|
||||||
@@ -71,9 +65,6 @@ namespace PepperDash.Core.Logging
|
|||||||
/// <param name="deviceKey"></param>
|
/// <param name="deviceKey"></param>
|
||||||
/// <param name="settings"></param>
|
/// <param name="settings"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <summary>
|
|
||||||
/// SetDebugSettingsForKey method
|
|
||||||
/// </summary>
|
|
||||||
public void SetDebugSettingsForKey(string deviceKey, object settings)
|
public void SetDebugSettingsForKey(string deviceKey, object settings)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -98,9 +89,6 @@ namespace PepperDash.Core.Logging
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="deviceKey"></param>
|
/// <param name="deviceKey"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <summary>
|
|
||||||
/// GetDebugSettingsForKey method
|
|
||||||
/// </summary>
|
|
||||||
public object GetDebugSettingsForKey(string deviceKey)
|
public object GetDebugSettingsForKey(string deviceKey)
|
||||||
{
|
{
|
||||||
return DeviceDebugSettings[deviceKey];
|
return DeviceDebugSettings[deviceKey];
|
||||||
|
|||||||
@@ -21,9 +21,6 @@ using Serilog.Formatting.Json;
|
|||||||
|
|
||||||
namespace PepperDash.Core
|
namespace PepperDash.Core
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Represents a DebugWebsocketSink
|
|
||||||
/// </summary>
|
|
||||||
public class DebugWebsocketSink : ILogEventSink
|
public class DebugWebsocketSink : ILogEventSink
|
||||||
{
|
{
|
||||||
private HttpServer _httpsServer;
|
private HttpServer _httpsServer;
|
||||||
@@ -50,9 +47,6 @@ namespace PepperDash.Core
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the IsRunning
|
|
||||||
/// </summary>
|
|
||||||
public bool IsRunning { get => _httpsServer?.IsListening ?? false; }
|
public bool IsRunning { get => _httpsServer?.IsListening ?? false; }
|
||||||
|
|
||||||
|
|
||||||
@@ -111,9 +105,6 @@ namespace PepperDash.Core
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Emit method
|
|
||||||
/// </summary>
|
|
||||||
public void Emit(LogEvent logEvent)
|
public void Emit(LogEvent logEvent)
|
||||||
{
|
{
|
||||||
if (_httpsServer == null || !_httpsServer.IsListening) return;
|
if (_httpsServer == null || !_httpsServer.IsListening) return;
|
||||||
@@ -125,9 +116,6 @@ namespace PepperDash.Core
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// StartServerAndSetPort method
|
|
||||||
/// </summary>
|
|
||||||
public void StartServerAndSetPort(int port)
|
public void StartServerAndSetPort(int port)
|
||||||
{
|
{
|
||||||
Debug.Console(0, "Starting Websocket Server on port: {0}", port);
|
Debug.Console(0, "Starting Websocket Server on port: {0}", port);
|
||||||
@@ -205,9 +193,6 @@ namespace PepperDash.Core
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// StopServer method
|
|
||||||
/// </summary>
|
|
||||||
public void StopServer()
|
public void StopServer()
|
||||||
{
|
{
|
||||||
Debug.Console(0, "Stopping Websocket Server");
|
Debug.Console(0, "Stopping Websocket Server");
|
||||||
@@ -219,9 +204,6 @@ namespace PepperDash.Core
|
|||||||
|
|
||||||
public static class DebugWebsocketSinkExtensions
|
public static class DebugWebsocketSinkExtensions
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// DebugWebsocketSink method
|
|
||||||
/// </summary>
|
|
||||||
public static LoggerConfiguration DebugWebsocketSink(
|
public static LoggerConfiguration DebugWebsocketSink(
|
||||||
this LoggerSinkConfiguration loggerConfiguration,
|
this LoggerSinkConfiguration loggerConfiguration,
|
||||||
ITextFormatter formatProvider = null)
|
ITextFormatter formatProvider = null)
|
||||||
@@ -230,9 +212,6 @@ namespace PepperDash.Core
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Represents a DebugClient
|
|
||||||
/// </summary>
|
|
||||||
public class DebugClient : WebSocketBehavior
|
public class DebugClient : WebSocketBehavior
|
||||||
{
|
{
|
||||||
private DateTime _connectionTime;
|
private DateTime _connectionTime;
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
namespace PepperDash.Core.PasswordManagement
|
namespace PepperDash.Core.PasswordManagement
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a PasswordClient
|
/// A class to allow user interaction with the PasswordManager
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class PasswordClient
|
public class PasswordClient
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -59,9 +59,6 @@ namespace PepperDash.Core.PasswordManagement
|
|||||||
/// Retrieve password by index
|
/// Retrieve password by index
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="key"></param>
|
/// <param name="key"></param>
|
||||||
/// <summary>
|
|
||||||
/// GetPasswordByIndex method
|
|
||||||
/// </summary>
|
|
||||||
public void GetPasswordByIndex(ushort key)
|
public void GetPasswordByIndex(ushort key)
|
||||||
{
|
{
|
||||||
OnUshrtChange((ushort)PasswordManager.Passwords.Count, 0, PasswordManagementConstants.PasswordManagerCountChange);
|
OnUshrtChange((ushort)PasswordManager.Passwords.Count, 0, PasswordManagementConstants.PasswordManagerCountChange);
|
||||||
@@ -84,9 +81,6 @@ namespace PepperDash.Core.PasswordManagement
|
|||||||
/// Password validation method
|
/// Password validation method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="password"></param>
|
/// <param name="password"></param>
|
||||||
/// <summary>
|
|
||||||
/// ValidatePassword method
|
|
||||||
/// </summary>
|
|
||||||
public void ValidatePassword(string password)
|
public void ValidatePassword(string password)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(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
|
/// password against the selected password when the length of the 2 are equal
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="data"></param>
|
/// <param name="data"></param>
|
||||||
/// <summary>
|
|
||||||
/// BuildPassword method
|
|
||||||
/// </summary>
|
|
||||||
public void BuildPassword(string data)
|
public void BuildPassword(string data)
|
||||||
{
|
{
|
||||||
PasswordToValidate = String.Concat(PasswordToValidate, data);
|
PasswordToValidate = String.Concat(PasswordToValidate, data);
|
||||||
@@ -117,9 +108,9 @@ namespace PepperDash.Core.PasswordManagement
|
|||||||
ValidatePassword(PasswordToValidate);
|
ValidatePassword(PasswordToValidate);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ClearPassword method
|
/// Clears the user entered password and resets the LEDs
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void ClearPassword()
|
public void ClearPassword()
|
||||||
{
|
{
|
||||||
PasswordToValidate = "";
|
PasswordToValidate = "";
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ using Crestron.SimplSharp;
|
|||||||
|
|
||||||
namespace PepperDash.Core.PasswordManagement
|
namespace PepperDash.Core.PasswordManagement
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a PasswordManager
|
/// Allows passwords to be stored and managed
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class PasswordManager
|
public class PasswordManager
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -71,9 +71,6 @@ namespace PepperDash.Core.PasswordManagement
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="key"></param>
|
/// <param name="key"></param>
|
||||||
/// <param name="password"></param>
|
/// <param name="password"></param>
|
||||||
/// <summary>
|
|
||||||
/// UpdatePassword method
|
|
||||||
/// </summary>
|
|
||||||
public void UpdatePassword(ushort key, string password)
|
public void UpdatePassword(ushort key, string password)
|
||||||
{
|
{
|
||||||
// validate the parameters
|
// validate the parameters
|
||||||
@@ -155,9 +152,6 @@ namespace PepperDash.Core.PasswordManagement
|
|||||||
/// Method to change the default timer value, (default 5000ms/5s)
|
/// Method to change the default timer value, (default 5000ms/5s)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="time"></param>
|
/// <param name="time"></param>
|
||||||
/// <summary>
|
|
||||||
/// PasswordTimerMs method
|
|
||||||
/// </summary>
|
|
||||||
public void PasswordTimerMs(ushort time)
|
public void PasswordTimerMs(ushort time)
|
||||||
{
|
{
|
||||||
PasswordTimerElapsedMs = Convert.ToInt64(time);
|
PasswordTimerElapsedMs = Convert.ToInt64(time);
|
||||||
|
|||||||
@@ -68,9 +68,9 @@ namespace PepperDash.Core.SystemInfo
|
|||||||
public const ushort ProgramConfigChange = 305;
|
public const ushort ProgramConfigChange = 305;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a ProcessorChangeEventArgs
|
/// Processor Change Event Args Class
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class ProcessorChangeEventArgs : EventArgs
|
public class ProcessorChangeEventArgs : EventArgs
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -114,9 +114,9 @@ namespace PepperDash.Core.SystemInfo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a EthernetChangeEventArgs
|
/// Ethernet Change Event Args Class
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class EthernetChangeEventArgs : EventArgs
|
public class EthernetChangeEventArgs : EventArgs
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -165,9 +165,9 @@ namespace PepperDash.Core.SystemInfo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a ControlSubnetChangeEventArgs
|
/// Control Subnet Chage Event Args Class
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class ControlSubnetChangeEventArgs : EventArgs
|
public class ControlSubnetChangeEventArgs : EventArgs
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -211,9 +211,9 @@ namespace PepperDash.Core.SystemInfo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a ProgramChangeEventArgs
|
/// Program Change Event Args Class
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class ProgramChangeEventArgs : EventArgs
|
public class ProgramChangeEventArgs : EventArgs
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -100,9 +100,9 @@ namespace PepperDash.Core.SystemInfo
|
|||||||
OnBoolChange(false, 0, SystemInfoConstants.BusyBoolChange);
|
OnBoolChange(false, 0, SystemInfoConstants.BusyBoolChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// GetEthernetInfo method
|
/// Gets the current ethernet info
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void GetEthernetInfo()
|
public void GetEthernetInfo()
|
||||||
{
|
{
|
||||||
OnBoolChange(true, 0, SystemInfoConstants.BusyBoolChange);
|
OnBoolChange(true, 0, SystemInfoConstants.BusyBoolChange);
|
||||||
@@ -161,9 +161,9 @@ namespace PepperDash.Core.SystemInfo
|
|||||||
OnBoolChange(false, 0, SystemInfoConstants.BusyBoolChange);
|
OnBoolChange(false, 0, SystemInfoConstants.BusyBoolChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// GetControlSubnetInfo method
|
/// Gets the current control subnet info
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void GetControlSubnetInfo()
|
public void GetControlSubnetInfo()
|
||||||
{
|
{
|
||||||
OnBoolChange(true, 0, SystemInfoConstants.BusyBoolChange);
|
OnBoolChange(true, 0, SystemInfoConstants.BusyBoolChange);
|
||||||
@@ -206,9 +206,6 @@ namespace PepperDash.Core.SystemInfo
|
|||||||
/// Gets the program info by index
|
/// Gets the program info by index
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="index"></param>
|
/// <param name="index"></param>
|
||||||
/// <summary>
|
|
||||||
/// GetProgramInfoByIndex method
|
|
||||||
/// </summary>
|
|
||||||
public void GetProgramInfoByIndex(ushort index)
|
public void GetProgramInfoByIndex(ushort index)
|
||||||
{
|
{
|
||||||
if (index < 1 || index > 10)
|
if (index < 1 || index > 10)
|
||||||
@@ -266,9 +263,9 @@ namespace PepperDash.Core.SystemInfo
|
|||||||
OnBoolChange(false, 0, SystemInfoConstants.BusyBoolChange);
|
OnBoolChange(false, 0, SystemInfoConstants.BusyBoolChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// RefreshProcessorUptime method
|
/// Gets the processor uptime and passes it to S+
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void RefreshProcessorUptime()
|
public void RefreshProcessorUptime()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -290,9 +287,6 @@ namespace PepperDash.Core.SystemInfo
|
|||||||
/// Gets the program uptime, by index, and passes it to S+
|
/// Gets the program uptime, by index, and passes it to S+
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="index"></param>
|
/// <param name="index"></param>
|
||||||
/// <summary>
|
|
||||||
/// RefreshProgramUptimeByIndex method
|
|
||||||
/// </summary>
|
|
||||||
public void RefreshProgramUptimeByIndex(int index)
|
public void RefreshProgramUptimeByIndex(int index)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -314,9 +308,6 @@ namespace PepperDash.Core.SystemInfo
|
|||||||
/// Sends command to console, passes response back using string change event
|
/// Sends command to console, passes response back using string change event
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="cmd"></param>
|
/// <param name="cmd"></param>
|
||||||
/// <summary>
|
|
||||||
/// SendConsoleCommand method
|
|
||||||
/// </summary>
|
|
||||||
public void SendConsoleCommand(string cmd)
|
public void SendConsoleCommand(string cmd)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(cmd))
|
if (string.IsNullOrEmpty(cmd))
|
||||||
|
|||||||
@@ -35,9 +35,6 @@ namespace PepperDash.Core
|
|||||||
return issuerCertificate;
|
return issuerCertificate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// IssueCertificate method
|
|
||||||
/// </summary>
|
|
||||||
public X509Certificate2 IssueCertificate(string subjectName, X509Certificate2 issuerCertificate, string[] subjectAlternativeNames, KeyPurposeID[] usages)
|
public X509Certificate2 IssueCertificate(string subjectName, X509Certificate2 issuerCertificate, string[] subjectAlternativeNames, KeyPurposeID[] usages)
|
||||||
{
|
{
|
||||||
// It's self-signed, so these are the same.
|
// It's self-signed, so these are the same.
|
||||||
@@ -59,9 +56,6 @@ namespace PepperDash.Core
|
|||||||
return ConvertCertificate(certificate, subjectKeyPair, random);
|
return ConvertCertificate(certificate, subjectKeyPair, random);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// CreateCertificateAuthorityCertificate method
|
|
||||||
/// </summary>
|
|
||||||
public X509Certificate2 CreateCertificateAuthorityCertificate(string subjectName, string[] subjectAlternativeNames, KeyPurposeID[] usages)
|
public X509Certificate2 CreateCertificateAuthorityCertificate(string subjectName, string[] subjectAlternativeNames, KeyPurposeID[] usages)
|
||||||
{
|
{
|
||||||
// It's self-signed, so these are the same.
|
// It's self-signed, so these are the same.
|
||||||
@@ -84,9 +78,6 @@ namespace PepperDash.Core
|
|||||||
return ConvertCertificate(certificate, subjectKeyPair, random);
|
return ConvertCertificate(certificate, subjectKeyPair, random);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// CreateSelfSignedCertificate method
|
|
||||||
/// </summary>
|
|
||||||
public X509Certificate2 CreateSelfSignedCertificate(string subjectName, string[] subjectAlternativeNames, KeyPurposeID[] usages)
|
public X509Certificate2 CreateSelfSignedCertificate(string subjectName, string[] subjectAlternativeNames, KeyPurposeID[] usages)
|
||||||
{
|
{
|
||||||
// It's self-signed, so these are the same.
|
// It's self-signed, so these are the same.
|
||||||
@@ -314,9 +305,6 @@ namespace PepperDash.Core
|
|||||||
return convertedCertificate;
|
return convertedCertificate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// WriteCertificate method
|
|
||||||
/// </summary>
|
|
||||||
public void WriteCertificate(X509Certificate2 certificate, string outputDirectory, string certName)
|
public void WriteCertificate(X509Certificate2 certificate, string outputDirectory, string certName)
|
||||||
{
|
{
|
||||||
// This password is the one attached to the PFX file. Use 'null' for no password.
|
// 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)
|
public bool AddCertToStore(X509Certificate2 cert, System.Security.Cryptography.X509Certificates.StoreName st, System.Security.Cryptography.X509Certificates.StoreLocation sl)
|
||||||
{
|
{
|
||||||
bool bRet = false;
|
bool bRet = false;
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
namespace PepperDash.Core.Web.RequestHandlers
|
namespace PepperDash.Core.Web.RequestHandlers
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a DefaultRequestHandler
|
/// Web API default request handler
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class DefaultRequestHandler : WebApiBaseRequestHandler
|
public class DefaultRequestHandler : WebApiBaseRequestHandler
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -142,9 +142,6 @@ namespace PepperDash.Core.Web.RequestHandlers
|
|||||||
/// Process request
|
/// Process request
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="context"></param>
|
/// <param name="context"></param>
|
||||||
/// <summary>
|
|
||||||
/// ProcessRequest method
|
|
||||||
/// </summary>
|
|
||||||
public void ProcessRequest(HttpCwsContext context)
|
public void ProcessRequest(HttpCwsContext context)
|
||||||
{
|
{
|
||||||
if (!_handlers.TryGetValue(context.Request.HttpMethod, out Func<HttpCwsContext, Task> handler))
|
if (!_handlers.TryGetValue(context.Request.HttpMethod, out Func<HttpCwsContext, Task> handler))
|
||||||
|
|||||||
@@ -144,9 +144,6 @@ namespace PepperDash.Core.Web.RequestHandlers
|
|||||||
/// Process request
|
/// Process request
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="context"></param>
|
/// <param name="context"></param>
|
||||||
/// <summary>
|
|
||||||
/// ProcessRequest method
|
|
||||||
/// </summary>
|
|
||||||
public void ProcessRequest(HttpCwsContext context)
|
public void ProcessRequest(HttpCwsContext context)
|
||||||
{
|
{
|
||||||
Action<HttpCwsContext> handler;
|
Action<HttpCwsContext> handler;
|
||||||
|
|||||||
@@ -25,24 +25,24 @@ namespace PepperDash.Core.Web
|
|||||||
private readonly CCriticalSection _serverLock = new CCriticalSection();
|
private readonly CCriticalSection _serverLock = new CCriticalSection();
|
||||||
private HttpCwsServer _server;
|
private HttpCwsServer _server;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Key
|
/// Web API server key
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Key { get; private set; }
|
public string Key { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Name
|
/// Web API server name
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Name { get; private set; }
|
public string Name { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the BasePath
|
/// CWS base path, will default to "/api" if not set via initialize method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string BasePath { get; private set; }
|
public string BasePath { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the IsRegistered
|
/// Indicates CWS is registered with base path
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsRegistered { get; private set; }
|
public bool IsRegistered { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -137,9 +137,9 @@ namespace PepperDash.Core.Web
|
|||||||
Start();
|
Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initialize method
|
/// Initializes CWS class
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Initialize(string key, string basePath)
|
public void Initialize(string key, string basePath)
|
||||||
{
|
{
|
||||||
Key = key;
|
Key = key;
|
||||||
@@ -165,9 +165,6 @@ namespace PepperDash.Core.Web
|
|||||||
/// Removes a route from CWS
|
/// Removes a route from CWS
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="route"></param>
|
/// <param name="route"></param>
|
||||||
/// <summary>
|
|
||||||
/// RemoveRoute method
|
|
||||||
/// </summary>
|
|
||||||
public void RemoveRoute(HttpCwsRoute route)
|
public void RemoveRoute(HttpCwsRoute route)
|
||||||
{
|
{
|
||||||
if (route == null)
|
if (route == null)
|
||||||
@@ -179,9 +176,9 @@ namespace PepperDash.Core.Web
|
|||||||
_server.Routes.Remove(route);
|
_server.Routes.Remove(route);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// GetRouteCollection method
|
/// Returns a list of the current routes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public HttpCwsRouteCollection GetRouteCollection()
|
public HttpCwsRouteCollection GetRouteCollection()
|
||||||
{
|
{
|
||||||
return _server.Routes;
|
return _server.Routes;
|
||||||
@@ -225,9 +222,9 @@ namespace PepperDash.Core.Web
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stop method
|
/// Stop CWS instance
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Stop()
|
public void Stop()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
namespace PepperDash.Core.WebApi.Presets
|
namespace PepperDash.Core.WebApi.Presets
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a Preset
|
/// Represents a preset
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class Preset
|
public class Preset
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -12,29 +12,29 @@ namespace PepperDash.Core.WebApi.Presets
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the UserId
|
/// User ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int UserId { get; set; }
|
public int UserId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the RoomTypeId
|
/// Room Type ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int RoomTypeId { get; set; }
|
public int RoomTypeId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the PresetName
|
/// Preset Name
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string PresetName { get; set; }
|
public string PresetName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the PresetNumber
|
/// Preset Number
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int PresetNumber { get; set; }
|
public int PresetNumber { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Data
|
/// Preset Data
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Data { get; set; }
|
public string Data { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -48,9 +48,9 @@ namespace PepperDash.Core.WebApi.Presets
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a PresetReceivedEventArgs
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class PresetReceivedEventArgs : EventArgs
|
public class PresetReceivedEventArgs : EventArgs
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -59,12 +59,12 @@ namespace PepperDash.Core.WebApi.Presets
|
|||||||
public bool LookupSuccess { get; private set; }
|
public bool LookupSuccess { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the ULookupSuccess
|
/// S+ helper
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ushort ULookupSuccess { get { return (ushort)(LookupSuccess ? 1 : 0); } }
|
public ushort ULookupSuccess { get { return (ushort)(LookupSuccess ? 1 : 0); } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Preset
|
/// The preset
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Preset Preset { get; private set; }
|
public Preset Preset { get; private set; }
|
||||||
|
|
||||||
|
|||||||
@@ -16,19 +16,19 @@ namespace PepperDash.Core.WebApi.Presets
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the ExternalId
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ExternalId { get; set; }
|
public string ExternalId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the FirstName
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string FirstName { get; set; }
|
public string FirstName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the LastName
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string LastName { get; set; }
|
public string LastName { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,13 +44,13 @@ namespace PepperDash.Core.WebApi.Presets
|
|||||||
public bool LookupSuccess { get; private set; }
|
public bool LookupSuccess { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the ULookupSuccess
|
/// For stupid S+
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ushort ULookupSuccess { get { return (ushort)(LookupSuccess ? 1 : 0); } }
|
public ushort ULookupSuccess { get { return (ushort)(LookupSuccess ? 1 : 0); } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the User
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public User User { get; private set; }
|
public User User { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -70,9 +70,9 @@ namespace PepperDash.Core.WebApi.Presets
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a UserAndRoomMessage
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class UserAndRoomMessage
|
public class UserAndRoomMessage
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -80,14 +80,14 @@ namespace PepperDash.Core.WebApi.Presets
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int UserId { get; set; }
|
public int UserId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the RoomTypeId
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int RoomTypeId { get; set; }
|
public int RoomTypeId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the PresetNumber
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int PresetNumber { get; set; }
|
public int PresetNumber { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -25,9 +25,9 @@ namespace PepperDash.Core.WebApi.Presets
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public event EventHandler<PresetReceivedEventArgs> PresetReceived;
|
public event EventHandler<PresetReceivedEventArgs> PresetReceived;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Key
|
/// Unique identifier for this instance
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Key { get; private set; }
|
public string Key { get; private set; }
|
||||||
|
|
||||||
//string JsonMasterKey;
|
//string JsonMasterKey;
|
||||||
@@ -77,9 +77,6 @@ namespace PepperDash.Core.WebApi.Presets
|
|||||||
/// Gets the user for a passcode
|
/// Gets the user for a passcode
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="passcode"></param>
|
/// <param name="passcode"></param>
|
||||||
/// <summary>
|
|
||||||
/// GetUserForPasscode method
|
|
||||||
/// </summary>
|
|
||||||
public void GetUserForPasscode(string passcode)
|
public void GetUserForPasscode(string passcode)
|
||||||
{
|
{
|
||||||
// Bullshit duplicate code here... These two cases should be the same
|
// Bullshit duplicate code here... These two cases should be the same
|
||||||
@@ -118,9 +115,6 @@ namespace PepperDash.Core.WebApi.Presets
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="roomTypeId"></param>
|
/// <param name="roomTypeId"></param>
|
||||||
/// <param name="presetNumber"></param>
|
/// <param name="presetNumber"></param>
|
||||||
/// <summary>
|
|
||||||
/// GetPresetForThisUser method
|
|
||||||
/// </summary>
|
|
||||||
public void GetPresetForThisUser(int roomTypeId, int presetNumber)
|
public void GetPresetForThisUser(int roomTypeId, int presetNumber)
|
||||||
{
|
{
|
||||||
if (CurrentUser == null)
|
if (CurrentUser == null)
|
||||||
@@ -218,9 +212,6 @@ namespace PepperDash.Core.WebApi.Presets
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="roomTypeId"></param>
|
/// <param name="roomTypeId"></param>
|
||||||
/// <param name="presetNumber"></param>
|
/// <param name="presetNumber"></param>
|
||||||
/// <summary>
|
|
||||||
/// SavePresetForThisUser method
|
|
||||||
/// </summary>
|
|
||||||
public void SavePresetForThisUser(int roomTypeId, int presetNumber)
|
public void SavePresetForThisUser(int roomTypeId, int presetNumber)
|
||||||
{
|
{
|
||||||
if (CurrentPreset == null)
|
if (CurrentPreset == null)
|
||||||
|
|||||||
@@ -59,9 +59,6 @@ namespace PepperDash.Core.Intersystem.Tokens
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="offset"></param>
|
/// <param name="offset"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <summary>
|
|
||||||
/// GetTokenWithOffset method
|
|
||||||
/// </summary>
|
|
||||||
public override XSigToken GetTokenWithOffset(int offset)
|
public override XSigToken GetTokenWithOffset(int offset)
|
||||||
{
|
{
|
||||||
if (offset == 0) return this;
|
if (offset == 0) return this;
|
||||||
@@ -72,10 +69,6 @@ namespace PepperDash.Core.Intersystem.Tokens
|
|||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <summary>
|
|
||||||
/// ToString method
|
|
||||||
/// </summary>
|
|
||||||
/// <inheritdoc />
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return Index + " = 0x" + Value.ToString("X4");
|
return Index + " = 0x" + Value.ToString("X4");
|
||||||
@@ -87,9 +80,6 @@ namespace PepperDash.Core.Intersystem.Tokens
|
|||||||
/// <param name="format"></param>
|
/// <param name="format"></param>
|
||||||
/// <param name="formatProvider"></param>
|
/// <param name="formatProvider"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <summary>
|
|
||||||
/// ToString method
|
|
||||||
/// </summary>
|
|
||||||
public string ToString(string format, IFormatProvider formatProvider)
|
public string ToString(string format, IFormatProvider formatProvider)
|
||||||
{
|
{
|
||||||
return Value.ToString(format, formatProvider);
|
return Value.ToString(format, formatProvider);
|
||||||
|
|||||||
@@ -57,9 +57,6 @@ namespace PepperDash.Core.Intersystem.Tokens
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="offset"></param>
|
/// <param name="offset"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <summary>
|
|
||||||
/// GetTokenWithOffset method
|
|
||||||
/// </summary>
|
|
||||||
public override XSigToken GetTokenWithOffset(int offset)
|
public override XSigToken GetTokenWithOffset(int offset)
|
||||||
{
|
{
|
||||||
if (offset == 0) return this;
|
if (offset == 0) return this;
|
||||||
@@ -70,10 +67,6 @@ namespace PepperDash.Core.Intersystem.Tokens
|
|||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <summary>
|
|
||||||
/// ToString method
|
|
||||||
/// </summary>
|
|
||||||
/// <inheritdoc />
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return Index + " = " + (Value ? "High" : "Low");
|
return Index + " = " + (Value ? "High" : "Low");
|
||||||
@@ -84,9 +77,6 @@ namespace PepperDash.Core.Intersystem.Tokens
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="formatProvider"></param>
|
/// <param name="formatProvider"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <summary>
|
|
||||||
/// ToString method
|
|
||||||
/// </summary>
|
|
||||||
public string ToString(IFormatProvider formatProvider)
|
public string ToString(IFormatProvider formatProvider)
|
||||||
{
|
{
|
||||||
return Value.ToString(formatProvider);
|
return Value.ToString(formatProvider);
|
||||||
|
|||||||
@@ -63,9 +63,6 @@ namespace PepperDash.Core.Intersystem.Tokens
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="offset"></param>
|
/// <param name="offset"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <summary>
|
|
||||||
/// GetTokenWithOffset method
|
|
||||||
/// </summary>
|
|
||||||
public override XSigToken GetTokenWithOffset(int offset)
|
public override XSigToken GetTokenWithOffset(int offset)
|
||||||
{
|
{
|
||||||
if (offset == 0) return this;
|
if (offset == 0) return this;
|
||||||
@@ -76,10 +73,6 @@ namespace PepperDash.Core.Intersystem.Tokens
|
|||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <summary>
|
|
||||||
/// ToString method
|
|
||||||
/// </summary>
|
|
||||||
/// <inheritdoc />
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return Index + " = \"" + Value + "\"";
|
return Index + " = \"" + Value + "\"";
|
||||||
|
|||||||
@@ -52,9 +52,6 @@ namespace PepperDash.Core.Intersystem
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="xSigSerialization">XSig state resolver.</param>
|
/// <param name="xSigSerialization">XSig state resolver.</param>
|
||||||
/// <returns>Bytes in XSig format for each token within the state representation.</returns>
|
/// <returns>Bytes in XSig format for each token within the state representation.</returns>
|
||||||
/// <summary>
|
|
||||||
/// GetBytes method
|
|
||||||
/// </summary>
|
|
||||||
public static byte[] GetBytes(IXSigSerialization xSigSerialization)
|
public static byte[] GetBytes(IXSigSerialization xSigSerialization)
|
||||||
{
|
{
|
||||||
return GetBytes(xSigSerialization, 0);
|
return GetBytes(xSigSerialization, 0);
|
||||||
@@ -66,9 +63,6 @@ namespace PepperDash.Core.Intersystem
|
|||||||
/// <param name="xSigSerialization">XSig state resolver.</param>
|
/// <param name="xSigSerialization">XSig state resolver.</param>
|
||||||
/// <param name="offset">Offset to which the data will be aligned.</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>
|
/// <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)
|
public static byte[] GetBytes(IXSigSerialization xSigSerialization, int offset)
|
||||||
{
|
{
|
||||||
var tokens = xSigSerialization.Serialize();
|
var tokens = xSigSerialization.Serialize();
|
||||||
@@ -88,9 +82,6 @@ namespace PepperDash.Core.Intersystem
|
|||||||
/// <param name="index">1-based digital index</param>
|
/// <param name="index">1-based digital index</param>
|
||||||
/// <param name="value">Digital data to be encoded</param>
|
/// <param name="value">Digital data to be encoded</param>
|
||||||
/// <returns>Bytes in XSig format for digtial information.</returns>
|
/// <returns>Bytes in XSig format for digtial information.</returns>
|
||||||
/// <summary>
|
|
||||||
/// GetBytes method
|
|
||||||
/// </summary>
|
|
||||||
public static byte[] GetBytes(int index, bool value)
|
public static byte[] GetBytes(int index, bool value)
|
||||||
{
|
{
|
||||||
return GetBytes(index, 0, value);
|
return GetBytes(index, 0, value);
|
||||||
@@ -103,9 +94,6 @@ namespace PepperDash.Core.Intersystem
|
|||||||
/// <param name="offset">Index offset.</param>
|
/// <param name="offset">Index offset.</param>
|
||||||
/// <param name="value">Digital data to be encoded</param>
|
/// <param name="value">Digital data to be encoded</param>
|
||||||
/// <returns>Bytes in XSig format for digtial information.</returns>
|
/// <returns>Bytes in XSig format for digtial information.</returns>
|
||||||
/// <summary>
|
|
||||||
/// GetBytes method
|
|
||||||
/// </summary>
|
|
||||||
public static byte[] GetBytes(int index, int offset, bool value)
|
public static byte[] GetBytes(int index, int offset, bool value)
|
||||||
{
|
{
|
||||||
return new XSigDigitalToken(index + offset, value).GetBytes();
|
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="startIndex">Starting index of the sequence.</param>
|
||||||
/// <param name="values">Digital signal value array.</param>
|
/// <param name="values">Digital signal value array.</param>
|
||||||
/// <returns>Byte sequence in XSig format for digital signal information.</returns>
|
/// <returns>Byte sequence in XSig format for digital signal information.</returns>
|
||||||
/// <summary>
|
|
||||||
/// GetBytes method
|
|
||||||
/// </summary>
|
|
||||||
public static byte[] GetBytes(int startIndex, bool[] values)
|
public static byte[] GetBytes(int startIndex, bool[] values)
|
||||||
{
|
{
|
||||||
return GetBytes(startIndex, 0, values);
|
return GetBytes(startIndex, 0, values);
|
||||||
@@ -132,9 +117,6 @@ namespace PepperDash.Core.Intersystem
|
|||||||
/// <param name="offset">Index offset.</param>
|
/// <param name="offset">Index offset.</param>
|
||||||
/// <param name="values">Digital signal value array.</param>
|
/// <param name="values">Digital signal value array.</param>
|
||||||
/// <returns>Byte sequence in XSig format for digital signal information.</returns>
|
/// <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)
|
public static byte[] GetBytes(int startIndex, int offset, bool[] values)
|
||||||
{
|
{
|
||||||
// Digital XSig data is 2 bytes per value
|
// 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="index">1-based analog index</param>
|
||||||
/// <param name="value">Analog data to be encoded</param>
|
/// <param name="value">Analog data to be encoded</param>
|
||||||
/// <returns>Bytes in XSig format for analog signal information.</returns>
|
/// <returns>Bytes in XSig format for analog signal information.</returns>
|
||||||
/// <summary>
|
|
||||||
/// GetBytes method
|
|
||||||
/// </summary>
|
|
||||||
public static byte[] GetBytes(int index, ushort value)
|
public static byte[] GetBytes(int index, ushort value)
|
||||||
{
|
{
|
||||||
return GetBytes(index, 0, value);
|
return GetBytes(index, 0, value);
|
||||||
@@ -167,9 +146,6 @@ namespace PepperDash.Core.Intersystem
|
|||||||
/// <param name="offset">Index offset.</param>
|
/// <param name="offset">Index offset.</param>
|
||||||
/// <param name="value">Analog data to be encoded</param>
|
/// <param name="value">Analog data to be encoded</param>
|
||||||
/// <returns>Bytes in XSig format for analog signal information.</returns>
|
/// <returns>Bytes in XSig format for analog signal information.</returns>
|
||||||
/// <summary>
|
|
||||||
/// GetBytes method
|
|
||||||
/// </summary>
|
|
||||||
public static byte[] GetBytes(int index, int offset, ushort value)
|
public static byte[] GetBytes(int index, int offset, ushort value)
|
||||||
{
|
{
|
||||||
return new XSigAnalogToken(index + offset, value).GetBytes();
|
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="startIndex">Starting index of the sequence.</param>
|
||||||
/// <param name="values">Analog signal value array.</param>
|
/// <param name="values">Analog signal value array.</param>
|
||||||
/// <returns>Byte sequence in XSig format for analog signal information.</returns>
|
/// <returns>Byte sequence in XSig format for analog signal information.</returns>
|
||||||
/// <summary>
|
|
||||||
/// GetBytes method
|
|
||||||
/// </summary>
|
|
||||||
public static byte[] GetBytes(int startIndex, ushort[] values)
|
public static byte[] GetBytes(int startIndex, ushort[] values)
|
||||||
{
|
{
|
||||||
return GetBytes(startIndex, 0, values);
|
return GetBytes(startIndex, 0, values);
|
||||||
@@ -196,9 +169,6 @@ namespace PepperDash.Core.Intersystem
|
|||||||
/// <param name="offset">Index offset.</param>
|
/// <param name="offset">Index offset.</param>
|
||||||
/// <param name="values">Analog signal value array.</param>
|
/// <param name="values">Analog signal value array.</param>
|
||||||
/// <returns>Byte sequence in XSig format for analog signal information.</returns>
|
/// <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)
|
public static byte[] GetBytes(int startIndex, int offset, ushort[] values)
|
||||||
{
|
{
|
||||||
// Analog XSig data is 4 bytes per value
|
// 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="index">1-based serial index</param>
|
||||||
/// <param name="value">Serial data to be encoded</param>
|
/// <param name="value">Serial data to be encoded</param>
|
||||||
/// <returns>Bytes in XSig format for serial signal information.</returns>
|
/// <returns>Bytes in XSig format for serial signal information.</returns>
|
||||||
/// <summary>
|
|
||||||
/// GetBytes method
|
|
||||||
/// </summary>
|
|
||||||
public static byte[] GetBytes(int index, string value)
|
public static byte[] GetBytes(int index, string value)
|
||||||
{
|
{
|
||||||
return GetBytes(index, 0, value);
|
return GetBytes(index, 0, value);
|
||||||
@@ -231,9 +198,6 @@ namespace PepperDash.Core.Intersystem
|
|||||||
/// <param name="offset">Index offset.</param>
|
/// <param name="offset">Index offset.</param>
|
||||||
/// <param name="value">Serial data to be encoded</param>
|
/// <param name="value">Serial data to be encoded</param>
|
||||||
/// <returns>Bytes in XSig format for serial signal information.</returns>
|
/// <returns>Bytes in XSig format for serial signal information.</returns>
|
||||||
/// <summary>
|
|
||||||
/// GetBytes method
|
|
||||||
/// </summary>
|
|
||||||
public static byte[] GetBytes(int index, int offset, string value)
|
public static byte[] GetBytes(int index, int offset, string value)
|
||||||
{
|
{
|
||||||
return new XSigSerialToken(index + offset, value).GetBytes();
|
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="startIndex">Starting index of the sequence.</param>
|
||||||
/// <param name="values">Serial signal value array.</param>
|
/// <param name="values">Serial signal value array.</param>
|
||||||
/// <returns>Byte sequence in XSig format for serial signal information.</returns>
|
/// <returns>Byte sequence in XSig format for serial signal information.</returns>
|
||||||
/// <summary>
|
|
||||||
/// GetBytes method
|
|
||||||
/// </summary>
|
|
||||||
public static byte[] GetBytes(int startIndex, string[] values)
|
public static byte[] GetBytes(int startIndex, string[] values)
|
||||||
{
|
{
|
||||||
return GetBytes(startIndex, 0, values);
|
return GetBytes(startIndex, 0, values);
|
||||||
@@ -260,9 +221,6 @@ namespace PepperDash.Core.Intersystem
|
|||||||
/// <param name="offset">Index offset.</param>
|
/// <param name="offset">Index offset.</param>
|
||||||
/// <param name="values">Serial signal value array.</param>
|
/// <param name="values">Serial signal value array.</param>
|
||||||
/// <returns>Byte sequence in XSig format for serial signal information.</returns>
|
/// <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)
|
public static byte[] GetBytes(int startIndex, int offset, string[] values)
|
||||||
{
|
{
|
||||||
// Serial XSig data is not fixed-length like the other formats
|
// Serial XSig data is not fixed-length like the other formats
|
||||||
|
|||||||
@@ -48,9 +48,6 @@ namespace PepperDash.Core.Intersystem
|
|||||||
/// <param name="stream">Input stream</param>
|
/// <param name="stream">Input stream</param>
|
||||||
/// <param name="value">Result</param>
|
/// <param name="value">Result</param>
|
||||||
/// <returns>True if successful, otherwise false.</returns>
|
/// <returns>True if successful, otherwise false.</returns>
|
||||||
/// <summary>
|
|
||||||
/// TryReadUInt16BE method
|
|
||||||
/// </summary>
|
|
||||||
public static bool TryReadUInt16BE(Stream stream, out ushort value)
|
public static bool TryReadUInt16BE(Stream stream, out ushort value)
|
||||||
{
|
{
|
||||||
value = 0;
|
value = 0;
|
||||||
@@ -68,9 +65,6 @@ namespace PepperDash.Core.Intersystem
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>XSigToken</returns>
|
/// <returns>XSigToken</returns>
|
||||||
/// <exception cref="ArgumentOutOfRangeException">Offset is less than 0.</exception>
|
/// <exception cref="ArgumentOutOfRangeException">Offset is less than 0.</exception>
|
||||||
/// <summary>
|
|
||||||
/// ReadXSigToken method
|
|
||||||
/// </summary>
|
|
||||||
public XSigToken ReadXSigToken()
|
public XSigToken ReadXSigToken()
|
||||||
{
|
{
|
||||||
ushort prefix;
|
ushort prefix;
|
||||||
@@ -120,9 +114,6 @@ namespace PepperDash.Core.Intersystem
|
|||||||
/// Reads all available XSig tokens from the stream.
|
/// Reads all available XSig tokens from the stream.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>XSigToken collection.</returns>
|
/// <returns>XSigToken collection.</returns>
|
||||||
/// <summary>
|
|
||||||
/// ReadAllXSigTokens method
|
|
||||||
/// </summary>
|
|
||||||
public IEnumerable<XSigToken> ReadAllXSigTokens()
|
public IEnumerable<XSigToken> ReadAllXSigTokens()
|
||||||
{
|
{
|
||||||
var tokens = new List<XSigToken>();
|
var tokens = new List<XSigToken>();
|
||||||
|
|||||||
@@ -47,9 +47,6 @@ namespace PepperDash.Core.Intersystem
|
|||||||
/// Write XSig data gathered from an IXSigStateResolver to the stream.
|
/// Write XSig data gathered from an IXSigStateResolver to the stream.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="xSigSerialization">IXSigStateResolver object.</param>
|
/// <param name="xSigSerialization">IXSigStateResolver object.</param>
|
||||||
/// <summary>
|
|
||||||
/// WriteXSigData method
|
|
||||||
/// </summary>
|
|
||||||
public void WriteXSigData(IXSigSerialization xSigSerialization)
|
public void WriteXSigData(IXSigSerialization xSigSerialization)
|
||||||
{
|
{
|
||||||
WriteXSigData(xSigSerialization, 0);
|
WriteXSigData(xSigSerialization, 0);
|
||||||
@@ -60,9 +57,6 @@ namespace PepperDash.Core.Intersystem
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="xSigSerialization">IXSigStateResolver object.</param>
|
/// <param name="xSigSerialization">IXSigStateResolver object.</param>
|
||||||
/// <param name="offset">Index offset for each XSigToken.</param>
|
/// <param name="offset">Index offset for each XSigToken.</param>
|
||||||
/// <summary>
|
|
||||||
/// WriteXSigData method
|
|
||||||
/// </summary>
|
|
||||||
public void WriteXSigData(IXSigSerialization xSigSerialization, int offset)
|
public void WriteXSigData(IXSigSerialization xSigSerialization, int offset)
|
||||||
{
|
{
|
||||||
if (xSigSerialization == null)
|
if (xSigSerialization == null)
|
||||||
@@ -76,9 +70,6 @@ namespace PepperDash.Core.Intersystem
|
|||||||
/// Write XSigToken to the stream.
|
/// Write XSigToken to the stream.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="token">XSigToken object.</param>
|
/// <param name="token">XSigToken object.</param>
|
||||||
/// <summary>
|
|
||||||
/// WriteXSigData method
|
|
||||||
/// </summary>
|
|
||||||
public void WriteXSigData(XSigToken token)
|
public void WriteXSigData(XSigToken token)
|
||||||
{
|
{
|
||||||
WriteXSigData(token, 0);
|
WriteXSigData(token, 0);
|
||||||
@@ -89,9 +80,6 @@ namespace PepperDash.Core.Intersystem
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="token">XSigToken object.</param>
|
/// <param name="token">XSigToken object.</param>
|
||||||
/// <param name="offset">Index offset for each XSigToken.</param>
|
/// <param name="offset">Index offset for each XSigToken.</param>
|
||||||
/// <summary>
|
|
||||||
/// WriteXSigData method
|
|
||||||
/// </summary>
|
|
||||||
public void WriteXSigData(XSigToken token, int offset)
|
public void WriteXSigData(XSigToken token, int offset)
|
||||||
{
|
{
|
||||||
WriteXSigData(new[] { token }, offset);
|
WriteXSigData(new[] { token }, offset);
|
||||||
@@ -120,9 +108,6 @@ namespace PepperDash.Core.Intersystem
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="tokens">XSigToken objects.</param>
|
/// <param name="tokens">XSigToken objects.</param>
|
||||||
/// <param name="offset">Index offset for each XSigToken.</param>
|
/// <param name="offset">Index offset for each XSigToken.</param>
|
||||||
/// <summary>
|
|
||||||
/// WriteXSigData method
|
|
||||||
/// </summary>
|
|
||||||
public void WriteXSigData(IEnumerable<XSigToken> tokens, int offset)
|
public void WriteXSigData(IEnumerable<XSigToken> tokens, int offset)
|
||||||
{
|
{
|
||||||
if (offset < 0)
|
if (offset < 0)
|
||||||
@@ -140,7 +125,7 @@ namespace PepperDash.Core.Intersystem
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Dispose method
|
/// Disposes of the internal stream if specified to not leave open.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,28 +3,26 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
|
using System.Reflection;
|
||||||
using Crestron.SimplSharpPro;
|
using Crestron.SimplSharpPro;
|
||||||
using Crestron.SimplSharpPro.DeviceSupport;
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
using Crestron.SimplSharpPro.EthernetCommunication;
|
using Crestron.SimplSharpPro.EthernetCommunication;
|
||||||
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Core.Logging;
|
|
||||||
using PepperDash.Essentials.Core.Config;
|
using PepperDash.Essentials.Core.Config;
|
||||||
using Serilog.Events;
|
using Serilog.Events;
|
||||||
|
|
||||||
|
//using PepperDash.Essentials.Devices.Common.Cameras;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Base class for bridge API variants
|
/// Base class for bridge API variants
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Obsolete("Will be removed in v3.0.0")]
|
|
||||||
public abstract class BridgeApi : EssentialsDevice
|
public abstract class BridgeApi : EssentialsDevice
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Constructor
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="key">Device key</param>
|
|
||||||
protected BridgeApi(string key) :
|
protected BridgeApi(string key) :
|
||||||
base(key)
|
base(key)
|
||||||
{
|
{
|
||||||
@@ -33,36 +31,23 @@ namespace PepperDash.Essentials.Core.Bridges
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class to link devices and rooms to an EISC Instance
|
/// Bridge API using EISC
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class EiscApiAdvanced : BridgeApi, ICommunicationMonitor
|
public class EiscApiAdvanced : BridgeApi, ICommunicationMonitor
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Gets the PropertiesConfig
|
|
||||||
/// </summary>
|
|
||||||
public EiscApiPropertiesConfig PropertiesConfig { get; private set; }
|
public EiscApiPropertiesConfig PropertiesConfig { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the JoinMaps dictionary
|
|
||||||
/// </summary>
|
|
||||||
public Dictionary<string, JoinMapBaseAdvanced> JoinMaps { get; private set; }
|
public Dictionary<string, JoinMapBaseAdvanced> JoinMaps { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the EISC instance
|
|
||||||
/// </summary>
|
|
||||||
public BasicTriList Eisc { get; private set; }
|
public BasicTriList Eisc { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Constructor
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="dc">Device configuration</param>
|
|
||||||
/// <param name="eisc">EISC instance</param>
|
|
||||||
public EiscApiAdvanced(DeviceConfig dc, BasicTriList eisc) :
|
public EiscApiAdvanced(DeviceConfig dc, BasicTriList eisc) :
|
||||||
base(dc.Key)
|
base(dc.Key)
|
||||||
{
|
{
|
||||||
JoinMaps = new Dictionary<string, JoinMapBaseAdvanced>();
|
JoinMaps = new Dictionary<string, JoinMapBaseAdvanced>();
|
||||||
|
|
||||||
PropertiesConfig = dc.Properties.ToObject<EiscApiPropertiesConfig>();
|
PropertiesConfig = dc.Properties.ToObject<EiscApiPropertiesConfig>();
|
||||||
|
//PropertiesConfig = JsonConvert.DeserializeObject<EiscApiPropertiesConfig>(dc.Properties.ToString());
|
||||||
|
|
||||||
Eisc = eisc;
|
Eisc = eisc;
|
||||||
|
|
||||||
@@ -75,18 +60,12 @@ namespace PepperDash.Essentials.Core.Bridges
|
|||||||
AddPostActivationAction(RegisterEisc);
|
AddPostActivationAction(RegisterEisc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// CustomActivate method
|
|
||||||
/// </summary>
|
|
||||||
public override bool CustomActivate()
|
public override bool CustomActivate()
|
||||||
{
|
{
|
||||||
CommunicationMonitor.Start();
|
CommunicationMonitor.Start();
|
||||||
return base.CustomActivate();
|
return base.CustomActivate();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Deactivate method
|
|
||||||
/// </summary>
|
|
||||||
public override bool Deactivate()
|
public override bool Deactivate()
|
||||||
{
|
{
|
||||||
CommunicationMonitor.Stop();
|
CommunicationMonitor.Stop();
|
||||||
@@ -99,7 +78,7 @@ namespace PepperDash.Essentials.Core.Bridges
|
|||||||
|
|
||||||
if (PropertiesConfig.Devices == null)
|
if (PropertiesConfig.Devices == null)
|
||||||
{
|
{
|
||||||
this.LogDebug("No devices linked to this bridge");
|
Debug.LogMessage(LogEventLevel.Debug, this, "No devices linked to this bridge");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,7 +99,9 @@ namespace PepperDash.Essentials.Core.Bridges
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.LogWarning("{deviceKey} is not compatible with this bridge type. Please update the device.", device.Key);
|
Debug.LogMessage(LogEventLevel.Information, this,
|
||||||
|
"{0} is not compatible with this bridge type. Please use 'eiscapi' instead, or updae the device.",
|
||||||
|
device.Key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,31 +116,31 @@ namespace PepperDash.Essentials.Core.Bridges
|
|||||||
|
|
||||||
if (registerResult != eDeviceRegistrationUnRegistrationResponse.Success)
|
if (registerResult != eDeviceRegistrationUnRegistrationResponse.Success)
|
||||||
{
|
{
|
||||||
this.LogVerbose("Registration result: {registerResult}", registerResult);
|
Debug.LogMessage(LogEventLevel.Verbose, this, "Registration result: {0}", registerResult);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.LogDebug("EISC registration successful");
|
Debug.LogMessage(LogEventLevel.Debug, this, "EISC registration successful");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Link rooms to this EISC. Rooms MUST implement IBridgeAdvanced
|
|
||||||
/// </summary>
|
|
||||||
public void LinkRooms()
|
public void LinkRooms()
|
||||||
{
|
{
|
||||||
this.LogDebug("Linking Rooms...");
|
Debug.LogMessage(LogEventLevel.Debug, this, "Linking Rooms...");
|
||||||
|
|
||||||
if (PropertiesConfig.Rooms == null)
|
if (PropertiesConfig.Rooms == null)
|
||||||
{
|
{
|
||||||
this.LogDebug("No rooms linked to this bridge.");
|
Debug.LogMessage(LogEventLevel.Debug, this, "No rooms linked to this bridge.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var room in PropertiesConfig.Rooms)
|
foreach (var room in PropertiesConfig.Rooms)
|
||||||
{
|
{
|
||||||
if (!(DeviceManager.GetDeviceForKey(room.RoomKey) is IBridgeAdvanced rm))
|
var rm = DeviceManager.GetDeviceForKey(room.RoomKey) as IBridgeAdvanced;
|
||||||
|
|
||||||
|
if (rm == null)
|
||||||
{
|
{
|
||||||
this.LogDebug("Room {roomKey} does not implement IBridgeAdvanced. Skipping...", room.RoomKey);
|
Debug.LogMessage(LogEventLevel.Debug, this,
|
||||||
|
"Room {0} does not implement IBridgeAdvanced. Skipping...", room.RoomKey);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -170,8 +151,8 @@ namespace PepperDash.Essentials.Core.Bridges
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds a join map
|
/// Adds a join map
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="deviceKey">The key of the device to add the join map for</param>
|
/// <param name="deviceKey"></param>
|
||||||
/// <param name="joinMap">The join map to add</param>
|
/// <param name="joinMap"></param>
|
||||||
public void AddJoinMap(string deviceKey, JoinMapBaseAdvanced joinMap)
|
public void AddJoinMap(string deviceKey, JoinMapBaseAdvanced joinMap)
|
||||||
{
|
{
|
||||||
if (!JoinMaps.ContainsKey(deviceKey))
|
if (!JoinMaps.ContainsKey(deviceKey))
|
||||||
@@ -180,13 +161,13 @@ namespace PepperDash.Essentials.Core.Bridges
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.LogWarning("Unable to add join map with key '{deviceKey}'. Key already exists in JoinMaps dictionary", deviceKey);
|
Debug.LogMessage(LogEventLevel.Verbose, this, "Unable to add join map with key '{0}'. Key already exists in JoinMaps dictionary", deviceKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// PrintJoinMaps method
|
/// Prints all the join maps on this bridge
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual void PrintJoinMaps()
|
public virtual void PrintJoinMaps()
|
||||||
{
|
{
|
||||||
CrestronConsole.ConsoleCommandResponse("Join Maps for EISC IPID: {0}\r\n", Eisc.ID.ToString("X"));
|
CrestronConsole.ConsoleCommandResponse("Join Maps for EISC IPID: {0}\r\n", Eisc.ID.ToString("X"));
|
||||||
@@ -197,17 +178,16 @@ namespace PepperDash.Essentials.Core.Bridges
|
|||||||
joinMap.Value.PrintJoinMapInfo();
|
joinMap.Value.PrintJoinMapInfo();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// MarkdownForBridge method
|
/// Generates markdown for all join maps on this bridge
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual void MarkdownForBridge(string bridgeKey)
|
public virtual void MarkdownForBridge(string bridgeKey)
|
||||||
{
|
{
|
||||||
this.LogInformation("Writing Joinmaps to files for EISC IPID: {eiscId}", Eisc.ID.ToString("X"));
|
Debug.LogMessage(LogEventLevel.Information, this, "Writing Joinmaps to files for EISC IPID: {0}", Eisc.ID.ToString("X"));
|
||||||
|
|
||||||
foreach (var joinMap in JoinMaps)
|
foreach (var joinMap in JoinMaps)
|
||||||
{
|
{
|
||||||
this.LogInformation("Generating markdown for device '{deviceKey}':", joinMap.Key);
|
Debug.LogMessage(LogEventLevel.Information, "Generating markdown for device '{0}':", joinMap.Key);
|
||||||
joinMap.Value.MarkdownJoinMapInfo(joinMap.Key, bridgeKey);
|
joinMap.Value.MarkdownJoinMapInfo(joinMap.Key, bridgeKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -215,45 +195,44 @@ namespace PepperDash.Essentials.Core.Bridges
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Prints the join map for a device by key
|
/// Prints the join map for a device by key
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="deviceKey">The key of the device to print the join map for</param>
|
/// <param name="deviceKey"></param>
|
||||||
public void PrintJoinMapForDevice(string deviceKey)
|
public void PrintJoinMapForDevice(string deviceKey)
|
||||||
{
|
{
|
||||||
var joinMap = JoinMaps[deviceKey];
|
var joinMap = JoinMaps[deviceKey];
|
||||||
|
|
||||||
if (joinMap == null)
|
if (joinMap == null)
|
||||||
{
|
{
|
||||||
this.LogInformation("Unable to find joinMap for device with key: '{deviceKey}'", deviceKey);
|
Debug.LogMessage(LogEventLevel.Information, this, "Unable to find joinMap for device with key: '{0}'", deviceKey);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.LogInformation("Join map for device '{deviceKey}' on EISC '{eiscKey}':", deviceKey, Key);
|
Debug.LogMessage(LogEventLevel.Information, "Join map for device '{0}' on EISC '{1}':", deviceKey, Key);
|
||||||
joinMap.PrintJoinMapInfo();
|
joinMap.PrintJoinMapInfo();
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Prints the join map for a device by key in Markdown format
|
/// Prints the join map for a device by key
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="deviceKey">The key of the device to print the join map for</param>
|
/// <param name="deviceKey"></param>
|
||||||
/// <param name="bridgeKey">The key of the bridge to use for the Markdown output</param>
|
|
||||||
public void MarkdownJoinMapForDevice(string deviceKey, string bridgeKey)
|
public void MarkdownJoinMapForDevice(string deviceKey, string bridgeKey)
|
||||||
{
|
{
|
||||||
var joinMap = JoinMaps[deviceKey];
|
var joinMap = JoinMaps[deviceKey];
|
||||||
|
|
||||||
if (joinMap == null)
|
if (joinMap == null)
|
||||||
{
|
{
|
||||||
this.LogInformation("Unable to find joinMap for device with key: '{deviceKey}'", deviceKey);
|
Debug.LogMessage(LogEventLevel.Information, this, "Unable to find joinMap for device with key: '{0}'", deviceKey);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.LogInformation("Join map for device '{deviceKey}' on EISC '{eiscKey}':", deviceKey, Key);
|
Debug.LogMessage(LogEventLevel.Information, "Join map for device '{0}' on EISC '{1}':", deviceKey, Key);
|
||||||
joinMap.MarkdownJoinMapInfo(deviceKey, bridgeKey);
|
joinMap.MarkdownJoinMapInfo(deviceKey, bridgeKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used for debugging to trigger an action based on a join number and type
|
/// Used for debugging to trigger an action based on a join number and type
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="join">The join number to execute the action for</param>
|
/// <param name="join"></param>
|
||||||
/// <param name="type">The type of join (digital, analog, serial)</param>
|
/// <param name="type"></param>
|
||||||
/// <param name="state">The state to pass to the action</param>
|
/// <param name="state"></param>
|
||||||
public void ExecuteJoinAction(uint join, string type, object state)
|
public void ExecuteJoinAction(uint join, string type, object state)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -262,202 +241,136 @@ namespace PepperDash.Essentials.Core.Bridges
|
|||||||
{
|
{
|
||||||
case "digital":
|
case "digital":
|
||||||
{
|
{
|
||||||
if (Eisc.BooleanOutput[join].UserObject is Action<bool> userObject)
|
var uo = Eisc.BooleanOutput[join].UserObject as Action<bool>;
|
||||||
|
if (uo != null)
|
||||||
{
|
{
|
||||||
this.LogVerbose("Executing Boolean Action");
|
Debug.LogMessage(LogEventLevel.Verbose, this, "Executing Action: {0}", uo.ToString());
|
||||||
userObject(Convert.ToBoolean(state));
|
uo(Convert.ToBoolean(state));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
this.LogVerbose("User Object is null. Nothing to Execute");
|
Debug.LogMessage(LogEventLevel.Verbose, this, "User Action is null. Nothing to Execute");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "analog":
|
case "analog":
|
||||||
{
|
{
|
||||||
if (Eisc.UShortOutput[join].UserObject is Action<ushort> userObject)
|
var uo = Eisc.BooleanOutput[join].UserObject as Action<ushort>;
|
||||||
|
if (uo != null)
|
||||||
{
|
{
|
||||||
this.LogVerbose("Executing Analog Action");
|
Debug.LogMessage(LogEventLevel.Verbose, this, "Executing Action: {0}", uo.ToString());
|
||||||
userObject(Convert.ToUInt16(state));
|
uo(Convert.ToUInt16(state));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
this.LogVerbose("User Object is null. Nothing to Execute");
|
Debug.LogMessage(LogEventLevel.Verbose, this, "User Action is null. Nothing to Execute"); break;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case "serial":
|
case "serial":
|
||||||
{
|
{
|
||||||
if (Eisc.StringOutput[join].UserObject is Action<string> userObject)
|
var uo = Eisc.BooleanOutput[join].UserObject as Action<string>;
|
||||||
|
if (uo != null)
|
||||||
{
|
{
|
||||||
this.LogVerbose("Executing Serial Action");
|
Debug.LogMessage(LogEventLevel.Verbose, this, "Executing Action: {0}", uo.ToString());
|
||||||
userObject(Convert.ToString(state));
|
uo(Convert.ToString(state));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
this.LogVerbose("User Object is null. Nothing to Execute");
|
Debug.LogMessage(LogEventLevel.Verbose, this, "User Action is null. Nothing to Execute");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
this.LogVerbose("Unknown join type. Use digital/serial/analog");
|
Debug.LogMessage(LogEventLevel.Verbose, "Unknown join type. Use digital/serial/analog");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
this.LogError("ExecuteJoinAction error: {message}", e.Message);
|
Debug.LogMessage(LogEventLevel.Debug, this, "Error: {0}", e);
|
||||||
this.LogDebug(e, "Stack Trace: ");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handle incoming sig changes
|
/// Handles incoming sig changes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="currentDevice">BasicTriList device that triggered the event</param>
|
/// <param name="currentDevice"></param>
|
||||||
/// <param name="args">Event arguments containing the signal information</param>
|
/// <param name="args"></param>
|
||||||
protected void Eisc_SigChange(object currentDevice, SigEventArgs args)
|
protected void Eisc_SigChange(object currentDevice, SigEventArgs args)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
this.LogVerbose("EiscApiAdvanced change: {type} {number}={value}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
|
Debug.LogMessage(LogEventLevel.Verbose, this, "EiscApiAdvanced change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
|
||||||
var userObject = args.Sig.UserObject;
|
var uo = args.Sig.UserObject;
|
||||||
|
|
||||||
if (userObject == null) return;
|
if (uo == null) return;
|
||||||
|
|
||||||
|
Debug.LogMessage(LogEventLevel.Debug, this, "Executing Action: {0}", uo.ToString());
|
||||||
if (userObject is Action<bool>)
|
if (uo is Action<bool>)
|
||||||
{
|
(uo as Action<bool>)(args.Sig.BoolValue);
|
||||||
this.LogDebug("Executing Boolean Action");
|
else if (uo is Action<ushort>)
|
||||||
(userObject as Action<bool>)(args.Sig.BoolValue);
|
(uo as Action<ushort>)(args.Sig.UShortValue);
|
||||||
}
|
else if (uo is Action<string>)
|
||||||
else if (userObject is Action<ushort>)
|
(uo as Action<string>)(args.Sig.StringValue);
|
||||||
{
|
|
||||||
this.LogDebug("Executing Analog Action");
|
|
||||||
(userObject as Action<ushort>)(args.Sig.UShortValue);
|
|
||||||
}
|
|
||||||
else if (userObject is Action<string>)
|
|
||||||
{
|
|
||||||
this.LogDebug("Executing Serial Action");
|
|
||||||
(userObject as Action<string>)(args.Sig.StringValue);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
this.LogError("Eisc_SigChange handler error: {message}", e.Message);
|
Debug.LogMessage(LogEventLevel.Verbose, this, "Error in Eisc_SigChange handler: {0}", e);
|
||||||
this.LogDebug(e, "Stack Trace: ");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Implementation of ICommunicationMonitor
|
#region Implementation of ICommunicationMonitor
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the CommunicationMonitor
|
|
||||||
/// </summary>
|
|
||||||
public StatusMonitorBase CommunicationMonitor { get; private set; }
|
public StatusMonitorBase CommunicationMonitor { get; private set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Represents a EiscApiPropertiesConfig
|
|
||||||
/// </summary>
|
|
||||||
public class EiscApiPropertiesConfig
|
public class EiscApiPropertiesConfig
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the Control
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("control")]
|
[JsonProperty("control")]
|
||||||
public EssentialsControlPropertiesConfig Control { get; set; }
|
public EssentialsControlPropertiesConfig Control { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the Devices
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("devices")]
|
[JsonProperty("devices")]
|
||||||
public List<ApiDevicePropertiesConfig> Devices { get; set; }
|
public List<ApiDevicePropertiesConfig> Devices { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the Rooms
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("rooms")]
|
[JsonProperty("rooms")]
|
||||||
public List<ApiRoomPropertiesConfig> Rooms { get; set; }
|
public List<ApiRoomPropertiesConfig> Rooms { get; set; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Represents a ApiDevicePropertiesConfig
|
|
||||||
/// </summary>
|
|
||||||
public class ApiDevicePropertiesConfig
|
public class ApiDevicePropertiesConfig
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the DeviceKey
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("deviceKey")]
|
[JsonProperty("deviceKey")]
|
||||||
public string DeviceKey { get; set; }
|
public string DeviceKey { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the JoinStart
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("joinStart")]
|
[JsonProperty("joinStart")]
|
||||||
public uint JoinStart { get; set; }
|
public uint JoinStart { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the JoinMapKey
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("joinMapKey")]
|
[JsonProperty("joinMapKey")]
|
||||||
public string JoinMapKey { get; set; }
|
public string JoinMapKey { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Represents a ApiRoomPropertiesConfig
|
|
||||||
/// </summary>
|
|
||||||
public class ApiRoomPropertiesConfig
|
public class ApiRoomPropertiesConfig
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the RoomKey
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("roomKey")]
|
[JsonProperty("roomKey")]
|
||||||
public string RoomKey { get; set; }
|
public string RoomKey { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the JoinStart
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("joinStart")]
|
[JsonProperty("joinStart")]
|
||||||
public uint JoinStart { get; set; }
|
public uint JoinStart { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the JoinMapKey
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("joinMapKey")]
|
[JsonProperty("joinMapKey")]
|
||||||
public string JoinMapKey { get; set; }
|
public string JoinMapKey { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Factory class for EiscApiAdvanced devices
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>
|
|
||||||
/// Supported types:
|
|
||||||
/// eiscapiadv - Create a standard EISC client over TCP/IP
|
|
||||||
/// eiscapiadvanced - Create a standard EISC client over TCP/IP
|
|
||||||
/// eiscapiadvancedserver - Create an EISC server
|
|
||||||
/// eiscapiadvancedclient - Create an EISC client
|
|
||||||
/// vceiscapiadv - Create a VC-4 EISC client
|
|
||||||
/// vceiscapiadvanced - Create a VC-4 EISC client
|
|
||||||
/// eiscapiadvudp - Create a standard EISC client over UDP
|
|
||||||
/// eiscapiadvancedudp - Create a standard EISC client over UDP
|
|
||||||
/// </remarks>
|
|
||||||
public class EiscApiAdvancedFactory : EssentialsDeviceFactory<EiscApiAdvanced>
|
public class EiscApiAdvancedFactory : EssentialsDeviceFactory<EiscApiAdvanced>
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Constructor
|
|
||||||
/// </summary>
|
|
||||||
public EiscApiAdvancedFactory()
|
public EiscApiAdvancedFactory()
|
||||||
{
|
{
|
||||||
TypeNames = new List<string> { "eiscapiadv", "eiscapiadvanced", "eiscapiadvancedserver", "eiscapiadvancedclient", "vceiscapiadv", "vceiscapiadvanced", "eiscapiadvudp", "eiscapiadvancedudp" };
|
TypeNames = new List<string> { "eiscapiadv", "eiscapiadvanced", "eiscapiadvancedserver", "eiscapiadvancedclient", "vceiscapiadv", "vceiscapiadvanced" };
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||||
{
|
{
|
||||||
Debug.LogDebug("Attempting to create new EiscApiAdvanced Device");
|
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new EiscApiAdvanced Device");
|
||||||
|
|
||||||
var controlProperties = CommFactory.GetControlPropertiesConfig(dc);
|
var controlProperties = CommFactory.GetControlPropertiesConfig(dc);
|
||||||
|
|
||||||
@@ -465,13 +378,6 @@ namespace PepperDash.Essentials.Core.Bridges
|
|||||||
|
|
||||||
switch (dc.Type.ToLower())
|
switch (dc.Type.ToLower())
|
||||||
{
|
{
|
||||||
case "eiscapiadvudp":
|
|
||||||
case "eiscapiadvancedudp":
|
|
||||||
{
|
|
||||||
eisc = new EthernetIntersystemCommunications(controlProperties.IpIdInt,
|
|
||||||
controlProperties.TcpSshProperties.Address, Global.ControlSystem);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "eiscapiadv":
|
case "eiscapiadv":
|
||||||
case "eiscapiadvanced":
|
case "eiscapiadvanced":
|
||||||
{
|
{
|
||||||
@@ -494,7 +400,7 @@ namespace PepperDash.Essentials.Core.Bridges
|
|||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(controlProperties.RoomId))
|
if (string.IsNullOrEmpty(controlProperties.RoomId))
|
||||||
{
|
{
|
||||||
Debug.LogInformation("Unable to build VC-4 EISC Client for device {deviceKey}. Room ID is missing or empty", dc.Key);
|
Debug.LogMessage(LogEventLevel.Information, "Unable to build VC-4 EISC Client for device {0}. Room ID is missing or empty", dc.Key);
|
||||||
eisc = null;
|
eisc = null;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,9 +34,6 @@ namespace PepperDash.Essentials.Core.Bridges
|
|||||||
bridge.PrintJoinMaps();
|
bridge.PrintJoinMaps();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
|
||||||
/// JoinmapMarkdown method
|
|
||||||
/// </summary>
|
|
||||||
public static void JoinmapMarkdown(string command)
|
public static void JoinmapMarkdown(string command)
|
||||||
{
|
{
|
||||||
var targets = command.Split(' ');
|
var targets = command.Split(' ');
|
||||||
|
|||||||
@@ -3,17 +3,10 @@
|
|||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defines the contract for IBridgeAdvanced
|
/// Defines a device that uses JoinMapBaseAdvanced for its join map
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IBridgeAdvanced
|
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);
|
void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,9 +2,6 @@ using System;
|
|||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Represents a AirMediaControllerJoinMap
|
|
||||||
/// </summary>
|
|
||||||
public class AirMediaControllerJoinMap : JoinMapBaseAdvanced
|
public class AirMediaControllerJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
[JoinName("IsOnline")]
|
[JoinName("IsOnline")]
|
||||||
|
|||||||
@@ -2,9 +2,6 @@
|
|||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Represents a AppleTvJoinMap
|
|
||||||
/// </summary>
|
|
||||||
public class AppleTvJoinMap : JoinMapBaseAdvanced
|
public class AppleTvJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
[JoinName("UpArrow")]
|
[JoinName("UpArrow")]
|
||||||
|
|||||||
@@ -2,9 +2,6 @@
|
|||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Represents a C2nRthsControllerJoinMap
|
|
||||||
/// </summary>
|
|
||||||
public class C2nRthsControllerJoinMap : JoinMapBaseAdvanced
|
public class C2nRthsControllerJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
[JoinName("IsOnline")]
|
[JoinName("IsOnline")]
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a CameraControllerJoinMap
|
/// Join map for CameraBase devices
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class CameraControllerJoinMap : JoinMapBaseAdvanced
|
public class CameraControllerJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,9 +2,6 @@
|
|||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Represents a CenOdtOccupancySensorBaseJoinMap
|
|
||||||
/// </summary>
|
|
||||||
public class CenOdtOccupancySensorBaseJoinMap : JoinMapBaseAdvanced
|
public class CenOdtOccupancySensorBaseJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
#region Digitals
|
#region Digitals
|
||||||
|
|||||||
@@ -2,9 +2,6 @@
|
|||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Represents a DisplayControllerJoinMap
|
|
||||||
/// </summary>
|
|
||||||
public class DisplayControllerJoinMap : JoinMapBaseAdvanced
|
public class DisplayControllerJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
[JoinName("Name")]
|
[JoinName("Name")]
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges {
|
namespace PepperDash.Essentials.Core.Bridges {
|
||||||
/// <summary>
|
|
||||||
/// Represents a DmBladeChassisControllerJoinMap
|
|
||||||
/// </summary>
|
|
||||||
public class DmBladeChassisControllerJoinMap : JoinMapBaseAdvanced {
|
public class DmBladeChassisControllerJoinMap : JoinMapBaseAdvanced {
|
||||||
|
|
||||||
[JoinName("IsOnline")]
|
[JoinName("IsOnline")]
|
||||||
|
|||||||
@@ -2,9 +2,6 @@ using System;
|
|||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Represents a DmChassisControllerJoinMap
|
|
||||||
/// </summary>
|
|
||||||
public class DmChassisControllerJoinMap : JoinMapBaseAdvanced
|
public class DmChassisControllerJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
[JoinName("EnableAudioBreakaway")]
|
[JoinName("EnableAudioBreakaway")]
|
||||||
|
|||||||
@@ -2,9 +2,6 @@ using System;
|
|||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Represents a DmRmcControllerJoinMap
|
|
||||||
/// </summary>
|
|
||||||
public class DmRmcControllerJoinMap : JoinMapBaseAdvanced
|
public class DmRmcControllerJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
[JoinName("IsOnline")]
|
[JoinName("IsOnline")]
|
||||||
|
|||||||
@@ -2,9 +2,6 @@
|
|||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Represents a DmTxControllerJoinMap
|
|
||||||
/// </summary>
|
|
||||||
public class DmTxControllerJoinMap : JoinMapBaseAdvanced
|
public class DmTxControllerJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
[JoinName("IsOnline")]
|
[JoinName("IsOnline")]
|
||||||
|
|||||||
@@ -2,9 +2,6 @@
|
|||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Represents a DmpsAudioOutputControllerJoinMap
|
|
||||||
/// </summary>
|
|
||||||
public class DmpsAudioOutputControllerJoinMap : JoinMapBaseAdvanced
|
public class DmpsAudioOutputControllerJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,6 @@
|
|||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Represents a DmpsMicrophoneControllerJoinMap
|
|
||||||
/// </summary>
|
|
||||||
public class DmpsMicrophoneControllerJoinMap : JoinMapBaseAdvanced
|
public class DmpsMicrophoneControllerJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
[JoinName("MicGain")]
|
[JoinName("MicGain")]
|
||||||
|
|||||||
@@ -2,9 +2,6 @@
|
|||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Represents a DmpsRoutingControllerJoinMap
|
|
||||||
/// </summary>
|
|
||||||
public class DmpsRoutingControllerJoinMap : JoinMapBaseAdvanced
|
public class DmpsRoutingControllerJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
[JoinName("EnableRouting")]
|
[JoinName("EnableRouting")]
|
||||||
|
|||||||
@@ -3,9 +3,6 @@
|
|||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Represents a GenericLightingJoinMap
|
|
||||||
/// </summary>
|
|
||||||
public class GenericLightingJoinMap : JoinMapBaseAdvanced
|
public class GenericLightingJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,6 @@
|
|||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Represents a GenericRelayControllerJoinMap
|
|
||||||
/// </summary>
|
|
||||||
public class GenericRelayControllerJoinMap : JoinMapBaseAdvanced
|
public class GenericRelayControllerJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,6 @@
|
|||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Represents a GlsOccupancySensorBaseJoinMap
|
|
||||||
/// </summary>
|
|
||||||
public class GlsOccupancySensorBaseJoinMap : JoinMapBaseAdvanced
|
public class GlsOccupancySensorBaseJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
[JoinName("IsOnline")]
|
[JoinName("IsOnline")]
|
||||||
|
|||||||
@@ -3,9 +3,6 @@ using PepperDash.Essentials.Core;
|
|||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Represents a GlsPartitionSensorJoinMap
|
|
||||||
/// </summary>
|
|
||||||
public class GlsPartitionSensorJoinMap : JoinMapBaseAdvanced
|
public class GlsPartitionSensorJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,6 @@
|
|||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Represents a HdMdNxM4kEControllerJoinMap
|
|
||||||
/// </summary>
|
|
||||||
public class HdMdNxM4kEControllerJoinMap : JoinMapBaseAdvanced
|
public class HdMdNxM4kEControllerJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
[JoinName("Name")]
|
[JoinName("Name")]
|
||||||
|
|||||||
@@ -2,9 +2,6 @@
|
|||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Represents a HdMdxxxCEControllerJoinMap
|
|
||||||
/// </summary>
|
|
||||||
public class HdMdxxxCEControllerJoinMap : JoinMapBaseAdvanced
|
public class HdMdxxxCEControllerJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -3,9 +3,6 @@ using PepperDash.Essentials.Core;
|
|||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Represents a HdPsXxxControllerJoinMap
|
|
||||||
/// </summary>
|
|
||||||
public class HdPsXxxControllerJoinMap : JoinMapBaseAdvanced
|
public class HdPsXxxControllerJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,6 @@
|
|||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Represents a Hrxxx0WirelessRemoteControllerJoinMap
|
|
||||||
/// </summary>
|
|
||||||
public class Hrxxx0WirelessRemoteControllerJoinMap : JoinMapBaseAdvanced
|
public class Hrxxx0WirelessRemoteControllerJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
[JoinName("Power")]
|
[JoinName("Power")]
|
||||||
|
|||||||
@@ -2,9 +2,6 @@
|
|||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Represents a IAnalogInputJoinMap
|
|
||||||
/// </summary>
|
|
||||||
public class IAnalogInputJoinMap : JoinMapBaseAdvanced
|
public class IAnalogInputJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,6 @@
|
|||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Represents a IBasicCommunicationJoinMap
|
|
||||||
/// </summary>
|
|
||||||
public class IBasicCommunicationJoinMap : JoinMapBaseAdvanced
|
public class IBasicCommunicationJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
[JoinName("TextReceived")]
|
[JoinName("TextReceived")]
|
||||||
|
|||||||
@@ -2,9 +2,6 @@
|
|||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Represents a IDigitalInputJoinMap
|
|
||||||
/// </summary>
|
|
||||||
public class IDigitalInputJoinMap : JoinMapBaseAdvanced
|
public class IDigitalInputJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,6 @@
|
|||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Represents a IDigitalOutputJoinMap
|
|
||||||
/// </summary>
|
|
||||||
public class IDigitalOutputJoinMap : JoinMapBaseAdvanced
|
public class IDigitalOutputJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,6 @@
|
|||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Represents a PduJoinMapBase
|
|
||||||
/// </summary>
|
|
||||||
public class PduJoinMapBase : JoinMapBaseAdvanced
|
public class PduJoinMapBase : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
[JoinName("Name")]
|
[JoinName("Name")]
|
||||||
|
|||||||
@@ -3,9 +3,6 @@
|
|||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Represents a SetTopBoxControllerJoinMap
|
|
||||||
/// </summary>
|
|
||||||
public class SetTopBoxControllerJoinMap : JoinMapBaseAdvanced
|
public class SetTopBoxControllerJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
[JoinName("PowerOn")]
|
[JoinName("PowerOn")]
|
||||||
|
|||||||
@@ -2,9 +2,6 @@
|
|||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Represents a StatusSignControllerJoinMap
|
|
||||||
/// </summary>
|
|
||||||
public class StatusSignControllerJoinMap : JoinMapBaseAdvanced
|
public class StatusSignControllerJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
[JoinName("IsOnline")]
|
[JoinName("IsOnline")]
|
||||||
|
|||||||
@@ -2,9 +2,6 @@
|
|||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Represents a SystemMonitorJoinMap
|
|
||||||
/// </summary>
|
|
||||||
public class SystemMonitorJoinMap : JoinMapBaseAdvanced
|
public class SystemMonitorJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
[JoinName("TimeZone")]
|
[JoinName("TimeZone")]
|
||||||
|
|||||||
@@ -2,9 +2,6 @@ using System;
|
|||||||
using PepperDash.Essentials.Core;
|
using PepperDash.Essentials.Core;
|
||||||
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Represents a VideoCodecControllerJoinMap
|
|
||||||
/// </summary>
|
|
||||||
public class VideoCodecControllerJoinMap : JoinMapBaseAdvanced
|
public class VideoCodecControllerJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
#region Digital
|
#region Digital
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user