Compare commits

..

1 Commits

Author SHA1 Message Date
Neil Dorin
cdd499e05b Resolves issue with RoomVacancyShutdownTimer in InShutDownWarning mode 2018-10-18 14:37:52 -06:00
801 changed files with 65684 additions and 94440 deletions

View File

@@ -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.

View File

@@ -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.

View File

@@ -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.

View File

@@ -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

View File

@@ -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

View File

@@ -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";
}

View File

@@ -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

View File

@@ -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

View File

@@ -1,45 +0,0 @@
name: Publish Docs
# Trigger the action on push to main
on:
push:
branches:
- main
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
actions: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
publish-docs:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Dotnet Setup
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x
- run: dotnet tool update -g docfx
- run: docfx ./docs/docfx.json
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
# Upload entire repository
path: './docs/_site'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

377
.gitignore vendored
View File

@@ -20,379 +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
_site/
api/
*.DS_Store
/._PepperDash.Essentials.4Series.sln
*.projectinfo

3
.gitmodules vendored
View File

@@ -0,0 +1,3 @@
[submodule "essentials-framework"]
path = essentials-framework
url = https://bitbucket.org/Pepperdash_Products/essentials-framework.git

View File

@@ -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"
}
]
}

View File

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

View File

@@ -1,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

View File

@@ -1,282 +0,0 @@
# Crestron Library Usage Analysis - PepperDash Essentials
This document provides a comprehensive analysis of Crestron classes and interfaces used throughout the PepperDash Essentials framework, organized by namespace and library component.
## Executive Summary
The PepperDash Essentials framework extensively leverages Crestron SDK components across 100+ files, providing abstractions for:
- Control system hardware (processors, touchpanels, IO devices)
- Communication interfaces (Serial, TCP/IP, SSH, CEC, IR)
- Device management and routing
- User interface components and smart objects
- System monitoring and diagnostics
## 1. Core Crestron Libraries
### 1.1 Crestron.SimplSharp
**Primary Usage**: Foundational framework components, collections, and basic types.
**Key Files**:
- Multiple files across all projects use `Crestron.SimplSharp` namespaces
- Provides basic C# runtime support for Crestron processors
### 1.2 Crestron.SimplSharpPro
**Primary Usage**: Main hardware abstraction layer for Crestron devices.
**Key Classes Used**:
#### CrestronControlSystem
- **File**: `/src/PepperDash.Essentials/ControlSystem.cs`
- **Usage**: Base class for the main control system implementation
- **Implementation**: `public class ControlSystem : CrestronControlSystem, ILoadConfig`
#### Device (Base Class)
- **Files**: 50+ files inherit from or use this class
- **Key Implementations**:
- `/src/PepperDash.Core/Device.cs` - Core device abstraction
- `/src/PepperDash.Essentials.Core/Devices/EssentialsDevice.cs` - Extended device base
- `/src/PepperDash.Essentials.Core/Room/Room.cs` - Room device implementation
- `/src/PepperDash.Essentials.Core/Devices/CrestronProcessor.cs` - Processor device wrapper
#### BasicTriList
- **Files**: 30+ files use this class extensively
- **Primary Usage**: Touchpanel communication and SIMPL bridging
- **Key Files**:
- `/src/PepperDash.Essentials.Core/Touchpanels/TriListExtensions.cs` - Extension methods for signal handling
- `/src/PepperDash.Essentials.Core/Devices/EssentialsBridgeableDevice.cs` - Bridge interface
- `/src/PepperDash.Essentials.Core/Touchpanels/ModalDialog.cs` - UI dialog implementation
#### BasicTriListWithSmartObject
- **Files**: Multiple touchpanel and UI files
- **Usage**: Enhanced touchpanel support with smart object integration
- **Key Files**:
- `/src/PepperDash.Essentials.Core/Touchpanels/Interfaces.cs` - Interface definitions
- `/src/PepperDash.Essentials.Core/SmartObjects/SubpageReferenceList/SubpageReferenceList.cs`
## 2. Communication Hardware
### 2.1 Serial Communication (ComPort)
**Primary Class**: `ComPort`
**Key Files**:
- `/src/PepperDash.Essentials.Core/Comm and IR/ComPortController.cs`
- `/src/PepperDash.Essentials.Core/Comm and IR/CommFactory.cs`
**Usage Pattern**:
```csharp
public class ComPortController : Device, IBasicCommunicationWithStreamDebugging
public static ComPort GetComPort(EssentialsControlPropertiesConfig config)
```
**Interface Support**: `IComPorts` - Used for devices that provide multiple COM ports
### 2.2 IR Communication (IROutputPort)
**Primary Class**: `IROutputPort`
**Key Files**:
- `/src/PepperDash.Essentials.Core/Devices/IrOutputPortController.cs`
- `/src/PepperDash.Essentials.Core/Devices/GenericIRController.cs`
- `/src/PepperDash.Essentials.Core/Comm and IR/IRPortHelper.cs`
**Usage Pattern**:
```csharp
public class IrOutputPortController : Device
IROutputPort IrPort;
public IrOutputPortController(string key, IROutputPort port, string irDriverFilepath)
```
### 2.3 CEC Communication (ICec)
**Primary Interface**: `ICec`
**Key Files**:
- `/src/PepperDash.Essentials.Core/Comm and IR/CecPortController.cs`
- `/src/PepperDash.Essentials.Core/Comm and IR/CommFactory.cs`
**Usage Pattern**:
```csharp
public class CecPortController : Device, IBasicCommunicationWithStreamDebugging
public static ICec GetCecPort(ControlPropertiesConfig config)
```
## 3. Input/Output Hardware
### 3.1 Digital Input
**Primary Interface**: `IDigitalInput`
**Key Files**:
- `/src/PepperDash.Essentials.Core/CrestronIO/GenericDigitalInputDevice.cs`
- `/src/PepperDash.Essentials.Core/Microphone Privacy/MicrophonePrivacyController.cs`
**Usage Pattern**:
```csharp
public List<IDigitalInput> Inputs { get; private set; }
void AddInput(IDigitalInput input)
```
### 3.2 Versiport Support
**Key Files**:
- `/src/PepperDash.Essentials.Core/CrestronIO/GenericVersiportInputDevice.cs`
- `/src/PepperDash.Essentials.Core/CrestronIO/GenericVersiportAnalogInputDevice.cs`
- `/src/PepperDash.Essentials.Core/CrestronIO/GenericVersiportOutputDevice.cs`
**Usage**: Provides flexible I/O port configuration for various signal types
## 4. Touchpanel Hardware
### 4.1 MPC3 Touchpanel
**Primary Class**: `MPC3Basic`
**Key File**: `/src/PepperDash.Essentials.Core/Touchpanels/Mpc3Touchpanel.cs`
**Usage Pattern**:
```csharp
public class Mpc3TouchpanelController : Device
readonly MPC3Basic _touchpanel;
_touchpanel = processor.ControllerTouchScreenSlotDevice as MPC3Basic;
```
### 4.2 TSW Series Support
**Evidence**: References found in messenger files and mobile control components
**Usage**: Integrated through mobile control messaging system for TSW touchpanel features
## 5. Timer and Threading
### 5.1 CTimer
**Primary Class**: `CTimer`
**Key File**: `/src/PepperDash.Core/PasswordManagement/PasswordManager.cs`
**Usage Pattern**:
```csharp
Debug.Console(1, string.Format("PasswordManager.UpdatePassword: CTimer Started"));
Debug.Console(1, string.Format("PasswordManager.UpdatePassword: CTimer Reset"));
```
## 6. Networking and Communication
### 6.1 Ethernet Communication
**Libraries Used**:
- `Crestron.SimplSharpPro.EthernetCommunication`
- `Crestron.SimplSharp.Net.Utilities.EthernetHelper`
**Key Files**:
- `/src/PepperDash.Core/Comm/GenericTcpIpClient.cs`
- `/src/PepperDash.Core/Comm/GenericTcpIpServer.cs`
- `/src/PepperDash.Core/Comm/GenericSecureTcpIpClient.cs`
- `/src/PepperDash.Core/Comm/GenericSshClient.cs`
- `/src/PepperDash.Core/Comm/GenericUdpServer.cs`
**Usage Pattern**:
```csharp
public class GenericTcpIpClient : Device, ISocketStatusWithStreamDebugging, IAutoReconnect
public class GenericSecureTcpIpClient : Device, ISocketStatusWithStreamDebugging, IAutoReconnect
```
## 7. Device Management Libraries
### 7.1 DeviceSupport
**Library**: `Crestron.SimplSharpPro.DeviceSupport`
**Usage**: Core device support infrastructure used throughout the framework
### 7.2 DM (DigitalMedia)
**Library**: `Crestron.SimplSharpPro.DM`
**Usage**: Digital media routing and switching support
**Evidence**: Found in routing configuration and DM output card references
## 8. User Interface Libraries
### 8.1 UI Components
**Library**: `Crestron.SimplSharpPro.UI`
**Usage**: User interface elements and touchpanel controls
### 8.2 Smart Objects
**Key Files**:
- `/src/PepperDash.Essentials.Core/SmartObjects/SmartObjectDynamicList.cs`
- `/src/PepperDash.Essentials.Core/SmartObjects/SubpageReferenceList/SubpageReferenceList.cs`
**Usage**: Advanced UI components with dynamic content
## 9. System Monitoring and Diagnostics
### 9.1 Diagnostics
**Library**: `Crestron.SimplSharpPro.Diagnostics`
**Usage**: System health monitoring and performance tracking
### 9.2 System Information
**Key Files**:
- `/src/PepperDash.Essentials.Core/Monitoring/SystemMonitorController.cs`
**Usage**: Provides system status, Ethernet information, and program details
## 10. Integration Patterns
### 10.1 SIMPL Bridging
**Pattern**: Extensive use of `BasicTriList` for SIMPL integration
**Files**: Bridge classes throughout the framework implement `LinkToApi` methods:
```csharp
public abstract void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge);
```
### 10.2 Device Factory Pattern
**Implementation**: Factory classes create hardware-specific implementations
**Example**: `CommFactory.cs` provides communication device creation
### 10.3 Extension Methods
**Pattern**: Extensive use of extension methods for Crestron classes
**Example**: `TriListExtensions.cs` adds 30+ extension methods to `BasicTriList`
## 11. Signal Processing
### 11.1 Signal Types
**Bool Signals**: Digital control and feedback
**UShort Signals**: Analog values and numeric data
**String Signals**: Text and configuration data
**Implementation**: Comprehensive signal handling in `TriListExtensions.cs`
## 12. Error Handling and Logging
**Pattern**: Consistent use of Crestron's Debug logging throughout
**Examples**:
```csharp
Debug.LogMessage(LogEventLevel.Information, "Device {0} is not a valid device", dc.PortDeviceKey);
Debug.LogMessage(LogEventLevel.Debug, "Error Waking Panel. Maybe testing with Xpanel?");
```
## 13. Threading and Synchronization
**Components**:
- CTimer for time-based operations
- Thread-safe collections and patterns
- Event-driven programming models
## Conclusion
The PepperDash Essentials framework demonstrates sophisticated integration with the Crestron ecosystem, leveraging:
- **Core Infrastructure**: CrestronControlSystem, Device base classes
- **Communication**: COM, IR, CEC, TCP/IP, SSH protocols
- **Hardware Abstraction**: Touchpanels, I/O devices, processors
- **User Interface**: Smart objects, signal processing, SIMPL bridging
- **System Services**: Monitoring, diagnostics, device management
This analysis shows that Essentials serves as a comprehensive middleware layer, abstracting Crestron hardware complexities while providing modern software development patterns and practices.
---
*Generated: [Current Date]*
*Framework Version: PepperDash Essentials (Based on codebase analysis)*

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -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.

View File

@@ -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
View 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

View 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; }
}
}

View 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
}
}

View File

@@ -0,0 +1,733 @@
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;
/// <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;
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;
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, "showactionpaths", "Prints the paths in teh Action Dictionary", ConsoleAccessLevelEnum.AccessOperator);
CrestronEnvironment.ProgramStatusEventHandler += new ProgramStatusEventHandler(CrestronEnvironment_ProgramStatusEventHandler);
}
/// <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)
{
SendMessageToServer(JObject.FromObject( new
{
type = "/system/close"
}));
}
}
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");
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");
// 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)
{
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.");
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");
CrestronConsole.ConsoleCommandResponse(@"Mobile Control Information:
Server address: {0}
System Name: {1}
System UUID: {2}
System User code: {3}
Connected?: {4}", url, name, SystemUuid,
code, conn);
}
/// <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()
{
var ready = RegisterLockEvent.Wait(20000);
if (!ready)
{
Debug.Console(1, this, "RegisterSystemToServer failed to enter after 20 seconds. Ignoring");
return;
}
RegisterLockEvent.Reset();
try
{
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);
string postBody = JsonConvert.SerializeObject(confObject);
SystemUuid = confObject.SystemUuid;
if (string.IsNullOrEmpty(postBody))
{
Debug.Console(1, this, "ERROR: Config body is empty. Cannot register with server.");
}
else
{
var regClient = new HttpClient();
regClient.Verbose = true;
regClient.KeepAlive = true;
string url = string.Format("http://{0}/api/system/join/{1}", Config.ServerUrl, SystemUuid);
Debug.Console(1, this, "Joining server at {0}", url);
HttpClientRequest request = new HttpClientRequest();
request.Url.Parse(url);
request.RequestType = RequestType.Post;
request.Header.SetHeaderValue("Content-Type", "application/json");
request.ContentString = postBody;
var err = regClient.DispatchAsync(request, RegistrationConnectionCallback);
}
}
catch (Exception e)
{
Debug.Console(0, this, "ERROR: Initilizing Room: {0}", e);
RegisterLockEvent.Set();
StartReconnectTimer();
}
}
/// <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 });
Debug.Console(1, this, "Message TX: {0}", message);
var messageBytes = System.Text.Encoding.UTF8.GetBytes(message);
WSClient.Send(messageBytes, (uint)messageBytes.Length, WebSocketClient.WEBSOCKET_PACKET_TYPES.LWS_WS_OPCODE_07__TEXT_FRAME);
//WSClient.SendAsync(messageBytes, (uint)messageBytes.Length, WebSocketClient.WEBSOCKET_PACKET_TYPES.LWS_WS_OPCODE_07__TEXT_FRAME);
}
}
/// <summary>
/// Disconnects the SSE Client and stops the heartbeat timer
/// </summary>
/// <param name="command"></param>
void DisconnectStreamClient(string command)
{
//if(SseClient != null)
// SseClient.Disconnect();
if (WSClient != null && WSClient.Connected)
WSClient.Disconnect();
if (ServerHeartbeatCheckTimer != null)
{
ServerHeartbeatCheckTimer.Stop();
ServerHeartbeatCheckTimer = null;
}
}
/// <summary>
/// The callback that fires when we get a response from our registration attempt
/// </summary>
/// <param name="resp"></param>
/// <param name="err"></param>
void RegistrationConnectionCallback(HttpClientResponse resp, HTTP_CALLBACK_ERROR err)
{
CheckHttpDebug(resp, err);
Debug.Console(1, this, "RegistrationConnectionCallback: {0}", err);
try
{
if (resp != null && resp.Code == 200)
{
if(ServerReconnectTimer != null)
{
ServerReconnectTimer.Stop();
ServerReconnectTimer = null;
}
// Success here!
ConnectStreamClient();
}
else
{
if (resp != null)
Debug.Console(1, this, "Response from server: {0}\n{1}", resp.Code, err);
else
{
Debug.Console(1, this, "Null response received from server.");
}
StartReconnectTimer();
}
}
catch (Exception e)
{
Debug.Console(1, this, "Error Initializing Stream Client: {0}", e);
StartReconnectTimer();
}
RegisterLockEvent.Set();
}
/// <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;
}
StartReconnectTimer();
}
/// <summary>
///
/// </summary>
/// <param name="dueTime"></param>
/// <param name="repeatTime"></param>
void StartReconnectTimer()
{
// Start the reconnect timer
if (ServerReconnectTimer == null)
{
ServerReconnectTimer = new CTimer(ReconnectToServerTimerCallback, null, ServerReconnectInterval, ServerReconnectInterval);
Debug.Console(1, this, "Reconnect Timer Started.");
}
ServerReconnectTimer.Reset(ServerReconnectInterval, ServerReconnectInterval);
}
/// <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.");
}
ServerHeartbeatCheckTimer.Reset(ServerHeartbeatInterval, ServerHeartbeatInterval);
}
/// <summary>
/// Connects the SSE Client
/// </summary>
/// <param name="o"></param>
void ConnectStreamClient()
{
Debug.Console(0, this, "Initializing Stream client to server.");
if (WSClient == null)
{
WSClient = new WebSocketClient();
}
WSClient.URL = string.Format("wss://{0}/system/join/{1}", Config.ServerUrl, this.SystemUuid);
WSClient.Connect();
Debug.Console(0, this, "Websocket connected");
WSClient.ReceiveCallBack = WebsocketReceiveCallback;
//WSClient.SendCallBack = WebsocketSendCallback;
WSClient.ReceiveAsync();
}
/// <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)
{
Debug.Console(0, this, "------ Begin HTTP Debug ---------------------------------------");
Debug.Console(0, this, "HTTP Response URL: {0}", r.ResponseUrl.ToString());
Debug.Console(0, this, "HTTP Response 'error' {0}", e);
Debug.Console(0, this, "HTTP Response code: {0}", r.Code);
Debug.Console(0, this, "HTTP Response content: \r{0}", r.ContentString);
Debug.Console(0, this, "------ End HTTP Debug -----------------------------------------");
}
}
/// <summary>
///
/// </summary>
/// <param name="data"></param>
/// <param name="length"></param>
/// <param name="opcode"></param>
/// <param name="err"></param>
int WebsocketReceiveCallback(byte[] data, uint length, WebSocketClient.WEBSOCKET_PACKET_TYPES opcode,
WebSocketClient.WEBSOCKET_RESULT_CODES err)
{
var rx = System.Text.Encoding.UTF8.GetString(data, 0, (int)length);
if(rx.Length > 0)
ParseStreamRx(rx);
WSClient.ReceiveAsync();
return 1;
}
/// <summary>
/// Callback to catch possible errors in sending via the websocket
/// </summary>
/// <param name="result"></param>
/// <returns></returns>
int WebsocketSendCallback(Crestron.SimplSharp.CrestronWebSocketClient.WebSocketClient.WEBSOCKET_RESULT_CODES result)
{
Debug.Console(1, this, "SendCallback result: {0}", result);
return 1;
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void ParseStreamRx(string message)
{
if(string.IsNullOrEmpty(message))
return;
Debug.Console(1, this, "Message RX: '{0}'", message);
try
{
var messageObj = JObject.Parse(message);
var type = messageObj["type"].Value<string>();
if (type == "hello")
{
ResetOrStartHearbeatTimer();
}
else if (type == "/system/heartbeat")
{
HandleHeartBeat(messageObj["content"]);
}
else if (type == "close")
{
WSClient.Disconnect();
ServerHeartbeatCheckTimer.Stop();
// Start the reconnect timer
StartReconnectTimer();
}
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");
}
}
}

View File

@@ -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");
}
}
}

View File

@@ -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");
}
}
}

View File

@@ -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");
}
}
}

View File

@@ -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");
}
}
}

View File

@@ -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");
}
}
}

View File

@@ -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");
}
}
}

View File

@@ -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");
}
}
}

View File

@@ -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");
}
}
}

View 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();
}
}

View File

@@ -0,0 +1,259 @@
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
/// </summary>
public class VideoCodecBaseMessenger
{
/// <summary>
///
/// </summary>
public VideoCodecBase Codec { get; private set; }
public CotijaSystemController AppServerController { get; private set; }
public string MessagePath { get; private set; }
/// <summary>
///
/// </summary>
/// <param name="codec"></param>
public VideoCodecBaseMessenger(VideoCodecBase codec, string messagePath)
{
if (codec == null)
throw new ArgumentNullException("codec");
if (string.IsNullOrEmpty(messagePath))
throw new ArgumentException("messagePath must not be empty or null");
MessagePath = messagePath;
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);
}
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void dirCodec_DirectoryResultReturned(object sender, DirectoryEventArgs e)
{
var dir = e.Directory;
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>
/// Registers this codec's messaging with an app server controller
/// </summary>
/// <param name="appServerController"></param>
public void RegisterWithAppServer(CotijaSystemController appServerController)
{
if (appServerController == null)
throw new ArgumentNullException("appServerController");
AppServerController = 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 + "/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));
}
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
});
}
/// <summary>
/// Helper for posting status message
/// </summary>
/// <param name="contentObject">The contents of the content object</param>
void PostStatusMessage(object contentObject)
{
AppServerController.SendMessageToServer(JObject.FromObject(new
{
type = MessagePath,
content = contentObject
}));
}
}
}

View File

@@ -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()
{
}
}
}

View File

@@ -0,0 +1,670 @@
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.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>
/// 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>
/// 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>
/// 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;
/// <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();
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);
CrestronConsole.AddNewConsoleCommand(s => LoadConfigValues(), "loadddvc", "", ConsoleAccessLevelEnum.AccessOperator);
return base.CustomActivate();
}
/// <summary>
/// Setup the actions to take place on various incoming API calls
/// </summary>
void SetupFunctions()
{
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/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)));
// Source Device (Current Source)'
SourceDeviceMapDictionary sourceJoinMap = new SourceDeviceMapDictionary();
var prefix = @"/device/currentSource/";
foreach (var item in sourceJoinMap)
{
Parent.AddAction(string.Format("{0}{1}", prefix, item.Key), new PressAndHoldAction(b => EISC.SetBool(item.Value, 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)
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});
}
// 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));
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,
};
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);
}
co.SourceLists.Add("default", newSl);
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;
}
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;
}
/// <summary>
///
/// </summary>
/// <param name="oldKey"></param>
/// <param name="newKey"></param>
void SourceChange(string oldKey, string newKey)
{
/* 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);
// }
// var huddleRoom = room as EssentialsHuddleSpaceRoom;
// JObject roomStatus = new JObject();
// roomStatus.Add("selectedSourceKey", huddleRoom.CurrentSourceInfoKey);
// JObject message = new JObject();
// message.Add("type", "/room/status/");
// message.Add("content", roomStatus);
// Parent.PostToServer(message);
//}
//else
//{
// 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);
// }
//}
}
}
}

View File

@@ -0,0 +1,491 @@
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;
namespace PepperDash.Essentials
{
public class CotijaEssentialsHuddleSpaceRoomBridge : CotijaBridgeBase
{
public EssentialsRoomBase Room { get; private set; }
public VideoCodecBaseMessenger VCMessenger { 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/mute", 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 += VolumeLevelFeedback_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)
{
var codec = vcRoom.VideoCodec;
VCMessenger = new VideoCodecBaseMessenger(vcRoom.VideoCodec, "/device/videoCodec");
VCMessenger.RegisterWithAppServer(Parent);
// May need to move this or remove this
codec.CallStatusChange += new EventHandler<CodecCallStatusItemChangeEventArgs>(codec_CallStatusChange);
vcRoom.IsSharingFeedback.OutputChange += new EventHandler<FeedbackEventArgs>(IsSharingFeedback_OutputChange);
//Parent.AddAction("/device/videoCodec/dial", new Action<string>(s => codec.Dial(s)));
//Parent.AddAction("/device/videoCodec/endCall", new Action<string>(s =>
//{
// var call = codec.ActiveCalls.FirstOrDefault(c => c.Id == s);
// if (call != null)
// {
// codec.EndCall(call);
// }
//}));
//Parent.AddAction("/device/videoCodec/endAllCalls", new Action(() => codec.EndAllCalls()));
}
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);
}

View File

@@ -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>
/// Represents a SourceDeviceMapDictionary
/// 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);
}
}
}

View 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;
}
}
}

View File

@@ -1,16 +1,24 @@
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>
/// Represents a EssentialsRoomVolumesConfig
///
/// </summary>
public class EssentialsRoomVolumesConfig
{
/// <summary>
/// Gets or sets the Master
/// </summary>
public EssentialsVolumeLevelConfig Master { get; set; }
public EssentialsVolumeLevelConfig Program { get; set; }
public EssentialsVolumeLevelConfig AudioCallRx { get; set; }
@@ -18,21 +26,12 @@ namespace PepperDash.Essentials.Room.Config
}
/// <summary>
/// Represents a EssentialsVolumeLevelConfig
///
/// </summary>
public class EssentialsVolumeLevelConfig
{
/// <summary>
/// Gets or sets the DeviceKey
/// </summary>
public string DeviceKey { get; set; }
/// <summary>
/// Gets or sets the Label
/// </summary>
public string Label { get; set; }
/// <summary>
/// Gets or sets the Level
/// </summary>
public int Level { get; set; }
/// <summary>
@@ -40,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)
@@ -58,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)
{
@@ -70,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;
}
* */
}
}
}

View File

@@ -0,0 +1,214 @@
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;
using PepperDash.Essentials.Core.Devices;
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 ThreeSeriesTcpIpEthernetIntersystemCommunications Eisc { get; private set; }
public EiscApi(string key, uint ipid, string hostname) :
base(key)
{
Eisc = new ThreeSeriesTcpIpEthernetIntersystemCommunications(ipid, hostname, Global.ControlSystem);
Eisc.SigChange += new Crestron.SimplSharpPro.DeviceSupport.SigEventHandler(Eisc_SigChange);
Eisc.Register();
}
/// <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, "BridgeApi 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>
/// Defines each type and it's matching API type
/// </summary>
public static class DeviceApiFactory
{
public static Dictionary<Type, Type> TypeMap = new Dictionary<Type, Type>
{
{ typeof(DmChassisController), typeof(DmChassisControllerApi) },
{ typeof(IBasicCommunication), typeof(IBasicCommunicationApi) }
//{ typeof(SomeShittyDisplayController), typeof(SomeShittyDisplayControllerApi) }
};
}
/// <summary>
/// API class for IBasicCommunication devices
/// </summary>
public class IBasicCommunicationApi : DeviceApiBase
{
public IBasicCommunication Device { get; set; }
SerialFeedback TextReceivedFeedback;
public IBasicCommunicationApi(IBasicCommunication dev)
{
TextReceivedFeedback = new SerialFeedback();
Device = dev;
SetupFeedbacks();
ActionApi = new Dictionary<string, Object>
{
{ "connect", new Action(Device.Connect) },
{ "disconnect", new Action(Device.Disconnect) },
{ "connectstate", new Action<bool>( b => ConnectByState(b) ) },
{ "sendtext", new Action<string>( s => Device.SendText(s) ) }
};
FeedbackApi = new Dictionary<string, Feedback>
{
{ "isconnected", new BoolFeedback( () => Device.IsConnected ) },
{ "textrecieved", TextReceivedFeedback }
};
}
/// <summary>
/// Controls connection based on state of input
/// </summary>
/// <param name="state"></param>
void ConnectByState(bool state)
{
if (state)
Device.Connect();
else
Device.Disconnect();
}
void SetupFeedbacks()
{
Device.TextReceived += new EventHandler<GenericCommMethodReceiveTextArgs>(Device_TextReceived);
if(Device is ISocketStatus)
(Device as ISocketStatus).ConnectionChange += new EventHandler<GenericSocketStatusChageEventArgs>(IBasicCommunicationApi_ConnectionChange);
}
void IBasicCommunicationApi_ConnectionChange(object sender, GenericSocketStatusChageEventArgs e)
{
FeedbackApi["isconnected"].FireUpdate();
}
void Device_TextReceived(object sender, GenericCommMethodReceiveTextArgs e)
{
TextReceivedFeedback.FireUpdate(e.Text);
}
}
public class DmChassisController : Device
{
public DmChassisController(string key)
: base(key)
{
}
public void SetInput(int input)
{
Debug.Console(2, this, "Dm Chassis {0}, input {1}", Key, input);
}
}
/// <summary>
/// Each flavor of API is a static class with static properties and a static constructor that
/// links up the things to do.
/// </summary>
public class DmChassisControllerApi : DeviceApiBase
{
IntFeedback Output1Feedback;
IntFeedback Output2Feedback;
public DmChassisControllerApi(DmChassisController dev)
{
Output1Feedback = new IntFeedback( new Func<int>(() => 1));
Output2Feedback = new IntFeedback( new Func<int>(() => 2));
ActionApi = new Dictionary<string, Object>
{
};
FeedbackApi = new Dictionary<string, Feedback>
{
{ "Output-1/fb", Output1Feedback },
{ "Output-2/fb", Output2Feedback }
};
}
/// <summary>
/// Factory method
/// </summary>
/// <param name="dev"></param>
/// <returns></returns>
public static DmChassisControllerApi GetActionApiForDevice(DmChassisController dev)
{
return new DmChassisControllerApi(dev);
}
}
}

View File

@@ -0,0 +1,184 @@
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;
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(0, "Name {0}, Key {1}, Type {2}, Properties {3}", name, key, type, properties.ToString());
if (typeName == "dm")
{
return new DmBridge(key, name, properties);
}
else if (typeName == "comm")
{
return new CommBridge(key, name, properties);
}
else
return null;
}
}
public class DmBridge : Device
{
public EiscBridgeProperties Properties { get; private set; }
public PepperDash.Essentials.DM.DmChassisController DmSwitch { get; private set; }
public DmBridge(string key, string name, JToken properties) : base(key, name)
{
Properties = JsonConvert.DeserializeObject<EiscBridgeProperties>(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);
ApiEisc.Eisc.SetUShortSigAction(101, u => DmSwitch.ExecuteSwitch(u,1, eRoutingSignalType.Video));
ApiEisc.Eisc.SetUShortSigAction(102, u => DmSwitch.ExecuteSwitch(u,2, eRoutingSignalType.Video));
}
}
foreach (var device in DeviceManager.AllDevices)
{
if (device.Key == this.Properties.ParentDeviceKey)
{
Debug.Console(0, "deviceKey {0} Matches", device.Key);
DmSwitch = DeviceManager.GetDeviceForKey(device.Key) as PepperDash.Essentials.DM.DmChassisController;
}
else
{
Debug.Console(0, "deviceKey {0} doesn't match", device.Key);
}
}
Debug.Console(0, "Bridge {0} Activated", this.Name);
return true;
}
}
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);
}
}
}

View File

@@ -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();
// }
//}
}

View 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;
}
}
}
}

View 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; }
}
}

View File

@@ -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 = "";
}
}
}

View File

@@ -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;
// }
// }
//}

View File

@@ -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;
// }
// }
//}

View File

@@ -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;
// }
// }
//}

View File

@@ -0,0 +1,91 @@
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);
}
}
catch (Exception e)
{
FactoryHelper.HandleDeviceCreationError(devToken, e);
}
return dev;
}
}
}

View File

@@ -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; }
}
}

View File

@@ -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;
// }
// }
//}

View File

@@ -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;
// }
// }
//}

View File

@@ -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;
// }
// }
//}

View File

@@ -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;
// // }
// //}
//}

View File

@@ -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;
// }
// }
//}

View File

@@ -0,0 +1,380 @@
using System;
using System.Linq;
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.CrestronThread;
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()
{
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 =>
{
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);
}
}
/// <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();
}
/// <summary>
/// Reads all devices from config and adds them to DeviceManager
/// </summary>
public void LoadDevices()
{
// Build the processor wrapper class
DeviceManager.AddDevice(new PepperDash.Essentials.Core.Devices.CrestronProcessor("processor"));
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 factory first
var newDev = DeviceFactory.GetDevice(devConf);
// Then associated library factories
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)
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");
}
}
}
}

View File

@@ -0,0 +1,367 @@
using System;
using System.Linq;
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.CrestronThread;
using PepperDash.Core;
using PepperDash.Core.PortalSync;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Devices.Common;
using PepperDash.Essentials.DM;
using PepperDash.Essentials.Fusion;
using PepperDash.Essentials.Room.Cotija;
namespace PepperDash.Essentials
{
public class ControlSystem : CrestronControlSystem
{
PepperDashPortalSyncClient PortalSync;
HttpLogoServer LogoServer;
public ControlSystem()
: base()
{
Thread.MaxNumberOfUserThreads = 400;
Global.ControlSystem = this;
DeviceManager.Initialize(this);
}
/// <summary>
/// Git 'er goin'
/// </summary>
public override void InitializeSystem()
{
<<<<<<< HEAD
DeterminePlatform();
//CrestronConsole.AddNewConsoleCommand(s => GoWithLoad(), "go", "Loads configuration file",
// ConsoleAccessLevelEnum.AccessOperator);
=======
CrestronConsole.AddNewConsoleCommand(s => GoWithLoad(), "go", "Loads configuration file",
ConsoleAccessLevelEnum.AccessOperator);
>>>>>>> 600b9f11ff1bbc186f7c2a2945955731b3523b3c
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();
#warning ^ For use with beta Include4.dat for XiO Edge
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 XiO Edge 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);
}
}
/// <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");
PortalSync = new PepperDashPortalSyncClient();
}
}
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();
}
/// <summary>
/// Reads all devices from config and adds them to DeviceManager
/// </summary>
public void LoadDevices()
{
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")
continue;
// Try local factory first
var newDev = DeviceFactory.GetDevice(devConf);
// Then associated library factories
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)
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 = roomConfig.GetRoomObject();
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));
}
else
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Room is NOT EssentialsHuddleSpaceRoom, 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 bridge. System controller not present");
}
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.FilePathPrefix + "html" + Global.DirectorySeparator + "logo");
}
catch (Exception)
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "NOTICE: Logo server cannot be started. Likely already running in another program");
}
}
}
}

View 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
}
}

View 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();
// }
//}
}

View 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
// }
//}

View File

@@ -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)
// {
// }
// }
//}

View File

@@ -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);
// }
// }
//}

View File

@@ -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
// };
// }
// }
//}

View File

@@ -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);
// }
// }
// }
//}

View File

@@ -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
// }
// }
//}

View 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);
// }
//}

View File

@@ -0,0 +1,318 @@
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using Crestron.SimplSharp;
//using Crestron.SimplSharpPro;
//using Crestron.SimplSharpPro.DeviceSupport;
//namespace PepperDash.Essentials.Core
//{
// public abstract class SmartGraphicsTouchpanelControllerBase : CrestronGenericBaseDevice
// {
// public BasicTriListWithSmartObject TriList { get; protected set; }
// public bool UsesSplashPage { get; set; }
// public string SplashMessage { get; set; }
// public bool ShowDate
// {
// set { TriList.BooleanInput[UiCue.ShowDate.Number].BoolValue = value; }
// }
// public bool ShowTime
// {
// set { TriList.BooleanInput[UiCue.ShowTime.Number].BoolValue = value; }
// }
// //public abstract List<CueActionPair> FunctionList { get; }
// protected eMainModeType MainMode;
// protected SourceListItem CurrentPresentationControlDevice;
// /// <summary>
// /// Defines the signal offset for the presentation device. Defaults to 100
// /// </summary>
// public uint PresentationControlDeviceJoinOffset { get { return 100; } }
// public enum eMainModeType
// {
// Presentation, Splash, Tech
// }
// protected string SgdFilePath;
// public EssentialsRoom CurrentRoom { get; protected set; }
// protected Dictionary<SourceListItem, DevicePageControllerBase> LoadedPageControllers
// = new Dictionary<SourceListItem, DevicePageControllerBase>();
// static object RoomChangeLock = new object();
// /// <summary>
// /// Constructor
// /// </summary>
// public SmartGraphicsTouchpanelControllerBase(string key, string name, BasicTriListWithSmartObject triList,
// string sgdFilePath)
// : base(key, name, triList)
// {
// TriList = triList;
// if (string.IsNullOrEmpty(key)) throw new ArgumentNullException("key");
// if (string.IsNullOrEmpty(sgdFilePath)) throw new ArgumentNullException("sgdFilePath");
// SgdFilePath = sgdFilePath;
// TriList.LoadSmartObjects(SgdFilePath);
// UsesSplashPage = true;
// SplashMessage = "Welcome";
// TriList.SigChange += Tsw_AnySigChange;
// foreach (var kvp in TriList.SmartObjects)
// kvp.Value.SigChange += this.Tsw_AnySigChange;
// }
//#warning wire UI manipulating presses up here, typically in child classes...
// //public override bool CustomActivate()
// //{
// // var baseSuccess = base.CustomActivate();
// // if (!baseSuccess) return false;
// // // Wiring up the buttons with UOs
// // foreach (var uo in this.FunctionList)
// // {
// // if (uo.Cue.Number == 0) continue;
// // //if (uo is BoolCueActionPair)
// // // TriList.BooleanOutput[uo.Cue.Number].UserObject = uo;
// // //else if (uo is UShortCueActionPair)
// // // TriList.UShortOutput[uo.Cue.Number].UserObject = uo;
// // //else if (uo is StringCueActionPair)
// // // TriList.StringOutput[uo.Cue.Number].UserObject = uo;
// // }
// // return true;
// //}
// //public void SetCurrentRoom(EssentialsRoom room)
// //{
// // if (CurrentRoom != null)
// // HideRoomUI();
// // CurrentRoom = room;
// // ShowRoomUI();
// //}
// /// <summary>
// ///
// /// </summary>
// /// <param name="room"></param>
// public void SetCurrentRoom(EssentialsRoom room)
// {
// if (CurrentRoom == room) return;
// IBasicVolumeControls oldAudio = null;
// //Disconnect current room and audio device
// if (CurrentRoom != null)
// {
// HideRoomUI();
// CurrentRoom.AudioDeviceWillChange -= CurrentRoom_AudioDeviceWillChange;
// CurrentRoom.PresentationSourceChange -= CurrentRoom_PresentationSourceChange;
// oldAudio = CurrentRoom.CurrentAudioDevice;
// }
// CurrentRoom = room;
// IBasicVolumeControls newAudio = null;
// if (CurrentRoom != null)
// {
// CurrentRoom.AudioDeviceWillChange += this.CurrentRoom_AudioDeviceWillChange;
// CurrentRoom.PresentationSourceChange += this.CurrentRoom_PresentationSourceChange;
// SetControlSource(CurrentRoom.CurrentPresentationSourceInfo);
// newAudio = CurrentRoom.CurrentAudioDevice;
// ShowRoomUI();
// }
// SwapAudioDeviceControls(oldAudio, newAudio);
// }
// /// <summary>
// /// Detaches and attaches an IVolumeFunctions device to the appropriate TP TriList signals.
// /// This will also add IVolumeNumeric if the device implements it.
// /// Overriding classes should call this. Overriding classes are responsible for
// /// linking up to hard keys, etc.
// /// </summary>
// /// <param name="oldDev">May be null</param>
// /// <param name="newDev">May be null</param>
// protected virtual void SwapAudioDeviceControls(IBasicVolumeControls oldDev, IBasicVolumeControls newDev)
// {
// // Disconnect
// if (oldDev != null)
// {
// TriList.BooleanOutput[CommonBoolCue.VolumeDown.Number].UserObject = null;
// TriList.BooleanOutput[CommonBoolCue.VolumeUp.Number].UserObject = null;
// TriList.BooleanOutput[CommonBoolCue.MuteToggle.Number].UserObject = null;
// TriList.BooleanInput[CommonBoolCue.ShowVolumeButtons.Number].BoolValue = false;
// TriList.BooleanInput[CommonBoolCue.ShowVolumeSlider.Number].BoolValue = false;
// if (oldDev is IBasicVolumeWithFeedback)
// {
// var fbDev = oldDev as IBasicVolumeWithFeedback;
// TriList.UShortOutput[401].UserObject = null;
// fbDev.MuteFeedback.UnlinkInputSig(TriList.BooleanInput[403]);
// fbDev.VolumeLevelFeedback.UnlinkInputSig(TriList.UShortInput[401]);
// }
// }
// if (newDev != null)
// {
// TriList.BooleanInput[CommonBoolCue.ShowVolumeSlider.Number].BoolValue = true;
// TriList.SetBoolSigAction(401, newDev.VolumeUp);
// TriList.SetBoolSigAction(402, newDev.VolumeDown);
// TriList.SetSigFalseAction(405, newDev.MuteToggle);
// if (newDev is IBasicVolumeWithFeedback) // Show slider
// {
// var fbDev = newDev as IBasicVolumeWithFeedback;
// TriList.BooleanInput[406].BoolValue = false;
// TriList.BooleanInput[407].BoolValue = true;
// TriList.UShortOutput[401].UserObject = new Action<ushort>(fbDev.SetVolume);
// fbDev.VolumeLevelFeedback.LinkInputSig(TriList.UShortInput[401]);
// }
// else // Show buttons only
// {
// TriList.BooleanInput[406].BoolValue = true;
// TriList.BooleanInput[407].BoolValue = false;
// }
// }
// }
// /// <summary>
// /// Does nothing. Override to add functionality when calling SetCurrentRoom
// /// </summary>
// protected virtual void HideRoomUI() { }
// /// <summary>
// /// Does nothing. Override to add functionality when calling SetCurrentRoom
// /// </summary>
// protected virtual void ShowRoomUI() { }
// /// <summary>
// /// Sets up the current presentation device and updates statuses if the device is capable.
// /// </summary>
// protected void SetControlSource(SourceListItem newSource)
// {
// if (CurrentPresentationControlDevice != null)
// {
// HideCurrentPresentationSourceUi();
//#warning Get button methods from RESI, and find a more-well-defined way to wire up feedbacks
// // Unhook presses and things
// //if (CurrentPresentationControlDevice is IHasCueActionList)
// //{
// // foreach (var uo in (CurrentPresentationControlDevice as IHasCueActionList).CueActionList)
// // {
// // if (uo.Cue.Number == 0) continue;
// // if (uo is BoolCueActionPair)
// // {
// // var bSig = TriList.BooleanOutput[uo.Cue.Number];
// // // Disconnection should also clear bool sigs in case they are pressed and
// // // might be orphaned
// // if (bSig.BoolValue)
// // (bSig.UserObject as BoolCueActionPair).Invoke(false);
// // bSig.UserObject = null;
// // }
// // else if (uo is UShortCueActionPair)
// // TriList.UShortOutput[uo.Cue.Number].UserObject = null;
// // else if (uo is StringCueActionPair)
// // TriList.StringOutput[uo.Cue.Number].UserObject = null;
// // }
// //}
// // unhook outputs
// if (CurrentPresentationControlDevice is IHasFeedback)
// {
// foreach (var fb in (CurrentPresentationControlDevice as IHasFeedback).Feedbacks)
// {
// if (fb.Cue.Number == 0) continue;
// if (fb is BoolFeedback)
// (fb as BoolFeedback).UnlinkInputSig(TriList.BooleanInput[fb.Cue.Number]);
// else if (fb is IntFeedback)
// (fb as IntFeedback).UnlinkInputSig(TriList.UShortInput[fb.Cue.Number]);
// else if (fb is StringFeedback)
// (fb as StringFeedback).UnlinkInputSig(TriList.StringInput[fb.Cue.Number]);
// }
// }
// }
// CurrentPresentationControlDevice = newSource;
// //connect presses and things
// //if (newSource is IHasCueActionList) // This has functions, get 'em
// //{
// // foreach (var ao in (newSource as IHasCueActionList).CueActionList)
// // {
// // if (ao.Cue.Number == 0) continue;
// // if (ao is BoolCueActionPair)
// // TriList.BooleanOutput[ao.Cue.Number].UserObject = ao;
// // else if (ao is UShortCueActionPair)
// // TriList.UShortOutput[ao.Cue.Number].UserObject = ao;
// // else if (ao is StringCueActionPair)
// // TriList.StringOutput[ao.Cue.Number].UserObject = ao;
// // }
// //}
// // connect outputs (addInputSig should update sig)
// if (CurrentPresentationControlDevice is IHasFeedback)
// {
// foreach (var fb in (CurrentPresentationControlDevice as IHasFeedback).Feedbacks)
// {
// if (fb.Cue.Number == 0) continue;
// if (fb is BoolFeedback)
// (fb as BoolFeedback).LinkInputSig(TriList.BooleanInput[fb.Cue.Number]);
// else if (fb is IntFeedback)
// (fb as IntFeedback).LinkInputSig(TriList.UShortInput[fb.Cue.Number]);
// else if (fb is StringFeedback)
// (fb as StringFeedback).LinkInputSig(TriList.StringInput[fb.Cue.Number]);
// }
// }
// ShowCurrentPresentationSourceUi();
// }
// /// <summary>
// /// Reveals the basic UI for the current device
// /// </summary>
// protected virtual void ShowCurrentPresentationSourceUi()
// {
// }
// /// <summary>
// /// Hides the UI for the current device and calls for a feedback signal cleanup
// /// </summary>
// protected virtual void HideCurrentPresentationSourceUi()
// {
// }
// /// <summary>
// ///
// /// </summary>
// void CurrentRoom_PresentationSourceChange(object sender, EssentialsRoomSourceChangeEventArgs args)
// {
// SetControlSource(args.NewSource);
// }
// /// <summary>
// ///
// /// </summary>
// void CurrentRoom_AudioDeviceWillChange(object sender, EssentialsRoomAudioDeviceChangeEventArgs e)
// {
// SwapAudioDeviceControls(e.OldDevice, e.NewDevice);
// }
// /// <summary>
// /// Panel event handler
// /// </summary>
// void Tsw_AnySigChange(object currentDevice, SigEventArgs args)
// {
// // plugged in commands
// object 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);
// }
// }
//}

View File

@@ -1,7 +1,4 @@

//using System;
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
@@ -11,9 +8,9 @@
//using Crestron.SimplSharpPro.UI;
//using PepperDash.Core;
//using PepperDash.Essentials.Core;
//namespace PepperDash.Essentials.Core
//namespace PepperDash.Essentials
//{
// //*****************************************************************************
@@ -36,7 +33,7 @@
// SourceSelectCallback = sourceSelectCallback;
// }
// void SetSourceList(Dictionary<uint, IPresentationSource> dict)
// void SetSourceList(Dictionary<uint, SourceListItem> dict)
// {
// // Iterate all positions, including ones missing from the dict.
// var max = dict.Keys.Max();
@@ -83,7 +80,7 @@
// // Handler to route source changes into list feedback
// void CurrentRoom_PresentationSourceChange(object sender, EssentialsRoomSourceChangeEventArgs args)
// {
// Debug.LogMessage(LogEventLevel.Verbose, "SRL received source change");
// Debug.Console(2, "SRL received source change");
// ClearPresentationSourceFb(args.OldSource);
// SetPresentationSourceFb(args.NewSource);
// }
@@ -97,7 +94,7 @@
// oldSourceItem.ClearFeedback();
// }
// void SetPresentationSourceFb(IPresentationSource source)
// void SetPresentationSourceFb(SourceListItem source)
// {
// if (source == null) return;
// // Now set the new source to light up
@@ -117,38 +114,38 @@
// public const uint ButtonTextJoin = 1;
// public const uint IconNameJoin = 2;
// public SourceListSubpageReferenceListItem(uint index,
// IPresentationSource srcDevice, SubpageReferenceList owner, Action<uint> sourceSelectCallback)
// public SourceListSubpageReferenceListItem(uint index, SourceListItem srcDeviceItem,
// SubpageReferenceList owner, Action<uint> sourceSelectCallback)
// : base(index, owner)
// {
// if (srcDevice == null) throw new ArgumentNullException("srcDevice");
// if (srcDeviceItem == null) throw new ArgumentNullException("srcDeviceItem");
// if (owner == null) throw new ArgumentNullException("owner");
// if (sourceSelectCallback == null) throw new ArgumentNullException("sourceSelectCallback");
// SourceDevice = srcDevice;
// SourceDevice = srcDeviceItem;
// var nameSig = owner.StringInputSig(index, ButtonTextJoin);
// // Should be able to see if there is not enough buttons right here
// if (nameSig == null)
// {
// Debug.LogMessage(LogEventLevel.Information, "ERROR: Item {0} does not exist on source list SRL", index);
// Debug.Console(0, "ERROR: Item {0} does not exist on source list SRL", index);
// return;
// }
// nameSig.StringValue = srcDevice.Name;
// owner.StringInputSig(index, IconNameJoin).StringValue = srcDevice.IconName;
// nameSig.StringValue = srcDeviceItem.Name;
// owner.StringInputSig(index, IconNameJoin).StringValue = srcDeviceItem.Icon;
// // Assign a source selection action to the appropriate button's UserObject - on release
// owner.GetBoolFeedbackSig(index, ButtonPressJoin).UserObject = new Action<bool>(b =>
// { if (!b) sourceSelectCallback(index); });
// // hook up the video icon
// var videoDev = srcDevice as IAttachVideoStatus;
// var videoDev = srcDeviceItem as IAttachVideoStatus;
// if (videoDev != null)
// {
// var status = videoDev.GetVideoStatuses();
// if (status != null)
// {
// Debug.LogMessage(LogEventLevel.Debug, "Linking {0} video status to SRL", videoDev.Key);
// Debug.Console(1, "Linking {0} video status to SRL", videoDev.Key);
// videoDev.GetVideoStatuses().VideoSyncFeedback.LinkInputSig(owner.BoolInputSig(index, 3));
// }
// }

View File

@@ -0,0 +1,99 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Crestron.SimplSharpPro;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials
{
public class DeviceFactory
{
public static IKeyed GetDevice(DeviceConfig dc)
{
var key = dc.Key;
var name = dc.Name;
var type = dc.Type;
var properties = dc.Properties;
var typeName = dc.Type.ToLower();
if (typeName == "amplifier")
{
return new Amplifier(dc.Key, dc.Name);
}
else if (dc.Group.ToLower() == "touchpanel") // typeName.StartsWith("tsw"))
{
return UiDeviceFactory.GetUiDevice(dc);
}
else if (typeName == "mockdisplay")
{
return new MockDisplay(key, name);
}
else if (typeName == "generic")
{
return new Device(key, name);
}
// MOVE into something else???
else if (typeName == "basicirdisplay")
{
var ir = IRPortHelper.GetIrPort(properties);
if (ir != null)
return new BasicIrDisplay(key, name, ir.Port, ir.FileName);
}
else if (typeName == "commmock")
{
var comm = CommFactory.CreateCommForDevice(dc);
var props = JsonConvert.DeserializeObject<ConsoleCommMockDevicePropertiesConfig>(
properties.ToString());
return new ConsoleCommMockDevice(key, name, props, comm);
}
else if (typeName == "appserver")
{
var props = JsonConvert.DeserializeObject<CotijaConfig>(properties.ToString());
return new CotijaSystemController(key, name, props);
}
else if (typeName == "mobilecontrolbridge-ddvc01")
{
var comm = CommFactory.GetControlPropertiesConfig(dc);
var bridge = new PepperDash.Essentials.Room.Cotija.CotijaDdvc01RoomBridge(key, name, comm.IpIdInt);
bridge.AddPreActivationAction(() =>
{
var parent = DeviceManager.AllDevices.FirstOrDefault(d => d.Key == "appServer") as CotijaSystemController;
if (parent == null)
{
Debug.Console(0, bridge, "ERROR: Cannot connect bridge. System controller not present");
}
Debug.Console(0, bridge, "Linking to parent controller");
bridge.AddParent(parent);
parent.AddBridge(bridge);
});
return bridge;
}
else if (typeName == "roomonwhenoccupancydetectedfeature")
{
var props = JsonConvert.DeserializeObject<Room.Behaviours.RoomOnToDefaultSourceWhenOccupiedConfig>(properties.ToString());
return new Room.Behaviours.RoomOnToDefaultSourceWhenOccupied(key, props);
}
return null;
}
}
}

View File

@@ -0,0 +1,162 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.UI;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.PageManagers;
namespace PepperDash.Essentials
{
public class UiDeviceFactory
{
public static IKeyed GetUiDevice(DeviceConfig config)
{
var comm = CommFactory.GetControlPropertiesConfig(config);
var props = JsonConvert.DeserializeObject<CrestronTouchpanelPropertiesConfig>(config.Properties.ToString());
EssentialsTouchpanelController panelController = new EssentialsTouchpanelController(config.Key, config.Name, config.Type, props, comm.IpIdInt);
panelController.AddPostActivationAction(() =>
{
var mainDriver = new EssentialsPanelMainInterfaceDriver(panelController.Panel, props);
// Then the sub drivers
// spin up different room drivers depending on room type
var room = DeviceManager.GetDeviceForKey(props.DefaultRoomKey);
if (room is EssentialsHuddleSpaceRoom)
{
// Header Driver
Debug.Console(0, panelController, "Adding header driver");
mainDriver.HeaderDriver = new EssentialsHeaderDriver(mainDriver, props);
// AV Driver
Debug.Console(0, panelController, "Adding huddle space AV driver");
var avDriver = new EssentialsHuddlePanelAvFunctionsDriver(mainDriver, props);
avDriver.DefaultRoomKey = props.DefaultRoomKey;
mainDriver.AvDriver = avDriver;
avDriver.CurrentRoom = room as EssentialsHuddleSpaceRoom;
// Environment Driver
if (avDriver.CurrentRoom.Config.Environment != null && avDriver.CurrentRoom.Config.Environment.DeviceKeys.Count > 0)
{
Debug.Console(0, panelController, "Adding environment driver");
mainDriver.EnvironmentDriver = new EssentialsEnvironmentDriver(mainDriver, props);
mainDriver.EnvironmentDriver.GetDevicesFromConfig(avDriver.CurrentRoom.Config.Environment);
}
mainDriver.HeaderDriver.SetupHeaderButtons(avDriver, avDriver.CurrentRoom);
panelController.LoadAndShowDriver(mainDriver); // This is a little convoluted.
if (panelController.Panel is TswFt5ButtonSystem)
{
var tsw = panelController.Panel as TswFt5ButtonSystem;
// Wire up hard keys
tsw.Power.UserObject = new Action<bool>(b => { if (!b) avDriver.PowerButtonPressed(); });
//tsw.Home.UserObject = new Action<bool>(b => { if (!b) HomePressed(); });
if(mainDriver.EnvironmentDriver != null)
tsw.Lights.UserObject = new Action<bool>(b =>
{
if (!b)
{
//mainDriver.AvDriver.PopupInterlock.ShowInterlockedWithToggle(mainDriver.EnvironmentDriver.BackgroundSubpageJoin);
mainDriver.EnvironmentDriver.Toggle();
}
});
tsw.Up.UserObject = new Action<bool>(avDriver.VolumeUpPress);
tsw.Down.UserObject = new Action<bool>(avDriver.VolumeDownPress);
}
}
//else if (room is EssentialsPresentationRoom)
//{
// Debug.Console(0, panelController, "Adding presentation room driver");
// var avDriver = new EssentialsPresentationPanelAvFunctionsDriver(mainDriver, props);
// avDriver.CurrentRoom = room as EssentialsPresentationRoom;
// avDriver.DefaultRoomKey = props.DefaultRoomKey;
// mainDriver.AvDriver = avDriver ;
// mainDriver.HeaderDriver = new EssentialsHeaderDriver(mainDriver, props);
// panelController.LoadAndShowDriver(mainDriver);
// if (panelController.Panel is TswFt5ButtonSystem)
// {
// var tsw = panelController.Panel as TswFt5ButtonSystem;
// // Wire up hard keys
// tsw.Power.UserObject = new Action<bool>(b => { if (!b) avDriver.PowerButtonPressed(); });
// //tsw.Home.UserObject = new Action<bool>(b => { if (!b) HomePressed(); });
// tsw.Up.UserObject = new Action<bool>(avDriver.VolumeUpPress);
// tsw.Down.UserObject = new Action<bool>(avDriver.VolumeDownPress);
// }
//}
else if (room is EssentialsHuddleVtc1Room)
{
Debug.Console(0, panelController, "Adding huddle space VTC AV driver");
// Header Driver
mainDriver.HeaderDriver = new EssentialsHeaderDriver(mainDriver, props);
// AV Driver
var avDriver = new EssentialsHuddleVtc1PanelAvFunctionsDriver(mainDriver, props);
var codecDriver = new PepperDash.Essentials.UIDrivers.VC.EssentialsVideoCodecUiDriver(panelController.Panel, avDriver,
(room as EssentialsHuddleVtc1Room).VideoCodec, mainDriver.HeaderDriver);
avDriver.SetVideoCodecDriver(codecDriver);
avDriver.DefaultRoomKey = props.DefaultRoomKey;
mainDriver.AvDriver = avDriver;
avDriver.CurrentRoom = room as EssentialsHuddleVtc1Room;
// Environment Driver
if (avDriver.CurrentRoom.Config.Environment != null && avDriver.CurrentRoom.Config.Environment.DeviceKeys.Count > 0)
{
Debug.Console(0, panelController, "Adding environment driver");
mainDriver.EnvironmentDriver = new EssentialsEnvironmentDriver(mainDriver, props);
mainDriver.EnvironmentDriver.GetDevicesFromConfig(avDriver.CurrentRoom.Config.Environment);
}
mainDriver.HeaderDriver.SetupHeaderButtons(avDriver, avDriver.CurrentRoom);
panelController.LoadAndShowDriver(mainDriver); // This is a little convoluted.
if (panelController.Panel is TswFt5ButtonSystem)
{
var tsw = panelController.Panel as TswFt5ButtonSystem;
// Wire up hard keys
tsw.Power.UserObject = new Action<bool>(b => { if (!b) avDriver.EndMeetingPress(); });
//tsw.Home.UserObject = new Action<bool>(b => { if (!b) HomePressed(); });
if (mainDriver.EnvironmentDriver != null)
tsw.Lights.UserObject = new Action<bool>(b =>
{
if (!b)
{
//mainDriver.AvDriver.PopupInterlock.ShowInterlockedWithToggle(mainDriver.EnvironmentDriver.BackgroundSubpageJoin);
mainDriver.EnvironmentDriver.Toggle();
}
});
tsw.Up.UserObject = new Action<bool>(avDriver.VolumeUpPress);
tsw.Down.UserObject = new Action<bool>(avDriver.VolumeDownPress);
}
}
else
{
Debug.Console(0, panelController, "ERROR: Cannot load AvFunctionsDriver for room '{0}'", props.DefaultRoomKey);
}
});
return panelController;
}
}
}

View File

@@ -0,0 +1,266 @@
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using Crestron.SimplSharp;
//using Crestron.SimplSharp.CrestronIO;
//using Crestron.SimplSharp.Net.Http;
//using Newtonsoft.Json;
//using Newtonsoft.Json.Linq;
//using PepperDash.Essentials.Core;
//using PepperDash.Essentials.Core.Http;
//using PepperDash.Core;
//namespace PepperDash.Essentials
//{
// public class EssentialsHttpApiHandler
// {
// string ConfigPath;
// string PresetsPathPrefix;
// EssentialsHttpServer Server;
// /// <summary>
// ///
// /// </summary>
// /// <param name="server">HTTP server to attach to</param>
// /// <param name="configPath">The full path to configuration file</param>
// /// <param name="presetsListPath">The folder prefix for the presets path, eq "\HTML\presets\"</param>
// public EssentialsHttpApiHandler(EssentialsHttpServer server, string configPath, string presetsPathPrefix)
// {
// if (server == null) throw new ArgumentNullException("server");
// Server = server;
// ConfigPath = configPath;
// PresetsPathPrefix = presetsPathPrefix;
// server.ApiRequest += Server_ApiRequest;
// }
// void Server_ApiRequest(object sender, Crestron.SimplSharp.Net.Http.OnHttpRequestArgs args)
// {
// try
// {
// var path = args.Request.Path.ToLower();
// if (path == "/api/config")
// HandleApiConfig(args);
// else if (path.StartsWith("/api/presetslist/"))
// HandleApiPresetsList(args);
// else if (path == "/api/presetslists")
// HandleApiGetPresetsLists(args.Request, args.Response);
// else
// {
// args.Response.Code = 404;
// return;
// }
// args.Response.Header.SetHeaderValue("Access-Control-Allow-Origin", "*");
// args.Response.Header.SetHeaderValue("Access-Control-Allow-Methods", "GET, POST, PATCH, PUT, DELETE, OPTIONS");
// }
// catch (Exception e)
// {
// Debug.Console(1, "Uncaught HTTP server error: \n{0}", e);
// args.Response.Code = 500;
// }
// }
// /// <summary>
// /// GET will return the running configuration. POST will attempt to take in a new config
// /// and restart the program.
// /// </summary>
// void HandleApiConfig(OnHttpRequestArgs args)
// {
// var request = args.Request;
// if (request.Header.RequestType == "GET")
// {
// if (File.Exists(ConfigPath))
// {
// Debug.Console(2, "Sending config:{0}", ConfigPath);
// args.Response.Header.ContentType = EssentialsHttpServer.GetContentType(new FileInfo(ConfigPath).Extension);
// args.Response.ContentStream = new FileStream(ConfigPath, FileMode.Open, FileAccess.Read);
// }
// }
// else if (request.Header.RequestType == "POST")
// {
// Debug.Console(2, "Post type: '{0}'", request.Header.ContentType);
// // Make sure we're receiving at least good json
// Debug.Console(1, "Receving new config");
// if (GetContentStringJson(args) == null)
// return;
// //---------------------------- try to move these into common method
// // Move current file aside
// var bakPath = ConfigPath + ".bak";
// if (File.Exists(bakPath))
// File.Delete(bakPath);
// File.Move(ConfigPath, bakPath);
// // Write the file
// using (FileStream fs = File.Open(ConfigPath, FileMode.OpenOrCreate))
// using (StreamWriter sw = new StreamWriter(fs))
// {
// try
// {
// sw.Write(args.Request.ContentString);
// }
// catch (Exception e)
// {
// string err = string.Format("Error writing received config file:\r{0}", e);
// CrestronConsole.PrintLine(err);
// ErrorLog.Warn(err);
// // Put file back
// File.Move(ConfigPath + ".bak", ConfigPath);
// args.Response.Code = 500;
// return;
// }
// }
// // If client says "yeah, restart" and has a good token
// // Restart program
// string consoleResponse = null;
// var restart = CrestronConsole.SendControlSystemCommand("progreset -p:" +
// InitialParametersClass.ApplicationNumber, ref consoleResponse);
// if (!restart) Debug.Console(0, "CAN'T DO THAT YO: {0}", consoleResponse);
// }
// }
// void HandleApiPresetsList(OnHttpRequestArgs args)
// {
// var listPath = PresetsPathPrefix + args.Request.Path.Remove(0, 17);
// Debug.Console(2, "Checking for preset list '{0}'", listPath);
// if (args.Request.Header.RequestType == "GET")
// {
// if (File.Exists(listPath))
// {
// Debug.Console(2, "Sending presets file:{0}", listPath);
// args.Response.Header.ContentType = EssentialsHttpServer.GetContentType(new FileInfo(listPath).Extension);
// args.Response.ContentStream = new FileStream(listPath, FileMode.Open, FileAccess.Read);
// }
// }
// else if (args.Request.Header.RequestType == "POST")
// {
// // Make sure we're receiving at least good json
// Debug.Console(1, "Receving new presets");
// if (GetContentStringJson(args) == null)
// return;
// //---------------------------- try to move these into common method
// // Move current file aside
// var bakPath = listPath + ".new";
// Debug.Console(2, "Moving presets file to {0}", bakPath);
// if(File.Exists(bakPath))
// File.Delete(bakPath);
// File.Move(listPath, bakPath);
// Debug.Console(2, "Writing new file");
// // Write the file
// using (FileStream fs = File.OpenWrite(listPath))
// using (StreamWriter sw = new StreamWriter(fs))
// {
// try
// {
// Debug.Console(2, "Writing {1}, {0} bytes", args.Request.ContentString.Length, listPath);
// sw.Write(args.Request.ContentString);
// }
// catch (Exception e)
// {
// string err = string.Format("Error writing received presets file:\r{0}", e);
// CrestronConsole.PrintLine(err);
// ErrorLog.Warn(err);
// // Put file back
// File.Move(listPath + ".bak", listPath);
// args.Response.Code = 500;
// return;
// }
// }
// }
// }
// void HandleApiGetPresetsLists(HttpServerRequest request, HttpServerResponse response)
// {
// if (request.Header.RequestType != "GET")
// {
// response.Code = 404; // This should be a 405 with an allow header
// return;
// }
// if (Directory.Exists(PresetsPathPrefix))
// {
// //CrestronConsole.PrintLine("Parsing presets directory");
// List<string> files = Directory.GetFiles(PresetsPathPrefix, "*.json")
// .ToList().Select(f => Path.GetFileName(f)).ToList();
// if (files.Count > 0)
// files.Sort();
// var json = JsonConvert.SerializeObject(files);
// response.Header.ContentType = "application/json";
// response.ContentString = json;
// }
// // //CrestronConsole.PrintLine("Found {0} files", files.Count);
// // JObject jo = new JObject();
// // JArray ja = new JArray();
// // foreach (var filename in files)
// // {
// // try
// // {
// // using (StreamReader sr = new StreamReader(filename))
// // {
// // JObject tempJo = JObject.Parse(sr.ReadToEnd());
// // if (tempJo.Value<string>("content").Equals("presetsList"))
// // {
// // var jItem = new JObject(); // make a new object
// // jItem.Add("Name", tempJo["name"]);
// // jItem.Add("File", filename);
// // jItem.Add("Url", Uri.EscapeUriString(new Uri(
// // filename.Replace("\\html", "")
// // .Replace("\\HTML", "")
// // .Replace('\\', '/'), UriKind.Relative).ToString()));
// // ja.Add(jItem); // add to array
// // }
// // else
// // CrestronConsole.PrintLine("Cannot use presets file '{0}'", filename);
// // }
// // }
// // catch
// // {
// // // ignore failures - maybe delete them
// // CrestronConsole.PrintLine("Unable to read presets file '{0}'", filename);
// // }
// // }
// // jo.Add("PresetChannelLists", ja);
// // //CrestronConsole.PrintLine(jo.ToString());
// // response.Header.ContentType = "application/json";
// // response.ContentString = jo.ToString();
// //}
// //else
// // CrestronConsole.PrintLine("No presets files in directory");
// }
// /// <summary>
// /// Simply does what it says
// /// </summary>
// JObject GetContentStringJson(OnHttpRequestArgs args)
// {
// //var content = args.Request.ContentString;
// //Debug.Console(1, "{0}", content);
// try
// {
// // just see if it parses properly
// return JObject.Parse(args.Request.ContentString);
// }
// catch (Exception e)
// {
// string err = string.Format("JSON Error reading config file:\r{0}", e);
// CrestronConsole.PrintLine(err);
// ErrorLog.Warn(err);
// args.Response.Code = 400; // Bad request
// return null;
// }
// }
// }
//}

View File

@@ -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"); }); ;
}
}
}
}

View File

@@ -0,0 +1,102 @@
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.Config;
using PepperDash.Essentials.Room.Behaviours;
namespace PepperDash.Essentials.Fusion
{
/// <summary>
/// Handles mapping Fusion Custom Property values to system properties
/// </summary>
public class FusionCustomPropertiesBridge
{
/// <summary>
/// Evaluates the room info and custom properties from Fusion and updates the system properties aa needed
/// </summary>
/// <param name="roomInfo"></param>
public void EvaluateRoomInfo(string roomKey, RoomInformation roomInfo)
{
var runtimeConfigurableDevices = DeviceManager.AllDevices.Where(d => d is IRuntimeConfigurableDevice);
try
{
foreach (var device in runtimeConfigurableDevices)
{
// Get the current device config so new values can be overwritten over existing
var deviceConfig = (device as IRuntimeConfigurableDevice).GetDeviceConfig();
if (device is RoomOnToDefaultSourceWhenOccupied)
{
var devConfig = (deviceConfig as RoomOnToDefaultSourceWhenOccupiedConfig);
var enableFeature = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("EnRoomOnWhenOccupied"));
if (enableFeature != null)
devConfig.EnableRoomOnWhenOccupied = bool.Parse(enableFeature.CustomFieldValue);
var enableTime = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("RoomOnWhenOccupiedStartTime"));
if (enableTime != null)
devConfig.OccupancyStartTime = enableTime.CustomFieldValue;
var disableTime = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("RoomOnWhenOccupiedEndTime"));
if (disableTime != null)
devConfig.OccupancyEndTime = disableTime.CustomFieldValue;
var enableSunday = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("EnRoomOnWhenOccupiedSun"));
if (enableSunday != null)
devConfig.EnableSunday = bool.Parse(enableSunday.CustomFieldValue);
var enableMonday = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("EnRoomOnWhenOccupiedMon"));
if (enableMonday != null)
devConfig.EnableMonday = bool.Parse(enableMonday.CustomFieldValue);
var enableTuesday = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("EnRoomOnWhenOccupiedTue"));
if (enableTuesday != null)
devConfig.EnableTuesday = bool.Parse(enableTuesday.CustomFieldValue);
var enableWednesday = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("EnRoomOnWhenOccupiedWed"));
if (enableWednesday != null)
devConfig.EnableWednesday = bool.Parse(enableWednesday.CustomFieldValue);
var enableThursday = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("EnRoomOnWhenOccupiedThu"));
if (enableThursday != null)
devConfig.EnableThursday = bool.Parse(enableThursday.CustomFieldValue);
var enableFriday = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("EnRoomOnWhenOccupiedFri"));
if (enableFriday != null)
devConfig.EnableFriday = bool.Parse(enableFriday.CustomFieldValue);
var enableSaturday = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("EnRoomOnWhenOccupiedSat"));
if (enableSaturday != null)
devConfig.EnableSaturday = bool.Parse(enableSaturday.CustomFieldValue);
deviceConfig = devConfig;
}
// Set the config on the device
(device as IRuntimeConfigurableDevice).SetDeviceConfig(deviceConfig);
}
//var roomConfig = ConfigReader.ConfigObject.Rooms.FirstOrDefault(r => r.Key.Equals(roomKey);
//if(roomConfig != null)
//{
// roomConfig.Name = roomInfo.Name;
// // Update HelpMessage in room properties
// roomConfig.Properties.
//}
}
catch (Exception e)
{
Debug.Console(1, "FusionCustomPropetiesBridge: Error mapping properties: {0}", e);
}
}
}
}

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
namespace PepperDash.Essentials.Fusion
{
public class ScheduleChangeEventArgs : EventArgs
{
public RoomSchedule Schedule { get; set; }
}
public class MeetingChangeEventArgs : EventArgs
{
public Event Meeting { get; set; }
}
}

View File

@@ -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,24 +46,18 @@ 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;
}
}
/// <summary>
/// Represents a ProcessorProgramItem
/// Used in ProcessorProgReg
/// </summary>
public class ProcessorProgramItem
{
/// <summary>
/// Gets or sets the Exists
/// </summary>
public bool Exists { get; set; }
/// <summary>
/// Gets or sets the Name
/// </summary>
public string Name { get; set; }
}
}

View File

@@ -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
@@ -54,9 +53,6 @@ namespace PepperDash.Essentials.Core.Fusion
/// </summary>
/// <param name="progSlot"></param>
/// <param name="mac"></param>
/// <summary>
/// GenerateNewRoomGuid method
/// </summary>
public string GenerateNewRoomGuid(uint progSlot, string mac)
{
Guid roomGuid = Guid.NewGuid();
@@ -78,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);
@@ -92,9 +88,6 @@ namespace PepperDash.Essentials.Core.Fusion
/// </summary>
/// <param name="room"></param>
/// <returns></returns>
/// <summary>
/// GetNextAvailableAssetNumber method
/// </summary>
public static uint GetNextAvailableAssetNumber(FusionRoom room)
{
uint slotNum = 0;
@@ -112,35 +105,20 @@ 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;
}
}
/// <summary>
/// Represents a FusionOccupancySensorAsset
/// </summary>
public class FusionOccupancySensorAsset
{
// SlotNumber fixed at 4
/// <summary>
/// Gets or sets the SlotNumber
/// </summary>
public uint SlotNumber { get { return 4; } }
/// <summary>
/// Gets or sets the Name
/// </summary>
public string Name { get { return "Occupancy Sensor"; } }
/// <summary>
/// Gets or sets the Type
/// </summary>
public eAssetType Type { get; set; }
/// <summary>
/// Gets or sets the InstanceId
/// </summary>
public string InstanceId { get; set; }
public FusionOccupancySensorAsset()
@@ -155,26 +133,11 @@ namespace PepperDash.Essentials.Core.Fusion
}
}
/// <summary>
/// Represents a FusionAsset
/// </summary>
public class FusionAsset
{
/// <summary>
/// Gets or sets the SlotNumber
/// </summary>
public uint SlotNumber { get; set; }
/// <summary>
/// Gets or sets the Name
/// </summary>
public string Name { get; set; }
/// <summary>
/// Gets or sets the Type
/// </summary>
public string Type { get; set; }
/// <summary>
/// Gets or sets the InstanceId
/// </summary>
public string InstanceId { get;set; }
public FusionAsset()
@@ -200,14 +163,8 @@ namespace PepperDash.Essentials.Core.Fusion
//***************************************************************************************************
/// <summary>
/// Represents a RoomSchedule
/// </summary>
public class RoomSchedule
{
/// <summary>
/// Gets or sets the Meetings
/// </summary>
public List<Event> Meetings { get; set; }
public RoomSchedule()
@@ -220,7 +177,7 @@ namespace PepperDash.Essentials.Core.Fusion
// Helper Classes for XML API
/// <summary>
/// Represents a LocalTimeRequest
/// Data needed to request the local time from the Fusion server
/// </summary>
public class LocalTimeRequest
{
@@ -234,9 +191,6 @@ namespace PepperDash.Essentials.Core.Fusion
public class RequestSchedule
{
//[XmlElement(ElementName = "RequestID")]
/// <summary>
/// Gets or sets the RequestID
/// </summary>
public string RequestID { get; set; }
//[XmlElement(ElementName = "RoomID")]
public string RoomID { get; set; }
@@ -256,30 +210,15 @@ namespace PepperDash.Essentials.Core.Fusion
//[XmlRoot(ElementName = "RequestAction")]
/// <summary>
/// Represents a RequestAction
/// </summary>
public class RequestAction
{
//[XmlElement(ElementName = "RequestID")]
/// <summary>
/// Gets or sets the RequestID
/// </summary>
public string RequestID { get; set; }
//[XmlElement(ElementName = "RoomID")]
/// <summary>
/// Gets or sets the RoomID
/// </summary>
public string RoomID { get; set; }
//[XmlElement(ElementName = "ActionID")]
/// <summary>
/// Gets or sets the ActionID
/// </summary>
public string ActionID { get; set; }
//[XmlElement(ElementName = "Parameters")]
/// <summary>
/// Gets or sets the Parameters
/// </summary>
public List<Parameter> Parameters { get; set; }
public RequestAction(string roomID, string actionID, List<Parameter> parameters)
@@ -291,43 +230,22 @@ namespace PepperDash.Essentials.Core.Fusion
}
//[XmlRoot(ElementName = "ActionResponse")]
/// <summary>
/// Represents a ActionResponse
/// </summary>
public class ActionResponse
{
//[XmlElement(ElementName = "RequestID")]
/// <summary>
/// Gets or sets the RequestID
/// </summary>
public string RequestID { get; set; }
//[XmlElement(ElementName = "ActionID")]
/// <summary>
/// Gets or sets the ActionID
/// </summary>
public string ActionID { get; set; }
//[XmlElement(ElementName = "Parameters")]
/// <summary>
/// Gets or sets the Parameters
/// </summary>
public List<Parameter> Parameters { get; set; }
}
//[XmlRoot(ElementName = "Parameter")]
/// <summary>
/// Represents a Parameter
/// </summary>
public class Parameter
{
//[XmlAttribute(AttributeName = "ID")]
/// <summary>
/// Gets or sets the ID
/// </summary>
public string ID { get; set; }
//[XmlAttribute(AttributeName = "Value")]
/// <summary>
/// Gets or sets the Value
/// </summary>
public string Value { get; set; }
}
@@ -360,120 +278,51 @@ namespace PepperDash.Essentials.Core.Fusion
}
//[XmlRoot(ElementName = "Event")]
/// <summary>
/// Represents a Event
/// </summary>
public class Event
{
//[XmlElement(ElementName = "MeetingID")]
/// <summary>
/// Gets or sets the MeetingID
/// </summary>
public string MeetingID { get; set; }
//[XmlElement(ElementName = "RVMeetingID")]
/// <summary>
/// Gets or sets the RVMeetingID
/// </summary>
public string RVMeetingID { get; set; }
//[XmlElement(ElementName = "Recurring")]
/// <summary>
/// Gets or sets the Recurring
/// </summary>
public string Recurring { get; set; }
//[XmlElement(ElementName = "InstanceID")]
/// <summary>
/// Gets or sets the InstanceID
/// </summary>
public string InstanceID { get; set; }
//[XmlElement(ElementName = "dtStart")]
/// <summary>
/// Gets or sets the dtStart
/// </summary>
public DateTime dtStart { get; set; }
//[XmlElement(ElementName = "dtEnd")]
/// <summary>
/// Gets or sets the dtEnd
/// </summary>
public DateTime dtEnd { get; set; }
//[XmlElement(ElementName = "Organizer")]
/// <summary>
/// Gets or sets the Organizer
/// </summary>
public string Organizer { get; set; }
//[XmlElement(ElementName = "Attendees")]
/// <summary>
/// Gets or sets the Attendees
/// </summary>
public Attendees Attendees { get; set; }
//[XmlElement(ElementName = "Resources")]
/// <summary>
/// Gets or sets the Resources
/// </summary>
public Resources Resources { get; set; }
//[XmlElement(ElementName = "IsEvent")]
/// <summary>
/// Gets or sets the IsEvent
/// </summary>
public string IsEvent { get; set; }
//[XmlElement(ElementName = "IsRoomViewMeeting")]
/// <summary>
/// Gets or sets the IsRoomViewMeeting
/// </summary>
public string IsRoomViewMeeting { get; set; }
//[XmlElement(ElementName = "IsPrivate")]
/// <summary>
/// Gets or sets the IsPrivate
/// </summary>
public string IsPrivate { get; set; }
//[XmlElement(ElementName = "IsExchangePrivate")]
/// <summary>
/// Gets or sets the IsExchangePrivate
/// </summary>
public string IsExchangePrivate { get; set; }
//[XmlElement(ElementName = "MeetingTypes")]
/// <summary>
/// Gets or sets the MeetingTypes
/// </summary>
public MeetingTypes MeetingTypes { get; set; }
//[XmlElement(ElementName = "ParticipantCode")]
/// <summary>
/// Gets or sets the ParticipantCode
/// </summary>
public string ParticipantCode { get; set; }
//[XmlElement(ElementName = "PhoneNo")]
/// <summary>
/// Gets or sets the PhoneNo
/// </summary>
public string PhoneNo { get; set; }
//[XmlElement(ElementName = "WelcomeMsg")]
/// <summary>
/// Gets or sets the WelcomeMsg
/// </summary>
public string WelcomeMsg { get; set; }
//[XmlElement(ElementName = "Subject")]
/// <summary>
/// Gets or sets the Subject
/// </summary>
public string Subject { get; set; }
//[XmlElement(ElementName = "LiveMeeting")]
/// <summary>
/// Gets or sets the LiveMeeting
/// </summary>
public LiveMeeting LiveMeeting { get; set; }
//[XmlElement(ElementName = "ShareDocPath")]
/// <summary>
/// Gets or sets the ShareDocPath
/// </summary>
public string ShareDocPath { get; set; }
//[XmlElement(ElementName = "HaveAttendees")]
/// <summary>
/// Gets or sets the HaveAttendees
/// </summary>
public string HaveAttendees { get; set; }
//[XmlElement(ElementName = "HaveResources")]
/// <summary>
/// Gets or sets the HaveResources
/// </summary>
public string HaveResources { get; set; }
/// <summary>
@@ -565,167 +414,86 @@ namespace PepperDash.Essentials.Core.Fusion
}
//[XmlRoot(ElementName = "Resources")]
/// <summary>
/// Represents a Resources
/// </summary>
public class Resources
{
//[XmlElement(ElementName = "Rooms")]
/// <summary>
/// Gets or sets the Rooms
/// </summary>
public Rooms Rooms { get; set; }
}
//[XmlRoot(ElementName = "Rooms")]
/// <summary>
/// Represents a Rooms
/// </summary>
public class Rooms
{
//[XmlElement(ElementName = "Room")]
/// <summary>
/// Gets or sets the Room
/// </summary>
public List<Room> Room { get; set; }
}
//[XmlRoot(ElementName = "Room")]
/// <summary>
/// Represents a Room
/// </summary>
public class Room
{
//[XmlElement(ElementName = "Name")]
/// <summary>
/// Gets or sets the Name
/// </summary>
public string Name { get; set; }
//[XmlElement(ElementName = "ID")]
/// <summary>
/// Gets or sets the ID
/// </summary>
public string ID { get; set; }
//[XmlElement(ElementName = "MPType")]
/// <summary>
/// Gets or sets the MPType
/// </summary>
public string MPType { get; set; }
}
//[XmlRoot(ElementName = "Attendees")]
/// <summary>
/// Represents a Attendees
/// </summary>
public class Attendees
{
//[XmlElement(ElementName = "Required")]
/// <summary>
/// Gets or sets the Required
/// </summary>
public Required Required { get; set; }
//[XmlElement(ElementName = "Optional")]
/// <summary>
/// Gets or sets the Optional
/// </summary>
public Optional Optional { get; set; }
}
//[XmlRoot(ElementName = "Required")]
/// <summary>
/// Represents a Required
/// </summary>
public class Required
{
//[XmlElement(ElementName = "Attendee")]
/// <summary>
/// Gets or sets the Attendee
/// </summary>
public List<string> Attendee { get; set; }
}
//[XmlRoot(ElementName = "Optional")]
/// <summary>
/// Represents a Optional
/// </summary>
public class Optional
{
//[XmlElement(ElementName = "Attendee")]
/// <summary>
/// Gets or sets the Attendee
/// </summary>
public List<string> Attendee { get; set; }
}
//[XmlRoot(ElementName = "MeetingType")]
/// <summary>
/// Represents a MeetingType
/// </summary>
public class MeetingType
{
//[XmlAttribute(AttributeName = "ID")]
/// <summary>
/// Gets or sets the ID
/// </summary>
public string ID { get; set; }
//[XmlAttribute(AttributeName = "Value")]
/// <summary>
/// Gets or sets the Value
/// </summary>
public string Value { get; set; }
}
//[XmlRoot(ElementName = "MeetingTypes")]
/// <summary>
/// Represents a MeetingTypes
/// </summary>
public class MeetingTypes
{
//[XmlElement(ElementName = "MeetingType")]
/// <summary>
/// Gets or sets the MeetingType
/// </summary>
public List<MeetingType> MeetingType { get; set; }
}
//[XmlRoot(ElementName = "LiveMeeting")]
/// <summary>
/// Represents a LiveMeeting
/// </summary>
public class LiveMeeting
{
//[XmlElement(ElementName = "URL")]
/// <summary>
/// Gets or sets the URL
/// </summary>
public string URL { get; set; }
//[XmlElement(ElementName = "ID")]
/// <summary>
/// Gets or sets the ID
/// </summary>
public string ID { get; set; }
//[XmlElement(ElementName = "Key")]
/// <summary>
/// Gets or sets the Key
/// </summary>
public string Key { get; set; }
//[XmlElement(ElementName = "Subject")]
/// <summary>
/// Gets or sets the Subject
/// </summary>
public string Subject { get; set; }
}
//[XmlRoot(ElementName = "LiveMeetingURL")]
/// <summary>
/// Represents a LiveMeetingURL
/// </summary>
public class LiveMeetingURL
{
//[XmlElement(ElementName = "LiveMeeting")]
/// <summary>
/// Gets or sets the LiveMeeting
/// </summary>
public LiveMeeting LiveMeeting { get; set; }
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,236 @@
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{1BED5BA9-88C4-4365-9362-6F4B128071D3}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>PepperDash.Essentials</RootNamespace>
<AssemblyName>PepperDashEssentials</AssemblyName>
<ProjectTypeGuids>{0B4745B0-194B-4BB6-8E21-E9057CA92230};{4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<PlatformFamilyName>WindowsCE</PlatformFamilyName>
<PlatformID>E2BECB1F-8C8C-41ba-B736-9BE7D946A398</PlatformID>
<OSVersion>5.0</OSVersion>
<DeployDirSuffix>SmartDeviceProject1</DeployDirSuffix>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<NativePlatformName>Windows CE</NativePlatformName>
<FormFactorID>
</FormFactorID>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<AllowedReferenceRelatedFileExtensions>.allowedReferenceRelatedFileExtensions</AllowedReferenceRelatedFileExtensions>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>DEBUG;TRACE;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<FileAlignment>512</FileAlignment>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
<GenerateSerializationAssemblies>off</GenerateSerializationAssemblies>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<AllowedReferenceRelatedFileExtensions>.allowedReferenceRelatedFileExtensions</AllowedReferenceRelatedFileExtensions>
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<FileAlignment>512</FileAlignment>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
<GenerateSerializationAssemblies>off</GenerateSerializationAssemblies>
</PropertyGroup>
<ItemGroup>
<Reference Include="Crestron.SimplSharpPro.DeviceSupport, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.DeviceSupport.dll</HintPath>
</Reference>
<Reference Include="Crestron.SimplSharpPro.DM, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.DM.dll</HintPath>
</Reference>
<Reference Include="Crestron.SimplSharpPro.EthernetCommunications, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.EthernetCommunications.dll</HintPath>
</Reference>
<Reference Include="Crestron.SimplSharpPro.Fusion, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Fusion.dll</HintPath>
</Reference>
<Reference Include="Crestron.SimplSharpPro.Remotes, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Remotes.dll</HintPath>
</Reference>
<Reference Include="Crestron.SimplSharpPro.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.UI.dll</HintPath>
</Reference>
<Reference Include="mscorlib" />
<Reference Include="PepperDash_Core, Version=1.0.3.27452, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\essentials-framework\references\PepperDash_Core.dll</HintPath>
</Reference>
<Reference Include="PepperDash_Essentials_DM, Version=1.0.0.19343, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\essentials-framework\Essentials DM\Essentials_DM\bin\PepperDash_Essentials_DM.dll</HintPath>
</Reference>
<Reference Include="SimplSharpCustomAttributesInterface, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpCustomAttributesInterface.dll</HintPath>
</Reference>
<Reference Include="SimplSharpHelperInterface, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpHelperInterface.dll</HintPath>
</Reference>
<Reference Include="SimplSharpNewtonsoft, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpNewtonsoft.dll</HintPath>
</Reference>
<Reference Include="SimplSharpPro, Version=1.5.2.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpPro.exe</HintPath>
</Reference>
<Reference Include="SimplSharpReflectionInterface, Version=1.0.5583.25238, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpReflectionInterface.dll</HintPath>
</Reference>
<Reference Include="SimplSharpTimerEventInterface, Version=1.0.6197.20052, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpTimerEventInterface.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data" />
</ItemGroup>
<ItemGroup>
<Compile Include="AppServer\Messengers\VideoCodecBaseMessenger.cs" />
<Compile Include="Audio\EssentialsVolumeLevelConfig.cs" />
<Compile Include="Bridges\BridgeBase.cs" />
<Compile Include="Bridges\BridgeFactory.cs" />
<Compile Include="Configuration ORIGINAL\Builders\TPConfig.cs" />
<Compile Include="Configuration ORIGINAL\Configuration.cs" />
<Compile Include="Configuration ORIGINAL\ConfigurationHelpers.cs" />
<Compile Include="Configuration ORIGINAL\ConfigTieLine.cs" />
<Compile Include="Configuration ORIGINAL\Factories\CommFactory.cs" />
<Compile Include="Configuration ORIGINAL\Factories\RemoteFactory.cs" />
<Compile Include="Configuration ORIGINAL\Factories\DeviceMonitorFactory.cs" />
<Compile Include="Configuration ORIGINAL\Factories\DmFactory.cs" />
<Compile Include="Configuration ORIGINAL\Factories\TouchpanelFactory.cs" />
<Compile Include="Configuration ORIGINAL\Factories\PcFactory.cs" />
<Compile Include="Configuration ORIGINAL\Factories\REMOVE DiscPlayerFactory.cs" />
<Compile Include="Configuration ORIGINAL\Factories\MAYBE SetTopBoxFactory.cs" />
<Compile Include="Configuration ORIGINAL\Factories\DisplayFactory.cs" />
<Compile Include="Configuration ORIGINAL\Factories\FactoryHelper.cs" />
<Compile Include="Factory\DeviceFactory.cs" />
<Compile Include="Devices\Amplifier.cs" />
<Compile Include="Devices\DiscPlayer\OppoExtendedBdp.cs" />
<Compile Include="Devices\NUMERIC AppleTV.cs" />
<Compile Include="ControlSystem.cs" />
<Compile Include="Factory\UiDeviceFactory.cs" />
<Compile Include="OTHER\Fusion\EssentialsHuddleVtc1FusionController.cs" />
<Compile Include="OTHER\Fusion\FusionCustomPropertiesBridge.cs" />
<Compile Include="OTHER\Fusion\FusionEventHandlers.cs" />
<Compile Include="OTHER\Fusion\FusionProcessorQueries.cs" />
<Compile Include="OTHER\Fusion\FusionRviDataClasses.cs" />
<Compile Include="REMOVE EssentialsApp.cs" />
<Compile Include="OTHER\Fusion\EssentialsHuddleSpaceFusionSystemControllerBase.cs" />
<Compile Include="HttpApiHandler.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Room\Behaviours\RoomOnToDefaultSourceWhenOccupied.cs" />
<Compile Include="Room\Config\DDVC01RoomPropertiesConfig.cs" />
<Compile Include="Room\Config\EssentialsPresentationPropertiesConfig.cs" />
<Compile Include="Room\Config\EssentialsHuddleRoomPropertiesConfig.cs" />
<Compile Include="Room\Config\EssentialsHuddleVtc1PropertiesConfig.cs" />
<Compile Include="Room\Config\EssentialsRoomEmergencyConfig.cs" />
<Compile Include="AppServer\CotijaConfig.cs" />
<Compile Include="AppServer\CotijaDdvc01DeviceBridge.cs" />
<Compile Include="AppServer\Interfaces.cs" />
<Compile Include="AppServer\RoomBridges\CotijaBridgeBase.cs" />
<Compile Include="AppServer\RoomBridges\CotijaDdvc01RoomBridge.cs" />
<Compile Include="AppServer\RoomBridges\CotijaEssentialsHuddleSpaceRoomBridge.cs" />
<Compile Include="AppServer\DeviceTypeInterfaces\IChannelExtensions.cs" />
<Compile Include="AppServer\DeviceTypeInterfaces\IColorExtensions.cs" />
<Compile Include="AppServer\DeviceTypeInterfaces\IDPadExtensions.cs" />
<Compile Include="AppServer\DeviceTypeInterfaces\IDvrExtensions.cs" />
<Compile Include="AppServer\DeviceTypeInterfaces\INumericExtensions.cs" />
<Compile Include="AppServer\DeviceTypeInterfaces\IPowerExtensions.cs" />
<Compile Include="AppServer\DeviceTypeInterfaces\ISetTopBoxControlsExtensions.cs" />
<Compile Include="AppServer\DeviceTypeInterfaces\ITransportExtensions.cs" />
<Compile Include="AppServer\RoomBridges\SourceDeviceMapDictionary.cs" />
<Compile Include="AppServer\Volumes.cs" />
<Compile Include="Room\Emergency\EsentialsRoomEmergencyContactClosure.cs" />
<Compile Include="Room\Types\EssentialsHuddleVtc1Room.cs" />
<Compile Include="Room\Types\EssentialsPresentationRoom.cs" />
<Compile Include="Room\Types\EssentialsRoomBase.cs" />
<Compile Include="Room\Config\EssentialsRoomConfig.cs" />
<Compile Include="FOR REFERENCE UI\PageControllers\DevicePageControllerBase.cs" />
<Compile Include="FOR REFERENCE UI\PageControllers\PageControllerLaptop.cs" />
<Compile Include="FOR REFERENCE UI\PageControllers\PageControllerLargeDvd.cs" />
<Compile Include="FOR REFERENCE UI\PageControllers\PageControllerLargeSetTopBoxGeneric.cs" />
<Compile Include="FOR REFERENCE UI\PageControllers\LargeTouchpanelControllerBase.cs" />
<Compile Include="FOR REFERENCE UI\Panels\SmartGraphicsTouchpanelControllerBase.cs" />
<Compile Include="UIDrivers\Environment Drivers\EssentialsEnvironmentDriver.cs" />
<Compile Include="UIDrivers\Environment Drivers\EssentialsLightingDriver.cs" />
<Compile Include="UIDrivers\Environment Drivers\EssentialsShadeDriver.cs" />
<Compile Include="UIDrivers\Essentials\EssentialsHeaderDriver.cs" />
<Compile Include="UIDrivers\JoinedSigInterlock.cs" />
<Compile Include="UIDrivers\SigInterlock.cs" />
<Compile Include="UIDrivers\EssentialsHuddleVTC\EssentialsHuddlePresentationUiDriver.cs" />
<Compile Include="UIDrivers\EssentialsHuddle\EssentialsHuddleTechPageDriver.cs" />
<Compile Include="UI\HttpLogoServer.cs" />
<Compile Include="UI\SmartObjectHeaderButtonList.cs" />
<Compile Include="UI\SubpageReferenceListCallStagingItem.cs" />
<Compile Include="UIDrivers\VC\EssentialsVideoCodecUiDriver.cs" />
<Compile Include="UIDrivers\EssentialsHuddleVTC\EssentialsHuddleVtc1PanelAvFunctionsDriver.cs" />
<Compile Include="UIDrivers\SourceChangeArgs.cs" />
<Compile Include="UI\JoinConstants\UISmartObjectJoin.cs" />
<Compile Include="UI\JoinConstants\UIStringlJoin.cs" />
<Compile Include="UI\JoinConstants\UIUshortJoin.cs" />
<Compile Include="UIDrivers\DualDisplayRouting.cs" />
<Compile Include="UIDrivers\Essentials\EssentialsPresentationPanelAvFunctionsDriver.cs" />
<Compile Include="UIDrivers\Page Drivers\SingleSubpageModalDriver.cs" />
<Compile Include="UIDrivers\Essentials\EssentialsPanelMainInterfaceDriver.cs" />
<Compile Include="UIDrivers\enums and base.cs" />
<Compile Include="UIDrivers\EssentialsHuddle\EssentialsHuddlePanelAvFunctionsDriver.cs" />
<Compile Include="UIDrivers\Page Drivers\SingleSubpageModalAndBackDriver.cs" />
<Compile Include="UIDrivers\SmartObjectRoomsList.cs" />
<Compile Include="UI\JoinConstants\UIBoolJoin.cs" />
<Compile Include="AppServer\CotijaSystemController.cs" />
<Compile Include="UI\DualDisplaySourceSRLController.cs" />
<Compile Include="UI\SubpageReferenceListActivityItem.cs" />
<Compile Include="UI\CrestronTouchpanelPropertiesConfig.cs" />
<Compile Include="FOR REFERENCE UI\Panels\REMOVE UiCue.cs" />
<Compile Include="FOR REFERENCE UI\SRL\SourceListSubpageReferenceList.cs" />
<Compile Include="Room\Types\EssentialsHuddleSpaceRoom.cs" />
<Compile Include="UI\EssentialsTouchpanelController.cs" />
<Compile Include="UI\SubpageReferenceListSourceItem.cs" />
<None Include="app.config" />
<None Include="Properties\ControlSystem.cfg" />
<EmbeddedResource Include="SGD\PepperDash Essentials iPad.sgd" />
<EmbeddedResource Include="SGD\PepperDash Essentials TSW-560.sgd" />
<EmbeddedResource Include="SGD\PepperDash Essentials TSW-760.sgd" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\essentials-framework\Essentials Core\PepperDashEssentialsBase\PepperDash_Essentials_Core.csproj">
<Project>{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}</Project>
<Name>PepperDash_Essentials_Core</Name>
</ProjectReference>
<ProjectReference Include="..\essentials-framework\Essentials Devices Common\Essentials Devices Common\Essentials Devices Common.csproj">
<Project>{892B761C-E479-44CE-BD74-243E9214AF13}</Project>
<Name>Essentials Devices Common</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
</VisualStudio>
</ProjectExtensions>
<PropertyGroup>
<PostBuildEvent>rem S# Pro preparation will execute after these operations</PostBuildEvent>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,8 @@
using System.Reflection;
[assembly: AssemblyTitle("PepperDashEssentials")]
[assembly: AssemblyCompany("PepperDash Technology Corp")]
[assembly: AssemblyProduct("PepperDashEssentials")]
[assembly: AssemblyCopyright("Copyright © PepperDash Technology Corp 2018")]
[assembly: AssemblyVersion("1.2.12.*")]

View File

@@ -0,0 +1,12 @@
using System.Reflection;
[assembly: AssemblyTitle("PepperDashEssentials")]
[assembly: AssemblyCompany("PepperDash Technology Corp")]
[assembly: AssemblyProduct("PepperDashEssentials")]
[assembly: AssemblyCopyright("Copyright © PepperDash Technology Corp 2017")]
<<<<<<< HEAD
[assembly: AssemblyVersion("1.1.8.*")]
=======
[assembly: AssemblyVersion("1.3.0.*")]
>>>>>>> feature/ecs-684

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<ControlSystem>
<Name>Test RMC3</Name>
<Address>auto 192.168.1.40;username crestron</Address>
<Address>auto 192.168.1.40</Address>
<ProgramSlot>Program01</ProgramSlot>
<Storage>Internal Flash</Storage>
</ControlSystem>

View File

@@ -0,0 +1,69 @@
//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 Crestron.SimplSharpPro.DM;
//using Crestron.SimplSharpPro.DM.Cards;
//using Crestron.SimplSharpPro.DM.Endpoints.Transmitters;
//using PepperDash.Essentials.Core;
//using PepperDash.Essentials.Core.Devices;
////using PepperDash.Essentials.Core.Devices.Dm;
//using PepperDash.Essentials.Displays;
////using PepperDash.Essentials.Core.Http;
//using PepperDash.Core;
//namespace PepperDash.Essentials
//{
// public class EssentialsApp
// {
// public string ConfigPath { get; set; }
// public Dictionary<string, Room> Rooms { get; private set; }
// //EssentialsHttpApiHandler ApiHandler; // MOVE ???????????????????
// public EssentialsApp(CrestronControlSystem cs)
// {
// // Use a fake license manager for now
// Global.LicenseManager = PepperDash.Essentials.License.MockEssentialsLicenseManager.Manager;
// // ---------------------------------- Make this configurable
// //var server = Global.HttpConfigServer;
// //server.Start(8081, "HttpConfigServer");
// //ConfigPath = string.Format(@"\NVRAM\Program{0}\EssentialsConfiguration.json",
// // InitialParametersClass.ApplicationNumber);
// //ApiHandler = new EssentialsHttpApiHandler(server, ConfigPath, @"\HTML\presets\lists\");
// Debug.Console(0, "\r\r--------------------CONFIG BEGIN--------------------\r");
// Configuration.Initialize(cs);
// Configuration.ReadConfiguration(ConfigPath);
// Debug.Console(0, "\r--------------------CONFIG END----------------------\r\r");
// }
// }
// public class ResponseToken
// {
// public string Token { get; private set; }
// public DateTime Expires { get; private set; }
// public bool IsExpired { get { return Expires < DateTime.Now; } }
// public ResponseToken(int timeoutMinutes)
// {
// Expires = DateTime.Now.AddMinutes(timeoutMinutes);
// Token = Guid.NewGuid().ToString();
// }
// }
//}

View File

@@ -0,0 +1,16 @@
<ProgramInfo>
<RequiredInfo>
<FriendlyName>PepperDashEssentials</FriendlyName>
<SystemName>PepperDashEssentialsBase</SystemName>
<EntryPoint>PepperDashEssentialsBase</EntryPoint>
<MinFirmwareVersion>1.009.0029</MinFirmwareVersion>
<ProgramTool>SIMPL# Plugin</ProgramTool>
<DesignToolId>5</DesignToolId>
<ProgramToolId>5</ProgramToolId>
<ArchiveName />
</RequiredInfo>
<OptionalInfo>
<CompiledOn>1/8/2016 3:03:22 PM</CompiledOn>
<CompilerRev>1.0.0.27100</CompilerRev>
</OptionalInfo>
</ProgramInfo>

View File

@@ -0,0 +1,18 @@
MainAssembly=PepperDashEssentialsBase.dll:5d68a993ab03b4b88d0f95478188a439
MainAssemblyMinFirmwareVersion=1.009.0029
ü
DependencySource=Crestron.SimplSharpPro.DeviceSupport.dll:caae4b4259aaf619059f0ae34473bfd2
DependencyPath=PepperDashEssentialsBase.cplz:Crestron.SimplSharpPro.DeviceSupport.dll
DependencyMainAssembly=Crestron.SimplSharpPro.DeviceSupport.dll:caae4b4259aaf619059f0ae34473bfd2
ü
DependencySource=Crestron.SimplSharpPro.DM.dll:bdf5acfa80cc3bb87f21deb891128b1d
DependencyPath=PepperDashEssentialsBase.cplz:Crestron.SimplSharpPro.DM.dll
DependencyMainAssembly=Crestron.SimplSharpPro.DM.dll:bdf5acfa80cc3bb87f21deb891128b1d
ü
DependencySource=Crestron.SimplSharpPro.EthernetCommunications.dll:36e663497195140ee6f1b4ebc53f5ea7
DependencyPath=PepperDashEssentialsBase.cplz:Crestron.SimplSharpPro.EthernetCommunications.dll
DependencyMainAssembly=Crestron.SimplSharpPro.EthernetCommunications.dll:36e663497195140ee6f1b4ebc53f5ea7
ü
DependencySource=Crestron.SimplSharpPro.UI.dll:089312a0cb0b4537072d4eb234e71e0e
DependencyPath=PepperDashEssentialsBase.cplz:Crestron.SimplSharpPro.UI.dll
DependencyMainAssembly=Crestron.SimplSharpPro.UI.dll:089312a0cb0b4537072d4eb234e71e0e

View File

@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Newtonsoft.Json;
namespace PepperDash.Essentials.Room.Config
{
public class DDVC01RoomPropertiesConfig : EssentialsHuddleVtc1PropertiesConfig
{
[JsonProperty("roomPhoneNumber")]
public string RoomPhoneNumber { get; set; }
[JsonProperty("roomURI")]
public string RoomURI { get; set; }
[JsonProperty("speedDials")]
public List<DDVC01SpeedDial> SpeedDials { get; set; }
[JsonProperty("volumeSliderNames")]
public List<string> VolumeSliderNames { get; set; }
}
public class DDVC01SpeedDial
{
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("number")]
public string Number { get; set; }
}
}

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