mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-03-15 10:22:29 +00:00
Compare commits
36 Commits
copilot/im
...
dev/3.x
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7137945c94 | ||
|
|
ac393c4885 | ||
|
|
346a5e9e57 | ||
|
|
426ef4ad6b | ||
|
|
bcb65c7fa4 | ||
|
|
c2ff65dce3 | ||
|
|
3feab2593d | ||
|
|
5d90fafbd7 | ||
|
|
7f60dcb4cf | ||
|
|
574e4dfb0f | ||
|
|
76759d35cc | ||
|
|
3ece4f0b7b | ||
|
|
aaa5b0532b | ||
|
|
04c4557528 | ||
|
|
9febbf2557 | ||
|
|
eafade9569 | ||
|
|
4e5b8f3897 | ||
|
|
7bd3ccd54b | ||
|
|
790b5a6fb9 | ||
|
|
fbcd9c84da | ||
|
|
4a2c9fe311 | ||
|
|
bdd398e2e6 | ||
|
|
8be5481ac9 | ||
|
|
dbab427d69 | ||
|
|
db4f540710 | ||
|
|
b64f63ac6b | ||
|
|
b21be608f0 | ||
|
|
6ab3ed9911 | ||
|
|
a9fdf30880 | ||
|
|
ce8b08e312 | ||
|
|
13e833b797 | ||
|
|
2be078da18 | ||
|
|
7330ae2e30 | ||
|
|
a57dddba5e | ||
|
|
0bfec16622 | ||
|
|
94e7b8210f |
247
.github/workflows/essentials-3-dev-build.yml
vendored
Normal file
247
.github/workflows/essentials-3-dev-build.yml
vendored
Normal file
@@ -0,0 +1,247 @@
|
|||||||
|
name: Essentials v3 Development Build
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- feature-3.0.0/*
|
||||||
|
- hotfix-3.0.0/*
|
||||||
|
- release-3.0.0/*
|
||||||
|
- development-3.0.0
|
||||||
|
|
||||||
|
env:
|
||||||
|
SOLUTION_PATH: .
|
||||||
|
SOLUTION_FILE: PepperDash.Essentials
|
||||||
|
VERSION: 0.0.0-buildtype-buildnumber
|
||||||
|
BUILD_TYPE: Debug
|
||||||
|
RELEASE_BRANCH: main
|
||||||
|
jobs:
|
||||||
|
Build_Project_4-Series:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
# Detect environment (Act vs GitHub)
|
||||||
|
- name: Detect environment
|
||||||
|
id: detect_env
|
||||||
|
run: |
|
||||||
|
if [ -n "$ACT" ]; then
|
||||||
|
echo "is_local=true" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "is_local=false" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Install prerequisites
|
||||||
|
run: |
|
||||||
|
if [ "${{ steps.detect_env.outputs.is_local }}" == "true" ]; then
|
||||||
|
# For Act - no sudo needed
|
||||||
|
apt-get update
|
||||||
|
apt-get install -y curl wget libicu-dev git unzip
|
||||||
|
else
|
||||||
|
# For GitHub runners - sudo required
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y curl wget libicu-dev git unzip
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Set Version Number
|
||||||
|
id: setVersion
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
latestVersion="3.0.0"
|
||||||
|
newVersion=$latestVersion
|
||||||
|
phase=""
|
||||||
|
newVersionString=""
|
||||||
|
|
||||||
|
if [[ $GITHUB_REF =~ ^refs/pull/.* ]]; then
|
||||||
|
phase="beta"
|
||||||
|
newVersionString="${newVersion}-${phase}-${GITHUB_RUN_NUMBER}"
|
||||||
|
elif [[ $GITHUB_REF =~ ^refs/heads/hotfix-3.0.0/.* ]]; then
|
||||||
|
phase="hotfix"
|
||||||
|
newVersionString="${newVersion}-${phase}-${GITHUB_RUN_NUMBER}"
|
||||||
|
elif [[ $GITHUB_REF =~ ^refs/heads/feature-3.0.0/.* ]]; then
|
||||||
|
phase="alpha"
|
||||||
|
newVersionString="${newVersion}-${phase}-${GITHUB_RUN_NUMBER}"
|
||||||
|
elif [[ $GITHUB_REF == "refs/heads/development-3.0.0" ]]; then
|
||||||
|
phase="beta"
|
||||||
|
newVersionString="${newVersion}-${phase}-${GITHUB_RUN_NUMBER}"
|
||||||
|
elif [[ $GITHUB_REF =~ ^refs/heads/release-3.0.0/.* ]]; then
|
||||||
|
version=$(echo $GITHUB_REF | awk -F '/' '{print $NF}' | sed 's/v//')
|
||||||
|
phase="rc"
|
||||||
|
newVersionString="${version}-${phase}-${GITHUB_RUN_NUMBER}"
|
||||||
|
else
|
||||||
|
# For local builds or unrecognized branches
|
||||||
|
newVersionString="${newVersion}-local"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "version=$newVersionString" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
# Create Build Properties file
|
||||||
|
- name: Create Build Properties
|
||||||
|
run: |
|
||||||
|
cat > Directory.Build.props << EOF
|
||||||
|
<Project>
|
||||||
|
<PropertyGroup>
|
||||||
|
<Version>${{ steps.setVersion.outputs.version }}</Version>
|
||||||
|
<AssemblyVersion>${{ steps.setVersion.outputs.version }}</AssemblyVersion>
|
||||||
|
<FileVersion>${{ steps.setVersion.outputs.version }}</FileVersion>
|
||||||
|
<InformationalVersion>${{ steps.setVersion.outputs.version }}</InformationalVersion>
|
||||||
|
<PackageVersion>${{ steps.setVersion.outputs.version }}</PackageVersion>
|
||||||
|
<NuGetVersion>${{ steps.setVersion.outputs.version }}</NuGetVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
||||||
|
EOF
|
||||||
|
|
||||||
|
- name: Setup .NET
|
||||||
|
uses: actions/setup-dotnet@v3
|
||||||
|
with:
|
||||||
|
dotnet-version: '8.0.x'
|
||||||
|
|
||||||
|
- name: Restore NuGet Packages
|
||||||
|
run: dotnet restore ${SOLUTION_FILE}.sln
|
||||||
|
|
||||||
|
- name: Build Solution
|
||||||
|
run: dotnet build ${SOLUTION_FILE}.sln --configuration ${BUILD_TYPE} --no-restore
|
||||||
|
|
||||||
|
# Copy the CPZ file to the output directory with version in the filename
|
||||||
|
- name: Copy and Rename CPZ Files
|
||||||
|
run: |
|
||||||
|
mkdir -p ./output/cpz
|
||||||
|
|
||||||
|
# Find the main CPZ file in the build output
|
||||||
|
if [ -f "./src/PepperDash.Essentials/bin/${BUILD_TYPE}/net8/PepperDashEssentials.cpz" ]; then
|
||||||
|
cp "./src/PepperDash.Essentials/bin/${BUILD_TYPE}/net8/PepperDashEssentials.cpz" "./output/cpz/PepperDashEssentials.${{ steps.setVersion.outputs.version }}.cpz"
|
||||||
|
echo "Main CPZ file copied and renamed successfully."
|
||||||
|
else
|
||||||
|
echo "Warning: Main CPZ file not found at expected location."
|
||||||
|
find ./src -name "*.cpz" | xargs -I {} cp {} ./output/cpz/
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Pack Solution
|
||||||
|
run: dotnet pack ${SOLUTION_FILE}.sln --configuration ${BUILD_TYPE} --output ./output/nuget --no-build
|
||||||
|
|
||||||
|
# List build artifacts (runs in both environments)
|
||||||
|
- name: List Build Artifacts
|
||||||
|
run: |
|
||||||
|
echo "=== Build Artifacts ==="
|
||||||
|
echo "NuGet Packages:"
|
||||||
|
find ./output/nuget -type f | sort
|
||||||
|
echo ""
|
||||||
|
echo "CPZ/CPLZ Files:"
|
||||||
|
find ./output -name "*.cpz" -o -name "*.cplz" | sort
|
||||||
|
echo "======================="
|
||||||
|
|
||||||
|
# Enhanced package inspection for local runs
|
||||||
|
- name: Inspect NuGet Packages
|
||||||
|
if: steps.detect_env.outputs.is_local == 'true'
|
||||||
|
run: |
|
||||||
|
echo "=== NuGet Package Details ==="
|
||||||
|
for pkg in $(find ./output/nuget -name "*.nupkg"); do
|
||||||
|
echo "Package: $(basename "$pkg")"
|
||||||
|
echo "Size: $(du -h "$pkg" | cut -f1)"
|
||||||
|
|
||||||
|
# Extract and show package contents
|
||||||
|
echo "Contents:"
|
||||||
|
unzip -l "$pkg" | tail -n +4 | head -n -2
|
||||||
|
echo "--------------------------"
|
||||||
|
|
||||||
|
# Try to extract and show the nuspec file (contains metadata)
|
||||||
|
echo "Metadata:"
|
||||||
|
unzip -p "$pkg" "*.nuspec" 2>/dev/null | grep -E "(<id>|<version>|<description>|<authors>|<dependencies>)" || echo "Metadata extraction failed"
|
||||||
|
echo "--------------------------"
|
||||||
|
done
|
||||||
|
echo "==========================="
|
||||||
|
|
||||||
|
# Tag creation - GitHub version
|
||||||
|
- name: Create tag for non-rc builds (GitHub)
|
||||||
|
if: ${{ !contains(steps.setVersion.outputs.version, 'rc') && steps.detect_env.outputs.is_local == 'false' }}
|
||||||
|
run: |
|
||||||
|
git config --global user.name "GitHub Actions"
|
||||||
|
git config --global user.email "actions@github.com"
|
||||||
|
git tag ${{ steps.setVersion.outputs.version }}
|
||||||
|
git push --tags origin
|
||||||
|
|
||||||
|
# Tag creation - Act mock version
|
||||||
|
- name: Create tag for non-rc builds (Act Mock)
|
||||||
|
if: ${{ !contains(steps.setVersion.outputs.version, 'rc') && steps.detect_env.outputs.is_local == 'true' }}
|
||||||
|
run: |
|
||||||
|
echo "Would create git tag: ${{ steps.setVersion.outputs.version }}"
|
||||||
|
echo "Would push tag to: origin"
|
||||||
|
|
||||||
|
# Release creation - GitHub version
|
||||||
|
- name: Create Release (GitHub)
|
||||||
|
if: steps.detect_env.outputs.is_local == 'false'
|
||||||
|
id: create_release
|
||||||
|
uses: ncipollo/release-action@v1
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
artifacts: 'output/cpz/*,output/**/*.cplz'
|
||||||
|
generateReleaseNotes: true
|
||||||
|
prerelease: ${{contains('debug', env.BUILD_TYPE)}}
|
||||||
|
tag: ${{ steps.setVersion.outputs.version }}
|
||||||
|
|
||||||
|
# Release creation - Act mock version with enhanced output
|
||||||
|
- name: Create Release (Act Mock)
|
||||||
|
if: steps.detect_env.outputs.is_local == 'true'
|
||||||
|
run: |
|
||||||
|
echo "=== Mock Release Creation ==="
|
||||||
|
echo "Would create release with:"
|
||||||
|
echo "- Tag: ${{ steps.setVersion.outputs.version }}"
|
||||||
|
echo "- Prerelease: ${{contains('debug', env.BUILD_TYPE)}}"
|
||||||
|
echo "- Artifacts matching pattern: output/cpz/*,output/**/*.cplz"
|
||||||
|
echo ""
|
||||||
|
echo "Matching artifacts:"
|
||||||
|
find ./output/cpz -type f
|
||||||
|
find ./output -name "*.cplz"
|
||||||
|
|
||||||
|
# Detailed info about release artifacts
|
||||||
|
echo ""
|
||||||
|
echo "Artifact Details:"
|
||||||
|
for artifact in $(find ./output/cpz -type f; find ./output -name "*.cplz"); do
|
||||||
|
echo "File: $(basename "$artifact")"
|
||||||
|
echo "Size: $(du -h "$artifact" | cut -f1)"
|
||||||
|
echo "Created: $(stat -c %y "$artifact")"
|
||||||
|
echo "MD5: $(md5sum "$artifact" | cut -d' ' -f1)"
|
||||||
|
echo "--------------------------"
|
||||||
|
done
|
||||||
|
echo "============================"
|
||||||
|
|
||||||
|
# NuGet setup - GitHub version
|
||||||
|
- name: Setup NuGet (GitHub)
|
||||||
|
if: steps.detect_env.outputs.is_local == 'false'
|
||||||
|
run: |
|
||||||
|
dotnet nuget add source https://nuget.pkg.github.com/pepperdash/index.json -n github -u pepperdash -p ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text
|
||||||
|
|
||||||
|
# NuGet setup - Act mock version
|
||||||
|
- name: Setup NuGet (Act Mock)
|
||||||
|
if: steps.detect_env.outputs.is_local == 'true'
|
||||||
|
run: |
|
||||||
|
echo "=== Mock NuGet Setup ==="
|
||||||
|
echo "Would add GitHub NuGet source: https://nuget.pkg.github.com/pepperdash/index.json"
|
||||||
|
echo "======================="
|
||||||
|
|
||||||
|
# Publish to NuGet - GitHub version
|
||||||
|
- name: Publish to Nuget (GitHub)
|
||||||
|
if: steps.detect_env.outputs.is_local == 'false'
|
||||||
|
run: dotnet nuget push ./output/nuget/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }}
|
||||||
|
|
||||||
|
# Publish to NuGet - Act mock version
|
||||||
|
- name: Publish to Nuget (Act Mock)
|
||||||
|
if: steps.detect_env.outputs.is_local == 'true'
|
||||||
|
run: |
|
||||||
|
echo "=== Mock Publish to NuGet ==="
|
||||||
|
echo "Would publish the following packages to https://api.nuget.org/v3/index.json:"
|
||||||
|
find ./output/nuget -name "*.nupkg" | sort
|
||||||
|
echo "============================="
|
||||||
|
|
||||||
|
# Publish to GitHub NuGet - GitHub version
|
||||||
|
- name: Publish to Github Nuget (GitHub)
|
||||||
|
if: steps.detect_env.outputs.is_local == 'false'
|
||||||
|
run: dotnet nuget push ./output/nuget/*.nupkg --source github --api-key ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
# Publish to GitHub NuGet - Act mock version
|
||||||
|
- name: Publish to Github Nuget (Act Mock)
|
||||||
|
if: steps.detect_env.outputs.is_local == 'true'
|
||||||
|
run: |
|
||||||
|
echo "=== Mock Publish to GitHub NuGet ==="
|
||||||
|
echo "Would publish the following packages to the GitHub NuGet registry:"
|
||||||
|
find ./output/nuget -name "*.nupkg" | sort
|
||||||
|
echo "=================================="
|
||||||
7
runtimeconfig.json
Normal file
7
runtimeconfig.json
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"runtimeOptions": {
|
||||||
|
"configProperties": {
|
||||||
|
"System.Globalization.Invariant": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<Project>
|
<Project>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Version>2.19.4-local</Version>
|
<Version>3.0.0-local</Version>
|
||||||
<InformationalVersion>$(Version)</InformationalVersion>
|
<InformationalVersion>$(Version)</InformationalVersion>
|
||||||
<Authors>PepperDash Technology</Authors>
|
<Authors>PepperDash Technology</Authors>
|
||||||
<Company>PepperDash Technology</Company>
|
<Company>PepperDash Technology</Company>
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
<Project>
|
<Project>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="$(TargetDir)$(TargetName).$(Version).$(TargetFramework).clz" Condition="$(ProjectType) == 'Library'">
|
<None Include="$(TargetDir)$(TargetName).$(Version).$(TargetFramework).clz" Condition="$(ProjectType) == 'Library' And '$(TargetFramework)' != '' And '$(TargetName)' != '' And '$(TargetDir)' != ''">
|
||||||
<Pack>true</Pack>
|
<Pack>true</Pack>
|
||||||
<PackagePath>build;</PackagePath>
|
<PackagePath>build;</PackagePath>
|
||||||
</None>
|
</None>
|
||||||
<None Include="$(TargetDir)$(TargetName).$(Version).$(TargetFramework).cpz" Condition="$(ProjectType) == 'Program'">
|
<None Include="$(TargetDir)$(TargetName).$(Version).$(TargetFramework).cpz" Condition="$(ProjectType) == 'Program' And '$(TargetFramework)' != '' And '$(TargetName)' != '' And '$(TargetDir)' != '' And ( '$(TargetFramework)' != 'net6.0' ) And ( '$(TargetFramework)' != 'net8.0' )">
|
||||||
<Pack>true</Pack>
|
<Pack>true</Pack>
|
||||||
<PackagePath>build;</PackagePath>
|
<PackagePath>build;</PackagePath>
|
||||||
</None>
|
</None>
|
||||||
<None Include="$(TargetDir)$(TargetName).$(Version).$(TargetFramework).cplz" Condition="$(ProjectType) == 'ProgramLibrary'">
|
<None Include="$(TargetDir)$(TargetName).$(Version).$(TargetFramework).cplz" Condition="$(ProjectType) == 'ProgramLibrary' And '$(TargetFramework)' != '' And '$(TargetName)' != '' And '$(TargetDir)' != ''">
|
||||||
<Pack>true</Pack>
|
<Pack>true</Pack>
|
||||||
<PackagePath>build;</PackagePath>
|
<PackagePath>build;</PackagePath>
|
||||||
</None>
|
</None>
|
||||||
|
|||||||
@@ -1,43 +0,0 @@
|
|||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
|
|
||||||
namespace PepperDash.Core
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Helper class for formatting communication text and byte data for debugging purposes.
|
|
||||||
/// </summary>
|
|
||||||
public class ComTextHelper
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Gets escaped text for a byte array
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="bytes"></param>
|
|
||||||
/// <returns>string with all bytes escaped</returns>
|
|
||||||
public static string GetEscapedText(byte[] bytes)
|
|
||||||
{
|
|
||||||
return string.Concat(bytes.Select(b => string.Format(@"[{0:X2}]", (int)b)).ToArray());
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets escaped text for a string
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="text"></param>
|
|
||||||
/// <returns>string with all bytes escaped</returns>
|
|
||||||
public static string GetEscapedText(string text)
|
|
||||||
{
|
|
||||||
var bytes = Encoding.GetEncoding(28591).GetBytes(text);
|
|
||||||
return string.Concat(bytes.Select(b => string.Format(@"[{0:X2}]", (int)b)).ToArray());
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets debug text for a string
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="text"></param>
|
|
||||||
/// <returns>string with all non-printable characters escaped</returns>
|
|
||||||
public static string GetDebugText(string text)
|
|
||||||
{
|
|
||||||
return Regex.Replace(text, @"[^\u0020-\u007E]", a => GetEscapedText(a.Value));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -8,8 +8,8 @@ using Crestron.SimplSharp;
|
|||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
|
|
||||||
|
|
||||||
namespace PepperDash.Core
|
namespace PepperDash.Core;
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defines the string event handler for line events on the gather
|
/// Defines the string event handler for line events on the gather
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -30,7 +30,7 @@ namespace PepperDash.Core
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The communication port that this gathers on
|
/// The communication port that this gathers on
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ICommunicationReceiver Port { get; private set; }
|
public ICommunicationReceiver Port { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Default false. If true, the delimiter will be included in the line output
|
/// Default false. If true, the delimiter will be included in the line output
|
||||||
@@ -67,22 +67,22 @@ namespace PepperDash.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="port"></param>
|
/// <param name="port"></param>
|
||||||
/// <param name="delimiter"></param>
|
/// <param name="delimiter"></param>
|
||||||
public CommunicationGather(ICommunicationReceiver port, string delimiter)
|
public CommunicationGather(ICommunicationReceiver port, string delimiter)
|
||||||
:this(port, new string[] { delimiter} )
|
:this(port, new string[] { delimiter} )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructor for using an array of string delimiters
|
/// Constructor for using an array of string delimiters
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="port"></param>
|
/// <param name="port"></param>
|
||||||
/// <param name="delimiters"></param>
|
/// <param name="delimiters"></param>
|
||||||
public CommunicationGather(ICommunicationReceiver port, string[] delimiters)
|
public CommunicationGather(ICommunicationReceiver port, string[] delimiters)
|
||||||
{
|
{
|
||||||
Port = port;
|
Port = port;
|
||||||
StringDelimiters = delimiters;
|
StringDelimiters = delimiters;
|
||||||
port.TextReceived += Port_TextReceivedStringDelimiter;
|
port.TextReceived += Port_TextReceivedStringDelimiter;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stop method
|
/// Stop method
|
||||||
@@ -135,35 +135,35 @@ namespace PepperDash.Core
|
|||||||
ReceiveBuffer.Append(args.Text);
|
ReceiveBuffer.Append(args.Text);
|
||||||
var str = ReceiveBuffer.ToString();
|
var str = ReceiveBuffer.ToString();
|
||||||
|
|
||||||
// Case: Receiving DEVICE get version\x0d\0x0a+OK "value":"1234"\x0d\x0a
|
// Case: Receiving DEVICE get version\x0d\0x0a+OK "value":"1234"\x0d\x0a
|
||||||
|
|
||||||
// RX: DEV
|
// RX: DEV
|
||||||
// Split: (1) "DEV"
|
// Split: (1) "DEV"
|
||||||
// RX: I
|
// RX: I
|
||||||
// Split: (1) "DEVI"
|
// Split: (1) "DEVI"
|
||||||
// RX: CE get version
|
// RX: CE get version
|
||||||
// Split: (1) "DEVICE get version"
|
// Split: (1) "DEVICE get version"
|
||||||
// RX: \x0d\x0a+OK "value":"1234"\x0d\x0a
|
// RX: \x0d\x0a+OK "value":"1234"\x0d\x0a
|
||||||
// Split: (2) DEVICE get version, +OK "value":"1234"
|
// Split: (2) DEVICE get version, +OK "value":"1234"
|
||||||
|
|
||||||
// Iterate the delimiters and fire an event for any matching delimiter
|
// Iterate the delimiters and fire an event for any matching delimiter
|
||||||
foreach (var delimiter in StringDelimiters)
|
foreach (var delimiter in StringDelimiters)
|
||||||
|
{
|
||||||
|
var lines = Regex.Split(str, delimiter);
|
||||||
|
if (lines.Length == 1)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
for (int i = 0; i < lines.Length - 1; i++)
|
||||||
{
|
{
|
||||||
var lines = Regex.Split(str, delimiter);
|
string strToSend = null;
|
||||||
if (lines.Length == 1)
|
if (IncludeDelimiter)
|
||||||
continue;
|
strToSend = lines[i] + delimiter;
|
||||||
|
else
|
||||||
for (int i = 0; i < lines.Length - 1; i++)
|
strToSend = lines[i];
|
||||||
{
|
handler(this, new GenericCommMethodReceiveTextArgs(strToSend, delimiter));
|
||||||
string strToSend = null;
|
|
||||||
if (IncludeDelimiter)
|
|
||||||
strToSend = lines[i] + delimiter;
|
|
||||||
else
|
|
||||||
strToSend = lines[i];
|
|
||||||
handler(this, new GenericCommMethodReceiveTextArgs(strToSend, delimiter));
|
|
||||||
}
|
|
||||||
ReceiveBuffer = new StringBuilder(lines[lines.Length - 1]);
|
|
||||||
}
|
}
|
||||||
|
ReceiveBuffer = new StringBuilder(lines[lines.Length - 1]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,5 +174,4 @@ namespace PepperDash.Core
|
|||||||
{
|
{
|
||||||
Stop();
|
Stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -1,138 +1,159 @@
|
|||||||
using System.Collections.Generic;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Crestron.SimplSharp;
|
using System.Timers;
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
|
|
||||||
namespace PepperDash.Core
|
namespace PepperDash.Core;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Controls the ability to disable/enable debugging of TX/RX data sent to/from a device with a built in timer to disable
|
||||||
|
/// </summary>
|
||||||
|
public class CommunicationStreamDebugging
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Controls the ability to disable/enable debugging of TX/RX data sent to/from a device with a built in timer to disable
|
/// Device Key that this instance configures
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class CommunicationStreamDebugging
|
public string ParentDeviceKey { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Timer to disable automatically if not manually disabled
|
||||||
|
/// </summary>
|
||||||
|
private Timer DebugExpiryPeriod;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The current debug setting
|
||||||
|
/// </summary>
|
||||||
|
public eStreamDebuggingSetting DebugSetting { get; private set; }
|
||||||
|
|
||||||
|
private uint _DebugTimeoutInMs;
|
||||||
|
private const uint _DefaultDebugTimeoutMin = 30;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Timeout in Minutes
|
||||||
|
/// </summary>
|
||||||
|
public uint DebugTimeoutMinutes
|
||||||
{
|
{
|
||||||
/// <summary>
|
get
|
||||||
/// Device Key that this instance configures
|
|
||||||
/// </summary>
|
|
||||||
public string ParentDeviceKey { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Timer to disable automatically if not manually disabled
|
|
||||||
/// </summary>
|
|
||||||
private CTimer DebugExpiryPeriod;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the DebugSetting
|
|
||||||
/// </summary>
|
|
||||||
public eStreamDebuggingSetting DebugSetting { get; private set; }
|
|
||||||
|
|
||||||
private uint _DebugTimeoutInMs;
|
|
||||||
private const uint _DefaultDebugTimeoutMin = 30;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Timeout in Minutes
|
|
||||||
/// </summary>
|
|
||||||
public uint DebugTimeoutMinutes
|
|
||||||
{
|
{
|
||||||
get
|
return _DebugTimeoutInMs/60000;
|
||||||
{
|
|
||||||
return _DebugTimeoutInMs / 60000;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the RxStreamDebuggingIsEnabled
|
|
||||||
/// </summary>
|
|
||||||
public bool RxStreamDebuggingIsEnabled { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Indicates that transmit stream debugging is enabled
|
|
||||||
/// </summary>
|
|
||||||
public bool TxStreamDebuggingIsEnabled { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Constructor
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="parentDeviceKey"></param>
|
|
||||||
public CommunicationStreamDebugging(string parentDeviceKey)
|
|
||||||
{
|
|
||||||
ParentDeviceKey = parentDeviceKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sets the debugging setting and if not setting to off, assumes the default of 30 mintues
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="setting"></param>
|
|
||||||
/// <summary>
|
|
||||||
/// SetDebuggingWithDefaultTimeout method
|
|
||||||
/// </summary>
|
|
||||||
public void SetDebuggingWithDefaultTimeout(eStreamDebuggingSetting setting)
|
|
||||||
{
|
|
||||||
if (setting == eStreamDebuggingSetting.Off)
|
|
||||||
{
|
|
||||||
DisableDebugging();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
SetDebuggingWithSpecificTimeout(setting, _DefaultDebugTimeoutMin);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sets the debugging setting for the specified number of minutes
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="setting"></param>
|
|
||||||
/// <param name="minutes"></param>
|
|
||||||
/// <summary>
|
|
||||||
/// SetDebuggingWithSpecificTimeout method
|
|
||||||
/// </summary>
|
|
||||||
public void SetDebuggingWithSpecificTimeout(eStreamDebuggingSetting setting, uint minutes)
|
|
||||||
{
|
|
||||||
if (setting == eStreamDebuggingSetting.Off)
|
|
||||||
{
|
|
||||||
DisableDebugging();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_DebugTimeoutInMs = minutes * 60000;
|
|
||||||
|
|
||||||
StopDebugTimer();
|
|
||||||
|
|
||||||
DebugExpiryPeriod = new CTimer((o) => DisableDebugging(), _DebugTimeoutInMs);
|
|
||||||
|
|
||||||
if ((setting & eStreamDebuggingSetting.Rx) == eStreamDebuggingSetting.Rx)
|
|
||||||
RxStreamDebuggingIsEnabled = true;
|
|
||||||
|
|
||||||
if ((setting & eStreamDebuggingSetting.Tx) == eStreamDebuggingSetting.Tx)
|
|
||||||
TxStreamDebuggingIsEnabled = true;
|
|
||||||
|
|
||||||
Debug.SetDeviceDebugSettings(ParentDeviceKey, setting);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Disabled debugging
|
|
||||||
/// </summary>
|
|
||||||
private void DisableDebugging()
|
|
||||||
{
|
|
||||||
StopDebugTimer();
|
|
||||||
|
|
||||||
Debug.SetDeviceDebugSettings(ParentDeviceKey, eStreamDebuggingSetting.Off);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void StopDebugTimer()
|
|
||||||
{
|
|
||||||
RxStreamDebuggingIsEnabled = false;
|
|
||||||
TxStreamDebuggingIsEnabled = false;
|
|
||||||
|
|
||||||
if (DebugExpiryPeriod == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
DebugExpiryPeriod.Stop();
|
|
||||||
DebugExpiryPeriod.Dispose();
|
|
||||||
DebugExpiryPeriod = null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates that receive stream debugging is enabled
|
||||||
|
/// </summary>
|
||||||
|
public bool RxStreamDebuggingIsEnabled{ get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates that transmit stream debugging is enabled
|
||||||
|
/// </summary>
|
||||||
|
public bool TxStreamDebuggingIsEnabled { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="parentDeviceKey"></param>
|
||||||
|
public CommunicationStreamDebugging(string parentDeviceKey)
|
||||||
|
{
|
||||||
|
ParentDeviceKey = parentDeviceKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the debugging setting and if not setting to off, assumes the default of 30 mintues
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="setting"></param>
|
||||||
|
public void SetDebuggingWithDefaultTimeout(eStreamDebuggingSetting setting)
|
||||||
|
{
|
||||||
|
if (setting == eStreamDebuggingSetting.Off)
|
||||||
|
{
|
||||||
|
DisableDebugging();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetDebuggingWithSpecificTimeout(setting, _DefaultDebugTimeoutMin);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the debugging setting for the specified number of minutes
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="setting"></param>
|
||||||
|
/// <param name="minutes"></param>
|
||||||
|
public void SetDebuggingWithSpecificTimeout(eStreamDebuggingSetting setting, uint minutes)
|
||||||
|
{
|
||||||
|
if (setting == eStreamDebuggingSetting.Off)
|
||||||
|
{
|
||||||
|
DisableDebugging();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_DebugTimeoutInMs = minutes * 60000;
|
||||||
|
|
||||||
|
StopDebugTimer();
|
||||||
|
|
||||||
|
DebugExpiryPeriod = new Timer(_DebugTimeoutInMs) { AutoReset = false };
|
||||||
|
DebugExpiryPeriod.Elapsed += (s, e) => DisableDebugging();
|
||||||
|
DebugExpiryPeriod.Start();
|
||||||
|
|
||||||
|
if ((setting & eStreamDebuggingSetting.Rx) == eStreamDebuggingSetting.Rx)
|
||||||
|
RxStreamDebuggingIsEnabled = true;
|
||||||
|
|
||||||
|
if ((setting & eStreamDebuggingSetting.Tx) == eStreamDebuggingSetting.Tx)
|
||||||
|
TxStreamDebuggingIsEnabled = true;
|
||||||
|
|
||||||
|
Debug.SetDeviceDebugSettings(ParentDeviceKey, setting);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Disabled debugging
|
||||||
|
/// </summary>
|
||||||
|
private void DisableDebugging()
|
||||||
|
{
|
||||||
|
StopDebugTimer();
|
||||||
|
|
||||||
|
Debug.SetDeviceDebugSettings(ParentDeviceKey, eStreamDebuggingSetting.Off);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void StopDebugTimer()
|
||||||
|
{
|
||||||
|
RxStreamDebuggingIsEnabled = false;
|
||||||
|
TxStreamDebuggingIsEnabled = false;
|
||||||
|
|
||||||
|
if (DebugExpiryPeriod == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
DebugExpiryPeriod.Stop();
|
||||||
|
DebugExpiryPeriod.Dispose();
|
||||||
|
DebugExpiryPeriod = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The available settings for stream debugging
|
||||||
|
/// </summary>
|
||||||
|
[Flags]
|
||||||
|
public enum eStreamDebuggingSetting
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Debug off
|
||||||
|
/// </summary>
|
||||||
|
Off = 0,
|
||||||
|
/// <summary>
|
||||||
|
/// Debug received data
|
||||||
|
/// </summary>
|
||||||
|
Rx = 1,
|
||||||
|
/// <summary>
|
||||||
|
/// Debug transmitted data
|
||||||
|
/// </summary>
|
||||||
|
Tx = 2,
|
||||||
|
/// <summary>
|
||||||
|
/// Debug both received and transmitted data
|
||||||
|
/// </summary>
|
||||||
|
Both = Rx | Tx
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,93 +1,97 @@
|
|||||||
using System;
|
extern alias NewtonsoftJson;
|
||||||
using Crestron.SimplSharp;
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
using Newtonsoft.Json.Converters;
|
|
||||||
|
|
||||||
namespace PepperDash.Core
|
using System;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using JsonConverter = NewtonsoftJson::Newtonsoft.Json.JsonConverterAttribute;
|
||||||
|
using JsonIgnore = NewtonsoftJson::Newtonsoft.Json.JsonIgnoreAttribute;
|
||||||
|
using JsonProperty = NewtonsoftJson::Newtonsoft.Json.JsonPropertyAttribute;
|
||||||
|
using NullValueHandling = NewtonsoftJson::Newtonsoft.Json.NullValueHandling;
|
||||||
|
using StringEnumConverter = NewtonsoftJson::Newtonsoft.Json.Converters.StringEnumConverter;
|
||||||
|
|
||||||
|
namespace PepperDash.Core;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Config properties that indicate how to communicate with a device for control
|
||||||
|
/// </summary>
|
||||||
|
public class ControlPropertiesConfig
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a ControlPropertiesConfig
|
/// The method of control
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class ControlPropertiesConfig
|
[JsonProperty("method")]
|
||||||
{
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
/// <summary>
|
public eControlMethod Method { get; set; }
|
||||||
/// The method of control
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("method")]
|
|
||||||
[JsonConverter(typeof(StringEnumConverter))]
|
|
||||||
public eControlMethod Method { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The key of the device that contains the control port
|
/// The key of the device that contains the control port
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("controlPortDevKey", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty("controlPortDevKey", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public string ControlPortDevKey { get; set; }
|
public string ControlPortDevKey { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The number of the control port on the device specified by ControlPortDevKey
|
/// The number of the control port on the device specified by ControlPortDevKey
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("controlPortNumber", NullValueHandling = NullValueHandling.Ignore)] // In case "null" is present in config on this value
|
[JsonProperty("controlPortNumber", NullValueHandling = NullValueHandling.Ignore)] // In case "null" is present in config on this value
|
||||||
public uint? ControlPortNumber { get; set; }
|
public uint? ControlPortNumber { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The name of the control port on the device specified by ControlPortDevKey
|
/// The name of the control port on the device specified by ControlPortDevKey
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("controlPortName", NullValueHandling = NullValueHandling.Ignore)] // In case "null" is present in config on this value
|
[JsonProperty("controlPortName", NullValueHandling = NullValueHandling.Ignore)] // In case "null" is present in config on this value
|
||||||
public string ControlPortName { get; set; }
|
public string ControlPortName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Properties for ethernet based communications
|
/// Properties for ethernet based communications
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("tcpSshProperties", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty("tcpSshProperties", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public TcpSshPropertiesConfig TcpSshProperties { get; set; }
|
public TcpSshPropertiesConfig TcpSshProperties { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The filename and path for the IR file
|
/// The filename and path for the IR file
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("irFile", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty("irFile", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public string IrFile { get; set; }
|
public string IrFile { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The IpId of a Crestron device
|
/// The IpId of a Crestron device
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("ipId", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty("ipId", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public string IpId { get; set; }
|
public string IpId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Readonly uint representation of the IpId
|
/// Readonly uint representation of the IpId
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public uint IpIdInt { get { return Convert.ToUInt32(IpId, 16); } }
|
public uint IpIdInt { get { return Convert.ToUInt32(IpId, 16); } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Char indicating end of line
|
/// Char indicating end of line
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("endOfLineChar", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty("endOfLineChar", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public char EndOfLineChar { get; set; }
|
public char EndOfLineChar { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defaults to Environment.NewLine;
|
/// Defaults to Environment.NewLine;
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("endOfLineString", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty("endOfLineString", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public string EndOfLineString { get; set; }
|
public string EndOfLineString { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Indicates
|
/// Indicates
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("deviceReadyResponsePattern", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty("deviceReadyResponsePattern", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public string DeviceReadyResponsePattern { get; set; }
|
public string DeviceReadyResponsePattern { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used when communcating to programs running in VC-4
|
/// Used when communcating to programs running in VC-4
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("roomId", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty("roomId", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public string RoomId { get; set; }
|
public string RoomId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructor
|
/// Constructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ControlPropertiesConfig()
|
public ControlPropertiesConfig()
|
||||||
{
|
{
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -16,236 +16,237 @@ using Crestron.SimplSharp;
|
|||||||
using Crestron.SimplSharp.CrestronSockets;
|
using Crestron.SimplSharp.CrestronSockets;
|
||||||
|
|
||||||
|
|
||||||
namespace PepperDash.Core
|
namespace PepperDash.Core;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Delegate for notifying of socket status changes
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="client"></param>
|
||||||
|
public delegate void GenericSocketStatusChangeEventDelegate(ISocketStatus client);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// EventArgs class for socket status changes
|
||||||
|
/// </summary>
|
||||||
|
public class GenericSocketStatusChageEventArgs : EventArgs
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Delegate for notifying of socket status changes
|
/// Gets or sets the Client
|
||||||
|
/// </summary>
|
||||||
|
public ISocketStatus Client { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="client"></param>
|
/// <param name="client"></param>
|
||||||
public delegate void GenericSocketStatusChangeEventDelegate(ISocketStatus client);
|
public GenericSocketStatusChageEventArgs(ISocketStatus client)
|
||||||
|
{
|
||||||
/// <summary>
|
Client = client;
|
||||||
/// EventArgs class for socket status changes
|
|
||||||
/// </summary>
|
|
||||||
public class GenericSocketStatusChageEventArgs : EventArgs
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the Client
|
|
||||||
/// </summary>
|
|
||||||
public ISocketStatus Client { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="client"></param>
|
|
||||||
public GenericSocketStatusChageEventArgs(ISocketStatus client)
|
|
||||||
{
|
|
||||||
Client = client;
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// S+ Constructor
|
|
||||||
/// </summary>
|
|
||||||
public GenericSocketStatusChageEventArgs() { }
|
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// S+ Constructor
|
||||||
|
/// </summary>
|
||||||
|
public GenericSocketStatusChageEventArgs() { }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Delegate for notifying of TCP Server state changes
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="state"></param>
|
||||||
|
public delegate void GenericTcpServerStateChangedEventDelegate(ServerState state);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// EventArgs class for TCP Server state changes
|
||||||
|
/// </summary>
|
||||||
|
public class GenericTcpServerStateChangedEventArgs : EventArgs
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the State
|
||||||
|
/// </summary>
|
||||||
|
public ServerState State { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Delegate for notifying of TCP Server state changes
|
/// Constructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="state"></param>
|
/// <param name="state"></param>
|
||||||
public delegate void GenericTcpServerStateChangedEventDelegate(ServerState state);
|
public GenericTcpServerStateChangedEventArgs(ServerState state)
|
||||||
|
{
|
||||||
|
State = state;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// S+ Constructor
|
||||||
|
/// </summary>
|
||||||
|
public GenericTcpServerStateChangedEventArgs() { }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Delegate for TCP Server socket status changes
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="socket"></param>
|
||||||
|
/// <param name="clientIndex"></param>
|
||||||
|
/// <param name="clientStatus"></param>
|
||||||
|
public delegate void GenericTcpServerSocketStatusChangeEventDelegate(object socket, uint clientIndex, SocketStatus clientStatus);
|
||||||
|
/// <summary>
|
||||||
|
/// EventArgs for TCP server socket status changes
|
||||||
|
/// </summary>
|
||||||
|
public class GenericTcpServerSocketStatusChangeEventArgs : EventArgs
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Socket
|
||||||
|
/// </summary>
|
||||||
|
public object Socket { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// EventArgs class for TCP Server state changes
|
/// Gets or sets the index of the client from which the status change was received
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class GenericTcpServerStateChangedEventArgs : EventArgs
|
public uint ReceivedFromClientIndex { get; private set; }
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the State
|
|
||||||
/// </summary>
|
|
||||||
public ServerState State { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Gets or sets the ClientStatus
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="state"></param>
|
public SocketStatus ClientStatus { get; set; }
|
||||||
public GenericTcpServerStateChangedEventArgs(ServerState state)
|
|
||||||
{
|
/// <summary>
|
||||||
State = state;
|
/// Constructor
|
||||||
}
|
/// </summary>
|
||||||
/// <summary>
|
/// <param name="socket"></param>
|
||||||
/// S+ Constructor
|
/// <param name="clientStatus"></param>
|
||||||
/// </summary>
|
public GenericTcpServerSocketStatusChangeEventArgs(object socket, SocketStatus clientStatus)
|
||||||
public GenericTcpServerStateChangedEventArgs() { }
|
{
|
||||||
|
Socket = socket;
|
||||||
|
ClientStatus = clientStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Delegate for TCP Server socket status changes
|
/// Constructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="socket"></param>
|
/// <param name="socket"></param>
|
||||||
/// <param name="clientIndex"></param>
|
/// <param name="clientIndex"></param>
|
||||||
/// <param name="clientStatus"></param>
|
/// <param name="clientStatus"></param>
|
||||||
public delegate void GenericTcpServerSocketStatusChangeEventDelegate(object socket, uint clientIndex, SocketStatus clientStatus);
|
public GenericTcpServerSocketStatusChangeEventArgs(object socket, uint clientIndex, SocketStatus clientStatus)
|
||||||
/// <summary>
|
|
||||||
/// EventArgs for TCP server socket status changes
|
|
||||||
/// </summary>
|
|
||||||
public class GenericTcpServerSocketStatusChangeEventArgs : EventArgs
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
Socket = socket;
|
||||||
///
|
ReceivedFromClientIndex = clientIndex;
|
||||||
/// </summary>
|
ClientStatus = clientStatus;
|
||||||
public object Socket { get; private set; }
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// S+ Constructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public uint ReceivedFromClientIndex { get; private set; }
|
public GenericTcpServerSocketStatusChangeEventArgs() { }
|
||||||
/// <summary>
|
}
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public SocketStatus ClientStatus { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// EventArgs for TCP server com method receive text
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="socket"></param>
|
public class GenericTcpServerCommMethodReceiveTextArgs : EventArgs
|
||||||
/// <param name="clientStatus"></param>
|
{
|
||||||
public GenericTcpServerSocketStatusChangeEventArgs(object socket, SocketStatus clientStatus)
|
/// <summary>
|
||||||
{
|
/// Gets or sets the index of the client from which the text was received
|
||||||
Socket = socket;
|
/// </summary>
|
||||||
ClientStatus = clientStatus;
|
public uint ReceivedFromClientIndex { get; private set; }
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Gets the index of the client from which the text was received as a ushort
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="socket"></param>
|
public ushort ReceivedFromClientIndexShort
|
||||||
/// <param name="clientIndex"></param>
|
{
|
||||||
/// <param name="clientStatus"></param>
|
get
|
||||||
public GenericTcpServerSocketStatusChangeEventArgs(object socket, uint clientIndex, SocketStatus clientStatus)
|
|
||||||
{
|
{
|
||||||
Socket = socket;
|
return (ushort)ReceivedFromClientIndex;
|
||||||
ReceivedFromClientIndex = clientIndex;
|
|
||||||
ClientStatus = clientStatus;
|
|
||||||
}
|
}
|
||||||
/// <summary>
|
|
||||||
/// S+ Constructor
|
|
||||||
/// </summary>
|
|
||||||
public GenericTcpServerSocketStatusChangeEventArgs() { }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// EventArgs for TCP server com method receive text
|
/// Gets or sets the Text
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class GenericTcpServerCommMethodReceiveTextArgs : EventArgs
|
public string Text { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text"></param>
|
||||||
|
public GenericTcpServerCommMethodReceiveTextArgs(string text)
|
||||||
{
|
{
|
||||||
/// <summary>
|
Text = text;
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public uint ReceivedFromClientIndex { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public ushort ReceivedFromClientIndexShort
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return (ushort)ReceivedFromClientIndex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the Text
|
|
||||||
/// </summary>
|
|
||||||
public string Text { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="text"></param>
|
|
||||||
public GenericTcpServerCommMethodReceiveTextArgs(string text)
|
|
||||||
{
|
|
||||||
Text = text;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="text"></param>
|
|
||||||
/// <param name="clientIndex"></param>
|
|
||||||
public GenericTcpServerCommMethodReceiveTextArgs(string text, uint clientIndex)
|
|
||||||
{
|
|
||||||
Text = text;
|
|
||||||
ReceivedFromClientIndex = clientIndex;
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// S+ Constructor
|
|
||||||
/// </summary>
|
|
||||||
public GenericTcpServerCommMethodReceiveTextArgs() { }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// EventArgs for TCP server client ready for communication
|
/// Constructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class GenericTcpServerClientReadyForcommunicationsEventArgs : EventArgs
|
/// <param name="text"></param>
|
||||||
|
/// <param name="clientIndex"></param>
|
||||||
|
public GenericTcpServerCommMethodReceiveTextArgs(string text, uint clientIndex)
|
||||||
{
|
{
|
||||||
/// <summary>
|
Text = text;
|
||||||
///
|
ReceivedFromClientIndex = clientIndex;
|
||||||
/// </summary>
|
}
|
||||||
public bool IsReady;
|
/// <summary>
|
||||||
|
/// S+ Constructor
|
||||||
|
/// </summary>
|
||||||
|
public GenericTcpServerCommMethodReceiveTextArgs() { }
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// EventArgs for TCP server client ready for communication
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="isReady"></param>
|
public class GenericTcpServerClientReadyForcommunicationsEventArgs : EventArgs
|
||||||
public GenericTcpServerClientReadyForcommunicationsEventArgs(bool isReady)
|
{
|
||||||
{
|
/// <summary>
|
||||||
IsReady = isReady;
|
/// Gets or sets IsReady
|
||||||
}
|
/// </summary>
|
||||||
/// <summary>
|
public bool IsReady;
|
||||||
/// S+ Constructor
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
public GenericTcpServerClientReadyForcommunicationsEventArgs() { }
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="isReady"></param>
|
||||||
|
public GenericTcpServerClientReadyForcommunicationsEventArgs(bool isReady)
|
||||||
|
{
|
||||||
|
IsReady = isReady;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// EventArgs for UDP connected
|
/// S+ Constructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class GenericUdpConnectedEventArgs : EventArgs
|
public GenericTcpServerClientReadyForcommunicationsEventArgs() { }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// EventArgs for UDP connected
|
||||||
|
/// </summary>
|
||||||
|
public class GenericUdpConnectedEventArgs : EventArgs
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the UConnected
|
||||||
|
/// </summary>
|
||||||
|
public ushort UConnected;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Connected status
|
||||||
|
/// </summary>
|
||||||
|
public bool Connected;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
|
public GenericUdpConnectedEventArgs() { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="uconnected"></param>
|
||||||
|
public GenericUdpConnectedEventArgs(ushort uconnected)
|
||||||
{
|
{
|
||||||
/// <summary>
|
UConnected = uconnected;
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public ushort UConnected;
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public bool Connected;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Constructor
|
|
||||||
/// </summary>
|
|
||||||
public GenericUdpConnectedEventArgs() { }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="uconnected"></param>
|
|
||||||
public GenericUdpConnectedEventArgs(ushort uconnected)
|
|
||||||
{
|
|
||||||
UConnected = uconnected;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="connected"></param>
|
|
||||||
public GenericUdpConnectedEventArgs(bool connected)
|
|
||||||
{
|
|
||||||
Connected = connected;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="connected"></param>
|
||||||
|
public GenericUdpConnectedEventArgs(bool connected)
|
||||||
|
{
|
||||||
|
Connected = connected;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,371 +1,357 @@
|
|||||||
|
|
||||||
|
extern alias NewtonsoftJson;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
using Crestron.SimplSharp.CrestronSockets;
|
using Crestron.SimplSharp.CrestronSockets;
|
||||||
using Newtonsoft.Json;
|
using JsonProperty = NewtonsoftJson::Newtonsoft.Json.JsonPropertyAttribute;
|
||||||
using PepperDash.Core.Logging;
|
using PepperDash.Core.Logging;
|
||||||
|
using Required = NewtonsoftJson::Newtonsoft.Json.Required;
|
||||||
|
|
||||||
namespace PepperDash.Core
|
namespace PepperDash.Core;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Generic UDP Server device
|
||||||
|
/// </summary>
|
||||||
|
public class GenericUdpServer : Device, ISocketStatusWithStreamDebugging
|
||||||
{
|
{
|
||||||
|
private const string SplusKey = "Uninitialized Udp Server";
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Generic UDP Server device
|
/// Object to enable stream debugging
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class GenericUdpServer : Device, ISocketStatusWithStreamDebugging
|
public CommunicationStreamDebugging StreamDebugging { get; private set; }
|
||||||
{
|
/// <summary>
|
||||||
private const string SplusKey = "Uninitialized Udp Server";
|
///
|
||||||
/// <summary>
|
/// </summary>
|
||||||
/// Object to enable stream debugging
|
public event EventHandler<GenericCommMethodReceiveBytesArgs> BytesReceived;
|
||||||
/// </summary>
|
|
||||||
public CommunicationStreamDebugging StreamDebugging { get; private set; }
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public event EventHandler<GenericCommMethodReceiveBytesArgs> BytesReceived;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event EventHandler<GenericCommMethodReceiveTextArgs> TextReceived;
|
public event EventHandler<GenericCommMethodReceiveTextArgs> TextReceived;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This event will fire when a message is dequeued that includes the source IP and Port info if needed to determine the source of the received data.
|
/// This event will fire when a message is dequeued that includes the source IP and Port info if needed to determine the source of the received data.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event EventHandler<GenericUdpReceiveTextExtraArgs> DataRecievedExtra;
|
public event EventHandler<GenericUdpReceiveTextExtraArgs> DataRecievedExtra;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event EventHandler<GenericSocketStatusChageEventArgs> ConnectionChange;
|
public event EventHandler<GenericSocketStatusChageEventArgs> ConnectionChange;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event EventHandler<GenericUdpConnectedEventArgs> UpdateConnectionStatus;
|
public event EventHandler<GenericUdpConnectedEventArgs> UpdateConnectionStatus;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public SocketStatus ClientStatus
|
public SocketStatus ClientStatus
|
||||||
|
{
|
||||||
|
get
|
||||||
{
|
{
|
||||||
get
|
return Server.ServerStatus;
|
||||||
{
|
|
||||||
return Server.ServerStatus;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public ushort UStatus
|
|
||||||
{
|
|
||||||
get { return (ushort)Server.ServerStatus; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Address of server
|
|
||||||
/// </summary>
|
|
||||||
public string Hostname { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Port on server
|
|
||||||
/// </summary>
|
|
||||||
public int Port { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Another damn S+ helper because S+ seems to treat large port nums as signed ints
|
|
||||||
/// which screws up things
|
|
||||||
/// </summary>
|
|
||||||
public ushort UPort
|
|
||||||
{
|
|
||||||
get { return Convert.ToUInt16(Port); }
|
|
||||||
set { Port = Convert.ToInt32(value); }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Indicates that the UDP Server is enabled
|
|
||||||
/// </summary>
|
|
||||||
public bool IsConnected
|
|
||||||
{
|
|
||||||
get;
|
|
||||||
private set;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Numeric value indicating
|
|
||||||
/// </summary>
|
|
||||||
public ushort UIsConnected
|
|
||||||
{
|
|
||||||
get { return IsConnected ? (ushort)1 : (ushort)0; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Defaults to 2000
|
|
||||||
/// </summary>
|
|
||||||
public int BufferSize { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The server
|
|
||||||
/// </summary>
|
|
||||||
public UDPServer Server { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Constructor for S+. Make sure to set key, address, port, and buffersize using init method
|
|
||||||
/// </summary>
|
|
||||||
public GenericUdpServer()
|
|
||||||
: base(SplusKey)
|
|
||||||
{
|
|
||||||
StreamDebugging = new CommunicationStreamDebugging(SplusKey);
|
|
||||||
BufferSize = 5000;
|
|
||||||
|
|
||||||
CrestronEnvironment.ProgramStatusEventHandler += new ProgramStatusEventHandler(CrestronEnvironment_ProgramStatusEventHandler);
|
|
||||||
CrestronEnvironment.EthernetEventHandler += new EthernetEventHandler(CrestronEnvironment_EthernetEventHandler);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="key"></param>
|
|
||||||
/// <param name="address"></param>
|
|
||||||
/// <param name="port"></param>
|
|
||||||
/// <param name="bufferSize"></param>
|
|
||||||
public GenericUdpServer(string key, string address, int port, int bufferSize)
|
|
||||||
: base(key)
|
|
||||||
{
|
|
||||||
StreamDebugging = new CommunicationStreamDebugging(key);
|
|
||||||
Hostname = address;
|
|
||||||
Port = port;
|
|
||||||
BufferSize = bufferSize;
|
|
||||||
|
|
||||||
CrestronEnvironment.ProgramStatusEventHandler += new ProgramStatusEventHandler(CrestronEnvironment_ProgramStatusEventHandler);
|
|
||||||
CrestronEnvironment.EthernetEventHandler += new EthernetEventHandler(CrestronEnvironment_EthernetEventHandler);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Call from S+ to initialize values
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="key"></param>
|
|
||||||
/// <param name="address"></param>
|
|
||||||
/// <param name="port"></param>
|
|
||||||
/// <summary>
|
|
||||||
/// Initialize method
|
|
||||||
/// </summary>
|
|
||||||
public void Initialize(string key, string address, ushort port)
|
|
||||||
{
|
|
||||||
Key = key;
|
|
||||||
Hostname = address;
|
|
||||||
UPort = port;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="ethernetEventArgs"></param>
|
|
||||||
void CrestronEnvironment_EthernetEventHandler(EthernetEventArgs ethernetEventArgs)
|
|
||||||
{
|
|
||||||
// Re-enable the server if the link comes back up and the status should be connected
|
|
||||||
if (ethernetEventArgs.EthernetEventType == eEthernetEventType.LinkUp
|
|
||||||
&& IsConnected)
|
|
||||||
{
|
|
||||||
Connect();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="programEventType"></param>
|
|
||||||
void CrestronEnvironment_ProgramStatusEventHandler(eProgramStatusEventType programEventType)
|
|
||||||
{
|
|
||||||
if (programEventType != eProgramStatusEventType.Stopping)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Debug.Console(1, this, "Program stopping. Disabling Server");
|
|
||||||
Disconnect();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Connect method
|
|
||||||
/// </summary>
|
|
||||||
public void Connect()
|
|
||||||
{
|
|
||||||
if (Server == null)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var address = IPAddress.Parse(Hostname);
|
|
||||||
|
|
||||||
Server = new UDPServer(address, Port, BufferSize);
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
this.LogError("Error parsing IP Address '{ipAddress}': message: {message}", Hostname, ex.Message);
|
|
||||||
this.LogInformation("Creating UDPServer with default buffersize");
|
|
||||||
|
|
||||||
Server = new UDPServer();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(Hostname))
|
|
||||||
{
|
|
||||||
Debug.Console(1, Debug.ErrorLogLevel.Warning, "GenericUdpServer '{0}': No address set", Key);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (Port < 1 || Port > 65535)
|
|
||||||
{
|
|
||||||
{
|
|
||||||
Debug.Console(1, Debug.ErrorLogLevel.Warning, "GenericUdpServer '{0}': Invalid port", Key);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var status = Server.EnableUDPServer(Hostname, Port);
|
|
||||||
|
|
||||||
Debug.Console(2, this, "SocketErrorCode: {0}", status);
|
|
||||||
if (status == SocketErrorCodes.SOCKET_OK)
|
|
||||||
IsConnected = true;
|
|
||||||
|
|
||||||
var handler = UpdateConnectionStatus;
|
|
||||||
if (handler != null)
|
|
||||||
handler(this, new GenericUdpConnectedEventArgs(UIsConnected));
|
|
||||||
|
|
||||||
// Start receiving data
|
|
||||||
Server.ReceiveDataAsync(Receive);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Disconnect method
|
|
||||||
/// </summary>
|
|
||||||
public void Disconnect()
|
|
||||||
{
|
|
||||||
if (Server != null)
|
|
||||||
Server.DisableUDPServer();
|
|
||||||
|
|
||||||
IsConnected = false;
|
|
||||||
|
|
||||||
var handler = UpdateConnectionStatus;
|
|
||||||
if (handler != null)
|
|
||||||
handler(this, new GenericUdpConnectedEventArgs(UIsConnected));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Recursive method to receive data
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="server"></param>
|
|
||||||
/// <param name="numBytes"></param>
|
|
||||||
void Receive(UDPServer server, int numBytes)
|
|
||||||
{
|
|
||||||
Debug.Console(2, this, "Received {0} bytes", numBytes);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (numBytes <= 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var sourceIp = Server.IPAddressLastMessageReceivedFrom;
|
|
||||||
var sourcePort = Server.IPPortLastMessageReceivedFrom;
|
|
||||||
var bytes = server.IncomingDataBuffer.Take(numBytes).ToArray();
|
|
||||||
var str = Encoding.GetEncoding(28591).GetString(bytes, 0, bytes.Length);
|
|
||||||
|
|
||||||
var dataRecivedExtra = DataRecievedExtra;
|
|
||||||
if (dataRecivedExtra != null)
|
|
||||||
dataRecivedExtra(this, new GenericUdpReceiveTextExtraArgs(str, sourceIp, sourcePort, bytes));
|
|
||||||
|
|
||||||
Debug.Console(2, this, "Bytes: {0}", bytes.ToString());
|
|
||||||
var bytesHandler = BytesReceived;
|
|
||||||
if (bytesHandler != null)
|
|
||||||
{
|
|
||||||
this.PrintReceivedBytes(bytes);
|
|
||||||
bytesHandler(this, new GenericCommMethodReceiveBytesArgs(bytes));
|
|
||||||
}
|
|
||||||
var textHandler = TextReceived;
|
|
||||||
if (textHandler != null)
|
|
||||||
{
|
|
||||||
this.PrintReceivedText(str);
|
|
||||||
textHandler(this, new GenericCommMethodReceiveTextArgs(str));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
this.LogException(ex, "GenericUdpServer Receive error");
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
server.ReceiveDataAsync(Receive);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// General send method
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="text"></param>
|
|
||||||
/// <summary>
|
|
||||||
/// SendText method
|
|
||||||
/// </summary>
|
|
||||||
public void SendText(string text)
|
|
||||||
{
|
|
||||||
var bytes = Encoding.GetEncoding(28591).GetBytes(text);
|
|
||||||
|
|
||||||
if (IsConnected && Server != null)
|
|
||||||
{
|
|
||||||
this.PrintSentText(text);
|
|
||||||
|
|
||||||
Server.SendData(bytes, bytes.Length);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="bytes"></param>
|
|
||||||
/// <summary>
|
|
||||||
/// SendBytes method
|
|
||||||
/// </summary>
|
|
||||||
public void SendBytes(byte[] bytes)
|
|
||||||
{
|
|
||||||
this.PrintSentBytes(bytes);
|
|
||||||
|
|
||||||
if (IsConnected && Server != null)
|
|
||||||
Server.SendData(bytes, bytes.Length);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a GenericUdpReceiveTextExtraArgs
|
/// Represents a GenericUdpReceiveTextExtraArgs
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class GenericUdpReceiveTextExtraArgs : EventArgs
|
public ushort UStatus
|
||||||
{
|
{
|
||||||
/// <summary>
|
get { return (ushort)Server.ServerStatus; }
|
||||||
///
|
}
|
||||||
/// </summary>
|
|
||||||
|
/// <summary>
|
||||||
|
/// Address of server
|
||||||
|
/// </summary>
|
||||||
|
public string Hostname { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Port on server
|
||||||
|
/// </summary>
|
||||||
|
public int Port { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Another damn S+ helper because S+ seems to treat large port nums as signed ints
|
||||||
|
/// which screws up things
|
||||||
|
/// </summary>
|
||||||
|
public ushort UPort
|
||||||
|
{
|
||||||
|
get { return Convert.ToUInt16(Port); }
|
||||||
|
set { Port = Convert.ToInt32(value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates that the UDP Server is enabled
|
||||||
|
/// </summary>
|
||||||
|
public bool IsConnected
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
private set;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Numeric value indicating
|
||||||
|
/// </summary>
|
||||||
|
public ushort UIsConnected
|
||||||
|
{
|
||||||
|
get { return IsConnected ? (ushort)1 : (ushort)0; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Defaults to 2000
|
||||||
|
/// </summary>
|
||||||
|
public int BufferSize { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The server
|
||||||
|
/// </summary>
|
||||||
|
public UDPServer Server { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor for S+. Make sure to set key, address, port, and buffersize using init method
|
||||||
|
/// </summary>
|
||||||
|
public GenericUdpServer()
|
||||||
|
: base(SplusKey)
|
||||||
|
{
|
||||||
|
StreamDebugging = new CommunicationStreamDebugging(SplusKey);
|
||||||
|
BufferSize = 5000;
|
||||||
|
|
||||||
|
CrestronEnvironment.ProgramStatusEventHandler += new ProgramStatusEventHandler(CrestronEnvironment_ProgramStatusEventHandler);
|
||||||
|
CrestronEnvironment.EthernetEventHandler += new EthernetEventHandler(CrestronEnvironment_EthernetEventHandler);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <param name="address"></param>
|
||||||
|
/// <param name="port"></param>
|
||||||
|
/// <param name="buffefSize"></param>
|
||||||
|
public GenericUdpServer(string key, string address, int port, int buffefSize)
|
||||||
|
: base(key)
|
||||||
|
{
|
||||||
|
StreamDebugging = new CommunicationStreamDebugging(key);
|
||||||
|
Hostname = address;
|
||||||
|
Port = port;
|
||||||
|
BufferSize = buffefSize;
|
||||||
|
|
||||||
|
CrestronEnvironment.ProgramStatusEventHandler += new ProgramStatusEventHandler(CrestronEnvironment_ProgramStatusEventHandler);
|
||||||
|
CrestronEnvironment.EthernetEventHandler += new EthernetEventHandler(CrestronEnvironment_EthernetEventHandler);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Call from S+ to initialize values
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <param name="address"></param>
|
||||||
|
/// <param name="port"></param>
|
||||||
|
public void Initialize(string key, string address, ushort port)
|
||||||
|
{
|
||||||
|
Key = key;
|
||||||
|
Hostname = address;
|
||||||
|
UPort = port;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ethernetEventArgs"></param>
|
||||||
|
void CrestronEnvironment_EthernetEventHandler(EthernetEventArgs ethernetEventArgs)
|
||||||
|
{
|
||||||
|
// Re-enable the server if the link comes back up and the status should be connected
|
||||||
|
if (ethernetEventArgs.EthernetEventType == eEthernetEventType.LinkUp
|
||||||
|
&& IsConnected)
|
||||||
|
{
|
||||||
|
Connect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="programEventType"></param>
|
||||||
|
void CrestronEnvironment_ProgramStatusEventHandler(eProgramStatusEventType programEventType)
|
||||||
|
{
|
||||||
|
if (programEventType != eProgramStatusEventType.Stopping)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Debug.Console(1, this, "Program stopping. Disabling Server");
|
||||||
|
Disconnect();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enables the UDP Server
|
||||||
|
/// </summary>
|
||||||
|
public void Connect()
|
||||||
|
{
|
||||||
|
if (Server == null)
|
||||||
|
{
|
||||||
|
Server = new UDPServer();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(Hostname))
|
||||||
|
{
|
||||||
|
Debug.Console(1, Debug.ErrorLogLevel.Warning, "GenericUdpServer '{0}': No address set", Key);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (Port < 1 || Port > 65535)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
Debug.Console(1, Debug.ErrorLogLevel.Warning, "GenericUdpServer '{0}': Invalid port", Key);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var status = Server.EnableUDPServer(Hostname, Port);
|
||||||
|
|
||||||
|
Debug.Console(2, this, "SocketErrorCode: {0}", status);
|
||||||
|
if (status == SocketErrorCodes.SOCKET_OK)
|
||||||
|
IsConnected = true;
|
||||||
|
|
||||||
|
var handler = UpdateConnectionStatus;
|
||||||
|
if (handler != null)
|
||||||
|
handler(this, new GenericUdpConnectedEventArgs(UIsConnected));
|
||||||
|
|
||||||
|
// Start receiving data
|
||||||
|
Server.ReceiveDataAsync(Receive);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Disabled the UDP Server
|
||||||
|
/// </summary>
|
||||||
|
public void Disconnect()
|
||||||
|
{
|
||||||
|
if(Server != null)
|
||||||
|
Server.DisableUDPServer();
|
||||||
|
|
||||||
|
IsConnected = false;
|
||||||
|
|
||||||
|
var handler = UpdateConnectionStatus;
|
||||||
|
if (handler != null)
|
||||||
|
handler(this, new GenericUdpConnectedEventArgs(UIsConnected));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Recursive method to receive data
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="server"></param>
|
||||||
|
/// <param name="numBytes"></param>
|
||||||
|
void Receive(UDPServer server, int numBytes)
|
||||||
|
{
|
||||||
|
Debug.Console(2, this, "Received {0} bytes", numBytes);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (numBytes <= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var sourceIp = Server.IPAddressLastMessageReceivedFrom;
|
||||||
|
var sourcePort = Server.IPPortLastMessageReceivedFrom;
|
||||||
|
var bytes = server.IncomingDataBuffer.Take(numBytes).ToArray();
|
||||||
|
var str = Encoding.GetEncoding(28591).GetString(bytes, 0, bytes.Length);
|
||||||
|
|
||||||
|
var dataRecivedExtra = DataRecievedExtra;
|
||||||
|
if (dataRecivedExtra != null)
|
||||||
|
dataRecivedExtra(this, new GenericUdpReceiveTextExtraArgs(str, sourceIp, sourcePort, bytes));
|
||||||
|
|
||||||
|
Debug.Console(2, this, "Bytes: {0}", bytes.ToString());
|
||||||
|
var bytesHandler = BytesReceived;
|
||||||
|
if (bytesHandler != null)
|
||||||
|
{
|
||||||
|
if (StreamDebugging.RxStreamDebuggingIsEnabled)
|
||||||
|
{
|
||||||
|
Debug.Console(0, this, "Received {1} bytes: '{0}'", ComTextHelper.GetEscapedText(bytes), bytes.Length);
|
||||||
|
}
|
||||||
|
bytesHandler(this, new GenericCommMethodReceiveBytesArgs(bytes));
|
||||||
|
}
|
||||||
|
var textHandler = TextReceived;
|
||||||
|
if (textHandler != null)
|
||||||
|
{
|
||||||
|
if (StreamDebugging.RxStreamDebuggingIsEnabled)
|
||||||
|
Debug.Console(0, this, "Received {1} characters of text: '{0}'", ComTextHelper.GetDebugText(str), str.Length);
|
||||||
|
textHandler(this, new GenericCommMethodReceiveTextArgs(str));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
this.LogException(ex, "GenericUdpServer Receive error");
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
server.ReceiveDataAsync(Receive);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// General send method
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text"></param>
|
||||||
|
public void SendText(string text)
|
||||||
|
{
|
||||||
|
var bytes = Encoding.GetEncoding(28591).GetBytes(text);
|
||||||
|
|
||||||
|
if (IsConnected && Server != null)
|
||||||
|
{
|
||||||
|
if (StreamDebugging.TxStreamDebuggingIsEnabled)
|
||||||
|
Debug.Console(0, this, "Sending {0} characters of text: '{1}'", text.Length, ComTextHelper.GetDebugText(text));
|
||||||
|
|
||||||
|
Server.SendData(bytes, bytes.Length);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="bytes"></param>
|
||||||
|
public void SendBytes(byte[] bytes)
|
||||||
|
{
|
||||||
|
if (StreamDebugging.TxStreamDebuggingIsEnabled)
|
||||||
|
Debug.Console(0, this, "Sending {0} bytes: '{1}'", bytes.Length, ComTextHelper.GetEscapedText(bytes));
|
||||||
|
|
||||||
|
if (IsConnected && Server != null)
|
||||||
|
Server.SendData(bytes, bytes.Length);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public class GenericUdpReceiveTextExtraArgs : EventArgs
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string Text { get; private set; }
|
public string Text { get; private set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string IpAddress { get; private set; }
|
public string IpAddress { get; private set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int Port { get; private set; }
|
public int Port { get; private set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public byte[] Bytes { get; private set; }
|
public byte[] Bytes { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="text"></param>
|
/// <param name="text"></param>
|
||||||
/// <param name="ipAddress"></param>
|
/// <param name="ipAddress"></param>
|
||||||
/// <param name="port"></param>
|
/// <param name="port"></param>
|
||||||
/// <param name="bytes"></param>
|
/// <param name="bytes"></param>
|
||||||
public GenericUdpReceiveTextExtraArgs(string text, string ipAddress, int port, byte[] bytes)
|
public GenericUdpReceiveTextExtraArgs(string text, string ipAddress, int port, byte[] bytes)
|
||||||
{
|
{
|
||||||
Text = text;
|
Text = text;
|
||||||
@@ -380,34 +366,33 @@ namespace PepperDash.Core
|
|||||||
public GenericUdpReceiveTextExtraArgs() { }
|
public GenericUdpReceiveTextExtraArgs() { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public class UdpServerPropertiesConfig
|
||||||
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class UdpServerPropertiesConfig
|
[JsonProperty(Required = Required.Always)]
|
||||||
|
public string Address { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty(Required = Required.Always)]
|
||||||
|
public int Port { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Defaults to 32768
|
||||||
|
/// </summary>
|
||||||
|
public int BufferSize { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public UdpServerPropertiesConfig()
|
||||||
{
|
{
|
||||||
/// <summary>
|
BufferSize = 32768;
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty(Required = Required.Always)]
|
|
||||||
public string Address { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty(Required = Required.Always)]
|
|
||||||
public int Port { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Defaults to 32768
|
|
||||||
/// </summary>
|
|
||||||
public int BufferSize { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public UdpServerPropertiesConfig()
|
|
||||||
{
|
|
||||||
BufferSize = 32768;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,59 +1,60 @@
|
|||||||
using Newtonsoft.Json;
|
extern alias NewtonsoftJson;
|
||||||
|
|
||||||
namespace PepperDash.Core
|
using JsonProperty = NewtonsoftJson::Newtonsoft.Json.JsonPropertyAttribute;
|
||||||
|
|
||||||
|
namespace PepperDash.Core;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Client config object for TCP client with server that inherits from TcpSshPropertiesConfig and adds properties for shared key and heartbeat
|
||||||
|
/// </summary>
|
||||||
|
public class TcpClientConfigObject
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a TcpClientConfigObject
|
/// TcpSsh Properties
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class TcpClientConfigObject
|
[JsonProperty("control")]
|
||||||
{
|
public ControlPropertiesConfig Control { get; set; }
|
||||||
/// <summary>
|
|
||||||
/// TcpSsh Properties
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("control")]
|
|
||||||
public ControlPropertiesConfig Control { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Bool value for secure. Currently not implemented in TCP sockets as they are not dynamic
|
/// Bool value for secure. Currently not implemented in TCP sockets as they are not dynamic
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("secure")]
|
[JsonProperty("secure")]
|
||||||
public bool Secure { get; set; }
|
public bool Secure { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Require a shared key that both server and client negotiate. If negotiation fails server disconnects the client
|
/// Require a shared key that both server and client negotiate. If negotiation fails server disconnects the client
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("sharedKeyRequired")]
|
[JsonProperty("sharedKeyRequired")]
|
||||||
public bool SharedKeyRequired { get; set; }
|
public bool SharedKeyRequired { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The shared key that must match on the server and client
|
/// The shared key that must match on the server and client
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("sharedKey")]
|
[JsonProperty("sharedKey")]
|
||||||
public string SharedKey { get; set; }
|
public string SharedKey { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Require a heartbeat on the client/server connection that will cause the server/client to disconnect if the heartbeat is not received.
|
/// Require a heartbeat on the client/server connection that will cause the server/client to disconnect if the heartbeat is not received.
|
||||||
/// heartbeats do not raise received events.
|
/// heartbeats do not raise received events.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("heartbeatRequired")]
|
[JsonProperty("heartbeatRequired")]
|
||||||
public bool HeartbeatRequired { get; set; }
|
public bool HeartbeatRequired { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The interval in seconds for the heartbeat from the client. If not received client is disconnected
|
/// The interval in seconds for the heartbeat from the client. If not received client is disconnected
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("heartbeatRequiredIntervalInSeconds")]
|
[JsonProperty("heartbeatRequiredIntervalInSeconds")]
|
||||||
public ushort HeartbeatRequiredIntervalInSeconds { get; set; }
|
public ushort HeartbeatRequiredIntervalInSeconds { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// HeartbeatString that will be checked against the message received. defaults to heartbeat if no string is provided.
|
/// HeartbeatString that will be checked against the message received. defaults to heartbeat if no string is provided.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("heartbeatStringToMatch")]
|
[JsonProperty("heartbeatStringToMatch")]
|
||||||
public string HeartbeatStringToMatch { get; set; }
|
public string HeartbeatStringToMatch { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Receive Queue size must be greater than 20 or defaults to 20
|
/// Receive Queue size must be greater than 20 or defaults to 20
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("receiveQueueSize")]
|
[JsonProperty("receiveQueueSize")]
|
||||||
public int ReceiveQueueSize { get; set; }
|
public int ReceiveQueueSize { get; set; }
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -4,57 +4,56 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
|
|
||||||
namespace PepperDash.Core
|
namespace PepperDash.Core;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Tcp Server Config object with properties for a tcp server with shared key and heartbeat capabilities
|
||||||
|
/// </summary>
|
||||||
|
public class TcpServerConfigObject
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tcp Server Config object with properties for a tcp server with shared key and heartbeat capabilities
|
/// Uique key
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class TcpServerConfigObject
|
public string Key { get; set; }
|
||||||
{
|
/// <summary>
|
||||||
/// <summary>
|
/// Max Clients that the server will allow to connect.
|
||||||
/// Uique key
|
/// </summary>
|
||||||
/// </summary>
|
public ushort MaxClients { get; set; }
|
||||||
public string Key { get; set; }
|
/// <summary>
|
||||||
/// <summary>
|
/// Bool value for secure. Currently not implemented in TCP sockets as they are not dynamic
|
||||||
/// Max Clients that the server will allow to connect.
|
/// </summary>
|
||||||
/// </summary>
|
public bool Secure { get; set; }
|
||||||
public ushort MaxClients { get; set; }
|
/// <summary>
|
||||||
/// <summary>
|
/// Port for the server to listen on
|
||||||
/// Bool value for secure. Currently not implemented in TCP sockets as they are not dynamic
|
/// </summary>
|
||||||
/// </summary>
|
public int Port { get; set; }
|
||||||
public bool Secure { get; set; }
|
/// <summary>
|
||||||
/// <summary>
|
/// Require a shared key that both server and client negotiate. If negotiation fails server disconnects the client
|
||||||
/// Port for the server to listen on
|
/// </summary>
|
||||||
/// </summary>
|
public bool SharedKeyRequired { get; set; }
|
||||||
public int Port { get; set; }
|
/// <summary>
|
||||||
/// <summary>
|
/// The shared key that must match on the server and client
|
||||||
/// Require a shared key that both server and client negotiate. If negotiation fails server disconnects the client
|
/// </summary>
|
||||||
/// </summary>
|
public string SharedKey { get; set; }
|
||||||
public bool SharedKeyRequired { get; set; }
|
/// <summary>
|
||||||
/// <summary>
|
/// Require a heartbeat on the client/server connection that will cause the server/client to disconnect if the heartbeat is not received.
|
||||||
/// The shared key that must match on the server and client
|
/// heartbeats do not raise received events.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string SharedKey { get; set; }
|
public bool HeartbeatRequired { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Require a heartbeat on the client/server connection that will cause the server/client to disconnect if the heartbeat is not received.
|
/// The interval in seconds for the heartbeat from the client. If not received client is disconnected
|
||||||
/// heartbeats do not raise received events.
|
/// </summary>
|
||||||
/// </summary>
|
public ushort HeartbeatRequiredIntervalInSeconds { get; set; }
|
||||||
public bool HeartbeatRequired { get; set; }
|
/// <summary>
|
||||||
/// <summary>
|
/// HeartbeatString that will be checked against the message received. defaults to heartbeat if no string is provided.
|
||||||
/// The interval in seconds for the heartbeat from the client. If not received client is disconnected
|
/// </summary>
|
||||||
/// </summary>
|
public string HeartbeatStringToMatch { get; set; }
|
||||||
public ushort HeartbeatRequiredIntervalInSeconds { get; set; }
|
/// <summary>
|
||||||
/// <summary>
|
/// Client buffer size. See Crestron help. defaults to 2000 if not greater than 2000
|
||||||
/// HeartbeatString that will be checked against the message received. defaults to heartbeat if no string is provided.
|
/// </summary>
|
||||||
/// </summary>
|
public int BufferSize { get; set; }
|
||||||
public string HeartbeatStringToMatch { get; set; }
|
/// <summary>
|
||||||
/// <summary>
|
/// Receive Queue size must be greater than 20 or defaults to 20
|
||||||
/// Client buffer size. See Crestron help. defaults to 2000 if not greater than 2000
|
/// </summary>
|
||||||
/// </summary>
|
public int ReceiveQueueSize { get; set; }
|
||||||
public int BufferSize { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// Receive Queue size must be greater than 20 or defaults to 20
|
|
||||||
/// </summary>
|
|
||||||
public int ReceiveQueueSize { get; set; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -4,84 +4,83 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
|
|
||||||
namespace PepperDash.Core
|
namespace PepperDash.Core;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Crestron Control Methods for a comm object
|
||||||
|
/// </summary>
|
||||||
|
public enum eControlMethod
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Crestron Control Methods for a comm object
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public enum eControlMethod
|
None = 0,
|
||||||
{
|
/// <summary>
|
||||||
/// <summary>
|
/// RS232/422/485
|
||||||
///
|
/// </summary>
|
||||||
/// </summary>
|
Com,
|
||||||
None = 0,
|
/// <summary>
|
||||||
/// <summary>
|
/// Crestron IpId (most Crestron ethernet devices)
|
||||||
/// RS232/422/485
|
/// </summary>
|
||||||
/// </summary>
|
IpId,
|
||||||
Com,
|
/// <summary>
|
||||||
/// <summary>
|
/// Crestron IpIdTcp (HD-MD series, etc.)
|
||||||
/// Crestron IpId (most Crestron ethernet devices)
|
/// </summary>
|
||||||
/// </summary>
|
IpidTcp,
|
||||||
IpId,
|
/// <summary>
|
||||||
/// <summary>
|
/// Crestron IR control
|
||||||
/// Crestron IpIdTcp (HD-MD series, etc.)
|
/// </summary>
|
||||||
/// </summary>
|
IR,
|
||||||
IpidTcp,
|
/// <summary>
|
||||||
/// <summary>
|
/// SSH client
|
||||||
/// Crestron IR control
|
/// </summary>
|
||||||
/// </summary>
|
Ssh,
|
||||||
IR,
|
/// <summary>
|
||||||
/// <summary>
|
/// TCP/IP client
|
||||||
/// SSH client
|
/// </summary>
|
||||||
/// </summary>
|
Tcpip,
|
||||||
Ssh,
|
/// <summary>
|
||||||
/// <summary>
|
/// Telnet
|
||||||
/// TCP/IP client
|
/// </summary>
|
||||||
/// </summary>
|
Telnet,
|
||||||
Tcpip,
|
/// <summary>
|
||||||
/// <summary>
|
/// Crestnet device
|
||||||
/// Telnet
|
/// </summary>
|
||||||
/// </summary>
|
Cresnet,
|
||||||
Telnet,
|
/// <summary>
|
||||||
/// <summary>
|
/// CEC Control, via a DM HDMI port
|
||||||
/// Crestnet device
|
/// </summary>
|
||||||
/// </summary>
|
Cec,
|
||||||
Cresnet,
|
/// <summary>
|
||||||
/// <summary>
|
/// UDP Server
|
||||||
/// CEC Control, via a DM HDMI port
|
/// </summary>
|
||||||
/// </summary>
|
Udp,
|
||||||
Cec,
|
/// <summary>
|
||||||
/// <summary>
|
/// HTTP client
|
||||||
/// UDP Server
|
/// </summary>
|
||||||
/// </summary>
|
Http,
|
||||||
Udp,
|
/// <summary>
|
||||||
/// <summary>
|
/// HTTPS client
|
||||||
/// HTTP client
|
/// </summary>
|
||||||
/// </summary>
|
Https,
|
||||||
Http,
|
/// <summary>
|
||||||
/// <summary>
|
/// Websocket client
|
||||||
/// HTTPS client
|
/// </summary>
|
||||||
/// </summary>
|
Ws,
|
||||||
Https,
|
/// <summary>
|
||||||
/// <summary>
|
/// Secure Websocket client
|
||||||
/// Websocket client
|
/// </summary>
|
||||||
/// </summary>
|
Wss,
|
||||||
Ws,
|
/// <summary>
|
||||||
/// <summary>
|
/// Secure TCP/IP
|
||||||
/// Secure Websocket client
|
/// </summary>
|
||||||
/// </summary>
|
SecureTcpIp,
|
||||||
Wss,
|
/// <summary>
|
||||||
/// <summary>
|
/// Crestron COM bridge
|
||||||
/// Secure TCP/IP
|
/// </summary>
|
||||||
/// </summary>
|
ComBridge,
|
||||||
SecureTcpIp,
|
/// <summary>
|
||||||
/// <summary>
|
/// Crestron Infinet EX device
|
||||||
/// Used when comms needs to be handled in SIMPL and bridged opposite the normal direction
|
/// </summary>
|
||||||
/// </summary>
|
InfinetEx
|
||||||
ComBridge,
|
|
||||||
/// <summary>
|
|
||||||
/// InfinetEX control
|
|
||||||
/// </summary>
|
|
||||||
InfinetEx
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
using System;
|
|
||||||
|
|
||||||
namespace PepperDash.Core
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// The available settings for stream debugging
|
|
||||||
/// </summary>
|
|
||||||
[Flags]
|
|
||||||
public enum eStreamDebuggingSetting
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Debug off
|
|
||||||
/// </summary>
|
|
||||||
Off = 0,
|
|
||||||
/// <summary>
|
|
||||||
/// Debug received data
|
|
||||||
/// </summary>
|
|
||||||
Rx = 1,
|
|
||||||
/// <summary>
|
|
||||||
/// Debug transmitted data
|
|
||||||
/// </summary>
|
|
||||||
Tx = 2,
|
|
||||||
/// <summary>
|
|
||||||
/// Debug both received and transmitted data
|
|
||||||
/// </summary>
|
|
||||||
Both = Rx | Tx
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,136 +1,143 @@
|
|||||||
using System;
|
extern alias NewtonsoftJson;
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
using Crestron.SimplSharp.CrestronSockets;
|
using Crestron.SimplSharp.CrestronSockets;
|
||||||
using Newtonsoft.Json;
|
using JsonConverter = NewtonsoftJson::Newtonsoft.Json.JsonConverterAttribute;
|
||||||
|
using JsonProperty = NewtonsoftJson::Newtonsoft.Json.JsonPropertyAttribute;
|
||||||
|
using StringEnumConverter = NewtonsoftJson::Newtonsoft.Json.Converters.StringEnumConverter;
|
||||||
|
|
||||||
namespace PepperDash.Core
|
namespace PepperDash.Core;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// An incoming communication stream
|
||||||
|
/// </summary>
|
||||||
|
public interface ICommunicationReceiver : IKeyed
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// An incoming communication stream
|
/// Notifies of bytes received
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface ICommunicationReceiver : IKeyed
|
event EventHandler<GenericCommMethodReceiveBytesArgs> BytesReceived;
|
||||||
{
|
/// <summary>
|
||||||
/// <summary>
|
/// Notifies of text received
|
||||||
/// Notifies of bytes received
|
/// </summary>
|
||||||
/// </summary>
|
event EventHandler<GenericCommMethodReceiveTextArgs> TextReceived;
|
||||||
event EventHandler<GenericCommMethodReceiveBytesArgs> BytesReceived;
|
|
||||||
/// <summary>
|
|
||||||
/// Notifies of text received
|
|
||||||
/// </summary>
|
|
||||||
event EventHandler<GenericCommMethodReceiveTextArgs> TextReceived;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Indicates connection status
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("isConnected")]
|
|
||||||
bool IsConnected { get; }
|
|
||||||
/// <summary>
|
|
||||||
/// Connect to the device
|
|
||||||
/// </summary>
|
|
||||||
void Connect();
|
|
||||||
/// <summary>
|
|
||||||
/// Disconnect from the device
|
|
||||||
/// </summary>
|
|
||||||
void Disconnect();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defines the contract for IBasicCommunication
|
/// Indicates connection status
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IBasicCommunication : ICommunicationReceiver
|
[JsonProperty("isConnected")]
|
||||||
{
|
bool IsConnected { get; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Send text to the device
|
/// Connect to the device
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="text"></param>
|
void Connect();
|
||||||
|
/// <summary>
|
||||||
|
/// Disconnect from the device
|
||||||
|
/// </summary>
|
||||||
|
void Disconnect();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Extends <see cref="ICommunicationReceiver"/> with methods for sending text and bytes to a device.
|
||||||
|
/// </summary>
|
||||||
|
public interface IBasicCommunication : ICommunicationReceiver
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Send text to the device
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text"></param>
|
||||||
void SendText(string text);
|
void SendText(string text);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Send bytes to the device
|
/// Send bytes to the device
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="bytes"></param>
|
/// <param name="bytes"></param>
|
||||||
void SendBytes(byte[] bytes);
|
void SendBytes(byte[] bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a device that implements IBasicCommunication and IStreamDebugging
|
/// Represents a device that implements IBasicCommunication and IStreamDebugging
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IBasicCommunicationWithStreamDebugging : IBasicCommunication, IStreamDebugging
|
public interface IBasicCommunicationWithStreamDebugging : IBasicCommunication, IStreamDebugging
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a device with stream debugging capablities
|
||||||
|
/// </summary>
|
||||||
|
public interface IStreamDebugging : IKeyed
|
||||||
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a device with stream debugging capablities
|
/// Object to enable stream debugging
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IStreamDebugging : IKeyed
|
[JsonProperty("streamDebugging")]
|
||||||
{
|
CommunicationStreamDebugging StreamDebugging { get; }
|
||||||
/// <summary>
|
}
|
||||||
/// Object to enable stream debugging
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("streamDebugging")]
|
|
||||||
CommunicationStreamDebugging StreamDebugging { get; }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// For IBasicCommunication classes that have SocketStatus. GenericSshClient,
|
||||||
|
/// GenericTcpIpClient
|
||||||
|
/// </summary>
|
||||||
|
public interface ISocketStatus : IBasicCommunication
|
||||||
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// For IBasicCommunication classes that have SocketStatus. GenericSshClient,
|
/// Notifies of socket status changes
|
||||||
/// GenericTcpIpClient
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface ISocketStatus : IBasicCommunication
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Notifies of socket status changes
|
|
||||||
/// </summary>
|
|
||||||
event EventHandler<GenericSocketStatusChageEventArgs> ConnectionChange;
|
event EventHandler<GenericSocketStatusChageEventArgs> ConnectionChange;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The current socket status of the client
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("clientStatus")]
|
|
||||||
[JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
|
|
||||||
SocketStatus ClientStatus { get; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Describes a device that implements ISocketStatus and IStreamDebugging
|
/// The current socket status of the client
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface ISocketStatusWithStreamDebugging : ISocketStatus, IStreamDebugging
|
[JsonProperty("clientStatus")]
|
||||||
{
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
|
SocketStatus ClientStatus { get; }
|
||||||
|
}
|
||||||
|
|
||||||
}
|
/// <summary>
|
||||||
|
/// Describes a device that implements ISocketStatus and IStreamDebugging
|
||||||
|
/// </summary>
|
||||||
|
public interface ISocketStatusWithStreamDebugging : ISocketStatus, IStreamDebugging
|
||||||
|
{
|
||||||
|
|
||||||
/// <summary>
|
}
|
||||||
/// Describes a device that can automatically attempt to reconnect
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
|
/// Describes a device that can automatically attempt to reconnect
|
||||||
|
/// </summary>
|
||||||
public interface IAutoReconnect
|
public interface IAutoReconnect
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Enable automatic recconnect
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("autoReconnect")]
|
|
||||||
bool AutoReconnect { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// Interval in ms to attempt automatic recconnections
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("autoReconnectIntervalMs")]
|
|
||||||
int AutoReconnectIntervalMs { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Enable automatic recconnect
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("autoReconnect")]
|
||||||
|
bool AutoReconnect { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Interval in ms to attempt automatic recconnections
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("autoReconnectIntervalMs")]
|
||||||
|
int AutoReconnectIntervalMs { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public enum eGenericCommMethodStatusChangeType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Connected
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public enum eGenericCommMethodStatusChangeType
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Connected
|
|
||||||
/// </summary>
|
|
||||||
Connected,
|
Connected,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Disconnected
|
/// Disconnected
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Disconnected
|
Disconnected
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This delegate defines handler for IBasicCommunication status changes
|
/// This delegate defines handler for IBasicCommunication status changes
|
||||||
@@ -139,20 +146,20 @@ namespace PepperDash.Core
|
|||||||
/// <param name="status"></param>
|
/// <param name="status"></param>
|
||||||
public delegate void GenericCommMethodStatusHandler(IBasicCommunication comm, eGenericCommMethodStatusChangeType status);
|
public delegate void GenericCommMethodStatusHandler(IBasicCommunication comm, eGenericCommMethodStatusChangeType status);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Event args for bytes received from a communication method
|
||||||
|
/// </summary>
|
||||||
|
public class GenericCommMethodReceiveBytesArgs : EventArgs
|
||||||
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The bytes received
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class GenericCommMethodReceiveBytesArgs : EventArgs
|
public byte[] Bytes { get; private set; }
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the Bytes
|
|
||||||
/// </summary>
|
|
||||||
public byte[] Bytes { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Constructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="bytes"></param>
|
/// <param name="bytes"></param>
|
||||||
public GenericCommMethodReceiveBytesArgs(byte[] bytes)
|
public GenericCommMethodReceiveBytesArgs(byte[] bytes)
|
||||||
{
|
{
|
||||||
Bytes = bytes;
|
Bytes = bytes;
|
||||||
@@ -164,42 +171,81 @@ namespace PepperDash.Core
|
|||||||
public GenericCommMethodReceiveBytesArgs() { }
|
public GenericCommMethodReceiveBytesArgs() { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Event args for text received
|
||||||
|
/// </summary>
|
||||||
|
public class GenericCommMethodReceiveTextArgs : EventArgs
|
||||||
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The text received
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class GenericCommMethodReceiveTextArgs : EventArgs
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public string Text { get; private set; }
|
public string Text { get; private set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The delimiter used to determine the end of a message, if applicable
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Delimiter { get; private set; }
|
public string Delimiter { get; private set; }
|
||||||
/// <summary>
|
|
||||||
///
|
/// <summary>
|
||||||
/// </summary>
|
/// Constructor
|
||||||
/// <param name="text"></param>
|
/// </summary>
|
||||||
|
/// <param name="text"></param>
|
||||||
public GenericCommMethodReceiveTextArgs(string text)
|
public GenericCommMethodReceiveTextArgs(string text)
|
||||||
{
|
{
|
||||||
Text = text;
|
Text = text;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="text"></param>
|
/// <param name="text"></param>
|
||||||
/// <param name="delimiter"></param>
|
/// <param name="delimiter"></param>
|
||||||
public GenericCommMethodReceiveTextArgs(string text, string delimiter)
|
public GenericCommMethodReceiveTextArgs(string text, string delimiter)
|
||||||
: this(text)
|
:this(text)
|
||||||
{
|
{
|
||||||
Delimiter = delimiter;
|
Delimiter = delimiter;
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// S+ Constructor
|
|
||||||
/// </summary>
|
|
||||||
public GenericCommMethodReceiveTextArgs() { }
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
/// <summary>
|
||||||
|
/// S+ Constructor
|
||||||
|
/// </summary>
|
||||||
|
public GenericCommMethodReceiveTextArgs() { }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Helper class to get escaped text for debugging communication streams
|
||||||
|
/// </summary>
|
||||||
|
public class ComTextHelper
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets escaped text for a byte array
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="bytes"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string GetEscapedText(byte[] bytes)
|
||||||
|
{
|
||||||
|
return String.Concat(bytes.Select(b => string.Format(@"[{0:X2}]", (int)b)).ToArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets escaped text for a string
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string GetEscapedText(string text)
|
||||||
|
{
|
||||||
|
var bytes = Encoding.GetEncoding(28591).GetBytes(text);
|
||||||
|
return String.Concat(bytes.Select(b => string.Format(@"[{0:X2}]", (int)b)).ToArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets debug text for a string
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string GetDebugText(string text)
|
||||||
|
{
|
||||||
|
return Regex.Replace(text, @"[^\u0020-\u007E]", a => GetEscapedText(a.Value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,19 +1,21 @@
|
|||||||
using System;
|
extern alias NewtonsoftJson;
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
using Crestron.SimplSharp.CrestronIO;
|
using Crestron.SimplSharp.CrestronIO;
|
||||||
using Newtonsoft.Json;
|
using Formatting = NewtonsoftJson::Newtonsoft.Json.Formatting;
|
||||||
using Newtonsoft.Json.Linq;
|
using JArray = NewtonsoftJson::Newtonsoft.Json.Linq.JArray;
|
||||||
|
using JObject = NewtonsoftJson::Newtonsoft.Json.Linq.JObject;
|
||||||
|
using JToken = NewtonsoftJson::Newtonsoft.Json.Linq.JToken;
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using Serilog.Events;
|
using Serilog.Events;
|
||||||
|
|
||||||
namespace PepperDash.Core.Config
|
namespace PepperDash.Core.Config;
|
||||||
{
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
/// <summary>
|
/// Reads a Portal formatted config file
|
||||||
/// Reads a Portal formatted config file
|
/// </summary>
|
||||||
/// </summary>
|
|
||||||
public class PortalConfigReader
|
public class PortalConfigReader
|
||||||
{
|
{
|
||||||
const string template = "template";
|
const string template = "template";
|
||||||
@@ -56,12 +58,12 @@ namespace PepperDash.Core.Config
|
|||||||
var merged = MergeConfigs(jsonObj);
|
var merged = MergeConfigs(jsonObj);
|
||||||
if (jsonObj[systemUrl] != null)
|
if (jsonObj[systemUrl] != null)
|
||||||
{
|
{
|
||||||
merged[systemUrl] = jsonObj[systemUrl].Value<string>();
|
merged[systemUrl] = (string)jsonObj[systemUrl];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (jsonObj[templateUrl] != null)
|
if (jsonObj[templateUrl] != null)
|
||||||
{
|
{
|
||||||
merged[templateUrl] = jsonObj[templateUrl].Value<string>();
|
merged[templateUrl] = (string)jsonObj[templateUrl];
|
||||||
}
|
}
|
||||||
|
|
||||||
jsonObj = merged;
|
jsonObj = merged;
|
||||||
@@ -122,31 +124,31 @@ namespace PepperDash.Core.Config
|
|||||||
Merge(template[destinationLists], system[destinationLists], destinationLists));
|
Merge(template[destinationLists], system[destinationLists], destinationLists));
|
||||||
|
|
||||||
|
|
||||||
if (system[cameraLists] == null)
|
if (system["cameraLists"] == null)
|
||||||
merged.Add(cameraLists, template[cameraLists]);
|
merged.Add("cameraLists", template["cameraLists"]);
|
||||||
else
|
else
|
||||||
merged.Add(cameraLists, Merge(template[cameraLists], system[cameraLists], cameraLists));
|
merged.Add("cameraLists", Merge(template["cameraLists"], system["cameraLists"], "cameraLists"));
|
||||||
|
|
||||||
if (system[audioControlPointLists] == null)
|
if (system["audioControlPointLists"] == null)
|
||||||
merged.Add(audioControlPointLists, template[audioControlPointLists]);
|
merged.Add("audioControlPointLists", template["audioControlPointLists"]);
|
||||||
else
|
else
|
||||||
merged.Add(audioControlPointLists,
|
merged.Add("audioControlPointLists",
|
||||||
Merge(template[audioControlPointLists], system[audioControlPointLists], audioControlPointLists));
|
Merge(template["audioControlPointLists"], system["audioControlPointLists"], "audioControlPointLists"));
|
||||||
|
|
||||||
|
|
||||||
// Template tie lines take precedence. Config tool doesn't do them at system
|
// Template tie lines take precedence. Config tool doesn't do them at system
|
||||||
// level anyway...
|
// level anyway...
|
||||||
if (template[tieLines] != null)
|
if (template["tieLines"] != null)
|
||||||
merged.Add(tieLines, template[tieLines]);
|
merged.Add("tieLines", template["tieLines"]);
|
||||||
else if (system[tieLines] != null)
|
else if (system["tieLines"] != null)
|
||||||
merged.Add(tieLines, system[tieLines]);
|
merged.Add("tieLines", system["tieLines"]);
|
||||||
else
|
else
|
||||||
merged.Add(tieLines, new JArray());
|
merged.Add(tieLines, new JArray());
|
||||||
|
|
||||||
if (template[joinMaps] != null)
|
if (template["joinMaps"] != null)
|
||||||
merged.Add(joinMaps, template[joinMaps]);
|
merged.Add("joinMaps", template["joinMaps"]);
|
||||||
else
|
else
|
||||||
merged.Add(joinMaps, new JObject());
|
merged.Add("joinMaps", new JObject());
|
||||||
|
|
||||||
if (system[global] != null)
|
if (system[global] != null)
|
||||||
merged.Add(global, Merge(template[global], system[global], global));
|
merged.Add(global, Merge(template[global], system[global], global));
|
||||||
@@ -169,26 +171,26 @@ namespace PepperDash.Core.Config
|
|||||||
return a1;
|
return a1;
|
||||||
else if (a1 != null)
|
else if (a1 != null)
|
||||||
{
|
{
|
||||||
if (a2[0]["key"] == null) // If the first item in the system array has no key, overwrite the template array
|
if (a2[0]["key"] == null) // If the first item in the system array has no key, overwrite the template array
|
||||||
{ // with the system array
|
{ // with the system array
|
||||||
return a2;
|
return a2;
|
||||||
}
|
}
|
||||||
else // The arrays are keyed, merge them by key
|
else // The arrays are keyed, merge them by key
|
||||||
|
{
|
||||||
|
for (int i = 0; i < a1.Count(); i++)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < a1.Count(); i++)
|
var a1Dev = a1[i];
|
||||||
|
// Try to get a system device and if found, merge it onto template
|
||||||
|
var a2Match = a2.FirstOrDefault(t => t[propertyName].Equals(a1Dev[propertyName]));// t.Value<int>("uid") == tmplDev.Value<int>("uid"));
|
||||||
|
if (a2Match != null)
|
||||||
{
|
{
|
||||||
var a1Dev = a1[i];
|
var mergedItem = Merge(a1Dev, a2Match, string.Format("{0}[{1}].", path, i));// Merge(JObject.FromObject(a1Dev), JObject.FromObject(a2Match));
|
||||||
// Try to get a system device and if found, merge it onto template
|
result.Add(mergedItem);
|
||||||
var a2Match = a2.FirstOrDefault(t => t[propertyName].Equals(a1Dev[propertyName]));// t.Value<int>("uid") == tmplDev.Value<int>("uid"));
|
|
||||||
if (a2Match != null)
|
|
||||||
{
|
|
||||||
var mergedItem = Merge(a1Dev, a2Match, string.Format("{0}[{1}].", path, i));// Merge(JObject.FromObject(a1Dev), JObject.FromObject(a2Match));
|
|
||||||
result.Add(mergedItem);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
result.Add(a1Dev);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
result.Add(a1Dev);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -205,9 +207,9 @@ namespace PepperDash.Core.Config
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Merge o2 onto o1
|
/// Merge o2 onto o1
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="o1"></param>
|
/// <param name="o1"></param>
|
||||||
/// <param name="o2"></param>
|
/// <param name="o2"></param>
|
||||||
/// <param name="path"></param>
|
/// <param name="path"></param>
|
||||||
static JObject Merge(JObject o1, JObject o2, string path)
|
static JObject Merge(JObject o1, JObject o2, string path)
|
||||||
{
|
{
|
||||||
foreach (var o2Prop in o2)
|
foreach (var o2Prop in o2)
|
||||||
@@ -253,5 +255,4 @@ namespace PepperDash.Core.Config
|
|||||||
}
|
}
|
||||||
return o1;
|
return o1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -4,28 +4,18 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
|
|
||||||
namespace PepperDash.Core
|
namespace PepperDash.Core;
|
||||||
|
|
||||||
|
public class EncodingHelper
|
||||||
{
|
{
|
||||||
/// <summary>
|
public static string ConvertUtf8ToAscii(string utf8String)
|
||||||
/// Represents a EncodingHelper
|
|
||||||
/// </summary>
|
|
||||||
public class EncodingHelper
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
return Encoding.ASCII.GetString(Encoding.UTF8.GetBytes(utf8String), 0, utf8String.Length);
|
||||||
/// ConvertUtf8ToAscii method
|
|
||||||
/// </summary>
|
|
||||||
public static string ConvertUtf8ToAscii(string utf8String)
|
|
||||||
{
|
|
||||||
return Encoding.ASCII.GetString(Encoding.UTF8.GetBytes(utf8String), 0, utf8String.Length);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// ConvertUtf8ToUtf16 method
|
|
||||||
/// </summary>
|
|
||||||
public static string ConvertUtf8ToUtf16(string utf8String)
|
|
||||||
{
|
|
||||||
return Encoding.Unicode.GetString(Encoding.UTF8.GetBytes(utf8String), 0, utf8String.Length);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string ConvertUtf8ToUtf16(string utf8String)
|
||||||
|
{
|
||||||
|
return Encoding.Unicode.GetString(Encoding.UTF8.GetBytes(utf8String), 0, utf8String.Length);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,35 +1,35 @@
|
|||||||
using System;
|
extern alias NewtonsoftJson;
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
using Newtonsoft.Json;
|
using JsonProperty = NewtonsoftJson::Newtonsoft.Json.JsonPropertyAttribute;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
|
|
||||||
namespace PepperDash.Core
|
namespace PepperDash.Core;
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Unique key interface to require a unique key for the class
|
/// Unique key interface to require a unique key for the class
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IKeyed
|
public interface IKeyed
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Unique Key
|
/// Gets the unique key associated with the object.
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("key")]
|
|
||||||
string Key { get; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Named Keyed device interface. Forces the device to have a Unique Key and a name.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IKeyName : IKeyed
|
[JsonProperty("key")]
|
||||||
{
|
string Key { get; }
|
||||||
/// <summary>
|
}
|
||||||
/// Isn't it obvious :)
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("name")]
|
|
||||||
string Name { get; }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Named Keyed device interface. Forces the device to have a Unique Key and a name.
|
||||||
|
/// </summary>
|
||||||
|
public interface IKeyName : IKeyed
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the name associated with the current object.
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("name")]
|
||||||
|
string Name { get; }
|
||||||
}
|
}
|
||||||
@@ -2,198 +2,194 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Serilog.Events;
|
using Serilog.Events;
|
||||||
|
|
||||||
namespace PepperDash.Core
|
namespace PepperDash.Core;
|
||||||
|
|
||||||
|
//*********************************************************************************************************
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a Device
|
||||||
|
/// </summary>
|
||||||
|
public class Device : IKeyName
|
||||||
{
|
{
|
||||||
//*********************************************************************************************************
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a Device
|
/// Unique Key
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class Device : IKeyName
|
public string Key { get; protected set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Name
|
||||||
|
/// </summary>
|
||||||
|
public string Name { get; protected set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public bool Enabled { get; protected set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A place to store reference to the original config object, if any. These values should
|
||||||
|
/// NOT be used as properties on the device as they are all publicly-settable values.
|
||||||
|
/// </summary>
|
||||||
|
//public DeviceConfig Config { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Helper method to check if Config exists
|
||||||
|
/// </summary>
|
||||||
|
//public bool HasConfig { get { return Config != null; } }
|
||||||
|
|
||||||
|
List<Action> _PreActivationActions;
|
||||||
|
List<Action> _PostActivationActions;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public static Device DefaultDevice { get { return _DefaultDevice; } }
|
||||||
|
static Device _DefaultDevice = new Device("Default", "Default");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Base constructor for all Devices.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
public Device(string key)
|
||||||
{
|
{
|
||||||
|
Key = key;
|
||||||
|
if (key.Contains(".")) Debug.LogMessage(LogEventLevel.Information, "WARNING: Device key should not include '.'", this);
|
||||||
|
Name = "";
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Unique Key
|
/// Constructor with key and name
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Key { get; protected set; }
|
/// <param name="key"></param>
|
||||||
/// <summary>
|
/// <param name="name"></param>
|
||||||
/// Gets or sets the Name
|
public Device(string key, string name) : this(key)
|
||||||
/// </summary>
|
{
|
||||||
public string Name { get; protected set; }
|
Name = name;
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public bool Enabled { get; protected set; }
|
|
||||||
|
|
||||||
/// <summary>
|
}
|
||||||
/// A place to store reference to the original config object, if any. These values should
|
|
||||||
/// NOT be used as properties on the device as they are all publicly-settable values.
|
|
||||||
/// </summary>
|
|
||||||
//public DeviceConfig Config { get; private set; }
|
|
||||||
/// <summary>
|
|
||||||
/// Helper method to check if Config exists
|
|
||||||
/// </summary>
|
|
||||||
//public bool HasConfig { get { return Config != null; } }
|
|
||||||
|
|
||||||
List<Action> _PreActivationActions;
|
//public Device(DeviceConfig config)
|
||||||
List<Action> _PostActivationActions;
|
// : this(config.Key, config.Name)
|
||||||
|
//{
|
||||||
|
// Config = config;
|
||||||
|
//}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Adds a pre activation action
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static Device DefaultDevice { get { return _DefaultDevice; } }
|
/// <param name="act"></param>
|
||||||
static Device _DefaultDevice = new Device("Default", "Default");
|
public void AddPreActivationAction(Action act)
|
||||||
|
{
|
||||||
|
if (_PreActivationActions == null)
|
||||||
|
_PreActivationActions = new List<Action>();
|
||||||
|
_PreActivationActions.Add(act);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Base constructor for all Devices.
|
/// Adds a post activation action
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="key"></param>
|
/// <param name="act"></param>
|
||||||
public Device(string key)
|
/// <summary>
|
||||||
{
|
/// AddPostActivationAction method
|
||||||
Key = key;
|
/// </summary>
|
||||||
if (key.Contains(".")) Debug.LogMessage(LogEventLevel.Information, "WARNING: Device key should not include '.'", this);
|
public void AddPostActivationAction(Action act)
|
||||||
Name = "";
|
{
|
||||||
}
|
if (_PostActivationActions == null)
|
||||||
|
_PostActivationActions = new List<Action>();
|
||||||
|
_PostActivationActions.Add(act);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructor with key and name
|
/// PreActivate method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="key"></param>
|
public void PreActivate()
|
||||||
/// <param name="name"></param>
|
{
|
||||||
public Device(string key, string name) : this(key)
|
if (_PreActivationActions != null)
|
||||||
{
|
_PreActivationActions.ForEach(a =>
|
||||||
Name = name;
|
{
|
||||||
|
try
|
||||||
}
|
|
||||||
|
|
||||||
//public Device(DeviceConfig config)
|
|
||||||
// : this(config.Key, config.Name)
|
|
||||||
//{
|
|
||||||
// Config = config;
|
|
||||||
//}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Adds a pre activation action
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="act"></param>
|
|
||||||
public void AddPreActivationAction(Action act)
|
|
||||||
{
|
|
||||||
if (_PreActivationActions == null)
|
|
||||||
_PreActivationActions = new List<Action>();
|
|
||||||
_PreActivationActions.Add(act);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Adds a post activation action
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="act"></param>
|
|
||||||
/// <summary>
|
|
||||||
/// AddPostActivationAction method
|
|
||||||
/// </summary>
|
|
||||||
public void AddPostActivationAction(Action act)
|
|
||||||
{
|
|
||||||
if (_PostActivationActions == null)
|
|
||||||
_PostActivationActions = new List<Action>();
|
|
||||||
_PostActivationActions.Add(act);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// PreActivate method
|
|
||||||
/// </summary>
|
|
||||||
public void PreActivate()
|
|
||||||
{
|
|
||||||
if (_PreActivationActions != null)
|
|
||||||
_PreActivationActions.ForEach(a =>
|
|
||||||
{
|
{
|
||||||
try
|
a.Invoke();
|
||||||
{
|
}
|
||||||
a.Invoke();
|
catch (Exception e)
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Debug.LogMessage(e, "Error in PreActivationAction: " + e.Message, this);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Activate method
|
|
||||||
/// </summary>
|
|
||||||
public bool Activate()
|
|
||||||
{
|
|
||||||
//if (_PreActivationActions != null)
|
|
||||||
// _PreActivationActions.ForEach(a => a.Invoke());
|
|
||||||
var result = CustomActivate();
|
|
||||||
//if(result && _PostActivationActions != null)
|
|
||||||
// _PostActivationActions.ForEach(a => a.Invoke());
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// PostActivate method
|
|
||||||
/// </summary>
|
|
||||||
public void PostActivate()
|
|
||||||
{
|
|
||||||
if (_PostActivationActions != null)
|
|
||||||
_PostActivationActions.ForEach(a =>
|
|
||||||
{
|
{
|
||||||
try
|
Debug.LogMessage(e, "Error in PreActivationAction: " + e.Message, this);
|
||||||
{
|
}
|
||||||
a.Invoke();
|
});
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Debug.LogMessage(e, "Error in PostActivationAction: " + e.Message, this);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called in between Pre and PostActivationActions when Activate() is called.
|
/// Activate method
|
||||||
/// Override to provide addtitional setup when calling activation. Overriding classes
|
/// </summary>
|
||||||
/// do not need to call base.CustomActivate()
|
public bool Activate()
|
||||||
/// </summary>
|
{
|
||||||
/// <returns>true if device activated successfully.</returns>
|
//if (_PreActivationActions != null)
|
||||||
/// <summary>
|
// _PreActivationActions.ForEach(a => a.Invoke());
|
||||||
/// CustomActivate method
|
var result = CustomActivate();
|
||||||
/// </summary>
|
//if(result && _PostActivationActions != null)
|
||||||
public virtual bool CustomActivate() { return true; }
|
// _PostActivationActions.ForEach(a => a.Invoke());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Call to deactivate device - unlink events, etc. Overriding classes do not
|
/// PostActivate method
|
||||||
/// need to call base.Deactivate()
|
/// </summary>
|
||||||
/// </summary>
|
public void PostActivate()
|
||||||
/// <returns></returns>
|
{
|
||||||
public virtual bool Deactivate() { return true; }
|
if (_PostActivationActions != null)
|
||||||
|
_PostActivationActions.ForEach(a =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
a.Invoke();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.LogMessage(e, "Error in PostActivationAction: " + e.Message, this);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Call this method to start communications with a device. Overriding classes do not need to call base.Initialize()
|
/// Called in between Pre and PostActivationActions when Activate() is called.
|
||||||
/// </summary>
|
/// Override to provide addtitional setup when calling activation. Overriding classes
|
||||||
public virtual void Initialize()
|
/// do not need to call base.CustomActivate()
|
||||||
{
|
/// </summary>
|
||||||
}
|
/// <returns>true if device activated successfully.</returns>
|
||||||
|
/// <summary>
|
||||||
|
/// CustomActivate method
|
||||||
|
/// </summary>
|
||||||
|
public virtual bool CustomActivate() { return true; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Helper method to check object for bool value false and fire an Action method
|
/// Call to deactivate device - unlink events, etc. Overriding classes do not
|
||||||
/// </summary>
|
/// need to call base.Deactivate()
|
||||||
/// <param name="o">Should be of type bool, others will be ignored</param>
|
/// </summary>
|
||||||
/// <param name="a">Action to be run when o is false</param>
|
/// <returns></returns>
|
||||||
public void OnFalse(object o, Action a)
|
public virtual bool Deactivate() { return true; }
|
||||||
{
|
|
||||||
if (o is bool && !(bool)o) a();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a string representation of the object, including its key and name.
|
/// Call this method to start communications with a device. Overriding classes do not need to call base.Initialize()
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>The returned string is formatted as "{Key} - {Name}". If the <c>Name</c> property is
|
public virtual void Initialize()
|
||||||
/// null or empty, "---" is used in place of the name.</remarks>
|
{
|
||||||
/// <returns>A string that represents the object, containing the key and name in the format "{Key} - {Name}".</returns>
|
}
|
||||||
/// <summary>
|
|
||||||
/// ToString method
|
/// <summary>
|
||||||
/// </summary>
|
/// Helper method to check object for bool value false and fire an Action method
|
||||||
public override string ToString()
|
/// </summary>
|
||||||
{
|
/// <param name="o">Should be of type bool, others will be ignored</param>
|
||||||
return string.Format("{0} - {1}", Key, string.IsNullOrEmpty(Name) ? "---" : Name);
|
/// <param name="a">Action to be run when o is false</param>
|
||||||
}
|
public void OnFalse(object o, Action a)
|
||||||
|
{
|
||||||
|
if (o is bool && !(bool)o) a();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a string representation of the object, including its key and name.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>The returned string is formatted as "{Key} - {Name}". If the <c>Name</c> property is
|
||||||
|
/// null or empty, "---" is used in place of the name.</remarks>
|
||||||
|
/// <returns>A string that represents the object, containing the key and name in the format "{Key} - {Name}".</returns>
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return string.Format("{0} - {1}", Key, string.IsNullOrEmpty(Name) ? "---" : Name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,12 +1,14 @@
|
|||||||
using Crestron.SimplSharp;
|
extern alias NewtonsoftJson;
|
||||||
using Newtonsoft.Json;
|
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using JsonProperty = NewtonsoftJson::Newtonsoft.Json.JsonPropertyAttribute;
|
||||||
using Serilog.Events;
|
using Serilog.Events;
|
||||||
|
|
||||||
namespace PepperDash.Core
|
namespace PepperDash.Core;
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a EthernetHelper
|
/// Represents an EthernetHelper.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class EthernetHelper
|
public class EthernetHelper
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -113,5 +115,4 @@ namespace PepperDash.Core
|
|||||||
CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_ROUTER, 0);
|
CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_ROUTER, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -4,8 +4,8 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
|
|
||||||
namespace PepperDash.Core
|
namespace PepperDash.Core;
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Bool change event args
|
/// Bool change event args
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -168,5 +168,4 @@ namespace PepperDash.Core
|
|||||||
Type = type;
|
Type = type;
|
||||||
Index = index;
|
Index = index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using Crestron.SimplSharp;
|
|
||||||
|
|
||||||
namespace PepperDash.Core.GenericRESTfulCommunications
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Constants
|
|
||||||
/// </summary>
|
|
||||||
public class GenericRESTfulConstants
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Generic boolean change
|
|
||||||
/// </summary>
|
|
||||||
public const ushort BoolValueChange = 1;
|
|
||||||
/// <summary>
|
|
||||||
/// Generic Ushort change
|
|
||||||
/// </summary>
|
|
||||||
public const ushort UshrtValueChange = 101;
|
|
||||||
/// <summary>
|
|
||||||
/// Response Code Ushort change
|
|
||||||
/// </summary>
|
|
||||||
public const ushort ResponseCodeChange = 102;
|
|
||||||
/// <summary>
|
|
||||||
/// Generic String chagne
|
|
||||||
/// </summary>
|
|
||||||
public const ushort StringValueChange = 201;
|
|
||||||
/// <summary>
|
|
||||||
/// Response string change
|
|
||||||
/// </summary>
|
|
||||||
public const ushort ResponseStringChange = 202;
|
|
||||||
/// <summary>
|
|
||||||
/// Error string change
|
|
||||||
/// </summary>
|
|
||||||
public const ushort ErrorStringChange = 203;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,256 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using Crestron.SimplSharp;
|
|
||||||
using Crestron.SimplSharp.Net.Http;
|
|
||||||
using Crestron.SimplSharp.Net.Https;
|
|
||||||
|
|
||||||
namespace PepperDash.Core.GenericRESTfulCommunications
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Generic RESTful communication class
|
|
||||||
/// </summary>
|
|
||||||
public class GenericRESTfulClient
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Boolean event handler
|
|
||||||
/// </summary>
|
|
||||||
public event EventHandler<BoolChangeEventArgs> BoolChange;
|
|
||||||
/// <summary>
|
|
||||||
/// Ushort event handler
|
|
||||||
/// </summary>
|
|
||||||
public event EventHandler<UshrtChangeEventArgs> UshrtChange;
|
|
||||||
/// <summary>
|
|
||||||
/// String event handler
|
|
||||||
/// </summary>
|
|
||||||
public event EventHandler<StringChangeEventArgs> StringChange;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Constructor
|
|
||||||
/// </summary>
|
|
||||||
public GenericRESTfulClient()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Generic RESTful submit request
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="url"></param>
|
|
||||||
/// <param name="port"></param>
|
|
||||||
/// <param name="requestType"></param>
|
|
||||||
/// <param name="username"></param>
|
|
||||||
/// <param name="password"></param>
|
|
||||||
/// <param name="contentType"></param>
|
|
||||||
public void SubmitRequest(string url, ushort port, ushort requestType, string contentType, string username, string password)
|
|
||||||
{
|
|
||||||
if (url.StartsWith("https:", StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
SubmitRequestHttps(url, port, requestType, contentType, username, password);
|
|
||||||
}
|
|
||||||
else if (url.StartsWith("http:", StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
SubmitRequestHttp(url, port, requestType, contentType, username, password);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
OnStringChange(string.Format("Invalid URL {0}", url), 0, GenericRESTfulConstants.ErrorStringChange);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Private HTTP submit request
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="url"></param>
|
|
||||||
/// <param name="port"></param>
|
|
||||||
/// <param name="requestType"></param>
|
|
||||||
/// <param name="contentType"></param>
|
|
||||||
/// <param name="username"></param>
|
|
||||||
/// <param name="password"></param>
|
|
||||||
private void SubmitRequestHttp(string url, ushort port, ushort requestType, string contentType, string username, string password)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
HttpClient client = new HttpClient();
|
|
||||||
HttpClientRequest request = new HttpClientRequest();
|
|
||||||
HttpClientResponse response;
|
|
||||||
|
|
||||||
client.KeepAlive = false;
|
|
||||||
|
|
||||||
if(port >= 1 || port <= 65535)
|
|
||||||
client.Port = port;
|
|
||||||
else
|
|
||||||
client.Port = 80;
|
|
||||||
|
|
||||||
var authorization = "";
|
|
||||||
if (!string.IsNullOrEmpty(username))
|
|
||||||
authorization = EncodeBase64(username, password);
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(authorization))
|
|
||||||
request.Header.SetHeaderValue("Authorization", authorization);
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(contentType))
|
|
||||||
request.Header.ContentType = contentType;
|
|
||||||
|
|
||||||
request.Url.Parse(url);
|
|
||||||
request.RequestType = (Crestron.SimplSharp.Net.Http.RequestType)requestType;
|
|
||||||
|
|
||||||
response = client.Dispatch(request);
|
|
||||||
|
|
||||||
CrestronConsole.PrintLine(string.Format("SubmitRequestHttp Response[{0}]: {1}", response.Code, response.ContentString.ToString()));
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(response.ContentString.ToString()))
|
|
||||||
OnStringChange(response.ContentString.ToString(), 0, GenericRESTfulConstants.ResponseStringChange);
|
|
||||||
|
|
||||||
if (response.Code > 0)
|
|
||||||
OnUshrtChange((ushort)response.Code, 0, GenericRESTfulConstants.ResponseCodeChange);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
//var msg = string.Format("SubmitRequestHttp({0}, {1}, {2}) failed:{3}", url, port, requestType, e.Message);
|
|
||||||
//CrestronConsole.PrintLine(msg);
|
|
||||||
//ErrorLog.Error(msg);
|
|
||||||
|
|
||||||
CrestronConsole.PrintLine(e.Message);
|
|
||||||
OnStringChange(e.Message, 0, GenericRESTfulConstants.ErrorStringChange);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Private HTTPS submit request
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="url"></param>
|
|
||||||
/// <param name="port"></param>
|
|
||||||
/// <param name="requestType"></param>
|
|
||||||
/// <param name="contentType"></param>
|
|
||||||
/// <param name="username"></param>
|
|
||||||
/// <param name="password"></param>
|
|
||||||
private void SubmitRequestHttps(string url, ushort port, ushort requestType, string contentType, string username, string password)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
HttpsClient client = new HttpsClient();
|
|
||||||
HttpsClientRequest request = new HttpsClientRequest();
|
|
||||||
HttpsClientResponse response;
|
|
||||||
|
|
||||||
client.KeepAlive = false;
|
|
||||||
client.HostVerification = false;
|
|
||||||
client.PeerVerification = false;
|
|
||||||
|
|
||||||
var authorization = "";
|
|
||||||
if (!string.IsNullOrEmpty(username))
|
|
||||||
authorization = EncodeBase64(username, password);
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(authorization))
|
|
||||||
request.Header.SetHeaderValue("Authorization", authorization);
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(contentType))
|
|
||||||
request.Header.ContentType = contentType;
|
|
||||||
|
|
||||||
request.Url.Parse(url);
|
|
||||||
request.RequestType = (Crestron.SimplSharp.Net.Https.RequestType)requestType;
|
|
||||||
|
|
||||||
response = client.Dispatch(request);
|
|
||||||
|
|
||||||
CrestronConsole.PrintLine(string.Format("SubmitRequestHttp Response[{0}]: {1}", response.Code, response.ContentString.ToString()));
|
|
||||||
|
|
||||||
if(!string.IsNullOrEmpty(response.ContentString.ToString()))
|
|
||||||
OnStringChange(response.ContentString.ToString(), 0, GenericRESTfulConstants.ResponseStringChange);
|
|
||||||
|
|
||||||
if(response.Code > 0)
|
|
||||||
OnUshrtChange((ushort)response.Code, 0, GenericRESTfulConstants.ResponseCodeChange);
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
//var msg = string.Format("SubmitRequestHttps({0}, {1}, {2}, {3}, {4}) failed:{5}", url, port, requestType, username, password, e.Message);
|
|
||||||
//CrestronConsole.PrintLine(msg);
|
|
||||||
//ErrorLog.Error(msg);
|
|
||||||
|
|
||||||
CrestronConsole.PrintLine(e.Message);
|
|
||||||
OnStringChange(e.Message, 0, GenericRESTfulConstants.ErrorStringChange);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Private method to encode username and password to Base64 string
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="username"></param>
|
|
||||||
/// <param name="password"></param>
|
|
||||||
/// <returns>authorization</returns>
|
|
||||||
private string EncodeBase64(string username, string password)
|
|
||||||
{
|
|
||||||
var authorization = "";
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (!string.IsNullOrEmpty(username))
|
|
||||||
{
|
|
||||||
string base64String = System.Convert.ToBase64String(System.Text.Encoding.GetEncoding("ISO-8859-1").GetBytes(string.Format("{0}:{1}", username, password)));
|
|
||||||
authorization = string.Format("Basic {0}", base64String);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
var msg = string.Format("EncodeBase64({0}, {1}) failed:\r{2}", username, password, e);
|
|
||||||
CrestronConsole.PrintLine(msg);
|
|
||||||
ErrorLog.Error(msg);
|
|
||||||
return "" ;
|
|
||||||
}
|
|
||||||
|
|
||||||
return authorization;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Protected method to handle boolean change events
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="state"></param>
|
|
||||||
/// <param name="index"></param>
|
|
||||||
/// <param name="type"></param>
|
|
||||||
protected void OnBoolChange(bool state, ushort index, ushort type)
|
|
||||||
{
|
|
||||||
var handler = BoolChange;
|
|
||||||
if (handler != null)
|
|
||||||
{
|
|
||||||
var args = new BoolChangeEventArgs(state, type);
|
|
||||||
args.Index = index;
|
|
||||||
BoolChange(this, args);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Protected mehtod to handle ushort change events
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="value"></param>
|
|
||||||
/// <param name="index"></param>
|
|
||||||
/// <param name="type"></param>
|
|
||||||
protected void OnUshrtChange(ushort value, ushort index, ushort type)
|
|
||||||
{
|
|
||||||
var handler = UshrtChange;
|
|
||||||
if (handler != null)
|
|
||||||
{
|
|
||||||
var args = new UshrtChangeEventArgs(value, type);
|
|
||||||
args.Index = index;
|
|
||||||
UshrtChange(this, args);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Protected method to handle string change events
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="value"></param>
|
|
||||||
/// <param name="index"></param>
|
|
||||||
/// <param name="type"></param>
|
|
||||||
protected void OnStringChange(string value, ushort index, ushort type)
|
|
||||||
{
|
|
||||||
var handler = StringChange;
|
|
||||||
if (handler != null)
|
|
||||||
{
|
|
||||||
var args = new StringChangeEventArgs(value, type);
|
|
||||||
args.Index = index;
|
|
||||||
StringChange(this, args);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -4,8 +4,8 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
|
|
||||||
namespace PepperDash.Core.JsonStandardObjects
|
namespace PepperDash.Core.JsonStandardObjects;
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constants for simpl modules
|
/// Constants for simpl modules
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -73,5 +73,4 @@ namespace PepperDash.Core.JsonStandardObjects
|
|||||||
Type = type;
|
Type = type;
|
||||||
Index = index;
|
Index = index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -4,8 +4,8 @@ using Crestron.SimplSharp;
|
|||||||
using PepperDash.Core.JsonToSimpl;
|
using PepperDash.Core.JsonToSimpl;
|
||||||
using Serilog.Events;
|
using Serilog.Events;
|
||||||
|
|
||||||
namespace PepperDash.Core.JsonStandardObjects
|
namespace PepperDash.Core.JsonStandardObjects;
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Device class
|
/// Device class
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -182,5 +182,4 @@ namespace PepperDash.Core.JsonStandardObjects
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion EventHandler Helpers
|
#endregion EventHandler Helpers
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -4,8 +4,8 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
|
|
||||||
namespace PepperDash.Core.JsonStandardObjects
|
namespace PepperDash.Core.JsonStandardObjects;
|
||||||
{
|
|
||||||
/*
|
/*
|
||||||
Convert JSON snippt to C#: http://json2csharp.com/#
|
Convert JSON snippt to C#: http://json2csharp.com/#
|
||||||
|
|
||||||
@@ -52,55 +52,55 @@ namespace PepperDash.Core.JsonStandardObjects
|
|||||||
/// </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>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int dataBits { get; set; }
|
public int dataBits { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int stopBits { get; set; }
|
public int stopBits { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string parity { get; set; }
|
public string parity { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string protocol { get; set; }
|
public string protocol { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string hardwareHandshake { get; set; }
|
public string hardwareHandshake { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string softwareHandshake { get; set; }
|
public string softwareHandshake { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
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>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ushort simplStopBits { get { return Convert.ToUInt16(stopBits); } }
|
public ushort simplStopBits { get { return Convert.ToUInt16(stopBits); } }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ushort simplPacing { get { return Convert.ToUInt16(pacing); } }
|
public ushort simplPacing { get { return Convert.ToUInt16(pacing); } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -117,43 +117,43 @@ namespace PepperDash.Core.JsonStandardObjects
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class TcpSshPropertiesConfig
|
public class TcpSshPropertiesConfig
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string address { get; set; }
|
public string address { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int port { get; set; }
|
public int port { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string username { get; set; }
|
public string username { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string password { get; set; }
|
public string password { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool autoReconnect { get; set; }
|
public bool autoReconnect { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
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>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ushort simplAutoReconnectIntervalMs { get { return Convert.ToUInt16(autoReconnectIntervalMs); } }
|
public ushort simplAutoReconnectIntervalMs { get { return Convert.ToUInt16(autoReconnectIntervalMs); } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -170,31 +170,31 @@ namespace PepperDash.Core.JsonStandardObjects
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class ControlConfig
|
public class ControlConfig
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string method { get; set; }
|
public string method { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string controlPortDevKey { get; set; }
|
public string controlPortDevKey { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int controlPortNumber { get; set; }
|
public int controlPortNumber { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ComParamsConfig comParams { get; set; }
|
public ComParamsConfig comParams { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
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>
|
||||||
@@ -212,27 +212,27 @@ namespace PepperDash.Core.JsonStandardObjects
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class PropertiesConfig
|
public class PropertiesConfig
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int deviceId { get; set; }
|
public int deviceId { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool enabled { get; set; }
|
public bool enabled { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
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>
|
||||||
@@ -249,9 +249,8 @@ namespace PepperDash.Core.JsonStandardObjects
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class RootObject
|
public class RootObject
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The collection of devices
|
/// The collection of devices
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<DeviceConfig> devices { get; set; }
|
public List<DeviceConfig> devices { get; set; }
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -4,78 +4,78 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
|
|
||||||
namespace PepperDash.Core.JsonToSimpl
|
namespace PepperDash.Core.JsonToSimpl;
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constants for Simpl modules
|
/// Constants for Simpl modules
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class JsonToSimplConstants
|
public class JsonToSimplConstants
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const ushort BoolValueChange = 1;
|
public const ushort BoolValueChange = 1;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const ushort JsonIsValidBoolChange = 2;
|
public const ushort JsonIsValidBoolChange = 2;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reports the if the device is 3-series compatible
|
/// Reports the if the device is 3-series compatible
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const ushort ProgramCompatibility3SeriesChange = 3;
|
public const ushort ProgramCompatibility3SeriesChange = 3;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reports the if the device is 4-series compatible
|
/// Reports the if the device is 4-series compatible
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const ushort ProgramCompatibility4SeriesChange = 4;
|
public const ushort ProgramCompatibility4SeriesChange = 4;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reports the device platform enum value
|
/// Reports the device platform enum value
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const ushort DevicePlatformValueChange = 5;
|
public const ushort DevicePlatformValueChange = 5;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const ushort UshortValueChange = 101;
|
public const ushort UshortValueChange = 101;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const ushort StringValueChange = 201;
|
public const ushort StringValueChange = 201;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const ushort FullPathToArrayChange = 202;
|
public const ushort FullPathToArrayChange = 202;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const ushort ActualFilePathChange = 203;
|
public const ushort ActualFilePathChange = 203;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const ushort FilenameResolvedChange = 204;
|
public const ushort FilenameResolvedChange = 204;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const ushort FilePathResolvedChange = 205;
|
public const ushort FilePathResolvedChange = 205;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reports the root directory change
|
/// Reports the root directory change
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const ushort RootDirectoryChange = 206;
|
public const ushort RootDirectoryChange = 206;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reports the room ID change
|
/// Reports the room ID change
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const ushort RoomIdChange = 207;
|
public const ushort RoomIdChange = 207;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reports the room name change
|
/// Reports the room name change
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const ushort RoomNameChange = 208;
|
public const ushort RoomNameChange = 208;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -88,33 +88,33 @@ 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>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ushort Index { get; private set; }
|
public ushort Index { get; private set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ushort BoolUShortValue { get; set; }
|
public ushort BoolUShortValue { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string StringValue { get; set; }
|
public string StringValue { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public SPlusValueWrapper() {}
|
public SPlusValueWrapper() {}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="type"></param>
|
/// <param name="type"></param>
|
||||||
/// <param name="index"></param>
|
/// <param name="index"></param>
|
||||||
public SPlusValueWrapper(SPlusType type, ushort index)
|
public SPlusValueWrapper(SPlusType type, ushort index)
|
||||||
{
|
{
|
||||||
ValueType = type;
|
ValueType = type;
|
||||||
@@ -127,17 +127,16 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public enum SPlusType
|
public enum SPlusType
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Digital
|
/// Digital
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Digital,
|
Digital,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Analog
|
/// Analog
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Analog,
|
Analog,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// String
|
/// String
|
||||||
/// </summary>
|
/// </summary>
|
||||||
String
|
String
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -7,11 +7,11 @@ using Serilog.Events;
|
|||||||
|
|
||||||
//using PepperDash.Core;
|
//using PepperDash.Core;
|
||||||
|
|
||||||
namespace PepperDash.Core.JsonToSimpl
|
namespace PepperDash.Core.JsonToSimpl;
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The global class to manage all the instances of JsonToSimplMaster
|
/// The global class to manage all the instances of JsonToSimplMaster
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class J2SGlobal
|
public class J2SGlobal
|
||||||
{
|
{
|
||||||
static List<JsonToSimplMaster> Masters = new List<JsonToSimplMaster>();
|
static List<JsonToSimplMaster> Masters = new List<JsonToSimplMaster>();
|
||||||
@@ -22,10 +22,7 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
/// master, this will fail
|
/// master, this will fail
|
||||||
/// </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)
|
||||||
@@ -59,5 +56,4 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
{
|
{
|
||||||
return Masters.FirstOrDefault(m => m.UniqueID.Equals(file, StringComparison.OrdinalIgnoreCase));
|
return Masters.FirstOrDefault(m => m.UniqueID.Equals(file, StringComparison.OrdinalIgnoreCase));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -1,22 +1,24 @@
|
|||||||
using System;
|
extern alias NewtonsoftJson;
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Newtonsoft.Json.Linq;
|
using JArray = NewtonsoftJson::Newtonsoft.Json.Linq.JArray;
|
||||||
using Serilog.Events;
|
using Serilog.Events;
|
||||||
|
|
||||||
namespace PepperDash.Core.JsonToSimpl
|
namespace PepperDash.Core.JsonToSimpl;
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a JsonToSimplArrayLookupChild
|
/// Used to interact with an array of values with the S+ modules
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class JsonToSimplArrayLookupChild : JsonToSimplChildObjectBase
|
public class JsonToSimplArrayLookupChild : JsonToSimplChildObjectBase
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string SearchPropertyName { get; set; }
|
public string SearchPropertyName { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string SearchPropertyValue { get; set; }
|
public string SearchPropertyValue { get; set; }
|
||||||
|
|
||||||
int ArrayIndex;
|
int ArrayIndex;
|
||||||
@@ -76,10 +78,9 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
PathSuffix == null ? "" : PathSuffix);
|
PathSuffix == null ? "" : PathSuffix);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ProcessAll method
|
/// Process all values
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <inheritdoc />
|
|
||||||
public override void ProcessAll()
|
public override void ProcessAll()
|
||||||
{
|
{
|
||||||
if (FindInArray())
|
if (FindInArray())
|
||||||
@@ -129,7 +130,7 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
var item = array.FirstOrDefault(o =>
|
var item = array.FirstOrDefault(o =>
|
||||||
{
|
{
|
||||||
var prop = o[SearchPropertyName];
|
var prop = o[SearchPropertyName];
|
||||||
return prop != null && prop.Value<string>()
|
return prop != null && ((string)prop)
|
||||||
.Equals(SearchPropertyValue, StringComparison.OrdinalIgnoreCase);
|
.Equals(SearchPropertyValue, StringComparison.OrdinalIgnoreCase);
|
||||||
});
|
});
|
||||||
if (item == null)
|
if (item == null)
|
||||||
@@ -159,5 +160,4 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -1,31 +1,33 @@
|
|||||||
using System;
|
extern alias NewtonsoftJson;
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Newtonsoft.Json.Linq;
|
using JValue = NewtonsoftJson::Newtonsoft.Json.Linq.JValue;
|
||||||
|
|
||||||
namespace PepperDash.Core.JsonToSimpl
|
namespace PepperDash.Core.JsonToSimpl;
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Base class for JSON objects
|
/// Base class for JSON objects
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class JsonToSimplChildObjectBase : IKeyed
|
public abstract class JsonToSimplChildObjectBase : IKeyed
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Notifies of bool change
|
/// Notifies of bool change
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event EventHandler<BoolChangeEventArgs> BoolChange;
|
public event EventHandler<BoolChangeEventArgs> BoolChange;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Notifies of ushort change
|
/// Notifies of ushort change
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event EventHandler<UshrtChangeEventArgs> UShortChange;
|
public event EventHandler<UshrtChangeEventArgs> UShortChange;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Notifies of string change
|
/// Notifies of string change
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event EventHandler<StringChangeEventArgs> StringChange;
|
public event EventHandler<StringChangeEventArgs> StringChange;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Delegate to get all values
|
/// Delegate to get all values
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public SPlusValuesDelegate GetAllValuesDelegate { get; set; }
|
public SPlusValuesDelegate GetAllValuesDelegate { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -33,9 +35,9 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public SPlusValuesDelegate SetAllPathsDelegate { get; set; }
|
public SPlusValuesDelegate SetAllPathsDelegate { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Key
|
/// Unique identifier for instance
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Key { get; protected set; }
|
public string Key { get; protected set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -49,33 +51,33 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string PathSuffix { get; protected set; }
|
public string PathSuffix { get; protected set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the LinkedToObject
|
/// Indicates if the instance is linked to an object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool LinkedToObject { get; protected set; }
|
public bool LinkedToObject { get; protected set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reference to Master instance
|
/// Reference to Master instance
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected JsonToSimplMaster Master;
|
protected JsonToSimplMaster Master;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Paths to boolean values in JSON structure
|
/// Paths to boolean values in JSON structure
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected Dictionary<ushort, string> BoolPaths = new Dictionary<ushort, string>();
|
protected Dictionary<ushort, string> BoolPaths = new Dictionary<ushort, string>();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Paths to numeric values in JSON structure
|
/// Paths to numeric values in JSON structure
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected Dictionary<ushort, string> UshortPaths = new Dictionary<ushort, string>();
|
protected Dictionary<ushort, string> UshortPaths = new Dictionary<ushort, string>();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Paths to string values in JSON structure
|
/// Paths to string values in JSON structure
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected Dictionary<ushort, string> StringPaths = new Dictionary<ushort, string>();
|
protected Dictionary<ushort, string> StringPaths = new Dictionary<ushort, string>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Call this before doing anything else
|
/// Call this before doing anything else
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="masterUniqueId"></param>
|
/// <param name="masterUniqueId"></param>
|
||||||
/// <param name="key"></param>
|
/// <param name="key"></param>
|
||||||
/// <param name="pathPrefix"></param>
|
/// <param name="pathPrefix"></param>
|
||||||
/// <param name="pathSuffix"></param>
|
/// <param name="pathSuffix"></param>
|
||||||
@@ -92,13 +94,10 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
Debug.Console(1, "JSON Child [{0}] cannot link to master {1}", key, masterUniqueId);
|
Debug.Console(1, "JSON Child [{0}] cannot link to master {1}", key, masterUniqueId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 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;
|
||||||
@@ -173,18 +172,18 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Processes the path to a ushort, converting to ushort if able, twos complement if necessary, firing off UshrtChange event
|
// Processes the path to a ushort, converting to ushort if able, twos complement if necessary, firing off UshrtChange event
|
||||||
void ProcessUshortPath(ushort index) {
|
void ProcessUshortPath(ushort index) {
|
||||||
string response;
|
string response;
|
||||||
if (Process(UshortPaths[index], out response)) {
|
if (Process(UshortPaths[index], out response)) {
|
||||||
ushort val;
|
ushort val;
|
||||||
try { val = Convert.ToInt32(response) < 0 ? (ushort)(Convert.ToInt16(response) + 65536) : Convert.ToUInt16(response); }
|
try { val = Convert.ToInt32(response) < 0 ? (ushort)(Convert.ToInt16(response) + 65536) : Convert.ToUInt16(response); }
|
||||||
catch { val = 0; }
|
catch { val = 0; }
|
||||||
|
|
||||||
OnUShortChange(val, index, JsonToSimplConstants.UshortValueChange);
|
OnUShortChange(val, index, JsonToSimplConstants.UshortValueChange);
|
||||||
}
|
|
||||||
else { }
|
|
||||||
// OnUShortChange(0, index, JsonToSimplConstants.UshortValueChange);
|
|
||||||
}
|
}
|
||||||
|
else { }
|
||||||
|
// OnUShortChange(0, index, JsonToSimplConstants.UshortValueChange);
|
||||||
|
}
|
||||||
|
|
||||||
// Processes the path to a string property and fires of a StringChange event.
|
// Processes the path to a string property and fires of a StringChange event.
|
||||||
void ProcessStringPath(ushort index)
|
void ProcessStringPath(ushort index)
|
||||||
@@ -233,7 +232,7 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
if (isCount)
|
if (isCount)
|
||||||
response = (t.HasValues ? t.Children().Count() : 0).ToString();
|
response = (t.HasValues ? t.Children().Count() : 0).ToString();
|
||||||
else
|
else
|
||||||
response = t.Value<string>();
|
response = (string)t;
|
||||||
Debug.Console(1, " ='{0}'", response);
|
Debug.Console(1, " ='{0}'", response);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -275,69 +274,54 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
GetAllValuesDelegate();
|
GetAllValuesDelegate();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </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))
|
||||||
SetValueOnMaster(BoolPaths[key], new JValue(theValue));
|
SetValueOnMaster(BoolPaths[key], new JValue(theValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </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))
|
||||||
SetValueOnMaster(UshortPaths[key], new JValue(theValue));
|
SetValueOnMaster(UshortPaths[key], new JValue(theValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </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))
|
||||||
SetValueOnMaster(StringPaths[key], new JValue(theValue));
|
SetValueOnMaster(StringPaths[key], new JValue(theValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </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);
|
||||||
@@ -367,12 +351,12 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
|
|
||||||
// Helpers for events
|
// Helpers for events
|
||||||
//******************************************************************************************
|
//******************************************************************************************
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Event helper
|
/// Event helper
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="state"></param>
|
/// <param name="state"></param>
|
||||||
/// <param name="index"></param>
|
/// <param name="index"></param>
|
||||||
/// <param name="type"></param>
|
/// <param name="type"></param>
|
||||||
protected void OnBoolChange(bool state, ushort index, ushort type)
|
protected void OnBoolChange(bool state, ushort index, ushort type)
|
||||||
{
|
{
|
||||||
var handler = BoolChange;
|
var handler = BoolChange;
|
||||||
@@ -385,12 +369,12 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
//******************************************************************************************
|
//******************************************************************************************
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Event helper
|
/// Event helper
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="state"></param>
|
/// <param name="state"></param>
|
||||||
/// <param name="index"></param>
|
/// <param name="index"></param>
|
||||||
/// <param name="type"></param>
|
/// <param name="type"></param>
|
||||||
protected void OnUShortChange(ushort state, ushort index, ushort type)
|
protected void OnUShortChange(ushort state, ushort index, ushort type)
|
||||||
{
|
{
|
||||||
var handler = UShortChange;
|
var handler = UShortChange;
|
||||||
@@ -402,12 +386,12 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Event helper
|
/// Event helper
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="value"></param>
|
/// <param name="value"></param>
|
||||||
/// <param name="index"></param>
|
/// <param name="index"></param>
|
||||||
/// <param name="type"></param>
|
/// <param name="type"></param>
|
||||||
protected void OnStringChange(string value, ushort index, ushort type)
|
protected void OnStringChange(string value, ushort index, ushort type)
|
||||||
{
|
{
|
||||||
var handler = StringChange;
|
var handler = StringChange;
|
||||||
@@ -418,5 +402,4 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
StringChange(this, args);
|
StringChange(this, args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -1,290 +1,290 @@
|
|||||||
using System;
|
extern alias NewtonsoftJson;
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
using Crestron.SimplSharp.CrestronIO;
|
using Crestron.SimplSharp.CrestronIO;
|
||||||
using Newtonsoft.Json.Linq;
|
using Formatting = NewtonsoftJson::Newtonsoft.Json.Formatting;
|
||||||
|
using JObject = NewtonsoftJson::Newtonsoft.Json.Linq.JObject;
|
||||||
|
using JValue = NewtonsoftJson::Newtonsoft.Json.Linq.JValue;
|
||||||
|
|
||||||
namespace PepperDash.Core.JsonToSimpl
|
namespace PepperDash.Core.JsonToSimpl;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a JSON file that can be read and written to
|
||||||
|
/// </summary>
|
||||||
|
public class JsonToSimplFileMaster : JsonToSimplMaster
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a JSON file that can be read and written to
|
/// Sets the filepath as well as registers this with the Global.Masters list
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class JsonToSimplFileMaster : JsonToSimplMaster
|
public string Filepath { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Filepath to the actual file that will be read (Portal or local)
|
||||||
|
/// </summary>
|
||||||
|
public string ActualFilePath { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public string Filename { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public string FilePathName { get; private set; }
|
||||||
|
|
||||||
|
/*****************************************************************************************/
|
||||||
|
/** Privates **/
|
||||||
|
|
||||||
|
|
||||||
|
// The JSON file in JObject form
|
||||||
|
// For gathering the incoming data
|
||||||
|
object StringBuilderLock = new object();
|
||||||
|
// To prevent multiple same-file access
|
||||||
|
static object FileLock = new object();
|
||||||
|
|
||||||
|
/*****************************************************************************************/
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// SIMPL+ default constructor.
|
||||||
|
/// </summary>
|
||||||
|
public JsonToSimplFileMaster()
|
||||||
{
|
{
|
||||||
/// <summary>
|
}
|
||||||
/// Sets the filepath as well as registers this with the Global.Masters list
|
|
||||||
/// </summary>
|
|
||||||
public string Filepath { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the ActualFilePath
|
/// Read, evaluate and udpate status
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ActualFilePath { get; private set; }
|
public void EvaluateFile(string filepath)
|
||||||
|
{
|
||||||
/// <summary>
|
try
|
||||||
/// Gets or sets the Filename
|
|
||||||
/// </summary>
|
|
||||||
public string Filename { get; private set; }
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public string FilePathName { get; private set; }
|
|
||||||
|
|
||||||
/*****************************************************************************************/
|
|
||||||
/** Privates **/
|
|
||||||
|
|
||||||
|
|
||||||
// The JSON file in JObject form
|
|
||||||
// For gathering the incoming data
|
|
||||||
object StringBuilderLock = new object();
|
|
||||||
// To prevent multiple same-file access
|
|
||||||
static object FileLock = new object();
|
|
||||||
|
|
||||||
/*****************************************************************************************/
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// SIMPL+ default constructor.
|
|
||||||
/// </summary>
|
|
||||||
public JsonToSimplFileMaster()
|
|
||||||
{
|
{
|
||||||
}
|
OnBoolChange(false, 0, JsonToSimplConstants.JsonIsValidBoolChange);
|
||||||
|
|
||||||
/// <summary>
|
var dirSeparator = Path.DirectorySeparatorChar;
|
||||||
/// Read, evaluate and udpate status
|
var dirSeparatorAlt = Path.AltDirectorySeparatorChar;
|
||||||
/// </summary>
|
|
||||||
public void EvaluateFile(string filepath)
|
var series = CrestronEnvironment.ProgramCompatibility;
|
||||||
{
|
|
||||||
try
|
var is3Series = (eCrestronSeries.Series3 == (series & eCrestronSeries.Series3));
|
||||||
|
OnBoolChange(is3Series, 0,
|
||||||
|
JsonToSimplConstants.ProgramCompatibility3SeriesChange);
|
||||||
|
|
||||||
|
var is4Series = (eCrestronSeries.Series4 == (series & eCrestronSeries.Series4));
|
||||||
|
OnBoolChange(is4Series, 0,
|
||||||
|
JsonToSimplConstants.ProgramCompatibility4SeriesChange);
|
||||||
|
|
||||||
|
var isServer = CrestronEnvironment.DevicePlatform == eDevicePlatform.Server;
|
||||||
|
OnBoolChange(isServer, 0,
|
||||||
|
JsonToSimplConstants.DevicePlatformValueChange);
|
||||||
|
|
||||||
|
// get the roomID
|
||||||
|
var roomId = Crestron.SimplSharp.InitialParametersClass.RoomId;
|
||||||
|
if (!string.IsNullOrEmpty(roomId))
|
||||||
{
|
{
|
||||||
OnBoolChange(false, 0, JsonToSimplConstants.JsonIsValidBoolChange);
|
OnStringChange(roomId, 0, JsonToSimplConstants.RoomIdChange);
|
||||||
|
}
|
||||||
|
|
||||||
var dirSeparator = Path.DirectorySeparatorChar;
|
// get the roomName
|
||||||
var dirSeparatorAlt = Path.AltDirectorySeparatorChar;
|
var roomName = Crestron.SimplSharp.InitialParametersClass.RoomName;
|
||||||
|
if (!string.IsNullOrEmpty(roomName))
|
||||||
|
{
|
||||||
|
OnStringChange(roomName, 0, JsonToSimplConstants.RoomNameChange);
|
||||||
|
}
|
||||||
|
|
||||||
var series = CrestronEnvironment.ProgramCompatibility;
|
var rootDirectory = Directory.GetApplicationRootDirectory();
|
||||||
|
OnStringChange(rootDirectory, 0, JsonToSimplConstants.RootDirectoryChange);
|
||||||
|
|
||||||
|
var splusPath = string.Empty;
|
||||||
|
if (Regex.IsMatch(filepath, @"user", RegexOptions.IgnoreCase))
|
||||||
|
{
|
||||||
|
if (is4Series)
|
||||||
|
splusPath = Regex.Replace(filepath, "user", "user", RegexOptions.IgnoreCase);
|
||||||
|
else if (isServer)
|
||||||
|
splusPath = Regex.Replace(filepath, "user", "User", RegexOptions.IgnoreCase);
|
||||||
|
else
|
||||||
|
splusPath = filepath;
|
||||||
|
}
|
||||||
|
|
||||||
var is3Series = (eCrestronSeries.Series3 == (series & eCrestronSeries.Series3));
|
filepath = splusPath.Replace(dirSeparatorAlt, dirSeparator);
|
||||||
OnBoolChange(is3Series, 0,
|
|
||||||
JsonToSimplConstants.ProgramCompatibility3SeriesChange);
|
Filepath = string.Format("{1}{0}{2}", dirSeparator, rootDirectory,
|
||||||
|
filepath.TrimStart(dirSeparator, dirSeparatorAlt));
|
||||||
|
|
||||||
|
OnStringChange(string.Format("Attempting to evaluate {0}", Filepath), 0, JsonToSimplConstants.StringValueChange);
|
||||||
|
|
||||||
var is4Series = (eCrestronSeries.Series4 == (series & eCrestronSeries.Series4));
|
if (string.IsNullOrEmpty(Filepath))
|
||||||
OnBoolChange(is4Series, 0,
|
{
|
||||||
JsonToSimplConstants.ProgramCompatibility4SeriesChange);
|
OnStringChange(string.Format("Cannot evaluate file. JSON file path not set"), 0, JsonToSimplConstants.StringValueChange);
|
||||||
|
CrestronConsole.PrintLine("Cannot evaluate file. JSON file path not set");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var isServer = CrestronEnvironment.DevicePlatform == eDevicePlatform.Server;
|
// get file directory and name to search
|
||||||
OnBoolChange(isServer, 0,
|
var fileDirectory = Path.GetDirectoryName(Filepath);
|
||||||
JsonToSimplConstants.DevicePlatformValueChange);
|
var fileName = Path.GetFileName(Filepath);
|
||||||
|
|
||||||
// get the roomID
|
OnStringChange(string.Format("Checking '{0}' for '{1}'", fileDirectory, fileName), 0, JsonToSimplConstants.StringValueChange);
|
||||||
var roomId = Crestron.SimplSharp.InitialParametersClass.RoomId;
|
Debug.Console(1, "Checking '{0}' for '{1}'", fileDirectory, fileName);
|
||||||
if (!string.IsNullOrEmpty(roomId))
|
|
||||||
|
if (Directory.Exists(fileDirectory))
|
||||||
|
{
|
||||||
|
// get the directory info
|
||||||
|
var directoryInfo = new DirectoryInfo(fileDirectory);
|
||||||
|
|
||||||
|
// get the file to be read
|
||||||
|
var actualFile = directoryInfo.GetFiles(fileName).FirstOrDefault();
|
||||||
|
if (actualFile == null)
|
||||||
{
|
{
|
||||||
OnStringChange(roomId, 0, JsonToSimplConstants.RoomIdChange);
|
var msg = string.Format("JSON file not found: {0}", Filepath);
|
||||||
}
|
OnStringChange(msg, 0, JsonToSimplConstants.StringValueChange);
|
||||||
|
CrestronConsole.PrintLine(msg);
|
||||||
// get the roomName
|
ErrorLog.Error(msg);
|
||||||
var roomName = Crestron.SimplSharp.InitialParametersClass.RoomName;
|
|
||||||
if (!string.IsNullOrEmpty(roomName))
|
|
||||||
{
|
|
||||||
OnStringChange(roomName, 0, JsonToSimplConstants.RoomNameChange);
|
|
||||||
}
|
|
||||||
|
|
||||||
var rootDirectory = Directory.GetApplicationRootDirectory();
|
|
||||||
OnStringChange(rootDirectory, 0, JsonToSimplConstants.RootDirectoryChange);
|
|
||||||
|
|
||||||
var splusPath = string.Empty;
|
|
||||||
if (Regex.IsMatch(filepath, @"user", RegexOptions.IgnoreCase))
|
|
||||||
{
|
|
||||||
if (is4Series)
|
|
||||||
splusPath = Regex.Replace(filepath, "user", "user", RegexOptions.IgnoreCase);
|
|
||||||
else if (isServer)
|
|
||||||
splusPath = Regex.Replace(filepath, "user", "User", RegexOptions.IgnoreCase);
|
|
||||||
else
|
|
||||||
splusPath = filepath;
|
|
||||||
}
|
|
||||||
|
|
||||||
filepath = splusPath.Replace(dirSeparatorAlt, dirSeparator);
|
|
||||||
|
|
||||||
Filepath = string.Format("{1}{0}{2}", dirSeparator, rootDirectory,
|
|
||||||
filepath.TrimStart(dirSeparator, dirSeparatorAlt));
|
|
||||||
|
|
||||||
OnStringChange(string.Format("Attempting to evaluate {0}", Filepath), 0, JsonToSimplConstants.StringValueChange);
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(Filepath))
|
|
||||||
{
|
|
||||||
OnStringChange(string.Format("Cannot evaluate file. JSON file path not set"), 0, JsonToSimplConstants.StringValueChange);
|
|
||||||
CrestronConsole.PrintLine("Cannot evaluate file. JSON file path not set");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get file directory and name to search
|
// \xSE\xR\PDT000-Template_Main_Config-Combined_DSP_v00.02.json
|
||||||
var fileDirectory = Path.GetDirectoryName(Filepath);
|
// \USER\PDT000-Template_Main_Config-Combined_DSP_v00.02.json
|
||||||
var fileName = Path.GetFileName(Filepath);
|
ActualFilePath = actualFile.FullName;
|
||||||
|
OnStringChange(ActualFilePath, 0, JsonToSimplConstants.ActualFilePathChange);
|
||||||
|
OnStringChange(string.Format("Actual JSON file is {0}", ActualFilePath), 0, JsonToSimplConstants.StringValueChange);
|
||||||
|
Debug.Console(1, "Actual JSON file is {0}", ActualFilePath);
|
||||||
|
|
||||||
OnStringChange(string.Format("Checking '{0}' for '{1}'", fileDirectory, fileName), 0, JsonToSimplConstants.StringValueChange);
|
Filename = actualFile.Name;
|
||||||
Debug.Console(1, "Checking '{0}' for '{1}'", fileDirectory, fileName);
|
OnStringChange(Filename, 0, JsonToSimplConstants.FilenameResolvedChange);
|
||||||
|
OnStringChange(string.Format("JSON Filename is {0}", Filename), 0, JsonToSimplConstants.StringValueChange);
|
||||||
if (Directory.Exists(fileDirectory))
|
Debug.Console(1, "JSON Filename is {0}", Filename);
|
||||||
{
|
|
||||||
// get the directory info
|
|
||||||
var directoryInfo = new DirectoryInfo(fileDirectory);
|
|
||||||
|
|
||||||
// get the file to be read
|
|
||||||
var actualFile = directoryInfo.GetFiles(fileName).FirstOrDefault();
|
|
||||||
if (actualFile == null)
|
|
||||||
{
|
|
||||||
var msg = string.Format("JSON file not found: {0}", Filepath);
|
|
||||||
OnStringChange(msg, 0, JsonToSimplConstants.StringValueChange);
|
|
||||||
CrestronConsole.PrintLine(msg);
|
|
||||||
ErrorLog.Error(msg);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// \xSE\xR\PDT000-Template_Main_Config-Combined_DSP_v00.02.json
|
|
||||||
// \USER\PDT000-Template_Main_Config-Combined_DSP_v00.02.json
|
|
||||||
ActualFilePath = actualFile.FullName;
|
|
||||||
OnStringChange(ActualFilePath, 0, JsonToSimplConstants.ActualFilePathChange);
|
|
||||||
OnStringChange(string.Format("Actual JSON file is {0}", ActualFilePath), 0, JsonToSimplConstants.StringValueChange);
|
|
||||||
Debug.Console(1, "Actual JSON file is {0}", ActualFilePath);
|
|
||||||
|
|
||||||
Filename = actualFile.Name;
|
|
||||||
OnStringChange(Filename, 0, JsonToSimplConstants.FilenameResolvedChange);
|
|
||||||
OnStringChange(string.Format("JSON Filename is {0}", Filename), 0, JsonToSimplConstants.StringValueChange);
|
|
||||||
Debug.Console(1, "JSON Filename is {0}", Filename);
|
|
||||||
|
|
||||||
|
|
||||||
FilePathName = string.Format(@"{0}{1}", actualFile.DirectoryName, dirSeparator);
|
FilePathName = string.Format(@"{0}{1}", actualFile.DirectoryName, dirSeparator);
|
||||||
OnStringChange(string.Format(@"{0}", actualFile.DirectoryName), 0, JsonToSimplConstants.FilePathResolvedChange);
|
OnStringChange(string.Format(@"{0}", actualFile.DirectoryName), 0, JsonToSimplConstants.FilePathResolvedChange);
|
||||||
OnStringChange(string.Format(@"JSON File Path is {0}", actualFile.DirectoryName), 0, JsonToSimplConstants.StringValueChange);
|
OnStringChange(string.Format(@"JSON File Path is {0}", actualFile.DirectoryName), 0, JsonToSimplConstants.StringValueChange);
|
||||||
Debug.Console(1, "JSON File Path is {0}", FilePathName);
|
Debug.Console(1, "JSON File Path is {0}", FilePathName);
|
||||||
|
|
||||||
var json = File.ReadToEnd(ActualFilePath, System.Text.Encoding.ASCII);
|
var json = File.ReadToEnd(ActualFilePath, System.Text.Encoding.ASCII);
|
||||||
|
|
||||||
JsonObject = JObject.Parse(json);
|
JsonObject = JObject.Parse(json);
|
||||||
foreach (var child in Children)
|
foreach (var child in Children)
|
||||||
child.ProcessAll();
|
child.ProcessAll();
|
||||||
|
|
||||||
OnBoolChange(true, 0, JsonToSimplConstants.JsonIsValidBoolChange);
|
OnBoolChange(true, 0, JsonToSimplConstants.JsonIsValidBoolChange);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
OnStringChange(string.Format("'{0}' not found", fileDirectory), 0, JsonToSimplConstants.StringValueChange);
|
|
||||||
Debug.Console(1, "'{0}' not found", fileDirectory);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
else
|
||||||
{
|
{
|
||||||
var msg = string.Format("EvaluateFile Exception: Message\r{0}", e.Message);
|
OnStringChange(string.Format("'{0}' not found", fileDirectory), 0, JsonToSimplConstants.StringValueChange);
|
||||||
OnStringChange(msg, 0, JsonToSimplConstants.StringValueChange);
|
Debug.Console(1, "'{0}' not found", fileDirectory);
|
||||||
CrestronConsole.PrintLine(msg);
|
|
||||||
ErrorLog.Error(msg);
|
|
||||||
|
|
||||||
var stackTrace = string.Format("EvaluateFile: Stack Trace\r{0}", e.StackTrace);
|
|
||||||
OnStringChange(stackTrace, 0, JsonToSimplConstants.StringValueChange);
|
|
||||||
CrestronConsole.PrintLine(stackTrace);
|
|
||||||
ErrorLog.Error(stackTrace);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sets the debug level
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="level"></param>
|
|
||||||
/// <summary>
|
|
||||||
/// setDebugLevel method
|
|
||||||
/// </summary>
|
|
||||||
public void setDebugLevel(uint level)
|
|
||||||
{
|
{
|
||||||
Debug.SetDebugLevel(level);
|
var msg = string.Format("EvaluateFile Exception: Message\r{0}", e.Message);
|
||||||
|
OnStringChange(msg, 0, JsonToSimplConstants.StringValueChange);
|
||||||
|
CrestronConsole.PrintLine(msg);
|
||||||
|
ErrorLog.Error(msg);
|
||||||
|
|
||||||
|
var stackTrace = string.Format("EvaluateFile: Stack Trace\r{0}", e.StackTrace);
|
||||||
|
OnStringChange(stackTrace, 0, JsonToSimplConstants.StringValueChange);
|
||||||
|
CrestronConsole.PrintLine(stackTrace);
|
||||||
|
ErrorLog.Error(stackTrace);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the debug level
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="level"></param>
|
||||||
|
public void setDebugLevel(uint level)
|
||||||
|
{
|
||||||
|
Debug.SetDebugLevel(level);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Saves the values to the file
|
||||||
|
/// </summary>
|
||||||
|
public override void Save()
|
||||||
|
{
|
||||||
|
// this code is duplicated in the other masters!!!!!!!!!!!!!
|
||||||
|
UnsavedValues = new Dictionary<string, JValue>();
|
||||||
|
// Make each child update their values into master object
|
||||||
|
foreach (var child in Children)
|
||||||
|
{
|
||||||
|
Debug.Console(1, "Master [{0}] checking child [{1}] for updates to save", UniqueID, child.Key);
|
||||||
|
child.UpdateInputsForMaster();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
if (UnsavedValues == null || UnsavedValues.Count == 0)
|
||||||
/// Saves the values to the file
|
|
||||||
/// </summary>
|
|
||||||
public override void Save()
|
|
||||||
{
|
{
|
||||||
// this code is duplicated in the other masters!!!!!!!!!!!!!
|
Debug.Console(1, "Master [{0}] No updated values to save. Skipping", UniqueID);
|
||||||
UnsavedValues = new Dictionary<string, JValue>();
|
return;
|
||||||
// Make each child update their values into master object
|
}
|
||||||
foreach (var child in Children)
|
lock (FileLock)
|
||||||
|
{
|
||||||
|
Debug.Console(1, "Saving");
|
||||||
|
foreach (var path in UnsavedValues.Keys)
|
||||||
{
|
{
|
||||||
Debug.Console(1, "Master [{0}] checking child [{1}] for updates to save", UniqueID, child.Key);
|
var tokenToReplace = JsonObject.SelectToken(path);
|
||||||
child.UpdateInputsForMaster();
|
if (tokenToReplace != null)
|
||||||
}
|
{// It's found
|
||||||
|
tokenToReplace.Replace(UnsavedValues[path]);
|
||||||
if (UnsavedValues == null || UnsavedValues.Count == 0)
|
Debug.Console(1, "JSON Master[{0}] Updating '{1}'", UniqueID, path);
|
||||||
{
|
|
||||||
Debug.Console(1, "Master [{0}] No updated values to save. Skipping", UniqueID);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
lock (FileLock)
|
|
||||||
{
|
|
||||||
Debug.Console(1, "Saving");
|
|
||||||
foreach (var path in UnsavedValues.Keys)
|
|
||||||
{
|
|
||||||
var tokenToReplace = JsonObject.SelectToken(path);
|
|
||||||
if (tokenToReplace != null)
|
|
||||||
{// It's found
|
|
||||||
tokenToReplace.Replace(UnsavedValues[path]);
|
|
||||||
Debug.Console(1, "JSON Master[{0}] Updating '{1}'", UniqueID, path);
|
|
||||||
}
|
|
||||||
else // No token. Let's make one
|
|
||||||
{
|
|
||||||
//http://stackoverflow.com/questions/17455052/how-to-set-the-value-of-a-json-path-using-json-net
|
|
||||||
Debug.Console(1, "JSON Master[{0}] Cannot write value onto missing property: '{1}'", UniqueID, path);
|
|
||||||
|
|
||||||
// JContainer jpart = JsonObject;
|
|
||||||
// // walk down the path and find where it goes
|
|
||||||
//#warning Does not handle arrays.
|
|
||||||
// foreach (var part in path.Split('.'))
|
|
||||||
// {
|
|
||||||
|
|
||||||
// var openPos = part.IndexOf('[');
|
|
||||||
// if (openPos > -1)
|
|
||||||
// {
|
|
||||||
// openPos++; // move to number
|
|
||||||
// var closePos = part.IndexOf(']');
|
|
||||||
// var arrayName = part.Substring(0, openPos - 1); // get the name
|
|
||||||
// var index = Convert.ToInt32(part.Substring(openPos, closePos - openPos));
|
|
||||||
|
|
||||||
// // Check if the array itself exists and add the item if so
|
|
||||||
// if (jpart[arrayName] != null)
|
|
||||||
// {
|
|
||||||
// var arrayObj = jpart[arrayName] as JArray;
|
|
||||||
// var item = arrayObj[index];
|
|
||||||
// if (item == null)
|
|
||||||
// arrayObj.Add(new JObject());
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Debug.Console(0, "IGNORING MISSING ARRAY VALUE FOR NOW");
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
// // Build the
|
|
||||||
// if (jpart[part] == null)
|
|
||||||
// jpart.Add(new JProperty(part, new JObject()));
|
|
||||||
// jpart = jpart[part] as JContainer;
|
|
||||||
// }
|
|
||||||
// jpart.Replace(UnsavedValues[path]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
using (StreamWriter sw = new StreamWriter(ActualFilePath))
|
else // No token. Let's make one
|
||||||
{
|
{
|
||||||
try
|
//http://stackoverflow.com/questions/17455052/how-to-set-the-value-of-a-json-path-using-json-net
|
||||||
{
|
Debug.Console(1, "JSON Master[{0}] Cannot write value onto missing property: '{1}'", UniqueID, path);
|
||||||
sw.Write(JsonObject.ToString());
|
|
||||||
sw.Flush();
|
// JContainer jpart = JsonObject;
|
||||||
}
|
// // walk down the path and find where it goes
|
||||||
catch (Exception e)
|
//#warning Does not handle arrays.
|
||||||
{
|
// foreach (var part in path.Split('.'))
|
||||||
string err = string.Format("Error writing JSON file:\r{0}", e);
|
// {
|
||||||
Debug.Console(0, err);
|
|
||||||
ErrorLog.Warn(err);
|
// var openPos = part.IndexOf('[');
|
||||||
return;
|
// if (openPos > -1)
|
||||||
}
|
// {
|
||||||
|
// openPos++; // move to number
|
||||||
|
// var closePos = part.IndexOf(']');
|
||||||
|
// var arrayName = part.Substring(0, openPos - 1); // get the name
|
||||||
|
// var index = Convert.ToInt32(part.Substring(openPos, closePos - openPos));
|
||||||
|
|
||||||
|
// // Check if the array itself exists and add the item if so
|
||||||
|
// if (jpart[arrayName] != null)
|
||||||
|
// {
|
||||||
|
// var arrayObj = jpart[arrayName] as JArray;
|
||||||
|
// var item = arrayObj[index];
|
||||||
|
// if (item == null)
|
||||||
|
// arrayObj.Add(new JObject());
|
||||||
|
// }
|
||||||
|
|
||||||
|
// Debug.Console(0, "IGNORING MISSING ARRAY VALUE FOR NOW");
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
// // Build the
|
||||||
|
// if (jpart[part] == null)
|
||||||
|
// jpart.Add(new JProperty(part, new JObject()));
|
||||||
|
// jpart = jpart[part] as JContainer;
|
||||||
|
// }
|
||||||
|
// jpart.Replace(UnsavedValues[path]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
using (StreamWriter sw = new StreamWriter(ActualFilePath))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
sw.Write(JsonObject.ToString());
|
||||||
|
sw.Flush();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
string err = string.Format("Error writing JSON file:\r{0}", e);
|
||||||
|
Debug.Console(0, err);
|
||||||
|
ErrorLog.Warn(err);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +1,17 @@
|
|||||||
|
|
||||||
|
|
||||||
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>
|
||||||
/// Constructor
|
/// Constructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public JsonToSimplFixedPathObject()
|
public JsonToSimplFixedPathObject()
|
||||||
{
|
{
|
||||||
this.LinkedToObject = true;
|
this.LinkedToObject = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -1,37 +1,40 @@
|
|||||||
using System;
|
extern alias NewtonsoftJson;
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
using Newtonsoft.Json.Linq;
|
using JObject = NewtonsoftJson::Newtonsoft.Json.Linq.JObject;
|
||||||
|
using JValue = NewtonsoftJson::Newtonsoft.Json.Linq.JValue;
|
||||||
|
|
||||||
namespace PepperDash.Core.JsonToSimpl
|
namespace PepperDash.Core.JsonToSimpl;
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a JsonToSimplGenericMaster
|
/// Generic Master
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class JsonToSimplGenericMaster : JsonToSimplMaster
|
public class JsonToSimplGenericMaster : JsonToSimplMaster
|
||||||
{
|
{
|
||||||
/*****************************************************************************************/
|
/*****************************************************************************************/
|
||||||
/** Privates **/
|
/** Privates **/
|
||||||
|
|
||||||
|
|
||||||
// The JSON file in JObject form
|
// The JSON file in JObject form
|
||||||
// For gathering the incoming data
|
// For gathering the incoming data
|
||||||
object StringBuilderLock = new object();
|
object StringBuilderLock = new object();
|
||||||
// To prevent multiple same-file access
|
// To prevent multiple same-file access
|
||||||
static object WriteLock = new object();
|
static object WriteLock = new object();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the SaveCallback
|
/// Callback action for saving
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Action<string> SaveCallback { get; set; }
|
public Action<string> SaveCallback { get; set; }
|
||||||
|
|
||||||
/*****************************************************************************************/
|
/*****************************************************************************************/
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// SIMPL+ default constructor.
|
/// SIMPL+ default constructor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public JsonToSimplGenericMaster()
|
public JsonToSimplGenericMaster()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -82,7 +85,7 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
public override void Save()
|
public override void Save()
|
||||||
{
|
{
|
||||||
// this code is duplicated in the other masters!!!!!!!!!!!!!
|
// this code is duplicated in the other masters!!!!!!!!!!!!!
|
||||||
UnsavedValues = new Dictionary<string, JValue>();
|
UnsavedValues = new Dictionary<string, JValue>();
|
||||||
// Make each child update their values into master object
|
// Make each child update their values into master object
|
||||||
foreach (var child in Children)
|
foreach (var child in Children)
|
||||||
{
|
{
|
||||||
@@ -118,5 +121,4 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
else
|
else
|
||||||
Debug.Console(0, this, "WARNING: No save callback defined.");
|
Debug.Console(0, this, "WARNING: No save callback defined.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -1,34 +1,39 @@
|
|||||||
|
extern alias NewtonsoftJson;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
using Crestron.SimplSharp.CrestronIO;
|
using Crestron.SimplSharp.CrestronIO;
|
||||||
using Newtonsoft.Json;
|
using JArray = NewtonsoftJson::Newtonsoft.Json.Linq.JArray;
|
||||||
using Newtonsoft.Json.Linq;
|
using JObject = NewtonsoftJson::Newtonsoft.Json.Linq.JObject;
|
||||||
|
using JValue = NewtonsoftJson::Newtonsoft.Json.Linq.JValue;
|
||||||
|
using JsonSerializationException = NewtonsoftJson::Newtonsoft.Json.JsonSerializationException;
|
||||||
|
using JsonTextReader = NewtonsoftJson::Newtonsoft.Json.JsonTextReader;
|
||||||
|
|
||||||
namespace PepperDash.Core.JsonToSimpl
|
namespace PepperDash.Core.JsonToSimpl;
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Abstract base class for JsonToSimpl interactions
|
/// Abstract base class for JsonToSimpl interactions
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class JsonToSimplMaster : IKeyed
|
public abstract class JsonToSimplMaster : IKeyed
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Notifies of bool change
|
/// Notifies of bool change
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event EventHandler<BoolChangeEventArgs> BoolChange;
|
public event EventHandler<BoolChangeEventArgs> BoolChange;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Notifies of ushort change
|
/// Notifies of ushort change
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event EventHandler<UshrtChangeEventArgs> UshrtChange;
|
public event EventHandler<UshrtChangeEventArgs> UshrtChange;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Notifies of string change
|
/// Notifies of string change
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event EventHandler<StringChangeEventArgs> StringChange;
|
public event EventHandler<StringChangeEventArgs> StringChange;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A collection of associated child modules
|
/// A collection of associated child modules
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected List<JsonToSimplChildObjectBase> Children = new List<JsonToSimplChildObjectBase>();
|
protected List<JsonToSimplChildObjectBase> Children = new List<JsonToSimplChildObjectBase>();
|
||||||
|
|
||||||
/*****************************************************************************************/
|
/*****************************************************************************************/
|
||||||
@@ -38,9 +43,9 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string Key { get { return UniqueID; } }
|
public string Key { get { return UniqueID; } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the UniqueID
|
/// A unique ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string UniqueID { get; protected set; }
|
public string UniqueID { get; protected set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -82,9 +87,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; }
|
||||||
|
|
||||||
/*****************************************************************************************/
|
/*****************************************************************************************/
|
||||||
@@ -144,9 +149,9 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
//Debug.Console(0, "Master[{0}] Unsaved size={1}", UniqueID, UnsavedValues.Count);
|
//Debug.Console(0, "Master[{0}] Unsaved size={1}", UniqueID, UnsavedValues.Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Saves the file
|
/// Saves the file
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract void Save();
|
public abstract void Save();
|
||||||
|
|
||||||
|
|
||||||
@@ -155,18 +160,14 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static class JsonFixes
|
public static class JsonFixes
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Deserializes a string into a JObject
|
/// Deserializes a string into a JObject
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="json"></param>
|
/// <param name="json"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static JObject ParseObject(string json)
|
public static JObject ParseObject(string json)
|
||||||
{
|
{
|
||||||
#if NET6_0
|
using (var reader = new JsonTextReader(new System.IO.StringReader(json)))
|
||||||
using (var reader = new JsonTextReader(new System.IO.StringReader(json)))
|
|
||||||
#else
|
|
||||||
using (var reader = new JsonTextReader(new Crestron.SimplSharp.CrestronIO.StringReader(json)))
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
var startDepth = reader.Depth;
|
var startDepth = reader.Depth;
|
||||||
var obj = JObject.Load(reader);
|
var obj = JObject.Load(reader);
|
||||||
@@ -176,21 +177,15 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Deserializes a string into a JArray
|
/// Deserializes a string into a JArray
|
||||||
/// </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
|
|
||||||
using (var reader = new JsonTextReader(new System.IO.StringReader(json)))
|
using (var reader = new JsonTextReader(new System.IO.StringReader(json)))
|
||||||
#else
|
|
||||||
using (var reader = new JsonTextReader(new Crestron.SimplSharp.CrestronIO.StringReader(json)))
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
var startDepth = reader.Depth;
|
var startDepth = reader.Depth;
|
||||||
var obj = JArray.Load(reader);
|
var obj = JArray.Load(reader);
|
||||||
@@ -233,12 +228,12 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Helper event
|
/// Helper event
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="value"></param>
|
/// <param name="value"></param>
|
||||||
/// <param name="index"></param>
|
/// <param name="index"></param>
|
||||||
/// <param name="type"></param>
|
/// <param name="type"></param>
|
||||||
protected void OnStringChange(string value, ushort index, ushort type)
|
protected void OnStringChange(string value, ushort index, ushort type)
|
||||||
{
|
{
|
||||||
if (StringChange != null)
|
if (StringChange != null)
|
||||||
@@ -249,4 +244,3 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,27 +1,30 @@
|
|||||||
using System;
|
extern alias NewtonsoftJson;
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
using Crestron.SimplSharp.CrestronIO;
|
using Crestron.SimplSharp.CrestronIO;
|
||||||
using Newtonsoft.Json.Linq;
|
using JObject = NewtonsoftJson::Newtonsoft.Json.Linq.JObject;
|
||||||
|
using JValue = NewtonsoftJson::Newtonsoft.Json.Linq.JValue;
|
||||||
using PepperDash.Core.Config;
|
using PepperDash.Core.Config;
|
||||||
|
|
||||||
namespace PepperDash.Core.JsonToSimpl
|
namespace PepperDash.Core.JsonToSimpl;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Portal File Master
|
||||||
|
/// </summary>
|
||||||
|
public class JsonToSimplPortalFileMaster : JsonToSimplMaster
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Portal File Master
|
|
||||||
/// </summary>
|
|
||||||
public class JsonToSimplPortalFileMaster : JsonToSimplMaster
|
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets the filepath as well as registers this with the Global.Masters list
|
/// Sets the filepath as well as registers this with the Global.Masters list
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string PortalFilepath { get; private set; }
|
public string PortalFilepath { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the ActualFilePath
|
/// File path of the actual file being read (Portal or local)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ActualFilePath { get; private set; }
|
public string ActualFilePath { get; private set; }
|
||||||
|
|
||||||
/*****************************************************************************************/
|
/*****************************************************************************************/
|
||||||
/** Privates **/
|
/** Privates **/
|
||||||
@@ -33,10 +36,10 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
/*****************************************************************************************/
|
/*****************************************************************************************/
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// SIMPL+ default constructor.
|
/// SIMPL+ default constructor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public JsonToSimplPortalFileMaster()
|
public JsonToSimplPortalFileMaster()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -64,7 +67,7 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
if (actualLocalFile != null)
|
if (actualLocalFile != null)
|
||||||
{
|
{
|
||||||
ActualFilePath = actualLocalFile.FullName;
|
ActualFilePath = actualLocalFile.FullName;
|
||||||
OnStringChange(ActualFilePath, 0, JsonToSimplConstants.ActualFilePathChange);
|
OnStringChange(ActualFilePath, 0, JsonToSimplConstants.ActualFilePathChange);
|
||||||
}
|
}
|
||||||
// If the local file does not exist, then read the portal file xyz.json
|
// If the local file does not exist, then read the portal file xyz.json
|
||||||
// and create the local.
|
// and create the local.
|
||||||
@@ -78,7 +81,7 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
// got the portal file, hand off to the merge / save method
|
// got the portal file, hand off to the merge / save method
|
||||||
PortalConfigReader.ReadAndMergeFileIfNecessary(actualPortalFile.FullName, newLocalPath);
|
PortalConfigReader.ReadAndMergeFileIfNecessary(actualPortalFile.FullName, newLocalPath);
|
||||||
ActualFilePath = newLocalPath;
|
ActualFilePath = newLocalPath;
|
||||||
OnStringChange(ActualFilePath, 0, JsonToSimplConstants.ActualFilePathChange);
|
OnStringChange(ActualFilePath, 0, JsonToSimplConstants.ActualFilePathChange);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -191,4 +194,3 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@@ -7,37 +7,30 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace PepperDash.Core.Logging
|
namespace PepperDash.Core.Logging;
|
||||||
|
|
||||||
|
public class CrestronEnricher : ILogEventEnricher
|
||||||
{
|
{
|
||||||
/// <summary>
|
static readonly string _appName;
|
||||||
/// Represents a CrestronEnricher
|
|
||||||
/// </summary>
|
static CrestronEnricher()
|
||||||
public class CrestronEnricher : ILogEventEnricher
|
|
||||||
{
|
{
|
||||||
static readonly string _appName;
|
switch (CrestronEnvironment.DevicePlatform)
|
||||||
|
|
||||||
static CrestronEnricher()
|
|
||||||
{
|
{
|
||||||
switch (CrestronEnvironment.DevicePlatform)
|
case eDevicePlatform.Appliance:
|
||||||
{
|
_appName = $"App {InitialParametersClass.ApplicationNumber}";
|
||||||
case eDevicePlatform.Appliance:
|
break;
|
||||||
_appName = $"App {InitialParametersClass.ApplicationNumber}";
|
case eDevicePlatform.Server:
|
||||||
break;
|
_appName = $"{InitialParametersClass.RoomId}";
|
||||||
case eDevicePlatform.Server:
|
break;
|
||||||
_appName = $"{InitialParametersClass.RoomId}";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Enrich method
|
|
||||||
/// </summary>
|
|
||||||
public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
|
|
||||||
{
|
|
||||||
var property = propertyFactory.CreateProperty("App", _appName);
|
|
||||||
|
|
||||||
logEvent.AddOrUpdateProperty(property);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
|
||||||
|
{
|
||||||
|
var property = propertyFactory.CreateProperty("App", _appName);
|
||||||
|
|
||||||
|
logEvent.AddOrUpdateProperty(property);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -9,56 +9,45 @@ using System.IO;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
|
|
||||||
namespace PepperDash.Core
|
namespace PepperDash.Core;
|
||||||
|
|
||||||
|
public class DebugConsoleSink : ILogEventSink
|
||||||
{
|
{
|
||||||
/// <summary>
|
private readonly ITextFormatter _textFormatter;
|
||||||
/// Represents a DebugConsoleSink
|
|
||||||
/// </summary>
|
public void Emit(LogEvent logEvent)
|
||||||
public class DebugConsoleSink : ILogEventSink
|
|
||||||
{
|
{
|
||||||
private readonly ITextFormatter _textFormatter;
|
if (!Debug.IsRunningOnAppliance) return;
|
||||||
|
|
||||||
/// <summary>
|
/*string message = $"[{logEvent.Timestamp}][{logEvent.Level}][App {InitialParametersClass.ApplicationNumber}]{logEvent.RenderMessage()}";
|
||||||
/// Emit method
|
|
||||||
/// </summary>
|
if(logEvent.Properties.TryGetValue("Key",out var value) && value is ScalarValue sv && sv.Value is string rawValue)
|
||||||
public void Emit(LogEvent logEvent)
|
|
||||||
{
|
{
|
||||||
if (!Debug.IsRunningOnAppliance) return;
|
message = $"[{logEvent.Timestamp}][{logEvent.Level}][App {InitialParametersClass.ApplicationNumber}][{rawValue,3}]: {logEvent.RenderMessage()}";
|
||||||
|
}*/
|
||||||
|
|
||||||
/*string message = $"[{logEvent.Timestamp}][{logEvent.Level}][App {InitialParametersClass.ApplicationNumber}]{logEvent.RenderMessage()}";
|
var buffer = new StringWriter(new StringBuilder(256));
|
||||||
|
|
||||||
if(logEvent.Properties.TryGetValue("Key",out var value) && value is ScalarValue sv && sv.Value is string rawValue)
|
_textFormatter.Format(logEvent, buffer);
|
||||||
{
|
|
||||||
message = $"[{logEvent.Timestamp}][{logEvent.Level}][App {InitialParametersClass.ApplicationNumber}][{rawValue,3}]: {logEvent.RenderMessage()}";
|
|
||||||
}*/
|
|
||||||
|
|
||||||
var buffer = new StringWriter(new StringBuilder(256));
|
var message = buffer.ToString();
|
||||||
|
|
||||||
_textFormatter.Format(logEvent, buffer);
|
|
||||||
|
|
||||||
var message = buffer.ToString();
|
|
||||||
|
|
||||||
CrestronConsole.PrintLine(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public DebugConsoleSink(ITextFormatter formatProvider )
|
|
||||||
{
|
|
||||||
_textFormatter = formatProvider ?? new JsonFormatter();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
CrestronConsole.PrintLine(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class DebugConsoleSinkExtensions
|
public DebugConsoleSink(ITextFormatter formatProvider )
|
||||||
{
|
{
|
||||||
/// <summary>
|
_textFormatter = formatProvider ?? new JsonFormatter();
|
||||||
/// DebugConsoleSink method
|
|
||||||
/// </summary>
|
|
||||||
public static LoggerConfiguration DebugConsoleSink(
|
|
||||||
this LoggerSinkConfiguration loggerConfiguration,
|
|
||||||
ITextFormatter formatProvider = null)
|
|
||||||
{
|
|
||||||
return loggerConfiguration.Sink(new DebugConsoleSink(formatProvider));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class DebugConsoleSinkExtensions
|
||||||
|
{
|
||||||
|
public static LoggerConfiguration DebugConsoleSink(
|
||||||
|
this LoggerSinkConfiguration loggerConfiguration,
|
||||||
|
ITextFormatter formatProvider = null)
|
||||||
|
{
|
||||||
|
return loggerConfiguration.Sink(new DebugConsoleSink(formatProvider));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,293 +1,283 @@
|
|||||||
using System;
|
extern alias NewtonsoftJson;
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
using Crestron.SimplSharp.CrestronIO;
|
using Crestron.SimplSharp.CrestronIO;
|
||||||
using Newtonsoft.Json;
|
using Formatting = NewtonsoftJson::Newtonsoft.Json.Formatting;
|
||||||
|
using JsonConvert = NewtonsoftJson::Newtonsoft.Json.JsonConvert;
|
||||||
|
|
||||||
|
|
||||||
namespace PepperDash.Core
|
namespace PepperDash.Core;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a debugging context
|
||||||
|
/// </summary>
|
||||||
|
public class DebugContext
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a debugging context
|
/// Describes the folder location where a given program stores it's debug level memory. By default, the
|
||||||
|
/// file written will be named appNdebug where N is 1-10.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class DebugContext
|
public string Key { get; private set; }
|
||||||
|
|
||||||
|
///// <summary>
|
||||||
|
///// The name of the file containing the current debug settings.
|
||||||
|
///// </summary>
|
||||||
|
//string FileName = string.Format(@"\nvram\debug\app{0}Debug.json", InitialParametersClass.ApplicationNumber);
|
||||||
|
|
||||||
|
DebugContextSaveData SaveData;
|
||||||
|
|
||||||
|
int SaveTimeoutMs = 30000;
|
||||||
|
|
||||||
|
CTimer SaveTimer;
|
||||||
|
|
||||||
|
|
||||||
|
static List<DebugContext> Contexts = new List<DebugContext>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates or gets a debug context
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static DebugContext GetDebugContext(string key)
|
||||||
{
|
{
|
||||||
/// <summary>
|
var context = Contexts.FirstOrDefault(c => c.Key.Equals(key, StringComparison.OrdinalIgnoreCase));
|
||||||
/// Describes the folder location where a given program stores it's debug level memory. By default, the
|
if (context == null)
|
||||||
/// file written will be named appNdebug where N is 1-10.
|
|
||||||
/// </summary>
|
|
||||||
public string Key { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The name of the file containing the current debug settings.
|
|
||||||
/// </summary>
|
|
||||||
//string FileName = string.Format(@"\nvram\debug\app{0}Debug.json", InitialParametersClass.ApplicationNumber);
|
|
||||||
|
|
||||||
DebugContextSaveData SaveData;
|
|
||||||
|
|
||||||
int SaveTimeoutMs = 30000;
|
|
||||||
|
|
||||||
CTimer SaveTimer;
|
|
||||||
|
|
||||||
|
|
||||||
static List<DebugContext> Contexts = new List<DebugContext>();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Creates or gets a debug context
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="key"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
/// <summary>
|
|
||||||
/// GetDebugContext method
|
|
||||||
/// </summary>
|
|
||||||
public static DebugContext GetDebugContext(string key)
|
|
||||||
{
|
{
|
||||||
var context = Contexts.FirstOrDefault(c => c.Key.Equals(key, StringComparison.OrdinalIgnoreCase));
|
context = new DebugContext(key);
|
||||||
if (context == null)
|
Contexts.Add(context);
|
||||||
{
|
}
|
||||||
context = new DebugContext(key);
|
return context;
|
||||||
Contexts.Add(context);
|
}
|
||||||
}
|
|
||||||
return context;
|
/// <summary>
|
||||||
|
/// Do not use. For S+ access.
|
||||||
|
/// </summary>
|
||||||
|
public DebugContext() { }
|
||||||
|
|
||||||
|
DebugContext(string key)
|
||||||
|
{
|
||||||
|
Key = key;
|
||||||
|
if (CrestronEnvironment.RuntimeEnvironment == eRuntimeEnvironment.SimplSharpPro)
|
||||||
|
{
|
||||||
|
// Add command to console
|
||||||
|
CrestronConsole.AddNewConsoleCommand(SetDebugFromConsole, "appdebug",
|
||||||
|
"appdebug:P [0-2]: Sets the application's console debug message level",
|
||||||
|
ConsoleAccessLevelEnum.AccessOperator);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
CrestronEnvironment.ProgramStatusEventHandler += CrestronEnvironment_ProgramStatusEventHandler;
|
||||||
/// Do not use. For S+ access.
|
|
||||||
/// </summary>
|
|
||||||
public DebugContext() { }
|
|
||||||
|
|
||||||
DebugContext(string key)
|
LoadMemory();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Used to save memory when shutting down
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="programEventType"></param>
|
||||||
|
void CrestronEnvironment_ProgramStatusEventHandler(eProgramStatusEventType programEventType)
|
||||||
|
{
|
||||||
|
if (programEventType == eProgramStatusEventType.Stopping)
|
||||||
{
|
{
|
||||||
Key = key;
|
if (SaveTimer != null)
|
||||||
if (CrestronEnvironment.RuntimeEnvironment == eRuntimeEnvironment.SimplSharpPro)
|
|
||||||
{
|
{
|
||||||
// Add command to console
|
SaveTimer.Stop();
|
||||||
CrestronConsole.AddNewConsoleCommand(SetDebugFromConsole, "appdebug",
|
SaveTimer = null;
|
||||||
"appdebug:P [0-2]: Sets the application's console debug message level",
|
}
|
||||||
ConsoleAccessLevelEnum.AccessOperator);
|
Console(0, "Saving debug settings");
|
||||||
|
SaveMemory();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Callback for console command
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="levelString"></param>
|
||||||
|
public void SetDebugFromConsole(string levelString)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(levelString.Trim()))
|
||||||
|
{
|
||||||
|
CrestronConsole.ConsoleCommandResponse("AppDebug level = {0}", SaveData.Level);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CrestronEnvironment.ProgramStatusEventHandler += CrestronEnvironment_ProgramStatusEventHandler;
|
SetDebugLevel(Convert.ToInt32(levelString));
|
||||||
|
|
||||||
LoadMemory();
|
|
||||||
}
|
}
|
||||||
|
catch
|
||||||
/// <summary>
|
|
||||||
/// Used to save memory when shutting down
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="programEventType"></param>
|
|
||||||
void CrestronEnvironment_ProgramStatusEventHandler(eProgramStatusEventType programEventType)
|
|
||||||
{
|
{
|
||||||
if (programEventType == eProgramStatusEventType.Stopping)
|
CrestronConsole.PrintLine("Usage: appdebug:P [0-2]");
|
||||||
{
|
|
||||||
if (SaveTimer != null)
|
|
||||||
{
|
|
||||||
SaveTimer.Stop();
|
|
||||||
SaveTimer = null;
|
|
||||||
}
|
|
||||||
Console(0, "Saving debug settings");
|
|
||||||
SaveMemory();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Callback for console command
|
/// Sets the debug level
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="levelString"></param>
|
/// <param name="level"> Valid values 0 (no debug), 1 (critical), 2 (all messages)</param>
|
||||||
/// <summary>
|
public void SetDebugLevel(int level)
|
||||||
/// SetDebugFromConsole method
|
{
|
||||||
/// </summary>
|
if (level <= 2)
|
||||||
public void SetDebugFromConsole(string levelString)
|
|
||||||
{
|
{
|
||||||
try
|
SaveData.Level = level;
|
||||||
{
|
SaveMemoryOnTimeout();
|
||||||
if (string.IsNullOrEmpty(levelString.Trim()))
|
|
||||||
{
|
|
||||||
CrestronConsole.ConsoleCommandResponse("AppDebug level = {0}", SaveData.Level);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
SetDebugLevel(Convert.ToInt32(levelString));
|
CrestronConsole.PrintLine("[Application {0}], Debug level set to {1}",
|
||||||
}
|
InitialParametersClass.ApplicationNumber, SaveData.Level);
|
||||||
catch
|
|
||||||
{
|
|
||||||
CrestronConsole.PrintLine("Usage: appdebug:P [0-2]");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets the debug level
|
/// Prints message to console if current debug level is equal to or higher than the level of this message.
|
||||||
/// </summary>
|
/// Uses CrestronConsole.PrintLine.
|
||||||
/// <param name="level"> Valid values 0 (no debug), 1 (critical), 2 (all messages)</param>
|
/// </summary>
|
||||||
/// <summary>
|
/// <param name="level"></param>
|
||||||
/// SetDebugLevel method
|
/// <param name="format">Console format string</param>
|
||||||
/// </summary>
|
/// <param name="items">Object parameters</param>
|
||||||
public void SetDebugLevel(int level)
|
public void Console(uint level, string format, params object[] items)
|
||||||
|
{
|
||||||
|
if (SaveData.Level >= level)
|
||||||
|
CrestronConsole.PrintLine("App {0}:{1}", InitialParametersClass.ApplicationNumber,
|
||||||
|
string.Format(format, items));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Appends a device Key to the beginning of a message
|
||||||
|
/// </summary>
|
||||||
|
public void Console(uint level, IKeyed dev, string format, params object[] items)
|
||||||
|
{
|
||||||
|
if (SaveData.Level >= level)
|
||||||
|
Console(level, "[{0}] {1}", dev.Key, string.Format(format, items));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="level"></param>
|
||||||
|
/// <param name="dev"></param>
|
||||||
|
/// <param name="errorLogLevel"></param>
|
||||||
|
/// <param name="format"></param>
|
||||||
|
/// <param name="items"></param>
|
||||||
|
public void Console(uint level, IKeyed dev, Debug.ErrorLogLevel errorLogLevel,
|
||||||
|
string format, params object[] items)
|
||||||
|
{
|
||||||
|
if (SaveData.Level >= level)
|
||||||
{
|
{
|
||||||
if (level <= 2)
|
var str = string.Format("[{0}] {1}", dev.Key, string.Format(format, items));
|
||||||
{
|
Console(level, str);
|
||||||
SaveData.Level = level;
|
LogError(errorLogLevel, str);
|
||||||
SaveMemoryOnTimeout();
|
|
||||||
|
|
||||||
CrestronConsole.PrintLine("[Application {0}], Debug level set to {1}",
|
|
||||||
InitialParametersClass.ApplicationNumber, SaveData.Level);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Prints message to console if current debug level is equal to or higher than the level of this message.
|
|
||||||
/// Uses CrestronConsole.PrintLine.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="level"></param>
|
|
||||||
/// <param name="format">Console format string</param>
|
|
||||||
/// <param name="items">Object parameters</param>
|
|
||||||
public void Console(uint level, string format, params object[] items)
|
|
||||||
{
|
|
||||||
if (SaveData.Level >= level)
|
|
||||||
CrestronConsole.PrintLine("App {0}:{1}", InitialParametersClass.ApplicationNumber,
|
|
||||||
string.Format(format, items));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Console method
|
|
||||||
/// </summary>
|
|
||||||
public void Console(uint level, IKeyed dev, string format, params object[] items)
|
|
||||||
{
|
|
||||||
if (SaveData.Level >= level)
|
|
||||||
Console(level, "[{0}] {1}", dev.Key, string.Format(format, items));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="level"></param>
|
|
||||||
/// <param name="dev"></param>
|
|
||||||
/// <param name="errorLogLevel"></param>
|
|
||||||
/// <param name="format"></param>
|
|
||||||
/// <param name="items"></param>
|
|
||||||
public void Console(uint level, IKeyed dev, Debug.ErrorLogLevel errorLogLevel,
|
|
||||||
string format, params object[] items)
|
|
||||||
{
|
|
||||||
if (SaveData.Level >= level)
|
|
||||||
{
|
|
||||||
var str = string.Format("[{0}] {1}", dev.Key, string.Format(format, items));
|
|
||||||
Console(level, str);
|
|
||||||
LogError(errorLogLevel, str);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="level"></param>
|
|
||||||
/// <param name="errorLogLevel"></param>
|
|
||||||
/// <param name="format"></param>
|
|
||||||
/// <param name="items"></param>
|
|
||||||
public void Console(uint level, Debug.ErrorLogLevel errorLogLevel,
|
|
||||||
string format, params object[] items)
|
|
||||||
{
|
|
||||||
if (SaveData.Level >= level)
|
|
||||||
{
|
|
||||||
var str = string.Format(format, items);
|
|
||||||
Console(level, str);
|
|
||||||
LogError(errorLogLevel, str);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="errorLogLevel"></param>
|
|
||||||
/// <param name="str"></param>
|
|
||||||
/// <summary>
|
|
||||||
/// LogError method
|
|
||||||
/// </summary>
|
|
||||||
public void LogError(Debug.ErrorLogLevel errorLogLevel, string str)
|
|
||||||
{
|
|
||||||
string msg = string.Format("App {0}:{1}", InitialParametersClass.ApplicationNumber, str);
|
|
||||||
switch (errorLogLevel)
|
|
||||||
{
|
|
||||||
case Debug.ErrorLogLevel.Error:
|
|
||||||
ErrorLog.Error(msg);
|
|
||||||
break;
|
|
||||||
case Debug.ErrorLogLevel.Warning:
|
|
||||||
ErrorLog.Warn(msg);
|
|
||||||
break;
|
|
||||||
case Debug.ErrorLogLevel.Notice:
|
|
||||||
ErrorLog.Notice(msg);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Writes the memory object after timeout
|
|
||||||
/// </summary>
|
|
||||||
void SaveMemoryOnTimeout()
|
|
||||||
{
|
|
||||||
if (SaveTimer == null)
|
|
||||||
SaveTimer = new CTimer(o =>
|
|
||||||
{
|
|
||||||
SaveTimer = null;
|
|
||||||
SaveMemory();
|
|
||||||
}, SaveTimeoutMs);
|
|
||||||
else
|
|
||||||
SaveTimer.Reset(SaveTimeoutMs);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Writes the memory - use SaveMemoryOnTimeout
|
|
||||||
/// </summary>
|
|
||||||
void SaveMemory()
|
|
||||||
{
|
|
||||||
using (StreamWriter sw = new StreamWriter(GetMemoryFileName()))
|
|
||||||
{
|
|
||||||
var json = JsonConvert.SerializeObject(SaveData);
|
|
||||||
sw.Write(json);
|
|
||||||
sw.Flush();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
void LoadMemory()
|
|
||||||
{
|
|
||||||
var file = GetMemoryFileName();
|
|
||||||
if (File.Exists(file))
|
|
||||||
{
|
|
||||||
using (StreamReader sr = new StreamReader(file))
|
|
||||||
{
|
|
||||||
var data = JsonConvert.DeserializeObject<DebugContextSaveData>(sr.ReadToEnd());
|
|
||||||
if (data != null)
|
|
||||||
{
|
|
||||||
SaveData = data;
|
|
||||||
Debug.Console(1, "Debug memory restored from file");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
SaveData = new DebugContextSaveData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Helper to get the file path for this app's debug memory
|
|
||||||
/// </summary>
|
|
||||||
string GetMemoryFileName()
|
|
||||||
{
|
|
||||||
return string.Format(@"\NVRAM\debugSettings\program{0}-{1}", InitialParametersClass.ApplicationNumber, Key);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class DebugContextSaveData
|
/// <param name="level"></param>
|
||||||
|
/// <param name="errorLogLevel"></param>
|
||||||
|
/// <param name="format"></param>
|
||||||
|
/// <param name="items"></param>
|
||||||
|
public void Console(uint level, Debug.ErrorLogLevel errorLogLevel,
|
||||||
|
string format, params object[] items)
|
||||||
{
|
{
|
||||||
/// <summary>
|
if (SaveData.Level >= level)
|
||||||
///
|
{
|
||||||
/// </summary>
|
var str = string.Format(format, items);
|
||||||
public int Level { get; set; }
|
Console(level, str);
|
||||||
|
LogError(errorLogLevel, str);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="errorLogLevel"></param>
|
||||||
|
/// <param name="str"></param>
|
||||||
|
public void LogError(Debug.ErrorLogLevel errorLogLevel, string str)
|
||||||
|
{
|
||||||
|
string msg = string.Format("App {0}:{1}", InitialParametersClass.ApplicationNumber, str);
|
||||||
|
switch (errorLogLevel)
|
||||||
|
{
|
||||||
|
case Debug.ErrorLogLevel.Error:
|
||||||
|
ErrorLog.Error(msg);
|
||||||
|
break;
|
||||||
|
case Debug.ErrorLogLevel.Warning:
|
||||||
|
ErrorLog.Warn(msg);
|
||||||
|
break;
|
||||||
|
case Debug.ErrorLogLevel.Notice:
|
||||||
|
ErrorLog.Notice(msg);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Writes the memory object after timeout
|
||||||
|
/// </summary>
|
||||||
|
void SaveMemoryOnTimeout()
|
||||||
|
{
|
||||||
|
if (SaveTimer == null)
|
||||||
|
SaveTimer = new CTimer(o =>
|
||||||
|
{
|
||||||
|
SaveTimer = null;
|
||||||
|
SaveMemory();
|
||||||
|
}, SaveTimeoutMs);
|
||||||
|
else
|
||||||
|
SaveTimer.Reset(SaveTimeoutMs);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Writes the memory - use SaveMemoryOnTimeout
|
||||||
|
/// </summary>
|
||||||
|
void SaveMemory()
|
||||||
|
{
|
||||||
|
using (StreamWriter sw = new StreamWriter(GetMemoryFileName()))
|
||||||
|
{
|
||||||
|
var json = JsonConvert.SerializeObject(SaveData);
|
||||||
|
sw.Write(json);
|
||||||
|
sw.Flush();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
void LoadMemory()
|
||||||
|
{
|
||||||
|
var file = GetMemoryFileName();
|
||||||
|
if (File.Exists(file))
|
||||||
|
{
|
||||||
|
using (StreamReader sr = new StreamReader(file))
|
||||||
|
{
|
||||||
|
var data = JsonConvert.DeserializeObject<DebugContextSaveData>(sr.ReadToEnd());
|
||||||
|
if (data != null)
|
||||||
|
{
|
||||||
|
SaveData = data;
|
||||||
|
Debug.Console(1, "Debug memory restored from file");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
SaveData = new DebugContextSaveData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Helper to get the file path for this app's debug memory
|
||||||
|
/// </summary>
|
||||||
|
string GetMemoryFileName()
|
||||||
|
{
|
||||||
|
return string.Format(@"\NVRAM\debugSettings\program{0}-{1}", InitialParametersClass.ApplicationNumber, Key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public class DebugContextSaveData
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public int Level { get; set; }
|
||||||
}
|
}
|
||||||
@@ -3,33 +3,26 @@ using Crestron.SimplSharp.CrestronLogger;
|
|||||||
using Serilog.Core;
|
using Serilog.Core;
|
||||||
using Serilog.Events;
|
using Serilog.Events;
|
||||||
|
|
||||||
namespace PepperDash.Core.Logging
|
namespace PepperDash.Core.Logging;
|
||||||
|
|
||||||
|
public class DebugCrestronLoggerSink : ILogEventSink
|
||||||
{
|
{
|
||||||
/// <summary>
|
public void Emit(LogEvent logEvent)
|
||||||
/// Represents a DebugCrestronLoggerSink
|
|
||||||
/// </summary>
|
|
||||||
public class DebugCrestronLoggerSink : ILogEventSink
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
if (!Debug.IsRunningOnAppliance) return;
|
||||||
/// Emit method
|
|
||||||
/// </summary>
|
string message = $"[{logEvent.Timestamp}][{logEvent.Level}][App {InitialParametersClass.ApplicationNumber}]{logEvent.RenderMessage()}";
|
||||||
public void Emit(LogEvent logEvent)
|
|
||||||
|
if (logEvent.Properties.TryGetValue("Key", out var value) && value is ScalarValue sv && sv.Value is string rawValue)
|
||||||
{
|
{
|
||||||
if (!Debug.IsRunningOnAppliance) return;
|
message = $"[{logEvent.Timestamp}][{logEvent.Level}][App {InitialParametersClass.ApplicationNumber}][{rawValue}]: {logEvent.RenderMessage()}";
|
||||||
|
|
||||||
string message = $"[{logEvent.Timestamp}][{logEvent.Level}][App {InitialParametersClass.ApplicationNumber}]{logEvent.RenderMessage()}";
|
|
||||||
|
|
||||||
if (logEvent.Properties.TryGetValue("Key", out var value) && value is ScalarValue sv && sv.Value is string rawValue)
|
|
||||||
{
|
|
||||||
message = $"[{logEvent.Timestamp}][{logEvent.Level}][App {InitialParametersClass.ApplicationNumber}][{rawValue}]: {logEvent.RenderMessage()}";
|
|
||||||
}
|
|
||||||
|
|
||||||
CrestronLogger.WriteToLog(message, (uint)logEvent.Level);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public DebugCrestronLoggerSink()
|
CrestronLogger.WriteToLog(message, (uint)logEvent.Level);
|
||||||
{
|
}
|
||||||
CrestronLogger.Initialize(1, LoggerModeEnum.RM);
|
|
||||||
}
|
public DebugCrestronLoggerSink()
|
||||||
|
{
|
||||||
|
CrestronLogger.Initialize(1, LoggerModeEnum.RM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,63 +9,56 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace PepperDash.Core.Logging
|
namespace PepperDash.Core.Logging;
|
||||||
|
|
||||||
|
public class DebugErrorLogSink : ILogEventSink
|
||||||
{
|
{
|
||||||
/// <summary>
|
private ITextFormatter _formatter;
|
||||||
/// Represents a DebugErrorLogSink
|
|
||||||
/// </summary>
|
private Dictionary<LogEventLevel, Action<string>> _errorLogMap = new Dictionary<LogEventLevel, Action<string>>
|
||||||
public class DebugErrorLogSink : ILogEventSink
|
|
||||||
{
|
{
|
||||||
private ITextFormatter _formatter;
|
{ LogEventLevel.Verbose, (msg) => ErrorLog.Notice(msg) },
|
||||||
|
{LogEventLevel.Debug, (msg) => ErrorLog.Notice(msg) },
|
||||||
|
{LogEventLevel.Information, (msg) => ErrorLog.Notice(msg) },
|
||||||
|
{LogEventLevel.Warning, (msg) => ErrorLog.Warn(msg) },
|
||||||
|
{LogEventLevel.Error, (msg) => ErrorLog.Error(msg) },
|
||||||
|
{LogEventLevel.Fatal, (msg) => ErrorLog.Error(msg) }
|
||||||
|
};
|
||||||
|
public void Emit(LogEvent logEvent)
|
||||||
|
{
|
||||||
|
string message;
|
||||||
|
|
||||||
private Dictionary<LogEventLevel, Action<string>> _errorLogMap = new Dictionary<LogEventLevel, Action<string>>
|
if (_formatter == null)
|
||||||
{
|
{
|
||||||
{ LogEventLevel.Verbose, (msg) => ErrorLog.Notice(msg) },
|
var programId = CrestronEnvironment.DevicePlatform == eDevicePlatform.Appliance
|
||||||
{LogEventLevel.Debug, (msg) => ErrorLog.Notice(msg) },
|
? $"App {InitialParametersClass.ApplicationNumber}"
|
||||||
{LogEventLevel.Information, (msg) => ErrorLog.Notice(msg) },
|
: $"Room {InitialParametersClass.RoomId}";
|
||||||
{LogEventLevel.Warning, (msg) => ErrorLog.Warn(msg) },
|
|
||||||
{LogEventLevel.Error, (msg) => ErrorLog.Error(msg) },
|
message = $"[{logEvent.Timestamp}][{logEvent.Level}][{programId}]{logEvent.RenderMessage()}";
|
||||||
{LogEventLevel.Fatal, (msg) => ErrorLog.Error(msg) }
|
|
||||||
};
|
if (logEvent.Properties.TryGetValue("Key", out var value) && value is ScalarValue sv && sv.Value is string rawValue)
|
||||||
/// <summary>
|
{
|
||||||
/// Emit method
|
message = $"[{logEvent.Timestamp}][{logEvent.Level}][{programId}][{rawValue}]: {logEvent.RenderMessage()}";
|
||||||
/// </summary>
|
}
|
||||||
public void Emit(LogEvent logEvent)
|
} else
|
||||||
{
|
{
|
||||||
string message;
|
var buffer = new StringWriter(new StringBuilder(256));
|
||||||
|
|
||||||
if (_formatter == null)
|
_formatter.Format(logEvent, buffer);
|
||||||
{
|
|
||||||
var programId = CrestronEnvironment.DevicePlatform == eDevicePlatform.Appliance
|
|
||||||
? $"App {InitialParametersClass.ApplicationNumber}"
|
|
||||||
: $"Room {InitialParametersClass.RoomId}";
|
|
||||||
|
|
||||||
message = $"[{logEvent.Timestamp}][{logEvent.Level}][{programId}]{logEvent.RenderMessage()}";
|
message = buffer.ToString();
|
||||||
|
|
||||||
if (logEvent.Properties.TryGetValue("Key", out var value) && value is ScalarValue sv && sv.Value is string rawValue)
|
|
||||||
{
|
|
||||||
message = $"[{logEvent.Timestamp}][{logEvent.Level}][{programId}][{rawValue}]: {logEvent.RenderMessage()}";
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
var buffer = new StringWriter(new StringBuilder(256));
|
|
||||||
|
|
||||||
_formatter.Format(logEvent, buffer);
|
|
||||||
|
|
||||||
message = buffer.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!_errorLogMap.TryGetValue(logEvent.Level, out var handler))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
handler(message);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public DebugErrorLogSink(ITextFormatter formatter = null)
|
if(!_errorLogMap.TryGetValue(logEvent.Level, out var handler))
|
||||||
{
|
{
|
||||||
_formatter = formatter;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handler(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public DebugErrorLogSink(ITextFormatter formatter = null)
|
||||||
|
{
|
||||||
|
_formatter = formatter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,112 +2,72 @@
|
|||||||
using Serilog.Events;
|
using Serilog.Events;
|
||||||
using Log = PepperDash.Core.Debug;
|
using Log = PepperDash.Core.Debug;
|
||||||
|
|
||||||
namespace PepperDash.Core.Logging
|
namespace PepperDash.Core.Logging;
|
||||||
|
|
||||||
|
public static class DebugExtensions
|
||||||
{
|
{
|
||||||
public static class DebugExtensions
|
public static void LogException(this IKeyed device, Exception ex, string message, params object[] args)
|
||||||
{
|
{
|
||||||
/// <summary>
|
Log.LogMessage(ex, message, device, args);
|
||||||
/// LogException method
|
}
|
||||||
/// </summary>
|
|
||||||
public static void LogException(this IKeyed device, Exception ex, string message, params object[] args)
|
|
||||||
{
|
|
||||||
Log.LogMessage(ex, message, device: device, args);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
public static void LogVerbose(this IKeyed device, Exception ex, string message, params object[] args)
|
||||||
/// LogVerbose method
|
{
|
||||||
/// </summary>
|
Log.LogMessage(LogEventLevel.Verbose, ex, message, device, args);
|
||||||
public static void LogVerbose(this IKeyed device, Exception ex, string message, params object[] args)
|
}
|
||||||
{
|
|
||||||
Log.LogVerbose(ex, device, message, args);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
public static void LogVerbose(this IKeyed device, string message, params object[] args)
|
||||||
/// LogVerbose method
|
{
|
||||||
/// </summary>
|
Log.LogMessage(LogEventLevel.Verbose, device, message, args);
|
||||||
public static void LogVerbose(this IKeyed device, string message, params object[] args)
|
}
|
||||||
{
|
|
||||||
Log.LogVerbose(device, message, args);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
public static void LogDebug(this IKeyed device, Exception ex, string message, params object[] args)
|
||||||
/// LogDebug method
|
{
|
||||||
/// </summary>
|
Log.LogMessage(LogEventLevel.Debug, ex, message, device, args);
|
||||||
public static void LogDebug(this IKeyed device, Exception ex, string message, params object[] args)
|
}
|
||||||
{
|
|
||||||
Log.LogDebug(ex, device, message, args);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
public static void LogDebug(this IKeyed device, string message, params object[] args)
|
||||||
/// LogDebug method
|
{
|
||||||
/// </summary>
|
Log.LogMessage(LogEventLevel.Debug, device, message, args);
|
||||||
public static void LogDebug(this IKeyed device, string message, params object[] args)
|
}
|
||||||
{
|
|
||||||
Log.LogDebug(device, message, args);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
public static void LogInformation(this IKeyed device, Exception ex, string message, params object[] args)
|
||||||
/// LogInformation method
|
{
|
||||||
/// </summary>
|
Log.LogMessage(LogEventLevel.Information, ex, message, device, args);
|
||||||
public static void LogInformation(this IKeyed device, Exception ex, string message, params object[] args)
|
}
|
||||||
{
|
|
||||||
Log.LogInformation(ex, device, message, args);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
public static void LogInformation(this IKeyed device, string message, params object[] args)
|
||||||
/// LogInformation method
|
{
|
||||||
/// </summary>
|
Log.LogMessage(LogEventLevel.Information, device, message, args);
|
||||||
public static void LogInformation(this IKeyed device, string message, params object[] args)
|
}
|
||||||
{
|
|
||||||
Log.LogInformation(device, message, args);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
public static void LogWarning(this IKeyed device, Exception ex, string message, params object[] args)
|
||||||
/// LogWarning method
|
{
|
||||||
/// </summary>
|
Log.LogMessage(LogEventLevel.Warning, ex, message, device, args);
|
||||||
public static void LogWarning(this IKeyed device, Exception ex, string message, params object[] args)
|
}
|
||||||
{
|
|
||||||
Log.LogWarning(ex, device, message, args);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
public static void LogWarning(this IKeyed device, string message, params object[] args)
|
||||||
/// LogWarning method
|
{
|
||||||
/// </summary>
|
Log.LogMessage(LogEventLevel.Warning, device, message, args);
|
||||||
public static void LogWarning(this IKeyed device, string message, params object[] args)
|
}
|
||||||
{
|
|
||||||
Log.LogWarning(device, message, args);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
public static void LogError(this IKeyed device, Exception ex, string message, params object[] args)
|
||||||
/// LogError method
|
{
|
||||||
/// </summary>
|
Log.LogMessage(LogEventLevel.Error, ex, message, device, args);
|
||||||
public static void LogError(this IKeyed device, Exception ex, string message, params object[] args)
|
}
|
||||||
{
|
|
||||||
Log.LogError(ex, device, message, args);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
public static void LogError(this IKeyed device, string message, params object[] args)
|
||||||
/// LogError method
|
{
|
||||||
/// </summary>
|
Log.LogMessage(LogEventLevel.Error, device, message, args);
|
||||||
public static void LogError(this IKeyed device, string message, params object[] args)
|
}
|
||||||
{
|
|
||||||
Log.LogError(device, message, args);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
public static void LogFatal(this IKeyed device, Exception ex, string message, params object[] args)
|
||||||
/// LogFatal method
|
{
|
||||||
/// </summary>
|
Log.LogMessage(LogEventLevel.Fatal, ex, message, device, args);
|
||||||
public static void LogFatal(this IKeyed device, Exception ex, string message, params object[] args)
|
}
|
||||||
{
|
|
||||||
Log.LogFatal(ex, device, message, args);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
public static void LogFatal(this IKeyed device, string message, params object[] args)
|
||||||
/// LogFatal method
|
{
|
||||||
/// </summary>
|
Log.LogMessage(LogEventLevel.Fatal, device, message, args);
|
||||||
public static void LogFatal(this IKeyed device, string message, params object[] args)
|
|
||||||
{
|
|
||||||
Log.LogFatal(device, message, args);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,127 +1,116 @@
|
|||||||
using System.Collections.Generic;
|
extern alias NewtonsoftJson;
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
using Newtonsoft.Json;
|
using JsonProperty = NewtonsoftJson::Newtonsoft.Json.JsonPropertyAttribute;
|
||||||
|
|
||||||
namespace PepperDash.Core.Logging
|
namespace PepperDash.Core.Logging;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Class to persist current Debug settings across program restarts
|
||||||
|
/// </summary>
|
||||||
|
public class DebugContextCollection
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a DebugContextCollection
|
/// To prevent threading issues with the DeviceDebugSettings collection
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class DebugContextCollection
|
private readonly object _deviceDebugSettingsLock = new();
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// To prevent threading issues with the DeviceDebugSettings collection
|
|
||||||
/// </summary>
|
|
||||||
private readonly CCriticalSection _deviceDebugSettingsLock;
|
|
||||||
|
|
||||||
[JsonProperty("items")] private readonly Dictionary<string, DebugContextItem> _items;
|
[JsonProperty("items")]
|
||||||
|
private readonly Dictionary<string, DebugContextItem> _items = new Dictionary<string, DebugContextItem>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Collection of the debug settings for each device where the dictionary key is the device key
|
/// Collection of the debug settings for each device where the dictionary key is the device key
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("deviceDebugSettings")]
|
[JsonProperty("deviceDebugSettings")]
|
||||||
private Dictionary<string, object> DeviceDebugSettings { get; set; }
|
private Dictionary<string, object> DeviceDebugSettings { get; set; } = new Dictionary<string, object>();
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Default constructor
|
/// Default constructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DebugContextCollection()
|
public DebugContextCollection()
|
||||||
{
|
{
|
||||||
_deviceDebugSettingsLock = new CCriticalSection();
|
|
||||||
DeviceDebugSettings = new Dictionary<string, object>();
|
|
||||||
_items = new Dictionary<string, DebugContextItem>();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
}
|
||||||
/// Sets the level of a given context item, and adds that item if it does not
|
|
||||||
/// exist
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="contextKey"></param>
|
|
||||||
/// <param name="level"></param>
|
|
||||||
/// <summary>
|
|
||||||
/// SetLevel method
|
|
||||||
/// </summary>
|
|
||||||
public void SetLevel(string contextKey, int level)
|
|
||||||
{
|
|
||||||
if (level < 0 || level > 2)
|
|
||||||
return;
|
|
||||||
GetOrCreateItem(contextKey).Level = level;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a level or creates it if not existing
|
/// Sets the level of a given context item, and adds that item if it does not
|
||||||
/// </summary>
|
/// exist
|
||||||
/// <param name="contextKey"></param>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <param name="contextKey"></param>
|
||||||
/// <summary>
|
/// <param name="level"></param>
|
||||||
/// GetOrCreateItem method
|
/// <summary>
|
||||||
/// </summary>
|
/// SetLevel method
|
||||||
public DebugContextItem GetOrCreateItem(string contextKey)
|
/// </summary>
|
||||||
{
|
public void SetLevel(string contextKey, int level)
|
||||||
if (!_items.ContainsKey(contextKey))
|
{
|
||||||
_items[contextKey] = new DebugContextItem { Level = 0 };
|
if (level < 0 || level > 2)
|
||||||
return _items[contextKey];
|
return;
|
||||||
}
|
GetOrCreateItem(contextKey).Level = level;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a level or creates it if not existing
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="contextKey"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <summary>
|
||||||
|
/// GetOrCreateItem method
|
||||||
|
/// </summary>
|
||||||
|
public DebugContextItem GetOrCreateItem(string contextKey)
|
||||||
|
{
|
||||||
|
if (!_items.ContainsKey(contextKey))
|
||||||
|
_items[contextKey] = new DebugContextItem { Level = 0 };
|
||||||
|
return _items[contextKey];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// sets the settings for a device or creates a new entry
|
/// sets the settings for a device or creates a new entry
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="deviceKey"></param>
|
/// <param name="deviceKey"></param>
|
||||||
/// <param name="settings"></param>
|
/// <param name="settings"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <summary>
|
public void SetDebugSettingsForKey(string deviceKey, object settings)
|
||||||
/// SetDebugSettingsForKey method
|
{
|
||||||
/// </summary>
|
lock (_deviceDebugSettingsLock)
|
||||||
public void SetDebugSettingsForKey(string deviceKey, object settings)
|
|
||||||
{
|
{
|
||||||
try
|
if (DeviceDebugSettings.ContainsKey(deviceKey))
|
||||||
{
|
{
|
||||||
_deviceDebugSettingsLock.Enter();
|
DeviceDebugSettings[deviceKey] = settings;
|
||||||
|
|
||||||
if (DeviceDebugSettings.ContainsKey(deviceKey))
|
|
||||||
{
|
|
||||||
DeviceDebugSettings[deviceKey] = settings;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
DeviceDebugSettings.Add(deviceKey, settings);
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
_deviceDebugSettingsLock.Leave();
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
DeviceDebugSettings.Add(deviceKey, settings);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the device settings for a device by key or returns null
|
/// Gets the device settings for a device by key or returns null
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="deviceKey"></param>
|
/// <param name="deviceKey"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <summary>
|
public object GetDebugSettingsForKey(string deviceKey)
|
||||||
/// GetDebugSettingsForKey method
|
{
|
||||||
/// </summary>
|
return DeviceDebugSettings[deviceKey];
|
||||||
public object GetDebugSettingsForKey(string deviceKey)
|
}
|
||||||
{
|
}
|
||||||
return DeviceDebugSettings[deviceKey];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Contains information about
|
/// Contains information about
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class DebugContextItem
|
public class DebugContextItem
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The level of debug messages to print
|
/// The level of debug messages to print
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("level")]
|
[JsonProperty("level")]
|
||||||
public int Level { get; set; }
|
public int Level { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Property to tell the program not to intitialize when it boots, if desired
|
/// Property to tell the program not to intitialize when it boots, if desired
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("doNotLoadOnNextBoot")]
|
[JsonProperty("doNotLoadOnNextBoot")]
|
||||||
public bool DoNotLoadOnNextBoot { get; set; }
|
public bool DoNotLoadOnNextBoot { get; set; }
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,292 +1,336 @@
|
|||||||
using System;
|
extern alias NewtonsoftJson;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System;
|
||||||
using System.Text;
|
using Crestron.SimplSharp;
|
||||||
using System.Threading.Tasks;
|
using Org.BouncyCastle.Asn1.X509;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
|
using Serilog.Configuration;
|
||||||
using Serilog.Core;
|
using Serilog.Core;
|
||||||
using Serilog.Events;
|
using Serilog.Events;
|
||||||
using Serilog.Configuration;
|
|
||||||
using WebSocketSharp.Server;
|
|
||||||
using Crestron.SimplSharp;
|
|
||||||
using WebSocketSharp;
|
|
||||||
using System.Security.Authentication;
|
|
||||||
using WebSocketSharp.Net;
|
|
||||||
using X509Certificate2 = System.Security.Cryptography.X509Certificates.X509Certificate2;
|
|
||||||
using System.IO;
|
|
||||||
using Org.BouncyCastle.Asn1.X509;
|
|
||||||
using Serilog.Formatting;
|
using Serilog.Formatting;
|
||||||
using Newtonsoft.Json.Linq;
|
using JObject = NewtonsoftJson::Newtonsoft.Json.Linq.JObject;
|
||||||
using Serilog.Formatting.Json;
|
using Serilog.Formatting.Json;
|
||||||
|
using System.IO;
|
||||||
|
using System.Security.Authentication;
|
||||||
|
using WebSocketSharp;
|
||||||
|
using WebSocketSharp.Server;
|
||||||
|
using X509Certificate2 = System.Security.Cryptography.X509Certificates.X509Certificate2;
|
||||||
|
using WebSocketSharp.Net;
|
||||||
|
|
||||||
namespace PepperDash.Core
|
namespace PepperDash.Core;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Provides a WebSocket-based logging sink for debugging purposes, allowing log events to be broadcast to connected
|
||||||
|
/// WebSocket clients.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>This class implements the <see cref="ILogEventSink"/> interface and is designed to send
|
||||||
|
/// formatted log events to WebSocket clients connected to a secure WebSocket server. The server is hosted locally
|
||||||
|
/// and uses a self-signed certificate for SSL/TLS encryption.</remarks>
|
||||||
|
public class DebugWebsocketSink : ILogEventSink, IKeyed
|
||||||
{
|
{
|
||||||
|
private HttpServer _httpsServer;
|
||||||
|
|
||||||
|
private readonly string _path = "/debug/join/";
|
||||||
|
private const string _certificateName = "selfCres";
|
||||||
|
private const string _certificatePassword = "cres12345";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a DebugWebsocketSink
|
/// Gets the port number on which the HTTPS server is currently running.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class DebugWebsocketSink : ILogEventSink
|
public int Port
|
||||||
|
{ get
|
||||||
|
{
|
||||||
|
|
||||||
|
if(_httpsServer == null) return 0;
|
||||||
|
return _httpsServer.Port;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the WebSocket URL for the current server instance.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>The URL is dynamically constructed based on the server's current IP address, port,
|
||||||
|
/// and WebSocket path.</remarks>
|
||||||
|
public string Url
|
||||||
{
|
{
|
||||||
private HttpServer _httpsServer;
|
get
|
||||||
|
|
||||||
private string _path = "/debug/join/";
|
|
||||||
private const string _certificateName = "selfCres";
|
|
||||||
private const string _certificatePassword = "cres12345";
|
|
||||||
|
|
||||||
public int Port
|
|
||||||
{ get
|
|
||||||
{
|
|
||||||
|
|
||||||
if(_httpsServer == null) return 0;
|
|
||||||
return _httpsServer.Port;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Url
|
|
||||||
{
|
{
|
||||||
get
|
if (_httpsServer == null) return "";
|
||||||
|
return $"wss://{CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_ADDRESS, 0)}:{_httpsServer.Port}{_httpsServer.WebSocketServices[_path].Path}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a value indicating whether the HTTPS server is currently listening for incoming connections.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsRunning { get => _httpsServer?.IsListening ?? false; }
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public string Key => "DebugWebsocketSink";
|
||||||
|
|
||||||
|
private readonly ITextFormatter _textFormatter;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="DebugWebsocketSink"/> class with the specified text formatter.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>This constructor initializes the WebSocket sink and ensures that a certificate is
|
||||||
|
/// available for secure communication. If the required certificate does not exist, it will be created
|
||||||
|
/// automatically. Additionally, the sink is configured to stop the server when the program is
|
||||||
|
/// stopping.</remarks>
|
||||||
|
/// <param name="formatProvider">The text formatter used to format log messages. If null, a default JSON formatter is used.</param>
|
||||||
|
public DebugWebsocketSink(ITextFormatter formatProvider)
|
||||||
|
{
|
||||||
|
|
||||||
|
_textFormatter = formatProvider ?? new JsonFormatter();
|
||||||
|
|
||||||
|
if (!File.Exists($"\\user\\{_certificateName}.pfx"))
|
||||||
|
CreateCert();
|
||||||
|
|
||||||
|
CrestronEnvironment.ProgramStatusEventHandler += type =>
|
||||||
|
{
|
||||||
|
if (type == eProgramStatusEventType.Stopping)
|
||||||
{
|
{
|
||||||
if (_httpsServer == null) return "";
|
StopServer();
|
||||||
return $"wss://{CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_ADDRESS, 0)}:{_httpsServer.Port}{_httpsServer.WebSocketServices[_path].Path}";
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void CreateCert()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var utility = new BouncyCertificate();
|
||||||
|
|
||||||
|
var ipAddress = CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_ADDRESS, 0);
|
||||||
|
var hostName = CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_HOSTNAME, 0);
|
||||||
|
var domainName = CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_DOMAIN_NAME, 0);
|
||||||
|
|
||||||
|
CrestronConsole.PrintLine(string.Format("DomainName: {0} | HostName: {1} | {1}.{0}@{2}", domainName, hostName, ipAddress));
|
||||||
|
|
||||||
|
var certificate = utility.CreateSelfSignedCertificate(string.Format("CN={0}.{1}", hostName, domainName), [string.Format("{0}.{1}", hostName, domainName), ipAddress], [KeyPurposeID.id_kp_serverAuth, KeyPurposeID.id_kp_clientAuth]);
|
||||||
|
|
||||||
|
//Crestron fails to let us do this...perhaps it should be done through their Dll's but haven't tested
|
||||||
|
|
||||||
|
var separator = Path.DirectorySeparatorChar;
|
||||||
|
|
||||||
|
utility.CertificatePassword = _certificatePassword;
|
||||||
|
utility.WriteCertificate(certificate, @$"{separator}user{separator}", _certificateName);
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the IsRunning
|
|
||||||
/// </summary>
|
|
||||||
public bool IsRunning { get => _httpsServer?.IsListening ?? false; }
|
|
||||||
|
|
||||||
|
|
||||||
private readonly ITextFormatter _textFormatter;
|
|
||||||
|
|
||||||
public DebugWebsocketSink(ITextFormatter formatProvider)
|
|
||||||
{
|
{
|
||||||
|
//Debug.Console(0, "WSS CreateCert Failed\r\n{0}\r\n{1}", ex.Message, ex.StackTrace);
|
||||||
|
CrestronConsole.PrintLine("WSS CreateCert Failed\r\n{0}\r\n{1}", ex.Message, ex.StackTrace);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_textFormatter = formatProvider ?? new JsonFormatter();
|
/// <summary>
|
||||||
|
/// Sends a log event to all connected WebSocket clients.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>The log event is formatted using the configured text formatter and then broadcasted
|
||||||
|
/// to all clients connected to the WebSocket server. If the WebSocket server is not initialized or not
|
||||||
|
/// listening, the method exits without performing any action.</remarks>
|
||||||
|
/// <param name="logEvent">The log event to be formatted and broadcasted. Cannot be null.</param>
|
||||||
|
public void Emit(LogEvent logEvent)
|
||||||
|
{
|
||||||
|
if (_httpsServer == null || !_httpsServer.IsListening) return;
|
||||||
|
|
||||||
if (!File.Exists($"\\user\\{_certificateName}.pfx"))
|
var sw = new StringWriter();
|
||||||
CreateCert(null);
|
_textFormatter.Format(logEvent, sw);
|
||||||
|
|
||||||
CrestronEnvironment.ProgramStatusEventHandler += type =>
|
_httpsServer.WebSocketServices[_path].Sessions.Broadcast(sw.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Starts the WebSocket server on the specified port and configures it with the appropriate certificate.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>This method initializes the WebSocket server and binds it to the specified port. It
|
||||||
|
/// also applies the server's certificate for secure communication. Ensure that the port is not already in use
|
||||||
|
/// and that the certificate file is accessible.</remarks>
|
||||||
|
/// <param name="port">The port number on which the WebSocket server will listen. Must be a valid, non-negative port number.</param>
|
||||||
|
public void StartServerAndSetPort(int port)
|
||||||
|
{
|
||||||
|
Debug.Console(0, "Starting Websocket Server on port: {0}", port);
|
||||||
|
|
||||||
|
|
||||||
|
Start(port, $"\\user\\{_certificateName}.pfx", _certificatePassword);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Start(int port, string certPath = "", string certPassword = "")
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_httpsServer = new HttpServer(port, true);
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(certPath))
|
||||||
{
|
{
|
||||||
if (type == eProgramStatusEventType.Stopping)
|
Debug.Console(0, "Assigning SSL Configuration");
|
||||||
{
|
|
||||||
StopServer();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CreateCert(string[] args)
|
_httpsServer.SslConfiguration.ServerCertificate = new X509Certificate2(certPath, certPassword);
|
||||||
{
|
_httpsServer.SslConfiguration.ClientCertificateRequired = false;
|
||||||
try
|
_httpsServer.SslConfiguration.CheckCertificateRevocation = false;
|
||||||
{
|
_httpsServer.SslConfiguration.EnabledSslProtocols = SslProtocols.Tls12;
|
||||||
//Debug.Console(0,"CreateCert Creating Utility");
|
//this is just to test, you might want to actually validate
|
||||||
CrestronConsole.PrintLine("CreateCert Creating Utility");
|
_httpsServer.SslConfiguration.ClientCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) =>
|
||||||
//var utility = new CertificateUtility();
|
|
||||||
var utility = new BouncyCertificate();
|
|
||||||
//Debug.Console(0, "CreateCert Calling CreateCert");
|
|
||||||
CrestronConsole.PrintLine("CreateCert Calling CreateCert");
|
|
||||||
//utility.CreateCert();
|
|
||||||
var ipAddress = CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_ADDRESS, 0);
|
|
||||||
var hostName = CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_HOSTNAME, 0);
|
|
||||||
var domainName = CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_DOMAIN_NAME, 0);
|
|
||||||
|
|
||||||
//Debug.Console(0, "DomainName: {0} | HostName: {1} | {1}.{0}@{2}", domainName, hostName, ipAddress);
|
|
||||||
CrestronConsole.PrintLine(string.Format("DomainName: {0} | HostName: {1} | {1}.{0}@{2}", domainName, hostName, ipAddress));
|
|
||||||
|
|
||||||
var certificate = utility.CreateSelfSignedCertificate(string.Format("CN={0}.{1}", hostName, domainName), new[] { string.Format("{0}.{1}", hostName, domainName), ipAddress }, new[] { KeyPurposeID.id_kp_serverAuth, KeyPurposeID.id_kp_clientAuth });
|
|
||||||
//Crestron fails to let us do this...perhaps it should be done through their Dll's but haven't tested
|
|
||||||
//Debug.Print($"CreateCert Storing Certificate To My.LocalMachine");
|
|
||||||
//utility.AddCertToStore(certificate, StoreName.My, StoreLocation.LocalMachine);
|
|
||||||
//Debug.Console(0, "CreateCert Saving Cert to \\user\\");
|
|
||||||
CrestronConsole.PrintLine("CreateCert Saving Cert to \\user\\");
|
|
||||||
utility.CertificatePassword = _certificatePassword;
|
|
||||||
utility.WriteCertificate(certificate, @"\user\", _certificateName);
|
|
||||||
//Debug.Console(0, "CreateCert Ending CreateCert");
|
|
||||||
CrestronConsole.PrintLine("CreateCert Ending CreateCert");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
//Debug.Console(0, "WSS CreateCert Failed\r\n{0}\r\n{1}", ex.Message, ex.StackTrace);
|
|
||||||
CrestronConsole.PrintLine(string.Format("WSS CreateCert Failed\r\n{0}\r\n{1}", ex.Message, ex.StackTrace));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Emit method
|
|
||||||
/// </summary>
|
|
||||||
public void Emit(LogEvent logEvent)
|
|
||||||
{
|
|
||||||
if (_httpsServer == null || !_httpsServer.IsListening) return;
|
|
||||||
|
|
||||||
var sw = new StringWriter();
|
|
||||||
_textFormatter.Format(logEvent, sw);
|
|
||||||
|
|
||||||
_httpsServer.WebSocketServices.Broadcast(sw.ToString());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// StartServerAndSetPort method
|
|
||||||
/// </summary>
|
|
||||||
public void StartServerAndSetPort(int port)
|
|
||||||
{
|
|
||||||
Debug.Console(0, "Starting Websocket Server on port: {0}", port);
|
|
||||||
|
|
||||||
|
|
||||||
Start(port, $"\\user\\{_certificateName}.pfx", _certificatePassword);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Start(int port, string certPath = "", string certPassword = "")
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_httpsServer = new HttpServer(port, true);
|
|
||||||
|
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(certPath))
|
|
||||||
{
|
|
||||||
Debug.Console(0, "Assigning SSL Configuration");
|
|
||||||
_httpsServer.SslConfiguration = new ServerSslConfiguration(new X509Certificate2(certPath, certPassword))
|
|
||||||
{
|
{
|
||||||
ClientCertificateRequired = false,
|
Debug.Console(0, "HTTPS ClientCerticateValidation Callback triggered");
|
||||||
CheckCertificateRevocation = false,
|
return true;
|
||||||
EnabledSslProtocols = SslProtocols.Tls12 | SslProtocols.Tls11 | SslProtocols.Tls,
|
|
||||||
//this is just to test, you might want to actually validate
|
|
||||||
ClientCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) =>
|
|
||||||
{
|
|
||||||
Debug.Console(0, "HTTPS ClientCerticateValidation Callback triggered");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
|
||||||
Debug.Console(0, "Adding Debug Client Service");
|
|
||||||
_httpsServer.AddWebSocketService<DebugClient>(_path);
|
|
||||||
Debug.Console(0, "Assigning Log Info");
|
|
||||||
_httpsServer.Log.Level = LogLevel.Trace;
|
|
||||||
_httpsServer.Log.Output = (d, s) =>
|
|
||||||
{
|
|
||||||
uint level;
|
|
||||||
|
|
||||||
switch(d.Level)
|
|
||||||
{
|
|
||||||
case WebSocketSharp.LogLevel.Fatal:
|
|
||||||
level = 3;
|
|
||||||
break;
|
|
||||||
case WebSocketSharp.LogLevel.Error:
|
|
||||||
level = 2;
|
|
||||||
break;
|
|
||||||
case WebSocketSharp.LogLevel.Warn:
|
|
||||||
level = 1;
|
|
||||||
break;
|
|
||||||
case WebSocketSharp.LogLevel.Info:
|
|
||||||
level = 0;
|
|
||||||
break;
|
|
||||||
case WebSocketSharp.LogLevel.Debug:
|
|
||||||
level = 4;
|
|
||||||
break;
|
|
||||||
case WebSocketSharp.LogLevel.Trace:
|
|
||||||
level = 5;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
level = 4;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
Debug.Console(level, "{1} {0}\rCaller:{2}\rMessage:{3}\rs:{4}", d.Level.ToString(), d.Date.ToString(), d.Caller.ToString(), d.Message, s);
|
|
||||||
};
|
|
||||||
Debug.Console(0, "Starting");
|
|
||||||
|
|
||||||
_httpsServer.Start();
|
|
||||||
Debug.Console(0, "Ready");
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
Debug.Console(0, "Adding Debug Client Service");
|
||||||
|
_httpsServer.AddWebSocketService<DebugClient>(_path);
|
||||||
|
Debug.Console(0, "Assigning Log Info");
|
||||||
|
_httpsServer.Log.Level = LogLevel.Trace;
|
||||||
|
_httpsServer.Log.Output = (d, s) =>
|
||||||
{
|
{
|
||||||
Debug.Console(0, "WebSocket Failed to start {0}", ex.Message);
|
uint level;
|
||||||
}
|
|
||||||
|
switch(d.Level)
|
||||||
|
{
|
||||||
|
case WebSocketSharp.LogLevel.Fatal:
|
||||||
|
level = 3;
|
||||||
|
break;
|
||||||
|
case WebSocketSharp.LogLevel.Error:
|
||||||
|
level = 2;
|
||||||
|
break;
|
||||||
|
case WebSocketSharp.LogLevel.Warn:
|
||||||
|
level = 1;
|
||||||
|
break;
|
||||||
|
case WebSocketSharp.LogLevel.Info:
|
||||||
|
level = 0;
|
||||||
|
break;
|
||||||
|
case WebSocketSharp.LogLevel.Debug:
|
||||||
|
level = 4;
|
||||||
|
break;
|
||||||
|
case WebSocketSharp.LogLevel.Trace:
|
||||||
|
level = 5;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
level = 4;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug.Console(level, "{1} {0}\rCaller:{2}\rMessage:{3}\rs:{4}", d.Level.ToString(), d.Date.ToString(), d.Caller.ToString(), d.Message, s);
|
||||||
|
};
|
||||||
|
Debug.Console(0, "Starting");
|
||||||
|
|
||||||
|
_httpsServer.Start();
|
||||||
|
Debug.Console(0, "Ready");
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
/// <summary>
|
|
||||||
/// StopServer method
|
|
||||||
/// </summary>
|
|
||||||
public void StopServer()
|
|
||||||
{
|
{
|
||||||
Debug.Console(0, "Stopping Websocket Server");
|
Debug.Console(0, "WebSocket Failed to start {0}", ex.Message);
|
||||||
_httpsServer?.Stop();
|
|
||||||
|
|
||||||
_httpsServer = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class DebugWebsocketSinkExtensions
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// DebugWebsocketSink method
|
|
||||||
/// </summary>
|
|
||||||
public static LoggerConfiguration DebugWebsocketSink(
|
|
||||||
this LoggerSinkConfiguration loggerConfiguration,
|
|
||||||
ITextFormatter formatProvider = null)
|
|
||||||
{
|
|
||||||
return loggerConfiguration.Sink(new DebugWebsocketSink(formatProvider));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a DebugClient
|
/// Stops the WebSocket server if it is currently running.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class DebugClient : WebSocketBehavior
|
/// <remarks>This method halts the WebSocket server and releases any associated resources. After
|
||||||
|
/// calling this method, the server will no longer accept or process incoming connections.</remarks>
|
||||||
|
public void StopServer()
|
||||||
{
|
{
|
||||||
private DateTime _connectionTime;
|
Debug.Console(0, "Stopping Websocket Server");
|
||||||
|
_httpsServer?.Stop();
|
||||||
|
|
||||||
public TimeSpan ConnectedDuration
|
_httpsServer = null;
|
||||||
{
|
}
|
||||||
get
|
}
|
||||||
{
|
|
||||||
if (Context.WebSocket.IsAlive)
|
/// <summary>
|
||||||
{
|
/// Configures the logger to write log events to a debug WebSocket sink.
|
||||||
return DateTime.Now - _connectionTime;
|
/// </summary>
|
||||||
}
|
/// <remarks>This extension method allows you to direct log events to a WebSocket sink for debugging
|
||||||
else
|
/// purposes.</remarks>
|
||||||
{
|
public static class DebugWebsocketSinkExtensions
|
||||||
return new TimeSpan(0);
|
{
|
||||||
}
|
/// <summary>
|
||||||
}
|
/// Configures a logger to write log events to a debug WebSocket sink.
|
||||||
}
|
/// </summary>
|
||||||
|
/// <remarks>This method adds a sink that writes log events to a WebSocket for debugging purposes.
|
||||||
public DebugClient()
|
/// It is typically used during development to stream log events in real-time.</remarks>
|
||||||
{
|
/// <param name="loggerConfiguration">The logger sink configuration to apply the WebSocket sink to.</param>
|
||||||
Debug.Console(0, "DebugClient Created");
|
/// <param name="formatProvider">An optional text formatter to format the log events. If not provided, a default formatter will be used.</param>
|
||||||
}
|
/// <returns>A <see cref="LoggerConfiguration"/> object that can be used to further configure the logger.</returns>
|
||||||
|
public static LoggerConfiguration DebugWebsocketSink(
|
||||||
protected override void OnOpen()
|
this LoggerSinkConfiguration loggerConfiguration,
|
||||||
{
|
ITextFormatter formatProvider = null)
|
||||||
base.OnOpen();
|
{
|
||||||
|
return loggerConfiguration.Sink(new DebugWebsocketSink(formatProvider));
|
||||||
var url = Context.WebSocket.Url;
|
}
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "New WebSocket Connection from: {0}", url);
|
}
|
||||||
|
|
||||||
_connectionTime = DateTime.Now;
|
/// <summary>
|
||||||
}
|
/// Represents a WebSocket client for debugging purposes, providing connection lifecycle management and message
|
||||||
|
/// handling functionality.
|
||||||
protected override void OnMessage(MessageEventArgs e)
|
/// </summary>
|
||||||
{
|
/// <remarks>The <see cref="DebugClient"/> class extends <see cref="WebSocketBehavior"/> to handle
|
||||||
base.OnMessage(e);
|
/// WebSocket connections, including events for opening, closing, receiving messages, and errors. It tracks the
|
||||||
|
/// duration of the connection and logs relevant events for debugging.</remarks>
|
||||||
Debug.Console(0, "WebSocket UiClient Message: {0}", e.Data);
|
public class DebugClient : WebSocketBehavior
|
||||||
}
|
{
|
||||||
|
private DateTime _connectionTime;
|
||||||
protected override void OnClose(CloseEventArgs e)
|
|
||||||
{
|
/// <summary>
|
||||||
base.OnClose(e);
|
/// Gets the duration of time the WebSocket connection has been active.
|
||||||
|
/// </summary>
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "WebSocket UiClient Closing: {0} reason: {1}", e.Code, e.Reason);
|
public TimeSpan ConnectedDuration
|
||||||
|
{
|
||||||
}
|
get
|
||||||
|
{
|
||||||
protected override void OnError(WebSocketSharp.ErrorEventArgs e)
|
if (Context.WebSocket.IsAlive)
|
||||||
{
|
{
|
||||||
base.OnError(e);
|
return DateTime.Now - _connectionTime;
|
||||||
|
}
|
||||||
Debug.Console(2, Debug.ErrorLogLevel.Notice, "WebSocket UiClient Error: {0} message: {1}", e.Exception, e.Message);
|
else
|
||||||
}
|
{
|
||||||
|
return new TimeSpan(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="DebugClient"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>This constructor creates a new <see cref="DebugClient"/> instance and logs its
|
||||||
|
/// creation using the <see cref="Debug.Console(int, string)"/> method with a debug level of 0.</remarks>
|
||||||
|
public DebugClient()
|
||||||
|
{
|
||||||
|
Debug.Console(0, "DebugClient Created");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
|
protected override void OnOpen()
|
||||||
|
{
|
||||||
|
base.OnOpen();
|
||||||
|
|
||||||
|
var url = Context.WebSocket.Url;
|
||||||
|
Debug.Console(0, Debug.ErrorLogLevel.Notice, "New WebSocket Connection from: {0}", url);
|
||||||
|
|
||||||
|
_connectionTime = DateTime.Now;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
|
protected override void OnMessage(MessageEventArgs e)
|
||||||
|
{
|
||||||
|
base.OnMessage(e);
|
||||||
|
|
||||||
|
Debug.Console(0, "WebSocket UiClient Message: {0}", e.Data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
|
protected override void OnClose(CloseEventArgs e)
|
||||||
|
{
|
||||||
|
base.OnClose(e);
|
||||||
|
|
||||||
|
Debug.Console(0, Debug.ErrorLogLevel.Notice, "WebSocket UiClient Closing: {0} reason: {1}", e.Code, e.Reason);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
|
protected override void OnError(WebSocketSharp.ErrorEventArgs e)
|
||||||
|
{
|
||||||
|
base.OnError(e);
|
||||||
|
|
||||||
|
Debug.Console(2, Debug.ErrorLogLevel.Notice, "WebSocket UiClient Error: {0} message: {1}", e.Exception, e.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,19 +4,17 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
|
|
||||||
namespace PepperDash.Core
|
namespace PepperDash.Core;
|
||||||
{
|
|
||||||
|
/// <summary>
|
||||||
|
/// Not in use
|
||||||
|
/// </summary>
|
||||||
|
public static class NetworkComm
|
||||||
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Not in use
|
/// Not in use
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static class NetworkComm
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Not in use
|
|
||||||
/// </summary>
|
|
||||||
static NetworkComm()
|
static NetworkComm()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
@@ -4,8 +4,8 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
|
|
||||||
namespace PepperDash.Core.PasswordManagement
|
namespace PepperDash.Core.PasswordManagement;
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// JSON password configuration
|
/// JSON password configuration
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -22,5 +22,4 @@ namespace PepperDash.Core.PasswordManagement
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -4,8 +4,8 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
|
|
||||||
namespace PepperDash.Core.PasswordManagement
|
namespace PepperDash.Core.PasswordManagement;
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constants
|
/// Constants
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -53,5 +53,4 @@ namespace PepperDash.Core.PasswordManagement
|
|||||||
/// Generic string value change constant
|
/// Generic string value change constant
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const ushort StringValueChange = 201;
|
public const ushort StringValueChange = 201;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace PepperDash.Core.PasswordManagement
|
namespace PepperDash.Core.PasswordManagement;
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a PasswordClient
|
/// A class to allow user interaction with the PasswordManager
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class PasswordClient
|
public class PasswordClient
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -192,5 +192,4 @@ namespace PepperDash.Core.PasswordManagement
|
|||||||
GetPasswordByIndex(args.Index);
|
GetPasswordByIndex(args.Index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -2,11 +2,11 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
|
|
||||||
namespace PepperDash.Core.PasswordManagement
|
namespace PepperDash.Core.PasswordManagement;
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a PasswordManager
|
/// Allows passwords to be stored and managed
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class PasswordManager
|
public class PasswordManager
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -196,7 +196,7 @@ namespace PepperDash.Core.PasswordManagement
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Protected ushort change event handler
|
/// Protected ushort change event handler
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="value"></param>
|
/// <param name="value"></param>
|
||||||
/// <param name="index"></param>
|
/// <param name="index"></param>
|
||||||
/// <param name="type"></param>
|
/// <param name="type"></param>
|
||||||
protected void OnUshrtChange(ushort value, ushort index, ushort type)
|
protected void OnUshrtChange(ushort value, ushort index, ushort type)
|
||||||
@@ -243,5 +243,4 @@ namespace PepperDash.Core.PasswordManagement
|
|||||||
PasswordChange(this, args);
|
PasswordChange(this, args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<RootNamespace>PepperDash.Core</RootNamespace>
|
<RootNamespace>PepperDash.Core</RootNamespace>
|
||||||
<AssemblyName>PepperDashCore</AssemblyName>
|
<AssemblyName>PepperDashCore</AssemblyName>
|
||||||
<TargetFramework>net472</TargetFramework>
|
<TargetFramework>net8</TargetFramework>
|
||||||
<Deterministic>true</Deterministic>
|
<Deterministic>true</Deterministic>
|
||||||
<NeutralLanguage>en</NeutralLanguage>
|
<NeutralLanguage>en</NeutralLanguage>
|
||||||
<OutputPath>bin\$(Configuration)\</OutputPath>
|
<OutputPath>bin\$(Configuration)\</OutputPath>
|
||||||
@@ -35,25 +35,20 @@
|
|||||||
<EmbeddedResource Remove="Properties\**" />
|
<EmbeddedResource Remove="Properties\**" />
|
||||||
<None Remove="lib\**" />
|
<None Remove="lib\**" />
|
||||||
<None Remove="Properties\**" />
|
<None Remove="Properties\**" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
<PackageReference Include="BouncyCastle.Cryptography" Version="2.6.1" />
|
||||||
<Reference Include="Microsoft.CSharp" />
|
<PackageReference Include="Crestron.SimplSharp.SDK.Library" Version="2.21.128" />
|
||||||
<Reference Include="System.Net.Http" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.4">
|
||||||
</ItemGroup>
|
<Aliases>global,NewtonsoftJson</Aliases>
|
||||||
<ItemGroup>
|
</PackageReference>
|
||||||
<PackageReference Include="BouncyCastle.Cryptography" Version="2.4.0" />
|
<PackageReference Include="Serilog" Version="4.3.0" />
|
||||||
<PackageReference Include="Crestron.SimplSharp.SDK.Library" Version="2.21.90" />
|
<PackageReference Include="Serilog.Expressions" Version="5.0.0" />
|
||||||
<PackageReference Include="Serilog" Version="3.1.1" />
|
<PackageReference Include="Serilog.Formatting.Compact" Version="3.0.0" />
|
||||||
<PackageReference Include="Serilog.Expressions" Version="4.0.0" />
|
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
|
||||||
<PackageReference Include="Serilog.Formatting.Compact" Version="2.0.0" />
|
<PackageReference Include="Serilog.Sinks.File" Version="7.0.0" />
|
||||||
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.1" />
|
<PackageReference Include="SSH.NET" Version="2025.0.0" />
|
||||||
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
<PackageReference Include="WebSocketSharp-netstandard" Version="1.0.1" />
|
||||||
<PackageReference Include="SSH.NET" Version="2024.2.0" />
|
|
||||||
<PackageReference Include="WebSocketSharp" Version="1.0.3-rc11" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup Condition="'$(TargetFramework)' == 'net6'">
|
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Remove="Comm\._GenericSshClient.cs" />
|
<Compile Remove="Comm\._GenericSshClient.cs" />
|
||||||
|
|||||||
@@ -4,68 +4,68 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
|
|
||||||
namespace PepperDash.Core.SystemInfo
|
namespace PepperDash.Core.SystemInfo;
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constants
|
/// Constants
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SystemInfoConstants
|
public class SystemInfoConstants
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const ushort BoolValueChange = 1;
|
public const ushort BoolValueChange = 1;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const ushort CompleteBoolChange = 2;
|
public const ushort CompleteBoolChange = 2;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const ushort BusyBoolChange = 3;
|
public const ushort BusyBoolChange = 3;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const ushort UshortValueChange = 101;
|
public const ushort UshortValueChange = 101;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const ushort StringValueChange = 201;
|
public const ushort StringValueChange = 201;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const ushort ConsoleResponseChange = 202;
|
public const ushort ConsoleResponseChange = 202;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const ushort ProcessorUptimeChange = 203;
|
public const ushort ProcessorUptimeChange = 203;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const ushort ProgramUptimeChange = 204;
|
public const ushort ProgramUptimeChange = 204;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const ushort ObjectChange = 301;
|
public const ushort ObjectChange = 301;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const ushort ProcessorConfigChange = 302;
|
public const ushort ProcessorConfigChange = 302;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const ushort EthernetConfigChange = 303;
|
public const ushort EthernetConfigChange = 303;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const ushort ControlSubnetConfigChange = 304;
|
public const ushort ControlSubnetConfigChange = 304;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const ushort ProgramConfigChange = 305;
|
public const ushort ProgramConfigChange = 305;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -73,18 +73,18 @@ namespace PepperDash.Core.SystemInfo
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class ProcessorChangeEventArgs : EventArgs
|
public class ProcessorChangeEventArgs : EventArgs
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ProcessorInfo Processor { get; set; }
|
public ProcessorInfo Processor { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ushort Type { get; set; }
|
public ushort Type { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ushort Index { get; set; }
|
public ushort Index { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructor
|
/// Constructor
|
||||||
@@ -119,18 +119,18 @@ namespace PepperDash.Core.SystemInfo
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class EthernetChangeEventArgs : EventArgs
|
public class EthernetChangeEventArgs : EventArgs
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public EthernetInfo Adapter { get; set; }
|
public EthernetInfo Adapter { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ushort Type { get; set; }
|
public ushort Type { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ushort Index { get; set; }
|
public ushort Index { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructor
|
/// Constructor
|
||||||
@@ -143,7 +143,7 @@ namespace PepperDash.Core.SystemInfo
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructor overload
|
/// Constructor overload
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ethernet"></param>
|
/// <param name="ethernet"></param>
|
||||||
/// <param name="type"></param>
|
/// <param name="type"></param>
|
||||||
public EthernetChangeEventArgs(EthernetInfo ethernet, ushort type)
|
public EthernetChangeEventArgs(EthernetInfo ethernet, ushort type)
|
||||||
{
|
{
|
||||||
@@ -154,9 +154,9 @@ namespace PepperDash.Core.SystemInfo
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructor overload
|
/// Constructor overload
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ethernet"></param>
|
/// <param name="ethernet"></param>
|
||||||
/// <param name="type"></param>
|
/// <param name="type"></param>
|
||||||
/// <param name="index"></param>
|
/// <param name="index"></param>
|
||||||
public EthernetChangeEventArgs(EthernetInfo ethernet, ushort type, ushort index)
|
public EthernetChangeEventArgs(EthernetInfo ethernet, ushort type, ushort index)
|
||||||
{
|
{
|
||||||
Adapter = ethernet;
|
Adapter = ethernet;
|
||||||
@@ -170,18 +170,18 @@ namespace PepperDash.Core.SystemInfo
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class ControlSubnetChangeEventArgs : EventArgs
|
public class ControlSubnetChangeEventArgs : EventArgs
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ControlSubnetInfo Adapter { get; set; }
|
public ControlSubnetInfo Adapter { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ushort Type { get; set; }
|
public ushort Type { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ushort Index { get; set; }
|
public ushort Index { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructor
|
/// Constructor
|
||||||
@@ -216,18 +216,18 @@ namespace PepperDash.Core.SystemInfo
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class ProgramChangeEventArgs : EventArgs
|
public class ProgramChangeEventArgs : EventArgs
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ProgramInfo Program { get; set; }
|
public ProgramInfo Program { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ushort Type { get; set; }
|
public ushort Type { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ushort Index { get; set; }
|
public ushort Index { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructor
|
/// Constructor
|
||||||
@@ -240,7 +240,7 @@ namespace PepperDash.Core.SystemInfo
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructor overload
|
/// Constructor overload
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="program"></param>
|
/// <param name="program"></param>
|
||||||
/// <param name="type"></param>
|
/// <param name="type"></param>
|
||||||
public ProgramChangeEventArgs(ProgramInfo program, ushort type)
|
public ProgramChangeEventArgs(ProgramInfo program, ushort type)
|
||||||
{
|
{
|
||||||
@@ -251,14 +251,13 @@ namespace PepperDash.Core.SystemInfo
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructor overload
|
/// Constructor overload
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="program"></param>
|
/// <param name="program"></param>
|
||||||
/// <param name="type"></param>
|
/// <param name="type"></param>
|
||||||
/// <param name="index"></param>
|
/// <param name="index"></param>
|
||||||
public ProgramChangeEventArgs(ProgramInfo program, ushort type, ushort index)
|
public ProgramChangeEventArgs(ProgramInfo program, ushort type, ushort index)
|
||||||
{
|
{
|
||||||
Program = program;
|
Program = program;
|
||||||
Type = type;
|
Type = type;
|
||||||
Index = index;
|
Index = index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -4,52 +4,52 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
|
|
||||||
namespace PepperDash.Core.SystemInfo
|
namespace PepperDash.Core.SystemInfo;
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Processor info class
|
/// Processor info class
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class ProcessorInfo
|
public class ProcessorInfo
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Model { get; set; }
|
public string Model { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string SerialNumber { get; set; }
|
public string SerialNumber { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Firmware { get; set; }
|
public string Firmware { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string FirmwareDate { get; set; }
|
public string FirmwareDate { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string OsVersion { get; set; }
|
public string OsVersion { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string RuntimeEnvironment { get; set; }
|
public string RuntimeEnvironment { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string DevicePlatform { get; set; }
|
public string DevicePlatform { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ModuleDirectory { get; set; }
|
public string ModuleDirectory { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string LocalTimeZone { get; set; }
|
public string LocalTimeZone { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ProgramIdTag { get; set; }
|
public string ProgramIdTag { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -66,45 +66,45 @@ namespace PepperDash.Core.SystemInfo
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class EthernetInfo
|
public class EthernetInfo
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ushort DhcpIsOn { get; set; }
|
public ushort DhcpIsOn { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Hostname { get; set; }
|
public string Hostname { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string MacAddress { get; set; }
|
public string MacAddress { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string IpAddress { get; set; }
|
public string IpAddress { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Subnet { get; set; }
|
public string Subnet { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Gateway { get; set; }
|
public string Gateway { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Dns1 { get; set; }
|
public string Dns1 { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Dns2 { get; set; }
|
public string Dns2 { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Dns3 { get; set; }
|
public string Dns3 { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Domain { get; set; }
|
public string Domain { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -121,29 +121,29 @@ namespace PepperDash.Core.SystemInfo
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class ControlSubnetInfo
|
public class ControlSubnetInfo
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ushort Enabled { get; set; }
|
public ushort Enabled { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ushort IsInAutomaticMode { get; set; }
|
public ushort IsInAutomaticMode { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string MacAddress { get; set; }
|
public string MacAddress { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string IpAddress { get; set; }
|
public string IpAddress { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Subnet { get; set; }
|
public string Subnet { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string RouterPrefix { get; set; }
|
public string RouterPrefix { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -160,37 +160,37 @@ namespace PepperDash.Core.SystemInfo
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class ProgramInfo
|
public class ProgramInfo
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Header { get; set; }
|
public string Header { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string System { get; set; }
|
public string System { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ProgramIdTag { get; set; }
|
public string ProgramIdTag { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string CompileTime { get; set; }
|
public string CompileTime { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Database { get; set; }
|
public string Database { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Environment { get; set; }
|
public string Environment { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Programmer { get; set; }
|
public string Programmer { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -200,5 +200,4 @@ namespace PepperDash.Core.SystemInfo
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -4,37 +4,37 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
|
|
||||||
namespace PepperDash.Core.SystemInfo
|
namespace PepperDash.Core.SystemInfo;
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// System Info class
|
/// System Info class
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SystemInfoToSimpl
|
public class SystemInfoToSimpl
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Notifies of bool change
|
/// Notifies of bool change
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event EventHandler<BoolChangeEventArgs> BoolChange;
|
public event EventHandler<BoolChangeEventArgs> BoolChange;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Notifies of string change
|
/// Notifies of string change
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event EventHandler<StringChangeEventArgs> StringChange;
|
public event EventHandler<StringChangeEventArgs> StringChange;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Notifies of processor change
|
/// Notifies of processor change
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event EventHandler<ProcessorChangeEventArgs> ProcessorChange;
|
public event EventHandler<ProcessorChangeEventArgs> ProcessorChange;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Notifies of ethernet change
|
/// Notifies of ethernet change
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event EventHandler<EthernetChangeEventArgs> EthernetChange;
|
public event EventHandler<EthernetChangeEventArgs> EthernetChange;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Notifies of control subnet change
|
/// Notifies of control subnet change
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event EventHandler<ControlSubnetChangeEventArgs> ControlSubnetChange;
|
public event EventHandler<ControlSubnetChangeEventArgs> ControlSubnetChange;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Notifies of program change
|
/// Notifies of program change
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event EventHandler<ProgramChangeEventArgs> ProgramChange;
|
public event EventHandler<ProgramChangeEventArgs> ProgramChange;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -336,10 +336,10 @@ namespace PepperDash.Core.SystemInfo
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// private method to parse console messages
|
/// private method to parse console messages
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="data"></param>
|
/// <param name="data"></param>
|
||||||
/// <param name="line"></param>
|
/// <param name="line"></param>
|
||||||
/// <param name="dataStart"></param>
|
/// <param name="dataStart"></param>
|
||||||
/// <param name="dataEnd"></param>
|
/// <param name="dataEnd"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private string ParseConsoleResponse(string data, string line, string dataStart, string dataEnd)
|
private string ParseConsoleResponse(string data, string line, string dataStart, string dataEnd)
|
||||||
{
|
{
|
||||||
@@ -467,5 +467,4 @@ namespace PepperDash.Core.SystemInfo
|
|||||||
ProgramChange(this, args);
|
ProgramChange(this, args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -20,352 +20,336 @@ using Org.BouncyCastle.Crypto.Operators;
|
|||||||
using BigInteger = Org.BouncyCastle.Math.BigInteger;
|
using BigInteger = Org.BouncyCastle.Math.BigInteger;
|
||||||
using X509Certificate = Org.BouncyCastle.X509.X509Certificate;
|
using X509Certificate = Org.BouncyCastle.X509.X509Certificate;
|
||||||
|
|
||||||
namespace PepperDash.Core
|
namespace PepperDash.Core;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Taken From https://github.com/rlipscombe/bouncy-castle-csharp/
|
||||||
|
/// </summary>
|
||||||
|
internal class BouncyCertificate
|
||||||
{
|
{
|
||||||
/// <summary>
|
public string CertificatePassword { get; set; } = "password";
|
||||||
/// Taken From https://github.com/rlipscombe/bouncy-castle-csharp/
|
public X509Certificate2 LoadCertificate(string issuerFileName, string password)
|
||||||
/// </summary>
|
|
||||||
internal class BouncyCertificate
|
|
||||||
{
|
{
|
||||||
public string CertificatePassword { get; set; } = "password";
|
// We need to pass 'Exportable', otherwise we can't get the private key.
|
||||||
public X509Certificate2 LoadCertificate(string issuerFileName, string password)
|
var issuerCertificate = new X509Certificate2(issuerFileName, password, X509KeyStorageFlags.Exportable);
|
||||||
|
return issuerCertificate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public X509Certificate2 IssueCertificate(string subjectName, X509Certificate2 issuerCertificate, string[] subjectAlternativeNames, KeyPurposeID[] usages)
|
||||||
|
{
|
||||||
|
// It's self-signed, so these are the same.
|
||||||
|
var issuerName = issuerCertificate.Subject;
|
||||||
|
|
||||||
|
var random = GetSecureRandom();
|
||||||
|
var subjectKeyPair = GenerateKeyPair(random, 2048);
|
||||||
|
|
||||||
|
var issuerKeyPair = DotNetUtilities.GetKeyPair(issuerCertificate.PrivateKey);
|
||||||
|
|
||||||
|
var serialNumber = GenerateSerialNumber(random);
|
||||||
|
var issuerSerialNumber = new BigInteger(issuerCertificate.GetSerialNumber());
|
||||||
|
|
||||||
|
const bool isCertificateAuthority = false;
|
||||||
|
var certificate = GenerateCertificate(random, subjectName, subjectKeyPair, serialNumber,
|
||||||
|
subjectAlternativeNames, issuerName, issuerKeyPair,
|
||||||
|
issuerSerialNumber, isCertificateAuthority,
|
||||||
|
usages);
|
||||||
|
return ConvertCertificate(certificate, subjectKeyPair, random);
|
||||||
|
}
|
||||||
|
|
||||||
|
public X509Certificate2 CreateCertificateAuthorityCertificate(string subjectName, string[] subjectAlternativeNames, KeyPurposeID[] usages)
|
||||||
|
{
|
||||||
|
// It's self-signed, so these are the same.
|
||||||
|
var issuerName = subjectName;
|
||||||
|
|
||||||
|
var random = GetSecureRandom();
|
||||||
|
var subjectKeyPair = GenerateKeyPair(random, 2048);
|
||||||
|
|
||||||
|
// It's self-signed, so these are the same.
|
||||||
|
var issuerKeyPair = subjectKeyPair;
|
||||||
|
|
||||||
|
var serialNumber = GenerateSerialNumber(random);
|
||||||
|
var issuerSerialNumber = serialNumber; // Self-signed, so it's the same serial number.
|
||||||
|
|
||||||
|
const bool isCertificateAuthority = true;
|
||||||
|
var certificate = GenerateCertificate(random, subjectName, subjectKeyPair, serialNumber,
|
||||||
|
subjectAlternativeNames, issuerName, issuerKeyPair,
|
||||||
|
issuerSerialNumber, isCertificateAuthority,
|
||||||
|
usages);
|
||||||
|
return ConvertCertificate(certificate, subjectKeyPair, random);
|
||||||
|
}
|
||||||
|
|
||||||
|
public X509Certificate2 CreateSelfSignedCertificate(string subjectName, string[] subjectAlternativeNames, KeyPurposeID[] usages)
|
||||||
|
{
|
||||||
|
// It's self-signed, so these are the same.
|
||||||
|
var issuerName = subjectName;
|
||||||
|
|
||||||
|
var random = GetSecureRandom();
|
||||||
|
var subjectKeyPair = GenerateKeyPair(random, 2048);
|
||||||
|
|
||||||
|
// It's self-signed, so these are the same.
|
||||||
|
var issuerKeyPair = subjectKeyPair;
|
||||||
|
|
||||||
|
var serialNumber = GenerateSerialNumber(random);
|
||||||
|
var issuerSerialNumber = serialNumber; // Self-signed, so it's the same serial number.
|
||||||
|
|
||||||
|
const bool isCertificateAuthority = false;
|
||||||
|
var certificate = GenerateCertificate(random, subjectName, subjectKeyPair, serialNumber,
|
||||||
|
subjectAlternativeNames, issuerName, issuerKeyPair,
|
||||||
|
issuerSerialNumber, isCertificateAuthority,
|
||||||
|
usages);
|
||||||
|
return ConvertCertificate(certificate, subjectKeyPair, random);
|
||||||
|
}
|
||||||
|
|
||||||
|
private SecureRandom GetSecureRandom()
|
||||||
|
{
|
||||||
|
// Since we're on Windows, we'll use the CryptoAPI one (on the assumption
|
||||||
|
// that it might have access to better sources of entropy than the built-in
|
||||||
|
// Bouncy Castle ones):
|
||||||
|
var randomGenerator = new CryptoApiRandomGenerator();
|
||||||
|
var random = new SecureRandom(randomGenerator);
|
||||||
|
return random;
|
||||||
|
}
|
||||||
|
|
||||||
|
private X509Certificate GenerateCertificate(SecureRandom random,
|
||||||
|
string subjectName,
|
||||||
|
AsymmetricCipherKeyPair subjectKeyPair,
|
||||||
|
BigInteger subjectSerialNumber,
|
||||||
|
string[] subjectAlternativeNames,
|
||||||
|
string issuerName,
|
||||||
|
AsymmetricCipherKeyPair issuerKeyPair,
|
||||||
|
BigInteger issuerSerialNumber,
|
||||||
|
bool isCertificateAuthority,
|
||||||
|
KeyPurposeID[] usages)
|
||||||
|
{
|
||||||
|
var certificateGenerator = new X509V3CertificateGenerator();
|
||||||
|
|
||||||
|
certificateGenerator.SetSerialNumber(subjectSerialNumber);
|
||||||
|
|
||||||
|
var issuerDN = new X509Name(issuerName);
|
||||||
|
certificateGenerator.SetIssuerDN(issuerDN);
|
||||||
|
|
||||||
|
// Note: The subject can be omitted if you specify a subject alternative name (SAN).
|
||||||
|
var subjectDN = new X509Name(subjectName);
|
||||||
|
certificateGenerator.SetSubjectDN(subjectDN);
|
||||||
|
|
||||||
|
// Our certificate needs valid from/to values.
|
||||||
|
var notBefore = DateTime.UtcNow.Date;
|
||||||
|
var notAfter = notBefore.AddYears(2);
|
||||||
|
|
||||||
|
certificateGenerator.SetNotBefore(notBefore);
|
||||||
|
certificateGenerator.SetNotAfter(notAfter);
|
||||||
|
|
||||||
|
// The subject's public key goes in the certificate.
|
||||||
|
certificateGenerator.SetPublicKey(subjectKeyPair.Public);
|
||||||
|
|
||||||
|
AddAuthorityKeyIdentifier(certificateGenerator, issuerDN, issuerKeyPair, issuerSerialNumber);
|
||||||
|
AddSubjectKeyIdentifier(certificateGenerator, subjectKeyPair);
|
||||||
|
//AddBasicConstraints(certificateGenerator, isCertificateAuthority);
|
||||||
|
|
||||||
|
if (usages != null && usages.Any())
|
||||||
|
AddExtendedKeyUsage(certificateGenerator, usages);
|
||||||
|
|
||||||
|
if (subjectAlternativeNames != null && subjectAlternativeNames.Any())
|
||||||
|
AddSubjectAlternativeNames(certificateGenerator, subjectAlternativeNames);
|
||||||
|
|
||||||
|
// Set the signature algorithm. This is used to generate the thumbprint which is then signed
|
||||||
|
// with the issuer's private key. We'll use SHA-256, which is (currently) considered fairly strong.
|
||||||
|
const string signatureAlgorithm = "SHA256WithRSA";
|
||||||
|
|
||||||
|
// The certificate is signed with the issuer's private key.
|
||||||
|
ISignatureFactory signatureFactory = new Asn1SignatureFactory(signatureAlgorithm, issuerKeyPair.Private, random);
|
||||||
|
var certificate = certificateGenerator.Generate(signatureFactory);
|
||||||
|
return certificate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The certificate needs a serial number. This is used for revocation,
|
||||||
|
/// and usually should be an incrementing index (which makes it easier to revoke a range of certificates).
|
||||||
|
/// Since we don't have anywhere to store the incrementing index, we can just use a random number.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="random"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private BigInteger GenerateSerialNumber(SecureRandom random)
|
||||||
|
{
|
||||||
|
var serialNumber =
|
||||||
|
BigIntegers.CreateRandomInRange(
|
||||||
|
BigInteger.One, BigInteger.ValueOf(Int64.MaxValue), random);
|
||||||
|
return serialNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Generate a key pair.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="random">The random number generator.</param>
|
||||||
|
/// <param name="strength">The key length in bits. For RSA, 2048 bits should be considered the minimum acceptable these days.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private AsymmetricCipherKeyPair GenerateKeyPair(SecureRandom random, int strength)
|
||||||
|
{
|
||||||
|
var keyGenerationParameters = new KeyGenerationParameters(random, strength);
|
||||||
|
|
||||||
|
var keyPairGenerator = new RsaKeyPairGenerator();
|
||||||
|
keyPairGenerator.Init(keyGenerationParameters);
|
||||||
|
var subjectKeyPair = keyPairGenerator.GenerateKeyPair();
|
||||||
|
return subjectKeyPair;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add the Authority Key Identifier. According to http://www.alvestrand.no/objectid/2.5.29.35.html, this
|
||||||
|
/// identifies the public key to be used to verify the signature on this certificate.
|
||||||
|
/// In a certificate chain, this corresponds to the "Subject Key Identifier" on the *issuer* certificate.
|
||||||
|
/// The Bouncy Castle documentation, at http://www.bouncycastle.org/wiki/display/JA1/X.509+Public+Key+Certificate+and+Certification+Request+Generation,
|
||||||
|
/// shows how to create this from the issuing certificate. Since we're creating a self-signed certificate, we have to do this slightly differently.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="certificateGenerator"></param>
|
||||||
|
/// <param name="issuerDN"></param>
|
||||||
|
/// <param name="issuerKeyPair"></param>
|
||||||
|
/// <param name="issuerSerialNumber"></param>
|
||||||
|
private void AddAuthorityKeyIdentifier(X509V3CertificateGenerator certificateGenerator,
|
||||||
|
X509Name issuerDN,
|
||||||
|
AsymmetricCipherKeyPair issuerKeyPair,
|
||||||
|
BigInteger issuerSerialNumber)
|
||||||
|
{
|
||||||
|
var authorityKeyIdentifierExtension =
|
||||||
|
new AuthorityKeyIdentifier(
|
||||||
|
SubjectPublicKeyInfoFactory.CreateSubjectPublicKeyInfo(issuerKeyPair.Public),
|
||||||
|
new GeneralNames(new GeneralName(issuerDN)),
|
||||||
|
issuerSerialNumber);
|
||||||
|
certificateGenerator.AddExtension(
|
||||||
|
X509Extensions.AuthorityKeyIdentifier.Id, false, authorityKeyIdentifierExtension);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add the "Subject Alternative Names" extension. Note that you have to repeat
|
||||||
|
/// the value from the "Subject Name" property.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="certificateGenerator"></param>
|
||||||
|
/// <param name="subjectAlternativeNames"></param>
|
||||||
|
private void AddSubjectAlternativeNames(X509V3CertificateGenerator certificateGenerator,
|
||||||
|
IEnumerable<string> subjectAlternativeNames)
|
||||||
|
{
|
||||||
|
var subjectAlternativeNamesExtension =
|
||||||
|
new DerSequence(
|
||||||
|
subjectAlternativeNames.Select(name => new GeneralName(GeneralName.DnsName, name))
|
||||||
|
.ToArray<Asn1Encodable>());
|
||||||
|
certificateGenerator.AddExtension(
|
||||||
|
X509Extensions.SubjectAlternativeName.Id, false, subjectAlternativeNamesExtension);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add the "Extended Key Usage" extension, specifying (for example) "server authentication".
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="certificateGenerator"></param>
|
||||||
|
/// <param name="usages"></param>
|
||||||
|
private void AddExtendedKeyUsage(X509V3CertificateGenerator certificateGenerator, KeyPurposeID[] usages)
|
||||||
|
{
|
||||||
|
certificateGenerator.AddExtension(
|
||||||
|
X509Extensions.ExtendedKeyUsage.Id, false, new ExtendedKeyUsage(usages));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add the "Basic Constraints" extension.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="certificateGenerator"></param>
|
||||||
|
/// <param name="isCertificateAuthority"></param>
|
||||||
|
private void AddBasicConstraints(X509V3CertificateGenerator certificateGenerator,
|
||||||
|
bool isCertificateAuthority)
|
||||||
|
{
|
||||||
|
certificateGenerator.AddExtension(
|
||||||
|
X509Extensions.BasicConstraints.Id, true, new BasicConstraints(isCertificateAuthority));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add the Subject Key Identifier.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="certificateGenerator"></param>
|
||||||
|
/// <param name="subjectKeyPair"></param>
|
||||||
|
private void AddSubjectKeyIdentifier(X509V3CertificateGenerator certificateGenerator,
|
||||||
|
AsymmetricCipherKeyPair subjectKeyPair)
|
||||||
|
{
|
||||||
|
var subjectKeyIdentifierExtension =
|
||||||
|
new SubjectKeyIdentifier(
|
||||||
|
SubjectPublicKeyInfoFactory.CreateSubjectPublicKeyInfo(subjectKeyPair.Public));
|
||||||
|
certificateGenerator.AddExtension(
|
||||||
|
X509Extensions.SubjectKeyIdentifier.Id, false, subjectKeyIdentifierExtension);
|
||||||
|
}
|
||||||
|
|
||||||
|
private X509Certificate2 ConvertCertificate(X509Certificate certificate,
|
||||||
|
AsymmetricCipherKeyPair subjectKeyPair,
|
||||||
|
SecureRandom random)
|
||||||
|
{
|
||||||
|
// Now to convert the Bouncy Castle certificate to a .NET certificate.
|
||||||
|
// See http://web.archive.org/web/20100504192226/http://www.fkollmann.de/v2/post/Creating-certificates-using-BouncyCastle.aspx
|
||||||
|
// ...but, basically, we create a PKCS12 store (a .PFX file) in memory, and add the public and private key to that.
|
||||||
|
var store = new Pkcs12StoreBuilder().Build();
|
||||||
|
|
||||||
|
// What Bouncy Castle calls "alias" is the same as what Windows terms the "friendly name".
|
||||||
|
string friendlyName = certificate.SubjectDN.ToString();
|
||||||
|
|
||||||
|
// Add the certificate.
|
||||||
|
var certificateEntry = new X509CertificateEntry(certificate);
|
||||||
|
store.SetCertificateEntry(friendlyName, certificateEntry);
|
||||||
|
|
||||||
|
// Add the private key.
|
||||||
|
store.SetKeyEntry(friendlyName, new AsymmetricKeyEntry(subjectKeyPair.Private), new[] { certificateEntry });
|
||||||
|
|
||||||
|
// Convert it to an X509Certificate2 object by saving/loading it from a MemoryStream.
|
||||||
|
// It needs a password. Since we'll remove this later, it doesn't particularly matter what we use.
|
||||||
|
|
||||||
|
var stream = new MemoryStream();
|
||||||
|
store.Save(stream, CertificatePassword.ToCharArray(), random);
|
||||||
|
|
||||||
|
var convertedCertificate =
|
||||||
|
new X509Certificate2(stream.ToArray(),
|
||||||
|
CertificatePassword,
|
||||||
|
X509KeyStorageFlags.PersistKeySet | X509KeyStorageFlags.Exportable);
|
||||||
|
return convertedCertificate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void WriteCertificate(X509Certificate2 certificate, string outputDirectory, string certName)
|
||||||
|
{
|
||||||
|
// This password is the one attached to the PFX file. Use 'null' for no password.
|
||||||
|
// Create PFX (PKCS #12) with private key
|
||||||
|
try
|
||||||
{
|
{
|
||||||
// We need to pass 'Exportable', otherwise we can't get the private key.
|
var pfx = certificate.Export(X509ContentType.Pfx, CertificatePassword);
|
||||||
var issuerCertificate = new X509Certificate2(issuerFileName, password, X509KeyStorageFlags.Exportable);
|
File.WriteAllBytes(string.Format("{0}.pfx", Path.Combine(outputDirectory, certName)), pfx);
|
||||||
return issuerCertificate;
|
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
/// <summary>
|
|
||||||
/// IssueCertificate method
|
|
||||||
/// </summary>
|
|
||||||
public X509Certificate2 IssueCertificate(string subjectName, X509Certificate2 issuerCertificate, string[] subjectAlternativeNames, KeyPurposeID[] usages)
|
|
||||||
{
|
{
|
||||||
// It's self-signed, so these are the same.
|
CrestronConsole.PrintLine(string.Format("Failed to write x509 cert pfx\r\n{0}", ex.Message));
|
||||||
var issuerName = issuerCertificate.Subject;
|
|
||||||
|
|
||||||
var random = GetSecureRandom();
|
|
||||||
var subjectKeyPair = GenerateKeyPair(random, 2048);
|
|
||||||
|
|
||||||
var issuerKeyPair = DotNetUtilities.GetKeyPair(issuerCertificate.PrivateKey);
|
|
||||||
|
|
||||||
var serialNumber = GenerateSerialNumber(random);
|
|
||||||
var issuerSerialNumber = new BigInteger(issuerCertificate.GetSerialNumber());
|
|
||||||
|
|
||||||
const bool isCertificateAuthority = false;
|
|
||||||
var certificate = GenerateCertificate(random, subjectName, subjectKeyPair, serialNumber,
|
|
||||||
subjectAlternativeNames, issuerName, issuerKeyPair,
|
|
||||||
issuerSerialNumber, isCertificateAuthority,
|
|
||||||
usages);
|
|
||||||
return ConvertCertificate(certificate, subjectKeyPair, random);
|
|
||||||
}
|
}
|
||||||
|
// Create Base 64 encoded CER (public key only)
|
||||||
/// <summary>
|
using (var writer = new StreamWriter($"{Path.Combine(outputDirectory, certName)}.cer", false))
|
||||||
/// CreateCertificateAuthorityCertificate method
|
|
||||||
/// </summary>
|
|
||||||
public X509Certificate2 CreateCertificateAuthorityCertificate(string subjectName, string[] subjectAlternativeNames, KeyPurposeID[] usages)
|
|
||||||
{
|
{
|
||||||
// It's self-signed, so these are the same.
|
|
||||||
var issuerName = subjectName;
|
|
||||||
|
|
||||||
var random = GetSecureRandom();
|
|
||||||
var subjectKeyPair = GenerateKeyPair(random, 2048);
|
|
||||||
|
|
||||||
// It's self-signed, so these are the same.
|
|
||||||
var issuerKeyPair = subjectKeyPair;
|
|
||||||
|
|
||||||
var serialNumber = GenerateSerialNumber(random);
|
|
||||||
var issuerSerialNumber = serialNumber; // Self-signed, so it's the same serial number.
|
|
||||||
|
|
||||||
const bool isCertificateAuthority = true;
|
|
||||||
var certificate = GenerateCertificate(random, subjectName, subjectKeyPair, serialNumber,
|
|
||||||
subjectAlternativeNames, issuerName, issuerKeyPair,
|
|
||||||
issuerSerialNumber, isCertificateAuthority,
|
|
||||||
usages);
|
|
||||||
return ConvertCertificate(certificate, subjectKeyPair, random);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// CreateSelfSignedCertificate method
|
|
||||||
/// </summary>
|
|
||||||
public X509Certificate2 CreateSelfSignedCertificate(string subjectName, string[] subjectAlternativeNames, KeyPurposeID[] usages)
|
|
||||||
{
|
|
||||||
// It's self-signed, so these are the same.
|
|
||||||
var issuerName = subjectName;
|
|
||||||
|
|
||||||
var random = GetSecureRandom();
|
|
||||||
var subjectKeyPair = GenerateKeyPair(random, 2048);
|
|
||||||
|
|
||||||
// It's self-signed, so these are the same.
|
|
||||||
var issuerKeyPair = subjectKeyPair;
|
|
||||||
|
|
||||||
var serialNumber = GenerateSerialNumber(random);
|
|
||||||
var issuerSerialNumber = serialNumber; // Self-signed, so it's the same serial number.
|
|
||||||
|
|
||||||
const bool isCertificateAuthority = false;
|
|
||||||
var certificate = GenerateCertificate(random, subjectName, subjectKeyPair, serialNumber,
|
|
||||||
subjectAlternativeNames, issuerName, issuerKeyPair,
|
|
||||||
issuerSerialNumber, isCertificateAuthority,
|
|
||||||
usages);
|
|
||||||
return ConvertCertificate(certificate, subjectKeyPair, random);
|
|
||||||
}
|
|
||||||
|
|
||||||
private SecureRandom GetSecureRandom()
|
|
||||||
{
|
|
||||||
// Since we're on Windows, we'll use the CryptoAPI one (on the assumption
|
|
||||||
// that it might have access to better sources of entropy than the built-in
|
|
||||||
// Bouncy Castle ones):
|
|
||||||
var randomGenerator = new CryptoApiRandomGenerator();
|
|
||||||
var random = new SecureRandom(randomGenerator);
|
|
||||||
return random;
|
|
||||||
}
|
|
||||||
|
|
||||||
private X509Certificate GenerateCertificate(SecureRandom random,
|
|
||||||
string subjectName,
|
|
||||||
AsymmetricCipherKeyPair subjectKeyPair,
|
|
||||||
BigInteger subjectSerialNumber,
|
|
||||||
string[] subjectAlternativeNames,
|
|
||||||
string issuerName,
|
|
||||||
AsymmetricCipherKeyPair issuerKeyPair,
|
|
||||||
BigInteger issuerSerialNumber,
|
|
||||||
bool isCertificateAuthority,
|
|
||||||
KeyPurposeID[] usages)
|
|
||||||
{
|
|
||||||
var certificateGenerator = new X509V3CertificateGenerator();
|
|
||||||
|
|
||||||
certificateGenerator.SetSerialNumber(subjectSerialNumber);
|
|
||||||
|
|
||||||
var issuerDN = new X509Name(issuerName);
|
|
||||||
certificateGenerator.SetIssuerDN(issuerDN);
|
|
||||||
|
|
||||||
// Note: The subject can be omitted if you specify a subject alternative name (SAN).
|
|
||||||
var subjectDN = new X509Name(subjectName);
|
|
||||||
certificateGenerator.SetSubjectDN(subjectDN);
|
|
||||||
|
|
||||||
// Our certificate needs valid from/to values.
|
|
||||||
var notBefore = DateTime.UtcNow.Date;
|
|
||||||
var notAfter = notBefore.AddYears(2);
|
|
||||||
|
|
||||||
certificateGenerator.SetNotBefore(notBefore);
|
|
||||||
certificateGenerator.SetNotAfter(notAfter);
|
|
||||||
|
|
||||||
// The subject's public key goes in the certificate.
|
|
||||||
certificateGenerator.SetPublicKey(subjectKeyPair.Public);
|
|
||||||
|
|
||||||
AddAuthorityKeyIdentifier(certificateGenerator, issuerDN, issuerKeyPair, issuerSerialNumber);
|
|
||||||
AddSubjectKeyIdentifier(certificateGenerator, subjectKeyPair);
|
|
||||||
//AddBasicConstraints(certificateGenerator, isCertificateAuthority);
|
|
||||||
|
|
||||||
if (usages != null && usages.Any())
|
|
||||||
AddExtendedKeyUsage(certificateGenerator, usages);
|
|
||||||
|
|
||||||
if (subjectAlternativeNames != null && subjectAlternativeNames.Any())
|
|
||||||
AddSubjectAlternativeNames(certificateGenerator, subjectAlternativeNames);
|
|
||||||
|
|
||||||
// Set the signature algorithm. This is used to generate the thumbprint which is then signed
|
|
||||||
// with the issuer's private key. We'll use SHA-256, which is (currently) considered fairly strong.
|
|
||||||
const string signatureAlgorithm = "SHA256WithRSA";
|
|
||||||
|
|
||||||
// The certificate is signed with the issuer's private key.
|
|
||||||
ISignatureFactory signatureFactory = new Asn1SignatureFactory(signatureAlgorithm, issuerKeyPair.Private, random);
|
|
||||||
var certificate = certificateGenerator.Generate(signatureFactory);
|
|
||||||
return certificate;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The certificate needs a serial number. This is used for revocation,
|
|
||||||
/// and usually should be an incrementing index (which makes it easier to revoke a range of certificates).
|
|
||||||
/// Since we don't have anywhere to store the incrementing index, we can just use a random number.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="random"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
private BigInteger GenerateSerialNumber(SecureRandom random)
|
|
||||||
{
|
|
||||||
var serialNumber =
|
|
||||||
BigIntegers.CreateRandomInRange(
|
|
||||||
BigInteger.One, BigInteger.ValueOf(Int64.MaxValue), random);
|
|
||||||
return serialNumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Generate a key pair.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="random">The random number generator.</param>
|
|
||||||
/// <param name="strength">The key length in bits. For RSA, 2048 bits should be considered the minimum acceptable these days.</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
private AsymmetricCipherKeyPair GenerateKeyPair(SecureRandom random, int strength)
|
|
||||||
{
|
|
||||||
var keyGenerationParameters = new KeyGenerationParameters(random, strength);
|
|
||||||
|
|
||||||
var keyPairGenerator = new RsaKeyPairGenerator();
|
|
||||||
keyPairGenerator.Init(keyGenerationParameters);
|
|
||||||
var subjectKeyPair = keyPairGenerator.GenerateKeyPair();
|
|
||||||
return subjectKeyPair;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Add the Authority Key Identifier. According to http://www.alvestrand.no/objectid/2.5.29.35.html, this
|
|
||||||
/// identifies the public key to be used to verify the signature on this certificate.
|
|
||||||
/// In a certificate chain, this corresponds to the "Subject Key Identifier" on the *issuer* certificate.
|
|
||||||
/// The Bouncy Castle documentation, at http://www.bouncycastle.org/wiki/display/JA1/X.509+Public+Key+Certificate+and+Certification+Request+Generation,
|
|
||||||
/// shows how to create this from the issuing certificate. Since we're creating a self-signed certificate, we have to do this slightly differently.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="certificateGenerator"></param>
|
|
||||||
/// <param name="issuerDN"></param>
|
|
||||||
/// <param name="issuerKeyPair"></param>
|
|
||||||
/// <param name="issuerSerialNumber"></param>
|
|
||||||
private void AddAuthorityKeyIdentifier(X509V3CertificateGenerator certificateGenerator,
|
|
||||||
X509Name issuerDN,
|
|
||||||
AsymmetricCipherKeyPair issuerKeyPair,
|
|
||||||
BigInteger issuerSerialNumber)
|
|
||||||
{
|
|
||||||
var authorityKeyIdentifierExtension =
|
|
||||||
new AuthorityKeyIdentifier(
|
|
||||||
SubjectPublicKeyInfoFactory.CreateSubjectPublicKeyInfo(issuerKeyPair.Public),
|
|
||||||
new GeneralNames(new GeneralName(issuerDN)),
|
|
||||||
issuerSerialNumber);
|
|
||||||
certificateGenerator.AddExtension(
|
|
||||||
X509Extensions.AuthorityKeyIdentifier.Id, false, authorityKeyIdentifierExtension);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Add the "Subject Alternative Names" extension. Note that you have to repeat
|
|
||||||
/// the value from the "Subject Name" property.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="certificateGenerator"></param>
|
|
||||||
/// <param name="subjectAlternativeNames"></param>
|
|
||||||
private void AddSubjectAlternativeNames(X509V3CertificateGenerator certificateGenerator,
|
|
||||||
IEnumerable<string> subjectAlternativeNames)
|
|
||||||
{
|
|
||||||
var subjectAlternativeNamesExtension =
|
|
||||||
new DerSequence(
|
|
||||||
subjectAlternativeNames.Select(name => new GeneralName(GeneralName.DnsName, name))
|
|
||||||
.ToArray<Asn1Encodable>());
|
|
||||||
certificateGenerator.AddExtension(
|
|
||||||
X509Extensions.SubjectAlternativeName.Id, false, subjectAlternativeNamesExtension);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Add the "Extended Key Usage" extension, specifying (for example) "server authentication".
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="certificateGenerator"></param>
|
|
||||||
/// <param name="usages"></param>
|
|
||||||
private void AddExtendedKeyUsage(X509V3CertificateGenerator certificateGenerator, KeyPurposeID[] usages)
|
|
||||||
{
|
|
||||||
certificateGenerator.AddExtension(
|
|
||||||
X509Extensions.ExtendedKeyUsage.Id, false, new ExtendedKeyUsage(usages));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Add the "Basic Constraints" extension.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="certificateGenerator"></param>
|
|
||||||
/// <param name="isCertificateAuthority"></param>
|
|
||||||
private void AddBasicConstraints(X509V3CertificateGenerator certificateGenerator,
|
|
||||||
bool isCertificateAuthority)
|
|
||||||
{
|
|
||||||
certificateGenerator.AddExtension(
|
|
||||||
X509Extensions.BasicConstraints.Id, true, new BasicConstraints(isCertificateAuthority));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Add the Subject Key Identifier.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="certificateGenerator"></param>
|
|
||||||
/// <param name="subjectKeyPair"></param>
|
|
||||||
private void AddSubjectKeyIdentifier(X509V3CertificateGenerator certificateGenerator,
|
|
||||||
AsymmetricCipherKeyPair subjectKeyPair)
|
|
||||||
{
|
|
||||||
var subjectKeyIdentifierExtension =
|
|
||||||
new SubjectKeyIdentifier(
|
|
||||||
SubjectPublicKeyInfoFactory.CreateSubjectPublicKeyInfo(subjectKeyPair.Public));
|
|
||||||
certificateGenerator.AddExtension(
|
|
||||||
X509Extensions.SubjectKeyIdentifier.Id, false, subjectKeyIdentifierExtension);
|
|
||||||
}
|
|
||||||
|
|
||||||
private X509Certificate2 ConvertCertificate(X509Certificate certificate,
|
|
||||||
AsymmetricCipherKeyPair subjectKeyPair,
|
|
||||||
SecureRandom random)
|
|
||||||
{
|
|
||||||
// Now to convert the Bouncy Castle certificate to a .NET certificate.
|
|
||||||
// See http://web.archive.org/web/20100504192226/http://www.fkollmann.de/v2/post/Creating-certificates-using-BouncyCastle.aspx
|
|
||||||
// ...but, basically, we create a PKCS12 store (a .PFX file) in memory, and add the public and private key to that.
|
|
||||||
var store = new Pkcs12StoreBuilder().Build();
|
|
||||||
|
|
||||||
// What Bouncy Castle calls "alias" is the same as what Windows terms the "friendly name".
|
|
||||||
string friendlyName = certificate.SubjectDN.ToString();
|
|
||||||
|
|
||||||
// Add the certificate.
|
|
||||||
var certificateEntry = new X509CertificateEntry(certificate);
|
|
||||||
store.SetCertificateEntry(friendlyName, certificateEntry);
|
|
||||||
|
|
||||||
// Add the private key.
|
|
||||||
store.SetKeyEntry(friendlyName, new AsymmetricKeyEntry(subjectKeyPair.Private), new[] { certificateEntry });
|
|
||||||
|
|
||||||
// Convert it to an X509Certificate2 object by saving/loading it from a MemoryStream.
|
|
||||||
// It needs a password. Since we'll remove this later, it doesn't particularly matter what we use.
|
|
||||||
|
|
||||||
var stream = new MemoryStream();
|
|
||||||
store.Save(stream, CertificatePassword.ToCharArray(), random);
|
|
||||||
|
|
||||||
var convertedCertificate =
|
|
||||||
new X509Certificate2(stream.ToArray(),
|
|
||||||
CertificatePassword,
|
|
||||||
X509KeyStorageFlags.PersistKeySet | X509KeyStorageFlags.Exportable);
|
|
||||||
return convertedCertificate;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// WriteCertificate method
|
|
||||||
/// </summary>
|
|
||||||
public void WriteCertificate(X509Certificate2 certificate, string outputDirectory, string certName)
|
|
||||||
{
|
|
||||||
// This password is the one attached to the PFX file. Use 'null' for no password.
|
|
||||||
// Create PFX (PKCS #12) with private key
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var pfx = certificate.Export(X509ContentType.Pfx, CertificatePassword);
|
var contents = string.Format("-----BEGIN CERTIFICATE-----\r\n{0}\r\n-----END CERTIFICATE-----", Convert.ToBase64String(certificate.Export(X509ContentType.Cert), Base64FormattingOptions.InsertLineBreaks));
|
||||||
File.WriteAllBytes(string.Format("{0}.pfx", Path.Combine(outputDirectory, certName)), pfx);
|
writer.Write(contents);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
CrestronConsole.PrintLine(string.Format("Failed to write x509 cert pfx\r\n{0}", ex.Message));
|
CrestronConsole.PrintLine(string.Format("Failed to write x509 cert cer\r\n{0}", ex.Message));
|
||||||
}
|
}
|
||||||
// Create Base 64 encoded CER (public key only)
|
|
||||||
using (var writer = new StreamWriter($"{Path.Combine(outputDirectory, certName)}.cer", false))
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var contents = string.Format("-----BEGIN CERTIFICATE-----\r\n{0}\r\n-----END CERTIFICATE-----", Convert.ToBase64String(certificate.Export(X509ContentType.Cert), Base64FormattingOptions.InsertLineBreaks));
|
|
||||||
writer.Write(contents);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
CrestronConsole.PrintLine(string.Format("Failed to write x509 cert cer\r\n{0}", ex.Message));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// AddCertToStore method
|
|
||||||
/// </summary>
|
|
||||||
public bool AddCertToStore(X509Certificate2 cert, System.Security.Cryptography.X509Certificates.StoreName st, System.Security.Cryptography.X509Certificates.StoreLocation sl)
|
|
||||||
{
|
|
||||||
bool bRet = false;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var store = new System.Security.Cryptography.X509Certificates.X509Store(st, sl);
|
|
||||||
store.Open(System.Security.Cryptography.X509Certificates.OpenFlags.ReadWrite);
|
|
||||||
store.Add(cert);
|
|
||||||
|
|
||||||
store.Close();
|
|
||||||
bRet = true;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
CrestronConsole.PrintLine(string.Format("AddCertToStore Failed\r\n{0}\r\n{1}", ex.Message, ex.StackTrace));
|
|
||||||
}
|
|
||||||
|
|
||||||
return bRet;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public bool AddCertToStore(X509Certificate2 cert, System.Security.Cryptography.X509Certificates.StoreName st, System.Security.Cryptography.X509Certificates.StoreLocation sl)
|
||||||
|
{
|
||||||
|
bool bRet = false;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var store = new System.Security.Cryptography.X509Certificates.X509Store(st, sl);
|
||||||
|
store.Open(System.Security.Cryptography.X509Certificates.OpenFlags.ReadWrite);
|
||||||
|
store.Add(cert);
|
||||||
|
|
||||||
|
store.Close();
|
||||||
|
bRet = true;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
CrestronConsole.PrintLine(string.Format("AddCertToStore Failed\r\n{0}\r\n{1}", ex.Message, ex.StackTrace));
|
||||||
|
}
|
||||||
|
|
||||||
|
return bRet;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
using Crestron.SimplSharp.WebScripting;
|
using Crestron.SimplSharp.WebScripting;
|
||||||
|
|
||||||
namespace PepperDash.Core.Web.RequestHandlers
|
namespace PepperDash.Core.Web.RequestHandlers;
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a DefaultRequestHandler
|
/// Web API default request handler
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class DefaultRequestHandler : WebApiBaseRequestHandler
|
public class DefaultRequestHandler : WebApiBaseRequestHandler
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -13,5 +13,4 @@ namespace PepperDash.Core.Web.RequestHandlers
|
|||||||
public DefaultRequestHandler()
|
public DefaultRequestHandler()
|
||||||
: base(true)
|
: base(true)
|
||||||
{ }
|
{ }
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -3,164 +3,160 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace PepperDash.Core.Web.RequestHandlers
|
namespace PepperDash.Core.Web.RequestHandlers;
|
||||||
|
|
||||||
|
public abstract class WebApiBaseRequestAsyncHandler:IHttpCwsHandler
|
||||||
{
|
{
|
||||||
public abstract class WebApiBaseRequestAsyncHandler:IHttpCwsHandler
|
private readonly Dictionary<string, Func<HttpCwsContext, Task>> _handlers;
|
||||||
|
protected readonly bool EnableCors;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
|
protected WebApiBaseRequestAsyncHandler(bool enableCors)
|
||||||
{
|
{
|
||||||
private readonly Dictionary<string, Func<HttpCwsContext, Task>> _handlers;
|
EnableCors = enableCors;
|
||||||
protected readonly bool EnableCors;
|
|
||||||
|
|
||||||
/// <summary>
|
_handlers = new Dictionary<string, Func<HttpCwsContext, Task>>
|
||||||
/// Constructor
|
|
||||||
/// </summary>
|
|
||||||
protected WebApiBaseRequestAsyncHandler(bool enableCors)
|
|
||||||
{
|
{
|
||||||
EnableCors = enableCors;
|
{"CONNECT", HandleConnect},
|
||||||
|
{"DELETE", HandleDelete},
|
||||||
|
{"GET", HandleGet},
|
||||||
|
{"HEAD", HandleHead},
|
||||||
|
{"OPTIONS", HandleOptions},
|
||||||
|
{"PATCH", HandlePatch},
|
||||||
|
{"POST", HandlePost},
|
||||||
|
{"PUT", HandlePut},
|
||||||
|
{"TRACE", HandleTrace}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
_handlers = new Dictionary<string, Func<HttpCwsContext, Task>>
|
/// <summary>
|
||||||
{
|
/// Constructor
|
||||||
{"CONNECT", HandleConnect},
|
/// </summary>
|
||||||
{"DELETE", HandleDelete},
|
protected WebApiBaseRequestAsyncHandler()
|
||||||
{"GET", HandleGet},
|
: this(false)
|
||||||
{"HEAD", HandleHead},
|
{
|
||||||
{"OPTIONS", HandleOptions},
|
}
|
||||||
{"PATCH", HandlePatch},
|
|
||||||
{"POST", HandlePost},
|
/// <summary>
|
||||||
{"PUT", HandlePut},
|
/// Handles CONNECT method requests
|
||||||
{"TRACE", HandleTrace}
|
/// </summary>
|
||||||
};
|
/// <param name="context"></param>
|
||||||
|
protected virtual async Task HandleConnect(HttpCwsContext context)
|
||||||
|
{
|
||||||
|
context.Response.StatusCode = 501;
|
||||||
|
context.Response.StatusDescription = "Not Implemented";
|
||||||
|
context.Response.End();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Handles DELETE method requests
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="context"></param>
|
||||||
|
protected virtual async Task HandleDelete(HttpCwsContext context)
|
||||||
|
{
|
||||||
|
context.Response.StatusCode = 501;
|
||||||
|
context.Response.StatusDescription = "Not Implemented";
|
||||||
|
context.Response.End();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Handles GET method requests
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="context"></param>
|
||||||
|
protected virtual async Task HandleGet(HttpCwsContext context)
|
||||||
|
{
|
||||||
|
context.Response.StatusCode = 501;
|
||||||
|
context.Response.StatusDescription = "Not Implemented";
|
||||||
|
context.Response.End();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Handles HEAD method requests
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="context"></param>
|
||||||
|
protected virtual async Task HandleHead(HttpCwsContext context)
|
||||||
|
{
|
||||||
|
context.Response.StatusCode = 501;
|
||||||
|
context.Response.StatusDescription = "Not Implemented";
|
||||||
|
context.Response.End();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Handles OPTIONS method requests
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="context"></param>
|
||||||
|
protected virtual async Task HandleOptions(HttpCwsContext context)
|
||||||
|
{
|
||||||
|
context.Response.StatusCode = 501;
|
||||||
|
context.Response.StatusDescription = "Not Implemented";
|
||||||
|
context.Response.End();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Handles PATCH method requests
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="context"></param>
|
||||||
|
protected virtual async Task HandlePatch(HttpCwsContext context)
|
||||||
|
{
|
||||||
|
context.Response.StatusCode = 501;
|
||||||
|
context.Response.StatusDescription = "Not Implemented";
|
||||||
|
context.Response.End();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Handles POST method requests
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="context"></param>
|
||||||
|
protected virtual async Task HandlePost(HttpCwsContext context)
|
||||||
|
{
|
||||||
|
context.Response.StatusCode = 501;
|
||||||
|
context.Response.StatusDescription = "Not Implemented";
|
||||||
|
context.Response.End();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Handles PUT method requests
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="context"></param>
|
||||||
|
protected virtual async Task HandlePut(HttpCwsContext context)
|
||||||
|
{
|
||||||
|
context.Response.StatusCode = 501;
|
||||||
|
context.Response.StatusDescription = "Not Implemented";
|
||||||
|
context.Response.End();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Handles TRACE method requests
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="context"></param>
|
||||||
|
protected virtual async Task HandleTrace(HttpCwsContext context)
|
||||||
|
{
|
||||||
|
context.Response.StatusCode = 501;
|
||||||
|
context.Response.StatusDescription = "Not Implemented";
|
||||||
|
context.Response.End();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Process request
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="context"></param>
|
||||||
|
public void ProcessRequest(HttpCwsContext context)
|
||||||
|
{
|
||||||
|
if (!_handlers.TryGetValue(context.Request.HttpMethod, out Func<HttpCwsContext, Task> handler))
|
||||||
|
{
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
if (EnableCors)
|
||||||
/// Constructor
|
|
||||||
/// </summary>
|
|
||||||
protected WebApiBaseRequestAsyncHandler()
|
|
||||||
: this(false)
|
|
||||||
{
|
{
|
||||||
|
context.Response.Headers.Add("Access-Control-Allow-Origin", "*");
|
||||||
|
context.Response.Headers.Add("Access-Control-Allow-Methods", "POST, GET, OPTIONS");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
var handlerTask = handler(context);
|
||||||
/// Handles CONNECT method requests
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="context"></param>
|
|
||||||
protected virtual async Task HandleConnect(HttpCwsContext context)
|
|
||||||
{
|
|
||||||
context.Response.StatusCode = 501;
|
|
||||||
context.Response.StatusDescription = "Not Implemented";
|
|
||||||
context.Response.End();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
handlerTask.GetAwaiter().GetResult();
|
||||||
/// Handles DELETE method requests
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="context"></param>
|
|
||||||
protected virtual async Task HandleDelete(HttpCwsContext context)
|
|
||||||
{
|
|
||||||
context.Response.StatusCode = 501;
|
|
||||||
context.Response.StatusDescription = "Not Implemented";
|
|
||||||
context.Response.End();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Handles GET method requests
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="context"></param>
|
|
||||||
protected virtual async Task HandleGet(HttpCwsContext context)
|
|
||||||
{
|
|
||||||
context.Response.StatusCode = 501;
|
|
||||||
context.Response.StatusDescription = "Not Implemented";
|
|
||||||
context.Response.End();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Handles HEAD method requests
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="context"></param>
|
|
||||||
protected virtual async Task HandleHead(HttpCwsContext context)
|
|
||||||
{
|
|
||||||
context.Response.StatusCode = 501;
|
|
||||||
context.Response.StatusDescription = "Not Implemented";
|
|
||||||
context.Response.End();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Handles OPTIONS method requests
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="context"></param>
|
|
||||||
protected virtual async Task HandleOptions(HttpCwsContext context)
|
|
||||||
{
|
|
||||||
context.Response.StatusCode = 501;
|
|
||||||
context.Response.StatusDescription = "Not Implemented";
|
|
||||||
context.Response.End();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Handles PATCH method requests
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="context"></param>
|
|
||||||
protected virtual async Task HandlePatch(HttpCwsContext context)
|
|
||||||
{
|
|
||||||
context.Response.StatusCode = 501;
|
|
||||||
context.Response.StatusDescription = "Not Implemented";
|
|
||||||
context.Response.End();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Handles POST method requests
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="context"></param>
|
|
||||||
protected virtual async Task HandlePost(HttpCwsContext context)
|
|
||||||
{
|
|
||||||
context.Response.StatusCode = 501;
|
|
||||||
context.Response.StatusDescription = "Not Implemented";
|
|
||||||
context.Response.End();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Handles PUT method requests
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="context"></param>
|
|
||||||
protected virtual async Task HandlePut(HttpCwsContext context)
|
|
||||||
{
|
|
||||||
context.Response.StatusCode = 501;
|
|
||||||
context.Response.StatusDescription = "Not Implemented";
|
|
||||||
context.Response.End();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Handles TRACE method requests
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="context"></param>
|
|
||||||
protected virtual async Task HandleTrace(HttpCwsContext context)
|
|
||||||
{
|
|
||||||
context.Response.StatusCode = 501;
|
|
||||||
context.Response.StatusDescription = "Not Implemented";
|
|
||||||
context.Response.End();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Process request
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="context"></param>
|
|
||||||
/// <summary>
|
|
||||||
/// ProcessRequest method
|
|
||||||
/// </summary>
|
|
||||||
public void ProcessRequest(HttpCwsContext context)
|
|
||||||
{
|
|
||||||
if (!_handlers.TryGetValue(context.Request.HttpMethod, out Func<HttpCwsContext, Task> handler))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (EnableCors)
|
|
||||||
{
|
|
||||||
context.Response.Headers.Add("Access-Control-Allow-Origin", "*");
|
|
||||||
context.Response.Headers.Add("Access-Control-Allow-Methods", "POST, GET, OPTIONS");
|
|
||||||
}
|
|
||||||
|
|
||||||
var handlerTask = handler(context);
|
|
||||||
|
|
||||||
handlerTask.GetAwaiter().GetResult();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Crestron.SimplSharp.WebScripting;
|
using Crestron.SimplSharp.WebScripting;
|
||||||
|
|
||||||
namespace PepperDash.Core.Web.RequestHandlers
|
namespace PepperDash.Core.Web.RequestHandlers;
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// CWS Base Handler, implements IHttpCwsHandler
|
/// CWS Base Handler, implements IHttpCwsHandler
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -164,5 +164,4 @@ namespace PepperDash.Core.Web.RequestHandlers
|
|||||||
|
|
||||||
handler(context);
|
handler(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -1,287 +1,252 @@
|
|||||||
using System;
|
extern alias NewtonsoftJson;
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
using Crestron.SimplSharp.WebScripting;
|
using Crestron.SimplSharp.WebScripting;
|
||||||
using Newtonsoft.Json;
|
using Formatting = NewtonsoftJson::Newtonsoft.Json.Formatting;
|
||||||
using Newtonsoft.Json.Linq;
|
using JsonConvert = NewtonsoftJson::Newtonsoft.Json.JsonConvert;
|
||||||
|
using JObject = NewtonsoftJson::Newtonsoft.Json.Linq.JObject;
|
||||||
using PepperDash.Core.Web.RequestHandlers;
|
using PepperDash.Core.Web.RequestHandlers;
|
||||||
|
using PepperDash.Core.Logging;
|
||||||
|
|
||||||
namespace PepperDash.Core.Web
|
namespace PepperDash.Core.Web;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Web API server
|
||||||
|
/// </summary>
|
||||||
|
public class WebApiServer : IKeyName
|
||||||
{
|
{
|
||||||
|
private const string SplusKey = "Uninitialized Web API Server";
|
||||||
|
private const string DefaultName = "Web API Server";
|
||||||
|
private const string DefaultBasePath = "/api";
|
||||||
|
|
||||||
|
private readonly object _serverLock = new();
|
||||||
|
private HttpCwsServer _server;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Web API server
|
/// Gets or sets the Key
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class WebApiServer : IKeyName
|
public string Key { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Name
|
||||||
|
/// </summary>
|
||||||
|
public string Name { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the BasePath
|
||||||
|
/// </summary>
|
||||||
|
public string BasePath { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the IsRegistered
|
||||||
|
/// </summary>
|
||||||
|
public bool IsRegistered { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor for S+. Make sure to set necessary properties using init method
|
||||||
|
/// </summary>
|
||||||
|
public WebApiServer()
|
||||||
|
: this(SplusKey, DefaultName, null)
|
||||||
{
|
{
|
||||||
private const string SplusKey = "Uninitialized Web API Server";
|
}
|
||||||
private const string DefaultName = "Web API Server";
|
|
||||||
private const string DefaultBasePath = "/api";
|
|
||||||
|
|
||||||
private const uint DebugTrace = 0;
|
/// <summary>
|
||||||
private const uint DebugInfo = 1;
|
/// Constructor
|
||||||
private const uint DebugVerbose = 2;
|
/// </summary>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <param name="basePath"></param>
|
||||||
|
public WebApiServer(string key, string basePath)
|
||||||
|
: this(key, DefaultName, basePath)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
private readonly CCriticalSection _serverLock = new CCriticalSection();
|
/// <summary>
|
||||||
private HttpCwsServer _server;
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <param name="name"></param>
|
||||||
|
/// <param name="basePath"></param>
|
||||||
|
public WebApiServer(string key, string name, string basePath)
|
||||||
|
{
|
||||||
|
Key = key;
|
||||||
|
Name = string.IsNullOrEmpty(name) ? DefaultName : name;
|
||||||
|
BasePath = string.IsNullOrEmpty(basePath) ? DefaultBasePath : basePath;
|
||||||
|
|
||||||
/// <summary>
|
if (_server == null) _server = new HttpCwsServer(BasePath);
|
||||||
/// Gets or sets the Key
|
|
||||||
/// </summary>
|
|
||||||
public string Key { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
_server.setProcessName(Key);
|
||||||
/// Gets or sets the Name
|
_server.HttpRequestHandler = new DefaultRequestHandler();
|
||||||
/// </summary>
|
|
||||||
public string Name { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
CrestronEnvironment.ProgramStatusEventHandler += CrestronEnvironment_ProgramStatusEventHandler;
|
||||||
/// Gets or sets the BasePath
|
CrestronEnvironment.EthernetEventHandler += CrestronEnvironment_EthernetEventHandler;
|
||||||
/// </summary>
|
}
|
||||||
public string BasePath { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the IsRegistered
|
/// Program status event handler
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsRegistered { get; private set; }
|
/// <param name="programEventType"></param>
|
||||||
|
void CrestronEnvironment_ProgramStatusEventHandler(eProgramStatusEventType programEventType)
|
||||||
|
{
|
||||||
|
if (programEventType != eProgramStatusEventType.Stopping) return;
|
||||||
|
|
||||||
/// <summary>
|
this.LogInformation("Program stopping. stopping server");
|
||||||
/// Http request handler
|
|
||||||
/// </summary>
|
|
||||||
//public IHttpCwsHandler HttpRequestHandler
|
|
||||||
//{
|
|
||||||
// get { return _server.HttpRequestHandler; }
|
|
||||||
// set
|
|
||||||
// {
|
|
||||||
// if (_server == null) return;
|
|
||||||
// _server.HttpRequestHandler = value;
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
/// <summary>
|
Stop();
|
||||||
/// Received request event handler
|
}
|
||||||
/// </summary>
|
|
||||||
//public event EventHandler<HttpCwsRequestEventArgs> ReceivedRequestEvent
|
|
||||||
//{
|
|
||||||
// add { _server.ReceivedRequestEvent += new HttpCwsRequestEventHandler(value); }
|
|
||||||
// remove { _server.ReceivedRequestEvent -= new HttpCwsRequestEventHandler(value); }
|
|
||||||
//}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructor for S+. Make sure to set necessary properties using init method
|
/// Ethernet event handler
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public WebApiServer()
|
/// <param name="ethernetEventArgs"></param>
|
||||||
: this(SplusKey, DefaultName, null)
|
void CrestronEnvironment_EthernetEventHandler(EthernetEventArgs ethernetEventArgs)
|
||||||
|
{
|
||||||
|
// Re-enable the server if the link comes back up and the status should be connected
|
||||||
|
if (ethernetEventArgs.EthernetEventType == eEthernetEventType.LinkUp && IsRegistered)
|
||||||
{
|
{
|
||||||
|
this.LogInformation("Ethernet link up. Server is already registered.");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
this.LogInformation("Ethernet link up. Starting server");
|
||||||
/// Constructor
|
|
||||||
/// </summary>
|
Start();
|
||||||
/// <param name="key"></param>
|
}
|
||||||
/// <param name="basePath"></param>
|
|
||||||
public WebApiServer(string key, string basePath)
|
/// <summary>
|
||||||
: this(key, DefaultName, basePath)
|
/// Initialize method
|
||||||
|
/// </summary>
|
||||||
|
public void Initialize(string key, string basePath)
|
||||||
|
{
|
||||||
|
Key = key;
|
||||||
|
BasePath = string.IsNullOrEmpty(basePath) ? DefaultBasePath : basePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a route to CWS
|
||||||
|
/// </summary>
|
||||||
|
public void AddRoute(HttpCwsRoute route)
|
||||||
|
{
|
||||||
|
if (route == null)
|
||||||
{
|
{
|
||||||
|
this.LogWarning("Failed to add route, route parameter is null");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
_server.Routes.Add(route);
|
||||||
/// Constructor
|
|
||||||
/// </summary>
|
}
|
||||||
/// <param name="key"></param>
|
|
||||||
/// <param name="name"></param>
|
/// <summary>
|
||||||
/// <param name="basePath"></param>
|
/// Removes a route from CWS
|
||||||
public WebApiServer(string key, string name, string basePath)
|
/// </summary>
|
||||||
|
/// <param name="route"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// RemoveRoute method
|
||||||
|
/// </summary>
|
||||||
|
public void RemoveRoute(HttpCwsRoute route)
|
||||||
|
{
|
||||||
|
if (route == null)
|
||||||
{
|
{
|
||||||
Key = key;
|
this.LogWarning("Failed to remove route, route parameter is null");
|
||||||
Name = string.IsNullOrEmpty(name) ? DefaultName : name;
|
return;
|
||||||
BasePath = string.IsNullOrEmpty(basePath) ? DefaultBasePath : basePath;
|
|
||||||
|
|
||||||
if (_server == null) _server = new HttpCwsServer(BasePath);
|
|
||||||
|
|
||||||
_server.setProcessName(Key);
|
|
||||||
_server.HttpRequestHandler = new DefaultRequestHandler();
|
|
||||||
|
|
||||||
CrestronEnvironment.ProgramStatusEventHandler += CrestronEnvironment_ProgramStatusEventHandler;
|
|
||||||
CrestronEnvironment.EthernetEventHandler += CrestronEnvironment_EthernetEventHandler;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
_server.Routes.Remove(route);
|
||||||
/// Program status event handler
|
}
|
||||||
/// </summary>
|
|
||||||
/// <param name="programEventType"></param>
|
|
||||||
void CrestronEnvironment_ProgramStatusEventHandler(eProgramStatusEventType programEventType)
|
|
||||||
{
|
|
||||||
if (programEventType != eProgramStatusEventType.Stopping) return;
|
|
||||||
|
|
||||||
Debug.Console(DebugInfo, this, "Program stopping. stopping server");
|
/// <summary>
|
||||||
|
/// GetRouteCollection method
|
||||||
|
/// </summary>
|
||||||
|
public HttpCwsRouteCollection GetRouteCollection()
|
||||||
|
{
|
||||||
|
return _server.Routes;
|
||||||
|
}
|
||||||
|
|
||||||
Stop();
|
/// <summary>
|
||||||
}
|
/// Starts CWS instance
|
||||||
|
/// </summary>
|
||||||
/// <summary>
|
public void Start()
|
||||||
/// Ethernet event handler
|
{
|
||||||
/// </summary>
|
lock (_serverLock)
|
||||||
/// <param name="ethernetEventArgs"></param>
|
|
||||||
void CrestronEnvironment_EthernetEventHandler(EthernetEventArgs ethernetEventArgs)
|
|
||||||
{
|
|
||||||
// Re-enable the server if the link comes back up and the status should be connected
|
|
||||||
if (ethernetEventArgs.EthernetEventType == eEthernetEventType.LinkUp && IsRegistered)
|
|
||||||
{
|
|
||||||
Debug.Console(DebugInfo, this, "Ethernet link up. Server is alreedy registered.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Debug.Console(DebugInfo, this, "Ethernet link up. Starting server");
|
|
||||||
|
|
||||||
Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initialize method
|
|
||||||
/// </summary>
|
|
||||||
public void Initialize(string key, string basePath)
|
|
||||||
{
|
|
||||||
Key = key;
|
|
||||||
BasePath = string.IsNullOrEmpty(basePath) ? DefaultBasePath : basePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Adds a route to CWS
|
|
||||||
/// </summary>
|
|
||||||
public void AddRoute(HttpCwsRoute route)
|
|
||||||
{
|
|
||||||
if (route == null)
|
|
||||||
{
|
|
||||||
Debug.Console(DebugInfo, this, "Failed to add route, route parameter is null");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_server.Routes.Add(route);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Removes a route from CWS
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="route"></param>
|
|
||||||
/// <summary>
|
|
||||||
/// RemoveRoute method
|
|
||||||
/// </summary>
|
|
||||||
public void RemoveRoute(HttpCwsRoute route)
|
|
||||||
{
|
|
||||||
if (route == null)
|
|
||||||
{
|
|
||||||
Debug.Console(DebugInfo, this, "Failed to remote route, orute parameter is null");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_server.Routes.Remove(route);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// GetRouteCollection method
|
|
||||||
/// </summary>
|
|
||||||
public HttpCwsRouteCollection GetRouteCollection()
|
|
||||||
{
|
|
||||||
return _server.Routes;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Starts CWS instance
|
|
||||||
/// </summary>
|
|
||||||
public void Start()
|
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_serverLock.Enter();
|
|
||||||
|
|
||||||
if (_server == null)
|
if (_server == null)
|
||||||
{
|
{
|
||||||
Debug.Console(DebugInfo, this, "Server is null, unable to start");
|
this.LogDebug("Server is null, unable to start");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsRegistered)
|
if (IsRegistered)
|
||||||
{
|
{
|
||||||
Debug.Console(DebugInfo, this, "Server has already been started");
|
this.LogDebug("Server has already been started");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
IsRegistered = _server.Register();
|
IsRegistered = _server.Register();
|
||||||
|
|
||||||
Debug.Console(DebugInfo, this, "Starting server, registration {0}", IsRegistered ? "was successful" : "failed");
|
this.LogDebug("Starting server, registration {0}", IsRegistered ? "was successful" : "failed");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Debug.Console(DebugInfo, this, "Start Exception Message: {0}", ex.Message);
|
this.LogException(ex, "Start Exception Message: {0}", ex.Message);
|
||||||
Debug.Console(DebugVerbose, this, "Start Exception StackTrace: {0}", ex.StackTrace);
|
this.LogVerbose("Start Exception StackTrace: {0}", ex.StackTrace);
|
||||||
if (ex.InnerException != null)
|
|
||||||
Debug.Console(DebugVerbose, this, "Start Exception InnerException: {0}", ex.InnerException);
|
|
||||||
}
|
}
|
||||||
finally
|
} // end lock
|
||||||
{
|
}
|
||||||
_serverLock.Leave();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stop method
|
/// Stop method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Stop()
|
public void Stop()
|
||||||
|
{
|
||||||
|
lock (_serverLock)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_serverLock.Enter();
|
|
||||||
|
|
||||||
if (_server == null)
|
if (_server == null)
|
||||||
{
|
{
|
||||||
Debug.Console(DebugInfo, this, "Server is null or has already been stopped");
|
this.LogDebug("Server is null or has already been stopped");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
IsRegistered = _server.Unregister() == false;
|
IsRegistered = _server.Unregister() == false;
|
||||||
|
|
||||||
Debug.Console(DebugInfo, this, "Stopping server, unregistration {0}", IsRegistered ? "failed" : "was successful");
|
this.LogDebug("Stopping server, unregistration {0}", IsRegistered ? "failed" : "was successful");
|
||||||
|
|
||||||
_server.Dispose();
|
_server.Dispose();
|
||||||
_server = null;
|
_server = null;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Debug.Console(DebugInfo, this, "Server Stop Exception Message: {0}", ex.Message);
|
this.LogException(ex, "Server Stop Exception Message: {0}", ex.Message);
|
||||||
Debug.Console(DebugVerbose, this, "Server Stop Exception StackTrace: {0}", ex.StackTrace);
|
|
||||||
if (ex.InnerException != null)
|
|
||||||
Debug.Console(DebugVerbose, this, "Server Stop Exception InnerException: {0}", ex.InnerException);
|
|
||||||
}
|
}
|
||||||
finally
|
} // end lock
|
||||||
{
|
}
|
||||||
_serverLock.Leave();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Received request handler
|
/// Received request handler
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// This is here for development and testing
|
/// This is here for development and testing
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="sender"></param>
|
/// <param name="sender"></param>
|
||||||
/// <param name="args"></param>
|
/// <param name="args"></param>
|
||||||
public void ReceivedRequestEventHandler(object sender, HttpCwsRequestEventArgs args)
|
public void ReceivedRequestEventHandler(object sender, HttpCwsRequestEventArgs args)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
try
|
var j = JsonConvert.SerializeObject(args.Context, Formatting.Indented);
|
||||||
{
|
this.LogVerbose("RecieveRequestEventHandler Context:\x0d\x0a{0}", j);
|
||||||
var j = JsonConvert.SerializeObject(args.Context, Formatting.Indented);
|
}
|
||||||
Debug.Console(DebugVerbose, this, "RecieveRequestEventHandler Context:\x0d\x0a{0}", j);
|
catch (Exception ex)
|
||||||
}
|
{
|
||||||
catch (Exception ex)
|
this.LogException(ex, "ReceivedRequestEventHandler Exception Message: {0}", ex.Message);
|
||||||
{
|
this.LogVerbose("ReceivedRequestEventHandler Exception StackTrace: {0}", ex.StackTrace);
|
||||||
Debug.Console(DebugInfo, this, "ReceivedRequestEventHandler Exception Message: {0}", ex.Message);
|
|
||||||
Debug.Console(DebugVerbose, this, "ReceivedRequestEventHandler Exception StackTrace: {0}", ex.StackTrace);
|
|
||||||
if (ex.InnerException != null)
|
|
||||||
Debug.Console(DebugVerbose, this, "ReceivedRequestEventHandler Exception InnerException: {0}", ex.InnerException);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,45 +1,45 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
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>
|
||||||
/// ID of preset
|
/// ID of preset
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the UserId
|
/// User ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int UserId { get; set; }
|
public int UserId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the RoomTypeId
|
/// Room Type ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int RoomTypeId { get; set; }
|
public int RoomTypeId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the PresetName
|
/// Preset Name
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string PresetName { get; set; }
|
public string PresetName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the PresetNumber
|
/// Preset Number
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int PresetNumber { get; set; }
|
public int PresetNumber { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Data
|
/// Preset Data
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Data { get; set; }
|
public string Data { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructor
|
/// Constructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Preset()
|
public Preset()
|
||||||
{
|
{
|
||||||
PresetName = "";
|
PresetName = "";
|
||||||
@@ -53,35 +53,34 @@ namespace PepperDash.Core.WebApi.Presets
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class PresetReceivedEventArgs : EventArgs
|
public class PresetReceivedEventArgs : EventArgs
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// True when the preset is found
|
/// True when the preset is found
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool LookupSuccess { get; private set; }
|
public bool LookupSuccess { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the ULookupSuccess
|
/// S+ helper
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ushort ULookupSuccess { get { return (ushort)(LookupSuccess ? 1 : 0); } }
|
public ushort ULookupSuccess { get { return (ushort)(LookupSuccess ? 1 : 0); } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Preset
|
/// The preset
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Preset Preset { get; private set; }
|
public Preset Preset { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// For Simpl+
|
/// For Simpl+
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public PresetReceivedEventArgs() { }
|
public PresetReceivedEventArgs() { }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructor
|
/// Constructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="preset"></param>
|
/// <param name="preset"></param>
|
||||||
/// <param name="success"></param>
|
/// <param name="success"></param>
|
||||||
public PresetReceivedEventArgs(Preset preset, bool success)
|
public PresetReceivedEventArgs(Preset preset, bool success)
|
||||||
{
|
{
|
||||||
LookupSuccess = success;
|
LookupSuccess = success;
|
||||||
Preset = preset;
|
Preset = preset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -4,31 +4,31 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
|
|
||||||
namespace PepperDash.Core.WebApi.Presets
|
namespace PepperDash.Core.WebApi.Presets;
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class User
|
public class User
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </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; }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,19 +38,19 @@ namespace PepperDash.Core.WebApi.Presets
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class UserReceivedEventArgs : EventArgs
|
public class UserReceivedEventArgs : EventArgs
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// True when user is found
|
/// True when user is found
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool LookupSuccess { get; private set; }
|
public bool LookupSuccess { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the ULookupSuccess
|
/// For stupid S+
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ushort ULookupSuccess { get { return (ushort)(LookupSuccess ? 1 : 0); } }
|
public ushort ULookupSuccess { get { return (ushort)(LookupSuccess ? 1 : 0); } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the User
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public User User { get; private set; }
|
public User User { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -58,14 +58,14 @@ namespace PepperDash.Core.WebApi.Presets
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public UserReceivedEventArgs() { }
|
public UserReceivedEventArgs() { }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructor
|
/// Constructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="user"></param>
|
/// <param name="user"></param>
|
||||||
/// <param name="success"></param>
|
/// <param name="success"></param>
|
||||||
public UserReceivedEventArgs(User user, bool success)
|
public UserReceivedEventArgs(User user, bool success)
|
||||||
{
|
{
|
||||||
LookupSuccess = success;
|
LookupSuccess = success;
|
||||||
User = user;
|
User = user;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -75,19 +75,18 @@ namespace PepperDash.Core.WebApi.Presets
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class UserAndRoomMessage
|
public class UserAndRoomMessage
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </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; }
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -1,33 +1,35 @@
|
|||||||
using System;
|
extern alias NewtonsoftJson;
|
||||||
|
|
||||||
|
using System;
|
||||||
using Crestron.SimplSharp; // For Basic SIMPL# Classes
|
using Crestron.SimplSharp; // For Basic SIMPL# Classes
|
||||||
using Crestron.SimplSharp.CrestronIO;
|
using Crestron.SimplSharp.CrestronIO;
|
||||||
using Crestron.SimplSharp.Net.Http;
|
using Crestron.SimplSharp.Net.Http;
|
||||||
using Crestron.SimplSharp.Net.Https;
|
using Crestron.SimplSharp.Net.Https;
|
||||||
using Newtonsoft.Json;
|
using JsonConvert = NewtonsoftJson::Newtonsoft.Json.JsonConvert;
|
||||||
using Newtonsoft.Json.Linq;
|
using JObject = NewtonsoftJson::Newtonsoft.Json.Linq.JObject;
|
||||||
using PepperDash.Core.JsonToSimpl;
|
using PepperDash.Core.JsonToSimpl;
|
||||||
|
|
||||||
|
|
||||||
namespace PepperDash.Core.WebApi.Presets
|
namespace PepperDash.Core.WebApi.Presets;
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Passcode client for the WebApi
|
/// Passcode client for the WebApi
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class WebApiPasscodeClient : IKeyed
|
public class WebApiPasscodeClient : IKeyed
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Notifies when user received
|
/// Notifies when user received
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event EventHandler<UserReceivedEventArgs> UserReceived;
|
public event EventHandler<UserReceivedEventArgs> UserReceived;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Notifies when Preset received
|
/// Notifies when Preset received
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event EventHandler<PresetReceivedEventArgs> PresetReceived;
|
public event EventHandler<PresetReceivedEventArgs> PresetReceived;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Key
|
/// Unique identifier for this instance
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Key { get; private set; }
|
public string Key { get; private set; }
|
||||||
|
|
||||||
//string JsonMasterKey;
|
//string JsonMasterKey;
|
||||||
@@ -54,13 +56,13 @@ namespace PepperDash.Core.WebApi.Presets
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes the instance
|
/// Initializes the instance
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="key"></param>
|
/// <param name="key"></param>
|
||||||
/// <param name="jsonMasterKey"></param>
|
/// <param name="jsonMasterKey"></param>
|
||||||
/// <param name="urlBase"></param>
|
/// <param name="urlBase"></param>
|
||||||
/// <param name="defaultPresetJsonFilePath"></param>
|
/// <param name="defaultPresetJsonFilePath"></param>
|
||||||
public void Initialize(string key, string jsonMasterKey, string urlBase, string defaultPresetJsonFilePath)
|
public void Initialize(string key, string jsonMasterKey, string urlBase, string defaultPresetJsonFilePath)
|
||||||
{
|
{
|
||||||
Key = key;
|
Key = key;
|
||||||
@@ -73,44 +75,41 @@ namespace PepperDash.Core.WebApi.Presets
|
|||||||
J2SMaster.Initialize(jsonMasterKey);
|
J2SMaster.Initialize(jsonMasterKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 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
|
||||||
// except for https/http and the certificate ignores
|
// except for https/http and the certificate ignores
|
||||||
if (!UrlBase.StartsWith("https"))
|
if (!UrlBase.StartsWith("https"))
|
||||||
return;
|
return;
|
||||||
var req = new HttpsClientRequest();
|
var req = new HttpsClientRequest();
|
||||||
req.Url = new UrlParser(UrlBase + "/api/users/dopin");
|
req.Url = new UrlParser(UrlBase + "/api/users/dopin");
|
||||||
req.RequestType = Crestron.SimplSharp.Net.Https.RequestType.Post;
|
req.RequestType = Crestron.SimplSharp.Net.Https.RequestType.Post;
|
||||||
req.Header.AddHeader(new HttpsHeader("Content-Type", "application/json"));
|
req.Header.AddHeader(new HttpsHeader("Content-Type", "application/json"));
|
||||||
req.Header.AddHeader(new HttpsHeader("Accept", "application/json"));
|
req.Header.AddHeader(new HttpsHeader("Accept", "application/json"));
|
||||||
var jo = new JObject();
|
var jo = new JObject();
|
||||||
jo.Add("pin", passcode);
|
jo.Add("pin", passcode);
|
||||||
req.ContentString = jo.ToString();
|
req.ContentString = jo.ToString();
|
||||||
|
|
||||||
var client = new HttpsClient();
|
var client = new HttpsClient();
|
||||||
client.HostVerification = false;
|
client.HostVerification = false;
|
||||||
client.PeerVerification = false;
|
client.PeerVerification = false;
|
||||||
var resp = client.Dispatch(req);
|
var resp = client.Dispatch(req);
|
||||||
var handler = UserReceived;
|
var handler = UserReceived;
|
||||||
if (resp.Code == 200)
|
if (resp.Code == 200)
|
||||||
{
|
{
|
||||||
//CrestronConsole.PrintLine("Received: {0}", resp.ContentString);
|
//CrestronConsole.PrintLine("Received: {0}", resp.ContentString);
|
||||||
var user = JsonConvert.DeserializeObject<User>(resp.ContentString);
|
var user = JsonConvert.DeserializeObject<User>(resp.ContentString);
|
||||||
CurrentUser = user;
|
CurrentUser = user;
|
||||||
if (handler != null)
|
if (handler != null)
|
||||||
UserReceived(this, new UserReceivedEventArgs(user, true));
|
UserReceived(this, new UserReceivedEventArgs(user, true));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (handler != null)
|
if (handler != null)
|
||||||
UserReceived(this, new UserReceivedEventArgs(null, false));
|
UserReceived(this, new UserReceivedEventArgs(null, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -136,57 +135,57 @@ namespace PepperDash.Core.WebApi.Presets
|
|||||||
PresetNumber = presetNumber
|
PresetNumber = presetNumber
|
||||||
};
|
};
|
||||||
|
|
||||||
var handler = PresetReceived;
|
var handler = PresetReceived;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (!UrlBase.StartsWith("https"))
|
if (!UrlBase.StartsWith("https"))
|
||||||
return;
|
return;
|
||||||
var req = new HttpsClientRequest();
|
var req = new HttpsClientRequest();
|
||||||
req.Url = new UrlParser(UrlBase + "/api/presets/userandroom");
|
req.Url = new UrlParser(UrlBase + "/api/presets/userandroom");
|
||||||
req.RequestType = Crestron.SimplSharp.Net.Https.RequestType.Post;
|
req.RequestType = Crestron.SimplSharp.Net.Https.RequestType.Post;
|
||||||
req.Header.AddHeader(new HttpsHeader("Content-Type", "application/json"));
|
req.Header.AddHeader(new HttpsHeader("Content-Type", "application/json"));
|
||||||
req.Header.AddHeader(new HttpsHeader("Accept", "application/json"));
|
req.Header.AddHeader(new HttpsHeader("Accept", "application/json"));
|
||||||
req.ContentString = JsonConvert.SerializeObject(msg);
|
req.ContentString = JsonConvert.SerializeObject(msg);
|
||||||
|
|
||||||
var client = new HttpsClient();
|
var client = new HttpsClient();
|
||||||
client.HostVerification = false;
|
client.HostVerification = false;
|
||||||
client.PeerVerification = false;
|
client.PeerVerification = false;
|
||||||
|
|
||||||
// ask for the preset
|
// ask for the preset
|
||||||
var resp = client.Dispatch(req);
|
var resp = client.Dispatch(req);
|
||||||
if (resp.Code == 200) // got it
|
if (resp.Code == 200) // got it
|
||||||
|
{
|
||||||
|
//Debug.Console(1, this, "Received: {0}", resp.ContentString);
|
||||||
|
var preset = JsonConvert.DeserializeObject<Preset>(resp.ContentString);
|
||||||
|
CurrentPreset = preset;
|
||||||
|
|
||||||
|
//if there's no preset data, load the template
|
||||||
|
if (preset.Data == null || preset.Data.Trim() == string.Empty || JObject.Parse(preset.Data).Count == 0)
|
||||||
{
|
{
|
||||||
//Debug.Console(1, this, "Received: {0}", resp.ContentString);
|
//Debug.Console(1, this, "Loaded preset has no data. Loading default template.");
|
||||||
var preset = JsonConvert.DeserializeObject<Preset>(resp.ContentString);
|
|
||||||
CurrentPreset = preset;
|
|
||||||
|
|
||||||
//if there's no preset data, load the template
|
|
||||||
if (preset.Data == null || preset.Data.Trim() == string.Empty || JObject.Parse(preset.Data).Count == 0)
|
|
||||||
{
|
|
||||||
//Debug.Console(1, this, "Loaded preset has no data. Loading default template.");
|
|
||||||
LoadDefaultPresetData();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
J2SMaster.LoadWithJson(preset.Data);
|
|
||||||
if (handler != null)
|
|
||||||
PresetReceived(this, new PresetReceivedEventArgs(preset, true));
|
|
||||||
}
|
|
||||||
else // no existing preset
|
|
||||||
{
|
|
||||||
CurrentPreset = new Preset();
|
|
||||||
LoadDefaultPresetData();
|
LoadDefaultPresetData();
|
||||||
if (handler != null)
|
return;
|
||||||
PresetReceived(this, new PresetReceivedEventArgs(null, false));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
J2SMaster.LoadWithJson(preset.Data);
|
||||||
|
if (handler != null)
|
||||||
|
PresetReceived(this, new PresetReceivedEventArgs(preset, true));
|
||||||
|
}
|
||||||
|
else // no existing preset
|
||||||
|
{
|
||||||
|
CurrentPreset = new Preset();
|
||||||
|
LoadDefaultPresetData();
|
||||||
|
if (handler != null)
|
||||||
|
PresetReceived(this, new PresetReceivedEventArgs(null, false));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (HttpException e)
|
catch (HttpException e)
|
||||||
{
|
{
|
||||||
var resp = e.Response;
|
var resp = e.Response;
|
||||||
Debug.Console(1, this, "No preset received (code {0}). Loading default template", resp.Code);
|
Debug.Console(1, this, "No preset received (code {0}). Loading default template", resp.Code);
|
||||||
LoadDefaultPresetData();
|
LoadDefaultPresetData();
|
||||||
if (handler != null)
|
if (handler != null)
|
||||||
PresetReceived(this, new PresetReceivedEventArgs(null, false));
|
PresetReceived(this, new PresetReceivedEventArgs(null, false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -245,8 +244,8 @@ namespace PepperDash.Core.WebApi.Presets
|
|||||||
{
|
{
|
||||||
CurrentPreset.Data = json;
|
CurrentPreset.Data = json;
|
||||||
|
|
||||||
if (!UrlBase.StartsWith("https"))
|
if (!UrlBase.StartsWith("https"))
|
||||||
return;
|
return;
|
||||||
var req = new HttpsClientRequest();
|
var req = new HttpsClientRequest();
|
||||||
req.RequestType = Crestron.SimplSharp.Net.Https.RequestType.Post;
|
req.RequestType = Crestron.SimplSharp.Net.Https.RequestType.Post;
|
||||||
req.Url = new UrlParser(string.Format("{0}/api/presets/addorchange", UrlBase));
|
req.Url = new UrlParser(string.Format("{0}/api/presets/addorchange", UrlBase));
|
||||||
@@ -255,8 +254,8 @@ namespace PepperDash.Core.WebApi.Presets
|
|||||||
req.ContentString = JsonConvert.SerializeObject(CurrentPreset);
|
req.ContentString = JsonConvert.SerializeObject(CurrentPreset);
|
||||||
|
|
||||||
var client = new HttpsClient();
|
var client = new HttpsClient();
|
||||||
client.HostVerification = false;
|
client.HostVerification = false;
|
||||||
client.PeerVerification = false;
|
client.PeerVerification = false;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var resp = client.Dispatch(req);
|
var resp = client.Dispatch(req);
|
||||||
@@ -279,4 +278,3 @@ namespace PepperDash.Core.WebApi.Presets
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,25 +1,24 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using PepperDash.Core.Intersystem.Tokens;
|
using PepperDash.Core.Intersystem.Tokens;
|
||||||
|
|
||||||
namespace PepperDash.Core.Intersystem.Serialization
|
namespace PepperDash.Core.Intersystem.Serialization;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Interface to determine XSig serialization for an object.
|
||||||
|
/// </summary>
|
||||||
|
public interface IXSigSerialization
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interface to determine XSig serialization for an object.
|
/// Serialize the sig data
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IXSigSerialization
|
/// <returns></returns>
|
||||||
{
|
IEnumerable<XSigToken> Serialize();
|
||||||
/// <summary>
|
|
||||||
/// Serialize the sig data
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
IEnumerable<XSigToken> Serialize();
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Deserialize the sig data
|
/// Deserialize the sig data
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="T"></typeparam>
|
/// <typeparam name="T"></typeparam>
|
||||||
/// <param name="tokens"></param>
|
/// <param name="tokens"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
T Deserialize<T>(IEnumerable<XSigToken> tokens) where T : class, IXSigSerialization;
|
T Deserialize<T>(IEnumerable<XSigToken> tokens) where T : class, IXSigSerialization;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,28 +1,27 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace PepperDash.Core.Intersystem.Serialization
|
namespace PepperDash.Core.Intersystem.Serialization;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Class to handle this specific exception type
|
||||||
|
/// </summary>
|
||||||
|
public class XSigSerializationException : Exception
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class to handle this specific exception type
|
/// default constructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class XSigSerializationException : Exception
|
public XSigSerializationException() { }
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// default constructor
|
|
||||||
/// </summary>
|
|
||||||
public XSigSerializationException() { }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// constructor with message
|
/// constructor with message
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="message"></param>
|
/// <param name="message"></param>
|
||||||
public XSigSerializationException(string message) : base(message) { }
|
public XSigSerializationException(string message) : base(message) { }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// constructor with message and innner exception
|
/// constructor with message and innner exception
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="message"></param>
|
/// <param name="message"></param>
|
||||||
/// <param name="inner"></param>
|
/// <param name="inner"></param>
|
||||||
public XSigSerializationException(string message, Exception inner) : base(message, inner) { }
|
public XSigSerializationException(string message, Exception inner) : base(message, inner) { }
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,98 +1,87 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace PepperDash.Core.Intersystem.Tokens
|
namespace PepperDash.Core.Intersystem.Tokens;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents an XSigAnalogToken
|
||||||
|
/// </summary>
|
||||||
|
public sealed class XSigAnalogToken : XSigToken, IFormattable
|
||||||
{
|
{
|
||||||
|
private readonly ushort _value;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents an XSigAnalogToken
|
/// Constructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class XSigAnalogToken : XSigToken, IFormattable
|
/// <param name="index"></param>
|
||||||
|
/// <param name="value"></param>
|
||||||
|
public XSigAnalogToken(int index, ushort value)
|
||||||
|
: base(index)
|
||||||
{
|
{
|
||||||
private readonly ushort _value;
|
// 10-bits available for analog encoded data
|
||||||
|
if (index >= 1024 || index < 0)
|
||||||
|
throw new ArgumentOutOfRangeException("index");
|
||||||
|
|
||||||
/// <summary>
|
_value = value;
|
||||||
/// Constructor
|
}
|
||||||
/// </summary>
|
|
||||||
/// <param name="index"></param>
|
|
||||||
/// <param name="value"></param>
|
|
||||||
public XSigAnalogToken(int index, ushort value)
|
|
||||||
: base(index)
|
|
||||||
{
|
|
||||||
// 10-bits available for analog encoded data
|
|
||||||
if (index >= 1024 || index < 0)
|
|
||||||
throw new ArgumentOutOfRangeException("index");
|
|
||||||
|
|
||||||
_value = value;
|
/// <summary>
|
||||||
}
|
///
|
||||||
|
/// </summary>
|
||||||
|
public ushort Value
|
||||||
|
{
|
||||||
|
get { return _value; }
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ushort Value
|
public override XSigTokenType TokenType
|
||||||
{
|
{
|
||||||
get { return _value; }
|
get { return XSigTokenType.Analog; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public override XSigTokenType TokenType
|
/// <returns></returns>
|
||||||
{
|
public override byte[] GetBytes()
|
||||||
get { return XSigTokenType.Analog; }
|
{
|
||||||
}
|
return new[] {
|
||||||
|
(byte)(0xC0 | ((Value & 0xC000) >> 10) | (Index - 1 >> 7)),
|
||||||
|
(byte)((Index - 1) & 0x7F),
|
||||||
|
(byte)((Value & 0x3F80) >> 7),
|
||||||
|
(byte)(Value & 0x7F)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <param name="offset"></param>
|
||||||
public override byte[] GetBytes()
|
/// <returns></returns>
|
||||||
{
|
public override XSigToken GetTokenWithOffset(int offset)
|
||||||
return new[] {
|
{
|
||||||
(byte)(0xC0 | ((Value & 0xC000) >> 10) | (Index - 1 >> 7)),
|
if (offset == 0) return this;
|
||||||
(byte)((Index - 1) & 0x7F),
|
return new XSigAnalogToken(Index + offset, Value);
|
||||||
(byte)((Value & 0x3F80) >> 7),
|
}
|
||||||
(byte)(Value & 0x7F)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="offset"></param>
|
/// <returns></returns>
|
||||||
/// <returns></returns>
|
public override string ToString()
|
||||||
/// <summary>
|
{
|
||||||
/// GetTokenWithOffset method
|
return Index + " = 0x" + Value.ToString("X4");
|
||||||
/// </summary>
|
}
|
||||||
public override XSigToken GetTokenWithOffset(int offset)
|
|
||||||
{
|
|
||||||
if (offset == 0) return this;
|
|
||||||
return new XSigAnalogToken(Index + offset, Value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <param name="format"></param>
|
||||||
/// <summary>
|
/// <param name="formatProvider"></param>
|
||||||
/// ToString method
|
/// <returns></returns>
|
||||||
/// </summary>
|
public string ToString(string format, IFormatProvider formatProvider)
|
||||||
/// <inheritdoc />
|
{
|
||||||
public override string ToString()
|
return Value.ToString(format, formatProvider);
|
||||||
{
|
|
||||||
return Index + " = 0x" + Value.ToString("X4");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="format"></param>
|
|
||||||
/// <param name="formatProvider"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
/// <summary>
|
|
||||||
/// ToString method
|
|
||||||
/// </summary>
|
|
||||||
public string ToString(string format, IFormatProvider formatProvider)
|
|
||||||
{
|
|
||||||
return Value.ToString(format, formatProvider);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,95 +1,84 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace PepperDash.Core.Intersystem.Tokens
|
namespace PepperDash.Core.Intersystem.Tokens;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents an XSigDigitalToken
|
||||||
|
/// </summary>
|
||||||
|
public sealed class XSigDigitalToken : XSigToken
|
||||||
{
|
{
|
||||||
|
private readonly bool _value;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents an XSigDigitalToken
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class XSigDigitalToken : XSigToken
|
/// <param name="index"></param>
|
||||||
|
/// <param name="value"></param>
|
||||||
|
public XSigDigitalToken(int index, bool value)
|
||||||
|
: base(index)
|
||||||
{
|
{
|
||||||
private readonly bool _value;
|
// 12-bits available for digital encoded data
|
||||||
|
if (index >= 4096 || index < 0)
|
||||||
|
throw new ArgumentOutOfRangeException("index");
|
||||||
|
|
||||||
/// <summary>
|
_value = value;
|
||||||
///
|
}
|
||||||
/// </summary>
|
|
||||||
/// <param name="index"></param>
|
|
||||||
/// <param name="value"></param>
|
|
||||||
public XSigDigitalToken(int index, bool value)
|
|
||||||
: base(index)
|
|
||||||
{
|
|
||||||
// 12-bits available for digital encoded data
|
|
||||||
if (index >= 4096 || index < 0)
|
|
||||||
throw new ArgumentOutOfRangeException("index");
|
|
||||||
|
|
||||||
_value = value;
|
/// <summary>
|
||||||
}
|
///
|
||||||
|
/// </summary>
|
||||||
|
public bool Value
|
||||||
|
{
|
||||||
|
get { return _value; }
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool Value
|
public override XSigTokenType TokenType
|
||||||
{
|
{
|
||||||
get { return _value; }
|
get { return XSigTokenType.Digital; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public override XSigTokenType TokenType
|
/// <returns></returns>
|
||||||
{
|
public override byte[] GetBytes()
|
||||||
get { return XSigTokenType.Digital; }
|
{
|
||||||
}
|
return new[] {
|
||||||
|
(byte)(0x80 | (Value ? 0 : 0x20) | ((Index - 1) >> 7)),
|
||||||
|
(byte)((Index - 1) & 0x7F)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <param name="offset"></param>
|
||||||
public override byte[] GetBytes()
|
/// <returns></returns>
|
||||||
{
|
public override XSigToken GetTokenWithOffset(int offset)
|
||||||
return new[] {
|
{
|
||||||
(byte)(0x80 | (Value ? 0 : 0x20) | ((Index - 1) >> 7)),
|
if (offset == 0) return this;
|
||||||
(byte)((Index - 1) & 0x7F)
|
return new XSigDigitalToken(Index + offset, Value);
|
||||||
};
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="offset"></param>
|
/// <returns></returns>
|
||||||
/// <returns></returns>
|
public override string ToString()
|
||||||
/// <summary>
|
{
|
||||||
/// GetTokenWithOffset method
|
return Index + " = " + (Value ? "High" : "Low");
|
||||||
/// </summary>
|
}
|
||||||
public override XSigToken GetTokenWithOffset(int offset)
|
|
||||||
{
|
|
||||||
if (offset == 0) return this;
|
|
||||||
return new XSigDigitalToken(Index + offset, Value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <param name="formatProvider"></param>
|
||||||
/// <summary>
|
/// <returns></returns>
|
||||||
/// ToString method
|
public string ToString(IFormatProvider formatProvider)
|
||||||
/// </summary>
|
{
|
||||||
/// <inheritdoc />
|
return Value.ToString(formatProvider);
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
return Index + " = " + (Value ? "High" : "Low");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="formatProvider"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
/// <summary>
|
|
||||||
/// ToString method
|
|
||||||
/// </summary>
|
|
||||||
public string ToString(IFormatProvider formatProvider)
|
|
||||||
{
|
|
||||||
return Value.ToString(formatProvider);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,88 +1,80 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace PepperDash.Core.Intersystem.Tokens
|
namespace PepperDash.Core.Intersystem.Tokens;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents an XSigSerialToken
|
||||||
|
/// </summary>
|
||||||
|
public sealed class XSigSerialToken : XSigToken
|
||||||
{
|
{
|
||||||
|
private readonly string _value;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents an XSigSerialToken
|
/// Constructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class XSigSerialToken : XSigToken
|
/// <param name="index"></param>
|
||||||
|
/// <param name="value"></param>
|
||||||
|
public XSigSerialToken(int index, string value)
|
||||||
|
: base(index)
|
||||||
{
|
{
|
||||||
private readonly string _value;
|
// 10-bits available for serial encoded data
|
||||||
|
if (index >= 1024 || index < 0)
|
||||||
|
throw new ArgumentOutOfRangeException("index");
|
||||||
|
|
||||||
/// <summary>
|
_value = value;
|
||||||
/// Constructor
|
}
|
||||||
/// </summary>
|
|
||||||
/// <param name="index"></param>
|
|
||||||
/// <param name="value"></param>
|
|
||||||
public XSigSerialToken(int index, string value)
|
|
||||||
: base(index)
|
|
||||||
{
|
|
||||||
// 10-bits available for serial encoded data
|
|
||||||
if (index >= 1024 || index < 0)
|
|
||||||
throw new ArgumentOutOfRangeException("index");
|
|
||||||
|
|
||||||
_value = value;
|
/// <summary>
|
||||||
}
|
///
|
||||||
|
/// </summary>
|
||||||
|
public string Value
|
||||||
|
{
|
||||||
|
get { return _value; }
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Value
|
public override XSigTokenType TokenType
|
||||||
{
|
{
|
||||||
get { return _value; }
|
get { return XSigTokenType.Serial; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public override XSigTokenType TokenType
|
/// <returns></returns>
|
||||||
{
|
public override byte[] GetBytes()
|
||||||
get { return XSigTokenType.Serial; }
|
{
|
||||||
}
|
var serialBytes = String.IsNullOrEmpty(Value) ? new byte[0] : Encoding.GetEncoding(28591).GetBytes(Value);
|
||||||
|
|
||||||
|
var xsig = new byte[serialBytes.Length + 3];
|
||||||
|
xsig[0] = (byte)(0xC8 | (Index - 1 >> 7));
|
||||||
|
xsig[1] = (byte)((Index - 1) & 0x7F);
|
||||||
|
xsig[xsig.Length - 1] = 0xFF;
|
||||||
|
|
||||||
/// <summary>
|
Buffer.BlockCopy(serialBytes, 0, xsig, 2, serialBytes.Length);
|
||||||
///
|
return xsig;
|
||||||
/// </summary>
|
}
|
||||||
/// <returns></returns>
|
|
||||||
public override byte[] GetBytes()
|
|
||||||
{
|
|
||||||
var serialBytes = String.IsNullOrEmpty(Value) ? new byte[0] : Encoding.GetEncoding(28591).GetBytes(Value);
|
|
||||||
|
|
||||||
var xsig = new byte[serialBytes.Length + 3];
|
|
||||||
xsig[0] = (byte)(0xC8 | (Index - 1 >> 7));
|
|
||||||
xsig[1] = (byte)((Index - 1) & 0x7F);
|
|
||||||
xsig[xsig.Length - 1] = 0xFF;
|
|
||||||
|
|
||||||
Buffer.BlockCopy(serialBytes, 0, xsig, 2, serialBytes.Length);
|
/// <summary>
|
||||||
return xsig;
|
///
|
||||||
}
|
/// </summary>
|
||||||
|
/// <param name="offset"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public override XSigToken GetTokenWithOffset(int offset)
|
||||||
|
{
|
||||||
|
if (offset == 0) return this;
|
||||||
|
return new XSigSerialToken(Index + offset, Value);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="offset"></param>
|
/// <returns></returns>
|
||||||
/// <returns></returns>
|
public override string ToString()
|
||||||
/// <summary>
|
{
|
||||||
/// GetTokenWithOffset method
|
return Index + " = \"" + Value + "\"";
|
||||||
/// </summary>
|
|
||||||
public override XSigToken GetTokenWithOffset(int offset)
|
|
||||||
{
|
|
||||||
if (offset == 0) return this;
|
|
||||||
return new XSigSerialToken(Index + offset, Value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
/// <summary>
|
|
||||||
/// ToString method
|
|
||||||
/// </summary>
|
|
||||||
/// <inheritdoc />
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
return Index + " = \"" + Value + "\"";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,45 +1,44 @@
|
|||||||
namespace PepperDash.Core.Intersystem.Tokens
|
namespace PepperDash.Core.Intersystem.Tokens;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents the base class for all XSig datatypes.
|
||||||
|
/// </summary>
|
||||||
|
public abstract class XSigToken
|
||||||
{
|
{
|
||||||
|
private readonly int _index;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents the base class for all XSig datatypes.
|
/// Constructs an XSigToken with the specified index.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class XSigToken
|
/// <param name="index">Index for the data.</param>
|
||||||
|
protected XSigToken(int index)
|
||||||
{
|
{
|
||||||
private readonly int _index;
|
_index = index;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Constructs an XSigToken with the specified index.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="index">Index for the data.</param>
|
|
||||||
protected XSigToken(int index)
|
|
||||||
{
|
|
||||||
_index = index;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// XSig 1-based index.
|
|
||||||
/// </summary>
|
|
||||||
public int Index
|
|
||||||
{
|
|
||||||
get { return _index; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// XSigToken type.
|
|
||||||
/// </summary>
|
|
||||||
public abstract XSigTokenType TokenType { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Generates the XSig bytes for the corresponding token.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>XSig byte array.</returns>
|
|
||||||
public abstract byte[] GetBytes();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns a new token if necessary with an updated index based on the specified offset.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="offset">Offset to adjust the index with.</param>
|
|
||||||
/// <returns>XSigToken</returns>
|
|
||||||
public abstract XSigToken GetTokenWithOffset(int offset);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// XSig 1-based index.
|
||||||
|
/// </summary>
|
||||||
|
public int Index
|
||||||
|
{
|
||||||
|
get { return _index; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// XSigToken type.
|
||||||
|
/// </summary>
|
||||||
|
public abstract XSigTokenType TokenType { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Generates the XSig bytes for the corresponding token.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>XSig byte array.</returns>
|
||||||
|
public abstract byte[] GetBytes();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a new token if necessary with an updated index based on the specified offset.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="offset">Offset to adjust the index with.</param>
|
||||||
|
/// <returns>XSigToken</returns>
|
||||||
|
public abstract XSigToken GetTokenWithOffset(int offset);
|
||||||
}
|
}
|
||||||
@@ -1,23 +1,22 @@
|
|||||||
namespace PepperDash.Core.Intersystem.Tokens
|
namespace PepperDash.Core.Intersystem.Tokens;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// XSig token types.
|
||||||
|
/// </summary>
|
||||||
|
public enum XSigTokenType
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// XSig token types.
|
/// Digital signal datatype.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public enum XSigTokenType
|
Digital,
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Digital signal datatype.
|
|
||||||
/// </summary>
|
|
||||||
Digital,
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Analog signal datatype.
|
/// Analog signal datatype.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Analog,
|
Analog,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Serial signal datatype.
|
/// Serial signal datatype.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Serial
|
Serial
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -18,264 +18,221 @@ using PepperDash.Core.Intersystem.Tokens;
|
|||||||
11111111 <- denotes end of data
|
11111111 <- denotes end of data
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace PepperDash.Core.Intersystem
|
namespace PepperDash.Core.Intersystem;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Helper methods for creating XSig byte sequences compatible with the Intersystem Communications (ISC) symbol.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Indexing is not from the start of each signal type but rather from the beginning of the first defined signal
|
||||||
|
/// the Intersystem Communications (ISC) symbol.
|
||||||
|
/// </remarks>
|
||||||
|
public static class XSigHelpers
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Helper methods for creating XSig byte sequences compatible with the Intersystem Communications (ISC) symbol.
|
/// Forces all outputs to 0.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <returns>Bytes in XSig format for clear outputs trigger.</returns>
|
||||||
/// Indexing is not from the start of each signal type but rather from the beginning of the first defined signal
|
public static byte[] ClearOutputs()
|
||||||
/// the Intersystem Communications (ISC) symbol.
|
|
||||||
/// </remarks>
|
|
||||||
public static class XSigHelpers
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
return new byte[] { 0xFC };
|
||||||
/// Forces all outputs to 0.
|
}
|
||||||
/// </summary>
|
|
||||||
/// <returns>Bytes in XSig format for clear outputs trigger.</returns>
|
/// <summary>
|
||||||
public static byte[] ClearOutputs()
|
/// Evaluate all inputs and re-transmit any digital, analog, and permanent serail signals not set to 0.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Bytes in XSig format for send status trigger.</returns>
|
||||||
|
public static byte[] SendStatus()
|
||||||
|
{
|
||||||
|
return new byte[] { 0xFD };
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get bytes for an IXSigStateResolver object.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="xSigSerialization">XSig state resolver.</param>
|
||||||
|
/// <returns>Bytes in XSig format for each token within the state representation.</returns>
|
||||||
|
public static byte[] GetBytes(IXSigSerialization xSigSerialization)
|
||||||
|
{
|
||||||
|
return GetBytes(xSigSerialization, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get bytes for an IXSigStateResolver object, with a specified offset.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="xSigSerialization">XSig state resolver.</param>
|
||||||
|
/// <param name="offset">Offset to which the data will be aligned.</param>
|
||||||
|
/// <returns>Bytes in XSig format for each token within the state representation.</returns>
|
||||||
|
public static byte[] GetBytes(IXSigSerialization xSigSerialization, int offset)
|
||||||
|
{
|
||||||
|
var tokens = xSigSerialization.Serialize();
|
||||||
|
if (tokens == null) return new byte[0];
|
||||||
|
using (var memoryStream = new MemoryStream())
|
||||||
{
|
{
|
||||||
return new byte[] { 0xFC };
|
using (var tokenWriter = new XSigTokenStreamWriter(memoryStream))
|
||||||
}
|
tokenWriter.WriteXSigData(xSigSerialization, offset);
|
||||||
|
|
||||||
/// <summary>
|
return memoryStream.ToArray();
|
||||||
/// Evaluate all inputs and re-transmit any digital, analog, and permanent serail signals not set to 0.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>Bytes in XSig format for send status trigger.</returns>
|
|
||||||
public static byte[] SendStatus()
|
|
||||||
{
|
|
||||||
return new byte[] { 0xFD };
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get bytes for an IXSigStateResolver object.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="xSigSerialization">XSig state resolver.</param>
|
|
||||||
/// <returns>Bytes in XSig format for each token within the state representation.</returns>
|
|
||||||
/// <summary>
|
|
||||||
/// GetBytes method
|
|
||||||
/// </summary>
|
|
||||||
public static byte[] GetBytes(IXSigSerialization xSigSerialization)
|
|
||||||
{
|
|
||||||
return GetBytes(xSigSerialization, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get bytes for an IXSigStateResolver object, with a specified offset.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="xSigSerialization">XSig state resolver.</param>
|
|
||||||
/// <param name="offset">Offset to which the data will be aligned.</param>
|
|
||||||
/// <returns>Bytes in XSig format for each token within the state representation.</returns>
|
|
||||||
/// <summary>
|
|
||||||
/// GetBytes method
|
|
||||||
/// </summary>
|
|
||||||
public static byte[] GetBytes(IXSigSerialization xSigSerialization, int offset)
|
|
||||||
{
|
|
||||||
var tokens = xSigSerialization.Serialize();
|
|
||||||
if (tokens == null) return new byte[0];
|
|
||||||
using (var memoryStream = new MemoryStream())
|
|
||||||
{
|
|
||||||
using (var tokenWriter = new XSigTokenStreamWriter(memoryStream))
|
|
||||||
tokenWriter.WriteXSigData(xSigSerialization, offset);
|
|
||||||
|
|
||||||
return memoryStream.ToArray();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get bytes for a single digital signal.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="index">1-based digital index</param>
|
|
||||||
/// <param name="value">Digital data to be encoded</param>
|
|
||||||
/// <returns>Bytes in XSig format for digtial information.</returns>
|
|
||||||
/// <summary>
|
|
||||||
/// GetBytes method
|
|
||||||
/// </summary>
|
|
||||||
public static byte[] GetBytes(int index, bool value)
|
|
||||||
{
|
|
||||||
return GetBytes(index, 0, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get bytes for a single digital signal.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="index">1-based digital index</param>
|
|
||||||
/// <param name="offset">Index offset.</param>
|
|
||||||
/// <param name="value">Digital data to be encoded</param>
|
|
||||||
/// <returns>Bytes in XSig format for digtial information.</returns>
|
|
||||||
/// <summary>
|
|
||||||
/// GetBytes method
|
|
||||||
/// </summary>
|
|
||||||
public static byte[] GetBytes(int index, int offset, bool value)
|
|
||||||
{
|
|
||||||
return new XSigDigitalToken(index + offset, value).GetBytes();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get byte sequence for multiple digital signals.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="startIndex">Starting index of the sequence.</param>
|
|
||||||
/// <param name="values">Digital signal value array.</param>
|
|
||||||
/// <returns>Byte sequence in XSig format for digital signal information.</returns>
|
|
||||||
/// <summary>
|
|
||||||
/// GetBytes method
|
|
||||||
/// </summary>
|
|
||||||
public static byte[] GetBytes(int startIndex, bool[] values)
|
|
||||||
{
|
|
||||||
return GetBytes(startIndex, 0, values);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get byte sequence for multiple digital signals.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="startIndex">Starting index of the sequence.</param>
|
|
||||||
/// <param name="offset">Index offset.</param>
|
|
||||||
/// <param name="values">Digital signal value array.</param>
|
|
||||||
/// <returns>Byte sequence in XSig format for digital signal information.</returns>
|
|
||||||
/// <summary>
|
|
||||||
/// GetBytes method
|
|
||||||
/// </summary>
|
|
||||||
public static byte[] GetBytes(int startIndex, int offset, bool[] values)
|
|
||||||
{
|
|
||||||
// Digital XSig data is 2 bytes per value
|
|
||||||
const int fixedLength = 2;
|
|
||||||
var bytes = new byte[values.Length * fixedLength];
|
|
||||||
for (var i = 0; i < values.Length; i++)
|
|
||||||
Buffer.BlockCopy(GetBytes(startIndex++, offset, values[i]), 0, bytes, i * fixedLength, fixedLength);
|
|
||||||
|
|
||||||
return bytes;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get bytes for a single analog signal.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="index">1-based analog index</param>
|
|
||||||
/// <param name="value">Analog data to be encoded</param>
|
|
||||||
/// <returns>Bytes in XSig format for analog signal information.</returns>
|
|
||||||
/// <summary>
|
|
||||||
/// GetBytes method
|
|
||||||
/// </summary>
|
|
||||||
public static byte[] GetBytes(int index, ushort value)
|
|
||||||
{
|
|
||||||
return GetBytes(index, 0, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get bytes for a single analog signal.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="index">1-based analog index</param>
|
|
||||||
/// <param name="offset">Index offset.</param>
|
|
||||||
/// <param name="value">Analog data to be encoded</param>
|
|
||||||
/// <returns>Bytes in XSig format for analog signal information.</returns>
|
|
||||||
/// <summary>
|
|
||||||
/// GetBytes method
|
|
||||||
/// </summary>
|
|
||||||
public static byte[] GetBytes(int index, int offset, ushort value)
|
|
||||||
{
|
|
||||||
return new XSigAnalogToken(index + offset, value).GetBytes();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get byte sequence for multiple analog signals.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="startIndex">Starting index of the sequence.</param>
|
|
||||||
/// <param name="values">Analog signal value array.</param>
|
|
||||||
/// <returns>Byte sequence in XSig format for analog signal information.</returns>
|
|
||||||
/// <summary>
|
|
||||||
/// GetBytes method
|
|
||||||
/// </summary>
|
|
||||||
public static byte[] GetBytes(int startIndex, ushort[] values)
|
|
||||||
{
|
|
||||||
return GetBytes(startIndex, 0, values);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get byte sequence for multiple analog signals.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="startIndex">Starting index of the sequence.</param>
|
|
||||||
/// <param name="offset">Index offset.</param>
|
|
||||||
/// <param name="values">Analog signal value array.</param>
|
|
||||||
/// <returns>Byte sequence in XSig format for analog signal information.</returns>
|
|
||||||
/// <summary>
|
|
||||||
/// GetBytes method
|
|
||||||
/// </summary>
|
|
||||||
public static byte[] GetBytes(int startIndex, int offset, ushort[] values)
|
|
||||||
{
|
|
||||||
// Analog XSig data is 4 bytes per value
|
|
||||||
const int fixedLength = 4;
|
|
||||||
var bytes = new byte[values.Length * fixedLength];
|
|
||||||
for (var i = 0; i < values.Length; i++)
|
|
||||||
Buffer.BlockCopy(GetBytes(startIndex++, offset, values[i]), 0, bytes, i * fixedLength, fixedLength);
|
|
||||||
|
|
||||||
return bytes;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get bytes for a single serial signal.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="index">1-based serial index</param>
|
|
||||||
/// <param name="value">Serial data to be encoded</param>
|
|
||||||
/// <returns>Bytes in XSig format for serial signal information.</returns>
|
|
||||||
/// <summary>
|
|
||||||
/// GetBytes method
|
|
||||||
/// </summary>
|
|
||||||
public static byte[] GetBytes(int index, string value)
|
|
||||||
{
|
|
||||||
return GetBytes(index, 0, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get bytes for a single serial signal.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="index">1-based serial index</param>
|
|
||||||
/// <param name="offset">Index offset.</param>
|
|
||||||
/// <param name="value">Serial data to be encoded</param>
|
|
||||||
/// <returns>Bytes in XSig format for serial signal information.</returns>
|
|
||||||
/// <summary>
|
|
||||||
/// GetBytes method
|
|
||||||
/// </summary>
|
|
||||||
public static byte[] GetBytes(int index, int offset, string value)
|
|
||||||
{
|
|
||||||
return new XSigSerialToken(index + offset, value).GetBytes();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get byte sequence for multiple serial signals.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="startIndex">Starting index of the sequence.</param>
|
|
||||||
/// <param name="values">Serial signal value array.</param>
|
|
||||||
/// <returns>Byte sequence in XSig format for serial signal information.</returns>
|
|
||||||
/// <summary>
|
|
||||||
/// GetBytes method
|
|
||||||
/// </summary>
|
|
||||||
public static byte[] GetBytes(int startIndex, string[] values)
|
|
||||||
{
|
|
||||||
return GetBytes(startIndex, 0, values);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get byte sequence for multiple serial signals.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="startIndex">Starting index of the sequence.</param>
|
|
||||||
/// <param name="offset">Index offset.</param>
|
|
||||||
/// <param name="values">Serial signal value array.</param>
|
|
||||||
/// <returns>Byte sequence in XSig format for serial signal information.</returns>
|
|
||||||
/// <summary>
|
|
||||||
/// GetBytes method
|
|
||||||
/// </summary>
|
|
||||||
public static byte[] GetBytes(int startIndex, int offset, string[] values)
|
|
||||||
{
|
|
||||||
// Serial XSig data is not fixed-length like the other formats
|
|
||||||
var dstOffset = 0;
|
|
||||||
var bytes = new byte[values.Sum(v => v.Length + 3)];
|
|
||||||
for (var i = 0; i < values.Length; i++)
|
|
||||||
{
|
|
||||||
var data = GetBytes(startIndex++, offset, values[i]);
|
|
||||||
Buffer.BlockCopy(data, 0, bytes, dstOffset, data.Length);
|
|
||||||
dstOffset += data.Length;
|
|
||||||
}
|
|
||||||
|
|
||||||
return bytes;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get bytes for a single digital signal.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="index">1-based digital index</param>
|
||||||
|
/// <param name="value">Digital data to be encoded</param>
|
||||||
|
/// <returns>Bytes in XSig format for digtial information.</returns>
|
||||||
|
public static byte[] GetBytes(int index, bool value)
|
||||||
|
{
|
||||||
|
return GetBytes(index, 0, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get bytes for a single digital signal.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="index">1-based digital index</param>
|
||||||
|
/// <param name="offset">Index offset.</param>
|
||||||
|
/// <param name="value">Digital data to be encoded</param>
|
||||||
|
/// <returns>Bytes in XSig format for digtial information.</returns>
|
||||||
|
public static byte[] GetBytes(int index, int offset, bool value)
|
||||||
|
{
|
||||||
|
return new XSigDigitalToken(index + offset, value).GetBytes();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get byte sequence for multiple digital signals.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="startIndex">Starting index of the sequence.</param>
|
||||||
|
/// <param name="values">Digital signal value array.</param>
|
||||||
|
/// <returns>Byte sequence in XSig format for digital signal information.</returns>
|
||||||
|
public static byte[] GetBytes(int startIndex, bool[] values)
|
||||||
|
{
|
||||||
|
return GetBytes(startIndex, 0, values);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get byte sequence for multiple digital signals.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="startIndex">Starting index of the sequence.</param>
|
||||||
|
/// <param name="offset">Index offset.</param>
|
||||||
|
/// <param name="values">Digital signal value array.</param>
|
||||||
|
/// <returns>Byte sequence in XSig format for digital signal information.</returns>
|
||||||
|
public static byte[] GetBytes(int startIndex, int offset, bool[] values)
|
||||||
|
{
|
||||||
|
// Digital XSig data is 2 bytes per value
|
||||||
|
const int fixedLength = 2;
|
||||||
|
var bytes = new byte[values.Length * fixedLength];
|
||||||
|
for (var i = 0; i < values.Length; i++)
|
||||||
|
Buffer.BlockCopy(GetBytes(startIndex++, offset, values[i]), 0, bytes, i * fixedLength, fixedLength);
|
||||||
|
|
||||||
|
return bytes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get bytes for a single analog signal.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="index">1-based analog index</param>
|
||||||
|
/// <param name="value">Analog data to be encoded</param>
|
||||||
|
/// <returns>Bytes in XSig format for analog signal information.</returns>
|
||||||
|
public static byte[] GetBytes(int index, ushort value)
|
||||||
|
{
|
||||||
|
return GetBytes(index, 0, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get bytes for a single analog signal.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="index">1-based analog index</param>
|
||||||
|
/// <param name="offset">Index offset.</param>
|
||||||
|
/// <param name="value">Analog data to be encoded</param>
|
||||||
|
/// <returns>Bytes in XSig format for analog signal information.</returns>
|
||||||
|
public static byte[] GetBytes(int index, int offset, ushort value)
|
||||||
|
{
|
||||||
|
return new XSigAnalogToken(index + offset, value).GetBytes();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get byte sequence for multiple analog signals.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="startIndex">Starting index of the sequence.</param>
|
||||||
|
/// <param name="values">Analog signal value array.</param>
|
||||||
|
/// <returns>Byte sequence in XSig format for analog signal information.</returns>
|
||||||
|
public static byte[] GetBytes(int startIndex, ushort[] values)
|
||||||
|
{
|
||||||
|
return GetBytes(startIndex, 0, values);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get byte sequence for multiple analog signals.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="startIndex">Starting index of the sequence.</param>
|
||||||
|
/// <param name="offset">Index offset.</param>
|
||||||
|
/// <param name="values">Analog signal value array.</param>
|
||||||
|
/// <returns>Byte sequence in XSig format for analog signal information.</returns>
|
||||||
|
public static byte[] GetBytes(int startIndex, int offset, ushort[] values)
|
||||||
|
{
|
||||||
|
// Analog XSig data is 4 bytes per value
|
||||||
|
const int fixedLength = 4;
|
||||||
|
var bytes = new byte[values.Length * fixedLength];
|
||||||
|
for (var i = 0; i < values.Length; i++)
|
||||||
|
Buffer.BlockCopy(GetBytes(startIndex++, offset, values[i]), 0, bytes, i * fixedLength, fixedLength);
|
||||||
|
|
||||||
|
return bytes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get bytes for a single serial signal.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="index">1-based serial index</param>
|
||||||
|
/// <param name="value">Serial data to be encoded</param>
|
||||||
|
/// <returns>Bytes in XSig format for serial signal information.</returns>
|
||||||
|
public static byte[] GetBytes(int index, string value)
|
||||||
|
{
|
||||||
|
return GetBytes(index, 0, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get bytes for a single serial signal.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="index">1-based serial index</param>
|
||||||
|
/// <param name="offset">Index offset.</param>
|
||||||
|
/// <param name="value">Serial data to be encoded</param>
|
||||||
|
/// <returns>Bytes in XSig format for serial signal information.</returns>
|
||||||
|
public static byte[] GetBytes(int index, int offset, string value)
|
||||||
|
{
|
||||||
|
return new XSigSerialToken(index + offset, value).GetBytes();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get byte sequence for multiple serial signals.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="startIndex">Starting index of the sequence.</param>
|
||||||
|
/// <param name="values">Serial signal value array.</param>
|
||||||
|
/// <returns>Byte sequence in XSig format for serial signal information.</returns>
|
||||||
|
public static byte[] GetBytes(int startIndex, string[] values)
|
||||||
|
{
|
||||||
|
return GetBytes(startIndex, 0, values);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get byte sequence for multiple serial signals.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="startIndex">Starting index of the sequence.</param>
|
||||||
|
/// <param name="offset">Index offset.</param>
|
||||||
|
/// <param name="values">Serial signal value array.</param>
|
||||||
|
/// <returns>Byte sequence in XSig format for serial signal information.</returns>
|
||||||
|
public static byte[] GetBytes(int startIndex, int offset, string[] values)
|
||||||
|
{
|
||||||
|
// Serial XSig data is not fixed-length like the other formats
|
||||||
|
var dstOffset = 0;
|
||||||
|
var bytes = new byte[values.Sum(v => v.Length + 3)];
|
||||||
|
for (var i = 0; i < values.Length; i++)
|
||||||
|
{
|
||||||
|
var data = GetBytes(startIndex++, offset, values[i]);
|
||||||
|
Buffer.BlockCopy(data, 0, bytes, dstOffset, data.Length);
|
||||||
|
dstOffset += data.Length;
|
||||||
|
}
|
||||||
|
|
||||||
|
return bytes;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -4,153 +4,143 @@ using Crestron.SimplSharp.CrestronIO;
|
|||||||
using PepperDash.Core.Intersystem.Serialization;
|
using PepperDash.Core.Intersystem.Serialization;
|
||||||
using PepperDash.Core.Intersystem.Tokens;
|
using PepperDash.Core.Intersystem.Tokens;
|
||||||
|
|
||||||
namespace PepperDash.Core.Intersystem
|
namespace PepperDash.Core.Intersystem;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// XSigToken stream reader.
|
||||||
|
/// </summary>
|
||||||
|
public sealed class XSigTokenStreamReader : IDisposable
|
||||||
{
|
{
|
||||||
|
private readonly Stream _stream;
|
||||||
|
private readonly bool _leaveOpen;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// XSigToken stream reader.
|
/// XSigToken stream reader constructor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class XSigTokenStreamReader : IDisposable
|
/// <param name="stream">Input stream to read from.</param>
|
||||||
|
/// <exception cref="T:System.ArgumentNullException">Stream is null.</exception>
|
||||||
|
/// <exception cref="T:System.ArgumentException">Stream cannot be read from.</exception>
|
||||||
|
public XSigTokenStreamReader(Stream stream)
|
||||||
|
: this(stream, false) { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// XSigToken stream reader constructor.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="stream">Input stream to read from.</param>
|
||||||
|
/// <param name="leaveOpen">Determines whether to leave the stream open or not.</param>
|
||||||
|
/// <exception cref="ArgumentNullException">Stream is null.</exception>
|
||||||
|
/// <exception cref="ArgumentException">Stream cannot be read from.</exception>
|
||||||
|
public XSigTokenStreamReader(Stream stream, bool leaveOpen)
|
||||||
{
|
{
|
||||||
private readonly Stream _stream;
|
if (stream == null)
|
||||||
private readonly bool _leaveOpen;
|
throw new ArgumentNullException("stream");
|
||||||
|
if (!stream.CanRead)
|
||||||
|
throw new ArgumentException("The specified stream cannot be read from.");
|
||||||
|
|
||||||
/// <inheritdoc />
|
_stream = stream;
|
||||||
/// <summary>
|
_leaveOpen = leaveOpen;
|
||||||
/// XSigToken stream reader constructor.
|
}
|
||||||
/// </summary>
|
|
||||||
/// <param name="stream">Input stream to read from.</param>
|
|
||||||
/// <exception cref="T:System.ArgumentNullException">Stream is null.</exception>
|
|
||||||
/// <exception cref="T:System.ArgumentException">Stream cannot be read from.</exception>
|
|
||||||
public XSigTokenStreamReader(Stream stream)
|
|
||||||
: this(stream, false) { }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// XSigToken stream reader constructor.
|
/// Reads a 16-bit unsigned integer from the specified stream using Big Endian byte order.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="stream">Input stream to read from.</param>
|
/// <param name="stream">Input stream</param>
|
||||||
/// <param name="leaveOpen">Determines whether to leave the stream open or not.</param>
|
/// <param name="value">Result</param>
|
||||||
/// <exception cref="ArgumentNullException">Stream is null.</exception>
|
/// <returns>True if successful, otherwise false.</returns>
|
||||||
/// <exception cref="ArgumentException">Stream cannot be read from.</exception>
|
public static bool TryReadUInt16BE(Stream stream, out ushort value)
|
||||||
public XSigTokenStreamReader(Stream stream, bool leaveOpen)
|
{
|
||||||
|
value = 0;
|
||||||
|
if (stream.Length < 2)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
var buffer = new byte[2];
|
||||||
|
stream.Read(buffer, 0, 2);
|
||||||
|
value = (ushort)((buffer[0] << 8) | buffer[1]);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Read XSig token from the stream.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>XSigToken</returns>
|
||||||
|
/// <exception cref="ArgumentOutOfRangeException">Offset is less than 0.</exception>
|
||||||
|
public XSigToken ReadXSigToken()
|
||||||
|
{
|
||||||
|
ushort prefix;
|
||||||
|
if (!TryReadUInt16BE(_stream, out prefix))
|
||||||
|
return null;
|
||||||
|
|
||||||
|
if ((prefix & 0xF880) == 0xC800) // Serial data
|
||||||
{
|
{
|
||||||
if (stream == null)
|
var index = ((prefix & 0x0700) >> 1) | (prefix & 0x7F);
|
||||||
throw new ArgumentNullException("stream");
|
var n = 0;
|
||||||
if (!stream.CanRead)
|
const int maxSerialDataLength = 252;
|
||||||
throw new ArgumentException("The specified stream cannot be read from.");
|
var chars = new char[maxSerialDataLength];
|
||||||
|
int ch;
|
||||||
|
while ((ch = _stream.ReadByte()) != 0xFF)
|
||||||
|
{
|
||||||
|
if (ch == -1) // Reached end of stream without end of data marker
|
||||||
|
return null;
|
||||||
|
|
||||||
|
chars[n++] = (char)ch;
|
||||||
|
}
|
||||||
|
|
||||||
_stream = stream;
|
return new XSigSerialToken((ushort)(index + 1), new string(chars, 0, n));
|
||||||
_leaveOpen = leaveOpen;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
if ((prefix & 0xC880) == 0xC000) // Analog data
|
||||||
/// Reads a 16-bit unsigned integer from the specified stream using Big Endian byte order.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="stream">Input stream</param>
|
|
||||||
/// <param name="value">Result</param>
|
|
||||||
/// <returns>True if successful, otherwise false.</returns>
|
|
||||||
/// <summary>
|
|
||||||
/// TryReadUInt16BE method
|
|
||||||
/// </summary>
|
|
||||||
public static bool TryReadUInt16BE(Stream stream, out ushort value)
|
|
||||||
{
|
{
|
||||||
value = 0;
|
ushort data;
|
||||||
if (stream.Length < 2)
|
if (!TryReadUInt16BE(_stream, out data))
|
||||||
return false;
|
|
||||||
|
|
||||||
var buffer = new byte[2];
|
|
||||||
stream.Read(buffer, 0, 2);
|
|
||||||
value = (ushort)((buffer[0] << 8) | buffer[1]);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Read XSig token from the stream.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>XSigToken</returns>
|
|
||||||
/// <exception cref="ArgumentOutOfRangeException">Offset is less than 0.</exception>
|
|
||||||
/// <summary>
|
|
||||||
/// ReadXSigToken method
|
|
||||||
/// </summary>
|
|
||||||
public XSigToken ReadXSigToken()
|
|
||||||
{
|
|
||||||
ushort prefix;
|
|
||||||
if (!TryReadUInt16BE(_stream, out prefix))
|
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
if ((prefix & 0xF880) == 0xC800) // Serial data
|
var index = ((prefix & 0x0700) >> 1) | (prefix & 0x7F);
|
||||||
{
|
var value = ((prefix & 0x3000) << 2) | ((data & 0x7F00) >> 1) | (data & 0x7F);
|
||||||
var index = ((prefix & 0x0700) >> 1) | (prefix & 0x7F);
|
return new XSigAnalogToken((ushort)(index + 1), (ushort)value);
|
||||||
var n = 0;
|
|
||||||
const int maxSerialDataLength = 252;
|
|
||||||
var chars = new char[maxSerialDataLength];
|
|
||||||
int ch;
|
|
||||||
while ((ch = _stream.ReadByte()) != 0xFF)
|
|
||||||
{
|
|
||||||
if (ch == -1) // Reached end of stream without end of data marker
|
|
||||||
return null;
|
|
||||||
|
|
||||||
chars[n++] = (char)ch;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new XSigSerialToken((ushort)(index + 1), new string(chars, 0, n));
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((prefix & 0xC880) == 0xC000) // Analog data
|
|
||||||
{
|
|
||||||
ushort data;
|
|
||||||
if (!TryReadUInt16BE(_stream, out data))
|
|
||||||
return null;
|
|
||||||
|
|
||||||
var index = ((prefix & 0x0700) >> 1) | (prefix & 0x7F);
|
|
||||||
var value = ((prefix & 0x3000) << 2) | ((data & 0x7F00) >> 1) | (data & 0x7F);
|
|
||||||
return new XSigAnalogToken((ushort)(index + 1), (ushort)value);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((prefix & 0xC080) == 0x8000) // Digital data
|
|
||||||
{
|
|
||||||
var index = ((prefix & 0x1F00) >> 1) | (prefix & 0x7F);
|
|
||||||
var value = (prefix & 0x2000) == 0;
|
|
||||||
return new XSigDigitalToken((ushort)(index + 1), value);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
if ((prefix & 0xC080) == 0x8000) // Digital data
|
||||||
/// Reads all available XSig tokens from the stream.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>XSigToken collection.</returns>
|
|
||||||
/// <summary>
|
|
||||||
/// ReadAllXSigTokens method
|
|
||||||
/// </summary>
|
|
||||||
public IEnumerable<XSigToken> ReadAllXSigTokens()
|
|
||||||
{
|
{
|
||||||
var tokens = new List<XSigToken>();
|
var index = ((prefix & 0x1F00) >> 1) | (prefix & 0x7F);
|
||||||
XSigToken token;
|
var value = (prefix & 0x2000) == 0;
|
||||||
while ((token = ReadXSigToken()) != null)
|
return new XSigDigitalToken((ushort)(index + 1), value);
|
||||||
tokens.Add(token);
|
|
||||||
|
|
||||||
return tokens;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
return null;
|
||||||
/// Attempts to deserialize all XSig data within the stream from the current position.
|
}
|
||||||
/// </summary>
|
|
||||||
/// <typeparam name="T">Type to deserialize the information to.</typeparam>
|
|
||||||
/// <returns>Deserialized object.</returns>
|
|
||||||
public T DeserializeStream<T>()
|
|
||||||
where T : class, IXSigSerialization, new()
|
|
||||||
{
|
|
||||||
return new T().Deserialize<T>(ReadAllXSigTokens());
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Disposes of the internal stream if specified to not leave open.
|
/// Reads all available XSig tokens from the stream.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Dispose()
|
/// <returns>XSigToken collection.</returns>
|
||||||
{
|
public IEnumerable<XSigToken> ReadAllXSigTokens()
|
||||||
if (!_leaveOpen)
|
{
|
||||||
_stream.Dispose();
|
var tokens = new List<XSigToken>();
|
||||||
}
|
XSigToken token;
|
||||||
|
while ((token = ReadXSigToken()) != null)
|
||||||
|
tokens.Add(token);
|
||||||
|
|
||||||
|
return tokens;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Attempts to deserialize all XSig data within the stream from the current position.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T">Type to deserialize the information to.</typeparam>
|
||||||
|
/// <returns>Deserialized object.</returns>
|
||||||
|
public T DeserializeStream<T>()
|
||||||
|
where T : class, IXSigSerialization, new()
|
||||||
|
{
|
||||||
|
return new T().Deserialize<T>(ReadAllXSigTokens());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Disposes of the internal stream if specified to not leave open.
|
||||||
|
/// </summary>
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
if (!_leaveOpen)
|
||||||
|
_stream.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,147 +5,131 @@ using Crestron.SimplSharp.CrestronIO;
|
|||||||
using PepperDash.Core.Intersystem.Serialization;
|
using PepperDash.Core.Intersystem.Serialization;
|
||||||
using PepperDash.Core.Intersystem.Tokens;
|
using PepperDash.Core.Intersystem.Tokens;
|
||||||
|
|
||||||
namespace PepperDash.Core.Intersystem
|
namespace PepperDash.Core.Intersystem;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// XSigToken stream writer.
|
||||||
|
/// </summary>
|
||||||
|
public sealed class XSigTokenStreamWriter : IDisposable
|
||||||
{
|
{
|
||||||
|
private readonly Stream _stream;
|
||||||
|
private readonly bool _leaveOpen;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// XSigToken stream writer.
|
/// XSigToken stream writer constructor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class XSigTokenStreamWriter : IDisposable
|
/// <param name="stream">Input stream to write to.</param>
|
||||||
|
/// <exception cref="T:System.ArgumentNullException">Stream is null.</exception>
|
||||||
|
/// <exception cref="T:System.ArgumentException">Stream cannot be written to.</exception>
|
||||||
|
public XSigTokenStreamWriter(Stream stream)
|
||||||
|
: this(stream, false) { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// XSigToken stream writer constructor.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="stream">Input stream to write to.</param>
|
||||||
|
/// <param name="leaveOpen">Determines whether to leave the stream open or not.</param>
|
||||||
|
/// <exception cref="ArgumentNullException">Stream is null.</exception>
|
||||||
|
/// <exception cref="ArgumentException">Stream cannot be written to.</exception>
|
||||||
|
public XSigTokenStreamWriter(Stream stream, bool leaveOpen)
|
||||||
{
|
{
|
||||||
private readonly Stream _stream;
|
if (stream == null)
|
||||||
private readonly bool _leaveOpen;
|
throw new ArgumentNullException("stream");
|
||||||
|
if (!stream.CanWrite)
|
||||||
|
throw new ArgumentException("The specified stream cannot be written to.");
|
||||||
|
|
||||||
/// <inheritdoc />
|
_stream = stream;
|
||||||
/// <summary>
|
_leaveOpen = leaveOpen;
|
||||||
/// XSigToken stream writer constructor.
|
}
|
||||||
/// </summary>
|
|
||||||
/// <param name="stream">Input stream to write to.</param>
|
|
||||||
/// <exception cref="T:System.ArgumentNullException">Stream is null.</exception>
|
|
||||||
/// <exception cref="T:System.ArgumentException">Stream cannot be written to.</exception>
|
|
||||||
public XSigTokenStreamWriter(Stream stream)
|
|
||||||
: this(stream, false) { }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// XSigToken stream writer constructor.
|
/// Write XSig data gathered from an IXSigStateResolver to the stream.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="stream">Input stream to write to.</param>
|
/// <param name="xSigSerialization">IXSigStateResolver object.</param>
|
||||||
/// <param name="leaveOpen">Determines whether to leave the stream open or not.</param>
|
public void WriteXSigData(IXSigSerialization xSigSerialization)
|
||||||
/// <exception cref="ArgumentNullException">Stream is null.</exception>
|
{
|
||||||
/// <exception cref="ArgumentException">Stream cannot be written to.</exception>
|
WriteXSigData(xSigSerialization, 0);
|
||||||
public XSigTokenStreamWriter(Stream stream, bool leaveOpen)
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Write XSig data gathered from an IXSigStateResolver to the stream.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="xSigSerialization">IXSigStateResolver object.</param>
|
||||||
|
/// <param name="offset">Index offset for each XSigToken.</param>
|
||||||
|
public void WriteXSigData(IXSigSerialization xSigSerialization, int offset)
|
||||||
|
{
|
||||||
|
if (xSigSerialization == null)
|
||||||
|
throw new ArgumentNullException("xSigSerialization");
|
||||||
|
|
||||||
|
var tokens = xSigSerialization.Serialize();
|
||||||
|
WriteXSigData(tokens, offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Write XSigToken to the stream.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="token">XSigToken object.</param>
|
||||||
|
public void WriteXSigData(XSigToken token)
|
||||||
|
{
|
||||||
|
WriteXSigData(token, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Write XSigToken to the stream.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="token">XSigToken object.</param>
|
||||||
|
/// <param name="offset">Index offset for each XSigToken.</param>
|
||||||
|
public void WriteXSigData(XSigToken token, int offset)
|
||||||
|
{
|
||||||
|
WriteXSigData(new[] { token }, offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Writes an array of XSigTokens to the stream.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="tokens">XSigToken objects.</param>
|
||||||
|
public void WriteXSigData(XSigToken[] tokens)
|
||||||
|
{
|
||||||
|
WriteXSigData(tokens.AsEnumerable());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Write an enumerable collection of XSigTokens to the stream.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="tokens">XSigToken objects.</param>
|
||||||
|
public void WriteXSigData(IEnumerable<XSigToken> tokens)
|
||||||
|
{
|
||||||
|
WriteXSigData(tokens, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Write an enumerable collection of XSigTokens to the stream.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="tokens">XSigToken objects.</param>
|
||||||
|
/// <param name="offset">Index offset for each XSigToken.</param>
|
||||||
|
public void WriteXSigData(IEnumerable<XSigToken> tokens, int offset)
|
||||||
|
{
|
||||||
|
if (offset < 0)
|
||||||
|
throw new ArgumentOutOfRangeException("offset", "Offset must be greater than or equal to 0.");
|
||||||
|
|
||||||
|
if (tokens != null)
|
||||||
{
|
{
|
||||||
if (stream == null)
|
foreach (var token in tokens)
|
||||||
throw new ArgumentNullException("stream");
|
|
||||||
if (!stream.CanWrite)
|
|
||||||
throw new ArgumentException("The specified stream cannot be written to.");
|
|
||||||
|
|
||||||
_stream = stream;
|
|
||||||
_leaveOpen = leaveOpen;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Write XSig data gathered from an IXSigStateResolver to the stream.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="xSigSerialization">IXSigStateResolver object.</param>
|
|
||||||
/// <summary>
|
|
||||||
/// WriteXSigData method
|
|
||||||
/// </summary>
|
|
||||||
public void WriteXSigData(IXSigSerialization xSigSerialization)
|
|
||||||
{
|
|
||||||
WriteXSigData(xSigSerialization, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Write XSig data gathered from an IXSigStateResolver to the stream.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="xSigSerialization">IXSigStateResolver object.</param>
|
|
||||||
/// <param name="offset">Index offset for each XSigToken.</param>
|
|
||||||
/// <summary>
|
|
||||||
/// WriteXSigData method
|
|
||||||
/// </summary>
|
|
||||||
public void WriteXSigData(IXSigSerialization xSigSerialization, int offset)
|
|
||||||
{
|
|
||||||
if (xSigSerialization == null)
|
|
||||||
throw new ArgumentNullException("xSigSerialization");
|
|
||||||
|
|
||||||
var tokens = xSigSerialization.Serialize();
|
|
||||||
WriteXSigData(tokens, offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Write XSigToken to the stream.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="token">XSigToken object.</param>
|
|
||||||
/// <summary>
|
|
||||||
/// WriteXSigData method
|
|
||||||
/// </summary>
|
|
||||||
public void WriteXSigData(XSigToken token)
|
|
||||||
{
|
|
||||||
WriteXSigData(token, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Write XSigToken to the stream.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="token">XSigToken object.</param>
|
|
||||||
/// <param name="offset">Index offset for each XSigToken.</param>
|
|
||||||
/// <summary>
|
|
||||||
/// WriteXSigData method
|
|
||||||
/// </summary>
|
|
||||||
public void WriteXSigData(XSigToken token, int offset)
|
|
||||||
{
|
|
||||||
WriteXSigData(new[] { token }, offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Writes an array of XSigTokens to the stream.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="tokens">XSigToken objects.</param>
|
|
||||||
public void WriteXSigData(XSigToken[] tokens)
|
|
||||||
{
|
|
||||||
WriteXSigData(tokens.AsEnumerable());
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Write an enumerable collection of XSigTokens to the stream.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="tokens">XSigToken objects.</param>
|
|
||||||
public void WriteXSigData(IEnumerable<XSigToken> tokens)
|
|
||||||
{
|
|
||||||
WriteXSigData(tokens, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Write an enumerable collection of XSigTokens to the stream.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="tokens">XSigToken objects.</param>
|
|
||||||
/// <param name="offset">Index offset for each XSigToken.</param>
|
|
||||||
/// <summary>
|
|
||||||
/// WriteXSigData method
|
|
||||||
/// </summary>
|
|
||||||
public void WriteXSigData(IEnumerable<XSigToken> tokens, int offset)
|
|
||||||
{
|
|
||||||
if (offset < 0)
|
|
||||||
throw new ArgumentOutOfRangeException("offset", "Offset must be greater than or equal to 0.");
|
|
||||||
|
|
||||||
if (tokens != null)
|
|
||||||
{
|
{
|
||||||
foreach (var token in tokens)
|
if (token == null) continue;
|
||||||
{
|
var bytes = token.GetTokenWithOffset(offset).GetBytes();
|
||||||
if (token == null) continue;
|
_stream.Write(bytes, 0, bytes.Length);
|
||||||
var bytes = token.GetTokenWithOffset(offset).GetBytes();
|
|
||||||
_stream.Write(bytes, 0, bytes.Length);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Dispose method
|
/// Disposes of the internal stream if specified to not leave open.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
if (!_leaveOpen)
|
if (!_leaveOpen)
|
||||||
_stream.Dispose();
|
_stream.Dispose();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -13,507 +13,408 @@ using PepperDash.Essentials.Core.Config;
|
|||||||
using Serilog.Events;
|
using Serilog.Events;
|
||||||
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Base class for bridge API variants
|
||||||
|
/// </summary>
|
||||||
|
public abstract class BridgeApi : EssentialsDevice
|
||||||
{
|
{
|
||||||
/// <summary>
|
protected BridgeApi(string key) :
|
||||||
/// Base class for bridge API variants
|
base(key)
|
||||||
/// </summary>
|
|
||||||
[Obsolete("Will be removed in v3.0.0")]
|
|
||||||
public abstract class BridgeApi : EssentialsDevice
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Constructor
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="key">Device key</param>
|
|
||||||
protected BridgeApi(string key) :
|
|
||||||
base(key)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Bridge API using EISC
|
||||||
|
/// </summary>
|
||||||
|
public class EiscApiAdvanced : BridgeApi, ICommunicationMonitor
|
||||||
|
{
|
||||||
|
public EiscApiPropertiesConfig PropertiesConfig { get; private set; }
|
||||||
|
|
||||||
|
public Dictionary<string, JoinMapBaseAdvanced> JoinMaps { get; private set; }
|
||||||
|
|
||||||
|
public BasicTriList Eisc { get; private set; }
|
||||||
|
|
||||||
|
public EiscApiAdvanced(DeviceConfig dc, BasicTriList eisc) :
|
||||||
|
base(dc.Key)
|
||||||
|
{
|
||||||
|
JoinMaps = new Dictionary<string, JoinMapBaseAdvanced>();
|
||||||
|
|
||||||
|
PropertiesConfig = dc.Properties.ToObject<EiscApiPropertiesConfig>();
|
||||||
|
//PropertiesConfig = JsonConvert.DeserializeObject<EiscApiPropertiesConfig>(dc.Properties.ToString());
|
||||||
|
|
||||||
|
Eisc = eisc;
|
||||||
|
|
||||||
|
Eisc.SigChange += Eisc_SigChange;
|
||||||
|
|
||||||
|
CommunicationMonitor = new CrestronGenericBaseCommunicationMonitor(this, Eisc, 120000, 300000);
|
||||||
|
|
||||||
|
AddPostActivationAction(LinkDevices);
|
||||||
|
AddPostActivationAction(LinkRooms);
|
||||||
|
AddPostActivationAction(RegisterEisc);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool CustomActivate()
|
||||||
|
{
|
||||||
|
CommunicationMonitor.Start();
|
||||||
|
return base.CustomActivate();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool Deactivate()
|
||||||
|
{
|
||||||
|
CommunicationMonitor.Stop();
|
||||||
|
return base.Deactivate();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LinkDevices()
|
||||||
|
{
|
||||||
|
Debug.LogMessage(LogEventLevel.Debug, this, "Linking Devices...");
|
||||||
|
|
||||||
|
if (PropertiesConfig.Devices == null)
|
||||||
|
{
|
||||||
|
Debug.LogMessage(LogEventLevel.Debug, this, "No devices linked to this bridge");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var d in PropertiesConfig.Devices)
|
||||||
|
{
|
||||||
|
var device = DeviceManager.GetDeviceForKey(d.DeviceKey);
|
||||||
|
|
||||||
|
if (device == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug.LogMessage(LogEventLevel.Debug, this, "Linking Device: '{0}'", device.Key);
|
||||||
|
|
||||||
|
if (device is IBridgeAdvanced bridge)
|
||||||
|
{
|
||||||
|
bridge.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey, this);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug.LogMessage(LogEventLevel.Information, this,
|
||||||
|
"{0} is not compatible with this bridge type. Please use 'eiscapi' instead, or updae the device.",
|
||||||
|
device.Key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RegisterEisc()
|
||||||
|
{
|
||||||
|
if (Eisc.Registered)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var registerResult = Eisc.Register();
|
||||||
|
|
||||||
|
if (registerResult != eDeviceRegistrationUnRegistrationResponse.Success)
|
||||||
|
{
|
||||||
|
Debug.LogMessage(LogEventLevel.Verbose, this, "Registration result: {0}", registerResult);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug.LogMessage(LogEventLevel.Debug, this, "EISC registration successful");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LinkRooms()
|
||||||
|
{
|
||||||
|
Debug.LogMessage(LogEventLevel.Debug, this, "Linking Rooms...");
|
||||||
|
|
||||||
|
if (PropertiesConfig.Rooms == null)
|
||||||
|
{
|
||||||
|
Debug.LogMessage(LogEventLevel.Debug, this, "No rooms linked to this bridge.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var room in PropertiesConfig.Rooms)
|
||||||
|
{
|
||||||
|
var rm = DeviceManager.GetDeviceForKey(room.RoomKey) as IBridgeAdvanced;
|
||||||
|
|
||||||
|
if (rm == null)
|
||||||
|
{
|
||||||
|
Debug.LogMessage(LogEventLevel.Debug, this,
|
||||||
|
"Room {0} does not implement IBridgeAdvanced. Skipping...", room.RoomKey);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
rm.LinkToApi(Eisc, room.JoinStart, room.JoinMapKey, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class to link devices and rooms to an EISC Instance
|
/// Adds a join map
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class EiscApiAdvanced : BridgeApi, ICommunicationMonitor
|
/// <param name="deviceKey"></param>
|
||||||
|
/// <param name="joinMap"></param>
|
||||||
|
public void AddJoinMap(string deviceKey, JoinMapBaseAdvanced joinMap)
|
||||||
{
|
{
|
||||||
/// <summary>
|
if (!JoinMaps.ContainsKey(deviceKey))
|
||||||
/// Gets the PropertiesConfig
|
|
||||||
/// </summary>
|
|
||||||
public EiscApiPropertiesConfig PropertiesConfig { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the JoinMaps dictionary
|
|
||||||
/// </summary>
|
|
||||||
public Dictionary<string, JoinMapBaseAdvanced> JoinMaps { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the EISC instance
|
|
||||||
/// </summary>
|
|
||||||
public BasicTriList Eisc { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Constructor
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="dc">Device configuration</param>
|
|
||||||
/// <param name="eisc">EISC instance</param>
|
|
||||||
public EiscApiAdvanced(DeviceConfig dc, BasicTriList eisc) :
|
|
||||||
base(dc.Key)
|
|
||||||
{
|
{
|
||||||
JoinMaps = new Dictionary<string, JoinMapBaseAdvanced>();
|
JoinMaps.Add(deviceKey, joinMap);
|
||||||
|
|
||||||
PropertiesConfig = dc.Properties.ToObject<EiscApiPropertiesConfig>();
|
|
||||||
|
|
||||||
Eisc = eisc;
|
|
||||||
|
|
||||||
Eisc.SigChange += Eisc_SigChange;
|
|
||||||
|
|
||||||
CommunicationMonitor = new CrestronGenericBaseCommunicationMonitor(this, Eisc, 120000, 300000);
|
|
||||||
|
|
||||||
AddPostActivationAction(LinkDevices);
|
|
||||||
AddPostActivationAction(LinkRooms);
|
|
||||||
AddPostActivationAction(RegisterEisc);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
/// <summary>
|
|
||||||
/// CustomActivate method
|
|
||||||
/// </summary>
|
|
||||||
public override bool CustomActivate()
|
|
||||||
{
|
{
|
||||||
CommunicationMonitor.Start();
|
Debug.LogMessage(LogEventLevel.Verbose, this, "Unable to add join map with key '{0}'. Key already exists in JoinMaps dictionary", deviceKey);
|
||||||
return base.CustomActivate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Deactivate method
|
|
||||||
/// </summary>
|
|
||||||
public override bool Deactivate()
|
|
||||||
{
|
|
||||||
CommunicationMonitor.Stop();
|
|
||||||
return base.Deactivate();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LinkDevices()
|
|
||||||
{
|
|
||||||
Debug.LogMessage(LogEventLevel.Debug, this, "Linking Devices...");
|
|
||||||
|
|
||||||
if (PropertiesConfig.Devices == null)
|
|
||||||
{
|
|
||||||
this.LogDebug("No devices linked to this bridge");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var d in PropertiesConfig.Devices)
|
|
||||||
{
|
|
||||||
var device = DeviceManager.GetDeviceForKey(d.DeviceKey);
|
|
||||||
|
|
||||||
if (device == null)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
Debug.LogMessage(LogEventLevel.Debug, this, "Linking Device: '{0}'", device.Key);
|
|
||||||
|
|
||||||
if (device is IBridgeAdvanced bridge)
|
|
||||||
{
|
|
||||||
bridge.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey, this);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.LogWarning("{deviceKey} is not compatible with this bridge type. Please update the device.", device.Key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void RegisterEisc()
|
|
||||||
{
|
|
||||||
if (Eisc.Registered)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var registerResult = Eisc.Register();
|
|
||||||
|
|
||||||
if (registerResult != eDeviceRegistrationUnRegistrationResponse.Success)
|
|
||||||
{
|
|
||||||
this.LogVerbose("Registration result: {registerResult}", registerResult);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.LogDebug("EISC registration successful");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Link rooms to this EISC. Rooms MUST implement IBridgeAdvanced
|
|
||||||
/// </summary>
|
|
||||||
public void LinkRooms()
|
|
||||||
{
|
|
||||||
this.LogDebug("Linking Rooms...");
|
|
||||||
|
|
||||||
if (PropertiesConfig.Rooms == null)
|
|
||||||
{
|
|
||||||
this.LogDebug("No rooms linked to this bridge.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var room in PropertiesConfig.Rooms)
|
|
||||||
{
|
|
||||||
if (!(DeviceManager.GetDeviceForKey(room.RoomKey) is IBridgeAdvanced rm))
|
|
||||||
{
|
|
||||||
this.LogDebug("Room {roomKey} does not implement IBridgeAdvanced. Skipping...", room.RoomKey);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
rm.LinkToApi(Eisc, room.JoinStart, room.JoinMapKey, this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Adds a join map
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="deviceKey">The key of the device to add the join map for</param>
|
|
||||||
/// <param name="joinMap">The join map to add</param>
|
|
||||||
public void AddJoinMap(string deviceKey, JoinMapBaseAdvanced joinMap)
|
|
||||||
{
|
|
||||||
if (!JoinMaps.ContainsKey(deviceKey))
|
|
||||||
{
|
|
||||||
JoinMaps.Add(deviceKey, joinMap);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.LogWarning("Unable to add join map with key '{deviceKey}'. Key already exists in JoinMaps dictionary", deviceKey);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// PrintJoinMaps method
|
|
||||||
/// </summary>
|
|
||||||
public virtual void PrintJoinMaps()
|
|
||||||
{
|
|
||||||
CrestronConsole.ConsoleCommandResponse("Join Maps for EISC IPID: {0}\r\n", Eisc.ID.ToString("X"));
|
|
||||||
|
|
||||||
foreach (var joinMap in JoinMaps)
|
|
||||||
{
|
|
||||||
CrestronConsole.ConsoleCommandResponse("Join map for device '{0}':", joinMap.Key);
|
|
||||||
joinMap.Value.PrintJoinMapInfo();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// MarkdownForBridge method
|
|
||||||
/// </summary>
|
|
||||||
public virtual void MarkdownForBridge(string bridgeKey)
|
|
||||||
{
|
|
||||||
this.LogInformation("Writing Joinmaps to files for EISC IPID: {eiscId}", Eisc.ID.ToString("X"));
|
|
||||||
|
|
||||||
foreach (var joinMap in JoinMaps)
|
|
||||||
{
|
|
||||||
this.LogInformation("Generating markdown for device '{deviceKey}':", joinMap.Key);
|
|
||||||
joinMap.Value.MarkdownJoinMapInfo(joinMap.Key, bridgeKey);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Prints the join map for a device by key
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="deviceKey">The key of the device to print the join map for</param>
|
|
||||||
public void PrintJoinMapForDevice(string deviceKey)
|
|
||||||
{
|
|
||||||
var joinMap = JoinMaps[deviceKey];
|
|
||||||
|
|
||||||
if (joinMap == null)
|
|
||||||
{
|
|
||||||
this.LogInformation("Unable to find joinMap for device with key: '{deviceKey}'", deviceKey);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.LogInformation("Join map for device '{deviceKey}' on EISC '{eiscKey}':", deviceKey, Key);
|
|
||||||
joinMap.PrintJoinMapInfo();
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Prints the join map for a device by key in Markdown format
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="deviceKey">The key of the device to print the join map for</param>
|
|
||||||
/// <param name="bridgeKey">The key of the bridge to use for the Markdown output</param>
|
|
||||||
public void MarkdownJoinMapForDevice(string deviceKey, string bridgeKey)
|
|
||||||
{
|
|
||||||
var joinMap = JoinMaps[deviceKey];
|
|
||||||
|
|
||||||
if (joinMap == null)
|
|
||||||
{
|
|
||||||
this.LogInformation("Unable to find joinMap for device with key: '{deviceKey}'", deviceKey);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.LogInformation("Join map for device '{deviceKey}' on EISC '{eiscKey}':", deviceKey, Key);
|
|
||||||
joinMap.MarkdownJoinMapInfo(deviceKey, bridgeKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Used for debugging to trigger an action based on a join number and type
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="join">The join number to execute the action for</param>
|
|
||||||
/// <param name="type">The type of join (digital, analog, serial)</param>
|
|
||||||
/// <param name="state">The state to pass to the action</param>
|
|
||||||
public void ExecuteJoinAction(uint join, string type, object state)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
switch (type.ToLower())
|
|
||||||
{
|
|
||||||
case "digital":
|
|
||||||
{
|
|
||||||
if (Eisc.BooleanOutput[join].UserObject is Action<bool> userObject)
|
|
||||||
{
|
|
||||||
this.LogVerbose("Executing Boolean Action");
|
|
||||||
userObject(Convert.ToBoolean(state));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
this.LogVerbose("User Object is null. Nothing to Execute");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "analog":
|
|
||||||
{
|
|
||||||
if (Eisc.UShortOutput[join].UserObject is Action<ushort> userObject)
|
|
||||||
{
|
|
||||||
this.LogVerbose("Executing Analog Action");
|
|
||||||
userObject(Convert.ToUInt16(state));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
this.LogVerbose("User Object is null. Nothing to Execute");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "serial":
|
|
||||||
{
|
|
||||||
if (Eisc.StringOutput[join].UserObject is Action<string> userObject)
|
|
||||||
{
|
|
||||||
this.LogVerbose("Executing Serial Action");
|
|
||||||
userObject(Convert.ToString(state));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
this.LogVerbose("User Object is null. Nothing to Execute");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
this.LogVerbose("Unknown join type. Use digital/serial/analog");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
this.LogError("ExecuteJoinAction error: {message}", e.Message);
|
|
||||||
this.LogDebug(e, "Stack Trace: ");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Handle incoming sig changes
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="currentDevice">BasicTriList device that triggered the event</param>
|
|
||||||
/// <param name="args">Event arguments containing the signal information</param>
|
|
||||||
protected void Eisc_SigChange(object currentDevice, SigEventArgs args)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
this.LogVerbose("EiscApiAdvanced change: {type} {number}={value}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
|
|
||||||
var userObject = args.Sig.UserObject;
|
|
||||||
|
|
||||||
if (userObject == null) return;
|
|
||||||
|
|
||||||
|
|
||||||
if (userObject is Action<bool>)
|
|
||||||
{
|
|
||||||
this.LogDebug("Executing Boolean Action");
|
|
||||||
(userObject as Action<bool>)(args.Sig.BoolValue);
|
|
||||||
}
|
|
||||||
else if (userObject is Action<ushort>)
|
|
||||||
{
|
|
||||||
this.LogDebug("Executing Analog Action");
|
|
||||||
(userObject as Action<ushort>)(args.Sig.UShortValue);
|
|
||||||
}
|
|
||||||
else if (userObject is Action<string>)
|
|
||||||
{
|
|
||||||
this.LogDebug("Executing Serial Action");
|
|
||||||
(userObject as Action<string>)(args.Sig.StringValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
this.LogError("Eisc_SigChange handler error: {message}", e.Message);
|
|
||||||
this.LogDebug(e, "Stack Trace: ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Implementation of ICommunicationMonitor
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the CommunicationMonitor
|
|
||||||
/// </summary>
|
|
||||||
public StatusMonitorBase CommunicationMonitor { get; private set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a EiscApiPropertiesConfig
|
/// Prints all the join maps on this bridge
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class EiscApiPropertiesConfig
|
public virtual void PrintJoinMaps()
|
||||||
{
|
{
|
||||||
/// <summary>
|
CrestronConsole.ConsoleCommandResponse("Join Maps for EISC IPID: {0}\r\n", Eisc.ID.ToString("X"));
|
||||||
/// Gets or sets the Control
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("control")]
|
|
||||||
public EssentialsControlPropertiesConfig Control { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
foreach (var joinMap in JoinMaps)
|
||||||
/// Gets or sets the Devices
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("devices")]
|
|
||||||
public List<ApiDevicePropertiesConfig> Devices { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the Rooms
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("rooms")]
|
|
||||||
public List<ApiRoomPropertiesConfig> Rooms { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Represents a ApiDevicePropertiesConfig
|
|
||||||
/// </summary>
|
|
||||||
public class ApiDevicePropertiesConfig
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
CrestronConsole.ConsoleCommandResponse("Join map for device '{0}':", joinMap.Key);
|
||||||
/// Gets or sets the DeviceKey
|
joinMap.Value.PrintJoinMapInfo();
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("deviceKey")]
|
|
||||||
public string DeviceKey { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the JoinStart
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("joinStart")]
|
|
||||||
public uint JoinStart { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the JoinMapKey
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("joinMapKey")]
|
|
||||||
public string JoinMapKey { get; set; }
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Generates markdown for all join maps on this bridge
|
||||||
|
/// </summary>
|
||||||
|
public virtual void MarkdownForBridge(string bridgeKey)
|
||||||
|
{
|
||||||
|
Debug.LogMessage(LogEventLevel.Information, this, "Writing Joinmaps to files for EISC IPID: {0}", Eisc.ID.ToString("X"));
|
||||||
|
|
||||||
/// <summary>
|
foreach (var joinMap in JoinMaps)
|
||||||
/// Represents a ApiRoomPropertiesConfig
|
|
||||||
/// </summary>
|
|
||||||
public class ApiRoomPropertiesConfig
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
Debug.LogMessage(LogEventLevel.Information, "Generating markdown for device '{0}':", joinMap.Key);
|
||||||
/// Gets or sets the RoomKey
|
joinMap.Value.MarkdownJoinMapInfo(joinMap.Key, bridgeKey);
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("roomKey")]
|
|
||||||
public string RoomKey { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the JoinStart
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("joinStart")]
|
|
||||||
public uint JoinStart { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the JoinMapKey
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("joinMapKey")]
|
|
||||||
public string JoinMapKey { get; set; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Factory class for EiscApiAdvanced devices
|
/// Prints the join map for a device by key
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <param name="deviceKey"></param>
|
||||||
/// Supported types:
|
public void PrintJoinMapForDevice(string deviceKey)
|
||||||
/// eiscapiadv - Create a standard EISC client over TCP/IP
|
|
||||||
/// eiscapiadvanced - Create a standard EISC client over TCP/IP
|
|
||||||
/// eiscapiadvancedserver - Create an EISC server
|
|
||||||
/// eiscapiadvancedclient - Create an EISC client
|
|
||||||
/// vceiscapiadv - Create a VC-4 EISC client
|
|
||||||
/// vceiscapiadvanced - Create a VC-4 EISC client
|
|
||||||
/// eiscapiadvudp - Create a standard EISC client over UDP
|
|
||||||
/// eiscapiadvancedudp - Create a standard EISC client over UDP
|
|
||||||
/// </remarks>
|
|
||||||
public class EiscApiAdvancedFactory : EssentialsDeviceFactory<EiscApiAdvanced>
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
var joinMap = JoinMaps[deviceKey];
|
||||||
/// Constructor
|
|
||||||
/// </summary>
|
if (joinMap == null)
|
||||||
public EiscApiAdvancedFactory()
|
|
||||||
{
|
{
|
||||||
TypeNames = new List<string> { "eiscapiadv", "eiscapiadvanced", "eiscapiadvancedserver", "eiscapiadvancedclient", "vceiscapiadv", "vceiscapiadvanced", "eiscapiadvudp", "eiscapiadvancedudp" };
|
Debug.LogMessage(LogEventLevel.Information, this, "Unable to find joinMap for device with key: '{0}'", deviceKey);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
Debug.LogMessage(LogEventLevel.Information, "Join map for device '{0}' on EISC '{1}':", deviceKey, Key);
|
||||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
joinMap.PrintJoinMapInfo();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Prints the join map for a device by key
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="deviceKey"></param>
|
||||||
|
public void MarkdownJoinMapForDevice(string deviceKey, string bridgeKey)
|
||||||
|
{
|
||||||
|
var joinMap = JoinMaps[deviceKey];
|
||||||
|
|
||||||
|
if (joinMap == null)
|
||||||
{
|
{
|
||||||
Debug.LogDebug("Attempting to create new EiscApiAdvanced Device");
|
Debug.LogMessage(LogEventLevel.Information, this, "Unable to find joinMap for device with key: '{0}'", deviceKey);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var controlProperties = CommFactory.GetControlPropertiesConfig(dc);
|
Debug.LogMessage(LogEventLevel.Information, "Join map for device '{0}' on EISC '{1}':", deviceKey, Key);
|
||||||
|
joinMap.MarkdownJoinMapInfo(deviceKey, bridgeKey);
|
||||||
|
}
|
||||||
|
|
||||||
BasicTriList eisc;
|
/// <summary>
|
||||||
|
/// Used for debugging to trigger an action based on a join number and type
|
||||||
switch (dc.Type.ToLower())
|
/// </summary>
|
||||||
|
/// <param name="join"></param>
|
||||||
|
/// <param name="type"></param>
|
||||||
|
/// <param name="state"></param>
|
||||||
|
public void ExecuteJoinAction(uint join, string type, object state)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
switch (type.ToLower())
|
||||||
{
|
{
|
||||||
case "eiscapiadvudp":
|
case "digital":
|
||||||
case "eiscapiadvancedudp":
|
|
||||||
{
|
{
|
||||||
eisc = new EthernetIntersystemCommunications(controlProperties.IpIdInt,
|
var uo = Eisc.BooleanOutput[join].UserObject as Action<bool>;
|
||||||
controlProperties.TcpSshProperties.Address, Global.ControlSystem);
|
if (uo != null)
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "eiscapiadv":
|
|
||||||
case "eiscapiadvanced":
|
|
||||||
{
|
|
||||||
eisc = new ThreeSeriesTcpIpEthernetIntersystemCommunications(controlProperties.IpIdInt,
|
|
||||||
controlProperties.TcpSshProperties.Address, Global.ControlSystem);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "eiscapiadvancedserver":
|
|
||||||
{
|
|
||||||
eisc = new EISCServer(controlProperties.IpIdInt, Global.ControlSystem);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "eiscapiadvancedclient":
|
|
||||||
{
|
|
||||||
eisc = new EISCClient(controlProperties.IpIdInt, controlProperties.TcpSshProperties.Address, Global.ControlSystem);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "vceiscapiadv":
|
|
||||||
case "vceiscapiadvanced":
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(controlProperties.RoomId))
|
|
||||||
{
|
{
|
||||||
Debug.LogInformation("Unable to build VC-4 EISC Client for device {deviceKey}. Room ID is missing or empty", dc.Key);
|
Debug.LogMessage(LogEventLevel.Verbose, this, "Executing Action: {0}", uo.ToString());
|
||||||
eisc = null;
|
uo(Convert.ToBoolean(state));
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
eisc = new VirtualControlEISCClient(controlProperties.IpIdInt, controlProperties.RoomId,
|
else
|
||||||
Global.ControlSystem);
|
Debug.LogMessage(LogEventLevel.Verbose, this, "User Action is null. Nothing to Execute");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "analog":
|
||||||
|
{
|
||||||
|
var uo = Eisc.BooleanOutput[join].UserObject as Action<ushort>;
|
||||||
|
if (uo != null)
|
||||||
|
{
|
||||||
|
Debug.LogMessage(LogEventLevel.Verbose, this, "Executing Action: {0}", uo.ToString());
|
||||||
|
uo(Convert.ToUInt16(state));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Debug.LogMessage(LogEventLevel.Verbose, this, "User Action is null. Nothing to Execute"); break;
|
||||||
|
}
|
||||||
|
case "serial":
|
||||||
|
{
|
||||||
|
var uo = Eisc.BooleanOutput[join].UserObject as Action<string>;
|
||||||
|
if (uo != null)
|
||||||
|
{
|
||||||
|
Debug.LogMessage(LogEventLevel.Verbose, this, "Executing Action: {0}", uo.ToString());
|
||||||
|
uo(Convert.ToString(state));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Debug.LogMessage(LogEventLevel.Verbose, this, "User Action is null. Nothing to Execute");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
eisc = null;
|
{
|
||||||
break;
|
Debug.LogMessage(LogEventLevel.Verbose, "Unknown join type. Use digital/serial/analog");
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.LogMessage(LogEventLevel.Debug, this, "Error: {0}", e);
|
||||||
|
}
|
||||||
|
|
||||||
if (eisc == null)
|
}
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new EiscApiAdvanced(dc, eisc);
|
/// <summary>
|
||||||
|
/// Handles incoming sig changes
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="currentDevice"></param>
|
||||||
|
/// <param name="args"></param>
|
||||||
|
protected void Eisc_SigChange(object currentDevice, SigEventArgs args)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Debug.LogMessage(LogEventLevel.Verbose, this, "EiscApiAdvanced change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
|
||||||
|
var uo = args.Sig.UserObject;
|
||||||
|
|
||||||
|
if (uo == null) return;
|
||||||
|
|
||||||
|
Debug.LogMessage(LogEventLevel.Debug, this, "Executing Action: {0}", uo.ToString());
|
||||||
|
if (uo is Action<bool>)
|
||||||
|
(uo as Action<bool>)(args.Sig.BoolValue);
|
||||||
|
else if (uo is Action<ushort>)
|
||||||
|
(uo as Action<ushort>)(args.Sig.UShortValue);
|
||||||
|
else if (uo is Action<string>)
|
||||||
|
(uo as Action<string>)(args.Sig.StringValue);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.LogMessage(LogEventLevel.Verbose, this, "Error in Eisc_SigChange handler: {0}", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region Implementation of ICommunicationMonitor
|
||||||
|
|
||||||
|
public StatusMonitorBase CommunicationMonitor { get; private set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
|
public class EiscApiPropertiesConfig
|
||||||
|
{
|
||||||
|
[JsonProperty("control")]
|
||||||
|
public EssentialsControlPropertiesConfig Control { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("devices")]
|
||||||
|
public List<ApiDevicePropertiesConfig> Devices { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("rooms")]
|
||||||
|
public List<ApiRoomPropertiesConfig> Rooms { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public class ApiDevicePropertiesConfig
|
||||||
|
{
|
||||||
|
[JsonProperty("deviceKey")]
|
||||||
|
public string DeviceKey { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("joinStart")]
|
||||||
|
public uint JoinStart { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("joinMapKey")]
|
||||||
|
public string JoinMapKey { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ApiRoomPropertiesConfig
|
||||||
|
{
|
||||||
|
[JsonProperty("roomKey")]
|
||||||
|
public string RoomKey { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("joinStart")]
|
||||||
|
public uint JoinStart { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("joinMapKey")]
|
||||||
|
public string JoinMapKey { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class EiscApiAdvancedFactory : EssentialsDeviceFactory<EiscApiAdvanced>
|
||||||
|
{
|
||||||
|
public EiscApiAdvancedFactory()
|
||||||
|
{
|
||||||
|
TypeNames = new List<string> { "eiscapiadv", "eiscapiadvanced", "eiscapiadvancedserver", "eiscapiadvancedclient", "vceiscapiadv", "vceiscapiadvanced" };
|
||||||
|
}
|
||||||
|
|
||||||
|
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||||
|
{
|
||||||
|
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new EiscApiAdvanced Device");
|
||||||
|
|
||||||
|
var controlProperties = CommFactory.GetControlPropertiesConfig(dc);
|
||||||
|
|
||||||
|
BasicTriList eisc;
|
||||||
|
|
||||||
|
switch (dc.Type.ToLower())
|
||||||
|
{
|
||||||
|
case "eiscapiadv":
|
||||||
|
case "eiscapiadvanced":
|
||||||
|
{
|
||||||
|
eisc = new ThreeSeriesTcpIpEthernetIntersystemCommunications(controlProperties.IpIdInt,
|
||||||
|
controlProperties.TcpSshProperties.Address, Global.ControlSystem);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "eiscapiadvancedserver":
|
||||||
|
{
|
||||||
|
eisc = new EISCServer(controlProperties.IpIdInt, Global.ControlSystem);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "eiscapiadvancedclient":
|
||||||
|
{
|
||||||
|
eisc = new EISCClient(controlProperties.IpIdInt, controlProperties.TcpSshProperties.Address, Global.ControlSystem);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "vceiscapiadv":
|
||||||
|
case "vceiscapiadvanced":
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(controlProperties.RoomId))
|
||||||
|
{
|
||||||
|
Debug.LogMessage(LogEventLevel.Information, "Unable to build VC-4 EISC Client for device {0}. Room ID is missing or empty", dc.Key);
|
||||||
|
eisc = null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
eisc = new VirtualControlEISCClient(controlProperties.IpIdInt, controlProperties.RoomId,
|
||||||
|
Global.ControlSystem);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
eisc = null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (eisc == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new EiscApiAdvanced(dc, eisc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -3,71 +3,62 @@ using Serilog.Events;
|
|||||||
|
|
||||||
//using PepperDash.Essentials.Devices.Common.Cameras;
|
//using PepperDash.Essentials.Devices.Common.Cameras;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Helper methods for bridges
|
||||||
|
/// </summary>
|
||||||
|
public static class BridgeHelper
|
||||||
{
|
{
|
||||||
/// <summary>
|
public static void PrintJoinMap(string command)
|
||||||
/// Helper methods for bridges
|
|
||||||
/// </summary>
|
|
||||||
public static class BridgeHelper
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
var targets = command.Split(' ');
|
||||||
/// PrintJoinMp method
|
|
||||||
/// </summary>
|
var bridgeKey = targets[0].Trim();
|
||||||
/// <param name="command">target bridgekey to print join map for</param>
|
|
||||||
public static void PrintJoinMap(string command)
|
if (!(DeviceManager.GetDeviceForKey(bridgeKey) is EiscApiAdvanced bridge))
|
||||||
{
|
{
|
||||||
var targets = command.Split(' ');
|
Debug.LogMessage(LogEventLevel.Information, "Unable to find advanced bridge with key: '{0}'", bridgeKey);
|
||||||
|
return;
|
||||||
var bridgeKey = targets[0].Trim();
|
|
||||||
|
|
||||||
if (!(DeviceManager.GetDeviceForKey(bridgeKey) is EiscApiAdvanced bridge))
|
|
||||||
{
|
|
||||||
Debug.LogMessage(LogEventLevel.Information, "Unable to find advanced bridge with key: '{0}'", bridgeKey);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (targets.Length > 1)
|
|
||||||
{
|
|
||||||
var deviceKey = targets[1].Trim();
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(deviceKey)) return;
|
|
||||||
bridge.PrintJoinMapForDevice(deviceKey);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
bridge.PrintJoinMaps();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/// <summary>
|
|
||||||
/// JoinmapMarkdown method
|
if (targets.Length > 1)
|
||||||
/// </summary>
|
|
||||||
public static void JoinmapMarkdown(string command)
|
|
||||||
{
|
{
|
||||||
var targets = command.Split(' ');
|
var deviceKey = targets[1].Trim();
|
||||||
|
|
||||||
var bridgeKey = targets[0].Trim();
|
if (string.IsNullOrEmpty(deviceKey)) return;
|
||||||
|
bridge.PrintJoinMapForDevice(deviceKey);
|
||||||
var bridge = DeviceManager.GetDeviceForKey(bridgeKey) as EiscApiAdvanced;
|
}
|
||||||
|
else
|
||||||
if (bridge == null)
|
{
|
||||||
{
|
bridge.PrintJoinMaps();
|
||||||
Debug.LogMessage(LogEventLevel.Information, "Unable to find advanced bridge with key: '{0}'", bridgeKey);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (targets.Length > 1)
|
|
||||||
{
|
|
||||||
var deviceKey = targets[1].Trim();
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(deviceKey)) return;
|
|
||||||
bridge.MarkdownJoinMapForDevice(deviceKey, bridgeKey);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
bridge.MarkdownForBridge(bridgeKey);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public static void JoinmapMarkdown(string command)
|
||||||
|
{
|
||||||
|
var targets = command.Split(' ');
|
||||||
|
|
||||||
|
var bridgeKey = targets[0].Trim();
|
||||||
|
|
||||||
|
var bridge = DeviceManager.GetDeviceForKey(bridgeKey) as EiscApiAdvanced;
|
||||||
|
|
||||||
|
if (bridge == null)
|
||||||
|
{
|
||||||
|
Debug.LogMessage(LogEventLevel.Information, "Unable to find advanced bridge with key: '{0}'", bridgeKey);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (targets.Length > 1)
|
||||||
|
{
|
||||||
|
var deviceKey = targets[1].Trim();
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(deviceKey)) return;
|
||||||
|
bridge.MarkdownJoinMapForDevice(deviceKey, bridgeKey);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bridge.MarkdownForBridge(bridgeKey);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,19 +1,11 @@
|
|||||||
using Crestron.SimplSharpPro.DeviceSupport;
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Defines a device that uses JoinMapBaseAdvanced for its join map
|
||||||
|
/// </summary>
|
||||||
|
public interface IBridgeAdvanced
|
||||||
{
|
{
|
||||||
/// <summary>
|
void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge);
|
||||||
/// Defines the contract for IBridgeAdvanced
|
|
||||||
/// </summary>
|
|
||||||
public interface IBridgeAdvanced
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Links the bridge to the API using the provided trilist, join start, join map key, and bridge.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="trilist">The trilist to link to.</param>
|
|
||||||
/// <param name="joinStart">The starting join number.</param>
|
|
||||||
/// <param name="joinMapKey">The key for the join map.</param>
|
|
||||||
/// <param name="bridge">The EISC API bridge.</param>
|
|
||||||
void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,110 +1,70 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges;
|
||||||
|
|
||||||
|
public class AirMediaControllerJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
|
[JoinName("IsOnline")]
|
||||||
|
public JoinDataComplete IsOnline = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Air Media Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("IsInSession")]
|
||||||
|
public JoinDataComplete IsInSession = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Air Media In Sharing Session", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("HdmiVideoSync")]
|
||||||
|
public JoinDataComplete HdmiVideoSync = new JoinDataComplete(new JoinData { JoinNumber = 3, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Air Media Has HDMI Video Sync", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("AutomaticInputRoutingEnabled")]
|
||||||
|
public JoinDataComplete AutomaticInputRoutingEnabled = new JoinDataComplete(new JoinData { JoinNumber = 4, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Air Media Automatic Input Routing Enable(d)", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("VideoOut")]
|
||||||
|
public JoinDataComplete VideoOut = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Air Media Video Route Select / Feedback", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("ErrorFB")]
|
||||||
|
public JoinDataComplete ErrorFB = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Air Media Error Status", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("NumberOfUsersConnectedFB")]
|
||||||
|
public JoinDataComplete NumberOfUsersConnectedFB = new JoinDataComplete(new JoinData { JoinNumber = 3, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Air Media Number of Users Connected", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("LoginCode")]
|
||||||
|
public JoinDataComplete LoginCode = new JoinDataComplete(new JoinData { JoinNumber = 4, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Air Media Login Code Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("Name")]
|
||||||
|
public JoinDataComplete Name = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Air Media Device Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
||||||
|
|
||||||
|
[JoinName("ConnectionAddressFB")]
|
||||||
|
public JoinDataComplete ConnectionAddressFB = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Air Media IP Address", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
||||||
|
|
||||||
|
[JoinName("HostnameFB")]
|
||||||
|
public JoinDataComplete HostnameFB = new JoinDataComplete(new JoinData { JoinNumber = 3, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Air Media Hostname", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
||||||
|
|
||||||
|
[JoinName("SerialNumberFeedback")]
|
||||||
|
public JoinDataComplete SerialNumberFeedback = new JoinDataComplete(new JoinData { JoinNumber = 4, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Air Media Serial Number", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a AirMediaControllerJoinMap
|
/// Constructor to use when instantiating this Join Map without inheriting from it
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class AirMediaControllerJoinMap : JoinMapBaseAdvanced
|
/// <param name="joinStart">Join this join map will start at</param>
|
||||||
|
public AirMediaControllerJoinMap(uint joinStart)
|
||||||
|
: this(joinStart, typeof(AirMediaControllerJoinMap))
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Air Media Online status
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("IsOnline")]
|
|
||||||
public JoinDataComplete IsOnline = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Air Media Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Air Media In Sharing Session status
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("IsInSession")]
|
|
||||||
public JoinDataComplete IsInSession = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Air Media In Sharing Session", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Air Media Has HDMI Video Sync status
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("HdmiVideoSync")]
|
|
||||||
public JoinDataComplete HdmiVideoSync = new JoinDataComplete(new JoinData { JoinNumber = 3, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Air Media Has HDMI Video Sync", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Air Media Automatic Input Routing Enable(d)
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("AutomaticInputRoutingEnabled")]
|
|
||||||
public JoinDataComplete AutomaticInputRoutingEnabled = new JoinDataComplete(new JoinData { JoinNumber = 4, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Air Media Automatic Input Routing Enable(d)", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Air Media Video Route Select / Feedback
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("VideoOut")]
|
|
||||||
public JoinDataComplete VideoOut = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Air Media Video Route Select / Feedback", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Air Media Error Status Feedback
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("ErrorFB")]
|
|
||||||
public JoinDataComplete ErrorFB = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Air Media Error Status", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Air Media Number of Users Connected Feedback
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("NumberOfUsersConnectedFB")]
|
|
||||||
public JoinDataComplete NumberOfUsersConnectedFB = new JoinDataComplete(new JoinData { JoinNumber = 3, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Air Media Number of Users Connected", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Air Media Login Code Set / Get
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("LoginCode")]
|
|
||||||
public JoinDataComplete LoginCode = new JoinDataComplete(new JoinData { JoinNumber = 4, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Air Media Login Code Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Air Media Device Name
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("Name")]
|
|
||||||
public JoinDataComplete Name = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Air Media Device Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Air Media IP Address Feedback
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("ConnectionAddressFB")]
|
|
||||||
public JoinDataComplete ConnectionAddressFB = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Air Media IP Address", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Air Media Hostname Feedback
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("HostnameFB")]
|
|
||||||
public JoinDataComplete HostnameFB = new JoinDataComplete(new JoinData { JoinNumber = 3, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Air Media Hostname", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Air Media Serial Number Feedback
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("SerialNumberFeedback")]
|
|
||||||
public JoinDataComplete SerialNumberFeedback = new JoinDataComplete(new JoinData { JoinNumber = 4, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Air Media Serial Number", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Constructor to use when instantiating this Join Map without inheriting from it
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="joinStart">Join this join map will start at</param>
|
|
||||||
public AirMediaControllerJoinMap(uint joinStart)
|
|
||||||
: this(joinStart, typeof(AirMediaControllerJoinMap))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Constructor to use when extending this Join map
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="joinStart">Join this join map will start at</param>
|
|
||||||
/// <param name="type">Type of the child join map</param>
|
|
||||||
protected AirMediaControllerJoinMap(uint joinStart, Type type) : base(joinStart, type){}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor to use when extending this Join map
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="joinStart">Join this join map will start at</param>
|
||||||
|
/// <param name="type">Type of the child join map</param>
|
||||||
|
protected AirMediaControllerJoinMap(uint joinStart, Type type) : base(joinStart, type){}
|
||||||
}
|
}
|
||||||
@@ -1,77 +1,52 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges;
|
||||||
|
|
||||||
|
public class AppleTvJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
|
[JoinName("UpArrow")]
|
||||||
|
public JoinDataComplete UpArrow = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "AppleTv Nav Up", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("DnArrow")]
|
||||||
|
public JoinDataComplete DnArrow = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "AppleTv Nav Down", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("LeftArrow")]
|
||||||
|
public JoinDataComplete LeftArrow = new JoinDataComplete(new JoinData { JoinNumber = 3, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "AppleTv Nav Left", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("RightArrow")]
|
||||||
|
public JoinDataComplete RightArrow = new JoinDataComplete(new JoinData { JoinNumber = 4, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "AppleTv Nav Right", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("Menu")]
|
||||||
|
public JoinDataComplete Menu = new JoinDataComplete(new JoinData { JoinNumber = 5, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "AppleTv Menu", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("Select")]
|
||||||
|
public JoinDataComplete Select = new JoinDataComplete(new JoinData { JoinNumber = 6, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "AppleTv Select", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("PlayPause")]
|
||||||
|
public JoinDataComplete PlayPause = new JoinDataComplete(new JoinData { JoinNumber = 7, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "AppleTv Play/Pause", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a AppleTvJoinMap
|
/// Constructor to use when instantiating this Join Map without inheriting from it
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class AppleTvJoinMap : JoinMapBaseAdvanced
|
/// <param name="joinStart">Join this join map will start at</param>
|
||||||
|
public AppleTvJoinMap(uint joinStart)
|
||||||
|
: base(joinStart, typeof(AppleTvJoinMap))
|
||||||
{
|
{
|
||||||
/// <summary>
|
}
|
||||||
/// AppleTv Nav Up
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("UpArrow")]
|
|
||||||
public JoinDataComplete UpArrow = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "AppleTv Nav Up", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// AppleTv Nav Down
|
/// Constructor to use when extending this Join map
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JoinName("DnArrow")]
|
/// <param name="joinStart">Join this join map will start at</param>
|
||||||
public JoinDataComplete DnArrow = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
|
/// <param name="type">Type of the child join map</param>
|
||||||
new JoinMetadata { Description = "AppleTv Nav Down", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
public AppleTvJoinMap(uint joinStart, Type type) : base(joinStart, type)
|
||||||
|
{
|
||||||
/// <summary>
|
|
||||||
/// AppleTv Nav Left
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("LeftArrow")]
|
|
||||||
public JoinDataComplete LeftArrow = new JoinDataComplete(new JoinData { JoinNumber = 3, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "AppleTv Nav Left", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// AppleTv Nav Right
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("RightArrow")]
|
|
||||||
public JoinDataComplete RightArrow = new JoinDataComplete(new JoinData { JoinNumber = 4, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "AppleTv Nav Right", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// AppleTv Menu
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("Menu")]
|
|
||||||
public JoinDataComplete Menu = new JoinDataComplete(new JoinData { JoinNumber = 5, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "AppleTv Menu", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// AppleTv Select
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("Select")]
|
|
||||||
public JoinDataComplete Select = new JoinDataComplete(new JoinData { JoinNumber = 6, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "AppleTv Select", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// AppleTv Play/Pause
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("PlayPause")]
|
|
||||||
public JoinDataComplete PlayPause = new JoinDataComplete(new JoinData { JoinNumber = 7, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "AppleTv Play/Pause", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Constructor to use when instantiating this Join Map without inheriting from it
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="joinStart">Join this join map will start at</param>
|
|
||||||
public AppleTvJoinMap(uint joinStart)
|
|
||||||
: base(joinStart, typeof(AppleTvJoinMap))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Constructor to use when extending this Join map
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="joinStart">Join this join map will start at</param>
|
|
||||||
/// <param name="type">Type of the child join map</param>
|
|
||||||
public AppleTvJoinMap(uint joinStart, Type type) : base(joinStart, type)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,63 +1,44 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges;
|
||||||
|
|
||||||
|
public class C2nRthsControllerJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
|
[JoinName("IsOnline")]
|
||||||
|
public JoinDataComplete IsOnline = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Temp Sensor Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("TemperatureFormat")]
|
||||||
|
public JoinDataComplete TemperatureFormat = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Temp Sensor Unit Format", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("Temperature")]
|
||||||
|
public JoinDataComplete Temperature = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Temp Sensor Temperature Feedback", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("Humidity")]
|
||||||
|
public JoinDataComplete Humidity = new JoinDataComplete(new JoinData { JoinNumber = 3, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Temp Sensor Humidity Feedback", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("Name")]
|
||||||
|
public JoinDataComplete Name = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Temp Sensor Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a C2nRthsControllerJoinMap
|
/// Constructor to use when instantiating this Join Map without inheriting from it
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class C2nRthsControllerJoinMap : JoinMapBaseAdvanced
|
/// <param name="joinStart">Join this join map will start at</param>
|
||||||
|
public C2nRthsControllerJoinMap(uint joinStart)
|
||||||
|
: this(joinStart, typeof(C2nRthsControllerJoinMap))
|
||||||
{
|
{
|
||||||
/// <summary>
|
}
|
||||||
/// C2nRthsController Online status
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("IsOnline")]
|
|
||||||
public JoinDataComplete IsOnline = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Temp Sensor Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Temperature Format (C/F)
|
/// Constructor to use when extending this Join map
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JoinName("TemperatureFormat")]
|
/// <param name="joinStart">Join this join map will start at</param>
|
||||||
public JoinDataComplete TemperatureFormat = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
|
/// <param name="type">Type of the child join map</param>
|
||||||
new JoinMetadata { Description = "Temp Sensor Unit Format", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
protected C2nRthsControllerJoinMap(uint joinStart, Type type) : base(joinStart, type)
|
||||||
|
{
|
||||||
/// <summary>
|
|
||||||
/// Temperature Sensor Feedbacks
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("Temperature")]
|
|
||||||
public JoinDataComplete Temperature = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Temp Sensor Temperature Feedback", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Humidity Sensor Feedbacks
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("Humidity")]
|
|
||||||
public JoinDataComplete Humidity = new JoinDataComplete(new JoinData { JoinNumber = 3, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Temp Sensor Humidity Feedback", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Temp Sensor Name
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("Name")]
|
|
||||||
public JoinDataComplete Name = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Temp Sensor Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Constructor to use when instantiating this Join Map without inheriting from it
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="joinStart">Join this join map will start at</param>
|
|
||||||
public C2nRthsControllerJoinMap(uint joinStart)
|
|
||||||
: this(joinStart, typeof(C2nRthsControllerJoinMap))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Constructor to use when extending this Join map
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="joinStart">Join this join map will start at</param>
|
|
||||||
/// <param name="type">Type of the child join map</param>
|
|
||||||
protected C2nRthsControllerJoinMap(uint joinStart, Type type) : base(joinStart, type)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,140 +1,68 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Join map for CameraBase devices
|
||||||
|
/// </summary>
|
||||||
|
public class CameraControllerJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
|
[JoinName("TiltUp")]
|
||||||
|
public JoinDataComplete TiltUp = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 }, new JoinMetadata { Description = "Tilt Up", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
[JoinName("TiltDown")]
|
||||||
|
public JoinDataComplete TiltDown = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 }, new JoinMetadata { Description = "Tilt Down", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
[JoinName("PanLeft")]
|
||||||
|
public JoinDataComplete PanLeft = new JoinDataComplete(new JoinData { JoinNumber = 3, JoinSpan = 1 }, new JoinMetadata { Description = "Pan Left", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
[JoinName("PanRight")]
|
||||||
|
public JoinDataComplete PanRight = new JoinDataComplete(new JoinData { JoinNumber = 4, JoinSpan = 1 }, new JoinMetadata { Description = "Pan Right", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
[JoinName("ZoomIn")]
|
||||||
|
public JoinDataComplete ZoomIn = new JoinDataComplete(new JoinData { JoinNumber = 5, JoinSpan = 1 }, new JoinMetadata { Description = "Zoom In", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
[JoinName("ZoomOut")]
|
||||||
|
public JoinDataComplete ZoomOut = new JoinDataComplete(new JoinData { JoinNumber = 6, JoinSpan = 1 }, new JoinMetadata { Description = "Zoom Out", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("IsOnline")]
|
||||||
|
public JoinDataComplete IsOnline = new JoinDataComplete(new JoinData { JoinNumber = 9, JoinSpan = 1 }, new JoinMetadata { Description = "Is Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
[JoinName("PowerOn")]
|
||||||
|
public JoinDataComplete PowerOn = new JoinDataComplete(new JoinData { JoinNumber = 7, JoinSpan = 1 }, new JoinMetadata { Description = "Power On", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
[JoinName("PowerOff")]
|
||||||
|
public JoinDataComplete PowerOff = new JoinDataComplete(new JoinData { JoinNumber = 8, JoinSpan = 1 }, new JoinMetadata { Description = "Power Off", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("NumberOfPresets")]
|
||||||
|
public JoinDataComplete NumberOfPresets = new JoinDataComplete(new JoinData { JoinNumber = 11, JoinSpan = 1 }, new JoinMetadata { Description = "Tells Essentials the number of defined presets", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
[JoinName("PresetRecallStart")]
|
||||||
|
public JoinDataComplete PresetRecallStart = new JoinDataComplete(new JoinData { JoinNumber = 11, JoinSpan = 20 }, new JoinMetadata { Description = "Preset Recall Start", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
[JoinName("PresetLabelStart")]
|
||||||
|
public JoinDataComplete PresetLabelStart = new JoinDataComplete(new JoinData { JoinNumber = 11, JoinSpan = 20 }, new JoinMetadata { Description = "Preset Label Start", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Serial });
|
||||||
|
[JoinName("PresetSaveStart")]
|
||||||
|
public JoinDataComplete PresetSaveStart = new JoinDataComplete(new JoinData { JoinNumber = 31, JoinSpan = 20 }, new JoinMetadata { Description = "Preset Save Start", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("CameraModeAuto")]
|
||||||
|
public JoinDataComplete CameraModeAuto = new JoinDataComplete(new JoinData { JoinNumber = 51, JoinSpan = 1 }, new JoinMetadata { Description = "Camera Mode Auto", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
[JoinName("CameraModeManual")]
|
||||||
|
public JoinDataComplete CameraModeManual = new JoinDataComplete(new JoinData { JoinNumber = 52, JoinSpan = 1 }, new JoinMetadata { Description = "Camera Mode Manual", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
[JoinName("CameraModeOff")]
|
||||||
|
public JoinDataComplete CameraModeOff = new JoinDataComplete(new JoinData { JoinNumber = 53, JoinSpan = 1 }, new JoinMetadata { Description = "Camera Mode Off", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("SupportsCameraModeAuto")]
|
||||||
|
public JoinDataComplete SupportsCameraModeAuto = new JoinDataComplete(new JoinData { JoinNumber = 55, JoinSpan = 1 }, new JoinMetadata { Description = "Supports Camera Mode Auto", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
[JoinName("SupportsCameraModeOff")]
|
||||||
|
public JoinDataComplete SupportsCameraModeOff = new JoinDataComplete(new JoinData { JoinNumber = 56, JoinSpan = 1 }, new JoinMetadata { Description = "Supports Camera Mode Off", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
[JoinName("SupportsPresets")]
|
||||||
|
public JoinDataComplete SupportsPresets = new JoinDataComplete(new JoinData { JoinNumber = 57, JoinSpan = 1 }, new JoinMetadata { Description = "Supports Presets", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a CameraControllerJoinMap
|
/// Constructor to use when instantiating this Join Map without inheriting from it
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class CameraControllerJoinMap : JoinMapBaseAdvanced
|
/// <param name="joinStart">Join this join map will start at</param>
|
||||||
|
public CameraControllerJoinMap(uint joinStart)
|
||||||
|
: this(joinStart, typeof(CameraControllerJoinMap))
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Tilt Up
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("TiltUp")]
|
|
||||||
public JoinDataComplete TiltUp = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 }, new JoinMetadata { Description = "Tilt Up", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Tilt Down
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("TiltDown")]
|
|
||||||
public JoinDataComplete TiltDown = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 }, new JoinMetadata { Description = "Tilt Down", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Pan Left
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("PanLeft")]
|
|
||||||
public JoinDataComplete PanLeft = new JoinDataComplete(new JoinData { JoinNumber = 3, JoinSpan = 1 }, new JoinMetadata { Description = "Pan Left", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Pan Right
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("PanRight")]
|
|
||||||
public JoinDataComplete PanRight = new JoinDataComplete(new JoinData { JoinNumber = 4, JoinSpan = 1 }, new JoinMetadata { Description = "Pan Right", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Zoom In
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("ZoomIn")]
|
|
||||||
public JoinDataComplete ZoomIn = new JoinDataComplete(new JoinData { JoinNumber = 5, JoinSpan = 1 }, new JoinMetadata { Description = "Zoom In", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Zoom Out
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("ZoomOut")]
|
|
||||||
public JoinDataComplete ZoomOut = new JoinDataComplete(new JoinData { JoinNumber = 6, JoinSpan = 1 }, new JoinMetadata { Description = "Zoom Out", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Is Online
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("IsOnline")]
|
|
||||||
public JoinDataComplete IsOnline = new JoinDataComplete(new JoinData { JoinNumber = 9, JoinSpan = 1 }, new JoinMetadata { Description = "Is Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Power On
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("PowerOn")]
|
|
||||||
public JoinDataComplete PowerOn = new JoinDataComplete(new JoinData { JoinNumber = 7, JoinSpan = 1 }, new JoinMetadata { Description = "Power On", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Power Off
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("PowerOff")]
|
|
||||||
public JoinDataComplete PowerOff = new JoinDataComplete(new JoinData { JoinNumber = 8, JoinSpan = 1 }, new JoinMetadata { Description = "Power Off", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Number Of Presets
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("NumberOfPresets")]
|
|
||||||
public JoinDataComplete NumberOfPresets = new JoinDataComplete(new JoinData { JoinNumber = 11, JoinSpan = 1 }, new JoinMetadata { Description = "Tells Essentials the number of defined presets", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Preset Recall Start
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("PresetRecallStart")]
|
|
||||||
public JoinDataComplete PresetRecallStart = new JoinDataComplete(new JoinData { JoinNumber = 11, JoinSpan = 20 }, new JoinMetadata { Description = "Preset Recall Start", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Preset Label Start
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("PresetLabelStart")]
|
|
||||||
public JoinDataComplete PresetLabelStart = new JoinDataComplete(new JoinData { JoinNumber = 11, JoinSpan = 20 }, new JoinMetadata { Description = "Preset Label Start", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Serial });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Preset Save Start
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("PresetSaveStart")]
|
|
||||||
public JoinDataComplete PresetSaveStart = new JoinDataComplete(new JoinData { JoinNumber = 31, JoinSpan = 20 }, new JoinMetadata { Description = "Preset Save Start", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Camera Mode Auto
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("CameraModeAuto")]
|
|
||||||
public JoinDataComplete CameraModeAuto = new JoinDataComplete(new JoinData { JoinNumber = 51, JoinSpan = 1 }, new JoinMetadata { Description = "Camera Mode Auto", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Camera Mode Manual
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("CameraModeManual")]
|
|
||||||
public JoinDataComplete CameraModeManual = new JoinDataComplete(new JoinData { JoinNumber = 52, JoinSpan = 1 }, new JoinMetadata { Description = "Camera Mode Manual", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Camera Mode Off
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("CameraModeOff")]
|
|
||||||
public JoinDataComplete CameraModeOff = new JoinDataComplete(new JoinData { JoinNumber = 53, JoinSpan = 1 }, new JoinMetadata { Description = "Camera Mode Off", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Supports Camera Mode Manual
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("SupportsCameraModeAuto")]
|
|
||||||
public JoinDataComplete SupportsCameraModeAuto = new JoinDataComplete(new JoinData { JoinNumber = 55, JoinSpan = 1 }, new JoinMetadata { Description = "Supports Camera Mode Auto", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Supports Camera Mode Off
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("SupportsCameraModeOff")]
|
|
||||||
public JoinDataComplete SupportsCameraModeOff = new JoinDataComplete(new JoinData { JoinNumber = 56, JoinSpan = 1 }, new JoinMetadata { Description = "Supports Camera Mode Off", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Supports Presets
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("SupportsPresets")]
|
|
||||||
public JoinDataComplete SupportsPresets = new JoinDataComplete(new JoinData { JoinNumber = 57, JoinSpan = 1 }, new JoinMetadata { Description = "Supports Presets", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Constructor to use when instantiating this Join Map without inheriting from it
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="joinStart">Join this join map will start at</param>
|
|
||||||
public CameraControllerJoinMap(uint joinStart)
|
|
||||||
: this(joinStart, typeof(CameraControllerJoinMap))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Constructor to use when extending this Join map
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="joinStart">Join this join map will start at</param>
|
|
||||||
/// <param name="type">Type of the child join map</param>
|
|
||||||
protected CameraControllerJoinMap(uint joinStart, Type type) : base(joinStart, type){}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor to use when extending this Join map
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="joinStart">Join this join map will start at</param>
|
||||||
|
/// <param name="type">Type of the child join map</param>
|
||||||
|
protected CameraControllerJoinMap(uint joinStart, Type type) : base(joinStart, type){}
|
||||||
}
|
}
|
||||||
@@ -1,320 +1,196 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges;
|
||||||
|
|
||||||
|
public class CenOdtOccupancySensorBaseJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
|
#region Digitals
|
||||||
|
|
||||||
|
[JoinName("Online")]
|
||||||
|
public JoinDataComplete Online = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("ForceOccupied")]
|
||||||
|
public JoinDataComplete ForceOccupied = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Force Occupied", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("ForceVacant")]
|
||||||
|
public JoinDataComplete ForceVacant = new JoinDataComplete(new JoinData { JoinNumber = 3, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Force Vacant", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("EnableRawStates")]
|
||||||
|
public JoinDataComplete EnableRawStates = new JoinDataComplete(new JoinData { JoinNumber = 4, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Enable Raw States", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("RoomOccupiedFeedback")]
|
||||||
|
public JoinDataComplete RoomOccupiedFeedback = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Room Occupied Feedback", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("GraceOccupancyDetectedFeedback")]
|
||||||
|
public JoinDataComplete GraceOccupancyDetectedFeedback = new JoinDataComplete(new JoinData { JoinNumber = 3, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Grace Occupancy Detected Feedback", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("RoomVacantFeedback")]
|
||||||
|
public JoinDataComplete RoomVacantFeedback = new JoinDataComplete(new JoinData { JoinNumber = 4, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Room Vacant Feedback", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("RawOccupancyFeedback")]
|
||||||
|
public JoinDataComplete RawOccupancyFeedback = new JoinDataComplete(new JoinData { JoinNumber = 5, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Raw Occupancy Feedback", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("RawOccupancyPirFeedback")]
|
||||||
|
public JoinDataComplete RawOccupancyPirFeedback = new JoinDataComplete(new JoinData { JoinNumber = 6, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Raw Occupancy Pir Feedback", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("RawOccupancyUsFeedback")]
|
||||||
|
public JoinDataComplete RawOccupancyUsFeedback = new JoinDataComplete(new JoinData { JoinNumber = 7, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Raw Occupancy Us Feedback", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("IdentityModeOn")]
|
||||||
|
public JoinDataComplete IdentityMode = new JoinDataComplete(new JoinData { JoinNumber = 8, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Enable Identity Mode", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("IdentityModeFeedback")]
|
||||||
|
public JoinDataComplete IdentityModeFeedback = new JoinDataComplete(new JoinData { JoinNumber = 8, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Identity Mode Feedback", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("EnableLedFlash")]
|
||||||
|
public JoinDataComplete EnableLedFlash = new JoinDataComplete(new JoinData { JoinNumber = 11, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Enable Led Flash", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("DisableLedFlash")]
|
||||||
|
public JoinDataComplete DisableLedFlash = new JoinDataComplete(new JoinData { JoinNumber = 12, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Disable Led Flash", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("EnableShortTimeout")]
|
||||||
|
public JoinDataComplete EnableShortTimeout = new JoinDataComplete(new JoinData { JoinNumber = 13, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Enable Short Timeout", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("DisableShortTimeout")]
|
||||||
|
public JoinDataComplete DisableShortTimeout = new JoinDataComplete(new JoinData { JoinNumber = 14, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Disable Short Timeout", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("OrWhenVacated")]
|
||||||
|
public JoinDataComplete OrWhenVacated = new JoinDataComplete(new JoinData { JoinNumber = 15, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Or When Vacated", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("AndWhenVacated")]
|
||||||
|
public JoinDataComplete AndWhenVacated = new JoinDataComplete(new JoinData { JoinNumber = 16, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "AndWhenVacated", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("EnableUsA")]
|
||||||
|
public JoinDataComplete EnableUsA = new JoinDataComplete(new JoinData { JoinNumber = 17, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Enable Us A", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("DisableUsA")]
|
||||||
|
public JoinDataComplete DisableUsA = new JoinDataComplete(new JoinData { JoinNumber = 18, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Disable Us A", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("EnableUsB")]
|
||||||
|
public JoinDataComplete EnableUsB = new JoinDataComplete(new JoinData { JoinNumber = 19, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Enable Us B", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("DisableUsB")]
|
||||||
|
public JoinDataComplete DisableUsB = new JoinDataComplete(new JoinData { JoinNumber = 20, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Disable Us B", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("EnablePir")]
|
||||||
|
public JoinDataComplete EnablePir = new JoinDataComplete(new JoinData { JoinNumber = 21, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Enable Pir", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("DisablePir")]
|
||||||
|
public JoinDataComplete DisablePir = new JoinDataComplete(new JoinData { JoinNumber = 22, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Disable Pir", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("IncrementUsInOccupiedState")]
|
||||||
|
public JoinDataComplete IncrementUsInOccupiedState = new JoinDataComplete(new JoinData { JoinNumber = 23, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Increment Us In OccupiedState", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("DecrementUsInOccupiedState")]
|
||||||
|
public JoinDataComplete DecrementUsInOccupiedState = new JoinDataComplete(new JoinData { JoinNumber = 24, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Dencrement Us In Occupied State", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("IncrementUsInVacantState")]
|
||||||
|
public JoinDataComplete IncrementUsInVacantState = new JoinDataComplete(new JoinData { JoinNumber = 25, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Increment Us In VacantState", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("DecrementUsInVacantState")]
|
||||||
|
public JoinDataComplete DecrementUsInVacantState = new JoinDataComplete(new JoinData { JoinNumber = 26, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Decrement Us In VacantState", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("IncrementPirInOccupiedState")]
|
||||||
|
public JoinDataComplete IncrementPirInOccupiedState = new JoinDataComplete(new JoinData { JoinNumber = 27, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Increment Pir In Occupied State", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("DecrementPirInOccupiedState")]
|
||||||
|
public JoinDataComplete DecrementPirInOccupiedState = new JoinDataComplete(new JoinData { JoinNumber = 28, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Decrement Pir In OccupiedState", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("IncrementPirInVacantState")]
|
||||||
|
public JoinDataComplete IncrementPirInVacantState = new JoinDataComplete(new JoinData { JoinNumber = 29, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Increment Pir In Vacant State", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("DecrementPirInVacantState")]
|
||||||
|
public JoinDataComplete DecrementPirInVacantState = new JoinDataComplete(new JoinData { JoinNumber = 30, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Decrement Pir In Vacant State", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Analog
|
||||||
|
|
||||||
|
[JoinName("Timeout")]
|
||||||
|
public JoinDataComplete Timeout = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Timeout", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("TimeoutLocalFeedback")]
|
||||||
|
public JoinDataComplete TimeoutLocalFeedback = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Timeout Local Feedback", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("InternalPhotoSensorValue")]
|
||||||
|
public JoinDataComplete InternalPhotoSensorValue = new JoinDataComplete(new JoinData { JoinNumber = 3, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Internal PhotoSensor Value", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("UsSensitivityInOccupiedState")]
|
||||||
|
public JoinDataComplete UsSensitivityInOccupiedState = new JoinDataComplete(new JoinData { JoinNumber = 5, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Us Sensitivity In Occupied State", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("UsSensitivityInVacantState")]
|
||||||
|
public JoinDataComplete UsSensitivityInVacantState = new JoinDataComplete(new JoinData { JoinNumber = 6, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Us Sensitivity In Vacant State", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("PirSensitivityInOccupiedState")]
|
||||||
|
public JoinDataComplete PirSensitivityInOccupiedState = new JoinDataComplete(new JoinData { JoinNumber = 7, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Pir Sensitivity In Occupied State", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("PirSensitivityInVacantState")]
|
||||||
|
public JoinDataComplete PirSensitivityInVacantState = new JoinDataComplete(new JoinData { JoinNumber = 8, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Pir Sensitivity In Vacant State", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Serial
|
||||||
|
|
||||||
|
[JoinName("Name")]
|
||||||
|
public JoinDataComplete Name = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a CenOdtOccupancySensorBaseJoinMap
|
/// Constructor to use when instantiating this Join Map without inheriting from it
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class CenOdtOccupancySensorBaseJoinMap : JoinMapBaseAdvanced
|
/// <param name="joinStart">Join this join map will start at</param>
|
||||||
|
public CenOdtOccupancySensorBaseJoinMap(uint joinStart)
|
||||||
|
: this(joinStart, typeof(CenOdtOccupancySensorBaseJoinMap))
|
||||||
{
|
{
|
||||||
#region Digitals
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Online
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("Online")]
|
|
||||||
public JoinDataComplete Online = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Force Occupied
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("ForceOccupied")]
|
|
||||||
public JoinDataComplete ForceOccupied = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Force Occupied", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Force Vacant
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("ForceVacant")]
|
|
||||||
public JoinDataComplete ForceVacant = new JoinDataComplete(new JoinData { JoinNumber = 3, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Force Vacant", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Enable Raw States
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("EnableRawStates")]
|
|
||||||
public JoinDataComplete EnableRawStates = new JoinDataComplete(new JoinData { JoinNumber = 4, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Enable Raw States", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Disable Raw States
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("RoomOccupiedFeedback")]
|
|
||||||
public JoinDataComplete RoomOccupiedFeedback = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Room Occupied Feedback", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Grace Occupancy Detected Feedback
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("GraceOccupancyDetectedFeedback")]
|
|
||||||
public JoinDataComplete GraceOccupancyDetectedFeedback = new JoinDataComplete(new JoinData { JoinNumber = 3, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Grace Occupancy Detected Feedback", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Room Vacant Feedback
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("RoomVacantFeedback")]
|
|
||||||
public JoinDataComplete RoomVacantFeedback = new JoinDataComplete(new JoinData { JoinNumber = 4, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Room Vacant Feedback", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Raw Occupancy Feedback
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("RawOccupancyFeedback")]
|
|
||||||
public JoinDataComplete RawOccupancyFeedback = new JoinDataComplete(new JoinData { JoinNumber = 5, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Raw Occupancy Feedback", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Raw Occupancy Pir Feedback
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("RawOccupancyPirFeedback")]
|
|
||||||
public JoinDataComplete RawOccupancyPirFeedback = new JoinDataComplete(new JoinData { JoinNumber = 6, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Raw Occupancy Pir Feedback", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Raw Occupancy Us Feedback
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("RawOccupancyUsFeedback")]
|
|
||||||
public JoinDataComplete RawOccupancyUsFeedback = new JoinDataComplete(new JoinData { JoinNumber = 7, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Raw Occupancy Us Feedback", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Identity Mode On
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("IdentityModeOn")]
|
|
||||||
public JoinDataComplete IdentityMode = new JoinDataComplete(new JoinData { JoinNumber = 8, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Enable Identity Mode", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Identity Mode Off
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("IdentityModeFeedback")]
|
|
||||||
public JoinDataComplete IdentityModeFeedback = new JoinDataComplete(new JoinData { JoinNumber = 8, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Identity Mode Feedback", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Enable Led Flash
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("EnableLedFlash")]
|
|
||||||
public JoinDataComplete EnableLedFlash = new JoinDataComplete(new JoinData { JoinNumber = 11, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Enable Led Flash", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Disable Led Flash
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("DisableLedFlash")]
|
|
||||||
public JoinDataComplete DisableLedFlash = new JoinDataComplete(new JoinData { JoinNumber = 12, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Disable Led Flash", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Enable Short Timeout
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("EnableShortTimeout")]
|
|
||||||
public JoinDataComplete EnableShortTimeout = new JoinDataComplete(new JoinData { JoinNumber = 13, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Enable Short Timeout", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Disable Short Timeout
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("DisableShortTimeout")]
|
|
||||||
public JoinDataComplete DisableShortTimeout = new JoinDataComplete(new JoinData { JoinNumber = 14, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Disable Short Timeout", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Or When Vacated
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("OrWhenVacated")]
|
|
||||||
public JoinDataComplete OrWhenVacated = new JoinDataComplete(new JoinData { JoinNumber = 15, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Or When Vacated", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// And When Vacated
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("AndWhenVacated")]
|
|
||||||
public JoinDataComplete AndWhenVacated = new JoinDataComplete(new JoinData { JoinNumber = 16, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "AndWhenVacated", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Enable Us A
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("EnableUsA")]
|
|
||||||
public JoinDataComplete EnableUsA = new JoinDataComplete(new JoinData { JoinNumber = 17, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Enable Us A", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Disable Us A
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("DisableUsA")]
|
|
||||||
public JoinDataComplete DisableUsA = new JoinDataComplete(new JoinData { JoinNumber = 18, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Disable Us A", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Enable Us B
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("EnableUsB")]
|
|
||||||
public JoinDataComplete EnableUsB = new JoinDataComplete(new JoinData { JoinNumber = 19, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Enable Us B", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Disable Us B
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("DisableUsB")]
|
|
||||||
public JoinDataComplete DisableUsB = new JoinDataComplete(new JoinData { JoinNumber = 20, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Disable Us B", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Enable Pir
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("EnablePir")]
|
|
||||||
public JoinDataComplete EnablePir = new JoinDataComplete(new JoinData { JoinNumber = 21, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Enable Pir", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Disable Pir
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("DisablePir")]
|
|
||||||
public JoinDataComplete DisablePir = new JoinDataComplete(new JoinData { JoinNumber = 22, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Disable Pir", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Increment Us In Occupied State
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("IncrementUsInOccupiedState")]
|
|
||||||
public JoinDataComplete IncrementUsInOccupiedState = new JoinDataComplete(new JoinData { JoinNumber = 23, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Increment Us In OccupiedState", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Decrement Us In Occupied State
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("DecrementUsInOccupiedState")]
|
|
||||||
public JoinDataComplete DecrementUsInOccupiedState = new JoinDataComplete(new JoinData { JoinNumber = 24, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Dencrement Us In Occupied State", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Increment Us In Vacant State
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("IncrementUsInVacantState")]
|
|
||||||
public JoinDataComplete IncrementUsInVacantState = new JoinDataComplete(new JoinData { JoinNumber = 25, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Increment Us In VacantState", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Decrement Us In Vacant State
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("DecrementUsInVacantState")]
|
|
||||||
public JoinDataComplete DecrementUsInVacantState = new JoinDataComplete(new JoinData { JoinNumber = 26, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Decrement Us In VacantState", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Increment Pir In Occupied State
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("IncrementPirInOccupiedState")]
|
|
||||||
public JoinDataComplete IncrementPirInOccupiedState = new JoinDataComplete(new JoinData { JoinNumber = 27, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Increment Pir In Occupied State", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Decrement Pir In Occupied State
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("DecrementPirInOccupiedState")]
|
|
||||||
public JoinDataComplete DecrementPirInOccupiedState = new JoinDataComplete(new JoinData { JoinNumber = 28, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Decrement Pir In OccupiedState", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Increment Pir In Vacant State
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("IncrementPirInVacantState")]
|
|
||||||
public JoinDataComplete IncrementPirInVacantState = new JoinDataComplete(new JoinData { JoinNumber = 29, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Increment Pir In Vacant State", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Decrement Pir In Vacant State
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("DecrementPirInVacantState")]
|
|
||||||
public JoinDataComplete DecrementPirInVacantState = new JoinDataComplete(new JoinData { JoinNumber = 30, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Decrement Pir In Vacant State", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Analog
|
|
||||||
/// <summary>
|
|
||||||
/// Timeout
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("Timeout")]
|
|
||||||
public JoinDataComplete Timeout = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Timeout", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Timeout Local Feedback
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("TimeoutLocalFeedback")]
|
|
||||||
public JoinDataComplete TimeoutLocalFeedback = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Timeout Local Feedback", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Internal PhotoSensor Value
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("InternalPhotoSensorValue")]
|
|
||||||
public JoinDataComplete InternalPhotoSensorValue = new JoinDataComplete(new JoinData { JoinNumber = 3, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Internal PhotoSensor Value", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// External PhotoSensor Value
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("UsSensitivityInOccupiedState")]
|
|
||||||
public JoinDataComplete UsSensitivityInOccupiedState = new JoinDataComplete(new JoinData { JoinNumber = 5, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Us Sensitivity In Occupied State", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Us Sensitivity In Vacant State
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("UsSensitivityInVacantState")]
|
|
||||||
public JoinDataComplete UsSensitivityInVacantState = new JoinDataComplete(new JoinData { JoinNumber = 6, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Us Sensitivity In Vacant State", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Pir Sensitivity In Occupied State
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("PirSensitivityInOccupiedState")]
|
|
||||||
public JoinDataComplete PirSensitivityInOccupiedState = new JoinDataComplete(new JoinData { JoinNumber = 7, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Pir Sensitivity In Occupied State", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Pir Sensitivity In Vacant State
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("PirSensitivityInVacantState")]
|
|
||||||
public JoinDataComplete PirSensitivityInVacantState = new JoinDataComplete(new JoinData { JoinNumber = 8, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Pir Sensitivity In Vacant State", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Serial
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Name
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("Name")]
|
|
||||||
public JoinDataComplete Name = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Constructor to use when instantiating this Join Map without inheriting from it
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="joinStart">Join this join map will start at</param>
|
|
||||||
public CenOdtOccupancySensorBaseJoinMap(uint joinStart)
|
|
||||||
: this(joinStart, typeof(CenOdtOccupancySensorBaseJoinMap))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Constructor to use when extending this Join map
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="joinStart">Join this join map will start at</param>
|
|
||||||
/// <param name="type">Type of the child join map</param>
|
|
||||||
protected CenOdtOccupancySensorBaseJoinMap(uint joinStart, Type type) : base(joinStart, type)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor to use when extending this Join map
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="joinStart">Join this join map will start at</param>
|
||||||
|
/// <param name="type">Type of the child join map</param>
|
||||||
|
protected CenOdtOccupancySensorBaseJoinMap(uint joinStart, Type type) : base(joinStart, type)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,133 +1,84 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges;
|
||||||
|
|
||||||
|
public class DisplayControllerJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
|
[JoinName("Name")]
|
||||||
|
public JoinDataComplete Name = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
||||||
|
|
||||||
|
[JoinName("PowerOff")]
|
||||||
|
public JoinDataComplete PowerOff = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Power Off", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("PowerOn")]
|
||||||
|
public JoinDataComplete PowerOn = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Power On", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("IsTwoWayDisplay")]
|
||||||
|
public JoinDataComplete IsTwoWayDisplay = new JoinDataComplete(new JoinData { JoinNumber = 3, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Is Two Way Display", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("VolumeUp")]
|
||||||
|
public JoinDataComplete VolumeUp = new JoinDataComplete(new JoinData { JoinNumber = 5, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Volume Up", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("VolumeLevel")]
|
||||||
|
public JoinDataComplete VolumeLevel = new JoinDataComplete(new JoinData { JoinNumber = 5, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Volume Level", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("VolumeDown")]
|
||||||
|
public JoinDataComplete VolumeDown = new JoinDataComplete(new JoinData { JoinNumber = 6, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Volume Down", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("VolumeMute")]
|
||||||
|
public JoinDataComplete VolumeMute = new JoinDataComplete(new JoinData { JoinNumber = 7, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Volume Mute", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("VolumeMuteOn")]
|
||||||
|
public JoinDataComplete VolumeMuteOn = new JoinDataComplete(new JoinData { JoinNumber = 8, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Volume Mute On", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("VolumeMuteOff")]
|
||||||
|
public JoinDataComplete VolumeMuteOff = new JoinDataComplete(new JoinData { JoinNumber = 9, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Volume Mute Off", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("InputSelectOffset")]
|
||||||
|
public JoinDataComplete InputSelectOffset = new JoinDataComplete(new JoinData { JoinNumber = 11, JoinSpan = 10 },
|
||||||
|
new JoinMetadata { Description = "Input Select", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("InputNamesOffset")]
|
||||||
|
public JoinDataComplete InputNamesOffset = new JoinDataComplete(new JoinData { JoinNumber = 11, JoinSpan = 10 },
|
||||||
|
new JoinMetadata { Description = "Input Names Offset", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
||||||
|
|
||||||
|
[JoinName("InputSelect")]
|
||||||
|
public JoinDataComplete InputSelect = new JoinDataComplete(new JoinData { JoinNumber = 11, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Input Select", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("ButtonVisibilityOffset")]
|
||||||
|
public JoinDataComplete ButtonVisibilityOffset = new JoinDataComplete(new JoinData { JoinNumber = 41, JoinSpan = 10 },
|
||||||
|
new JoinMetadata { Description = "Button Visibility Offset", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.DigitalSerial });
|
||||||
|
|
||||||
|
[JoinName("IsOnline")]
|
||||||
|
public JoinDataComplete IsOnline = new JoinDataComplete(new JoinData { JoinNumber = 50, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Is Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a DisplayControllerJoinMap
|
/// Constructor to use when instantiating this Join Map without inheriting from it
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class DisplayControllerJoinMap : JoinMapBaseAdvanced
|
/// <param name="joinStart">Join this join map will start at</param>
|
||||||
|
public DisplayControllerJoinMap(uint joinStart)
|
||||||
|
: this(joinStart, typeof(DisplayControllerJoinMap))
|
||||||
{
|
{
|
||||||
/// <summary>
|
}
|
||||||
/// Name
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("Name")]
|
|
||||||
public JoinDataComplete Name = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Power Off
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("PowerOff")]
|
|
||||||
public JoinDataComplete PowerOff = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Power Off", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Power On
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("PowerOn")]
|
|
||||||
public JoinDataComplete PowerOn = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Power On", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Is Two Way Display
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("IsTwoWayDisplay")]
|
|
||||||
public JoinDataComplete IsTwoWayDisplay = new JoinDataComplete(new JoinData { JoinNumber = 3, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Is Two Way Display", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Volume Up
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("VolumeUp")]
|
|
||||||
public JoinDataComplete VolumeUp = new JoinDataComplete(new JoinData { JoinNumber = 5, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Volume Up", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Volume Level
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("VolumeLevel")]
|
|
||||||
public JoinDataComplete VolumeLevel = new JoinDataComplete(new JoinData { JoinNumber = 5, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Volume Level", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Volume Down
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("VolumeDown")]
|
|
||||||
public JoinDataComplete VolumeDown = new JoinDataComplete(new JoinData { JoinNumber = 6, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Volume Down", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Volume Mute
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("VolumeMute")]
|
|
||||||
public JoinDataComplete VolumeMute = new JoinDataComplete(new JoinData { JoinNumber = 7, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Volume Mute", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Volume Mute On
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("VolumeMuteOn")]
|
|
||||||
public JoinDataComplete VolumeMuteOn = new JoinDataComplete(new JoinData { JoinNumber = 8, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Volume Mute On", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Volume Mute Off
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("VolumeMuteOff")]
|
|
||||||
public JoinDataComplete VolumeMuteOff = new JoinDataComplete(new JoinData { JoinNumber = 9, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Volume Mute Off", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Input Select Offset
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("InputSelectOffset")]
|
|
||||||
public JoinDataComplete InputSelectOffset = new JoinDataComplete(new JoinData { JoinNumber = 11, JoinSpan = 10 },
|
|
||||||
new JoinMetadata { Description = "Input Select", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Input Names Offset
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("InputNamesOffset")]
|
|
||||||
public JoinDataComplete InputNamesOffset = new JoinDataComplete(new JoinData { JoinNumber = 11, JoinSpan = 10 },
|
|
||||||
new JoinMetadata { Description = "Input Names Offset", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Input Select
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("InputSelect")]
|
|
||||||
public JoinDataComplete InputSelect = new JoinDataComplete(new JoinData { JoinNumber = 11, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Input Select", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Button Visibility Offset
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("ButtonVisibilityOffset")]
|
|
||||||
public JoinDataComplete ButtonVisibilityOffset = new JoinDataComplete(new JoinData { JoinNumber = 41, JoinSpan = 10 },
|
|
||||||
new JoinMetadata { Description = "Button Visibility Offset", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.DigitalSerial });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Is Online
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("IsOnline")]
|
|
||||||
public JoinDataComplete IsOnline = new JoinDataComplete(new JoinData { JoinNumber = 50, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Is Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructor to use when instantiating this Join Map without inheriting from it
|
/// Constructor to use when extending this Join map
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="joinStart">Join this join map will start at</param>
|
/// <param name="joinStart">Join this join map will start at</param>
|
||||||
public DisplayControllerJoinMap(uint joinStart)
|
/// <param name="type">Type of the child join map</param>
|
||||||
: this(joinStart, typeof(DisplayControllerJoinMap))
|
protected DisplayControllerJoinMap(uint joinStart, Type type) : base(joinStart, type)
|
||||||
{
|
{
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Constructor to use when extending this Join map
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="joinStart">Join this join map will start at</param>
|
|
||||||
/// <param name="type">Type of the child join map</param>
|
|
||||||
protected DisplayControllerJoinMap(uint joinStart, Type type) : base(joinStart, type)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,113 +1,73 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges {
|
namespace PepperDash.Essentials.Core.Bridges;
|
||||||
|
public class DmBladeChassisControllerJoinMap : JoinMapBaseAdvanced {
|
||||||
|
|
||||||
|
[JoinName("IsOnline")]
|
||||||
|
public JoinDataComplete IsOnline = new JoinDataComplete(new JoinData { JoinNumber = 11, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "DM Blade Chassis Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("VideoSyncStatus")]
|
||||||
|
public JoinDataComplete VideoSyncStatus = new JoinDataComplete(new JoinData { JoinNumber = 101, JoinSpan = 128 },
|
||||||
|
new JoinMetadata { Description = "DM Blade Input Video Sync", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("InputEndpointOnline")]
|
||||||
|
public JoinDataComplete InputEndpointOnline = new JoinDataComplete(new JoinData { JoinNumber = 501, JoinSpan = 128 },
|
||||||
|
new JoinMetadata { Description = "DM Blade Chassis Input Endpoint Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("OutputEndpointOnline")]
|
||||||
|
public JoinDataComplete OutputEndpointOnline = new JoinDataComplete(new JoinData { JoinNumber = 701, JoinSpan = 128 },
|
||||||
|
new JoinMetadata { Description = "DM Blade Chassis Output Endpoint Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("TxAdvancedIsPresent")]
|
||||||
|
public JoinDataComplete TxAdvancedIsPresent = new JoinDataComplete(new JoinData { JoinNumber = 1001, JoinSpan = 128 },
|
||||||
|
new JoinMetadata { Description = "DM Blade Chassis Tx Advanced Is Present", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("OutputVideo")]
|
||||||
|
public JoinDataComplete OutputVideo = new JoinDataComplete(new JoinData { JoinNumber = 101, JoinSpan = 128 },
|
||||||
|
new JoinMetadata { Description = "DM Blade Chassis Output Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("HdcpSupportState")]
|
||||||
|
public JoinDataComplete HdcpSupportState = new JoinDataComplete(new JoinData { JoinNumber = 1001, JoinSpan = 128 },
|
||||||
|
new JoinMetadata { Description = "DM Blade Chassis Input HDCP Support State", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("HdcpSupportCapability")]
|
||||||
|
public JoinDataComplete HdcpSupportCapability = new JoinDataComplete(new JoinData { JoinNumber = 1201, JoinSpan = 128 },
|
||||||
|
new JoinMetadata { Description = "DM Blade Chassis Input HDCP Support Capability", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("InputNames")]
|
||||||
|
public JoinDataComplete InputNames = new JoinDataComplete(new JoinData { JoinNumber = 101, JoinSpan = 128 },
|
||||||
|
new JoinMetadata { Description = "DM Blade Chassis Input Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
||||||
|
|
||||||
|
[JoinName("OutputNames")]
|
||||||
|
public JoinDataComplete OutputNames = new JoinDataComplete(new JoinData { JoinNumber = 301, JoinSpan = 128 },
|
||||||
|
new JoinMetadata { Description = "DM Blade Chassis Output Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
||||||
|
|
||||||
|
[JoinName("OutputCurrentVideoInputNames")]
|
||||||
|
public JoinDataComplete OutputCurrentVideoInputNames = new JoinDataComplete(new JoinData { JoinNumber = 2001, JoinSpan = 128 },
|
||||||
|
new JoinMetadata { Description = "DM Blade Chassis Video Output Currently Routed Video Input Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
||||||
|
|
||||||
|
[JoinName("InputCurrentResolution")]
|
||||||
|
public JoinDataComplete InputCurrentResolution = new JoinDataComplete(new JoinData { JoinNumber = 2401, JoinSpan = 128 },
|
||||||
|
new JoinMetadata { Description = "DM Blade Chassis Input Current Resolution", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a DmBladeChassisControllerJoinMap
|
/// Constructor to use when instantiating this Join Map without inheriting from it
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class DmBladeChassisControllerJoinMap : JoinMapBaseAdvanced {
|
/// <param name="joinStart">Join this join map will start at</param>
|
||||||
|
public DmBladeChassisControllerJoinMap(uint joinStart)
|
||||||
/// <summary>
|
: this(joinStart, typeof(DmBladeChassisControllerJoinMap))
|
||||||
/// DM Blade Chassis Online status
|
{
|
||||||
/// </summary>
|
|
||||||
[JoinName("IsOnline")]
|
|
||||||
public JoinDataComplete IsOnline = new JoinDataComplete(new JoinData { JoinNumber = 11, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "DM Blade Chassis Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM Blade Input Video Sync
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("VideoSyncStatus")]
|
|
||||||
public JoinDataComplete VideoSyncStatus = new JoinDataComplete(new JoinData { JoinNumber = 101, JoinSpan = 128 },
|
|
||||||
new JoinMetadata { Description = "DM Blade Input Video Sync", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM Blade Chassis Input Endpoint Online
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("InputEndpointOnline")]
|
|
||||||
public JoinDataComplete InputEndpointOnline = new JoinDataComplete(new JoinData { JoinNumber = 501, JoinSpan = 128 },
|
|
||||||
new JoinMetadata { Description = "DM Blade Chassis Input Endpoint Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM Blade Chassis Output Endpoint Online
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("OutputEndpointOnline")]
|
|
||||||
public JoinDataComplete OutputEndpointOnline = new JoinDataComplete(new JoinData { JoinNumber = 701, JoinSpan = 128 },
|
|
||||||
new JoinMetadata { Description = "DM Blade Chassis Output Endpoint Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM Blade Chassis Tx Advanced Is Present
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("TxAdvancedIsPresent")]
|
|
||||||
public JoinDataComplete TxAdvancedIsPresent = new JoinDataComplete(new JoinData { JoinNumber = 1001, JoinSpan = 128 },
|
|
||||||
new JoinMetadata { Description = "DM Blade Chassis Tx Advanced Is Present", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM Blade Chassis Rx Advanced Is Present
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("OutputVideo")]
|
|
||||||
public JoinDataComplete OutputVideo = new JoinDataComplete(new JoinData { JoinNumber = 101, JoinSpan = 128 },
|
|
||||||
new JoinMetadata { Description = "DM Blade Chassis Output Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM Blade Chassis Input HDCP Support State
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("HdcpSupportState")]
|
|
||||||
public JoinDataComplete HdcpSupportState = new JoinDataComplete(new JoinData { JoinNumber = 1001, JoinSpan = 128 },
|
|
||||||
new JoinMetadata { Description = "DM Blade Chassis Input HDCP Support State", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM Blade Chassis Input HDCP Support Capability
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("HdcpSupportCapability")]
|
|
||||||
public JoinDataComplete HdcpSupportCapability = new JoinDataComplete(new JoinData { JoinNumber = 1201, JoinSpan = 128 },
|
|
||||||
new JoinMetadata { Description = "DM Blade Chassis Input HDCP Support Capability", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM Blade Chassis Input Names
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("InputNames")]
|
|
||||||
public JoinDataComplete InputNames = new JoinDataComplete(new JoinData { JoinNumber = 101, JoinSpan = 128 },
|
|
||||||
new JoinMetadata { Description = "DM Blade Chassis Input Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM Blade Chassis Output Names
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("OutputNames")]
|
|
||||||
public JoinDataComplete OutputNames = new JoinDataComplete(new JoinData { JoinNumber = 301, JoinSpan = 128 },
|
|
||||||
new JoinMetadata { Description = "DM Blade Chassis Output Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM Blade Chassis Video Output Currently Routed Video Input Name
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("OutputCurrentVideoInputNames")]
|
|
||||||
public JoinDataComplete OutputCurrentVideoInputNames = new JoinDataComplete(new JoinData { JoinNumber = 2001, JoinSpan = 128 },
|
|
||||||
new JoinMetadata { Description = "DM Blade Chassis Video Output Currently Routed Video Input Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM Blade Chassis Input Current Resolution
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("InputCurrentResolution")]
|
|
||||||
public JoinDataComplete InputCurrentResolution = new JoinDataComplete(new JoinData { JoinNumber = 2401, JoinSpan = 128 },
|
|
||||||
new JoinMetadata { Description = "DM Blade Chassis Input Current Resolution", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Constructor to use when instantiating this Join Map without inheriting from it
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="joinStart">Join this join map will start at</param>
|
|
||||||
public DmBladeChassisControllerJoinMap(uint joinStart)
|
|
||||||
: this(joinStart, typeof(DmBladeChassisControllerJoinMap))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Constructor to use when extending this Join map
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="joinStart">Join this join map will start at</param>
|
|
||||||
/// <param name="type">Type of the child join map</param>
|
|
||||||
protected DmBladeChassisControllerJoinMap(uint joinStart, Type type) : base(joinStart, type)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor to use when extending this Join map
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="joinStart">Join this join map will start at</param>
|
||||||
|
/// <param name="type">Type of the child join map</param>
|
||||||
|
protected DmBladeChassisControllerJoinMap(uint joinStart, Type type) : base(joinStart, type)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,259 +1,169 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges;
|
||||||
|
|
||||||
|
public class DmChassisControllerJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
|
[JoinName("EnableAudioBreakaway")]
|
||||||
|
public JoinDataComplete EnableAudioBreakaway = new JoinDataComplete(
|
||||||
|
new JoinData {JoinNumber = 4, JoinSpan = 1},
|
||||||
|
new JoinMetadata
|
||||||
|
{
|
||||||
|
Description = "DM Chassis enable audio breakaway routing",
|
||||||
|
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||||
|
JoinType = eJoinType.Digital
|
||||||
|
});
|
||||||
|
|
||||||
|
[JoinName("EnableUsbBreakaway")]
|
||||||
|
public JoinDataComplete EnableUsbBreakaway = new JoinDataComplete(
|
||||||
|
new JoinData { JoinNumber = 5, JoinSpan = 1 },
|
||||||
|
new JoinMetadata
|
||||||
|
{
|
||||||
|
Description = "DM Chassis enable USB breakaway routing",
|
||||||
|
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||||
|
JoinType = eJoinType.Digital
|
||||||
|
});
|
||||||
|
|
||||||
|
[JoinName("Name")]
|
||||||
|
public JoinDataComplete Name = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "DM Chassis Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
||||||
|
|
||||||
|
[JoinName("SystemId")]
|
||||||
|
public JoinDataComplete SystemId = new JoinDataComplete(new JoinData { JoinNumber = 10, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "DM Chassis SystemId Get/Set/Trigger/", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.DigitalAnalog });
|
||||||
|
|
||||||
|
[JoinName("IsOnline")]
|
||||||
|
public JoinDataComplete IsOnline = new JoinDataComplete(new JoinData { JoinNumber = 11, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "DM Chassis Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("VideoSyncStatus")]
|
||||||
|
public JoinDataComplete VideoSyncStatus = new JoinDataComplete(new JoinData { JoinNumber = 101, JoinSpan = 32 },
|
||||||
|
new JoinMetadata { Description = "DM Input Video Sync", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("InputEndpointOnline")]
|
||||||
|
public JoinDataComplete InputEndpointOnline = new JoinDataComplete(new JoinData { JoinNumber = 501, JoinSpan = 32 },
|
||||||
|
new JoinMetadata { Description = "DM Chassis Input Endpoint Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("OutputEndpointOnline")]
|
||||||
|
public JoinDataComplete OutputEndpointOnline = new JoinDataComplete(new JoinData { JoinNumber = 701, JoinSpan = 32 },
|
||||||
|
new JoinMetadata { Description = "DM Chassis Output Endpoint Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("TxAdvancedIsPresent")]
|
||||||
|
public JoinDataComplete TxAdvancedIsPresent = new JoinDataComplete(new JoinData { JoinNumber = 1001, JoinSpan = 32 },
|
||||||
|
new JoinMetadata { Description = "DM Chassis Tx Advanced Is Present", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("OutputDisabledByHdcp")]
|
||||||
|
public JoinDataComplete OutputDisabledByHdcp = new JoinDataComplete(new JoinData { JoinNumber = 1201, JoinSpan = 32 },
|
||||||
|
new JoinMetadata { Description = "DM Chassis Output Disabled by HDCP", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("OutputVideo")]
|
||||||
|
public JoinDataComplete OutputVideo = new JoinDataComplete(new JoinData { JoinNumber = 101, JoinSpan = 32 },
|
||||||
|
new JoinMetadata { Description = "DM Chassis Output Video Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("OutputAudio")]
|
||||||
|
public JoinDataComplete OutputAudio = new JoinDataComplete(new JoinData { JoinNumber = 301, JoinSpan = 32 },
|
||||||
|
new JoinMetadata { Description = "DM Chassis Output Audio Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("OutputUsb")]
|
||||||
|
public JoinDataComplete OutputUsb = new JoinDataComplete(new JoinData { JoinNumber = 501, JoinSpan = 32 },
|
||||||
|
new JoinMetadata { Description = "DM Chassis Output USB Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("InputUsb")]
|
||||||
|
public JoinDataComplete InputUsb = new JoinDataComplete(new JoinData { JoinNumber = 701, JoinSpan = 32 },
|
||||||
|
new JoinMetadata { Description = "DM Chassis Input Usb Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("HdcpSupportState")]
|
||||||
|
public JoinDataComplete HdcpSupportState = new JoinDataComplete(new JoinData { JoinNumber = 1001, JoinSpan = 32 },
|
||||||
|
new JoinMetadata { Description = "DM Chassis Input HDCP Support State", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("HdcpSupportCapability")]
|
||||||
|
public JoinDataComplete HdcpSupportCapability = new JoinDataComplete(new JoinData { JoinNumber = 1201, JoinSpan = 32 },
|
||||||
|
new JoinMetadata { Description = "DM Chassis Input HDCP Support Capability", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("InputStreamCardState")]
|
||||||
|
public JoinDataComplete InputStreamCardState = new JoinDataComplete(new JoinData { JoinNumber = 1501, JoinSpan = 32 },
|
||||||
|
new JoinMetadata { Description = "DM Chassis Stream Input Start (1), Stop (2), Pause (3) with Feedback", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("OutputStreamCardState")]
|
||||||
|
public JoinDataComplete OutputStreamCardState = new JoinDataComplete(new JoinData { JoinNumber = 1601, JoinSpan = 32 },
|
||||||
|
new JoinMetadata { Description = "DM Chassis Stream Output Start (1), Stop (2), Pause (3) with Feedback", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("NoRouteName")]
|
||||||
|
public JoinDataComplete NoRouteName = new JoinDataComplete(new JoinData { JoinNumber = 100, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "DM Chassis Input Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
||||||
|
|
||||||
|
[JoinName("InputNames")]
|
||||||
|
public JoinDataComplete InputNames = new JoinDataComplete(new JoinData { JoinNumber = 101, JoinSpan = 32 },
|
||||||
|
new JoinMetadata { Description = "DM Chassis Input Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
||||||
|
|
||||||
|
[JoinName("OutputNames")]
|
||||||
|
public JoinDataComplete OutputNames = new JoinDataComplete(new JoinData { JoinNumber = 301, JoinSpan = 32 },
|
||||||
|
new JoinMetadata { Description = "DM Chassis Output Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
||||||
|
|
||||||
|
[JoinName("InputVideoNames")] public JoinDataComplete InputVideoNames =
|
||||||
|
new JoinDataComplete(new JoinData {JoinNumber = 501, JoinSpan = 200},
|
||||||
|
new JoinMetadata
|
||||||
|
{
|
||||||
|
Description = "DM Chassis Video Input Names",
|
||||||
|
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
|
||||||
|
JoinType = eJoinType.Serial
|
||||||
|
});
|
||||||
|
|
||||||
|
[JoinName("InputAudioNames")]
|
||||||
|
public JoinDataComplete InputAudioNames =
|
||||||
|
new JoinDataComplete(new JoinData { JoinNumber = 701, JoinSpan = 200 },
|
||||||
|
new JoinMetadata
|
||||||
|
{
|
||||||
|
Description = "DM Chassis Audio Input Names",
|
||||||
|
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
|
||||||
|
JoinType = eJoinType.Serial
|
||||||
|
});
|
||||||
|
[JoinName("OutputVideoNames")]
|
||||||
|
public JoinDataComplete OutputVideoNames =
|
||||||
|
new JoinDataComplete(new JoinData { JoinNumber = 901, JoinSpan = 200 },
|
||||||
|
new JoinMetadata
|
||||||
|
{
|
||||||
|
Description = "DM Chassis Video Output Names",
|
||||||
|
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
|
||||||
|
JoinType = eJoinType.Serial
|
||||||
|
});
|
||||||
|
[JoinName("OutputAudioNames")]
|
||||||
|
public JoinDataComplete OutputAudioNames =
|
||||||
|
new JoinDataComplete(new JoinData { JoinNumber = 1101, JoinSpan = 200 },
|
||||||
|
new JoinMetadata
|
||||||
|
{
|
||||||
|
Description = "DM Chassis Audio Output Names",
|
||||||
|
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
|
||||||
|
JoinType = eJoinType.Serial
|
||||||
|
});
|
||||||
|
|
||||||
|
[JoinName("OutputCurrentVideoInputNames")]
|
||||||
|
public JoinDataComplete OutputCurrentVideoInputNames = new JoinDataComplete(new JoinData { JoinNumber = 2001, JoinSpan = 32 },
|
||||||
|
new JoinMetadata { Description = "DM Chassis Video Output Currently Routed Video Input Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
||||||
|
|
||||||
|
[JoinName("OutputCurrentAudioInputNames")]
|
||||||
|
public JoinDataComplete OutputCurrentAudioInputNames = new JoinDataComplete(new JoinData { JoinNumber = 2201, JoinSpan = 32 },
|
||||||
|
new JoinMetadata { Description = "DM Chassis Audio Output Currently Routed Video Input Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
||||||
|
|
||||||
|
[JoinName("InputCurrentResolution")]
|
||||||
|
public JoinDataComplete InputCurrentResolution = new JoinDataComplete(new JoinData { JoinNumber = 2401, JoinSpan = 32 },
|
||||||
|
new JoinMetadata { Description = "DM Chassis Input Current Resolution", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a DmChassisControllerJoinMap
|
/// Constructor to use when instantiating this Join Map without inheriting from it
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class DmChassisControllerJoinMap : JoinMapBaseAdvanced
|
/// <param name="joinStart">Join this join map will start at</param>
|
||||||
|
public DmChassisControllerJoinMap(uint joinStart)
|
||||||
|
: this(joinStart, typeof(DmChassisControllerJoinMap))
|
||||||
{
|
{
|
||||||
/// <summary>
|
}
|
||||||
/// DM Chassis enable audio breakaway routing
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("EnableAudioBreakaway")]
|
|
||||||
public JoinDataComplete EnableAudioBreakaway = new JoinDataComplete(
|
|
||||||
new JoinData {JoinNumber = 4, JoinSpan = 1},
|
|
||||||
new JoinMetadata
|
|
||||||
{
|
|
||||||
Description = "DM Chassis enable audio breakaway routing",
|
|
||||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
|
||||||
JoinType = eJoinType.Digital
|
|
||||||
});
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM Chassis enable USB breakaway routing
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("EnableUsbBreakaway")]
|
|
||||||
public JoinDataComplete EnableUsbBreakaway = new JoinDataComplete(
|
|
||||||
new JoinData { JoinNumber = 5, JoinSpan = 1 },
|
|
||||||
new JoinMetadata
|
|
||||||
{
|
|
||||||
Description = "DM Chassis enable USB breakaway routing",
|
|
||||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
|
||||||
JoinType = eJoinType.Digital
|
|
||||||
});
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM Chassis Name
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("Name")]
|
|
||||||
public JoinDataComplete Name = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "DM Chassis Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM Chassis SystemId Get/Set/Trigger
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("SystemId")]
|
|
||||||
public JoinDataComplete SystemId = new JoinDataComplete(new JoinData { JoinNumber = 10, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "DM Chassis SystemId Get/Set/Trigger/", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.DigitalAnalog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM Chassis Online status
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("IsOnline")]
|
|
||||||
public JoinDataComplete IsOnline = new JoinDataComplete(new JoinData { JoinNumber = 11, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "DM Chassis Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM Input Video Sync
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("VideoSyncStatus")]
|
|
||||||
public JoinDataComplete VideoSyncStatus = new JoinDataComplete(new JoinData { JoinNumber = 101, JoinSpan = 32 },
|
|
||||||
new JoinMetadata { Description = "DM Input Video Sync", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM Chassis Input Endpoint Online
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("InputEndpointOnline")]
|
|
||||||
public JoinDataComplete InputEndpointOnline = new JoinDataComplete(new JoinData { JoinNumber = 501, JoinSpan = 32 },
|
|
||||||
new JoinMetadata { Description = "DM Chassis Input Endpoint Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM Chassis Output Endpoint Online
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("OutputEndpointOnline")]
|
|
||||||
public JoinDataComplete OutputEndpointOnline = new JoinDataComplete(new JoinData { JoinNumber = 701, JoinSpan = 32 },
|
|
||||||
new JoinMetadata { Description = "DM Chassis Output Endpoint Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM Chassis Tx Advanced Is Present
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("TxAdvancedIsPresent")]
|
|
||||||
public JoinDataComplete TxAdvancedIsPresent = new JoinDataComplete(new JoinData { JoinNumber = 1001, JoinSpan = 32 },
|
|
||||||
new JoinMetadata { Description = "DM Chassis Tx Advanced Is Present", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM Chassis Rx Advanced Is Present
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("OutputDisabledByHdcp")]
|
|
||||||
public JoinDataComplete OutputDisabledByHdcp = new JoinDataComplete(new JoinData { JoinNumber = 1201, JoinSpan = 32 },
|
|
||||||
new JoinMetadata { Description = "DM Chassis Output Disabled by HDCP", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM Chassis Output Set / Get
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("OutputVideo")]
|
|
||||||
public JoinDataComplete OutputVideo = new JoinDataComplete(new JoinData { JoinNumber = 101, JoinSpan = 32 },
|
|
||||||
new JoinMetadata { Description = "DM Chassis Output Video Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM Chassis Output Audio Set / Get
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("OutputAudio")]
|
|
||||||
public JoinDataComplete OutputAudio = new JoinDataComplete(new JoinData { JoinNumber = 301, JoinSpan = 32 },
|
|
||||||
new JoinMetadata { Description = "DM Chassis Output Audio Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM Chassis Input Set / Get
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("OutputUsb")]
|
|
||||||
public JoinDataComplete OutputUsb = new JoinDataComplete(new JoinData { JoinNumber = 501, JoinSpan = 32 },
|
|
||||||
new JoinMetadata { Description = "DM Chassis Output USB Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM Chassis Input Set / Get
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("InputUsb")]
|
|
||||||
public JoinDataComplete InputUsb = new JoinDataComplete(new JoinData { JoinNumber = 701, JoinSpan = 32 },
|
|
||||||
new JoinMetadata { Description = "DM Chassis Input Usb Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM Chassis Input HDCP Support State
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("HdcpSupportState")]
|
|
||||||
public JoinDataComplete HdcpSupportState = new JoinDataComplete(new JoinData { JoinNumber = 1001, JoinSpan = 32 },
|
|
||||||
new JoinMetadata { Description = "DM Chassis Input HDCP Support State", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM Chassis Input HDCP Support Capability
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("HdcpSupportCapability")]
|
|
||||||
public JoinDataComplete HdcpSupportCapability = new JoinDataComplete(new JoinData { JoinNumber = 1201, JoinSpan = 32 },
|
|
||||||
new JoinMetadata { Description = "DM Chassis Input HDCP Support Capability", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM Chassis Stream Input Start (1), Stop (2), Pause (3) with Feedback
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("InputStreamCardState")]
|
|
||||||
public JoinDataComplete InputStreamCardState = new JoinDataComplete(new JoinData { JoinNumber = 1501, JoinSpan = 32 },
|
|
||||||
new JoinMetadata { Description = "DM Chassis Stream Input Start (1), Stop (2), Pause (3) with Feedback", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM Chassis Stream Output Start (1), Stop (2), Pause (3) with Feedback
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("OutputStreamCardState")]
|
|
||||||
public JoinDataComplete OutputStreamCardState = new JoinDataComplete(new JoinData { JoinNumber = 1601, JoinSpan = 32 },
|
|
||||||
new JoinMetadata { Description = "DM Chassis Stream Output Start (1), Stop (2), Pause (3) with Feedback", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM Chassis No Route Name
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("NoRouteName")]
|
|
||||||
public JoinDataComplete NoRouteName = new JoinDataComplete(new JoinData { JoinNumber = 100, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "DM Chassis Input Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM Chassis Input Names
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("InputNames")]
|
|
||||||
public JoinDataComplete InputNames = new JoinDataComplete(new JoinData { JoinNumber = 101, JoinSpan = 32 },
|
|
||||||
new JoinMetadata { Description = "DM Chassis Input Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM Chassis Output Names
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("OutputNames")]
|
|
||||||
public JoinDataComplete OutputNames = new JoinDataComplete(new JoinData { JoinNumber = 301, JoinSpan = 32 },
|
|
||||||
new JoinMetadata { Description = "DM Chassis Output Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM Chassis Video Input Names
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("InputVideoNames")] public JoinDataComplete InputVideoNames =
|
|
||||||
new JoinDataComplete(new JoinData {JoinNumber = 501, JoinSpan = 200},
|
|
||||||
new JoinMetadata
|
|
||||||
{
|
|
||||||
Description = "DM Chassis Video Input Names",
|
|
||||||
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
|
|
||||||
JoinType = eJoinType.Serial
|
|
||||||
});
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM Chassis Audio Input Names
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("InputAudioNames")]
|
|
||||||
public JoinDataComplete InputAudioNames =
|
|
||||||
new JoinDataComplete(new JoinData { JoinNumber = 701, JoinSpan = 200 },
|
|
||||||
new JoinMetadata
|
|
||||||
{
|
|
||||||
Description = "DM Chassis Audio Input Names",
|
|
||||||
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
|
|
||||||
JoinType = eJoinType.Serial
|
|
||||||
});
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM Chassis Video Output Names
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("OutputVideoNames")]
|
|
||||||
public JoinDataComplete OutputVideoNames =
|
|
||||||
new JoinDataComplete(new JoinData { JoinNumber = 901, JoinSpan = 200 },
|
|
||||||
new JoinMetadata
|
|
||||||
{
|
|
||||||
Description = "DM Chassis Video Output Names",
|
|
||||||
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
|
|
||||||
JoinType = eJoinType.Serial
|
|
||||||
});
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM Chassis Audio Output Names
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("OutputAudioNames")]
|
|
||||||
public JoinDataComplete OutputAudioNames =
|
|
||||||
new JoinDataComplete(new JoinData { JoinNumber = 1101, JoinSpan = 200 },
|
|
||||||
new JoinMetadata
|
|
||||||
{
|
|
||||||
Description = "DM Chassis Audio Output Names",
|
|
||||||
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
|
|
||||||
JoinType = eJoinType.Serial
|
|
||||||
});
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM Chassis Video Output Currently Routed Video Input Name
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("OutputCurrentVideoInputNames")]
|
|
||||||
public JoinDataComplete OutputCurrentVideoInputNames = new JoinDataComplete(new JoinData { JoinNumber = 2001, JoinSpan = 32 },
|
|
||||||
new JoinMetadata { Description = "DM Chassis Video Output Currently Routed Video Input Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM Chassis Audio Output Currently Routed Audio Input Name
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("OutputCurrentAudioInputNames")]
|
|
||||||
public JoinDataComplete OutputCurrentAudioInputNames = new JoinDataComplete(new JoinData { JoinNumber = 2201, JoinSpan = 32 },
|
|
||||||
new JoinMetadata { Description = "DM Chassis Audio Output Currently Routed Video Input Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM Chassis Input Current Resolution
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("InputCurrentResolution")]
|
|
||||||
public JoinDataComplete InputCurrentResolution = new JoinDataComplete(new JoinData { JoinNumber = 2401, JoinSpan = 32 },
|
|
||||||
new JoinMetadata { Description = "DM Chassis Input Current Resolution", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructor to use when instantiating this Join Map without inheriting from it
|
/// Constructor to use when extending this Join map
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="joinStart">Join this join map will start at</param>
|
/// <param name="joinStart">Join this join map will start at</param>
|
||||||
public DmChassisControllerJoinMap(uint joinStart)
|
/// <param name="type">Type of the child join map</param>
|
||||||
: this(joinStart, typeof(DmChassisControllerJoinMap))
|
protected DmChassisControllerJoinMap(uint joinStart, Type type) : base(joinStart, type)
|
||||||
{
|
{
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Constructor to use when extending this Join map
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="joinStart">Join this join map will start at</param>
|
|
||||||
/// <param name="type">Type of the child join map</param>
|
|
||||||
protected DmChassisControllerJoinMap(uint joinStart, Type type) : base(joinStart, type)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,143 +1,91 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges;
|
||||||
|
|
||||||
|
public class DmRmcControllerJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
|
[JoinName("IsOnline")]
|
||||||
|
public JoinDataComplete IsOnline = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "DM RMC Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("VideoMuteOn")]
|
||||||
|
public JoinDataComplete VideoMuteOn = new JoinDataComplete(new JoinData { JoinNumber = 3, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "DM RMC Mute Video", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("VideoMuteOff")]
|
||||||
|
public JoinDataComplete VideoMuteOff = new JoinDataComplete(new JoinData { JoinNumber = 4, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "DM RMC UnMute Video", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("VideoMuteToggle")]
|
||||||
|
public JoinDataComplete VideoMuteToggle = new JoinDataComplete(new JoinData { JoinNumber = 5, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "DM RMC Mute Video Toggle", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("CurrentOutputResolution")]
|
||||||
|
public JoinDataComplete CurrentOutputResolution = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "DM RMC Current Output Resolution", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
||||||
|
|
||||||
|
[JoinName("EdidManufacturer")]
|
||||||
|
public JoinDataComplete EdidManufacturer = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "DM RMC EDID Manufacturer", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
||||||
|
|
||||||
|
[JoinName("EdidName")]
|
||||||
|
public JoinDataComplete EdidName = new JoinDataComplete(new JoinData { JoinNumber = 3, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "DM RMC EDID Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
||||||
|
|
||||||
|
[JoinName("EdidPrefferedTiming")]
|
||||||
|
public JoinDataComplete EdidPrefferedTiming = new JoinDataComplete(new JoinData { JoinNumber = 4, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "DM RMC EDID Preferred Timing", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
||||||
|
|
||||||
|
[JoinName("EdidSerialNumber")]
|
||||||
|
public JoinDataComplete EdidSerialNumber = new JoinDataComplete(new JoinData { JoinNumber = 5, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "DM RMC EDID Serial Number", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
||||||
|
|
||||||
|
[JoinName("Name")]
|
||||||
|
public JoinDataComplete Name = new JoinDataComplete(new JoinData { JoinNumber = 6, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "DM RMC Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
||||||
|
|
||||||
|
[JoinName("AudioVideoSource")]
|
||||||
|
public JoinDataComplete AudioVideoSource = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "DM RMC Audio Video Source Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("HdcpSupportCapability")]
|
||||||
|
public JoinDataComplete HdcpSupportCapability = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "DM RMC HDCP Support Capability", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("Port1HdcpState")]
|
||||||
|
public JoinDataComplete Port1HdcpState = new JoinDataComplete(new JoinData { JoinNumber = 3, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "DM RMC Port 1 (DM) HDCP State Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("Port2HdcpState")]
|
||||||
|
public JoinDataComplete Port2HdcpState = new JoinDataComplete(new JoinData { JoinNumber = 4, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "DM TX Port 2 (HDMI) HDCP State Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("HdmiInputSync")]
|
||||||
|
public JoinDataComplete HdmiInputSync = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "DM RMC HDMI Input Sync", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("HdcpInputPortCount")]
|
||||||
|
public JoinDataComplete HdcpInputPortCount = new JoinDataComplete(new JoinData { JoinNumber = 5, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Number of Input Ports that support HDCP", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a DmRmcControllerJoinMap
|
/// Constructor to use when instantiating this Join Map without inheriting from it
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class DmRmcControllerJoinMap : JoinMapBaseAdvanced
|
/// <param name="joinStart">Join this join map will start at</param>
|
||||||
|
public DmRmcControllerJoinMap(uint joinStart)
|
||||||
|
: this(joinStart, typeof(DmRmcControllerJoinMap))
|
||||||
{
|
{
|
||||||
/// <summary>
|
}
|
||||||
/// DM RMC Online
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("IsOnline")]
|
|
||||||
public JoinDataComplete IsOnline = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "DM RMC Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM RMC Mute Video
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("VideoMuteOn")]
|
|
||||||
public JoinDataComplete VideoMuteOn = new JoinDataComplete(new JoinData { JoinNumber = 3, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "DM RMC Mute Video", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM RMC UnMute Video
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("VideoMuteOff")]
|
|
||||||
public JoinDataComplete VideoMuteOff = new JoinDataComplete(new JoinData { JoinNumber = 4, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "DM RMC UnMute Video", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM RMC Mute Video Toggle
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("VideoMuteToggle")]
|
|
||||||
public JoinDataComplete VideoMuteToggle = new JoinDataComplete(new JoinData { JoinNumber = 5, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "DM RMC Mute Video Toggle", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM RMC Current Output Resolution
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("CurrentOutputResolution")]
|
|
||||||
public JoinDataComplete CurrentOutputResolution = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "DM RMC Current Output Resolution", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM RMC EDID Manufacturer
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("EdidManufacturer")]
|
|
||||||
public JoinDataComplete EdidManufacturer = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "DM RMC EDID Manufacturer", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM RMC EDID Name
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("EdidName")]
|
|
||||||
public JoinDataComplete EdidName = new JoinDataComplete(new JoinData { JoinNumber = 3, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "DM RMC EDID Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM RMC EDID Preferred Timing
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("EdidPrefferedTiming")]
|
|
||||||
public JoinDataComplete EdidPrefferedTiming = new JoinDataComplete(new JoinData { JoinNumber = 4, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "DM RMC EDID Preferred Timing", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM RMC EDID Serial Number
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("EdidSerialNumber")]
|
|
||||||
public JoinDataComplete EdidSerialNumber = new JoinDataComplete(new JoinData { JoinNumber = 5, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "DM RMC EDID Serial Number", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM RMC Name
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("Name")]
|
|
||||||
public JoinDataComplete Name = new JoinDataComplete(new JoinData { JoinNumber = 6, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "DM RMC Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM RMC Audio Video Source Set / Get
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("AudioVideoSource")]
|
|
||||||
public JoinDataComplete AudioVideoSource = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "DM RMC Audio Video Source Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM RMC HDCP Support Capability
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("HdcpSupportCapability")]
|
|
||||||
public JoinDataComplete HdcpSupportCapability = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "DM RMC HDCP Support Capability", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM RMC Port 1 (DM) HDCP State Set / Get
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("Port1HdcpState")]
|
|
||||||
public JoinDataComplete Port1HdcpState = new JoinDataComplete(new JoinData { JoinNumber = 3, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "DM RMC Port 1 (DM) HDCP State Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM RMC Port 2 (HDMI) HDCP State Set / Get
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("Port2HdcpState")]
|
|
||||||
public JoinDataComplete Port2HdcpState = new JoinDataComplete(new JoinData { JoinNumber = 4, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "DM RMC Port 2 (HDMI) HDCP State Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM RMC HDMI Input Sync
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("HdmiInputSync")]
|
|
||||||
public JoinDataComplete HdmiInputSync = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "DM RMC HDMI Input Sync", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM RMC Number of Input Ports that support HDCP
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("HdcpInputPortCount")]
|
|
||||||
public JoinDataComplete HdcpInputPortCount = new JoinDataComplete(new JoinData { JoinNumber = 5, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Number of Input Ports that support HDCP", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor to use when extending this Join map
|
||||||
/// <summary>
|
/// </summary>
|
||||||
/// Constructor to use when instantiating this Join Map without inheriting from it
|
/// <param name="joinStart">Join this join map will start at</param>
|
||||||
/// </summary>
|
/// <param name="type">Type of the child join map</param>
|
||||||
/// <param name="joinStart">Join this join map will start at</param>
|
protected DmRmcControllerJoinMap(uint joinStart, Type type)
|
||||||
public DmRmcControllerJoinMap(uint joinStart)
|
: base(joinStart, type)
|
||||||
: this(joinStart, typeof(DmRmcControllerJoinMap))
|
{
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Constructor to use when extending this Join map
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="joinStart">Join this join map will start at</param>
|
|
||||||
/// <param name="type">Type of the child join map</param>
|
|
||||||
protected DmRmcControllerJoinMap(uint joinStart, Type type)
|
|
||||||
: base(joinStart, type)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,150 +1,95 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges;
|
||||||
|
|
||||||
|
public class DmTxControllerJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
|
[JoinName("IsOnline")]
|
||||||
|
public JoinDataComplete IsOnline = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "DM TX Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("VideoSyncStatus")]
|
||||||
|
public JoinDataComplete VideoSyncStatus = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "DM TX Video Sync", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("FreeRunEnabled")]
|
||||||
|
public JoinDataComplete FreeRunEnabled = new JoinDataComplete(new JoinData { JoinNumber = 3, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "DM TX Enable Free Run Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("Input1VideoSyncStatus")]
|
||||||
|
public JoinDataComplete Input1VideoSyncStatus = new JoinDataComplete(new JoinData { JoinNumber = 4, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Input 1 Video Sync Status", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("Input2VideoSyncStatus")]
|
||||||
|
public JoinDataComplete Input2VideoSyncStatus = new JoinDataComplete(new JoinData { JoinNumber = 5, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Input 2 Video Sync Status", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("Input3VideoSyncStatus")]
|
||||||
|
public JoinDataComplete Input3VideoSyncStatus = new JoinDataComplete(new JoinData { JoinNumber = 6, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Input 3 Video Sync Status", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("CurrentInputResolution")]
|
||||||
|
public JoinDataComplete CurrentInputResolution = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "DM TX Current Input Resolution", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
||||||
|
|
||||||
|
[JoinName("Name")]
|
||||||
|
public JoinDataComplete Name = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "DM TX Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
||||||
|
|
||||||
|
[JoinName("VideoInput")]
|
||||||
|
public JoinDataComplete VideoInput = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "DM TX Video Input Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("AudioInput")]
|
||||||
|
public JoinDataComplete AudioInput = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "DM TX Audio Input Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("HdcpSupportCapability")]
|
||||||
|
public JoinDataComplete HdcpSupportCapability = new JoinDataComplete(new JoinData { JoinNumber = 3, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "DM TX HDCP Support Capability", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("Port1HdcpState")]
|
||||||
|
public JoinDataComplete Port1HdcpState = new JoinDataComplete(new JoinData { JoinNumber = 4, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "DM TX Port 1 HDCP State Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("Port2HdcpState")]
|
||||||
|
public JoinDataComplete Port2HdcpState = new JoinDataComplete(new JoinData { JoinNumber = 5, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "DM TX Port 2 HDCP State Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("VgaBrightness")]
|
||||||
|
public JoinDataComplete VgaBrightness = new JoinDataComplete(new JoinData { JoinNumber = 6, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "DM TX VGA Brightness", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("VgaContrast")]
|
||||||
|
public JoinDataComplete VgaContrast = new JoinDataComplete(new JoinData { JoinNumber = 7, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "DM TX Online", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("Port3HdcpState")]
|
||||||
|
public JoinDataComplete Port3HdcpState = new JoinDataComplete(new JoinData { JoinNumber = 8, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "DM TX Port 3 HDCP State Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("HdcpInputPortCount")]
|
||||||
|
public JoinDataComplete HdcpInputPortCount = new JoinDataComplete(new JoinData { JoinNumber = 9, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Number of Input Ports that support HDCP", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a DmTxControllerJoinMap
|
/// Constructor to use when instantiating this Join Map without inheriting from it
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class DmTxControllerJoinMap : JoinMapBaseAdvanced
|
/// <param name="joinStart">Join this join map will start at</param>
|
||||||
|
public DmTxControllerJoinMap(uint joinStart)
|
||||||
|
: this(joinStart, typeof(DmTxControllerJoinMap))
|
||||||
{
|
{
|
||||||
/// <summary>
|
}
|
||||||
/// DM TX Online
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("IsOnline")]
|
|
||||||
public JoinDataComplete IsOnline = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "DM TX Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM TX Video Sync
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("VideoSyncStatus")]
|
|
||||||
public JoinDataComplete VideoSyncStatus = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "DM TX Video Sync", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM TX Enable Free Run Set / Get
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("FreeRunEnabled")]
|
|
||||||
public JoinDataComplete FreeRunEnabled = new JoinDataComplete(new JoinData { JoinNumber = 3, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "DM TX Enable Free Run Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Input 1 Video Sync Status
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("Input1VideoSyncStatus")]
|
|
||||||
public JoinDataComplete Input1VideoSyncStatus = new JoinDataComplete(new JoinData { JoinNumber = 4, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Input 1 Video Sync Status", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Input 2 Video Sync Status
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("Input2VideoSyncStatus")]
|
|
||||||
public JoinDataComplete Input2VideoSyncStatus = new JoinDataComplete(new JoinData { JoinNumber = 5, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Input 2 Video Sync Status", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Input 3 Video Sync Status
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("Input3VideoSyncStatus")]
|
|
||||||
public JoinDataComplete Input3VideoSyncStatus = new JoinDataComplete(new JoinData { JoinNumber = 6, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Input 3 Video Sync Status", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM TX Current Input Resolution
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("CurrentInputResolution")]
|
|
||||||
public JoinDataComplete CurrentInputResolution = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "DM TX Current Input Resolution", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM TX Name
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("Name")]
|
|
||||||
public JoinDataComplete Name = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "DM TX Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM TX Video Input Set / Get
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("VideoInput")]
|
|
||||||
public JoinDataComplete VideoInput = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "DM TX Video Input Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM TX Audio Input Set / Get
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("AudioInput")]
|
|
||||||
public JoinDataComplete AudioInput = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "DM TX Audio Input Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM TX HDCP Support Capability
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("HdcpSupportCapability")]
|
|
||||||
public JoinDataComplete HdcpSupportCapability = new JoinDataComplete(new JoinData { JoinNumber = 3, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "DM TX HDCP Support Capability", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM TX Port 1 HDCP State Set / Get
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("Port1HdcpState")]
|
|
||||||
public JoinDataComplete Port1HdcpState = new JoinDataComplete(new JoinData { JoinNumber = 4, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "DM TX Port 1 HDCP State Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM TX Port 2 HDCP State Set / Get
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("Port2HdcpState")]
|
|
||||||
public JoinDataComplete Port2HdcpState = new JoinDataComplete(new JoinData { JoinNumber = 5, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "DM TX Port 2 HDCP State Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM TX VGA Brightness
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("VgaBrightness")]
|
|
||||||
public JoinDataComplete VgaBrightness = new JoinDataComplete(new JoinData { JoinNumber = 6, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "DM TX VGA Brightness", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM TX VGA Contrast
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("VgaContrast")]
|
|
||||||
public JoinDataComplete VgaContrast = new JoinDataComplete(new JoinData { JoinNumber = 7, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "DM TX Online", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM TX Port 3 HDCP State Set / Get
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("Port3HdcpState")]
|
|
||||||
public JoinDataComplete Port3HdcpState = new JoinDataComplete(new JoinData { JoinNumber = 8, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "DM TX Port 3 HDCP State Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM TX Number of Input Ports that support HDCP
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("HdcpInputPortCount")]
|
|
||||||
public JoinDataComplete HdcpInputPortCount = new JoinDataComplete(new JoinData { JoinNumber = 9, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Number of Input Ports that support HDCP", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor to use when extending this Join map
|
||||||
/// <summary>
|
/// </summary>
|
||||||
/// Constructor to use when instantiating this Join Map without inheriting from it
|
/// <param name="joinStart">Join this join map will start at</param>
|
||||||
/// </summary>
|
/// <param name="type">Type of the child join map</param>
|
||||||
/// <param name="joinStart">Join this join map will start at</param>
|
protected DmTxControllerJoinMap(uint joinStart, Type type)
|
||||||
public DmTxControllerJoinMap(uint joinStart)
|
: base(joinStart, type)
|
||||||
: this(joinStart, typeof(DmTxControllerJoinMap))
|
{
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Constructor to use when extending this Join map
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="joinStart">Join this join map will start at</param>
|
|
||||||
/// <param name="type">Type of the child join map</param>
|
|
||||||
protected DmTxControllerJoinMap(uint joinStart, Type type)
|
|
||||||
: base(joinStart, type)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,288 +1,173 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges;
|
||||||
|
|
||||||
|
public class DmpsAudioOutputControllerJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
|
|
||||||
|
[JoinName("MasterVolumeLevel")]
|
||||||
|
public JoinDataComplete MasterVolumeLevel = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Master Volume Signed dB Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("MasterVolumeLevelScaled")]
|
||||||
|
public JoinDataComplete MasterVolumeLevelScaled = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Master Volume 16bit Scaled Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("MixerPresetRecall")]
|
||||||
|
public JoinDataComplete MixerPresetRecall = new JoinDataComplete(new JoinData { JoinNumber = 3, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Mixer Preset Recall Set", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("MixerEqPresetRecall")]
|
||||||
|
public JoinDataComplete MixerEqPresetRecall = new JoinDataComplete(new JoinData { JoinNumber = 4, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Mixer Eq Preset Recall Set", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("MasterVolumeMuteOn")]
|
||||||
|
public JoinDataComplete MasterVolumeMuteOn = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Master Volume Mute On Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("MasterVolumeMuteOff")]
|
||||||
|
public JoinDataComplete MasterVolumeMuteOff = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Master Volume Mute Off Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("MasterVolumeUp")]
|
||||||
|
public JoinDataComplete MasterVolumeUp = new JoinDataComplete(new JoinData { JoinNumber = 3, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Master Volume Level Up", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("MasterVolumeDown")]
|
||||||
|
public JoinDataComplete MasterVolumeDown = new JoinDataComplete(new JoinData { JoinNumber = 4, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Master Volume Level Down", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("MasterVolumeLevelScaledSend")]
|
||||||
|
public JoinDataComplete MasterVolumeLevelScaledSend = new JoinDataComplete(new JoinData { JoinNumber = 5, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Master Volume Scaled Send Enable/Disable", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("SourceVolumeLevel")]
|
||||||
|
public JoinDataComplete SourceVolumeLevel = new JoinDataComplete(new JoinData { JoinNumber = 11, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Source Volume Signed dB Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("SourceVolumeLevelScaled")]
|
||||||
|
public JoinDataComplete SourceVolumeLevelScaled = new JoinDataComplete(new JoinData { JoinNumber = 12, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Source Volume 16bit Scaled Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("SourceVolumeMuteOn")]
|
||||||
|
public JoinDataComplete SourceVolumeMuteOn = new JoinDataComplete(new JoinData { JoinNumber = 11, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Source Volume Mute On Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("SourceVolumeMuteOff")]
|
||||||
|
public JoinDataComplete SourceVolumeMuteOff = new JoinDataComplete(new JoinData { JoinNumber = 12, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Source Volume Mute Off Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("SourceVolumeUp")]
|
||||||
|
public JoinDataComplete SourceVolumeUp = new JoinDataComplete(new JoinData { JoinNumber = 13, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Source Volume Level Up", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("SourceVolumeDown")]
|
||||||
|
public JoinDataComplete SourceVolumeDown = new JoinDataComplete(new JoinData { JoinNumber = 14, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Source Volume Level Down", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("SourceVolumeLevelScaledSend")]
|
||||||
|
public JoinDataComplete SourceVolumeLevelScaledSend = new JoinDataComplete(new JoinData { JoinNumber = 15, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Source Volume Scaled Send Enable/Disable", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("Codec1VolumeLevel")]
|
||||||
|
public JoinDataComplete Codec1VolumeLevel = new JoinDataComplete(new JoinData { JoinNumber = 21, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Codec1 Volume Signed dB Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("Codec1VolumeLevelScaled")]
|
||||||
|
public JoinDataComplete Codec1VolumeLevelScaled = new JoinDataComplete(new JoinData { JoinNumber = 22, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Codec1 Volume 16bit Scaled Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("Codec1VolumeMuteOn")]
|
||||||
|
public JoinDataComplete Codec1VolumeMuteOn = new JoinDataComplete(new JoinData { JoinNumber = 21, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Codec1 Volume Mute On Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("Codec1VolumeMuteOff")]
|
||||||
|
public JoinDataComplete Codec1VolumeMuteOff = new JoinDataComplete(new JoinData { JoinNumber = 22, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Codec1 Volume Mute Off Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("Codec1VolumeUp")]
|
||||||
|
public JoinDataComplete Codec1VolumeUp = new JoinDataComplete(new JoinData { JoinNumber = 23, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Codec1 Volume Level Up", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("Codec1VolumeDown")]
|
||||||
|
public JoinDataComplete Codec1VolumeDown = new JoinDataComplete(new JoinData { JoinNumber = 24, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Codec1 Volume Level Down", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("Codec1VolumeLevelScaledSend")]
|
||||||
|
public JoinDataComplete Codec1VolumeLevelScaledSend = new JoinDataComplete(new JoinData { JoinNumber = 25, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Codec1 Volume Scaled Send Enable/Disable", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("Codec2VolumeLevel")]
|
||||||
|
public JoinDataComplete Codec2VolumeLevel = new JoinDataComplete(new JoinData { JoinNumber = 31, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Codec2 Volume Signed dB Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("Codec2VolumeLevelScaled")]
|
||||||
|
public JoinDataComplete Codec2VolumeLevelScaled = new JoinDataComplete(new JoinData { JoinNumber = 32, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Codec2 Volume 16bit Scaled Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("Codec2VolumeMuteOn")]
|
||||||
|
public JoinDataComplete Codec2VolumeMuteOn = new JoinDataComplete(new JoinData { JoinNumber = 31, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Codec2 Volume Mute On Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("Codec2VolumeMuteOff")]
|
||||||
|
public JoinDataComplete Codec2VolumeMuteOff = new JoinDataComplete(new JoinData { JoinNumber = 32, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Codec2 Volume Mute Off Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("Codec2VolumeUp")]
|
||||||
|
public JoinDataComplete Codec2VolumeUp = new JoinDataComplete(new JoinData { JoinNumber = 33, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Codec2 Volume Level Up", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("Codec2VolumeDown")]
|
||||||
|
public JoinDataComplete Codec2VolumeDown = new JoinDataComplete(new JoinData { JoinNumber = 34, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Codec2 Volume Level Down", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("Codec2VolumeLevelScaledSend")]
|
||||||
|
public JoinDataComplete Codec2VolumeLevelScaledSend = new JoinDataComplete(new JoinData { JoinNumber = 35, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Codec2 Volume Scaled Send Enable/Disable", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("MicsMasterVolumeLevel")]
|
||||||
|
public JoinDataComplete MicsMasterVolumeLevel = new JoinDataComplete(new JoinData { JoinNumber = 41, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "MicsMaster Volume Signed dB Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("MicsMasterVolumeLevelScaled")]
|
||||||
|
public JoinDataComplete MicsMasterVolumeLevelScaled = new JoinDataComplete(new JoinData { JoinNumber = 42, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "MicsMaster Volume 16bit Scaled Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("MicsMasterVolumeMuteOn")]
|
||||||
|
public JoinDataComplete MicsMasterVolumeMuteOn = new JoinDataComplete(new JoinData { JoinNumber = 41, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "MicsMaster Volume Mute On Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("MicsMasterVolumeMuteOff")]
|
||||||
|
public JoinDataComplete MicsMasterVolumeMuteOff = new JoinDataComplete(new JoinData { JoinNumber = 42, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "MicsMaster Volume Mute Off Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("MicsMasterVolumeUp")]
|
||||||
|
public JoinDataComplete MicsMasterVolumeUp = new JoinDataComplete(new JoinData { JoinNumber = 43, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "MicsMaster Volume Level Up", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("MicsMasterVolumeDown")]
|
||||||
|
public JoinDataComplete MicsMasterVolumeDown = new JoinDataComplete(new JoinData { JoinNumber = 44, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "MicsMaster Volume Level Down", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("MicsMasterVolumeLevelScaledSend")]
|
||||||
|
public JoinDataComplete MicsMasterVolumeLevelScaledSend = new JoinDataComplete(new JoinData { JoinNumber = 45, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Mics Master Volume Scaled Send Enable/Disable", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a DmpsAudioOutputControllerJoinMap
|
/// Constructor to use when instantiating this Join Map without inheriting from it
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class DmpsAudioOutputControllerJoinMap : JoinMapBaseAdvanced
|
/// <param name="joinStart">Join this join map will start at</param>
|
||||||
|
public DmpsAudioOutputControllerJoinMap(uint joinStart)
|
||||||
|
: this(joinStart, typeof(DmpsAudioOutputControllerJoinMap))
|
||||||
{
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Master Volume Level Signed dB Set / Get
|
/// Constructor to use when extending this Join map
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JoinName("MasterVolumeLevel")]
|
/// <param name="joinStart">Join this join map will start at</param>
|
||||||
public JoinDataComplete MasterVolumeLevel = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
/// <param name="type">Type of the child join map</param>
|
||||||
new JoinMetadata { Description = "Master Volume Signed dB Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
protected DmpsAudioOutputControllerJoinMap(uint joinStart, Type type) : base(joinStart, type)
|
||||||
|
{
|
||||||
/// <summary>
|
|
||||||
/// Master Volume 16bit Scaled Set / Get
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("MasterVolumeLevelScaled")]
|
|
||||||
public JoinDataComplete MasterVolumeLevelScaled = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Master Volume 16bit Scaled Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Mixer Preset Recall Set
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("MixerPresetRecall")]
|
|
||||||
public JoinDataComplete MixerPresetRecall = new JoinDataComplete(new JoinData { JoinNumber = 3, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Mixer Preset Recall Set", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Mixer Eq Preset Recall Set
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("MixerEqPresetRecall")]
|
|
||||||
public JoinDataComplete MixerEqPresetRecall = new JoinDataComplete(new JoinData { JoinNumber = 4, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Mixer Eq Preset Recall Set", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Master Volume Mute On Set / Get
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("MasterVolumeMuteOn")]
|
|
||||||
public JoinDataComplete MasterVolumeMuteOn = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Master Volume Mute On Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Master Volume Mute Off Set / Get
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("MasterVolumeMuteOff")]
|
|
||||||
public JoinDataComplete MasterVolumeMuteOff = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Master Volume Mute Off Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Master Volume Level Up
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("MasterVolumeUp")]
|
|
||||||
public JoinDataComplete MasterVolumeUp = new JoinDataComplete(new JoinData { JoinNumber = 3, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Master Volume Level Up", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Master Volume Level Down
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("MasterVolumeDown")]
|
|
||||||
public JoinDataComplete MasterVolumeDown = new JoinDataComplete(new JoinData { JoinNumber = 4, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Master Volume Level Down", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Master Volume Scaled Send Enable/Disable
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("MasterVolumeLevelScaledSend")]
|
|
||||||
public JoinDataComplete MasterVolumeLevelScaledSend = new JoinDataComplete(new JoinData { JoinNumber = 5, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Master Volume Scaled Send Enable/Disable", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Source Volume Signed dB Set / Get
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("SourceVolumeLevel")]
|
|
||||||
public JoinDataComplete SourceVolumeLevel = new JoinDataComplete(new JoinData { JoinNumber = 11, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Source Volume Signed dB Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Source Volume 16bit Scaled Set / Get
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("SourceVolumeLevelScaled")]
|
|
||||||
public JoinDataComplete SourceVolumeLevelScaled = new JoinDataComplete(new JoinData { JoinNumber = 12, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Source Volume 16bit Scaled Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Source Volume Mute On Set / Get
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("SourceVolumeMuteOn")]
|
|
||||||
public JoinDataComplete SourceVolumeMuteOn = new JoinDataComplete(new JoinData { JoinNumber = 11, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Source Volume Mute On Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Source Volume Mute Off Set / Get
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("SourceVolumeMuteOff")]
|
|
||||||
public JoinDataComplete SourceVolumeMuteOff = new JoinDataComplete(new JoinData { JoinNumber = 12, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Source Volume Mute Off Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Source Volume Level Up
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("SourceVolumeUp")]
|
|
||||||
public JoinDataComplete SourceVolumeUp = new JoinDataComplete(new JoinData { JoinNumber = 13, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Source Volume Level Up", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Source Volume Level Down
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("SourceVolumeDown")]
|
|
||||||
public JoinDataComplete SourceVolumeDown = new JoinDataComplete(new JoinData { JoinNumber = 14, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Source Volume Level Down", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Source Volume Scaled Send Enable/Disable
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("SourceVolumeLevelScaledSend")]
|
|
||||||
public JoinDataComplete SourceVolumeLevelScaledSend = new JoinDataComplete(new JoinData { JoinNumber = 15, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Source Volume Scaled Send Enable/Disable", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Codec1 Volume Signed dB Set / Get
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("Codec1VolumeLevel")]
|
|
||||||
public JoinDataComplete Codec1VolumeLevel = new JoinDataComplete(new JoinData { JoinNumber = 21, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Codec1 Volume Signed dB Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Codec1 Volume 16bit Scaled Set / Get
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("Codec1VolumeLevelScaled")]
|
|
||||||
public JoinDataComplete Codec1VolumeLevelScaled = new JoinDataComplete(new JoinData { JoinNumber = 22, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Codec1 Volume 16bit Scaled Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Codec1 Volume Mute On Set / Get
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("Codec1VolumeMuteOn")]
|
|
||||||
public JoinDataComplete Codec1VolumeMuteOn = new JoinDataComplete(new JoinData { JoinNumber = 21, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Codec1 Volume Mute On Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Codec1 Volume Mute Off Set / Get
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("Codec1VolumeMuteOff")]
|
|
||||||
public JoinDataComplete Codec1VolumeMuteOff = new JoinDataComplete(new JoinData { JoinNumber = 22, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Codec1 Volume Mute Off Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Codec1 Volume Level Up
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("Codec1VolumeUp")]
|
|
||||||
public JoinDataComplete Codec1VolumeUp = new JoinDataComplete(new JoinData { JoinNumber = 23, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Codec1 Volume Level Up", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Codec1 Volume Level Down
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("Codec1VolumeDown")]
|
|
||||||
public JoinDataComplete Codec1VolumeDown = new JoinDataComplete(new JoinData { JoinNumber = 24, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Codec1 Volume Level Down", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Codec1 Volume Scaled Send Enable/Disable
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("Codec1VolumeLevelScaledSend")]
|
|
||||||
public JoinDataComplete Codec1VolumeLevelScaledSend = new JoinDataComplete(new JoinData { JoinNumber = 25, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Codec1 Volume Scaled Send Enable/Disable", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Codec2 Volume Signed dB Set / Get
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("Codec2VolumeLevel")]
|
|
||||||
public JoinDataComplete Codec2VolumeLevel = new JoinDataComplete(new JoinData { JoinNumber = 31, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Codec2 Volume Signed dB Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Codec2 Volume 16bit Scaled Set / Get
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("Codec2VolumeLevelScaled")]
|
|
||||||
public JoinDataComplete Codec2VolumeLevelScaled = new JoinDataComplete(new JoinData { JoinNumber = 32, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Codec2 Volume 16bit Scaled Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Codec2 Volume Mute On Set / Get
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("Codec2VolumeMuteOn")]
|
|
||||||
public JoinDataComplete Codec2VolumeMuteOn = new JoinDataComplete(new JoinData { JoinNumber = 31, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Codec2 Volume Mute On Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Codec2 Volume Mute Off Set / Get
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("Codec2VolumeMuteOff")]
|
|
||||||
public JoinDataComplete Codec2VolumeMuteOff = new JoinDataComplete(new JoinData { JoinNumber = 32, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Codec2 Volume Mute Off Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Codec2 Volume Level Up
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("Codec2VolumeUp")]
|
|
||||||
public JoinDataComplete Codec2VolumeUp = new JoinDataComplete(new JoinData { JoinNumber = 33, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Codec2 Volume Level Up", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Codec2 Volume Level Down
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("Codec2VolumeDown")]
|
|
||||||
public JoinDataComplete Codec2VolumeDown = new JoinDataComplete(new JoinData { JoinNumber = 34, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Codec2 Volume Level Down", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Codec2 Volume Scaled Send Enable/Disable
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("Codec2VolumeLevelScaledSend")]
|
|
||||||
public JoinDataComplete Codec2VolumeLevelScaledSend = new JoinDataComplete(new JoinData { JoinNumber = 35, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Codec2 Volume Scaled Send Enable/Disable", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// MicsMaster Volume Signed dB Set / Get
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("MicsMasterVolumeLevel")]
|
|
||||||
public JoinDataComplete MicsMasterVolumeLevel = new JoinDataComplete(new JoinData { JoinNumber = 41, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "MicsMaster Volume Signed dB Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// MicsMaster Volume 16bit Scaled Set / Get
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("MicsMasterVolumeLevelScaled")]
|
|
||||||
public JoinDataComplete MicsMasterVolumeLevelScaled = new JoinDataComplete(new JoinData { JoinNumber = 42, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "MicsMaster Volume 16bit Scaled Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// MicsMaster Volume Mute On Set / Get
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("MicsMasterVolumeMuteOn")]
|
|
||||||
public JoinDataComplete MicsMasterVolumeMuteOn = new JoinDataComplete(new JoinData { JoinNumber = 41, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "MicsMaster Volume Mute On Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// MicsMaster Volume Mute Off Set / Get
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("MicsMasterVolumeMuteOff")]
|
|
||||||
public JoinDataComplete MicsMasterVolumeMuteOff = new JoinDataComplete(new JoinData { JoinNumber = 42, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "MicsMaster Volume Mute Off Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// MicsMaster Volume Level Up
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("MicsMasterVolumeUp")]
|
|
||||||
public JoinDataComplete MicsMasterVolumeUp = new JoinDataComplete(new JoinData { JoinNumber = 43, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "MicsMaster Volume Level Up", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// MicsMaster Volume Level Down
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("MicsMasterVolumeDown")]
|
|
||||||
public JoinDataComplete MicsMasterVolumeDown = new JoinDataComplete(new JoinData { JoinNumber = 44, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "MicsMaster Volume Level Down", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// MicsMaster Volume Scaled Send Enable/Disable
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("MicsMasterVolumeLevelScaledSend")]
|
|
||||||
public JoinDataComplete MicsMasterVolumeLevelScaledSend = new JoinDataComplete(new JoinData { JoinNumber = 45, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Mics Master Volume Scaled Send Enable/Disable", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Constructor to use when instantiating this Join Map without inheriting from it
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="joinStart">Join this join map will start at</param>
|
|
||||||
public DmpsAudioOutputControllerJoinMap(uint joinStart)
|
|
||||||
: this(joinStart, typeof(DmpsAudioOutputControllerJoinMap))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Constructor to use when extending this Join map
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="joinStart">Join this join map will start at</param>
|
|
||||||
/// <param name="type">Type of the child join map</param>
|
|
||||||
protected DmpsAudioOutputControllerJoinMap(uint joinStart, Type type) : base(joinStart, type)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,72 +1,49 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges;
|
||||||
|
|
||||||
|
public class DmpsMicrophoneControllerJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
|
[JoinName("MicGain")]
|
||||||
|
public JoinDataComplete MicGain = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Mic Gain dB Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("MicGainScaled")]
|
||||||
|
public JoinDataComplete MicGainScaled = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Mic Gain 16bit Scaled Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("MicMuteOn")]
|
||||||
|
public JoinDataComplete MicMuteOn = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Mic Mute On Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("MicMuteOff")]
|
||||||
|
public JoinDataComplete MicMuteOff = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Mic Mute Off Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("MicGainScaledSend")]
|
||||||
|
public JoinDataComplete MicGainScaledSend = new JoinDataComplete(new JoinData { JoinNumber = 3, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Mic Gain Scaled Send Enable/Disable", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("MicName")]
|
||||||
|
public JoinDataComplete MicName = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Mic Name Get", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a DmpsMicrophoneControllerJoinMap
|
/// Constructor to use when instantiating this Join Map without inheriting from it
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class DmpsMicrophoneControllerJoinMap : JoinMapBaseAdvanced
|
/// <param name="joinStart">Join this join map will start at</param>
|
||||||
|
public DmpsMicrophoneControllerJoinMap(uint joinStart)
|
||||||
|
: this(joinStart, typeof(DmpsMicrophoneControllerJoinMap))
|
||||||
{
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Mic Gain dB Set / Get
|
/// Constructor to use when extending this Join map
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JoinName("MicGain")]
|
/// <param name="joinStart">Join this join map will start at</param>
|
||||||
public JoinDataComplete MicGain = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
/// <param name="type">Type of the child join map</param>
|
||||||
new JoinMetadata { Description = "Mic Gain dB Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
protected DmpsMicrophoneControllerJoinMap(uint joinStart, Type type)
|
||||||
|
: base(joinStart, type)
|
||||||
/// <summary>
|
{
|
||||||
/// Mic Gain 16bit Scaled Set / Get
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("MicGainScaled")]
|
|
||||||
public JoinDataComplete MicGainScaled = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Mic Gain 16bit Scaled Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Mic Mute On Set / Get
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("MicMuteOn")]
|
|
||||||
public JoinDataComplete MicMuteOn = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Mic Mute On Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Mic Mute Off Set / Get
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("MicMuteOff")]
|
|
||||||
public JoinDataComplete MicMuteOff = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Mic Mute Off Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Mic Gain Scaled Send Enable/Disable
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("MicGainScaledSend")]
|
|
||||||
public JoinDataComplete MicGainScaledSend = new JoinDataComplete(new JoinData { JoinNumber = 3, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Mic Gain Scaled Send Enable/Disable", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Mic Name Get
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("MicName")]
|
|
||||||
public JoinDataComplete MicName = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Mic Name Get", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Constructor to use when instantiating this Join Map without inheriting from it
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="joinStart">Join this join map will start at</param>
|
|
||||||
public DmpsMicrophoneControllerJoinMap(uint joinStart)
|
|
||||||
: this(joinStart, typeof(DmpsMicrophoneControllerJoinMap))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Constructor to use when extending this Join map
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="joinStart">Join this join map will start at</param>
|
|
||||||
/// <param name="type">Type of the child join map</param>
|
|
||||||
protected DmpsMicrophoneControllerJoinMap(uint joinStart, Type type)
|
|
||||||
: base(joinStart, type)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,185 +1,122 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges;
|
||||||
|
|
||||||
|
public class DmpsRoutingControllerJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
|
[JoinName("EnableRouting")]
|
||||||
|
public JoinDataComplete EnableRouting = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "DMPS Enable Audio and Video Routing", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("SystemPowerOn")]
|
||||||
|
public JoinDataComplete SystemPowerOn = new JoinDataComplete(new JoinData { JoinNumber = 12, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "DMPS System Power On Get/Set", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("SystemPowerOff")]
|
||||||
|
public JoinDataComplete SystemPowerOff = new JoinDataComplete(new JoinData { JoinNumber = 13, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "DMPS System Power Off Get/Set", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("FrontPanelLockOn")]
|
||||||
|
public JoinDataComplete FrontPanelLockOn = new JoinDataComplete(new JoinData { JoinNumber = 14, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "DMPS Front Panel Lock On Get/Set", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("FrontPanelLockOff")]
|
||||||
|
public JoinDataComplete FrontPanelLockOff = new JoinDataComplete(new JoinData { JoinNumber = 15, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "DMPS Front Panel Lock Off Get/Set", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("VideoSyncStatus")]
|
||||||
|
public JoinDataComplete VideoSyncStatus = new JoinDataComplete(new JoinData { JoinNumber = 101, JoinSpan = 32 },
|
||||||
|
new JoinMetadata { Description = "DM Input Video Sync", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("InputEndpointOnline")]
|
||||||
|
public JoinDataComplete InputEndpointOnline = new JoinDataComplete(new JoinData { JoinNumber = 501, JoinSpan = 32 },
|
||||||
|
new JoinMetadata { Description = "DM Chassis Input Endpoint Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("OutputEndpointOnline")]
|
||||||
|
public JoinDataComplete OutputEndpointOnline = new JoinDataComplete(new JoinData { JoinNumber = 701, JoinSpan = 32 },
|
||||||
|
new JoinMetadata { Description = "DM Chassis Output Endpoint Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("OutputVideo")]
|
||||||
|
public JoinDataComplete OutputVideo = new JoinDataComplete(new JoinData { JoinNumber = 101, JoinSpan = 32 },
|
||||||
|
new JoinMetadata { Description = "DM Chassis Output Video Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("OutputAudio")]
|
||||||
|
public JoinDataComplete OutputAudio = new JoinDataComplete(new JoinData { JoinNumber = 301, JoinSpan = 32 },
|
||||||
|
new JoinMetadata { Description = "DM Chassis Output Audio Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("InputNames")]
|
||||||
|
public JoinDataComplete InputNames = new JoinDataComplete(new JoinData { JoinNumber = 101, JoinSpan = 32 },
|
||||||
|
new JoinMetadata { Description = "DM Chassis Input Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
||||||
|
|
||||||
|
[JoinName("OutputNames")]
|
||||||
|
public JoinDataComplete OutputNames = new JoinDataComplete(new JoinData { JoinNumber = 301, JoinSpan = 32 },
|
||||||
|
new JoinMetadata { Description = "DM Chassis Output Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
||||||
|
|
||||||
|
[JoinName("InputVideoNames")]
|
||||||
|
public JoinDataComplete InputVideoNames =
|
||||||
|
new JoinDataComplete(new JoinData { JoinNumber = 501, JoinSpan = 32 },
|
||||||
|
new JoinMetadata
|
||||||
|
{
|
||||||
|
Description = "Video Input Name",
|
||||||
|
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||||
|
JoinType = eJoinType.Serial
|
||||||
|
});
|
||||||
|
|
||||||
|
[JoinName("InputAudioNames")]
|
||||||
|
public JoinDataComplete InputAudioNames =
|
||||||
|
new JoinDataComplete(new JoinData { JoinNumber = 701, JoinSpan = 32 },
|
||||||
|
new JoinMetadata
|
||||||
|
{
|
||||||
|
Description = "Audio Input Name",
|
||||||
|
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||||
|
JoinType = eJoinType.Serial
|
||||||
|
});
|
||||||
|
[JoinName("OutputVideoNames")]
|
||||||
|
public JoinDataComplete OutputVideoNames =
|
||||||
|
new JoinDataComplete(new JoinData { JoinNumber = 901, JoinSpan = 32 },
|
||||||
|
new JoinMetadata
|
||||||
|
{
|
||||||
|
Description = "Video Output Name",
|
||||||
|
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||||
|
JoinType = eJoinType.Serial
|
||||||
|
});
|
||||||
|
[JoinName("OutputAudioNames")]
|
||||||
|
public JoinDataComplete OutputAudioNames =
|
||||||
|
new JoinDataComplete(new JoinData { JoinNumber = 1101, JoinSpan = 32 },
|
||||||
|
new JoinMetadata
|
||||||
|
{
|
||||||
|
Description = "Audio Output Name",
|
||||||
|
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||||
|
JoinType = eJoinType.Serial
|
||||||
|
});
|
||||||
|
|
||||||
|
[JoinName("OutputCurrentVideoInputNames")]
|
||||||
|
public JoinDataComplete OutputCurrentVideoInputNames = new JoinDataComplete(new JoinData { JoinNumber = 2001, JoinSpan = 32 },
|
||||||
|
new JoinMetadata { Description = "DM Chassis Video Output Currently Routed Video Input Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
||||||
|
|
||||||
|
[JoinName("OutputCurrentAudioInputNames")]
|
||||||
|
public JoinDataComplete OutputCurrentAudioInputNames = new JoinDataComplete(new JoinData { JoinNumber = 2201, JoinSpan = 32 },
|
||||||
|
new JoinMetadata { Description = "DM Chassis Audio Output Currently Routed Video Input Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
||||||
|
|
||||||
|
[JoinName("InputCurrentResolution")]
|
||||||
|
public JoinDataComplete InputCurrentResolution = new JoinDataComplete(new JoinData { JoinNumber = 2401, JoinSpan = 32 },
|
||||||
|
new JoinMetadata { Description = "DM Chassis Input Current Resolution", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a DmpsRoutingControllerJoinMap
|
/// Constructor to use when instantiating this Join Map without inheriting from it
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class DmpsRoutingControllerJoinMap : JoinMapBaseAdvanced
|
/// <param name="joinStart">Join this join map will start at</param>
|
||||||
|
public DmpsRoutingControllerJoinMap(uint joinStart)
|
||||||
|
: this(joinStart, typeof(DmpsRoutingControllerJoinMap))
|
||||||
{
|
{
|
||||||
/// <summary>
|
}
|
||||||
/// DMPS Enable Audio and Video Routing
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("EnableRouting")]
|
|
||||||
public JoinDataComplete EnableRouting = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "DMPS Enable Audio and Video Routing", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DMPS Disable Audio and Video Routing
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("SystemPowerOn")]
|
|
||||||
public JoinDataComplete SystemPowerOn = new JoinDataComplete(new JoinData { JoinNumber = 12, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "DMPS System Power On Get/Set", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DMPS Disable Audio and Video Routing
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("SystemPowerOff")]
|
|
||||||
public JoinDataComplete SystemPowerOff = new JoinDataComplete(new JoinData { JoinNumber = 13, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "DMPS System Power Off Get/Set", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DMPS Front Panel Lock On Get/Set
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("FrontPanelLockOn")]
|
|
||||||
public JoinDataComplete FrontPanelLockOn = new JoinDataComplete(new JoinData { JoinNumber = 14, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "DMPS Front Panel Lock On Get/Set", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DMPS Front Panel Lock Off Get/Set
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("FrontPanelLockOff")]
|
|
||||||
public JoinDataComplete FrontPanelLockOff = new JoinDataComplete(new JoinData { JoinNumber = 15, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "DMPS Front Panel Lock Off Get/Set", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM Input Video Sync
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("VideoSyncStatus")]
|
|
||||||
public JoinDataComplete VideoSyncStatus = new JoinDataComplete(new JoinData { JoinNumber = 101, JoinSpan = 32 },
|
|
||||||
new JoinMetadata { Description = "DM Input Video Sync", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM Chassis Input Endpoint Online
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("InputEndpointOnline")]
|
|
||||||
public JoinDataComplete InputEndpointOnline = new JoinDataComplete(new JoinData { JoinNumber = 501, JoinSpan = 32 },
|
|
||||||
new JoinMetadata { Description = "DM Chassis Input Endpoint Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM Chassis Output Endpoint Online
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("OutputEndpointOnline")]
|
|
||||||
public JoinDataComplete OutputEndpointOnline = new JoinDataComplete(new JoinData { JoinNumber = 701, JoinSpan = 32 },
|
|
||||||
new JoinMetadata { Description = "DM Chassis Output Endpoint Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM Chassis Input Video Set / Get
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("OutputVideo")]
|
|
||||||
public JoinDataComplete OutputVideo = new JoinDataComplete(new JoinData { JoinNumber = 101, JoinSpan = 32 },
|
|
||||||
new JoinMetadata { Description = "DM Chassis Output Video Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM Chassis Input Audio Set / Get
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("OutputAudio")]
|
|
||||||
public JoinDataComplete OutputAudio = new JoinDataComplete(new JoinData { JoinNumber = 301, JoinSpan = 32 },
|
|
||||||
new JoinMetadata { Description = "DM Chassis Output Audio Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM Chassis Input Name
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("InputNames")]
|
|
||||||
public JoinDataComplete InputNames = new JoinDataComplete(new JoinData { JoinNumber = 101, JoinSpan = 32 },
|
|
||||||
new JoinMetadata { Description = "DM Chassis Input Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM Chassis Output Name
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("OutputNames")]
|
|
||||||
public JoinDataComplete OutputNames = new JoinDataComplete(new JoinData { JoinNumber = 301, JoinSpan = 32 },
|
|
||||||
new JoinMetadata { Description = "DM Chassis Output Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM Chassis Video Input Name
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("InputVideoNames")]
|
|
||||||
public JoinDataComplete InputVideoNames =
|
|
||||||
new JoinDataComplete(new JoinData { JoinNumber = 501, JoinSpan = 32 },
|
|
||||||
new JoinMetadata
|
|
||||||
{
|
|
||||||
Description = "DM Chassis Video Input Name",
|
|
||||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
|
||||||
JoinType = eJoinType.Serial
|
|
||||||
});
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM Chassis Audio Input Name
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("InputAudioNames")]
|
|
||||||
public JoinDataComplete InputAudioNames =
|
|
||||||
new JoinDataComplete(new JoinData { JoinNumber = 701, JoinSpan = 32 },
|
|
||||||
new JoinMetadata
|
|
||||||
{
|
|
||||||
Description = "Audio Input Name",
|
|
||||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
|
||||||
JoinType = eJoinType.Serial
|
|
||||||
});
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM Chassis Video Output Name
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("OutputVideoNames")]
|
|
||||||
public JoinDataComplete OutputVideoNames =
|
|
||||||
new JoinDataComplete(new JoinData { JoinNumber = 901, JoinSpan = 32 },
|
|
||||||
new JoinMetadata
|
|
||||||
{
|
|
||||||
Description = "Video Output Name",
|
|
||||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
|
||||||
JoinType = eJoinType.Serial
|
|
||||||
});
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM Chassis Audio Output Name
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("OutputAudioNames")]
|
|
||||||
public JoinDataComplete OutputAudioNames =
|
|
||||||
new JoinDataComplete(new JoinData { JoinNumber = 1101, JoinSpan = 32 },
|
|
||||||
new JoinMetadata
|
|
||||||
{
|
|
||||||
Description = "Audio Output Name",
|
|
||||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
|
||||||
JoinType = eJoinType.Serial
|
|
||||||
});
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM Chassis Video Output Currently Routed Video Input Name
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("OutputCurrentVideoInputNames")]
|
|
||||||
public JoinDataComplete OutputCurrentVideoInputNames = new JoinDataComplete(new JoinData { JoinNumber = 2001, JoinSpan = 32 },
|
|
||||||
new JoinMetadata { Description = "DM Chassis Video Output Currently Routed Video Input Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM Chassis Audio Output Currently Routed Video Input Name
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("OutputCurrentAudioInputNames")]
|
|
||||||
public JoinDataComplete OutputCurrentAudioInputNames = new JoinDataComplete(new JoinData { JoinNumber = 2201, JoinSpan = 32 },
|
|
||||||
new JoinMetadata { Description = "DM Chassis Audio Output Currently Routed Video Input Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DM Chassis Input Current Resolution
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("InputCurrentResolution")]
|
|
||||||
public JoinDataComplete InputCurrentResolution = new JoinDataComplete(new JoinData { JoinNumber = 2401, JoinSpan = 32 },
|
|
||||||
new JoinMetadata { Description = "DM Chassis Input Current Resolution", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructor to use when instantiating this Join Map without inheriting from it
|
/// Constructor to use when extending this Join map
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="joinStart">Join this join map will start at</param>
|
/// <param name="joinStart">Join this join map will start at</param>
|
||||||
public DmpsRoutingControllerJoinMap(uint joinStart)
|
/// <param name="type">Type of the child join map</param>
|
||||||
: this(joinStart, typeof(DmpsRoutingControllerJoinMap))
|
protected DmpsRoutingControllerJoinMap(uint joinStart, Type type) : base(joinStart, type)
|
||||||
{
|
{
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Constructor to use when extending this Join map
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="joinStart">Join this join map will start at</param>
|
|
||||||
/// <param name="type">Type of the child join map</param>
|
|
||||||
protected DmpsRoutingControllerJoinMap(uint joinStart, Type type) : base(joinStart, type)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,7 @@
|
|||||||
using PepperDash.Essentials.Core;
|
using PepperDash.Essentials.Core;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
namespace PepperDash.Essentials.Core.Bridges.JoinMaps;
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Represents a GenericIrControllerJoinMap
|
|
||||||
/// </summary>
|
|
||||||
public sealed class GenericIrControllerJoinMap : JoinMapBaseAdvanced
|
public sealed class GenericIrControllerJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -995,5 +992,4 @@ namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
|||||||
: base(joinStart, typeof(GenericIrControllerJoinMap))
|
: base(joinStart, typeof(GenericIrControllerJoinMap))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -1,67 +1,48 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges;
|
||||||
|
|
||||||
|
public class GenericLightingJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
|
|
||||||
|
[JoinName("IsOnline")]
|
||||||
|
public JoinDataComplete IsOnline = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Lighting Controller Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("SelectScene")]
|
||||||
|
public JoinDataComplete SelectScene = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Lighting Controller Select Scene By Index", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("SelectSceneDirect")]
|
||||||
|
public JoinDataComplete SelectSceneDirect = new JoinDataComplete(new JoinData { JoinNumber = 11, JoinSpan = 10 },
|
||||||
|
new JoinMetadata { Description = "Lighting Controller Select Scene", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.DigitalSerial });
|
||||||
|
|
||||||
|
[JoinName("ButtonVisibility")]
|
||||||
|
public JoinDataComplete ButtonVisibility = new JoinDataComplete(new JoinData { JoinNumber = 41, JoinSpan = 10 },
|
||||||
|
new JoinMetadata { Description = "Lighting Controller Button Visibility", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("IntegrationIdSet")]
|
||||||
|
public JoinDataComplete IntegrationIdSet = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Lighting Controller Set Integration Id", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Serial });
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a GenericLightingJoinMap
|
/// Constructor to use when instantiating this Join Map without inheriting from it
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class GenericLightingJoinMap : JoinMapBaseAdvanced
|
/// <param name="joinStart">Join this join map will start at</param>
|
||||||
|
public GenericLightingJoinMap(uint joinStart)
|
||||||
|
: this(joinStart, typeof(GenericLightingJoinMap))
|
||||||
{
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Lighting Controller Online
|
/// Constructor to use when extending this Join map
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JoinName("IsOnline")]
|
/// <param name="joinStart">Join this join map will start at</param>
|
||||||
public JoinDataComplete IsOnline = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
/// <param name="type">Type of the child join map</param>
|
||||||
new JoinMetadata { Description = "Lighting Controller Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
protected GenericLightingJoinMap(uint joinStart, Type type) : base(joinStart, type)
|
||||||
|
{
|
||||||
/// <summary>
|
|
||||||
/// Select Scene By Index
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("SelectScene")]
|
|
||||||
public JoinDataComplete SelectScene = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Lighting Controller Select Scene By Index", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Select Scene Direct
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("SelectSceneDirect")]
|
|
||||||
public JoinDataComplete SelectSceneDirect = new JoinDataComplete(new JoinData { JoinNumber = 11, JoinSpan = 10 },
|
|
||||||
new JoinMetadata { Description = "Lighting Controller Select Scene", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.DigitalSerial });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Button Visibility
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("ButtonVisibility")]
|
|
||||||
public JoinDataComplete ButtonVisibility = new JoinDataComplete(new JoinData { JoinNumber = 41, JoinSpan = 10 },
|
|
||||||
new JoinMetadata { Description = "Lighting Controller Button Visibility", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Set Integration Id
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("IntegrationIdSet")]
|
|
||||||
public JoinDataComplete IntegrationIdSet = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Lighting Controller Set Integration Id", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Serial });
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Constructor to use when instantiating this Join Map without inheriting from it
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="joinStart">Join this join map will start at</param>
|
|
||||||
public GenericLightingJoinMap(uint joinStart)
|
|
||||||
: this(joinStart, typeof(GenericLightingJoinMap))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Constructor to use when extending this Join map
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="joinStart">Join this join map will start at</param>
|
|
||||||
/// <param name="type">Type of the child join map</param>
|
|
||||||
protected GenericLightingJoinMap(uint joinStart, Type type) : base(joinStart, type)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,37 +1,30 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges;
|
||||||
|
|
||||||
|
public class GenericRelayControllerJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
|
|
||||||
|
[JoinName("Relay")]
|
||||||
|
public JoinDataComplete Relay = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Device Relay State Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a GenericRelayControllerJoinMap
|
/// Constructor to use when instantiating this Join Map without inheriting from it
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class GenericRelayControllerJoinMap : JoinMapBaseAdvanced
|
/// <param name="joinStart">Join this join map will start at</param>
|
||||||
|
public GenericRelayControllerJoinMap(uint joinStart)
|
||||||
|
: this(joinStart, typeof(GenericRelayControllerJoinMap))
|
||||||
{
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Device Relay State Set / Get
|
/// Constructor to use when extending this Join map
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JoinName("Relay")]
|
/// <param name="joinStart">Join this join map will start at</param>
|
||||||
public JoinDataComplete Relay = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
/// <param name="type">Type of the child join map</param>
|
||||||
new JoinMetadata { Description = "Device Relay State Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
protected GenericRelayControllerJoinMap(uint joinStart, Type type) : base(joinStart, type)
|
||||||
|
{
|
||||||
/// <summary>
|
|
||||||
/// Constructor to use when instantiating this Join Map without inheriting from it
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="joinStart">Join this join map will start at</param>
|
|
||||||
public GenericRelayControllerJoinMap(uint joinStart)
|
|
||||||
: this(joinStart, typeof(GenericRelayControllerJoinMap))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Constructor to use when extending this Join map
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="joinStart">Join this join map will start at</param>
|
|
||||||
/// <param name="type">Type of the child join map</param>
|
|
||||||
protected GenericRelayControllerJoinMap(uint joinStart, Type type) : base(joinStart, type)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,304 +1,184 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges;
|
||||||
|
|
||||||
|
public class GlsOccupancySensorBaseJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
|
[JoinName("IsOnline")]
|
||||||
|
public JoinDataComplete IsOnline = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Occ Sensor Is Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("ForceOccupied")]
|
||||||
|
public JoinDataComplete ForceOccupied = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Occ Sensor Set to Occupied", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("ForceVacant")]
|
||||||
|
public JoinDataComplete ForceVacant = new JoinDataComplete(new JoinData { JoinNumber = 3, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Occ Sensor Set to Vacant", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("EnableRawStates")]
|
||||||
|
public JoinDataComplete EnableRawStates = new JoinDataComplete(new JoinData { JoinNumber = 4, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Occ Sensor Enable Raw", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("RoomOccupiedFeedback")]
|
||||||
|
public JoinDataComplete RoomOccupiedFeedback = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Occ Sensor Room Is Occupied", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("GraceOccupancyDetectedFeedback")]
|
||||||
|
public JoinDataComplete GraceOccupancyDetectedFeedback = new JoinDataComplete(new JoinData { JoinNumber = 3, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Occ Sensor Grace Occupancy Detected", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("RoomVacantFeedback")]
|
||||||
|
public JoinDataComplete RoomVacantFeedback = new JoinDataComplete(new JoinData { JoinNumber = 4, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Occ Sensor Room Is Vacant", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("RawOccupancyFeedback")]
|
||||||
|
public JoinDataComplete RawOccupancyFeedback = new JoinDataComplete(new JoinData { JoinNumber = 5, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Occ Sensor Raw Occupancy Detected", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("RawOccupancyPirFeedback")]
|
||||||
|
public JoinDataComplete RawOccupancyPirFeedback = new JoinDataComplete(new JoinData { JoinNumber = 6, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Occ Sensor Raw PIR Occupancy Detected", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("RawOccupancyUsFeedback")]
|
||||||
|
public JoinDataComplete RawOccupancyUsFeedback = new JoinDataComplete(new JoinData { JoinNumber = 7, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Occ Sensor Raw US Occupancy Detected", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("EnableLedFlash")]
|
||||||
|
public JoinDataComplete EnableLedFlash = new JoinDataComplete(new JoinData { JoinNumber = 11, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Occ Sensor Enable LED Flash", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("DisableLedFlash")]
|
||||||
|
public JoinDataComplete DisableLedFlash = new JoinDataComplete(new JoinData { JoinNumber = 12, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Occ Sensor Disable LED Flash", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("EnableShortTimeout")]
|
||||||
|
public JoinDataComplete EnableShortTimeout = new JoinDataComplete(new JoinData { JoinNumber = 13, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Occ Sensor Enable Short Timeout", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("DisableShortTimeout")]
|
||||||
|
public JoinDataComplete DisableShortTimeout = new JoinDataComplete(new JoinData { JoinNumber = 14, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Occ Sensor Disable Short Timeout", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("OrWhenVacated")]
|
||||||
|
public JoinDataComplete OrWhenVacated = new JoinDataComplete(new JoinData { JoinNumber = 15, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Occ Sensor Set To Vacant when Either Sensor is Vacant", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("AndWhenVacated")]
|
||||||
|
public JoinDataComplete AndWhenVacated = new JoinDataComplete(new JoinData { JoinNumber = 16, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Occ Sensor Set To Vacant when Both Sensors are Vacant", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("EnableUsA")]
|
||||||
|
public JoinDataComplete EnableUsA = new JoinDataComplete(new JoinData { JoinNumber = 17, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Occ Sensor Enable Ultrasonic Sensor A", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("DisableUsA")]
|
||||||
|
public JoinDataComplete DisableUsA = new JoinDataComplete(new JoinData { JoinNumber = 18, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Occ Sensor Disable Ultrasonic Sensor A", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("EnableUsB")]
|
||||||
|
public JoinDataComplete EnableUsB = new JoinDataComplete(new JoinData { JoinNumber = 19, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Occ Sensor Enable Ultrasonic Sensor B", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("DisableUsB")]
|
||||||
|
public JoinDataComplete DisableUsB = new JoinDataComplete(new JoinData { JoinNumber = 20, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Occ Sensor Disable Ultrasonic Sensor B", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("EnablePir")]
|
||||||
|
public JoinDataComplete EnablePir = new JoinDataComplete(new JoinData { JoinNumber = 21, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Occ Sensor Enable IR Sensor", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("DisablePir")]
|
||||||
|
public JoinDataComplete DisablePir = new JoinDataComplete(new JoinData { JoinNumber = 22, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Occ Sensor Disable IR Sensor", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("IncrementUsInOccupiedState")]
|
||||||
|
public JoinDataComplete IncrementUsInOccupiedState = new JoinDataComplete(new JoinData { JoinNumber = 23, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Occ Sensor Increment US Occupied State Sensitivity", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("DecrementUsInOccupiedState")]
|
||||||
|
public JoinDataComplete DecrementUsInOccupiedState = new JoinDataComplete(new JoinData { JoinNumber = 24, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Occ Sensor Decrement US Occupied State Sensitivity", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("IncrementUsInVacantState")]
|
||||||
|
public JoinDataComplete IncrementUsInVacantState = new JoinDataComplete(new JoinData { JoinNumber = 25, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Occ Sensor Increment US Vacant State Sensitivity", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("DecrementUsInVacantState")]
|
||||||
|
public JoinDataComplete DecrementUsInVacantState = new JoinDataComplete(new JoinData { JoinNumber = 26, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Occ Sensor Decrement US Vacant State Sensitivity", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("IncrementPirInOccupiedState")]
|
||||||
|
public JoinDataComplete IncrementPirInOccupiedState = new JoinDataComplete(new JoinData { JoinNumber = 27, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Occ Sensor Increment IR Occupied State Sensitivity", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("DecrementPirInOccupiedState")]
|
||||||
|
public JoinDataComplete DecrementPirInOccupiedState = new JoinDataComplete(new JoinData { JoinNumber = 28, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Occ Sensor Decrement IR Occupied State Sensitivity", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("IncrementPirInVacantState")]
|
||||||
|
public JoinDataComplete IncrementPirInVacantState = new JoinDataComplete(new JoinData { JoinNumber = 29, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Occ Sensor Increment IR Vacant State Sensitivity", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("DecrementPirInVacantState")]
|
||||||
|
public JoinDataComplete DecrementPirInVacantState = new JoinDataComplete(new JoinData { JoinNumber = 30, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Occ Sensor Decrement IR Vacant State Sensitivity", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("Timeout")]
|
||||||
|
public JoinDataComplete Timeout = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Occ Sensor Timeout Value", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("TimeoutLocalFeedback")]
|
||||||
|
public JoinDataComplete TimeoutLocalFeedback = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Occ Sensor Local Timeout Value", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("InternalPhotoSensorValue")]
|
||||||
|
public JoinDataComplete InternalPhotoSensorValue = new JoinDataComplete(new JoinData { JoinNumber = 3, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Occ Sensor Internal PhotoSensor Value", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("ExternalPhotoSensorValue")]
|
||||||
|
public JoinDataComplete ExternalPhotoSensorValue = new JoinDataComplete(new JoinData { JoinNumber = 4, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Occ Sensor External PhotoSensor Value", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("UsSensitivityInOccupiedState")]
|
||||||
|
public JoinDataComplete UsSensitivityInOccupiedState = new JoinDataComplete(new JoinData { JoinNumber = 5, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Occ Sensor Ultrasonic Sensitivity in Occupied State", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("UsSensitivityInVacantState")]
|
||||||
|
public JoinDataComplete UsSensitivityInVacantState = new JoinDataComplete(new JoinData { JoinNumber = 6, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Occ Sensor Ultrasonic Sensitivity in Vacant State", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("PirSensitivityInOccupiedState")]
|
||||||
|
public JoinDataComplete PirSensitivityInOccupiedState = new JoinDataComplete(new JoinData { JoinNumber = 7, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Occ Sensor PIR Sensitivity in Occupied State", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("PirSensitivityInVacantState")]
|
||||||
|
public JoinDataComplete PirSensitivityInVacantState = new JoinDataComplete(new JoinData { JoinNumber = 8, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Occ Sensor PIR Sensitivity in Vacant State", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("Name")]
|
||||||
|
public JoinDataComplete Name = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Occ Sensor Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a GlsOccupancySensorBaseJoinMap
|
/// Constructor to use when instantiating this Join Map without inheriting from it
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class GlsOccupancySensorBaseJoinMap : JoinMapBaseAdvanced
|
/// <param name="joinStart">Join this join map will start at</param>
|
||||||
|
public GlsOccupancySensorBaseJoinMap(uint joinStart)
|
||||||
|
: this(joinStart, typeof(GlsOccupancySensorBaseJoinMap))
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Occ Sensor Is Online
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("IsOnline")]
|
|
||||||
public JoinDataComplete IsOnline = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Occ Sensor Is Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Occ Sensor Set to Occupied
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("ForceOccupied")]
|
|
||||||
public JoinDataComplete ForceOccupied = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Occ Sensor Set to Occupied", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Occ Sensor Set to Vacant
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("ForceVacant")]
|
|
||||||
public JoinDataComplete ForceVacant = new JoinDataComplete(new JoinData { JoinNumber = 3, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Occ Sensor Set to Vacant", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Occ Sensor Enable Raw
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("EnableRawStates")]
|
|
||||||
public JoinDataComplete EnableRawStates = new JoinDataComplete(new JoinData { JoinNumber = 4, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Occ Sensor Enable Raw", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Occ Sensor Disable Raw
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("RoomOccupiedFeedback")]
|
|
||||||
public JoinDataComplete RoomOccupiedFeedback = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Occ Sensor Room Is Occupied", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Occ Sensor Grace Occupancy Detected
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("GraceOccupancyDetectedFeedback")]
|
|
||||||
public JoinDataComplete GraceOccupancyDetectedFeedback = new JoinDataComplete(new JoinData { JoinNumber = 3, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Occ Sensor Grace Occupancy Detected", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Occ Sensor Room Is Vacant
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("RoomVacantFeedback")]
|
|
||||||
public JoinDataComplete RoomVacantFeedback = new JoinDataComplete(new JoinData { JoinNumber = 4, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Occ Sensor Room Is Vacant", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Occ Sensor Raw Occupancy Detected
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("RawOccupancyFeedback")]
|
|
||||||
public JoinDataComplete RawOccupancyFeedback = new JoinDataComplete(new JoinData { JoinNumber = 5, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Occ Sensor Raw Occupancy Detected", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Occ Sensor Raw PIR Occupancy Detected
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("RawOccupancyPirFeedback")]
|
|
||||||
public JoinDataComplete RawOccupancyPirFeedback = new JoinDataComplete(new JoinData { JoinNumber = 6, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Occ Sensor Raw PIR Occupancy Detected", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Occ Sensor Raw US Occupancy Detected
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("RawOccupancyUsFeedback")]
|
|
||||||
public JoinDataComplete RawOccupancyUsFeedback = new JoinDataComplete(new JoinData { JoinNumber = 7, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Occ Sensor Raw US Occupancy Detected", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Occ Sensor Enable LED Flash
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("EnableLedFlash")]
|
|
||||||
public JoinDataComplete EnableLedFlash = new JoinDataComplete(new JoinData { JoinNumber = 11, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Occ Sensor Enable LED Flash", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Occ Sensor Disable LED Flash
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("DisableLedFlash")]
|
|
||||||
public JoinDataComplete DisableLedFlash = new JoinDataComplete(new JoinData { JoinNumber = 12, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Occ Sensor Disable LED Flash", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Occ Sensor Enable Short Timeout
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("EnableShortTimeout")]
|
|
||||||
public JoinDataComplete EnableShortTimeout = new JoinDataComplete(new JoinData { JoinNumber = 13, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Occ Sensor Enable Short Timeout", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Occ Sensor Disable Short Timeout
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("DisableShortTimeout")]
|
|
||||||
public JoinDataComplete DisableShortTimeout = new JoinDataComplete(new JoinData { JoinNumber = 14, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Occ Sensor Disable Short Timeout", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Occ Sensor Set To Vacant when Either Sensor is Vacant
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("OrWhenVacated")]
|
|
||||||
public JoinDataComplete OrWhenVacated = new JoinDataComplete(new JoinData { JoinNumber = 15, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Occ Sensor Set To Vacant when Either Sensor is Vacant", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Occ Sensor Set To Vacant when Both Sensors are Vacant
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("AndWhenVacated")]
|
|
||||||
public JoinDataComplete AndWhenVacated = new JoinDataComplete(new JoinData { JoinNumber = 16, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Occ Sensor Set To Vacant when Both Sensors are Vacant", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Occ Sensor Enable Ultrasonic Sensor A
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("EnableUsA")]
|
|
||||||
public JoinDataComplete EnableUsA = new JoinDataComplete(new JoinData { JoinNumber = 17, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Occ Sensor Enable Ultrasonic Sensor A", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Occ Sensor Disable Ultrasonic Sensor A
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("DisableUsA")]
|
|
||||||
public JoinDataComplete DisableUsA = new JoinDataComplete(new JoinData { JoinNumber = 18, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Occ Sensor Disable Ultrasonic Sensor A", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Occ Sensor Enable Ultrasonic Sensor B
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("EnableUsB")]
|
|
||||||
public JoinDataComplete EnableUsB = new JoinDataComplete(new JoinData { JoinNumber = 19, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Occ Sensor Enable Ultrasonic Sensor B", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Occ Sensor Disable Ultrasonic Sensor B
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("DisableUsB")]
|
|
||||||
public JoinDataComplete DisableUsB = new JoinDataComplete(new JoinData { JoinNumber = 20, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Occ Sensor Disable Ultrasonic Sensor B", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Occ Sensor Enable IR Sensor
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("EnablePir")]
|
|
||||||
public JoinDataComplete EnablePir = new JoinDataComplete(new JoinData { JoinNumber = 21, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Occ Sensor Enable IR Sensor", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Occ Sensor Disable IR Sensor
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("DisablePir")]
|
|
||||||
public JoinDataComplete DisablePir = new JoinDataComplete(new JoinData { JoinNumber = 22, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Occ Sensor Disable IR Sensor", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Occ Sensor Increment US Occupied State Sensitivity
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("IncrementUsInOccupiedState")]
|
|
||||||
public JoinDataComplete IncrementUsInOccupiedState = new JoinDataComplete(new JoinData { JoinNumber = 23, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Occ Sensor Increment US Occupied State Sensitivity", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Occ Sensor Decrement US Occupied State Sensitivity
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("DecrementUsInOccupiedState")]
|
|
||||||
public JoinDataComplete DecrementUsInOccupiedState = new JoinDataComplete(new JoinData { JoinNumber = 24, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Occ Sensor Decrement US Occupied State Sensitivity", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Occ Sensor Increment US Vacant State Sensitivity
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("IncrementUsInVacantState")]
|
|
||||||
public JoinDataComplete IncrementUsInVacantState = new JoinDataComplete(new JoinData { JoinNumber = 25, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Occ Sensor Increment US Vacant State Sensitivity", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Occ Sensor Decrement US Vacant State Sensitivity
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("DecrementUsInVacantState")]
|
|
||||||
public JoinDataComplete DecrementUsInVacantState = new JoinDataComplete(new JoinData { JoinNumber = 26, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Occ Sensor Decrement US Vacant State Sensitivity", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Occ Sensor Increment IR Occupied State Sensitivity
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("IncrementPirInOccupiedState")]
|
|
||||||
public JoinDataComplete IncrementPirInOccupiedState = new JoinDataComplete(new JoinData { JoinNumber = 27, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Occ Sensor Increment IR Occupied State Sensitivity", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Occ Sensor Decrement IR Occupied State Sensitivity
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("DecrementPirInOccupiedState")]
|
|
||||||
public JoinDataComplete DecrementPirInOccupiedState = new JoinDataComplete(new JoinData { JoinNumber = 28, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Occ Sensor Decrement IR Occupied State Sensitivity", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Occ Sensor Increment IR Vacant State Sensitivity
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("IncrementPirInVacantState")]
|
|
||||||
public JoinDataComplete IncrementPirInVacantState = new JoinDataComplete(new JoinData { JoinNumber = 29, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Occ Sensor Increment IR Vacant State Sensitivity", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Occ Sensor Decrement IR Vacant State Sensitivity
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("DecrementPirInVacantState")]
|
|
||||||
public JoinDataComplete DecrementPirInVacantState = new JoinDataComplete(new JoinData { JoinNumber = 30, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Occ Sensor Decrement IR Vacant State Sensitivity", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Occ Sensor Timeout Value
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("Timeout")]
|
|
||||||
public JoinDataComplete Timeout = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Occ Sensor Timeout Value", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Occ Sensor Local Timeout Value
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("TimeoutLocalFeedback")]
|
|
||||||
public JoinDataComplete TimeoutLocalFeedback = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Occ Sensor Local Timeout Value", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Occ Sensor Internal PhotoSensor Value
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("InternalPhotoSensorValue")]
|
|
||||||
public JoinDataComplete InternalPhotoSensorValue = new JoinDataComplete(new JoinData { JoinNumber = 3, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Occ Sensor Internal PhotoSensor Value", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Occ Sensor External PhotoSensor Value
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("ExternalPhotoSensorValue")]
|
|
||||||
public JoinDataComplete ExternalPhotoSensorValue = new JoinDataComplete(new JoinData { JoinNumber = 4, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Occ Sensor External PhotoSensor Value", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Occ Sensor Ultrasonic Sensitivity in Occupied State
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("UsSensitivityInOccupiedState")]
|
|
||||||
public JoinDataComplete UsSensitivityInOccupiedState = new JoinDataComplete(new JoinData { JoinNumber = 5, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Occ Sensor Ultrasonic Sensitivity in Occupied State", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Occ Sensor Ultrasonic Sensitivity in Vacant State
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("UsSensitivityInVacantState")]
|
|
||||||
public JoinDataComplete UsSensitivityInVacantState = new JoinDataComplete(new JoinData { JoinNumber = 6, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Occ Sensor Ultrasonic Sensitivity in Vacant State", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Occ Sensor PIR Sensitivity in Occupied State
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("PirSensitivityInOccupiedState")]
|
|
||||||
public JoinDataComplete PirSensitivityInOccupiedState = new JoinDataComplete(new JoinData { JoinNumber = 7, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Occ Sensor PIR Sensitivity in Occupied State", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Occ Sensor PIR Sensitivity in Vacant State
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("PirSensitivityInVacantState")]
|
|
||||||
public JoinDataComplete PirSensitivityInVacantState = new JoinDataComplete(new JoinData { JoinNumber = 8, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Occ Sensor PIR Sensitivity in Vacant State", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Occ Sensor Name
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("Name")]
|
|
||||||
public JoinDataComplete Name = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Occ Sensor Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Constructor to use when instantiating this Join Map without inheriting from it
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="joinStart">Join this join map will start at</param>
|
|
||||||
public GlsOccupancySensorBaseJoinMap(uint joinStart)
|
|
||||||
: this(joinStart, typeof(GlsOccupancySensorBaseJoinMap))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Constructor to use when extending this Join map
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="joinStart">Join this join map will start at</param>
|
|
||||||
/// <param name="type">Type of the child join map</param>
|
|
||||||
protected GlsOccupancySensorBaseJoinMap(uint joinStart, Type type)
|
|
||||||
: base(joinStart, type)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor to use when extending this Join map
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="joinStart">Join this join map will start at</param>
|
||||||
|
/// <param name="type">Type of the child join map</param>
|
||||||
|
protected GlsOccupancySensorBaseJoinMap(uint joinStart, Type type)
|
||||||
|
: base(joinStart, type)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,183 +1,156 @@
|
|||||||
using System;
|
using System;
|
||||||
using PepperDash.Essentials.Core;
|
using PepperDash.Essentials.Core;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
namespace PepperDash.Essentials.Core.Bridges.JoinMaps;
|
||||||
|
|
||||||
|
public class GlsPartitionSensorJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
|
|
||||||
|
#region Digital
|
||||||
|
|
||||||
|
[JoinName("IsOnline")]
|
||||||
|
public JoinDataComplete IsOnline = new JoinDataComplete(
|
||||||
|
new JoinData
|
||||||
|
{
|
||||||
|
JoinNumber = 1,
|
||||||
|
JoinSpan = 1
|
||||||
|
},
|
||||||
|
new JoinMetadata
|
||||||
|
{
|
||||||
|
Description = "Sensor Is Online",
|
||||||
|
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||||
|
JoinType = eJoinType.Digital
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
[JoinName("Enable")]
|
||||||
|
public JoinDataComplete Enable = new JoinDataComplete(
|
||||||
|
new JoinData
|
||||||
|
{
|
||||||
|
JoinNumber = 2,
|
||||||
|
JoinSpan = 1
|
||||||
|
},
|
||||||
|
new JoinMetadata
|
||||||
|
{
|
||||||
|
Description = "Sensor Enable",
|
||||||
|
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
|
||||||
|
JoinType = eJoinType.Digital
|
||||||
|
});
|
||||||
|
|
||||||
|
[JoinName("PartitionSensed")]
|
||||||
|
public JoinDataComplete PartitionSensed = new JoinDataComplete(
|
||||||
|
new JoinData
|
||||||
|
{
|
||||||
|
JoinNumber = 3,
|
||||||
|
JoinSpan = 1
|
||||||
|
},
|
||||||
|
new JoinMetadata
|
||||||
|
{
|
||||||
|
Description = "Sensor Partition Sensed",
|
||||||
|
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||||
|
JoinType = eJoinType.Digital
|
||||||
|
});
|
||||||
|
|
||||||
|
[JoinName("PartitionNotSensed")]
|
||||||
|
public JoinDataComplete PartitionNotSensed = new JoinDataComplete(
|
||||||
|
new JoinData
|
||||||
|
{
|
||||||
|
JoinNumber = 4,
|
||||||
|
JoinSpan = 1
|
||||||
|
},
|
||||||
|
new JoinMetadata
|
||||||
|
{
|
||||||
|
Description = "Sensor Partition Not Sensed",
|
||||||
|
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||||
|
JoinType = eJoinType.Digital
|
||||||
|
});
|
||||||
|
|
||||||
|
[JoinName("IncreaseSensitivity")]
|
||||||
|
public JoinDataComplete IncreaseSensitivity = new JoinDataComplete(
|
||||||
|
new JoinData
|
||||||
|
{
|
||||||
|
JoinNumber = 6,
|
||||||
|
JoinSpan = 1
|
||||||
|
},
|
||||||
|
new JoinMetadata
|
||||||
|
{
|
||||||
|
Description = "Sensor Increase Sensitivity",
|
||||||
|
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||||
|
JoinType = eJoinType.Digital
|
||||||
|
});
|
||||||
|
|
||||||
|
[JoinName("DecreaseSensitivity")]
|
||||||
|
public JoinDataComplete DecreaseSensitivity = new JoinDataComplete(
|
||||||
|
new JoinData
|
||||||
|
{
|
||||||
|
JoinNumber = 7,
|
||||||
|
JoinSpan = 1
|
||||||
|
},
|
||||||
|
new JoinMetadata
|
||||||
|
{
|
||||||
|
Description = "Sensor Decrease Sensitivity",
|
||||||
|
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||||
|
JoinType = eJoinType.Digital
|
||||||
|
});
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Analog
|
||||||
|
|
||||||
|
[JoinName("Sensitivity")]
|
||||||
|
public JoinDataComplete Sensitivity = new JoinDataComplete(
|
||||||
|
new JoinData
|
||||||
|
{
|
||||||
|
JoinNumber = 2,
|
||||||
|
JoinSpan = 1
|
||||||
|
},
|
||||||
|
new JoinMetadata
|
||||||
|
{
|
||||||
|
Description = "Sensor Sensitivity",
|
||||||
|
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
|
||||||
|
JoinType = eJoinType.Analog
|
||||||
|
});
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
#region Serial
|
||||||
|
|
||||||
|
[JoinName("Name")]
|
||||||
|
public JoinDataComplete Name = new JoinDataComplete(
|
||||||
|
new JoinData
|
||||||
|
{
|
||||||
|
JoinNumber = 1,
|
||||||
|
JoinSpan = 1
|
||||||
|
},
|
||||||
|
new JoinMetadata
|
||||||
|
{
|
||||||
|
Description = "Sensor Name",
|
||||||
|
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||||
|
JoinType = eJoinType.Serial
|
||||||
|
});
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a GlsPartitionSensorJoinMap
|
/// Constructor to use when instantiating this Join Map without inheriting from it
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class GlsPartitionSensorJoinMap : JoinMapBaseAdvanced
|
/// <param name="joinStart">Join this join map will start at</param>
|
||||||
|
public GlsPartitionSensorJoinMap(uint joinStart)
|
||||||
|
: this(joinStart, typeof(GlsPartitionSensorJoinMap))
|
||||||
{
|
{
|
||||||
|
|
||||||
#region Digital
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sensor Is Online
|
/// Constructor to use when extending this Join map
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JoinName("IsOnline")]
|
/// <param name="joinStart">Join this join map will start at</param>
|
||||||
public JoinDataComplete IsOnline = new JoinDataComplete(
|
/// <param name="type">Type of the child join map</param>
|
||||||
new JoinData
|
protected GlsPartitionSensorJoinMap(uint joinStart, Type type)
|
||||||
{
|
: base(joinStart, type)
|
||||||
JoinNumber = 1,
|
{
|
||||||
JoinSpan = 1
|
|
||||||
},
|
|
||||||
new JoinMetadata
|
|
||||||
{
|
|
||||||
Description = "Sensor Is Online",
|
|
||||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
|
||||||
JoinType = eJoinType.Digital
|
|
||||||
});
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sensor Enable
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("Enable")]
|
|
||||||
public JoinDataComplete Enable = new JoinDataComplete(
|
|
||||||
new JoinData
|
|
||||||
{
|
|
||||||
JoinNumber = 2,
|
|
||||||
JoinSpan = 1
|
|
||||||
},
|
|
||||||
new JoinMetadata
|
|
||||||
{
|
|
||||||
Description = "Sensor Enable",
|
|
||||||
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
|
|
||||||
JoinType = eJoinType.Digital
|
|
||||||
});
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sensor Partition Sensed
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("PartitionSensed")]
|
|
||||||
public JoinDataComplete PartitionSensed = new JoinDataComplete(
|
|
||||||
new JoinData
|
|
||||||
{
|
|
||||||
JoinNumber = 3,
|
|
||||||
JoinSpan = 1
|
|
||||||
},
|
|
||||||
new JoinMetadata
|
|
||||||
{
|
|
||||||
Description = "Sensor Partition Sensed",
|
|
||||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
|
||||||
JoinType = eJoinType.Digital
|
|
||||||
});
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sensor Partition Not Sensed
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("PartitionNotSensed")]
|
|
||||||
public JoinDataComplete PartitionNotSensed = new JoinDataComplete(
|
|
||||||
new JoinData
|
|
||||||
{
|
|
||||||
JoinNumber = 4,
|
|
||||||
JoinSpan = 1
|
|
||||||
},
|
|
||||||
new JoinMetadata
|
|
||||||
{
|
|
||||||
Description = "Sensor Partition Not Sensed",
|
|
||||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
|
||||||
JoinType = eJoinType.Digital
|
|
||||||
});
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sensor Increase Sensitivity
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("IncreaseSensitivity")]
|
|
||||||
public JoinDataComplete IncreaseSensitivity = new JoinDataComplete(
|
|
||||||
new JoinData
|
|
||||||
{
|
|
||||||
JoinNumber = 6,
|
|
||||||
JoinSpan = 1
|
|
||||||
},
|
|
||||||
new JoinMetadata
|
|
||||||
{
|
|
||||||
Description = "Sensor Increase Sensitivity",
|
|
||||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
|
||||||
JoinType = eJoinType.Digital
|
|
||||||
});
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sensor Decrease Sensitivity
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("DecreaseSensitivity")]
|
|
||||||
public JoinDataComplete DecreaseSensitivity = new JoinDataComplete(
|
|
||||||
new JoinData
|
|
||||||
{
|
|
||||||
JoinNumber = 7,
|
|
||||||
JoinSpan = 1
|
|
||||||
},
|
|
||||||
new JoinMetadata
|
|
||||||
{
|
|
||||||
Description = "Sensor Decrease Sensitivity",
|
|
||||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
|
||||||
JoinType = eJoinType.Digital
|
|
||||||
});
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Analog
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sensor Sensitivity
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("Sensitivity")]
|
|
||||||
public JoinDataComplete Sensitivity = new JoinDataComplete(
|
|
||||||
new JoinData
|
|
||||||
{
|
|
||||||
JoinNumber = 2,
|
|
||||||
JoinSpan = 1
|
|
||||||
},
|
|
||||||
new JoinMetadata
|
|
||||||
{
|
|
||||||
Description = "Sensor Sensitivity",
|
|
||||||
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
|
|
||||||
JoinType = eJoinType.Analog
|
|
||||||
});
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Serial
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sensor Name
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("Name")]
|
|
||||||
public JoinDataComplete Name = new JoinDataComplete(
|
|
||||||
new JoinData
|
|
||||||
{
|
|
||||||
JoinNumber = 1,
|
|
||||||
JoinSpan = 1
|
|
||||||
},
|
|
||||||
new JoinMetadata
|
|
||||||
{
|
|
||||||
Description = "Sensor Name",
|
|
||||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
|
||||||
JoinType = eJoinType.Serial
|
|
||||||
});
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Constructor to use when instantiating this Join Map without inheriting from it
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="joinStart">Join this join map will start at</param>
|
|
||||||
public GlsPartitionSensorJoinMap(uint joinStart)
|
|
||||||
: this(joinStart, typeof(GlsPartitionSensorJoinMap))
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Constructor to use when extending this Join map
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="joinStart">Join this join map will start at</param>
|
|
||||||
/// <param name="type">Type of the child join map</param>
|
|
||||||
protected GlsPartitionSensorJoinMap(uint joinStart, Type type)
|
|
||||||
: base(joinStart, type)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,99 +1,65 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges;
|
||||||
|
|
||||||
|
public class HdMdNxM4kEControllerJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
|
[JoinName("Name")]
|
||||||
|
public JoinDataComplete Name = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Device Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
||||||
|
|
||||||
|
[JoinName("EnableAutoRoute")]
|
||||||
|
public JoinDataComplete EnableAutoRoute = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Enable Automatic Routing on 4x1 Switchers", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("InputName")]
|
||||||
|
public JoinDataComplete InputName = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 8 },
|
||||||
|
new JoinMetadata { Description = "Device Input Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
||||||
|
|
||||||
|
[JoinName("InputSync")]
|
||||||
|
public JoinDataComplete InputSync = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 8 },
|
||||||
|
new JoinMetadata { Description = "Device Input Sync", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("OutputName")]
|
||||||
|
public JoinDataComplete OutputName = new JoinDataComplete(new JoinData { JoinNumber = 11, JoinSpan = 2 },
|
||||||
|
new JoinMetadata { Description = "Device Output Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
||||||
|
|
||||||
|
[JoinName("OutputRoute")]
|
||||||
|
public JoinDataComplete OutputRoute = new JoinDataComplete(new JoinData { JoinNumber = 11, JoinSpan = 2 },
|
||||||
|
new JoinMetadata { Description = "Device Output Route Set/Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
||||||
|
|
||||||
|
[JoinName("OutputRoutedName")]
|
||||||
|
public JoinDataComplete OutputRoutedName = new JoinDataComplete(new JoinData { JoinNumber = 16, JoinSpan = 2 },
|
||||||
|
new JoinMetadata { Description = "Device Output Route Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
||||||
|
|
||||||
|
[JoinName("EnableInputHdcp")]
|
||||||
|
public JoinDataComplete EnableInputHdcp = new JoinDataComplete(new JoinData { JoinNumber = 11, JoinSpan = 8 },
|
||||||
|
new JoinMetadata { Description = "Device Enable Input Hdcp", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("DisableInputHdcp")]
|
||||||
|
public JoinDataComplete DisableInputHdcp = new JoinDataComplete(new JoinData { JoinNumber = 21, JoinSpan = 8 },
|
||||||
|
new JoinMetadata { Description = "Device Disnable Input Hdcp", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("IsOnline")]
|
||||||
|
public JoinDataComplete IsOnline = new JoinDataComplete(new JoinData { JoinNumber = 30, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Device Onlne", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a HdMdNxM4kEControllerJoinMap
|
/// Constructor to use when instantiating this Join Map without inheriting from it
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class HdMdNxM4kEControllerJoinMap : JoinMapBaseAdvanced
|
/// <param name="joinStart">Join this join map will start at</param>
|
||||||
|
public HdMdNxM4kEControllerJoinMap(uint joinStart)
|
||||||
|
: this(joinStart, typeof(HdMdNxM4kEControllerJoinMap))
|
||||||
{
|
{
|
||||||
/// <summary>
|
}
|
||||||
/// Device Name
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("Name")]
|
|
||||||
public JoinDataComplete Name = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Device Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Enable Automatic Routing on 4x1 Switchers
|
/// Constructor to use when extending this Join map
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JoinName("EnableAutoRoute")]
|
/// <param name="joinStart">Join this join map will start at</param>
|
||||||
public JoinDataComplete EnableAutoRoute = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
/// <param name="type">Type of the child join map</param>
|
||||||
new JoinMetadata { Description = "Enable Automatic Routing on 4x1 Switchers", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
protected HdMdNxM4kEControllerJoinMap(uint joinStart, Type type)
|
||||||
|
: base(joinStart, type)
|
||||||
/// <summary>
|
{
|
||||||
/// Device Input Name
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("InputName")]
|
|
||||||
public JoinDataComplete InputName = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 8 },
|
|
||||||
new JoinMetadata { Description = "Device Input Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Device Input Sync
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("InputSync")]
|
|
||||||
public JoinDataComplete InputSync = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 8 },
|
|
||||||
new JoinMetadata { Description = "Device Input Sync", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Device Output Name
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("OutputName")]
|
|
||||||
public JoinDataComplete OutputName = new JoinDataComplete(new JoinData { JoinNumber = 11, JoinSpan = 2 },
|
|
||||||
new JoinMetadata { Description = "Device Output Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Device Output Route Set/Get
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("OutputRoute")]
|
|
||||||
public JoinDataComplete OutputRoute = new JoinDataComplete(new JoinData { JoinNumber = 11, JoinSpan = 2 },
|
|
||||||
new JoinMetadata { Description = "Device Output Route Set/Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Device Output Route Name
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("OutputRoutedName")]
|
|
||||||
public JoinDataComplete OutputRoutedName = new JoinDataComplete(new JoinData { JoinNumber = 16, JoinSpan = 2 },
|
|
||||||
new JoinMetadata { Description = "Device Output Route Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Device Enable Input Hdcp
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("EnableInputHdcp")]
|
|
||||||
public JoinDataComplete EnableInputHdcp = new JoinDataComplete(new JoinData { JoinNumber = 11, JoinSpan = 8 },
|
|
||||||
new JoinMetadata { Description = "Device Enable Input Hdcp", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Device Disable Input Hdcp
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("DisableInputHdcp")]
|
|
||||||
public JoinDataComplete DisableInputHdcp = new JoinDataComplete(new JoinData { JoinNumber = 21, JoinSpan = 8 },
|
|
||||||
new JoinMetadata { Description = "Device Disnable Input Hdcp", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Device Online Status
|
|
||||||
/// </summary>
|
|
||||||
[JoinName("IsOnline")]
|
|
||||||
public JoinDataComplete IsOnline = new JoinDataComplete(new JoinData { JoinNumber = 30, JoinSpan = 1 },
|
|
||||||
new JoinMetadata { Description = "Device Onlne", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Constructor to use when instantiating this Join Map without inheriting from it
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="joinStart">Join this join map will start at</param>
|
|
||||||
public HdMdNxM4kEControllerJoinMap(uint joinStart)
|
|
||||||
: this(joinStart, typeof(HdMdNxM4kEControllerJoinMap))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Constructor to use when extending this Join map
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="joinStart">Join this join map will start at</param>
|
|
||||||
/// <param name="type">Type of the child join map</param>
|
|
||||||
protected HdMdNxM4kEControllerJoinMap(uint joinStart, Type type)
|
|
||||||
: base(joinStart, type)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user