mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-01-11 19:44:52 +00:00
Compare commits
203 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8a9a8ac6a7 | ||
|
|
b1742675c2 | ||
|
|
f564a2f554 | ||
|
|
0ede2e9973 | ||
|
|
5f5c963fa4 | ||
|
|
3d7fb1a804 | ||
|
|
dc36386c0d | ||
|
|
88a60b06e6 | ||
|
|
7273646be0 | ||
|
|
61883e5d4a | ||
|
|
90c12a97fa | ||
|
|
17fd9488f2 | ||
|
|
84262c782d | ||
|
|
8dbb3fd898 | ||
|
|
01d462d553 | ||
|
|
1d8924bc48 | ||
|
|
0ac439be14 | ||
|
|
23fb8311fe | ||
|
|
65adc5de1c | ||
|
|
13a8876a61 | ||
|
|
3897a41dd1 | ||
|
|
8c47c5ed65 | ||
|
|
3e39210cc0 | ||
|
|
2e98e8d146 | ||
|
|
1aea817f93 | ||
|
|
897d568032 | ||
|
|
a16ea3f034 | ||
|
|
c959f20204 | ||
|
|
8dfa05293c | ||
|
|
4685850eff | ||
|
|
dc53b293f1 | ||
|
|
1d9490c46f | ||
|
|
b301df6910 | ||
|
|
50a6bde4f2 | ||
|
|
dd5253301b | ||
|
|
b423d1cb58 | ||
|
|
91cc452e03 | ||
|
|
07168f0f5b | ||
|
|
08e528220c | ||
|
|
f5626fcd8b | ||
|
|
6482bbe6f4 | ||
|
|
b9fceb830f | ||
|
|
f37d1e18b2 | ||
|
|
bff6d9e68d | ||
|
|
41b42dbc8f | ||
|
|
fb0a91b454 | ||
|
|
2def648596 | ||
|
|
dc04e04f96 | ||
|
|
6f5d74a44e | ||
|
|
ce4f3dfff1 | ||
|
|
cae86d1943 | ||
|
|
0196997a4e | ||
|
|
f9d320e2b2 | ||
|
|
af33aa41bf | ||
|
|
f682793bbb | ||
|
|
3c3fca7766 | ||
|
|
4efc4d4e6e | ||
|
|
d52c629085 | ||
|
|
3e923ff41f | ||
|
|
54f23eeb9f | ||
|
|
c3c7948990 | ||
|
|
c7cfcbe69e | ||
|
|
01a9503f47 | ||
|
|
e6eafdaf14 | ||
|
|
c53a14f05e | ||
|
|
db4b5e863b | ||
|
|
b929113ea6 | ||
|
|
183112987e | ||
|
|
6bbd11c59b | ||
|
|
1274c74807 | ||
|
|
412dca0459 | ||
|
|
ae2725f6d1 | ||
|
|
6b9b6bbd68 | ||
|
|
a8e5e2f763 | ||
|
|
bdde968c61 | ||
|
|
5d2022549d | ||
|
|
3e6f345b8b | ||
|
|
bde56a22d1 | ||
|
|
0bcb776ac5 | ||
|
|
0f41f3ce50 | ||
|
|
46cce6559c | ||
|
|
b57582feea | ||
|
|
13d15388f0 | ||
|
|
58d22abd5a | ||
|
|
214a740345 | ||
|
|
a5eb61ef0e | ||
|
|
12683551a4 | ||
|
|
68427af337 | ||
|
|
33ceff861f | ||
|
|
a2d42dc77b | ||
|
|
1abf56474e | ||
|
|
a262dfdf5b | ||
|
|
26907acb56 | ||
|
|
0ee35dfbd9 | ||
|
|
a71e991383 | ||
|
|
1c63e506b8 | ||
|
|
f498d55dd6 | ||
|
|
1d46f8520d | ||
|
|
3b3ea98dea | ||
|
|
75ff8ea88a | ||
|
|
69e76bdb3a | ||
|
|
639e1810db | ||
|
|
ff5fab4984 | ||
|
|
ca3f6d4d14 | ||
|
|
c045c8e7a6 | ||
|
|
82465e8789 | ||
|
|
c0d3c92495 | ||
|
|
5c6ba60d51 | ||
|
|
f13978368f | ||
|
|
3d811c6979 | ||
|
|
a6f0163264 | ||
|
|
b33273e6d3 | ||
|
|
fed06bc025 | ||
|
|
cc6e555f25 | ||
|
|
b0fd837cdc | ||
|
|
95a6f3948f | ||
|
|
8df353ab75 | ||
|
|
535fce5f33 | ||
|
|
b588a8c325 | ||
|
|
253095cb93 | ||
|
|
9b85456f2e | ||
|
|
f6a9ecca03 | ||
|
|
2028fa308a | ||
|
|
a63e8b394f | ||
|
|
16e1185fdf | ||
|
|
9e4f34acd5 | ||
|
|
dc3cc1d4eb | ||
|
|
e8a9282180 | ||
|
|
58ed6b450f | ||
|
|
741d6a4a87 | ||
|
|
d2680298ff | ||
|
|
1ad1c5404f | ||
|
|
a9424cde22 | ||
|
|
9b145d6dfc | ||
|
|
b6965fac0b | ||
|
|
57dee6153b | ||
|
|
d65ff7add0 | ||
|
|
849675c539 | ||
|
|
fd14eeb9a7 | ||
|
|
2196f5e67a | ||
|
|
830093da3b | ||
|
|
fb70dac224 | ||
|
|
2180521004 | ||
|
|
682c21f37c | ||
|
|
b81c667e5f | ||
|
|
4b4bf1a1c8 | ||
|
|
65819cf723 | ||
|
|
cb5dcc5088 | ||
|
|
0d071e6e82 | ||
|
|
9aad840a78 | ||
|
|
617e2bdc4f | ||
|
|
88de2a2ee0 | ||
|
|
f502432fcc | ||
|
|
a052700934 | ||
|
|
74d48a0427 | ||
|
|
e344e05857 | ||
|
|
0b5681842e | ||
|
|
6ab5f06fc9 | ||
|
|
d55d30be3f | ||
|
|
efd630c8f1 | ||
|
|
2a1c9dbaf6 | ||
|
|
7801a980b5 | ||
|
|
0d42a41af3 | ||
|
|
ba6fdb83ae | ||
|
|
12d9ad1183 | ||
|
|
75fb5bc9d6 | ||
|
|
841af73248 | ||
|
|
2fd4bbc8b3 | ||
|
|
6aad62ee6b | ||
|
|
de8c7477b8 | ||
|
|
057d8ac5f5 | ||
|
|
d5dddade85 | ||
|
|
78529a4d56 | ||
|
|
f87e0a7888 | ||
|
|
2c8259e350 | ||
|
|
19f3b10f90 | ||
|
|
85c2c448d1 | ||
|
|
2b29bf6aa5 | ||
|
|
87e5e9bbe0 | ||
|
|
ce3de2baeb | ||
|
|
f10e20b78a | ||
|
|
6656e67085 | ||
|
|
5c08c7d65e | ||
|
|
0becff5320 | ||
|
|
4cda13f004 | ||
|
|
710bfa3e8f | ||
|
|
25122abed1 | ||
|
|
1d54214c55 | ||
|
|
0f449801e4 | ||
|
|
394be710a4 | ||
|
|
85683ea9fa | ||
|
|
17b0373c73 | ||
|
|
7320f47d60 | ||
|
|
667c511515 | ||
|
|
8586796a6d | ||
|
|
a3d499accf | ||
|
|
9e9b8628a4 | ||
|
|
efd5b59bda | ||
|
|
6d21950180 | ||
|
|
5d0f50677a | ||
|
|
7abccd8865 | ||
|
|
c2d961505e | ||
|
|
b65064a124 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -19,4 +19,5 @@ Thumbs.db
|
||||
obj/
|
||||
[Rr]elease*/
|
||||
_ReSharper*/
|
||||
SIMPLSharpLogs/
|
||||
SIMPLSharpLogs/
|
||||
*.projectinfo
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro;
|
||||
|
||||
@@ -54,17 +55,22 @@ namespace PepperDash.Essentials.Core
|
||||
|
||||
void Port_SerialDataReceived(ComPort ReceivingComPort, ComPortSerialDataEventArgs args)
|
||||
{
|
||||
var bytesHandler = BytesReceived;
|
||||
if (bytesHandler != null)
|
||||
{
|
||||
var bytes = Encoding.GetEncoding(28591).GetBytes(args.SerialData);
|
||||
bytesHandler(this, new GenericCommMethodReceiveBytesArgs(bytes));
|
||||
}
|
||||
var textHandler = TextReceived;
|
||||
if (textHandler != null)
|
||||
textHandler(this, new GenericCommMethodReceiveTextArgs(args.SerialData));
|
||||
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;
|
||||
@@ -83,8 +89,6 @@ namespace PepperDash.Essentials.Core
|
||||
Port.Send(text);
|
||||
}
|
||||
|
||||
//public BoolFeedback IsConnected { get; private set; }
|
||||
|
||||
public void Connect()
|
||||
{
|
||||
}
|
||||
@@ -94,5 +98,25 @@ namespace PepperDash.Essentials.Core
|
||||
}
|
||||
|
||||
#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());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,9 @@ namespace PepperDash.Essentials.Core.Config
|
||||
[JsonProperty("key")]
|
||||
public string Key { get; set; }
|
||||
|
||||
[JsonProperty("uid")]
|
||||
public int Uid { get; set; }
|
||||
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
|
||||
@@ -1,128 +1,127 @@
|
||||
using Crestron.SimplSharpPro;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
public static class CommonBoolCue
|
||||
{
|
||||
public static readonly Cue Power = new Cue("Power", 101, eCueType.Bool);
|
||||
public static readonly Cue PowerOn = new Cue("PowerOn", 102, eCueType.Bool);
|
||||
public static readonly Cue PowerOff = new Cue("PowerOff", 103, eCueType.Bool);
|
||||
|
||||
public static readonly Cue HasPowerFeedback = new Cue("HasPowerFeedback", 101, eCueType.Bool);
|
||||
public static readonly Cue PowerOnFeedback = new Cue("PowerOnFeedback", 102, eCueType.Bool);
|
||||
public static readonly Cue IsOnlineFeedback = new Cue("IsOnlineFeedback", 104, eCueType.Bool);
|
||||
public static readonly Cue IsWarmingUp = new Cue("IsWarmingUp", 105, eCueType.Bool);
|
||||
public static readonly Cue IsCoolingDown = new Cue("IsCoolingDown", 106, eCueType.Bool);
|
||||
|
||||
public static readonly Cue Dash = new Cue("Dash", 109, eCueType.Bool);
|
||||
public static readonly Cue Digit0 = new Cue("Digit0", 110, eCueType.Bool);
|
||||
public static readonly Cue Digit1 = new Cue("Digit1", 111, eCueType.Bool);
|
||||
public static readonly Cue Digit2 = new Cue("Digit2", 112, eCueType.Bool);
|
||||
public static readonly Cue Digit3 = new Cue("Digit3", 113, eCueType.Bool);
|
||||
public static readonly Cue Digit4 = new Cue("Digit4", 114, eCueType.Bool);
|
||||
public static readonly Cue Digit5 = new Cue("Digit5", 115, eCueType.Bool);
|
||||
public static readonly Cue Digit6 = new Cue("Digit6", 116, eCueType.Bool);
|
||||
public static readonly Cue Digit7 = new Cue("Digit7", 117, eCueType.Bool);
|
||||
public static readonly Cue Digit8 = new Cue("Digit8", 118, eCueType.Bool);
|
||||
public static readonly Cue Digit9 = new Cue("Digit9", 119, eCueType.Bool);
|
||||
public static readonly Cue KeypadMisc1 = new Cue("KeypadMisc1", 120, eCueType.Bool);
|
||||
public static readonly Cue KeypadMisc2 = new Cue("KeypadMisc2", 121, eCueType.Bool);
|
||||
|
||||
public static readonly Cue NumericEnter = new Cue("Enter", 122, eCueType.Bool);
|
||||
public static readonly Cue ChannelUp = new Cue("ChannelUp", 123, eCueType.Bool);
|
||||
public static readonly Cue ChannelDown = new Cue("ChannelDown", 124, eCueType.Bool);
|
||||
public static readonly Cue Last = new Cue("Last", 125, eCueType.Bool);
|
||||
public static readonly Cue OpenClose = new Cue("OpenClose", 126, eCueType.Bool);
|
||||
public static readonly Cue Subtitle = new Cue("Subtitle", 127, eCueType.Bool);
|
||||
public static readonly Cue Audio = new Cue("Audio", 128, eCueType.Bool);
|
||||
public static readonly Cue Info = new Cue("Info", 129, eCueType.Bool);
|
||||
public static readonly Cue Menu = new Cue("Menu", 130, eCueType.Bool);
|
||||
public static readonly Cue DeviceMenu = new Cue("DeviceMenu", 131, eCueType.Bool);
|
||||
public static readonly Cue Return = new Cue("Return", 132, eCueType.Bool);
|
||||
public static readonly Cue Back = new Cue("Back", 133, eCueType.Bool);
|
||||
public static readonly Cue Exit = new Cue("Exit", 134, eCueType.Bool);
|
||||
public static readonly Cue Clear = new Cue("Clear", 135, eCueType.Bool);
|
||||
public static readonly Cue List = new Cue("List", 136, eCueType.Bool);
|
||||
public static readonly Cue Guide = new Cue("Guide", 137, eCueType.Bool);
|
||||
public static readonly Cue Am = new Cue("Am", 136, eCueType.Bool);
|
||||
public static readonly Cue Fm = new Cue("Fm", 137, eCueType.Bool);
|
||||
public static readonly Cue Up = new Cue("Up", 138, eCueType.Bool);
|
||||
public static readonly Cue Down = new Cue("Down", 139, eCueType.Bool);
|
||||
public static readonly Cue Left = new Cue("Left", 140, eCueType.Bool);
|
||||
public static readonly Cue Right = new Cue("Right", 141, eCueType.Bool);
|
||||
public static readonly Cue Select = new Cue("Select", 142, eCueType.Bool);
|
||||
public static readonly Cue SmartApps = new Cue("SmartApps", 143, eCueType.Bool);
|
||||
public static readonly Cue Dvr = new Cue("Dvr", 144, eCueType.Bool);
|
||||
|
||||
|
||||
public static readonly Cue Play = new Cue("Play", 145, eCueType.Bool);
|
||||
public static readonly Cue Pause = new Cue("Pause", 146, eCueType.Bool);
|
||||
public static readonly Cue Stop = new Cue("Stop", 147, eCueType.Bool);
|
||||
public static readonly Cue ChapNext = new Cue("ChapNext", 148, eCueType.Bool);
|
||||
public static readonly Cue ChapPrevious = new Cue("ChapPrevious", 149, eCueType.Bool);
|
||||
public static readonly Cue Rewind = new Cue("Rewind", 150, eCueType.Bool);
|
||||
public static readonly Cue Ffwd = new Cue("Ffwd", 151, eCueType.Bool);
|
||||
public static readonly Cue Replay = new Cue("Replay", 152, eCueType.Bool);
|
||||
public static readonly Cue Advance = new Cue("Advance", 153, eCueType.Bool);
|
||||
public static readonly Cue Record = new Cue("Record", 154, eCueType.Bool);
|
||||
public static readonly Cue Red = new Cue("Red", 155, eCueType.Bool);
|
||||
public static readonly Cue Green = new Cue("Green", 156, eCueType.Bool);
|
||||
public static readonly Cue Yellow = new Cue("Yellow", 157, eCueType.Bool);
|
||||
public static readonly Cue Blue = new Cue("Blue", 158, eCueType.Bool);
|
||||
public static readonly Cue Home = new Cue("Home", 159, eCueType.Bool);
|
||||
public static readonly Cue PopUp = new Cue("PopUp", 160, eCueType.Bool);
|
||||
public static readonly Cue PageUp = new Cue("PageUp", 161, eCueType.Bool);
|
||||
public static readonly Cue PageDown = new Cue("PageDown", 162, eCueType.Bool);
|
||||
public static readonly Cue Search = new Cue("Search", 163, eCueType.Bool);
|
||||
public static readonly Cue Setup = new Cue("Setup", 164, eCueType.Bool);
|
||||
public static readonly Cue RStep = new Cue("RStep", 165, eCueType.Bool);
|
||||
public static readonly Cue FStep = new Cue("FStep", 166, eCueType.Bool);
|
||||
|
||||
public static readonly Cue IsConnected = new Cue("IsConnected", 281, eCueType.Bool);
|
||||
public static readonly Cue IsOk = new Cue("IsOk", 282, eCueType.Bool);
|
||||
public static readonly Cue InWarning = new Cue("InWarning", 283, eCueType.Bool);
|
||||
public static readonly Cue InError = new Cue("InError", 284, eCueType.Bool);
|
||||
public static readonly Cue StatusUnknown = new Cue("StatusUnknown", 285, eCueType.Bool);
|
||||
|
||||
public static readonly Cue VolumeUp = new Cue("VolumeUp", 401, eCueType.Bool);
|
||||
public static readonly Cue VolumeDown = new Cue("VolumeDown", 402, eCueType.Bool);
|
||||
public static readonly Cue MuteOn = new Cue("MuteOn", 403, eCueType.Bool);
|
||||
public static readonly Cue MuteOff = new Cue("MuteOff", 404, eCueType.Bool);
|
||||
public static readonly Cue MuteToggle = new Cue("MuteToggle", 405, eCueType.Bool);
|
||||
public static readonly Cue ShowVolumeButtons = new Cue("ShowVolumeButtons", 406, eCueType.Bool);
|
||||
public static readonly Cue ShowVolumeSlider = new Cue("ShowVolumeSlider", 407, eCueType.Bool);
|
||||
|
||||
public static readonly Cue Hdmi1 = new Cue("Hdmi1", 451, eCueType.Bool);
|
||||
public static readonly Cue Hdmi2 = new Cue("Hdmi2", 452, eCueType.Bool);
|
||||
public static readonly Cue Hdmi3 = new Cue("Hdmi3", 453, eCueType.Bool);
|
||||
public static readonly Cue Hdmi4 = new Cue("Hdmi4", 454, eCueType.Bool);
|
||||
public static readonly Cue Hdmi5 = new Cue("Hdmi5", 455, eCueType.Bool);
|
||||
public static readonly Cue Hdmi6 = new Cue("Hdmi6", 456, eCueType.Bool);
|
||||
public static readonly Cue DisplayPort1 = new Cue("DisplayPort1", 457, eCueType.Bool);
|
||||
public static readonly Cue DisplayPort2 = new Cue("DisplayPort2", 458, eCueType.Bool);
|
||||
public static readonly Cue Dvi1 = new Cue("Dvi1", 459, eCueType.Bool);
|
||||
public static readonly Cue Dvi2 = new Cue("Dvi2", 460, eCueType.Bool);
|
||||
public static readonly Cue Video1 = new Cue("Video1", 461, eCueType.Bool);
|
||||
public static readonly Cue Video2 = new Cue("Video2", 462, eCueType.Bool);
|
||||
public static readonly Cue Component1 = new Cue("Component1", 463, eCueType.Bool);
|
||||
public static readonly Cue Component2 = new Cue("Component2", 464, eCueType.Bool);
|
||||
public static readonly Cue Vga1 = new Cue("Vga1", 465, eCueType.Bool);
|
||||
public static readonly Cue Vga2 = new Cue("Vga2", 466, eCueType.Bool);
|
||||
public static readonly Cue Rgb1 = new Cue("Rgb1", 467, eCueType.Bool);
|
||||
public static readonly Cue Rgb2 = new Cue("Rgb2", 468, eCueType.Bool);
|
||||
public static readonly Cue Antenna = new Cue("Antenna", 469, eCueType.Bool);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static class CommonIntCue
|
||||
{
|
||||
public static readonly Cue MainVolumeLevel = new Cue("MainVolumeLevel", 401, eCueType.Int);
|
||||
public static readonly Cue MainVolumeLevelFeedback = new Cue("MainVolumeLevelFeedback", 401, eCueType.Int);
|
||||
}
|
||||
|
||||
public static class CommonStringCue
|
||||
{
|
||||
public static readonly Cue IpConnectionsText = new Cue("IpConnectionsText", 9999, eCueType.String);
|
||||
}
|
||||
using Crestron.SimplSharpPro;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
public static class CommonBoolCue
|
||||
{
|
||||
public static readonly Cue Power = new Cue("Power", 101, eCueType.Bool);
|
||||
public static readonly Cue PowerOn = new Cue("PowerOn", 102, eCueType.Bool);
|
||||
public static readonly Cue PowerOff = new Cue("PowerOff", 103, eCueType.Bool);
|
||||
|
||||
public static readonly Cue HasPowerFeedback = new Cue("HasPowerFeedback", 101, eCueType.Bool);
|
||||
public static readonly Cue PowerOnFeedback = new Cue("PowerOnFeedback", 102, eCueType.Bool);
|
||||
public static readonly Cue IsOnlineFeedback = new Cue("IsOnlineFeedback", 104, eCueType.Bool);
|
||||
public static readonly Cue IsWarmingUp = new Cue("IsWarmingUp", 105, eCueType.Bool);
|
||||
public static readonly Cue IsCoolingDown = new Cue("IsCoolingDown", 106, eCueType.Bool);
|
||||
|
||||
public static readonly Cue Dash = new Cue("Dash", 109, eCueType.Bool);
|
||||
public static readonly Cue Digit0 = new Cue("Digit0", 110, eCueType.Bool);
|
||||
public static readonly Cue Digit1 = new Cue("Digit1", 111, eCueType.Bool);
|
||||
public static readonly Cue Digit2 = new Cue("Digit2", 112, eCueType.Bool);
|
||||
public static readonly Cue Digit3 = new Cue("Digit3", 113, eCueType.Bool);
|
||||
public static readonly Cue Digit4 = new Cue("Digit4", 114, eCueType.Bool);
|
||||
public static readonly Cue Digit5 = new Cue("Digit5", 115, eCueType.Bool);
|
||||
public static readonly Cue Digit6 = new Cue("Digit6", 116, eCueType.Bool);
|
||||
public static readonly Cue Digit7 = new Cue("Digit7", 117, eCueType.Bool);
|
||||
public static readonly Cue Digit8 = new Cue("Digit8", 118, eCueType.Bool);
|
||||
public static readonly Cue Digit9 = new Cue("Digit9", 119, eCueType.Bool);
|
||||
public static readonly Cue KeypadMisc1 = new Cue("KeypadMisc1", 120, eCueType.Bool);
|
||||
public static readonly Cue KeypadMisc2 = new Cue("KeypadMisc2", 121, eCueType.Bool);
|
||||
|
||||
public static readonly Cue NumericEnter = new Cue("Enter", 122, eCueType.Bool);
|
||||
public static readonly Cue ChannelUp = new Cue("ChannelUp", 123, eCueType.Bool);
|
||||
public static readonly Cue ChannelDown = new Cue("ChannelDown", 124, eCueType.Bool);
|
||||
public static readonly Cue Last = new Cue("Last", 125, eCueType.Bool);
|
||||
public static readonly Cue OpenClose = new Cue("OpenClose", 126, eCueType.Bool);
|
||||
public static readonly Cue Subtitle = new Cue("Subtitle", 127, eCueType.Bool);
|
||||
public static readonly Cue Audio = new Cue("Audio", 128, eCueType.Bool);
|
||||
public static readonly Cue Info = new Cue("Info", 129, eCueType.Bool);
|
||||
public static readonly Cue Menu = new Cue("Menu", 130, eCueType.Bool);
|
||||
public static readonly Cue DeviceMenu = new Cue("DeviceMenu", 131, eCueType.Bool);
|
||||
public static readonly Cue Return = new Cue("Return", 132, eCueType.Bool);
|
||||
public static readonly Cue Back = new Cue("Back", 133, eCueType.Bool);
|
||||
public static readonly Cue Exit = new Cue("Exit", 134, eCueType.Bool);
|
||||
public static readonly Cue Clear = new Cue("Clear", 135, eCueType.Bool);
|
||||
public static readonly Cue List = new Cue("List", 136, eCueType.Bool);
|
||||
public static readonly Cue Guide = new Cue("Guide", 137, eCueType.Bool);
|
||||
public static readonly Cue Am = new Cue("Am", 136, eCueType.Bool);
|
||||
public static readonly Cue Fm = new Cue("Fm", 137, eCueType.Bool);
|
||||
public static readonly Cue Up = new Cue("Up", 138, eCueType.Bool);
|
||||
public static readonly Cue Down = new Cue("Down", 139, eCueType.Bool);
|
||||
public static readonly Cue Left = new Cue("Left", 140, eCueType.Bool);
|
||||
public static readonly Cue Right = new Cue("Right", 141, eCueType.Bool);
|
||||
public static readonly Cue Select = new Cue("Select", 142, eCueType.Bool);
|
||||
public static readonly Cue SmartApps = new Cue("SmartApps", 143, eCueType.Bool);
|
||||
public static readonly Cue Dvr = new Cue("Dvr", 144, eCueType.Bool);
|
||||
|
||||
public static readonly Cue Play = new Cue("Play", 145, eCueType.Bool);
|
||||
public static readonly Cue Pause = new Cue("Pause", 146, eCueType.Bool);
|
||||
public static readonly Cue Stop = new Cue("Stop", 147, eCueType.Bool);
|
||||
public static readonly Cue ChapNext = new Cue("ChapNext", 148, eCueType.Bool);
|
||||
public static readonly Cue ChapPrevious = new Cue("ChapPrevious", 149, eCueType.Bool);
|
||||
public static readonly Cue Rewind = new Cue("Rewind", 150, eCueType.Bool);
|
||||
public static readonly Cue Ffwd = new Cue("Ffwd", 151, eCueType.Bool);
|
||||
public static readonly Cue Replay = new Cue("Replay", 152, eCueType.Bool);
|
||||
public static readonly Cue Advance = new Cue("Advance", 153, eCueType.Bool);
|
||||
public static readonly Cue Record = new Cue("Record", 154, eCueType.Bool);
|
||||
public static readonly Cue Red = new Cue("Red", 155, eCueType.Bool);
|
||||
public static readonly Cue Green = new Cue("Green", 156, eCueType.Bool);
|
||||
public static readonly Cue Yellow = new Cue("Yellow", 157, eCueType.Bool);
|
||||
public static readonly Cue Blue = new Cue("Blue", 158, eCueType.Bool);
|
||||
public static readonly Cue Home = new Cue("Home", 159, eCueType.Bool);
|
||||
public static readonly Cue PopUp = new Cue("PopUp", 160, eCueType.Bool);
|
||||
public static readonly Cue PageUp = new Cue("PageUp", 161, eCueType.Bool);
|
||||
public static readonly Cue PageDown = new Cue("PageDown", 162, eCueType.Bool);
|
||||
public static readonly Cue Search = new Cue("Search", 163, eCueType.Bool);
|
||||
public static readonly Cue Setup = new Cue("Setup", 164, eCueType.Bool);
|
||||
public static readonly Cue RStep = new Cue("RStep", 165, eCueType.Bool);
|
||||
public static readonly Cue FStep = new Cue("FStep", 166, eCueType.Bool);
|
||||
|
||||
public static readonly Cue IsConnected = new Cue("IsConnected", 281, eCueType.Bool);
|
||||
public static readonly Cue IsOk = new Cue("IsOk", 282, eCueType.Bool);
|
||||
public static readonly Cue InWarning = new Cue("InWarning", 283, eCueType.Bool);
|
||||
public static readonly Cue InError = new Cue("InError", 284, eCueType.Bool);
|
||||
public static readonly Cue StatusUnknown = new Cue("StatusUnknown", 285, eCueType.Bool);
|
||||
|
||||
public static readonly Cue VolumeUp = new Cue("VolumeUp", 401, eCueType.Bool);
|
||||
public static readonly Cue VolumeDown = new Cue("VolumeDown", 402, eCueType.Bool);
|
||||
public static readonly Cue MuteOn = new Cue("MuteOn", 403, eCueType.Bool);
|
||||
public static readonly Cue MuteOff = new Cue("MuteOff", 404, eCueType.Bool);
|
||||
public static readonly Cue MuteToggle = new Cue("MuteToggle", 405, eCueType.Bool);
|
||||
public static readonly Cue ShowVolumeButtons = new Cue("ShowVolumeButtons", 406, eCueType.Bool);
|
||||
public static readonly Cue ShowVolumeSlider = new Cue("ShowVolumeSlider", 407, eCueType.Bool);
|
||||
|
||||
public static readonly Cue Hdmi1 = new Cue("Hdmi1", 451, eCueType.Bool);
|
||||
public static readonly Cue Hdmi2 = new Cue("Hdmi2", 452, eCueType.Bool);
|
||||
public static readonly Cue Hdmi3 = new Cue("Hdmi3", 453, eCueType.Bool);
|
||||
public static readonly Cue Hdmi4 = new Cue("Hdmi4", 454, eCueType.Bool);
|
||||
public static readonly Cue Hdmi5 = new Cue("Hdmi5", 455, eCueType.Bool);
|
||||
public static readonly Cue Hdmi6 = new Cue("Hdmi6", 456, eCueType.Bool);
|
||||
public static readonly Cue DisplayPort1 = new Cue("DisplayPort1", 457, eCueType.Bool);
|
||||
public static readonly Cue DisplayPort2 = new Cue("DisplayPort2", 458, eCueType.Bool);
|
||||
public static readonly Cue Dvi1 = new Cue("Dvi1", 459, eCueType.Bool);
|
||||
public static readonly Cue Dvi2 = new Cue("Dvi2", 460, eCueType.Bool);
|
||||
public static readonly Cue Video1 = new Cue("Video1", 461, eCueType.Bool);
|
||||
public static readonly Cue Video2 = new Cue("Video2", 462, eCueType.Bool);
|
||||
public static readonly Cue Component1 = new Cue("Component1", 463, eCueType.Bool);
|
||||
public static readonly Cue Component2 = new Cue("Component2", 464, eCueType.Bool);
|
||||
public static readonly Cue Vga1 = new Cue("Vga1", 465, eCueType.Bool);
|
||||
public static readonly Cue Vga2 = new Cue("Vga2", 466, eCueType.Bool);
|
||||
public static readonly Cue Rgb1 = new Cue("Rgb1", 467, eCueType.Bool);
|
||||
public static readonly Cue Rgb2 = new Cue("Rgb2", 468, eCueType.Bool);
|
||||
public static readonly Cue Antenna = new Cue("Antenna", 469, eCueType.Bool);
|
||||
|
||||
public static readonly Cue InCall = new Cue("InCall", 501, eCueType.Bool);
|
||||
}
|
||||
|
||||
public static class CommonIntCue
|
||||
{
|
||||
public static readonly Cue MainVolumeLevel = new Cue("MainVolumeLevel", 401, eCueType.Int);
|
||||
public static readonly Cue MainVolumeLevelFeedback = new Cue("MainVolumeLevelFeedback", 401, eCueType.Int);
|
||||
}
|
||||
|
||||
public static class CommonStringCue
|
||||
{
|
||||
public static readonly Cue IpConnectionsText = new Cue("IpConnectionsText", 9999, eCueType.String);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.Core.Crestron_IO
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a generic digital input deviced tied to a versiport
|
||||
/// </summary>
|
||||
public class GenericVersiportInputDevice
|
||||
{
|
||||
//Versiport InputPort {get; private set;}
|
||||
|
||||
//BoolFeedback InputStateFeedback {get; private set;}
|
||||
|
||||
//Func<bool> InputStateFeedbackFunc
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// return () => InputPort.DigitalIn;
|
||||
// }
|
||||
//}
|
||||
|
||||
//public GenericVersiportInputDevice(Versiport inputPort)
|
||||
//{
|
||||
// InputStateFeedback = new BoolFeedback(InputStateFeedbackFunc);
|
||||
|
||||
// InputPort = inputPort;
|
||||
|
||||
// InputPort.VersiportChange += new VersiportEventHandler(InputPort_VersiportChange);
|
||||
|
||||
//}
|
||||
|
||||
//void InputPort_VersiportChange(Versiport port, VersiportEventArgs args)
|
||||
//{
|
||||
// InputStateFeedback.FireUpdate();
|
||||
//}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Crestron_IO
|
||||
{
|
||||
public interface IDigitalInput
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using Crestron.SimplSharpPro;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Crestron_IO
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a generic device controlled by relays
|
||||
/// </summary>
|
||||
public class GenericRelayDevice
|
||||
{
|
||||
//Relay RelayOutput { get; private set; }
|
||||
|
||||
//public boolfeedback relaystatefeedback { get; private set; }
|
||||
|
||||
//func<bool> relaystatefeedbackfunc
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// return () => relayoutput.state;
|
||||
// }
|
||||
//}
|
||||
|
||||
//public genericrelaydevice(relay relay)
|
||||
//{
|
||||
// relaystatefeedback = new boolfeedback(relaystatefeedbackfunc);
|
||||
|
||||
// if(relay.availableforuse)
|
||||
// relayoutput = relay;
|
||||
|
||||
// relayoutput.statechange += new relayeventhandler(relayoutput_statechange);
|
||||
//}
|
||||
|
||||
//void relayoutput_statechange(relay relay, relayeventargs args)
|
||||
//{
|
||||
// relaystatefeedback.fireupdate();
|
||||
//}
|
||||
}
|
||||
}
|
||||
@@ -1,116 +1,122 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// A bridge class to cover the basic features of GenericBase hardware
|
||||
/// </summary>
|
||||
public class CrestronGenericBaseDevice : Device, IOnline, IHasFeedback, ICommunicationMonitor
|
||||
{
|
||||
public virtual GenericBase Hardware { get; protected set; }
|
||||
|
||||
public BoolFeedback IsOnline { get; private set; }
|
||||
public BoolFeedback IsRegistered { get; private set; }
|
||||
public StringFeedback IpConnectionsText { get; private set; }
|
||||
|
||||
public CrestronGenericBaseDevice(string key, string name, GenericBase hardware)
|
||||
: base(key, name)
|
||||
{
|
||||
Hardware = hardware;
|
||||
IsOnline = new BoolFeedback(CommonBoolCue.IsOnlineFeedback, () => Hardware.IsOnline);
|
||||
IsRegistered = new BoolFeedback(new Cue("IsRegistered", 0, eCueType.Bool), () => Hardware.Registered);
|
||||
IpConnectionsText = new StringFeedback(CommonStringCue.IpConnectionsText, () =>
|
||||
string.Join(",", Hardware.ConnectedIpList.Select(cip => cip.DeviceIpAddress).ToArray()));
|
||||
CommunicationMonitor = new CrestronGenericBaseCommunicationMonitor(this, hardware, 120000, 300000);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Make sure that overriding classes call this!
|
||||
/// Registers the Crestron device, connects up to the base events, starts communication monitor
|
||||
/// </summary>
|
||||
public override bool CustomActivate()
|
||||
{
|
||||
new CTimer(o =>
|
||||
{
|
||||
Debug.Console(1, this, "Activating");
|
||||
var response = Hardware.RegisterWithLogging(Key);
|
||||
if (response == eDeviceRegistrationUnRegistrationResponse.Success)
|
||||
{
|
||||
Hardware.OnlineStatusChange += new OnlineStatusChangeEventHandler(Hardware_OnlineStatusChange);
|
||||
CommunicationMonitor.Start();
|
||||
}
|
||||
}, 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This disconnects events and unregisters the base hardware device.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override bool Deactivate()
|
||||
{
|
||||
CommunicationMonitor.Stop();
|
||||
Hardware.OnlineStatusChange -= Hardware_OnlineStatusChange;
|
||||
|
||||
return Hardware.UnRegister() == eDeviceRegistrationUnRegistrationResponse.Success;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list containing the Outputs that we want to expose.
|
||||
/// </summary>
|
||||
public virtual List<Feedback> Feedbacks
|
||||
{
|
||||
get
|
||||
{
|
||||
return new List<Feedback>
|
||||
{
|
||||
IsOnline,
|
||||
IsRegistered,
|
||||
IpConnectionsText
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
void Hardware_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args)
|
||||
{
|
||||
IsOnline.FireUpdate();
|
||||
}
|
||||
|
||||
#region IStatusMonitor Members
|
||||
|
||||
public StatusMonitorBase CommunicationMonitor { get; private set; }
|
||||
#endregion
|
||||
}
|
||||
|
||||
//***********************************************************************************
|
||||
public class CrestronGenericBaseDeviceEventIds
|
||||
{
|
||||
public const uint IsOnline = 1;
|
||||
public const uint IpConnectionsText =2;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds logging to Register() failure
|
||||
/// </summary>
|
||||
public static class GenericBaseExtensions
|
||||
{
|
||||
public static eDeviceRegistrationUnRegistrationResponse RegisterWithLogging(this GenericBase device, string key)
|
||||
{
|
||||
var result = device.Register();
|
||||
if (result != eDeviceRegistrationUnRegistrationResponse.Success)
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Error, "Cannot register device '{0}': {1}", key, result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// A bridge class to cover the basic features of GenericBase hardware
|
||||
/// </summary>
|
||||
public class CrestronGenericBaseDevice : Device, IOnline, IHasFeedback, ICommunicationMonitor, IUsageTracking
|
||||
{
|
||||
public virtual GenericBase Hardware { get; protected set; }
|
||||
|
||||
public BoolFeedback IsOnline { get; private set; }
|
||||
public BoolFeedback IsRegistered { get; private set; }
|
||||
public StringFeedback IpConnectionsText { get; private set; }
|
||||
|
||||
public CrestronGenericBaseDevice(string key, string name, GenericBase hardware)
|
||||
: base(key, name)
|
||||
{
|
||||
Hardware = hardware;
|
||||
IsOnline = new BoolFeedback(CommonBoolCue.IsOnlineFeedback, () => Hardware.IsOnline);
|
||||
IsRegistered = new BoolFeedback(new Cue("IsRegistered", 0, eCueType.Bool), () => Hardware.Registered);
|
||||
IpConnectionsText = new StringFeedback(CommonStringCue.IpConnectionsText, () =>
|
||||
string.Join(",", Hardware.ConnectedIpList.Select(cip => cip.DeviceIpAddress).ToArray()));
|
||||
CommunicationMonitor = new CrestronGenericBaseCommunicationMonitor(this, hardware, 120000, 300000);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Make sure that overriding classes call this!
|
||||
/// Registers the Crestron device, connects up to the base events, starts communication monitor
|
||||
/// </summary>
|
||||
public override bool CustomActivate()
|
||||
{
|
||||
new CTimer(o =>
|
||||
{
|
||||
Debug.Console(1, this, "Activating");
|
||||
var response = Hardware.RegisterWithLogging(Key);
|
||||
if (response == eDeviceRegistrationUnRegistrationResponse.Success)
|
||||
{
|
||||
Hardware.OnlineStatusChange += new OnlineStatusChangeEventHandler(Hardware_OnlineStatusChange);
|
||||
CommunicationMonitor.Start();
|
||||
}
|
||||
}, 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This disconnects events and unregisters the base hardware device.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override bool Deactivate()
|
||||
{
|
||||
CommunicationMonitor.Stop();
|
||||
Hardware.OnlineStatusChange -= Hardware_OnlineStatusChange;
|
||||
|
||||
return Hardware.UnRegister() == eDeviceRegistrationUnRegistrationResponse.Success;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list containing the Outputs that we want to expose.
|
||||
/// </summary>
|
||||
public virtual List<Feedback> Feedbacks
|
||||
{
|
||||
get
|
||||
{
|
||||
return new List<Feedback>
|
||||
{
|
||||
IsOnline,
|
||||
IsRegistered,
|
||||
IpConnectionsText
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
void Hardware_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args)
|
||||
{
|
||||
IsOnline.FireUpdate();
|
||||
}
|
||||
|
||||
#region IStatusMonitor Members
|
||||
|
||||
public StatusMonitorBase CommunicationMonitor { get; private set; }
|
||||
#endregion
|
||||
|
||||
#region IUsageTracking Members
|
||||
|
||||
public UsageTracking UsageTracker { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
//***********************************************************************************
|
||||
public class CrestronGenericBaseDeviceEventIds
|
||||
{
|
||||
public const uint IsOnline = 1;
|
||||
public const uint IpConnectionsText =2;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds logging to Register() failure
|
||||
/// </summary>
|
||||
public static class GenericBaseExtensions
|
||||
{
|
||||
public static eDeviceRegistrationUnRegistrationResponse RegisterWithLogging(this GenericBase device, string key)
|
||||
{
|
||||
var result = device.Register();
|
||||
if (result != eDeviceRegistrationUnRegistrationResponse.Success)
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Error, "Cannot register device '{0}': {1}", key, result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,46 +1,48 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.SmartObjects;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public interface IPower
|
||||
{
|
||||
void PowerOn();
|
||||
void PowerOff();
|
||||
void PowerToggle();
|
||||
BoolFeedback PowerIsOnFeedback { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static class IPowerExtensions
|
||||
{
|
||||
public static void LinkButtons(this IPower dev, BasicTriList triList)
|
||||
{
|
||||
triList.SetSigFalseAction(101, dev.PowerOn);
|
||||
triList.SetSigFalseAction(102, dev.PowerOff);
|
||||
triList.SetSigFalseAction(103, dev.PowerToggle);
|
||||
dev.PowerIsOnFeedback.LinkInputSig(triList.BooleanInput[101]);
|
||||
}
|
||||
|
||||
public static void UnlinkButtons(this IPower dev, BasicTriList triList)
|
||||
{
|
||||
triList.ClearBoolSigAction(101);
|
||||
triList.ClearBoolSigAction(102);
|
||||
triList.ClearBoolSigAction(103);
|
||||
dev.PowerIsOnFeedback.UnlinkInputSig(triList.BooleanInput[101]);
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using Crestron.SimplSharpPro.Fusion;
|
||||
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.SmartObjects;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public interface IPower
|
||||
{
|
||||
void PowerOn();
|
||||
void PowerOff();
|
||||
void PowerToggle();
|
||||
BoolFeedback PowerIsOnFeedback { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static class IPowerExtensions
|
||||
{
|
||||
public static void LinkButtons(this IPower dev, BasicTriList triList)
|
||||
{
|
||||
triList.SetSigFalseAction(101, dev.PowerOn);
|
||||
triList.SetSigFalseAction(102, dev.PowerOff);
|
||||
triList.SetSigFalseAction(103, dev.PowerToggle);
|
||||
dev.PowerIsOnFeedback.LinkInputSig(triList.BooleanInput[101]);
|
||||
}
|
||||
|
||||
public static void UnlinkButtons(this IPower dev, BasicTriList triList)
|
||||
{
|
||||
triList.ClearBoolSigAction(101);
|
||||
triList.ClearBoolSigAction(102);
|
||||
triList.ClearBoolSigAction(103);
|
||||
dev.PowerIsOnFeedback.UnlinkInputSig(triList.BooleanInput[101]);
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Adds control of codec receive volume
|
||||
/// </summary>
|
||||
public interface IReceiveVolume
|
||||
{
|
||||
// Break this out into 3 interfaces
|
||||
void SetReceiveVolume(ushort level);
|
||||
void ReceiveMuteOn();
|
||||
void ReceiveMuteOff();
|
||||
void ReceiveMuteToggle();
|
||||
IntFeedback ReceiveLevelFeedback { get; }
|
||||
BoolFeedback ReceiveMuteIsOnFeedback { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds control of codec transmit volume
|
||||
/// </summary>
|
||||
public interface ITransmitVolume
|
||||
{
|
||||
void SetTransmitVolume(ushort level);
|
||||
void TransmitMuteOn();
|
||||
void TransmitMuteOff();
|
||||
void TransmitMuteToggle();
|
||||
IntFeedback TransmitLevelFeedback { get; }
|
||||
BoolFeedback TransmitMuteIsOnFeedback { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds control of codec privacy function (microphone mute)
|
||||
/// </summary>
|
||||
public interface IPrivacy
|
||||
{
|
||||
void PrivacyModeOn();
|
||||
void PrivacyModeOff();
|
||||
void PrivacyModeToggle();
|
||||
BoolFeedback PrivacyModeIsOnFeedback { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Requirements for a device that has dialing capabilities
|
||||
/// </summary>
|
||||
public interface IHasDialer
|
||||
{
|
||||
// Add requirements for Dialer functionality
|
||||
|
||||
void Dial(string number);
|
||||
<<<<<<< HEAD
|
||||
void EndCall(string number);
|
||||
=======
|
||||
void EndCall(object activeCall);
|
||||
void EndAllCalls();
|
||||
>>>>>>> origin/feature/cisco-spark-2
|
||||
void AcceptCall();
|
||||
void RejectCall();
|
||||
void SendDtmf(string digit);
|
||||
|
||||
IntFeedback ActiveCallCountFeedback { get; }
|
||||
BoolFeedback IncomingCallFeedback { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines minimum volume controls for a codec device with dialing capabilities
|
||||
/// </summary>
|
||||
public interface ICodecAudio : IBasicVolumeWithFeedback, IPrivacy
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds control of codec receive volume
|
||||
/// </summary>
|
||||
public interface IReceiveVolume
|
||||
{
|
||||
// Break this out into 3 interfaces
|
||||
void SetReceiveVolume(ushort level);
|
||||
void ReceiveMuteOn();
|
||||
void ReceiveMuteOff();
|
||||
void ReceiveMuteToggle();
|
||||
IntFeedback ReceiveLevelFeedback { get; }
|
||||
BoolFeedback ReceiveMuteIsOnFeedback { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds control of codec transmit volume
|
||||
/// </summary>
|
||||
public interface ITransmitVolume
|
||||
{
|
||||
void SetTransmitVolume(ushort level);
|
||||
void TransmitMuteOn();
|
||||
void TransmitMuteOff();
|
||||
void TransmitMuteToggle();
|
||||
IntFeedback TransmitLevelFeedback { get; }
|
||||
BoolFeedback TransmitMuteIsOnFeedback { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds control of codec privacy function (microphone mute)
|
||||
/// </summary>
|
||||
public interface IPrivacy
|
||||
{
|
||||
void PrivacyModeOn();
|
||||
void PrivacyModeOff();
|
||||
void PrivacyModeToggle();
|
||||
BoolFeedback PrivacyModeIsOnFeedback { get; }
|
||||
}
|
||||
|
||||
public interface IHasCallHistory
|
||||
{
|
||||
// Add recent calls list
|
||||
}
|
||||
|
||||
public interface IHasDirectory
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public interface IHasObtp
|
||||
{
|
||||
|
||||
// Upcoming Meeting warning event
|
||||
}
|
||||
}
|
||||
@@ -73,7 +73,7 @@ namespace PepperDash.Essentials.Core
|
||||
|
||||
CType t = obj.GetType();
|
||||
// get the properties and set them into a new collection of NameType wrappers
|
||||
var props = t.GetProperties().Select(p => new PropertyNameType(p));
|
||||
var props = t.GetProperties().Select(p => new PropertyNameType(p, obj));
|
||||
return JsonConvert.SerializeObject(props, Formatting.Indented);
|
||||
}
|
||||
|
||||
@@ -197,6 +197,27 @@ namespace PepperDash.Essentials.Core
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets a property on an object.
|
||||
/// </summary>
|
||||
/// <param name="deviceObjectPath"></param>
|
||||
/// <returns></returns>
|
||||
public static string SetProperty(string deviceObjectPath)
|
||||
{
|
||||
throw new NotImplementedException("This could be really useful. Finish it please");
|
||||
|
||||
//var obj = FindObjectOnPath(deviceObjectPath);
|
||||
//if (obj == null)
|
||||
// return "{\"error\":\"No object found\"}";
|
||||
|
||||
//CType t = obj.GetType();
|
||||
|
||||
|
||||
//// get the properties and set them into a new collection of NameType wrappers
|
||||
//var props = t.GetProperties().Select(p => new PropertyNameType(p, obj));
|
||||
//return JsonConvert.SerializeObject(props, Formatting.Indented);
|
||||
}
|
||||
}
|
||||
|
||||
public class DeviceActionWrapper
|
||||
@@ -208,14 +229,37 @@ namespace PepperDash.Essentials.Core
|
||||
|
||||
public class PropertyNameType
|
||||
{
|
||||
object Parent;
|
||||
|
||||
[JsonIgnore]
|
||||
public PropertyInfo PropInfo { get; private set; }
|
||||
public string Name { get { return PropInfo.Name; } }
|
||||
public string Type { get { return PropInfo.PropertyType.Name; } }
|
||||
public string Value { get
|
||||
{
|
||||
if (PropInfo.CanRead)
|
||||
{
|
||||
try
|
||||
{
|
||||
return PropInfo.GetValue(Parent, null).ToString();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
return null;
|
||||
} }
|
||||
|
||||
public PropertyNameType(PropertyInfo info)
|
||||
public bool CanRead { get { return PropInfo.CanRead; } }
|
||||
public bool CanWrite { get { return PropInfo.CanWrite; } }
|
||||
|
||||
|
||||
public PropertyNameType(PropertyInfo info, object parent)
|
||||
{
|
||||
PropInfo = info;
|
||||
Parent = parent;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,10 +29,10 @@ namespace PepperDash.Essentials.Core
|
||||
|
||||
public static void Initialize(CrestronControlSystem cs)
|
||||
{
|
||||
CrestronConsole.AddNewConsoleCommand(ListDeviceCommands, "devcmdlist", "Lists commands",
|
||||
ConsoleAccessLevelEnum.AccessOperator);
|
||||
CrestronConsole.AddNewConsoleCommand(DoDeviceCommand, "devcmd", "Runs a command on device - key Name value",
|
||||
ConsoleAccessLevelEnum.AccessOperator);
|
||||
//CrestronConsole.AddNewConsoleCommand(ListDeviceCommands, "devcmdlist", "Lists commands",
|
||||
// ConsoleAccessLevelEnum.AccessOperator);
|
||||
//CrestronConsole.AddNewConsoleCommand(DoDeviceCommand, "devcmd", "Runs a command on device - key Name value",
|
||||
// ConsoleAccessLevelEnum.AccessOperator);
|
||||
CrestronConsole.AddNewConsoleCommand(ListDeviceCommStatuses, "devcommstatus", "Lists the communication status of all devices",
|
||||
ConsoleAccessLevelEnum.AccessOperator);
|
||||
CrestronConsole.AddNewConsoleCommand(ListDeviceFeedbacks, "devfb", "Lists current feedbacks",
|
||||
@@ -53,6 +53,8 @@ namespace PepperDash.Essentials.Core
|
||||
{
|
||||
CrestronConsole.ConsoleCommandResponse(DeviceJsonApi.GetApiMethods(s));
|
||||
}, "apimethods", "", ConsoleAccessLevelEnum.AccessOperator);
|
||||
CrestronConsole.AddNewConsoleCommand(SimulateComReceiveOnDevice, "devsimreceive",
|
||||
"Simulates incoming data on a com device", ConsoleAccessLevelEnum.AccessOperator);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -105,7 +107,6 @@ namespace PepperDash.Essentials.Core
|
||||
Debug.Console(0, "{0} Devices registered with Device Mangager:",Devices.Count);
|
||||
var sorted = Devices.Values.ToList();
|
||||
sorted.Sort((a, b) => a.Key.CompareTo(b.Key));
|
||||
//var devs = Devices.Values.Where(d => d is IKeyed).Select(d => d as IKeyed);
|
||||
|
||||
foreach (var d in sorted)
|
||||
{
|
||||
@@ -131,16 +132,16 @@ namespace PepperDash.Essentials.Core
|
||||
statusDev.DumpFeedbacksToConsole(true);
|
||||
}
|
||||
|
||||
static void ListDeviceCommands(string devKey)
|
||||
{
|
||||
var dev = GetDeviceForKey(devKey);
|
||||
if (dev == null)
|
||||
{
|
||||
Debug.Console(0, "Device '{0}' not found", devKey);
|
||||
return;
|
||||
}
|
||||
Debug.Console(0, "This needs to be reworked. Stay tuned.", devKey);
|
||||
}
|
||||
//static void ListDeviceCommands(string devKey)
|
||||
//{
|
||||
// var dev = GetDeviceForKey(devKey);
|
||||
// if (dev == null)
|
||||
// {
|
||||
// Debug.Console(0, "Device '{0}' not found", devKey);
|
||||
// return;
|
||||
// }
|
||||
// Debug.Console(0, "This needs to be reworked. Stay tuned.", devKey);
|
||||
//}
|
||||
|
||||
static void ListDeviceCommStatuses(string input)
|
||||
{
|
||||
@@ -154,10 +155,10 @@ namespace PepperDash.Essentials.Core
|
||||
}
|
||||
|
||||
|
||||
static void DoDeviceCommand(string command)
|
||||
{
|
||||
Debug.Console(0, "Not yet implemented. Stay tuned");
|
||||
}
|
||||
//static void DoDeviceCommand(string command)
|
||||
//{
|
||||
// Debug.Console(0, "Not yet implemented. Stay tuned");
|
||||
//}
|
||||
|
||||
public static void AddDevice(IKeyed newDev)
|
||||
{
|
||||
@@ -167,7 +168,7 @@ namespace PepperDash.Essentials.Core
|
||||
//if (existingDevice != null)
|
||||
if(Devices.ContainsKey(newDev.Key))
|
||||
{
|
||||
Debug.Console(0, newDev, "A device with this key already exists. Not added to manager");
|
||||
Debug.Console(0, newDev, "WARNING: A device with this key already exists. Not added to manager");
|
||||
return;
|
||||
}
|
||||
Devices.Add(newDev.Key, newDev);
|
||||
@@ -207,5 +208,29 @@ namespace PepperDash.Essentials.Core
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Console handler that simulates com port data receive
|
||||
/// </summary>
|
||||
/// <param name="s"></param>
|
||||
public static void SimulateComReceiveOnDevice(string s)
|
||||
{
|
||||
// devcomsim:1 xyzabc
|
||||
var match = Regex.Match(s, @"(\S*)\s*(.*)");
|
||||
if (match.Groups.Count < 3)
|
||||
{
|
||||
CrestronConsole.ConsoleCommandResponse(" Format: devsimreceive:P <device key> <string to send>");
|
||||
return;
|
||||
}
|
||||
//Debug.Console(2, "**** {0} - {1} ****", match.Groups[1].Value, match.Groups[2].Value);
|
||||
|
||||
ComPortController com = GetDeviceForKey(match.Groups[1].Value) as ComPortController;
|
||||
if (com == null)
|
||||
{
|
||||
CrestronConsole.ConsoleCommandResponse("'{0}' is not a comm port device", match.Groups[1].Value);
|
||||
return;
|
||||
}
|
||||
com.SimulateReceive(match.Groups[2].Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using Crestron.SimplSharp.Reflection;
|
||||
|
||||
using PepperDash.Core;
|
||||
|
||||
@@ -21,32 +22,40 @@ namespace PepperDash.Essentials.Core
|
||||
{
|
||||
public static void DumpFeedbacksToConsole(this IHasFeedback source, bool getCurrentStates)
|
||||
{
|
||||
var outputs = source.Feedbacks.OrderBy(x => x.Type);
|
||||
if (outputs != null)
|
||||
CType t = source.GetType();
|
||||
// get the properties and set them into a new collection of NameType wrappers
|
||||
var props = t.GetProperties().Select(p => new PropertyNameType(p, t));
|
||||
|
||||
|
||||
|
||||
var feedbacks = source.Feedbacks.OrderBy(x => x.Type);
|
||||
if (feedbacks != null)
|
||||
{
|
||||
Debug.Console(0, source, "\n\nAvailable outputs:");
|
||||
foreach (var o in outputs)
|
||||
Debug.Console(0, source, "\n\nAvailable feedbacks:");
|
||||
foreach (var f in feedbacks)
|
||||
{
|
||||
string val = "";
|
||||
string type = "";
|
||||
if (getCurrentStates)
|
||||
{
|
||||
switch (o.Type)
|
||||
{
|
||||
case eCueType.Bool:
|
||||
val = " = " + o.BoolValue;
|
||||
break;
|
||||
case eCueType.Int:
|
||||
val = " = " + o.IntValue;
|
||||
break;
|
||||
case eCueType.String:
|
||||
val = " = " + o.StringValue;
|
||||
break;
|
||||
//case eOutputType.Other:
|
||||
// break;
|
||||
}
|
||||
if (f is BoolFeedback)
|
||||
{
|
||||
val = f.BoolValue.ToString();
|
||||
type = "boolean";
|
||||
}
|
||||
else if (f is IntFeedback)
|
||||
{
|
||||
val = f.IntValue.ToString();
|
||||
type = "integer";
|
||||
}
|
||||
else if (f is StringFeedback)
|
||||
{
|
||||
val = f.StringValue;
|
||||
type = "string";
|
||||
}
|
||||
}
|
||||
Debug.Console(0, "{0,-8} {1,5} {2}{3}", o.Type, o.Cue.Number,
|
||||
(string.IsNullOrEmpty(o.Cue.Name) ? "-none-" : o.Cue.Name), val);
|
||||
Debug.Console(0, "{0,-12} {1, -25} {2}", type,
|
||||
(string.IsNullOrEmpty(f.Cue.Name) ? "-no name-" : f.Cue.Name), val);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -0,0 +1,135 @@
|
||||
<<<<<<< HEAD
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using Crestron.SimplSharp.Reflection;
|
||||
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
public interface IHasFeedback : IKeyed
|
||||
{
|
||||
/// <summary>
|
||||
/// This method shall return a list of all Output objects on a device,
|
||||
/// including all "aggregate" devices.
|
||||
/// </summary>
|
||||
List<Feedback> Feedbacks { get; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static class IHasFeedbackExtensions
|
||||
{
|
||||
public static void DumpFeedbacksToConsole(this IHasFeedback source, bool getCurrentStates)
|
||||
{
|
||||
CType t = source.GetType();
|
||||
// get the properties and set them into a new collection of NameType wrappers
|
||||
var props = t.GetProperties().Select(p => new PropertyNameType(p, t));
|
||||
|
||||
|
||||
|
||||
var feedbacks = source.Feedbacks.OrderBy(x => x.Type);
|
||||
if (feedbacks != null)
|
||||
{
|
||||
Debug.Console(0, source, "\n\nAvailable feedbacks:");
|
||||
foreach (var f in feedbacks)
|
||||
{
|
||||
string val = "";
|
||||
string type = "";
|
||||
if (getCurrentStates)
|
||||
{
|
||||
if (f is BoolFeedback)
|
||||
{
|
||||
val = f.BoolValue.ToString();
|
||||
type = "boolean";
|
||||
}
|
||||
else if (f is IntFeedback)
|
||||
{
|
||||
val = f.IntValue.ToString();
|
||||
type = "integer";
|
||||
}
|
||||
else if (f is StringFeedback)
|
||||
{
|
||||
val = f.StringValue;
|
||||
type = "string";
|
||||
}
|
||||
}
|
||||
Debug.Console(0, "{0,-12} {1, -25} {2}", type,
|
||||
(string.IsNullOrEmpty(f.Cue.Name) ? "-no name-" : f.Cue.Name), val);
|
||||
}
|
||||
}
|
||||
else
|
||||
Debug.Console(0, source, "No available outputs:");
|
||||
}
|
||||
}
|
||||
=======
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
public interface IHasFeedback : IKeyed
|
||||
{
|
||||
/// <summary>
|
||||
/// This method shall return a list of all Output objects on a device,
|
||||
/// including all "aggregate" devices.
|
||||
/// </summary>
|
||||
List<Feedback> Feedbacks { get; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static class IHasFeedbackExtensions
|
||||
{
|
||||
public static void DumpFeedbacksToConsole(this IHasFeedback source, bool getCurrentStates)
|
||||
{
|
||||
var feedbacks = source.Feedbacks.OrderBy(x => x.Type);
|
||||
if (feedbacks != null)
|
||||
{
|
||||
Debug.Console(0, source, "\n\nAvailable feedbacks:");
|
||||
foreach (var f in feedbacks)
|
||||
{
|
||||
string val = "";
|
||||
if (getCurrentStates)
|
||||
{
|
||||
if (f is BoolFeedback)
|
||||
val = " = " + f.BoolValue;
|
||||
else if(f is IntFeedback)
|
||||
val = " = " + f.IntValue;
|
||||
else if(f is StringFeedback)
|
||||
val = " = " + f.StringValue;
|
||||
|
||||
//switch (f.Type)
|
||||
//{
|
||||
// case eCueType.Bool:
|
||||
// val = " = " + f.BoolValue;
|
||||
// break;
|
||||
// case eCueType.Int:
|
||||
// val = " = " + f.IntValue;
|
||||
// break;
|
||||
// case eCueType.String:
|
||||
// val = " = " + f.StringValue;
|
||||
// break;
|
||||
// //case eOutputType.Other:
|
||||
// // break;
|
||||
//}
|
||||
}
|
||||
Debug.Console(0, "{0,-8} {1}{2}", f.GetType(),
|
||||
(string.IsNullOrEmpty(f.Cue.Name) ? "-none-" : f.Cue.Name), val);
|
||||
}
|
||||
}
|
||||
else
|
||||
Debug.Console(0, source, "No available outputs:");
|
||||
}
|
||||
}
|
||||
|
||||
public static class IHasFeedbackFusionExtensions
|
||||
{
|
||||
|
||||
}
|
||||
>>>>>>> origin/feature/ecs-307
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
public interface IHasFeedback : IKeyed
|
||||
{
|
||||
/// <summary>
|
||||
/// This method shall return a list of all Output objects on a device,
|
||||
/// including all "aggregate" devices.
|
||||
/// </summary>
|
||||
List<Feedback> Feedbacks { get; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static class IHasFeedbackExtensions
|
||||
{
|
||||
public static void DumpFeedbacksToConsole(this IHasFeedback source, bool getCurrentStates)
|
||||
{
|
||||
var feedbacks = source.Feedbacks.OrderBy(x => x.Type);
|
||||
if (feedbacks != null)
|
||||
{
|
||||
Debug.Console(0, source, "\n\nAvailable feedbacks:");
|
||||
foreach (var f in feedbacks)
|
||||
{
|
||||
string val = "";
|
||||
if (getCurrentStates)
|
||||
{
|
||||
if (f is BoolFeedback)
|
||||
val = " = " + f.BoolValue;
|
||||
else if(f is IntFeedback)
|
||||
val = " = " + f.IntValue;
|
||||
else if(f is StringFeedback)
|
||||
val = " = " + f.StringValue;
|
||||
|
||||
//switch (f.Type)
|
||||
//{
|
||||
// case eCueType.Bool:
|
||||
// val = " = " + f.BoolValue;
|
||||
// break;
|
||||
// case eCueType.Int:
|
||||
// val = " = " + f.IntValue;
|
||||
// break;
|
||||
// case eCueType.String:
|
||||
// val = " = " + f.StringValue;
|
||||
// break;
|
||||
// //case eOutputType.Other:
|
||||
// // break;
|
||||
//}
|
||||
}
|
||||
Debug.Console(0, "{0,-8} {1}{2}", f.GetType(),
|
||||
(string.IsNullOrEmpty(f.Cue.Name) ? "-none-" : f.Cue.Name), val);
|
||||
}
|
||||
}
|
||||
else
|
||||
Debug.Console(0, source, "No available outputs:");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using Crestron.SimplSharp.Reflection;
|
||||
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
public interface IHasFeedback : IKeyed
|
||||
{
|
||||
/// <summary>
|
||||
/// This method shall return a list of all Output objects on a device,
|
||||
/// including all "aggregate" devices.
|
||||
/// </summary>
|
||||
List<Feedback> Feedbacks { get; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static class IHasFeedbackExtensions
|
||||
{
|
||||
public static void DumpFeedbacksToConsole(this IHasFeedback source, bool getCurrentStates)
|
||||
{
|
||||
CType t = source.GetType();
|
||||
// get the properties and set them into a new collection of NameType wrappers
|
||||
var props = t.GetProperties().Select(p => new PropertyNameType(p, t));
|
||||
|
||||
|
||||
|
||||
var feedbacks = source.Feedbacks.OrderBy(x => x.Type);
|
||||
if (feedbacks != null)
|
||||
{
|
||||
Debug.Console(0, source, "\n\nAvailable feedbacks:");
|
||||
foreach (var f in feedbacks)
|
||||
{
|
||||
string val = "";
|
||||
string type = "";
|
||||
if (getCurrentStates)
|
||||
{
|
||||
if (f is BoolFeedback)
|
||||
{
|
||||
val = f.BoolValue.ToString();
|
||||
type = "boolean";
|
||||
}
|
||||
else if (f is IntFeedback)
|
||||
{
|
||||
val = f.IntValue.ToString();
|
||||
type = "integer";
|
||||
}
|
||||
else if (f is StringFeedback)
|
||||
{
|
||||
val = f.StringValue;
|
||||
type = "string";
|
||||
}
|
||||
}
|
||||
Debug.Console(0, "{0,-12} {1, -25} {2}", type,
|
||||
(string.IsNullOrEmpty(f.Cue.Name) ? "-no name-" : f.Cue.Name), val);
|
||||
}
|
||||
}
|
||||
else
|
||||
Debug.Console(0, source, "No available outputs:");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
public interface IHasFeedback : IKeyed
|
||||
{
|
||||
/// <summary>
|
||||
/// This method shall return a list of all Output objects on a device,
|
||||
/// including all "aggregate" devices.
|
||||
/// </summary>
|
||||
List<Feedback> Feedbacks { get; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static class IHasFeedbackExtensions
|
||||
{
|
||||
public static void DumpFeedbacksToConsole(this IHasFeedback source, bool getCurrentStates)
|
||||
{
|
||||
var feedbacks = source.Feedbacks.OrderBy(x => x.Type);
|
||||
if (feedbacks != null)
|
||||
{
|
||||
Debug.Console(0, source, "\n\nAvailable feedbacks:");
|
||||
foreach (var f in feedbacks)
|
||||
{
|
||||
string val = "";
|
||||
if (getCurrentStates)
|
||||
{
|
||||
if (f is BoolFeedback)
|
||||
val = " = " + f.BoolValue;
|
||||
else if(f is IntFeedback)
|
||||
val = " = " + f.IntValue;
|
||||
else if(f is StringFeedback)
|
||||
val = " = " + f.StringValue;
|
||||
|
||||
//switch (f.Type)
|
||||
//{
|
||||
// case eCueType.Bool:
|
||||
// val = " = " + f.BoolValue;
|
||||
// break;
|
||||
// case eCueType.Int:
|
||||
// val = " = " + f.IntValue;
|
||||
// break;
|
||||
// case eCueType.String:
|
||||
// val = " = " + f.StringValue;
|
||||
// break;
|
||||
// //case eOutputType.Other:
|
||||
// // break;
|
||||
//}
|
||||
}
|
||||
Debug.Console(0, "{0,-8} {1}{2}", f.GetType(),
|
||||
(string.IsNullOrEmpty(f.Cue.Name) ? "-none-" : f.Cue.Name), val);
|
||||
}
|
||||
}
|
||||
else
|
||||
Debug.Console(0, source, "No available outputs:");
|
||||
}
|
||||
}
|
||||
|
||||
public static class IHasFeedbackFusionExtensions
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
public interface IUsageTracking
|
||||
{
|
||||
UsageTracking UsageTracker { get; set; }
|
||||
}
|
||||
|
||||
//public static class IUsageTrackingExtensions
|
||||
//{
|
||||
// public static void EnableUsageTracker(this IUsageTracking device)
|
||||
// {
|
||||
// device.UsageTracker = new UsageTracking();
|
||||
// }
|
||||
//}
|
||||
|
||||
public class UsageTracking
|
||||
{
|
||||
public event EventHandler<DeviceUsageEventArgs> DeviceUsageEnded;
|
||||
|
||||
public InUseTracking InUseTracker { get; protected set; }
|
||||
|
||||
public bool UsageIsTracked { get; set; }
|
||||
|
||||
public bool UsageTrackingStarted { get; protected set; }
|
||||
public DateTime UsageStartTime { get; protected set; }
|
||||
public DateTime UsageEndTime { get; protected set; }
|
||||
|
||||
public Device Parent { get; private set; }
|
||||
|
||||
public UsageTracking(Device parent)
|
||||
{
|
||||
Parent = parent;
|
||||
|
||||
InUseTracker = new InUseTracking();
|
||||
|
||||
InUseTracker.InUseFeedback.OutputChange +=new EventHandler<EventArgs>(InUseFeedback_OutputChange);
|
||||
}
|
||||
|
||||
void InUseFeedback_OutputChange(object sender, EventArgs e)
|
||||
{
|
||||
if(InUseTracker.InUseFeedback.BoolValue)
|
||||
{
|
||||
StartDeviceUsage();
|
||||
}
|
||||
else
|
||||
{
|
||||
EndDeviceUsage();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Stores the usage start time
|
||||
/// </summary>
|
||||
public void StartDeviceUsage()
|
||||
{
|
||||
UsageTrackingStarted = true;
|
||||
UsageStartTime = DateTime.Now;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calculates the difference between the usage start and end times, gets the total minutes used and fires an event to pass that info to a consumer
|
||||
/// </summary>
|
||||
public void EndDeviceUsage()
|
||||
{
|
||||
try
|
||||
{
|
||||
UsageTrackingStarted = false;
|
||||
|
||||
UsageEndTime = DateTime.Now;
|
||||
|
||||
if (UsageStartTime != null)
|
||||
{
|
||||
var timeUsed = UsageEndTime - UsageStartTime;
|
||||
|
||||
var handler = DeviceUsageEnded;
|
||||
|
||||
if (handler != null)
|
||||
{
|
||||
Debug.Console(1, "Device Usage Ended for: {0} at {1}. In use for {2} minutes.", Parent.Name, UsageEndTime, timeUsed.Minutes);
|
||||
handler(this, new DeviceUsageEventArgs() { UsageEndTime = UsageEndTime, MinutesUsed = timeUsed.Minutes });
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Console(1, "Error ending device usage: {0}", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class DeviceUsageEventArgs : EventArgs
|
||||
{
|
||||
public DateTime UsageEndTime { get; set; }
|
||||
public int MinutesUsed { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
public interface IUsageTracking
|
||||
{
|
||||
UsageTracking UsageTracker { get; set; }
|
||||
}
|
||||
|
||||
//public static class IUsageTrackingExtensions
|
||||
//{
|
||||
// public static void EnableUsageTracker(this IUsageTracking device)
|
||||
// {
|
||||
// device.UsageTracker = new UsageTracking();
|
||||
// }
|
||||
//}
|
||||
|
||||
public class UsageTracking
|
||||
{
|
||||
public event EventHandler<DeviceUsageEventArgs> DeviceUsageEnded;
|
||||
|
||||
public InUseTracking InUseTracker { get; protected set; }
|
||||
|
||||
public bool UsageIsTracked { get; set; }
|
||||
public DateTime UsageStartTime { get; protected set; }
|
||||
public DateTime UsageEndTime { get; protected set; }
|
||||
|
||||
public Device Parent { get; private set; }
|
||||
|
||||
public UsageTracking(Device parent)
|
||||
{
|
||||
Parent = parent;
|
||||
|
||||
InUseTracker = new InUseTracking();
|
||||
|
||||
InUseTracker.InUseFeedback.OutputChange +=new EventHandler<EventArgs>(InUseFeedback_OutputChange);
|
||||
}
|
||||
|
||||
void InUseFeedback_OutputChange(object sender, EventArgs e)
|
||||
{
|
||||
if(InUseTracker.InUseFeedback.BoolValue)
|
||||
{
|
||||
StartDeviceUsage();
|
||||
}
|
||||
else
|
||||
{
|
||||
EndDeviceUsage();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Stores the usage start time
|
||||
/// </summary>
|
||||
public void StartDeviceUsage()
|
||||
{
|
||||
UsageStartTime = DateTime.Now;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calculates the difference between the usage start and end times, gets the total minutes used and fires an event to pass that info to a consumer
|
||||
/// </summary>
|
||||
public void EndDeviceUsage()
|
||||
{
|
||||
try
|
||||
{
|
||||
UsageEndTime = DateTime.Now;
|
||||
|
||||
if (UsageStartTime != null)
|
||||
{
|
||||
var timeUsed = UsageEndTime - UsageStartTime;
|
||||
|
||||
var handler = DeviceUsageEnded;
|
||||
|
||||
if (handler != null)
|
||||
{
|
||||
Debug.Console(1, "Device Usage Ended for: {0} at {1}. In use for {2} minutes.", Parent.Name, UsageEndTime, timeUsed.Minutes);
|
||||
handler(this, new DeviceUsageEventArgs() { UsageEndTime = UsageEndTime, MinutesUsed = timeUsed.Minutes });
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
Debug.Console(1, "Device Usage Ended at {0}. In use for {1} minutes.", UsageEndTime, timeUsed.Minutes);
|
||||
handler(this, new DeviceUsageEventArgs() { UsageEndTime = UsageEndTime, MinutesUsed = timeUsed.Minutes });
|
||||
=======
|
||||
Debug.Console(1, "Error ending device usage: {0}", e);
|
||||
>>>>>>> origin/feature/fusion-nyu
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class DeviceUsageEventArgs : EventArgs
|
||||
{
|
||||
public DateTime UsageEndTime { get; set; }
|
||||
public int MinutesUsed { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,98 +1,96 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines minimal volume control methods
|
||||
/// </summary>
|
||||
public interface IBasicVolumeControls
|
||||
{
|
||||
void VolumeUp(bool pressRelease);
|
||||
void VolumeDown(bool pressRelease);
|
||||
void MuteToggle();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds feedback and direct volume level set to IBasicVolumeControls
|
||||
/// </summary>
|
||||
public interface IBasicVolumeWithFeedback : IBasicVolumeControls
|
||||
{
|
||||
void SetVolume(ushort level);
|
||||
void MuteOn();
|
||||
void MuteOff();
|
||||
IntFeedback VolumeLevelFeedback { get; }
|
||||
BoolFeedback MuteFeedback { get; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public interface IFullAudioSettings : IBasicVolumeWithFeedback
|
||||
{
|
||||
void SetBalance(ushort level);
|
||||
void BalanceLeft(bool pressRelease);
|
||||
void BalanceRight(bool pressRelease);
|
||||
|
||||
void SetBass(ushort level);
|
||||
void BassUp(bool pressRelease);
|
||||
void BassDown(bool pressRelease);
|
||||
|
||||
void SetTreble(ushort level);
|
||||
void TrebleUp(bool pressRelease);
|
||||
void TrebleDown(bool pressRelease);
|
||||
|
||||
bool hasMaxVolume { get; }
|
||||
void SetMaxVolume(ushort level);
|
||||
void MaxVolumeUp(bool pressRelease);
|
||||
void MaxVolumeDown(bool pressRelease);
|
||||
|
||||
bool hasDefaultVolume { get; }
|
||||
void SetDefaultVolume(ushort level);
|
||||
void DefaultVolumeUp(bool pressRelease);
|
||||
void DefaultVolumeDown(bool pressRelease);
|
||||
|
||||
void LoudnessToggle();
|
||||
void MonoToggle();
|
||||
|
||||
BoolFeedback LoudnessFeedback { get; }
|
||||
BoolFeedback MonoFeedback { get; }
|
||||
IntFeedback BalanceFeedback { get; }
|
||||
IntFeedback BassFeedback { get; }
|
||||
IntFeedback TrebleFeedback { get; }
|
||||
IntFeedback MaxVolumeFeedback { get; }
|
||||
IntFeedback DefaultVolumeFeedback { get; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A class that implements this, contains a reference to an IBasicVolumeControls device.
|
||||
/// For example, speakers attached to an audio zone. The speakers can provide reference
|
||||
/// to their linked volume control.
|
||||
/// </summary>
|
||||
public interface IHasVolumeDevice
|
||||
{
|
||||
IBasicVolumeControls VolumeDevice { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Identifies a device that contains audio zones
|
||||
/// </summary>
|
||||
public interface IAudioZones : IRouting
|
||||
{
|
||||
Dictionary<uint, IAudioZone> Zone { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines minimum functionality for an audio zone
|
||||
/// </summary>
|
||||
public interface IAudioZone : IBasicVolumeWithFeedback
|
||||
{
|
||||
void SelectInput(ushort input);
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines minimal volume control methods
|
||||
/// </summary>
|
||||
public interface IBasicVolumeControls
|
||||
{
|
||||
void VolumeUp(bool pressRelease);
|
||||
void VolumeDown(bool pressRelease);
|
||||
void MuteToggle();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds feedback and direct volume level set to IBasicVolumeControls
|
||||
/// </summary>
|
||||
public interface IBasicVolumeWithFeedback : IBasicVolumeControls
|
||||
{
|
||||
void SetVolume(ushort level);
|
||||
void MuteOn();
|
||||
void MuteOff();
|
||||
IntFeedback VolumeLevelFeedback { get; }
|
||||
BoolFeedback MuteFeedback { get; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public interface IFullAudioSettings : IBasicVolumeWithFeedback
|
||||
{
|
||||
void SetBalance(ushort level);
|
||||
void BalanceLeft(bool pressRelease);
|
||||
void BalanceRight(bool pressRelease);
|
||||
|
||||
void SetBass(ushort level);
|
||||
void BassUp(bool pressRelease);
|
||||
void BassDown(bool pressRelease);
|
||||
|
||||
void SetTreble(ushort level);
|
||||
void TrebleUp(bool pressRelease);
|
||||
void TrebleDown(bool pressRelease);
|
||||
|
||||
bool hasMaxVolume { get; }
|
||||
void SetMaxVolume(ushort level);
|
||||
void MaxVolumeUp(bool pressRelease);
|
||||
void MaxVolumeDown(bool pressRelease);
|
||||
|
||||
bool hasDefaultVolume { get; }
|
||||
void SetDefaultVolume(ushort level);
|
||||
void DefaultVolumeUp(bool pressRelease);
|
||||
void DefaultVolumeDown(bool pressRelease);
|
||||
|
||||
void LoudnessToggle();
|
||||
void MonoToggle();
|
||||
|
||||
BoolFeedback LoudnessFeedback { get; }
|
||||
BoolFeedback MonoFeedback { get; }
|
||||
IntFeedback BalanceFeedback { get; }
|
||||
IntFeedback BassFeedback { get; }
|
||||
IntFeedback TrebleFeedback { get; }
|
||||
IntFeedback MaxVolumeFeedback { get; }
|
||||
IntFeedback DefaultVolumeFeedback { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A class that implements this, contains a reference to an IBasicVolumeControls device.
|
||||
/// For example, speakers attached to an audio zone. The speakers can provide reference
|
||||
/// to their linked volume control.
|
||||
/// </summary>
|
||||
public interface IHasVolumeDevice
|
||||
{
|
||||
IBasicVolumeControls VolumeDevice { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Identifies a device that contains audio zones
|
||||
/// </summary>
|
||||
public interface IAudioZones : IRouting
|
||||
{
|
||||
Dictionary<uint, IAudioZone> Zone { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines minimum functionality for an audio zone
|
||||
/// </summary>
|
||||
public interface IAudioZone : IBasicVolumeWithFeedback
|
||||
{
|
||||
void SelectInput(ushort input);
|
||||
}
|
||||
}
|
||||
@@ -1,92 +0,0 @@
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
|
||||
//namespace PepperDash.Essentials.Core
|
||||
//{
|
||||
// //*********************************************************************************************************
|
||||
// /// <summary>
|
||||
// /// The core event and status-bearing class that most if not all device and connectors can derive from.
|
||||
// /// </summary>
|
||||
// public class Device : IKeyed
|
||||
// {
|
||||
// public string Key { get; protected set; }
|
||||
// public string Name { get; protected set; }
|
||||
// public bool Enabled { get; protected set; }
|
||||
// List<Action> _PreActivationActions;
|
||||
// List<Action> _PostActivationActions;
|
||||
|
||||
// public static Device DefaultDevice { get { return _DefaultDevice; } }
|
||||
// static Device _DefaultDevice = new Device("Default", "Default");
|
||||
|
||||
// /// <summary>
|
||||
// /// Base constructor for all Devices.
|
||||
// /// </summary>
|
||||
// /// <param name="key"></param>
|
||||
// public Device(string key)
|
||||
// {
|
||||
// Key = key;
|
||||
// if (key.Contains('.')) Debug.Console(0, this, "WARNING: Device name's should not include '.'");
|
||||
// Name = "";
|
||||
// }
|
||||
|
||||
// public Device(string key, string name) : this(key)
|
||||
// {
|
||||
// Name = name;
|
||||
// }
|
||||
|
||||
// public void AddPreActivationAction(Action act)
|
||||
// {
|
||||
// if (_PreActivationActions == null)
|
||||
// _PreActivationActions = new List<Action>();
|
||||
// _PreActivationActions.Add(act);
|
||||
// }
|
||||
|
||||
// public void AddPostActivationAction(Action act)
|
||||
// {
|
||||
// if (_PostActivationActions == null)
|
||||
// _PostActivationActions = new List<Action>();
|
||||
// _PostActivationActions.Add(act);
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// Gets this device ready to be used in the system. Runs any added pre-activation items, and
|
||||
// /// all post-activation at end. Classes needing additional logic to
|
||||
// /// run should override CustomActivate()
|
||||
// /// </summary>
|
||||
// public bool Activate()
|
||||
// {
|
||||
// if (_PreActivationActions != null)
|
||||
// _PreActivationActions.ForEach(a => a.Invoke());
|
||||
// var result = CustomActivate();
|
||||
// if(result && _PostActivationActions != null)
|
||||
// _PostActivationActions.ForEach(a => a.Invoke());
|
||||
// return result;
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// Called in between Pre and PostActivationActions when Activate() is called.
|
||||
// /// Override to provide addtitional setup when calling activation. Overriding classes
|
||||
// /// do not need to call base.CustomActivate()
|
||||
// /// </summary>
|
||||
// /// <returns>true if device activated successfully.</returns>
|
||||
// public virtual bool CustomActivate() { return true; }
|
||||
|
||||
// /// <summary>
|
||||
// /// Call to deactivate device - unlink events, etc. Overriding classes do not
|
||||
// /// need to call base.Deactivate()
|
||||
// /// </summary>
|
||||
// /// <returns></returns>
|
||||
// public virtual bool Deactivate() { return true; }
|
||||
|
||||
// /// <summary>
|
||||
// /// Helper method to check object for bool value false and fire an Action method
|
||||
// /// </summary>
|
||||
// /// <param name="o">Should be of type bool, others will be ignored</param>
|
||||
// /// <param name="a">Action to be run when o is false</param>
|
||||
// public void OnFalse(object o, Action a)
|
||||
// {
|
||||
// if (o is bool && !(bool)o) a();
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
@@ -1,44 +0,0 @@
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using Crestron.SimplSharp;
|
||||
//using Crestron.SimplSharpPro;
|
||||
//using Crestron.SimplSharpPro.DeviceSupport;
|
||||
//using Crestron.SimplSharpPro.EthernetCommunication;
|
||||
//using Crestron.SimplSharpPro.UI;
|
||||
|
||||
//using PepperDash.Core;
|
||||
|
||||
|
||||
//namespace PepperDash.Essentials.Core
|
||||
//{
|
||||
|
||||
//[Obsolete]
|
||||
// public class PresentationDevice : Device, IPresentationSource
|
||||
// {
|
||||
// public PresentationSourceType Type { get; protected set; }
|
||||
// public string IconName { get { return "Blank"; } set { } }
|
||||
// public BoolFeedback HasPowerOnFeedback { get; protected set; }
|
||||
|
||||
// PresentationDevice()
|
||||
// : base("Default", "Default")
|
||||
// {
|
||||
// HasPowerOnFeedback = new BoolFeedback(CommonBoolCue.HasPowerFeedback, () => false);
|
||||
// Type = PresentationSourceType.None;
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// Returns a "default" presentation device, with no abilities.
|
||||
// /// </summary>
|
||||
// public static IPresentationSource Default
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// if (_Default == null)
|
||||
// _Default = new PresentationDevice();
|
||||
// return _Default;
|
||||
// }
|
||||
// }
|
||||
// static IPresentationSource _Default;
|
||||
// }
|
||||
//}
|
||||
@@ -1,52 +0,0 @@
|
||||
//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;
|
||||
|
||||
//namespace PepperDash.Essentials.Core
|
||||
//{
|
||||
|
||||
// public class DeviceConfig
|
||||
// {
|
||||
// public string Key { get; set; }
|
||||
// public string Name { get; set; }
|
||||
// public string Type { get; set; }
|
||||
// [JsonConverter(typeof(DevicePropertiesJsonConverter))]
|
||||
// public JToken Properties { get; set; }
|
||||
|
||||
|
||||
// }
|
||||
|
||||
// /// <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
|
||||
// /// </summary>
|
||||
// public class DevicePropertiesJsonConverter : JsonConverter
|
||||
// {
|
||||
// public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
|
||||
// {
|
||||
// return JObject.Load(reader);
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// This will be hit with every value in the ComPortConfig class. We only need to
|
||||
// /// do custom conversion on the comspec items.
|
||||
// /// </summary>
|
||||
// public override bool CanConvert(Type objectType)
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// public override bool CanRead { get { return true; } }
|
||||
// public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
@@ -1,50 +0,0 @@
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Text;
|
||||
//using Crestron.SimplSharp;
|
||||
//using Crestron.SimplSharpPro;
|
||||
//using Crestron.SimplSharpPro.DeviceSupport;
|
||||
|
||||
//using PepperDash.Core;
|
||||
|
||||
|
||||
//namespace PepperDash.Essentials.Core
|
||||
//{
|
||||
// public abstract class DvdDeviceBase : Device, IPresentationSource, IHasCueActionList
|
||||
// {
|
||||
// public DvdDeviceBase(string key, string name)
|
||||
// : base(key, name)
|
||||
// {
|
||||
// HasPowerOnFeedback = new BoolFeedback(() => false);
|
||||
|
||||
// }
|
||||
|
||||
// #region IPresentationSource Members
|
||||
|
||||
// PresentationSourceType IPresentationSource.Type
|
||||
// {
|
||||
// get { return PresentationSourceType.Dvd; }
|
||||
// }
|
||||
|
||||
// public string IconName
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// return "DVD";
|
||||
// }
|
||||
// set { }
|
||||
// }
|
||||
|
||||
// public virtual BoolFeedback HasPowerOnFeedback { get; private set; }
|
||||
|
||||
// #endregion
|
||||
|
||||
// #region IFunctionList Members
|
||||
|
||||
// public abstract List<CueActionPair> CueActionList { get; }
|
||||
|
||||
// #endregion
|
||||
|
||||
// }
|
||||
//}
|
||||
@@ -1,130 +0,0 @@
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using Crestron.SimplSharpPro;
|
||||
|
||||
//using PepperDash.Essentials.Core;
|
||||
|
||||
//using PepperDash.Core;
|
||||
|
||||
|
||||
//namespace PepperDash.Essentials.Core
|
||||
//{
|
||||
// /// <summary>
|
||||
// /// This DVD class should cover most IR, one-way DVD and Bluray fuctions
|
||||
// /// </summary>
|
||||
// public class IrDvdBase : Device, IHasCueActionList,
|
||||
// IPresentationSource, IAttachVideoStatus, IHasFeedback, IRoutingOutputs
|
||||
// {
|
||||
// public PresentationSourceType Type { get; protected set; }
|
||||
// public string IconName { get; set; }
|
||||
|
||||
// public BoolFeedback HasPowerOnFeedback { get; private set; }
|
||||
// public IrOutputPortController IrPort { get; private set; }
|
||||
|
||||
// public RoutingOutputPort HdmiOut { get; private set; }
|
||||
|
||||
// #region IRoutingOutputs Members
|
||||
|
||||
// /// <summary>
|
||||
// /// Options: hdmi
|
||||
// /// </summary>
|
||||
// public RoutingPortCollection<RoutingOutputPort> OutputPorts { get; private set; }
|
||||
|
||||
// #endregion
|
||||
|
||||
// public IrDvdBase(string key, string name, IROutputPort port, IrDriverInfo driverInfo)
|
||||
// : base(key, name)
|
||||
// {
|
||||
// IrPort = new IrOutputPortController("ir-" + key, port, driverInfo.FileName);
|
||||
// Type = PresentationSourceType.Dvd;
|
||||
// IconName = "Bluray";
|
||||
// HasPowerOnFeedback = new BoolFeedback(CommonBoolCue.HasPowerFeedback, () => false);
|
||||
|
||||
// HdmiOut = new RoutingOutputPort("HDMI", eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, 0, this);
|
||||
// OutputPorts = new RoutingPortCollection<RoutingOutputPort>()
|
||||
// {
|
||||
// HdmiOut
|
||||
// };
|
||||
// CueActionList = IrPort.GetUOsForIrCommands(driverInfo.IrMap);
|
||||
// }
|
||||
|
||||
// public IrDvdBase(string key, string name, IROutputPort port, string irDriverFilepath)
|
||||
// : base(key, name)
|
||||
// {
|
||||
// IrPort = new IrOutputPortController("ir-" + key, port, irDriverFilepath);
|
||||
// Type = PresentationSourceType.Dvd;
|
||||
// IconName = "Bluray";
|
||||
// HasPowerOnFeedback = new BoolFeedback(CommonBoolCue.HasPowerFeedback, () => false);
|
||||
|
||||
// HdmiOut = new RoutingOutputPort("HDMI", eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, 0, this);
|
||||
// OutputPorts = new RoutingPortCollection<RoutingOutputPort>()
|
||||
// {
|
||||
// HdmiOut
|
||||
// };
|
||||
// var numToIr = new Dictionary<Cue, string>
|
||||
// {
|
||||
// { CommonBoolCue.Power, IROutputStandardCommands.IROut_POWER },
|
||||
// { CommonBoolCue.PowerOff, IROutputStandardCommands.IROut_POWER_OFF },
|
||||
// { CommonBoolCue.PowerOn, IROutputStandardCommands.IROut_POWER_ON },
|
||||
// { CommonBoolCue.Replay, IROutputStandardCommands.IROut_REPLAY },
|
||||
// { CommonBoolCue.Play, IROutputStandardCommands.IROut_PLAY },
|
||||
// { CommonBoolCue.Pause, IROutputStandardCommands.IROut_PAUSE },
|
||||
// { CommonBoolCue.Stop, IROutputStandardCommands.IROut_STOP },
|
||||
// { CommonBoolCue.ChapPrevious, IROutputStandardCommands.IROut_TRACK_MINUS },
|
||||
// { CommonBoolCue.ChapNext, IROutputStandardCommands.IROut_TRACK_PLUS },
|
||||
// { CommonBoolCue.Rewind, IROutputStandardCommands.IROut_RSCAN },
|
||||
// { CommonBoolCue.Ffwd, IROutputStandardCommands.IROut_FSCAN },
|
||||
// { CommonBoolCue.RStep, IROutputStandardCommands.IROut_R_STEP },
|
||||
// { CommonBoolCue.FStep, IROutputStandardCommands.IROut_F_STEP },
|
||||
// { CommonBoolCue.Exit, IROutputStandardCommands.IROut_EXIT },
|
||||
// { CommonBoolCue.Home, IROutputStandardCommands.IROut_HOME },
|
||||
// { CommonBoolCue.Menu, IROutputStandardCommands.IROut_MENU },
|
||||
// { CommonBoolCue.PopUp, IROutputStandardCommands.IROut_POPUPMENU },
|
||||
// { CommonBoolCue.Up, IROutputStandardCommands.IROut_UP_ARROW },
|
||||
// { CommonBoolCue.Down, IROutputStandardCommands.IROut_DN_ARROW },
|
||||
// { CommonBoolCue.Left, IROutputStandardCommands.IROut_LEFT_ARROW },
|
||||
// { CommonBoolCue.Right, IROutputStandardCommands.IROut_RIGHT_ARROW },
|
||||
// { CommonBoolCue.Select, IROutputStandardCommands.IROut_ENTER },
|
||||
// { CommonBoolCue.Info, IROutputStandardCommands.IROut_INFO },
|
||||
// { CommonBoolCue.Red, IROutputStandardCommands.IROut_RED },
|
||||
// { CommonBoolCue.Green, IROutputStandardCommands.IROut_GREEN },
|
||||
// { CommonBoolCue.Yellow, IROutputStandardCommands.IROut_YELLOW },
|
||||
// { CommonBoolCue.Blue, IROutputStandardCommands.IROut_BLUE },
|
||||
// { CommonBoolCue.Digit0, IROutputStandardCommands.IROut_0 },
|
||||
// { CommonBoolCue.Digit1, IROutputStandardCommands.IROut_1 },
|
||||
// { CommonBoolCue.Digit2, IROutputStandardCommands.IROut_2 },
|
||||
// { CommonBoolCue.Digit3, IROutputStandardCommands.IROut_3 },
|
||||
// { CommonBoolCue.Digit4, IROutputStandardCommands.IROut_4 },
|
||||
// { CommonBoolCue.Digit5, IROutputStandardCommands.IROut_5 },
|
||||
// { CommonBoolCue.Digit6, IROutputStandardCommands.IROut_6 },
|
||||
// { CommonBoolCue.Digit7, IROutputStandardCommands.IROut_7 },
|
||||
// { CommonBoolCue.Digit8, IROutputStandardCommands.IROut_8 },
|
||||
// { CommonBoolCue.Digit9, IROutputStandardCommands.IROut_9 },
|
||||
// { CommonBoolCue.Audio, "AUDIO" },
|
||||
// { CommonBoolCue.Subtitle, "SUBTITLE" },
|
||||
// { CommonBoolCue.Setup, "SETUP" },
|
||||
// };
|
||||
// CueActionList = IrPort.GetUOsForIrCommands(numToIr);
|
||||
// }
|
||||
|
||||
|
||||
// public List<Feedback> Feedbacks
|
||||
// {
|
||||
// get { return this.GetVideoStatuses().ToList(); }
|
||||
// }
|
||||
|
||||
|
||||
// #region IFunctionList Members
|
||||
|
||||
// public List<CueActionPair> CueActionList { get; set; }
|
||||
|
||||
// #endregion
|
||||
// }
|
||||
|
||||
// public class IrDriverInfo
|
||||
// {
|
||||
// public Dictionary<Cue, string> IrMap { get; set; }
|
||||
// public string FileName { get; set; }
|
||||
// }
|
||||
//}
|
||||
@@ -1,143 +0,0 @@
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using Crestron.SimplSharpPro;
|
||||
|
||||
//using PepperDash.Essentials.Core;
|
||||
//using PepperDash.Essentials.Core.Presets;
|
||||
|
||||
//using PepperDash.Core;
|
||||
|
||||
|
||||
//namespace PepperDash.Essentials.Core
|
||||
//{
|
||||
// /// <summary>
|
||||
// /// This DVD class should cover most IR, one-way DVD and Bluray fuctions
|
||||
// /// </summary>
|
||||
// public class IrSetTopBoxBase : Device, IHasCueActionList,
|
||||
// IPresentationSource, IAttachVideoStatus, IHasFeedback, IRoutingOutputs, IHasSetTopBoxProperties
|
||||
// {
|
||||
// public PresentationSourceType Type { get; protected set; }
|
||||
// public string IconName { get; set; }
|
||||
|
||||
// public BoolFeedback HasPowerOnFeedback { get; private set; }
|
||||
// public IrOutputPortController IrPort { get; private set; }
|
||||
|
||||
// public DevicePresetsModel PresetsModel { get; private set; }
|
||||
|
||||
// #region IRoutingOutputs Members
|
||||
|
||||
// /// <summary>
|
||||
// /// Options: hdmi
|
||||
// /// </summary>
|
||||
// public RoutingPortCollection<RoutingOutputPort> OutputPorts { get; private set; }
|
||||
|
||||
// #endregion
|
||||
|
||||
// public IrSetTopBoxBase(string key, string name, IROutputPort port, string irDriverFilepath)
|
||||
// : base(key, name)
|
||||
// {
|
||||
// IrPort = new IrOutputPortController("ir-" + key, port, irDriverFilepath);
|
||||
// Type = PresentationSourceType.SetTopBox;
|
||||
// IconName = "TV";
|
||||
// HasPowerOnFeedback = new BoolFeedback(CommonBoolCue.HasPowerFeedback, () => false);
|
||||
// OutputPorts = new RoutingPortCollection<RoutingOutputPort>()
|
||||
// {
|
||||
// new RoutingOutputPort("HDMI", eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, 0, this)
|
||||
// };
|
||||
// }
|
||||
|
||||
// public void LoadPresets(string filePath)
|
||||
// {
|
||||
// //PresetsModel = new DevicePresetsModel(Key + "-presets", this, filePath);
|
||||
// //DeviceManager.AddDevice(PresetsModel);
|
||||
// }
|
||||
|
||||
// #region IDeviceWithOutputs Members
|
||||
|
||||
// public List<Feedback> Feedbacks
|
||||
// {
|
||||
// get { return this.GetVideoStatuses().ToList(); }
|
||||
// }
|
||||
|
||||
// #endregion
|
||||
|
||||
// #region IFunctionList Members
|
||||
|
||||
// public List<CueActionPair> CueActionList
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// // This might be the best way to get the words back into functions
|
||||
// new BoolCueActionPair(CommonBoolCue.Power, b => IrPort.PressRelease(IROutputStandardCommands.IROut_POWER, b));
|
||||
// new BoolCueActionPair(CommonBoolCue.PowerOn, b => IrPort.PressRelease(IROutputStandardCommands.IROut_POWER_ON, b));
|
||||
// new BoolCueActionPair(CommonBoolCue.PowerOff, b => IrPort.PressRelease(IROutputStandardCommands.IROut_POWER_OFF, b));
|
||||
// new BoolCueActionPair(CommonBoolCue.ChannelUp, b => IrPort.PressRelease(IROutputStandardCommands.IROut_CH_PLUS, b));
|
||||
|
||||
// var numToIr = new Dictionary<Cue, string>
|
||||
// {
|
||||
// { CommonBoolCue.Power, IROutputStandardCommands.IROut_POWER },
|
||||
// { CommonBoolCue.PowerOn, IROutputStandardCommands.IROut_POWER_ON },
|
||||
// { CommonBoolCue.PowerOff, IROutputStandardCommands.IROut_POWER_OFF },
|
||||
// { CommonBoolCue.ChannelUp, IROutputStandardCommands.IROut_CH_PLUS },
|
||||
// { CommonBoolCue.ChannelDown, IROutputStandardCommands.IROut_CH_MINUS },
|
||||
// { CommonBoolCue.Last, IROutputStandardCommands.IROut_LAST },
|
||||
// { CommonBoolCue.Play, IROutputStandardCommands.IROut_PLAY },
|
||||
// { CommonBoolCue.Pause, IROutputStandardCommands.IROut_PAUSE },
|
||||
// { CommonBoolCue.Stop, IROutputStandardCommands.IROut_STOP },
|
||||
// { CommonBoolCue.ChapPrevious, IROutputStandardCommands.IROut_TRACK_MINUS },
|
||||
// { CommonBoolCue.ChapNext, IROutputStandardCommands.IROut_TRACK_PLUS },
|
||||
// { CommonBoolCue.Rewind, IROutputStandardCommands.IROut_RSCAN },
|
||||
// { CommonBoolCue.Ffwd, IROutputStandardCommands.IROut_FSCAN },
|
||||
// { CommonBoolCue.Replay, IROutputStandardCommands.IROut_REPLAY },
|
||||
// { CommonBoolCue.Advance, "ADVANCE" },
|
||||
// { CommonBoolCue.Record, IROutputStandardCommands.IROut_RECORD },
|
||||
// { CommonBoolCue.Exit, IROutputStandardCommands.IROut_EXIT },
|
||||
// { CommonBoolCue.Menu, IROutputStandardCommands.IROut_MENU },
|
||||
// { CommonBoolCue.List, IROutputStandardCommands.IROut_DVR },
|
||||
// { CommonBoolCue.Dvr, IROutputStandardCommands.IROut_DVR },
|
||||
// { CommonBoolCue.Back, IROutputStandardCommands.IROut_BACK },
|
||||
// { CommonBoolCue.Up, IROutputStandardCommands.IROut_UP_ARROW },
|
||||
// { CommonBoolCue.Down, IROutputStandardCommands.IROut_DN_ARROW },
|
||||
// { CommonBoolCue.Left, IROutputStandardCommands.IROut_LEFT_ARROW },
|
||||
// { CommonBoolCue.Right, IROutputStandardCommands.IROut_RIGHT_ARROW },
|
||||
// { CommonBoolCue.Select, IROutputStandardCommands.IROut_ENTER },
|
||||
// { CommonBoolCue.Guide, IROutputStandardCommands.IROut_GUIDE },
|
||||
// { CommonBoolCue.PageUp, IROutputStandardCommands.IROut_PAGE_UP },
|
||||
// { CommonBoolCue.PageDown, IROutputStandardCommands.IROut_PAGE_DOWN },
|
||||
// { CommonBoolCue.Info, IROutputStandardCommands.IROut_INFO },
|
||||
// { CommonBoolCue.Red, IROutputStandardCommands.IROut_RED },
|
||||
// { CommonBoolCue.Green, IROutputStandardCommands.IROut_GREEN },
|
||||
// { CommonBoolCue.Yellow, IROutputStandardCommands.IROut_YELLOW },
|
||||
// { CommonBoolCue.Blue, IROutputStandardCommands.IROut_BLUE },
|
||||
// { CommonBoolCue.Digit0, IROutputStandardCommands.IROut_0 },
|
||||
// { CommonBoolCue.Digit1, IROutputStandardCommands.IROut_1 },
|
||||
// { CommonBoolCue.Digit2, IROutputStandardCommands.IROut_2 },
|
||||
// { CommonBoolCue.Digit3, IROutputStandardCommands.IROut_3 },
|
||||
// { CommonBoolCue.Digit4, IROutputStandardCommands.IROut_4 },
|
||||
// { CommonBoolCue.Digit5, IROutputStandardCommands.IROut_5 },
|
||||
// { CommonBoolCue.Digit6, IROutputStandardCommands.IROut_6 },
|
||||
// { CommonBoolCue.Digit7, IROutputStandardCommands.IROut_7 },
|
||||
// { CommonBoolCue.Digit8, IROutputStandardCommands.IROut_8 },
|
||||
// { CommonBoolCue.Digit9, IROutputStandardCommands.IROut_9 },
|
||||
// { CommonBoolCue.Dash, "DASH" },
|
||||
// };
|
||||
// return IrPort.GetUOsForIrCommands(numToIr);
|
||||
// }
|
||||
// }
|
||||
|
||||
// #endregion
|
||||
|
||||
// #region IHasSetTopBoxProperties Members
|
||||
|
||||
// public bool HasDpad { get; set; }
|
||||
|
||||
// public bool HasPreset { get; set; }
|
||||
|
||||
// public bool HasDvr { get; set; }
|
||||
|
||||
// public bool HasNumbers { get; set; }
|
||||
|
||||
// #endregion
|
||||
// }
|
||||
//}
|
||||
@@ -1,99 +1,127 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.DM;
|
||||
using Crestron.SimplSharpPro.DM.Endpoints;
|
||||
using Crestron.SimplSharpPro.DM.Endpoints.Transmitters;
|
||||
|
||||
using PepperDash.Core;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public abstract class DisplayBase : Device, IHasFeedback, IRoutingSinkWithSwitching, IPower, IWarmingCooling
|
||||
{
|
||||
public BoolFeedback PowerIsOnFeedback { get; protected set; }
|
||||
public BoolFeedback IsCoolingDownFeedback { get; protected set; }
|
||||
public BoolFeedback IsWarmingUpFeedback { get; private set; }
|
||||
|
||||
public uint WarmupTime { get; set; }
|
||||
public uint CooldownTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Bool Func that will provide a value for the PowerIsOn Output. Must be implemented
|
||||
/// by concrete sub-classes
|
||||
/// </summary>
|
||||
abstract protected Func<bool> PowerIsOnFeedbackFunc { get; }
|
||||
abstract protected Func<bool> IsCoolingDownFeedbackFunc { get; }
|
||||
abstract protected Func<bool> IsWarmingUpFeedbackFunc { get; }
|
||||
|
||||
protected CTimer WarmupTimer;
|
||||
protected CTimer CooldownTimer;
|
||||
|
||||
#region IRoutingInputs Members
|
||||
|
||||
public RoutingPortCollection<RoutingInputPort> InputPorts { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
public DisplayBase(string key, string name)
|
||||
: base(key, name)
|
||||
{
|
||||
PowerIsOnFeedback = new BoolFeedback(CommonBoolCue.PowerOnFeedback, PowerIsOnFeedbackFunc);
|
||||
IsCoolingDownFeedback = new BoolFeedback(CommonBoolCue.IsCoolingDown, IsCoolingDownFeedbackFunc);
|
||||
IsWarmingUpFeedback = new BoolFeedback(CommonBoolCue.IsWarmingUp, IsWarmingUpFeedbackFunc);
|
||||
|
||||
InputPorts = new RoutingPortCollection<RoutingInputPort>();
|
||||
}
|
||||
|
||||
public abstract void PowerOn();
|
||||
public abstract void PowerOff();
|
||||
public abstract void PowerToggle();
|
||||
|
||||
public virtual List<Feedback> Feedbacks
|
||||
{
|
||||
get
|
||||
{
|
||||
return new List<Feedback>
|
||||
{
|
||||
PowerIsOnFeedback,
|
||||
IsCoolingDownFeedback,
|
||||
IsWarmingUpFeedback
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void ExecuteSwitch(object selector);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public abstract class TwoWayDisplayBase : DisplayBase
|
||||
{
|
||||
public static MockDisplay DefaultDisplay {
|
||||
get
|
||||
{
|
||||
if (_DefaultDisplay == null)
|
||||
_DefaultDisplay = new MockDisplay("default", "Default Display");
|
||||
return _DefaultDisplay;
|
||||
}
|
||||
}
|
||||
static MockDisplay _DefaultDisplay;
|
||||
|
||||
public TwoWayDisplayBase(string key, string name)
|
||||
: base(key, name)
|
||||
{
|
||||
WarmupTime = 7000;
|
||||
CooldownTime = 15000;
|
||||
}
|
||||
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.DM;
|
||||
using Crestron.SimplSharpPro.DM.Endpoints;
|
||||
using Crestron.SimplSharpPro.DM.Endpoints.Transmitters;
|
||||
|
||||
using PepperDash.Core;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public abstract class DisplayBase : Device, IHasFeedback, IRoutingSinkWithSwitching, IPower, IWarmingCooling, IUsageTracking
|
||||
{
|
||||
public BoolFeedback PowerIsOnFeedback { get; protected set; }
|
||||
public BoolFeedback IsCoolingDownFeedback { get; protected set; }
|
||||
public BoolFeedback IsWarmingUpFeedback { get; private set; }
|
||||
|
||||
public UsageTracking UsageTracker { get; set; }
|
||||
|
||||
public uint WarmupTime { get; set; }
|
||||
public uint CooldownTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Bool Func that will provide a value for the PowerIsOn Output. Must be implemented
|
||||
/// by concrete sub-classes
|
||||
/// </summary>
|
||||
abstract protected Func<bool> PowerIsOnFeedbackFunc { get; }
|
||||
abstract protected Func<bool> IsCoolingDownFeedbackFunc { get; }
|
||||
abstract protected Func<bool> IsWarmingUpFeedbackFunc { get; }
|
||||
|
||||
|
||||
protected CTimer WarmupTimer;
|
||||
protected CTimer CooldownTimer;
|
||||
|
||||
#region IRoutingInputs Members
|
||||
|
||||
public RoutingPortCollection<RoutingInputPort> InputPorts { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
public DisplayBase(string key, string name)
|
||||
: base(key, name)
|
||||
{
|
||||
PowerIsOnFeedback = new BoolFeedback(CommonBoolCue.PowerOnFeedback, PowerIsOnFeedbackFunc);
|
||||
IsCoolingDownFeedback = new BoolFeedback(CommonBoolCue.IsCoolingDown, IsCoolingDownFeedbackFunc);
|
||||
IsWarmingUpFeedback = new BoolFeedback(CommonBoolCue.IsWarmingUp, IsWarmingUpFeedbackFunc);
|
||||
|
||||
InputPorts = new RoutingPortCollection<RoutingInputPort>();
|
||||
|
||||
PowerIsOnFeedback.OutputChange += new EventHandler<EventArgs>(PowerIsOnFeedback_OutputChange);
|
||||
}
|
||||
|
||||
void PowerIsOnFeedback_OutputChange(object sender, EventArgs e)
|
||||
{
|
||||
if (UsageTracker != null)
|
||||
{
|
||||
if (PowerIsOnFeedback.BoolValue)
|
||||
UsageTracker.StartDeviceUsage();
|
||||
else
|
||||
UsageTracker.EndDeviceUsage();
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void PowerOn();
|
||||
public abstract void PowerOff();
|
||||
public abstract void PowerToggle();
|
||||
|
||||
public virtual List<Feedback> Feedbacks
|
||||
{
|
||||
get
|
||||
{
|
||||
return new List<Feedback>
|
||||
{
|
||||
PowerIsOnFeedback,
|
||||
IsCoolingDownFeedback,
|
||||
IsWarmingUpFeedback
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void ExecuteSwitch(object selector);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public abstract class TwoWayDisplayBase : DisplayBase
|
||||
{
|
||||
public StringFeedback CurrentInputFeedback { get; private set; }
|
||||
|
||||
abstract protected Func<string> CurrentInputFeedbackFunc { get; }
|
||||
|
||||
|
||||
public static MockDisplay DefaultDisplay
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_DefaultDisplay == null)
|
||||
_DefaultDisplay = new MockDisplay("default", "Default Display");
|
||||
return _DefaultDisplay;
|
||||
}
|
||||
}
|
||||
static MockDisplay _DefaultDisplay;
|
||||
|
||||
public TwoWayDisplayBase(string key, string name)
|
||||
: base(key, name)
|
||||
{
|
||||
CurrentInputFeedback = new StringFeedback(CurrentInputFeedbackFunc);
|
||||
|
||||
WarmupTime = 7000;
|
||||
CooldownTime = 15000;
|
||||
|
||||
Feedbacks.Add(CurrentInputFeedback);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -33,6 +33,7 @@ namespace PepperDash.Essentials.Core
|
||||
protected override Func<bool> PowerIsOnFeedbackFunc { get { return () => _PowerIsOn; } }
|
||||
protected override Func<bool> IsCoolingDownFeedbackFunc { get { return () => _IsCoolingDown; } }
|
||||
protected override Func<bool> IsWarmingUpFeedbackFunc { get { return () => _IsWarmingUp; } }
|
||||
protected override Func<string> CurrentInputFeedbackFunc { get { return () => "Not Implemented"; } }
|
||||
|
||||
int VolumeHeldRepeatInterval = 200;
|
||||
ushort VolumeInterval = 655;
|
||||
|
||||
@@ -103,6 +103,11 @@ namespace PepperDash.Essentials.Core
|
||||
LinkedComplementInputSigs.Remove(sig);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return BoolValue.ToString();
|
||||
}
|
||||
|
||||
void UpdateSig(BoolInputSig sig)
|
||||
{
|
||||
sig.BoolValue = _BoolValue;
|
||||
@@ -160,6 +165,11 @@ namespace PepperDash.Essentials.Core
|
||||
LinkedInputSigs.Remove(sig);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return IntValue.ToString();
|
||||
}
|
||||
|
||||
void UpdateSig(UShortInputSig sig)
|
||||
{
|
||||
sig.UShortValue = UShortValue;
|
||||
@@ -212,6 +222,11 @@ namespace PepperDash.Essentials.Core
|
||||
LinkedInputSigs.Remove(sig);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return StringValue;
|
||||
}
|
||||
|
||||
void UpdateSig(StringInputSig sig)
|
||||
{
|
||||
sig.StringValue = _StringValue;
|
||||
|
||||
79
Essentials Core/PepperDashEssentialsBase/Global/JobTimer.cs
Normal file
79
Essentials Core/PepperDashEssentialsBase/Global/JobTimer.cs
Normal file
@@ -0,0 +1,79 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
public static class JobTimer
|
||||
{
|
||||
static CTimer MinuteTimer;
|
||||
|
||||
static List<JobTimerItem> Items = new List<JobTimerItem>();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="act"></param>
|
||||
public static void AddAction(Action act)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="act"></param>
|
||||
public static void AddJobTimerItem(JobTimerItem item)
|
||||
{
|
||||
var existing = Items.FirstOrDefault(i => i.Key == item.Key);
|
||||
if (existing != null)
|
||||
{
|
||||
Items.Remove(existing);
|
||||
}
|
||||
Items.Add(item);
|
||||
}
|
||||
|
||||
static void CheckAndRunTimer()
|
||||
{
|
||||
if (Items.Count > 0 && MinuteTimer == null)
|
||||
{
|
||||
MinuteTimer = new CTimer(o => MinuteTimerCallback(), null, 60000, 60000);
|
||||
}
|
||||
}
|
||||
|
||||
static void MinuteTimerCallback()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class JobTimerItem
|
||||
{
|
||||
public string Key { get; private set; }
|
||||
public Action JobAction { get; private set; }
|
||||
public eJobTimerCycleTypes CycleType { get; private set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public DateTime RunNextAt { get; set; }
|
||||
|
||||
public JobTimerItem(string key, eJobTimerCycleTypes cycle, Action act)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public enum eJobTimerCycleTypes
|
||||
{
|
||||
RunEveryHour,
|
||||
RunEveryHalfHour,
|
||||
RunEveryMinute
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,7 @@ namespace PepperDash.Essentials.Core
|
||||
long PollTime;
|
||||
CTimer PollTimer;
|
||||
string PollString;
|
||||
Action PollAction;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -39,14 +40,38 @@ namespace PepperDash.Essentials.Core
|
||||
{
|
||||
if (pollTime > warningTime || pollTime > errorTime)
|
||||
throw new ArgumentException("pollTime must be less than warning or errorTime");
|
||||
if (pollTime < 5000)
|
||||
throw new ArgumentException("pollTime cannot be less than 5000 ms");
|
||||
//if (pollTime < 5000)
|
||||
// throw new ArgumentException("pollTime cannot be less than 5000 ms");
|
||||
|
||||
Client = client;
|
||||
PollTime = pollTime;
|
||||
PollString = pollString;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Poll is a provided action instead of string
|
||||
/// </summary>
|
||||
/// <param name="parent"></param>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="pollTime"></param>
|
||||
/// <param name="warningTime"></param>
|
||||
/// <param name="errorTime"></param>
|
||||
/// <param name="pollBytes"></param>
|
||||
public GenericCommunicationMonitor(IKeyed parent, IBasicCommunication client, long pollTime,
|
||||
long warningTime, long errorTime, Action pollAction) :
|
||||
base(parent, warningTime, errorTime)
|
||||
{
|
||||
if (pollTime > warningTime || pollTime > errorTime)
|
||||
throw new ArgumentException("pollTime must be less than warning or errorTime");
|
||||
//if (pollTime < 5000)
|
||||
// throw new ArgumentException("pollTime cannot be less than 5000 ms");
|
||||
|
||||
Client = client;
|
||||
PollTime = pollTime;
|
||||
PollAction = pollAction;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Build the monitor from a config object
|
||||
/// </summary>
|
||||
@@ -79,7 +104,7 @@ namespace PepperDash.Essentials.Core
|
||||
void Client_BytesReceived(object sender, GenericCommMethodReceiveBytesArgs e)
|
||||
{
|
||||
Status = MonitorStatus.IsOk;
|
||||
StopErrorTimers();
|
||||
ResetErrorTimers();
|
||||
}
|
||||
|
||||
void Poll()
|
||||
@@ -87,12 +112,15 @@ namespace PepperDash.Essentials.Core
|
||||
StartErrorTimers();
|
||||
if (Client.IsConnected)
|
||||
{
|
||||
Debug.Console(2, Client, "Monitor, Polling");
|
||||
Client.SendText(PollString);
|
||||
//Debug.Console(2, this, "Polling");
|
||||
if(PollAction != null)
|
||||
PollAction.Invoke();
|
||||
else
|
||||
Client.SendText(PollString);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(2, Client, "Monitor, Comm not connected");
|
||||
Debug.Console(2, this, "Comm not connected");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,7 +132,7 @@ namespace PepperDash.Essentials.Core
|
||||
if (Client.IsConnected)
|
||||
{
|
||||
//Client.IsConnected -= OneTimeConnectHandler;
|
||||
Debug.Console(2, Client, "Monitor, Comm connected");
|
||||
Debug.Console(2, this, "Comm connected");
|
||||
Poll();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,11 +26,14 @@ namespace PepperDash.Essentials.Core
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// StatusUnknown = 0, IsOk = 1, InWarning = 2, InError = 3
|
||||
/// </summary>
|
||||
public enum MonitorStatus
|
||||
{
|
||||
IsOk, InWarning, InError, StatusUnknown
|
||||
StatusUnknown = 0,
|
||||
IsOk = 1,
|
||||
InWarning = 2,
|
||||
InError = 3
|
||||
}
|
||||
|
||||
public class MonitorStatusChangeEventArgs : EventArgs
|
||||
|
||||
@@ -13,10 +13,17 @@ using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
public abstract class StatusMonitorBase : IStatusMonitor
|
||||
public abstract class StatusMonitorBase : IStatusMonitor, IKeyName
|
||||
{
|
||||
public event EventHandler<MonitorStatusChangeEventArgs> StatusChange;
|
||||
|
||||
/// <summary>
|
||||
/// Format returned: "parentdevkey-comMonitor"
|
||||
/// </summary>
|
||||
public string Key { get { return Parent.Key + "-comMonitor"; } }
|
||||
|
||||
public string Name { get { return "Comm. monitor"; } }
|
||||
|
||||
public IKeyed Parent { get; private set; }
|
||||
|
||||
public MonitorStatus Status
|
||||
@@ -29,7 +36,6 @@ namespace PepperDash.Essentials.Core
|
||||
_Status = value;
|
||||
OnStatusChange(value);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
MonitorStatus _Status;
|
||||
@@ -96,5 +102,13 @@ namespace PepperDash.Essentials.Core
|
||||
ErrorTimer = null;
|
||||
}
|
||||
|
||||
protected void ResetErrorTimers()
|
||||
{
|
||||
if(WarningTimer != null)
|
||||
WarningTimer.Reset(WarningTime, WarningTime);
|
||||
if(ErrorTimer != null)
|
||||
ErrorTimer.Reset(ErrorTime, ErrorTime);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,7 @@
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<OutputPath>..\..\Release Package\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
@@ -58,6 +58,10 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.EthernetCommunications.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Crestron.SimplSharpPro.Fusion, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Fusion.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Crestron.SimplSharpPro.Remotes, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Remotes.dll</HintPath>
|
||||
@@ -67,7 +71,7 @@
|
||||
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.UI.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="mscorlib" />
|
||||
<Reference Include="PepperDash_Core, Version=1.0.0.16459, Culture=neutral, processorArchitecture=MSIL">
|
||||
<Reference Include="PepperDash_Core, Version=1.0.1.26313, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\PepperDash.Core\Pepperdash Core\Pepperdash Core\bin\PepperDash_Core.dll</HintPath>
|
||||
</Reference>
|
||||
@@ -99,6 +103,12 @@
|
||||
<Reference Include="System.Data" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Crestron IO\Inputs\GenericVersiportInputDevice.cs" />
|
||||
<Compile Include="Crestron IO\Inputs\IDigitalInput.cs" />
|
||||
<Compile Include="Crestron IO\Relay\GenericRelayDevice.cs" />
|
||||
<Compile Include="Devices\CodecInterfaces.cs" />
|
||||
<Compile Include="Global\JobTimer.cs" />
|
||||
<Compile Include="Ramps and Increments\ActionIncrementer.cs" />
|
||||
<Compile Include="Comm and IR\CommFactory.cs" />
|
||||
<Compile Include="Comm and IR\CommunicationExtras.cs" />
|
||||
<Compile Include="Comm and IR\REMOVE ComPortConfig.cs" />
|
||||
@@ -111,7 +121,7 @@
|
||||
<Compile Include="Config\DeviceConfig.cs" />
|
||||
<Compile Include="Constants\CommonCues.cs" />
|
||||
<Compile Include="Devices\DisplayUiConstants.cs" />
|
||||
<Compile Include="Devices\REMOVE DeviceConfig.cs" />
|
||||
<Compile Include="Devices\IUsageTracking.cs" />
|
||||
<Compile Include="Devices\DeviceJsonApi.cs" />
|
||||
<Compile Include="Devices\SourceListItem.cs" />
|
||||
<Compile Include="DeviceTypeInterfaces\IDisplayBasic.cs" />
|
||||
@@ -132,6 +142,9 @@
|
||||
<Compile Include="Devices\IVolumeAndAudioInterfaces.cs" />
|
||||
<Compile Include="Display\BasicIrDisplay.cs" />
|
||||
<Compile Include="Feedbacks\BoolFeedbackOneShot.cs" />
|
||||
<Compile Include="Ramps and Increments\NumericalHelpers.cs" />
|
||||
<Compile Include="Ramps and Increments\UshortSigIncrementer.cs" />
|
||||
<Compile Include="Routing\DummyRoutingInputsDevice.cs" />
|
||||
<Compile Include="Routing\ICardPortsDevice.cs" />
|
||||
<Compile Include="InUseTracking\IInUseTracking.cs" />
|
||||
<Compile Include="InUseTracking\InUseTracking.cs" />
|
||||
@@ -141,10 +154,7 @@
|
||||
<Compile Include="Monitoring\StatusMonitorBase.cs" />
|
||||
<Compile Include="Monitoring\Interfaces and things.cs" />
|
||||
<Compile Include="Monitoring\GenericCommunicationMonitor.cs" />
|
||||
<Compile Include="Devices\REPLACE IrSetTopBoxBase.cs" />
|
||||
<Compile Include="Devices\REPLACE IrDvdBase.cs" />
|
||||
<Compile Include="Devices\NewInterfaces.cs" />
|
||||
<Compile Include="Devices\REPLACE DvdDeviceBase.cs" />
|
||||
<Compile Include="Devices\IAttachVideoStatusExtensions.cs" />
|
||||
<Compile Include="Devices\IHasFeedbacks.cs" />
|
||||
<Compile Include="Devices\SmartObjectBaseTypes.cs" />
|
||||
@@ -153,7 +163,7 @@
|
||||
<Compile Include="Display\MockDisplay.cs" />
|
||||
<Compile Include="Ethernet\EthernetStatistics.cs" />
|
||||
<Compile Include="Fusion\MOVED FusionSystemController.cs" />
|
||||
<Compile Include="Global.cs" />
|
||||
<Compile Include="Global\Global.cs" />
|
||||
<Compile Include="License\EssentialsLicenseManager.cs" />
|
||||
<Compile Include="Feedbacks\BoolOutputLogicals.cs" />
|
||||
<Compile Include="Presets\Interfaces.cs" />
|
||||
@@ -173,6 +183,8 @@
|
||||
<Compile Include="SmartObjects\SmartObjectHelper.cs" />
|
||||
<Compile Include="SmartObjects\SmartObjectHelperBase.cs" />
|
||||
<Compile Include="Routing\TieLine.cs" />
|
||||
<Compile Include="Timers\CountdownTimer.cs" />
|
||||
<Compile Include="Touchpanels\Keyboards\HabaneroKeyboardController.cs" />
|
||||
<Compile Include="Touchpanels\MOVED LargeTouchpanelControllerBase.cs" />
|
||||
<Compile Include="Touchpanels\TriListExtensions.cs" />
|
||||
<Compile Include="Touchpanels\MOVED UIControllers\DevicePageControllerBase.cs" />
|
||||
@@ -188,8 +200,6 @@
|
||||
<Compile Include="Crestron\CrestronGenericBaseDevice.cs" />
|
||||
<Compile Include="Debug\Debug.cs" />
|
||||
<Compile Include="DeviceControlsParentInterfaces\IPresentationSource.cs" />
|
||||
<Compile Include="Devices\REMOVE DefaultDevice.cs" />
|
||||
<Compile Include="Devices\MOVED TO CORE Device.cs" />
|
||||
<Compile Include="Devices\DeviceManager.cs" />
|
||||
<Compile Include="Devices\IrOutputPortController.cs" />
|
||||
<Compile Include="Display\DisplayBase.cs" />
|
||||
@@ -197,7 +207,7 @@
|
||||
<Compile Include="Room\Room.cs" />
|
||||
<Compile Include="Room\RoomCues.cs" />
|
||||
<Compile Include="Room\MOVED RoomEventArgs.cs" />
|
||||
<Compile Include="SubpageReferencList\SourceListSubpageReferenceList.cs" />
|
||||
<Compile Include="SmartObjects\SubpageReferencList\SourceListSubpageReferenceList.cs" />
|
||||
<Compile Include="Touchpanels\ModalDialog.cs" />
|
||||
<Compile Include="Touchpanels\SmartGraphicsTouchpanelControllerBase.cs" />
|
||||
<Compile Include="TriListBridges\HandlerBridge.cs" />
|
||||
@@ -205,9 +215,8 @@
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="SigHelper.cs" />
|
||||
<Compile Include="REMOVE SigId.cs" />
|
||||
<Compile Include="SubpageReferencList\DeviceStatusListController.cs" />
|
||||
<Compile Include="SubpageReferencList\SubpageReferenceList.cs" />
|
||||
<Compile Include="SubpageReferencList\SubpageReferenceListItem.cs" />
|
||||
<Compile Include="SmartObjects\SubpageReferencList\SubpageReferenceList.cs" />
|
||||
<Compile Include="SmartObjects\SubpageReferencList\SubpageReferenceListItem.cs" />
|
||||
<None Include="app.config" />
|
||||
<None Include="Properties\ControlSystem.cfg" />
|
||||
</ItemGroup>
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,120 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// An incrementer that can use the values of some other object/primitive value to do its thing.
|
||||
/// It uses an Action to set the value and a Func to get the value from whatever this is
|
||||
/// attached to.
|
||||
/// </summary>
|
||||
public class ActionIncrementer
|
||||
{
|
||||
public int ChangeAmount { get; set; }
|
||||
public int MaxValue { get; set; }
|
||||
public int MinValue { get; set; }
|
||||
public uint RepeatDelay { get; set; }
|
||||
public uint RepeatTime { get; set; }
|
||||
|
||||
Action<int> SetAction;
|
||||
Func<int> GetFunc;
|
||||
CTimer Timer;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="changeAmount"></param>
|
||||
/// <param name="minValue"></param>
|
||||
/// <param name="maxValue"></param>
|
||||
/// <param name="repeatDelay"></param>
|
||||
/// <param name="repeatTime"></param>
|
||||
/// <param name="setAction">Action that will be called when this needs to set the destination value</param>
|
||||
/// <param name="getFunc">Func that is called to get the current value</param>
|
||||
public ActionIncrementer(int changeAmount, int minValue, int maxValue, uint repeatDelay, uint repeatTime, Action<int> setAction, Func<int> getFunc)
|
||||
{
|
||||
SetAction = setAction;
|
||||
GetFunc = getFunc;
|
||||
ChangeAmount = changeAmount;
|
||||
MaxValue = maxValue;
|
||||
MinValue = minValue;
|
||||
RepeatDelay = repeatDelay;
|
||||
RepeatTime = repeatTime;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Starts incrementing cycle
|
||||
/// </summary>
|
||||
public void StartUp()
|
||||
{
|
||||
if (Timer != null) return;
|
||||
Go(ChangeAmount);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Starts decrementing cycle
|
||||
/// </summary>
|
||||
public void StartDown()
|
||||
{
|
||||
if (Timer != null) return;
|
||||
Go(-ChangeAmount);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stops the repeat
|
||||
/// </summary>
|
||||
public void Stop()
|
||||
{
|
||||
if (Timer != null)
|
||||
Timer.Stop();
|
||||
Timer = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper that does the work of setting new level, and starting repeat loop, checking against bounds first.
|
||||
/// </summary>
|
||||
/// <param name="change"></param>
|
||||
void Go(int change)
|
||||
{
|
||||
int currentLevel = GetFunc();
|
||||
// Fire once then pause
|
||||
int newLevel = currentLevel + change;
|
||||
bool atLimit = CheckLevel(newLevel, out newLevel);
|
||||
SetAction(newLevel);
|
||||
|
||||
if (atLimit) // Don't go past end
|
||||
Stop();
|
||||
else if (Timer == null) // Only enter the timer if it's not already running
|
||||
Timer = new CTimer(o => { Go(change); }, null, RepeatDelay, RepeatTime);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper to check a new level against min/max. Returns revised level if new level
|
||||
/// will go out of bounds
|
||||
/// </summary>
|
||||
/// <param name="levelIn">The level to check against bounds</param>
|
||||
/// <param name="levelOut">Revised level if bounds are exceeded. Min or max</param>
|
||||
/// <returns>true if new level is at or past bounds</returns>
|
||||
bool CheckLevel(int levelIn, out int levelOut)
|
||||
{
|
||||
bool isAtLimit = false;
|
||||
if (levelIn > MaxValue)
|
||||
{
|
||||
levelOut = MaxValue;
|
||||
isAtLimit = true;
|
||||
}
|
||||
else if (levelIn < MinValue)
|
||||
{
|
||||
levelOut = MinValue;
|
||||
isAtLimit = true;
|
||||
}
|
||||
else
|
||||
levelOut = levelIn;
|
||||
return isAtLimit;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
public class NumericalHelpers
|
||||
{
|
||||
/// <summary>
|
||||
/// Scales a value
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <param name="inMin"></param>
|
||||
/// <param name="inMax"></param>
|
||||
/// <param name="outMin"></param>
|
||||
/// <param name="outMax"></param>
|
||||
/// <returns></returns>
|
||||
public static double Scale(double input, double inMin, double inMax, double outMin, double outMax)
|
||||
{
|
||||
//Debug.Console(2, this, "Scaling (double) input '{0}' with min '{1}'/max '{2}' to output range min '{3}'/max '{4}'", input, inMin, inMax, outMin, outMax);
|
||||
|
||||
double inputRange = inMax - inMin;
|
||||
|
||||
if (inputRange <= 0)
|
||||
{
|
||||
throw new ArithmeticException(string.Format("Invalid Input Range '{0}' for Scaling. Min '{1}' Max '{2}'.", inputRange, inMin, inMax));
|
||||
}
|
||||
|
||||
double outputRange = outMax - outMin;
|
||||
|
||||
var output = (((input - inMin) * outputRange) / inputRange) + outMin;
|
||||
|
||||
// Debug.Console(2, this, "Scaled output '{0}'", output);
|
||||
|
||||
return output;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro;
|
||||
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Attaches to UShortInputSig and does incremental ramping of the signal
|
||||
/// </summary>
|
||||
public class UshortSigIncrementer
|
||||
{
|
||||
UShortInputSig TheSig;
|
||||
public ushort ChangeAmount { get; set; }
|
||||
public int MaxValue { get; set; }
|
||||
public int MinValue { get; set; }
|
||||
public uint RepeatDelay { get; set; }
|
||||
public uint RepeatTime { get; set; }
|
||||
bool SignedMode;
|
||||
CTimer Timer;
|
||||
|
||||
public UshortSigIncrementer(UShortInputSig sig, ushort changeAmount, int minValue, int maxValue, uint repeatDelay, uint repeatTime)
|
||||
{
|
||||
TheSig = sig;
|
||||
ChangeAmount = changeAmount;
|
||||
MaxValue = maxValue;
|
||||
MinValue = minValue;
|
||||
if (MinValue < 0 || MaxValue < 0) SignedMode = true;
|
||||
RepeatDelay = repeatDelay;
|
||||
RepeatTime = repeatTime;
|
||||
if (SignedMode && (MinValue < -32768 || MaxValue > 32767))
|
||||
Debug.Console(1, "UshortSigIncrementer has signed values that exceed range of -32768, 32767");
|
||||
}
|
||||
|
||||
public void StartUp()
|
||||
{
|
||||
if (Timer != null) return;
|
||||
Go(ChangeAmount);
|
||||
}
|
||||
|
||||
public void StartDown()
|
||||
{
|
||||
if (Timer != null) return;
|
||||
Go(-ChangeAmount);
|
||||
}
|
||||
|
||||
void Go(int change)
|
||||
{
|
||||
int level;
|
||||
if (SignedMode) level = TheSig.ShortValue;
|
||||
else level = TheSig.UShortValue;
|
||||
|
||||
// Fire once then pause
|
||||
int newLevel = level + change;
|
||||
bool atLimit = CheckLevel(newLevel, out newLevel);
|
||||
SetValue((ushort)newLevel);
|
||||
|
||||
|
||||
if (atLimit) // Don't go past end
|
||||
Stop();
|
||||
else if (Timer == null) // Only enter the timer if it's not already running
|
||||
Timer = new CTimer(o => { Go(change); }, null, RepeatDelay, RepeatTime);
|
||||
}
|
||||
|
||||
bool CheckLevel(int levelIn, out int levelOut)
|
||||
{
|
||||
bool IsAtLimit = false;
|
||||
if (levelIn > MaxValue)
|
||||
{
|
||||
levelOut = MaxValue;
|
||||
IsAtLimit = true;
|
||||
}
|
||||
else if (levelIn < MinValue)
|
||||
{
|
||||
levelOut = MinValue;
|
||||
IsAtLimit = true;
|
||||
}
|
||||
else
|
||||
levelOut = levelIn;
|
||||
return IsAtLimit;
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
if (Timer != null)
|
||||
Timer.Stop();
|
||||
Timer = null;
|
||||
}
|
||||
|
||||
void SetValue(ushort value)
|
||||
{
|
||||
//CrestronConsole.PrintLine("Increment level:{0} / {1}", value, (short)value);
|
||||
TheSig.UShortValue = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,56 +1,56 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro;
|
||||
|
||||
using PepperDash.Core;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
//***************************************************************************************************
|
||||
|
||||
public abstract class Room : Device, IHasFeedback
|
||||
{
|
||||
public abstract BoolFeedback RoomIsOnFeedback { get; protected set; }
|
||||
public abstract BoolFeedback IsCoolingDownFeedback { get; protected set; }
|
||||
public abstract BoolFeedback IsWarmingUpFeedback { get; protected set; }
|
||||
|
||||
// In concrete classes, these should be computed from the relevant devices
|
||||
public virtual uint CooldownTime { get { return 10000; } }
|
||||
public virtual uint WarmupTime { get { return 5000; } }
|
||||
|
||||
public string Description { get; set; }
|
||||
public string HelpMessage { get; set; }
|
||||
|
||||
public Room(string key, string name)
|
||||
: base(key, name)
|
||||
{
|
||||
Description = "";
|
||||
HelpMessage = "";
|
||||
}
|
||||
|
||||
public virtual void RoomOn() { }
|
||||
|
||||
public virtual void RoomOff() { }
|
||||
|
||||
#region IDeviceWithOutputs Members
|
||||
|
||||
public virtual List<Feedback> Feedbacks
|
||||
{
|
||||
get
|
||||
{
|
||||
return new List<Feedback>
|
||||
{
|
||||
RoomIsOnFeedback,
|
||||
IsCoolingDownFeedback,
|
||||
IsWarmingUpFeedback
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro;
|
||||
|
||||
using PepperDash.Core;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
//***************************************************************************************************
|
||||
|
||||
public abstract class Room : Device, IHasFeedback
|
||||
{
|
||||
public abstract BoolFeedback RoomIsOnFeedback { get; protected set; }
|
||||
public abstract BoolFeedback IsCoolingDownFeedback { get; protected set; }
|
||||
public abstract BoolFeedback IsWarmingUpFeedback { get; protected set; }
|
||||
|
||||
// In concrete classes, these should be computed from the relevant devices
|
||||
public virtual uint CooldownTime { get { return 10000; } }
|
||||
public virtual uint WarmupTime { get { return 5000; } }
|
||||
|
||||
public string Description { get; set; }
|
||||
public string HelpMessage { get; set; }
|
||||
|
||||
public Room(string key, string name)
|
||||
: base(key, name)
|
||||
{
|
||||
Description = "";
|
||||
HelpMessage = "";
|
||||
}
|
||||
|
||||
public virtual void RoomOn() { }
|
||||
|
||||
public virtual void RoomOff() { }
|
||||
|
||||
#region IDeviceWithOutputs Members
|
||||
|
||||
public virtual List<Feedback> Feedbacks
|
||||
{
|
||||
get
|
||||
{
|
||||
return new List<Feedback>
|
||||
{
|
||||
RoomIsOnFeedback,
|
||||
IsCoolingDownFeedback,
|
||||
IsWarmingUpFeedback
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Routing
|
||||
{
|
||||
public class DummyRoutingInputsDevice : Device, IRoutingSource
|
||||
{
|
||||
/// <summary>
|
||||
/// A single output port, backplane, audioVideo
|
||||
/// </summary>
|
||||
public RoutingOutputPort AudioVideoOutputPort { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// contains the output port
|
||||
/// </summary>
|
||||
public RoutingPortCollection<RoutingOutputPort> OutputPorts
|
||||
{
|
||||
get { return new RoutingPortCollection<RoutingOutputPort>() { AudioVideoOutputPort }; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// constructor
|
||||
/// </summary>
|
||||
/// <param name="key">key for special device</param>
|
||||
public DummyRoutingInputsDevice(string key) : base(key)
|
||||
{
|
||||
AudioVideoOutputPort = new RoutingOutputPort("internal", eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.BackplaneOnly,
|
||||
null, this, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,7 @@ namespace PepperDash.Essentials.Core
|
||||
var newRoute = destination.GetRouteToSource(source, signalType);
|
||||
if (newRoute == null) return;
|
||||
RouteDescriptorCollection.DefaultCollection.AddRouteDescriptor(newRoute);
|
||||
Debug.Console(1, destination, "Executing new route");
|
||||
Debug.Console(2, destination, "Executing full route");
|
||||
newRoute.ExecuteRoutes();
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace PepperDash.Essentials.Core
|
||||
routeDescr = null;
|
||||
}
|
||||
|
||||
Debug.Console(1, destination, "Route{0} discovered", routeDescr == null ? " NOT" : "");
|
||||
//Debug.Console(1, destination, "Route{0} discovered", routeDescr == null ? " NOT" : "");
|
||||
return routeDescr;
|
||||
}
|
||||
|
||||
@@ -102,19 +102,18 @@ namespace PepperDash.Essentials.Core
|
||||
eRoutingSignalType signalType, int cycle, RouteDescriptor routeTable)
|
||||
{
|
||||
cycle++;
|
||||
Debug.Console(2, destination, "SelectInput-cycle {1}. Finding {2} route back to {0}", source.Key, cycle, signalType);
|
||||
Debug.Console(2, "GetRouteToSource: {0} {1}--> {2}", cycle, source.Key, destination.Key);
|
||||
|
||||
RoutingInputPort goodInputPort = null;
|
||||
var destDevInputTies = TieLineCollection.Default.Where(t =>
|
||||
t.DestinationPort.ParentDevice == destination && (t.Type == signalType || t.Type == eRoutingSignalType.AudioVideo));
|
||||
|
||||
// find a direct tie
|
||||
var directTie = destDevInputTies.FirstOrDefault(
|
||||
t => !(t.SourcePort.ParentDevice is IRoutingInputsOutputs)
|
||||
&& t.DestinationPort.ParentDevice == destination
|
||||
t => t.DestinationPort.ParentDevice == destination
|
||||
&& t.SourcePort.ParentDevice == source);
|
||||
RoutingInputPort goodInputPort = null;
|
||||
if (directTie != null) // Found a tie directly to the source
|
||||
{
|
||||
Debug.Console(2, destination, "Found direct tie to {0}**", source.Key);
|
||||
goodInputPort = directTie.DestinationPort;
|
||||
}
|
||||
else // no direct-connect. Walk back devices.
|
||||
@@ -149,7 +148,7 @@ namespace PepperDash.Essentials.Core
|
||||
// we have a route on corresponding inputPort. *** Do the route ***
|
||||
if (goodInputPort != null)
|
||||
{
|
||||
Debug.Console(2, destination, "adding RouteDescriptor");
|
||||
//Debug.Console(2, destination, "adding RouteDescriptor");
|
||||
if (outputPortToUse == null)
|
||||
{
|
||||
// it's a sink device
|
||||
@@ -161,7 +160,7 @@ namespace PepperDash.Essentials.Core
|
||||
}
|
||||
else // device is merely IRoutingInputOutputs
|
||||
Debug.Console(2, destination, " No routing. Passthrough device");
|
||||
Debug.Console(2, destination, "Exiting cycle {0}", cycle);
|
||||
//Debug.Console(2, destination, "Exiting cycle {0}", cycle);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -265,14 +264,14 @@ namespace PepperDash.Essentials.Core
|
||||
{
|
||||
foreach (var route in Routes)
|
||||
{
|
||||
Debug.Console(2, route.ToString());
|
||||
Debug.Console(2, "ExecuteRoutes: {0}", route.ToString());
|
||||
if (route.SwitchingDevice is IRoutingSinkWithSwitching)
|
||||
(route.SwitchingDevice as IRoutingSinkWithSwitching).ExecuteSwitch(route.InputPort.Selector);
|
||||
else if (route.SwitchingDevice is IRouting)
|
||||
{
|
||||
(route.SwitchingDevice as IRouting).ExecuteSwitch(route.InputPort.Selector, route.OutputPort.Selector, SignalType);
|
||||
route.OutputPort.InUseTracker.AddUser(Destination, "destination-" + SignalType);
|
||||
Debug.Console(2, "Port {0} routing. Count={1}", route.OutputPort.Key, route.OutputPort.InUseTracker.InUseCountFeedback.UShortValue);
|
||||
Debug.Console(2, "Output port {0} routing. Count={1}", route.OutputPort.Key, route.OutputPort.InUseTracker.InUseCountFeedback.UShortValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -324,10 +323,11 @@ namespace PepperDash.Essentials.Core
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
if(OutputPort == null) // IRoutingSink
|
||||
if(SwitchingDevice is IRouting)
|
||||
return string.Format("{0} switches output '{1}' to input '{2}'", SwitchingDevice.Key, OutputPort.Selector, InputPort.Selector);
|
||||
else
|
||||
return string.Format("{0} switches to input '{1}'", SwitchingDevice.Key, InputPort.Selector);
|
||||
|
||||
return string.Format("{0} switches output '{1}' to input '{2}'", SwitchingDevice.Key, OutputPort.Selector, InputPort.Selector);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -40,6 +40,9 @@ namespace PepperDash.Essentials.Core
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Endpoint device like a display, that selects inputs
|
||||
/// </summary>
|
||||
public interface IRoutingSinkWithSwitching : IRoutingSinkNoSwitching
|
||||
{
|
||||
//void ClearRoute();
|
||||
@@ -53,12 +56,21 @@ namespace PepperDash.Essentials.Core
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines a midpoint device as have internal routing. Any devices in the middle of the
|
||||
/// signal chain, that do switching, must implement this for routing to work otherwise
|
||||
/// the routing algorithm will treat the IRoutingInputsOutputs device as a passthrough
|
||||
/// device.
|
||||
/// </summary>
|
||||
public interface IRouting : IRoutingInputsOutputs
|
||||
{
|
||||
//void ClearRoute(object outputSelector);
|
||||
void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines an IRoutingOutputs devices as being a source - the start of the chain
|
||||
/// </summary>
|
||||
public interface IRoutingSource : IRoutingOutputs
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1,200 +1,201 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using PepperDash.Core;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Base class for RoutingInput and Output ports
|
||||
/// </summary>
|
||||
public abstract class RoutingPort : IKeyed
|
||||
{
|
||||
public string Key { get; private set; }
|
||||
public eRoutingSignalType Type { get; private set; }
|
||||
public eRoutingPortConnectionType ConnectionType { get; private set; }
|
||||
public readonly object Selector;
|
||||
public bool IsInternal { get; private set; }
|
||||
|
||||
public RoutingPort(string key, eRoutingSignalType type, eRoutingPortConnectionType connType, object selector, bool isInternal)
|
||||
{
|
||||
Key = key;
|
||||
Type = type;
|
||||
ConnectionType = connType;
|
||||
Selector = selector;
|
||||
IsInternal = IsInternal;
|
||||
}
|
||||
}
|
||||
|
||||
public enum eRoutingSignalType
|
||||
{
|
||||
Audio,
|
||||
Video,
|
||||
AudioVideo
|
||||
}
|
||||
|
||||
public enum eRoutingPortConnectionType
|
||||
{
|
||||
None, BackplaneOnly, DisplayPort, Dvi, Hdmi, Rgb, Vga, LineAudio, DigitalAudio, Sdi,
|
||||
Composite, Component, DmCat, DmMmFiber, DmSmFiber, Speaker
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Basic RoutingInput with no statuses.
|
||||
/// </summary>
|
||||
public class RoutingInputPort : RoutingPort
|
||||
{
|
||||
/// <summary>
|
||||
/// The IRoutingInputs object this lives on
|
||||
/// </summary>
|
||||
public IRoutingInputs ParentDevice { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for a basic RoutingInputPort
|
||||
/// </summary>
|
||||
/// <param name="selector">An object used to refer to this port in the IRouting device's ExecuteSwitch method.
|
||||
/// May be string, number, whatever</param>
|
||||
/// <param name="parent">The IRoutingInputs object this lives on</param>
|
||||
public RoutingInputPort(string key, eRoutingSignalType type, eRoutingPortConnectionType connType,
|
||||
object selector, IRoutingInputs parent)
|
||||
: this (key, type, connType, selector, parent, false)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for a virtual routing input port that lives inside a device. For example
|
||||
/// the ports that link a DM card to a DM matrix bus
|
||||
/// </summary>
|
||||
/// <param name="isInternal">true for internal ports</param>
|
||||
public RoutingInputPort(string key, eRoutingSignalType type, eRoutingPortConnectionType connType,
|
||||
object selector, IRoutingInputs parent, bool isInternal)
|
||||
: base(key, type, connType, selector, isInternal)
|
||||
{
|
||||
if (parent == null)
|
||||
throw new ArgumentNullException("parent");
|
||||
ParentDevice = parent;
|
||||
}
|
||||
|
||||
|
||||
///// <summary>
|
||||
///// Static method to get a named port from a named device
|
||||
///// </summary>
|
||||
///// <returns>Returns null if device or port doesn't exist</returns>
|
||||
//public static RoutingInputPort GetDevicePort(string deviceKey, string portKey)
|
||||
//{
|
||||
// var sourceDev = DeviceManager.GetDeviceForKey(deviceKey) as IRoutingInputs;
|
||||
// if (sourceDev == null)
|
||||
// return null;
|
||||
// return sourceDev.InputPorts[portKey];
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
///// Static method to get a named port from a card in a named ICardPortsDevice device
|
||||
///// Uses ICardPortsDevice.GetChildInputPort
|
||||
///// </summary>
|
||||
///// <param name="cardKey">'input-N'</param>
|
||||
///// <returns>null if device, card or port doesn't exist</returns>
|
||||
//public static RoutingInputPort GetDeviceCardPort(string deviceKey, string cardKey, string portKey)
|
||||
//{
|
||||
// var sourceDev = DeviceManager.GetDeviceForKey(deviceKey) as ICardPortsDevice;
|
||||
// if (sourceDev == null)
|
||||
// return null;
|
||||
// return sourceDev.GetChildInputPort(cardKey, portKey);
|
||||
//}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A RoutingInputPort for devices like DM-TX and DM input cards.
|
||||
/// Will provide video statistics on connected signals
|
||||
/// </summary>
|
||||
public class RoutingInputPortWithVideoStatuses : RoutingInputPort
|
||||
{
|
||||
/// <summary>
|
||||
/// Video statuses attached to this port
|
||||
/// </summary>
|
||||
public VideoStatusOutputs VideoStatus { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="selector">An object used to refer to this port in the IRouting device's ExecuteSwitch method.
|
||||
/// May be string, number, whatever</param>
|
||||
/// <param name="parent">The IRoutingInputs object this lives on</param>
|
||||
/// <param name="funcs">A VideoStatusFuncsWrapper used to assign the callback funcs that will get
|
||||
/// the values for the various stats</param>
|
||||
public RoutingInputPortWithVideoStatuses(string key,
|
||||
eRoutingSignalType type, eRoutingPortConnectionType connType, object selector,
|
||||
IRoutingInputs parent, VideoStatusFuncsWrapper funcs) :
|
||||
base(key, type, connType, selector, parent)
|
||||
{
|
||||
VideoStatus = new VideoStatusOutputs(funcs);
|
||||
}
|
||||
}
|
||||
|
||||
public class RoutingOutputPort : RoutingPort
|
||||
{
|
||||
/// <summary>
|
||||
/// The IRoutingOutputs object this port lives on
|
||||
/// </summary>
|
||||
public IRoutingOutputs ParentDevice { get; private set; }
|
||||
|
||||
public InUseTracking InUseTracker { get; private set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
/// <param name="selector">An object used to refer to this port in the IRouting device's ExecuteSwitch method.
|
||||
/// May be string, number, whatever</param>
|
||||
/// <param name="parent">The IRoutingOutputs object this port lives on</param>
|
||||
public RoutingOutputPort(string key, eRoutingSignalType type, eRoutingPortConnectionType connType,
|
||||
object selector, IRoutingOutputs parent)
|
||||
: this(key, type, connType, selector, parent, false)
|
||||
{
|
||||
}
|
||||
|
||||
public RoutingOutputPort(string key, eRoutingSignalType type, eRoutingPortConnectionType connType,
|
||||
object selector, IRoutingOutputs parent, bool isInternal)
|
||||
: base(key, type, connType, selector, isInternal)
|
||||
{
|
||||
if (parent == null)
|
||||
throw new ArgumentNullException("parent");
|
||||
ParentDevice = parent;
|
||||
InUseTracker = new InUseTracking();
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return ParentDevice.Key + ":" + Key;
|
||||
}
|
||||
|
||||
///// <summary>
|
||||
///// Static method to get a named port from a named device
|
||||
///// </summary>
|
||||
///// <returns>Returns null if device or port doesn't exist</returns>
|
||||
//public static RoutingOutputPort GetDevicePort(string deviceKey, string portKey)
|
||||
//{
|
||||
// var sourceDev = DeviceManager.GetDeviceForKey(deviceKey) as IRoutingOutputs;
|
||||
// if (sourceDev == null)
|
||||
// return null;
|
||||
// var port = sourceDev.OutputPorts[portKey];
|
||||
// if (port == null)
|
||||
// Debug.Console(0, "WARNING: Device '{0}' does does not contain output port '{1}'", deviceKey, portKey);
|
||||
// return port;
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
///// Static method to get a named port from a card in a named ICardPortsDevice device
|
||||
///// Uses ICardPortsDevice.GetChildOutputPort on that device
|
||||
///// </summary>
|
||||
///// <param name="cardKey">'input-N' or 'output-N'</param>
|
||||
///// <returns>null if device, card or port doesn't exist</returns>
|
||||
//public static RoutingOutputPort GetDeviceCardPort(string deviceKey, string cardKey, string portKey)
|
||||
//{
|
||||
// var sourceDev = DeviceManager.GetDeviceForKey(deviceKey) as ICardPortsDevice;
|
||||
// if (sourceDev == null)
|
||||
// return null;
|
||||
// var port = sourceDev.GetChildOutputPort(cardKey, portKey);
|
||||
//}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using PepperDash.Core;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Base class for RoutingInput and Output ports
|
||||
/// </summary>
|
||||
public abstract class RoutingPort : IKeyed
|
||||
{
|
||||
public string Key { get; private set; }
|
||||
public eRoutingSignalType Type { get; private set; }
|
||||
public eRoutingPortConnectionType ConnectionType { get; private set; }
|
||||
public readonly object Selector;
|
||||
public bool IsInternal { get; private set; }
|
||||
public object FeedbackMatchObject { get; set; }
|
||||
|
||||
public RoutingPort(string key, eRoutingSignalType type, eRoutingPortConnectionType connType, object selector, bool isInternal)
|
||||
{
|
||||
Key = key;
|
||||
Type = type;
|
||||
ConnectionType = connType;
|
||||
Selector = selector;
|
||||
IsInternal = IsInternal;
|
||||
}
|
||||
}
|
||||
|
||||
public enum eRoutingSignalType
|
||||
{
|
||||
Audio,
|
||||
Video,
|
||||
AudioVideo
|
||||
}
|
||||
|
||||
public enum eRoutingPortConnectionType
|
||||
{
|
||||
None, BackplaneOnly, DisplayPort, Dvi, Hdmi, Rgb, Vga, LineAudio, DigitalAudio, Sdi,
|
||||
Composite, Component, DmCat, DmMmFiber, DmSmFiber, Speaker
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Basic RoutingInput with no statuses.
|
||||
/// </summary>
|
||||
public class RoutingInputPort : RoutingPort
|
||||
{
|
||||
/// <summary>
|
||||
/// The IRoutingInputs object this lives on
|
||||
/// </summary>
|
||||
public IRoutingInputs ParentDevice { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for a basic RoutingInputPort
|
||||
/// </summary>
|
||||
/// <param name="selector">An object used to refer to this port in the IRouting device's ExecuteSwitch method.
|
||||
/// May be string, number, whatever</param>
|
||||
/// <param name="parent">The IRoutingInputs object this lives on</param>
|
||||
public RoutingInputPort(string key, eRoutingSignalType type, eRoutingPortConnectionType connType,
|
||||
object selector, IRoutingInputs parent)
|
||||
: this (key, type, connType, selector, parent, false)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for a virtual routing input port that lives inside a device. For example
|
||||
/// the ports that link a DM card to a DM matrix bus
|
||||
/// </summary>
|
||||
/// <param name="isInternal">true for internal ports</param>
|
||||
public RoutingInputPort(string key, eRoutingSignalType type, eRoutingPortConnectionType connType,
|
||||
object selector, IRoutingInputs parent, bool isInternal)
|
||||
: base(key, type, connType, selector, isInternal)
|
||||
{
|
||||
if (parent == null)
|
||||
throw new ArgumentNullException("parent");
|
||||
ParentDevice = parent;
|
||||
}
|
||||
|
||||
|
||||
///// <summary>
|
||||
///// Static method to get a named port from a named device
|
||||
///// </summary>
|
||||
///// <returns>Returns null if device or port doesn't exist</returns>
|
||||
//public static RoutingInputPort GetDevicePort(string deviceKey, string portKey)
|
||||
//{
|
||||
// var sourceDev = DeviceManager.GetDeviceForKey(deviceKey) as IRoutingInputs;
|
||||
// if (sourceDev == null)
|
||||
// return null;
|
||||
// return sourceDev.InputPorts[portKey];
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
///// Static method to get a named port from a card in a named ICardPortsDevice device
|
||||
///// Uses ICardPortsDevice.GetChildInputPort
|
||||
///// </summary>
|
||||
///// <param name="cardKey">'input-N'</param>
|
||||
///// <returns>null if device, card or port doesn't exist</returns>
|
||||
//public static RoutingInputPort GetDeviceCardPort(string deviceKey, string cardKey, string portKey)
|
||||
//{
|
||||
// var sourceDev = DeviceManager.GetDeviceForKey(deviceKey) as ICardPortsDevice;
|
||||
// if (sourceDev == null)
|
||||
// return null;
|
||||
// return sourceDev.GetChildInputPort(cardKey, portKey);
|
||||
//}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A RoutingInputPort for devices like DM-TX and DM input cards.
|
||||
/// Will provide video statistics on connected signals
|
||||
/// </summary>
|
||||
public class RoutingInputPortWithVideoStatuses : RoutingInputPort
|
||||
{
|
||||
/// <summary>
|
||||
/// Video statuses attached to this port
|
||||
/// </summary>
|
||||
public VideoStatusOutputs VideoStatus { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="selector">An object used to refer to this port in the IRouting device's ExecuteSwitch method.
|
||||
/// May be string, number, whatever</param>
|
||||
/// <param name="parent">The IRoutingInputs object this lives on</param>
|
||||
/// <param name="funcs">A VideoStatusFuncsWrapper used to assign the callback funcs that will get
|
||||
/// the values for the various stats</param>
|
||||
public RoutingInputPortWithVideoStatuses(string key,
|
||||
eRoutingSignalType type, eRoutingPortConnectionType connType, object selector,
|
||||
IRoutingInputs parent, VideoStatusFuncsWrapper funcs) :
|
||||
base(key, type, connType, selector, parent)
|
||||
{
|
||||
VideoStatus = new VideoStatusOutputs(funcs);
|
||||
}
|
||||
}
|
||||
|
||||
public class RoutingOutputPort : RoutingPort
|
||||
{
|
||||
/// <summary>
|
||||
/// The IRoutingOutputs object this port lives on
|
||||
/// </summary>
|
||||
public IRoutingOutputs ParentDevice { get; private set; }
|
||||
|
||||
public InUseTracking InUseTracker { get; private set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
/// <param name="selector">An object used to refer to this port in the IRouting device's ExecuteSwitch method.
|
||||
/// May be string, number, whatever</param>
|
||||
/// <param name="parent">The IRoutingOutputs object this port lives on</param>
|
||||
public RoutingOutputPort(string key, eRoutingSignalType type, eRoutingPortConnectionType connType,
|
||||
object selector, IRoutingOutputs parent)
|
||||
: this(key, type, connType, selector, parent, false)
|
||||
{
|
||||
}
|
||||
|
||||
public RoutingOutputPort(string key, eRoutingSignalType type, eRoutingPortConnectionType connType,
|
||||
object selector, IRoutingOutputs parent, bool isInternal)
|
||||
: base(key, type, connType, selector, isInternal)
|
||||
{
|
||||
if (parent == null)
|
||||
throw new ArgumentNullException("parent");
|
||||
ParentDevice = parent;
|
||||
InUseTracker = new InUseTracking();
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return ParentDevice.Key + ":" + Key;
|
||||
}
|
||||
|
||||
///// <summary>
|
||||
///// Static method to get a named port from a named device
|
||||
///// </summary>
|
||||
///// <returns>Returns null if device or port doesn't exist</returns>
|
||||
//public static RoutingOutputPort GetDevicePort(string deviceKey, string portKey)
|
||||
//{
|
||||
// var sourceDev = DeviceManager.GetDeviceForKey(deviceKey) as IRoutingOutputs;
|
||||
// if (sourceDev == null)
|
||||
// return null;
|
||||
// var port = sourceDev.OutputPorts[portKey];
|
||||
// if (port == null)
|
||||
// Debug.Console(0, "WARNING: Device '{0}' does does not contain output port '{1}'", deviceKey, portKey);
|
||||
// return port;
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
///// Static method to get a named port from a card in a named ICardPortsDevice device
|
||||
///// Uses ICardPortsDevice.GetChildOutputPort on that device
|
||||
///// </summary>
|
||||
///// <param name="cardKey">'input-N' or 'output-N'</param>
|
||||
///// <returns>null if device, card or port doesn't exist</returns>
|
||||
//public static RoutingOutputPort GetDeviceCardPort(string deviceKey, string cardKey, string portKey)
|
||||
//{
|
||||
// var sourceDev = DeviceManager.GetDeviceForKey(deviceKey) as ICardPortsDevice;
|
||||
// if (sourceDev == null)
|
||||
// return null;
|
||||
// var port = sourceDev.GetChildOutputPort(cardKey, portKey);
|
||||
//}
|
||||
}
|
||||
}
|
||||
@@ -1,46 +1,183 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Routing
|
||||
{
|
||||
/// <summary>
|
||||
/// These should correspond directly with the portNames var in the config tool.
|
||||
/// </summary>
|
||||
public class RoutingPortNames
|
||||
{
|
||||
public const string AntennaIn = "antennaIn";
|
||||
public const string AnyAudioIn = "anyAudioIn";
|
||||
public const string AnyAudioOut = "anyAudioOut";
|
||||
public const string AnyOut = "anyOut";
|
||||
public const string AnyVideoIn = "anyVideoIn";
|
||||
public const string AnyVideoOut = "anyVideoOut";
|
||||
public const string BalancedAudioOut = "balancedAudioOut";
|
||||
public const string ComponentIn = "componentIn";
|
||||
public const string ComponentOut = "componentOut";
|
||||
public const string CompositeIn = "compositeIn";
|
||||
public const string CompositeOut = "compositeOut";
|
||||
public const string DisplayPortIn = "displayPortIn";
|
||||
public const string DisplayPortIn1 = "displayPortIn1";
|
||||
public const string DisplayPortIn2 = "displayPortIn2";
|
||||
public const string DisplayPortIn3 = "displayPortIn3";
|
||||
public const string DisplayPortOut = "displayPortOut";
|
||||
public const string DmIn = "dmIn";
|
||||
public const string DmOut = "dmOut";
|
||||
public const string DviIn = "dviIn";
|
||||
public const string DviOut = "dviOut";
|
||||
public const string HdmiIn = "hdmiIn";
|
||||
public const string HdmiIn1 = "hdmiIn1";
|
||||
public const string HdmiIn2 = "hdmiIn2";
|
||||
public const string HdmiIn3 = "hdmiIn3";
|
||||
public const string HdmiIn4 = "hdmiIn4";
|
||||
public const string HdmiIn5 = "hdmiIn5";
|
||||
public const string HdmiIn6 = "hdmiIn6";
|
||||
public const string HdmiOut = "hdmiOut";
|
||||
public const string RgbIn = "rgbIn";
|
||||
public const string VgaIn = "vgaIn";
|
||||
public const string VgaOut = "vgaOut";
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Routing
|
||||
{
|
||||
/// <summary>
|
||||
/// These should correspond directly with the portNames var in the config tool.
|
||||
/// </summary>
|
||||
public class RoutingPortNames
|
||||
{
|
||||
/// <summary>
|
||||
/// antennaIn
|
||||
/// </summary>
|
||||
public const string AntennaIn = "antennaIn";
|
||||
/// <summary>
|
||||
/// anyAudioIn
|
||||
/// </summary>
|
||||
public const string AnyAudioIn = "anyAudioIn";
|
||||
/// <summary>
|
||||
/// anyAudioOut
|
||||
/// </summary>
|
||||
public const string AnyAudioOut = "anyAudioOut";
|
||||
/// <summary>
|
||||
/// anyOut
|
||||
/// </summary>
|
||||
public const string AnyOut = "anyOut";
|
||||
/// <summary>
|
||||
/// anyVideoIn
|
||||
/// </summary>
|
||||
public const string AnyVideoIn = "anyVideoIn";
|
||||
/// <summary>
|
||||
/// anyVideoOut
|
||||
/// </summary>
|
||||
public const string AnyVideoOut = "anyVideoOut";
|
||||
/// <summary>
|
||||
/// balancedAudioOut
|
||||
/// </summary>
|
||||
public const string BalancedAudioOut = "balancedAudioOut";
|
||||
/// <summary>
|
||||
/// codecOsd
|
||||
/// </summary>
|
||||
public const string CodecOsd = "codecOsd";
|
||||
/// <summary>
|
||||
/// componentIn
|
||||
/// </summary>
|
||||
public const string ComponentIn = "componentIn";
|
||||
/// <summary>
|
||||
/// componentOut
|
||||
/// </summary>
|
||||
public const string ComponentOut = "componentOut";
|
||||
/// <summary>
|
||||
/// compositeIn
|
||||
/// </summary>
|
||||
public const string CompositeIn = "compositeIn";
|
||||
/// <summary>
|
||||
/// compositeOut
|
||||
/// </summary>
|
||||
public const string CompositeOut = "compositeOut";
|
||||
/// <summary>
|
||||
/// displayPortIn
|
||||
/// </summary>
|
||||
public const string DisplayPortIn = "displayPortIn";
|
||||
/// <summary>
|
||||
/// displayPortIn1
|
||||
/// </summary>
|
||||
public const string DisplayPortIn1 = "displayPortIn1";
|
||||
/// <summary>
|
||||
/// displayPortIn2
|
||||
/// </summary>
|
||||
public const string DisplayPortIn2 = "displayPortIn2";
|
||||
/// <summary>
|
||||
/// displayPortIn3
|
||||
/// </summary>
|
||||
public const string DisplayPortIn3 = "displayPortIn3";
|
||||
/// <summary>
|
||||
/// displayPortOut
|
||||
/// </summary>
|
||||
public const string DisplayPortOut = "displayPortOut";
|
||||
/// <summary>
|
||||
/// dmIn
|
||||
/// </summary>
|
||||
public const string DmIn = "dmIn";
|
||||
/// <summary>
|
||||
/// dmOut
|
||||
/// </summary>
|
||||
public const string DmOut = "dmOut";
|
||||
/// <summary>
|
||||
/// dviIn
|
||||
/// </summary>
|
||||
public const string DviIn = "dviIn";
|
||||
/// <summary>
|
||||
/// dviIn1
|
||||
/// </summary>
|
||||
public const string DviIn1 = "dviIn1";
|
||||
/// <summary>
|
||||
/// dviOut
|
||||
/// </summary>
|
||||
public const string DviOut = "dviOut";
|
||||
/// <summary>
|
||||
/// hdmiIn
|
||||
/// </summary>
|
||||
public const string HdmiIn = "hdmiIn";
|
||||
/// <summary>
|
||||
/// hdmiIn1
|
||||
/// </summary>
|
||||
public const string HdmiIn1 = "hdmiIn1";
|
||||
/// <summary>
|
||||
/// hdmiIn2
|
||||
/// </summary>
|
||||
public const string HdmiIn2 = "hdmiIn2";
|
||||
/// <summary>
|
||||
/// hdmiIn3
|
||||
/// </summary>
|
||||
public const string HdmiIn3 = "hdmiIn3";
|
||||
/// <summary>
|
||||
/// hdmiIn4
|
||||
/// </summary>
|
||||
public const string HdmiIn4 = "hdmiIn4";
|
||||
/// <summary>
|
||||
/// hdmiIn5
|
||||
/// </summary>
|
||||
public const string HdmiIn5 = "hdmiIn5";
|
||||
/// <summary>
|
||||
/// hdmiIn6
|
||||
/// </summary>
|
||||
public const string HdmiIn6 = "hdmiIn6";
|
||||
/// <summary>
|
||||
/// hdmiOut
|
||||
/// </summary>
|
||||
public const string HdmiOut = "hdmiOut";
|
||||
/// <summary>
|
||||
/// hdmiOut1
|
||||
/// </summary>
|
||||
public const string HdmiOut1 = "hdmiOut1";
|
||||
/// <summary>
|
||||
/// hdmiOut2
|
||||
/// </summary>
|
||||
public const string HdmiOut2 = "hdmiOut2";
|
||||
/// <summary>
|
||||
/// hdmiOut3
|
||||
/// </summary>
|
||||
public const string HdmiOut3 = "hdmiOut3";
|
||||
/// <summary>
|
||||
/// hdmiOut4
|
||||
/// </summary>
|
||||
public const string HdmiOut4 = "hdmiOut4";
|
||||
/// <summary>
|
||||
/// hdmiOut5
|
||||
/// </summary>
|
||||
public const string HdmiOut5 = "hdmiOut5";
|
||||
/// <summary>
|
||||
/// hdmiOut6
|
||||
/// </summary>
|
||||
public const string HdmiOut6 = "hdmiOut6";
|
||||
/// <summary>
|
||||
/// none
|
||||
/// </summary>
|
||||
public const string None = "none";
|
||||
/// <summary>
|
||||
/// rgbIn
|
||||
/// </summary>
|
||||
public const string RgbIn = "rgbIn";
|
||||
/// <summary>
|
||||
/// rgbIn1
|
||||
/// </summary>
|
||||
public const string RgbIn1 = "rgbIn1";
|
||||
/// <summary>
|
||||
/// rgbIn2
|
||||
/// </summary>
|
||||
public const string RgbIn2 = "rgbIn2";
|
||||
/// <summary>
|
||||
/// vgaIn
|
||||
/// </summary>
|
||||
public const string VgaIn = "vgaIn";
|
||||
/// <summary>
|
||||
/// vgaOut
|
||||
/// </summary>
|
||||
public const string VgaOut = "vgaOut";
|
||||
}
|
||||
}
|
||||
@@ -69,93 +69,4 @@ namespace PepperDash.Essentials.Core
|
||||
sig.CreateRamp(level, time / 10);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attaches to UShortInputSig and does incremental ramping of the signal
|
||||
/// </summary>
|
||||
public class UshortSigIncrementer
|
||||
{
|
||||
UShortInputSig TheSig;
|
||||
public ushort ChangeAmount { get; set; }
|
||||
public int MaxValue { get; set; }
|
||||
public int MinValue { get; set; }
|
||||
public uint RepeatDelay { get; set; }
|
||||
public uint RepeatTime { get; set; }
|
||||
bool SignedMode;
|
||||
CTimer Timer;
|
||||
|
||||
public UshortSigIncrementer(UShortInputSig sig, ushort changeAmount, int minValue, int maxValue, uint repeatDelay, uint repeatTime)
|
||||
{
|
||||
TheSig = sig;
|
||||
ChangeAmount = changeAmount;
|
||||
MaxValue = maxValue;
|
||||
MinValue = minValue;
|
||||
if (MinValue < 0 || MaxValue < 0) SignedMode = true;
|
||||
RepeatDelay = repeatDelay;
|
||||
RepeatTime = repeatTime;
|
||||
if (SignedMode && (MinValue < -32768 || MaxValue > 32767))
|
||||
Debug.Console(1, "UshortSigIncrementer has signed values that exceed range of -32768, 32767");
|
||||
}
|
||||
|
||||
public void StartUp()
|
||||
{
|
||||
if (Timer != null) return;
|
||||
Go(ChangeAmount);
|
||||
}
|
||||
|
||||
public void StartDown()
|
||||
{
|
||||
if (Timer != null) return;
|
||||
Go(-ChangeAmount);
|
||||
}
|
||||
|
||||
void Go(int change)
|
||||
{
|
||||
int level;
|
||||
if (SignedMode) level = TheSig.ShortValue;
|
||||
else level = TheSig.UShortValue;
|
||||
|
||||
// Fire once then pause
|
||||
int newLevel = level + change;
|
||||
bool atLimit = CheckLevel(newLevel, out newLevel);
|
||||
SetValue((ushort)newLevel);
|
||||
|
||||
|
||||
if (atLimit) // Don't go past end
|
||||
Stop();
|
||||
else if (Timer == null) // Only enter the timer if it's not already running
|
||||
Timer = new CTimer(o => { Go(change); }, null, RepeatDelay, RepeatTime);
|
||||
}
|
||||
|
||||
bool CheckLevel(int levelIn, out int levelOut)
|
||||
{
|
||||
bool IsAtLimit = false;
|
||||
if (levelIn > MaxValue)
|
||||
{
|
||||
levelOut = MaxValue;
|
||||
IsAtLimit = true;
|
||||
}
|
||||
else if (levelIn < MinValue)
|
||||
{
|
||||
levelOut = MinValue;
|
||||
IsAtLimit = true;
|
||||
}
|
||||
else
|
||||
levelOut = levelIn;
|
||||
return IsAtLimit;
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
if (Timer != null)
|
||||
Timer.Stop();
|
||||
Timer = null;
|
||||
}
|
||||
|
||||
void SetValue(ushort value)
|
||||
{
|
||||
//CrestronConsole.PrintLine("Increment level:{0} / {1}", value, (short)value);
|
||||
TheSig.UShortValue = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -33,6 +33,12 @@ namespace PepperDash.Essentials.Core.SmartObjects
|
||||
/// </summary>
|
||||
public int MaxCount { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Wrapper for smart object
|
||||
/// </summary>
|
||||
/// <param name="so"></param>
|
||||
/// <param name="useUserObjectHandler">True if the standard user object action handler will be used</param>
|
||||
/// <param name="nameSigOffset">The starting join of the string sigs for the button labels</param>
|
||||
public SmartObjectDynamicList(SmartObject so, bool useUserObjectHandler, uint nameSigOffset) : base(so, useUserObjectHandler)
|
||||
{
|
||||
try
|
||||
|
||||
@@ -6,6 +6,8 @@ using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Core.SmartObjects
|
||||
{
|
||||
public class SmartObjectHelperBase
|
||||
@@ -33,13 +35,37 @@ namespace PepperDash.Essentials.Core.SmartObjects
|
||||
SmartObject.SigChange -= this.SmartObject_SigChange;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper to get a sig name with debugging when fail
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public BoolOutputSig GetBoolOutputNamed(string name)
|
||||
{
|
||||
if (SmartObject.BooleanOutput.Contains(name))
|
||||
return SmartObject.BooleanOutput[name];
|
||||
else
|
||||
Debug.Console(0, "WARNING: Cannot get signal. Smart object {0} on trilist {1:x2} does not contain signal '{2}'",
|
||||
SmartObject.ID, SmartObject.Device.ID, name);
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets action on signal after checking for existence.
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="a"></param>
|
||||
public void SetBoolAction(string name, Action<bool> a)
|
||||
{
|
||||
if (SmartObject.BooleanOutput.Contains(name))
|
||||
SmartObject.BooleanOutput[name].UserObject = a;
|
||||
else
|
||||
{
|
||||
Debug.Console(0, "WARNING: Cannot set action. Smart object {0} on trilist {1:x2} does not contain signal '{2}'",
|
||||
SmartObject.ID, SmartObject.Device.ID, name);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Standard Action listener
|
||||
/// </summary>
|
||||
|
||||
@@ -10,6 +10,14 @@ namespace PepperDash.Essentials.Core.SmartObjects
|
||||
{
|
||||
public class SmartObjectNumeric : SmartObjectHelperBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Defaults to "Misc_1". The name of the button in VTPro (Usually the text)
|
||||
/// </summary>
|
||||
public string Misc1SigName { get; set; }
|
||||
/// <summary>
|
||||
/// Defaults to "Misc_2". The name of the button in VTPro (Usually the text)
|
||||
/// </summary>
|
||||
public string Misc2SigName { get; set; }
|
||||
|
||||
public BoolOutputSig Digit1 { get { return GetBoolOutputNamed("1"); } }
|
||||
public BoolOutputSig Digit2 { get { return GetBoolOutputNamed("2"); } }
|
||||
@@ -21,11 +29,13 @@ namespace PepperDash.Essentials.Core.SmartObjects
|
||||
public BoolOutputSig Digit8 { get { return GetBoolOutputNamed("8"); } }
|
||||
public BoolOutputSig Digit9 { get { return GetBoolOutputNamed("9"); } }
|
||||
public BoolOutputSig Digit0 { get { return GetBoolOutputNamed("0"); } }
|
||||
public BoolOutputSig Misc1 { get { return GetBoolOutputNamed("Misc_1"); } }
|
||||
public BoolOutputSig Misc2 { get { return GetBoolOutputNamed("Misc_2"); } }
|
||||
public BoolOutputSig Misc1 { get { return GetBoolOutputNamed(Misc1SigName); } }
|
||||
public BoolOutputSig Misc2 { get { return GetBoolOutputNamed(Misc2SigName); } }
|
||||
|
||||
public SmartObjectNumeric(SmartObject so, bool useUserObjectHandler) : base(so, useUserObjectHandler)
|
||||
{
|
||||
Misc1SigName = "Misc_1";
|
||||
Misc2SigName = "Misc_2";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -53,7 +53,7 @@ namespace PepperDash.Essentials.Core
|
||||
// Fail cleanly if not defined
|
||||
if (triList.SmartObjects == null || triList.SmartObjects.Count == 0)
|
||||
{
|
||||
Debug.Console(0, "TriList {0:X2} Smart objects not loaded", triList.ID, smartObjectId);
|
||||
Debug.Console(0, "TriList {0:X2} Smart objects have not been loaded", triList.ID, smartObjectId);
|
||||
return;
|
||||
}
|
||||
if (triList.SmartObjects.TryGetValue(smartObjectId, out obj))
|
||||
@@ -74,7 +74,8 @@ namespace PepperDash.Essentials.Core
|
||||
SRL.SigChange += new SmartObjectSigChangeEventHandler(SRL_SigChange);
|
||||
}
|
||||
else
|
||||
Debug.Console(0, "TriList 0x{0:X2} Cannot load smart object {1}", triList.ID, smartObjectId);
|
||||
Debug.Console(0, "ERROR: TriList 0x{0:X2} Cannot load smart object {1}. Verify correct SGD file is loaded",
|
||||
triList.ID, smartObjectId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1,111 +0,0 @@
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Text;
|
||||
//using Crestron.SimplSharp;
|
||||
//using Crestron.SimplSharpPro;
|
||||
//using Crestron.SimplSharpPro.UI;
|
||||
|
||||
//namespace PepperDash.Essentials.Core
|
||||
//{
|
||||
// /// <summary>
|
||||
// /// Controls the device/tech status list - links in to the first 10, 1, 5 statuses in an item's StatusProperties
|
||||
// /// </summary>
|
||||
// public class DeviceStatusListController : SubpageReferenceListController
|
||||
// {
|
||||
// Dictionary<uint, Device> Items = new Dictionary<uint, Device>();
|
||||
|
||||
// public DeviceStatusListController(SmartObject list)
|
||||
// {
|
||||
// TheList = new SubpageReferenceList(list, 10, 1, 5);
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// Attaches an item's StatusProperties to the list item.
|
||||
// /// THIS METHOD MAY BE BETTER ABSORBED INTO SOME OTHER CONTROLLER CLASS AS A
|
||||
// /// PSIG -> LIST ITEM ADAPTER
|
||||
// /// </summary>
|
||||
// /// <param name="index">List position</param>
|
||||
// /// <param name="device"></param>
|
||||
// public void AddItem(uint listIndex, Device device)
|
||||
// {
|
||||
// if (device == null) throw new ArgumentNullException("device");
|
||||
// Items[listIndex] = device;
|
||||
|
||||
// // Feedback - read the status properties and if there is room for them on the list sigs
|
||||
// // link them up.
|
||||
// //foreach (PValue statusPsig in device.StatusProperties)
|
||||
// //{
|
||||
// // uint num = statusPsig.Number;
|
||||
// // Sig listSig = null;
|
||||
// // switch (statusPsig.Type) // Switch on the PSig type and whether the PSig number is within the increment range
|
||||
// // {
|
||||
// // case eSigType.Bool:
|
||||
// // if (num > TheList.BoolIncrement) return;
|
||||
// // listSig = TheList.BoolInputSig(listIndex, num); // Pull the appropriate list sig.
|
||||
// // break;
|
||||
// // case eSigType.String:
|
||||
// // if (num > TheList.StringIncrement) return;
|
||||
// // listSig = TheList.StringInputSig(listIndex, num);
|
||||
// // break;
|
||||
// // case eSigType.UShort:
|
||||
// // if (num > TheList.UShortIncrement) return;
|
||||
// // listSig = TheList.UShortInputSig(listIndex, num);
|
||||
// // break;
|
||||
// // default:
|
||||
// // return;
|
||||
// // }
|
||||
// // if (listSig != null) // If we got a sig, plug it into the PSig for updates.
|
||||
// // statusPsig.AddLinkedSig(listSig, true);
|
||||
// //}
|
||||
|
||||
// // Press/other handlers - read the Commands and if there is room, add them as Sig handlers.
|
||||
// //foreach (var id in device.Commands.Keys)
|
||||
// //{
|
||||
// // var pValueNumber = id.Number;
|
||||
// // Sig listSig = null;
|
||||
// // // Switch on type of a command and if it's in range, get it's list Sig.
|
||||
// // switch (id.Type)
|
||||
// // {
|
||||
// // case eSigType.Bool:
|
||||
// // if (pValueNumber > TheList.BoolIncrement) return;
|
||||
// // listSig = TheList.BoolFeedbackSig(listIndex, pValueNumber);
|
||||
// // break;
|
||||
// // case eSigType.String:
|
||||
// // if (pValueNumber > TheList.StringIncrement) return;
|
||||
// // listSig = TheList.StringOutputSig(listIndex, pValueNumber);
|
||||
// // break;
|
||||
// // case eSigType.UShort:
|
||||
// // if (pValueNumber > TheList.UShortIncrement) return;
|
||||
// // listSig = TheList.UShortOutputSig(listIndex, pValueNumber);
|
||||
// // break;
|
||||
// // default:
|
||||
// // return;
|
||||
// // }
|
||||
// // if (listSig != null) // If we got a sig, add the command to its ChangeAction
|
||||
// // SigToAction.GetSigToActionUserObjectForSig(listSig).SigChangeAction += device.Commands[id];
|
||||
// // // This will need to be undone when detached MAKE A HELPER!!!!
|
||||
// //}
|
||||
|
||||
// // "Custom things" below
|
||||
// // Set the name on sig 1 - just an assignment. Don't
|
||||
// var nameSig = TheList.StringInputSig(listIndex, 1);
|
||||
// if (nameSig != null)
|
||||
// nameSig.StringValue = device.Key;
|
||||
|
||||
// // Map IsOnline bool to a 0 / 1 state analog icon
|
||||
// // Add an action to the online PValue that maps to a ushort sig on the list POTENTIAL LEAK HERE IF
|
||||
// // this isn't cleaned up on disconnect
|
||||
// var onlineSig = TheList.UShortInputSig(listIndex, 1);
|
||||
// //var onlinePValue = device.StatusProperties[Device.JoinIsOnline];
|
||||
// //if (onlineSig != null && onlinePValue != null)
|
||||
// // onlinePValue.AddChangeAction(pv => onlineSig.UShortValue = (ushort)(onlinePValue.BoolValue ? 1 : 0));
|
||||
// // //OR onlinePValue.AddLinkedSig(onlineSig, true);
|
||||
|
||||
// // Set the list length based on largest key
|
||||
// TheList.Count = (ushort)Items.Keys.DefaultIfEmpty().Max(); // The count will be the largest key or 0
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
//}
|
||||
@@ -0,0 +1,134 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
public class SecondsCountdownTimer: IKeyed
|
||||
{
|
||||
public event EventHandler<EventArgs> HasStarted;
|
||||
public event EventHandler<EventArgs> HasFinished;
|
||||
public event EventHandler<EventArgs> WasCancelled;
|
||||
|
||||
public string Key { get; private set; }
|
||||
|
||||
public BoolFeedback IsRunningFeedback { get; private set; }
|
||||
bool _IsRunning;
|
||||
|
||||
public IntFeedback PercentFeedback { get; private set; }
|
||||
public StringFeedback TimeRemainingFeedback { get; private set; }
|
||||
|
||||
public bool CountsDown { get; set; }
|
||||
public int SecondsToCount { get; set; }
|
||||
|
||||
public DateTime StartTime { get; private set; }
|
||||
public DateTime FinishTime { get; private set; }
|
||||
|
||||
CTimer SecondTimer;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
public SecondsCountdownTimer(string key)
|
||||
{
|
||||
Key = key;
|
||||
IsRunningFeedback = new BoolFeedback(() => _IsRunning);
|
||||
|
||||
TimeRemainingFeedback = new StringFeedback(() =>
|
||||
{
|
||||
// Need to handle up and down here.
|
||||
|
||||
if (StartTime == null || FinishTime == null)
|
||||
return "";
|
||||
var timeSpan = FinishTime - DateTime.Now;
|
||||
return Math.Round(timeSpan.TotalSeconds).ToString();
|
||||
});
|
||||
|
||||
PercentFeedback = new IntFeedback(() =>
|
||||
{
|
||||
if (StartTime == null || FinishTime == null)
|
||||
return 0;
|
||||
double percent = (FinishTime - DateTime.Now).TotalSeconds
|
||||
/ (FinishTime - StartTime).TotalSeconds
|
||||
* 100;
|
||||
return (int)percent;
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void Start()
|
||||
{
|
||||
if (_IsRunning)
|
||||
return;
|
||||
StartTime = DateTime.Now;
|
||||
FinishTime = StartTime + TimeSpan.FromSeconds(SecondsToCount);
|
||||
|
||||
if (SecondTimer != null)
|
||||
SecondTimer.Stop();
|
||||
SecondTimer = new CTimer(SecondElapsedTimerCallback, null, 0, 1000);
|
||||
_IsRunning = true;
|
||||
IsRunningFeedback.FireUpdate();
|
||||
|
||||
var handler = HasStarted;
|
||||
if (handler != null)
|
||||
handler(this, new EventArgs());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void Reset()
|
||||
{
|
||||
_IsRunning = false;
|
||||
Start();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void Cancel()
|
||||
{
|
||||
StopHelper();
|
||||
|
||||
var handler = WasCancelled;
|
||||
if (handler != null)
|
||||
handler(this, new EventArgs());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called upon expiration, or calling this will force timer to finish.
|
||||
/// </summary>
|
||||
public void Finish()
|
||||
{
|
||||
StopHelper();
|
||||
|
||||
var handler = HasFinished;
|
||||
if (handler != null)
|
||||
handler(this, new EventArgs());
|
||||
}
|
||||
|
||||
void StopHelper()
|
||||
{
|
||||
if (SecondTimer != null)
|
||||
SecondTimer.Stop();
|
||||
_IsRunning = false;
|
||||
IsRunningFeedback.FireUpdate();
|
||||
}
|
||||
|
||||
void SecondElapsedTimerCallback(object o)
|
||||
{
|
||||
PercentFeedback.FireUpdate();
|
||||
TimeRemainingFeedback.FireUpdate();
|
||||
|
||||
if (DateTime.Now >= FinishTime)
|
||||
Finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,436 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Touchpanels.Keyboards
|
||||
{
|
||||
public class HabaneroKeyboardController
|
||||
{
|
||||
/// <summary>
|
||||
/// Single-key press events, rather than using a built-up text string on the OutputFeedback
|
||||
/// </summary>
|
||||
public event EventHandler<KeyboardControllerPressEventArgs> KeyPress;
|
||||
|
||||
public BasicTriList TriList { get; private set; }
|
||||
|
||||
public StringFeedback OutputFeedback { get; private set; }
|
||||
|
||||
public bool IsVisible { get; private set; }
|
||||
|
||||
public string DotComButtonString { get; set; }
|
||||
|
||||
public string GoButtonText { get; set; }
|
||||
|
||||
public string SecondaryButtonText { get; set; }
|
||||
|
||||
public bool GoButtonVisible { get; set; }
|
||||
|
||||
public bool SecondaryButtonVisible { get; set; }
|
||||
|
||||
int ShiftMode = 0;
|
||||
|
||||
StringBuilder Output;
|
||||
|
||||
public Action HideAction { get; set; }
|
||||
|
||||
CTimer BackspaceTimer;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="trilist"></param>
|
||||
public HabaneroKeyboardController(BasicTriList trilist)
|
||||
{
|
||||
TriList = trilist;
|
||||
Output = new StringBuilder();
|
||||
OutputFeedback = new StringFeedback(() => Output.ToString());
|
||||
DotComButtonString = ".com";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Shows the keyboard and attaches sig handlers in the range of 2901-2969
|
||||
/// </summary>
|
||||
public void Show()
|
||||
{
|
||||
if (IsVisible)
|
||||
return;
|
||||
|
||||
TriList.SetSigTrueAction(ClosePressJoin, Hide);
|
||||
TriList.SetSigTrueAction(GoButtonPressJoin, () => OnKeyPress(KeyboardSpecialKey.GoButton));
|
||||
TriList.SetSigTrueAction(SecondaryButtonPressJoin, () => OnKeyPress(KeyboardSpecialKey.SecondaryButton));
|
||||
TriList.SetSigTrueAction(2921, () => Press(A(ShiftMode)));
|
||||
TriList.SetSigTrueAction(2922, () => Press(B(ShiftMode)));
|
||||
TriList.SetSigTrueAction(2923, () => Press(C(ShiftMode)));
|
||||
TriList.SetSigTrueAction(2924, () => Press(D(ShiftMode)));
|
||||
TriList.SetSigTrueAction(2925, () => Press(E(ShiftMode)));
|
||||
TriList.SetSigTrueAction(2926, () => Press(F(ShiftMode)));
|
||||
TriList.SetSigTrueAction(2927, () => Press(G(ShiftMode)));
|
||||
TriList.SetSigTrueAction(2928, () => Press(H(ShiftMode)));
|
||||
TriList.SetSigTrueAction(2929, () => Press(I(ShiftMode)));
|
||||
TriList.SetSigTrueAction(2930, () => Press(J(ShiftMode)));
|
||||
TriList.SetSigTrueAction(2931, () => Press(K(ShiftMode)));
|
||||
TriList.SetSigTrueAction(2932, () => Press(L(ShiftMode)));
|
||||
TriList.SetSigTrueAction(2933, () => Press(M(ShiftMode)));
|
||||
TriList.SetSigTrueAction(2934, () => Press(N(ShiftMode)));
|
||||
TriList.SetSigTrueAction(2935, () => Press(O(ShiftMode)));
|
||||
TriList.SetSigTrueAction(2936, () => Press(P(ShiftMode)));
|
||||
TriList.SetSigTrueAction(2937, () => Press(Q(ShiftMode)));
|
||||
TriList.SetSigTrueAction(2938, () => Press(R(ShiftMode)));
|
||||
TriList.SetSigTrueAction(2939, () => Press(S(ShiftMode)));
|
||||
TriList.SetSigTrueAction(2940, () => Press(T(ShiftMode)));
|
||||
TriList.SetSigTrueAction(2941, () => Press(U(ShiftMode)));
|
||||
TriList.SetSigTrueAction(2942, () => Press(V(ShiftMode)));
|
||||
TriList.SetSigTrueAction(2943, () => Press(W(ShiftMode)));
|
||||
TriList.SetSigTrueAction(2944, () => Press(X(ShiftMode)));
|
||||
TriList.SetSigTrueAction(2945, () => Press(Y(ShiftMode)));
|
||||
TriList.SetSigTrueAction(2946, () => Press(Z(ShiftMode)));
|
||||
TriList.SetSigTrueAction(2947, () => Press('.'));
|
||||
TriList.SetSigTrueAction(2948, () => Press('@'));
|
||||
TriList.SetSigTrueAction(2949, () => Press(' '));
|
||||
TriList.SetSigHeldAction(2950, 500, StartBackspaceRepeat, StopBackspaceRepeat, Backspace);
|
||||
//TriList.SetSigTrueAction(2950, Backspace);
|
||||
TriList.SetSigTrueAction(2951, Shift);
|
||||
TriList.SetSigTrueAction(2952, NumShift);
|
||||
TriList.SetSigTrueAction(2953, Clear);
|
||||
TriList.SetSigTrueAction(2954, () => Press(DotComButtonString));
|
||||
|
||||
TriList.SetBool(GoButtonVisibleJoin, GoButtonVisible);
|
||||
TriList.SetString(GoButtonTextJoin, GoButtonText);
|
||||
TriList.SetBool(SecondaryButtonVisibleJoin, SecondaryButtonVisible);
|
||||
TriList.SetString(SecondaryButtonTextJoin, SecondaryButtonText);
|
||||
|
||||
TriList.SetBool(KeyboardVisible, true);
|
||||
ShowKeys();
|
||||
IsVisible = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Hides the keyboard and disconnects ALL sig handlers from 2901 - 2969
|
||||
/// </summary>
|
||||
public void Hide()
|
||||
{
|
||||
if (!IsVisible)
|
||||
return;
|
||||
|
||||
for (uint i = 2901; i < 2970; i++)
|
||||
TriList.ClearBoolSigAction(i);
|
||||
|
||||
// run attached actions
|
||||
if(HideAction != null)
|
||||
HideAction();
|
||||
|
||||
TriList.SetBool(KeyboardVisible, false);
|
||||
IsVisible = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="c"></param>
|
||||
public void Press(char c)
|
||||
{
|
||||
OnKeyPress(c.ToString());
|
||||
Output.Append(c);
|
||||
OutputFeedback.FireUpdate();
|
||||
ResetShift();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="s"></param>
|
||||
public void Press(string s)
|
||||
{
|
||||
OnKeyPress(s);
|
||||
Output.Append(s);
|
||||
OutputFeedback.FireUpdate();
|
||||
ResetShift();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void EnableGoButton()
|
||||
{
|
||||
TriList.SetBool(GoButtonEnableJoin, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void DisableGoButton()
|
||||
{
|
||||
TriList.SetBool(GoButtonEnableJoin, false);
|
||||
}
|
||||
|
||||
void ResetShift()
|
||||
{
|
||||
if (ShiftMode == 1)
|
||||
{
|
||||
ShiftMode = 0;
|
||||
ShowKeys();
|
||||
}
|
||||
else if (ShiftMode == 3)
|
||||
{
|
||||
ShiftMode = 2;
|
||||
ShowKeys();
|
||||
}
|
||||
}
|
||||
|
||||
char A(int i) { return new char[] { 'a', 'A', '?', '?' }[i]; }
|
||||
char B(int i) { return new char[] { 'b', 'B', ':', ':' }[i]; }
|
||||
char C(int i) { return new char[] { 'c', 'C', '>', '>' }[i]; }
|
||||
char D(int i) { return new char[] { 'd', 'D', '_', '_' }[i]; }
|
||||
char E(int i) { return new char[] { 'e', 'E', '3', '#' }[i]; }
|
||||
char F(int i) { return new char[] { 'f', 'F', '=', '=' }[i]; }
|
||||
char G(int i) { return new char[] { 'g', 'G', '+', '+' }[i]; }
|
||||
char H(int i) { return new char[] { 'h', 'H', '[', '[' }[i]; }
|
||||
char I(int i) { return new char[] { 'i', 'I', '8', '*' }[i]; }
|
||||
char J(int i) { return new char[] { 'j', 'J', ']', ']' }[i]; }
|
||||
char K(int i) { return new char[] { 'k', 'K', '/', '/' }[i]; }
|
||||
char L(int i) { return new char[] { 'l', 'L', '\\', '\\' }[i]; }
|
||||
char M(int i) { return new char[] { 'm', 'M', '"', '"' }[i]; }
|
||||
char N(int i) { return new char[] { 'n', 'N', '\'', '\'' }[i]; }
|
||||
char O(int i) { return new char[] { 'o', 'O', '9', '(' }[i]; }
|
||||
char P(int i) { return new char[] { 'p', 'P', '0', ')' }[i]; }
|
||||
char Q(int i) { return new char[] { 'q', 'Q', '1', '!' }[i]; }
|
||||
char R(int i) { return new char[] { 'r', 'R', '4', '$' }[i]; }
|
||||
char S(int i) { return new char[] { 's', 'S', '-', '-' }[i]; }
|
||||
char T(int i) { return new char[] { 't', 'T', '5', '%' }[i]; }
|
||||
char U(int i) { return new char[] { 'u', 'U', '7', '&' }[i]; }
|
||||
char V(int i) { return new char[] { 'v', 'V', ';', ';' }[i]; }
|
||||
char W(int i) { return new char[] { 'w', 'W', '2', '@' }[i]; }
|
||||
char X(int i) { return new char[] { 'x', 'X', '<', '<' }[i]; }
|
||||
char Y(int i) { return new char[] { 'y', 'Y', '6', '^' }[i]; }
|
||||
char Z(int i) { return new char[] { 'z', 'Z', ',', ',' }[i]; }
|
||||
|
||||
/// <summary>
|
||||
/// Does what it says
|
||||
/// </summary>
|
||||
void StartBackspaceRepeat()
|
||||
{
|
||||
if (BackspaceTimer == null)
|
||||
{
|
||||
BackspaceTimer = new CTimer(o => Backspace(), null, 0, 175);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Does what it says
|
||||
/// </summary>
|
||||
void StopBackspaceRepeat()
|
||||
{
|
||||
if (BackspaceTimer != null)
|
||||
{
|
||||
BackspaceTimer.Stop();
|
||||
BackspaceTimer = null;
|
||||
}
|
||||
}
|
||||
|
||||
void Backspace()
|
||||
{
|
||||
OnKeyPress(KeyboardSpecialKey.Backspace);
|
||||
|
||||
if (Output.Length > 0)
|
||||
{
|
||||
Output.Remove(Output.Length - 1, 1);
|
||||
OutputFeedback.FireUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
void Clear()
|
||||
{
|
||||
OnKeyPress(KeyboardSpecialKey.Clear);
|
||||
|
||||
Output.Remove(0, Output.Length);
|
||||
OutputFeedback.FireUpdate();
|
||||
}
|
||||
|
||||
/* When in mode 0 (lowercase):
|
||||
* shift button: up arrow 0
|
||||
* numShift button: 123/#$@#$ 0
|
||||
*
|
||||
* - shift --> mode 1
|
||||
* - double-tap shift --> caps lock
|
||||
* - numShift --> mode 2
|
||||
*
|
||||
* mode 1 (uppercase)
|
||||
* shift button: down arrow 1
|
||||
* numShift button: 123/##$# 0
|
||||
*
|
||||
* - shift --> mode 0
|
||||
* - numShift --> mode 2
|
||||
*
|
||||
* - Tapping any key will go back to mode 0
|
||||
*
|
||||
* mode 2 (numbers-sym)
|
||||
* Shift button: #$#$#$ 2
|
||||
* numShift: ABC 1
|
||||
*
|
||||
* - shift --> mode 3
|
||||
* - double-tap shift --> caps lock
|
||||
* - numShift --> mode 0
|
||||
*
|
||||
* mode 3 (sym)
|
||||
* Shift button: 123 3
|
||||
* numShift: ABC 1
|
||||
*
|
||||
* - shift --> mode 2
|
||||
* - numShift --> mode 0
|
||||
*
|
||||
* - Tapping any key will go back to mode 2
|
||||
*/
|
||||
void Shift()
|
||||
{
|
||||
if (ShiftMode == 0)
|
||||
ShiftMode = 1;
|
||||
else if (ShiftMode == 1)
|
||||
ShiftMode = 0;
|
||||
else if (ShiftMode == 2)
|
||||
ShiftMode = 3;
|
||||
else
|
||||
ShiftMode = 2;
|
||||
|
||||
ShowKeys();
|
||||
}
|
||||
|
||||
void NumShift()
|
||||
{
|
||||
if (ShiftMode == 0 || ShiftMode == 1)
|
||||
ShiftMode = 2;
|
||||
else if (ShiftMode == 2 || ShiftMode == 3)
|
||||
ShiftMode = 0;
|
||||
ShowKeys();
|
||||
}
|
||||
|
||||
void ShowKeys()
|
||||
{
|
||||
TriList.SetString(2921, A(ShiftMode).ToString());
|
||||
TriList.SetString(2922, B(ShiftMode).ToString());
|
||||
TriList.SetString(2923, C(ShiftMode).ToString());
|
||||
TriList.SetString(2924, D(ShiftMode).ToString());
|
||||
TriList.SetString(2925, E(ShiftMode).ToString());
|
||||
TriList.SetString(2926, F(ShiftMode).ToString());
|
||||
TriList.SetString(2927, G(ShiftMode).ToString());
|
||||
TriList.SetString(2928, H(ShiftMode).ToString());
|
||||
TriList.SetString(2929, I(ShiftMode).ToString());
|
||||
TriList.SetString(2930, J(ShiftMode).ToString());
|
||||
TriList.SetString(2931, K(ShiftMode).ToString());
|
||||
TriList.SetString(2932, L(ShiftMode).ToString());
|
||||
TriList.SetString(2933, M(ShiftMode).ToString());
|
||||
TriList.SetString(2934, N(ShiftMode).ToString());
|
||||
TriList.SetString(2935, O(ShiftMode).ToString());
|
||||
TriList.SetString(2936, P(ShiftMode).ToString());
|
||||
TriList.SetString(2937, Q(ShiftMode).ToString());
|
||||
TriList.SetString(2938, R(ShiftMode).ToString());
|
||||
TriList.SetString(2939, S(ShiftMode).ToString());
|
||||
TriList.SetString(2940, T(ShiftMode).ToString());
|
||||
TriList.SetString(2941, U(ShiftMode).ToString());
|
||||
TriList.SetString(2942, V(ShiftMode).ToString());
|
||||
TriList.SetString(2943, W(ShiftMode).ToString());
|
||||
TriList.SetString(2944, X(ShiftMode).ToString());
|
||||
TriList.SetString(2945, Y(ShiftMode).ToString());
|
||||
TriList.SetString(2946, Z(ShiftMode).ToString());
|
||||
TriList.SetString(2954, DotComButtonString);
|
||||
|
||||
TriList.SetUshort(2951, (ushort)ShiftMode); // 0 = up, 1 = down, 2 = #, 3 = 123
|
||||
TriList.SetUshort(2952, (ushort)(ShiftMode < 2 ? 0 : 1)); // 0 = #, 1 = abc
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Event fire helper for text
|
||||
/// </summary>
|
||||
/// <param name="text"></param>
|
||||
void OnKeyPress(string text)
|
||||
{
|
||||
var handler = KeyPress;
|
||||
if (handler != null)
|
||||
KeyPress(this, new KeyboardControllerPressEventArgs(text));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// event helper for special keys
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
void OnKeyPress(KeyboardSpecialKey key)
|
||||
{
|
||||
var handler = KeyPress;
|
||||
if (handler != null)
|
||||
KeyPress(this, new KeyboardControllerPressEventArgs(key));
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 2901
|
||||
/// </summary>
|
||||
public const uint KeyboardVisible = 2901;
|
||||
/// <summary>
|
||||
/// 2902
|
||||
/// </summary>
|
||||
public const uint ClosePressJoin = 2902;
|
||||
/// <summary>
|
||||
/// 2903
|
||||
/// </summary>
|
||||
public const uint GoButtonPressJoin = 2903;
|
||||
/// <summary>
|
||||
/// 2903
|
||||
/// </summary>
|
||||
public const uint GoButtonTextJoin = 2903;
|
||||
/// <summary>
|
||||
/// 2904
|
||||
/// </summary>
|
||||
public const uint SecondaryButtonPressJoin = 2904;
|
||||
/// <summary>
|
||||
/// 2904
|
||||
/// </summary>
|
||||
public const uint SecondaryButtonTextJoin = 2904;
|
||||
/// <summary>
|
||||
/// 2905
|
||||
/// </summary>
|
||||
public const uint GoButtonVisibleJoin = 2905;
|
||||
/// <summary>
|
||||
/// 2906
|
||||
/// </summary>
|
||||
public const uint SecondaryButtonVisibleJoin = 2906;
|
||||
/// <summary>
|
||||
/// 2907
|
||||
/// </summary>
|
||||
public const uint GoButtonEnableJoin = 2907;
|
||||
/// <summary>
|
||||
/// 2910
|
||||
/// </summary>
|
||||
public const uint ClearPressJoin = 2910;
|
||||
/// <summary>
|
||||
/// 2911
|
||||
/// </summary>
|
||||
public const uint ClearVisibleJoin = 2911;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class KeyboardControllerPressEventArgs : EventArgs
|
||||
{
|
||||
public string Text { get; private set; }
|
||||
public KeyboardSpecialKey SpecialKey { get; private set; }
|
||||
|
||||
public KeyboardControllerPressEventArgs(string text)
|
||||
{
|
||||
Text = text;
|
||||
}
|
||||
|
||||
public KeyboardControllerPressEventArgs(KeyboardSpecialKey key)
|
||||
{
|
||||
SpecialKey = key;
|
||||
}
|
||||
}
|
||||
|
||||
public enum KeyboardSpecialKey
|
||||
{
|
||||
None = 0, Backspace, Clear, GoButton, SecondaryButton
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
@@ -14,6 +15,10 @@ namespace PepperDash.Essentials.Core
|
||||
/// Bool press 3992
|
||||
/// </summary>
|
||||
public const uint Button2Join = 3992;
|
||||
/// <summary>
|
||||
/// 3993
|
||||
/// </summary>
|
||||
public const uint CancelButtonJoin = 3993;
|
||||
/// <summary>
|
||||
///For visibility of single button. Bool feedback 3994
|
||||
/// </summary>
|
||||
@@ -26,6 +31,10 @@ namespace PepperDash.Essentials.Core
|
||||
/// Shows the timer guage if in use. Bool feedback 3996
|
||||
/// </summary>
|
||||
public const uint TimerVisibleJoin = 3996;
|
||||
/// <summary>
|
||||
/// Visibility join to show "X" button 3997
|
||||
/// </summary>
|
||||
public const uint CancelVisibleJoin = 3997;
|
||||
/// <summary>
|
||||
/// Shows the modal subpage. Boolean feeback join 3999
|
||||
/// </summary>
|
||||
@@ -34,7 +43,7 @@ namespace PepperDash.Essentials.Core
|
||||
/// <summary>
|
||||
/// The seconds value of the countdown timer. Ushort join 3991
|
||||
/// </summary>
|
||||
public const uint TimerSecondsJoin = 3991;
|
||||
//public const uint TimerSecondsJoin = 3991;
|
||||
/// <summary>
|
||||
/// The full ushort value of the countdown timer for a gauge. Ushort join 3992
|
||||
/// </summary>
|
||||
@@ -69,11 +78,15 @@ namespace PepperDash.Essentials.Core
|
||||
get { return TriList.BooleanInput[ModalVisibleJoin].BoolValue; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public bool CanCancel { get; private set; }
|
||||
|
||||
|
||||
BasicTriList TriList;
|
||||
|
||||
Action<uint> ModalCompleteAction;
|
||||
CTimer Timer;
|
||||
|
||||
static object CompleteActionLock = new object();
|
||||
|
||||
@@ -85,8 +98,10 @@ namespace PepperDash.Essentials.Core
|
||||
{
|
||||
TriList = triList;
|
||||
// Attach actions to buttons
|
||||
triList.SetSigFalseAction(Button1Join, () => OnModalComplete(1, true));
|
||||
triList.SetSigFalseAction(Button2Join, () => OnModalComplete(2, true));
|
||||
triList.SetSigFalseAction(Button1Join, () => OnModalComplete(1));
|
||||
triList.SetSigFalseAction(Button2Join, () => OnModalComplete(2));
|
||||
triList.SetSigFalseAction(CancelButtonJoin, () => { if (CanCancel) CancelDialog(); });
|
||||
CanCancel = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -97,11 +112,10 @@ namespace PepperDash.Essentials.Core
|
||||
/// <param name="decreasingGauge">If the progress bar gauge needs to count down instead of up</param>
|
||||
/// <param name="completeAction">The action to run when the dialog is dismissed. Parameter will be 1 or 2 if button pressed, or 0 if dialog times out</param>
|
||||
/// <returns>True when modal is created.</returns>
|
||||
public bool PresentModalTimerDialog(uint numberOfButtons, string title, string iconName,
|
||||
public bool PresentModalDialog(uint numberOfButtons, string title, string iconName,
|
||||
string message, string button1Text,
|
||||
string button2Text, uint timeMs, bool decreasingGauge, Action<uint> completeAction)
|
||||
string button2Text, bool showGauge, bool showCancel, Action<uint> completeAction)
|
||||
{
|
||||
//Debug.Console(0, "Present dialog");
|
||||
// Don't reset dialog if visible now
|
||||
if (!ModalIsVisible)
|
||||
{
|
||||
@@ -131,69 +145,45 @@ namespace PepperDash.Essentials.Core
|
||||
TriList.StringInput[Button1TextJoin].StringValue = button1Text;
|
||||
TriList.StringInput[Button2TextJoin].StringValue = button2Text;
|
||||
}
|
||||
// Show/hide timer
|
||||
TriList.BooleanInput[TimerVisibleJoin].BoolValue = timeMs > 0;
|
||||
// Show/hide guage
|
||||
TriList.BooleanInput[TimerVisibleJoin].BoolValue = showGauge;
|
||||
|
||||
CanCancel = showCancel;
|
||||
TriList.BooleanInput[CancelVisibleJoin].BoolValue = showCancel;
|
||||
|
||||
//Reveal and activate
|
||||
TriList.BooleanInput[ModalVisibleJoin].BoolValue = true;
|
||||
|
||||
// Start ramp timers if visible
|
||||
if (timeMs > 0)
|
||||
{
|
||||
TriList.UShortInput[TimerSecondsJoin].UShortValue = (ushort)(timeMs / 1000); // Seconds display
|
||||
TriList.UShortInput[TimerSecondsJoin].CreateRamp(0, (uint)(timeMs / 10));
|
||||
if (decreasingGauge)
|
||||
{
|
||||
// Gauge
|
||||
TriList.UShortInput[TimerGaugeJoin].UShortValue = ushort.MaxValue;
|
||||
// Text
|
||||
TriList.UShortInput[TimerGaugeJoin].CreateRamp(0, (uint)(timeMs / 10));
|
||||
}
|
||||
else
|
||||
{
|
||||
TriList.UShortInput[TimerGaugeJoin].UShortValue = 0; // Gauge
|
||||
TriList.UShortInput[TimerGaugeJoin].
|
||||
CreateRamp(ushort.MaxValue, (uint)(timeMs / 10));
|
||||
}
|
||||
Timer = new CTimer(o => OnModalComplete(0, false), timeMs);
|
||||
}
|
||||
|
||||
// Start a timer and fire action with no button on timeout.
|
||||
return true;
|
||||
}
|
||||
|
||||
// Dialog is busy
|
||||
//Debug.Console(2, "Modal is already visible");
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Hide dialog from elsewhere, fires CompleteAction
|
||||
/// </summary>
|
||||
public void CancelDialog()
|
||||
{
|
||||
if (ModalIsVisible)
|
||||
{
|
||||
TriList.UShortInput[TimerSecondsJoin].StopRamp();
|
||||
TriList.UShortInput[TimerGaugeJoin].StopRamp();
|
||||
if (Timer != null) Timer.Stop();
|
||||
TriList.BooleanInput[ModalVisibleJoin].BoolValue = false;
|
||||
}
|
||||
OnModalComplete(0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Hides dialog. Fires no action
|
||||
/// </summary>
|
||||
public void HideDialog()
|
||||
{
|
||||
TriList.BooleanInput[ModalVisibleJoin].BoolValue = false;
|
||||
}
|
||||
|
||||
// When the modal is cleared or times out, clean up the various bits
|
||||
void OnModalComplete(uint buttonNum, bool cancelled)
|
||||
void OnModalComplete(uint buttonNum)
|
||||
{
|
||||
//Debug.Console(2, "OnModalComplete {0}, {1}", buttonNum, cancelled);
|
||||
TriList.BooleanInput[ModalVisibleJoin].BoolValue = false;
|
||||
if (cancelled)
|
||||
{
|
||||
TriList.UShortInput[TimerSecondsJoin].StopRamp();
|
||||
TriList.UShortInput[TimerGaugeJoin].StopRamp();
|
||||
Timer.Stop();
|
||||
}
|
||||
if (ModalCompleteAction != null)
|
||||
{
|
||||
//Debug.Console(2, "Modal complete action");
|
||||
ModalCompleteAction(buttonNum);
|
||||
}
|
||||
|
||||
var action = ModalCompleteAction;
|
||||
if (action != null)
|
||||
action(buttonNum);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,13 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
/// <summary>
|
||||
@@ -13,7 +17,8 @@ namespace PepperDash.Essentials.Core
|
||||
public static class SigAndTriListExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Attaches Action to Sig's user object and returns the same Sig.
|
||||
/// Attaches Action to Sig's user object and returns the same Sig. This provides no protection
|
||||
/// from null sigs
|
||||
/// </summary>
|
||||
/// <param name="sig">The BoolOutputSig to attach the Action to</param>
|
||||
/// <param name="a">An action to run when sig is pressed and when released</param>
|
||||
@@ -59,6 +64,74 @@ namespace PepperDash.Essentials.Core
|
||||
return sig.SetBoolSigAction(b => { if (!b) a(); });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets an action to a held sig
|
||||
/// </summary>
|
||||
/// <returns>The sig</returns>
|
||||
public static BoolOutputSig SetSigHeldAction(this BasicTriList tl, uint sigNum, uint heldMs, Action heldAction)
|
||||
{
|
||||
return SetSigHeldAction(tl, sigNum, heldMs, heldAction, null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets an action to a held sig as well as a released-without-hold action
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static BoolOutputSig SetSigHeldAction(this BoolOutputSig sig, uint heldMs, Action heldAction, Action holdReleasedAction, Action releaseAction)
|
||||
{
|
||||
CTimer heldTimer = null;
|
||||
bool wasHeld = false;
|
||||
return sig.SetBoolSigAction(press =>
|
||||
{
|
||||
if (press)
|
||||
{
|
||||
wasHeld = false;
|
||||
// Could insert a pressed action here
|
||||
heldTimer = new CTimer(o =>
|
||||
{
|
||||
// if still held and there's an action
|
||||
if (sig.BoolValue && heldAction != null)
|
||||
{
|
||||
wasHeld = true;
|
||||
// Hold action here
|
||||
heldAction();
|
||||
}
|
||||
}, heldMs);
|
||||
}
|
||||
else if (!press && !wasHeld) // released, no hold
|
||||
{
|
||||
heldTimer.Stop();
|
||||
if (releaseAction != null)
|
||||
releaseAction();
|
||||
}
|
||||
else // !press && wasHeld // released after held
|
||||
{
|
||||
heldTimer.Stop();
|
||||
if (holdReleasedAction != null)
|
||||
holdReleasedAction();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets an action to a held sig as well as a released-without-hold action
|
||||
/// </summary>
|
||||
/// <returns>The sig</returns>
|
||||
public static BoolOutputSig SetSigHeldAction(this BasicTriList tl, uint sigNum, uint heldMs, Action heldAction, Action releaseAction)
|
||||
{
|
||||
return tl.BooleanOutput[sigNum].SetSigHeldAction(heldMs, heldAction, null, releaseAction);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets an action to a held sig, an action for the release of hold, as well as a released-without-hold action
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static BoolOutputSig SetSigHeldAction(this BasicTriList tl, uint sigNum, uint heldMs, Action heldAction,
|
||||
Action holdReleasedAction, Action releaseAction)
|
||||
{
|
||||
return tl.BooleanOutput[sigNum].SetSigHeldAction(heldMs, heldAction, holdReleasedAction, releaseAction);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -108,5 +181,29 @@ namespace PepperDash.Essentials.Core
|
||||
{
|
||||
return ClearSigAction(tl.StringOutput[sigNum]) as StringOutputSig;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper method to set the value of a bool Sig on TriList
|
||||
/// </summary>
|
||||
public static void SetBool(this BasicTriList tl, uint sigNum, bool value)
|
||||
{
|
||||
tl.BooleanInput[sigNum].BoolValue = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper method to set the value of a ushort Sig on TriList
|
||||
/// </summary>
|
||||
public static void SetUshort(this BasicTriList tl, uint sigNum, ushort value)
|
||||
{
|
||||
tl.UShortInput[sigNum].UShortValue = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper method to set the value of a string Sig on TriList
|
||||
/// </summary>
|
||||
public static void SetString(this BasicTriList tl, uint sigNum, string value)
|
||||
{
|
||||
tl.StringInput[sigNum].StringValue = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -89,8 +89,10 @@ namespace PepperDash.Essentials.DM
|
||||
public void VolumeDown(bool pressRelease)
|
||||
{
|
||||
if (pressRelease)
|
||||
Output.Volume.CreateRamp(0, 400);
|
||||
#warning SCALE THIS RAMP
|
||||
{
|
||||
var remainingRatio = Output.Volume.UShortValue / 65535;
|
||||
Output.Volume.CreateRamp(0, (uint)(400 * remainingRatio));
|
||||
}
|
||||
else
|
||||
Output.Volume.StopRamp();
|
||||
}
|
||||
@@ -101,7 +103,10 @@ namespace PepperDash.Essentials.DM
|
||||
public void VolumeUp(bool pressRelease)
|
||||
{
|
||||
if (pressRelease)
|
||||
{
|
||||
var remainingRatio = (65535 - Output.Volume.UShortValue) / 65535;
|
||||
Output.Volume.CreateRamp(65535, 400);
|
||||
}
|
||||
else
|
||||
Output.Volume.StopRamp();
|
||||
}
|
||||
|
||||
120
Essentials DM/Essentials_DM/Chassis/DmCardAudioOutput.cs.orig
Normal file
120
Essentials DM/Essentials_DM/Chassis/DmCardAudioOutput.cs.orig
Normal file
@@ -0,0 +1,120 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro.DM;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.DM
|
||||
{
|
||||
public class DmCardAudioOutputController : IBasicVolumeWithFeedback
|
||||
{
|
||||
public Audio.Output Output { get; private set; }
|
||||
|
||||
public IntFeedback VolumeLevelFeedback { get; private set; }
|
||||
|
||||
public BoolFeedback MuteFeedback { get; private set; }
|
||||
|
||||
ushort PreMuteVolumeLevel;
|
||||
bool IsMuted;
|
||||
|
||||
public DmCardAudioOutputController(Audio.Output output)
|
||||
{
|
||||
Output = output;
|
||||
VolumeLevelFeedback = new IntFeedback(() => Output.VolumeFeedback.UShortValue);
|
||||
MuteFeedback = new BoolFeedback(() => IsMuted);
|
||||
}
|
||||
|
||||
#region IBasicVolumeWithFeedback Members
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void MuteOff()
|
||||
{
|
||||
SetVolume(PreMuteVolumeLevel);
|
||||
IsMuted = false;
|
||||
MuteFeedback.FireUpdate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void MuteOn()
|
||||
{
|
||||
PreMuteVolumeLevel = Output.VolumeFeedback.UShortValue;
|
||||
SetVolume(0);
|
||||
IsMuted = true;
|
||||
MuteFeedback.FireUpdate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void SetVolume(ushort level)
|
||||
{
|
||||
Debug.Console(2, "Set volume out {0}", level);
|
||||
Output.Volume.UShortValue = level;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
internal void VolumeEventFromChassis()
|
||||
{
|
||||
VolumeLevelFeedback.FireUpdate();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IBasicVolumeControls Members
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void MuteToggle()
|
||||
{
|
||||
if (IsMuted)
|
||||
MuteOff();
|
||||
else
|
||||
MuteOn();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void VolumeDown(bool pressRelease)
|
||||
{
|
||||
if (pressRelease)
|
||||
<<<<<<< HEAD
|
||||
{
|
||||
var remainingRatio = Output.Volume.UShortValue / 65535;
|
||||
Output.Volume.CreateRamp(0, (uint)(400 * remainingRatio));
|
||||
}
|
||||
=======
|
||||
Output.Volume.CreateRamp(0, 400);
|
||||
>>>>>>> origin/feature/fusion-nyu
|
||||
else
|
||||
Output.Volume.StopRamp();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void VolumeUp(bool pressRelease)
|
||||
{
|
||||
if (pressRelease)
|
||||
{
|
||||
var remainingRatio = (65535 - Output.Volume.UShortValue) / 65535;
|
||||
Output.Volume.CreateRamp(65535, 400);
|
||||
}
|
||||
else
|
||||
Output.Volume.StopRamp();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro.DM;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.DM
|
||||
{
|
||||
public class DmCardAudioOutputController : IBasicVolumeWithFeedback
|
||||
{
|
||||
public Audio.Output Output { get; private set; }
|
||||
|
||||
public IntFeedback VolumeLevelFeedback { get; private set; }
|
||||
|
||||
public BoolFeedback MuteFeedback { get; private set; }
|
||||
|
||||
ushort PreMuteVolumeLevel;
|
||||
bool IsMuted;
|
||||
|
||||
public DmCardAudioOutputController(Audio.Output output)
|
||||
{
|
||||
Output = output;
|
||||
VolumeLevelFeedback = new IntFeedback(() => Output.VolumeFeedback.UShortValue);
|
||||
MuteFeedback = new BoolFeedback(() => IsMuted);
|
||||
}
|
||||
|
||||
#region IBasicVolumeWithFeedback Members
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void MuteOff()
|
||||
{
|
||||
SetVolume(PreMuteVolumeLevel);
|
||||
IsMuted = false;
|
||||
MuteFeedback.FireUpdate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void MuteOn()
|
||||
{
|
||||
PreMuteVolumeLevel = Output.VolumeFeedback.UShortValue;
|
||||
SetVolume(0);
|
||||
IsMuted = true;
|
||||
MuteFeedback.FireUpdate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void SetVolume(ushort level)
|
||||
{
|
||||
Debug.Console(2, "Set volume out {0}", level);
|
||||
Output.Volume.UShortValue = level;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
internal void VolumeEventFromChassis()
|
||||
{
|
||||
VolumeLevelFeedback.FireUpdate();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IBasicVolumeControls Members
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void MuteToggle()
|
||||
{
|
||||
if (IsMuted)
|
||||
MuteOff();
|
||||
else
|
||||
MuteOn();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void VolumeDown(bool pressRelease)
|
||||
{
|
||||
if (pressRelease)
|
||||
<<<<<<< HEAD
|
||||
{
|
||||
var remainingRatio = Output.Volume.UShortValue / 65535;
|
||||
Output.Volume.CreateRamp(0, (uint)(400 * remainingRatio));
|
||||
}
|
||||
=======
|
||||
Output.Volume.CreateRamp(0, 400);
|
||||
>>>>>>> origin/feature/fusion-nyu
|
||||
else
|
||||
Output.Volume.StopRamp();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void VolumeUp(bool pressRelease)
|
||||
{
|
||||
if (pressRelease)
|
||||
{
|
||||
var remainingRatio = (65535 - Output.Volume.UShortValue) / 65535;
|
||||
Output.Volume.CreateRamp(65535, 400);
|
||||
}
|
||||
else
|
||||
Output.Volume.StopRamp();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro.DM;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.DM
|
||||
{
|
||||
public class DmCardAudioOutputController : IBasicVolumeWithFeedback
|
||||
{
|
||||
public Audio.Output Output { get; private set; }
|
||||
|
||||
public IntFeedback VolumeLevelFeedback { get; private set; }
|
||||
|
||||
public BoolFeedback MuteFeedback { get; private set; }
|
||||
|
||||
ushort PreMuteVolumeLevel;
|
||||
bool IsMuted;
|
||||
|
||||
public DmCardAudioOutputController(Audio.Output output)
|
||||
{
|
||||
Output = output;
|
||||
VolumeLevelFeedback = new IntFeedback(() => Output.VolumeFeedback.UShortValue);
|
||||
MuteFeedback = new BoolFeedback(() => IsMuted);
|
||||
}
|
||||
|
||||
#region IBasicVolumeWithFeedback Members
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void MuteOff()
|
||||
{
|
||||
SetVolume(PreMuteVolumeLevel);
|
||||
IsMuted = false;
|
||||
MuteFeedback.FireUpdate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void MuteOn()
|
||||
{
|
||||
PreMuteVolumeLevel = Output.VolumeFeedback.UShortValue;
|
||||
SetVolume(0);
|
||||
IsMuted = true;
|
||||
MuteFeedback.FireUpdate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void SetVolume(ushort level)
|
||||
{
|
||||
Debug.Console(2, "Set volume out {0}", level);
|
||||
Output.Volume.UShortValue = level;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
internal void VolumeEventFromChassis()
|
||||
{
|
||||
VolumeLevelFeedback.FireUpdate();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IBasicVolumeControls Members
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void MuteToggle()
|
||||
{
|
||||
if (IsMuted)
|
||||
MuteOff();
|
||||
else
|
||||
MuteOn();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void VolumeDown(bool pressRelease)
|
||||
{
|
||||
if (pressRelease)
|
||||
Output.Volume.CreateRamp(0, 400);
|
||||
#warning SCALE THIS RAMP
|
||||
else
|
||||
Output.Volume.StopRamp();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void VolumeUp(bool pressRelease)
|
||||
{
|
||||
if (pressRelease)
|
||||
Output.Volume.CreateRamp(65535, 400);
|
||||
else
|
||||
Output.Volume.StopRamp();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro.DM;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.DM
|
||||
{
|
||||
public class DmCardAudioOutputController : IBasicVolumeWithFeedback
|
||||
{
|
||||
public Audio.Output Output { get; private set; }
|
||||
|
||||
public IntFeedback VolumeLevelFeedback { get; private set; }
|
||||
|
||||
public BoolFeedback MuteFeedback { get; private set; }
|
||||
|
||||
ushort PreMuteVolumeLevel;
|
||||
bool IsMuted;
|
||||
|
||||
public DmCardAudioOutputController(Audio.Output output)
|
||||
{
|
||||
Output = output;
|
||||
VolumeLevelFeedback = new IntFeedback(() => Output.VolumeFeedback.UShortValue);
|
||||
MuteFeedback = new BoolFeedback(() => IsMuted);
|
||||
}
|
||||
|
||||
#region IBasicVolumeWithFeedback Members
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void MuteOff()
|
||||
{
|
||||
SetVolume(PreMuteVolumeLevel);
|
||||
IsMuted = false;
|
||||
MuteFeedback.FireUpdate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void MuteOn()
|
||||
{
|
||||
PreMuteVolumeLevel = Output.VolumeFeedback.UShortValue;
|
||||
SetVolume(0);
|
||||
IsMuted = true;
|
||||
MuteFeedback.FireUpdate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void SetVolume(ushort level)
|
||||
{
|
||||
Debug.Console(2, "Set volume out {0}", level);
|
||||
Output.Volume.UShortValue = level;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
internal void VolumeEventFromChassis()
|
||||
{
|
||||
VolumeLevelFeedback.FireUpdate();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IBasicVolumeControls Members
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void MuteToggle()
|
||||
{
|
||||
if (IsMuted)
|
||||
MuteOff();
|
||||
else
|
||||
MuteOn();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void VolumeDown(bool pressRelease)
|
||||
{
|
||||
if (pressRelease)
|
||||
{
|
||||
var remainingRatio = Output.Volume.UShortValue / 65535;
|
||||
Output.Volume.CreateRamp(0, (uint)(400 * remainingRatio));
|
||||
}
|
||||
else
|
||||
Output.Volume.StopRamp();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void VolumeUp(bool pressRelease)
|
||||
{
|
||||
if (pressRelease)
|
||||
{
|
||||
var remainingRatio = (65535 - Output.Volume.UShortValue) / 65535;
|
||||
Output.Volume.CreateRamp(65535, 400);
|
||||
}
|
||||
else
|
||||
Output.Volume.StopRamp();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro.DM;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.DM
|
||||
{
|
||||
public class DmCardAudioOutputController : IBasicVolumeWithFeedback
|
||||
{
|
||||
public Audio.Output Output { get; private set; }
|
||||
|
||||
public IntFeedback VolumeLevelFeedback { get; private set; }
|
||||
|
||||
public BoolFeedback MuteFeedback { get; private set; }
|
||||
|
||||
ushort PreMuteVolumeLevel;
|
||||
bool IsMuted;
|
||||
|
||||
public DmCardAudioOutputController(Audio.Output output)
|
||||
{
|
||||
Output = output;
|
||||
VolumeLevelFeedback = new IntFeedback(() => Output.VolumeFeedback.UShortValue);
|
||||
MuteFeedback = new BoolFeedback(() => IsMuted);
|
||||
}
|
||||
|
||||
#region IBasicVolumeWithFeedback Members
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void MuteOff()
|
||||
{
|
||||
SetVolume(PreMuteVolumeLevel);
|
||||
IsMuted = false;
|
||||
MuteFeedback.FireUpdate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void MuteOn()
|
||||
{
|
||||
PreMuteVolumeLevel = Output.VolumeFeedback.UShortValue;
|
||||
SetVolume(0);
|
||||
IsMuted = true;
|
||||
MuteFeedback.FireUpdate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void SetVolume(ushort level)
|
||||
{
|
||||
Debug.Console(2, "Set volume out {0}", level);
|
||||
Output.Volume.UShortValue = level;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
internal void VolumeEventFromChassis()
|
||||
{
|
||||
VolumeLevelFeedback.FireUpdate();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IBasicVolumeControls Members
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void MuteToggle()
|
||||
{
|
||||
if (IsMuted)
|
||||
MuteOff();
|
||||
else
|
||||
MuteOn();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void VolumeDown(bool pressRelease)
|
||||
{
|
||||
if (pressRelease)
|
||||
Output.Volume.CreateRamp(0, 400);
|
||||
else
|
||||
Output.Volume.StopRamp();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void VolumeUp(bool pressRelease)
|
||||
{
|
||||
if (pressRelease)
|
||||
Output.Volume.CreateRamp(65535, 400);
|
||||
else
|
||||
Output.Volume.StopRamp();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -57,9 +57,9 @@
|
||||
<Reference Include="mscorlib" />
|
||||
<Reference Include="PepperDash_Core, Version=1.0.0.15153, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\PepperDash.Core\Pepperdash Core\Pepperdash Core\bin\PepperDash_Core.dll</HintPath>
|
||||
<HintPath>..\..\..\pepperdash-simplsharp-core\Pepperdash Core\CLZ Builds\PepperDash_Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PepperDash_Essentials_Core, Version=1.0.0.14500, Culture=neutral, processorArchitecture=MSIL">
|
||||
<Reference Include="PepperDash_Essentials_Core, Version=1.0.0.24289, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\Essentials Core\PepperDashEssentialsBase\bin\PepperDash_Essentials_Core.dll</HintPath>
|
||||
</Reference>
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Codec
|
||||
|
||||
{
|
||||
public class CodecActiveCallItem
|
||||
{
|
||||
public string Name { get; set; }
|
||||
|
||||
public string Number { get; set; }
|
||||
|
||||
public eCodecCallType Type { get; set; }
|
||||
|
||||
public eCodecCallStatus Status { get; set; }
|
||||
|
||||
public eCodecCallDirection Direction { get; set; }
|
||||
|
||||
public string Id { get; set; }
|
||||
|
||||
//public object CallMetaData { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns true when this call is any status other than
|
||||
/// Unknown, Disconnected, Disconnecting
|
||||
/// </summary>
|
||||
public bool IsActiveCall
|
||||
{
|
||||
get
|
||||
{
|
||||
return !(Status == eCodecCallStatus.Disconnected
|
||||
|| Status == eCodecCallStatus.Disconnecting
|
||||
|| Status == eCodecCallStatus.Idle
|
||||
|| Status == eCodecCallStatus.Unknown);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Codec
|
||||
|
||||
{
|
||||
public class CodecActiveCallItem
|
||||
{
|
||||
public string Name { get; set; }
|
||||
|
||||
public string Number { get; set; }
|
||||
|
||||
<<<<<<< HEAD:Essentials Devices Common/Essentials Devices Common/Codec/CodecActiveCallItem.cs
|
||||
public eCodecCallType Type { get; set; }
|
||||
|
||||
public eCodecCallStatus Status { get; set; }
|
||||
|
||||
public string Id { get; set; }
|
||||
=======
|
||||
public eCodecCallType Type { get; set; }
|
||||
|
||||
public eCodecCallStatus Status { get; set; }
|
||||
|
||||
public string Id { get; set; }
|
||||
|
||||
public object CallMetaData { get; set; }
|
||||
>>>>>>> origin/feature/cisco-spark-2:Essentials Devices Common/Essentials Devices Common/VideoCodec/CodecActiveCallItem.cs
|
||||
}
|
||||
|
||||
public enum eCodecCallType
|
||||
{
|
||||
Unknown = 0, Audio, Video
|
||||
<<<<<<< HEAD:Essentials Devices Common/Essentials Devices Common/Codec/CodecActiveCallItem.cs
|
||||
}
|
||||
|
||||
public enum eCodecCallStatus
|
||||
{
|
||||
Unknown = 0, Dialing, Connected, Incoming, OnHold, Disconnected
|
||||
=======
|
||||
}
|
||||
|
||||
public enum eCodecCallStatus
|
||||
{
|
||||
Unknown = 0, Dialing, Connected, Incoming, OnHold, Disconnected
|
||||
>>>>>>> origin/feature/cisco-spark-2:Essentials Devices Common/Essentials Devices Common/VideoCodec/CodecActiveCallItem.cs
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Codec
|
||||
|
||||
{
|
||||
public enum eCodecCallDirection
|
||||
{
|
||||
Unknown = 0, Incoming, Outgoing
|
||||
}
|
||||
|
||||
public class CodecCallDirection
|
||||
{
|
||||
/// <summary>
|
||||
/// Takes the Cisco call type and converts to the matching enum
|
||||
/// </summary>
|
||||
/// <param name="s"></param>
|
||||
/// <returns></returns>
|
||||
public static eCodecCallDirection ConvertToDirectionEnum(string s)
|
||||
{
|
||||
switch (s.ToLower())
|
||||
{
|
||||
case "incoming":
|
||||
{
|
||||
return eCodecCallDirection.Incoming;
|
||||
}
|
||||
case "outgoing":
|
||||
{
|
||||
return eCodecCallDirection.Outgoing;
|
||||
}
|
||||
default:
|
||||
return eCodecCallDirection.Unknown;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Codec
|
||||
{
|
||||
public enum eCodecCallStatus
|
||||
{
|
||||
Unknown = 0,
|
||||
Connected,
|
||||
Connecting,
|
||||
Dialing,
|
||||
Disconnected,
|
||||
Disconnecting,
|
||||
EarlyMedia,
|
||||
Idle,
|
||||
OnHold,
|
||||
Ringing,
|
||||
Preserved,
|
||||
RemotePreserved,
|
||||
}
|
||||
|
||||
|
||||
public class CodecCallStatus
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Takes the Cisco call type and converts to the matching enum
|
||||
/// </summary>
|
||||
/// <param name="s"></param>
|
||||
/// <returns></returns>
|
||||
public static eCodecCallStatus ConvertToStatusEnum(string s)
|
||||
{
|
||||
switch (s)
|
||||
{
|
||||
case "Connected":
|
||||
{
|
||||
return eCodecCallStatus.Connected;
|
||||
}
|
||||
case "Connecting":
|
||||
{
|
||||
return eCodecCallStatus.Connecting;
|
||||
}
|
||||
case "Dialling":
|
||||
{
|
||||
return eCodecCallStatus.Dialing;
|
||||
}
|
||||
case "Disconnected":
|
||||
{
|
||||
return eCodecCallStatus.Disconnected;
|
||||
}
|
||||
case "Disconnecting":
|
||||
{
|
||||
return eCodecCallStatus.Disconnecting;
|
||||
}
|
||||
case "EarlyMedia":
|
||||
{
|
||||
return eCodecCallStatus.EarlyMedia;
|
||||
}
|
||||
case "Idle":
|
||||
{
|
||||
return eCodecCallStatus.Idle;
|
||||
}
|
||||
case "OnHold":
|
||||
{
|
||||
return eCodecCallStatus.OnHold;
|
||||
}
|
||||
case "Ringing":
|
||||
{
|
||||
return eCodecCallStatus.Ringing;
|
||||
}
|
||||
case "Preserved":
|
||||
{
|
||||
return eCodecCallStatus.Preserved;
|
||||
}
|
||||
case "RemotePreserved":
|
||||
{
|
||||
return eCodecCallStatus.RemotePreserved;
|
||||
}
|
||||
default:
|
||||
return eCodecCallStatus.Unknown;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Codec
|
||||
|
||||
{
|
||||
public enum eCodecCallType
|
||||
{
|
||||
Unknown = 0,
|
||||
Audio,
|
||||
Video,
|
||||
AudioCanEscalate,
|
||||
ForwardAllCall
|
||||
}
|
||||
|
||||
public class CodecCallType
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Takes the Cisco call type and converts to the matching enum
|
||||
/// </summary>
|
||||
/// <param name="s"></param>
|
||||
/// <returns></returns>
|
||||
public static eCodecCallType ConvertToTypeEnum(string s)
|
||||
{
|
||||
switch (s)
|
||||
{
|
||||
case "Audio":
|
||||
{
|
||||
return eCodecCallType.Audio;
|
||||
}
|
||||
case "Video":
|
||||
{
|
||||
return eCodecCallType.Video;
|
||||
}
|
||||
case "AudioCanEscalate":
|
||||
{
|
||||
return eCodecCallType.AudioCanEscalate;
|
||||
}
|
||||
case "ForwardAllCall":
|
||||
{
|
||||
return eCodecCallType.ForwardAllCall;
|
||||
}
|
||||
default:
|
||||
return eCodecCallType.Unknown;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Codec
|
||||
{
|
||||
public enum eMeetingPrivacy
|
||||
{
|
||||
Unknown = 0,
|
||||
Public,
|
||||
Private
|
||||
}
|
||||
|
||||
public class CodecCallPrivacy
|
||||
{
|
||||
/// <summary>
|
||||
/// Takes the Cisco privacy type and converts to the matching enum
|
||||
/// </summary>
|
||||
/// <param name="s"></param>
|
||||
/// <returns></returns>
|
||||
public static eMeetingPrivacy ConvertToDirectionEnum(string s)
|
||||
{
|
||||
switch (s.ToLower())
|
||||
{
|
||||
case "public":
|
||||
{
|
||||
return eMeetingPrivacy.Public;
|
||||
}
|
||||
case "private":
|
||||
{
|
||||
return eMeetingPrivacy.Private;
|
||||
}
|
||||
default:
|
||||
return eMeetingPrivacy.Unknown;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Codec
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines minimum volume controls for a codec device with dialing capabilities
|
||||
/// </summary>
|
||||
public interface ICodecAudio : IBasicVolumeWithFeedback, IPrivacy
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Codec
|
||||
{
|
||||
/// <summary>
|
||||
/// Implements a common set of data about a codec
|
||||
/// </summary>
|
||||
public interface iCodecInfo
|
||||
{
|
||||
VideoCodecInfo CodecInfo { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stores general information about a codec
|
||||
/// </summary>
|
||||
public abstract class VideoCodecInfo
|
||||
{
|
||||
public abstract bool MultiSiteOptionIsEnabled { get; }
|
||||
public abstract string IpAddress { get; }
|
||||
public abstract string SipPhoneNumber { get; }
|
||||
public abstract string E164Alias { get; }
|
||||
public abstract string H323Id { get; }
|
||||
public abstract string SipUri { get; }
|
||||
public abstract bool AutoAnswerEnabled { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Codec
|
||||
{
|
||||
public interface IHasCallFavorites
|
||||
{
|
||||
CodecCallFavorites CallFavorites { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents favorites entries for a codec device
|
||||
/// </summary>
|
||||
public class CodecCallFavorites
|
||||
{
|
||||
public List<CodecActiveCallItem> Favorites { get; set; }
|
||||
|
||||
public CodecCallFavorites()
|
||||
{
|
||||
Favorites = new List<CodecActiveCallItem>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Devices.Common.Codec;
|
||||
using PepperDash.Essentials.Devices.Common.VideoCodec;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Codec
|
||||
{
|
||||
public interface IHasCallHistory
|
||||
{
|
||||
CodecCallHistory CallHistory { get; }
|
||||
|
||||
void RemoveCallHistoryEntry(CodecCallHistory.CallHistoryEntry entry);
|
||||
}
|
||||
|
||||
public enum eCodecOccurrenceType
|
||||
{
|
||||
Unknown = 0,
|
||||
Placed,
|
||||
Received,
|
||||
NoAnswer
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents the recent call history for a codec device
|
||||
/// </summary>
|
||||
public class CodecCallHistory
|
||||
{
|
||||
public event EventHandler<EventArgs> RecentCallsListHasChanged;
|
||||
|
||||
public List<CallHistoryEntry> RecentCalls { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Item that gets added to the list when there are no recent calls in history
|
||||
/// </summary>
|
||||
CallHistoryEntry ListEmptyEntry;
|
||||
|
||||
public CodecCallHistory()
|
||||
{
|
||||
ListEmptyEntry = new CallHistoryEntry() { Name = "No Recent Calls" };
|
||||
|
||||
RecentCalls = new List<CallHistoryEntry>();
|
||||
|
||||
RecentCalls.Add(ListEmptyEntry);
|
||||
}
|
||||
|
||||
void OnRecentCallsListChange()
|
||||
{
|
||||
var handler = RecentCallsListHasChanged;
|
||||
if (handler != null)
|
||||
{
|
||||
handler(this, new EventArgs());
|
||||
|
||||
//if (Debug.Level == 1)
|
||||
//{
|
||||
|
||||
// Debug.Console(1, "RecentCalls:\n");
|
||||
|
||||
// foreach (CodecCallHistory.CallHistoryEntry entry in RecentCalls)
|
||||
// {
|
||||
// Debug.Console(1, "\nName: {0}\nNumber: {1}\nStartTime: {2}\nType: {3}\n", entry.Name, entry.Number, entry.StartTime.ToString(), entry.OccurenceType);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveEntry(CallHistoryEntry entry)
|
||||
{
|
||||
RecentCalls.Remove(entry);
|
||||
OnRecentCallsListChange();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generic call history entry, not device specific
|
||||
/// </summary>
|
||||
public class CallHistoryEntry : CodecActiveCallItem
|
||||
{
|
||||
public DateTime StartTime { get; set; }
|
||||
public eCodecOccurrenceType OccurenceType { get; set; }
|
||||
public string OccurrenceHistoryId { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a list of call history entries returned by a Cisco codec to the generic list type
|
||||
/// </summary>
|
||||
/// <param name="entries"></param>
|
||||
/// <returns></returns>
|
||||
public void ConvertCiscoCallHistoryToGeneric(List<CiscoCallHistory.Entry> entries)
|
||||
{
|
||||
var genericEntries = new List<CallHistoryEntry>();
|
||||
|
||||
foreach (CiscoCallHistory.Entry entry in entries)
|
||||
{
|
||||
|
||||
genericEntries.Add(new CallHistoryEntry()
|
||||
{
|
||||
Name = entry.DisplayName.Value,
|
||||
Number = entry.CallbackNumber.Value,
|
||||
StartTime = entry.LastOccurrenceStartTime.Value,
|
||||
OccurrenceHistoryId = entry.LastOccurrenceHistoryId.Value,
|
||||
OccurenceType = ConvertToOccurenceTypeEnum(entry.OccurrenceType.Value)
|
||||
});
|
||||
}
|
||||
|
||||
// Check if list is empty and if so, add an item to display No Recent Calls
|
||||
if(genericEntries.Count == 0)
|
||||
genericEntries.Add(ListEmptyEntry);
|
||||
|
||||
RecentCalls = genericEntries;
|
||||
OnRecentCallsListChange();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Takes the Cisco occurence type and converts it to the matching enum
|
||||
/// </summary>
|
||||
/// <param name="s"></para
|
||||
public eCodecOccurrenceType ConvertToOccurenceTypeEnum(string s)
|
||||
{
|
||||
switch (s)
|
||||
{
|
||||
case "Placed":
|
||||
{
|
||||
return eCodecOccurrenceType.Placed;
|
||||
}
|
||||
case "Received":
|
||||
{
|
||||
return eCodecOccurrenceType.Received;
|
||||
}
|
||||
case "NoAnswer":
|
||||
{
|
||||
return eCodecOccurrenceType.NoAnswer;
|
||||
}
|
||||
default:
|
||||
return eCodecOccurrenceType.Unknown;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Codec
|
||||
{
|
||||
public interface IHasContentSharing
|
||||
{
|
||||
BoolFeedback SharingContentIsOnFeedback { get; }
|
||||
StringFeedback SharingSourceFeedback { get; }
|
||||
|
||||
bool AutoShareContentWhileInCall { get; }
|
||||
|
||||
void StartSharing();
|
||||
void StopSharing();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Codec
|
||||
{
|
||||
/// <summary>
|
||||
/// Requirements for a device that has dialing capabilities
|
||||
/// </summary>
|
||||
public interface IHasDialer
|
||||
{
|
||||
// Add requirements for Dialer functionality
|
||||
|
||||
event EventHandler<CodecCallStatusItemChangeEventArgs> CallStatusChange;
|
||||
|
||||
void Dial(string number);
|
||||
void EndCall(CodecActiveCallItem activeCall);
|
||||
void EndAllCalls();
|
||||
void AcceptCall(CodecActiveCallItem item);
|
||||
void RejectCall(CodecActiveCallItem item);
|
||||
void SendDtmf(string digit);
|
||||
|
||||
//BoolFeedback IncomingCallFeedback { get; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class CodecCallStatusItemChangeEventArgs : EventArgs
|
||||
{
|
||||
public CodecActiveCallItem CallItem { get; private set; }
|
||||
|
||||
//public eCodecCallStatus PreviousStatus { get; private set; }
|
||||
|
||||
//public eCodecCallStatus NewStatus { get; private set; }
|
||||
|
||||
public CodecCallStatusItemChangeEventArgs(/*eCodecCallStatus previousStatus,
|
||||
eCodecCallStatus newStatus,*/ CodecActiveCallItem item)
|
||||
{
|
||||
//PreviousStatus = previousStatus;
|
||||
//NewStatus = newStatus;
|
||||
CallItem = item;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Devices.Common.VideoCodec;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Codec
|
||||
{
|
||||
public interface IHasDirectory
|
||||
{
|
||||
event EventHandler<DirectoryEventArgs> DirectoryResultReturned;
|
||||
|
||||
CodecDirectory DirectoryRoot { get; }
|
||||
|
||||
CodecPhonebookSyncState PhonebookSyncState { get; }
|
||||
|
||||
void SearchDirectory(string searchString);
|
||||
|
||||
void GetDirectoryFolderContents(string folderId);
|
||||
}
|
||||
|
||||
public class DirectoryEventArgs : EventArgs
|
||||
{
|
||||
public CodecDirectory Directory { get; set; }
|
||||
}
|
||||
|
||||
public class CodecDirectory
|
||||
{
|
||||
public List<DirectoryItem> DirectoryResults { get; private set; }
|
||||
|
||||
public string ResultsFolderId { get; set; }
|
||||
|
||||
//public int Limit { get; private set; }
|
||||
|
||||
public CodecDirectory()
|
||||
{
|
||||
DirectoryResults = new List<DirectoryItem>();
|
||||
}
|
||||
|
||||
public void AddFoldersToDirectory(List<DirectoryItem> folders)
|
||||
{
|
||||
if(folders != null)
|
||||
DirectoryResults.AddRange(folders);
|
||||
|
||||
SortDirectory();
|
||||
}
|
||||
|
||||
public void AddContactsToDirectory(List<DirectoryItem> contacts)
|
||||
{
|
||||
if(contacts != null)
|
||||
DirectoryResults.AddRange(contacts);
|
||||
|
||||
SortDirectory();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Formats the DirectoryResults list to display all folders alphabetically, then all contacts alphabetically
|
||||
/// </summary>
|
||||
private void SortDirectory()
|
||||
{
|
||||
var sortedFolders = new List<DirectoryItem>();
|
||||
|
||||
sortedFolders.AddRange(DirectoryResults.Where(f => f is DirectoryFolder));
|
||||
|
||||
sortedFolders.OrderBy(f => f.Name);
|
||||
|
||||
var sortedContacts = new List<DirectoryItem>();
|
||||
|
||||
sortedContacts.AddRange(DirectoryResults.Where(c => c is DirectoryContact));
|
||||
|
||||
sortedFolders.OrderBy(c => c.Name);
|
||||
|
||||
DirectoryResults.Clear();
|
||||
|
||||
DirectoryResults.AddRange(sortedFolders);
|
||||
|
||||
DirectoryResults.AddRange(sortedContacts);
|
||||
}
|
||||
}
|
||||
|
||||
public class DirectoryItem
|
||||
{
|
||||
public string Name { get; set; }
|
||||
}
|
||||
|
||||
public class DirectoryFolder : DirectoryItem
|
||||
{
|
||||
public List<DirectoryContact> Contacts { get; set; }
|
||||
public string FolderId { get; set; }
|
||||
public string ParentFolderId { get; set; }
|
||||
|
||||
public DirectoryFolder()
|
||||
{
|
||||
Contacts = new List<DirectoryContact>();
|
||||
}
|
||||
}
|
||||
|
||||
public class DirectoryContact : DirectoryItem
|
||||
{
|
||||
public string ContactId { get; set; }
|
||||
public string FolderId { get; set; }
|
||||
public string Title { get; set; }
|
||||
public List<ContactMethod> ContactMethods { get; set; }
|
||||
|
||||
public DirectoryContact()
|
||||
{
|
||||
ContactMethods = new List<ContactMethod>();
|
||||
}
|
||||
}
|
||||
|
||||
public class ContactMethod
|
||||
{
|
||||
public string ContactMethodId { get; set; }
|
||||
public string Number { get; set; }
|
||||
public eContactMethodDevice Device { get; set; }
|
||||
public eContactMethodCallType CallType { get; set; }
|
||||
}
|
||||
|
||||
public enum eContactMethodDevice
|
||||
{
|
||||
Unknown = 0,
|
||||
Mobile,
|
||||
Other,
|
||||
Telephone,
|
||||
Video
|
||||
}
|
||||
|
||||
public enum eContactMethodCallType
|
||||
{
|
||||
Unknown = 0,
|
||||
Audio,
|
||||
Video
|
||||
}
|
||||
|
||||
public class DirectorySearchResultEventArgs : EventArgs
|
||||
{
|
||||
public CodecDirectory Directory { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Codec
|
||||
{
|
||||
public enum eMeetingEventChangeType
|
||||
{
|
||||
Unkown = 0,
|
||||
MeetingStartWarning,
|
||||
MeetingStart,
|
||||
MeetingEndWarning,
|
||||
MeetingEnd
|
||||
}
|
||||
|
||||
public interface IHasScheduleAwareness
|
||||
{
|
||||
CodecScheduleAwareness CodecSchedule { get; }
|
||||
|
||||
void GetSchedule();
|
||||
}
|
||||
|
||||
public class CodecScheduleAwareness
|
||||
{
|
||||
List<Meeting> _Meetings;
|
||||
|
||||
public event EventHandler<MeetingEventArgs> MeetingEventChange;
|
||||
|
||||
public event EventHandler<EventArgs> MeetingsListHasChanged;
|
||||
|
||||
public List<Meeting> Meetings
|
||||
{
|
||||
get
|
||||
{
|
||||
return _Meetings;
|
||||
}
|
||||
set
|
||||
{
|
||||
_Meetings = value;
|
||||
|
||||
var handler = MeetingsListHasChanged;
|
||||
if (handler != null)
|
||||
{
|
||||
handler(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private CTimer ScheduleChecker;
|
||||
|
||||
public CodecScheduleAwareness()
|
||||
{
|
||||
Meetings = new List<Meeting>();
|
||||
|
||||
ScheduleChecker = new CTimer(CheckSchedule, null, 1000, 1000);
|
||||
}
|
||||
|
||||
private void OnMeetingChange(eMeetingEventChangeType changeType, Meeting meeting)
|
||||
{
|
||||
var handler = MeetingEventChange;
|
||||
if (handler != null)
|
||||
{
|
||||
handler(this, new MeetingEventArgs() { ChangeType = changeType, Meeting = meeting });
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckSchedule(object o)
|
||||
{
|
||||
// Iterate the meeting list and check if any meeting need to do anythingk
|
||||
|
||||
foreach (Meeting m in Meetings)
|
||||
{
|
||||
eMeetingEventChangeType changeType = eMeetingEventChangeType.Unkown;
|
||||
|
||||
if (m.TimeToMeetingStart.TotalMinutes <= m.MeetingWarningMinutes.TotalMinutes) // Meeting is about to start
|
||||
changeType = eMeetingEventChangeType.MeetingStartWarning;
|
||||
else if (m.TimeToMeetingStart.TotalMinutes == 0) // Meeting Start
|
||||
changeType = eMeetingEventChangeType.MeetingStart;
|
||||
else if (m.TimeToMeetingEnd.TotalMinutes <= m.MeetingWarningMinutes.TotalMinutes) // Meeting is about to end
|
||||
changeType = eMeetingEventChangeType.MeetingEndWarning;
|
||||
else if (m.TimeToMeetingEnd.TotalMinutes == 0) // Meeting has ended
|
||||
changeType = eMeetingEventChangeType.MeetingEnd;
|
||||
|
||||
if (changeType != eMeetingEventChangeType.Unkown)
|
||||
OnMeetingChange(changeType, m);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generic class to represent a meeting (Cisco or Polycom OBTP or Fusion)
|
||||
/// </summary>
|
||||
public class Meeting
|
||||
{
|
||||
public TimeSpan MeetingWarningMinutes = TimeSpan.FromMinutes(5);
|
||||
|
||||
public string Id { get; set; }
|
||||
public string Organizer { get; set; }
|
||||
public string Title { get; set; }
|
||||
public string Agenda { get; set; }
|
||||
public TimeSpan TimeToMeetingStart
|
||||
{
|
||||
get
|
||||
{
|
||||
return StartTime - DateTime.Now;
|
||||
}
|
||||
}
|
||||
public TimeSpan TimeToMeetingEnd
|
||||
{
|
||||
get
|
||||
{
|
||||
return EndTime - DateTime.Now;
|
||||
}
|
||||
}
|
||||
public DateTime StartTime { get; set; }
|
||||
public DateTime EndTime { get; set; }
|
||||
public TimeSpan Duration
|
||||
{
|
||||
get
|
||||
{
|
||||
return EndTime - StartTime;
|
||||
}
|
||||
}
|
||||
public eMeetingPrivacy Privacy { get; set; }
|
||||
public bool Joinable
|
||||
{
|
||||
get
|
||||
{
|
||||
return StartTime.AddMinutes(-5) <= DateTime.Now
|
||||
&& DateTime.Now <= EndTime.AddMinutes(-5);
|
||||
}
|
||||
}
|
||||
//public string ConferenceNumberToDial { get; set; }
|
||||
public string ConferencePassword { get; set; }
|
||||
public bool IsOneButtonToPushMeeting { get; set; }
|
||||
|
||||
public List<Call> Calls { get; private set; }
|
||||
|
||||
public Meeting()
|
||||
{
|
||||
Calls = new List<Call>();
|
||||
}
|
||||
}
|
||||
|
||||
public class Call
|
||||
{
|
||||
public string Number { get; set; }
|
||||
public string Protocol { get; set; }
|
||||
public string CallRate { get; set; }
|
||||
public string CallType { get; set; }
|
||||
}
|
||||
|
||||
public class MeetingEventArgs : EventArgs
|
||||
{
|
||||
public eMeetingEventChangeType ChangeType { get; set; }
|
||||
public Meeting Meeting { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
@@ -17,10 +17,10 @@ namespace PepperDash.Essentials.Devices.Common.DSP
|
||||
|
||||
// Verbose on subscriptions?
|
||||
|
||||
// Example subscription feedback responses
|
||||
// ! "publishToken":"name" "value":-77.0
|
||||
// ! "myLevelName" -77
|
||||
|
||||
|
||||
public class BiampTesiraForteDsp : DspBase
|
||||
{
|
||||
public IBasicCommunication Communication { get; private set; }
|
||||
|
||||
@@ -10,18 +10,6 @@ using System.Text.RegularExpressions;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.DSP
|
||||
{
|
||||
|
||||
// QUESTIONS:
|
||||
//
|
||||
// When subscribing, just use the Instance ID for Custom Name?
|
||||
|
||||
// Verbose on subscriptions?
|
||||
|
||||
// ! "publishToken":"name" "value":-77.0
|
||||
// ! "myLevelName" -77
|
||||
|
||||
#warning Working here when set aside for config editor work
|
||||
|
||||
public class TesiraForteLevelControl : TesiraForteControlPoint, IDspLevelControl, IKeyed
|
||||
{
|
||||
bool _IsMuted;
|
||||
|
||||
@@ -1,308 +1,314 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Routing;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common
|
||||
{
|
||||
public class IRBlurayBase : Device, IDiscPlayerControls, IUiDisplayInfo, IRoutingOutputs
|
||||
{
|
||||
public IrOutputPortController IrPort { get; private set; }
|
||||
|
||||
public uint DisplayUiType { get { return DisplayUiConstants.TypeBluray; } }
|
||||
|
||||
public IRBlurayBase(string key, string name, IrOutputPortController portCont)
|
||||
: base(key, name)
|
||||
{
|
||||
IrPort = portCont;
|
||||
DeviceManager.AddDevice(portCont);
|
||||
|
||||
HasKeypadAccessoryButton1 = true;
|
||||
KeypadAccessoryButton1Command = "Clear";
|
||||
KeypadAccessoryButton1Label = "Clear";
|
||||
|
||||
HasKeypadAccessoryButton2 = true;
|
||||
KeypadAccessoryButton2Command = "NumericEnter";
|
||||
KeypadAccessoryButton2Label = "Enter";
|
||||
|
||||
PowerIsOnFeedback = new BoolFeedback(() => _PowerIsOn);
|
||||
|
||||
HdmiOut = new RoutingOutputPort(RoutingPortNames.HdmiOut, eRoutingSignalType.AudioVideo,
|
||||
eRoutingPortConnectionType.Hdmi, null, this);
|
||||
AnyAudioOut = new RoutingOutputPort(RoutingPortNames.AnyAudioOut, eRoutingSignalType.Audio,
|
||||
eRoutingPortConnectionType.DigitalAudio, null, this);
|
||||
OutputPorts = new RoutingPortCollection<RoutingOutputPort> { HdmiOut, AnyAudioOut };
|
||||
}
|
||||
|
||||
|
||||
#region IDPad Members
|
||||
|
||||
public void Up(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_UP_ARROW, pressRelease);
|
||||
}
|
||||
|
||||
public void Down(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_DN_ARROW, pressRelease);
|
||||
}
|
||||
|
||||
public void Left(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_LEFT_ARROW, pressRelease);
|
||||
}
|
||||
|
||||
public void Right(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_RIGHT_ARROW, pressRelease);
|
||||
}
|
||||
|
||||
public void Select(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_ENTER, pressRelease);
|
||||
}
|
||||
|
||||
public void Menu(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_MENU, pressRelease);
|
||||
}
|
||||
|
||||
public void Exit(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_EXIT, pressRelease);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region INumericKeypad Members
|
||||
|
||||
public void Digit0(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_0, pressRelease);
|
||||
}
|
||||
|
||||
public void Digit1(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_1, pressRelease);
|
||||
}
|
||||
|
||||
public void Digit2(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_2, pressRelease);
|
||||
}
|
||||
|
||||
public void Digit3(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_3, pressRelease);
|
||||
}
|
||||
|
||||
public void Digit4(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_4, pressRelease);
|
||||
}
|
||||
|
||||
public void Digit5(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_5, pressRelease);
|
||||
}
|
||||
|
||||
public void Digit6(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_6, pressRelease);
|
||||
}
|
||||
|
||||
public void Digit7(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_7, pressRelease);
|
||||
}
|
||||
|
||||
public void Digit8(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_8, pressRelease);
|
||||
}
|
||||
|
||||
public void Digit9(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_9, pressRelease);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defaults to true
|
||||
/// </summary>
|
||||
public bool HasKeypadAccessoryButton1 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Defaults to "-"
|
||||
/// </summary>
|
||||
public string KeypadAccessoryButton1Label { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Defaults to "Dash"
|
||||
/// </summary>
|
||||
public string KeypadAccessoryButton1Command { get; set; }
|
||||
|
||||
public void KeypadAccessoryButton1(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(KeypadAccessoryButton1Command, pressRelease);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defaults to true
|
||||
/// </summary>
|
||||
public bool HasKeypadAccessoryButton2 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Defaults to "Enter"
|
||||
/// </summary>
|
||||
public string KeypadAccessoryButton2Label { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Defaults to "Enter"
|
||||
/// </summary>
|
||||
public string KeypadAccessoryButton2Command { get; set; }
|
||||
|
||||
public void KeypadAccessoryButton2(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(KeypadAccessoryButton2Command, pressRelease);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IChannelFunctions Members
|
||||
|
||||
public void ChannelUp(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_CH_PLUS, pressRelease);
|
||||
}
|
||||
|
||||
public void ChannelDown(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_CH_MINUS, pressRelease);
|
||||
}
|
||||
|
||||
public void LastChannel(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_LAST, pressRelease);
|
||||
}
|
||||
|
||||
public void Guide(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_GUIDE, pressRelease);
|
||||
}
|
||||
|
||||
public void Info(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_INFO, pressRelease);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IColorFunctions Members
|
||||
|
||||
public void Red(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_RED, pressRelease);
|
||||
}
|
||||
|
||||
public void Green(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_GREEN, pressRelease);
|
||||
}
|
||||
|
||||
public void Yellow(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_YELLOW, pressRelease);
|
||||
}
|
||||
|
||||
public void Blue(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_BLUE, pressRelease);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IRoutingOutputs Members
|
||||
|
||||
public RoutingOutputPort HdmiOut { get; private set; }
|
||||
public RoutingOutputPort AnyAudioOut { get; private set; }
|
||||
public RoutingPortCollection<RoutingOutputPort> OutputPorts { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region IPower Members
|
||||
|
||||
public void PowerOn()
|
||||
{
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_POWER_ON, 200);
|
||||
_PowerIsOn = true;
|
||||
}
|
||||
|
||||
public void PowerOff()
|
||||
{
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_POWER_OFF, 200);
|
||||
_PowerIsOn = false;
|
||||
}
|
||||
|
||||
public void PowerToggle()
|
||||
{
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_POWER, 200);
|
||||
_PowerIsOn = false;
|
||||
}
|
||||
|
||||
public BoolFeedback PowerIsOnFeedback { get; set; }
|
||||
bool _PowerIsOn;
|
||||
|
||||
#endregion
|
||||
|
||||
#region ITransport Members
|
||||
|
||||
public void Play(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_PLAY, pressRelease);
|
||||
}
|
||||
|
||||
public void Pause(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_PAUSE, pressRelease);
|
||||
}
|
||||
|
||||
public void Rewind(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_RSCAN, pressRelease);
|
||||
}
|
||||
|
||||
public void FFwd(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_FSCAN, pressRelease);
|
||||
}
|
||||
|
||||
public void ChapMinus(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_TRACK_MINUS, pressRelease);
|
||||
}
|
||||
|
||||
public void ChapPlus(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_TRACK_PLUS, pressRelease);
|
||||
}
|
||||
|
||||
public void Stop(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_STOP, pressRelease);
|
||||
}
|
||||
|
||||
public void Record(bool pressRelease)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Routing;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common
|
||||
{
|
||||
public class IRBlurayBase : Device, IDiscPlayerControls, IUiDisplayInfo, IRoutingOutputs, IUsageTracking
|
||||
{
|
||||
public IrOutputPortController IrPort { get; private set; }
|
||||
|
||||
public uint DisplayUiType { get { return DisplayUiConstants.TypeBluray; } }
|
||||
|
||||
public IRBlurayBase(string key, string name, IrOutputPortController portCont)
|
||||
: base(key, name)
|
||||
{
|
||||
IrPort = portCont;
|
||||
DeviceManager.AddDevice(portCont);
|
||||
|
||||
HasKeypadAccessoryButton1 = true;
|
||||
KeypadAccessoryButton1Command = "Clear";
|
||||
KeypadAccessoryButton1Label = "Clear";
|
||||
|
||||
HasKeypadAccessoryButton2 = true;
|
||||
KeypadAccessoryButton2Command = "NumericEnter";
|
||||
KeypadAccessoryButton2Label = "Enter";
|
||||
|
||||
PowerIsOnFeedback = new BoolFeedback(() => _PowerIsOn);
|
||||
|
||||
HdmiOut = new RoutingOutputPort(RoutingPortNames.HdmiOut, eRoutingSignalType.AudioVideo,
|
||||
eRoutingPortConnectionType.Hdmi, null, this);
|
||||
AnyAudioOut = new RoutingOutputPort(RoutingPortNames.AnyAudioOut, eRoutingSignalType.Audio,
|
||||
eRoutingPortConnectionType.DigitalAudio, null, this);
|
||||
OutputPorts = new RoutingPortCollection<RoutingOutputPort> { HdmiOut, AnyAudioOut };
|
||||
}
|
||||
|
||||
|
||||
#region IDPad Members
|
||||
|
||||
public void Up(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_UP_ARROW, pressRelease);
|
||||
}
|
||||
|
||||
public void Down(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_DN_ARROW, pressRelease);
|
||||
}
|
||||
|
||||
public void Left(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_LEFT_ARROW, pressRelease);
|
||||
}
|
||||
|
||||
public void Right(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_RIGHT_ARROW, pressRelease);
|
||||
}
|
||||
|
||||
public void Select(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_ENTER, pressRelease);
|
||||
}
|
||||
|
||||
public void Menu(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_MENU, pressRelease);
|
||||
}
|
||||
|
||||
public void Exit(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_EXIT, pressRelease);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region INumericKeypad Members
|
||||
|
||||
public void Digit0(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_0, pressRelease);
|
||||
}
|
||||
|
||||
public void Digit1(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_1, pressRelease);
|
||||
}
|
||||
|
||||
public void Digit2(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_2, pressRelease);
|
||||
}
|
||||
|
||||
public void Digit3(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_3, pressRelease);
|
||||
}
|
||||
|
||||
public void Digit4(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_4, pressRelease);
|
||||
}
|
||||
|
||||
public void Digit5(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_5, pressRelease);
|
||||
}
|
||||
|
||||
public void Digit6(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_6, pressRelease);
|
||||
}
|
||||
|
||||
public void Digit7(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_7, pressRelease);
|
||||
}
|
||||
|
||||
public void Digit8(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_8, pressRelease);
|
||||
}
|
||||
|
||||
public void Digit9(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_9, pressRelease);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defaults to true
|
||||
/// </summary>
|
||||
public bool HasKeypadAccessoryButton1 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Defaults to "-"
|
||||
/// </summary>
|
||||
public string KeypadAccessoryButton1Label { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Defaults to "Dash"
|
||||
/// </summary>
|
||||
public string KeypadAccessoryButton1Command { get; set; }
|
||||
|
||||
public void KeypadAccessoryButton1(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(KeypadAccessoryButton1Command, pressRelease);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defaults to true
|
||||
/// </summary>
|
||||
public bool HasKeypadAccessoryButton2 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Defaults to "Enter"
|
||||
/// </summary>
|
||||
public string KeypadAccessoryButton2Label { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Defaults to "Enter"
|
||||
/// </summary>
|
||||
public string KeypadAccessoryButton2Command { get; set; }
|
||||
|
||||
public void KeypadAccessoryButton2(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(KeypadAccessoryButton2Command, pressRelease);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IChannelFunctions Members
|
||||
|
||||
public void ChannelUp(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_CH_PLUS, pressRelease);
|
||||
}
|
||||
|
||||
public void ChannelDown(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_CH_MINUS, pressRelease);
|
||||
}
|
||||
|
||||
public void LastChannel(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_LAST, pressRelease);
|
||||
}
|
||||
|
||||
public void Guide(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_GUIDE, pressRelease);
|
||||
}
|
||||
|
||||
public void Info(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_INFO, pressRelease);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IColorFunctions Members
|
||||
|
||||
public void Red(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_RED, pressRelease);
|
||||
}
|
||||
|
||||
public void Green(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_GREEN, pressRelease);
|
||||
}
|
||||
|
||||
public void Yellow(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_YELLOW, pressRelease);
|
||||
}
|
||||
|
||||
public void Blue(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_BLUE, pressRelease);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IRoutingOutputs Members
|
||||
|
||||
public RoutingOutputPort HdmiOut { get; private set; }
|
||||
public RoutingOutputPort AnyAudioOut { get; private set; }
|
||||
public RoutingPortCollection<RoutingOutputPort> OutputPorts { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region IPower Members
|
||||
|
||||
public void PowerOn()
|
||||
{
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_POWER_ON, 200);
|
||||
_PowerIsOn = true;
|
||||
}
|
||||
|
||||
public void PowerOff()
|
||||
{
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_POWER_OFF, 200);
|
||||
_PowerIsOn = false;
|
||||
}
|
||||
|
||||
public void PowerToggle()
|
||||
{
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_POWER, 200);
|
||||
_PowerIsOn = false;
|
||||
}
|
||||
|
||||
public BoolFeedback PowerIsOnFeedback { get; set; }
|
||||
bool _PowerIsOn;
|
||||
|
||||
#endregion
|
||||
|
||||
#region ITransport Members
|
||||
|
||||
public void Play(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_PLAY, pressRelease);
|
||||
}
|
||||
|
||||
public void Pause(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_PAUSE, pressRelease);
|
||||
}
|
||||
|
||||
public void Rewind(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_RSCAN, pressRelease);
|
||||
}
|
||||
|
||||
public void FFwd(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_FSCAN, pressRelease);
|
||||
}
|
||||
|
||||
public void ChapMinus(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_TRACK_MINUS, pressRelease);
|
||||
}
|
||||
|
||||
public void ChapPlus(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_TRACK_PLUS, pressRelease);
|
||||
}
|
||||
|
||||
public void Stop(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_STOP, pressRelease);
|
||||
}
|
||||
|
||||
public void Record(bool pressRelease)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IUsageTracking Members
|
||||
|
||||
public UsageTracking UsageTracker { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -22,13 +22,6 @@ namespace PepperDash.Essentials.Devices.Displays
|
||||
var properties = dc.Properties;
|
||||
|
||||
var typeName = dc.Type.ToLower();
|
||||
//if (typeName == "dmmd8x8")
|
||||
//{
|
||||
// var props = JsonConvert.DeserializeObject
|
||||
// <PepperDash.Essentials.DM.Config.DMChassisPropertiesConfig>(properties.ToString());
|
||||
// return PepperDash.Essentials.DM.DmChassisController.
|
||||
// GetDmChassisController(key, name, type, props);
|
||||
//}
|
||||
|
||||
try
|
||||
{
|
||||
@@ -38,10 +31,18 @@ namespace PepperDash.Essentials.Devices.Displays
|
||||
if (comm != null)
|
||||
return new NecPSXMDisplay(dc.Key, dc.Name, comm);
|
||||
}
|
||||
else if(typeName == "samsungmdc")
|
||||
{
|
||||
var comm = CommFactory.CreateCommForDevice(dc);
|
||||
if (comm != null)
|
||||
return new SamsungMDC(dc.Key, dc.Name, comm, dc.Properties["id"].Value<string>());
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Console(0, "Displays factory: Exception creating device type {0}, key {1}: {2}", dc.Type, dc.Key, e.Message);
|
||||
Debug.Console(0, "Displays factory: Exception creating device type {0}, key {1}: \nCONFIG JSON: {2} \nERROR: {3}\n\n",
|
||||
dc.Type, dc.Key, JsonConvert.SerializeObject(dc), e);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Displays
|
||||
{
|
||||
public interface IInputHdmi1 { void InputHdmi1(); }
|
||||
public interface IInputHdmi2 { void InputHdmi2(); }
|
||||
public interface IInputHdmi3 { void InputHdmi3(); }
|
||||
public interface IInputHdmi4 { void InputHdmi4(); }
|
||||
public interface IInputDisplayPort1 { void InputDisplayPort1(); }
|
||||
public interface IInputDisplayPort2 { void InputDisplayPort2(); }
|
||||
|
||||
}
|
||||
@@ -64,6 +64,8 @@ namespace PepperDash.Essentials.Devices.Displays
|
||||
protected override Func<bool> PowerIsOnFeedbackFunc { get { return () => _PowerIsOn; } }
|
||||
protected override Func<bool> IsCoolingDownFeedbackFunc { get { return () => _IsCoolingDown; } }
|
||||
protected override Func<bool> IsWarmingUpFeedbackFunc { get { return () => _IsWarmingUp; } }
|
||||
protected override Func<string> CurrentInputFeedbackFunc { get { return () => "Not Implemented"; } }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for IBasicCommunication
|
||||
|
||||
@@ -0,0 +1,581 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro.CrestronThread;
|
||||
using Crestron.SimplSharpPro;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Routing;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Displays
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class SamsungMDC : TwoWayDisplayBase, IBasicVolumeWithFeedback, ICommunicationMonitor, IInputDisplayPort1, IInputDisplayPort2,
|
||||
IInputHdmi1, IInputHdmi2, IInputHdmi3, IInputHdmi4
|
||||
{
|
||||
public IBasicCommunication Communication { get; private set; }
|
||||
|
||||
public StatusMonitorBase CommunicationMonitor { get; private set; }
|
||||
|
||||
public byte ID { get; private set; }
|
||||
|
||||
|
||||
bool _PowerIsOn;
|
||||
bool _IsWarmingUp;
|
||||
bool _IsCoolingDown;
|
||||
ushort _VolumeLevelForSig;
|
||||
int _LastVolumeSent;
|
||||
bool _IsMuted;
|
||||
RoutingInputPort _CurrentInputPort;
|
||||
byte[] IncomingBuffer = new byte[]{};
|
||||
ActionIncrementer VolumeIncrementer;
|
||||
bool VolumeIsRamping;
|
||||
public bool IsInStandby { get; private set; }
|
||||
|
||||
protected override Func<bool> PowerIsOnFeedbackFunc { get { return () => _PowerIsOn; } }
|
||||
protected override Func<bool> IsCoolingDownFeedbackFunc { get { return () => _IsCoolingDown; } }
|
||||
protected override Func<bool> IsWarmingUpFeedbackFunc { get { return () => _IsWarmingUp; } }
|
||||
protected override Func<string> CurrentInputFeedbackFunc { get { return () => _CurrentInputPort.Key; } }
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for IBasicCommunication
|
||||
/// </summary>
|
||||
public SamsungMDC(string key, string name, IBasicCommunication comm, string id)
|
||||
: base(key, name)
|
||||
{
|
||||
Communication = comm;
|
||||
Communication.BytesReceived += new EventHandler<GenericCommMethodReceiveBytesArgs>(Communication_BytesReceived);
|
||||
|
||||
ID = id == null ? (byte)0x01 : Convert.ToByte(id, 16); // If id is null, set default value of 0x01, otherwise assign value passed in constructor
|
||||
Init();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for TCP
|
||||
/// </summary>
|
||||
public SamsungMDC(string key, string name, string hostname, int port, string id)
|
||||
: base(key, name)
|
||||
{
|
||||
Communication = new GenericTcpIpClient(key + "-tcp", hostname, port, 5000);
|
||||
ID = id == null ? (byte)0x01 : Convert.ToByte(id, 16); // If id is null, set default value of 0x01, otherwise assign value passed in constructor
|
||||
Init();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for COM
|
||||
/// </summary>
|
||||
public SamsungMDC(string key, string name, ComPort port, ComPort.ComPortSpec spec, string id)
|
||||
: base(key, name)
|
||||
{
|
||||
Communication = new ComPortController(key + "-com", port, spec);
|
||||
//Communication.TextReceived += new EventHandler<GenericCommMethodReceiveTextArgs>(Communication_TextReceived);
|
||||
|
||||
ID = id == null ? (byte)0x01 : Convert.ToByte(id, 16); // If id is null, set default value of 0x01, otherwise assign value passed in constructor
|
||||
Init();
|
||||
}
|
||||
|
||||
void AddRoutingInputPort(RoutingInputPort port, byte fbMatch)
|
||||
{
|
||||
port.FeedbackMatchObject = fbMatch;
|
||||
InputPorts.Add(port);
|
||||
}
|
||||
|
||||
void Init()
|
||||
{
|
||||
WarmupTime = 10000;
|
||||
CooldownTime = 8000;
|
||||
|
||||
CommunicationMonitor = new GenericCommunicationMonitor(this, Communication, 2000, 120000, 300000, StatusGet);
|
||||
DeviceManager.AddDevice(CommunicationMonitor);
|
||||
|
||||
VolumeIncrementer = new ActionIncrementer(655, 0, 65535, 800, 80,
|
||||
v => SetVolume((ushort)v),
|
||||
() => _LastVolumeSent);
|
||||
|
||||
AddRoutingInputPort(new RoutingInputPort(RoutingPortNames.HdmiIn1, eRoutingSignalType.AudioVideo,
|
||||
eRoutingPortConnectionType.Hdmi, new Action(InputHdmi1), this), 0x21);
|
||||
|
||||
AddRoutingInputPort(new RoutingInputPort(RoutingPortNames.HdmiIn2, eRoutingSignalType.AudioVideo,
|
||||
eRoutingPortConnectionType.Hdmi, new Action(InputHdmi2), this), 0x23);
|
||||
|
||||
AddRoutingInputPort(new RoutingInputPort(RoutingPortNames.HdmiIn3, eRoutingSignalType.AudioVideo,
|
||||
eRoutingPortConnectionType.Hdmi, new Action(InputHdmi3), this), 0x32);
|
||||
|
||||
AddRoutingInputPort(new RoutingInputPort(RoutingPortNames.DisplayPortIn1, eRoutingSignalType.AudioVideo,
|
||||
eRoutingPortConnectionType.DisplayPort, new Action(InputDisplayPort1), this), 0x25);
|
||||
|
||||
AddRoutingInputPort(new RoutingInputPort(RoutingPortNames.DviIn, eRoutingSignalType.AudioVideo,
|
||||
eRoutingPortConnectionType.Dvi, new Action(InputDvi1), this), 0x18);
|
||||
|
||||
AddRoutingInputPort(new RoutingInputPort(RoutingPortNames.CompositeIn, eRoutingSignalType.AudioVideo,
|
||||
eRoutingPortConnectionType.Composite, new Action(InputVideo1), this), 0x08);
|
||||
|
||||
AddRoutingInputPort(new RoutingInputPort(RoutingPortNames.RgbIn1, eRoutingSignalType.Video,
|
||||
eRoutingPortConnectionType.Vga, new Action(InputRgb1), this), 0x14);
|
||||
|
||||
AddRoutingInputPort(new RoutingInputPort(RoutingPortNames.RgbIn2, eRoutingSignalType.Video,
|
||||
eRoutingPortConnectionType.Rgb, new Action(new Action(InputRgb2)), this), 0x1E);
|
||||
|
||||
VolumeLevelFeedback = new IntFeedback(() => { return _VolumeLevelForSig; });
|
||||
MuteFeedback = new BoolFeedback(() => _IsMuted);
|
||||
|
||||
StatusGet();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override bool CustomActivate()
|
||||
{
|
||||
Communication.Connect();
|
||||
CommunicationMonitor.StatusChange += (o, a) => { Debug.Console(2, this, "Communication monitor state: {0}", CommunicationMonitor.Status); };
|
||||
CommunicationMonitor.Start();
|
||||
return true;
|
||||
}
|
||||
|
||||
public override List<Feedback> Feedbacks
|
||||
{
|
||||
get
|
||||
{
|
||||
var list = base.Feedbacks;
|
||||
list.AddRange(new List<Feedback>
|
||||
{
|
||||
VolumeLevelFeedback,
|
||||
MuteFeedback,
|
||||
CurrentInputFeedback
|
||||
});
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// /
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
void Communication_BytesReceived(object sender, GenericCommMethodReceiveBytesArgs e)
|
||||
{
|
||||
// This is probably not thread-safe buffering
|
||||
// Append the incoming bytes with whatever is in the buffer
|
||||
var newBytes = new byte[IncomingBuffer.Length + e.Bytes.Length];
|
||||
IncomingBuffer.CopyTo(newBytes, 0);
|
||||
e.Bytes.CopyTo(newBytes, IncomingBuffer.Length);
|
||||
|
||||
// Need to find AA FF and have
|
||||
for (int i = 0; i < newBytes.Length; i++)
|
||||
{
|
||||
if (newBytes[i] == 0xAA && newBytes[i + 1] == 0xFF)
|
||||
{
|
||||
newBytes = newBytes.Skip(i).ToArray(); // Trim off junk if there's "dirt" in the buffer
|
||||
|
||||
// parse it
|
||||
// If it's at least got the header, then process it,
|
||||
while (newBytes.Length > 4 && newBytes[0] == 0xAA && newBytes[1] == 0xFF)
|
||||
{
|
||||
var msgLen = newBytes[3];
|
||||
// if the buffer is shorter than the header (3) + message (msgLen) + checksum (1),
|
||||
// give and save it for next time
|
||||
if (newBytes.Length < msgLen + 4)
|
||||
break;
|
||||
|
||||
// Good length, grab the message
|
||||
var message = newBytes.Skip(4).Take(msgLen).ToArray();
|
||||
|
||||
// At this point, the ack/nak is the first byte
|
||||
if (message[0] == 0x41)
|
||||
{
|
||||
switch (message[1]) // type byte
|
||||
{
|
||||
case 0x00: // General status
|
||||
UpdatePowerFB(message[2], message[5]); // "power" can be misrepresented when the display sleeps
|
||||
UpdateInputFb(message[5]);
|
||||
UpdateVolumeFB(message[3]);
|
||||
UpdateMuteFb(message[4]);
|
||||
UpdateInputFb(message[5]);
|
||||
break;
|
||||
|
||||
case 0x11:
|
||||
UpdatePowerFB(message[2]);
|
||||
break;
|
||||
|
||||
case 0x12:
|
||||
UpdateVolumeFB(message[2]);
|
||||
break;
|
||||
|
||||
case 0x13:
|
||||
UpdateMuteFb(message[2]);
|
||||
break;
|
||||
|
||||
case 0x14:
|
||||
UpdateInputFb(message[2]);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Skip over what we've used and save the rest for next time
|
||||
newBytes = newBytes.Skip(5 + msgLen).ToArray();
|
||||
}
|
||||
|
||||
break; // parsing will mean we can stop looking for header in loop
|
||||
}
|
||||
}
|
||||
|
||||
// Save whatever partial message is here
|
||||
IncomingBuffer = newBytes;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void UpdatePowerFB(byte powerByte)
|
||||
{
|
||||
var newVal = powerByte == 1;
|
||||
if (newVal != _PowerIsOn)
|
||||
{
|
||||
_PowerIsOn = newVal;
|
||||
PowerIsOnFeedback.FireUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates power status from general updates where source is included.
|
||||
/// Compensates for errant standby / power off hiccups by ignoring
|
||||
/// power off states with input < 0x10
|
||||
/// </summary>
|
||||
void UpdatePowerFB(byte powerByte, byte inputByte)
|
||||
{
|
||||
// This should reject errant power feedbacks when switching away from input on standby.
|
||||
if (powerByte == 0x01 && inputByte < 0x10)
|
||||
IsInStandby = true;
|
||||
if (powerByte == 0x00 && IsInStandby) // Ignore power off if coming from standby - glitch
|
||||
{
|
||||
IsInStandby = false;
|
||||
return;
|
||||
}
|
||||
|
||||
UpdatePowerFB(powerByte);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void UpdateVolumeFB(byte b)
|
||||
{
|
||||
var newVol = (ushort)NumericalHelpers.Scale((double)b, 0, 100, 0, 65535);
|
||||
if (!VolumeIsRamping)
|
||||
_LastVolumeSent = newVol;
|
||||
if (newVol != _VolumeLevelForSig)
|
||||
{
|
||||
_VolumeLevelForSig = newVol;
|
||||
VolumeLevelFeedback.FireUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void UpdateMuteFb(byte b)
|
||||
{
|
||||
var newMute = b == 1;
|
||||
if (newMute != _IsMuted)
|
||||
{
|
||||
_IsMuted = newMute;
|
||||
MuteFeedback.FireUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void UpdateInputFb(byte b)
|
||||
{
|
||||
var newInput = InputPorts.FirstOrDefault(i => i.FeedbackMatchObject.Equals(b));
|
||||
if (newInput != null && newInput != _CurrentInputPort)
|
||||
{
|
||||
_CurrentInputPort = newInput;
|
||||
CurrentInputFeedback.FireUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Formats an outgoing message. Replaces third byte with ID and replaces last byte with checksum
|
||||
/// </summary>
|
||||
/// <param name="b"></param>
|
||||
void SendBytes(byte[] b)
|
||||
{
|
||||
b[2] = ID;
|
||||
// append checksum by adding all bytes, except last which should be 00
|
||||
int checksum = 0;
|
||||
for (var i = 1; i < b.Length - 1; i++) // add 2nd through 2nd-to-last bytes
|
||||
{
|
||||
checksum += b[i];
|
||||
}
|
||||
checksum = checksum & 0x000000FF; // mask off MSBs
|
||||
b[b.Length - 1] = (byte)checksum;
|
||||
if(Debug.Level == 2) // This check is here to prevent following string format from building unnecessarily on level 0 or 1
|
||||
Debug.Console(2, this, "Sending:{0}", ComTextHelper.GetEscapedText(b));
|
||||
Communication.SendBytes(b);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void StatusGet()
|
||||
{
|
||||
SendBytes(new byte[] { 0xAA, 0x00, 0x00, 0x00, 0x00 });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public override void PowerOn()
|
||||
{
|
||||
//Send(PowerOnCmd);
|
||||
SendBytes(new byte[] { 0xAA, 0x11, 0x00, 0x01, 0x01, 0x00 });
|
||||
if (!PowerIsOnFeedback.BoolValue && !_IsWarmingUp && !_IsCoolingDown)
|
||||
{
|
||||
_IsWarmingUp = true;
|
||||
IsWarmingUpFeedback.FireUpdate();
|
||||
// Fake power-up cycle
|
||||
WarmupTimer = new CTimer(o =>
|
||||
{
|
||||
_IsWarmingUp = false;
|
||||
_PowerIsOn = true;
|
||||
IsWarmingUpFeedback.FireUpdate();
|
||||
PowerIsOnFeedback.FireUpdate();
|
||||
}, WarmupTime);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public override void PowerOff()
|
||||
{
|
||||
// If a display has unreliable-power off feedback, just override this and
|
||||
// remove this check.
|
||||
if (!_IsWarmingUp && !_IsCoolingDown) // PowerIsOnFeedback.BoolValue &&
|
||||
{
|
||||
//Send(PowerOffCmd);
|
||||
SendBytes(new byte[] { 0xAA, 0x11, 0x00, 0x01, 0x00, 0x00 });
|
||||
_IsCoolingDown = true;
|
||||
_PowerIsOn = false;
|
||||
PowerIsOnFeedback.FireUpdate();
|
||||
IsCoolingDownFeedback.FireUpdate();
|
||||
// Fake cool-down cycle
|
||||
CooldownTimer = new CTimer(o =>
|
||||
{
|
||||
_IsCoolingDown = false;
|
||||
IsCoolingDownFeedback.FireUpdate();
|
||||
}, CooldownTime);
|
||||
}
|
||||
}
|
||||
|
||||
public override void PowerToggle()
|
||||
{
|
||||
if (PowerIsOnFeedback.BoolValue && !IsWarmingUpFeedback.BoolValue)
|
||||
PowerOff();
|
||||
else if (!PowerIsOnFeedback.BoolValue && !IsCoolingDownFeedback.BoolValue)
|
||||
PowerOn();
|
||||
}
|
||||
|
||||
public void PowerGet()
|
||||
{
|
||||
SendBytes(new byte[] { 0xAA, 0x11, 0x00, 0x00, 0x00 });
|
||||
}
|
||||
|
||||
public void InputHdmi1()
|
||||
{
|
||||
SendBytes(new byte[] { 0xAA, 0x14, 0x00, 0x01, 0x22, 0x00 });
|
||||
}
|
||||
|
||||
public void InputHdmi2()
|
||||
{
|
||||
SendBytes(new byte[] { 0xAA, 0x14, 0x00, 0x01, 0x24, 0x00 });
|
||||
}
|
||||
|
||||
public void InputHdmi3()
|
||||
{
|
||||
SendBytes(new byte[] { 0xAA, 0x14, 0x00, 0x01, 0x32, 0x00 });
|
||||
}
|
||||
|
||||
public void InputHdmi4()
|
||||
{
|
||||
SendBytes(new byte[] { 0xAA, 0x14, 0x00, 0x01, 0x34, 0x00 });
|
||||
}
|
||||
|
||||
public void InputDisplayPort1()
|
||||
{
|
||||
SendBytes(new byte[] { 0xAA, 0x14, 0x00, 0x01, 0x25, 0x00 });
|
||||
}
|
||||
|
||||
public void InputDisplayPort2()
|
||||
{
|
||||
SendBytes(new byte[] { 0xAA, 0x14, 0x00, 0x01, 0x26, 0x00 });
|
||||
}
|
||||
|
||||
public void InputDvi1()
|
||||
{
|
||||
SendBytes(new byte[] { 0xAA, 0x14, 0x00, 0x01, 0x18, 0x00 });
|
||||
}
|
||||
|
||||
public void InputVideo1()
|
||||
{
|
||||
SendBytes(new byte[] { 0xAA, 0x14, 0x00, 0x01, 0x08, 0x00 });
|
||||
}
|
||||
|
||||
public void InputRgb1()
|
||||
{
|
||||
SendBytes(new byte[] { 0xAA, 0x14, 0x00, 0x01, 0x14, 0x00 });
|
||||
}
|
||||
|
||||
public void InputRgb2()
|
||||
{
|
||||
SendBytes(new byte[] { 0xAA, 0x14, 0x00, 0x01, 0x1E, 0x00 });
|
||||
}
|
||||
|
||||
public void InputGet()
|
||||
{
|
||||
SendBytes(new byte[] { 0xAA, 0x14, 0x00, 0x00, 0x00 });
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Executes a switch, turning on display if necessary.
|
||||
/// </summary>
|
||||
/// <param name="selector"></param>
|
||||
public override void ExecuteSwitch(object selector)
|
||||
{
|
||||
//if (!(selector is Action))
|
||||
// Debug.Console(1, this, "WARNING: ExecuteSwitch cannot handle type {0}", selector.GetType());
|
||||
|
||||
if (_PowerIsOn)
|
||||
(selector as Action)();
|
||||
else // if power is off, wait until we get on FB to send it.
|
||||
{
|
||||
// One-time event handler to wait for power on before executing switch
|
||||
EventHandler<EventArgs> handler = null; // necessary to allow reference inside lambda to handler
|
||||
handler = (o, a) =>
|
||||
{
|
||||
if (!_IsWarmingUp) // Done warming
|
||||
{
|
||||
IsWarmingUpFeedback.OutputChange -= handler;
|
||||
(selector as Action)();
|
||||
}
|
||||
};
|
||||
IsWarmingUpFeedback.OutputChange += handler; // attach and wait for on FB
|
||||
PowerOn();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Scales the level to the range of the display and sends the command
|
||||
/// </summary>
|
||||
/// <param name="level"></param>
|
||||
public void SetVolume(ushort level)
|
||||
{
|
||||
_LastVolumeSent = level;
|
||||
var scaled = (int)NumericalHelpers.Scale(level, 0, 65535, 0, 100);
|
||||
// The inputs to Scale ensure that byte won't overflow
|
||||
SendBytes(new byte[] { 0xAA, 0x12, 0x00, 0x01, Convert.ToByte(scaled), 0x00 });
|
||||
}
|
||||
|
||||
#region IBasicVolumeWithFeedback Members
|
||||
|
||||
public IntFeedback VolumeLevelFeedback { get; private set; }
|
||||
|
||||
public BoolFeedback MuteFeedback { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void MuteOff()
|
||||
{
|
||||
SendBytes(new byte[] { 0xAA, 0x13, 0x00, 0x01, 0x00, 0x00 });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void MuteOn()
|
||||
{
|
||||
SendBytes(new byte[] { 0xAA, 0x13, 0x00, 0x01, 0x01, 0x00 });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void MuteGet()
|
||||
{
|
||||
SendBytes(new byte[] { 0xAA, 0x13, 0x00, 0x00, 0x00 });
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IBasicVolumeControls Members
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void MuteToggle()
|
||||
{
|
||||
if (_IsMuted)
|
||||
MuteOff();
|
||||
else
|
||||
MuteOn();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="pressRelease"></param>
|
||||
public void VolumeDown(bool pressRelease)
|
||||
{
|
||||
if (pressRelease)
|
||||
{
|
||||
VolumeIncrementer.StartDown();
|
||||
VolumeIsRamping = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
VolumeIsRamping = false;
|
||||
VolumeIncrementer.Stop();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="pressRelease"></param>
|
||||
public void VolumeUp(bool pressRelease)
|
||||
{
|
||||
if (pressRelease)
|
||||
{
|
||||
VolumeIncrementer.StartUp();
|
||||
VolumeIsRamping = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
VolumeIsRamping = false;
|
||||
VolumeIncrementer.Stop();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void VolumeGet()
|
||||
{
|
||||
SendBytes(new byte[] { 0xAA, 0x12, 0x00, 0x00, 0x00 });
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -54,12 +54,16 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Gateways.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Crestron.SimplSharpPro.GeneralIO, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.GeneralIO.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="mscorlib" />
|
||||
<Reference Include="PepperDash_Core, Version=1.0.6284.20368, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\PepperDash.Core\Pepperdash Core\Pepperdash Core\bin\PepperDash_Core.dll</HintPath>
|
||||
<HintPath>..\..\..\pepperdash-simplsharp-core\Pepperdash Core\CLZ Builds\PepperDash_Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PepperDash_Essentials_Core, Version=1.0.0.14500, Culture=neutral, processorArchitecture=MSIL">
|
||||
<Reference Include="PepperDash_Essentials_Core, Version=1.0.0.24289, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\Essentials Core\PepperDashEssentialsBase\bin\PepperDash_Essentials_Core.dll</HintPath>
|
||||
</Reference>
|
||||
@@ -91,8 +95,22 @@
|
||||
<Reference Include="System.Data" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Codec\eCodecCallDirection.cs" />
|
||||
<Compile Include="Codec\eCodecCallType.cs" />
|
||||
<Compile Include="Codec\eCodecCallStatus.cs" />
|
||||
<Compile Include="Codec\eMeetingPrivacy.cs" />
|
||||
<Compile Include="Codec\iCodecAudio.cs" />
|
||||
<Compile Include="Codec\iCodecInfo.cs" />
|
||||
<Compile Include="Codec\iHasCallFavorites.cs" />
|
||||
<Compile Include="Codec\iHasCallHistory.cs" />
|
||||
<Compile Include="Codec\iHasContentSharing.cs" />
|
||||
<Compile Include="Codec\iHasDialer.cs" />
|
||||
<Compile Include="Codec\iHasDirectory.cs" />
|
||||
<Compile Include="Codec\iHasScheduleAwareness.cs" />
|
||||
<Compile Include="Crestron\Gateways\CenRfgwController.cs" />
|
||||
<Compile Include="Display\ComTcpDisplayBase.cs" />
|
||||
<Compile Include="Display\InputInterfaces.cs" />
|
||||
<Compile Include="Display\SamsungMDCDisplay.cs" />
|
||||
<Compile Include="Display\DeviceFactory.cs" />
|
||||
<Compile Include="Display\NecPaSeriesProjector.cs" />
|
||||
<Compile Include="Display\NECPSXMDisplay.cs" />
|
||||
@@ -104,6 +122,10 @@
|
||||
<Compile Include="DSP\BiampTesira\BiampTesiraFortePropertiesConfig.cs" />
|
||||
<Compile Include="DSP\PolycomSoundStructure\SoundStructureBasics.cs" />
|
||||
<Compile Include="Factory\DeviceFactory.cs" />
|
||||
<Compile Include="Generic\GenericSource.cs" />
|
||||
<Compile Include="Occupancy\EssentialsGlsOccupancySensorBaseController.cs" />
|
||||
<Compile Include="Occupancy\EssentialsOccupancyAggregator.cs" />
|
||||
<Compile Include="Occupancy\iOccupancyStatusProvider.cs" />
|
||||
<Compile Include="PC\InRoomPc.cs" />
|
||||
<Compile Include="PC\Laptop.cs" />
|
||||
<Compile Include="SetTopBox\SetTopBoxPropertiesConfig.cs" />
|
||||
@@ -113,6 +135,23 @@
|
||||
<Compile Include="SetTopBox\IRSetTopBoxBase.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Streaming\Roku.cs" />
|
||||
<Compile Include="VideoCodec\CiscoCodec\BookingsDataClasses.cs" />
|
||||
<Compile Include="VideoCodec\CiscoCodec\CallHistoryDataClasses.cs" />
|
||||
<Compile Include="VideoCodec\CiscoCodec\CameraConverter.cs" />
|
||||
<Compile Include="VideoCodec\CiscoCodec\CiscoSparkCodec.cs" />
|
||||
<Compile Include="VideoCodec\CiscoCodec\CiscoSparkCodecPropertiesConfig.cs" />
|
||||
<Compile Include="VideoCodec\CiscoCodec\xStatusSparkPlus.cs" />
|
||||
<Compile Include="VideoCodec\MockVC\MockVcPropertiesConfig.cs" />
|
||||
<Compile Include="VideoCodec\CiscoCodec\PhonebookDataClasses.cs" />
|
||||
<Compile Include="VideoCodec\CiscoCodec\xConfiguration.cs" />
|
||||
<Compile Include="VideoCodec\CiscoCodec\xEvent.cs" />
|
||||
<Compile Include="VideoCodec\CiscoCodec\HttpApiServer.cs" />
|
||||
<Compile Include="Codec\CodecActiveCallItem.cs" />
|
||||
<Compile Include="VideoCodec\Interfaces\IHasCodecLayouts.cs" />
|
||||
<Compile Include="VideoCodec\Interfaces\IHasCodecSelfview.cs" />
|
||||
<Compile Include="VideoCodec\MockVC\MockVC.cs" />
|
||||
<Compile Include="VideoCodec\CiscoCodec\xStatus.cs" />
|
||||
<Compile Include="VideoCodec\VideoCodecBase.cs" />
|
||||
<None Include="Properties\ControlSystem.cfg" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" />
|
||||
|
||||
Binary file not shown.
@@ -1,129 +1,141 @@
|
||||
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;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
|
||||
using PepperDash.Essentials.Devices.Common.DSP;
|
||||
|
||||
using PepperDash.Essentials.Devices.Common;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common
|
||||
{
|
||||
public class DeviceFactory
|
||||
{
|
||||
public static IKeyed GetDevice(DeviceConfig dc)
|
||||
{
|
||||
var key = dc.Key;
|
||||
var name = dc.Name;
|
||||
var type = dc.Type;
|
||||
var properties = dc.Properties;
|
||||
|
||||
var typeName = dc.Type.ToLower();
|
||||
var groupName = dc.Group.ToLower();
|
||||
|
||||
if (typeName == "appletv")
|
||||
{
|
||||
//var ir = IRPortHelper.GetIrPort(properties);
|
||||
//if (ir != null)
|
||||
// return new AppleTV(key, name, ir.Port, ir.FileName);
|
||||
|
||||
var irCont = IRPortHelper.GetIrOutputPortController(dc);
|
||||
return new AppleTV(key, name, irCont);
|
||||
|
||||
}
|
||||
|
||||
else if (typeName == "basicirdisplay")
|
||||
{
|
||||
var ir = IRPortHelper.GetIrPort(properties);
|
||||
if (ir != null)
|
||||
return new BasicIrDisplay(key, name, ir.Port, ir.FileName);
|
||||
}
|
||||
|
||||
else if (typeName == "cenrfgwex")
|
||||
{
|
||||
return CenRfgwController.GetNewExGatewayController(key, name,
|
||||
properties.Value<string>("id"), properties.Value<string>("gatewayType"));
|
||||
}
|
||||
|
||||
else if (typeName == "cenerfgwpoe")
|
||||
{
|
||||
return CenRfgwController.GetNewErGatewayController(key, name,
|
||||
properties.Value<string>("id"), properties.Value<string>("gatewayType"));
|
||||
}
|
||||
|
||||
else if (typeName == "genericaudiooutwithvolume")
|
||||
{
|
||||
var zone = dc.Properties.Value<uint>("zone");
|
||||
return new GenericAudioOutWithVolume(key, name,
|
||||
dc.Properties.Value<string>("volumeDeviceKey"), zone);
|
||||
}
|
||||
|
||||
else if (groupName == "discplayer") // (typeName == "irbluray")
|
||||
{
|
||||
if (properties["control"]["method"].Value<string>() == "ir")
|
||||
{
|
||||
var irCont = IRPortHelper.GetIrOutputPortController(dc);
|
||||
return new IRBlurayBase(key, name, irCont);
|
||||
|
||||
//var ir = IRPortHelper.GetIrPort(properties);
|
||||
//if (ir != null)
|
||||
// return new IRBlurayBase(key, name, ir.Port, ir.FileName);
|
||||
}
|
||||
else if (properties["control"]["method"].Value<string>() == "com")
|
||||
{
|
||||
Debug.Console(0, "[{0}] COM Device type not implemented YET!", key);
|
||||
}
|
||||
}
|
||||
|
||||
else if (groupName == "settopbox") //(typeName == "irstbbase")
|
||||
{
|
||||
var irCont = IRPortHelper.GetIrOutputPortController(dc);
|
||||
var config = dc.Properties.ToObject<SetTopBoxPropertiesConfig>();
|
||||
var stb = new IRSetTopBoxBase(key, name, irCont, config);
|
||||
|
||||
//stb.HasDvr = properties.Value<bool>("hasDvr");
|
||||
var listName = properties.Value<string>("presetsList");
|
||||
if (listName != null)
|
||||
stb.LoadPresets(listName);
|
||||
return stb;
|
||||
}
|
||||
|
||||
else if (typeName == "laptop")
|
||||
{
|
||||
return new Laptop(key, name);
|
||||
}
|
||||
|
||||
else if (typeName == "inroompc")
|
||||
{
|
||||
return new InRoomPc(key, name);
|
||||
}
|
||||
|
||||
else if (typeName == "roku")
|
||||
{
|
||||
var irCont = IRPortHelper.GetIrOutputPortController(dc);
|
||||
return new Roku2(key, name, irCont);
|
||||
|
||||
//var ir = IRPortHelper.GetIrPort(properties);
|
||||
//if (ir != null)
|
||||
// return new Roku2(key, name, ir.Port, ir.FileName);
|
||||
}
|
||||
|
||||
else if (typeName == "biamptesira")
|
||||
{
|
||||
var comm = CommFactory.CreateCommForDevice(dc);
|
||||
var props = JsonConvert.DeserializeObject<BiampTesiraFortePropertiesConfig>(
|
||||
properties.ToString());
|
||||
return new BiampTesiraForteDsp(key, name, comm, props);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
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;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
|
||||
using PepperDash.Essentials.Devices.Common.DSP;
|
||||
using PepperDash.Essentials.Devices.Common.VideoCodec;
|
||||
|
||||
using PepperDash.Essentials.Devices.Common;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common
|
||||
{
|
||||
public class DeviceFactory
|
||||
{
|
||||
public static IKeyed GetDevice(DeviceConfig dc)
|
||||
{
|
||||
var key = dc.Key;
|
||||
var name = dc.Name;
|
||||
var type = dc.Type;
|
||||
var properties = dc.Properties;
|
||||
|
||||
var typeName = dc.Type.ToLower();
|
||||
var groupName = dc.Group.ToLower();
|
||||
|
||||
if (typeName == "appletv")
|
||||
{
|
||||
//var ir = IRPortHelper.GetIrPort(properties);
|
||||
//if (ir != null)
|
||||
// return new AppleTV(key, name, ir.Port, ir.FileName);
|
||||
|
||||
var irCont = IRPortHelper.GetIrOutputPortController(dc);
|
||||
return new AppleTV(key, name, irCont);
|
||||
}
|
||||
|
||||
else if (typeName == "basicirdisplay")
|
||||
{
|
||||
var ir = IRPortHelper.GetIrPort(properties);
|
||||
if (ir != null)
|
||||
return new BasicIrDisplay(key, name, ir.Port, ir.FileName);
|
||||
}
|
||||
|
||||
else if (typeName == "biamptesira")
|
||||
{
|
||||
var comm = CommFactory.CreateCommForDevice(dc);
|
||||
var props = JsonConvert.DeserializeObject<BiampTesiraFortePropertiesConfig>(
|
||||
properties.ToString());
|
||||
return new BiampTesiraForteDsp(key, name, comm, props);
|
||||
}
|
||||
|
||||
else if (typeName == "cenrfgwex")
|
||||
{
|
||||
return CenRfgwController.GetNewExGatewayController(key, name,
|
||||
properties.Value<string>("id"), properties.Value<string>("gatewayType"));
|
||||
}
|
||||
|
||||
else if (typeName == "cenerfgwpoe")
|
||||
{
|
||||
return CenRfgwController.GetNewErGatewayController(key, name,
|
||||
properties.Value<string>("id"), properties.Value<string>("gatewayType"));
|
||||
}
|
||||
|
||||
else if (groupName == "discplayer") // (typeName == "irbluray")
|
||||
{
|
||||
if (properties["control"]["method"].Value<string>() == "ir")
|
||||
{
|
||||
var irCont = IRPortHelper.GetIrOutputPortController(dc);
|
||||
return new IRBlurayBase(key, name, irCont);
|
||||
}
|
||||
else if (properties["control"]["method"].Value<string>() == "com")
|
||||
{
|
||||
Debug.Console(0, "[{0}] COM Device type not implemented YET!", key);
|
||||
}
|
||||
}
|
||||
|
||||
else if (typeName == "genericaudiooutwithvolume")
|
||||
{
|
||||
var zone = dc.Properties.Value<uint>("zone");
|
||||
return new GenericAudioOutWithVolume(key, name,
|
||||
dc.Properties.Value<string>("volumeDeviceKey"), zone);
|
||||
}
|
||||
|
||||
else if (groupName == "genericsource")
|
||||
{
|
||||
return new GenericSource(key, name);
|
||||
}
|
||||
|
||||
else if (typeName == "inroompc")
|
||||
{
|
||||
return new InRoomPc(key, name);
|
||||
}
|
||||
|
||||
else if (typeName == "laptop")
|
||||
{
|
||||
return new Laptop(key, name);
|
||||
}
|
||||
|
||||
else if (typeName == "mockvc")
|
||||
{
|
||||
var props = JsonConvert.DeserializeObject
|
||||
<PepperDash.Essentials.Devices.Common.VideoCodec.MockVcPropertiesConfig>(properties.ToString());
|
||||
return new PepperDash.Essentials.Devices.Common.VideoCodec
|
||||
.MockVC(key, name, props);
|
||||
}
|
||||
|
||||
else if (typeName.StartsWith("ciscospark"))
|
||||
{
|
||||
var comm = CommFactory.CreateCommForDevice(dc);
|
||||
var props = JsonConvert.DeserializeObject<Codec.CiscoSparkCodecPropertiesConfig>(properties.ToString());
|
||||
return new PepperDash.Essentials.Devices.Common.VideoCodec.Cisco.CiscoSparkCodec(key, name, comm, props);
|
||||
}
|
||||
|
||||
else if (groupName == "settopbox") //(typeName == "irstbbase")
|
||||
{
|
||||
var irCont = IRPortHelper.GetIrOutputPortController(dc);
|
||||
var config = dc.Properties.ToObject<SetTopBoxPropertiesConfig>();
|
||||
var stb = new IRSetTopBoxBase(key, name, irCont, config);
|
||||
|
||||
//stb.HasDvr = properties.Value<bool>("hasDvr");
|
||||
var listName = properties.Value<string>("presetsList");
|
||||
if (listName != null)
|
||||
stb.LoadPresets(listName);
|
||||
return stb;
|
||||
}
|
||||
|
||||
else if (typeName == "roku")
|
||||
{
|
||||
var irCont = IRPortHelper.GetIrOutputPortController(dc);
|
||||
return new Roku2(key, name, irCont);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Routing;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common
|
||||
{
|
||||
public class GenericSource : Device, IUiDisplayInfo, IRoutingOutputs, IUsageTracking
|
||||
{
|
||||
|
||||
public uint DisplayUiType { get { return DisplayUiConstants.TypeNoControls; } }
|
||||
|
||||
public GenericSource(string key, string name)
|
||||
: base(key, name)
|
||||
{
|
||||
|
||||
AnyOut = new RoutingOutputPort(RoutingPortNames.AnyOut, eRoutingSignalType.AudioVideo,
|
||||
eRoutingPortConnectionType.Hdmi, null, this);
|
||||
OutputPorts = new RoutingPortCollection<RoutingOutputPort> { AnyOut };
|
||||
}
|
||||
|
||||
#region IRoutingOutputs Members
|
||||
|
||||
public RoutingOutputPort AnyOut { get; private set; }
|
||||
public RoutingPortCollection<RoutingOutputPort> OutputPorts { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region IUsageTracking Members
|
||||
|
||||
public UsageTracking UsageTracker { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro.GeneralIO;
|
||||
|
||||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Occupancy
|
||||
{
|
||||
public class EssentialsGlsOccupancySensorBaseController : CrestronGenericBaseDevice, IOccupancyStatusProvider
|
||||
{
|
||||
public GlsOccupancySensorBase OccSensor { get; private set; }
|
||||
|
||||
public BoolFeedback RoomIsOccupiedFeedback { get; private set; }
|
||||
|
||||
public EssentialsGlsOccupancySensorBaseController(string key, string name, GlsOccupancySensorBase sensor, GlsOccupancySensorConfigurationProperties props)
|
||||
: base(key, name, sensor)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class GlsOccupancySensorConfigurationProperties
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Occupancy
|
||||
{
|
||||
/// <summary>
|
||||
/// Aggregates the RoomIsOccupied feedbacks of one or more IOccupancyStatusProvider objects
|
||||
/// </summary>
|
||||
public class EssentialsOccupancyAggregator : Device, IOccupancyStatusProvider
|
||||
{
|
||||
/// <summary>
|
||||
/// Aggregated feedback of all linked IOccupancyStatusProvider devices
|
||||
/// </summary>
|
||||
public BoolFeedback RoomIsOccupiedFeedback
|
||||
{
|
||||
get
|
||||
{
|
||||
return AggregatedOccupancyStatus.Output;
|
||||
}
|
||||
}
|
||||
|
||||
private BoolFeedbackOr AggregatedOccupancyStatus;
|
||||
|
||||
public EssentialsOccupancyAggregator(string key, string name)
|
||||
: base(key, name)
|
||||
{
|
||||
AggregatedOccupancyStatus = new BoolFeedbackOr();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds an IOccupancyStatusProvider device
|
||||
/// </summary>
|
||||
/// <param name="statusProvider"></param>
|
||||
public void AddOccupancyStatusProvider(IOccupancyStatusProvider statusProvider)
|
||||
{
|
||||
AggregatedOccupancyStatus.AddOutputIn(statusProvider.RoomIsOccupiedFeedback);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Occupancy
|
||||
{
|
||||
public interface IOccupancyStatusProvider
|
||||
{
|
||||
BoolFeedback RoomIsOccupiedFeedback { get; }
|
||||
}
|
||||
}
|
||||
@@ -1,55 +1,61 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Crestron.SimplSharpPro;
|
||||
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Routing;
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// This DVD class should cover most IR, one-way DVD and Bluray fuctions
|
||||
/// </summary>
|
||||
public class InRoomPc : Device, IHasFeedback, IRoutingOutputs, IAttachVideoStatus, IUiDisplayInfo
|
||||
{
|
||||
public uint DisplayUiType { get { return DisplayUiConstants.TypeLaptop; } }
|
||||
public string IconName { get; set; }
|
||||
public BoolFeedback HasPowerOnFeedback { get; private set; }
|
||||
|
||||
public RoutingOutputPort AnyVideoOut { get; private set; }
|
||||
|
||||
#region IRoutingOutputs Members
|
||||
|
||||
/// <summary>
|
||||
/// Options: hdmi
|
||||
/// </summary>
|
||||
public RoutingPortCollection<RoutingOutputPort> OutputPorts { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
public InRoomPc(string key, string name)
|
||||
: base(key, name)
|
||||
{
|
||||
IconName = "PC";
|
||||
HasPowerOnFeedback = new BoolFeedback(CommonBoolCue.HasPowerFeedback,
|
||||
() => this.GetVideoStatuses() != VideoStatusOutputs.NoStatus);
|
||||
OutputPorts = new RoutingPortCollection<RoutingOutputPort>();
|
||||
OutputPorts.Add(AnyVideoOut = new RoutingOutputPort(RoutingPortNames.AnyVideoOut, eRoutingSignalType.AudioVideo,
|
||||
eRoutingPortConnectionType.None, 0, this));
|
||||
}
|
||||
|
||||
#region IHasFeedback Members
|
||||
|
||||
/// <summary>
|
||||
/// Passes through the VideoStatuses list
|
||||
/// </summary>
|
||||
public List<Feedback> Feedbacks
|
||||
{
|
||||
get { return this.GetVideoStatuses().ToList(); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Crestron.SimplSharpPro;
|
||||
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Routing;
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// This DVD class should cover most IR, one-way DVD and Bluray fuctions
|
||||
/// </summary>
|
||||
public class InRoomPc : Device, IHasFeedback, IRoutingOutputs, IAttachVideoStatus, IUiDisplayInfo, IUsageTracking
|
||||
{
|
||||
public uint DisplayUiType { get { return DisplayUiConstants.TypeLaptop; } }
|
||||
public string IconName { get; set; }
|
||||
public BoolFeedback HasPowerOnFeedback { get; private set; }
|
||||
|
||||
public RoutingOutputPort AnyVideoOut { get; private set; }
|
||||
|
||||
#region IRoutingOutputs Members
|
||||
|
||||
/// <summary>
|
||||
/// Options: hdmi
|
||||
/// </summary>
|
||||
public RoutingPortCollection<RoutingOutputPort> OutputPorts { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
public InRoomPc(string key, string name)
|
||||
: base(key, name)
|
||||
{
|
||||
IconName = "PC";
|
||||
HasPowerOnFeedback = new BoolFeedback(CommonBoolCue.HasPowerFeedback,
|
||||
() => this.GetVideoStatuses() != VideoStatusOutputs.NoStatus);
|
||||
OutputPorts = new RoutingPortCollection<RoutingOutputPort>();
|
||||
OutputPorts.Add(AnyVideoOut = new RoutingOutputPort(RoutingPortNames.AnyVideoOut, eRoutingSignalType.AudioVideo,
|
||||
eRoutingPortConnectionType.None, 0, this));
|
||||
}
|
||||
|
||||
#region IHasFeedback Members
|
||||
|
||||
/// <summary>
|
||||
/// Passes through the VideoStatuses list
|
||||
/// </summary>
|
||||
public List<Feedback> Feedbacks
|
||||
{
|
||||
get { return this.GetVideoStatuses().ToList(); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IUsageTracking Members
|
||||
|
||||
public UsageTracking UsageTracker { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,55 +1,61 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Crestron.SimplSharpPro;
|
||||
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Routing;
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// This DVD class should cover most IR, one-way DVD and Bluray fuctions
|
||||
/// </summary>
|
||||
public class Laptop : Device, IHasFeedback, IRoutingOutputs, IAttachVideoStatus, IUiDisplayInfo
|
||||
{
|
||||
public uint DisplayUiType { get { return DisplayUiConstants.TypeLaptop; } }
|
||||
public string IconName { get; set; }
|
||||
public BoolFeedback HasPowerOnFeedback { get; private set; }
|
||||
|
||||
public RoutingOutputPort AnyVideoOut { get; private set; }
|
||||
|
||||
#region IRoutingOutputs Members
|
||||
|
||||
/// <summary>
|
||||
/// Options: hdmi
|
||||
/// </summary>
|
||||
public RoutingPortCollection<RoutingOutputPort> OutputPorts { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
public Laptop(string key, string name)
|
||||
: base(key, name)
|
||||
{
|
||||
IconName = "Laptop";
|
||||
HasPowerOnFeedback = new BoolFeedback(CommonBoolCue.HasPowerFeedback,
|
||||
() => this.GetVideoStatuses() != VideoStatusOutputs.NoStatus);
|
||||
OutputPorts = new RoutingPortCollection<RoutingOutputPort>();
|
||||
OutputPorts.Add(AnyVideoOut = new RoutingOutputPort(RoutingPortNames.AnyOut, eRoutingSignalType.AudioVideo,
|
||||
eRoutingPortConnectionType.None, 0, this));
|
||||
}
|
||||
|
||||
#region IHasFeedback Members
|
||||
|
||||
/// <summary>
|
||||
/// Passes through the VideoStatuses list
|
||||
/// </summary>
|
||||
public List<Feedback> Feedbacks
|
||||
{
|
||||
get { return this.GetVideoStatuses().ToList(); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Crestron.SimplSharpPro;
|
||||
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Routing;
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// This DVD class should cover most IR, one-way DVD and Bluray fuctions
|
||||
/// </summary>
|
||||
public class Laptop : Device, IHasFeedback, IRoutingOutputs, IAttachVideoStatus, IUiDisplayInfo, IUsageTracking
|
||||
{
|
||||
public uint DisplayUiType { get { return DisplayUiConstants.TypeLaptop; } }
|
||||
public string IconName { get; set; }
|
||||
public BoolFeedback HasPowerOnFeedback { get; private set; }
|
||||
|
||||
public RoutingOutputPort AnyVideoOut { get; private set; }
|
||||
|
||||
#region IRoutingOutputs Members
|
||||
|
||||
/// <summary>
|
||||
/// Options: hdmi
|
||||
/// </summary>
|
||||
public RoutingPortCollection<RoutingOutputPort> OutputPorts { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
public Laptop(string key, string name)
|
||||
: base(key, name)
|
||||
{
|
||||
IconName = "Laptop";
|
||||
HasPowerOnFeedback = new BoolFeedback(CommonBoolCue.HasPowerFeedback,
|
||||
() => this.GetVideoStatuses() != VideoStatusOutputs.NoStatus);
|
||||
OutputPorts = new RoutingPortCollection<RoutingOutputPort>();
|
||||
OutputPorts.Add(AnyVideoOut = new RoutingOutputPort(RoutingPortNames.AnyOut, eRoutingSignalType.AudioVideo,
|
||||
eRoutingPortConnectionType.None, 0, this));
|
||||
}
|
||||
|
||||
#region IHasFeedback Members
|
||||
|
||||
/// <summary>
|
||||
/// Passes through the VideoStatuses list
|
||||
/// </summary>
|
||||
public List<Feedback> Feedbacks
|
||||
{
|
||||
get { return this.GetVideoStatuses().ToList(); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IUsageTracking Members
|
||||
|
||||
public UsageTracking UsageTracker { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user