mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-01-16 22:14:54 +00:00
Compare commits
337 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ca9da1ef79 | ||
|
|
e0bfb8f091 | ||
|
|
97db1f35a1 | ||
|
|
2b6a13271f | ||
|
|
4686799371 | ||
|
|
cb750a2fd0 | ||
|
|
6d81e8d21e | ||
|
|
600b9f11ff | ||
|
|
c20036cfe9 | ||
|
|
005b3f0843 | ||
|
|
fbe5df84be | ||
|
|
8e4c84dd02 | ||
|
|
dace2a57c2 | ||
|
|
3cf188f820 | ||
|
|
80377a41d0 | ||
|
|
a0ebc08838 | ||
|
|
0de4fbb69c | ||
|
|
c88b259c71 | ||
|
|
20660c561a | ||
|
|
b44613b91f | ||
|
|
58de8ce8ad | ||
|
|
33f0a1fe32 | ||
|
|
4b0f8abd9f | ||
|
|
4defea55f0 | ||
|
|
9c8f85555e | ||
|
|
62e2c3d19f | ||
|
|
e1c8b54434 | ||
|
|
6d913e8a72 | ||
|
|
afa1cff0e0 | ||
|
|
ce6cecbb79 | ||
|
|
69314bb1f1 | ||
|
|
fb19b5894b | ||
|
|
82fad55c1e | ||
|
|
8d03e81431 | ||
|
|
fa8ea4cef6 | ||
|
|
97a44ffa4f | ||
|
|
ee55be86e0 | ||
|
|
ced1efdb47 | ||
|
|
5129b19748 | ||
|
|
525881ebe1 | ||
|
|
856a81ded4 | ||
|
|
ef8298ccd6 | ||
|
|
cdbab152f6 | ||
|
|
359bd508e5 | ||
|
|
62e5e6f176 | ||
|
|
2d375ed2d7 | ||
|
|
2e78191e33 | ||
|
|
45ac17622a | ||
|
|
e7e6ae98cf | ||
|
|
2fbd645bf0 | ||
|
|
2a4ed67bee | ||
|
|
17c448e309 | ||
|
|
5afa626fb3 | ||
|
|
ba1e8646e5 | ||
|
|
88e82fb398 | ||
|
|
53ee87c9be | ||
|
|
032bb2b8e5 | ||
|
|
6ee56dd66c | ||
|
|
d887b448c9 | ||
|
|
f099c88352 | ||
|
|
f98a429b55 | ||
|
|
645816c75f | ||
|
|
491fff2793 | ||
|
|
952e7f4083 | ||
|
|
56c418580c | ||
|
|
4134622b28 | ||
|
|
09b3f7c5e7 | ||
|
|
9fa2b22448 | ||
|
|
62d8190eef | ||
|
|
19284b171a | ||
|
|
29c60548cc | ||
|
|
17f147b5e0 | ||
|
|
7aa3d50cd6 | ||
|
|
b85abe1b79 | ||
|
|
b7bab6cfd1 | ||
|
|
b83b3737e9 | ||
|
|
42c4c705c9 | ||
|
|
cb41b31018 | ||
|
|
6f028c06ae | ||
|
|
bc25c31860 | ||
|
|
32b548eba0 | ||
|
|
f83e64ee7e | ||
|
|
2ee365447c | ||
|
|
e5ac725b85 | ||
|
|
d0cbb8d096 | ||
|
|
91f6235441 | ||
|
|
3c256564c6 | ||
|
|
53de4f32eb | ||
|
|
9effa78fdf | ||
|
|
ba5036e400 | ||
|
|
cd747a01ea | ||
|
|
ac4ef972fe | ||
|
|
857d10f0b2 | ||
|
|
b45fb57cb2 | ||
|
|
e1e2627f56 | ||
|
|
d1646f8216 | ||
|
|
02cfc46f90 | ||
|
|
0fb946c7d5 | ||
|
|
026ab438ad | ||
|
|
51afb966d5 | ||
|
|
68fb82f801 | ||
|
|
0830fb8943 | ||
|
|
2ed63e7c84 | ||
|
|
08a4497f2c | ||
|
|
85d79c5265 | ||
|
|
fe76b257b2 | ||
|
|
800de511ce | ||
|
|
82784f00a4 | ||
|
|
289a33451f | ||
|
|
ae496f556b | ||
|
|
762f13c708 | ||
|
|
a61bfc4173 | ||
|
|
c3d455a7c2 | ||
|
|
864e65fe92 | ||
|
|
385dd8a482 | ||
|
|
19860be486 | ||
|
|
4d6a680f23 | ||
|
|
f9cb4e8a34 | ||
|
|
07e77f2ce4 | ||
|
|
6dbc152810 | ||
|
|
a3580ca15c | ||
|
|
7a1ead7b56 | ||
|
|
f9d1a737c4 | ||
|
|
d9013157ad | ||
|
|
43f0ae0533 | ||
|
|
6d66c7d896 | ||
|
|
f327ab1590 | ||
|
|
47fc2f3371 | ||
|
|
d1197329f3 | ||
|
|
a0817307b1 | ||
|
|
43c3b83637 | ||
|
|
2a485e36c8 | ||
|
|
bc47c65e48 | ||
|
|
1ad5bc68e5 | ||
|
|
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;
|
||||
|
||||
@@ -25,16 +26,24 @@ namespace PepperDash.Essentials.Core
|
||||
public ComPortController(string key, ComPort port, ComPort.ComPortSpec spec)
|
||||
: base(key)
|
||||
{
|
||||
if (port == null)
|
||||
{
|
||||
Debug.Console(0, this, "ERROR: Invalid com port, continuing but comms will not function");
|
||||
return;
|
||||
}
|
||||
|
||||
Port = port;
|
||||
Spec = spec;
|
||||
//IsConnected = new BoolFeedback(CommonBoolCue.IsConnected, () => true);
|
||||
|
||||
if (Port.Parent is CrestronControlSystem)
|
||||
{
|
||||
|
||||
|
||||
var result = Port.Register();
|
||||
if (result != eDeviceRegistrationUnRegistrationResponse.Success)
|
||||
{
|
||||
Debug.Console(0, this, "WARNING: Cannot register Com port: {0}", result);
|
||||
Debug.Console(0, this, "ERROR: Cannot register Com port: {0}", result);
|
||||
return; // false
|
||||
}
|
||||
}
|
||||
@@ -54,17 +63,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;
|
||||
@@ -74,17 +88,19 @@ namespace PepperDash.Essentials.Core
|
||||
|
||||
public void SendText(string text)
|
||||
{
|
||||
if (Port == null)
|
||||
return;
|
||||
Port.Send(text);
|
||||
}
|
||||
|
||||
public void SendBytes(byte[] bytes)
|
||||
{
|
||||
if (Port == null)
|
||||
return;
|
||||
var text = Encoding.GetEncoding(28591).GetString(bytes, 0, bytes.Length);
|
||||
Port.Send(text);
|
||||
}
|
||||
|
||||
//public BoolFeedback IsConnected { get; private set; }
|
||||
|
||||
public void Connect()
|
||||
{
|
||||
}
|
||||
@@ -94,5 +110,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());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,178 +1,198 @@
|
||||
using System;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class CommFactory
|
||||
{
|
||||
public static EssentialsControlPropertiesConfig GetControlPropertiesConfig(DeviceConfig deviceConfig)
|
||||
{
|
||||
try
|
||||
{
|
||||
return JsonConvert.DeserializeObject<EssentialsControlPropertiesConfig>
|
||||
(deviceConfig.Properties["control"].ToString());
|
||||
//Debug.Console(2, "Control TEST: {0}", JsonConvert.SerializeObject(controlConfig));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
Debug.Console(0, "ERROR: [{0}] Control properties deserialize failed:\r{1}", deviceConfig.Key, e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns a comm method of either com port, TCP, SSH
|
||||
/// </summary>
|
||||
/// <param name="deviceConfig">The Device config object</param>
|
||||
public static IBasicCommunication CreateCommForDevice(DeviceConfig deviceConfig)
|
||||
{
|
||||
EssentialsControlPropertiesConfig controlConfig = GetControlPropertiesConfig(deviceConfig);
|
||||
if (controlConfig == null)
|
||||
return null;
|
||||
|
||||
IBasicCommunication comm = null;
|
||||
try
|
||||
{
|
||||
var c = controlConfig.TcpSshProperties;
|
||||
switch (controlConfig.Method)
|
||||
{
|
||||
case eControlMethod.Com:
|
||||
comm = new ComPortController(deviceConfig.Key + "-com", GetComPort(controlConfig), controlConfig.ComParams);
|
||||
break;
|
||||
case eControlMethod.IR:
|
||||
break;
|
||||
case eControlMethod.Ssh:
|
||||
{
|
||||
var ssh = new GenericSshClient(deviceConfig.Key + "-ssh", c.Address, c.Port, c.Username, c.Password);
|
||||
ssh.AutoReconnect = c.AutoReconnect;
|
||||
if(ssh.AutoReconnect)
|
||||
ssh.AutoReconnectIntervalMs = c.AutoReconnectIntervalMs;
|
||||
comm = ssh;
|
||||
break;
|
||||
}
|
||||
case eControlMethod.Tcpip:
|
||||
{
|
||||
var tcp = new GenericTcpIpClient(deviceConfig.Key + "-tcp", c.Address, c.Port, c.BufferSize);
|
||||
tcp.AutoReconnect = c.AutoReconnect;
|
||||
if (tcp.AutoReconnect)
|
||||
tcp.AutoReconnectIntervalMs = c.AutoReconnectIntervalMs;
|
||||
comm = tcp;
|
||||
break;
|
||||
}
|
||||
case eControlMethod.Telnet:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Console(0, "Cannot create communication from JSON:\r{0}\r\rException:\r{1}",
|
||||
deviceConfig.Properties.ToString(), e);
|
||||
}
|
||||
|
||||
// put it in the device manager if it's the right flavor
|
||||
var comDev = comm as Device;
|
||||
if (comDev != null)
|
||||
DeviceManager.AddDevice(comDev);
|
||||
return comm;
|
||||
}
|
||||
|
||||
public static ComPort GetComPort(EssentialsControlPropertiesConfig config)
|
||||
{
|
||||
var comPar = config.ComParams;
|
||||
var dev = GetIComPortsDeviceFromManagedDevice(config.ControlPortDevKey);
|
||||
if (dev != null && config.ControlPortNumber <= dev.NumberOfComPorts)
|
||||
return dev.ComPorts[config.ControlPortNumber];
|
||||
Debug.Console(0, "GetComPort: Device '{0}' does not have com port {1}", config.ControlPortDevKey, config.ControlPortNumber);
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper to grab the IComPorts device for this PortDeviceKey. Key "controlSystem" will
|
||||
/// return the ControlSystem object from the Global class.
|
||||
/// </summary>
|
||||
/// <returns>IComPorts device or null if the device is not found or does not implement IComPorts</returns>
|
||||
public static IComPorts GetIComPortsDeviceFromManagedDevice(string ComPortDevKey)
|
||||
{
|
||||
if ((ComPortDevKey.Equals("controlSystem", System.StringComparison.OrdinalIgnoreCase)
|
||||
|| ComPortDevKey.Equals("processor", System.StringComparison.OrdinalIgnoreCase))
|
||||
&& Global.ControlSystem is IComPorts)
|
||||
return Global.ControlSystem;
|
||||
else
|
||||
{
|
||||
var dev = DeviceManager.GetDeviceForKey(ComPortDevKey) as IComPorts;
|
||||
if (dev == null)
|
||||
Debug.Console(0, "ComPortConfig: Cannot find com port device '{0}'", ComPortDevKey);
|
||||
return dev;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class EssentialsControlPropertiesConfig :
|
||||
PepperDash.Core.ControlPropertiesConfig
|
||||
{
|
||||
// ****** All of these things, except for #Pro-specific com stuff, were
|
||||
// moved into PepperDash.Core to help non-pro PortalSync.
|
||||
|
||||
//public eControlMethod Method { get; set; }
|
||||
|
||||
//public string ControlPortDevKey { get; set; }
|
||||
|
||||
//[JsonProperty(NullValueHandling = NullValueHandling.Ignore)] // In case "null" is present in config on this value
|
||||
//public uint ControlPortNumber { get; set; }
|
||||
|
||||
//public TcpSshPropertiesConfig TcpSshProperties { get; set; }
|
||||
|
||||
//public string IrFile { get; set; }
|
||||
|
||||
//public ComPortConfig ComParams { get; set; }
|
||||
|
||||
[JsonConverter(typeof(ComSpecJsonConverter))]
|
||||
public ComPort.ComPortSpec ComParams { get; set; }
|
||||
|
||||
//public string IpId { get; set; }
|
||||
|
||||
//[JsonIgnore]
|
||||
//public uint IpIdInt { get { return Convert.ToUInt32(IpId, 16); } }
|
||||
|
||||
//public char EndOfLineChar { get; set; }
|
||||
|
||||
///// <summary>
|
||||
///// Defaults to Environment.NewLine;
|
||||
///// </summary>
|
||||
//public string EndOfLineString { get; set; }
|
||||
|
||||
//public string DeviceReadyResponsePattern { get; set; }
|
||||
|
||||
//public EssentialsControlPropertiesConfig()
|
||||
//{
|
||||
// EndOfLineString = CrestronEnvironment.NewLine;
|
||||
//}
|
||||
}
|
||||
|
||||
public class IrControlSpec
|
||||
{
|
||||
public string PortDeviceKey { get; set; }
|
||||
public uint PortNumber { get; set; }
|
||||
public string File { get; set; }
|
||||
}
|
||||
|
||||
//public enum eControlMethod
|
||||
//{
|
||||
// None = 0, Com, IpId, IR, Ssh, Tcpip, Telnet
|
||||
//}
|
||||
using System;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class CommFactory
|
||||
{
|
||||
public static EssentialsControlPropertiesConfig GetControlPropertiesConfig(DeviceConfig deviceConfig)
|
||||
{
|
||||
try
|
||||
{
|
||||
return JsonConvert.DeserializeObject<EssentialsControlPropertiesConfig>
|
||||
(deviceConfig.Properties["control"].ToString());
|
||||
//Debug.Console(2, "Control TEST: {0}", JsonConvert.SerializeObject(controlConfig));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
Debug.Console(0, "ERROR: [{0}] Control properties deserialize failed:\r{1}", deviceConfig.Key, e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns a comm method of either com port, TCP, SSH
|
||||
/// </summary>
|
||||
/// <param name="deviceConfig">The Device config object</param>
|
||||
public static IBasicCommunication CreateCommForDevice(DeviceConfig deviceConfig)
|
||||
{
|
||||
EssentialsControlPropertiesConfig controlConfig = GetControlPropertiesConfig(deviceConfig);
|
||||
if (controlConfig == null)
|
||||
return null;
|
||||
|
||||
IBasicCommunication comm = null;
|
||||
try
|
||||
{
|
||||
var c = controlConfig.TcpSshProperties;
|
||||
switch (controlConfig.Method)
|
||||
{
|
||||
case eControlMethod.Com:
|
||||
comm = new ComPortController(deviceConfig.Key + "-com", GetComPort(controlConfig), controlConfig.ComParams);
|
||||
break;
|
||||
case eControlMethod.IR:
|
||||
break;
|
||||
case eControlMethod.Ssh:
|
||||
{
|
||||
var ssh = new GenericSshClient(deviceConfig.Key + "-ssh", c.Address, c.Port, c.Username, c.Password);
|
||||
ssh.AutoReconnect = c.AutoReconnect;
|
||||
if(ssh.AutoReconnect)
|
||||
ssh.AutoReconnectIntervalMs = c.AutoReconnectIntervalMs;
|
||||
comm = ssh;
|
||||
break;
|
||||
}
|
||||
case eControlMethod.Tcpip:
|
||||
{
|
||||
var tcp = new GenericTcpIpClient(deviceConfig.Key + "-tcp", c.Address, c.Port, c.BufferSize);
|
||||
tcp.AutoReconnect = c.AutoReconnect;
|
||||
if (tcp.AutoReconnect)
|
||||
tcp.AutoReconnectIntervalMs = c.AutoReconnectIntervalMs;
|
||||
comm = tcp;
|
||||
break;
|
||||
}
|
||||
case eControlMethod.Telnet:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Console(0, "Cannot create communication from JSON:\r{0}\r\rException:\r{1}",
|
||||
deviceConfig.Properties.ToString(), e);
|
||||
}
|
||||
|
||||
// put it in the device manager if it's the right flavor
|
||||
var comDev = comm as Device;
|
||||
if (comDev != null)
|
||||
DeviceManager.AddDevice(comDev);
|
||||
return comm;
|
||||
}
|
||||
|
||||
public static ComPort GetComPort(EssentialsControlPropertiesConfig config)
|
||||
{
|
||||
var comPar = config.ComParams;
|
||||
var dev = GetIComPortsDeviceFromManagedDevice(config.ControlPortDevKey);
|
||||
if (dev != null && config.ControlPortNumber <= dev.NumberOfComPorts)
|
||||
return dev.ComPorts[config.ControlPortNumber];
|
||||
Debug.Console(0, "GetComPort: Device '{0}' does not have com port {1}", config.ControlPortDevKey, config.ControlPortNumber);
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper to grab the IComPorts device for this PortDeviceKey. Key "controlSystem" will
|
||||
/// return the ControlSystem object from the Global class.
|
||||
/// </summary>
|
||||
/// <returns>IComPorts device or null if the device is not found or does not implement IComPorts</returns>
|
||||
public static IComPorts GetIComPortsDeviceFromManagedDevice(string ComPortDevKey)
|
||||
{
|
||||
if ((ComPortDevKey.Equals("controlSystem", System.StringComparison.OrdinalIgnoreCase)
|
||||
|| ComPortDevKey.Equals("processor", System.StringComparison.OrdinalIgnoreCase))
|
||||
&& Global.ControlSystem is IComPorts)
|
||||
return Global.ControlSystem;
|
||||
else
|
||||
{
|
||||
var dev = DeviceManager.GetDeviceForKey(ComPortDevKey) as IComPorts;
|
||||
if (dev == null)
|
||||
Debug.Console(0, "ComPortConfig: Cannot find com port device '{0}'", ComPortDevKey);
|
||||
return dev;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class EssentialsControlPropertiesConfig :
|
||||
PepperDash.Core.ControlPropertiesConfig
|
||||
{
|
||||
// ****** All of these things, except for #Pro-specific com stuff, were
|
||||
// moved into PepperDash.Core to help non-pro PortalSync.
|
||||
|
||||
//public eControlMethod Method { get; set; }
|
||||
|
||||
//public string ControlPortDevKey { get; set; }
|
||||
|
||||
//[JsonProperty(NullValueHandling = NullValueHandling.Ignore)] // In case "null" is present in config on this value
|
||||
//public uint ControlPortNumber { get; set; }
|
||||
|
||||
//public TcpSshPropertiesConfig TcpSshProperties { get; set; }
|
||||
|
||||
//public string IrFile { get; set; }
|
||||
|
||||
//public ComPortConfig ComParams { get; set; }
|
||||
|
||||
[JsonConverter(typeof(ComSpecJsonConverter))]
|
||||
public ComPort.ComPortSpec ComParams { get; set; }
|
||||
|
||||
public string CresnetId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to provide uint conversion of string CresnetId
|
||||
/// </summary>
|
||||
public uint CresnetIdInt
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
return Convert.ToUInt32(CresnetId, 16);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw new FormatException(string.Format("ERROR:Unable to convert Cresnet ID: {0} to hex. Error:\n{1}", CresnetId));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//public string IpId { get; set; }
|
||||
|
||||
//[JsonIgnore]
|
||||
//public uint IpIdInt { get { return Convert.ToUInt32(IpId, 16); } }
|
||||
|
||||
//public char EndOfLineChar { get; set; }
|
||||
|
||||
///// <summary>
|
||||
///// Defaults to Environment.NewLine;
|
||||
///// </summary>
|
||||
//public string EndOfLineString { get; set; }
|
||||
|
||||
//public string DeviceReadyResponsePattern { get; set; }
|
||||
|
||||
//public EssentialsControlPropertiesConfig()
|
||||
//{
|
||||
// EndOfLineString = CrestronEnvironment.NewLine;
|
||||
//}
|
||||
}
|
||||
|
||||
public class IrControlSpec
|
||||
{
|
||||
public string PortDeviceKey { get; set; }
|
||||
public uint PortNumber { get; set; }
|
||||
public string File { get; set; }
|
||||
}
|
||||
|
||||
//public enum eControlMethod
|
||||
//{
|
||||
// None = 0, Com, IpId, IR, Ssh, Tcpip, Telnet
|
||||
//}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ namespace PepperDash.Essentials.Core
|
||||
{
|
||||
get
|
||||
{
|
||||
return string.Format(@"\NVRAM\Program{0}\IR\", InitialParametersClass.ApplicationNumber);
|
||||
return Global.FilePathPrefix + "IR" + Global.DirectorySeparator;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,9 +17,6 @@ namespace PepperDash.Essentials.Core.Config
|
||||
[JsonProperty("info")]
|
||||
public InfoConfig Info { get; set; }
|
||||
|
||||
//[JsonProperty("roomLists")]
|
||||
//public Dictionary<string, List<string>> RoomLists { get; set; }
|
||||
|
||||
[JsonProperty("devices")]
|
||||
public List<DeviceConfig> Devices { get; set; }
|
||||
|
||||
|
||||
@@ -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,4 +1,6 @@
|
||||
using System;
|
||||
using System;
|
||||
|
||||
using Crestron.SimplSharp.Reflection;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
@@ -19,7 +21,10 @@ namespace PepperDash.Essentials.Core.Config
|
||||
public string Type { get; set; }
|
||||
|
||||
[JsonProperty("version")]
|
||||
public string Version { get; set; }
|
||||
public string Version { get; set; }
|
||||
|
||||
[JsonProperty("runtimeInfo")]
|
||||
public RuntimeInfo RuntimeInfo { get; set; }
|
||||
|
||||
[JsonProperty("comment")]
|
||||
public string Comment { get; set; }
|
||||
@@ -30,7 +35,34 @@ namespace PepperDash.Essentials.Core.Config
|
||||
Date = DateTime.Now;
|
||||
Type = "";
|
||||
Version = "";
|
||||
Comment = "";
|
||||
Comment = "";
|
||||
|
||||
RuntimeInfo = new RuntimeInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Represents runtime information about the program/processor
|
||||
/// </summary>
|
||||
public class RuntimeInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// The name of the running application
|
||||
/// </summary>
|
||||
[JsonProperty("appName")]
|
||||
public string AppName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The Assembly version of the running application
|
||||
/// </summary>
|
||||
[JsonProperty("assemblyVersion")]
|
||||
public string AssemblyVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The OS Version of the processor (Firmware Version)
|
||||
/// </summary>
|
||||
[JsonProperty("osVersion")]
|
||||
public string OsVersion { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Config
|
||||
{
|
||||
public class SourceDevicePropertiesConfigBase
|
||||
{
|
||||
public bool DisableSharing { 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,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
namespace PepperDash.Essentials.Core.CrestronIO
|
||||
{
|
||||
public class IOPortConfig
|
||||
{
|
||||
public string PortDeviceKey { get; set; }
|
||||
public uint PortNumber { get; set; }
|
||||
public bool DisablePullUpResistor { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
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.CrestronIO
|
||||
{
|
||||
public class GenericDigitalInputDevice : Device, IDigitalInput
|
||||
{
|
||||
public DigitalInput InputPort { get; private set; }
|
||||
|
||||
public BoolFeedback InputStateFeedback { get; private set; }
|
||||
|
||||
Func<bool> InputStateFeedbackFunc
|
||||
{
|
||||
get
|
||||
{
|
||||
return () => InputPort.State;
|
||||
}
|
||||
}
|
||||
|
||||
public GenericDigitalInputDevice(string key, DigitalInput inputPort):
|
||||
base(key)
|
||||
{
|
||||
InputStateFeedback = new BoolFeedback(InputStateFeedbackFunc);
|
||||
|
||||
InputPort = inputPort;
|
||||
|
||||
InputPort.StateChange += new DigitalInputEventHandler(InputPort_StateChange);
|
||||
|
||||
}
|
||||
|
||||
void InputPort_StateChange(DigitalInput digitalInput, DigitalInputEventArgs args)
|
||||
{
|
||||
InputStateFeedback.FireUpdate();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
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.CrestronIO
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a generic digital input deviced tied to a versiport
|
||||
/// </summary>
|
||||
public class GenericVersiportDigitalInputDevice : Device, IDigitalInput
|
||||
{
|
||||
public Versiport InputPort { get; private set; }
|
||||
|
||||
public BoolFeedback InputStateFeedback { get; private set; }
|
||||
|
||||
Func<bool> InputStateFeedbackFunc
|
||||
{
|
||||
get
|
||||
{
|
||||
return () => InputPort.DigitalIn;
|
||||
}
|
||||
}
|
||||
|
||||
public GenericVersiportDigitalInputDevice(string key, Versiport inputPort, IOPortConfig props):
|
||||
base(key)
|
||||
{
|
||||
InputStateFeedback = new BoolFeedback(InputStateFeedbackFunc);
|
||||
InputPort = inputPort;
|
||||
InputPort.SetVersiportConfiguration(eVersiportConfiguration.DigitalInput);
|
||||
if (props.DisablePullUpResistor)
|
||||
InputPort.DisablePullUpResistor = true;
|
||||
InputPort.VersiportChange += new VersiportEventHandler(InputPort_VersiportChange);
|
||||
|
||||
Debug.Console(1, this, "Created GenericVersiportDigitalInputDevice on port '{0}'. DisablePullUpResistor: '{1}'", props.PortNumber, InputPort.DisablePullUpResistor);
|
||||
}
|
||||
|
||||
void InputPort_VersiportChange(Versiport port, VersiportEventArgs args)
|
||||
{
|
||||
Debug.Console(1, this, "Versiport change: {0}", args.Event);
|
||||
|
||||
if(args.Event == eVersiportEvent.DigitalInChange)
|
||||
InputStateFeedback.FireUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
namespace PepperDash.Essentials.Core.CrestronIO
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a device that provides digital input
|
||||
/// </summary>
|
||||
public interface IDigitalInput
|
||||
{
|
||||
BoolFeedback InputStateFeedback { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
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.CrestronIO
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a generic device controlled by relays
|
||||
/// </summary>
|
||||
public class GenericRelayDevice : Device, ISwitchedOutput
|
||||
{
|
||||
public Relay RelayOutput { get; private set; }
|
||||
|
||||
public BoolFeedback OutputIsOnFeedback { get; private set; }
|
||||
|
||||
public GenericRelayDevice(string key, Relay relay):
|
||||
base(key)
|
||||
{
|
||||
OutputIsOnFeedback = new BoolFeedback(new Func<bool>(() => RelayOutput.State));
|
||||
|
||||
if (relay.AvailableForUse)
|
||||
RelayOutput = relay;
|
||||
|
||||
RelayOutput.StateChange += new RelayEventHandler(RelayOutput_StateChange);
|
||||
}
|
||||
|
||||
void RelayOutput_StateChange(Relay relay, RelayEventArgs args)
|
||||
{
|
||||
OutputIsOnFeedback.FireUpdate();
|
||||
}
|
||||
|
||||
public void OpenRelay()
|
||||
{
|
||||
RelayOutput.State = false;
|
||||
}
|
||||
|
||||
public void CloseRelay()
|
||||
{
|
||||
RelayOutput.State = true;
|
||||
}
|
||||
|
||||
public void ToggleRelayState()
|
||||
{
|
||||
if (RelayOutput.State == true)
|
||||
OpenRelay();
|
||||
else
|
||||
CloseRelay();
|
||||
}
|
||||
|
||||
#region ISwitchedOutput Members
|
||||
|
||||
void ISwitchedOutput.On()
|
||||
{
|
||||
CloseRelay();
|
||||
}
|
||||
|
||||
void ISwitchedOutput.Off()
|
||||
{
|
||||
OpenRelay();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Core.CrestronIO
|
||||
{
|
||||
/// <summary>
|
||||
/// Describes an output capable of switching on and off
|
||||
/// </summary>
|
||||
public interface ISwitchedOutput
|
||||
{
|
||||
BoolFeedback OutputIsOnFeedback {get;}
|
||||
|
||||
void On();
|
||||
void Off();
|
||||
}
|
||||
|
||||
public interface ISwitchedOutputCollection
|
||||
{
|
||||
Dictionary<uint, ISwitchedOutput> SwitchedOutputs { get; }
|
||||
}
|
||||
}
|
||||
@@ -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()
|
||||
{
|
||||
Debug.Console(0, this, "Activating");
|
||||
var response = Hardware.RegisterWithLogging(Key);
|
||||
if (response != eDeviceRegistrationUnRegistrationResponse.Success)
|
||||
{
|
||||
Debug.Console(0, this, "ERROR: Cannot register Crestron device: {0}", response);
|
||||
return false;
|
||||
}
|
||||
Hardware.OnlineStatusChange += new OnlineStatusChangeEventHandler(Hardware_OnlineStatusChange);
|
||||
CommunicationMonitor.Start();
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
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()
|
||||
{
|
||||
Debug.Console(0, this, "Activating");
|
||||
var response = Hardware.RegisterWithLogging(Key);
|
||||
if (response != eDeviceRegistrationUnRegistrationResponse.Success)
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
Debug.Console(0, this, "ERROR: Cannot register Crestron device: {0}", response);
|
||||
return false;
|
||||
}
|
||||
=======
|
||||
Debug.Console(0, this, "ERROR: Cannot register Crestron device: {0}", response);
|
||||
return false;
|
||||
}
|
||||
>>>>>>> origin/feature/ecs-342-neil
|
||||
Hardware.OnlineStatusChange += new OnlineStatusChangeEventHandler(Hardware_OnlineStatusChange);
|
||||
CommunicationMonitor.Start();
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -56,8 +56,6 @@ namespace PepperDash.Essentials.Core
|
||||
System.Globalization.CultureInfo.InvariantCulture))
|
||||
.ToArray();
|
||||
object ret = method.Invoke(obj, convertedParams);
|
||||
//Debug.Console(0, JsonConvert.SerializeObject(ret));
|
||||
// return something?
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -73,7 +71,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 +195,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 +227,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,6 @@ 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(ListDeviceCommStatuses, "devcommstatus", "Lists the communication status of all devices",
|
||||
ConsoleAccessLevelEnum.AccessOperator);
|
||||
CrestronConsole.AddNewConsoleCommand(ListDeviceFeedbacks, "devfb", "Lists current feedbacks",
|
||||
@@ -53,6 +49,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>
|
||||
@@ -62,8 +60,15 @@ namespace PepperDash.Essentials.Core
|
||||
{
|
||||
foreach (var d in Devices.Values)
|
||||
{
|
||||
if (d is Device)
|
||||
(d as Device).Activate();
|
||||
try
|
||||
{
|
||||
if (d is Device)
|
||||
(d as Device).Activate();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Console(0, d, "ERROR: Device activation failure:\r{0}", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +110,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 +135,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 +158,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 +171,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 +211,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,253 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using Crestron.SimplSharpPro.EthernetCommunication;
|
||||
using Crestron.SimplSharpPro.UI;
|
||||
using Crestron.SimplSharp.Reflection;
|
||||
|
||||
using PepperDash.Core;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
public static class DeviceManager
|
||||
{
|
||||
//public static List<Device> Devices { get { return _Devices; } }
|
||||
//static List<Device> _Devices = new List<Device>();
|
||||
|
||||
static Dictionary<string, IKeyed> Devices = new Dictionary<string, IKeyed>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a copy of all the devices in a list
|
||||
/// </summary>
|
||||
public static List<IKeyed> AllDevices { get { return new List<IKeyed>(Devices.Values); } }
|
||||
|
||||
public static void Initialize(CrestronControlSystem cs)
|
||||
{
|
||||
CrestronConsole.AddNewConsoleCommand(ListDeviceCommStatuses, "devcommstatus", "Lists the communication status of all devices",
|
||||
ConsoleAccessLevelEnum.AccessOperator);
|
||||
CrestronConsole.AddNewConsoleCommand(ListDeviceFeedbacks, "devfb", "Lists current feedbacks",
|
||||
ConsoleAccessLevelEnum.AccessOperator);
|
||||
CrestronConsole.AddNewConsoleCommand(ListDevices, "devlist", "Lists current managed devices",
|
||||
ConsoleAccessLevelEnum.AccessOperator);
|
||||
CrestronConsole.AddNewConsoleCommand(DeviceJsonApi.DoDeviceActionWithJson, "devjson", "",
|
||||
ConsoleAccessLevelEnum.AccessOperator);
|
||||
CrestronConsole.AddNewConsoleCommand(s =>
|
||||
{
|
||||
CrestronConsole.ConsoleCommandResponse(DeviceJsonApi.GetProperties(s));
|
||||
}, "devprops", "", ConsoleAccessLevelEnum.AccessOperator);
|
||||
CrestronConsole.AddNewConsoleCommand(s =>
|
||||
{
|
||||
CrestronConsole.ConsoleCommandResponse(DeviceJsonApi.GetMethods(s));
|
||||
}, "devmethods", "", ConsoleAccessLevelEnum.AccessOperator);
|
||||
CrestronConsole.AddNewConsoleCommand(s =>
|
||||
{
|
||||
CrestronConsole.ConsoleCommandResponse(DeviceJsonApi.GetApiMethods(s));
|
||||
}, "apimethods", "", ConsoleAccessLevelEnum.AccessOperator);
|
||||
CrestronConsole.AddNewConsoleCommand(SimulateComReceiveOnDevice, "devsimreceive",
|
||||
"Simulates incoming data on a com device", ConsoleAccessLevelEnum.AccessOperator);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calls activate on all Device class items
|
||||
/// </summary>
|
||||
public static void ActivateAll()
|
||||
{
|
||||
foreach (var d in Devices.Values)
|
||||
<<<<<<< HEAD
|
||||
{
|
||||
try
|
||||
{
|
||||
if (d is Device)
|
||||
(d as Device).Activate();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Console(0, d, "ERROR: Device activation failure:\r{0}", e);
|
||||
}
|
||||
}
|
||||
=======
|
||||
{
|
||||
try
|
||||
{
|
||||
if (d is Device)
|
||||
(d as Device).Activate();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Console(0, d, "ERROR: Device activation failure:\r{0}", e);
|
||||
}
|
||||
}
|
||||
>>>>>>> origin/feature/ecs-342-neil
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calls activate on all Device class items
|
||||
/// </summary>
|
||||
public static void DeactivateAll()
|
||||
{
|
||||
foreach (var d in Devices.Values)
|
||||
{
|
||||
if (d is Device)
|
||||
(d as Device).Deactivate();
|
||||
}
|
||||
}
|
||||
|
||||
//static void ListMethods(string devKey)
|
||||
//{
|
||||
// var dev = GetDeviceForKey(devKey);
|
||||
// if(dev != null)
|
||||
// {
|
||||
// var type = dev.GetType().GetCType();
|
||||
// var methods = type.GetMethods(BindingFlags.Public|BindingFlags.Instance);
|
||||
// var sb = new StringBuilder();
|
||||
// sb.AppendLine(string.Format("{2} methods on [{0}] ({1}):", dev.Key, type.Name, methods.Length));
|
||||
// foreach (var m in methods)
|
||||
// {
|
||||
// sb.Append(string.Format("{0}(", m.Name));
|
||||
// var pars = m.GetParameters();
|
||||
// foreach (var p in pars)
|
||||
// sb.Append(string.Format("({1}){0} ", p.Name, p.ParameterType.Name));
|
||||
// sb.AppendLine(")");
|
||||
// }
|
||||
// CrestronConsole.ConsoleCommandResponse(sb.ToString());
|
||||
// }
|
||||
//}
|
||||
|
||||
static void ListDevices(string s)
|
||||
{
|
||||
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));
|
||||
|
||||
foreach (var d in sorted)
|
||||
{
|
||||
var name = d is IKeyName ? (d as IKeyName).Name : "---";
|
||||
Debug.Console(0, " [{0}] {1}", d.Key, name);
|
||||
}
|
||||
}
|
||||
|
||||
static void ListDeviceFeedbacks(string devKey)
|
||||
{
|
||||
var dev = GetDeviceForKey(devKey);
|
||||
if(dev == null)
|
||||
{
|
||||
Debug.Console(0, "Device '{0}' not found", devKey);
|
||||
return;
|
||||
}
|
||||
var statusDev = dev as IHasFeedback;
|
||||
if(statusDev == null)
|
||||
{
|
||||
Debug.Console(0, "Device '{0}' does not have visible feedbacks", devKey);
|
||||
return;
|
||||
}
|
||||
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 ListDeviceCommStatuses(string input)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
foreach (var dev in Devices.Values)
|
||||
{
|
||||
if (dev is ICommunicationMonitor)
|
||||
sb.Append(string.Format("{0}: {1}\r", dev.Key, (dev as ICommunicationMonitor).CommunicationMonitor.Status));
|
||||
}
|
||||
CrestronConsole.ConsoleCommandResponse(sb.ToString());
|
||||
}
|
||||
|
||||
|
||||
//static void DoDeviceCommand(string command)
|
||||
//{
|
||||
// Debug.Console(0, "Not yet implemented. Stay tuned");
|
||||
//}
|
||||
|
||||
public static void AddDevice(IKeyed newDev)
|
||||
{
|
||||
// Check for device with same key
|
||||
//var existingDevice = _Devices.FirstOrDefault(d => d.Key.Equals(newDev.Key, StringComparison.OrdinalIgnoreCase));
|
||||
////// If it exists, remove or warn??
|
||||
//if (existingDevice != null)
|
||||
if(Devices.ContainsKey(newDev.Key))
|
||||
{
|
||||
Debug.Console(0, newDev, "WARNING: A device with this key already exists. Not added to manager");
|
||||
return;
|
||||
}
|
||||
Devices.Add(newDev.Key, newDev);
|
||||
//if (!(_Devices.Contains(newDev)))
|
||||
// _Devices.Add(newDev);
|
||||
}
|
||||
|
||||
public static void RemoveDevice(IKeyed newDev)
|
||||
{
|
||||
if(newDev == null)
|
||||
return;
|
||||
if (Devices.ContainsKey(newDev.Key))
|
||||
Devices.Remove(newDev.Key);
|
||||
//if (_Devices.Contains(newDev))
|
||||
// _Devices.Remove(newDev);
|
||||
else
|
||||
Debug.Console(0, "Device manager: Device '{0}' does not exist in manager. Cannot remove", newDev.Key);
|
||||
}
|
||||
|
||||
public static IEnumerable<string> GetDeviceKeys()
|
||||
{
|
||||
//return _Devices.Select(d => d.Key).ToList();
|
||||
return Devices.Keys;
|
||||
}
|
||||
|
||||
public static IEnumerable<IKeyed> GetDevices()
|
||||
{
|
||||
//return _Devices.Select(d => d.Key).ToList();
|
||||
return Devices.Values;
|
||||
}
|
||||
|
||||
public static IKeyed GetDeviceForKey(string key)
|
||||
{
|
||||
//return _Devices.FirstOrDefault(d => d.Key.Equals(key, StringComparison.OrdinalIgnoreCase));
|
||||
if (key != null && Devices.ContainsKey(key))
|
||||
return Devices[key];
|
||||
|
||||
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,105 @@
|
||||
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>
|
||||
/// A class that implements this contains a reference to a current IBasicVolumeControls device.
|
||||
/// The class may have multiple IBasicVolumeControls.
|
||||
/// </summary>
|
||||
public interface IHasCurrentVolumeControls
|
||||
{
|
||||
IBasicVolumeControls CurrentVolumeControls { 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
|
||||
// }
|
||||
//}
|
||||
@@ -23,6 +23,7 @@ namespace PepperDash.Essentials.Core
|
||||
/// </summary>
|
||||
public class SourceListItem
|
||||
{
|
||||
[JsonProperty("sourceKey")]
|
||||
public string SourceKey { get; set; }
|
||||
/// <summary>
|
||||
/// Returns the source Device for this, if it exists in DeviceManager
|
||||
@@ -43,6 +44,7 @@ namespace PepperDash.Essentials.Core
|
||||
/// Gets either the source's Name or this AlternateName property, if
|
||||
/// defined. If source doesn't exist, returns "Missing source"
|
||||
/// </summary>
|
||||
[JsonProperty("preferredName")]
|
||||
public string PreferredName
|
||||
{
|
||||
get
|
||||
@@ -60,15 +62,36 @@ namespace PepperDash.Essentials.Core
|
||||
/// <summary>
|
||||
/// A name that will override the source's name on the UI
|
||||
/// </summary>
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[JsonProperty("icon")]
|
||||
public string Icon { get; set; }
|
||||
|
||||
[JsonProperty("altIcon")]
|
||||
public string AltIcon { get; set; }
|
||||
|
||||
[JsonProperty("includeInSourceList")]
|
||||
public bool IncludeInSourceList { get; set; }
|
||||
public int Order { get; set; }
|
||||
|
||||
[JsonProperty("order")]
|
||||
public int Order { get; set; }
|
||||
|
||||
[JsonProperty("volumeControlKey")]
|
||||
public string VolumeControlKey { get; set; }
|
||||
|
||||
[JsonProperty("type")]
|
||||
public eSourceListItemType Type { get; set; }
|
||||
|
||||
[JsonProperty("routeList")]
|
||||
public List<SourceRouteListItem> RouteList { get; set; }
|
||||
|
||||
[JsonProperty("disableCodecSharing")]
|
||||
public bool DisableCodecSharing { get; set; }
|
||||
|
||||
[JsonProperty("disableRoutedSharing")]
|
||||
public bool DisableRoutedSharing { get; set; }
|
||||
|
||||
public SourceListItem()
|
||||
{
|
||||
Icon = "Blank";
|
||||
|
||||
@@ -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;
|
||||
@@ -63,14 +64,14 @@ namespace PepperDash.Essentials.Core
|
||||
if (!PowerIsOnFeedback.BoolValue && !_IsWarmingUp && !_IsCoolingDown)
|
||||
{
|
||||
_IsWarmingUp = true;
|
||||
IsWarmingUpFeedback.FireUpdate();
|
||||
IsWarmingUpFeedback.InvokeFireUpdate();
|
||||
// Fake power-up cycle
|
||||
WarmupTimer = new CTimer(o =>
|
||||
{
|
||||
_IsWarmingUp = false;
|
||||
_PowerIsOn = true;
|
||||
IsWarmingUpFeedback.FireUpdate();
|
||||
PowerIsOnFeedback.FireUpdate();
|
||||
IsWarmingUpFeedback.InvokeFireUpdate();
|
||||
PowerIsOnFeedback.InvokeFireUpdate();
|
||||
}, WarmupTime);
|
||||
}
|
||||
}
|
||||
@@ -83,14 +84,14 @@ namespace PepperDash.Essentials.Core
|
||||
{
|
||||
_IsCoolingDown = true;
|
||||
_PowerIsOn = false;
|
||||
PowerIsOnFeedback.FireUpdate();
|
||||
IsCoolingDownFeedback.FireUpdate();
|
||||
PowerIsOnFeedback.InvokeFireUpdate();
|
||||
IsCoolingDownFeedback.InvokeFireUpdate();
|
||||
// Fake cool-down cycle
|
||||
CooldownTimer = new CTimer(o =>
|
||||
{
|
||||
Debug.Console(2, this, "Cooldown timer ending");
|
||||
_IsCoolingDown = false;
|
||||
IsCoolingDownFeedback.FireUpdate();
|
||||
IsCoolingDownFeedback.InvokeFireUpdate();
|
||||
}, CooldownTime);
|
||||
}
|
||||
}
|
||||
@@ -116,20 +117,20 @@ namespace PepperDash.Essentials.Core
|
||||
|
||||
public void SetVolume(ushort level)
|
||||
{
|
||||
_FakeVolumeLevel = level;
|
||||
VolumeLevelFeedback.FireUpdate();
|
||||
_FakeVolumeLevel = level;
|
||||
VolumeLevelFeedback.InvokeFireUpdate();
|
||||
}
|
||||
|
||||
public void MuteOn()
|
||||
{
|
||||
_IsMuted = true;
|
||||
MuteFeedback.FireUpdate();
|
||||
MuteFeedback.InvokeFireUpdate();
|
||||
}
|
||||
|
||||
public void MuteOff()
|
||||
{
|
||||
_IsMuted = false;
|
||||
MuteFeedback.FireUpdate();
|
||||
MuteFeedback.InvokeFireUpdate();
|
||||
}
|
||||
|
||||
public BoolFeedback MuteFeedback { get; private set; }
|
||||
@@ -169,7 +170,7 @@ namespace PepperDash.Essentials.Core
|
||||
public void MuteToggle()
|
||||
{
|
||||
_IsMuted = !_IsMuted;
|
||||
MuteFeedback.FireUpdate();
|
||||
MuteFeedback.InvokeFireUpdate();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -19,6 +19,16 @@ namespace PepperDash.Essentials.Core
|
||||
|
||||
public abstract eCueType Type { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Feedbacks can be put into test mode for simulation of events without real data.
|
||||
/// Using JSON debugging methods and the Set/ClearTestValue methods, we can simulate
|
||||
/// Feedback behaviors
|
||||
/// </summary>
|
||||
public bool InTestMode { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Base Constructor - empty
|
||||
/// </summary>
|
||||
protected Feedback()
|
||||
{
|
||||
}
|
||||
@@ -28,8 +38,31 @@ namespace PepperDash.Essentials.Core
|
||||
Cue = cue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clears test mode and fires update.
|
||||
/// </summary>
|
||||
public void ClearTestValue()
|
||||
{
|
||||
InTestMode = false;
|
||||
FireUpdate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fires an update synchronously
|
||||
/// </summary>
|
||||
public abstract void FireUpdate();
|
||||
|
||||
/// <summary>
|
||||
/// Fires the update asynchronously within a CrestronInvoke
|
||||
/// </summary>
|
||||
public void InvokeFireUpdate()
|
||||
{
|
||||
CrestronInvoke.BeginInvoke(o => FireUpdate());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper method that fires event. Use this intstead of calling OutputChange
|
||||
/// </summary>
|
||||
protected void OnOutputChange()
|
||||
{
|
||||
if (OutputChange != null) OutputChange(this, EventArgs.Empty);
|
||||
@@ -42,18 +75,24 @@ namespace PepperDash.Essentials.Core
|
||||
public class BoolFeedback : Feedback
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns the current value of the feedback, derived from the ValueFunc
|
||||
/// Returns the current value of the feedback, derived from the ValueFunc. The ValueFunc is
|
||||
/// evaluated whenever FireUpdate() is called
|
||||
/// </summary>
|
||||
public override bool BoolValue { get { return _BoolValue; } }
|
||||
bool _BoolValue;
|
||||
|
||||
public override eCueType Type { get { return eCueType.Bool; } }
|
||||
|
||||
/// <summary>
|
||||
/// Fake value to be used in test mode
|
||||
/// </summary>
|
||||
public bool TestValue { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Func that evaluates on FireUpdate
|
||||
/// </summary>
|
||||
public Func<bool> ValueFunc { get; private set; }
|
||||
/// <summary>
|
||||
/// The last value delivered on FireUpdate
|
||||
/// </summary>
|
||||
//public bool PreviousValue { get; private set; }
|
||||
|
||||
List<BoolInputSig> LinkedInputSigs = new List<BoolInputSig>();
|
||||
List<BoolInputSig> LinkedComplementInputSigs = new List<BoolInputSig>();
|
||||
|
||||
@@ -71,7 +110,7 @@ namespace PepperDash.Essentials.Core
|
||||
|
||||
public override void FireUpdate()
|
||||
{
|
||||
var newValue = ValueFunc.Invoke();
|
||||
bool newValue = InTestMode ? TestValue : ValueFunc.Invoke();
|
||||
if (newValue != _BoolValue)
|
||||
{
|
||||
_BoolValue = newValue;
|
||||
@@ -103,6 +142,22 @@ namespace PepperDash.Essentials.Core
|
||||
LinkedComplementInputSigs.Remove(sig);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return (InTestMode ? "TEST -- " : "") + BoolValue.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Puts this in test mode, sets the test value and fires an update.
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
public void SetTestValue(bool value)
|
||||
{
|
||||
TestValue = value;
|
||||
InTestMode = true;
|
||||
FireUpdate();
|
||||
}
|
||||
|
||||
void UpdateSig(BoolInputSig sig)
|
||||
{
|
||||
sig.BoolValue = _BoolValue;
|
||||
@@ -120,9 +175,14 @@ namespace PepperDash.Essentials.Core
|
||||
public override int IntValue { get { return _IntValue; } } // ValueFunc.Invoke(); } }
|
||||
int _IntValue;
|
||||
public ushort UShortValue { get { return (ushort)_IntValue; } }
|
||||
public override eCueType Type { get { return eCueType.Int; } }
|
||||
//public int PreviousValue { get; private set; }
|
||||
|
||||
public override eCueType Type { get { return eCueType.Int; } }
|
||||
|
||||
public int TestValue { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Func evaluated on FireUpdate
|
||||
/// </summary>
|
||||
Func<int> ValueFunc;
|
||||
List<UShortInputSig> LinkedInputSigs = new List<UShortInputSig>();
|
||||
|
||||
@@ -140,7 +200,7 @@ namespace PepperDash.Essentials.Core
|
||||
|
||||
public override void FireUpdate()
|
||||
{
|
||||
var newValue = ValueFunc.Invoke();
|
||||
var newValue = InTestMode ? TestValue : ValueFunc.Invoke();
|
||||
if (newValue != _IntValue)
|
||||
{
|
||||
_IntValue = newValue;
|
||||
@@ -160,6 +220,22 @@ namespace PepperDash.Essentials.Core
|
||||
LinkedInputSigs.Remove(sig);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return (InTestMode ? "TEST -- " : "") + IntValue.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Puts this in test mode, sets the test value and fires an update.
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
public void SetTestValue(int value)
|
||||
{
|
||||
TestValue = value;
|
||||
InTestMode = true;
|
||||
FireUpdate();
|
||||
}
|
||||
|
||||
void UpdateSig(UShortInputSig sig)
|
||||
{
|
||||
sig.UShortValue = UShortValue;
|
||||
@@ -172,8 +248,17 @@ namespace PepperDash.Essentials.Core
|
||||
{
|
||||
public override string StringValue { get { return _StringValue; } } // ValueFunc.Invoke(); } }
|
||||
string _StringValue;
|
||||
|
||||
public override eCueType Type { get { return eCueType.String; } }
|
||||
//public string PreviousValue { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Used in testing. Set/Clear functions
|
||||
/// </summary>
|
||||
public string TestValue { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Evalutated on FireUpdate
|
||||
/// </summary>
|
||||
public Func<string> ValueFunc { get; private set; }
|
||||
List<StringInputSig> LinkedInputSigs = new List<StringInputSig>();
|
||||
|
||||
@@ -192,7 +277,7 @@ namespace PepperDash.Essentials.Core
|
||||
|
||||
public override void FireUpdate()
|
||||
{
|
||||
var newValue = ValueFunc.Invoke();
|
||||
var newValue = InTestMode ? TestValue : ValueFunc.Invoke();
|
||||
if (newValue != _StringValue)
|
||||
{
|
||||
_StringValue = newValue;
|
||||
@@ -212,6 +297,22 @@ namespace PepperDash.Essentials.Core
|
||||
LinkedInputSigs.Remove(sig);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return (InTestMode ? "TEST -- " : "") + StringValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Puts this in test mode, sets the test value and fires an update.
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
public void SetTestValue(string value)
|
||||
{
|
||||
TestValue = value;
|
||||
InTestMode = true;
|
||||
FireUpdate();
|
||||
}
|
||||
|
||||
void UpdateSig(StringInputSig sig)
|
||||
{
|
||||
sig.StringValue = _StringValue;
|
||||
|
||||
@@ -1,42 +1,49 @@
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharp.CrestronDataStore;
|
||||
using Crestron.SimplSharpPro;
|
||||
|
||||
//using PepperDash.Essentials.Core.Http;
|
||||
using PepperDash.Essentials.License;
|
||||
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
public static class Global
|
||||
{
|
||||
public static CrestronControlSystem ControlSystem { get; set; }
|
||||
|
||||
public static LicenseManager LicenseManager { get; set; }
|
||||
|
||||
//public static EssentialsHttpServer HttpConfigServer
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// if (_HttpConfigServer == null)
|
||||
// _HttpConfigServer = new EssentialsHttpServer();
|
||||
// return _HttpConfigServer;
|
||||
// }
|
||||
//}
|
||||
//static EssentialsHttpServer _HttpConfigServer;
|
||||
|
||||
|
||||
static Global()
|
||||
{
|
||||
// Fire up CrestronDataStoreStatic
|
||||
var err = CrestronDataStoreStatic.InitCrestronDataStore();
|
||||
if (err != CrestronDataStore.CDS_ERROR.CDS_SUCCESS)
|
||||
{
|
||||
CrestronConsole.PrintLine("Error starting CrestronDataStoreStatic: {0}", err);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharp.CrestronDataStore;
|
||||
using Crestron.SimplSharpPro;
|
||||
|
||||
//using PepperDash.Essentials.Core.Http;
|
||||
using PepperDash.Essentials.License;
|
||||
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
public static class Global
|
||||
{
|
||||
public static CrestronControlSystem ControlSystem { get; set; }
|
||||
|
||||
public static LicenseManager LicenseManager { get; set; }
|
||||
|
||||
public static string FilePathPrefix { get; private set; }
|
||||
|
||||
public static char DirectorySeparator
|
||||
{
|
||||
get
|
||||
{
|
||||
return System.IO.Path.DirectorySeparatorChar;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the file path prefix
|
||||
/// </summary>
|
||||
/// <param name="prefix"></param>
|
||||
public static void SetFilePathPrefix(string prefix)
|
||||
{
|
||||
FilePathPrefix = prefix;
|
||||
}
|
||||
|
||||
static Global()
|
||||
{
|
||||
// Fire up CrestronDataStoreStatic
|
||||
var err = CrestronDataStoreStatic.InitCrestronDataStore();
|
||||
if (err != CrestronDataStore.CDS_ERROR.CDS_SUCCESS)
|
||||
{
|
||||
CrestronConsole.PrintLine("Error starting CrestronDataStoreStatic: {0}", err);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
80
Essentials Core/PepperDashEssentialsBase/Global/JobTimer.cs
Normal file
80
Essentials Core/PepperDashEssentialsBase/Global/JobTimer.cs
Normal file
@@ -0,0 +1,80 @@
|
||||
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
|
||||
{
|
||||
RunEveryDay,
|
||||
RunEveryHour,
|
||||
RunEveryHalfHour,
|
||||
RunEveryMinute
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Lighting
|
||||
{
|
||||
/// <summary>
|
||||
/// Requirements for a device that implements lighting scene control
|
||||
/// </summary>
|
||||
public interface ILightingScenes
|
||||
{
|
||||
event EventHandler<LightingSceneChangeEventArgs> LightingSceneChange;
|
||||
|
||||
List<LightingScene> LightingScenes { get; }
|
||||
|
||||
void SelectScene(LightingScene scene);
|
||||
|
||||
LightingScene CurrentLightingScene { get; }
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Requirements for a device that implements master raise/lower
|
||||
/// </summary>
|
||||
public interface ILightingMasterRaiseLower
|
||||
{
|
||||
void MasterRaise();
|
||||
void MasterLower();
|
||||
void MasterRaiseLowerStop();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Requiremnts for controlling a lighting load
|
||||
/// </summary>
|
||||
public interface ILightingLoad
|
||||
{
|
||||
void SetLoadLevel(int level);
|
||||
void Raise();
|
||||
void Lower();
|
||||
|
||||
IntFeedback LoadLevelFeedback { get; }
|
||||
BoolFeedback LoadIsOnFeedback { get; }
|
||||
}
|
||||
|
||||
public class LightingSceneChangeEventArgs : EventArgs
|
||||
{
|
||||
public LightingScene CurrentLightingScene { get; private set; }
|
||||
|
||||
public LightingSceneChangeEventArgs(LightingScene scene)
|
||||
{
|
||||
CurrentLightingScene = scene;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
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.Lighting
|
||||
{
|
||||
public abstract class LightingBase : Device, ILightingScenes
|
||||
{
|
||||
#region ILightingScenes Members
|
||||
|
||||
public event EventHandler<LightingSceneChangeEventArgs> LightingSceneChange;
|
||||
|
||||
public List<LightingScene> LightingScenes { get; protected set; }
|
||||
|
||||
public LightingScene CurrentLightingScene { get; protected set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
public LightingBase(string key, string name)
|
||||
: base(key, name)
|
||||
{
|
||||
LightingScenes = new List<LightingScene>();
|
||||
|
||||
CurrentLightingScene = new LightingScene();
|
||||
}
|
||||
|
||||
public abstract void SelectScene(LightingScene scene);
|
||||
|
||||
public void SimulateSceneSelect(string sceneName)
|
||||
{
|
||||
Debug.Console(1, this, "Simulating selection of scene '{0}'", sceneName);
|
||||
|
||||
var scene = LightingScenes.FirstOrDefault(s => s.Name.Equals(sceneName));
|
||||
|
||||
if (scene != null)
|
||||
{
|
||||
CurrentLightingScene = scene;
|
||||
OnLightingSceneChange();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the IsActive property on each scene and fires the LightingSceneChange event
|
||||
/// </summary>
|
||||
protected void OnLightingSceneChange()
|
||||
{
|
||||
foreach (var scene in LightingScenes)
|
||||
{
|
||||
if (scene == CurrentLightingScene)
|
||||
scene.IsActive = true;
|
||||
else
|
||||
scene.IsActive = false;
|
||||
}
|
||||
|
||||
var handler = LightingSceneChange;
|
||||
if (handler != null)
|
||||
{
|
||||
handler(this, new LightingSceneChangeEventArgs(CurrentLightingScene));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class LightingScene
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string ID { get; set; }
|
||||
bool _IsActive;
|
||||
public bool IsActive
|
||||
{
|
||||
get
|
||||
{
|
||||
return _IsActive;
|
||||
}
|
||||
set
|
||||
{
|
||||
_IsActive = value;
|
||||
IsActiveFeedback.FireUpdate();
|
||||
}
|
||||
}
|
||||
public BoolFeedback IsActiveFeedback { get; set; }
|
||||
|
||||
public LightingScene()
|
||||
{
|
||||
IsActiveFeedback = new BoolFeedback(new Func<bool>(() => IsActive));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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,9 +71,9 @@
|
||||
<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>
|
||||
<HintPath>..\..\..\pepperdash-simplsharp-core\Pepperdash Core\CLZ Builds\PepperDash_Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SimplSharpCustomAttributesInterface, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
@@ -99,6 +103,18 @@
|
||||
<Reference Include="System.Data" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Config\SourceDevicePropertiesConfigBase.cs" />
|
||||
<Compile Include="Crestron IO\Inputs\GenericDigitalInputDevice.cs" />
|
||||
<Compile Include="Crestron IO\Inputs\GenericVersiportInputDevice.cs" />
|
||||
<Compile Include="Crestron IO\Inputs\IDigitalInput.cs" />
|
||||
<Compile Include="Crestron IO\IOPortConfig.cs" />
|
||||
<Compile Include="Crestron IO\Relay\GenericRelayDevice.cs" />
|
||||
<Compile Include="Crestron IO\Relay\ISwitchedOutput.cs" />
|
||||
<Compile Include="Devices\CodecInterfaces.cs" />
|
||||
<Compile Include="Global\JobTimer.cs" />
|
||||
<Compile Include="Lighting\Lighting Interfaces.cs" />
|
||||
<Compile Include="Lighting\LightingBase.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 +127,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 +148,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 +160,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 +169,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" />
|
||||
@@ -167,12 +183,17 @@
|
||||
<Compile Include="Feedbacks\BoolFeedbackPulseExtender.cs" />
|
||||
<Compile Include="Routing\RoutingPortNames.cs" />
|
||||
<Compile Include="Routing\TieLineConfig.cs" />
|
||||
<Compile Include="Shades\Shade Interfaces.cs" />
|
||||
<Compile Include="Shades\ShadeBase.cs" />
|
||||
<Compile Include="Shades\ShadeController.cs" />
|
||||
<Compile Include="SmartObjects\SmartObjectNumeric.cs" />
|
||||
<Compile Include="SmartObjects\SmartObjectDynamicList.cs" />
|
||||
<Compile Include="SmartObjects\SmartObjectDPad.cs" />
|
||||
<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 +209,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 +216,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 +224,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.
@@ -4,5 +4,4 @@
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("PepperDashEssentialsBase")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2015")]
|
||||
[assembly: AssemblyVersion("1.0.0.*")]
|
||||
|
||||
[assembly: AssemblyVersion("1.0.3.*")]
|
||||
@@ -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,203 @@
|
||||
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>
|
||||
/// hdmiIn1PC
|
||||
/// </summary>
|
||||
public const string HdmiIn1PC = "hdmiIn1PC";
|
||||
/// <summary>
|
||||
/// hdmiIn2
|
||||
/// </summary>
|
||||
public const string HdmiIn2 = "hdmiIn2";
|
||||
/// <summary>
|
||||
/// hdmiIn2PC
|
||||
/// </summary>
|
||||
public const string HdmiIn2PC = "hdmiIn2PC";
|
||||
/// <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>
|
||||
/// vgaIn1
|
||||
/// </summary>
|
||||
public const string VgaIn1 = "vgaIn1";
|
||||
/// <summary>
|
||||
/// vgaOut
|
||||
/// </summary>
|
||||
public const string VgaOut = "vgaOut";
|
||||
/// <summary>
|
||||
/// IPC/OPS
|
||||
/// </summary>
|
||||
public const string IpcOps = "ipcOps";
|
||||
/// <summary>
|
||||
/// MediaPlayer
|
||||
/// </summary>
|
||||
public const string MediaPlayer = "mediaPlayer";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Shades
|
||||
{
|
||||
public interface IShades
|
||||
{
|
||||
List<ShadeBase> Shades { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Requirements for a device that implements basic Open/Close shade control
|
||||
/// </summary>
|
||||
public interface IShadesOpenClose
|
||||
{
|
||||
void Open();
|
||||
void Close();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Requirements for a device that implements basic Open/Close/Stop shade control (Uses 3 relays)
|
||||
/// </summary>
|
||||
public interface IShadesOpenCloseStop : IShadesOpenClose
|
||||
{
|
||||
void StopOrPreset();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Requirements for a shade device that provides open/closed feedback
|
||||
/// </summary>
|
||||
public interface iShadesRaiseLowerFeedback
|
||||
{
|
||||
BoolFeedback ShadeIsOpenFeedback { get; }
|
||||
BoolFeedback ShadeIsClosedFeedback { get; }
|
||||
}
|
||||
|
||||
}
|
||||
31
Essentials Core/PepperDashEssentialsBase/Shades/ShadeBase.cs
Normal file
31
Essentials Core/PepperDashEssentialsBase/Shades/ShadeBase.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.CrestronIO;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Shades
|
||||
{
|
||||
/// <summary>
|
||||
/// Base class for a shade device
|
||||
/// </summary>
|
||||
public abstract class ShadeBase : Device, IShadesOpenClose
|
||||
{
|
||||
public ShadeBase(string key, string name)
|
||||
: base(key, name)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#region iShadesOpenClose Members
|
||||
|
||||
public abstract void Open();
|
||||
public abstract void StopOrPreset();
|
||||
public abstract void Close();
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Shades
|
||||
{
|
||||
/// <summary>
|
||||
/// Class that contains the shades to be controlled in a room
|
||||
/// </summary>
|
||||
public class ShadeController : Device, IShades
|
||||
{
|
||||
ShadeControllerConfigProperties Config;
|
||||
|
||||
public List<ShadeBase> Shades { get; private set; }
|
||||
|
||||
public ShadeController(string key, string name, ShadeControllerConfigProperties config)
|
||||
: base(key, name)
|
||||
{
|
||||
Config = config;
|
||||
|
||||
Shades = new List<ShadeBase>();
|
||||
}
|
||||
|
||||
public override bool CustomActivate()
|
||||
{
|
||||
foreach (var shadeConfig in Config.Shades)
|
||||
{
|
||||
var shade = DeviceManager.GetDeviceForKey(shadeConfig.Key) as ShadeBase;
|
||||
|
||||
if (shade != null)
|
||||
{
|
||||
AddShade(shade);
|
||||
}
|
||||
}
|
||||
return base.CustomActivate();
|
||||
}
|
||||
|
||||
void AddShade(ShadeBase shade)
|
||||
{
|
||||
Shades.Add(shade);
|
||||
}
|
||||
}
|
||||
|
||||
public class ShadeControllerConfigProperties
|
||||
{
|
||||
public List<ShadeConfig> Shades { get; set; }
|
||||
|
||||
|
||||
public class ShadeConfig
|
||||
{
|
||||
public string Key { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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))
|
||||
@@ -68,13 +68,14 @@ namespace PepperDash.Essentials.Core
|
||||
// Count the enable lines to see what max items is
|
||||
MaxDefinedItems = (ushort)SRL.BooleanInput
|
||||
.Where(s => s.Name.Contains("Enable")).Count();
|
||||
Debug.Console(0, "SRL {0} contains max {1} items", SRL.ID, MaxDefinedItems);
|
||||
Debug.Console(2, "SRL {0} contains max {1} items", SRL.ID, MaxDefinedItems);
|
||||
|
||||
SRL.SigChange -= new SmartObjectSigChangeEventHandler(SRL_SigChange);
|
||||
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>
|
||||
///
|
||||
@@ -71,23 +144,47 @@ namespace PepperDash.Essentials.Core
|
||||
sig.UserObject = a;
|
||||
return sig;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="tl"></param>
|
||||
/// <param name="sigNum"></param>
|
||||
/// <param name="a"></param>
|
||||
/// <returns></returns>
|
||||
public static UShortOutputSig SetUShortSigAction(this BasicTriList tl, uint sigNum, Action<ushort> a)
|
||||
{
|
||||
return tl.UShortOutput[sigNum].SetUShortSigAction(a);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="sig"></param>
|
||||
/// <param name="a"></param>
|
||||
/// <returns></returns>
|
||||
public static StringOutputSig SetStringSigAction(this StringOutputSig sig, Action<string> a)
|
||||
{
|
||||
sig.UserObject = a;
|
||||
return sig;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="tl"></param>
|
||||
/// <param name="sigNum"></param>
|
||||
/// <param name="a"></param>
|
||||
/// <returns></returns>
|
||||
public static StringOutputSig SetStringSigAction(this BasicTriList tl, uint sigNum, Action<string> a)
|
||||
{
|
||||
return tl.SetStringSigAction(sigNum, a);
|
||||
return tl.StringOutput[sigNum].SetStringSigAction(a);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="sig"></param>
|
||||
/// <returns></returns>
|
||||
public static Sig ClearSigAction(this Sig sig)
|
||||
{
|
||||
sig.UserObject = null;
|
||||
@@ -108,5 +205,50 @@ 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>
|
||||
/// Sends an true-false pulse to the sig
|
||||
/// </summary>
|
||||
/// <param name="tl"></param>
|
||||
/// <param name="sigNum"></param>
|
||||
public static void PulseBool(this BasicTriList tl, uint sigNum)
|
||||
{
|
||||
tl.BooleanInput[sigNum].Pulse();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sends a timed pulse to the sig
|
||||
/// </summary>
|
||||
/// <param name="tl"></param>
|
||||
/// <param name="sigNum"></param>
|
||||
/// <param name="ms"></param>
|
||||
public static void PulseBool(this BasicTriList tl, uint sigNum, int ms)
|
||||
{
|
||||
tl.BooleanInput[sigNum].Pulse(ms);
|
||||
}
|
||||
|
||||
/// <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
|
||||
}
|
||||
}
|
||||
127
Essentials DM/Essentials_DM/Chassis/HdMdNxM4kEController.cs
Normal file
127
Essentials DM/Essentials_DM/Chassis/HdMdNxM4kEController.cs
Normal file
@@ -0,0 +1,127 @@
|
||||
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;
|
||||
using PepperDash.Essentials.DM.Config;
|
||||
|
||||
namespace PepperDash.Essentials.DM.Chassis
|
||||
{
|
||||
public class HdMdNxM4kEController : Device, IRoutingInputsOutputs, IRouting
|
||||
{
|
||||
public HdMdNxM Chassis { get; private set; }
|
||||
|
||||
public RoutingPortCollection<RoutingInputPort> InputPorts { get; private set; }
|
||||
public RoutingPortCollection<RoutingOutputPort> OutputPorts { get; private set; }
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="chassis"></param>
|
||||
public HdMdNxM4kEController(string key, string name, HdMdNxM chassis,
|
||||
HdMdNxM4kEPropertiesConfig props)
|
||||
: base(key, name)
|
||||
{
|
||||
Chassis = chassis;
|
||||
|
||||
// logical ports
|
||||
InputPorts = new RoutingPortCollection<RoutingInputPort>();
|
||||
for (uint i = 1; i <= 4; i++)
|
||||
{
|
||||
InputPorts.Add(new RoutingInputPort("hdmiIn" + i, eRoutingSignalType.AudioVideo,
|
||||
eRoutingPortConnectionType.Hdmi, i, this));
|
||||
}
|
||||
OutputPorts = new RoutingPortCollection<RoutingOutputPort>();
|
||||
OutputPorts.Add(new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.AudioVideo,
|
||||
eRoutingPortConnectionType.Hdmi, null, this));
|
||||
|
||||
// physical settings
|
||||
if (props != null && props.Inputs != null)
|
||||
{
|
||||
foreach (var kvp in props.Inputs)
|
||||
{
|
||||
// strip "hdmiIn"
|
||||
var inputNum = Convert.ToUInt32(kvp.Key.Substring(6));
|
||||
|
||||
var port = chassis.HdmiInputs[inputNum].HdmiInputPort;
|
||||
// set hdcp disables
|
||||
if (kvp.Value.DisableHdcp)
|
||||
{
|
||||
Debug.Console(0, this, "Configuration disables HDCP support on {0}", kvp.Key);
|
||||
port.HdcpSupportOff();
|
||||
}
|
||||
else
|
||||
port.HdcpSupportOn();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override bool CustomActivate()
|
||||
{
|
||||
var result = Chassis.Register();
|
||||
if (result != Crestron.SimplSharpPro.eDeviceRegistrationUnRegistrationResponse.Success)
|
||||
{
|
||||
Debug.Console(0, this, "Device registration failed: {0}", result);
|
||||
return false;
|
||||
}
|
||||
|
||||
return base.CustomActivate();
|
||||
}
|
||||
|
||||
|
||||
|
||||
#region IRouting Members
|
||||
|
||||
public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType)
|
||||
{
|
||||
// Try to make switch only when necessary. The unit appears to toggle when already selected.
|
||||
var current = Chassis.HdmiOutputs[1].VideoOut;
|
||||
if(current != Chassis.HdmiInputs[(uint)inputSelector])
|
||||
Chassis.HdmiOutputs[1].VideoOut = Chassis.HdmiInputs[(uint)inputSelector];
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="type"></param>
|
||||
/// <param name="properties"></param>
|
||||
/// <returns></returns>
|
||||
public static HdMdNxM4kEController GetController(string key, string name,
|
||||
string type, HdMdNxM4kEPropertiesConfig properties)
|
||||
{
|
||||
try
|
||||
{
|
||||
var ipid = properties.Control.IpIdInt;
|
||||
var address = properties.Control.TcpSshProperties.Address;
|
||||
|
||||
type = type.ToLower();
|
||||
if (type == "hdmd4x14ke")
|
||||
{
|
||||
var chassis = new HdMd4x14kE(ipid, address, Global.ControlSystem);
|
||||
return new HdMdNxM4kEController(key, name, chassis, properties);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Console(0, "ERROR Creating device key {0}: \r{1}", key, e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -47,6 +47,13 @@ namespace PepperDash.Essentials.DM
|
||||
return PepperDash.Essentials.DM.DmRmcHelper.GetDmRmcController(key, name, type, props);
|
||||
}
|
||||
|
||||
else if (typeName.Equals("hdmd4x14ke"))
|
||||
{
|
||||
var props = JsonConvert.DeserializeObject
|
||||
<PepperDash.Essentials.DM.Config.HdMdNxM4kEPropertiesConfig>(properties.ToString());
|
||||
return PepperDash.Essentials.DM.Chassis.HdMdNxM4kEController.GetController(key, name, type, props);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials.DM.Config
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the properties section of HdMdNxM boxes
|
||||
/// </summary>
|
||||
public class HdMdNxM4kEPropertiesConfig
|
||||
{
|
||||
[JsonProperty("control")]
|
||||
public ControlPropertiesConfig Control { get; set; }
|
||||
|
||||
[JsonProperty("inputs")]
|
||||
public Dictionary<string, InputPropertiesConfig> Inputs { get; set; }
|
||||
}
|
||||
}
|
||||
15
Essentials DM/Essentials_DM/Config/InputPropertiesConfig.cs
Normal file
15
Essentials DM/Essentials_DM/Config/InputPropertiesConfig.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
namespace PepperDash.Essentials.DM.Config
|
||||
{
|
||||
public class InputPropertiesConfig
|
||||
{
|
||||
public string Name { get; set; }
|
||||
|
||||
public bool DisableHdcp { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -55,14 +55,10 @@
|
||||
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.DM.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="mscorlib" />
|
||||
<Reference Include="PepperDash_Core, Version=1.0.0.15153, Culture=neutral, processorArchitecture=MSIL">
|
||||
<Reference Include="PepperDash_Core, Version=1.0.4.20530, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\PepperDash.Core\Pepperdash Core\Pepperdash Core\bin\PepperDash_Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PepperDash_Essentials_Core, Version=1.0.0.14500, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\Essentials Core\PepperDashEssentialsBase\bin\PepperDash_Essentials_Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SimplSharpCustomAttributesInterface, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpCustomAttributesInterface.dll</HintPath>
|
||||
@@ -95,9 +91,12 @@
|
||||
<Compile Include="Cards REMOVE\DmInputCardBase.cs" />
|
||||
<Compile Include="Chassis\DmCardAudioOutput.cs" />
|
||||
<Compile Include="Chassis\DmChassisController.cs" />
|
||||
<Compile Include="Chassis\HdMdNxM4kEController.cs" />
|
||||
<Compile Include="Config\DmRmcConfig.cs" />
|
||||
<Compile Include="Config\DmTxConfig.cs" />
|
||||
<Compile Include="Config\DMChassisConfig.cs" />
|
||||
<Compile Include="Config\HdMdNxM4kEPropertiesConfig.cs" />
|
||||
<Compile Include="Config\InputPropertiesConfig.cs" />
|
||||
<Compile Include="DmPortName.cs" />
|
||||
<Compile Include="Endpoints\Receivers\DmRmc4KScalerCController.cs" />
|
||||
<Compile Include="Endpoints\Receivers\DmRmcScalerCController.cs" />
|
||||
@@ -115,6 +114,12 @@
|
||||
<Compile Include="VideoStatusHelpers.cs" />
|
||||
<None Include="Properties\ControlSystem.cfg" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Essentials Core\PepperDashEssentialsBase\PepperDash_Essentials_Core.csproj">
|
||||
<Project>{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}</Project>
|
||||
<Name>PepperDash_Essentials_Core</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" />
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
|
||||
Binary file not shown.
@@ -4,5 +4,4 @@
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Essentials_DM")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2016")]
|
||||
[assembly: AssemblyVersion("1.0.0.*")]
|
||||
|
||||
[assembly: AssemblyVersion("1.0.3.*")]
|
||||
@@ -0,0 +1,740 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ClassDiagram MajorVersion="1" MinorVersion="1">
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.GenericAudioOut" Collapsed="true">
|
||||
<Position X="0.5" Y="7.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAA=</HashCode>
|
||||
<FileName>Audio\GenericAudioOut.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
<Lollipop Position="0.2" />
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.GenericAudioOutWithVolume" Collapsed="true">
|
||||
<Position X="0.5" Y="9" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAgAAAAQA=</HashCode>
|
||||
<FileName>Audio\GenericAudioOut.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
<Lollipop Position="0.2" />
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.CenRfgwController" Collapsed="true">
|
||||
<Position X="19" Y="0.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAAIIAAAAAAACABAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>Crestron\Gateways\CenRfgwController.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.IRBlurayBase" Collapsed="true" BaseTypeListCollapsed="true">
|
||||
<Position X="17.25" Y="4.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>gUyjAAoIAAAAxgYAABAAgAECABAoAEAQqcCAQHIABAI=</HashCode>
|
||||
<FileName>DiscPlayer\IRDiscPlayerBase.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
<Lollipop Position="0.2" Collapsed="true" />
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.DeviceFactory" Collapsed="true">
|
||||
<Position X="15.5" Y="3.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>Factory\DeviceFactory.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.GenericSource" Collapsed="true" BaseTypeListCollapsed="true">
|
||||
<Position X="12" Y="4.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAgAAAAAAAACAAAAAAAAAAAAAAAgAAAAAAAAAAIAAAA=</HashCode>
|
||||
<FileName>Generic\GenericSource.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
<Lollipop Position="0.2" Collapsed="true" />
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.InRoomPc" Collapsed="true" BaseTypeListCollapsed="true">
|
||||
<Position X="15.5" Y="4.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAwAAAAAAAACAAAAAAACAAAAAQAgAAAAAAAAAAIAAAA=</HashCode>
|
||||
<FileName>PC\InRoomPc.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
<Lollipop Position="0.2" Collapsed="true" />
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.Laptop" Collapsed="true" BaseTypeListCollapsed="true">
|
||||
<Position X="22.5" Y="4.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAwAAAAAAAACAAAAAAACAAAAAQAgAAAAAAAAAAIAAAA=</HashCode>
|
||||
<FileName>PC\Laptop.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
<Lollipop Position="0.2" Collapsed="true" />
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.IRSetTopBoxBase" Collapsed="true" BaseTypeListCollapsed="true">
|
||||
<Position X="19" Y="4.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AUgjCAqAEAASwgYAACAAoAECABAoAEAwrcCAQHKABAI=</HashCode>
|
||||
<FileName>SetTopBox\IRSetTopBoxBase.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
<Lollipop Position="0.2" Collapsed="true" />
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.SetTopBoxPropertiesConfig" Collapsed="true">
|
||||
<Position X="13.75" Y="6.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAEEAAQAAAAAAAAIAAAAAAAAAAAAAAAAACAAAA=</HashCode>
|
||||
<FileName>SetTopBox\SetTopBoxPropertiesConfig.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.AppleTV" Collapsed="true" BaseTypeListCollapsed="true">
|
||||
<Position X="10.25" Y="0.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAggAAIAAAAARAAAAAAAgAACABAoAEAQqACAQAAABAI=</HashCode>
|
||||
<FileName>Streaming\AppleTV.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
<Lollipop Position="0.2" Collapsed="true" />
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.Roku2" Collapsed="true" BaseTypeListCollapsed="true">
|
||||
<Position X="10.25" Y="6.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAggAAIAAAAABAAAAAAAgAACABAoAEAQqACAQAAABAI=</HashCode>
|
||||
<FileName>Streaming\Roku.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
<Lollipop Position="0.2" Collapsed="true" />
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.Codec.CodecActiveCallItem" Collapsed="true">
|
||||
<Position X="19" Y="1.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAACAAAEAAAAAAAAAOAAAAQAAAAAAAAAAQAAAAAAAAA=</HashCode>
|
||||
<FileName>Codec\CodecActiveCallItem.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.Codec.CodecCallStatusItemChangeEventArgs" Collapsed="true">
|
||||
<Position X="15.5" Y="2.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>Codec\CodecActiveCallItem.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.Codec.CodecCallDirection" Collapsed="true">
|
||||
<Position X="20.75" Y="1.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAA=</HashCode>
|
||||
<FileName>Codec\eCodecCallDirection.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.Codec.CodecCallStatus" Collapsed="true">
|
||||
<Position X="13.75" Y="2.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAA=</HashCode>
|
||||
<FileName>Codec\eCodecCallStatus.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.Codec.CodecCallType" Collapsed="true">
|
||||
<Position X="17.25" Y="2.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAA=</HashCode>
|
||||
<FileName>Codec\eCodecCallType.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.Codec.CodecCallPrivacy" Collapsed="true">
|
||||
<Position X="12" Y="2.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAA=</HashCode>
|
||||
<FileName>Codec\eMeetingPrivacy.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.Codec.VideoCodecInfo" Collapsed="true">
|
||||
<Position X="5.5" Y="3.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>gIAAAAAAAAAAAACCAACAAAAAAAAAAAACAAAAAABAAAA=</HashCode>
|
||||
<FileName>Codec\iCodecInfo.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.Codec.CodecCallFavorites" Collapsed="true">
|
||||
<Position X="22.5" Y="1.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAA=</HashCode>
|
||||
<FileName>Codec\iHasCallFavorites.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.Codec.CodecCallHistory" Collapsed="true">
|
||||
<Position X="10.25" Y="2.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAQAAAAAgAAAAAAAAAAAAAAGAAAABAAAAAAACQ=</HashCode>
|
||||
<FileName>Codec\iHasCallHistory.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.Codec.DirectoryEventArgs" Collapsed="true">
|
||||
<Position X="17.25" Y="3.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>Codec\iHasDirectory.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.Codec.CodecDirectory" Collapsed="true">
|
||||
<Position X="20.75" Y="2.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAIAAAAAAAAAAAABAAAAAIAAIAAQAAAAAA=</HashCode>
|
||||
<FileName>Codec\iHasDirectory.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.Codec.DirectoryItem" Collapsed="true">
|
||||
<Position X="6.75" Y="0.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>Codec\iHasDirectory.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.Codec.DirectoryFolder" Collapsed="true">
|
||||
<Position X="5.5" Y="1.75" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAIAAAAAAAAA=</HashCode>
|
||||
<FileName>Codec\iHasDirectory.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.Codec.DirectoryContact" Collapsed="true">
|
||||
<Position X="7.75" Y="1.75" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAgAAAAAAAEAAAAAAAAAAAAAAAAEIAAAAAAAAAAA=</HashCode>
|
||||
<FileName>Codec\iHasDirectory.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.Codec.ContactMethod" Collapsed="true">
|
||||
<Position X="13.75" Y="3.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAIAAAAAAAgAAAEAAAAAAAAAIAAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>Codec\iHasDirectory.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.Codec.DirectorySearchResultEventArgs" Collapsed="true">
|
||||
<Position X="19" Y="3.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>Codec\iHasDirectory.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.Codec.CodecScheduleAwareness" Collapsed="true">
|
||||
<Position X="10.25" Y="3.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAABAAAAAEAAAAAAAgAAEAAAABAAAAAAAIQAAAAA=</HashCode>
|
||||
<FileName>Codec\iHasScheduleAwareness.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.Codec.Meeting" Collapsed="true">
|
||||
<Position X="13.75" Y="5.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAACAAAAAAACEEgAAAAAAAgQIAAoAQABAAQAAEgAAAA=</HashCode>
|
||||
<FileName>Codec\iHasScheduleAwareness.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.Codec.Call" Collapsed="true">
|
||||
<Position X="17.25" Y="0.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAEAAAABAAAAIAAAAAAAAAAgAAAA=</HashCode>
|
||||
<FileName>Codec\iHasScheduleAwareness.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.Codec.MeetingEventArgs" Collapsed="true">
|
||||
<Position X="15.5" Y="5.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAQAAAAA=</HashCode>
|
||||
<FileName>Codec\iHasScheduleAwareness.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.Codec.CiscoSparkCodecPropertiesConfig" Collapsed="true">
|
||||
<Position X="17.25" Y="1.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAQAAAAAAAAAAAAAAAAAIQAAACAABAAAAA=</HashCode>
|
||||
<FileName>VideoCodec\CiscoCodec\CiscoSparkCodecPropertiesConfig.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.Codec.SharingProperties" Collapsed="true">
|
||||
<Position X="15.5" Y="6.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAA=</HashCode>
|
||||
<FileName>VideoCodec\CiscoCodec\CiscoSparkCodecPropertiesConfig.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Displays.AvocorDisplay" Collapsed="true" BaseTypeListCollapsed="true">
|
||||
<Position X="12" Y="0.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>hC4gIEAIUAABoQAEgBACAAAdBC1gmsGRICKGdQNBACw=</HashCode>
|
||||
<FileName>Display\AvocorVTFDisplay.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
<Lollipop Position="0.2" Collapsed="true" />
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Displays.ComTcpDisplayBase" Collapsed="true">
|
||||
<Position X="6.5" Y="6.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAEQAAAAA=</HashCode>
|
||||
<FileName>Display\ComTcpDisplayBase.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
<Lollipop Position="0.2" />
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Displays.DisplayDeviceFactory" Collapsed="true">
|
||||
<Position X="20.75" Y="3.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>Display\DeviceFactory.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Displays.NecPaSeriesProjector" Collapsed="true">
|
||||
<Position X="6.5" Y="8" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>ogSIAAKIAAALCAAEABAQEAgABAAAAMIAAAAAEABAACA=</HashCode>
|
||||
<FileName>Display\NecPaSeriesProjector.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Displays.NecPSXMDisplay" Collapsed="true" BaseTypeListCollapsed="true">
|
||||
<Position X="22.5" Y="5.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>hLQgIShIAABFQQRUAvICDRMQESwSEQKRKACCZQNAESY=</HashCode>
|
||||
<FileName>Display\NECPSXMDisplay.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
<Lollipop Position="0.2" Collapsed="true" />
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Displays.SamsungMDC" Collapsed="true" BaseTypeListCollapsed="true">
|
||||
<Position X="12" Y="6.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>hKwwIEAIQAABoUAGgBACAAAEBGxAmYORKCCGZQJAACw=</HashCode>
|
||||
<FileName>Display\SamsungMDCDisplay.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
<Lollipop Position="0.2" Collapsed="true" />
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.DSP.BiampTesiraForteDsp" Collapsed="true">
|
||||
<Position X="3.5" Y="8" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>gACAAIAAAAEAQYCigAAAAAAQAACgCAAAAAAAAAMAAAI=</HashCode>
|
||||
<FileName>DSP\BiampTesira\BiampTesiraForteDsp.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.DSP.TesiraForteLevelControl" Collapsed="true">
|
||||
<Position X="0.5" Y="6.25" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>RAAgJACAAAAAAYAAAkIAAAAAIAQCEACJABACRAAAAUQ=</HashCode>
|
||||
<FileName>DSP\BiampTesira\BiampTesiraForteDspLevel.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
<Lollipop Position="0.2" />
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.DSP.BiampTesiraFortePropertiesConfig" Collapsed="true">
|
||||
<Position X="15.5" Y="0.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>BAAAAAAEAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>DSP\BiampTesira\BiampTesiraFortePropertiesConfig.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.DSP.BiampTesiraForteLevelControlBlockConfig" Collapsed="true">
|
||||
<Position X="13.75" Y="0.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAEAAAAIAAAAAAAAAAAAAAAAAIAAEAAAAAAEQ=</HashCode>
|
||||
<FileName>DSP\BiampTesira\BiampTesiraFortePropertiesConfig.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.DSP.TesiraForteControlPoint" Collapsed="true">
|
||||
<Position X="0.5" Y="4.75" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAIAAAAACAAQQAAAAAQAAAAAAAIAAAABEAAAAAAEA=</HashCode>
|
||||
<FileName>DSP\BiampTesira\TesiraForteControlPoint.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.DSP.DspBase" Collapsed="true">
|
||||
<Position X="3.5" Y="6.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAEAIAgAAAAAAIAAAAAAAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>DSP\DspBase.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.DSP.DspControlPoint" Collapsed="true">
|
||||
<Position X="1.75" Y="3.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>DSP\DspBase.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.DSP.DspMuteControl" Collapsed="true">
|
||||
<Position X="2.75" Y="4.75" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>BAAAAAAAAAAAAAAAAQAAAAAAAAAAAAABAAAAQAAAAAQ=</HashCode>
|
||||
<FileName>DSP\DspBase.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.DSP.SoundStructureBasics" Collapsed="true">
|
||||
<Position X="17.25" Y="6.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAA=</HashCode>
|
||||
<FileName>DSP\PolycomSoundStructure\SoundStructureBasics.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.Environment.Lutron.LutronQuantumArea" Collapsed="true" BaseTypeListCollapsed="true">
|
||||
<Position X="10.25" Y="5.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>gACAEBAAAoAABQBAASAAAAAAAAEgAAACAAACAAMAQAI=</HashCode>
|
||||
<FileName>Environment\Lutron\LutronQuantum.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
<Lollipop Position="0.2" Collapsed="true" />
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.Environment.Lutron.LutronQuantumPropertiesConfig" Collapsed="true">
|
||||
<Position X="12" Y="5.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAEAAAAAAAAgQAAAAAAAAAAAAQCAAACAAAAAAA=</HashCode>
|
||||
<FileName>Environment\Lutron\LutronQuantum.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.Microphones.MicrophonePrivacyController" Collapsed="true">
|
||||
<Position X="17.25" Y="5.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>gQAABAAAAxAAIACAgAgAgCBAUQAAQAgCIAEQAACBAAA=</HashCode>
|
||||
<FileName>Microphone\MicrophonePrivacyController.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.Microphones.MicrophonePrivacyControllerConfig" Collapsed="true">
|
||||
<Position X="19" Y="5.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAEAAAAAgAIAAAAAAAAAA=</HashCode>
|
||||
<FileName>Microphone\MicrophonePrivacyControllerConfig.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.Microphones.KeyedDevice" Collapsed="true">
|
||||
<Position X="20.75" Y="4.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>Microphone\MicrophonePrivacyControllerConfig.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.Occupancy.EssentialsGlsOccupancySensorBaseController" Collapsed="true" BaseTypeListCollapsed="true">
|
||||
<Position X="22.5" Y="3.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAIAAAAAAAABAABgAAAAAASEABAAAAAAAAA=</HashCode>
|
||||
<FileName>Occupancy\EssentialsGlsOccupancySensorBaseController.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
<Lollipop Position="0.2" Collapsed="true" />
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.Occupancy.EssentialsOccupancyAggregator" Collapsed="true" BaseTypeListCollapsed="true">
|
||||
<Position X="10.25" Y="4.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAACBAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>Occupancy\EssentialsOccupancyAggregator.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
<Lollipop Position="0.2" Collapsed="true" />
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.VideoCodec.CiscoCodecBookings" Collapsed="true">
|
||||
<Position X="22.5" Y="0.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAg=</HashCode>
|
||||
<FileName>VideoCodec\CiscoCodec\BookingsDataClasses.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.VideoCodec.CiscoCallHistory" Collapsed="true">
|
||||
<Position X="20.75" Y="0.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>VideoCodec\CiscoCodec\CallHistoryDataClasses.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.VideoCodec.CiscoCodecPhonebook" Collapsed="true">
|
||||
<Position X="13.75" Y="1.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>EAAAABAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAA=</HashCode>
|
||||
<FileName>VideoCodec\CiscoCodec\PhonebookDataClasses.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.VideoCodec.MockVC" Collapsed="true">
|
||||
<Position X="0.5" Y="2" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>BgYAIAACAQaKBACAAwAAUSQAAWYCEACDAAiAQBBCgQU=</HashCode>
|
||||
<FileName>VideoCodec\MockVC\MockVC.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
<Lollipop Position="0.2" />
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.VideoCodec.MockCodecInfo" Collapsed="true">
|
||||
<Position X="5.5" Y="4.75" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>gKAAAAAAAAAAAACCAACAAAAAAAAAAAACAAAAAABBAAA=</HashCode>
|
||||
<FileName>VideoCodec\MockVC\MockVC.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.VideoCodec.MockVcPropertiesConfig" Collapsed="true">
|
||||
<Position X="20.75" Y="5.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAA=</HashCode>
|
||||
<FileName>VideoCodec\MockVC\MockVcPropertiesConfig.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.VideoCodec.VideoCodecBase" Collapsed="true">
|
||||
<Position X="1.75" Y="2" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>BiwgAAECAASAAECAgQEDIABAAAYiEBCpCEigQBZCAQU=</HashCode>
|
||||
<FileName>VideoCodec\VideoCodecBase.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
<Lollipop Position="0.2" />
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.VideoCodec.CodecPhonebookSyncState" Collapsed="true" BaseTypeListCollapsed="true">
|
||||
<Position X="22.5" Y="2.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>EAiCAAQAAgEAAQQAEAAAAAAAAAEAAAAAAACAAAAAAAM=</HashCode>
|
||||
<FileName>VideoCodec\VideoCodecBase.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
<Lollipop Position="0.2" Collapsed="true" />
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.VideoCodec.Cisco.CiscoSparkCodec" Collapsed="true">
|
||||
<Position X="2.75" Y="2" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>jhQEtAJaASb7kSCwAwtxECSABsf2n1GBJEmAVJFKWTc=</HashCode>
|
||||
<FileName>VideoCodec\CiscoCodec\CiscoSparkCodec.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
<Lollipop Position="0.2" />
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.VideoCodec.Cisco.CodecCommandWithLabel" Collapsed="true">
|
||||
<Position X="19" Y="2.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAEAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>VideoCodec\CiscoCodec\CiscoSparkCodec.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.VideoCodec.Cisco.CodecSyncState" Collapsed="true" BaseTypeListCollapsed="true">
|
||||
<Position X="12" Y="3.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AIAAAAQACAEAAAQAEAAAAAAAAAAgAAAAAAAACAACACE=</HashCode>
|
||||
<FileName>VideoCodec\CiscoCodec\CiscoSparkCodec.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
<Lollipop Position="0.2" Collapsed="true" />
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.VideoCodec.Cisco.HttpApiServer" Collapsed="true">
|
||||
<Position X="13.75" Y="4.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAQAAAACAAAAABAAAAAAAIAIAAAAAAAQAAgAAAAAA=</HashCode>
|
||||
<FileName>VideoCodec\CiscoCodec\HttpApiServer.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.VideoCodec.Cisco.CiscoCodecConfiguration" Collapsed="true">
|
||||
<Position X="10.25" Y="1.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>VideoCodec\CiscoCodec\xConfiguration.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.VideoCodec.Cisco.CiscoCodecEvents" Collapsed="true">
|
||||
<Position X="12" Y="1.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>VideoCodec\CiscoCodec\xEvent.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.VideoCodec.Cisco.CiscoCodecStatus" Collapsed="true">
|
||||
<Position X="15.5" Y="1.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>VideoCodec\CiscoCodec\xStatus.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="PepperDash.Essentials.Devices.Common.VideoCodec.CiscoCodec.xStatusSparkPlus" Collapsed="true">
|
||||
<Position X="19" Y="6.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>VideoCodec\CiscoCodec\xStatusSparkPlus.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Interface Name="PepperDash.Essentials.Devices.Common.Codec.ICodecAudio" Collapsed="true">
|
||||
<Position X="10.25" Y="7.75" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>Codec\iCodecAudio.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Interface>
|
||||
<Interface Name="PepperDash.Essentials.Devices.Common.Codec.iCodecInfo" Collapsed="true">
|
||||
<Position X="12" Y="7.75" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>Codec\iCodecInfo.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Interface>
|
||||
<Interface Name="PepperDash.Essentials.Devices.Common.Codec.IHasCallFavorites" Collapsed="true">
|
||||
<Position X="15.5" Y="7.75" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>Codec\iHasCallFavorites.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Interface>
|
||||
<Interface Name="PepperDash.Essentials.Devices.Common.Codec.IHasCallHistory" Collapsed="true">
|
||||
<Position X="17.25" Y="7.75" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAQAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>Codec\iHasCallHistory.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Interface>
|
||||
<Interface Name="PepperDash.Essentials.Devices.Common.Codec.IHasContentSharing" Collapsed="true">
|
||||
<Position X="22.5" Y="7.75" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAACAAAAAAAAAAAAAAAAAAAAAAAIAEAgABAAAAA=</HashCode>
|
||||
<FileName>Codec\iHasContentSharing.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Interface>
|
||||
<Interface Name="PepperDash.Essentials.Devices.Common.Codec.IHasDialer" Collapsed="true">
|
||||
<Position X="10.25" Y="8.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAgAAAACAAAAAACAAAAAAAAAAAICAAAAAAAAAAQCAAA=</HashCode>
|
||||
<FileName>Codec\iHasDialer.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Interface>
|
||||
<Interface Name="PepperDash.Essentials.Devices.Common.Codec.IHasDirectory" Collapsed="true">
|
||||
<Position X="12" Y="8.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAgAAAAAAAAAAAAgCAAAAABAAAEAAAAAA=</HashCode>
|
||||
<FileName>Codec\iHasDirectory.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Interface>
|
||||
<Interface Name="PepperDash.Essentials.Devices.Common.Codec.IHasScheduleAwareness" Collapsed="true">
|
||||
<Position X="13.75" Y="8.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAAAACQAAAAAAAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>Codec\iHasScheduleAwareness.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Interface>
|
||||
<Interface Name="PepperDash.Essentials.Devices.Displays.IInputHdmi1" Collapsed="true">
|
||||
<Position X="19" Y="8.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAA=</HashCode>
|
||||
<FileName>Display\InputInterfaces.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Interface>
|
||||
<Interface Name="PepperDash.Essentials.Devices.Displays.IInputHdmi2" Collapsed="true">
|
||||
<Position X="20.75" Y="8.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAA=</HashCode>
|
||||
<FileName>Display\InputInterfaces.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Interface>
|
||||
<Interface Name="PepperDash.Essentials.Devices.Displays.IInputHdmi3" Collapsed="true">
|
||||
<Position X="22.5" Y="8.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAA=</HashCode>
|
||||
<FileName>Display\InputInterfaces.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Interface>
|
||||
<Interface Name="PepperDash.Essentials.Devices.Displays.IInputHdmi4" Collapsed="true">
|
||||
<Position X="10.25" Y="9.25" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAA=</HashCode>
|
||||
<FileName>Display\InputInterfaces.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Interface>
|
||||
<Interface Name="PepperDash.Essentials.Devices.Displays.IInputDisplayPort1" Collapsed="true">
|
||||
<Position X="15.5" Y="8.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAA=</HashCode>
|
||||
<FileName>Display\InputInterfaces.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Interface>
|
||||
<Interface Name="PepperDash.Essentials.Devices.Displays.IInputDisplayPort2" Collapsed="true">
|
||||
<Position X="17.25" Y="8.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>Display\InputInterfaces.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Interface>
|
||||
<Interface Name="PepperDash.Essentials.Devices.Displays.IInputVga1" Collapsed="true">
|
||||
<Position X="12" Y="9.25" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>Display\InputInterfaces.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Interface>
|
||||
<Interface Name="PepperDash.Essentials.Devices.Common.DSP.IDspLevelControl" Collapsed="true">
|
||||
<Position X="13.75" Y="7.75" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>QAAAAACAAAAAAAAAAAAAAAAAAAAAAAAIAAEAAAAAAAQ=</HashCode>
|
||||
<FileName>DSP\DspBase.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Interface>
|
||||
<Interface Name="PepperDash.Essentials.Devices.Common.Occupancy.IOccupancyStatusProvider" Collapsed="true">
|
||||
<Position X="13.75" Y="9.25" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>Occupancy\iOccupancyStatusProvider.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Interface>
|
||||
<Interface Name="PepperDash.Essentials.Devices.Common.VideoCodec.IHasCodecLayouts" Collapsed="true">
|
||||
<Position X="19" Y="7.75" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAgAAAAAAAAAAAAAAAEEgAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>VideoCodec\Interfaces\IHasCodecLayouts.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Interface>
|
||||
<Interface Name="PepperDash.Essentials.Devices.Common.VideoCodec.IHasCodecSelfview" Collapsed="true">
|
||||
<Position X="20.75" Y="7.75" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>ABAAEAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAABAAAAI=</HashCode>
|
||||
<FileName>VideoCodec\Interfaces\IHasCodecSelfview.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Interface>
|
||||
<Enum Name="PepperDash.Essentials.Devices.Common.eExGatewayType" Collapsed="true">
|
||||
<Position X="10.25" Y="11" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAgAAAAAAAAAAAAAIAAAEAAAAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>Crestron\Gateways\CenRfgwController.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Enum>
|
||||
<Enum Name="PepperDash.Essentials.Devices.Common.Codec.eCodecCallDirection" Collapsed="true">
|
||||
<Position X="12" Y="10.25" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAgQAAAAAAAAAAAABA=</HashCode>
|
||||
<FileName>Codec\eCodecCallDirection.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Enum>
|
||||
<Enum Name="PepperDash.Essentials.Devices.Common.Codec.eCodecCallStatus" Collapsed="true">
|
||||
<Position X="13.75" Y="10.25" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>CAgAAABAAAAAQAACAAABAAAAAAAAAAABCAAAAiAAQBA=</HashCode>
|
||||
<FileName>Codec\eCodecCallStatus.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Enum>
|
||||
<Enum Name="PepperDash.Essentials.Devices.Common.Codec.eCodecCallType" Collapsed="true">
|
||||
<Position X="15.5" Y="10.25" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAoBg=</HashCode>
|
||||
<FileName>Codec\eCodecCallType.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Enum>
|
||||
<Enum Name="PepperDash.Essentials.Devices.Common.Codec.eMeetingPrivacy" Collapsed="true">
|
||||
<Position X="13.75" Y="11" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAQBA=</HashCode>
|
||||
<FileName>Codec\eMeetingPrivacy.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Enum>
|
||||
<Enum Name="PepperDash.Essentials.Devices.Common.Codec.eCodecOccurrenceType" Collapsed="true">
|
||||
<Position X="17.25" Y="10.25" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAABAAAAAIAAAAAAAAAAAAAAAAAAAEAAAAAAABA=</HashCode>
|
||||
<FileName>Codec\iHasCallHistory.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Enum>
|
||||
<Enum Name="PepperDash.Essentials.Devices.Common.Codec.eContactMethodDevice" Collapsed="true">
|
||||
<Position X="22.5" Y="10.25" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>BAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAIAAAAAAABg=</HashCode>
|
||||
<FileName>Codec\iHasDirectory.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Enum>
|
||||
<Enum Name="PepperDash.Essentials.Devices.Common.Codec.eContactMethodCallType" Collapsed="true">
|
||||
<Position X="20.75" Y="10.25" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAABg=</HashCode>
|
||||
<FileName>Codec\iHasDirectory.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Enum>
|
||||
<Enum Name="PepperDash.Essentials.Devices.Common.Codec.eMeetingEventChangeType" Collapsed="true">
|
||||
<Position X="12" Y="11" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>BAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAIACg=</HashCode>
|
||||
<FileName>Codec\iHasScheduleAwareness.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Enum>
|
||||
<Enum Name="PepperDash.Essentials.Devices.Common.Environment.Lutron.eAction" Collapsed="true">
|
||||
<Position X="10.25" Y="10.25" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AACAACAAABAAgIAAgAAQAAAAAAAAIAAAIAAAACAEAAg=</HashCode>
|
||||
<FileName>Environment\Lutron\LutronQuantum.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Enum>
|
||||
<Enum Name="PepperDash.Essentials.Devices.Common.VideoCodec.Cisco.eCommandType" Collapsed="true">
|
||||
<Position X="19" Y="10.25" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAACAQAAAAABAAEAAAAAAAAgAAAAAAAAAA=</HashCode>
|
||||
<FileName>VideoCodec\CiscoCodec\CiscoSparkCodec.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Enum>
|
||||
<Font Name="Segoe UI" Size="9" />
|
||||
</ClassDiagram>
|
||||
@@ -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 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class CodecCallStatusItemChangeEventArgs : EventArgs
|
||||
{
|
||||
public CodecActiveCallItem CallItem { get; private set; }
|
||||
|
||||
public CodecCallStatusItemChangeEventArgs(CodecActiveCallItem item)
|
||||
{
|
||||
CallItem = item;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user