mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-01-31 05:14:51 +00:00
Compare commits
242 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ce782c1cd3 | ||
|
|
f93287641f | ||
|
|
d2e9c2e238 | ||
|
|
4b926c10f6 | ||
|
|
7e9256187a | ||
|
|
061d95e2b1 | ||
|
|
78fe799afc | ||
|
|
596b8bf29a | ||
|
|
87de4a4bf0 | ||
|
|
52343ddf7b | ||
|
|
854c2bcb6f | ||
|
|
0b9ed462b4 | ||
|
|
4dafa34b2e | ||
|
|
f1611da74c | ||
|
|
d588757eb6 | ||
|
|
5bb5c9e07f | ||
|
|
176c9d9835 | ||
|
|
6726e989a7 | ||
|
|
77fbee78a8 | ||
|
|
172e2fb744 | ||
|
|
f2b2825220 | ||
|
|
1b832409e4 | ||
|
|
969ba3c87c | ||
|
|
d93a563cd8 | ||
|
|
63f81456e8 | ||
|
|
764d8d2b48 | ||
|
|
1ae6069ac2 | ||
|
|
7eccc82541 | ||
|
|
b2dbd3c377 | ||
|
|
47e47ec272 | ||
|
|
c392ac6b06 | ||
|
|
af2fe7e54e | ||
|
|
3f68a84fe8 | ||
|
|
5d93a5177c | ||
|
|
f83a7aecf2 | ||
|
|
6b21b37aef | ||
|
|
b1459da2ba | ||
|
|
82e2f1e959 | ||
|
|
c329e31802 | ||
|
|
2b9615ad94 | ||
|
|
71098ca65d | ||
|
|
b917ff980a | ||
|
|
c3c9c584ae | ||
|
|
b6f6c72c92 | ||
|
|
59b2995a1b | ||
|
|
bdf3e2054f | ||
|
|
1acb3a20c5 | ||
|
|
2c98fc4545 | ||
|
|
05c9dd3c69 | ||
|
|
5de8b703dd | ||
|
|
a3887510df | ||
|
|
dc8d0e25d5 | ||
|
|
028e411ffe | ||
|
|
5aed3c4480 | ||
|
|
ddfd1d0586 | ||
|
|
77d5438063 | ||
|
|
42a79f0e1e | ||
|
|
f8a6ef8c41 | ||
|
|
af1489d511 | ||
|
|
aa2b5b9ab4 | ||
|
|
fd2fe8fa6e | ||
|
|
15c6da43eb | ||
|
|
6725266ad9 | ||
|
|
8f564a82d4 | ||
|
|
6f6ff28784 | ||
|
|
0a0bfc018d | ||
|
|
bd5a69a83c | ||
|
|
48c6bb78bc | ||
|
|
2cd68d40dc | ||
|
|
43281f0db6 | ||
|
|
fa141c6207 | ||
|
|
07d6fcef1c | ||
|
|
a5ea9bb1eb | ||
|
|
90c122d966 | ||
|
|
634b07dc12 | ||
|
|
699900518a | ||
|
|
ea2d573ab3 | ||
|
|
5c923e66ec | ||
|
|
7958c64e67 | ||
|
|
410ffd2f19 | ||
|
|
53e0599e2a | ||
|
|
af12a81c00 | ||
|
|
2a9e7c81eb | ||
|
|
c15adea02e | ||
|
|
935f2c4bf4 | ||
|
|
327a9a5f6b | ||
|
|
b7ed1d8238 | ||
|
|
aff4e5a61f | ||
|
|
fe172098b9 | ||
|
|
f2c2cd423d | ||
|
|
22722fca21 | ||
|
|
6efec400b8 | ||
|
|
f82816729b | ||
|
|
1b599ff863 | ||
|
|
ae23e48fd0 | ||
|
|
a8f1f77d48 | ||
|
|
68064c7194 | ||
|
|
3ceecd3fbe | ||
|
|
8585977f71 | ||
|
|
288c9bb04c | ||
|
|
47fb805766 | ||
|
|
31b0683cdf | ||
|
|
04194da31c | ||
|
|
09bdc49c15 | ||
|
|
e36b2b97d2 | ||
|
|
d705525a45 | ||
|
|
ecce6e2be9 | ||
|
|
95c0f57000 | ||
|
|
697b9109a3 | ||
|
|
727367c061 | ||
|
|
f26ff0b767 | ||
|
|
44b72dcfe5 | ||
|
|
937f3f3dc0 | ||
|
|
17bf6e3f0a | ||
|
|
e7253b4acc | ||
|
|
71a27027e7 | ||
|
|
2655b8f7b8 | ||
|
|
3adee8bc30 | ||
|
|
e3a3a2cd2d | ||
|
|
6235b44d89 | ||
|
|
90bbd65fdc | ||
|
|
43fd263ea1 | ||
|
|
038e23289e | ||
|
|
2121456d50 | ||
|
|
3a99c3bb30 | ||
|
|
52ac57c080 | ||
|
|
84ee743ff5 | ||
|
|
24fb74701a | ||
|
|
1c9aa1eaf6 | ||
|
|
7c88843f50 | ||
|
|
7a3ce5fcf1 | ||
|
|
3049e5a041 | ||
|
|
59234274dc | ||
|
|
120dae2e63 | ||
|
|
e4317825d3 | ||
|
|
bf6971a52d | ||
|
|
ef0a8dd3b9 | ||
|
|
ca42d744cf | ||
|
|
ffa4de49e9 | ||
|
|
3c5c157a70 | ||
|
|
8ef58359e7 | ||
|
|
530e1ebcb8 | ||
|
|
8d03bef34f | ||
|
|
a870418f96 | ||
|
|
37e2dfd11f | ||
|
|
6c02423a1c | ||
|
|
6ea966ec6c | ||
|
|
6e9b24576e | ||
|
|
ad04235061 | ||
|
|
34f3e543f2 | ||
|
|
e145bfbaee | ||
|
|
4f726007b8 | ||
|
|
d62b5b7e0c | ||
|
|
967d281b62 | ||
|
|
be9fd5e8d1 | ||
|
|
f25d05edc2 | ||
|
|
c3d6890a4c | ||
|
|
ff6184c241 | ||
|
|
034c6913f7 | ||
|
|
03da699a36 | ||
|
|
3a3f6db692 | ||
|
|
87a449d1ee | ||
|
|
1d6a835323 | ||
|
|
6bbad2e0f9 | ||
|
|
821f2a6d60 | ||
|
|
f6136a8c77 | ||
|
|
676526ed48 | ||
|
|
a8ffe2d09f | ||
|
|
541fbbbb2d | ||
|
|
3a5686c27a | ||
|
|
531e7186f2 | ||
|
|
9bc0269e78 | ||
|
|
0df53facb1 | ||
|
|
2ee77f1bca | ||
|
|
9a56f5bb49 | ||
|
|
895f49b888 | ||
|
|
e51e1930d9 | ||
|
|
d245f36cf3 | ||
|
|
47675f12b4 | ||
|
|
a7c920b780 | ||
|
|
3a91a895e6 | ||
|
|
397b0b4d9c | ||
|
|
b793c04ad3 | ||
|
|
3d9070dc4f | ||
|
|
3f82eaeb66 | ||
|
|
3cbf784417 | ||
|
|
3d6ce7534f | ||
|
|
28d694d0b4 | ||
|
|
a320eff13c | ||
|
|
f7db0ef36c | ||
|
|
184144dc3c | ||
|
|
dfd7cb4411 | ||
|
|
5014343fa3 | ||
|
|
f2bfeda074 | ||
|
|
339a4f8a62 | ||
|
|
78668e8abb | ||
|
|
101d1b5625 | ||
|
|
780f7bc249 | ||
|
|
6ec0295aba | ||
|
|
d98b7e837a | ||
|
|
99da6debdc | ||
|
|
c2665f0225 | ||
|
|
0406361d75 | ||
|
|
182326b3c5 | ||
|
|
4a69207038 | ||
|
|
7b4aad3516 | ||
|
|
8dabe732ec | ||
|
|
410cf1b4ad | ||
|
|
ee6293fa75 | ||
|
|
873fd81b5c | ||
|
|
a2a3f4caed | ||
|
|
1df658b7eb | ||
|
|
1c9061cc28 | ||
|
|
a0a83a1af7 | ||
|
|
f17b62844d | ||
|
|
5f8170fb66 | ||
|
|
42086f650d | ||
|
|
a84084b273 | ||
|
|
5ed8ff6dac | ||
|
|
b295f931a3 | ||
|
|
bff8529c9f | ||
|
|
f819d0d743 | ||
|
|
1534433949 | ||
|
|
daf44ae797 | ||
|
|
759635b364 | ||
|
|
96e60f6eaf | ||
|
|
a13428fb4e | ||
|
|
818d6c9ca5 | ||
|
|
a6df8f908b | ||
|
|
0d5c93bbde | ||
|
|
40dcca0e8d | ||
|
|
ef443bdfb0 | ||
|
|
a900a08095 | ||
|
|
fa94b83d63 | ||
|
|
5f119690c2 | ||
|
|
43071a4d91 | ||
|
|
4d4d50bc92 | ||
|
|
2e566b41a0 | ||
|
|
be5b23e9d1 | ||
|
|
448b408f94 | ||
|
|
e1422d8653 | ||
|
|
b353b93458 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -20,4 +20,5 @@ obj/
|
|||||||
[Rr]elease*/
|
[Rr]elease*/
|
||||||
_ReSharper*/
|
_ReSharper*/
|
||||||
SIMPLSharpLogs/
|
SIMPLSharpLogs/
|
||||||
*.projectinfo
|
*.projectinfo
|
||||||
|
essentials-framework/EssentialDMTestConfig/
|
||||||
|
|||||||
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -1,3 +0,0 @@
|
|||||||
[submodule "essentials-framework"]
|
|
||||||
path = essentials-framework
|
|
||||||
url = https://bitbucket.org/Pepperdash_Products/essentials-framework.git
|
|
||||||
|
|||||||
BIN
IR Drivers/samsung_un_series.ir
Normal file
BIN
IR Drivers/samsung_un_series.ir
Normal file
Binary file not shown.
@@ -1,49 +1,49 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||||
# Visual Studio 2008
|
# Visual Studio 2008
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PepperDashEssentials", ".\PepperDashEssentials\PepperDashEssentials.csproj", "{1BED5BA9-88C4-4365-9362-6F4B128071D3}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PepperDashEssentials", ".\PepperDashEssentials\PepperDashEssentials.csproj", "{1BED5BA9-88C4-4365-9362-6F4B128071D3}"
|
||||||
ProjectSection(ProjectDependencies) = postProject
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
{892B761C-E479-44CE-BD74-243E9214AF13} = {892B761C-E479-44CE-BD74-243E9214AF13}
|
{892B761C-E479-44CE-BD74-243E9214AF13} = {892B761C-E479-44CE-BD74-243E9214AF13}
|
||||||
{9199CE8A-0C9F-4952-8672-3EED798B284F} = {9199CE8A-0C9F-4952-8672-3EED798B284F}
|
{9199CE8A-0C9F-4952-8672-3EED798B284F} = {9199CE8A-0C9F-4952-8672-3EED798B284F}
|
||||||
{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5} = {A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}
|
{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5} = {A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PepperDash_Essentials_Core", ".\essentials-framework\Essentials Core\PepperDashEssentialsBase\PepperDash_Essentials_Core.csproj", "{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PepperDash_Essentials_Core", ".\essentials-framework\Essentials Core\PepperDashEssentialsBase\PepperDash_Essentials_Core.csproj", "{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Essentials Devices Common", ".\essentials-framework\Essentials Devices Common\Essentials Devices Common\Essentials Devices Common.csproj", "{892B761C-E479-44CE-BD74-243E9214AF13}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Essentials Devices Common", ".\essentials-framework\Essentials Devices Common\Essentials Devices Common\Essentials Devices Common.csproj", "{892B761C-E479-44CE-BD74-243E9214AF13}"
|
||||||
ProjectSection(ProjectDependencies) = postProject
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5} = {A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}
|
{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5} = {A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Essentials_DM", ".\essentials-framework\Essentials DM\Essentials_DM\Essentials_DM.csproj", "{9199CE8A-0C9F-4952-8672-3EED798B284F}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Essentials_DM", ".\essentials-framework\Essentials DM\Essentials_DM\Essentials_DM.csproj", "{9199CE8A-0C9F-4952-8672-3EED798B284F}"
|
||||||
ProjectSection(ProjectDependencies) = postProject
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5} = {A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}
|
{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5} = {A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
Release|Any CPU = Release|Any CPU
|
Release|Any CPU = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{1BED5BA9-88C4-4365-9362-6F4B128071D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{1BED5BA9-88C4-4365-9362-6F4B128071D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{1BED5BA9-88C4-4365-9362-6F4B128071D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{1BED5BA9-88C4-4365-9362-6F4B128071D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{1BED5BA9-88C4-4365-9362-6F4B128071D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{1BED5BA9-88C4-4365-9362-6F4B128071D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{1BED5BA9-88C4-4365-9362-6F4B128071D3}.Release|Any CPU.Build.0 = Release|Any CPU
|
{1BED5BA9-88C4-4365-9362-6F4B128071D3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}.Release|Any CPU.Build.0 = Release|Any CPU
|
{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{892B761C-E479-44CE-BD74-243E9214AF13}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{892B761C-E479-44CE-BD74-243E9214AF13}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{892B761C-E479-44CE-BD74-243E9214AF13}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{892B761C-E479-44CE-BD74-243E9214AF13}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{892B761C-E479-44CE-BD74-243E9214AF13}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{892B761C-E479-44CE-BD74-243E9214AF13}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{892B761C-E479-44CE-BD74-243E9214AF13}.Release|Any CPU.Build.0 = Release|Any CPU
|
{892B761C-E479-44CE-BD74-243E9214AF13}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{9199CE8A-0C9F-4952-8672-3EED798B284F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{9199CE8A-0C9F-4952-8672-3EED798B284F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{9199CE8A-0C9F-4952-8672-3EED798B284F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{9199CE8A-0C9F-4952-8672-3EED798B284F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{9199CE8A-0C9F-4952-8672-3EED798B284F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{9199CE8A-0C9F-4952-8672-3EED798B284F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{9199CE8A-0C9F-4952-8672-3EED798B284F}.Release|Any CPU.Build.0 = Release|Any CPU
|
{9199CE8A-0C9F-4952-8672-3EED798B284F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,102 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
|
using PepperDash.Essentials.Devices.Common.Codec;
|
||||||
|
using PepperDash.Essentials.Devices.Common.AudioCodec;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.AppServer.Messengers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Provides a messaging bridge for an AudioCodecBase device
|
||||||
|
/// </summary>
|
||||||
|
public class AudioCodecBaseMessenger : MessengerBase
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Device being bridged
|
||||||
|
/// </summary>
|
||||||
|
public AudioCodecBase Codec { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constuctor
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <param name="codec"></param>
|
||||||
|
/// <param name="messagePath"></param>
|
||||||
|
public AudioCodecBaseMessenger(string key, AudioCodecBase codec, string messagePath)
|
||||||
|
: base(key, messagePath)
|
||||||
|
{
|
||||||
|
if (codec == null)
|
||||||
|
throw new ArgumentNullException("codec");
|
||||||
|
|
||||||
|
Codec = codec;
|
||||||
|
codec.CallStatusChange += new EventHandler<CodecCallStatusItemChangeEventArgs>(codec_CallStatusChange);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void CustomRegisterWithAppServer(CotijaSystemController appServerController)
|
||||||
|
{
|
||||||
|
appServerController.AddAction(MessagePath + "/fullStatus", new Action(SendAtcFullMessageObject));
|
||||||
|
appServerController.AddAction(MessagePath + "/dial", new Action<string>(s => Codec.Dial(s)));
|
||||||
|
appServerController.AddAction(MessagePath + "/endCallById", new Action<string>(s =>
|
||||||
|
{
|
||||||
|
var call = GetCallWithId(s);
|
||||||
|
if (call != null)
|
||||||
|
Codec.EndCall(call);
|
||||||
|
}));
|
||||||
|
appServerController.AddAction(MessagePath + "/endAllCalls", new Action(Codec.EndAllCalls));
|
||||||
|
appServerController.AddAction(MessagePath + "/dtmf", new Action<string>(s => Codec.SendDtmf(s)));
|
||||||
|
appServerController.AddAction(MessagePath + "/rejectById", new Action<string>(s =>
|
||||||
|
{
|
||||||
|
var call = GetCallWithId(s);
|
||||||
|
if (call != null)
|
||||||
|
Codec.RejectCall(call);
|
||||||
|
}));
|
||||||
|
appServerController.AddAction(MessagePath + "/acceptById", new Action<string>(s =>
|
||||||
|
{
|
||||||
|
var call = GetCallWithId(s);
|
||||||
|
if (call != null)
|
||||||
|
Codec.AcceptCall(call);
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Helper to grab a call with string ID
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
CodecActiveCallItem GetCallWithId(string id)
|
||||||
|
{
|
||||||
|
return Codec.ActiveCalls.FirstOrDefault(c => c.Id == id);
|
||||||
|
}
|
||||||
|
|
||||||
|
void codec_CallStatusChange(object sender, CodecCallStatusItemChangeEventArgs e)
|
||||||
|
{
|
||||||
|
SendAtcFullMessageObject();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Helper method to build call status for vtc
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
void SendAtcFullMessageObject()
|
||||||
|
{
|
||||||
|
|
||||||
|
var info = Codec.CodecInfo;
|
||||||
|
PostStatusMessage(new
|
||||||
|
{
|
||||||
|
isInCall = Codec.IsInCall,
|
||||||
|
calls = Codec.ActiveCalls,
|
||||||
|
info = new
|
||||||
|
{
|
||||||
|
phoneNumber = info.PhoneNumber
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
75
PepperDashEssentials/AppServer/Messengers/ConfigMessenger.cs
Normal file
75
PepperDashEssentials/AppServer/Messengers/ConfigMessenger.cs
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core.Config;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.AppServer.Messengers
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Handles interactions with the app server to update the config
|
||||||
|
/// </summary>
|
||||||
|
public class ConfigMessenger : MessengerBase
|
||||||
|
{
|
||||||
|
public ConfigMessenger(string key, string messagePath)
|
||||||
|
: base(key, messagePath)
|
||||||
|
{
|
||||||
|
ConfigUpdater.ConfigStatusChanged -= ConfigUpdater_ConfigStatusChanged;
|
||||||
|
ConfigUpdater.ConfigStatusChanged += new EventHandler<ConfigStatusEventArgs>(ConfigUpdater_ConfigStatusChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConfigUpdater_ConfigStatusChanged(object sender, ConfigStatusEventArgs e)
|
||||||
|
{
|
||||||
|
PostUpdateStatus(e.UpdateStatus.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void CustomRegisterWithAppServer(CotijaSystemController appServerController)
|
||||||
|
{
|
||||||
|
appServerController.AddAction(MessagePath + "/updateConfig", new Action<string>(s => GetConfigFile(s)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Generates or passes the URL to make the request to GET the config from a server
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="url"></param>
|
||||||
|
void GetConfigFile(string url)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Attempt to parse the URL
|
||||||
|
var parser = new Crestron.SimplSharp.Net.Http.UrlParser(url);
|
||||||
|
|
||||||
|
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Successfully parsed URL from AppServer message: {0}", parser.Url);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
// If unable to parse the URL, generate it from config data
|
||||||
|
Debug.Console(2, "Error parsing URL: {0}", e);
|
||||||
|
|
||||||
|
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Unable to parse URL from AppServer message. Generating URL from config data");
|
||||||
|
url = string.Format("http://{0}/api/system/{1}/config", AppServerController.Config.ServerUrl, AppServerController.SystemUuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
ConfigUpdater.GetConfigFromServer(url);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Posts a message with the current status of the config update
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="status"></param>
|
||||||
|
void PostUpdateStatus(string status)
|
||||||
|
{
|
||||||
|
PostStatusMessage(new
|
||||||
|
{
|
||||||
|
updateStatus = status
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
216
PepperDashEssentials/AppServer/Messengers/Ddvc01AtcMessenger.cs
Normal file
216
PepperDashEssentials/AppServer/Messengers/Ddvc01AtcMessenger.cs
Normal file
@@ -0,0 +1,216 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
using Crestron.SimplSharpPro.EthernetCommunication;
|
||||||
|
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.Devices.Common.Codec;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.AppServer.Messengers
|
||||||
|
{
|
||||||
|
public class Ddvc01AtcMessenger : MessengerBase
|
||||||
|
{
|
||||||
|
BasicTriList EISC;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 221
|
||||||
|
/// </summary>
|
||||||
|
const uint BDialHangupOnHook = 221;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 251
|
||||||
|
/// </summary>
|
||||||
|
const uint BIncomingAnswer = 251;
|
||||||
|
/// <summary>
|
||||||
|
/// 252
|
||||||
|
/// </summary>
|
||||||
|
const uint BIncomingReject = 252;
|
||||||
|
/// <summary>
|
||||||
|
/// 241
|
||||||
|
/// </summary>
|
||||||
|
const uint BSpeedDial1 = 241;
|
||||||
|
/// <summary>
|
||||||
|
/// 242
|
||||||
|
/// </summary>
|
||||||
|
const uint BSpeedDial2 = 242;
|
||||||
|
/// <summary>
|
||||||
|
/// 243
|
||||||
|
/// </summary>
|
||||||
|
const uint BSpeedDial3 = 243;
|
||||||
|
/// <summary>
|
||||||
|
/// 244
|
||||||
|
/// </summary>
|
||||||
|
const uint BSpeedDial4 = 244;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 201
|
||||||
|
/// </summary>
|
||||||
|
const uint SCurrentDialString = 201;
|
||||||
|
/// <summary>
|
||||||
|
/// 211
|
||||||
|
/// </summary>
|
||||||
|
const uint SCurrentCallNumber = 211;
|
||||||
|
/// <summary>
|
||||||
|
/// 212
|
||||||
|
/// </summary>
|
||||||
|
const uint SCurrentCallName = 212;
|
||||||
|
/// <summary>
|
||||||
|
/// 221
|
||||||
|
/// </summary>
|
||||||
|
const uint SHookState = 221;
|
||||||
|
/// <summary>
|
||||||
|
/// 222
|
||||||
|
/// </summary>
|
||||||
|
const uint SCallDirection = 222;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 201-212 0-9*#
|
||||||
|
/// </summary>
|
||||||
|
Dictionary<string, uint> DTMFMap = new Dictionary<string, uint>
|
||||||
|
{
|
||||||
|
{ "1", 201 },
|
||||||
|
{ "2", 202 },
|
||||||
|
{ "3", 203 },
|
||||||
|
{ "4", 204 },
|
||||||
|
{ "5", 205 },
|
||||||
|
{ "6", 206 },
|
||||||
|
{ "7", 207 },
|
||||||
|
{ "8", 208 },
|
||||||
|
{ "9", 209 },
|
||||||
|
{ "0", 210 },
|
||||||
|
{ "*", 211 },
|
||||||
|
{ "#", 212 },
|
||||||
|
};
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
CodecActiveCallItem CurrentCallItem;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="eisc"></param>
|
||||||
|
/// <param name="messagePath"></param>
|
||||||
|
public Ddvc01AtcMessenger(string key, BasicTriList eisc, string messagePath)
|
||||||
|
: base(key, messagePath)
|
||||||
|
{
|
||||||
|
EISC = eisc;
|
||||||
|
|
||||||
|
CurrentCallItem = new CodecActiveCallItem();
|
||||||
|
CurrentCallItem.Type = eCodecCallType.Audio;
|
||||||
|
CurrentCallItem.Id = "-audio-";
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
void SendFullStatus()
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
this.PostStatusMessage(new
|
||||||
|
{
|
||||||
|
calls = GetCurrentCallList(),
|
||||||
|
currentCallString = EISC.GetString(SCurrentCallNumber),
|
||||||
|
currentDialString = EISC.GetString(SCurrentDialString),
|
||||||
|
isInCall = EISC.GetString(SHookState) == "Connected"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="appServerController"></param>
|
||||||
|
protected override void CustomRegisterWithAppServer(CotijaSystemController appServerController)
|
||||||
|
{
|
||||||
|
//EISC.SetStringSigAction(SCurrentDialString, s => PostStatusMessage(new { currentDialString = s }));
|
||||||
|
|
||||||
|
EISC.SetStringSigAction(SHookState, s =>
|
||||||
|
{
|
||||||
|
CurrentCallItem.Status = (eCodecCallStatus)Enum.Parse(typeof(eCodecCallStatus), s, true);
|
||||||
|
//GetCurrentCallList();
|
||||||
|
SendFullStatus();
|
||||||
|
});
|
||||||
|
|
||||||
|
EISC.SetStringSigAction(SCurrentCallNumber, s =>
|
||||||
|
{
|
||||||
|
CurrentCallItem.Number = s;
|
||||||
|
SendCallsList();
|
||||||
|
});
|
||||||
|
|
||||||
|
EISC.SetStringSigAction(SCurrentCallName, s =>
|
||||||
|
{
|
||||||
|
CurrentCallItem.Name = s;
|
||||||
|
SendCallsList();
|
||||||
|
});
|
||||||
|
|
||||||
|
EISC.SetStringSigAction(SCallDirection, s =>
|
||||||
|
{
|
||||||
|
CurrentCallItem.Direction = (eCodecCallDirection)Enum.Parse(typeof(eCodecCallDirection), s, true);
|
||||||
|
SendCallsList();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Add press and holds using helper
|
||||||
|
Action<string, uint> addPHAction = (s, u) =>
|
||||||
|
AppServerController.AddAction(MessagePath + s, new PressAndHoldAction(b => EISC.SetBool(u, b)));
|
||||||
|
|
||||||
|
// Add straight pulse calls
|
||||||
|
Action<string, uint> addAction = (s, u) =>
|
||||||
|
AppServerController.AddAction(MessagePath + s, new Action(() => EISC.PulseBool(u, 100)));
|
||||||
|
addAction("/endCallById", BDialHangupOnHook);
|
||||||
|
addAction("/endAllCalls", BDialHangupOnHook);
|
||||||
|
addAction("/acceptById", BIncomingAnswer);
|
||||||
|
addAction("/rejectById", BIncomingReject);
|
||||||
|
addAction("/speedDial1", BSpeedDial1);
|
||||||
|
addAction("/speedDial2", BSpeedDial2);
|
||||||
|
addAction("/speedDial3", BSpeedDial3);
|
||||||
|
addAction("/speedDial4", BSpeedDial4);
|
||||||
|
|
||||||
|
// Get status
|
||||||
|
AppServerController.AddAction(MessagePath + "/fullStatus", new Action(SendFullStatus));
|
||||||
|
// Dial on string
|
||||||
|
AppServerController.AddAction(MessagePath + "/dial", new Action<string>(s => EISC.SetString(SCurrentDialString, s)));
|
||||||
|
// Pulse DTMF
|
||||||
|
AppServerController.AddAction(MessagePath + "/dtmf", new Action<string>(s =>
|
||||||
|
{
|
||||||
|
if (DTMFMap.ContainsKey(s))
|
||||||
|
{
|
||||||
|
EISC.PulseBool(DTMFMap[s], 100);
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
void SendCallsList()
|
||||||
|
{
|
||||||
|
PostStatusMessage(new
|
||||||
|
{
|
||||||
|
calls = GetCurrentCallList(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Turns the
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
List<CodecActiveCallItem> GetCurrentCallList()
|
||||||
|
{
|
||||||
|
if (CurrentCallItem.Status == eCodecCallStatus.Disconnected)
|
||||||
|
{
|
||||||
|
return new List<CodecActiveCallItem>();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return new List<CodecActiveCallItem>() { CurrentCallItem };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
623
PepperDashEssentials/AppServer/Messengers/Ddvc01VtcMessenger.cs
Normal file
623
PepperDashEssentials/AppServer/Messengers/Ddvc01VtcMessenger.cs
Normal file
@@ -0,0 +1,623 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
using Crestron.SimplSharpPro.EthernetCommunication;
|
||||||
|
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.Devices.Common.Codec;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.AppServer.Messengers
|
||||||
|
{
|
||||||
|
public class Ddvc01VtcMessenger : MessengerBase
|
||||||
|
{
|
||||||
|
BasicTriList EISC;
|
||||||
|
|
||||||
|
/********* Bools *********/
|
||||||
|
/// <summary>
|
||||||
|
/// 724
|
||||||
|
/// </summary>
|
||||||
|
const uint BDialHangup = 724;
|
||||||
|
/// <summary>
|
||||||
|
/// 750
|
||||||
|
/// </summary>
|
||||||
|
const uint BCallIncoming = 750;
|
||||||
|
/// <summary>
|
||||||
|
/// 751
|
||||||
|
/// </summary>
|
||||||
|
const uint BIncomingAnswer = 751;
|
||||||
|
/// <summary>
|
||||||
|
/// 752
|
||||||
|
/// </summary>
|
||||||
|
const uint BIncomingReject = 752;
|
||||||
|
/// <summary>
|
||||||
|
/// 741
|
||||||
|
/// </summary>
|
||||||
|
const uint BSpeedDial1 = 741;
|
||||||
|
/// <summary>
|
||||||
|
/// 742
|
||||||
|
/// </summary>
|
||||||
|
const uint BSpeedDial2 = 742;
|
||||||
|
/// <summary>
|
||||||
|
/// 743
|
||||||
|
/// </summary>
|
||||||
|
const uint BSpeedDial3 = 743;
|
||||||
|
/// <summary>
|
||||||
|
/// 744
|
||||||
|
/// </summary>
|
||||||
|
const uint BSpeedDial4 = 744;
|
||||||
|
/// <summary>
|
||||||
|
/// 800
|
||||||
|
/// </summary>
|
||||||
|
const uint BDirectorySearchBusy = 800;
|
||||||
|
/// <summary>
|
||||||
|
/// 801
|
||||||
|
/// </summary>
|
||||||
|
const uint BDirectoryLineSelected = 801;
|
||||||
|
/// <summary>
|
||||||
|
/// 801 when selected entry is a contact
|
||||||
|
/// </summary>
|
||||||
|
const uint BDirectoryEntryIsContact = 801;
|
||||||
|
/// <summary>
|
||||||
|
/// 802 To show/hide back button
|
||||||
|
/// </summary>
|
||||||
|
const uint BDirectoryIsRoot = 802;
|
||||||
|
/// <summary>
|
||||||
|
/// 803 Pulse from system to inform us when directory is ready
|
||||||
|
/// </summary>
|
||||||
|
const uint DDirectoryHasChanged = 803;
|
||||||
|
/// <summary>
|
||||||
|
/// 804
|
||||||
|
/// </summary>
|
||||||
|
const uint BDirectoryRoot = 804;
|
||||||
|
/// <summary>
|
||||||
|
/// 805
|
||||||
|
/// </summary>
|
||||||
|
const uint BDirectoryFolderBack = 805;
|
||||||
|
/// <summary>
|
||||||
|
/// 806
|
||||||
|
/// </summary>
|
||||||
|
const uint BDirectoryDialSelectedLine = 806;
|
||||||
|
/// <summary>
|
||||||
|
/// 811
|
||||||
|
/// </summary>
|
||||||
|
const uint BCameraControlUp = 811;
|
||||||
|
/// <summary>
|
||||||
|
/// 812
|
||||||
|
/// </summary>
|
||||||
|
const uint BCameraControlDown = 812;
|
||||||
|
/// <summary>
|
||||||
|
/// 813
|
||||||
|
/// </summary>
|
||||||
|
const uint BCameraControlLeft = 813;
|
||||||
|
/// <summary>
|
||||||
|
/// 814
|
||||||
|
/// </summary>
|
||||||
|
const uint BCameraControlRight = 814;
|
||||||
|
/// <summary>
|
||||||
|
/// 815
|
||||||
|
/// </summary>
|
||||||
|
const uint BCameraControlZoomIn = 815;
|
||||||
|
/// <summary>
|
||||||
|
/// 816
|
||||||
|
/// </summary>
|
||||||
|
const uint BCameraControlZoomOut = 816;
|
||||||
|
/// <summary>
|
||||||
|
/// 821 - 826
|
||||||
|
/// </summary>
|
||||||
|
const uint BCameraPresetStart = 821;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 831
|
||||||
|
/// </summary>
|
||||||
|
const uint BCameraModeAuto = 831;
|
||||||
|
/// <summary>
|
||||||
|
/// 832
|
||||||
|
/// </summary>
|
||||||
|
const uint BCameraModeManual = 832;
|
||||||
|
/// <summary>
|
||||||
|
/// 833
|
||||||
|
/// </summary>
|
||||||
|
const uint BCameraModeOff = 833;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 841
|
||||||
|
/// </summary>
|
||||||
|
const uint BCameraSelfView = 841;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 842
|
||||||
|
/// </summary>
|
||||||
|
const uint BCameraLayout = 842;
|
||||||
|
|
||||||
|
|
||||||
|
/********* Ushorts *********/
|
||||||
|
/// <summary>
|
||||||
|
/// 760
|
||||||
|
/// </summary>
|
||||||
|
const uint UCameraNumberSelect = 760;
|
||||||
|
/// <summary>
|
||||||
|
/// 801
|
||||||
|
/// </summary>
|
||||||
|
const uint UDirectorySelectRow = 801;
|
||||||
|
/// <summary>
|
||||||
|
/// 801
|
||||||
|
/// </summary>
|
||||||
|
const uint UDirectoryRowCount = 801;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/********* Strings *********/
|
||||||
|
/// <summary>
|
||||||
|
/// 701
|
||||||
|
/// </summary>
|
||||||
|
const uint SCurrentDialString = 701;
|
||||||
|
/// <summary>
|
||||||
|
/// 702
|
||||||
|
/// </summary>
|
||||||
|
const uint SCurrentCallName = 702;
|
||||||
|
/// <summary>
|
||||||
|
/// 703
|
||||||
|
/// </summary>
|
||||||
|
const uint SCurrentCallNumber = 703;
|
||||||
|
/// <summary>
|
||||||
|
/// 731
|
||||||
|
/// </summary>
|
||||||
|
const uint SHookState = 731;
|
||||||
|
/// <summary>
|
||||||
|
/// 722
|
||||||
|
/// </summary>
|
||||||
|
const uint SCallDirection = 722;
|
||||||
|
/// <summary>
|
||||||
|
/// 751
|
||||||
|
/// </summary>
|
||||||
|
const uint SIncomingCallName = 751;
|
||||||
|
/// <summary>
|
||||||
|
/// 752
|
||||||
|
/// </summary>
|
||||||
|
const uint SIncomingCallNumber = 752;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 800
|
||||||
|
/// </summary>
|
||||||
|
const uint SDirectorySearchString = 800;
|
||||||
|
/// <summary>
|
||||||
|
/// 801-1055
|
||||||
|
/// </summary>
|
||||||
|
const uint SDirectoryEntriesStart = 801;
|
||||||
|
/// <summary>
|
||||||
|
/// 1056
|
||||||
|
/// </summary>
|
||||||
|
const uint SDirectoryEntrySelectedName = 1056;
|
||||||
|
/// <summary>
|
||||||
|
/// 1057
|
||||||
|
/// </summary>
|
||||||
|
const uint SDirectoryEntrySelectedNumber = 1057;
|
||||||
|
/// <summary>
|
||||||
|
/// 1058
|
||||||
|
/// </summary>
|
||||||
|
const uint SDirectorySelectedFolderName = 1058;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 701-712 0-9*#
|
||||||
|
/// </summary>
|
||||||
|
Dictionary<string, uint> DTMFMap = new Dictionary<string, uint>
|
||||||
|
{
|
||||||
|
{ "1", 701 },
|
||||||
|
{ "2", 702 },
|
||||||
|
{ "3", 703 },
|
||||||
|
{ "4", 704 },
|
||||||
|
{ "5", 705 },
|
||||||
|
{ "6", 706 },
|
||||||
|
{ "7", 707 },
|
||||||
|
{ "8", 708 },
|
||||||
|
{ "9", 709 },
|
||||||
|
{ "0", 710 },
|
||||||
|
{ "*", 711 },
|
||||||
|
{ "#", 712 },
|
||||||
|
};
|
||||||
|
|
||||||
|
CodecActiveCallItem CurrentCallItem;
|
||||||
|
CodecActiveCallItem IncomingCallItem;
|
||||||
|
|
||||||
|
ushort PreviousDirectoryLength = 0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="eisc"></param>
|
||||||
|
/// <param name="messagePath"></param>
|
||||||
|
public Ddvc01VtcMessenger(string key, BasicTriList eisc, string messagePath)
|
||||||
|
: base(key, messagePath)
|
||||||
|
{
|
||||||
|
EISC = eisc;
|
||||||
|
|
||||||
|
CurrentCallItem = new CodecActiveCallItem();
|
||||||
|
CurrentCallItem.Type = eCodecCallType.Video;
|
||||||
|
CurrentCallItem.Id = "-video-";
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="appServerController"></param>
|
||||||
|
protected override void CustomRegisterWithAppServer(CotijaSystemController appServerController)
|
||||||
|
{
|
||||||
|
var asc = appServerController;
|
||||||
|
EISC.SetStringSigAction(SHookState, s =>
|
||||||
|
{
|
||||||
|
CurrentCallItem.Status = (eCodecCallStatus)Enum.Parse(typeof(eCodecCallStatus), s, true);
|
||||||
|
PostFullStatus(); // SendCallsList();
|
||||||
|
});
|
||||||
|
|
||||||
|
EISC.SetStringSigAction(SCurrentCallNumber, s =>
|
||||||
|
{
|
||||||
|
CurrentCallItem.Number = s;
|
||||||
|
PostCallsList();
|
||||||
|
});
|
||||||
|
|
||||||
|
EISC.SetStringSigAction(SCurrentCallName, s =>
|
||||||
|
{
|
||||||
|
CurrentCallItem.Name = s;
|
||||||
|
PostCallsList();
|
||||||
|
});
|
||||||
|
|
||||||
|
EISC.SetStringSigAction(SCallDirection, s =>
|
||||||
|
{
|
||||||
|
CurrentCallItem.Direction = (eCodecCallDirection)Enum.Parse(typeof(eCodecCallDirection), s, true);
|
||||||
|
PostCallsList();
|
||||||
|
});
|
||||||
|
|
||||||
|
EISC.SetBoolSigAction(BCallIncoming, b =>
|
||||||
|
{
|
||||||
|
if (b)
|
||||||
|
{
|
||||||
|
var ica = new CodecActiveCallItem()
|
||||||
|
{
|
||||||
|
Direction = eCodecCallDirection.Incoming,
|
||||||
|
Id = "-video-incoming",
|
||||||
|
Name = EISC.GetString(SIncomingCallName),
|
||||||
|
Number = EISC.GetString(SIncomingCallNumber),
|
||||||
|
Status = eCodecCallStatus.Ringing,
|
||||||
|
Type = eCodecCallType.Video
|
||||||
|
};
|
||||||
|
IncomingCallItem = ica;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IncomingCallItem = null;
|
||||||
|
}
|
||||||
|
PostCallsList();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Directory insanity
|
||||||
|
EISC.SetUShortSigAction(UDirectoryRowCount, u =>
|
||||||
|
{
|
||||||
|
// The length of the list comes in before the list does.
|
||||||
|
// Splice the sig change operation onto the last string sig that will be changing
|
||||||
|
// when the directory entries make it through.
|
||||||
|
if (PreviousDirectoryLength > 0)
|
||||||
|
{
|
||||||
|
EISC.ClearStringSigAction(SDirectoryEntriesStart + PreviousDirectoryLength - 1);
|
||||||
|
}
|
||||||
|
EISC.SetStringSigAction(SDirectoryEntriesStart + u - 1, s => PostDirectory());
|
||||||
|
PreviousDirectoryLength = u;
|
||||||
|
});
|
||||||
|
|
||||||
|
EISC.SetStringSigAction(SDirectoryEntrySelectedName, s =>
|
||||||
|
{
|
||||||
|
PostStatusMessage(new
|
||||||
|
{
|
||||||
|
directoryContactSelected = new
|
||||||
|
{
|
||||||
|
name = EISC.GetString(SDirectoryEntrySelectedName),
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
EISC.SetStringSigAction(SDirectoryEntrySelectedNumber, s =>
|
||||||
|
{
|
||||||
|
PostStatusMessage(new
|
||||||
|
{
|
||||||
|
directoryContactSelected = new
|
||||||
|
{
|
||||||
|
number = EISC.GetString(SDirectoryEntrySelectedNumber),
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
EISC.SetStringSigAction(SDirectorySelectedFolderName, s => PostStatusMessage(new
|
||||||
|
{
|
||||||
|
directorySelectedFolderName = EISC.GetString(SDirectorySelectedFolderName)
|
||||||
|
}));
|
||||||
|
|
||||||
|
EISC.SetSigTrueAction(BCameraModeAuto, () => PostCameraMode());
|
||||||
|
EISC.SetSigTrueAction(BCameraModeManual, () => PostCameraMode());
|
||||||
|
EISC.SetSigTrueAction(BCameraModeOff, () => PostCameraMode());
|
||||||
|
|
||||||
|
EISC.SetBoolSigAction(BCameraSelfView, b => PostStatusMessage(new
|
||||||
|
{
|
||||||
|
cameraSelfView = b
|
||||||
|
}));
|
||||||
|
|
||||||
|
EISC.SetUShortSigAction(UCameraNumberSelect, (u) => PostSelectedCamera());
|
||||||
|
|
||||||
|
|
||||||
|
// Add press and holds using helper action
|
||||||
|
Action<string, uint> addPHAction = (s, u) =>
|
||||||
|
AppServerController.AddAction(MessagePath + s, new PressAndHoldAction(b => EISC.SetBool(u, b)));
|
||||||
|
addPHAction("/cameraUp", BCameraControlUp);
|
||||||
|
addPHAction("/cameraDown", BCameraControlDown);
|
||||||
|
addPHAction("/cameraLeft", BCameraControlLeft);
|
||||||
|
addPHAction("/cameraRight", BCameraControlRight);
|
||||||
|
addPHAction("/cameraZoomIn", BCameraControlZoomIn);
|
||||||
|
addPHAction("/cameraZoomOut", BCameraControlZoomOut);
|
||||||
|
|
||||||
|
// Add straight pulse calls using helper action
|
||||||
|
Action<string, uint> addAction = (s, u) =>
|
||||||
|
AppServerController.AddAction(MessagePath + s, new Action(() => EISC.PulseBool(u, 100)));
|
||||||
|
addAction("/endCallById", BDialHangup);
|
||||||
|
addAction("/endAllCalls", BDialHangup);
|
||||||
|
addAction("/acceptById", BIncomingAnswer);
|
||||||
|
addAction("/rejectById", BIncomingReject);
|
||||||
|
addAction("/speedDial1", BSpeedDial1);
|
||||||
|
addAction("/speedDial2", BSpeedDial2);
|
||||||
|
addAction("/speedDial3", BSpeedDial3);
|
||||||
|
addAction("/speedDial4", BSpeedDial4);
|
||||||
|
addAction("/cameraModeAuto", BCameraModeAuto);
|
||||||
|
addAction("/cameraModeManual", BCameraModeManual);
|
||||||
|
addAction("/cameraModeOff", BCameraModeOff);
|
||||||
|
addAction("/cameraSelfView", BCameraSelfView);
|
||||||
|
addAction("/cameraLayout", BCameraLayout);
|
||||||
|
|
||||||
|
asc.AddAction("/cameraSelect", new Action<string>(SelectCamera));
|
||||||
|
|
||||||
|
// camera presets
|
||||||
|
for(uint i = 0; i < 6; i++)
|
||||||
|
{
|
||||||
|
addAction("/cameraPreset" + (i + 1), BCameraPresetStart + i);
|
||||||
|
}
|
||||||
|
|
||||||
|
asc.AddAction(MessagePath + "/isReady", new Action(PostIsReady));
|
||||||
|
// Get status
|
||||||
|
asc.AddAction(MessagePath + "/fullStatus", new Action(PostFullStatus));
|
||||||
|
// Dial on string
|
||||||
|
asc.AddAction(MessagePath + "/dial", new Action<string>(s =>
|
||||||
|
EISC.SetString(SCurrentDialString, s)));
|
||||||
|
// Pulse DTMF
|
||||||
|
asc.AddAction(MessagePath + "/dtmf", new Action<string>(s =>
|
||||||
|
{
|
||||||
|
if (DTMFMap.ContainsKey(s))
|
||||||
|
{
|
||||||
|
EISC.PulseBool(DTMFMap[s], 100);
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
// Directory madness
|
||||||
|
asc.AddAction(MessagePath + "/directoryRoot", new Action(() => EISC.PulseBool(BDirectoryRoot)));
|
||||||
|
asc.AddAction(MessagePath + "/directoryBack", new Action(() => EISC.PulseBool(BDirectoryFolderBack)));
|
||||||
|
asc.AddAction(MessagePath + "/directoryById", new Action<string>(s =>
|
||||||
|
{
|
||||||
|
// the id should contain the line number to forward to simpl
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var u = ushort.Parse(s);
|
||||||
|
EISC.SetUshort(UDirectorySelectRow, u);
|
||||||
|
EISC.PulseBool(BDirectoryLineSelected);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
Debug.Console(1, this, Debug.ErrorLogLevel.Warning,
|
||||||
|
"/directoryById request contains non-numeric ID incompatible with DDVC bridge");
|
||||||
|
}
|
||||||
|
|
||||||
|
}));
|
||||||
|
asc.AddAction(MessagePath + "/directorySelectContact", new Action<string>(s =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var u = ushort.Parse(s);
|
||||||
|
EISC.SetUshort(UDirectorySelectRow, u);
|
||||||
|
EISC.PulseBool(BDirectoryLineSelected);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
asc.AddAction(MessagePath + "/directoryDialContact", new Action(() => {
|
||||||
|
EISC.PulseBool(BDirectoryDialSelectedLine);
|
||||||
|
}));
|
||||||
|
asc.AddAction(MessagePath + "/getDirectory", new Action(() =>
|
||||||
|
{
|
||||||
|
if (EISC.GetUshort(UDirectoryRowCount) > 0)
|
||||||
|
{
|
||||||
|
PostDirectory();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
EISC.PulseBool(BDirectoryRoot);
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
void PostFullStatus()
|
||||||
|
{
|
||||||
|
this.PostStatusMessage(new
|
||||||
|
{
|
||||||
|
calls = GetCurrentCallList(),
|
||||||
|
cameraMode = GetCameraMode(),
|
||||||
|
cameraSelfView = EISC.GetBool(BCameraSelfView),
|
||||||
|
currentCallString = EISC.GetString(SCurrentCallNumber),
|
||||||
|
currentDialString = EISC.GetString(SCurrentDialString),
|
||||||
|
directoryContactSelected = new
|
||||||
|
{
|
||||||
|
name = EISC.GetString(SDirectoryEntrySelectedName),
|
||||||
|
number = EISC.GetString(SDirectoryEntrySelectedNumber)
|
||||||
|
},
|
||||||
|
directorySelectedFolderName = EISC.GetString(SDirectorySelectedFolderName),
|
||||||
|
isInCall = EISC.GetString(SHookState) == "Connected",
|
||||||
|
hasDirectory = true,
|
||||||
|
hasDirectorySearch = false,
|
||||||
|
hasRecents = !EISC.BooleanOutput[502].BoolValue,
|
||||||
|
hasCameras = true,
|
||||||
|
showCamerasWhenNotInCall = EISC.BooleanOutput[503].BoolValue,
|
||||||
|
selectedCamera = GetSelectedCamera(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
void PostDirectory()
|
||||||
|
{
|
||||||
|
var u = EISC.GetUshort(UDirectoryRowCount);
|
||||||
|
var items = new List<object>();
|
||||||
|
for (uint i = 0; i < u; i++)
|
||||||
|
{
|
||||||
|
var name = EISC.GetString(SDirectoryEntriesStart + i);
|
||||||
|
var id = (i + 1).ToString();
|
||||||
|
// is folder or contact?
|
||||||
|
if (name.StartsWith("[+]"))
|
||||||
|
{
|
||||||
|
items.Add(new
|
||||||
|
{
|
||||||
|
folderId = id,
|
||||||
|
name = name
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
items.Add(new
|
||||||
|
{
|
||||||
|
contactId = id,
|
||||||
|
name = name
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var directoryMessage = new
|
||||||
|
{
|
||||||
|
currentDirectory = new
|
||||||
|
{
|
||||||
|
isRootDirectory = EISC.GetBool(BDirectoryIsRoot),
|
||||||
|
directoryResults = items
|
||||||
|
}
|
||||||
|
};
|
||||||
|
PostStatusMessage(directoryMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
void PostCameraMode()
|
||||||
|
{
|
||||||
|
PostStatusMessage(new
|
||||||
|
{
|
||||||
|
cameraMode = GetCameraMode()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="mode"></param>
|
||||||
|
string GetCameraMode()
|
||||||
|
{
|
||||||
|
string m;
|
||||||
|
if (EISC.GetBool(BCameraModeAuto)) m = "auto";
|
||||||
|
else if (EISC.GetBool(BCameraModeManual)) m = "manual";
|
||||||
|
else m = "off";
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PostSelectedCamera()
|
||||||
|
{
|
||||||
|
PostStatusMessage(new
|
||||||
|
{
|
||||||
|
selectedCamera = GetSelectedCamera()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
string GetSelectedCamera()
|
||||||
|
{
|
||||||
|
var num = EISC.GetUshort(UCameraNumberSelect);
|
||||||
|
string m;
|
||||||
|
if (num == 100)
|
||||||
|
{
|
||||||
|
m = "cameraFar";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m = "camera" + num;
|
||||||
|
}
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
void PostIsReady()
|
||||||
|
{
|
||||||
|
PostStatusMessage(new
|
||||||
|
{
|
||||||
|
isReady = true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
void PostCallsList()
|
||||||
|
{
|
||||||
|
PostStatusMessage(new
|
||||||
|
{
|
||||||
|
calls = GetCurrentCallList(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="s"></param>
|
||||||
|
void SelectCamera(string s)
|
||||||
|
{
|
||||||
|
var cam = s.Substring(6);
|
||||||
|
if (cam.ToLower() == "far")
|
||||||
|
{
|
||||||
|
EISC.SetUshort(UCameraNumberSelect, 100);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
EISC.SetUshort(UCameraNumberSelect, UInt16.Parse(cam));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Turns the
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
List<CodecActiveCallItem> GetCurrentCallList()
|
||||||
|
{
|
||||||
|
var list = new List<CodecActiveCallItem>();
|
||||||
|
if (CurrentCallItem.Status != eCodecCallStatus.Disconnected)
|
||||||
|
{
|
||||||
|
list.Add(CurrentCallItem);
|
||||||
|
}
|
||||||
|
if (EISC.GetBool(BCallIncoming)) {
|
||||||
|
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
81
PepperDashEssentials/AppServer/Messengers/MessengerBase.cs
Normal file
81
PepperDashEssentials/AppServer/Messengers/MessengerBase.cs
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
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.Devices.Common.Codec;
|
||||||
|
using PepperDash.Essentials.Devices.Common.VideoCodec;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.AppServer.Messengers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Provides a messaging bridge for a VideoCodecBase
|
||||||
|
/// </summary>
|
||||||
|
public abstract class MessengerBase : IKeyed
|
||||||
|
{
|
||||||
|
public string Key { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public CotijaSystemController AppServerController { get; private set; }
|
||||||
|
|
||||||
|
public string MessagePath { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="codec"></param>
|
||||||
|
public MessengerBase(string key, string messagePath)
|
||||||
|
{
|
||||||
|
Key = key;
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(messagePath))
|
||||||
|
throw new ArgumentException("messagePath must not be empty or null");
|
||||||
|
|
||||||
|
MessagePath = messagePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Registers this messenger with appserver controller
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="appServerController"></param>
|
||||||
|
public void RegisterWithAppServer(CotijaSystemController appServerController)
|
||||||
|
{
|
||||||
|
if (appServerController == null)
|
||||||
|
throw new ArgumentNullException("appServerController");
|
||||||
|
|
||||||
|
AppServerController = appServerController;
|
||||||
|
CustomRegisterWithAppServer(AppServerController);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Implemented in extending classes. Wire up API calls and feedback here
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="appServerController"></param>
|
||||||
|
abstract protected void CustomRegisterWithAppServer(CotijaSystemController appServerController);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Helper for posting status message
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="contentObject">The contents of the content object</param>
|
||||||
|
protected void PostStatusMessage(object contentObject)
|
||||||
|
{
|
||||||
|
if (AppServerController != null)
|
||||||
|
{
|
||||||
|
AppServerController.SendMessageToServer(JObject.FromObject(new
|
||||||
|
{
|
||||||
|
type = MessagePath,
|
||||||
|
content = contentObject
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
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.Monitoring;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.AppServer.Messengers
|
||||||
|
{
|
||||||
|
public class SystemMonitorMessenger : MessengerBase
|
||||||
|
{
|
||||||
|
public SystemMonitorController SysMon { get; private set; }
|
||||||
|
|
||||||
|
public SystemMonitorMessenger(string key, SystemMonitorController sysMon, string messagePath)
|
||||||
|
: base(key, messagePath)
|
||||||
|
{
|
||||||
|
if (sysMon == null)
|
||||||
|
throw new ArgumentNullException("sysMon");
|
||||||
|
|
||||||
|
SysMon = sysMon;
|
||||||
|
|
||||||
|
SysMon.SystemMonitorPropertiesChanged += new EventHandler<EventArgs>(SysMon_SystemMonitorPropertiesChanged);
|
||||||
|
|
||||||
|
foreach (var p in SysMon.ProgramStatusFeedbackCollection)
|
||||||
|
{
|
||||||
|
p.Value.ProgramInfoChanged += new EventHandler<ProgramInfoEventArgs>(ProgramInfoChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
CrestronConsole.AddNewConsoleCommand(s => SendFullStatusMessage(), "SendFullSysMonStatus", "Sends the full System Monitor Status", ConsoleAccessLevelEnum.AccessOperator);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Posts the program information message
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
void ProgramInfoChanged(object sender, ProgramInfoEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.ProgramInfo != null)
|
||||||
|
{
|
||||||
|
//Debug.Console(1, "Posting Status Message: {0}", e.ProgramInfo.ToString());
|
||||||
|
PostStatusMessage(e.ProgramInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Posts the system monitor properties
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
void SysMon_SystemMonitorPropertiesChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
SendSystemMonitorStatusMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SendFullStatusMessage()
|
||||||
|
{
|
||||||
|
SendSystemMonitorStatusMessage();
|
||||||
|
|
||||||
|
foreach (var p in SysMon.ProgramStatusFeedbackCollection)
|
||||||
|
{
|
||||||
|
PostStatusMessage(p.Value.ProgramInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SendSystemMonitorStatusMessage()
|
||||||
|
{
|
||||||
|
Debug.Console(1, "Posting System Monitor Status Message.");
|
||||||
|
|
||||||
|
// This takes a while, launch a new thread
|
||||||
|
CrestronInvoke.BeginInvoke((o) =>
|
||||||
|
{
|
||||||
|
PostStatusMessage(new
|
||||||
|
{
|
||||||
|
timeZone = SysMon.TimeZoneFeedback.IntValue,
|
||||||
|
timeZoneName = SysMon.TimeZoneTextFeedback.StringValue,
|
||||||
|
ioControllerVersion = SysMon.IOControllerVersionFeedback.StringValue,
|
||||||
|
snmpVersion = SysMon.SnmpVersionFeedback.StringValue,
|
||||||
|
bacnetVersion = SysMon.BACnetAppVersionFeedback.StringValue,
|
||||||
|
controllerVersion = SysMon.ControllerVersionFeedback.StringValue
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void CustomRegisterWithAppServer(CotijaSystemController appServerController)
|
||||||
|
{
|
||||||
|
AppServerController.AddAction(MessagePath + "/fullStatus", new Action(SendFullStatusMessage));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,36 +8,31 @@ using Newtonsoft.Json;
|
|||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
using PepperDash.Essentials.Devices.Common.Codec;
|
using PepperDash.Essentials.Devices.Common.Codec;
|
||||||
|
using PepperDash.Essentials.Devices.Common.Cameras;
|
||||||
using PepperDash.Essentials.Devices.Common.VideoCodec;
|
using PepperDash.Essentials.Devices.Common.VideoCodec;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.AppServer.Messengers
|
namespace PepperDash.Essentials.AppServer.Messengers
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Provides a messaging bridge for a VideoCodecBase
|
/// Provides a messaging bridge for a VideoCodecBase device
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class VideoCodecBaseMessenger
|
public class VideoCodecBaseMessenger : MessengerBase
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public VideoCodecBase Codec { get; private set; }
|
public VideoCodecBase Codec { get; private set; }
|
||||||
|
|
||||||
public CotijaSystemController AppServerController { get; private set; }
|
|
||||||
|
|
||||||
public string MessagePath { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="codec"></param>
|
/// <param name="codec"></param>
|
||||||
public VideoCodecBaseMessenger(VideoCodecBase codec, string messagePath)
|
public VideoCodecBaseMessenger(string key, VideoCodecBase codec, string messagePath)
|
||||||
|
: base(key, messagePath)
|
||||||
{
|
{
|
||||||
if (codec == null)
|
if (codec == null)
|
||||||
throw new ArgumentNullException("codec");
|
throw new ArgumentNullException("codec");
|
||||||
if (string.IsNullOrEmpty(messagePath))
|
|
||||||
throw new ArgumentException("messagePath must not be empty or null");
|
|
||||||
|
|
||||||
MessagePath = messagePath;
|
|
||||||
Codec = codec;
|
Codec = codec;
|
||||||
codec.CallStatusChange += new EventHandler<CodecCallStatusItemChangeEventArgs>(codec_CallStatusChange);
|
codec.CallStatusChange += new EventHandler<CodecCallStatusItemChangeEventArgs>(codec_CallStatusChange);
|
||||||
codec.IsReadyChange += new EventHandler<EventArgs>(codec_IsReadyChange);
|
codec.IsReadyChange += new EventHandler<EventArgs>(codec_IsReadyChange);
|
||||||
@@ -46,8 +41,33 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
if (dirCodec != null)
|
if (dirCodec != null)
|
||||||
{
|
{
|
||||||
dirCodec.DirectoryResultReturned += new EventHandler<DirectoryEventArgs>(dirCodec_DirectoryResultReturned);
|
dirCodec.DirectoryResultReturned += new EventHandler<DirectoryEventArgs>(dirCodec_DirectoryResultReturned);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var recCodec = codec as IHasCallHistory;
|
||||||
|
if (recCodec != null)
|
||||||
|
{
|
||||||
|
recCodec.CallHistory.RecentCallsListHasChanged += new EventHandler<EventArgs>(CallHistory_RecentCallsListHasChanged);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
void CallHistory_RecentCallsListHasChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var recents = (sender as CodecCallHistory).RecentCalls;
|
||||||
|
|
||||||
|
if (recents != null)
|
||||||
|
{
|
||||||
|
PostStatusMessage(new
|
||||||
|
{
|
||||||
|
recentCalls = recents
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
@@ -56,13 +76,73 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
void dirCodec_DirectoryResultReturned(object sender, DirectoryEventArgs e)
|
void dirCodec_DirectoryResultReturned(object sender, DirectoryEventArgs e)
|
||||||
{
|
{
|
||||||
var dir = e.Directory;
|
SendDirectory((Codec as IHasDirectory).CurrentDirectoryResult, e.DirectoryIsOnRoot);
|
||||||
PostStatusMessage(new
|
|
||||||
{
|
|
||||||
currentDirectory = e.Directory
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Posts the current directory
|
||||||
|
/// </summary>
|
||||||
|
void SendDirectory(CodecDirectory directory, bool isRoot)
|
||||||
|
{
|
||||||
|
var dirCodec = Codec as IHasDirectory;
|
||||||
|
|
||||||
|
if (dirCodec != null)
|
||||||
|
{
|
||||||
|
var prefixedDirectoryResults = PrefixDirectoryFolderItems(directory);
|
||||||
|
|
||||||
|
var directoryMessage = new
|
||||||
|
{
|
||||||
|
currentDirectory = new
|
||||||
|
{
|
||||||
|
directoryResults = prefixedDirectoryResults,
|
||||||
|
isRootDirectory = isRoot
|
||||||
|
}
|
||||||
|
};
|
||||||
|
PostStatusMessage(directoryMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Iterates a directory object and prefixes any folder items with "[+] "
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="directory"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
List<DirectoryItem> PrefixDirectoryFolderItems (CodecDirectory directory)
|
||||||
|
{
|
||||||
|
var tempDirectoryList = new List<DirectoryItem>();
|
||||||
|
|
||||||
|
if (directory.CurrentDirectoryResults.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (var item in directory.CurrentDirectoryResults)
|
||||||
|
{
|
||||||
|
if (item is DirectoryFolder)
|
||||||
|
{
|
||||||
|
var newFolder = new DirectoryFolder();
|
||||||
|
|
||||||
|
newFolder = (DirectoryFolder)item.Clone();
|
||||||
|
|
||||||
|
string prefixName = "[+] " + newFolder.Name;
|
||||||
|
|
||||||
|
newFolder.Name = prefixName;
|
||||||
|
|
||||||
|
tempDirectoryList.Add(newFolder);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tempDirectoryList.Add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//else
|
||||||
|
//{
|
||||||
|
// DirectoryItem noResults = new DirectoryItem() { Name = "No Results Found" };
|
||||||
|
|
||||||
|
// tempDirectoryList.Add(noResults);
|
||||||
|
//}
|
||||||
|
|
||||||
|
return tempDirectoryList;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -77,16 +157,11 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Registers this codec's messaging with an app server controller
|
/// Called from base's RegisterWithAppServer method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="appServerController"></param>
|
/// <param name="appServerController"></param>
|
||||||
public void RegisterWithAppServer(CotijaSystemController appServerController)
|
protected override void CustomRegisterWithAppServer(CotijaSystemController appServerController)
|
||||||
{
|
{
|
||||||
if (appServerController == null)
|
|
||||||
throw new ArgumentNullException("appServerController");
|
|
||||||
|
|
||||||
AppServerController = appServerController;
|
|
||||||
|
|
||||||
appServerController.AddAction("/device/videoCodec/isReady", new Action(SendIsReady));
|
appServerController.AddAction("/device/videoCodec/isReady", new Action(SendIsReady));
|
||||||
appServerController.AddAction("/device/videoCodec/fullStatus", new Action(SendVtcFullMessageObject));
|
appServerController.AddAction("/device/videoCodec/fullStatus", new Action(SendVtcFullMessageObject));
|
||||||
appServerController.AddAction("/device/videoCodec/dial", new Action<string>(s => Codec.Dial(s)));
|
appServerController.AddAction("/device/videoCodec/dial", new Action<string>(s => Codec.Dial(s)));
|
||||||
@@ -110,9 +185,24 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
if (call != null)
|
if (call != null)
|
||||||
Codec.AcceptCall(call);
|
Codec.AcceptCall(call);
|
||||||
}));
|
}));
|
||||||
appServerController.AddAction(MessagePath + "/directoryRoot", new Action(GetDirectoryRoot));
|
|
||||||
appServerController.AddAction(MessagePath + "/directoryById", new Action<string>(s => GetDirectory(s)));
|
// Directory actions
|
||||||
appServerController.AddAction(MessagePath + "/directorySearch", new Action<string>(s => DirectorySearch(s)));
|
var dirCodec = Codec as IHasDirectory;
|
||||||
|
if (dirCodec != null)
|
||||||
|
{
|
||||||
|
appServerController.AddAction(MessagePath + "/getDirectory", new Action(GetDirectoryRoot));
|
||||||
|
appServerController.AddAction(MessagePath + "/directoryById", new Action<string>(s => GetDirectory(s)));
|
||||||
|
appServerController.AddAction(MessagePath + "/directorySearch", new Action<string>(s => DirectorySearch(s)));
|
||||||
|
appServerController.AddAction(MessagePath + "/directoryBack", new Action(GetPreviousDirectory));
|
||||||
|
}
|
||||||
|
|
||||||
|
// History actions
|
||||||
|
var recCodec = Codec as IHasCallHistory;
|
||||||
|
if (recCodec != null)
|
||||||
|
{
|
||||||
|
appServerController.AddAction(MessagePath + "/getCallHistory", new Action(GetCallHistory));
|
||||||
|
}
|
||||||
|
|
||||||
appServerController.AddAction(MessagePath + "/privacyModeOn", new Action(Codec.PrivacyModeOn));
|
appServerController.AddAction(MessagePath + "/privacyModeOn", new Action(Codec.PrivacyModeOn));
|
||||||
appServerController.AddAction(MessagePath + "/privacyModeOff", new Action(Codec.PrivacyModeOff));
|
appServerController.AddAction(MessagePath + "/privacyModeOff", new Action(Codec.PrivacyModeOff));
|
||||||
appServerController.AddAction(MessagePath + "/privacyModeToggle", new Action(Codec.PrivacyModeToggle));
|
appServerController.AddAction(MessagePath + "/privacyModeToggle", new Action(Codec.PrivacyModeToggle));
|
||||||
@@ -122,6 +212,24 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
appServerController.AddAction(MessagePath + "/standbyOff", new Action(Codec.StandbyDeactivate));
|
appServerController.AddAction(MessagePath + "/standbyOff", new Action(Codec.StandbyDeactivate));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GetCallHistory()
|
||||||
|
{
|
||||||
|
var codec = (Codec as IHasCallHistory);
|
||||||
|
|
||||||
|
if (codec != null)
|
||||||
|
{
|
||||||
|
var recents = codec.CallHistory.RecentCalls;
|
||||||
|
|
||||||
|
if (recents != null)
|
||||||
|
{
|
||||||
|
PostStatusMessage(new
|
||||||
|
{
|
||||||
|
recentCalls = recents
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void GetFullStatusMessage()
|
public void GetFullStatusMessage()
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -184,12 +292,28 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PostStatusMessage(new
|
dirCodec.SetCurrentDirectoryToRoot();
|
||||||
{
|
|
||||||
currentDirectory = dirCodec.DirectoryRoot
|
//PostStatusMessage(new
|
||||||
});
|
//{
|
||||||
|
// currentDirectory = dirCodec.DirectoryRoot
|
||||||
|
//});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Requests the parent folder contents
|
||||||
|
/// </summary>
|
||||||
|
void GetPreviousDirectory()
|
||||||
|
{
|
||||||
|
var dirCodec = Codec as IHasDirectory;
|
||||||
|
if (dirCodec == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
dirCodec.GetDirectoryParentFolderContents();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handler for codec changes
|
/// Handler for codec changes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -239,21 +363,11 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
sipURI = info.SipUri
|
sipURI = info.SipUri
|
||||||
},
|
},
|
||||||
showSelfViewByDefault = Codec.ShowSelfViewByDefault,
|
showSelfViewByDefault = Codec.ShowSelfViewByDefault,
|
||||||
hasDirectory = Codec is IHasDirectory
|
hasDirectory = Codec is IHasDirectory,
|
||||||
|
hasDirectorySearch = true,
|
||||||
|
hasRecents = Codec is IHasCallHistory,
|
||||||
|
hasCameras = Codec is IHasCodecCameras
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Helper for posting status message
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="contentObject">The contents of the content object</param>
|
|
||||||
void PostStatusMessage(object contentObject)
|
|
||||||
{
|
|
||||||
AppServerController.SendMessageToServer(JObject.FromObject(new
|
|
||||||
{
|
|
||||||
type = MessagePath,
|
|
||||||
content = contentObject
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -10,6 +10,7 @@ using Newtonsoft.Json;
|
|||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.AppServer.Messengers;
|
||||||
using PepperDash.Essentials.Core;
|
using PepperDash.Essentials.Core;
|
||||||
using PepperDash.Essentials.Core.Config;
|
using PepperDash.Essentials.Core.Config;
|
||||||
using PepperDash.Essentials.Room.Config;
|
using PepperDash.Essentials.Room.Config;
|
||||||
@@ -26,18 +27,31 @@ namespace PepperDash.Essentials.Room.Cotija
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public const uint RoomIsOn = 301;
|
public const uint RoomIsOn = 301;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 12
|
||||||
|
/// </summary>
|
||||||
|
public const uint PrivacyMute = 12;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 41
|
||||||
|
/// </summary>
|
||||||
|
public const uint PromptForCode = 41;
|
||||||
|
/// <summary>
|
||||||
|
/// 42
|
||||||
|
/// </summary>
|
||||||
|
public const uint ClientJoined = 42;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 51
|
/// 51
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const uint ActivitySharePress = 51;
|
public const uint ActivityShare = 51;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 52
|
/// 52
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const uint ActivityPhoneCallPress = 52;
|
public const uint ActivityPhoneCall = 52;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 53
|
/// 53
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const uint ActivityVideoCallPress = 53;
|
public const uint ActivityVideoCall = 53;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 1
|
/// 1
|
||||||
@@ -47,7 +61,10 @@ namespace PepperDash.Essentials.Room.Cotija
|
|||||||
/// 1
|
/// 1
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const uint MasterVolumeMuteToggle = 1;
|
public const uint MasterVolumeMuteToggle = 1;
|
||||||
|
/// <summary>
|
||||||
|
/// 1
|
||||||
|
/// </summary>
|
||||||
|
public const uint VolumeMutesJoinStart = 1;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 61
|
/// 61
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -60,17 +77,31 @@ namespace PepperDash.Essentials.Room.Cotija
|
|||||||
/// 63
|
/// 63
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const uint ShutdownStart = 63;
|
public const uint ShutdownStart = 63;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 72
|
/// 72
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const uint SourceHasChanged = 72;
|
public const uint SourceHasChanged = 71;
|
||||||
|
/// <summary>
|
||||||
|
/// 261 - The start of the range of speed dial visibles
|
||||||
|
/// </summary>
|
||||||
|
public const uint SpeedDialVisibleStartJoin = 261;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 501
|
/// 501
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const uint ConfigIsReady = 501;
|
public const uint ConfigIsReady = 501;
|
||||||
|
/// <summary>
|
||||||
|
/// 502
|
||||||
|
/// </summary>
|
||||||
|
public const uint HideVideoConfRecents = 502;
|
||||||
|
/// <summary>
|
||||||
|
/// 503
|
||||||
|
/// </summary>
|
||||||
|
public const uint ShowCameraWhenNotInCall = 503;
|
||||||
|
/// <summary>
|
||||||
|
/// 601
|
||||||
|
/// </summary>
|
||||||
|
public const uint SourceShareDisableStartJoin = 601;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class UshortJoin
|
public class UshortJoin
|
||||||
@@ -79,19 +110,40 @@ namespace PepperDash.Essentials.Room.Cotija
|
|||||||
/// 1
|
/// 1
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const uint MasterVolumeLevel = 1;
|
public const uint MasterVolumeLevel = 1;
|
||||||
|
/// <summary>
|
||||||
|
/// 1
|
||||||
|
/// </summary>
|
||||||
|
public const uint VolumeSlidersJoinStart = 1;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 61
|
/// 61
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const uint ShutdownPromptDuration = 61;
|
public const uint ShutdownPromptDuration = 61;
|
||||||
|
/// <summary>
|
||||||
|
/// 101
|
||||||
|
/// </summary>
|
||||||
|
public const uint VolumeSliderCount = 101;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class StringJoin
|
public class StringJoin
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 1
|
||||||
|
/// </summary>
|
||||||
|
public const uint VolumeSliderNamesJoinStart = 1;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 71
|
/// 71
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const uint SelectedSourceKey = 71;
|
public const uint SelectedSourceKey = 71;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 241
|
||||||
|
/// </summary>
|
||||||
|
public const uint SpeedDialNameStartJoin = 241;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 251
|
||||||
|
/// </summary>
|
||||||
|
public const uint SpeedDialNumberStartJoin = 251;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 501
|
/// 501
|
||||||
@@ -121,6 +173,38 @@ namespace PepperDash.Essentials.Room.Cotija
|
|||||||
/// 402
|
/// 402
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const uint ServerUrl = 402;
|
public const uint ServerUrl = 402;
|
||||||
|
/// <summary>
|
||||||
|
/// 512
|
||||||
|
/// </summary>
|
||||||
|
public const uint RoomSpeedDialNamesJoinStart = 512;
|
||||||
|
/// <summary>
|
||||||
|
/// 516
|
||||||
|
/// </summary>
|
||||||
|
public const uint RoomSpeedDialNumberssJoinStart = 516;
|
||||||
|
/// <summary>
|
||||||
|
/// 601
|
||||||
|
/// </summary>
|
||||||
|
public const uint SourceNameJoinStart = 601;
|
||||||
|
/// <summary>
|
||||||
|
/// 621
|
||||||
|
/// </summary>
|
||||||
|
public const uint SourceIconJoinStart = 621;
|
||||||
|
/// <summary>
|
||||||
|
/// 641
|
||||||
|
/// </summary>
|
||||||
|
public const uint SourceKeyJoinStart = 641;
|
||||||
|
/// <summary>
|
||||||
|
/// 661
|
||||||
|
/// </summary>
|
||||||
|
public const uint SourceTypeJoinStart = 661;
|
||||||
|
/// <summary>
|
||||||
|
/// 761
|
||||||
|
/// </summary>
|
||||||
|
public const uint CameraNearNameStart = 761;
|
||||||
|
/// <summary>
|
||||||
|
/// 770 - presence of this name on the input will cause the camera to be added
|
||||||
|
/// </summary>
|
||||||
|
public const uint CameraFarName = 770;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -145,6 +229,9 @@ namespace PepperDash.Essentials.Room.Cotija
|
|||||||
|
|
||||||
CotijaDdvc01DeviceBridge SourceBridge;
|
CotijaDdvc01DeviceBridge SourceBridge;
|
||||||
|
|
||||||
|
Ddvc01AtcMessenger AtcMessenger;
|
||||||
|
Ddvc01VtcMessenger VtcMessenger;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
@@ -182,6 +269,14 @@ namespace PepperDash.Essentials.Room.Cotija
|
|||||||
SetupFunctions();
|
SetupFunctions();
|
||||||
SetupFeedbacks();
|
SetupFeedbacks();
|
||||||
|
|
||||||
|
var atcKey = string.Format("atc-{0}-{1}", this.Key, Parent.Key);
|
||||||
|
AtcMessenger = new Ddvc01AtcMessenger(atcKey, EISC, "/device/audioCodec");
|
||||||
|
AtcMessenger.RegisterWithAppServer(Parent);
|
||||||
|
|
||||||
|
var vtcKey = string.Format("atc-{0}-{1}", this.Key, Parent.Key);
|
||||||
|
VtcMessenger = new Ddvc01VtcMessenger(vtcKey, EISC, "/device/videoCodec");
|
||||||
|
VtcMessenger.RegisterWithAppServer(Parent);
|
||||||
|
|
||||||
EISC.SigChange += EISC_SigChange;
|
EISC.SigChange += EISC_SigChange;
|
||||||
EISC.OnlineStatusChange += (o, a) =>
|
EISC.OnlineStatusChange += (o, a) =>
|
||||||
{
|
{
|
||||||
@@ -216,8 +311,6 @@ namespace PepperDash.Essentials.Room.Cotija
|
|||||||
}
|
}
|
||||||
}, "mobilebridgedump", "Dumps DDVC01 bridge EISC data b,u,s", ConsoleAccessLevelEnum.AccessOperator);
|
}, "mobilebridgedump", "Dumps DDVC01 bridge EISC data b,u,s", ConsoleAccessLevelEnum.AccessOperator);
|
||||||
|
|
||||||
CrestronConsole.AddNewConsoleCommand(s => LoadConfigValues(), "loadddvc", "", ConsoleAccessLevelEnum.AccessOperator);
|
|
||||||
|
|
||||||
return base.CustomActivate();
|
return base.CustomActivate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -227,6 +320,8 @@ namespace PepperDash.Essentials.Room.Cotija
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
void SetupFunctions()
|
void SetupFunctions()
|
||||||
{
|
{
|
||||||
|
Parent.AddAction(@"/room/room1/promptForCode", new Action(() => EISC.PulseBool(BoolJoin.PromptForCode)));
|
||||||
|
Parent.AddAction(@"/room/room1/clientJoined", new Action(() => EISC.PulseBool(BoolJoin.ClientJoined)));
|
||||||
|
|
||||||
Parent.AddAction(@"/room/room1/status", new Action(SendFullStatus));
|
Parent.AddAction(@"/room/room1/status", new Action(SendFullStatus));
|
||||||
|
|
||||||
@@ -237,12 +332,26 @@ namespace PepperDash.Essentials.Room.Cotija
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
Parent.AddAction(@"/room/room1/defaultsource", new Action(() =>
|
Parent.AddAction(@"/room/room1/defaultsource", new Action(() =>
|
||||||
EISC.PulseBool(BoolJoin.ActivitySharePress)));
|
EISC.PulseBool(BoolJoin.ActivityShare)));
|
||||||
|
Parent.AddAction(@"/room/room1/activityPhone", new Action(() =>
|
||||||
|
EISC.PulseBool(BoolJoin.ActivityPhoneCall)));
|
||||||
|
Parent.AddAction(@"/room/room1/activityVideo", new Action(() =>
|
||||||
|
EISC.PulseBool(BoolJoin.ActivityVideoCall)));
|
||||||
|
|
||||||
Parent.AddAction(@"/room/room1/volumes/master/level", new Action<ushort>(u =>
|
Parent.AddAction(@"/room/room1/volumes/master/level", new Action<ushort>(u =>
|
||||||
EISC.SetUshort(UshortJoin.MasterVolumeLevel, u)));
|
EISC.SetUshort(UshortJoin.MasterVolumeLevel, u)));
|
||||||
Parent.AddAction(@"/room/room1/volumes/master/muteToggle", new Action(() =>
|
Parent.AddAction(@"/room/room1/volumes/master/muteToggle", new Action(() =>
|
||||||
EISC.PulseBool(BoolJoin.MasterVolumeIsMuted)));
|
EISC.PulseBool(BoolJoin.MasterVolumeIsMuted)));
|
||||||
|
Parent.AddAction(@"/room/room1/volumes/master/privacyMuteToggle", new Action(() =>
|
||||||
|
EISC.PulseBool(BoolJoin.PrivacyMute)));
|
||||||
|
for (uint i = 2; i <= 7; i++)
|
||||||
|
{
|
||||||
|
var index = i;
|
||||||
|
Parent.AddAction(string.Format(@"/room/room1/volumes/level-{0}/level", index), new Action<ushort>(u =>
|
||||||
|
EISC.SetUshort(index, u)));
|
||||||
|
Parent.AddAction(string.Format(@"/room/room1/volumes/level-{0}/muteToggle", index), new Action(() =>
|
||||||
|
EISC.PulseBool(index)));
|
||||||
|
}
|
||||||
|
|
||||||
Parent.AddAction(@"/room/room1/shutdownStart", new Action(() =>
|
Parent.AddAction(@"/room/room1/shutdownStart", new Action(() =>
|
||||||
EISC.PulseBool(BoolJoin.ShutdownStart)));
|
EISC.PulseBool(BoolJoin.ShutdownStart)));
|
||||||
@@ -250,20 +359,26 @@ namespace PepperDash.Essentials.Room.Cotija
|
|||||||
EISC.PulseBool(BoolJoin.ShutdownEnd)));
|
EISC.PulseBool(BoolJoin.ShutdownEnd)));
|
||||||
Parent.AddAction(@"/room/room1/shutdownCancel", new Action(() =>
|
Parent.AddAction(@"/room/room1/shutdownCancel", new Action(() =>
|
||||||
EISC.PulseBool(BoolJoin.ShutdownCancel)));
|
EISC.PulseBool(BoolJoin.ShutdownCancel)));
|
||||||
|
|
||||||
|
|
||||||
// Source Device (Current Source)'
|
|
||||||
|
|
||||||
SourceDeviceMapDictionary sourceJoinMap = new SourceDeviceMapDictionary();
|
|
||||||
|
|
||||||
var prefix = @"/device/currentSource/";
|
|
||||||
|
|
||||||
foreach (var item in sourceJoinMap)
|
|
||||||
{
|
|
||||||
Parent.AddAction(string.Format("{0}{1}", prefix, item.Key), new PressAndHoldAction(b => EISC.SetBool(item.Value, b)));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="devKey"></param>
|
||||||
|
void SetupSourceFunctions(string devKey)
|
||||||
|
{
|
||||||
|
SourceDeviceMapDictionary sourceJoinMap = new SourceDeviceMapDictionary();
|
||||||
|
|
||||||
|
var prefix = string.Format("/device/{0}/", devKey);
|
||||||
|
|
||||||
|
foreach (var item in sourceJoinMap)
|
||||||
|
{
|
||||||
|
var join = item.Value;
|
||||||
|
Parent.AddAction(string.Format("{0}{1}", prefix, item.Key), new PressAndHoldAction(b => EISC.SetBool(join, b)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Links feedbacks to whatever is gonna happen!
|
/// Links feedbacks to whatever is gonna happen!
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -295,7 +410,6 @@ namespace PepperDash.Essentials.Room.Cotija
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
EISC.SetBoolSigAction(BoolJoin.MasterVolumeIsMuted, b =>
|
EISC.SetBoolSigAction(BoolJoin.MasterVolumeIsMuted, b =>
|
||||||
PostStatusMessage(new
|
PostStatusMessage(new
|
||||||
{
|
{
|
||||||
@@ -307,6 +421,48 @@ namespace PepperDash.Essentials.Room.Cotija
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
EISC.SetBoolSigAction(BoolJoin.PrivacyMute, b =>
|
||||||
|
PostStatusMessage(new
|
||||||
|
{
|
||||||
|
volumes = new
|
||||||
|
{
|
||||||
|
master = new
|
||||||
|
{
|
||||||
|
privacyMuted = b
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
for (uint i = 2; i <= 7; i++)
|
||||||
|
{
|
||||||
|
var index = i; // local scope for lambdas
|
||||||
|
EISC.SetUShortSigAction(index, u => // start at join 2
|
||||||
|
{
|
||||||
|
// need a dict in order to create the level-n property on auxFaders
|
||||||
|
var dict = new Dictionary<string, object>();
|
||||||
|
dict.Add("level-" + index, new { level = u });
|
||||||
|
PostStatusMessage(new
|
||||||
|
{
|
||||||
|
volumes = new
|
||||||
|
{
|
||||||
|
auxFaders = dict,
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
EISC.SetBoolSigAction(index, b =>
|
||||||
|
{
|
||||||
|
// need a dict in order to create the level-n property on auxFaders
|
||||||
|
var dict = new Dictionary<string, object>();
|
||||||
|
dict.Add("level-" + index, new { muted = b });
|
||||||
|
PostStatusMessage(new
|
||||||
|
{
|
||||||
|
volumes = new
|
||||||
|
{
|
||||||
|
auxFaders = dict,
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// shutdown things
|
// shutdown things
|
||||||
@@ -329,6 +485,23 @@ namespace PepperDash.Essentials.Room.Cotija
|
|||||||
|
|
||||||
// Config things
|
// Config things
|
||||||
EISC.SetSigTrueAction(BoolJoin.ConfigIsReady, LoadConfigValues);
|
EISC.SetSigTrueAction(BoolJoin.ConfigIsReady, LoadConfigValues);
|
||||||
|
|
||||||
|
// Activity modes
|
||||||
|
EISC.SetSigTrueAction(BoolJoin.ActivityShare, () => UpdateActivity(1));
|
||||||
|
EISC.SetSigTrueAction(BoolJoin.ActivityPhoneCall, () => UpdateActivity(2));
|
||||||
|
EISC.SetSigTrueAction(BoolJoin.ActivityVideoCall, () => UpdateActivity(3));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates activity states
|
||||||
|
/// </summary>
|
||||||
|
void UpdateActivity(int mode)
|
||||||
|
{
|
||||||
|
PostStatusMessage(new
|
||||||
|
{
|
||||||
|
activityMode = mode,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -345,10 +518,10 @@ namespace PepperDash.Essentials.Room.Cotija
|
|||||||
var version = Assembly.GetExecutingAssembly().GetName().Version;
|
var version = Assembly.GetExecutingAssembly().GetName().Version;
|
||||||
co.Info.RuntimeInfo.AssemblyVersion = string.Format("{0}.{1}.{2}", version.Major, version.Minor, version.Build);
|
co.Info.RuntimeInfo.AssemblyVersion = string.Format("{0}.{1}.{2}", version.Major, version.Minor, version.Build);
|
||||||
|
|
||||||
|
|
||||||
//Room
|
//Room
|
||||||
if (co.Rooms == null)
|
//if (co.Rooms == null)
|
||||||
co.Rooms = new List<DeviceConfig>();
|
// always start fresh in case simpl changed
|
||||||
|
co.Rooms = new List<DeviceConfig>();
|
||||||
var rm = new DeviceConfig();
|
var rm = new DeviceConfig();
|
||||||
if (co.Rooms.Count == 0)
|
if (co.Rooms.Count == 0)
|
||||||
{
|
{
|
||||||
@@ -360,7 +533,7 @@ namespace PepperDash.Essentials.Room.Cotija
|
|||||||
Debug.Console(0, this, "Replacing Room[0] in config");
|
Debug.Console(0, this, "Replacing Room[0] in config");
|
||||||
co.Rooms[0] = rm;
|
co.Rooms[0] = rm;
|
||||||
}
|
}
|
||||||
rm.Name = EISC.StringOutput[501].StringValue;
|
rm.Name = EISC.StringOutput[StringJoin.ConfigRoomName].StringValue;
|
||||||
rm.Key = "room1";
|
rm.Key = "room1";
|
||||||
rm.Type = "ddvc01";
|
rm.Type = "ddvc01";
|
||||||
|
|
||||||
@@ -371,25 +544,21 @@ namespace PepperDash.Essentials.Room.Cotija
|
|||||||
rmProps = JsonConvert.DeserializeObject<DDVC01RoomPropertiesConfig>(rm.Properties.ToString());
|
rmProps = JsonConvert.DeserializeObject<DDVC01RoomPropertiesConfig>(rm.Properties.ToString());
|
||||||
|
|
||||||
rmProps.Help = new EssentialsHelpPropertiesConfig();
|
rmProps.Help = new EssentialsHelpPropertiesConfig();
|
||||||
rmProps.Help.CallButtonText = EISC.StringOutput[503].StringValue;
|
rmProps.Help.CallButtonText = EISC.StringOutput[StringJoin.ConfigHelpNumber].StringValue;
|
||||||
rmProps.Help.Message = EISC.StringOutput[502].StringValue;
|
rmProps.Help.Message = EISC.StringOutput[StringJoin.ConfigHelpMessage].StringValue;
|
||||||
|
|
||||||
rmProps.Environment = new EssentialsEnvironmentPropertiesConfig(); // enabled defaults to false
|
rmProps.Environment = new EssentialsEnvironmentPropertiesConfig(); // enabled defaults to false
|
||||||
|
|
||||||
rmProps.RoomPhoneNumber = EISC.StringOutput[504].StringValue;
|
rmProps.RoomPhoneNumber = EISC.StringOutput[StringJoin.ConfigRoomPhoneNumber].StringValue;
|
||||||
rmProps.RoomURI = EISC.StringOutput[505].StringValue;
|
rmProps.RoomURI = EISC.StringOutput[StringJoin.ConfigRoomURI].StringValue;
|
||||||
rmProps.SpeedDials = new List<DDVC01SpeedDial>();
|
rmProps.SpeedDials = new List<DDVC01SpeedDial>();
|
||||||
// add speed dials as long as there are more - up to 4
|
|
||||||
for (uint i = 512; i <= 519; i = i + 2)
|
// This MAY need a check
|
||||||
{
|
rmProps.AudioCodecKey = "audioCodec";
|
||||||
var num = EISC.StringOutput[i].StringValue;
|
rmProps.VideoCodecKey = "videoCodec";
|
||||||
if (string.IsNullOrEmpty(num))
|
|
||||||
break;
|
|
||||||
var name = EISC.StringOutput[i + 1].StringValue;
|
|
||||||
rmProps.SpeedDials.Add(new DDVC01SpeedDial { Number = num, Name = name});
|
|
||||||
}
|
|
||||||
// volume control names
|
// volume control names
|
||||||
var volCount = EISC.UShortOutput[701].UShortValue;
|
var volCount = EISC.UShortOutput[UshortJoin.VolumeSliderCount].UShortValue;
|
||||||
|
|
||||||
//// use Volumes object or?
|
//// use Volumes object or?
|
||||||
//rmProps.VolumeSliderNames = new List<string>();
|
//rmProps.VolumeSliderNames = new List<string>();
|
||||||
@@ -403,7 +572,10 @@ namespace PepperDash.Essentials.Room.Cotija
|
|||||||
co.Devices = new List<DeviceConfig>();
|
co.Devices = new List<DeviceConfig>();
|
||||||
|
|
||||||
// clear out previous DDVC devices
|
// clear out previous DDVC devices
|
||||||
co.Devices.RemoveAll(d => d.Key.StartsWith("source-", StringComparison.OrdinalIgnoreCase));
|
co.Devices.RemoveAll(d =>
|
||||||
|
d.Key.StartsWith("source-", StringComparison.OrdinalIgnoreCase)
|
||||||
|
|| d.Key.Equals("audioCodec", StringComparison.OrdinalIgnoreCase)
|
||||||
|
|| d.Key.Equals("videoCodec", StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
||||||
rmProps.SourceListKey = "default";
|
rmProps.SourceListKey = "default";
|
||||||
rm.Properties = JToken.FromObject(rmProps);
|
rm.Properties = JToken.FromObject(rmProps);
|
||||||
@@ -414,22 +586,39 @@ namespace PepperDash.Essentials.Room.Cotija
|
|||||||
|
|
||||||
co.SourceLists = new Dictionary<string,Dictionary<string,SourceListItem>>();
|
co.SourceLists = new Dictionary<string,Dictionary<string,SourceListItem>>();
|
||||||
var newSl = new Dictionary<string, SourceListItem>();
|
var newSl = new Dictionary<string, SourceListItem>();
|
||||||
// add sources...
|
// add "none" source if VTC present
|
||||||
for (uint i = 0; i<= 19; i++)
|
|
||||||
|
if (!string.IsNullOrEmpty(rmProps.VideoCodecKey))
|
||||||
{
|
{
|
||||||
var name = EISC.StringOutput[601 + i].StringValue;
|
var codecOsd = new SourceListItem()
|
||||||
|
{
|
||||||
|
Name = "None",
|
||||||
|
IncludeInSourceList = true,
|
||||||
|
Order = 1,
|
||||||
|
Type = eSourceListItemType.Route,
|
||||||
|
SourceKey = ""
|
||||||
|
};
|
||||||
|
newSl.Add("Source-None", codecOsd);
|
||||||
|
}
|
||||||
|
// add sources...
|
||||||
|
for (uint i = 0; i <= 19; i++)
|
||||||
|
{
|
||||||
|
var name = EISC.StringOutput[StringJoin.SourceNameJoinStart + i].StringValue;
|
||||||
if(string.IsNullOrEmpty(name))
|
if(string.IsNullOrEmpty(name))
|
||||||
break;
|
break;
|
||||||
var icon = EISC.StringOutput[651 + i].StringValue;
|
var icon = EISC.StringOutput[StringJoin.SourceIconJoinStart + i].StringValue;
|
||||||
var key = EISC.StringOutput[671 + i].StringValue;
|
var key = EISC.StringOutput[StringJoin.SourceKeyJoinStart + i].StringValue;
|
||||||
var type = EISC.StringOutput[701 + i].StringValue;
|
var type = EISC.StringOutput[StringJoin.SourceTypeJoinStart + i].StringValue;
|
||||||
|
var disableShare = EISC.BooleanOutput[BoolJoin.SourceShareDisableStartJoin + i].BoolValue;
|
||||||
|
|
||||||
Debug.Console(0, this, "Adding source {0} '{1}'", key, name);
|
Debug.Console(0, this, "Adding source {0} '{1}'", key, name);
|
||||||
var newSLI = new SourceListItem{
|
var newSLI = new SourceListItem{
|
||||||
Icon = icon,
|
Icon = icon,
|
||||||
Name = name,
|
Name = name,
|
||||||
Order = (int)i + 1,
|
Order = (int)i + 10,
|
||||||
SourceKey = key,
|
SourceKey = key,
|
||||||
|
Type = eSourceListItemType.Route,
|
||||||
|
DisableCodecSharing = disableShare,
|
||||||
};
|
};
|
||||||
newSl.Add(key, newSLI);
|
newSl.Add(key, newSLI);
|
||||||
|
|
||||||
@@ -447,10 +636,97 @@ namespace PepperDash.Essentials.Room.Cotija
|
|||||||
Type = type
|
Type = type
|
||||||
};
|
};
|
||||||
co.Devices.Add(devConf);
|
co.Devices.Add(devConf);
|
||||||
|
|
||||||
|
if (group.ToLower().StartsWith("settopbox")) // Add others here as needed
|
||||||
|
{
|
||||||
|
SetupSourceFunctions(key);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
co.SourceLists.Add("default", newSl);
|
co.SourceLists.Add("default", newSl);
|
||||||
|
|
||||||
|
// Build "audioCodec" config if we need
|
||||||
|
if (!string.IsNullOrEmpty(rmProps.AudioCodecKey))
|
||||||
|
{
|
||||||
|
var acFavs = new List<PepperDash.Essentials.Devices.Common.Codec.CodecActiveCallItem>();
|
||||||
|
for (uint i = 0; i < 4; i++)
|
||||||
|
{
|
||||||
|
if (!EISC.GetBool(BoolJoin.SpeedDialVisibleStartJoin + i))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
acFavs.Add(new PepperDash.Essentials.Devices.Common.Codec.CodecActiveCallItem()
|
||||||
|
{
|
||||||
|
Name = EISC.GetString(StringJoin.SpeedDialNameStartJoin + i),
|
||||||
|
Number = EISC.GetString(StringJoin.SpeedDialNumberStartJoin + i),
|
||||||
|
Type = PepperDash.Essentials.Devices.Common.Codec.eCodecCallType.Audio
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var acProps = new
|
||||||
|
{
|
||||||
|
favorites = acFavs
|
||||||
|
};
|
||||||
|
|
||||||
|
var acStr = "audioCodec";
|
||||||
|
var acConf = new DeviceConfig()
|
||||||
|
{
|
||||||
|
Group = acStr,
|
||||||
|
Key = acStr,
|
||||||
|
Name = acStr,
|
||||||
|
Type = acStr,
|
||||||
|
Properties = JToken.FromObject(acProps)
|
||||||
|
};
|
||||||
|
co.Devices.Add(acConf);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Build Video codec config
|
||||||
|
if (!string.IsNullOrEmpty(rmProps.VideoCodecKey))
|
||||||
|
{
|
||||||
|
// No favorites, for now?
|
||||||
|
var favs = new List<PepperDash.Essentials.Devices.Common.Codec.CodecActiveCallItem>();
|
||||||
|
|
||||||
|
// cameras
|
||||||
|
var camsProps = new List<object>();
|
||||||
|
for (uint i = 0; i < 9; i++)
|
||||||
|
{
|
||||||
|
var name = EISC.GetString(i + StringJoin.CameraNearNameStart);
|
||||||
|
if (!string.IsNullOrEmpty(name))
|
||||||
|
{
|
||||||
|
camsProps.Add(new
|
||||||
|
{
|
||||||
|
name = name,
|
||||||
|
selector = "camera" + (i + 1),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var farName = EISC.GetString(StringJoin.CameraFarName);
|
||||||
|
if (!string.IsNullOrEmpty(farName))
|
||||||
|
{
|
||||||
|
camsProps.Add(new
|
||||||
|
{
|
||||||
|
name = farName,
|
||||||
|
selector = "cameraFar",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var props = new
|
||||||
|
{
|
||||||
|
favorites = favs,
|
||||||
|
cameras = camsProps,
|
||||||
|
};
|
||||||
|
var str = "videoCodec";
|
||||||
|
var conf = new DeviceConfig()
|
||||||
|
{
|
||||||
|
Group = str,
|
||||||
|
Key = str,
|
||||||
|
Name = str,
|
||||||
|
Type = str,
|
||||||
|
Properties = JToken.FromObject(props)
|
||||||
|
};
|
||||||
|
co.Devices.Add(conf);
|
||||||
|
}
|
||||||
|
|
||||||
Debug.Console(0, this, "******* CONFIG FROM DDVC: \r{0}", JsonConvert.SerializeObject(ConfigReader.ConfigObject, Formatting.Indented));
|
Debug.Console(0, this, "******* CONFIG FROM DDVC: \r{0}", JsonConvert.SerializeObject(ConfigReader.ConfigObject, Formatting.Indented));
|
||||||
|
|
||||||
var handler = ConfigurationIsReady;
|
var handler = ConfigurationIsReady;
|
||||||
@@ -462,43 +738,48 @@ namespace PepperDash.Essentials.Room.Cotija
|
|||||||
ConfigIsLoaded = true;
|
ConfigIsLoaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
void SendFullStatus()
|
void SendFullStatus()
|
||||||
{
|
{
|
||||||
if (ConfigIsLoaded)
|
if (ConfigIsLoaded)
|
||||||
{
|
{
|
||||||
var count = EISC.UShortOutput[801].UShortValue;
|
var count = EISC.UShortOutput[101].UShortValue;
|
||||||
|
|
||||||
Debug.Console(1, this, "The Fader Count is : {0}", count);
|
Debug.Console(1, this, "The Fader Count is : {0}", count);
|
||||||
|
|
||||||
// build volumes object, serialize and put in content of method below
|
// build volumes object, serialize and put in content of method below
|
||||||
|
|
||||||
var auxFaders = new List<Volume>();
|
|
||||||
|
|
||||||
// Create auxFaders
|
// Create auxFaders
|
||||||
for (uint i = 2; i <= count; i++)
|
var auxFaderDict = new Dictionary<string, Volume>();
|
||||||
{
|
for (uint i = 2; i <= count; i++)
|
||||||
auxFaders.Add(
|
{
|
||||||
new Volume(string.Format("level-{0}", i),
|
auxFaderDict.Add("level-" + i,
|
||||||
EISC.UShortOutput[i].UShortValue,
|
new Volume("level-" + i,
|
||||||
EISC.BooleanOutput[i].BoolValue,
|
EISC.UShortOutput[i].UShortValue,
|
||||||
EISC.StringOutput[800 + i].StringValue,
|
EISC.BooleanOutput[i].BoolValue,
|
||||||
true,
|
EISC.StringOutput[i].StringValue,
|
||||||
"someting.png"));
|
true,
|
||||||
}
|
"someting.png"));
|
||||||
|
}
|
||||||
|
|
||||||
var volumes = new Volumes();
|
var volumes = new Volumes();
|
||||||
|
|
||||||
volumes.Master = new Volume("master",
|
volumes.Master = new Volume("master",
|
||||||
EISC.UShortOutput[UshortJoin.MasterVolumeLevel].UShortValue,
|
EISC.UShortOutput[UshortJoin.MasterVolumeLevel].UShortValue,
|
||||||
EISC.BooleanOutput[BoolJoin.MasterVolumeIsMuted].BoolValue,
|
EISC.BooleanOutput[BoolJoin.MasterVolumeIsMuted].BoolValue,
|
||||||
EISC.StringOutput[801].StringValue,
|
EISC.StringOutput[1].StringValue,
|
||||||
true,
|
true,
|
||||||
"something.png");
|
"something.png");
|
||||||
|
volumes.Master.HasPrivacyMute = true;
|
||||||
|
volumes.Master.PrivacyMuted = EISC.BooleanOutput[BoolJoin.PrivacyMute].BoolValue;
|
||||||
|
|
||||||
volumes.AuxFaders = auxFaders;
|
volumes.AuxFaders = auxFaderDict;
|
||||||
|
|
||||||
PostStatusMessage(new
|
PostStatusMessage(new
|
||||||
{
|
{
|
||||||
|
activityMode = GetActivityMode(),
|
||||||
isOn = EISC.BooleanOutput[BoolJoin.RoomIsOn].BoolValue,
|
isOn = EISC.BooleanOutput[BoolJoin.RoomIsOn].BoolValue,
|
||||||
selectedSourceKey = EISC.StringOutput[StringJoin.SelectedSourceKey].StringValue,
|
selectedSourceKey = EISC.StringOutput[StringJoin.SelectedSourceKey].StringValue,
|
||||||
volumes = volumes
|
volumes = volumes
|
||||||
@@ -513,6 +794,18 @@ namespace PepperDash.Essentials.Room.Cotija
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the activity mode int
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
int GetActivityMode()
|
||||||
|
{
|
||||||
|
if (EISC.BooleanOutput[BoolJoin.ActivityPhoneCall].BoolValue) return 2;
|
||||||
|
else if (EISC.BooleanOutput[BoolJoin.ActivityShare].BoolValue) return 1;
|
||||||
|
else if (EISC.BooleanOutput[BoolJoin.ActivityVideoCall].BoolValue) return 3;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Helper for posting status message
|
/// Helper for posting status message
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -585,86 +878,5 @@ namespace PepperDash.Essentials.Room.Cotija
|
|||||||
EISC.StringInput[StringJoin.UserCodeToSystem].StringValue = UserCode;
|
EISC.StringInput[StringJoin.UserCodeToSystem].StringValue = UserCode;
|
||||||
EISC.StringInput[StringJoin.ServerUrl].StringValue = Parent.Config.ClientAppUrl;
|
EISC.StringInput[StringJoin.ServerUrl].StringValue = Parent.Config.ClientAppUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="oldKey"></param>
|
|
||||||
/// <param name="newKey"></param>
|
|
||||||
void SourceChange(string oldKey, string newKey)
|
|
||||||
{
|
|
||||||
/* Example message
|
|
||||||
* {
|
|
||||||
"type":"/room/status",
|
|
||||||
"content": {
|
|
||||||
"selectedSourceKey": "off",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
//if (type == ChangeType.WillChange)
|
|
||||||
//{
|
|
||||||
// // Disconnect from previous source
|
|
||||||
|
|
||||||
// if (info != null)
|
|
||||||
// {
|
|
||||||
// var previousDev = info.SourceDevice;
|
|
||||||
|
|
||||||
// // device type interfaces
|
|
||||||
// if (previousDev is ISetTopBoxControls)
|
|
||||||
// (previousDev as ISetTopBoxControls).UnlinkActions(Parent);
|
|
||||||
// // common interfaces
|
|
||||||
// if (previousDev is IChannel)
|
|
||||||
// (previousDev as IChannel).UnlinkActions(Parent);
|
|
||||||
// if (previousDev is IColor)
|
|
||||||
// (previousDev as IColor).UnlinkActions(Parent);
|
|
||||||
// if (previousDev is IDPad)
|
|
||||||
// (previousDev as IDPad).UnlinkActions(Parent);
|
|
||||||
// if (previousDev is IDvr)
|
|
||||||
// (previousDev as IDvr).UnlinkActions(Parent);
|
|
||||||
// if (previousDev is INumericKeypad)
|
|
||||||
// (previousDev as INumericKeypad).UnlinkActions(Parent);
|
|
||||||
// if (previousDev is IPower)
|
|
||||||
// (previousDev as IPower).UnlinkActions(Parent);
|
|
||||||
// if (previousDev is ITransport)
|
|
||||||
// (previousDev as ITransport).UnlinkActions(Parent);
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// var huddleRoom = room as EssentialsHuddleSpaceRoom;
|
|
||||||
// JObject roomStatus = new JObject();
|
|
||||||
// roomStatus.Add("selectedSourceKey", huddleRoom.CurrentSourceInfoKey);
|
|
||||||
|
|
||||||
// JObject message = new JObject();
|
|
||||||
|
|
||||||
// message.Add("type", "/room/status/");
|
|
||||||
// message.Add("content", roomStatus);
|
|
||||||
|
|
||||||
// Parent.PostToServer(message);
|
|
||||||
//}
|
|
||||||
//else
|
|
||||||
//{
|
|
||||||
// if (info != null)
|
|
||||||
// {
|
|
||||||
// var dev = info.SourceDevice;
|
|
||||||
|
|
||||||
// if (dev is ISetTopBoxControls)
|
|
||||||
// (dev as ISetTopBoxControls).LinkActions(Parent);
|
|
||||||
// if (dev is IChannel)
|
|
||||||
// (dev as IChannel).LinkActions(Parent);
|
|
||||||
// if (dev is IColor)
|
|
||||||
// (dev as IColor).LinkActions(Parent);
|
|
||||||
// if (dev is IDPad)
|
|
||||||
// (dev as IDPad).LinkActions(Parent);
|
|
||||||
// if (dev is IDvr)
|
|
||||||
// (dev as IDvr).LinkActions(Parent);
|
|
||||||
// if (dev is INumericKeypad)
|
|
||||||
// (dev as INumericKeypad).LinkActions(Parent);
|
|
||||||
// if (dev is IPower)
|
|
||||||
// (dev as IPower).LinkActions(Parent);
|
|
||||||
// if (dev is ITransport)
|
|
||||||
// (dev as ITransport).LinkActions(Parent);
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -12,6 +12,7 @@ using PepperDash.Essentials.Core;
|
|||||||
using PepperDash.Essentials.Room.Cotija;
|
using PepperDash.Essentials.Room.Cotija;
|
||||||
using PepperDash.Essentials.Devices.Common.Codec;
|
using PepperDash.Essentials.Devices.Common.Codec;
|
||||||
using PepperDash.Essentials.Devices.Common.VideoCodec;
|
using PepperDash.Essentials.Devices.Common.VideoCodec;
|
||||||
|
using PepperDash.Essentials.Devices.Common.AudioCodec;
|
||||||
|
|
||||||
namespace PepperDash.Essentials
|
namespace PepperDash.Essentials
|
||||||
{
|
{
|
||||||
@@ -22,6 +23,9 @@ namespace PepperDash.Essentials
|
|||||||
|
|
||||||
public VideoCodecBaseMessenger VCMessenger { get; private set; }
|
public VideoCodecBaseMessenger VCMessenger { get; private set; }
|
||||||
|
|
||||||
|
public AudioCodecBaseMessenger ACMessenger { get; private set; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -74,7 +78,7 @@ namespace PepperDash.Essentials
|
|||||||
{
|
{
|
||||||
Parent.AddAction(string.Format(@"/room/{0}/volumes/master/level", Room.Key), new Action<ushort>(u =>
|
Parent.AddAction(string.Format(@"/room/{0}/volumes/master/level", Room.Key), new Action<ushort>(u =>
|
||||||
(volumeRoom.CurrentVolumeControls as IBasicVolumeWithFeedback).SetVolume(u)));
|
(volumeRoom.CurrentVolumeControls as IBasicVolumeWithFeedback).SetVolume(u)));
|
||||||
Parent.AddAction(string.Format(@"/room/{0}/volumes/master/mute", Room.Key), new Action(() =>
|
Parent.AddAction(string.Format(@"/room/{0}/volumes/master/muteToggle", Room.Key), new Action(() =>
|
||||||
volumeRoom.CurrentVolumeControls.MuteToggle()));
|
volumeRoom.CurrentVolumeControls.MuteToggle()));
|
||||||
volumeRoom.CurrentVolumeDeviceChange += new EventHandler<VolumeDeviceChangeEventArgs>(Room_CurrentVolumeDeviceChange);
|
volumeRoom.CurrentVolumeDeviceChange += new EventHandler<VolumeDeviceChangeEventArgs>(Room_CurrentVolumeDeviceChange);
|
||||||
|
|
||||||
@@ -82,7 +86,7 @@ namespace PepperDash.Essentials
|
|||||||
var currentVolumeDevice = volumeRoom.CurrentVolumeControls as IBasicVolumeWithFeedback;
|
var currentVolumeDevice = volumeRoom.CurrentVolumeControls as IBasicVolumeWithFeedback;
|
||||||
if (currentVolumeDevice != null)
|
if (currentVolumeDevice != null)
|
||||||
{
|
{
|
||||||
currentVolumeDevice.MuteFeedback.OutputChange += VolumeLevelFeedback_OutputChange;
|
currentVolumeDevice.MuteFeedback.OutputChange += MuteFeedback_OutputChange;
|
||||||
currentVolumeDevice.VolumeLevelFeedback.OutputChange += VolumeLevelFeedback_OutputChange;
|
currentVolumeDevice.VolumeLevelFeedback.OutputChange += VolumeLevelFeedback_OutputChange;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -92,29 +96,25 @@ namespace PepperDash.Essentials
|
|||||||
sscRoom.CurrentSingleSourceChange += new SourceInfoChangeHandler(Room_CurrentSingleSourceChange);
|
sscRoom.CurrentSingleSourceChange += new SourceInfoChangeHandler(Room_CurrentSingleSourceChange);
|
||||||
|
|
||||||
var vcRoom = Room as IHasVideoCodec;
|
var vcRoom = Room as IHasVideoCodec;
|
||||||
if (vcRoom != null)
|
if (vcRoom != null && vcRoom.VideoCodec != null)
|
||||||
{
|
{
|
||||||
var codec = vcRoom.VideoCodec;
|
var codec = vcRoom.VideoCodec;
|
||||||
VCMessenger = new VideoCodecBaseMessenger(vcRoom.VideoCodec, "/device/videoCodec");
|
var key = vcRoom.VideoCodec.Key + "-" + parent.Key;
|
||||||
|
VCMessenger = new VideoCodecBaseMessenger(key, vcRoom.VideoCodec, "/device/videoCodec");
|
||||||
VCMessenger.RegisterWithAppServer(Parent);
|
VCMessenger.RegisterWithAppServer(Parent);
|
||||||
|
|
||||||
// May need to move this or remove this
|
|
||||||
codec.CallStatusChange += new EventHandler<CodecCallStatusItemChangeEventArgs>(codec_CallStatusChange);
|
|
||||||
|
|
||||||
vcRoom.IsSharingFeedback.OutputChange += new EventHandler<FeedbackEventArgs>(IsSharingFeedback_OutputChange);
|
vcRoom.IsSharingFeedback.OutputChange += new EventHandler<FeedbackEventArgs>(IsSharingFeedback_OutputChange);
|
||||||
|
|
||||||
//Parent.AddAction("/device/videoCodec/dial", new Action<string>(s => codec.Dial(s)));
|
|
||||||
//Parent.AddAction("/device/videoCodec/endCall", new Action<string>(s =>
|
|
||||||
//{
|
|
||||||
// var call = codec.ActiveCalls.FirstOrDefault(c => c.Id == s);
|
|
||||||
// if (call != null)
|
|
||||||
// {
|
|
||||||
// codec.EndCall(call);
|
|
||||||
// }
|
|
||||||
//}));
|
|
||||||
//Parent.AddAction("/device/videoCodec/endAllCalls", new Action(() => codec.EndAllCalls()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var acRoom = Room as IHasAudioCodec;
|
||||||
|
if (acRoom != null && acRoom.AudioCodec != null)
|
||||||
|
{
|
||||||
|
var codec = acRoom.AudioCodec;
|
||||||
|
var key = acRoom.AudioCodec.Key + "-" + parent.Key;
|
||||||
|
ACMessenger = new AudioCodecBaseMessenger(key, acRoom.AudioCodec, "/device/audioCodec");
|
||||||
|
ACMessenger.RegisterWithAppServer(Parent);
|
||||||
|
}
|
||||||
|
|
||||||
var defCallRm = Room as IRunDefaultCallRoute;
|
var defCallRm = Room as IRunDefaultCallRoute;
|
||||||
if (defCallRm != null)
|
if (defCallRm != null)
|
||||||
{
|
{
|
||||||
@@ -169,18 +169,18 @@ namespace PepperDash.Essentials
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
///// <summary>
|
||||||
/// Handler for codec changes
|
///// Handler for codec changes
|
||||||
/// </summary>
|
///// </summary>
|
||||||
void codec_CallStatusChange(object sender, CodecCallStatusItemChangeEventArgs e)
|
//void codec_CallStatusChange(object sender, CodecCallStatusItemChangeEventArgs e)
|
||||||
{
|
//{
|
||||||
PostStatusMessage(new
|
// PostStatusMessage(new
|
||||||
{
|
// {
|
||||||
calls = GetCallsMessageObject(),
|
// calls = GetCallsMessageObject(),
|
||||||
//vtc = GetVtcCallsMessageObject()
|
// //vtc = GetVtcCallsMessageObject()
|
||||||
});
|
// });
|
||||||
|
|
||||||
}
|
//}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Helper for posting status message
|
/// Helper for posting status message
|
||||||
@@ -417,7 +417,7 @@ namespace PepperDash.Essentials
|
|||||||
if (rmVc != null)
|
if (rmVc != null)
|
||||||
{
|
{
|
||||||
var vc = rmVc.CurrentVolumeControls as IBasicVolumeWithFeedback;
|
var vc = rmVc.CurrentVolumeControls as IBasicVolumeWithFeedback;
|
||||||
if (rmVc != null)
|
if (vc != null)
|
||||||
{
|
{
|
||||||
volumes.Master = new Volume("master", vc.VolumeLevelFeedback.UShortValue, vc.MuteFeedback.BoolValue, "Volume", true, "");
|
volumes.Master = new Volume("master", vc.VolumeLevelFeedback.UShortValue, vc.MuteFeedback.BoolValue, "Volume", true, "");
|
||||||
}
|
}
|
||||||
@@ -425,53 +425,52 @@ namespace PepperDash.Essentials
|
|||||||
|
|
||||||
PostStatusMessage(new
|
PostStatusMessage(new
|
||||||
{
|
{
|
||||||
calls = GetCallsMessageObject(),
|
//calls = GetCallsMessageObject(),
|
||||||
isOn = room.OnFeedback.BoolValue,
|
isOn = room.OnFeedback.BoolValue,
|
||||||
selectedSourceKey = sourceKey,
|
selectedSourceKey = sourceKey,
|
||||||
vtc = GetVtcCallsMessageObject(),
|
//vtc = GetVtcCallsMessageObject(),
|
||||||
volumes = volumes
|
volumes = volumes
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
///// <summary>
|
||||||
/// Helper to return a anonymous object with the call data for JSON message
|
///// Helper to return a anonymous object with the call data for JSON message
|
||||||
/// </summary>
|
///// </summary>
|
||||||
/// <returns></returns>
|
///// <returns></returns>
|
||||||
object GetCallsMessageObject()
|
//object GetCallsMessageObject()
|
||||||
{
|
//{
|
||||||
var callRm = Room as IHasVideoCodec;
|
// var callRm = Room as IHasVideoCodec;
|
||||||
if (callRm == null)
|
// if (callRm == null)
|
||||||
return null;
|
// return null;
|
||||||
return new
|
// return new
|
||||||
{
|
// {
|
||||||
activeCalls = callRm.VideoCodec.ActiveCalls,
|
// activeCalls = callRm.VideoCodec.ActiveCalls,
|
||||||
callType = callRm.CallTypeFeedback.IntValue,
|
// callType = callRm.CallTypeFeedback.IntValue,
|
||||||
inCall = callRm.InCallFeedback.BoolValue,
|
// inCall = callRm.InCallFeedback.BoolValue,
|
||||||
isSharing = callRm.IsSharingFeedback.BoolValue,
|
// isSharing = callRm.IsSharingFeedback.BoolValue,
|
||||||
privacyModeIsOn = callRm.PrivacyModeIsOnFeedback.BoolValue
|
// privacyModeIsOn = callRm.PrivacyModeIsOnFeedback.BoolValue
|
||||||
};
|
// };
|
||||||
}
|
//}
|
||||||
|
|
||||||
/// <summary>
|
///// <summary>
|
||||||
/// Helper method to build call status for vtc
|
///// Helper method to build call status for vtc
|
||||||
/// </summary>
|
///// </summary>
|
||||||
/// <returns></returns>
|
///// <returns></returns>
|
||||||
object GetVtcCallsMessageObject()
|
//object GetVtcCallsMessageObject()
|
||||||
{
|
//{
|
||||||
var callRm = Room as IHasVideoCodec;
|
// var callRm = Room as IHasVideoCodec;
|
||||||
object vtc = null;
|
// object vtc = null;
|
||||||
if (callRm != null)
|
// if (callRm != null)
|
||||||
{
|
// {
|
||||||
var codec = callRm.VideoCodec;
|
// var codec = callRm.VideoCodec;
|
||||||
vtc = new
|
// vtc = new
|
||||||
{
|
// {
|
||||||
isInCall = codec.IsInCall,
|
// isInCall = codec.IsInCall,
|
||||||
calls = codec.ActiveCalls
|
// calls = codec.ActiveCalls
|
||||||
};
|
// };
|
||||||
}
|
// }
|
||||||
return vtc;
|
// return vtc;
|
||||||
}
|
//}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ namespace PepperDash.Essentials.Room.Cotija
|
|||||||
public Volume Master { get; set; }
|
public Volume Master { get; set; }
|
||||||
|
|
||||||
[JsonProperty("auxFaders")]
|
[JsonProperty("auxFaders")]
|
||||||
public List<Volume> AuxFaders { get; set; }
|
public Dictionary<string, Volume> AuxFaders { get; set; }
|
||||||
|
|
||||||
public Volumes()
|
public Volumes()
|
||||||
{
|
{
|
||||||
AuxFaders = new List<Volume>();
|
AuxFaders = new Dictionary<string, Volume>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -39,6 +39,13 @@ namespace PepperDash.Essentials.Room.Cotija
|
|||||||
[JsonProperty("hasMute")]
|
[JsonProperty("hasMute")]
|
||||||
public bool HasMute { get; set; }
|
public bool HasMute { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("hasPrivacyMute")]
|
||||||
|
public bool HasPrivacyMute { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("privacyMuted")]
|
||||||
|
public bool PrivacyMuted { get; set; }
|
||||||
|
|
||||||
|
|
||||||
[JsonProperty("muteIcon")]
|
[JsonProperty("muteIcon")]
|
||||||
public string MuteIcon { get; set; }
|
public string MuteIcon { get; set; }
|
||||||
|
|
||||||
|
|||||||
BIN
PepperDashEssentials/Bridges/._EssentialsLightsBridge.cs
Normal file
BIN
PepperDashEssentials/Bridges/._EssentialsLightsBridge.cs
Normal file
Binary file not shown.
61
PepperDashEssentials/Bridges/AirMediaControllerBridge.cs
Normal file
61
PepperDashEssentials/Bridges/AirMediaControllerBridge.cs
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.Devices.Common;
|
||||||
|
using PepperDash.Essentials.DM.AirMedia;
|
||||||
|
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Bridges
|
||||||
|
{
|
||||||
|
public static class AirMediaControllerApiExtensions
|
||||||
|
{
|
||||||
|
public static void LinkToApi(this AirMediaController airMedia, BasicTriList trilist, uint joinStart, string joinMapKey)
|
||||||
|
{
|
||||||
|
AirMediaControllerJoinMap joinMap = new AirMediaControllerJoinMap();
|
||||||
|
|
||||||
|
var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey);
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(joinMapSerialized))
|
||||||
|
joinMap = JsonConvert.DeserializeObject<AirMediaControllerJoinMap>(joinMapSerialized);
|
||||||
|
|
||||||
|
joinMap.OffsetJoinNumbers(joinStart);
|
||||||
|
|
||||||
|
Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||||
|
Debug.Console(0, "Linking to Airmedia: {0}", airMedia.Name);
|
||||||
|
|
||||||
|
trilist.StringInput[joinMap.Name].StringValue = airMedia.Name;
|
||||||
|
|
||||||
|
var commMonitor = airMedia as ICommunicationMonitor;
|
||||||
|
if (commMonitor != null)
|
||||||
|
{
|
||||||
|
commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]);
|
||||||
|
}
|
||||||
|
|
||||||
|
airMedia.IsInSessionFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsInSession]);
|
||||||
|
airMedia.HdmiVideoSyncDetectedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.HdmiVideoSync]);
|
||||||
|
|
||||||
|
trilist.SetSigTrueAction(joinMap.AutomaticInputRoutingEnabled, new Action( airMedia.AirMedia.DisplayControl.EnableAutomaticRouting));
|
||||||
|
trilist.SetSigFalseAction(joinMap.AutomaticInputRoutingEnabled, new Action( airMedia.AirMedia.DisplayControl.DisableAutomaticRouting));
|
||||||
|
airMedia.AutomaticInputRoutingEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.AutomaticInputRoutingEnabled]);
|
||||||
|
|
||||||
|
trilist.SetUShortSigAction(joinMap.VideoOut, new Action<ushort>((u) => airMedia.SelectVideoOut(u)));
|
||||||
|
|
||||||
|
airMedia.VideoOutFeedback.LinkInputSig(trilist.UShortInput[joinMap.VideoOut]);
|
||||||
|
airMedia.ErrorFeedback.LinkInputSig(trilist.UShortInput[joinMap.ErrorFB]);
|
||||||
|
airMedia.NumberOfUsersConnectedFeedback.LinkInputSig(trilist.UShortInput[joinMap.NumberOfUsersConnectedFB]);
|
||||||
|
|
||||||
|
trilist.SetUShortSigAction(joinMap.LoginCode, new Action<ushort>((u) => airMedia.AirMedia.AirMedia.LoginCode.UShortValue = u));
|
||||||
|
airMedia.LoginCodeFeedback.LinkInputSig(trilist.UShortInput[joinMap.LoginCode]);
|
||||||
|
|
||||||
|
airMedia.ConnectionAddressFeedback.LinkInputSig(trilist.StringInput[joinMap.ConnectionAddressFB]);
|
||||||
|
airMedia.HostnameFeedback.LinkInputSig(trilist.StringInput[joinMap.HostnameFB]);
|
||||||
|
airMedia.SerialNumberFeedback.LinkInputSig(trilist.StringInput[joinMap.SerialNumberFeedback]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
41
PepperDashEssentials/Bridges/AppleTvBridge.cs
Normal file
41
PepperDashEssentials/Bridges/AppleTvBridge.cs
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.Devices.Common;
|
||||||
|
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Bridges
|
||||||
|
{
|
||||||
|
public static class AppleTvApiExtensions
|
||||||
|
{
|
||||||
|
public static void LinkToApi(this AppleTV appleTv, BasicTriList trilist, uint joinStart, string joinMapKey)
|
||||||
|
{
|
||||||
|
AppleTvJoinMap joinMap = new AppleTvJoinMap();
|
||||||
|
|
||||||
|
var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey);
|
||||||
|
|
||||||
|
if(!string.IsNullOrEmpty(joinMapSerialized))
|
||||||
|
joinMap = JsonConvert.DeserializeObject<AppleTvJoinMap>(joinMapSerialized);
|
||||||
|
|
||||||
|
joinMap.OffsetJoinNumbers(joinStart);
|
||||||
|
|
||||||
|
Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||||
|
Debug.Console(0, "Linking to Bridge Type {0}", appleTv.GetType().Name.ToString());
|
||||||
|
|
||||||
|
trilist.SetBoolSigAction(joinMap.UpArrow, (b) => appleTv.Up(b));
|
||||||
|
trilist.SetBoolSigAction(joinMap.DnArrow, (b) => appleTv.Down(b));
|
||||||
|
trilist.SetBoolSigAction(joinMap.LeftArrow, (b) => appleTv.Left(b));
|
||||||
|
trilist.SetBoolSigAction(joinMap.RightArrow, (b) => appleTv.Right(b));
|
||||||
|
trilist.SetBoolSigAction(joinMap.Select, (b) => appleTv.Select(b));
|
||||||
|
trilist.SetBoolSigAction(joinMap.Menu, (b) => appleTv.Menu(b));
|
||||||
|
trilist.SetBoolSigAction(joinMap.PlayPause, (b) => appleTv.Play(b));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,9 +5,18 @@ using System.Text;
|
|||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
using Crestron.SimplSharpPro.EthernetCommunication;
|
using Crestron.SimplSharpPro.EthernetCommunication;
|
||||||
|
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core;
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.Core.Lighting;
|
||||||
using PepperDash.Essentials.Core.Devices;
|
using PepperDash.Essentials.Core.Devices;
|
||||||
|
using PepperDash.Essentials.Devices.Common;
|
||||||
|
using PepperDash.Essentials.Devices.Common.Cameras;
|
||||||
|
using PepperDash.Essentials.Core.Config;
|
||||||
|
using PepperDash.Essentials.Core.CrestronIO;
|
||||||
|
using PepperDash.Essentials.DM;
|
||||||
|
//using PepperDash.Essentials.Devices.Common.Cameras;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Bridges
|
namespace PepperDash.Essentials.Bridges
|
||||||
{
|
{
|
||||||
@@ -44,17 +53,176 @@ namespace PepperDash.Essentials.Bridges
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class EiscApi : BridgeApi
|
public class EiscApi : BridgeApi
|
||||||
{
|
{
|
||||||
|
public EiscApiPropertiesConfig PropertiesConfig { get; private set; }
|
||||||
|
|
||||||
public ThreeSeriesTcpIpEthernetIntersystemCommunications Eisc { get; private set; }
|
public ThreeSeriesTcpIpEthernetIntersystemCommunications Eisc { get; private set; }
|
||||||
|
|
||||||
|
public EiscApi(DeviceConfig dc) :
|
||||||
public EiscApi(string key, uint ipid, string hostname) :
|
base(dc.Key)
|
||||||
base(key)
|
|
||||||
{
|
{
|
||||||
Eisc = new ThreeSeriesTcpIpEthernetIntersystemCommunications(ipid, hostname, Global.ControlSystem);
|
PropertiesConfig = JsonConvert.DeserializeObject<EiscApiPropertiesConfig>(dc.Properties.ToString());
|
||||||
|
|
||||||
|
Eisc = new ThreeSeriesTcpIpEthernetIntersystemCommunications(PropertiesConfig.Control.IpIdInt, PropertiesConfig.Control.TcpSshProperties.Address, Global.ControlSystem);
|
||||||
|
|
||||||
Eisc.SigChange += new Crestron.SimplSharpPro.DeviceSupport.SigEventHandler(Eisc_SigChange);
|
Eisc.SigChange += new Crestron.SimplSharpPro.DeviceSupport.SigEventHandler(Eisc_SigChange);
|
||||||
|
|
||||||
Eisc.Register();
|
Eisc.Register();
|
||||||
|
|
||||||
|
AddPostActivationAction( () =>
|
||||||
|
{
|
||||||
|
Debug.Console(1, this, "Linking Devices...");
|
||||||
|
|
||||||
|
foreach (var d in PropertiesConfig.Devices)
|
||||||
|
{
|
||||||
|
var device = DeviceManager.GetDeviceForKey(d.DeviceKey);
|
||||||
|
|
||||||
|
if (device != null)
|
||||||
|
{
|
||||||
|
if (device is IBridge) // Check for this first to allow bridges in plugins to override existing bridges that apply to the same type.
|
||||||
|
{
|
||||||
|
(device as IBridge).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (device is PepperDash.Essentials.Core.Monitoring.SystemMonitorController)
|
||||||
|
{
|
||||||
|
(device as PepperDash.Essentials.Core.Monitoring.SystemMonitorController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (device is GenericComm)
|
||||||
|
{
|
||||||
|
(device as GenericComm).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (device is CameraBase)
|
||||||
|
{
|
||||||
|
(device as CameraBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (device is PepperDash.Essentials.Core.DisplayBase)
|
||||||
|
{
|
||||||
|
(device as DisplayBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (device is DmChassisController)
|
||||||
|
{
|
||||||
|
(device as DmChassisController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (device is DmpsRoutingController)
|
||||||
|
{
|
||||||
|
(device as DmpsRoutingController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (device is DmpsAudioOutputController)
|
||||||
|
{
|
||||||
|
(device as DmpsAudioOutputController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (device is DmTxControllerBase)
|
||||||
|
{
|
||||||
|
(device as DmTxControllerBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (device is DmRmcControllerBase)
|
||||||
|
{
|
||||||
|
(device as DmRmcControllerBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (device is GenericRelayDevice)
|
||||||
|
{
|
||||||
|
(device as GenericRelayDevice).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (device is IDigitalInput)
|
||||||
|
{
|
||||||
|
(device as IDigitalInput).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (device is AppleTV)
|
||||||
|
{
|
||||||
|
(device as AppleTV).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (device is HdMdxxxCEController)
|
||||||
|
{
|
||||||
|
(device as HdMdxxxCEController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (device is LightingBase)
|
||||||
|
{
|
||||||
|
(device as LightingBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (device is DigitalLogger)
|
||||||
|
{
|
||||||
|
(device as DigitalLogger).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug.Console(1, this, "Devices Linked.");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Used for debugging to trigger an action based on a join number and type
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="join"></param>
|
||||||
|
/// <param name="type"></param>
|
||||||
|
public void ExecuteJoinAction(uint join, string type, object state)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
switch (type.ToLower())
|
||||||
|
{
|
||||||
|
case "digital":
|
||||||
|
{
|
||||||
|
var uo = Eisc.BooleanOutput[join].UserObject as Action<bool>;
|
||||||
|
if (uo != null)
|
||||||
|
{
|
||||||
|
Debug.Console(1, this, "Executing Action: {0}", uo.ToString());
|
||||||
|
uo(Convert.ToBoolean(state));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Debug.Console(1, this, "User Action is null. Nothing to Execute");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "analog":
|
||||||
|
{
|
||||||
|
var uo = Eisc.BooleanOutput[join].UserObject as Action<ushort>;
|
||||||
|
if (uo != null)
|
||||||
|
{
|
||||||
|
Debug.Console(1, this, "Executing Action: {0}", uo.ToString());
|
||||||
|
uo(Convert.ToUInt16(state));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Debug.Console(1, this, "User Action is null. Nothing to Execute"); break;
|
||||||
|
}
|
||||||
|
case "serial":
|
||||||
|
{
|
||||||
|
var uo = Eisc.BooleanOutput[join].UserObject as Action<string>;
|
||||||
|
if (uo != null)
|
||||||
|
{
|
||||||
|
Debug.Console(1, this, "Executing Action: {0}", uo.ToString());
|
||||||
|
uo(Convert.ToString(state));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Debug.Console(1, this, "User Action is null. Nothing to Execute");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
Debug.Console(1, "Unknown join type. Use digital/serial/analog");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.Console(1, this, "Error: {0}", e);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -64,150 +232,50 @@ namespace PepperDash.Essentials.Bridges
|
|||||||
/// <param name="args"></param>
|
/// <param name="args"></param>
|
||||||
void Eisc_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args)
|
void Eisc_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args)
|
||||||
{
|
{
|
||||||
if (Debug.Level >= 1)
|
try
|
||||||
Debug.Console(1, this, "BridgeApi EISC change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
|
{
|
||||||
var uo = args.Sig.UserObject;
|
if (Debug.Level >= 1)
|
||||||
if (uo is Action<bool>)
|
Debug.Console(1, this, "EiscApi change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
|
||||||
(uo as Action<bool>)(args.Sig.BoolValue);
|
var uo = args.Sig.UserObject;
|
||||||
else if (uo is Action<ushort>)
|
if (uo != null)
|
||||||
(uo as Action<ushort>)(args.Sig.UShortValue);
|
{
|
||||||
else if (uo is Action<string>)
|
Debug.Console(1, this, "Executing Action: {0}", uo.ToString());
|
||||||
(uo as Action<string>)(args.Sig.StringValue);
|
if (uo is Action<bool>)
|
||||||
|
(uo as Action<bool>)(args.Sig.BoolValue);
|
||||||
|
else if (uo is Action<ushort>)
|
||||||
|
(uo as Action<ushort>)(args.Sig.UShortValue);
|
||||||
|
else if (uo is Action<string>)
|
||||||
|
(uo as Action<string>)(args.Sig.StringValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.Console(2, this, "Error in Eisc_SigChange handler: {0}", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class EiscApiPropertiesConfig
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Defines each type and it's matching API type
|
|
||||||
/// </summary>
|
|
||||||
public static class DeviceApiFactory
|
|
||||||
{
|
{
|
||||||
public static Dictionary<Type, Type> TypeMap = new Dictionary<Type, Type>
|
[JsonProperty("control")]
|
||||||
|
public EssentialsControlPropertiesConfig Control { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("devices")]
|
||||||
|
public List<ApiDevice> Devices { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public class ApiDevice
|
||||||
{
|
{
|
||||||
{ typeof(DmChassisController), typeof(DmChassisControllerApi) },
|
[JsonProperty("deviceKey")]
|
||||||
{ typeof(IBasicCommunication), typeof(IBasicCommunicationApi) }
|
public string DeviceKey { get; set; }
|
||||||
//{ typeof(SomeShittyDisplayController), typeof(SomeShittyDisplayControllerApi) }
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
[JsonProperty("joinStart")]
|
||||||
|
public uint JoinStart { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
[JsonProperty("joinMapKey")]
|
||||||
/// API class for IBasicCommunication devices
|
public string JoinMapKey { get; set; }
|
||||||
/// </summary>
|
|
||||||
public class IBasicCommunicationApi : DeviceApiBase
|
|
||||||
{
|
|
||||||
public IBasicCommunication Device { get; set; }
|
|
||||||
|
|
||||||
SerialFeedback TextReceivedFeedback;
|
|
||||||
|
|
||||||
public IBasicCommunicationApi(IBasicCommunication dev)
|
|
||||||
{
|
|
||||||
TextReceivedFeedback = new SerialFeedback();
|
|
||||||
|
|
||||||
Device = dev;
|
|
||||||
|
|
||||||
SetupFeedbacks();
|
|
||||||
|
|
||||||
ActionApi = new Dictionary<string, Object>
|
|
||||||
{
|
|
||||||
{ "connect", new Action(Device.Connect) },
|
|
||||||
{ "disconnect", new Action(Device.Disconnect) },
|
|
||||||
{ "connectstate", new Action<bool>( b => ConnectByState(b) ) },
|
|
||||||
{ "sendtext", new Action<string>( s => Device.SendText(s) ) }
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
FeedbackApi = new Dictionary<string, Feedback>
|
|
||||||
{
|
|
||||||
{ "isconnected", new BoolFeedback( () => Device.IsConnected ) },
|
|
||||||
{ "textrecieved", TextReceivedFeedback }
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Controls connection based on state of input
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="state"></param>
|
|
||||||
void ConnectByState(bool state)
|
|
||||||
{
|
|
||||||
if (state)
|
|
||||||
Device.Connect();
|
|
||||||
else
|
|
||||||
Device.Disconnect();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetupFeedbacks()
|
|
||||||
{
|
|
||||||
Device.TextReceived += new EventHandler<GenericCommMethodReceiveTextArgs>(Device_TextReceived);
|
|
||||||
|
|
||||||
if(Device is ISocketStatus)
|
|
||||||
(Device as ISocketStatus).ConnectionChange += new EventHandler<GenericSocketStatusChageEventArgs>(IBasicCommunicationApi_ConnectionChange);
|
|
||||||
}
|
|
||||||
|
|
||||||
void IBasicCommunicationApi_ConnectionChange(object sender, GenericSocketStatusChageEventArgs e)
|
|
||||||
{
|
|
||||||
FeedbackApi["isconnected"].FireUpdate();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Device_TextReceived(object sender, GenericCommMethodReceiveTextArgs e)
|
|
||||||
{
|
|
||||||
TextReceivedFeedback.FireUpdate(e.Text);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public class DmChassisController : Device
|
|
||||||
{
|
|
||||||
public DmChassisController(string key)
|
|
||||||
: base(key)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetInput(int input)
|
|
||||||
{
|
|
||||||
Debug.Console(2, this, "Dm Chassis {0}, input {1}", Key, input);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Each flavor of API is a static class with static properties and a static constructor that
|
|
||||||
/// links up the things to do.
|
|
||||||
/// </summary>
|
|
||||||
public class DmChassisControllerApi : DeviceApiBase
|
|
||||||
{
|
|
||||||
IntFeedback Output1Feedback;
|
|
||||||
IntFeedback Output2Feedback;
|
|
||||||
|
|
||||||
public DmChassisControllerApi(DmChassisController dev)
|
|
||||||
{
|
|
||||||
Output1Feedback = new IntFeedback( new Func<int>(() => 1));
|
|
||||||
Output2Feedback = new IntFeedback( new Func<int>(() => 2));
|
|
||||||
|
|
||||||
ActionApi = new Dictionary<string, Object>
|
|
||||||
{
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
FeedbackApi = new Dictionary<string, Feedback>
|
|
||||||
{
|
|
||||||
{ "Output-1/fb", Output1Feedback },
|
|
||||||
{ "Output-2/fb", Output2Feedback }
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Factory method
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="dev"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static DmChassisControllerApi GetActionApiForDevice(DmChassisController dev)
|
|
||||||
{
|
|
||||||
return new DmChassisControllerApi(dev);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -9,83 +9,38 @@ using PepperDash.Essentials.Core;
|
|||||||
using PepperDash.Essentials.Core.Config;
|
using PepperDash.Essentials.Core.Config;
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core.Routing;
|
using PepperDash.Essentials.Core.Routing;
|
||||||
|
using PepperDash.Essentials.Bridges;
|
||||||
using Crestron.SimplSharpPro;
|
using Crestron.SimplSharpPro;
|
||||||
using Crestron.SimplSharpPro.EthernetCommunication;
|
using Crestron.SimplSharpPro.EthernetCommunication;
|
||||||
|
|
||||||
namespace PepperDash.Essentials
|
namespace PepperDash.Essentials
|
||||||
{
|
{
|
||||||
public class BridgeFactory
|
public class BridgeFactory
|
||||||
{
|
{
|
||||||
public static IKeyed GetDevice(PepperDash.Essentials.Core.Config.DeviceConfig dc)
|
public static IKeyed GetDevice(DeviceConfig dc)
|
||||||
{
|
{
|
||||||
// ? why is this static JTA 2018-06-13?
|
// ? why is this static JTA 2018-06-13?
|
||||||
|
|
||||||
var key = dc.Key;
|
|
||||||
var name = dc.Name;
|
|
||||||
var type = dc.Type;
|
|
||||||
var properties = dc.Properties;
|
|
||||||
var propAnon = new { };
|
|
||||||
JsonConvert.DeserializeAnonymousType(dc.Properties.ToString(), propAnon);
|
|
||||||
|
|
||||||
var typeName = dc.Type.ToLower();
|
|
||||||
var groupName = dc.Group.ToLower();
|
|
||||||
|
|
||||||
Debug.Console(0, "Name {0}, Key {1}, Type {2}, Properties {3}", name, key, type, properties.ToString());
|
var key = dc.Key;
|
||||||
if (typeName == "dm")
|
var name = dc.Name;
|
||||||
|
var type = dc.Type;
|
||||||
|
var properties = dc.Properties;
|
||||||
|
var propAnon = new { };
|
||||||
|
|
||||||
|
var typeName = dc.Type.ToLower();
|
||||||
|
var groupName = dc.Group.ToLower();
|
||||||
|
|
||||||
|
//Debug.Console(2, "Name {0}, Key {1}, Type {2}, Properties {3}", name, key, type, properties.ToString());
|
||||||
|
|
||||||
|
if (typeName == "eiscapi")
|
||||||
{
|
{
|
||||||
return new DmBridge(key, name, properties);
|
return new EiscApi(dc);
|
||||||
}
|
|
||||||
else if (typeName == "comm")
|
|
||||||
{
|
|
||||||
return new CommBridge(key, name, properties);
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class DmBridge : Device
|
return null;
|
||||||
{
|
}
|
||||||
public EiscBridgeProperties Properties { get; private set; }
|
}
|
||||||
|
|
||||||
public PepperDash.Essentials.DM.DmChassisController DmSwitch { get; private set; }
|
|
||||||
|
|
||||||
public DmBridge(string key, string name, JToken properties) : base(key, name)
|
|
||||||
{
|
|
||||||
Properties = JsonConvert.DeserializeObject<EiscBridgeProperties>(properties.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool CustomActivate()
|
|
||||||
{
|
|
||||||
// Create EiscApis
|
|
||||||
if (Properties.Eiscs != null)
|
|
||||||
{
|
|
||||||
foreach (var eisc in Properties.Eiscs)
|
|
||||||
{
|
|
||||||
var ApiEisc = new BridgeApiEisc(eisc.IpId, eisc.Hostname);
|
|
||||||
|
|
||||||
ApiEisc.Eisc.SetUShortSigAction(101, u => DmSwitch.ExecuteSwitch(u,1, eRoutingSignalType.Video));
|
|
||||||
ApiEisc.Eisc.SetUShortSigAction(102, u => DmSwitch.ExecuteSwitch(u,2, eRoutingSignalType.Video));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var device in DeviceManager.AllDevices)
|
|
||||||
{
|
|
||||||
if (device.Key == this.Properties.ParentDeviceKey)
|
|
||||||
{
|
|
||||||
Debug.Console(0, "deviceKey {0} Matches", device.Key);
|
|
||||||
DmSwitch = DeviceManager.GetDeviceForKey(device.Key) as PepperDash.Essentials.DM.DmChassisController;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Debug.Console(0, "deviceKey {0} doesn't match", device.Key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Debug.Console(0, "Bridge {0} Activated", this.Name);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class CommBridge : Device
|
public class CommBridge : Device
|
||||||
{
|
{
|
||||||
@@ -134,10 +89,10 @@ namespace PepperDash.Essentials
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public class EiscBridgeProperties
|
public class EiscBridgeProperties
|
||||||
{
|
{
|
||||||
public string ParentDeviceKey { get; set; }
|
public string ParentDeviceKey { get; set; }
|
||||||
public eApiType ApiType { get; set; }
|
public eApiType ApiType { get; set; }
|
||||||
public List<EiscProperties> Eiscs { get; set; }
|
public List<EiscProperties> Eiscs { get; set; }
|
||||||
public string ApiOverrideFilePath { get; set; }
|
public string ApiOverrideFilePath { get; set; }
|
||||||
|
|
||||||
@@ -146,7 +101,7 @@ namespace PepperDash.Essentials
|
|||||||
public string IpId { get; set; }
|
public string IpId { get; set; }
|
||||||
public string Hostname { get; set; }
|
public string Hostname { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CommBridgeProperties : EiscBridgeProperties
|
public class CommBridgeProperties : EiscBridgeProperties
|
||||||
{
|
{
|
||||||
@@ -155,30 +110,30 @@ namespace PepperDash.Essentials
|
|||||||
|
|
||||||
public enum eApiType { Eisc = 0 }
|
public enum eApiType { Eisc = 0 }
|
||||||
|
|
||||||
public class BridgeApiEisc
|
public class BridgeApiEisc
|
||||||
{
|
{
|
||||||
public uint Ipid { get; private set; }
|
public uint Ipid { get; private set; }
|
||||||
public ThreeSeriesTcpIpEthernetIntersystemCommunications Eisc { get; private set; }
|
public ThreeSeriesTcpIpEthernetIntersystemCommunications Eisc { get; private set; }
|
||||||
|
|
||||||
public BridgeApiEisc(string ipid, string hostname)
|
public BridgeApiEisc(string ipid, string hostname)
|
||||||
{
|
{
|
||||||
Ipid = (UInt32)int.Parse(ipid, System.Globalization.NumberStyles.HexNumber);
|
Ipid = (UInt32)int.Parse(ipid, System.Globalization.NumberStyles.HexNumber);
|
||||||
Eisc = new ThreeSeriesTcpIpEthernetIntersystemCommunications(Ipid, hostname, Global.ControlSystem);
|
Eisc = new ThreeSeriesTcpIpEthernetIntersystemCommunications(Ipid, hostname, Global.ControlSystem);
|
||||||
Eisc.Register();
|
Eisc.Register();
|
||||||
Eisc.SigChange += Eisc_SigChange;
|
Eisc.SigChange += Eisc_SigChange;
|
||||||
Debug.Console(0, "BridgeApiEisc Created at Ipid {0}", ipid);
|
Debug.Console(0, "BridgeApiEisc Created at Ipid {0}", ipid);
|
||||||
}
|
}
|
||||||
void Eisc_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args)
|
void Eisc_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args)
|
||||||
{
|
{
|
||||||
if (Debug.Level >= 1)
|
if (Debug.Level >= 1)
|
||||||
Debug.Console(1, "BridgeApiEisc change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
|
Debug.Console(1, "BridgeApiEisc change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
|
||||||
var uo = args.Sig.UserObject;
|
var uo = args.Sig.UserObject;
|
||||||
if (uo is Action<bool>)
|
if (uo is Action<bool>)
|
||||||
(uo as Action<bool>)(args.Sig.BoolValue);
|
(uo as Action<bool>)(args.Sig.BoolValue);
|
||||||
else if (uo is Action<ushort>)
|
else if (uo is Action<ushort>)
|
||||||
(uo as Action<ushort>)(args.Sig.UShortValue);
|
(uo as Action<ushort>)(args.Sig.UShortValue);
|
||||||
else if (uo is Action<string>)
|
else if (uo is Action<string>)
|
||||||
(uo as Action<string>)(args.Sig.StringValue);
|
(uo as Action<string>)(args.Sig.StringValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
90
PepperDashEssentials/Bridges/Bridges.BridgeFactory.cs
Normal file
90
PepperDashEssentials/Bridges/Bridges.BridgeFactory.cs
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.Core.Config;
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core.Routing;
|
||||||
|
using Crestron.SimplSharpPro;
|
||||||
|
using Crestron.SimplSharpPro.EthernetCommunication;
|
||||||
|
using PepperDash.Essentials.Bridges;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials {
|
||||||
|
public class BridgeFactory {
|
||||||
|
public static IKeyed GetDevice(PepperDash.Essentials.Core.Config.DeviceConfig dc) {
|
||||||
|
// ? why is this static JTA 2018-06-13?
|
||||||
|
|
||||||
|
var key = dc.Key;
|
||||||
|
var name = dc.Name;
|
||||||
|
var type = dc.Type;
|
||||||
|
var properties = dc.Properties;
|
||||||
|
var propAnon = new { };
|
||||||
|
JsonConvert.DeserializeAnonymousType(dc.Properties.ToString(), propAnon);
|
||||||
|
|
||||||
|
var typeName = dc.Type.ToLower();
|
||||||
|
var groupName = dc.Group.ToLower();
|
||||||
|
|
||||||
|
Debug.Console(2, "Name {0}, Key {1}, Type {2}, Properties {3}", name, key, type, properties.ToString());
|
||||||
|
if (typeName == "essentialdm")
|
||||||
|
{
|
||||||
|
return new EssentialDM(key, name, properties);
|
||||||
|
}
|
||||||
|
else if (typeName == "essentialcomm")
|
||||||
|
{
|
||||||
|
Debug.Console(2, "Launch Essential Comm");
|
||||||
|
return new EssentialComm(key, name, properties);
|
||||||
|
}
|
||||||
|
else if (typeName == "essentialdsp")
|
||||||
|
{
|
||||||
|
Debug.Console(2, "Launch EssentialDsp");
|
||||||
|
return new EssentialDsp(key, name, properties);
|
||||||
|
}
|
||||||
|
else if (typeName == "essentialstvone")
|
||||||
|
{
|
||||||
|
Debug.Console(2, "Launch essentialstvone");
|
||||||
|
return new EssentialsTVOne(key, name, properties);
|
||||||
|
}
|
||||||
|
else if (typeName == "essentialslighting")
|
||||||
|
{
|
||||||
|
Debug.Console(2, "Launch essentialslighting");
|
||||||
|
return new EssentialsLightsBridge(key, name, properties);
|
||||||
|
}
|
||||||
|
else if (typeName == "eiscapi")
|
||||||
|
{
|
||||||
|
return new EiscApi(dc);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class BridgeApiEisc {
|
||||||
|
public uint Ipid;
|
||||||
|
public ThreeSeriesTcpIpEthernetIntersystemCommunications Eisc;
|
||||||
|
public BridgeApiEisc(string ipid) {
|
||||||
|
Ipid = (UInt32)int.Parse(ipid, System.Globalization.NumberStyles.HexNumber);
|
||||||
|
Eisc = new ThreeSeriesTcpIpEthernetIntersystemCommunications(Ipid, "127.0.0.2", Global.ControlSystem);
|
||||||
|
Eisc.Register();
|
||||||
|
Eisc.SigChange += Eisc_SigChange;
|
||||||
|
Debug.Console(2, "BridgeApiEisc Created at Ipid {0}", ipid);
|
||||||
|
}
|
||||||
|
void Eisc_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args) {
|
||||||
|
if (Debug.Level >= 1)
|
||||||
|
Debug.Console(2, "DDVC EISC change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
|
||||||
|
var uo = args.Sig.UserObject;
|
||||||
|
if (uo is Action<bool>)
|
||||||
|
(uo as Action<bool>)(args.Sig.BoolValue);
|
||||||
|
else if (uo is Action<ushort>)
|
||||||
|
(uo as Action<ushort>)(args.Sig.UShortValue);
|
||||||
|
else if (uo is Action<string>)
|
||||||
|
(uo as Action<string>)(args.Sig.StringValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
137
PepperDashEssentials/Bridges/CameraControllerBridge.cs
Normal file
137
PepperDashEssentials/Bridges/CameraControllerBridge.cs
Normal file
@@ -0,0 +1,137 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.Devices.Common;
|
||||||
|
using PepperDash.Essentials.Devices.Common.Cameras;
|
||||||
|
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Bridges
|
||||||
|
{
|
||||||
|
public static class CameraControllerApiExtensions
|
||||||
|
{
|
||||||
|
|
||||||
|
public static void LinkToApi(this PepperDash.Essentials.Devices.Common.Cameras.CameraBase cameraDevice, BasicTriList trilist, uint joinStart, string joinMapKey)
|
||||||
|
{
|
||||||
|
CameraControllerJoinMap joinMap = new CameraControllerJoinMap();
|
||||||
|
|
||||||
|
var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey);
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(joinMapSerialized))
|
||||||
|
joinMap = JsonConvert.DeserializeObject<CameraControllerJoinMap>(joinMapSerialized);
|
||||||
|
|
||||||
|
joinMap.OffsetJoinNumbers(joinStart);
|
||||||
|
|
||||||
|
Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||||
|
Debug.Console(0, "Linking to Bridge Type {0}", cameraDevice.GetType().Name.ToString());
|
||||||
|
|
||||||
|
var commMonitor = cameraDevice as ICommunicationMonitor;
|
||||||
|
commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]);
|
||||||
|
|
||||||
|
var ptzCamera = cameraDevice as IHasCameraPtzControl;
|
||||||
|
|
||||||
|
if (ptzCamera != null)
|
||||||
|
{
|
||||||
|
trilist.SetBoolSigAction(joinMap.Left, (b) =>
|
||||||
|
{
|
||||||
|
if (b)
|
||||||
|
{
|
||||||
|
ptzCamera.PanLeft();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ptzCamera.PanStop();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
trilist.SetBoolSigAction(joinMap.Right, (b) =>
|
||||||
|
{
|
||||||
|
if (b)
|
||||||
|
{
|
||||||
|
ptzCamera.PanRight();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ptzCamera.PanStop();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
trilist.SetBoolSigAction(joinMap.Up, (b) =>
|
||||||
|
{
|
||||||
|
if (b)
|
||||||
|
{
|
||||||
|
ptzCamera.TiltUp();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ptzCamera.TiltStop();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
trilist.SetBoolSigAction(joinMap.Down, (b) =>
|
||||||
|
{
|
||||||
|
if (b)
|
||||||
|
{
|
||||||
|
ptzCamera.TiltDown();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ptzCamera.TiltStop();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
trilist.SetBoolSigAction(joinMap.ZoomIn, (b) =>
|
||||||
|
{
|
||||||
|
if (b)
|
||||||
|
{
|
||||||
|
ptzCamera.ZoomIn();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ptzCamera.ZoomStop();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
trilist.SetBoolSigAction(joinMap.ZoomOut, (b) =>
|
||||||
|
{
|
||||||
|
if (b)
|
||||||
|
{
|
||||||
|
ptzCamera.ZoomOut();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ptzCamera.ZoomStop();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cameraDevice.GetType().Name.ToString().ToLower() == "cameravisca")
|
||||||
|
{
|
||||||
|
var viscaCamera = cameraDevice as PepperDash.Essentials.Devices.Common.Cameras.CameraVisca;
|
||||||
|
trilist.SetSigTrueAction(joinMap.PowerOn, () => viscaCamera.PowerOn());
|
||||||
|
trilist.SetSigTrueAction(joinMap.PowerOff, () => viscaCamera.PowerOff());
|
||||||
|
|
||||||
|
viscaCamera.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PowerOn]);
|
||||||
|
viscaCamera.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.PowerOff]);
|
||||||
|
|
||||||
|
viscaCamera.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]);
|
||||||
|
for (int i = 0; i < joinMap.NumberOfPresets; i++)
|
||||||
|
{
|
||||||
|
int tempNum = i;
|
||||||
|
trilist.SetSigTrueAction((ushort)(joinMap.PresetRecallOffset + tempNum), () =>
|
||||||
|
{
|
||||||
|
viscaCamera.RecallPreset(tempNum);
|
||||||
|
});
|
||||||
|
trilist.SetSigTrueAction((ushort)(joinMap.PresetSaveOffset + tempNum), () =>
|
||||||
|
{
|
||||||
|
viscaCamera.SavePreset(tempNum);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
42
PepperDashEssentials/Bridges/DigitalLoggerBridge.cs
Normal file
42
PepperDashEssentials/Bridges/DigitalLoggerBridge.cs
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.Devices.Common;
|
||||||
|
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Bridges
|
||||||
|
{
|
||||||
|
public static class DigitalLoggerApiExtensions
|
||||||
|
{
|
||||||
|
public static void LinkToApi(this DigitalLogger DigitalLogger, BasicTriList trilist, uint joinStart, string joinMapKey)
|
||||||
|
{
|
||||||
|
DigitalLoggerJoinMap joinMap = new DigitalLoggerJoinMap();
|
||||||
|
|
||||||
|
var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey);
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(joinMapSerialized))
|
||||||
|
joinMap = JsonConvert.DeserializeObject<DigitalLoggerJoinMap>(joinMapSerialized);
|
||||||
|
|
||||||
|
joinMap.OffsetJoinNumbers(joinStart);
|
||||||
|
|
||||||
|
Debug.Console(1, DigitalLogger, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||||
|
for (uint i = 1; i <= DigitalLogger.CircuitCount; i++)
|
||||||
|
{
|
||||||
|
var circuit = i;
|
||||||
|
DigitalLogger.CircuitNameFeedbacks[circuit - 1].LinkInputSig(trilist.StringInput[joinMap.CircuitNames + circuit]);
|
||||||
|
DigitalLogger.CircuitIsCritical[circuit - 1].LinkInputSig(trilist.BooleanInput[joinMap.CircuitIsCritical + circuit]);
|
||||||
|
DigitalLogger.CircuitState[circuit - 1].LinkInputSig(trilist.BooleanInput[joinMap.CircuitState + circuit]);
|
||||||
|
trilist.SetSigTrueAction(joinMap.CircuitCycle + circuit, () => DigitalLogger.CycleCircuit(circuit - 1));
|
||||||
|
trilist.SetSigTrueAction(joinMap.CircuitOnCmd + circuit, () => DigitalLogger.TurnOnCircuit(circuit - 1));
|
||||||
|
trilist.SetSigTrueAction(joinMap.CircuitOffCmd + circuit, () => DigitalLogger.TurnOffCircuit(circuit - 1));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
153
PepperDashEssentials/Bridges/DisplayControllerBridge.cs
Normal file
153
PepperDashEssentials/Bridges/DisplayControllerBridge.cs
Normal file
@@ -0,0 +1,153 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.Devices.Common;
|
||||||
|
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Bridges
|
||||||
|
{
|
||||||
|
public static class DisplayControllerApiExtensions
|
||||||
|
{
|
||||||
|
public static void LinkToApi(this PepperDash.Essentials.Core.DisplayBase displayDevice, BasicTriList trilist, uint joinStart, string joinMapKey)
|
||||||
|
{
|
||||||
|
int inputNumber = 0;
|
||||||
|
IntFeedback inputNumberFeedback;
|
||||||
|
List<string> inputKeys = new List<string>();
|
||||||
|
|
||||||
|
DisplayControllerJoinMap joinMap = new DisplayControllerJoinMap();
|
||||||
|
|
||||||
|
var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey);
|
||||||
|
|
||||||
|
if(!string.IsNullOrEmpty(joinMapSerialized))
|
||||||
|
joinMap = JsonConvert.DeserializeObject<DisplayControllerJoinMap>(joinMapSerialized);
|
||||||
|
|
||||||
|
joinMap.OffsetJoinNumbers(joinStart);
|
||||||
|
|
||||||
|
Debug.Console(1, "Linking to Trilist '{0}'",trilist.ID.ToString("X"));
|
||||||
|
Debug.Console(0, "Linking to Display: {0}", displayDevice.Name);
|
||||||
|
|
||||||
|
trilist.StringInput[joinMap.Name].StringValue = displayDevice.Name;
|
||||||
|
|
||||||
|
var commMonitor = displayDevice as ICommunicationMonitor;
|
||||||
|
if (commMonitor != null)
|
||||||
|
{
|
||||||
|
commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]);
|
||||||
|
}
|
||||||
|
|
||||||
|
inputNumberFeedback = new IntFeedback(() => { return inputNumber; });
|
||||||
|
|
||||||
|
// Two way feedbacks
|
||||||
|
var twoWayDisplay = displayDevice as PepperDash.Essentials.Core.TwoWayDisplayBase;
|
||||||
|
if (twoWayDisplay != null)
|
||||||
|
{
|
||||||
|
trilist.SetBool(joinMap.IsTwoWayDisplay, true);
|
||||||
|
|
||||||
|
twoWayDisplay.CurrentInputFeedback.OutputChange += new EventHandler<FeedbackEventArgs>(CurrentInputFeedback_OutputChange);
|
||||||
|
|
||||||
|
|
||||||
|
inputNumberFeedback.LinkInputSig(trilist.UShortInput[joinMap.InputSelect]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Power Off
|
||||||
|
trilist.SetSigTrueAction(joinMap.PowerOff, () =>
|
||||||
|
{
|
||||||
|
inputNumber = 102;
|
||||||
|
inputNumberFeedback.FireUpdate();
|
||||||
|
displayDevice.PowerOff();
|
||||||
|
});
|
||||||
|
|
||||||
|
displayDevice.PowerIsOnFeedback.OutputChange += new EventHandler<FeedbackEventArgs>( (o,a) => {
|
||||||
|
if (!a.BoolValue)
|
||||||
|
{
|
||||||
|
inputNumber = 102;
|
||||||
|
inputNumberFeedback.FireUpdate();
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
inputNumber = 0;
|
||||||
|
inputNumberFeedback.FireUpdate();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
displayDevice.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.PowerOff]);
|
||||||
|
|
||||||
|
// PowerOn
|
||||||
|
trilist.SetSigTrueAction(joinMap.PowerOn, () =>
|
||||||
|
{
|
||||||
|
inputNumber = 0;
|
||||||
|
inputNumberFeedback.FireUpdate();
|
||||||
|
displayDevice.PowerOn();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
displayDevice.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PowerOn]);
|
||||||
|
|
||||||
|
int count = 1;
|
||||||
|
foreach (var input in displayDevice.InputPorts)
|
||||||
|
{
|
||||||
|
inputKeys.Add(input.Key.ToString());
|
||||||
|
var tempKey = inputKeys.ElementAt(count - 1);
|
||||||
|
trilist.SetSigTrueAction((ushort)(joinMap.InputSelectOffset + count), () => { displayDevice.ExecuteSwitch(displayDevice.InputPorts[tempKey].Selector); });
|
||||||
|
Debug.Console(2, displayDevice, "Setting Input Select Action on Digital Join {0} to Input: {1}", joinMap.InputSelectOffset + count, displayDevice.InputPorts[tempKey].Key.ToString());
|
||||||
|
trilist.StringInput[(ushort)(joinMap.InputNamesOffset + count)].StringValue = input.Key.ToString();
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug.Console(2, displayDevice, "Setting Input Select Action on Analog Join {0}", joinMap.InputSelect);
|
||||||
|
trilist.SetUShortSigAction(joinMap.InputSelect, (a) =>
|
||||||
|
{
|
||||||
|
if (a == 0)
|
||||||
|
{
|
||||||
|
displayDevice.PowerOff();
|
||||||
|
inputNumber = 0;
|
||||||
|
}
|
||||||
|
else if (a > 0 && a < displayDevice.InputPorts.Count && a != inputNumber)
|
||||||
|
{
|
||||||
|
displayDevice.ExecuteSwitch(displayDevice.InputPorts.ElementAt(a - 1).Selector);
|
||||||
|
inputNumber = a;
|
||||||
|
}
|
||||||
|
else if (a == 102)
|
||||||
|
{
|
||||||
|
displayDevice.PowerToggle();
|
||||||
|
|
||||||
|
}
|
||||||
|
if (twoWayDisplay != null)
|
||||||
|
inputNumberFeedback.FireUpdate();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
var volumeDisplay = displayDevice as IBasicVolumeControls;
|
||||||
|
if (volumeDisplay != null)
|
||||||
|
{
|
||||||
|
trilist.SetBoolSigAction(joinMap.VolumeUp, (b) => volumeDisplay.VolumeUp(b));
|
||||||
|
trilist.SetBoolSigAction(joinMap.VolumeDown, (b) => volumeDisplay.VolumeDown(b));
|
||||||
|
trilist.SetSigTrueAction(joinMap.VolumeMute, () => volumeDisplay.MuteToggle());
|
||||||
|
|
||||||
|
var volumeDisplayWithFeedback = volumeDisplay as IBasicVolumeWithFeedback;
|
||||||
|
if(volumeDisplayWithFeedback != null)
|
||||||
|
{
|
||||||
|
trilist.SetUShortSigAction(joinMap.VolumeLevel, new Action<ushort>((u) => volumeDisplayWithFeedback.SetVolume(u)));
|
||||||
|
volumeDisplayWithFeedback.VolumeLevelFeedback.LinkInputSig(trilist.UShortInput[joinMap.VolumeLevel]);
|
||||||
|
volumeDisplayWithFeedback.MuteFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VolumeMute]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void CurrentInputFeedback_OutputChange(object sender, FeedbackEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
Debug.Console(0, "CurrentInputFeedback_OutputChange {0}", e.StringValue);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
214
PepperDashEssentials/Bridges/DmChassisControllerBridge.cs
Normal file
214
PepperDashEssentials/Bridges/DmChassisControllerBridge.cs
Normal file
@@ -0,0 +1,214 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
using Crestron.SimplSharpPro.DM;
|
||||||
|
using Crestron.SimplSharpPro.DM.Endpoints;
|
||||||
|
using Crestron.SimplSharpPro.DM.Endpoints.Transmitters;
|
||||||
|
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.DM;
|
||||||
|
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Bridges
|
||||||
|
{
|
||||||
|
public static class DmChassisControllerApiExtentions
|
||||||
|
{
|
||||||
|
public static void LinkToApi(this DmChassisController dmChassis, BasicTriList trilist, uint joinStart, string joinMapKey)
|
||||||
|
{
|
||||||
|
DmChassisControllerJoinMap joinMap = new DmChassisControllerJoinMap();
|
||||||
|
|
||||||
|
var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey);
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(joinMapSerialized))
|
||||||
|
joinMap = JsonConvert.DeserializeObject<DmChassisControllerJoinMap>(joinMapSerialized);
|
||||||
|
|
||||||
|
|
||||||
|
joinMap.OffsetJoinNumbers(joinStart);
|
||||||
|
|
||||||
|
Debug.Console(1, dmChassis, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||||
|
|
||||||
|
dmChassis.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]);
|
||||||
|
|
||||||
|
trilist.SetUShortSigAction(joinMap.SystemId, new Action<ushort>(o => dmChassis.Chassis.SystemId.UShortValue = o));
|
||||||
|
trilist.SetSigTrueAction(joinMap.SystemId, new Action(() => dmChassis.Chassis.ApplySystemId()));
|
||||||
|
|
||||||
|
dmChassis.SystemIdFeebdack.LinkInputSig(trilist.UShortInput[joinMap.SystemId]);
|
||||||
|
dmChassis.SystemIdBusyFeedback.LinkInputSig(trilist.BooleanInput[joinMap.SystemId]);
|
||||||
|
|
||||||
|
// Link up outputs
|
||||||
|
for (uint i = 1; i <= dmChassis.Chassis.NumberOfOutputs; i++)
|
||||||
|
{
|
||||||
|
var ioSlot = i;
|
||||||
|
|
||||||
|
// Control
|
||||||
|
trilist.SetUShortSigAction(joinMap.OutputVideo + ioSlot, new Action<ushort>(o => dmChassis.ExecuteSwitch(o, ioSlot, eRoutingSignalType.Video)));
|
||||||
|
trilist.SetUShortSigAction(joinMap.OutputAudio + ioSlot, new Action<ushort>(o => dmChassis.ExecuteSwitch(o, ioSlot, eRoutingSignalType.Audio)));
|
||||||
|
trilist.SetUShortSigAction(joinMap.OutputUsb + ioSlot, new Action<ushort>(o => dmChassis.ExecuteSwitch(o, ioSlot, eRoutingSignalType.UsbOutput)));
|
||||||
|
trilist.SetUShortSigAction(joinMap.InputUsb + ioSlot, new Action<ushort>(o => dmChassis.ExecuteSwitch(o, ioSlot, eRoutingSignalType.UsbInput)));
|
||||||
|
|
||||||
|
if (dmChassis.TxDictionary.ContainsKey(ioSlot))
|
||||||
|
{
|
||||||
|
Debug.Console(2, "Creating Tx Feedbacks {0}", ioSlot);
|
||||||
|
var txKey = dmChassis.TxDictionary[ioSlot];
|
||||||
|
var basicTxDevice = DeviceManager.GetDeviceForKey(txKey) as BasicDmTxControllerBase;
|
||||||
|
|
||||||
|
var txDevice = basicTxDevice as DmTxControllerBase;
|
||||||
|
|
||||||
|
if (dmChassis.Chassis is DmMd8x8Cpu3 || dmChassis.Chassis is DmMd8x8Cpu3rps
|
||||||
|
|| dmChassis.Chassis is DmMd16x16Cpu3 || dmChassis.Chassis is DmMd16x16Cpu3rps
|
||||||
|
|| dmChassis.Chassis is DmMd32x32Cpu3 || dmChassis.Chassis is DmMd32x32Cpu3rps)
|
||||||
|
{
|
||||||
|
dmChassis.InputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (txDevice != null)
|
||||||
|
{
|
||||||
|
txDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (basicTxDevice != null && txDevice == null)
|
||||||
|
trilist.BooleanInput[joinMap.TxAdvancedIsPresent + ioSlot].BoolValue = true;
|
||||||
|
|
||||||
|
|
||||||
|
if (txDevice != null)
|
||||||
|
{
|
||||||
|
txDevice.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus + ioSlot]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dmChassis.VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus + ioSlot]);
|
||||||
|
|
||||||
|
var inputPort = dmChassis.InputPorts[string.Format("inputCard{0}--hdmiIn", ioSlot)];
|
||||||
|
if (inputPort != null)
|
||||||
|
{
|
||||||
|
var hdmiInPort = inputPort.Port;
|
||||||
|
|
||||||
|
if (hdmiInPort != null)
|
||||||
|
{
|
||||||
|
if (hdmiInPort is HdmiInputWithCEC)
|
||||||
|
{
|
||||||
|
var hdmiInPortWCec = hdmiInPort as HdmiInputWithCEC;
|
||||||
|
|
||||||
|
if (hdmiInPortWCec.HdcpSupportedLevel != eHdcpSupportedLevel.Unknown)
|
||||||
|
{
|
||||||
|
SetHdcpCapabilityAction(true, hdmiInPortWCec, joinMap.HdcpSupportState + ioSlot, trilist);
|
||||||
|
}
|
||||||
|
|
||||||
|
dmChassis.InputCardHdcpCapabilityFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.HdcpSupportState + ioSlot]);
|
||||||
|
|
||||||
|
trilist.UShortInput[joinMap.HdcpSupportCapability + ioSlot].UShortValue = (ushort)dmChassis.InputCardHdcpCapabilityTypes[ioSlot];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dmChassis.VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus + ioSlot]);
|
||||||
|
|
||||||
|
var inputPort = dmChassis.InputPorts[string.Format("inputCard{0}--hdmiIn", ioSlot)];
|
||||||
|
if (inputPort != null)
|
||||||
|
{
|
||||||
|
var hdmiPort = inputPort.Port as EndpointHdmiInput;
|
||||||
|
|
||||||
|
if (hdmiPort != null)
|
||||||
|
{
|
||||||
|
SetHdcpCapabilityAction(true, hdmiPort, joinMap.HdcpSupportState + ioSlot, trilist);
|
||||||
|
dmChassis.InputCardHdcpCapabilityFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.HdcpSupportState + ioSlot]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (dmChassis.RxDictionary.ContainsKey(ioSlot))
|
||||||
|
{
|
||||||
|
Debug.Console(2, "Creating Rx Feedbacks {0}", ioSlot);
|
||||||
|
var RxKey = dmChassis.RxDictionary[ioSlot];
|
||||||
|
var RxDevice = DeviceManager.GetDeviceForKey(RxKey) as DmRmcControllerBase;
|
||||||
|
if (dmChassis.Chassis is DmMd8x8Cpu3 || dmChassis.Chassis is DmMd8x8Cpu3rps
|
||||||
|
|| dmChassis.Chassis is DmMd16x16Cpu3 || dmChassis.Chassis is DmMd16x16Cpu3rps
|
||||||
|
|| dmChassis.Chassis is DmMd32x32Cpu3 || dmChassis.Chassis is DmMd32x32Cpu3rps)
|
||||||
|
{
|
||||||
|
dmChassis.OutputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline + ioSlot]);
|
||||||
|
}
|
||||||
|
else if (RxDevice != null)
|
||||||
|
{
|
||||||
|
RxDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline + ioSlot]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Feedback
|
||||||
|
dmChassis.VideoOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputVideo + ioSlot]);
|
||||||
|
dmChassis.AudioOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputAudio + ioSlot]);
|
||||||
|
dmChassis.UsbOutputRoutedToFeebacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputUsb + ioSlot]);
|
||||||
|
dmChassis.UsbInputRoutedToFeebacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.InputUsb + ioSlot]);
|
||||||
|
|
||||||
|
|
||||||
|
dmChassis.OutputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputNames + ioSlot]);
|
||||||
|
dmChassis.InputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.InputNames + ioSlot]);
|
||||||
|
dmChassis.OutputVideoRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentVideoInputNames + ioSlot]);
|
||||||
|
dmChassis.OutputAudioRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentAudioInputNames + ioSlot]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void SetHdcpCapabilityAction(bool hdcpTypeSimple, HdmiInputWithCEC port, uint join, BasicTriList trilist)
|
||||||
|
{
|
||||||
|
if (hdcpTypeSimple)
|
||||||
|
{
|
||||||
|
trilist.SetUShortSigAction(join,
|
||||||
|
new Action<ushort>(s =>
|
||||||
|
{
|
||||||
|
if (s == 0)
|
||||||
|
{
|
||||||
|
port.HdcpSupportOff();
|
||||||
|
}
|
||||||
|
else if (s > 0)
|
||||||
|
{
|
||||||
|
port.HdcpSupportOn();
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
trilist.SetUShortSigAction(join,
|
||||||
|
new Action<ushort>(s =>
|
||||||
|
{
|
||||||
|
port.HdcpReceiveCapability = (eHdcpCapabilityType)s;
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void SetHdcpCapabilityAction(bool hdcpTypeSimple, EndpointHdmiInput port, uint join, BasicTriList trilist)
|
||||||
|
{
|
||||||
|
if (hdcpTypeSimple)
|
||||||
|
{
|
||||||
|
trilist.SetUShortSigAction(join,
|
||||||
|
new Action<ushort>(s =>
|
||||||
|
{
|
||||||
|
if (s == 0)
|
||||||
|
{
|
||||||
|
port.HdcpSupportOff();
|
||||||
|
}
|
||||||
|
else if (s > 0)
|
||||||
|
{
|
||||||
|
port.HdcpSupportOn();
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
trilist.SetUShortSigAction(join,
|
||||||
|
new Action<ushort>(s =>
|
||||||
|
{
|
||||||
|
port.HdcpCapability = (eHdcpCapabilityType)s;
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
44
PepperDashEssentials/Bridges/DmRmcControllerBridge.cs
Normal file
44
PepperDashEssentials/Bridges/DmRmcControllerBridge.cs
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.DM;
|
||||||
|
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Bridges
|
||||||
|
{
|
||||||
|
public static class DmRmcControllerApiExtensions
|
||||||
|
{
|
||||||
|
public static void LinkToApi(this DmRmcControllerBase rmc, BasicTriList trilist, uint joinStart, string joinMapKey)
|
||||||
|
{
|
||||||
|
DmRmcControllerJoinMap joinMap = new DmRmcControllerJoinMap();
|
||||||
|
|
||||||
|
var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey);
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(joinMapSerialized))
|
||||||
|
joinMap = JsonConvert.DeserializeObject<DmRmcControllerJoinMap>(joinMapSerialized);
|
||||||
|
|
||||||
|
joinMap.OffsetJoinNumbers(joinStart);
|
||||||
|
|
||||||
|
Debug.Console(1, rmc, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||||
|
|
||||||
|
rmc.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]);
|
||||||
|
if(rmc.VideoOutputResolutionFeedback != null)
|
||||||
|
rmc.VideoOutputResolutionFeedback.LinkInputSig(trilist.StringInput[joinMap.CurrentOutputResolution]);
|
||||||
|
if(rmc.EdidManufacturerFeedback != null)
|
||||||
|
rmc.EdidManufacturerFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidManufacturer]);
|
||||||
|
if(rmc.EdidNameFeedback != null)
|
||||||
|
rmc.EdidNameFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidName]);
|
||||||
|
if(rmc.EdidPreferredTimingFeedback != null)
|
||||||
|
rmc.EdidPreferredTimingFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidPrefferedTiming]);
|
||||||
|
if(rmc.EdidSerialNumberFeedback != null)
|
||||||
|
rmc.EdidSerialNumberFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidSerialNumber]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
137
PepperDashEssentials/Bridges/DmTxControllerBridge.cs
Normal file
137
PepperDashEssentials/Bridges/DmTxControllerBridge.cs
Normal file
@@ -0,0 +1,137 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Crestron.SimplSharpPro.DM;
|
||||||
|
using Crestron.SimplSharpPro.DM.Endpoints;
|
||||||
|
using Crestron.SimplSharpPro.DM.Endpoints.Transmitters;
|
||||||
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.DM;
|
||||||
|
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Bridges
|
||||||
|
{
|
||||||
|
public static class DmTxControllerApiExtensions
|
||||||
|
{
|
||||||
|
public static void LinkToApi(this DmTxControllerBase tx, BasicTriList trilist, uint joinStart, string joinMapKey)
|
||||||
|
{
|
||||||
|
DmTxControllerJoinMap joinMap = new DmTxControllerJoinMap();
|
||||||
|
|
||||||
|
var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey);
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(joinMapSerialized))
|
||||||
|
joinMap = JsonConvert.DeserializeObject<DmTxControllerJoinMap>(joinMapSerialized);
|
||||||
|
|
||||||
|
joinMap.OffsetJoinNumbers(joinStart);
|
||||||
|
|
||||||
|
Debug.Console(1, tx, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||||
|
|
||||||
|
tx.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]);
|
||||||
|
tx.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus]);
|
||||||
|
tx.AnyVideoInput.VideoStatus.VideoResolutionFeedback.LinkInputSig(trilist.StringInput[joinMap.CurrentInputResolution]);
|
||||||
|
trilist.UShortInput[joinMap.HdcpSupportCapability].UShortValue = (ushort)tx.HdcpSupportCapability;
|
||||||
|
|
||||||
|
bool hdcpTypeSimple;
|
||||||
|
|
||||||
|
if (tx.Hardware is DmTx4kX02CBase || tx.Hardware is DmTx4kzX02CBase)
|
||||||
|
hdcpTypeSimple = false;
|
||||||
|
else
|
||||||
|
hdcpTypeSimple = true;
|
||||||
|
|
||||||
|
if (tx is ITxRouting)
|
||||||
|
{
|
||||||
|
var txR = tx as ITxRouting;
|
||||||
|
|
||||||
|
trilist.SetUShortSigAction(joinMap.VideoInput,
|
||||||
|
new Action<ushort>(i => txR.ExecuteNumericSwitch(i, 0, eRoutingSignalType.Video)));
|
||||||
|
trilist.SetUShortSigAction(joinMap.AudioInput,
|
||||||
|
new Action<ushort>(i => txR.ExecuteNumericSwitch(i, 0, eRoutingSignalType.Audio)));
|
||||||
|
|
||||||
|
txR.VideoSourceNumericFeedback.LinkInputSig(trilist.UShortInput[joinMap.VideoInput]);
|
||||||
|
txR.AudioSourceNumericFeedback.LinkInputSig(trilist.UShortInput[joinMap.AudioInput]);
|
||||||
|
|
||||||
|
trilist.UShortInput[joinMap.HdcpSupportCapability].UShortValue = (ushort)tx.HdcpSupportCapability;
|
||||||
|
|
||||||
|
if(txR.InputPorts[DmPortName.HdmiIn] != null)
|
||||||
|
{
|
||||||
|
var inputPort = txR.InputPorts[DmPortName.HdmiIn];
|
||||||
|
|
||||||
|
if (tx.Feedbacks["HdmiInHdcpCapability"] != null)
|
||||||
|
(tx.Feedbacks["HdmiInHdcpCapability"] as IntFeedback).LinkInputSig(trilist.UShortInput[joinMap.Port1HdcpState]);
|
||||||
|
|
||||||
|
if (inputPort.ConnectionType == eRoutingPortConnectionType.Hdmi && inputPort.Port != null)
|
||||||
|
{
|
||||||
|
var port = inputPort.Port as EndpointHdmiInput;
|
||||||
|
|
||||||
|
SetHdcpCapabilityAction(hdcpTypeSimple, port, joinMap.Port1HdcpState, trilist);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (txR.InputPorts[DmPortName.HdmiIn1] != null)
|
||||||
|
{
|
||||||
|
var inputPort = txR.InputPorts[DmPortName.HdmiIn1];
|
||||||
|
|
||||||
|
if (tx.Feedbacks["HdmiIn1HdcpCapability"] != null)
|
||||||
|
(tx.Feedbacks["HdmiIn1HdcpCapability"] as IntFeedback).LinkInputSig(trilist.UShortInput[joinMap.Port1HdcpState]);
|
||||||
|
|
||||||
|
if (inputPort.ConnectionType == eRoutingPortConnectionType.Hdmi && inputPort.Port != null)
|
||||||
|
{
|
||||||
|
var port = inputPort.Port as EndpointHdmiInput;
|
||||||
|
|
||||||
|
SetHdcpCapabilityAction(hdcpTypeSimple, port, joinMap.Port1HdcpState, trilist);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (txR.InputPorts[DmPortName.HdmiIn2] != null)
|
||||||
|
{
|
||||||
|
var inputPort = txR.InputPorts[DmPortName.HdmiIn2];
|
||||||
|
|
||||||
|
if (tx.Feedbacks["HdmiIn2HdcpCapability"] != null)
|
||||||
|
(tx.Feedbacks["HdmiIn2HdcpCapability"] as IntFeedback).LinkInputSig(trilist.UShortInput[joinMap.Port1HdcpState]);
|
||||||
|
|
||||||
|
if (inputPort.ConnectionType == eRoutingPortConnectionType.Hdmi && inputPort.Port != null)
|
||||||
|
{
|
||||||
|
var port = inputPort.Port as EndpointHdmiInput;
|
||||||
|
|
||||||
|
SetHdcpCapabilityAction(hdcpTypeSimple, port, joinMap.Port2HdcpState, trilist);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void SetHdcpCapabilityAction(bool hdcpTypeSimple, EndpointHdmiInput port, uint join, BasicTriList trilist)
|
||||||
|
{
|
||||||
|
if (hdcpTypeSimple)
|
||||||
|
{
|
||||||
|
trilist.SetUShortSigAction(join,
|
||||||
|
new Action<ushort>(s =>
|
||||||
|
{
|
||||||
|
if (s == 0)
|
||||||
|
{
|
||||||
|
port.HdcpSupportOff();
|
||||||
|
}
|
||||||
|
else if (s > 0)
|
||||||
|
{
|
||||||
|
port.HdcpSupportOn();
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
trilist.SetUShortSigAction(join,
|
||||||
|
new Action<ushort>(s =>
|
||||||
|
{
|
||||||
|
port.HdcpCapability = (eHdcpCapabilityType)s;
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
using Crestron.SimplSharpPro.DM;
|
||||||
|
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.DM;
|
||||||
|
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Bridges
|
||||||
|
{
|
||||||
|
public static class DmpsAudioOutputControllerApiExtensions
|
||||||
|
{
|
||||||
|
public static void LinkToApi(this DmpsAudioOutputController dmAudioOutputController, BasicTriList trilist, uint joinStart, string joinMapKey)
|
||||||
|
{
|
||||||
|
DmpsAudioOutputControllerJoinMap joinMap = new DmpsAudioOutputControllerJoinMap();
|
||||||
|
|
||||||
|
var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey);
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(joinMapSerialized))
|
||||||
|
joinMap = JsonConvert.DeserializeObject<DmpsAudioOutputControllerJoinMap>(joinMapSerialized);
|
||||||
|
|
||||||
|
joinMap.OffsetJoinNumbers(joinStart);
|
||||||
|
|
||||||
|
Debug.Console(1, dmAudioOutputController, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||||
|
|
||||||
|
if (dmAudioOutputController.MasterVolumeLevel != null)
|
||||||
|
{
|
||||||
|
SetUpDmpsAudioOutputJoins(trilist, dmAudioOutputController.MasterVolumeLevel, joinMap.MasterVolume);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dmAudioOutputController.SourceVolumeLevel != null)
|
||||||
|
{
|
||||||
|
SetUpDmpsAudioOutputJoins(trilist, dmAudioOutputController.SourceVolumeLevel, joinMap.SourceVolume);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dmAudioOutputController.Codec1VolumeLevel != null)
|
||||||
|
{
|
||||||
|
SetUpDmpsAudioOutputJoins(trilist, dmAudioOutputController.Codec1VolumeLevel, joinMap.Codec1Volume);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dmAudioOutputController.Codec2VolumeLevel != null)
|
||||||
|
{
|
||||||
|
SetUpDmpsAudioOutputJoins(trilist, dmAudioOutputController.Codec2VolumeLevel, joinMap.Codec2Volume);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static void SetUpDmpsAudioOutputJoins(BasicTriList trilist, DmpsAudioOutput output, uint joinStart)
|
||||||
|
{
|
||||||
|
var volumeLevelJoin = joinStart;
|
||||||
|
var muteOnJoin = joinStart;
|
||||||
|
var muteOffJoin = joinStart + 1;
|
||||||
|
var volumeUpJoin = joinStart + 2;
|
||||||
|
var volumeDownJoin = joinStart + 3;
|
||||||
|
|
||||||
|
|
||||||
|
trilist.SetUShortSigAction(volumeLevelJoin, new Action<ushort>(o => output.SetVolume(o)));
|
||||||
|
output.VolumeLevelFeedback.LinkInputSig(trilist.UShortInput[volumeLevelJoin]);
|
||||||
|
|
||||||
|
trilist.SetSigTrueAction(muteOnJoin, new Action(output.MuteOn));
|
||||||
|
output.MuteFeedback.LinkInputSig(trilist.BooleanInput[muteOnJoin]);
|
||||||
|
trilist.SetSigTrueAction(muteOffJoin, new Action(output.MuteOff));
|
||||||
|
output.MuteFeedback.LinkComplementInputSig(trilist.BooleanInput[muteOffJoin]);
|
||||||
|
|
||||||
|
trilist.SetBoolSigAction(volumeUpJoin, new Action<bool>(b => output.VolumeUp(b)));
|
||||||
|
trilist.SetBoolSigAction(volumeDownJoin, new Action<bool>(b => output.VolumeDown(b)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
128
PepperDashEssentials/Bridges/DmpsRoutingControllerBridge.cs
Normal file
128
PepperDashEssentials/Bridges/DmpsRoutingControllerBridge.cs
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
using Crestron.SimplSharpPro.DM;
|
||||||
|
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.DM;
|
||||||
|
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Bridges
|
||||||
|
{
|
||||||
|
public static class DmpsRoutingControllerApiExtentions
|
||||||
|
{
|
||||||
|
public static void LinkToApi(this DmpsRoutingController dmpsRouter, BasicTriList trilist, uint joinStart, string joinMapKey)
|
||||||
|
{
|
||||||
|
DmpsRoutingControllerJoinMap joinMap = new DmpsRoutingControllerJoinMap();
|
||||||
|
|
||||||
|
var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey);
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(joinMapSerialized))
|
||||||
|
joinMap = JsonConvert.DeserializeObject<DmpsRoutingControllerJoinMap>(joinMapSerialized);
|
||||||
|
|
||||||
|
joinMap.OffsetJoinNumbers(joinStart);
|
||||||
|
|
||||||
|
Debug.Console(1, dmpsRouter, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||||
|
|
||||||
|
// Link up outputs
|
||||||
|
for (uint i = 1; i <= dmpsRouter.Dmps.NumberOfSwitcherInputs; i++)
|
||||||
|
{
|
||||||
|
Debug.Console(2, dmpsRouter, "Linking Input Card {0}", i);
|
||||||
|
|
||||||
|
var ioSlot = i;
|
||||||
|
|
||||||
|
//if (dmpsRouter.TxDictionary.ContainsKey(ioSlot))
|
||||||
|
//{
|
||||||
|
// Debug.Console(2, "Creating Tx Feedbacks {0}", ioSlot);
|
||||||
|
// var TxKey = dmpsRouter.TxDictionary[ioSlot];
|
||||||
|
// var TxDevice = DeviceManager.GetDeviceForKey(TxKey) as DmTxControllerBase;
|
||||||
|
// //TxDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]);
|
||||||
|
// // TxDevice.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]);
|
||||||
|
// // trilist.SetUShortSigAction((ApiMap.HdcpSupport[ioSlot]), u => TxDevice.SetHdcpSupportAll((ePdtHdcpSupport)(u)));
|
||||||
|
// // TxDevice.HdcpSupportAllFeedback.LinkInputSig(trilist.UShortInput[joinMap. + ioSlot]);
|
||||||
|
// // trilist.UShortInput[ApiMap.HdcpSupportCapability[ioSlot]].UShortValue = TxDevice.HdcpSupportCapability;
|
||||||
|
//}
|
||||||
|
//else
|
||||||
|
//{
|
||||||
|
// // dmChassis.VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[ApiMap.TxVideoSyncStatus[ioSlot]]);
|
||||||
|
//}
|
||||||
|
|
||||||
|
if(dmpsRouter.VideoInputSyncFeedbacks[ioSlot] != null)
|
||||||
|
dmpsRouter.VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus + ioSlot]);
|
||||||
|
|
||||||
|
if (dmpsRouter.InputNameFeedbacks[ioSlot] != null)
|
||||||
|
dmpsRouter.InputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.InputNames + ioSlot]);
|
||||||
|
|
||||||
|
trilist.SetStringSigAction(joinMap.InputNames + ioSlot, new Action<string>(s =>
|
||||||
|
{
|
||||||
|
var inputCard = dmpsRouter.Dmps.SwitcherInputs[ioSlot] as DMInput;
|
||||||
|
|
||||||
|
if (inputCard != null)
|
||||||
|
{
|
||||||
|
if (inputCard.NameFeedback != null && !string.IsNullOrEmpty(inputCard.NameFeedback.StringValue) && inputCard.NameFeedback.StringValue != s)
|
||||||
|
if(inputCard.Name != null)
|
||||||
|
inputCard.Name.StringValue = s;
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
if(dmpsRouter.InputEndpointOnlineFeedbacks[ioSlot] != null)
|
||||||
|
dmpsRouter.InputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (uint i = 1; i <= dmpsRouter.Dmps.NumberOfSwitcherOutputs; i++)
|
||||||
|
{
|
||||||
|
Debug.Console(2, dmpsRouter, "Linking Output Card {0}", i);
|
||||||
|
|
||||||
|
var ioSlot = i;
|
||||||
|
// Control
|
||||||
|
trilist.SetUShortSigAction(joinMap.OutputVideo + ioSlot, new Action<ushort>(o => dmpsRouter.ExecuteSwitch(o, ioSlot, eRoutingSignalType.Video)));
|
||||||
|
trilist.SetUShortSigAction(joinMap.OutputAudio + ioSlot, new Action<ushort>(o => dmpsRouter.ExecuteSwitch(o, ioSlot, eRoutingSignalType.Audio)));
|
||||||
|
|
||||||
|
trilist.SetStringSigAction(joinMap.OutputNames + ioSlot, new Action<string>(s =>
|
||||||
|
{
|
||||||
|
var outputCard = dmpsRouter.Dmps.SwitcherOutputs[ioSlot] as DMOutput;
|
||||||
|
|
||||||
|
//Debug.Console(2, dmpsRouter, "Output Name String Sig Action for Output Card {0}", ioSlot);
|
||||||
|
|
||||||
|
if (outputCard != null)
|
||||||
|
{
|
||||||
|
//Debug.Console(2, dmpsRouter, "Card Type: {0}", outputCard.CardInputOutputType);
|
||||||
|
|
||||||
|
if (!(outputCard is Crestron.SimplSharpPro.DM.Cards.Card.Dmps3CodecOutput) && outputCard.NameFeedback != null)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(outputCard.NameFeedback.StringValue))
|
||||||
|
{
|
||||||
|
//Debug.Console(2, dmpsRouter, "NameFeedabck: {0}", outputCard.NameFeedback.StringValue);
|
||||||
|
|
||||||
|
if (outputCard.NameFeedback.StringValue != s && outputCard.Name != null)
|
||||||
|
{
|
||||||
|
outputCard.Name.StringValue = s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
// Feedback
|
||||||
|
if(dmpsRouter.VideoOutputFeedbacks[ioSlot] != null)
|
||||||
|
dmpsRouter.VideoOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputVideo + ioSlot]);
|
||||||
|
if (dmpsRouter.AudioOutputFeedbacks[ioSlot] != null)
|
||||||
|
dmpsRouter.AudioOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputAudio + ioSlot]);
|
||||||
|
if (dmpsRouter.OutputNameFeedbacks[ioSlot] != null)
|
||||||
|
dmpsRouter.OutputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputNames + ioSlot]);
|
||||||
|
if (dmpsRouter.OutputVideoRouteNameFeedbacks[ioSlot] != null)
|
||||||
|
dmpsRouter.OutputVideoRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentVideoInputNames + ioSlot]);
|
||||||
|
if (dmpsRouter.OutputAudioRouteNameFeedbacks[ioSlot] != null)
|
||||||
|
dmpsRouter.OutputAudioRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentAudioInputNames + ioSlot]);
|
||||||
|
if (dmpsRouter.OutputEndpointOnlineFeedbacks[ioSlot] != null)
|
||||||
|
dmpsRouter.OutputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline + ioSlot]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
120
PepperDashEssentials/Bridges/DspControllerBridge.cs
Normal file
120
PepperDashEssentials/Bridges/DspControllerBridge.cs
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.Devices.Common;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Bridges
|
||||||
|
{
|
||||||
|
public static class SamsungDisplayControllerApiExtensions
|
||||||
|
{
|
||||||
|
public static void LinkToApi(this PepperDash.Essentials.Core.TwoWayDisplayBase displayDevice, BasicTriList trilist, uint joinStart, string joinMapKey)
|
||||||
|
{
|
||||||
|
var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as DisplayControllerJoinMap;
|
||||||
|
|
||||||
|
if (joinMap == null)
|
||||||
|
{
|
||||||
|
joinMap = new DisplayControllerJoinMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
joinMap.OffsetJoinNumbers(joinStart);
|
||||||
|
Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||||
|
Debug.Console(0, "Linking to lighting Type {0}", displayDevice.GetType().Name.ToString());
|
||||||
|
|
||||||
|
var commMonitor = displayDevice as ICommunicationMonitor;
|
||||||
|
commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]);
|
||||||
|
|
||||||
|
|
||||||
|
// Poewer Off
|
||||||
|
trilist.SetSigTrueAction(joinMap.PowerOff, () => displayDevice.PowerOff());
|
||||||
|
displayDevice.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.PowerOff]);
|
||||||
|
|
||||||
|
// Poewer On
|
||||||
|
trilist.SetSigTrueAction(joinMap.PowerOn, () => displayDevice.PowerOn());
|
||||||
|
displayDevice.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PowerOn]);
|
||||||
|
|
||||||
|
// GenericLighitng Actions & FeedBack
|
||||||
|
|
||||||
|
// int sceneIndex = 1;
|
||||||
|
/*
|
||||||
|
foreach (var scene in displayDevice.LightingScenes)
|
||||||
|
{
|
||||||
|
var tempIndex = sceneIndex - 1;
|
||||||
|
//trilist.SetSigTrueAction((uint)(joinMap.LightingSceneOffset + sceneIndex), () => displayDevice.SelectScene(displayDevice.LightingScenes[tempIndex]));
|
||||||
|
scene.IsActiveFeedback.LinkInputSig(trilist.BooleanInput[(uint)(joinMap.LightingSceneOffset + sceneIndex)]);
|
||||||
|
trilist.StringInput[(uint)(joinMap.LightingSceneOffset + sceneIndex)].StringValue = scene.Name;
|
||||||
|
trilist.BooleanInput[(uint)(joinMap.ButtonVisibilityOffset + sceneIndex)].BoolValue = true;
|
||||||
|
sceneIndex++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (displayDevice.GetType().Name.ToString() == "LutronQuantumArea")
|
||||||
|
{
|
||||||
|
var lutronDevice = displayDevice as PepperDash.Essentials.Devices.Common.Environment.Lutron.LutronQuantumArea;
|
||||||
|
lutronDevice.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]);
|
||||||
|
trilist.SetStringSigAction(joinMap.IntegrationIdSet, s => lutronDevice.IntegrationId = s);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
//ApiEisc.Eisc.SetStringSigAction(ApiMap.integrationID, (s) => { lutronLights.IntegrationId = s; });
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
var lutronLights = displayDevice as PepperDash.Essentials.Devices.Common.Environment.Lutron.LutronQuantumArea;
|
||||||
|
|
||||||
|
|
||||||
|
for (uint i = 1; i <= lightingBase.CircuitCount; i++)
|
||||||
|
{
|
||||||
|
var circuit = i;
|
||||||
|
lightingBase.CircuitNameFeedbacks[circuit - 1].LinkInputSig(trilist.StringInput[joinMap.CircuitNames + circuit]);
|
||||||
|
lightingBase.CircuitIsCritical[circuit - 1].LinkInputSig(trilist.BooleanInput[joinMap.CircuitIsCritical + circuit]);
|
||||||
|
lightingBase.CircuitState[circuit - 1].LinkInputSig(trilist.BooleanInput[joinMap.CircuitState + circuit]);
|
||||||
|
trilist.SetSigTrueAction(joinMap.CircuitCycle + circuit, () => lightingBase.CycleCircuit(circuit - 1));
|
||||||
|
trilist.SetSigTrueAction(joinMap.CircuitOnCmd + circuit, () => lightingBase.TurnOnCircuit(circuit - 1));
|
||||||
|
trilist.SetSigTrueAction(joinMap.CircuitOffCmd + circuit, () => lightingBase.TurnOffCircuit(circuit - 1));
|
||||||
|
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class DisplayControllerJoinMap : JoinMapBase
|
||||||
|
{
|
||||||
|
public uint IsOnline { get; set; }
|
||||||
|
public uint PowerOff { get; set; }
|
||||||
|
public uint PowerOn { get; set; }
|
||||||
|
public uint SelectScene { get; set; }
|
||||||
|
public uint LightingSceneOffset { get; set; }
|
||||||
|
public uint ButtonVisibilityOffset { get; set; }
|
||||||
|
public uint IntegrationIdSet { get; set; }
|
||||||
|
|
||||||
|
public DisplayControllerJoinMap()
|
||||||
|
{
|
||||||
|
// Digital
|
||||||
|
IsOnline = 1;
|
||||||
|
PowerOff = 1;
|
||||||
|
PowerOn = 2;
|
||||||
|
SelectScene = 1;
|
||||||
|
IntegrationIdSet = 1;
|
||||||
|
LightingSceneOffset = 10;
|
||||||
|
ButtonVisibilityOffset = 40;
|
||||||
|
// Analog
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OffsetJoinNumbers(uint joinStart)
|
||||||
|
{
|
||||||
|
var joinOffset = joinStart - 1;
|
||||||
|
|
||||||
|
IsOnline = IsOnline + joinOffset;
|
||||||
|
PowerOff = PowerOff + joinOffset;
|
||||||
|
PowerOn = PowerOn + joinOffset;
|
||||||
|
SelectScene = SelectScene + joinOffset;
|
||||||
|
LightingSceneOffset = LightingSceneOffset + joinOffset;
|
||||||
|
ButtonVisibilityOffset = ButtonVisibilityOffset + joinOffset;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
144
PepperDashEssentials/Bridges/EssentialComms.cs
Normal file
144
PepperDashEssentials/Bridges/EssentialComms.cs
Normal file
@@ -0,0 +1,144 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.Core.Config;
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core.Routing;
|
||||||
|
using Crestron.SimplSharpPro;
|
||||||
|
using Crestron.SimplSharpPro.EthernetCommunication;
|
||||||
|
using Crestron.SimplSharpPro.CrestronThread;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials {
|
||||||
|
public class EssentialCommConfig {
|
||||||
|
public string[] EiscApiIpids;
|
||||||
|
public EssentialCommCommConnectionConfigs[] CommConnections;
|
||||||
|
}
|
||||||
|
public class EssentialCommCommConnectionConfigs {
|
||||||
|
public uint joinNumber {get; set; }
|
||||||
|
public EssentialsControlPropertiesConfig control { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class EssentialCommsPort {
|
||||||
|
public IBasicCommunication Comm;
|
||||||
|
public IntFeedback StatusFeedback;
|
||||||
|
public BoolFeedback ConnectedFeedback;
|
||||||
|
public List<EssentialComApiMap> Outputs = new List<EssentialComApiMap>();
|
||||||
|
public String RxBuffer;
|
||||||
|
public EssentialCommsPort(EssentialsControlPropertiesConfig config, string keyPrefix) {
|
||||||
|
Comm = CommFactory.CreateCommForConfig(config, keyPrefix);
|
||||||
|
// var PortGather = new CommunicationGather(Comm, config.EndOfLineChar);
|
||||||
|
Comm.TextReceived += new EventHandler<GenericCommMethodReceiveTextArgs>(Communication_TextReceived);
|
||||||
|
|
||||||
|
var socket = Comm as ISocketStatus;
|
||||||
|
StatusFeedback = new IntFeedback(() => { return (int)socket.ClientStatus; });
|
||||||
|
ConnectedFeedback = new BoolFeedback(() => { return Comm.IsConnected; });
|
||||||
|
|
||||||
|
if (socket != null) {
|
||||||
|
socket.ConnectionChange += new EventHandler<GenericSocketStatusChageEventArgs>(socket_ConnectionChange);
|
||||||
|
} else {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
void socket_ConnectionChange(object sender, GenericSocketStatusChageEventArgs e) {
|
||||||
|
StatusFeedback.FireUpdate();
|
||||||
|
ConnectedFeedback.FireUpdate();
|
||||||
|
if (e.Client.IsConnected) {
|
||||||
|
// Tasks on connect
|
||||||
|
} else {
|
||||||
|
// Cleanup items from this session
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void Communication_TextReceived(object sender, GenericCommMethodReceiveTextArgs args) {
|
||||||
|
try {
|
||||||
|
foreach (var Output in Outputs) {
|
||||||
|
Output.Api.Eisc.StringInput[Output.Join].StringValue = args.Text;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception) {
|
||||||
|
throw new FormatException(string.Format("ERROR:{0}"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class EssentialComm : Device {
|
||||||
|
public EssentialCommConfig Properties;
|
||||||
|
|
||||||
|
public CommunicationGather PortGather { get; private set; }
|
||||||
|
public List<BridgeApiEisc> Apis {get; set;}
|
||||||
|
public Dictionary<string, StringFeedback> CommFeedbacks {get; private set; }
|
||||||
|
public StatusMonitorBase CommunicationMonitor { get; private set; }
|
||||||
|
public Dictionary<uint, EssentialCommsPort> CommDictionary { get; private set; }
|
||||||
|
|
||||||
|
public EssentialComm(string key, string name, JToken properties) : base(key, name) {
|
||||||
|
Properties = JsonConvert.DeserializeObject<EssentialCommConfig>(properties.ToString());
|
||||||
|
CommFeedbacks = new Dictionary<string, StringFeedback>();
|
||||||
|
CommDictionary = new Dictionary<uint, EssentialCommsPort>();
|
||||||
|
Apis = new List<BridgeApiEisc>();
|
||||||
|
int commNumber = 1;
|
||||||
|
foreach (var commConfig in Properties.CommConnections) {
|
||||||
|
var commPort = new EssentialCommsPort(commConfig.control, string.Format("{0}-{1}", this.Key, commConfig.joinNumber));
|
||||||
|
CommDictionary.Add(commConfig.joinNumber, commPort);
|
||||||
|
|
||||||
|
commNumber++;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var Ipid in Properties.EiscApiIpids) {
|
||||||
|
var ApiEisc = new BridgeApiEisc(Ipid);
|
||||||
|
Apis.Add(ApiEisc);
|
||||||
|
foreach (var commConnection in CommDictionary) {
|
||||||
|
Debug.Console(2, "Joining Api{0} to comm {1}", Ipid, commConnection.Key);
|
||||||
|
var tempComm = commConnection.Value;
|
||||||
|
var tempJoin = (uint)commConnection.Key;
|
||||||
|
EssentialComApiMap ApiMap = new EssentialComApiMap(ApiEisc, (uint)tempJoin);
|
||||||
|
|
||||||
|
tempComm.Outputs.Add(ApiMap);
|
||||||
|
// Check for ApiMap Overide Values here
|
||||||
|
|
||||||
|
ApiEisc.Eisc.SetBoolSigAction(tempJoin, b => {if (b) { tempComm.Comm.Connect(); } else { tempComm.Comm.Disconnect(); }});
|
||||||
|
ApiEisc.Eisc.SetStringSigAction(tempJoin, s => tempComm.Comm.SendText(s));
|
||||||
|
|
||||||
|
tempComm.StatusFeedback.LinkInputSig(ApiEisc.Eisc.UShortInput[tempJoin]);
|
||||||
|
tempComm.ConnectedFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[tempJoin]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
ApiEisc.Eisc.Register();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public override bool CustomActivate()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Debug.Console(2, "Name {0} Activated", this.Name);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
Debug.Console(0, "Bridge {0}", e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
public class EssentialComApiMap {
|
||||||
|
public uint Join;
|
||||||
|
public BridgeApiEisc Api;
|
||||||
|
public uint connectJoin;
|
||||||
|
public EssentialComApiMap(BridgeApiEisc api, uint join) {
|
||||||
|
Join = join;
|
||||||
|
Api = api;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
150
PepperDashEssentials/Bridges/EssentialDM.cs
Normal file
150
PepperDashEssentials/Bridges/EssentialDM.cs
Normal file
@@ -0,0 +1,150 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.Core.Config;
|
||||||
|
using PepperDash.Essentials.DM;
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core.Routing;
|
||||||
|
using Crestron.SimplSharpPro;
|
||||||
|
using Crestron.SimplSharpPro.EthernetCommunication;
|
||||||
|
using Crestron.SimplSharpPro.DM;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials {
|
||||||
|
public class EssentialDM : PepperDash.Core.Device {
|
||||||
|
public EssentialDMProperties Properties;
|
||||||
|
public List<BridgeApiEisc> BridgeApiEiscs;
|
||||||
|
private PepperDash.Essentials.DM.DmChassisController DmSwitch;
|
||||||
|
private EssentialDMApiMap ApiMap = new EssentialDMApiMap();
|
||||||
|
public EssentialDM(string key, string name, JToken properties)
|
||||||
|
: base(key, name) {
|
||||||
|
Properties = JsonConvert.DeserializeObject<EssentialDMProperties>(properties.ToString());
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
public override bool CustomActivate() {
|
||||||
|
// Create EiscApis
|
||||||
|
try {
|
||||||
|
foreach (var device in DeviceManager.AllDevices) {
|
||||||
|
if (device.Key == this.Properties.connectionDeviceKey) {
|
||||||
|
Debug.Console(2, "deviceKey {0} Matches", device.Key);
|
||||||
|
DmSwitch = DeviceManager.GetDeviceForKey(device.Key) as PepperDash.Essentials.DM.DmChassisController;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
else {
|
||||||
|
Debug.Console(2, "deviceKey {0} doesn't match", device.Key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (Properties.EiscApiIpids != null) {
|
||||||
|
|
||||||
|
|
||||||
|
foreach (string Ipid in Properties.EiscApiIpids) {
|
||||||
|
var ApiEisc = new BridgeApiEisc(Ipid);
|
||||||
|
for (uint x = 1; x <= DmSwitch.Chassis.NumberOfInputs;x++ ) {
|
||||||
|
uint tempX = x;
|
||||||
|
Debug.Console(2, "Creating EiscActions {0}", tempX);
|
||||||
|
|
||||||
|
|
||||||
|
ApiEisc.Eisc.SetUShortSigAction(ApiMap.OutputVideoRoutes[tempX], u => DmSwitch.ExecuteSwitch(u, tempX, eRoutingSignalType.Video));
|
||||||
|
ApiEisc.Eisc.SetUShortSigAction(ApiMap.OutputAudioRoutes[tempX], u => DmSwitch.ExecuteSwitch(u, tempX, eRoutingSignalType.Audio));
|
||||||
|
|
||||||
|
|
||||||
|
if (DmSwitch.TxDictionary.ContainsKey(tempX)) {
|
||||||
|
Debug.Console(2, "Creating Tx Feedbacks {0}", tempX);
|
||||||
|
var TxKey = DmSwitch.TxDictionary[tempX];
|
||||||
|
var TxDevice = DeviceManager.GetDeviceForKey(TxKey) as DmTxControllerBase;
|
||||||
|
TxDevice.IsOnline.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.TxOnlineStatus[tempX]]);
|
||||||
|
TxDevice.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.TxVideoSyncStatus[tempX]]);
|
||||||
|
ApiEisc.Eisc.SetUShortSigAction((ApiMap.HdcpSupport[tempX]), u => TxDevice.SetHdcpSupportAll((ePdtHdcpSupport)(u)));
|
||||||
|
TxDevice.HdcpSupportAllFeedback.LinkInputSig(ApiEisc.Eisc.UShortInput[ApiMap.HdcpSupport[tempX]]);
|
||||||
|
ApiEisc.Eisc.UShortInput[ApiMap.HdcpSupportCapability[tempX]].UShortValue = TxDevice.HdcpSupportCapability;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
DmSwitch.VideoInputSyncFeedbacks[tempX].LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.TxVideoSyncStatus[tempX]]);
|
||||||
|
}
|
||||||
|
if (DmSwitch.RxDictionary.ContainsKey(tempX)) {
|
||||||
|
Debug.Console(2, "Creating Rx Feedbacks {0}", tempX);
|
||||||
|
var RxKey = DmSwitch.RxDictionary[tempX];
|
||||||
|
var RxDevice = DeviceManager.GetDeviceForKey(RxKey) as DmRmcControllerBase;
|
||||||
|
RxDevice.IsOnline.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.RxOnlineStatus[tempX]]);
|
||||||
|
}
|
||||||
|
// DmSwitch.InputEndpointOnlineFeedbacks[(ushort)tempOutputNum].LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.OutputVideoRoutes[tempOutputNum]]);
|
||||||
|
DmSwitch.VideoOutputFeedbacks[(ushort)tempX].LinkInputSig(ApiEisc.Eisc.UShortInput[ApiMap.OutputVideoRoutes[tempX]]);
|
||||||
|
DmSwitch.AudioOutputFeedbacks[(ushort)tempX].LinkInputSig(ApiEisc.Eisc.UShortInput[ApiMap.OutputAudioRoutes[tempX]]);
|
||||||
|
DmSwitch.InputNameFeedbacks[(ushort)tempX].LinkInputSig(ApiEisc.Eisc.StringInput[ApiMap.InputNames[tempX]]);
|
||||||
|
DmSwitch.OutputNameFeedbacks[(ushort)tempX].LinkInputSig(ApiEisc.Eisc.StringInput[ApiMap.OutputNames[tempX]]);
|
||||||
|
DmSwitch.OutputRouteNameFeedbacks[(ushort)tempX].LinkInputSig(ApiEisc.Eisc.StringInput[ApiMap.OutputRouteNames[tempX]]);
|
||||||
|
}
|
||||||
|
DmSwitch.IsOnline.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.ChassisOnline]);
|
||||||
|
ApiEisc.Eisc.Register();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Debug.Console(2, "Name {0} Activated", this.Name);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
Debug.Console(2, "BRidge {0}", e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class EssentialDMProperties {
|
||||||
|
public string connectionDeviceKey;
|
||||||
|
public string[] EiscApiIpids;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class EssentialDMApiMap {
|
||||||
|
public ushort ChassisOnline = 11;
|
||||||
|
public Dictionary<uint, ushort> OutputVideoRoutes;
|
||||||
|
public Dictionary<uint, ushort> OutputAudioRoutes;
|
||||||
|
public Dictionary<uint, ushort> TxOnlineStatus;
|
||||||
|
public Dictionary<uint, ushort> RxOnlineStatus;
|
||||||
|
public Dictionary<uint, ushort> TxVideoSyncStatus;
|
||||||
|
public Dictionary<uint, ushort> InputNames;
|
||||||
|
public Dictionary<uint, ushort> OutputNames;
|
||||||
|
public Dictionary<uint, ushort> OutputRouteNames;
|
||||||
|
public Dictionary<uint, ushort> HdcpSupport;
|
||||||
|
public Dictionary<uint, ushort> HdcpSupportCapability;
|
||||||
|
|
||||||
|
public EssentialDMApiMap() {
|
||||||
|
OutputVideoRoutes = new Dictionary<uint, ushort>();
|
||||||
|
OutputAudioRoutes = new Dictionary<uint, ushort>();
|
||||||
|
TxOnlineStatus = new Dictionary<uint, ushort>();
|
||||||
|
RxOnlineStatus = new Dictionary<uint, ushort>();
|
||||||
|
TxVideoSyncStatus = new Dictionary<uint, ushort>();
|
||||||
|
InputNames = new Dictionary<uint, ushort>();
|
||||||
|
OutputNames = new Dictionary<uint, ushort>();
|
||||||
|
OutputRouteNames = new Dictionary<uint, ushort>();
|
||||||
|
HdcpSupport = new Dictionary<uint, ushort>();
|
||||||
|
HdcpSupportCapability = new Dictionary<uint, ushort>();
|
||||||
|
|
||||||
|
for (uint x = 1; x <= 200; x++) {
|
||||||
|
// Debug.Console(0, "Init Value {0}", x);
|
||||||
|
uint tempNum = x;
|
||||||
|
HdcpSupportCapability[tempNum] = (ushort)(tempNum + 1200);
|
||||||
|
HdcpSupport[tempNum] = (ushort)(tempNum + 1000);
|
||||||
|
OutputVideoRoutes[tempNum] = (ushort)(tempNum + 100);
|
||||||
|
OutputAudioRoutes[tempNum] = (ushort)(tempNum + 300);
|
||||||
|
TxOnlineStatus[tempNum] = (ushort)(tempNum + 500);
|
||||||
|
RxOnlineStatus[tempNum] = (ushort)(tempNum + 700);
|
||||||
|
TxVideoSyncStatus[tempNum] = (ushort)(tempNum + 100);
|
||||||
|
InputNames[tempNum] = (ushort)(tempNum + 100);
|
||||||
|
OutputNames[tempNum] = (ushort)(tempNum + 300);
|
||||||
|
OutputRouteNames[tempNum] = (ushort)(tempNum + 2000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
217
PepperDashEssentials/Bridges/EssentialDsp.cs
Normal file
217
PepperDashEssentials/Bridges/EssentialDsp.cs
Normal file
@@ -0,0 +1,217 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.Core.Config;
|
||||||
|
using PepperDash.Essentials.DM;
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core.Routing;
|
||||||
|
using Crestron.SimplSharpPro;
|
||||||
|
using Crestron.SimplSharpPro.EthernetCommunication;
|
||||||
|
using Crestron.SimplSharpPro.DM;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials {
|
||||||
|
public class EssentialDsp : PepperDash.Core.Device {
|
||||||
|
public EssentialDspProperties Properties;
|
||||||
|
public List<BridgeApiEisc> BridgeApiEiscs;
|
||||||
|
private PepperDash.Essentials.Devices.Common.DSP.QscDsp Dsp;
|
||||||
|
private EssentialDspApiMap ApiMap = new EssentialDspApiMap();
|
||||||
|
public EssentialDsp(string key, string name, JToken properties)
|
||||||
|
: base(key, name) {
|
||||||
|
Properties = JsonConvert.DeserializeObject<EssentialDspProperties>(properties.ToString());
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
public override bool CustomActivate() {
|
||||||
|
// Create EiscApis
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ICommunicationMonitor comm = null;
|
||||||
|
foreach (var device in DeviceManager.AllDevices)
|
||||||
|
{
|
||||||
|
if (device.Key == this.Properties.connectionDeviceKey)
|
||||||
|
{
|
||||||
|
if (!(device is ICommunicationMonitor))
|
||||||
|
{
|
||||||
|
comm = device as ICommunicationMonitor;
|
||||||
|
}
|
||||||
|
Debug.Console(2, "deviceKey {0} Matches", device.Key);
|
||||||
|
Dsp = DeviceManager.GetDeviceForKey(device.Key) as PepperDash.Essentials.Devices.Common.DSP.QscDsp;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.Console(2, "deviceKey {0} doesn't match", device.Key);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (Properties.EiscApiIpids != null && Dsp != null)
|
||||||
|
{
|
||||||
|
foreach (string Ipid in Properties.EiscApiIpids)
|
||||||
|
{
|
||||||
|
var ApiEisc = new BridgeApiEisc(Ipid);
|
||||||
|
Debug.Console(2, "Connecting EiscApi {0} to {1}", ApiEisc.Ipid, Dsp.Name);
|
||||||
|
ushort x = 1;
|
||||||
|
if (comm != null)
|
||||||
|
{
|
||||||
|
comm.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.Online]);
|
||||||
|
}
|
||||||
|
foreach (var channel in Dsp.LevelControlPoints)
|
||||||
|
{
|
||||||
|
//var QscChannel = channel.Value as PepperDash.Essentials.Devices.Common.DSP.QscDspLevelControl;
|
||||||
|
Debug.Console(2, "QscChannel {0} connect", x);
|
||||||
|
|
||||||
|
var genericChannel = channel.Value as IBasicVolumeWithFeedback;
|
||||||
|
if (channel.Value.Enabled)
|
||||||
|
{
|
||||||
|
ApiEisc.Eisc.StringInput[ApiMap.channelName[x]].StringValue = channel.Value.LevelCustomName;
|
||||||
|
ApiEisc.Eisc.UShortInput[ApiMap.channelType[x]].UShortValue = (ushort)channel.Value.Type;
|
||||||
|
|
||||||
|
genericChannel.MuteFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.channelMuteToggle[x]]);
|
||||||
|
genericChannel.VolumeLevelFeedback.LinkInputSig(ApiEisc.Eisc.UShortInput[ApiMap.channelVolume[x]]);
|
||||||
|
|
||||||
|
ApiEisc.Eisc.SetSigTrueAction(ApiMap.channelMuteToggle[x], () => genericChannel.MuteToggle());
|
||||||
|
ApiEisc.Eisc.SetSigTrueAction(ApiMap.channelMuteOn[x], () => genericChannel.MuteOn());
|
||||||
|
ApiEisc.Eisc.SetSigTrueAction(ApiMap.channelMuteOff[x], () => genericChannel.MuteOff());
|
||||||
|
|
||||||
|
ApiEisc.Eisc.SetBoolSigAction(ApiMap.channelVolumeUp[x], b => genericChannel.VolumeUp(b));
|
||||||
|
ApiEisc.Eisc.SetBoolSigAction(ApiMap.channelVolumeDown[x], b => genericChannel.VolumeDown(b));
|
||||||
|
|
||||||
|
ApiEisc.Eisc.SetUShortSigAction(ApiMap.channelVolume[x], u => genericChannel.SetVolume(u));
|
||||||
|
ApiEisc.Eisc.SetStringSigAction(ApiMap.presetString, s => Dsp.RunPreset(s));
|
||||||
|
}
|
||||||
|
x++;
|
||||||
|
|
||||||
|
}
|
||||||
|
x = 1;
|
||||||
|
foreach (var preset in Dsp.PresetList)
|
||||||
|
{
|
||||||
|
ApiEisc.Eisc.StringInput[ApiMap.presets[x]].StringValue = preset.label;
|
||||||
|
ApiEisc.Eisc.SetSigTrueAction(ApiMap.presets[x], () => Dsp.RunPresetNumber(x));
|
||||||
|
x++;
|
||||||
|
}
|
||||||
|
foreach (var dialer in Dsp.Dialers)
|
||||||
|
{
|
||||||
|
ApiEisc.Eisc.SetSigTrueAction(ApiMap.Keypad0, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num0));
|
||||||
|
ApiEisc.Eisc.SetSigTrueAction(ApiMap.Keypad1, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num1));
|
||||||
|
ApiEisc.Eisc.SetSigTrueAction(ApiMap.Keypad2, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num2));
|
||||||
|
ApiEisc.Eisc.SetSigTrueAction(ApiMap.Keypad3, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num3));
|
||||||
|
ApiEisc.Eisc.SetSigTrueAction(ApiMap.Keypad4, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num4));
|
||||||
|
ApiEisc.Eisc.SetSigTrueAction(ApiMap.Keypad5, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num5));
|
||||||
|
ApiEisc.Eisc.SetSigTrueAction(ApiMap.Keypad6, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num6));
|
||||||
|
ApiEisc.Eisc.SetSigTrueAction(ApiMap.Keypad7, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num7));
|
||||||
|
ApiEisc.Eisc.SetSigTrueAction(ApiMap.Keypad8, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num8));
|
||||||
|
ApiEisc.Eisc.SetSigTrueAction(ApiMap.Keypad9, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num9));
|
||||||
|
ApiEisc.Eisc.SetSigTrueAction(ApiMap.KeypadStar, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Star));
|
||||||
|
ApiEisc.Eisc.SetSigTrueAction(ApiMap.KeypadPound, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Pound));
|
||||||
|
ApiEisc.Eisc.SetSigTrueAction(ApiMap.KeypadClear, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Clear));
|
||||||
|
ApiEisc.Eisc.SetSigTrueAction(ApiMap.KeypadBackspace, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Backspace));
|
||||||
|
|
||||||
|
ApiEisc.Eisc.SetSigTrueAction(ApiMap.Dial, () => dialer.Value.Dial());
|
||||||
|
ApiEisc.Eisc.SetSigTrueAction(ApiMap.DoNotDisturbToggle, () => dialer.Value.DoNotDisturbToggle());
|
||||||
|
ApiEisc.Eisc.SetSigTrueAction(ApiMap.DoNotDisturbOn, () => dialer.Value.DoNotDisturbOn());
|
||||||
|
ApiEisc.Eisc.SetSigTrueAction(ApiMap.DoNotDisturbOff, () => dialer.Value.DoNotDisturbOff());
|
||||||
|
ApiEisc.Eisc.SetSigTrueAction(ApiMap.AutoAnswerToggle, () => dialer.Value.AutoAnswerToggle());
|
||||||
|
ApiEisc.Eisc.SetSigTrueAction(ApiMap.AutoAnswerOn, () => dialer.Value.AutoAnswerOn());
|
||||||
|
ApiEisc.Eisc.SetSigTrueAction(ApiMap.AutoAnswerOff, () => dialer.Value.AutoAnswerOff());
|
||||||
|
|
||||||
|
dialer.Value.DoNotDisturbFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.DoNotDisturbToggle]);
|
||||||
|
dialer.Value.DoNotDisturbFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.DoNotDisturbOn]);
|
||||||
|
dialer.Value.DoNotDisturbFeedback.LinkComplementInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.DoNotDisturbOff]);
|
||||||
|
|
||||||
|
dialer.Value.AutoAnswerFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.AutoAnswerToggle]);
|
||||||
|
dialer.Value.AutoAnswerFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.AutoAnswerOn]);
|
||||||
|
dialer.Value.AutoAnswerFeedback.LinkComplementInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.AutoAnswerOff]);
|
||||||
|
|
||||||
|
dialer.Value.OffHookFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.Dial]);
|
||||||
|
dialer.Value.DialStringFeedback.LinkInputSig(ApiEisc.Eisc.StringInput[ApiMap.DialString]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Debug.Console(2, "Name {0} Activated", this.Name);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
Debug.Console(0, "Bridge {0}", e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class EssentialDspProperties {
|
||||||
|
public string connectionDeviceKey;
|
||||||
|
public string[] EiscApiIpids;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class EssentialDspApiMap {
|
||||||
|
public ushort Online = 1;
|
||||||
|
public ushort presetString = 2000;
|
||||||
|
public Dictionary<uint, ushort> channelMuteToggle;
|
||||||
|
public Dictionary<uint, ushort> channelMuteOn;
|
||||||
|
public Dictionary<uint, ushort> channelMuteOff;
|
||||||
|
public Dictionary<uint, ushort> channelVolume;
|
||||||
|
public Dictionary<uint, ushort> channelType;
|
||||||
|
public Dictionary<uint, ushort> channelName;
|
||||||
|
public Dictionary<uint, ushort> channelVolumeUp;
|
||||||
|
public Dictionary<uint, ushort> channelVolumeDown;
|
||||||
|
public Dictionary<uint, ushort> presets;
|
||||||
|
public ushort DialString = 3100;
|
||||||
|
public ushort Keypad0 = 3110;
|
||||||
|
public ushort Keypad1 = 3111;
|
||||||
|
public ushort Keypad2 = 3112;
|
||||||
|
public ushort Keypad3 = 3113;
|
||||||
|
public ushort Keypad4 = 3114;
|
||||||
|
public ushort Keypad5 = 3115;
|
||||||
|
public ushort Keypad6 = 3116;
|
||||||
|
public ushort Keypad7 = 3117;
|
||||||
|
public ushort Keypad8 = 3118;
|
||||||
|
public ushort Keypad9 = 3119;
|
||||||
|
public ushort KeypadStar = 3120;
|
||||||
|
public ushort KeypadPound = 3121;
|
||||||
|
public ushort KeypadClear = 3122;
|
||||||
|
public ushort KeypadBackspace = 3123;
|
||||||
|
public ushort Dial = 3124;
|
||||||
|
public ushort DoNotDisturbToggle = 3132;
|
||||||
|
public ushort DoNotDisturbOn = 3133;
|
||||||
|
public ushort DoNotDisturbOff = 3134;
|
||||||
|
public ushort AutoAnswerToggle = 3127;
|
||||||
|
public ushort AutoAnswerOn = 3125;
|
||||||
|
public ushort AutoAnswerOff = 3126;
|
||||||
|
|
||||||
|
public EssentialDspApiMap() {
|
||||||
|
channelMuteToggle = new Dictionary<uint, ushort>();
|
||||||
|
channelMuteOn = new Dictionary<uint, ushort>();
|
||||||
|
channelMuteOff = new Dictionary<uint, ushort>();
|
||||||
|
channelVolume = new Dictionary<uint, ushort>();
|
||||||
|
channelName = new Dictionary<uint, ushort>();
|
||||||
|
channelType = new Dictionary<uint, ushort>();
|
||||||
|
presets = new Dictionary<uint, ushort>();
|
||||||
|
channelVolumeUp = new Dictionary<uint, ushort>();
|
||||||
|
channelVolumeDown = new Dictionary<uint, ushort>();
|
||||||
|
for (uint x = 1; x <= 100; x++) {
|
||||||
|
uint tempNum = x;
|
||||||
|
presets[tempNum] = (ushort)(tempNum + 100);
|
||||||
|
channelMuteToggle[tempNum] = (ushort)(tempNum + 400);
|
||||||
|
channelMuteOn[tempNum] = (ushort)(tempNum + 600);
|
||||||
|
channelMuteOff[tempNum] = (ushort)(tempNum + 800);
|
||||||
|
channelVolume[tempNum] = (ushort)(tempNum + 200);
|
||||||
|
channelName[tempNum] = (ushort)(tempNum + 200);
|
||||||
|
channelType[tempNum] = (ushort)(tempNum + 400);
|
||||||
|
channelVolumeUp[tempNum] = (ushort)(tempNum + 1000);
|
||||||
|
channelVolumeDown[tempNum] = (ushort)(tempNum + 1200);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
98
PepperDashEssentials/Bridges/EssentialTVOne.cs
Normal file
98
PepperDashEssentials/Bridges/EssentialTVOne.cs
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.Core.Config;
|
||||||
|
using PepperDash.Essentials.DM;
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core.Routing;
|
||||||
|
using Crestron.SimplSharpPro;
|
||||||
|
using Crestron.SimplSharpPro.EthernetCommunication;
|
||||||
|
using Crestron.SimplSharpPro.DM;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials
|
||||||
|
{
|
||||||
|
public class EssentialsTVOne : PepperDash.Core.Device
|
||||||
|
{
|
||||||
|
public EssentialTVOneProperties Properties;
|
||||||
|
public List<BridgeApiEisc> BridgeApiEiscs;
|
||||||
|
private PepperDash.Essentials.Devices.Common.TVOneCorio TVOneCorio;
|
||||||
|
private EssentialsTVOneApiMap ApiMap = new EssentialsTVOneApiMap();
|
||||||
|
public EssentialsTVOne(string key, string name, JToken properties)
|
||||||
|
: base(key, name)
|
||||||
|
{
|
||||||
|
Properties = JsonConvert.DeserializeObject<EssentialTVOneProperties>(properties.ToString());
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
public override bool CustomActivate() {
|
||||||
|
// Create EiscApis
|
||||||
|
try
|
||||||
|
{
|
||||||
|
foreach (var device in DeviceManager.AllDevices)
|
||||||
|
{
|
||||||
|
if (device.Key == this.Properties.connectionDeviceKey)
|
||||||
|
{
|
||||||
|
Debug.Console(2, "deviceKey {0} Matches", device.Key);
|
||||||
|
TVOneCorio = DeviceManager.GetDeviceForKey(device.Key) as PepperDash.Essentials.Devices.Common.TVOneCorio;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.Console(2, "deviceKey {0} doesn't match", device.Key);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (Properties.EiscApiIpids != null && TVOneCorio != null)
|
||||||
|
{
|
||||||
|
foreach (string Ipid in Properties.EiscApiIpids)
|
||||||
|
{
|
||||||
|
var ApiEisc = new BridgeApiEisc(Ipid);
|
||||||
|
Debug.Console(2, "Connecting EiscApi {0} to {1}", ApiEisc.Ipid, TVOneCorio.Name);
|
||||||
|
ushort x = 1;
|
||||||
|
TVOneCorio.OnlineFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.Online]);
|
||||||
|
ApiEisc.Eisc.SetUShortSigAction(ApiMap.CallPreset, u => TVOneCorio.CallPreset(u));
|
||||||
|
TVOneCorio.PresetFeedback.LinkInputSig(ApiEisc.Eisc.UShortInput[ApiMap.PresetFeedback]);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Debug.Console(2, "Name {0} Activated", this.Name);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
Debug.Console(0, "Bridge {0}", e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class EssentialTVOneProperties
|
||||||
|
{
|
||||||
|
public string connectionDeviceKey;
|
||||||
|
public string[] EiscApiIpids;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class EssentialsTVOneApiMap
|
||||||
|
{
|
||||||
|
public ushort CallPreset = 1;
|
||||||
|
public ushort PresetFeedback = 1;
|
||||||
|
public ushort Online = 1;
|
||||||
|
|
||||||
|
public EssentialsTVOneApiMap()
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
74
PepperDashEssentials/Bridges/GenericLightingBridge.cs
Normal file
74
PepperDashEssentials/Bridges/GenericLightingBridge.cs
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.Devices.Common;
|
||||||
|
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Bridges
|
||||||
|
{
|
||||||
|
public static class GenericLightingApiExtensions
|
||||||
|
{
|
||||||
|
public static void LinkToApi(this PepperDash.Essentials.Core.Lighting.LightingBase lightingDevice, BasicTriList trilist, uint joinStart, string joinMapKey)
|
||||||
|
{
|
||||||
|
GenericLightingJoinMap joinMap = new GenericLightingJoinMap();
|
||||||
|
|
||||||
|
var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey);
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(joinMapSerialized))
|
||||||
|
joinMap = JsonConvert.DeserializeObject<GenericLightingJoinMap>(joinMapSerialized);
|
||||||
|
|
||||||
|
joinMap.OffsetJoinNumbers(joinStart);
|
||||||
|
|
||||||
|
Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||||
|
|
||||||
|
Debug.Console(0, "Linking to Lighting Type {0}", lightingDevice.GetType().Name.ToString());
|
||||||
|
|
||||||
|
// GenericLighitng Actions & FeedBack
|
||||||
|
trilist.SetUShortSigAction(joinMap.SelectScene, u => lightingDevice.SelectScene(lightingDevice.LightingScenes[u]));
|
||||||
|
|
||||||
|
int sceneIndex = 1;
|
||||||
|
foreach (var scene in lightingDevice.LightingScenes)
|
||||||
|
{
|
||||||
|
var tempIndex = sceneIndex - 1;
|
||||||
|
trilist.SetSigTrueAction((uint)(joinMap.LightingSceneOffset + sceneIndex), () => lightingDevice.SelectScene(lightingDevice.LightingScenes[tempIndex]));
|
||||||
|
scene.IsActiveFeedback.LinkInputSig(trilist.BooleanInput[(uint)(joinMap.LightingSceneOffset + sceneIndex)]);
|
||||||
|
trilist.StringInput[(uint)(joinMap.LightingSceneOffset + sceneIndex)].StringValue = scene.Name;
|
||||||
|
trilist.BooleanInput[(uint)(joinMap.ButtonVisibilityOffset + sceneIndex)].BoolValue = true;
|
||||||
|
sceneIndex++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lightingDevice.GetType().Name.ToString() == "LutronQuantumArea")
|
||||||
|
{
|
||||||
|
var lutronDevice = lightingDevice as PepperDash.Essentials.Devices.Common.Environment.Lutron.LutronQuantumArea;
|
||||||
|
lutronDevice.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]);
|
||||||
|
trilist.SetStringSigAction(joinMap.IntegrationIdSet, s => lutronDevice.IntegrationId = s);
|
||||||
|
}
|
||||||
|
|
||||||
|
//ApiEisc.Eisc.SetStringSigAction(ApiMap.integrationID, (s) => { lutronLights.IntegrationId = s; });
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
var lutronLights = lightingDevice as PepperDash.Essentials.Devices.Common.Environment.Lutron.LutronQuantumArea;
|
||||||
|
|
||||||
|
|
||||||
|
for (uint i = 1; i <= lightingBase.CircuitCount; i++)
|
||||||
|
{
|
||||||
|
var circuit = i;
|
||||||
|
lightingBase.CircuitNameFeedbacks[circuit - 1].LinkInputSig(trilist.StringInput[joinMap.CircuitNames + circuit]);
|
||||||
|
lightingBase.CircuitIsCritical[circuit - 1].LinkInputSig(trilist.BooleanInput[joinMap.CircuitIsCritical + circuit]);
|
||||||
|
lightingBase.CircuitState[circuit - 1].LinkInputSig(trilist.BooleanInput[joinMap.CircuitState + circuit]);
|
||||||
|
trilist.SetSigTrueAction(joinMap.CircuitCycle + circuit, () => lightingBase.CycleCircuit(circuit - 1));
|
||||||
|
trilist.SetSigTrueAction(joinMap.CircuitOnCmd + circuit, () => lightingBase.TurnOnCircuit(circuit - 1));
|
||||||
|
trilist.SetSigTrueAction(joinMap.CircuitOffCmd + circuit, () => lightingBase.TurnOffCircuit(circuit - 1));
|
||||||
|
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
51
PepperDashEssentials/Bridges/GenericRelayDeviceBridge.cs
Normal file
51
PepperDashEssentials/Bridges/GenericRelayDeviceBridge.cs
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.Core.CrestronIO;
|
||||||
|
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Bridges
|
||||||
|
{
|
||||||
|
public static class GenericRelayDeviceApiExtensions
|
||||||
|
{
|
||||||
|
public static void LinkToApi(this GenericRelayDevice relay, BasicTriList trilist, uint joinStart, string joinMapKey)
|
||||||
|
{
|
||||||
|
GenericRelayControllerJoinMap joinMap = new GenericRelayControllerJoinMap();
|
||||||
|
|
||||||
|
var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey);
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(joinMapSerialized))
|
||||||
|
joinMap = JsonConvert.DeserializeObject<GenericRelayControllerJoinMap>(joinMapSerialized);
|
||||||
|
|
||||||
|
joinMap.OffsetJoinNumbers(joinStart);
|
||||||
|
|
||||||
|
if (relay.RelayOutput == null)
|
||||||
|
{
|
||||||
|
Debug.Console(1, relay, "Unable to link device '{0}'. Relay is null", relay.Key);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug.Console(1, relay, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||||
|
|
||||||
|
trilist.SetBoolSigAction(joinMap.Relay, new Action<bool>(b =>
|
||||||
|
{
|
||||||
|
if (b)
|
||||||
|
relay.CloseRelay();
|
||||||
|
else
|
||||||
|
relay.OpenRelay();
|
||||||
|
}));
|
||||||
|
|
||||||
|
// feedback for relay state
|
||||||
|
|
||||||
|
relay.OutputIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Relay]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
66
PepperDashEssentials/Bridges/HdMdxxxCEControllerBridge.cs
Normal file
66
PepperDashEssentials/Bridges/HdMdxxxCEControllerBridge.cs
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
using Crestron.SimplSharpPro.DM;
|
||||||
|
using Crestron.SimplSharpPro.DM.Endpoints;
|
||||||
|
using Crestron.SimplSharpPro.DM.Endpoints.Receivers;
|
||||||
|
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.DM;
|
||||||
|
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Bridges
|
||||||
|
{
|
||||||
|
public static class HdMdxxxCEControllerApiExtensions
|
||||||
|
{
|
||||||
|
public static void LinkToApi(this HdMdxxxCEController hdMdPair, BasicTriList trilist, uint joinStart, string joinMapKey)
|
||||||
|
{
|
||||||
|
HdMdxxxCEControllerJoinMap joinMap = new HdMdxxxCEControllerJoinMap();
|
||||||
|
|
||||||
|
var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey);
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(joinMapSerialized))
|
||||||
|
joinMap = JsonConvert.DeserializeObject<HdMdxxxCEControllerJoinMap>(joinMapSerialized);
|
||||||
|
|
||||||
|
joinMap.OffsetJoinNumbers(joinStart);
|
||||||
|
|
||||||
|
Debug.Console(1, hdMdPair, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||||
|
|
||||||
|
hdMdPair.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]);
|
||||||
|
hdMdPair.RemoteEndDetectedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RemoteEndDetected]);
|
||||||
|
|
||||||
|
trilist.SetSigTrueAction(joinMap.AutoRouteOn, new Action(() => hdMdPair.AutoRouteOn()));
|
||||||
|
hdMdPair.AutoRouteOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.AutoRouteOn]);
|
||||||
|
trilist.SetSigTrueAction(joinMap.AutoRouteOff, new Action(() => hdMdPair.AutoRouteOff()));
|
||||||
|
hdMdPair.AutoRouteOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.AutoRouteOff]);
|
||||||
|
|
||||||
|
trilist.SetSigTrueAction(joinMap.PriorityRoutingOn, new Action(() => hdMdPair.PriorityRouteOn()));
|
||||||
|
hdMdPair.PriorityRoutingOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PriorityRoutingOn]);
|
||||||
|
trilist.SetSigTrueAction(joinMap.PriorityRoutingOff, new Action(() => hdMdPair.PriorityRouteOff()));
|
||||||
|
hdMdPair.PriorityRoutingOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.PriorityRoutingOff]);
|
||||||
|
|
||||||
|
trilist.SetSigTrueAction(joinMap.InputOnScreenDisplayEnabled, new Action(() => hdMdPair.OnScreenDisplayEnable()));
|
||||||
|
hdMdPair.InputOnScreenDisplayEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.InputOnScreenDisplayEnabled]);
|
||||||
|
trilist.SetSigTrueAction(joinMap.AutoRouteOff, new Action(() => hdMdPair.OnScreenDisplayDisable()));
|
||||||
|
hdMdPair.InputOnScreenDisplayEnabledFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.InputOnScreenDisplayDisabled]);
|
||||||
|
|
||||||
|
trilist.SetUShortSigAction(joinMap.VideoSource, new Action<ushort>((i) => hdMdPair.ExecuteSwitch(i, null, eRoutingSignalType.Video | eRoutingSignalType.Audio)));
|
||||||
|
hdMdPair.VideoSourceFeedback.LinkInputSig(trilist.UShortInput[joinMap.VideoSource]);
|
||||||
|
|
||||||
|
trilist.UShortInput[joinMap.SourceCount].UShortValue = (ushort)hdMdPair.InputPorts.Count;
|
||||||
|
|
||||||
|
foreach (var input in hdMdPair.InputPorts)
|
||||||
|
{
|
||||||
|
var number = Convert.ToUInt16(input.Selector);
|
||||||
|
hdMdPair.SyncDetectedFeedbacks[number].LinkInputSig(trilist.BooleanInput[joinMap.SyncDetected + number]);
|
||||||
|
trilist.StringInput[joinMap.SourceNames + number].StringValue = input.Key;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
69
PepperDashEssentials/Bridges/IBasicCommunicationBridge.cs
Normal file
69
PepperDashEssentials/Bridges/IBasicCommunicationBridge.cs
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Bridges
|
||||||
|
{
|
||||||
|
public static class IBasicCommunicationApiExtensions
|
||||||
|
{
|
||||||
|
public static void LinkToApi(this GenericComm comm, BasicTriList trilist, uint joinStart, string joinMapKey)
|
||||||
|
{
|
||||||
|
IBasicCommunicationJoinMap joinMap = new IBasicCommunicationJoinMap();
|
||||||
|
|
||||||
|
var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey);
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(joinMapSerialized))
|
||||||
|
joinMap = JsonConvert.DeserializeObject<IBasicCommunicationJoinMap>(joinMapSerialized);
|
||||||
|
joinMap.OffsetJoinNumbers(joinStart);
|
||||||
|
|
||||||
|
if (comm.CommPort == null)
|
||||||
|
{
|
||||||
|
Debug.Console(1, comm, "Unable to link device '{0}'. CommPort is null", comm.Key);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug.Console(1, comm, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||||
|
|
||||||
|
// this is a permanent event handler. This cannot be -= from event
|
||||||
|
comm.CommPort.TextReceived += (s, a) =>
|
||||||
|
{
|
||||||
|
Debug.Console(2, comm, "RX: {0}", a.Text);
|
||||||
|
trilist.SetString(joinMap.TextReceived, a.Text);
|
||||||
|
};
|
||||||
|
trilist.SetStringSigAction(joinMap.SendText, new Action<string>(s => comm.CommPort.SendText(s)));
|
||||||
|
trilist.SetStringSigAction(joinMap.SetPortConfig, new Action<string>(s => comm.SetPortConfig(s)));
|
||||||
|
|
||||||
|
|
||||||
|
var sComm = comm.CommPort as ISocketStatus;
|
||||||
|
if (sComm != null)
|
||||||
|
{
|
||||||
|
sComm.ConnectionChange += (s, a) =>
|
||||||
|
{
|
||||||
|
trilist.SetUshort(joinMap.Status, (ushort)(a.Client.ClientStatus));
|
||||||
|
trilist.SetBool(joinMap.Connected, a.Client.ClientStatus ==
|
||||||
|
Crestron.SimplSharp.CrestronSockets.SocketStatus.SOCKET_STATUS_CONNECTED);
|
||||||
|
};
|
||||||
|
|
||||||
|
trilist.SetBoolSigAction(joinMap.Connect, new Action<bool>(b =>
|
||||||
|
{
|
||||||
|
if (b)
|
||||||
|
{
|
||||||
|
sComm.Connect();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sComm.Disconnect();
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
14
PepperDashEssentials/Bridges/IBridge.cs
Normal file
14
PepperDashEssentials/Bridges/IBridge.cs
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Bridges
|
||||||
|
{
|
||||||
|
public interface IBridge
|
||||||
|
{
|
||||||
|
void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
44
PepperDashEssentials/Bridges/IDigitalInputBridge.cs
Normal file
44
PepperDashEssentials/Bridges/IDigitalInputBridge.cs
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.Core.CrestronIO;
|
||||||
|
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Bridges
|
||||||
|
{
|
||||||
|
public static class IDigitalInputApiExtenstions
|
||||||
|
{
|
||||||
|
public static void LinkToApi(this IDigitalInput input, BasicTriList trilist, uint joinStart, string joinMapKey)
|
||||||
|
{
|
||||||
|
IDigitalInputJoinMap joinMap = new IDigitalInputJoinMap();
|
||||||
|
|
||||||
|
var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey);
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(joinMapSerialized))
|
||||||
|
joinMap = JsonConvert.DeserializeObject<IDigitalInputJoinMap>(joinMapSerialized);
|
||||||
|
|
||||||
|
joinMap.OffsetJoinNumbers(joinStart);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Debug.Console(1, input as Device, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||||
|
|
||||||
|
// Link feedback for input state
|
||||||
|
input.InputStateFeedback.LinkInputSig(trilist.BooleanInput[joinMap.InputState]);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.Console(1, input as Device, "Unable to link device '{0}'. Input is null", (input as Device).Key);
|
||||||
|
Debug.Console(1, input as Device, "Error: {0}", e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,110 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Bridges
|
||||||
|
{
|
||||||
|
public class AirMediaControllerJoinMap : JoinMapBase
|
||||||
|
{
|
||||||
|
#region Digitals
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates that the device is online when high
|
||||||
|
/// </summary>
|
||||||
|
public uint IsOnline { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates that the device is in session when high
|
||||||
|
/// </summary>
|
||||||
|
public uint IsInSession { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates sync detected on HDMI input when high
|
||||||
|
/// </summary>
|
||||||
|
public uint HdmiVideoSync { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Set High to enable automatic input routing and low to disable. Feedback high when enabled
|
||||||
|
/// </summary>
|
||||||
|
public uint AutomaticInputRoutingEnabled { get; set; }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Analogs
|
||||||
|
/// <summary>
|
||||||
|
/// Selects source and provides feedback
|
||||||
|
/// </summary>
|
||||||
|
public uint VideoOut { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Provided error feedback
|
||||||
|
/// </summary>
|
||||||
|
public uint ErrorFB { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates the number of connected users as feedback
|
||||||
|
/// </summary>
|
||||||
|
public uint NumberOfUsersConnectedFB { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the login code and provides the current code as feedback
|
||||||
|
/// </summary>
|
||||||
|
public uint LoginCode { get; set; }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Serials
|
||||||
|
/// <summary>
|
||||||
|
/// Provides the name defined in config as feedback
|
||||||
|
/// </summary>
|
||||||
|
public uint Name { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Provides the connection address as feedback
|
||||||
|
/// </summary>
|
||||||
|
public uint ConnectionAddressFB { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Provides the hostname as feedback
|
||||||
|
/// </summary>
|
||||||
|
public uint HostnameFB { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Provides the serial number as feedback
|
||||||
|
/// </summary>
|
||||||
|
public uint SerialNumberFeedback { get; set; }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public AirMediaControllerJoinMap()
|
||||||
|
{
|
||||||
|
// Digital
|
||||||
|
IsOnline = 1;
|
||||||
|
IsInSession = 2;
|
||||||
|
HdmiVideoSync = 3;
|
||||||
|
AutomaticInputRoutingEnabled = 4;
|
||||||
|
|
||||||
|
// Analog
|
||||||
|
VideoOut = 1;
|
||||||
|
ErrorFB = 2;
|
||||||
|
NumberOfUsersConnectedFB = 3;
|
||||||
|
LoginCode = 4;
|
||||||
|
|
||||||
|
// Serial
|
||||||
|
Name = 1;
|
||||||
|
ConnectionAddressFB = 2;
|
||||||
|
HostnameFB = 3;
|
||||||
|
SerialNumberFeedback = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OffsetJoinNumbers(uint joinStart)
|
||||||
|
{
|
||||||
|
var joinOffset = joinStart - 1;
|
||||||
|
|
||||||
|
IsOnline = IsOnline + joinOffset;
|
||||||
|
IsInSession = IsInSession + joinOffset;
|
||||||
|
HdmiVideoSync = HdmiVideoSync + joinOffset;
|
||||||
|
AutomaticInputRoutingEnabled = AutomaticInputRoutingEnabled + joinOffset;
|
||||||
|
|
||||||
|
VideoOut = VideoOut + joinOffset;
|
||||||
|
ErrorFB = ErrorFB + joinOffset;
|
||||||
|
NumberOfUsersConnectedFB = NumberOfUsersConnectedFB + joinOffset;
|
||||||
|
LoginCode = LoginCode + joinOffset;
|
||||||
|
|
||||||
|
Name = Name + joinOffset;
|
||||||
|
ConnectionAddressFB = ConnectionAddressFB + joinOffset;
|
||||||
|
HostnameFB = HostnameFB + joinOffset;
|
||||||
|
SerialNumberFeedback = SerialNumberFeedback + joinOffset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
67
PepperDashEssentials/Bridges/JoinMaps/AppleTvJoinMap.cs
Normal file
67
PepperDashEssentials/Bridges/JoinMaps/AppleTvJoinMap.cs
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Bridges
|
||||||
|
{
|
||||||
|
public class AppleTvJoinMap : JoinMapBase
|
||||||
|
{
|
||||||
|
#region Digitals
|
||||||
|
/// <summary>
|
||||||
|
/// Sends up arrow command while high
|
||||||
|
/// </summary>
|
||||||
|
public uint UpArrow { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Sends down arrow command while high
|
||||||
|
/// </summary>
|
||||||
|
public uint DnArrow { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Sends left arrow command while high
|
||||||
|
/// </summary>
|
||||||
|
public uint LeftArrow { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Sends right arrow command while high
|
||||||
|
/// </summary>
|
||||||
|
public uint RightArrow { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Sends menu command
|
||||||
|
/// </summary>
|
||||||
|
public uint Menu { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Sends select command
|
||||||
|
/// </summary>
|
||||||
|
public uint Select { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Sends play/pause command
|
||||||
|
/// </summary>
|
||||||
|
public uint PlayPause { get; set; }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public AppleTvJoinMap()
|
||||||
|
{
|
||||||
|
UpArrow = 1;
|
||||||
|
DnArrow = 2;
|
||||||
|
LeftArrow = 3;
|
||||||
|
RightArrow = 4;
|
||||||
|
Menu = 5;
|
||||||
|
Select = 6;
|
||||||
|
PlayPause = 7;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OffsetJoinNumbers(uint joinStart)
|
||||||
|
{
|
||||||
|
var joinOffset = joinStart - 1;
|
||||||
|
|
||||||
|
UpArrow = UpArrow + joinOffset;
|
||||||
|
DnArrow = DnArrow + joinOffset;
|
||||||
|
LeftArrow = LeftArrow + joinOffset;
|
||||||
|
RightArrow = RightArrow + joinOffset;
|
||||||
|
Menu = Menu + joinOffset;
|
||||||
|
Select = Select + joinOffset;
|
||||||
|
PlayPause = PlayPause + joinOffset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Bridges
|
||||||
|
{
|
||||||
|
public class CameraControllerJoinMap : JoinMapBase
|
||||||
|
{
|
||||||
|
public uint IsOnline { get; set; }
|
||||||
|
public uint PowerOff { get; set; }
|
||||||
|
public uint PowerOn { get; set; }
|
||||||
|
public uint Up { get; set; }
|
||||||
|
public uint Down { get; set; }
|
||||||
|
public uint Left { get; set; }
|
||||||
|
public uint Right { get; set; }
|
||||||
|
public uint ZoomIn { get; set; }
|
||||||
|
public uint ZoomOut { get; set; }
|
||||||
|
public uint PresetRecallOffset { get; set; }
|
||||||
|
public uint PresetSaveOffset { get; set; }
|
||||||
|
public uint NumberOfPresets { get; set; }
|
||||||
|
|
||||||
|
public CameraControllerJoinMap()
|
||||||
|
{
|
||||||
|
// Digital
|
||||||
|
IsOnline = 9;
|
||||||
|
PowerOff = 8;
|
||||||
|
PowerOn = 7;
|
||||||
|
Up = 1;
|
||||||
|
Down = 2;
|
||||||
|
Left = 3;
|
||||||
|
Right = 4;
|
||||||
|
ZoomIn = 5;
|
||||||
|
ZoomOut = 6;
|
||||||
|
PresetRecallOffset = 10;
|
||||||
|
PresetSaveOffset = 30;
|
||||||
|
NumberOfPresets = 5;
|
||||||
|
// Analog
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OffsetJoinNumbers(uint joinStart)
|
||||||
|
{
|
||||||
|
var joinOffset = joinStart - 1;
|
||||||
|
|
||||||
|
IsOnline = IsOnline + joinOffset;
|
||||||
|
PowerOff = PowerOff + joinOffset;
|
||||||
|
PowerOn = PowerOn + joinOffset;
|
||||||
|
Up = Up + joinOffset;
|
||||||
|
Down = Down + joinOffset;
|
||||||
|
Left = Left + joinOffset;
|
||||||
|
Right = Right + joinOffset;
|
||||||
|
ZoomIn = ZoomIn + joinOffset;
|
||||||
|
ZoomOut = ZoomOut + joinOffset;
|
||||||
|
PresetRecallOffset = PresetRecallOffset + joinOffset;
|
||||||
|
PresetSaveOffset = PresetSaveOffset + joinOffset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Bridges
|
||||||
|
{
|
||||||
|
public class DigitalLoggerJoinMap : JoinMapBase
|
||||||
|
{
|
||||||
|
public uint IsOnline { get; set; }
|
||||||
|
public uint CircuitNames { get; set; }
|
||||||
|
public uint CircuitState { get; set; }
|
||||||
|
public uint CircuitCycle { get; set; }
|
||||||
|
public uint CircuitIsCritical { get; set; }
|
||||||
|
public uint CircuitOnCmd { get; set; }
|
||||||
|
public uint CircuitOffCmd { get; set; }
|
||||||
|
|
||||||
|
public DigitalLoggerJoinMap()
|
||||||
|
{
|
||||||
|
// Digital
|
||||||
|
IsOnline = 9;
|
||||||
|
CircuitState = 0;
|
||||||
|
CircuitCycle = 0;
|
||||||
|
CircuitIsCritical = 10;
|
||||||
|
CircuitOnCmd = 10;
|
||||||
|
CircuitOffCmd = 20;
|
||||||
|
// Serial
|
||||||
|
CircuitNames = 0;
|
||||||
|
// Analog
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OffsetJoinNumbers(uint joinStart)
|
||||||
|
{
|
||||||
|
var joinOffset = joinStart - 1;
|
||||||
|
|
||||||
|
IsOnline = IsOnline + joinOffset;
|
||||||
|
CircuitNames = CircuitNames + joinOffset;
|
||||||
|
CircuitState = CircuitState + joinOffset;
|
||||||
|
CircuitCycle = CircuitCycle + joinOffset;
|
||||||
|
CircuitIsCritical = CircuitIsCritical + joinOffset;
|
||||||
|
CircuitOnCmd = CircuitOnCmd + joinOffset;
|
||||||
|
CircuitOffCmd = CircuitOffCmd + joinOffset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,117 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Bridges
|
||||||
|
{
|
||||||
|
public class DisplayControllerJoinMap : JoinMapBase
|
||||||
|
{
|
||||||
|
#region Digitals
|
||||||
|
/// <summary>
|
||||||
|
/// Turns the display off and reports power off feedback
|
||||||
|
/// </summary>
|
||||||
|
public uint PowerOff { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Turns the display on and repots power on feedback
|
||||||
|
/// </summary>
|
||||||
|
public uint PowerOn { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates that the display device supports two way communication when high
|
||||||
|
/// </summary>
|
||||||
|
public uint IsTwoWayDisplay { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Increments the volume while high
|
||||||
|
/// </summary>
|
||||||
|
public uint VolumeUp { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Decrements teh volume while high
|
||||||
|
/// </summary>
|
||||||
|
public uint VolumeDown { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Toggles the mute state. Feedback is high when volume is muted
|
||||||
|
/// </summary>
|
||||||
|
public uint VolumeMute { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Range of digital joins to select inputs and report current input as feedback
|
||||||
|
/// </summary>
|
||||||
|
public uint InputSelectOffset { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Range of digital joins to report visibility for input buttons
|
||||||
|
/// </summary>
|
||||||
|
public uint ButtonVisibilityOffset { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// High if the device is online
|
||||||
|
/// </summary>
|
||||||
|
public uint IsOnline { get; set; }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Analogs
|
||||||
|
/// <summary>
|
||||||
|
/// Analog join to set the input and report current input as feedback
|
||||||
|
/// </summary>
|
||||||
|
public uint InputSelect { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the volume level and reports the current level as feedback
|
||||||
|
/// </summary>
|
||||||
|
public uint VolumeLevel { get; set; }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Serials
|
||||||
|
/// <summary>
|
||||||
|
/// Reports the name of the display as defined in config as feedback
|
||||||
|
/// </summary>
|
||||||
|
public uint Name { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Range of serial joins that reports the names of the inputs as feedback
|
||||||
|
/// </summary>
|
||||||
|
public uint InputNamesOffset { get; set; }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public DisplayControllerJoinMap()
|
||||||
|
{
|
||||||
|
// Digital
|
||||||
|
IsOnline = 50;
|
||||||
|
PowerOff = 1;
|
||||||
|
PowerOn = 2;
|
||||||
|
IsTwoWayDisplay = 3;
|
||||||
|
VolumeUp = 5;
|
||||||
|
VolumeDown = 6;
|
||||||
|
VolumeMute = 7;
|
||||||
|
|
||||||
|
ButtonVisibilityOffset = 40;
|
||||||
|
InputSelectOffset = 10;
|
||||||
|
|
||||||
|
// Analog
|
||||||
|
InputSelect = 11;
|
||||||
|
VolumeLevel = 5;
|
||||||
|
|
||||||
|
// Serial
|
||||||
|
Name = 1;
|
||||||
|
InputNamesOffset = 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OffsetJoinNumbers(uint joinStart)
|
||||||
|
{
|
||||||
|
var joinOffset = joinStart - 1;
|
||||||
|
|
||||||
|
IsOnline = IsOnline + joinOffset;
|
||||||
|
PowerOff = PowerOff + joinOffset;
|
||||||
|
PowerOn = PowerOn + joinOffset;
|
||||||
|
IsTwoWayDisplay = IsTwoWayDisplay + joinOffset;
|
||||||
|
ButtonVisibilityOffset = ButtonVisibilityOffset + joinOffset;
|
||||||
|
Name = Name + joinOffset;
|
||||||
|
InputNamesOffset = InputNamesOffset + joinOffset;
|
||||||
|
InputSelectOffset = InputSelectOffset + joinOffset;
|
||||||
|
|
||||||
|
InputSelect = InputSelect + joinOffset;
|
||||||
|
|
||||||
|
VolumeUp = VolumeUp + joinOffset;
|
||||||
|
VolumeDown = VolumeDown + joinOffset;
|
||||||
|
VolumeMute = VolumeMute + joinOffset;
|
||||||
|
VolumeLevel = VolumeLevel + joinOffset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,147 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Bridges
|
||||||
|
{
|
||||||
|
public class DmChassisControllerJoinMap : JoinMapBase
|
||||||
|
{
|
||||||
|
#region Digital/Analogs
|
||||||
|
/// <summary>
|
||||||
|
/// Analog input sets System ID, output reports current ID as feedback.
|
||||||
|
/// Digital input applies System ID, output is high when applying busy.
|
||||||
|
/// </summary>
|
||||||
|
public uint SystemId { get; set; }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Digitals
|
||||||
|
/// <summary>
|
||||||
|
/// High when device is online
|
||||||
|
/// </summary>
|
||||||
|
public uint IsOnline { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Range reports video sync feedback for each input
|
||||||
|
/// </summary>
|
||||||
|
public uint VideoSyncStatus { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Range reports high if corresponding input's endpoint is online
|
||||||
|
/// </summary>
|
||||||
|
public uint InputEndpointOnline { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Range reports high if corresponding output's endpoint is online
|
||||||
|
/// </summary>
|
||||||
|
public uint OutputEndpointOnline { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Range reports high if corresponding input's transmitter supports bridging as a separate device for detailed AV switching, HDCP control, etc.
|
||||||
|
/// </summary>
|
||||||
|
public uint TxAdvancedIsPresent { get; set; } // indicates that there is an attached transmitter that should be bridged to be interacted with
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Analogs
|
||||||
|
/// <summary>
|
||||||
|
/// Range sets and reports the current video source for the corresponding output
|
||||||
|
/// </summary>
|
||||||
|
public uint OutputVideo { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Range sets and reports the current audio source for the corresponding output
|
||||||
|
/// </summary>
|
||||||
|
public uint OutputAudio { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Range sets and reports the current Usb source for the corresponding output
|
||||||
|
/// </summary>
|
||||||
|
public uint OutputUsb { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Range sets and reports the current Usb source for the corresponding input
|
||||||
|
/// </summary>
|
||||||
|
public uint InputUsb { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Range sets and reports the current HDCP state for the corresponding input card
|
||||||
|
/// </summary>
|
||||||
|
public uint HdcpSupportState { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Range reports the highest supported HDCP state level for the corresponding input card
|
||||||
|
/// </summary>
|
||||||
|
public uint HdcpSupportCapability { get; set; }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Serials
|
||||||
|
/// <summary>
|
||||||
|
/// Range sets and reports the name for the corresponding input card
|
||||||
|
/// </summary>
|
||||||
|
public uint InputNames { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Range sets and reports the name for the corresponding output card
|
||||||
|
/// </summary>
|
||||||
|
public uint OutputNames { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Range reports the name of the current video source for the corresponding output card
|
||||||
|
/// </summary>
|
||||||
|
public uint OutputCurrentVideoInputNames { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Range reports the name of the current audio source for the corresponding output card
|
||||||
|
/// </summary>
|
||||||
|
public uint OutputCurrentAudioInputNames { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Range reports the current input resolution for each corresponding input card
|
||||||
|
/// </summary>
|
||||||
|
public uint InputCurrentResolution { get; set; }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public DmChassisControllerJoinMap()
|
||||||
|
{
|
||||||
|
//Digital/Analog
|
||||||
|
SystemId = 10; // Analog sets/gets SystemId, digital input applies and provides feedback of ID change busy
|
||||||
|
|
||||||
|
//Digital
|
||||||
|
IsOnline = 11;
|
||||||
|
VideoSyncStatus = 100; //101-299
|
||||||
|
InputEndpointOnline = 500; //501-699
|
||||||
|
OutputEndpointOnline = 700; //701-899
|
||||||
|
TxAdvancedIsPresent = 1000; //1001-1199
|
||||||
|
|
||||||
|
//Analog
|
||||||
|
OutputVideo = 100; //101-299
|
||||||
|
OutputAudio = 300; //301-499
|
||||||
|
OutputUsb = 500; //501-699
|
||||||
|
InputUsb = 700; //701-899
|
||||||
|
VideoSyncStatus = 100; //101-299
|
||||||
|
HdcpSupportState = 1000; //1001-1199
|
||||||
|
HdcpSupportCapability = 1200; //1201-1399
|
||||||
|
|
||||||
|
|
||||||
|
//Serial
|
||||||
|
InputNames = 100; //101-299
|
||||||
|
OutputNames = 300; //301-499
|
||||||
|
OutputCurrentVideoInputNames = 2000; //2001-2199
|
||||||
|
OutputCurrentAudioInputNames = 2200; //2201-2399
|
||||||
|
InputCurrentResolution = 2400; // 2401-2599
|
||||||
|
InputEndpointOnline = 500; //501-699
|
||||||
|
OutputEndpointOnline = 700; //701-899
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OffsetJoinNumbers(uint joinStart)
|
||||||
|
{
|
||||||
|
var joinOffset = joinStart - 1;
|
||||||
|
|
||||||
|
SystemId = SystemId + joinOffset;
|
||||||
|
IsOnline = IsOnline + joinOffset;
|
||||||
|
OutputVideo = OutputVideo + joinOffset;
|
||||||
|
OutputAudio = OutputAudio + joinOffset;
|
||||||
|
OutputUsb = OutputUsb + joinOffset;
|
||||||
|
InputUsb = InputUsb + joinOffset;
|
||||||
|
VideoSyncStatus = VideoSyncStatus + joinOffset;
|
||||||
|
InputNames = InputNames + joinOffset;
|
||||||
|
OutputNames = OutputNames + joinOffset;
|
||||||
|
OutputCurrentVideoInputNames = OutputCurrentVideoInputNames + joinOffset;
|
||||||
|
OutputCurrentAudioInputNames = OutputCurrentAudioInputNames + joinOffset;
|
||||||
|
InputCurrentResolution = InputCurrentResolution + joinOffset;
|
||||||
|
InputEndpointOnline = InputEndpointOnline + joinOffset;
|
||||||
|
OutputEndpointOnline = OutputEndpointOnline + joinOffset;
|
||||||
|
HdcpSupportState = HdcpSupportState + joinOffset;
|
||||||
|
HdcpSupportCapability = HdcpSupportCapability + joinOffset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Bridges
|
||||||
|
{
|
||||||
|
public class DmRmcControllerJoinMap : JoinMapBase
|
||||||
|
{
|
||||||
|
#region Digitals
|
||||||
|
/// <summary>
|
||||||
|
/// High when device is online (if not attached to a DMP3 or DM chassis with a CPU3 card
|
||||||
|
/// </summary>
|
||||||
|
public uint IsOnline { get; set; }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Serials
|
||||||
|
/// <summary>
|
||||||
|
/// Reports the current output resolution
|
||||||
|
/// </summary>
|
||||||
|
public uint CurrentOutputResolution { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Reports the EDID manufacturer value
|
||||||
|
/// </summary>
|
||||||
|
public uint EdidManufacturer { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Reports the EDID Name value
|
||||||
|
/// </summary>
|
||||||
|
public uint EdidName { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Reports the EDID preffered timing value
|
||||||
|
/// </summary>
|
||||||
|
public uint EdidPrefferedTiming { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Reports the EDID serial number value
|
||||||
|
/// </summary>
|
||||||
|
public uint EdidSerialNumber { get; set; }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public DmRmcControllerJoinMap()
|
||||||
|
{
|
||||||
|
// Digital
|
||||||
|
IsOnline = 1;
|
||||||
|
|
||||||
|
// Serial
|
||||||
|
CurrentOutputResolution = 1;
|
||||||
|
EdidManufacturer = 2;
|
||||||
|
EdidName = 3;
|
||||||
|
EdidPrefferedTiming = 4;
|
||||||
|
EdidSerialNumber = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OffsetJoinNumbers(uint joinStart)
|
||||||
|
{
|
||||||
|
var joinOffset = joinStart - 1;
|
||||||
|
|
||||||
|
IsOnline = IsOnline + joinOffset;
|
||||||
|
CurrentOutputResolution = CurrentOutputResolution + joinOffset;
|
||||||
|
EdidManufacturer = EdidManufacturer + joinOffset;
|
||||||
|
EdidName = EdidName + joinOffset;
|
||||||
|
EdidPrefferedTiming = EdidPrefferedTiming + joinOffset;
|
||||||
|
EdidSerialNumber = EdidSerialNumber + joinOffset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Bridges
|
||||||
|
{
|
||||||
|
public class DmTxControllerJoinMap : JoinMapBase
|
||||||
|
{
|
||||||
|
#region Digitals
|
||||||
|
/// <summary>
|
||||||
|
/// High when device is online (if not attached to a DMP3 or DM chassis with a CPU3 card
|
||||||
|
/// </summary>
|
||||||
|
public uint IsOnline { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// High when video sync is detected
|
||||||
|
/// </summary>
|
||||||
|
public uint VideoSyncStatus { get; set; }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Analogs
|
||||||
|
/// <summary>
|
||||||
|
/// Sets and reports the video source
|
||||||
|
/// </summary>
|
||||||
|
public uint VideoInput { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Sets and reports the audio source
|
||||||
|
/// </summary>
|
||||||
|
public uint AudioInput { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Reports the highest supported HDCP state level for the corresponding input card
|
||||||
|
/// </summary>
|
||||||
|
public uint HdcpSupportCapability { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Sets and reports the current HDCP state for the corresponding input port
|
||||||
|
/// </summary>
|
||||||
|
public uint Port1HdcpState { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Sets and reports the current HDCP state for the corresponding input port
|
||||||
|
/// </summary>
|
||||||
|
public uint Port2HdcpState { get; set; }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Serials
|
||||||
|
/// <summary>
|
||||||
|
/// Reports the current input resolution
|
||||||
|
/// </summary>
|
||||||
|
public uint CurrentInputResolution { get; set; }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
public DmTxControllerJoinMap()
|
||||||
|
{
|
||||||
|
// Digital
|
||||||
|
IsOnline = 1;
|
||||||
|
VideoSyncStatus = 2;
|
||||||
|
// Serial
|
||||||
|
CurrentInputResolution = 1;
|
||||||
|
// Analog
|
||||||
|
VideoInput = 1;
|
||||||
|
AudioInput = 2;
|
||||||
|
HdcpSupportCapability = 3;
|
||||||
|
Port1HdcpState = 4;
|
||||||
|
Port2HdcpState = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OffsetJoinNumbers(uint joinStart)
|
||||||
|
{
|
||||||
|
var joinOffset = joinStart - 1;
|
||||||
|
|
||||||
|
IsOnline = IsOnline + joinOffset;
|
||||||
|
VideoSyncStatus = VideoSyncStatus + joinOffset;
|
||||||
|
CurrentInputResolution = CurrentInputResolution + joinOffset;
|
||||||
|
VideoInput = VideoInput + joinOffset;
|
||||||
|
AudioInput = AudioInput + joinOffset;
|
||||||
|
HdcpSupportCapability = HdcpSupportCapability + joinOffset;
|
||||||
|
Port1HdcpState = Port1HdcpState + joinOffset;
|
||||||
|
Port2HdcpState = Port2HdcpState + joinOffset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Bridges
|
||||||
|
{
|
||||||
|
public class DmpsAudioOutputControllerJoinMap : JoinMapBase
|
||||||
|
{
|
||||||
|
#region Digital/Analog
|
||||||
|
/// <summary>
|
||||||
|
/// Range of joins for Master Volume
|
||||||
|
/// Analog join 1 is volume level and feedback
|
||||||
|
/// Digital join 1 is Mute on and feedback
|
||||||
|
/// Digital join 2 is Mute off and feedback
|
||||||
|
/// Digital join 3 is volume up
|
||||||
|
/// Digital join 4 is volume down
|
||||||
|
/// </summary>
|
||||||
|
public uint MasterVolume { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Range of joins for Source Volume
|
||||||
|
/// Analog join 11 is volume level and feedback
|
||||||
|
/// Digital join 11 is Mute on and feedback
|
||||||
|
/// Digital join 12 is Mute off and feedback
|
||||||
|
/// Digital join 13 is volume up
|
||||||
|
/// Digital join 14 is volume down
|
||||||
|
/// </summary>
|
||||||
|
public uint SourceVolume { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Range of joins for Codec1 Volume (if applicable)
|
||||||
|
/// Analog join 21 is volume level and feedback
|
||||||
|
/// Digital join 21 is Mute on and feedback
|
||||||
|
/// Digital join 22 is Mute off and feedback
|
||||||
|
/// Digital join 23 is volume up
|
||||||
|
/// Digital join 24 is volume down
|
||||||
|
/// </summary>
|
||||||
|
public uint Codec1Volume { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Range of joins for Codec2 Volume (if applicable)
|
||||||
|
/// Analog join 31 is volume level and feedback
|
||||||
|
/// Digital join 31 is Mute on and feedback
|
||||||
|
/// Digital join 32 is Mute off and feedback
|
||||||
|
/// Digital join 33 is volume up
|
||||||
|
/// Digital join 34 is volume down
|
||||||
|
/// </summary>
|
||||||
|
public uint Codec2Volume { get; set; }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public DmpsAudioOutputControllerJoinMap()
|
||||||
|
{
|
||||||
|
MasterVolume = 1; // 1-10
|
||||||
|
SourceVolume = 11; // 11-20
|
||||||
|
Codec1Volume = 21; // 21-30
|
||||||
|
Codec2Volume = 31; // 31-40
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OffsetJoinNumbers(uint joinStart)
|
||||||
|
{
|
||||||
|
var joinOffset = joinStart;
|
||||||
|
|
||||||
|
MasterVolume = MasterVolume + joinOffset;
|
||||||
|
SourceVolume = SourceVolume + joinOffset;
|
||||||
|
Codec1Volume = Codec1Volume + joinOffset;
|
||||||
|
Codec2Volume = Codec2Volume + joinOffset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,127 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Bridges
|
||||||
|
{
|
||||||
|
public class DmpsRoutingControllerJoinMap : JoinMapBase
|
||||||
|
{
|
||||||
|
#region Digitals
|
||||||
|
/// <summary>
|
||||||
|
/// Range reports video sync feedback for each input
|
||||||
|
/// </summary>
|
||||||
|
public uint VideoSyncStatus { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Range reports high if corresponding input's endpoint is online
|
||||||
|
/// </summary>
|
||||||
|
public uint InputEndpointOnline { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Range reports high if corresponding output's endpoint is online
|
||||||
|
/// </summary>
|
||||||
|
public uint OutputEndpointOnline { get; set; }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
#region Analogs
|
||||||
|
/// <summary>
|
||||||
|
/// Range sets and reports the current video source for the corresponding output
|
||||||
|
/// </summary>
|
||||||
|
public uint OutputVideo { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Range sets and reports the current audio source for the corresponding output
|
||||||
|
/// </summary>
|
||||||
|
public uint OutputAudio { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Range sets and reports the current Usb source for the corresponding output
|
||||||
|
/// </summary>
|
||||||
|
//public uint OutputUsb { get; set; }
|
||||||
|
///// <summary>
|
||||||
|
///// Range sets and reports the current Usb source for the corresponding input
|
||||||
|
///// </summary>
|
||||||
|
//public uint InputUsb { get; set; }
|
||||||
|
///// <summary>
|
||||||
|
///// Range sets and reports the current HDCP state for the corresponding input card
|
||||||
|
///// </summary>
|
||||||
|
//public uint HdcpSupportState { get; set; }
|
||||||
|
///// <summary>
|
||||||
|
///// Range reports the highest supported HDCP state level for the corresponding input card
|
||||||
|
///// </summary>
|
||||||
|
//public uint HdcpSupportCapability { get; set; }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Serials
|
||||||
|
/// <summary>
|
||||||
|
/// Range sets and reports the name for the corresponding input card
|
||||||
|
/// </summary>
|
||||||
|
public uint InputNames { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Range sets and reports the name for the corresponding output card
|
||||||
|
/// </summary>
|
||||||
|
public uint OutputNames { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Range reports the name of the current video source for the corresponding output card
|
||||||
|
/// </summary>
|
||||||
|
public uint OutputCurrentVideoInputNames { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Range reports the name of the current audio source for the corresponding output card
|
||||||
|
/// </summary>
|
||||||
|
public uint OutputCurrentAudioInputNames { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Range reports the current input resolution for each corresponding input card
|
||||||
|
/// </summary>
|
||||||
|
public uint InputCurrentResolution { get; set; }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
public DmpsRoutingControllerJoinMap()
|
||||||
|
{
|
||||||
|
//Digital
|
||||||
|
VideoSyncStatus = 100; //101-299
|
||||||
|
InputEndpointOnline = 500; //501-699
|
||||||
|
OutputEndpointOnline = 700; //701-899
|
||||||
|
|
||||||
|
//Analog
|
||||||
|
OutputVideo = 100; //101-299
|
||||||
|
OutputAudio = 300; //301-499
|
||||||
|
//OutputUsb = 500; //501-699
|
||||||
|
//InputUsb = 700; //701-899
|
||||||
|
VideoSyncStatus = 100; //101-299
|
||||||
|
//HdcpSupportState = 1000; //1001-1199
|
||||||
|
//HdcpSupportCapability = 1200; //1201-1399
|
||||||
|
|
||||||
|
|
||||||
|
//Serial
|
||||||
|
InputNames = 100; //101-299
|
||||||
|
OutputNames = 300; //301-499
|
||||||
|
OutputCurrentVideoInputNames = 2000; //2001-2199
|
||||||
|
OutputCurrentAudioInputNames = 2200; //2201-2399
|
||||||
|
InputCurrentResolution = 2400; // 2401-2599
|
||||||
|
InputEndpointOnline = 500; //501-699
|
||||||
|
OutputEndpointOnline = 700; //701-899
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OffsetJoinNumbers(uint joinStart)
|
||||||
|
{
|
||||||
|
var joinOffset = joinStart - 1;
|
||||||
|
|
||||||
|
OutputVideo = OutputVideo + joinOffset;
|
||||||
|
OutputAudio = OutputAudio + joinOffset;
|
||||||
|
//OutputUsb = OutputUsb + joinOffset;
|
||||||
|
//InputUsb = InputUsb + joinOffset;
|
||||||
|
VideoSyncStatus = VideoSyncStatus + joinOffset;
|
||||||
|
InputNames = InputNames + joinOffset;
|
||||||
|
OutputNames = OutputNames + joinOffset;
|
||||||
|
OutputCurrentVideoInputNames = OutputCurrentVideoInputNames + joinOffset;
|
||||||
|
OutputCurrentAudioInputNames = OutputCurrentAudioInputNames + joinOffset;
|
||||||
|
InputCurrentResolution = InputCurrentResolution + joinOffset;
|
||||||
|
InputEndpointOnline = InputEndpointOnline + joinOffset;
|
||||||
|
OutputEndpointOnline = OutputEndpointOnline + joinOffset;
|
||||||
|
//HdcpSupportState = HdcpSupportState + joinOffset;
|
||||||
|
//HdcpSupportCapability = HdcpSupportCapability + joinOffset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Bridges
|
||||||
|
{
|
||||||
|
public class GenericLightingJoinMap : JoinMapBase
|
||||||
|
{
|
||||||
|
public uint IsOnline { get; set; }
|
||||||
|
public uint SelectScene { get; set; }
|
||||||
|
public uint LightingSceneOffset { get; set; }
|
||||||
|
public uint ButtonVisibilityOffset { get; set; }
|
||||||
|
public uint IntegrationIdSet { get; set; }
|
||||||
|
|
||||||
|
public GenericLightingJoinMap()
|
||||||
|
{
|
||||||
|
// Digital
|
||||||
|
IsOnline = 1;
|
||||||
|
SelectScene = 1;
|
||||||
|
IntegrationIdSet = 1;
|
||||||
|
LightingSceneOffset = 10;
|
||||||
|
ButtonVisibilityOffset = 40;
|
||||||
|
// Analog
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OffsetJoinNumbers(uint joinStart)
|
||||||
|
{
|
||||||
|
var joinOffset = joinStart - 1;
|
||||||
|
|
||||||
|
IsOnline = IsOnline + joinOffset;
|
||||||
|
SelectScene = SelectScene + joinOffset;
|
||||||
|
LightingSceneOffset = LightingSceneOffset + joinOffset;
|
||||||
|
ButtonVisibilityOffset = ButtonVisibilityOffset + joinOffset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Bridges
|
||||||
|
{
|
||||||
|
public class GenericRelayControllerJoinMap : JoinMapBase
|
||||||
|
{
|
||||||
|
#region Digitals
|
||||||
|
/// <summary>
|
||||||
|
/// Sets and reports the state of the relay (High = closed, Low = Open)
|
||||||
|
/// </summary>
|
||||||
|
public uint Relay { get; set; }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public GenericRelayControllerJoinMap()
|
||||||
|
{
|
||||||
|
Relay = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OffsetJoinNumbers(uint joinStart)
|
||||||
|
{
|
||||||
|
var joinOffset = joinStart - 1;
|
||||||
|
|
||||||
|
Relay = Relay + joinOffset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,119 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Bridges
|
||||||
|
{
|
||||||
|
public class HdMdxxxCEControllerJoinMap : JoinMapBase
|
||||||
|
{
|
||||||
|
#region Digitals
|
||||||
|
/// <summary>
|
||||||
|
/// High when the pair is online
|
||||||
|
/// </summary>
|
||||||
|
public uint IsOnline { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// High when the remote end device is online
|
||||||
|
/// </summary>
|
||||||
|
public uint RemoteEndDetected { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets Auto Route On and provides feedback
|
||||||
|
/// </summary>
|
||||||
|
public uint AutoRouteOn { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets Auto Route Off and provides feedback
|
||||||
|
/// </summary>
|
||||||
|
public uint AutoRouteOff { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets Priority Routing On and provides feedback
|
||||||
|
/// </summary>
|
||||||
|
public uint PriorityRoutingOn { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets Priority Routing Off and provides feedback
|
||||||
|
/// </summary>
|
||||||
|
public uint PriorityRoutingOff { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enables OSD and provides feedback
|
||||||
|
/// </summary>
|
||||||
|
public uint InputOnScreenDisplayEnabled { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Disables OSD and provides feedback
|
||||||
|
/// </summary>
|
||||||
|
public uint InputOnScreenDisplayDisabled { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Provides Video Sync Detected feedback for each input
|
||||||
|
/// </summary>
|
||||||
|
public uint SyncDetected { get; set; }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Analogs
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the video source for the receiver's HDMI out and provides feedback
|
||||||
|
/// </summary>
|
||||||
|
public uint VideoSource { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates the number of sources supported by the Tx/Rx pair
|
||||||
|
/// </summary>
|
||||||
|
public uint SourceCount { get; set; }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Serials
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates the name of each input port
|
||||||
|
/// </summary>
|
||||||
|
public uint SourceNames { get; set; }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public HdMdxxxCEControllerJoinMap()
|
||||||
|
{
|
||||||
|
//Digital
|
||||||
|
IsOnline = 1;
|
||||||
|
RemoteEndDetected = 2;
|
||||||
|
AutoRouteOn = 3;
|
||||||
|
AutoRouteOff = 4;
|
||||||
|
PriorityRoutingOn = 5;
|
||||||
|
PriorityRoutingOff = 6;
|
||||||
|
InputOnScreenDisplayEnabled = 7;
|
||||||
|
InputOnScreenDisplayDisabled = 8;
|
||||||
|
SyncDetected = 10; // 11-15
|
||||||
|
|
||||||
|
//Analog
|
||||||
|
VideoSource = 1;
|
||||||
|
SourceCount = 2;
|
||||||
|
|
||||||
|
//Serials
|
||||||
|
SourceNames = 10; // 11-15
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OffsetJoinNumbers(uint joinStart)
|
||||||
|
{
|
||||||
|
var joinOffset = joinStart - 1;
|
||||||
|
|
||||||
|
IsOnline = IsOnline + joinOffset;
|
||||||
|
RemoteEndDetected = RemoteEndDetected + joinOffset;
|
||||||
|
AutoRouteOn = AutoRouteOn + joinOffset;
|
||||||
|
AutoRouteOff = AutoRouteOff + joinOffset;
|
||||||
|
PriorityRoutingOn = PriorityRoutingOn + joinOffset;
|
||||||
|
PriorityRoutingOff = PriorityRoutingOff + joinOffset;
|
||||||
|
InputOnScreenDisplayEnabled = InputOnScreenDisplayEnabled + joinOffset;
|
||||||
|
InputOnScreenDisplayDisabled = InputOnScreenDisplayDisabled + joinOffset;
|
||||||
|
SyncDetected = SyncDetected + joinOffset;
|
||||||
|
|
||||||
|
VideoSource = VideoSource + joinOffset;
|
||||||
|
SourceCount = SourceCount + joinOffset;
|
||||||
|
|
||||||
|
SourceNames = SourceNames + joinOffset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Bridges
|
||||||
|
{
|
||||||
|
public class IBasicCommunicationJoinMap : JoinMapBase
|
||||||
|
{
|
||||||
|
#region Digitals
|
||||||
|
/// <summary>
|
||||||
|
/// Set High to connect, Low to disconnect
|
||||||
|
/// </summary>
|
||||||
|
public uint Connect { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Reports Connected State (High = Connected)
|
||||||
|
/// </summary>
|
||||||
|
public uint Connected { get; set; }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Analogs
|
||||||
|
/// <summary>
|
||||||
|
/// Reports the connections status value
|
||||||
|
/// </summary>
|
||||||
|
public uint Status { get; set; }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Serials
|
||||||
|
/// <summary>
|
||||||
|
/// Data back from port
|
||||||
|
/// </summary>
|
||||||
|
public uint TextReceived { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Sends data to the port
|
||||||
|
/// </summary>
|
||||||
|
public uint SendText { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Takes a JSON serialized string that sets a COM port's parameters
|
||||||
|
/// </summary>
|
||||||
|
public uint SetPortConfig { get; set; }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public IBasicCommunicationJoinMap()
|
||||||
|
{
|
||||||
|
TextReceived = 1;
|
||||||
|
SendText = 1;
|
||||||
|
SetPortConfig = 2;
|
||||||
|
Connect = 1;
|
||||||
|
Connected = 1;
|
||||||
|
Status = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OffsetJoinNumbers(uint joinStart)
|
||||||
|
{
|
||||||
|
var joinOffset = joinStart - 1;
|
||||||
|
|
||||||
|
TextReceived = TextReceived + joinOffset;
|
||||||
|
SendText = SendText + joinOffset;
|
||||||
|
SetPortConfig = SetPortConfig + joinOffset;
|
||||||
|
Connect = Connect + joinOffset;
|
||||||
|
Connected = Connected + joinOffset;
|
||||||
|
Status = Status + joinOffset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Bridges
|
||||||
|
{
|
||||||
|
public class IDigitalInputJoinMap : JoinMapBase
|
||||||
|
{
|
||||||
|
#region Digitals
|
||||||
|
/// <summary>
|
||||||
|
/// Reports the state of the digital input
|
||||||
|
/// </summary>
|
||||||
|
public uint InputState { get; set; }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public IDigitalInputJoinMap()
|
||||||
|
{
|
||||||
|
InputState = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OffsetJoinNumbers(uint joinStart)
|
||||||
|
{
|
||||||
|
var joinOffset = joinStart - 1;
|
||||||
|
|
||||||
|
InputState = InputState + joinOffset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
136
PepperDashEssentials/Bridges/JoinMaps/SystemMonitorJoinMap.cs
Normal file
136
PepperDashEssentials/Bridges/JoinMaps/SystemMonitorJoinMap.cs
Normal file
@@ -0,0 +1,136 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Bridges
|
||||||
|
{
|
||||||
|
public class SystemMonitorJoinMap : JoinMapBase
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Offset to indicate where the range of iterated program joins will start
|
||||||
|
/// </summary>
|
||||||
|
public uint ProgramStartJoin { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Offset between each program join set
|
||||||
|
/// </summary>
|
||||||
|
public uint ProgramOffsetJoin { get; set; }
|
||||||
|
|
||||||
|
#region Digitals
|
||||||
|
/// <summary>
|
||||||
|
/// Range Sets and reports whether the corresponding program slot is started
|
||||||
|
/// </summary>
|
||||||
|
public uint ProgramStart { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Range Sets and reports whether the corresponding program slot is stopped
|
||||||
|
/// </summary>
|
||||||
|
public uint ProgramStop { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Range Sets and reports whether the corresponding program is registered
|
||||||
|
/// </summary>
|
||||||
|
public uint ProgramRegister { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Range Sets and reports whether the corresponding program is unregistered
|
||||||
|
/// </summary>
|
||||||
|
public uint ProgramUnregister { get; set; }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Analogs
|
||||||
|
/// <summary>
|
||||||
|
/// Sets and reports the time zone
|
||||||
|
/// </summary>
|
||||||
|
public uint TimeZone { get; set; }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Serials
|
||||||
|
/// <summary>
|
||||||
|
/// Reports the time zone name
|
||||||
|
/// </summary>
|
||||||
|
public uint TimeZoneName { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Reports the IO Controller Version
|
||||||
|
/// </summary>
|
||||||
|
public uint IOControllerVersion { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Reports the SNMP App Version
|
||||||
|
/// </summary>
|
||||||
|
public uint SnmpAppVersion { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Reports the BACnet App Version
|
||||||
|
/// </summary>
|
||||||
|
public uint BACnetAppVersion { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Reports the firmware version
|
||||||
|
/// </summary>
|
||||||
|
public uint ControllerVersion { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Reports the name of the corresponding program
|
||||||
|
/// </summary>
|
||||||
|
public uint ProgramName { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Reports the compile time of the corresponding program
|
||||||
|
/// </summary>
|
||||||
|
public uint ProgramCompiledTime { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Reports the Crestron Database version of the corresponding program
|
||||||
|
/// </summary>
|
||||||
|
public uint ProgramCrestronDatabaseVersion { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Reports the Environment Version of the corresponding program
|
||||||
|
/// </summary>
|
||||||
|
public uint ProgramEnvironmentVersion { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Serialized JSON output that aggregates the program info of the corresponding program
|
||||||
|
/// </summary>
|
||||||
|
public uint AggregatedProgramInfo { get; set; }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public SystemMonitorJoinMap()
|
||||||
|
{
|
||||||
|
TimeZone = 1;
|
||||||
|
|
||||||
|
TimeZoneName = 1;
|
||||||
|
IOControllerVersion = 2;
|
||||||
|
SnmpAppVersion = 3;
|
||||||
|
BACnetAppVersion = 4;
|
||||||
|
ControllerVersion = 5;
|
||||||
|
|
||||||
|
|
||||||
|
ProgramStartJoin = 10;
|
||||||
|
|
||||||
|
ProgramOffsetJoin = 5;
|
||||||
|
|
||||||
|
// Offset in groups of 5 joins
|
||||||
|
ProgramStart = 1;
|
||||||
|
ProgramStop = 2;
|
||||||
|
ProgramRegister = 3;
|
||||||
|
ProgramUnregister = 4;
|
||||||
|
|
||||||
|
ProgramName = 1;
|
||||||
|
ProgramCompiledTime = 2;
|
||||||
|
ProgramCrestronDatabaseVersion = 3;
|
||||||
|
ProgramEnvironmentVersion = 4;
|
||||||
|
AggregatedProgramInfo = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OffsetJoinNumbers(uint joinStart)
|
||||||
|
{
|
||||||
|
var joinOffset = joinStart - 1;
|
||||||
|
|
||||||
|
TimeZone = TimeZone + joinOffset;
|
||||||
|
|
||||||
|
TimeZoneName = TimeZoneName + joinOffset;
|
||||||
|
IOControllerVersion = IOControllerVersion + joinOffset;
|
||||||
|
SnmpAppVersion = SnmpAppVersion + joinOffset;
|
||||||
|
BACnetAppVersion = BACnetAppVersion + joinOffset;
|
||||||
|
ControllerVersion = ControllerVersion + joinOffset;
|
||||||
|
|
||||||
|
// Sets the initial join value where the iterated program joins will begin
|
||||||
|
ProgramStartJoin = ProgramStartJoin + joinOffset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
68
PepperDashEssentials/Bridges/SystemMonitorBridge.cs
Normal file
68
PepperDashEssentials/Bridges/SystemMonitorBridge.cs
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
using Crestron.SimplSharpPro.Diagnostics;
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.Core.Monitoring;
|
||||||
|
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Bridges
|
||||||
|
{
|
||||||
|
public static class SystemMonitorBridge
|
||||||
|
{
|
||||||
|
public static void LinkToApi(this SystemMonitorController systemMonitorController, BasicTriList trilist, uint joinStart, string joinMapKey)
|
||||||
|
{
|
||||||
|
SystemMonitorJoinMap joinMap = new SystemMonitorJoinMap();
|
||||||
|
|
||||||
|
var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey);
|
||||||
|
|
||||||
|
if(!string.IsNullOrEmpty(joinMapSerialized))
|
||||||
|
joinMap = JsonConvert.DeserializeObject<SystemMonitorJoinMap>(joinMapSerialized);
|
||||||
|
|
||||||
|
joinMap.OffsetJoinNumbers(joinStart);
|
||||||
|
|
||||||
|
Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||||
|
Debug.Console(2, systemMonitorController, "Linking API starting at join: {0}", joinStart);
|
||||||
|
|
||||||
|
systemMonitorController.TimeZoneFeedback.LinkInputSig(trilist.UShortInput[joinMap.TimeZone]);
|
||||||
|
//trilist.SetUShortSigAction(joinMap.TimeZone, new Action<ushort>(u => systemMonitorController.SetTimeZone(u)));
|
||||||
|
systemMonitorController.TimeZoneTextFeedback.LinkInputSig(trilist.StringInput[joinMap.TimeZoneName]);
|
||||||
|
|
||||||
|
systemMonitorController.IOControllerVersionFeedback.LinkInputSig(trilist.StringInput[joinMap.IOControllerVersion]);
|
||||||
|
systemMonitorController.SnmpVersionFeedback.LinkInputSig(trilist.StringInput[joinMap.SnmpAppVersion]);
|
||||||
|
systemMonitorController.BACnetAppVersionFeedback.LinkInputSig(trilist.StringInput[joinMap.BACnetAppVersion]);
|
||||||
|
systemMonitorController.ControllerVersionFeedback.LinkInputSig(trilist.StringInput[joinMap.ControllerVersion]);
|
||||||
|
|
||||||
|
// iterate the program status feedback collection and map all the joins
|
||||||
|
var programSlotJoinStart = joinMap.ProgramStartJoin;
|
||||||
|
|
||||||
|
foreach (var p in systemMonitorController.ProgramStatusFeedbackCollection)
|
||||||
|
{
|
||||||
|
var programNumber = p.Value.Program.Number;
|
||||||
|
|
||||||
|
trilist.SetBoolSigAction(programSlotJoinStart + joinMap.ProgramStart, new Action<bool>
|
||||||
|
(b => SystemMonitor.ProgramCollection[programNumber].OperatingState = eProgramOperatingState.Start));
|
||||||
|
p.Value.ProgramStartedFeedback.LinkInputSig(trilist.BooleanInput[programSlotJoinStart + joinMap.ProgramStart]);
|
||||||
|
|
||||||
|
trilist.SetBoolSigAction(programSlotJoinStart + joinMap.ProgramStop, new Action<bool>
|
||||||
|
(b => SystemMonitor.ProgramCollection[programNumber].OperatingState = eProgramOperatingState.Stop));
|
||||||
|
p.Value.ProgramStoppedFeedback.LinkInputSig(trilist.BooleanInput[programSlotJoinStart + joinMap.ProgramStop]);
|
||||||
|
|
||||||
|
trilist.SetBoolSigAction(programSlotJoinStart + joinMap.ProgramRegister, new Action<bool>
|
||||||
|
(b => SystemMonitor.ProgramCollection[programNumber].RegistrationState = eProgramRegistrationState.Register));
|
||||||
|
p.Value.ProgramRegisteredFeedback.LinkInputSig(trilist.BooleanInput[programSlotJoinStart + joinMap.ProgramRegister]);
|
||||||
|
|
||||||
|
trilist.SetBoolSigAction(programSlotJoinStart + joinMap.ProgramUnregister, new Action<bool>
|
||||||
|
(b => SystemMonitor.ProgramCollection[programNumber].RegistrationState = eProgramRegistrationState.Unregister));
|
||||||
|
p.Value.ProgramUnregisteredFeedback.LinkInputSig(trilist.BooleanInput[programSlotJoinStart + joinMap.ProgramUnregister]);
|
||||||
|
|
||||||
|
programSlotJoinStart = programSlotJoinStart + joinMap.ProgramOffsetJoin;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -80,6 +80,16 @@ namespace PepperDash.Essentials
|
|||||||
var dm = new DmMd8x8(ipId, Global.ControlSystem);
|
var dm = new DmMd8x8(ipId, Global.ControlSystem);
|
||||||
//dev = new DmChassisController(devKey, devName, dm);
|
//dev = new DmChassisController(devKey, devName, dm);
|
||||||
}
|
}
|
||||||
|
else if (devType.Equals("dmmd16x16", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
var dm = new DmMd16x16(ipId, Global.ControlSystem);
|
||||||
|
//dev = new DmChassisController(devKey, devName, dm);
|
||||||
|
}
|
||||||
|
else if (devType.Equals("dmmd32x32", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
var dm = new DmMd32x32(ipId, Global.ControlSystem);
|
||||||
|
//dev = new DmChassisController(devKey, devName, dm);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
using Crestron.SimplSharp.CrestronIO;
|
using Crestron.SimplSharp.CrestronIO;
|
||||||
using Crestron.SimplSharpPro;
|
using Crestron.SimplSharpPro;
|
||||||
using Crestron.SimplSharpPro.CrestronThread;
|
using Crestron.SimplSharpPro.CrestronThread;
|
||||||
|
using Crestron.SimplSharpPro.Diagnostics;
|
||||||
|
using Crestron.SimplSharp.Reflection;
|
||||||
|
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core;
|
using PepperDash.Essentials.Core;
|
||||||
using PepperDash.Essentials.Core.Config;
|
using PepperDash.Essentials.Core.Config;
|
||||||
@@ -15,29 +19,35 @@ using PepperDash.Essentials.Room.Cotija;
|
|||||||
|
|
||||||
namespace PepperDash.Essentials
|
namespace PepperDash.Essentials
|
||||||
{
|
{
|
||||||
public class ControlSystem : CrestronControlSystem
|
public class ControlSystem : CrestronControlSystem
|
||||||
{
|
{
|
||||||
HttpLogoServer LogoServer;
|
HttpLogoServer LogoServer;
|
||||||
|
|
||||||
public ControlSystem()
|
List<object> FactoryObjects = new List<object>();
|
||||||
: base()
|
|
||||||
{
|
|
||||||
Thread.MaxNumberOfUserThreads = 400;
|
|
||||||
Global.ControlSystem = this;
|
|
||||||
DeviceManager.Initialize(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
public ControlSystem()
|
||||||
/// Git 'er goin'
|
: base()
|
||||||
/// </summary>
|
{
|
||||||
public override void InitializeSystem()
|
Thread.MaxNumberOfUserThreads = 400;
|
||||||
{
|
Global.ControlSystem = this;
|
||||||
|
DeviceManager.Initialize(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Git 'er goin'
|
||||||
|
/// </summary>
|
||||||
|
public override void InitializeSystem()
|
||||||
|
{
|
||||||
DeterminePlatform();
|
DeterminePlatform();
|
||||||
|
|
||||||
//CrestronConsole.AddNewConsoleCommand(s => GoWithLoad(), "go", "Loads configuration file",
|
//CrestronConsole.AddNewConsoleCommand(s => GoWithLoad(), "go", "Loads configuration file",
|
||||||
// ConsoleAccessLevelEnum.AccessOperator);
|
// ConsoleAccessLevelEnum.AccessOperator);
|
||||||
|
|
||||||
// CrestronConsole.AddNewConsoleCommand(S => { ConfigWriter.WriteConfigFile(null); }, "writeconfig", "writes the current config to a file", ConsoleAccessLevelEnum.AccessOperator);
|
// CrestronConsole.AddNewConsoleCommand(S => { ConfigWriter.WriteConfigFile(null); }, "writeconfig", "writes the current config to a file", ConsoleAccessLevelEnum.AccessOperator);
|
||||||
|
CrestronConsole.AddNewConsoleCommand(s =>
|
||||||
|
{
|
||||||
|
Debug.Console(0, Debug.ErrorLogLevel.Notice, "CONSOLE MESSAGE: {0}", s);
|
||||||
|
}, "appdebugmessage", "Writes message to log", ConsoleAccessLevelEnum.AccessOperator);
|
||||||
|
|
||||||
CrestronConsole.AddNewConsoleCommand(s =>
|
CrestronConsole.AddNewConsoleCommand(s =>
|
||||||
{
|
{
|
||||||
@@ -46,26 +56,26 @@ namespace PepperDash.Essentials
|
|||||||
},
|
},
|
||||||
"listtielines", "Prints out all tie lines", ConsoleAccessLevelEnum.AccessOperator);
|
"listtielines", "Prints out all tie lines", ConsoleAccessLevelEnum.AccessOperator);
|
||||||
|
|
||||||
CrestronConsole.AddNewConsoleCommand(s =>
|
CrestronConsole.AddNewConsoleCommand(s =>
|
||||||
{
|
{
|
||||||
CrestronConsole.ConsoleCommandResponse
|
CrestronConsole.ConsoleCommandResponse
|
||||||
("Current running configuration. This is the merged system and template configuration");
|
("Current running configuration. This is the merged system and template configuration");
|
||||||
CrestronConsole.ConsoleCommandResponse(Newtonsoft.Json.JsonConvert.SerializeObject
|
CrestronConsole.ConsoleCommandResponse(Newtonsoft.Json.JsonConvert.SerializeObject
|
||||||
(ConfigReader.ConfigObject, Newtonsoft.Json.Formatting.Indented));
|
(ConfigReader.ConfigObject, Newtonsoft.Json.Formatting.Indented));
|
||||||
}, "showconfig", "Shows the current running merged config", ConsoleAccessLevelEnum.AccessOperator);
|
}, "showconfig", "Shows the current running merged config", ConsoleAccessLevelEnum.AccessOperator);
|
||||||
|
|
||||||
CrestronConsole.AddNewConsoleCommand(s =>
|
CrestronConsole.AddNewConsoleCommand(s =>
|
||||||
{
|
{
|
||||||
CrestronConsole.ConsoleCommandResponse("This system can be found at the following URLs:\r" +
|
CrestronConsole.ConsoleCommandResponse("This system can be found at the following URLs:\r" +
|
||||||
"System URL: {0}\r" +
|
"System URL: {0}\r" +
|
||||||
"Template URL: {1}", ConfigReader.ConfigObject.SystemUrl, ConfigReader.ConfigObject.TemplateUrl);
|
"Template URL: {1}", ConfigReader.ConfigObject.SystemUrl, ConfigReader.ConfigObject.TemplateUrl);
|
||||||
}, "portalinfo", "Shows portal URLS from configuration", ConsoleAccessLevelEnum.AccessOperator);
|
}, "portalinfo", "Shows portal URLS from configuration", ConsoleAccessLevelEnum.AccessOperator);
|
||||||
|
|
||||||
GoWithLoad();
|
GoWithLoad();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines if the program is running on a processor (appliance) or server (XiO Edge).
|
/// Determines if the program is running on a processor (appliance) or server (VC-4).
|
||||||
///
|
///
|
||||||
/// Sets Global.FilePathPrefix based on platform
|
/// Sets Global.FilePathPrefix based on platform
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -85,100 +95,214 @@ namespace PepperDash.Essentials
|
|||||||
|
|
||||||
directoryPrefix = Crestron.SimplSharp.CrestronIO.Directory.GetApplicationRootDirectory();
|
directoryPrefix = Crestron.SimplSharp.CrestronIO.Directory.GetApplicationRootDirectory();
|
||||||
|
|
||||||
//directoryPrefix = "";
|
if (CrestronEnvironment.DevicePlatform != eDevicePlatform.Server) // Handles 3-series running Windows OS
|
||||||
|
|
||||||
if (CrestronEnvironment.DevicePlatform != eDevicePlatform.Server)
|
|
||||||
{
|
{
|
||||||
filePathPrefix = directoryPrefix + dirSeparator + "NVRAM"
|
|
||||||
+ dirSeparator + string.Format("program{0}", InitialParametersClass.ApplicationNumber) + dirSeparator;
|
|
||||||
|
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Starting Essentials v{0} on 3-series Appliance", versionString);
|
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Starting Essentials v{0} on 3-series Appliance", versionString);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
filePathPrefix = directoryPrefix + dirSeparator + "User" + dirSeparator;
|
|
||||||
|
|
||||||
|
// Check if User/ProgramX exists
|
||||||
|
if (Directory.Exists(directoryPrefix + dirSeparator + "User"
|
||||||
|
+ dirSeparator + string.Format("program{0}", InitialParametersClass.ApplicationNumber)))
|
||||||
|
{
|
||||||
|
Debug.Console(0, @"User/program{0} directory found", InitialParametersClass.ApplicationNumber);
|
||||||
|
filePathPrefix = directoryPrefix + dirSeparator + "User"
|
||||||
|
+ dirSeparator + string.Format("program{0}", InitialParametersClass.ApplicationNumber) + dirSeparator;
|
||||||
|
}
|
||||||
|
// Check if Nvram/Programx exists
|
||||||
|
else if (Directory.Exists(directoryPrefix + dirSeparator + "Nvram"
|
||||||
|
+ dirSeparator + string.Format("program{0}", InitialParametersClass.ApplicationNumber)))
|
||||||
|
{
|
||||||
|
Debug.Console(0, @"Nvram/program{0} directory found", InitialParametersClass.ApplicationNumber);
|
||||||
|
filePathPrefix = directoryPrefix + dirSeparator + "Nvram"
|
||||||
|
+ dirSeparator + string.Format("program{0}", InitialParametersClass.ApplicationNumber) + dirSeparator;
|
||||||
|
}
|
||||||
|
// If neither exists, set path to User/ProgramX
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.Console(0, @"No previous directory found. Using User/program{0}", InitialParametersClass.ApplicationNumber);
|
||||||
|
filePathPrefix = directoryPrefix + dirSeparator + "User"
|
||||||
|
+ dirSeparator + string.Format("program{0}", InitialParametersClass.ApplicationNumber) + dirSeparator;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // Handles Linux OS (Virtual Control)
|
||||||
|
{
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Starting Essentials v{0} on Virtual Control Server", versionString);
|
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Starting Essentials v{0} on Virtual Control Server", versionString);
|
||||||
|
|
||||||
|
// Set path to User/
|
||||||
|
filePathPrefix = directoryPrefix + dirSeparator + "User" + dirSeparator;
|
||||||
}
|
}
|
||||||
|
|
||||||
Global.SetFilePathPrefix(filePathPrefix);
|
Global.SetFilePathPrefix(filePathPrefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Do it, yo
|
/// Do it, yo
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void GoWithLoad()
|
public void GoWithLoad()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
CrestronConsole.AddNewConsoleCommand(EnablePortalSync, "portalsync", "Loads Portal Sync",
|
|
||||||
ConsoleAccessLevelEnum.AccessOperator);
|
|
||||||
|
|
||||||
//PortalSync = new PepperDashPortalSyncClient();
|
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Starting Essentials load from configuration");
|
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Starting Essentials load from configuration");
|
||||||
|
|
||||||
var filesReady = SetupFilesystem();
|
var filesReady = SetupFilesystem();
|
||||||
if (filesReady)
|
if (filesReady)
|
||||||
{
|
{
|
||||||
|
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Checking for plugins");
|
||||||
|
LoadPlugins();
|
||||||
|
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Folder structure verified. Loading config...");
|
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Folder structure verified. Loading config...");
|
||||||
if (!ConfigReader.LoadConfig2())
|
if (!ConfigReader.LoadConfig2())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Load();
|
Load();
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Essentials load complete\r" +
|
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Essentials load complete\r" +
|
||||||
"-------------------------------------------------------------");
|
"-------------------------------------------------------------");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Debug.Console(0,
|
Debug.Console(0,
|
||||||
"------------------------------------------------\r" +
|
"------------------------------------------------\r" +
|
||||||
"------------------------------------------------\r" +
|
"------------------------------------------------\r" +
|
||||||
"------------------------------------------------\r" +
|
"------------------------------------------------\r" +
|
||||||
"Essentials file structure setup completed.\r" +
|
"Essentials file structure setup completed.\r" +
|
||||||
"Please load config, sgd and ir files and\r" +
|
"Please load config, sgd and ir files and\r" +
|
||||||
"restart program.\r" +
|
"restart program.\r" +
|
||||||
"------------------------------------------------\r" +
|
"------------------------------------------------\r" +
|
||||||
"------------------------------------------------\r" +
|
"------------------------------------------------\r" +
|
||||||
"------------------------------------------------");
|
"------------------------------------------------");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Debug.Console(0, "FATAL INITIALIZE ERROR. System is in an inconsistent state:\r{0}", e);
|
Debug.Console(0, "FATAL INITIALIZE ERROR. System is in an inconsistent state:\r{0}", e);
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
}
|
||||||
/// Verifies filesystem is set up. IR, SGD, and program1 folders
|
|
||||||
/// </summary>
|
|
||||||
bool SetupFilesystem()
|
|
||||||
{
|
|
||||||
Debug.Console(0, "Verifying and/or creating folder structure");
|
|
||||||
var configDir = Global.FilePathPrefix;
|
|
||||||
var configExists = Directory.Exists(configDir);
|
|
||||||
if (!configExists)
|
|
||||||
Directory.Create(configDir);
|
|
||||||
|
|
||||||
var irDir = Global.FilePathPrefix + "ir";
|
// Notify the OS that the program intitialization has completed
|
||||||
if (!Directory.Exists(irDir))
|
SystemMonitor.ProgramInitialization.ProgramInitializationComplete = true;
|
||||||
Directory.Create(irDir);
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initial simple implementation. Reads user/programN/plugins folder and
|
||||||
|
/// use
|
||||||
|
/// </summary>
|
||||||
|
void LoadPlugins()
|
||||||
|
{
|
||||||
|
var dir = Global.FilePathPrefix + "plugins";
|
||||||
|
if (Directory.Exists(dir))
|
||||||
|
{
|
||||||
|
// TODO Clear out or create localPlugins folder (maybe in program slot folder)
|
||||||
|
|
||||||
|
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Plugins directory found, checking for factory plugins");
|
||||||
|
var di = new DirectoryInfo(dir);
|
||||||
|
var zFiles = di.GetFiles("*.cplz");
|
||||||
|
foreach (var fi in zFiles)
|
||||||
|
{
|
||||||
|
Debug.Console(0, "Found cplz: {0}. Unzipping into plugins directory", fi.Name);
|
||||||
|
var result = CrestronZIP.Unzip(fi.FullName, di.FullName);
|
||||||
|
Debug.Console(0, "UnZip Result: {0}", result.ToString());
|
||||||
|
fi.Delete();
|
||||||
|
}
|
||||||
|
var files = di.GetFiles("*.dll");
|
||||||
|
Dictionary<string, Assembly> assyList = new Dictionary<string, Assembly>();
|
||||||
|
foreach (FileInfo fi in files)
|
||||||
|
{
|
||||||
|
// TODO COPY plugin to loadedPlugins folder
|
||||||
|
// TODO LOAD that loadedPlugins dll file
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var assy = Assembly.LoadFrom(fi.FullName);
|
||||||
|
var ver = assy.GetName().Version;
|
||||||
|
var verStr = string.Format("{0}.{1}.{2}.{3}", ver.Major, ver.Minor, ver.Build, ver.Revision);
|
||||||
|
assyList.Add(fi.FullName, assy);
|
||||||
|
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Loaded plugin file '{0}', version {1}", fi.FullName, verStr);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
Debug.Console(2, "Assembly {0} is not a custom assembly", fi.FullName);
|
||||||
|
continue; //catching any load issues and continuing. There will be exceptions loading Crestron .dlls from the cplz Probably should do something different here
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach (var assy in assyList)
|
||||||
|
{
|
||||||
|
// iteratate this assembly's classes, looking for "LoadPlugin()" methods
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var types = assy.Value.GetTypes();
|
||||||
|
foreach (var type in types)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var methods = type.GetMethods(BindingFlags.Public | BindingFlags.Static);
|
||||||
|
var loadPlugin = methods.FirstOrDefault(m => m.Name.Equals("LoadPlugin"));
|
||||||
|
if (loadPlugin != null)
|
||||||
|
{
|
||||||
|
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Adding type {0}", assy.Key, type.FullName);
|
||||||
|
loadPlugin.Invoke(null, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
Debug.Console(2, "Load Plugin not found. {0} is not a plugin assembly", assy.Value.FullName);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
Debug.Console(2, "Assembly {0} is not a custom assembly. Types cannot be loaded.", assy.Value.FullName);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// plugin dll will be loaded. Any classes in plugin should have a static constructor
|
||||||
|
// that registers that class with the Core.DeviceFactory
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Verifies filesystem is set up. IR, SGD, and programX folders
|
||||||
|
/// </summary>
|
||||||
|
bool SetupFilesystem()
|
||||||
|
{
|
||||||
|
Debug.Console(0, "Verifying and/or creating folder structure");
|
||||||
|
var configDir = Global.FilePathPrefix;
|
||||||
|
var configExists = Directory.Exists(configDir);
|
||||||
|
if (!configExists)
|
||||||
|
Directory.Create(configDir);
|
||||||
|
|
||||||
|
var irDir = Global.FilePathPrefix + "ir";
|
||||||
|
if (!Directory.Exists(irDir))
|
||||||
|
Directory.Create(irDir);
|
||||||
|
|
||||||
var sgdDir = Global.FilePathPrefix + "sgd";
|
var sgdDir = Global.FilePathPrefix + "sgd";
|
||||||
if (!Directory.Exists(sgdDir))
|
if (!Directory.Exists(sgdDir))
|
||||||
Directory.Create(sgdDir);
|
Directory.Create(sgdDir);
|
||||||
|
|
||||||
|
var pluginDir = Global.FilePathPrefix + "plugins";
|
||||||
|
if (!Directory.Exists(pluginDir))
|
||||||
|
Directory.Create(pluginDir);
|
||||||
|
|
||||||
return configExists;
|
return configExists;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void EnablePortalSync(string s)
|
///// <summary>
|
||||||
{
|
/////
|
||||||
if (s.ToLower() == "enable")
|
///// </summary>
|
||||||
{
|
///// <param name="s"></param>
|
||||||
CrestronConsole.ConsoleCommandResponse("Portal Sync features enabled");
|
//public void EnablePortalSync(string s)
|
||||||
}
|
//{
|
||||||
}
|
// if (s.ToLower() == "enable")
|
||||||
|
// {
|
||||||
|
// CrestronConsole.ConsoleCommandResponse("Portal Sync features enabled");
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public void TearDown()
|
public void TearDown()
|
||||||
{
|
{
|
||||||
Debug.Console(0, "Tearing down existing system");
|
Debug.Console(0, "Tearing down existing system");
|
||||||
@@ -203,38 +327,83 @@ namespace PepperDash.Essentials
|
|||||||
LoadLogoServer();
|
LoadLogoServer();
|
||||||
|
|
||||||
DeviceManager.ActivateAll();
|
DeviceManager.ActivateAll();
|
||||||
}
|
|
||||||
|
LinkSystemMonitorToAppServer();
|
||||||
|
}
|
||||||
|
|
||||||
|
void LinkSystemMonitorToAppServer()
|
||||||
|
{
|
||||||
|
var sysMon = DeviceManager.GetDeviceForKey("systemMonitor") as PepperDash.Essentials.Core.Monitoring.SystemMonitorController;
|
||||||
|
|
||||||
|
var appServer = DeviceManager.GetDeviceForKey("appServer") as CotijaSystemController;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
if (sysMon != null && appServer != null)
|
||||||
/// Reads all devices from config and adds them to DeviceManager
|
{
|
||||||
/// </summary>
|
var key = sysMon.Key + "-" + appServer.Key;
|
||||||
public void LoadDevices()
|
var messenger = new PepperDash.Essentials.AppServer.Messengers.SystemMonitorMessenger
|
||||||
{
|
(key, sysMon, "/device/systemMonitor");
|
||||||
|
|
||||||
|
messenger.RegisterWithAppServer(appServer);
|
||||||
|
|
||||||
|
DeviceManager.AddDevice(messenger);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Reads all devices from config and adds them to DeviceManager
|
||||||
|
/// </summary>
|
||||||
|
public void LoadDevices()
|
||||||
|
{
|
||||||
// Build the processor wrapper class
|
// Build the processor wrapper class
|
||||||
|
|
||||||
DeviceManager.AddDevice(new PepperDash.Essentials.Core.Devices.CrestronProcessor("processor"));
|
DeviceManager.AddDevice(new PepperDash.Essentials.Core.Devices.CrestronProcessor("processor"));
|
||||||
|
|
||||||
foreach (var devConf in ConfigReader.ConfigObject.Devices)
|
// Check if the processor is a DMPS model
|
||||||
{
|
if (this.ControllerPrompt.IndexOf("dmps", StringComparison.OrdinalIgnoreCase) > -1)
|
||||||
|
{
|
||||||
|
Debug.Console(2, "Adding DmpsRoutingController for {0} to Device Manager.", this.ControllerPrompt);
|
||||||
|
|
||||||
try
|
var dmpsRoutingController = DmpsRoutingController.GetDmpsRoutingController("processor-avRouting", this.ControllerPrompt, new DM.Config.DmpsRoutingPropertiesConfig());
|
||||||
{
|
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Creating device '{0}'", devConf.Key);
|
DeviceManager.AddDevice(dmpsRoutingController);
|
||||||
// Skip this to prevent unnecessary warnings
|
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.Console(2, "************Processor is not DMPS type***************");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add global System Monitor device
|
||||||
|
DeviceManager.AddDevice(new PepperDash.Essentials.Core.Monitoring.SystemMonitorController("systemMonitor"));
|
||||||
|
|
||||||
|
foreach (var devConf in ConfigReader.ConfigObject.Devices)
|
||||||
|
{
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Creating device '{0}', type '{1}'", devConf.Key, devConf.Type);
|
||||||
|
// Skip this to prevent unnecessary warnings
|
||||||
if (devConf.Key == "processor")
|
if (devConf.Key == "processor")
|
||||||
{
|
{
|
||||||
if (devConf.Type.ToLower() != Global.ControlSystem.ControllerPrompt.ToLower())
|
if (devConf.Type.ToLower() != Global.ControlSystem.ControllerPrompt.ToLower())
|
||||||
Debug.Console(0,
|
Debug.Console(0,
|
||||||
"WARNING: Config file defines processor type as '{0}' but actual processor is '{1}'! Some ports may not be available",
|
"WARNING: Config file defines processor type as '{0}' but actual processor is '{1}'! Some ports may not be available",
|
||||||
devConf.Type.ToUpper(), Global.ControlSystem.ControllerPrompt.ToUpper());
|
devConf.Type.ToUpper(), Global.ControlSystem.ControllerPrompt.ToUpper());
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try local factory first
|
// Try local factories first
|
||||||
var newDev = DeviceFactory.GetDevice(devConf);
|
var newDev = DeviceFactory.GetDevice(devConf);
|
||||||
|
|
||||||
// Then associated library factories
|
if (newDev == null)
|
||||||
|
newDev = BridgeFactory.GetDevice(devConf);
|
||||||
|
|
||||||
|
// Then associated library factories
|
||||||
|
if (newDev == null)
|
||||||
|
newDev = PepperDash.Essentials.Core.DeviceFactory.GetDevice(devConf);
|
||||||
if (newDev == null)
|
if (newDev == null)
|
||||||
newDev = PepperDash.Essentials.Devices.Common.DeviceFactory.GetDevice(devConf);
|
newDev = PepperDash.Essentials.Devices.Common.DeviceFactory.GetDevice(devConf);
|
||||||
if (newDev == null)
|
if (newDev == null)
|
||||||
@@ -242,62 +411,76 @@ namespace PepperDash.Essentials
|
|||||||
if (newDev == null)
|
if (newDev == null)
|
||||||
newDev = PepperDash.Essentials.Devices.Displays.DisplayDeviceFactory.GetDevice(devConf);
|
newDev = PepperDash.Essentials.Devices.Displays.DisplayDeviceFactory.GetDevice(devConf);
|
||||||
|
|
||||||
|
//if (newDev == null) // might want to consider the ability to override an essentials "type"
|
||||||
|
//{
|
||||||
|
// // iterate plugin factories
|
||||||
|
// foreach (var f in FactoryObjects)
|
||||||
|
// {
|
||||||
|
// var cresFactory = f as IGetCrestronDevice;
|
||||||
|
// if (cresFactory != null)
|
||||||
|
// {
|
||||||
|
// newDev = cresFactory.GetDevice(devConf, this);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
if (newDev != null)
|
if (newDev != null)
|
||||||
DeviceManager.AddDevice(newDev);
|
DeviceManager.AddDevice(newDev);
|
||||||
else
|
else
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "ERROR: Cannot load unknown device type '{0}', key '{1}'.", devConf.Type, devConf.Key);
|
Debug.Console(0, Debug.ErrorLogLevel.Notice, "ERROR: Cannot load unknown device type '{0}', key '{1}'.", devConf.Type, devConf.Key);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "ERROR: Creating device {0}. Skipping device. \r{1}", devConf.Key, e);
|
Debug.Console(0, Debug.ErrorLogLevel.Notice, "ERROR: Creating device {0}. Skipping device. \r{1}", devConf.Key, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "All Devices Loaded.");
|
Debug.Console(0, Debug.ErrorLogLevel.Notice, "All Devices Loaded.");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Helper method to load tie lines. This should run after devices have loaded
|
|
||||||
/// </summary>
|
|
||||||
public void LoadTieLines()
|
|
||||||
{
|
|
||||||
// In the future, we can't necessarily just clear here because devices
|
|
||||||
// might be making their own internal sources/tie lines
|
|
||||||
|
|
||||||
var tlc = TieLineCollection.Default;
|
/// <summary>
|
||||||
//tlc.Clear();
|
/// Helper method to load tie lines. This should run after devices have loaded
|
||||||
if (ConfigReader.ConfigObject.TieLines == null)
|
/// </summary>
|
||||||
{
|
public void LoadTieLines()
|
||||||
return;
|
{
|
||||||
}
|
// In the future, we can't necessarily just clear here because devices
|
||||||
|
// might be making their own internal sources/tie lines
|
||||||
|
|
||||||
foreach (var tieLineConfig in ConfigReader.ConfigObject.TieLines)
|
var tlc = TieLineCollection.Default;
|
||||||
{
|
//tlc.Clear();
|
||||||
var newTL = tieLineConfig.GetTieLine();
|
if (ConfigReader.ConfigObject.TieLines == null)
|
||||||
if (newTL != null)
|
{
|
||||||
tlc.Add(newTL);
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach (var tieLineConfig in ConfigReader.ConfigObject.TieLines)
|
||||||
|
{
|
||||||
|
var newTL = tieLineConfig.GetTieLine();
|
||||||
|
if (newTL != null)
|
||||||
|
tlc.Add(newTL);
|
||||||
|
}
|
||||||
|
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "All Tie Lines Loaded.");
|
Debug.Console(0, Debug.ErrorLogLevel.Notice, "All Tie Lines Loaded.");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reads all rooms from config and adds them to DeviceManager
|
/// Reads all rooms from config and adds them to DeviceManager
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void LoadRooms()
|
public void LoadRooms()
|
||||||
{
|
{
|
||||||
if (ConfigReader.ConfigObject.Rooms == null)
|
if (ConfigReader.ConfigObject.Rooms == null)
|
||||||
{
|
{
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Warning, "WARNING: Configuration contains no rooms");
|
Debug.Console(0, Debug.ErrorLogLevel.Warning, "WARNING: Configuration contains no rooms");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var roomConfig in ConfigReader.ConfigObject.Rooms)
|
foreach (var roomConfig in ConfigReader.ConfigObject.Rooms)
|
||||||
{
|
{
|
||||||
var room = EssentialsRoomConfigHelper.GetRoomObject(roomConfig) as EssentialsRoomBase;
|
var room = EssentialsRoomConfigHelper.GetRoomObject(roomConfig) as EssentialsRoomBase;
|
||||||
if (room != null)
|
if (room != null)
|
||||||
{
|
{
|
||||||
if (room is EssentialsHuddleSpaceRoom)
|
if (room is EssentialsHuddleSpaceRoom)
|
||||||
{
|
{
|
||||||
DeviceManager.AddDevice(room);
|
DeviceManager.AddDevice(room);
|
||||||
@@ -307,10 +490,10 @@ namespace PepperDash.Essentials
|
|||||||
|
|
||||||
|
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Cotija Bridge...");
|
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Cotija Bridge...");
|
||||||
// Cotija bridge
|
// Cotija bridge
|
||||||
var bridge = new CotijaEssentialsHuddleSpaceRoomBridge(room as EssentialsHuddleSpaceRoom);
|
var bridge = new CotijaEssentialsHuddleSpaceRoomBridge(room as EssentialsHuddleSpaceRoom);
|
||||||
AddBridgePostActivationHelper(bridge); // Lets things happen later when all devices are present
|
AddBridgePostActivationHelper(bridge); // Lets things happen later when all devices are present
|
||||||
DeviceManager.AddDevice(bridge);
|
DeviceManager.AddDevice(bridge);
|
||||||
|
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Cotija Bridge Added...");
|
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Cotija Bridge Added...");
|
||||||
}
|
}
|
||||||
@@ -321,60 +504,60 @@ namespace PepperDash.Essentials
|
|||||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Room is EssentialsHuddleVtc1Room, attempting to add to DeviceManager with Fusion");
|
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Room is EssentialsHuddleVtc1Room, attempting to add to DeviceManager with Fusion");
|
||||||
DeviceManager.AddDevice(new EssentialsHuddleVtc1FusionController((EssentialsHuddleVtc1Room)room, 0xf1));
|
DeviceManager.AddDevice(new EssentialsHuddleVtc1FusionController((EssentialsHuddleVtc1Room)room, 0xf1));
|
||||||
|
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Cotija Bridge...");
|
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Cotija Bridge...");
|
||||||
// Cotija bridge
|
// Cotija bridge
|
||||||
var bridge = new CotijaEssentialsHuddleSpaceRoomBridge(room);
|
var bridge = new CotijaEssentialsHuddleSpaceRoomBridge(room);
|
||||||
AddBridgePostActivationHelper(bridge); // Lets things happen later when all devices are present
|
AddBridgePostActivationHelper(bridge); // Lets things happen later when all devices are present
|
||||||
DeviceManager.AddDevice(bridge);
|
DeviceManager.AddDevice(bridge);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Room is NOT EssentialsRoom, attempting to add to DeviceManager w/o Fusion");
|
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Room is NOT EssentialsRoom, attempting to add to DeviceManager w/o Fusion");
|
||||||
DeviceManager.AddDevice(room);
|
DeviceManager.AddDevice(room);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "WARNING: Cannot create room from config, key '{0}'", roomConfig.Key);
|
Debug.Console(0, Debug.ErrorLogLevel.Notice, "WARNING: Cannot create room from config, key '{0}'", roomConfig.Key);
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "All Rooms Loaded.");
|
Debug.Console(0, Debug.ErrorLogLevel.Notice, "All Rooms Loaded.");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Helps add the post activation steps that link bridges to main controller
|
/// Helps add the post activation steps that link bridges to main controller
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="bridge"></param>
|
/// <param name="bridge"></param>
|
||||||
void AddBridgePostActivationHelper(CotijaBridgeBase bridge)
|
void AddBridgePostActivationHelper(CotijaBridgeBase bridge)
|
||||||
{
|
{
|
||||||
bridge.AddPostActivationAction(() =>
|
bridge.AddPostActivationAction(() =>
|
||||||
{
|
{
|
||||||
var parent = DeviceManager.AllDevices.FirstOrDefault(d => d.Key == "appServer") as CotijaSystemController;
|
var parent = DeviceManager.AllDevices.FirstOrDefault(d => d.Key == "appServer") as CotijaSystemController;
|
||||||
if (parent == null)
|
if (parent == null)
|
||||||
{
|
{
|
||||||
Debug.Console(0, bridge, "ERROR: Cannot connect app server room bridge. System controller not present");
|
Debug.Console(0, bridge, "ERROR: Cannot connect app server room bridge. System controller not present");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Debug.Console(0, bridge, "Linking to parent controller");
|
Debug.Console(0, bridge, "Linking to parent controller");
|
||||||
bridge.AddParent(parent);
|
bridge.AddParent(parent);
|
||||||
parent.AddBridge(bridge);
|
parent.AddBridge(bridge);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fires up a logo server if not already running
|
/// Fires up a logo server if not already running
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void LoadLogoServer()
|
void LoadLogoServer()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
LogoServer = new HttpLogoServer(8080, Global.DirectorySeparator + "html" + Global.DirectorySeparator + "logo");
|
LogoServer = new HttpLogoServer(8080, Global.DirectorySeparator + "html" + Global.DirectorySeparator + "logo");
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "NOTICE: Logo server cannot be started. Likely already running in another program");
|
Debug.Console(0, Debug.ErrorLogLevel.Notice, "NOTICE: Logo server cannot be started. Likely already running in another program");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,348 +1,348 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
using Crestron.SimplSharp.CrestronIO;
|
using Crestron.SimplSharp.CrestronIO;
|
||||||
using Crestron.SimplSharpPro;
|
using Crestron.SimplSharpPro;
|
||||||
using Crestron.SimplSharpPro.DeviceSupport;
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
using Crestron.SimplSharpPro.Fusion;
|
using Crestron.SimplSharpPro.Fusion;
|
||||||
|
|
||||||
|
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials;
|
using PepperDash.Essentials;
|
||||||
using PepperDash.Essentials.Core;
|
using PepperDash.Essentials.Core;
|
||||||
using PepperDash.Essentials.Core.Config;
|
using PepperDash.Essentials.Core.Config;
|
||||||
using PepperDash.Essentials.Devices.Common;
|
using PepperDash.Essentials.Devices.Common;
|
||||||
using PepperDash.Essentials.Devices.Common.Occupancy;
|
using PepperDash.Essentials.Devices.Common.Occupancy;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Fusion
|
namespace PepperDash.Essentials.Fusion
|
||||||
{
|
{
|
||||||
public class EssentialsHuddleVtc1FusionController : EssentialsHuddleSpaceFusionSystemControllerBase
|
public class EssentialsHuddleVtc1FusionController : EssentialsHuddleSpaceFusionSystemControllerBase
|
||||||
{
|
{
|
||||||
BooleanSigData CodecIsInCall;
|
BooleanSigData CodecIsInCall;
|
||||||
|
|
||||||
public EssentialsHuddleVtc1FusionController(EssentialsHuddleVtc1Room room, uint ipId)
|
public EssentialsHuddleVtc1FusionController(EssentialsHuddleVtc1Room room, uint ipId)
|
||||||
: base(room, ipId)
|
: base(room, ipId)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called in base class constructor before RVI and GUID files are built
|
/// Called in base class constructor before RVI and GUID files are built
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected override void ExecuteCustomSteps()
|
protected override void ExecuteCustomSteps()
|
||||||
{
|
{
|
||||||
SetUpCodec();
|
SetUpCodec();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a static asset for the codec and maps the joins to the main room symbol
|
/// Creates a static asset for the codec and maps the joins to the main room symbol
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void SetUpCodec()
|
void SetUpCodec()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var codec = (Room as EssentialsHuddleVtc1Room).VideoCodec;
|
var codec = (Room as EssentialsHuddleVtc1Room).VideoCodec;
|
||||||
|
|
||||||
if (codec == null)
|
if (codec == null)
|
||||||
{
|
{
|
||||||
Debug.Console(1, this, "Cannot link codec to Fusion because codec is null");
|
Debug.Console(1, this, "Cannot link codec to Fusion because codec is null");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
codec.UsageTracker = new UsageTracking(codec);
|
codec.UsageTracker = new UsageTracking(codec);
|
||||||
codec.UsageTracker.UsageIsTracked = true;
|
codec.UsageTracker.UsageIsTracked = true;
|
||||||
codec.UsageTracker.DeviceUsageEnded += UsageTracker_DeviceUsageEnded;
|
codec.UsageTracker.DeviceUsageEnded += UsageTracker_DeviceUsageEnded;
|
||||||
|
|
||||||
var codecPowerOnAction = new Action<bool>(b => { if (!b) codec.StandbyDeactivate(); });
|
var codecPowerOnAction = new Action<bool>(b => { if (!b) codec.StandbyDeactivate(); });
|
||||||
var codecPowerOffAction = new Action<bool>(b => { if (!b) codec.StandbyActivate(); });
|
var codecPowerOffAction = new Action<bool>(b => { if (!b) codec.StandbyActivate(); });
|
||||||
|
|
||||||
// Map FusionRoom Attributes:
|
// Map FusionRoom Attributes:
|
||||||
|
|
||||||
// Codec volume
|
// Codec volume
|
||||||
var codecVolume = FusionRoom.CreateOffsetUshortSig(50, "Volume - Fader01", eSigIoMask.InputOutputSig);
|
var codecVolume = FusionRoom.CreateOffsetUshortSig(50, "Volume - Fader01", eSigIoMask.InputOutputSig);
|
||||||
codecVolume.OutputSig.UserObject = new Action<ushort>(b => (codec as IBasicVolumeWithFeedback).SetVolume(b));
|
codecVolume.OutputSig.UserObject = new Action<ushort>(b => (codec as IBasicVolumeWithFeedback).SetVolume(b));
|
||||||
(codec as IBasicVolumeWithFeedback).VolumeLevelFeedback.LinkInputSig(codecVolume.InputSig);
|
(codec as IBasicVolumeWithFeedback).VolumeLevelFeedback.LinkInputSig(codecVolume.InputSig);
|
||||||
|
|
||||||
// In Call Status
|
// In Call Status
|
||||||
CodecIsInCall = FusionRoom.CreateOffsetBoolSig(69, "Conf - VC 1 In Call", eSigIoMask.InputSigOnly);
|
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<PepperDash.Essentials.Devices.Common.Codec.CodecCallStatusItemChangeEventArgs>(codec_CallStatusChange);
|
||||||
|
|
||||||
// Online status
|
// Online status
|
||||||
if (codec is ICommunicationMonitor)
|
if (codec is ICommunicationMonitor)
|
||||||
{
|
{
|
||||||
var c = codec as ICommunicationMonitor;
|
var c = codec as ICommunicationMonitor;
|
||||||
var codecOnline = FusionRoom.CreateOffsetBoolSig(122, "Online - VC 1", eSigIoMask.InputSigOnly);
|
var codecOnline = FusionRoom.CreateOffsetBoolSig(122, "Online - VC 1", eSigIoMask.InputSigOnly);
|
||||||
codecOnline.InputSig.BoolValue = c.CommunicationMonitor.Status == MonitorStatus.IsOk;
|
codecOnline.InputSig.BoolValue = c.CommunicationMonitor.Status == MonitorStatus.IsOk;
|
||||||
c.CommunicationMonitor.StatusChange += (o, a) =>
|
c.CommunicationMonitor.StatusChange += (o, a) =>
|
||||||
{
|
{
|
||||||
codecOnline.InputSig.BoolValue = a.Status == MonitorStatus.IsOk;
|
codecOnline.InputSig.BoolValue = a.Status == MonitorStatus.IsOk;
|
||||||
};
|
};
|
||||||
Debug.Console(0, this, "Linking '{0}' communication monitor to Fusion '{1}'", codec.Key, "Online - VC 1");
|
Debug.Console(0, this, "Linking '{0}' communication monitor to Fusion '{1}'", codec.Key, "Online - VC 1");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Codec IP Address
|
// Codec IP Address
|
||||||
bool codecHasIpInfo = false;
|
bool codecHasIpInfo = false;
|
||||||
var codecComm = codec.Communication;
|
var codecComm = codec.Communication;
|
||||||
|
|
||||||
string codecIpAddress = string.Empty;
|
string codecIpAddress = string.Empty;
|
||||||
int codecIpPort = 0;
|
int codecIpPort = 0;
|
||||||
|
|
||||||
StringSigData codecIpAddressSig;
|
StringSigData codecIpAddressSig;
|
||||||
StringSigData codecIpPortSig;
|
StringSigData codecIpPortSig;
|
||||||
|
|
||||||
if(codecComm is GenericSshClient)
|
if(codecComm is GenericSshClient)
|
||||||
{
|
{
|
||||||
codecIpAddress = (codecComm as GenericSshClient).Hostname;
|
codecIpAddress = (codecComm as GenericSshClient).Hostname;
|
||||||
codecIpPort = (codecComm as GenericSshClient).Port;
|
codecIpPort = (codecComm as GenericSshClient).Port;
|
||||||
codecHasIpInfo = true;
|
codecHasIpInfo = true;
|
||||||
}
|
}
|
||||||
else if (codecComm is GenericTcpIpClient)
|
else if (codecComm is GenericTcpIpClient)
|
||||||
{
|
{
|
||||||
codecIpAddress = (codecComm as GenericTcpIpClient).Hostname;
|
codecIpAddress = (codecComm as GenericTcpIpClient).Hostname;
|
||||||
codecIpPort = (codecComm as GenericTcpIpClient).Port;
|
codecIpPort = (codecComm as GenericTcpIpClient).Port;
|
||||||
codecHasIpInfo = true;
|
codecHasIpInfo = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (codecHasIpInfo)
|
if (codecHasIpInfo)
|
||||||
{
|
{
|
||||||
codecIpAddressSig = FusionRoom.CreateOffsetStringSig(121, "IP Address - VC", eSigIoMask.InputSigOnly);
|
codecIpAddressSig = FusionRoom.CreateOffsetStringSig(121, "IP Address - VC", eSigIoMask.InputSigOnly);
|
||||||
codecIpAddressSig.InputSig.StringValue = codecIpAddress;
|
codecIpAddressSig.InputSig.StringValue = codecIpAddress;
|
||||||
|
|
||||||
codecIpPortSig = FusionRoom.CreateOffsetStringSig(150, "IP Port - VC", eSigIoMask.InputSigOnly);
|
codecIpPortSig = FusionRoom.CreateOffsetStringSig(150, "IP Port - VC", eSigIoMask.InputSigOnly);
|
||||||
codecIpPortSig.InputSig.StringValue = codecIpPort.ToString();
|
codecIpPortSig.InputSig.StringValue = codecIpPort.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
var tempAsset = new FusionAsset();
|
var tempAsset = new FusionAsset();
|
||||||
|
|
||||||
var deviceConfig = ConfigReader.ConfigObject.Devices.FirstOrDefault(c => c.Key.Equals(codec.Key));
|
var deviceConfig = ConfigReader.ConfigObject.Devices.FirstOrDefault(c => c.Key.Equals(codec.Key));
|
||||||
|
|
||||||
if (FusionStaticAssets.ContainsKey(deviceConfig.Uid))
|
if (FusionStaticAssets.ContainsKey(deviceConfig.Uid))
|
||||||
{
|
{
|
||||||
tempAsset = FusionStaticAssets[deviceConfig.Uid];
|
tempAsset = FusionStaticAssets[deviceConfig.Uid];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Create a new asset
|
// Create a new asset
|
||||||
tempAsset = new FusionAsset(FusionRoomGuids.GetNextAvailableAssetNumber(FusionRoom), codec.Name, "Codec", "");
|
tempAsset = new FusionAsset(FusionRoomGuids.GetNextAvailableAssetNumber(FusionRoom), codec.Name, "Codec", "");
|
||||||
FusionStaticAssets.Add(deviceConfig.Uid, tempAsset);
|
FusionStaticAssets.Add(deviceConfig.Uid, tempAsset);
|
||||||
}
|
}
|
||||||
|
|
||||||
var codecAsset = FusionRoom.CreateStaticAsset(tempAsset.SlotNumber, tempAsset.Name, "Display", tempAsset.InstanceId);
|
var codecAsset = FusionRoom.CreateStaticAsset(tempAsset.SlotNumber, tempAsset.Name, "Display", tempAsset.InstanceId);
|
||||||
codecAsset.PowerOn.OutputSig.UserObject = codecPowerOnAction;
|
codecAsset.PowerOn.OutputSig.UserObject = codecPowerOnAction;
|
||||||
codecAsset.PowerOff.OutputSig.UserObject = codecPowerOffAction;
|
codecAsset.PowerOff.OutputSig.UserObject = codecPowerOffAction;
|
||||||
codec.StandbyIsOnFeedback.LinkComplementInputSig(codecAsset.PowerOn.InputSig);
|
codec.StandbyIsOnFeedback.LinkComplementInputSig(codecAsset.PowerOn.InputSig);
|
||||||
|
|
||||||
// TODO: Map relevant attributes on asset symbol
|
// TODO: Map relevant attributes on asset symbol
|
||||||
|
|
||||||
codecAsset.TrySetMakeModel(codec);
|
codecAsset.TrySetMakeModel(codec);
|
||||||
codecAsset.TryLinkAssetErrorToCommunication(codec);
|
codecAsset.TryLinkAssetErrorToCommunication(codec);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Debug.Console(1, this, "Error setting up codec in Fusion: {0}", e);
|
Debug.Console(1, this, "Error setting up codec in Fusion: {0}", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void codec_CallStatusChange(object sender, PepperDash.Essentials.Devices.Common.Codec.CodecCallStatusItemChangeEventArgs e)
|
void codec_CallStatusChange(object sender, PepperDash.Essentials.Devices.Common.Codec.CodecCallStatusItemChangeEventArgs e)
|
||||||
{
|
{
|
||||||
var codec = (Room as EssentialsHuddleVtc1Room).VideoCodec;
|
var codec = (Room as EssentialsHuddleVtc1Room).VideoCodec;
|
||||||
|
|
||||||
CodecIsInCall.InputSig.BoolValue = codec.IsInCall;
|
CodecIsInCall.InputSig.BoolValue = codec.IsInCall;
|
||||||
}
|
}
|
||||||
|
|
||||||
// These methods are overridden because they access the room class which is of a different type
|
// These methods are overridden because they access the room class which is of a different type
|
||||||
|
|
||||||
protected override void CreateSymbolAndBasicSigs(uint ipId)
|
protected override void CreateSymbolAndBasicSigs(uint ipId)
|
||||||
{
|
{
|
||||||
Debug.Console(1, this, "Creating Fusion Room symbol with GUID: {0}", RoomGuid);
|
Debug.Console(1, this, "Creating Fusion Room symbol with GUID: {0}", RoomGuid);
|
||||||
|
|
||||||
FusionRoom = new FusionRoom(ipId, Global.ControlSystem, Room.Name, RoomGuid);
|
FusionRoom = new FusionRoom(ipId, Global.ControlSystem, Room.Name, RoomGuid);
|
||||||
FusionRoom.ExtenderRoomViewSchedulingDataReservedSigs.Use();
|
FusionRoom.ExtenderRoomViewSchedulingDataReservedSigs.Use();
|
||||||
FusionRoom.ExtenderFusionRoomDataReservedSigs.Use();
|
FusionRoom.ExtenderFusionRoomDataReservedSigs.Use();
|
||||||
|
|
||||||
FusionRoom.Register();
|
FusionRoom.Register();
|
||||||
|
|
||||||
FusionRoom.FusionStateChange += FusionRoom_FusionStateChange;
|
FusionRoom.FusionStateChange += FusionRoom_FusionStateChange;
|
||||||
|
|
||||||
FusionRoom.ExtenderRoomViewSchedulingDataReservedSigs.DeviceExtenderSigChange += FusionRoomSchedule_DeviceExtenderSigChange;
|
FusionRoom.ExtenderRoomViewSchedulingDataReservedSigs.DeviceExtenderSigChange += FusionRoomSchedule_DeviceExtenderSigChange;
|
||||||
FusionRoom.ExtenderFusionRoomDataReservedSigs.DeviceExtenderSigChange += ExtenderFusionRoomDataReservedSigs_DeviceExtenderSigChange;
|
FusionRoom.ExtenderFusionRoomDataReservedSigs.DeviceExtenderSigChange += ExtenderFusionRoomDataReservedSigs_DeviceExtenderSigChange;
|
||||||
FusionRoom.OnlineStatusChange += FusionRoom_OnlineStatusChange;
|
FusionRoom.OnlineStatusChange += FusionRoom_OnlineStatusChange;
|
||||||
|
|
||||||
CrestronConsole.AddNewConsoleCommand(RequestFullRoomSchedule, "FusReqRoomSchedule", "Requests schedule of the room for the next 24 hours", ConsoleAccessLevelEnum.AccessOperator);
|
CrestronConsole.AddNewConsoleCommand(RequestFullRoomSchedule, "FusReqRoomSchedule", "Requests schedule of the room for the next 24 hours", ConsoleAccessLevelEnum.AccessOperator);
|
||||||
CrestronConsole.AddNewConsoleCommand(ModifyMeetingEndTimeConsoleHelper, "FusReqRoomSchMod", "Ends or extends a meeting by the specified time", ConsoleAccessLevelEnum.AccessOperator);
|
CrestronConsole.AddNewConsoleCommand(ModifyMeetingEndTimeConsoleHelper, "FusReqRoomSchMod", "Ends or extends a meeting by the specified time", ConsoleAccessLevelEnum.AccessOperator);
|
||||||
CrestronConsole.AddNewConsoleCommand(CreateAsHocMeeting, "FusCreateMeeting", "Creates and Ad Hoc meeting for on hour or until the next meeting", ConsoleAccessLevelEnum.AccessOperator);
|
CrestronConsole.AddNewConsoleCommand(CreateAsHocMeeting, "FusCreateMeeting", "Creates and Ad Hoc meeting for on hour or until the next meeting", ConsoleAccessLevelEnum.AccessOperator);
|
||||||
|
|
||||||
// Room to fusion room
|
// Room to fusion room
|
||||||
Room.OnFeedback.LinkInputSig(FusionRoom.SystemPowerOn.InputSig);
|
Room.OnFeedback.LinkInputSig(FusionRoom.SystemPowerOn.InputSig);
|
||||||
|
|
||||||
// Moved to
|
// Moved to
|
||||||
CurrentRoomSourceNameSig = FusionRoom.CreateOffsetStringSig(84, "Display 1 - Current Source", eSigIoMask.InputSigOnly);
|
CurrentRoomSourceNameSig = FusionRoom.CreateOffsetStringSig(84, "Display 1 - Current Source", eSigIoMask.InputSigOnly);
|
||||||
// Don't think we need to get current status of this as nothing should be alive yet.
|
// Don't think we need to get current status of this as nothing should be alive yet.
|
||||||
(Room as EssentialsHuddleVtc1Room).CurrentSingleSourceChange += Room_CurrentSourceInfoChange;
|
(Room as EssentialsHuddleVtc1Room).CurrentSingleSourceChange += Room_CurrentSourceInfoChange;
|
||||||
|
|
||||||
|
|
||||||
FusionRoom.SystemPowerOn.OutputSig.SetSigFalseAction((Room as EssentialsHuddleVtc1Room).PowerOnToDefaultOrLastSource);
|
FusionRoom.SystemPowerOn.OutputSig.SetSigFalseAction((Room as EssentialsHuddleVtc1Room).PowerOnToDefaultOrLastSource);
|
||||||
FusionRoom.SystemPowerOff.OutputSig.SetSigFalseAction(() => (Room as EssentialsHuddleVtc1Room).RunRouteAction("roomOff"));
|
FusionRoom.SystemPowerOff.OutputSig.SetSigFalseAction(() => (Room as EssentialsHuddleVtc1Room).RunRouteAction("roomOff"));
|
||||||
// NO!! room.RoomIsOn.LinkComplementInputSig(FusionRoom.SystemPowerOff.InputSig);
|
// NO!! room.RoomIsOn.LinkComplementInputSig(FusionRoom.SystemPowerOff.InputSig);
|
||||||
|
|
||||||
|
|
||||||
CrestronEnvironment.EthernetEventHandler += CrestronEnvironment_EthernetEventHandler;
|
CrestronEnvironment.EthernetEventHandler += CrestronEnvironment_EthernetEventHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void SetUpSources()
|
protected override void SetUpSources()
|
||||||
{
|
{
|
||||||
// Sources
|
// Sources
|
||||||
var dict = ConfigReader.ConfigObject.GetSourceListForKey((Room as EssentialsHuddleVtc1Room).SourceListKey);
|
var dict = ConfigReader.ConfigObject.GetSourceListForKey((Room as EssentialsHuddleVtc1Room).SourceListKey);
|
||||||
if (dict != null)
|
if (dict != null)
|
||||||
{
|
{
|
||||||
// NEW PROCESS:
|
// NEW PROCESS:
|
||||||
// Make these lists and insert the fusion attributes by iterating these
|
// Make these lists and insert the fusion attributes by iterating these
|
||||||
var setTopBoxes = dict.Where(d => d.Value.SourceDevice is ISetTopBoxControls);
|
var setTopBoxes = dict.Where(d => d.Value.SourceDevice is ISetTopBoxControls);
|
||||||
uint i = 1;
|
uint i = 1;
|
||||||
foreach (var kvp in setTopBoxes)
|
foreach (var kvp in setTopBoxes)
|
||||||
{
|
{
|
||||||
TryAddRouteActionSigs("Display 1 - Source TV " + i, 188 + i, kvp.Key, kvp.Value.SourceDevice);
|
TryAddRouteActionSigs("Display 1 - Source TV " + i, 188 + i, kvp.Key, kvp.Value.SourceDevice);
|
||||||
i++;
|
i++;
|
||||||
if (i > 5) // We only have five spots
|
if (i > 5) // We only have five spots
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
var discPlayers = dict.Where(d => d.Value.SourceDevice is IDiscPlayerControls);
|
var discPlayers = dict.Where(d => d.Value.SourceDevice is IDiscPlayerControls);
|
||||||
i = 1;
|
i = 1;
|
||||||
foreach (var kvp in discPlayers)
|
foreach (var kvp in discPlayers)
|
||||||
{
|
{
|
||||||
TryAddRouteActionSigs("Display 1 - Source DVD " + i, 181 + i, kvp.Key, kvp.Value.SourceDevice);
|
TryAddRouteActionSigs("Display 1 - Source DVD " + i, 181 + i, kvp.Key, kvp.Value.SourceDevice);
|
||||||
i++;
|
i++;
|
||||||
if (i > 5) // We only have five spots
|
if (i > 5) // We only have five spots
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
var laptops = dict.Where(d => d.Value.SourceDevice is Laptop);
|
var laptops = dict.Where(d => d.Value.SourceDevice is Laptop);
|
||||||
i = 1;
|
i = 1;
|
||||||
foreach (var kvp in laptops)
|
foreach (var kvp in laptops)
|
||||||
{
|
{
|
||||||
TryAddRouteActionSigs("Display 1 - Source Laptop " + i, 166 + i, kvp.Key, kvp.Value.SourceDevice);
|
TryAddRouteActionSigs("Display 1 - Source Laptop " + i, 166 + i, kvp.Key, kvp.Value.SourceDevice);
|
||||||
i++;
|
i++;
|
||||||
if (i > 10) // We only have ten spots???
|
if (i > 10) // We only have ten spots???
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var kvp in dict)
|
foreach (var kvp in dict)
|
||||||
{
|
{
|
||||||
var usageDevice = kvp.Value.SourceDevice as IUsageTracking;
|
var usageDevice = kvp.Value.SourceDevice as IUsageTracking;
|
||||||
|
|
||||||
if (usageDevice != null)
|
if (usageDevice != null)
|
||||||
{
|
{
|
||||||
usageDevice.UsageTracker = new UsageTracking(usageDevice as Device);
|
usageDevice.UsageTracker = new UsageTracking(usageDevice as Device);
|
||||||
usageDevice.UsageTracker.UsageIsTracked = true;
|
usageDevice.UsageTracker.UsageIsTracked = true;
|
||||||
usageDevice.UsageTracker.DeviceUsageEnded += new EventHandler<DeviceUsageEventArgs>(UsageTracker_DeviceUsageEnded);
|
usageDevice.UsageTracker.DeviceUsageEnded += new EventHandler<DeviceUsageEventArgs>(UsageTracker_DeviceUsageEnded);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Debug.Console(1, this, "WARNING: Config source list '{0}' not found for room '{1}'",
|
Debug.Console(1, this, "WARNING: Config source list '{0}' not found for room '{1}'",
|
||||||
(Room as EssentialsHuddleVtc1Room).SourceListKey, Room.Key);
|
(Room as EssentialsHuddleVtc1Room).SourceListKey, Room.Key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void SetUpDisplay()
|
protected override void SetUpDisplay()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//Setup Display Usage Monitoring
|
//Setup Display Usage Monitoring
|
||||||
|
|
||||||
var displays = DeviceManager.AllDevices.Where(d => d is DisplayBase);
|
var displays = DeviceManager.AllDevices.Where(d => d is DisplayBase);
|
||||||
|
|
||||||
// Consider updating this in multiple display systems
|
// Consider updating this in multiple display systems
|
||||||
|
|
||||||
foreach (DisplayBase display in displays)
|
foreach (DisplayBase display in displays)
|
||||||
{
|
{
|
||||||
display.UsageTracker = new UsageTracking(display);
|
display.UsageTracker = new UsageTracking(display);
|
||||||
display.UsageTracker.UsageIsTracked = true;
|
display.UsageTracker.UsageIsTracked = true;
|
||||||
display.UsageTracker.DeviceUsageEnded += new EventHandler<DeviceUsageEventArgs>(UsageTracker_DeviceUsageEnded);
|
display.UsageTracker.DeviceUsageEnded += new EventHandler<DeviceUsageEventArgs>(UsageTracker_DeviceUsageEnded);
|
||||||
}
|
}
|
||||||
|
|
||||||
var defaultDisplay = (Room as EssentialsHuddleVtc1Room).DefaultDisplay as DisplayBase;
|
var defaultDisplay = (Room as EssentialsHuddleVtc1Room).DefaultDisplay as DisplayBase;
|
||||||
if (defaultDisplay == null)
|
if (defaultDisplay == null)
|
||||||
{
|
{
|
||||||
Debug.Console(1, this, "Cannot link null display to Fusion because default display is null");
|
Debug.Console(1, this, "Cannot link null display to Fusion because default display is null");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var dispPowerOnAction = new Action<bool>(b => { if (!b) defaultDisplay.PowerOn(); });
|
var dispPowerOnAction = new Action<bool>(b => { if (!b) defaultDisplay.PowerOn(); });
|
||||||
var dispPowerOffAction = new Action<bool>(b => { if (!b) defaultDisplay.PowerOff(); });
|
var dispPowerOffAction = new Action<bool>(b => { if (!b) defaultDisplay.PowerOff(); });
|
||||||
|
|
||||||
// Display to fusion room sigs
|
// Display to fusion room sigs
|
||||||
FusionRoom.DisplayPowerOn.OutputSig.UserObject = dispPowerOnAction;
|
FusionRoom.DisplayPowerOn.OutputSig.UserObject = dispPowerOnAction;
|
||||||
FusionRoom.DisplayPowerOff.OutputSig.UserObject = dispPowerOffAction;
|
FusionRoom.DisplayPowerOff.OutputSig.UserObject = dispPowerOffAction;
|
||||||
defaultDisplay.PowerIsOnFeedback.LinkInputSig(FusionRoom.DisplayPowerOn.InputSig);
|
defaultDisplay.PowerIsOnFeedback.LinkInputSig(FusionRoom.DisplayPowerOn.InputSig);
|
||||||
if (defaultDisplay is IDisplayUsage)
|
if (defaultDisplay is IDisplayUsage)
|
||||||
(defaultDisplay as IDisplayUsage).LampHours.LinkInputSig(FusionRoom.DisplayUsage.InputSig);
|
(defaultDisplay as IDisplayUsage).LampHours.LinkInputSig(FusionRoom.DisplayUsage.InputSig);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
MapDisplayToRoomJoins(1, 158, defaultDisplay);
|
MapDisplayToRoomJoins(1, 158, defaultDisplay);
|
||||||
|
|
||||||
|
|
||||||
var deviceConfig = ConfigReader.ConfigObject.Devices.FirstOrDefault(d => d.Key.Equals(defaultDisplay.Key));
|
var deviceConfig = ConfigReader.ConfigObject.Devices.FirstOrDefault(d => d.Key.Equals(defaultDisplay.Key));
|
||||||
|
|
||||||
//Check for existing asset in GUIDs collection
|
//Check for existing asset in GUIDs collection
|
||||||
|
|
||||||
var tempAsset = new FusionAsset();
|
var tempAsset = new FusionAsset();
|
||||||
|
|
||||||
if (FusionStaticAssets.ContainsKey(deviceConfig.Uid))
|
if (FusionStaticAssets.ContainsKey(deviceConfig.Uid))
|
||||||
{
|
{
|
||||||
tempAsset = FusionStaticAssets[deviceConfig.Uid];
|
tempAsset = FusionStaticAssets[deviceConfig.Uid];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Create a new asset
|
// Create a new asset
|
||||||
tempAsset = new FusionAsset(FusionRoomGuids.GetNextAvailableAssetNumber(FusionRoom), defaultDisplay.Name, "Display", "");
|
tempAsset = new FusionAsset(FusionRoomGuids.GetNextAvailableAssetNumber(FusionRoom), defaultDisplay.Name, "Display", "");
|
||||||
FusionStaticAssets.Add(deviceConfig.Uid, tempAsset);
|
FusionStaticAssets.Add(deviceConfig.Uid, tempAsset);
|
||||||
}
|
}
|
||||||
|
|
||||||
var dispAsset = FusionRoom.CreateStaticAsset(tempAsset.SlotNumber, tempAsset.Name, "Display", tempAsset.InstanceId);
|
var dispAsset = FusionRoom.CreateStaticAsset(tempAsset.SlotNumber, tempAsset.Name, "Display", tempAsset.InstanceId);
|
||||||
dispAsset.PowerOn.OutputSig.UserObject = dispPowerOnAction;
|
dispAsset.PowerOn.OutputSig.UserObject = dispPowerOnAction;
|
||||||
dispAsset.PowerOff.OutputSig.UserObject = dispPowerOffAction;
|
dispAsset.PowerOff.OutputSig.UserObject = dispPowerOffAction;
|
||||||
defaultDisplay.PowerIsOnFeedback.LinkInputSig(dispAsset.PowerOn.InputSig);
|
defaultDisplay.PowerIsOnFeedback.LinkInputSig(dispAsset.PowerOn.InputSig);
|
||||||
// NO!! display.PowerIsOn.LinkComplementInputSig(dispAsset.PowerOff.InputSig);
|
// NO!! display.PowerIsOn.LinkComplementInputSig(dispAsset.PowerOff.InputSig);
|
||||||
// Use extension methods
|
// Use extension methods
|
||||||
dispAsset.TrySetMakeModel(defaultDisplay);
|
dispAsset.TrySetMakeModel(defaultDisplay);
|
||||||
dispAsset.TryLinkAssetErrorToCommunication(defaultDisplay);
|
dispAsset.TryLinkAssetErrorToCommunication(defaultDisplay);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Debug.Console(1, this, "Error setting up display in Fusion: {0}", e);
|
Debug.Console(1, this, "Error setting up display in Fusion: {0}", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void MapDisplayToRoomJoins(int displayIndex, int joinOffset, DisplayBase display)
|
protected override void MapDisplayToRoomJoins(int displayIndex, int joinOffset, DisplayBase display)
|
||||||
{
|
{
|
||||||
string displayName = string.Format("Display {0} - ", displayIndex);
|
string displayName = string.Format("Display {0} - ", displayIndex);
|
||||||
|
|
||||||
|
|
||||||
if (display == (Room as EssentialsHuddleVtc1Room).DefaultDisplay)
|
if (display == (Room as EssentialsHuddleVtc1Room).DefaultDisplay)
|
||||||
{
|
{
|
||||||
// Power on
|
// Power on
|
||||||
var defaultDisplayPowerOn = FusionRoom.CreateOffsetBoolSig((uint)joinOffset, displayName + "Power On", eSigIoMask.InputOutputSig);
|
var defaultDisplayPowerOn = FusionRoom.CreateOffsetBoolSig((uint)joinOffset, displayName + "Power On", eSigIoMask.InputOutputSig);
|
||||||
defaultDisplayPowerOn.OutputSig.UserObject = new Action<bool>(b => { if (!b) display.PowerOn(); });
|
defaultDisplayPowerOn.OutputSig.UserObject = new Action<bool>(b => { if (!b) display.PowerOn(); });
|
||||||
display.PowerIsOnFeedback.LinkInputSig(defaultDisplayPowerOn.InputSig);
|
display.PowerIsOnFeedback.LinkInputSig(defaultDisplayPowerOn.InputSig);
|
||||||
|
|
||||||
// Power Off
|
// Power Off
|
||||||
var defaultDisplayPowerOff = FusionRoom.CreateOffsetBoolSig((uint)joinOffset + 1, displayName + "Power Off", eSigIoMask.InputOutputSig);
|
var defaultDisplayPowerOff = FusionRoom.CreateOffsetBoolSig((uint)joinOffset + 1, displayName + "Power Off", eSigIoMask.InputOutputSig);
|
||||||
defaultDisplayPowerOn.OutputSig.UserObject = new Action<bool>(b => { if (!b) display.PowerOff(); }); ;
|
defaultDisplayPowerOn.OutputSig.UserObject = new Action<bool>(b => { if (!b) display.PowerOff(); }); ;
|
||||||
display.PowerIsOnFeedback.LinkInputSig(defaultDisplayPowerOn.InputSig);
|
display.PowerIsOnFeedback.LinkInputSig(defaultDisplayPowerOn.InputSig);
|
||||||
|
|
||||||
// Current Source
|
// Current Source
|
||||||
var defaultDisplaySourceNone = FusionRoom.CreateOffsetBoolSig((uint)joinOffset + 8, displayName + "Source None", eSigIoMask.InputOutputSig);
|
var defaultDisplaySourceNone = FusionRoom.CreateOffsetBoolSig((uint)joinOffset + 8, displayName + "Source None", eSigIoMask.InputOutputSig);
|
||||||
defaultDisplaySourceNone.OutputSig.UserObject = new Action<bool>(b => { if (!b) (Room as EssentialsHuddleVtc1Room).RunRouteAction("roomOff"); }); ;
|
defaultDisplaySourceNone.OutputSig.UserObject = new Action<bool>(b => { if (!b) (Room as EssentialsHuddleVtc1Room).RunRouteAction("roomOff"); }); ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,102 +1,119 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using PepperDash.Core;
|
using Newtonsoft.Json.Linq;
|
||||||
using PepperDash.Essentials.Core;
|
|
||||||
using PepperDash.Essentials.Core.Config;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Room.Behaviours;
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.Core.Config;
|
||||||
namespace PepperDash.Essentials.Fusion
|
using PepperDash.Essentials.Core.Devices;
|
||||||
{
|
using PepperDash.Essentials.Room.Behaviours;
|
||||||
/// <summary>
|
|
||||||
/// Handles mapping Fusion Custom Property values to system properties
|
namespace PepperDash.Essentials.Fusion
|
||||||
/// </summary>
|
{
|
||||||
public class FusionCustomPropertiesBridge
|
/// <summary>
|
||||||
{
|
/// Handles mapping Fusion Custom Property values to system properties
|
||||||
|
/// </summary>
|
||||||
/// <summary>
|
public class FusionCustomPropertiesBridge
|
||||||
/// Evaluates the room info and custom properties from Fusion and updates the system properties aa needed
|
{
|
||||||
/// </summary>
|
|
||||||
/// <param name="roomInfo"></param>
|
/// <summary>
|
||||||
public void EvaluateRoomInfo(string roomKey, RoomInformation roomInfo)
|
/// Evaluates the room info and custom properties from Fusion and updates the system properties aa needed
|
||||||
{
|
/// </summary>
|
||||||
var runtimeConfigurableDevices = DeviceManager.AllDevices.Where(d => d is IRuntimeConfigurableDevice);
|
/// <param name="roomInfo"></param>
|
||||||
|
public void EvaluateRoomInfo(string roomKey, RoomInformation roomInfo)
|
||||||
try
|
{
|
||||||
{
|
try
|
||||||
foreach (var device in runtimeConfigurableDevices)
|
{
|
||||||
{
|
var reconfigurableDevices = DeviceManager.AllDevices.Where(d => d is ReconfigurableDevice);
|
||||||
// Get the current device config so new values can be overwritten over existing
|
|
||||||
var deviceConfig = (device as IRuntimeConfigurableDevice).GetDeviceConfig();
|
foreach (var device in reconfigurableDevices)
|
||||||
|
{
|
||||||
if (device is RoomOnToDefaultSourceWhenOccupied)
|
// Get the current device config so new values can be overwritten over existing
|
||||||
{
|
var deviceConfig = (device as ReconfigurableDevice).Config;
|
||||||
var devConfig = (deviceConfig as RoomOnToDefaultSourceWhenOccupiedConfig);
|
|
||||||
|
if (device is RoomOnToDefaultSourceWhenOccupied)
|
||||||
var enableFeature = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("EnRoomOnWhenOccupied"));
|
{
|
||||||
if (enableFeature != null)
|
Debug.Console(1, "Mapping Room on via Occupancy values from Fusion");
|
||||||
devConfig.EnableRoomOnWhenOccupied = bool.Parse(enableFeature.CustomFieldValue);
|
|
||||||
|
var devProps = JsonConvert.DeserializeObject<RoomOnToDefaultSourceWhenOccupiedConfig>(deviceConfig.Properties.ToString());
|
||||||
var enableTime = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("RoomOnWhenOccupiedStartTime"));
|
|
||||||
if (enableTime != null)
|
var enableFeature = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("EnRoomOnWhenOccupied"));
|
||||||
devConfig.OccupancyStartTime = enableTime.CustomFieldValue;
|
if (enableFeature != null)
|
||||||
|
devProps.EnableRoomOnWhenOccupied = bool.Parse(enableFeature.CustomFieldValue);
|
||||||
var disableTime = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("RoomOnWhenOccupiedEndTime"));
|
|
||||||
if (disableTime != null)
|
var enableTime = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("RoomOnWhenOccupiedStartTime"));
|
||||||
devConfig.OccupancyEndTime = disableTime.CustomFieldValue;
|
if (enableTime != null)
|
||||||
|
devProps.OccupancyStartTime = enableTime.CustomFieldValue;
|
||||||
var enableSunday = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("EnRoomOnWhenOccupiedSun"));
|
|
||||||
if (enableSunday != null)
|
var disableTime = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("RoomOnWhenOccupiedEndTime"));
|
||||||
devConfig.EnableSunday = bool.Parse(enableSunday.CustomFieldValue);
|
if (disableTime != null)
|
||||||
|
devProps.OccupancyEndTime = disableTime.CustomFieldValue;
|
||||||
var enableMonday = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("EnRoomOnWhenOccupiedMon"));
|
|
||||||
if (enableMonday != null)
|
var enableSunday = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("EnRoomOnWhenOccupiedSun"));
|
||||||
devConfig.EnableMonday = bool.Parse(enableMonday.CustomFieldValue);
|
if (enableSunday != null)
|
||||||
|
devProps.EnableSunday = bool.Parse(enableSunday.CustomFieldValue);
|
||||||
var enableTuesday = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("EnRoomOnWhenOccupiedTue"));
|
|
||||||
if (enableTuesday != null)
|
var enableMonday = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("EnRoomOnWhenOccupiedMon"));
|
||||||
devConfig.EnableTuesday = bool.Parse(enableTuesday.CustomFieldValue);
|
if (enableMonday != null)
|
||||||
|
devProps.EnableMonday = bool.Parse(enableMonday.CustomFieldValue);
|
||||||
var enableWednesday = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("EnRoomOnWhenOccupiedWed"));
|
|
||||||
if (enableWednesday != null)
|
var enableTuesday = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("EnRoomOnWhenOccupiedTue"));
|
||||||
devConfig.EnableWednesday = bool.Parse(enableWednesday.CustomFieldValue);
|
if (enableTuesday != null)
|
||||||
|
devProps.EnableTuesday = bool.Parse(enableTuesday.CustomFieldValue);
|
||||||
var enableThursday = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("EnRoomOnWhenOccupiedThu"));
|
|
||||||
if (enableThursday != null)
|
var enableWednesday = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("EnRoomOnWhenOccupiedWed"));
|
||||||
devConfig.EnableThursday = bool.Parse(enableThursday.CustomFieldValue);
|
if (enableWednesday != null)
|
||||||
|
devProps.EnableWednesday = bool.Parse(enableWednesday.CustomFieldValue);
|
||||||
var enableFriday = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("EnRoomOnWhenOccupiedFri"));
|
|
||||||
if (enableFriday != null)
|
var enableThursday = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("EnRoomOnWhenOccupiedThu"));
|
||||||
devConfig.EnableFriday = bool.Parse(enableFriday.CustomFieldValue);
|
if (enableThursday != null)
|
||||||
|
devProps.EnableThursday = bool.Parse(enableThursday.CustomFieldValue);
|
||||||
var enableSaturday = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("EnRoomOnWhenOccupiedSat"));
|
|
||||||
if (enableSaturday != null)
|
var enableFriday = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("EnRoomOnWhenOccupiedFri"));
|
||||||
devConfig.EnableSaturday = bool.Parse(enableSaturday.CustomFieldValue);
|
if (enableFriday != null)
|
||||||
|
devProps.EnableFriday = bool.Parse(enableFriday.CustomFieldValue);
|
||||||
deviceConfig = devConfig;
|
|
||||||
}
|
var enableSaturday = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("EnRoomOnWhenOccupiedSat"));
|
||||||
|
if (enableSaturday != null)
|
||||||
// Set the config on the device
|
devProps.EnableSaturday = bool.Parse(enableSaturday.CustomFieldValue);
|
||||||
(device as IRuntimeConfigurableDevice).SetDeviceConfig(deviceConfig);
|
|
||||||
}
|
deviceConfig.Properties = JToken.FromObject(devProps);
|
||||||
|
}
|
||||||
//var roomConfig = ConfigReader.ConfigObject.Rooms.FirstOrDefault(r => r.Key.Equals(roomKey);
|
else if (device is EssentialsRoomBase)
|
||||||
|
{
|
||||||
//if(roomConfig != null)
|
// Set the room name
|
||||||
//{
|
if (!string.IsNullOrEmpty(roomInfo.Name))
|
||||||
// roomConfig.Name = roomInfo.Name;
|
{
|
||||||
|
Debug.Console(1, "Current Room Name: {0}. New Room Name: {1}", deviceConfig.Name, roomInfo.Name);
|
||||||
// // Update HelpMessage in room properties
|
// Set the name in config
|
||||||
// roomConfig.Properties.
|
deviceConfig.Name = roomInfo.Name;
|
||||||
//}
|
|
||||||
}
|
Debug.Console(1, "Room Name Successfully Changed.");
|
||||||
catch (Exception e)
|
}
|
||||||
{
|
|
||||||
Debug.Console(1, "FusionCustomPropetiesBridge: Error mapping properties: {0}", e);
|
// Set the help message
|
||||||
}
|
var helpMessage = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("RoomHelpMessage"));
|
||||||
}
|
if (helpMessage != null)
|
||||||
}
|
{
|
||||||
|
//Debug.Console(1, "Current Help Message: {0}. New Help Message: {1}", deviceConfig.Properties["help"]["message"].Value<string>(ToString()), helpMessage.CustomFieldValue);
|
||||||
|
deviceConfig.Properties["helpMessage"] = (string)helpMessage.CustomFieldValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the config on the device
|
||||||
|
(device as ReconfigurableDevice).SetConfig(deviceConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.Console(1, "FusionCustomPropetiesBridge: Error mapping properties: {0}", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -43,13 +43,13 @@ namespace PepperDash.Essentials
|
|||||||
return new Device(key, name);
|
return new Device(key, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
// MOVE into something else???
|
//// MOVE into something else???
|
||||||
else if (typeName == "basicirdisplay")
|
//else if (typeName == "basicirdisplay")
|
||||||
{
|
//{
|
||||||
var ir = IRPortHelper.GetIrPort(properties);
|
// var ir = IRPortHelper.GetIrPort(properties);
|
||||||
if (ir != null)
|
// if (ir != null)
|
||||||
return new BasicIrDisplay(key, name, ir.Port, ir.FileName);
|
// return new BasicIrDisplay(key, name, ir.Port, ir.FileName);
|
||||||
}
|
//}
|
||||||
|
|
||||||
else if (typeName == "commmock")
|
else if (typeName == "commmock")
|
||||||
{
|
{
|
||||||
@@ -87,9 +87,7 @@ namespace PepperDash.Essentials
|
|||||||
|
|
||||||
else if (typeName == "roomonwhenoccupancydetectedfeature")
|
else if (typeName == "roomonwhenoccupancydetectedfeature")
|
||||||
{
|
{
|
||||||
var props = JsonConvert.DeserializeObject<Room.Behaviours.RoomOnToDefaultSourceWhenOccupiedConfig>(properties.ToString());
|
return new Room.Behaviours.RoomOnToDefaultSourceWhenOccupied(dc);
|
||||||
|
|
||||||
return new Room.Behaviours.RoomOnToDefaultSourceWhenOccupied(key, props);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -1,162 +1,185 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
using Crestron.SimplSharpPro;
|
using Crestron.SimplSharpPro;
|
||||||
using Crestron.SimplSharpPro.DeviceSupport;
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
using Crestron.SimplSharpPro.UI;
|
using Crestron.SimplSharpPro.UI;
|
||||||
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core;
|
using PepperDash.Essentials.Core;
|
||||||
using PepperDash.Essentials.Core.Config;
|
using PepperDash.Essentials.Core.Config;
|
||||||
using PepperDash.Essentials.Core.PageManagers;
|
using PepperDash.Essentials.Core.PageManagers;
|
||||||
|
using PepperDash.Essentials.DM.Endpoints.DGEs;
|
||||||
|
|
||||||
namespace PepperDash.Essentials
|
|
||||||
{
|
namespace PepperDash.Essentials
|
||||||
public class UiDeviceFactory
|
{
|
||||||
{
|
public class UiDeviceFactory
|
||||||
public static IKeyed GetUiDevice(DeviceConfig config)
|
{
|
||||||
{
|
public static IKeyed GetUiDevice(DeviceConfig config)
|
||||||
var comm = CommFactory.GetControlPropertiesConfig(config);
|
{
|
||||||
|
var comm = CommFactory.GetControlPropertiesConfig(config);
|
||||||
var props = JsonConvert.DeserializeObject<CrestronTouchpanelPropertiesConfig>(config.Properties.ToString());
|
|
||||||
|
var typeName = config.Type.ToLower();
|
||||||
EssentialsTouchpanelController panelController = new EssentialsTouchpanelController(config.Key, config.Name, config.Type, props, comm.IpIdInt);
|
|
||||||
|
EssentialsTouchpanelController panelController = null;
|
||||||
panelController.AddPostActivationAction(() =>
|
|
||||||
{
|
var props = JsonConvert.DeserializeObject<CrestronTouchpanelPropertiesConfig>(config.Properties.ToString());
|
||||||
var mainDriver = new EssentialsPanelMainInterfaceDriver(panelController.Panel, props);
|
|
||||||
// Then the sub drivers
|
if (typeName.Contains("dge"))
|
||||||
|
{
|
||||||
// spin up different room drivers depending on room type
|
Dge100 dgeDevice = null;
|
||||||
var room = DeviceManager.GetDeviceForKey(props.DefaultRoomKey);
|
if (typeName == "dge100")
|
||||||
if (room is EssentialsHuddleSpaceRoom)
|
dgeDevice = new Dge100(comm.IpIdInt, Global.ControlSystem);
|
||||||
{
|
else if (typeName == "dmdge200c")
|
||||||
|
dgeDevice = new DmDge200C(comm.IpIdInt, Global.ControlSystem);
|
||||||
// Header Driver
|
|
||||||
Debug.Console(0, panelController, "Adding header driver");
|
var dgeController = new DgeController(config.Key, config.Name, dgeDevice, config, props);
|
||||||
mainDriver.HeaderDriver = new EssentialsHeaderDriver(mainDriver, props);
|
|
||||||
|
DeviceManager.AddDevice(dgeController);
|
||||||
// AV Driver
|
|
||||||
Debug.Console(0, panelController, "Adding huddle space AV driver");
|
panelController = new EssentialsTouchpanelController(config.Key, config.Name, dgeController.DigitalGraphicsEngine,
|
||||||
var avDriver = new EssentialsHuddlePanelAvFunctionsDriver(mainDriver, props);
|
props.ProjectName, props.SgdFile);
|
||||||
avDriver.DefaultRoomKey = props.DefaultRoomKey;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
panelController = new EssentialsTouchpanelController(config.Key, config.Name, config.Type, props, comm.IpIdInt);
|
||||||
|
}
|
||||||
|
|
||||||
|
panelController.AddPostActivationAction(() =>
|
||||||
|
{
|
||||||
|
var mainDriver = new EssentialsPanelMainInterfaceDriver(panelController.Panel, props);
|
||||||
|
// Then the sub drivers
|
||||||
|
|
||||||
|
// spin up different room drivers depending on room type
|
||||||
|
var room = DeviceManager.GetDeviceForKey(props.DefaultRoomKey);
|
||||||
|
if (room is EssentialsHuddleSpaceRoom)
|
||||||
|
{
|
||||||
|
|
||||||
|
// Header Driver
|
||||||
|
Debug.Console(0, panelController, "Adding header driver");
|
||||||
|
mainDriver.HeaderDriver = new EssentialsHeaderDriver(mainDriver, props);
|
||||||
|
|
||||||
|
// AV Driver
|
||||||
|
Debug.Console(0, panelController, "Adding huddle space AV driver");
|
||||||
|
var avDriver = new EssentialsHuddlePanelAvFunctionsDriver(mainDriver, props);
|
||||||
|
avDriver.DefaultRoomKey = props.DefaultRoomKey;
|
||||||
mainDriver.AvDriver = avDriver;
|
mainDriver.AvDriver = avDriver;
|
||||||
avDriver.CurrentRoom = room as EssentialsHuddleSpaceRoom;
|
avDriver.CurrentRoom = room as EssentialsHuddleSpaceRoom;
|
||||||
|
|
||||||
// Environment Driver
|
// Environment Driver
|
||||||
if (avDriver.CurrentRoom.Config.Environment != null && avDriver.CurrentRoom.Config.Environment.DeviceKeys.Count > 0)
|
if (avDriver.CurrentRoom.PropertiesConfig.Environment != null && avDriver.CurrentRoom.PropertiesConfig.Environment.DeviceKeys.Count > 0)
|
||||||
{
|
{
|
||||||
Debug.Console(0, panelController, "Adding environment driver");
|
Debug.Console(0, panelController, "Adding environment driver");
|
||||||
mainDriver.EnvironmentDriver = new EssentialsEnvironmentDriver(mainDriver, props);
|
mainDriver.EnvironmentDriver = new EssentialsEnvironmentDriver(mainDriver, props);
|
||||||
|
|
||||||
mainDriver.EnvironmentDriver.GetDevicesFromConfig(avDriver.CurrentRoom.Config.Environment);
|
mainDriver.EnvironmentDriver.GetDevicesFromConfig(avDriver.CurrentRoom.PropertiesConfig.Environment);
|
||||||
}
|
}
|
||||||
|
|
||||||
mainDriver.HeaderDriver.SetupHeaderButtons(avDriver, avDriver.CurrentRoom);
|
mainDriver.HeaderDriver.SetupHeaderButtons(avDriver, avDriver.CurrentRoom);
|
||||||
|
|
||||||
panelController.LoadAndShowDriver(mainDriver); // This is a little convoluted.
|
panelController.LoadAndShowDriver(mainDriver); // This is a little convoluted.
|
||||||
|
|
||||||
if (panelController.Panel is TswFt5ButtonSystem)
|
if (panelController.Panel is TswFt5ButtonSystem)
|
||||||
{
|
{
|
||||||
var tsw = panelController.Panel as TswFt5ButtonSystem;
|
var tsw = panelController.Panel as TswFt5ButtonSystem;
|
||||||
// Wire up hard keys
|
// Wire up hard keys
|
||||||
tsw.Power.UserObject = new Action<bool>(b => { if (!b) avDriver.PowerButtonPressed(); });
|
tsw.Power.UserObject = new Action<bool>(b => { if (!b) avDriver.PowerButtonPressed(); });
|
||||||
//tsw.Home.UserObject = new Action<bool>(b => { if (!b) HomePressed(); });
|
//tsw.Home.UserObject = new Action<bool>(b => { if (!b) HomePressed(); });
|
||||||
if(mainDriver.EnvironmentDriver != null)
|
if(mainDriver.EnvironmentDriver != null)
|
||||||
tsw.Lights.UserObject = new Action<bool>(b =>
|
tsw.Lights.UserObject = new Action<bool>(b =>
|
||||||
{
|
{
|
||||||
if (!b)
|
if (!b)
|
||||||
{
|
{
|
||||||
//mainDriver.AvDriver.PopupInterlock.ShowInterlockedWithToggle(mainDriver.EnvironmentDriver.BackgroundSubpageJoin);
|
//mainDriver.AvDriver.PopupInterlock.ShowInterlockedWithToggle(mainDriver.EnvironmentDriver.BackgroundSubpageJoin);
|
||||||
mainDriver.EnvironmentDriver.Toggle();
|
mainDriver.EnvironmentDriver.Toggle();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
tsw.Up.UserObject = new Action<bool>(avDriver.VolumeUpPress);
|
tsw.Up.UserObject = new Action<bool>(avDriver.VolumeUpPress);
|
||||||
tsw.Down.UserObject = new Action<bool>(avDriver.VolumeDownPress);
|
tsw.Down.UserObject = new Action<bool>(avDriver.VolumeDownPress);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//else if (room is EssentialsPresentationRoom)
|
//else if (room is EssentialsPresentationRoom)
|
||||||
//{
|
//{
|
||||||
// Debug.Console(0, panelController, "Adding presentation room driver");
|
// Debug.Console(0, panelController, "Adding presentation room driver");
|
||||||
// var avDriver = new EssentialsPresentationPanelAvFunctionsDriver(mainDriver, props);
|
// var avDriver = new EssentialsPresentationPanelAvFunctionsDriver(mainDriver, props);
|
||||||
// avDriver.CurrentRoom = room as EssentialsPresentationRoom;
|
// avDriver.CurrentRoom = room as EssentialsPresentationRoom;
|
||||||
// avDriver.DefaultRoomKey = props.DefaultRoomKey;
|
// avDriver.DefaultRoomKey = props.DefaultRoomKey;
|
||||||
// mainDriver.AvDriver = avDriver ;
|
// mainDriver.AvDriver = avDriver ;
|
||||||
// mainDriver.HeaderDriver = new EssentialsHeaderDriver(mainDriver, props);
|
// mainDriver.HeaderDriver = new EssentialsHeaderDriver(mainDriver, props);
|
||||||
// panelController.LoadAndShowDriver(mainDriver);
|
// panelController.LoadAndShowDriver(mainDriver);
|
||||||
|
|
||||||
// if (panelController.Panel is TswFt5ButtonSystem)
|
// if (panelController.Panel is TswFt5ButtonSystem)
|
||||||
// {
|
// {
|
||||||
// var tsw = panelController.Panel as TswFt5ButtonSystem;
|
// var tsw = panelController.Panel as TswFt5ButtonSystem;
|
||||||
// // Wire up hard keys
|
// // Wire up hard keys
|
||||||
// tsw.Power.UserObject = new Action<bool>(b => { if (!b) avDriver.PowerButtonPressed(); });
|
// tsw.Power.UserObject = new Action<bool>(b => { if (!b) avDriver.PowerButtonPressed(); });
|
||||||
// //tsw.Home.UserObject = new Action<bool>(b => { if (!b) HomePressed(); });
|
// //tsw.Home.UserObject = new Action<bool>(b => { if (!b) HomePressed(); });
|
||||||
// tsw.Up.UserObject = new Action<bool>(avDriver.VolumeUpPress);
|
// tsw.Up.UserObject = new Action<bool>(avDriver.VolumeUpPress);
|
||||||
// tsw.Down.UserObject = new Action<bool>(avDriver.VolumeDownPress);
|
// tsw.Down.UserObject = new Action<bool>(avDriver.VolumeDownPress);
|
||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
else if (room is EssentialsHuddleVtc1Room)
|
else if (room is EssentialsHuddleVtc1Room)
|
||||||
{
|
{
|
||||||
Debug.Console(0, panelController, "Adding huddle space VTC AV driver");
|
Debug.Console(0, panelController, "Adding huddle space VTC AV driver");
|
||||||
|
|
||||||
// Header Driver
|
// Header Driver
|
||||||
mainDriver.HeaderDriver = new EssentialsHeaderDriver(mainDriver, props);
|
mainDriver.HeaderDriver = new EssentialsHeaderDriver(mainDriver, props);
|
||||||
|
|
||||||
// AV Driver
|
// AV Driver
|
||||||
var avDriver = new EssentialsHuddleVtc1PanelAvFunctionsDriver(mainDriver, props);
|
var avDriver = new EssentialsHuddleVtc1PanelAvFunctionsDriver(mainDriver, props);
|
||||||
|
|
||||||
var codecDriver = new PepperDash.Essentials.UIDrivers.VC.EssentialsVideoCodecUiDriver(panelController.Panel, avDriver,
|
var codecDriver = new PepperDash.Essentials.UIDrivers.VC.EssentialsVideoCodecUiDriver(panelController.Panel, avDriver,
|
||||||
(room as EssentialsHuddleVtc1Room).VideoCodec, mainDriver.HeaderDriver);
|
(room as EssentialsHuddleVtc1Room).VideoCodec, mainDriver.HeaderDriver);
|
||||||
avDriver.SetVideoCodecDriver(codecDriver);
|
avDriver.SetVideoCodecDriver(codecDriver);
|
||||||
avDriver.DefaultRoomKey = props.DefaultRoomKey;
|
avDriver.DefaultRoomKey = props.DefaultRoomKey;
|
||||||
mainDriver.AvDriver = avDriver;
|
mainDriver.AvDriver = avDriver;
|
||||||
avDriver.CurrentRoom = room as EssentialsHuddleVtc1Room;
|
avDriver.CurrentRoom = room as EssentialsHuddleVtc1Room;
|
||||||
|
|
||||||
// Environment Driver
|
// Environment Driver
|
||||||
if (avDriver.CurrentRoom.Config.Environment != null && avDriver.CurrentRoom.Config.Environment.DeviceKeys.Count > 0)
|
if (avDriver.CurrentRoom.PropertiesConfig.Environment != null && avDriver.CurrentRoom.PropertiesConfig.Environment.DeviceKeys.Count > 0)
|
||||||
{
|
{
|
||||||
Debug.Console(0, panelController, "Adding environment driver");
|
Debug.Console(0, panelController, "Adding environment driver");
|
||||||
mainDriver.EnvironmentDriver = new EssentialsEnvironmentDriver(mainDriver, props);
|
mainDriver.EnvironmentDriver = new EssentialsEnvironmentDriver(mainDriver, props);
|
||||||
|
|
||||||
mainDriver.EnvironmentDriver.GetDevicesFromConfig(avDriver.CurrentRoom.Config.Environment);
|
mainDriver.EnvironmentDriver.GetDevicesFromConfig(avDriver.CurrentRoom.PropertiesConfig.Environment);
|
||||||
}
|
}
|
||||||
|
|
||||||
mainDriver.HeaderDriver.SetupHeaderButtons(avDriver, avDriver.CurrentRoom);
|
mainDriver.HeaderDriver.SetupHeaderButtons(avDriver, avDriver.CurrentRoom);
|
||||||
|
|
||||||
panelController.LoadAndShowDriver(mainDriver); // This is a little convoluted.
|
panelController.LoadAndShowDriver(mainDriver); // This is a little convoluted.
|
||||||
|
|
||||||
if (panelController.Panel is TswFt5ButtonSystem)
|
if (panelController.Panel is TswFt5ButtonSystem)
|
||||||
{
|
{
|
||||||
var tsw = panelController.Panel as TswFt5ButtonSystem;
|
var tsw = panelController.Panel as TswFt5ButtonSystem;
|
||||||
// Wire up hard keys
|
// Wire up hard keys
|
||||||
tsw.Power.UserObject = new Action<bool>(b => { if (!b) avDriver.EndMeetingPress(); });
|
tsw.Power.UserObject = new Action<bool>(b => { if (!b) avDriver.EndMeetingPress(); });
|
||||||
//tsw.Home.UserObject = new Action<bool>(b => { if (!b) HomePressed(); });
|
//tsw.Home.UserObject = new Action<bool>(b => { if (!b) HomePressed(); });
|
||||||
if (mainDriver.EnvironmentDriver != null)
|
if (mainDriver.EnvironmentDriver != null)
|
||||||
tsw.Lights.UserObject = new Action<bool>(b =>
|
tsw.Lights.UserObject = new Action<bool>(b =>
|
||||||
{
|
{
|
||||||
if (!b)
|
if (!b)
|
||||||
{
|
{
|
||||||
//mainDriver.AvDriver.PopupInterlock.ShowInterlockedWithToggle(mainDriver.EnvironmentDriver.BackgroundSubpageJoin);
|
//mainDriver.AvDriver.PopupInterlock.ShowInterlockedWithToggle(mainDriver.EnvironmentDriver.BackgroundSubpageJoin);
|
||||||
mainDriver.EnvironmentDriver.Toggle();
|
mainDriver.EnvironmentDriver.Toggle();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
tsw.Up.UserObject = new Action<bool>(avDriver.VolumeUpPress);
|
tsw.Up.UserObject = new Action<bool>(avDriver.VolumeUpPress);
|
||||||
tsw.Down.UserObject = new Action<bool>(avDriver.VolumeDownPress);
|
tsw.Down.UserObject = new Action<bool>(avDriver.VolumeDownPress);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Debug.Console(0, panelController, "ERROR: Cannot load AvFunctionsDriver for room '{0}'", props.DefaultRoomKey);
|
Debug.Console(0, panelController, "ERROR: Cannot load AvFunctionsDriver for room '{0}'", props.DefaultRoomKey);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return panelController;
|
return panelController;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -48,27 +48,27 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Crestron.SimplSharpPro.DeviceSupport, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
<Reference Include="Crestron.SimplSharpPro.DeviceSupport, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.DeviceSupport.dll</HintPath>
|
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.DeviceSupport.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Crestron.SimplSharpPro.DM, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
<Reference Include="Crestron.SimplSharpPro.DM, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.DM.dll</HintPath>
|
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.DM.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Crestron.SimplSharpPro.EthernetCommunications, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
<Reference Include="Crestron.SimplSharpPro.EthernetCommunications, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.EthernetCommunications.dll</HintPath>
|
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.EthernetCommunications.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Crestron.SimplSharpPro.Fusion, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
<Reference Include="Crestron.SimplSharpPro.Fusion, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Fusion.dll</HintPath>
|
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Fusion.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Crestron.SimplSharpPro.Remotes, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
<Reference Include="Crestron.SimplSharpPro.Remotes, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Remotes.dll</HintPath>
|
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Remotes.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Crestron.SimplSharpPro.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
<Reference Include="Crestron.SimplSharpPro.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.UI.dll</HintPath>
|
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.UI.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="mscorlib" />
|
<Reference Include="mscorlib" />
|
||||||
<Reference Include="PepperDash_Core, Version=1.0.3.27452, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="PepperDash_Core, Version=1.0.3.27452, Culture=neutral, processorArchitecture=MSIL">
|
||||||
@@ -81,37 +81,76 @@
|
|||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="SimplSharpCustomAttributesInterface, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
<Reference Include="SimplSharpCustomAttributesInterface, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpCustomAttributesInterface.dll</HintPath>
|
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpCustomAttributesInterface.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="SimplSharpHelperInterface, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
<Reference Include="SimplSharpHelperInterface, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpHelperInterface.dll</HintPath>
|
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpHelperInterface.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="SimplSharpNewtonsoft, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
<Reference Include="SimplSharpNewtonsoft, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpNewtonsoft.dll</HintPath>
|
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpNewtonsoft.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="SimplSharpPro, Version=1.5.2.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
<Reference Include="SimplSharpPro, Version=1.5.3.17, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpPro.exe</HintPath>
|
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpPro.exe</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="SimplSharpReflectionInterface, Version=1.0.5583.25238, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
<Reference Include="SimplSharpReflectionInterface, Version=1.0.5583.25238, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpReflectionInterface.dll</HintPath>
|
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpReflectionInterface.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="SimplSharpTimerEventInterface, Version=1.0.6197.20052, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
<Reference Include="SimplSharpTimerEventInterface, Version=1.0.6197.20052, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpTimerEventInterface.dll</HintPath>
|
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpTimerEventInterface.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="AppServer\Messengers\ConfigMessenger.cs" />
|
||||||
|
<Compile Include="AppServer\Messengers\Ddvc01AtcMessenger.cs" />
|
||||||
|
<Compile Include="AppServer\Messengers\AudioCodecBaseMessenger.cs" />
|
||||||
|
<Compile Include="AppServer\Messengers\Ddvc01VtcMessenger.cs" />
|
||||||
|
<Compile Include="AppServer\Messengers\MessengerBase.cs" />
|
||||||
|
<Compile Include="AppServer\Messengers\SystemMonitorMessenger.cs" />
|
||||||
<Compile Include="AppServer\Messengers\VideoCodecBaseMessenger.cs" />
|
<Compile Include="AppServer\Messengers\VideoCodecBaseMessenger.cs" />
|
||||||
<Compile Include="Audio\EssentialsVolumeLevelConfig.cs" />
|
<Compile Include="Audio\EssentialsVolumeLevelConfig.cs" />
|
||||||
|
<Compile Include="Bridges\AppleTvBridge.cs" />
|
||||||
<Compile Include="Bridges\BridgeBase.cs" />
|
<Compile Include="Bridges\BridgeBase.cs" />
|
||||||
<Compile Include="Bridges\BridgeFactory.cs" />
|
<Compile Include="Bridges\BridgeFactory.cs" />
|
||||||
|
<Compile Include="Bridges\CameraControllerBridge.cs" />
|
||||||
|
<Compile Include="Bridges\AirMediaControllerBridge.cs" />
|
||||||
|
<Compile Include="Bridges\DmpsAudioOutputControllerBridge.cs" />
|
||||||
|
<Compile Include="Bridges\DmpsRoutingControllerBridge.cs" />
|
||||||
|
<Compile Include="Bridges\DisplayControllerBridge.cs" />
|
||||||
|
<Compile Include="Bridges\DigitalLoggerBridge.cs" />
|
||||||
|
<Compile Include="Bridges\DmChassisControllerBridge.cs" />
|
||||||
|
<Compile Include="Bridges\DmTxControllerBridge.cs" />
|
||||||
|
<Compile Include="Bridges\GenericLightingBridge.cs" />
|
||||||
|
<Compile Include="Bridges\GenericRelayDeviceBridge.cs" />
|
||||||
|
<Compile Include="Bridges\HdMdxxxCEControllerBridge.cs" />
|
||||||
|
<Compile Include="Bridges\IBasicCommunicationBridge.cs" />
|
||||||
|
<Compile Include="Bridges\DmRmcControllerBridge.cs" />
|
||||||
|
<Compile Include="Bridges\IBridge.cs" />
|
||||||
|
<Compile Include="Bridges\IDigitalInputBridge.cs" />
|
||||||
|
<Compile Include="Bridges\JoinMaps\AirMediaControllerJoinMap.cs" />
|
||||||
|
<Compile Include="Bridges\JoinMaps\AppleTvJoinMap.cs" />
|
||||||
|
<Compile Include="Bridges\JoinMaps\CameraControllerJoinMap.cs" />
|
||||||
|
<Compile Include="Bridges\JoinMaps\DigitalLoggerJoinMap.cs" />
|
||||||
|
<Compile Include="Bridges\JoinMaps\DisplayControllerJoinMap.cs" />
|
||||||
|
<Compile Include="Bridges\JoinMaps\DmChassisControllerJoinMap.cs" />
|
||||||
|
<Compile Include="Bridges\JoinMaps\DmpsAudioOutputControllerJoinMap.cs" />
|
||||||
|
<Compile Include="Bridges\JoinMaps\DmpsRoutingControllerJoinMap.cs" />
|
||||||
|
<Compile Include="Bridges\JoinMaps\DmRmcControllerJoinMap.cs" />
|
||||||
|
<Compile Include="Bridges\JoinMaps\DmTxControllerJoinMap.cs" />
|
||||||
|
<Compile Include="Bridges\JoinMaps\GenericLightingJoinMap.cs" />
|
||||||
|
<Compile Include="Bridges\JoinMaps\GenericRelayControllerJoinMap.cs" />
|
||||||
|
<Compile Include="Bridges\JoinMaps\HdMdxxxCEControllerJoinMap.cs" />
|
||||||
|
<Compile Include="Bridges\JoinMaps\IBasicCommunicationJoinMap.cs" />
|
||||||
|
<Compile Include="Bridges\JoinMaps\IDigitalInputJoinMap.cs" />
|
||||||
|
<Compile Include="Bridges\JoinMaps\SystemMonitorJoinMap.cs" />
|
||||||
|
<Compile Include="Bridges\SystemMonitorBridge.cs" />
|
||||||
<Compile Include="Configuration ORIGINAL\Builders\TPConfig.cs" />
|
<Compile Include="Configuration ORIGINAL\Builders\TPConfig.cs" />
|
||||||
<Compile Include="Configuration ORIGINAL\Configuration.cs" />
|
<Compile Include="Configuration ORIGINAL\Configuration.cs" />
|
||||||
<Compile Include="Configuration ORIGINAL\ConfigurationHelpers.cs" />
|
<Compile Include="Configuration ORIGINAL\ConfigurationHelpers.cs" />
|
||||||
@@ -132,13 +171,13 @@
|
|||||||
<Compile Include="Devices\NUMERIC AppleTV.cs" />
|
<Compile Include="Devices\NUMERIC AppleTV.cs" />
|
||||||
<Compile Include="ControlSystem.cs" />
|
<Compile Include="ControlSystem.cs" />
|
||||||
<Compile Include="Factory\UiDeviceFactory.cs" />
|
<Compile Include="Factory\UiDeviceFactory.cs" />
|
||||||
<Compile Include="OTHER\Fusion\EssentialsHuddleVtc1FusionController.cs" />
|
<Compile Include="FOR REFERENCE UI\OTHER\Fusion\EssentialsHuddleVtc1FusionController.cs" />
|
||||||
<Compile Include="OTHER\Fusion\FusionCustomPropertiesBridge.cs" />
|
<Compile Include="FOR REFERENCE UI\OTHER\Fusion\FusionCustomPropertiesBridge.cs" />
|
||||||
<Compile Include="OTHER\Fusion\FusionEventHandlers.cs" />
|
<Compile Include="FOR REFERENCE UI\OTHER\Fusion\FusionEventHandlers.cs" />
|
||||||
<Compile Include="OTHER\Fusion\FusionProcessorQueries.cs" />
|
<Compile Include="FOR REFERENCE UI\OTHER\Fusion\FusionProcessorQueries.cs" />
|
||||||
<Compile Include="OTHER\Fusion\FusionRviDataClasses.cs" />
|
<Compile Include="FOR REFERENCE UI\OTHER\Fusion\FusionRviDataClasses.cs" />
|
||||||
<Compile Include="REMOVE EssentialsApp.cs" />
|
<Compile Include="REMOVE EssentialsApp.cs" />
|
||||||
<Compile Include="OTHER\Fusion\EssentialsHuddleSpaceFusionSystemControllerBase.cs" />
|
<Compile Include="FOR REFERENCE UI\OTHER\Fusion\EssentialsHuddleSpaceFusionSystemControllerBase.cs" />
|
||||||
<Compile Include="HttpApiHandler.cs" />
|
<Compile Include="HttpApiHandler.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Room\Behaviours\RoomOnToDefaultSourceWhenOccupied.cs" />
|
<Compile Include="Room\Behaviours\RoomOnToDefaultSourceWhenOccupied.cs" />
|
||||||
@@ -203,7 +242,6 @@
|
|||||||
<Compile Include="AppServer\CotijaSystemController.cs" />
|
<Compile Include="AppServer\CotijaSystemController.cs" />
|
||||||
<Compile Include="UI\DualDisplaySourceSRLController.cs" />
|
<Compile Include="UI\DualDisplaySourceSRLController.cs" />
|
||||||
<Compile Include="UI\SubpageReferenceListActivityItem.cs" />
|
<Compile Include="UI\SubpageReferenceListActivityItem.cs" />
|
||||||
<Compile Include="UI\CrestronTouchpanelPropertiesConfig.cs" />
|
|
||||||
<Compile Include="FOR REFERENCE UI\Panels\REMOVE UiCue.cs" />
|
<Compile Include="FOR REFERENCE UI\Panels\REMOVE UiCue.cs" />
|
||||||
<Compile Include="FOR REFERENCE UI\SRL\SourceListSubpageReferenceList.cs" />
|
<Compile Include="FOR REFERENCE UI\SRL\SourceListSubpageReferenceList.cs" />
|
||||||
<Compile Include="Room\Types\EssentialsHuddleSpaceRoom.cs" />
|
<Compile Include="Room\Types\EssentialsHuddleSpaceRoom.cs" />
|
||||||
@@ -211,9 +249,15 @@
|
|||||||
<Compile Include="UI\SubpageReferenceListSourceItem.cs" />
|
<Compile Include="UI\SubpageReferenceListSourceItem.cs" />
|
||||||
<None Include="app.config" />
|
<None Include="app.config" />
|
||||||
<None Include="Properties\ControlSystem.cfg" />
|
<None Include="Properties\ControlSystem.cfg" />
|
||||||
<EmbeddedResource Include="SGD\PepperDash Essentials iPad.sgd" />
|
<EmbeddedResource Include="SGD\PepperDash Essentials iPad.sgd">
|
||||||
<EmbeddedResource Include="SGD\PepperDash Essentials TSW-560.sgd" />
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
<EmbeddedResource Include="SGD\PepperDash Essentials TSW-760.sgd" />
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="SGD\PepperDash Essentials TSW-560.sgd">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="SGD\PepperDash Essentials TSW-760.sgd">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</EmbeddedResource>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\essentials-framework\Essentials Core\PepperDashEssentialsBase\PepperDash_Essentials_Core.csproj">
|
<ProjectReference Include="..\essentials-framework\Essentials Core\PepperDashEssentialsBase\PepperDash_Essentials_Core.csproj">
|
||||||
|
|||||||
@@ -4,5 +4,5 @@
|
|||||||
[assembly: AssemblyCompany("PepperDash Technology Corp")]
|
[assembly: AssemblyCompany("PepperDash Technology Corp")]
|
||||||
[assembly: AssemblyProduct("PepperDashEssentials")]
|
[assembly: AssemblyProduct("PepperDashEssentials")]
|
||||||
[assembly: AssemblyCopyright("Copyright © PepperDash Technology Corp 2018")]
|
[assembly: AssemblyCopyright("Copyright © PepperDash Technology Corp 2018")]
|
||||||
[assembly: AssemblyVersion("1.2.12.*")]
|
[assembly: AssemblyVersion("1.4.0.*")]
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<ControlSystem>
|
<ControlSystem>
|
||||||
<Name>Test RMC3</Name>
|
<Name>192.168.10.1</Name>
|
||||||
<Address>auto 192.168.1.40</Address>
|
<Address>auto 192.168.10.1</Address>
|
||||||
<ProgramSlot>Program01</ProgramSlot>
|
<ProgramSlot>Program01</ProgramSlot>
|
||||||
<Storage>Internal Flash</Storage>
|
<Storage>Internal Flash</Storage>
|
||||||
</ControlSystem>
|
</ControlSystem>
|
||||||
35
PepperDashEssentials/Properties/UpdateAssemblyVersion.ps1
Normal file
35
PepperDashEssentials/Properties/UpdateAssemblyVersion.ps1
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
function Update-SourceVersion
|
||||||
|
{
|
||||||
|
Param ([string]$Version)
|
||||||
|
$NewVersion = ‘AssemblyVersion("‘ + $Version + ‘.*")’;
|
||||||
|
foreach ($o in $input)
|
||||||
|
{
|
||||||
|
Write-output $o.FullName
|
||||||
|
$TmpFile = $o.FullName + “.tmp”
|
||||||
|
get-content $o.FullName |
|
||||||
|
%{$_ -replace ‘AssemblyVersion\("(\d+\.\d+\.\d+)\.\*"\)’, $NewVersion } > $TmpFile
|
||||||
|
move-item $TmpFile $o.FullName -force
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function Update-AllAssemblyInfoFiles ( $version )
|
||||||
|
{
|
||||||
|
foreach ($file in “AssemblyInfo.cs”, “AssemblyInfo.vb” )
|
||||||
|
{
|
||||||
|
get-childitem -recurse |? {$_.Name -eq $file} | Update-SourceVersion $version ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# validate arguments
|
||||||
|
$r= [System.Text.RegularExpressions.Regex]::Match($args[0], "^\d+\.\d+\.\d+$");
|
||||||
|
if ($r.Success)
|
||||||
|
{
|
||||||
|
Update-AllAssemblyInfoFiles $args[0];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
echo ” “;
|
||||||
|
echo “Error: Input version does not match x.y.z format!”
|
||||||
|
echo ” “;
|
||||||
|
echo "Unable to apply version to AssemblyInfo.cs files";
|
||||||
|
}
|
||||||
@@ -11,6 +11,7 @@ using Newtonsoft.Json.Linq;
|
|||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core;
|
using PepperDash.Essentials.Core;
|
||||||
using PepperDash.Essentials.Core.Config;
|
using PepperDash.Essentials.Core.Config;
|
||||||
|
using PepperDash.Essentials.Core.Devices;
|
||||||
using PepperDash.Essentials.Devices.Common.Occupancy;
|
using PepperDash.Essentials.Devices.Common.Occupancy;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Room.Behaviours
|
namespace PepperDash.Essentials.Room.Behaviours
|
||||||
@@ -18,9 +19,9 @@ namespace PepperDash.Essentials.Room.Behaviours
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// A device that when linked to a room can power the room on when enabled during scheduled hours.
|
/// A device that when linked to a room can power the room on when enabled during scheduled hours.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class RoomOnToDefaultSourceWhenOccupied : Device, IRuntimeConfigurableDevice
|
public class RoomOnToDefaultSourceWhenOccupied : ReconfigurableDevice
|
||||||
{
|
{
|
||||||
RoomOnToDefaultSourceWhenOccupiedConfig Config;
|
RoomOnToDefaultSourceWhenOccupiedConfig PropertiesConfig;
|
||||||
|
|
||||||
public bool FeatureEnabled { get; private set; }
|
public bool FeatureEnabled { get; private set; }
|
||||||
|
|
||||||
@@ -42,10 +43,10 @@ namespace PepperDash.Essentials.Room.Behaviours
|
|||||||
|
|
||||||
private Fusion.EssentialsHuddleSpaceFusionSystemControllerBase FusionRoom;
|
private Fusion.EssentialsHuddleSpaceFusionSystemControllerBase FusionRoom;
|
||||||
|
|
||||||
public RoomOnToDefaultSourceWhenOccupied(string key, RoomOnToDefaultSourceWhenOccupiedConfig config)
|
public RoomOnToDefaultSourceWhenOccupied(DeviceConfig config) :
|
||||||
: base(key)
|
base (config)
|
||||||
{
|
{
|
||||||
Config = config;
|
PropertiesConfig = JsonConvert.DeserializeObject<RoomOnToDefaultSourceWhenOccupiedConfig>(config.Properties.ToString());
|
||||||
|
|
||||||
FeatureEventGroup = new ScheduledEventGroup(this.Key);
|
FeatureEventGroup = new ScheduledEventGroup(this.Key);
|
||||||
|
|
||||||
@@ -63,7 +64,7 @@ namespace PepperDash.Essentials.Room.Behaviours
|
|||||||
else
|
else
|
||||||
Debug.Console(1, this, "Room has no RoomOccupancy object set");
|
Debug.Console(1, this, "Room has no RoomOccupancy object set");
|
||||||
|
|
||||||
var fusionRoomKey = Config.RoomKey + "-fusion";
|
var fusionRoomKey = PropertiesConfig.RoomKey + "-fusion";
|
||||||
|
|
||||||
FusionRoom = DeviceManager.GetDeviceForKey(fusionRoomKey) as Fusion.EssentialsHuddleSpaceFusionSystemControllerBase;
|
FusionRoom = DeviceManager.GetDeviceForKey(fusionRoomKey) as Fusion.EssentialsHuddleSpaceFusionSystemControllerBase;
|
||||||
|
|
||||||
@@ -79,45 +80,48 @@ namespace PepperDash.Essentials.Room.Behaviours
|
|||||||
return base.CustomActivate();
|
return base.CustomActivate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets up device based on config values
|
||||||
|
/// </summary>
|
||||||
void SetUpDevice()
|
void SetUpDevice()
|
||||||
{
|
{
|
||||||
Room = DeviceManager.GetDeviceForKey(Config.RoomKey) as EssentialsRoomBase;
|
Room = DeviceManager.GetDeviceForKey(PropertiesConfig.RoomKey) as EssentialsRoomBase;
|
||||||
|
|
||||||
if (Room != null)
|
if (Room != null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
FeatureEnabledTime = DateTime.Parse(Config.OccupancyStartTime);
|
FeatureEnabledTime = DateTime.Parse(PropertiesConfig.OccupancyStartTime);
|
||||||
|
|
||||||
if (FeatureEnabledTime != null)
|
if (FeatureEnabledTime != null)
|
||||||
{
|
{
|
||||||
Debug.Console(1, this, "Enabled Time: {0}", FeatureEnabledTime.ToString());
|
Debug.Console(1, this, "Enabled Time: {0}", FeatureEnabledTime.ToString());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Debug.Console(1, this, "Unable to parse {0} to DateTime", Config.OccupancyStartTime);
|
Debug.Console(1, this, "Unable to parse {0} to DateTime", PropertiesConfig.OccupancyStartTime);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Debug.Console(1, this, "Unable to parse OccupancyStartTime property: {0} \n Error: {1}", Config.OccupancyStartTime, e);
|
Debug.Console(1, this, "Unable to parse OccupancyStartTime property: {0} \n Error: {1}", PropertiesConfig.OccupancyStartTime, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
FeatureDisabledTime = DateTime.Parse(Config.OccupancyEndTime);
|
FeatureDisabledTime = DateTime.Parse(PropertiesConfig.OccupancyEndTime);
|
||||||
|
|
||||||
if (FeatureDisabledTime != null)
|
if (FeatureDisabledTime != null)
|
||||||
{
|
{
|
||||||
Debug.Console(1, this, "Disabled Time: {0}", FeatureDisabledTime.ToString());
|
Debug.Console(1, this, "Disabled Time: {0}", FeatureDisabledTime.ToString());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Debug.Console(1, this, "Unable to parse {0} to DateTime", Config.OccupancyEndTime);
|
Debug.Console(1, this, "Unable to parse {0} to DateTime", PropertiesConfig.OccupancyEndTime);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Debug.Console(1, this, "Unable to parse a DateTime config value \n Error: {1}", e);
|
Debug.Console(1, this, "Unable to parse a DateTime config value \n Error: {1}", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Config.EnableRoomOnWhenOccupied)
|
if (!PropertiesConfig.EnableRoomOnWhenOccupied)
|
||||||
FeatureEventGroup.ClearAllEvents();
|
FeatureEventGroup.ClearAllEvents();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -133,30 +137,18 @@ namespace PepperDash.Essentials.Room.Behaviours
|
|||||||
FeatureEnabled = CheckIfFeatureShouldBeEnabled();
|
FeatureEnabled = CheckIfFeatureShouldBeEnabled();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Debug.Console(1, this, "Unable to get room from Device Manager with key: {0}", Config.RoomKey);
|
Debug.Console(1, this, "Unable to get room from Device Manager with key: {0}", PropertiesConfig.RoomKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns a JObject of the device config properties as they currently exist at runtime
|
protected override void CustomSetConfig(DeviceConfig config)
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public JToken GetLocalConfigProperties()
|
|
||||||
{
|
{
|
||||||
return JToken.FromObject(Config);
|
var newPropertiesConfig = JsonConvert.DeserializeObject<RoomOnToDefaultSourceWhenOccupiedConfig>(config.Properties.ToString());
|
||||||
}
|
|
||||||
|
|
||||||
public object GetDeviceConfig()
|
if(newPropertiesConfig != null)
|
||||||
{
|
PropertiesConfig = newPropertiesConfig;
|
||||||
return Config;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetDeviceConfig(object config)
|
ConfigWriter.UpdateDeviceConfig(config);
|
||||||
{
|
|
||||||
var newConfig = config as RoomOnToDefaultSourceWhenOccupiedConfig;
|
|
||||||
|
|
||||||
Config = newConfig;
|
|
||||||
|
|
||||||
ConfigWriter.UpdateDeviceProperties(this.Key, GetLocalConfigProperties());
|
|
||||||
|
|
||||||
SetUpDevice();
|
SetUpDevice();
|
||||||
}
|
}
|
||||||
@@ -182,7 +174,7 @@ namespace PepperDash.Essentials.Room.Behaviours
|
|||||||
{
|
{
|
||||||
if (SchEvent.Name == FeatureEnableEventName)
|
if (SchEvent.Name == FeatureEnableEventName)
|
||||||
{
|
{
|
||||||
if (Config.EnableRoomOnWhenOccupied)
|
if (PropertiesConfig.EnableRoomOnWhenOccupied)
|
||||||
FeatureEnabled = true;
|
FeatureEnabled = true;
|
||||||
|
|
||||||
Debug.Console(1, this, "*****Feature Enabled by event.*****");
|
Debug.Console(1, this, "*****Feature Enabled by event.*****");
|
||||||
@@ -204,7 +196,7 @@ namespace PepperDash.Essentials.Room.Behaviours
|
|||||||
{
|
{
|
||||||
bool enabled = false;
|
bool enabled = false;
|
||||||
|
|
||||||
if(Config.EnableRoomOnWhenOccupied)
|
if(PropertiesConfig.EnableRoomOnWhenOccupied)
|
||||||
{
|
{
|
||||||
Debug.Console(1, this, "Current Time: {0} \n FeatureEnabledTime: {1} \n FeatureDisabledTime: {2}", DateTime.Now, FeatureEnabledTime, FeatureDisabledTime);
|
Debug.Console(1, this, "Current Time: {0} \n FeatureEnabledTime: {1} \n FeatureDisabledTime: {2}", DateTime.Now, FeatureEnabledTime, FeatureDisabledTime);
|
||||||
|
|
||||||
@@ -446,19 +438,19 @@ namespace PepperDash.Essentials.Room.Behaviours
|
|||||||
{
|
{
|
||||||
ScheduledEventCommon.eWeekDays value = new ScheduledEventCommon.eWeekDays();
|
ScheduledEventCommon.eWeekDays value = new ScheduledEventCommon.eWeekDays();
|
||||||
|
|
||||||
if (Config.EnableSunday)
|
if (PropertiesConfig.EnableSunday)
|
||||||
value = value | ScheduledEventCommon.eWeekDays.Sunday;
|
value = value | ScheduledEventCommon.eWeekDays.Sunday;
|
||||||
if (Config.EnableMonday)
|
if (PropertiesConfig.EnableMonday)
|
||||||
value = value | ScheduledEventCommon.eWeekDays.Monday;
|
value = value | ScheduledEventCommon.eWeekDays.Monday;
|
||||||
if (Config.EnableTuesday)
|
if (PropertiesConfig.EnableTuesday)
|
||||||
value = value | ScheduledEventCommon.eWeekDays.Tuesday;
|
value = value | ScheduledEventCommon.eWeekDays.Tuesday;
|
||||||
if (Config.EnableWednesday)
|
if (PropertiesConfig.EnableWednesday)
|
||||||
value = value | ScheduledEventCommon.eWeekDays.Wednesday;
|
value = value | ScheduledEventCommon.eWeekDays.Wednesday;
|
||||||
if (Config.EnableThursday)
|
if (PropertiesConfig.EnableThursday)
|
||||||
value = value | ScheduledEventCommon.eWeekDays.Thursday;
|
value = value | ScheduledEventCommon.eWeekDays.Thursday;
|
||||||
if (Config.EnableFriday)
|
if (PropertiesConfig.EnableFriday)
|
||||||
value = value | ScheduledEventCommon.eWeekDays.Friday;
|
value = value | ScheduledEventCommon.eWeekDays.Friday;
|
||||||
if (Config.EnableSaturday)
|
if (PropertiesConfig.EnableSaturday)
|
||||||
value = value | ScheduledEventCommon.eWeekDays.Saturday;
|
value = value | ScheduledEventCommon.eWeekDays.Saturday;
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
@@ -473,7 +465,7 @@ namespace PepperDash.Essentials.Room.Behaviours
|
|||||||
{
|
{
|
||||||
if (type == ScheduledEventCommon.eCallbackReason.NormalExpiration)
|
if (type == ScheduledEventCommon.eCallbackReason.NormalExpiration)
|
||||||
{
|
{
|
||||||
if(Config.EnableRoomOnWhenOccupied)
|
if(PropertiesConfig.EnableRoomOnWhenOccupied)
|
||||||
FeatureEnabled = true;
|
FeatureEnabled = true;
|
||||||
|
|
||||||
Debug.Console(1, this, "RoomOnToDefaultSourceWhenOccupied Feature Enabled.");
|
Debug.Console(1, this, "RoomOnToDefaultSourceWhenOccupied Feature Enabled.");
|
||||||
|
|||||||
@@ -20,5 +20,7 @@ namespace PepperDash.Essentials.Room.Config
|
|||||||
public string DefaultSourceItem { get; set; }
|
public string DefaultSourceItem { get; set; }
|
||||||
[JsonProperty("videoCodecKey")]
|
[JsonProperty("videoCodecKey")]
|
||||||
public string VideoCodecKey { get; set; }
|
public string VideoCodecKey { get; set; }
|
||||||
|
[JsonProperty("audioCodecKey")]
|
||||||
|
public string AudioCodecKey { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -24,64 +24,14 @@ namespace PepperDash.Essentials.Room.Config
|
|||||||
var typeName = roomConfig.Type.ToLower();
|
var typeName = roomConfig.Type.ToLower();
|
||||||
if (typeName == "huddle")
|
if (typeName == "huddle")
|
||||||
{
|
{
|
||||||
var props = JsonConvert.DeserializeObject<EssentialsHuddleRoomPropertiesConfig>
|
var huddle = new EssentialsHuddleSpaceRoom(roomConfig);
|
||||||
(roomConfig.Properties.ToString());
|
|
||||||
var disp = DeviceManager.GetDeviceForKey(props.DefaultDisplayKey) as IRoutingSinkWithSwitching;
|
|
||||||
var audio = DeviceManager.GetDeviceForKey(props.DefaultAudioKey) as IRoutingSinkNoSwitching;
|
|
||||||
var huddle = new EssentialsHuddleSpaceRoom(roomConfig.Key, roomConfig.Name, disp, audio, props);
|
|
||||||
|
|
||||||
if (props.Occupancy != null)
|
|
||||||
huddle.SetRoomOccupancy(DeviceManager.GetDeviceForKey(props.Occupancy.DeviceKey) as
|
|
||||||
PepperDash.Essentials.Devices.Common.Occupancy.IOccupancyStatusProvider, props.Occupancy.TimeoutMinutes);
|
|
||||||
huddle.LogoUrl = props.Logo.GetUrl();
|
|
||||||
huddle.SourceListKey = props.SourceListKey;
|
|
||||||
huddle.DefaultSourceItem = props.DefaultSourceItem;
|
|
||||||
huddle.DefaultVolume = (ushort)(props.Volumes.Master.Level * 65535 / 100);
|
|
||||||
return huddle;
|
return huddle;
|
||||||
}
|
}
|
||||||
//else if (typeName == "presentation")
|
|
||||||
//{
|
|
||||||
// var props = JsonConvert.DeserializeObject<EssentialsPresentationRoomPropertiesConfig>
|
|
||||||
// (this.Properties.ToString());
|
|
||||||
// var displaysDict = new Dictionary<uint, IRoutingSinkNoSwitching>();
|
|
||||||
// uint i = 1;
|
|
||||||
// foreach (var dispKey in props.DisplayKeys) // read in the ordered displays list
|
|
||||||
// {
|
|
||||||
// var disp = DeviceManager.GetDeviceForKey(dispKey) as IRoutingSinkWithSwitching;
|
|
||||||
// displaysDict.Add(i++, disp);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // Get the master volume control
|
|
||||||
// IBasicVolumeWithFeedback masterVolumeControlDev = props.Volumes.Master.GetDevice();
|
|
||||||
|
|
||||||
|
|
||||||
// var presRoom = new EssentialsPresentationRoom(Key, Name, displaysDict, masterVolumeControlDev, props);
|
|
||||||
// return presRoom;
|
|
||||||
//}
|
|
||||||
else if (typeName == "huddlevtc1")
|
else if (typeName == "huddlevtc1")
|
||||||
{
|
{
|
||||||
var props = JsonConvert.DeserializeObject<EssentialsHuddleVtc1PropertiesConfig>
|
var rm = new EssentialsHuddleVtc1Room(roomConfig);
|
||||||
(roomConfig.Properties.ToString());
|
|
||||||
var disp = DeviceManager.GetDeviceForKey(props.DefaultDisplayKey) as IRoutingSinkWithSwitching;
|
|
||||||
|
|
||||||
var codec = DeviceManager.GetDeviceForKey(props.VideoCodecKey) as
|
|
||||||
PepperDash.Essentials.Devices.Common.VideoCodec.VideoCodecBase;
|
|
||||||
|
|
||||||
var rm = new EssentialsHuddleVtc1Room(roomConfig.Key, roomConfig.Name, disp, codec, codec, props);
|
|
||||||
// Add Occupancy object from config
|
|
||||||
|
|
||||||
if (props.Occupancy != null)
|
|
||||||
rm.SetRoomOccupancy(DeviceManager.GetDeviceForKey(props.Occupancy.DeviceKey) as
|
|
||||||
PepperDash.Essentials.Devices.Common.Occupancy.IOccupancyStatusProvider, props.Occupancy.TimeoutMinutes);
|
|
||||||
rm.LogoUrl = props.Logo.GetUrl();
|
|
||||||
rm.SourceListKey = props.SourceListKey;
|
|
||||||
rm.DefaultSourceItem = props.DefaultSourceItem;
|
|
||||||
rm.DefaultVolume = (ushort)(props.Volumes.Master.Level * 65535 / 100);
|
|
||||||
|
|
||||||
rm.MicrophonePrivacy = GetMicrophonePrivacy(props, rm); // Get Microphone Privacy object, if any
|
|
||||||
|
|
||||||
rm.Emergency = GetEmergency(props, rm); // Get emergency object, if any
|
|
||||||
|
|
||||||
return rm;
|
return rm;
|
||||||
}
|
}
|
||||||
else if (typeName == "ddvc01Bridge")
|
else if (typeName == "ddvc01Bridge")
|
||||||
@@ -96,7 +46,7 @@ namespace PepperDash.Essentials.Room.Config
|
|||||||
/// Gets and operating, standalone emergegncy object that can be plugged into a room.
|
/// Gets and operating, standalone emergegncy object that can be plugged into a room.
|
||||||
/// Returns null if there is no emergency defined
|
/// Returns null if there is no emergency defined
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static EssentialsRoomEmergencyBase GetEmergency(EssentialsRoomPropertiesConfig props, EssentialsRoomBase room)
|
public static EssentialsRoomEmergencyBase GetEmergency(EssentialsRoomPropertiesConfig props, EssentialsRoomBase room)
|
||||||
{
|
{
|
||||||
// This emergency
|
// This emergency
|
||||||
var emergency = props.Emergency;
|
var emergency = props.Emergency;
|
||||||
@@ -115,13 +65,13 @@ namespace PepperDash.Essentials.Room.Config
|
|||||||
/// <param name="props"></param>
|
/// <param name="props"></param>
|
||||||
/// <param name="room"></param>
|
/// <param name="room"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
static PepperDash.Essentials.Devices.Common.Microphones.MicrophonePrivacyController GetMicrophonePrivacy(
|
public static PepperDash.Essentials.Devices.Common.Microphones.MicrophonePrivacyController GetMicrophonePrivacy(
|
||||||
EssentialsRoomPropertiesConfig props, EssentialsHuddleVtc1Room room)
|
EssentialsRoomPropertiesConfig props, EssentialsHuddleVtc1Room room)
|
||||||
{
|
{
|
||||||
var microphonePrivacy = props.MicrophonePrivacy;
|
var microphonePrivacy = props.MicrophonePrivacy;
|
||||||
if (microphonePrivacy == null)
|
if (microphonePrivacy == null)
|
||||||
{
|
{
|
||||||
Debug.Console(0, "ERROR: Cannot create microphone privacy with null properties");
|
Debug.Console(0, "Cannot create microphone privacy with null properties");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// Get the MicrophonePrivacy device from the device manager
|
// Get the MicrophonePrivacy device from the device manager
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
|
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core;
|
using PepperDash.Essentials.Core;
|
||||||
using PepperDash.Essentials.Core.Config;
|
using PepperDash.Essentials.Core.Config;
|
||||||
@@ -11,7 +13,7 @@ using PepperDash.Essentials.Room.Config;
|
|||||||
|
|
||||||
namespace PepperDash.Essentials
|
namespace PepperDash.Essentials
|
||||||
{
|
{
|
||||||
public class EssentialsHuddleSpaceRoom : EssentialsRoomBase, IHasCurrentSourceInfoChange, IRunRouteAction, IRunDefaultPresentRoute
|
public class EssentialsHuddleSpaceRoom : EssentialsRoomBase, IHasCurrentSourceInfoChange, IRunRouteAction, IRunDefaultPresentRoute, IHasCurrentVolumeControls
|
||||||
{
|
{
|
||||||
public event EventHandler<VolumeDeviceChangeEventArgs> CurrentVolumeDeviceChange;
|
public event EventHandler<VolumeDeviceChangeEventArgs> CurrentVolumeDeviceChange;
|
||||||
public event SourceInfoChangeHandler CurrentSingleSourceChange;
|
public event SourceInfoChangeHandler CurrentSingleSourceChange;
|
||||||
@@ -66,7 +68,7 @@ namespace PepperDash.Essentials
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public EssentialsRoomPropertiesConfig Config { get; private set; }
|
public EssentialsHuddleRoomPropertiesConfig PropertiesConfig { get; private set; }
|
||||||
|
|
||||||
public IRoutingSinkWithSwitching DefaultDisplay { get; private set; }
|
public IRoutingSinkWithSwitching DefaultDisplay { get; private set; }
|
||||||
public IRoutingSinkNoSwitching DefaultAudioDevice { get; private set; }
|
public IRoutingSinkNoSwitching DefaultAudioDevice { get; private set; }
|
||||||
@@ -147,22 +149,32 @@ namespace PepperDash.Essentials
|
|||||||
|
|
||||||
public string CurrentSourceInfoKey { get; private set; }
|
public string CurrentSourceInfoKey { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
public EssentialsHuddleSpaceRoom(DeviceConfig config)
|
||||||
///
|
: base(config)
|
||||||
/// </summary>
|
{
|
||||||
/// <param name="key"></param>
|
try
|
||||||
/// <param name="name"></param>
|
{
|
||||||
public EssentialsHuddleSpaceRoom(string key, string name, IRoutingSinkWithSwitching defaultDisplay,
|
PropertiesConfig = JsonConvert.DeserializeObject<EssentialsHuddleRoomPropertiesConfig>
|
||||||
IRoutingSinkNoSwitching defaultAudio, EssentialsRoomPropertiesConfig config)
|
(config.Properties.ToString());
|
||||||
: base(key, name)
|
DefaultDisplay = DeviceManager.GetDeviceForKey(PropertiesConfig.DefaultDisplayKey) as IRoutingSinkWithSwitching;
|
||||||
|
|
||||||
|
|
||||||
|
DefaultAudioDevice = DeviceManager.GetDeviceForKey(PropertiesConfig.DefaultAudioKey) as IRoutingSinkWithSwitching;
|
||||||
|
|
||||||
|
Initialize();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.Console(1, this, "Error building room: \n{0}", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Initialize()
|
||||||
{
|
{
|
||||||
Config = config;
|
if (DefaultAudioDevice is IBasicVolumeControls)
|
||||||
DefaultDisplay = defaultDisplay;
|
DefaultVolumeControls = DefaultAudioDevice as IBasicVolumeControls;
|
||||||
DefaultAudioDevice = defaultAudio;
|
else if (DefaultAudioDevice is IHasVolumeDevice)
|
||||||
if (defaultAudio is IBasicVolumeControls)
|
DefaultVolumeControls = (DefaultAudioDevice as IHasVolumeDevice).VolumeDevice;
|
||||||
DefaultVolumeControls = defaultAudio as IBasicVolumeControls;
|
|
||||||
else if (defaultAudio is IHasVolumeDevice)
|
|
||||||
DefaultVolumeControls = (defaultAudio as IHasVolumeDevice).VolumeDevice;
|
|
||||||
CurrentVolumeControls = DefaultVolumeControls;
|
CurrentVolumeControls = DefaultVolumeControls;
|
||||||
|
|
||||||
var disp = DefaultDisplay as DisplayBase;
|
var disp = DefaultDisplay as DisplayBase;
|
||||||
@@ -195,6 +207,15 @@ namespace PepperDash.Essentials
|
|||||||
EnablePowerOnToLastSource = true;
|
EnablePowerOnToLastSource = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void CustomSetConfig(DeviceConfig config)
|
||||||
|
{
|
||||||
|
var newPropertiesConfig = JsonConvert.DeserializeObject<EssentialsHuddleRoomPropertiesConfig>(config.Properties.ToString());
|
||||||
|
|
||||||
|
if (newPropertiesConfig != null)
|
||||||
|
PropertiesConfig = newPropertiesConfig;
|
||||||
|
|
||||||
|
ConfigWriter.UpdateRoomConfig(config);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
@@ -225,6 +246,21 @@ namespace PepperDash.Essentials
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override bool CustomActivate()
|
||||||
|
{
|
||||||
|
// Add Occupancy object from config
|
||||||
|
if (PropertiesConfig.Occupancy != null)
|
||||||
|
this.SetRoomOccupancy(DeviceManager.GetDeviceForKey(PropertiesConfig.Occupancy.DeviceKey) as
|
||||||
|
PepperDash.Essentials.Devices.Common.Occupancy.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);
|
||||||
|
|
||||||
|
return base.CustomActivate();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -7,6 +7,8 @@ using Crestron.SimplSharp.Scheduler;
|
|||||||
|
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core;
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.Core.Config;
|
||||||
|
using PepperDash.Essentials.Core.Devices;
|
||||||
using PepperDash.Essentials.Devices.Common.Occupancy;
|
using PepperDash.Essentials.Devices.Common.Occupancy;
|
||||||
|
|
||||||
namespace PepperDash.Essentials
|
namespace PepperDash.Essentials
|
||||||
@@ -14,7 +16,7 @@ namespace PepperDash.Essentials
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class EssentialsRoomBase : Device
|
public abstract class EssentialsRoomBase : ReconfigurableDevice
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
@@ -80,12 +82,9 @@ namespace PepperDash.Essentials
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool ZeroVolumeWhenSwtichingVolumeDevices { get; private set; }
|
public bool ZeroVolumeWhenSwtichingVolumeDevices { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
public EssentialsRoomBase(DeviceConfig config)
|
||||||
/// </summary>
|
: base(config)
|
||||||
/// <param name="key"></param>
|
|
||||||
/// <param name="name"></param>
|
|
||||||
public EssentialsRoomBase(string key, string name) : base(key, name)
|
|
||||||
{
|
{
|
||||||
// Setup the ShutdownPromptTimer
|
// Setup the ShutdownPromptTimer
|
||||||
ShutdownPromptTimer = new SecondsCountdownTimer(Key + "-offTimer");
|
ShutdownPromptTimer = new SecondsCountdownTimer(Key + "-offTimer");
|
||||||
@@ -169,8 +168,6 @@ namespace PepperDash.Essentials
|
|||||||
RoomVacancyShutdownTimer.SecondsToCount = RoomVacancyShutdownPromptSeconds;
|
RoomVacancyShutdownTimer.SecondsToCount = RoomVacancyShutdownPromptSeconds;
|
||||||
else if (mode == eVacancyMode.InInitialVacancy)
|
else if (mode == eVacancyMode.InInitialVacancy)
|
||||||
RoomVacancyShutdownTimer.SecondsToCount = RoomVacancyShutdownSeconds;
|
RoomVacancyShutdownTimer.SecondsToCount = RoomVacancyShutdownSeconds;
|
||||||
else if (mode == eVacancyMode.InShutdownWarning)
|
|
||||||
RoomVacancyShutdownTimer.SecondsToCount = 60;
|
|
||||||
VacancyMode = mode;
|
VacancyMode = mode;
|
||||||
RoomVacancyShutdownTimer.Start();
|
RoomVacancyShutdownTimer.Start();
|
||||||
|
|
||||||
@@ -203,7 +200,7 @@ namespace PepperDash.Essentials
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="statusProvider"></param>
|
/// <param name="statusProvider"></param>
|
||||||
public void SetRoomOccupancy(IOccupancyStatusProvider statusProvider, int timeoutMinutes)
|
public void SetRoomOccupancy(IOccupancyStatusProvider statusProvider, int timeoutMinutes)
|
||||||
{
|
{
|
||||||
if (statusProvider == null)
|
if (statusProvider == null)
|
||||||
{
|
{
|
||||||
Debug.Console(0, this, "ERROR: Occupancy sensor device is null");
|
Debug.Console(0, this, "ERROR: Occupancy sensor device is null");
|
||||||
|
|||||||
@@ -1,48 +0,0 @@
|
|||||||
namespace PepperDash.Essentials
|
|
||||||
{
|
|
||||||
public class CrestronTouchpanelPropertiesConfig
|
|
||||||
{
|
|
||||||
public string IpId { get; set; }
|
|
||||||
public string DefaultRoomKey { get; set; }
|
|
||||||
public string RoomListKey { get; set; }
|
|
||||||
public string SgdFile { get; set; }
|
|
||||||
public string ProjectName { get; set; }
|
|
||||||
public bool ShowVolumeGauge { get; set; }
|
|
||||||
public bool UsesSplashPage { get; set; }
|
|
||||||
public bool ShowDate { get; set; }
|
|
||||||
public bool ShowTime { get; set; }
|
|
||||||
public UiSetupPropertiesConfig Setup { get; set; }
|
|
||||||
public string HeaderStyle { get; set; }
|
|
||||||
public bool IncludeInFusionRoomHealth { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The count of sources that will trigger the "additional" arrows to show on the SRL.
|
|
||||||
/// Defaults to 5
|
|
||||||
/// </summary>
|
|
||||||
public int SourcesOverflowCount { get; set; }
|
|
||||||
|
|
||||||
public CrestronTouchpanelPropertiesConfig()
|
|
||||||
{
|
|
||||||
SourcesOverflowCount = 5;
|
|
||||||
HeaderStyle = CrestronTouchpanelPropertiesConfig.Habanero;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// "habanero"
|
|
||||||
/// </summary>
|
|
||||||
public const string Habanero = "habanero";
|
|
||||||
/// <summary>
|
|
||||||
/// "verbose"
|
|
||||||
/// </summary>
|
|
||||||
public const string Verbose = "verbose";
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public class UiSetupPropertiesConfig
|
|
||||||
{
|
|
||||||
public bool IsVisible { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -27,9 +27,17 @@ namespace PepperDash.Essentials
|
|||||||
{
|
{
|
||||||
Panel = tsw;
|
Panel = tsw;
|
||||||
tsw.LoadSmartObjects(sgdPath);
|
tsw.LoadSmartObjects(sgdPath);
|
||||||
tsw.SigChange += new Crestron.SimplSharpPro.DeviceSupport.SigEventHandler(Tsw_SigChange);
|
tsw.SigChange += Panel_SigChange;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public EssentialsTouchpanelController(string key, string name, Dge100 panel, string projectName, string sgdPath)
|
||||||
|
: base(key, name)
|
||||||
|
{
|
||||||
|
Panel = panel;
|
||||||
|
panel.LoadSmartObjects(sgdPath);
|
||||||
|
panel.SigChange += Panel_SigChange;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Config constructor
|
/// Config constructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -102,7 +110,7 @@ namespace PepperDash.Essentials
|
|||||||
}
|
}
|
||||||
|
|
||||||
Panel.LoadSmartObjects(sgdName);
|
Panel.LoadSmartObjects(sgdName);
|
||||||
Panel.SigChange += Tsw_SigChange;
|
Panel.SigChange += Panel_SigChange;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,7 +166,7 @@ namespace PepperDash.Essentials
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tsw_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args)
|
void Panel_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args)
|
||||||
{
|
{
|
||||||
if (Debug.Level == 2)
|
if (Debug.Level == 2)
|
||||||
Debug.Console(2, this, "Sig change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
|
Debug.Console(2, this, "Sig change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ namespace PepperDash.Essentials
|
|||||||
avDriver.PopupInterlock.HideAndClear());
|
avDriver.PopupInterlock.HideAndClear());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetUpHelpButton(EssentialsRoomPropertiesConfig roomConf)
|
public void SetUpHelpButton(EssentialsRoomPropertiesConfig roomConf)
|
||||||
{
|
{
|
||||||
// Help roomConf and popup
|
// Help roomConf and popup
|
||||||
if (roomConf.Help != null)
|
if (roomConf.Help != null)
|
||||||
@@ -107,7 +107,7 @@ namespace PepperDash.Essentials
|
|||||||
var room = DeviceManager.GetDeviceForKey(Config.DefaultRoomKey)
|
var room = DeviceManager.GetDeviceForKey(Config.DefaultRoomKey)
|
||||||
as EssentialsHuddleSpaceRoom;
|
as EssentialsHuddleSpaceRoom;
|
||||||
if (room != null)
|
if (room != null)
|
||||||
message = room.Config.HelpMessage;
|
message = room.PropertiesConfig.HelpMessage;
|
||||||
else
|
else
|
||||||
message = "Sorry, no help message available. No room connected.";
|
message = "Sorry, no help message available. No room connected.";
|
||||||
//TriList.StringInput[UIStringJoin.HelpMessage].StringValue = message;
|
//TriList.StringInput[UIStringJoin.HelpMessage].StringValue = message;
|
||||||
@@ -227,7 +227,7 @@ namespace PepperDash.Essentials
|
|||||||
|
|
||||||
TriList.SetBool(UIBoolJoin.TopBarHabaneroDynamicVisible, true);
|
TriList.SetBool(UIBoolJoin.TopBarHabaneroDynamicVisible, true);
|
||||||
|
|
||||||
var roomConf = currentRoom.Config;
|
var roomConf = currentRoom.PropertiesConfig;
|
||||||
|
|
||||||
// Register for the PopupInterlock IsShowsFeedback event to tie the header carets subpage visiblity to it
|
// Register for the PopupInterlock IsShowsFeedback event to tie the header carets subpage visiblity to it
|
||||||
Parent.AvDriver.PopupInterlock.StatusChanged -= PopupInterlock_StatusChanged;
|
Parent.AvDriver.PopupInterlock.StatusChanged -= PopupInterlock_StatusChanged;
|
||||||
@@ -289,7 +289,7 @@ namespace PepperDash.Essentials
|
|||||||
|
|
||||||
TriList.SetBool(UIBoolJoin.TopBarHabaneroDynamicVisible, true);
|
TriList.SetBool(UIBoolJoin.TopBarHabaneroDynamicVisible, true);
|
||||||
|
|
||||||
var roomConf = currentRoom.Config;
|
var roomConf = currentRoom.PropertiesConfig;
|
||||||
|
|
||||||
// Register for the PopupInterlock IsShowsFeedback event to tie the header carets subpage visiblity to it
|
// Register for the PopupInterlock IsShowsFeedback event to tie the header carets subpage visiblity to it
|
||||||
Parent.AvDriver.PopupInterlock.StatusChanged -= PopupInterlock_StatusChanged;
|
Parent.AvDriver.PopupInterlock.StatusChanged -= PopupInterlock_StatusChanged;
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -58,16 +58,7 @@ namespace PepperDash.Essentials.UIDrivers.VC
|
|||||||
SmartObjectDynamicList RecentCallsList;
|
SmartObjectDynamicList RecentCallsList;
|
||||||
|
|
||||||
SmartObjectDynamicList DirectoryList;
|
SmartObjectDynamicList DirectoryList;
|
||||||
|
|
||||||
CodecDirectory CurrentDirectoryResult;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Tracks the directory browse history when browsing beyond the root directory
|
|
||||||
/// </summary>
|
|
||||||
List<CodecDirectory> DirectoryBrowseHistory;
|
|
||||||
|
|
||||||
bool NextDirectoryResultIsFolderContents;
|
|
||||||
|
|
||||||
BoolFeedback DirectoryBackButtonVisibleFeedback;
|
BoolFeedback DirectoryBackButtonVisibleFeedback;
|
||||||
|
|
||||||
// These are likely temp until we get a keyboard built
|
// These are likely temp until we get a keyboard built
|
||||||
@@ -111,7 +102,6 @@ namespace PepperDash.Essentials.UIDrivers.VC
|
|||||||
SetupCallStagingPopover();
|
SetupCallStagingPopover();
|
||||||
SetupDialKeypad();
|
SetupDialKeypad();
|
||||||
ActiveCallsSRL = new SubpageReferenceList(triList, UISmartObjectJoin.CodecActiveCallsHeaderList, 5,5,5);
|
ActiveCallsSRL = new SubpageReferenceList(triList, UISmartObjectJoin.CodecActiveCallsHeaderList, 5,5,5);
|
||||||
SetupDirectoryList();
|
|
||||||
SetupRecentCallsList();
|
SetupRecentCallsList();
|
||||||
SetupFavorites();
|
SetupFavorites();
|
||||||
SetupLayoutControls();
|
SetupLayoutControls();
|
||||||
@@ -169,12 +159,14 @@ namespace PepperDash.Essentials.UIDrivers.VC
|
|||||||
});
|
});
|
||||||
SearchStringFeedback.LinkInputSig(triList.StringInput[UIStringJoin.CodecDirectorySearchEntryText]);
|
SearchStringFeedback.LinkInputSig(triList.StringInput[UIStringJoin.CodecDirectorySearchEntryText]);
|
||||||
|
|
||||||
|
SetupDirectoryList();
|
||||||
|
|
||||||
SearchStringBackspaceVisibleFeedback = new BoolFeedback(() => SearchStringBuilder.Length > 0);
|
SearchStringBackspaceVisibleFeedback = new BoolFeedback(() => SearchStringBuilder.Length > 0);
|
||||||
SearchStringBackspaceVisibleFeedback.LinkInputSig(triList.BooleanInput[UIBoolJoin.VCDirectoryBackspaceVisible]);
|
SearchStringBackspaceVisibleFeedback.LinkInputSig(triList.BooleanInput[UIBoolJoin.VCDirectoryBackspaceVisible]);
|
||||||
|
|
||||||
triList.SetSigFalseAction(UIBoolJoin.VCDirectoryBackPress, GetDirectoryParentFolderContents);
|
triList.SetSigFalseAction(UIBoolJoin.VCDirectoryBackPress, GetDirectoryParentFolderContents);
|
||||||
|
|
||||||
DirectoryBackButtonVisibleFeedback = new BoolFeedback(() => CurrentDirectoryResult != (codec as IHasDirectory).DirectoryRoot);
|
DirectoryBackButtonVisibleFeedback = (codec as IHasDirectory).CurrentDirectoryResultIsNotDirectoryRoot;
|
||||||
DirectoryBackButtonVisibleFeedback
|
DirectoryBackButtonVisibleFeedback
|
||||||
.LinkInputSig(triList.BooleanInput[UIBoolJoin.VCDirectoryBackVisible]);
|
.LinkInputSig(triList.BooleanInput[UIBoolJoin.VCDirectoryBackVisible]);
|
||||||
|
|
||||||
@@ -484,9 +476,9 @@ namespace PepperDash.Essentials.UIDrivers.VC
|
|||||||
TriList.SetString(timeTextOffset + i, timeText);
|
TriList.SetString(timeTextOffset + i, timeText);
|
||||||
|
|
||||||
string iconName = null;
|
string iconName = null;
|
||||||
if (c.OccurenceType == eCodecOccurrenceType.Received)
|
if (c.OccurrenceType == eCodecOccurrenceType.Received)
|
||||||
iconName = "Misc-18_Light";
|
iconName = "Misc-18_Light";
|
||||||
else if (c.OccurenceType == eCodecOccurrenceType.Placed)
|
else if (c.OccurrenceType == eCodecOccurrenceType.Placed)
|
||||||
iconName = "Misc-17_Light";
|
iconName = "Misc-17_Light";
|
||||||
else
|
else
|
||||||
iconName = "Delete";
|
iconName = "Delete";
|
||||||
@@ -532,8 +524,6 @@ namespace PepperDash.Essentials.UIDrivers.VC
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
void SetupDirectoryList()
|
void SetupDirectoryList()
|
||||||
{
|
{
|
||||||
DirectoryBrowseHistory = new List<CodecDirectory>();
|
|
||||||
|
|
||||||
var codec = Codec as IHasDirectory;
|
var codec = Codec as IHasDirectory;
|
||||||
if (codec != null)
|
if (codec != null)
|
||||||
{
|
{
|
||||||
@@ -548,28 +538,20 @@ namespace PepperDash.Essentials.UIDrivers.VC
|
|||||||
codec.PhonebookSyncState.InitialSyncCompleted += new EventHandler<EventArgs>(PhonebookSyncState_InitialSyncCompleted);
|
codec.PhonebookSyncState.InitialSyncCompleted += new EventHandler<EventArgs>(PhonebookSyncState_InitialSyncCompleted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RefreshDirectory();
|
||||||
// If there is something here now, show it otherwise wait for the event
|
|
||||||
if (CurrentDirectoryResult != null && codec.DirectoryRoot.DirectoryResults.Count > 0)
|
|
||||||
{
|
|
||||||
RefreshDirectory();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets the current directory resutls to the DirectorRoot and updates Back Button visibiltiy
|
/// Sets the current directory results to the DirectoryRoot and updates Back Button visibiltiy
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void SetCurrentDirectoryToRoot()
|
void SetCurrentDirectoryToRoot()
|
||||||
{
|
{
|
||||||
DirectoryBrowseHistory.Clear();
|
(Codec as IHasDirectory).SetCurrentDirectoryToRoot();
|
||||||
|
|
||||||
CurrentDirectoryResult = (Codec as IHasDirectory).DirectoryRoot;
|
|
||||||
|
|
||||||
SearchKeypadClear();
|
SearchKeypadClear();
|
||||||
|
|
||||||
DirectoryBackButtonVisibleFeedback.FireUpdate();
|
|
||||||
|
|
||||||
RefreshDirectory();
|
RefreshDirectory();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -584,10 +566,8 @@ namespace PepperDash.Essentials.UIDrivers.VC
|
|||||||
|
|
||||||
SetCurrentDirectoryToRoot();
|
SetCurrentDirectoryToRoot();
|
||||||
|
|
||||||
if (CurrentDirectoryResult != null && codec.DirectoryRoot.DirectoryResults.Count > 0)
|
RefreshDirectory();
|
||||||
{
|
|
||||||
RefreshDirectory();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -597,13 +577,7 @@ namespace PepperDash.Essentials.UIDrivers.VC
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
void dir_DirectoryResultReturned(object sender, DirectoryEventArgs e)
|
void dir_DirectoryResultReturned(object sender, DirectoryEventArgs e)
|
||||||
{
|
{
|
||||||
if (NextDirectoryResultIsFolderContents)
|
|
||||||
{
|
|
||||||
NextDirectoryResultIsFolderContents = false;
|
|
||||||
DirectoryBrowseHistory.Add(e.Directory);
|
|
||||||
}
|
|
||||||
CurrentDirectoryResult = e.Directory;
|
|
||||||
DirectoryBackButtonVisibleFeedback.FireUpdate();
|
|
||||||
RefreshDirectory();
|
RefreshDirectory();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -615,7 +589,6 @@ namespace PepperDash.Essentials.UIDrivers.VC
|
|||||||
{
|
{
|
||||||
(Codec as IHasDirectory).GetDirectoryFolderContents(folder.FolderId);
|
(Codec as IHasDirectory).GetDirectoryFolderContents(folder.FolderId);
|
||||||
|
|
||||||
NextDirectoryResultIsFolderContents = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -625,18 +598,13 @@ namespace PepperDash.Essentials.UIDrivers.VC
|
|||||||
{
|
{
|
||||||
var codec = Codec as IHasDirectory;
|
var codec = Codec as IHasDirectory;
|
||||||
|
|
||||||
if (DirectoryBrowseHistory.Count > 0)
|
if (codec != null)
|
||||||
{
|
{
|
||||||
var lastItemIndex = DirectoryBrowseHistory.Count - 1;
|
codec.GetDirectoryParentFolderContents();
|
||||||
CurrentDirectoryResult = DirectoryBrowseHistory[lastItemIndex];
|
|
||||||
DirectoryBrowseHistory.Remove(DirectoryBrowseHistory[lastItemIndex]);
|
|
||||||
|
|
||||||
RefreshDirectory();
|
//RefreshDirectory();
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SetCurrentDirectoryToRoot();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -645,10 +613,10 @@ namespace PepperDash.Essentials.UIDrivers.VC
|
|||||||
/// <param name="dir"></param>
|
/// <param name="dir"></param>
|
||||||
void RefreshDirectory()
|
void RefreshDirectory()
|
||||||
{
|
{
|
||||||
if (CurrentDirectoryResult.DirectoryResults.Count > 0)
|
if ((Codec as IHasDirectory).CurrentDirectoryResult.CurrentDirectoryResults.Count > 0)
|
||||||
{
|
{
|
||||||
ushort i = 0;
|
ushort i = 0;
|
||||||
foreach (var r in CurrentDirectoryResult.DirectoryResults)
|
foreach (var r in (Codec as IHasDirectory).CurrentDirectoryResult.CurrentDirectoryResults)
|
||||||
{
|
{
|
||||||
if (i == DirectoryList.MaxCount)
|
if (i == DirectoryList.MaxCount)
|
||||||
{
|
{
|
||||||
@@ -725,13 +693,13 @@ namespace PepperDash.Essentials.UIDrivers.VC
|
|||||||
Parent.MeetingOrContactMethodModalSrl.StringInputSig(i, 4).StringValue = "";
|
Parent.MeetingOrContactMethodModalSrl.StringInputSig(i, 4).StringValue = "";
|
||||||
Parent.MeetingOrContactMethodModalSrl.StringInputSig(i, 5).StringValue = "Connect";
|
Parent.MeetingOrContactMethodModalSrl.StringInputSig(i, 5).StringValue = "Connect";
|
||||||
Parent.MeetingOrContactMethodModalSrl.BoolInputSig(i, 2).BoolValue = true;
|
Parent.MeetingOrContactMethodModalSrl.BoolInputSig(i, 2).BoolValue = true;
|
||||||
var cc = c; // lambda scope
|
var cc = c; // to maintian lambda scope
|
||||||
Parent.MeetingOrContactMethodModalSrl.GetBoolFeedbackSig(i, 1).SetSigFalseAction(() =>
|
Parent.MeetingOrContactMethodModalSrl.GetBoolFeedbackSig(i, 1).SetSigFalseAction(() =>
|
||||||
{
|
{
|
||||||
Parent.PopupInterlock.Hide();
|
Parent.PopupInterlock.Hide();
|
||||||
var codec = Codec as VideoCodecBase;
|
var codec = Codec as VideoCodecBase;
|
||||||
if (codec != null)
|
if (codec != null)
|
||||||
codec.Dial(c.Number);
|
codec.Dial(cc.Number);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
Parent.MeetingOrContactMethodModalSrl.Count = i;
|
Parent.MeetingOrContactMethodModalSrl.Count = i;
|
||||||
@@ -744,10 +712,10 @@ namespace PepperDash.Essentials.UIDrivers.VC
|
|||||||
void SetupLayoutControls()
|
void SetupLayoutControls()
|
||||||
{
|
{
|
||||||
TriList.SetSigFalseAction(UIBoolJoin.VCStagingSelfViewLayoutPress, this.ShowSelfViewLayout);
|
TriList.SetSigFalseAction(UIBoolJoin.VCStagingSelfViewLayoutPress, this.ShowSelfViewLayout);
|
||||||
var svc = Codec as IHasCodecSelfview;
|
var svc = Codec as IHasCodecSelfView;
|
||||||
if (svc != null)
|
if (svc != null)
|
||||||
{
|
{
|
||||||
TriList.SetSigFalseAction(UIBoolJoin.VCSelfViewTogglePress, svc.SelfviewModeToggle);
|
TriList.SetSigFalseAction(UIBoolJoin.VCSelfViewTogglePress, svc.SelfViewModeToggle);
|
||||||
svc.SelfviewIsOnFeedback.LinkInputSig(TriList.BooleanInput[UIBoolJoin.VCSelfViewTogglePress]);
|
svc.SelfviewIsOnFeedback.LinkInputSig(TriList.BooleanInput[UIBoolJoin.VCSelfViewTogglePress]);
|
||||||
}
|
}
|
||||||
var lc = Codec as IHasCodecLayouts;
|
var lc = Codec as IHasCodecLayouts;
|
||||||
@@ -1102,7 +1070,7 @@ namespace PepperDash.Essentials.UIDrivers.VC
|
|||||||
SearchStringFeedback.FireUpdate();
|
SearchStringFeedback.FireUpdate();
|
||||||
SearchStringKeypadCheckEnables();
|
SearchStringKeypadCheckEnables();
|
||||||
|
|
||||||
if(CurrentDirectoryResult != (Codec as IHasDirectory).DirectoryRoot)
|
if ((Codec as IHasDirectory).CurrentDirectoryResultIsNotDirectoryRoot.BoolValue)
|
||||||
SetCurrentDirectoryToRoot();
|
SetCurrentDirectoryToRoot();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
13
README.md
Normal file
13
README.md
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
# Pepperdash Essentials
|
||||||
|
|
||||||
|
## RELEASE PROCESS CONTROLLED BY JENKINS CI PROCESS
|
||||||
|
|
||||||
|
#### How to merge
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
- Make changes
|
||||||
|
- Build
|
||||||
|
- Test on your system
|
||||||
|
- Commit and push to essentials
|
||||||
|
- Curse a whole lot when you try to figure out how to then get developments all synced up
|
||||||
Binary file not shown.
Binary file not shown.
@@ -30,4 +30,14 @@ devjson:1 {"deviceKey":"room1.InCallFeedback","methodName":"SetTestValue", "para
|
|||||||
|
|
||||||
devjson:1 {"deviceKey":"room1.InCallFeedback","methodName":"ClearTestValue", "params": []}
|
devjson:1 {"deviceKey":"room1.InCallFeedback","methodName":"ClearTestValue", "params": []}
|
||||||
|
|
||||||
devjson:3 {"deviceKey":"room1.RoomOccupancy.RoomIsOccupiedFeedback","methodName":"SetTestValue", "params": [ true ]}
|
devjson:3 {"deviceKey":"room1.RoomOccupancy.RoomIsOccupiedFeedback","methodName":"SetTestValue", "params": [ true ]}
|
||||||
|
|
||||||
|
devjson:2 {"deviceKey":"codec-comms-ssh", "methodName":"SendText", "params": ["xcommand dial number: 10.11.50.211\r"]}
|
||||||
|
|
||||||
|
devjson:2 {"deviceKey":"codec-comms-ssh", "methodName":"Connect", "params": []}
|
||||||
|
|
||||||
|
devjson:1 {"deviceKey":"commBridge", "methodName":"ExecuteJoinAction", "params":[ 301, "digital", true ]}
|
||||||
|
|
||||||
|
devjson:2 {"deviceKey":"display01Comm-com", "methodName":"SendText", "params": [ "I'M GETTING TIRED OF THIS" ]}
|
||||||
|
|
||||||
|
devjson:10 {"deviceKey":"dmLink-ssh", "methodName":"Connect", "params": []}
|
||||||
Submodule essentials-framework deleted from 1587cee74f
@@ -0,0 +1,20 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||||
|
# Visual Studio 2008
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PepperDash_Essentials_Core", "PepperDashEssentialsBase\PepperDash_Essentials_Core.csproj", "{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
@@ -0,0 +1,100 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Crestron.SimplSharpPro;
|
||||||
|
using Crestron.SimplSharpPro.DM;
|
||||||
|
|
||||||
|
using PepperDash.Core;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core
|
||||||
|
{
|
||||||
|
public class CecPortController : Device, IBasicCommunication
|
||||||
|
{
|
||||||
|
public event EventHandler<GenericCommMethodReceiveBytesArgs> BytesReceived;
|
||||||
|
public event EventHandler<GenericCommMethodReceiveTextArgs> TextReceived;
|
||||||
|
|
||||||
|
public bool IsConnected { get { return true; } }
|
||||||
|
|
||||||
|
ICec Port;
|
||||||
|
|
||||||
|
public CecPortController(string key, ICec port)
|
||||||
|
: base(key)
|
||||||
|
{
|
||||||
|
Port = port;
|
||||||
|
|
||||||
|
Port.StreamCec.CecChange += new CecChangeEventHandler(StreamCec_CecChange);
|
||||||
|
}
|
||||||
|
|
||||||
|
void StreamCec_CecChange(Cec cecDevice, CecEventArgs args)
|
||||||
|
{
|
||||||
|
if (args.EventId == CecEventIds.CecMessageReceivedEventId)
|
||||||
|
OnDataReceived(cecDevice.Received.StringValue);
|
||||||
|
else if (args.EventId == CecEventIds.ErrorFeedbackEventId)
|
||||||
|
if(cecDevice.ErrorFeedback.BoolValue)
|
||||||
|
Debug.Console(2, this, "CEC NAK Error");
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnDataReceived(string s)
|
||||||
|
{
|
||||||
|
var bytesHandler = BytesReceived;
|
||||||
|
if (bytesHandler != null)
|
||||||
|
{
|
||||||
|
var bytes = Encoding.GetEncoding(28591).GetBytes(s);
|
||||||
|
bytesHandler(this, new GenericCommMethodReceiveBytesArgs(bytes));
|
||||||
|
}
|
||||||
|
var textHandler = TextReceived;
|
||||||
|
if (textHandler != null)
|
||||||
|
textHandler(this, new GenericCommMethodReceiveTextArgs(s));
|
||||||
|
}
|
||||||
|
|
||||||
|
#region IBasicCommunication Members
|
||||||
|
|
||||||
|
public void SendText(string text)
|
||||||
|
{
|
||||||
|
if (Port == null)
|
||||||
|
return;
|
||||||
|
Port.StreamCec.Send.StringValue = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SendBytes(byte[] bytes)
|
||||||
|
{
|
||||||
|
if (Port == null)
|
||||||
|
return;
|
||||||
|
var text = Encoding.GetEncoding(28591).GetString(bytes, 0, bytes.Length);
|
||||||
|
Port.StreamCec.Send.StringValue = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Connect()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Disconnect()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="s"></param>
|
||||||
|
public void SimulateReceive(string s)
|
||||||
|
{
|
||||||
|
// split out hex chars and build string
|
||||||
|
var split = Regex.Split(s, @"(\\[Xx][0-9a-fA-F][0-9a-fA-F])");
|
||||||
|
StringBuilder b = new StringBuilder();
|
||||||
|
foreach (var t in split)
|
||||||
|
{
|
||||||
|
if (t.StartsWith(@"\") && t.Length == 4)
|
||||||
|
b.Append((char)(Convert.ToByte(t.Substring(2, 2), 16)));
|
||||||
|
else
|
||||||
|
b.Append(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
OnDataReceived(b.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,132 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Crestron.SimplSharpPro;
|
||||||
|
|
||||||
|
using PepperDash.Core;
|
||||||
|
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core
|
||||||
|
{
|
||||||
|
public class ComPortController : Device, IBasicCommunication
|
||||||
|
{
|
||||||
|
public event EventHandler<GenericCommMethodReceiveBytesArgs> BytesReceived;
|
||||||
|
public event EventHandler<GenericCommMethodReceiveTextArgs> TextReceived;
|
||||||
|
|
||||||
|
public bool IsConnected { get { return true; } }
|
||||||
|
|
||||||
|
ComPort Port;
|
||||||
|
ComPort.ComPortSpec Spec;
|
||||||
|
|
||||||
|
public ComPortController(string key, ComPort port, ComPort.ComPortSpec spec)
|
||||||
|
: base(key)
|
||||||
|
{
|
||||||
|
if (port == null)
|
||||||
|
{
|
||||||
|
Debug.Console(0, this, "ERROR: Invalid com port, continuing but comms will not function");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Port = port;
|
||||||
|
Spec = spec;
|
||||||
|
//IsConnected = new BoolFeedback(CommonBoolCue.IsConnected, () => true);
|
||||||
|
|
||||||
|
if (Port.Parent is CrestronControlSystem)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
var result = Port.Register();
|
||||||
|
if (result != eDeviceRegistrationUnRegistrationResponse.Success)
|
||||||
|
{
|
||||||
|
Debug.Console(0, this, "ERROR: Cannot register Com port: {0}", result);
|
||||||
|
return; // false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var specResult = Port.SetComPortSpec(Spec);
|
||||||
|
if (specResult != 0)
|
||||||
|
{
|
||||||
|
Debug.Console(0, this, "WARNING: Cannot set comspec");
|
||||||
|
return; // false
|
||||||
|
}
|
||||||
|
Port.SerialDataReceived += new ComPortDataReceivedEvent(Port_SerialDataReceived);
|
||||||
|
}
|
||||||
|
|
||||||
|
~ComPortController()
|
||||||
|
{
|
||||||
|
Port.SerialDataReceived -= Port_SerialDataReceived;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Port_SerialDataReceived(ComPort ReceivingComPort, ComPortSerialDataEventArgs args)
|
||||||
|
{
|
||||||
|
OnDataReceived(args.SerialData);
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnDataReceived(string s)
|
||||||
|
{
|
||||||
|
var bytesHandler = BytesReceived;
|
||||||
|
if (bytesHandler != null)
|
||||||
|
{
|
||||||
|
var bytes = Encoding.GetEncoding(28591).GetBytes(s);
|
||||||
|
bytesHandler(this, new GenericCommMethodReceiveBytesArgs(bytes));
|
||||||
|
}
|
||||||
|
var textHandler = TextReceived;
|
||||||
|
if (textHandler != null)
|
||||||
|
textHandler(this, new GenericCommMethodReceiveTextArgs(s));
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool Deactivate()
|
||||||
|
{
|
||||||
|
return Port.UnRegister() == eDeviceRegistrationUnRegistrationResponse.Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region IBasicCommunication Members
|
||||||
|
|
||||||
|
public void SendText(string text)
|
||||||
|
{
|
||||||
|
if (Port == null)
|
||||||
|
return;
|
||||||
|
Port.Send(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SendBytes(byte[] bytes)
|
||||||
|
{
|
||||||
|
if (Port == null)
|
||||||
|
return;
|
||||||
|
var text = Encoding.GetEncoding(28591).GetString(bytes, 0, bytes.Length);
|
||||||
|
Port.Send(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Connect()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Disconnect()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="s"></param>
|
||||||
|
public void SimulateReceive(string s)
|
||||||
|
{
|
||||||
|
// split out hex chars and build string
|
||||||
|
var split = Regex.Split(s, @"(\\[Xx][0-9a-fA-F][0-9a-fA-F])");
|
||||||
|
StringBuilder b = new StringBuilder();
|
||||||
|
foreach (var t in split)
|
||||||
|
{
|
||||||
|
if (t.StartsWith(@"\") && t.Length == 4)
|
||||||
|
b.Append((char)(Convert.ToByte(t.Substring(2, 2), 16)));
|
||||||
|
else
|
||||||
|
b.Append(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
OnDataReceived(b.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,102 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Crestron.SimplSharpPro;
|
||||||
|
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
|
using PepperDash.Core;
|
||||||
|
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This converter creates a proper ComPort.ComPortSpec struct from more-friendly JSON values. It uses
|
||||||
|
/// ComSpecPropsJsonConverter to finish the individual properties.
|
||||||
|
/// </summary>
|
||||||
|
public class ComSpecJsonConverter : JsonConverter
|
||||||
|
{
|
||||||
|
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
|
||||||
|
{
|
||||||
|
if (objectType == typeof(ComPort.ComPortSpec))
|
||||||
|
{
|
||||||
|
var newSer = new JsonSerializer();
|
||||||
|
newSer.Converters.Add(new ComSpecPropsJsonConverter());
|
||||||
|
newSer.ObjectCreationHandling = ObjectCreationHandling.Replace;
|
||||||
|
return newSer.Deserialize<ComPort.ComPortSpec>(reader);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public override bool CanConvert(Type objectType)
|
||||||
|
{
|
||||||
|
return objectType == typeof(ComPort.ComPortSpec);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool CanRead { get { return true; } }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This converter will not be used for writing
|
||||||
|
/// </summary>
|
||||||
|
public override bool CanWrite { get { return false; } }
|
||||||
|
|
||||||
|
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The gist of this converter: The comspec JSON comes in with normal values that need to be converted
|
||||||
|
/// into enum names. This converter takes the value and applies the appropriate enum's name prefix to the value
|
||||||
|
/// and then returns the enum value using Enum.Parse. NOTE: Does not write
|
||||||
|
/// </summary>
|
||||||
|
public class ComSpecPropsJsonConverter : JsonConverter
|
||||||
|
{
|
||||||
|
public override bool CanConvert(Type objectType)
|
||||||
|
{
|
||||||
|
return objectType == typeof(ComPort.eComBaudRates)
|
||||||
|
|| objectType == typeof(ComPort.eComDataBits)
|
||||||
|
|| objectType == typeof(ComPort.eComParityType)
|
||||||
|
|| objectType == typeof(ComPort.eComHardwareHandshakeType)
|
||||||
|
|| objectType == typeof(ComPort.eComSoftwareHandshakeType)
|
||||||
|
|| objectType == typeof(ComPort.eComProtocolType)
|
||||||
|
|| objectType == typeof(ComPort.eComStopBits);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool CanRead { get { return true; } }
|
||||||
|
|
||||||
|
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
|
||||||
|
{
|
||||||
|
//Debug.Console(2, "ReadJson type: " + objectType.Name);
|
||||||
|
if (objectType == typeof(ComPort.eComBaudRates))
|
||||||
|
return Enum.Parse(typeof(ComPort.eComBaudRates), "ComspecBaudRate" + reader.Value, false);
|
||||||
|
else if (objectType == typeof(ComPort.eComDataBits))
|
||||||
|
return Enum.Parse(typeof(ComPort.eComDataBits), "ComspecDataBits" + reader.Value, true);
|
||||||
|
else if (objectType == typeof(ComPort.eComHardwareHandshakeType))
|
||||||
|
return Enum.Parse(typeof(ComPort.eComHardwareHandshakeType), "ComspecHardwareHandshake" + reader.Value, true);
|
||||||
|
else if (objectType == typeof(ComPort.eComParityType))
|
||||||
|
return Enum.Parse(typeof(ComPort.eComParityType), "ComspecParity" + reader.Value, true);
|
||||||
|
else if (objectType == typeof(ComPort.eComProtocolType))
|
||||||
|
return Enum.Parse(typeof(ComPort.eComProtocolType), "ComspecProtocol" + reader.Value, true);
|
||||||
|
else if (objectType == typeof(ComPort.eComSoftwareHandshakeType))
|
||||||
|
return Enum.Parse(typeof(ComPort.eComSoftwareHandshakeType), "ComspecSoftwareHandshake" + reader.Value, true);
|
||||||
|
else if (objectType == typeof(ComPort.eComStopBits))
|
||||||
|
return Enum.Parse(typeof(ComPort.eComStopBits), "ComspecStopBits" + reader.Value, true);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,196 @@
|
|||||||
|
using System;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Crestron.SimplSharpPro;
|
||||||
|
using Crestron.SimplSharpPro.DM;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core.Config;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public class CommFactory
|
||||||
|
{
|
||||||
|
public static EssentialsControlPropertiesConfig GetControlPropertiesConfig(DeviceConfig deviceConfig)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return JsonConvert.DeserializeObject<EssentialsControlPropertiesConfig>
|
||||||
|
(deviceConfig.Properties["control"].ToString());
|
||||||
|
//Debug.Console(2, "Control TEST: {0}", JsonConvert.SerializeObject(controlConfig));
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
|
||||||
|
Debug.Console(0, "ERROR: [{0}] Control properties deserialize failed:\r{1}", deviceConfig.Key, e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a comm method of either com port, TCP, SSH, and puts this into the DeviceManager
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="deviceConfig">The Device config object</param>
|
||||||
|
public static IBasicCommunication CreateCommForDevice(DeviceConfig deviceConfig)
|
||||||
|
{
|
||||||
|
EssentialsControlPropertiesConfig controlConfig = GetControlPropertiesConfig(deviceConfig);
|
||||||
|
if (controlConfig == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
IBasicCommunication comm = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var c = controlConfig.TcpSshProperties;
|
||||||
|
switch (controlConfig.Method)
|
||||||
|
{
|
||||||
|
case eControlMethod.Com:
|
||||||
|
comm = new ComPortController(deviceConfig.Key + "-com", GetComPort(controlConfig), controlConfig.ComParams);
|
||||||
|
break;
|
||||||
|
case eControlMethod.Cec:
|
||||||
|
comm = new CecPortController(deviceConfig.Key + "-cec", GetCecPort(controlConfig));
|
||||||
|
break;
|
||||||
|
case eControlMethod.IR:
|
||||||
|
break;
|
||||||
|
case eControlMethod.Ssh:
|
||||||
|
{
|
||||||
|
var ssh = new GenericSshClient(deviceConfig.Key + "-ssh", c.Address, c.Port, c.Username, c.Password);
|
||||||
|
ssh.AutoReconnect = c.AutoReconnect;
|
||||||
|
if(ssh.AutoReconnect)
|
||||||
|
ssh.AutoReconnectIntervalMs = c.AutoReconnectIntervalMs;
|
||||||
|
comm = ssh;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case eControlMethod.Tcpip:
|
||||||
|
{
|
||||||
|
var tcp = new GenericTcpIpClient(deviceConfig.Key + "-tcp", c.Address, c.Port, c.BufferSize);
|
||||||
|
tcp.AutoReconnect = c.AutoReconnect;
|
||||||
|
if (tcp.AutoReconnect)
|
||||||
|
tcp.AutoReconnectIntervalMs = c.AutoReconnectIntervalMs;
|
||||||
|
comm = tcp;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case eControlMethod.Udp:
|
||||||
|
{
|
||||||
|
var udp = new GenericUdpServer(deviceConfig.Key + "-udp", c.Address, c.Port, c.BufferSize);
|
||||||
|
comm = udp;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case eControlMethod.Telnet:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.Console(0, "Cannot create communication from JSON:\r{0}\r\rException:\r{1}",
|
||||||
|
deviceConfig.Properties.ToString(), e);
|
||||||
|
}
|
||||||
|
|
||||||
|
// put it in the device manager if it's the right flavor
|
||||||
|
var comDev = comm as Device;
|
||||||
|
if (comDev != null)
|
||||||
|
DeviceManager.AddDevice(comDev);
|
||||||
|
return comm;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ComPort GetComPort(EssentialsControlPropertiesConfig config)
|
||||||
|
{
|
||||||
|
var comPar = config.ComParams;
|
||||||
|
var dev = GetIComPortsDeviceFromManagedDevice(config.ControlPortDevKey);
|
||||||
|
if (dev != null && config.ControlPortNumber <= dev.NumberOfComPorts)
|
||||||
|
return dev.ComPorts[config.ControlPortNumber];
|
||||||
|
Debug.Console(0, "GetComPort: Device '{0}' does not have com port {1}", config.ControlPortDevKey, config.ControlPortNumber);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets an ICec port from a RoutingInput or RoutingOutput on a device
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="config"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static ICec GetCecPort(ControlPropertiesConfig config)
|
||||||
|
{
|
||||||
|
var dev = DeviceManager.GetDeviceForKey(config.ControlPortDevKey);
|
||||||
|
|
||||||
|
if (dev != null)
|
||||||
|
{
|
||||||
|
var inputPort = (dev as IRoutingInputsOutputs).InputPorts[config.ControlPortName];
|
||||||
|
|
||||||
|
if (inputPort != null)
|
||||||
|
if (inputPort.Port is ICec)
|
||||||
|
return inputPort.Port as ICec;
|
||||||
|
|
||||||
|
var outputPort = (dev as IRoutingInputsOutputs).OutputPorts[config.ControlPortName];
|
||||||
|
|
||||||
|
if (outputPort != null)
|
||||||
|
if (outputPort.Port is ICec)
|
||||||
|
return outputPort.Port as ICec;
|
||||||
|
}
|
||||||
|
Debug.Console(0, "GetCecPort: Device '{0}' does not have a CEC port called: '{1}'", config.ControlPortDevKey, config.ControlPortName);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Helper to grab the IComPorts device for this PortDeviceKey. Key "controlSystem" will
|
||||||
|
/// return the ControlSystem object from the Global class.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>IComPorts device or null if the device is not found or does not implement IComPorts</returns>
|
||||||
|
public static IComPorts GetIComPortsDeviceFromManagedDevice(string ComPortDevKey)
|
||||||
|
{
|
||||||
|
if ((ComPortDevKey.Equals("controlSystem", System.StringComparison.OrdinalIgnoreCase)
|
||||||
|
|| ComPortDevKey.Equals("processor", System.StringComparison.OrdinalIgnoreCase))
|
||||||
|
&& Global.ControlSystem is IComPorts)
|
||||||
|
return Global.ControlSystem;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var dev = DeviceManager.GetDeviceForKey(ComPortDevKey) as IComPorts;
|
||||||
|
if (dev == null)
|
||||||
|
Debug.Console(0, "ComPortConfig: Cannot find com port device '{0}'", ComPortDevKey);
|
||||||
|
return dev;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public class EssentialsControlPropertiesConfig :
|
||||||
|
PepperDash.Core.ControlPropertiesConfig
|
||||||
|
{
|
||||||
|
|
||||||
|
[JsonConverter(typeof(ComSpecJsonConverter))]
|
||||||
|
public ComPort.ComPortSpec ComParams { get; set; }
|
||||||
|
|
||||||
|
public string CresnetId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Attempts to provide uint conversion of string CresnetId
|
||||||
|
/// </summary>
|
||||||
|
public uint CresnetIdInt
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return Convert.ToUInt32(CresnetId, 16);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
throw new FormatException(string.Format("ERROR:Unable to convert Cresnet ID: {0} to hex. Error:\n{1}", CresnetId));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class IrControlSpec
|
||||||
|
{
|
||||||
|
public string PortDeviceKey { get; set; }
|
||||||
|
public uint PortNumber { get; set; }
|
||||||
|
public string File { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Crestron.SimplSharpPro;
|
||||||
|
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
|
using PepperDash.Core;
|
||||||
|
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public interface IComPortsDevice
|
||||||
|
{
|
||||||
|
IComPorts Device { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
|
||||||
|
using PepperDash.Core;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core
|
||||||
|
{
|
||||||
|
public class ConsoleCommMockDevice : Device, ICommunicationMonitor
|
||||||
|
{
|
||||||
|
public IBasicCommunication Communication { get; private set; }
|
||||||
|
public CommunicationGather PortGather { get; private set; }
|
||||||
|
public StatusMonitorBase CommunicationMonitor { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Defaults to \x0a
|
||||||
|
/// </summary>
|
||||||
|
public string LineEnding { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Set to true to show responses in full hex
|
||||||
|
/// </summary>
|
||||||
|
public bool ShowHexResponse { get; set; }
|
||||||
|
|
||||||
|
public ConsoleCommMockDevice(string key, string name, ConsoleCommMockDevicePropertiesConfig props, IBasicCommunication comm)
|
||||||
|
:base(key, name)
|
||||||
|
{
|
||||||
|
Communication = comm;
|
||||||
|
PortGather = new CommunicationGather(Communication, '\x0d');
|
||||||
|
PortGather.LineReceived += this.Port_LineReceived;
|
||||||
|
CommunicationMonitor = new GenericCommunicationMonitor(this, Communication, props.CommunicationMonitorProperties);
|
||||||
|
LineEnding = props.LineEnding;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool CustomActivate()
|
||||||
|
{
|
||||||
|
Communication.Connect();
|
||||||
|
CommunicationMonitor.StatusChange += (o, a) => { Debug.Console(2, this, "Communication monitor state: {0}", CommunicationMonitor.Status); };
|
||||||
|
CommunicationMonitor.Start();
|
||||||
|
|
||||||
|
CrestronConsole.AddNewConsoleCommand(SendLine, "send" + Key, "", ConsoleAccessLevelEnum.AccessOperator);
|
||||||
|
CrestronConsole.AddNewConsoleCommand(s => Communication.Connect(), "con" + Key, "", ConsoleAccessLevelEnum.AccessOperator);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Port_LineReceived(object dev, GenericCommMethodReceiveTextArgs args)
|
||||||
|
{
|
||||||
|
if (Debug.Level == 2)
|
||||||
|
Debug.Console(2, this, "RX: '{0}'",
|
||||||
|
ShowHexResponse ? ComTextHelper.GetEscapedText(args.Text) : args.Text);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SendLine(string s)
|
||||||
|
{
|
||||||
|
//if (Debug.Level == 2)
|
||||||
|
// Debug.Console(2, this, " Send '{0}'", ComTextHelper.GetEscapedText(s));
|
||||||
|
Communication.SendText(s + LineEnding);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ConsoleCommMockDevicePropertiesConfig
|
||||||
|
{
|
||||||
|
public string LineEnding { get; set; }
|
||||||
|
public CommunicationMonitorConfig CommunicationMonitorProperties { get; set; }
|
||||||
|
|
||||||
|
public ConsoleCommMockDevicePropertiesConfig()
|
||||||
|
{
|
||||||
|
LineEnding = "\x0a";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,105 @@
|
|||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
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.Devices;
|
||||||
|
using PepperDash.Essentials.Core.Config;
|
||||||
|
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Serves as a generic wrapper class for all styles of IBasicCommuncation ports
|
||||||
|
/// </summary>
|
||||||
|
public class
|
||||||
|
GenericComm : ReconfigurableDevice
|
||||||
|
{
|
||||||
|
EssentialsControlPropertiesConfig PropertiesConfig;
|
||||||
|
|
||||||
|
public IBasicCommunication CommPort { get; private set; }
|
||||||
|
|
||||||
|
public GenericComm(DeviceConfig config)
|
||||||
|
: base(config)
|
||||||
|
{
|
||||||
|
PropertiesConfig = CommFactory.GetControlPropertiesConfig(config);
|
||||||
|
|
||||||
|
CommPort = CommFactory.CreateCommForDevice(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetPortConfig(string portConfig)
|
||||||
|
{
|
||||||
|
// TODO: Deserialize new EssentialsControlPropertiesConfig and handle as necessary
|
||||||
|
try
|
||||||
|
{
|
||||||
|
PropertiesConfig = JsonConvert.DeserializeObject<EssentialsControlPropertiesConfig>
|
||||||
|
(portConfig.ToString());
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.Console(2, this, "Error deserializing port config: {0}", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void CustomSetConfig(DeviceConfig config)
|
||||||
|
{
|
||||||
|
PropertiesConfig = CommFactory.GetControlPropertiesConfig(config);
|
||||||
|
|
||||||
|
ConfigWriter.UpdateDeviceConfig(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,160 @@
|
|||||||
|
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 = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
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;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core.Config
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Override this and splice on specific room type behavior, as well as other properties
|
||||||
|
/// </summary>
|
||||||
|
public class BasicConfig
|
||||||
|
{
|
||||||
|
[JsonProperty("info")]
|
||||||
|
public InfoConfig Info { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("devices")]
|
||||||
|
public List<DeviceConfig> Devices { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("sourceLists")]
|
||||||
|
public Dictionary<string, Dictionary<string, SourceListItem>> SourceLists { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("tieLines")]
|
||||||
|
public List<TieLineConfig> TieLines { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("joinMaps")]
|
||||||
|
public Dictionary<string, string> JoinMaps { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Checks SourceLists for a given list and returns it if found. Otherwise, returns null
|
||||||
|
/// </summary>
|
||||||
|
public Dictionary<string, SourceListItem> GetSourceListForKey(string key)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(key) || !SourceLists.ContainsKey(key))
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return SourceLists[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user