Compare commits

...

25 Commits

Author SHA1 Message Date
Neil Dorin
97a9f319c3 Fixed access modifiers in interface 2021-02-03 14:10:08 -07:00
Neil Dorin
46ec92cb13 Adds sub interfaces to capture EssentialsRoomBase 2021-02-03 14:08:00 -07:00
Neil Dorin
7a426ebc3a Updates factory method signature to take parent room as parameter. Adds methods to build components in ComponentRoom constructor 2021-02-01 14:20:57 -07:00
Neil Dorin
f0299729e6 Progress on abstract base classes and interfaces 2021-01-29 17:19:59 -07:00
Neil Dorin
657b9f1f54 Adds summary help and Room ActivityComponentBase 2021-01-28 18:08:06 -07:00
Neil Dorin
76a8b50b6f Updates GetComponetsofType generic 2021-01-28 17:46:12 -07:00
Neil Dorin
bee73edbe1 progress on component room classes and interfaces 2021-01-28 13:36:59 -07:00
Neil Dorin
fb97cf4753 Merge branch 'development' into feature/add-component-room 2021-01-27 14:05:28 -07:00
Neil Dorin
3fd84d1fac Removes EssentialsInterfaces library and moves interfaces to Essentials Core 2021-01-27 13:53:06 -07:00
Neil Dorin
c262e7c3c5 minor fixes to allow build to succeed. 2021-01-19 17:04:06 -07:00
Neil Dorin
7404566f72 Adds ComponentFactory 2021-01-19 17:00:52 -07:00
Neil Dorin
cb49b1f8c8 Interfaces added and some base classes built 2020-11-27 18:05:14 -07:00
Andrew Welker
de3f2004de Merge pull request #516 from PepperDash/feature-2.0.0/add-new-project
Add PepperDash_Essentials_Interfaces project
2020-11-25 10:30:16 -07:00
Andrew Welker
0cfc727b08 Fix root namespaces 2020-11-25 09:57:09 -07:00
Andrew Welker
0f8251ea8a update dependencies, references, and build order 2020-11-24 17:06:03 -07:00
Andrew Welker
13cbeb7605 Add PepperDash_Essentials_Interfaces project 2020-11-24 16:43:24 -07:00
Andrew Welker
2fd2b6787f Merge pull request #515 from PepperDash/feature-2.0.0/update-workflows-for-2.0.0
fix regex
2020-11-24 16:41:24 -07:00
Andrew Welker
dd48147fdb fix regex 2020-11-24 16:26:07 -07:00
Andrew Welker
33c3c1ad30 Merge pull request #511 from PepperDash/feature-2.0.0/update-workflows-for-2.0.0
fix branch name for PR-triggered workflows
2020-11-24 15:09:55 -07:00
Andrew Welker
f154ce2385 fix branch name for PR-triggered workflows 2020-11-24 14:32:21 -07:00
Trevor Payne
9a0cf05360 Merge pull request #509 from PepperDash/feature-2.0.0/update-workflows-for-2.0.0
Feature 2.0.0/update workflows for 2.0.0
2020-11-24 15:29:32 -06:00
Andrew Welker
d2e4be162d change phase for PR triggered builds to beta 2020-11-24 13:43:07 -07:00
Andrew Welker
9dbfd9bcae Change workflow name 2020-11-24 13:25:02 -07:00
Andrew Welker
8d1ec183df fix string formatting 2020-11-24 13:17:10 -07:00
Andrew Welker
d52941d91d add workflow for 2.0.0 builds 2020-11-24 13:14:07 -07:00
18 changed files with 1259 additions and 164 deletions

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

View File

@@ -17,6 +17,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;
@@ -61,6 +62,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 =>
@@ -429,8 +432,18 @@ 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.ToLower() != "componentroom")
{
room = EssentialsRoomConfigHelper.GetRoomObject(roomConfig) as EssentialsRoomBase;
}
else
{
room = new ComponentRoom(roomConfig);
}
if (room != null && room is EssentialsRoomBase)
{
// default IPID
uint fusionIpId = 0xf1;
@@ -438,11 +451,14 @@ namespace PepperDash.Essentials
// default to no join map key
string fusionJoinMapKey = string.Empty;
if (room.Config.Properties["fusion"] != null)
var essRoom = room as EssentialsRoomBase;
if (essRoom.Config.Properties["fusion"] != null)
{
Debug.Console(2, "Custom Fusion config found. Using custom values");
var fusionConfig = room.Config.Properties["fusion"].ToObject<EssentialsRoomFusionConfig>();
var fusionConfig = essRoom.Config.Properties["fusion"].ToObject<EssentialsRoomFusionConfig>();
if (fusionConfig != null)
{
@@ -453,26 +469,24 @@ namespace PepperDash.Essentials
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(room, fusionIpId, fusionJoinMapKey));
DeviceManager.AddDevice(new Core.Fusion.EssentialsHuddleSpaceFusionSystemControllerBase(essRoom, fusionIpId, fusionJoinMapKey));
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, fusionIpId, fusionJoinMapKey));
DeviceManager.AddDevice(new EssentialsHuddleVtc1FusionController((EssentialsHuddleVtc1Room)essRoom, fusionIpId, fusionJoinMapKey));
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Mobile Control Bridge...");
CreateMobileControlBridge(room);
CreateMobileControlBridge(room as EssentialsRoomBase);
}
else if (room is EssentialsTechRoom)
{
@@ -480,18 +494,20 @@ namespace PepperDash.Essentials
Debug.Console(0, Debug.ErrorLogLevel.Notice,
"Room is EssentialsTechRoom, Attempting to add to DeviceManager with Fusion");
DeviceManager.AddDevice(new EssentialsTechRoomFusionSystemController((EssentialsTechRoom)room, fusionIpId, fusionJoinMapKey));
DeviceManager.AddDevice(new EssentialsTechRoomFusionSystemController((EssentialsTechRoom)essRoom, fusionIpId, fusionJoinMapKey));
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Mobile Control Bridge");
CreateMobileControlBridge(room);
CreateMobileControlBridge(essRoom);
}
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);
@@ -588,9 +604,9 @@ namespace PepperDash.Essentials
return ((logoDark != null && logoDark == "system") ||
(logoLight != null && logoLight == "system") || (logo != null && logo == "system"));
}
catch
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;
}
}

View File

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

View File

@@ -246,8 +246,11 @@ namespace PepperDash.Essentials.Core
public class DeviceActionWrapper
{
[JsonProperty("deviceKey")]
public string DeviceKey { get; set; }
[JsonProperty("methodName")]
public string MethodName { get; set; }
[JsonProperty("params")]
public object[] Params { get; set; }
}

View File

@@ -1,113 +1,116 @@
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>
/// Defines the basic needs for a Device Factory
/// </summary>
public abstract class EssentialsDeviceFactory<T> : IDeviceFactory where T:EssentialsDevice
{
/// <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; }
#region IDeviceFactory Members
/// <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);
}
}
#endregion
/// <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);
}
/// <summary>
/// Defines 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; }
}
}

View File

@@ -16,7 +16,7 @@ namespace PepperDash.Essentials.Core
public interface IDeviceFactory
{
/// <summary>
/// Loads all the types to the DeviceFactory
/// Loads all the types to the Factory
/// </summary>
void LoadTypeFactories();
}

View File

@@ -0,0 +1,135 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Core;
namespace PepperDash.Essentials.Core.Interfaces.Components
{
/// <summary>
/// Describes a room comprised of components
/// </summary>
public interface IComponentRoom : IKeyed
{
List<IActivatableComponent> Components { get; }
List<IRoomActivityComponent> Activities { get; }
List<T> GetComponentsOfType<T>() where T : IActivatableComponent;
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
{
/// <summary>
/// Indicates if the component is enabled
/// </summary>
BoolFeedback IsEnabledFeedback { get; }
/// <summary>
/// Set this value to enable or disable the component
/// </summary>
bool Enable { set; }
/// <summary>
/// Label to be displayed for the activity on the UI
/// </summary>
string Label { get; }
/// <summary>
/// Icon to be displayed for the activity on the UI
/// </summary>
string Icon { get; }
/// <summary>
/// The component group that will be activated when this activty starts
/// </summary>
IRoomBehaviourGroupComponent Component { get; }
/// <summary>
/// Determines the order the activities will be displayed on the UI
/// </summary>
int Order { get; }
/// <summary>
/// Starts the activity
/// </summary>
void StartActivity();
/// <summary>
/// Ends the activity
/// </summary>
void EndActivity();
}
/// <summary>
/// Describes a room component that can be "activated"
/// </summary>
public interface IActivatableComponent : IRoomComponent
{
/// <summary>
/// Indicates if the component is activated
/// </summary>
BoolFeedback ActivatedFeedback { get; }
/// <summary>
/// Activates the component
/// </summary>
void Activate();
/// <summary>
/// Dactivates the component
/// </summary>
void Deactivate();
}
/// <summary>
/// Describes a group of room behaviour component. Is able to contain a collection of components that aggregate
/// together to behave as one
/// </summary>
public interface IRoomBehaviourGroupComponent : IRoomComponent
{
/// <summary>
/// A collection of components that work together to achieve a common behaviour
/// </summary>
List<IActivatableComponent> Components { get; }
void ActivateComponents();
void DeactivateComponents();
}
/// <summary>
/// Describes an individual room behaviour component
/// </summary>
public interface IRoomBehaviourComponent : IActivatableComponent
{
}
/// <summary>
/// Describes a room device component behaviour
/// </summary>
public interface IDeviceBehaviourComponent<T> : IActivatableComponent where T : EssentialsDevice
{
/// <summary>
/// The device this component applies behaviour to
/// </summary>
T Device { get; }
}
}

View File

@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
namespace PepperDash.Essentials.Core.Interfaces.Room
{
public interface IHasMobileControl
{
/// <summary>
/// Indicates if this room is Mobile Control Enabled
/// </summary>
bool IsMobileControlEnabled { get; }
/// <summary>
/// The bridge for this room if Mobile Control is enabled
/// </summary>
IMobileControlRoomBridge MobileControlRoomBridge { get; }
}
}

View File

@@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
namespace PepperDash.Essentials.Core.Interfaces.Room
{
public interface IHasRoomOccupancyStatusProvider
{
event EventHandler<EventArgs> RoomOccupancyIsSet;
IOccupancyStatusProvider RoomOccupancy { get; }
bool OccupancyStatusProviderIsRemote { get; }
int ShutdownVacancySeconds { get; }
eVacancyMode VacancyMode { get; }
void StartRoomVacancyTimer(eVacancyMode mode);
/// <summary>
/// Sets the object to be used as the IOccupancyStatusProvider for the room. Can be an Occupancy Aggregator or a specific device
/// </summary>
/// <param name="statusProvider"></param>
/// <param name="timoutMinutes"></param>
void SetRoomOccupancy(IOccupancyStatusProvider statusProvider, int timeoutMinutes);
/// <summary>
/// Executes when RoomVacancyShutdownTimer expires. Used to trigger specific room actions as needed. Must nullify the timer object when executed
/// </summary>
/// <param name="o"></param>
void RoomVacatedForTimeoutPeriod(object o);
}
}

View File

@@ -0,0 +1,49 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Core;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Core.Interfaces.Room
{
/// <summary>
/// Describes the necessary functions for a room that can be powered on and shutdown
/// </summary>
public interface IHasRoomOn
{
BoolFeedback OnFeedback { get; }
BoolFeedback IsWarmingUpFeedback { get; }
BoolFeedback IsCoolingDownFeedback { get; }
/// <summary>
/// Timer used for informing the UIs of a shutdown
/// </summary>
SecondsCountdownTimer ShutdownPromptTimer { get; }
/// <summary>
///
/// </summary>
int ShutdownPromptSeconds { get; }
int ShutdownVacancySeconds { get; }
eShutdownType ShutdownType { get; }
/// <summary>
/// Starts the Shutdown process based on the type
/// </summary>
/// <param name="type"></param>
void StartShutdown(eShutdownType type);
/// <summary>
/// Resets the vacancy mode and shuts down the room
/// </summary>
void Shutdown();
}
}

View File

@@ -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>
@@ -225,8 +225,12 @@
<Compile Include="Gateways\CenRfgwController.cs" />
<Compile Include="Gateways\EssentialsRfGatewayConfig.cs" />
<Compile Include="Global\EthernetAdapterInfo.cs" />
<Compile Include="Interfaces\Components\RoomComponents.cs" />
<Compile Include="Interfaces\ILogStrings.cs" />
<Compile Include="Interfaces\ILogStringsWithLevel.cs" />
<Compile Include="Interfaces\Room\IHasMobileControl.cs" />
<Compile Include="Interfaces\Room\IHasRoomOccupancyStatusProvider.cs" />
<Compile Include="Interfaces\Room\IHasRoomOn.cs" />
<Compile Include="Queues\ComsMessage.cs" />
<Compile Include="Queues\ProcessStringMessage.cs" />
<Compile Include="Queues\GenericQueue.cs" />
@@ -281,10 +285,14 @@
<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\Config\EssentialsRoomScheduledEventsConfig.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" />

View File

@@ -0,0 +1,194 @@
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.Interfaces.Components;
namespace PepperDash.Essentials.Core.Room.Components
{
public class ComponentFactoryWrapper
{
public CType CType { get; set; }
public string Description { get; set; }
public Func<RoomComponentConfig, IComponentRoom, 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, IComponentRoom, 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, IComponentRoom, 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, IComponentRoom parent)
{
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, parent);
}
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, IComponentRoom parent);
#endregion
}
}

View File

@@ -0,0 +1,163 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Core;
using PepperDash.Essentials.Core.Interfaces.Components;
using PepperDash.Essentials.Core.Room.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; }
[JsonProperty("selectAction")]
public DeviceActionWrapper SelectAction { 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
{
[JsonProperty("deviceKey")]
public string DeviceKey { get; set; }
}
/// <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<IActivatableComponent> Components { get; private set; }
public List<IRoomActivityComponent> Activities { get; private set; }
public ComponentRoom(DeviceConfig config)
: base(config)
{
try
{
PropertiesConfig = config.Properties.ToObject<ComponentRoomPropertiesConfig>();
BuildComponents();
BuildActivities();
}
catch (Exception e)
{
Debug.Console(1, this, "Error building ComponentRoom: \n{0}", e);
}
}
private void BuildComponents()
{
foreach (var compConf in PropertiesConfig.Components)
{
IKeyed newComponent = null;
newComponent = ComponentFactory.GetComponent(compConf, this);
if (newComponent != null)
{
Components.Add(newComponent as IActivatableComponent);
DeviceManager.AddDevice(newComponent);
}
else
{
Debug.Console(0, this, Debug.ErrorLogLevel.Error, "Unable to build room component with key: {0}", compConf.Key);
}
}
}
private void BuildActivities()
{
foreach (var compConf in PropertiesConfig.Activities)
{
IKeyed newComponent = null;
newComponent = ComponentFactory.GetComponent(compConf, this);
if (newComponent != null)
{
Activities.Add(newComponent as IRoomActivityComponent);
DeviceManager.AddDevice(newComponent);
}
else
{
Debug.Console(0, this, Debug.ErrorLogLevel.Error, "Unable to build room activity with key: {0}", compConf.Key);
}
}
}
/// <summary>
/// Returns a set of IRoomComponent that matches the specified Type
/// </summary>
/// <typeparam name="T"></typeparam>
/// <returns></returns>
public List<T> GetComponentsOfType<T>() where T : IActivatableComponent
{
return Components.OfType<T>().ToList();
}
/// <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>();
}
}
}

View File

@@ -0,0 +1,114 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Core;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.Interfaces.Components;
namespace PepperDash.Essentials.Core.Room.Components
{
/// <summary>
/// The base class from which Room Components should be derived
/// </summary>
[Description("The base Essentials Device Class")]
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;
}
}
/// <summary>
/// The base class from which Room Activities should be derived
/// </summary>
public abstract class RoomActivityComponentBase : IRoomActivityComponent
{
#region IRoomActivityComponent Members
public BoolFeedback IsEnabledFeedback { get; private set; }
private bool _enable;
public bool Enable
{
set
{
if (value != _enable)
{
_enable = value;
IsEnabledFeedback.FireUpdate();
}
}
}
public string Label { get; private set; }
public string Icon { get; private set; }
public IRoomBehaviourGroupComponent Component { get; private set; }
public int Order { get; private set; }
#endregion
#region IRoomComponent Members
public IComponentRoom Parent { get; private set; }
#endregion
#region IKeyed Members
private string _componentKey;
public string Key
{
get
{
return Parent.Key + "-" + _componentKey;
}
}
#endregion
public RoomActivityComponentBase(string key, IComponentRoom parent)
{
_componentKey = key;
Parent = parent;
IsEnabledFeedback = new BoolFeedback(() => _enable);
}
public void StartActivity()
{
throw new NotImplementedException();
}
public void EndActivity()
{
throw new NotImplementedException();
}
}
}

View File

@@ -203,7 +203,7 @@ namespace PepperDash.Essentials.Core
}
/// <summary>
///
/// Starts the Shutdown process based on the type
/// </summary>
/// <param name="type"></param>
public void StartShutdown(eShutdownType type)

View File

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

View File

@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Essentials.Core.Interfaces.Components;
namespace PepperDash.Essentials.Core.Room
{
/// <summary>
/// The class that constructs rooms
/// </summary>
public static class RoomFactory
{
}
}