mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-04-12 03:57:27 +00:00
Merge commit 'c732eb48f2629c7426954529cc73baf8d9cf5649' into feature/unit-testing-framework
This commit is contained in:
commit
9245ac9c74
521 changed files with 10454 additions and 2984 deletions
282
Crestron-Library-Usage-Analysis.md
Normal file
282
Crestron-Library-Usage-Analysis.md
Normal file
|
|
@ -0,0 +1,282 @@
|
||||||
|
# Crestron Library Usage Analysis - PepperDash Essentials
|
||||||
|
|
||||||
|
This document provides a comprehensive analysis of Crestron classes and interfaces used throughout the PepperDash Essentials framework, organized by namespace and library component.
|
||||||
|
|
||||||
|
## Executive Summary
|
||||||
|
|
||||||
|
The PepperDash Essentials framework extensively leverages Crestron SDK components across 100+ files, providing abstractions for:
|
||||||
|
- Control system hardware (processors, touchpanels, IO devices)
|
||||||
|
- Communication interfaces (Serial, TCP/IP, SSH, CEC, IR)
|
||||||
|
- Device management and routing
|
||||||
|
- User interface components and smart objects
|
||||||
|
- System monitoring and diagnostics
|
||||||
|
|
||||||
|
## 1. Core Crestron Libraries
|
||||||
|
|
||||||
|
### 1.1 Crestron.SimplSharp
|
||||||
|
|
||||||
|
**Primary Usage**: Foundational framework components, collections, and basic types.
|
||||||
|
|
||||||
|
**Key Files**:
|
||||||
|
- Multiple files across all projects use `Crestron.SimplSharp` namespaces
|
||||||
|
- Provides basic C# runtime support for Crestron processors
|
||||||
|
|
||||||
|
### 1.2 Crestron.SimplSharpPro
|
||||||
|
|
||||||
|
**Primary Usage**: Main hardware abstraction layer for Crestron devices.
|
||||||
|
|
||||||
|
**Key Classes Used**:
|
||||||
|
|
||||||
|
#### CrestronControlSystem
|
||||||
|
- **File**: `/src/PepperDash.Essentials/ControlSystem.cs`
|
||||||
|
- **Usage**: Base class for the main control system implementation
|
||||||
|
- **Implementation**: `public class ControlSystem : CrestronControlSystem, ILoadConfig`
|
||||||
|
|
||||||
|
#### Device (Base Class)
|
||||||
|
- **Files**: 50+ files inherit from or use this class
|
||||||
|
- **Key Implementations**:
|
||||||
|
- `/src/PepperDash.Core/Device.cs` - Core device abstraction
|
||||||
|
- `/src/PepperDash.Essentials.Core/Devices/EssentialsDevice.cs` - Extended device base
|
||||||
|
- `/src/PepperDash.Essentials.Core/Room/Room.cs` - Room device implementation
|
||||||
|
- `/src/PepperDash.Essentials.Core/Devices/CrestronProcessor.cs` - Processor device wrapper
|
||||||
|
|
||||||
|
#### BasicTriList
|
||||||
|
- **Files**: 30+ files use this class extensively
|
||||||
|
- **Primary Usage**: Touchpanel communication and SIMPL bridging
|
||||||
|
- **Key Files**:
|
||||||
|
- `/src/PepperDash.Essentials.Core/Touchpanels/TriListExtensions.cs` - Extension methods for signal handling
|
||||||
|
- `/src/PepperDash.Essentials.Core/Devices/EssentialsBridgeableDevice.cs` - Bridge interface
|
||||||
|
- `/src/PepperDash.Essentials.Core/Touchpanels/ModalDialog.cs` - UI dialog implementation
|
||||||
|
|
||||||
|
#### BasicTriListWithSmartObject
|
||||||
|
- **Files**: Multiple touchpanel and UI files
|
||||||
|
- **Usage**: Enhanced touchpanel support with smart object integration
|
||||||
|
- **Key Files**:
|
||||||
|
- `/src/PepperDash.Essentials.Core/Touchpanels/Interfaces.cs` - Interface definitions
|
||||||
|
- `/src/PepperDash.Essentials.Core/SmartObjects/SubpageReferenceList/SubpageReferenceList.cs`
|
||||||
|
|
||||||
|
## 2. Communication Hardware
|
||||||
|
|
||||||
|
### 2.1 Serial Communication (ComPort)
|
||||||
|
|
||||||
|
**Primary Class**: `ComPort`
|
||||||
|
**Key Files**:
|
||||||
|
- `/src/PepperDash.Essentials.Core/Comm and IR/ComPortController.cs`
|
||||||
|
- `/src/PepperDash.Essentials.Core/Comm and IR/CommFactory.cs`
|
||||||
|
|
||||||
|
**Usage Pattern**:
|
||||||
|
```csharp
|
||||||
|
public class ComPortController : Device, IBasicCommunicationWithStreamDebugging
|
||||||
|
public static ComPort GetComPort(EssentialsControlPropertiesConfig config)
|
||||||
|
```
|
||||||
|
|
||||||
|
**Interface Support**: `IComPorts` - Used for devices that provide multiple COM ports
|
||||||
|
|
||||||
|
### 2.2 IR Communication (IROutputPort)
|
||||||
|
|
||||||
|
**Primary Class**: `IROutputPort`
|
||||||
|
**Key Files**:
|
||||||
|
- `/src/PepperDash.Essentials.Core/Devices/IrOutputPortController.cs`
|
||||||
|
- `/src/PepperDash.Essentials.Core/Devices/GenericIRController.cs`
|
||||||
|
- `/src/PepperDash.Essentials.Core/Comm and IR/IRPortHelper.cs`
|
||||||
|
|
||||||
|
**Usage Pattern**:
|
||||||
|
```csharp
|
||||||
|
public class IrOutputPortController : Device
|
||||||
|
IROutputPort IrPort;
|
||||||
|
public IrOutputPortController(string key, IROutputPort port, string irDriverFilepath)
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2.3 CEC Communication (ICec)
|
||||||
|
|
||||||
|
**Primary Interface**: `ICec`
|
||||||
|
**Key Files**:
|
||||||
|
- `/src/PepperDash.Essentials.Core/Comm and IR/CecPortController.cs`
|
||||||
|
- `/src/PepperDash.Essentials.Core/Comm and IR/CommFactory.cs`
|
||||||
|
|
||||||
|
**Usage Pattern**:
|
||||||
|
```csharp
|
||||||
|
public class CecPortController : Device, IBasicCommunicationWithStreamDebugging
|
||||||
|
public static ICec GetCecPort(ControlPropertiesConfig config)
|
||||||
|
```
|
||||||
|
|
||||||
|
## 3. Input/Output Hardware
|
||||||
|
|
||||||
|
### 3.1 Digital Input
|
||||||
|
|
||||||
|
**Primary Interface**: `IDigitalInput`
|
||||||
|
**Key Files**:
|
||||||
|
- `/src/PepperDash.Essentials.Core/CrestronIO/GenericDigitalInputDevice.cs`
|
||||||
|
- `/src/PepperDash.Essentials.Core/Microphone Privacy/MicrophonePrivacyController.cs`
|
||||||
|
|
||||||
|
**Usage Pattern**:
|
||||||
|
```csharp
|
||||||
|
public List<IDigitalInput> Inputs { get; private set; }
|
||||||
|
void AddInput(IDigitalInput input)
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3.2 Versiport Support
|
||||||
|
|
||||||
|
**Key Files**:
|
||||||
|
- `/src/PepperDash.Essentials.Core/CrestronIO/GenericVersiportInputDevice.cs`
|
||||||
|
- `/src/PepperDash.Essentials.Core/CrestronIO/GenericVersiportAnalogInputDevice.cs`
|
||||||
|
- `/src/PepperDash.Essentials.Core/CrestronIO/GenericVersiportOutputDevice.cs`
|
||||||
|
|
||||||
|
**Usage**: Provides flexible I/O port configuration for various signal types
|
||||||
|
|
||||||
|
## 4. Touchpanel Hardware
|
||||||
|
|
||||||
|
### 4.1 MPC3 Touchpanel
|
||||||
|
|
||||||
|
**Primary Class**: `MPC3Basic`
|
||||||
|
**Key File**: `/src/PepperDash.Essentials.Core/Touchpanels/Mpc3Touchpanel.cs`
|
||||||
|
|
||||||
|
**Usage Pattern**:
|
||||||
|
```csharp
|
||||||
|
public class Mpc3TouchpanelController : Device
|
||||||
|
readonly MPC3Basic _touchpanel;
|
||||||
|
_touchpanel = processor.ControllerTouchScreenSlotDevice as MPC3Basic;
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4.2 TSW Series Support
|
||||||
|
|
||||||
|
**Evidence**: References found in messenger files and mobile control components
|
||||||
|
**Usage**: Integrated through mobile control messaging system for TSW touchpanel features
|
||||||
|
|
||||||
|
## 5. Timer and Threading
|
||||||
|
|
||||||
|
### 5.1 CTimer
|
||||||
|
|
||||||
|
**Primary Class**: `CTimer`
|
||||||
|
**Key File**: `/src/PepperDash.Core/PasswordManagement/PasswordManager.cs`
|
||||||
|
|
||||||
|
**Usage Pattern**:
|
||||||
|
```csharp
|
||||||
|
Debug.Console(1, string.Format("PasswordManager.UpdatePassword: CTimer Started"));
|
||||||
|
Debug.Console(1, string.Format("PasswordManager.UpdatePassword: CTimer Reset"));
|
||||||
|
```
|
||||||
|
|
||||||
|
## 6. Networking and Communication
|
||||||
|
|
||||||
|
### 6.1 Ethernet Communication
|
||||||
|
|
||||||
|
**Libraries Used**:
|
||||||
|
- `Crestron.SimplSharpPro.EthernetCommunication`
|
||||||
|
- `Crestron.SimplSharp.Net.Utilities.EthernetHelper`
|
||||||
|
|
||||||
|
**Key Files**:
|
||||||
|
- `/src/PepperDash.Core/Comm/GenericTcpIpClient.cs`
|
||||||
|
- `/src/PepperDash.Core/Comm/GenericTcpIpServer.cs`
|
||||||
|
- `/src/PepperDash.Core/Comm/GenericSecureTcpIpClient.cs`
|
||||||
|
- `/src/PepperDash.Core/Comm/GenericSshClient.cs`
|
||||||
|
- `/src/PepperDash.Core/Comm/GenericUdpServer.cs`
|
||||||
|
|
||||||
|
**Usage Pattern**:
|
||||||
|
```csharp
|
||||||
|
public class GenericTcpIpClient : Device, ISocketStatusWithStreamDebugging, IAutoReconnect
|
||||||
|
public class GenericSecureTcpIpClient : Device, ISocketStatusWithStreamDebugging, IAutoReconnect
|
||||||
|
```
|
||||||
|
|
||||||
|
## 7. Device Management Libraries
|
||||||
|
|
||||||
|
### 7.1 DeviceSupport
|
||||||
|
|
||||||
|
**Library**: `Crestron.SimplSharpPro.DeviceSupport`
|
||||||
|
**Usage**: Core device support infrastructure used throughout the framework
|
||||||
|
|
||||||
|
### 7.2 DM (DigitalMedia)
|
||||||
|
|
||||||
|
**Library**: `Crestron.SimplSharpPro.DM`
|
||||||
|
**Usage**: Digital media routing and switching support
|
||||||
|
**Evidence**: Found in routing configuration and DM output card references
|
||||||
|
|
||||||
|
## 8. User Interface Libraries
|
||||||
|
|
||||||
|
### 8.1 UI Components
|
||||||
|
|
||||||
|
**Library**: `Crestron.SimplSharpPro.UI`
|
||||||
|
**Usage**: User interface elements and touchpanel controls
|
||||||
|
|
||||||
|
### 8.2 Smart Objects
|
||||||
|
|
||||||
|
**Key Files**:
|
||||||
|
- `/src/PepperDash.Essentials.Core/SmartObjects/SmartObjectDynamicList.cs`
|
||||||
|
- `/src/PepperDash.Essentials.Core/SmartObjects/SubpageReferenceList/SubpageReferenceList.cs`
|
||||||
|
|
||||||
|
**Usage**: Advanced UI components with dynamic content
|
||||||
|
|
||||||
|
## 9. System Monitoring and Diagnostics
|
||||||
|
|
||||||
|
### 9.1 Diagnostics
|
||||||
|
|
||||||
|
**Library**: `Crestron.SimplSharpPro.Diagnostics`
|
||||||
|
**Usage**: System health monitoring and performance tracking
|
||||||
|
|
||||||
|
### 9.2 System Information
|
||||||
|
|
||||||
|
**Key Files**:
|
||||||
|
- `/src/PepperDash.Essentials.Core/Monitoring/SystemMonitorController.cs`
|
||||||
|
|
||||||
|
**Usage**: Provides system status, Ethernet information, and program details
|
||||||
|
|
||||||
|
## 10. Integration Patterns
|
||||||
|
|
||||||
|
### 10.1 SIMPL Bridging
|
||||||
|
|
||||||
|
**Pattern**: Extensive use of `BasicTriList` for SIMPL integration
|
||||||
|
**Files**: Bridge classes throughout the framework implement `LinkToApi` methods:
|
||||||
|
```csharp
|
||||||
|
public abstract void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge);
|
||||||
|
```
|
||||||
|
|
||||||
|
### 10.2 Device Factory Pattern
|
||||||
|
|
||||||
|
**Implementation**: Factory classes create hardware-specific implementations
|
||||||
|
**Example**: `CommFactory.cs` provides communication device creation
|
||||||
|
|
||||||
|
### 10.3 Extension Methods
|
||||||
|
|
||||||
|
**Pattern**: Extensive use of extension methods for Crestron classes
|
||||||
|
**Example**: `TriListExtensions.cs` adds 30+ extension methods to `BasicTriList`
|
||||||
|
|
||||||
|
## 11. Signal Processing
|
||||||
|
|
||||||
|
### 11.1 Signal Types
|
||||||
|
|
||||||
|
**Bool Signals**: Digital control and feedback
|
||||||
|
**UShort Signals**: Analog values and numeric data
|
||||||
|
**String Signals**: Text and configuration data
|
||||||
|
|
||||||
|
**Implementation**: Comprehensive signal handling in `TriListExtensions.cs`
|
||||||
|
|
||||||
|
## 12. Error Handling and Logging
|
||||||
|
|
||||||
|
**Pattern**: Consistent use of Crestron's Debug logging throughout
|
||||||
|
**Examples**:
|
||||||
|
```csharp
|
||||||
|
Debug.LogMessage(LogEventLevel.Information, "Device {0} is not a valid device", dc.PortDeviceKey);
|
||||||
|
Debug.LogMessage(LogEventLevel.Debug, "Error Waking Panel. Maybe testing with Xpanel?");
|
||||||
|
```
|
||||||
|
|
||||||
|
## 13. Threading and Synchronization
|
||||||
|
|
||||||
|
**Components**:
|
||||||
|
- CTimer for time-based operations
|
||||||
|
- Thread-safe collections and patterns
|
||||||
|
- Event-driven programming models
|
||||||
|
|
||||||
|
## Conclusion
|
||||||
|
|
||||||
|
The PepperDash Essentials framework demonstrates sophisticated integration with the Crestron ecosystem, leveraging:
|
||||||
|
|
||||||
|
- **Core Infrastructure**: CrestronControlSystem, Device base classes
|
||||||
|
- **Communication**: COM, IR, CEC, TCP/IP, SSH protocols
|
||||||
|
- **Hardware Abstraction**: Touchpanels, I/O devices, processors
|
||||||
|
- **User Interface**: Smart objects, signal processing, SIMPL bridging
|
||||||
|
- **System Services**: Monitoring, diagnostics, device management
|
||||||
|
|
||||||
|
This analysis shows that Essentials serves as a comprehensive middleware layer, abstracting Crestron hardware complexities while providing modern software development patterns and practices.
|
||||||
|
|
||||||
|
---
|
||||||
|
*Generated: [Current Date]*
|
||||||
|
*Framework Version: PepperDash Essentials (Based on codebase analysis)*
|
||||||
|
|
@ -84,10 +84,9 @@ namespace PepperDash.Core
|
||||||
port.TextReceived += Port_TextReceivedStringDelimiter;
|
port.TextReceived += Port_TextReceivedStringDelimiter;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Disconnects this gather from the Port's TextReceived event. This will not fire LineReceived
|
/// Stop method
|
||||||
/// after the this call.
|
/// </summary>
|
||||||
/// </summary>
|
|
||||||
public void Stop()
|
public void Stop()
|
||||||
{
|
{
|
||||||
Port.TextReceived -= Port_TextReceived;
|
Port.TextReceived -= Port_TextReceived;
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ namespace PepperDash.Core
|
||||||
private CTimer DebugExpiryPeriod;
|
private CTimer DebugExpiryPeriod;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The current debug setting
|
/// Gets or sets the DebugSetting
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public eStreamDebuggingSetting DebugSetting { get; private set; }
|
public eStreamDebuggingSetting DebugSetting { get; private set; }
|
||||||
|
|
||||||
|
|
@ -42,7 +42,7 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Indicates that receive stream debugging is enabled
|
/// Gets or sets the RxStreamDebuggingIsEnabled
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool RxStreamDebuggingIsEnabled{ get; private set; }
|
public bool RxStreamDebuggingIsEnabled{ get; private set; }
|
||||||
|
|
||||||
|
|
@ -65,6 +65,9 @@ namespace PepperDash.Core
|
||||||
/// Sets the debugging setting and if not setting to off, assumes the default of 30 mintues
|
/// 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)
|
||||||
|
|
@ -81,6 +84,9 @@ 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)
|
||||||
|
|
@ -135,6 +141,9 @@ namespace PepperDash.Core
|
||||||
/// The available settings for stream debugging
|
/// The available settings for stream debugging
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Flags]
|
[Flags]
|
||||||
|
/// <summary>
|
||||||
|
/// Enumeration of eStreamDebuggingSetting values
|
||||||
|
/// </summary>
|
||||||
public enum eStreamDebuggingSetting
|
public enum eStreamDebuggingSetting
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ using Newtonsoft.Json.Converters;
|
||||||
namespace PepperDash.Core
|
namespace PepperDash.Core
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Config properties that indicate how to communicate with a device for control
|
/// Represents a ControlPropertiesConfig
|
||||||
/// </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>
|
||||||
/// Port on server
|
/// Gets or sets the Port
|
||||||
/// </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>
|
||||||
/// bool to track if auto reconnect should be set on the socket
|
/// Gets or sets the AutoReconnect
|
||||||
/// </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>
|
||||||
/// Bool to show whether the server requires a preshared key. This is used in the DynamicTCPServer class
|
/// Gets or sets the SharedKeyRequired
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool SharedKeyRequired { get; set; }
|
public bool SharedKeyRequired { get; set; }
|
||||||
|
|
||||||
|
|
@ -207,7 +207,7 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// SharedKey is sent for varification to the server. Shared key can be any text (255 char limit in SIMPL+ Module), but must match the Shared Key on the Server module
|
/// Gets or sets the SharedKey
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string SharedKey { get; set; }
|
public string SharedKey { get; set; }
|
||||||
|
|
||||||
|
|
@ -222,7 +222,7 @@ namespace PepperDash.Core
|
||||||
bool IsTryingToConnect;
|
bool IsTryingToConnect;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Bool showing if socket is ready for communication after shared key exchange
|
/// Gets or sets the IsReadyForCommunication
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsReadyForCommunication { get; set; }
|
public bool IsReadyForCommunication { get; set; }
|
||||||
|
|
||||||
|
|
@ -342,7 +342,7 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Just to help S+ set the key
|
/// Initialize method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Initialize(string key)
|
public void Initialize(string key)
|
||||||
{
|
{
|
||||||
|
|
@ -421,6 +421,9 @@ 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)
|
||||||
|
|
@ -432,7 +435,7 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Connect Method. Will return if already connected. Will write errors if missing address, port, or unique key/name.
|
/// Connect method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Connect()
|
public void Connect()
|
||||||
{
|
{
|
||||||
|
|
@ -563,7 +566,7 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Disconnect method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Disconnect()
|
public void Disconnect()
|
||||||
{
|
{
|
||||||
|
|
@ -586,7 +589,7 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Does the actual disconnect business
|
/// DisconnectClient method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void DisconnectClient()
|
public void DisconnectClient()
|
||||||
{
|
{
|
||||||
|
|
@ -846,7 +849,7 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// General send method
|
/// SendText method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SendText(string text)
|
public void SendText(string text)
|
||||||
{
|
{
|
||||||
|
|
@ -875,7 +878,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>
|
||||||
/// Port on server
|
/// Gets or sets the Port
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int Port { get; set; }
|
public int Port { get; set; }
|
||||||
|
|
||||||
|
|
@ -113,7 +113,7 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// SharedKey is sent for varification to the server. Shared key can be any text (255 char limit in SIMPL+ Module), but must match the Shared Key on the Server module
|
/// Gets or sets the SharedKey
|
||||||
/// </summary>
|
/// </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>
|
||||||
/// Defaults to 2000
|
/// Gets or sets the BufferSize
|
||||||
/// </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>
|
||||||
/// Just to help S+ set the key
|
/// Initialize method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Initialize(string key)
|
public void Initialize(string key)
|
||||||
{
|
{
|
||||||
|
|
@ -395,7 +395,7 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Connect Method. Will return if already connected. Will write errors if missing address, port, or unique key/name.
|
/// Connect method
|
||||||
/// </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>
|
||||||
/// General send method
|
/// SendText 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>
|
||||||
/// 3 by default
|
/// Gets or sets the MonitorClientMaxFailureCount
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int MonitorClientMaxFailureCount { get; set; }
|
public int MonitorClientMaxFailureCount { get; set; }
|
||||||
|
|
||||||
|
|
@ -190,7 +190,7 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Port Server should listen on
|
/// Gets or sets the Port
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int Port { get; set; }
|
public int Port { get; set; }
|
||||||
|
|
||||||
|
|
@ -223,8 +223,7 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// SharedKey is sent for varification to the server. Shared key can be any text (255 char limit in SIMPL+ Module), but must match the Shared Key on the Server module.
|
/// Gets or sets the SharedKey
|
||||||
/// 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; }
|
||||||
|
|
||||||
|
|
@ -248,7 +247,7 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Milliseconds before server expects another heartbeat. Set by property HeartbeatRequiredIntervalInSeconds which is driven from S+
|
/// Gets or sets the HeartbeatRequiredIntervalMs
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int HeartbeatRequiredIntervalMs { get; set; }
|
public int HeartbeatRequiredIntervalMs { get; set; }
|
||||||
|
|
||||||
|
|
@ -258,7 +257,7 @@ namespace PepperDash.Core
|
||||||
public ushort HeartbeatRequiredIntervalInSeconds { set { HeartbeatRequiredIntervalMs = (value * 1000); } }
|
public ushort HeartbeatRequiredIntervalInSeconds { set { HeartbeatRequiredIntervalMs = (value * 1000); } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// String to Match for heartbeat. If null or empty any string will reset heartbeat timer
|
/// Gets or sets the HeartbeatStringToMatch
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string HeartbeatStringToMatch { get; set; }
|
public string HeartbeatStringToMatch { get; set; }
|
||||||
|
|
||||||
|
|
@ -276,7 +275,7 @@ namespace PepperDash.Core
|
||||||
public List<uint> ConnectedClientsIndexes = new List<uint>();
|
public List<uint> ConnectedClientsIndexes = new List<uint>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defaults to 2000
|
/// Gets or sets the BufferSize
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int BufferSize { get; set; }
|
public int BufferSize { get; set; }
|
||||||
|
|
||||||
|
|
@ -339,7 +338,7 @@ namespace PepperDash.Core
|
||||||
|
|
||||||
#region Methods - Server Actions
|
#region Methods - Server Actions
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Disconnects all clients and stops the server
|
/// KillServer method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void KillServer()
|
public void KillServer()
|
||||||
{
|
{
|
||||||
|
|
@ -356,6 +355,9 @@ 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;
|
||||||
|
|
@ -395,7 +397,7 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Start listening on the specified port
|
/// Listen method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Listen()
|
public void Listen()
|
||||||
{
|
{
|
||||||
|
|
@ -453,7 +455,7 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stop Listeneing
|
/// StopListening method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void StopListening()
|
public void StopListening()
|
||||||
{
|
{
|
||||||
|
|
@ -478,6 +480,9 @@ 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
|
||||||
|
|
@ -491,7 +496,7 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Disconnect All Clients
|
/// DisconnectAllClientsForShutdown method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void DisconnectAllClientsForShutdown()
|
public void DisconnectAllClientsForShutdown()
|
||||||
{
|
{
|
||||||
|
|
@ -533,6 +538,9 @@ 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();
|
||||||
|
|
@ -566,6 +574,9 @@ 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
|
||||||
|
|
@ -634,6 +645,9 @@ 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);
|
||||||
|
|
|
||||||
|
|
@ -36,13 +36,13 @@ namespace PepperDash.Core
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event EventHandler<GenericSocketStatusChageEventArgs> ConnectionChange;
|
public event EventHandler<GenericSocketStatusChageEventArgs> ConnectionChange;
|
||||||
|
|
||||||
///// <summary>
|
/// <summary>
|
||||||
/////
|
/////
|
||||||
///// </summary>
|
///// </summary>
|
||||||
//public event GenericSocketStatusChangeEventDelegate SocketStatusChange;
|
//public event GenericSocketStatusChangeEventDelegate SocketStatusChange;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Address of server
|
/// Gets or sets the Hostname
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Hostname { get; set; }
|
public string Hostname { get; set; }
|
||||||
|
|
||||||
|
|
@ -52,12 +52,12 @@ namespace PepperDash.Core
|
||||||
public int Port { get; set; }
|
public int Port { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Username for server
|
/// Gets or sets the Username
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Username { get; set; }
|
public string Username { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// And... Password for server. That was worth documenting!
|
/// Gets or sets the Password
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Password { get; set; }
|
public string Password { get; set; }
|
||||||
|
|
||||||
|
|
@ -79,7 +79,7 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Socket status change event
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public SocketStatus ClientStatus
|
public SocketStatus ClientStatus
|
||||||
{
|
{
|
||||||
|
|
@ -123,8 +123,7 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Millisecond value, determines the timeout period in between reconnect attempts.
|
/// Gets or sets the AutoReconnectIntervalMs
|
||||||
/// Set to 5000 by default
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int AutoReconnectIntervalMs { get; set; }
|
public int AutoReconnectIntervalMs { get; set; }
|
||||||
|
|
||||||
|
|
@ -147,31 +146,31 @@ 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 CTimer(o =>
|
ReconnectTimer = new CTimer(o =>
|
||||||
{
|
{
|
||||||
if (ConnectEnabled)
|
if (ConnectEnabled)
|
||||||
{
|
{
|
||||||
Connect();
|
Connect();
|
||||||
}
|
}
|
||||||
}, 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 CTimer(o =>
|
ReconnectTimer = new CTimer(o =>
|
||||||
{
|
{
|
||||||
|
|
@ -180,25 +179,25 @@ namespace PepperDash.Core
|
||||||
Connect();
|
Connect();
|
||||||
}
|
}
|
||||||
}, 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>
|
||||||
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 to the server, using the provided properties.
|
/// Connect method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Connect()
|
public void Connect()
|
||||||
{
|
{
|
||||||
|
|
@ -224,10 +223,7 @@ namespace PepperDash.Core
|
||||||
this.LogDebug("Attempting connect");
|
this.LogDebug("Attempting connect");
|
||||||
|
|
||||||
// Cancel reconnect if running.
|
// Cancel reconnect if running.
|
||||||
if (ReconnectTimer != null)
|
ReconnectTimer?.Stop();
|
||||||
{
|
|
||||||
ReconnectTimer.Stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Cleanup the old client if it already exists
|
// Cleanup the old client if it already exists
|
||||||
if (Client != null)
|
if (Client != null)
|
||||||
|
|
@ -269,20 +265,26 @@ namespace PepperDash.Core
|
||||||
|
|
||||||
if (ie is SocketException)
|
if (ie is SocketException)
|
||||||
{
|
{
|
||||||
this.LogException(ie, "CONNECTION failure: Cannot reach host");
|
this.LogError("CONNECTION failure: Cannot reach host");
|
||||||
|
this.LogVerbose(ie, "Exception details: ");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ie is System.Net.Sockets.SocketException socketException)
|
if (ie is System.Net.Sockets.SocketException socketException)
|
||||||
{
|
{
|
||||||
this.LogException(ie, "Connection failure: Cannot reach {host} on {port}",
|
this.LogError("Connection failure: Cannot reach {host} on {port}",
|
||||||
Hostname, Port);
|
Hostname, Port);
|
||||||
|
this.LogVerbose(socketException, "SocketException details: ");
|
||||||
}
|
}
|
||||||
if (ie is SshAuthenticationException)
|
if (ie is SshAuthenticationException)
|
||||||
{
|
{
|
||||||
this.LogException(ie, "Authentication failure for username {userName}", Username);
|
this.LogError("Authentication failure for username {userName}", Username);
|
||||||
|
this.LogVerbose(ie, "AuthenticationException details: ");
|
||||||
}
|
}
|
||||||
else
|
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);
|
||||||
|
|
@ -292,7 +294,7 @@ namespace PepperDash.Core
|
||||||
ReconnectTimer.Reset(AutoReconnectIntervalMs);
|
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);
|
||||||
|
|
||||||
|
|
@ -307,7 +309,8 @@ namespace PepperDash.Core
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
var errorLogLevel = DisconnectLogged == true ? Debug.ErrorLogLevel.None : Debug.ErrorLogLevel.Error;
|
var errorLogLevel = DisconnectLogged == true ? Debug.ErrorLogLevel.None : Debug.ErrorLogLevel.Error;
|
||||||
this.LogException(e, "Unhandled exception on connect");
|
this.LogError("Unhandled exception on connect: {error}", e.Message);
|
||||||
|
this.LogVerbose(e, "Exception details: ");
|
||||||
DisconnectLogged = true;
|
DisconnectLogged = true;
|
||||||
KillClient(SocketStatus.SOCKET_STATUS_CONNECT_FAILED);
|
KillClient(SocketStatus.SOCKET_STATUS_CONNECT_FAILED);
|
||||||
if (AutoReconnect)
|
if (AutoReconnect)
|
||||||
|
|
@ -324,18 +327,18 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Disconnect the clients and put away it's resources.
|
/// Disconnect method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Disconnect()
|
public void Disconnect()
|
||||||
{
|
{
|
||||||
ConnectEnabled = false;
|
ConnectEnabled = false;
|
||||||
// Stop trying reconnects, if we are
|
// Stop trying reconnects, if we are
|
||||||
if (ReconnectTimer != null)
|
if (ReconnectTimer != null)
|
||||||
{
|
{
|
||||||
ReconnectTimer.Stop();
|
ReconnectTimer.Stop();
|
||||||
// ReconnectTimer = null;
|
// ReconnectTimer = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
KillClient(SocketStatus.SOCKET_STATUS_BROKEN_LOCALLY);
|
KillClient(SocketStatus.SOCKET_STATUS_BROKEN_LOCALLY);
|
||||||
}
|
}
|
||||||
|
|
@ -361,7 +364,7 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
this.LogException(ex,"Exception in Kill Client");
|
this.LogException(ex, "Exception in Kill Client");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -369,7 +372,7 @@ namespace PepperDash.Core
|
||||||
/// Kills the stream
|
/// Kills the stream
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void KillStream()
|
void KillStream()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (TheStream != null)
|
if (TheStream != null)
|
||||||
|
|
@ -385,59 +388,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>
|
||||||
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>
|
||||||
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);
|
||||||
if (StreamDebugging.RxStreamDebuggingIsEnabled)
|
if (StreamDebugging.RxStreamDebuggingIsEnabled)
|
||||||
{
|
{
|
||||||
this.LogInformation("Received {1} bytes: '{0}'", ComTextHelper.GetEscapedText(bytes), bytes.Length);
|
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)
|
||||||
{
|
{
|
||||||
if (StreamDebugging.RxStreamDebuggingIsEnabled)
|
if (StreamDebugging.RxStreamDebuggingIsEnabled)
|
||||||
this.LogInformation("Received: '{0}'", ComTextHelper.GetDebugText(response));
|
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>
|
||||||
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)
|
||||||
|
|
@ -466,55 +469,54 @@ namespace PepperDash.Core
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void OnConnectionChange()
|
void OnConnectionChange()
|
||||||
{
|
{
|
||||||
if (ConnectionChange != null)
|
ConnectionChange?.Invoke(this, new GenericSocketStatusChageEventArgs(this));
|
||||||
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"></param>
|
/// <param name="text">The text to send</param>
|
||||||
public void SendText(string text)
|
public void SendText(string text)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
|
||||||
if (Client != null && TheStream != null && IsConnected)
|
|
||||||
{
|
|
||||||
if (StreamDebugging.TxStreamDebuggingIsEnabled)
|
|
||||||
this.LogInformation(
|
|
||||||
"Sending {length} characters of text: '{text}'",
|
|
||||||
text.Length,
|
|
||||||
ComTextHelper.GetDebugText(text));
|
|
||||||
|
|
||||||
TheStream.Write(text);
|
|
||||||
TheStream.Flush();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.LogDebug("Client is null or disconnected. Cannot Send Text");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (ObjectDisposedException)
|
|
||||||
{
|
{
|
||||||
this.LogError("ObjectDisposedException sending '{message}'. Restarting connection...", text.Trim());
|
if (Client != null && TheStream != null && IsConnected)
|
||||||
|
{
|
||||||
|
if (StreamDebugging.TxStreamDebuggingIsEnabled)
|
||||||
|
this.LogInformation(
|
||||||
|
"Sending {length} characters of text: '{text}'",
|
||||||
|
text.Length,
|
||||||
|
ComTextHelper.GetDebugText(text));
|
||||||
|
|
||||||
|
TheStream.Write(text);
|
||||||
|
TheStream.Flush();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.LogDebug("Client is null or disconnected. Cannot Send Text");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (ObjectDisposedException)
|
||||||
|
{
|
||||||
|
this.LogError("ObjectDisposedException sending '{message}'. Restarting connection...", text.Trim());
|
||||||
|
|
||||||
KillClient(SocketStatus.SOCKET_STATUS_CONNECT_FAILED);
|
KillClient(SocketStatus.SOCKET_STATUS_CONNECT_FAILED);
|
||||||
ReconnectTimer.Reset();
|
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"></param>
|
/// <param name="bytes">The bytes to send</param>
|
||||||
public void SendBytes(byte[] bytes)
|
public void SendBytes(byte[] bytes)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (Client != null && TheStream != null && IsConnected)
|
if (Client != null && TheStream != null && IsConnected)
|
||||||
|
|
@ -540,38 +542,38 @@ namespace PepperDash.Core
|
||||||
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>
|
/// <summary>
|
||||||
/// Fired when connection changes
|
/// Represents a SshConnectionChangeEventArgs
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SshConnectionChangeEventArgs : EventArgs
|
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>
|
||||||
/// Connection Status represented as a ushort
|
/// Gets or sets the UIsConnected
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ushort UIsConnected { get { return (ushort)(Client.IsConnected ? 1 : 0); } }
|
public ushort UIsConnected { get { return (ushort)(Client.IsConnected ? 1 : 0); } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The client
|
/// Gets or sets the Client
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public GenericSshClient Client { get; private set; }
|
public GenericSshClient Client { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Socket Status as represented by
|
/// Gets or sets the Status
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ushort Status { get { return Client.UStatus; } }
|
public ushort Status { get { return Client.UStatus; } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// S+ Constructor
|
/// S+ Constructor
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Port on server
|
/// Gets or sets the Port
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int Port { get; set; }
|
public int Port { get; set; }
|
||||||
|
|
||||||
|
|
@ -135,9 +135,9 @@ namespace PepperDash.Core
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ConnectionFailure { get { return ClientStatus.ToString(); } }
|
public string ConnectionFailure { get { return ClientStatus.ToString(); } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// bool to track if auto reconnect should be set on the socket
|
/// Gets or sets the AutoReconnect
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool AutoReconnect { get; set; }
|
public bool AutoReconnect { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -232,7 +232,7 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Just to help S+ set the key
|
/// Initialize method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Initialize(string key)
|
public void Initialize(string key)
|
||||||
{
|
{
|
||||||
|
|
@ -255,6 +255,9 @@ namespace PepperDash.Core
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
/// <summary>
|
||||||
|
/// Deactivate method
|
||||||
|
/// </summary>
|
||||||
public override bool Deactivate()
|
public override bool Deactivate()
|
||||||
{
|
{
|
||||||
RetryTimer.Stop();
|
RetryTimer.Stop();
|
||||||
|
|
@ -267,9 +270,9 @@ namespace PepperDash.Core
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Attempts to connect to the server
|
/// Connect method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Connect()
|
public void Connect()
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(Hostname))
|
if (string.IsNullOrEmpty(Hostname))
|
||||||
|
|
@ -334,9 +337,9 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Attempts to disconnect the client
|
/// Disconnect method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Disconnect()
|
public void Disconnect()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
@ -355,7 +358,7 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Does the actual disconnect business
|
/// DisconnectClient method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void DisconnectClient()
|
public void DisconnectClient()
|
||||||
{
|
{
|
||||||
|
|
@ -446,9 +449,9 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// General send method
|
/// SendText 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);
|
||||||
|
|
@ -459,9 +462,9 @@ namespace PepperDash.Core
|
||||||
_client.SendData(bytes, bytes.Length);
|
_client.SendData(bytes, bytes.Length);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This is useful from console and...?
|
/// SendEscapedText method
|
||||||
/// </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 =>
|
||||||
|
|
@ -476,6 +479,9 @@ namespace PepperDash.Core
|
||||||
/// Sends Bytes to the server
|
/// Sends Bytes to the server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="bytes"></param>
|
/// <param name="bytes"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// SendBytes method
|
||||||
|
/// </summary>
|
||||||
public void SendBytes(byte[] bytes)
|
public void SendBytes(byte[] bytes)
|
||||||
{
|
{
|
||||||
if (StreamDebugging.TxStreamDebuggingIsEnabled)
|
if (StreamDebugging.TxStreamDebuggingIsEnabled)
|
||||||
|
|
@ -508,9 +514,9 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Configuration properties for TCP/SSH Connections
|
/// Represents a TcpSshPropertiesConfig
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class TcpSshPropertiesConfig
|
public class TcpSshPropertiesConfig
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -529,9 +535,9 @@ namespace PepperDash.Core
|
||||||
/// Username credential
|
/// Username credential
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Username { get; set; }
|
public string Username { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Passord credential
|
/// Gets or sets the Password
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Password { get; set; }
|
public string Password { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -539,14 +545,14 @@ namespace PepperDash.Core
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int BufferSize { get; set; }
|
public int BufferSize { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defaults to true
|
/// Gets or sets the AutoReconnect
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool AutoReconnect { get; set; }
|
public bool AutoReconnect { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defaults to 5000ms
|
/// Gets or sets the AutoReconnectIntervalMs
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int AutoReconnectIntervalMs { get; set; }
|
public int AutoReconnectIntervalMs { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ namespace PepperDash.Core
|
||||||
public string Hostname { get; set; }
|
public string Hostname { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Port on server
|
/// Gets or sets the Port
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int Port { get; set; }
|
public int Port { get; set; }
|
||||||
|
|
||||||
|
|
@ -102,7 +102,7 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// SharedKey is sent for varification to the server. Shared key can be any text (255 char limit in SIMPL+ Module), but must match the Shared Key on the Server module
|
/// Gets or sets the SharedKey
|
||||||
/// </summary>
|
/// </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>
|
||||||
/// Defaults to 2000
|
/// Gets or sets the BufferSize
|
||||||
/// </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>
|
||||||
/// Just to help S+ set the key
|
/// Initialize method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Initialize(string key)
|
public void Initialize(string key)
|
||||||
{
|
{
|
||||||
|
|
@ -311,7 +311,7 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Connect Method. Will return if already connected. Will write errors if missing address, port, or unique key/name.
|
/// Connect method
|
||||||
/// </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>
|
||||||
/// General send method
|
/// SendText 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>
|
||||||
/// 3 by default
|
/// Gets or sets the MonitorClientMaxFailureCount
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int MonitorClientMaxFailureCount { get; set; }
|
public int MonitorClientMaxFailureCount { get; set; }
|
||||||
|
|
||||||
|
|
@ -171,7 +171,7 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Port Server should listen on
|
/// Gets or sets the Port
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int Port { get; set; }
|
public int Port { get; set; }
|
||||||
|
|
||||||
|
|
@ -204,8 +204,7 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// SharedKey is sent for varification to the server. Shared key can be any text (255 char limit in SIMPL+ Module), but must match the Shared Key on the Server module.
|
/// Gets or sets the SharedKey
|
||||||
/// 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; }
|
||||||
|
|
||||||
|
|
@ -229,7 +228,7 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Milliseconds before server expects another heartbeat. Set by property HeartbeatRequiredIntervalInSeconds which is driven from S+
|
/// Gets or sets the HeartbeatRequiredIntervalMs
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int HeartbeatRequiredIntervalMs { get; set; }
|
public int HeartbeatRequiredIntervalMs { get; set; }
|
||||||
|
|
||||||
|
|
@ -239,7 +238,7 @@ namespace PepperDash.Core
|
||||||
public ushort HeartbeatRequiredIntervalInSeconds { set { HeartbeatRequiredIntervalMs = (value * 1000); } }
|
public ushort HeartbeatRequiredIntervalInSeconds { set { HeartbeatRequiredIntervalMs = (value * 1000); } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// String to Match for heartbeat. If null or empty any string will reset heartbeat timer
|
/// Gets or sets the HeartbeatStringToMatch
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string HeartbeatStringToMatch { get; set; }
|
public string HeartbeatStringToMatch { get; set; }
|
||||||
|
|
||||||
|
|
@ -257,7 +256,7 @@ namespace PepperDash.Core
|
||||||
public List<uint> ConnectedClientsIndexes = new List<uint>();
|
public List<uint> ConnectedClientsIndexes = new List<uint>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defaults to 2000
|
/// Gets or sets the BufferSize
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int BufferSize { get; set; }
|
public int BufferSize { get; set; }
|
||||||
|
|
||||||
|
|
@ -320,7 +319,7 @@ namespace PepperDash.Core
|
||||||
|
|
||||||
#region Methods - Server Actions
|
#region Methods - Server Actions
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Disconnects all clients and stops the server
|
/// KillServer method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void KillServer()
|
public void KillServer()
|
||||||
{
|
{
|
||||||
|
|
@ -337,6 +336,9 @@ 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;
|
||||||
|
|
@ -375,7 +377,7 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Start listening on the specified port
|
/// Listen method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Listen()
|
public void Listen()
|
||||||
{
|
{
|
||||||
|
|
@ -432,7 +434,7 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stop Listening
|
/// StopListening method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void StopListening()
|
public void StopListening()
|
||||||
{
|
{
|
||||||
|
|
@ -457,6 +459,9 @@ 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
|
||||||
|
|
@ -470,7 +475,7 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Disconnect All Clients
|
/// DisconnectAllClientsForShutdown method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void DisconnectAllClientsForShutdown()
|
public void DisconnectAllClientsForShutdown()
|
||||||
{
|
{
|
||||||
|
|
@ -512,6 +517,9 @@ 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();
|
||||||
|
|
@ -545,6 +553,9 @@ 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
|
||||||
|
|
@ -613,6 +624,9 @@ 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);
|
||||||
|
|
|
||||||
|
|
@ -150,6 +150,9 @@ 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;
|
||||||
|
|
@ -185,7 +188,7 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Enables the UDP Server
|
/// Connect method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Connect()
|
public void Connect()
|
||||||
{
|
{
|
||||||
|
|
@ -222,7 +225,7 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Disabled the UDP Server
|
/// Disconnect method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Disconnect()
|
public void Disconnect()
|
||||||
{
|
{
|
||||||
|
|
@ -292,6 +295,9 @@ 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);
|
||||||
|
|
@ -309,6 +315,9 @@ 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)
|
||||||
{
|
{
|
||||||
if (StreamDebugging.TxStreamDebuggingIsEnabled)
|
if (StreamDebugging.TxStreamDebuggingIsEnabled)
|
||||||
|
|
@ -320,9 +329,9 @@ namespace PepperDash.Core
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Represents a GenericUdpReceiveTextExtraArgs
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class GenericUdpReceiveTextExtraArgs : EventArgs
|
public class GenericUdpReceiveTextExtraArgs : EventArgs
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
namespace PepperDash.Core
|
namespace PepperDash.Core
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Client config object for TCP client with server that inherits from TcpSshPropertiesConfig and adds properties for shared key and heartbeat
|
/// Represents a TcpClientConfigObject
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class TcpClientConfigObject
|
public class TcpClientConfigObject
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -38,9 +38,9 @@ namespace PepperDash.Core
|
||||||
void Disconnect();
|
void Disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a device that uses basic connection
|
/// Defines the contract for IBasicCommunication
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IBasicCommunication : ICommunicationReceiver
|
public interface IBasicCommunication : ICommunicationReceiver
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -147,9 +147,9 @@ namespace PepperDash.Core
|
||||||
/// </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>
|
||||||
|
|
@ -228,6 +228,9 @@ namespace PepperDash.Core
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="text"></param>
|
/// <param name="text"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
/// <summary>
|
||||||
|
/// GetEscapedText method
|
||||||
|
/// </summary>
|
||||||
public static string GetEscapedText(string text)
|
public static string GetEscapedText(string text)
|
||||||
{
|
{
|
||||||
var bytes = Encoding.GetEncoding(28591).GetBytes(text);
|
var bytes = Encoding.GetEncoding(28591).GetBytes(text);
|
||||||
|
|
@ -239,6 +242,9 @@ namespace PepperDash.Core
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="text"></param>
|
/// <param name="text"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
/// <summary>
|
||||||
|
/// GetDebugText method
|
||||||
|
/// </summary>
|
||||||
public static string GetDebugText(string text)
|
public static string GetDebugText(string text)
|
||||||
{
|
{
|
||||||
return Regex.Replace(text, @"[^\u0020-\u007E]", a => GetEscapedText(a.Value));
|
return Regex.Replace(text, @"[^\u0020-\u007E]", a => GetEscapedText(a.Value));
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,9 @@ 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"]);
|
||||||
|
|
|
||||||
|
|
@ -6,13 +6,22 @@ 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>
|
||||||
/// The core event and status-bearing class that most if not all device and connectors can derive from.
|
/// Represents a Device
|
||||||
/// </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>
|
||||||
/// Name of the devie
|
/// Gets or sets the Name
|
||||||
/// </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,6 +86,9 @@ 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)
|
||||||
|
|
@ -93,9 +96,9 @@ namespace PepperDash.Core
|
||||||
_PostActivationActions.Add(act);
|
_PostActivationActions.Add(act);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Executes the preactivation actions
|
/// PreActivate method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void PreActivate()
|
public void PreActivate()
|
||||||
{
|
{
|
||||||
if (_PreActivationActions != null)
|
if (_PreActivationActions != null)
|
||||||
|
|
@ -112,11 +115,9 @@ namespace PepperDash.Core
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets this device ready to be used in the system. Runs any added pre-activation items, and
|
/// Activate method
|
||||||
/// all post-activation at end. Classes needing additional logic to
|
/// </summary>
|
||||||
/// run should override CustomActivate()
|
|
||||||
/// </summary>
|
|
||||||
public bool Activate()
|
public bool Activate()
|
||||||
{
|
{
|
||||||
//if (_PreActivationActions != null)
|
//if (_PreActivationActions != null)
|
||||||
|
|
@ -127,9 +128,9 @@ namespace PepperDash.Core
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Executes the postactivation actions
|
/// PostActivate method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void PostActivate()
|
public void PostActivate()
|
||||||
{
|
{
|
||||||
if (_PostActivationActions != null)
|
if (_PostActivationActions != null)
|
||||||
|
|
@ -152,6 +153,9 @@ 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>
|
||||||
|
|
@ -178,12 +182,15 @@ 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>
|
||||||
/// Class to help with accessing values from the CrestronEthernetHelper class
|
/// Represents a EthernetHelper
|
||||||
/// </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>
|
||||||
/// Boolean ushort value property
|
/// Gets or sets the IntValue
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ushort IntValue { get { return (ushort)(State ? 1 : 0); } }
|
public ushort IntValue { get { return (ushort)(State ? 1 : 0); } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Boolean change event args type
|
/// Gets or sets the Type
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ushort Type { get; set; }
|
public ushort Type { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Boolean change event args index
|
/// Gets or sets the Index
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ushort Index { get; set; }
|
public ushort Index { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -64,9 +64,9 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ushort change event args
|
/// Represents a UshrtChangeEventArgs
|
||||||
/// </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>
|
||||||
/// Ushort change event args type
|
/// Gets or sets the Type
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ushort Type { get; set; }
|
public ushort Type { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ushort change event args index
|
/// Gets or sets the Index
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ushort Index { get; set; }
|
public ushort Index { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -117,9 +117,9 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// String change event args
|
/// Represents a StringChangeEventArgs
|
||||||
/// </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>
|
||||||
/// String change event args type
|
/// Gets or sets the Type
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ushort Type { get; set; }
|
public ushort Type { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// string change event args index
|
/// Gets or sets the 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>
|
||||||
/// Device change event args type
|
/// Gets or sets the Type
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ushort Type { get; set; }
|
public ushort Type { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Device change event args index
|
/// Gets or sets the Index
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ushort Index { get; set; }
|
public ushort Index { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,9 @@ 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>
|
||||||
/// Device communication parameter class
|
/// Represents a ComParamsConfig
|
||||||
/// </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>
|
||||||
/// Device properties class
|
/// Represents a PropertiesConfig
|
||||||
/// </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>
|
||||||
/// S+ types enum
|
/// Enumeration of SPlusType values
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public enum SPlusType
|
public enum SPlusType
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,9 @@ 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)
|
||||||
|
|
@ -49,9 +52,9 @@ namespace PepperDash.Core.JsonToSimpl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a master by its key. Case-insensitive
|
/// GetMasterByFile method
|
||||||
/// </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>
|
||||||
/// Used to interact with an array of values with the S+ modules
|
/// Represents a JsonToSimplArrayLookupChild
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class JsonToSimplArrayLookupChild : JsonToSimplChildObjectBase
|
public class JsonToSimplArrayLookupChild : JsonToSimplChildObjectBase
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -76,9 +76,10 @@ namespace PepperDash.Core.JsonToSimpl
|
||||||
PathSuffix == null ? "" : PathSuffix);
|
PathSuffix == null ? "" : PathSuffix);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Process all values
|
/// ProcessAll method
|
||||||
/// </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>
|
||||||
/// Use a callback to reduce task switch/threading
|
/// Gets or sets the SetAllPathsDelegate
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public SPlusValuesDelegate SetAllPathsDelegate { get; set; }
|
public SPlusValuesDelegate SetAllPathsDelegate { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Unique identifier for instance
|
/// Gets or sets the Key
|
||||||
/// </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>
|
||||||
/// Indicates if the instance is linked to an object
|
/// Gets or sets the LinkedToObject
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool LinkedToObject { get; protected set; }
|
public bool LinkedToObject { get; protected set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -96,6 +96,9 @@ 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;
|
||||||
|
|
@ -110,9 +113,9 @@ namespace PepperDash.Core.JsonToSimpl
|
||||||
BoolPaths[index] = path;
|
BoolPaths[index] = path;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set the JPath for a ushort out index.
|
/// SetUshortPath method
|
||||||
/// </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);
|
||||||
|
|
@ -120,9 +123,9 @@ namespace PepperDash.Core.JsonToSimpl
|
||||||
UshortPaths[index] = path;
|
UshortPaths[index] = path;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set the JPath for a string output index.
|
/// SetStringPath method
|
||||||
/// </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);
|
||||||
|
|
@ -130,10 +133,10 @@ namespace PepperDash.Core.JsonToSimpl
|
||||||
StringPaths[index] = path;
|
StringPaths[index] = path;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Evalutates all outputs with defined paths. called by S+ when paths are ready to process
|
/// ProcessAll method
|
||||||
/// and by Master when file is read.
|
/// </summary>
|
||||||
/// </summary>
|
/// <inheritdoc />
|
||||||
public virtual void ProcessAll()
|
public virtual void ProcessAll()
|
||||||
{
|
{
|
||||||
if (!LinkedToObject)
|
if (!LinkedToObject)
|
||||||
|
|
@ -277,6 +280,9 @@ 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);
|
||||||
|
|
@ -287,6 +293,9 @@ 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))
|
||||||
|
|
@ -298,6 +307,9 @@ 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))
|
||||||
|
|
@ -309,6 +321,9 @@ 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))
|
||||||
|
|
@ -320,6 +335,9 @@ 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>
|
||||||
/// Filepath to the actual file that will be read (Portal or local)
|
/// Gets or sets the ActualFilePath
|
||||||
/// </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,6 +194,9 @@ 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>
|
||||||
/// Generic Master
|
/// Represents a JsonToSimplGenericMaster
|
||||||
/// </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>
|
||||||
/// Callback action for saving
|
/// Gets or sets the SaveCallback
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Action<string> SaveCallback { get; set; }
|
public Action<string> SaveCallback { get; set; }
|
||||||
|
|
||||||
/*****************************************************************************************/
|
/*****************************************************************************************/
|
||||||
|
|
@ -60,6 +60,9 @@ namespace PepperDash.Core.JsonToSimpl
|
||||||
/// Loads JSON into JsonObject, but does not trigger evaluation by children
|
/// 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
|
||||||
|
|
@ -72,9 +75,10 @@ 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>
|
||||||
/// A unique ID
|
/// Gets or sets the UniqueID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string UniqueID { get; protected set; }
|
public string UniqueID { get; protected set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -53,10 +53,9 @@ namespace PepperDash.Core.JsonToSimpl
|
||||||
}
|
}
|
||||||
string _DebugName = "";
|
string _DebugName = "";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This will be prepended to all paths to allow path swapping or for more organized
|
/// Gets or sets the PathPrefix
|
||||||
/// sub-paths
|
/// </summary>
|
||||||
/// </summary>
|
|
||||||
public string PathPrefix { get; set; }
|
public string PathPrefix { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -83,9 +82,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; }
|
||||||
|
|
||||||
/*****************************************************************************************/
|
/*****************************************************************************************/
|
||||||
|
|
@ -120,6 +119,9 @@ 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))
|
||||||
|
|
@ -128,9 +130,9 @@ namespace PepperDash.Core.JsonToSimpl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called from the child to add changed or new values for saving
|
/// AddUnsavedValue method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void AddUnsavedValue(string path, JValue value)
|
public void AddUnsavedValue(string path, JValue value)
|
||||||
{
|
{
|
||||||
if (UnsavedValues.ContainsKey(path))
|
if (UnsavedValues.ContainsKey(path))
|
||||||
|
|
@ -179,6 +181,9 @@ 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>
|
||||||
/// File path of the actual file being read (Portal or local)
|
/// Gets or sets the ActualFilePath
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ActualFilePath { get; private set; }
|
public string ActualFilePath { get; private set; }
|
||||||
|
|
||||||
|
|
@ -128,6 +128,9 @@ 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,6 +9,9 @@ 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;
|
||||||
|
|
@ -27,6 +30,9 @@ 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);
|
||||||
|
|
|
||||||
|
|
@ -78,12 +78,12 @@ namespace PepperDash.Core
|
||||||
public static string FileName = string.Format(@"app{0}Debug.json", InitialParametersClass.ApplicationNumber);
|
public static string FileName = string.Format(@"app{0}Debug.json", InitialParametersClass.ApplicationNumber);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Debug level to set for a given program.
|
/// Gets or sets the Level
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static int Level { get; private set; }
|
public static int Level { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// When this is true, the configuration file will NOT be loaded until triggered by either a console command or a signal
|
/// Gets or sets the DoNotLoadConfigOnNextBoot
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static bool DoNotLoadConfigOnNextBoot { get; private set; }
|
public static bool DoNotLoadConfigOnNextBoot { get; private set; }
|
||||||
|
|
||||||
|
|
@ -94,7 +94,7 @@ namespace PepperDash.Core
|
||||||
public static bool IsRunningOnAppliance = CrestronEnvironment.DevicePlatform == eDevicePlatform.Appliance;
|
public static bool IsRunningOnAppliance = CrestronEnvironment.DevicePlatform == eDevicePlatform.Appliance;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Version for the currently loaded PepperDashCore dll
|
/// Gets or sets the PepperDashCoreVersion
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string PepperDashCoreVersion { get; private set; }
|
public static string PepperDashCoreVersion { get; private set; }
|
||||||
|
|
||||||
|
|
@ -233,6 +233,9 @@ namespace PepperDash.Core
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// UpdateLoggerConfiguration method
|
||||||
|
/// </summary>
|
||||||
public static void UpdateLoggerConfiguration(LoggerConfiguration config)
|
public static void UpdateLoggerConfiguration(LoggerConfiguration config)
|
||||||
{
|
{
|
||||||
_loggerConfiguration = config;
|
_loggerConfiguration = config;
|
||||||
|
|
@ -240,6 +243,9 @@ namespace PepperDash.Core
|
||||||
_logger = config.CreateLogger();
|
_logger = config.CreateLogger();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ResetLoggerConfiguration method
|
||||||
|
/// </summary>
|
||||||
public static void ResetLoggerConfiguration()
|
public static void ResetLoggerConfiguration()
|
||||||
{
|
{
|
||||||
_loggerConfiguration = _defaultLoggerConfiguration;
|
_loggerConfiguration = _defaultLoggerConfiguration;
|
||||||
|
|
@ -319,6 +325,9 @@ 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 static void SetDebugFromConsole(string levelString)
|
public static void SetDebugFromConsole(string levelString)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
@ -371,6 +380,9 @@ namespace PepperDash.Core
|
||||||
/// Sets the debug level
|
/// Sets the debug level
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="level"> Valid values 0-5</param>
|
/// <param name="level"> Valid values 0-5</param>
|
||||||
|
/// <summary>
|
||||||
|
/// SetDebugLevel method
|
||||||
|
/// </summary>
|
||||||
public static void SetDebugLevel(uint level)
|
public static void SetDebugLevel(uint level)
|
||||||
{
|
{
|
||||||
if(!_logLevels.TryGetValue(level, out var logLevel))
|
if(!_logLevels.TryGetValue(level, out var logLevel))
|
||||||
|
|
@ -385,6 +397,9 @@ namespace PepperDash.Core
|
||||||
SetDebugLevel(logLevel);
|
SetDebugLevel(logLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// SetDebugLevel method
|
||||||
|
/// </summary>
|
||||||
public static void SetDebugLevel(LogEventLevel level)
|
public static void SetDebugLevel(LogEventLevel level)
|
||||||
{
|
{
|
||||||
_consoleLoggingLevelSwitch.MinimumLevel = level;
|
_consoleLoggingLevelSwitch.MinimumLevel = level;
|
||||||
|
|
@ -402,6 +417,9 @@ namespace PepperDash.Core
|
||||||
CrestronConsole.PrintLine($"Error saving console debug level setting: {err}");
|
CrestronConsole.PrintLine($"Error saving console debug level setting: {err}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// SetWebSocketMinimumDebugLevel method
|
||||||
|
/// </summary>
|
||||||
public static void SetWebSocketMinimumDebugLevel(LogEventLevel level)
|
public static void SetWebSocketMinimumDebugLevel(LogEventLevel level)
|
||||||
{
|
{
|
||||||
_websocketLoggingLevelSwitch.MinimumLevel = level;
|
_websocketLoggingLevelSwitch.MinimumLevel = level;
|
||||||
|
|
@ -414,6 +432,9 @@ namespace PepperDash.Core
|
||||||
LogMessage(LogEventLevel.Information, "Websocket debug level set to {0}", _websocketLoggingLevelSwitch.MinimumLevel);
|
LogMessage(LogEventLevel.Information, "Websocket debug level set to {0}", _websocketLoggingLevelSwitch.MinimumLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// SetErrorLogMinimumDebugLevel method
|
||||||
|
/// </summary>
|
||||||
public static void SetErrorLogMinimumDebugLevel(LogEventLevel level)
|
public static void SetErrorLogMinimumDebugLevel(LogEventLevel level)
|
||||||
{
|
{
|
||||||
_errorLogLevelSwitch.MinimumLevel = level;
|
_errorLogLevelSwitch.MinimumLevel = level;
|
||||||
|
|
@ -426,6 +447,9 @@ namespace PepperDash.Core
|
||||||
LogMessage(LogEventLevel.Information, "Error log debug level set to {0}", _websocketLoggingLevelSwitch.MinimumLevel);
|
LogMessage(LogEventLevel.Information, "Error log debug level set to {0}", _websocketLoggingLevelSwitch.MinimumLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// SetFileMinimumDebugLevel method
|
||||||
|
/// </summary>
|
||||||
public static void SetFileMinimumDebugLevel(LogEventLevel level)
|
public static void SetFileMinimumDebugLevel(LogEventLevel level)
|
||||||
{
|
{
|
||||||
_errorLogLevelSwitch.MinimumLevel = level;
|
_errorLogLevelSwitch.MinimumLevel = level;
|
||||||
|
|
@ -442,6 +466,9 @@ namespace PepperDash.Core
|
||||||
/// Callback for console command
|
/// Callback for console command
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="stateString"></param>
|
/// <param name="stateString"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// SetDoNotLoadOnNextBootFromConsole method
|
||||||
|
/// </summary>
|
||||||
public static void SetDoNotLoadOnNextBootFromConsole(string stateString)
|
public static void SetDoNotLoadOnNextBootFromConsole(string stateString)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
@ -464,6 +491,9 @@ namespace PepperDash.Core
|
||||||
/// Callback for console command
|
/// Callback for console command
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="items"></param>
|
/// <param name="items"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// SetDebugFilterFromConsole method
|
||||||
|
/// </summary>
|
||||||
public static void SetDebugFilterFromConsole(string items)
|
public static void SetDebugFilterFromConsole(string items)
|
||||||
{
|
{
|
||||||
var str = items.Trim();
|
var str = items.Trim();
|
||||||
|
|
@ -559,6 +589,9 @@ namespace PepperDash.Core
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="deviceKey"></param>
|
/// <param name="deviceKey"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
/// <summary>
|
||||||
|
/// GetDeviceDebugSettingsForKey method
|
||||||
|
/// </summary>
|
||||||
public static object GetDeviceDebugSettingsForKey(string deviceKey)
|
public static object GetDeviceDebugSettingsForKey(string deviceKey)
|
||||||
{
|
{
|
||||||
return _contexts.GetDebugSettingsForKey(deviceKey);
|
return _contexts.GetDebugSettingsForKey(deviceKey);
|
||||||
|
|
@ -579,7 +612,7 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// ShowDebugLog method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static void ShowDebugLog(string s)
|
public static void ShowDebugLog(string s)
|
||||||
{
|
{
|
||||||
|
|
@ -595,6 +628,9 @@ namespace PepperDash.Core
|
||||||
/// <param name="message">Message template</param>
|
/// <param name="message">Message template</param>
|
||||||
/// <param name="device">Optional IKeyed device. If provided, the Key of the device will be added to the log message</param>
|
/// <param name="device">Optional IKeyed device. If provided, the Key of the device will be added to the log message</param>
|
||||||
/// <param name="args">Args to put into message template</param>
|
/// <param name="args">Args to put into message template</param>
|
||||||
|
/// <summary>
|
||||||
|
/// LogMessage method
|
||||||
|
/// </summary>
|
||||||
public static void LogMessage(Exception ex, string message, IKeyed device = null, params object[] args)
|
public static void LogMessage(Exception ex, string message, IKeyed device = null, params object[] args)
|
||||||
{
|
{
|
||||||
using (LogContext.PushProperty("Key", device?.Key))
|
using (LogContext.PushProperty("Key", device?.Key))
|
||||||
|
|
@ -623,16 +659,25 @@ namespace PepperDash.Core
|
||||||
_logger.Write(level, message, args);
|
_logger.Write(level, message, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogMessage method
|
||||||
|
/// </summary>
|
||||||
public static void LogMessage(LogEventLevel level, Exception ex, string message, params object[] args)
|
public static void LogMessage(LogEventLevel level, Exception ex, string message, params object[] args)
|
||||||
{
|
{
|
||||||
_logger.Write(level, ex, message, args);
|
_logger.Write(level, ex, message, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogMessage method
|
||||||
|
/// </summary>
|
||||||
public static void LogMessage(LogEventLevel level, IKeyed keyed, string message, params object[] args)
|
public static void LogMessage(LogEventLevel level, IKeyed keyed, string message, params object[] args)
|
||||||
{
|
{
|
||||||
LogMessage(level, message, keyed, args);
|
LogMessage(level, message, keyed, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogMessage method
|
||||||
|
/// </summary>
|
||||||
public static void LogMessage(LogEventLevel level, Exception ex, IKeyed device, string message, params object[] args)
|
public static void LogMessage(LogEventLevel level, Exception ex, IKeyed device, string message, params object[] args)
|
||||||
{
|
{
|
||||||
using (LogContext.PushProperty("Key", device?.Key))
|
using (LogContext.PushProperty("Key", device?.Key))
|
||||||
|
|
@ -642,6 +687,9 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Explicit methods for logging levels
|
#region Explicit methods for logging levels
|
||||||
|
/// <summary>
|
||||||
|
/// LogVerbose method
|
||||||
|
/// </summary>
|
||||||
public static void LogVerbose(IKeyed keyed, string message, params object[] args)
|
public static void LogVerbose(IKeyed keyed, string message, params object[] args)
|
||||||
{
|
{
|
||||||
using(LogContext.PushProperty("Key", keyed?.Key))
|
using(LogContext.PushProperty("Key", keyed?.Key))
|
||||||
|
|
@ -650,6 +698,9 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogVerbose method
|
||||||
|
/// </summary>
|
||||||
public static void LogVerbose(Exception ex, IKeyed keyed, string message, params object[] args)
|
public static void LogVerbose(Exception ex, IKeyed keyed, string message, params object[] args)
|
||||||
{
|
{
|
||||||
using(LogContext.PushProperty("Key", keyed?.Key))
|
using(LogContext.PushProperty("Key", keyed?.Key))
|
||||||
|
|
@ -658,16 +709,25 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogVerbose method
|
||||||
|
/// </summary>
|
||||||
public static void LogVerbose(string message, params object[] args)
|
public static void LogVerbose(string message, params object[] args)
|
||||||
{
|
{
|
||||||
_logger.Write(LogEventLevel.Verbose, message, args);
|
_logger.Write(LogEventLevel.Verbose, message, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogVerbose method
|
||||||
|
/// </summary>
|
||||||
public static void LogVerbose(Exception ex, string message, params object[] args)
|
public static void LogVerbose(Exception ex, string message, params object[] args)
|
||||||
{
|
{
|
||||||
_logger.Write(LogEventLevel.Verbose, ex, null, message, args);
|
_logger.Write(LogEventLevel.Verbose, ex, null, message, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogDebug method
|
||||||
|
/// </summary>
|
||||||
public static void LogDebug(IKeyed keyed, string message, params object[] args)
|
public static void LogDebug(IKeyed keyed, string message, params object[] args)
|
||||||
{
|
{
|
||||||
using (LogContext.PushProperty("Key", keyed?.Key))
|
using (LogContext.PushProperty("Key", keyed?.Key))
|
||||||
|
|
@ -676,6 +736,9 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogDebug method
|
||||||
|
/// </summary>
|
||||||
public static void LogDebug(Exception ex, IKeyed keyed, string message, params object[] args)
|
public static void LogDebug(Exception ex, IKeyed keyed, string message, params object[] args)
|
||||||
{
|
{
|
||||||
using (LogContext.PushProperty("Key", keyed?.Key))
|
using (LogContext.PushProperty("Key", keyed?.Key))
|
||||||
|
|
@ -684,16 +747,25 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogDebug method
|
||||||
|
/// </summary>
|
||||||
public static void LogDebug(string message, params object[] args)
|
public static void LogDebug(string message, params object[] args)
|
||||||
{
|
{
|
||||||
_logger.Write(LogEventLevel.Debug, message, args);
|
_logger.Write(LogEventLevel.Debug, message, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogDebug method
|
||||||
|
/// </summary>
|
||||||
public static void LogDebug(Exception ex, string message, params object[] args)
|
public static void LogDebug(Exception ex, string message, params object[] args)
|
||||||
{
|
{
|
||||||
_logger.Write(LogEventLevel.Debug, ex, null, message, args);
|
_logger.Write(LogEventLevel.Debug, ex, null, message, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogInformation method
|
||||||
|
/// </summary>
|
||||||
public static void LogInformation(IKeyed keyed, string message, params object[] args)
|
public static void LogInformation(IKeyed keyed, string message, params object[] args)
|
||||||
{
|
{
|
||||||
using (LogContext.PushProperty("Key", keyed?.Key))
|
using (LogContext.PushProperty("Key", keyed?.Key))
|
||||||
|
|
@ -702,6 +774,9 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogInformation method
|
||||||
|
/// </summary>
|
||||||
public static void LogInformation(Exception ex, IKeyed keyed, string message, params object[] args)
|
public static void LogInformation(Exception ex, IKeyed keyed, string message, params object[] args)
|
||||||
{
|
{
|
||||||
using (LogContext.PushProperty("Key", keyed?.Key))
|
using (LogContext.PushProperty("Key", keyed?.Key))
|
||||||
|
|
@ -710,16 +785,25 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogInformation method
|
||||||
|
/// </summary>
|
||||||
public static void LogInformation(string message, params object[] args)
|
public static void LogInformation(string message, params object[] args)
|
||||||
{
|
{
|
||||||
_logger.Write(LogEventLevel.Information, message, args);
|
_logger.Write(LogEventLevel.Information, message, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogInformation method
|
||||||
|
/// </summary>
|
||||||
public static void LogInformation(Exception ex, string message, params object[] args)
|
public static void LogInformation(Exception ex, string message, params object[] args)
|
||||||
{
|
{
|
||||||
_logger.Write(LogEventLevel.Information, ex, null, message, args);
|
_logger.Write(LogEventLevel.Information, ex, null, message, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogWarning method
|
||||||
|
/// </summary>
|
||||||
public static void LogWarning(IKeyed keyed, string message, params object[] args)
|
public static void LogWarning(IKeyed keyed, string message, params object[] args)
|
||||||
{
|
{
|
||||||
using (LogContext.PushProperty("Key", keyed?.Key))
|
using (LogContext.PushProperty("Key", keyed?.Key))
|
||||||
|
|
@ -728,6 +812,9 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogWarning method
|
||||||
|
/// </summary>
|
||||||
public static void LogWarning(Exception ex, IKeyed keyed, string message, params object[] args)
|
public static void LogWarning(Exception ex, IKeyed keyed, string message, params object[] args)
|
||||||
{
|
{
|
||||||
using (LogContext.PushProperty("Key", keyed?.Key))
|
using (LogContext.PushProperty("Key", keyed?.Key))
|
||||||
|
|
@ -736,16 +823,25 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogWarning method
|
||||||
|
/// </summary>
|
||||||
public static void LogWarning(string message, params object[] args)
|
public static void LogWarning(string message, params object[] args)
|
||||||
{
|
{
|
||||||
_logger.Write(LogEventLevel.Warning, message, args);
|
_logger.Write(LogEventLevel.Warning, message, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogWarning method
|
||||||
|
/// </summary>
|
||||||
public static void LogWarning(Exception ex, string message, params object[] args)
|
public static void LogWarning(Exception ex, string message, params object[] args)
|
||||||
{
|
{
|
||||||
_logger.Write(LogEventLevel.Warning, ex, null, message, args);
|
_logger.Write(LogEventLevel.Warning, ex, null, message, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogError method
|
||||||
|
/// </summary>
|
||||||
public static void LogError(IKeyed keyed, string message, params object[] args)
|
public static void LogError(IKeyed keyed, string message, params object[] args)
|
||||||
{
|
{
|
||||||
using (LogContext.PushProperty("Key", keyed?.Key))
|
using (LogContext.PushProperty("Key", keyed?.Key))
|
||||||
|
|
@ -754,6 +850,9 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogError method
|
||||||
|
/// </summary>
|
||||||
public static void LogError(Exception ex, IKeyed keyed, string message, params object[] args)
|
public static void LogError(Exception ex, IKeyed keyed, string message, params object[] args)
|
||||||
{
|
{
|
||||||
using (LogContext.PushProperty("Key", keyed?.Key))
|
using (LogContext.PushProperty("Key", keyed?.Key))
|
||||||
|
|
@ -762,16 +861,25 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogError method
|
||||||
|
/// </summary>
|
||||||
public static void LogError(string message, params object[] args)
|
public static void LogError(string message, params object[] args)
|
||||||
{
|
{
|
||||||
_logger.Write(LogEventLevel.Error, message, args);
|
_logger.Write(LogEventLevel.Error, message, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogError method
|
||||||
|
/// </summary>
|
||||||
public static void LogError(Exception ex, string message, params object[] args)
|
public static void LogError(Exception ex, string message, params object[] args)
|
||||||
{
|
{
|
||||||
_logger.Write(LogEventLevel.Error, ex, null, message, args);
|
_logger.Write(LogEventLevel.Error, ex, null, message, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogFatal method
|
||||||
|
/// </summary>
|
||||||
public static void LogFatal(IKeyed keyed, string message, params object[] args)
|
public static void LogFatal(IKeyed keyed, string message, params object[] args)
|
||||||
{
|
{
|
||||||
using (LogContext.PushProperty("Key", keyed?.Key))
|
using (LogContext.PushProperty("Key", keyed?.Key))
|
||||||
|
|
@ -780,6 +888,9 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogFatal method
|
||||||
|
/// </summary>
|
||||||
public static void LogFatal(Exception ex, IKeyed keyed, string message, params object[] args)
|
public static void LogFatal(Exception ex, IKeyed keyed, string message, params object[] args)
|
||||||
{
|
{
|
||||||
using (LogContext.PushProperty("Key", keyed?.Key))
|
using (LogContext.PushProperty("Key", keyed?.Key))
|
||||||
|
|
@ -788,11 +899,17 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogFatal method
|
||||||
|
/// </summary>
|
||||||
public static void LogFatal(string message, params object[] args)
|
public static void LogFatal(string message, params object[] args)
|
||||||
{
|
{
|
||||||
_logger.Write(LogEventLevel.Fatal, message, args);
|
_logger.Write(LogEventLevel.Fatal, message, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogFatal method
|
||||||
|
/// </summary>
|
||||||
public static void LogFatal(Exception ex, string message, params object[] args)
|
public static void LogFatal(Exception ex, string message, params object[] args)
|
||||||
{
|
{
|
||||||
_logger.Write(LogEventLevel.Fatal, ex, null, message, args);
|
_logger.Write(LogEventLevel.Fatal, ex, null, message, args);
|
||||||
|
|
@ -869,6 +986,9 @@ namespace PepperDash.Core
|
||||||
/// Logs to Console when at-level, and all messages to error log
|
/// Logs to Console when at-level, and all messages to error log
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Obsolete("Use LogMessage methods, Will be removed in 2.2.0 and later versions")]
|
[Obsolete("Use LogMessage methods, Will be removed in 2.2.0 and later versions")]
|
||||||
|
/// <summary>
|
||||||
|
/// Console method
|
||||||
|
/// </summary>
|
||||||
public static void Console(uint level, ErrorLogLevel errorLogLevel,
|
public static void Console(uint level, ErrorLogLevel errorLogLevel,
|
||||||
string format, params object[] items)
|
string format, params object[] items)
|
||||||
{
|
{
|
||||||
|
|
@ -881,6 +1001,9 @@ namespace PepperDash.Core
|
||||||
/// it will only be written to the log.
|
/// it will only be written to the log.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Obsolete("Use LogMessage methods, Will be removed in 2.2.0 and later versions")]
|
[Obsolete("Use LogMessage methods, Will be removed in 2.2.0 and later versions")]
|
||||||
|
/// <summary>
|
||||||
|
/// ConsoleWithLog method
|
||||||
|
/// </summary>
|
||||||
public static void ConsoleWithLog(uint level, string format, params object[] items)
|
public static void ConsoleWithLog(uint level, string format, params object[] items)
|
||||||
{
|
{
|
||||||
LogMessage(level, format, items);
|
LogMessage(level, format, items);
|
||||||
|
|
@ -1003,7 +1126,7 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Error level to for message to be logged at
|
/// Enumeration of ErrorLogLevel values
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public enum ErrorLogLevel
|
public enum ErrorLogLevel
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -11,10 +11,16 @@ 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;
|
||||||
|
|
@ -44,6 +50,9 @@ 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,6 +38,9 @@ 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));
|
||||||
|
|
@ -92,6 +95,9 @@ 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
|
||||||
|
|
@ -114,6 +120,9 @@ 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)
|
||||||
|
|
@ -141,7 +150,7 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Appends a device Key to the beginning of a message
|
/// Console method
|
||||||
/// </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)
|
||||||
{
|
{
|
||||||
|
|
@ -191,6 +200,9 @@ 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,8 +5,14 @@ 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,6 +11,9 @@ 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;
|
||||||
|
|
@ -24,6 +27,9 @@ 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;
|
||||||
|
|
|
||||||
|
|
@ -6,66 +6,105 @@ 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, 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.LogMessage(LogEventLevel.Verbose, ex, message, device, 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.LogMessage(LogEventLevel.Verbose, 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.LogMessage(LogEventLevel.Debug, ex, message, device, 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.LogMessage(LogEventLevel.Debug, 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.LogMessage(LogEventLevel.Information, ex, message, device, 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.LogMessage(LogEventLevel.Information, 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.LogMessage(LogEventLevel.Warning, ex, message, device, 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.LogMessage(LogEventLevel.Warning, 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.LogMessage(LogEventLevel.Error, ex, message, device, 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.LogMessage(LogEventLevel.Error, 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.LogMessage(LogEventLevel.Fatal, ex, message, device, 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.LogMessage(LogEventLevel.Fatal, 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>
|
||||||
/// Class to persist current Debug settings across program restarts
|
/// Represents a DebugContextCollection
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class DebugContextCollection
|
public class DebugContextCollection
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -39,6 +39,9 @@ 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)
|
||||||
|
|
@ -51,6 +54,9 @@ 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))
|
||||||
|
|
@ -65,6 +71,9 @@ 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
|
||||||
|
|
@ -89,6 +98,9 @@ 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,6 +21,9 @@ 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;
|
||||||
|
|
@ -47,6 +50,9 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the IsRunning
|
||||||
|
/// </summary>
|
||||||
public bool IsRunning { get => _httpsServer?.IsListening ?? false; }
|
public bool IsRunning { get => _httpsServer?.IsListening ?? false; }
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -105,6 +111,9 @@ 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;
|
||||||
|
|
@ -116,6 +125,9 @@ 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);
|
||||||
|
|
@ -193,6 +205,9 @@ 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");
|
||||||
|
|
@ -204,6 +219,9 @@ 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)
|
||||||
|
|
@ -212,6 +230,9 @@ 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>
|
||||||
/// A class to allow user interaction with the PasswordManager
|
/// Represents a PasswordClient
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class PasswordClient
|
public class PasswordClient
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -59,6 +59,9 @@ 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);
|
||||||
|
|
@ -81,6 +84,9 @@ 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))
|
||||||
|
|
@ -99,6 +105,9 @@ 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);
|
||||||
|
|
@ -108,9 +117,9 @@ namespace PepperDash.Core.PasswordManagement
|
||||||
ValidatePassword(PasswordToValidate);
|
ValidatePassword(PasswordToValidate);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Clears the user entered password and resets the LEDs
|
/// ClearPassword method
|
||||||
/// </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>
|
||||||
/// Allows passwords to be stored and managed
|
/// Represents a PasswordManager
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class PasswordManager
|
public class PasswordManager
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -71,6 +71,9 @@ 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
|
||||||
|
|
@ -152,6 +155,9 @@ 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>
|
||||||
/// Processor Change Event Args Class
|
/// Represents a ProcessorChangeEventArgs
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class ProcessorChangeEventArgs : EventArgs
|
public class ProcessorChangeEventArgs : EventArgs
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -114,9 +114,9 @@ namespace PepperDash.Core.SystemInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ethernet Change Event Args Class
|
/// Represents a EthernetChangeEventArgs
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class EthernetChangeEventArgs : EventArgs
|
public class EthernetChangeEventArgs : EventArgs
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -165,9 +165,9 @@ namespace PepperDash.Core.SystemInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Control Subnet Chage Event Args Class
|
/// Represents a ControlSubnetChangeEventArgs
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class ControlSubnetChangeEventArgs : EventArgs
|
public class ControlSubnetChangeEventArgs : EventArgs
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -211,9 +211,9 @@ namespace PepperDash.Core.SystemInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Program Change Event Args Class
|
/// Represents a ProgramChangeEventArgs
|
||||||
/// </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>
|
||||||
/// Gets the current ethernet info
|
/// GetEthernetInfo method
|
||||||
/// </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>
|
||||||
/// Gets the current control subnet info
|
/// GetControlSubnetInfo method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void GetControlSubnetInfo()
|
public void GetControlSubnetInfo()
|
||||||
{
|
{
|
||||||
OnBoolChange(true, 0, SystemInfoConstants.BusyBoolChange);
|
OnBoolChange(true, 0, SystemInfoConstants.BusyBoolChange);
|
||||||
|
|
@ -206,6 +206,9 @@ 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)
|
||||||
|
|
@ -263,9 +266,9 @@ namespace PepperDash.Core.SystemInfo
|
||||||
OnBoolChange(false, 0, SystemInfoConstants.BusyBoolChange);
|
OnBoolChange(false, 0, SystemInfoConstants.BusyBoolChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the processor uptime and passes it to S+
|
/// RefreshProcessorUptime method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void RefreshProcessorUptime()
|
public void RefreshProcessorUptime()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
@ -287,6 +290,9 @@ 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
|
||||||
|
|
@ -308,6 +314,9 @@ 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,6 +35,9 @@ 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.
|
||||||
|
|
@ -56,6 +59,9 @@ 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.
|
||||||
|
|
@ -78,6 +84,9 @@ 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.
|
||||||
|
|
@ -305,6 +314,9 @@ 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.
|
||||||
|
|
@ -332,6 +344,9 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// AddCertToStore method
|
||||||
|
/// </summary>
|
||||||
public bool AddCertToStore(X509Certificate2 cert, System.Security.Cryptography.X509Certificates.StoreName st, System.Security.Cryptography.X509Certificates.StoreLocation sl)
|
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>
|
||||||
/// Web API default request handler
|
/// Represents a DefaultRequestHandler
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class DefaultRequestHandler : WebApiBaseRequestHandler
|
public class DefaultRequestHandler : WebApiBaseRequestHandler
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -142,6 +142,9 @@ 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,6 +144,9 @@ 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>
|
||||||
/// Web API server key
|
/// Gets or sets the Key
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Key { get; private set; }
|
public string Key { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Web API server name
|
/// Gets or sets the Name
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Name { get; private set; }
|
public string Name { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// CWS base path, will default to "/api" if not set via initialize method
|
/// Gets or sets the BasePath
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string BasePath { get; private set; }
|
public string BasePath { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Indicates CWS is registered with base path
|
/// Gets or sets the IsRegistered
|
||||||
/// </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>
|
||||||
/// Initializes CWS class
|
/// Initialize method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Initialize(string key, string basePath)
|
public void Initialize(string key, string basePath)
|
||||||
{
|
{
|
||||||
Key = key;
|
Key = key;
|
||||||
|
|
@ -165,6 +165,9 @@ 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)
|
||||||
|
|
@ -176,9 +179,9 @@ namespace PepperDash.Core.Web
|
||||||
_server.Routes.Remove(route);
|
_server.Routes.Remove(route);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a list of the current routes
|
/// GetRouteCollection method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public HttpCwsRouteCollection GetRouteCollection()
|
public HttpCwsRouteCollection GetRouteCollection()
|
||||||
{
|
{
|
||||||
return _server.Routes;
|
return _server.Routes;
|
||||||
|
|
@ -222,9 +225,9 @@ namespace PepperDash.Core.Web
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stop CWS instance
|
/// Stop method
|
||||||
/// </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>
|
||||||
/// User ID
|
/// Gets or sets the UserId
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int UserId { get; set; }
|
public int UserId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Room Type ID
|
/// Gets or sets the RoomTypeId
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int RoomTypeId { get; set; }
|
public int RoomTypeId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Preset Name
|
/// Gets or sets the PresetName
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string PresetName { get; set; }
|
public string PresetName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Preset Number
|
/// Gets or sets the PresetNumber
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int PresetNumber { get; set; }
|
public int PresetNumber { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Preset Data
|
/// Gets or sets the 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>
|
||||||
/// S+ helper
|
/// Gets or sets the ULookupSuccess
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ushort ULookupSuccess { get { return (ushort)(LookupSuccess ? 1 : 0); } }
|
public ushort ULookupSuccess { get { return (ushort)(LookupSuccess ? 1 : 0); } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The preset
|
/// Gets or sets 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>
|
||||||
/// For stupid S+
|
/// Gets or sets the ULookupSuccess
|
||||||
/// </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>
|
||||||
/// Unique identifier for this instance
|
/// Gets or sets the Key
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Key { get; private set; }
|
public string Key { get; private set; }
|
||||||
|
|
||||||
//string JsonMasterKey;
|
//string JsonMasterKey;
|
||||||
|
|
@ -77,6 +77,9 @@ 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
|
||||||
|
|
@ -115,6 +118,9 @@ 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)
|
||||||
|
|
@ -212,6 +218,9 @@ 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,6 +59,9 @@ 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;
|
||||||
|
|
@ -69,6 +72,10 @@ 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");
|
||||||
|
|
@ -80,6 +87,9 @@ 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,6 +57,9 @@ 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;
|
||||||
|
|
@ -67,6 +70,10 @@ 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");
|
||||||
|
|
@ -77,6 +84,9 @@ 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,6 +63,9 @@ 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;
|
||||||
|
|
@ -73,6 +76,10 @@ 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,6 +52,9 @@ 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);
|
||||||
|
|
@ -63,6 +66,9 @@ 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();
|
||||||
|
|
@ -82,6 +88,9 @@ 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);
|
||||||
|
|
@ -94,6 +103,9 @@ 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();
|
||||||
|
|
@ -105,6 +117,9 @@ 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);
|
||||||
|
|
@ -117,6 +132,9 @@ 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
|
||||||
|
|
@ -134,6 +152,9 @@ 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);
|
||||||
|
|
@ -146,6 +167,9 @@ 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();
|
||||||
|
|
@ -157,6 +181,9 @@ 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);
|
||||||
|
|
@ -169,6 +196,9 @@ 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
|
||||||
|
|
@ -186,6 +216,9 @@ 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);
|
||||||
|
|
@ -198,6 +231,9 @@ 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();
|
||||||
|
|
@ -209,6 +245,9 @@ 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);
|
||||||
|
|
@ -221,6 +260,9 @@ 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,6 +48,9 @@ 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;
|
||||||
|
|
@ -65,6 +68,9 @@ 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;
|
||||||
|
|
@ -114,6 +120,9 @@ 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,6 +47,9 @@ 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);
|
||||||
|
|
@ -57,6 +60,9 @@ 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)
|
||||||
|
|
@ -70,6 +76,9 @@ 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);
|
||||||
|
|
@ -80,6 +89,9 @@ 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);
|
||||||
|
|
@ -108,6 +120,9 @@ 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)
|
||||||
|
|
@ -125,7 +140,7 @@ namespace PepperDash.Core.Intersystem
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Disposes of the internal stream if specified to not leave open.
|
/// Dispose method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ namespace PepperDash.Essentials.Core.Bridges
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Bridge API using EISC
|
/// Represents a EiscApiAdvanced
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class EiscApiAdvanced : BridgeApi, ICommunicationMonitor
|
public class EiscApiAdvanced : BridgeApi, ICommunicationMonitor
|
||||||
{
|
{
|
||||||
|
|
@ -60,12 +60,19 @@ namespace PepperDash.Essentials.Core.Bridges
|
||||||
AddPostActivationAction(RegisterEisc);
|
AddPostActivationAction(RegisterEisc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// CustomActivate method
|
||||||
|
/// </summary>
|
||||||
|
/// <inheritdoc />
|
||||||
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();
|
||||||
|
|
@ -123,6 +130,9 @@ namespace PepperDash.Essentials.Core.Bridges
|
||||||
Debug.LogMessage(LogEventLevel.Debug, this, "EISC registration successful");
|
Debug.LogMessage(LogEventLevel.Debug, this, "EISC registration successful");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LinkRooms method
|
||||||
|
/// </summary>
|
||||||
public void LinkRooms()
|
public void LinkRooms()
|
||||||
{
|
{
|
||||||
Debug.LogMessage(LogEventLevel.Debug, this, "Linking Rooms...");
|
Debug.LogMessage(LogEventLevel.Debug, this, "Linking Rooms...");
|
||||||
|
|
@ -153,6 +163,9 @@ namespace PepperDash.Essentials.Core.Bridges
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="deviceKey"></param>
|
/// <param name="deviceKey"></param>
|
||||||
/// <param name="joinMap"></param>
|
/// <param name="joinMap"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// AddJoinMap method
|
||||||
|
/// </summary>
|
||||||
public void AddJoinMap(string deviceKey, JoinMapBaseAdvanced joinMap)
|
public void AddJoinMap(string deviceKey, JoinMapBaseAdvanced joinMap)
|
||||||
{
|
{
|
||||||
if (!JoinMaps.ContainsKey(deviceKey))
|
if (!JoinMaps.ContainsKey(deviceKey))
|
||||||
|
|
@ -166,8 +179,9 @@ namespace PepperDash.Essentials.Core.Bridges
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Prints all the join maps on this bridge
|
/// PrintJoinMaps method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <inheritdoc />
|
||||||
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"));
|
||||||
|
|
@ -179,8 +193,9 @@ namespace PepperDash.Essentials.Core.Bridges
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Generates markdown for all join maps on this bridge
|
/// MarkdownForBridge method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <inheritdoc />
|
||||||
public virtual void MarkdownForBridge(string bridgeKey)
|
public virtual void MarkdownForBridge(string bridgeKey)
|
||||||
{
|
{
|
||||||
Debug.LogMessage(LogEventLevel.Information, this, "Writing Joinmaps to files for EISC IPID: {0}", Eisc.ID.ToString("X"));
|
Debug.LogMessage(LogEventLevel.Information, this, "Writing Joinmaps to files for EISC IPID: {0}", Eisc.ID.ToString("X"));
|
||||||
|
|
@ -196,6 +211,9 @@ namespace PepperDash.Essentials.Core.Bridges
|
||||||
/// Prints the join map for a device by key
|
/// Prints the join map for a device by key
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="deviceKey"></param>
|
/// <param name="deviceKey"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// PrintJoinMapForDevice method
|
||||||
|
/// </summary>
|
||||||
public void PrintJoinMapForDevice(string deviceKey)
|
public void PrintJoinMapForDevice(string deviceKey)
|
||||||
{
|
{
|
||||||
var joinMap = JoinMaps[deviceKey];
|
var joinMap = JoinMaps[deviceKey];
|
||||||
|
|
@ -213,6 +231,9 @@ namespace PepperDash.Essentials.Core.Bridges
|
||||||
/// Prints the join map for a device by key
|
/// Prints the join map for a device by key
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="deviceKey"></param>
|
/// <param name="deviceKey"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// MarkdownJoinMapForDevice method
|
||||||
|
/// </summary>
|
||||||
public void MarkdownJoinMapForDevice(string deviceKey, string bridgeKey)
|
public void MarkdownJoinMapForDevice(string deviceKey, string bridgeKey)
|
||||||
{
|
{
|
||||||
var joinMap = JoinMaps[deviceKey];
|
var joinMap = JoinMaps[deviceKey];
|
||||||
|
|
@ -233,6 +254,9 @@ namespace PepperDash.Essentials.Core.Bridges
|
||||||
/// <param name="join"></param>
|
/// <param name="join"></param>
|
||||||
/// <param name="type"></param>
|
/// <param name="type"></param>
|
||||||
/// <param name="state"></param>
|
/// <param name="state"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// ExecuteJoinAction method
|
||||||
|
/// </summary>
|
||||||
public void ExecuteJoinAction(uint join, string type, object state)
|
public void ExecuteJoinAction(uint join, string type, object state)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
@ -318,49 +342,91 @@ namespace PepperDash.Essentials.Core.Bridges
|
||||||
|
|
||||||
#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
|
||||||
{
|
{
|
||||||
[JsonProperty("control")]
|
[JsonProperty("control")]
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Control
|
||||||
|
/// </summary>
|
||||||
public EssentialsControlPropertiesConfig Control { get; set; }
|
public EssentialsControlPropertiesConfig Control { get; set; }
|
||||||
|
|
||||||
[JsonProperty("devices")]
|
[JsonProperty("devices")]
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Devices
|
||||||
|
/// </summary>
|
||||||
public List<ApiDevicePropertiesConfig> Devices { get; set; }
|
public List<ApiDevicePropertiesConfig> Devices { get; set; }
|
||||||
|
|
||||||
[JsonProperty("rooms")]
|
[JsonProperty("rooms")]
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Rooms
|
||||||
|
/// </summary>
|
||||||
public List<ApiRoomPropertiesConfig> Rooms { get; set; }
|
public List<ApiRoomPropertiesConfig> Rooms { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a ApiDevicePropertiesConfig
|
||||||
|
/// </summary>
|
||||||
public class ApiDevicePropertiesConfig
|
public class ApiDevicePropertiesConfig
|
||||||
{
|
{
|
||||||
[JsonProperty("deviceKey")]
|
[JsonProperty("deviceKey")]
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the DeviceKey
|
||||||
|
/// </summary>
|
||||||
public string DeviceKey { get; set; }
|
public string DeviceKey { get; set; }
|
||||||
|
|
||||||
[JsonProperty("joinStart")]
|
[JsonProperty("joinStart")]
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the JoinStart
|
||||||
|
/// </summary>
|
||||||
public uint JoinStart { get; set; }
|
public uint JoinStart { get; set; }
|
||||||
|
|
||||||
[JsonProperty("joinMapKey")]
|
[JsonProperty("joinMapKey")]
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the JoinMapKey
|
||||||
|
/// </summary>
|
||||||
public string JoinMapKey { get; set; }
|
public string JoinMapKey { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a ApiRoomPropertiesConfig
|
||||||
|
/// </summary>
|
||||||
public class ApiRoomPropertiesConfig
|
public class ApiRoomPropertiesConfig
|
||||||
{
|
{
|
||||||
[JsonProperty("roomKey")]
|
[JsonProperty("roomKey")]
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the RoomKey
|
||||||
|
/// </summary>
|
||||||
public string RoomKey { get; set; }
|
public string RoomKey { get; set; }
|
||||||
|
|
||||||
[JsonProperty("joinStart")]
|
[JsonProperty("joinStart")]
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the JoinStart
|
||||||
|
/// </summary>
|
||||||
public uint JoinStart { get; set; }
|
public uint JoinStart { get; set; }
|
||||||
|
|
||||||
[JsonProperty("joinMapKey")]
|
[JsonProperty("joinMapKey")]
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the JoinMapKey
|
||||||
|
/// </summary>
|
||||||
public string JoinMapKey { get; set; }
|
public string JoinMapKey { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a EiscApiAdvancedFactory
|
||||||
|
/// </summary>
|
||||||
public class EiscApiAdvancedFactory : EssentialsDeviceFactory<EiscApiAdvanced>
|
public class EiscApiAdvancedFactory : EssentialsDeviceFactory<EiscApiAdvanced>
|
||||||
{
|
{
|
||||||
public EiscApiAdvancedFactory()
|
public EiscApiAdvancedFactory()
|
||||||
|
|
@ -368,6 +434,10 @@ namespace PepperDash.Essentials.Core.Bridges
|
||||||
TypeNames = new List<string> { "eiscapiadv", "eiscapiadvanced", "eiscapiadvancedserver", "eiscapiadvancedclient", "vceiscapiadv", "vceiscapiadvanced" };
|
TypeNames = new List<string> { "eiscapiadv", "eiscapiadvanced", "eiscapiadvancedserver", "eiscapiadvancedclient", "vceiscapiadv", "vceiscapiadvanced" };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// BuildDevice method
|
||||||
|
/// </summary>
|
||||||
|
/// <inheritdoc />
|
||||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||||
{
|
{
|
||||||
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new EiscApiAdvanced Device");
|
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new EiscApiAdvanced Device");
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,9 @@ 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,7 +3,7 @@
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defines a device that uses JoinMapBaseAdvanced for its join map
|
/// Defines the contract for IBridgeAdvanced
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IBridgeAdvanced
|
public interface IBridgeAdvanced
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,9 @@ 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,6 +2,9 @@
|
||||||
|
|
||||||
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,6 +2,9 @@
|
||||||
|
|
||||||
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>
|
||||||
/// Join map for CameraBase devices
|
/// Represents a CameraControllerJoinMap
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class CameraControllerJoinMap : JoinMapBaseAdvanced
|
public class CameraControllerJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
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,6 +2,9 @@
|
||||||
|
|
||||||
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,6 +1,9 @@
|
||||||
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,6 +2,9 @@ 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,6 +2,9 @@ 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,6 +2,9 @@
|
||||||
|
|
||||||
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,6 +2,9 @@
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a DmpsAudioOutputControllerJoinMap
|
||||||
|
/// </summary>
|
||||||
public class DmpsAudioOutputControllerJoinMap : JoinMapBaseAdvanced
|
public class DmpsAudioOutputControllerJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
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,6 +2,9 @@
|
||||||
|
|
||||||
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,6 +3,9 @@
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a GenericLightingJoinMap
|
||||||
|
/// </summary>
|
||||||
public class GenericLightingJoinMap : JoinMapBaseAdvanced
|
public class GenericLightingJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a GenericRelayControllerJoinMap
|
||||||
|
/// </summary>
|
||||||
public class GenericRelayControllerJoinMap : JoinMapBaseAdvanced
|
public class GenericRelayControllerJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
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,6 +3,9 @@ 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,6 +2,9 @@
|
||||||
|
|
||||||
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,6 +2,9 @@
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a HdMdxxxCEControllerJoinMap
|
||||||
|
/// </summary>
|
||||||
public class HdMdxxxCEControllerJoinMap : JoinMapBaseAdvanced
|
public class HdMdxxxCEControllerJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,9 @@ 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,6 +2,9 @@
|
||||||
|
|
||||||
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,6 +2,9 @@
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a IAnalogInputJoinMap
|
||||||
|
/// </summary>
|
||||||
public class IAnalogInputJoinMap : JoinMapBaseAdvanced
|
public class IAnalogInputJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
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,6 +2,9 @@
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a IDigitalInputJoinMap
|
||||||
|
/// </summary>
|
||||||
public class IDigitalInputJoinMap : JoinMapBaseAdvanced
|
public class IDigitalInputJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a IDigitalOutputJoinMap
|
||||||
|
/// </summary>
|
||||||
public class IDigitalOutputJoinMap : JoinMapBaseAdvanced
|
public class IDigitalOutputJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
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,6 +3,9 @@
|
||||||
|
|
||||||
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,6 +2,9 @@
|
||||||
|
|
||||||
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,6 +2,9 @@
|
||||||
|
|
||||||
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,6 +2,9 @@ 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
|
||||||
|
|
|
||||||
|
|
@ -12,13 +12,22 @@ using Serilog.Events;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core
|
namespace PepperDash.Essentials.Core
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a CecPortController
|
||||||
|
/// </summary>
|
||||||
public class CecPortController : Device, IBasicCommunicationWithStreamDebugging
|
public class CecPortController : Device, IBasicCommunicationWithStreamDebugging
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the StreamDebugging
|
||||||
|
/// </summary>
|
||||||
public CommunicationStreamDebugging StreamDebugging { get; private set; }
|
public CommunicationStreamDebugging StreamDebugging { get; private set; }
|
||||||
|
|
||||||
public event EventHandler<GenericCommMethodReceiveBytesArgs> BytesReceived;
|
public event EventHandler<GenericCommMethodReceiveBytesArgs> BytesReceived;
|
||||||
public event EventHandler<GenericCommMethodReceiveTextArgs> TextReceived;
|
public event EventHandler<GenericCommMethodReceiveTextArgs> TextReceived;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the IsConnected
|
||||||
|
/// </summary>
|
||||||
public bool IsConnected { get { return true; } }
|
public bool IsConnected { get { return true; } }
|
||||||
|
|
||||||
ICec Port;
|
ICec Port;
|
||||||
|
|
@ -74,6 +83,9 @@ namespace PepperDash.Essentials.Core
|
||||||
|
|
||||||
#region IBasicCommunication Members
|
#region IBasicCommunication Members
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// SendText method
|
||||||
|
/// </summary>
|
||||||
public void SendText(string text)
|
public void SendText(string text)
|
||||||
{
|
{
|
||||||
if (Port == null)
|
if (Port == null)
|
||||||
|
|
@ -83,6 +95,9 @@ namespace PepperDash.Essentials.Core
|
||||||
Port.StreamCec.Send.StringValue = text;
|
Port.StreamCec.Send.StringValue = text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// SendBytes method
|
||||||
|
/// </summary>
|
||||||
public void SendBytes(byte[] bytes)
|
public void SendBytes(byte[] bytes)
|
||||||
{
|
{
|
||||||
if (Port == null)
|
if (Port == null)
|
||||||
|
|
@ -93,10 +108,16 @@ namespace PepperDash.Essentials.Core
|
||||||
Port.StreamCec.Send.StringValue = text;
|
Port.StreamCec.Send.StringValue = text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Connect method
|
||||||
|
/// </summary>
|
||||||
public void Connect()
|
public void Connect()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Disconnect method
|
||||||
|
/// </summary>
|
||||||
public void Disconnect()
|
public void Disconnect()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
@ -107,6 +128,9 @@ namespace PepperDash.Essentials.Core
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="s"></param>
|
/// <param name="s"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// SimulateReceive method
|
||||||
|
/// </summary>
|
||||||
public void SimulateReceive(string s)
|
public void SimulateReceive(string s)
|
||||||
{
|
{
|
||||||
// split out hex chars and build string
|
// split out hex chars and build string
|
||||||
|
|
|
||||||
|
|
@ -12,13 +12,22 @@ using Serilog.Events;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core
|
namespace PepperDash.Essentials.Core
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a ComPortController
|
||||||
|
/// </summary>
|
||||||
public class ComPortController : Device, IBasicCommunicationWithStreamDebugging
|
public class ComPortController : Device, IBasicCommunicationWithStreamDebugging
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the StreamDebugging
|
||||||
|
/// </summary>
|
||||||
public CommunicationStreamDebugging StreamDebugging { get; private set; }
|
public CommunicationStreamDebugging StreamDebugging { get; private set; }
|
||||||
|
|
||||||
public event EventHandler<GenericCommMethodReceiveBytesArgs> BytesReceived;
|
public event EventHandler<GenericCommMethodReceiveBytesArgs> BytesReceived;
|
||||||
public event EventHandler<GenericCommMethodReceiveTextArgs> TextReceived;
|
public event EventHandler<GenericCommMethodReceiveTextArgs> TextReceived;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the IsConnected
|
||||||
|
/// </summary>
|
||||||
public bool IsConnected { get { return true; } }
|
public bool IsConnected { get { return true; } }
|
||||||
|
|
||||||
ComPort Port;
|
ComPort Port;
|
||||||
|
|
@ -116,6 +125,10 @@ namespace PepperDash.Essentials.Core
|
||||||
if(!eventSubscribed) Debug.LogMessage(LogEventLevel.Warning, this, "Received data but no handler is registered");
|
if(!eventSubscribed) Debug.LogMessage(LogEventLevel.Warning, this, "Received data but no handler is registered");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Deactivate method
|
||||||
|
/// </summary>
|
||||||
|
/// <inheritdoc />
|
||||||
public override bool Deactivate()
|
public override bool Deactivate()
|
||||||
{
|
{
|
||||||
return Port.UnRegister() == eDeviceRegistrationUnRegistrationResponse.Success;
|
return Port.UnRegister() == eDeviceRegistrationUnRegistrationResponse.Success;
|
||||||
|
|
@ -123,6 +136,9 @@ namespace PepperDash.Essentials.Core
|
||||||
|
|
||||||
#region IBasicCommunication Members
|
#region IBasicCommunication Members
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// SendText method
|
||||||
|
/// </summary>
|
||||||
public void SendText(string text)
|
public void SendText(string text)
|
||||||
{
|
{
|
||||||
if (Port == null)
|
if (Port == null)
|
||||||
|
|
@ -133,6 +149,9 @@ namespace PepperDash.Essentials.Core
|
||||||
Port.Send(text);
|
Port.Send(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// SendBytes method
|
||||||
|
/// </summary>
|
||||||
public void SendBytes(byte[] bytes)
|
public void SendBytes(byte[] bytes)
|
||||||
{
|
{
|
||||||
if (Port == null)
|
if (Port == null)
|
||||||
|
|
@ -144,10 +163,16 @@ namespace PepperDash.Essentials.Core
|
||||||
Port.Send(text);
|
Port.Send(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Connect method
|
||||||
|
/// </summary>
|
||||||
public void Connect()
|
public void Connect()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Disconnect method
|
||||||
|
/// </summary>
|
||||||
public void Disconnect()
|
public void Disconnect()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
@ -158,6 +183,9 @@ namespace PepperDash.Essentials.Core
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="s"></param>
|
/// <param name="s"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// SimulateReceive method
|
||||||
|
/// </summary>
|
||||||
public void SimulateReceive(string s)
|
public void SimulateReceive(string s)
|
||||||
{
|
{
|
||||||
// split out hex chars and build string
|
// split out hex chars and build string
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,9 @@ namespace PepperDash.Essentials.Core
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// CanConvert method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <inheritdoc />
|
||||||
public override bool CanConvert(Type objectType)
|
public override bool CanConvert(Type objectType)
|
||||||
{
|
{
|
||||||
return objectType == typeof(ComPort.ComPortSpec?);
|
return objectType == typeof(ComPort.ComPortSpec?);
|
||||||
|
|
@ -44,10 +45,15 @@ namespace PepperDash.Essentials.Core
|
||||||
public override bool CanRead { get { return true; } }
|
public override bool CanRead { get { return true; } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This converter will not be used for writing
|
/// Gets or sets the CanWrite
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <inheritdoc />
|
||||||
public override bool CanWrite { get { return false; } }
|
public override bool CanWrite { get { return false; } }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// WriteJson method
|
||||||
|
/// </summary>
|
||||||
|
/// <inheritdoc />
|
||||||
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
|
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
|
|
@ -55,12 +61,11 @@ namespace PepperDash.Essentials.Core
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The gist of this converter: The comspec JSON comes in with normal values that need to be converted
|
/// Represents a ComSpecPropsJsonConverter
|
||||||
/// into enum names. This converter takes the value and applies the appropriate enum's name prefix to the value
|
|
||||||
/// and then returns the enum value using Enum.Parse. NOTE: Does not write
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class ComSpecPropsJsonConverter : JsonConverter
|
public class ComSpecPropsJsonConverter : JsonConverter
|
||||||
{
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
public override bool CanConvert(Type objectType)
|
public override bool CanConvert(Type objectType)
|
||||||
{
|
{
|
||||||
return objectType == typeof(ComPort.eComBaudRates)
|
return objectType == typeof(ComPort.eComBaudRates)
|
||||||
|
|
@ -72,8 +77,15 @@ namespace PepperDash.Essentials.Core
|
||||||
|| objectType == typeof(ComPort.eComStopBits);
|
|| objectType == typeof(ComPort.eComStopBits);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the CanRead
|
||||||
|
/// </summary>
|
||||||
|
/// <inheritdoc />
|
||||||
public override bool CanRead { get { return true; } }
|
public override bool CanRead { get { return true; } }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ReadJson method
|
||||||
|
/// </summary>
|
||||||
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
|
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
|
||||||
{
|
{
|
||||||
//Debug.LogMessage(LogEventLevel.Verbose, "ReadJson type: " + objectType.Name);
|
//Debug.LogMessage(LogEventLevel.Verbose, "ReadJson type: " + objectType.Name);
|
||||||
|
|
@ -94,6 +106,10 @@ namespace PepperDash.Essentials.Core
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// WriteJson method
|
||||||
|
/// </summary>
|
||||||
|
/// <inheritdoc />
|
||||||
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
|
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,9 @@ namespace PepperDash.Essentials.Core
|
||||||
/// Returns a comm method of either com port, TCP, SSH, and puts this into the DeviceManager
|
/// Returns a comm method of either com port, TCP, SSH, and puts this into the DeviceManager
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="deviceConfig">The Device config object</param>
|
/// <param name="deviceConfig">The Device config object</param>
|
||||||
|
/// <summary>
|
||||||
|
/// CreateCommForDevice method
|
||||||
|
/// </summary>
|
||||||
public static IBasicCommunication CreateCommForDevice(DeviceConfig deviceConfig)
|
public static IBasicCommunication CreateCommForDevice(DeviceConfig deviceConfig)
|
||||||
{
|
{
|
||||||
EssentialsControlPropertiesConfig controlConfig = GetControlPropertiesConfig(deviceConfig);
|
EssentialsControlPropertiesConfig controlConfig = GetControlPropertiesConfig(deviceConfig);
|
||||||
|
|
@ -110,6 +113,9 @@ namespace PepperDash.Essentials.Core
|
||||||
return comm;
|
return comm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// GetComPort method
|
||||||
|
/// </summary>
|
||||||
public static ComPort GetComPort(EssentialsControlPropertiesConfig config)
|
public static ComPort GetComPort(EssentialsControlPropertiesConfig config)
|
||||||
{
|
{
|
||||||
var comPar = config.ComParams;
|
var comPar = config.ComParams;
|
||||||
|
|
@ -125,6 +131,9 @@ namespace PepperDash.Essentials.Core
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="config"></param>
|
/// <param name="config"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
/// <summary>
|
||||||
|
/// GetCecPort method
|
||||||
|
/// </summary>
|
||||||
public static ICec GetCecPort(ControlPropertiesConfig config)
|
public static ICec GetCecPort(ControlPropertiesConfig config)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
@ -182,6 +191,9 @@ namespace PepperDash.Essentials.Core
|
||||||
/// return the ControlSystem object from the Global class.
|
/// return the ControlSystem object from the Global class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>IComPorts device or null if the device is not found or does not implement IComPorts</returns>
|
/// <returns>IComPorts device or null if the device is not found or does not implement IComPorts</returns>
|
||||||
|
/// <summary>
|
||||||
|
/// GetIComPortsDeviceFromManagedDevice method
|
||||||
|
/// </summary>
|
||||||
public static IComPorts GetIComPortsDeviceFromManagedDevice(string ComPortDevKey)
|
public static IComPorts GetIComPortsDeviceFromManagedDevice(string ComPortDevKey)
|
||||||
{
|
{
|
||||||
if ((ComPortDevKey.Equals("controlSystem", System.StringComparison.OrdinalIgnoreCase)
|
if ((ComPortDevKey.Equals("controlSystem", System.StringComparison.OrdinalIgnoreCase)
|
||||||
|
|
@ -199,7 +211,7 @@ namespace PepperDash.Essentials.Core
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Represents a EssentialsControlPropertiesConfig
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class EssentialsControlPropertiesConfig :
|
public class EssentialsControlPropertiesConfig :
|
||||||
ControlPropertiesConfig
|
ControlPropertiesConfig
|
||||||
|
|
@ -232,6 +244,9 @@ namespace PepperDash.Essentials.Core
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonProperty("infinetId", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty("infinetId", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the InfinetId
|
||||||
|
/// </summary>
|
||||||
public string InfinetId { get; set; }
|
public string InfinetId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -254,10 +269,22 @@ namespace PepperDash.Essentials.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a IrControlSpec
|
||||||
|
/// </summary>
|
||||||
public class IrControlSpec
|
public class IrControlSpec
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the PortDeviceKey
|
||||||
|
/// </summary>
|
||||||
public string PortDeviceKey { get; set; }
|
public string PortDeviceKey { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the PortNumber
|
||||||
|
/// </summary>
|
||||||
public uint PortNumber { get; set; }
|
public uint PortNumber { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the File
|
||||||
|
/// </summary>
|
||||||
public string File { get; set; }
|
public string File { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -11,20 +11,32 @@ using Serilog.Events;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core
|
namespace PepperDash.Essentials.Core
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a ConsoleCommMockDevice
|
||||||
|
/// </summary>
|
||||||
public class ConsoleCommMockDevice : EssentialsDevice, ICommunicationMonitor
|
public class ConsoleCommMockDevice : EssentialsDevice, ICommunicationMonitor
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Communication
|
||||||
|
/// </summary>
|
||||||
public IBasicCommunication Communication { get; private set; }
|
public IBasicCommunication Communication { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the PortGather
|
||||||
|
/// </summary>
|
||||||
public CommunicationGather PortGather { get; private set; }
|
public CommunicationGather PortGather { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the CommunicationMonitor
|
||||||
|
/// </summary>
|
||||||
public StatusMonitorBase CommunicationMonitor { get; private set; }
|
public StatusMonitorBase CommunicationMonitor { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defaults to \x0a
|
/// Gets or sets the LineEnding
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string LineEnding { get; set; }
|
public string LineEnding { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set to true to show responses in full hex
|
/// Gets or sets the ShowHexResponse
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool ShowHexResponse { get; set; }
|
public bool ShowHexResponse { get; set; }
|
||||||
|
|
||||||
public ConsoleCommMockDevice(string key, string name, ConsoleCommMockDevicePropertiesConfig props, IBasicCommunication comm)
|
public ConsoleCommMockDevice(string key, string name, ConsoleCommMockDevicePropertiesConfig props, IBasicCommunication comm)
|
||||||
|
|
@ -37,6 +49,10 @@ namespace PepperDash.Essentials.Core
|
||||||
LineEnding = props.LineEnding;
|
LineEnding = props.LineEnding;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// CustomActivate method
|
||||||
|
/// </summary>
|
||||||
|
/// <inheritdoc />
|
||||||
public override bool CustomActivate()
|
public override bool CustomActivate()
|
||||||
{
|
{
|
||||||
Communication.Connect();
|
Communication.Connect();
|
||||||
|
|
@ -56,9 +72,18 @@ namespace PepperDash.Essentials.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a ConsoleCommMockDevicePropertiesConfig
|
||||||
|
/// </summary>
|
||||||
public class ConsoleCommMockDevicePropertiesConfig
|
public class ConsoleCommMockDevicePropertiesConfig
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the LineEnding
|
||||||
|
/// </summary>
|
||||||
public string LineEnding { get; set; }
|
public string LineEnding { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the CommunicationMonitorProperties
|
||||||
|
/// </summary>
|
||||||
public CommunicationMonitorConfig CommunicationMonitorProperties { get; set; }
|
public CommunicationMonitorConfig CommunicationMonitorProperties { get; set; }
|
||||||
|
|
||||||
public ConsoleCommMockDevicePropertiesConfig()
|
public ConsoleCommMockDevicePropertiesConfig()
|
||||||
|
|
@ -67,6 +92,9 @@ namespace PepperDash.Essentials.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a ConsoleCommMockDeviceFactory
|
||||||
|
/// </summary>
|
||||||
public class ConsoleCommMockDeviceFactory : EssentialsDeviceFactory<ConsoleCommMockDevice>
|
public class ConsoleCommMockDeviceFactory : EssentialsDeviceFactory<ConsoleCommMockDevice>
|
||||||
{
|
{
|
||||||
public ConsoleCommMockDeviceFactory()
|
public ConsoleCommMockDeviceFactory()
|
||||||
|
|
@ -74,6 +102,10 @@ namespace PepperDash.Essentials.Core
|
||||||
TypeNames = new List<string>() { "commmock" };
|
TypeNames = new List<string>() { "commmock" };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// BuildDevice method
|
||||||
|
/// </summary>
|
||||||
|
/// <inheritdoc />
|
||||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||||
{
|
{
|
||||||
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new Comm Mock Device");
|
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new Comm Mock Device");
|
||||||
|
|
|
||||||
|
|
@ -44,12 +44,18 @@ namespace PepperDash.Essentials.Core
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// BuildDevice method
|
||||||
|
/// </summary>
|
||||||
public static IKeyed BuildDevice(DeviceConfig dc)
|
public static IKeyed BuildDevice(DeviceConfig dc)
|
||||||
{
|
{
|
||||||
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new Generic Comm Device");
|
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new Generic Comm Device");
|
||||||
return new GenericComm(dc);
|
return new GenericComm(dc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// SetPortConfig method
|
||||||
|
/// </summary>
|
||||||
public void SetPortConfig(string portConfig)
|
public void SetPortConfig(string portConfig)
|
||||||
{
|
{
|
||||||
// TODO: Deserialize new EssentialsControlPropertiesConfig and handle as necessary
|
// TODO: Deserialize new EssentialsControlPropertiesConfig and handle as necessary
|
||||||
|
|
@ -71,6 +77,10 @@ namespace PepperDash.Essentials.Core
|
||||||
ConfigWriter.UpdateDeviceConfig(config);
|
ConfigWriter.UpdateDeviceConfig(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LinkToApi method
|
||||||
|
/// </summary>
|
||||||
|
/// <inheritdoc />
|
||||||
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
|
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
|
||||||
{
|
{
|
||||||
var joinMap = new IBasicCommunicationJoinMap(joinStart);
|
var joinMap = new IBasicCommunicationJoinMap(joinStart);
|
||||||
|
|
@ -129,6 +139,9 @@ namespace PepperDash.Essentials.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a GenericCommFactory
|
||||||
|
/// </summary>
|
||||||
public class GenericCommFactory : EssentialsDeviceFactory<GenericComm>
|
public class GenericCommFactory : EssentialsDeviceFactory<GenericComm>
|
||||||
{
|
{
|
||||||
public GenericCommFactory()
|
public GenericCommFactory()
|
||||||
|
|
@ -136,6 +149,10 @@ namespace PepperDash.Essentials.Core
|
||||||
TypeNames = new List<string>() { "genericComm" };
|
TypeNames = new List<string>() { "genericComm" };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// BuildDevice method
|
||||||
|
/// </summary>
|
||||||
|
/// <inheritdoc />
|
||||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||||
{
|
{
|
||||||
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new Generic Comm Device");
|
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new Generic Comm Device");
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,9 @@ using System;
|
||||||
namespace PepperDash.Essentials.Core
|
namespace PepperDash.Essentials.Core
|
||||||
{
|
{
|
||||||
[Obsolete("Please use the builtin HttpClient class instead: https://learn.microsoft.com/en-us/dotnet/fundamentals/networking/http/httpclient-guidelines")]
|
[Obsolete("Please use the builtin HttpClient class instead: https://learn.microsoft.com/en-us/dotnet/fundamentals/networking/http/httpclient-guidelines")]
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a GenericHttpClient
|
||||||
|
/// </summary>
|
||||||
public class GenericHttpClient : Device, IBasicCommunication
|
public class GenericHttpClient : Device, IBasicCommunication
|
||||||
{
|
{
|
||||||
private readonly HttpClient Client;
|
private readonly HttpClient Client;
|
||||||
|
|
@ -25,6 +28,9 @@ namespace PepperDash.Essentials.Core
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="path"></param>
|
/// <param name="path"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// SendText method
|
||||||
|
/// </summary>
|
||||||
public void SendText(string path)
|
public void SendText(string path)
|
||||||
{
|
{
|
||||||
HttpClientRequest request = new HttpClientRequest();
|
HttpClientRequest request = new HttpClientRequest();
|
||||||
|
|
@ -40,6 +46,9 @@ namespace PepperDash.Essentials.Core
|
||||||
HttpClient.DISPATCHASYNC_ERROR error = Client.DispatchAsyncEx(request, Response, request);
|
HttpClient.DISPATCHASYNC_ERROR error = Client.DispatchAsyncEx(request, Response, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// SendTextNoResponse method
|
||||||
|
/// </summary>
|
||||||
public void SendTextNoResponse(string format, params object[] items)
|
public void SendTextNoResponse(string format, params object[] items)
|
||||||
{
|
{
|
||||||
HttpClientRequest request = new HttpClientRequest();
|
HttpClientRequest request = new HttpClientRequest();
|
||||||
|
|
@ -65,6 +74,9 @@ namespace PepperDash.Essentials.Core
|
||||||
|
|
||||||
#region IBasicCommunication Members
|
#region IBasicCommunication Members
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// SendBytes method
|
||||||
|
/// </summary>
|
||||||
public void SendBytes(byte[] bytes)
|
public void SendBytes(byte[] bytes)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
|
|
@ -78,11 +90,17 @@ namespace PepperDash.Essentials.Core
|
||||||
|
|
||||||
public event EventHandler<GenericCommMethodReceiveBytesArgs> BytesReceived;
|
public event EventHandler<GenericCommMethodReceiveBytesArgs> BytesReceived;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Connect method
|
||||||
|
/// </summary>
|
||||||
public void Connect()
|
public void Connect()
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Disconnect method
|
||||||
|
/// </summary>
|
||||||
public void Disconnect()
|
public void Disconnect()
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
|
|
@ -97,10 +115,22 @@ namespace PepperDash.Essentials.Core
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a GenericHttpClientEventArgs
|
||||||
|
/// </summary>
|
||||||
public class GenericHttpClientEventArgs : EventArgs
|
public class GenericHttpClientEventArgs : EventArgs
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the ResponseText
|
||||||
|
/// </summary>
|
||||||
public string ResponseText { get; private set; }
|
public string ResponseText { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the RequestPath
|
||||||
|
/// </summary>
|
||||||
public string RequestPath { get; private set; }
|
public string RequestPath { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Error
|
||||||
|
/// </summary>
|
||||||
public HTTP_CALLBACK_ERROR Error { get; set; }
|
public HTTP_CALLBACK_ERROR Error { get; set; }
|
||||||
public GenericHttpClientEventArgs(string response, string request, HTTP_CALLBACK_ERROR error)
|
public GenericHttpClientEventArgs(string response, string request, HTTP_CALLBACK_ERROR error)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -83,6 +83,9 @@ namespace PepperDash.Essentials.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// GetIrOutputPort method
|
||||||
|
/// </summary>
|
||||||
public static IROutputPort GetIrOutputPort(DeviceConfig dc)
|
public static IROutputPort GetIrOutputPort(DeviceConfig dc)
|
||||||
{
|
{
|
||||||
var irControllerKey = dc.Key + "-ir";
|
var irControllerKey = dc.Key + "-ir";
|
||||||
|
|
@ -142,6 +145,9 @@ namespace PepperDash.Essentials.Core
|
||||||
return port;
|
return port;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// GetIrOutputPortController method
|
||||||
|
/// </summary>
|
||||||
public static IrOutputPortController GetIrOutputPortController(DeviceConfig config)
|
public static IrOutputPortController GetIrOutputPortController(DeviceConfig config)
|
||||||
{
|
{
|
||||||
Debug.LogMessage(LogEventLevel.Debug, "Attempting to create new Ir Port Controller");
|
Debug.LogMessage(LogEventLevel.Debug, "Attempting to create new Ir Port Controller");
|
||||||
|
|
@ -159,8 +165,8 @@ namespace PepperDash.Essentials.Core
|
||||||
|
|
||||||
/*
|
/*
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a ready-to-go IrOutputPortController from a DeviceConfig object.
|
/// GetIrOutputPortController method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static IrOutputPortController GetIrOutputPortController(DeviceConfig devConf)
|
public static IrOutputPortController GetIrOutputPortController(DeviceConfig devConf)
|
||||||
{
|
{
|
||||||
var irControllerKey = devConf.Key + "-ir";
|
var irControllerKey = devConf.Key + "-ir";
|
||||||
|
|
@ -222,12 +228,15 @@ namespace PepperDash.Essentials.Core
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Wrapper to help in IR port creation
|
/// Represents a IrOutPortConfig
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class IrOutPortConfig
|
public class IrOutPortConfig
|
||||||
{
|
{
|
||||||
[JsonProperty("port")]
|
[JsonProperty("port")]
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Port
|
||||||
|
/// </summary>
|
||||||
public IROutputPort Port { get; set; }
|
public IROutputPort Port { get; set; }
|
||||||
|
|
||||||
[JsonProperty("fileName")]
|
[JsonProperty("fileName")]
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue