mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-01-12 03:54:51 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5a2b1f431f | ||
|
|
6253d4becf | ||
|
|
1bb9bfab70 | ||
|
|
6aae1c6613 | ||
|
|
72477a9a24 |
37
.github/ISSUE_TEMPLATE/bug_report.md
vendored
37
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -1,37 +0,0 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: "[BUG]-"
|
||||
labels: bug
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Was this bug identified in a specific build version?**
|
||||
Please note the build version where this bug was identified
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**Stacktrace**
|
||||
|
||||
Include a stack trace of the exception if possible.
|
||||
```
|
||||
Paste stack trace here
|
||||
```
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
21
.github/ISSUE_TEMPLATE/feature_request.md
vendored
21
.github/ISSUE_TEMPLATE/feature_request.md
vendored
@@ -1,21 +0,0 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: "[FEATURE]-"
|
||||
labels: enhancement
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
If this is a request for support for a new device or type, be as specific as possible and include any pertinent manufacturer and model information.
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
||||
27
.github/ISSUE_TEMPLATE/rfi_request.md
vendored
27
.github/ISSUE_TEMPLATE/rfi_request.md
vendored
@@ -1,27 +0,0 @@
|
||||
---
|
||||
name: Request for Information
|
||||
about: Request specific information about capabilities of the framework
|
||||
title: "[RFI]-"
|
||||
labels: RFI
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**What is your request?**
|
||||
Please provide as much detail as possible.
|
||||
|
||||
|
||||
**What is the intended use case**
|
||||
- [ ] Essentials Standalone Application
|
||||
- [ ] Essentials + SIMPL Windows Hybrid
|
||||
|
||||
**User Interface Requirements**
|
||||
- [ ] Not Applicable (logic only)
|
||||
- [ ] Crestron Smart Graphics Touchpanel
|
||||
- [ ] Cisco Touch10
|
||||
- [ ] Mobile Control
|
||||
- [ ] Crestron CH5 Touchpanel interface
|
||||
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the request here.
|
||||
23
.github/scripts/GenerateVersionNumber-2.0.0.ps1
vendored
23
.github/scripts/GenerateVersionNumber-2.0.0.ps1
vendored
@@ -1,23 +0,0 @@
|
||||
$latestVersion = [version]"2.0.0"
|
||||
|
||||
$newVersion = [version]$latestVersion
|
||||
$phase = ""
|
||||
$newVersionString = ""
|
||||
|
||||
switch -regex ($Env:GITHUB_REF) {
|
||||
'^refs\/pull\/*.' {
|
||||
$phase = 'beta';
|
||||
$newVersionString = "{0}-{1}-{2}" -f $newVersion, $phase, $Env:GITHUB_RUN_NUMBER
|
||||
}
|
||||
'^refs\/heads\/feature-2.0.0\/*.' {
|
||||
$phase = 'alpha'
|
||||
$newVersionString = "{0}-{1}-{2}" -f $newVersion, $phase, $Env:GITHUB_RUN_NUMBER
|
||||
}
|
||||
'development-2.0.0' {
|
||||
$phase = 'beta'
|
||||
$newVersionString = "{0}-{1}-{2}" -f $newVersion, $phase, $Env:GITHUB_RUN_NUMBER
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Write-Output $newVersionString
|
||||
59
.github/scripts/GenerateVersionNumber.ps1
vendored
59
.github/scripts/GenerateVersionNumber.ps1
vendored
@@ -1,59 +0,0 @@
|
||||
$latestVersions = $(git tag --merged origin/main)
|
||||
$latestVersion = [version]"0.0.0"
|
||||
Write-Host "GITHUB_REF: $($Env:GITHUB_REF)"
|
||||
Write-Host "GITHUB_HEAD_REF: $($Env:GITHUB_HEAD_REF)"
|
||||
Write-Host "GITHUB_BASE_REF: $($Env:GITHUB_BASE_REF)"
|
||||
Foreach ($version in $latestVersions) {
|
||||
Write-Host $version
|
||||
try {
|
||||
if (([version]$version) -ge $latestVersion) {
|
||||
$latestVersion = $version
|
||||
Write-Host "Setting latest version to: $latestVersion"
|
||||
}
|
||||
}
|
||||
catch {
|
||||
Write-Host "Unable to convert $($version). Skipping"
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$newVersion = [version]$latestVersion
|
||||
$phase = ""
|
||||
$newVersionString = ""
|
||||
|
||||
switch -regex ($Env:GITHUB_REF) {
|
||||
'^refs\/pull\/*.' {
|
||||
$splitRef = $Env:GITHUB_REF -split "/"
|
||||
$phase = "pr$($splitRef[2])"
|
||||
$newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $newVersion.Major, $newVersion.Minor, ($newVersion.Build + 1), $phase, $Env:GITHUB_RUN_NUMBER
|
||||
}
|
||||
'^refs\/heads\/main*.' {
|
||||
$newVersionString = "{0}.{1}.{2}" -f $newVersion.Major, $newVersion.Minor, $newVersion.Build
|
||||
}
|
||||
'^refs\/heads\/feature\/*.' {
|
||||
$phase = 'alpha'
|
||||
$newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $newVersion.Major, $newVersion.Minor, ($newVersion.Build + 1), $phase, $Env:GITHUB_RUN_NUMBER
|
||||
}
|
||||
'^refs\/heads\/release\/*.' {
|
||||
$splitRef = $Env:GITHUB_REF -split "/"
|
||||
$version = [version]($splitRef[-1] -replace "v", "")
|
||||
$phase = 'rc'
|
||||
$newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $version.Major, $version.Minor, $version.Build, $phase, $Env:GITHUB_RUN_NUMBER
|
||||
}
|
||||
'^refs\/heads\/development*.' {
|
||||
$phase = 'beta'
|
||||
$newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $newVersion.Major, $newVersion.Minor, ($newVersion.Build + 1), $phase, $Env:GITHUB_RUN_NUMBER
|
||||
}
|
||||
'^refs\/heads\/hotfix\/*.' {
|
||||
$phase = 'hotfix'
|
||||
$newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $newVersion.Major, $newVersion.Minor, ($newVersion.Build + 1), $phase, $Env:GITHUB_RUN_NUMBER
|
||||
}
|
||||
'^refs\/heads\/bugfix\/*.' {
|
||||
$phase = 'hotfix'
|
||||
$newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $newVersion.Major, $newVersion.Minor, ($newVersion.Build + 1), $phase, $Env:GITHUB_RUN_NUMBER
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Write-Output $newVersionString
|
||||
40
.github/scripts/UpdateAssemblyVersion.ps1
vendored
40
.github/scripts/UpdateAssemblyVersion.ps1
vendored
@@ -1,40 +0,0 @@
|
||||
function Update-SourceVersion {
|
||||
Param ([string]$Version)
|
||||
#$fullVersion = $Version
|
||||
$baseVersion = [regex]::Match($Version, "(\d+.\d+.\d+).*").captures.groups[1].value
|
||||
$NewAssemblyVersion = ‘AssemblyVersion("‘ + $baseVersion + ‘.*")’
|
||||
Write-Output "AssemblyVersion = $NewAssemblyVersion"
|
||||
$NewAssemblyInformationalVersion = ‘AssemblyInformationalVersion("‘ + $Version + ‘")’
|
||||
Write-Output "AssemblyInformationalVersion = $NewAssemblyInformationalVersion"
|
||||
|
||||
foreach ($o in $input) {
|
||||
Write-output $o.FullName
|
||||
$TmpFile = $o.FullName + “.tmp”
|
||||
get-content $o.FullName |
|
||||
ForEach-Object {
|
||||
$_ -replace ‘AssemblyVersion\(".*"\)’, $NewAssemblyVersion } |
|
||||
ForEach-Object {
|
||||
$_ -replace ‘AssemblyInformationalVersion\(".*"\)’, $NewAssemblyInformationalVersion
|
||||
} > $TmpFile
|
||||
move-item $TmpFile $o.FullName -force
|
||||
}
|
||||
}
|
||||
|
||||
function Update-AllAssemblyInfoFiles ( $version ) {
|
||||
foreach ($file in “AssemblyInfo.cs”, “AssemblyInfo.vb” ) {
|
||||
get-childitem -Path $Env:GITHUB_WORKSPACE -recurse | Where-Object { $_.Name -eq $file } | Update-SourceVersion $version ;
|
||||
}
|
||||
}
|
||||
|
||||
# validate arguments
|
||||
$r = [System.Text.RegularExpressions.Regex]::Match($args[0], "\d+\.\d+\.\d+.*");
|
||||
if ($r.Success) {
|
||||
Write-Output "Updating Assembly Version to $args ...";
|
||||
Update-AllAssemblyInfoFiles $args[0];
|
||||
}
|
||||
else {
|
||||
Write-Output ” “;
|
||||
Write-Output “Error: Input version does not match x.y.z format!”
|
||||
Write-Output ” “;
|
||||
Write-Output "Unable to apply version to AssemblyInfo.cs files";
|
||||
}
|
||||
45
.github/scripts/ZipBuildOutput.ps1
vendored
45
.github/scripts/ZipBuildOutput.ps1
vendored
@@ -1,45 +0,0 @@
|
||||
# Uncomment these for local testing
|
||||
# $Env:GITHUB_WORKSPACE = "C:\Working Directories\PD\essentials"
|
||||
# $Env:SOLUTION_FILE = "PepperDashEssentials"
|
||||
# $Env:VERSION = "0.0.0-buildType-test"
|
||||
|
||||
# Sets the root directory for the operation
|
||||
$destination = "$($Env:GITHUB_HOME)\output"
|
||||
New-Item -ItemType Directory -Force -Path ($destination)
|
||||
Get-ChildItem ($destination)
|
||||
$exclusions = @(git submodule foreach --quiet 'echo $name')
|
||||
$exclusions += "Newtonsoft.Compact.Json.dll"
|
||||
# Trying to get any .json schema files (not currently working)
|
||||
# Gets any files with the listed extensions.
|
||||
Get-ChildItem -recurse -Path "$($Env:GITHUB_WORKSPACE)" -include "*.clz", "*.cpz", "*.cplz", "*.dll", "*.nuspec" | ForEach-Object {
|
||||
$allowed = $true;
|
||||
# Exclude any files in submodules
|
||||
foreach ($exclude in $exclusions) {
|
||||
if ((Split-Path $_.FullName -Parent).contains("$($exclude)")) {
|
||||
$allowed = $false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($allowed) {
|
||||
Write-Host "allowing $($_)"
|
||||
$_;
|
||||
}
|
||||
} | Copy-Item -Destination ($destination) -Force
|
||||
Write-Host "Getting matching files..."
|
||||
# Get any files from the output folder that match the following extensions
|
||||
Get-ChildItem -Path $destination | Where-Object { ($_.Extension -eq ".clz") -or ($_.Extension -eq ".cpz" -or ($_.Extension -eq ".cplz")) } | ForEach-Object {
|
||||
# Replace the extensions with dll and xml and create an array
|
||||
# Removed dll file capture, as previous step should capture all of them. Add if needed-> $($_ -replace "cpz|clz|cplz", "dll"),
|
||||
$filenames = @($($_ -replace "cpz|clz|cplz", "xml"))
|
||||
Write-Host "Filenames:"
|
||||
Write-Host $filenames
|
||||
if ($filenames.length -gt 0) {
|
||||
# Attempt to get the files and return them to the output directory
|
||||
Get-ChildItem -Recurse -Path "$($Env:GITHUB_WORKSPACE)" -include $filenames | Copy-Item -Destination ($destination) -Force
|
||||
}
|
||||
}
|
||||
|
||||
Get-ChildItem -Path $destination\*.cpz | Rename-Item -NewName { "$($_.BaseName)-$($Env:VERSION)$($_.Extension)" }
|
||||
Compress-Archive -Path $destination -DestinationPath "$($Env:GITHUB_WORKSPACE)\$($Env:SOLUTION_FILE)-$($Env:VERSION).zip" -Force
|
||||
Write-Host "Output Contents post Zip"
|
||||
Get-ChildItem -Path $destination
|
||||
@@ -1,22 +0,0 @@
|
||||
name: Build PepperDash Essentials
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '**'
|
||||
|
||||
jobs:
|
||||
getVersion:
|
||||
uses: PepperDash/workflow-templates/.github/workflows/essentialsplugins-getversion.yml@main
|
||||
secrets: inherit
|
||||
build-4Series:
|
||||
uses: PepperDash/workflow-templates/.github/workflows/essentialsplugins-4Series-builds.yml@main
|
||||
secrets: inherit
|
||||
needs: getVersion
|
||||
if: needs.getVersion.outputs.newVersion == 'true'
|
||||
with:
|
||||
newVersion: ${{ needs.getVersion.outputs.newVersion }}
|
||||
version: ${{ needs.getVersion.outputs.version }}
|
||||
tag: ${{ needs.getVersion.outputs.tag }}
|
||||
channel: ${{ needs.getVersion.outputs.channel }}
|
||||
bypassPackageCheck: true
|
||||
373
.gitignore
vendored
373
.gitignore
vendored
@@ -20,375 +20,4 @@ obj/
|
||||
[Rr]elease*/
|
||||
_ReSharper*/
|
||||
SIMPLSharpLogs/
|
||||
*.projectinfo
|
||||
essentials-framework/EssentialDMTestConfig/
|
||||
output/
|
||||
packages/
|
||||
|
||||
PepperDashEssentials-0.0.0-buildType-test.zip
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
##
|
||||
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
||||
|
||||
# User-specific files
|
||||
*.rsuser
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
|
||||
# Mono auto generated files
|
||||
mono_crash.*
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
[Ww][Ii][Nn]32/
|
||||
[Aa][Rr][Mm]/
|
||||
[Aa][Rr][Mm]64/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Ll]og/
|
||||
[Ll]ogs/
|
||||
|
||||
# Visual Studio 2015/2017 cache/options directory
|
||||
.vs/
|
||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||
#wwwroot/
|
||||
|
||||
# Visual Studio 2017 auto generated files
|
||||
Generated\ Files/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
# NUnit
|
||||
*.VisualState.xml
|
||||
TestResult.xml
|
||||
nunit-*.xml
|
||||
|
||||
# Build Results of an ATL Project
|
||||
[Dd]ebugPS/
|
||||
[Rr]eleasePS/
|
||||
dlldata.c
|
||||
|
||||
# Benchmark Results
|
||||
BenchmarkDotNet.Artifacts/
|
||||
|
||||
# .NET Core
|
||||
project.lock.json
|
||||
project.fragment.lock.json
|
||||
artifacts/
|
||||
|
||||
# ASP.NET Scaffolding
|
||||
ScaffoldingReadMe.txt
|
||||
|
||||
# StyleCop
|
||||
StyleCopReport.xml
|
||||
|
||||
# Files built by Visual Studio
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_h.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.iobj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.ipdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*_wpftmp.csproj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opendb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
*.VC.db
|
||||
*.VC.VC.opendb
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
*.sap
|
||||
|
||||
# Visual Studio Trace Files
|
||||
*.e2e
|
||||
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
*.DotSettings.user
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# AxoCover is a Code Coverage Tool
|
||||
.axoCover/*
|
||||
!.axoCover/settings.json
|
||||
|
||||
# Coverlet is a free, cross platform Code Coverage Tool
|
||||
coverage*.json
|
||||
coverage*.xml
|
||||
coverage*.info
|
||||
|
||||
# Visual Studio code coverage results
|
||||
*.coverage
|
||||
*.coveragexml
|
||||
|
||||
# NCrunch
|
||||
_NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
nCrunchTemp_*
|
||||
|
||||
# MightyMoose
|
||||
*.mm.*
|
||||
AutoTest.Net/
|
||||
|
||||
# Web workbench (sass)
|
||||
.sass-cache/
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.[Pp]ublish.xml
|
||||
*.azurePubxml
|
||||
# Note: Comment the next line if you want to checkin your web deploy settings,
|
||||
# but database connection strings (with potential passwords) will be unencrypted
|
||||
*.pubxml
|
||||
*.publishproj
|
||||
|
||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||
# in these scripts will be unencrypted
|
||||
PublishScripts/
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
# NuGet Symbol Packages
|
||||
*.snupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
**/[Pp]ackages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/[Pp]ackages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/[Pp]ackages/repositories.config
|
||||
# NuGet v3's project.json files produces more ignorable files
|
||||
*.nuget.props
|
||||
*.nuget.targets
|
||||
|
||||
# Microsoft Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Microsoft Azure Emulator
|
||||
ecf/
|
||||
rcf/
|
||||
|
||||
# Windows Store app package directories and files
|
||||
AppPackages/
|
||||
BundleArtifacts/
|
||||
Package.StoreAssociation.xml
|
||||
_pkginfo.txt
|
||||
*.appx
|
||||
*.appxbundle
|
||||
*.appxupload
|
||||
|
||||
# Visual Studio cache files
|
||||
# files ending in .cache can be ignored
|
||||
*.[Cc]ache
|
||||
# but keep track of directories ending in .cache
|
||||
!?*.[Cc]ache/
|
||||
|
||||
# Others
|
||||
ClientBin/
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.jfm
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
orleans.codegen.cs
|
||||
|
||||
# Including strong name files can present a security risk
|
||||
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
||||
#*.snk
|
||||
|
||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||
#bower_components/
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file
|
||||
# to a newer Visual Studio version. Backup files are not needed,
|
||||
# because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
ServiceFabricBackup/
|
||||
*.rptproj.bak
|
||||
|
||||
# SQL Server files
|
||||
*.mdf
|
||||
*.ldf
|
||||
*.ndf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
*.rptproj.rsuser
|
||||
*- [Bb]ackup.rdl
|
||||
*- [Bb]ackup ([0-9]).rdl
|
||||
*- [Bb]ackup ([0-9][0-9]).rdl
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# GhostDoc plugin setting file
|
||||
*.GhostDoc.xml
|
||||
|
||||
# Node.js Tools for Visual Studio
|
||||
.ntvs_analysis.dat
|
||||
node_modules/
|
||||
|
||||
# Visual Studio 6 build log
|
||||
*.plg
|
||||
|
||||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
|
||||
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||
*.vbw
|
||||
|
||||
# Visual Studio LightSwitch build output
|
||||
**/*.HTMLClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/ModelManifest.xml
|
||||
**/*.Server/GeneratedArtifacts
|
||||
**/*.Server/ModelManifest.xml
|
||||
_Pvt_Extensions
|
||||
|
||||
# Paket dependency manager
|
||||
.paket/paket.exe
|
||||
paket-files/
|
||||
|
||||
# FAKE - F# Make
|
||||
.fake/
|
||||
|
||||
# CodeRush personal settings
|
||||
.cr/personal
|
||||
|
||||
# Python Tools for Visual Studio (PTVS)
|
||||
__pycache__/
|
||||
*.pyc
|
||||
|
||||
# Cake - Uncomment if you are using it
|
||||
# tools/**
|
||||
# !tools/packages.config
|
||||
|
||||
# Tabs Studio
|
||||
*.tss
|
||||
|
||||
# Telerik's JustMock configuration file
|
||||
*.jmconfig
|
||||
|
||||
# BizTalk build output
|
||||
*.btp.cs
|
||||
*.btm.cs
|
||||
*.odx.cs
|
||||
*.xsd.cs
|
||||
|
||||
# OpenCover UI analysis results
|
||||
OpenCover/
|
||||
|
||||
# Azure Stream Analytics local run output
|
||||
ASALocalRun/
|
||||
|
||||
# MSBuild Binary and Structured Log
|
||||
*.binlog
|
||||
|
||||
# NVidia Nsight GPU debugger configuration file
|
||||
*.nvuser
|
||||
|
||||
# MFractors (Xamarin productivity tool) working folder
|
||||
.mfractor/
|
||||
|
||||
# Local History for Visual Studio
|
||||
.localhistory/
|
||||
|
||||
# BeatPulse healthcheck temp database
|
||||
healthchecksdb
|
||||
|
||||
# Backup folder for Package Reference Convert tool in Visual Studio 2017
|
||||
MigrationBackup/
|
||||
|
||||
# Ionide (cross platform F# VS Code tools) working folder
|
||||
.ionide/
|
||||
|
||||
# Fody - auto-generated XML schema
|
||||
FodyWeavers.xsd
|
||||
essentials-framework/Essentials Interfaces/PepperDash_Essentials_Interfaces/PepperDash_Essentials_Interfaces.csproj
|
||||
.DS_Store
|
||||
/._PepperDash.Essentials.sln
|
||||
.vscode/settings.json
|
||||
*.projectinfo
|
||||
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -0,0 +1,3 @@
|
||||
[submodule "essentials-framework"]
|
||||
path = essentials-framework
|
||||
url = https://bitbucket.org/Pepperdash_Products/essentials-framework.git
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
{
|
||||
"plugins": [
|
||||
[
|
||||
"@semantic-release/commit-analyzer",
|
||||
{
|
||||
"releaseRules": [
|
||||
{ "scope": "force-patch", "release": "patch" },
|
||||
{ "scope": "no-release", "release": false }
|
||||
]
|
||||
}
|
||||
],
|
||||
"@semantic-release/release-notes-generator",
|
||||
["@semantic-release/changelog",
|
||||
{
|
||||
"changelogFile": "CHANGELOG.md"
|
||||
}
|
||||
],
|
||||
[
|
||||
"@semantic-release/exec",
|
||||
{
|
||||
"verifyReleaseCmd": "echo \"newVersion=true\" >> $GITHUB_OUTPUT",
|
||||
"publishCmd": "echo \"version=${nextRelease.version}\" >> $GITHUB_OUTPUT && echo \"tag=${nextRelease.gitTag}\" >> $GITHUB_OUTPUT && echo \"type=${nextRelease.type}\" >> $GITHUB_OUTPUT && echo \"channel=${nextRelease.channel}\" >> $GITHUB_OUTPUT"
|
||||
}
|
||||
]
|
||||
],
|
||||
"branches": [
|
||||
"main",
|
||||
{"name": "development", "prerelease": "beta", "channel": "beta"},
|
||||
{"name": "release", "prerelease": "rc", "channel": "rc"},
|
||||
{
|
||||
"name": "replace-me-feature-branch",
|
||||
"prerelease": "replace-me-prerelease",
|
||||
"channel": "replace-me-prerelease"
|
||||
}
|
||||
]
|
||||
}
|
||||
110
CONTRIBUTING.md
110
CONTRIBUTING.md
@@ -1,110 +0,0 @@
|
||||
# Contributors Guide
|
||||
|
||||
Essentials is an open source project. If you are interested in making it better,
|
||||
there are many ways you can contribute. For example, you can:
|
||||
|
||||
- Submit a bug report
|
||||
- Suggest a new feature
|
||||
- Provide feedback by commenting on feature requests/proposals
|
||||
- Propose a patch by submitting a pull request
|
||||
- Suggest or submit documentation improvements
|
||||
- Review outstanding pull requests
|
||||
- Answer questions from other users
|
||||
- Share the software with other users who are interested
|
||||
- Teach others to use the software
|
||||
|
||||
## Bugs and Feature Requests
|
||||
|
||||
If you believe that you have found a bug or wish to propose a new feature,
|
||||
please first search the existing [issues] to see if it has already been
|
||||
reported. If you are unable to find an existing issue, consider using one of
|
||||
the provided templates to create a new issue and provide as many details as you
|
||||
can to assist in reproducing the bug or explaining your proposed feature.
|
||||
|
||||
## Patch Submission tips
|
||||
|
||||
Patches should be submitted in the form of Pull Requests to the Essentials
|
||||
[repository] on GitHub. But first, consider the following tips to ensure a
|
||||
smooth process when submitting a patch:
|
||||
|
||||
- Ensure that the patch compiles and does not break any build-time tests.
|
||||
- Be understanding, patient, and friendly; developers may need time to review
|
||||
your submissions before they can take action or respond. This does not mean
|
||||
your contribution is not valued. If your contribution has not received a
|
||||
response in a reasonable time, consider commenting with a polite inquiry for
|
||||
an update.
|
||||
- Limit your patches to the smallest reasonable change to achieve your intended
|
||||
goal. For example, do not make unnecessary indentation changes; but don't go
|
||||
out of your way to make the patch so minimal that it isn't easy to read,
|
||||
either. Consider the reviewer's perspective.
|
||||
- Before submission, please squash your commits to using a message that starts
|
||||
with the issue number and a description of the changes.
|
||||
- Isolate multiple patches from each other. If you wish to make several
|
||||
independent patches, do so in separate, smaller pull requests that can be
|
||||
reviewed more easily.
|
||||
- Be prepared to answer questions from reviewers. They may have further
|
||||
questions before accepting your patch, and may even propose changes. Please
|
||||
accept this feedback constructively, and not as a rejection of your proposed
|
||||
change.
|
||||
|
||||
## GitFlow Branch Model
|
||||
This repository adheres to the [GitFlow](https://nvie.com/posts/a-successful-git-branching-model/) branch model and is intitialized for GitFlow to make for consistent branch name prefixes. Please take time to familiarize yourself with this model.
|
||||
|
||||
- `master` will contain the latest stable version of the framework and release builds will be created from tagged commits on `master`.
|
||||
- HotFix/Patch Pull Requests should target `master` as the base branch.
|
||||
- All other Pull Requests (bug fixes, enhancements, etc.) should target `development` as the base branch.
|
||||
- `release/vX.Y.X` branches will be used for release candidates when moving new features from `development` to `master`.
|
||||
Beta builds will be created from tagged commits on release candidate branches.
|
||||
|
||||
## Review
|
||||
|
||||
- We welcome code reviews from anyone. A committer is required to formally
|
||||
accept and merge the changes.
|
||||
- Reviewers will be looking for things like threading issues, performance
|
||||
implications, API design, duplication of existing functionality, readability
|
||||
and code style, avoidance of bloat (scope-creep), etc.
|
||||
- Reviewers will likely ask questions to better understand your change.
|
||||
- Reviewers will make comments about changes to your patch:
|
||||
- MUST means that the change is required
|
||||
- SHOULD means that the change is suggested, further discussion on the
|
||||
subject may be required
|
||||
- COULD means that the change is optional
|
||||
|
||||
## Timeline and Managing Expectations
|
||||
|
||||
As we continue to engage contributors and learn best practices for running a successful open source project, our processes
|
||||
and guidance will likely evolve. We will try to communicate expectations as we are able and to always be responsive. We
|
||||
hope that the community will share their suggestions for improving this engagement. Based on the level of initial interest
|
||||
we receive and the availability of resources to evaluate contributions, we anticipate the following:
|
||||
|
||||
- We will initially prioritize pull requests that include small bug fixes and code that addresses potential vulnerabilities
|
||||
as well as pull requests that include improvements for processor language specifications because these require a
|
||||
reasonable amount of effort to evaluate and will help us exercise and revise our process for accepting contributions. In
|
||||
other words, we are going to start small in order to work out the kinks first.
|
||||
- We are committed to maintaining the integrity and security of our code base. In addition to the careful review the
|
||||
maintainers will give to code contributions to make sure they do not introduce new bugs or vulnerabilities, we will be
|
||||
trying to identify best practices to incorporate with our open source project so that contributors can have more control
|
||||
over whether their contributions are accepted. These might include things like style guides and requirements for tests and
|
||||
documentation to accompany some code contributions. As a result, it may take a long time for some contributions to be
|
||||
accepted. This does not mean we are ignoring them.
|
||||
- We are committed to integrating this GitHub project with our team's regular development work flow so that the open source
|
||||
project remains dynamic and relevant. This may affect our responsiveness and ability to accept pull requests
|
||||
quickly. This does not mean we are ignoring them.
|
||||
- Not all innovative ideas need to be accepted as pull requests into this GitHub project to be valuable to the community.
|
||||
There may be times when we recommend that you just share your code for some enhancement to Essentials from your own
|
||||
repository. As we identify and recognize extensions that are of general interest to Essentials, we
|
||||
may seek to incorporate them with our baseline.
|
||||
|
||||
## Legal
|
||||
|
||||
Consistent with Section D.6. of the GitHub Terms of Service as of 2019, and the MIT license, the project maintainer for this project accepts contributions using the inbound=outbound model.
|
||||
When you submit a pull request to this repository (inbound), you are agreeing to license your contribution under the same terms as specified in [LICENSE] (outbound).
|
||||
|
||||
This is an open source project.
|
||||
Contributions you make to this repository are completely voluntary.
|
||||
When you submit an issue, bug report, question, enhancement, pull request, etc., you are offering your contribution without expectation of payment, you expressly waive any future pay claims against PepperDash related to your contribution, and you acknowledge that this does not create an obligation on the part of PepperDash of any kind.
|
||||
Furthermore, your contributing to this project does not create an employer-employee relationship between the PepperDash and the contributor.
|
||||
|
||||
[issues]: https://github.com/PepperDash/Essentials/issues
|
||||
[repository]: https://github.com/PepperDash/Essentials
|
||||
[LICENSE]: https://github.com/PepperDash/Essentials/blob/master/LICENSE.md
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,7 +0,0 @@
|
||||
Copyright (c) <2020> PepperDash Technology Corporation
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -1,97 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.4.33213.308
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PepperDash.Essentials.Devices.Common", "src\PepperDash.Essentials.Devices.Common\PepperDash.Essentials.Devices.Common.csproj", "{53E204B7-97DD-441D-A96C-721DF014DF82}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{E5336563-1194-501E-BC4A-79AD9283EF90} = {E5336563-1194-501E-BC4A-79AD9283EF90}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PepperDash.Essentials", "src\PepperDash.Essentials\PepperDash.Essentials.csproj", "{CB3B11BA-625C-4D35-B663-FDC5BE9A230E}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{E5336563-1194-501E-BC4A-79AD9283EF90} = {E5336563-1194-501E-BC4A-79AD9283EF90}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PepperDash.Essentials.Core", "src\PepperDash.Essentials.Core\PepperDash.Essentials.Core.csproj", "{3D192FED-8FFC-4CB5-B5F7-BA307ABA254B}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{E5336563-1194-501E-BC4A-79AD9283EF90} = {E5336563-1194-501E-BC4A-79AD9283EF90}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Mobile Control", "Mobile Control", "{B24989D7-32B5-48D5-9AE1-5F3B17D25206}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PepperDash.Essentials.MobileControl", "src\PepperDash.Essentials.MobileControl\PepperDash.Essentials.MobileControl.csproj", "{F6D362DE-2256-44B1-927A-8CE4705D839A}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{E5336563-1194-501E-BC4A-79AD9283EF90} = {E5336563-1194-501E-BC4A-79AD9283EF90}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PepperDash.Essentials.MobileControl.Messengers", "src\PepperDash.Essentials.MobileControl.Messengers\PepperDash.Essentials.MobileControl.Messengers.csproj", "{B438694F-8FF7-464A-9EC8-10427374471F}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{E5336563-1194-501E-BC4A-79AD9283EF90} = {E5336563-1194-501E-BC4A-79AD9283EF90}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Essentials", "Essentials", "{AD98B742-8D85-481C-A69D-D8D8ABED39EA}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Core", "Core", "{02EA681E-C7D8-13C7-8484-4AC65E1B71E8}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PepperDash.Core", "src\PepperDash.Core\PepperDash.Core.csproj", "{E5336563-1194-501E-BC4A-79AD9283EF90}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug 4.7.2|Any CPU = Debug 4.7.2|Any CPU
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{53E204B7-97DD-441D-A96C-721DF014DF82}.Debug 4.7.2|Any CPU.ActiveCfg = Debug 4.7.2|Any CPU
|
||||
{53E204B7-97DD-441D-A96C-721DF014DF82}.Debug 4.7.2|Any CPU.Build.0 = Debug 4.7.2|Any CPU
|
||||
{53E204B7-97DD-441D-A96C-721DF014DF82}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{53E204B7-97DD-441D-A96C-721DF014DF82}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{53E204B7-97DD-441D-A96C-721DF014DF82}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{53E204B7-97DD-441D-A96C-721DF014DF82}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{CB3B11BA-625C-4D35-B663-FDC5BE9A230E}.Debug 4.7.2|Any CPU.ActiveCfg = Debug 4.7.2|Any CPU
|
||||
{CB3B11BA-625C-4D35-B663-FDC5BE9A230E}.Debug 4.7.2|Any CPU.Build.0 = Debug 4.7.2|Any CPU
|
||||
{CB3B11BA-625C-4D35-B663-FDC5BE9A230E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{CB3B11BA-625C-4D35-B663-FDC5BE9A230E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{CB3B11BA-625C-4D35-B663-FDC5BE9A230E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{CB3B11BA-625C-4D35-B663-FDC5BE9A230E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{3D192FED-8FFC-4CB5-B5F7-BA307ABA254B}.Debug 4.7.2|Any CPU.ActiveCfg = Debug 4.7.2|Any CPU
|
||||
{3D192FED-8FFC-4CB5-B5F7-BA307ABA254B}.Debug 4.7.2|Any CPU.Build.0 = Debug 4.7.2|Any CPU
|
||||
{3D192FED-8FFC-4CB5-B5F7-BA307ABA254B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3D192FED-8FFC-4CB5-B5F7-BA307ABA254B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3D192FED-8FFC-4CB5-B5F7-BA307ABA254B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3D192FED-8FFC-4CB5-B5F7-BA307ABA254B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{F6D362DE-2256-44B1-927A-8CE4705D839A}.Debug 4.7.2|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{F6D362DE-2256-44B1-927A-8CE4705D839A}.Debug 4.7.2|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F6D362DE-2256-44B1-927A-8CE4705D839A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{F6D362DE-2256-44B1-927A-8CE4705D839A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F6D362DE-2256-44B1-927A-8CE4705D839A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F6D362DE-2256-44B1-927A-8CE4705D839A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{B438694F-8FF7-464A-9EC8-10427374471F}.Debug 4.7.2|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B438694F-8FF7-464A-9EC8-10427374471F}.Debug 4.7.2|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B438694F-8FF7-464A-9EC8-10427374471F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B438694F-8FF7-464A-9EC8-10427374471F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B438694F-8FF7-464A-9EC8-10427374471F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B438694F-8FF7-464A-9EC8-10427374471F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E5336563-1194-501E-BC4A-79AD9283EF90}.Debug 4.7.2|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E5336563-1194-501E-BC4A-79AD9283EF90}.Debug 4.7.2|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E5336563-1194-501E-BC4A-79AD9283EF90}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E5336563-1194-501E-BC4A-79AD9283EF90}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E5336563-1194-501E-BC4A-79AD9283EF90}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E5336563-1194-501E-BC4A-79AD9283EF90}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{53E204B7-97DD-441D-A96C-721DF014DF82} = {AD98B742-8D85-481C-A69D-D8D8ABED39EA}
|
||||
{CB3B11BA-625C-4D35-B663-FDC5BE9A230E} = {AD98B742-8D85-481C-A69D-D8D8ABED39EA}
|
||||
{3D192FED-8FFC-4CB5-B5F7-BA307ABA254B} = {AD98B742-8D85-481C-A69D-D8D8ABED39EA}
|
||||
{F6D362DE-2256-44B1-927A-8CE4705D839A} = {B24989D7-32B5-48D5-9AE1-5F3B17D25206}
|
||||
{B438694F-8FF7-464A-9EC8-10427374471F} = {B24989D7-32B5-48D5-9AE1-5F3B17D25206}
|
||||
{E5336563-1194-501E-BC4A-79AD9283EF90} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {6907A4BF-7201-47CF-AAB1-3597F3B8E1C3}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
49
PepperDashEssentials.sln
Normal file
49
PepperDashEssentials.sln
Normal file
@@ -0,0 +1,49 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual Studio 2008
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PepperDashEssentials", ".\PepperDashEssentials\PepperDashEssentials.csproj", "{1BED5BA9-88C4-4365-9362-6F4B128071D3}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{892B761C-E479-44CE-BD74-243E9214AF13} = {892B761C-E479-44CE-BD74-243E9214AF13}
|
||||
{9199CE8A-0C9F-4952-8672-3EED798B284F} = {9199CE8A-0C9F-4952-8672-3EED798B284F}
|
||||
{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5} = {A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PepperDash_Essentials_Core", ".\essentials-framework\Essentials Core\PepperDashEssentialsBase\PepperDash_Essentials_Core.csproj", "{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Essentials Devices Common", ".\essentials-framework\Essentials Devices Common\Essentials Devices Common\Essentials Devices Common.csproj", "{892B761C-E479-44CE-BD74-243E9214AF13}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5} = {A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Essentials_DM", ".\essentials-framework\Essentials DM\Essentials_DM\Essentials_DM.csproj", "{9199CE8A-0C9F-4952-8672-3EED798B284F}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5} = {A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{1BED5BA9-88C4-4365-9362-6F4B128071D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1BED5BA9-88C4-4365-9362-6F4B128071D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1BED5BA9-88C4-4365-9362-6F4B128071D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1BED5BA9-88C4-4365-9362-6F4B128071D3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{892B761C-E479-44CE-BD74-243E9214AF13}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{892B761C-E479-44CE-BD74-243E9214AF13}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{892B761C-E479-44CE-BD74-243E9214AF13}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{892B761C-E479-44CE-BD74-243E9214AF13}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{9199CE8A-0C9F-4952-8672-3EED798B284F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9199CE8A-0C9F-4952-8672-3EED798B284F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9199CE8A-0C9F-4952-8672-3EED798B284F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9199CE8A-0C9F-4952-8672-3EED798B284F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
33
PepperDashEssentials/AppServer/CotijaConfig.cs
Normal file
33
PepperDashEssentials/AppServer/CotijaConfig.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class CotijaConfig
|
||||
{
|
||||
[JsonProperty("serverUrl")]
|
||||
public string ServerUrl { get; set; }
|
||||
|
||||
[JsonProperty("clientAppUrl")]
|
||||
public string ClientAppUrl { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class CotijaDdvc01RoomBridgePropertiesConfig
|
||||
{
|
||||
[JsonProperty("eiscId")]
|
||||
public string EiscId { get; set; }
|
||||
}
|
||||
}
|
||||
148
PepperDashEssentials/AppServer/CotijaDdvc01DeviceBridge.cs
Normal file
148
PepperDashEssentials/AppServer/CotijaDdvc01DeviceBridge.cs
Normal file
@@ -0,0 +1,148 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro.EthernetCommunication;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Room.Cotija
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a generic device connection through to and EISC for DDVC01
|
||||
/// </summary>
|
||||
public class CotijaDdvc01DeviceBridge : Device, IChannel, INumericKeypad
|
||||
{
|
||||
/// <summary>
|
||||
/// EISC used to talk to Simpl
|
||||
/// </summary>
|
||||
ThreeSeriesTcpIpEthernetIntersystemCommunications EISC;
|
||||
|
||||
public CotijaDdvc01DeviceBridge(string key, string name, ThreeSeriesTcpIpEthernetIntersystemCommunications eisc)
|
||||
: base(key, name)
|
||||
{
|
||||
EISC = eisc;
|
||||
}
|
||||
|
||||
|
||||
#region IChannel Members
|
||||
|
||||
public void ChannelUp(bool pressRelease)
|
||||
{
|
||||
EISC.SetBool(1111, pressRelease);
|
||||
}
|
||||
|
||||
public void ChannelDown(bool pressRelease)
|
||||
{
|
||||
EISC.SetBool(1111, pressRelease);
|
||||
}
|
||||
|
||||
public void LastChannel(bool pressRelease)
|
||||
{
|
||||
EISC.SetBool(1111, pressRelease);
|
||||
}
|
||||
|
||||
public void Guide(bool pressRelease)
|
||||
{
|
||||
EISC.SetBool(1111, pressRelease);
|
||||
}
|
||||
|
||||
public void Info(bool pressRelease)
|
||||
{
|
||||
EISC.SetBool(1111, pressRelease);
|
||||
}
|
||||
|
||||
public void Exit(bool pressRelease)
|
||||
{
|
||||
EISC.SetBool(1111, pressRelease);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region INumericKeypad Members
|
||||
|
||||
public void Digit0(bool pressRelease)
|
||||
{
|
||||
EISC.SetBool(1111, pressRelease);
|
||||
}
|
||||
|
||||
public void Digit1(bool pressRelease)
|
||||
{
|
||||
EISC.SetBool(1111, pressRelease);
|
||||
}
|
||||
|
||||
public void Digit2(bool pressRelease)
|
||||
{
|
||||
EISC.SetBool(1111, pressRelease);
|
||||
}
|
||||
|
||||
public void Digit3(bool pressRelease)
|
||||
{
|
||||
EISC.SetBool(1111, pressRelease);
|
||||
}
|
||||
|
||||
public void Digit4(bool pressRelease)
|
||||
{
|
||||
EISC.SetBool(1111, pressRelease);
|
||||
}
|
||||
|
||||
public void Digit5(bool pressRelease)
|
||||
{
|
||||
EISC.SetBool(1111, pressRelease);
|
||||
}
|
||||
|
||||
public void Digit6(bool pressRelease)
|
||||
{
|
||||
EISC.SetBool(1111, pressRelease);
|
||||
}
|
||||
|
||||
public void Digit7(bool pressRelease)
|
||||
{
|
||||
EISC.SetBool(1111, pressRelease);
|
||||
}
|
||||
|
||||
public void Digit8(bool pressRelease)
|
||||
{
|
||||
EISC.SetBool(1111, pressRelease);
|
||||
}
|
||||
|
||||
public void Digit9(bool pressRelease)
|
||||
{
|
||||
EISC.SetBool(1111, pressRelease);
|
||||
}
|
||||
|
||||
public bool HasKeypadAccessoryButton1
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public string KeypadAccessoryButton1Label
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public void KeypadAccessoryButton1(bool pressRelease)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool HasKeypadAccessoryButton2
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public string KeypadAccessoryButton2Label
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public void KeypadAccessoryButton2(bool pressRelease)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
845
PepperDashEssentials/AppServer/CotijaSystemController.cs
Normal file
845
PepperDashEssentials/AppServer/CotijaSystemController.cs
Normal file
@@ -0,0 +1,845 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharp.CrestronIO;
|
||||
using Crestron.SimplSharp.Reflection;
|
||||
using Crestron.SimplSharpPro.CrestronThread;
|
||||
using Crestron.SimplSharp.CrestronWebSocketClient;
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharp.Net.Http;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.Room.Cotija;
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
{
|
||||
public class CotijaSystemController : Device
|
||||
{
|
||||
WebSocketClient WSClient;
|
||||
|
||||
//bool LinkUp;
|
||||
|
||||
/// <summary>
|
||||
/// Prevents post operations from stomping on each other and getting lost
|
||||
/// </summary>
|
||||
CEvent PostLockEvent = new CEvent(true, true);
|
||||
|
||||
CEvent RegisterLockEvent = new CEvent(true, true);
|
||||
|
||||
public CotijaConfig Config { get; private set; }
|
||||
|
||||
Dictionary<string, Object> ActionDictionary = new Dictionary<string, Object>(StringComparer.InvariantCultureIgnoreCase);
|
||||
|
||||
Dictionary<string, CTimer> PushedActions = new Dictionary<string, CTimer>();
|
||||
|
||||
CTimer ServerHeartbeatCheckTimer;
|
||||
|
||||
long ServerHeartbeatInterval = 20000;
|
||||
|
||||
CTimer ServerReconnectTimer;
|
||||
|
||||
long ServerReconnectInterval = 5000;
|
||||
|
||||
DateTime LastAckMessage;
|
||||
|
||||
string SystemUuid;
|
||||
|
||||
List<CotijaBridgeBase> RoomBridges = new List<CotijaBridgeBase>();
|
||||
|
||||
long ButtonHeartbeatInterval = 1000;
|
||||
|
||||
/// <summary>
|
||||
/// Used for tracking HTTP debugging
|
||||
/// </summary>
|
||||
bool HttpDebugEnabled;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="config"></param>
|
||||
public CotijaSystemController(string key, string name, CotijaConfig config) : base(key, name)
|
||||
{
|
||||
Config = config;
|
||||
|
||||
SystemUuid = ConfigReader.ConfigObject.SystemUuid;
|
||||
|
||||
Debug.Console(0, this, "Mobile UI controller initializing for server:{0}", config.ServerUrl);
|
||||
|
||||
CrestronConsole.AddNewConsoleCommand(AuthorizeSystem,
|
||||
"mobileauth", "Authorizes system to talk to cotija server", ConsoleAccessLevelEnum.AccessOperator);
|
||||
CrestronConsole.AddNewConsoleCommand(s => ShowInfo(),
|
||||
"mobileinfo", "Shows information for current mobile control session", ConsoleAccessLevelEnum.AccessOperator);
|
||||
CrestronConsole.AddNewConsoleCommand(s => {
|
||||
s = s.Trim();
|
||||
if(!string.IsNullOrEmpty(s))
|
||||
{
|
||||
HttpDebugEnabled = (s.Trim() != "0");
|
||||
}
|
||||
CrestronConsole.ConsoleCommandResponse("HTTP Debug {0}", HttpDebugEnabled ? "Enabled" : "Disabled");
|
||||
},
|
||||
"mobilehttpdebug", "1 enables more verbose HTTP response debugging", ConsoleAccessLevelEnum.AccessOperator);
|
||||
CrestronConsole.AddNewConsoleCommand(TestHttpRequest,
|
||||
"mobilehttprequest", "Tests an HTTP get to URL given", ConsoleAccessLevelEnum.AccessOperator);
|
||||
|
||||
CrestronConsole.AddNewConsoleCommand(PrintActionDictionaryPaths, "mobileshowactionpaths",
|
||||
"Prints the paths in the Action Dictionary", ConsoleAccessLevelEnum.AccessOperator);
|
||||
CrestronConsole.AddNewConsoleCommand(s => ConnectWebsocketClient(), "mobileconnect",
|
||||
"Forces connect of websocket", ConsoleAccessLevelEnum.AccessOperator);
|
||||
CrestronConsole.AddNewConsoleCommand(s => CleanUpWebsocketClient(), "mobiledisco",
|
||||
"Disconnects websocket", ConsoleAccessLevelEnum.AccessOperator);
|
||||
|
||||
CrestronEnvironment.ProgramStatusEventHandler += new ProgramStatusEventHandler(CrestronEnvironment_ProgramStatusEventHandler);
|
||||
CrestronEnvironment.EthernetEventHandler += new EthernetEventHandler(CrestronEnvironment_EthernetEventHandler);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If config rooms is empty or null then go
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override bool CustomActivate()
|
||||
{
|
||||
if (ConfigReader.ConfigObject.Rooms == null || ConfigReader.ConfigObject.Rooms.Count == 0)
|
||||
{
|
||||
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "Config contains no rooms. Registering with Server.");
|
||||
RegisterSystemToServer();
|
||||
}
|
||||
|
||||
return base.CustomActivate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="ethernetEventArgs"></param>
|
||||
void CrestronEnvironment_EthernetEventHandler(EthernetEventArgs args)
|
||||
{
|
||||
Debug.Console(1, this, Debug.ErrorLogLevel.Warning, "Ethernet status change, port {0}: {1}",
|
||||
args.EthernetAdapter, args.EthernetEventType);
|
||||
|
||||
if (args.EthernetEventType == eEthernetEventType.LinkDown && WSClient != null && args.EthernetAdapter == WSClient.EthernetAdapter)
|
||||
{
|
||||
CleanUpWebsocketClient();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sends message to server to indicate the system is shutting down
|
||||
/// </summary>
|
||||
/// <param name="programEventType"></param>
|
||||
void CrestronEnvironment_ProgramStatusEventHandler(eProgramStatusEventType programEventType)
|
||||
{
|
||||
if (programEventType == eProgramStatusEventType.Stopping && WSClient.Connected)
|
||||
{
|
||||
CleanUpWebsocketClient();
|
||||
}
|
||||
}
|
||||
|
||||
public void PrintActionDictionaryPaths(object o)
|
||||
{
|
||||
Debug.Console(0, this, "ActionDictionary Contents:");
|
||||
|
||||
foreach (var item in ActionDictionary)
|
||||
{
|
||||
Debug.Console(0, this, "{0}", item.Key);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds an action to the dictionary
|
||||
/// </summary>
|
||||
/// <param name="key">The path of the API command</param>
|
||||
/// <param name="action">The action to be triggered by the commmand</param>
|
||||
public void AddAction(string key, object action)
|
||||
{
|
||||
if (!ActionDictionary.ContainsKey(key))
|
||||
{
|
||||
ActionDictionary.Add(key, action);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(1, this, "Cannot add action with key '{0}' because key already exists in ActionDictionary.", key);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes an action from the dictionary
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
public void RemoveAction(string key)
|
||||
{
|
||||
if (ActionDictionary.ContainsKey(key))
|
||||
ActionDictionary.Remove(key);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="bridge"></param>
|
||||
public void AddBridge(CotijaBridgeBase bridge)
|
||||
{
|
||||
RoomBridges.Add(bridge);
|
||||
var b = bridge as IDelayedConfiguration;
|
||||
if (b != null)
|
||||
{
|
||||
Debug.Console(0, this, "Adding room bridge with delayed configuration");
|
||||
b.ConfigurationIsReady += new EventHandler<EventArgs>(bridge_ConfigurationIsReady);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(0, this, "Adding room bridge and sending configuration");
|
||||
//SystemUuid = ConfigReader.ConfigObject.SystemUuid;
|
||||
RegisterSystemToServer();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
void bridge_ConfigurationIsReady(object sender, EventArgs e)
|
||||
{
|
||||
Debug.Console(1, this, "Bridge ready. Registering");
|
||||
//SystemUuid = ConfigReader.ConfigObject.SystemUuid;
|
||||
// send the configuration object to the server
|
||||
RegisterSystemToServer();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="o"></param>
|
||||
void ReconnectToServerTimerCallback(object o)
|
||||
{
|
||||
RegisterSystemToServer();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies system connection with servers
|
||||
/// </summary>
|
||||
/// <param name="command"></param>
|
||||
void AuthorizeSystem(string code)
|
||||
{
|
||||
//SystemUuid = ConfigReader.ConfigObject.SystemUuid;
|
||||
|
||||
if (string.IsNullOrEmpty(SystemUuid))
|
||||
{
|
||||
CrestronConsole.ConsoleCommandResponse("System does not have a UUID. Please ensure proper portal-format configuration is loaded and restart.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(code))
|
||||
{
|
||||
CrestronConsole.ConsoleCommandResponse("Please enter a user code to authorize a system");
|
||||
return;
|
||||
}
|
||||
|
||||
var req = new HttpClientRequest();
|
||||
string url = string.Format("http://{0}/api/system/grantcode/{1}/{2}", Config.ServerUrl, code, SystemUuid);
|
||||
Debug.Console(0, this, "Authorizing to: {0}", url);
|
||||
|
||||
if (string.IsNullOrEmpty(Config.ServerUrl))
|
||||
{
|
||||
CrestronConsole.ConsoleCommandResponse("Config URL address is not set. Check portal configuration");
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
req.Url.Parse(url);
|
||||
new HttpClient().DispatchAsync(req, (r, e) =>
|
||||
{
|
||||
CheckHttpDebug(r, e);
|
||||
if (e == HTTP_CALLBACK_ERROR.COMPLETED)
|
||||
{
|
||||
if (r.Code == 200)
|
||||
{
|
||||
Debug.Console(0, "System authorized, sending config.");
|
||||
#warning This registration may need to wait for config ready. Maybe.
|
||||
RegisterSystemToServer();
|
||||
}
|
||||
else if (r.Code == 404)
|
||||
{
|
||||
if (r.ContentString.Contains("codeNotFound"))
|
||||
{
|
||||
Debug.Console(0, "Authorization failed, code not found for system UUID {0}", SystemUuid);
|
||||
}
|
||||
else if (r.ContentString.Contains("uuidNotFound"))
|
||||
{
|
||||
Debug.Console(0, "Authorization failed, uuid {0} not found. Check Essentials configuration is correct",
|
||||
SystemUuid);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
Debug.Console(0, this, "Error {0} in authorizing system", e);
|
||||
});
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Console(0, this, "Error in authorizing: {0}", e);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dumps info in response to console command.
|
||||
/// </summary>
|
||||
void ShowInfo()
|
||||
{
|
||||
var url = Config != null ? Config.ServerUrl : "No config";
|
||||
string name;
|
||||
string code;
|
||||
if (RoomBridges != null && RoomBridges.Count > 0)
|
||||
{
|
||||
name = RoomBridges[0].RoomName;
|
||||
code = RoomBridges[0].UserCode;
|
||||
}
|
||||
else
|
||||
{
|
||||
name = "No config";
|
||||
code = "Not available";
|
||||
}
|
||||
var conn = WSClient == null ? "No client" : (WSClient.Connected ? "Yes" : "No");
|
||||
var secSinceLastAck = DateTime.Now - LastAckMessage;
|
||||
|
||||
|
||||
CrestronConsole.ConsoleCommandResponse(@"Mobile Control Information:
|
||||
Server address: {0}
|
||||
System Name: {1}
|
||||
System UUID: {2}
|
||||
System User code: {3}
|
||||
Connected?: {4}
|
||||
Seconds Since Last Ack: {5}", url, name, SystemUuid,
|
||||
code, conn, secSinceLastAck.Seconds);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registers the room with the server
|
||||
/// </summary>
|
||||
/// <param name="url">URL of the server, including the port number, if not 80. Format: "serverUrlOrIp:port"</param>
|
||||
void RegisterSystemToServer()
|
||||
{
|
||||
ConnectWebsocketClient();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Connects the Websocket Client
|
||||
/// </summary>
|
||||
/// <param name="o"></param>
|
||||
void ConnectWebsocketClient()
|
||||
{
|
||||
|
||||
Debug.Console(1, this, "Initializing Stream client to server.");
|
||||
|
||||
if (WSClient != null)
|
||||
{
|
||||
Debug.Console(1, this, "Cleaning up previous socket");
|
||||
CleanUpWebsocketClient();
|
||||
}
|
||||
|
||||
WSClient = new WebSocketClient();
|
||||
WSClient.URL = string.Format("wss://{0}/system/join/{1}", Config.ServerUrl, this.SystemUuid);
|
||||
WSClient.ConnectionCallBack = Websocket_ConnectCallback;
|
||||
WSClient.ConnectAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="code"></param>
|
||||
/// <returns></returns>
|
||||
int Websocket_ConnectCallback(WebSocketClient.WEBSOCKET_RESULT_CODES code)
|
||||
{
|
||||
if (code == WebSocketClient.WEBSOCKET_RESULT_CODES.WEBSOCKET_CLIENT_SUCCESS)
|
||||
{
|
||||
StopServerReconnectTimer();
|
||||
Debug.Console(1, this, "Websocket connected");
|
||||
WSClient.DisconnectCallBack = Websocket_DisconnectCallback;
|
||||
WSClient.SendCallBack = Websocket_SendCallback;
|
||||
WSClient.ReceiveCallBack = Websocket_ReceiveCallback;
|
||||
WSClient.ReceiveAsync();
|
||||
SendMessageObjectToServer(new
|
||||
{
|
||||
type = "hello"
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
if (code == WebSocketClient.WEBSOCKET_RESULT_CODES.WEBSOCKET_CLIENT_HTTP_HANDSHAKE_TOKEN_ERROR)
|
||||
{
|
||||
// This is the case when app server is running behind a websever and app server is down
|
||||
Debug.Console(1, this, Debug.ErrorLogLevel.Warning, "Web socket connection failed. Check that app server is running behind web server");
|
||||
}
|
||||
else if (code == WebSocketClient.WEBSOCKET_RESULT_CODES.WEBSOCKET_CLIENT_SOCKET_CONNECTION_FAILED)
|
||||
{
|
||||
// this will be the case when webserver is unreachable
|
||||
Debug.Console(1, this, Debug.ErrorLogLevel.Warning, "Web socket connection failed");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(1, this, Debug.ErrorLogLevel.Warning, "Web socket connection failure: {0}", code);
|
||||
}
|
||||
StartServerReconnectTimer();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// After a "hello" from the server, sends config and stuff
|
||||
/// </summary>
|
||||
void SendInitialMessage()
|
||||
{
|
||||
Debug.Console(1, this, "Sending initial join message");
|
||||
var confObject = ConfigReader.ConfigObject;
|
||||
confObject.Info.RuntimeInfo.AppName = Assembly.GetExecutingAssembly().GetName().Name;
|
||||
var version = Assembly.GetExecutingAssembly().GetName().Version;
|
||||
confObject.Info.RuntimeInfo.AssemblyVersion = string.Format("{0}.{1}.{2}", version.Major, version.Minor, version.Build);
|
||||
|
||||
var msg = new
|
||||
{
|
||||
type = "join",
|
||||
content = new
|
||||
{
|
||||
config = confObject
|
||||
}
|
||||
};
|
||||
SendMessageObjectToServer(msg);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sends any object type to server
|
||||
/// </summary>
|
||||
/// <param name="o"></param>
|
||||
public void SendMessageObjectToServer(object o)
|
||||
{
|
||||
SendMessageToServer(JObject.FromObject(o));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sends a message to the server from a room
|
||||
/// </summary>
|
||||
/// <param name="room">room from which the message originates</param>
|
||||
/// <param name="o">object to be serialized and sent in post body</param>
|
||||
public void SendMessageToServer(JObject o)
|
||||
{
|
||||
if (WSClient != null && WSClient.Connected)
|
||||
{
|
||||
string message = JsonConvert.SerializeObject(o, Formatting.None, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
|
||||
|
||||
if (!message.Contains("/system/heartbeat"))
|
||||
Debug.Console(1, this, "Message TX: {0}", message);
|
||||
//else
|
||||
// Debug.Console(1, this, "TX messages contains /system/heartbeat");
|
||||
|
||||
var messageBytes = System.Text.Encoding.UTF8.GetBytes(message);
|
||||
var result = WSClient.Send(messageBytes, (uint)messageBytes.Length, WebSocketClient.WEBSOCKET_PACKET_TYPES.LWS_WS_OPCODE_07__TEXT_FRAME);
|
||||
if (result != WebSocketClient.WEBSOCKET_RESULT_CODES.WEBSOCKET_CLIENT_SUCCESS)
|
||||
{
|
||||
Debug.Console(1, this, "Socket send result error: {0}", result);
|
||||
}
|
||||
}
|
||||
else if (!WSClient.Connected)
|
||||
{
|
||||
Debug.Console(1, this, "Cannot send. Not connected {0}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disconnects the SSE Client and stops the heartbeat timer
|
||||
/// </summary>
|
||||
/// <param name="command"></param>
|
||||
void CleanUpWebsocketClient()
|
||||
{
|
||||
Debug.Console(1, this, "Disconnecting websocket");
|
||||
if (WSClient != null)
|
||||
{
|
||||
WSClient.SendCallBack = null;
|
||||
WSClient.ReceiveCallBack = null;
|
||||
WSClient.ConnectionCallBack = null;
|
||||
WSClient.DisconnectCallBack = null;
|
||||
if (WSClient.Connected)
|
||||
{
|
||||
WSClient.Disconnect();
|
||||
}
|
||||
WSClient = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="dueTime"></param>
|
||||
/// <param name="repeatTime"></param>
|
||||
void StartServerReconnectTimer()
|
||||
{
|
||||
StopServerReconnectTimer();
|
||||
ServerReconnectTimer = new CTimer(ReconnectToServerTimerCallback, ServerReconnectInterval);
|
||||
Debug.Console(1, this, "Reconnect Timer Started.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Does what it says
|
||||
/// </summary>
|
||||
void StopServerReconnectTimer()
|
||||
{
|
||||
if (ServerReconnectTimer != null)
|
||||
{
|
||||
ServerReconnectTimer.Stop();
|
||||
ServerReconnectTimer = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes when we don't get a heartbeat message in time. Triggers reconnect.
|
||||
/// </summary>
|
||||
/// <param name="o">For CTimer callback. Not used</param>
|
||||
void HeartbeatExpiredTimerCallback(object o)
|
||||
{
|
||||
Debug.Console(1, this, "Heartbeat Timer Expired.");
|
||||
if (ServerHeartbeatCheckTimer != null)
|
||||
{
|
||||
ServerHeartbeatCheckTimer.Stop();
|
||||
ServerHeartbeatCheckTimer = null;
|
||||
}
|
||||
CleanUpWebsocketClient();
|
||||
StartServerReconnectTimer();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="dueTime"></param>
|
||||
/// <param name="repeatTime"></param>
|
||||
void ResetOrStartHearbeatTimer()
|
||||
{
|
||||
if (ServerHeartbeatCheckTimer == null)
|
||||
{
|
||||
ServerHeartbeatCheckTimer = new CTimer(HeartbeatExpiredTimerCallback, null, ServerHeartbeatInterval, ServerHeartbeatInterval);
|
||||
Debug.Console(1, this, "Heartbeat Timer Started.");
|
||||
}
|
||||
else
|
||||
{
|
||||
ServerHeartbeatCheckTimer.Reset(ServerHeartbeatInterval, ServerHeartbeatInterval);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Waits two and goes again
|
||||
/// </summary>
|
||||
void ReconnectStreamClient()
|
||||
{
|
||||
new CTimer(o => ConnectWebsocketClient(), 2000);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="code"></param>
|
||||
/// <returns></returns>
|
||||
int Websocket_DisconnectCallback(WebSocketClient.WEBSOCKET_RESULT_CODES code, object o)
|
||||
{
|
||||
Debug.Console(1, this, Debug.ErrorLogLevel.Warning, "Websocket disconnected with code: {0}", code);
|
||||
|
||||
if (ServerHeartbeatCheckTimer != null)
|
||||
ServerHeartbeatCheckTimer.Stop();
|
||||
// Start the reconnect timer
|
||||
StartServerReconnectTimer();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Resets reconnect timer and updates usercode
|
||||
/// </summary>
|
||||
/// <param name="content"></param>
|
||||
void HandleHeartBeat(JToken content)
|
||||
{
|
||||
SendMessageToServer(JObject.FromObject(new
|
||||
{
|
||||
type = "/system/heartbeatAck"
|
||||
}));
|
||||
|
||||
var code = content["userCode"];
|
||||
if(code != null)
|
||||
{
|
||||
foreach (var b in RoomBridges)
|
||||
{
|
||||
b.SetUserCode(code.Value<string>());
|
||||
}
|
||||
}
|
||||
ResetOrStartHearbeatTimer();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Outputs debug info when enabled
|
||||
/// </summary>
|
||||
/// <param name="req"></param>
|
||||
/// <param name="r"></param>
|
||||
/// <param name="e"></param>
|
||||
void CheckHttpDebug(HttpClientResponse r, HTTP_CALLBACK_ERROR e)
|
||||
{
|
||||
if (HttpDebugEnabled)
|
||||
{
|
||||
try
|
||||
{
|
||||
Debug.Console(0, this, "------ Begin HTTP Debug ---------------------------------------");
|
||||
if (r != null)
|
||||
{
|
||||
Debug.Console(0, this, "HTTP Response URL: {0}", r.ResponseUrl != null ? r.ResponseUrl.ToString() : "NONE");
|
||||
Debug.Console(0, this, "HTTP Response code: {0}", r.Code);
|
||||
Debug.Console(0, this, "HTTP Response content: \r{0}", r.ContentString);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(0, this, "No HTTP response");
|
||||
}
|
||||
Debug.Console(0, this, "HTTP Response 'error' {0}", e);
|
||||
Debug.Console(0, this, "------ End HTTP Debug -----------------------------------------");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.Console(0, this, "HttpDebugError: {0}", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <param name="length"></param>
|
||||
/// <param name="opcode"></param>
|
||||
/// <param name="err"></param>
|
||||
int Websocket_ReceiveCallback(byte[] data, uint length, WebSocketClient.WEBSOCKET_PACKET_TYPES opcode,
|
||||
WebSocketClient.WEBSOCKET_RESULT_CODES err)
|
||||
{
|
||||
if (opcode == WebSocketClient.WEBSOCKET_PACKET_TYPES.LWS_WS_OPCODE_07__TEXT_FRAME)
|
||||
{
|
||||
var rx = System.Text.Encoding.UTF8.GetString(data, 0, (int)length);
|
||||
if (rx.Length > 0)
|
||||
ParseStreamRx(rx);
|
||||
WSClient.ReceiveAsync();
|
||||
}
|
||||
|
||||
else if (opcode == WebSocketClient.WEBSOCKET_PACKET_TYPES.LWS_WS_OPCODE_07__CLOSE)
|
||||
{
|
||||
Debug.Console(1, this, "Websocket disconnect received from remote");
|
||||
CleanUpWebsocketClient();
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(1, this, "websocket rx opcode/err {0}/{1}", opcode, err);
|
||||
WSClient.ReceiveAsync();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Callback to catch possible errors in sending via the websocket
|
||||
/// </summary>
|
||||
/// <param name="result"></param>
|
||||
/// <returns></returns>
|
||||
int Websocket_SendCallback(Crestron.SimplSharp.CrestronWebSocketClient.WebSocketClient.WEBSOCKET_RESULT_CODES result)
|
||||
{
|
||||
if(result != WebSocketClient.WEBSOCKET_RESULT_CODES.WEBSOCKET_CLIENT_SUCCESS)
|
||||
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "SendCallback questionable result: {0}", result);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
void ParseStreamRx(string message)
|
||||
{
|
||||
if(string.IsNullOrEmpty(message))
|
||||
return;
|
||||
|
||||
if (!message.Contains("/system/heartbeat"))
|
||||
Debug.Console(1, this, "Message RX: {0}", message);
|
||||
else
|
||||
{
|
||||
LastAckMessage = DateTime.Now;
|
||||
//Debug.Console(1, this, "RX message contains /system/heartbeat");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var messageObj = JObject.Parse(message);
|
||||
|
||||
var type = messageObj["type"].Value<string>();
|
||||
|
||||
if (type == "hello")
|
||||
{
|
||||
SendInitialMessage();
|
||||
ResetOrStartHearbeatTimer();
|
||||
}
|
||||
else if (type == "/system/heartbeat")
|
||||
{
|
||||
HandleHeartBeat(messageObj["content"]);
|
||||
}
|
||||
else if (type == "close")
|
||||
{
|
||||
Debug.Console(1, this, "Received close message from server.");
|
||||
// DisconnectWebsocketClient();
|
||||
|
||||
if (ServerHeartbeatCheckTimer != null)
|
||||
ServerHeartbeatCheckTimer.Stop();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Check path against Action dictionary
|
||||
if (ActionDictionary.ContainsKey(type))
|
||||
{
|
||||
var action = ActionDictionary[type];
|
||||
|
||||
if (action is Action)
|
||||
{
|
||||
(action as Action)();
|
||||
}
|
||||
else if (action is PressAndHoldAction)
|
||||
{
|
||||
var stateString = messageObj["content"]["state"].Value<string>();
|
||||
|
||||
// Look for a button press event
|
||||
if (!string.IsNullOrEmpty(stateString))
|
||||
{
|
||||
switch (stateString)
|
||||
{
|
||||
case "true":
|
||||
{
|
||||
if (!PushedActions.ContainsKey(type))
|
||||
{
|
||||
PushedActions.Add(type, new CTimer(o =>
|
||||
{
|
||||
(action as PressAndHoldAction)(false);
|
||||
PushedActions.Remove(type);
|
||||
}, null, ButtonHeartbeatInterval, ButtonHeartbeatInterval));
|
||||
}
|
||||
// Maybe add an else to reset the timer
|
||||
break;
|
||||
}
|
||||
case "held":
|
||||
{
|
||||
if (PushedActions.ContainsKey(type))
|
||||
{
|
||||
PushedActions[type].Reset(ButtonHeartbeatInterval, ButtonHeartbeatInterval);
|
||||
}
|
||||
return;
|
||||
}
|
||||
case "false":
|
||||
{
|
||||
if (PushedActions.ContainsKey(type))
|
||||
{
|
||||
PushedActions[type].Stop();
|
||||
PushedActions.Remove(type);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
(action as PressAndHoldAction)(stateString == "true");
|
||||
}
|
||||
}
|
||||
else if (action is Action<bool>)
|
||||
{
|
||||
var stateString = messageObj["content"]["state"].Value<string>();
|
||||
|
||||
if (!string.IsNullOrEmpty(stateString))
|
||||
{
|
||||
(action as Action<bool>)(stateString == "true");
|
||||
}
|
||||
}
|
||||
else if (action is Action<ushort>)
|
||||
{
|
||||
(action as Action<ushort>)(messageObj["content"]["value"].Value<ushort>());
|
||||
}
|
||||
else if (action is Action<string>)
|
||||
{
|
||||
(action as Action<string>)(messageObj["content"]["value"].Value<string>());
|
||||
}
|
||||
else if (action is Action<SourceSelectMessageContent>)
|
||||
{
|
||||
(action as Action<SourceSelectMessageContent>)(messageObj["content"]
|
||||
.ToObject<SourceSelectMessageContent>());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(1, this, "-- Warning: Incoming message has no registered handler");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
//Debug.Console(1, "SseMessageLengthBeforeFailureCount: {0}", SseMessageLengthBeforeFailureCount);
|
||||
//SseMessageLengthBeforeFailureCount = 0;
|
||||
Debug.Console(1, this, "Unable to parse message: {0}", err);
|
||||
}
|
||||
}
|
||||
|
||||
void TestHttpRequest(string s)
|
||||
{
|
||||
{
|
||||
s = s.Trim();
|
||||
if (string.IsNullOrEmpty(s))
|
||||
{
|
||||
PrintTestHttpRequestUsage();
|
||||
return;
|
||||
}
|
||||
var tokens = s.Split(' ');
|
||||
if (tokens.Length < 2)
|
||||
{
|
||||
CrestronConsole.ConsoleCommandResponse("Too few paramaters\r");
|
||||
PrintTestHttpRequestUsage();
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var url = tokens[1];
|
||||
if (tokens[0].ToLower() == "get")
|
||||
{
|
||||
var resp = new HttpClient().Get(url);
|
||||
CrestronConsole.ConsoleCommandResponse("RESPONSE:\r{0}\r\r", resp);
|
||||
}
|
||||
else if (tokens[0].ToLower() == "post")
|
||||
{
|
||||
var resp = new HttpClient().Post(url, new byte[] { });
|
||||
CrestronConsole.ConsoleCommandResponse("RESPONSE:\r{0}\r\r", resp);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
CrestronConsole.ConsoleCommandResponse("Only get or post supported\r");
|
||||
PrintTestHttpRequestUsage();
|
||||
}
|
||||
}
|
||||
catch (HttpException e)
|
||||
{
|
||||
CrestronConsole.ConsoleCommandResponse("Exception in request:\r");
|
||||
CrestronConsole.ConsoleCommandResponse("Response URL: {0}\r", e.Response.ResponseUrl);
|
||||
CrestronConsole.ConsoleCommandResponse("Response Error Code: {0}\r", e.Response.Code);
|
||||
CrestronConsole.ConsoleCommandResponse("Response body: {0}\r", e.Response.ContentString);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void PrintTestHttpRequestUsage()
|
||||
{
|
||||
CrestronConsole.ConsoleCommandResponse("Usage: mobilehttprequest:N get/post url\r");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Room.Cotija
|
||||
{
|
||||
public static class IChannelExtensions
|
||||
{
|
||||
public static void LinkActions(this IChannel dev, CotijaSystemController controller)
|
||||
{
|
||||
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
|
||||
|
||||
controller.AddAction(prefix + "chanUp", new PressAndHoldAction(dev.ChannelUp));
|
||||
controller.AddAction(prefix + "chanDown", new PressAndHoldAction(dev.ChannelDown));
|
||||
controller.AddAction(prefix + "lastChan", new PressAndHoldAction(dev.LastChannel));
|
||||
controller.AddAction(prefix + "guide", new PressAndHoldAction(dev.Guide));
|
||||
controller.AddAction(prefix + "info", new PressAndHoldAction(dev.Info));
|
||||
controller.AddAction(prefix + "exit", new PressAndHoldAction(dev.Exit));
|
||||
}
|
||||
|
||||
public static void UnlinkActions(this IChannel dev, CotijaSystemController controller)
|
||||
{
|
||||
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
|
||||
|
||||
controller.RemoveAction(prefix + "chanUp");
|
||||
controller.RemoveAction(prefix + "chanDown");
|
||||
controller.RemoveAction(prefix + "lastChan");
|
||||
controller.RemoveAction(prefix + "guide");
|
||||
controller.RemoveAction(prefix + "info");
|
||||
controller.RemoveAction(prefix + "exit");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Room.Cotija
|
||||
{
|
||||
public static class IColorExtensions
|
||||
{
|
||||
public static void LinkActions(this IColor dev, CotijaSystemController controller)
|
||||
{
|
||||
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
|
||||
|
||||
controller.AddAction(prefix + "red", new PressAndHoldAction(dev.Red));
|
||||
controller.AddAction(prefix + "green", new PressAndHoldAction(dev.Green));
|
||||
controller.AddAction(prefix + "yellow", new PressAndHoldAction(dev.Yellow));
|
||||
controller.AddAction(prefix + "blue", new PressAndHoldAction(dev.Blue));
|
||||
}
|
||||
|
||||
public static void UnlinkActions(this IColor dev, CotijaSystemController controller)
|
||||
{
|
||||
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
|
||||
|
||||
controller.RemoveAction(prefix + "red");
|
||||
controller.RemoveAction(prefix + "green");
|
||||
controller.RemoveAction(prefix + "yellow");
|
||||
controller.RemoveAction(prefix + "blue");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Room.Cotija
|
||||
{
|
||||
public static class IDPadExtensions
|
||||
{
|
||||
public static void LinkActions(this IDPad dev, CotijaSystemController controller)
|
||||
{
|
||||
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
|
||||
|
||||
controller.AddAction(prefix + "up", new PressAndHoldAction(dev.Up));
|
||||
controller.AddAction(prefix + "down", new PressAndHoldAction(dev.Down));
|
||||
controller.AddAction(prefix + "left", new PressAndHoldAction(dev.Left));
|
||||
controller.AddAction(prefix + "right", new PressAndHoldAction(dev.Right));
|
||||
controller.AddAction(prefix + "select", new PressAndHoldAction(dev.Select));
|
||||
controller.AddAction(prefix + "menu", new PressAndHoldAction(dev.Menu));
|
||||
controller.AddAction(prefix + "exit", new PressAndHoldAction(dev.Exit));
|
||||
}
|
||||
|
||||
public static void UnlinkActions(this IDPad dev, CotijaSystemController controller)
|
||||
{
|
||||
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
|
||||
|
||||
controller.RemoveAction(prefix + "up");
|
||||
controller.RemoveAction(prefix + "down");
|
||||
controller.RemoveAction(prefix + "left");
|
||||
controller.RemoveAction(prefix + "right");
|
||||
controller.RemoveAction(prefix + "select");
|
||||
controller.RemoveAction(prefix + "menu");
|
||||
controller.RemoveAction(prefix + "exit");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Room.Cotija
|
||||
{
|
||||
public static class IDvrExtensions
|
||||
{
|
||||
public static void LinkActions(this IDvr dev, CotijaSystemController controller)
|
||||
{
|
||||
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
|
||||
|
||||
controller.AddAction(prefix + "dvrlist", new PressAndHoldAction(dev.DvrList));
|
||||
controller.AddAction(prefix + "record", new PressAndHoldAction(dev.Record));
|
||||
}
|
||||
|
||||
public static void UnlinkActions(this IDvr dev, CotijaSystemController controller)
|
||||
{
|
||||
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
|
||||
|
||||
controller.RemoveAction(prefix + "dvrlist");
|
||||
controller.RemoveAction(prefix + "record");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Room.Cotija
|
||||
{
|
||||
public static class INumericExtensions
|
||||
{
|
||||
public static void LinkActions(this INumericKeypad dev, CotijaSystemController controller)
|
||||
{
|
||||
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
|
||||
|
||||
controller.AddAction(prefix + "num0", new PressAndHoldAction(dev.Digit0));
|
||||
controller.AddAction(prefix + "num1", new PressAndHoldAction(dev.Digit1));
|
||||
controller.AddAction(prefix + "num2", new PressAndHoldAction(dev.Digit2));
|
||||
controller.AddAction(prefix + "num3", new PressAndHoldAction(dev.Digit3));
|
||||
controller.AddAction(prefix + "num4", new PressAndHoldAction(dev.Digit4));
|
||||
controller.AddAction(prefix + "num5", new PressAndHoldAction(dev.Digit5));
|
||||
controller.AddAction(prefix + "num6", new PressAndHoldAction(dev.Digit6));
|
||||
controller.AddAction(prefix + "num7", new PressAndHoldAction(dev.Digit0));
|
||||
controller.AddAction(prefix + "num8", new PressAndHoldAction(dev.Digit0));
|
||||
controller.AddAction(prefix + "num9", new PressAndHoldAction(dev.Digit0));
|
||||
controller.AddAction(prefix + "numDash", new PressAndHoldAction(dev.KeypadAccessoryButton1));
|
||||
controller.AddAction(prefix + "numEnter", new PressAndHoldAction(dev.KeypadAccessoryButton2));
|
||||
// Deal with the Accessory functions on the numpad later
|
||||
}
|
||||
|
||||
public static void UnlinkActions(this INumericKeypad dev, CotijaSystemController controller)
|
||||
{
|
||||
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
|
||||
|
||||
controller.RemoveAction(prefix + "num0");
|
||||
controller.RemoveAction(prefix + "num1");
|
||||
controller.RemoveAction(prefix + "num2");
|
||||
controller.RemoveAction(prefix + "num3");
|
||||
controller.RemoveAction(prefix + "num4");
|
||||
controller.RemoveAction(prefix + "num5");
|
||||
controller.RemoveAction(prefix + "num6");
|
||||
controller.RemoveAction(prefix + "num7");
|
||||
controller.RemoveAction(prefix + "num8");
|
||||
controller.RemoveAction(prefix + "num9");
|
||||
controller.RemoveAction(prefix + "numDash");
|
||||
controller.RemoveAction(prefix + "numEnter");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Room.Cotija
|
||||
{
|
||||
public static class IPowerExtensions
|
||||
{
|
||||
public static void LinkActions(this IPower dev, CotijaSystemController controller)
|
||||
{
|
||||
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
|
||||
|
||||
controller.AddAction(prefix + "powerOn", new Action(dev.PowerOn));
|
||||
controller.AddAction(prefix + "powerOff", new Action(dev.PowerOff));
|
||||
controller.AddAction(prefix + "powerToggle", new Action(dev.PowerToggle));
|
||||
}
|
||||
|
||||
public static void UnlinkActions(this IPower dev, CotijaSystemController controller)
|
||||
{
|
||||
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
|
||||
|
||||
controller.RemoveAction(prefix + "powerOn");
|
||||
controller.RemoveAction(prefix + "powerOff");
|
||||
controller.RemoveAction(prefix + "powerToggle");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Room.Cotija
|
||||
{
|
||||
public static class ISetTopBoxControlsExtensions
|
||||
{
|
||||
public static void LinkActions(this ISetTopBoxControls dev, CotijaSystemController controller)
|
||||
{
|
||||
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
|
||||
|
||||
controller.AddAction(prefix + "dvrList", new PressAndHoldAction(dev.DvrList));
|
||||
controller.AddAction(prefix + "replay", new PressAndHoldAction(dev.Replay));
|
||||
}
|
||||
|
||||
public static void UnlinkActions(this ISetTopBoxControls dev, CotijaSystemController controller)
|
||||
{
|
||||
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
|
||||
|
||||
controller.RemoveAction(prefix + "dvrList");
|
||||
controller.RemoveAction(prefix + "replay");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Room.Cotija
|
||||
{
|
||||
public static class ITransportExtensions
|
||||
{
|
||||
public static void LinkActions(this ITransport dev, CotijaSystemController controller)
|
||||
{
|
||||
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
|
||||
|
||||
controller.AddAction(prefix + "play", new PressAndHoldAction(dev.Play));
|
||||
controller.AddAction(prefix + "pause", new PressAndHoldAction(dev.Pause));
|
||||
controller.AddAction(prefix + "stop", new PressAndHoldAction(dev.Stop));
|
||||
controller.AddAction(prefix + "prevTrack", new PressAndHoldAction(dev.ChapPlus));
|
||||
controller.AddAction(prefix + "nextTrack", new PressAndHoldAction(dev.ChapMinus));
|
||||
controller.AddAction(prefix + "rewind", new PressAndHoldAction(dev.Rewind));
|
||||
controller.AddAction(prefix + "ffwd", new PressAndHoldAction(dev.FFwd));
|
||||
controller.AddAction(prefix + "record", new PressAndHoldAction(dev.Record));
|
||||
}
|
||||
|
||||
public static void UnlinkActions(this ITransport dev, CotijaSystemController controller)
|
||||
{
|
||||
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
|
||||
|
||||
controller.RemoveAction(prefix + "play");
|
||||
controller.RemoveAction(prefix + "pause");
|
||||
controller.RemoveAction(prefix + "stop");
|
||||
controller.RemoveAction(prefix + "prevTrack");
|
||||
controller.RemoveAction(prefix + "nextTrack");
|
||||
controller.RemoveAction(prefix + "rewind");
|
||||
controller.RemoveAction(prefix + "ffwd");
|
||||
controller.RemoveAction(prefix + "record");
|
||||
}
|
||||
}
|
||||
}
|
||||
60
PepperDashEssentials/AppServer/Interfaces.cs
Normal file
60
PepperDashEssentials/AppServer/Interfaces.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Room.Cotija
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a room whose configuration is derived from runtime data,
|
||||
/// perhaps from another program, and that the data may not be fully
|
||||
/// available at startup.
|
||||
/// </summary>
|
||||
public interface IDelayedConfiguration
|
||||
{
|
||||
event EventHandler<EventArgs> ConfigurationIsReady;
|
||||
}
|
||||
}
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
{
|
||||
/// <summary>
|
||||
/// For rooms with a single presentation source, change event
|
||||
/// </summary>
|
||||
public interface IHasCurrentSourceInfoChange
|
||||
{
|
||||
string CurrentSourceInfoKey { get; }
|
||||
SourceListItem CurrentSourceInfo { get; }
|
||||
event SourceInfoChangeHandler CurrentSingleSourceChange;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// For rooms with routing
|
||||
/// </summary>
|
||||
public interface IRunRouteAction
|
||||
{
|
||||
void RunRouteAction(string routeKey);
|
||||
|
||||
void RunRouteAction(string routeKey, Action successCallback);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// For rooms that default presentation only routing
|
||||
/// </summary>
|
||||
public interface IRunDefaultPresentRoute
|
||||
{
|
||||
bool RunDefaultPresentRoute();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// For rooms that have default presentation and calling routes
|
||||
/// </summary>
|
||||
public interface IRunDefaultCallRoute : IRunDefaultPresentRoute
|
||||
{
|
||||
bool RunDefaultCallRoute();
|
||||
}
|
||||
}
|
||||
187
PepperDashEssentials/AppServer/Messengers/AtcDdvc01Messenger.cs
Normal file
187
PepperDashEssentials/AppServer/Messengers/AtcDdvc01Messenger.cs
Normal file
@@ -0,0 +1,187 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using Crestron.SimplSharpPro.EthernetCommunication;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Devices.Common.Codec;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
public class Ddvc01AtcMessenger : MessengerBase
|
||||
{
|
||||
BasicTriList EISC;
|
||||
|
||||
const uint BDialHangup = 221;
|
||||
const uint BIncomingAnswer = 251;
|
||||
const uint BIncomingReject = 252;
|
||||
const uint BSpeedDial1 = 241;
|
||||
const uint BSpeedDial2 = 242;
|
||||
const uint BSpeedDial3 = 243;
|
||||
const uint BSpeedDial4 = 244;
|
||||
|
||||
/// <summary>
|
||||
/// 201
|
||||
/// </summary>
|
||||
const uint SCurrentDialString = 201;
|
||||
/// <summary>
|
||||
/// 211
|
||||
/// </summary>
|
||||
const uint SCurrentCallNumber = 211;
|
||||
/// <summary>
|
||||
/// 212
|
||||
/// </summary>
|
||||
const uint SCurrentCallName = 212;
|
||||
/// <summary>
|
||||
/// 221
|
||||
/// </summary>
|
||||
const uint SHookState = 221;
|
||||
/// <summary>
|
||||
/// 222
|
||||
/// </summary>
|
||||
const uint SCallDirection = 222;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
Dictionary<string, uint> DTMFMap = new Dictionary<string, uint>
|
||||
{
|
||||
{ "1", 201 },
|
||||
{ "2", 202 },
|
||||
{ "3", 203 },
|
||||
{ "4", 204 },
|
||||
{ "5", 205 },
|
||||
{ "6", 206 },
|
||||
{ "7", 207 },
|
||||
{ "8", 208 },
|
||||
{ "9", 209 },
|
||||
{ "0", 210 },
|
||||
{ "*", 211 },
|
||||
{ "#", 212 },
|
||||
};
|
||||
|
||||
CodecActiveCallItem CurrentCallItem;
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="eisc"></param>
|
||||
/// <param name="messagePath"></param>
|
||||
public Ddvc01AtcMessenger(string key, BasicTriList eisc, string messagePath)
|
||||
: base(key, messagePath)
|
||||
{
|
||||
EISC = eisc;
|
||||
|
||||
CurrentCallItem = new CodecActiveCallItem();
|
||||
CurrentCallItem.Type = eCodecCallType.Audio;
|
||||
CurrentCallItem.Id = "-audio-";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void SendFullStatus()
|
||||
{
|
||||
|
||||
|
||||
this.PostStatusMessage(new
|
||||
{
|
||||
calls = GetCurrentCallList(),
|
||||
currentCallString = EISC.GetString(SCurrentCallNumber),
|
||||
currentDialString = EISC.GetString(SCurrentDialString),
|
||||
isInCall = EISC.GetString(SHookState) == "Connected"
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="appServerController"></param>
|
||||
protected override void CustomRegisterWithAppServer(CotijaSystemController appServerController)
|
||||
{
|
||||
//EISC.SetStringSigAction(SCurrentDialString, s => PostStatusMessage(new { currentDialString = s }));
|
||||
|
||||
EISC.SetStringSigAction(SHookState, s =>
|
||||
{
|
||||
CurrentCallItem.Status = (eCodecCallStatus)Enum.Parse(typeof(eCodecCallStatus), s, true);
|
||||
//GetCurrentCallList();
|
||||
SendCallsList();
|
||||
});
|
||||
|
||||
EISC.SetStringSigAction(SCurrentCallNumber, s =>
|
||||
{
|
||||
CurrentCallItem.Number = s;
|
||||
SendCallsList();
|
||||
});
|
||||
|
||||
EISC.SetStringSigAction(SCurrentCallName, s =>
|
||||
{
|
||||
CurrentCallItem.Name = s;
|
||||
SendCallsList();
|
||||
});
|
||||
|
||||
EISC.SetStringSigAction(SCallDirection, s =>
|
||||
{
|
||||
CurrentCallItem.Direction = (eCodecCallDirection)Enum.Parse(typeof(eCodecCallDirection), s, true);
|
||||
SendCallsList();
|
||||
});
|
||||
|
||||
// Add press and holds using helper
|
||||
Action<string, uint> addPHAction = (s, u) =>
|
||||
AppServerController.AddAction(MessagePath + s, new PressAndHoldAction(b => EISC.SetBool(u, b)));
|
||||
|
||||
// Add straight pulse calls
|
||||
Action<string, uint> addAction = (s, u) =>
|
||||
AppServerController.AddAction(MessagePath + s, new Action(() => EISC.PulseBool(u, 100)));
|
||||
addAction("/endCallById", BDialHangup);
|
||||
addAction("/acceptById", BIncomingAnswer);
|
||||
addAction("/rejectById", BIncomingReject);
|
||||
addAction("/speedDial1", BSpeedDial1);
|
||||
addAction("/speedDial2", BSpeedDial2);
|
||||
addAction("/speedDial3", BSpeedDial3);
|
||||
addAction("/speedDial4", BSpeedDial4);
|
||||
|
||||
// Get status
|
||||
AppServerController.AddAction(MessagePath + "/fullStatus", new Action(SendFullStatus));
|
||||
// Dial on string
|
||||
AppServerController.AddAction(MessagePath + "/dial", new Action<string>(s => EISC.SetString(SCurrentDialString, s)));
|
||||
// Pulse DTMF
|
||||
AppServerController.AddAction(MessagePath + "/dtmf", new Action<string>(s =>
|
||||
{
|
||||
if (DTMFMap.ContainsKey(s))
|
||||
{
|
||||
EISC.PulseBool(DTMFMap[s], 100);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
void SendCallsList()
|
||||
{
|
||||
PostStatusMessage(new
|
||||
{
|
||||
calls = GetCurrentCallList(),
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Turns the
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
List<CodecActiveCallItem> GetCurrentCallList()
|
||||
{
|
||||
if (CurrentCallItem.Status == eCodecCallStatus.Disconnected)
|
||||
{
|
||||
return new List<CodecActiveCallItem>();
|
||||
}
|
||||
else
|
||||
{
|
||||
return new List<CodecActiveCallItem>() { CurrentCallItem };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
using PepperDash.Essentials.Devices.Common.Codec;
|
||||
using PepperDash.Essentials.Devices.Common.AudioCodec;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides a messaging bridge for an AudioCodecBase device
|
||||
/// </summary>
|
||||
public class AudioCodecBaseMessenger : MessengerBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Device being bridged
|
||||
/// </summary>
|
||||
public AudioCodecBase Codec { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Constuctor
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="codec"></param>
|
||||
/// <param name="messagePath"></param>
|
||||
public AudioCodecBaseMessenger(string key, AudioCodecBase codec, string messagePath)
|
||||
: base(key, messagePath)
|
||||
{
|
||||
if (codec == null)
|
||||
throw new ArgumentNullException("codec");
|
||||
|
||||
Codec = codec;
|
||||
codec.CallStatusChange += new EventHandler<CodecCallStatusItemChangeEventArgs>(codec_CallStatusChange);
|
||||
|
||||
}
|
||||
|
||||
protected override void CustomRegisterWithAppServer(CotijaSystemController appServerController)
|
||||
{
|
||||
appServerController.AddAction(MessagePath + "/fullStatus", new Action(SendAtcFullMessageObject));
|
||||
appServerController.AddAction(MessagePath + "/dial", new Action<string>(s => Codec.Dial(s)));
|
||||
appServerController.AddAction(MessagePath + "/endCallById", new Action<string>(s =>
|
||||
{
|
||||
var call = GetCallWithId(s);
|
||||
if (call != null)
|
||||
Codec.EndCall(call);
|
||||
}));
|
||||
appServerController.AddAction(MessagePath + "/endAllCalls", new Action(Codec.EndAllCalls));
|
||||
appServerController.AddAction(MessagePath + "/dtmf", new Action<string>(s => Codec.SendDtmf(s)));
|
||||
appServerController.AddAction(MessagePath + "/rejectById", new Action<string>(s =>
|
||||
{
|
||||
var call = GetCallWithId(s);
|
||||
if (call != null)
|
||||
Codec.RejectCall(call);
|
||||
}));
|
||||
appServerController.AddAction(MessagePath + "/acceptById", new Action<string>(s =>
|
||||
{
|
||||
var call = GetCallWithId(s);
|
||||
if (call != null)
|
||||
Codec.AcceptCall(call);
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper to grab a call with string ID
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
CodecActiveCallItem GetCallWithId(string id)
|
||||
{
|
||||
return Codec.ActiveCalls.FirstOrDefault(c => c.Id == id);
|
||||
}
|
||||
|
||||
void codec_CallStatusChange(object sender, CodecCallStatusItemChangeEventArgs e)
|
||||
{
|
||||
SendAtcFullMessageObject();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper method to build call status for vtc
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
void SendAtcFullMessageObject()
|
||||
{
|
||||
|
||||
var info = Codec.CodecInfo;
|
||||
PostStatusMessage(new
|
||||
{
|
||||
isInCall = Codec.IsInCall,
|
||||
calls = Codec.ActiveCalls,
|
||||
info = new
|
||||
{
|
||||
phoneNumber = info.PhoneNumber
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
81
PepperDashEssentials/AppServer/Messengers/MessengerBase.cs
Normal file
81
PepperDashEssentials/AppServer/Messengers/MessengerBase.cs
Normal file
@@ -0,0 +1,81 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
using PepperDash.Core;
|
||||
|
||||
using PepperDash.Essentials.Devices.Common.Codec;
|
||||
using PepperDash.Essentials.Devices.Common.VideoCodec;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides a messaging bridge for a VideoCodecBase
|
||||
/// </summary>
|
||||
public abstract class MessengerBase : IKeyed
|
||||
{
|
||||
public string Key { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public CotijaSystemController AppServerController { get; private set; }
|
||||
|
||||
public string MessagePath { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="codec"></param>
|
||||
public MessengerBase(string key, string messagePath)
|
||||
{
|
||||
Key = key;
|
||||
|
||||
if (string.IsNullOrEmpty(messagePath))
|
||||
throw new ArgumentException("messagePath must not be empty or null");
|
||||
|
||||
MessagePath = messagePath;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Registers this messenger with appserver controller
|
||||
/// </summary>
|
||||
/// <param name="appServerController"></param>
|
||||
public void RegisterWithAppServer(CotijaSystemController appServerController)
|
||||
{
|
||||
if (appServerController == null)
|
||||
throw new ArgumentNullException("appServerController");
|
||||
|
||||
AppServerController = appServerController;
|
||||
CustomRegisterWithAppServer(AppServerController);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Implemented in extending classes. Wire up API calls and feedback here
|
||||
/// </summary>
|
||||
/// <param name="appServerController"></param>
|
||||
abstract protected void CustomRegisterWithAppServer(CotijaSystemController appServerController);
|
||||
|
||||
/// <summary>
|
||||
/// Helper for posting status message
|
||||
/// </summary>
|
||||
/// <param name="contentObject">The contents of the content object</param>
|
||||
protected void PostStatusMessage(object contentObject)
|
||||
{
|
||||
if (AppServerController != null)
|
||||
{
|
||||
AppServerController.SendMessageToServer(JObject.FromObject(new
|
||||
{
|
||||
type = MessagePath,
|
||||
content = contentObject
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.Monitoring;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
public class SystemMonitorMessenger : MessengerBase
|
||||
{
|
||||
public SystemMonitorController SysMon { get; private set; }
|
||||
|
||||
public SystemMonitorMessenger(string key, SystemMonitorController sysMon, string messagePath)
|
||||
: base(key, messagePath)
|
||||
{
|
||||
if (sysMon == null)
|
||||
throw new ArgumentNullException("sysMon");
|
||||
|
||||
SysMon = sysMon;
|
||||
|
||||
SysMon.SystemMonitorPropertiesChanged += new EventHandler<EventArgs>(SysMon_SystemMonitorPropertiesChanged);
|
||||
|
||||
foreach (var p in SysMon.ProgramStatusFeedbackCollection)
|
||||
{
|
||||
p.Value.ProgramInfoChanged += new EventHandler<ProgramInfoEventArgs>(ProgramInfoChanged);
|
||||
}
|
||||
|
||||
CrestronConsole.AddNewConsoleCommand(s => SendFullStatusMessage(), "SendFullSysMonStatus", "Sends the full System Monitor Status", ConsoleAccessLevelEnum.AccessOperator);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Posts the program information message
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
void ProgramInfoChanged(object sender, ProgramInfoEventArgs e)
|
||||
{
|
||||
Debug.Console(1, "Posting Status Message: {0}", e.ProgramInfo.ToString());
|
||||
PostStatusMessage(e.ProgramInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Posts the system monitor properties
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
void SysMon_SystemMonitorPropertiesChanged(object sender, EventArgs e)
|
||||
{
|
||||
SendSystemMonitorStatusMessage();
|
||||
}
|
||||
|
||||
void SendFullStatusMessage()
|
||||
{
|
||||
SendSystemMonitorStatusMessage();
|
||||
|
||||
foreach (var p in SysMon.ProgramStatusFeedbackCollection)
|
||||
{
|
||||
PostStatusMessage(p.Value.ProgramInfo);
|
||||
}
|
||||
}
|
||||
|
||||
void SendSystemMonitorStatusMessage()
|
||||
{
|
||||
Debug.Console(1, "Posting System Monitor Status Message.");
|
||||
|
||||
// This takes a while, launch a new thread
|
||||
CrestronInvoke.BeginInvoke((o) =>
|
||||
{
|
||||
PostStatusMessage(new
|
||||
{
|
||||
timeZone = SysMon.TimeZoneFeedback.IntValue,
|
||||
timeZoneName = SysMon.TimeZoneTextFeedback.StringValue,
|
||||
ioControllerVersion = SysMon.IOControllerVersionFeedback.StringValue,
|
||||
snmpVersion = SysMon.SnmpVersionFeedback.StringValue,
|
||||
bacnetVersion = SysMon.BACnetAppVersionFeedback.StringValue,
|
||||
controllerVersion = SysMon.ControllerVersionFeedback.StringValue
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
protected override void CustomRegisterWithAppServer(CotijaSystemController appServerController)
|
||||
{
|
||||
AppServerController.AddAction(MessagePath + "/fullStatus", new Action(SendFullStatusMessage));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,279 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
using PepperDash.Essentials.Devices.Common.Codec;
|
||||
using PepperDash.Essentials.Devices.Common.VideoCodec;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides a messaging bridge for a VideoCodecBase device
|
||||
/// </summary>
|
||||
public class VideoCodecBaseMessenger : MessengerBase
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public VideoCodecBase Codec { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="codec"></param>
|
||||
public VideoCodecBaseMessenger(string key, VideoCodecBase codec, string messagePath)
|
||||
: base(key, messagePath)
|
||||
{
|
||||
if (codec == null)
|
||||
throw new ArgumentNullException("codec");
|
||||
|
||||
Codec = codec;
|
||||
codec.CallStatusChange += new EventHandler<CodecCallStatusItemChangeEventArgs>(codec_CallStatusChange);
|
||||
codec.IsReadyChange += new EventHandler<EventArgs>(codec_IsReadyChange);
|
||||
|
||||
var dirCodec = codec as IHasDirectory;
|
||||
if (dirCodec != null)
|
||||
{
|
||||
dirCodec.DirectoryResultReturned += new EventHandler<DirectoryEventArgs>(dirCodec_DirectoryResultReturned);
|
||||
}
|
||||
|
||||
var recCodec = codec as IHasCallHistory;
|
||||
if (recCodec != null)
|
||||
{
|
||||
recCodec.CallHistory.RecentCallsListHasChanged += new EventHandler<EventArgs>(CallHistory_RecentCallsListHasChanged);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
void CallHistory_RecentCallsListHasChanged(object sender, EventArgs e)
|
||||
{
|
||||
var recents = (sender as CodecCallHistory).RecentCalls;
|
||||
|
||||
if (recents != null)
|
||||
{
|
||||
PostStatusMessage(new
|
||||
{
|
||||
recentCalls = recents
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
void dirCodec_DirectoryResultReturned(object sender, DirectoryEventArgs e)
|
||||
{
|
||||
PostStatusMessage(new
|
||||
{
|
||||
currentDirectory = e.Directory
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
void codec_IsReadyChange(object sender, EventArgs e)
|
||||
{
|
||||
PostStatusMessage(new
|
||||
{
|
||||
isReady = true
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called from base's RegisterWithAppServer method
|
||||
/// </summary>
|
||||
/// <param name="appServerController"></param>
|
||||
protected override void CustomRegisterWithAppServer(CotijaSystemController appServerController)
|
||||
{
|
||||
appServerController.AddAction("/device/videoCodec/isReady", new Action(SendIsReady));
|
||||
appServerController.AddAction("/device/videoCodec/fullStatus", new Action(SendVtcFullMessageObject));
|
||||
appServerController.AddAction("/device/videoCodec/dial", new Action<string>(s => Codec.Dial(s)));
|
||||
appServerController.AddAction("/device/videoCodec/endCallById", new Action<string>(s =>
|
||||
{
|
||||
var call = GetCallWithId(s);
|
||||
if (call != null)
|
||||
Codec.EndCall(call);
|
||||
}));
|
||||
appServerController.AddAction(MessagePath + "/endAllCalls", new Action(Codec.EndAllCalls));
|
||||
appServerController.AddAction(MessagePath + "/dtmf", new Action<string>(s => Codec.SendDtmf(s)));
|
||||
appServerController.AddAction(MessagePath + "/rejectById", new Action<string>(s =>
|
||||
{
|
||||
var call = GetCallWithId(s);
|
||||
if (call != null)
|
||||
Codec.RejectCall(call);
|
||||
}));
|
||||
appServerController.AddAction(MessagePath + "/acceptById", new Action<string>(s =>
|
||||
{
|
||||
var call = GetCallWithId(s);
|
||||
if (call != null)
|
||||
Codec.AcceptCall(call);
|
||||
}));
|
||||
appServerController.AddAction(MessagePath + "/directoryRoot", new Action(GetDirectoryRoot));
|
||||
appServerController.AddAction(MessagePath + "/directoryById", new Action<string>(s => GetDirectory(s)));
|
||||
appServerController.AddAction(MessagePath + "/directorySearch", new Action<string>(s => DirectorySearch(s)));
|
||||
appServerController.AddAction(MessagePath + "/getCallHistory", new Action(GetCallHistory));
|
||||
appServerController.AddAction(MessagePath + "/privacyModeOn", new Action(Codec.PrivacyModeOn));
|
||||
appServerController.AddAction(MessagePath + "/privacyModeOff", new Action(Codec.PrivacyModeOff));
|
||||
appServerController.AddAction(MessagePath + "/privacyModeToggle", new Action(Codec.PrivacyModeToggle));
|
||||
appServerController.AddAction(MessagePath + "/sharingStart", new Action(Codec.StartSharing));
|
||||
appServerController.AddAction(MessagePath + "/sharingStop", new Action(Codec.StopSharing));
|
||||
appServerController.AddAction(MessagePath + "/standbyOn", new Action(Codec.StandbyActivate));
|
||||
appServerController.AddAction(MessagePath + "/standbyOff", new Action(Codec.StandbyDeactivate));
|
||||
}
|
||||
|
||||
void GetCallHistory()
|
||||
{
|
||||
var codec = (Codec as IHasCallHistory);
|
||||
|
||||
if (codec != null)
|
||||
{
|
||||
var recents = codec.CallHistory.RecentCalls;
|
||||
|
||||
if (recents != null)
|
||||
{
|
||||
PostStatusMessage(new
|
||||
{
|
||||
recentCalls = recents
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void GetFullStatusMessage()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper to grab a call with string ID
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
CodecActiveCallItem GetCallWithId(string id)
|
||||
{
|
||||
return Codec.ActiveCalls.FirstOrDefault(c => c.Id == id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="s"></param>
|
||||
void DirectorySearch(string s)
|
||||
{
|
||||
var dirCodec = Codec as IHasDirectory;
|
||||
if (dirCodec != null)
|
||||
{
|
||||
dirCodec.SearchDirectory(s);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
void GetDirectory(string id)
|
||||
{
|
||||
var dirCodec = Codec as IHasDirectory;
|
||||
if(dirCodec == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
dirCodec.GetDirectoryFolderContents(id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void GetDirectoryRoot()
|
||||
{
|
||||
var dirCodec = Codec as IHasDirectory;
|
||||
if (dirCodec == null)
|
||||
{
|
||||
// do something else?
|
||||
return;
|
||||
}
|
||||
if (!dirCodec.PhonebookSyncState.InitialSyncComplete)
|
||||
{
|
||||
PostStatusMessage(new
|
||||
{
|
||||
initialSyncComplete = false
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
PostStatusMessage(new
|
||||
{
|
||||
currentDirectory = dirCodec.DirectoryRoot
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handler for codec changes
|
||||
/// </summary>
|
||||
void codec_CallStatusChange(object sender, CodecCallStatusItemChangeEventArgs e)
|
||||
{
|
||||
SendVtcFullMessageObject();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void SendIsReady()
|
||||
{
|
||||
PostStatusMessage(new
|
||||
{
|
||||
isReady = Codec.IsReady
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper method to build call status for vtc
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
void SendVtcFullMessageObject()
|
||||
{
|
||||
if (!Codec.IsReady)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var info = Codec.CodecInfo;
|
||||
PostStatusMessage(new
|
||||
{
|
||||
isInCall = Codec.IsInCall,
|
||||
privacyModeIsOn = Codec.PrivacyModeIsOnFeedback.BoolValue,
|
||||
sharingContentIsOn = Codec.SharingContentIsOnFeedback.BoolValue,
|
||||
sharingSource = Codec.SharingSourceFeedback.StringValue,
|
||||
standbyIsOn = Codec.StandbyIsOnFeedback.StringValue,
|
||||
calls = Codec.ActiveCalls,
|
||||
info = new
|
||||
{
|
||||
autoAnswerEnabled = info.AutoAnswerEnabled,
|
||||
e164Alias = info.E164Alias,
|
||||
h323Id = info.H323Id,
|
||||
ipAddress = info.IpAddress,
|
||||
sipPhoneNumber = info.SipPhoneNumber,
|
||||
sipURI = info.SipUri
|
||||
},
|
||||
showSelfViewByDefault = Codec.ShowSelfViewByDefault,
|
||||
hasDirectory = Codec is IHasDirectory,
|
||||
hasRecents = Codec is IHasCallHistory,
|
||||
hasCameras = Codec is IHasCameraControl
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public abstract class CotijaBridgeBase: Device
|
||||
{
|
||||
public CotijaSystemController Parent { get; private set; }
|
||||
|
||||
public string UserCode { get; private set; }
|
||||
|
||||
public abstract string RoomName { get; }
|
||||
|
||||
public CotijaBridgeBase(string key, string name)
|
||||
: base(key, name)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set the parent. Does nothing else. Override to add functionality such
|
||||
/// as adding actions to parent
|
||||
/// </summary>
|
||||
/// <param name="parent"></param>
|
||||
public virtual void AddParent(CotijaSystemController parent)
|
||||
{
|
||||
Parent = parent;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the UserCode on the bridge object. Called from controller. A changed code will
|
||||
/// fire method UserCodeChange. Override that to handle changes
|
||||
/// </summary>
|
||||
/// <param name="code"></param>
|
||||
public void SetUserCode(string code)
|
||||
{
|
||||
var changed = UserCode != code;
|
||||
UserCode = code;
|
||||
if (changed)
|
||||
{
|
||||
UserCodeChange();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Empty method in base class. Override this to add functionality
|
||||
/// when code changes
|
||||
/// </summary>
|
||||
protected virtual void UserCodeChange()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,679 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharp.Reflection;
|
||||
using Crestron.SimplSharpPro.EthernetCommunication;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.AppServer.Messengers;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.Room.Config;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.Room.Cotija
|
||||
{
|
||||
public class CotijaDdvc01RoomBridge : CotijaBridgeBase, IDelayedConfiguration
|
||||
{
|
||||
public class BoolJoin
|
||||
{
|
||||
/// <summary>
|
||||
/// 301
|
||||
/// </summary>
|
||||
public const uint RoomIsOn = 301;
|
||||
|
||||
/// <summary>
|
||||
/// 41
|
||||
/// </summary>
|
||||
public const uint PromptForCode = 41;
|
||||
/// <summary>
|
||||
/// 42
|
||||
/// </summary>
|
||||
public const uint ClientJoined = 42;
|
||||
/// <summary>
|
||||
/// 51
|
||||
/// </summary>
|
||||
public const uint ActivitySharePress = 51;
|
||||
/// <summary>
|
||||
/// 52
|
||||
/// </summary>
|
||||
public const uint ActivityPhoneCallPress = 52;
|
||||
/// <summary>
|
||||
/// 53
|
||||
/// </summary>
|
||||
public const uint ActivityVideoCallPress = 53;
|
||||
|
||||
/// <summary>
|
||||
/// 1
|
||||
/// </summary>
|
||||
public const uint MasterVolumeIsMuted = 1;
|
||||
/// <summary>
|
||||
/// 1
|
||||
/// </summary>
|
||||
public const uint MasterVolumeMuteToggle = 1;
|
||||
|
||||
/// <summary>
|
||||
/// 61
|
||||
/// </summary>
|
||||
public const uint ShutdownCancel = 61;
|
||||
/// <summary>
|
||||
/// 62
|
||||
/// </summary>
|
||||
public const uint ShutdownEnd = 62;
|
||||
/// <summary>
|
||||
/// 63
|
||||
/// </summary>
|
||||
public const uint ShutdownStart = 63;
|
||||
/// <summary>
|
||||
/// 72
|
||||
/// </summary>
|
||||
public const uint SourceHasChanged = 72;
|
||||
/// <summary>
|
||||
/// 261 - The start of the range of speed dial visibles
|
||||
/// </summary>
|
||||
public const uint SpeedDialVisibleStartJoin = 261;
|
||||
/// <summary>
|
||||
/// 501
|
||||
/// </summary>
|
||||
public const uint ConfigIsReady = 501;
|
||||
}
|
||||
|
||||
public class UshortJoin
|
||||
{
|
||||
/// <summary>
|
||||
/// 1
|
||||
/// </summary>
|
||||
public const uint MasterVolumeLevel = 1;
|
||||
|
||||
/// <summary>
|
||||
/// 61
|
||||
/// </summary>
|
||||
public const uint ShutdownPromptDuration = 61;
|
||||
}
|
||||
|
||||
public class StringJoin
|
||||
{
|
||||
/// <summary>
|
||||
/// 71
|
||||
/// </summary>
|
||||
public const uint SelectedSourceKey = 71;
|
||||
|
||||
/// <summary>
|
||||
/// 241
|
||||
/// </summary>
|
||||
public const uint SpeedDialNameStartJoin = 241;
|
||||
|
||||
/// <summary>
|
||||
/// 251
|
||||
/// </summary>
|
||||
public const uint SpeedDialNumberStartJoin = 251;
|
||||
|
||||
/// <summary>
|
||||
/// 501
|
||||
/// </summary>
|
||||
public const uint ConfigRoomName = 501;
|
||||
/// <summary>
|
||||
/// 502
|
||||
/// </summary>
|
||||
public const uint ConfigHelpMessage = 502;
|
||||
/// <summary>
|
||||
/// 503
|
||||
/// </summary>
|
||||
public const uint ConfigHelpNumber = 503;
|
||||
/// <summary>
|
||||
/// 504
|
||||
/// </summary>
|
||||
public const uint ConfigRoomPhoneNumber = 504;
|
||||
/// <summary>
|
||||
/// 505
|
||||
/// </summary>
|
||||
public const uint ConfigRoomURI = 505;
|
||||
/// <summary>
|
||||
/// 401
|
||||
/// </summary>
|
||||
public const uint UserCodeToSystem = 401;
|
||||
/// <summary>
|
||||
/// 402
|
||||
/// </summary>
|
||||
public const uint ServerUrl = 402;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fires when config is ready to go
|
||||
/// </summary>
|
||||
public event EventHandler<EventArgs> ConfigurationIsReady;
|
||||
|
||||
public ThreeSeriesTcpIpEthernetIntersystemCommunications EISC { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public bool ConfigIsLoaded { get; private set; }
|
||||
|
||||
public override string RoomName
|
||||
{
|
||||
get {
|
||||
var name = EISC.StringOutput[StringJoin.ConfigRoomName].StringValue;
|
||||
return string.IsNullOrEmpty(name) ? "Not Loaded" : name;
|
||||
}
|
||||
}
|
||||
|
||||
CotijaDdvc01DeviceBridge SourceBridge;
|
||||
|
||||
Ddvc01AtcMessenger AtcMessenger;
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="ipId"></param>
|
||||
public CotijaDdvc01RoomBridge(string key, string name, uint ipId)
|
||||
: base(key, name)
|
||||
{
|
||||
try
|
||||
{
|
||||
EISC = new ThreeSeriesTcpIpEthernetIntersystemCommunications(ipId, "127.0.0.2", Global.ControlSystem);
|
||||
var reg = EISC.Register();
|
||||
if (reg != Crestron.SimplSharpPro.eDeviceRegistrationUnRegistrationResponse.Success)
|
||||
Debug.Console(0, this, "Cannot connect EISC at IPID {0}: \r{1}", ipId, reg);
|
||||
|
||||
SourceBridge = new CotijaDdvc01DeviceBridge(key + "-sourceBridge", "DDVC01 source bridge", EISC);
|
||||
DeviceManager.AddDevice(SourceBridge);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Finish wiring up everything after all devices are created. The base class will hunt down the related
|
||||
/// parent controller and link them up.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override bool CustomActivate()
|
||||
{
|
||||
Debug.Console(0, this, "Final activation. Setting up actions and feedbacks");
|
||||
SetupFunctions();
|
||||
SetupFeedbacks();
|
||||
|
||||
var key = this.Key + "-" + Parent.Key;
|
||||
AtcMessenger = new Ddvc01AtcMessenger(key, EISC, "/device/audioCodec");
|
||||
AtcMessenger.RegisterWithAppServer(Parent);
|
||||
|
||||
EISC.SigChange += EISC_SigChange;
|
||||
EISC.OnlineStatusChange += (o, a) =>
|
||||
{
|
||||
Debug.Console(1, this, "DDVC EISC online={0}. Config is ready={1}", a.DeviceOnLine, EISC.BooleanOutput[BoolJoin.ConfigIsReady].BoolValue);
|
||||
if (a.DeviceOnLine && EISC.BooleanOutput[BoolJoin.ConfigIsReady].BoolValue)
|
||||
LoadConfigValues();
|
||||
};
|
||||
// load config if it's already there
|
||||
if (EISC.IsOnline && EISC.BooleanOutput[BoolJoin.ConfigIsReady].BoolValue) // || EISC.BooleanInput[BoolJoin.ConfigIsReady].BoolValue)
|
||||
LoadConfigValues();
|
||||
|
||||
|
||||
CrestronConsole.AddNewConsoleCommand(s =>
|
||||
{
|
||||
for (uint i = 1; i < 1000; i++)
|
||||
{
|
||||
if (s.ToLower().Equals("b"))
|
||||
{
|
||||
CrestronConsole.ConsoleCommandResponse("D{0,6} {1} - ", i, EISC.BooleanOutput[i].BoolValue);
|
||||
}
|
||||
else if (s.ToLower().Equals("u"))
|
||||
{
|
||||
CrestronConsole.ConsoleCommandResponse("U{0,6} {1,8} - ", i, EISC.UShortOutput[i].UShortValue);
|
||||
}
|
||||
else if (s.ToLower().Equals("s"))
|
||||
{
|
||||
var val = EISC.StringOutput[i].StringValue;
|
||||
if(!string.IsNullOrEmpty(val))
|
||||
CrestronConsole.ConsoleCommandResponse("S{0,6} {1}\r", i, EISC.StringOutput[i].StringValue);
|
||||
}
|
||||
|
||||
}
|
||||
}, "mobilebridgedump", "Dumps DDVC01 bridge EISC data b,u,s", ConsoleAccessLevelEnum.AccessOperator);
|
||||
|
||||
return base.CustomActivate();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Setup the actions to take place on various incoming API calls
|
||||
/// </summary>
|
||||
void SetupFunctions()
|
||||
{
|
||||
#warning need join numbers for these
|
||||
Parent.AddAction(@"/room/room1/promptForCode", new Action(() => EISC.PulseBool(BoolJoin.PromptForCode)));
|
||||
Parent.AddAction(@"/room/room1/clientJoined", new Action(() => EISC.PulseBool(BoolJoin.ClientJoined)));
|
||||
|
||||
Parent.AddAction(@"/room/room1/status", new Action(SendFullStatus));
|
||||
|
||||
Parent.AddAction(@"/room/room1/source", new Action<SourceSelectMessageContent>(c =>
|
||||
{
|
||||
EISC.SetString(StringJoin.SelectedSourceKey, c.SourceListItem);
|
||||
EISC.PulseBool(BoolJoin.SourceHasChanged);
|
||||
}));
|
||||
|
||||
Parent.AddAction(@"/room/room1/defaultsource", new Action(() =>
|
||||
EISC.PulseBool(BoolJoin.ActivitySharePress)));
|
||||
Parent.AddAction(@"/room/room1/activityVideo", new Action(() =>
|
||||
EISC.PulseBool(BoolJoin.ActivityVideoCallPress)));
|
||||
Parent.AddAction(@"/room/room1/activityPhone", new Action(() =>
|
||||
EISC.PulseBool(BoolJoin.ActivityPhoneCallPress)));
|
||||
|
||||
Parent.AddAction(@"/room/room1/volumes/master/level", new Action<ushort>(u =>
|
||||
EISC.SetUshort(UshortJoin.MasterVolumeLevel, u)));
|
||||
Parent.AddAction(@"/room/room1/volumes/master/muteToggle", new Action(() =>
|
||||
EISC.PulseBool(BoolJoin.MasterVolumeIsMuted)));
|
||||
|
||||
Parent.AddAction(@"/room/room1/shutdownStart", new Action(() =>
|
||||
EISC.PulseBool(BoolJoin.ShutdownStart)));
|
||||
Parent.AddAction(@"/room/room1/shutdownEnd", new Action(() =>
|
||||
EISC.PulseBool(BoolJoin.ShutdownEnd)));
|
||||
Parent.AddAction(@"/room/room1/shutdownCancel", new Action(() =>
|
||||
EISC.PulseBool(BoolJoin.ShutdownCancel)));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="devKey"></param>
|
||||
void SetupSourceFunctions(string devKey)
|
||||
{
|
||||
SourceDeviceMapDictionary sourceJoinMap = new SourceDeviceMapDictionary();
|
||||
|
||||
var prefix = string.Format("/device/{0}/", devKey);
|
||||
|
||||
foreach (var item in sourceJoinMap)
|
||||
{
|
||||
var join = item.Value;
|
||||
Parent.AddAction(string.Format("{0}{1}", prefix, item.Key), new PressAndHoldAction(b => EISC.SetBool(join, b)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Links feedbacks to whatever is gonna happen!
|
||||
/// </summary>
|
||||
void SetupFeedbacks()
|
||||
{
|
||||
// Power
|
||||
EISC.SetBoolSigAction(BoolJoin.RoomIsOn, b =>
|
||||
PostStatusMessage(new
|
||||
{
|
||||
isOn = b
|
||||
}));
|
||||
|
||||
// Source change things
|
||||
EISC.SetSigTrueAction(BoolJoin.SourceHasChanged, () =>
|
||||
PostStatusMessage(new
|
||||
{
|
||||
selectedSourceKey = EISC.StringOutput[StringJoin.SelectedSourceKey].StringValue
|
||||
}));
|
||||
|
||||
// Volume things
|
||||
EISC.SetUShortSigAction(UshortJoin.MasterVolumeLevel, u =>
|
||||
PostStatusMessage(new
|
||||
{
|
||||
volumes = new
|
||||
{
|
||||
master = new
|
||||
{
|
||||
level = u
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
EISC.SetBoolSigAction(BoolJoin.MasterVolumeIsMuted, b =>
|
||||
PostStatusMessage(new
|
||||
{
|
||||
volumes = new
|
||||
{
|
||||
master = new
|
||||
{
|
||||
muted = b
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
|
||||
// shutdown things
|
||||
EISC.SetSigTrueAction(BoolJoin.ShutdownCancel, new Action(() =>
|
||||
PostMessage("/room/shutdown/", new
|
||||
{
|
||||
state = "wasCancelled"
|
||||
})));
|
||||
EISC.SetSigTrueAction(BoolJoin.ShutdownEnd, new Action(() =>
|
||||
PostMessage("/room/shutdown/", new
|
||||
{
|
||||
state = "hasFinished"
|
||||
})));
|
||||
EISC.SetSigTrueAction(BoolJoin.ShutdownStart, new Action(() =>
|
||||
PostMessage("/room/shutdown/", new
|
||||
{
|
||||
state = "hasStarted",
|
||||
duration = EISC.UShortOutput[UshortJoin.ShutdownPromptDuration].UShortValue
|
||||
})));
|
||||
|
||||
// Config things
|
||||
EISC.SetSigTrueAction(BoolJoin.ConfigIsReady, LoadConfigValues);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads in config values when the Simpl program is ready
|
||||
/// </summary>
|
||||
void LoadConfigValues()
|
||||
{
|
||||
Debug.Console(1, this, "Loading configuration from DDVC01 EISC bridge");
|
||||
ConfigIsLoaded = false;
|
||||
|
||||
var co = ConfigReader.ConfigObject;
|
||||
|
||||
co.Info.RuntimeInfo.AppName = Assembly.GetExecutingAssembly().GetName().Name;
|
||||
var version = Assembly.GetExecutingAssembly().GetName().Version;
|
||||
co.Info.RuntimeInfo.AssemblyVersion = string.Format("{0}.{1}.{2}", version.Major, version.Minor, version.Build);
|
||||
|
||||
//Room
|
||||
//if (co.Rooms == null)
|
||||
// always start fresh in case simpl changed
|
||||
co.Rooms = new List<DeviceConfig>();
|
||||
var rm = new DeviceConfig();
|
||||
if (co.Rooms.Count == 0)
|
||||
{
|
||||
Debug.Console(0, this, "Adding room to config");
|
||||
co.Rooms.Add(rm);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(0, this, "Replacing Room[0] in config");
|
||||
co.Rooms[0] = rm;
|
||||
}
|
||||
rm.Name = EISC.StringOutput[501].StringValue;
|
||||
rm.Key = "room1";
|
||||
rm.Type = "ddvc01";
|
||||
|
||||
DDVC01RoomPropertiesConfig rmProps;
|
||||
if (rm.Properties == null)
|
||||
rmProps = new DDVC01RoomPropertiesConfig();
|
||||
else
|
||||
rmProps = JsonConvert.DeserializeObject<DDVC01RoomPropertiesConfig>(rm.Properties.ToString());
|
||||
|
||||
rmProps.Help = new EssentialsHelpPropertiesConfig();
|
||||
rmProps.Help.CallButtonText = EISC.StringOutput[503].StringValue;
|
||||
rmProps.Help.Message = EISC.StringOutput[502].StringValue;
|
||||
|
||||
rmProps.Environment = new EssentialsEnvironmentPropertiesConfig(); // enabled defaults to false
|
||||
|
||||
rmProps.RoomPhoneNumber = EISC.StringOutput[504].StringValue;
|
||||
rmProps.RoomURI = EISC.StringOutput[505].StringValue;
|
||||
rmProps.SpeedDials = new List<DDVC01SpeedDial>();
|
||||
// add speed dials as long as there are more - up to 4
|
||||
for (uint i = 512; i <= 519; i = i + 2)
|
||||
{
|
||||
var num = EISC.StringOutput[i].StringValue;
|
||||
if (string.IsNullOrEmpty(num))
|
||||
break;
|
||||
var name = EISC.StringOutput[i + 1].StringValue;
|
||||
rmProps.SpeedDials.Add(new DDVC01SpeedDial { Number = num, Name = name});
|
||||
}
|
||||
|
||||
// This MAY need a check
|
||||
rmProps.AudioCodecKey = "audioCodec";
|
||||
rmProps.VideoCodecKey = null; // "videoCodec";
|
||||
|
||||
// volume control names
|
||||
var volCount = EISC.UShortOutput[701].UShortValue;
|
||||
|
||||
//// use Volumes object or?
|
||||
//rmProps.VolumeSliderNames = new List<string>();
|
||||
//for(uint i = 701; i <= 700 + volCount; i++)
|
||||
//{
|
||||
// rmProps.VolumeSliderNames.Add(EISC.StringInput[i].StringValue);
|
||||
//}
|
||||
|
||||
// There should be cotija devices in here, I think...
|
||||
if(co.Devices == null)
|
||||
co.Devices = new List<DeviceConfig>();
|
||||
|
||||
// clear out previous DDVC devices
|
||||
co.Devices.RemoveAll(d =>
|
||||
d.Key.StartsWith("source-", StringComparison.OrdinalIgnoreCase)
|
||||
|| d.Key.Equals("audioCodec", StringComparison.OrdinalIgnoreCase)
|
||||
|| d.Key.Equals("videoCodec", StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
rmProps.SourceListKey = "default";
|
||||
rm.Properties = JToken.FromObject(rmProps);
|
||||
|
||||
// Source list! This might be brutal!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
var groupMap = GetSourceGroupDictionary();
|
||||
|
||||
co.SourceLists = new Dictionary<string,Dictionary<string,SourceListItem>>();
|
||||
var newSl = new Dictionary<string, SourceListItem>();
|
||||
// add sources...
|
||||
for (uint i = 0; i<= 19; i++)
|
||||
{
|
||||
var name = EISC.StringOutput[601 + i].StringValue;
|
||||
if(string.IsNullOrEmpty(name))
|
||||
break;
|
||||
var icon = EISC.StringOutput[651 + i].StringValue;
|
||||
var key = EISC.StringOutput[671 + i].StringValue;
|
||||
|
||||
var type = EISC.StringOutput[701 + i].StringValue;
|
||||
|
||||
Debug.Console(0, this, "Adding source {0} '{1}'", key, name);
|
||||
var newSLI = new SourceListItem{
|
||||
Icon = icon,
|
||||
Name = name,
|
||||
Order = (int)i + 1,
|
||||
SourceKey = key,
|
||||
Type = eSourceListItemType.Route
|
||||
};
|
||||
newSl.Add(key, newSLI);
|
||||
|
||||
string group = "genericsource";
|
||||
if (groupMap.ContainsKey(type))
|
||||
{
|
||||
group = groupMap[type];
|
||||
}
|
||||
|
||||
// add dev to devices list
|
||||
var devConf = new DeviceConfig {
|
||||
Group = group,
|
||||
Key = key,
|
||||
Name = name,
|
||||
Type = type
|
||||
};
|
||||
co.Devices.Add(devConf);
|
||||
|
||||
if (group.ToLower().StartsWith("settopbox")) // Add others here as needed
|
||||
{
|
||||
SetupSourceFunctions(key);
|
||||
}
|
||||
}
|
||||
|
||||
co.SourceLists.Add("default", newSl);
|
||||
|
||||
// build "audioCodec" config if we need
|
||||
if (!string.IsNullOrEmpty(rmProps.AudioCodecKey))
|
||||
{
|
||||
var acFavs = new List<PepperDash.Essentials.Devices.Common.Codec.CodecActiveCallItem>();
|
||||
for (uint i = 0; i < 4; i++)
|
||||
{
|
||||
if (!EISC.GetBool(BoolJoin.SpeedDialVisibleStartJoin + i))
|
||||
{
|
||||
break;
|
||||
}
|
||||
acFavs.Add(new PepperDash.Essentials.Devices.Common.Codec.CodecActiveCallItem()
|
||||
{
|
||||
Name = EISC.GetString(StringJoin.SpeedDialNameStartJoin + i),
|
||||
Number = EISC.GetString(StringJoin.SpeedDialNumberStartJoin + i),
|
||||
Type = PepperDash.Essentials.Devices.Common.Codec.eCodecCallType.Audio
|
||||
});
|
||||
}
|
||||
|
||||
var acProps = new
|
||||
{
|
||||
favorites = acFavs
|
||||
};
|
||||
|
||||
var acStr = "audioCodec";
|
||||
var acConf = new DeviceConfig()
|
||||
{
|
||||
Group = acStr,
|
||||
Key = acStr,
|
||||
Name = acStr,
|
||||
Type = acStr,
|
||||
Properties = JToken.FromObject(acProps)
|
||||
};
|
||||
co.Devices.Add(acConf);
|
||||
}
|
||||
|
||||
Debug.Console(0, this, "******* CONFIG FROM DDVC: \r{0}", JsonConvert.SerializeObject(ConfigReader.ConfigObject, Formatting.Indented));
|
||||
|
||||
var handler = ConfigurationIsReady;
|
||||
if (handler != null)
|
||||
{
|
||||
handler(this, new EventArgs());
|
||||
}
|
||||
|
||||
ConfigIsLoaded = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void SendFullStatus()
|
||||
{
|
||||
if (ConfigIsLoaded)
|
||||
{
|
||||
var count = EISC.UShortOutput[801].UShortValue;
|
||||
|
||||
Debug.Console(1, this, "The Fader Count is : {0}", count);
|
||||
|
||||
// build volumes object, serialize and put in content of method below
|
||||
|
||||
var auxFaders = new List<Volume>();
|
||||
|
||||
// Create auxFaders
|
||||
for (uint i = 2; i <= count; i++)
|
||||
{
|
||||
auxFaders.Add(
|
||||
new Volume(string.Format("level-{0}", i),
|
||||
EISC.UShortOutput[i].UShortValue,
|
||||
EISC.BooleanOutput[i].BoolValue,
|
||||
EISC.StringOutput[800 + i].StringValue,
|
||||
true,
|
||||
"someting.png"));
|
||||
}
|
||||
|
||||
var volumes = new Volumes();
|
||||
|
||||
volumes.Master = new Volume("master",
|
||||
EISC.UShortOutput[UshortJoin.MasterVolumeLevel].UShortValue,
|
||||
EISC.BooleanOutput[BoolJoin.MasterVolumeIsMuted].BoolValue,
|
||||
EISC.StringOutput[801].StringValue,
|
||||
true,
|
||||
"something.png");
|
||||
|
||||
volumes.AuxFaders = auxFaders;
|
||||
|
||||
PostStatusMessage(new
|
||||
{
|
||||
isOn = EISC.BooleanOutput[BoolJoin.RoomIsOn].BoolValue,
|
||||
selectedSourceKey = EISC.StringOutput[StringJoin.SelectedSourceKey].StringValue,
|
||||
volumes = volumes
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
PostStatusMessage(new
|
||||
{
|
||||
error = "systemNotReady"
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper for posting status message
|
||||
/// </summary>
|
||||
/// <param name="contentObject">The contents of the content object</param>
|
||||
void PostStatusMessage(object contentObject)
|
||||
{
|
||||
Parent.SendMessageToServer(JObject.FromObject(new
|
||||
{
|
||||
type = "/room/status/",
|
||||
content = contentObject
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="messageType"></param>
|
||||
/// <param name="contentObject"></param>
|
||||
void PostMessage(string messageType, object contentObject)
|
||||
{
|
||||
Parent.SendMessageToServer(JObject.FromObject(new
|
||||
{
|
||||
type = messageType,
|
||||
content = contentObject
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="currentDevice"></param>
|
||||
/// <param name="args"></param>
|
||||
void EISC_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args)
|
||||
{
|
||||
if (Debug.Level >= 1)
|
||||
Debug.Console(1, this, "DDVC EISC change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
|
||||
var uo = args.Sig.UserObject;
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the mapping of types to groups, for setting up devices.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Dictionary<string, string> GetSourceGroupDictionary()
|
||||
{
|
||||
//type, group
|
||||
var d = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
{ "laptop", "pc" },
|
||||
{ "wireless", "genericsource" },
|
||||
{ "iptv", "settopbox" }
|
||||
|
||||
};
|
||||
return d;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// updates the usercode from server
|
||||
/// </summary>
|
||||
protected override void UserCodeChange()
|
||||
{
|
||||
Debug.Console(1, this, "Server user code changed: {0}", UserCode);
|
||||
EISC.StringInput[StringJoin.UserCodeToSystem].StringValue = UserCode;
|
||||
EISC.StringInput[StringJoin.ServerUrl].StringValue = Parent.Config.ClientAppUrl;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,489 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.AppServer.Messengers;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Room.Cotija;
|
||||
using PepperDash.Essentials.Devices.Common.Codec;
|
||||
using PepperDash.Essentials.Devices.Common.VideoCodec;
|
||||
using PepperDash.Essentials.Devices.Common.AudioCodec;
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
{
|
||||
public class CotijaEssentialsHuddleSpaceRoomBridge : CotijaBridgeBase
|
||||
{
|
||||
|
||||
public EssentialsRoomBase Room { get; private set; }
|
||||
|
||||
public VideoCodecBaseMessenger VCMessenger { get; private set; }
|
||||
|
||||
public AudioCodecBaseMessenger ACMessenger { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public override string RoomName
|
||||
{
|
||||
get
|
||||
{
|
||||
return Room.Name;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="parent"></param>
|
||||
/// <param name="room"></param>
|
||||
public CotijaEssentialsHuddleSpaceRoomBridge(EssentialsRoomBase room):
|
||||
base("mobileControlBridge-essentialsHuddle", "Essentials Mobile Control Bridge-Huddle")
|
||||
{
|
||||
Room = room;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Override of base: calls base to add parent and then registers actions and events.
|
||||
/// </summary>
|
||||
/// <param name="parent"></param>
|
||||
public override void AddParent(CotijaSystemController parent)
|
||||
{
|
||||
base.AddParent(parent);
|
||||
|
||||
// we add actions to the messaging system with a path, and a related action. Custom action
|
||||
// content objects can be handled in the controller's LineReceived method - and perhaps other
|
||||
// sub-controller parsing could be attached to these classes, so that the systemController
|
||||
// doesn't need to know about everything.
|
||||
|
||||
// Source Changes and room off
|
||||
Parent.AddAction(string.Format(@"/room/{0}/status", Room.Key), new Action(() => SendFullStatus(Room)));
|
||||
|
||||
var routeRoom = Room as IRunRouteAction;
|
||||
if(routeRoom != null)
|
||||
Parent.AddAction(string.Format(@"/room/{0}/source", Room.Key), new Action<SourceSelectMessageContent>(c =>
|
||||
routeRoom.RunRouteAction(c.SourceListItem)));
|
||||
|
||||
var defaultRoom = Room as IRunDefaultPresentRoute;
|
||||
if(defaultRoom != null)
|
||||
Parent.AddAction(string.Format(@"/room/{0}/defaultsource", Room.Key), new Action(() => defaultRoom.RunDefaultPresentRoute()));
|
||||
|
||||
var volumeRoom = Room as IHasCurrentVolumeControls;
|
||||
if (volumeRoom != null)
|
||||
{
|
||||
Parent.AddAction(string.Format(@"/room/{0}/volumes/master/level", Room.Key), new Action<ushort>(u =>
|
||||
(volumeRoom.CurrentVolumeControls as IBasicVolumeWithFeedback).SetVolume(u)));
|
||||
Parent.AddAction(string.Format(@"/room/{0}/volumes/master/muteToggle", Room.Key), new Action(() =>
|
||||
volumeRoom.CurrentVolumeControls.MuteToggle()));
|
||||
volumeRoom.CurrentVolumeDeviceChange += new EventHandler<VolumeDeviceChangeEventArgs>(Room_CurrentVolumeDeviceChange);
|
||||
|
||||
// Registers for initial volume events, if possible
|
||||
var currentVolumeDevice = volumeRoom.CurrentVolumeControls as IBasicVolumeWithFeedback;
|
||||
if (currentVolumeDevice != null)
|
||||
{
|
||||
currentVolumeDevice.MuteFeedback.OutputChange += MuteFeedback_OutputChange;
|
||||
currentVolumeDevice.VolumeLevelFeedback.OutputChange += VolumeLevelFeedback_OutputChange;
|
||||
}
|
||||
}
|
||||
|
||||
var sscRoom = Room as IHasCurrentSourceInfoChange;
|
||||
if(sscRoom != null)
|
||||
sscRoom.CurrentSingleSourceChange += new SourceInfoChangeHandler(Room_CurrentSingleSourceChange);
|
||||
|
||||
var vcRoom = Room as IHasVideoCodec;
|
||||
if (vcRoom != null && vcRoom.VideoCodec != null)
|
||||
{
|
||||
var codec = vcRoom.VideoCodec;
|
||||
var key = vcRoom.VideoCodec.Key + "-" + parent.Key;
|
||||
VCMessenger = new VideoCodecBaseMessenger(key, vcRoom.VideoCodec, "/device/videoCodec");
|
||||
VCMessenger.RegisterWithAppServer(Parent);
|
||||
|
||||
vcRoom.IsSharingFeedback.OutputChange += new EventHandler<FeedbackEventArgs>(IsSharingFeedback_OutputChange);
|
||||
}
|
||||
|
||||
var acRoom = Room as IHasAudioCodec;
|
||||
if (acRoom != null && acRoom.AudioCodec != null)
|
||||
{
|
||||
var codec = acRoom.AudioCodec;
|
||||
var key = acRoom.AudioCodec.Key + "-" + parent.Key;
|
||||
ACMessenger = new AudioCodecBaseMessenger(key, acRoom.AudioCodec, "/device/audioCodec");
|
||||
ACMessenger.RegisterWithAppServer(Parent);
|
||||
}
|
||||
|
||||
var defCallRm = Room as IRunDefaultCallRoute;
|
||||
if (defCallRm != null)
|
||||
{
|
||||
Parent.AddAction(string.Format(@"/room/{0}/activityVideo", Room.Key), new Action(()=>defCallRm.RunDefaultCallRoute()));
|
||||
}
|
||||
|
||||
Parent.AddAction(string.Format(@"/room/{0}/shutdownStart", Room.Key), new Action(() => Room.StartShutdown(eShutdownType.Manual)));
|
||||
Parent.AddAction(string.Format(@"/room/{0}/shutdownEnd", Room.Key), new Action(() => Room.ShutdownPromptTimer.Finish()));
|
||||
Parent.AddAction(string.Format(@"/room/{0}/shutdownCancel", Room.Key), new Action(() => Room.ShutdownPromptTimer.Cancel()));
|
||||
|
||||
Room.OnFeedback.OutputChange += OnFeedback_OutputChange;
|
||||
Room.IsCoolingDownFeedback.OutputChange += IsCoolingDownFeedback_OutputChange;
|
||||
Room.IsWarmingUpFeedback.OutputChange += IsWarmingUpFeedback_OutputChange;
|
||||
|
||||
Room.ShutdownPromptTimer.HasStarted += ShutdownPromptTimer_HasStarted;
|
||||
Room.ShutdownPromptTimer.HasFinished += ShutdownPromptTimer_HasFinished;
|
||||
Room.ShutdownPromptTimer.WasCancelled += ShutdownPromptTimer_WasCancelled;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
void IsSharingFeedback_OutputChange(object sender, FeedbackEventArgs e)
|
||||
{
|
||||
// sharing source
|
||||
string shareText;
|
||||
bool isSharing;
|
||||
#warning This share update needs to happen on source change as well!
|
||||
var vcRoom = Room as IHasVideoCodec;
|
||||
var srcInfoRoom = Room as IHasCurrentSourceInfoChange;
|
||||
if (vcRoom.VideoCodec.SharingContentIsOnFeedback.BoolValue && srcInfoRoom.CurrentSourceInfo != null)
|
||||
{
|
||||
|
||||
shareText = srcInfoRoom.CurrentSourceInfo.PreferredName;
|
||||
isSharing = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
shareText = "None";
|
||||
isSharing = false;
|
||||
}
|
||||
|
||||
PostStatusMessage(new
|
||||
{
|
||||
share = new
|
||||
{
|
||||
currentShareText = shareText,
|
||||
isSharing = isSharing
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
///// <summary>
|
||||
///// Handler for codec changes
|
||||
///// </summary>
|
||||
//void codec_CallStatusChange(object sender, CodecCallStatusItemChangeEventArgs e)
|
||||
//{
|
||||
// PostStatusMessage(new
|
||||
// {
|
||||
// calls = GetCallsMessageObject(),
|
||||
// //vtc = GetVtcCallsMessageObject()
|
||||
// });
|
||||
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// Helper for posting status message
|
||||
/// </summary>
|
||||
/// <param name="contentObject">The contents of the content object</param>
|
||||
void PostStatusMessage(object contentObject)
|
||||
{
|
||||
Parent.SendMessageToServer(JObject.FromObject(new
|
||||
{
|
||||
type = "/room/status/",
|
||||
content = contentObject
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handler for cancelled shutdown
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
void ShutdownPromptTimer_WasCancelled(object sender, EventArgs e)
|
||||
{
|
||||
JObject roomStatus = new JObject();
|
||||
roomStatus.Add("state", "wasCancelled");
|
||||
JObject message = new JObject();
|
||||
message.Add("type", "/room/shutdown/");
|
||||
message.Add("content", roomStatus);
|
||||
Parent.SendMessageToServer(message);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handler for when shutdown finishes
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
void ShutdownPromptTimer_HasFinished(object sender, EventArgs e)
|
||||
{
|
||||
JObject roomStatus = new JObject();
|
||||
roomStatus.Add("state", "hasFinished");
|
||||
JObject message = new JObject();
|
||||
message.Add("type", "/room/shutdown/");
|
||||
message.Add("content", roomStatus);
|
||||
Parent.SendMessageToServer(message);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handler for when shutdown starts
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
void ShutdownPromptTimer_HasStarted(object sender, EventArgs e)
|
||||
{
|
||||
JObject roomStatus = new JObject();
|
||||
roomStatus.Add("state", "hasStarted");
|
||||
roomStatus.Add("duration", Room.ShutdownPromptTimer.SecondsToCount);
|
||||
JObject message = new JObject();
|
||||
message.Add("type", "/room/shutdown/");
|
||||
message.Add("content", roomStatus);
|
||||
Parent.SendMessageToServer(message);
|
||||
// equivalent JS message:
|
||||
// Post( { type: '/room/status/', content: { shutdown: 'hasStarted', duration: Room.ShutdownPromptTimer.SecondsToCount })
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
void IsWarmingUpFeedback_OutputChange(object sender, FeedbackEventArgs e)
|
||||
{
|
||||
PostStatusMessage(new
|
||||
{
|
||||
isWarmingUp = e.BoolValue
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
void IsCoolingDownFeedback_OutputChange(object sender, FeedbackEventArgs e)
|
||||
{
|
||||
PostStatusMessage(new
|
||||
{
|
||||
isCoolingDown = e.BoolValue
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
void OnFeedback_OutputChange(object sender, FeedbackEventArgs e)
|
||||
{
|
||||
PostStatusMessage(new
|
||||
{
|
||||
isOn = e.BoolValue
|
||||
});
|
||||
}
|
||||
|
||||
void Room_CurrentVolumeDeviceChange(object sender, VolumeDeviceChangeEventArgs e)
|
||||
{
|
||||
if (e.OldDev is IBasicVolumeWithFeedback)
|
||||
{
|
||||
var oldDev = e.OldDev as IBasicVolumeWithFeedback;
|
||||
oldDev.MuteFeedback.OutputChange -= MuteFeedback_OutputChange;
|
||||
oldDev.VolumeLevelFeedback.OutputChange -= VolumeLevelFeedback_OutputChange;
|
||||
}
|
||||
|
||||
if (e.NewDev is IBasicVolumeWithFeedback)
|
||||
{
|
||||
var newDev = e.NewDev as IBasicVolumeWithFeedback;
|
||||
newDev.MuteFeedback.OutputChange += MuteFeedback_OutputChange;
|
||||
newDev.VolumeLevelFeedback.OutputChange += VolumeLevelFeedback_OutputChange;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Event handler for mute changes
|
||||
/// </summary>
|
||||
void MuteFeedback_OutputChange(object sender, FeedbackEventArgs e)
|
||||
{
|
||||
PostStatusMessage(new
|
||||
{
|
||||
volumes = new
|
||||
{
|
||||
master = new
|
||||
{
|
||||
muted = e.BoolValue
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles Volume changes on room
|
||||
/// </summary>
|
||||
void VolumeLevelFeedback_OutputChange(object sender, FeedbackEventArgs e)
|
||||
{
|
||||
PostStatusMessage(new
|
||||
{
|
||||
volumes = new
|
||||
{
|
||||
master = new
|
||||
{
|
||||
level = e.IntValue
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
void Room_CurrentSingleSourceChange(EssentialsRoomBase room, PepperDash.Essentials.Core.SourceListItem info, ChangeType type)
|
||||
{
|
||||
/* Example message
|
||||
* {
|
||||
"type":"/room/status",
|
||||
"content": {
|
||||
"selectedSourceKey": "off",
|
||||
}
|
||||
}
|
||||
*/
|
||||
if (type == ChangeType.WillChange)
|
||||
{
|
||||
// Disconnect from previous source
|
||||
|
||||
if (info != null)
|
||||
{
|
||||
var previousDev = info.SourceDevice;
|
||||
|
||||
// device type interfaces
|
||||
if (previousDev is ISetTopBoxControls)
|
||||
(previousDev as ISetTopBoxControls).UnlinkActions(Parent);
|
||||
// common interfaces
|
||||
if (previousDev is IChannel)
|
||||
(previousDev as IChannel).UnlinkActions(Parent);
|
||||
if (previousDev is IColor)
|
||||
(previousDev as IColor).UnlinkActions(Parent);
|
||||
if (previousDev is IDPad)
|
||||
(previousDev as IDPad).UnlinkActions(Parent);
|
||||
if (previousDev is IDvr)
|
||||
(previousDev as IDvr).UnlinkActions(Parent);
|
||||
if (previousDev is INumericKeypad)
|
||||
(previousDev as INumericKeypad).UnlinkActions(Parent);
|
||||
if (previousDev is IPower)
|
||||
(previousDev as IPower).UnlinkActions(Parent);
|
||||
if (previousDev is ITransport)
|
||||
(previousDev as ITransport).UnlinkActions(Parent);
|
||||
}
|
||||
}
|
||||
else // did change
|
||||
{
|
||||
if (info != null)
|
||||
{
|
||||
var dev = info.SourceDevice;
|
||||
|
||||
if (dev is ISetTopBoxControls)
|
||||
(dev as ISetTopBoxControls).LinkActions(Parent);
|
||||
if (dev is IChannel)
|
||||
(dev as IChannel).LinkActions(Parent);
|
||||
if (dev is IColor)
|
||||
(dev as IColor).LinkActions(Parent);
|
||||
if (dev is IDPad)
|
||||
(dev as IDPad).LinkActions(Parent);
|
||||
if (dev is IDvr)
|
||||
(dev as IDvr).LinkActions(Parent);
|
||||
if (dev is INumericKeypad)
|
||||
(dev as INumericKeypad).LinkActions(Parent);
|
||||
if (dev is IPower)
|
||||
(dev as IPower).LinkActions(Parent);
|
||||
if (dev is ITransport)
|
||||
(dev as ITransport).LinkActions(Parent);
|
||||
|
||||
var srcRm = room as IHasCurrentSourceInfoChange;
|
||||
PostStatusMessage(new
|
||||
{
|
||||
selectedSourceKey = srcRm.CurrentSourceInfoKey
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Posts the full status of the room to the server
|
||||
/// </summary>
|
||||
/// <param name="room"></param>
|
||||
void SendFullStatus(EssentialsRoomBase room)
|
||||
{
|
||||
var sourceKey = room is IHasCurrentSourceInfoChange ? (room as IHasCurrentSourceInfoChange).CurrentSourceInfoKey : null;
|
||||
|
||||
var rmVc = room as IHasCurrentVolumeControls;
|
||||
var volumes = new Volumes();
|
||||
if (rmVc != null)
|
||||
{
|
||||
var vc = rmVc.CurrentVolumeControls as IBasicVolumeWithFeedback;
|
||||
if (rmVc != null)
|
||||
{
|
||||
volumes.Master = new Volume("master", vc.VolumeLevelFeedback.UShortValue, vc.MuteFeedback.BoolValue, "Volume", true, "");
|
||||
}
|
||||
}
|
||||
|
||||
PostStatusMessage(new
|
||||
{
|
||||
//calls = GetCallsMessageObject(),
|
||||
isOn = room.OnFeedback.BoolValue,
|
||||
selectedSourceKey = sourceKey,
|
||||
//vtc = GetVtcCallsMessageObject(),
|
||||
volumes = volumes
|
||||
});
|
||||
}
|
||||
|
||||
///// <summary>
|
||||
///// Helper to return a anonymous object with the call data for JSON message
|
||||
///// </summary>
|
||||
///// <returns></returns>
|
||||
//object GetCallsMessageObject()
|
||||
//{
|
||||
// var callRm = Room as IHasVideoCodec;
|
||||
// if (callRm == null)
|
||||
// return null;
|
||||
// return new
|
||||
// {
|
||||
// activeCalls = callRm.VideoCodec.ActiveCalls,
|
||||
// callType = callRm.CallTypeFeedback.IntValue,
|
||||
// inCall = callRm.InCallFeedback.BoolValue,
|
||||
// isSharing = callRm.IsSharingFeedback.BoolValue,
|
||||
// privacyModeIsOn = callRm.PrivacyModeIsOnFeedback.BoolValue
|
||||
// };
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
///// Helper method to build call status for vtc
|
||||
///// </summary>
|
||||
///// <returns></returns>
|
||||
//object GetVtcCallsMessageObject()
|
||||
//{
|
||||
// var callRm = Room as IHasVideoCodec;
|
||||
// object vtc = null;
|
||||
// if (callRm != null)
|
||||
// {
|
||||
// var codec = callRm.VideoCodec;
|
||||
// vtc = new
|
||||
// {
|
||||
// isInCall = codec.IsInCall,
|
||||
// calls = codec.ActiveCalls
|
||||
// };
|
||||
// }
|
||||
// return vtc;
|
||||
//}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class SourceSelectMessageContent
|
||||
{
|
||||
public string SourceListItem { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="b"></param>
|
||||
public delegate void PressAndHoldAction(bool b);
|
||||
|
||||
}
|
||||
@@ -1,13 +1,19 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
namespace PepperDash.Essentials.Room.MobileControl
|
||||
namespace PepperDash.Essentials.Room.Cotija
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Contains all of the default joins that map to API funtions
|
||||
/// </summary>
|
||||
public class SourceDeviceMapDictionary : Dictionary<string, uint>
|
||||
{
|
||||
public SourceDeviceMapDictionary()
|
||||
|
||||
public SourceDeviceMapDictionary(): base()
|
||||
{
|
||||
var dictionary = new Dictionary<string, uint>
|
||||
{
|
||||
@@ -35,6 +41,7 @@ namespace PepperDash.Essentials.Room.MobileControl
|
||||
{"preset22", 122},
|
||||
{"preset23", 123},
|
||||
{"preset24", 124},
|
||||
|
||||
{"num0", 130},
|
||||
{"num1", 131},
|
||||
{"num2", 132},
|
||||
@@ -74,7 +81,7 @@ namespace PepperDash.Essentials.Room.MobileControl
|
||||
{"guide", 166},
|
||||
{"reboot", 167},
|
||||
{"dvrList", 168},
|
||||
{"replay", 169},
|
||||
{"replay", 169},
|
||||
{"play", 170},
|
||||
{"select", 171},
|
||||
{"record", 172},
|
||||
@@ -85,11 +92,12 @@ namespace PepperDash.Essentials.Room.MobileControl
|
||||
{"powerOn", 177},
|
||||
{"powerOff", 178},
|
||||
{"dot", 179}
|
||||
|
||||
};
|
||||
|
||||
foreach (var item in dictionary)
|
||||
{
|
||||
Add(item.Key, item.Value);
|
||||
this.Add(item.Key, item.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
55
PepperDashEssentials/AppServer/Volumes.cs
Normal file
55
PepperDashEssentials/AppServer/Volumes.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace PepperDash.Essentials.Room.Cotija
|
||||
{
|
||||
public class Volumes
|
||||
{
|
||||
[JsonProperty("master")]
|
||||
public Volume Master { get; set; }
|
||||
|
||||
[JsonProperty("auxFaders")]
|
||||
public List<Volume> AuxFaders { get; set; }
|
||||
|
||||
public Volumes()
|
||||
{
|
||||
AuxFaders = new List<Volume>();
|
||||
}
|
||||
}
|
||||
|
||||
public class Volume
|
||||
{
|
||||
[JsonProperty("key")]
|
||||
public string Key { get; set; }
|
||||
|
||||
[JsonProperty("level")]
|
||||
public ushort Level { get; set; }
|
||||
|
||||
[JsonProperty("muted")]
|
||||
public bool Muted { get; set; }
|
||||
|
||||
[JsonProperty("label")]
|
||||
public string Label { get; set; }
|
||||
|
||||
[JsonProperty("hasMute")]
|
||||
public bool HasMute { get; set; }
|
||||
|
||||
[JsonProperty("muteIcon")]
|
||||
public string MuteIcon { get; set; }
|
||||
|
||||
public Volume(string key, ushort level, bool muted, string label, bool hasMute, string muteIcon)
|
||||
{
|
||||
Key = key;
|
||||
Level = level;
|
||||
Muted = muted;
|
||||
Label = label;
|
||||
HasMute = hasMute;
|
||||
MuteIcon = muteIcon;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,18 @@
|
||||
using System;
|
||||
using PepperDash.Essentials.Core;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using Crestron.SimplSharp;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace PepperDash.Essentials.Room.Config
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.Devices.Common.DSP;
|
||||
using PepperDash.Essentials.DM;
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
@@ -28,8 +39,6 @@ namespace PepperDash.Essentials.Room.Config
|
||||
/// </summary>
|
||||
public IBasicVolumeWithFeedback GetDevice()
|
||||
{
|
||||
throw new NotImplementedException("This method references DM CHASSIS Directly");
|
||||
/*
|
||||
// DM output card format: deviceKey--output~number, dm8x8-1--output~4
|
||||
var match = Regex.Match(DeviceKey, @"([-_\w]+)--(\w+)~(\d+)");
|
||||
if (match.Success)
|
||||
@@ -46,7 +55,7 @@ namespace PepperDash.Essentials.Room.Config
|
||||
return null;
|
||||
}
|
||||
|
||||
// DSP/DMPS format: deviceKey--levelName, biampTesira-1--master
|
||||
// DSP format: deviceKey--levelName, biampTesira-1--master
|
||||
match = Regex.Match(DeviceKey, @"([-_\w]+)--(.+)");
|
||||
if (match.Success)
|
||||
{
|
||||
@@ -58,34 +67,11 @@ namespace PepperDash.Essentials.Room.Config
|
||||
if (dsp.LevelControlPoints.ContainsKey(levelTag)) // should always...
|
||||
return dsp.LevelControlPoints[levelTag];
|
||||
}
|
||||
|
||||
var dmps = DeviceManager.GetDeviceForKey(devKey) as DmpsAudioOutputController;
|
||||
if (dmps != null)
|
||||
{
|
||||
var levelTag = match.Groups[2].Value;
|
||||
switch (levelTag)
|
||||
{
|
||||
case "master":
|
||||
return dmps.MasterVolumeLevel;
|
||||
case "source":
|
||||
return dmps.SourceVolumeLevel;
|
||||
case "micsmaster":
|
||||
return dmps.MicsMasterVolumeLevel;
|
||||
case "codec1":
|
||||
return dmps.Codec1VolumeLevel;
|
||||
case "codec2":
|
||||
return dmps.Codec2VolumeLevel;
|
||||
default:
|
||||
return dmps.MasterVolumeLevel;
|
||||
}
|
||||
}
|
||||
// No volume for some reason. We have failed as developers
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
* */
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
PepperDashEssentials/Bridges/._DspControllerBridge.cs
Normal file
BIN
PepperDashEssentials/Bridges/._DspControllerBridge.cs
Normal file
Binary file not shown.
BIN
PepperDashEssentials/Bridges/._EssentialDsp.cs
Normal file
BIN
PepperDashEssentials/Bridges/._EssentialDsp.cs
Normal file
Binary file not shown.
BIN
PepperDashEssentials/Bridges/._EssentialTVOne.cs
Normal file
BIN
PepperDashEssentials/Bridges/._EssentialTVOne.cs
Normal file
Binary file not shown.
BIN
PepperDashEssentials/Bridges/._EssentialsLightsBridge.cs
Normal file
BIN
PepperDashEssentials/Bridges/._EssentialsLightsBridge.cs
Normal file
Binary file not shown.
198
PepperDashEssentials/Bridges/BridgeBase.cs
Normal file
198
PepperDashEssentials/Bridges/BridgeBase.cs
Normal file
@@ -0,0 +1,198 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro.EthernetCommunication;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Lighting;
|
||||
using PepperDash.Essentials.Core.Devices;
|
||||
using PepperDash.Essentials.Devices.Common;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.Core.CrestronIO;
|
||||
using PepperDash.Essentials.DM;
|
||||
using PepperDash.Essentials.Devices.Common.Cameras;
|
||||
using PepperDash.Essentials.Devices.Common.DSP;
|
||||
|
||||
namespace PepperDash.Essentials.Bridges
|
||||
{
|
||||
/// <summary>
|
||||
/// Base class for all bridge class variants
|
||||
/// </summary>
|
||||
public class BridgeBase : Device
|
||||
{
|
||||
public BridgeApi Api { get; private set; }
|
||||
|
||||
public BridgeBase(string key) :
|
||||
base(key)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Base class for bridge API variants
|
||||
/// </summary>
|
||||
public abstract class BridgeApi : Device
|
||||
{
|
||||
public BridgeApi(string key) :
|
||||
base(key)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Bridge API using EISC
|
||||
/// </summary>
|
||||
public class EiscApi : BridgeApi
|
||||
{
|
||||
public EiscApiPropertiesConfig PropertiesConfig { get; private set; }
|
||||
|
||||
public ThreeSeriesTcpIpEthernetIntersystemCommunications Eisc { get; private set; }
|
||||
|
||||
|
||||
public EiscApi(DeviceConfig dc) :
|
||||
base(dc.Key)
|
||||
{
|
||||
PropertiesConfig = JsonConvert.DeserializeObject<EiscApiPropertiesConfig>(dc.Properties.ToString());
|
||||
|
||||
Eisc = new ThreeSeriesTcpIpEthernetIntersystemCommunications(PropertiesConfig.Control.IpIdInt, PropertiesConfig.Control.TcpSshProperties.Address, Global.ControlSystem);
|
||||
|
||||
Eisc.SigChange += new Crestron.SimplSharpPro.DeviceSupport.SigEventHandler(Eisc_SigChange);
|
||||
|
||||
Eisc.Register();
|
||||
|
||||
AddPostActivationAction( () =>
|
||||
{
|
||||
Debug.Console(1, this, "Linking Devices...");
|
||||
|
||||
foreach (var d in PropertiesConfig.Devices)
|
||||
{
|
||||
var device = DeviceManager.GetDeviceForKey(d.DeviceKey);
|
||||
|
||||
if (device != null)
|
||||
{
|
||||
if (device is PepperDash.Essentials.Core.Monitoring.SystemMonitorController)
|
||||
{
|
||||
(device as PepperDash.Essentials.Core.Monitoring.SystemMonitorController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||
continue;
|
||||
}
|
||||
else if (device is GenericComm)
|
||||
{
|
||||
(device as GenericComm).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||
continue;
|
||||
}
|
||||
else if (device is CameraBase)
|
||||
{
|
||||
(device as CameraBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||
continue;
|
||||
}
|
||||
else if (device is PepperDash.Essentials.Core.TwoWayDisplayBase)
|
||||
{
|
||||
(device as TwoWayDisplayBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||
continue;
|
||||
}
|
||||
else if (device is DmChassisController)
|
||||
{
|
||||
(device as DmChassisController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||
continue;
|
||||
}
|
||||
|
||||
else if (device is DmTxControllerBase)
|
||||
{
|
||||
(device as DmTxControllerBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||
continue;
|
||||
}
|
||||
else if (device is DmRmcControllerBase)
|
||||
{
|
||||
(device as DmRmcControllerBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||
continue;
|
||||
}
|
||||
else if (device is GenericRelayDevice)
|
||||
{
|
||||
(device as GenericRelayDevice).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||
continue;
|
||||
}
|
||||
else if (device is IDigitalInput)
|
||||
{
|
||||
(device as IDigitalInput).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||
continue;
|
||||
}
|
||||
else if (device is LightingBase)
|
||||
{
|
||||
(device as LightingBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||
continue;
|
||||
}
|
||||
else if (device is DigitalLogger)
|
||||
{
|
||||
(device as DigitalLogger).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||
continue;
|
||||
}
|
||||
else if (device is TVOneCorio)
|
||||
{
|
||||
(device as TVOneCorio).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||
continue;
|
||||
}
|
||||
else if (device is QscDsp)
|
||||
{
|
||||
(device as QscDsp).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Debug.Console(1, this, "Devices Linked.");
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles incoming sig changes
|
||||
/// </summary>
|
||||
/// <param name="currentDevice"></param>
|
||||
/// <param name="args"></param>
|
||||
void Eisc_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args)
|
||||
{
|
||||
if (Debug.Level >= 1)
|
||||
Debug.Console(1, this, "EiscApi change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
|
||||
var uo = args.Sig.UserObject;
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
public class EiscApiPropertiesConfig
|
||||
{
|
||||
[JsonProperty("control")]
|
||||
public EssentialsControlPropertiesConfig Control { get; set; }
|
||||
|
||||
[JsonProperty("devices")]
|
||||
public List<ApiDevice> Devices { get; set; }
|
||||
|
||||
|
||||
public class ApiDevice
|
||||
{
|
||||
[JsonProperty("deviceKey")]
|
||||
public string DeviceKey { get; set; }
|
||||
|
||||
[JsonProperty("joinStart")]
|
||||
public uint JoinStart { get; set; }
|
||||
|
||||
[JsonProperty("joinMapKey")]
|
||||
public string JoinMapKey { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
141
PepperDashEssentials/Bridges/BridgeFactory.cs
Normal file
141
PepperDashEssentials/Bridges/BridgeFactory.cs
Normal file
@@ -0,0 +1,141 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.Routing;
|
||||
using PepperDash.Essentials.Bridges;
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.EthernetCommunication;
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
|
||||
{
|
||||
public class BridgeFactory
|
||||
{
|
||||
public static IKeyed GetDevice(DeviceConfig dc)
|
||||
{
|
||||
// ? why is this static JTA 2018-06-13?
|
||||
|
||||
var key = dc.Key;
|
||||
var name = dc.Name;
|
||||
var type = dc.Type;
|
||||
var properties = dc.Properties;
|
||||
var propAnon = new { };
|
||||
|
||||
var typeName = dc.Type.ToLower();
|
||||
var groupName = dc.Group.ToLower();
|
||||
|
||||
//Debug.Console(2, "Name {0}, Key {1}, Type {2}, Properties {3}", name, key, type, properties.ToString());
|
||||
|
||||
if (typeName == "eiscapi")
|
||||
{
|
||||
return new EiscApi(dc);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class CommBridge : Device
|
||||
{
|
||||
public CommBridgeProperties Properties { get; private set; }
|
||||
|
||||
public List<IBasicCommunication> CommDevices { get; private set; }
|
||||
|
||||
public CommBridge(string key, string name, JToken properties)
|
||||
: base(key, name)
|
||||
{
|
||||
Properties = JsonConvert.DeserializeObject<CommBridgeProperties>(properties.ToString());
|
||||
}
|
||||
|
||||
public override bool CustomActivate()
|
||||
{
|
||||
// Create EiscApis
|
||||
if (Properties.Eiscs != null)
|
||||
{
|
||||
foreach (var eisc in Properties.Eiscs)
|
||||
{
|
||||
var ApiEisc = new BridgeApiEisc(eisc.IpId, eisc.Hostname);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var deviceKey in Properties.CommDevices)
|
||||
{
|
||||
var device = DeviceManager.GetDeviceForKey(deviceKey);
|
||||
|
||||
if (device != null)
|
||||
{
|
||||
Debug.Console(0, "deviceKey {0} Found in Device Manager", device.Key);
|
||||
CommDevices.Add(device as IBasicCommunication);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(0, "deviceKey {0} Not Found in Device Manager", deviceKey);
|
||||
}
|
||||
}
|
||||
|
||||
// Iterate through all the CommDevices and link up their Actions and Feedbacks
|
||||
|
||||
Debug.Console(0, "Bridge {0} Activated", this.Name);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class EiscBridgeProperties
|
||||
{
|
||||
public string ParentDeviceKey { get; set; }
|
||||
public eApiType ApiType { get; set; }
|
||||
public List<EiscProperties> Eiscs { get; set; }
|
||||
public string ApiOverrideFilePath { get; set; }
|
||||
|
||||
public class EiscProperties
|
||||
{
|
||||
public string IpId { get; set; }
|
||||
public string Hostname { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
public class CommBridgeProperties : EiscBridgeProperties
|
||||
{
|
||||
public List<string> CommDevices { get; set; }
|
||||
}
|
||||
|
||||
public enum eApiType { Eisc = 0 }
|
||||
|
||||
public class BridgeApiEisc
|
||||
{
|
||||
public uint Ipid { get; private set; }
|
||||
public ThreeSeriesTcpIpEthernetIntersystemCommunications Eisc { get; private set; }
|
||||
|
||||
public BridgeApiEisc(string ipid, string hostname)
|
||||
{
|
||||
Ipid = (UInt32)int.Parse(ipid, System.Globalization.NumberStyles.HexNumber);
|
||||
Eisc = new ThreeSeriesTcpIpEthernetIntersystemCommunications(Ipid, hostname, Global.ControlSystem);
|
||||
Eisc.Register();
|
||||
Eisc.SigChange += Eisc_SigChange;
|
||||
Debug.Console(0, "BridgeApiEisc Created at Ipid {0}", ipid);
|
||||
}
|
||||
void Eisc_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args)
|
||||
{
|
||||
if (Debug.Level >= 1)
|
||||
Debug.Console(1, "BridgeApiEisc change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
|
||||
var uo = args.Sig.UserObject;
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
90
PepperDashEssentials/Bridges/Bridges.BridgeFactory.cs
Normal file
90
PepperDashEssentials/Bridges/Bridges.BridgeFactory.cs
Normal file
@@ -0,0 +1,90 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.Routing;
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.EthernetCommunication;
|
||||
using PepperDash.Essentials.Bridges;
|
||||
|
||||
namespace PepperDash.Essentials {
|
||||
public class BridgeFactory {
|
||||
public static IKeyed GetDevice(PepperDash.Essentials.Core.Config.DeviceConfig dc) {
|
||||
// ? why is this static JTA 2018-06-13?
|
||||
|
||||
var key = dc.Key;
|
||||
var name = dc.Name;
|
||||
var type = dc.Type;
|
||||
var properties = dc.Properties;
|
||||
var propAnon = new { };
|
||||
JsonConvert.DeserializeAnonymousType(dc.Properties.ToString(), propAnon);
|
||||
|
||||
var typeName = dc.Type.ToLower();
|
||||
var groupName = dc.Group.ToLower();
|
||||
|
||||
Debug.Console(2, "Name {0}, Key {1}, Type {2}, Properties {3}", name, key, type, properties.ToString());
|
||||
if (typeName == "essentialdm")
|
||||
{
|
||||
return new EssentialDM(key, name, properties);
|
||||
}
|
||||
else if (typeName == "essentialcomm")
|
||||
{
|
||||
Debug.Console(2, "Launch Essential Comm");
|
||||
return new EssentialComm(key, name, properties);
|
||||
}
|
||||
else if (typeName == "essentialdsp")
|
||||
{
|
||||
Debug.Console(2, "Launch EssentialDsp");
|
||||
return new EssentialDsp(key, name, properties);
|
||||
}
|
||||
else if (typeName == "essentialstvone")
|
||||
{
|
||||
Debug.Console(2, "Launch essentialstvone");
|
||||
return new EssentialsTVOne(key, name, properties);
|
||||
}
|
||||
else if (typeName == "essentialslighting")
|
||||
{
|
||||
Debug.Console(2, "Launch essentialslighting");
|
||||
return new EssentialsLightsBridge(key, name, properties);
|
||||
}
|
||||
else if (typeName == "eiscapi")
|
||||
{
|
||||
return new EiscApi(dc);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public class BridgeApiEisc {
|
||||
public uint Ipid;
|
||||
public ThreeSeriesTcpIpEthernetIntersystemCommunications Eisc;
|
||||
public BridgeApiEisc(string ipid) {
|
||||
Ipid = (UInt32)int.Parse(ipid, System.Globalization.NumberStyles.HexNumber);
|
||||
Eisc = new ThreeSeriesTcpIpEthernetIntersystemCommunications(Ipid, "127.0.0.2", Global.ControlSystem);
|
||||
Eisc.Register();
|
||||
Eisc.SigChange += Eisc_SigChange;
|
||||
Debug.Console(2, "BridgeApiEisc Created at Ipid {0}", ipid);
|
||||
}
|
||||
void Eisc_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args) {
|
||||
if (Debug.Level >= 1)
|
||||
Debug.Console(2, "DDVC EISC change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
|
||||
var uo = args.Sig.UserObject;
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
187
PepperDashEssentials/Bridges/CameraControllerBridge.cs
Normal file
187
PepperDashEssentials/Bridges/CameraControllerBridge.cs
Normal file
@@ -0,0 +1,187 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Devices.Common;
|
||||
|
||||
namespace PepperDash.Essentials.Bridges
|
||||
{
|
||||
public static class CameraControllerApiExtensions
|
||||
{
|
||||
|
||||
public static BasicTriList _TriList;
|
||||
public static CameraControllerJoinMap JoinMap;
|
||||
public static void LinkToApi(this PepperDash.Essentials.Devices.Common.Cameras.CameraBase cameraDevice, BasicTriList trilist, uint joinStart, string joinMapKey)
|
||||
{
|
||||
JoinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as CameraControllerJoinMap;
|
||||
|
||||
_TriList = trilist;
|
||||
if (JoinMap == null)
|
||||
{
|
||||
JoinMap = new CameraControllerJoinMap();
|
||||
}
|
||||
|
||||
JoinMap.OffsetJoinNumbers(joinStart);
|
||||
Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||
Debug.Console(0, "Linking to Bridge Type {0}", cameraDevice.GetType().Name.ToString());
|
||||
|
||||
var commMonitor = cameraDevice as ICommunicationMonitor;
|
||||
commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[JoinMap.IsOnline]);
|
||||
|
||||
|
||||
trilist.SetBoolSigAction(JoinMap.Left, (b) =>
|
||||
{
|
||||
if (b)
|
||||
{
|
||||
cameraDevice.PanLeft();
|
||||
}
|
||||
else
|
||||
{
|
||||
cameraDevice.Stop();
|
||||
}
|
||||
});
|
||||
trilist.SetBoolSigAction(JoinMap.Right, (b) =>
|
||||
{
|
||||
if (b)
|
||||
{
|
||||
cameraDevice.PanRight();
|
||||
}
|
||||
else
|
||||
{
|
||||
cameraDevice.Stop();
|
||||
}
|
||||
});
|
||||
|
||||
trilist.SetBoolSigAction(JoinMap.Up, (b) =>
|
||||
{
|
||||
if (b)
|
||||
{
|
||||
cameraDevice.TiltUp();
|
||||
}
|
||||
else
|
||||
{
|
||||
cameraDevice.Stop();
|
||||
}
|
||||
});
|
||||
trilist.SetBoolSigAction(JoinMap.Down, (b) =>
|
||||
{
|
||||
if (b)
|
||||
{
|
||||
cameraDevice.TiltDown();
|
||||
}
|
||||
else
|
||||
{
|
||||
cameraDevice.Stop();
|
||||
}
|
||||
});
|
||||
|
||||
trilist.SetBoolSigAction(JoinMap.ZoomIn, (b) =>
|
||||
{
|
||||
if (b)
|
||||
{
|
||||
cameraDevice.ZoomIn();
|
||||
}
|
||||
else
|
||||
{
|
||||
cameraDevice.Stop();
|
||||
}
|
||||
});
|
||||
|
||||
trilist.SetBoolSigAction(JoinMap.ZoomOut, (b) =>
|
||||
{
|
||||
if (b)
|
||||
{
|
||||
cameraDevice.ZoomOut();
|
||||
}
|
||||
else
|
||||
{
|
||||
cameraDevice.Stop();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
if (cameraDevice.GetType().Name.ToString().ToLower() == "cameravisca")
|
||||
{
|
||||
var viscaCamera = cameraDevice as PepperDash.Essentials.Devices.Common.Cameras.CameraVisca;
|
||||
trilist.SetSigTrueAction(JoinMap.PowerOn, () => viscaCamera.PowerOn());
|
||||
trilist.SetSigTrueAction(JoinMap.PowerOff, () => viscaCamera.PowerOff());
|
||||
|
||||
viscaCamera.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[JoinMap.PowerOn]);
|
||||
viscaCamera.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[JoinMap.PowerOff]);
|
||||
|
||||
viscaCamera.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[JoinMap.IsOnline]);
|
||||
for (int i = 0; i < JoinMap.NumberOfPresets; i++)
|
||||
{
|
||||
int tempNum = i;
|
||||
trilist.SetSigTrueAction((ushort)(JoinMap.PresetRecallOffset + tempNum), () =>
|
||||
{
|
||||
viscaCamera.RecallPreset(tempNum);
|
||||
});
|
||||
trilist.SetSigTrueAction((ushort)(JoinMap.PresetSaveOffset + tempNum), () =>
|
||||
{
|
||||
viscaCamera.SavePreset(tempNum);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
public class CameraControllerJoinMap : JoinMapBase
|
||||
{
|
||||
public uint IsOnline { get; set; }
|
||||
public uint PowerOff { get; set; }
|
||||
public uint PowerOn { get; set; }
|
||||
public uint Up { get; set; }
|
||||
public uint Down { get; set; }
|
||||
public uint Left { get; set; }
|
||||
public uint Right { get; set; }
|
||||
public uint ZoomIn { get; set; }
|
||||
public uint ZoomOut { get; set; }
|
||||
public uint PresetRecallOffset { get; set; }
|
||||
public uint PresetSaveOffset { get; set; }
|
||||
public uint NumberOfPresets { get; set; }
|
||||
|
||||
public CameraControllerJoinMap()
|
||||
{
|
||||
// Digital
|
||||
IsOnline = 9;
|
||||
PowerOff = 8;
|
||||
PowerOn = 7;
|
||||
Up = 1;
|
||||
Down = 2;
|
||||
Left = 3;
|
||||
Right = 4;
|
||||
ZoomIn = 5;
|
||||
ZoomOut = 6;
|
||||
PresetRecallOffset = 10;
|
||||
PresetSaveOffset = 30;
|
||||
NumberOfPresets = 5;
|
||||
// Analog
|
||||
}
|
||||
|
||||
public override void OffsetJoinNumbers(uint joinStart)
|
||||
{
|
||||
var joinOffset = joinStart - 1;
|
||||
|
||||
IsOnline = IsOnline + joinOffset;
|
||||
PowerOff = PowerOff + joinOffset;
|
||||
PowerOn = PowerOn + joinOffset;
|
||||
Up = Up + joinOffset;
|
||||
Down = Down + joinOffset;
|
||||
Left = Left + joinOffset;
|
||||
Right = Right + joinOffset;
|
||||
ZoomIn = ZoomIn + joinOffset;
|
||||
ZoomOut = ZoomOut + joinOffset;
|
||||
PresetRecallOffset = PresetRecallOffset + joinOffset;
|
||||
PresetSaveOffset = PresetSaveOffset + joinOffset;
|
||||
}
|
||||
}
|
||||
}
|
||||
77
PepperDashEssentials/Bridges/DigitalLoggerBridge.cs
Normal file
77
PepperDashEssentials/Bridges/DigitalLoggerBridge.cs
Normal file
@@ -0,0 +1,77 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Devices.Common;
|
||||
|
||||
namespace PepperDash.Essentials.Bridges
|
||||
{
|
||||
public static class DigitalLoggerApiExtensions
|
||||
{
|
||||
public static void LinkToApi(this DigitalLogger DigitalLogger, BasicTriList trilist, uint joinStart, string joinMapKey)
|
||||
{
|
||||
var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as DigitalLoggerJoinMap;
|
||||
|
||||
if (joinMap == null)
|
||||
joinMap = new DigitalLoggerJoinMap();
|
||||
|
||||
joinMap.OffsetJoinNumbers(joinStart);
|
||||
Debug.Console(1, DigitalLogger, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||
for (uint i = 1; i <= DigitalLogger.CircuitCount; i++)
|
||||
{
|
||||
var circuit = i;
|
||||
DigitalLogger.CircuitNameFeedbacks[circuit - 1].LinkInputSig(trilist.StringInput[joinMap.CircuitNames + circuit]);
|
||||
DigitalLogger.CircuitIsCritical[circuit - 1].LinkInputSig(trilist.BooleanInput[joinMap.CircuitIsCritical + circuit]);
|
||||
DigitalLogger.CircuitState[circuit - 1].LinkInputSig(trilist.BooleanInput[joinMap.CircuitState + circuit]);
|
||||
trilist.SetSigTrueAction(joinMap.CircuitCycle + circuit, () => DigitalLogger.CycleCircuit(circuit - 1));
|
||||
trilist.SetSigTrueAction(joinMap.CircuitOnCmd + circuit, () => DigitalLogger.TurnOnCircuit(circuit - 1));
|
||||
trilist.SetSigTrueAction(joinMap.CircuitOffCmd + circuit, () => DigitalLogger.TurnOffCircuit(circuit - 1));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
public class DigitalLoggerJoinMap : JoinMapBase
|
||||
{
|
||||
public uint IsOnline { get; set; }
|
||||
public uint CircuitNames { get; set; }
|
||||
public uint CircuitState { get; set; }
|
||||
public uint CircuitCycle { get; set; }
|
||||
public uint CircuitIsCritical { get; set; }
|
||||
public uint CircuitOnCmd { get; set; }
|
||||
public uint CircuitOffCmd { get; set; }
|
||||
public DigitalLoggerJoinMap()
|
||||
{
|
||||
// Digital
|
||||
IsOnline = 9;
|
||||
CircuitState = 0;
|
||||
CircuitCycle = 0;
|
||||
CircuitIsCritical = 10;
|
||||
CircuitOnCmd = 10;
|
||||
CircuitOffCmd = 20;
|
||||
// Serial
|
||||
CircuitNames = 0;
|
||||
// Analog
|
||||
}
|
||||
|
||||
public override void OffsetJoinNumbers(uint joinStart)
|
||||
{
|
||||
var joinOffset = joinStart - 1;
|
||||
|
||||
IsOnline = IsOnline + joinOffset;
|
||||
CircuitNames = CircuitNames + joinOffset;
|
||||
CircuitState = CircuitState + joinOffset;
|
||||
CircuitCycle = CircuitCycle + joinOffset;
|
||||
CircuitIsCritical = CircuitIsCritical + joinOffset;
|
||||
CircuitOnCmd = CircuitOnCmd + joinOffset;
|
||||
CircuitOffCmd = CircuitOffCmd + joinOffset;
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
171
PepperDashEssentials/Bridges/DisplayControllerBridge.cs
Normal file
171
PepperDashEssentials/Bridges/DisplayControllerBridge.cs
Normal file
@@ -0,0 +1,171 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Devices.Common;
|
||||
|
||||
namespace PepperDash.Essentials.Bridges
|
||||
{
|
||||
public static class DisplayControllerApiExtensions
|
||||
{
|
||||
|
||||
public static BasicTriList _TriList;
|
||||
public static DisplayControllerJoinMap JoinMap;
|
||||
public static int InputNumber;
|
||||
public static IntFeedback InputNumberFeedback;
|
||||
public static List<string> InputKeys = new List<string>();
|
||||
public static void LinkToApi(this PepperDash.Essentials.Core.TwoWayDisplayBase displayDevice, BasicTriList trilist, uint joinStart, string joinMapKey)
|
||||
{
|
||||
JoinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as DisplayControllerJoinMap;
|
||||
_TriList = trilist;
|
||||
|
||||
if (JoinMap == null)
|
||||
{
|
||||
JoinMap = new DisplayControllerJoinMap();
|
||||
}
|
||||
|
||||
JoinMap.OffsetJoinNumbers(joinStart);
|
||||
Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||
Debug.Console(0, "Linking to Bridge Type {0}", displayDevice.GetType().Name.ToString());
|
||||
|
||||
trilist.StringInput[JoinMap.Name].StringValue = displayDevice.GetType().Name.ToString();
|
||||
|
||||
InputNumberFeedback = new IntFeedback(() => { return InputNumber;});
|
||||
InputNumberFeedback.LinkInputSig(trilist.UShortInput[JoinMap.InputSelect]);
|
||||
var commMonitor = displayDevice as ICommunicationMonitor;
|
||||
commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[JoinMap.IsOnline]);
|
||||
|
||||
// Poewer Off
|
||||
trilist.SetSigTrueAction(JoinMap.PowerOff, () =>
|
||||
{
|
||||
InputNumber = 102;
|
||||
InputNumberFeedback.FireUpdate();
|
||||
displayDevice.PowerOff();
|
||||
});
|
||||
|
||||
displayDevice.PowerIsOnFeedback.OutputChange += new EventHandler<FeedbackEventArgs>(PowerIsOnFeedback_OutputChange);
|
||||
displayDevice.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[JoinMap.PowerOff]);
|
||||
|
||||
// Poewer On
|
||||
trilist.SetSigTrueAction(JoinMap.PowerOn, () =>
|
||||
{
|
||||
InputNumber = 0;
|
||||
InputNumberFeedback.FireUpdate();
|
||||
displayDevice.PowerOn();
|
||||
});
|
||||
|
||||
|
||||
displayDevice.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[JoinMap.PowerOn]);
|
||||
|
||||
int count = 1;
|
||||
foreach (var input in displayDevice.InputPorts)
|
||||
{
|
||||
InputKeys.Add(input.Key.ToString());
|
||||
var tempKey = InputKeys.ElementAt(count - 1);
|
||||
trilist.SetSigTrueAction((ushort)(JoinMap.InputSelectOffset + count), () => { displayDevice.ExecuteSwitch(displayDevice.InputPorts[tempKey].Selector); });
|
||||
trilist.StringInput[(ushort)(JoinMap.InputNamesOffset + count)].StringValue = input.Key.ToString();
|
||||
count++;
|
||||
}
|
||||
|
||||
displayDevice.CurrentInputFeedback.OutputChange += new EventHandler<FeedbackEventArgs>(CurrentInputFeedback_OutputChange);
|
||||
trilist.SetUShortSigAction(JoinMap.InputSelect, (a) =>
|
||||
{
|
||||
if (a == 0)
|
||||
{
|
||||
displayDevice.PowerOff();
|
||||
InputNumber = 0;
|
||||
}
|
||||
else if (a > 0 && a < displayDevice.InputPorts.Count && a != InputNumber)
|
||||
{
|
||||
displayDevice.ExecuteSwitch(displayDevice.InputPorts.ElementAt(a - 1).Selector);
|
||||
InputNumber = a;
|
||||
}
|
||||
else if (a == 102)
|
||||
{
|
||||
displayDevice.PowerToggle();
|
||||
|
||||
}
|
||||
InputNumberFeedback.FireUpdate();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
static void CurrentInputFeedback_OutputChange(object sender, FeedbackEventArgs e)
|
||||
{
|
||||
|
||||
Debug.Console(0, "CurrentInputFeedback_OutputChange {0}", e.StringValue);
|
||||
|
||||
}
|
||||
|
||||
static void PowerIsOnFeedback_OutputChange(object sender, FeedbackEventArgs e)
|
||||
{
|
||||
|
||||
// Debug.Console(0, "PowerIsOnFeedback_OutputChange {0}", e.BoolValue);
|
||||
if (!e.BoolValue)
|
||||
{
|
||||
InputNumber = 102;
|
||||
InputNumberFeedback.FireUpdate();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
InputNumber = 0;
|
||||
InputNumberFeedback.FireUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
public class DisplayControllerJoinMap : JoinMapBase
|
||||
{
|
||||
public uint Name { get; set; }
|
||||
public uint InputNamesOffset { get; set; }
|
||||
public uint InputSelectOffset { get; set; }
|
||||
public uint IsOnline { get; set; }
|
||||
public uint PowerOff { get; set; }
|
||||
public uint InputSelect { get; set; }
|
||||
public uint PowerOn { get; set; }
|
||||
public uint SelectScene { get; set; }
|
||||
public uint LightingSceneOffset { get; set; }
|
||||
public uint ButtonVisibilityOffset { get; set; }
|
||||
public uint IntegrationIdSet { get; set; }
|
||||
|
||||
public DisplayControllerJoinMap()
|
||||
{
|
||||
// Digital
|
||||
IsOnline = 50;
|
||||
PowerOff = 1;
|
||||
PowerOn = 2;
|
||||
InputSelect = 4;
|
||||
IntegrationIdSet = 1;
|
||||
LightingSceneOffset = 10;
|
||||
ButtonVisibilityOffset = 40;
|
||||
Name = 1;
|
||||
InputNamesOffset = 10;
|
||||
InputSelectOffset = 4;
|
||||
// Analog
|
||||
}
|
||||
|
||||
public override void OffsetJoinNumbers(uint joinStart)
|
||||
{
|
||||
var joinOffset = joinStart - 1;
|
||||
|
||||
IsOnline = IsOnline + joinOffset;
|
||||
PowerOff = PowerOff + joinOffset;
|
||||
PowerOn = PowerOn + joinOffset;
|
||||
SelectScene = SelectScene + joinOffset;
|
||||
LightingSceneOffset = LightingSceneOffset + joinOffset;
|
||||
ButtonVisibilityOffset = ButtonVisibilityOffset + joinOffset;
|
||||
Name = Name + joinOffset;
|
||||
InputNamesOffset = InputNamesOffset + joinOffset;
|
||||
InputSelectOffset = InputSelectOffset + joinOffset;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
130
PepperDashEssentials/Bridges/DmChassisControllerBridge.cs
Normal file
130
PepperDashEssentials/Bridges/DmChassisControllerBridge.cs
Normal file
@@ -0,0 +1,130 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.DM;
|
||||
|
||||
namespace PepperDash.Essentials.Bridges
|
||||
{
|
||||
public static class DmChassisControllerApiExtentions
|
||||
{
|
||||
public static void LinkToApi(this DmChassisController dmChassis, BasicTriList trilist, uint joinStart, string joinMapKey)
|
||||
{
|
||||
var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as DmChassisControllerJoinMap;
|
||||
|
||||
if (joinMap == null)
|
||||
joinMap = new DmChassisControllerJoinMap();
|
||||
|
||||
joinMap.OffsetJoinNumbers(joinStart);
|
||||
|
||||
Debug.Console(1, dmChassis, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||
|
||||
dmChassis.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]);
|
||||
|
||||
// Link up outputs
|
||||
for (uint i = 1; i <= dmChassis.Chassis.NumberOfOutputs - 1; i++)
|
||||
{
|
||||
var ioSlot = i;
|
||||
|
||||
// Control
|
||||
trilist.SetUShortSigAction(joinMap.OutputVideo + ioSlot, new Action<ushort>(o => dmChassis.ExecuteSwitch(o, ioSlot, eRoutingSignalType.Video)));
|
||||
trilist.SetUShortSigAction(joinMap.OutputAudio + ioSlot, new Action<ushort>(o => dmChassis.ExecuteSwitch(o, ioSlot, eRoutingSignalType.Audio)));
|
||||
if (dmChassis.TxDictionary.ContainsKey(ioSlot))
|
||||
{
|
||||
Debug.Console(2, "Creating Tx Feedbacks {0}", ioSlot);
|
||||
var TxKey = dmChassis.TxDictionary[ioSlot];
|
||||
var TxDevice = DeviceManager.GetDeviceForKey(TxKey) as DmTxControllerBase;
|
||||
TxDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]);
|
||||
// TxDevice.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]);
|
||||
// trilist.SetUShortSigAction((ApiMap.HdcpSupport[ioSlot]), u => TxDevice.SetHdcpSupportAll((ePdtHdcpSupport)(u)));
|
||||
// TxDevice.HdcpSupportAllFeedback.LinkInputSig(trilist.UShortInput[joinMap. + ioSlot]);
|
||||
// trilist.UShortInput[ApiMap.HdcpSupportCapability[ioSlot]].UShortValue = TxDevice.HdcpSupportCapability;
|
||||
}
|
||||
else
|
||||
{
|
||||
// dmChassis.VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[ApiMap.TxVideoSyncStatus[ioSlot]]);
|
||||
}
|
||||
if (dmChassis.RxDictionary.ContainsKey(ioSlot))
|
||||
{
|
||||
Debug.Console(2, "Creating Rx Feedbacks {0}", ioSlot);
|
||||
var RxKey = dmChassis.RxDictionary[ioSlot];
|
||||
var RxDevice = DeviceManager.GetDeviceForKey(RxKey) as DmRmcControllerBase;
|
||||
RxDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline + ioSlot]);
|
||||
}
|
||||
// Feedback
|
||||
dmChassis.VideoOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputVideo + ioSlot]);
|
||||
dmChassis.AudioOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputAudio + ioSlot]);
|
||||
|
||||
dmChassis.VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus + ioSlot]);
|
||||
|
||||
dmChassis.OutputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputNames + ioSlot]);
|
||||
dmChassis.InputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.InputNames + ioSlot]);
|
||||
dmChassis.OutputVideoRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentVideoInputNames + ioSlot]);
|
||||
dmChassis.OutputAudioRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentAudioInputNames + ioSlot]);
|
||||
// dmChassis.InputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]);
|
||||
// dmChassis.OutputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline + ioSlot]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class DmChassisControllerJoinMap : JoinMapBase
|
||||
{
|
||||
public uint IsOnline { get; set; }
|
||||
public uint OutputVideo { get; set; }
|
||||
public uint OutputAudio { get; set; }
|
||||
public uint VideoSyncStatus { get; set; }
|
||||
public uint InputNames { get; set; }
|
||||
public uint OutputNames { get; set; }
|
||||
public uint OutputCurrentVideoInputNames { get; set; }
|
||||
public uint OutputCurrentAudioInputNames { get; set; }
|
||||
public uint InputCurrentResolution { get; set; }
|
||||
public uint InputEndpointOnline { get; set; }
|
||||
public uint OutputEndpointOnline { get; set; }
|
||||
//public uint HdcpSupport { get; set; }
|
||||
//public uint HdcpSupportCapability { get; set; }
|
||||
|
||||
|
||||
public DmChassisControllerJoinMap()
|
||||
{
|
||||
IsOnline = 11;
|
||||
OutputVideo = 100; //101-299
|
||||
OutputAudio = 300; //301-499
|
||||
VideoSyncStatus = 100; //101-299
|
||||
InputNames = 100; //101-299
|
||||
OutputNames = 300; //301-499
|
||||
OutputCurrentVideoInputNames = 2000; //2001-2199
|
||||
OutputCurrentAudioInputNames = 2200; //2201-2399
|
||||
InputCurrentResolution = 2400; // 2401-2599
|
||||
InputEndpointOnline = 500;
|
||||
OutputEndpointOnline = 700;
|
||||
//HdcpSupport = 1000; //1001-1199
|
||||
//HdcpSupportCapability = 1200; //1201-1399
|
||||
|
||||
}
|
||||
|
||||
public override void OffsetJoinNumbers(uint joinStart)
|
||||
{
|
||||
var joinOffset = joinStart - 1;
|
||||
|
||||
IsOnline = IsOnline + joinOffset;
|
||||
OutputVideo = OutputVideo + joinOffset;
|
||||
OutputAudio = OutputAudio + joinOffset;
|
||||
VideoSyncStatus = VideoSyncStatus + joinOffset;
|
||||
InputNames = InputNames + joinOffset;
|
||||
OutputNames = OutputNames + joinOffset;
|
||||
OutputCurrentVideoInputNames = OutputCurrentVideoInputNames + joinOffset;
|
||||
OutputCurrentAudioInputNames = OutputCurrentAudioInputNames + joinOffset;
|
||||
InputCurrentResolution = InputCurrentResolution + joinOffset;
|
||||
InputEndpointOnline = InputEndpointOnline + joinOffset;
|
||||
OutputEndpointOnline = OutputEndpointOnline + joinOffset;
|
||||
//HdcpSupport = HdcpSupport + joinOffset;
|
||||
//HdcpSupportCapability = HdcpSupportCapability + joinOffset;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
75
PepperDashEssentials/Bridges/DmRmcControllerBridge.cs
Normal file
75
PepperDashEssentials/Bridges/DmRmcControllerBridge.cs
Normal file
@@ -0,0 +1,75 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.DM;
|
||||
|
||||
namespace PepperDash.Essentials.Bridges
|
||||
{
|
||||
public static class DmRmcControllerApiExtensions
|
||||
{
|
||||
public static void LinkToApi(this DmRmcControllerBase rmc, BasicTriList trilist, uint joinStart, string joinMapKey)
|
||||
{
|
||||
var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as DmRmcControllerJoinMap;
|
||||
|
||||
if (joinMap == null)
|
||||
joinMap = new DmRmcControllerJoinMap();
|
||||
|
||||
joinMap.OffsetJoinNumbers(joinStart);
|
||||
|
||||
Debug.Console(1, rmc, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||
|
||||
rmc.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]);
|
||||
if(rmc.VideoOutputResolutionFeedback != null)
|
||||
rmc.VideoOutputResolutionFeedback.LinkInputSig(trilist.StringInput[joinMap.CurrentOutputResolution]);
|
||||
if(rmc.EdidManufacturerFeedback != null)
|
||||
rmc.EdidManufacturerFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidManufacturer]);
|
||||
if(rmc.EdidNameFeedback != null)
|
||||
rmc.EdidNameFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidName]);
|
||||
if(rmc.EdidPreferredTimingFeedback != null)
|
||||
rmc.EdidPreferredTimingFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidPrefferedTiming]);
|
||||
if(rmc.EdidSerialNumberFeedback != null)
|
||||
rmc.EdidSerialNumberFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidSerialNumber]);
|
||||
}
|
||||
|
||||
public class DmRmcControllerJoinMap : JoinMapBase
|
||||
{
|
||||
public uint IsOnline { get; set; }
|
||||
public uint CurrentOutputResolution { get; set; }
|
||||
public uint EdidManufacturer { get; set; }
|
||||
public uint EdidName { get; set; }
|
||||
public uint EdidPrefferedTiming { get; set; }
|
||||
public uint EdidSerialNumber { get; set; }
|
||||
|
||||
public DmRmcControllerJoinMap()
|
||||
{
|
||||
// Digital
|
||||
IsOnline = 1;
|
||||
|
||||
// Serial
|
||||
CurrentOutputResolution = 1;
|
||||
EdidManufacturer = 2;
|
||||
EdidName = 3;
|
||||
EdidPrefferedTiming = 4;
|
||||
EdidSerialNumber = 5;
|
||||
}
|
||||
|
||||
public override void OffsetJoinNumbers(uint joinStart)
|
||||
{
|
||||
var joinOffset = joinStart - 1;
|
||||
|
||||
IsOnline = IsOnline + joinOffset;
|
||||
CurrentOutputResolution = CurrentOutputResolution + joinOffset;
|
||||
EdidManufacturer = EdidManufacturer + joinOffset;
|
||||
EdidName = EdidName + joinOffset;
|
||||
EdidPrefferedTiming = EdidPrefferedTiming + joinOffset;
|
||||
EdidSerialNumber = EdidSerialNumber + joinOffset;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
173
PepperDashEssentials/Bridges/DmTxControllerBridge.cs
Normal file
173
PepperDashEssentials/Bridges/DmTxControllerBridge.cs
Normal file
@@ -0,0 +1,173 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro.DM;
|
||||
using Crestron.SimplSharpPro.DM.Endpoints;
|
||||
using Crestron.SimplSharpPro.DM.Endpoints.Transmitters;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.DM;
|
||||
|
||||
namespace PepperDash.Essentials.Bridges
|
||||
{
|
||||
public static class DmTxControllerApiExtensions
|
||||
{
|
||||
public static void LinkToApi(this DmTxControllerBase tx, BasicTriList trilist, uint joinStart, string joinMapKey)
|
||||
{
|
||||
var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as DmTxControllerJoinMap;
|
||||
|
||||
if (joinMap == null)
|
||||
joinMap = new DmTxControllerJoinMap();
|
||||
|
||||
joinMap.OffsetJoinNumbers(joinStart);
|
||||
|
||||
Debug.Console(1, tx, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||
|
||||
tx.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]);
|
||||
tx.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus]);
|
||||
tx.AnyVideoInput.VideoStatus.VideoResolutionFeedback.LinkInputSig(trilist.StringInput[joinMap.CurrentInputResolution]);
|
||||
//tx.HdcpSupportAllFeedback.LinkInputSig(trilist.UShortInput[joinMap.HdcpSupportCapability]);
|
||||
|
||||
bool hdcpTypeSimple;
|
||||
|
||||
if (tx.Hardware is DmTx4kX02CBase || tx.Hardware is DmTx4kzX02CBase)
|
||||
hdcpTypeSimple = false;
|
||||
else
|
||||
hdcpTypeSimple = true;
|
||||
|
||||
if (tx is ITxRouting)
|
||||
{
|
||||
var txR = tx as ITxRouting;
|
||||
|
||||
trilist.SetUShortSigAction(joinMap.VideoInput,
|
||||
new Action<ushort>(i => txR.ExecuteNumericSwitch(i, 0, eRoutingSignalType.Video)));
|
||||
trilist.SetUShortSigAction(joinMap.AudioInput,
|
||||
new Action<ushort>(i => txR.ExecuteNumericSwitch(i, 0, eRoutingSignalType.Audio)));
|
||||
|
||||
txR.VideoSourceNumericFeedback.LinkInputSig(trilist.UShortInput[joinMap.VideoInput]);
|
||||
txR.AudioSourceNumericFeedback.LinkInputSig(trilist.UShortInput[joinMap.AudioInput]);
|
||||
|
||||
trilist.UShortInput[joinMap.HdcpSupportCapability].UShortValue = (ushort)tx.HdcpSupportCapability;
|
||||
|
||||
if(txR.InputPorts[DmPortName.HdmiIn] != null)
|
||||
{
|
||||
var inputPort = txR.InputPorts[DmPortName.HdmiIn];
|
||||
|
||||
if (tx.Feedbacks["HdmiInHdcpCapability"] != null)
|
||||
(tx.Feedbacks["HdmiInHdcpCapability"] as IntFeedback).LinkInputSig(trilist.UShortInput[joinMap.Port1HdcpState]);
|
||||
|
||||
if (inputPort.ConnectionType == eRoutingPortConnectionType.Hdmi && inputPort.Port != null)
|
||||
{
|
||||
var port = inputPort.Port as EndpointHdmiInput;
|
||||
|
||||
SetHdcpCapabilityAction(hdcpTypeSimple, port, joinMap.Port1HdcpState, trilist);
|
||||
}
|
||||
}
|
||||
|
||||
if (txR.InputPorts[DmPortName.HdmiIn1] != null)
|
||||
{
|
||||
var inputPort = txR.InputPorts[DmPortName.HdmiIn1];
|
||||
|
||||
if (tx.Feedbacks["HdmiIn1HdcpCapability"] != null)
|
||||
(tx.Feedbacks["HdmiIn1HdcpCapability"] as IntFeedback).LinkInputSig(trilist.UShortInput[joinMap.Port1HdcpState]);
|
||||
|
||||
if (inputPort.ConnectionType == eRoutingPortConnectionType.Hdmi && inputPort.Port != null)
|
||||
{
|
||||
var port = inputPort.Port as EndpointHdmiInput;
|
||||
|
||||
SetHdcpCapabilityAction(hdcpTypeSimple, port, joinMap.Port1HdcpState, trilist);
|
||||
}
|
||||
}
|
||||
|
||||
if (txR.InputPorts[DmPortName.HdmiIn2] != null)
|
||||
{
|
||||
var inputPort = txR.InputPorts[DmPortName.HdmiIn2];
|
||||
|
||||
if (tx.Feedbacks["HdmiIn2HdcpCapability"] != null)
|
||||
(tx.Feedbacks["HdmiIn2HdcpCapability"] as IntFeedback).LinkInputSig(trilist.UShortInput[joinMap.Port1HdcpState]);
|
||||
|
||||
if (inputPort.ConnectionType == eRoutingPortConnectionType.Hdmi && inputPort.Port != null)
|
||||
{
|
||||
var port = inputPort.Port as EndpointHdmiInput;
|
||||
|
||||
SetHdcpCapabilityAction(hdcpTypeSimple, port, joinMap.Port2HdcpState, trilist);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
static void SetHdcpCapabilityAction(bool hdcpTypeSimple, EndpointHdmiInput port, uint join, BasicTriList trilist)
|
||||
{
|
||||
if (hdcpTypeSimple)
|
||||
{
|
||||
trilist.SetUShortSigAction(join,
|
||||
new Action<ushort>(s =>
|
||||
{
|
||||
if (s == 0)
|
||||
{
|
||||
port.HdcpSupportOff();
|
||||
}
|
||||
else if (s > 0)
|
||||
{
|
||||
port.HdcpSupportOn();
|
||||
}
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
trilist.SetUShortSigAction(join,
|
||||
new Action<ushort>(s =>
|
||||
{
|
||||
port.HdcpCapability = (eHdcpCapabilityType)s;
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
public class DmTxControllerJoinMap : JoinMapBase
|
||||
{
|
||||
public uint IsOnline { get; set; }
|
||||
public uint VideoSyncStatus { get; set; }
|
||||
public uint CurrentInputResolution { get; set; }
|
||||
public uint HdcpSupportCapability { get; set; }
|
||||
public uint VideoInput { get; set; }
|
||||
public uint AudioInput { get; set; }
|
||||
public uint Port1HdcpState { get; set; }
|
||||
public uint Port2HdcpState { get; set; }
|
||||
|
||||
|
||||
public DmTxControllerJoinMap()
|
||||
{
|
||||
// Digital
|
||||
IsOnline = 1;
|
||||
VideoSyncStatus = 2;
|
||||
// Serial
|
||||
CurrentInputResolution = 1;
|
||||
// Analog
|
||||
VideoInput = 1;
|
||||
AudioInput = 2;
|
||||
HdcpSupportCapability = 3;
|
||||
Port1HdcpState = 4;
|
||||
Port2HdcpState = 5;
|
||||
}
|
||||
|
||||
public override void OffsetJoinNumbers(uint joinStart)
|
||||
{
|
||||
var joinOffset = joinStart - 1;
|
||||
|
||||
IsOnline = IsOnline + joinOffset;
|
||||
VideoSyncStatus = VideoSyncStatus + joinOffset;
|
||||
CurrentInputResolution = CurrentInputResolution + joinOffset;
|
||||
VideoInput = VideoInput + joinOffset;
|
||||
AudioInput = AudioInput + joinOffset;
|
||||
HdcpSupportCapability = HdcpSupportCapability + joinOffset;
|
||||
Port1HdcpState = Port1HdcpState + joinOffset;
|
||||
Port2HdcpState = Port2HdcpState + joinOffset;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
120
PepperDashEssentials/Bridges/DspControllerBridge.cs
Normal file
120
PepperDashEssentials/Bridges/DspControllerBridge.cs
Normal file
@@ -0,0 +1,120 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Devices.Common;
|
||||
|
||||
namespace PepperDash.Essentials.Bridges
|
||||
{
|
||||
public static class SamsungDisplayControllerApiExtensions
|
||||
{
|
||||
public static void LinkToApi(this PepperDash.Essentials.Core.TwoWayDisplayBase displayDevice, BasicTriList trilist, uint joinStart, string joinMapKey)
|
||||
{
|
||||
var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as DisplayControllerJoinMap;
|
||||
|
||||
if (joinMap == null)
|
||||
{
|
||||
joinMap = new DisplayControllerJoinMap();
|
||||
}
|
||||
|
||||
joinMap.OffsetJoinNumbers(joinStart);
|
||||
Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||
Debug.Console(0, "Linking to lighting Type {0}", displayDevice.GetType().Name.ToString());
|
||||
|
||||
var commMonitor = displayDevice as ICommunicationMonitor;
|
||||
commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]);
|
||||
|
||||
|
||||
// Poewer Off
|
||||
trilist.SetSigTrueAction(joinMap.PowerOff, () => displayDevice.PowerOff());
|
||||
displayDevice.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.PowerOff]);
|
||||
|
||||
// Poewer On
|
||||
trilist.SetSigTrueAction(joinMap.PowerOn, () => displayDevice.PowerOn());
|
||||
displayDevice.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PowerOn]);
|
||||
|
||||
// GenericLighitng Actions & FeedBack
|
||||
|
||||
// int sceneIndex = 1;
|
||||
/*
|
||||
foreach (var scene in displayDevice.LightingScenes)
|
||||
{
|
||||
var tempIndex = sceneIndex - 1;
|
||||
//trilist.SetSigTrueAction((uint)(joinMap.LightingSceneOffset + sceneIndex), () => displayDevice.SelectScene(displayDevice.LightingScenes[tempIndex]));
|
||||
scene.IsActiveFeedback.LinkInputSig(trilist.BooleanInput[(uint)(joinMap.LightingSceneOffset + sceneIndex)]);
|
||||
trilist.StringInput[(uint)(joinMap.LightingSceneOffset + sceneIndex)].StringValue = scene.Name;
|
||||
trilist.BooleanInput[(uint)(joinMap.ButtonVisibilityOffset + sceneIndex)].BoolValue = true;
|
||||
sceneIndex++;
|
||||
}
|
||||
|
||||
if (displayDevice.GetType().Name.ToString() == "LutronQuantumArea")
|
||||
{
|
||||
var lutronDevice = displayDevice as PepperDash.Essentials.Devices.Common.Environment.Lutron.LutronQuantumArea;
|
||||
lutronDevice.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]);
|
||||
trilist.SetStringSigAction(joinMap.IntegrationIdSet, s => lutronDevice.IntegrationId = s);
|
||||
}
|
||||
*/
|
||||
//ApiEisc.Eisc.SetStringSigAction(ApiMap.integrationID, (s) => { lutronLights.IntegrationId = s; });
|
||||
|
||||
|
||||
/*
|
||||
var lutronLights = displayDevice as PepperDash.Essentials.Devices.Common.Environment.Lutron.LutronQuantumArea;
|
||||
|
||||
|
||||
for (uint i = 1; i <= lightingBase.CircuitCount; i++)
|
||||
{
|
||||
var circuit = i;
|
||||
lightingBase.CircuitNameFeedbacks[circuit - 1].LinkInputSig(trilist.StringInput[joinMap.CircuitNames + circuit]);
|
||||
lightingBase.CircuitIsCritical[circuit - 1].LinkInputSig(trilist.BooleanInput[joinMap.CircuitIsCritical + circuit]);
|
||||
lightingBase.CircuitState[circuit - 1].LinkInputSig(trilist.BooleanInput[joinMap.CircuitState + circuit]);
|
||||
trilist.SetSigTrueAction(joinMap.CircuitCycle + circuit, () => lightingBase.CycleCircuit(circuit - 1));
|
||||
trilist.SetSigTrueAction(joinMap.CircuitOnCmd + circuit, () => lightingBase.TurnOnCircuit(circuit - 1));
|
||||
trilist.SetSigTrueAction(joinMap.CircuitOffCmd + circuit, () => lightingBase.TurnOffCircuit(circuit - 1));
|
||||
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
public class DisplayControllerJoinMap : JoinMapBase
|
||||
{
|
||||
public uint IsOnline { get; set; }
|
||||
public uint PowerOff { get; set; }
|
||||
public uint PowerOn { get; set; }
|
||||
public uint SelectScene { get; set; }
|
||||
public uint LightingSceneOffset { get; set; }
|
||||
public uint ButtonVisibilityOffset { get; set; }
|
||||
public uint IntegrationIdSet { get; set; }
|
||||
|
||||
public DisplayControllerJoinMap()
|
||||
{
|
||||
// Digital
|
||||
IsOnline = 1;
|
||||
PowerOff = 1;
|
||||
PowerOn = 2;
|
||||
SelectScene = 1;
|
||||
IntegrationIdSet = 1;
|
||||
LightingSceneOffset = 10;
|
||||
ButtonVisibilityOffset = 40;
|
||||
// Analog
|
||||
}
|
||||
|
||||
public override void OffsetJoinNumbers(uint joinStart)
|
||||
{
|
||||
var joinOffset = joinStart - 1;
|
||||
|
||||
IsOnline = IsOnline + joinOffset;
|
||||
PowerOff = PowerOff + joinOffset;
|
||||
PowerOn = PowerOn + joinOffset;
|
||||
SelectScene = SelectScene + joinOffset;
|
||||
LightingSceneOffset = LightingSceneOffset + joinOffset;
|
||||
ButtonVisibilityOffset = ButtonVisibilityOffset + joinOffset;
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
144
PepperDashEssentials/Bridges/EssentialComms.cs
Normal file
144
PepperDashEssentials/Bridges/EssentialComms.cs
Normal file
@@ -0,0 +1,144 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.Routing;
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.EthernetCommunication;
|
||||
using Crestron.SimplSharpPro.CrestronThread;
|
||||
|
||||
namespace PepperDash.Essentials {
|
||||
public class EssentialCommConfig {
|
||||
public string[] EiscApiIpids;
|
||||
public EssentialCommCommConnectionConfigs[] CommConnections;
|
||||
}
|
||||
public class EssentialCommCommConnectionConfigs {
|
||||
public uint joinNumber {get; set; }
|
||||
public EssentialsControlPropertiesConfig control { get; set; }
|
||||
}
|
||||
|
||||
public class EssentialCommsPort {
|
||||
public IBasicCommunication Comm;
|
||||
public IntFeedback StatusFeedback;
|
||||
public BoolFeedback ConnectedFeedback;
|
||||
public List<EssentialComApiMap> Outputs = new List<EssentialComApiMap>();
|
||||
public String RxBuffer;
|
||||
public EssentialCommsPort(EssentialsControlPropertiesConfig config, string keyPrefix) {
|
||||
Comm = CommFactory.CreateCommForConfig(config, keyPrefix);
|
||||
// var PortGather = new CommunicationGather(Comm, config.EndOfLineChar);
|
||||
Comm.TextReceived += new EventHandler<GenericCommMethodReceiveTextArgs>(Communication_TextReceived);
|
||||
|
||||
var socket = Comm as ISocketStatus;
|
||||
StatusFeedback = new IntFeedback(() => { return (int)socket.ClientStatus; });
|
||||
ConnectedFeedback = new BoolFeedback(() => { return Comm.IsConnected; });
|
||||
|
||||
if (socket != null) {
|
||||
socket.ConnectionChange += new EventHandler<GenericSocketStatusChageEventArgs>(socket_ConnectionChange);
|
||||
} else {
|
||||
}
|
||||
|
||||
}
|
||||
void socket_ConnectionChange(object sender, GenericSocketStatusChageEventArgs e) {
|
||||
StatusFeedback.FireUpdate();
|
||||
ConnectedFeedback.FireUpdate();
|
||||
if (e.Client.IsConnected) {
|
||||
// Tasks on connect
|
||||
} else {
|
||||
// Cleanup items from this session
|
||||
}
|
||||
}
|
||||
void Communication_TextReceived(object sender, GenericCommMethodReceiveTextArgs args) {
|
||||
try {
|
||||
foreach (var Output in Outputs) {
|
||||
Output.Api.Eisc.StringInput[Output.Join].StringValue = args.Text;
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception) {
|
||||
throw new FormatException(string.Format("ERROR:{0}"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class EssentialComm : Device {
|
||||
public EssentialCommConfig Properties;
|
||||
|
||||
public CommunicationGather PortGather { get; private set; }
|
||||
public List<BridgeApiEisc> Apis {get; set;}
|
||||
public Dictionary<string, StringFeedback> CommFeedbacks {get; private set; }
|
||||
public StatusMonitorBase CommunicationMonitor { get; private set; }
|
||||
public Dictionary<uint, EssentialCommsPort> CommDictionary { get; private set; }
|
||||
|
||||
public EssentialComm(string key, string name, JToken properties) : base(key, name) {
|
||||
Properties = JsonConvert.DeserializeObject<EssentialCommConfig>(properties.ToString());
|
||||
CommFeedbacks = new Dictionary<string, StringFeedback>();
|
||||
CommDictionary = new Dictionary<uint, EssentialCommsPort>();
|
||||
Apis = new List<BridgeApiEisc>();
|
||||
int commNumber = 1;
|
||||
foreach (var commConfig in Properties.CommConnections) {
|
||||
var commPort = new EssentialCommsPort(commConfig.control, string.Format("{0}-{1}", this.Key, commConfig.joinNumber));
|
||||
CommDictionary.Add(commConfig.joinNumber, commPort);
|
||||
|
||||
commNumber++;
|
||||
}
|
||||
|
||||
foreach (var Ipid in Properties.EiscApiIpids) {
|
||||
var ApiEisc = new BridgeApiEisc(Ipid);
|
||||
Apis.Add(ApiEisc);
|
||||
foreach (var commConnection in CommDictionary) {
|
||||
Debug.Console(2, "Joining Api{0} to comm {1}", Ipid, commConnection.Key);
|
||||
var tempComm = commConnection.Value;
|
||||
var tempJoin = (uint)commConnection.Key;
|
||||
EssentialComApiMap ApiMap = new EssentialComApiMap(ApiEisc, (uint)tempJoin);
|
||||
|
||||
tempComm.Outputs.Add(ApiMap);
|
||||
// Check for ApiMap Overide Values here
|
||||
|
||||
ApiEisc.Eisc.SetBoolSigAction(tempJoin, b => {if (b) { tempComm.Comm.Connect(); } else { tempComm.Comm.Disconnect(); }});
|
||||
ApiEisc.Eisc.SetStringSigAction(tempJoin, s => tempComm.Comm.SendText(s));
|
||||
|
||||
tempComm.StatusFeedback.LinkInputSig(ApiEisc.Eisc.UShortInput[tempJoin]);
|
||||
tempComm.ConnectedFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[tempJoin]);
|
||||
|
||||
|
||||
|
||||
}
|
||||
ApiEisc.Eisc.Register();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public override bool CustomActivate()
|
||||
{
|
||||
try {
|
||||
|
||||
|
||||
|
||||
Debug.Console(2, "Name {0} Activated", this.Name);
|
||||
return true;
|
||||
}
|
||||
catch (Exception e) {
|
||||
Debug.Console(0, "Bridge {0}", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
public class EssentialComApiMap {
|
||||
public uint Join;
|
||||
public BridgeApiEisc Api;
|
||||
public uint connectJoin;
|
||||
public EssentialComApiMap(BridgeApiEisc api, uint join) {
|
||||
Join = join;
|
||||
Api = api;
|
||||
}
|
||||
}
|
||||
}
|
||||
150
PepperDashEssentials/Bridges/EssentialDM.cs
Normal file
150
PepperDashEssentials/Bridges/EssentialDM.cs
Normal file
@@ -0,0 +1,150 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.DM;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.Routing;
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.EthernetCommunication;
|
||||
using Crestron.SimplSharpPro.DM;
|
||||
|
||||
namespace PepperDash.Essentials {
|
||||
public class EssentialDM : PepperDash.Core.Device {
|
||||
public EssentialDMProperties Properties;
|
||||
public List<BridgeApiEisc> BridgeApiEiscs;
|
||||
private PepperDash.Essentials.DM.DmChassisController DmSwitch;
|
||||
private EssentialDMApiMap ApiMap = new EssentialDMApiMap();
|
||||
public EssentialDM(string key, string name, JToken properties)
|
||||
: base(key, name) {
|
||||
Properties = JsonConvert.DeserializeObject<EssentialDMProperties>(properties.ToString());
|
||||
|
||||
|
||||
}
|
||||
public override bool CustomActivate() {
|
||||
// Create EiscApis
|
||||
try {
|
||||
foreach (var device in DeviceManager.AllDevices) {
|
||||
if (device.Key == this.Properties.connectionDeviceKey) {
|
||||
Debug.Console(2, "deviceKey {0} Matches", device.Key);
|
||||
DmSwitch = DeviceManager.GetDeviceForKey(device.Key) as PepperDash.Essentials.DM.DmChassisController;
|
||||
|
||||
}
|
||||
|
||||
|
||||
else {
|
||||
Debug.Console(2, "deviceKey {0} doesn't match", device.Key);
|
||||
}
|
||||
}
|
||||
if (Properties.EiscApiIpids != null) {
|
||||
|
||||
|
||||
foreach (string Ipid in Properties.EiscApiIpids) {
|
||||
var ApiEisc = new BridgeApiEisc(Ipid);
|
||||
for (uint x = 1; x <= DmSwitch.Chassis.NumberOfInputs;x++ ) {
|
||||
uint tempX = x;
|
||||
Debug.Console(2, "Creating EiscActions {0}", tempX);
|
||||
|
||||
|
||||
ApiEisc.Eisc.SetUShortSigAction(ApiMap.OutputVideoRoutes[tempX], u => DmSwitch.ExecuteSwitch(u, tempX, eRoutingSignalType.Video));
|
||||
ApiEisc.Eisc.SetUShortSigAction(ApiMap.OutputAudioRoutes[tempX], u => DmSwitch.ExecuteSwitch(u, tempX, eRoutingSignalType.Audio));
|
||||
|
||||
|
||||
if (DmSwitch.TxDictionary.ContainsKey(tempX)) {
|
||||
Debug.Console(2, "Creating Tx Feedbacks {0}", tempX);
|
||||
var TxKey = DmSwitch.TxDictionary[tempX];
|
||||
var TxDevice = DeviceManager.GetDeviceForKey(TxKey) as DmTxControllerBase;
|
||||
TxDevice.IsOnline.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.TxOnlineStatus[tempX]]);
|
||||
TxDevice.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.TxVideoSyncStatus[tempX]]);
|
||||
ApiEisc.Eisc.SetUShortSigAction((ApiMap.HdcpSupport[tempX]), u => TxDevice.SetHdcpSupportAll((ePdtHdcpSupport)(u)));
|
||||
TxDevice.HdcpSupportAllFeedback.LinkInputSig(ApiEisc.Eisc.UShortInput[ApiMap.HdcpSupport[tempX]]);
|
||||
ApiEisc.Eisc.UShortInput[ApiMap.HdcpSupportCapability[tempX]].UShortValue = TxDevice.HdcpSupportCapability;
|
||||
}
|
||||
else {
|
||||
DmSwitch.VideoInputSyncFeedbacks[tempX].LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.TxVideoSyncStatus[tempX]]);
|
||||
}
|
||||
if (DmSwitch.RxDictionary.ContainsKey(tempX)) {
|
||||
Debug.Console(2, "Creating Rx Feedbacks {0}", tempX);
|
||||
var RxKey = DmSwitch.RxDictionary[tempX];
|
||||
var RxDevice = DeviceManager.GetDeviceForKey(RxKey) as DmRmcControllerBase;
|
||||
RxDevice.IsOnline.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.RxOnlineStatus[tempX]]);
|
||||
}
|
||||
// DmSwitch.InputEndpointOnlineFeedbacks[(ushort)tempOutputNum].LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.OutputVideoRoutes[tempOutputNum]]);
|
||||
DmSwitch.VideoOutputFeedbacks[(ushort)tempX].LinkInputSig(ApiEisc.Eisc.UShortInput[ApiMap.OutputVideoRoutes[tempX]]);
|
||||
DmSwitch.AudioOutputFeedbacks[(ushort)tempX].LinkInputSig(ApiEisc.Eisc.UShortInput[ApiMap.OutputAudioRoutes[tempX]]);
|
||||
DmSwitch.InputNameFeedbacks[(ushort)tempX].LinkInputSig(ApiEisc.Eisc.StringInput[ApiMap.InputNames[tempX]]);
|
||||
DmSwitch.OutputNameFeedbacks[(ushort)tempX].LinkInputSig(ApiEisc.Eisc.StringInput[ApiMap.OutputNames[tempX]]);
|
||||
DmSwitch.OutputRouteNameFeedbacks[(ushort)tempX].LinkInputSig(ApiEisc.Eisc.StringInput[ApiMap.OutputRouteNames[tempX]]);
|
||||
}
|
||||
DmSwitch.IsOnline.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.ChassisOnline]);
|
||||
ApiEisc.Eisc.Register();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Debug.Console(2, "Name {0} Activated", this.Name);
|
||||
return true;
|
||||
}
|
||||
catch (Exception e) {
|
||||
Debug.Console(2, "BRidge {0}", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
public class EssentialDMProperties {
|
||||
public string connectionDeviceKey;
|
||||
public string[] EiscApiIpids;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class EssentialDMApiMap {
|
||||
public ushort ChassisOnline = 11;
|
||||
public Dictionary<uint, ushort> OutputVideoRoutes;
|
||||
public Dictionary<uint, ushort> OutputAudioRoutes;
|
||||
public Dictionary<uint, ushort> TxOnlineStatus;
|
||||
public Dictionary<uint, ushort> RxOnlineStatus;
|
||||
public Dictionary<uint, ushort> TxVideoSyncStatus;
|
||||
public Dictionary<uint, ushort> InputNames;
|
||||
public Dictionary<uint, ushort> OutputNames;
|
||||
public Dictionary<uint, ushort> OutputRouteNames;
|
||||
public Dictionary<uint, ushort> HdcpSupport;
|
||||
public Dictionary<uint, ushort> HdcpSupportCapability;
|
||||
|
||||
public EssentialDMApiMap() {
|
||||
OutputVideoRoutes = new Dictionary<uint, ushort>();
|
||||
OutputAudioRoutes = new Dictionary<uint, ushort>();
|
||||
TxOnlineStatus = new Dictionary<uint, ushort>();
|
||||
RxOnlineStatus = new Dictionary<uint, ushort>();
|
||||
TxVideoSyncStatus = new Dictionary<uint, ushort>();
|
||||
InputNames = new Dictionary<uint, ushort>();
|
||||
OutputNames = new Dictionary<uint, ushort>();
|
||||
OutputRouteNames = new Dictionary<uint, ushort>();
|
||||
HdcpSupport = new Dictionary<uint, ushort>();
|
||||
HdcpSupportCapability = new Dictionary<uint, ushort>();
|
||||
|
||||
for (uint x = 1; x <= 200; x++) {
|
||||
// Debug.Console(0, "Init Value {0}", x);
|
||||
uint tempNum = x;
|
||||
HdcpSupportCapability[tempNum] = (ushort)(tempNum + 1200);
|
||||
HdcpSupport[tempNum] = (ushort)(tempNum + 1000);
|
||||
OutputVideoRoutes[tempNum] = (ushort)(tempNum + 100);
|
||||
OutputAudioRoutes[tempNum] = (ushort)(tempNum + 300);
|
||||
TxOnlineStatus[tempNum] = (ushort)(tempNum + 500);
|
||||
RxOnlineStatus[tempNum] = (ushort)(tempNum + 700);
|
||||
TxVideoSyncStatus[tempNum] = (ushort)(tempNum + 100);
|
||||
InputNames[tempNum] = (ushort)(tempNum + 100);
|
||||
OutputNames[tempNum] = (ushort)(tempNum + 300);
|
||||
OutputRouteNames[tempNum] = (ushort)(tempNum + 2000);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
217
PepperDashEssentials/Bridges/EssentialDsp.cs
Normal file
217
PepperDashEssentials/Bridges/EssentialDsp.cs
Normal file
@@ -0,0 +1,217 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.DM;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.Routing;
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.EthernetCommunication;
|
||||
using Crestron.SimplSharpPro.DM;
|
||||
|
||||
namespace PepperDash.Essentials {
|
||||
public class EssentialDsp : PepperDash.Core.Device {
|
||||
public EssentialDspProperties Properties;
|
||||
public List<BridgeApiEisc> BridgeApiEiscs;
|
||||
private PepperDash.Essentials.Devices.Common.DSP.QscDsp Dsp;
|
||||
private EssentialDspApiMap ApiMap = new EssentialDspApiMap();
|
||||
public EssentialDsp(string key, string name, JToken properties)
|
||||
: base(key, name) {
|
||||
Properties = JsonConvert.DeserializeObject<EssentialDspProperties>(properties.ToString());
|
||||
|
||||
|
||||
}
|
||||
public override bool CustomActivate() {
|
||||
// Create EiscApis
|
||||
|
||||
try
|
||||
{
|
||||
ICommunicationMonitor comm = null;
|
||||
foreach (var device in DeviceManager.AllDevices)
|
||||
{
|
||||
if (device.Key == this.Properties.connectionDeviceKey)
|
||||
{
|
||||
if (!(device is ICommunicationMonitor))
|
||||
{
|
||||
comm = device as ICommunicationMonitor;
|
||||
}
|
||||
Debug.Console(2, "deviceKey {0} Matches", device.Key);
|
||||
Dsp = DeviceManager.GetDeviceForKey(device.Key) as PepperDash.Essentials.Devices.Common.DSP.QscDsp;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(2, "deviceKey {0} doesn't match", device.Key);
|
||||
|
||||
}
|
||||
}
|
||||
if (Properties.EiscApiIpids != null && Dsp != null)
|
||||
{
|
||||
foreach (string Ipid in Properties.EiscApiIpids)
|
||||
{
|
||||
var ApiEisc = new BridgeApiEisc(Ipid);
|
||||
Debug.Console(2, "Connecting EiscApi {0} to {1}", ApiEisc.Ipid, Dsp.Name);
|
||||
ushort x = 1;
|
||||
if (comm != null)
|
||||
{
|
||||
comm.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.Online]);
|
||||
}
|
||||
foreach (var channel in Dsp.LevelControlPoints)
|
||||
{
|
||||
//var QscChannel = channel.Value as PepperDash.Essentials.Devices.Common.DSP.QscDspLevelControl;
|
||||
Debug.Console(2, "QscChannel {0} connect", x);
|
||||
|
||||
var genericChannel = channel.Value as IBasicVolumeWithFeedback;
|
||||
if (channel.Value.Enabled)
|
||||
{
|
||||
ApiEisc.Eisc.StringInput[ApiMap.channelName[x]].StringValue = channel.Value.LevelCustomName;
|
||||
ApiEisc.Eisc.UShortInput[ApiMap.channelType[x]].UShortValue = (ushort)channel.Value.Type;
|
||||
|
||||
genericChannel.MuteFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.channelMuteToggle[x]]);
|
||||
genericChannel.VolumeLevelFeedback.LinkInputSig(ApiEisc.Eisc.UShortInput[ApiMap.channelVolume[x]]);
|
||||
|
||||
ApiEisc.Eisc.SetSigTrueAction(ApiMap.channelMuteToggle[x], () => genericChannel.MuteToggle());
|
||||
ApiEisc.Eisc.SetSigTrueAction(ApiMap.channelMuteOn[x], () => genericChannel.MuteOn());
|
||||
ApiEisc.Eisc.SetSigTrueAction(ApiMap.channelMuteOff[x], () => genericChannel.MuteOff());
|
||||
|
||||
ApiEisc.Eisc.SetBoolSigAction(ApiMap.channelVolumeUp[x], b => genericChannel.VolumeUp(b));
|
||||
ApiEisc.Eisc.SetBoolSigAction(ApiMap.channelVolumeDown[x], b => genericChannel.VolumeDown(b));
|
||||
|
||||
ApiEisc.Eisc.SetUShortSigAction(ApiMap.channelVolume[x], u => genericChannel.SetVolume(u));
|
||||
ApiEisc.Eisc.SetStringSigAction(ApiMap.presetString, s => Dsp.RunPreset(s));
|
||||
}
|
||||
x++;
|
||||
|
||||
}
|
||||
x = 1;
|
||||
foreach (var preset in Dsp.PresetList)
|
||||
{
|
||||
ApiEisc.Eisc.StringInput[ApiMap.presets[x]].StringValue = preset.label;
|
||||
ApiEisc.Eisc.SetSigTrueAction(ApiMap.presets[x], () => Dsp.RunPresetNumber(x));
|
||||
x++;
|
||||
}
|
||||
foreach (var dialer in Dsp.Dialers)
|
||||
{
|
||||
ApiEisc.Eisc.SetSigTrueAction(ApiMap.Keypad0, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num0));
|
||||
ApiEisc.Eisc.SetSigTrueAction(ApiMap.Keypad1, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num1));
|
||||
ApiEisc.Eisc.SetSigTrueAction(ApiMap.Keypad2, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num2));
|
||||
ApiEisc.Eisc.SetSigTrueAction(ApiMap.Keypad3, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num3));
|
||||
ApiEisc.Eisc.SetSigTrueAction(ApiMap.Keypad4, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num4));
|
||||
ApiEisc.Eisc.SetSigTrueAction(ApiMap.Keypad5, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num5));
|
||||
ApiEisc.Eisc.SetSigTrueAction(ApiMap.Keypad6, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num6));
|
||||
ApiEisc.Eisc.SetSigTrueAction(ApiMap.Keypad7, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num7));
|
||||
ApiEisc.Eisc.SetSigTrueAction(ApiMap.Keypad8, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num8));
|
||||
ApiEisc.Eisc.SetSigTrueAction(ApiMap.Keypad9, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num9));
|
||||
ApiEisc.Eisc.SetSigTrueAction(ApiMap.KeypadStar, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Star));
|
||||
ApiEisc.Eisc.SetSigTrueAction(ApiMap.KeypadPound, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Pound));
|
||||
ApiEisc.Eisc.SetSigTrueAction(ApiMap.KeypadClear, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Clear));
|
||||
ApiEisc.Eisc.SetSigTrueAction(ApiMap.KeypadBackspace, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Backspace));
|
||||
|
||||
ApiEisc.Eisc.SetSigTrueAction(ApiMap.Dial, () => dialer.Value.Dial());
|
||||
ApiEisc.Eisc.SetSigTrueAction(ApiMap.DoNotDisturbToggle, () => dialer.Value.DoNotDisturbToggle());
|
||||
ApiEisc.Eisc.SetSigTrueAction(ApiMap.DoNotDisturbOn, () => dialer.Value.DoNotDisturbOn());
|
||||
ApiEisc.Eisc.SetSigTrueAction(ApiMap.DoNotDisturbOff, () => dialer.Value.DoNotDisturbOff());
|
||||
ApiEisc.Eisc.SetSigTrueAction(ApiMap.AutoAnswerToggle, () => dialer.Value.AutoAnswerToggle());
|
||||
ApiEisc.Eisc.SetSigTrueAction(ApiMap.AutoAnswerOn, () => dialer.Value.AutoAnswerOn());
|
||||
ApiEisc.Eisc.SetSigTrueAction(ApiMap.AutoAnswerOff, () => dialer.Value.AutoAnswerOff());
|
||||
|
||||
dialer.Value.DoNotDisturbFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.DoNotDisturbToggle]);
|
||||
dialer.Value.DoNotDisturbFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.DoNotDisturbOn]);
|
||||
dialer.Value.DoNotDisturbFeedback.LinkComplementInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.DoNotDisturbOff]);
|
||||
|
||||
dialer.Value.AutoAnswerFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.AutoAnswerToggle]);
|
||||
dialer.Value.AutoAnswerFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.AutoAnswerOn]);
|
||||
dialer.Value.AutoAnswerFeedback.LinkComplementInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.AutoAnswerOff]);
|
||||
|
||||
dialer.Value.OffHookFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.Dial]);
|
||||
dialer.Value.DialStringFeedback.LinkInputSig(ApiEisc.Eisc.StringInput[ApiMap.DialString]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Debug.Console(2, "Name {0} Activated", this.Name);
|
||||
return true;
|
||||
}
|
||||
catch (Exception e) {
|
||||
Debug.Console(0, "Bridge {0}", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
public class EssentialDspProperties {
|
||||
public string connectionDeviceKey;
|
||||
public string[] EiscApiIpids;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class EssentialDspApiMap {
|
||||
public ushort Online = 1;
|
||||
public ushort presetString = 2000;
|
||||
public Dictionary<uint, ushort> channelMuteToggle;
|
||||
public Dictionary<uint, ushort> channelMuteOn;
|
||||
public Dictionary<uint, ushort> channelMuteOff;
|
||||
public Dictionary<uint, ushort> channelVolume;
|
||||
public Dictionary<uint, ushort> channelType;
|
||||
public Dictionary<uint, ushort> channelName;
|
||||
public Dictionary<uint, ushort> channelVolumeUp;
|
||||
public Dictionary<uint, ushort> channelVolumeDown;
|
||||
public Dictionary<uint, ushort> presets;
|
||||
public ushort DialString = 3100;
|
||||
public ushort Keypad0 = 3110;
|
||||
public ushort Keypad1 = 3111;
|
||||
public ushort Keypad2 = 3112;
|
||||
public ushort Keypad3 = 3113;
|
||||
public ushort Keypad4 = 3114;
|
||||
public ushort Keypad5 = 3115;
|
||||
public ushort Keypad6 = 3116;
|
||||
public ushort Keypad7 = 3117;
|
||||
public ushort Keypad8 = 3118;
|
||||
public ushort Keypad9 = 3119;
|
||||
public ushort KeypadStar = 3120;
|
||||
public ushort KeypadPound = 3121;
|
||||
public ushort KeypadClear = 3122;
|
||||
public ushort KeypadBackspace = 3123;
|
||||
public ushort Dial = 3124;
|
||||
public ushort DoNotDisturbToggle = 3132;
|
||||
public ushort DoNotDisturbOn = 3133;
|
||||
public ushort DoNotDisturbOff = 3134;
|
||||
public ushort AutoAnswerToggle = 3127;
|
||||
public ushort AutoAnswerOn = 3125;
|
||||
public ushort AutoAnswerOff = 3126;
|
||||
|
||||
public EssentialDspApiMap() {
|
||||
channelMuteToggle = new Dictionary<uint, ushort>();
|
||||
channelMuteOn = new Dictionary<uint, ushort>();
|
||||
channelMuteOff = new Dictionary<uint, ushort>();
|
||||
channelVolume = new Dictionary<uint, ushort>();
|
||||
channelName = new Dictionary<uint, ushort>();
|
||||
channelType = new Dictionary<uint, ushort>();
|
||||
presets = new Dictionary<uint, ushort>();
|
||||
channelVolumeUp = new Dictionary<uint, ushort>();
|
||||
channelVolumeDown = new Dictionary<uint, ushort>();
|
||||
for (uint x = 1; x <= 100; x++) {
|
||||
uint tempNum = x;
|
||||
presets[tempNum] = (ushort)(tempNum + 100);
|
||||
channelMuteToggle[tempNum] = (ushort)(tempNum + 400);
|
||||
channelMuteOn[tempNum] = (ushort)(tempNum + 600);
|
||||
channelMuteOff[tempNum] = (ushort)(tempNum + 800);
|
||||
channelVolume[tempNum] = (ushort)(tempNum + 200);
|
||||
channelName[tempNum] = (ushort)(tempNum + 200);
|
||||
channelType[tempNum] = (ushort)(tempNum + 400);
|
||||
channelVolumeUp[tempNum] = (ushort)(tempNum + 1000);
|
||||
channelVolumeDown[tempNum] = (ushort)(tempNum + 1200);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
98
PepperDashEssentials/Bridges/EssentialTVOne.cs
Normal file
98
PepperDashEssentials/Bridges/EssentialTVOne.cs
Normal file
@@ -0,0 +1,98 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.DM;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.Routing;
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.EthernetCommunication;
|
||||
using Crestron.SimplSharpPro.DM;
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
{
|
||||
public class EssentialsTVOne : PepperDash.Core.Device
|
||||
{
|
||||
public EssentialTVOneProperties Properties;
|
||||
public List<BridgeApiEisc> BridgeApiEiscs;
|
||||
private PepperDash.Essentials.Devices.Common.TVOneCorio TVOneCorio;
|
||||
private EssentialsTVOneApiMap ApiMap = new EssentialsTVOneApiMap();
|
||||
public EssentialsTVOne(string key, string name, JToken properties)
|
||||
: base(key, name)
|
||||
{
|
||||
Properties = JsonConvert.DeserializeObject<EssentialTVOneProperties>(properties.ToString());
|
||||
|
||||
|
||||
}
|
||||
public override bool CustomActivate() {
|
||||
// Create EiscApis
|
||||
try
|
||||
{
|
||||
foreach (var device in DeviceManager.AllDevices)
|
||||
{
|
||||
if (device.Key == this.Properties.connectionDeviceKey)
|
||||
{
|
||||
Debug.Console(2, "deviceKey {0} Matches", device.Key);
|
||||
TVOneCorio = DeviceManager.GetDeviceForKey(device.Key) as PepperDash.Essentials.Devices.Common.TVOneCorio;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(2, "deviceKey {0} doesn't match", device.Key);
|
||||
|
||||
}
|
||||
}
|
||||
if (Properties.EiscApiIpids != null && TVOneCorio != null)
|
||||
{
|
||||
foreach (string Ipid in Properties.EiscApiIpids)
|
||||
{
|
||||
var ApiEisc = new BridgeApiEisc(Ipid);
|
||||
Debug.Console(2, "Connecting EiscApi {0} to {1}", ApiEisc.Ipid, TVOneCorio.Name);
|
||||
ushort x = 1;
|
||||
TVOneCorio.OnlineFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.Online]);
|
||||
ApiEisc.Eisc.SetUShortSigAction(ApiMap.CallPreset, u => TVOneCorio.CallPreset(u));
|
||||
TVOneCorio.PresetFeedback.LinkInputSig(ApiEisc.Eisc.UShortInput[ApiMap.PresetFeedback]);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Debug.Console(2, "Name {0} Activated", this.Name);
|
||||
return true;
|
||||
}
|
||||
catch (Exception e) {
|
||||
Debug.Console(0, "Bridge {0}", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
public class EssentialTVOneProperties
|
||||
{
|
||||
public string connectionDeviceKey;
|
||||
public string[] EiscApiIpids;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class EssentialsTVOneApiMap
|
||||
{
|
||||
public ushort CallPreset = 1;
|
||||
public ushort PresetFeedback = 1;
|
||||
public ushort Online = 1;
|
||||
|
||||
public EssentialsTVOneApiMap()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
104
PepperDashEssentials/Bridges/GenericLightingBridge.cs
Normal file
104
PepperDashEssentials/Bridges/GenericLightingBridge.cs
Normal file
@@ -0,0 +1,104 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Devices.Common;
|
||||
|
||||
namespace PepperDash.Essentials.Bridges
|
||||
{
|
||||
public static class GenericLightingApiExtensions
|
||||
{
|
||||
public static void LinkToApi(this PepperDash.Essentials.Core.Lighting.LightingBase lightingDevice, BasicTriList trilist, uint joinStart, string joinMapKey)
|
||||
{
|
||||
var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as GenericLightingJoinMap;
|
||||
|
||||
if (joinMap == null)
|
||||
joinMap = new GenericLightingJoinMap();
|
||||
|
||||
joinMap.OffsetJoinNumbers(joinStart);
|
||||
Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||
|
||||
|
||||
|
||||
Debug.Console(0, "Linking to lighting Type {0}", lightingDevice.GetType().Name.ToString());
|
||||
|
||||
// GenericLighitng Actions & FeedBack
|
||||
trilist.SetUShortSigAction(joinMap.SelectScene, u => {if(u > 0) { lightingDevice.SelectScene(lightingDevice.LightingScenes[u-1]);}});
|
||||
|
||||
|
||||
int sceneIndex = 1;
|
||||
foreach (var scene in lightingDevice.LightingScenes)
|
||||
{
|
||||
var tempIndex = sceneIndex - 1;
|
||||
trilist.SetSigTrueAction((uint)(joinMap.LightingSceneOffset + sceneIndex), () => lightingDevice.SelectScene(lightingDevice.LightingScenes[tempIndex]));
|
||||
scene.IsActiveFeedback.LinkInputSig(trilist.BooleanInput[(uint)(joinMap.LightingSceneOffset + sceneIndex)]);
|
||||
trilist.StringInput[(uint)(joinMap.LightingSceneOffset + sceneIndex)].StringValue = scene.Name;
|
||||
trilist.BooleanInput[(uint)(joinMap.ButtonVisibilityOffset + sceneIndex)].BoolValue = true;
|
||||
sceneIndex++;
|
||||
}
|
||||
|
||||
if (lightingDevice.GetType().Name.ToString() == "LutronQuantumArea")
|
||||
{
|
||||
var lutronDevice = lightingDevice as PepperDash.Essentials.Devices.Common.Environment.Lutron.LutronQuantumArea;
|
||||
lutronDevice.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]);
|
||||
trilist.SetStringSigAction(joinMap.IntegrationIdSet, s => lutronDevice.IntegrationId = s);
|
||||
}
|
||||
|
||||
//ApiEisc.Eisc.SetStringSigAction(ApiMap.integrationID, (s) => { lutronLights.IntegrationId = s; });
|
||||
|
||||
|
||||
/*
|
||||
var lutronLights = lightingDevice as PepperDash.Essentials.Devices.Common.Environment.Lutron.LutronQuantumArea;
|
||||
|
||||
|
||||
for (uint i = 1; i <= lightingBase.CircuitCount; i++)
|
||||
{
|
||||
var circuit = i;
|
||||
lightingBase.CircuitNameFeedbacks[circuit - 1].LinkInputSig(trilist.StringInput[joinMap.CircuitNames + circuit]);
|
||||
lightingBase.CircuitIsCritical[circuit - 1].LinkInputSig(trilist.BooleanInput[joinMap.CircuitIsCritical + circuit]);
|
||||
lightingBase.CircuitState[circuit - 1].LinkInputSig(trilist.BooleanInput[joinMap.CircuitState + circuit]);
|
||||
trilist.SetSigTrueAction(joinMap.CircuitCycle + circuit, () => lightingBase.CycleCircuit(circuit - 1));
|
||||
trilist.SetSigTrueAction(joinMap.CircuitOnCmd + circuit, () => lightingBase.TurnOnCircuit(circuit - 1));
|
||||
trilist.SetSigTrueAction(joinMap.CircuitOffCmd + circuit, () => lightingBase.TurnOffCircuit(circuit - 1));
|
||||
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
public class GenericLightingJoinMap : JoinMapBase
|
||||
{
|
||||
public uint IsOnline { get; set; }
|
||||
public uint SelectScene { get; set; }
|
||||
public uint LightingSceneOffset { get; set; }
|
||||
public uint ButtonVisibilityOffset { get; set; }
|
||||
public uint IntegrationIdSet { get; set; }
|
||||
|
||||
public GenericLightingJoinMap()
|
||||
{
|
||||
// Digital
|
||||
IsOnline = 1;
|
||||
SelectScene = 1;
|
||||
IntegrationIdSet = 1;
|
||||
LightingSceneOffset = 10;
|
||||
ButtonVisibilityOffset = 40;
|
||||
// Analog
|
||||
}
|
||||
|
||||
public override void OffsetJoinNumbers(uint joinStart)
|
||||
{
|
||||
var joinOffset = joinStart - 1;
|
||||
|
||||
IsOnline = IsOnline + joinOffset;
|
||||
SelectScene = SelectScene + joinOffset;
|
||||
LightingSceneOffset = LightingSceneOffset + joinOffset;
|
||||
ButtonVisibilityOffset = ButtonVisibilityOffset + joinOffset;
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
66
PepperDashEssentials/Bridges/GenericRelayDeviceBridge.cs
Normal file
66
PepperDashEssentials/Bridges/GenericRelayDeviceBridge.cs
Normal file
@@ -0,0 +1,66 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.CrestronIO;
|
||||
|
||||
namespace PepperDash.Essentials.Bridges
|
||||
{
|
||||
public static class GenericRelayDeviceApiExtensions
|
||||
{
|
||||
public static void LinkToApi(this GenericRelayDevice relay, BasicTriList trilist, uint joinStart, string joinMapKey)
|
||||
{
|
||||
var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as GenericRelayControllerJoinMap;
|
||||
|
||||
if (joinMap == null)
|
||||
joinMap = new GenericRelayControllerJoinMap();
|
||||
|
||||
joinMap.OffsetJoinNumbers(joinStart);
|
||||
|
||||
if (relay.RelayOutput == null)
|
||||
{
|
||||
Debug.Console(1, relay, "Unable to link device '{0}'. Relay is null", relay.Key);
|
||||
return;
|
||||
}
|
||||
|
||||
Debug.Console(1, relay, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||
|
||||
trilist.SetBoolSigAction(joinMap.Relay, new Action<bool>(b =>
|
||||
{
|
||||
if (b)
|
||||
relay.CloseRelay();
|
||||
else
|
||||
relay.OpenRelay();
|
||||
}));
|
||||
|
||||
// feedback for relay state
|
||||
|
||||
relay.OutputIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Relay]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class GenericRelayControllerJoinMap : JoinMapBase
|
||||
{
|
||||
//Digital
|
||||
public uint Relay { get; set; }
|
||||
|
||||
public GenericRelayControllerJoinMap()
|
||||
{
|
||||
Relay = 1;
|
||||
}
|
||||
|
||||
public override void OffsetJoinNumbers(uint joinStart)
|
||||
{
|
||||
var joinOffset = joinStart - 1;
|
||||
|
||||
Relay = Relay + joinOffset;
|
||||
}
|
||||
}
|
||||
}
|
||||
103
PepperDashEssentials/Bridges/IBasicCommunicationBridge.cs
Normal file
103
PepperDashEssentials/Bridges/IBasicCommunicationBridge.cs
Normal file
@@ -0,0 +1,103 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Bridges
|
||||
{
|
||||
public static class IBasicCommunicationApiExtensions
|
||||
{
|
||||
public static void LinkToApi(this GenericComm comm, BasicTriList trilist, uint joinStart, string joinMapKey)
|
||||
{
|
||||
var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as IBasicCommunicationJoinMap;
|
||||
|
||||
if (joinMap == null)
|
||||
joinMap = new IBasicCommunicationJoinMap();
|
||||
|
||||
joinMap.OffsetJoinNumbers(joinStart);
|
||||
|
||||
if (comm.CommPort == null)
|
||||
{
|
||||
Debug.Console(1, comm, "Unable to link device '{0}'. CommPort is null", comm.Key);
|
||||
return;
|
||||
}
|
||||
|
||||
Debug.Console(1, comm, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||
|
||||
// this is a permanent event handler. This cannot be -= from event
|
||||
comm.CommPort.TextReceived += (s, a) => trilist.SetString(joinMap.TextReceived, a.Text);
|
||||
trilist.SetStringSigAction(joinMap.SendText, new Action<string>(s => comm.CommPort.SendText(s)));
|
||||
trilist.SetStringSigAction(joinMap.SetPortConfig + 1, new Action<string>(s => comm.SetPortConfig(s)));
|
||||
|
||||
|
||||
var sComm = comm.CommPort as ISocketStatus;
|
||||
if (sComm != null)
|
||||
{
|
||||
sComm.ConnectionChange += (s, a) =>
|
||||
{
|
||||
trilist.SetUshort(joinMap.Status, (ushort)(a.Client.ClientStatus));
|
||||
trilist.SetBool(joinMap.Connected, a.Client.ClientStatus ==
|
||||
Crestron.SimplSharp.CrestronSockets.SocketStatus.SOCKET_STATUS_CONNECTED);
|
||||
};
|
||||
|
||||
trilist.SetBoolSigAction(joinMap.Connect, new Action<bool>(b =>
|
||||
{
|
||||
if (b)
|
||||
{
|
||||
sComm.Connect();
|
||||
}
|
||||
else
|
||||
{
|
||||
sComm.Disconnect();
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class IBasicCommunicationJoinMap : JoinMapBase
|
||||
{
|
||||
//Digital
|
||||
public uint Connect { get; set; }
|
||||
public uint Connected { get; set; }
|
||||
|
||||
//Analog
|
||||
public uint Status { get; set; }
|
||||
|
||||
// Serial
|
||||
public uint TextReceived { get; set; }
|
||||
public uint SendText { get; set; }
|
||||
public uint SetPortConfig { get; set; }
|
||||
|
||||
|
||||
public IBasicCommunicationJoinMap()
|
||||
{
|
||||
TextReceived = 1;
|
||||
SendText = 1;
|
||||
SetPortConfig = 2;
|
||||
Connect = 1;
|
||||
Connected = 1;
|
||||
Status = 1;
|
||||
}
|
||||
|
||||
public override void OffsetJoinNumbers(uint joinStart)
|
||||
{
|
||||
var joinOffset = joinStart - 1;
|
||||
|
||||
TextReceived = TextReceived + joinOffset;
|
||||
SendText = SendText + joinOffset;
|
||||
SetPortConfig = SetPortConfig + joinOffset;
|
||||
Connect = Connect + joinOffset;
|
||||
Connected = Connected + joinOffset;
|
||||
Status = Status + joinOffset;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
59
PepperDashEssentials/Bridges/IDigitalInputBridge.cs
Normal file
59
PepperDashEssentials/Bridges/IDigitalInputBridge.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.CrestronIO;
|
||||
|
||||
namespace PepperDash.Essentials.Bridges
|
||||
{
|
||||
public static class IDigitalInputApiExtenstions
|
||||
{
|
||||
public static void LinkToApi(this IDigitalInput input, BasicTriList trilist, uint joinStart, string joinMapKey)
|
||||
{
|
||||
var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as IDigitalInputApiJoinMap;
|
||||
|
||||
if (joinMap == null)
|
||||
joinMap = new IDigitalInputApiJoinMap();
|
||||
|
||||
joinMap.OffsetJoinNumbers(joinStart);
|
||||
|
||||
try
|
||||
{
|
||||
Debug.Console(1, input as Device, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||
|
||||
// Link feedback for input state
|
||||
input.InputStateFeedback.LinkInputSig(trilist.BooleanInput[joinMap.InputState]);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Console(1, input as Device, "Unable to link device '{0}'. Input is null", (input as Device).Key);
|
||||
Debug.Console(1, input as Device, "Error: {0}", e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class IDigitalInputApiJoinMap : JoinMapBase
|
||||
{
|
||||
//Digital
|
||||
public uint InputState { get; set; }
|
||||
|
||||
public IDigitalInputApiJoinMap()
|
||||
{
|
||||
InputState = 1;
|
||||
}
|
||||
|
||||
public override void OffsetJoinNumbers(uint joinStart)
|
||||
{
|
||||
var joinOffset = joinStart - 1;
|
||||
|
||||
InputState = InputState + joinOffset;
|
||||
}
|
||||
}
|
||||
}
|
||||
40
PepperDashEssentials/Bridges/JoinMapBase.cs
Normal file
40
PepperDashEssentials/Bridges/JoinMapBase.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
namespace PepperDash.Essentials.Bridges
|
||||
{
|
||||
public static class JoinMapHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// Attempts to get the join map from config
|
||||
/// </summary>
|
||||
/// <param name="joinMapKey"></param>
|
||||
/// <returns></returns>
|
||||
public static JoinMapBase GetJoinMapForDevice(string joinMapKey)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(joinMapKey))
|
||||
return null;
|
||||
|
||||
// FUTURE TODO: Get the join map from the ConfigReader.ConfigObject
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public abstract class JoinMapBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Modifies all the join numbers by adding the offset. This should never be called twice
|
||||
/// </summary>
|
||||
/// <param name="joinStart"></param>
|
||||
public abstract void OffsetJoinNumbers(uint joinStart);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
224
PepperDashEssentials/Bridges/QscDspBridge.cs
Normal file
224
PepperDashEssentials/Bridges/QscDspBridge.cs
Normal file
@@ -0,0 +1,224 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Devices.Common;
|
||||
using PepperDash.Essentials.Devices.Common.DSP;
|
||||
|
||||
namespace PepperDash.Essentials.Bridges
|
||||
{
|
||||
public static class QscDspDeviceApiExtensions
|
||||
{
|
||||
public static void LinkToApi(this QscDsp DspDevice, BasicTriList trilist, uint joinStart, string joinMapKey)
|
||||
{
|
||||
var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as QscDspDeviceJoinMap;
|
||||
|
||||
if (joinMap == null)
|
||||
joinMap = new QscDspDeviceJoinMap();
|
||||
|
||||
joinMap.OffsetJoinNumbers(joinStart);
|
||||
Debug.Console(1, DspDevice, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||
ushort x = 1;
|
||||
var comm = DspDevice as ICommunicationMonitor;
|
||||
DspDevice.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]);
|
||||
foreach (var channel in DspDevice.LevelControlPoints)
|
||||
{
|
||||
//var QscChannel = channel.Value as PepperDash.Essentials.Devices.Common.DSP.QscDspLevelControl;
|
||||
Debug.Console(2, "QscChannel {0} connect", x);
|
||||
|
||||
var genericChannel = channel.Value as IBasicVolumeWithFeedback;
|
||||
if (channel.Value.Enabled)
|
||||
{
|
||||
trilist.StringInput[joinMap.ChannelName + x].StringValue = channel.Value.LevelCustomName;
|
||||
trilist.UShortInput[joinMap.ChannelType + x].UShortValue = (ushort)channel.Value.Type;
|
||||
|
||||
genericChannel.MuteFeedback.LinkInputSig(trilist.BooleanInput[joinMap.ChannelMuteToggle + x]);
|
||||
genericChannel.VolumeLevelFeedback.LinkInputSig(trilist.UShortInput[joinMap.ChannelVolume + x]);
|
||||
|
||||
trilist.SetSigTrueAction(joinMap.ChannelMuteToggle + x, () => genericChannel.MuteToggle());
|
||||
trilist.SetSigTrueAction(joinMap.ChannelMuteOn + x, () => genericChannel.MuteOn());
|
||||
trilist.SetSigTrueAction(joinMap.ChannelMuteOff + x, () => genericChannel.MuteOff());
|
||||
|
||||
trilist.SetBoolSigAction(joinMap.ChannelVolumeUp + x, b => genericChannel.VolumeUp(b));
|
||||
trilist.SetBoolSigAction(joinMap.ChannelVolumeDown + x, b => genericChannel.VolumeDown(b));
|
||||
|
||||
trilist.SetUShortSigAction(joinMap.ChannelVolume + x, u => genericChannel.SetVolume(u));
|
||||
|
||||
}
|
||||
x++;
|
||||
}
|
||||
x = 1;
|
||||
trilist.SetStringSigAction(joinMap.PresetStringCmd, s => DspDevice.RunPreset(s));
|
||||
foreach (var preset in DspDevice.PresetList)
|
||||
{
|
||||
trilist.StringInput[joinMap.Presets + x].StringValue = preset.label;
|
||||
trilist.SetSigTrueAction(joinMap.Presets + x, () => DspDevice.RunPresetNumber(x));
|
||||
x++;
|
||||
}
|
||||
foreach (var dialer in DspDevice.Dialers)
|
||||
{
|
||||
trilist.SetSigTrueAction(joinMap.Keypad0, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num0));
|
||||
trilist.SetSigTrueAction(joinMap.Keypad1, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num1));
|
||||
trilist.SetSigTrueAction(joinMap.Keypad2, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num2));
|
||||
trilist.SetSigTrueAction(joinMap.Keypad3, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num3));
|
||||
trilist.SetSigTrueAction(joinMap.Keypad4, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num4));
|
||||
trilist.SetSigTrueAction(joinMap.Keypad5, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num5));
|
||||
trilist.SetSigTrueAction(joinMap.Keypad6, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num6));
|
||||
trilist.SetSigTrueAction(joinMap.Keypad7, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num7));
|
||||
trilist.SetSigTrueAction(joinMap.Keypad8, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num8));
|
||||
trilist.SetSigTrueAction(joinMap.Keypad9, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num9));
|
||||
trilist.SetSigTrueAction(joinMap.KeypadStar, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Star));
|
||||
trilist.SetSigTrueAction(joinMap.KeypadPound, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Pound));
|
||||
trilist.SetSigTrueAction(joinMap.KeypadClear, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Clear));
|
||||
trilist.SetSigTrueAction(joinMap.KeypadBackspace, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Backspace));
|
||||
|
||||
trilist.SetSigTrueAction(joinMap.Dial, () => dialer.Value.Dial());
|
||||
trilist.SetSigTrueAction(joinMap.DoNotDisturbToggle, () => dialer.Value.DoNotDisturbToggle());
|
||||
trilist.SetSigTrueAction(joinMap.DoNotDisturbOn, () => dialer.Value.DoNotDisturbOn());
|
||||
trilist.SetSigTrueAction(joinMap.DoNotDisturbOff, () => dialer.Value.DoNotDisturbOff());
|
||||
trilist.SetSigTrueAction(joinMap.AutoAnswerToggle, () => dialer.Value.AutoAnswerToggle());
|
||||
trilist.SetSigTrueAction(joinMap.AutoAnswerOn, () => dialer.Value.AutoAnswerOn());
|
||||
trilist.SetSigTrueAction(joinMap.AutoAnswerOff, () => dialer.Value.AutoAnswerOff());
|
||||
|
||||
dialer.Value.DoNotDisturbFeedback.LinkInputSig(trilist.BooleanInput[joinMap.DoNotDisturbToggle]);
|
||||
dialer.Value.DoNotDisturbFeedback.LinkInputSig(trilist.BooleanInput[joinMap.DoNotDisturbOn]);
|
||||
dialer.Value.DoNotDisturbFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.DoNotDisturbOff]);
|
||||
|
||||
dialer.Value.AutoAnswerFeedback.LinkInputSig(trilist.BooleanInput[joinMap.AutoAnswerToggle]);
|
||||
dialer.Value.AutoAnswerFeedback.LinkInputSig(trilist.BooleanInput[joinMap.AutoAnswerOn]);
|
||||
dialer.Value.AutoAnswerFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.AutoAnswerOff]);
|
||||
|
||||
dialer.Value.OffHookFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Dial]);
|
||||
dialer.Value.DialStringFeedback.LinkInputSig(trilist.StringInput[joinMap.DialStringCmd]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
public class QscDspDeviceJoinMap : JoinMapBase
|
||||
{
|
||||
public uint IsOnline { get; set; }
|
||||
public uint PresetStringCmd { get; set; }
|
||||
public uint ChannelMuteToggle { get; set; }
|
||||
public uint ChannelMuteOn { get; set; }
|
||||
public uint ChannelMuteOff { get; set; }
|
||||
public uint ChannelVolume { get; set; }
|
||||
public uint ChannelType { get; set; }
|
||||
public uint ChannelName { get; set; }
|
||||
public uint ChannelVolumeUp { get; set; }
|
||||
public uint ChannelVolumeDown { get; set; }
|
||||
public uint Presets { get; set; }
|
||||
public uint DialStringCmd { get; set; }
|
||||
public uint Keypad0 { get; set; }
|
||||
public uint Keypad1 { get; set; }
|
||||
public uint Keypad2 { get; set; }
|
||||
public uint Keypad3 { get; set; }
|
||||
public uint Keypad4 { get; set; }
|
||||
public uint Keypad5 { get; set; }
|
||||
public uint Keypad6 { get; set; }
|
||||
public uint Keypad7 { get; set; }
|
||||
public uint Keypad8 { get; set; }
|
||||
public uint Keypad9 { get; set; }
|
||||
public uint KeypadStar { get; set; }
|
||||
public uint KeypadPound { get; set; }
|
||||
public uint KeypadClear { get; set; }
|
||||
public uint KeypadBackspace { get; set; }
|
||||
public uint Dial { get; set; }
|
||||
public uint DoNotDisturbToggle { get; set; }
|
||||
public uint DoNotDisturbOn { get; set; }
|
||||
public uint DoNotDisturbOff { get; set; }
|
||||
public uint AutoAnswerToggle { get; set; }
|
||||
public uint AutoAnswerOn { get; set; }
|
||||
public uint AutoAnswerOff { get; set; }
|
||||
|
||||
public uint CallPreset { get; set; }
|
||||
public uint PresetFeedback { get; set; }
|
||||
|
||||
public QscDspDeviceJoinMap()
|
||||
{
|
||||
// Arrays
|
||||
ChannelName = 200;
|
||||
ChannelMuteToggle = 400;
|
||||
ChannelMuteOn = 600;
|
||||
ChannelMuteOff = 800;
|
||||
ChannelVolume = 200;
|
||||
ChannelVolumeUp = 1000;
|
||||
ChannelVolumeDown = 1200;
|
||||
ChannelType = 400;
|
||||
Presets = 100;
|
||||
|
||||
// SIngleJoins
|
||||
IsOnline = 1;
|
||||
PresetStringCmd = 2000;
|
||||
DialStringCmd = 3100;
|
||||
Keypad0 = 3110;
|
||||
Keypad1 = 3111;
|
||||
Keypad2 = 3112;
|
||||
Keypad3 = 3113;
|
||||
Keypad4 = 3114;
|
||||
Keypad5 = 3115;
|
||||
Keypad6 = 3116;
|
||||
Keypad7 = 3117;
|
||||
Keypad8 = 3118;
|
||||
Keypad9 = 3119;
|
||||
KeypadStar = 3120;
|
||||
KeypadPound = 3121;
|
||||
KeypadClear = 3122;
|
||||
KeypadBackspace = 3123;
|
||||
DoNotDisturbToggle = 3132;
|
||||
DoNotDisturbOn = 3133;
|
||||
DoNotDisturbOff = 3134;
|
||||
AutoAnswerToggle = 3127;
|
||||
AutoAnswerOn = 3125;
|
||||
AutoAnswerOff = 3126;
|
||||
Dial = 3124;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public override void OffsetJoinNumbers(uint joinStart)
|
||||
{
|
||||
var joinOffset = joinStart - 1;
|
||||
ChannelName = ChannelName + joinOffset;
|
||||
ChannelMuteToggle = ChannelMuteToggle + joinOffset;
|
||||
ChannelMuteOn = ChannelMuteOn + joinOffset;
|
||||
ChannelMuteOff = ChannelMuteOff + joinOffset;
|
||||
ChannelVolume = ChannelVolume + joinOffset;
|
||||
ChannelVolumeUp = ChannelVolumeUp + joinOffset;
|
||||
ChannelVolumeDown = ChannelVolumeDown + joinOffset;
|
||||
ChannelType = ChannelType + joinOffset;
|
||||
Presets = Presets + joinOffset;
|
||||
|
||||
IsOnline = IsOnline + joinOffset;
|
||||
PresetStringCmd = PresetStringCmd + joinOffset;
|
||||
DialStringCmd = DialStringCmd + joinOffset;
|
||||
Keypad0 = Keypad0 + joinOffset;
|
||||
Keypad1 = Keypad1 + joinOffset;
|
||||
Keypad2 = Keypad2 + joinOffset;
|
||||
Keypad3 = Keypad3 + joinOffset;
|
||||
Keypad4 = Keypad4 + joinOffset;
|
||||
Keypad5 = Keypad5 + joinOffset;
|
||||
Keypad6 = Keypad6 + joinOffset;
|
||||
Keypad7 = Keypad7 + joinOffset;
|
||||
Keypad8 = Keypad8 + joinOffset;
|
||||
Keypad9 = Keypad9 + joinOffset;
|
||||
KeypadStar = KeypadStar + joinOffset;
|
||||
KeypadPound = KeypadPound + joinOffset;
|
||||
KeypadClear = KeypadClear + joinOffset;
|
||||
KeypadBackspace = KeypadBackspace + joinOffset;
|
||||
DoNotDisturbToggle = DoNotDisturbToggle + joinOffset;
|
||||
DoNotDisturbOn = DoNotDisturbOn + joinOffset;
|
||||
DoNotDisturbOff = DoNotDisturbOff + joinOffset;
|
||||
AutoAnswerToggle = AutoAnswerToggle + joinOffset;
|
||||
AutoAnswerOn = AutoAnswerOn + joinOffset;
|
||||
AutoAnswerOff = AutoAnswerOff + joinOffset;
|
||||
Dial = Dial + joinOffset;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
150
PepperDashEssentials/Bridges/SystemMonitorBridge.cs
Normal file
150
PepperDashEssentials/Bridges/SystemMonitorBridge.cs
Normal file
@@ -0,0 +1,150 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using Crestron.SimplSharpPro.Diagnostics;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Monitoring;
|
||||
|
||||
namespace PepperDash.Essentials.Bridges
|
||||
{
|
||||
public static class SystemMonitorBridge
|
||||
{
|
||||
public static void LinkToApi(this SystemMonitorController systemMonitorController, BasicTriList trilist, uint joinStart, string joinMapKey)
|
||||
{
|
||||
var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as SystemMonitorJoinMap;
|
||||
|
||||
if (joinMap == null)
|
||||
joinMap = new SystemMonitorJoinMap();
|
||||
|
||||
joinMap.OffsetJoinNumbers(joinStart);
|
||||
|
||||
//Debug.Console(1, systemMonitorController, "Linking API starting at join: {0}", joinStart);
|
||||
|
||||
systemMonitorController.TimeZoneFeedback.LinkInputSig(trilist.UShortInput[joinMap.TimeZone]);
|
||||
//trilist.SetUShortSigAction(joinMap.TimeZone, new Action<ushort>(u => systemMonitorController.SetTimeZone(u)));
|
||||
systemMonitorController.TimeZoneTextFeedback.LinkInputSig(trilist.StringInput[joinMap.TimeZoneName]);
|
||||
|
||||
systemMonitorController.IOControllerVersionFeedback.LinkInputSig(trilist.StringInput[joinMap.IOControllerVersion]);
|
||||
systemMonitorController.SnmpVersionFeedback.LinkInputSig(trilist.StringInput[joinMap.SnmpAppVersion]);
|
||||
systemMonitorController.BACnetAppVersionFeedback.LinkInputSig(trilist.StringInput[joinMap.BACnetAppVersion]);
|
||||
systemMonitorController.ControllerVersionFeedback.LinkInputSig(trilist.StringInput[joinMap.ControllerVersion]);
|
||||
|
||||
|
||||
// iterate the program status feedback collection and map all the joins
|
||||
var programSlotJoinStart = joinMap.ProgramStartJoin;
|
||||
|
||||
foreach (var p in systemMonitorController.ProgramStatusFeedbackCollection)
|
||||
{
|
||||
|
||||
// TODO: link feedbacks for each program slot
|
||||
var programNumber = p.Value.Program.Number;
|
||||
|
||||
//Debug.Console(1, systemMonitorController, "Linking API for Program Slot: {0} starting at join: {1}", programNumber, programSlotJoinStart);
|
||||
|
||||
trilist.SetBoolSigAction(programSlotJoinStart + joinMap.ProgramStart, new Action<bool>
|
||||
(b => SystemMonitor.ProgramCollection[programNumber].OperatingState = eProgramOperatingState.Start));
|
||||
p.Value.ProgramStartedFeedback.LinkInputSig(trilist.BooleanInput[programSlotJoinStart + joinMap.ProgramStart]);
|
||||
|
||||
trilist.SetBoolSigAction(programSlotJoinStart + joinMap.ProgramStop, new Action<bool>
|
||||
(b => SystemMonitor.ProgramCollection[programNumber].OperatingState = eProgramOperatingState.Stop));
|
||||
p.Value.ProgramStoppedFeedback.LinkInputSig(trilist.BooleanInput[programSlotJoinStart + joinMap.ProgramStop]);
|
||||
|
||||
trilist.SetBoolSigAction(programSlotJoinStart + joinMap.ProgramRegister, new Action<bool>
|
||||
(b => SystemMonitor.ProgramCollection[programNumber].RegistrationState = eProgramRegistrationState.Register));
|
||||
p.Value.ProgramRegisteredFeedback.LinkInputSig(trilist.BooleanInput[programSlotJoinStart + joinMap.ProgramRegister]);
|
||||
|
||||
trilist.SetBoolSigAction(programSlotJoinStart + joinMap.ProgramUnregister, new Action<bool>
|
||||
(b => SystemMonitor.ProgramCollection[programNumber].RegistrationState = eProgramRegistrationState.Unregister));
|
||||
p.Value.ProgramUnregisteredFeedback.LinkInputSig(trilist.BooleanInput[programSlotJoinStart + joinMap.ProgramUnregister]);
|
||||
|
||||
programSlotJoinStart = programSlotJoinStart + joinMap.ProgramOffsetJoin;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class SystemMonitorJoinMap : JoinMapBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Offset to indicate where the range of iterated program joins will start
|
||||
/// </summary>
|
||||
public uint ProgramStartJoin { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Offset between each program join set
|
||||
/// </summary>
|
||||
public uint ProgramOffsetJoin { get; set; }
|
||||
|
||||
//Digital
|
||||
public uint ProgramStart { get; set; }
|
||||
public uint ProgramStop { get; set; }
|
||||
public uint ProgramRegister { get; set; }
|
||||
public uint ProgramUnregister { get; set; }
|
||||
|
||||
//Analog
|
||||
public uint TimeZone { get; set; }
|
||||
|
||||
//Serial
|
||||
public uint TimeZoneName { get; set; }
|
||||
public uint IOControllerVersion { get; set; }
|
||||
public uint SnmpAppVersion { get; set; }
|
||||
public uint BACnetAppVersion { get; set; }
|
||||
public uint ControllerVersion { get; set; }
|
||||
|
||||
public uint ProgramName { get; set; }
|
||||
public uint ProgramCompiledTime { get; set; }
|
||||
public uint ProgramCrestronDatabaseVersion { get; set; }
|
||||
public uint ProgramEnvironmentVersion { get; set; }
|
||||
public uint AggregatedProgramInfo { get; set; }
|
||||
|
||||
public SystemMonitorJoinMap()
|
||||
{
|
||||
TimeZone = 1;
|
||||
|
||||
TimeZoneName = 1;
|
||||
IOControllerVersion = 2;
|
||||
SnmpAppVersion = 3;
|
||||
BACnetAppVersion = 4;
|
||||
ControllerVersion = 5;
|
||||
|
||||
|
||||
ProgramStartJoin = 10;
|
||||
|
||||
ProgramOffsetJoin = 5;
|
||||
|
||||
// Offset in groups of 5 joins
|
||||
ProgramStart = 1;
|
||||
ProgramStop = 2;
|
||||
ProgramRegister = 3;
|
||||
ProgramUnregister = 4;
|
||||
|
||||
ProgramName = 1;
|
||||
ProgramCompiledTime = 2;
|
||||
ProgramCrestronDatabaseVersion = 3;
|
||||
ProgramEnvironmentVersion = 4;
|
||||
AggregatedProgramInfo = 5;
|
||||
}
|
||||
|
||||
public override void OffsetJoinNumbers(uint joinStart)
|
||||
{
|
||||
var joinOffset = joinStart - 1;
|
||||
|
||||
TimeZone = TimeZone + joinOffset;
|
||||
|
||||
TimeZoneName = TimeZoneName + joinOffset;
|
||||
IOControllerVersion = IOControllerVersion + joinOffset;
|
||||
SnmpAppVersion = SnmpAppVersion + joinOffset;
|
||||
BACnetAppVersion = BACnetAppVersion + joinOffset;
|
||||
ControllerVersion = ControllerVersion + joinOffset;
|
||||
|
||||
// Sets the initial join value where the iterated program joins will begin
|
||||
ProgramStartJoin = ProgramStartJoin + joinOffset;
|
||||
}
|
||||
}
|
||||
}
|
||||
54
PepperDashEssentials/Bridges/TvOneBridge.cs
Normal file
54
PepperDashEssentials/Bridges/TvOneBridge.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Devices.Common;
|
||||
|
||||
namespace PepperDash.Essentials.Bridges
|
||||
{
|
||||
public static class TvOneApiExtensions
|
||||
{
|
||||
public static void LinkToApi(this TVOneCorio TvOne, BasicTriList trilist, uint joinStart, string joinMapKey)
|
||||
{
|
||||
var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as TvOneJoinMap;
|
||||
|
||||
if (joinMap == null)
|
||||
joinMap = new TvOneJoinMap();
|
||||
|
||||
joinMap.OffsetJoinNumbers(joinStart);
|
||||
Debug.Console(1, TvOne, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||
|
||||
TvOne.OnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]);
|
||||
trilist.SetUShortSigAction(joinMap.CallPreset, u => TvOne.CallPreset(u));
|
||||
TvOne.PresetFeedback.LinkInputSig(trilist.UShortInput[joinMap.PresetFeedback]);
|
||||
}
|
||||
}
|
||||
public class TvOneJoinMap : JoinMapBase
|
||||
{
|
||||
public uint CallPreset { get; set; }
|
||||
public uint PresetFeedback { get; set; }
|
||||
public uint IsOnline { get; set; }
|
||||
public TvOneJoinMap()
|
||||
{
|
||||
// Digital
|
||||
CallPreset = 1;
|
||||
PresetFeedback = 1;
|
||||
IsOnline = 1;
|
||||
|
||||
}
|
||||
|
||||
public override void OffsetJoinNumbers(uint joinStart)
|
||||
{
|
||||
var joinOffset = joinStart - 1;
|
||||
|
||||
IsOnline = IsOnline + joinOffset;
|
||||
CallPreset = CallPreset + joinOffset;
|
||||
PresetFeedback = PresetFeedback + joinOffset;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
{
|
||||
|
||||
//public class TPConfig : DeviceConfig
|
||||
//{
|
||||
// new public TPConfigProperties Properties { get; set; }
|
||||
//}
|
||||
|
||||
//public class TPConfigProperties
|
||||
//{
|
||||
// /*
|
||||
// "properties": {
|
||||
// "ipId": "aa",
|
||||
// "defaultSystemKey": "system1",
|
||||
// "sgdPath": "\\NVRAM\\Program1\\Sgds\\PepperDash Essentials TSW1050_v0.9.sgd",
|
||||
// "usesSplashPage": true,
|
||||
// "showDate": true,
|
||||
// "showTime": false
|
||||
// }
|
||||
// */
|
||||
// public uint IpId { get; set; }
|
||||
// public string deafultSystemKey { get; set; }
|
||||
// public string SgdPath { get; set; }
|
||||
// public bool UsesSplashPage { get; set; }
|
||||
// public bool ShowDate { get; set; }
|
||||
// public bool ShowTime { get; set; }
|
||||
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
///// <summary>
|
||||
///// The gist of this converter: The comspec JSON comes in with normal values that need to be converted
|
||||
///// into enum names. This converter takes the value and applies the appropriate enum's name prefix to the value
|
||||
///// and then returns the enum value using Enum.Parse
|
||||
///// </summary>
|
||||
//public class TPPropertiesConverter : JsonConverter
|
||||
//{
|
||||
// public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
|
||||
// {
|
||||
// return JObject.Load(reader);
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// This will be hit with every value in the ComPortConfig class. We only need to
|
||||
// /// do custom conversion on the comspec items.
|
||||
// /// </summary>
|
||||
// public override bool CanConvert(Type objectType)
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// public override bool CanRead { get { return true; } }
|
||||
// public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
//}
|
||||
}
|
||||
82
PepperDashEssentials/Configuration Original/ConfigTieLine.cs
Normal file
82
PepperDashEssentials/Configuration Original/ConfigTieLine.cs
Normal file
@@ -0,0 +1,82 @@
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
{
|
||||
public class ConfigTieLine
|
||||
{
|
||||
[JsonProperty(Required=Required.Always)]
|
||||
public string SourceDeviceKey { get; set; }
|
||||
|
||||
[JsonProperty(Required = Required.Always)]
|
||||
public string SourcePortKey { get; set; }
|
||||
|
||||
[JsonProperty(Required = Required.Always)]
|
||||
public string DestinationDeviceKey { get; set; }
|
||||
|
||||
[JsonProperty(Required = Required.Always)]
|
||||
public string DestinationPortKey { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("Tie line: [{0}]{1} --> [{2}]{3}", SourceDeviceKey, SourcePortKey, DestinationDeviceKey, DestinationPortKey);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a tie line if one can be constructed between the two devices and ports
|
||||
/// </summary>
|
||||
/// <returns>TieLine or null if devices or ports don't exist</returns>
|
||||
public TieLine GetTieLine()
|
||||
{
|
||||
var sourceDevice = (IRoutingOutputs)DeviceManager.GetDeviceForKey(SourceDeviceKey);
|
||||
var destinationDevice = (IRoutingInputs)DeviceManager.GetDeviceForKey(DestinationDeviceKey);
|
||||
|
||||
if (sourceDevice == null)
|
||||
{
|
||||
Debug.Console(0, " Cannot create TieLine. Source device '{0}' not found or does not have outputs",
|
||||
SourceDeviceKey);
|
||||
return null;
|
||||
}
|
||||
else if (destinationDevice == null)
|
||||
{
|
||||
Debug.Console(0, " Cannot create TieLine. Destination device '{0}' not found or does not have inputs",
|
||||
DestinationDeviceKey);
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get the ports by key name from the lists
|
||||
RoutingOutputPort sourcePort = sourceDevice.OutputPorts.FirstOrDefault(
|
||||
p => p.Key.Equals(SourcePortKey, System.StringComparison.OrdinalIgnoreCase));
|
||||
//RoutingOutputPort sourcePort = null;
|
||||
//sourceDevice.OutputPorts.TryGetValue(SourcePortKey, out sourcePort);
|
||||
if (sourcePort == null)
|
||||
{
|
||||
Debug.Console(0, " Cannot create TieLine {0}-->{1}. Source device does not have output port '{2}'",
|
||||
sourceDevice.Key, destinationDevice.Key, SourcePortKey);
|
||||
return null;
|
||||
}
|
||||
|
||||
RoutingInputPort destinationPort = destinationDevice.InputPorts.FirstOrDefault(
|
||||
p => p.Key.Equals(DestinationPortKey, System.StringComparison.OrdinalIgnoreCase));
|
||||
//RoutingInputPort destinationPort = null;
|
||||
//destinationDevice.InputPorts.TryGetValue(DestinationPortKey, out destinationPort);
|
||||
if (destinationPort == null)
|
||||
{
|
||||
Debug.Console(0, " Cannot create TieLine {0}-->{1}. Destination device does not have input port '{2}'",
|
||||
sourceDevice.Key, destinationDevice.Key, DestinationPortKey);
|
||||
return null;
|
||||
}
|
||||
|
||||
var tl = new TieLine(sourcePort, destinationPort);
|
||||
Debug.Console(1, " Created {0}", this);
|
||||
return tl;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
287
PepperDashEssentials/Configuration Original/Configuration.cs
Normal file
287
PepperDashEssentials/Configuration Original/Configuration.cs
Normal file
@@ -0,0 +1,287 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharp.CrestronIO;
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using Crestron.SimplSharpPro.CrestronThread;
|
||||
using Crestron.SimplSharpPro.Diagnostics;
|
||||
using Crestron.SimplSharpPro.EthernetCommunication;
|
||||
using Crestron.SimplSharpPro.UI;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Devices;
|
||||
//using PepperDash.Essentials.Core.Devices.Dm;
|
||||
//using PepperDash.Essentials.Fusion;
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
{
|
||||
public static class Configuration
|
||||
{
|
||||
|
||||
public static string LastPath { get; private set; }
|
||||
public static CrestronControlSystem ControlSystem { get; private set; }
|
||||
|
||||
public static void Initialize(CrestronControlSystem cs)
|
||||
{
|
||||
CrestronConsole.AddNewConsoleCommand(ReloadFromConsole, "configreload", "Reloads configuration file",
|
||||
ConsoleAccessLevelEnum.AccessOperator);
|
||||
ControlSystem = cs;
|
||||
}
|
||||
|
||||
public static bool ReadConfiguration(string filePath)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Read file
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
LastPath = filePath;
|
||||
string json = File.ReadToEnd(filePath, System.Text.Encoding.ASCII);
|
||||
JObject jo = JObject.Parse(json);
|
||||
|
||||
var info = JsonConvert.DeserializeObject<ConfigInfo>(jo["info"].ToString());
|
||||
Debug.Console(0, "\r[Config] file read:");
|
||||
Debug.Console(0, " File: {0}", filePath);
|
||||
Debug.Console(0, " Name: {0}", info.Name);
|
||||
Debug.Console(0, " Type: {0}", info.SystemTemplateType);
|
||||
Debug.Console(0, " Date: {0}", info.EditDate);
|
||||
Debug.Console(0, " ConfigVersion: {0}", info.Version);
|
||||
Debug.Console(0, " EditedBy: {0}", info.EditedBy);
|
||||
Debug.Console(0, " Comment: {0}\r", info.Comment);
|
||||
|
||||
// Get the main config object
|
||||
var jConfig = jo["configuration"];
|
||||
|
||||
// Devices
|
||||
var jDevices = (JArray)jConfig["devices"];
|
||||
CreateDevices(jDevices);
|
||||
|
||||
// TieLines
|
||||
var jRouting = jConfig["routing"];
|
||||
CreateRouting(jRouting);
|
||||
|
||||
/// Parse the available source list(s)
|
||||
var jSourceLists = (JArray)jConfig["sourceLists"];
|
||||
var jSourceListJson = jSourceLists.ToString();
|
||||
List<ConfigSourceList> sourceLists = JsonConvert.DeserializeObject<List<ConfigSourceList>>(jSourceListJson);
|
||||
|
||||
// System
|
||||
var jSystems = (JArray)jConfig["systems"];
|
||||
CreateSystems(jSystems, sourceLists);
|
||||
|
||||
// Activate everything
|
||||
DeviceManager.ActivateAll();
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(0, "[Config] file not found '{0}'", filePath);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Console(0, "Configuration read error: \r {0}", e);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void CreateDevices(JArray jDevices)
|
||||
{
|
||||
//Debug.Console(0, " Creating {0} devices", jDevices.Count);
|
||||
//for (int i = 0; i < jDevices.Count; i++)
|
||||
//{
|
||||
// var jDev = jDevices[i];
|
||||
|
||||
// //var devConfig = JsonConvert.DeserializeObject<DeviceConfig>(jDev.ToString());
|
||||
// //Debug.Console(0, "++++++++++++{0}", devConfig);
|
||||
|
||||
|
||||
// var group = jDev["group"].Value<string>();
|
||||
// Debug.Console(0, " [{0}], creating {1}:{2}", jDev["key"].Value<string>(),
|
||||
// group, jDev["type"].Value<string>());
|
||||
|
||||
// Device dev = null;
|
||||
// if (group.Equals("Display", StringComparison.OrdinalIgnoreCase))
|
||||
// dev = DisplayFactory.CreateDisplay(jDev);
|
||||
// else if (group.Equals("DeviceMonitor", StringComparison.OrdinalIgnoreCase))
|
||||
// dev = DeviceManagerFactory.Create(jDev);
|
||||
// //else if (group.Equals("Pc", StringComparison.OrdinalIgnoreCase))
|
||||
// // dev = PcFactory.Create(jDev);
|
||||
// //else if (group.Equals("SetTopBox", StringComparison.OrdinalIgnoreCase))
|
||||
// // dev = SetTopBoxFactory.Create(jDev);
|
||||
// //else if (group.Equals("DiscPlayer", StringComparison.OrdinalIgnoreCase))
|
||||
// // dev = DiscPlayerFactory.Create(jDev);
|
||||
// //else if (group.Equals("Touchpanel", StringComparison.OrdinalIgnoreCase))
|
||||
// // dev = TouchpanelFactory.Create(jDev);
|
||||
// else if (group.Equals("dmEndpoint", StringComparison.OrdinalIgnoreCase)) // Add Transmitter and Receiver
|
||||
// dev = DmFactory.Create(jDev);
|
||||
// else if (group.Equals("dmChassic", StringComparison.OrdinalIgnoreCase))
|
||||
// dev = DmFactory.CreateChassis(jDev);
|
||||
// else if (group.Equals("processor", StringComparison.OrdinalIgnoreCase))
|
||||
// continue; // ignore it. Has no value right now.
|
||||
// //else if (group.Equals("remote", StringComparison.OrdinalIgnoreCase))
|
||||
// // dev = RemoteFactory.Create(jDev);
|
||||
// else
|
||||
// {
|
||||
// Debug.Console(0, " ERROR: Device [{0}] has unknown Group '{1}'. Skipping",
|
||||
// jDev["key"].Value<string>(), group);
|
||||
// continue;
|
||||
// }
|
||||
|
||||
// if (dev != null)
|
||||
// DeviceManager.AddDevice(dev);
|
||||
// else
|
||||
// Debug.Console(0, " ERROR: failed to create device {0}",
|
||||
// jDev["key"].Value<string>());
|
||||
//}
|
||||
}
|
||||
|
||||
static void CreateSystems(JArray jSystems, List<ConfigSourceList> sourceLists)
|
||||
{
|
||||
// // assuming one system
|
||||
// var jSystem = jSystems[0];
|
||||
// var name = jSystem.Value<string>("name");
|
||||
// var key = FactoryHelper.KeyOrConvertName(jSystem.Value<string>("key"), name);
|
||||
|
||||
// if (jSystem.Value<string>("type").Equals("EssentialsHuddleSpace", StringComparison.OrdinalIgnoreCase))
|
||||
// {
|
||||
// var sys = new HuddleSpaceRoom(key, name);
|
||||
// var props = jSystem["properties"];
|
||||
// var displayKey = props["displayKey"].Value<string>();
|
||||
// if (displayKey != null)
|
||||
// sys.DefaultDisplay = (DisplayBase)DeviceManager.GetDeviceForKey(displayKey);
|
||||
|
||||
// // Add sources from passed in config list
|
||||
// var myList = sourceLists.FirstOrDefault(
|
||||
// l => l.Key.Equals(props.Value<string>("sourceListKey"), StringComparison.OrdinalIgnoreCase));
|
||||
// if (myList != null)
|
||||
// AddSourcesToSystem(sys, myList);
|
||||
|
||||
// DeviceManager.AddDevice(sys);
|
||||
|
||||
// //spin up a fusion thing too
|
||||
//#warning add this fusion connector back in later
|
||||
// //DeviceManager.AddDevice(new EssentialsHuddleSpaceFusionSystemController(sys, 0xf1));
|
||||
//}
|
||||
}
|
||||
|
||||
//static void AddSourcesToSystem(Room system, ConfigSourceList configList)
|
||||
//{
|
||||
//foreach (var configItem in configList.PresentationSources)
|
||||
//{
|
||||
// var src = (IPresentationSource)DeviceManager.GetDeviceForKey(configItem.SourceKey);
|
||||
// if (src != null)
|
||||
// system.Sources.Add(configItem.Number, src);
|
||||
// else
|
||||
// Debug.Console(0, system, "cannot find source '{0}' from list {1}",
|
||||
// configItem.SourceKey, configList.Name);
|
||||
//}
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// Links up routing, creates tie lines
|
||||
/// </summary>
|
||||
/// <param name="jRouting">The "Routing" JArray from configuration</param>
|
||||
static void CreateRouting(JToken jRouting)
|
||||
{
|
||||
var jsonTieLines = jRouting["tieLines"].ToString();
|
||||
var tieLineConfigs = JsonConvert.DeserializeObject<List<ConfigTieLine>>(jsonTieLines);
|
||||
foreach (var c in tieLineConfigs)
|
||||
{
|
||||
var tl = c.GetTieLine();
|
||||
if (tl != null)
|
||||
TieLineCollection.Default.Add(tl);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns the IIROutputPorts device (control system, etc) that contains a given IR port
|
||||
/// </summary>
|
||||
/// <param name="propsToken"></param>
|
||||
static IROutputPort GetIrPort(JToken propsToken)
|
||||
{
|
||||
var portDevName = propsToken.Value<string>("IrPortDevice");
|
||||
var portNum = propsToken.Value<uint>("IrPortNumber");
|
||||
if (portDevName.Equals("controlSystem", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
IIROutputPorts irDev = ControlSystem;
|
||||
if (portNum <= irDev.NumberOfIROutputPorts)
|
||||
return ControlSystem.IROutputPorts[portNum];
|
||||
else
|
||||
Debug.Console(0, "[Config] ERROR: IR Port {0} out of range. Range 0-{1} on {2}", portNum,
|
||||
ControlSystem.IROutputPorts.Count, irDev.ToString());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static void HandleUnknownType(JToken devToken, string type)
|
||||
{
|
||||
Debug.Console(0, "[Config] ERROR: Type '{0}' not found in group '{1}'", type,
|
||||
devToken.Value<string>("Group"));
|
||||
}
|
||||
|
||||
static void HandleDeviceCreationError(JToken devToken, Exception e)
|
||||
{
|
||||
Debug.Console(0, "[Config] ERROR creating device [{0}]: \r{1}",
|
||||
devToken["Key"].Value<string>(), e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Console helper to reload
|
||||
/// </summary>
|
||||
static void ReloadFromConsole(string s)
|
||||
{
|
||||
// Gotta tear down everything first!
|
||||
|
||||
if (!string.IsNullOrEmpty(LastPath))
|
||||
{
|
||||
ReadConfiguration(LastPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class ConfigSourceList
|
||||
{
|
||||
[JsonProperty(Required = Required.Always)]
|
||||
public string Key { get; set; }
|
||||
|
||||
[JsonProperty(Required = Required.Always)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[JsonProperty(Required = Required.Always)]
|
||||
public List<ConfigSourceItem> PresentationSources { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class ConfigSourceItem
|
||||
{
|
||||
[JsonProperty(Required = Required.Always)]
|
||||
public uint Number { get; set; }
|
||||
|
||||
[JsonProperty(Required = Required.Always)]
|
||||
public string SourceKey { get; set; }
|
||||
|
||||
public string AlternateName { get; set; }
|
||||
}
|
||||
|
||||
public class ConfigInfo
|
||||
{
|
||||
public string SystemTemplateType { get; set; }
|
||||
public string ProcessorType { get; set; }
|
||||
public string Name { get; set; }
|
||||
public uint ProgramSlotNumber { get; set; }
|
||||
public string Version { get; set; }
|
||||
public string EditedBy { get; set; }
|
||||
public string EditDate { get; set; }
|
||||
public string Comment { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
{
|
||||
public class SourceListConfigProperties
|
||||
{
|
||||
[JsonProperty(Required= Required.Always)]
|
||||
public uint Number { get; set; }
|
||||
[JsonProperty(Required= Required.Always)]
|
||||
public string SourceKey { get; set; }
|
||||
public string AltName { get; set; }
|
||||
public string AltIcon { get; set; }
|
||||
|
||||
public SourceListConfigProperties()
|
||||
{
|
||||
AltName = "";
|
||||
AltIcon = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
//using System;
|
||||
//using Crestron.SimplSharpPro;
|
||||
|
||||
//using Newtonsoft.Json;
|
||||
//using Newtonsoft.Json.Linq;
|
||||
|
||||
//using PepperDash.Essentials.Core;
|
||||
//using PepperDash.Essentials.Devices;
|
||||
//using PepperDash.Core;
|
||||
|
||||
//namespace PepperDash.Essentials
|
||||
//{
|
||||
// public class CommFactory
|
||||
// {
|
||||
// public static IBasicCommunication CreateCommForDevice(JToken devToken)
|
||||
// {
|
||||
// var devKey = devToken.Value<string>("key");
|
||||
// IBasicCommunication comm = null;
|
||||
// try
|
||||
// {
|
||||
// var control = devToken["properties"]["control"];
|
||||
// var commMethod = control["method"].Value<string>();
|
||||
// if (commMethod == "com")
|
||||
// {
|
||||
// var comConfig = JsonConvert.DeserializeObject<ComPortConfig>(
|
||||
// control["comParams"].ToString(),
|
||||
// new JsonSerializerSettings
|
||||
// {
|
||||
// // Needs ObjectCreationHandling to make the ComSpec struct populate
|
||||
// ObjectCreationHandling = ObjectCreationHandling.Replace,
|
||||
// Converters = new JsonConverter[] { new ComSpecJsonConverter() }
|
||||
// });
|
||||
// comm = new ComPortController(devKey + "-com", comConfig.GetComPort(), comConfig.ComSpec);
|
||||
// }
|
||||
// else if (commMethod == "tcpIp")
|
||||
// {
|
||||
// var tcpConfig = JsonConvert.DeserializeObject<TcpIpConfig>(control["tcpParams"].ToString());
|
||||
// comm = new GenericTcpIpClient(devKey + "-tcp", tcpConfig.Address, tcpConfig.Port, tcpConfig.BufferSize);
|
||||
// }
|
||||
// }
|
||||
// catch (Exception e)
|
||||
// {
|
||||
// Debug.Console(0, "Cannot create communication from JSON:\r{0}\r\rException:\r{1}", devToken.ToString(), e);
|
||||
// }
|
||||
|
||||
// // put it in the device manager if it's the right flavor
|
||||
// var comDev = comm as Device;
|
||||
// if (comDev != null)
|
||||
// DeviceManager.AddDevice(comDev);
|
||||
|
||||
// return comm;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
@@ -0,0 +1,38 @@
|
||||
//using System;
|
||||
//using Crestron.SimplSharpPro;
|
||||
|
||||
//using Newtonsoft.Json.Linq;
|
||||
|
||||
//using PepperDash.Essentials.Core;
|
||||
//using PepperDash.Essentials.Core.Devices;
|
||||
//using PepperDash.Core;
|
||||
|
||||
//namespace PepperDash.Essentials
|
||||
//{
|
||||
// public class DeviceManagerFactory
|
||||
// {
|
||||
// public static Device Create(JToken devToken)
|
||||
// {
|
||||
// Device dev = null;
|
||||
// try
|
||||
// {
|
||||
// var devType = devToken.Value<string>("type");
|
||||
// var devKey = devToken.Value<string>("key");
|
||||
// var devName = devToken.Value<string>("name");
|
||||
// if (devType.Equals("DeviceMonitor", StringComparison.OrdinalIgnoreCase))
|
||||
// {
|
||||
// var comm = CommFactory.CreateCommForDevice(devToken);
|
||||
// if (comm == null) return null;
|
||||
// dev = new GenericCommunicationMonitoredDevice(devKey, devName, comm, devToken["properties"]["pollString"].Value<string>());
|
||||
// }
|
||||
// else
|
||||
// FactoryHelper.HandleUnknownType(devToken, devType);
|
||||
// }
|
||||
// catch (Exception e)
|
||||
// {
|
||||
// FactoryHelper.HandleDeviceCreationError(devToken, e);
|
||||
// }
|
||||
// return dev;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
@@ -0,0 +1,122 @@
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Text;
|
||||
//using Crestron.SimplSharp;
|
||||
|
||||
//using Newtonsoft.Json;
|
||||
//using Newtonsoft.Json.Linq;
|
||||
|
||||
//using PepperDash.Essentials.Core;
|
||||
//using PepperDash.Essentials.Devices;
|
||||
//using PepperDash.Essentials.Displays;
|
||||
//using PepperDash.Core;
|
||||
|
||||
//namespace PepperDash.Essentials
|
||||
//{
|
||||
// public class DisplayFactory
|
||||
// {
|
||||
// public static DisplayBase CreateDisplay(JToken devToken)
|
||||
// {
|
||||
// DisplayBase dev = null;
|
||||
// try
|
||||
// {
|
||||
// var devType = devToken.Value<string>("type");
|
||||
// var devKey = devToken.Value<string>("key");
|
||||
// var devName = devToken.Value<string>("name");
|
||||
// var properties = devToken["properties"];
|
||||
|
||||
// if (devType.Equals("MockDisplay", StringComparison.OrdinalIgnoreCase))
|
||||
// dev = new MockDisplay(devKey, devName);
|
||||
|
||||
// else if (devType.Equals("NecMPSX", StringComparison.OrdinalIgnoreCase))
|
||||
// {
|
||||
// var comm = CommFactory.CreateCommForDevice(devToken);
|
||||
// if (comm == null) return null;
|
||||
// dev = new NecPSXMDisplayCom(devKey, devName, comm);
|
||||
|
||||
|
||||
|
||||
// //var commMethod = properties["control"]["method"].Value<string>();
|
||||
|
||||
// //// Helper-ize this?
|
||||
// //if(commMethod == "com")
|
||||
// //{
|
||||
// // // Move some of this up above???
|
||||
// // var comConfig = JsonConvert.DeserializeObject<ComPortConfig>(
|
||||
// // properties["control"]["comParams"].ToString(),
|
||||
// // new JsonSerializerSettings {
|
||||
// // // Needs ObjectCreationHandling to make the ComSpec struct populate
|
||||
// // ObjectCreationHandling = ObjectCreationHandling.Replace,
|
||||
// // Converters = new JsonConverter[] { new ComSpecJsonConverter() }
|
||||
// // });
|
||||
// // dev = new NecPSXMDisplayCom(devKey, devName, comConfig.GetComPort(), comConfig.ComSpec);
|
||||
// //}
|
||||
// //else if (commMethod == "tcpIp")
|
||||
// //{
|
||||
// // var spec = properties["control"]["tcpSpec"];
|
||||
// // var host = spec["address"].Value<string>();
|
||||
// // var port = spec["port"].Value<int>();
|
||||
// // dev = new NecPSXMDisplayCom(devKey, devName, host, port);
|
||||
// //}
|
||||
|
||||
|
||||
|
||||
// }
|
||||
|
||||
// else if (devType.Equals("NecNpPa550", StringComparison.OrdinalIgnoreCase))
|
||||
// {
|
||||
// var proj = new NecPaSeriesProjector(devKey, devName);
|
||||
// var comm = CreateCommunicationFromPropertiesToken(
|
||||
// devKey + "-comm", properties, 3000);
|
||||
// proj.CommunicationMethod = comm;
|
||||
// dev = proj;
|
||||
// }
|
||||
// else
|
||||
// FactoryHelper.HandleUnknownType(devToken, devType);
|
||||
// }
|
||||
// catch (Exception e)
|
||||
// {
|
||||
// FactoryHelper.HandleDeviceCreationError(devToken, e);
|
||||
// }
|
||||
// return dev;
|
||||
// }
|
||||
|
||||
// public static IBasicCommunication CreateCommunicationFromPropertiesToken(
|
||||
// string commKey, JToken properties, int bufferSize)
|
||||
// {
|
||||
// Debug.Console(2, "Building port from: {0}", properties.ToString());
|
||||
|
||||
// var tcpToken = properties["TcpIp"];
|
||||
// if (tcpToken != null)
|
||||
// {
|
||||
// // Convert the Tcp property
|
||||
// var spec = JsonConvert.DeserializeObject<TcpIpConfig>(tcpToken.ToString());
|
||||
|
||||
// var tcp = new GenericTcpIpClient(commKey, spec.Address, spec.Port, bufferSize);
|
||||
// DeviceManager.AddDevice(tcp);
|
||||
// return tcp;
|
||||
// }
|
||||
|
||||
// var com = properties["Com"];
|
||||
// if (com != null)
|
||||
// {
|
||||
// // Make the interim config object
|
||||
// var comConfig = JsonConvert.DeserializeObject<ComPortConfig>(com.ToString(),
|
||||
// new JsonSerializerSettings { ObjectCreationHandling = ObjectCreationHandling.Replace });
|
||||
|
||||
// // Get the IComPorts hardware device from the Device or Control System
|
||||
// var comDev = comConfig.GetIComPortsDeviceFromManagedDevice();
|
||||
// if (comDev != null)
|
||||
// {
|
||||
// var controller = new ComPortController(commKey, comDev.ComPorts[comConfig.ComPortNumber], comConfig.ComSpec);
|
||||
// DeviceManager.AddDevice(controller);
|
||||
// return controller;
|
||||
// }
|
||||
// }
|
||||
// Debug.Console(0, "No Tcp or Com port information for port {0}", commKey);
|
||||
// return null;
|
||||
// }
|
||||
|
||||
// }
|
||||
//}
|
||||
@@ -0,0 +1,101 @@
|
||||
using System;
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.DM;
|
||||
using Crestron.SimplSharpPro.DM.Endpoints.Receivers;
|
||||
using Crestron.SimplSharpPro.DM.Endpoints.Transmitters;
|
||||
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Devices;
|
||||
//using PepperDash.Essentials.Devices.Dm;
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
{
|
||||
public class DmFactory
|
||||
{
|
||||
public static Device Create(JToken devToken)
|
||||
{
|
||||
Device dev = null;
|
||||
try
|
||||
{
|
||||
var devType = devToken.Value<string>("type");
|
||||
var devKey = devToken.Value<string>("key");
|
||||
var devName = devToken.Value<string>("name");
|
||||
// Catch all 200 series TX
|
||||
var devprops = devToken["properties"];
|
||||
var ipId = Convert.ToUInt32(devprops.Value<string>("ipId"), 16);
|
||||
var parent = devprops.Value<string>("parent");
|
||||
if (parent == null)
|
||||
parent = "controlSystem";
|
||||
|
||||
if (devType.StartsWith("DmTx2", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
DmTx201C tx;
|
||||
if (parent.Equals("controlSystem", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
tx = new DmTx201C(ipId, Global.ControlSystem);
|
||||
//dev = new DmTx201SBasicController(devKey, devName, tx);
|
||||
}
|
||||
|
||||
}
|
||||
else if (devType.StartsWith("DmRmc", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
DmRmc100C rmc;
|
||||
if (parent.Equals("controlSystem", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
rmc = new DmRmc100C(ipId, Global.ControlSystem);
|
||||
//dev = new DmRmcBaseController(devKey, devName, rmc);
|
||||
}
|
||||
}
|
||||
else
|
||||
FactoryHelper.HandleUnknownType(devToken, devType);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
FactoryHelper.HandleDeviceCreationError(devToken, e);
|
||||
}
|
||||
return dev;
|
||||
}
|
||||
|
||||
|
||||
public static Device CreateChassis(JToken devToken)
|
||||
{
|
||||
Device dev = null;
|
||||
try
|
||||
{
|
||||
var devType = devToken.Value<string>("type");
|
||||
var devKey = devToken.Value<string>("key");
|
||||
var devName = devToken.Value<string>("name");
|
||||
// Catch all 200 series TX
|
||||
var devprops = devToken["properties"];
|
||||
var ipId = Convert.ToUInt32(devprops.Value<string>("ipId"), 16);
|
||||
var parent = devprops.Value<string>("parent");
|
||||
if (parent == null)
|
||||
parent = "controlSystem";
|
||||
|
||||
if (devType.Equals("dmmd8x8", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
var dm = new DmMd8x8(ipId, Global.ControlSystem);
|
||||
//dev = new DmChassisController(devKey, devName, dm);
|
||||
}
|
||||
else if (devType.Equals("dmmd16x16", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
var dm = new DmMd16x16(ipId, Global.ControlSystem);
|
||||
//dev = new DmChassisController(devKey, devName, dm);
|
||||
}
|
||||
else if (devType.Equals("dmmd32x32", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
var dm = new DmMd32x32(ipId, Global.ControlSystem);
|
||||
//dev = new DmChassisController(devKey, devName, dm);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
FactoryHelper.HandleDeviceCreationError(devToken, e);
|
||||
}
|
||||
return dev;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Devices;
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
{
|
||||
public static class FactoryHelper
|
||||
{
|
||||
public static string IrDriverPathPrefix = Global.FilePathPrefix + "IR" + Global.DirectorySeparator;
|
||||
|
||||
public static void HandleUnknownType(JToken devToken, string type)
|
||||
{
|
||||
Debug.Console(0, "[Config] ERROR: Type '{0}' not found in group '{1}'", type,
|
||||
devToken.Value<string>("group"));
|
||||
}
|
||||
|
||||
public static void HandleDeviceCreationError(JToken devToken, Exception e)
|
||||
{
|
||||
Debug.Console(0, "[Config] ERROR creating device [{0}]: \r{1}",
|
||||
devToken["key"].Value<string>(), e);
|
||||
Debug.Console(0, "Relevant config:\r{0}", devToken.ToString(Newtonsoft.Json.Formatting.Indented));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Finds either the ControlSystem or a device controller that contains IR ports and
|
||||
/// returns a port from the hardware device
|
||||
/// </summary>
|
||||
/// <param name="propsToken"></param>
|
||||
/// <returns>Crestron IrPort or null if device doesn't have IR or is not found</returns>
|
||||
public static IrOutPortConfig GetIrPort(JToken propsToken)
|
||||
{
|
||||
var irSpec = propsToken["control"]["irSpec"];
|
||||
var portDevKey = irSpec.Value<string>("portDeviceKey");
|
||||
var portNum = irSpec.Value<uint>("portNumber");
|
||||
IIROutputPorts irDev = null;
|
||||
if (portDevKey.Equals("controlSystem", StringComparison.OrdinalIgnoreCase)
|
||||
|| portDevKey.Equals("processor", StringComparison.OrdinalIgnoreCase))
|
||||
irDev = Global.ControlSystem;
|
||||
else
|
||||
irDev = DeviceManager.GetDeviceForKey(portDevKey) as IIROutputPorts;
|
||||
|
||||
if (irDev == null)
|
||||
{
|
||||
Debug.Console(0, "[Config] Error, device with IR ports '{0}' not found", portDevKey);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (portNum <= irDev.NumberOfIROutputPorts) // success!
|
||||
{
|
||||
var file = IrDriverPathPrefix + irSpec["file"].Value<string>();
|
||||
return new IrOutPortConfig { Port = irDev.IROutputPorts[portNum], FileName = file };
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(0, "[Config] Error, device '{0}' IR port {1} out of range",
|
||||
portDevKey, portNum);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Finds either the ControlSystem or a device controller that contains com ports and
|
||||
/// returns a port from the hardware device
|
||||
/// </summary>
|
||||
/// <param name="propsToken">The Properties token from the device's config</param>
|
||||
/// <returns>Crestron ComPort or null if device doesn't have IR or is not found</returns>
|
||||
public static ComPort GetComPort(JToken propsToken)
|
||||
{
|
||||
var portDevKey = propsToken.Value<string>("comPortDevice");
|
||||
var portNum = propsToken.Value<uint>("comPortNumber");
|
||||
IComPorts comDev = null;
|
||||
if (portDevKey.Equals("controlSystem", StringComparison.OrdinalIgnoreCase))
|
||||
comDev = Global.ControlSystem;
|
||||
else
|
||||
comDev = DeviceManager.GetDeviceForKey(portDevKey) as IComPorts;
|
||||
|
||||
if (comDev == null)
|
||||
{
|
||||
Debug.Console(0, "[Config] Error, device with com ports '{0}' not found", portDevKey);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (portNum <= comDev.NumberOfComPorts) // success!
|
||||
return comDev.ComPorts[portNum];
|
||||
else
|
||||
{
|
||||
Debug.Console(0, "[Config] Error, device '{0}' com port {1} out of range",
|
||||
portDevKey, portNum);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the key if it exists or converts the name into a key
|
||||
/// </summary>
|
||||
public static string KeyOrConvertName(string key, string name)
|
||||
{
|
||||
if (string.IsNullOrEmpty(key))
|
||||
return name.Replace(' ', '-');
|
||||
return key;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wrapper to help in IR port creation
|
||||
/// </summary>
|
||||
public class IrOutPortConfig
|
||||
{
|
||||
public IROutputPort Port { get; set; }
|
||||
public string FileName { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
//using System;
|
||||
//using Crestron.SimplSharpPro;
|
||||
|
||||
//using Newtonsoft.Json.Linq;
|
||||
|
||||
//using PepperDash.Essentials.Core;
|
||||
//using PepperDash.Essentials.Devices;
|
||||
|
||||
//using PepperDash.Core;
|
||||
|
||||
//namespace PepperDash.Essentials
|
||||
//{
|
||||
// public class SetTopBoxFactory
|
||||
// {
|
||||
// public static Device Create(JToken devToken)
|
||||
// {
|
||||
// Device dev = null;
|
||||
// try
|
||||
// {
|
||||
// var devType = devToken.Value<string>("type");
|
||||
// var devKey = devToken.Value<string>("key");
|
||||
// var devName = devToken.Value<string>("name");
|
||||
// var props = devToken["properties"];
|
||||
// var portConfig = FactoryHelper.GetIrPort(props);
|
||||
// if (portConfig != null)
|
||||
// {
|
||||
// if (devType.EndsWith("-generic"))
|
||||
// {
|
||||
// var stb = new IrSetTopBoxBase(devKey, devName, portConfig.Port, portConfig.FileName);
|
||||
// // Do this a better way?
|
||||
// stb.HasDpad = props["hasDpad"].Value<bool>();
|
||||
// stb.HasDvr = props["hasDvr"].Value<bool>();
|
||||
// stb.HasNumbers = props["hasNumbers"].Value<bool>();
|
||||
// stb.HasPreset = props["hasPresets"].Value<bool>();
|
||||
// dev = stb;
|
||||
// }
|
||||
// else
|
||||
// FactoryHelper.HandleUnknownType(devToken, devType);
|
||||
|
||||
// var preDev = dev as IHasSetTopBoxProperties;
|
||||
// if(preDev.HasPreset)
|
||||
// preDev.LoadPresets(props["presetListName"].Value<string>());
|
||||
// }
|
||||
// }
|
||||
// catch (Exception e)
|
||||
// {
|
||||
// FactoryHelper.HandleDeviceCreationError(devToken, e);
|
||||
// }
|
||||
// return dev;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
@@ -0,0 +1,34 @@
|
||||
//using System;
|
||||
//using Crestron.SimplSharpPro;
|
||||
|
||||
//using Newtonsoft.Json.Linq;
|
||||
|
||||
//using PepperDash.Essentials.Core;
|
||||
//using PepperDash.Essentials.Devices;
|
||||
//using PepperDash.Core;
|
||||
|
||||
//namespace PepperDash.Essentials
|
||||
//{
|
||||
// public class PcFactory
|
||||
// {
|
||||
// public static Device Create(JToken devToken)
|
||||
// {
|
||||
// Device dev = null;
|
||||
// //try
|
||||
// //{
|
||||
// // var devType = devToken.Value<string>("type");
|
||||
// // var devKey = devToken.Value<string>("key");
|
||||
// // var devName = devToken.Value<string>("name");
|
||||
// // if (devType.Equals("laptop", StringComparison.OrdinalIgnoreCase))
|
||||
// // dev = new Laptop(devKey, devName);
|
||||
// // else
|
||||
// // FactoryHelper.HandleUnknownType(devToken, devType);
|
||||
// //}
|
||||
// //catch (Exception e)
|
||||
// //{
|
||||
// // FactoryHelper.HandleDeviceCreationError(devToken, e);
|
||||
// //}
|
||||
// return dev;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
@@ -0,0 +1,46 @@
|
||||
//using System;
|
||||
//using Crestron.SimplSharpPro;
|
||||
|
||||
//using Newtonsoft.Json.Linq;
|
||||
|
||||
//using PepperDash.Essentials.Core;
|
||||
//using PepperDash.Essentials.Devices;
|
||||
//using PepperDash.Core;
|
||||
|
||||
//namespace PepperDash.Essentials
|
||||
//{
|
||||
// public class DiscPlayerFactory
|
||||
// {
|
||||
// public static Device Create(JToken devToken)
|
||||
// {
|
||||
// Device dev = null;
|
||||
// try
|
||||
// {
|
||||
// var devType = devToken.Value<string>("type");
|
||||
// var devKey = devToken.Value<string>("key");
|
||||
// var devName = devToken.Value<string>("name");
|
||||
|
||||
// // Filter out special (Pioneer
|
||||
// //(devType.Equals("genericIr", StringComparison.OrdinalIgnoreCase))
|
||||
|
||||
// var props = devToken["properties"];
|
||||
// var portConfig = FactoryHelper.GetIrPort(props);
|
||||
// if (portConfig != null)
|
||||
// {
|
||||
// if (devType.EndsWith("-generic"))
|
||||
// dev = new IrDvdBase(devKey, devName, portConfig.Port, portConfig.FileName);
|
||||
// else
|
||||
// FactoryHelper.HandleUnknownType(devToken, devType);
|
||||
// }
|
||||
|
||||
// // NO PORT ERROR HERE??
|
||||
|
||||
// }
|
||||
// catch (Exception e)
|
||||
// {
|
||||
// FactoryHelper.HandleDeviceCreationError(devToken, e);
|
||||
// }
|
||||
// return dev;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
@@ -0,0 +1,127 @@
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using Crestron.SimplSharpPro;
|
||||
//using Crestron.SimplSharpPro.Remotes;
|
||||
//using Crestron.SimplSharpPro.UI;
|
||||
//using Newtonsoft.Json;
|
||||
//using Newtonsoft.Json.Linq;
|
||||
|
||||
//using PepperDash.Essentials.Core;
|
||||
//using PepperDash.Essentials.Devices;
|
||||
////using PepperDash.Essentials.Remotes;
|
||||
//using PepperDash.Core;
|
||||
|
||||
//namespace PepperDash.Essentials
|
||||
//{
|
||||
// //public class RemoteFactory
|
||||
// //{
|
||||
// // public static Device Create(JToken devToken)
|
||||
// // {
|
||||
// // Hr150Controller dev = null;
|
||||
// // try
|
||||
// // {
|
||||
// // var devType = devToken.Value<string>("type");
|
||||
// // var devKey = devToken.Value<string>("key");
|
||||
// // var devName = devToken.Value<string>("name");
|
||||
// // var props = devToken["properties"];
|
||||
|
||||
// // if (devType.Equals("hr150", StringComparison.OrdinalIgnoreCase))
|
||||
// // {
|
||||
// // uint id = Convert.ToUInt32(props.Value<string>("rfId"), 16);
|
||||
// // var parent = props.Value<string>("rfGateway");
|
||||
// // RFExGateway rf = GetGateway(parent);
|
||||
|
||||
// // var hw = new Hr150(id, rf);
|
||||
// // dev = new Hr150Controller(devKey, devName, hw);
|
||||
|
||||
// // // Have to add the buttons and default source after all devices are spun up
|
||||
// // dev.AddPostActivationAction(() =>
|
||||
// // {
|
||||
// // var defaultSystemKey = props.Value<string>("defaultSystemKey");
|
||||
// // dev.SetCurrentRoom((EssentialsRoom)DeviceManager.GetDeviceForKey(defaultSystemKey));
|
||||
|
||||
// // // Link custom buttons
|
||||
// // var buttonProps = JsonConvert.DeserializeObject<Dictionary<uint, string>>(props["buttons"].ToString());
|
||||
// // foreach (var kvp in buttonProps)
|
||||
// // {
|
||||
// // var split = kvp.Value.Split(':');
|
||||
// // if (split[0].Equals("source"))
|
||||
// // {
|
||||
// // var src = DeviceManager.GetDeviceForKey(split[1]) as IPresentationSource;
|
||||
// // if (src == null)
|
||||
// // {
|
||||
// // Debug.Console(0, dev, "Error: Cannot add source key '{0}'", split[1]);
|
||||
// // continue;
|
||||
// // }
|
||||
// // dev.SetCustomButtonAsSource(kvp.Key, src);
|
||||
// // }
|
||||
// // else if (split[0] == "room")
|
||||
// // {
|
||||
// // if (split[1] == "off")
|
||||
// // dev.SetCustomButtonAsRoomOff(kvp.Key);
|
||||
// // }
|
||||
// // }
|
||||
// // });
|
||||
// // }
|
||||
// // else if (devType.Equals("tsr302", StringComparison.OrdinalIgnoreCase))
|
||||
// // {
|
||||
// // uint id = Convert.ToUInt32(props.Value<string>("rfId"), 16);
|
||||
// // var parent = props.Value<string>("rfGateway");
|
||||
// // RFExGateway rf = GetGateway(parent);
|
||||
// // var sgd = props.Value<string>("sgdPath");
|
||||
|
||||
// // var hw = new Tsr302(id, rf);
|
||||
|
||||
// // //dev = new Hr150Controller(devKey, devName, hw);
|
||||
|
||||
// // //// Have to add the buttons and default source after all devices are spun up
|
||||
// // //dev.AddPostActivationAction(() =>
|
||||
// // //{
|
||||
// // // var defaultSystemKey = props.Value<string>("defaultSystemKey");
|
||||
// // // dev.SetCurrentRoom((EssentialsRoom)DeviceManager.GetDeviceForKey(defaultSystemKey));
|
||||
|
||||
// // // // Link custom buttons
|
||||
// // // var buttonProps = JsonConvert.DeserializeObject<Dictionary<uint, string>>(props["buttons"].ToString());
|
||||
// // // foreach (var kvp in buttonProps)
|
||||
// // // {
|
||||
// // // var split = kvp.Value.Split(':');
|
||||
// // // if (split[0].Equals("source"))
|
||||
// // // {
|
||||
// // // var src = DeviceManager.GetDeviceForKey(split[1]) as IPresentationSource;
|
||||
// // // if (src == null)
|
||||
// // // {
|
||||
// // // Debug.Console(0, dev, "Error: Cannot add source key '{0}'", split[1]);
|
||||
// // // continue;
|
||||
// // // }
|
||||
// // // dev.SetCustomButtonAsSource(kvp.Key, src);
|
||||
// // // }
|
||||
// // // else if (split[0] == "room")
|
||||
// // // {
|
||||
// // // if (split[1] == "off")
|
||||
// // // dev.SetCustomButtonAsRoomOff(kvp.Key);
|
||||
// // // }
|
||||
// // // }
|
||||
// // //});
|
||||
// // }
|
||||
// // }
|
||||
// // catch (Exception e)
|
||||
// // {
|
||||
// // FactoryHelper.HandleDeviceCreationError(devToken, e);
|
||||
// // }
|
||||
// // return dev;
|
||||
// // }
|
||||
|
||||
// // public static RFExGateway GetGateway(string parent)
|
||||
// // {
|
||||
// // if (parent == null)
|
||||
// // parent = "controlSystem";
|
||||
// // RFExGateway rf = null;
|
||||
// // if (parent.Equals("controlSystem", StringComparison.OrdinalIgnoreCase)
|
||||
// // || parent.Equals("processor", StringComparison.OrdinalIgnoreCase))
|
||||
// // {
|
||||
// // rf = Global.ControlSystem.ControllerRFGatewayDevice;
|
||||
// // }
|
||||
// // return rf;
|
||||
// // }
|
||||
// //}
|
||||
//}
|
||||
@@ -0,0 +1,48 @@
|
||||
//using System;
|
||||
//using Crestron.SimplSharpPro;
|
||||
//using Crestron.SimplSharpPro.UI;
|
||||
|
||||
//using Newtonsoft.Json.Linq;
|
||||
|
||||
//using PepperDash.Essentials.Core;
|
||||
//using PepperDash.Essentials.Devices;
|
||||
//using PepperDash.Core;
|
||||
|
||||
//namespace PepperDash.Essentials
|
||||
//{
|
||||
// public class TouchpanelFactory
|
||||
// {
|
||||
// public static Device Create(JToken devToken)
|
||||
// {
|
||||
// SmartGraphicsTouchpanelControllerBase dev = null;
|
||||
// try
|
||||
// {
|
||||
// var devType = devToken.Value<string>("type");
|
||||
// var devKey = devToken.Value<string>("key");
|
||||
// var devName = devToken.Value<string>("name");
|
||||
// var props = devToken["properties"];
|
||||
// if (devType.Equals("Tsw1052", StringComparison.OrdinalIgnoreCase))
|
||||
// {
|
||||
// uint ipId = Convert.ToUInt32(props.Value<string>("ipId"), 16);
|
||||
// var hw = new Tsw1052(ipId, Global.ControlSystem);
|
||||
// dev = TouchpanelControllerFactory.Create(devKey, devName, hw, props.Value<string>("sgdPath"));
|
||||
// dev.UsesSplashPage = props.Value<bool>("usesSplashPage");
|
||||
// dev.ShowDate = props.Value<bool>("showDate");
|
||||
// dev.ShowTime = props.Value<bool>("showTime");
|
||||
|
||||
// // This plugs the system key into the tp, but it won't be linked up until later
|
||||
// dev.AddPostActivationAction(() =>
|
||||
// {
|
||||
// var defaultSystemKey = props.Value<string>("defaultSystemKey");
|
||||
// dev.SetCurrentRoom((EssentialsRoom)DeviceManager.GetDeviceForKey(defaultSystemKey));
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
// catch (Exception e)
|
||||
// {
|
||||
// FactoryHelper.HandleDeviceCreationError(devToken, e);
|
||||
// }
|
||||
// return dev;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
425
PepperDashEssentials/ControlSystem.cs
Normal file
425
PepperDashEssentials/ControlSystem.cs
Normal file
@@ -0,0 +1,425 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharp.CrestronIO;
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.CrestronThread;
|
||||
using Crestron.SimplSharpPro.Diagnostics;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.Devices.Common;
|
||||
using PepperDash.Essentials.DM;
|
||||
using PepperDash.Essentials.Fusion;
|
||||
using PepperDash.Essentials.Room.Config;
|
||||
using PepperDash.Essentials.Room.Cotija;
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
{
|
||||
public class ControlSystem : CrestronControlSystem
|
||||
{
|
||||
HttpLogoServer LogoServer;
|
||||
|
||||
public ControlSystem()
|
||||
: base()
|
||||
{
|
||||
Thread.MaxNumberOfUserThreads = 400;
|
||||
Global.ControlSystem = this;
|
||||
DeviceManager.Initialize(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Git 'er goin'
|
||||
/// </summary>
|
||||
public override void InitializeSystem()
|
||||
{
|
||||
SystemMonitor.ProgramInitialization.ProgramInitializationUnderUserControl = true;
|
||||
|
||||
DeterminePlatform();
|
||||
|
||||
//CrestronConsole.AddNewConsoleCommand(s => GoWithLoad(), "go", "Loads configuration file",
|
||||
// ConsoleAccessLevelEnum.AccessOperator);
|
||||
|
||||
// CrestronConsole.AddNewConsoleCommand(S => { ConfigWriter.WriteConfigFile(null); }, "writeconfig", "writes the current config to a file", ConsoleAccessLevelEnum.AccessOperator);
|
||||
CrestronConsole.AddNewConsoleCommand(s =>
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "CONSOLE MESSAGE: {0}", s);
|
||||
}, "appdebugmessage", "Writes message to log", ConsoleAccessLevelEnum.AccessOperator);
|
||||
|
||||
CrestronConsole.AddNewConsoleCommand(s =>
|
||||
{
|
||||
foreach (var tl in TieLineCollection.Default)
|
||||
CrestronConsole.ConsoleCommandResponse(" {0}\r", tl);
|
||||
},
|
||||
"listtielines", "Prints out all tie lines", ConsoleAccessLevelEnum.AccessOperator);
|
||||
|
||||
CrestronConsole.AddNewConsoleCommand(s =>
|
||||
{
|
||||
CrestronConsole.ConsoleCommandResponse
|
||||
("Current running configuration. This is the merged system and template configuration");
|
||||
CrestronConsole.ConsoleCommandResponse(Newtonsoft.Json.JsonConvert.SerializeObject
|
||||
(ConfigReader.ConfigObject, Newtonsoft.Json.Formatting.Indented));
|
||||
}, "showconfig", "Shows the current running merged config", ConsoleAccessLevelEnum.AccessOperator);
|
||||
|
||||
CrestronConsole.AddNewConsoleCommand(s =>
|
||||
{
|
||||
CrestronConsole.ConsoleCommandResponse("This system can be found at the following URLs:\r" +
|
||||
"System URL: {0}\r" +
|
||||
"Template URL: {1}", ConfigReader.ConfigObject.SystemUrl, ConfigReader.ConfigObject.TemplateUrl);
|
||||
}, "portalinfo", "Shows portal URLS from configuration", ConsoleAccessLevelEnum.AccessOperator);
|
||||
|
||||
GoWithLoad();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines if the program is running on a processor (appliance) or server (XiO Edge).
|
||||
///
|
||||
/// Sets Global.FilePathPrefix based on platform
|
||||
/// </summary>
|
||||
public void DeterminePlatform()
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Determining Platform....");
|
||||
|
||||
string filePathPrefix;
|
||||
|
||||
var dirSeparator = Global.DirectorySeparator;
|
||||
|
||||
var version = Crestron.SimplSharp.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
|
||||
|
||||
var versionString = string.Format("{0}.{1}.{2}", version.Major, version.Minor, version.Build);
|
||||
|
||||
string directoryPrefix;
|
||||
|
||||
directoryPrefix = Crestron.SimplSharp.CrestronIO.Directory.GetApplicationRootDirectory();
|
||||
|
||||
//directoryPrefix = "";
|
||||
|
||||
if (CrestronEnvironment.DevicePlatform != eDevicePlatform.Server)
|
||||
{
|
||||
filePathPrefix = directoryPrefix + dirSeparator + "NVRAM"
|
||||
+ dirSeparator + string.Format("program{0}", InitialParametersClass.ApplicationNumber) + dirSeparator;
|
||||
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Starting Essentials v{0} on 3-series Appliance", versionString);
|
||||
}
|
||||
else
|
||||
{
|
||||
filePathPrefix = directoryPrefix + dirSeparator + "User" + dirSeparator;
|
||||
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Starting Essentials v{0} on Virtual Control Server", versionString);
|
||||
}
|
||||
|
||||
Global.SetFilePathPrefix(filePathPrefix);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Do it, yo
|
||||
/// </summary>
|
||||
public void GoWithLoad()
|
||||
{
|
||||
try
|
||||
{
|
||||
CrestronConsole.AddNewConsoleCommand(EnablePortalSync, "portalsync", "Loads Portal Sync",
|
||||
ConsoleAccessLevelEnum.AccessOperator);
|
||||
|
||||
//PortalSync = new PepperDashPortalSyncClient();
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Starting Essentials load from configuration");
|
||||
|
||||
var filesReady = SetupFilesystem();
|
||||
if (filesReady)
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Folder structure verified. Loading config...");
|
||||
if (!ConfigReader.LoadConfig2())
|
||||
return;
|
||||
|
||||
Load();
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Essentials load complete\r" +
|
||||
"-------------------------------------------------------------");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(0,
|
||||
"------------------------------------------------\r" +
|
||||
"------------------------------------------------\r" +
|
||||
"------------------------------------------------\r" +
|
||||
"Essentials file structure setup completed.\r" +
|
||||
"Please load config, sgd and ir files and\r" +
|
||||
"restart program.\r" +
|
||||
"------------------------------------------------\r" +
|
||||
"------------------------------------------------\r" +
|
||||
"------------------------------------------------");
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Console(0, "FATAL INITIALIZE ERROR. System is in an inconsistent state:\r{0}", e);
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Notify the
|
||||
SystemMonitor.ProgramInitialization.ProgramInitializationComplete = true;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies filesystem is set up. IR, SGD, and program1 folders
|
||||
/// </summary>
|
||||
bool SetupFilesystem()
|
||||
{
|
||||
Debug.Console(0, "Verifying and/or creating folder structure");
|
||||
var configDir = Global.FilePathPrefix;
|
||||
var configExists = Directory.Exists(configDir);
|
||||
if (!configExists)
|
||||
Directory.Create(configDir);
|
||||
|
||||
var irDir = Global.FilePathPrefix + "ir";
|
||||
if (!Directory.Exists(irDir))
|
||||
Directory.Create(irDir);
|
||||
|
||||
var sgdDir = Global.FilePathPrefix + "sgd";
|
||||
if (!Directory.Exists(sgdDir))
|
||||
Directory.Create(sgdDir);
|
||||
|
||||
return configExists;
|
||||
}
|
||||
|
||||
public void EnablePortalSync(string s)
|
||||
{
|
||||
if (s.ToLower() == "enable")
|
||||
{
|
||||
CrestronConsole.ConsoleCommandResponse("Portal Sync features enabled");
|
||||
}
|
||||
}
|
||||
|
||||
public void TearDown()
|
||||
{
|
||||
Debug.Console(0, "Tearing down existing system");
|
||||
DeviceManager.DeactivateAll();
|
||||
|
||||
TieLineCollection.Default.Clear();
|
||||
|
||||
foreach (var key in DeviceManager.GetDevices())
|
||||
DeviceManager.RemoveDevice(key);
|
||||
|
||||
Debug.Console(0, "Tear down COMPLETE");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void Load()
|
||||
{
|
||||
LoadDevices();
|
||||
LoadTieLines();
|
||||
LoadRooms();
|
||||
LoadLogoServer();
|
||||
|
||||
DeviceManager.ActivateAll();
|
||||
|
||||
LinkSystemMonitorToAppServer();
|
||||
}
|
||||
|
||||
void LinkSystemMonitorToAppServer()
|
||||
{
|
||||
var sysMon = DeviceManager.GetDeviceForKey("systemMonitor") as PepperDash.Essentials.Core.Monitoring.SystemMonitorController;
|
||||
|
||||
var appServer = DeviceManager.GetDeviceForKey("appServer") as CotijaSystemController;
|
||||
|
||||
|
||||
if (sysMon != null && appServer != null)
|
||||
{
|
||||
var key = sysMon.Key + "-" + appServer.Key;
|
||||
var messenger = new PepperDash.Essentials.AppServer.Messengers.SystemMonitorMessenger
|
||||
(key, sysMon, "/device/systemMonitor");
|
||||
|
||||
messenger.RegisterWithAppServer(appServer);
|
||||
|
||||
DeviceManager.AddDevice(messenger);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads all devices from config and adds them to DeviceManager
|
||||
/// </summary>
|
||||
public void LoadDevices()
|
||||
{
|
||||
# warning Missing PepperDash.Essentials.Core.Devices.CrestronProcessor("processor"));
|
||||
// Build the processor wrapper class
|
||||
// DeviceManager.AddDevice(new PepperDash.Essentials.Core.Devices.CrestronProcessor("processor"));
|
||||
|
||||
// Add global System Monitor device
|
||||
DeviceManager.AddDevice(new PepperDash.Essentials.Core.Monitoring.SystemMonitorController("systemMonitor"));
|
||||
|
||||
foreach (var devConf in ConfigReader.ConfigObject.Devices)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Creating device '{0}'", devConf.Key);
|
||||
// Skip this to prevent unnecessary warnings
|
||||
if (devConf.Key == "processor")
|
||||
{
|
||||
if (devConf.Type.ToLower() != Global.ControlSystem.ControllerPrompt.ToLower())
|
||||
Debug.Console(0,
|
||||
"WARNING: Config file defines processor type as '{0}' but actual processor is '{1}'! Some ports may not be available",
|
||||
devConf.Type.ToUpper(), Global.ControlSystem.ControllerPrompt.ToUpper());
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// Try local factories first
|
||||
var newDev = DeviceFactory.GetDevice(devConf);
|
||||
|
||||
if (newDev == null)
|
||||
newDev = BridgeFactory.GetDevice(devConf);
|
||||
|
||||
// Then associated library factories
|
||||
if (newDev == null)
|
||||
newDev = PepperDash.Essentials.Core.DeviceFactory.GetDevice(devConf);
|
||||
if (newDev == null)
|
||||
newDev = PepperDash.Essentials.Devices.Common.DeviceFactory.GetDevice(devConf);
|
||||
if (newDev == null)
|
||||
newDev = PepperDash.Essentials.DM.DeviceFactory.GetDevice(devConf);
|
||||
if (newDev == null)
|
||||
newDev = PepperDash.Essentials.Devices.Displays.DisplayDeviceFactory.GetDevice(devConf);
|
||||
if (newDev == null)
|
||||
newDev = PepperDash.Essentials.BridgeFactory.GetDevice(devConf);
|
||||
if (newDev != null)
|
||||
DeviceManager.AddDevice(newDev);
|
||||
else
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "ERROR: Cannot load unknown device type '{0}', key '{1}'.", devConf.Type, devConf.Key);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "ERROR: Creating device {0}. Skipping device. \r{1}", devConf.Key, e);
|
||||
}
|
||||
}
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "All Devices Loaded.");
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Helper method to load tie lines. This should run after devices have loaded
|
||||
/// </summary>
|
||||
public void LoadTieLines()
|
||||
{
|
||||
// In the future, we can't necessarily just clear here because devices
|
||||
// might be making their own internal sources/tie lines
|
||||
|
||||
var tlc = TieLineCollection.Default;
|
||||
//tlc.Clear();
|
||||
if (ConfigReader.ConfigObject.TieLines == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var tieLineConfig in ConfigReader.ConfigObject.TieLines)
|
||||
{
|
||||
var newTL = tieLineConfig.GetTieLine();
|
||||
if (newTL != null)
|
||||
tlc.Add(newTL);
|
||||
}
|
||||
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "All Tie Lines Loaded.");
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads all rooms from config and adds them to DeviceManager
|
||||
/// </summary>
|
||||
public void LoadRooms()
|
||||
{
|
||||
if (ConfigReader.ConfigObject.Rooms == null)
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Warning, "WARNING: Configuration contains no rooms");
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var roomConfig in ConfigReader.ConfigObject.Rooms)
|
||||
{
|
||||
var room = EssentialsRoomConfigHelper.GetRoomObject(roomConfig) as EssentialsRoomBase;
|
||||
if (room != null)
|
||||
{
|
||||
if (room is EssentialsHuddleSpaceRoom)
|
||||
{
|
||||
DeviceManager.AddDevice(room);
|
||||
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Room is EssentialsHuddleSpaceRoom, attempting to add to DeviceManager with Fusion");
|
||||
DeviceManager.AddDevice(new EssentialsHuddleSpaceFusionSystemControllerBase((EssentialsHuddleSpaceRoom)room, 0xf1));
|
||||
|
||||
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Cotija Bridge...");
|
||||
// Cotija bridge
|
||||
var bridge = new CotijaEssentialsHuddleSpaceRoomBridge(room as EssentialsHuddleSpaceRoom);
|
||||
AddBridgePostActivationHelper(bridge); // Lets things happen later when all devices are present
|
||||
DeviceManager.AddDevice(bridge);
|
||||
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Cotija Bridge Added...");
|
||||
}
|
||||
else if (room is EssentialsHuddleVtc1Room)
|
||||
{
|
||||
DeviceManager.AddDevice(room);
|
||||
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Room is EssentialsHuddleVtc1Room, attempting to add to DeviceManager with Fusion");
|
||||
DeviceManager.AddDevice(new EssentialsHuddleVtc1FusionController((EssentialsHuddleVtc1Room)room, 0xf1));
|
||||
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Cotija Bridge...");
|
||||
// Cotija bridge
|
||||
var bridge = new CotijaEssentialsHuddleSpaceRoomBridge(room);
|
||||
AddBridgePostActivationHelper(bridge); // Lets things happen later when all devices are present
|
||||
DeviceManager.AddDevice(bridge);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Room is NOT EssentialsRoom, attempting to add to DeviceManager w/o Fusion");
|
||||
DeviceManager.AddDevice(room);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "WARNING: Cannot create room from config, key '{0}'", roomConfig.Key);
|
||||
}
|
||||
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "All Rooms Loaded.");
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helps add the post activation steps that link bridges to main controller
|
||||
/// </summary>
|
||||
/// <param name="bridge"></param>
|
||||
void AddBridgePostActivationHelper(CotijaBridgeBase bridge)
|
||||
{
|
||||
bridge.AddPostActivationAction(() =>
|
||||
{
|
||||
var parent = DeviceManager.AllDevices.FirstOrDefault(d => d.Key == "appServer") as CotijaSystemController;
|
||||
if (parent == null)
|
||||
{
|
||||
Debug.Console(0, bridge, "ERROR: Cannot connect app server room bridge. System controller not present");
|
||||
return;
|
||||
}
|
||||
Debug.Console(0, bridge, "Linking to parent controller");
|
||||
bridge.AddParent(parent);
|
||||
parent.AddBridge(bridge);
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fires up a logo server if not already running
|
||||
/// </summary>
|
||||
void LoadLogoServer()
|
||||
{
|
||||
try
|
||||
{
|
||||
LogoServer = new HttpLogoServer(8080, Global.DirectorySeparator + "html" + Global.DirectorySeparator + "logo");
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "NOTICE: Logo server cannot be started. Likely already running in another program");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
31
PepperDashEssentials/Devices/Amplifier.cs
Normal file
31
PepperDashEssentials/Devices/Amplifier.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Routing;
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
{
|
||||
public class Amplifier : Device, IRoutingSinkNoSwitching
|
||||
{
|
||||
public RoutingInputPort AudioIn { get; private set; }
|
||||
|
||||
public Amplifier(string key, string name)
|
||||
: base(key, name)
|
||||
{
|
||||
AudioIn = new RoutingInputPort(RoutingPortNames.AnyAudioIn, eRoutingSignalType.Audio,
|
||||
eRoutingPortConnectionType.None, null, this);
|
||||
InputPorts = new RoutingPortCollection<RoutingInputPort> { AudioIn };
|
||||
}
|
||||
|
||||
#region IRoutingInputs Members
|
||||
|
||||
public RoutingPortCollection<RoutingInputPort> InputPorts { get; private set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
42
PepperDashEssentials/Devices/DiscPlayer/OppoExtendedBdp.cs
Normal file
42
PepperDashEssentials/Devices/DiscPlayer/OppoExtendedBdp.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
|
||||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Devices
|
||||
{
|
||||
///// <summary>
|
||||
///// This DVD class should cover most IR, one-way DVD and Bluray fuctions
|
||||
///// </summary>
|
||||
//public class OppoBluray : IrDvdBase, IDvdControls, IExtendedOutputs
|
||||
//{
|
||||
// public OppoBluray(string key, string name, IROutputPort port, string irDriverFilepath) : base(key, name, port, irDriverFilepath) { }
|
||||
|
||||
|
||||
|
||||
// public OutputsToTriListBridge GetExtendedOutputsToTriListBridge()
|
||||
// {
|
||||
// return new ExtendedDvdTriListBridge();
|
||||
// }
|
||||
|
||||
|
||||
//}
|
||||
|
||||
//public class ExtendedDvdTriListBridge : OutputsToTriListBridge
|
||||
//{
|
||||
|
||||
// public override void Link()
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
|
||||
// public override void UnLink()
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
//}
|
||||
}
|
||||
45
PepperDashEssentials/Devices/NUMERIC AppleTV.cs
Normal file
45
PepperDashEssentials/Devices/NUMERIC AppleTV.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using Crestron.SimplSharp;
|
||||
//using Crestron.SimplSharpPro;
|
||||
//using Crestron.SimplSharpPro.DeviceSupport;
|
||||
|
||||
//using PepperDash.Essentials.Core;
|
||||
|
||||
//namespace PepperDash.Essentials.Devices
|
||||
//{
|
||||
// public class AppleTV : Device, IHasCueActionList
|
||||
// {
|
||||
// public IrOutputPortController IrPort { get; private set; }
|
||||
|
||||
// public AppleTV(string key, string name, IROutputPort port, string irDriverFilepath)
|
||||
// : base(key, name)
|
||||
// {
|
||||
// IrPort = new IrOutputPortController("ir" + key, port, irDriverFilepath);
|
||||
// }
|
||||
|
||||
// #region IFunctionList Members
|
||||
// public List<CueActionPair> CueActionList
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// var numToIr = new Dictionary<Cue, string>
|
||||
// {
|
||||
// { CommonBoolCue.Menu, IROutputStandardCommands.IROut_MENU },
|
||||
// { CommonBoolCue.Up, IROutputStandardCommands.IROut_UP_ARROW },
|
||||
// { CommonBoolCue.Down, IROutputStandardCommands.IROut_DN_ARROW },
|
||||
// { CommonBoolCue.Left, IROutputStandardCommands.IROut_LEFT_ARROW },
|
||||
// { CommonBoolCue.Right, IROutputStandardCommands.IROut_RIGHT_ARROW },
|
||||
// { CommonBoolCue.Select, IROutputStandardCommands.IROut_ENTER }
|
||||
// };
|
||||
// var funcs = new List<CueActionPair>(numToIr.Count);
|
||||
|
||||
// foreach (var kvp in numToIr)
|
||||
// funcs.Add(new BoolCueActionPair(kvp.Key, b => IrPort.PressRelease(kvp.Value, b)));
|
||||
// return funcs;
|
||||
// }
|
||||
// }
|
||||
// #endregion
|
||||
// }
|
||||
//}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,348 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharp.CrestronIO;
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using Crestron.SimplSharpPro.Fusion;
|
||||
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.Devices.Common;
|
||||
using PepperDash.Essentials.Devices.Common.Occupancy;
|
||||
|
||||
namespace PepperDash.Essentials.Fusion
|
||||
{
|
||||
public class EssentialsHuddleVtc1FusionController : EssentialsHuddleSpaceFusionSystemControllerBase
|
||||
{
|
||||
BooleanSigData CodecIsInCall;
|
||||
|
||||
public EssentialsHuddleVtc1FusionController(EssentialsHuddleVtc1Room room, uint ipId)
|
||||
: base(room, ipId)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called in base class constructor before RVI and GUID files are built
|
||||
/// </summary>
|
||||
protected override void ExecuteCustomSteps()
|
||||
{
|
||||
SetUpCodec();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a static asset for the codec and maps the joins to the main room symbol
|
||||
/// </summary>
|
||||
void SetUpCodec()
|
||||
{
|
||||
try
|
||||
{
|
||||
var codec = (Room as EssentialsHuddleVtc1Room).VideoCodec;
|
||||
|
||||
if (codec == null)
|
||||
{
|
||||
Debug.Console(1, this, "Cannot link codec to Fusion because codec is null");
|
||||
return;
|
||||
}
|
||||
|
||||
codec.UsageTracker = new UsageTracking(codec);
|
||||
codec.UsageTracker.UsageIsTracked = true;
|
||||
codec.UsageTracker.DeviceUsageEnded += UsageTracker_DeviceUsageEnded;
|
||||
|
||||
var codecPowerOnAction = new Action<bool>(b => { if (!b) codec.StandbyDeactivate(); });
|
||||
var codecPowerOffAction = new Action<bool>(b => { if (!b) codec.StandbyActivate(); });
|
||||
|
||||
// Map FusionRoom Attributes:
|
||||
|
||||
// Codec volume
|
||||
var codecVolume = FusionRoom.CreateOffsetUshortSig(50, "Volume - Fader01", eSigIoMask.InputOutputSig);
|
||||
codecVolume.OutputSig.UserObject = new Action<ushort>(b => (codec as IBasicVolumeWithFeedback).SetVolume(b));
|
||||
(codec as IBasicVolumeWithFeedback).VolumeLevelFeedback.LinkInputSig(codecVolume.InputSig);
|
||||
|
||||
// In Call Status
|
||||
CodecIsInCall = FusionRoom.CreateOffsetBoolSig(69, "Conf - VC 1 In Call", eSigIoMask.InputSigOnly);
|
||||
codec.CallStatusChange += new EventHandler<PepperDash.Essentials.Devices.Common.Codec.CodecCallStatusItemChangeEventArgs>(codec_CallStatusChange);
|
||||
|
||||
// Online status
|
||||
if (codec is ICommunicationMonitor)
|
||||
{
|
||||
var c = codec as ICommunicationMonitor;
|
||||
var codecOnline = FusionRoom.CreateOffsetBoolSig(122, "Online - VC 1", eSigIoMask.InputSigOnly);
|
||||
codecOnline.InputSig.BoolValue = c.CommunicationMonitor.Status == MonitorStatus.IsOk;
|
||||
c.CommunicationMonitor.StatusChange += (o, a) =>
|
||||
{
|
||||
codecOnline.InputSig.BoolValue = a.Status == MonitorStatus.IsOk;
|
||||
};
|
||||
Debug.Console(0, this, "Linking '{0}' communication monitor to Fusion '{1}'", codec.Key, "Online - VC 1");
|
||||
}
|
||||
|
||||
// Codec IP Address
|
||||
bool codecHasIpInfo = false;
|
||||
var codecComm = codec.Communication;
|
||||
|
||||
string codecIpAddress = string.Empty;
|
||||
int codecIpPort = 0;
|
||||
|
||||
StringSigData codecIpAddressSig;
|
||||
StringSigData codecIpPortSig;
|
||||
|
||||
if(codecComm is GenericSshClient)
|
||||
{
|
||||
codecIpAddress = (codecComm as GenericSshClient).Hostname;
|
||||
codecIpPort = (codecComm as GenericSshClient).Port;
|
||||
codecHasIpInfo = true;
|
||||
}
|
||||
else if (codecComm is GenericTcpIpClient)
|
||||
{
|
||||
codecIpAddress = (codecComm as GenericTcpIpClient).Hostname;
|
||||
codecIpPort = (codecComm as GenericTcpIpClient).Port;
|
||||
codecHasIpInfo = true;
|
||||
}
|
||||
|
||||
if (codecHasIpInfo)
|
||||
{
|
||||
codecIpAddressSig = FusionRoom.CreateOffsetStringSig(121, "IP Address - VC", eSigIoMask.InputSigOnly);
|
||||
codecIpAddressSig.InputSig.StringValue = codecIpAddress;
|
||||
|
||||
codecIpPortSig = FusionRoom.CreateOffsetStringSig(150, "IP Port - VC", eSigIoMask.InputSigOnly);
|
||||
codecIpPortSig.InputSig.StringValue = codecIpPort.ToString();
|
||||
}
|
||||
|
||||
var tempAsset = new FusionAsset();
|
||||
|
||||
var deviceConfig = ConfigReader.ConfigObject.Devices.FirstOrDefault(c => c.Key.Equals(codec.Key));
|
||||
|
||||
if (FusionStaticAssets.ContainsKey(deviceConfig.Uid))
|
||||
{
|
||||
tempAsset = FusionStaticAssets[deviceConfig.Uid];
|
||||
}
|
||||
else
|
||||
{
|
||||
// Create a new asset
|
||||
tempAsset = new FusionAsset(FusionRoomGuids.GetNextAvailableAssetNumber(FusionRoom), codec.Name, "Codec", "");
|
||||
FusionStaticAssets.Add(deviceConfig.Uid, tempAsset);
|
||||
}
|
||||
|
||||
var codecAsset = FusionRoom.CreateStaticAsset(tempAsset.SlotNumber, tempAsset.Name, "Display", tempAsset.InstanceId);
|
||||
codecAsset.PowerOn.OutputSig.UserObject = codecPowerOnAction;
|
||||
codecAsset.PowerOff.OutputSig.UserObject = codecPowerOffAction;
|
||||
codec.StandbyIsOnFeedback.LinkComplementInputSig(codecAsset.PowerOn.InputSig);
|
||||
|
||||
// TODO: Map relevant attributes on asset symbol
|
||||
|
||||
codecAsset.TrySetMakeModel(codec);
|
||||
codecAsset.TryLinkAssetErrorToCommunication(codec);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Console(1, this, "Error setting up codec in Fusion: {0}", e);
|
||||
}
|
||||
}
|
||||
|
||||
void codec_CallStatusChange(object sender, PepperDash.Essentials.Devices.Common.Codec.CodecCallStatusItemChangeEventArgs e)
|
||||
{
|
||||
var codec = (Room as EssentialsHuddleVtc1Room).VideoCodec;
|
||||
|
||||
CodecIsInCall.InputSig.BoolValue = codec.IsInCall;
|
||||
}
|
||||
|
||||
// These methods are overridden because they access the room class which is of a different type
|
||||
|
||||
protected override void CreateSymbolAndBasicSigs(uint ipId)
|
||||
{
|
||||
Debug.Console(1, this, "Creating Fusion Room symbol with GUID: {0}", RoomGuid);
|
||||
|
||||
FusionRoom = new FusionRoom(ipId, Global.ControlSystem, Room.Name, RoomGuid);
|
||||
FusionRoom.ExtenderRoomViewSchedulingDataReservedSigs.Use();
|
||||
FusionRoom.ExtenderFusionRoomDataReservedSigs.Use();
|
||||
|
||||
FusionRoom.Register();
|
||||
|
||||
FusionRoom.FusionStateChange += FusionRoom_FusionStateChange;
|
||||
|
||||
FusionRoom.ExtenderRoomViewSchedulingDataReservedSigs.DeviceExtenderSigChange += FusionRoomSchedule_DeviceExtenderSigChange;
|
||||
FusionRoom.ExtenderFusionRoomDataReservedSigs.DeviceExtenderSigChange += ExtenderFusionRoomDataReservedSigs_DeviceExtenderSigChange;
|
||||
FusionRoom.OnlineStatusChange += FusionRoom_OnlineStatusChange;
|
||||
|
||||
CrestronConsole.AddNewConsoleCommand(RequestFullRoomSchedule, "FusReqRoomSchedule", "Requests schedule of the room for the next 24 hours", ConsoleAccessLevelEnum.AccessOperator);
|
||||
CrestronConsole.AddNewConsoleCommand(ModifyMeetingEndTimeConsoleHelper, "FusReqRoomSchMod", "Ends or extends a meeting by the specified time", ConsoleAccessLevelEnum.AccessOperator);
|
||||
CrestronConsole.AddNewConsoleCommand(CreateAsHocMeeting, "FusCreateMeeting", "Creates and Ad Hoc meeting for on hour or until the next meeting", ConsoleAccessLevelEnum.AccessOperator);
|
||||
|
||||
// Room to fusion room
|
||||
Room.OnFeedback.LinkInputSig(FusionRoom.SystemPowerOn.InputSig);
|
||||
|
||||
// Moved to
|
||||
CurrentRoomSourceNameSig = FusionRoom.CreateOffsetStringSig(84, "Display 1 - Current Source", eSigIoMask.InputSigOnly);
|
||||
// Don't think we need to get current status of this as nothing should be alive yet.
|
||||
(Room as EssentialsHuddleVtc1Room).CurrentSingleSourceChange += Room_CurrentSourceInfoChange;
|
||||
|
||||
|
||||
FusionRoom.SystemPowerOn.OutputSig.SetSigFalseAction((Room as EssentialsHuddleVtc1Room).PowerOnToDefaultOrLastSource);
|
||||
FusionRoom.SystemPowerOff.OutputSig.SetSigFalseAction(() => (Room as EssentialsHuddleVtc1Room).RunRouteAction("roomOff"));
|
||||
// NO!! room.RoomIsOn.LinkComplementInputSig(FusionRoom.SystemPowerOff.InputSig);
|
||||
|
||||
|
||||
CrestronEnvironment.EthernetEventHandler += CrestronEnvironment_EthernetEventHandler;
|
||||
}
|
||||
|
||||
protected override void SetUpSources()
|
||||
{
|
||||
// Sources
|
||||
var dict = ConfigReader.ConfigObject.GetSourceListForKey((Room as EssentialsHuddleVtc1Room).SourceListKey);
|
||||
if (dict != null)
|
||||
{
|
||||
// NEW PROCESS:
|
||||
// Make these lists and insert the fusion attributes by iterating these
|
||||
var setTopBoxes = dict.Where(d => d.Value.SourceDevice is ISetTopBoxControls);
|
||||
uint i = 1;
|
||||
foreach (var kvp in setTopBoxes)
|
||||
{
|
||||
TryAddRouteActionSigs("Display 1 - Source TV " + i, 188 + i, kvp.Key, kvp.Value.SourceDevice);
|
||||
i++;
|
||||
if (i > 5) // We only have five spots
|
||||
break;
|
||||
}
|
||||
|
||||
var discPlayers = dict.Where(d => d.Value.SourceDevice is IDiscPlayerControls);
|
||||
i = 1;
|
||||
foreach (var kvp in discPlayers)
|
||||
{
|
||||
TryAddRouteActionSigs("Display 1 - Source DVD " + i, 181 + i, kvp.Key, kvp.Value.SourceDevice);
|
||||
i++;
|
||||
if (i > 5) // We only have five spots
|
||||
break;
|
||||
}
|
||||
|
||||
var laptops = dict.Where(d => d.Value.SourceDevice is Laptop);
|
||||
i = 1;
|
||||
foreach (var kvp in laptops)
|
||||
{
|
||||
TryAddRouteActionSigs("Display 1 - Source Laptop " + i, 166 + i, kvp.Key, kvp.Value.SourceDevice);
|
||||
i++;
|
||||
if (i > 10) // We only have ten spots???
|
||||
break;
|
||||
}
|
||||
|
||||
foreach (var kvp in dict)
|
||||
{
|
||||
var usageDevice = kvp.Value.SourceDevice as IUsageTracking;
|
||||
|
||||
if (usageDevice != null)
|
||||
{
|
||||
usageDevice.UsageTracker = new UsageTracking(usageDevice as Device);
|
||||
usageDevice.UsageTracker.UsageIsTracked = true;
|
||||
usageDevice.UsageTracker.DeviceUsageEnded += new EventHandler<DeviceUsageEventArgs>(UsageTracker_DeviceUsageEnded);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(1, this, "WARNING: Config source list '{0}' not found for room '{1}'",
|
||||
(Room as EssentialsHuddleVtc1Room).SourceListKey, Room.Key);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void SetUpDisplay()
|
||||
{
|
||||
try
|
||||
{
|
||||
//Setup Display Usage Monitoring
|
||||
|
||||
var displays = DeviceManager.AllDevices.Where(d => d is DisplayBase);
|
||||
|
||||
// Consider updating this in multiple display systems
|
||||
|
||||
foreach (DisplayBase display in displays)
|
||||
{
|
||||
display.UsageTracker = new UsageTracking(display);
|
||||
display.UsageTracker.UsageIsTracked = true;
|
||||
display.UsageTracker.DeviceUsageEnded += new EventHandler<DeviceUsageEventArgs>(UsageTracker_DeviceUsageEnded);
|
||||
}
|
||||
|
||||
var defaultDisplay = (Room as EssentialsHuddleVtc1Room).DefaultDisplay as DisplayBase;
|
||||
if (defaultDisplay == null)
|
||||
{
|
||||
Debug.Console(1, this, "Cannot link null display to Fusion because default display is null");
|
||||
return;
|
||||
}
|
||||
|
||||
var dispPowerOnAction = new Action<bool>(b => { if (!b) defaultDisplay.PowerOn(); });
|
||||
var dispPowerOffAction = new Action<bool>(b => { if (!b) defaultDisplay.PowerOff(); });
|
||||
|
||||
// Display to fusion room sigs
|
||||
FusionRoom.DisplayPowerOn.OutputSig.UserObject = dispPowerOnAction;
|
||||
FusionRoom.DisplayPowerOff.OutputSig.UserObject = dispPowerOffAction;
|
||||
defaultDisplay.PowerIsOnFeedback.LinkInputSig(FusionRoom.DisplayPowerOn.InputSig);
|
||||
if (defaultDisplay is IDisplayUsage)
|
||||
(defaultDisplay as IDisplayUsage).LampHours.LinkInputSig(FusionRoom.DisplayUsage.InputSig);
|
||||
|
||||
|
||||
|
||||
MapDisplayToRoomJoins(1, 158, defaultDisplay);
|
||||
|
||||
|
||||
var deviceConfig = ConfigReader.ConfigObject.Devices.FirstOrDefault(d => d.Key.Equals(defaultDisplay.Key));
|
||||
|
||||
//Check for existing asset in GUIDs collection
|
||||
|
||||
var tempAsset = new FusionAsset();
|
||||
|
||||
if (FusionStaticAssets.ContainsKey(deviceConfig.Uid))
|
||||
{
|
||||
tempAsset = FusionStaticAssets[deviceConfig.Uid];
|
||||
}
|
||||
else
|
||||
{
|
||||
// Create a new asset
|
||||
tempAsset = new FusionAsset(FusionRoomGuids.GetNextAvailableAssetNumber(FusionRoom), defaultDisplay.Name, "Display", "");
|
||||
FusionStaticAssets.Add(deviceConfig.Uid, tempAsset);
|
||||
}
|
||||
|
||||
var dispAsset = FusionRoom.CreateStaticAsset(tempAsset.SlotNumber, tempAsset.Name, "Display", tempAsset.InstanceId);
|
||||
dispAsset.PowerOn.OutputSig.UserObject = dispPowerOnAction;
|
||||
dispAsset.PowerOff.OutputSig.UserObject = dispPowerOffAction;
|
||||
defaultDisplay.PowerIsOnFeedback.LinkInputSig(dispAsset.PowerOn.InputSig);
|
||||
// NO!! display.PowerIsOn.LinkComplementInputSig(dispAsset.PowerOff.InputSig);
|
||||
// Use extension methods
|
||||
dispAsset.TrySetMakeModel(defaultDisplay);
|
||||
dispAsset.TryLinkAssetErrorToCommunication(defaultDisplay);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Console(1, this, "Error setting up display in Fusion: {0}", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected override void MapDisplayToRoomJoins(int displayIndex, int joinOffset, DisplayBase display)
|
||||
{
|
||||
string displayName = string.Format("Display {0} - ", displayIndex);
|
||||
|
||||
|
||||
if (display == (Room as EssentialsHuddleVtc1Room).DefaultDisplay)
|
||||
{
|
||||
// Power on
|
||||
var defaultDisplayPowerOn = FusionRoom.CreateOffsetBoolSig((uint)joinOffset, displayName + "Power On", eSigIoMask.InputOutputSig);
|
||||
defaultDisplayPowerOn.OutputSig.UserObject = new Action<bool>(b => { if (!b) display.PowerOn(); });
|
||||
display.PowerIsOnFeedback.LinkInputSig(defaultDisplayPowerOn.InputSig);
|
||||
|
||||
// Power Off
|
||||
var defaultDisplayPowerOff = FusionRoom.CreateOffsetBoolSig((uint)joinOffset + 1, displayName + "Power Off", eSigIoMask.InputOutputSig);
|
||||
defaultDisplayPowerOn.OutputSig.UserObject = new Action<bool>(b => { if (!b) display.PowerOff(); }); ;
|
||||
display.PowerIsOnFeedback.LinkInputSig(defaultDisplayPowerOn.InputSig);
|
||||
|
||||
// Current Source
|
||||
var defaultDisplaySourceNone = FusionRoom.CreateOffsetBoolSig((uint)joinOffset + 8, displayName + "Source None", eSigIoMask.InputOutputSig);
|
||||
defaultDisplaySourceNone.OutputSig.UserObject = new Action<bool>(b => { if (!b) (Room as EssentialsHuddleVtc1Room).RunRouteAction("roomOff"); }); ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,4 @@
|
||||
|
||||
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -12,9 +10,9 @@ using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.Core.Devices;
|
||||
using Serilog.Events;
|
||||
using PepperDash.Essentials.Room.Behaviours;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Fusion
|
||||
namespace PepperDash.Essentials.Fusion
|
||||
{
|
||||
/// <summary>
|
||||
/// Handles mapping Fusion Custom Property values to system properties
|
||||
@@ -39,7 +37,7 @@ namespace PepperDash.Essentials.Core.Fusion
|
||||
|
||||
if (device is RoomOnToDefaultSourceWhenOccupied)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, "Mapping Room on via Occupancy values from Fusion");
|
||||
Debug.Console(1, "Mapping Room on via Occupancy values from Fusion");
|
||||
|
||||
var devProps = JsonConvert.DeserializeObject<RoomOnToDefaultSourceWhenOccupiedConfig>(deviceConfig.Properties.ToString());
|
||||
|
||||
@@ -85,23 +83,23 @@ namespace PepperDash.Essentials.Core.Fusion
|
||||
|
||||
deviceConfig.Properties = JToken.FromObject(devProps);
|
||||
}
|
||||
else if (device is IEssentialsRoom)
|
||||
else if (device is EssentialsRoomBase)
|
||||
{
|
||||
// Set the room name
|
||||
if (!string.IsNullOrEmpty(roomInfo.Name))
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, "Current Room Name: {0}. New Room Name: {1}", deviceConfig.Name, roomInfo.Name);
|
||||
Debug.Console(1, "Current Room Name: {0}. New Room Name: {1}", deviceConfig.Name, roomInfo.Name);
|
||||
// Set the name in config
|
||||
deviceConfig.Name = roomInfo.Name;
|
||||
|
||||
Debug.LogMessage(LogEventLevel.Debug, "Room Name Successfully Changed.");
|
||||
Debug.Console(1, "Room Name Successfully Changed.");
|
||||
}
|
||||
|
||||
// Set the help message
|
||||
var helpMessage = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("RoomHelpMessage"));
|
||||
if (helpMessage != null)
|
||||
{
|
||||
//Debug.LogMessage(LogEventLevel.Debug, "Current Help Message: {0}. New Help Message: {1}", deviceConfig.Properties["help"]["message"].Value<string>(ToString()), helpMessage.CustomFieldValue);
|
||||
//Debug.Console(1, "Current Help Message: {0}. New Help Message: {1}", deviceConfig.Properties["help"]["message"].Value<string>(ToString()), helpMessage.CustomFieldValue);
|
||||
deviceConfig.Properties["helpMessage"] = (string)helpMessage.CustomFieldValue;
|
||||
}
|
||||
}
|
||||
@@ -114,7 +112,7 @@ namespace PepperDash.Essentials.Core.Fusion
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, "FusionCustomPropetiesBridge: Error mapping properties: {0}", e);
|
||||
Debug.Console(1, "FusionCustomPropetiesBridge: Error mapping properties: {0}", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Fusion
|
||||
namespace PepperDash.Essentials.Fusion
|
||||
{
|
||||
public class ScheduleChangeEventArgs : EventArgs
|
||||
{
|
||||
@@ -4,9 +4,9 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using PepperDash.Core;
|
||||
using Serilog.Events;
|
||||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Fusion
|
||||
namespace PepperDash.Essentials.Fusion
|
||||
{
|
||||
/// <summary>
|
||||
/// When created, runs progcomments on every slot and stores the program names in a list
|
||||
@@ -46,7 +46,7 @@ namespace PepperDash.Essentials.Core.Fusion
|
||||
}
|
||||
}
|
||||
programs[i] = item;
|
||||
Debug.LogMessage(LogEventLevel.Debug, "Program {0}: {1}", i, item.Name);
|
||||
Debug.Console(1, "Program {0}: {1}", i, item.Name);
|
||||
}
|
||||
return programs;
|
||||
}
|
||||
@@ -6,9 +6,8 @@ using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro.Fusion;
|
||||
|
||||
using PepperDash.Core;
|
||||
using Serilog.Events;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Fusion
|
||||
namespace PepperDash.Essentials.Fusion
|
||||
{
|
||||
// Helper Classes for GUIDs
|
||||
|
||||
@@ -75,7 +74,7 @@ namespace PepperDash.Essentials.Core.Fusion
|
||||
{
|
||||
var slotNum = GetNextAvailableAssetNumber(room);
|
||||
|
||||
Debug.LogMessage(LogEventLevel.Verbose, "Adding Fusion Asset: {0} of Type: {1} at Slot Number: {2} with GUID: {3}", assetName, type, slotNum, instanceId);
|
||||
Debug.Console(2, "Adding Fusion Asset: {0} of Type: {1} at Slot Number: {2} with GUID: {3}", assetName, type, slotNum, instanceId);
|
||||
|
||||
var tempAsset = new FusionAsset(slotNum, assetName, type, instanceId);
|
||||
|
||||
@@ -106,7 +105,7 @@ namespace PepperDash.Essentials.Core.Fusion
|
||||
else
|
||||
slotNum = slotNum + 1;
|
||||
|
||||
Debug.LogMessage(LogEventLevel.Verbose, "#Next available fusion asset number is: {0}", slotNum);
|
||||
Debug.Console(2, "#Next available fusion asset number is: {0}", slotNum);
|
||||
|
||||
return slotNum;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,47 @@
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Text;
|
||||
//using Crestron.SimplSharp;
|
||||
//using Crestron.SimplSharpPro;
|
||||
//using Crestron.SimplSharpPro.DeviceSupport;
|
||||
|
||||
//using PepperDash.Core;
|
||||
//using PepperDash.Essentials.Core;
|
||||
//using PepperDash.Essentials.Core.Presets;
|
||||
|
||||
//namespace PepperDash.Essentials
|
||||
//{
|
||||
// /// <summary>
|
||||
// ///
|
||||
// /// </summary>
|
||||
// public abstract class DevicePageControllerBase
|
||||
// {
|
||||
|
||||
// protected BasicTriListWithSmartObject TriList;
|
||||
// protected List<BoolInputSig> FixedObjectSigs;
|
||||
|
||||
// public DevicePageControllerBase(BasicTriListWithSmartObject triList)
|
||||
// {
|
||||
// TriList = triList;
|
||||
// }
|
||||
|
||||
// public void SetVisible(bool state)
|
||||
// {
|
||||
// foreach (var sig in FixedObjectSigs)
|
||||
// {
|
||||
// Debug.Console(2, "set visible {0}={1}", sig.Number, state);
|
||||
// sig.BoolValue = state;
|
||||
// }
|
||||
// CustomSetVisible(state);
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// Add any specialized show/hide logic here - beyond FixedObjectSigs. Overriding
|
||||
// /// methods do not need to call this base method
|
||||
// /// </summary>
|
||||
// protected virtual void CustomSetVisible(bool state)
|
||||
// {
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
@@ -0,0 +1,308 @@
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using Crestron.SimplSharp;
|
||||
//using Crestron.SimplSharpPro;
|
||||
//using Crestron.SimplSharpPro.DeviceSupport;
|
||||
//using Crestron.SimplSharpPro.UI;
|
||||
|
||||
//using PepperDash.Core;
|
||||
|
||||
|
||||
//namespace PepperDash.Essentials.Core
|
||||
//{
|
||||
// /// <summary>
|
||||
// ///
|
||||
// /// </summary>
|
||||
// public class LargeTouchpanelControllerBase : SmartGraphicsTouchpanelControllerBase
|
||||
// {
|
||||
// public string PresentationShareButtonInVideoText = "Share";
|
||||
// public string PresentationShareButtonNotInVideoText = "Presentation";
|
||||
|
||||
// SourceListSubpageReferenceList SourceSelectSRL;
|
||||
// DevicePageControllerBase CurrentPresentationSourcePageController;
|
||||
|
||||
// public LargeTouchpanelControllerBase(string key, string name,
|
||||
// BasicTriListWithSmartObject triList, string sgdFilePath)
|
||||
// : base(key, name, triList, sgdFilePath)
|
||||
// {
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// Static factory method
|
||||
// /// </summary>
|
||||
// public static LargeTouchpanelControllerBase GetController(string key, string name,
|
||||
// string type, CrestronTswPropertiesConfig props)
|
||||
// {
|
||||
// var id = Convert.ToUInt32(props.IpId, 16);
|
||||
// type = type.ToLower();
|
||||
// Tswx52ButtonVoiceControl tsw = null;
|
||||
// if (type == "tsw752")
|
||||
// tsw = new Tsw752(id, Global.ControlSystem);
|
||||
// else if (type == "tsw1052")
|
||||
// tsw = new Tsw1052(id, Global.ControlSystem);
|
||||
// else
|
||||
// {
|
||||
// Debug.Console(0, "WARNING: Cannot create TSW controller with type '{0}'", type);
|
||||
// return null;
|
||||
// }
|
||||
|
||||
// var sgdPath = string.Format(@"\NVRAM\Program{0}\SGD\{1}",
|
||||
// InitialParametersClass.ApplicationNumber, props.SgdFile);
|
||||
// var controller = new LargeTouchpanelControllerBase(key, name, tsw, sgdPath);
|
||||
// controller.UsesSplashPage = props.UsesSplashPage;
|
||||
|
||||
// // Get the room and add it after everthing is ready
|
||||
// var room = DeviceManager.GetDeviceForKey(props.DefaultRoomKey) as EssentialsRoom;
|
||||
// controller.AddPostActivationAction(() =>
|
||||
// {
|
||||
// controller.SetCurrentRoom(room);
|
||||
|
||||
// });
|
||||
|
||||
// return controller;
|
||||
// }
|
||||
|
||||
// public override bool CustomActivate()
|
||||
// {
|
||||
// var baseSuccess = base.CustomActivate();
|
||||
// if (!baseSuccess) return false;
|
||||
|
||||
// SourceSelectSRL = new SourceListSubpageReferenceList(this.TriList, n =>
|
||||
// { if (CurrentRoom != null) CurrentRoom.SelectSource(n); });
|
||||
|
||||
// var lm = Global.LicenseManager;
|
||||
// if (lm != null)
|
||||
// {
|
||||
// lm.LicenseIsValid.LinkInputSig(TriList.BooleanInput[UiCue.ShowLicensed.Number]);
|
||||
// //others
|
||||
// }
|
||||
|
||||
// // Wire up buttons
|
||||
// TriList.SetSigFalseAction(15003, () => SetMainMode(eMainModeType.Presentation));
|
||||
// TriList.SetSigFalseAction(15008, PowerOffWithConfirmPressed);
|
||||
// TriList.SetSigFalseAction(15101, () => SetMainMode(eMainModeType.Presentation));
|
||||
// TriList.SetSigFalseAction(15013, ShowHelp);
|
||||
// TriList.SetSigFalseAction(15014, () => SetMainMode(eMainModeType.Tech));
|
||||
|
||||
// // Temp things -----------------------------------------------------------------------
|
||||
// TriList.StringInput[UiCue.SplashMessage.Number].StringValue = SplashMessage;
|
||||
// //------------------------------------------------------------------------------------
|
||||
|
||||
// // Initialize initial view
|
||||
// ShowSplashOrMain();
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// In Essentials, this should NEVER be called, since it's a one-room solution
|
||||
// /// </summary>
|
||||
// protected override void HideRoomUI()
|
||||
// {
|
||||
// // UI Cleanup here????
|
||||
|
||||
// //SwapAudioDeviceControls(CurrentRoom.CurrentAudioDevice, null);
|
||||
// //CurrentRoom.AudioDeviceWillChange -= CurrentRoom_AudioDeviceWillChange;
|
||||
|
||||
// CurrentRoom.IsCoolingDownFeedback.OutputChange -= CurrentRoom_IsCoolingDown_OutputChange;
|
||||
// CurrentRoom.IsWarmingUpFeedback.OutputChange -= CurrentRoom_IsWarmingUp_OutputChange;
|
||||
|
||||
// SourceSelectSRL.DetachFromCurrentRoom();
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// Ties this panel controller to the Room and gets updates.
|
||||
// /// </summary>
|
||||
// protected override void ShowRoomUI()
|
||||
// {
|
||||
// Debug.Console(1, this, "connecting to system '{0}'", CurrentRoom.Key);
|
||||
|
||||
// TriList.StringInput[RoomCue.Name.Number].StringValue = CurrentRoom.Name;
|
||||
// TriList.StringInput[RoomCue.Description.Number].StringValue = CurrentRoom.Description;
|
||||
|
||||
// CurrentRoom.IsCoolingDownFeedback.OutputChange -= CurrentRoom_IsCoolingDown_OutputChange;
|
||||
// CurrentRoom.IsWarmingUpFeedback.OutputChange -= CurrentRoom_IsWarmingUp_OutputChange;
|
||||
// CurrentRoom.IsCoolingDownFeedback.OutputChange += CurrentRoom_IsCoolingDown_OutputChange;
|
||||
// CurrentRoom.IsWarmingUpFeedback.OutputChange += CurrentRoom_IsWarmingUp_OutputChange;
|
||||
|
||||
// SourceSelectSRL.AttachToRoom(CurrentRoom);
|
||||
// }
|
||||
|
||||
// void CurrentRoom_IsCoolingDown_OutputChange(object sender, EventArgs e)
|
||||
// {
|
||||
// Debug.Console(2, this, "Received room in cooldown={0}", CurrentRoom.IsCoolingDownFeedback.BoolValue);
|
||||
// if (CurrentRoom.IsCoolingDownFeedback.BoolValue) // When entering cooldown
|
||||
// {
|
||||
// // Do we need to check for an already-running cooldown - like in the case of room switches?
|
||||
// new ModalDialog(TriList).PresentModalTimerDialog(0, "Power Off", "Power", "Please wait, shutting down",
|
||||
// "", "", CurrentRoom.CooldownTime, true, b =>
|
||||
// {
|
||||
// ShowSplashOrMain();
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
|
||||
// void CurrentRoom_IsWarmingUp_OutputChange(object sender, EventArgs e)
|
||||
// {
|
||||
// Debug.Console(2, this, "Received room in warmup={0}", CurrentRoom.IsWarmingUpFeedback.BoolValue);
|
||||
// if (CurrentRoom.IsWarmingUpFeedback.BoolValue) // When entering warmup
|
||||
// {
|
||||
// // Do we need to check for an already-running cooldown - like in the case of room switches?
|
||||
// new ModalDialog(TriList).PresentModalTimerDialog(0, "Power On", "Power", "Please wait, powering on",
|
||||
// "", "", CurrentRoom.WarmupTime, false, b =>
|
||||
// {
|
||||
// // Reveal sources - or has already been done behind modal
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
|
||||
// // Handler for source change events.
|
||||
// void CurrentRoom_PresentationSourceChange(object sender, EssentialsRoomSourceChangeEventArgs args)
|
||||
// {
|
||||
// // Put away the old source and set up the new source.
|
||||
// Debug.Console(2, this, "Received source change={0}", args.NewSource != null ? args.NewSource.SourceKey : "none");
|
||||
|
||||
// // If we're in tech, don't switch screen modes. Add any other modes we may want to switch away from
|
||||
// // inside the if below.
|
||||
// if (MainMode == eMainModeType.Splash)
|
||||
// SetMainMode(eMainModeType.Presentation);
|
||||
// SetControlSource(args.NewSource);
|
||||
// }
|
||||
|
||||
// //***********************************************************************
|
||||
// //** UI Manipulation
|
||||
// //***********************************************************************
|
||||
|
||||
// /// <summary>
|
||||
// /// Shows the splash page or the main presentation page, depending on config setting
|
||||
// /// </summary>
|
||||
// void ShowSplashOrMain()
|
||||
// {
|
||||
// if (UsesSplashPage)
|
||||
// SetMainMode(eMainModeType.Splash);
|
||||
// else
|
||||
// SetMainMode(eMainModeType.Presentation);
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// Switches between main modes
|
||||
// /// </summary>
|
||||
// void SetMainMode(eMainModeType mode)
|
||||
// {
|
||||
// MainMode = mode;
|
||||
// switch (mode)
|
||||
// {
|
||||
// case eMainModeType.Presentation:
|
||||
// TriList.BooleanInput[UiCue.VisibleCommonFooter.Number].BoolValue = true;
|
||||
// TriList.BooleanInput[UiCue.VisibleCommonHeader.Number].BoolValue = true;
|
||||
// TriList.BooleanInput[UiCue.VisibleSplash.Number].BoolValue = false;
|
||||
// TriList.BooleanInput[UiCue.VisiblePresentationSourceList.Number].BoolValue = true;
|
||||
// ShowCurrentPresentationSourceUi();
|
||||
// break;
|
||||
// case eMainModeType.Splash:
|
||||
// TriList.BooleanInput[UiCue.VisibleCommonFooter.Number].BoolValue = false;
|
||||
// TriList.BooleanInput[UiCue.VisibleCommonHeader.Number].BoolValue = false;
|
||||
// TriList.BooleanInput[UiCue.VisiblePresentationSourceList.Number].BoolValue = false;
|
||||
// TriList.BooleanInput[UiCue.VisibleSplash.Number].BoolValue = true;
|
||||
// HideCurrentPresentationSourceUi();
|
||||
// break;
|
||||
// case eMainModeType.Tech:
|
||||
// new ModalDialog(TriList).PresentModalTimerDialog(1, "Tech page", "Info",
|
||||
// "Tech page will be here soon!<br>I promise",
|
||||
// "Bueno!", "", 0, false, null);
|
||||
// MainMode = eMainModeType.Presentation;
|
||||
// break;
|
||||
// default:
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// ///
|
||||
// /// </summary>
|
||||
// void PowerOffWithConfirmPressed()
|
||||
// {
|
||||
// if (CurrentRoom == null)
|
||||
// return;
|
||||
// if (!CurrentRoom.RoomIsOnFeedback.BoolValue)
|
||||
// return;
|
||||
// // Timeout or button 1 press will shut down
|
||||
// var modal = new ModalDialog(TriList);
|
||||
// uint seconds = CurrentRoom.UnattendedShutdownTimeMs / 1000;
|
||||
// var message = string.Format("Meeting will end in {0} seconds", seconds);
|
||||
// modal.PresentModalTimerDialog(2, "End Meeting", "Info", message,
|
||||
// "End Meeting Now", "Cancel", CurrentRoom.UnattendedShutdownTimeMs, true,
|
||||
// but => { if (but != 2) CurrentRoom.RoomOff(); });
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// Reveals the basic UI for the current device
|
||||
// /// </summary>
|
||||
// protected override void ShowCurrentPresentationSourceUi()
|
||||
// {
|
||||
// if (MainMode == eMainModeType.Splash && CurrentRoom.RoomIsOnFeedback.BoolValue)
|
||||
// SetMainMode(eMainModeType.Presentation);
|
||||
|
||||
// if (CurrentPresentationControlDevice == null)
|
||||
// {
|
||||
// // If system is off, do one thing
|
||||
|
||||
// // Otherwise, do something else - shouldn't be in this condition
|
||||
|
||||
// return;
|
||||
// }
|
||||
|
||||
// // If a controller is already loaded, use it
|
||||
// if (LoadedPageControllers.ContainsKey(CurrentPresentationControlDevice))
|
||||
// CurrentPresentationSourcePageController = LoadedPageControllers[CurrentPresentationControlDevice];
|
||||
// else
|
||||
// {
|
||||
// // This is by no means optimal, but for now....
|
||||
// if (CurrentPresentationControlDevice.Type == PresentationSourceType.SetTopBox
|
||||
// && CurrentPresentationControlDevice is ISetTopBoxControls)
|
||||
// CurrentPresentationSourcePageController = new PageControllerLargeSetTopBoxGeneric(TriList,
|
||||
// CurrentPresentationControlDevice as ISetTopBoxControls);
|
||||
|
||||
// else if (CurrentPresentationControlDevice.Type == PresentationSourceType.Laptop)
|
||||
// CurrentPresentationSourcePageController = new PageControllerLaptop(TriList);
|
||||
|
||||
// // separate these...
|
||||
// else if (CurrentPresentationControlDevice.Type == PresentationSourceType.Dvd)
|
||||
// CurrentPresentationSourcePageController =
|
||||
// new PageControllerLargeDvd(TriList, CurrentPresentationControlDevice as IDiscPlayerControls);
|
||||
|
||||
// else
|
||||
// CurrentPresentationSourcePageController = null;
|
||||
|
||||
// // Save it.
|
||||
// if (CurrentPresentationSourcePageController != null)
|
||||
// LoadedPageControllers[CurrentPresentationControlDevice] = CurrentPresentationSourcePageController;
|
||||
// }
|
||||
|
||||
// if (CurrentPresentationSourcePageController != null)
|
||||
// CurrentPresentationSourcePageController.SetVisible(true);
|
||||
// }
|
||||
|
||||
// protected override void HideCurrentPresentationSourceUi()
|
||||
// {
|
||||
// if (CurrentPresentationControlDevice != null && CurrentPresentationSourcePageController != null)
|
||||
// CurrentPresentationSourcePageController.SetVisible(false);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// void ShowHelp()
|
||||
// {
|
||||
// new ModalDialog(TriList).PresentModalTimerDialog(1, "Help", "Help", CurrentRoom.HelpMessage,
|
||||
// "OK", "", 0, false, null);
|
||||
// }
|
||||
|
||||
// protected void ListSmartObjects()
|
||||
// {
|
||||
// Debug.Console(0, this, "Smart objects IDs:");
|
||||
// var list = TriList.SmartObjects.OrderBy(s => s.Key);
|
||||
// foreach (var kvp in list)
|
||||
// Debug.Console(0, " {0}", kvp.Key);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
@@ -0,0 +1,28 @@
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Text;
|
||||
//using Crestron.SimplSharp;
|
||||
//using Crestron.SimplSharpPro;
|
||||
//using Crestron.SimplSharpPro.DeviceSupport;
|
||||
|
||||
//using PepperDash.Core;
|
||||
//using PepperDash.Essentials.Core;
|
||||
//using PepperDash.Essentials.Core.Presets;
|
||||
|
||||
|
||||
//namespace PepperDash.Essentials
|
||||
//{
|
||||
// public class PageControllerLaptop : DevicePageControllerBase
|
||||
// {
|
||||
// public PageControllerLaptop(BasicTriListWithSmartObject tl)
|
||||
// : base(tl)
|
||||
// {
|
||||
// FixedObjectSigs = new List<BoolInputSig>
|
||||
// {
|
||||
// tl.BooleanInput[10092], // well
|
||||
// tl.BooleanInput[11001] // Laptop info
|
||||
// };
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
@@ -0,0 +1,46 @@
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Text;
|
||||
//using Crestron.SimplSharp;
|
||||
//using Crestron.SimplSharpPro;
|
||||
//using Crestron.SimplSharpPro.DeviceSupport;
|
||||
|
||||
//using PepperDash.Core;
|
||||
//using PepperDash.Essentials.Core;
|
||||
//using PepperDash.Essentials.Core.Presets;
|
||||
|
||||
//namespace PepperDash.Essentials
|
||||
//{
|
||||
// /// <summary>
|
||||
// ///
|
||||
// /// </summary>
|
||||
// public class PageControllerLargeDvd : DevicePageControllerBase
|
||||
// {
|
||||
// IDiscPlayerControls Device;
|
||||
|
||||
// public PageControllerLargeDvd(BasicTriListWithSmartObject tl, IDiscPlayerControls device)
|
||||
// : base(tl)
|
||||
// {
|
||||
|
||||
// Device = device;
|
||||
// FixedObjectSigs = new List<BoolInputSig>
|
||||
// {
|
||||
// tl.BooleanInput[10093], // well
|
||||
// tl.BooleanInput[10411], // DVD Dpad
|
||||
// tl.BooleanInput[10412] // everything else
|
||||
// };
|
||||
// }
|
||||
|
||||
// protected override void CustomSetVisible(bool state)
|
||||
// {
|
||||
// // Hook up smart objects if applicable
|
||||
// if (Device != null)
|
||||
// {
|
||||
//#warning rewire this
|
||||
// //var uos = (Device as IHasCueActionList).CueActionList;
|
||||
// //SmartObjectHelper.LinkDpadWithUserObjects(TriList, 10411, uos, state);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
@@ -0,0 +1,139 @@
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Text;
|
||||
//using Crestron.SimplSharp;
|
||||
//using Crestron.SimplSharpPro;
|
||||
//using Crestron.SimplSharpPro.DeviceSupport;
|
||||
|
||||
//using PepperDash.Essentials.Core.Presets;
|
||||
|
||||
//using PepperDash.Core;
|
||||
//using PepperDash.Essentials.Core;
|
||||
|
||||
//namespace PepperDash.Essentials
|
||||
//{
|
||||
|
||||
// public class PageControllerLargeSetTopBoxGeneric : DevicePageControllerBase
|
||||
// {
|
||||
// // To-DO: Add properties for component subpage names. DpadPos1, DpadPos2...
|
||||
// // Derived classes can then insert special subpages for variations on given
|
||||
// // device types. Like DirecTV vs Comcast
|
||||
|
||||
// public uint DpadSmartObjectId { get; set; }
|
||||
// public uint NumberPadSmartObjectId { get; set; }
|
||||
// public uint PresetsSmartObjectId { get; set; }
|
||||
// public uint Position5TabsId { get; set; }
|
||||
|
||||
// ISetTopBoxControls Device;
|
||||
// DevicePresetsView PresetsView;
|
||||
|
||||
|
||||
// bool ShowPosition5Tabs;
|
||||
// uint CurrentVisiblePosition5Item = 1;
|
||||
// Dictionary<uint, uint> Position5SubpageJoins = new Dictionary<uint, uint>
|
||||
// {
|
||||
// { 1, 10053 },
|
||||
// { 2, 10054 }
|
||||
// };
|
||||
|
||||
// public PageControllerLargeSetTopBoxGeneric(BasicTriListWithSmartObject tl, ISetTopBoxControls device)
|
||||
// : base(tl)
|
||||
// {
|
||||
// Device = device;
|
||||
// DpadSmartObjectId = 10011;
|
||||
// NumberPadSmartObjectId = 10014;
|
||||
// PresetsSmartObjectId = 10012;
|
||||
// Position5TabsId = 10081;
|
||||
|
||||
// bool dpad = device is IDPad;
|
||||
// bool preset = device.HasPresets;
|
||||
// bool dvr = device.HasDvr;
|
||||
// bool numbers = device is INumericKeypad;
|
||||
// uint[] joins = null;
|
||||
|
||||
// if (dpad && !preset && !dvr && !numbers) joins = new uint[] { 10031, 10091 };
|
||||
// else if (!dpad && preset && !dvr && !numbers) joins = new uint[] { 10032, 10091 };
|
||||
// else if (!dpad && !preset && dvr && !numbers) joins = new uint[] { 10033, 10091 };
|
||||
// else if (!dpad && !preset && !dvr && numbers) joins = new uint[] { 10034, 10091 };
|
||||
|
||||
// else if (dpad && preset && !dvr && !numbers) joins = new uint[] { 10042, 10021, 10092 };
|
||||
// else if (dpad && !preset && dvr && !numbers) joins = new uint[] { 10043, 10021, 10092 };
|
||||
// else if (dpad && !preset && !dvr && numbers) joins = new uint[] { 10044, 10021, 10092 };
|
||||
// else if (!dpad && preset && dvr && !numbers) joins = new uint[] { 10043, 10022, 10092 };
|
||||
// else if (!dpad && preset && !dvr && numbers) joins = new uint[] { 10044, 10022, 10092 };
|
||||
// else if (!dpad && !preset && dvr && numbers) joins = new uint[] { 10044, 10023, 10092 };
|
||||
|
||||
// else if (dpad && preset && dvr && !numbers) joins = new uint[] { 10053, 10032, 10011, 10093 };
|
||||
// else if (dpad && preset && !dvr && numbers) joins = new uint[] { 10054, 10032, 10011, 10093 };
|
||||
// else if (dpad && !preset && dvr && numbers) joins = new uint[] { 10054, 10033, 10011, 10093 };
|
||||
// else if (!dpad && preset && dvr && numbers) joins = new uint[] { 10054, 10033, 10012, 10093 };
|
||||
|
||||
// else if (dpad && preset && dvr && numbers)
|
||||
// {
|
||||
// joins = new uint[] { 10081, 10032, 10011, 10093 }; // special case
|
||||
// ShowPosition5Tabs = true;
|
||||
// }
|
||||
// // Project the joins into corresponding sigs.
|
||||
// FixedObjectSigs = joins.Select(u => TriList.BooleanInput[u]).ToList();
|
||||
|
||||
// // Build presets
|
||||
// if (device.HasPresets)
|
||||
// {
|
||||
// PresetsView = new DevicePresetsView(tl, device.PresetsModel);
|
||||
// }
|
||||
// }
|
||||
|
||||
// protected override void CustomSetVisible(bool state)
|
||||
// {
|
||||
// if (ShowPosition5Tabs)
|
||||
// {
|
||||
// // Show selected tab
|
||||
// TriList.BooleanInput[Position5SubpageJoins[CurrentVisiblePosition5Item]].BoolValue = state;
|
||||
|
||||
// var tabSo = TriList.SmartObjects[Position5TabsId];
|
||||
// if (state) // Link up the tab object
|
||||
// {
|
||||
// tabSo.BooleanOutput["Tab Button 1 Press"].UserObject = new Action<bool>(b => ShowTab(1));
|
||||
// tabSo.BooleanOutput["Tab Button 2 Press"].UserObject = new Action<bool>(b => ShowTab(2));
|
||||
// }
|
||||
// else // Disco tab object
|
||||
// {
|
||||
// tabSo.BooleanOutput["Tab Button 1 Press"].UserObject = null;
|
||||
// tabSo.BooleanOutput["Tab Button 2 Press"].UserObject = null;
|
||||
// }
|
||||
// }
|
||||
|
||||
// // Hook up smart objects if applicable
|
||||
//#warning hook these up
|
||||
// //if (Device is IHasCueActionList)
|
||||
// //{
|
||||
// // var uos = (Device as IHasCueActionList).CueActionList;
|
||||
// // SmartObjectHelper.LinkDpadWithUserObjects(TriList, DpadSmartObjectId, uos, state);
|
||||
// // SmartObjectHelper.LinkNumpadWithUserObjects(TriList, NumberPadSmartObjectId,
|
||||
// // uos, CommonBoolCue.Dash, CommonBoolCue.Last, state);
|
||||
// //}
|
||||
|
||||
|
||||
// // Link, unlink presets
|
||||
// if (Device.HasPresets && state)
|
||||
// PresetsView.Attach();
|
||||
// else if (Device.HasPresets && !state)
|
||||
// PresetsView.Detach();
|
||||
// }
|
||||
|
||||
// void ShowTab(uint number)
|
||||
// {
|
||||
// // Ignore re-presses
|
||||
// if (CurrentVisiblePosition5Item == number) return;
|
||||
// // Swap subpage
|
||||
// var bi = TriList.BooleanInput;
|
||||
// if (CurrentVisiblePosition5Item > 0)
|
||||
// bi[Position5SubpageJoins[CurrentVisiblePosition5Item]].BoolValue = false;
|
||||
// CurrentVisiblePosition5Item = number;
|
||||
// bi[Position5SubpageJoins[CurrentVisiblePosition5Item]].BoolValue = true;
|
||||
|
||||
// // Show feedback on buttons
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
43
PepperDashEssentials/FOR REFERENCE UI/Panels/REMOVE UiCue.cs
Normal file
43
PepperDashEssentials/FOR REFERENCE UI/Panels/REMOVE UiCue.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Text;
|
||||
//using Crestron.SimplSharp;
|
||||
|
||||
//namespace PepperDash.Essentials.Core
|
||||
//{
|
||||
// public class UiCue
|
||||
// {
|
||||
// public static readonly Cue VisibleSystemInit = Cue.BoolCue("VisibleSystemInit", 15001);
|
||||
// public static readonly Cue VisibleSplash = Cue.BoolCue("VisibleSplash", 15002);
|
||||
// public static readonly Cue PressSplash = Cue.BoolCue("PressSplash", 15003);
|
||||
// public static readonly Cue PressRoomOn = Cue.BoolCue("PressRoomOn", 15006);
|
||||
// public static readonly Cue PressRoomOff = Cue.BoolCue("PressRoomOff", 15007);
|
||||
// public static readonly Cue PressRoomOffWithConfirm = Cue.BoolCue("PressRoomOffWithConfirm", 15008);
|
||||
// public static readonly Cue VisibleCommonHeader = Cue.BoolCue("PressPowerOffConfirm", 15011);
|
||||
// public static readonly Cue VisibleCommonFooter = Cue.BoolCue("VisibleCommonFooter", 15012);
|
||||
// public static readonly Cue PressHelp = Cue.BoolCue("PressHelp", 15013);
|
||||
// public static readonly Cue PressSettings = Cue.BoolCue("PressSettings", 15014);
|
||||
|
||||
// public static readonly Cue ShowDate = Cue.BoolCue("PressSettings", 15015);
|
||||
// public static readonly Cue ShowTime = Cue.BoolCue("PressSettings", 15016);
|
||||
// public static readonly Cue ShowLicensed = Cue.BoolCue("PressSettings", 15017);
|
||||
// public static readonly Cue ShowUnLicensed = Cue.BoolCue("PressSettings", 15018);
|
||||
|
||||
// public static readonly Cue PressModePresentationShare = Cue.BoolCue("PressModePresentationShare", 15101);
|
||||
// public static readonly Cue PressModeVideoConf = Cue.BoolCue("PressModeVideoConf", 15102);
|
||||
// public static readonly Cue PressModeAudioConf = Cue.BoolCue("PressModeAudioConf", 15103);
|
||||
|
||||
// public static readonly Cue VisiblePresentationSourceList = Cue.BoolCue("VisiblePresentationSourceList", 15111);
|
||||
// public static readonly Cue VisibleSystemIsOff = Cue.BoolCue("VisibleSystemIsOff", 15112);
|
||||
|
||||
// public static readonly Cue VisibleAudioConfPopover = Cue.BoolCue("VisibleAudioConfPopover", 15201);
|
||||
|
||||
// public static readonly Cue VisibleVideoConfPopover = Cue.BoolCue("VisibleVideoConfPopover", 15251);
|
||||
|
||||
// public static readonly Cue TextRoomName = Cue.BoolCue("TextRoomName", 4001);
|
||||
// public static readonly Cue TextPresentationShareButton = Cue.BoolCue("TextPresentationShareButton", 4011);
|
||||
|
||||
// public static readonly Cue SplashMessage = Cue.StringCue("SplashMessage", 2101);
|
||||
// }
|
||||
//}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user