mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-01-17 06:25:02 +00:00
Compare commits
124 Commits
master
...
1.5.7-alph
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
14044d8754 | ||
|
|
ddb1f254e6 | ||
|
|
35388ddf66 | ||
|
|
5b400ec89e | ||
|
|
0a33090462 | ||
|
|
68ea7bba84 | ||
|
|
bb87e2f53b | ||
|
|
91450adc5f | ||
|
|
51feb7bf0b | ||
|
|
90bfa53e85 | ||
|
|
8408093344 | ||
|
|
359f09c125 | ||
|
|
71a950b04a | ||
|
|
bba72e3b31 | ||
|
|
1e7dc6afd9 | ||
|
|
79794412fc | ||
|
|
66edecf6ad | ||
|
|
0f4bded380 | ||
|
|
7f08bfc913 | ||
|
|
6f16bc3427 | ||
|
|
35ec5e903e | ||
|
|
f98292a4aa | ||
|
|
6b6604b7a9 | ||
|
|
55eb110373 | ||
|
|
42418fedb8 | ||
|
|
407fc2e948 | ||
|
|
49177da820 | ||
|
|
a1809dccb4 | ||
|
|
7d97bc118e | ||
|
|
48bc41a69e | ||
|
|
e4a8e89135 | ||
|
|
1bd6825258 | ||
|
|
e5099e9a2a | ||
|
|
ccdaa12f20 | ||
|
|
60d387c792 | ||
|
|
d9b4ca815e | ||
|
|
37686044d4 | ||
|
|
ef50098460 | ||
|
|
f2eff3fdb4 | ||
|
|
2749fdc2e9 | ||
|
|
514fe466fd | ||
|
|
c77d394e08 | ||
|
|
0cfcf4f266 | ||
|
|
d86cc44c3b | ||
|
|
26bd0d624e | ||
|
|
841cb2a83b | ||
|
|
b89112bec1 | ||
|
|
5920c7c0f0 | ||
|
|
d23ef01281 | ||
|
|
dab153f1b0 | ||
|
|
c5ad321842 | ||
|
|
c78b305faa | ||
|
|
a67b435565 | ||
|
|
84d8ff410e | ||
|
|
625c870072 | ||
|
|
c475155546 | ||
|
|
1b6669d4ef | ||
|
|
ffbba24b5a | ||
|
|
9bdbb1fbad | ||
|
|
0465a3b9a6 | ||
|
|
e62dd762f4 | ||
|
|
9c4e4c7976 | ||
|
|
7fa3031cfa | ||
|
|
d34177482e | ||
|
|
1be0a3cba9 | ||
|
|
ce513ac086 | ||
|
|
c98cd05a5c | ||
|
|
d68645ccb0 | ||
|
|
9517eaa0b0 | ||
|
|
6b140bf2d7 | ||
|
|
eab0d2b1d7 | ||
|
|
df8a885594 | ||
|
|
5ea79ac94e | ||
|
|
459dc951e9 | ||
|
|
f823abacc1 | ||
|
|
f0eeae0432 | ||
|
|
4b663eea62 | ||
|
|
8d2d45b5ce | ||
|
|
62fdd6a572 | ||
|
|
305fe5c372 | ||
|
|
b39afe2f50 | ||
|
|
43698ba839 | ||
|
|
b975ce6a6d | ||
|
|
e83acd5bfa | ||
|
|
2f1592bc62 | ||
|
|
1c609764b8 | ||
|
|
c7464a1e34 | ||
|
|
608a9068b9 | ||
|
|
e006a4616a | ||
|
|
677789bec1 | ||
|
|
0dc589f2ea | ||
|
|
aecb36e937 | ||
|
|
be97fe15da | ||
|
|
2a7311ba50 | ||
|
|
b95c341fca | ||
|
|
469d3b0975 | ||
|
|
bece417bf3 | ||
|
|
75774d128d | ||
|
|
430c819813 | ||
|
|
6c2d8c02c1 | ||
|
|
2d0876486d | ||
|
|
22427b1246 | ||
|
|
3c7495aaa1 | ||
|
|
ef4b0441d3 | ||
|
|
190697d855 | ||
|
|
19e78d649f | ||
|
|
0dad34893e | ||
|
|
1fee896a3d | ||
|
|
b6f0ccbf17 | ||
|
|
10bc39ffea | ||
|
|
2a9f6e253b | ||
|
|
0869961622 | ||
|
|
dedcfcbb66 | ||
|
|
5707d12fbe | ||
|
|
8fe586dfec | ||
|
|
696f169ea4 | ||
|
|
efd4f379ee | ||
|
|
aef491855c | ||
|
|
7882210eaf | ||
|
|
138628613c | ||
|
|
912e545678 | ||
|
|
efe8b15763 | ||
|
|
f2cb95af96 | ||
|
|
3bf3ac2cce |
4
.github/scripts/GenerateVersionNumber.ps1
vendored
4
.github/scripts/GenerateVersionNumber.ps1
vendored
@@ -1,4 +1,4 @@
|
||||
$latestVersions = $(git tag --merged origin/master)
|
||||
$latestVersions = $(git tag --merged origin/main)
|
||||
$latestVersion = [version]"0.0.0"
|
||||
Foreach ($version in $latestVersions) {
|
||||
Write-Host $version
|
||||
@@ -18,7 +18,7 @@ $newVersion = [version]$latestVersion
|
||||
$phase = ""
|
||||
$newVersionString = ""
|
||||
switch -regex ($Env:GITHUB_REF) {
|
||||
'^refs\/heads\/master*.' {
|
||||
'^refs\/heads\/main*.' {
|
||||
$newVersionString = "{0}.{1}.{2}" -f $newVersion.Major, $newVersion.Minor, $newVersion.Build
|
||||
}
|
||||
'^refs\/heads\/feature\/*.' {
|
||||
|
||||
8
.github/workflows/docker.yml
vendored
8
.github/workflows/docker.yml
vendored
@@ -18,8 +18,8 @@ env:
|
||||
VERSION: 0.0.0-buildtype-buildnumber
|
||||
# Defaults to debug for build type
|
||||
BUILD_TYPE: Debug
|
||||
# Defaults to master as the release branch. Change as necessary
|
||||
RELEASE_BRANCH: master
|
||||
# Defaults to main as the release branch. Change as necessary
|
||||
RELEASE_BRANCH: main
|
||||
jobs:
|
||||
Build_Project:
|
||||
runs-on: windows-latest
|
||||
@@ -189,11 +189,11 @@ jobs:
|
||||
run: git push --tags origin
|
||||
- name: Check Directory
|
||||
run: Get-ChildItem ./
|
||||
# This step only runs if the branch is master or release/ runs and pushes the build to the public build repo
|
||||
# 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, 'master') || contains(github.ref, '/release/')
|
||||
if: contains(github.ref, 'main') || contains(github.ref, '/release/')
|
||||
steps:
|
||||
# Checkout the repo
|
||||
- name: check Github ref
|
||||
|
||||
22
.github/workflows/master.yml
vendored
22
.github/workflows/master.yml
vendored
@@ -1,11 +1,11 @@
|
||||
name: Master Build using Docker
|
||||
name: main Build using Docker
|
||||
|
||||
on:
|
||||
release:
|
||||
types:
|
||||
- created
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
env:
|
||||
# solution path doesn't need slashes unless there it is multiple folders deep
|
||||
# solution name does not include extension. .sln is assumed
|
||||
@@ -15,8 +15,8 @@ env:
|
||||
VERSION: 0.0.0-buildtype-buildnumber
|
||||
# Defaults to debug for build type
|
||||
BUILD_TYPE: Release
|
||||
# Defaults to master as the release branch. Change as necessary
|
||||
RELEASE_BRANCH: master
|
||||
# Defaults to main as the release branch. Change as necessary
|
||||
RELEASE_BRANCH: main
|
||||
jobs:
|
||||
Build_Project:
|
||||
runs-on: windows-latest
|
||||
@@ -114,8 +114,8 @@ jobs:
|
||||
Remove-Item -Path ./Version/version.txt
|
||||
Remove-Item -Path ./Version
|
||||
# Checkout/Create the branch
|
||||
- name: Checkout Master branch
|
||||
run: git checkout master
|
||||
- name: Checkout main branch
|
||||
run: git checkout main
|
||||
# Download the build output into the repo
|
||||
- name: Download Build output
|
||||
uses: actions/download-artifact@v1
|
||||
@@ -151,13 +151,13 @@ jobs:
|
||||
# Push the commit
|
||||
- name: Push to Builds Repo
|
||||
shell: powershell
|
||||
run: git push -u origin master --force
|
||||
run: git push -u origin main --force
|
||||
# Push the tags
|
||||
- name: Push tags
|
||||
run: git push --tags origin
|
||||
- name: Check Directory
|
||||
run: Get-ChildItem ./
|
||||
# This step only runs if the branch is master or release/ runs and pushes the build to the public build repo
|
||||
# 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
|
||||
@@ -186,9 +186,9 @@ jobs:
|
||||
Write-Output "::set-env name=VERSION::$version"
|
||||
Remove-Item -Path ./Version/version.txt
|
||||
Remove-Item -Path ./Version
|
||||
# Checkout master branch
|
||||
# Checkout main branch
|
||||
- name: Create new branch
|
||||
run: git checkout master
|
||||
run: git checkout main
|
||||
# Download the build output into the repo
|
||||
- name: Download Build output
|
||||
uses: actions/download-artifact@v1
|
||||
@@ -224,7 +224,7 @@ jobs:
|
||||
# Push the commit
|
||||
- name: Push to Builds Repo
|
||||
shell: powershell
|
||||
run: git push -u origin master --force
|
||||
run: git push -u origin main --force
|
||||
# Push the tags
|
||||
- name: Push tags
|
||||
run: git push --tags origin
|
||||
|
||||
@@ -6,8 +6,8 @@ using Crestron.SimplSharp;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
using PepperDash.Essentials.Devices.Common.Codec;
|
||||
using PepperDash.Essentials.Core.Devices.AudioCodec;
|
||||
using PepperDash.Essentials.Core.Devices.Codec;
|
||||
using PepperDash.Essentials.Devices.Common.AudioCodec;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
|
||||
@@ -6,6 +6,7 @@ using Crestron.SimplSharp;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Rooms;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
|
||||
@@ -9,7 +9,7 @@ using Newtonsoft.Json.Linq;
|
||||
|
||||
using PepperDash.Core;
|
||||
|
||||
using PepperDash.Essentials.Devices.Common.Codec;
|
||||
using PepperDash.Essentials.Core.Devices.Codec;
|
||||
using PepperDash.Essentials.Devices.Common.VideoCodec;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
|
||||
@@ -8,7 +8,7 @@ using Crestron.SimplSharpPro.EthernetCommunication;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Devices.Common.Codec;
|
||||
using PepperDash.Essentials.Core.Devices.Codec;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
|
||||
@@ -8,7 +8,7 @@ using Crestron.SimplSharpPro.EthernetCommunication;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Devices.Common.Codec;
|
||||
using PepperDash.Essentials.Core.Devices.Codec;
|
||||
using PepperDash.Essentials.Devices.Common.Cameras;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
|
||||
@@ -9,9 +9,11 @@ using Newtonsoft.Json.Linq;
|
||||
|
||||
using PepperDash.Core;
|
||||
|
||||
using PepperDash.Essentials.Devices.Common.Codec;
|
||||
using PepperDash.Essentials.Core.Devices.Codec;
|
||||
using PepperDash.Essentials.Core.Devices.VideoCodec;
|
||||
using PepperDash.Essentials.Devices.Common.Cameras;
|
||||
using PepperDash.Essentials.Devices.Common.VideoCodec;
|
||||
using PepperDash.Essentials.Devices.Core.VideoCodec;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
|
||||
@@ -1,18 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.AppServer.Messengers;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Devices.AudioCodec;
|
||||
using PepperDash.Essentials.Core.Devices.VideoCodec;
|
||||
using PepperDash.Essentials.Core.Rooms;
|
||||
using PepperDash.Essentials.Room.MobileControl;
|
||||
using PepperDash.Essentials.Devices.Common.Codec;
|
||||
using PepperDash.Essentials.Devices.Common.VideoCodec;
|
||||
using PepperDash.Essentials.Devices.Common.AudioCodec;
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
{
|
||||
|
||||
@@ -14,7 +14,7 @@ using PepperDash.Essentials.AppServer;
|
||||
using PepperDash.Essentials.AppServer.Messengers;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.Room.Config;
|
||||
using PepperDash.Essentials.Core.Rooms.Config;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.Room.MobileControl
|
||||
@@ -522,18 +522,18 @@ namespace PepperDash.Essentials.Room.MobileControl
|
||||
// Build "audioCodec" config if we need
|
||||
if (!string.IsNullOrEmpty(rmProps.AudioCodecKey))
|
||||
{
|
||||
var acFavs = new List<PepperDash.Essentials.Devices.Common.Codec.CodecActiveCallItem>();
|
||||
var acFavs = new List<Core.Devices.Codec.CodecActiveCallItem>();
|
||||
for (uint i = 0; i < 4; i++)
|
||||
{
|
||||
if (!EISC.GetBool(JoinMap.SpeedDialVisibleStartJoin.JoinNumber + i))
|
||||
{
|
||||
break;
|
||||
}
|
||||
acFavs.Add(new PepperDash.Essentials.Devices.Common.Codec.CodecActiveCallItem()
|
||||
acFavs.Add(new Core.Devices.Codec.CodecActiveCallItem()
|
||||
{
|
||||
Name = EISC.GetString(JoinMap.SpeedDialNameStartJoin.JoinNumber + i),
|
||||
Number = EISC.GetString(JoinMap.SpeedDialNumberStartJoin.JoinNumber + i),
|
||||
Type = PepperDash.Essentials.Devices.Common.Codec.eCodecCallType.Audio
|
||||
Type = Core.Devices.Codec.eCodecCallType.Audio
|
||||
});
|
||||
}
|
||||
|
||||
@@ -558,7 +558,7 @@ namespace PepperDash.Essentials.Room.MobileControl
|
||||
if (!string.IsNullOrEmpty(rmProps.VideoCodecKey))
|
||||
{
|
||||
// No favorites, for now?
|
||||
var favs = new List<PepperDash.Essentials.Devices.Common.Codec.CodecActiveCallItem>();
|
||||
var favs = new List<Core.Devices.Codec.CodecActiveCallItem>();
|
||||
|
||||
// cameras
|
||||
var camsProps = new List<object>();
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Crestron.SimplSharp.Reflection;
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.EthernetCommunication;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Bridges;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Bridges;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
@@ -15,15 +15,11 @@ namespace PepperDash.Essentials.Bridges
|
||||
{
|
||||
public EiscApiPropertiesConfig PropertiesConfig { get; private set; }
|
||||
|
||||
protected Dictionary<string, JoinMapBaseAdvanced> JoinMaps { get; private set; }
|
||||
|
||||
public ThreeSeriesTcpIpEthernetIntersystemCommunications Eisc { get; private set; }
|
||||
|
||||
public EiscApi(DeviceConfig dc) :
|
||||
base(dc.Key)
|
||||
{
|
||||
JoinMaps = new Dictionary<string, JoinMapBaseAdvanced>();
|
||||
|
||||
PropertiesConfig = dc.Properties.ToObject<EiscApiPropertiesConfig>();
|
||||
//PropertiesConfig = JsonConvert.DeserializeObject<EiscApiPropertiesConfig>(dc.Properties.ToString());
|
||||
|
||||
@@ -44,19 +40,31 @@ namespace PepperDash.Essentials.Bridges
|
||||
if (device == null) continue;
|
||||
|
||||
Debug.Console(1, this, "Linking Device: '{0}'", device.Key);
|
||||
if (device is IBridge) // Check for this first to allow bridges in plugins to override existing bridges that apply to the same type.
|
||||
if (typeof(IBridge).IsAssignableFrom(device.GetType().GetCType())) // Check for this first to allow bridges in plugins to override existing bridges that apply to the same type.
|
||||
{
|
||||
Debug.Console(2, this, "'{0}' is IBridge", device.Key);
|
||||
|
||||
var dev = device as IBridge;
|
||||
|
||||
if (dev == null)
|
||||
{
|
||||
Debug.Console(0, this, Debug.ErrorLogLevel.Error, "Cast to IBridge failed for {0}");
|
||||
continue;
|
||||
}
|
||||
|
||||
dev.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||
}
|
||||
if (!(device is IBridgeAdvanced)) continue;
|
||||
if (!typeof(IBridgeAdvanced).IsAssignableFrom(device.GetType().GetCType())) continue;
|
||||
Debug.Console(2, this, "'{0}' is IBridgeAdvanced", device.Key);
|
||||
|
||||
var advDev = device as IBridgeAdvanced;
|
||||
|
||||
if (advDev == null)
|
||||
{
|
||||
Debug.Console(0, this, Debug.ErrorLogLevel.Error, "Cast to IBridgeAdvanced failed for {0}");
|
||||
continue;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
advDev.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey, null);
|
||||
@@ -66,63 +74,12 @@ namespace PepperDash.Essentials.Bridges
|
||||
Debug.ConsoleWithLog(0, this,
|
||||
"Please update the bridge config to use EiscBridgeAdvanced with this device: {0}", device.Key);
|
||||
}
|
||||
|
||||
}
|
||||
Debug.Console(1, this, "Devices Linked.");
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a join map
|
||||
/// </summary>
|
||||
/// <param name="deviceKey"></param>
|
||||
/// <param name="joinMap"></param>
|
||||
public void AddJoinMap(string deviceKey, JoinMapBaseAdvanced joinMap)
|
||||
{
|
||||
if (!JoinMaps.ContainsKey(deviceKey))
|
||||
{
|
||||
JoinMaps.Add(deviceKey, joinMap);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(2, this, "Unable to add join map with key '{0}'. Key already exists in JoinMaps dictionary", deviceKey);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Prints all the join maps on this bridge
|
||||
/// </summary>
|
||||
public void PrintJoinMaps()
|
||||
{
|
||||
Debug.Console(0, this, "Join Maps for EISC IPID: {0}", Eisc.ID.ToString("X"));
|
||||
|
||||
foreach (var joinMap in JoinMaps)
|
||||
{
|
||||
Debug.Console(0, "Join map for device '{0}':", joinMap.Key);
|
||||
joinMap.Value.PrintJoinMapInfo();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Prints the join map for a device by key
|
||||
/// </summary>
|
||||
/// <param name="deviceKey"></param>
|
||||
public void PrintJoinMapForDevice(string deviceKey)
|
||||
{
|
||||
var joinMap = JoinMaps[deviceKey];
|
||||
|
||||
if (joinMap == null)
|
||||
{
|
||||
Debug.Console(0, this, "Unable to find joinMap for device with key: '{0}'", deviceKey);
|
||||
return;
|
||||
}
|
||||
|
||||
Debug.Console(0, "Join map for device '{0}' on EISC '{1}':", deviceKey, Key);
|
||||
joinMap.PrintJoinMapInfo();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used for debugging to trigger an action based on a join number and type
|
||||
/// </summary>
|
||||
@@ -194,7 +151,7 @@ namespace PepperDash.Essentials.Bridges
|
||||
try
|
||||
{
|
||||
if (Debug.Level >= 1)
|
||||
Debug.Console(1, this, "EiscApiAdvanced change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
|
||||
Debug.Console(1, this, "EiscApi change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
|
||||
var uo = args.Sig.UserObject;
|
||||
|
||||
if (uo == null) return;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
|
||||
namespace PepperDash.Essentials.Bridges
|
||||
{
|
||||
@@ -6,7 +7,8 @@ namespace PepperDash.Essentials.Bridges
|
||||
/// Defines a device that uses the legacy JoinMapBase for its join map
|
||||
/// </summary>
|
||||
[Obsolete("IBridgeAdvanced should be used going forward with JoinMapBaseAdvanced")]
|
||||
public interface IBridge:Core.Bridges.IBridge
|
||||
public interface IBridge
|
||||
{
|
||||
void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey);
|
||||
}
|
||||
}
|
||||
@@ -12,12 +12,9 @@ using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Bridges;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.Devices.Common;
|
||||
using PepperDash.Essentials.Core.Rooms.Config;
|
||||
using PepperDash.Essentials.DM;
|
||||
using PepperDash.Essentials.Fusion;
|
||||
using PepperDash.Essentials.Room.Config;
|
||||
using PepperDash.Essentials.Room.MobileControl;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace PepperDash.Essentials.Fusion
|
||||
|
||||
// In Call Status
|
||||
CodecIsInCall = FusionRoom.CreateOffsetBoolSig(69, "Conf - VC 1 In Call", eSigIoMask.InputSigOnly);
|
||||
codec.CallStatusChange += new EventHandler<PepperDash.Essentials.Devices.Common.Codec.CodecCallStatusItemChangeEventArgs>(codec_CallStatusChange);
|
||||
codec.CallStatusChange += new EventHandler<Core.Devices.Codec.CodecCallStatusItemChangeEventArgs>(codec_CallStatusChange);
|
||||
|
||||
// Online status
|
||||
if (codec is ICommunicationMonitor)
|
||||
@@ -147,7 +147,7 @@ namespace PepperDash.Essentials.Fusion
|
||||
}
|
||||
}
|
||||
|
||||
void codec_CallStatusChange(object sender, PepperDash.Essentials.Devices.Common.Codec.CodecCallStatusItemChangeEventArgs e)
|
||||
void codec_CallStatusChange(object sender, Core.Devices.Codec.CodecCallStatusItemChangeEventArgs e)
|
||||
{
|
||||
var codec = (Room as EssentialsHuddleVtc1Room).VideoCodec;
|
||||
|
||||
|
||||
@@ -123,7 +123,6 @@
|
||||
<Compile Include="AppServer\SIMPLJoinMaps\SIMPLVtcJoinMap.cs" />
|
||||
<Compile Include="AppServer\SIMPLJoinMaps\SIMPLAtcJoinMap.cs" />
|
||||
<Compile Include="AppServer\SIMPLJoinMaps\MobileControlSIMPLRoomJoinMap.cs" />
|
||||
<Compile Include="Audio\EssentialsVolumeLevelConfig.cs" />
|
||||
<Compile Include="Bridges\EiscBridge.cs" />
|
||||
<Compile Include="Bridges\JoinMaps\AirMediaControllerJoinMap.cs" />
|
||||
<Compile Include="Bridges\JoinMaps\AppleTvJoinMap.cs" />
|
||||
@@ -153,13 +152,6 @@
|
||||
<Compile Include="ControlSystem.cs" />
|
||||
<Compile Include="Fusion\EssentialsHuddleVtc1FusionController.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Room\Config\EssentialsDualDisplayRoomPropertiesConfig.cs" />
|
||||
<Compile Include="Room\Config\EssentialsNDisplayRoomPropertiesConfig.cs" />
|
||||
<Compile Include="Room\Config\DDVC01RoomPropertiesConfig.cs" />
|
||||
<Compile Include="Room\Config\EssentialsPresentationPropertiesConfig.cs" />
|
||||
<Compile Include="Room\Config\EssentialsHuddleRoomPropertiesConfig.cs" />
|
||||
<Compile Include="Room\Config\EssentialsHuddleVtc1PropertiesConfig.cs" />
|
||||
<Compile Include="Room\Config\EssentialsRoomEmergencyConfig.cs" />
|
||||
<Compile Include="AppServer\MobileControlConfig.cs" />
|
||||
<Compile Include="AppServer\MobileControlDdvc01DeviceBridge.cs" />
|
||||
<Compile Include="AppServer\Interfaces.cs" />
|
||||
@@ -176,11 +168,6 @@
|
||||
<Compile Include="AppServer\DeviceTypeInterfaces\ITransportExtensions.cs" />
|
||||
<Compile Include="AppServer\RoomBridges\SourceDeviceMapDictionary.cs" />
|
||||
<Compile Include="AppServer\Volumes.cs" />
|
||||
<Compile Include="Room\Emergency\EsentialsRoomEmergencyContactClosure.cs" />
|
||||
<Compile Include="Room\Types\EssentialsDualDisplayRoom.cs" />
|
||||
<Compile Include="Room\Types\EssentialsHuddleVtc1Room.cs" />
|
||||
<Compile Include="Room\Types\EssentialsNDisplayRoomBase.cs" />
|
||||
<Compile Include="Room\Config\EssentialsRoomConfig.cs" />
|
||||
<Compile Include="UIDrivers\Environment Drivers\EssentialsEnvironmentDriver.cs" />
|
||||
<Compile Include="UIDrivers\Environment Drivers\EssentialsLightingDriver.cs" />
|
||||
<Compile Include="UIDrivers\Environment Drivers\EssentialsShadeDriver.cs" />
|
||||
@@ -210,7 +197,6 @@
|
||||
<Compile Include="AppServer\MobileControlSystemController.cs" />
|
||||
<Compile Include="UI\DualDisplaySourceSRLController.cs" />
|
||||
<Compile Include="UI\SubpageReferenceListActivityItem.cs" />
|
||||
<Compile Include="Room\Types\EssentialsHuddleSpaceRoom.cs" />
|
||||
<Compile Include="UI\EssentialsTouchpanelController.cs" />
|
||||
<Compile Include="UI\SubpageReferenceListSourceItem.cs" />
|
||||
<None Include="app.config" />
|
||||
@@ -247,6 +233,9 @@
|
||||
<Name>Essentials Devices Common</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="UIDrivers\EssentialsDualDisplay\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" />
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Devices;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.Room.Config;
|
||||
using PepperDash.Essentials.Devices.Common.Codec;
|
||||
@@ -77,9 +74,8 @@ namespace PepperDash.Essentials
|
||||
var leftDisp = LeftDisplay as DisplayBase;
|
||||
var rightDisp = RightDisplay as DisplayBase;
|
||||
if (leftDisp != null && RightDisplay != null)
|
||||
return leftDisp.IsWarmingUpFeedback.BoolValue || rightDisp.IsWarmingUpFeedback.BoolValue;
|
||||
else
|
||||
return false;
|
||||
return rightDisp != null && (leftDisp.IsWarmingUpFeedback.BoolValue || rightDisp.IsWarmingUpFeedback.BoolValue);
|
||||
return false;
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -96,9 +92,8 @@ namespace PepperDash.Essentials
|
||||
var leftDisp = LeftDisplay as DisplayBase;
|
||||
var rightDisp = RightDisplay as DisplayBase;
|
||||
if (leftDisp != null && RightDisplay != null)
|
||||
return leftDisp.IsCoolingDownFeedback.BoolValue || rightDisp.IsCoolingDownFeedback.BoolValue;
|
||||
else
|
||||
return false;
|
||||
return rightDisp != null && (leftDisp.IsCoolingDownFeedback.BoolValue || rightDisp.IsCoolingDownFeedback.BoolValue);
|
||||
return false;
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -120,7 +115,7 @@ namespace PepperDash.Essentials
|
||||
/// If room is off, enables power on to last source. Default true
|
||||
/// </summary>
|
||||
public bool EnablePowerOnToLastSource { get; set; }
|
||||
string LastSourceKey;
|
||||
string _lastSourceKey;
|
||||
|
||||
/// <summary>
|
||||
/// Sets the volume control device, and attaches/removes InUseTrackers with "audio"
|
||||
@@ -128,27 +123,27 @@ namespace PepperDash.Essentials
|
||||
/// </summary>
|
||||
public IBasicVolumeControls CurrentVolumeControls
|
||||
{
|
||||
get { return _CurrentAudioDevice; }
|
||||
get { return _currentAudioDevice; }
|
||||
set
|
||||
{
|
||||
if (value == _CurrentAudioDevice) return;
|
||||
if (value == _currentAudioDevice) return;
|
||||
|
||||
var oldDev = _CurrentAudioDevice;
|
||||
var oldDev = _currentAudioDevice;
|
||||
// derigister this room from the device, if it can
|
||||
if (oldDev is IInUseTracking)
|
||||
(oldDev as IInUseTracking).InUseTracker.RemoveUser(this, "audio");
|
||||
var handler = CurrentVolumeDeviceChange;
|
||||
if (handler != null)
|
||||
CurrentVolumeDeviceChange(this, new VolumeDeviceChangeEventArgs(oldDev, value, ChangeType.WillChange));
|
||||
_CurrentAudioDevice = value;
|
||||
_currentAudioDevice = value;
|
||||
if (handler != null)
|
||||
CurrentVolumeDeviceChange(this, new VolumeDeviceChangeEventArgs(oldDev, value, ChangeType.DidChange));
|
||||
// register this room with new device, if it can
|
||||
if (_CurrentAudioDevice is IInUseTracking)
|
||||
(_CurrentAudioDevice as IInUseTracking).InUseTracker.AddUser(this, "audio");
|
||||
if (_currentAudioDevice is IInUseTracking)
|
||||
(_currentAudioDevice as IInUseTracking).InUseTracker.AddUser(this, "audio");
|
||||
}
|
||||
}
|
||||
IBasicVolumeControls _CurrentAudioDevice;
|
||||
IBasicVolumeControls _currentAudioDevice;
|
||||
|
||||
/// <summary>
|
||||
/// "codecOsd"
|
||||
@@ -161,7 +156,7 @@ namespace PepperDash.Essentials
|
||||
/// </summary>
|
||||
public IHasScheduleAwareness ScheduleSource { get { return VideoCodec as IHasScheduleAwareness; } }
|
||||
|
||||
CCriticalSection SourceSelectLock = new CCriticalSection();
|
||||
readonly CCriticalSection _sourceSelectLock = new CCriticalSection();
|
||||
|
||||
public EssentialsDualDisplayRoom(DeviceConfig config)
|
||||
: base(config)
|
||||
@@ -196,12 +191,12 @@ namespace PepperDash.Essentials
|
||||
}
|
||||
|
||||
VideoCodec = DeviceManager.GetDeviceForKey(PropertiesConfig.VideoCodecKey) as
|
||||
PepperDash.Essentials.Devices.Common.VideoCodec.VideoCodecBase;
|
||||
VideoCodecBase;
|
||||
if (VideoCodec == null)
|
||||
throw new ArgumentNullException("codec cannot be null");
|
||||
|
||||
AudioCodec = DeviceManager.GetDeviceForKey(PropertiesConfig.AudioCodecKey) as
|
||||
PepperDash.Essentials.Devices.Common.AudioCodec.AudioCodecBase;
|
||||
AudioCodecBase;
|
||||
if (AudioCodec == null)
|
||||
Debug.Console(0, this, "No Audio Codec Found");
|
||||
|
||||
@@ -217,8 +212,8 @@ namespace PepperDash.Essentials
|
||||
|
||||
void Initialize()
|
||||
{
|
||||
if (DefaultAudioDevice is IBasicVolumeControls)
|
||||
DefaultVolumeControls = DefaultAudioDevice as IBasicVolumeControls;
|
||||
if (DefaultAudioDevice != null)
|
||||
DefaultVolumeControls = DefaultAudioDevice;
|
||||
else if (DefaultAudioDevice is IHasVolumeDevice)
|
||||
DefaultVolumeControls = (DefaultAudioDevice as IHasVolumeDevice).VolumeDevice;
|
||||
CurrentVolumeControls = DefaultVolumeControls;
|
||||
@@ -233,12 +228,12 @@ namespace PepperDash.Essentials
|
||||
InitializeDisplay(rightDisp);
|
||||
|
||||
// Get Microphone Privacy object, if any
|
||||
this.MicrophonePrivacy = EssentialsRoomConfigHelper.GetMicrophonePrivacy(PropertiesConfig, this);
|
||||
MicrophonePrivacy = EssentialsRoomConfigHelper.GetMicrophonePrivacy(PropertiesConfig, this);
|
||||
|
||||
Debug.Console(2, this, "Microphone Privacy Config evaluated.");
|
||||
|
||||
// Get emergency object, if any
|
||||
this.Emergency = EssentialsRoomConfigHelper.GetEmergency(PropertiesConfig, this);
|
||||
Emergency = EssentialsRoomConfigHelper.GetEmergency(PropertiesConfig, this);
|
||||
|
||||
Debug.Console(2, this, "Emergency Config evaluated.");
|
||||
|
||||
@@ -254,23 +249,20 @@ namespace PepperDash.Essentials
|
||||
if (VideoCodec != null)
|
||||
inVideoCall = VideoCodec.IsInCall;
|
||||
|
||||
if (inAudioCall || inVideoCall)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
return inAudioCall || inVideoCall;
|
||||
});
|
||||
|
||||
VideoCodec.CallStatusChange += (o, a) => this.InCallFeedback.FireUpdate();
|
||||
VideoCodec.CallStatusChange += (o, a) => InCallFeedback.FireUpdate();
|
||||
|
||||
if (AudioCodec != null)
|
||||
AudioCodec.CallStatusChange += (o, a) => this.InCallFeedback.FireUpdate();
|
||||
AudioCodec.CallStatusChange += (o, a) => InCallFeedback.FireUpdate();
|
||||
|
||||
IsSharingFeedback = new BoolFeedback(() => VideoCodec.SharingContentIsOnFeedback.BoolValue);
|
||||
VideoCodec.SharingContentIsOnFeedback.OutputChange += (o, a) => this.IsSharingFeedback.FireUpdate();
|
||||
VideoCodec.SharingContentIsOnFeedback.OutputChange += (o, a) => IsSharingFeedback.FireUpdate();
|
||||
|
||||
// link privacy to VC (for now?)
|
||||
PrivacyModeIsOnFeedback = new BoolFeedback(() => VideoCodec.PrivacyModeIsOnFeedback.BoolValue);
|
||||
VideoCodec.PrivacyModeIsOnFeedback.OutputChange += (o, a) => this.PrivacyModeIsOnFeedback.FireUpdate();
|
||||
VideoCodec.PrivacyModeIsOnFeedback.OutputChange += (o, a) => PrivacyModeIsOnFeedback.FireUpdate();
|
||||
|
||||
CallTypeFeedback = new IntFeedback(() => 0);
|
||||
|
||||
@@ -300,13 +292,18 @@ namespace PepperDash.Essentials
|
||||
disp.IsWarmingUpFeedback.OutputChange += (o, a) =>
|
||||
{
|
||||
IsWarmingUpFeedback.FireUpdate();
|
||||
if (!IsWarmingUpFeedback.BoolValue)
|
||||
(CurrentVolumeControls as IBasicVolumeWithFeedback).SetVolume(DefaultVolume);
|
||||
};
|
||||
disp.IsCoolingDownFeedback.OutputChange += (o, a) =>
|
||||
{
|
||||
IsCoolingDownFeedback.FireUpdate();
|
||||
if (IsWarmingUpFeedback.BoolValue)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var basicVolumeWithFeedback = CurrentVolumeControls as IBasicVolumeWithFeedback;
|
||||
if (basicVolumeWithFeedback != null)
|
||||
{
|
||||
basicVolumeWithFeedback.SetVolume(DefaultVolume);
|
||||
}
|
||||
};
|
||||
disp.IsCoolingDownFeedback.OutputChange += (o, a) => IsCoolingDownFeedback.FireUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -324,13 +321,13 @@ namespace PepperDash.Essentials
|
||||
{
|
||||
// Add Occupancy object from config
|
||||
if (PropertiesConfig.Occupancy != null)
|
||||
this.SetRoomOccupancy(DeviceManager.GetDeviceForKey(PropertiesConfig.Occupancy.DeviceKey) as
|
||||
SetRoomOccupancy(DeviceManager.GetDeviceForKey(PropertiesConfig.Occupancy.DeviceKey) as
|
||||
IOccupancyStatusProvider, PropertiesConfig.Occupancy.TimeoutMinutes);
|
||||
|
||||
this.LogoUrl = PropertiesConfig.Logo.GetUrl();
|
||||
this.SourceListKey = PropertiesConfig.SourceListKey;
|
||||
this.DefaultSourceItem = PropertiesConfig.DefaultSourceItem;
|
||||
this.DefaultVolume = (ushort)(PropertiesConfig.Volumes.Master.Level * 65535 / 100);
|
||||
LogoUrl = PropertiesConfig.Logo.GetUrl();
|
||||
SourceListKey = PropertiesConfig.SourceListKey;
|
||||
DefaultSourceItem = PropertiesConfig.DefaultSourceItem;
|
||||
DefaultVolume = (ushort)(PropertiesConfig.Volumes.Master.Level * 65535 / 100);
|
||||
|
||||
return base.CustomActivate();
|
||||
}
|
||||
@@ -376,6 +373,7 @@ namespace PepperDash.Essentials
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="routeKey"></param>
|
||||
/// <param name="sourceListKey"></param>
|
||||
public void RunRouteAction(string routeKey, string sourceListKey)
|
||||
{
|
||||
RunRouteAction(routeKey, sourceListKey, null);
|
||||
@@ -385,14 +383,17 @@ namespace PepperDash.Essentials
|
||||
/// Gets a source from config list SourceListKey and dynamically build and executes the
|
||||
/// route or commands
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="routeKey"></param>
|
||||
/// <param name="sourceListKey"></param>
|
||||
/// <param name="successCallback"></param>
|
||||
public void RunRouteAction(string routeKey, string sourceListKey, Action successCallback)
|
||||
{
|
||||
// Run this on a separate thread
|
||||
new CTimer(o =>
|
||||
//new CTimer
|
||||
CrestronInvoke.BeginInvoke(o =>
|
||||
{
|
||||
// try to prevent multiple simultaneous selections
|
||||
SourceSelectLock.TryEnter();
|
||||
_sourceSelectLock.TryEnter();
|
||||
|
||||
try
|
||||
{
|
||||
@@ -414,9 +415,9 @@ namespace PepperDash.Essentials
|
||||
}
|
||||
|
||||
// End usage timer on last source
|
||||
if (!string.IsNullOrEmpty(LastSourceKey))
|
||||
if (!string.IsNullOrEmpty(_lastSourceKey))
|
||||
{
|
||||
var usageLastSource = dict[LastSourceKey].SourceDevice as IUsageTracking;
|
||||
var usageLastSource = dict[_lastSourceKey].SourceDevice as IUsageTracking;
|
||||
if (usageLastSource != null && usageLastSource.UsageTracker != null)
|
||||
{
|
||||
try
|
||||
@@ -436,7 +437,7 @@ namespace PepperDash.Essentials
|
||||
if (routeKey.ToLower() != "roomoff")
|
||||
{
|
||||
|
||||
LastSourceKey = routeKey;
|
||||
_lastSourceKey = routeKey;
|
||||
}
|
||||
//else
|
||||
// CurrentSourceInfoKey = null;
|
||||
@@ -521,7 +522,7 @@ namespace PepperDash.Essentials
|
||||
Debug.Console(1, this, "ERROR in routing: {0}", e);
|
||||
}
|
||||
|
||||
SourceSelectLock.Leave();
|
||||
_sourceSelectLock.Leave();
|
||||
}, 0); // end of CTimer
|
||||
}
|
||||
|
||||
@@ -530,6 +531,8 @@ namespace PepperDash.Essentials
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="route"></param>
|
||||
/// <param name="sourceItem"></param>
|
||||
/// <param name="sourceItemKey"></param>
|
||||
void DoRouteItem(SourceRouteListItem route, SourceListItem sourceItem, string sourceItemKey)
|
||||
{
|
||||
// if there is a $defaultAll on route, run two separate
|
||||
@@ -553,9 +556,9 @@ namespace PepperDash.Essentials
|
||||
/// </summary>
|
||||
/// <param name="route"></param>
|
||||
/// <returns></returns>
|
||||
bool DoRoute(SourceRouteListItem route, SourceListItem sourceItem, string sourceItemKey)
|
||||
private bool DoRoute(SourceRouteListItem route, SourceListItem sourceItem, string sourceItemKey)
|
||||
{
|
||||
IRoutingSinkNoSwitching dest = null;
|
||||
IRoutingSink dest = null;
|
||||
|
||||
if (route.DestinationKey.Equals("$defaultaudio", StringComparison.OrdinalIgnoreCase))
|
||||
dest = DefaultAudioDevice as IRoutingSinkNoSwitching;
|
||||
@@ -617,9 +620,9 @@ namespace PepperDash.Essentials
|
||||
/// </summary>
|
||||
public override void PowerOnToDefaultOrLastSource()
|
||||
{
|
||||
if (!EnablePowerOnToLastSource || LastSourceKey == null)
|
||||
if (!EnablePowerOnToLastSource || _lastSourceKey == null)
|
||||
return;
|
||||
RunRouteAction(LastSourceKey, SourceListKey);
|
||||
RunRouteAction(_lastSourceKey, SourceListKey);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -627,10 +630,11 @@ namespace PepperDash.Essentials
|
||||
/// </summary>
|
||||
public static void AllRoomsOff()
|
||||
{
|
||||
var allRooms = DeviceManager.AllDevices.Where(d =>
|
||||
d is EssentialsHuddleSpaceRoom && !(d as EssentialsHuddleSpaceRoom).ExcludeFromGlobalFunctions);
|
||||
var allRooms = DeviceManager.AllDevices.OfType<EssentialsHuddleSpaceRoom>().Where(d => !d.ExcludeFromGlobalFunctions);
|
||||
foreach (var room in allRooms)
|
||||
(room as EssentialsHuddleSpaceRoom).RunRouteAction("roomOff", (room as EssentialsHuddleSpaceRoom).SourceListKey);
|
||||
{
|
||||
room.RunRouteAction("roomOff", room.SourceListKey);
|
||||
}
|
||||
}
|
||||
|
||||
#region IPrivacy Members
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
@@ -13,148 +7,21 @@ using PepperDash.Essentials.Room.Config;
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
{
|
||||
public class EssentialsHuddleSpaceRoom : EssentialsRoomBase, IHasCurrentSourceInfoChange, IRunRouteAction, IRunDefaultPresentRoute, IHasCurrentVolumeControls, IHasDefaultDisplay
|
||||
{
|
||||
public event EventHandler<VolumeDeviceChangeEventArgs> CurrentVolumeDeviceChange;
|
||||
public event SourceInfoChangeHandler CurrentSourceChange;
|
||||
|
||||
protected override Func<bool> OnFeedbackFunc
|
||||
{
|
||||
get
|
||||
{
|
||||
return () =>
|
||||
{
|
||||
var disp = DefaultDisplay as DisplayBase;
|
||||
var val = CurrentSourceInfo != null
|
||||
&& CurrentSourceInfo.Type == eSourceListItemType.Route
|
||||
&& disp != null;
|
||||
//&& disp.PowerIsOnFeedback.BoolValue;
|
||||
return val;
|
||||
};
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
protected override Func<bool> IsWarmingFeedbackFunc
|
||||
{
|
||||
get
|
||||
{
|
||||
return () =>
|
||||
{
|
||||
var disp = DefaultDisplay as DisplayBase;
|
||||
if (disp != null)
|
||||
return disp.IsWarmingUpFeedback.BoolValue;
|
||||
else
|
||||
return false;
|
||||
};
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
protected override Func<bool> IsCoolingFeedbackFunc
|
||||
{
|
||||
get
|
||||
{
|
||||
return () =>
|
||||
{
|
||||
var disp = DefaultDisplay as DisplayBase;
|
||||
if (disp != null)
|
||||
return disp.IsCoolingDownFeedback.BoolValue;
|
||||
else
|
||||
return false;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public EssentialsHuddleRoomPropertiesConfig PropertiesConfig { get; private set; }
|
||||
|
||||
public IRoutingSinkWithSwitching DefaultDisplay { get; private set; }
|
||||
public IRoutingSinkNoSwitching DefaultAudioDevice { get; private set; }
|
||||
public IBasicVolumeControls DefaultVolumeControls { get; private set; }
|
||||
|
||||
public bool ExcludeFromGlobalFunctions { get; set; }
|
||||
|
||||
public string DefaultSourceItem { get; set; }
|
||||
|
||||
public ushort DefaultVolume { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If room is off, enables power on to last source. Default true
|
||||
/// </summary>
|
||||
public bool EnablePowerOnToLastSource { get; set; }
|
||||
string LastSourceKey;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public IBasicVolumeControls CurrentVolumeControls
|
||||
{
|
||||
get { return _CurrentAudioDevice; }
|
||||
set
|
||||
{
|
||||
if (value == _CurrentAudioDevice) return;
|
||||
|
||||
var oldDev = _CurrentAudioDevice;
|
||||
// derigister this room from the device, if it can
|
||||
if (oldDev is IInUseTracking)
|
||||
(oldDev as IInUseTracking).InUseTracker.RemoveUser(this, "audio");
|
||||
var handler = CurrentVolumeDeviceChange;
|
||||
if (handler != null)
|
||||
CurrentVolumeDeviceChange(this, new VolumeDeviceChangeEventArgs(oldDev, value, ChangeType.WillChange));
|
||||
_CurrentAudioDevice = value;
|
||||
if (handler != null)
|
||||
CurrentVolumeDeviceChange(this, new VolumeDeviceChangeEventArgs(oldDev, value, ChangeType.DidChange));
|
||||
// register this room with new device, if it can
|
||||
if (_CurrentAudioDevice is IInUseTracking)
|
||||
(_CurrentAudioDevice as IInUseTracking).InUseTracker.AddUser(this, "audio");
|
||||
}
|
||||
}
|
||||
IBasicVolumeControls _CurrentAudioDevice;
|
||||
|
||||
/// <summary>
|
||||
/// The SourceListItem last run - containing names and icons
|
||||
/// </summary>
|
||||
public SourceListItem CurrentSourceInfo
|
||||
{
|
||||
get { return _CurrentSourceInfo; }
|
||||
set
|
||||
{
|
||||
if (value == _CurrentSourceInfo) return;
|
||||
|
||||
var handler = CurrentSourceChange;
|
||||
// remove from in-use tracker, if so equipped
|
||||
if(_CurrentSourceInfo != null && _CurrentSourceInfo.SourceDevice is IInUseTracking)
|
||||
(_CurrentSourceInfo.SourceDevice as IInUseTracking).InUseTracker.RemoveUser(this, "control");
|
||||
|
||||
if (handler != null)
|
||||
handler(_CurrentSourceInfo, ChangeType.WillChange);
|
||||
|
||||
_CurrentSourceInfo = value;
|
||||
|
||||
// add to in-use tracking
|
||||
if (_CurrentSourceInfo != null && _CurrentSourceInfo.SourceDevice is IInUseTracking)
|
||||
(_CurrentSourceInfo.SourceDevice as IInUseTracking).InUseTracker.AddUser(this, "control");
|
||||
if (handler != null)
|
||||
handler( _CurrentSourceInfo, ChangeType.DidChange);
|
||||
}
|
||||
}
|
||||
SourceListItem _CurrentSourceInfo;
|
||||
|
||||
public string CurrentSourceInfoKey { get; set; }
|
||||
|
||||
public class EssentialsHuddleSpaceRoom : EssentialsRoomBase, IRunRouteAction,
|
||||
IRunDefaultPresentRoute, IHasCurrentVolumeControls, IHasDefaultDisplay, IHasCurrentSourceInfoChange
|
||||
{
|
||||
public EssentialsHuddleSpaceRoom(DeviceConfig config)
|
||||
: base(config)
|
||||
{
|
||||
try
|
||||
{
|
||||
PropertiesConfig = JsonConvert.DeserializeObject<EssentialsHuddleRoomPropertiesConfig>
|
||||
(config.Properties.ToString());
|
||||
DefaultDisplay = DeviceManager.GetDeviceForKey(PropertiesConfig.DefaultDisplayKey) as IRoutingSinkWithSwitching;
|
||||
PropertiesConfig = config.Properties.ToObject<EssentialsHuddleRoomPropertiesConfig>();
|
||||
DefaultDisplay =
|
||||
DeviceManager.GetDeviceForKey(PropertiesConfig.DefaultDisplayKey) as IRoutingSinkWithSwitching;
|
||||
//why are we assuming IRoutingSinkWithSwitching here?
|
||||
|
||||
|
||||
DefaultAudioDevice = DeviceManager.GetDeviceForKey(PropertiesConfig.DefaultAudioKey) as IRoutingSinkWithSwitching;
|
||||
DefaultAudioDevice =
|
||||
DeviceManager.GetDeviceForKey(PropertiesConfig.DefaultAudioKey) as IRoutingSinkWithSwitching;
|
||||
|
||||
Initialize();
|
||||
}
|
||||
@@ -164,361 +31,122 @@ namespace PepperDash.Essentials
|
||||
}
|
||||
}
|
||||
|
||||
void Initialize()
|
||||
{
|
||||
public EssentialsHuddleRoomPropertiesConfig PropertiesConfig { get; private set; }
|
||||
|
||||
private void Initialize()
|
||||
{
|
||||
if (DefaultAudioDevice is IBasicVolumeControls)
|
||||
{
|
||||
DefaultVolumeControls = DefaultAudioDevice as IBasicVolumeControls;
|
||||
}
|
||||
else if (DefaultAudioDevice is IHasVolumeDevice)
|
||||
{
|
||||
DefaultVolumeControls = (DefaultAudioDevice as IHasVolumeDevice).VolumeDevice;
|
||||
}
|
||||
CurrentVolumeControls = DefaultVolumeControls;
|
||||
|
||||
var disp = DefaultDisplay as DisplayBase;
|
||||
if (disp != null)
|
||||
{
|
||||
// Link power, warming, cooling to display
|
||||
disp.PowerIsOnFeedback.OutputChange += (o, a) =>
|
||||
{
|
||||
if (disp.PowerIsOnFeedback.BoolValue != OnFeedback.BoolValue)
|
||||
{
|
||||
if (!disp.PowerIsOnFeedback.BoolValue)
|
||||
CurrentSourceInfo = null;
|
||||
OnFeedback.FireUpdate();
|
||||
}
|
||||
};
|
||||
SourceListKey = String.IsNullOrEmpty(PropertiesConfig.SourceListKey)
|
||||
? "default"
|
||||
: PropertiesConfig.SourceListKey;
|
||||
|
||||
disp.IsWarmingUpFeedback.OutputChange += (o, a) =>
|
||||
{
|
||||
IsWarmingUpFeedback.FireUpdate();
|
||||
if (!IsWarmingUpFeedback.BoolValue)
|
||||
(DefaultDisplay as IBasicVolumeWithFeedback).SetVolume(DefaultVolume);
|
||||
};
|
||||
disp.IsCoolingDownFeedback.OutputChange += (o, a) =>
|
||||
{
|
||||
IsCoolingDownFeedback.FireUpdate();
|
||||
};
|
||||
EnablePowerOnToLastSource = true;
|
||||
|
||||
var disp = DefaultDisplay as DisplayBase;
|
||||
if (disp == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SourceListKey = "default";
|
||||
EnablePowerOnToLastSource = true;
|
||||
}
|
||||
|
||||
IsWarmingFeedbackFunc = () => disp.IsWarmingUpFeedback.BoolValue;
|
||||
|
||||
IsCoolingFeedbackFunc = () => disp.IsCoolingDownFeedback.BoolValue;
|
||||
|
||||
OnFeedbackFunc = () => CurrentSourceInfo != null
|
||||
&& CurrentSourceInfo.Type == eSourceListItemType.Route;
|
||||
|
||||
InitializeDisplay(disp);
|
||||
}
|
||||
|
||||
protected override void IsCoolingDownFeedbackOnOutputChange(object sender, FeedbackEventArgs feedbackEventArgs)
|
||||
{
|
||||
IsCoolingDownFeedback.FireUpdate();
|
||||
}
|
||||
|
||||
protected override void PowerIsOnFeedbackOnOutputChange(object sender, FeedbackEventArgs feedbackEventArgs)
|
||||
{
|
||||
var display = sender as DisplayBase;
|
||||
|
||||
if (display == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (display.PowerIsOnFeedback.BoolValue == OnFeedback.BoolValue)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!display.PowerIsOnFeedback.BoolValue)
|
||||
{
|
||||
CurrentSourceInfo = null;
|
||||
}
|
||||
OnFeedback.FireUpdate();
|
||||
}
|
||||
|
||||
protected override void IsWarmingUpFeedbackOnOutputChange(object sender, FeedbackEventArgs feedbackEventArgs)
|
||||
{
|
||||
IsWarmingUpFeedback.FireUpdate();
|
||||
|
||||
if (IsWarmingUpFeedback.BoolValue)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var displayVolumeControl = DefaultDisplay as IBasicVolumeWithFeedback;
|
||||
|
||||
if (displayVolumeControl == null)
|
||||
{
|
||||
Debug.Console(0, this, Debug.ErrorLogLevel.Error,
|
||||
"Default display {0} is not volume control control provider", DefaultDisplay.Key);
|
||||
return;
|
||||
}
|
||||
|
||||
displayVolumeControl.SetVolume(DefaultVolume);
|
||||
}
|
||||
|
||||
protected override void CustomSetConfig(DeviceConfig config)
|
||||
{
|
||||
var newPropertiesConfig = JsonConvert.DeserializeObject<EssentialsHuddleRoomPropertiesConfig>(config.Properties.ToString());
|
||||
var newPropertiesConfig =
|
||||
JsonConvert.DeserializeObject<EssentialsHuddleRoomPropertiesConfig>(config.Properties.ToString());
|
||||
|
||||
if (newPropertiesConfig != null)
|
||||
PropertiesConfig = newPropertiesConfig;
|
||||
|
||||
ConfigWriter.UpdateRoomConfig(config);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
protected override void EndShutdown()
|
||||
{
|
||||
SetDefaultLevels();
|
||||
|
||||
RunDefaultPresentRoute();
|
||||
|
||||
CrestronEnvironment.Sleep(1000);
|
||||
|
||||
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Shutting down room");
|
||||
|
||||
RunRouteAction("roomOff");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Routes the default source item, if any
|
||||
/// </summary>
|
||||
public override bool RunDefaultPresentRoute()
|
||||
{
|
||||
if (DefaultSourceItem == null)
|
||||
{
|
||||
Debug.Console(0, this, "Unable to run default present route, DefaultSourceItem is null.");
|
||||
return false;
|
||||
PropertiesConfig = newPropertiesConfig;
|
||||
}
|
||||
|
||||
RunRouteAction(DefaultSourceItem);
|
||||
return true;
|
||||
ConfigWriter.UpdateRoomConfig(config);
|
||||
}
|
||||
|
||||
public override bool CustomActivate()
|
||||
{
|
||||
// Add Occupancy object from config
|
||||
if (PropertiesConfig.Occupancy != null)
|
||||
this.SetRoomOccupancy(DeviceManager.GetDeviceForKey(PropertiesConfig.Occupancy.DeviceKey) as
|
||||
{
|
||||
SetRoomOccupancy(DeviceManager.GetDeviceForKey(PropertiesConfig.Occupancy.DeviceKey) as
|
||||
IOccupancyStatusProvider, PropertiesConfig.Occupancy.TimeoutMinutes);
|
||||
}
|
||||
|
||||
this.LogoUrl = PropertiesConfig.Logo.GetUrl();
|
||||
this.SourceListKey = PropertiesConfig.SourceListKey;
|
||||
this.DefaultSourceItem = PropertiesConfig.DefaultSourceItem;
|
||||
this.DefaultVolume = (ushort)(PropertiesConfig.Volumes.Master.Level * 65535 / 100);
|
||||
LogoUrl = PropertiesConfig.Logo.GetUrl();
|
||||
SourceListKey = PropertiesConfig.SourceListKey;
|
||||
DefaultSourceItem = PropertiesConfig.DefaultSourceItem;
|
||||
DefaultVolume = (ushort) (PropertiesConfig.Volumes.Master.Level*65535/100);
|
||||
|
||||
return base.CustomActivate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="routeKey"></param>
|
||||
public void RunRouteAction(string routeKey)
|
||||
{
|
||||
RunRouteAction(routeKey, new Action(() => { }));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="routeKey"></param>
|
||||
/// <param name="souceListKey"></param>
|
||||
/// <param name="successCallback"></param>
|
||||
public void RunRouteAction(string routeKey, string souceListKey)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="routeKey"></param>
|
||||
/// <param name="souceListKey"></param>
|
||||
/// <param name="successCallback"></param>
|
||||
public void RunRouteAction(string routeKey, string souceListKey, Action successCallback)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a source from config list SourceListKey and dynamically build and executes the
|
||||
/// route or commands
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
public void RunRouteAction(string routeKey, Action successCallback)
|
||||
{
|
||||
// Run this on a separate thread
|
||||
new CTimer(o =>
|
||||
{
|
||||
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Run route action '{0}'", routeKey);
|
||||
var dict = ConfigReader.ConfigObject.GetSourceListForKey(SourceListKey);
|
||||
if(dict == null)
|
||||
{
|
||||
Debug.Console(1, this, "WARNING: Config source list '{0}' not found", SourceListKey);
|
||||
return;
|
||||
}
|
||||
|
||||
// Try to get the list item by it's string key
|
||||
if (!dict.ContainsKey(routeKey))
|
||||
{
|
||||
Debug.Console(1, this, "WARNING: No item '{0}' found on config list '{1}'",
|
||||
routeKey, SourceListKey);
|
||||
return;
|
||||
}
|
||||
|
||||
var item = dict[routeKey];
|
||||
//Debug.Console(2, this, "Action {0} has {1} steps",
|
||||
// item.SourceKey, item.RouteList.Count);
|
||||
|
||||
// End usage timer on last source
|
||||
if (!string.IsNullOrEmpty(LastSourceKey))
|
||||
{
|
||||
var lastSource = dict[LastSourceKey].SourceDevice;
|
||||
|
||||
try
|
||||
{
|
||||
if (lastSource != null && lastSource is IUsageTracking)
|
||||
(lastSource as IUsageTracking).UsageTracker.EndDeviceUsage();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Console(1, this, "*#* EXCEPTION in end usage tracking (257):\r{0}", e);
|
||||
}
|
||||
}
|
||||
|
||||
// Let's run it
|
||||
if (routeKey.ToLower() != "roomoff")
|
||||
{
|
||||
LastSourceKey = routeKey;
|
||||
}
|
||||
else
|
||||
{
|
||||
CurrentSourceInfoKey = null;
|
||||
}
|
||||
|
||||
foreach (var route in item.RouteList)
|
||||
{
|
||||
// if there is a $defaultAll on route, run two separate
|
||||
if (route.DestinationKey.Equals("$defaultAll", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// Going to assume a single-path route for now
|
||||
var tempVideo = new SourceRouteListItem
|
||||
{
|
||||
DestinationKey = "$defaultDisplay",
|
||||
SourceKey = route.SourceKey,
|
||||
Type = eRoutingSignalType.Video
|
||||
};
|
||||
DoRoute(tempVideo);
|
||||
|
||||
//var tempAudio = new SourceRouteListItem
|
||||
//{
|
||||
// DestinationKey = "$defaultAudio",
|
||||
// SourceKey = route.SourceKey,
|
||||
// Type = eRoutingSignalType.Audio
|
||||
//};
|
||||
//DoRoute(tempAudio);
|
||||
//continue; -- not sure why this was here
|
||||
}
|
||||
else
|
||||
DoRoute(route);
|
||||
}
|
||||
|
||||
// Start usage timer on routed source
|
||||
if (item.SourceDevice is IUsageTracking)
|
||||
{
|
||||
(item.SourceDevice as IUsageTracking).UsageTracker.StartDeviceUsage();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Set volume control, using default if non provided
|
||||
IBasicVolumeControls volDev = null;
|
||||
// Handle special cases for volume control
|
||||
if (string.IsNullOrEmpty(item.VolumeControlKey)
|
||||
|| item.VolumeControlKey.Equals("$defaultAudio", StringComparison.OrdinalIgnoreCase))
|
||||
volDev = DefaultVolumeControls;
|
||||
else if (item.VolumeControlKey.Equals("$defaultDisplay", StringComparison.OrdinalIgnoreCase))
|
||||
volDev = DefaultDisplay as IBasicVolumeControls;
|
||||
// Or a specific device, probably rarely used.
|
||||
else
|
||||
{
|
||||
var dev = DeviceManager.GetDeviceForKey(item.VolumeControlKey);
|
||||
if (dev is IBasicVolumeControls)
|
||||
volDev = dev as IBasicVolumeControls;
|
||||
else if (dev is IHasVolumeDevice)
|
||||
volDev = (dev as IHasVolumeDevice).VolumeDevice;
|
||||
}
|
||||
|
||||
if (volDev != CurrentVolumeControls)
|
||||
{
|
||||
// zero the volume on the device we are leaving.
|
||||
// Set the volume to default on device we are entering
|
||||
if (ZeroVolumeWhenSwtichingVolumeDevices && CurrentVolumeControls is IBasicVolumeWithFeedback)
|
||||
{
|
||||
var vd = CurrentVolumeControls as IBasicVolumeWithFeedback;
|
||||
SavedVolumeLevels[vd] = (uint)vd.VolumeLevelFeedback.IntValue;
|
||||
vd.SetVolume(0);
|
||||
}
|
||||
CurrentVolumeControls = volDev;
|
||||
if (ZeroVolumeWhenSwtichingVolumeDevices && CurrentVolumeControls is IBasicVolumeWithFeedback)
|
||||
{
|
||||
var vd = CurrentVolumeControls as IBasicVolumeWithFeedback;
|
||||
ushort vol = (SavedVolumeLevels.ContainsKey(vd) ? (ushort)SavedVolumeLevels[vd] : DefaultVolume);
|
||||
vd.SetVolume(vol);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// store the name and UI info for routes
|
||||
if (item.SourceKey == "$off")
|
||||
{
|
||||
CurrentSourceInfoKey = routeKey;
|
||||
CurrentSourceInfo = null;
|
||||
}
|
||||
else if (item.SourceKey != null)
|
||||
{
|
||||
CurrentSourceInfoKey = routeKey;
|
||||
CurrentSourceInfo = item;
|
||||
}
|
||||
// And finally, set the "control". This will trigger event
|
||||
//CurrentControlDevice = DeviceManager.GetDeviceForKey(item.SourceKey) as Device;
|
||||
|
||||
OnFeedback.FireUpdate();
|
||||
|
||||
// report back when done
|
||||
if (successCallback != null)
|
||||
successCallback();
|
||||
|
||||
}, 0); // end of CTimer
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Will power the room on with the last-used source
|
||||
/// </summary>
|
||||
public override void PowerOnToDefaultOrLastSource()
|
||||
{
|
||||
if (!EnablePowerOnToLastSource || LastSourceKey == null)
|
||||
return;
|
||||
RunRouteAction(LastSourceKey);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Does what it says
|
||||
/// </summary>
|
||||
public override void SetDefaultLevels()
|
||||
{
|
||||
Debug.Console(1, this, "Restoring default levels");
|
||||
var vc = CurrentVolumeControls as IBasicVolumeWithFeedback;
|
||||
if (vc != null)
|
||||
vc.SetVolume(DefaultVolume);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="route"></param>
|
||||
/// <returns></returns>
|
||||
bool DoRoute(SourceRouteListItem route)
|
||||
{
|
||||
IRoutingSinkNoSwitching dest = null;
|
||||
|
||||
if (route.DestinationKey.Equals("$defaultaudio", StringComparison.OrdinalIgnoreCase))
|
||||
dest = DefaultAudioDevice;
|
||||
else if (route.DestinationKey.Equals("$defaultDisplay", StringComparison.OrdinalIgnoreCase))
|
||||
dest = DefaultDisplay;
|
||||
else
|
||||
dest = DeviceManager.GetDeviceForKey(route.DestinationKey) as IRoutingSinkNoSwitching;
|
||||
|
||||
if (dest == null)
|
||||
{
|
||||
Debug.Console(1, this, "Cannot route, unknown destination '{0}'", route.DestinationKey);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (route.SourceKey.Equals("$off", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
dest.ReleaseRoute();
|
||||
if (dest is IPower)
|
||||
(dest as IPower).PowerOff();
|
||||
}
|
||||
else
|
||||
{
|
||||
var source = DeviceManager.GetDeviceForKey(route.SourceKey) as IRoutingOutputs;
|
||||
if (source == null)
|
||||
{
|
||||
Debug.Console(1, this, "Cannot route unknown source '{0}' to {1}", route.SourceKey, route.DestinationKey);
|
||||
return false;
|
||||
}
|
||||
dest.ReleaseAndMakeRoute(source, route.Type);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void RoomVacatedForTimeoutPeriod(object o)
|
||||
{
|
||||
//Implement this
|
||||
//TODO: Implement RoomVacatedForTimeoutPeriod
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Runs "roomOff" action on all rooms not set to ExcludeFromGlobalFunctions
|
||||
/// </summary>
|
||||
public static void AllRoomsOff()
|
||||
{
|
||||
var allRooms = DeviceManager.AllDevices.Where(d =>
|
||||
d is EssentialsHuddleSpaceRoom && !(d as EssentialsHuddleSpaceRoom).ExcludeFromGlobalFunctions);
|
||||
foreach (var room in allRooms)
|
||||
(room as EssentialsHuddleSpaceRoom).RunRouteAction("roomOff");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
@@ -49,58 +47,7 @@ namespace PepperDash.Essentials
|
||||
public BoolFeedback IsSharingFeedback { get; private set; }
|
||||
|
||||
//************************
|
||||
|
||||
|
||||
protected override Func<bool> OnFeedbackFunc
|
||||
{
|
||||
get
|
||||
{
|
||||
return () =>
|
||||
{
|
||||
var disp = DefaultDisplay as DisplayBase;
|
||||
var val = CurrentSourceInfo != null
|
||||
&& CurrentSourceInfo.Type == eSourceListItemType.Route
|
||||
&& disp != null;
|
||||
//&& disp.PowerIsOnFeedback.BoolValue;
|
||||
return val;
|
||||
};
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
protected override Func<bool> IsWarmingFeedbackFunc
|
||||
{
|
||||
get
|
||||
{
|
||||
return () =>
|
||||
{
|
||||
var disp = DefaultDisplay as DisplayBase;
|
||||
if (disp != null)
|
||||
return disp.IsWarmingUpFeedback.BoolValue;
|
||||
else
|
||||
return false;
|
||||
};
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
protected override Func<bool> IsCoolingFeedbackFunc
|
||||
{
|
||||
get
|
||||
{
|
||||
return () =>
|
||||
{
|
||||
var disp = DefaultDisplay as DisplayBase;
|
||||
if (disp != null)
|
||||
return disp.IsCoolingDownFeedback.BoolValue;
|
||||
else
|
||||
return false;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public EssentialsHuddleVtc1PropertiesConfig PropertiesConfig { get; private set; }
|
||||
|
||||
public IRoutingSinkWithSwitching DefaultDisplay { get; private set; }
|
||||
@@ -121,64 +68,36 @@ namespace PepperDash.Essentials
|
||||
/// If room is off, enables power on to last source. Default true
|
||||
/// </summary>
|
||||
public bool EnablePowerOnToLastSource { get; set; }
|
||||
string LastSourceKey;
|
||||
|
||||
/// <summary>
|
||||
/// Sets the volume control device, and attaches/removes InUseTrackers with "audio"
|
||||
/// tag to device.
|
||||
/// </summary>
|
||||
public IBasicVolumeControls CurrentVolumeControls
|
||||
{
|
||||
get { return _CurrentAudioDevice; }
|
||||
set
|
||||
{
|
||||
if (value == _CurrentAudioDevice) return;
|
||||
|
||||
var oldDev = _CurrentAudioDevice;
|
||||
// derigister this room from the device, if it can
|
||||
if (oldDev is IInUseTracking)
|
||||
(oldDev as IInUseTracking).InUseTracker.RemoveUser(this, "audio");
|
||||
var handler = CurrentVolumeDeviceChange;
|
||||
if (handler != null)
|
||||
CurrentVolumeDeviceChange(this, new VolumeDeviceChangeEventArgs(oldDev, value, ChangeType.WillChange));
|
||||
_CurrentAudioDevice = value;
|
||||
if (handler != null)
|
||||
CurrentVolumeDeviceChange(this, new VolumeDeviceChangeEventArgs(oldDev, value, ChangeType.DidChange));
|
||||
// register this room with new device, if it can
|
||||
if (_CurrentAudioDevice is IInUseTracking)
|
||||
(_CurrentAudioDevice as IInUseTracking).InUseTracker.AddUser(this, "audio");
|
||||
}
|
||||
}
|
||||
IBasicVolumeControls _CurrentAudioDevice;
|
||||
private string _lastSourceKey;
|
||||
|
||||
/// <summary>
|
||||
/// The SourceListItem last run - containing names and icons
|
||||
/// </summary>
|
||||
public SourceListItem CurrentSourceInfo
|
||||
{
|
||||
get { return _CurrentSourceInfo; }
|
||||
get { return _currentSourceInfo; }
|
||||
set
|
||||
{
|
||||
if (value == _CurrentSourceInfo) return;
|
||||
if (value == _currentSourceInfo) return;
|
||||
|
||||
var handler = CurrentSourceChange;
|
||||
// remove from in-use tracker, if so equipped
|
||||
if(_CurrentSourceInfo != null && _CurrentSourceInfo.SourceDevice is IInUseTracking)
|
||||
(_CurrentSourceInfo.SourceDevice as IInUseTracking).InUseTracker.RemoveUser(this, "control");
|
||||
if(_currentSourceInfo != null && _currentSourceInfo.SourceDevice is IInUseTracking)
|
||||
(_currentSourceInfo.SourceDevice as IInUseTracking).InUseTracker.RemoveUser(this, "control");
|
||||
|
||||
if (handler != null)
|
||||
handler(_CurrentSourceInfo, ChangeType.WillChange);
|
||||
handler(_currentSourceInfo, ChangeType.WillChange);
|
||||
|
||||
_CurrentSourceInfo = value;
|
||||
_currentSourceInfo = value;
|
||||
|
||||
// add to in-use tracking
|
||||
if (_CurrentSourceInfo != null && _CurrentSourceInfo.SourceDevice is IInUseTracking)
|
||||
(_CurrentSourceInfo.SourceDevice as IInUseTracking).InUseTracker.AddUser(this, "control");
|
||||
if (_currentSourceInfo != null && _currentSourceInfo.SourceDevice is IInUseTracking)
|
||||
(_currentSourceInfo.SourceDevice as IInUseTracking).InUseTracker.AddUser(this, "control");
|
||||
if (handler != null)
|
||||
handler(_CurrentSourceInfo, ChangeType.DidChange);
|
||||
handler(_currentSourceInfo, ChangeType.DidChange);
|
||||
}
|
||||
}
|
||||
SourceListItem _CurrentSourceInfo;
|
||||
private SourceListItem _currentSourceInfo;
|
||||
|
||||
public string CurrentSourceInfoKey { get; set; }
|
||||
|
||||
@@ -193,7 +112,7 @@ namespace PepperDash.Essentials
|
||||
/// </summary>
|
||||
public IHasScheduleAwareness ScheduleSource { get { return VideoCodec as IHasScheduleAwareness; } }
|
||||
|
||||
CCriticalSection SourceSelectLock = new CCriticalSection();
|
||||
private readonly CCriticalSection _sourceSelectLock = new CCriticalSection();
|
||||
|
||||
public EssentialsHuddleVtc1Room(DeviceConfig config)
|
||||
: base(config)
|
||||
@@ -205,12 +124,12 @@ namespace PepperDash.Essentials
|
||||
DefaultDisplay = DeviceManager.GetDeviceForKey(PropertiesConfig.DefaultDisplayKey) as IRoutingSinkWithSwitching;
|
||||
|
||||
VideoCodec = DeviceManager.GetDeviceForKey(PropertiesConfig.VideoCodecKey) as
|
||||
PepperDash.Essentials.Devices.Common.VideoCodec.VideoCodecBase;
|
||||
VideoCodecBase;
|
||||
if (VideoCodec == null)
|
||||
throw new ArgumentNullException("codec cannot be null");
|
||||
|
||||
AudioCodec = DeviceManager.GetDeviceForKey(PropertiesConfig.AudioCodecKey) as
|
||||
PepperDash.Essentials.Devices.Common.AudioCodec.AudioCodecBase;
|
||||
AudioCodecBase;
|
||||
if (AudioCodec == null)
|
||||
Debug.Console(0, this, "No Audio Codec Found");
|
||||
|
||||
@@ -228,8 +147,8 @@ namespace PepperDash.Essentials
|
||||
{
|
||||
try
|
||||
{
|
||||
if (DefaultAudioDevice is IBasicVolumeControls)
|
||||
DefaultVolumeControls = DefaultAudioDevice as IBasicVolumeControls;
|
||||
if (DefaultAudioDevice != null)
|
||||
DefaultVolumeControls = DefaultAudioDevice;
|
||||
else if (DefaultAudioDevice is IHasVolumeDevice)
|
||||
DefaultVolumeControls = (DefaultAudioDevice as IHasVolumeDevice).VolumeDevice;
|
||||
CurrentVolumeControls = DefaultVolumeControls;
|
||||
@@ -238,8 +157,8 @@ namespace PepperDash.Essentials
|
||||
// Combines call feedback from both codecs if available
|
||||
InCallFeedback = new BoolFeedback(() =>
|
||||
{
|
||||
bool inAudioCall = false;
|
||||
bool inVideoCall = false;
|
||||
var inAudioCall = false;
|
||||
var inVideoCall = false;
|
||||
|
||||
if (AudioCodec != null)
|
||||
inAudioCall = AudioCodec.IsInCall;
|
||||
@@ -247,72 +166,48 @@ namespace PepperDash.Essentials
|
||||
if (VideoCodec != null)
|
||||
inVideoCall = VideoCodec.IsInCall;
|
||||
|
||||
if (inAudioCall || inVideoCall)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
return inAudioCall || inVideoCall;
|
||||
});
|
||||
|
||||
var disp = DefaultDisplay as DisplayBase;
|
||||
if (disp != null)
|
||||
{
|
||||
// Link power, warming, cooling to display
|
||||
disp.PowerIsOnFeedback.OutputChange += (o, a) =>
|
||||
{
|
||||
if (disp.PowerIsOnFeedback.BoolValue != OnFeedback.BoolValue)
|
||||
{
|
||||
if (!disp.PowerIsOnFeedback.BoolValue)
|
||||
CurrentSourceInfo = null;
|
||||
OnFeedback.FireUpdate();
|
||||
}
|
||||
if (disp.PowerIsOnFeedback.BoolValue)
|
||||
{
|
||||
SetDefaultLevels();
|
||||
}
|
||||
};
|
||||
|
||||
disp.IsWarmingUpFeedback.OutputChange += (o, a) =>
|
||||
{
|
||||
IsWarmingUpFeedback.FireUpdate();
|
||||
if (!IsWarmingUpFeedback.BoolValue)
|
||||
(CurrentVolumeControls as IBasicVolumeWithFeedback).SetVolume(DefaultVolume);
|
||||
};
|
||||
disp.IsCoolingDownFeedback.OutputChange += (o, a) =>
|
||||
{
|
||||
IsCoolingDownFeedback.FireUpdate();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Get Microphone Privacy object, if any MUST HAPPEN AFTER setting InCallFeedback
|
||||
this.MicrophonePrivacy = EssentialsRoomConfigHelper.GetMicrophonePrivacy(PropertiesConfig, this);
|
||||
MicrophonePrivacy = EssentialsRoomConfigHelper.GetMicrophonePrivacy(PropertiesConfig, this);
|
||||
|
||||
Debug.Console(2, this, "Microphone Privacy Config evaluated.");
|
||||
|
||||
// Get emergency object, if any
|
||||
this.Emergency = EssentialsRoomConfigHelper.GetEmergency(PropertiesConfig, this);
|
||||
Emergency = EssentialsRoomConfigHelper.GetEmergency(PropertiesConfig, this);
|
||||
|
||||
Debug.Console(2, this, "Emergency Config evaluated.");
|
||||
|
||||
|
||||
VideoCodec.CallStatusChange += (o, a) => this.InCallFeedback.FireUpdate();
|
||||
VideoCodec.CallStatusChange += (o, a) => InCallFeedback.FireUpdate();
|
||||
|
||||
if (AudioCodec != null)
|
||||
AudioCodec.CallStatusChange += (o, a) => this.InCallFeedback.FireUpdate();
|
||||
AudioCodec.CallStatusChange += (o, a) => InCallFeedback.FireUpdate();
|
||||
|
||||
IsSharingFeedback = new BoolFeedback(() => VideoCodec.SharingContentIsOnFeedback.BoolValue);
|
||||
VideoCodec.SharingContentIsOnFeedback.OutputChange += (o, a) => this.IsSharingFeedback.FireUpdate();
|
||||
VideoCodec.SharingContentIsOnFeedback.OutputChange += (o, a) => IsSharingFeedback.FireUpdate();
|
||||
|
||||
// link privacy to VC (for now?)
|
||||
PrivacyModeIsOnFeedback = new BoolFeedback(() => VideoCodec.PrivacyModeIsOnFeedback.BoolValue);
|
||||
VideoCodec.PrivacyModeIsOnFeedback.OutputChange += (o, a) => this.PrivacyModeIsOnFeedback.FireUpdate();
|
||||
VideoCodec.PrivacyModeIsOnFeedback.OutputChange += (o, a) => PrivacyModeIsOnFeedback.FireUpdate();
|
||||
|
||||
CallTypeFeedback = new IntFeedback(() => 0);
|
||||
|
||||
SourceListKey = "default";
|
||||
EnablePowerOnToLastSource = true;
|
||||
|
||||
var disp = DefaultDisplay as DisplayBase;
|
||||
if (disp == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
OnFeedbackFunc = () => CurrentSourceInfo != null
|
||||
&& CurrentSourceInfo.Type == eSourceListItemType.Route;
|
||||
|
||||
InitializeDisplay(disp);
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -320,6 +215,50 @@ namespace PepperDash.Essentials
|
||||
}
|
||||
}
|
||||
|
||||
#region Overrides of EssentialsRoomBase
|
||||
|
||||
protected override void PowerIsOnFeedbackOnOutputChange(object sender, FeedbackEventArgs args)
|
||||
{
|
||||
var disp = sender as DisplayBase;
|
||||
|
||||
if (disp == null) return;
|
||||
|
||||
if (disp.PowerIsOnFeedback.BoolValue != OnFeedback.BoolValue)
|
||||
{
|
||||
if (!disp.PowerIsOnFeedback.BoolValue)
|
||||
CurrentSourceInfo = null;
|
||||
OnFeedback.FireUpdate();
|
||||
}
|
||||
if (disp.PowerIsOnFeedback.BoolValue)
|
||||
{
|
||||
SetDefaultLevels();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void IsCoolingDownFeedbackOnOutputChange(object sender, FeedbackEventArgs args)
|
||||
{
|
||||
IsCoolingDownFeedback.FireUpdate();
|
||||
}
|
||||
|
||||
protected override void IsWarmingUpFeedbackOnOutputChange(object sender, FeedbackEventArgs args)
|
||||
{
|
||||
IsWarmingUpFeedback.FireUpdate();
|
||||
|
||||
if (IsWarmingUpFeedback.BoolValue)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var basicVolumeWithFeedback = CurrentVolumeControls as IBasicVolumeWithFeedback;
|
||||
if (basicVolumeWithFeedback != null)
|
||||
{
|
||||
basicVolumeWithFeedback.SetVolume(DefaultVolume);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
protected override void CustomSetConfig(DeviceConfig config)
|
||||
{
|
||||
var newPropertiesConfig = JsonConvert.DeserializeObject<EssentialsHuddleVtc1PropertiesConfig>(config.Properties.ToString());
|
||||
@@ -336,14 +275,14 @@ namespace PepperDash.Essentials
|
||||
if (PropertiesConfig.Occupancy != null)
|
||||
{
|
||||
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Setting Occupancy Provider for room");
|
||||
this.SetRoomOccupancy(DeviceManager.GetDeviceForKey(PropertiesConfig.Occupancy.DeviceKey) as
|
||||
SetRoomOccupancy(DeviceManager.GetDeviceForKey(PropertiesConfig.Occupancy.DeviceKey) as
|
||||
IOccupancyStatusProvider, PropertiesConfig.Occupancy.TimeoutMinutes);
|
||||
}
|
||||
|
||||
this.LogoUrl = PropertiesConfig.Logo.GetUrl();
|
||||
this.SourceListKey = PropertiesConfig.SourceListKey;
|
||||
this.DefaultSourceItem = PropertiesConfig.DefaultSourceItem;
|
||||
this.DefaultVolume = (ushort)(PropertiesConfig.Volumes.Master.Level * 65535 / 100);
|
||||
LogoUrl = PropertiesConfig.Logo.GetUrl();
|
||||
SourceListKey = PropertiesConfig.SourceListKey;
|
||||
DefaultSourceItem = PropertiesConfig.DefaultSourceItem;
|
||||
DefaultVolume = (ushort)(PropertiesConfig.Volumes.Master.Level * 65535 / 100);
|
||||
|
||||
return base.CustomActivate();
|
||||
}
|
||||
@@ -392,9 +331,9 @@ namespace PepperDash.Essentials
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="routeKey"></param>
|
||||
public void RunRouteAction(string routeKey)
|
||||
public override void RunRouteAction(string routeKey)
|
||||
{
|
||||
RunRouteAction(routeKey, new Action(() => { }));
|
||||
RunRouteAction(routeKey, () => { });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -402,7 +341,6 @@ namespace PepperDash.Essentials
|
||||
/// </summary>
|
||||
/// <param name="routeKey"></param>
|
||||
/// <param name="souceListKey"></param>
|
||||
/// <param name="successCallback"></param>
|
||||
public void RunRouteAction(string routeKey, string souceListKey)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
@@ -419,18 +357,18 @@ namespace PepperDash.Essentials
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a source from config list SourceListKey and dynamically build and executes the
|
||||
/// route or commands
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <summary>
|
||||
/// Gets a source from config list SourceListKey and dynamically build and executes the
|
||||
/// route or commands
|
||||
/// </summary>
|
||||
public void RunRouteAction(string routeKey, Action successCallback)
|
||||
{
|
||||
// Run this on a separate thread
|
||||
new CTimer(o =>
|
||||
//new CTimer
|
||||
CrestronInvoke.BeginInvoke(o =>
|
||||
{
|
||||
// try to prevent multiple simultaneous selections
|
||||
SourceSelectLock.TryEnter();
|
||||
_sourceSelectLock.TryEnter();
|
||||
|
||||
try
|
||||
{
|
||||
@@ -452,9 +390,9 @@ namespace PepperDash.Essentials
|
||||
}
|
||||
|
||||
// End usage timer on last source
|
||||
if (!string.IsNullOrEmpty(LastSourceKey))
|
||||
if (!string.IsNullOrEmpty(_lastSourceKey))
|
||||
{
|
||||
var usageLastSource = dict[LastSourceKey].SourceDevice as IUsageTracking;
|
||||
var usageLastSource = dict[_lastSourceKey].SourceDevice as IUsageTracking;
|
||||
if (usageLastSource != null && usageLastSource.UsageTracker != null)
|
||||
{
|
||||
try
|
||||
@@ -474,7 +412,7 @@ namespace PepperDash.Essentials
|
||||
if (routeKey.ToLower() != "roomoff")
|
||||
{
|
||||
|
||||
LastSourceKey = routeKey;
|
||||
_lastSourceKey = routeKey;
|
||||
}
|
||||
else
|
||||
CurrentSourceInfoKey = null;
|
||||
@@ -526,7 +464,7 @@ namespace PepperDash.Essentials
|
||||
if (ZeroVolumeWhenSwtichingVolumeDevices && CurrentVolumeControls is IBasicVolumeWithFeedback)
|
||||
{
|
||||
var vd = CurrentVolumeControls as IBasicVolumeWithFeedback;
|
||||
ushort vol = (SavedVolumeLevels.ContainsKey(vd) ? (ushort)SavedVolumeLevels[vd] : DefaultVolume);
|
||||
var vol = (SavedVolumeLevels.ContainsKey(vd) ? (ushort)SavedVolumeLevels[vd] : DefaultVolume);
|
||||
vd.SetVolume(vol);
|
||||
}
|
||||
}
|
||||
@@ -557,7 +495,7 @@ namespace PepperDash.Essentials
|
||||
Debug.Console(1, this, "ERROR in routing: {0}", e);
|
||||
}
|
||||
|
||||
SourceSelectLock.Leave();
|
||||
_sourceSelectLock.Leave();
|
||||
}, 0); // end of CTimer
|
||||
}
|
||||
|
||||
@@ -588,9 +526,9 @@ namespace PepperDash.Essentials
|
||||
/// </summary>
|
||||
/// <param name="route"></param>
|
||||
/// <returns></returns>
|
||||
bool DoRoute(SourceRouteListItem route)
|
||||
private bool DoRoute(SourceRouteListItem route)
|
||||
{
|
||||
IRoutingSinkNoSwitching dest = null;
|
||||
IRoutingSink dest;
|
||||
|
||||
if (route.DestinationKey.Equals("$defaultaudio", StringComparison.OrdinalIgnoreCase))
|
||||
dest = DefaultAudioDevice as IRoutingSinkNoSwitching;
|
||||
@@ -644,9 +582,9 @@ namespace PepperDash.Essentials
|
||||
/// </summary>
|
||||
public override void PowerOnToDefaultOrLastSource()
|
||||
{
|
||||
if (!EnablePowerOnToLastSource || LastSourceKey == null)
|
||||
if (!EnablePowerOnToLastSource || _lastSourceKey == null)
|
||||
return;
|
||||
RunRouteAction(LastSourceKey);
|
||||
RunRouteAction(_lastSourceKey);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -657,7 +595,13 @@ namespace PepperDash.Essentials
|
||||
var allRooms = DeviceManager.AllDevices.Where(d =>
|
||||
d is EssentialsHuddleSpaceRoom && !(d as EssentialsHuddleSpaceRoom).ExcludeFromGlobalFunctions);
|
||||
foreach (var room in allRooms)
|
||||
(room as EssentialsHuddleSpaceRoom).RunRouteAction("roomOff");
|
||||
{
|
||||
var essentialsHuddleSpaceRoom = room as EssentialsHuddleSpaceRoom;
|
||||
if (essentialsHuddleSpaceRoom != null)
|
||||
{
|
||||
essentialsHuddleSpaceRoom.RunRouteAction("roomOff");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region IPrivacy Members
|
||||
|
||||
@@ -1,16 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
using PepperDash.Core;
|
||||
using System.Collections.Generic;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Devices;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.Room.Config;
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
{
|
||||
@@ -23,7 +13,7 @@ namespace PepperDash.Essentials
|
||||
|
||||
public Dictionary<eSourceListItemDestinationTypes, IRoutingSinkWithSwitching> Displays { get; protected set;}
|
||||
|
||||
public EssentialsNDisplayRoomBase(DeviceConfig config)
|
||||
protected EssentialsNDisplayRoomBase(DeviceConfig config)
|
||||
: base (config)
|
||||
{
|
||||
Displays = new Dictionary<eSourceListItemDestinationTypes, IRoutingSinkWithSwitching>();
|
||||
|
||||
@@ -211,7 +211,7 @@ namespace PepperDash.Essentials
|
||||
var comm = CommFactory.GetControlPropertiesConfig(dc);
|
||||
var props = Newtonsoft.Json.JsonConvert.DeserializeObject<CrestronTouchpanelPropertiesConfig>(dc.Properties.ToString());
|
||||
|
||||
Debug.Console(1, "Factory Attempting to create new Generic Comm Device");
|
||||
Debug.Console(1, "Factory Attempting to create new EssentialsTouchpanelController");
|
||||
|
||||
var panelController = new EssentialsTouchpanelController(dc.Key, dc.Name, dc.Type, props, comm.IpIdInt);
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ namespace PepperDash.Essentials
|
||||
/// <summary>
|
||||
/// Reads the device keys from the config and gets the devices by key
|
||||
/// </summary>
|
||||
public void GetDevicesFromConfig(Room.Config.EssentialsEnvironmentPropertiesConfig EnvironmentPropertiesConfig)
|
||||
public void GetDevicesFromConfig(Core.Rooms.Config.EssentialsEnvironmentPropertiesConfig EnvironmentPropertiesConfig)
|
||||
{
|
||||
if (EnvironmentPropertiesConfig != null)
|
||||
{
|
||||
|
||||
@@ -10,10 +10,11 @@ using Crestron.SimplSharpPro.DeviceSupport;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Devices.VideoCodec;
|
||||
using PepperDash.Essentials.Core.SmartObjects;
|
||||
using PepperDash.Essentials.Core.PageManagers;
|
||||
using PepperDash.Essentials.Room.Config;
|
||||
using PepperDash.Essentials.Devices.Common.Codec;
|
||||
using PepperDash.Essentials.Core.Rooms.Config;
|
||||
using PepperDash.Essentials.Core.Devices.Codec;
|
||||
using PepperDash.Essentials.Devices.Common.VideoCodec;
|
||||
|
||||
|
||||
|
||||
@@ -2,13 +2,11 @@
|
||||
using System.Collections.Generic;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.UI;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.Core.SmartObjects;
|
||||
using PepperDash.Essentials.Core.PageManagers;
|
||||
using PepperDash.Essentials.UIDrivers;
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
{
|
||||
@@ -17,7 +15,7 @@ namespace PepperDash.Essentials
|
||||
/// </summary>
|
||||
public class EssentialsHuddlePanelAvFunctionsDriver : PanelDriverBase, IAVDriver
|
||||
{
|
||||
CrestronTouchpanelPropertiesConfig Config;
|
||||
private readonly CrestronTouchpanelPropertiesConfig _config;
|
||||
|
||||
public enum UiDisplayMode
|
||||
{
|
||||
@@ -35,8 +33,8 @@ namespace PepperDash.Essentials
|
||||
/// </summary>
|
||||
public uint VolumeButtonPopupTimeout
|
||||
{
|
||||
get { return VolumeButtonsPopupFeedback.TimeoutMs; }
|
||||
set { VolumeButtonsPopupFeedback.TimeoutMs = value; }
|
||||
get { return _volumeButtonsPopupFeedback.TimeoutMs; }
|
||||
set { _volumeButtonsPopupFeedback.TimeoutMs = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -44,8 +42,8 @@ namespace PepperDash.Essentials
|
||||
/// </summary>
|
||||
public uint VolumeGaugePopupTimeout
|
||||
{
|
||||
get { return VolumeGaugeFeedback.TimeoutMs; }
|
||||
set { VolumeGaugeFeedback.TimeoutMs = value; }
|
||||
get { return _volumeGaugeFeedback.TimeoutMs; }
|
||||
set { _volumeGaugeFeedback.TimeoutMs = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -53,21 +51,12 @@ namespace PepperDash.Essentials
|
||||
/// </summary>
|
||||
public uint PowerOffTimeout { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string DefaultRoomKey
|
||||
{
|
||||
get { return _DefaultRoomKey; }
|
||||
set
|
||||
{
|
||||
_DefaultRoomKey = value;
|
||||
//CurrentRoom = DeviceManager.GetDeviceForKey(value) as EssentialsHuddleSpaceRoom;
|
||||
}
|
||||
}
|
||||
string _DefaultRoomKey;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string DefaultRoomKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
/// Indicates that the SetHeaderButtons method has completed successfully
|
||||
/// </summary>
|
||||
public bool HeaderButtonsAreSetUp { get; private set; }
|
||||
@@ -77,13 +66,13 @@ namespace PepperDash.Essentials
|
||||
/// </summary>
|
||||
public EssentialsHuddleSpaceRoom CurrentRoom
|
||||
{
|
||||
get { return _CurrentRoom; }
|
||||
get { return _currentRoom; }
|
||||
set
|
||||
{
|
||||
SetCurrentRoom(value);
|
||||
}
|
||||
}
|
||||
EssentialsHuddleSpaceRoom _CurrentRoom;
|
||||
EssentialsHuddleSpaceRoom _currentRoom;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -93,88 +82,86 @@ namespace PepperDash.Essentials
|
||||
/// <summary>
|
||||
/// For hitting feedback
|
||||
/// </summary>
|
||||
BoolInputSig ShareButtonSig;
|
||||
BoolInputSig EndMeetingButtonSig;
|
||||
private readonly BoolInputSig _shareButtonSig;
|
||||
private BoolInputSig _endMeetingButtonSig;
|
||||
|
||||
/// <summary>
|
||||
/// Controls the extended period that the volume gauge shows on-screen,
|
||||
/// as triggered by Volume up/down operations
|
||||
/// </summary>
|
||||
BoolFeedbackPulseExtender VolumeGaugeFeedback;
|
||||
private readonly BoolFeedbackPulseExtender _volumeGaugeFeedback;
|
||||
|
||||
/// <summary>
|
||||
/// Controls the period that the volume buttons show on non-hard-button
|
||||
/// interfaces
|
||||
/// </summary>
|
||||
BoolFeedbackPulseExtender VolumeButtonsPopupFeedback;
|
||||
private readonly BoolFeedbackPulseExtender _volumeButtonsPopupFeedback;
|
||||
|
||||
/// <summary>
|
||||
/// The parent driver for this
|
||||
/// </summary>
|
||||
PanelDriverBase Parent;
|
||||
private readonly PanelDriverBase _parent;
|
||||
|
||||
/// <summary>
|
||||
/// All children attached to this driver. For hiding and showing as a group.
|
||||
/// </summary>
|
||||
List<PanelDriverBase> ChildDrivers = new List<PanelDriverBase>();
|
||||
private List<PanelDriverBase> _childDrivers = new List<PanelDriverBase>();
|
||||
|
||||
List<BoolInputSig> CurrentDisplayModeSigsInUse = new List<BoolInputSig>();
|
||||
private readonly List<BoolInputSig> _currentDisplayModeSigsInUse = new List<BoolInputSig>();
|
||||
|
||||
//// Important smart objects
|
||||
|
||||
/// <summary>
|
||||
/// Smart Object 3200
|
||||
/// </summary>
|
||||
SubpageReferenceList SourcesSrl;
|
||||
private readonly SubpageReferenceList _sourcesSrl;
|
||||
|
||||
/// <summary>
|
||||
/// Smart Object 15022
|
||||
/// </summary>
|
||||
SubpageReferenceList ActivityFooterSrl;
|
||||
private readonly SubpageReferenceList _activityFooterSrl;
|
||||
|
||||
/// <summary>
|
||||
/// Tracks which audio page group the UI is in
|
||||
/// </summary>
|
||||
UiDisplayMode CurrentDisplayMode;
|
||||
private UiDisplayMode _currentDisplayMode;
|
||||
|
||||
/// <summary>
|
||||
/// The AV page mangagers that have been used, to keep them alive for later
|
||||
/// </summary>
|
||||
Dictionary<object, PageManager> PageManagers = new Dictionary<object, PageManager>();
|
||||
private readonly Dictionary<object, PageManager> _pageManagers = new Dictionary<object, PageManager>();
|
||||
|
||||
/// <summary>
|
||||
/// Current page manager running for a source
|
||||
/// </summary>
|
||||
PageManager CurrentSourcePageManager;
|
||||
private PageManager _currentSourcePageManager;
|
||||
|
||||
/// <summary>
|
||||
/// Will auto-timeout a power off
|
||||
/// </summary>
|
||||
CTimer PowerOffTimer;
|
||||
private CTimer _powerOffTimer;
|
||||
|
||||
ModalDialog PowerDownModal;
|
||||
private ModalDialog _powerDownModal;
|
||||
|
||||
public JoinedSigInterlock PopupInterlock { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The driver for the tech page. Lazy getter for memory usage
|
||||
/// </summary>
|
||||
PepperDash.Essentials.UIDrivers.EssentialsHuddleTechPageDriver TechDriver
|
||||
EssentialsHuddleTechPageDriver TechDriver
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_TechDriver == null)
|
||||
_TechDriver = new PepperDash.Essentials.UIDrivers.EssentialsHuddleTechPageDriver(TriList, CurrentRoom.PropertiesConfig.Tech);
|
||||
return _TechDriver;
|
||||
get {
|
||||
return _techDriver ??
|
||||
(_techDriver = new EssentialsHuddleTechPageDriver(TriList, CurrentRoom.PropertiesConfig.Tech));
|
||||
}
|
||||
}
|
||||
PepperDash.Essentials.UIDrivers.EssentialsHuddleTechPageDriver _TechDriver;
|
||||
private EssentialsHuddleTechPageDriver _techDriver;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Controls timeout of notification ribbon timer
|
||||
/// </summary>
|
||||
CTimer RibbonTimer;
|
||||
private CTimer _ribbonTimer;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
@@ -182,25 +169,25 @@ namespace PepperDash.Essentials
|
||||
public EssentialsHuddlePanelAvFunctionsDriver(PanelDriverBase parent, CrestronTouchpanelPropertiesConfig config)
|
||||
: base(parent.TriList)
|
||||
{
|
||||
Config = config;
|
||||
Parent = parent;
|
||||
_config = config;
|
||||
_parent = parent;
|
||||
PopupInterlock = new JoinedSigInterlock(TriList);
|
||||
|
||||
SourcesSrl = new SubpageReferenceList(TriList, 3200, 3, 3, 3);
|
||||
ActivityFooterSrl = new SubpageReferenceList(TriList, 15022, 3, 3, 3);
|
||||
ShareButtonSig = ActivityFooterSrl.BoolInputSig(1, 1);
|
||||
_sourcesSrl = new SubpageReferenceList(TriList, 3200, 3, 3, 3);
|
||||
_activityFooterSrl = new SubpageReferenceList(TriList, 15022, 3, 3, 3);
|
||||
_shareButtonSig = _activityFooterSrl.BoolInputSig(1, 1);
|
||||
|
||||
SetupActivityFooterWhenRoomOff();
|
||||
|
||||
ShowVolumeGauge = true;
|
||||
|
||||
// One-second pulse extender for volume gauge
|
||||
VolumeGaugeFeedback = new BoolFeedbackPulseExtender(1500);
|
||||
VolumeGaugeFeedback.Feedback
|
||||
_volumeGaugeFeedback = new BoolFeedbackPulseExtender(1500);
|
||||
_volumeGaugeFeedback.Feedback
|
||||
.LinkInputSig(TriList.BooleanInput[UIBoolJoin.VolumeGaugePopupVisible]);
|
||||
|
||||
VolumeButtonsPopupFeedback = new BoolFeedbackPulseExtender(4000);
|
||||
VolumeButtonsPopupFeedback.Feedback
|
||||
_volumeButtonsPopupFeedback = new BoolFeedbackPulseExtender(4000);
|
||||
_volumeButtonsPopupFeedback.Feedback
|
||||
.LinkInputSig(TriList.BooleanInput[UIBoolJoin.VolumeButtonPopupVisible]);
|
||||
|
||||
PowerOffTimeout = 30000;
|
||||
@@ -220,30 +207,19 @@ namespace PepperDash.Essentials
|
||||
return;
|
||||
}
|
||||
|
||||
var roomConf = CurrentRoom.PropertiesConfig;
|
||||
switch (_config.HeaderStyle.ToLower())
|
||||
{
|
||||
case CrestronTouchpanelPropertiesConfig.Habanero:
|
||||
TriList.SetSigFalseAction(UIBoolJoin.HeaderRoomButtonPress, () =>
|
||||
PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.RoomHeaderPageVisible));
|
||||
break;
|
||||
case CrestronTouchpanelPropertiesConfig.Verbose:
|
||||
break;
|
||||
}
|
||||
|
||||
if (Config.HeaderStyle.ToLower() == CrestronTouchpanelPropertiesConfig.Habanero)
|
||||
{
|
||||
TriList.SetSigFalseAction(UIBoolJoin.HeaderRoomButtonPress, () =>
|
||||
PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.RoomHeaderPageVisible));
|
||||
}
|
||||
else if (Config.HeaderStyle.ToLower() == CrestronTouchpanelPropertiesConfig.Verbose)
|
||||
{
|
||||
// room name on join 1, concat phone and sip on join 2, no button method
|
||||
//var addr = roomConf.Addresses;
|
||||
//if (addr == null) // protect from missing values by using default empties
|
||||
// addr = new EssentialsRoomAddressPropertiesConfig();
|
||||
//// empty string when either missing, pipe when both showing
|
||||
//TriList.SetString(UIStringJoin.RoomAddressPipeText,
|
||||
// (string.IsNullOrEmpty(addr.PhoneNumber.Trim())
|
||||
// || string.IsNullOrEmpty(addr.SipAddress.Trim())) ? "" : " | ");
|
||||
//TriList.SetString(UIStringJoin.RoomPhoneText, addr.PhoneNumber);
|
||||
//TriList.SetString(UIStringJoin.RoomSipText, addr.SipAddress);
|
||||
}
|
||||
|
||||
TriList.SetBool(UIBoolJoin.DateAndTimeVisible, Config.ShowDate && Config.ShowTime);
|
||||
TriList.SetBool(UIBoolJoin.DateOnlyVisible, Config.ShowDate && !Config.ShowTime);
|
||||
TriList.SetBool(UIBoolJoin.TimeOnlyVisible, !Config.ShowDate && Config.ShowTime);
|
||||
TriList.SetBool(UIBoolJoin.DateAndTimeVisible, _config.ShowDate && _config.ShowTime);
|
||||
TriList.SetBool(UIBoolJoin.DateOnlyVisible, _config.ShowDate && !_config.ShowTime);
|
||||
TriList.SetBool(UIBoolJoin.TimeOnlyVisible, !_config.ShowDate && _config.ShowTime);
|
||||
|
||||
TriList.SetBool(UIBoolJoin.TopBarHabaneroDynamicVisible, true);
|
||||
TriList.BooleanInput[UIBoolJoin.ActivityFooterVisible].BoolValue = true;
|
||||
@@ -330,7 +306,7 @@ namespace PepperDash.Essentials
|
||||
{
|
||||
TriList.SetBool(UIBoolJoin.LogoDefaultVisible, false);
|
||||
TriList.SetBool(UIBoolJoin.LogoUrlVisible, true);
|
||||
TriList.SetString(UIStringJoin.LogoUrl, _CurrentRoom.LogoUrl);
|
||||
TriList.SetString(UIStringJoin.LogoUrl, _currentRoom.LogoUrl);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -355,7 +331,7 @@ namespace PepperDash.Essentials
|
||||
TriList.BooleanInput[UIBoolJoin.TapToBeginVisible].BoolValue = false;
|
||||
TriList.BooleanInput[UIBoolJoin.SelectASourceVisible].BoolValue = false;
|
||||
//TriList.BooleanInput[UIBoolJoin.StagingPageVisible].BoolValue = false;
|
||||
VolumeButtonsPopupFeedback.ClearNow();
|
||||
_volumeButtonsPopupFeedback.ClearNow();
|
||||
//CancelPowerOff();
|
||||
|
||||
base.Hide();
|
||||
@@ -372,12 +348,12 @@ namespace PepperDash.Essentials
|
||||
TriList.SetBool(UIBoolJoin.NotificationRibbonVisible, true);
|
||||
if (timeout > 0)
|
||||
{
|
||||
if (RibbonTimer != null)
|
||||
RibbonTimer.Stop();
|
||||
RibbonTimer = new CTimer(o =>
|
||||
if (_ribbonTimer != null)
|
||||
_ribbonTimer.Stop();
|
||||
_ribbonTimer = new CTimer(o =>
|
||||
{
|
||||
TriList.SetBool(UIBoolJoin.NotificationRibbonVisible, false);
|
||||
RibbonTimer = null;
|
||||
_ribbonTimer = null;
|
||||
}, timeout);
|
||||
}
|
||||
}
|
||||
@@ -388,10 +364,10 @@ namespace PepperDash.Essentials
|
||||
public void HideNotificationRibbon()
|
||||
{
|
||||
TriList.SetBool(UIBoolJoin.NotificationRibbonVisible, false);
|
||||
if (RibbonTimer != null)
|
||||
if (_ribbonTimer != null)
|
||||
{
|
||||
RibbonTimer.Stop();
|
||||
RibbonTimer = null;
|
||||
_ribbonTimer.Stop();
|
||||
_ribbonTimer = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -403,7 +379,7 @@ namespace PepperDash.Essentials
|
||||
{
|
||||
//Clear whatever is showing now.
|
||||
HideAndClearCurrentDisplayModeSigsInUse();
|
||||
CurrentDisplayMode = mode;
|
||||
_currentDisplayMode = mode;
|
||||
switch (mode)
|
||||
{
|
||||
case UiDisplayMode.PresentationMode:
|
||||
@@ -421,7 +397,7 @@ namespace PepperDash.Essentials
|
||||
TriList.BooleanInput[UIBoolJoin.SelectASourceVisible].BoolValue = false;
|
||||
}
|
||||
// Date/time
|
||||
if (Config.ShowDate && Config.ShowTime)
|
||||
if (_config.ShowDate && _config.ShowTime)
|
||||
{
|
||||
TriList.BooleanInput[UIBoolJoin.DateAndTimeVisible].BoolValue = true;
|
||||
TriList.BooleanInput[UIBoolJoin.DateOnlyVisible].BoolValue = false;
|
||||
@@ -430,8 +406,8 @@ namespace PepperDash.Essentials
|
||||
else
|
||||
{
|
||||
TriList.BooleanInput[UIBoolJoin.DateAndTimeVisible].BoolValue = false;
|
||||
TriList.BooleanInput[UIBoolJoin.DateOnlyVisible].BoolValue = Config.ShowDate;
|
||||
TriList.BooleanInput[UIBoolJoin.TimeOnlyVisible].BoolValue = Config.ShowTime;
|
||||
TriList.BooleanInput[UIBoolJoin.DateOnlyVisible].BoolValue = _config.ShowDate;
|
||||
TriList.BooleanInput[UIBoolJoin.TimeOnlyVisible].BoolValue = _config.ShowTime;
|
||||
}
|
||||
|
||||
ShowCurrentDisplayModeSigsInUse();
|
||||
@@ -444,12 +420,12 @@ namespace PepperDash.Essentials
|
||||
/// </summary>
|
||||
void SetupActivityFooterWhenRoomOff()
|
||||
{
|
||||
ActivityFooterSrl.Clear();
|
||||
ActivityFooterSrl.AddItem(new SubpageReferenceListActivityItem(1, ActivityFooterSrl, 0,
|
||||
_activityFooterSrl.Clear();
|
||||
_activityFooterSrl.AddItem(new SubpageReferenceListActivityItem(1, _activityFooterSrl, 0,
|
||||
b => { if (!b) ShareButtonPressed(); }));
|
||||
ActivityFooterSrl.Count = 1;
|
||||
_activityFooterSrl.Count = 1;
|
||||
TriList.UShortInput[UIUshortJoin.PresentationStagingCaretMode].UShortValue = 0;
|
||||
ShareButtonSig.BoolValue = false;
|
||||
_shareButtonSig.BoolValue = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -457,15 +433,15 @@ namespace PepperDash.Essentials
|
||||
/// </summary>
|
||||
void SetupActivityFooterWhenRoomOn()
|
||||
{
|
||||
ActivityFooterSrl.Clear();
|
||||
ActivityFooterSrl.AddItem(new SubpageReferenceListActivityItem(1, ActivityFooterSrl,
|
||||
_activityFooterSrl.Clear();
|
||||
_activityFooterSrl.AddItem(new SubpageReferenceListActivityItem(1, _activityFooterSrl,
|
||||
0, null));
|
||||
ActivityFooterSrl.AddItem(new SubpageReferenceListActivityItem(2, ActivityFooterSrl,
|
||||
_activityFooterSrl.AddItem(new SubpageReferenceListActivityItem(2, _activityFooterSrl,
|
||||
4, b => { if (!b) PowerButtonPressed(); }));
|
||||
ActivityFooterSrl.Count = 2;
|
||||
_activityFooterSrl.Count = 2;
|
||||
TriList.UShortInput[UIUshortJoin.PresentationStagingCaretMode].UShortValue = 1;
|
||||
EndMeetingButtonSig = ActivityFooterSrl.BoolInputSig(2, 1);
|
||||
ShareButtonSig.BoolValue = CurrentRoom.OnFeedback.BoolValue;
|
||||
_endMeetingButtonSig = _activityFooterSrl.BoolInputSig(2, 1);
|
||||
_shareButtonSig.BoolValue = CurrentRoom.OnFeedback.BoolValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -473,7 +449,7 @@ namespace PepperDash.Essentials
|
||||
/// </summary>
|
||||
void ShareButtonPressed()
|
||||
{
|
||||
ShareButtonSig.BoolValue = true;
|
||||
_shareButtonSig.BoolValue = true;
|
||||
TriList.BooleanInput[UIBoolJoin.StartPageVisible].BoolValue = false;
|
||||
TriList.BooleanInput[UIBoolJoin.SourceStagingBarVisible].BoolValue = true;
|
||||
TriList.BooleanInput[UIBoolJoin.SelectASourceVisible].BoolValue = true;
|
||||
@@ -488,7 +464,7 @@ namespace PepperDash.Essentials
|
||||
/// </summary>
|
||||
void ShowCurrentDisplayModeSigsInUse()
|
||||
{
|
||||
foreach (var sig in CurrentDisplayModeSigsInUse)
|
||||
foreach (var sig in _currentDisplayModeSigsInUse)
|
||||
sig.BoolValue = true;
|
||||
}
|
||||
|
||||
@@ -497,9 +473,9 @@ namespace PepperDash.Essentials
|
||||
/// </summary>
|
||||
void HideAndClearCurrentDisplayModeSigsInUse()
|
||||
{
|
||||
foreach (var sig in CurrentDisplayModeSigsInUse)
|
||||
foreach (var sig in _currentDisplayModeSigsInUse)
|
||||
sig.BoolValue = false;
|
||||
CurrentDisplayModeSigsInUse.Clear();
|
||||
_currentDisplayModeSigsInUse.Clear();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -507,7 +483,7 @@ namespace PepperDash.Essentials
|
||||
/// </summary>
|
||||
public override void BackButtonPressed()
|
||||
{
|
||||
switch (CurrentDisplayMode)
|
||||
switch (_currentDisplayMode)
|
||||
{
|
||||
case UiDisplayMode.PresentationMode:
|
||||
//CancelReturnToSourceTimer();
|
||||
@@ -522,7 +498,7 @@ namespace PepperDash.Essentials
|
||||
void BackToHome()
|
||||
{
|
||||
Hide();
|
||||
Parent.Show();
|
||||
_parent.Show();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -534,26 +510,28 @@ namespace PepperDash.Essentials
|
||||
return;
|
||||
|
||||
var uiDev = CurrentRoom.CurrentSourceInfo.SourceDevice as IUiDisplayInfo;
|
||||
PageManager pm = null;
|
||||
// If we need a page manager, get an appropriate one
|
||||
if (uiDev != null)
|
||||
{
|
||||
TriList.BooleanInput[UIBoolJoin.SelectASourceVisible].BoolValue = false;
|
||||
// Got an existing page manager, get it
|
||||
if (PageManagers.ContainsKey(uiDev))
|
||||
pm = PageManagers[uiDev];
|
||||
// Otherwise make an apporiate one
|
||||
else if (uiDev is ISetTopBoxControls)
|
||||
//pm = new SetTopBoxMediumPageManager(uiDev as ISetTopBoxControls, TriList);
|
||||
pm = new SetTopBoxThreePanelPageManager(uiDev as ISetTopBoxControls, TriList);
|
||||
else if (uiDev is IDiscPlayerControls)
|
||||
pm = new DiscPlayerMediumPageManager(uiDev as IDiscPlayerControls, TriList);
|
||||
else
|
||||
pm = new DefaultPageManager(uiDev, TriList);
|
||||
PageManagers[uiDev] = pm;
|
||||
CurrentSourcePageManager = pm;
|
||||
pm.Show();
|
||||
}
|
||||
// If we need a page manager, get an appropriate one
|
||||
if (uiDev == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
TriList.BooleanInput[UIBoolJoin.SelectASourceVisible].BoolValue = false;
|
||||
// Got an existing page manager, get it
|
||||
PageManager pm;
|
||||
if (_pageManagers.ContainsKey(uiDev))
|
||||
pm = _pageManagers[uiDev];
|
||||
// Otherwise make an apporiate one
|
||||
else if (uiDev is ISetTopBoxControls)
|
||||
//pm = new SetTopBoxMediumPageManager(uiDev as ISetTopBoxControls, TriList);
|
||||
pm = new SetTopBoxThreePanelPageManager(uiDev as ISetTopBoxControls, TriList);
|
||||
else if (uiDev is IDiscPlayerControls)
|
||||
pm = new DiscPlayerMediumPageManager(uiDev as IDiscPlayerControls, TriList);
|
||||
else
|
||||
pm = new DefaultPageManager(uiDev, TriList);
|
||||
_pageManagers[uiDev] = pm;
|
||||
_currentSourcePageManager = pm;
|
||||
pm.Show();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -564,7 +542,7 @@ namespace PepperDash.Essentials
|
||||
void UiSelectSource(string key)
|
||||
{
|
||||
// Run the route and when it calls back, show the source
|
||||
CurrentRoom.RunRouteAction(key, new Action(() => { }));
|
||||
CurrentRoom.RunRouteAction(key, () => { });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -588,12 +566,12 @@ namespace PepperDash.Essentials
|
||||
{
|
||||
// Do we need to check where the UI is? No?
|
||||
var timer = CurrentRoom.ShutdownPromptTimer;
|
||||
EndMeetingButtonSig.BoolValue = true;
|
||||
ShareButtonSig.BoolValue = false;
|
||||
_endMeetingButtonSig.BoolValue = true;
|
||||
_shareButtonSig.BoolValue = false;
|
||||
|
||||
if (CurrentRoom.ShutdownType == eShutdownType.Manual || CurrentRoom.ShutdownType == eShutdownType.Vacancy)
|
||||
{
|
||||
PowerDownModal = new ModalDialog(TriList);
|
||||
_powerDownModal = new ModalDialog(TriList);
|
||||
var message = string.Format("Meeting will end in {0} seconds", CurrentRoom.ShutdownPromptSeconds);
|
||||
|
||||
// Attach timer things to modal
|
||||
@@ -607,15 +585,15 @@ namespace PepperDash.Essentials
|
||||
{
|
||||
if (!onFb.BoolValue)
|
||||
{
|
||||
EndMeetingButtonSig.BoolValue = false;
|
||||
PowerDownModal.HideDialog();
|
||||
_endMeetingButtonSig.BoolValue = false;
|
||||
_powerDownModal.HideDialog();
|
||||
onFb.OutputChange -= offHandler;
|
||||
//gauge.OutputChange -= gaugeHandler;
|
||||
}
|
||||
};
|
||||
onFb.OutputChange += offHandler;
|
||||
|
||||
PowerDownModal.PresentModalDialog(2, "End Meeting", "Power", message, "Cancel", "End Meeting Now", true, true,
|
||||
_powerDownModal.PresentModalDialog(2, "End Meeting", "Power", message, "Cancel", "End Meeting Now", true, true,
|
||||
but =>
|
||||
{
|
||||
if (but != 2) // any button except for End cancels
|
||||
@@ -633,7 +611,7 @@ namespace PepperDash.Essentials
|
||||
/// <param name="e"></param>
|
||||
void ShutdownPromptTimer_HasFinished(object sender, EventArgs e)
|
||||
{
|
||||
EndMeetingButtonSig.BoolValue = false;
|
||||
_endMeetingButtonSig.BoolValue = false;
|
||||
CurrentRoom.ShutdownPromptTimer.TimeRemainingFeedback.OutputChange -= ShutdownPromptTimer_TimeRemainingFeedback_OutputChange;
|
||||
CurrentRoom.ShutdownPromptTimer.PercentFeedback.OutputChange -= ShutdownPromptTimer_PercentFeedback_OutputChange;
|
||||
}
|
||||
@@ -645,10 +623,10 @@ namespace PepperDash.Essentials
|
||||
/// <param name="e"></param>
|
||||
void ShutdownPromptTimer_WasCancelled(object sender, EventArgs e)
|
||||
{
|
||||
if (PowerDownModal != null)
|
||||
PowerDownModal.HideDialog();
|
||||
EndMeetingButtonSig.BoolValue = false;
|
||||
ShareButtonSig.BoolValue = CurrentRoom.OnFeedback.BoolValue;
|
||||
if (_powerDownModal != null)
|
||||
_powerDownModal.HideDialog();
|
||||
_endMeetingButtonSig.BoolValue = false;
|
||||
_shareButtonSig.BoolValue = CurrentRoom.OnFeedback.BoolValue;
|
||||
|
||||
CurrentRoom.ShutdownPromptTimer.TimeRemainingFeedback.OutputChange += ShutdownPromptTimer_TimeRemainingFeedback_OutputChange;
|
||||
CurrentRoom.ShutdownPromptTimer.PercentFeedback.OutputChange -= ShutdownPromptTimer_PercentFeedback_OutputChange;
|
||||
@@ -656,27 +634,38 @@ namespace PepperDash.Essentials
|
||||
|
||||
void ShutdownPromptTimer_TimeRemainingFeedback_OutputChange(object sender, EventArgs e)
|
||||
{
|
||||
var stringFeedback = sender as StringFeedback;
|
||||
if (stringFeedback == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var message = string.Format("Meeting will end in {0} seconds", (sender as StringFeedback).StringValue);
|
||||
var message = string.Format("Meeting will end in {0} seconds", stringFeedback.StringValue);
|
||||
TriList.StringInput[ModalDialog.MessageTextJoin].StringValue = message;
|
||||
}
|
||||
|
||||
void ShutdownPromptTimer_PercentFeedback_OutputChange(object sender, EventArgs e)
|
||||
{
|
||||
var value = (ushort)((sender as IntFeedback).UShortValue * 65535 / 100);
|
||||
TriList.UShortInput[ModalDialog.TimerGaugeJoin].UShortValue = value;
|
||||
}
|
||||
void ShutdownPromptTimer_PercentFeedback_OutputChange(object sender, EventArgs e)
|
||||
{
|
||||
var intFeedback = sender as IntFeedback;
|
||||
if (intFeedback == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var value = (ushort)(intFeedback.UShortValue * 65535 / 100);
|
||||
TriList.UShortInput[ModalDialog.TimerGaugeJoin].UShortValue = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void CancelPowerOffTimer()
|
||||
{
|
||||
if (PowerOffTimer != null)
|
||||
{
|
||||
PowerOffTimer.Stop();
|
||||
PowerOffTimer = null;
|
||||
}
|
||||
if (_powerOffTimer == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_powerOffTimer.Stop();
|
||||
_powerOffTimer = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -684,13 +673,13 @@ namespace PepperDash.Essentials
|
||||
/// </summary>
|
||||
void VolumeButtonsTogglePress()
|
||||
{
|
||||
if (VolumeButtonsPopupFeedback.BoolValue)
|
||||
VolumeButtonsPopupFeedback.ClearNow();
|
||||
if (_volumeButtonsPopupFeedback.BoolValue)
|
||||
_volumeButtonsPopupFeedback.ClearNow();
|
||||
else
|
||||
{
|
||||
// Trigger the popup
|
||||
VolumeButtonsPopupFeedback.BoolValue = true;
|
||||
VolumeButtonsPopupFeedback.BoolValue = false;
|
||||
_volumeButtonsPopupFeedback.BoolValue = true;
|
||||
_volumeButtonsPopupFeedback.BoolValue = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -702,8 +691,8 @@ namespace PepperDash.Essentials
|
||||
{
|
||||
// extend timeouts
|
||||
if (ShowVolumeGauge)
|
||||
VolumeGaugeFeedback.BoolValue = state;
|
||||
VolumeButtonsPopupFeedback.BoolValue = state;
|
||||
_volumeGaugeFeedback.BoolValue = state;
|
||||
_volumeButtonsPopupFeedback.BoolValue = state;
|
||||
if (CurrentRoom.CurrentVolumeControls != null)
|
||||
CurrentRoom.CurrentVolumeControls.VolumeUp(state);
|
||||
}
|
||||
@@ -716,8 +705,8 @@ namespace PepperDash.Essentials
|
||||
{
|
||||
// extend timeouts
|
||||
if (ShowVolumeGauge)
|
||||
VolumeGaugeFeedback.BoolValue = state;
|
||||
VolumeButtonsPopupFeedback.BoolValue = state;
|
||||
_volumeGaugeFeedback.BoolValue = state;
|
||||
_volumeButtonsPopupFeedback.BoolValue = state;
|
||||
if (CurrentRoom.CurrentVolumeControls != null)
|
||||
CurrentRoom.CurrentVolumeControls.VolumeDown(state);
|
||||
}
|
||||
@@ -728,31 +717,31 @@ namespace PepperDash.Essentials
|
||||
/// </summary>
|
||||
public void RefreshCurrentRoom(EssentialsHuddleSpaceRoom room)
|
||||
{
|
||||
if (_CurrentRoom != null)
|
||||
if (_currentRoom != null)
|
||||
{
|
||||
// Disconnect current room
|
||||
_CurrentRoom.CurrentVolumeDeviceChange -= this.CurrentRoom_CurrentAudioDeviceChange;
|
||||
_currentRoom.CurrentVolumeDeviceChange -= CurrentRoom_CurrentAudioDeviceChange;
|
||||
ClearAudioDeviceConnections();
|
||||
_CurrentRoom.CurrentSourceChange -= this.CurrentRoom_SourceInfoChange;
|
||||
DisconnectSource(_CurrentRoom.CurrentSourceInfo);
|
||||
_CurrentRoom.ShutdownPromptTimer.HasStarted -= ShutdownPromptTimer_HasStarted;
|
||||
_CurrentRoom.ShutdownPromptTimer.HasFinished -= ShutdownPromptTimer_HasFinished;
|
||||
_CurrentRoom.ShutdownPromptTimer.WasCancelled -= ShutdownPromptTimer_WasCancelled;
|
||||
_currentRoom.CurrentSourceChange -= CurrentRoom_SourceInfoChange;
|
||||
DisconnectSource(_currentRoom.CurrentSourceInfo);
|
||||
_currentRoom.ShutdownPromptTimer.HasStarted -= ShutdownPromptTimer_HasStarted;
|
||||
_currentRoom.ShutdownPromptTimer.HasFinished -= ShutdownPromptTimer_HasFinished;
|
||||
_currentRoom.ShutdownPromptTimer.WasCancelled -= ShutdownPromptTimer_WasCancelled;
|
||||
|
||||
_CurrentRoom.OnFeedback.OutputChange -= CurrentRoom_OnFeedback_OutputChange;
|
||||
_CurrentRoom.IsWarmingUpFeedback.OutputChange -= CurrentRoom_IsWarmingFeedback_OutputChange;
|
||||
_CurrentRoom.IsCoolingDownFeedback.OutputChange -= IsCoolingDownFeedback_OutputChange;
|
||||
_currentRoom.OnFeedback.OutputChange -= CurrentRoom_OnFeedback_OutputChange;
|
||||
_currentRoom.IsWarmingUpFeedback.OutputChange -= CurrentRoom_IsWarmingFeedback_OutputChange;
|
||||
_currentRoom.IsCoolingDownFeedback.OutputChange -= IsCoolingDownFeedback_OutputChange;
|
||||
}
|
||||
|
||||
_CurrentRoom = room;
|
||||
_currentRoom = room;
|
||||
|
||||
if (_CurrentRoom != null)
|
||||
if (_currentRoom != null)
|
||||
{
|
||||
// get the source list config and set up the source list
|
||||
var config = ConfigReader.ConfigObject.SourceLists;
|
||||
if (config.ContainsKey(_CurrentRoom.SourceListKey))
|
||||
if (config.ContainsKey(_currentRoom.SourceListKey))
|
||||
{
|
||||
var srcList = config[_CurrentRoom.SourceListKey];
|
||||
var srcList = config[_currentRoom.SourceListKey];
|
||||
// Setup sources list
|
||||
uint i = 1; // counter for UI list
|
||||
foreach (var kvp in srcList)
|
||||
@@ -769,16 +758,16 @@ namespace PepperDash.Essentials
|
||||
continue;
|
||||
}
|
||||
var routeKey = kvp.Key;
|
||||
var item = new SubpageReferenceListSourceItem(i++, SourcesSrl, srcConfig,
|
||||
var item = new SubpageReferenceListSourceItem(i++, _sourcesSrl, srcConfig,
|
||||
b => { if (!b) UiSelectSource(routeKey); });
|
||||
SourcesSrl.AddItem(item); // add to the SRL
|
||||
item.RegisterForSourceChange(_CurrentRoom);
|
||||
_sourcesSrl.AddItem(item); // add to the SRL
|
||||
item.RegisterForSourceChange(_currentRoom);
|
||||
}
|
||||
SourcesSrl.Count = (ushort)(i - 1);
|
||||
_sourcesSrl.Count = (ushort)(i - 1);
|
||||
}
|
||||
// Name and logo
|
||||
TriList.StringInput[UIStringJoin.CurrentRoomName].StringValue = _CurrentRoom.Name;
|
||||
if (_CurrentRoom.LogoUrl == null)
|
||||
TriList.StringInput[UIStringJoin.CurrentRoomName].StringValue = _currentRoom.Name;
|
||||
if (_currentRoom.LogoUrl == null)
|
||||
{
|
||||
TriList.BooleanInput[UIBoolJoin.LogoDefaultVisible].BoolValue = true;
|
||||
TriList.BooleanInput[UIBoolJoin.LogoUrlVisible].BoolValue = false;
|
||||
@@ -787,26 +776,31 @@ namespace PepperDash.Essentials
|
||||
{
|
||||
TriList.BooleanInput[UIBoolJoin.LogoDefaultVisible].BoolValue = false;
|
||||
TriList.BooleanInput[UIBoolJoin.LogoUrlVisible].BoolValue = true;
|
||||
TriList.StringInput[UIStringJoin.LogoUrl].StringValue = _CurrentRoom.LogoUrl;
|
||||
TriList.StringInput[UIStringJoin.LogoUrl].StringValue = _currentRoom.LogoUrl;
|
||||
}
|
||||
|
||||
// Shutdown timer
|
||||
_CurrentRoom.ShutdownPromptTimer.HasStarted += ShutdownPromptTimer_HasStarted;
|
||||
_CurrentRoom.ShutdownPromptTimer.HasFinished += ShutdownPromptTimer_HasFinished;
|
||||
_CurrentRoom.ShutdownPromptTimer.WasCancelled += ShutdownPromptTimer_WasCancelled;
|
||||
_currentRoom.ShutdownPromptTimer.HasStarted += ShutdownPromptTimer_HasStarted;
|
||||
_currentRoom.ShutdownPromptTimer.HasFinished += ShutdownPromptTimer_HasFinished;
|
||||
_currentRoom.ShutdownPromptTimer.WasCancelled += ShutdownPromptTimer_WasCancelled;
|
||||
|
||||
// Link up all the change events from the room
|
||||
_CurrentRoom.OnFeedback.OutputChange += CurrentRoom_OnFeedback_OutputChange;
|
||||
_currentRoom.OnFeedback.OutputChange += CurrentRoom_OnFeedback_OutputChange;
|
||||
CurrentRoom_SyncOnFeedback();
|
||||
_CurrentRoom.IsWarmingUpFeedback.OutputChange += CurrentRoom_IsWarmingFeedback_OutputChange;
|
||||
_CurrentRoom.IsCoolingDownFeedback.OutputChange += IsCoolingDownFeedback_OutputChange;
|
||||
_currentRoom.IsWarmingUpFeedback.OutputChange += CurrentRoom_IsWarmingFeedback_OutputChange;
|
||||
_currentRoom.IsCoolingDownFeedback.OutputChange += IsCoolingDownFeedback_OutputChange;
|
||||
|
||||
_CurrentRoom.CurrentVolumeDeviceChange += CurrentRoom_CurrentAudioDeviceChange;
|
||||
_currentRoom.CurrentVolumeDeviceChange += CurrentRoom_CurrentAudioDeviceChange;
|
||||
RefreshAudioDeviceConnections();
|
||||
_CurrentRoom.CurrentSourceChange += CurrentRoom_SourceInfoChange;
|
||||
_currentRoom.CurrentSourceChange += CurrentRoom_SourceInfoChange;
|
||||
RefreshSourceInfo();
|
||||
|
||||
(Parent as EssentialsPanelMainInterfaceDriver).HeaderDriver.SetupHeaderButtons(this, CurrentRoom);
|
||||
var essentialsPanelMainInterfaceDriver = _parent as EssentialsPanelMainInterfaceDriver;
|
||||
|
||||
if (essentialsPanelMainInterfaceDriver != null)
|
||||
{
|
||||
essentialsPanelMainInterfaceDriver.HeaderDriver.SetupHeaderButtons(this, CurrentRoom);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -817,7 +811,7 @@ namespace PepperDash.Essentials
|
||||
|
||||
void SetCurrentRoom(EssentialsHuddleSpaceRoom room)
|
||||
{
|
||||
if (_CurrentRoom == room) return;
|
||||
if (_currentRoom == room) return;
|
||||
// Disconnect current (probably never called)
|
||||
|
||||
room.ConfigChanged -= room_ConfigChanged;
|
||||
@@ -833,7 +827,7 @@ namespace PepperDash.Essentials
|
||||
/// <param name="e"></param>
|
||||
void room_ConfigChanged(object sender, EventArgs e)
|
||||
{
|
||||
RefreshCurrentRoom(_CurrentRoom);
|
||||
RefreshCurrentRoom(_currentRoom);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -846,7 +840,7 @@ namespace PepperDash.Essentials
|
||||
|
||||
void CurrentRoom_SyncOnFeedback()
|
||||
{
|
||||
var value = _CurrentRoom.OnFeedback.BoolValue;
|
||||
var value = _currentRoom.OnFeedback.BoolValue;
|
||||
//Debug.Console(2, CurrentRoom, "UI: Is on event={0}", value);
|
||||
TriList.BooleanInput[UIBoolJoin.RoomIsOn].BoolValue = value;
|
||||
|
||||
@@ -908,15 +902,14 @@ namespace PepperDash.Essentials
|
||||
// Hide whatever is showing
|
||||
if (IsVisible)
|
||||
{
|
||||
if (CurrentSourcePageManager != null)
|
||||
if (_currentSourcePageManager != null)
|
||||
{
|
||||
CurrentSourcePageManager.Hide();
|
||||
CurrentSourcePageManager = null;
|
||||
_currentSourcePageManager.Hide();
|
||||
_currentSourcePageManager = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (previousInfo == null) return;
|
||||
var previousDev = previousInfo.SourceDevice;
|
||||
var previousDev = previousInfo.SourceDevice;
|
||||
|
||||
// device type interfaces
|
||||
if (previousDev is ISetTopBoxControls)
|
||||
@@ -947,7 +940,7 @@ namespace PepperDash.Essentials
|
||||
{
|
||||
var routeInfo = CurrentRoom.CurrentSourceInfo;
|
||||
// This will show off popup too
|
||||
if (this.IsVisible)
|
||||
if (IsVisible)
|
||||
ShowCurrentSource();
|
||||
|
||||
if (routeInfo == null)// || !CurrentRoom.OnFeedback.BoolValue)
|
||||
@@ -955,22 +948,23 @@ namespace PepperDash.Essentials
|
||||
// Check for power off and insert "Room is off"
|
||||
TriList.StringInput[UIStringJoin.CurrentSourceName].StringValue = "Room is off";
|
||||
TriList.StringInput[UIStringJoin.CurrentSourceIcon].StringValue = "Power";
|
||||
this.Hide();
|
||||
Parent.Show();
|
||||
Hide();
|
||||
_parent.Show();
|
||||
return;
|
||||
}
|
||||
else if (CurrentRoom.CurrentSourceInfo != null)
|
||||
{
|
||||
TriList.StringInput[UIStringJoin.CurrentSourceName].StringValue = routeInfo.PreferredName;
|
||||
TriList.StringInput[UIStringJoin.CurrentSourceIcon].StringValue = routeInfo.Icon; // defaults to "blank"
|
||||
}
|
||||
else
|
||||
{
|
||||
TriList.StringInput[UIStringJoin.CurrentSourceName].StringValue = "---";
|
||||
TriList.StringInput[UIStringJoin.CurrentSourceIcon].StringValue = "Blank";
|
||||
}
|
||||
|
||||
// Connect controls
|
||||
|
||||
if (CurrentRoom.CurrentSourceInfo != null)
|
||||
{
|
||||
TriList.StringInput[UIStringJoin.CurrentSourceName].StringValue = routeInfo.PreferredName;
|
||||
TriList.StringInput[UIStringJoin.CurrentSourceIcon].StringValue = routeInfo.Icon; // defaults to "blank"
|
||||
}
|
||||
else
|
||||
{
|
||||
TriList.StringInput[UIStringJoin.CurrentSourceName].StringValue = "---";
|
||||
TriList.StringInput[UIStringJoin.CurrentSourceIcon].StringValue = "Blank";
|
||||
}
|
||||
|
||||
// Connect controls
|
||||
if (routeInfo.SourceDevice != null)
|
||||
ConnectControlDeviceMethods(routeInfo.SourceDevice);
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.Core.SmartObjects;
|
||||
using PepperDash.Essentials.Core.Touchpanels.Keyboards;
|
||||
using PepperDash.Essentials.Devices.Displays;
|
||||
using PepperDash.Essentials.Room.Config;
|
||||
using PepperDash.Essentials.Core.Rooms.Config;
|
||||
|
||||
namespace PepperDash.Essentials.UIDrivers
|
||||
{
|
||||
|
||||
@@ -8,10 +8,11 @@ using Crestron.SimplSharpPro.UI;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.Core.Devices.VideoCodec;
|
||||
using PepperDash.Essentials.Core.SmartObjects;
|
||||
using PepperDash.Essentials.Core.PageManagers;
|
||||
using PepperDash.Essentials.Room.Config;
|
||||
using PepperDash.Essentials.Devices.Common.Codec;
|
||||
using PepperDash.Essentials.Core.Rooms.Config;
|
||||
using PepperDash.Essentials.Core.Devices.Codec;
|
||||
using PepperDash.Essentials.Devices.Common.VideoCodec;
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
|
||||
@@ -9,10 +9,12 @@ using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Devices.VideoCodec;
|
||||
using PepperDash.Essentials.Core.SmartObjects;
|
||||
using PepperDash.Essentials.Core.Touchpanels.Keyboards;
|
||||
using PepperDash.Essentials.Devices.Common.Codec;
|
||||
using PepperDash.Essentials.Core.Devices.Codec;
|
||||
using PepperDash.Essentials.Devices.Common.VideoCodec;
|
||||
using PepperDash.Essentials.Devices.Core.VideoCodec;
|
||||
|
||||
namespace PepperDash.Essentials.UIDrivers.VC
|
||||
{
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
|
||||
# PepperDash Essentials Framework (c) 2020
|
||||
|
||||
## [Latest Release](https://github.com/PepperDash/Essentials/releases/latest)
|
||||
|
||||
## License
|
||||
Provided under MIT license
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ using Crestron.SimplSharpPro.EthernetCommunication;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
|
||||
//using PepperDash.Essentials.Devices.Common.Cameras;
|
||||
@@ -111,28 +110,17 @@ namespace PepperDash.Essentials.Core.Bridges
|
||||
|
||||
Debug.Console(1, this, "Linking Device: '{0}'", device.Key);
|
||||
|
||||
if (typeof (IBridge).IsAssignableFrom(device.GetType().GetCType()))
|
||||
if (!typeof (IBridgeAdvanced).IsAssignableFrom(device.GetType().GetCType()))
|
||||
{
|
||||
var basicBridge = device as IBridge;
|
||||
if (basicBridge != null)
|
||||
{
|
||||
Debug.Console(0, this, Debug.ErrorLogLevel.Notice,
|
||||
"Linking EiscApiAdvanced {0} to device {1} using obsolete join map. Please update the device's join map.",
|
||||
Key, device.Key);
|
||||
basicBridge.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||
}
|
||||
Debug.Console(0, this, Debug.ErrorLogLevel.Notice,
|
||||
"{0} is not compatible with this bridge type. Please use 'eiscapi' instead, or updae the device.",
|
||||
device.Key);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!typeof (IBridgeAdvanced).IsAssignableFrom(device.GetType().GetCType()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
var bridge = device as IBridgeAdvanced;
|
||||
if (bridge != null) bridge.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey, this);
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@@ -303,7 +291,7 @@ namespace PepperDash.Essentials.Core.Bridges
|
||||
{
|
||||
public EiscApiAdvancedFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "eiscapiadv", "eiscapiadvanced" };
|
||||
TypeNames = new List<string> { "eiscapiadv", "eiscapiadvanced" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
|
||||
@@ -1,19 +1,12 @@
|
||||
using System;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using PepperDash.Core;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Bridges
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines a device that uses JoinMapBaseAdvanced for its join map
|
||||
/// </summary>
|
||||
public interface IBridgeAdvanced:IKeyed
|
||||
public interface IBridgeAdvanced
|
||||
{
|
||||
void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge);
|
||||
}
|
||||
|
||||
public interface IBridge:IKeyed
|
||||
{
|
||||
void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey);
|
||||
}
|
||||
}
|
||||
@@ -89,6 +89,43 @@ namespace PepperDash.Essentials.Core.Bridges
|
||||
public JoinDataComplete OutputNames = new JoinDataComplete(new JoinData() { JoinNumber = 301, JoinSpan = 32 },
|
||||
new JoinMetadata() { Label = "DM Chassis Output Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
||||
|
||||
[JoinName("InputVideoNames")] public JoinDataComplete InputVideoNames =
|
||||
new JoinDataComplete(new JoinData {JoinNumber = 501, JoinSpan = 200},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Video Input Name",
|
||||
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
|
||||
JoinType = eJoinType.Serial
|
||||
});
|
||||
|
||||
[JoinName("InputAudioNames")]
|
||||
public JoinDataComplete InputAudioNames =
|
||||
new JoinDataComplete(new JoinData { JoinNumber = 701, JoinSpan = 200 },
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Video Input Name",
|
||||
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
|
||||
JoinType = eJoinType.Serial
|
||||
});
|
||||
[JoinName("OutputVideoNames")]
|
||||
public JoinDataComplete OutputVideoNames =
|
||||
new JoinDataComplete(new JoinData { JoinNumber = 901, JoinSpan = 200 },
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Video Input Name",
|
||||
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
|
||||
JoinType = eJoinType.Serial
|
||||
});
|
||||
[JoinName("OutputAudioNames")]
|
||||
public JoinDataComplete OutputAudioNames =
|
||||
new JoinDataComplete(new JoinData { JoinNumber = 1101, JoinSpan = 200 },
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Video Input Name",
|
||||
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
|
||||
JoinType = eJoinType.Serial
|
||||
});
|
||||
|
||||
[JoinName("OutputCurrentVideoInputNames")]
|
||||
public JoinDataComplete OutputCurrentVideoInputNames = new JoinDataComplete(new JoinData() { JoinNumber = 2001, JoinSpan = 32 },
|
||||
new JoinMetadata() { Label = "DM Chassis Video Output Currently Routed Video Input Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Bridges
|
||||
{
|
||||
public class HdMdNxM4kEControllerJoinMap : JoinMapBaseAdvanced
|
||||
{
|
||||
[JoinName("Name")]
|
||||
public JoinDataComplete Name = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "Device Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
||||
|
||||
[JoinName("EnableAutoRoute")]
|
||||
public JoinDataComplete EnableAutoRoute = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "Enable Automatic Routing on 4x1 Switchers", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("InputName")]
|
||||
public JoinDataComplete InputName = new JoinDataComplete(new JoinData() { JoinNumber = 2, JoinSpan = 8 },
|
||||
new JoinMetadata() { Label = "Device Input Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
||||
|
||||
[JoinName("InputSync")]
|
||||
public JoinDataComplete InputSync = new JoinDataComplete(new JoinData() { JoinNumber = 2, JoinSpan = 8 },
|
||||
new JoinMetadata() { Label = "Device Input Sync", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("OutputName")]
|
||||
public JoinDataComplete OutputName = new JoinDataComplete(new JoinData() { JoinNumber = 11, JoinSpan = 2 },
|
||||
new JoinMetadata() { Label = "Device Output Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
||||
|
||||
[JoinName("OutputRoute")]
|
||||
public JoinDataComplete OutputRoute = new JoinDataComplete(new JoinData() { JoinNumber = 11, JoinSpan = 2 },
|
||||
new JoinMetadata() { Label = "Device Output Route Set/Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
||||
|
||||
[JoinName("OutputRoutedName")]
|
||||
public JoinDataComplete OutputRoutedName = new JoinDataComplete(new JoinData() { JoinNumber = 16, JoinSpan = 2 },
|
||||
new JoinMetadata() { Label = "Device Output Route Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
||||
|
||||
[JoinName("EnableInputHdcp")]
|
||||
public JoinDataComplete EnableInputHdcp = new JoinDataComplete(new JoinData() { JoinNumber = 11, JoinSpan = 8 },
|
||||
new JoinMetadata() { Label = "Device Enable Input Hdcp", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("DisableInputHdcp")]
|
||||
public JoinDataComplete DisableInputHdcp = new JoinDataComplete(new JoinData() { JoinNumber = 21, JoinSpan = 8 },
|
||||
new JoinMetadata() { Label = "Device Disnable Input Hdcp", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("IsOnline")]
|
||||
public JoinDataComplete IsOnline = new JoinDataComplete(new JoinData() { JoinNumber = 30, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "Device Onlne", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
public HdMdNxM4kEControllerJoinMap(uint joinStart)
|
||||
: base(joinStart, typeof(HdMdNxM4kEControllerJoinMap))
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,238 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Bridges
|
||||
{
|
||||
public class Hrxxx0WirelessRemoteControllerJoinMap : JoinMapBaseAdvanced
|
||||
{
|
||||
[JoinName("Power")]
|
||||
public JoinDataComplete Power = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "Power", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Menu")]
|
||||
public JoinDataComplete Menu = new JoinDataComplete(new JoinData() { JoinNumber = 2, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "Menu", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Guide")]
|
||||
public JoinDataComplete Guide = new JoinDataComplete(new JoinData() { JoinNumber = 3, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "Guide", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Info")]
|
||||
public JoinDataComplete Info = new JoinDataComplete(new JoinData() { JoinNumber = 4, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "Info", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("VolumeUp")]
|
||||
public JoinDataComplete VolumeUp = new JoinDataComplete(new JoinData() { JoinNumber = 5, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "VolumeUp", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("VolumeDown")]
|
||||
public JoinDataComplete VolumeDown = new JoinDataComplete(new JoinData() { JoinNumber = 6, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "VolumeDown", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("DialPadUp")]
|
||||
public JoinDataComplete DialPadUp = new JoinDataComplete(new JoinData() { JoinNumber = 7, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "DialPadUp", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("DialPadDown")]
|
||||
public JoinDataComplete DialPadDown = new JoinDataComplete(new JoinData() { JoinNumber = 8, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "DialPadDown", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("DialPadLeft")]
|
||||
public JoinDataComplete DialPadLeft = new JoinDataComplete(new JoinData() { JoinNumber = 9, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "DialPadLeft", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("DialPadRight")]
|
||||
public JoinDataComplete DialPadRight = new JoinDataComplete(new JoinData() { JoinNumber = 10, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "DialPadRight", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("DialPadSelect")]
|
||||
public JoinDataComplete DialPadSelect = new JoinDataComplete(new JoinData() { JoinNumber = 11, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "DialPadSelect", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("ChannelUp")]
|
||||
public JoinDataComplete ChannelUp = new JoinDataComplete(new JoinData() { JoinNumber = 12, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "ChannelUp", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("ChannelDown")]
|
||||
public JoinDataComplete ChannelDown = new JoinDataComplete(new JoinData() { JoinNumber = 13, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "ChannelDown", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Mute")]
|
||||
public JoinDataComplete Mute = new JoinDataComplete(new JoinData() { JoinNumber = 14, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "Mute", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Exit")]
|
||||
public JoinDataComplete Exit = new JoinDataComplete(new JoinData() { JoinNumber = 15, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "Exit", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Last")]
|
||||
public JoinDataComplete Last = new JoinDataComplete(new JoinData() { JoinNumber = 16, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "Last", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Play")]
|
||||
public JoinDataComplete Play = new JoinDataComplete(new JoinData() { JoinNumber = 17, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "Play", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Pause")]
|
||||
public JoinDataComplete Pause = new JoinDataComplete(new JoinData() { JoinNumber = 18, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "Pause", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Rewind")]
|
||||
public JoinDataComplete Rewind = new JoinDataComplete(new JoinData() { JoinNumber = 19, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "Rewind", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("FastForward")]
|
||||
public JoinDataComplete FastForward = new JoinDataComplete(new JoinData() { JoinNumber = 20, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "FastForward", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("PreviousTrack")]
|
||||
public JoinDataComplete PreviousTrack = new JoinDataComplete(new JoinData() { JoinNumber = 21, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "PreviousTrack", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("NextTrack")]
|
||||
public JoinDataComplete NextTrack = new JoinDataComplete(new JoinData() { JoinNumber = 22, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "NextTrack", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Stop")]
|
||||
public JoinDataComplete Stop = new JoinDataComplete(new JoinData() { JoinNumber = 23, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "Stop", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Record")]
|
||||
public JoinDataComplete Record = new JoinDataComplete(new JoinData() { JoinNumber = 24, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "Record", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Dvr")]
|
||||
public JoinDataComplete Dvr = new JoinDataComplete(new JoinData() { JoinNumber = 25, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "Dvr", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Keypad1")]
|
||||
public JoinDataComplete Keypad1 = new JoinDataComplete(new JoinData() { JoinNumber = 26, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "Keypad1", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Keypad2Abc")]
|
||||
public JoinDataComplete Keypad2 = new JoinDataComplete(new JoinData() { JoinNumber = 27, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "Keypad2Abc", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Keypad3Def")]
|
||||
public JoinDataComplete Keypad3Def = new JoinDataComplete(new JoinData() { JoinNumber = 28, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "Keypad3Def", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Keypad4Ghi")]
|
||||
public JoinDataComplete Keypad4Ghi = new JoinDataComplete(new JoinData() { JoinNumber = 29, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "Keypad4Ghi", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Keypad5Jkl")]
|
||||
public JoinDataComplete Keypad5Jkl = new JoinDataComplete(new JoinData() { JoinNumber = 30, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "Keypad5Jkl", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Keypad6Mno")]
|
||||
public JoinDataComplete Keypad6Mno = new JoinDataComplete(new JoinData() { JoinNumber = 31, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "Keypad6Mno", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Keypad7Pqrs")]
|
||||
public JoinDataComplete Keypad7Pqrs = new JoinDataComplete(new JoinData() { JoinNumber = 32, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "Keypad7Pqrs", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Keypad8Tuv")]
|
||||
public JoinDataComplete Keypad8Tuv = new JoinDataComplete(new JoinData() { JoinNumber = 33, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "Keypad8Tuv", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Keypad9Wxyz")]
|
||||
public JoinDataComplete Keypad9Wxyz = new JoinDataComplete(new JoinData() { JoinNumber = 34, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "Keypad9Wxyz", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Keypad0")]
|
||||
public JoinDataComplete Keypad0 = new JoinDataComplete(new JoinData() { JoinNumber = 35, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "Keypad0", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Clear")]
|
||||
public JoinDataComplete Clear = new JoinDataComplete(new JoinData() { JoinNumber = 36, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "Clear", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Enter")]
|
||||
public JoinDataComplete Enter = new JoinDataComplete(new JoinData() { JoinNumber = 37, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "Enter", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Red")]
|
||||
public JoinDataComplete Red = new JoinDataComplete(new JoinData() { JoinNumber = 38, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "Red", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Green")]
|
||||
public JoinDataComplete Green = new JoinDataComplete(new JoinData() { JoinNumber = 39, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "Green", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Yellow")]
|
||||
public JoinDataComplete Yellow = new JoinDataComplete(new JoinData() { JoinNumber = 40, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "Yellow", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Blue")]
|
||||
public JoinDataComplete Blue = new JoinDataComplete(new JoinData() { JoinNumber = 41, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "Blue", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Custom1")]
|
||||
public JoinDataComplete Custom1 = new JoinDataComplete(new JoinData() { JoinNumber = 42, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "Custom1", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Custom2")]
|
||||
public JoinDataComplete Custom2 = new JoinDataComplete(new JoinData() { JoinNumber = 43, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "Custom2", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Custom3")]
|
||||
public JoinDataComplete Custom3 = new JoinDataComplete(new JoinData() { JoinNumber = 44, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "Custom3", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Custom4")]
|
||||
public JoinDataComplete Custom4 = new JoinDataComplete(new JoinData() { JoinNumber = 45, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "Custom4", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Custom5")]
|
||||
public JoinDataComplete Custom5 = new JoinDataComplete(new JoinData() { JoinNumber = 46, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "Custom5", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Custom6")]
|
||||
public JoinDataComplete Custom6 = new JoinDataComplete(new JoinData() { JoinNumber = 47, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "Custom6", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Custom7")]
|
||||
public JoinDataComplete Custom7 = new JoinDataComplete(new JoinData() { JoinNumber = 48, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "Custom7", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Custom8")]
|
||||
public JoinDataComplete Custom8 = new JoinDataComplete(new JoinData() { JoinNumber = 49, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "Custom8", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Custom9")]
|
||||
public JoinDataComplete Custom9 = new JoinDataComplete(new JoinData() { JoinNumber = 50, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "Custom9", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Fav")]
|
||||
public JoinDataComplete Fav = new JoinDataComplete(new JoinData() { JoinNumber = 51, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "Fav", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("Home")]
|
||||
public JoinDataComplete Home = new JoinDataComplete(new JoinData() { JoinNumber = 52, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "Home", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("BatteryLow")]
|
||||
public JoinDataComplete BatteryLow = new JoinDataComplete(new JoinData() { JoinNumber = 53, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "BatteryLow", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("BatteryCritical")]
|
||||
public JoinDataComplete BatteryCritical = new JoinDataComplete(new JoinData() { JoinNumber = 54, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "BatteryCritical", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("BatteryVoltage")]
|
||||
public JoinDataComplete BatteryVoltage = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 },
|
||||
new JoinMetadata() { Label = "BatteryVoltage", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
|
||||
|
||||
public Hrxxx0WirelessRemoteControllerJoinMap(uint joinStart)
|
||||
: base(joinStart, typeof(Hrxxx0WirelessRemoteControllerJoinMap))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -11,8 +11,10 @@ using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
public class ComPortController : Device, IBasicCommunication
|
||||
public class ComPortController : Device, IBasicCommunicationWithStreamDebugging
|
||||
{
|
||||
public CommunicationStreamDebugging StreamDebugging { get; private set; }
|
||||
|
||||
public event EventHandler<GenericCommMethodReceiveBytesArgs> BytesReceived;
|
||||
public event EventHandler<GenericCommMethodReceiveTextArgs> TextReceived;
|
||||
|
||||
@@ -24,6 +26,8 @@ namespace PepperDash.Essentials.Core
|
||||
public ComPortController(string key, Func<EssentialsControlPropertiesConfig, ComPort> postActivationFunc,
|
||||
ComPort.ComPortSpec spec, EssentialsControlPropertiesConfig config) : base(key)
|
||||
{
|
||||
StreamDebugging = new CommunicationStreamDebugging(key);
|
||||
|
||||
Spec = spec;
|
||||
|
||||
AddPostActivationAction(() =>
|
||||
@@ -91,7 +95,12 @@ namespace PepperDash.Essentials.Core
|
||||
}
|
||||
var textHandler = TextReceived;
|
||||
if (textHandler != null)
|
||||
{
|
||||
if (StreamDebugging.RxStreamDebuggingIsEnabled)
|
||||
Debug.Console(0, this, "Recevied: '{0}'", s);
|
||||
|
||||
textHandler(this, new GenericCommMethodReceiveTextArgs(s));
|
||||
}
|
||||
}
|
||||
|
||||
public override bool Deactivate()
|
||||
@@ -105,7 +114,10 @@ namespace PepperDash.Essentials.Core
|
||||
{
|
||||
if (Port == null)
|
||||
return;
|
||||
Port.Send(text);
|
||||
|
||||
if (StreamDebugging.TxStreamDebuggingIsEnabled)
|
||||
Debug.Console(0, this, "Sending {0} characters of text: '{1}'", text.Length, text);
|
||||
Port.Send(text);
|
||||
}
|
||||
|
||||
public void SendBytes(byte[] bytes)
|
||||
@@ -113,6 +125,9 @@ namespace PepperDash.Essentials.Core
|
||||
if (Port == null)
|
||||
return;
|
||||
var text = Encoding.GetEncoding(28591).GetString(bytes, 0, bytes.Length);
|
||||
if (StreamDebugging.TxStreamDebuggingIsEnabled)
|
||||
Debug.Console(0, this, "Sending {0} bytes: '{1}'", bytes.Length, ComTextHelper.GetEscapedText(bytes));
|
||||
|
||||
Port.Send(text);
|
||||
}
|
||||
|
||||
@@ -184,6 +184,26 @@ namespace PepperDash.Essentials.Core
|
||||
throw new FormatException(string.Format("ERROR:Unable to convert Cresnet ID: {0} to hex. Error:\n{1}", CresnetId));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string InfinetId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Attepmts to provide uiont conversion of string InifinetId
|
||||
/// </summary>
|
||||
public uint InfinetIdInt
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
return Convert.ToUInt32(InfinetId, 16);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw new FormatException(string.Format("ERROR:Unable to conver Infinet ID: {0} to hex. Error:\n{1}", InfinetId));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,7 +76,14 @@ namespace PepperDash.Essentials.Core
|
||||
if (!string.IsNullOrEmpty(joinMapSerialized))
|
||||
joinMap = JsonConvert.DeserializeObject<IBasicCommunicationJoinMap>(joinMapSerialized);
|
||||
|
||||
bridge.AddJoinMap(Key, joinMap);
|
||||
if (bridge != null)
|
||||
{
|
||||
bridge.AddJoinMap(Key, joinMap);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
|
||||
}
|
||||
|
||||
if (CommPort == null)
|
||||
{
|
||||
@@ -0,0 +1,235 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharp.CrestronIO;
|
||||
using Crestron.SimplSharpPro;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static class IRPortHelper
|
||||
{
|
||||
public static string IrDriverPathPrefix
|
||||
{
|
||||
get
|
||||
{
|
||||
return Global.FilePathPrefix + "IR" + Global.DirectorySeparator;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Finds either the ControlSystem or a device controller that contains IR ports and
|
||||
/// returns a port from the hardware device
|
||||
/// </summary>
|
||||
/// <param name="propsToken"></param>
|
||||
/// <returns>IrPortConfig object. The port and or filename will be empty/null
|
||||
/// if valid values don't exist on config</returns>
|
||||
public static IrOutPortConfig GetIrPort(JToken propsToken)
|
||||
{
|
||||
var control = propsToken["control"];
|
||||
if (control == null)
|
||||
return null;
|
||||
if (control["method"].Value<string>() != "ir")
|
||||
{
|
||||
Debug.Console(0, "IRPortHelper called with non-IR properties");
|
||||
return null;
|
||||
}
|
||||
|
||||
var port = new IrOutPortConfig();
|
||||
|
||||
var portDevKey = control.Value<string>("controlPortDevKey");
|
||||
var portNum = control.Value<uint>("controlPortNumber");
|
||||
if (portDevKey == null || portNum == 0)
|
||||
{
|
||||
Debug.Console(1, "WARNING: Properties is missing port device or port number");
|
||||
return port;
|
||||
}
|
||||
|
||||
IIROutputPorts irDev = null;
|
||||
if (portDevKey.Equals("controlSystem", StringComparison.OrdinalIgnoreCase)
|
||||
|| portDevKey.Equals("processor", StringComparison.OrdinalIgnoreCase))
|
||||
irDev = Global.ControlSystem;
|
||||
else
|
||||
irDev = DeviceManager.GetDeviceForKey(portDevKey) as IIROutputPorts;
|
||||
|
||||
if (irDev == null)
|
||||
{
|
||||
Debug.Console(1, "[Config] Error, device with IR ports '{0}' not found", portDevKey);
|
||||
return port;
|
||||
}
|
||||
|
||||
if (portNum <= irDev.NumberOfIROutputPorts) // success!
|
||||
{
|
||||
var file = IrDriverPathPrefix + control["irFile"].Value<string>();
|
||||
port.Port = irDev.IROutputPorts[portNum];
|
||||
port.FileName = file;
|
||||
return port; // new IrOutPortConfig { Port = irDev.IROutputPorts[portNum], FileName = file };
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(1, "[Config] Error, device '{0}' IR port {1} out of range",
|
||||
portDevKey, portNum);
|
||||
return port;
|
||||
}
|
||||
}
|
||||
|
||||
public static IROutputPort GetIrOutputPort(DeviceConfig dc)
|
||||
{
|
||||
var irControllerKey = dc.Key + "-ir";
|
||||
if (dc.Properties == null)
|
||||
{
|
||||
Debug.Console(0, "[{0}] WARNING: Device config does not include properties. IR will not function.", dc.Key);
|
||||
return null;
|
||||
}
|
||||
|
||||
var control = dc.Properties["control"];
|
||||
if (control == null)
|
||||
{
|
||||
Debug.Console(0,
|
||||
"WARNING: Device config does not include control properties. IR will not function for {0}", dc.Key);
|
||||
return null;
|
||||
}
|
||||
|
||||
var portDevKey = control.Value<string>("controlPortDevKey");
|
||||
var portNum = control.Value<uint>("controlPortNumber");
|
||||
IIROutputPorts irDev = null;
|
||||
|
||||
if (portDevKey == null)
|
||||
{
|
||||
Debug.Console(0, "WARNING: control properties is missing ir device for {0}", dc.Key);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (portNum == 0)
|
||||
{
|
||||
Debug.Console(0, "WARNING: control properties is missing ir port number for {0}", dc.Key);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (portDevKey.Equals("controlSystem", StringComparison.OrdinalIgnoreCase)
|
||||
|| portDevKey.Equals("processor", StringComparison.OrdinalIgnoreCase))
|
||||
irDev = Global.ControlSystem;
|
||||
else
|
||||
irDev = DeviceManager.GetDeviceForKey(portDevKey) as IIROutputPorts;
|
||||
|
||||
if (irDev == null)
|
||||
{
|
||||
Debug.Console(0, "WARNING: device with IR ports '{0}' not found", portDevKey);
|
||||
return null;
|
||||
}
|
||||
if (portNum >= irDev.NumberOfIROutputPorts)
|
||||
{
|
||||
Debug.Console(0, "WARNING: device '{0}' IR port {1} out of range",
|
||||
portDevKey, portNum);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
var port = irDev.IROutputPorts[portNum];
|
||||
|
||||
port.LoadIRDriver(Global.FilePathPrefix + "IR" + Global.DirectorySeparator + control["irFile"].Value<string>());
|
||||
|
||||
return port;
|
||||
|
||||
}
|
||||
|
||||
public static IrOutputPortController GetIrOutputPortController(DeviceConfig config)
|
||||
{
|
||||
Debug.Console(1, "Attempting to create new Ir Port Controller");
|
||||
|
||||
if (config == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var irDevice = new IrOutputPortController(config.Key, GetIrOutputPort, config);
|
||||
|
||||
return irDevice;
|
||||
}
|
||||
|
||||
/*
|
||||
/// <summary>
|
||||
/// Returns a ready-to-go IrOutputPortController from a DeviceConfig object.
|
||||
/// </summary>
|
||||
public static IrOutputPortController GetIrOutputPortController(DeviceConfig devConf)
|
||||
{
|
||||
var irControllerKey = devConf.Key + "-ir";
|
||||
if (devConf.Properties == null)
|
||||
{
|
||||
Debug.Console(0, "[{0}] WARNING: Device config does not include properties. IR will not function.", devConf.Key);
|
||||
return new IrOutputPortController(irControllerKey, null, "");
|
||||
}
|
||||
|
||||
var control = devConf.Properties["control"];
|
||||
if (control == null)
|
||||
{
|
||||
var c = new IrOutputPortController(irControllerKey, null, "");
|
||||
Debug.Console(0, c, "WARNING: Device config does not include control properties. IR will not function");
|
||||
return c;
|
||||
}
|
||||
|
||||
var portDevKey = control.Value<string>("controlPortDevKey");
|
||||
var portNum = control.Value<uint>("controlPortNumber");
|
||||
IIROutputPorts irDev = null;
|
||||
|
||||
if (portDevKey == null)
|
||||
{
|
||||
var c = new IrOutputPortController(irControllerKey, null, "");
|
||||
Debug.Console(0, c, "WARNING: control properties is missing ir device");
|
||||
return c;
|
||||
}
|
||||
|
||||
if (portNum == 0)
|
||||
{
|
||||
var c = new IrOutputPortController(irControllerKey, null, "");
|
||||
Debug.Console(0, c, "WARNING: control properties is missing ir port number");
|
||||
return c;
|
||||
}
|
||||
|
||||
if (portDevKey.Equals("controlSystem", StringComparison.OrdinalIgnoreCase)
|
||||
|| portDevKey.Equals("processor", StringComparison.OrdinalIgnoreCase))
|
||||
irDev = Global.ControlSystem;
|
||||
else
|
||||
irDev = DeviceManager.GetDeviceForKey(portDevKey) as IIROutputPorts;
|
||||
|
||||
if (irDev == null)
|
||||
{
|
||||
var c = new IrOutputPortController(irControllerKey, null, "");
|
||||
Debug.Console(0, c, "WARNING: device with IR ports '{0}' not found", portDevKey);
|
||||
return c;
|
||||
}
|
||||
|
||||
if (portNum <= irDev.NumberOfIROutputPorts) // success!
|
||||
return new IrOutputPortController(irControllerKey, irDev.IROutputPorts[portNum],
|
||||
IrDriverPathPrefix + control["irFile"].Value<string>());
|
||||
else
|
||||
{
|
||||
var c = new IrOutputPortController(irControllerKey, null, "");
|
||||
Debug.Console(0, c, "WARNING: device '{0}' IR port {1} out of range",
|
||||
portDevKey, portNum);
|
||||
return c;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wrapper to help in IR port creation
|
||||
/// </summary>
|
||||
public class IrOutPortConfig
|
||||
{
|
||||
public IROutputPort Port { get; set; }
|
||||
public string FileName { get; set; }
|
||||
|
||||
public IrOutPortConfig()
|
||||
{
|
||||
FileName = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ using Crestron.SimplSharp;
|
||||
using Newtonsoft.Json;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash_Essentials_Core.Devices;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Config
|
||||
{
|
||||
@@ -23,7 +24,10 @@ namespace PepperDash.Essentials.Core.Config
|
||||
[JsonProperty("sourceLists")]
|
||||
public Dictionary<string, Dictionary<string, SourceListItem>> SourceLists { get; set; }
|
||||
|
||||
[JsonProperty("tieLines")]
|
||||
[JsonProperty("destinationLists")]
|
||||
public Dictionary<string, Dictionary<string, DestinationListItem>> DestinationLists { get; set; }
|
||||
|
||||
[JsonProperty("tieLines")]
|
||||
public List<TieLineConfig> TieLines { get; set; }
|
||||
|
||||
[JsonProperty("joinMaps")]
|
||||
@@ -40,6 +44,14 @@ namespace PepperDash.Essentials.Core.Config
|
||||
return SourceLists[key];
|
||||
}
|
||||
|
||||
public Dictionary<string, DestinationListItem> GetDestinationListForKey(string key)
|
||||
{
|
||||
if (string.IsNullOrEmpty(key) || !SourceLists.ContainsKey(key))
|
||||
return null;
|
||||
|
||||
return DestinationLists[key];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks Devices for an item with a Key that matches and returns it if found. Otherwise, retunes null
|
||||
/// </summary>
|
||||
@@ -52,12 +64,9 @@ namespace PepperDash.Essentials.Core.Config
|
||||
|
||||
var deviceConfig = Devices.FirstOrDefault(d => d.Key.Equals(key));
|
||||
|
||||
if (deviceConfig != null)
|
||||
return deviceConfig;
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
//removed if statement that was here...
|
||||
//DeviceConfig will be null if it's not found in the list
|
||||
return deviceConfig;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,105 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
public class ComPortController : Device, IBasicCommunication
|
||||
{
|
||||
public event EventHandler<GenericCommMethodReceiveBytesArgs> BytesReceived;
|
||||
public event EventHandler<GenericCommMethodReceiveTextArgs> TextReceived;
|
||||
|
||||
ComPort Port;
|
||||
ComPort.ComPortSpec Spec;
|
||||
|
||||
public ComPortController(string key, IComPorts ComDevice, uint comPortNum, ComPort.ComPortSpec spec)
|
||||
: base(key)
|
||||
{
|
||||
Port = ComDevice.ComPorts[comPortNum];
|
||||
Spec = spec;
|
||||
|
||||
Debug.Console(2, "Creating com port '{0}'", key);
|
||||
Debug.Console(2, "Com port spec:\r{0}", JsonConvert.SerializeObject(spec));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a ComPort if the parameters are correct. Returns and logs errors if not
|
||||
/// </summary>
|
||||
public static ComPortController GetComPortController(string key,
|
||||
IComPorts comDevice, uint comPortNum, ComPort.ComPortSpec spec)
|
||||
{
|
||||
Debug.Console(1, "Creating com port '{0}'", key);
|
||||
if (comDevice == null)
|
||||
throw new ArgumentNullException("comDevice");
|
||||
if (string.IsNullOrEmpty(key))
|
||||
throw new ArgumentNullException("key");
|
||||
if (comPortNum > comDevice.NumberOfComPorts)
|
||||
{
|
||||
Debug.Console(0, "[{0}] Com port {1} out of range on {2}",
|
||||
key, comPortNum, comDevice.GetType().Name);
|
||||
return null;
|
||||
}
|
||||
var port = new ComPortController(key, comDevice, comPortNum, spec);
|
||||
return port;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registers port and sends ComSpec
|
||||
/// </summary>
|
||||
/// <returns>false if either register or comspec fails</returns>
|
||||
public override bool CustomActivate()
|
||||
{
|
||||
var result = Port.Register();
|
||||
if (result != eDeviceRegistrationUnRegistrationResponse.Success)
|
||||
{
|
||||
Debug.Console(0, this, "Cannot register Com port: {0}", result);
|
||||
return false;
|
||||
}
|
||||
var specResult = Port.SetComPortSpec(Spec);
|
||||
if (specResult != 0)
|
||||
{
|
||||
Debug.Console(0, this, "Cannot set comspec");
|
||||
return false;
|
||||
}
|
||||
Port.SerialDataReceived += new ComPortDataReceivedEvent(Port_SerialDataReceived);
|
||||
return true;
|
||||
}
|
||||
|
||||
void Port_SerialDataReceived(ComPort ReceivingComPort, ComPortSerialDataEventArgs args)
|
||||
{
|
||||
if (BytesReceived != null)
|
||||
{
|
||||
var bytes = Encoding.GetEncoding(28591).GetBytes(args.SerialData);
|
||||
BytesReceived(this, new GenericCommMethodReceiveBytesArgs(bytes));
|
||||
}
|
||||
if(TextReceived != null)
|
||||
TextReceived(this, new GenericCommMethodReceiveTextArgs(args.SerialData));
|
||||
}
|
||||
|
||||
public override bool Deactivate()
|
||||
{
|
||||
return Port.UnRegister() == eDeviceRegistrationUnRegistrationResponse.Success;
|
||||
}
|
||||
|
||||
#region IBasicCommunication Members
|
||||
|
||||
public void SendText(string text)
|
||||
{
|
||||
Port.Send(text);
|
||||
}
|
||||
|
||||
public void SendBytes(byte[] bytes)
|
||||
{
|
||||
|
||||
var text = Encoding.GetEncoding(28591).GetString(bytes, 0, bytes.Length);
|
||||
Port.Send(text);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,160 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharp.CrestronIO;
|
||||
using Crestron.SimplSharpPro;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static class IRPortHelper
|
||||
{
|
||||
public static string IrDriverPathPrefix
|
||||
{
|
||||
get
|
||||
{
|
||||
return Global.FilePathPrefix + "IR" + Global.DirectorySeparator;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Finds either the ControlSystem or a device controller that contains IR ports and
|
||||
/// returns a port from the hardware device
|
||||
/// </summary>
|
||||
/// <param name="propsToken"></param>
|
||||
/// <returns>IrPortConfig object. The port and or filename will be empty/null
|
||||
/// if valid values don't exist on config</returns>
|
||||
public static IrOutPortConfig GetIrPort(JToken propsToken)
|
||||
{
|
||||
var control = propsToken["control"];
|
||||
if (control == null)
|
||||
return null;
|
||||
if (control["method"].Value<string>() != "ir")
|
||||
{
|
||||
Debug.Console(0, "IRPortHelper called with non-IR properties");
|
||||
return null;
|
||||
}
|
||||
|
||||
var port = new IrOutPortConfig();
|
||||
|
||||
var portDevKey = control.Value<string>("controlPortDevKey");
|
||||
var portNum = control.Value<uint>("controlPortNumber");
|
||||
if (portDevKey == null || portNum == 0)
|
||||
{
|
||||
Debug.Console(1, "WARNING: Properties is missing port device or port number");
|
||||
return port;
|
||||
}
|
||||
|
||||
IIROutputPorts irDev = null;
|
||||
if (portDevKey.Equals("controlSystem", StringComparison.OrdinalIgnoreCase)
|
||||
|| portDevKey.Equals("processor", StringComparison.OrdinalIgnoreCase))
|
||||
irDev = Global.ControlSystem;
|
||||
else
|
||||
irDev = DeviceManager.GetDeviceForKey(portDevKey) as IIROutputPorts;
|
||||
|
||||
if (irDev == null)
|
||||
{
|
||||
Debug.Console(1, "[Config] Error, device with IR ports '{0}' not found", portDevKey);
|
||||
return port;
|
||||
}
|
||||
|
||||
if (portNum <= irDev.NumberOfIROutputPorts) // success!
|
||||
{
|
||||
var file = IrDriverPathPrefix + control["irFile"].Value<string>();
|
||||
port.Port = irDev.IROutputPorts[portNum];
|
||||
port.FileName = file;
|
||||
return port; // new IrOutPortConfig { Port = irDev.IROutputPorts[portNum], FileName = file };
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(1, "[Config] Error, device '{0}' IR port {1} out of range",
|
||||
portDevKey, portNum);
|
||||
return port;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a ready-to-go IrOutputPortController from a DeviceConfig object.
|
||||
/// </summary>
|
||||
public static IrOutputPortController GetIrOutputPortController(DeviceConfig devConf)
|
||||
{
|
||||
var irControllerKey = devConf.Key + "-ir";
|
||||
if (devConf.Properties == null)
|
||||
{
|
||||
Debug.Console(0, "[{0}] WARNING: Device config does not include properties. IR will not function.", devConf.Key);
|
||||
return new IrOutputPortController(irControllerKey, null, "");
|
||||
}
|
||||
|
||||
var control = devConf.Properties["control"];
|
||||
if (control == null)
|
||||
{
|
||||
var c = new IrOutputPortController(irControllerKey, null, "");
|
||||
Debug.Console(0, c, "WARNING: Device config does not include control properties. IR will not function");
|
||||
return c;
|
||||
}
|
||||
|
||||
var portDevKey = control.Value<string>("controlPortDevKey");
|
||||
var portNum = control.Value<uint>("controlPortNumber");
|
||||
IIROutputPorts irDev = null;
|
||||
|
||||
if (portDevKey == null)
|
||||
{
|
||||
var c = new IrOutputPortController(irControllerKey, null, "");
|
||||
Debug.Console(0, c, "WARNING: control properties is missing ir device");
|
||||
return c;
|
||||
}
|
||||
|
||||
if (portNum == 0)
|
||||
{
|
||||
var c = new IrOutputPortController(irControllerKey, null, "");
|
||||
Debug.Console(0, c, "WARNING: control properties is missing ir port number");
|
||||
return c;
|
||||
}
|
||||
|
||||
if (portDevKey.Equals("controlSystem", StringComparison.OrdinalIgnoreCase)
|
||||
|| portDevKey.Equals("processor", StringComparison.OrdinalIgnoreCase))
|
||||
irDev = Global.ControlSystem;
|
||||
else
|
||||
irDev = DeviceManager.GetDeviceForKey(portDevKey) as IIROutputPorts;
|
||||
|
||||
if (irDev == null)
|
||||
{
|
||||
var c = new IrOutputPortController(irControllerKey, null, "");
|
||||
Debug.Console(0, c, "WARNING: device with IR ports '{0}' not found", portDevKey);
|
||||
return c;
|
||||
}
|
||||
|
||||
if (portNum <= irDev.NumberOfIROutputPorts) // success!
|
||||
return new IrOutputPortController(irControllerKey, irDev.IROutputPorts[portNum],
|
||||
IrDriverPathPrefix + control["irFile"].Value<string>());
|
||||
else
|
||||
{
|
||||
var c = new IrOutputPortController(irControllerKey, null, "");
|
||||
Debug.Console(0, c, "WARNING: device '{0}' IR port {1} out of range",
|
||||
portDevKey, portNum);
|
||||
return c;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wrapper to help in IR port creation
|
||||
/// </summary>
|
||||
public class IrOutPortConfig
|
||||
{
|
||||
public IROutputPort Port { get; set; }
|
||||
public string FileName { get; set; }
|
||||
|
||||
public IrOutPortConfig()
|
||||
{
|
||||
FileName = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -55,7 +55,14 @@ namespace PepperDash.Essentials.Core.CrestronIO
|
||||
if (!string.IsNullOrEmpty(joinMapSerialized))
|
||||
joinMap = JsonConvert.DeserializeObject<C2nRthsControllerJoinMap>(joinMapSerialized);
|
||||
|
||||
bridge.AddJoinMap(Key, joinMap);
|
||||
if (bridge != null)
|
||||
{
|
||||
bridge.AddJoinMap(Key, joinMap);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
|
||||
}
|
||||
|
||||
Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using Crestron.SimplSharpProInternal;
|
||||
|
||||
namespace PepperDash.Essentials.Core.CrestronIO.Cards
|
||||
{
|
||||
public class C3CardControllerBase:CrestronGenericBaseDevice
|
||||
{
|
||||
private readonly C3Card _card;
|
||||
|
||||
public C3CardControllerBase(string key, string name, C3Card hardware) : base(key, name, hardware)
|
||||
{
|
||||
_card = hardware;
|
||||
}
|
||||
|
||||
#region Overrides of Object
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return String.Format("{0} {1}", Key, _card.ToString());
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.ThreeSeriesCards;
|
||||
|
||||
namespace PepperDash.Essentials.Core.CrestronIO.Cards
|
||||
{
|
||||
public class C3Com3Controller:C3CardControllerBase, IComPorts
|
||||
{
|
||||
private readonly C3com3 _card;
|
||||
|
||||
public C3Com3Controller(string key, string name, C3com3 hardware) : base(key, name, hardware)
|
||||
{
|
||||
_card = hardware;
|
||||
}
|
||||
|
||||
#region Implementation of IComPorts
|
||||
|
||||
public CrestronCollection<ComPort> ComPorts
|
||||
{
|
||||
get { return _card.ComPorts; }
|
||||
}
|
||||
|
||||
public int NumberOfComPorts
|
||||
{
|
||||
get { return _card.NumberOfComPorts; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.ThreeSeriesCards;
|
||||
|
||||
namespace PepperDash.Essentials.Core.CrestronIO.Cards
|
||||
{
|
||||
public class C3Io16Controller:C3CardControllerBase,IIOPorts
|
||||
{
|
||||
private readonly C3io16 _card;
|
||||
|
||||
public C3Io16Controller(string key, string name, C3io16 hardware) : base(key, name, hardware)
|
||||
{
|
||||
_card = hardware;
|
||||
}
|
||||
|
||||
#region Implementation of IIOPorts
|
||||
|
||||
public CrestronCollection<Versiport> VersiPorts
|
||||
{
|
||||
get { return _card.VersiPorts; }
|
||||
}
|
||||
|
||||
public int NumberOfVersiPorts
|
||||
{
|
||||
get { return _card.NumberOfVersiPorts; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.ThreeSeriesCards;
|
||||
|
||||
namespace PepperDash.Essentials.Core.CrestronIO.Cards
|
||||
{
|
||||
public class C3Ir8Controller:C3CardControllerBase, IIROutputPorts
|
||||
{
|
||||
private readonly C3ir8 _card;
|
||||
|
||||
public C3Ir8Controller(string key, string name, C3ir8 hardware) : base(key, name, hardware)
|
||||
{
|
||||
_card = hardware;
|
||||
}
|
||||
|
||||
#region Implementation of IIROutputPorts
|
||||
|
||||
public CrestronCollection<IROutputPort> IROutputPorts
|
||||
{
|
||||
get { return _card.IROutputPorts; }
|
||||
}
|
||||
|
||||
public int NumberOfIROutputPorts
|
||||
{
|
||||
get { return _card.NumberOfIROutputPorts; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.ThreeSeriesCards;
|
||||
|
||||
namespace PepperDash.Essentials.Core.CrestronIO.Cards
|
||||
{
|
||||
public class C3Ry16Controller:C3CardControllerBase, IRelayPorts
|
||||
{
|
||||
private readonly C3ry16 _card;
|
||||
|
||||
public C3Ry16Controller(string key, string name, C3ry16 hardware) : base(key, name, hardware)
|
||||
{
|
||||
_card = hardware;
|
||||
}
|
||||
|
||||
#region Implementation of IRelayPorts
|
||||
|
||||
public CrestronCollection<Relay> RelayPorts
|
||||
{
|
||||
get { return _card.RelayPorts; }
|
||||
}
|
||||
|
||||
public int NumberOfRelayPorts
|
||||
{
|
||||
get { return _card.NumberOfRelayPorts; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.ThreeSeriesCards;
|
||||
|
||||
namespace PepperDash.Essentials.Core.CrestronIO.Cards
|
||||
{
|
||||
public class C3Ry8Controller:C3CardControllerBase, IRelayPorts
|
||||
{
|
||||
private readonly C3ry8 _card;
|
||||
|
||||
public C3Ry8Controller(string key, string name, C3ry8 hardware) : base(key, name, hardware)
|
||||
{
|
||||
_card = hardware;
|
||||
}
|
||||
|
||||
#region Implementation of IRelayPorts
|
||||
|
||||
public CrestronCollection<Relay> RelayPorts
|
||||
{
|
||||
get { return _card.RelayPorts; }
|
||||
}
|
||||
|
||||
public int NumberOfRelayPorts
|
||||
{
|
||||
get { return _card.NumberOfRelayPorts; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Crestron.SimplSharpPro.ThreeSeriesCards;
|
||||
using Newtonsoft.Json;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
|
||||
namespace PepperDash.Essentials.Core.CrestronIO.Cards
|
||||
{
|
||||
[ConfigSnippet("\"properties\":{\"card\":\"c3com3\"}")]
|
||||
public class CenCi31Controller : CrestronGenericBaseDevice
|
||||
{
|
||||
private const string CardKeyTemplate = "{0}-card";
|
||||
private const string CardNameTemplate = "{0}:{1}:{2}";
|
||||
private const uint CardSlot = 1;
|
||||
private readonly CenCi31 _cardCage;
|
||||
private readonly CenCi31Configuration _config;
|
||||
|
||||
private readonly Dictionary<string, Func<CenCi31, uint, C3CardControllerBase>> _cardDict;
|
||||
|
||||
public CenCi31Controller(string key, string name, CenCi31Configuration config, CenCi31 hardware) : base(key, name, hardware)
|
||||
{
|
||||
_cardCage = hardware;
|
||||
|
||||
_config = config;
|
||||
|
||||
_cardDict = new Dictionary<string, Func<CenCi31, uint, C3CardControllerBase>>
|
||||
{
|
||||
{
|
||||
"c3com3",
|
||||
(c, s) =>
|
||||
new C3Com3Controller(String.Format(CardKeyTemplate, key),
|
||||
String.Format(CardNameTemplate, key, s, "C3Com3"), new C3com3(_cardCage))
|
||||
},
|
||||
{
|
||||
"c3io16",
|
||||
(c, s) =>
|
||||
new C3Io16Controller(String.Format(CardKeyTemplate, key),
|
||||
String.Format(CardNameTemplate, key, s,"C3Io16"), new C3io16(_cardCage))
|
||||
},
|
||||
{
|
||||
"c3ir8",
|
||||
(c, s) =>
|
||||
new C3Ir8Controller(String.Format(CardKeyTemplate, key),
|
||||
String.Format(CardNameTemplate, key, s, "C3Ir8"), new C3ir8(_cardCage))
|
||||
},
|
||||
{
|
||||
"c3ry16",
|
||||
(c, s) =>
|
||||
new C3Ry16Controller(String.Format(CardKeyTemplate, key),
|
||||
String.Format(CardNameTemplate, key, s, "C3Ry16"), new C3ry16(_cardCage))
|
||||
},
|
||||
{
|
||||
"c3ry8",
|
||||
(c, s) =>
|
||||
new C3Ry8Controller(String.Format(CardKeyTemplate, key),
|
||||
String.Format(CardNameTemplate, key, s, "C3Ry8"), new C3ry8(_cardCage))
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
GetCards();
|
||||
}
|
||||
|
||||
private void GetCards()
|
||||
{
|
||||
Func<CenCi31, uint, C3CardControllerBase> cardBuilder;
|
||||
|
||||
if (String.IsNullOrEmpty(_config.Card))
|
||||
{
|
||||
Debug.Console(0, this, "No card specified");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_cardDict.TryGetValue(_config.Card.ToLower(), out cardBuilder))
|
||||
{
|
||||
Debug.Console(0, "Unable to find factory for 3-Series card type {0}.", _config.Card);
|
||||
return;
|
||||
}
|
||||
|
||||
var device = cardBuilder(_cardCage, CardSlot);
|
||||
|
||||
DeviceManager.AddDevice(device);
|
||||
}
|
||||
}
|
||||
|
||||
public class CenCi31Configuration
|
||||
{
|
||||
[JsonProperty("card")]
|
||||
public string Card { get; set; }
|
||||
}
|
||||
|
||||
public class CenCi31ControllerFactory : EssentialsDeviceFactory<CenCi31Controller>
|
||||
{
|
||||
public CenCi31ControllerFactory()
|
||||
{
|
||||
TypeNames = new List<string> {"cenci31"};
|
||||
}
|
||||
#region Overrides of EssentialsDeviceFactory<CenCi31Controller>
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory attempting to build new CEN-CI-1");
|
||||
|
||||
var controlProperties = CommFactory.GetControlPropertiesConfig(dc);
|
||||
var ipId = controlProperties.IpIdInt;
|
||||
|
||||
var cardCage = new CenCi31(ipId, Global.ControlSystem);
|
||||
var config = dc.Properties.ToObject<CenCi31Configuration>();
|
||||
|
||||
return new CenCi31Controller(dc.Key, dc.Name, config, cardCage);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Crestron.SimplSharpPro.ThreeSeriesCards;
|
||||
using Newtonsoft.Json;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
|
||||
namespace PepperDash.Essentials.Core.CrestronIO.Cards
|
||||
{
|
||||
[ConfigSnippet("\"properties\":{\"cards\":{\"1\":\"c3com3\",\"2\":\"c3ry16\",\"3\":\"c3ry8\"}}")]
|
||||
public class CenCi33Controller : CrestronGenericBaseDevice
|
||||
{
|
||||
private const string CardKeyTemplate = "{0}-card{1}";
|
||||
private const string CardNameTemplate = "{0}:{1}:{2}";
|
||||
private const uint CardSlots = 3;
|
||||
private readonly CenCi33 _cardCage;
|
||||
private readonly CenCi33Configuration _config;
|
||||
|
||||
private readonly Dictionary<string, Func<CenCi33, uint, C3CardControllerBase>> _cardDict;
|
||||
|
||||
public CenCi33Controller(string key, string name, CenCi33Configuration config, CenCi33 hardware) : base(key, name, hardware)
|
||||
{
|
||||
_cardCage = hardware;
|
||||
|
||||
_config = config;
|
||||
|
||||
_cardDict = new Dictionary<string, Func<CenCi33, uint, C3CardControllerBase>>
|
||||
{
|
||||
{
|
||||
"c3com3",
|
||||
(c, s) =>
|
||||
new C3Com3Controller(String.Format(CardKeyTemplate, key, s),
|
||||
String.Format(CardNameTemplate, key, s, "C3Com3"), new C3com3(s,_cardCage))
|
||||
},
|
||||
{
|
||||
"c3io16",
|
||||
(c, s) =>
|
||||
new C3Io16Controller(String.Format(CardKeyTemplate, key, s),
|
||||
String.Format(CardNameTemplate, key, s, "C3Io16"), new C3io16(s,_cardCage))
|
||||
},
|
||||
{
|
||||
"c3ir8",
|
||||
(c, s) =>
|
||||
new C3Ir8Controller(String.Format(CardKeyTemplate, key, s),
|
||||
String.Format(CardNameTemplate, key, s, "C3Ir8"), new C3ir8(s,_cardCage))
|
||||
},
|
||||
{
|
||||
"c3ry16",
|
||||
(c, s) =>
|
||||
new C3Ry16Controller(String.Format(CardKeyTemplate, key, s),
|
||||
String.Format(CardNameTemplate, key, s, "C3Ry16"), new C3ry16(s,_cardCage))
|
||||
},
|
||||
{
|
||||
"c3ry8",
|
||||
(c, s) =>
|
||||
new C3Ry8Controller(String.Format(CardKeyTemplate, key, s),
|
||||
String.Format(CardNameTemplate, key, s, "C3Ry8"), new C3ry8(s,_cardCage))
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
GetCards();
|
||||
}
|
||||
|
||||
private void GetCards()
|
||||
{
|
||||
if (_config.Cards == null)
|
||||
{
|
||||
Debug.Console(0, this, "No card configuration for this device found");
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint i = 1; i <= CardSlots; i++)
|
||||
{
|
||||
string cardType;
|
||||
if (!_config.Cards.TryGetValue(i, out cardType))
|
||||
{
|
||||
Debug.Console(1, this, "No card found for slot {0}", i);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (String.IsNullOrEmpty(cardType))
|
||||
{
|
||||
Debug.Console(0, this, "No card specified for slot {0}", i);
|
||||
return;
|
||||
}
|
||||
|
||||
Func<CenCi33, uint, C3CardControllerBase> cardBuilder;
|
||||
if (!_cardDict.TryGetValue(cardType.ToLower(), out cardBuilder))
|
||||
{
|
||||
Debug.Console(0, "Unable to find factory for 3-Series card type {0}.", cardType);
|
||||
return;
|
||||
}
|
||||
|
||||
var device = cardBuilder(_cardCage, i);
|
||||
|
||||
DeviceManager.AddDevice(device);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class CenCi33Configuration
|
||||
{
|
||||
[JsonProperty("cards")]
|
||||
public Dictionary<uint, string> Cards { get; set; }
|
||||
}
|
||||
|
||||
public class CenCi33ControllerFactory : EssentialsDeviceFactory<CenCi33Controller>
|
||||
{
|
||||
public CenCi33ControllerFactory()
|
||||
{
|
||||
TypeNames = new List<string> {"cenci33"};
|
||||
}
|
||||
#region Overrides of EssentialsDeviceFactory<CenCi33Controller>
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory attempting to build new CEN-CI-3");
|
||||
|
||||
var controlProperties = CommFactory.GetControlPropertiesConfig(dc);
|
||||
var ipId = controlProperties.IpIdInt;
|
||||
|
||||
var cardCage = new CenCi33(ipId, Global.ControlSystem);
|
||||
var config = dc.Properties.ToObject<CenCi33Configuration>();
|
||||
|
||||
return new CenCi33Controller(dc.Key, dc.Name, config, cardCage);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Crestron.SimplSharpPro.ThreeSeriesCards;
|
||||
using Newtonsoft.Json;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
|
||||
namespace PepperDash.Essentials.Core.CrestronIO.Cards
|
||||
{
|
||||
[ConfigSnippet("\"properties\":{\"cards\":{\"1\":\"c3com3\",\"2\":\"c3ry16\",\"3\":\"c3ry8\"}}")]
|
||||
public class InternalCardCageController : EssentialsDevice
|
||||
{
|
||||
private const string CardKeyTemplate = "{0}-card{1}";
|
||||
private const string CardNameTemplate = "{0}:{1}:{2}";
|
||||
private const uint CardSlots = 3;
|
||||
|
||||
private readonly InternalCardCageConfiguration _config;
|
||||
|
||||
private readonly Dictionary<string, Func<uint, C3CardControllerBase>> _cardDict;
|
||||
|
||||
public InternalCardCageController(string key, string name, InternalCardCageConfiguration config) : base(key, name)
|
||||
{
|
||||
_config = config;
|
||||
|
||||
_cardDict = new Dictionary<string, Func<uint, C3CardControllerBase>>
|
||||
{
|
||||
{
|
||||
"c3com3",
|
||||
(s) =>
|
||||
new C3Com3Controller(String.Format(CardKeyTemplate, key, s),
|
||||
String.Format(CardNameTemplate, key, s, "C3Com3"), new C3com3(s,Global.ControlSystem))
|
||||
},
|
||||
{
|
||||
"c3io16",
|
||||
(s) =>
|
||||
new C3Io16Controller(String.Format(CardKeyTemplate, key, s),
|
||||
String.Format(CardNameTemplate, key, s, "C3Io16"), new C3io16(s,Global.ControlSystem))
|
||||
},
|
||||
{
|
||||
"c3ir8",
|
||||
(s) =>
|
||||
new C3Ir8Controller(String.Format(CardKeyTemplate, key, s),
|
||||
String.Format(CardNameTemplate, key, s, "C3Ir8"), new C3ir8(s,Global.ControlSystem))
|
||||
},
|
||||
{
|
||||
"c3ry16",
|
||||
(s) =>
|
||||
new C3Ry16Controller(String.Format(CardKeyTemplate, key, s),
|
||||
String.Format(CardNameTemplate, key, s, "C3Ry16"), new C3ry16(s,Global.ControlSystem))
|
||||
},
|
||||
{
|
||||
"c3ry8",
|
||||
(s) =>
|
||||
new C3Ry8Controller(String.Format(CardKeyTemplate, key, s),
|
||||
String.Format(CardNameTemplate, key, s, "C3Ry8"), new C3ry8(s,Global.ControlSystem))
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
GetCards();
|
||||
}
|
||||
|
||||
private void GetCards()
|
||||
{
|
||||
if (_config.Cards == null)
|
||||
{
|
||||
Debug.Console(0, this, "No card configuration for this device found");
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint i = 1; i <= CardSlots; i++)
|
||||
{
|
||||
string cardType;
|
||||
if (!_config.Cards.TryGetValue(i, out cardType))
|
||||
{
|
||||
Debug.Console(1, this, "No card found for slot {0}", i);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (String.IsNullOrEmpty(cardType))
|
||||
{
|
||||
Debug.Console(0, this, "No card specified for slot {0}", i);
|
||||
return;
|
||||
}
|
||||
|
||||
Func<uint, C3CardControllerBase> cardBuilder;
|
||||
if (!_cardDict.TryGetValue(cardType.ToLower(), out cardBuilder))
|
||||
{
|
||||
Debug.Console(0, "Unable to find factory for 3-Series card type {0}.", cardType);
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var device = cardBuilder(i);
|
||||
|
||||
|
||||
DeviceManager.AddDevice(device);
|
||||
}
|
||||
catch (InvalidOperationException ex)
|
||||
{
|
||||
Debug.Console(0, this, Debug.ErrorLogLevel.Error,
|
||||
"Unable to add card {0} to internal card cage.\r\nError Message: {1}\r\nStack Trace: {2}",
|
||||
cardType, ex.Message, ex.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class InternalCardCageConfiguration
|
||||
{
|
||||
[JsonProperty("cards")]
|
||||
public Dictionary<uint, string> Cards { get; set; }
|
||||
}
|
||||
|
||||
public class InternalCardCageControllerFactory : EssentialsDeviceFactory<InternalCardCageController>
|
||||
{
|
||||
public InternalCardCageControllerFactory()
|
||||
{
|
||||
TypeNames = new List<string> {"internalcardcage"};
|
||||
}
|
||||
#region Overrides of EssentialsDeviceFactory<InternalCardCageController>
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory attempting to build new Internal Card Cage Controller");
|
||||
|
||||
if (!Global.ControlSystem.SupportsThreeSeriesPlugInCards)
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Warning, "Current control system does NOT support 3-Series cards. Everything is NOT awesome.");
|
||||
return null;
|
||||
}
|
||||
|
||||
var config = dc.Properties.ToObject<InternalCardCageConfiguration>();
|
||||
|
||||
return new InternalCardCageController(dc.Key, dc.Name, config);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,8 @@ using PepperDash.Essentials.Core.Config;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.Core.CrestronIO
|
||||
{
|
||||
{
|
||||
[Description("Wrapper class for Digital Input")]
|
||||
public class GenericDigitalInputDevice : EssentialsBridgeableDevice, IDigitalInput
|
||||
{
|
||||
public DigitalInput InputPort { get; private set; }
|
||||
@@ -26,23 +27,78 @@ namespace PepperDash.Essentials.Core.CrestronIO
|
||||
return () => InputPort.State;
|
||||
}
|
||||
}
|
||||
|
||||
public GenericDigitalInputDevice(string key, DigitalInput inputPort):
|
||||
base(key)
|
||||
{
|
||||
InputStateFeedback = new BoolFeedback(InputStateFeedbackFunc);
|
||||
|
||||
InputPort = inputPort;
|
||||
|
||||
InputPort.StateChange += InputPort_StateChange;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public GenericDigitalInputDevice(string key, string name, Func<IOPortConfig, DigitalInput> postActivationFunc,
|
||||
IOPortConfig config)
|
||||
: base(key, name)
|
||||
{
|
||||
|
||||
AddPostActivationAction(() =>
|
||||
{
|
||||
InputPort = postActivationFunc(config);
|
||||
|
||||
InputPort.Register();
|
||||
|
||||
InputPort.StateChange += InputPort_StateChange;
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
#region Events
|
||||
|
||||
void InputPort_StateChange(DigitalInput digitalInput, DigitalInputEventArgs args)
|
||||
{
|
||||
InputStateFeedback.FireUpdate();
|
||||
}
|
||||
|
||||
InputStateFeedback.FireUpdate();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region PreActivate
|
||||
|
||||
private static DigitalInput GetDigitalInput(IOPortConfig dc)
|
||||
{
|
||||
IDigitalInputPorts ioPortDevice;
|
||||
|
||||
if (dc.PortDeviceKey.Equals("processor"))
|
||||
{
|
||||
if (!Global.ControlSystem.SupportsDigitalInput)
|
||||
{
|
||||
Debug.Console(0, "GetDigitalInput: Processor does not support Digital Inputs");
|
||||
return null;
|
||||
}
|
||||
ioPortDevice = Global.ControlSystem;
|
||||
}
|
||||
else
|
||||
{
|
||||
var ioPortDev = DeviceManager.GetDeviceForKey(dc.PortDeviceKey) as IDigitalInputPorts;
|
||||
if (ioPortDev == null)
|
||||
{
|
||||
Debug.Console(0, "GetDigitalInput: Device {0} is not a valid device", dc.PortDeviceKey);
|
||||
return null;
|
||||
}
|
||||
ioPortDevice = ioPortDev;
|
||||
}
|
||||
if (ioPortDevice == null)
|
||||
{
|
||||
Debug.Console(0, "GetDigitalInput: Device '0' is not a valid IRelayPorts Device", dc.PortDeviceKey);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (dc.PortNumber > ioPortDevice.NumberOfDigitalInputPorts)
|
||||
{
|
||||
Debug.Console(0, "GetDigitalInput: Device {0} does not contain a port {1}", dc.PortDeviceKey, dc.PortNumber);
|
||||
}
|
||||
|
||||
return ioPortDevice.DigitalInputPorts[dc.PortNumber];
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Bridge Linking
|
||||
|
||||
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
|
||||
{
|
||||
var joinMap = new IDigitalInputJoinMap(joinStart);
|
||||
@@ -52,7 +108,14 @@ namespace PepperDash.Essentials.Core.CrestronIO
|
||||
if (!string.IsNullOrEmpty(joinMapSerialized))
|
||||
joinMap = JsonConvert.DeserializeObject<IDigitalInputJoinMap>(joinMapSerialized);
|
||||
|
||||
bridge.AddJoinMap(Key, joinMap);
|
||||
if (bridge != null)
|
||||
{
|
||||
bridge.AddJoinMap(Key, joinMap);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
@@ -65,98 +128,37 @@ namespace PepperDash.Essentials.Core.CrestronIO
|
||||
{
|
||||
Debug.Console(1, this, "Unable to link device '{0}'. Input is null", Key);
|
||||
Debug.Console(1, this, "Error: {0}", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Factory
|
||||
|
||||
public class GenericDigitalInputDeviceFactory : EssentialsDeviceFactory<GenericDigitalInputDevice>
|
||||
{
|
||||
public GenericDigitalInputDeviceFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "digitalinput" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new Generic Relay Device");
|
||||
|
||||
var props = JsonConvert.DeserializeObject<IOPortConfig>(dc.Properties.ToString());
|
||||
|
||||
if (props == null) return null;
|
||||
|
||||
var portDevice = new GenericDigitalInputDevice(dc.Key, dc.Name, GetDigitalInput, props);
|
||||
|
||||
return portDevice;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
public class GenericDigitalInputDeviceFactory : EssentialsDeviceFactory<GenericDigitalInputDevice>
|
||||
{
|
||||
public GenericDigitalInputDeviceFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "digitalinput" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new Digtal Input Device");
|
||||
|
||||
var props = JsonConvert.DeserializeObject<IOPortConfig>(dc.Properties.ToString());
|
||||
|
||||
IDigitalInputPorts portDevice;
|
||||
|
||||
if (props.PortDeviceKey == "processor")
|
||||
portDevice = Global.ControlSystem as IDigitalInputPorts;
|
||||
else
|
||||
portDevice = DeviceManager.GetDeviceForKey(props.PortDeviceKey) as IDigitalInputPorts;
|
||||
|
||||
if (portDevice == null)
|
||||
Debug.Console(0, "ERROR: Unable to add digital input device with key '{0}'. Port Device does not support digital inputs", dc.Key);
|
||||
else
|
||||
{
|
||||
var cs = (portDevice as CrestronControlSystem);
|
||||
if (cs == null)
|
||||
{
|
||||
Debug.Console(0, "ERROR: Port device for [{0}] is not control system", props.PortDeviceKey);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (cs.SupportsVersiport)
|
||||
{
|
||||
Debug.Console(1, "Attempting to add Digital Input device to Versiport port '{0}'", props.PortNumber);
|
||||
|
||||
if (props.PortNumber > cs.NumberOfVersiPorts)
|
||||
{
|
||||
Debug.Console(0, "WARNING: Cannot add Vesiport {0} on {1}. Out of range",
|
||||
props.PortNumber, props.PortDeviceKey);
|
||||
return null;
|
||||
}
|
||||
|
||||
Versiport vp = cs.VersiPorts[props.PortNumber];
|
||||
|
||||
if (!vp.Registered)
|
||||
{
|
||||
var regSuccess = vp.Register();
|
||||
if (regSuccess == eDeviceRegistrationUnRegistrationResponse.Success)
|
||||
{
|
||||
Debug.Console(1, "Successfully Created Digital Input Device on Versiport");
|
||||
return new GenericVersiportDigitalInputDevice(dc.Key, vp, props);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(0, "WARNING: Attempt to register versiport {0} on device with key '{1}' failed: {2}",
|
||||
props.PortNumber, props.PortDeviceKey, regSuccess);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (cs.SupportsDigitalInput)
|
||||
{
|
||||
Debug.Console(1, "Attempting to add Digital Input device to Digital Input port '{0}'", props.PortNumber);
|
||||
|
||||
if (props.PortNumber > cs.NumberOfDigitalInputPorts)
|
||||
{
|
||||
Debug.Console(0, "WARNING: Cannot register DIO port {0} on {1}. Out of range",
|
||||
props.PortNumber, props.PortDeviceKey);
|
||||
return null;
|
||||
}
|
||||
|
||||
DigitalInput digitalInput = cs.DigitalInputPorts[props.PortNumber];
|
||||
|
||||
if (!digitalInput.Registered)
|
||||
{
|
||||
if (digitalInput.Register() == eDeviceRegistrationUnRegistrationResponse.Success)
|
||||
{
|
||||
Debug.Console(1, "Successfully Created Digital Input Device on Digital Input");
|
||||
return new GenericDigitalInputDevice(dc.Key, digitalInput);
|
||||
}
|
||||
else
|
||||
Debug.Console(0, "WARNING: Attempt to register digital input {0} on device with key '{1}' failed.",
|
||||
props.PortNumber, props.PortDeviceKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,46 +14,114 @@ namespace PepperDash.Essentials.Core.CrestronIO
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a generic device controlled by relays
|
||||
/// </summary>
|
||||
/// </summary>
|
||||
[Description("Wrapper class for a Relay")]
|
||||
public class GenericRelayDevice : EssentialsBridgeableDevice, ISwitchedOutput
|
||||
{
|
||||
public Relay RelayOutput { get; private set; }
|
||||
|
||||
public BoolFeedback OutputIsOnFeedback { get; private set; }
|
||||
|
||||
public GenericRelayDevice(string key, Relay relay):
|
||||
base(key)
|
||||
{
|
||||
OutputIsOnFeedback = new BoolFeedback(new Func<bool>(() => RelayOutput.State));
|
||||
|
||||
RelayOutput = relay;
|
||||
RelayOutput.Register();
|
||||
|
||||
RelayOutput.StateChange += new RelayEventHandler(RelayOutput_StateChange);
|
||||
}
|
||||
|
||||
public BoolFeedback OutputIsOnFeedback { get; private set; }
|
||||
|
||||
//Maintained for compatibility with PepperDash.Essentials.Core.Devices.CrestronProcessor
|
||||
public GenericRelayDevice(string key, Relay relay) :
|
||||
base(key)
|
||||
{
|
||||
OutputIsOnFeedback = new BoolFeedback(new Func<bool>(() => RelayOutput.State));
|
||||
|
||||
RelayOutput = relay;
|
||||
RelayOutput.Register();
|
||||
|
||||
RelayOutput.StateChange += new RelayEventHandler(RelayOutput_StateChange);
|
||||
}
|
||||
|
||||
public GenericRelayDevice(string key, string name, Func<IOPortConfig, Relay> postActivationFunc,
|
||||
IOPortConfig config)
|
||||
: base(key, name)
|
||||
{
|
||||
|
||||
AddPostActivationAction(() =>
|
||||
{
|
||||
RelayOutput = postActivationFunc(config);
|
||||
|
||||
RelayOutput.Register();
|
||||
|
||||
RelayOutput.StateChange += RelayOutput_StateChange;
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
#region PreActivate
|
||||
|
||||
private static Relay GetRelay(IOPortConfig dc)
|
||||
{
|
||||
|
||||
IRelayPorts relayDevice;
|
||||
|
||||
if(dc.PortDeviceKey.Equals("processor"))
|
||||
{
|
||||
if (!Global.ControlSystem.SupportsRelay)
|
||||
{
|
||||
Debug.Console(0, "GetRelayDevice: Processor does not support relays");
|
||||
return null;
|
||||
}
|
||||
relayDevice = Global.ControlSystem;
|
||||
}
|
||||
else
|
||||
{
|
||||
var relayDev = DeviceManager.GetDeviceForKey(dc.PortDeviceKey) as IRelayPorts;
|
||||
if (relayDev == null)
|
||||
{
|
||||
Debug.Console(0, "GetRelayDevice: Device {0} is not a valid device", dc.PortDeviceKey);
|
||||
return null;
|
||||
}
|
||||
relayDevice = relayDev;
|
||||
}
|
||||
if (relayDevice == null)
|
||||
{
|
||||
Debug.Console(0, "GetRelayDevice: Device '0' is not a valid IRelayPorts Device", dc.PortDeviceKey);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (dc.PortNumber > relayDevice.NumberOfRelayPorts)
|
||||
{
|
||||
Debug.Console(0, "GetRelayDevice: Device {0} does not contain a port {1}", dc.PortDeviceKey, dc.PortNumber);
|
||||
}
|
||||
|
||||
return relayDevice.RelayPorts[dc.PortNumber];
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Events
|
||||
|
||||
void RelayOutput_StateChange(Relay relay, RelayEventArgs args)
|
||||
{
|
||||
OutputIsOnFeedback.FireUpdate();
|
||||
OutputIsOnFeedback.FireUpdate();
|
||||
}
|
||||
|
||||
public void OpenRelay()
|
||||
{
|
||||
RelayOutput.State = false;
|
||||
}
|
||||
|
||||
public void CloseRelay()
|
||||
{
|
||||
RelayOutput.State = true;
|
||||
}
|
||||
|
||||
public void ToggleRelayState()
|
||||
{
|
||||
if (RelayOutput.State == true)
|
||||
OpenRelay();
|
||||
else
|
||||
CloseRelay();
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
public void OpenRelay()
|
||||
{
|
||||
RelayOutput.State = false;
|
||||
}
|
||||
|
||||
public void CloseRelay()
|
||||
{
|
||||
RelayOutput.State = true;
|
||||
}
|
||||
|
||||
public void ToggleRelayState()
|
||||
{
|
||||
if (RelayOutput.State == true)
|
||||
OpenRelay();
|
||||
else
|
||||
CloseRelay();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ISwitchedOutput Members
|
||||
|
||||
@@ -67,8 +135,10 @@ namespace PepperDash.Essentials.Core.CrestronIO
|
||||
OpenRelay();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Bridge Linking
|
||||
|
||||
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
|
||||
{
|
||||
var joinMap = new GenericRelayControllerJoinMap(joinStart);
|
||||
@@ -78,7 +148,14 @@ namespace PepperDash.Essentials.Core.CrestronIO
|
||||
if (!string.IsNullOrEmpty(joinMapSerialized))
|
||||
joinMap = JsonConvert.DeserializeObject<GenericRelayControllerJoinMap>(joinMapSerialized);
|
||||
|
||||
bridge.AddJoinMap(Key, joinMap);
|
||||
if (bridge != null)
|
||||
{
|
||||
bridge.AddJoinMap(Key, joinMap);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
|
||||
}
|
||||
|
||||
if (RelayOutput == null)
|
||||
{
|
||||
@@ -98,77 +175,90 @@ namespace PepperDash.Essentials.Core.CrestronIO
|
||||
|
||||
// feedback for relay state
|
||||
|
||||
OutputIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Relay.JoinNumber]);
|
||||
}
|
||||
}
|
||||
OutputIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Relay.JoinNumber]);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Factory
|
||||
|
||||
public class GenericRelayDeviceFactory : EssentialsDeviceFactory<GenericRelayDevice>
|
||||
{
|
||||
public GenericRelayDeviceFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "relayoutput" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new Generic Relay Device");
|
||||
|
||||
var props = JsonConvert.DeserializeObject<IOPortConfig>(dc.Properties.ToString());
|
||||
|
||||
if (props == null) return null;
|
||||
|
||||
var portDevice = new GenericRelayDevice(dc.Key, dc.Name, GetRelay, props);
|
||||
|
||||
return portDevice;
|
||||
|
||||
|
||||
/*
|
||||
if (props.PortDeviceKey == "processor")
|
||||
portDevice = Global.ControlSystem as IRelayPorts;
|
||||
else
|
||||
portDevice = DeviceManager.GetDeviceForKey(props.PortDeviceKey) as IRelayPorts;
|
||||
|
||||
public class GenericRelayDeviceFactory : EssentialsDeviceFactory<GenericRelayDevice>
|
||||
{
|
||||
public GenericRelayDeviceFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "relayoutput" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new Generic Relay Device");
|
||||
|
||||
var props = JsonConvert.DeserializeObject<IOPortConfig>(dc.Properties.ToString());
|
||||
var key = dc.Key;
|
||||
|
||||
IRelayPorts portDevice;
|
||||
|
||||
if (props.PortDeviceKey == "processor")
|
||||
portDevice = Global.ControlSystem as IRelayPorts;
|
||||
else
|
||||
portDevice = DeviceManager.GetDeviceForKey(props.PortDeviceKey) as IRelayPorts;
|
||||
|
||||
if (portDevice == null)
|
||||
Debug.Console(0, "Unable to add relay device with key '{0}'. Port Device does not support relays", key);
|
||||
else
|
||||
{
|
||||
var cs = (portDevice as CrestronControlSystem);
|
||||
|
||||
if (cs != null)
|
||||
{
|
||||
// The relay is on a control system processor
|
||||
if (!cs.SupportsRelay || props.PortNumber > cs.NumberOfRelayPorts)
|
||||
{
|
||||
Debug.Console(0, "Port Device: {0} does not support relays or does not have enough relays");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
if (portDevice == null)
|
||||
Debug.Console(0, "Unable to add relay device with key '{0}'. Port Device does not support relays", key);
|
||||
else
|
||||
{
|
||||
// The relay is on another device type
|
||||
var cs = (portDevice as CrestronControlSystem);
|
||||
|
||||
if (props.PortNumber > portDevice.NumberOfRelayPorts)
|
||||
if (cs != null)
|
||||
{
|
||||
Debug.Console(0, "Port Device: {0} does not have enough relays");
|
||||
return null;
|
||||
// The relay is on a control system processor
|
||||
if (!cs.SupportsRelay || props.PortNumber > cs.NumberOfRelayPorts)
|
||||
{
|
||||
Debug.Console(0, "Port Device: {0} does not support relays or does not have enough relays");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Relay relay = portDevice.RelayPorts[props.PortNumber];
|
||||
|
||||
if (!relay.Registered)
|
||||
{
|
||||
if (relay.Register() == eDeviceRegistrationUnRegistrationResponse.Success)
|
||||
return new GenericRelayDevice(key, relay);
|
||||
else
|
||||
Debug.Console(0, "Attempt to register relay {0} on device with key '{1}' failed.", props.PortNumber, props.PortDeviceKey);
|
||||
{
|
||||
// The relay is on another device type
|
||||
|
||||
if (props.PortNumber > portDevice.NumberOfRelayPorts)
|
||||
{
|
||||
Debug.Console(0, "Port Device: {0} does not have enough relays");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Relay relay = portDevice.RelayPorts[props.PortNumber];
|
||||
|
||||
if (!relay.Registered)
|
||||
{
|
||||
if (relay.Register() == eDeviceRegistrationUnRegistrationResponse.Success)
|
||||
return new GenericRelayDevice(key, relay);
|
||||
else
|
||||
Debug.Console(0, "Attempt to register relay {0} on device with key '{1}' failed.", props.PortNumber, props.PortDeviceKey);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new GenericRelayDevice(key, relay);
|
||||
}
|
||||
|
||||
// Future: Check if portDevice is 3-series card or other non control system that supports versiports
|
||||
}
|
||||
else
|
||||
{
|
||||
return new GenericRelayDevice(key, relay);
|
||||
}
|
||||
|
||||
// Future: Check if portDevice is 3-series card or other non control system that supports versiports
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -118,7 +118,14 @@ namespace PepperDash.Essentials.Core.CrestronIO
|
||||
if (!string.IsNullOrEmpty(joinMapSerialized))
|
||||
joinMap = JsonConvert.DeserializeObject<StatusSignControllerJoinMap>(joinMapSerialized);
|
||||
|
||||
bridge.AddJoinMap(Key, joinMap);
|
||||
if (bridge != null)
|
||||
{
|
||||
bridge.AddJoinMap(Key, joinMap);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
|
||||
}
|
||||
|
||||
Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Devices.Codec
|
||||
|
||||
{
|
||||
public class CodecActiveCallItem
|
||||
{
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[JsonProperty("number")]
|
||||
public string Number { get; set; }
|
||||
|
||||
[JsonProperty("type")]
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public eCodecCallType Type { get; set; }
|
||||
|
||||
[JsonProperty("status")]
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public eCodecCallStatus Status { get; set; }
|
||||
|
||||
[JsonProperty("direction")]
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public eCodecCallDirection Direction { get; set; }
|
||||
|
||||
[JsonProperty("id")]
|
||||
public string Id { get; set; }
|
||||
|
||||
//public object CallMetaData { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns true when this call is any status other than
|
||||
/// Unknown, Disconnected, Disconnecting
|
||||
/// </summary>
|
||||
[JsonProperty("isActiveCall")]
|
||||
public bool IsActiveCall
|
||||
{
|
||||
get
|
||||
{
|
||||
return !(Status == eCodecCallStatus.Disconnected
|
||||
|| Status == eCodecCallStatus.Disconnecting
|
||||
|| Status == eCodecCallStatus.Idle
|
||||
|| Status == eCodecCallStatus.Unknown);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class CodecCallStatusItemChangeEventArgs : EventArgs
|
||||
{
|
||||
public CodecActiveCallItem CallItem { get; private set; }
|
||||
|
||||
public CodecCallStatusItemChangeEventArgs(CodecActiveCallItem item)
|
||||
{
|
||||
CallItem = item;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
namespace PepperDash.Essentials.Core.Devices.Codec
|
||||
|
||||
{
|
||||
public enum eCodecCallDirection
|
||||
{
|
||||
Unknown = 0, Incoming, Outgoing
|
||||
}
|
||||
|
||||
public class CodecCallDirection
|
||||
{
|
||||
/// <summary>
|
||||
/// Takes the Cisco call type and converts to the matching enum
|
||||
/// </summary>
|
||||
/// <param name="s"></param>
|
||||
/// <returns></returns>
|
||||
public static eCodecCallDirection ConvertToDirectionEnum(string s)
|
||||
{
|
||||
switch (s.ToLower())
|
||||
{
|
||||
case "incoming":
|
||||
{
|
||||
return eCodecCallDirection.Incoming;
|
||||
}
|
||||
case "outgoing":
|
||||
{
|
||||
return eCodecCallDirection.Outgoing;
|
||||
}
|
||||
default:
|
||||
return eCodecCallDirection.Unknown;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
namespace PepperDash.Essentials.Core.Devices.Codec
|
||||
{
|
||||
public enum eCodecCallStatus
|
||||
{
|
||||
Unknown = 0,
|
||||
Connected,
|
||||
Connecting,
|
||||
Dialing,
|
||||
Disconnected,
|
||||
Disconnecting,
|
||||
EarlyMedia,
|
||||
Idle,
|
||||
OnHold,
|
||||
Ringing,
|
||||
Preserved,
|
||||
RemotePreserved,
|
||||
}
|
||||
|
||||
|
||||
public class CodecCallStatus
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Takes the Cisco call type and converts to the matching enum
|
||||
/// </summary>
|
||||
/// <param name="s"></param>
|
||||
/// <returns></returns>
|
||||
public static eCodecCallStatus ConvertToStatusEnum(string s)
|
||||
{
|
||||
switch (s)
|
||||
{
|
||||
case "Connected":
|
||||
{
|
||||
return eCodecCallStatus.Connected;
|
||||
}
|
||||
case "Connecting":
|
||||
{
|
||||
return eCodecCallStatus.Connecting;
|
||||
}
|
||||
case "Dialling":
|
||||
{
|
||||
return eCodecCallStatus.Dialing;
|
||||
}
|
||||
case "Disconnected":
|
||||
{
|
||||
return eCodecCallStatus.Disconnected;
|
||||
}
|
||||
case "Disconnecting":
|
||||
{
|
||||
return eCodecCallStatus.Disconnecting;
|
||||
}
|
||||
case "EarlyMedia":
|
||||
{
|
||||
return eCodecCallStatus.EarlyMedia;
|
||||
}
|
||||
case "Idle":
|
||||
{
|
||||
return eCodecCallStatus.Idle;
|
||||
}
|
||||
case "OnHold":
|
||||
{
|
||||
return eCodecCallStatus.OnHold;
|
||||
}
|
||||
case "Ringing":
|
||||
{
|
||||
return eCodecCallStatus.Ringing;
|
||||
}
|
||||
case "Preserved":
|
||||
{
|
||||
return eCodecCallStatus.Preserved;
|
||||
}
|
||||
case "RemotePreserved":
|
||||
{
|
||||
return eCodecCallStatus.RemotePreserved;
|
||||
}
|
||||
default:
|
||||
return eCodecCallStatus.Unknown;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
namespace PepperDash.Essentials.Core.Devices.Codec
|
||||
|
||||
{
|
||||
public enum eCodecCallType
|
||||
{
|
||||
Unknown = 0,
|
||||
Audio,
|
||||
Video,
|
||||
AudioCanEscalate,
|
||||
ForwardAllCall
|
||||
}
|
||||
|
||||
public class CodecCallType
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Takes the Cisco call type and converts to the matching enum
|
||||
/// </summary>
|
||||
/// <param name="s"></param>
|
||||
/// <returns></returns>
|
||||
public static eCodecCallType ConvertToTypeEnum(string s)
|
||||
{
|
||||
switch (s)
|
||||
{
|
||||
case "Audio":
|
||||
{
|
||||
return eCodecCallType.Audio;
|
||||
}
|
||||
case "Video":
|
||||
{
|
||||
return eCodecCallType.Video;
|
||||
}
|
||||
case "AudioCanEscalate":
|
||||
{
|
||||
return eCodecCallType.AudioCanEscalate;
|
||||
}
|
||||
case "ForwardAllCall":
|
||||
{
|
||||
return eCodecCallType.ForwardAllCall;
|
||||
}
|
||||
default:
|
||||
return eCodecCallType.Unknown;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
namespace PepperDash.Essentials.Core.Devices.Codec
|
||||
{
|
||||
public enum eMeetingPrivacy
|
||||
{
|
||||
Unknown = 0,
|
||||
Public,
|
||||
Private
|
||||
}
|
||||
|
||||
public class CodecCallPrivacy
|
||||
{
|
||||
/// <summary>
|
||||
/// Takes the Cisco privacy type and converts to the matching enum
|
||||
/// </summary>
|
||||
/// <param name="s"></param>
|
||||
/// <returns></returns>
|
||||
public static eMeetingPrivacy ConvertToDirectionEnum(string s)
|
||||
{
|
||||
switch (s.ToLower())
|
||||
{
|
||||
case "public":
|
||||
{
|
||||
return eMeetingPrivacy.Public;
|
||||
}
|
||||
case "private":
|
||||
{
|
||||
return eMeetingPrivacy.Private;
|
||||
}
|
||||
default:
|
||||
return eMeetingPrivacy.Unknown;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace PepperDash.Essentials.Core.Devices.Codec
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines minimum volume controls for a codec device with dialing capabilities
|
||||
/// </summary>
|
||||
public interface ICodecAudio : IBasicVolumeWithFeedback, IPrivacy
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Devices.Codec
|
||||
{
|
||||
public interface IHasCallFavorites
|
||||
{
|
||||
CodecCallFavorites CallFavorites { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents favorites entries for a codec device
|
||||
/// </summary>
|
||||
public class CodecCallFavorites
|
||||
{
|
||||
public List<CodecActiveCallItem> Favorites { get; set; }
|
||||
|
||||
public CodecCallFavorites()
|
||||
{
|
||||
Favorites = new List<CodecActiveCallItem>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Devices.Codec
|
||||
{
|
||||
public interface IHasCallHistory
|
||||
{
|
||||
CodecCallHistory CallHistory { get; }
|
||||
|
||||
void RemoveCallHistoryEntry(CodecCallHistory.CallHistoryEntry entry);
|
||||
}
|
||||
|
||||
public enum eCodecOccurrenceType
|
||||
{
|
||||
Unknown = 0,
|
||||
Placed,
|
||||
Received,
|
||||
NoAnswer
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents the recent call history for a codec device
|
||||
/// </summary>
|
||||
public class CodecCallHistory
|
||||
{
|
||||
public event EventHandler<EventArgs> RecentCallsListHasChanged;
|
||||
|
||||
public List<CallHistoryEntry> RecentCalls { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Item that gets added to the list when there are no recent calls in history
|
||||
/// </summary>
|
||||
readonly CallHistoryEntry _listEmptyEntry;
|
||||
|
||||
public CallHistoryEntry ListEmptyEntry
|
||||
{
|
||||
get { return _listEmptyEntry; }
|
||||
}
|
||||
|
||||
public CodecCallHistory()
|
||||
{
|
||||
_listEmptyEntry = new CallHistoryEntry() { Name = "No Recent Calls" };
|
||||
|
||||
RecentCalls = new List<CallHistoryEntry> {_listEmptyEntry};
|
||||
}
|
||||
|
||||
private void OnRecentCallsListChange()
|
||||
{
|
||||
var handler = RecentCallsListHasChanged;
|
||||
if (handler != null)
|
||||
{
|
||||
handler(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveEntry(CallHistoryEntry entry)
|
||||
{
|
||||
RecentCalls.Remove(entry);
|
||||
OnRecentCallsListChange();
|
||||
}
|
||||
|
||||
public void UpdateCallHistory(List<CallHistoryEntry> newList)
|
||||
{
|
||||
RecentCalls = newList;
|
||||
|
||||
OnRecentCallsListChange();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generic call history entry, not device specific
|
||||
/// </summary>
|
||||
public class CallHistoryEntry : CodecActiveCallItem
|
||||
{
|
||||
[JsonConverter(typeof (IsoDateTimeConverter))]
|
||||
[JsonProperty("startTime")]
|
||||
public DateTime StartTime { get; set; }
|
||||
|
||||
[JsonConverter(typeof (StringEnumConverter))]
|
||||
[JsonProperty("occurrenceType")]
|
||||
public eCodecOccurrenceType OccurrenceType { get; set; }
|
||||
|
||||
[JsonProperty("occurrenceHistoryId")]
|
||||
public string OccurrenceHistoryId { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
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.Devices.Codec
|
||||
{
|
||||
public interface IHasContentSharing
|
||||
{
|
||||
BoolFeedback SharingContentIsOnFeedback { get; }
|
||||
StringFeedback SharingSourceFeedback { get; }
|
||||
|
||||
bool AutoShareContentWhileInCall { get; }
|
||||
|
||||
void StartSharing();
|
||||
void StopSharing();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Devices.Codec
|
||||
{
|
||||
/// <summary>
|
||||
/// Requirements for a device that has dialing capabilities
|
||||
/// </summary>
|
||||
public interface IHasDialer
|
||||
{
|
||||
// Add requirements for Dialer functionality
|
||||
|
||||
event EventHandler<CodecCallStatusItemChangeEventArgs> CallStatusChange;
|
||||
|
||||
void Dial(string number);
|
||||
void EndCall(CodecActiveCallItem activeCall);
|
||||
void EndAllCalls();
|
||||
void AcceptCall(CodecActiveCallItem item);
|
||||
void RejectCall(CodecActiveCallItem item);
|
||||
void SendDtmf(string digit);
|
||||
|
||||
bool IsInCall { get; }
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,223 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using PepperDash.Essentials.Core.Devices.VideoCodec;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Devices.Codec
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the API for codecs with a directory
|
||||
/// </summary>
|
||||
public interface IHasDirectory
|
||||
{
|
||||
event EventHandler<DirectoryEventArgs> DirectoryResultReturned;
|
||||
|
||||
CodecDirectory DirectoryRoot { get; }
|
||||
|
||||
CodecDirectory CurrentDirectoryResult { get; }
|
||||
|
||||
CodecPhonebookSyncState PhonebookSyncState { get; }
|
||||
|
||||
void SearchDirectory(string searchString);
|
||||
|
||||
void GetDirectoryFolderContents(string folderId);
|
||||
|
||||
void SetCurrentDirectoryToRoot();
|
||||
|
||||
void GetDirectoryParentFolderContents();
|
||||
|
||||
BoolFeedback CurrentDirectoryResultIsNotDirectoryRoot { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Tracks the directory browse history when browsing beyond the root directory
|
||||
/// </summary>
|
||||
List<CodecDirectory> DirectoryBrowseHistory { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class DirectoryEventArgs : EventArgs
|
||||
{
|
||||
public CodecDirectory Directory { get; set; }
|
||||
public bool DirectoryIsOnRoot { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a codec directory
|
||||
/// </summary>
|
||||
public class CodecDirectory
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the contents of the directory
|
||||
/// </summary>
|
||||
[JsonProperty("directoryResults")]
|
||||
public List<DirectoryItem> CurrentDirectoryResults { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Used to store the ID of the current folder for CurrentDirectoryResults
|
||||
/// </summary>
|
||||
[JsonProperty("resultsFolderId")]
|
||||
public string ResultsFolderId { get; set; }
|
||||
|
||||
public CodecDirectory()
|
||||
{
|
||||
CurrentDirectoryResults = new List<DirectoryItem>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds folders to the directory
|
||||
/// </summary>
|
||||
/// <param name="folders"></param>
|
||||
public void AddFoldersToDirectory(List<DirectoryItem> folders)
|
||||
{
|
||||
if(folders != null)
|
||||
CurrentDirectoryResults.AddRange(folders);
|
||||
|
||||
SortDirectory();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds contacts to the directory
|
||||
/// </summary>
|
||||
/// <param name="contacts"></param>
|
||||
public void AddContactsToDirectory(List<DirectoryItem> contacts)
|
||||
{
|
||||
if(contacts != null)
|
||||
CurrentDirectoryResults.AddRange(contacts);
|
||||
|
||||
SortDirectory();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sorts the DirectoryResults list to display all folders alphabetically, then all contacts alphabetically
|
||||
/// </summary>
|
||||
private void SortDirectory()
|
||||
{
|
||||
var sortedFolders = new List<DirectoryItem>();
|
||||
|
||||
sortedFolders.AddRange(CurrentDirectoryResults.Where(f => f is DirectoryFolder));
|
||||
|
||||
sortedFolders.OrderBy(f => f.Name);
|
||||
|
||||
var sortedContacts = new List<DirectoryItem>();
|
||||
|
||||
sortedContacts.AddRange(CurrentDirectoryResults.Where(c => c is DirectoryContact));
|
||||
|
||||
sortedFolders.OrderBy(c => c.Name);
|
||||
|
||||
CurrentDirectoryResults.Clear();
|
||||
|
||||
CurrentDirectoryResults.AddRange(sortedFolders);
|
||||
|
||||
CurrentDirectoryResults.AddRange(sortedContacts);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used to decorate a contact to indicate it can be invided to a meeting
|
||||
/// </summary>
|
||||
public interface IInvitableContact
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents an item in the directory
|
||||
/// </summary>
|
||||
public class DirectoryItem : ICloneable
|
||||
{
|
||||
public object Clone()
|
||||
{
|
||||
return this.MemberwiseClone();
|
||||
}
|
||||
|
||||
[JsonProperty("folderId")]
|
||||
public string FolderId { get; set; }
|
||||
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a folder type DirectoryItem
|
||||
/// </summary>
|
||||
public class DirectoryFolder : DirectoryItem
|
||||
{
|
||||
[JsonProperty("contacts")]
|
||||
public List<DirectoryContact> Contacts { get; set; }
|
||||
|
||||
[JsonProperty("parentFolderId")]
|
||||
public string ParentFolderId { get; set; }
|
||||
|
||||
public DirectoryFolder()
|
||||
{
|
||||
Contacts = new List<DirectoryContact>();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a contact type DirectoryItem
|
||||
/// </summary>
|
||||
public class DirectoryContact : DirectoryItem
|
||||
{
|
||||
[JsonProperty("contactId")]
|
||||
public string ContactId { get; set; }
|
||||
|
||||
[JsonProperty("title")]
|
||||
public string Title { get; set; }
|
||||
|
||||
[JsonProperty("contactMethods")]
|
||||
public List<ContactMethod> ContactMethods { get; set; }
|
||||
|
||||
public DirectoryContact()
|
||||
{
|
||||
ContactMethods = new List<ContactMethod>();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a method of contact for a contact
|
||||
/// </summary>
|
||||
public class ContactMethod
|
||||
{
|
||||
[JsonProperty("contactMethodId")]
|
||||
public string ContactMethodId { get; set; }
|
||||
|
||||
[JsonProperty("number")]
|
||||
public string Number { get; set; }
|
||||
|
||||
[JsonProperty("device")]
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public eContactMethodDevice Device { get; set; }
|
||||
|
||||
[JsonProperty("callType")]
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public eContactMethodCallType CallType { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public enum eContactMethodDevice
|
||||
{
|
||||
Unknown = 0,
|
||||
Mobile,
|
||||
Other,
|
||||
Telephone,
|
||||
Video
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public enum eContactMethodCallType
|
||||
{
|
||||
Unknown = 0,
|
||||
Audio,
|
||||
Video
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Devices.Codec
|
||||
{
|
||||
public enum eMeetingEventChangeType
|
||||
{
|
||||
Unkown = 0,
|
||||
MeetingStartWarning,
|
||||
MeetingStart,
|
||||
MeetingEndWarning,
|
||||
MeetingEnd
|
||||
}
|
||||
|
||||
public interface IHasScheduleAwareness
|
||||
{
|
||||
CodecScheduleAwareness CodecSchedule { get; }
|
||||
|
||||
void GetSchedule();
|
||||
}
|
||||
|
||||
public class CodecScheduleAwareness
|
||||
{
|
||||
List<Meeting> _Meetings;
|
||||
|
||||
public event EventHandler<MeetingEventArgs> MeetingEventChange;
|
||||
|
||||
public event EventHandler<EventArgs> MeetingsListHasChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Setter triggers MeetingsListHasChanged event
|
||||
/// </summary>
|
||||
public List<Meeting> Meetings
|
||||
{
|
||||
get
|
||||
{
|
||||
return _Meetings;
|
||||
}
|
||||
set
|
||||
{
|
||||
_Meetings = value;
|
||||
|
||||
var handler = MeetingsListHasChanged;
|
||||
if (handler != null)
|
||||
{
|
||||
handler(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private CTimer ScheduleChecker;
|
||||
|
||||
public CodecScheduleAwareness()
|
||||
{
|
||||
Meetings = new List<Meeting>();
|
||||
|
||||
ScheduleChecker = new CTimer(CheckSchedule, null, 1000, 1000);
|
||||
}
|
||||
|
||||
private void OnMeetingChange(eMeetingEventChangeType changeType, Meeting meeting)
|
||||
{
|
||||
var handler = MeetingEventChange;
|
||||
if (handler != null)
|
||||
{
|
||||
handler(this, new MeetingEventArgs() { ChangeType = changeType, Meeting = meeting });
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckSchedule(object o)
|
||||
{
|
||||
// Iterate the meeting list and check if any meeting need to do anythingk
|
||||
|
||||
const double meetingTimeEpsilon = 0.0001;
|
||||
foreach (Meeting m in Meetings)
|
||||
{
|
||||
eMeetingEventChangeType changeType = eMeetingEventChangeType.Unkown;
|
||||
|
||||
if (m.TimeToMeetingStart.TotalMinutes <= m.MeetingWarningMinutes.TotalMinutes) // Meeting is about to start
|
||||
changeType = eMeetingEventChangeType.MeetingStartWarning;
|
||||
else if (Math.Abs(m.TimeToMeetingStart.TotalMinutes) < meetingTimeEpsilon) // Meeting Start
|
||||
changeType = eMeetingEventChangeType.MeetingStart;
|
||||
else if (m.TimeToMeetingEnd.TotalMinutes <= m.MeetingWarningMinutes.TotalMinutes) // Meeting is about to end
|
||||
changeType = eMeetingEventChangeType.MeetingEndWarning;
|
||||
else if (Math.Abs(m.TimeToMeetingEnd.TotalMinutes) < meetingTimeEpsilon) // Meeting has ended
|
||||
changeType = eMeetingEventChangeType.MeetingEnd;
|
||||
|
||||
if (changeType != eMeetingEventChangeType.Unkown)
|
||||
OnMeetingChange(changeType, m);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generic class to represent a meeting (Cisco or Polycom OBTP or Fusion)
|
||||
/// </summary>
|
||||
public class Meeting
|
||||
{
|
||||
public TimeSpan MeetingWarningMinutes = TimeSpan.FromMinutes(5);
|
||||
|
||||
public string Id { get; set; }
|
||||
public string Organizer { get; set; }
|
||||
public string Title { get; set; }
|
||||
public string Agenda { get; set; }
|
||||
public TimeSpan TimeToMeetingStart
|
||||
{
|
||||
get
|
||||
{
|
||||
return StartTime - DateTime.Now;
|
||||
}
|
||||
}
|
||||
public TimeSpan TimeToMeetingEnd
|
||||
{
|
||||
get
|
||||
{
|
||||
return EndTime - DateTime.Now;
|
||||
}
|
||||
}
|
||||
public DateTime StartTime { get; set; }
|
||||
public DateTime EndTime { get; set; }
|
||||
public TimeSpan Duration
|
||||
{
|
||||
get
|
||||
{
|
||||
return EndTime - StartTime;
|
||||
}
|
||||
}
|
||||
public eMeetingPrivacy Privacy { get; set; }
|
||||
public bool Joinable
|
||||
{
|
||||
get
|
||||
{
|
||||
return StartTime.AddMinutes(-5) <= DateTime.Now
|
||||
&& DateTime.Now <= EndTime; //.AddMinutes(-5);
|
||||
}
|
||||
}
|
||||
//public string ConferenceNumberToDial { get; set; }
|
||||
public string ConferencePassword { get; set; }
|
||||
public bool IsOneButtonToPushMeeting { get; set; }
|
||||
|
||||
public List<Call> Calls { get; private set; }
|
||||
|
||||
public Meeting()
|
||||
{
|
||||
Calls = new List<Call>();
|
||||
}
|
||||
}
|
||||
|
||||
public class Call
|
||||
{
|
||||
public string Number { get; set; }
|
||||
public string Protocol { get; set; }
|
||||
public string CallRate { get; set; }
|
||||
public string CallType { get; set; }
|
||||
}
|
||||
|
||||
public class MeetingEventArgs : EventArgs
|
||||
{
|
||||
public eMeetingEventChangeType ChangeType { get; set; }
|
||||
public Meeting Meeting { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
namespace PepperDash.Essentials.Core.Devices.AudioCodec
|
||||
{
|
||||
/// <summary>
|
||||
/// Implements a common set of data about a codec
|
||||
/// </summary>
|
||||
public interface IAudioCodecInfo
|
||||
{
|
||||
AudioCodecInfo CodecInfo { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stores general information about a codec
|
||||
/// </summary>
|
||||
public abstract class AudioCodecInfo
|
||||
{
|
||||
public abstract string PhoneNumber { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,7 @@ namespace PepperDash.Essentials.Core
|
||||
triList.SetBoolSigAction(141, dev.Right);
|
||||
triList.SetBoolSigAction(142, dev.Select);
|
||||
triList.SetBoolSigAction(130, dev.Menu);
|
||||
triList.SetBoolSigAction(134, dev.Exit);
|
||||
triList.SetBoolSigAction(134, dev.Exit);
|
||||
}
|
||||
|
||||
public static void UnlinkButtons(this IDPad dev, BasicTriList triList)
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
namespace PepperDash.Essentials.Core.Devices.AudioCodec
|
||||
{
|
||||
/// <summary>
|
||||
/// For rooms that have audio codec
|
||||
/// </summary>
|
||||
public interface IHasAudioCodec
|
||||
{
|
||||
AudioCodecBase AudioCodec { get; }
|
||||
BoolFeedback InCallFeedback { get; }
|
||||
|
||||
///// <summary>
|
||||
///// Make this more specific
|
||||
///// </summary>
|
||||
//List<PepperDash.Essentials.Devices.Common.Codec.CodecActiveCallItem> ActiveCalls { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Core.VideoCodec
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the required elements for layout control
|
||||
/// </summary>
|
||||
public interface IHasCodecLayouts
|
||||
{
|
||||
StringFeedback LocalLayoutFeedback { get; }
|
||||
|
||||
void LocalLayoutToggle();
|
||||
void LocalLayoutToggleSingleProminent();
|
||||
void MinMaxLayoutToggle();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Core.VideoCodec
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the requred elements for selfview control
|
||||
/// </summary>
|
||||
public interface IHasCodecSelfView
|
||||
{
|
||||
BoolFeedback SelfviewIsOnFeedback { get; }
|
||||
|
||||
bool ShowSelfViewByDefault { get; }
|
||||
|
||||
void SelfViewModeOn();
|
||||
|
||||
void SelfViewModeOff();
|
||||
|
||||
void SelfViewModeToggle();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
namespace PepperDash.Essentials.Core.Devices.VideoCodec
|
||||
{
|
||||
/// <summary>
|
||||
/// For rooms that have video codec
|
||||
/// </summary>
|
||||
public interface IHasVideoCodec
|
||||
{
|
||||
VideoCodecBase VideoCodec { get; }
|
||||
BoolFeedback InCallFeedback { get; }
|
||||
|
||||
///// <summary>
|
||||
///// Make this more specific
|
||||
///// </summary>
|
||||
//List<PepperDash.Essentials.Devices.Common.Codec.CodecActiveCallItem> ActiveCalls { get; }
|
||||
|
||||
/// <summary>
|
||||
/// States: 0 for on hook, 1 for video, 2 for audio, 3 for telekenesis
|
||||
/// </summary>
|
||||
IntFeedback CallTypeFeedback { get; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
BoolFeedback PrivacyModeIsOnFeedback { get; }
|
||||
|
||||
/// <summary>
|
||||
/// When something in the room is sharing with the far end or through other means
|
||||
/// </summary>
|
||||
BoolFeedback IsSharingFeedback { get; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Devices.Codec
|
||||
{
|
||||
/// <summary>
|
||||
/// Implements a common set of data about a codec
|
||||
/// </summary>
|
||||
public interface iVideoCodecInfo
|
||||
{
|
||||
VideoCodecInfo CodecInfo { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stores general information about a codec
|
||||
/// </summary>
|
||||
public abstract class VideoCodecInfo
|
||||
{
|
||||
public abstract bool MultiSiteOptionIsEnabled { get; }
|
||||
public abstract string IpAddress { get; }
|
||||
public abstract string SipPhoneNumber { get; }
|
||||
public abstract string E164Alias { get; }
|
||||
public abstract string H323Id { get; }
|
||||
public abstract string SipUri { get; }
|
||||
public abstract bool AutoAnswerEnabled { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using PepperDash.Essentials.Core.Devices.Codec;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Devices.AudioCodec
|
||||
{
|
||||
public abstract class AudioCodecBase : EssentialsDevice, IHasDialer, IUsageTracking, IAudioCodecInfo
|
||||
{
|
||||
|
||||
public event EventHandler<CodecCallStatusItemChangeEventArgs> CallStatusChange;
|
||||
|
||||
public AudioCodecInfo CodecInfo { get; protected set; }
|
||||
|
||||
#region IUsageTracking Members
|
||||
|
||||
/// <summary>
|
||||
/// This object can be added by outside users of this class to provide usage tracking
|
||||
/// for various services
|
||||
/// </summary>
|
||||
public UsageTracking UsageTracker { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Returns true when any call is not in state Unknown, Disconnecting, Disconnected
|
||||
/// </summary>
|
||||
public bool IsInCall
|
||||
{
|
||||
get
|
||||
{
|
||||
bool value;
|
||||
|
||||
if (ActiveCalls != null)
|
||||
value = ActiveCalls.Any(c => c.IsActiveCall);
|
||||
else
|
||||
value = false;
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
// In most cases only a single call can be active
|
||||
public List<CodecActiveCallItem> ActiveCalls { get; set; }
|
||||
|
||||
public AudioCodecBase(string key, string name)
|
||||
: base(key, name)
|
||||
{
|
||||
ActiveCalls = new List<CodecActiveCallItem>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper method to fire CallStatusChange event with old and new status
|
||||
/// </summary>
|
||||
protected void SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus newStatus, CodecActiveCallItem call)
|
||||
{
|
||||
call.Status = newStatus;
|
||||
|
||||
OnCallStatusChange(call);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="previousStatus"></param>
|
||||
/// <param name="newStatus"></param>
|
||||
/// <param name="item"></param>
|
||||
protected void OnCallStatusChange(CodecActiveCallItem item)
|
||||
{
|
||||
var handler = CallStatusChange;
|
||||
if (handler != null)
|
||||
handler(this, new CodecCallStatusItemChangeEventArgs(item));
|
||||
|
||||
if (UsageTracker != null)
|
||||
{
|
||||
if (IsInCall && !UsageTracker.UsageTrackingStarted)
|
||||
UsageTracker.StartDeviceUsage();
|
||||
else if (UsageTracker.UsageTrackingStarted && !IsInCall)
|
||||
UsageTracker.EndDeviceUsage();
|
||||
}
|
||||
}
|
||||
|
||||
#region IHasDialer Members
|
||||
|
||||
public abstract void Dial(string number);
|
||||
|
||||
public abstract void EndCall(CodecActiveCallItem activeCall);
|
||||
|
||||
public abstract void EndAllCalls();
|
||||
|
||||
public abstract void AcceptCall(CodecActiveCallItem item);
|
||||
|
||||
public abstract void RejectCall(CodecActiveCallItem item);
|
||||
|
||||
public abstract void SendDtmf(string digit);
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -53,7 +53,7 @@ namespace PepperDash.Essentials.Core
|
||||
|
||||
public ConfigSnippetAttribute(string configSnippet)
|
||||
{
|
||||
Debug.Console(2, "Setting Description {0}", configSnippet);
|
||||
Debug.Console(2, "Setting Config Snippet {0}", configSnippet);
|
||||
_ConfigSnippet = configSnippet;
|
||||
}
|
||||
|
||||
@@ -83,8 +83,9 @@ namespace PepperDash.Essentials.Core
|
||||
foreach (var typeName in TypeNames)
|
||||
{
|
||||
Debug.Console(2, "Getting Description Attribute from class: '{0}'", typeof(T).FullName);
|
||||
var attributes = typeof(T).GetCustomAttributes(typeof(DescriptionAttribute), true) as DescriptionAttribute[];
|
||||
string description = attributes[0].Description;
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,323 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.Core.Routing;
|
||||
using PepperDash.Essentials.Core.Devices.Codec;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Devices.VideoCodec
|
||||
{
|
||||
public abstract class VideoCodecBase : ReconfigurableDevice, IRoutingInputsOutputs,
|
||||
IUsageTracking, IHasDialer, IHasContentSharing, ICodecAudio, iVideoCodecInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Fires when the status of any active, dialing, or incoming call changes or is new
|
||||
/// </summary>
|
||||
public event EventHandler<CodecCallStatusItemChangeEventArgs> CallStatusChange;
|
||||
|
||||
public event EventHandler<EventArgs> IsReadyChange;
|
||||
|
||||
public IBasicCommunication Communication { get; protected set; }
|
||||
|
||||
#region IUsageTracking Members
|
||||
|
||||
/// <summary>
|
||||
/// This object can be added by outside users of this class to provide usage tracking
|
||||
/// for various services
|
||||
/// </summary>
|
||||
public UsageTracking UsageTracker { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// An internal pseudo-source that is routable and connected to the osd input
|
||||
/// </summary>
|
||||
public DummyRoutingInputsDevice OsdSource { get; protected set; }
|
||||
|
||||
public RoutingPortCollection<RoutingInputPort> InputPorts { get; private set; }
|
||||
|
||||
public RoutingPortCollection<RoutingOutputPort> OutputPorts { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns true when any call is not in state Unknown, Disconnecting, Disconnected
|
||||
/// </summary>
|
||||
public bool IsInCall
|
||||
{
|
||||
get
|
||||
{
|
||||
bool value;
|
||||
|
||||
if (ActiveCalls != null)
|
||||
value = ActiveCalls.Any(c => c.IsActiveCall);
|
||||
else
|
||||
value = false;
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
public BoolFeedback StandbyIsOnFeedback { get; private set; }
|
||||
|
||||
abstract protected Func<bool> PrivacyModeIsOnFeedbackFunc { get; }
|
||||
abstract protected Func<int> VolumeLevelFeedbackFunc { get; }
|
||||
abstract protected Func<bool> MuteFeedbackFunc { get; }
|
||||
abstract protected Func<bool> StandbyIsOnFeedbackFunc { get; }
|
||||
|
||||
public List<CodecActiveCallItem> ActiveCalls { get; set; }
|
||||
|
||||
public VideoCodecInfo CodecInfo { get; protected set; }
|
||||
|
||||
public bool ShowSelfViewByDefault { get; protected set; }
|
||||
|
||||
|
||||
public bool IsReady { get; protected set; }
|
||||
|
||||
public VideoCodecBase(DeviceConfig config)
|
||||
: base(config)
|
||||
{
|
||||
StandbyIsOnFeedback = new BoolFeedback(StandbyIsOnFeedbackFunc);
|
||||
PrivacyModeIsOnFeedback = new BoolFeedback(PrivacyModeIsOnFeedbackFunc);
|
||||
VolumeLevelFeedback = new IntFeedback(VolumeLevelFeedbackFunc);
|
||||
MuteFeedback = new BoolFeedback(MuteFeedbackFunc);
|
||||
SharingSourceFeedback = new StringFeedback(SharingSourceFeedbackFunc);
|
||||
SharingContentIsOnFeedback = new BoolFeedback(SharingContentIsOnFeedbackFunc);
|
||||
|
||||
InputPorts = new RoutingPortCollection<RoutingInputPort>();
|
||||
OutputPorts = new RoutingPortCollection<RoutingOutputPort>();
|
||||
|
||||
ActiveCalls = new List<CodecActiveCallItem>();
|
||||
}
|
||||
|
||||
#region IHasDialer Members
|
||||
|
||||
public abstract void Dial(string number);
|
||||
public abstract void Dial(Meeting meeting);
|
||||
public virtual void Dial(IInvitableContact contact)
|
||||
{
|
||||
|
||||
}
|
||||
public abstract void EndCall(CodecActiveCallItem call);
|
||||
public abstract void EndAllCalls();
|
||||
public abstract void AcceptCall(CodecActiveCallItem call);
|
||||
public abstract void RejectCall(CodecActiveCallItem call);
|
||||
public abstract void SendDtmf(string s);
|
||||
|
||||
#endregion
|
||||
|
||||
public virtual List<Feedback> Feedbacks
|
||||
{
|
||||
get
|
||||
{
|
||||
return new List<Feedback>
|
||||
{
|
||||
PrivacyModeIsOnFeedback,
|
||||
SharingSourceFeedback
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void ExecuteSwitch(object selector);
|
||||
|
||||
/// <summary>
|
||||
/// Helper method to fire CallStatusChange event with old and new status
|
||||
/// </summary>
|
||||
protected void SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus newStatus, CodecActiveCallItem call)
|
||||
{
|
||||
call.Status = newStatus;
|
||||
|
||||
OnCallStatusChange(call);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="previousStatus"></param>
|
||||
/// <param name="newStatus"></param>
|
||||
/// <param name="item"></param>
|
||||
protected void OnCallStatusChange(CodecActiveCallItem item)
|
||||
{
|
||||
var handler = CallStatusChange;
|
||||
if (handler != null)
|
||||
handler(this, new CodecCallStatusItemChangeEventArgs(item));
|
||||
|
||||
if (AutoShareContentWhileInCall)
|
||||
StartSharing();
|
||||
|
||||
if (UsageTracker != null)
|
||||
{
|
||||
if (IsInCall && !UsageTracker.UsageTrackingStarted)
|
||||
UsageTracker.StartDeviceUsage();
|
||||
else if (UsageTracker.UsageTrackingStarted && !IsInCall)
|
||||
UsageTracker.EndDeviceUsage();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets IsReady property and fires the event. Used for dependent classes to sync up their data.
|
||||
/// </summary>
|
||||
protected void SetIsReady()
|
||||
{
|
||||
IsReady = true;
|
||||
var h = IsReadyChange;
|
||||
if(h != null)
|
||||
h(this, new EventArgs());
|
||||
}
|
||||
|
||||
#region ICodecAudio Members
|
||||
|
||||
public abstract void PrivacyModeOn();
|
||||
public abstract void PrivacyModeOff();
|
||||
public abstract void PrivacyModeToggle();
|
||||
public BoolFeedback PrivacyModeIsOnFeedback { get; private set; }
|
||||
|
||||
|
||||
public BoolFeedback MuteFeedback { get; private set; }
|
||||
|
||||
public abstract void MuteOff();
|
||||
|
||||
public abstract void MuteOn();
|
||||
|
||||
public abstract void SetVolume(ushort level);
|
||||
|
||||
public IntFeedback VolumeLevelFeedback { get; private set; }
|
||||
|
||||
public abstract void MuteToggle();
|
||||
|
||||
public abstract void VolumeDown(bool pressRelease);
|
||||
|
||||
|
||||
public abstract void VolumeUp(bool pressRelease);
|
||||
|
||||
#endregion
|
||||
|
||||
#region IHasSharing Members
|
||||
|
||||
public abstract void StartSharing();
|
||||
public abstract void StopSharing();
|
||||
|
||||
public bool AutoShareContentWhileInCall { get; protected set; }
|
||||
|
||||
public StringFeedback SharingSourceFeedback { get; private set; }
|
||||
public BoolFeedback SharingContentIsOnFeedback { get; private set; }
|
||||
|
||||
abstract protected Func<string> SharingSourceFeedbackFunc { get; }
|
||||
abstract protected Func<bool> SharingContentIsOnFeedbackFunc { get; }
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
// **** DEBUGGING THINGS ****
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public virtual void ListCalls()
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
foreach (var c in ActiveCalls)
|
||||
sb.AppendFormat("{0} {1} -- {2} {3}\n", c.Id, c.Number, c.Name, c.Status);
|
||||
Debug.Console(1, this, "\n{0}\n", sb.ToString());
|
||||
}
|
||||
|
||||
public abstract void StandbyActivate();
|
||||
|
||||
public abstract void StandbyDeactivate();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Used to track the status of syncronizing the phonebook values when connecting to a codec or refreshing the phonebook info
|
||||
/// </summary>
|
||||
public class CodecPhonebookSyncState : IKeyed
|
||||
{
|
||||
bool _InitialSyncComplete;
|
||||
|
||||
public event EventHandler<EventArgs> InitialSyncCompleted;
|
||||
|
||||
public string Key { get; private set; }
|
||||
|
||||
public bool InitialSyncComplete
|
||||
{
|
||||
get { return _InitialSyncComplete; }
|
||||
private set
|
||||
{
|
||||
if (value == true)
|
||||
{
|
||||
var handler = InitialSyncCompleted;
|
||||
if (handler != null)
|
||||
handler(this, new EventArgs());
|
||||
}
|
||||
_InitialSyncComplete = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool InitialPhonebookFoldersWasReceived { get; private set; }
|
||||
|
||||
public bool NumberOfContactsWasReceived { get; private set; }
|
||||
|
||||
public bool PhonebookRootEntriesWasRecieved { get; private set; }
|
||||
|
||||
public bool PhonebookHasFolders { get; private set; }
|
||||
|
||||
public int NumberOfContacts { get; private set; }
|
||||
|
||||
public CodecPhonebookSyncState(string key)
|
||||
{
|
||||
Key = key;
|
||||
|
||||
CodecDisconnected();
|
||||
}
|
||||
|
||||
public void InitialPhonebookFoldersReceived()
|
||||
{
|
||||
InitialPhonebookFoldersWasReceived = true;
|
||||
|
||||
CheckSyncStatus();
|
||||
}
|
||||
|
||||
public void PhonebookRootEntriesReceived()
|
||||
{
|
||||
PhonebookRootEntriesWasRecieved = true;
|
||||
|
||||
CheckSyncStatus();
|
||||
}
|
||||
|
||||
public void SetPhonebookHasFolders(bool value)
|
||||
{
|
||||
PhonebookHasFolders = value;
|
||||
|
||||
Debug.Console(1, this, "Phonebook has folders: {0}", PhonebookHasFolders);
|
||||
}
|
||||
|
||||
public void SetNumberOfContacts(int contacts)
|
||||
{
|
||||
NumberOfContacts = contacts;
|
||||
NumberOfContactsWasReceived = true;
|
||||
|
||||
Debug.Console(1, this, "Phonebook contains {0} contacts.", NumberOfContacts);
|
||||
|
||||
CheckSyncStatus();
|
||||
}
|
||||
|
||||
public void CodecDisconnected()
|
||||
{
|
||||
InitialPhonebookFoldersWasReceived = false;
|
||||
PhonebookHasFolders = false;
|
||||
NumberOfContacts = 0;
|
||||
NumberOfContactsWasReceived = false;
|
||||
}
|
||||
|
||||
void CheckSyncStatus()
|
||||
{
|
||||
if (InitialPhonebookFoldersWasReceived && NumberOfContactsWasReceived && PhonebookRootEntriesWasRecieved)
|
||||
{
|
||||
InitialSyncComplete = true;
|
||||
Debug.Console(1, this, "Initial Phonebook Sync Complete!");
|
||||
}
|
||||
else
|
||||
InitialSyncComplete = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
using Newtonsoft.Json;
|
||||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash_Essentials_Core.Devices
|
||||
{
|
||||
public class DestinationListItem
|
||||
{
|
||||
[JsonProperty("sinkKey")]
|
||||
public string SinkKey { get; set; }
|
||||
|
||||
private EssentialsDevice _sinkDevice;
|
||||
|
||||
[JsonIgnore]
|
||||
public EssentialsDevice SinkDevice
|
||||
{
|
||||
get { return _sinkDevice ?? (_sinkDevice = DeviceManager.GetDeviceForKey(SinkKey) as EssentialsDevice); }
|
||||
}
|
||||
|
||||
public string PreferredName
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Name))
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
|
||||
return SinkDevice == null ? "---" : SinkDevice.Name;
|
||||
}
|
||||
}
|
||||
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[JsonProperty("includeInDestinationList")]
|
||||
public bool IncludeInDestinationList { get; set; }
|
||||
|
||||
[JsonProperty("order")]
|
||||
public int Order { get; set; }
|
||||
|
||||
[JsonProperty("surfaceLocation")]
|
||||
public int SurfaceLocation { get; set; }
|
||||
|
||||
[JsonProperty("verticalLocation")]
|
||||
public int VerticalLocation { get; set; }
|
||||
|
||||
[JsonProperty("horizontalLocation")]
|
||||
public int HorizontalLocation { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -43,7 +43,10 @@ namespace PepperDash.Essentials.Core
|
||||
CrestronConsole.AddNewConsoleCommand(s => CrestronConsole.ConsoleCommandResponse(DeviceJsonApi.GetApiMethods(s)), "apimethods", "", ConsoleAccessLevelEnum.AccessOperator);
|
||||
CrestronConsole.AddNewConsoleCommand(SimulateComReceiveOnDevice, "devsimreceive",
|
||||
"Simulates incoming data on a com device", ConsoleAccessLevelEnum.AccessOperator);
|
||||
}
|
||||
|
||||
CrestronConsole.AddNewConsoleCommand(s => SetDeviceStreamDebugging(s), "setdevicestreamdebug", "set comm debug [deviceKey] [off/rx/tx/both] ([minutes])", ConsoleAccessLevelEnum.AccessOperator);
|
||||
CrestronConsole.AddNewConsoleCommand(s => DisableAllDeviceStreamDebugging(), "disableallstreamdebug", "disables stream debugging on all devices", ConsoleAccessLevelEnum.AccessOperator);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calls activate steps on all Device class items
|
||||
@@ -299,5 +302,81 @@ namespace PepperDash.Essentials.Core
|
||||
}
|
||||
com.SimulateReceive(match.Groups[2].Value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to set the debug level of a device
|
||||
/// </summary>
|
||||
/// <param name="s"></param>
|
||||
public static void SetDeviceStreamDebugging(string s)
|
||||
{
|
||||
var args = s.Split(' ');
|
||||
|
||||
var deviceKey = args[0];
|
||||
var setting = args[1];
|
||||
|
||||
var timeout= String.Empty;
|
||||
|
||||
if (args.Length >= 3)
|
||||
{
|
||||
timeout = args[2];
|
||||
}
|
||||
|
||||
var device = GetDeviceForKey(deviceKey) as IStreamDebugging;
|
||||
|
||||
if (device == null)
|
||||
{
|
||||
Debug.Console(0, "Unable to get device with key: {0}", deviceKey);
|
||||
return;
|
||||
}
|
||||
|
||||
eStreamDebuggingSetting debugSetting;
|
||||
|
||||
try
|
||||
{
|
||||
debugSetting = (eStreamDebuggingSetting)Enum.Parse(typeof(eStreamDebuggingSetting), setting, true);
|
||||
}
|
||||
catch
|
||||
{
|
||||
Debug.Console(0, "Unable to convert setting value. Please use off/rx/tx/both");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(timeout))
|
||||
{
|
||||
try
|
||||
{
|
||||
var min = Convert.ToUInt32(timeout);
|
||||
|
||||
device.StreamDebugging.SetDebuggingWithSpecificTimeout(debugSetting, min);
|
||||
Debug.Console(0, "Device: '{0}' debug level set to {1) for {2} minutes", deviceKey, debugSetting, min);
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Console(0, "Unable to convert minutes or settings value. Please use an integer value for minutes. Errro: {0}", e);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
device.StreamDebugging.SetDebuggingWithDefaultTimeout(debugSetting);
|
||||
Debug.Console(0, "Device: '{0}' debug level set to {1) for default time (30 minutes)", deviceKey, debugSetting);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets stream debugging settings to off for all devices
|
||||
/// </summary>
|
||||
public static void DisableAllDeviceStreamDebugging()
|
||||
{
|
||||
foreach (var device in AllDevices)
|
||||
{
|
||||
var streamDevice = device as IStreamDebugging;
|
||||
|
||||
if (streamDevice != null)
|
||||
{
|
||||
streamDevice.StreamDebugging.SetDebuggingWithDefaultTimeout(eStreamDebuggingSetting.Off);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
public interface IBasicVideoMute
|
||||
{
|
||||
void VideoMuteToggle();
|
||||
}
|
||||
|
||||
public interface IBasicVideoMuteWithFeedback : IBasicVideoMute
|
||||
{
|
||||
BoolFeedback VideoMuteIsOn { get; }
|
||||
|
||||
void VideoMuteOn();
|
||||
void VideoMuteOff();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,10 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
|
||||
|
||||
using PepperDash.Core;
|
||||
|
||||
@@ -37,9 +40,21 @@ namespace PepperDash.Essentials.Core
|
||||
return;
|
||||
}
|
||||
LoadDriver(irDriverFilepath);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
}
|
||||
|
||||
public IrOutputPortController(string key, Func<DeviceConfig, IROutputPort> postActivationFunc,
|
||||
DeviceConfig config)
|
||||
: base(key)
|
||||
{
|
||||
AddPostActivationAction(() =>
|
||||
{
|
||||
IrPort = postActivationFunc(config);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Loads the IR driver at path
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
@@ -118,7 +133,6 @@ namespace PepperDash.Essentials.Core
|
||||
{
|
||||
Debug.Console(2, this, "Device {0}: IR Driver {1} does not contain command {2}",
|
||||
Key, IrPort.IRDriverFileNameByIRDriverId(IrPortUid), command);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharp.CrestronIO;
|
||||
using Crestron.SimplSharpPro;
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
@@ -31,16 +24,11 @@ namespace PepperDash.Essentials.Core
|
||||
/// Returns the source Device for this, if it exists in DeviceManager
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public Device SourceDevice
|
||||
public EssentialsDevice SourceDevice
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_SourceDevice == null)
|
||||
_SourceDevice = DeviceManager.GetDeviceForKey(SourceKey) as Device;
|
||||
return _SourceDevice;
|
||||
}
|
||||
get { return _sourceDevice ?? (_sourceDevice = DeviceManager.GetDeviceForKey(SourceKey) as EssentialsDevice); }
|
||||
}
|
||||
Device _SourceDevice;
|
||||
private EssentialsDevice _sourceDevice;
|
||||
|
||||
/// <summary>
|
||||
/// Gets either the source's Name or this AlternateName property, if
|
||||
@@ -51,13 +39,12 @@ namespace PepperDash.Essentials.Core
|
||||
{
|
||||
get
|
||||
{
|
||||
if (string.IsNullOrEmpty(Name))
|
||||
{
|
||||
if (SourceDevice == null)
|
||||
return "---";
|
||||
return SourceDevice.Name;
|
||||
}
|
||||
return Name;
|
||||
if (!string.IsNullOrEmpty(Name))
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
|
||||
return SourceDevice == null ? "---" : SourceDevice.Name;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,235 +1,236 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.Core.Bridges;
|
||||
using PepperDash.Essentials.Core.Routing;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
public class BasicIrDisplay : DisplayBase, IBasicVolumeControls, IBridgeAdvanced
|
||||
{
|
||||
public IrOutputPortController IrPort { get; private set; }
|
||||
public ushort IrPulseTime { get; set; }
|
||||
|
||||
protected override Func<bool> PowerIsOnFeedbackFunc
|
||||
{
|
||||
get { return () => _PowerIsOn; }
|
||||
}
|
||||
protected override Func<bool> IsCoolingDownFeedbackFunc
|
||||
{
|
||||
get { return () => _IsCoolingDown; }
|
||||
}
|
||||
protected override Func<bool> IsWarmingUpFeedbackFunc
|
||||
{
|
||||
get { return () => _IsWarmingUp; }
|
||||
}
|
||||
|
||||
bool _PowerIsOn;
|
||||
bool _IsWarmingUp;
|
||||
bool _IsCoolingDown;
|
||||
|
||||
public BasicIrDisplay(string key, string name, IROutputPort port, string irDriverFilepath)
|
||||
: base(key, name)
|
||||
{
|
||||
IrPort = new IrOutputPortController(key + "-ir", port, irDriverFilepath);
|
||||
DeviceManager.AddDevice(IrPort);
|
||||
|
||||
PowerIsOnFeedback.OutputChange += (o, a) => {
|
||||
Debug.Console(2, this, "Power on={0}", _PowerIsOn);
|
||||
if (_PowerIsOn) StartWarmingTimer();
|
||||
else StartCoolingTimer();
|
||||
};
|
||||
IsWarmingUpFeedback.OutputChange += (o, a) => Debug.Console(2, this, "Warming up={0}", _IsWarmingUp);
|
||||
IsCoolingDownFeedback.OutputChange += (o, a) => Debug.Console(2, this, "Cooling down={0}", _IsCoolingDown);
|
||||
|
||||
InputPorts.AddRange(new RoutingPortCollection<RoutingInputPort>
|
||||
{
|
||||
new RoutingInputPort(RoutingPortNames.HdmiIn1, eRoutingSignalType.Audio | eRoutingSignalType.Video,
|
||||
eRoutingPortConnectionType.Hdmi, new Action(Hdmi1), this, false),
|
||||
new RoutingInputPort(RoutingPortNames.HdmiIn2, eRoutingSignalType.Audio | eRoutingSignalType.Video,
|
||||
eRoutingPortConnectionType.Hdmi, new Action(Hdmi2), this, false),
|
||||
new RoutingInputPort(RoutingPortNames.HdmiIn3, eRoutingSignalType.Audio | eRoutingSignalType.Video,
|
||||
eRoutingPortConnectionType.Hdmi, new Action(Hdmi3), this, false),
|
||||
new RoutingInputPort(RoutingPortNames.HdmiIn4, eRoutingSignalType.Audio | eRoutingSignalType.Video,
|
||||
eRoutingPortConnectionType.Hdmi, new Action(Hdmi4), this, false),
|
||||
new RoutingInputPort(RoutingPortNames.ComponentIn, eRoutingSignalType.Audio | eRoutingSignalType.Video,
|
||||
eRoutingPortConnectionType.Hdmi, new Action(Component1), this, false),
|
||||
new RoutingInputPort(RoutingPortNames.CompositeIn, eRoutingSignalType.Audio | eRoutingSignalType.Video,
|
||||
eRoutingPortConnectionType.Hdmi, new Action(Video1), this, false),
|
||||
new RoutingInputPort(RoutingPortNames.AntennaIn, eRoutingSignalType.Audio | eRoutingSignalType.Video,
|
||||
eRoutingPortConnectionType.Hdmi, new Action(Antenna), this, false),
|
||||
});
|
||||
}
|
||||
|
||||
public void Hdmi1()
|
||||
{
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_HDMI_1, IrPulseTime);
|
||||
}
|
||||
|
||||
public void Hdmi2()
|
||||
{
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_HDMI_2, IrPulseTime);
|
||||
}
|
||||
|
||||
public void Hdmi3()
|
||||
{
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_HDMI_3, IrPulseTime);
|
||||
}
|
||||
|
||||
public void Hdmi4()
|
||||
{
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_HDMI_4, IrPulseTime);
|
||||
}
|
||||
|
||||
public void Component1()
|
||||
{
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_COMPONENT_1, IrPulseTime);
|
||||
}
|
||||
|
||||
public void Video1()
|
||||
{
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_VIDEO_1, IrPulseTime);
|
||||
}
|
||||
|
||||
public void Antenna()
|
||||
{
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_ANTENNA, IrPulseTime);
|
||||
}
|
||||
|
||||
#region IPower Members
|
||||
|
||||
public override void PowerOn()
|
||||
{
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_POWER_ON, IrPulseTime);
|
||||
_PowerIsOn = true;
|
||||
PowerIsOnFeedback.FireUpdate();
|
||||
}
|
||||
|
||||
public override void PowerOff()
|
||||
{
|
||||
_PowerIsOn = false;
|
||||
PowerIsOnFeedback.FireUpdate();
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_POWER_OFF, IrPulseTime);
|
||||
}
|
||||
|
||||
public override void PowerToggle()
|
||||
{
|
||||
_PowerIsOn = false;
|
||||
PowerIsOnFeedback.FireUpdate();
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_POWER, IrPulseTime);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IBasicVolumeControls Members
|
||||
|
||||
public void VolumeUp(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_VOL_PLUS, pressRelease);
|
||||
}
|
||||
|
||||
public void VolumeDown(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_VOL_MINUS, pressRelease);
|
||||
}
|
||||
|
||||
public void MuteToggle()
|
||||
{
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_MUTE, 200);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
void StartWarmingTimer()
|
||||
{
|
||||
_IsWarmingUp = true;
|
||||
IsWarmingUpFeedback.FireUpdate();
|
||||
new CTimer(o => {
|
||||
_IsWarmingUp = false;
|
||||
IsWarmingUpFeedback.FireUpdate();
|
||||
}, 10000);
|
||||
}
|
||||
|
||||
void StartCoolingTimer()
|
||||
{
|
||||
_IsCoolingDown = true;
|
||||
IsCoolingDownFeedback.FireUpdate();
|
||||
new CTimer(o =>
|
||||
{
|
||||
_IsCoolingDown = false;
|
||||
IsCoolingDownFeedback.FireUpdate();
|
||||
}, 7000);
|
||||
}
|
||||
|
||||
#region IRoutingSink Members
|
||||
|
||||
/// <summary>
|
||||
/// Typically called by the discovery routing algorithm.
|
||||
/// </summary>
|
||||
/// <param name="inputSelector">A delegate containing the input selector method to call</param>
|
||||
public override void ExecuteSwitch(object inputSelector)
|
||||
{
|
||||
Debug.Console(2, this, "Switching to input '{0}'", (inputSelector as Action).ToString());
|
||||
|
||||
Action finishSwitch = () =>
|
||||
{
|
||||
var action = inputSelector as Action;
|
||||
if (action != null)
|
||||
action();
|
||||
};
|
||||
|
||||
if (!PowerIsOnFeedback.BoolValue)
|
||||
{
|
||||
PowerOn();
|
||||
EventHandler<FeedbackEventArgs> oneTimer = null;
|
||||
oneTimer = (o, a) =>
|
||||
{
|
||||
if (IsWarmingUpFeedback.BoolValue) return; // Only catch done warming
|
||||
IsWarmingUpFeedback.OutputChange -= oneTimer;
|
||||
finishSwitch();
|
||||
};
|
||||
IsWarmingUpFeedback.OutputChange += oneTimer;
|
||||
}
|
||||
else // Do it!
|
||||
finishSwitch();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
|
||||
{
|
||||
LinkDisplayToApi(this, trilist, joinStart, joinMapKey, bridge);
|
||||
}
|
||||
}
|
||||
|
||||
public class BasicIrDisplayFactory : EssentialsDeviceFactory<BasicIrDisplay>
|
||||
{
|
||||
public BasicIrDisplayFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "basicirdisplay" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new BasicIrDisplay Device");
|
||||
var ir = IRPortHelper.GetIrPort(dc.Properties);
|
||||
if (ir != null)
|
||||
{
|
||||
var display = new BasicIrDisplay(dc.Key, dc.Name, ir.Port, ir.FileName);
|
||||
display.IrPulseTime = 200; // Set default pulse time for IR commands.
|
||||
return display;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.Core.Bridges;
|
||||
using PepperDash.Essentials.Core.Routing;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
[Description("Wrapper class for a Basic IR Display")]
|
||||
public class BasicIrDisplay : DisplayBase, IBasicVolumeControls, IBridgeAdvanced
|
||||
{
|
||||
public IrOutputPortController IrPort { get; private set; }
|
||||
public ushort IrPulseTime { get; set; }
|
||||
|
||||
protected override Func<bool> PowerIsOnFeedbackFunc
|
||||
{
|
||||
get { return () => _PowerIsOn; }
|
||||
}
|
||||
protected override Func<bool> IsCoolingDownFeedbackFunc
|
||||
{
|
||||
get { return () => _IsCoolingDown; }
|
||||
}
|
||||
protected override Func<bool> IsWarmingUpFeedbackFunc
|
||||
{
|
||||
get { return () => _IsWarmingUp; }
|
||||
}
|
||||
|
||||
bool _PowerIsOn;
|
||||
bool _IsWarmingUp;
|
||||
bool _IsCoolingDown;
|
||||
|
||||
public BasicIrDisplay(string key, string name, IROutputPort port, string irDriverFilepath)
|
||||
: base(key, name)
|
||||
{
|
||||
IrPort = new IrOutputPortController(key + "-ir", port, irDriverFilepath);
|
||||
DeviceManager.AddDevice(IrPort);
|
||||
|
||||
PowerIsOnFeedback.OutputChange += (o, a) => {
|
||||
Debug.Console(2, this, "Power on={0}", _PowerIsOn);
|
||||
if (_PowerIsOn) StartWarmingTimer();
|
||||
else StartCoolingTimer();
|
||||
};
|
||||
IsWarmingUpFeedback.OutputChange += (o, a) => Debug.Console(2, this, "Warming up={0}", _IsWarmingUp);
|
||||
IsCoolingDownFeedback.OutputChange += (o, a) => Debug.Console(2, this, "Cooling down={0}", _IsCoolingDown);
|
||||
|
||||
InputPorts.AddRange(new RoutingPortCollection<RoutingInputPort>
|
||||
{
|
||||
new RoutingInputPort(RoutingPortNames.HdmiIn1, eRoutingSignalType.Audio | eRoutingSignalType.Video,
|
||||
eRoutingPortConnectionType.Hdmi, new Action(Hdmi1), this, false),
|
||||
new RoutingInputPort(RoutingPortNames.HdmiIn2, eRoutingSignalType.Audio | eRoutingSignalType.Video,
|
||||
eRoutingPortConnectionType.Hdmi, new Action(Hdmi2), this, false),
|
||||
new RoutingInputPort(RoutingPortNames.HdmiIn3, eRoutingSignalType.Audio | eRoutingSignalType.Video,
|
||||
eRoutingPortConnectionType.Hdmi, new Action(Hdmi3), this, false),
|
||||
new RoutingInputPort(RoutingPortNames.HdmiIn4, eRoutingSignalType.Audio | eRoutingSignalType.Video,
|
||||
eRoutingPortConnectionType.Hdmi, new Action(Hdmi4), this, false),
|
||||
new RoutingInputPort(RoutingPortNames.ComponentIn, eRoutingSignalType.Audio | eRoutingSignalType.Video,
|
||||
eRoutingPortConnectionType.Hdmi, new Action(Component1), this, false),
|
||||
new RoutingInputPort(RoutingPortNames.CompositeIn, eRoutingSignalType.Audio | eRoutingSignalType.Video,
|
||||
eRoutingPortConnectionType.Hdmi, new Action(Video1), this, false),
|
||||
new RoutingInputPort(RoutingPortNames.AntennaIn, eRoutingSignalType.Audio | eRoutingSignalType.Video,
|
||||
eRoutingPortConnectionType.Hdmi, new Action(Antenna), this, false),
|
||||
});
|
||||
}
|
||||
|
||||
public void Hdmi1()
|
||||
{
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_HDMI_1, IrPulseTime);
|
||||
}
|
||||
|
||||
public void Hdmi2()
|
||||
{
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_HDMI_2, IrPulseTime);
|
||||
}
|
||||
|
||||
public void Hdmi3()
|
||||
{
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_HDMI_3, IrPulseTime);
|
||||
}
|
||||
|
||||
public void Hdmi4()
|
||||
{
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_HDMI_4, IrPulseTime);
|
||||
}
|
||||
|
||||
public void Component1()
|
||||
{
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_COMPONENT_1, IrPulseTime);
|
||||
}
|
||||
|
||||
public void Video1()
|
||||
{
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_VIDEO_1, IrPulseTime);
|
||||
}
|
||||
|
||||
public void Antenna()
|
||||
{
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_ANTENNA, IrPulseTime);
|
||||
}
|
||||
|
||||
#region IPower Members
|
||||
|
||||
public override void PowerOn()
|
||||
{
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_POWER_ON, IrPulseTime);
|
||||
_PowerIsOn = true;
|
||||
PowerIsOnFeedback.FireUpdate();
|
||||
}
|
||||
|
||||
public override void PowerOff()
|
||||
{
|
||||
_PowerIsOn = false;
|
||||
PowerIsOnFeedback.FireUpdate();
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_POWER_OFF, IrPulseTime);
|
||||
}
|
||||
|
||||
public override void PowerToggle()
|
||||
{
|
||||
_PowerIsOn = false;
|
||||
PowerIsOnFeedback.FireUpdate();
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_POWER, IrPulseTime);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IBasicVolumeControls Members
|
||||
|
||||
public void VolumeUp(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_VOL_PLUS, pressRelease);
|
||||
}
|
||||
|
||||
public void VolumeDown(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_VOL_MINUS, pressRelease);
|
||||
}
|
||||
|
||||
public void MuteToggle()
|
||||
{
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_MUTE, 200);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
void StartWarmingTimer()
|
||||
{
|
||||
_IsWarmingUp = true;
|
||||
IsWarmingUpFeedback.FireUpdate();
|
||||
new CTimer(o => {
|
||||
_IsWarmingUp = false;
|
||||
IsWarmingUpFeedback.FireUpdate();
|
||||
}, 10000);
|
||||
}
|
||||
|
||||
void StartCoolingTimer()
|
||||
{
|
||||
_IsCoolingDown = true;
|
||||
IsCoolingDownFeedback.FireUpdate();
|
||||
new CTimer(o =>
|
||||
{
|
||||
_IsCoolingDown = false;
|
||||
IsCoolingDownFeedback.FireUpdate();
|
||||
}, 7000);
|
||||
}
|
||||
|
||||
#region IRoutingSink Members
|
||||
|
||||
/// <summary>
|
||||
/// Typically called by the discovery routing algorithm.
|
||||
/// </summary>
|
||||
/// <param name="inputSelector">A delegate containing the input selector method to call</param>
|
||||
public override void ExecuteSwitch(object inputSelector)
|
||||
{
|
||||
Debug.Console(2, this, "Switching to input '{0}'", (inputSelector as Action).ToString());
|
||||
|
||||
Action finishSwitch = () =>
|
||||
{
|
||||
var action = inputSelector as Action;
|
||||
if (action != null)
|
||||
action();
|
||||
};
|
||||
|
||||
if (!PowerIsOnFeedback.BoolValue)
|
||||
{
|
||||
PowerOn();
|
||||
EventHandler<FeedbackEventArgs> oneTimer = null;
|
||||
oneTimer = (o, a) =>
|
||||
{
|
||||
if (IsWarmingUpFeedback.BoolValue) return; // Only catch done warming
|
||||
IsWarmingUpFeedback.OutputChange -= oneTimer;
|
||||
finishSwitch();
|
||||
};
|
||||
IsWarmingUpFeedback.OutputChange += oneTimer;
|
||||
}
|
||||
else // Do it!
|
||||
finishSwitch();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
|
||||
{
|
||||
LinkDisplayToApi(this, trilist, joinStart, joinMapKey, bridge);
|
||||
}
|
||||
}
|
||||
|
||||
public class BasicIrDisplayFactory : EssentialsDeviceFactory<BasicIrDisplay>
|
||||
{
|
||||
public BasicIrDisplayFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "basicirdisplay" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new BasicIrDisplay Device");
|
||||
var ir = IRPortHelper.GetIrPort(dc.Properties);
|
||||
if (ir != null)
|
||||
{
|
||||
var display = new BasicIrDisplay(dc.Key, dc.Name, ir.Port, ir.FileName);
|
||||
display.IrPulseTime = 200; // Set default pulse time for IR commands.
|
||||
return display;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -128,9 +128,16 @@ namespace PepperDash.Essentials.Core
|
||||
if (!string.IsNullOrEmpty(joinMapSerialized))
|
||||
joinMap = JsonConvert.DeserializeObject<DisplayControllerJoinMap>(joinMapSerialized);
|
||||
|
||||
bridge.AddJoinMap(Key, joinMap);
|
||||
|
||||
Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||
if (bridge != null)
|
||||
{
|
||||
bridge.AddJoinMap(Key, joinMap);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(0,this,"Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
|
||||
}
|
||||
|
||||
Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||
Debug.Console(0, "Linking to Display: {0}", displayDevice.Name);
|
||||
|
||||
trilist.StringInput[joinMap.Name.JoinNumber].StringValue = displayDevice.Name;
|
||||
|
||||
@@ -103,7 +103,7 @@ namespace PepperDash.Essentials.Core
|
||||
// Check for types that have been added by plugin dlls.
|
||||
if (FactoryMethods.ContainsKey(typeName))
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Loading '{0}' from plugin", dc.Type);
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Loading '{0}' from Essentials Core", dc.Type);
|
||||
return FactoryMethods[typeName].FactoryMethod(dc);
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user