mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-01-12 12:05:00 +00:00
Compare commits
307 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d64cbc639a | ||
|
|
8404e7d5a4 | ||
|
|
e4135a958c | ||
|
|
f4ac4e6319 | ||
|
|
b026174cd2 | ||
|
|
66ff6b2e07 | ||
|
|
e7bbfbd40a | ||
|
|
eec86fde48 | ||
|
|
7b57ce439e | ||
|
|
5d120391a5 | ||
|
|
db5aa319ec | ||
|
|
10f5516a5a | ||
|
|
45e6dff26d | ||
|
|
10129b8178 | ||
|
|
9128e108f7 | ||
|
|
760ec8be92 | ||
|
|
bbcdd3e179 | ||
|
|
7a649f4ea8 | ||
|
|
6946946c12 | ||
|
|
dca73e1508 | ||
|
|
990090e1de | ||
|
|
3b843104d8 | ||
|
|
a37814ab3c | ||
|
|
2181410927 | ||
|
|
d4191ceb75 | ||
|
|
5f6d15c6c0 | ||
|
|
4cc40227fd | ||
|
|
d0dbbe095f | ||
|
|
c7180db2b7 | ||
|
|
d95ee27979 | ||
|
|
e964172200 | ||
|
|
840934502b | ||
|
|
a76f4c15dc | ||
|
|
b19e2e38ad | ||
|
|
9a7fe553f9 | ||
|
|
e6ecaf3a1e | ||
|
|
895b76a0cd | ||
|
|
5c9996e728 | ||
|
|
0cc2328276 | ||
|
|
8fadfa98f2 | ||
|
|
1ccf54003f | ||
|
|
54769ce270 | ||
|
|
6b85323949 | ||
|
|
319d8f99c5 | ||
|
|
cc742f4291 | ||
|
|
6beff106ec | ||
|
|
cb35aa13f5 | ||
|
|
b71523bd2d | ||
|
|
0c56da112c | ||
|
|
08f4d8e9a2 | ||
|
|
25e7e9634a | ||
|
|
7ac3f81ea5 | ||
|
|
1c06e8381b | ||
|
|
f5305197b3 | ||
|
|
1805ebaf0f | ||
|
|
ca8207f2bd | ||
|
|
4e81859695 | ||
|
|
655bb954fa | ||
|
|
1ebacf3f0f | ||
|
|
7de0251188 | ||
|
|
492e593263 | ||
|
|
afe2046c81 | ||
|
|
98d3a4a2fa | ||
|
|
1702c69b73 | ||
|
|
722d28b1b3 | ||
|
|
ef7da0d7af | ||
|
|
77d8e63a31 | ||
|
|
d2d99d4bfa | ||
|
|
4bd71b04bf | ||
|
|
c5bcd89695 | ||
|
|
c7cc98bff7 | ||
|
|
db60f8f1be | ||
|
|
e82efdde2d | ||
|
|
d00c8bed5f | ||
|
|
a91af6bd75 | ||
|
|
2d36b80800 | ||
|
|
e152b9a504 | ||
|
|
eac7c91327 | ||
|
|
ac0d5e59a0 | ||
|
|
78be8ec5f2 | ||
|
|
5fc4ff6027 | ||
|
|
63853739f3 | ||
|
|
c14193f9ac | ||
|
|
da179c01f5 | ||
|
|
0ded3e30f9 | ||
|
|
8d215930d9 | ||
|
|
b4edb021ee | ||
|
|
52caa98f33 | ||
|
|
4e041d1773 | ||
|
|
118bd5a54a | ||
|
|
116abbf962 | ||
|
|
a06333e1c3 | ||
|
|
d937dc14fc | ||
|
|
604f4ca22d | ||
|
|
2d7ad8ba2a | ||
|
|
e4a3933743 | ||
|
|
d6445861f5 | ||
|
|
03b076c8eb | ||
|
|
7c58221acc | ||
|
|
14f7c27b33 | ||
|
|
9ea65883b7 | ||
|
|
9d0020d999 | ||
|
|
fb44a3b93c | ||
|
|
6b7c5c01f8 | ||
|
|
1a3eb9a546 | ||
|
|
44c171c8f4 | ||
|
|
ae9833ffaa | ||
|
|
685c344785 | ||
|
|
e6f5142fc3 | ||
|
|
3c9ca1e527 | ||
|
|
452d0a5a39 | ||
|
|
8643ed2caf | ||
|
|
2787c7fc52 | ||
|
|
babc3e4f1a | ||
|
|
0a4ff82af0 | ||
|
|
b455e1af21 | ||
|
|
e12a5e95bf | ||
|
|
3e7144f7ef | ||
|
|
19e070ed76 | ||
|
|
b818c14713 | ||
|
|
63e7866890 | ||
|
|
922d1d8133 | ||
|
|
d26ea01ed9 | ||
|
|
4ebd1b53b5 | ||
|
|
0226b58b1e | ||
|
|
be41922c54 | ||
|
|
56f93c5491 | ||
|
|
8cfd58bb7e | ||
|
|
6ddfdc4b38 | ||
|
|
7640b95701 | ||
|
|
6c2abc7abd | ||
|
|
1849d118b4 | ||
|
|
22e7f004a5 | ||
|
|
0dcaacb038 | ||
|
|
cf8e673677 | ||
|
|
200080247a | ||
|
|
ba247ee8d6 | ||
|
|
b3617d04c8 | ||
|
|
85cf51876a | ||
|
|
b6f47168c0 | ||
|
|
1e755df9bb | ||
|
|
037f8ed043 | ||
|
|
e327d2d359 | ||
|
|
e832566168 | ||
|
|
252d037380 | ||
|
|
dd0f7a586e | ||
|
|
2feec62052 | ||
|
|
33a1b1697a | ||
|
|
955d68b3f3 | ||
|
|
0f28d46f34 | ||
|
|
275759143b | ||
|
|
3a4737b6f6 | ||
|
|
2b2308d5c2 | ||
|
|
185f03065e | ||
|
|
3803263598 | ||
|
|
358fa1a9c0 | ||
|
|
7fbbc9f2b8 | ||
|
|
f4f400f9b6 | ||
|
|
d3383db890 | ||
|
|
139e5370ea | ||
|
|
4f9fa05e3f | ||
|
|
7ab2574912 | ||
|
|
35167d77f9 | ||
|
|
bdd17dfa27 | ||
|
|
6443e00428 | ||
|
|
008279e867 | ||
|
|
c4a6d20791 | ||
|
|
61b4002e5a | ||
|
|
da63d0917e | ||
|
|
0228fd1c0f | ||
|
|
085ba134c4 | ||
|
|
a9fce3237c | ||
|
|
840fb21e15 | ||
|
|
6ab4d4d090 | ||
|
|
fcdee3b9fd | ||
|
|
4e15d7fe5a | ||
|
|
2a76e2b3f9 | ||
|
|
f9522a533a | ||
|
|
ec07ec84f7 | ||
|
|
0457bcf7fe | ||
|
|
ba0b2e169a | ||
|
|
bebcc3c6e1 | ||
|
|
8ed236abae | ||
|
|
8572191c1e | ||
|
|
4a9b1514e3 | ||
|
|
9c7e38b379 | ||
|
|
846e905ae1 | ||
|
|
00d2159d06 | ||
|
|
7019b62610 | ||
|
|
a583fdb72a | ||
|
|
33bf98303d | ||
|
|
b2f3aa9cfa | ||
|
|
31f6a4bcfd | ||
|
|
29b77f5629 | ||
|
|
f74fa35ca4 | ||
|
|
74231a428d | ||
|
|
8ba0920cc0 | ||
|
|
e23fe06fef | ||
|
|
79fd1f7424 | ||
|
|
2da8f8c9a8 | ||
|
|
743accd980 | ||
|
|
b445f68466 | ||
|
|
847e106b8d | ||
|
|
57f2d7c938 | ||
|
|
f0415d0d05 | ||
|
|
d2ebc340bd | ||
|
|
07fbe102bd | ||
|
|
319909539c | ||
|
|
00589488ac | ||
|
|
f25219c20a | ||
|
|
7c7ae65d40 | ||
|
|
0dcbb652df | ||
|
|
0649cea367 | ||
|
|
9f840fae41 | ||
|
|
c5aef18943 | ||
|
|
70d4a7054f | ||
|
|
b20009b247 | ||
|
|
9588564633 | ||
|
|
eef3b5fb31 | ||
|
|
7078ba55c7 | ||
|
|
e06be3ebe9 | ||
|
|
10046a9ed4 | ||
|
|
51f294c37f | ||
|
|
1990201215 | ||
|
|
be78d17af5 | ||
|
|
8a6d5ebd56 | ||
|
|
93c0b33958 | ||
|
|
dca21aa4dc | ||
|
|
ac09267173 | ||
|
|
ef63c1db02 | ||
|
|
f828cbecbd | ||
|
|
890abf4383 | ||
|
|
52c96cc2c3 | ||
|
|
4ab3cdb1ff | ||
|
|
2dfd647f63 | ||
|
|
7f054d5e98 | ||
|
|
43297c0341 | ||
|
|
6280aa90c9 | ||
|
|
ca497c8f47 | ||
|
|
1da481a8db | ||
|
|
c04d79931d | ||
|
|
dbd3ab2f70 | ||
|
|
36b5faa3d9 | ||
|
|
07bf74ab19 | ||
|
|
e356f57e1a | ||
|
|
86ad88969e | ||
|
|
7020480159 | ||
|
|
bc54856392 | ||
|
|
24a435c965 | ||
|
|
2897ec1d83 | ||
|
|
f075412a86 | ||
|
|
4f5bb4dc46 | ||
|
|
382c35924c | ||
|
|
88c332729f | ||
|
|
e9a6aa641b | ||
|
|
16bc2ca381 | ||
|
|
2fc1f45161 | ||
|
|
ef7eae50e4 | ||
|
|
2c50efd4c5 | ||
|
|
3ebe44be34 | ||
|
|
e7b322c303 | ||
|
|
08491bdf2a | ||
|
|
f1fa3c07fd | ||
|
|
b19b4ae26e | ||
|
|
7f8215199d | ||
|
|
dd060c4442 | ||
|
|
e782339dcc | ||
|
|
766ed3ab51 | ||
|
|
cd0e3f7001 | ||
|
|
29d5ecb13f | ||
|
|
2987f600bb | ||
|
|
5c23aeca48 | ||
|
|
6ef8ba3639 | ||
|
|
4f7ad4ccb9 | ||
|
|
e03b0dc1bb | ||
|
|
b75153b848 | ||
|
|
d70d33c5e3 | ||
|
|
7eb6748682 | ||
|
|
c92c750e55 | ||
|
|
225c6281b9 | ||
|
|
249e9f372e | ||
|
|
4dfab9a287 | ||
|
|
ec43749ba4 | ||
|
|
2e4202ccce | ||
|
|
4c16dd07b5 | ||
|
|
0c4ad1c4df | ||
|
|
eb90fb343d | ||
|
|
2967a0f968 | ||
|
|
7b2a8b17b7 | ||
|
|
89ca614d3d | ||
|
|
355df1341e | ||
|
|
78c17cd729 | ||
|
|
504c21204f | ||
|
|
8dba5a335b | ||
|
|
3d6d578663 | ||
|
|
a5e9d7ba55 | ||
|
|
5eb65fd723 | ||
|
|
e0dcde5c35 | ||
|
|
c6cfecdbbb | ||
|
|
30bdac93ee | ||
|
|
1228431bc2 | ||
|
|
5a2070de3f | ||
|
|
bc1645065c | ||
|
|
21f9795bcd | ||
|
|
a69bc94945 | ||
|
|
864c8ddf77 | ||
|
|
5764149306 |
3
.github/ISSUE_TEMPLATE/bug_report.md
vendored
3
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -7,6 +7,9 @@ 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.
|
||||
|
||||
|
||||
27
.github/ISSUE_TEMPLATE/rfi_request.md
vendored
Normal file
27
.github/ISSUE_TEMPLATE/rfi_request.md
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
---
|
||||
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.
|
||||
165
.github/workflows/docker.yml
vendored
165
.github/workflows/docker.yml
vendored
@@ -78,16 +78,9 @@ jobs:
|
||||
with:
|
||||
name: Version
|
||||
path: ${{env.GITHUB_HOME}}\output\version.txt
|
||||
# Create the release on the source repo
|
||||
- name: Create tag for non-rc builds
|
||||
if: contains(env.VERSION, 'alpha') || contains(env.VERSION, 'beta')
|
||||
run: |
|
||||
git tag $($Env:VERSION)
|
||||
git push --tags origin
|
||||
- name: Create Release
|
||||
id: create_release
|
||||
# using contributor's version to allow for pointing at the right commit
|
||||
if: contains(env.VERSION,'-rc-') || contains(env.VERSION,'-hotfix-')
|
||||
uses: fleskesvor/create-release@feature/support-target-commitish
|
||||
with:
|
||||
tag_name: ${{ env.VERSION }}
|
||||
@@ -97,7 +90,6 @@ jobs:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
# Upload the build package to the release
|
||||
- name: Upload Release Package
|
||||
if: contains(env.VERSION,'-rc-') || contains(env.VERSION,'-hotfix-')
|
||||
id: upload_release
|
||||
uses: actions/upload-release-asset@v1
|
||||
with:
|
||||
@@ -150,160 +142,3 @@ jobs:
|
||||
run: nuget push **/*.nupkg -source github
|
||||
- name: Publish nuget package to nuget.org
|
||||
run: nuget push **/*.nupkg -Source https://api.nuget.org/v3/index.json
|
||||
# This step always runs and pushes the build to the internal build rep
|
||||
Internal_Push_Output:
|
||||
needs: Build_Project
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: check Github ref
|
||||
run: ${{toJson(github.ref)}}
|
||||
# Checkout the repo
|
||||
- name: Checkout Builds Repo
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
token: ${{ secrets.BUILDS_TOKEN }}
|
||||
repository: PepperDash-Engineering/essentials-builds
|
||||
ref: ${{ Env.GITHUB_REF }}
|
||||
# Download the version artifact from the build job
|
||||
- name: Download Build Version Info
|
||||
uses: actions/download-artifact@v1
|
||||
with:
|
||||
name: Version
|
||||
- name: Check Directory
|
||||
run: Get-ChildItem "./"
|
||||
# Set the version number environment variable from the file we just downloaded
|
||||
- name: Set Version Number
|
||||
shell: powershell
|
||||
run: |
|
||||
Get-ChildItem "./Version"
|
||||
$version = Get-Content -Path ./Version/version.txt
|
||||
Write-Host "Version: $version"
|
||||
echo "VERSION=$version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
||||
Remove-Item -Path ./Version/version.txt
|
||||
Remove-Item -Path ./Version
|
||||
# Checkout/Create the branch
|
||||
- name: Create new branch
|
||||
run: git checkout -b $($Env:GITHUB_REF -replace "refs/heads/")
|
||||
# Download the build output into the repo
|
||||
- name: Download Build output
|
||||
uses: actions/download-artifact@v1
|
||||
with:
|
||||
name: Build
|
||||
path: ./
|
||||
- name: Check directory
|
||||
run: Get-ChildItem ./
|
||||
# Unzip the build package file
|
||||
- name: Unzip Build file
|
||||
run: |
|
||||
Get-ChildItem .\*.zip | Expand-Archive -DestinationPath .\
|
||||
Remove-Item -Path .\*.zip
|
||||
- name: Check directory again
|
||||
run: Get-ChildItem ./
|
||||
# Copy Contents of output folder to root directory
|
||||
- name: Copy Files to root & delete output directory
|
||||
run: |
|
||||
Remove-Item -Path .\* -Include @("*.cpz","*.md","*.cplz","*.json","*.dll","*.clz")
|
||||
Get-ChildItem -Path .\output\* | Copy-Item -Destination .\
|
||||
Remove-Item -Path .\output -Recurse
|
||||
# Commits the build output to the branch and tags it with the version
|
||||
- name: Commit build output and tag the commit
|
||||
shell: powershell
|
||||
run: |
|
||||
git config user.email "actions@pepperdash.com"
|
||||
git config user.name "GitHub Actions"
|
||||
git add .
|
||||
$commit = "Build $($Env:GITHUB_RUN_NUMBER) from commit: https://github.com/$($Env:GITHUB_REPOSITORY)/commit/$($Env:GITHUB_SHA)"
|
||||
Write-Host "Commit: $commit"
|
||||
git commit -m $commit
|
||||
git tag $($Env:VERSION)
|
||||
# Push the commit
|
||||
- name: Push to Builds Repo
|
||||
shell: powershell
|
||||
run: |
|
||||
$branch = $($Env:GITHUB_REF) -replace "refs/heads/"
|
||||
Write-Host "Branch: $branch"
|
||||
git push -u origin $($branch) --force
|
||||
# Push the tags
|
||||
- name: Push tags
|
||||
run: git push --tags origin
|
||||
- name: Check Directory
|
||||
run: Get-ChildItem ./
|
||||
# This step only runs if the branch is main or release/ runs and pushes the build to the public build repo
|
||||
Public_Push_Output:
|
||||
needs: Build_Project
|
||||
runs-on: windows-latest
|
||||
if: contains(github.ref, 'main') || contains(github.ref, '/release/')
|
||||
steps:
|
||||
# Checkout the repo
|
||||
- name: check Github ref
|
||||
run: ${{toJson(github.ref)}}
|
||||
- name: Checkout Builds Repo
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
token: ${{ secrets.BUILDS_TOKEN }}
|
||||
repository: PepperDash/Essentials-Builds
|
||||
ref: ${{ Env.GITHUB_REF }}
|
||||
# Download the version artifact from the build job
|
||||
- name: Download Build Version Info
|
||||
uses: actions/download-artifact@v1
|
||||
with:
|
||||
name: Version
|
||||
- name: Check Directory
|
||||
run: Get-ChildItem "./"
|
||||
# Set the version number environment variable from the file we just downloaded
|
||||
- name: Set Version Number
|
||||
shell: powershell
|
||||
run: |
|
||||
Get-ChildItem "./Version"
|
||||
$version = Get-Content -Path ./Version/version.txt
|
||||
Write-Host "Version: $version"
|
||||
echo "VERSION=$version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
||||
Remove-Item -Path ./Version/version.txt
|
||||
Remove-Item -Path ./Version
|
||||
# Checkout/Create the branch
|
||||
- name: Create new branch
|
||||
run: git checkout -b $($Env:GITHUB_REF -replace "refs/heads/")
|
||||
# Download the build output into the repo
|
||||
- name: Download Build output
|
||||
uses: actions/download-artifact@v1
|
||||
with:
|
||||
name: Build
|
||||
path: ./
|
||||
- name: Check directory
|
||||
run: Get-ChildItem ./
|
||||
# Unzip the build package file
|
||||
- name: Unzip Build file
|
||||
run: |
|
||||
Get-ChildItem .\*.zip | Expand-Archive -DestinationPath .\
|
||||
Remove-Item -Path .\*.zip
|
||||
- name: Check directory again
|
||||
run: Get-ChildItem ./
|
||||
# Copy Contents of output folder to root directory
|
||||
- name: Copy Files to root & delete output directory
|
||||
run: |
|
||||
Remove-Item -Path .\* -Include @("*.cpz","*.md","*.cplz","*.json","*.dll","*.clz")
|
||||
Get-ChildItem -Path .\output\* | Copy-Item -Destination .\
|
||||
Remove-Item -Path .\output -Recurse
|
||||
# Commits the build output to the branch and tags it with the version
|
||||
- name: Commit build output and tag the commit
|
||||
shell: powershell
|
||||
run: |
|
||||
git config user.email "actions@pepperdash.com"
|
||||
git config user.name "GitHub Actions"
|
||||
git add .
|
||||
$commit = "Build $($Env:GITHUB_RUN_NUMBER) from commit: https://github.com/$($Env:GITHUB_REPOSITORY)/commit/$($Env:GITHUB_SHA)"
|
||||
Write-Host "Commit: $commit"
|
||||
git commit -m $commit
|
||||
git tag $($Env:VERSION)
|
||||
# Push the commit
|
||||
- name: Push to Builds Repo
|
||||
shell: powershell
|
||||
run: |
|
||||
$branch = $($Env:GITHUB_REF) -replace "refs/heads/"
|
||||
Write-Host "Branch: $branch"
|
||||
git push -u origin $($branch) --force
|
||||
# Push the tags
|
||||
- name: Push tags
|
||||
run: git push --tags origin
|
||||
- name: Check Directory
|
||||
run: Get-ChildItem ./
|
||||
|
||||
145
.github/workflows/main.yml
vendored
145
.github/workflows/main.yml
vendored
@@ -123,148 +123,3 @@ jobs:
|
||||
run: nuget push **/*.nupkg -source github
|
||||
- name: Publish nuget package to nuget.org
|
||||
run: nuget push **/*.nupkg -Source https://api.nuget.org/v3/index.json
|
||||
Internal_Push_Output:
|
||||
needs: Build_Project
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
# Checkout the repo
|
||||
- name: Checkout Builds Repo
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
token: ${{ secrets.BUILDS_TOKEN }}
|
||||
repository: PepperDash-Engineering/essentials-builds
|
||||
ref: ${{ Env.GITHUB_REF }}
|
||||
# Download the version artifact from the build job
|
||||
- name: Download Build Version Info
|
||||
uses: actions/download-artifact@v1
|
||||
with:
|
||||
name: Version
|
||||
- name: Check Directory
|
||||
run: Get-ChildItem "./"
|
||||
# Set the version number environment variable from the file we just downloaded
|
||||
- name: Set Version Number
|
||||
shell: powershell
|
||||
run: |
|
||||
Get-ChildItem "./Version"
|
||||
$version = Get-Content -Path ./Version/version.txt
|
||||
Write-Host "Version: $version"
|
||||
echo "VERSION=$version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
||||
Remove-Item -Path ./Version/version.txt
|
||||
Remove-Item -Path ./Version
|
||||
# Checkout/Create the branch
|
||||
- name: Checkout main branch
|
||||
run: git checkout main
|
||||
# Download the build output into the repo
|
||||
- name: Download Build output
|
||||
uses: actions/download-artifact@v1
|
||||
with:
|
||||
name: Build
|
||||
path: ./
|
||||
- name: Check directory
|
||||
run: Get-ChildItem ./
|
||||
# Unzip the build package file
|
||||
- name: Unzip Build file
|
||||
run: |
|
||||
Get-ChildItem .\*.zip | Expand-Archive -DestinationPath .\
|
||||
Remove-Item -Path .\*.zip
|
||||
- name: Check directory again
|
||||
run: Get-ChildItem ./
|
||||
# Copy Contents of output folder to root directory
|
||||
- name: Copy Files to root & delete output directory
|
||||
run: |
|
||||
Remove-Item -Path .\* -Include @("*.cpz","*.md","*.cplz","*.json","*.dll","*.clz")
|
||||
Get-ChildItem -Path .\output\* | Copy-Item -Destination .\
|
||||
Remove-Item -Path .\output -Recurse
|
||||
# Commits the build output to the branch and tags it with the version
|
||||
- name: Commit build output and tag the commit
|
||||
shell: powershell
|
||||
run: |
|
||||
git config user.email "actions@pepperdash.com"
|
||||
git config user.name "GitHub Actions"
|
||||
git add .
|
||||
$commit = "Build $($Env:GITHUB_RUN_NUMBER) from commit: https://github.com/$($Env:GITHUB_REPOSITORY)/commit/$($Env:GITHUB_SHA)"
|
||||
Write-Host "Commit: $commit"
|
||||
git commit -m $commit
|
||||
git tag $($Env:VERSION)
|
||||
# Push the commit
|
||||
- name: Push to Builds Repo
|
||||
shell: powershell
|
||||
run: git push -u origin main --force
|
||||
# Push the tags
|
||||
- name: Push tags
|
||||
run: git push --tags origin
|
||||
- name: Check Directory
|
||||
run: Get-ChildItem ./
|
||||
# This step only runs if the branch is main or release/ runs and pushes the build to the public build repo
|
||||
Public_Push_Output:
|
||||
needs: Build_Project
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
# Checkout the repo
|
||||
- name: Checkout Builds Repo
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
token: ${{ secrets.BUILDS_TOKEN }}
|
||||
repository: PepperDash/Essentials-Builds
|
||||
ref: ${{ Env.GITHUB_REF }}
|
||||
# Download the version artifact from the build job
|
||||
- name: Download Build Version Info
|
||||
uses: actions/download-artifact@v1
|
||||
with:
|
||||
name: Version
|
||||
- name: Check Directory
|
||||
run: Get-ChildItem "./"
|
||||
# Set the version number environment variable from the file we just downloaded
|
||||
- name: Set Version Number
|
||||
shell: powershell
|
||||
run: |
|
||||
Get-ChildItem "./Version"
|
||||
$version = Get-Content -Path ./Version/version.txt
|
||||
Write-Host "Version: $version"
|
||||
echo "VERSION=$version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
||||
Remove-Item -Path ./Version/version.txt
|
||||
Remove-Item -Path ./Version
|
||||
# Checkout main branch
|
||||
- name: Create new branch
|
||||
run: git checkout main
|
||||
# Download the build output into the repo
|
||||
- name: Download Build output
|
||||
uses: actions/download-artifact@v1
|
||||
with:
|
||||
name: Build
|
||||
path: ./
|
||||
- name: Check directory
|
||||
run: Get-ChildItem ./
|
||||
# Unzip the build package file
|
||||
- name: Unzip Build file
|
||||
run: |
|
||||
Get-ChildItem .\*.zip | Expand-Archive -DestinationPath .\
|
||||
Remove-Item -Path .\*.zip
|
||||
- name: Check directory again
|
||||
run: Get-ChildItem ./
|
||||
# Copy Contents of output folder to root directory
|
||||
- name: Copy Files to root & delete output directory
|
||||
run: |
|
||||
Remove-Item -Path .\* -Include @("*.cpz","*.md","*.cplz","*.json","*.dll","*.clz")
|
||||
Get-ChildItem -Path .\output\* | Copy-Item -Destination .\
|
||||
Remove-Item -Path .\output -Recurse
|
||||
# Commits the build output to the branch and tags it with the version
|
||||
- name: Commit build output and tag the commit
|
||||
shell: powershell
|
||||
run: |
|
||||
git config user.email "actions@pepperdash.com"
|
||||
git config user.name "GitHub Actions"
|
||||
git add .
|
||||
$commit = "Build $($Env:GITHUB_RUN_NUMBER) from commit: https://github.com/$($Env:GITHUB_REPOSITORY)/commit/$($Env:GITHUB_SHA)"
|
||||
Write-Host "Commit: $commit"
|
||||
git commit -m $commit
|
||||
git tag $($Env:VERSION)
|
||||
# Push the commit
|
||||
- name: Push to Builds Repo
|
||||
shell: powershell
|
||||
run: git push -u origin main --force
|
||||
# Push the tags
|
||||
- name: Push tags
|
||||
run: git push --tags origin
|
||||
- name: Check Directory
|
||||
run: Get-ChildItem ./
|
||||
|
||||
@@ -36,6 +36,7 @@ namespace PepperDash.Essentials
|
||||
Thread.MaxNumberOfUserThreads = 400;
|
||||
Global.ControlSystem = this;
|
||||
DeviceManager.Initialize(this);
|
||||
SecretsManager.Initialize();
|
||||
SystemMonitor.ProgramInitialization.ProgramInitializationUnderUserControl = true;
|
||||
}
|
||||
|
||||
@@ -71,7 +72,7 @@ namespace PepperDash.Essentials
|
||||
CrestronConsole.AddNewConsoleCommand(s =>
|
||||
{
|
||||
foreach (var tl in TieLineCollection.Default)
|
||||
CrestronConsole.ConsoleCommandResponse(" {0}\r", tl);
|
||||
CrestronConsole.ConsoleCommandResponse(" {0}\r\n", tl);
|
||||
},
|
||||
"listtielines", "Prints out all tie lines", ConsoleAccessLevelEnum.AccessOperator);
|
||||
|
||||
@@ -85,8 +86,8 @@ namespace PepperDash.Essentials
|
||||
|
||||
CrestronConsole.AddNewConsoleCommand(s =>
|
||||
{
|
||||
CrestronConsole.ConsoleCommandResponse("This system can be found at the following URLs:\r" +
|
||||
"System URL: {0}\r" +
|
||||
CrestronConsole.ConsoleCommandResponse("This system can be found at the following URLs:\r\n" +
|
||||
"System URL: {0}\r\n" +
|
||||
"Template URL: {1}", ConfigReader.ConfigObject.SystemUrl, ConfigReader.ConfigObject.TemplateUrl);
|
||||
}, "portalinfo", "Shows portal URLS from configuration", ConsoleAccessLevelEnum.AccessOperator);
|
||||
|
||||
@@ -130,29 +131,46 @@ namespace PepperDash.Essentials
|
||||
|
||||
if (CrestronEnvironment.DevicePlatform != eDevicePlatform.Server) // Handles 3-series running Windows CE OS
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Starting Essentials v{0} on 3-series Appliance", Global.AssemblyVersion);
|
||||
string userFolder;
|
||||
string nvramFolder;
|
||||
bool is4series = false;
|
||||
|
||||
if (eCrestronSeries.Series4 == (Global.ProcessorSeries & eCrestronSeries.Series4)) // Handle 4-series
|
||||
{
|
||||
is4series = true;
|
||||
// Set path to user/
|
||||
userFolder = "user";
|
||||
nvramFolder = "nvram";
|
||||
}
|
||||
else
|
||||
{
|
||||
userFolder = "User";
|
||||
nvramFolder = "Nvram";
|
||||
}
|
||||
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Starting Essentials v{0} on {1} Appliance", Global.AssemblyVersion, is4series ? "4-series" : "3-series");
|
||||
|
||||
// Check if User/ProgramX exists
|
||||
if (Directory.Exists(Global.ApplicationDirectoryPathPrefix + dirSeparator + "User"
|
||||
if (Directory.Exists(Global.ApplicationDirectoryPathPrefix + dirSeparator + userFolder
|
||||
+ dirSeparator + string.Format("program{0}", InitialParametersClass.ApplicationNumber)))
|
||||
{
|
||||
Debug.Console(0, @"User/program{0} directory found", InitialParametersClass.ApplicationNumber);
|
||||
filePathPrefix = directoryPrefix + dirSeparator + "User"
|
||||
Debug.Console(0, @"{0}/program{1} directory found", userFolder, InitialParametersClass.ApplicationNumber);
|
||||
filePathPrefix = directoryPrefix + dirSeparator + userFolder
|
||||
+ dirSeparator + string.Format("program{0}", InitialParametersClass.ApplicationNumber) + dirSeparator;
|
||||
}
|
||||
// Check if Nvram/Programx exists
|
||||
else if (Directory.Exists(directoryPrefix + dirSeparator + "Nvram"
|
||||
else if (Directory.Exists(directoryPrefix + dirSeparator + nvramFolder
|
||||
+ dirSeparator + string.Format("program{0}", InitialParametersClass.ApplicationNumber)))
|
||||
{
|
||||
Debug.Console(0, @"Nvram/program{0} directory found", InitialParametersClass.ApplicationNumber);
|
||||
filePathPrefix = directoryPrefix + dirSeparator + "Nvram"
|
||||
Debug.Console(0, @"{0}/program{1} directory found", nvramFolder, InitialParametersClass.ApplicationNumber);
|
||||
filePathPrefix = directoryPrefix + dirSeparator + nvramFolder
|
||||
+ dirSeparator + string.Format("program{0}", InitialParametersClass.ApplicationNumber) + dirSeparator;
|
||||
}
|
||||
// If neither exists, set path to User/ProgramX
|
||||
else
|
||||
{
|
||||
Debug.Console(0, @"No previous directory found. Using User/program{0}", InitialParametersClass.ApplicationNumber);
|
||||
filePathPrefix = directoryPrefix + dirSeparator + "User"
|
||||
Debug.Console(0, @"No previous directory found. Using {0}/program{1}", userFolder, InitialParametersClass.ApplicationNumber);
|
||||
filePathPrefix = directoryPrefix + dirSeparator + userFolder
|
||||
+ dirSeparator + string.Format("program{0}", InitialParametersClass.ApplicationNumber) + dirSeparator;
|
||||
}
|
||||
}
|
||||
@@ -323,7 +341,12 @@ namespace PepperDash.Essentials
|
||||
// Skip this to prevent unnecessary warnings
|
||||
if (devConf.Key == "processor")
|
||||
{
|
||||
if (devConf.Type.ToLower() != Global.ControlSystem.ControllerPrompt.ToLower())
|
||||
var prompt = Global.ControlSystem.ControllerPrompt;
|
||||
|
||||
var typeMatch = String.Equals(devConf.Type, prompt, StringComparison.OrdinalIgnoreCase) &&
|
||||
String.Equals(devConf.Type, prompt.Replace("-", ""), StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
if (!typeMatch)
|
||||
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());
|
||||
@@ -378,11 +401,11 @@ namespace PepperDash.Essentials
|
||||
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);
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Error, "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.Error, "ERROR: Creating device {0}. Skipping device. \r{1}", devConf.Key, e);
|
||||
}
|
||||
}
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "All Devices Loaded.");
|
||||
@@ -429,7 +452,7 @@ namespace PepperDash.Essentials
|
||||
|
||||
foreach (var roomConfig in ConfigReader.ConfigObject.Rooms)
|
||||
{
|
||||
var room = EssentialsRoomConfigHelper.GetRoomObject(roomConfig) as EssentialsRoomBase;
|
||||
var room = EssentialsRoomConfigHelper.GetRoomObject(roomConfig) as IEssentialsRoom;
|
||||
if (room != null)
|
||||
{
|
||||
// default IPID
|
||||
@@ -451,7 +474,7 @@ namespace PepperDash.Essentials
|
||||
}
|
||||
}
|
||||
|
||||
if (room is EssentialsHuddleSpaceRoom)
|
||||
if (room is IEssentialsHuddleSpaceRoom)
|
||||
{
|
||||
DeviceManager.AddDevice(room);
|
||||
|
||||
@@ -463,12 +486,12 @@ namespace PepperDash.Essentials
|
||||
|
||||
CreateMobileControlBridge(room);
|
||||
}
|
||||
else if (room is EssentialsHuddleVtc1Room)
|
||||
else if (room is IEssentialsHuddleVtc1Room)
|
||||
{
|
||||
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, fusionIpId, fusionJoinMapKey));
|
||||
DeviceManager.AddDevice(new EssentialsHuddleVtc1FusionController((IEssentialsHuddleVtc1Room)room, fusionIpId, fusionJoinMapKey));
|
||||
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Mobile Control Bridge...");
|
||||
|
||||
@@ -501,7 +524,7 @@ namespace PepperDash.Essentials
|
||||
|
||||
}
|
||||
|
||||
private static void CreateMobileControlBridge(EssentialsRoomBase room)
|
||||
private static void CreateMobileControlBridge(IEssentialsRoom room)
|
||||
{
|
||||
var mobileControl = GetMobileControlDevice();
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace PepperDash.Essentials.Fusion
|
||||
{
|
||||
BooleanSigData CodecIsInCall;
|
||||
|
||||
public EssentialsHuddleVtc1FusionController(EssentialsHuddleVtc1Room room, uint ipId, string joinMapKey)
|
||||
public EssentialsHuddleVtc1FusionController(IEssentialsHuddleVtc1Room room, uint ipId, string joinMapKey)
|
||||
: base(room, ipId, joinMapKey)
|
||||
{
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace PepperDash.Essentials.Fusion
|
||||
{
|
||||
try
|
||||
{
|
||||
var codec = (Room as EssentialsHuddleVtc1Room).VideoCodec;
|
||||
var codec = (Room as IEssentialsHuddleVtc1Room).VideoCodec;
|
||||
|
||||
if (codec == null)
|
||||
{
|
||||
@@ -141,7 +141,7 @@ namespace PepperDash.Essentials.Fusion
|
||||
|
||||
void codec_CallStatusChange(object sender, PepperDash.Essentials.Devices.Common.Codec.CodecCallStatusItemChangeEventArgs e)
|
||||
{
|
||||
var codec = (Room as EssentialsHuddleVtc1Room).VideoCodec;
|
||||
var codec = (Room as IEssentialsHuddleVtc1Room).VideoCodec;
|
||||
|
||||
CodecIsInCall.InputSig.BoolValue = codec.IsInCall;
|
||||
}
|
||||
@@ -174,11 +174,11 @@ namespace PepperDash.Essentials.Fusion
|
||||
// Moved to
|
||||
CurrentRoomSourceNameSig = FusionRoom.CreateOffsetStringSig(JoinMap.Display1CurrentSourceName.JoinNumber, JoinMap.Display1CurrentSourceName.AttributeName, eSigIoMask.InputSigOnly);
|
||||
// Don't think we need to get current status of this as nothing should be alive yet.
|
||||
(Room as EssentialsHuddleVtc1Room).CurrentSourceChange += Room_CurrentSourceInfoChange;
|
||||
(Room as IEssentialsHuddleVtc1Room).CurrentSourceChange += Room_CurrentSourceInfoChange;
|
||||
|
||||
|
||||
FusionRoom.SystemPowerOn.OutputSig.SetSigFalseAction((Room as EssentialsHuddleVtc1Room).PowerOnToDefaultOrLastSource);
|
||||
FusionRoom.SystemPowerOff.OutputSig.SetSigFalseAction(() => (Room as EssentialsHuddleVtc1Room).RunRouteAction("roomOff", Room.SourceListKey));
|
||||
FusionRoom.SystemPowerOn.OutputSig.SetSigFalseAction((Room as IEssentialsHuddleVtc1Room).PowerOnToDefaultOrLastSource);
|
||||
FusionRoom.SystemPowerOff.OutputSig.SetSigFalseAction(() => (Room as IEssentialsHuddleVtc1Room).RunRouteAction("roomOff", Room.SourceListKey));
|
||||
|
||||
|
||||
CrestronEnvironment.EthernetEventHandler += CrestronEnvironment_EthernetEventHandler;
|
||||
@@ -187,7 +187,7 @@ namespace PepperDash.Essentials.Fusion
|
||||
protected override void SetUpSources()
|
||||
{
|
||||
// Sources
|
||||
var dict = ConfigReader.ConfigObject.GetSourceListForKey((Room as EssentialsHuddleVtc1Room).SourceListKey);
|
||||
var dict = ConfigReader.ConfigObject.GetSourceListForKey((Room as IEssentialsHuddleVtc1Room).SourceListKey);
|
||||
if (dict != null)
|
||||
{
|
||||
// NEW PROCESS:
|
||||
@@ -238,7 +238,7 @@ namespace PepperDash.Essentials.Fusion
|
||||
else
|
||||
{
|
||||
Debug.Console(1, this, "WARNING: Config source list '{0}' not found for room '{1}'",
|
||||
(Room as EssentialsHuddleVtc1Room).SourceListKey, Room.Key);
|
||||
(Room as IEssentialsHuddleVtc1Room).SourceListKey, Room.Key);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -259,7 +259,7 @@ namespace PepperDash.Essentials.Fusion
|
||||
display.UsageTracker.DeviceUsageEnded += new EventHandler<DeviceUsageEventArgs>(UsageTracker_DeviceUsageEnded);
|
||||
}
|
||||
|
||||
var defaultDisplay = (Room as EssentialsHuddleVtc1Room).DefaultDisplay as DisplayBase;
|
||||
var defaultDisplay = (Room as IEssentialsHuddleVtc1Room).DefaultDisplay as DisplayBase;
|
||||
if (defaultDisplay == null)
|
||||
{
|
||||
Debug.Console(1, this, "Cannot link null display to Fusion because default display is null");
|
||||
@@ -332,7 +332,7 @@ namespace PepperDash.Essentials.Fusion
|
||||
string displayName = string.Format("Display {0} - ", displayIndex);
|
||||
|
||||
|
||||
if (display == (Room as EssentialsHuddleVtc1Room).DefaultDisplay)
|
||||
if (display == (Room as IEssentialsHuddleVtc1Room).DefaultDisplay)
|
||||
{
|
||||
// Power on
|
||||
var defaultDisplayPowerOn = FusionRoom.CreateOffsetBoolSig((uint)joinOffset, displayName + "Power On", eSigIoMask.InputOutputSig);
|
||||
@@ -351,7 +351,7 @@ namespace PepperDash.Essentials.Fusion
|
||||
|
||||
// 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", Room.SourceListKey); }); ;
|
||||
defaultDisplaySourceNone.OutputSig.UserObject = new Action<bool>(b => { if (!b) (Room as IEssentialsHuddleVtc1Room).RunRouteAction("roomOff", Room.SourceListKey); }); ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,27 +30,29 @@ namespace PepperDash.Essentials.Fusion
|
||||
|
||||
foreach (var display in displays.Values.Cast<DisplayBase>())
|
||||
{
|
||||
Debug.Console(2, this, "Setting up Static Asset for {0}", display.Key);
|
||||
var disp = display; // Local scope variable
|
||||
|
||||
display.UsageTracker = new UsageTracking(display) { UsageIsTracked = true };
|
||||
display.UsageTracker.DeviceUsageEnded += UsageTracker_DeviceUsageEnded;
|
||||
Debug.Console(2, this, "Setting up Static Asset for {0}", disp.Key);
|
||||
|
||||
disp.UsageTracker = new UsageTracking(disp) { UsageIsTracked = true };
|
||||
disp.UsageTracker.DeviceUsageEnded += UsageTracker_DeviceUsageEnded;
|
||||
|
||||
var dispPowerOnAction = new Action<bool>(b =>
|
||||
{
|
||||
if (!b)
|
||||
{
|
||||
display.PowerOn();
|
||||
disp.PowerOn();
|
||||
}
|
||||
});
|
||||
var dispPowerOffAction = new Action<bool>(b =>
|
||||
{
|
||||
if (!b)
|
||||
{
|
||||
display.PowerOff();
|
||||
disp.PowerOff();
|
||||
}
|
||||
});
|
||||
|
||||
var deviceConfig = ConfigReader.ConfigObject.GetDeviceForKey(display.Key);
|
||||
var deviceConfig = ConfigReader.ConfigObject.GetDeviceForKey(disp.Key);
|
||||
|
||||
FusionAsset tempAsset;
|
||||
|
||||
@@ -63,30 +65,36 @@ namespace PepperDash.Essentials.Fusion
|
||||
{
|
||||
// Create a new asset
|
||||
tempAsset = new FusionAsset(FusionRoomGuids.GetNextAvailableAssetNumber(FusionRoom),
|
||||
display.Name, "Display", "");
|
||||
disp.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;
|
||||
|
||||
var defaultTwoWayDisplay = display as IHasPowerControlWithFeedback;
|
||||
if (dispAsset != null)
|
||||
{
|
||||
dispAsset.PowerOn.OutputSig.UserObject = dispPowerOnAction;
|
||||
dispAsset.PowerOff.OutputSig.UserObject = dispPowerOffAction;
|
||||
|
||||
// Use extension methods
|
||||
dispAsset.TrySetMakeModel(disp);
|
||||
dispAsset.TryLinkAssetErrorToCommunication(disp);
|
||||
}
|
||||
|
||||
var defaultTwoWayDisplay = disp as IHasPowerControlWithFeedback;
|
||||
if (defaultTwoWayDisplay != null)
|
||||
{
|
||||
defaultTwoWayDisplay.PowerIsOnFeedback.LinkInputSig(FusionRoom.DisplayPowerOn.InputSig);
|
||||
if (display is IDisplayUsage)
|
||||
if (disp is IDisplayUsage)
|
||||
{
|
||||
(display as IDisplayUsage).LampHours.LinkInputSig(FusionRoom.DisplayUsage.InputSig);
|
||||
(disp as IDisplayUsage).LampHours.LinkInputSig(FusionRoom.DisplayUsage.InputSig);
|
||||
}
|
||||
|
||||
defaultTwoWayDisplay.PowerIsOnFeedback.LinkInputSig(dispAsset.PowerOn.InputSig);
|
||||
if(dispAsset != null)
|
||||
defaultTwoWayDisplay.PowerIsOnFeedback.LinkInputSig(dispAsset.PowerOn.InputSig);
|
||||
}
|
||||
|
||||
// Use extension methods
|
||||
dispAsset.TrySetMakeModel(display);
|
||||
dispAsset.TryLinkAssetErrorToCommunication(display);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
|
||||
@@ -137,7 +137,7 @@
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Room\Config\EssentialsDualDisplayRoomPropertiesConfig.cs" />
|
||||
<Compile Include="Room\Config\EssentialsNDisplayRoomPropertiesConfig.cs" />
|
||||
<Compile Include="Room\Config\DDVC01RoomPropertiesConfig.cs" />
|
||||
<Compile Include="Room\Config\SimplRoomPropertiesConfig.cs" />
|
||||
<Compile Include="Room\Config\EssentialsPresentationPropertiesConfig.cs" />
|
||||
<Compile Include="Room\Config\EssentialsHuddleRoomPropertiesConfig.cs" />
|
||||
<Compile Include="Room\Config\EssentialsHuddleVtc1PropertiesConfig.cs" />
|
||||
@@ -149,6 +149,7 @@
|
||||
<Compile Include="Room\Types\EssentialsNDisplayRoomBase.cs" />
|
||||
<Compile Include="Room\Config\EssentialsRoomConfig.cs" />
|
||||
<Compile Include="Room\Types\EssentialsTechRoom.cs" />
|
||||
<Compile Include="Room\Types\IEssentialsHuddleSpaceRoom.cs" />
|
||||
<Compile Include="UIDrivers\Environment Drivers\EssentialsEnvironmentDriver.cs" />
|
||||
<Compile Include="UIDrivers\Environment Drivers\EssentialsLightingDriver.cs" />
|
||||
<Compile Include="UIDrivers\Environment Drivers\EssentialsShadeDriver.cs" />
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace PepperDash.Essentials.Room.Config
|
||||
/// Gets and operating, standalone emergegncy object that can be plugged into a room.
|
||||
/// Returns null if there is no emergency defined
|
||||
/// </summary>
|
||||
public static EssentialsRoomEmergencyBase GetEmergency(EssentialsRoomPropertiesConfig props, EssentialsRoomBase room)
|
||||
public static EssentialsRoomEmergencyBase GetEmergency(EssentialsRoomPropertiesConfig props, IEssentialsRoom room)
|
||||
{
|
||||
// This emergency
|
||||
var emergency = props.Emergency;
|
||||
@@ -96,7 +96,7 @@ namespace PepperDash.Essentials.Room.Config
|
||||
if (behaviour == "trackroomstate")
|
||||
{
|
||||
// Tie LED enable to room power state
|
||||
var essRoom = room as EssentialsRoomBase;
|
||||
var essRoom = room as IEssentialsRoom;
|
||||
essRoom.OnFeedback.OutputChange += (o, a) =>
|
||||
{
|
||||
if (essRoom.OnFeedback.BoolValue)
|
||||
@@ -196,9 +196,20 @@ namespace PepperDash.Essentials.Room.Config
|
||||
public string DefaultAudioKey { get; set; }
|
||||
[JsonProperty("sourceListKey")]
|
||||
public string SourceListKey { get; set; }
|
||||
[JsonProperty("destinationListKey")]
|
||||
public string DestinationListKey { get; set; }
|
||||
[JsonProperty("defaultSourceItem")]
|
||||
public string DefaultSourceItem { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates if the room supports advanced sharing
|
||||
/// </summary>
|
||||
[JsonProperty("supportsAdvancedSharing")]
|
||||
public bool SupportsAdvancedSharing { get; set; }
|
||||
/// <summary>
|
||||
/// Indicates if non-tech users can change the share mode
|
||||
/// </summary>
|
||||
[JsonProperty("userCanChangeShareMode")]
|
||||
public bool UserCanChangeShareMode { get; set; }
|
||||
}
|
||||
|
||||
public class EssentialsConferenceRoomPropertiesConfig : EssentialsAvRoomPropertiesConfig
|
||||
|
||||
@@ -5,30 +5,62 @@ namespace PepperDash.Essentials.Room.Config
|
||||
{
|
||||
public class EssentialsTechRoomConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// The key of the dummy device used to enable routing
|
||||
/// </summary>
|
||||
[JsonProperty("dummySourceKey")]
|
||||
public string DummySourceKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The keys of the displays assigned to this room
|
||||
/// </summary>
|
||||
[JsonProperty("displays")]
|
||||
public List<string> Displays;
|
||||
public List<string> Displays { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The keys of the tuners assinged to this room
|
||||
/// </summary>
|
||||
[JsonProperty("tuners")]
|
||||
public List<string> Tuners;
|
||||
public List<string> Tuners { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// PIN to access the room as a normal user
|
||||
/// </summary>
|
||||
[JsonProperty("userPin")]
|
||||
public string UserPin;
|
||||
public string UserPin { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// PIN to access the room as a tech user
|
||||
/// </summary>
|
||||
[JsonProperty("techPin")]
|
||||
public string TechPin;
|
||||
public string TechPin { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Name of the presets file. Path prefix is assumed to be /html/presets/lists/
|
||||
/// </summary>
|
||||
[JsonProperty("presetsFileName")]
|
||||
public string PresetsFileName;
|
||||
public string PresetsFileName { get; set; }
|
||||
|
||||
[JsonProperty("scheduledEvents")]
|
||||
public List<ScheduledEventConfig> ScheduledEvents;
|
||||
public List<ScheduledEventConfig> ScheduledEvents { get; set; }
|
||||
|
||||
[JsonProperty("isPrimary")] public bool IsPrimary;
|
||||
/// <summary>
|
||||
/// Indicates that the room is the primary when true
|
||||
/// </summary>
|
||||
[JsonProperty("isPrimary")]
|
||||
public bool IsPrimary { get; set; }
|
||||
|
||||
[JsonProperty("isTvPresetsProvider")] public bool IsTvPresetsProvider;
|
||||
/// <summary>
|
||||
/// Indicates which tuners should mirror preset recall when two rooms are configured in a primary->secondary scenario
|
||||
/// </summary>
|
||||
[JsonProperty("mirroredTuners")]
|
||||
public Dictionary<uint, string> MirroredTuners { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates the room
|
||||
/// </summary>
|
||||
[JsonProperty("isTvPresetsProvider")]
|
||||
public bool IsTvPresetsProvider;
|
||||
|
||||
public EssentialsTechRoomConfig()
|
||||
{
|
||||
|
||||
@@ -8,19 +8,19 @@ using Newtonsoft.Json;
|
||||
|
||||
namespace PepperDash.Essentials.Room.Config
|
||||
{
|
||||
public class DDVC01RoomPropertiesConfig : EssentialsHuddleVtc1PropertiesConfig
|
||||
public class SimplRoomPropertiesConfig : EssentialsHuddleVtc1PropertiesConfig
|
||||
{
|
||||
[JsonProperty("roomPhoneNumber")]
|
||||
public string RoomPhoneNumber { get; set; }
|
||||
[JsonProperty("roomURI")]
|
||||
public string RoomURI { get; set; }
|
||||
[JsonProperty("speedDials")]
|
||||
public List<DDVC01SpeedDial> SpeedDials { get; set; }
|
||||
public List<SimplSpeedDial> SpeedDials { get; set; }
|
||||
[JsonProperty("volumeSliderNames")]
|
||||
public List<string> VolumeSliderNames { get; set; }
|
||||
}
|
||||
|
||||
public class DDVC01SpeedDial
|
||||
public class SimplSpeedDial
|
||||
{
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
@@ -17,11 +17,11 @@ namespace PepperDash.Essentials.Room
|
||||
|
||||
public class EssentialsRoomEmergencyContactClosure : EssentialsRoomEmergencyBase
|
||||
{
|
||||
EssentialsRoomBase Room;
|
||||
IEssentialsRoom Room;
|
||||
string Behavior;
|
||||
bool TriggerOnClose;
|
||||
|
||||
public EssentialsRoomEmergencyContactClosure(string key, EssentialsRoomEmergencyConfig config, EssentialsRoomBase room) :
|
||||
public EssentialsRoomEmergencyContactClosure(string key, EssentialsRoomEmergencyConfig config, IEssentialsRoom room) :
|
||||
base(key)
|
||||
{
|
||||
Room = room;
|
||||
|
||||
@@ -274,10 +274,23 @@ namespace PepperDash.Essentials
|
||||
|
||||
CallTypeFeedback = new IntFeedback(() => 0);
|
||||
|
||||
SourceListKey = "default";
|
||||
SetSourceListKey();
|
||||
EnablePowerOnToLastSource = true;
|
||||
}
|
||||
|
||||
private void SetSourceListKey()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(PropertiesConfig.SourceListKey))
|
||||
{
|
||||
SetSourceListKey(PropertiesConfig.SourceListKey);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetSourceListKey(Key);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void InitializeDisplay(DisplayBase disp)
|
||||
{
|
||||
if (disp != null)
|
||||
@@ -333,7 +346,6 @@ namespace PepperDash.Essentials
|
||||
|
||||
this.LogoUrlLightBkgnd = PropertiesConfig.LogoLight.GetLogoUrlLight();
|
||||
this.LogoUrlDarkBkgnd = PropertiesConfig.LogoDark.GetLogoUrlDark();
|
||||
this.SourceListKey = PropertiesConfig.SourceListKey;
|
||||
this.DefaultSourceItem = PropertiesConfig.DefaultSourceItem;
|
||||
this.DefaultVolume = (ushort)(PropertiesConfig.Volumes.Master.Level * 65535 / 100);
|
||||
|
||||
@@ -633,9 +645,9 @@ namespace PepperDash.Essentials
|
||||
public static void AllRoomsOff()
|
||||
{
|
||||
var allRooms = DeviceManager.AllDevices.Where(d =>
|
||||
d is EssentialsHuddleSpaceRoom && !(d as EssentialsHuddleSpaceRoom).ExcludeFromGlobalFunctions);
|
||||
d is IEssentialsHuddleSpaceRoom && !(d as IEssentialsHuddleSpaceRoom).ExcludeFromGlobalFunctions);
|
||||
foreach (var room in allRooms)
|
||||
(room as EssentialsHuddleSpaceRoom).RunRouteAction("roomOff", (room as EssentialsHuddleSpaceRoom).SourceListKey);
|
||||
(room as IEssentialsHuddleSpaceRoom).RunRouteAction("roomOff", (room as IEssentialsHuddleSpaceRoom).SourceListKey);
|
||||
}
|
||||
|
||||
#region IPrivacy Members
|
||||
|
||||
@@ -13,7 +13,7 @@ using PepperDash.Essentials.Room.Config;
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
{
|
||||
public class EssentialsHuddleSpaceRoom : EssentialsRoomBase, IHasCurrentSourceInfoChange, IRunRouteAction, IRunDefaultPresentRoute, IHasCurrentVolumeControls, IHasDefaultDisplay
|
||||
public class EssentialsHuddleSpaceRoom : EssentialsRoomBase, IEssentialsHuddleSpaceRoom
|
||||
{
|
||||
public event EventHandler<VolumeDeviceChangeEventArgs> CurrentVolumeDeviceChange;
|
||||
public event SourceInfoChangeHandler CurrentSourceChange;
|
||||
@@ -201,11 +201,25 @@ namespace PepperDash.Essentials
|
||||
IsCoolingDownFeedback.FireUpdate();
|
||||
};
|
||||
}
|
||||
|
||||
SetSourceListKey();
|
||||
|
||||
SourceListKey = "default";
|
||||
EnablePowerOnToLastSource = true;
|
||||
}
|
||||
|
||||
private void SetSourceListKey()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(PropertiesConfig.SourceListKey))
|
||||
{
|
||||
SetSourceListKey(PropertiesConfig.SourceListKey);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetSourceListKey(Key);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected override void CustomSetConfig(DeviceConfig config)
|
||||
{
|
||||
var newPropertiesConfig = JsonConvert.DeserializeObject<EssentialsHuddleRoomPropertiesConfig>(config.Properties.ToString());
|
||||
@@ -256,7 +270,6 @@ namespace PepperDash.Essentials
|
||||
|
||||
this.LogoUrlLightBkgnd = PropertiesConfig.LogoLight.GetLogoUrlLight();
|
||||
this.LogoUrlDarkBkgnd = PropertiesConfig.LogoDark.GetLogoUrlDark();
|
||||
this.SourceListKey = PropertiesConfig.SourceListKey;
|
||||
this.DefaultSourceItem = PropertiesConfig.DefaultSourceItem;
|
||||
this.DefaultVolume = (ushort)(PropertiesConfig.Volumes.Master.Level * 65535 / 100);
|
||||
|
||||
|
||||
@@ -13,13 +13,13 @@ using PepperDash.Essentials.Room.Config;
|
||||
using PepperDash.Essentials.Devices.Common.Codec;
|
||||
using PepperDash.Essentials.Devices.Common.VideoCodec;
|
||||
using PepperDash.Essentials.Devices.Common.AudioCodec;
|
||||
using PepperDash_Essentials_Core.DeviceTypeInterfaces;
|
||||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
{
|
||||
public class EssentialsHuddleVtc1Room : EssentialsRoomBase, IHasCurrentSourceInfoChange,
|
||||
IPrivacy, IHasCurrentVolumeControls, IRunRouteAction, IRunDefaultCallRoute, IHasVideoCodec, IHasAudioCodec, IHasDefaultDisplay, IHasInCallFeedback
|
||||
{
|
||||
public class EssentialsHuddleVtc1Room : EssentialsRoomBase, IEssentialsHuddleVtc1Room
|
||||
{
|
||||
private bool _codecExternalSourceChange;
|
||||
public event EventHandler<VolumeDeviceChangeEventArgs> CurrentVolumeDeviceChange;
|
||||
public event SourceInfoChangeHandler CurrentSourceChange;
|
||||
|
||||
@@ -51,20 +51,6 @@ namespace PepperDash.Essentials
|
||||
|
||||
//************************
|
||||
|
||||
public override string SourceListKey
|
||||
{
|
||||
get
|
||||
{
|
||||
return _SourceListKey;
|
||||
}
|
||||
set
|
||||
{
|
||||
_SourceListKey = value;
|
||||
SetCodecExternalSources();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
protected override Func<bool> OnFeedbackFunc
|
||||
{
|
||||
get
|
||||
@@ -192,10 +178,12 @@ namespace PepperDash.Essentials
|
||||
handler(_CurrentSourceInfo, ChangeType.DidChange);
|
||||
|
||||
var vc = VideoCodec as IHasExternalSourceSwitching;
|
||||
if (vc != null)
|
||||
if (vc != null && !_codecExternalSourceChange)
|
||||
{
|
||||
vc.SetSelectedSource(CurrentSourceInfoKey);
|
||||
}
|
||||
|
||||
_codecExternalSourceChange = false;
|
||||
}
|
||||
}
|
||||
SourceListItem _CurrentSourceInfo;
|
||||
@@ -338,7 +326,8 @@ namespace PepperDash.Essentials
|
||||
|
||||
CallTypeFeedback = new IntFeedback(() => 0);
|
||||
|
||||
SourceListKey = "default";
|
||||
SetSourceListKey();
|
||||
|
||||
EnablePowerOnToLastSource = true;
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -347,6 +336,21 @@ namespace PepperDash.Essentials
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void SetSourceListKey()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(PropertiesConfig.SourceListKey))
|
||||
{
|
||||
SetSourceListKey(PropertiesConfig.SourceListKey);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetSourceListKey(Key);
|
||||
}
|
||||
|
||||
SetCodecExternalSources();
|
||||
}
|
||||
|
||||
protected override void CustomSetConfig(DeviceConfig config)
|
||||
{
|
||||
var newPropertiesConfig = JsonConvert.DeserializeObject<EssentialsHuddleVtc1PropertiesConfig>(config.Properties.ToString());
|
||||
@@ -370,13 +374,14 @@ namespace PepperDash.Essentials
|
||||
this.LogoUrlLightBkgnd = PropertiesConfig.LogoLight.GetLogoUrlLight();
|
||||
this.LogoUrlDarkBkgnd = PropertiesConfig.LogoDark.GetLogoUrlDark();
|
||||
|
||||
this.SourceListKey = PropertiesConfig.SourceListKey;
|
||||
this.DefaultSourceItem = PropertiesConfig.DefaultSourceItem;
|
||||
this.DefaultVolume = (ushort)(PropertiesConfig.Volumes.Master.Level * 65535 / 100);
|
||||
|
||||
return base.CustomActivate();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@@ -418,6 +423,12 @@ namespace PepperDash.Essentials
|
||||
return true;
|
||||
}
|
||||
|
||||
public void RunRouteActionCodec(string routeKey, string sourceListKey)
|
||||
{
|
||||
_codecExternalSourceChange = true;
|
||||
RunRouteAction(routeKey, sourceListKey);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@@ -597,12 +608,21 @@ namespace PepperDash.Essentials
|
||||
if (VideoCodec.UsageTracker.InUseTracker.InUseFeedback.BoolValue)
|
||||
{
|
||||
Debug.Console(1, this, "Video Codec in use, deactivating standby on codec");
|
||||
VideoCodec.StandbyDeactivate();
|
||||
}
|
||||
|
||||
if (VideoCodec.StandbyIsOnFeedback.BoolValue)
|
||||
{
|
||||
VideoCodec.StandbyDeactivate();
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(1, this, "Video codec not in standby. No need to wake.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(1, this, "Room OnFeedback state: {0}", OnFeedback.BoolValue);
|
||||
}
|
||||
|
||||
// report back when done
|
||||
@@ -712,10 +732,10 @@ namespace PepperDash.Essentials
|
||||
/// </summary>
|
||||
public static void AllRoomsOff()
|
||||
{
|
||||
var allRooms = DeviceManager.AllDevices.Where(d =>
|
||||
d is EssentialsHuddleSpaceRoom && !(d as EssentialsHuddleSpaceRoom).ExcludeFromGlobalFunctions);
|
||||
var allRooms = DeviceManager.AllDevices.Where(d =>
|
||||
d is IEssentialsRoom && !(d as IEssentialsHuddleSpaceRoom).ExcludeFromGlobalFunctions);
|
||||
foreach (var room in allRooms)
|
||||
(room as EssentialsHuddleSpaceRoom).RunRouteAction("roomOff");
|
||||
(room as IEssentialsHuddleSpaceRoom).RunRouteAction("roomOff");
|
||||
}
|
||||
|
||||
|
||||
@@ -738,7 +758,7 @@ namespace PepperDash.Essentials
|
||||
x => x.DestinationKey == VideoCodec.Key && x.DestinationPort == videoCodecWithExternalSwitching.ExternalSourceInputPort).DestinationPort;
|
||||
|
||||
videoCodecWithExternalSwitching.ClearExternalSources();
|
||||
videoCodecWithExternalSwitching.RunRouteAction = RunRouteAction;
|
||||
videoCodecWithExternalSwitching.RunRouteAction = RunRouteActionCodec;
|
||||
var srcList = ConfigReader.ConfigObject.SourceLists.SingleOrDefault(x => x.Key == SourceListKey).Value.OrderBy(kv => kv.Value.Order); ;
|
||||
|
||||
foreach (var kvp in srcList)
|
||||
|
||||
@@ -107,14 +107,18 @@ namespace PepperDash.Essentials
|
||||
|
||||
private void TunerPresetsOnPresetRecalled(ISetTopBoxNumericKeypad device, string channel)
|
||||
{
|
||||
//Debug.Console(2, this, "TunerPresetsOnPresetRecalled");
|
||||
|
||||
if (!_currentPresets.ContainsKey(device.Key))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//Debug.Console(2, this, "Tuner Key: {0} Channel: {1}", device.Key, channel);
|
||||
|
||||
_currentPresets[device.Key] = channel;
|
||||
|
||||
if (!CurrentPresetsFeedbacks.ContainsKey(device.Key))
|
||||
if (CurrentPresetsFeedbacks.ContainsKey(device.Key))
|
||||
{
|
||||
CurrentPresetsFeedbacks[device.Key].FireUpdate();
|
||||
}
|
||||
@@ -183,11 +187,12 @@ namespace PepperDash.Essentials
|
||||
|
||||
var roomEvent = _roomScheduledEventGroup.ScheduledEvents[scheduledEvent.Key];
|
||||
|
||||
if (!SchedulerUtilities.CheckEventTimeForMatch(roomEvent, DateTime.Parse(scheduledEvent.Time)) &&
|
||||
!SchedulerUtilities.CheckEventRecurrenceForMatch(roomEvent, scheduledEvent.Days))
|
||||
{
|
||||
return;
|
||||
}
|
||||
//if (SchedulerUtilities.CheckEventTimeForMatch(roomEvent, DateTime.Parse(scheduledEvent.Time)) &&
|
||||
// SchedulerUtilities.CheckEventRecurrenceForMatch(roomEvent, scheduledEvent.Days))
|
||||
//{
|
||||
// Debug.Console(1, this, "Existing event matches new event properties. Nothing to update");
|
||||
// return;
|
||||
//}
|
||||
|
||||
Debug.Console(1, this,
|
||||
"Existing event does not match new config properties. Deleting existing event '{0}' and creating new event from configuration",
|
||||
@@ -373,13 +378,32 @@ Params: {2}"
|
||||
uint i;
|
||||
if (_config.IsPrimary)
|
||||
{
|
||||
i = 0;
|
||||
foreach (var feedback in CurrentPresetsFeedbacks)
|
||||
Debug.Console(1, this, "Linking Primary system Tuner Preset Mirroring");
|
||||
if (_config.MirroredTuners != null && _config.MirroredTuners.Count > 0)
|
||||
{
|
||||
feedback.Value.LinkInputSig(trilist.StringInput[(uint) (joinMap.CurrentPreset.JoinNumber + i)]);
|
||||
i++;
|
||||
foreach (var tuner in _config.MirroredTuners)
|
||||
{
|
||||
var f = CurrentPresetsFeedbacks[tuner.Value];
|
||||
|
||||
if (f == null)
|
||||
{
|
||||
Debug.Console(1, this, "Unable to find feedback with key: {0}", tuner.Value);
|
||||
continue;
|
||||
}
|
||||
|
||||
var join = joinMap.CurrentPreset.JoinNumber + tuner.Key;
|
||||
f.LinkInputSig(trilist.StringInput[(uint)(join)]);
|
||||
Debug.Console(1, this, "Linked Current Preset feedback for tuner: {0} to serial join: {1}", tuner.Value, join);
|
||||
}
|
||||
}
|
||||
|
||||
//i = 0;
|
||||
//foreach (var feedback in CurrentPresetsFeedbacks)
|
||||
//{
|
||||
// feedback.Value.LinkInputSig(trilist.StringInput[(uint) (joinMap.CurrentPreset.JoinNumber + i)]);
|
||||
// i++;
|
||||
//}
|
||||
|
||||
trilist.OnlineStatusChange += (device, args) =>
|
||||
{
|
||||
if (!args.DeviceOnLine)
|
||||
@@ -395,15 +419,35 @@ Params: {2}"
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
i = 0;
|
||||
foreach (var setTopBox in _tuners)
|
||||
else
|
||||
{
|
||||
var tuner = setTopBox;
|
||||
Debug.Console(1, this, "Linking Secondary system Tuner Preset Mirroring");
|
||||
|
||||
trilist.SetStringSigAction(joinMap.CurrentPreset.JoinNumber + i, s => _tunerPresets.Dial(s, tuner.Value));
|
||||
if (_config.MirroredTuners != null && _config.MirroredTuners.Count > 0)
|
||||
{
|
||||
foreach (var tuner in _config.MirroredTuners)
|
||||
{
|
||||
var t = _tuners[tuner.Value];
|
||||
|
||||
i++;
|
||||
if (t == null)
|
||||
{
|
||||
Debug.Console(1, this, "Unable to find tuner with key: {0}", tuner.Value);
|
||||
continue;
|
||||
}
|
||||
|
||||
var join = joinMap.CurrentPreset.JoinNumber + tuner.Key;
|
||||
trilist.SetStringSigAction(join, s => _tunerPresets.Dial(s, t));
|
||||
Debug.Console(1, this, "Linked preset recall action for tuner: {0} to serial join: {1}", tuner.Value, join);
|
||||
}
|
||||
|
||||
//foreach (var setTopBox in _tuners)
|
||||
//{
|
||||
// var tuner = setTopBox;
|
||||
|
||||
// trilist.SetStringSigAction(joinMap.CurrentPreset.JoinNumber + i, s => _tunerPresets.Dial(s, tuner.Value));
|
||||
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||
using PepperDash.Essentials.Room.Config;
|
||||
using PepperDash.Essentials.Core.Devices;
|
||||
using PepperDash.Essentials.Devices.Common.Codec;
|
||||
using PepperDash.Essentials.Devices.Common.VideoCodec;
|
||||
using PepperDash.Essentials.Devices.Common.AudioCodec;
|
||||
|
||||
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
{
|
||||
public interface IEssentialsHuddleSpaceRoom : IEssentialsRoom, IHasCurrentSourceInfoChange, IRunRouteAction, IRunDefaultPresentRoute, IHasDefaultDisplay
|
||||
{
|
||||
bool ExcludeFromGlobalFunctions { get; }
|
||||
|
||||
void RunRouteAction(string routeKey);
|
||||
|
||||
EssentialsHuddleRoomPropertiesConfig PropertiesConfig { get; }
|
||||
|
||||
IBasicVolumeControls CurrentVolumeControls { get; }
|
||||
|
||||
event EventHandler<VolumeDeviceChangeEventArgs> CurrentVolumeDeviceChange;
|
||||
}
|
||||
|
||||
public interface IEssentialsHuddleVtc1Room : IEssentialsRoom, IHasCurrentSourceInfoChange,
|
||||
IPrivacy, IHasCurrentVolumeControls, IRunRouteAction, IRunDefaultCallRoute, IHasVideoCodec, IHasAudioCodec, IHasDefaultDisplay, IHasInCallFeedback
|
||||
{
|
||||
EssentialsHuddleVtc1PropertiesConfig PropertiesConfig { get; }
|
||||
|
||||
void RunRouteAction(string routeKey);
|
||||
|
||||
IHasScheduleAwareness ScheduleSource { get; }
|
||||
|
||||
BoolFeedback InCallFeedback { get; }
|
||||
|
||||
BoolFeedback PrivacyModeIsOnFeedback { get; }
|
||||
|
||||
string DefaultCodecRouteString { get; }
|
||||
}
|
||||
}
|
||||
@@ -79,6 +79,16 @@ namespace PepperDash.Essentials
|
||||
Panel = new Tsw1052(id, Global.ControlSystem);
|
||||
else if (type == "tsw1060")
|
||||
Panel = new Tsw1060(id, Global.ControlSystem);
|
||||
else if (type == "tsw570")
|
||||
Panel = new Tsw570(id, Global.ControlSystem);
|
||||
else if (type == "tsw770")
|
||||
Panel = new Tsw770(id, Global.ControlSystem);
|
||||
else if (type == "ts770")
|
||||
Panel = new Ts770(id, Global.ControlSystem);
|
||||
else if (type == "tsw1070")
|
||||
Panel = new Tsw1070(id, Global.ControlSystem);
|
||||
else if (type == "ts1070")
|
||||
Panel = new Ts1070(id, Global.ControlSystem);
|
||||
else
|
||||
{
|
||||
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "WARNING: Cannot create TSW controller with type '{0}'", type);
|
||||
@@ -203,7 +213,7 @@ namespace PepperDash.Essentials
|
||||
{
|
||||
public EssentialsTouchpanelControllerFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "tsw550", "tsw750", "tsw1050", "tsw560", "tsw760", "tsw1060", "xpanel" };
|
||||
TypeNames = new List<string>() { "tsw550", "tsw750", "tsw1050", "tsw560", "tsw760", "tsw1060", "tsw570", "tsw770", "ts770", "tsw1070", "ts1070", "xpanel" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
@@ -222,7 +232,7 @@ namespace PepperDash.Essentials
|
||||
|
||||
// spin up different room drivers depending on room type
|
||||
var room = DeviceManager.GetDeviceForKey(props.DefaultRoomKey);
|
||||
if (room is EssentialsHuddleSpaceRoom)
|
||||
if (room is IEssentialsHuddleSpaceRoom)
|
||||
{
|
||||
// Screen Saver Driver
|
||||
mainDriver.ScreenSaverController = new ScreenSaverController(mainDriver, props);
|
||||
@@ -236,7 +246,7 @@ namespace PepperDash.Essentials
|
||||
var avDriver = new EssentialsHuddlePanelAvFunctionsDriver(mainDriver, props);
|
||||
avDriver.DefaultRoomKey = props.DefaultRoomKey;
|
||||
mainDriver.AvDriver = avDriver;
|
||||
avDriver.CurrentRoom = room as EssentialsHuddleSpaceRoom;
|
||||
avDriver.CurrentRoom = room as IEssentialsHuddleSpaceRoom;
|
||||
|
||||
// Environment Driver
|
||||
if (avDriver.CurrentRoom.PropertiesConfig.Environment != null && avDriver.CurrentRoom.PropertiesConfig.Environment.DeviceKeys.Count > 0)
|
||||
@@ -270,7 +280,7 @@ namespace PepperDash.Essentials
|
||||
tsw.Down.UserObject = new Action<bool>(avDriver.VolumeDownPress);
|
||||
}
|
||||
}
|
||||
else if (room is EssentialsHuddleVtc1Room)
|
||||
else if (room is IEssentialsHuddleVtc1Room)
|
||||
{
|
||||
Debug.Console(0, panelController, "Adding huddle space VTC AV driver");
|
||||
|
||||
@@ -284,11 +294,11 @@ namespace PepperDash.Essentials
|
||||
var avDriver = new EssentialsHuddleVtc1PanelAvFunctionsDriver(mainDriver, props);
|
||||
|
||||
var codecDriver = new PepperDash.Essentials.UIDrivers.VC.EssentialsVideoCodecUiDriver(panelController.Panel, avDriver,
|
||||
(room as EssentialsHuddleVtc1Room).VideoCodec, mainDriver.HeaderDriver);
|
||||
(room as IEssentialsHuddleVtc1Room).VideoCodec, mainDriver.HeaderDriver);
|
||||
avDriver.SetVideoCodecDriver(codecDriver);
|
||||
avDriver.DefaultRoomKey = props.DefaultRoomKey;
|
||||
mainDriver.AvDriver = avDriver;
|
||||
avDriver.CurrentRoom = room as EssentialsHuddleVtc1Room;
|
||||
avDriver.CurrentRoom = room as IEssentialsHuddleVtc1Room;
|
||||
|
||||
// Environment Driver
|
||||
if (avDriver.CurrentRoom.PropertiesConfig.Environment != null && avDriver.CurrentRoom.PropertiesConfig.Environment.DeviceKeys.Count > 0)
|
||||
|
||||
@@ -764,6 +764,10 @@ namespace PepperDash.Essentials
|
||||
/// </summary>
|
||||
public const uint NextMeetingModalVisible = 15049;
|
||||
/// <summary>
|
||||
/// 15050
|
||||
/// </summary>
|
||||
public const uint NextMeetingNotificationRibbonVisible = 15050;
|
||||
/// <summary>
|
||||
/// 15051
|
||||
/// </summary>
|
||||
public const uint Display1SelectPressAndFb = 15051;
|
||||
|
||||
@@ -146,18 +146,18 @@
|
||||
|
||||
// }
|
||||
|
||||
// void CurrentRoom_CurrentSourceInfoChange(EssentialsRoomBase room, SourceListItem info, ChangeType type)
|
||||
// void CurrentRoom_CurrentSourceInfoChange(IEssentialsRoom room, SourceListItem info, ChangeType type)
|
||||
// {
|
||||
|
||||
// }
|
||||
|
||||
// void CurrentRoom_CurrentDisplay1SourceChange(EssentialsRoomBase room, SourceListItem info, ChangeType type)
|
||||
// void CurrentRoom_CurrentDisplay1SourceChange(IEssentialsRoom room, SourceListItem info, ChangeType type)
|
||||
// {
|
||||
// TriList.StringInput[UIStringJoin.Display1SourceLabel].StringValue = PendingSource.PreferredName;
|
||||
|
||||
// }
|
||||
|
||||
// void CurrentRoom_CurrentDisplay2SourceChange(EssentialsRoomBase room, SourceListItem info, ChangeType type)
|
||||
// void CurrentRoom_CurrentDisplay2SourceChange(IEssentialsRoom room, SourceListItem info, ChangeType type)
|
||||
// {
|
||||
// TriList.StringInput[UIStringJoin.Display2SourceLabel].StringValue = PendingSource.PreferredName;
|
||||
// }
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace PepperDash.Essentials
|
||||
CaretInterlock = new JoinedSigInterlock(TriList);
|
||||
}
|
||||
|
||||
void SetUpGear(IAVDriver avDriver, EssentialsRoomBase currentRoom)
|
||||
void SetUpGear(IAVDriver avDriver, IEssentialsRoom currentRoom)
|
||||
{
|
||||
// Gear
|
||||
TriList.SetString(UIStringJoin.HeaderButtonIcon5, "Gear");
|
||||
@@ -105,7 +105,7 @@ namespace PepperDash.Essentials
|
||||
{
|
||||
string message = null;
|
||||
var room = DeviceManager.GetDeviceForKey(Config.DefaultRoomKey)
|
||||
as EssentialsHuddleSpaceRoom;
|
||||
as IEssentialsHuddleSpaceRoom;
|
||||
if (room != null)
|
||||
message = room.PropertiesConfig.HelpMessage;
|
||||
else
|
||||
@@ -207,6 +207,7 @@ namespace PepperDash.Essentials
|
||||
//TriList.SetUshort(UIUshortJoin.CallHeaderButtonMode, 1);
|
||||
|
||||
// Set the call status text
|
||||
Debug.Console(1, "Active Call Count: {0}", codec.ActiveCalls.Count);
|
||||
if (codec.ActiveCalls.Count > 0)
|
||||
{
|
||||
if (codec.ActiveCalls.Count == 1)
|
||||
@@ -221,7 +222,7 @@ namespace PepperDash.Essentials
|
||||
/// <summary>
|
||||
/// Sets up Header Buttons for the EssentialsHuddleVtc1Room type
|
||||
/// </summary>
|
||||
public void SetupHeaderButtons(EssentialsHuddleVtc1PanelAvFunctionsDriver avDriver, EssentialsHuddleVtc1Room currentRoom)
|
||||
public void SetupHeaderButtons(EssentialsHuddleVtc1PanelAvFunctionsDriver avDriver, IEssentialsHuddleVtc1Room currentRoom)
|
||||
{
|
||||
HeaderButtonsAreSetUp = false;
|
||||
|
||||
@@ -283,7 +284,7 @@ namespace PepperDash.Essentials
|
||||
/// <summary>
|
||||
/// Sets up Header Buttons for the EssentialsHuddleSpaceRoom type
|
||||
/// </summary>
|
||||
public void SetupHeaderButtons(EssentialsHuddlePanelAvFunctionsDriver avDriver, EssentialsHuddleSpaceRoom currentRoom)
|
||||
public void SetupHeaderButtons(EssentialsHuddlePanelAvFunctionsDriver avDriver, IEssentialsHuddleSpaceRoom currentRoom)
|
||||
{
|
||||
HeaderButtonsAreSetUp = false;
|
||||
|
||||
|
||||
@@ -983,7 +983,7 @@
|
||||
// /// <summary>
|
||||
// /// Handles source change
|
||||
// /// </summary>
|
||||
// void _CurrentRoom_SourceInfoChange(EssentialsRoomBase room,
|
||||
// void _CurrentRoom_SourceInfoChange(IEssentialsRoom room,
|
||||
// SourceListItem info, ChangeType change)
|
||||
// {
|
||||
// if (change == ChangeType.WillChange)
|
||||
@@ -995,7 +995,7 @@
|
||||
// /// <summary>
|
||||
// ///
|
||||
// /// </summary>
|
||||
// void _CurrentRoom_CurrentDisplay1SourceChange(EssentialsRoomBase room, SourceListItem info, ChangeType type)
|
||||
// void _CurrentRoom_CurrentDisplay1SourceChange(IEssentialsRoom room, SourceListItem info, ChangeType type)
|
||||
// {
|
||||
// if (type == ChangeType.DidChange)
|
||||
// {
|
||||
@@ -1021,7 +1021,7 @@
|
||||
// /// <summary>
|
||||
// ///
|
||||
// /// </summary>
|
||||
// void _CurrentRoom_CurrentDisplay2SourceChange(EssentialsRoomBase room, SourceListItem info, ChangeType type)
|
||||
// void _CurrentRoom_CurrentDisplay2SourceChange(IEssentialsRoom room, SourceListItem info, ChangeType type)
|
||||
// {
|
||||
// if (type == ChangeType.DidChange)
|
||||
// {
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace PepperDash.Essentials
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public EssentialsHuddleSpaceRoom CurrentRoom
|
||||
public IEssentialsHuddleSpaceRoom CurrentRoom
|
||||
{
|
||||
get { return _CurrentRoom; }
|
||||
set
|
||||
@@ -86,7 +86,7 @@ namespace PepperDash.Essentials
|
||||
SetCurrentRoom(value);
|
||||
}
|
||||
}
|
||||
EssentialsHuddleSpaceRoom _CurrentRoom;
|
||||
IEssentialsHuddleSpaceRoom _CurrentRoom;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -498,7 +498,7 @@ namespace PepperDash.Essentials
|
||||
TriList.BooleanInput[UIBoolJoin.SelectASourceVisible].BoolValue = true;
|
||||
// Run default source when room is off and share is pressed
|
||||
if (!CurrentRoom.OnFeedback.BoolValue)
|
||||
CurrentRoom.RunDefaultPresentRoute();
|
||||
(CurrentRoom as IRunDefaultPresentRoute).RunDefaultPresentRoute();
|
||||
}
|
||||
|
||||
|
||||
@@ -583,7 +583,7 @@ namespace PepperDash.Essentials
|
||||
void UiSelectSource(string key)
|
||||
{
|
||||
// Run the route and when it calls back, show the source
|
||||
CurrentRoom.RunRouteAction(key, new Action(() => { }));
|
||||
CurrentRoom.RunRouteAction(key);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -745,7 +745,7 @@ namespace PepperDash.Essentials
|
||||
/// <summary>
|
||||
/// Helper for property setter. Sets the panel to the given room, latching up all functionality
|
||||
/// </summary>
|
||||
public void RefreshCurrentRoom(EssentialsHuddleSpaceRoom room)
|
||||
public void RefreshCurrentRoom(IEssentialsHuddleSpaceRoom room)
|
||||
{
|
||||
if (_CurrentRoom != null)
|
||||
{
|
||||
@@ -836,7 +836,7 @@ namespace PepperDash.Essentials
|
||||
}
|
||||
}
|
||||
|
||||
void SetCurrentRoom(EssentialsHuddleSpaceRoom room)
|
||||
void SetCurrentRoom(IEssentialsHuddleSpaceRoom room)
|
||||
{
|
||||
if (_CurrentRoom == room) return;
|
||||
// Disconnect current (probably never called)
|
||||
@@ -871,7 +871,7 @@ namespace PepperDash.Essentials
|
||||
UpdateMCJoins(_CurrentRoom);
|
||||
}
|
||||
|
||||
void UpdateMCJoins(EssentialsHuddleSpaceRoom room)
|
||||
void UpdateMCJoins(IEssentialsHuddleSpaceRoom room)
|
||||
{
|
||||
TriList.SetString(UIStringJoin.RoomMcUrl, room.MobileControlRoomBridge.McServerUrl);
|
||||
TriList.SetString(UIStringJoin.RoomMcQrCodeUrl, room.MobileControlRoomBridge.QrCodeUrl);
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace PepperDash.Essentials
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public EssentialsHuddleVtc1Room CurrentRoom
|
||||
public IEssentialsHuddleVtc1Room CurrentRoom
|
||||
{
|
||||
get { return _CurrentRoom; }
|
||||
set
|
||||
@@ -58,7 +58,7 @@ namespace PepperDash.Essentials
|
||||
SetCurrentRoom(value);
|
||||
}
|
||||
}
|
||||
EssentialsHuddleVtc1Room _CurrentRoom;
|
||||
IEssentialsHuddleVtc1Room _CurrentRoom;
|
||||
|
||||
/// <summary>
|
||||
/// For hitting feedbacks
|
||||
@@ -652,7 +652,7 @@ namespace PepperDash.Essentials
|
||||
if (!CurrentRoom.OnFeedback.BoolValue)
|
||||
{
|
||||
// If there's no default, show UI elements
|
||||
if (!CurrentRoom.RunDefaultPresentRoute())
|
||||
if (!(CurrentRoom as IRunDefaultPresentRoute).RunDefaultPresentRoute())
|
||||
TriList.SetBool(UIBoolJoin.SelectASourceVisible, true);
|
||||
}
|
||||
}
|
||||
@@ -743,7 +743,7 @@ namespace PepperDash.Essentials
|
||||
void UiSelectSource(string key)
|
||||
{
|
||||
// Run the route and when it calls back, show the source
|
||||
CurrentRoom.RunRouteAction(key, new Action(() => { }));
|
||||
CurrentRoom.RunRouteAction(key);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -894,7 +894,7 @@ namespace PepperDash.Essentials
|
||||
/// <summary>
|
||||
/// Helper for property setter. Sets the panel to the given room, latching up all functionality
|
||||
/// </summary>
|
||||
void RefreshCurrentRoom(EssentialsHuddleVtc1Room room)
|
||||
void RefreshCurrentRoom(IEssentialsHuddleVtc1Room room)
|
||||
{
|
||||
|
||||
if (_CurrentRoom != null)
|
||||
@@ -969,7 +969,7 @@ namespace PepperDash.Essentials
|
||||
}
|
||||
}
|
||||
|
||||
void SetCurrentRoom(EssentialsHuddleVtc1Room room)
|
||||
void SetCurrentRoom(IEssentialsHuddleVtc1Room room)
|
||||
{
|
||||
if (_CurrentRoom == room) return;
|
||||
// Disconnect current (probably never called)
|
||||
@@ -1004,7 +1004,7 @@ namespace PepperDash.Essentials
|
||||
UpdateMCJoins(_CurrentRoom);
|
||||
}
|
||||
|
||||
void UpdateMCJoins(EssentialsHuddleVtc1Room room)
|
||||
void UpdateMCJoins(IEssentialsHuddleVtc1Room room)
|
||||
{
|
||||
TriList.SetString(UIStringJoin.RoomMcUrl, room.MobileControlRoomBridge.McServerUrl);
|
||||
TriList.SetString(UIStringJoin.RoomMcQrCodeUrl, room.MobileControlRoomBridge.QrCodeUrl);
|
||||
@@ -1035,7 +1035,7 @@ namespace PepperDash.Essentials
|
||||
if (CurrentRoom.CurrentSourceInfo != null && CurrentRoom.CurrentSourceInfo.DisableCodecSharing)
|
||||
{
|
||||
Debug.Console(1, CurrentRoom, "Transitioning to in-call, cancelling non-sharable source");
|
||||
CurrentRoom.RunRouteAction("codecOsd", CurrentRoom.SourceListKey);
|
||||
CurrentRoom.RunRouteAction("codecOsd");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1443,7 +1443,7 @@ namespace PepperDash.Essentials
|
||||
/// </summary>
|
||||
public interface IAVWithVCDriver : IAVDriver
|
||||
{
|
||||
EssentialsHuddleVtc1Room CurrentRoom { get; }
|
||||
IEssentialsHuddleVtc1Room CurrentRoom { get; }
|
||||
|
||||
PepperDash.Essentials.Core.Touchpanels.Keyboards.HabaneroKeyboardController Keyboard { get; }
|
||||
/// <summary>
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace PepperDash.Essentials
|
||||
/// <summary>
|
||||
/// Sets feedback for the given room
|
||||
/// </summary>
|
||||
public void SetFeedbackForRoom(EssentialsHuddleSpaceRoom room)
|
||||
public void SetFeedbackForRoom(IEssentialsHuddleSpaceRoom room)
|
||||
{
|
||||
var itemToSet = Items.FirstOrDefault(i => i.Room == room);
|
||||
if (itemToSet != null)
|
||||
@@ -48,11 +48,11 @@ namespace PepperDash.Essentials
|
||||
|
||||
public class SmartObjectRoomsListItem
|
||||
{
|
||||
public EssentialsHuddleSpaceRoom Room { get; private set; }
|
||||
public IEssentialsHuddleSpaceRoom Room { get; private set; }
|
||||
SmartObjectRoomsList Parent;
|
||||
public uint Index { get; private set; }
|
||||
|
||||
public SmartObjectRoomsListItem(EssentialsHuddleSpaceRoom room, uint index, SmartObjectRoomsList parent,
|
||||
public SmartObjectRoomsListItem(IEssentialsHuddleSpaceRoom room, uint index, SmartObjectRoomsList parent,
|
||||
Action<bool> buttonAction)
|
||||
{
|
||||
Room = room;
|
||||
|
||||
@@ -12,5 +12,5 @@ namespace PepperDash.Essentials
|
||||
///// <summary>
|
||||
///// The handler type for a Room's SourceInfoChange
|
||||
///// </summary>
|
||||
//public delegate void SourceInfoChangeHandler(EssentialsRoomBase room, SourceListItem info, ChangeType type);
|
||||
//public delegate void SourceInfoChangeHandler(IEssentialsRoom room, SourceListItem info, ChangeType type);
|
||||
}
|
||||
@@ -385,7 +385,7 @@ namespace PepperDash.Essentials.Core.Bridges
|
||||
{
|
||||
public EiscApiAdvancedFactory()
|
||||
{
|
||||
TypeNames = new List<string> { "eiscapiadv", "eiscapiadvanced", "vceiscapiadv", "vceiscapiadvanced" };
|
||||
TypeNames = new List<string> { "eiscapiadv", "eiscapiadvanced", "eiscapiadvancedserver", "eiscapiadvancedclient", "vceiscapiadv", "vceiscapiadvanced" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
@@ -403,6 +403,16 @@ namespace PepperDash.Essentials.Core.Bridges
|
||||
controlProperties.TcpSshProperties.Address, Global.ControlSystem);
|
||||
return new EiscApiAdvanced(dc, eisc);
|
||||
}
|
||||
case "eiscapiadvancedserver":
|
||||
{
|
||||
var eisc = new EISCServer(controlProperties.IpIdInt, Global.ControlSystem);
|
||||
return new EiscApiAdvanced(dc, eisc);
|
||||
}
|
||||
case "eiscapiadvancedclient":
|
||||
{
|
||||
var eisc = new EISCClient(controlProperties.IpIdInt, controlProperties.TcpSshProperties.Address, Global.ControlSystem);
|
||||
return new EiscApiAdvanced(dc, eisc);
|
||||
}
|
||||
case "vceiscapiadv":
|
||||
case "vceiscapiadvanced":
|
||||
{
|
||||
|
||||
@@ -154,7 +154,7 @@ namespace PepperDash.Essentials.Core.Bridges
|
||||
|
||||
[JoinName("PirSensitivityInVacantState")]
|
||||
public JoinDataComplete PirSensitivityInVacantState = new JoinDataComplete(new JoinData { JoinNumber = 8, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "Occ Sensor Ultrasonic Sensitivity in Vacant State", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
|
||||
new JoinMetadata { Description = "Occ Sensor PIR Sensitivity in Vacant State", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
|
||||
|
||||
[JoinName("Name")]
|
||||
public JoinDataComplete Name = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
||||
|
||||
@@ -1,131 +1,274 @@
|
||||
using System;
|
||||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash_Essentials_Core.Bridges.JoinMaps
|
||||
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||
{
|
||||
public class GlsPartitionSensorJoinMap : JoinMapBaseAdvanced
|
||||
{
|
||||
[JoinName("IsOnline")]
|
||||
public JoinDataComplete IsOnline = new JoinDataComplete(
|
||||
new JoinData
|
||||
{
|
||||
JoinNumber = 1,
|
||||
JoinSpan = 1
|
||||
},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Sensor Is Online",
|
||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
public class GlsPartitionSensorJoinMap : JoinMapBaseAdvanced
|
||||
{
|
||||
[JoinName("IsOnline")]
|
||||
public JoinDataComplete IsOnline = new JoinDataComplete(
|
||||
new JoinData
|
||||
{
|
||||
JoinNumber = 1,
|
||||
JoinSpan = 1
|
||||
},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Sensor Is Online",
|
||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("Name")]
|
||||
public JoinDataComplete Name = new JoinDataComplete(
|
||||
new JoinData
|
||||
{
|
||||
JoinNumber = 1,
|
||||
JoinSpan = 1
|
||||
},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Sensor Name",
|
||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||
JoinType = eJoinType.Serial
|
||||
});
|
||||
[JoinName("Name")]
|
||||
public JoinDataComplete Name = new JoinDataComplete(
|
||||
new JoinData
|
||||
{
|
||||
JoinNumber = 1,
|
||||
JoinSpan = 1
|
||||
},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Sensor Name",
|
||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||
JoinType = eJoinType.Serial
|
||||
});
|
||||
|
||||
[JoinName("Enable")]
|
||||
public JoinDataComplete Enable = new JoinDataComplete(
|
||||
new JoinData
|
||||
{
|
||||
JoinNumber = 2,
|
||||
JoinSpan = 1
|
||||
},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Sensor Enable",
|
||||
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
[JoinName("Enable")]
|
||||
public JoinDataComplete Enable = new JoinDataComplete(
|
||||
new JoinData
|
||||
{
|
||||
JoinNumber = 2,
|
||||
JoinSpan = 1
|
||||
},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Sensor Enable",
|
||||
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("PartitionSensed")]
|
||||
public JoinDataComplete PartitionSensed = new JoinDataComplete(
|
||||
new JoinData
|
||||
{
|
||||
JoinNumber = 3,
|
||||
JoinSpan = 1
|
||||
},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Sensor Partition Sensed",
|
||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
[JoinName("PartitionSensed")]
|
||||
public JoinDataComplete PartitionSensed = new JoinDataComplete(
|
||||
new JoinData
|
||||
{
|
||||
JoinNumber = 3,
|
||||
JoinSpan = 1
|
||||
},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Sensor Partition Sensed",
|
||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("PartitionNotSensed")]
|
||||
public JoinDataComplete PartitionNotSensed = new JoinDataComplete(
|
||||
new JoinData
|
||||
{
|
||||
JoinNumber = 4,
|
||||
JoinSpan = 1
|
||||
},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Sensor Partition Not Sensed",
|
||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
[JoinName("PartitionNotSensed")]
|
||||
public JoinDataComplete PartitionNotSensed = new JoinDataComplete(
|
||||
new JoinData
|
||||
{
|
||||
JoinNumber = 4,
|
||||
JoinSpan = 1
|
||||
},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Sensor Partition Not Sensed",
|
||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("IncreaseSensitivity")]
|
||||
public JoinDataComplete IncreaseSensitivity = new JoinDataComplete(
|
||||
new JoinData
|
||||
{
|
||||
JoinNumber = 6,
|
||||
JoinSpan = 1
|
||||
},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Sensor Increase Sensitivity",
|
||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
[JoinName("IncreaseSensitivity")]
|
||||
public JoinDataComplete IncreaseSensitivity = new JoinDataComplete(
|
||||
new JoinData
|
||||
{
|
||||
JoinNumber = 6,
|
||||
JoinSpan = 1
|
||||
},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Sensor Increase Sensitivity",
|
||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("DecreaseSensitivity")]
|
||||
public JoinDataComplete DecreaseSensitivity = new JoinDataComplete(
|
||||
new JoinData
|
||||
{
|
||||
JoinNumber = 7,
|
||||
JoinSpan = 1
|
||||
},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Sensor Decrease Sensitivity",
|
||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
[JoinName("DecreaseSensitivity")]
|
||||
public JoinDataComplete DecreaseSensitivity = new JoinDataComplete(
|
||||
new JoinData
|
||||
{
|
||||
JoinNumber = 7,
|
||||
JoinSpan = 1
|
||||
},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Sensor Decrease Sensitivity",
|
||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("Sensitivity")]
|
||||
public JoinDataComplete Sensitivity = new JoinDataComplete(
|
||||
new JoinData
|
||||
{
|
||||
JoinNumber = 2,
|
||||
JoinSpan = 1
|
||||
},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Sensor Sensitivity",
|
||||
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
|
||||
JoinType = eJoinType.Analog
|
||||
});
|
||||
[JoinName("Sensitivity")]
|
||||
public JoinDataComplete Sensitivity = new JoinDataComplete(
|
||||
new JoinData
|
||||
{
|
||||
JoinNumber = 2,
|
||||
JoinSpan = 1
|
||||
},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Sensor Sensitivity",
|
||||
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
|
||||
JoinType = eJoinType.Analog
|
||||
});
|
||||
|
||||
/// <summary>
|
||||
/// Constructor to use when instantiating this Join Map without inheriting from it
|
||||
/// </summary>
|
||||
/// <param name="joinStart">Join this join map will start at</param>
|
||||
public GlsPartitionSensorJoinMap(uint joinStart)
|
||||
: this(joinStart, typeof (GlsPartitionSensorJoinMap))
|
||||
{
|
||||
public GlsPartitionSensorJoinMap(uint joinStart)
|
||||
: this(joinStart, typeof(GlsPartitionSensorJoinMap))
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor to use when extending this Join map
|
||||
/// </summary>
|
||||
/// <param name="joinStart">Join this join map will start at</param>
|
||||
/// <param name="type">Type of the child join map</param>
|
||||
protected GlsPartitionSensorJoinMap(uint joinStart, Type type)
|
||||
: base(joinStart, type)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace PepperDash_Essentials_Core.Bridges.JoinMaps
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Obsolete("use PepperDash.Essentials.Core.Bridges.JoinMaps version")]
|
||||
public class GlsPartitionSensorJoinMap:JoinMapBaseAdvanced
|
||||
{
|
||||
[JoinName("IsOnline")]
|
||||
public JoinDataComplete IsOnline = new JoinDataComplete(
|
||||
new JoinData
|
||||
{
|
||||
JoinNumber = 1,
|
||||
JoinSpan = 1
|
||||
},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Sensor Is Online",
|
||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("Name")]
|
||||
public JoinDataComplete Name = new JoinDataComplete(
|
||||
new JoinData
|
||||
{
|
||||
JoinNumber = 1,
|
||||
JoinSpan = 1
|
||||
},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Sensor Name",
|
||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||
JoinType = eJoinType.Serial
|
||||
});
|
||||
|
||||
[JoinName("Enable")]
|
||||
public JoinDataComplete Enable = new JoinDataComplete(
|
||||
new JoinData
|
||||
{
|
||||
JoinNumber = 2,
|
||||
JoinSpan = 1
|
||||
},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Sensor Enable",
|
||||
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("PartitionSensed")]
|
||||
public JoinDataComplete PartitionSensed = new JoinDataComplete(
|
||||
new JoinData
|
||||
{
|
||||
JoinNumber = 3,
|
||||
JoinSpan = 1
|
||||
},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Sensor Partition Sensed",
|
||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("PartitionNotSensed")]
|
||||
public JoinDataComplete PartitionNotSensed = new JoinDataComplete(
|
||||
new JoinData
|
||||
{
|
||||
JoinNumber = 4,
|
||||
JoinSpan = 1
|
||||
},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Sensor Partition Not Sensed",
|
||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("IncreaseSensitivity")]
|
||||
public JoinDataComplete IncreaseSensitivity = new JoinDataComplete(
|
||||
new JoinData
|
||||
{
|
||||
JoinNumber = 6,
|
||||
JoinSpan = 1
|
||||
},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Sensor Increase Sensitivity",
|
||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("DecreaseSensitivity")]
|
||||
public JoinDataComplete DecreaseSensitivity = new JoinDataComplete(
|
||||
new JoinData
|
||||
{
|
||||
JoinNumber = 7,
|
||||
JoinSpan = 1
|
||||
},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Sensor Decrease Sensitivity",
|
||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("Sensitivity")]
|
||||
public JoinDataComplete Sensitivity = new JoinDataComplete(
|
||||
new JoinData
|
||||
{
|
||||
JoinNumber = 2,
|
||||
JoinSpan = 1
|
||||
},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Sensor Sensitivity",
|
||||
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
|
||||
JoinType = eJoinType.Analog
|
||||
});
|
||||
|
||||
/// <summary>
|
||||
/// Constructor to use when instantiating this Join Map without inheriting from it
|
||||
/// </summary>
|
||||
/// <param name="joinStart">Join this join map will start at</param>
|
||||
public GlsPartitionSensorJoinMap(uint joinStart)
|
||||
: this(joinStart, typeof(GlsPartitionSensorJoinMap))
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor to use when extending this Join map
|
||||
|
||||
@@ -0,0 +1,222 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Bridges
|
||||
{
|
||||
/// <summary>
|
||||
/// Join map for IRBlurayBase devices
|
||||
/// </summary>
|
||||
public class IRBlurayBaseJoinMap : JoinMapBaseAdvanced
|
||||
{
|
||||
[JoinName("PowerOn")]
|
||||
public JoinDataComplete PowerOn = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "Power On", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("PowerOff")]
|
||||
public JoinDataComplete PowerOff = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "Power Off", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("PowerToggle")]
|
||||
public JoinDataComplete PowerToggle = new JoinDataComplete(new JoinData { JoinNumber = 3, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "Power Toggle", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Up")]
|
||||
public JoinDataComplete Up = new JoinDataComplete(new JoinData { JoinNumber = 4, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "Nav Up", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Down")]
|
||||
public JoinDataComplete Down = new JoinDataComplete(new JoinData { JoinNumber = 5, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "Nav Down", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Left")]
|
||||
public JoinDataComplete Left = new JoinDataComplete(new JoinData { JoinNumber = 6, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "Nav Left", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Right")]
|
||||
public JoinDataComplete Right = new JoinDataComplete(new JoinData { JoinNumber = 7, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "Nav Right", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Select")]
|
||||
public JoinDataComplete Select = new JoinDataComplete(new JoinData { JoinNumber = 8, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "Select", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Menu")]
|
||||
public JoinDataComplete Menu = new JoinDataComplete(new JoinData { JoinNumber = 9, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "Menu", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Exit")]
|
||||
public JoinDataComplete Exit = new JoinDataComplete(new JoinData { JoinNumber = 10, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "Exit", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Digit0")]
|
||||
public JoinDataComplete Digit0 = new JoinDataComplete(new JoinData { JoinNumber = 11, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "Digit 0", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Digit1")]
|
||||
public JoinDataComplete Digit1 = new JoinDataComplete(new JoinData { JoinNumber = 12, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "Digit 1", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Digit2")]
|
||||
public JoinDataComplete Digit2 = new JoinDataComplete(new JoinData { JoinNumber = 13, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "Digit 2", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Digit3")]
|
||||
public JoinDataComplete Digit3 = new JoinDataComplete(new JoinData { JoinNumber = 14, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "Digit 3", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Digit4")]
|
||||
public JoinDataComplete Digit4 = new JoinDataComplete(new JoinData { JoinNumber = 15, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "Digit 4", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Digit5")]
|
||||
public JoinDataComplete Digit5 = new JoinDataComplete(new JoinData { JoinNumber = 16, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "Digit 5", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Digit6")]
|
||||
public JoinDataComplete Digit6 = new JoinDataComplete(new JoinData { JoinNumber = 17, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "Digit 6", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Digit7")]
|
||||
public JoinDataComplete Digit7 = new JoinDataComplete(new JoinData { JoinNumber = 18, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "Digit 7", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Digit8")]
|
||||
public JoinDataComplete Digit8 = new JoinDataComplete(new JoinData { JoinNumber = 19, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "Digit 8", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Digit9")]
|
||||
public JoinDataComplete Digit9 = new JoinDataComplete(new JoinData { JoinNumber = 20, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "Digit 9", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("KeypadClear")]
|
||||
public JoinDataComplete KeypadClear = new JoinDataComplete(new JoinData { JoinNumber = 21, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "Keypad Clear", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("KeypadEnter")]
|
||||
public JoinDataComplete KeypadEnter = new JoinDataComplete(new JoinData { JoinNumber = 22, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "Keypad Enter", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("ChannelUp")]
|
||||
public JoinDataComplete ChannelUp = new JoinDataComplete(new JoinData { JoinNumber = 23, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "STB Channel Up", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("ChannelDown")]
|
||||
public JoinDataComplete ChannelDown = new JoinDataComplete(new JoinData { JoinNumber = 24, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "STB Channel Down", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("LastChannel")]
|
||||
public JoinDataComplete LastChannel = new JoinDataComplete(new JoinData { JoinNumber = 25, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "Last Channel", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Guide")]
|
||||
public JoinDataComplete Guide = new JoinDataComplete(new JoinData { JoinNumber = 26, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "Guide", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Info")]
|
||||
public JoinDataComplete Info = new JoinDataComplete(new JoinData { JoinNumber = 27, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "Info", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Red")]
|
||||
public JoinDataComplete Red = new JoinDataComplete(new JoinData { JoinNumber = 28, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "Red", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Green")]
|
||||
public JoinDataComplete Green = new JoinDataComplete(new JoinData { JoinNumber = 29, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "Green", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Yellow")]
|
||||
public JoinDataComplete Yellow = new JoinDataComplete(new JoinData { JoinNumber = 30, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "Yellow", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Blue")]
|
||||
public JoinDataComplete Blue = new JoinDataComplete(new JoinData { JoinNumber = 31, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "Blue", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
|
||||
[JoinName("Play")]
|
||||
public JoinDataComplete Play = new JoinDataComplete(new JoinData { JoinNumber = 33, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "Play", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Pause")]
|
||||
public JoinDataComplete Pause = new JoinDataComplete(new JoinData { JoinNumber = 34, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "Pause", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Stop")]
|
||||
public JoinDataComplete Stop = new JoinDataComplete(new JoinData { JoinNumber = 35, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "Stop", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("FFwd")]
|
||||
public JoinDataComplete FFwd = new JoinDataComplete(new JoinData { JoinNumber = 36, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "FFwd", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Rewind")]
|
||||
public JoinDataComplete Rewind = new JoinDataComplete(new JoinData { JoinNumber = 37, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "Rewind", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("ChapPlus")]
|
||||
public JoinDataComplete ChapPlus = new JoinDataComplete(new JoinData { JoinNumber = 38, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "Chapter Plus", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("ChapMinus")]
|
||||
public JoinDataComplete ChapMinus = new JoinDataComplete(new JoinData { JoinNumber = 39, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "Chapter Minus", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Replay")]
|
||||
public JoinDataComplete Replay = new JoinDataComplete(new JoinData { JoinNumber = 40, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "Replay", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Record")]
|
||||
public JoinDataComplete Record = new JoinDataComplete(new JoinData { JoinNumber = 41, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "Record", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("HasKeypadAccessoryButton1")]
|
||||
public JoinDataComplete HasKeypadAccessoryButton1 = new JoinDataComplete(new JoinData { JoinNumber = 42, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "Has Keypad Accessory Button 1", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("HasKeypadAccessoryButton2")]
|
||||
public JoinDataComplete HasKeypadAccessoryButton2 = new JoinDataComplete(new JoinData { JoinNumber = 43, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "Has Keypad Accessory Button 2", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("KeypadAccessoryButton1Press")]
|
||||
public JoinDataComplete KeypadAccessoryButton1Press = new JoinDataComplete(new JoinData { JoinNumber = 42, JoinSpan = 2 },
|
||||
new JoinMetadata { Description = "Keypad Accessory Button 1 Press", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("KeypadAccessoryButton2Press")]
|
||||
public JoinDataComplete KeypadAccessoryButton2Press = new JoinDataComplete(new JoinData { JoinNumber = 43, JoinSpan = 2 },
|
||||
new JoinMetadata { Description = "Keypad Accessory Button 2 Press", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Name")]
|
||||
public JoinDataComplete Name = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("KeypadAccessoryButton1Label")]
|
||||
public JoinDataComplete KeypadAccessoryButton1Label = new JoinDataComplete(new JoinData { JoinNumber = 42, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "Keypad Accessory Button 1 Label", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
||||
|
||||
[JoinName("KeypadAccessoryButton2Label")]
|
||||
public JoinDataComplete KeypadAccessoryButton2Label = new JoinDataComplete(new JoinData { JoinNumber = 43, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "Keypad Accessory Button 1 Label", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
||||
|
||||
/// <summary>
|
||||
/// Constructor to use when instantiating this Join Map without inheriting from it
|
||||
/// </summary>
|
||||
/// <param name="joinStart">Join this join map will start at</param>
|
||||
public IRBlurayBaseJoinMap(uint joinStart)
|
||||
: this(joinStart, typeof(IRBlurayBaseJoinMap))
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor to use when extending this Join map
|
||||
/// </summary>
|
||||
/// <param name="joinStart">Join this join map will start at</param>
|
||||
/// <param name="type">Type of the child join map</param>
|
||||
protected IRBlurayBaseJoinMap(uint joinStart, Type type)
|
||||
: base(joinStart, type)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
using System;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.Core.Bridges
|
||||
{
|
||||
public class SetTopBoxControllerJoinMap : JoinMapBaseAdvanced
|
||||
{
|
||||
namespace PepperDash.Essentials.Core.Bridges
|
||||
{
|
||||
public class SetTopBoxControllerJoinMap : JoinMapBaseAdvanced
|
||||
{
|
||||
[JoinName("PowerOn")]
|
||||
public JoinDataComplete PowerOn = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "STB Power On", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||
@@ -236,5 +236,5 @@ namespace PepperDash.Essentials.Core.Bridges
|
||||
: base(joinStart, type)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -11,8 +11,10 @@ using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
public class CecPortController : Device, IBasicCommunication
|
||||
public class CecPortController : Device, IBasicCommunicationWithStreamDebugging
|
||||
{
|
||||
public CommunicationStreamDebugging StreamDebugging { get; private set; }
|
||||
|
||||
public event EventHandler<GenericCommMethodReceiveBytesArgs> BytesReceived;
|
||||
public event EventHandler<GenericCommMethodReceiveTextArgs> TextReceived;
|
||||
|
||||
@@ -23,6 +25,8 @@ namespace PepperDash.Essentials.Core
|
||||
public CecPortController(string key, Func<EssentialsControlPropertiesConfig, ICec> postActivationFunc,
|
||||
EssentialsControlPropertiesConfig config):base(key)
|
||||
{
|
||||
StreamDebugging = new CommunicationStreamDebugging(key);
|
||||
|
||||
AddPostActivationAction(() =>
|
||||
{
|
||||
Port = postActivationFunc(config);
|
||||
@@ -50,15 +54,21 @@ namespace PepperDash.Essentials.Core
|
||||
|
||||
void OnDataReceived(string s)
|
||||
{
|
||||
var bytesHandler = BytesReceived;
|
||||
var bytesHandler = BytesReceived;
|
||||
if (bytesHandler != null)
|
||||
{
|
||||
var bytes = Encoding.GetEncoding(28591).GetBytes(s);
|
||||
if (StreamDebugging.RxStreamDebuggingIsEnabled)
|
||||
Debug.Console(0, this, "Received: '{0}'", ComTextHelper.GetEscapedText(bytes));
|
||||
bytesHandler(this, new GenericCommMethodReceiveBytesArgs(bytes));
|
||||
}
|
||||
var textHandler = TextReceived;
|
||||
if (textHandler != null)
|
||||
textHandler(this, new GenericCommMethodReceiveTextArgs(s));
|
||||
if (textHandler != null)
|
||||
{
|
||||
if (StreamDebugging.RxStreamDebuggingIsEnabled)
|
||||
Debug.Console(0, this, "Received: '{0}'", s);
|
||||
textHandler(this, new GenericCommMethodReceiveTextArgs(s));
|
||||
}
|
||||
}
|
||||
|
||||
#region IBasicCommunication Members
|
||||
@@ -67,6 +77,8 @@ namespace PepperDash.Essentials.Core
|
||||
{
|
||||
if (Port == null)
|
||||
return;
|
||||
if (StreamDebugging.TxStreamDebuggingIsEnabled)
|
||||
Debug.Console(0, this, "Sending {0} characters of text: '{1}'", text.Length, text);
|
||||
Port.StreamCec.Send.StringValue = text;
|
||||
}
|
||||
|
||||
@@ -75,6 +87,8 @@ namespace PepperDash.Essentials.Core
|
||||
if (Port == null)
|
||||
return;
|
||||
var text = Encoding.GetEncoding(28591).GetString(bytes, 0, bytes.Length);
|
||||
if (StreamDebugging.TxStreamDebuggingIsEnabled)
|
||||
Debug.Console(0, this, "Sending {0} bytes: '{1}'", bytes.Length, ComTextHelper.GetEscapedText(bytes));
|
||||
Port.StreamCec.Send.StringValue = text;
|
||||
}
|
||||
|
||||
|
||||
@@ -92,18 +92,20 @@ namespace PepperDash.Essentials.Core
|
||||
|
||||
void OnDataReceived(string s)
|
||||
{
|
||||
|
||||
var bytesHandler = BytesReceived;
|
||||
if (bytesHandler != null)
|
||||
{
|
||||
var bytes = Encoding.GetEncoding(28591).GetBytes(s);
|
||||
if (StreamDebugging.RxStreamDebuggingIsEnabled)
|
||||
Debug.Console(0, this, "Received: '{0}'", ComTextHelper.GetEscapedText(bytes));
|
||||
bytesHandler(this, new GenericCommMethodReceiveBytesArgs(bytes));
|
||||
}
|
||||
var textHandler = TextReceived;
|
||||
if (textHandler != null)
|
||||
{
|
||||
if (StreamDebugging.RxStreamDebuggingIsEnabled)
|
||||
Debug.Console(0, this, "Recevied: '{0}'", s);
|
||||
|
||||
if (StreamDebugging.RxStreamDebuggingIsEnabled)
|
||||
Debug.Console(0, this, "Received: '{0}'", s);
|
||||
textHandler(this, new GenericCommMethodReceiveTextArgs(s));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace PepperDash.Essentials.Core
|
||||
{
|
||||
Communication = comm;
|
||||
PortGather = new CommunicationGather(Communication, '\x0d');
|
||||
PortGather.LineReceived += this.Port_LineReceived;
|
||||
//PortGather.LineReceived += this.Port_LineReceived;
|
||||
CommunicationMonitor = new GenericCommunicationMonitor(this, Communication, props.CommunicationMonitorProperties);
|
||||
LineEnding = props.LineEnding;
|
||||
}
|
||||
@@ -47,13 +47,6 @@ namespace PepperDash.Essentials.Core
|
||||
return true;
|
||||
}
|
||||
|
||||
void Port_LineReceived(object dev, GenericCommMethodReceiveTextArgs args)
|
||||
{
|
||||
if (Debug.Level == 2)
|
||||
Debug.Console(2, this, "RX: '{0}'",
|
||||
ShowHexResponse ? ComTextHelper.GetEscapedText(args.Text) : args.Text);
|
||||
}
|
||||
|
||||
void SendLine(string s)
|
||||
{
|
||||
//if (Debug.Level == 2)
|
||||
|
||||
@@ -25,6 +25,7 @@ namespace PepperDash.Essentials.Core
|
||||
public GenericComm(DeviceConfig config)
|
||||
: base(config)
|
||||
{
|
||||
|
||||
PropertiesConfig = CommFactory.GetControlPropertiesConfig(config);
|
||||
|
||||
var commPort = CommFactory.CreateCommForDevice(config);
|
||||
@@ -96,7 +97,6 @@ namespace PepperDash.Essentials.Core
|
||||
// this is a permanent event handler. This cannot be -= from event
|
||||
CommPort.TextReceived += (s, a) =>
|
||||
{
|
||||
Debug.Console(2, this, "RX: {0}", a.Text);
|
||||
trilist.SetString(joinMap.TextReceived.JoinNumber, a.Text);
|
||||
};
|
||||
trilist.SetStringSigAction(joinMap.SendText.JoinNumber, s => CommPort.SendText(s));
|
||||
|
||||
@@ -33,7 +33,6 @@ namespace PepperDash.Essentials.Core
|
||||
string url = string.Format("http://{0}/{1}", Client.HostName, path);
|
||||
request.Url = new UrlParser(url);
|
||||
HttpClient.DISPATCHASYNC_ERROR error = Client.DispatchAsyncEx(request, Response, request);
|
||||
Debug.Console(2, this, "GenericHttpClient SentRequest TX:'{0}'", url);
|
||||
}
|
||||
public void SendText(string format, params object[] items)
|
||||
{
|
||||
@@ -41,7 +40,6 @@ namespace PepperDash.Essentials.Core
|
||||
string url = string.Format("http://{0}/{1}", Client.HostName, string.Format(format, items));
|
||||
request.Url = new UrlParser(url);
|
||||
HttpClient.DISPATCHASYNC_ERROR error = Client.DispatchAsyncEx(request, Response, request);
|
||||
Debug.Console(2, this, "GenericHttpClient SentRequest TX:'{0}'", url);
|
||||
}
|
||||
|
||||
public void SendTextNoResponse(string format, params object[] items)
|
||||
@@ -50,7 +48,6 @@ namespace PepperDash.Essentials.Core
|
||||
string url = string.Format("http://{0}/{1}", Client.HostName, string.Format(format, items));
|
||||
request.Url = new UrlParser(url);
|
||||
Client.Dispatch(request);
|
||||
Debug.Console(2, this, "GenericHttpClient SentRequest TX:'{0}'", url);
|
||||
}
|
||||
|
||||
private void Response(HttpClientResponse response, HTTP_CALLBACK_ERROR error, object request)
|
||||
@@ -63,10 +60,6 @@ namespace PepperDash.Essentials.Core
|
||||
{
|
||||
if (ResponseRecived != null)
|
||||
ResponseRecived(this, new GenericHttpClientEventArgs(responseReceived.ContentString, (request as HttpClientRequest).Url.ToString(), error));
|
||||
|
||||
Debug.Console(2, this, "GenericHttpClient ResponseReceived");
|
||||
Debug.Console(2, this, "RX:{0}", responseReceived.ContentString);
|
||||
Debug.Console(2, this, "TX:{0}", (request as HttpClientRequest).Url.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Newtonsoft.Json;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
@@ -25,12 +20,25 @@ namespace PepperDash.Essentials.Core.Config
|
||||
[JsonProperty("sourceLists")]
|
||||
public Dictionary<string, Dictionary<string, SourceListItem>> SourceLists { get; set; }
|
||||
|
||||
[JsonProperty("tieLines")]
|
||||
[JsonProperty("destinationLists")]
|
||||
public Dictionary<string, Dictionary<string,DestinationListItem>> DestinationLists { get; set; }
|
||||
|
||||
[JsonProperty("tieLines")]
|
||||
public List<TieLineConfig> TieLines { get; set; }
|
||||
|
||||
[JsonProperty("joinMaps")]
|
||||
public Dictionary<string, JObject> JoinMaps { get; set; }
|
||||
|
||||
public BasicConfig()
|
||||
{
|
||||
Info = new InfoConfig();
|
||||
Devices = new List<DeviceConfig>();
|
||||
SourceLists = new Dictionary<string, Dictionary<string, SourceListItem>>();
|
||||
DestinationLists = new Dictionary<string, Dictionary<string, DestinationListItem>>();
|
||||
TieLines = new List<TieLineConfig>();
|
||||
JoinMaps = new Dictionary<string, JObject>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks SourceLists for a given list and returns it if found. Otherwise, returns null
|
||||
/// </summary>
|
||||
@@ -42,6 +50,21 @@ namespace PepperDash.Essentials.Core.Config
|
||||
return SourceLists[key];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves a DestinationListItem based on the key
|
||||
/// </summary>
|
||||
/// <param name="key">key of the item to retrieve</param>
|
||||
/// <returns>DestinationListItem if the key exists, null otherwise</returns>
|
||||
public Dictionary<string, DestinationListItem> GetDestinationListForKey(string key)
|
||||
{
|
||||
if (string.IsNullOrEmpty(key) || !DestinationLists.ContainsKey(key))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return DestinationLists[key];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks Devices for an item with a Key that matches and returns it if found. Otherwise, retunes null
|
||||
/// </summary>
|
||||
|
||||
@@ -30,7 +30,19 @@ namespace PepperDash.Essentials.Core.Config
|
||||
|
||||
[JsonProperty("properties")]
|
||||
[JsonConverter(typeof(DevicePropertiesConverter))]
|
||||
public JToken Properties { get; set; }
|
||||
public JToken Properties { get; set; }
|
||||
|
||||
public DeviceConfig(DeviceConfig dc)
|
||||
{
|
||||
Key = dc.Key;
|
||||
Uid = dc.Uid;
|
||||
Name = dc.Name;
|
||||
Group = dc.Group;
|
||||
Type = dc.Type;
|
||||
Properties = JToken.FromObject(dc.Properties);
|
||||
}
|
||||
|
||||
public DeviceConfig() {}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,162 +1,162 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharp.CrestronIO;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Config
|
||||
{
|
||||
/// <summary>
|
||||
/// Responsible for updating config at runtime, and writing the updates out to a local file
|
||||
/// </summary>
|
||||
public class ConfigWriter
|
||||
{
|
||||
public const string LocalConfigFolder = "LocalConfig";
|
||||
|
||||
public const long WriteTimeout = 30000;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharp.CrestronIO;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Config
|
||||
{
|
||||
/// <summary>
|
||||
/// Responsible for updating config at runtime, and writing the updates out to a local file
|
||||
/// </summary>
|
||||
public class ConfigWriter
|
||||
{
|
||||
public const string LocalConfigFolder = "LocalConfig";
|
||||
|
||||
public const long WriteTimeout = 30000;
|
||||
|
||||
public static CTimer WriteTimer;
|
||||
static CCriticalSection fileLock = new CCriticalSection();
|
||||
|
||||
/// <summary>
|
||||
/// Updates the config properties of a device
|
||||
/// </summary>
|
||||
/// <param name="deviceKey"></param>
|
||||
/// <param name="properties"></param>
|
||||
/// <returns></returns>
|
||||
public static bool UpdateDeviceProperties(string deviceKey, JToken properties)
|
||||
{
|
||||
bool success = false;
|
||||
|
||||
// Get the current device config
|
||||
var deviceConfig = ConfigReader.ConfigObject.Devices.FirstOrDefault(d => d.Key.Equals(deviceKey));
|
||||
|
||||
if (deviceConfig != null)
|
||||
{
|
||||
// Replace the current properties JToken with the new one passed into this method
|
||||
deviceConfig.Properties = properties;
|
||||
|
||||
Debug.Console(1, "Updated properties of device: '{0}'", deviceKey);
|
||||
|
||||
success = true;
|
||||
}
|
||||
|
||||
ResetTimer();
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
public static bool UpdateDeviceConfig(DeviceConfig config)
|
||||
{
|
||||
bool success = false;
|
||||
|
||||
var deviceConfig = ConfigReader.ConfigObject.Devices.FirstOrDefault(d => d.Key.Equals(config.Key));
|
||||
|
||||
if (deviceConfig != null)
|
||||
{
|
||||
deviceConfig = config;
|
||||
|
||||
Debug.Console(1, "Updated config of device: '{0}'", config.Key);
|
||||
|
||||
success = true;
|
||||
}
|
||||
|
||||
ResetTimer();
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
public static bool UpdateRoomConfig(DeviceConfig config)
|
||||
{
|
||||
bool success = false;
|
||||
|
||||
var deviceConfig = ConfigReader.ConfigObject.Rooms.FirstOrDefault(d => d.Key.Equals(config.Key));
|
||||
|
||||
if (deviceConfig != null)
|
||||
{
|
||||
deviceConfig = config;
|
||||
|
||||
Debug.Console(1, "Updated config of device: '{0}'", config.Key);
|
||||
|
||||
success = true;
|
||||
}
|
||||
|
||||
ResetTimer();
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets (or starts) the write timer
|
||||
/// </summary>
|
||||
static void ResetTimer()
|
||||
{
|
||||
if (WriteTimer == null)
|
||||
WriteTimer = new CTimer(WriteConfigFile, WriteTimeout);
|
||||
|
||||
WriteTimer.Reset(WriteTimeout);
|
||||
|
||||
Debug.Console(1, "Config File write timer has been reset.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Writes the current config to a file in the LocalConfig subfolder
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static void WriteConfigFile(object o)
|
||||
{
|
||||
var filePath = Global.FilePathPrefix + LocalConfigFolder + Global.DirectorySeparator + "configurationFile.json";
|
||||
|
||||
var configData = JsonConvert.SerializeObject(ConfigReader.ConfigObject);
|
||||
|
||||
WriteFile(filePath, configData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Writes
|
||||
/// </summary>
|
||||
/// <param name="filepath"></param>
|
||||
/// <param name="o"></param>
|
||||
public static void WriteFile(string filePath, string configData)
|
||||
{
|
||||
if (WriteTimer != null)
|
||||
WriteTimer.Stop();
|
||||
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Writing Configuration to file");
|
||||
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to write config file: '{0}'", filePath);
|
||||
|
||||
try
|
||||
{
|
||||
if (fileLock.TryEnter())
|
||||
{
|
||||
using (StreamWriter sw = new StreamWriter(filePath))
|
||||
{
|
||||
sw.Write(configData);
|
||||
sw.Flush();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Error, "Unable to enter FileLock");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Error, "Error: Config write failed: \r{0}", e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (fileLock != null && !fileLock.Disposed)
|
||||
fileLock.Leave();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
static CCriticalSection fileLock = new CCriticalSection();
|
||||
|
||||
/// <summary>
|
||||
/// Updates the config properties of a device
|
||||
/// </summary>
|
||||
/// <param name="deviceKey"></param>
|
||||
/// <param name="properties"></param>
|
||||
/// <returns></returns>
|
||||
public static bool UpdateDeviceProperties(string deviceKey, JToken properties)
|
||||
{
|
||||
bool success = false;
|
||||
|
||||
// Get the current device config
|
||||
var deviceConfig = ConfigReader.ConfigObject.Devices.FirstOrDefault(d => d.Key.Equals(deviceKey));
|
||||
|
||||
if (deviceConfig != null)
|
||||
{
|
||||
// Replace the current properties JToken with the new one passed into this method
|
||||
deviceConfig.Properties = properties;
|
||||
|
||||
Debug.Console(1, "Updated properties of device: '{0}'", deviceKey);
|
||||
|
||||
success = true;
|
||||
}
|
||||
|
||||
ResetTimer();
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
public static bool UpdateDeviceConfig(DeviceConfig config)
|
||||
{
|
||||
bool success = false;
|
||||
|
||||
var deviceConfigIndex = ConfigReader.ConfigObject.Devices.FindIndex(d => d.Key.Equals(config.Key));
|
||||
|
||||
if (deviceConfigIndex >= 0)
|
||||
{
|
||||
ConfigReader.ConfigObject.Devices[deviceConfigIndex] = config;
|
||||
|
||||
Debug.Console(1, "Updated config of device: '{0}'", config.Key);
|
||||
|
||||
success = true;
|
||||
}
|
||||
|
||||
ResetTimer();
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
public static bool UpdateRoomConfig(DeviceConfig config)
|
||||
{
|
||||
bool success = false;
|
||||
|
||||
var roomConfigIndex = ConfigReader.ConfigObject.Rooms.FindIndex(d => d.Key.Equals(config.Key));
|
||||
|
||||
if (roomConfigIndex >= 0)
|
||||
{
|
||||
ConfigReader.ConfigObject.Rooms[roomConfigIndex] = config;
|
||||
|
||||
Debug.Console(1, "Updated room of device: '{0}'", config.Key);
|
||||
|
||||
success = true;
|
||||
}
|
||||
|
||||
ResetTimer();
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets (or starts) the write timer
|
||||
/// </summary>
|
||||
static void ResetTimer()
|
||||
{
|
||||
if (WriteTimer == null)
|
||||
WriteTimer = new CTimer(WriteConfigFile, WriteTimeout);
|
||||
|
||||
WriteTimer.Reset(WriteTimeout);
|
||||
|
||||
Debug.Console(1, "Config File write timer has been reset.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Writes the current config to a file in the LocalConfig subfolder
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static void WriteConfigFile(object o)
|
||||
{
|
||||
var filePath = Global.FilePathPrefix + LocalConfigFolder + Global.DirectorySeparator + "configurationFile.json";
|
||||
|
||||
var configData = JsonConvert.SerializeObject(ConfigReader.ConfigObject);
|
||||
|
||||
WriteFile(filePath, configData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Writes
|
||||
/// </summary>
|
||||
/// <param name="filepath"></param>
|
||||
/// <param name="o"></param>
|
||||
public static void WriteFile(string filePath, string configData)
|
||||
{
|
||||
if (WriteTimer != null)
|
||||
WriteTimer.Stop();
|
||||
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Writing Configuration to file");
|
||||
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to write config file: '{0}'", filePath);
|
||||
|
||||
try
|
||||
{
|
||||
if (fileLock.TryEnter())
|
||||
{
|
||||
using (StreamWriter sw = new StreamWriter(filePath))
|
||||
{
|
||||
sw.Write(configData);
|
||||
sw.Flush();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Error, "Unable to enter FileLock");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Error, "Error: Config write failed: \r{0}", e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (fileLock != null && !fileLock.Disposed)
|
||||
fileLock.Leave();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -51,6 +51,13 @@ namespace PepperDash.Essentials.Core.Config
|
||||
|
||||
[JsonProperty("rooms")]
|
||||
public List<DeviceConfig> Rooms { get; set; }
|
||||
|
||||
|
||||
public EssentialsConfig()
|
||||
: base()
|
||||
{
|
||||
Rooms = new List<DeviceConfig>();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using Crestron.SimplSharpPro.GeneralIO;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.Bridges;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
|
||||
namespace PepperDash.Essentials.Core.CrestronIO
|
||||
{
|
||||
public class C2NIoController:CrestronGenericBaseDevice, IComPorts, IIROutputPorts, IRelayPorts
|
||||
{
|
||||
private C2nIo _device;
|
||||
|
||||
public C2NIoController(string key, Func<DeviceConfig, C2nIo> preActivationFunc, DeviceConfig config):base(key, config.Name)
|
||||
{
|
||||
AddPreActivationAction(() =>
|
||||
{
|
||||
_device = preActivationFunc(config);
|
||||
|
||||
RegisterCrestronGenericBase(_device);
|
||||
});
|
||||
}
|
||||
|
||||
#region Implementation of IComPorts
|
||||
|
||||
public CrestronCollection<ComPort> ComPorts
|
||||
{
|
||||
get { return _device.ComPorts; }
|
||||
}
|
||||
|
||||
public int NumberOfComPorts
|
||||
{
|
||||
get { return _device.NumberOfComPorts; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Implementation of IIROutputPorts
|
||||
|
||||
public CrestronCollection<IROutputPort> IROutputPorts
|
||||
{
|
||||
get { return _device.IROutputPorts; }
|
||||
}
|
||||
|
||||
public int NumberOfIROutputPorts
|
||||
{
|
||||
get { return _device.NumberOfIROutputPorts; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Implementation of IRelayPorts
|
||||
|
||||
public CrestronCollection<Relay> RelayPorts
|
||||
{
|
||||
get { return _device.RelayPorts; }
|
||||
}
|
||||
|
||||
public int NumberOfRelayPorts
|
||||
{
|
||||
get { return _device.NumberOfRelayPorts; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public class C2NIoControllerFactory : EssentialsDeviceFactory<C2nRthsController>
|
||||
{
|
||||
public C2NIoControllerFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "c2nio" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new C2N-IO Device");
|
||||
|
||||
return new C2NIoController(dc.Key, GetC2NIoDevice, dc);
|
||||
}
|
||||
|
||||
static C2nIo GetC2NIoDevice(DeviceConfig dc)
|
||||
{
|
||||
var control = CommFactory.GetControlPropertiesConfig(dc);
|
||||
var cresnetId = control.CresnetIdInt;
|
||||
var branchId = control.ControlPortNumber;
|
||||
var parentKey = string.IsNullOrEmpty(control.ControlPortDevKey) ? "processor" : control.ControlPortDevKey;
|
||||
|
||||
if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
Debug.Console(0, "Device {0} is a valid cresnet master - creating new C2nIo", parentKey);
|
||||
return new C2nIo(cresnetId, Global.ControlSystem);
|
||||
}
|
||||
var cresnetBridge = DeviceManager.GetDeviceForKey(parentKey) as IHasCresnetBranches;
|
||||
|
||||
if (cresnetBridge != null)
|
||||
{
|
||||
Debug.Console(0, "Device {0} is a valid cresnet master - creating new C2nIo", parentKey);
|
||||
return new C2nIo(cresnetId, cresnetBridge.CresnetBranches[branchId]);
|
||||
}
|
||||
Debug.Console(0, "Device {0} is not a valid cresnet master", parentKey);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -130,6 +130,12 @@ namespace PepperDash.Essentials.Core
|
||||
void Hardware_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args)
|
||||
{
|
||||
Debug.Console(2, this, "OnlineStatusChange Event. Online = {0}", args.DeviceOnLine);
|
||||
|
||||
if (!Hardware.Registered)
|
||||
{
|
||||
return; // protects in cases where device has been unregistered and feedbacks would attempt to access null sigs.
|
||||
}
|
||||
|
||||
foreach (var feedback in Feedbacks)
|
||||
{
|
||||
if (feedback != null)
|
||||
|
||||
@@ -1,8 +1,20 @@
|
||||
namespace PepperDash_Essentials_Core.DeviceTypeInterfaces
|
||||
using System;
|
||||
|
||||
namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
|
||||
{
|
||||
public interface IHasBranding
|
||||
{
|
||||
bool BrandingEnabled { get; }
|
||||
void InitializeBranding(string roomKey);
|
||||
}
|
||||
}
|
||||
|
||||
namespace PepperDash_Essentials_Core.DeviceTypeInterfaces
|
||||
{
|
||||
[Obsolete("Use PepperDash.Essentials.Core.DeviceTypeInterfaces")]
|
||||
public interface IHasBranding
|
||||
{
|
||||
bool BrandingEnabled { get; }
|
||||
void InitializeBranding(string roomKey);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using PepperDash.Essentials.Core;
|
||||
using System;
|
||||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash_Essentials_Core.DeviceTypeInterfaces
|
||||
namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
|
||||
{
|
||||
public interface IHasPhoneDialing
|
||||
{
|
||||
@@ -11,4 +12,18 @@ namespace PepperDash_Essentials_Core.DeviceTypeInterfaces
|
||||
void EndPhoneCall();
|
||||
void SendDtmfToPhone(string digit);
|
||||
}
|
||||
}
|
||||
|
||||
namespace PepperDash_Essentials_Core.DeviceTypeInterfaces
|
||||
{
|
||||
[Obsolete("Use PepperDash.Essentials.Core.DeviceTypeInterfaces")]
|
||||
public interface IHasPhoneDialing
|
||||
{
|
||||
BoolFeedback PhoneOffHookFeedback { get; }
|
||||
StringFeedback CallerIdNameFeedback { get; }
|
||||
StringFeedback CallerIdNumberFeedback { get; }
|
||||
void DialPhoneCall(string number);
|
||||
void EndPhoneCall();
|
||||
void SendDtmfToPhone(string digit);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PepperDash_Essentials_Core.DeviceTypeInterfaces
|
||||
namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
|
||||
{
|
||||
public interface ILanguageDefinition
|
||||
{
|
||||
@@ -15,4 +15,21 @@ namespace PepperDash_Essentials_Core.DeviceTypeInterfaces
|
||||
List<LanguageLabel> DestinationGroupNames { get; set; }
|
||||
List<LanguageLabel> RoomNames { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
namespace PepperDash_Essentials_Core.DeviceTypeInterfaces
|
||||
{
|
||||
[Obsolete("Use PepperDash.Essentials.Core.DeviceTypeInterfaces")]
|
||||
public interface ILanguageDefinition
|
||||
{
|
||||
string LocaleName { get; set; }
|
||||
string FriendlyName { get; set; }
|
||||
bool Enable { get; set; }
|
||||
List<LanguageLabel> UiLabels { get; set; }
|
||||
List<LanguageLabel> Sources { get; set; }
|
||||
List<LanguageLabel> Destinations { get; set; }
|
||||
List<LanguageLabel> SourceGroupNames { get; set; }
|
||||
List<LanguageLabel> DestinationGroupNames { get; set; }
|
||||
List<LanguageLabel> RoomNames { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
|
||||
{
|
||||
|
||||
public interface ILanguageProvider
|
||||
{
|
||||
ILanguageDefinition CurrentLanguage { get; set; }
|
||||
|
||||
event EventHandler CurrentLanguageChanged;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace PepperDash_Essentials_Core.DeviceTypeInterfaces
|
||||
{
|
||||
public interface ILanguageProvider
|
||||
[Obsolete("Use PepperDash.Essentials.Core.DeviceTypeInterfaces")]
|
||||
public interface ILanguageProvider
|
||||
{
|
||||
ILanguageDefinition CurrentLanguage { get; set; }
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
|
||||
/// </summary>
|
||||
public interface IMobileControl : IKeyed
|
||||
{
|
||||
void CreateMobileControlRoomBridge(EssentialsRoomBase room, IMobileControl parent);
|
||||
void CreateMobileControlRoomBridge(IEssentialsRoom room, IMobileControl parent);
|
||||
|
||||
void LinkSystemMonitorToAppServer();
|
||||
}
|
||||
@@ -20,6 +20,10 @@ namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
|
||||
{
|
||||
event EventHandler<EventArgs> UserCodeChanged;
|
||||
|
||||
event EventHandler<EventArgs> UserPromptedForCode;
|
||||
|
||||
event EventHandler<EventArgs> ClientJoined;
|
||||
|
||||
string UserCode { get; }
|
||||
|
||||
string QrCodeUrl { get; }
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace PepperDash.Essentials.Core
|
||||
/// </summary>
|
||||
bool HasDpad { get; }
|
||||
|
||||
PepperDash.Essentials.Core.Presets.DevicePresetsModel PresetsModel { get; }
|
||||
PepperDash.Essentials.Core.Presets.DevicePresetsModel TvPresets { get; }
|
||||
void LoadPresets(string filePath);
|
||||
|
||||
void DvrList(bool pressRelease);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using PepperDash.Core;
|
||||
using System;
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash_Essentials_Core.DeviceTypeInterfaces
|
||||
namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
|
||||
{
|
||||
public class LanguageLabel
|
||||
{
|
||||
@@ -9,4 +10,16 @@ namespace PepperDash_Essentials_Core.DeviceTypeInterfaces
|
||||
public string DisplayText { get; set; }
|
||||
public uint JoinNumber { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
namespace PepperDash_Essentials_Core.DeviceTypeInterfaces
|
||||
{
|
||||
[Obsolete("Use PepperDash.Essentials.Core.DeviceTypeInterfaces")]
|
||||
public class LanguageLabel
|
||||
{
|
||||
public string Key { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string DisplayText { get; set; }
|
||||
public uint JoinNumber { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
using Newtonsoft.Json;
|
||||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
public class DestinationListItem
|
||||
{
|
||||
[JsonProperty("sinkKey")]
|
||||
public string SinkKey { get; set; }
|
||||
|
||||
private EssentialsDevice _sinkDevice;
|
||||
|
||||
[JsonIgnore]
|
||||
public EssentialsDevice SinkDevice
|
||||
{
|
||||
get { return _sinkDevice ?? (_sinkDevice = DeviceManager.GetDeviceForKey(SinkKey) as EssentialsDevice); }
|
||||
}
|
||||
|
||||
[JsonProperty("preferredName")]
|
||||
public string PreferredName
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Name))
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
|
||||
return SinkDevice == null ? "---" : SinkDevice.Name;
|
||||
}
|
||||
}
|
||||
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[JsonProperty("includeInDestinationList")]
|
||||
public bool IncludeInDestinationList { get; set; }
|
||||
|
||||
[JsonProperty("order")]
|
||||
public int Order { get; set; }
|
||||
|
||||
[JsonProperty("surfaceLocation")]
|
||||
public int SurfaceLocation { get; set; }
|
||||
|
||||
[JsonProperty("verticalLocation")]
|
||||
public int VerticalLocation { get; set; }
|
||||
|
||||
[JsonProperty("horizontalLocation")]
|
||||
public int HorizontalLocation { get; set; }
|
||||
|
||||
[JsonProperty("sinkType")]
|
||||
public eRoutingSignalType SinkType { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -20,8 +20,23 @@ namespace PepperDash.Essentials.Core
|
||||
/// <param name="json"></param>
|
||||
public static void DoDeviceActionWithJson(string json)
|
||||
{
|
||||
var action = JsonConvert.DeserializeObject<DeviceActionWrapper>(json);
|
||||
DoDeviceAction(action);
|
||||
if (String.IsNullOrEmpty(json))
|
||||
{
|
||||
CrestronConsole.ConsoleCommandResponse(
|
||||
"Please provide a JSON object matching the format {\"deviceKey\":\"myDevice\", \"methodName\":\"someMethod\", \"params\": [\"param1\", true]}.\r\nIf the method has no parameters, the \"params\" object may be omitted.");
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
var action = JsonConvert.DeserializeObject<DeviceActionWrapper>(json);
|
||||
|
||||
DoDeviceAction(action);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
CrestronConsole.ConsoleCommandResponse("Incorrect format for JSON. Please check that the format matches {\"deviceKey\":\"myDevice\", \"methodName\":\"someMethod\", \"params\": [\"param1\", true]}");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -33,31 +48,65 @@ namespace PepperDash.Essentials.Core
|
||||
{
|
||||
var key = action.DeviceKey;
|
||||
var obj = FindObjectOnPath(key);
|
||||
if (obj == null)
|
||||
return;
|
||||
if (obj == null)
|
||||
{
|
||||
CrestronConsole.ConsoleCommandResponse("Unable to find object at path {0}", key);
|
||||
return;
|
||||
}
|
||||
|
||||
CType t = obj.GetType();
|
||||
var method = t.GetMethod(action.MethodName);
|
||||
if (method == null)
|
||||
{
|
||||
Debug.Console(0, "Method '{0}' not found", action.MethodName);
|
||||
return;
|
||||
}
|
||||
var mParams = method.GetParameters();
|
||||
// Add empty params if not provided
|
||||
if (action.Params == null) action.Params = new object[0];
|
||||
if (mParams.Length > action.Params.Length)
|
||||
{
|
||||
Debug.Console(0, "Method '{0}' requires {1} params", action.MethodName, mParams.Length);
|
||||
return;
|
||||
}
|
||||
object[] convertedParams = mParams
|
||||
.Select((p, i) => Convert.ChangeType(action.Params[i], p.ParameterType,
|
||||
System.Globalization.CultureInfo.InvariantCulture))
|
||||
.ToArray();
|
||||
object ret = method.Invoke(obj, convertedParams);
|
||||
if (action.Params == null)
|
||||
{
|
||||
//no params, so setting action.Params to empty array
|
||||
action.Params = new object[0];
|
||||
}
|
||||
|
||||
CType t = obj.GetType();
|
||||
try
|
||||
{
|
||||
var methods = t.GetMethods().Where(m => m.Name == action.MethodName).ToList();
|
||||
|
||||
var method = methods.Count == 1 ? methods[0] : methods.FirstOrDefault(m => m.GetParameters().Length == action.Params.Length);
|
||||
|
||||
if (method == null)
|
||||
{
|
||||
CrestronConsole.ConsoleCommandResponse(
|
||||
"Unable to find method with name {0} and that matches parameters {1}", action.MethodName,
|
||||
action.Params);
|
||||
return;
|
||||
}
|
||||
var mParams = method.GetParameters();
|
||||
|
||||
var convertedParams = mParams
|
||||
.Select((p, i) => ConvertType(action.Params[i], p.ParameterType))
|
||||
.ToArray();
|
||||
method.Invoke(obj, convertedParams);
|
||||
|
||||
CrestronConsole.ConsoleCommandResponse("Method {0} successfully called on device {1}", method.Name,
|
||||
action.DeviceKey);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
CrestronConsole.ConsoleCommandResponse("Unable to call method with name {0}. {1}", action.MethodName,
|
||||
ex.Message);}
|
||||
}
|
||||
|
||||
private static object ConvertType(object value, Type conversionType)
|
||||
{
|
||||
if (!conversionType.IsEnum)
|
||||
{
|
||||
return Convert.ChangeType(value, conversionType, System.Globalization.CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
var stringValue = Convert.ToString(value);
|
||||
|
||||
if (String.IsNullOrEmpty(stringValue))
|
||||
{
|
||||
throw new InvalidCastException(
|
||||
String.Format("{0} cannot be converted to a string prior to conversion to enum"));
|
||||
}
|
||||
return Enum.Parse(conversionType, stringValue, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the properties on a device
|
||||
/// </summary>
|
||||
@@ -242,6 +291,8 @@ namespace PepperDash.Essentials.Core
|
||||
//var props = t.GetProperties().Select(p => new PropertyNameType(p, obj));
|
||||
//return JsonConvert.SerializeObject(props, Formatting.Indented);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class DeviceActionWrapper
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace PepperDash.Essentials.Core
|
||||
CrestronConsole.AddNewConsoleCommand(SimulateComReceiveOnDevice, "devsimreceive",
|
||||
"Simulates incoming data on a com device", ConsoleAccessLevelEnum.AccessOperator);
|
||||
|
||||
CrestronConsole.AddNewConsoleCommand(s => SetDeviceStreamDebugging(s), "setdevicestreamdebug", "set comm debug [deviceKey] [off/rx/tx/both] ([minutes])", ConsoleAccessLevelEnum.AccessOperator);
|
||||
CrestronConsole.AddNewConsoleCommand(SetDeviceStreamDebugging, "setdevicestreamdebug", "set comm debug [deviceKey] [off/rx/tx/both] ([minutes])", ConsoleAccessLevelEnum.AccessOperator);
|
||||
CrestronConsole.AddNewConsoleCommand(s => DisableAllDeviceStreamDebugging(), "disableallstreamdebug", "disables stream debugging on all devices", ConsoleAccessLevelEnum.AccessOperator);
|
||||
}
|
||||
|
||||
@@ -387,6 +387,15 @@ namespace PepperDash.Essentials.Core
|
||||
/// <param name="s"></param>
|
||||
public static void SetDeviceStreamDebugging(string s)
|
||||
{
|
||||
if (String.IsNullOrEmpty(s) || s.Contains("?"))
|
||||
{
|
||||
CrestronConsole.ConsoleCommandResponse(
|
||||
@"SETDEVICESTREAMDEBUG [{deviceKey}] [OFF |TX | RX | BOTH] [timeOutInMinutes]
|
||||
{deviceKey} [OFF | TX | RX | BOTH] - Device to set stream debugging on, and which setting to use
|
||||
timeOutInMinutes - Set timeout for stream debugging. Default is 30 minutes");
|
||||
return;
|
||||
}
|
||||
|
||||
var args = s.Split(' ');
|
||||
|
||||
var deviceKey = args[0];
|
||||
@@ -426,7 +435,7 @@ namespace PepperDash.Essentials.Core
|
||||
var min = Convert.ToUInt32(timeout);
|
||||
|
||||
device.StreamDebugging.SetDebuggingWithSpecificTimeout(debugSetting, min);
|
||||
Debug.Console(0, "Device: '{0}' debug level set to {1) for {2} minutes", deviceKey, debugSetting, min);
|
||||
Debug.Console(0, "Device: '{0}' debug level set to {1} for {2} minutes", deviceKey, debugSetting, min);
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -437,7 +446,7 @@ namespace PepperDash.Essentials.Core
|
||||
else
|
||||
{
|
||||
device.StreamDebugging.SetDebuggingWithDefaultTimeout(debugSetting);
|
||||
Debug.Console(0, "Device: '{0}' debug level set to {1) for default time (30 minutes)", deviceKey, debugSetting);
|
||||
Debug.Console(0, "Device: '{0}' debug level set to {1} for default time (30 minutes)", deviceKey, debugSetting);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,113 +1,113 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharp.Reflection;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the basic needs for an EssentialsDevice to enable it to be build by an IDeviceFactory class
|
||||
/// </summary>
|
||||
[Description("The base Essentials Device Class")]
|
||||
public abstract class EssentialsDevice : Device
|
||||
{
|
||||
protected EssentialsDevice(string key)
|
||||
: base(key)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected EssentialsDevice(string key, string name)
|
||||
: base(key, name)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Class, Inherited = true, AllowMultiple = true)]
|
||||
public class DescriptionAttribute : Attribute
|
||||
{
|
||||
private string _Description;
|
||||
|
||||
public DescriptionAttribute(string description)
|
||||
{
|
||||
Debug.Console(2, "Setting Description: {0}", description);
|
||||
_Description = description;
|
||||
}
|
||||
|
||||
public string Description
|
||||
{
|
||||
get { return _Description; }
|
||||
}
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Class, Inherited = true, AllowMultiple = true)]
|
||||
public class ConfigSnippetAttribute : Attribute
|
||||
{
|
||||
private string _ConfigSnippet;
|
||||
|
||||
public ConfigSnippetAttribute(string configSnippet)
|
||||
{
|
||||
Debug.Console(2, "Setting Config Snippet {0}", configSnippet);
|
||||
_ConfigSnippet = configSnippet;
|
||||
}
|
||||
|
||||
public string ConfigSnippet
|
||||
{
|
||||
get { return _ConfigSnippet; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Devices the basic needs for a Device Factory
|
||||
/// </summary>
|
||||
public abstract class EssentialsDeviceFactory<T> : IDeviceFactory where T:EssentialsDevice
|
||||
{
|
||||
#region IDeviceFactory Members
|
||||
|
||||
/// <summary>
|
||||
/// A list of strings that can be used in the type property of a DeviceConfig object to build an instance of this device
|
||||
/// </summary>
|
||||
public List<string> TypeNames { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Loads an item to the DeviceFactory.FactoryMethods dictionary for each entry in the TypeNames list
|
||||
/// </summary>
|
||||
public void LoadTypeFactories()
|
||||
{
|
||||
foreach (var typeName in TypeNames)
|
||||
{
|
||||
Debug.Console(2, "Getting Description Attribute from class: '{0}'", typeof(T).FullName);
|
||||
var descriptionAttribute = typeof(T).GetCustomAttributes(typeof(DescriptionAttribute), true) as DescriptionAttribute[];
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharp.Reflection;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the basic needs for an EssentialsDevice to enable it to be build by an IDeviceFactory class
|
||||
/// </summary>
|
||||
[Description("The base Essentials Device Class")]
|
||||
public abstract class EssentialsDevice : Device
|
||||
{
|
||||
protected EssentialsDevice(string key)
|
||||
: base(key)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected EssentialsDevice(string key, string name)
|
||||
: base(key, name)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Class, Inherited = true, AllowMultiple = true)]
|
||||
public class DescriptionAttribute : Attribute
|
||||
{
|
||||
private string _Description;
|
||||
|
||||
public DescriptionAttribute(string description)
|
||||
{
|
||||
Debug.Console(2, "Setting Description: {0}", description);
|
||||
_Description = description;
|
||||
}
|
||||
|
||||
public string Description
|
||||
{
|
||||
get { return _Description; }
|
||||
}
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Class, Inherited = true, AllowMultiple = true)]
|
||||
public class ConfigSnippetAttribute : Attribute
|
||||
{
|
||||
private string _ConfigSnippet;
|
||||
|
||||
public ConfigSnippetAttribute(string configSnippet)
|
||||
{
|
||||
Debug.Console(2, "Setting Config Snippet {0}", configSnippet);
|
||||
_ConfigSnippet = configSnippet;
|
||||
}
|
||||
|
||||
public string ConfigSnippet
|
||||
{
|
||||
get { return _ConfigSnippet; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Devices the basic needs for a Device Factory
|
||||
/// </summary>
|
||||
public abstract class EssentialsDeviceFactory<T> : IDeviceFactory where T:EssentialsDevice
|
||||
{
|
||||
#region IDeviceFactory Members
|
||||
|
||||
/// <summary>
|
||||
/// A list of strings that can be used in the type property of a DeviceConfig object to build an instance of this device
|
||||
/// </summary>
|
||||
public List<string> TypeNames { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Loads an item to the DeviceFactory.FactoryMethods dictionary for each entry in the TypeNames list
|
||||
/// </summary>
|
||||
public void LoadTypeFactories()
|
||||
{
|
||||
foreach (var typeName in TypeNames)
|
||||
{
|
||||
Debug.Console(2, "Getting Description Attribute from class: '{0}'", typeof(T).FullName);
|
||||
var descriptionAttribute = typeof(T).GetCustomAttributes(typeof(DescriptionAttribute), true) as DescriptionAttribute[];
|
||||
string description = descriptionAttribute[0].Description;
|
||||
var snippetAttribute = typeof(T).GetCustomAttributes(typeof(ConfigSnippetAttribute), true) as ConfigSnippetAttribute[];
|
||||
DeviceFactory.AddFactoryForType(typeName.ToLower(), description, typeof(T), BuildDevice);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The method that will build the device
|
||||
/// </summary>
|
||||
/// <param name="dc">The device config</param>
|
||||
/// <returns>An instance of the device</returns>
|
||||
public abstract EssentialsDevice BuildDevice(DeviceConfig dc);
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Devices the basic needs for a Device Factory
|
||||
/// </summary>
|
||||
public abstract class EssentialsPluginDeviceFactory<T> : EssentialsDeviceFactory<T>, IPluginDeviceFactory where T : EssentialsDevice
|
||||
{
|
||||
/// <summary>
|
||||
/// Specifies the minimum version of Essentials required for a plugin to run. Must use the format Major.Minor.Build (ex. "1.4.33")
|
||||
/// </summary>
|
||||
public string MinimumEssentialsFrameworkVersion { get; protected set; }
|
||||
}
|
||||
var snippetAttribute = typeof(T).GetCustomAttributes(typeof(ConfigSnippetAttribute), true) as ConfigSnippetAttribute[];
|
||||
DeviceFactory.AddFactoryForType(typeName.ToLower(), description, typeof(T), BuildDevice);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The method that will build the device
|
||||
/// </summary>
|
||||
/// <param name="dc">The device config</param>
|
||||
/// <returns>An instance of the device</returns>
|
||||
public abstract EssentialsDevice BuildDevice(DeviceConfig dc);
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Devices the basic needs for a Device Factory
|
||||
/// </summary>
|
||||
public abstract class EssentialsPluginDeviceFactory<T> : EssentialsDeviceFactory<T>, IPluginDeviceFactory where T : EssentialsDevice
|
||||
{
|
||||
/// <summary>
|
||||
/// Specifies the minimum version of Essentials required for a plugin to run. Must use the format Major.Minor.Build (ex. "1.4.33")
|
||||
/// </summary>
|
||||
public string MinimumEssentialsFrameworkVersion { get; protected set; }
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Bridges;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
|
||||
namespace PepperDash_Essentials_Core.Devices
|
||||
namespace PepperDash.Essentials.Core.Devices
|
||||
{
|
||||
public class GenericIrController: EssentialsBridgeableDevice
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.Core.Devices
|
||||
{
|
||||
public interface IReconfigurableDevice
|
||||
{
|
||||
event EventHandler<EventArgs> ConfigChanged;
|
||||
|
||||
DeviceConfig Config { get; }
|
||||
|
||||
void SetConfig(DeviceConfig config);
|
||||
}
|
||||
}
|
||||
@@ -7,13 +7,15 @@ using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.Bridges;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Devices
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public abstract class ReconfigurableDevice : EssentialsDevice
|
||||
public abstract class ReconfigurableDevice : EssentialsDevice, IReconfigurableDevice
|
||||
{
|
||||
public event EventHandler<EventArgs> ConfigChanged;
|
||||
|
||||
@@ -52,6 +54,8 @@ namespace PepperDash.Essentials.Core.Devices
|
||||
Name = config.Name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Used by the extending class to allow for any custom actions to be taken (tell the ConfigWriter to write config, etc)
|
||||
/// </summary>
|
||||
|
||||
@@ -130,10 +130,24 @@ namespace PepperDash.Essentials.Core
|
||||
[JsonProperty("sourceListKey")]
|
||||
public string SourceListKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates if the device associated with this source is controllable
|
||||
/// </summary>
|
||||
[JsonProperty("isControllable")]
|
||||
public bool IsControllable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that the device associated with this source has audio available
|
||||
/// </summary>
|
||||
[JsonProperty("isAudioSource")]
|
||||
public bool IsAudioSource { get; set; }
|
||||
|
||||
public SourceListItem()
|
||||
{
|
||||
Icon = "Blank";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class SourceRouteListItem
|
||||
|
||||
@@ -59,6 +59,9 @@ namespace PepperDash.Essentials.Core
|
||||
|
||||
VolumeLevelFeedback = new IntFeedback(() => { return _FakeVolumeLevel; });
|
||||
MuteFeedback = new BoolFeedback("MuteOn", () => _IsMuted);
|
||||
|
||||
WarmupTime = 10000;
|
||||
CooldownTime = 5000;
|
||||
}
|
||||
|
||||
public override void PowerOn()
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
public static class JsonExtensions
|
||||
{
|
||||
public static List<JToken> FindTokens(this JToken containerToken, string name)
|
||||
{
|
||||
List<JToken> matches = new List<JToken>();
|
||||
FindTokens(containerToken, name, matches);
|
||||
return matches;
|
||||
}
|
||||
|
||||
private static void FindTokens(JToken containerToken, string name, List<JToken> matches)
|
||||
{
|
||||
if (containerToken.Type == JTokenType.Object)
|
||||
{
|
||||
foreach (JProperty child in containerToken.Children<JProperty>())
|
||||
{
|
||||
if (child.Name == name)
|
||||
{
|
||||
matches.Add(child.Value);
|
||||
}
|
||||
FindTokens(child.Value, name, matches);
|
||||
}
|
||||
}
|
||||
else if (containerToken.Type == JTokenType.Array)
|
||||
{
|
||||
foreach (JToken child in containerToken.Children())
|
||||
{
|
||||
FindTokens(child, name, matches);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,8 @@ using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.GeneralIO;
|
||||
using Crestron.SimplSharp.Reflection;
|
||||
using PepperDash.Core;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.Core.CrestronIO;
|
||||
@@ -67,13 +69,13 @@ namespace PepperDash.Essentials.Core
|
||||
/// <returns></returns>
|
||||
public static void AddFactoryForType(string typeName, Func<DeviceConfig, IKeyed> method)
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Adding factory method for type '{0}'", typeName);
|
||||
Debug.Console(1, Debug.ErrorLogLevel.Notice, "Adding factory method for type '{0}'", typeName);
|
||||
DeviceFactory.FactoryMethods.Add(typeName, new DeviceFactoryWrapper() { FactoryMethod = method});
|
||||
}
|
||||
|
||||
public static void AddFactoryForType(string typeName, string description, CType cType, Func<DeviceConfig, IKeyed> method)
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Adding factory method for type '{0}'", typeName);
|
||||
Debug.Console(1, Debug.ErrorLogLevel.Notice, "Adding factory method for type '{0}'", typeName);
|
||||
|
||||
if(FactoryMethods.ContainsKey(typeName))
|
||||
{
|
||||
@@ -83,33 +85,81 @@ namespace PepperDash.Essentials.Core
|
||||
|
||||
var wrapper = new DeviceFactoryWrapper() { CType = cType, Description = description, FactoryMethod = method };
|
||||
DeviceFactory.FactoryMethods.Add(typeName, wrapper);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The factory method for Core "things". Also iterates the Factory methods that have
|
||||
/// been loaded from plugins
|
||||
/// </summary>
|
||||
/// <param name="dc"></param>
|
||||
/// <returns></returns>
|
||||
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();
|
||||
|
||||
// Check for types that have been added by plugin dlls.
|
||||
if (FactoryMethods.ContainsKey(typeName))
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Loading '{0}' from Essentials Core", dc.Type);
|
||||
return FactoryMethods[typeName].FactoryMethod(dc);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static void CheckForSecrets(IEnumerable<JProperty> obj)
|
||||
{
|
||||
foreach (var prop in obj.Where(prop => prop.Value as JObject != null))
|
||||
{
|
||||
if (prop.Name.ToLower() == "secret")
|
||||
{
|
||||
var secret = GetSecret(prop.Children().First().ToObject<SecretsPropertiesConfig>());
|
||||
//var secret = GetSecret(JsonConvert.DeserializeObject<SecretsPropertiesConfig>(prop.Children().First().ToString()));
|
||||
prop.Parent.Replace(secret);
|
||||
}
|
||||
var recurseProp = prop.Value as JObject;
|
||||
if (recurseProp == null) return;
|
||||
CheckForSecrets(recurseProp.Properties());
|
||||
}
|
||||
}
|
||||
|
||||
private static string GetSecret(SecretsPropertiesConfig data)
|
||||
{
|
||||
var secretProvider = SecretsManager.GetSecretProviderByKey(data.Provider);
|
||||
if (secretProvider == null) return null;
|
||||
var secret = secretProvider.GetSecret(data.Key);
|
||||
if (secret != null) return (string) secret.Value;
|
||||
Debug.Console(1,
|
||||
"Unable to retrieve secret {0}{1} - Make sure you've added it to the secrets provider",
|
||||
data.Provider, data.Key);
|
||||
return String.Empty;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The factory method for Core "things". Also iterates the Factory methods that have
|
||||
/// been loaded from plugins
|
||||
/// </summary>
|
||||
/// <param name="dc"></param>
|
||||
/// <returns></returns>
|
||||
public static IKeyed GetDevice(DeviceConfig dc)
|
||||
{
|
||||
try
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Loading '{0}' from Essentials Core", dc.Type);
|
||||
|
||||
var localDc = new DeviceConfig(dc);
|
||||
|
||||
var key = localDc.Key;
|
||||
var name = localDc.Name;
|
||||
var type = localDc.Type;
|
||||
var properties = localDc.Properties;
|
||||
//var propRecurse = properties;
|
||||
|
||||
var typeName = localDc.Type.ToLower();
|
||||
|
||||
|
||||
var jObject = properties as JObject;
|
||||
if (jObject != null)
|
||||
{
|
||||
var jProp = jObject.Properties();
|
||||
|
||||
CheckForSecrets(jProp);
|
||||
}
|
||||
|
||||
Debug.Console(2, "typeName = {0}", typeName);
|
||||
// Check for types that have been added by plugin dlls.
|
||||
return !FactoryMethods.ContainsKey(typeName) ? null : FactoryMethods[typeName].FactoryMethod(localDc);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Error, "Exception occurred while creating device {0}: {1}", dc.Key, ex.Message);
|
||||
|
||||
Debug.Console(2, "{0}", ex.StackTrace);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Prints the type names and associated metadata from the FactoryMethods collection.
|
||||
/// </summary>
|
||||
|
||||
@@ -3,8 +3,9 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash_Essentials_Core
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
public class IsReadyEventArgs : EventArgs
|
||||
{
|
||||
@@ -16,6 +17,27 @@ namespace PepperDash_Essentials_Core
|
||||
}
|
||||
}
|
||||
|
||||
public interface IHasReady
|
||||
{
|
||||
event EventHandler<IsReadyEventArgs> IsReadyEvent;
|
||||
bool IsReady { get; }
|
||||
}
|
||||
}
|
||||
|
||||
namespace PepperDash_Essentials_Core
|
||||
{
|
||||
[Obsolete("Use PepperDash.Essentials.Core")]
|
||||
public class IsReadyEventArgs : EventArgs
|
||||
{
|
||||
public bool IsReady { get; set; }
|
||||
|
||||
public IsReadyEventArgs(bool data)
|
||||
{
|
||||
IsReady = data;
|
||||
}
|
||||
}
|
||||
|
||||
[Obsolete("Use PepperDash.Essentials.Core")]
|
||||
public interface IHasReady
|
||||
{
|
||||
event EventHandler<IsReadyEventArgs> IsReadyEvent;
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace PepperDash.Essentials.Core
|
||||
|
||||
protected bool ComputedValue;
|
||||
|
||||
public BoolFeedbackLogic()
|
||||
protected BoolFeedbackLogic()
|
||||
{
|
||||
Output = new BoolFeedback(() => ComputedValue);
|
||||
}
|
||||
@@ -40,21 +40,18 @@ namespace PepperDash.Essentials.Core
|
||||
|
||||
public void AddOutputsIn(List<BoolFeedback> outputs)
|
||||
{
|
||||
foreach (var o in outputs)
|
||||
{
|
||||
// skip existing
|
||||
if (OutputsIn.Contains(o)) continue;
|
||||
|
||||
OutputsIn.Add(o);
|
||||
o.OutputChange += AnyInput_OutputChange;
|
||||
}
|
||||
Evaluate();
|
||||
foreach (var o in outputs.Where(o => !OutputsIn.Contains(o)))
|
||||
{
|
||||
OutputsIn.Add(o);
|
||||
o.OutputChange += AnyInput_OutputChange;
|
||||
}
|
||||
Evaluate();
|
||||
}
|
||||
|
||||
public void RemoveOutputIn(BoolFeedback output)
|
||||
public void RemoveOutputIn(BoolFeedback output)
|
||||
{
|
||||
// Don't double up outputs
|
||||
if (OutputsIn.Contains(output)) return;
|
||||
if (!OutputsIn.Contains(output)) return;
|
||||
|
||||
OutputsIn.Remove(output);
|
||||
output.OutputChange -= AnyInput_OutputChange;
|
||||
@@ -71,6 +68,12 @@ namespace PepperDash.Essentials.Core
|
||||
Evaluate();
|
||||
}
|
||||
|
||||
public void ClearOutputs()
|
||||
{
|
||||
OutputsIn.Clear();
|
||||
Evaluate();
|
||||
}
|
||||
|
||||
void AnyInput_OutputChange(object sender, EventArgs e)
|
||||
{
|
||||
Evaluate();
|
||||
@@ -85,11 +88,12 @@ namespace PepperDash.Essentials.Core
|
||||
{
|
||||
var prevValue = ComputedValue;
|
||||
var newValue = OutputsIn.All(o => o.BoolValue);
|
||||
if (newValue != prevValue)
|
||||
{
|
||||
ComputedValue = newValue;
|
||||
Output.FireUpdate();
|
||||
}
|
||||
if (newValue == prevValue)
|
||||
{
|
||||
return;
|
||||
}
|
||||
ComputedValue = newValue;
|
||||
Output.FireUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,33 +103,35 @@ namespace PepperDash.Essentials.Core
|
||||
{
|
||||
var prevValue = ComputedValue;
|
||||
var newValue = OutputsIn.Any(o => o.BoolValue);
|
||||
if (newValue != prevValue)
|
||||
{
|
||||
ComputedValue = newValue;
|
||||
Output.FireUpdate();
|
||||
}
|
||||
if (newValue == prevValue)
|
||||
{
|
||||
return;
|
||||
}
|
||||
ComputedValue = newValue;
|
||||
Output.FireUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
public class BoolFeedbackLinq : BoolFeedbackLogic
|
||||
{
|
||||
Func<IEnumerable<BoolFeedback>, bool> Predicate;
|
||||
readonly Func<IEnumerable<BoolFeedback>, bool> _predicate;
|
||||
|
||||
public BoolFeedbackLinq(Func<IEnumerable<BoolFeedback>, bool> predicate)
|
||||
: base()
|
||||
{
|
||||
Predicate = predicate;
|
||||
_predicate = predicate;
|
||||
}
|
||||
|
||||
protected override void Evaluate()
|
||||
{
|
||||
var prevValue = ComputedValue;
|
||||
var newValue = Predicate(OutputsIn);
|
||||
if (newValue != prevValue)
|
||||
{
|
||||
ComputedValue = newValue;
|
||||
Output.FireUpdate();
|
||||
}
|
||||
var newValue = _predicate(OutputsIn);
|
||||
if (newValue == prevValue)
|
||||
{
|
||||
return;
|
||||
}
|
||||
ComputedValue = newValue;
|
||||
Output.FireUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,7 @@ namespace PepperDash.Essentials.Core.Fusion
|
||||
protected FusionRoom FusionRoom;
|
||||
protected Dictionary<int, FusionAsset> FusionStaticAssets;
|
||||
public long PushNotificationTimeout = 5000;
|
||||
protected EssentialsRoomBase Room;
|
||||
protected IEssentialsRoom Room;
|
||||
public long SchedulePollInterval = 300000;
|
||||
|
||||
private Event _currentMeeting;
|
||||
@@ -86,7 +86,7 @@ namespace PepperDash.Essentials.Core.Fusion
|
||||
|
||||
#endregion
|
||||
|
||||
public EssentialsHuddleSpaceFusionSystemControllerBase(EssentialsRoomBase room, uint ipId, string joinMapKey)
|
||||
public EssentialsHuddleSpaceFusionSystemControllerBase(IEssentialsRoom room, uint ipId, string joinMapKey)
|
||||
: base(room.Key + "-fusion")
|
||||
{
|
||||
try
|
||||
@@ -1676,20 +1676,46 @@ namespace PepperDash.Essentials.Core.Fusion
|
||||
public static FusionStaticAsset CreateStaticAsset(this FusionRoom fr, uint number, string name, string type,
|
||||
string instanceId)
|
||||
{
|
||||
Debug.Console(0, "Adding Fusion Static Asset '{0}' to slot {1} with GUID: '{2}'", name, number, instanceId);
|
||||
try
|
||||
{
|
||||
Debug.Console(0, "Adding Fusion Static Asset '{0}' to slot {1} with GUID: '{2}'", name, number, instanceId);
|
||||
|
||||
fr.AddAsset(eAssetType.StaticAsset, number, name, type, instanceId);
|
||||
return fr.UserConfigurableAssetDetails[number].Asset as FusionStaticAsset;
|
||||
fr.AddAsset(eAssetType.StaticAsset, number, name, type, instanceId);
|
||||
return fr.UserConfigurableAssetDetails[number].Asset as FusionStaticAsset;
|
||||
}
|
||||
catch (InvalidOperationException ex)
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Error creating Static Asset for device: '{0}'. Check that multiple devices don't have missing or duplicate uid properties in configuration. /r/nError: {1}", name, ex);
|
||||
return null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Console(2, Debug.ErrorLogLevel.Error, "Error creating Static Asset: {0}", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static FusionOccupancySensor CreateOccupancySensorAsset(this FusionRoom fr, uint number, string name,
|
||||
string type, string instanceId)
|
||||
{
|
||||
Debug.Console(0, "Adding Fusion Occupancy Sensor Asset '{0}' to slot {1} with GUID: '{2}'", name, number,
|
||||
instanceId);
|
||||
try
|
||||
{
|
||||
Debug.Console(0, "Adding Fusion Occupancy Sensor Asset '{0}' to slot {1} with GUID: '{2}'", name, number,
|
||||
instanceId);
|
||||
|
||||
fr.AddAsset(eAssetType.OccupancySensor, number, name, type, instanceId);
|
||||
return fr.UserConfigurableAssetDetails[number].Asset as FusionOccupancySensor;
|
||||
fr.AddAsset(eAssetType.OccupancySensor, number, name, type, instanceId);
|
||||
return fr.UserConfigurableAssetDetails[number].Asset as FusionOccupancySensor;
|
||||
}
|
||||
catch (InvalidOperationException ex)
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Error creating Static Asset for device: '{0}'. Check that multiple devices don't have missing or duplicate uid properties in configuration. Error: {1}", name, ex);
|
||||
return null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Console(2, Debug.ErrorLogLevel.Error, "Error creating Static Asset: {0}", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ namespace PepperDash.Essentials.Core.Fusion
|
||||
|
||||
deviceConfig.Properties = JToken.FromObject(devProps);
|
||||
}
|
||||
else if (device is EssentialsRoomBase)
|
||||
else if (device is IEssentialsRoom)
|
||||
{
|
||||
// Set the room name
|
||||
if (!string.IsNullOrEmpty(roomInfo.Name))
|
||||
|
||||
@@ -10,9 +10,7 @@ using Crestron.SimplSharpPro.DeviceSupport;
|
||||
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash_Essentials_Core;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
|
||||
@@ -26,6 +26,8 @@ namespace PepperDash.Essentials.Core
|
||||
|
||||
public static LicenseManager LicenseManager { get; set; }
|
||||
|
||||
public static eCrestronSeries ProcessorSeries { get { return CrestronEnvironment.ProgramCompatibility; } }
|
||||
|
||||
/// <summary>
|
||||
/// The file path prefix to the folder containing configuration files
|
||||
/// </summary>
|
||||
|
||||
@@ -24,6 +24,10 @@ namespace PepperDash.Essentials.Core
|
||||
CrestronConsole.AddNewConsoleCommand(ClearEventsFromGroup, "ClearAllEvents", "Clears all scheduled events for this group", ConsoleAccessLevelEnum.AccessOperator);
|
||||
|
||||
CrestronConsole.AddNewConsoleCommand(ListAllEventGroups, "ListAllEventGroups", "Lists all the event groups by key", ConsoleAccessLevelEnum.AccessOperator);
|
||||
|
||||
CrestronConsole.AddNewConsoleCommand(ListAllEventsForGroup, "ListEventsForGroup",
|
||||
"Lists all events for the given group", ConsoleAccessLevelEnum.AccessOperator);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -32,12 +36,26 @@ namespace PepperDash.Essentials.Core
|
||||
/// <param name="groupName"></param>
|
||||
static void ClearEventsFromGroup(string groupName)
|
||||
{
|
||||
if (!EventGroups.ContainsKey(groupName))
|
||||
{
|
||||
Debug.Console(0,
|
||||
"[Scheduler]: Unable to delete events from group '{0}'. Group not found in EventGroups dictionary.",
|
||||
groupName);
|
||||
return;
|
||||
}
|
||||
|
||||
var group = EventGroups[groupName];
|
||||
|
||||
if (group != null)
|
||||
{
|
||||
group.ClearAllEvents();
|
||||
|
||||
Debug.Console(0, "[Scheduler]: All events deleted from group '{0}'", groupName);
|
||||
}
|
||||
else
|
||||
Debug.Console(0, "[Scheduler]: Unable to delete events from group '{0}'. Group not found in EventGroups dictionary.", groupName);
|
||||
Debug.Console(0,
|
||||
"[Scheduler]: Unable to delete events from group '{0}'. Group not found in EventGroups dictionary.",
|
||||
groupName);
|
||||
}
|
||||
|
||||
static void ListAllEventGroups(string command)
|
||||
@@ -49,6 +67,33 @@ namespace PepperDash.Essentials.Core
|
||||
}
|
||||
}
|
||||
|
||||
static void ListAllEventsForGroup(string args)
|
||||
{
|
||||
Debug.Console(0, "Getting events for group {0}...", args);
|
||||
|
||||
ScheduledEventGroup group;
|
||||
|
||||
if (!EventGroups.TryGetValue(args, out group))
|
||||
{
|
||||
Debug.Console(0, "Unabled to get event group for key {0}", args);
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var evt in group.ScheduledEvents)
|
||||
{
|
||||
Debug.Console(0,
|
||||
@"
|
||||
****Event key {0}****
|
||||
Event date/time: {1}
|
||||
Persistent: {2}
|
||||
Acknowlegable: {3}
|
||||
Recurrence: {4}
|
||||
Recurrence Days: {5}
|
||||
********************", evt.Key, evt.Value.DateAndTime, evt.Value.Persistent, evt.Value.Acknowledgeable,
|
||||
evt.Value.Recurrence.Recurrence, evt.Value.Recurrence.RecurrenceDays);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds the event group to the global list
|
||||
/// </summary>
|
||||
|
||||
@@ -233,7 +233,10 @@ namespace PepperDash.Essentials.Core
|
||||
}
|
||||
|
||||
|
||||
PrintJoinMapInfo();
|
||||
if (Debug.Level > 0)
|
||||
{
|
||||
PrintJoinMapInfo();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,460 +1,539 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using Crestron.SimplSharpPro.GeneralIO;
|
||||
using Newtonsoft.Json;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.Core.Bridges;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
[Description("Wrapper class for Single Technology GLS Occupancy Sensors")]
|
||||
public class GlsOccupancySensorBaseController : CrestronGenericBridgeableBaseDevice, IOccupancyStatusProvider
|
||||
{
|
||||
public GlsOccupancySensorBase OccSensor { get; private set; }
|
||||
[Description("Wrapper class for Single Technology GLS Occupancy Sensors")]
|
||||
[ConfigSnippet("\"properties\": {\"control\": {\"method\": \"cresnet\",\"cresnetId\": \"97\"},\"enablePir\": true,\"enableLedFlash\": true,\"enableRawStates\":true,\"remoteTimeout\": 30,\"internalPhotoSensorMinChange\": 0,\"externalPhotoSensorMinChange\": 0}")]
|
||||
public abstract class GlsOccupancySensorBaseController : CrestronGenericBridgeableBaseDevice, IOccupancyStatusProvider
|
||||
{
|
||||
public GlsOccupancySensorPropertiesConfig PropertiesConfig { get; private set; }
|
||||
|
||||
public BoolFeedback RoomIsOccupiedFeedback { get; private set; }
|
||||
protected GlsOccupancySensorBase OccSensor;
|
||||
|
||||
public BoolFeedback GraceOccupancyDetectedFeedback { get; private set; }
|
||||
public BoolFeedback RoomIsOccupiedFeedback { get; private set; }
|
||||
|
||||
public BoolFeedback RawOccupancyFeedback { get; private set; }
|
||||
public BoolFeedback GraceOccupancyDetectedFeedback { get; private set; }
|
||||
|
||||
public BoolFeedback PirSensorEnabledFeedback { get; private set; }
|
||||
public BoolFeedback RawOccupancyFeedback { get; private set; }
|
||||
|
||||
public BoolFeedback LedFlashEnabledFeedback { get; private set; }
|
||||
public BoolFeedback PirSensorEnabledFeedback { get; private set; }
|
||||
|
||||
public BoolFeedback ShortTimeoutEnabledFeedback { get; private set; }
|
||||
public BoolFeedback LedFlashEnabledFeedback { get; private set; }
|
||||
|
||||
public IntFeedback PirSensitivityInVacantStateFeedback { get; private set; }
|
||||
public BoolFeedback ShortTimeoutEnabledFeedback { get; private set; }
|
||||
|
||||
public IntFeedback PirSensitivityInOccupiedStateFeedback { get; private set; }
|
||||
public IntFeedback PirSensitivityInVacantStateFeedback { get; private set; }
|
||||
|
||||
public IntFeedback CurrentTimeoutFeedback { get; private set; }
|
||||
public IntFeedback PirSensitivityInOccupiedStateFeedback { get; private set; }
|
||||
|
||||
public IntFeedback LocalTimoutFeedback { get; private set; }
|
||||
public IntFeedback CurrentTimeoutFeedback { get; private set; }
|
||||
|
||||
public IntFeedback InternalPhotoSensorValue { get; set; }
|
||||
public IntFeedback LocalTimoutFeedback { get; private set; }
|
||||
|
||||
public IntFeedback ExternalPhotoSensorValue { get; set; }
|
||||
public IntFeedback InternalPhotoSensorValue { get; set; }
|
||||
|
||||
// Debug properties
|
||||
public bool InTestMode { get; private set; }
|
||||
public IntFeedback ExternalPhotoSensorValue { get; set; }
|
||||
|
||||
public bool TestRoomIsOccupiedFeedback { get; private set; }
|
||||
// Debug properties
|
||||
public bool InTestMode { get; private set; }
|
||||
|
||||
public Func<bool> RoomIsOccupiedFeedbackFunc
|
||||
public bool TestRoomIsOccupiedFeedback { get; private set; }
|
||||
|
||||
public Func<bool> RoomIsOccupiedFeedbackFunc
|
||||
{
|
||||
get
|
||||
{
|
||||
return () => InTestMode ? TestRoomIsOccupiedFeedback : OccSensor.OccupancyDetectedFeedback.BoolValue;
|
||||
}
|
||||
}
|
||||
|
||||
protected GlsOccupancySensorBaseController(string key, DeviceConfig config)
|
||||
: this(key, config.Name, config)
|
||||
{
|
||||
}
|
||||
|
||||
protected GlsOccupancySensorBaseController(string key, string name, DeviceConfig config)
|
||||
: base(key, name)
|
||||
{
|
||||
get
|
||||
|
||||
var props = config.Properties.ToObject<GlsOccupancySensorPropertiesConfig>();
|
||||
|
||||
if (props != null)
|
||||
{
|
||||
return () => InTestMode ? TestRoomIsOccupiedFeedback : OccSensor.OccupancyDetectedFeedback.BoolValue;
|
||||
}
|
||||
}
|
||||
|
||||
public GlsOccupancySensorBaseController(string key, Func<DeviceConfig, GlsOccupancySensorBase> preActivationFunc,
|
||||
DeviceConfig config)
|
||||
: base(key, config.Name)
|
||||
{
|
||||
|
||||
|
||||
AddPreActivationAction(() =>
|
||||
{
|
||||
OccSensor = preActivationFunc(config);
|
||||
|
||||
RegisterCrestronGenericBase(OccSensor);
|
||||
|
||||
RegisterGlsOdtSensorBaseController(OccSensor);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public GlsOccupancySensorBaseController(string key, string name) : base(key, name) {}
|
||||
|
||||
protected void RegisterGlsOdtSensorBaseController(GlsOccupancySensorBase occSensor)
|
||||
{
|
||||
OccSensor = occSensor;
|
||||
|
||||
RoomIsOccupiedFeedback = new BoolFeedback(RoomIsOccupiedFeedbackFunc);
|
||||
|
||||
PirSensorEnabledFeedback = new BoolFeedback(() => OccSensor.PirEnabledFeedback.BoolValue);
|
||||
|
||||
LedFlashEnabledFeedback = new BoolFeedback(() => OccSensor.LedFlashEnabledFeedback.BoolValue);
|
||||
|
||||
ShortTimeoutEnabledFeedback = new BoolFeedback(() => OccSensor.ShortTimeoutEnabledFeedback.BoolValue);
|
||||
|
||||
PirSensitivityInVacantStateFeedback =
|
||||
new IntFeedback(() => OccSensor.PirSensitivityInVacantStateFeedback.UShortValue);
|
||||
|
||||
PirSensitivityInOccupiedStateFeedback =
|
||||
new IntFeedback(() => OccSensor.PirSensitivityInOccupiedStateFeedback.UShortValue);
|
||||
|
||||
CurrentTimeoutFeedback = new IntFeedback(() => OccSensor.CurrentTimeoutFeedback.UShortValue);
|
||||
|
||||
LocalTimoutFeedback = new IntFeedback(() => OccSensor.LocalTimeoutFeedback.UShortValue);
|
||||
|
||||
GraceOccupancyDetectedFeedback =
|
||||
new BoolFeedback(() => OccSensor.GraceOccupancyDetectedFeedback.BoolValue);
|
||||
|
||||
RawOccupancyFeedback = new BoolFeedback(() => OccSensor.RawOccupancyFeedback.BoolValue);
|
||||
|
||||
InternalPhotoSensorValue = new IntFeedback(() => OccSensor.InternalPhotoSensorValueFeedback.UShortValue);
|
||||
|
||||
ExternalPhotoSensorValue = new IntFeedback(() => OccSensor.ExternalPhotoSensorValueFeedback.UShortValue);
|
||||
|
||||
OccSensor.BaseEvent += OccSensor_BaseEvent;
|
||||
|
||||
OccSensor.GlsOccupancySensorChange += OccSensor_GlsOccupancySensorChange;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Catches events for feedbacks on the base class. Any extending wrapper class should call this delegate after it checks for it's own event IDs.
|
||||
/// </summary>
|
||||
/// <param name="device"></param>
|
||||
/// <param name="args"></param>
|
||||
protected virtual void OccSensor_GlsOccupancySensorChange(GlsOccupancySensorBase device, GlsOccupancySensorChangeEventArgs args)
|
||||
{
|
||||
switch (args.EventId)
|
||||
{
|
||||
case GlsOccupancySensorBase.PirEnabledFeedbackEventId:
|
||||
PirSensorEnabledFeedback.FireUpdate();
|
||||
break;
|
||||
case GlsOccupancySensorBase.LedFlashEnabledFeedbackEventId:
|
||||
LedFlashEnabledFeedback.FireUpdate();
|
||||
break;
|
||||
case GlsOccupancySensorBase.ShortTimeoutEnabledFeedbackEventId:
|
||||
ShortTimeoutEnabledFeedback.FireUpdate();
|
||||
break;
|
||||
case GlsOccupancySensorBase.PirSensitivityInOccupiedStateFeedbackEventId:
|
||||
PirSensitivityInOccupiedStateFeedback.FireUpdate();
|
||||
break;
|
||||
case GlsOccupancySensorBase.PirSensitivityInVacantStateFeedbackEventId:
|
||||
PirSensitivityInVacantStateFeedback.FireUpdate();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OccSensor_BaseEvent(Crestron.SimplSharpPro.GenericBase device, Crestron.SimplSharpPro.BaseEventArgs args)
|
||||
{
|
||||
Debug.Console(2, this, "GlsOccupancySensorChange EventId: {0}", args.EventId);
|
||||
|
||||
switch (args.EventId)
|
||||
{
|
||||
case Crestron.SimplSharpPro.GeneralIO.GlsOccupancySensorBase.RoomVacantFeedbackEventId:
|
||||
case Crestron.SimplSharpPro.GeneralIO.GlsOccupancySensorBase.RoomOccupiedFeedbackEventId:
|
||||
Debug.Console(1, this, "Occupancy State: {0}", OccSensor.OccupancyDetectedFeedback.BoolValue);
|
||||
RoomIsOccupiedFeedback.FireUpdate();
|
||||
break;
|
||||
case GlsOccupancySensorBase.TimeoutFeedbackEventId:
|
||||
CurrentTimeoutFeedback.FireUpdate();
|
||||
break;
|
||||
case GlsOccupancySensorBase.TimeoutLocalFeedbackEventId:
|
||||
LocalTimoutFeedback.FireUpdate();
|
||||
break;
|
||||
case GlsOccupancySensorBase.GraceOccupancyDetectedFeedbackEventId:
|
||||
GraceOccupancyDetectedFeedback.FireUpdate();
|
||||
break;
|
||||
case GlsOccupancySensorBase.RawOccupancyFeedbackEventId:
|
||||
RawOccupancyFeedback.FireUpdate();
|
||||
break;
|
||||
case GlsOccupancySensorBase.InternalPhotoSensorValueFeedbackEventId:
|
||||
InternalPhotoSensorValue.FireUpdate();
|
||||
break;
|
||||
case GlsOccupancySensorBase.ExternalPhotoSensorValueFeedbackEventId:
|
||||
ExternalPhotoSensorValue.FireUpdate();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetTestMode(bool mode)
|
||||
{
|
||||
InTestMode = mode;
|
||||
|
||||
Debug.Console(1, this, "In Mock Mode: '{0}'", InTestMode);
|
||||
}
|
||||
|
||||
public void SetTestOccupiedState(bool state)
|
||||
{
|
||||
if (!InTestMode)
|
||||
Debug.Console(1, "Mock mode not enabled");
|
||||
else
|
||||
{
|
||||
TestRoomIsOccupiedFeedback = state;
|
||||
|
||||
RoomIsOccupiedFeedback.FireUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables the PIR sensor
|
||||
/// </summary>
|
||||
/// <param name="state"></param>
|
||||
public void SetPirEnable(bool state)
|
||||
{
|
||||
if (state)
|
||||
{
|
||||
OccSensor.EnablePir.BoolValue = state;
|
||||
OccSensor.DisablePir.BoolValue = !state;
|
||||
PropertiesConfig = props;
|
||||
}
|
||||
else
|
||||
{
|
||||
OccSensor.EnablePir.BoolValue = state;
|
||||
OccSensor.DisablePir.BoolValue = !state;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables the LED Flash
|
||||
/// </summary>
|
||||
/// <param name="state"></param>
|
||||
public void SetLedFlashEnable(bool state)
|
||||
{
|
||||
if (state)
|
||||
{
|
||||
OccSensor.EnableLedFlash.BoolValue = state;
|
||||
OccSensor.DisableLedFlash.BoolValue = !state;
|
||||
}
|
||||
else
|
||||
{
|
||||
OccSensor.EnableLedFlash.BoolValue = state;
|
||||
OccSensor.DisableLedFlash.BoolValue = !state;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables short timeout based on state
|
||||
/// </summary>
|
||||
/// <param name="state"></param>
|
||||
public void SetShortTimeoutState(bool state)
|
||||
{
|
||||
if (state)
|
||||
{
|
||||
OccSensor.EnableShortTimeout.BoolValue = state;
|
||||
OccSensor.DisableShortTimeout.BoolValue = !state;
|
||||
}
|
||||
else
|
||||
{
|
||||
OccSensor.EnableShortTimeout.BoolValue = state;
|
||||
OccSensor.DisableShortTimeout.BoolValue = !state;
|
||||
}
|
||||
}
|
||||
|
||||
public void IncrementPirSensitivityInOccupiedState(bool pressRelease)
|
||||
{
|
||||
OccSensor.IncrementPirSensitivityInOccupiedState.BoolValue = pressRelease;
|
||||
}
|
||||
|
||||
public void DecrementPirSensitivityInOccupiedState(bool pressRelease)
|
||||
{
|
||||
OccSensor.DecrementPirSensitivityInOccupiedState.BoolValue = pressRelease;
|
||||
}
|
||||
|
||||
public void IncrementPirSensitivityInVacantState(bool pressRelease)
|
||||
{
|
||||
OccSensor.IncrementPirSensitivityInVacantState.BoolValue = pressRelease;
|
||||
}
|
||||
|
||||
public void DecrementPirSensitivityInVacantState(bool pressRelease)
|
||||
{
|
||||
OccSensor.DecrementPirSensitivityInVacantState.BoolValue = pressRelease;
|
||||
}
|
||||
|
||||
public void ForceOccupied()
|
||||
{
|
||||
OccSensor.ForceOccupied.BoolValue = true;
|
||||
}
|
||||
|
||||
public void ForceVacant()
|
||||
{
|
||||
OccSensor.ForceVacant.BoolValue = true;
|
||||
}
|
||||
|
||||
public void EnableRawStates(bool state)
|
||||
{
|
||||
OccSensor.EnableRawStates.BoolValue = state;
|
||||
}
|
||||
|
||||
public void SetRemoteTimeout(ushort time)
|
||||
{
|
||||
OccSensor.RemoteTimeout.UShortValue = time;
|
||||
}
|
||||
|
||||
public void SetInternalPhotoSensorMinChange(ushort value)
|
||||
{
|
||||
OccSensor.InternalPhotoSensorMinimumChange.UShortValue = value;
|
||||
}
|
||||
|
||||
public void SetExternalPhotoSensorMinChange(ushort value)
|
||||
{
|
||||
OccSensor.ExternalPhotoSensorMinimumChange.UShortValue = value;
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected void LinkOccSensorToApi(GlsOccupancySensorBaseController occController, BasicTriList trilist,
|
||||
uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
|
||||
{
|
||||
var joinMap = new GlsOccupancySensorBaseJoinMap(joinStart);
|
||||
|
||||
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
|
||||
|
||||
if (!string.IsNullOrEmpty(joinMapSerialized))
|
||||
joinMap = JsonConvert.DeserializeObject<GlsOccupancySensorBaseJoinMap>(joinMapSerialized);
|
||||
|
||||
if (bridge != null)
|
||||
{
|
||||
bridge.AddJoinMap(Key, joinMap);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
|
||||
Debug.Console(1, this, "props are null. Unable to deserialize into GlsOccupancySensorPropertiesConfig");
|
||||
}
|
||||
|
||||
Debug.Console(1, occController, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||
|
||||
#region Single and Dual Sensor Stuff
|
||||
occController.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]);
|
||||
trilist.StringInput[joinMap.Name.JoinNumber].StringValue = occController.Name;
|
||||
|
||||
trilist.OnlineStatusChange += (d, args) =>
|
||||
{
|
||||
if (args.DeviceOnLine)
|
||||
AddPostActivationAction(() =>
|
||||
{
|
||||
trilist.StringInput[joinMap.Name.JoinNumber].StringValue = occController.Name;
|
||||
}
|
||||
};
|
||||
OccSensor.OnlineStatusChange += (o, a) =>
|
||||
{
|
||||
if (a.DeviceOnLine)
|
||||
{
|
||||
ApplySettingsToSensorFromConfig();
|
||||
}
|
||||
};
|
||||
|
||||
// Occupied status
|
||||
trilist.SetSigTrueAction(joinMap.ForceOccupied.JoinNumber, occController.ForceOccupied);
|
||||
trilist.SetSigTrueAction(joinMap.ForceVacant.JoinNumber, occController.ForceVacant);
|
||||
occController.RoomIsOccupiedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RoomOccupiedFeedback.JoinNumber]);
|
||||
occController.RoomIsOccupiedFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.RoomVacantFeedback.JoinNumber]);
|
||||
occController.RawOccupancyFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyFeedback.JoinNumber]);
|
||||
trilist.SetBoolSigAction(joinMap.EnableRawStates.JoinNumber, occController.EnableRawStates);
|
||||
if (OccSensor.IsOnline)
|
||||
{
|
||||
ApplySettingsToSensorFromConfig();
|
||||
|
||||
// Timouts
|
||||
trilist.SetUShortSigAction(joinMap.Timeout.JoinNumber, occController.SetRemoteTimeout);
|
||||
occController.CurrentTimeoutFeedback.LinkInputSig(trilist.UShortInput[joinMap.Timeout.JoinNumber]);
|
||||
occController.LocalTimoutFeedback.LinkInputSig(trilist.UShortInput[joinMap.TimeoutLocalFeedback.JoinNumber]);
|
||||
|
||||
// LED Flash
|
||||
trilist.SetSigTrueAction(joinMap.EnableLedFlash.JoinNumber, () => occController.SetLedFlashEnable(true));
|
||||
trilist.SetSigTrueAction(joinMap.DisableLedFlash.JoinNumber, () => occController.SetLedFlashEnable(false));
|
||||
occController.LedFlashEnabledFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.EnableLedFlash.JoinNumber]);
|
||||
|
||||
// Short Timeout
|
||||
trilist.SetSigTrueAction(joinMap.EnableShortTimeout.JoinNumber, () => occController.SetShortTimeoutState(true));
|
||||
trilist.SetSigTrueAction(joinMap.DisableShortTimeout.JoinNumber, () => occController.SetShortTimeoutState(false));
|
||||
occController.ShortTimeoutEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableShortTimeout.JoinNumber]);
|
||||
|
||||
// PIR Sensor
|
||||
trilist.SetSigTrueAction(joinMap.EnablePir.JoinNumber, () => occController.SetPirEnable(true));
|
||||
trilist.SetSigTrueAction(joinMap.DisablePir.JoinNumber, () => occController.SetPirEnable(false));
|
||||
occController.PirSensorEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnablePir.JoinNumber]);
|
||||
|
||||
// PIR Sensitivity in Occupied State
|
||||
trilist.SetBoolSigAction(joinMap.IncrementPirInOccupiedState.JoinNumber, occController.IncrementPirSensitivityInOccupiedState);
|
||||
trilist.SetBoolSigAction(joinMap.DecrementPirInOccupiedState.JoinNumber, occController.DecrementPirSensitivityInOccupiedState);
|
||||
occController.PirSensitivityInOccupiedStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.PirSensitivityInOccupiedState.JoinNumber]);
|
||||
|
||||
// PIR Sensitivity in Vacant State
|
||||
trilist.SetBoolSigAction(joinMap.IncrementPirInVacantState.JoinNumber, occController.IncrementPirSensitivityInVacantState);
|
||||
trilist.SetBoolSigAction(joinMap.DecrementPirInVacantState.JoinNumber, occController.DecrementPirSensitivityInVacantState);
|
||||
occController.PirSensitivityInVacantStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.PirSensitivityInVacantState.JoinNumber]);
|
||||
#endregion
|
||||
|
||||
#region Dual Technology Sensor Stuff
|
||||
var odtOccController = occController as GlsOdtOccupancySensorController;
|
||||
|
||||
if (odtOccController == null) return;
|
||||
// OR When Vacated
|
||||
trilist.SetBoolSigAction(joinMap.OrWhenVacated.JoinNumber, odtOccController.SetOrWhenVacatedState);
|
||||
odtOccController.OrWhenVacatedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.OrWhenVacated.JoinNumber]);
|
||||
|
||||
// AND When Vacated
|
||||
trilist.SetBoolSigAction(joinMap.AndWhenVacated.JoinNumber, odtOccController.SetAndWhenVacatedState);
|
||||
odtOccController.AndWhenVacatedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.AndWhenVacated.JoinNumber]);
|
||||
|
||||
// Ultrasonic A Sensor
|
||||
trilist.SetSigTrueAction(joinMap.EnableUsA.JoinNumber, () => odtOccController.SetUsAEnable(true));
|
||||
trilist.SetSigTrueAction(joinMap.DisableUsA.JoinNumber, () => odtOccController.SetUsAEnable(false));
|
||||
odtOccController.UltrasonicAEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableUsA.JoinNumber]);
|
||||
|
||||
// Ultrasonic B Sensor
|
||||
trilist.SetSigTrueAction(joinMap.EnableUsB.JoinNumber, () => odtOccController.SetUsBEnable(true));
|
||||
trilist.SetSigTrueAction(joinMap.DisableUsB.JoinNumber, () => odtOccController.SetUsBEnable(false));
|
||||
odtOccController.UltrasonicAEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableUsB.JoinNumber]);
|
||||
|
||||
// US Sensitivity in Occupied State
|
||||
trilist.SetBoolSigAction(joinMap.IncrementUsInOccupiedState.JoinNumber, odtOccController.IncrementUsSensitivityInOccupiedState);
|
||||
trilist.SetBoolSigAction(joinMap.DecrementUsInOccupiedState.JoinNumber, odtOccController.DecrementUsSensitivityInOccupiedState);
|
||||
odtOccController.UltrasonicSensitivityInOccupiedStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.UsSensitivityInOccupiedState.JoinNumber]);
|
||||
|
||||
// US Sensitivity in Vacant State
|
||||
trilist.SetBoolSigAction(joinMap.IncrementUsInVacantState.JoinNumber, odtOccController.IncrementUsSensitivityInVacantState);
|
||||
trilist.SetBoolSigAction(joinMap.DecrementUsInVacantState.JoinNumber, odtOccController.DecrementUsSensitivityInVacantState);
|
||||
odtOccController.UltrasonicSensitivityInVacantStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.UsSensitivityInVacantState.JoinNumber]);
|
||||
|
||||
//Sensor Raw States
|
||||
odtOccController.RawOccupancyPirFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyPirFeedback.JoinNumber]);
|
||||
odtOccController.RawOccupancyUsFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyUsFeedback.JoinNumber]);
|
||||
|
||||
#endregion
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
|
||||
|
||||
/// <summary>
|
||||
/// Applies any sensor settings defined in config
|
||||
/// </summary>
|
||||
protected virtual void ApplySettingsToSensorFromConfig()
|
||||
{
|
||||
LinkOccSensorToApi(this, trilist, joinStart, joinMapKey, bridge);
|
||||
Debug.Console(1, this, "Attempting to apply settings to sensor from config");
|
||||
|
||||
if (PropertiesConfig.EnablePir != null)
|
||||
{
|
||||
Debug.Console(1, this, "EnablePir found, attempting to set value from config");
|
||||
SetPirEnable((bool)PropertiesConfig.EnablePir);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(1, this, "EnablePir null, no value specified in config");
|
||||
}
|
||||
|
||||
if (PropertiesConfig.EnableLedFlash != null)
|
||||
{
|
||||
Debug.Console(1, this, "EnableLedFlash found, attempting to set value from config");
|
||||
SetLedFlashEnable((bool)PropertiesConfig.EnableLedFlash);
|
||||
}
|
||||
|
||||
if (PropertiesConfig.RemoteTimeout != null)
|
||||
{
|
||||
Debug.Console(1, this, "RemoteTimeout found, attempting to set value from config");
|
||||
SetRemoteTimeout((ushort)PropertiesConfig.RemoteTimeout);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(1, this, "RemoteTimeout null, no value specified in config");
|
||||
}
|
||||
|
||||
if (PropertiesConfig.ShortTimeoutState != null)
|
||||
{
|
||||
SetShortTimeoutState((bool)PropertiesConfig.ShortTimeoutState);
|
||||
}
|
||||
|
||||
if (PropertiesConfig.EnableRawStates != null)
|
||||
{
|
||||
EnableRawStates((bool)PropertiesConfig.EnableRawStates);
|
||||
}
|
||||
|
||||
if (PropertiesConfig.InternalPhotoSensorMinChange != null)
|
||||
{
|
||||
SetInternalPhotoSensorMinChange((ushort)PropertiesConfig.InternalPhotoSensorMinChange);
|
||||
}
|
||||
|
||||
if (PropertiesConfig.ExternalPhotoSensorMinChange != null)
|
||||
{
|
||||
SetExternalPhotoSensorMinChange((ushort)PropertiesConfig.ExternalPhotoSensorMinChange);
|
||||
}
|
||||
}
|
||||
|
||||
#region PreActivation
|
||||
protected void RegisterGlsOccupancySensorBaseController(GlsOccupancySensorBase occSensor)
|
||||
{
|
||||
OccSensor = occSensor;
|
||||
|
||||
private static GlsOirCCn GetGlsOirCCn(DeviceConfig dc)
|
||||
{
|
||||
var control = CommFactory.GetControlPropertiesConfig(dc);
|
||||
var cresnetId = control.CresnetIdInt;
|
||||
var branchId = control.ControlPortNumber;
|
||||
var parentKey = string.IsNullOrEmpty(control.ControlPortDevKey) ? "processor" : control.ControlPortDevKey;
|
||||
RoomIsOccupiedFeedback = new BoolFeedback(RoomIsOccupiedFeedbackFunc);
|
||||
|
||||
if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase))
|
||||
PirSensorEnabledFeedback = new BoolFeedback(() => OccSensor.PirEnabledFeedback.BoolValue);
|
||||
|
||||
LedFlashEnabledFeedback = new BoolFeedback(() => OccSensor.LedFlashEnabledFeedback.BoolValue);
|
||||
|
||||
ShortTimeoutEnabledFeedback = new BoolFeedback(() => OccSensor.ShortTimeoutEnabledFeedback.BoolValue);
|
||||
|
||||
PirSensitivityInVacantStateFeedback =
|
||||
new IntFeedback(() => OccSensor.PirSensitivityInVacantStateFeedback.UShortValue);
|
||||
|
||||
PirSensitivityInOccupiedStateFeedback =
|
||||
new IntFeedback(() => OccSensor.PirSensitivityInOccupiedStateFeedback.UShortValue);
|
||||
|
||||
CurrentTimeoutFeedback = new IntFeedback(() => OccSensor.CurrentTimeoutFeedback.UShortValue);
|
||||
|
||||
LocalTimoutFeedback = new IntFeedback(() => OccSensor.LocalTimeoutFeedback.UShortValue);
|
||||
|
||||
GraceOccupancyDetectedFeedback =
|
||||
new BoolFeedback(() => OccSensor.GraceOccupancyDetectedFeedback.BoolValue);
|
||||
|
||||
RawOccupancyFeedback = new BoolFeedback(() => OccSensor.RawOccupancyFeedback.BoolValue);
|
||||
|
||||
InternalPhotoSensorValue = new IntFeedback(() => OccSensor.InternalPhotoSensorValueFeedback.UShortValue);
|
||||
|
||||
ExternalPhotoSensorValue = new IntFeedback(() => OccSensor.ExternalPhotoSensorValueFeedback.UShortValue);
|
||||
|
||||
OccSensor.BaseEvent += OccSensor_BaseEvent;
|
||||
|
||||
OccSensor.GlsOccupancySensorChange += OccSensor_GlsOccupancySensorChange;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Catches events for feedbacks on the base class. Any extending wrapper class should call this delegate after it checks for it's own event IDs.
|
||||
/// </summary>
|
||||
/// <param name="device"></param>
|
||||
/// <param name="args"></param>
|
||||
protected virtual void OccSensor_GlsOccupancySensorChange(GlsOccupancySensorBase device, GlsOccupancySensorChangeEventArgs args)
|
||||
{
|
||||
switch (args.EventId)
|
||||
{
|
||||
case GlsOccupancySensorBase.PirEnabledFeedbackEventId:
|
||||
PirSensorEnabledFeedback.FireUpdate();
|
||||
break;
|
||||
case GlsOccupancySensorBase.LedFlashEnabledFeedbackEventId:
|
||||
LedFlashEnabledFeedback.FireUpdate();
|
||||
break;
|
||||
case GlsOccupancySensorBase.ShortTimeoutEnabledFeedbackEventId:
|
||||
ShortTimeoutEnabledFeedback.FireUpdate();
|
||||
break;
|
||||
case GlsOccupancySensorBase.PirSensitivityInOccupiedStateFeedbackEventId:
|
||||
PirSensitivityInOccupiedStateFeedback.FireUpdate();
|
||||
break;
|
||||
case GlsOccupancySensorBase.PirSensitivityInVacantStateFeedbackEventId:
|
||||
PirSensitivityInVacantStateFeedback.FireUpdate();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OccSensor_BaseEvent(Crestron.SimplSharpPro.GenericBase device, Crestron.SimplSharpPro.BaseEventArgs args)
|
||||
{
|
||||
Debug.Console(2, this, "GlsOccupancySensorChange EventId: {0}", args.EventId);
|
||||
|
||||
switch (args.EventId)
|
||||
{
|
||||
case GlsOccupancySensorBase.RoomVacantFeedbackEventId:
|
||||
case GlsOccupancySensorBase.RoomOccupiedFeedbackEventId:
|
||||
Debug.Console(1, this, "Occupancy State: {0}", OccSensor.OccupancyDetectedFeedback.BoolValue);
|
||||
RoomIsOccupiedFeedback.FireUpdate();
|
||||
break;
|
||||
case GlsOccupancySensorBase.TimeoutFeedbackEventId:
|
||||
CurrentTimeoutFeedback.FireUpdate();
|
||||
break;
|
||||
case GlsOccupancySensorBase.TimeoutLocalFeedbackEventId:
|
||||
LocalTimoutFeedback.FireUpdate();
|
||||
break;
|
||||
case GlsOccupancySensorBase.GraceOccupancyDetectedFeedbackEventId:
|
||||
GraceOccupancyDetectedFeedback.FireUpdate();
|
||||
break;
|
||||
case GlsOccupancySensorBase.RawOccupancyFeedbackEventId:
|
||||
RawOccupancyFeedback.FireUpdate();
|
||||
break;
|
||||
case GlsOccupancySensorBase.InternalPhotoSensorValueFeedbackEventId:
|
||||
InternalPhotoSensorValue.FireUpdate();
|
||||
break;
|
||||
case GlsOccupancySensorBase.ExternalPhotoSensorValueFeedbackEventId:
|
||||
ExternalPhotoSensorValue.FireUpdate();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetTestMode(bool mode)
|
||||
{
|
||||
InTestMode = mode;
|
||||
|
||||
Debug.Console(1, this, "In Mock Mode: '{0}'", InTestMode);
|
||||
}
|
||||
|
||||
public void SetTestOccupiedState(bool state)
|
||||
{
|
||||
if (!InTestMode)
|
||||
Debug.Console(1, "Mock mode not enabled");
|
||||
else
|
||||
{
|
||||
TestRoomIsOccupiedFeedback = state;
|
||||
|
||||
RoomIsOccupiedFeedback.FireUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables the PIR sensor
|
||||
/// </summary>
|
||||
/// <param name="state"></param>
|
||||
public void SetPirEnable(bool state)
|
||||
{
|
||||
Debug.Console(1, this, "Setting EnablePir to: {0}", state);
|
||||
|
||||
OccSensor.EnablePir.BoolValue = state;
|
||||
OccSensor.DisablePir.BoolValue = !state;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables the LED Flash
|
||||
/// </summary>
|
||||
/// <param name="state"></param>
|
||||
public void SetLedFlashEnable(bool state)
|
||||
{
|
||||
OccSensor.EnableLedFlash.BoolValue = state;
|
||||
OccSensor.DisableLedFlash.BoolValue = !state;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables short timeout based on state
|
||||
/// </summary>
|
||||
/// <param name="state"></param>
|
||||
public void SetShortTimeoutState(bool state)
|
||||
{
|
||||
OccSensor.EnableShortTimeout.BoolValue = state;
|
||||
OccSensor.DisableShortTimeout.BoolValue = !state;
|
||||
}
|
||||
|
||||
public void IncrementPirSensitivityInOccupiedState(bool pressRelease)
|
||||
{
|
||||
OccSensor.IncrementPirSensitivityInOccupiedState.BoolValue = pressRelease;
|
||||
}
|
||||
|
||||
public void DecrementPirSensitivityInOccupiedState(bool pressRelease)
|
||||
{
|
||||
OccSensor.DecrementPirSensitivityInOccupiedState.BoolValue = pressRelease;
|
||||
}
|
||||
|
||||
public void IncrementPirSensitivityInVacantState(bool pressRelease)
|
||||
{
|
||||
OccSensor.IncrementPirSensitivityInVacantState.BoolValue = pressRelease;
|
||||
}
|
||||
|
||||
public void DecrementPirSensitivityInVacantState(bool pressRelease)
|
||||
{
|
||||
OccSensor.DecrementPirSensitivityInVacantState.BoolValue = pressRelease;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Pulse ForceOccupied on the sensor for .5 seconds
|
||||
/// </summary>
|
||||
public void ForceOccupied()
|
||||
{
|
||||
CrestronInvoke.BeginInvoke((o) =>
|
||||
{
|
||||
ForceOccupied(true);
|
||||
CrestronEnvironment.Sleep(500);
|
||||
ForceOccupied(false);
|
||||
});
|
||||
}
|
||||
|
||||
public void ForceOccupied(bool value)
|
||||
{
|
||||
OccSensor.ForceOccupied.BoolValue = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Pulse ForceVacant on the sensor for .5 seconds
|
||||
/// </summary>
|
||||
public void ForceVacant()
|
||||
{
|
||||
CrestronInvoke.BeginInvoke((o) =>
|
||||
{
|
||||
Debug.Console(0, "Device {0} is a valid cresnet master - creating new GlsOirCCn", parentKey);
|
||||
return new GlsOirCCn(cresnetId, Global.ControlSystem);
|
||||
}
|
||||
var cresnetBridge = DeviceManager.GetDeviceForKey(parentKey) as IHasCresnetBranches;
|
||||
ForceVacant(true);
|
||||
CrestronEnvironment.Sleep(500);
|
||||
ForceVacant(false);
|
||||
});
|
||||
}
|
||||
|
||||
if (cresnetBridge != null)
|
||||
{
|
||||
Debug.Console(0, "Device {0} is a valid cresnet master - creating new GlsOirCCn", parentKey);
|
||||
return new GlsOirCCn(cresnetId, cresnetBridge.CresnetBranches[branchId]);
|
||||
}
|
||||
Debug.Console(0, "Device {0} is not a valid cresnet master", parentKey);
|
||||
return null;
|
||||
}
|
||||
#endregion
|
||||
public void ForceVacant(bool value)
|
||||
{
|
||||
OccSensor.ForceVacant.BoolValue = value;
|
||||
}
|
||||
|
||||
public class GlsOccupancySensorBaseControllerFactory : EssentialsDeviceFactory<GlsOccupancySensorBaseController>
|
||||
{
|
||||
public GlsOccupancySensorBaseControllerFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "glsoirccn" };
|
||||
}
|
||||
public void EnableRawStates(bool state)
|
||||
{
|
||||
OccSensor.EnableRawStates.BoolValue = state;
|
||||
}
|
||||
|
||||
public void SetRemoteTimeout(ushort time)
|
||||
{
|
||||
Debug.Console(1, this, "Setting RemoteTimout to: {0}", time);
|
||||
|
||||
OccSensor.RemoteTimeout.UShortValue = time;
|
||||
}
|
||||
|
||||
public void SetInternalPhotoSensorMinChange(ushort value)
|
||||
{
|
||||
OccSensor.InternalPhotoSensorMinimumChange.UShortValue = value;
|
||||
}
|
||||
|
||||
public void SetExternalPhotoSensorMinChange(ushort value)
|
||||
{
|
||||
OccSensor.ExternalPhotoSensorMinimumChange.UShortValue = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method to print current occ settings to console.
|
||||
/// </summary>
|
||||
public virtual void GetSettings()
|
||||
{
|
||||
var dash = new string('*', 50);
|
||||
CrestronConsole.PrintLine(string.Format("{0}\n", dash));
|
||||
|
||||
Debug.Console(0, this, "Vacancy Detected: {0}",
|
||||
OccSensor.VacancyDetectedFeedback.BoolValue);
|
||||
|
||||
Debug.Console(0, this, "Timeout Current: {0} | Local: {1}",
|
||||
OccSensor.CurrentTimeoutFeedback.UShortValue,
|
||||
OccSensor.LocalTimeoutFeedback.UShortValue);
|
||||
|
||||
Debug.Console(0, this, "Short Timeout Enabled: {0}",
|
||||
OccSensor.ShortTimeoutEnabledFeedback.BoolValue);
|
||||
|
||||
Debug.Console(0, this, "PIR Sensor Enabled: {0} | Sensitivity Occupied: {1} | Sensitivity Vacant: {2}",
|
||||
OccSensor.PirEnabledFeedback.BoolValue,
|
||||
OccSensor.PirSensitivityInOccupiedStateFeedback.UShortValue,
|
||||
OccSensor.PirSensitivityInVacantStateFeedback.UShortValue);
|
||||
|
||||
CrestronConsole.PrintLine(string.Format("{0}\n", dash));
|
||||
}
|
||||
|
||||
protected void LinkOccSensorToApi(GlsOccupancySensorBaseController occController, BasicTriList trilist,
|
||||
uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
|
||||
{
|
||||
var joinMap = new GlsOccupancySensorBaseJoinMap(joinStart);
|
||||
|
||||
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
|
||||
|
||||
if (!string.IsNullOrEmpty(joinMapSerialized))
|
||||
joinMap = JsonConvert.DeserializeObject<GlsOccupancySensorBaseJoinMap>(joinMapSerialized);
|
||||
|
||||
if (bridge != null)
|
||||
{
|
||||
bridge.AddJoinMap(Key, joinMap);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
|
||||
}
|
||||
|
||||
Debug.Console(1, occController, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||
|
||||
occController.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]);
|
||||
trilist.StringInput[joinMap.Name.JoinNumber].StringValue = occController.Name;
|
||||
|
||||
trilist.OnlineStatusChange += (d, args) =>
|
||||
{
|
||||
if (args.DeviceOnLine)
|
||||
{
|
||||
trilist.StringInput[joinMap.Name.JoinNumber].StringValue = occController.Name;
|
||||
}
|
||||
};
|
||||
|
||||
LinkSingleTechSensorToApi(occController, trilist, joinMap);
|
||||
|
||||
LinkDualTechSensorToApi(occController, trilist, joinMap);
|
||||
}
|
||||
|
||||
private static void LinkDualTechSensorToApi(GlsOccupancySensorBaseController occController, BasicTriList trilist,
|
||||
GlsOccupancySensorBaseJoinMap joinMap)
|
||||
{
|
||||
var odtOccController = occController as GlsOdtOccupancySensorController;
|
||||
|
||||
if (odtOccController == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
// OR When Vacated
|
||||
trilist.SetBoolSigAction(joinMap.OrWhenVacated.JoinNumber, odtOccController.SetOrWhenVacatedState);
|
||||
odtOccController.OrWhenVacatedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.OrWhenVacated.JoinNumber]);
|
||||
|
||||
// AND When Vacated
|
||||
trilist.SetBoolSigAction(joinMap.AndWhenVacated.JoinNumber, odtOccController.SetAndWhenVacatedState);
|
||||
odtOccController.AndWhenVacatedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.AndWhenVacated.JoinNumber]);
|
||||
|
||||
// Ultrasonic A Sensor
|
||||
trilist.SetSigTrueAction(joinMap.EnableUsA.JoinNumber, () => odtOccController.SetUsAEnable(true));
|
||||
trilist.SetSigTrueAction(joinMap.DisableUsA.JoinNumber, () => odtOccController.SetUsAEnable(false));
|
||||
odtOccController.UltrasonicAEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableUsA.JoinNumber]);
|
||||
|
||||
// Ultrasonic B Sensor
|
||||
trilist.SetSigTrueAction(joinMap.EnableUsB.JoinNumber, () => odtOccController.SetUsBEnable(true));
|
||||
trilist.SetSigTrueAction(joinMap.DisableUsB.JoinNumber, () => odtOccController.SetUsBEnable(false));
|
||||
odtOccController.UltrasonicBEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableUsB.JoinNumber]);
|
||||
|
||||
// US Sensitivity in Occupied State
|
||||
trilist.SetBoolSigAction(joinMap.IncrementUsInOccupiedState.JoinNumber,
|
||||
odtOccController.IncrementUsSensitivityInOccupiedState);
|
||||
trilist.SetBoolSigAction(joinMap.DecrementUsInOccupiedState.JoinNumber,
|
||||
odtOccController.DecrementUsSensitivityInOccupiedState);
|
||||
odtOccController.UltrasonicSensitivityInOccupiedStateFeedback.LinkInputSig(
|
||||
trilist.UShortInput[joinMap.UsSensitivityInOccupiedState.JoinNumber]);
|
||||
|
||||
// US Sensitivity in Vacant State
|
||||
trilist.SetBoolSigAction(joinMap.IncrementUsInVacantState.JoinNumber,
|
||||
odtOccController.IncrementUsSensitivityInVacantState);
|
||||
trilist.SetBoolSigAction(joinMap.DecrementUsInVacantState.JoinNumber,
|
||||
odtOccController.DecrementUsSensitivityInVacantState);
|
||||
odtOccController.UltrasonicSensitivityInVacantStateFeedback.LinkInputSig(
|
||||
trilist.UShortInput[joinMap.UsSensitivityInVacantState.JoinNumber]);
|
||||
|
||||
//Sensor Raw States
|
||||
odtOccController.RawOccupancyPirFeedback.LinkInputSig(
|
||||
trilist.BooleanInput[joinMap.RawOccupancyPirFeedback.JoinNumber]);
|
||||
odtOccController.RawOccupancyUsFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyUsFeedback.JoinNumber]);
|
||||
}
|
||||
|
||||
private static void LinkSingleTechSensorToApi(GlsOccupancySensorBaseController occController, BasicTriList trilist,
|
||||
GlsOccupancySensorBaseJoinMap joinMap)
|
||||
{
|
||||
// Occupied status
|
||||
trilist.SetBoolSigAction(joinMap.ForceOccupied.JoinNumber, occController.ForceOccupied);
|
||||
trilist.SetBoolSigAction(joinMap.ForceVacant.JoinNumber, occController.ForceVacant);
|
||||
occController.RoomIsOccupiedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RoomOccupiedFeedback.JoinNumber]);
|
||||
occController.RoomIsOccupiedFeedback.LinkComplementInputSig(
|
||||
trilist.BooleanInput[joinMap.RoomVacantFeedback.JoinNumber]);
|
||||
occController.RawOccupancyFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyFeedback.JoinNumber]);
|
||||
trilist.SetBoolSigAction(joinMap.EnableRawStates.JoinNumber, occController.EnableRawStates);
|
||||
|
||||
// Timouts
|
||||
trilist.SetUShortSigAction(joinMap.Timeout.JoinNumber, occController.SetRemoteTimeout);
|
||||
occController.CurrentTimeoutFeedback.LinkInputSig(trilist.UShortInput[joinMap.Timeout.JoinNumber]);
|
||||
occController.LocalTimoutFeedback.LinkInputSig(trilist.UShortInput[joinMap.TimeoutLocalFeedback.JoinNumber]);
|
||||
|
||||
// LED Flash
|
||||
trilist.SetSigTrueAction(joinMap.EnableLedFlash.JoinNumber, () => occController.SetLedFlashEnable(true));
|
||||
trilist.SetSigTrueAction(joinMap.DisableLedFlash.JoinNumber, () => occController.SetLedFlashEnable(false));
|
||||
occController.LedFlashEnabledFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.EnableLedFlash.JoinNumber]);
|
||||
|
||||
// Short Timeout
|
||||
trilist.SetSigTrueAction(joinMap.EnableShortTimeout.JoinNumber, () => occController.SetShortTimeoutState(true));
|
||||
trilist.SetSigTrueAction(joinMap.DisableShortTimeout.JoinNumber, () => occController.SetShortTimeoutState(false));
|
||||
occController.ShortTimeoutEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableShortTimeout.JoinNumber]);
|
||||
|
||||
// PIR Sensor
|
||||
trilist.SetSigTrueAction(joinMap.EnablePir.JoinNumber, () => occController.SetPirEnable(true));
|
||||
trilist.SetSigTrueAction(joinMap.DisablePir.JoinNumber, () => occController.SetPirEnable(false));
|
||||
occController.PirSensorEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnablePir.JoinNumber]);
|
||||
|
||||
// PIR Sensitivity in Occupied State
|
||||
trilist.SetBoolSigAction(joinMap.IncrementPirInOccupiedState.JoinNumber,
|
||||
occController.IncrementPirSensitivityInOccupiedState);
|
||||
trilist.SetBoolSigAction(joinMap.DecrementPirInOccupiedState.JoinNumber,
|
||||
occController.DecrementPirSensitivityInOccupiedState);
|
||||
occController.PirSensitivityInOccupiedStateFeedback.LinkInputSig(
|
||||
trilist.UShortInput[joinMap.PirSensitivityInOccupiedState.JoinNumber]);
|
||||
|
||||
// PIR Sensitivity in Vacant State
|
||||
trilist.SetBoolSigAction(joinMap.IncrementPirInVacantState.JoinNumber,
|
||||
occController.IncrementPirSensitivityInVacantState);
|
||||
trilist.SetBoolSigAction(joinMap.DecrementPirInVacantState.JoinNumber,
|
||||
occController.DecrementPirSensitivityInVacantState);
|
||||
occController.PirSensitivityInVacantStateFeedback.LinkInputSig(
|
||||
trilist.UShortInput[joinMap.PirSensitivityInVacantState.JoinNumber]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new GlsOccupancySensorBaseController Device");
|
||||
|
||||
return new GlsOccupancySensorBaseController(dc.Key, GetGlsOirCCn, dc);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines configuration properties for Crestron GLS series occupancy sensors
|
||||
/// </summary>
|
||||
public class GlsOccupancySensorPropertiesConfig
|
||||
{
|
||||
// Single Technology Sensors (PIR): GlsOccupancySensorBase
|
||||
[JsonProperty("enablePir")]
|
||||
public bool? EnablePir { get; set; }
|
||||
|
||||
[JsonProperty("enableLedFlash")]
|
||||
public bool? EnableLedFlash { get; set; }
|
||||
|
||||
[JsonProperty("shortTimeoutState")]
|
||||
public bool? ShortTimeoutState { get; set; }
|
||||
|
||||
[JsonProperty("enableRawStates")]
|
||||
public bool? EnableRawStates { get; set; }
|
||||
|
||||
[JsonProperty("remoteTimeout")]
|
||||
public ushort? RemoteTimeout { get; set; }
|
||||
|
||||
[JsonProperty("internalPhotoSensorMinChange")]
|
||||
public ushort? InternalPhotoSensorMinChange { get; set; }
|
||||
|
||||
[JsonProperty("externalPhotoSensorMinChange")]
|
||||
public ushort? ExternalPhotoSensorMinChange { get; set; }
|
||||
|
||||
// Dual Technology Sensors: GlsOdtCCn
|
||||
[JsonProperty("enableUsA")]
|
||||
public bool? EnableUsA { get; set; }
|
||||
|
||||
[JsonProperty("enableUsB")]
|
||||
public bool? EnableUsB { get; set; }
|
||||
|
||||
[JsonProperty("orWhenVacatedState")]
|
||||
public bool? OrWhenVacatedState { get; set; }
|
||||
|
||||
[JsonProperty("andWhenVacatedState")]
|
||||
public bool? AndWhenVacatedState { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,183 +1,266 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using Crestron.SimplSharpPro.GeneralIO;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.Core.Bridges;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
[Description("Wrapper class for Dual Technology GLS Occupancy Sensors")]
|
||||
[Description("Wrapper class for Dual Technology GLS Occupancy Sensors")]
|
||||
[ConfigSnippet("\"properties\": {\"control\": {\"method\": \"cresnet\",\"cresnetId\": \"97\"},\"enablePir\": true,\"enableLedFlash\": true,\"enableRawStates\":true,\"remoteTimeout\": 30,\"internalPhotoSensorMinChange\": 0,\"externalPhotoSensorMinChange\": 0,\"enableUsA\": true,\"enableUsB\": true,\"orWhenVacatedState\": true}")]
|
||||
public class GlsOdtOccupancySensorController : GlsOccupancySensorBaseController
|
||||
{
|
||||
public new GlsOdtCCn OccSensor { get; private set; }
|
||||
{
|
||||
private GlsOdtCCn _occSensor;
|
||||
|
||||
public BoolFeedback OrWhenVacatedFeedback { get; private set; }
|
||||
public BoolFeedback OrWhenVacatedFeedback { get; private set; }
|
||||
|
||||
public BoolFeedback AndWhenVacatedFeedback { get; private set; }
|
||||
public BoolFeedback AndWhenVacatedFeedback { get; private set; }
|
||||
|
||||
public BoolFeedback UltrasonicAEnabledFeedback { get; private set; }
|
||||
public BoolFeedback UltrasonicAEnabledFeedback { get; private set; }
|
||||
|
||||
public BoolFeedback UltrasonicBEnabledFeedback { get; private set; }
|
||||
public BoolFeedback UltrasonicBEnabledFeedback { get; private set; }
|
||||
|
||||
public IntFeedback UltrasonicSensitivityInVacantStateFeedback { get; private set; }
|
||||
public IntFeedback UltrasonicSensitivityInVacantStateFeedback { get; private set; }
|
||||
|
||||
public IntFeedback UltrasonicSensitivityInOccupiedStateFeedback { get; private set; }
|
||||
public IntFeedback UltrasonicSensitivityInOccupiedStateFeedback { get; private set; }
|
||||
|
||||
public BoolFeedback RawOccupancyPirFeedback { get; private set; }
|
||||
public BoolFeedback RawOccupancyPirFeedback { get; private set; }
|
||||
|
||||
public BoolFeedback RawOccupancyUsFeedback { get; private set; }
|
||||
public BoolFeedback RawOccupancyUsFeedback { get; private set; }
|
||||
|
||||
|
||||
public GlsOdtOccupancySensorController(string key, Func<DeviceConfig, GlsOdtCCn> preActivationFunc,
|
||||
DeviceConfig config)
|
||||
: base(key, config.Name)
|
||||
public GlsOdtOccupancySensorController(string key, Func<DeviceConfig, GlsOdtCCn> preActivationFunc,
|
||||
DeviceConfig config)
|
||||
: base(key, config.Name, config)
|
||||
{
|
||||
AddPreActivationAction(() =>
|
||||
{
|
||||
_occSensor = preActivationFunc(config);
|
||||
|
||||
RegisterCrestronGenericBase(_occSensor);
|
||||
|
||||
RegisterGlsOccupancySensorBaseController(_occSensor);
|
||||
|
||||
AndWhenVacatedFeedback = new BoolFeedback(() => _occSensor.AndWhenVacatedFeedback.BoolValue);
|
||||
|
||||
OrWhenVacatedFeedback = new BoolFeedback(() => _occSensor.OrWhenVacatedFeedback.BoolValue);
|
||||
|
||||
UltrasonicAEnabledFeedback = new BoolFeedback(() => _occSensor.UsAEnabledFeedback.BoolValue);
|
||||
|
||||
UltrasonicBEnabledFeedback = new BoolFeedback(() => _occSensor.UsBEnabledFeedback.BoolValue);
|
||||
|
||||
RawOccupancyPirFeedback = new BoolFeedback(() => _occSensor.RawOccupancyPirFeedback.BoolValue);
|
||||
|
||||
RawOccupancyUsFeedback = new BoolFeedback(() => _occSensor.RawOccupancyUsFeedback.BoolValue);
|
||||
|
||||
UltrasonicSensitivityInVacantStateFeedback = new IntFeedback(() => _occSensor.UsSensitivityInVacantStateFeedback.UShortValue);
|
||||
|
||||
UltrasonicSensitivityInOccupiedStateFeedback = new IntFeedback(() => _occSensor.UsSensitivityInOccupiedStateFeedback.UShortValue);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
protected override void ApplySettingsToSensorFromConfig()
|
||||
{
|
||||
AddPreActivationAction(() =>
|
||||
base.ApplySettingsToSensorFromConfig();
|
||||
|
||||
if (PropertiesConfig.EnableUsA != null)
|
||||
{
|
||||
OccSensor = preActivationFunc(config);
|
||||
Debug.Console(1, this, "EnableUsA found, attempting to set value from config");
|
||||
SetUsAEnable((bool)PropertiesConfig.EnableUsA);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(1, this, "EnableUsA null, no value specified in config");
|
||||
}
|
||||
|
||||
RegisterCrestronGenericBase(OccSensor);
|
||||
|
||||
RegisterGlsOdtSensorBaseController(OccSensor);
|
||||
if (PropertiesConfig.EnableUsB != null)
|
||||
{
|
||||
Debug.Console(1, this, "EnableUsB found, attempting to set value from config");
|
||||
SetUsBEnable((bool)PropertiesConfig.EnableUsB);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(1, this, "EnablePir null, no value specified in config");
|
||||
}
|
||||
|
||||
AndWhenVacatedFeedback = new BoolFeedback(() => OccSensor.AndWhenVacatedFeedback.BoolValue);
|
||||
|
||||
OrWhenVacatedFeedback = new BoolFeedback(() => OccSensor.OrWhenVacatedFeedback.BoolValue);
|
||||
if (PropertiesConfig.OrWhenVacatedState != null)
|
||||
{
|
||||
SetOrWhenVacatedState((bool)PropertiesConfig.OrWhenVacatedState);
|
||||
}
|
||||
|
||||
UltrasonicAEnabledFeedback = new BoolFeedback(() => OccSensor.UsAEnabledFeedback.BoolValue);
|
||||
|
||||
UltrasonicBEnabledFeedback = new BoolFeedback(() => OccSensor.UsBEnabledFeedback.BoolValue);
|
||||
|
||||
RawOccupancyPirFeedback = new BoolFeedback(() => OccSensor.RawOccupancyPirFeedback.BoolValue);
|
||||
|
||||
RawOccupancyUsFeedback = new BoolFeedback(() => OccSensor.RawOccupancyUsFeedback.BoolValue);
|
||||
|
||||
UltrasonicSensitivityInVacantStateFeedback = new IntFeedback(() => OccSensor.UsSensitivityInVacantStateFeedback.UShortValue);
|
||||
|
||||
UltrasonicSensitivityInOccupiedStateFeedback = new IntFeedback(() => OccSensor.UsSensitivityInOccupiedStateFeedback.UShortValue);
|
||||
|
||||
});
|
||||
if (PropertiesConfig.AndWhenVacatedState != null)
|
||||
{
|
||||
SetAndWhenVacatedState((bool)PropertiesConfig.AndWhenVacatedState);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the base class event delegate to fire feedbacks for event IDs that pertain to this extended class.
|
||||
/// Then calls the base delegate method to ensure any common event IDs are captured.
|
||||
/// </summary>
|
||||
/// <param name="device"></param>
|
||||
/// <param name="args"></param>
|
||||
protected override void OccSensor_GlsOccupancySensorChange(GlsOccupancySensorBase device, GlsOccupancySensorChangeEventArgs args)
|
||||
/// <summary>
|
||||
/// Overrides the base class event delegate to fire feedbacks for event IDs that pertain to this extended class.
|
||||
/// Then calls the base delegate method to ensure any common event IDs are captured.
|
||||
/// </summary>
|
||||
/// <param name="device"></param>
|
||||
/// <param name="args"></param>
|
||||
protected override void OccSensor_GlsOccupancySensorChange(GlsOccupancySensorBase device, GlsOccupancySensorChangeEventArgs args)
|
||||
{
|
||||
switch (args.EventId)
|
||||
{
|
||||
case GlsOccupancySensorBase.AndWhenVacatedFeedbackEventId:
|
||||
AndWhenVacatedFeedback.FireUpdate();
|
||||
break;
|
||||
case GlsOccupancySensorBase.OrWhenVacatedFeedbackEventId:
|
||||
OrWhenVacatedFeedback.FireUpdate();
|
||||
break;
|
||||
case GlsOccupancySensorBase.UsAEnabledFeedbackEventId:
|
||||
UltrasonicAEnabledFeedback.FireUpdate();
|
||||
break;
|
||||
case GlsOccupancySensorBase.UsBEnabledFeedbackEventId:
|
||||
UltrasonicBEnabledFeedback.FireUpdate();
|
||||
break;
|
||||
case GlsOccupancySensorBase.UsSensitivityInOccupiedStateFeedbackEventId:
|
||||
UltrasonicSensitivityInOccupiedStateFeedback.FireUpdate();
|
||||
break;
|
||||
case GlsOccupancySensorBase.UsSensitivityInVacantStateFeedbackEventId:
|
||||
UltrasonicSensitivityInVacantStateFeedback.FireUpdate();
|
||||
break;
|
||||
}
|
||||
|
||||
base.OccSensor_GlsOccupancySensorChange(device, args);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the base class event delegate to fire feedbacks for event IDs that pertain to this extended class.
|
||||
/// Then calls the base delegate method to ensure any common event IDs are captured.
|
||||
/// </summary>
|
||||
/// <param name="device"></param>
|
||||
/// <param name="args"></param>
|
||||
protected override void OccSensor_BaseEvent(Crestron.SimplSharpPro.GenericBase device, Crestron.SimplSharpPro.BaseEventArgs args)
|
||||
{
|
||||
switch (args.EventId)
|
||||
{
|
||||
case GlsOccupancySensorBase.RawOccupancyPirFeedbackEventId:
|
||||
RawOccupancyPirFeedback.FireUpdate();
|
||||
break;
|
||||
case GlsOccupancySensorBase.RawOccupancyUsFeedbackEventId:
|
||||
RawOccupancyUsFeedback.FireUpdate();
|
||||
break;
|
||||
}
|
||||
|
||||
base.OccSensor_BaseEvent(device, args);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the OrWhenVacated state
|
||||
/// </summary>
|
||||
/// <param name="state"></param>
|
||||
public void SetOrWhenVacatedState(bool state)
|
||||
{
|
||||
_occSensor.OrWhenVacated.BoolValue = state;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the AndWhenVacated state
|
||||
/// </summary>
|
||||
/// <param name="state"></param>
|
||||
public void SetAndWhenVacatedState(bool state)
|
||||
{
|
||||
_occSensor.AndWhenVacated.BoolValue = state;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables the Ultrasonic A sensor
|
||||
/// </summary>
|
||||
/// <param name="state"></param>
|
||||
public void SetUsAEnable(bool state)
|
||||
{
|
||||
_occSensor.EnableUsA.BoolValue = state;
|
||||
_occSensor.DisableUsA.BoolValue = !state;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables the Ultrasonic B sensor
|
||||
/// </summary>
|
||||
/// <param name="state"></param>
|
||||
public void SetUsBEnable(bool state)
|
||||
{
|
||||
_occSensor.EnableUsB.BoolValue = state;
|
||||
_occSensor.DisableUsB.BoolValue = !state;
|
||||
}
|
||||
|
||||
public void IncrementUsSensitivityInOccupiedState(bool pressRelease)
|
||||
{
|
||||
_occSensor.IncrementUsSensitivityInOccupiedState.BoolValue = pressRelease;
|
||||
}
|
||||
|
||||
public void DecrementUsSensitivityInOccupiedState(bool pressRelease)
|
||||
{
|
||||
_occSensor.DecrementUsSensitivityInOccupiedState.BoolValue = pressRelease;
|
||||
}
|
||||
|
||||
public void IncrementUsSensitivityInVacantState(bool pressRelease)
|
||||
{
|
||||
_occSensor.IncrementUsSensitivityInVacantState.BoolValue = pressRelease;
|
||||
}
|
||||
|
||||
public void DecrementUsSensitivityInVacantState(bool pressRelease)
|
||||
{
|
||||
_occSensor.DecrementUsSensitivityInVacantState.BoolValue = pressRelease;
|
||||
}
|
||||
|
||||
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
|
||||
{
|
||||
LinkOccSensorToApi(this, trilist, joinStart, joinMapKey, bridge);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method to print occ sensor settings to console.
|
||||
/// </summary>
|
||||
public override void GetSettings()
|
||||
{
|
||||
base.GetSettings();
|
||||
|
||||
Debug.Console(0, this, "Ultrasonic Enabled A: {0} | B: {1}",
|
||||
_occSensor.UsAEnabledFeedback.BoolValue,
|
||||
_occSensor.UsBEnabledFeedback.BoolValue);
|
||||
|
||||
Debug.Console(0, this, "Ultrasonic Sensitivity Occupied: {0} | Vacant: {1}",
|
||||
_occSensor.UsSensitivityInOccupiedStateFeedback.UShortValue,
|
||||
_occSensor.UsSensitivityInVacantStateFeedback.UShortValue);
|
||||
|
||||
var dash = new string('*', 50);
|
||||
CrestronConsole.PrintLine(string.Format("{0}\n", dash));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class GlsOdtOccupancySensorControllerFactory : EssentialsDeviceFactory<GlsOdtOccupancySensorController>
|
||||
{
|
||||
public GlsOdtOccupancySensorControllerFactory()
|
||||
{
|
||||
if (args.EventId == GlsOccupancySensorBase.AndWhenVacatedFeedbackEventId)
|
||||
AndWhenVacatedFeedback.FireUpdate();
|
||||
else if (args.EventId == GlsOccupancySensorBase.OrWhenVacatedFeedbackEventId)
|
||||
OrWhenVacatedFeedback.FireUpdate();
|
||||
else if (args.EventId == GlsOccupancySensorBase.UsAEnabledFeedbackEventId)
|
||||
UltrasonicAEnabledFeedback.FireUpdate();
|
||||
else if (args.EventId == GlsOccupancySensorBase.UsBEnabledFeedbackEventId)
|
||||
UltrasonicBEnabledFeedback.FireUpdate();
|
||||
else if (args.EventId == GlsOccupancySensorBase.UsSensitivityInOccupiedStateFeedbackEventId)
|
||||
UltrasonicSensitivityInOccupiedStateFeedback.FireUpdate();
|
||||
else if (args.EventId == GlsOccupancySensorBase.UsSensitivityInVacantStateFeedbackEventId)
|
||||
UltrasonicSensitivityInVacantStateFeedback.FireUpdate();
|
||||
|
||||
base.OccSensor_GlsOccupancySensorChange(device, args);
|
||||
TypeNames = new List<string> { "glsodtccn" };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the base class event delegate to fire feedbacks for event IDs that pertain to this extended class.
|
||||
/// Then calls the base delegate method to ensure any common event IDs are captured.
|
||||
/// </summary>
|
||||
/// <param name="device"></param>
|
||||
/// <param name="args"></param>
|
||||
protected override void OccSensor_BaseEvent(Crestron.SimplSharpPro.GenericBase device, Crestron.SimplSharpPro.BaseEventArgs args)
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
if (args.EventId == GlsOccupancySensorBase.RawOccupancyPirFeedbackEventId)
|
||||
RawOccupancyPirFeedback.FireUpdate();
|
||||
else if (args.EventId == GlsOccupancySensorBase.RawOccupancyUsFeedbackEventId)
|
||||
RawOccupancyUsFeedback.FireUpdate();
|
||||
Debug.Console(1, "Factory Attempting to create new GlsOccupancySensorBaseController Device");
|
||||
|
||||
base.OccSensor_BaseEvent(device, args);
|
||||
return new GlsOdtOccupancySensorController(dc.Key, GetGlsOdtCCn, dc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the OrWhenVacated state
|
||||
/// </summary>
|
||||
/// <param name="state"></param>
|
||||
public void SetOrWhenVacatedState(bool state)
|
||||
{
|
||||
OccSensor.OrWhenVacated.BoolValue = state;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the AndWhenVacated state
|
||||
/// </summary>
|
||||
/// <param name="state"></param>
|
||||
public void SetAndWhenVacatedState(bool state)
|
||||
{
|
||||
OccSensor.AndWhenVacated.BoolValue = state;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables the Ultrasonic A sensor
|
||||
/// </summary>
|
||||
/// <param name="state"></param>
|
||||
public void SetUsAEnable(bool state)
|
||||
{
|
||||
OccSensor.EnableUsA.BoolValue = state;
|
||||
OccSensor.DisableUsA.BoolValue = !state;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables the Ultrasonic B sensor
|
||||
/// </summary>
|
||||
/// <param name="state"></param>
|
||||
public void SetUsBEnable(bool state)
|
||||
{
|
||||
OccSensor.EnableUsB.BoolValue = state;
|
||||
OccSensor.DisableUsB.BoolValue = !state;
|
||||
}
|
||||
|
||||
public void IncrementUsSensitivityInOccupiedState(bool pressRelease)
|
||||
{
|
||||
OccSensor.IncrementUsSensitivityInOccupiedState.BoolValue = pressRelease;
|
||||
}
|
||||
|
||||
public void DecrementUsSensitivityInOccupiedState(bool pressRelease)
|
||||
{
|
||||
OccSensor.DecrementUsSensitivityInOccupiedState.BoolValue = pressRelease;
|
||||
}
|
||||
|
||||
public void IncrementUsSensitivityInVacantState(bool pressRelease)
|
||||
{
|
||||
OccSensor.IncrementUsSensitivityInVacantState.BoolValue = pressRelease;
|
||||
}
|
||||
|
||||
public void DecrementUsSensitivityInVacantState(bool pressRelease)
|
||||
{
|
||||
OccSensor.DecrementUsSensitivityInVacantState.BoolValue = pressRelease;
|
||||
}
|
||||
|
||||
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
|
||||
{
|
||||
LinkOccSensorToApi(this, trilist, joinStart, joinMapKey, bridge);
|
||||
}
|
||||
|
||||
#region PreActivation
|
||||
|
||||
private static GlsOdtCCn GetGlsOdtCCn(DeviceConfig dc)
|
||||
{
|
||||
var control = CommFactory.GetControlPropertiesConfig(dc);
|
||||
var cresnetId = control.CresnetIdInt;
|
||||
var branchId = control.ControlPortNumber;
|
||||
var parentKey = string.IsNullOrEmpty(control.ControlPortDevKey) ? "processor" : control.ControlPortDevKey;
|
||||
var parentKey = String.IsNullOrEmpty(control.ControlPortDevKey) ? "processor" : control.ControlPortDevKey;
|
||||
|
||||
if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
@@ -194,24 +277,6 @@ namespace PepperDash.Essentials.Core
|
||||
Debug.Console(0, "Device {0} is not a valid cresnet master", parentKey);
|
||||
return null;
|
||||
}
|
||||
#endregion
|
||||
|
||||
public class GlsOdtOccupancySensorControllerFactory : EssentialsDeviceFactory<GlsOdtOccupancySensorController>
|
||||
{
|
||||
public GlsOdtOccupancySensorControllerFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "glsodtccn" };
|
||||
}
|
||||
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new GlsOccupancySensorBaseController Device");
|
||||
|
||||
return new GlsOdtOccupancySensorController(dc.Key, GetGlsOdtCCn, dc);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using Crestron.SimplSharpPro.GeneralIO;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.Bridges;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
public class GlsOirOccupancySensorController:GlsOccupancySensorBaseController
|
||||
{
|
||||
private GlsOirCCn _occSensor;
|
||||
|
||||
public GlsOirOccupancySensorController(string key, Func<DeviceConfig, GlsOirCCn> preActivationFunc,DeviceConfig config) : this(key,config.Name, preActivationFunc, config)
|
||||
{
|
||||
}
|
||||
|
||||
public GlsOirOccupancySensorController(string key, string name, Func<DeviceConfig, GlsOirCCn> preActivationFunc, DeviceConfig config) : base(key, name, config)
|
||||
{
|
||||
AddPreActivationAction(() =>
|
||||
{
|
||||
_occSensor = preActivationFunc(config);
|
||||
|
||||
RegisterCrestronGenericBase(_occSensor);
|
||||
|
||||
RegisterGlsOccupancySensorBaseController(_occSensor);
|
||||
});
|
||||
}
|
||||
|
||||
#region Overrides of CrestronGenericBridgeableBaseDevice
|
||||
|
||||
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
|
||||
{
|
||||
LinkOccSensorToApi(this, trilist, joinStart, joinMapKey, bridge);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public class GlsOccupancySensorBaseControllerFactory : EssentialsDeviceFactory<GlsOccupancySensorBaseController>
|
||||
{
|
||||
public GlsOccupancySensorBaseControllerFactory()
|
||||
{
|
||||
TypeNames = new List<string> { "glsoirccn" };
|
||||
}
|
||||
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new GlsOirOccupancySensorController Device");
|
||||
|
||||
return new GlsOirOccupancySensorController(dc.Key, GetGlsOirCCn, dc);
|
||||
}
|
||||
|
||||
private static GlsOirCCn GetGlsOirCCn(DeviceConfig dc)
|
||||
{
|
||||
var control = CommFactory.GetControlPropertiesConfig(dc);
|
||||
var cresnetId = control.CresnetIdInt;
|
||||
var branchId = control.ControlPortNumber;
|
||||
var parentKey = string.IsNullOrEmpty(control.ControlPortDevKey) ? "processor" : control.ControlPortDevKey;
|
||||
|
||||
if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
Debug.Console(0, "Device {0} is a valid cresnet master - creating new GlsOirCCn", parentKey);
|
||||
return new GlsOirCCn(cresnetId, Global.ControlSystem);
|
||||
}
|
||||
var cresnetBridge = DeviceManager.GetDeviceForKey(parentKey) as IHasCresnetBranches;
|
||||
|
||||
if (cresnetBridge != null)
|
||||
{
|
||||
Debug.Console(0, "Device {0} is a valid cresnet master - creating new GlsOirCCn", parentKey);
|
||||
return new GlsOirCCn(cresnetId, cresnetBridge.CresnetBranches[branchId]);
|
||||
}
|
||||
Debug.Console(0, "Device {0} is not a valid cresnet master", parentKey);
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -2,17 +2,18 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro.GeneralIO;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Aggregates the RoomIsOccupied feedbacks of one or more IOccupancyStatusProvider objects
|
||||
/// </summary>
|
||||
public class IOccupancyStatusProviderAggregator : Device, IOccupancyStatusProvider
|
||||
public class IOccupancyStatusProviderAggregator : EssentialsDevice, IOccupancyStatusProvider
|
||||
{
|
||||
/// <summary>
|
||||
/// Aggregated feedback of all linked IOccupancyStatusProvider devices
|
||||
@@ -21,16 +22,51 @@ namespace PepperDash.Essentials.Core
|
||||
{
|
||||
get
|
||||
{
|
||||
return AggregatedOccupancyStatus.Output;
|
||||
return _aggregatedOccupancyStatus.Output;
|
||||
}
|
||||
}
|
||||
|
||||
private BoolFeedbackOr AggregatedOccupancyStatus;
|
||||
private readonly BoolFeedbackOr _aggregatedOccupancyStatus;
|
||||
|
||||
public IOccupancyStatusProviderAggregator(string key, string name)
|
||||
: base(key, name)
|
||||
{
|
||||
AggregatedOccupancyStatus = new BoolFeedbackOr();
|
||||
_aggregatedOccupancyStatus = new BoolFeedbackOr();
|
||||
}
|
||||
|
||||
public IOccupancyStatusProviderAggregator(string key, string name, OccupancyAggregatorConfig config)
|
||||
: this(key, name)
|
||||
{
|
||||
AddPostActivationAction(() =>
|
||||
{
|
||||
if (config.DeviceKeys.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var deviceKey in config.DeviceKeys)
|
||||
{
|
||||
var device = DeviceManager.GetDeviceForKey(deviceKey);
|
||||
|
||||
if (device == null)
|
||||
{
|
||||
Debug.Console(0, this, Debug.ErrorLogLevel.Notice,
|
||||
"Unable to retrieve Occupancy provider with key {0}", deviceKey);
|
||||
continue;
|
||||
}
|
||||
|
||||
var provider = device as IOccupancyStatusProvider;
|
||||
|
||||
if (provider == null)
|
||||
{
|
||||
Debug.Console(0, this, Debug.ErrorLogLevel.Notice,
|
||||
"Device with key {0} does NOT implement IOccupancyStatusProvider. Please check configuration.");
|
||||
continue;
|
||||
}
|
||||
|
||||
AddOccupancyStatusProvider(provider);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -39,7 +75,35 @@ namespace PepperDash.Essentials.Core
|
||||
/// <param name="statusProvider"></param>
|
||||
public void AddOccupancyStatusProvider(IOccupancyStatusProvider statusProvider)
|
||||
{
|
||||
AggregatedOccupancyStatus.AddOutputIn(statusProvider.RoomIsOccupiedFeedback);
|
||||
_aggregatedOccupancyStatus.AddOutputIn(statusProvider.RoomIsOccupiedFeedback);
|
||||
}
|
||||
|
||||
public void RemoveOccupancyStatusProvider(IOccupancyStatusProvider statusProvider)
|
||||
{
|
||||
_aggregatedOccupancyStatus.RemoveOutputIn(statusProvider.RoomIsOccupiedFeedback);
|
||||
}
|
||||
|
||||
public void ClearOccupancyStatusProviders()
|
||||
{
|
||||
_aggregatedOccupancyStatus.ClearOutputs();
|
||||
}
|
||||
}
|
||||
|
||||
public class OccupancyAggregatorFactory : EssentialsDeviceFactory<IOccupancyStatusProviderAggregator>
|
||||
{
|
||||
public OccupancyAggregatorFactory()
|
||||
{
|
||||
TypeNames = new List<string> { "occupancyAggregator", "occAggregate" };
|
||||
}
|
||||
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new GlsOccupancySensorBaseController Device");
|
||||
|
||||
var config = dc.Properties.ToObject<OccupancyAggregatorConfig>();
|
||||
|
||||
return new IOccupancyStatusProviderAggregator(dc.Key, dc.Name, config);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
public class OccupancyAggregatorConfig
|
||||
{
|
||||
[JsonProperty("deviceKeys")] public List<string> DeviceKeys { get; set; }
|
||||
|
||||
public OccupancyAggregatorConfig()
|
||||
{
|
||||
DeviceKeys = new List<string>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ using Crestron.SimplSharpPro.GeneralIO;
|
||||
using Newtonsoft.Json;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.Bridges;
|
||||
using PepperDash_Essentials_Core.Bridges.JoinMaps;
|
||||
using PepperDash.Essentials.Core.Bridges.JoinMaps;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -48,39 +48,39 @@
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<HintPath>..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Fusion.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Crestron.SimplSharpPro.Gateways, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Gateways.dll</HintPath>
|
||||
<HintPath>..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Gateways.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Crestron.SimplSharpPro.GeneralIO, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.GeneralIO.dll</HintPath>
|
||||
<HintPath>..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.GeneralIO.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>
|
||||
<HintPath>..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Remotes.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Crestron.SimplSharpPro.ThreeSeriesCards, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.ThreeSeriesCards.dll</HintPath>
|
||||
<HintPath>..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.ThreeSeriesCards.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>
|
||||
<HintPath>..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.UI.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="mscorlib" />
|
||||
<Reference Include="PepperDash_Core, Version=1.0.42.30563, Culture=neutral, processorArchitecture=MSIL">
|
||||
@@ -89,30 +89,30 @@
|
||||
</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>
|
||||
<HintPath>..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpCustomAttributesInterface.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</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>
|
||||
<HintPath>..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpHelperInterface.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</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>
|
||||
<HintPath>..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpNewtonsoft.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SimplSharpPro, Version=1.5.3.17, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpPro.exe</HintPath>
|
||||
<HintPath>..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpPro.exe</HintPath>
|
||||
<Private>False</Private>
|
||||
</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>
|
||||
<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>
|
||||
<HintPath>..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpTimerEventInterface.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
@@ -143,6 +143,7 @@
|
||||
<Compile Include="Bridges\JoinMaps\Hrxxx0WirelessRemoteControllerJoinMap.cs" />
|
||||
<Compile Include="Bridges\JoinMaps\IBasicCommunicationJoinMap.cs" />
|
||||
<Compile Include="Bridges\JoinMaps\IDigitalInputJoinMap.cs" />
|
||||
<Compile Include="Bridges\JoinMaps\IRBlurayBaseJoinMap.cs" />
|
||||
<Compile Include="Bridges\JoinMaps\SetTopBoxControllerJoinMap.cs" />
|
||||
<Compile Include="Bridges\JoinMaps\StatusSignControllerJoinMap.cs" />
|
||||
<Compile Include="Bridges\JoinMaps\SystemMonitorJoinMap.cs" />
|
||||
@@ -161,6 +162,7 @@
|
||||
<Compile Include="Config\Essentials\ConfigWriter.cs" />
|
||||
<Compile Include="Config\Essentials\EssentialsConfig.cs" />
|
||||
<Compile Include="Config\SourceDevicePropertiesConfigBase.cs" />
|
||||
<Compile Include="Crestron IO\C2nIo\C2nIoController.cs" />
|
||||
<Compile Include="Crestron IO\C2nRts\C2nRthsController.cs" />
|
||||
<Compile Include="Crestron IO\Cards\C3CardControllerBase.cs" />
|
||||
<Compile Include="Crestron IO\Cards\C3Com3Controller.cs" />
|
||||
@@ -188,6 +190,7 @@
|
||||
<Compile Include="Device Info\IDeviceInfoProvider.cs" />
|
||||
<Compile Include="Devices\CodecInterfaces.cs" />
|
||||
<Compile Include="Devices\CrestronProcessor.cs" />
|
||||
<Compile Include="Devices\DestinationListItem.cs" />
|
||||
<Compile Include="Devices\DeviceApiBase.cs" />
|
||||
<Compile Include="Devices\DeviceFeedbackExtensions.cs" />
|
||||
<Compile Include="Devices\EssentialsBridgeableDevice.cs" />
|
||||
@@ -195,6 +198,7 @@
|
||||
<Compile Include="Devices\GenericIRController.cs" />
|
||||
<Compile Include="Devices\IDspPreset.cs" />
|
||||
<Compile Include="Devices\IProjectorInterfaces.cs" />
|
||||
<Compile Include="Devices\IReconfigurableDevice.cs" />
|
||||
<Compile Include="Devices\PC\InRoomPc.cs" />
|
||||
<Compile Include="Devices\PC\Laptop.cs" />
|
||||
<Compile Include="Devices\ReconfigurableDevice.cs" />
|
||||
@@ -207,6 +211,7 @@
|
||||
<Compile Include="DeviceTypeInterfaces\IHasFarEndContentStatus.cs" />
|
||||
<Compile Include="DeviceTypeInterfaces\IHasPhoneDialing.cs" />
|
||||
<Compile Include="DeviceTypeInterfaces\IMobileControl.cs" />
|
||||
<Compile Include="Extensions\JsonExtensions.cs" />
|
||||
<Compile Include="Factory\DeviceFactory.cs" />
|
||||
<Compile Include="Factory\IDeviceFactory.cs" />
|
||||
<Compile Include="Factory\ReadyEventArgs.cs" />
|
||||
@@ -227,6 +232,9 @@
|
||||
<Compile Include="Global\EthernetAdapterInfo.cs" />
|
||||
<Compile Include="Interfaces\ILogStrings.cs" />
|
||||
<Compile Include="Interfaces\ILogStringsWithLevel.cs" />
|
||||
<Compile Include="Occupancy\GlsOccupancySensorPropertiesConfig.cs" />
|
||||
<Compile Include="Occupancy\GlsOirOccupancySensorController.cs" />
|
||||
<Compile Include="Occupancy\OccupancyAggregatorConfig.cs" />
|
||||
<Compile Include="Queues\ComsMessage.cs" />
|
||||
<Compile Include="Queues\ProcessStringMessage.cs" />
|
||||
<Compile Include="Queues\GenericQueue.cs" />
|
||||
@@ -283,6 +291,7 @@
|
||||
<Compile Include="Room\Behaviours\RoomOnToDefaultSourceWhenOccupied.cs" />
|
||||
<Compile Include="Room\EssentialsRoomBase.cs" />
|
||||
<Compile Include="Room\Config\EssentialsRoomScheduledEventsConfig.cs" />
|
||||
<Compile Include="Room\IEssentialsRoom.cs" />
|
||||
<Compile Include="Room\Interfaces.cs" />
|
||||
<Compile Include="Room\iOccupancyStatusProvider.cs" />
|
||||
<Compile Include="Routing\DummyRoutingInputsDevice.cs" />
|
||||
@@ -316,6 +325,10 @@
|
||||
<Compile Include="Feedbacks\BoolFeedbackPulseExtender.cs" />
|
||||
<Compile Include="Routing\RoutingPortNames.cs" />
|
||||
<Compile Include="Routing\TieLineConfig.cs" />
|
||||
<Compile Include="Secrets\CrestronSecretsProvider.cs" />
|
||||
<Compile Include="Secrets\Interfaces.cs" />
|
||||
<Compile Include="Secrets\SecretsManager.cs" />
|
||||
<Compile Include="Secrets\SecretsPropertiesConfig.cs" />
|
||||
<Compile Include="Shades\Shade Interfaces.cs" />
|
||||
<Compile Include="Shades\ShadeBase.cs" />
|
||||
<Compile Include="Shades\ShadeController.cs" />
|
||||
@@ -326,6 +339,7 @@
|
||||
<Compile Include="Routing\TieLine.cs" />
|
||||
<Compile Include="Queues\StringResponseProcessor.cs" />
|
||||
<Compile Include="Timers\CountdownTimer.cs" />
|
||||
<Compile Include="Timers\RetriggerableTimer.cs" />
|
||||
<Compile Include="Touchpanels\CrestronTouchpanelPropertiesConfig.cs" />
|
||||
<Compile Include="Touchpanels\Interfaces.cs" />
|
||||
<Compile Include="Touchpanels\Keyboards\HabaneroKeyboardController.cs" />
|
||||
@@ -336,6 +350,7 @@
|
||||
<Compile Include="UI PageManagers\SinglePageManager.cs" />
|
||||
<Compile Include="UI PageManagers\PageManager.cs" />
|
||||
<Compile Include="UI PageManagers\SetTopBoxTwoPanelPageManager.cs" />
|
||||
<Compile Include="Utilities\ActionSequence.cs" />
|
||||
<Compile Include="VideoStatus\VideoStatusOutputs.cs" />
|
||||
<Compile Include="Crestron\CrestronGenericBaseDevice.cs" />
|
||||
<Compile Include="DeviceControlsParentInterfaces\IPresentationSource.cs" />
|
||||
|
||||
@@ -358,14 +358,27 @@ namespace PepperDash.Essentials
|
||||
try
|
||||
{
|
||||
var assy = loadedAssembly.Assembly;
|
||||
var types = assy.GetTypes();
|
||||
CType[] types = {};
|
||||
try
|
||||
{
|
||||
types = assy.GetTypes();
|
||||
}
|
||||
catch (TypeLoadException e)
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Warning, "Unable to get types for assembly {0}: {1}",
|
||||
loadedAssembly.Name, e.Message);
|
||||
Debug.Console(2, e.StackTrace);
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach (var type in types)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (typeof(IPluginDeviceFactory).IsAssignableFrom(type))
|
||||
if (typeof (IPluginDeviceFactory).IsAssignableFrom(type) && !type.IsAbstract)
|
||||
{
|
||||
var plugin = (IPluginDeviceFactory)Crestron.SimplSharp.Reflection.Activator.CreateInstance(type);
|
||||
var plugin =
|
||||
(IPluginDeviceFactory) Crestron.SimplSharp.Reflection.Activator.CreateInstance(type);
|
||||
LoadCustomPlugin(plugin, loadedAssembly);
|
||||
}
|
||||
else
|
||||
@@ -378,10 +391,15 @@ namespace PepperDash.Essentials
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (NotSupportedException e)
|
||||
{
|
||||
//this happens for dlls that aren't PD dlls, like ports of Mono classes into S#. Swallowing.
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Console(2, "Load Plugin not found. {0}.{2} is not a plugin factory. Exception: {1}",
|
||||
loadedAssembly.Name, e, type.Name);
|
||||
loadedAssembly.Name, e.Message, type.Name);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -389,7 +407,9 @@ namespace PepperDash.Essentials
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Console(2, "Error Loading Assembly: {0} Exception: {1} ", loadedAssembly.Name, e);
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Warning, "Error Loading assembly {0}: {1}",
|
||||
loadedAssembly.Name, e.Message);
|
||||
Debug.Console(2, "{0}", e.StackTrace);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash_Essentials_Core.Queues
|
||||
namespace PepperDash.Essentials.Core.Queues
|
||||
{
|
||||
/// <summary>
|
||||
/// IBasicCommunication Message for IQueue
|
||||
@@ -62,6 +62,78 @@ namespace PepperDash_Essentials_Core.Queues
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Shows either the byte[] or string to be sent
|
||||
/// </summary>
|
||||
public override string ToString()
|
||||
{
|
||||
return _bytes != null ? _bytes.ToString() : _string;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace PepperDash_Essentials_Core.Queues
|
||||
{
|
||||
/// <summary>
|
||||
/// IBasicCommunication Message for IQueue
|
||||
/// </summary>
|
||||
[Obsolete("Use PepperDash.Essentials.Core.Queues")]
|
||||
public class ComsMessage : IQueueMessage
|
||||
{
|
||||
private readonly byte[] _bytes;
|
||||
private readonly IBasicCommunication _coms;
|
||||
private readonly string _string;
|
||||
private readonly bool _isByteMessage;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for a string message
|
||||
/// </summary>
|
||||
/// <param name="coms">IBasicCommunication to send the message</param>
|
||||
/// <param name="message">Message to send</param>
|
||||
public ComsMessage(IBasicCommunication coms, string message)
|
||||
{
|
||||
Validate(coms, message);
|
||||
_coms = coms;
|
||||
_string = message;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for a byte message
|
||||
/// </summary>
|
||||
/// <param name="coms">IBasicCommunication to send the message</param>
|
||||
/// <param name="message">Message to send</param>
|
||||
public ComsMessage(IBasicCommunication coms, byte[] message)
|
||||
{
|
||||
Validate(coms, message);
|
||||
_coms = coms;
|
||||
_bytes = message;
|
||||
_isByteMessage = true;
|
||||
}
|
||||
|
||||
private void Validate(IBasicCommunication coms, object message)
|
||||
{
|
||||
if (coms == null)
|
||||
throw new ArgumentNullException("coms");
|
||||
|
||||
if (message == null)
|
||||
throw new ArgumentNullException("message");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dispatchs the string/byte[] to the IBasicCommunication specified
|
||||
/// </summary>
|
||||
public void Dispatch()
|
||||
{
|
||||
if (_isByteMessage)
|
||||
{
|
||||
_coms.SendBytes(_bytes);
|
||||
}
|
||||
else
|
||||
{
|
||||
_coms.SendText(_string);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Shows either the byte[] or string to be sent
|
||||
/// </summary>
|
||||
|
||||
@@ -3,7 +3,7 @@ using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro.CrestronThread;
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash_Essentials_Core.Queues
|
||||
namespace PepperDash.Essentials.Core.Queues
|
||||
{
|
||||
/// <summary>
|
||||
/// Threadsafe processing of queued items with pacing if required
|
||||
@@ -14,45 +14,56 @@ namespace PepperDash_Essentials_Core.Queues
|
||||
protected readonly CrestronQueue<IQueueMessage> _queue;
|
||||
protected readonly Thread _worker;
|
||||
protected readonly CEvent _waitHandle = new CEvent();
|
||||
|
||||
|
||||
private bool _delayEnabled;
|
||||
private int _delayTime;
|
||||
|
||||
private const Thread.eThreadPriority _defaultPriority = Thread.eThreadPriority.MediumPriority;
|
||||
|
||||
/// <summary>
|
||||
/// If the instance has been disposed.
|
||||
/// </summary>
|
||||
public bool Disposed { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the capacity of the CrestronQueue (fixed Size property)
|
||||
/// </summary>
|
||||
public int QueueCapacity
|
||||
{
|
||||
get
|
||||
{
|
||||
return _queue.Size;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the number of elements currently in the CrestronQueue
|
||||
/// </summary>
|
||||
public int QueueCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return _queue.Count;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with no thread priority
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
public GenericQueue(string key)
|
||||
: this(key, Thread.eThreadPriority.NotSet)
|
||||
: this(key, _defaultPriority, 0, 0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for generic queue with no pacing
|
||||
/// Constructor with queue size
|
||||
/// </summary>
|
||||
/// <param name="key">Key</param>
|
||||
public GenericQueue(string key, Thread.eThreadPriority priority)
|
||||
/// <param name="key"></param>
|
||||
/// <param name="capacity">Fixed size for the queue to hold</param>
|
||||
public GenericQueue(string key, int capacity)
|
||||
: this(key, _defaultPriority, capacity, 0)
|
||||
{
|
||||
_key = key;
|
||||
_queue = new CrestronQueue<IQueueMessage>(25);
|
||||
_worker = new Thread(ProcessQueue, null, Thread.eThreadStartOptions.Running)
|
||||
{
|
||||
Priority = priority
|
||||
};
|
||||
|
||||
CrestronEnvironment.ProgramStatusEventHandler += programEvent =>
|
||||
{
|
||||
if (programEvent != eProgramStatusEventType.Stopping)
|
||||
return;
|
||||
|
||||
Dispose();
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -60,10 +71,20 @@ namespace PepperDash_Essentials_Core.Queues
|
||||
/// </summary>
|
||||
/// <param name="key">Key</param>
|
||||
/// <param name="pacing">Pacing in ms between actions</param>
|
||||
public GenericQueue(string key, int pacing)
|
||||
: this(key)
|
||||
public GenericQueue(int pacing, string key)
|
||||
: this(key, _defaultPriority, 0, pacing)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with pacing and capacity
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="pacing"></param>
|
||||
/// <param name="capacity"></param>
|
||||
public GenericQueue(string key, int pacing, int capacity)
|
||||
: this(key, _defaultPriority, capacity, pacing)
|
||||
{
|
||||
SetDelayValues(pacing);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -73,8 +94,54 @@ namespace PepperDash_Essentials_Core.Queues
|
||||
/// <param name="pacing"></param>
|
||||
/// <param name="priority"></param>
|
||||
public GenericQueue(string key, int pacing, Thread.eThreadPriority priority)
|
||||
: this(key, priority)
|
||||
: this(key, priority, 0, pacing)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with pacing, priority and capacity
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="priority"></param>
|
||||
/// <param name="capacity"></param>
|
||||
public GenericQueue(string key, Thread.eThreadPriority priority, int capacity)
|
||||
: this(key, priority, capacity, 0)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with pacing, priority and capacity
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="pacing"></param>
|
||||
/// <param name="priority"></param>
|
||||
/// <param name="capacity"></param>
|
||||
public GenericQueue(string key, int pacing, Thread.eThreadPriority priority, int capacity)
|
||||
: this(key, priority, capacity, pacing)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for generic queue with no pacing
|
||||
/// </summary>
|
||||
/// <param name="key">Key</param>
|
||||
/// <param name="priority"></param>
|
||||
/// <param name="capacity"></param>
|
||||
/// <param name="pacing"></param>
|
||||
protected GenericQueue(string key, Thread.eThreadPriority priority, int capacity, int pacing)
|
||||
{
|
||||
_key = key;
|
||||
int cap = 25; // sets default
|
||||
if (capacity > 0)
|
||||
{
|
||||
cap = capacity; // overrides default
|
||||
}
|
||||
_queue = new CrestronQueue<IQueueMessage>(cap);
|
||||
_worker = new Thread(ProcessQueue, null, Thread.eThreadStartOptions.Running)
|
||||
{
|
||||
Priority = priority
|
||||
};
|
||||
|
||||
SetDelayValues(pacing);
|
||||
}
|
||||
|
||||
@@ -82,8 +149,273 @@ namespace PepperDash_Essentials_Core.Queues
|
||||
{
|
||||
_delayEnabled = pacing > 0;
|
||||
_delayTime = pacing;
|
||||
|
||||
CrestronEnvironment.ProgramStatusEventHandler += programEvent =>
|
||||
{
|
||||
if (programEvent != eProgramStatusEventType.Stopping)
|
||||
return;
|
||||
|
||||
Dispose(true);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Thread callback
|
||||
/// </summary>
|
||||
/// <param name="obj">The action used to process dequeued items</param>
|
||||
/// <returns>Null when the thread is exited</returns>
|
||||
private object ProcessQueue(object obj)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
IQueueMessage item = null;
|
||||
|
||||
if (_queue.Count > 0)
|
||||
{
|
||||
item = _queue.Dequeue();
|
||||
if (item == null)
|
||||
break;
|
||||
}
|
||||
if (item != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
//Debug.Console(2, this, "Processing queue item: '{0}'", item.ToString());
|
||||
item.Dispatch();
|
||||
|
||||
if (_delayEnabled)
|
||||
Thread.Sleep(_delayTime);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.Console(0, this, Debug.ErrorLogLevel.Error, "Caught an exception in the Queue {0}\r{1}\r{2}", ex.Message, ex.InnerException, ex.StackTrace);
|
||||
}
|
||||
}
|
||||
else _waitHandle.Wait();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void Enqueue(IQueueMessage item)
|
||||
{
|
||||
if (Disposed)
|
||||
{
|
||||
Debug.Console(1, this, "I've been disposed so you can't enqueue any messages. Are you trying to dispatch a message while the program is stopping?");
|
||||
return;
|
||||
}
|
||||
|
||||
_queue.Enqueue(item);
|
||||
_waitHandle.Set();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disposes the thread and cleans up resources. Thread cannot be restarted once
|
||||
/// disposed.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
CrestronEnvironment.GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Actually does the disposing. If you override this method, be sure to either call the base implementation
|
||||
/// or clean up all the resources yourself.
|
||||
/// </summary>
|
||||
/// <param name="disposing">set to true unless called from finalizer</param>
|
||||
protected void Dispose(bool disposing)
|
||||
{
|
||||
if (Disposed)
|
||||
return;
|
||||
|
||||
if (disposing)
|
||||
{
|
||||
Debug.Console(2, this, "Disposing...");
|
||||
if (_queue != null && !_queue.Disposed)
|
||||
{
|
||||
_queue.Clear();
|
||||
Enqueue(null);
|
||||
}
|
||||
_worker.Abort();
|
||||
_waitHandle.Close();
|
||||
}
|
||||
|
||||
Disposed = true;
|
||||
}
|
||||
|
||||
~GenericQueue()
|
||||
{
|
||||
Dispose(true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Key
|
||||
/// </summary>
|
||||
public string Key
|
||||
{
|
||||
get { return _key; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace PepperDash_Essentials_Core.Queues
|
||||
{
|
||||
/// <summary>
|
||||
/// Threadsafe processing of queued items with pacing if required
|
||||
/// </summary>
|
||||
[Obsolete("Use PepperDash.Essentials.Core.Queues")]
|
||||
public class GenericQueue : IQueue<IQueueMessage>
|
||||
{
|
||||
private readonly string _key;
|
||||
protected readonly CrestronQueue<IQueueMessage> _queue;
|
||||
protected readonly Thread _worker;
|
||||
protected readonly CEvent _waitHandle = new CEvent();
|
||||
|
||||
private bool _delayEnabled;
|
||||
private int _delayTime;
|
||||
|
||||
private const Thread.eThreadPriority _defaultPriority = Thread.eThreadPriority.MediumPriority;
|
||||
|
||||
/// <summary>
|
||||
/// If the instance has been disposed.
|
||||
/// </summary>
|
||||
public bool Disposed { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the capacity of the CrestronQueue (fixed Size property)
|
||||
/// </summary>
|
||||
public int QueueCapacity
|
||||
{
|
||||
get
|
||||
{
|
||||
return _queue.Size;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the number of elements currently in the CrestronQueue
|
||||
/// </summary>
|
||||
public int QueueCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return _queue.Count;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with no thread priority
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
public GenericQueue(string key)
|
||||
: this(key, _defaultPriority, 0, 0)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with queue size
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="capacity">Fixed size for the queue to hold</param>
|
||||
public GenericQueue(string key, int capacity)
|
||||
: this(key, _defaultPriority, capacity, 0)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for generic queue with no pacing
|
||||
/// </summary>
|
||||
/// <param name="key">Key</param>
|
||||
/// <param name="pacing">Pacing in ms between actions</param>
|
||||
public GenericQueue(int pacing, string key)
|
||||
: this(key, _defaultPriority, 0, pacing)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with pacing and capacity
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="pacing"></param>
|
||||
/// <param name="capacity"></param>
|
||||
public GenericQueue(string key, int pacing, int capacity)
|
||||
: this(key, _defaultPriority, capacity, pacing)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with pacing and priority
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="pacing"></param>
|
||||
/// <param name="priority"></param>
|
||||
public GenericQueue(string key, int pacing, Thread.eThreadPriority priority)
|
||||
: this(key, priority, 0, pacing)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with pacing, priority and capacity
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="priority"></param>
|
||||
/// <param name="capacity"></param>
|
||||
public GenericQueue(string key, Thread.eThreadPriority priority, int capacity)
|
||||
: this(key, priority, capacity, 0)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with pacing, priority and capacity
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="pacing"></param>
|
||||
/// <param name="priority"></param>
|
||||
/// <param name="capacity"></param>
|
||||
public GenericQueue(string key, int pacing, Thread.eThreadPriority priority, int capacity)
|
||||
: this(key, priority, capacity, pacing)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for generic queue with no pacing
|
||||
/// </summary>
|
||||
/// <param name="key">Key</param>
|
||||
/// <param name="priority"></param>
|
||||
/// <param name="capacity"></param>
|
||||
/// <param name="pacing"></param>
|
||||
protected GenericQueue(string key, Thread.eThreadPriority priority, int capacity, int pacing)
|
||||
{
|
||||
_key = key;
|
||||
int cap = 25; // sets default
|
||||
if (capacity > 0)
|
||||
{
|
||||
cap = capacity; // overrides default
|
||||
}
|
||||
_queue = new CrestronQueue<IQueueMessage>(cap);
|
||||
_worker = new Thread(ProcessQueue, null, Thread.eThreadStartOptions.Running)
|
||||
{
|
||||
Priority = priority
|
||||
};
|
||||
|
||||
SetDelayValues(pacing);
|
||||
}
|
||||
|
||||
private void SetDelayValues(int pacing)
|
||||
{
|
||||
_delayEnabled = pacing > 0;
|
||||
_delayTime = pacing;
|
||||
|
||||
CrestronEnvironment.ProgramStatusEventHandler += programEvent =>
|
||||
{
|
||||
if (programEvent != eProgramStatusEventType.Stopping)
|
||||
return;
|
||||
|
||||
Dispose(true);
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Thread callback
|
||||
/// </summary>
|
||||
@@ -150,8 +482,13 @@ namespace PepperDash_Essentials_Core.Queues
|
||||
|
||||
if (disposing)
|
||||
{
|
||||
Enqueue(null);
|
||||
_worker.Join();
|
||||
Debug.Console(2, this, "Disposing...");
|
||||
if (_queue != null && !_queue.Disposed)
|
||||
{
|
||||
_queue.Clear();
|
||||
Enqueue(null);
|
||||
}
|
||||
_worker.Abort();
|
||||
_waitHandle.Close();
|
||||
}
|
||||
|
||||
@@ -160,7 +497,7 @@ namespace PepperDash_Essentials_Core.Queues
|
||||
|
||||
~GenericQueue()
|
||||
{
|
||||
Dispose(false);
|
||||
Dispose(true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -5,11 +5,21 @@ using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash_Essentials_Core.Queues
|
||||
namespace PepperDash.Essentials.Core.Queues
|
||||
{
|
||||
public interface IQueue<T> : IKeyed, IDisposable where T : class
|
||||
{
|
||||
void Enqueue(T item);
|
||||
bool Disposed { get; }
|
||||
}
|
||||
}
|
||||
|
||||
namespace PepperDash_Essentials_Core.Queues
|
||||
{
|
||||
[Obsolete("Use PepperDash.Essentials.Core.Queues")]
|
||||
public interface IQueue<T> : IKeyed, IDisposable where T : class
|
||||
{
|
||||
void Enqueue(T item);
|
||||
bool Disposed { get; }
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,18 @@
|
||||
namespace PepperDash_Essentials_Core.Queues
|
||||
using System;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Queues
|
||||
{
|
||||
public interface IQueueMessage
|
||||
{
|
||||
void Dispatch();
|
||||
}
|
||||
}
|
||||
|
||||
namespace PepperDash_Essentials_Core.Queues
|
||||
{
|
||||
[Obsolete("Use PepperDash.Essentials.Core.Queues")]
|
||||
public interface IQueueMessage
|
||||
{
|
||||
void Dispatch();
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
|
||||
namespace PepperDash_Essentials_Core.Queues
|
||||
namespace PepperDash.Essentials.Core.Queues
|
||||
{
|
||||
/// <summary>
|
||||
/// Message class for processing strings via an IQueue
|
||||
@@ -32,6 +32,50 @@ namespace PepperDash_Essentials_Core.Queues
|
||||
_action(_message);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// To string
|
||||
/// </summary>
|
||||
/// <returns>The current message</returns>
|
||||
public override string ToString()
|
||||
{
|
||||
return _message ?? String.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace PepperDash_Essentials_Core.Queues
|
||||
{
|
||||
/// <summary>
|
||||
/// Message class for processing strings via an IQueue
|
||||
/// </summary>
|
||||
[Obsolete("Use PepperDash.Essentials.Core.Queues")]
|
||||
public class ProcessStringMessage : IQueueMessage
|
||||
{
|
||||
private readonly Action<string> _action;
|
||||
private readonly string _message;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="message">Message to be processed</param>
|
||||
/// <param name="action">Action to invoke on the message</param>
|
||||
public ProcessStringMessage(string message, Action<string> action)
|
||||
{
|
||||
_message = message;
|
||||
_action = action;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes the string with the given action
|
||||
/// </summary>
|
||||
public void Dispatch()
|
||||
{
|
||||
if (_action == null || String.IsNullOrEmpty(_message))
|
||||
return;
|
||||
|
||||
_action(_message);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// To string
|
||||
/// </summary>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
using Crestron.SimplSharp;
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash_Essentials_Core.Queues
|
||||
namespace PepperDash.Essentials.Core.Queues
|
||||
{
|
||||
public sealed class StringResponseProcessor : IKeyed, IDisposable
|
||||
{
|
||||
@@ -98,6 +98,110 @@ namespace PepperDash_Essentials_Core.Queues
|
||||
/// </summary>
|
||||
public bool Disposed { get; private set; }
|
||||
|
||||
~StringResponseProcessor()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace PepperDash_Essentials_Core.Queues
|
||||
{
|
||||
[Obsolete("Use PepperDash.Essentials.Core.Queues")]
|
||||
public sealed class StringResponseProcessor : IKeyed, IDisposable
|
||||
{
|
||||
private readonly Action<string> _processStringAction;
|
||||
private readonly IQueue<IQueueMessage> _queue;
|
||||
private readonly IBasicCommunication _coms;
|
||||
private readonly CommunicationGather _gather;
|
||||
|
||||
private StringResponseProcessor(string key, Action<string> processStringAction)
|
||||
{
|
||||
_processStringAction = processStringAction;
|
||||
_queue = new GenericQueue(key);
|
||||
|
||||
CrestronEnvironment.ProgramStatusEventHandler += programEvent =>
|
||||
{
|
||||
if (programEvent != eProgramStatusEventType.Stopping)
|
||||
return;
|
||||
|
||||
Dispose();
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor that builds an instance and subscribes to coms TextReceived for processing
|
||||
/// </summary>
|
||||
/// <param name="coms">Com port to process strings from</param>
|
||||
/// <param name="processStringAction">Action to process the incoming strings</param>
|
||||
public StringResponseProcessor(IBasicCommunication coms, Action<string> processStringAction)
|
||||
: this(coms.Key, processStringAction)
|
||||
{
|
||||
_coms = coms;
|
||||
coms.TextReceived += OnResponseReceived;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor that builds an instance and subscribes to gather Line Received for processing
|
||||
/// </summary>
|
||||
/// <param name="gather">Gather to process strings from</param>
|
||||
/// <param name="processStringAction">Action to process the incoming strings</param>
|
||||
public StringResponseProcessor(CommunicationGather gather, Action<string> processStringAction)
|
||||
: this(gather.Port.Key, processStringAction)
|
||||
{
|
||||
_gather = gather;
|
||||
gather.LineReceived += OnResponseReceived;
|
||||
}
|
||||
|
||||
private void OnResponseReceived(object sender, GenericCommMethodReceiveTextArgs args)
|
||||
{
|
||||
_queue.Enqueue(new ProcessStringMessage(args.Text, _processStringAction));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Key
|
||||
/// </summary>
|
||||
public string Key
|
||||
{
|
||||
get { return _queue.Key; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disposes the instance and cleans up resources.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
CrestronEnvironment.GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
private void Dispose(bool disposing)
|
||||
{
|
||||
if (Disposed)
|
||||
return;
|
||||
|
||||
if (disposing)
|
||||
{
|
||||
if (_coms != null)
|
||||
_coms.TextReceived -= OnResponseReceived;
|
||||
|
||||
if (_gather != null)
|
||||
{
|
||||
_gather.LineReceived -= OnResponseReceived;
|
||||
_gather.Stop();
|
||||
}
|
||||
|
||||
_queue.Dispose();
|
||||
}
|
||||
|
||||
Disposed = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If the instance has been disposed or not. If it has, you can not use it anymore
|
||||
/// </summary>
|
||||
public bool Disposed { get; private set; }
|
||||
|
||||
~StringResponseProcessor()
|
||||
{
|
||||
Dispose(false);
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace PepperDash.Essentials.Core
|
||||
}
|
||||
}
|
||||
|
||||
void _gateway_IsReadyEvent(object sender, PepperDash_Essentials_Core.IsReadyEventArgs e)
|
||||
void _gateway_IsReadyEvent(object sender, IsReadyEventArgs e)
|
||||
{
|
||||
if (e.IsReady != true) return;
|
||||
_remote = GetHr1x0WirelessRemote(_config);
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace PepperDash.Essentials.Core
|
||||
|
||||
ScheduledEventGroup FeatureEventGroup;
|
||||
|
||||
public EssentialsRoomBase Room { get; private set; }
|
||||
public IEssentialsRoom Room { get; private set; }
|
||||
|
||||
private Fusion.EssentialsHuddleSpaceFusionSystemControllerBase FusionRoom;
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace PepperDash.Essentials.Core
|
||||
/// </summary>
|
||||
void SetUpDevice()
|
||||
{
|
||||
Room = DeviceManager.GetDeviceForKey(PropertiesConfig.RoomKey) as EssentialsRoomBase;
|
||||
Room = DeviceManager.GetDeviceForKey(PropertiesConfig.RoomKey) as IEssentialsRoom;
|
||||
|
||||
if (Room != null)
|
||||
{
|
||||
@@ -169,10 +169,15 @@ namespace PepperDash.Essentials.Core
|
||||
|
||||
void FeatureEventGroup_UserGroupCallBack(ScheduledEvent SchEvent, ScheduledEventCommon.eCallbackReason type)
|
||||
{
|
||||
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "{0}:{1} @ {2}", SchEvent.Name, type, DateTime.Now);
|
||||
|
||||
if (type == ScheduledEventCommon.eCallbackReason.NormalExpiration)
|
||||
{
|
||||
SchEvent.Acknowledge();
|
||||
|
||||
if (SchEvent.Name == FeatureEnableEventName)
|
||||
{
|
||||
|
||||
if (PropertiesConfig.EnableRoomOnWhenOccupied)
|
||||
FeatureEnabled = true;
|
||||
|
||||
@@ -248,9 +253,8 @@ namespace PepperDash.Essentials.Core
|
||||
schEvent = new ScheduledEvent(name, FeatureEventGroup);
|
||||
|
||||
// Set up its initial properties
|
||||
|
||||
if(!schEvent.Acknowledgeable)
|
||||
schEvent.Acknowledgeable = true;
|
||||
|
||||
schEvent.Acknowledgeable = false;
|
||||
|
||||
if(!schEvent.Persistent)
|
||||
schEvent.Persistent = true;
|
||||
@@ -287,7 +291,7 @@ namespace PepperDash.Essentials.Core
|
||||
|
||||
Debug.Console(1, this, "Event '{0}' Absolute time set to {1}", schEvent.Name, schEvent.DateAndTime.ToString());
|
||||
|
||||
CalculateAndSetAcknowledgeExpirationTimeout(schEvent, FeatureEnabledTime, FeatureDisabledTime);
|
||||
//CalculateAndSetAcknowledgeExpirationTimeout(schEvent, FeatureEnabledTime, FeatureDisabledTime);
|
||||
|
||||
schEvent.Recurrence.Weekly(eventRecurrennce);
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace PepperDash.Essentials.Core
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public abstract class EssentialsRoomBase : ReconfigurableDevice
|
||||
public abstract class EssentialsRoomBase : ReconfigurableDevice, IEssentialsRoom
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
@@ -53,18 +53,22 @@ namespace PepperDash.Essentials.Core
|
||||
/// </summary>
|
||||
///
|
||||
protected string _SourceListKey;
|
||||
public virtual string SourceListKey {
|
||||
public string SourceListKey {
|
||||
get
|
||||
{
|
||||
return _SourceListKey;
|
||||
}
|
||||
set
|
||||
private set
|
||||
{
|
||||
_SourceListKey = value;
|
||||
|
||||
if (value != _SourceListKey)
|
||||
{
|
||||
_SourceListKey = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected const string _defaultSourceListKey = "default";
|
||||
|
||||
/// <summary>
|
||||
/// Timer used for informing the UIs of a shutdown
|
||||
/// </summary>
|
||||
@@ -160,6 +164,22 @@ namespace PepperDash.Essentials.Core
|
||||
return base.CustomActivate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the SourceListKey property to the passed in value or the default if no value passed in
|
||||
/// </summary>
|
||||
/// <param name="sourceListKey"></param>
|
||||
protected void SetSourceListKey(string sourceListKey)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(sourceListKey))
|
||||
{
|
||||
SourceListKey = sourceListKey;
|
||||
}
|
||||
else
|
||||
{
|
||||
sourceListKey = _defaultSourceListKey;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If mobile control is enabled, sets the appropriate properties
|
||||
/// </summary>
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||
using PepperDash.Essentials.Room.Config;
|
||||
using PepperDash.Essentials.Core.Devices;
|
||||
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Describes the basic functionality of an EssentialsRoom
|
||||
/// </summary>
|
||||
public interface IEssentialsRoom : IKeyName, IReconfigurableDevice
|
||||
{
|
||||
BoolFeedback OnFeedback { get; }
|
||||
|
||||
event EventHandler<EventArgs> RoomOccupancyIsSet;
|
||||
|
||||
BoolFeedback IsWarmingUpFeedback { get; }
|
||||
BoolFeedback IsCoolingDownFeedback { get; }
|
||||
|
||||
IOccupancyStatusProvider RoomOccupancy { get; }
|
||||
bool OccupancyStatusProviderIsRemote { get; }
|
||||
|
||||
bool IsMobileControlEnabled { get; }
|
||||
IMobileControlRoomBridge MobileControlRoomBridge { get; }
|
||||
|
||||
string SourceListKey { get; }
|
||||
|
||||
SecondsCountdownTimer ShutdownPromptTimer { get; }
|
||||
int ShutdownPromptSeconds { get; }
|
||||
int ShutdownVacancySeconds { get; }
|
||||
eShutdownType ShutdownType { get; }
|
||||
|
||||
EssentialsRoomEmergencyBase Emergency { get; }
|
||||
|
||||
Core.Privacy.MicrophonePrivacyController MicrophonePrivacy { get; }
|
||||
|
||||
string LogoUrlLightBkgnd { get; }
|
||||
string LogoUrlDarkBkgnd { get; }
|
||||
|
||||
eVacancyMode VacancyMode { get; }
|
||||
|
||||
bool ZeroVolumeWhenSwtichingVolumeDevices { get; }
|
||||
|
||||
void StartShutdown(eShutdownType type);
|
||||
void StartRoomVacancyTimer(eVacancyMode mode);
|
||||
|
||||
void Shutdown();
|
||||
|
||||
void SetRoomOccupancy(IOccupancyStatusProvider statusProvider, int timeoutMinutes);
|
||||
|
||||
void PowerOnToDefaultOrLastSource();
|
||||
bool RunDefaultPresentRoute();
|
||||
|
||||
void SetDefaultLevels();
|
||||
|
||||
void RoomVacatedForTimeoutPeriod(object o);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,6 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
/// <summary>
|
||||
@@ -64,5 +65,7 @@ namespace PepperDash.Essentials.Core
|
||||
{
|
||||
bool RunDefaultCallRoute();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -123,25 +123,34 @@ namespace PepperDash.Essentials.Core
|
||||
// No direct tie? Run back out on the inputs' attached devices...
|
||||
// Only the ones that are routing devices
|
||||
var attachedMidpoints = destDevInputTies.Where(t => t.SourcePort.ParentDevice is IRoutingInputsOutputs);
|
||||
|
||||
//Create a list for tracking already checked devices to avoid loops, if it doesn't already exist from previous iteration
|
||||
if (alreadyCheckedDevices == null)
|
||||
alreadyCheckedDevices = new List<IRoutingInputsOutputs>();
|
||||
alreadyCheckedDevices.Add(destination as IRoutingInputsOutputs);
|
||||
|
||||
foreach (var inputTieToTry in attachedMidpoints)
|
||||
{
|
||||
Debug.Console(2, destination, "Trying to find route on {0}", inputTieToTry.SourcePort.ParentDevice.Key);
|
||||
var upstreamDeviceOutputPort = inputTieToTry.SourcePort;
|
||||
var upstreamRoutingDevice = upstreamDeviceOutputPort.ParentDevice as IRoutingInputsOutputs;
|
||||
Debug.Console(2, destination, "Trying to find route on {0}", upstreamRoutingDevice.Key);
|
||||
|
||||
// Check if this previous device has already been walked
|
||||
if (!(alreadyCheckedDevices != null && alreadyCheckedDevices.Contains(upstreamRoutingDevice)))
|
||||
{
|
||||
// haven't seen this device yet. Do it. Pass the output port to the next
|
||||
// level to enable switching on success
|
||||
var upstreamRoutingSuccess = upstreamRoutingDevice.GetRouteToSource(source, upstreamDeviceOutputPort,
|
||||
alreadyCheckedDevices, signalType, cycle, routeTable);
|
||||
if (upstreamRoutingSuccess)
|
||||
{
|
||||
Debug.Console(2, destination, "Upstream device route found");
|
||||
goodInputPort = inputTieToTry.DestinationPort;
|
||||
break; // Stop looping the inputs in this cycle
|
||||
}
|
||||
}
|
||||
if (alreadyCheckedDevices.Contains(upstreamRoutingDevice))
|
||||
{
|
||||
Debug.Console(2, destination, "Skipping input {0} on {1}, this was already checked", upstreamRoutingDevice.Key, destination.Key);
|
||||
continue;
|
||||
}
|
||||
// haven't seen this device yet. Do it. Pass the output port to the next
|
||||
// level to enable switching on success
|
||||
var upstreamRoutingSuccess = upstreamRoutingDevice.GetRouteToSource(source, upstreamDeviceOutputPort,
|
||||
alreadyCheckedDevices, signalType, cycle, routeTable);
|
||||
if (upstreamRoutingSuccess)
|
||||
{
|
||||
Debug.Console(2, destination, "Upstream device route found");
|
||||
goodInputPort = inputTieToTry.DestinationPort;
|
||||
break; // Stop looping the inputs in this cycle
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,10 +172,6 @@ namespace PepperDash.Essentials.Core
|
||||
//Debug.Console(2, destination, "Exiting cycle {0}", cycle);
|
||||
return true;
|
||||
}
|
||||
|
||||
if(alreadyCheckedDevices == null)
|
||||
alreadyCheckedDevices = new List<IRoutingInputsOutputs>();
|
||||
alreadyCheckedDevices.Add(destination as IRoutingInputsOutputs);
|
||||
|
||||
Debug.Console(2, destination, "No route found to {0}", source.Key);
|
||||
return false;
|
||||
|
||||
@@ -92,6 +92,16 @@ namespace PepperDash.Essentials.Core
|
||||
void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType);
|
||||
}
|
||||
|
||||
public interface IRoutingWithClear : IRouting
|
||||
{
|
||||
/// <summary>
|
||||
/// Clears a route to an output, however a device needs to do that
|
||||
/// </summary>
|
||||
/// <param name="outputSelector">Output to clear</param>
|
||||
/// <param name="signalType">signal type to clear</param>
|
||||
void ClearRoute(object outputSelector, eRoutingSignalType signalType);
|
||||
}
|
||||
|
||||
public interface IRoutingNumeric : IRouting
|
||||
{
|
||||
void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type);
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
using System;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharp.CrestronDataStore;
|
||||
using PepperDash.Core;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
public class CrestronSecretsProvider : ISecretProvider
|
||||
{
|
||||
public string Key { get; set; }
|
||||
//Added for reference
|
||||
private static readonly bool SecureSupported;
|
||||
public CrestronSecretsProvider(string key)
|
||||
{
|
||||
Key = key;
|
||||
}
|
||||
|
||||
static CrestronSecretsProvider()
|
||||
{
|
||||
//Added for future encrypted reference
|
||||
SecureSupported = CrestronSecureStorage.Supported;
|
||||
|
||||
CrestronDataStoreStatic.InitCrestronDataStore();
|
||||
if (SecureSupported)
|
||||
{
|
||||
//doThingsFuture
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set secret for item in the CrestronSecretsProvider
|
||||
/// </summary>
|
||||
/// <param name="key">Secret Key</param>
|
||||
/// <param name="value">Secret Value</param>
|
||||
public bool SetSecret(string key, object value)
|
||||
{
|
||||
var secret = value as string;
|
||||
if (String.IsNullOrEmpty(secret))
|
||||
{
|
||||
Debug.Console(2, this, "Unable to set secret for {0}:{1} - value is empty.", Key, key);
|
||||
return false;
|
||||
}
|
||||
var setErrorCode = CrestronDataStoreStatic.SetLocalStringValue(key, secret);
|
||||
switch (setErrorCode)
|
||||
{
|
||||
case CrestronDataStore.CDS_ERROR.CDS_SUCCESS:
|
||||
Debug.Console(1, this,"Secret Successfully Set for {0}:{1}", Key, key);
|
||||
return true;
|
||||
default:
|
||||
Debug.Console(2, this, Debug.ErrorLogLevel.Notice, "Unable to set secret for {0}:{1} - {2}", Key, key, setErrorCode.ToString());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve secret for item in the CrestronSecretsProvider
|
||||
/// </summary>
|
||||
/// <param name="key">Secret Key</param>
|
||||
/// <returns>ISecret Object containing key, provider, and value</returns>
|
||||
public ISecret GetSecret(string key)
|
||||
{
|
||||
string mySecret;
|
||||
var getErrorCode = CrestronDataStoreStatic.GetLocalStringValue(key, out mySecret);
|
||||
|
||||
switch (getErrorCode)
|
||||
{
|
||||
case CrestronDataStore.CDS_ERROR.CDS_SUCCESS:
|
||||
Debug.Console(2, this, "Secret Successfully retrieved for {0}:{1}", Key, key);
|
||||
return new CrestronSecret(key, mySecret, this);
|
||||
default:
|
||||
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Unable to retrieve secret for {0}:{1} - {2}",
|
||||
Key, key, getErrorCode.ToString());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Special container class for CrestronSecret provider
|
||||
/// </summary>
|
||||
public class CrestronSecret : ISecret
|
||||
{
|
||||
public ISecretProvider Provider { get; private set; }
|
||||
public string Key { get; private set; }
|
||||
|
||||
public object Value { get; private set; }
|
||||
|
||||
public CrestronSecret(string key, string value, ISecretProvider provider)
|
||||
{
|
||||
Key = key;
|
||||
Value = value;
|
||||
Provider = provider;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// All ISecrecretProvider classes must implement this interface.
|
||||
/// </summary>
|
||||
public interface ISecretProvider : IKeyed
|
||||
{
|
||||
bool SetSecret(string key, object value);
|
||||
|
||||
ISecret GetSecret(string key);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// interface for delivering secrets in Essentials.
|
||||
/// </summary>
|
||||
public interface ISecret
|
||||
{
|
||||
ISecretProvider Provider { get; }
|
||||
string Key { get; }
|
||||
object Value { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,281 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Crestron.SimplSharp;
|
||||
using PepperDash.Core;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
public static class SecretsManager
|
||||
{
|
||||
public static Dictionary<string, ISecretProvider> Secrets { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initialize the SecretsManager
|
||||
/// </summary>
|
||||
public static void Initialize()
|
||||
{
|
||||
|
||||
AddSecretProvider("default", new CrestronSecretsProvider("default"));
|
||||
|
||||
CrestronConsole.AddNewConsoleCommand(SetSecretProcess, "setsecret",
|
||||
"Adds secrets to secret provider",
|
||||
ConsoleAccessLevelEnum.AccessOperator);
|
||||
|
||||
CrestronConsole.AddNewConsoleCommand(UpdateSecretProcess, "updatesecret",
|
||||
"Updates secrets in secret provider",
|
||||
ConsoleAccessLevelEnum.AccessAdministrator);
|
||||
|
||||
CrestronConsole.AddNewConsoleCommand(DeleteSecretProcess, "deletesecret",
|
||||
"Deletes secrets in secret provider",
|
||||
ConsoleAccessLevelEnum.AccessAdministrator);
|
||||
}
|
||||
|
||||
static SecretsManager()
|
||||
{
|
||||
Secrets = new Dictionary<string, ISecretProvider>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get Secret Provider from dictionary by key
|
||||
/// </summary>
|
||||
/// <param name="key">Dictionary Key for provider</param>
|
||||
/// <returns>ISecretProvider</returns>
|
||||
public static ISecretProvider GetSecretProviderByKey(string key)
|
||||
{
|
||||
ISecretProvider secret;
|
||||
|
||||
Secrets.TryGetValue(key, out secret);
|
||||
|
||||
if (secret == null)
|
||||
{
|
||||
Debug.Console(1, "SecretsManager unable to retrieve SecretProvider with the key '{0}'", key);
|
||||
}
|
||||
return secret;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add secret provider to secrets dictionary
|
||||
/// </summary>
|
||||
/// <param name="key">Key of new entry</param>
|
||||
/// <param name="provider">New Provider Entry</param>
|
||||
public static void AddSecretProvider(string key, ISecretProvider provider)
|
||||
{
|
||||
if (!Secrets.ContainsKey(key))
|
||||
{
|
||||
Secrets.Add(key, provider);
|
||||
Debug.Console(1, "Secrets provider '{0}' added to SecretsManager", key);
|
||||
}
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Unable to add Provider '{0}' to Secrets. Provider with that key already exists", key );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add secret provider to secrets dictionary, with optional overwrite parameter
|
||||
/// </summary>
|
||||
/// <param name="key">Key of new entry</param>
|
||||
/// <param name="provider">New provider entry</param>
|
||||
/// <param name="overwrite">true to overwrite any existing providers in the dictionary</param>
|
||||
public static void AddSecretProvider(string key, ISecretProvider provider, bool overwrite)
|
||||
{
|
||||
if (!Secrets.ContainsKey(key))
|
||||
{
|
||||
Secrets.Add(key, provider);
|
||||
Debug.Console(1, "Secrets provider '{0}' added to SecretsManager", key);
|
||||
|
||||
}
|
||||
if (overwrite)
|
||||
{
|
||||
Secrets.Add(key, provider);
|
||||
Debug.Console(1, Debug.ErrorLogLevel.Notice, "Provider with the key '{0}' already exists in secrets. Overwriting with new secrets provider.", key);
|
||||
|
||||
}
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Unable to add Provider '{0}' to Secrets. Provider with that key already exists", key);
|
||||
}
|
||||
|
||||
private static void SetSecretProcess(string cmd)
|
||||
{
|
||||
string response;
|
||||
var args = cmd.Split(' ');
|
||||
|
||||
if (args.Length == 0)
|
||||
{
|
||||
//some Instructional Text
|
||||
response = "Adds secrets to secret provider. Format 'setsecret <provider> <secretKey> <secret>";
|
||||
CrestronConsole.ConsoleCommandResponse(response);
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.Length == 1 && args[0] == "?")
|
||||
{
|
||||
response = "Adds secrets to secret provider. Format 'setsecret <provider> <secretKey> <secret>";
|
||||
CrestronConsole.ConsoleCommandResponse(response);
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.Length < 3)
|
||||
{
|
||||
response = "Improper number of arguments";
|
||||
CrestronConsole.ConsoleCommandResponse(response);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
var provider = GetSecretProviderByKey(args[0]);
|
||||
|
||||
if (provider == null)
|
||||
{
|
||||
//someFail
|
||||
response = "Provider key invalid";
|
||||
CrestronConsole.ConsoleCommandResponse(response);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
var key = args[1];
|
||||
var secret = args[2];
|
||||
|
||||
if (provider.GetSecret(key) == null)
|
||||
{
|
||||
|
||||
response = provider.SetSecret(key, secret)
|
||||
? String.Format(
|
||||
"Secret successfully set for {0}:{1}",
|
||||
provider.Key, key)
|
||||
: String.Format(
|
||||
"Unable to set secret for {0}:{1}",
|
||||
provider.Key, key);
|
||||
CrestronConsole.ConsoleCommandResponse(response);
|
||||
return;
|
||||
}
|
||||
response =
|
||||
String.Format(
|
||||
"Unable to set secret for {0}:{1} - Please use the 'UpdateSecret' command to modify it");
|
||||
CrestronConsole.ConsoleCommandResponse(response);
|
||||
}
|
||||
|
||||
private static void UpdateSecretProcess(string cmd)
|
||||
{
|
||||
string response;
|
||||
var args = cmd.Split(' ');
|
||||
|
||||
if (args.Length == 0)
|
||||
{
|
||||
//some Instructional Text
|
||||
response = "Updates secrets in secret provider. Format 'updatesecret <provider> <secretKey> <secret>";
|
||||
CrestronConsole.ConsoleCommandResponse(response);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (args.Length == 1 && args[0] == "?")
|
||||
{
|
||||
response = "Updates secrets in secret provider. Format 'updatesecret <provider> <secretKey> <secret>";
|
||||
CrestronConsole.ConsoleCommandResponse(response);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (args.Length < 3)
|
||||
{
|
||||
//someFail
|
||||
response = "Improper number of arguments";
|
||||
CrestronConsole.ConsoleCommandResponse(response);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
var provider = GetSecretProviderByKey(args[0]);
|
||||
|
||||
if (provider == null)
|
||||
{
|
||||
//someFail
|
||||
response = "Provider key invalid";
|
||||
CrestronConsole.ConsoleCommandResponse(response);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
var key = args[1];
|
||||
var secret = args[2];
|
||||
|
||||
if (provider.GetSecret(key) != null)
|
||||
{
|
||||
response = provider.SetSecret(key, secret)
|
||||
? String.Format(
|
||||
"Secret successfully set for {0}:{1}",
|
||||
provider.Key, key)
|
||||
: String.Format(
|
||||
"Unable to set secret for {0}:{1}",
|
||||
provider.Key, key);
|
||||
CrestronConsole.ConsoleCommandResponse(response);
|
||||
return;
|
||||
}
|
||||
|
||||
response =
|
||||
String.Format(
|
||||
"Unable to update secret for {0}:{1} - Please use the 'SetSecret' command to create a new secret");
|
||||
CrestronConsole.ConsoleCommandResponse(response);
|
||||
}
|
||||
|
||||
private static void DeleteSecretProcess(string cmd)
|
||||
{
|
||||
string response;
|
||||
var args = cmd.Split(' ');
|
||||
|
||||
if (args.Length == 0)
|
||||
{
|
||||
//some Instructional Text
|
||||
response = "Deletes secrets in secret provider. Format 'deletesecret <provider> <secretKey>";
|
||||
CrestronConsole.ConsoleCommandResponse(response);
|
||||
return;
|
||||
|
||||
}
|
||||
if (args.Length == 1 && args[0] == "?")
|
||||
{
|
||||
response = "Deletes secrets in secret provider. Format 'deletesecret <provider> <secretKey>";
|
||||
CrestronConsole.ConsoleCommandResponse(response);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (args.Length < 2)
|
||||
{
|
||||
//someFail
|
||||
response = "Improper number of arguments";
|
||||
CrestronConsole.ConsoleCommandResponse(response);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
var provider = GetSecretProviderByKey(args[0]);
|
||||
|
||||
if (provider == null)
|
||||
{
|
||||
//someFail
|
||||
response = "Provider key invalid";
|
||||
CrestronConsole.ConsoleCommandResponse(response);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
var key = args[1];
|
||||
|
||||
|
||||
provider.SetSecret(key, "");
|
||||
response = provider.SetSecret(key, "")
|
||||
? String.Format(
|
||||
"Secret successfully deleted for {0}:{1}",
|
||||
provider.Key, key)
|
||||
: String.Format(
|
||||
"Unable to delete secret for {0}:{1}",
|
||||
provider.Key, key);
|
||||
CrestronConsole.ConsoleCommandResponse(response);
|
||||
return;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Provide a way to easily deserialize into a secret object from config
|
||||
/// </summary>
|
||||
public class SecretsPropertiesConfig
|
||||
{
|
||||
[JsonProperty("provider")]
|
||||
public string Provider { get; set; }
|
||||
[JsonProperty("key")]
|
||||
public string Key { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@ namespace PepperDash.Essentials.Core
|
||||
public string Key { get; private set; }
|
||||
|
||||
public BoolFeedback IsRunningFeedback { get; private set; }
|
||||
bool _IsRunning;
|
||||
bool _isRunning;
|
||||
|
||||
public IntFeedback PercentFeedback { get; private set; }
|
||||
public StringFeedback TimeRemainingFeedback { get; private set; }
|
||||
@@ -32,7 +32,7 @@ namespace PepperDash.Essentials.Core
|
||||
public DateTime StartTime { get; private set; }
|
||||
public DateTime FinishTime { get; private set; }
|
||||
|
||||
CTimer SecondTimer;
|
||||
private CTimer _secondTimer;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
@@ -41,38 +41,34 @@ namespace PepperDash.Essentials.Core
|
||||
public SecondsCountdownTimer(string key)
|
||||
{
|
||||
Key = key;
|
||||
IsRunningFeedback = new BoolFeedback(() => _IsRunning);
|
||||
IsRunningFeedback = new BoolFeedback(() => _isRunning);
|
||||
|
||||
TimeRemainingFeedback = new StringFeedback(() =>
|
||||
{
|
||||
// Need to handle up and down here.
|
||||
|
||||
if (StartTime == null || FinishTime == null)
|
||||
return "";
|
||||
var timeSpan = FinishTime - DateTime.Now;
|
||||
|
||||
if (timeSpan.TotalSeconds < 60)
|
||||
Debug.Console(2, this,
|
||||
"timeSpan.Minutes == {0}, timeSpan.Seconds == {1}, timeSpan.TotalSeconds == {2}",
|
||||
timeSpan.Minutes, timeSpan.Seconds, timeSpan.TotalSeconds);
|
||||
|
||||
if (Math.Floor(timeSpan.TotalSeconds) < 60 && Math.Floor(timeSpan.TotalSeconds) >= 0) //ignore milliseconds
|
||||
{
|
||||
return Math.Round(timeSpan.TotalSeconds).ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(2, this, "timeSpan.Minutes == {0}, timeSpan.Seconds == {1}", timeSpan.Minutes, timeSpan.Seconds);
|
||||
return String.Format("{0:D2}:{1:D2}",
|
||||
timeSpan.Minutes,
|
||||
timeSpan.Seconds);
|
||||
return String.Format("{0:00}", timeSpan.Seconds);
|
||||
}
|
||||
|
||||
return Math.Floor(timeSpan.TotalSeconds) < 0
|
||||
? "00"
|
||||
: String.Format("{0:00}:{1:00}", timeSpan.Minutes, timeSpan.Seconds);
|
||||
});
|
||||
|
||||
PercentFeedback = new IntFeedback(() =>
|
||||
{
|
||||
if (StartTime == null || FinishTime == null)
|
||||
return 0;
|
||||
double percent = (FinishTime - DateTime.Now).TotalSeconds
|
||||
/ (FinishTime - StartTime).TotalSeconds
|
||||
* 100;
|
||||
return (int)percent;
|
||||
});
|
||||
PercentFeedback =
|
||||
new IntFeedback(
|
||||
() =>
|
||||
(int)
|
||||
(Math.Floor((FinishTime - DateTime.Now).TotalSeconds)/
|
||||
Math.Floor((FinishTime - StartTime).TotalSeconds)*100));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -80,15 +76,15 @@ namespace PepperDash.Essentials.Core
|
||||
/// </summary>
|
||||
public void Start()
|
||||
{
|
||||
if (_IsRunning)
|
||||
if (_isRunning)
|
||||
return;
|
||||
StartTime = DateTime.Now;
|
||||
FinishTime = StartTime + TimeSpan.FromSeconds(SecondsToCount);
|
||||
|
||||
if (SecondTimer != null)
|
||||
SecondTimer.Stop();
|
||||
SecondTimer = new CTimer(SecondElapsedTimerCallback, null, 0, 1000);
|
||||
_IsRunning = true;
|
||||
if (_secondTimer != null)
|
||||
_secondTimer.Stop();
|
||||
_secondTimer = new CTimer(SecondElapsedTimerCallback, null, 0, 1000);
|
||||
_isRunning = true;
|
||||
IsRunningFeedback.FireUpdate();
|
||||
|
||||
var handler = HasStarted;
|
||||
@@ -101,7 +97,7 @@ namespace PepperDash.Essentials.Core
|
||||
/// </summary>
|
||||
public void Reset()
|
||||
{
|
||||
_IsRunning = false;
|
||||
_isRunning = false;
|
||||
Start();
|
||||
}
|
||||
|
||||
@@ -131,19 +127,22 @@ namespace PepperDash.Essentials.Core
|
||||
|
||||
void StopHelper()
|
||||
{
|
||||
if (SecondTimer != null)
|
||||
SecondTimer.Stop();
|
||||
_IsRunning = false;
|
||||
if (_secondTimer != null)
|
||||
_secondTimer.Stop();
|
||||
_isRunning = false;
|
||||
IsRunningFeedback.FireUpdate();
|
||||
}
|
||||
|
||||
void SecondElapsedTimerCallback(object o)
|
||||
{
|
||||
if (DateTime.Now >= FinishTime)
|
||||
{
|
||||
Finish();
|
||||
return;
|
||||
}
|
||||
|
||||
PercentFeedback.FireUpdate();
|
||||
TimeRemainingFeedback.FireUpdate();
|
||||
|
||||
if (DateTime.Now >= FinishTime)
|
||||
Finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
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 Newtonsoft.Json;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.Core.Timers
|
||||
{
|
||||
/// <summary>
|
||||
/// A device that runs a retriggerable timer and can execute actions specified in config
|
||||
/// </summary>
|
||||
[Description("A retriggerable timer device")]
|
||||
public class RetriggerableTimer : EssentialsDevice
|
||||
{
|
||||
private RetriggerableTimerPropertiesConfig _propertiesConfig;
|
||||
|
||||
private CTimer _timer;
|
||||
private long _timerIntervalMs;
|
||||
|
||||
public RetriggerableTimer(string key, DeviceConfig config)
|
||||
: base(key, config.Name)
|
||||
{
|
||||
var props = config.Properties.ToObject<RetriggerableTimerPropertiesConfig>();
|
||||
_propertiesConfig = props;
|
||||
|
||||
if (_propertiesConfig != null)
|
||||
{
|
||||
_timerIntervalMs = _propertiesConfig.TimerIntervalMs;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool CustomActivate()
|
||||
{
|
||||
if (_propertiesConfig.StartTimerOnActivation)
|
||||
{
|
||||
StartTimer();
|
||||
}
|
||||
|
||||
return base.CustomActivate();
|
||||
}
|
||||
|
||||
private void CleanUpTimer()
|
||||
{
|
||||
if (_timer != null)
|
||||
{
|
||||
_timer.Stop();
|
||||
_timer.Dispose();
|
||||
}
|
||||
|
||||
_timer = null;
|
||||
}
|
||||
|
||||
public void StartTimer()
|
||||
{
|
||||
CleanUpTimer();
|
||||
Debug.Console(0, this, "Starting Timer");
|
||||
|
||||
_timer = new CTimer(TimerElapsedCallback, GetActionFromConfig(eRetriggerableTimerEvents.Elapsed), _timerIntervalMs, _timerIntervalMs);
|
||||
}
|
||||
|
||||
public void StopTimer()
|
||||
{
|
||||
Debug.Console(0, this, "Stopping Timer");
|
||||
_timer.Stop();
|
||||
|
||||
ExecuteAction(GetActionFromConfig(eRetriggerableTimerEvents.Stopped));
|
||||
}
|
||||
|
||||
private DeviceActionWrapper GetActionFromConfig(eRetriggerableTimerEvents eventType)
|
||||
{
|
||||
var action = _propertiesConfig.Events[eRetriggerableTimerEvents.Elapsed];
|
||||
|
||||
if (action != null)
|
||||
return action;
|
||||
else return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes the Elapsed action from confing when the timer elapses
|
||||
/// </summary>
|
||||
/// <param name="o"></param>
|
||||
private void TimerElapsedCallback(object action)
|
||||
{
|
||||
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "Timer Elapsed. Executing Action");
|
||||
|
||||
if (action == null)
|
||||
{
|
||||
Debug.Console(1, this, "Timer elapsed but unable to execute action. Action is null.");
|
||||
return;
|
||||
}
|
||||
|
||||
var devAction = action as DeviceActionWrapper;
|
||||
if (devAction != null)
|
||||
ExecuteAction(devAction);
|
||||
else
|
||||
{
|
||||
Debug.Console(2, this, "Unable to cast action as DeviceActionWrapper. Cannot Execute");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void ExecuteAction(DeviceActionWrapper action)
|
||||
{
|
||||
if (action == null)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
DeviceJsonApi.DoDeviceAction(action);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Console(2, this, "Error Executing Action: {0}", e);
|
||||
}
|
||||
//finally // Not sure this is needed
|
||||
//{
|
||||
// _Timer.Reset(0, _TimerIntervalMs);
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Configuration Properties for RetriggerableTimer
|
||||
/// </summary>
|
||||
public class RetriggerableTimerPropertiesConfig
|
||||
{
|
||||
[JsonProperty("startTimerOnActivation")]
|
||||
public bool StartTimerOnActivation { get; set; }
|
||||
|
||||
[JsonProperty("timerIntervalMs")]
|
||||
public long TimerIntervalMs { get; set; }
|
||||
|
||||
[JsonProperty("events")]
|
||||
public Dictionary<eRetriggerableTimerEvents, DeviceActionWrapper> Events { get; set; }
|
||||
|
||||
public RetriggerableTimerPropertiesConfig()
|
||||
{
|
||||
Events = new Dictionary<eRetriggerableTimerEvents, DeviceActionWrapper>();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The set of values describing events on the timer
|
||||
/// </summary>
|
||||
public enum eRetriggerableTimerEvents
|
||||
{
|
||||
Elapsed,
|
||||
Stopped,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Factory class
|
||||
/// </summary>
|
||||
public class RetriggerableTimerFactory : EssentialsDeviceFactory<RetriggerableTimer>
|
||||
{
|
||||
public RetriggerableTimerFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "retriggerabletimer" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new RetriggerableTimer Device");
|
||||
|
||||
return new RetriggerableTimer(dc.Key, dc);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -169,9 +169,9 @@ namespace PepperDash.Essentials.Core.PageManagers
|
||||
}
|
||||
|
||||
// Build presets
|
||||
if (stb.HasPresets && stb.PresetsModel != null)
|
||||
if (stb.HasPresets && stb.TvPresets != null)
|
||||
{
|
||||
PresetsView = new DevicePresetsView(trilist, stb.PresetsModel);
|
||||
PresetsView = new DevicePresetsView(trilist, stb.TvPresets);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user