mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-01-12 03:54:51 +00:00
Compare commits
16 Commits
feature/Ge
...
1.7.2-alph
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c262e7c3c5 | ||
|
|
7404566f72 | ||
|
|
cb49b1f8c8 | ||
|
|
de3f2004de | ||
|
|
0cfc727b08 | ||
|
|
0f8251ea8a | ||
|
|
13cbeb7605 | ||
|
|
2fd2b6787f | ||
|
|
dd48147fdb | ||
|
|
33c3c1ad30 | ||
|
|
f154ce2385 | ||
|
|
9a0cf05360 | ||
|
|
d2e4be162d | ||
|
|
9dbfd9bcae | ||
|
|
8d1ec183df | ||
|
|
d52941d91d |
23
.github/scripts/GenerateVersionNumber-2.0.0.ps1
vendored
Normal file
23
.github/scripts/GenerateVersionNumber-2.0.0.ps1
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
$latestVersion = [version]"2.0.0"
|
||||
|
||||
$newVersion = [version]$latestVersion
|
||||
$phase = ""
|
||||
$newVersionString = ""
|
||||
|
||||
switch -regex ($Env:GITHUB_REF) {
|
||||
'^refs\/pull\/*.' {
|
||||
$phase = 'beta';
|
||||
$newVersionString = "{0}-{1}-{2}" -f $newVersion, $phase, $Env:GITHUB_RUN_NUMBER
|
||||
}
|
||||
'^refs\/heads\/feature-2.0.0\/*.' {
|
||||
$phase = 'alpha'
|
||||
$newVersionString = "{0}-{1}-{2}" -f $newVersion, $phase, $Env:GITHUB_RUN_NUMBER
|
||||
}
|
||||
'development-2.0.0' {
|
||||
$phase = 'beta'
|
||||
$newVersionString = "{0}-{1}-{2}" -f $newVersion, $phase, $Env:GITHUB_RUN_NUMBER
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Write-Output $newVersionString
|
||||
307
.github/workflows/Build Essentials.yml
vendored
Normal file
307
.github/workflows/Build Essentials.yml
vendored
Normal file
@@ -0,0 +1,307 @@
|
||||
name: Build Essentials 2.0.0
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- feature-2.0.0/*
|
||||
pull_request:
|
||||
types:
|
||||
- closed
|
||||
branches:
|
||||
- development-2.0.0
|
||||
|
||||
env:
|
||||
# solution path doesn't need slashes unless there it is multiple folders deep
|
||||
# solution name does not include extension. .sln is assumed
|
||||
SOLUTION_PATH: PepperDashEssentials
|
||||
SOLUTION_FILE: PepperDashEssentials
|
||||
# Do not edit this, we're just creating it here
|
||||
VERSION: 0.0.0-buildtype-buildnumber
|
||||
# Defaults to debug for build type
|
||||
BUILD_TYPE: Debug
|
||||
# Defaults to main as the release branch. Change as necessary
|
||||
RELEASE_BRANCH: main
|
||||
jobs:
|
||||
Build_Project:
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
# First we checkout the source repo
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
# Fetch all tags
|
||||
- name: Fetch tags
|
||||
run: git fetch --tags
|
||||
# Generate the appropriate version number
|
||||
- name: Set Version Number
|
||||
shell: powershell
|
||||
run: |
|
||||
$version = ./.github/scripts/GenerateVersionNumber-2.0.0.ps1
|
||||
echo "VERSION=$version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
||||
# Use the version number to set the version of the assemblies
|
||||
- name: Update AssemblyInfo.cs
|
||||
shell: powershell
|
||||
run: |
|
||||
./.github/scripts/UpdateAssemblyVersion.ps1 ${{ env.VERSION }}
|
||||
- name: restore Nuget Packages
|
||||
run: nuget install .\packages.config -OutputDirectory .\packages -ExcludeVersion
|
||||
# Login to Docker
|
||||
- name: Login to Docker
|
||||
uses: azure/docker-login@v1
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_TOKEN }}
|
||||
# Build the solutions in the docker image
|
||||
- name: Build Solution
|
||||
shell: powershell
|
||||
run: |
|
||||
Invoke-Expression "docker run --rm --mount type=bind,source=""$($Env:GITHUB_WORKSPACE)"",target=""c:/project"" pepperdash/sspbuilder c:\cihelpers\vsidebuild.exe -Solution ""c:\project\$($Env:SOLUTION_FILE).sln"" -BuildSolutionConfiguration $($ENV:BUILD_TYPE)"
|
||||
# Zip up the output files as needed
|
||||
- name: Zip Build Output
|
||||
shell: powershell
|
||||
run: ./.github/scripts/ZipBuildOutput.ps1
|
||||
# Write the version to a file to be consumed by the push jobs
|
||||
- name: Write Version
|
||||
run: Write-Output "$($Env:VERSION)" | Out-File -FilePath "$($Env:GITHUB_HOME)\output\version.txt"
|
||||
# Upload the build output as an artifact
|
||||
- name: Upload Build Output
|
||||
uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: Build
|
||||
path: ./${{ env.SOLUTION_FILE}}-${{ env.VERSION}}.zip
|
||||
# Upload the Version file as an artifact
|
||||
- name: Upload version.txt
|
||||
uses: actions/upload-artifact@v1
|
||||
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 }}
|
||||
release_name: ${{ env.VERSION }}
|
||||
prerelease: ${{contains('debug', env.BUILD_TYPE)}}
|
||||
env:
|
||||
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:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ./${{ env.SOLUTION_FILE}}-${{ env.VERSION}}.zip
|
||||
asset_name: ${{ env.SOLUTION_FILE}}-${{ env.VERSION}}.zip
|
||||
asset_content_type: application/zip
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
Push_Nuget_Package:
|
||||
needs: Build_Project
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Download Build Version Info
|
||||
uses: actions/download-artifact@v1
|
||||
with:
|
||||
name: Version
|
||||
- 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
|
||||
- name: Download Build output
|
||||
uses: actions/download-artifact@v1
|
||||
with:
|
||||
name: Build
|
||||
path: ./
|
||||
- name: Unzip Build file
|
||||
run: |
|
||||
Get-ChildItem .\*.zip | Expand-Archive -DestinationPath .\
|
||||
Remove-Item -Path .\*.zip
|
||||
- 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
|
||||
- name: Add nuget.exe
|
||||
uses: nuget/setup-nuget@v1
|
||||
- name: Add Github Packages source
|
||||
run: nuget sources add -name github -source https://nuget.pkg.github.com/pepperdash/index.json -username Pepperdash -password ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Add nuget.org API Key
|
||||
run: nuget setApiKey ${{ secrets.NUGET_API_KEY }}
|
||||
- name: Create nuget package
|
||||
run: nuget pack "./PepperDash_Essentials_Core.nuspec" -version ${{ env.VERSION }}
|
||||
- name: Publish nuget package to Github registry
|
||||
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 ./
|
||||
@@ -9,6 +9,9 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PepperDashEssentials", "Pep
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PepperDash_Essentials_Core", "essentials-framework\Essentials Core\PepperDashEssentialsBase\PepperDash_Essentials_Core.csproj", "{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{E51D7C84-4906-486C-B2BA-EEB3B4E9731B} = {E51D7C84-4906-486C-B2BA-EEB3B4E9731B}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Essentials Devices Common", "essentials-framework\Essentials Devices Common\Essentials Devices Common\Essentials Devices Common.csproj", "{892B761C-E479-44CE-BD74-243E9214AF13}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
@@ -20,6 +23,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PepperDash_Essentials_DM",
|
||||
{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5} = {A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PepperDash_Essentials_Interfaces", "essentials-framework\Essentials Interfaces\PepperDash_Essentials_Interfaces\PepperDash_Essentials_Interfaces.csproj", "{E51D7C84-4906-486C-B2BA-EEB3B4E9731B}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -42,6 +47,10 @@ Global
|
||||
{9199CE8A-0C9F-4952-8672-3EED798B284F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9199CE8A-0C9F-4952-8672-3EED798B284F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9199CE8A-0C9F-4952-8672-3EED798B284F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E51D7C84-4906-486C-B2BA-EEB3B4E9731B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E51D7C84-4906-486C-B2BA-EEB3B4E9731B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E51D7C84-4906-486C-B2BA-EEB3B4E9731B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E51D7C84-4906-486C-B2BA-EEB3B4E9731B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -16,6 +16,7 @@ using PepperDash.Essentials.Devices.Common;
|
||||
using PepperDash.Essentials.DM;
|
||||
using PepperDash.Essentials.Fusion;
|
||||
using PepperDash.Essentials.Room.Config;
|
||||
using PepperDash.Essentials.Core.Room;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||
@@ -60,6 +61,8 @@ namespace PepperDash.Essentials
|
||||
|
||||
CrestronConsole.AddNewConsoleCommand(PepperDash.Essentials.Core.DeviceFactory.GetDeviceFactoryTypes, "gettypes", "Gets the device types that can be built. Accepts a filter string.", ConsoleAccessLevelEnum.AccessOperator);
|
||||
|
||||
CrestronConsole.AddNewConsoleCommand(PepperDash.Essentials.Core.Room.Components.ComponentFactory.GetComponentFactoryTypes, "getcomponenttypes", "Gets the components types that can be built. Accepts a filter string.", ConsoleAccessLevelEnum.AccessOperator);
|
||||
|
||||
CrestronConsole.AddNewConsoleCommand(BridgeHelper.PrintJoinMap, "getjoinmap", "map(s) for bridge or device on bridge [brKey [devKey]]", ConsoleAccessLevelEnum.AccessOperator);
|
||||
|
||||
CrestronConsole.AddNewConsoleCommand(s =>
|
||||
@@ -428,12 +431,21 @@ namespace PepperDash.Essentials
|
||||
|
||||
foreach (var roomConfig in ConfigReader.ConfigObject.Rooms)
|
||||
{
|
||||
var room = EssentialsRoomConfigHelper.GetRoomObject(roomConfig) as EssentialsRoomBase;
|
||||
if (room != null)
|
||||
Device room = null;
|
||||
|
||||
if (roomConfig.Type != "componentRoom")
|
||||
{
|
||||
room = EssentialsRoomConfigHelper.GetRoomObject(roomConfig) as EssentialsRoomBase;
|
||||
}
|
||||
else
|
||||
{
|
||||
room = new ComponentRoom(roomConfig);
|
||||
}
|
||||
|
||||
if (room != null && room is EssentialsRoomBase)
|
||||
{
|
||||
if (room is EssentialsHuddleSpaceRoom)
|
||||
{
|
||||
DeviceManager.AddDevice(room);
|
||||
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Room is EssentialsHuddleSpaceRoom, attempting to add to DeviceManager with Fusion");
|
||||
DeviceManager.AddDevice(new Core.Fusion.EssentialsHuddleSpaceFusionSystemControllerBase((EssentialsHuddleSpaceRoom)room, 0xf1));
|
||||
@@ -441,25 +453,26 @@ namespace PepperDash.Essentials
|
||||
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Mobile Control Bridge...");
|
||||
|
||||
CreateMobileControlBridge(room);
|
||||
CreateMobileControlBridge(room as EssentialsRoomBase);
|
||||
}
|
||||
else if (room is EssentialsHuddleVtc1Room)
|
||||
{
|
||||
DeviceManager.AddDevice(room);
|
||||
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Room is EssentialsHuddleVtc1Room, attempting to add to DeviceManager with Fusion");
|
||||
DeviceManager.AddDevice(new EssentialsHuddleVtc1FusionController((EssentialsHuddleVtc1Room)room, 0xf1));
|
||||
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Mobile Control Bridge...");
|
||||
|
||||
CreateMobileControlBridge(room);
|
||||
CreateMobileControlBridge(room as EssentialsRoomBase);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Room is NOT EssentialsRoom, attempting to add to DeviceManager w/o Fusion");
|
||||
DeviceManager.AddDevice(room);
|
||||
}
|
||||
|
||||
}
|
||||
else if (room != null)
|
||||
{
|
||||
DeviceManager.AddDevice(room);
|
||||
}
|
||||
else
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Notice: Cannot create room from config, key '{0}' - Is this intentional? This may be a valid configuration.", roomConfig.Key);
|
||||
@@ -558,7 +571,7 @@ namespace PepperDash.Essentials
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Console(1, Debug.ErrorLogLevel.Notice, "Unable to find logo information in any room config");
|
||||
Debug.Console(1, Debug.ErrorLogLevel.Notice, "Unable to find logo information in any room config: {0}", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<ProjectGuid>{1BED5BA9-88C4-4365-9362-6F4B128071D3}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>PepperDashEssentials</RootNamespace>
|
||||
<RootNamespace>PepperDash.Essentials</RootNamespace>
|
||||
<AssemblyName>PepperDashEssentials</AssemblyName>
|
||||
<ProjectTypeGuids>{0B4745B0-194B-4BB6-8E21-E9057CA92230};{4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<PlatformFamilyName>WindowsCE</PlatformFamilyName>
|
||||
@@ -215,6 +215,10 @@
|
||||
<Project>{9199CE8A-0C9F-4952-8672-3EED798B284F}</Project>
|
||||
<Name>PepperDash_Essentials_DM</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\essentials-framework\Essentials Interfaces\PepperDash_Essentials_Interfaces\PepperDash_Essentials_Interfaces.csproj">
|
||||
<Project>{E51D7C84-4906-486C-B2BA-EEB3B4E9731B}</Project>
|
||||
<Name>PepperDash_Essentials_Interfaces</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" />
|
||||
<ProjectExtensions>
|
||||
|
||||
@@ -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 @@
|
||||
<ProjectGuid>{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>PepperDash_Essentials_Core</RootNamespace>
|
||||
<RootNamespace>PepperDash.Essentials.Core</RootNamespace>
|
||||
<AssemblyName>PepperDash_Essentials_Core</AssemblyName>
|
||||
<ProjectTypeGuids>{0B4745B0-194B-4BB6-8E21-E9057CA92300};{4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<PlatformFamilyName>WindowsCE</PlatformFamilyName>
|
||||
@@ -277,9 +277,13 @@
|
||||
<Compile Include="Remotes\CrestronRemotePropertiesConfig.cs" />
|
||||
<Compile Include="Remotes\Hrxx0WirelessRemoteController.cs" />
|
||||
<Compile Include="Room\Behaviours\RoomOnToDefaultSourceWhenOccupied.cs" />
|
||||
<Compile Include="Room\Components\ComponentFactory.cs" />
|
||||
<Compile Include="Room\Components\ComponentRoom.cs" />
|
||||
<Compile Include="Room\Components\RoomComponentBase.cs" />
|
||||
<Compile Include="Room\EssentialsRoomBase.cs" />
|
||||
<Compile Include="Room\Interfaces.cs" />
|
||||
<Compile Include="Room\iOccupancyStatusProvider.cs" />
|
||||
<Compile Include="Room\RoomFactory.cs" />
|
||||
<Compile Include="Routing\DummyRoutingInputsDevice.cs" />
|
||||
<Compile Include="Routing\ICardPortsDevice.cs" />
|
||||
<Compile Include="InUseTracking\IInUseTracking.cs" />
|
||||
@@ -350,6 +354,12 @@
|
||||
<None Include="app.config" />
|
||||
<None Include="Properties\ControlSystem.cfg" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Essentials Interfaces\PepperDash_Essentials_Interfaces\PepperDash_Essentials_Interfaces.csproj">
|
||||
<Project>{E51D7C84-4906-486C-B2BA-EEB3B4E9731B}</Project>
|
||||
<Name>PepperDash_Essentials_Interfaces</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" />
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
|
||||
@@ -0,0 +1,195 @@
|
||||
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.Interfaces.Components;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Room.Components
|
||||
{
|
||||
public class ComponentFactoryWrapper
|
||||
{
|
||||
public CType CType { get; set; }
|
||||
public string Description { get; set; }
|
||||
public Func<RoomComponentConfig, IKeyed> FactoryMethod { get; set; }
|
||||
|
||||
public ComponentFactoryWrapper()
|
||||
{
|
||||
CType = null;
|
||||
Description = "Not Available";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines a class that is capable of loading component types
|
||||
/// </summary>
|
||||
public interface IComponentFactory : IDeviceFactory
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public static class ComponentFactory
|
||||
{
|
||||
static ComponentFactory()
|
||||
{
|
||||
var assy = Assembly.GetExecutingAssembly();
|
||||
PluginLoader.SetEssentialsAssembly(assy.GetName().Name, assy);
|
||||
|
||||
var types = assy.GetTypes().Where(ct => typeof(IComponentFactory).IsAssignableFrom(ct) && !ct.IsInterface && !ct.IsAbstract);
|
||||
|
||||
if (types != null)
|
||||
{
|
||||
foreach (var type in types)
|
||||
{
|
||||
try
|
||||
{
|
||||
var factory = (IComponentFactory)Crestron.SimplSharp.Reflection.Activator.CreateInstance(type);
|
||||
factory.LoadTypeFactories();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Error, "Unable to load type: '{1}' ComponentFactory: {0}", e, type.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A dictionary of factory methods, keyed by config types, added by plugins.
|
||||
/// These methods are looked up and called by GetDevice in this class.
|
||||
/// </summary>
|
||||
static Dictionary<string, ComponentFactoryWrapper> FactoryMethods =
|
||||
new Dictionary<string, ComponentFactoryWrapper>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
/// <summary>
|
||||
/// Adds a plugin factory method
|
||||
/// </summary>
|
||||
/// <param name="dc"></param>
|
||||
/// <returns></returns>
|
||||
public static void AddFactoryForType(string typeName, Func<RoomComponentConfig, IKeyed> method)
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Adding factory method for type '{0}'", typeName);
|
||||
ComponentFactory.FactoryMethods.Add(typeName, new ComponentFactoryWrapper() { FactoryMethod = method });
|
||||
}
|
||||
|
||||
public static void AddFactoryForType(string typeName, string description, CType cType, Func<RoomComponentConfig, IKeyed> method)
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Adding factory method for type '{0}'", typeName);
|
||||
|
||||
if (FactoryMethods.ContainsKey(typeName))
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Error, "Unable to add type: '{0}'. Already exists in ComponentFactory", typeName);
|
||||
return;
|
||||
}
|
||||
|
||||
var wrapper = new ComponentFactoryWrapper() { CType = cType, Description = description, FactoryMethod = method };
|
||||
ComponentFactory.FactoryMethods.Add(typeName, wrapper);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The factory method for Core components. Also iterates the Factory methods that have
|
||||
/// been loaded from plugins
|
||||
/// </summary>
|
||||
/// <param name="dc"></param>
|
||||
/// <returns></returns>
|
||||
public static IKeyed GetComponent(RoomComponentConfig 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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Prints the type names and associated metadata from the FactoryMethods collection.
|
||||
/// </summary>
|
||||
/// <param name="command"></param>
|
||||
public static void GetComponentFactoryTypes(string filter)
|
||||
{
|
||||
Dictionary<string, ComponentFactoryWrapper> types = new Dictionary<string, ComponentFactoryWrapper>();
|
||||
|
||||
if (!string.IsNullOrEmpty(filter))
|
||||
{
|
||||
types = FactoryMethods.Where(k => k.Key.Contains(filter)).ToDictionary(k => k.Key, k => k.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
types = FactoryMethods;
|
||||
}
|
||||
|
||||
Debug.Console(0, "Component Types:");
|
||||
|
||||
foreach (var type in types.OrderBy(t => t.Key))
|
||||
{
|
||||
var description = type.Value.Description;
|
||||
var cType = "Not Specified by Plugin";
|
||||
|
||||
if (type.Value.CType != null)
|
||||
{
|
||||
cType = type.Value.CType.FullName;
|
||||
}
|
||||
|
||||
Debug.Console(0,
|
||||
@"Type: '{0}'
|
||||
CType: '{1}'
|
||||
Description: {2}", type.Key, cType, description);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Devices the basic needs for a Device Factory
|
||||
/// </summary>
|
||||
public abstract class EssentialsComponentFactory<T> : IComponentFactory where T : IComponent
|
||||
{
|
||||
#region IComponentFactory 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 ComponentFactory.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[];
|
||||
ComponentFactory.AddFactoryForType(typeName.ToLower(), description, typeof(T), BuildComponent);
|
||||
}
|
||||
}
|
||||
|
||||
/// <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 IComponent BuildComponent(RoomComponentConfig dc);
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Interfaces.Components;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.Core.Devices;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Room
|
||||
{
|
||||
/// <summary>
|
||||
/// The base config class for various component types
|
||||
/// </summary>
|
||||
public abstract class RoomComponentConfig : DeviceConfig
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The config class for an activiry
|
||||
/// </summary>
|
||||
public class RoomActivityConfig : RoomComponentConfig
|
||||
{
|
||||
[JsonProperty("label")]
|
||||
public string Label { get; set; }
|
||||
[JsonProperty("icon")]
|
||||
public string Icon { get; set; }
|
||||
[JsonProperty("componentKey")]
|
||||
public string ComponentKey { get; set; }
|
||||
[JsonProperty("order")]
|
||||
public int Order { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The config class for a room behaviour
|
||||
/// </summary>
|
||||
public class RoomBehaviourConfig : RoomComponentConfig
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The config class for a device behavior
|
||||
/// </summary>
|
||||
public class RoomDeviceBehaviourConfig : RoomComponentConfig
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The config class for a ComponentRoom
|
||||
/// </summary>
|
||||
public class ComponentRoomPropertiesConfig
|
||||
{
|
||||
[JsonProperty("activities")]
|
||||
public List<RoomActivityConfig> Activities { get; set; }
|
||||
[JsonProperty("components")]
|
||||
public List<RoomComponentConfig> Components { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A room comprised of component parts built at runtime.
|
||||
/// </summary>
|
||||
public class ComponentRoom : ReconfigurableDevice, IComponentRoom
|
||||
{
|
||||
public ComponentRoomPropertiesConfig PropertiesConfig { get; private set; }
|
||||
|
||||
public List<IRoomComponent> Components { get; private set; }
|
||||
public List<IRoomActivityComponent> Activities { get; private set; }
|
||||
|
||||
public ComponentRoom(DeviceConfig config)
|
||||
: base(config)
|
||||
{
|
||||
try
|
||||
{
|
||||
PropertiesConfig = JsonConvert.DeserializeObject<ComponentRoomPropertiesConfig>
|
||||
(config.Properties.ToString());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Console(1, this, "Error building ComponentRoom: \n{0}", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public List<IRoomComponent> GetRoomComponentsOfType(Type componentType)
|
||||
{
|
||||
// TODO: Figure this out later
|
||||
return Components;
|
||||
//var results = Components.OfType<componentType>();
|
||||
//return results;
|
||||
//return Components.Where(c => c != null && type.IsAssignableFrom(c.GetType()));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of the activies sorted by order
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<IRoomActivityComponent> GetOrderedActvities()
|
||||
{
|
||||
return Activities.OrderBy(a => a.Order).ToList<IRoomActivityComponent>();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using PepperDash.Essentials.Interfaces.Components;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Room.Components
|
||||
{
|
||||
/// <summary>
|
||||
/// The base class from which Room Components should be derived
|
||||
/// </summary>
|
||||
public abstract class RoomComponentBase : IRoomComponent
|
||||
{
|
||||
private string _componentKey;
|
||||
|
||||
/// <summary>
|
||||
/// The key of the component, which is composed of the parent room key, plus the specific component key
|
||||
/// </summary>
|
||||
public string Key {
|
||||
get
|
||||
{
|
||||
return Parent.Key + "-" + _componentKey;
|
||||
}
|
||||
}
|
||||
|
||||
public IComponentRoom Parent { get; private set; }
|
||||
|
||||
public RoomComponentBase(string key, IComponentRoom parent)
|
||||
{
|
||||
_componentKey = key;
|
||||
Parent = parent;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -12,45 +12,45 @@ namespace PepperDash.Essentials.Core
|
||||
{
|
||||
//***************************************************************************************************
|
||||
|
||||
public abstract class Room : Device, IHasFeedback
|
||||
{
|
||||
public abstract BoolFeedback RoomIsOnFeedback { get; protected set; }
|
||||
public abstract BoolFeedback IsCoolingDownFeedback { get; protected set; }
|
||||
public abstract BoolFeedback IsWarmingUpFeedback { get; protected set; }
|
||||
// public abstract class Room : Device, IHasFeedback
|
||||
// {
|
||||
// public abstract BoolFeedback RoomIsOnFeedback { get; protected set; }
|
||||
// public abstract BoolFeedback IsCoolingDownFeedback { get; protected set; }
|
||||
// public abstract BoolFeedback IsWarmingUpFeedback { get; protected set; }
|
||||
|
||||
// In concrete classes, these should be computed from the relevant devices
|
||||
public virtual uint CooldownTime { get { return 10000; } }
|
||||
public virtual uint WarmupTime { get { return 5000; } }
|
||||
// // In concrete classes, these should be computed from the relevant devices
|
||||
// public virtual uint CooldownTime { get { return 10000; } }
|
||||
// public virtual uint WarmupTime { get { return 5000; } }
|
||||
|
||||
public string Description { get; set; }
|
||||
public string HelpMessage { get; set; }
|
||||
// public string Description { get; set; }
|
||||
// public string HelpMessage { get; set; }
|
||||
|
||||
public Room(string key, string name)
|
||||
: base(key, name)
|
||||
{
|
||||
Description = "";
|
||||
HelpMessage = "";
|
||||
}
|
||||
// public Room(string key, string name)
|
||||
// : base(key, name)
|
||||
// {
|
||||
// Description = "";
|
||||
// HelpMessage = "";
|
||||
// }
|
||||
|
||||
public virtual void RoomOn() { }
|
||||
// public virtual void RoomOn() { }
|
||||
|
||||
public virtual void RoomOff() { }
|
||||
// public virtual void RoomOff() { }
|
||||
|
||||
#region IDeviceWithOutputs Members
|
||||
// #region IDeviceWithOutputs Members
|
||||
|
||||
public virtual FeedbackCollection<Feedback> Feedbacks
|
||||
{
|
||||
get
|
||||
{
|
||||
return new FeedbackCollection<Feedback>
|
||||
{
|
||||
RoomIsOnFeedback,
|
||||
IsCoolingDownFeedback,
|
||||
IsWarmingUpFeedback
|
||||
};
|
||||
}
|
||||
}
|
||||
// public virtual FeedbackCollection<Feedback> Feedbacks
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// return new FeedbackCollection<Feedback>
|
||||
// {
|
||||
// RoomIsOnFeedback,
|
||||
// IsCoolingDownFeedback,
|
||||
// IsWarmingUpFeedback
|
||||
// };
|
||||
// }
|
||||
// }
|
||||
|
||||
#endregion
|
||||
}
|
||||
// #endregion
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using PepperDash.Essentials.Interfaces.Components;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Room
|
||||
{
|
||||
/// <summary>
|
||||
/// The class that constructs rooms
|
||||
/// </summary>
|
||||
public static class RoomFactory
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -154,6 +154,10 @@
|
||||
<Project>{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}</Project>
|
||||
<Name>PepperDash_Essentials_Core</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Essentials Interfaces\PepperDash_Essentials_Interfaces\PepperDash_Essentials_Interfaces.csproj">
|
||||
<Project>{E51D7C84-4906-486C-B2BA-EEB3B4E9731B}</Project>
|
||||
<Name>PepperDash_Essentials_Interfaces</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" />
|
||||
<ProjectExtensions>
|
||||
|
||||
@@ -184,6 +184,10 @@
|
||||
<Project>{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}</Project>
|
||||
<Name>PepperDash_Essentials_Core</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Essentials Interfaces\PepperDash_Essentials_Interfaces\PepperDash_Essentials_Interfaces.csproj">
|
||||
<Project>{E51D7C84-4906-486C-B2BA-EEB3B4E9731B}</Project>
|
||||
<Name>PepperDash_Essentials_Interfaces</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" />
|
||||
<ProjectExtensions>
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Interfaces.Components
|
||||
{
|
||||
/// <summary>
|
||||
/// Describes a room comprised of components
|
||||
/// </summary>
|
||||
public interface IComponentRoom : IKeyed
|
||||
{
|
||||
List<IRoomComponent> Components { get; }
|
||||
List<IRoomActivityComponent> Activities { get; }
|
||||
|
||||
List<IRoomComponent> GetRoomComponentsOfType(Type type);
|
||||
List<IRoomActivityComponent> GetOrderedActvities();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Describes a component
|
||||
/// </summary>
|
||||
public interface IComponent : IKeyed
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Describes a room component
|
||||
/// </summary>
|
||||
public interface IRoomComponent : IComponent
|
||||
{
|
||||
IComponentRoom Parent { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Describes a room activity component
|
||||
/// </summary>
|
||||
public interface IRoomActivityComponent : IRoomComponent
|
||||
{
|
||||
string Label { get; }
|
||||
string Icon { get; }
|
||||
IRoomComponent Component { get; }
|
||||
int Order { get; }
|
||||
|
||||
void StartActivity();
|
||||
void EndActivity();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Describes a room component that can be "used" by a user
|
||||
/// </summary>
|
||||
public interface IUsableRoomComponent
|
||||
{
|
||||
bool InUse { get; }
|
||||
|
||||
void StartUse();
|
||||
void EndUse();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Describes a room behaviour component
|
||||
/// </summary>
|
||||
public interface IRoomBehaviourComponent : IUsableRoomComponent
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Describes a room device component
|
||||
/// </summary>
|
||||
public interface IRoomDeviceComponent : IUsableRoomComponent
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{E51D7C84-4906-486C-B2BA-EEB3B4E9731B}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>PepperDash.Essentials.Interfaces</RootNamespace>
|
||||
<AssemblyName>PepperDash_Essentials_Interfaces</AssemblyName>
|
||||
<ProjectTypeGuids>{0B4745B0-194B-4BB6-8E21-E9057CA92500};{4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<PlatformFamilyName>WindowsCE</PlatformFamilyName>
|
||||
<PlatformID>E2BECB1F-8C8C-41ba-B736-9BE7D946A398</PlatformID>
|
||||
<OSVersion>5.0</OSVersion>
|
||||
<DeployDirSuffix>SmartDeviceProject1</DeployDirSuffix>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<NativePlatformName>Windows CE</NativePlatformName>
|
||||
<FormFactorID>
|
||||
</FormFactorID>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<AllowedReferenceRelatedFileExtensions>.allowedReferenceRelatedFileExtensions</AllowedReferenceRelatedFileExtensions>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<NoStdLib>true</NoStdLib>
|
||||
<NoConfig>true</NoConfig>
|
||||
<GenerateSerializationAssemblies>off</GenerateSerializationAssemblies>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<AllowedReferenceRelatedFileExtensions>.allowedReferenceRelatedFileExtensions</AllowedReferenceRelatedFileExtensions>
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<NoStdLib>true</NoStdLib>
|
||||
<NoConfig>true</NoConfig>
|
||||
<GenerateSerializationAssemblies>off</GenerateSerializationAssemblies>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="mscorlib" />
|
||||
<Reference Include="PepperDash_Core, Version=1.0.43.36276, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\packages\PepperDashCore\lib\net35\PepperDash_Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SimplSharpCustomAttributesInterface, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpCustomAttributesInterface.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SimplSharpHelperInterface, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpHelperInterface.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Data" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Components\RoomComponents.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<None Include="Properties\ControlSystem.cfg" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>rem S# preparation will execute after these operations</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,8 @@
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: AssemblyTitle("PepperDash_Essentials_Interfaces")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("PepperDash_Essentials_Interfaces")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2020")]
|
||||
[assembly: AssemblyVersion("1.0.0.*")]
|
||||
|
||||
Reference in New Issue
Block a user