Compare commits

...

30 Commits

Author SHA1 Message Date
Andrew Welker
34440af1c5 fix for updating call status when in meeting & call is already connected 2020-10-01 13:25:33 -06:00
Andrew Welker
c0e3da9214 fix for EiscApiAdvanced loading 2020-10-01 12:15:54 -06:00
Andrew Welker
d50ad7345d fix ZoomRoomCamera Timer 2020-10-01 10:37:31 -06:00
Andrew Welker
95016c3ec6 fix camera mute command 2020-10-01 10:07:08 -06:00
Andrew Welker
f8f5c2474c Merge branch 'development' into feature/zoom-room-feature-add 2020-09-30 17:05:17 -06:00
Andrew Welker
b997e9a135 Merge pull request #428 from PepperDash/feature/vc4-eisc
Add VirtualControlEiscClient
2020-09-30 17:01:56 -06:00
Andrew Welker
c7ccac2fe6 fix merge issue 2020-09-30 16:40:58 -06:00
Andrew Welker
05885f568e Merge branch 'development' into feature/zoom-room-feature-add 2020-09-30 16:27:00 -06:00
Andrew Welker
b500b9f6cc Add feedbacks for Camera Auto Mode 2020-09-30 16:26:48 -06:00
Andrew Welker
e784c08f80 Add camera off and auto stuff to Zoom Room 2020-09-30 15:47:32 -06:00
Andrew Welker
45ea5cc875 Merge branch 'development' into feature/vc4-eisc 2020-09-30 14:09:04 -06:00
Andrew Welker
a006698bb2 Merge pull request #433 from PepperDash/feature/add-runtime-ip-info-to-global
Add runtime IP info to global
2020-09-30 14:06:38 -06:00
Andrew Welker
e365944dc3 add config object to stop downloading large phonebooks 2020-09-30 13:55:40 -06:00
Neil Dorin
c33dcb78d0 Merge branch 'development' into feature/add-runtime-ip-info-to-global 2020-09-30 13:21:52 -06:00
Neil Dorin
e48ec3af7c Adds information about ethernet interfaces to Global class 2020-09-30 13:15:23 -06:00
Andrew Welker
4b9d7d1a1f adjust queue size 2020-09-30 11:21:13 -06:00
Andrew Welker
d6133905b2 really fix pepperdash core version 2020-09-30 09:00:56 -06:00
Andrew Welker
741b401d8c fix PepperDash Core version 2020-09-30 08:52:16 -06:00
Jason DeVito
cb661313c2 Fixes for indexing form xsig 2020-09-29 17:21:17 -05:00
Andrew Welker
3c794849bd added a couple of debugging statements 2020-09-29 15:22:32 -06:00
Andrew Welker
753b4e69ee add constructor to CodecScheduleAwareness to chang refresh timer 2020-09-29 15:08:33 -06:00
Andrew Welker
b502007fff Changes to keep from clearing meeting list 2020-09-29 14:41:55 -06:00
Andrew Welker
1e6d65fe53 changing some things to check for updates to meetings list 2020-09-29 13:24:53 -06:00
Andrew Welker
72515a79ca fixes and additions 2020-09-29 12:08:29 -06:00
Andrew Welker
b286008403 fix signal direction 2020-09-28 19:17:09 -06:00
Andrew Welker
c8e3f752db added properties to support dynamic time before meeting start for warnings 2020-09-28 19:15:39 -06:00
Andrew Welker
d2eadcd2f5 Use InitialParametersClass.RoomId instead of Config 2020-09-25 10:42:41 -06:00
Andrew Welker
13dabc09c7 Merge branch 'development' into feature/vc4-eisc 2020-09-25 08:53:39 -06:00
Andrew Welker
0fc6a73b30 adjust factory and constructor for EiscApiAdvanced
Keep SystemMonitor from getting instantiated
if we're on a VC-4 instance
2020-09-25 08:47:31 -06:00
Andrew Welker
8f319a4405 making changes for adding VC4 bridge 2020-09-16 09:55:58 -06:00
16 changed files with 729 additions and 468 deletions

View File

@@ -327,7 +327,11 @@ namespace PepperDash.Essentials
DeviceManager.AddDevice(new PepperDash.Essentials.Core.Devices.CrestronProcessor("processor"));
// Add global System Monitor device
DeviceManager.AddDevice(new PepperDash.Essentials.Core.Monitoring.SystemMonitorController("systemMonitor"));
if (CrestronEnvironment.DevicePlatform == eDevicePlatform.Appliance)
{
DeviceManager.AddDevice(
new PepperDash.Essentials.Core.Monitoring.SystemMonitorController("systemMonitor"));
}
foreach (var devConf in ConfigReader.ConfigObject.Devices)
{

View File

@@ -1,7 +1,9 @@
using System;
using System.Collections.Generic;
using Crestron.SimplSharp;
using Crestron.SimplSharp.Reflection;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.EthernetCommunication;
using Newtonsoft.Json;
@@ -82,9 +84,9 @@ namespace PepperDash.Essentials.Core.Bridges
protected Dictionary<string, JoinMapBaseAdvanced> JoinMaps { get; private set; }
public ThreeSeriesTcpIpEthernetIntersystemCommunications Eisc { get; private set; }
public BasicTriList Eisc { get; private set; }
public EiscApiAdvanced(DeviceConfig dc) :
public EiscApiAdvanced(DeviceConfig dc, BasicTriList eisc) :
base(dc.Key)
{
JoinMaps = new Dictionary<string, JoinMapBaseAdvanced>();
@@ -92,44 +94,52 @@ namespace PepperDash.Essentials.Core.Bridges
PropertiesConfig = dc.Properties.ToObject<EiscApiPropertiesConfig>();
//PropertiesConfig = JsonConvert.DeserializeObject<EiscApiPropertiesConfig>(dc.Properties.ToString());
Eisc = new ThreeSeriesTcpIpEthernetIntersystemCommunications(PropertiesConfig.Control.IpIdInt, PropertiesConfig.Control.TcpSshProperties.Address, Global.ControlSystem);
Eisc = eisc;
Eisc.SigChange += Eisc_SigChange;
AddPostActivationAction( () =>
AddPostActivationAction(LinkDevices);
}
private void LinkDevices()
{
Debug.Console(1, this, "Linking Devices...");
foreach (var d in PropertiesConfig.Devices)
{
Debug.Console(1, this, "Linking Devices...");
var device = DeviceManager.GetDeviceForKey(d.DeviceKey);
foreach (var d in PropertiesConfig.Devices)
if (device == null)
{
var device = DeviceManager.GetDeviceForKey(d.DeviceKey);
if (device == null) continue;
Debug.Console(1, this, "Linking Device: '{0}'", device.Key);
if (!typeof (IBridgeAdvanced).IsAssignableFrom(device.GetType().GetCType()))
{
Debug.Console(0, this, Debug.ErrorLogLevel.Notice,
"{0} is not compatible with this bridge type. Please use 'eiscapi' instead, or updae the device.",
device.Key);
continue;
}
var bridge = device as IBridgeAdvanced;
if (bridge != null) bridge.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey, this);
continue;
}
var registerResult = Eisc.Register();
Debug.Console(1, this, "Linking Device: '{0}'", device.Key);
if (registerResult != eDeviceRegistrationUnRegistrationResponse.Success)
if (!typeof (IBridgeAdvanced).IsAssignableFrom(device.GetType().GetCType()))
{
Debug.Console(2, this, Debug.ErrorLogLevel.Error, "Registration result: {0}", registerResult);
return;
Debug.Console(0, this, Debug.ErrorLogLevel.Notice,
"{0} is not compatible with this bridge type. Please use 'eiscapi' instead, or updae the device.",
device.Key);
continue;
}
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "EISC registration successful");
});
var bridge = device as IBridgeAdvanced;
if (bridge != null)
{
bridge.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey, this);
}
}
var registerResult = Eisc.Register();
if (registerResult != eDeviceRegistrationUnRegistrationResponse.Success)
{
Debug.Console(2, this, Debug.ErrorLogLevel.Error, "Registration result: {0}", registerResult);
return;
}
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "EISC registration successful");
}
/// <summary>
@@ -152,7 +162,7 @@ namespace PepperDash.Essentials.Core.Bridges
/// <summary>
/// Prints all the join maps on this bridge
/// </summary>
public void PrintJoinMaps()
public virtual void PrintJoinMaps()
{
Debug.Console(0, this, "Join Maps for EISC IPID: {0}", Eisc.ID.ToString("X"));
@@ -247,7 +257,7 @@ namespace PepperDash.Essentials.Core.Bridges
/// </summary>
/// <param name="currentDevice"></param>
/// <param name="args"></param>
void Eisc_SigChange(object currentDevice, SigEventArgs args)
protected void Eisc_SigChange(object currentDevice, SigEventArgs args)
{
try
{
@@ -299,15 +309,34 @@ namespace PepperDash.Essentials.Core.Bridges
{
public EiscApiAdvancedFactory()
{
TypeNames = new List<string> { "eiscapiadv", "eiscapiadvanced" };
TypeNames = new List<string> { "eiscapiadv", "eiscapiadvanced", "vceiscapiadv", "vceiscapiadvanced" };
}
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory Attempting to create new EiscApiAdvanced Device");
return new EiscApiAdvanced(dc);
var controlProperties = CommFactory.GetControlPropertiesConfig(dc);
switch (dc.Type.ToLower())
{
case "eiscapiadv":
case "eiscapiadvanced":
{
var eisc = new ThreeSeriesTcpIpEthernetIntersystemCommunications(controlProperties.IpIdInt,
controlProperties.TcpSshProperties.Address, Global.ControlSystem);
return new EiscApiAdvanced(dc, eisc);
}
case "vceiscapiadv":
case "vceiscapiadvanced":
{
var eisc = new VirtualControlEISCClient(controlProperties.IpIdInt, InitialParametersClass.RoomId,
Global.ControlSystem);
return new EiscApiAdvanced(dc, eisc);
}
default:
return null;
}
}
}

View File

@@ -266,7 +266,7 @@ namespace PepperDash_Essentials_Core.Bridges.JoinMaps
new JoinMetadata
{
Description = "Directory Line Selected FB",
JoinCapabilities = eJoinCapabilities.ToSIMPL,
JoinCapabilities = eJoinCapabilities.FromSIMPL,
JoinType = eJoinType.Digital
});
@@ -701,6 +701,14 @@ namespace PepperDash_Essentials_Core.Bridges.JoinMaps
JoinType = eJoinType.Analog
});
[JoinName("MinutesBeforeMeetingStart")] public JoinDataComplete MinutesBeforeMeetingStart =
new JoinDataComplete(new JoinData {JoinNumber = 41, JoinSpan = 1},
new JoinMetadata
{
Description = "Minutes before meeting start that a meeting is joinable",
JoinCapabilities = eJoinCapabilities.FromSIMPL,
JoinType = eJoinType.Analog
});
public VideoCodecControllerJoinMap(uint joinStart) : base(joinStart, typeof (VideoCodecControllerJoinMap))
{

View File

@@ -1,120 +1,120 @@
using System;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DM;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.Core
{
/// <summary>
///
/// </summary>
public class CommFactory
{
public static EssentialsControlPropertiesConfig GetControlPropertiesConfig(DeviceConfig deviceConfig)
{
try
{
return JsonConvert.DeserializeObject<EssentialsControlPropertiesConfig>
(deviceConfig.Properties["control"].ToString());
//Debug.Console(2, "Control TEST: {0}", JsonConvert.SerializeObject(controlConfig));
}
catch (Exception e)
{
Debug.Console(0, "ERROR: [{0}] Control properties deserialize failed:\r{1}", deviceConfig.Key, e);
return null;
}
}
/// <summary>
/// Returns a comm method of either com port, TCP, SSH, and puts this into the DeviceManager
/// </summary>
/// <param name="deviceConfig">The Device config object</param>
public static IBasicCommunication CreateCommForDevice(DeviceConfig deviceConfig)
{
EssentialsControlPropertiesConfig controlConfig = GetControlPropertiesConfig(deviceConfig);
if (controlConfig == null)
return null;
IBasicCommunication comm = null;
try
{
var c = controlConfig.TcpSshProperties;
switch (controlConfig.Method)
{
case eControlMethod.Com:
comm = new ComPortController(deviceConfig.Key + "-com", GetComPort, controlConfig.ComParams, controlConfig);
break;
case eControlMethod.Cec:
comm = new CecPortController(deviceConfig.Key + "-cec", GetCecPort, controlConfig);
break;
case eControlMethod.IR:
break;
case eControlMethod.Ssh:
{
var ssh = new GenericSshClient(deviceConfig.Key + "-ssh", c.Address, c.Port, c.Username, c.Password);
ssh.AutoReconnect = c.AutoReconnect;
if(ssh.AutoReconnect)
ssh.AutoReconnectIntervalMs = c.AutoReconnectIntervalMs;
comm = ssh;
break;
}
case eControlMethod.Tcpip:
{
var tcp = new GenericTcpIpClient(deviceConfig.Key + "-tcp", c.Address, c.Port, c.BufferSize);
tcp.AutoReconnect = c.AutoReconnect;
if (tcp.AutoReconnect)
tcp.AutoReconnectIntervalMs = c.AutoReconnectIntervalMs;
comm = tcp;
break;
}
case eControlMethod.Udp:
{
var udp = new GenericUdpServer(deviceConfig.Key + "-udp", c.Address, c.Port, c.BufferSize);
comm = udp;
break;
}
case eControlMethod.Telnet:
break;
default:
break;
}
}
catch (Exception e)
{
Debug.Console(0, "Cannot create communication from JSON:\r{0}\r\rException:\r{1}",
deviceConfig.Properties.ToString(), e);
}
// put it in the device manager if it's the right flavor
var comDev = comm as Device;
if (comDev != null)
DeviceManager.AddDevice(comDev);
return comm;
}
public static ComPort GetComPort(EssentialsControlPropertiesConfig config)
{
var comPar = config.ComParams;
var dev = GetIComPortsDeviceFromManagedDevice(config.ControlPortDevKey);
if (dev != null && config.ControlPortNumber <= dev.NumberOfComPorts)
return dev.ComPorts[config.ControlPortNumber];
Debug.Console(0, "GetComPort: Device '{0}' does not have com port {1}", config.ControlPortDevKey, config.ControlPortNumber);
return null;
}
/// <summary>
/// Gets an ICec port from a RoutingInput or RoutingOutput on a device
/// </summary>
/// <param name="config"></param>
/// <returns></returns>
public static ICec GetCecPort(ControlPropertiesConfig config)
{
using System;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DM;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.Core
{
/// <summary>
///
/// </summary>
public class CommFactory
{
public static EssentialsControlPropertiesConfig GetControlPropertiesConfig(DeviceConfig deviceConfig)
{
try
{
return JsonConvert.DeserializeObject<EssentialsControlPropertiesConfig>
(deviceConfig.Properties["control"].ToString());
//Debug.Console(2, "Control TEST: {0}", JsonConvert.SerializeObject(controlConfig));
}
catch (Exception e)
{
Debug.Console(0, "ERROR: [{0}] Control properties deserialize failed:\r{1}", deviceConfig.Key, e);
return null;
}
}
/// <summary>
/// Returns a comm method of either com port, TCP, SSH, and puts this into the DeviceManager
/// </summary>
/// <param name="deviceConfig">The Device config object</param>
public static IBasicCommunication CreateCommForDevice(DeviceConfig deviceConfig)
{
EssentialsControlPropertiesConfig controlConfig = GetControlPropertiesConfig(deviceConfig);
if (controlConfig == null)
return null;
IBasicCommunication comm = null;
try
{
var c = controlConfig.TcpSshProperties;
switch (controlConfig.Method)
{
case eControlMethod.Com:
comm = new ComPortController(deviceConfig.Key + "-com", GetComPort, controlConfig.ComParams, controlConfig);
break;
case eControlMethod.Cec:
comm = new CecPortController(deviceConfig.Key + "-cec", GetCecPort, controlConfig);
break;
case eControlMethod.IR:
break;
case eControlMethod.Ssh:
{
var ssh = new GenericSshClient(deviceConfig.Key + "-ssh", c.Address, c.Port, c.Username, c.Password);
ssh.AutoReconnect = c.AutoReconnect;
if(ssh.AutoReconnect)
ssh.AutoReconnectIntervalMs = c.AutoReconnectIntervalMs;
comm = ssh;
break;
}
case eControlMethod.Tcpip:
{
var tcp = new GenericTcpIpClient(deviceConfig.Key + "-tcp", c.Address, c.Port, c.BufferSize);
tcp.AutoReconnect = c.AutoReconnect;
if (tcp.AutoReconnect)
tcp.AutoReconnectIntervalMs = c.AutoReconnectIntervalMs;
comm = tcp;
break;
}
case eControlMethod.Udp:
{
var udp = new GenericUdpServer(deviceConfig.Key + "-udp", c.Address, c.Port, c.BufferSize);
comm = udp;
break;
}
case eControlMethod.Telnet:
break;
default:
break;
}
}
catch (Exception e)
{
Debug.Console(0, "Cannot create communication from JSON:\r{0}\r\rException:\r{1}",
deviceConfig.Properties.ToString(), e);
}
// put it in the device manager if it's the right flavor
var comDev = comm as Device;
if (comDev != null)
DeviceManager.AddDevice(comDev);
return comm;
}
public static ComPort GetComPort(EssentialsControlPropertiesConfig config)
{
var comPar = config.ComParams;
var dev = GetIComPortsDeviceFromManagedDevice(config.ControlPortDevKey);
if (dev != null && config.ControlPortNumber <= dev.NumberOfComPorts)
return dev.ComPorts[config.ControlPortNumber];
Debug.Console(0, "GetComPort: Device '{0}' does not have com port {1}", config.ControlPortDevKey, config.ControlPortNumber);
return null;
}
/// <summary>
/// Gets an ICec port from a RoutingInput or RoutingOutput on a device
/// </summary>
/// <param name="config"></param>
/// <returns></returns>
public static ICec GetCecPort(ControlPropertiesConfig config)
{
var dev = DeviceManager.GetDeviceForKey(config.ControlPortDevKey);
if (dev != null)
@@ -147,64 +147,64 @@ namespace PepperDash.Essentials.Core
Debug.Console(0, "GetCecPort: '{0}' - Configuration missing 'ControlPortName'", config.ControlPortDevKey);
}
}
Debug.Console(0, "GetCecPort: Device '{0}' is not a valid device.", config.ControlPortDevKey);
return null;
}
/// <summary>
/// Helper to grab the IComPorts device for this PortDeviceKey. Key "controlSystem" will
/// return the ControlSystem object from the Global class.
/// </summary>
/// <returns>IComPorts device or null if the device is not found or does not implement IComPorts</returns>
public static IComPorts GetIComPortsDeviceFromManagedDevice(string ComPortDevKey)
{
if ((ComPortDevKey.Equals("controlSystem", System.StringComparison.OrdinalIgnoreCase)
|| ComPortDevKey.Equals("processor", System.StringComparison.OrdinalIgnoreCase))
&& Global.ControlSystem is IComPorts)
return Global.ControlSystem;
else
{
var dev = DeviceManager.GetDeviceForKey(ComPortDevKey) as IComPorts;
if (dev == null)
Debug.Console(0, "ComPortConfig: Cannot find com port device '{0}'", ComPortDevKey);
return dev;
}
}
}
/// <summary>
///
/// </summary>
public class EssentialsControlPropertiesConfig :
PepperDash.Core.ControlPropertiesConfig
{
[JsonConverter(typeof(ComSpecJsonConverter))]
public ComPort.ComPortSpec ComParams { get; set; }
public string CresnetId { get; set; }
/// <summary>
/// Attempts to provide uint conversion of string CresnetId
/// </summary>
public uint CresnetIdInt
{
get
{
try
{
return Convert.ToUInt32(CresnetId, 16);
}
catch (Exception)
{
throw new FormatException(string.Format("ERROR:Unable to convert Cresnet ID: {0} to hex. Error:\n{1}", CresnetId));
}
}
Debug.Console(0, "GetCecPort: Device '{0}' is not a valid device.", config.ControlPortDevKey);
return null;
}
public string InfinetId { get; set; }
/// <summary>
/// Helper to grab the IComPorts device for this PortDeviceKey. Key "controlSystem" will
/// return the ControlSystem object from the Global class.
/// </summary>
/// <returns>IComPorts device or null if the device is not found or does not implement IComPorts</returns>
public static IComPorts GetIComPortsDeviceFromManagedDevice(string ComPortDevKey)
{
if ((ComPortDevKey.Equals("controlSystem", System.StringComparison.OrdinalIgnoreCase)
|| ComPortDevKey.Equals("processor", System.StringComparison.OrdinalIgnoreCase))
&& Global.ControlSystem is IComPorts)
return Global.ControlSystem;
else
{
var dev = DeviceManager.GetDeviceForKey(ComPortDevKey) as IComPorts;
if (dev == null)
Debug.Console(0, "ComPortConfig: Cannot find com port device '{0}'", ComPortDevKey);
return dev;
}
}
}
/// <summary>
///
/// </summary>
public class EssentialsControlPropertiesConfig :
PepperDash.Core.ControlPropertiesConfig
{
[JsonConverter(typeof(ComSpecJsonConverter))]
public ComPort.ComPortSpec ComParams { get; set; }
public string CresnetId { get; set; }
/// <summary>
/// Attempts to provide uint conversion of string CresnetId
/// </summary>
public uint CresnetIdInt
{
get
{
try
{
return Convert.ToUInt32(CresnetId, 16);
}
catch (Exception)
{
throw new FormatException(string.Format("ERROR:Unable to convert Cresnet ID: {0} to hex. Error:\n{1}", CresnetId));
}
}
}
public string InfinetId { get; set; }
/// <summary>
/// Attepmts to provide uiont conversion of string InifinetId
/// </summary>
@@ -221,13 +221,13 @@ namespace PepperDash.Essentials.Core
throw new FormatException(string.Format("ERROR:Unable to conver Infinet ID: {0} to hex. Error:\n{1}", InfinetId));
}
}
}
}
public class IrControlSpec
{
public string PortDeviceKey { get; set; }
public uint PortNumber { get; set; }
public string File { get; set; }
}
}
}
public class IrControlSpec
{
public string PortDeviceKey { get; set; }
public uint PortNumber { get; set; }
public string File { get; set; }
}
}

View File

@@ -1,5 +1,5 @@
using System;
using System.Collections.Generic;
using Crestron.SimplSharp;
using Crestron.SimplSharp.Reflection;
@@ -81,7 +81,7 @@ namespace PepperDash.Essentials.Core.Config
// }
//}
/// <summary>
/// <summary>,
/// The OS Version of the processor (Firmware Version)
/// </summary>
[JsonProperty("osVersion")]
@@ -92,5 +92,18 @@ namespace PepperDash.Essentials.Core.Config
// return Crestron.SimplSharp.CrestronEnvironment.OSVersion.Firmware;
// }
//}
/// <summary>
/// The information gathered by the processor at runtime about it's NICs and their IP addresses.
/// </summary>
[JsonProperty("ipInfo")]
public Dictionary<short, EthernetAdapterInfo> IpInfo
{
get
{
return Global.EthernetAdapterInfoCollection;
}
}
}
}

View File

@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
namespace PepperDash.Essentials.Core
{
public class EthernetAdapterInfo
{
public EthernetAdapterType Type { get; set; }
public bool DhcpIsOn { get; set; }
public string Hostname { get; set; }
public string MacAddress { get; set; }
public string IpAddress { get; set; }
public string Subnet { get; set; }
public string Gateway { get; set; }
public string Dns1 { get; set; }
public string Dns2 { get; set; }
public string Dns3 { get; set; }
public string Domain { get; set; }
}
}

View File

@@ -1,175 +1,180 @@
using System;
using System.Text.RegularExpressions;
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Crestron.SimplSharp.CrestronDataStore;
using Crestron.SimplSharpPro;
using PepperDash.Core;
using PepperDash.Essentials.License;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Schema;
namespace PepperDash.Essentials.Core
{
public static class Global
{
using System;
using System.Text.RegularExpressions;
using Crestron.SimplSharp;
using System.Collections.Generic;
using Crestron.SimplSharp.CrestronIO;
using Crestron.SimplSharp.CrestronDataStore;
using Crestron.SimplSharpPro;
using PepperDash.Core;
using PepperDash.Essentials.License;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Schema;
namespace PepperDash.Essentials.Core
{
public static class Global
{
public static CrestronControlSystem ControlSystem { get; set; }
public static LicenseManager LicenseManager { get; set; }
/// <summary>
/// The file path prefix to the folder containing configuration files
/// </summary>
public static string FilePathPrefix { get; private set; }
/// <summary>
/// The file path prefix to the applciation directory
/// </summary>
public static string ApplicationDirectoryPathPrefix
{
get
{
return Crestron.SimplSharp.CrestronIO.Directory.GetApplicationDirectory();
}
}
/// <summary>
/// Returns the directory separator character based on the running OS
/// </summary>
public static char DirectorySeparator
{
get
{
return System.IO.Path.DirectorySeparatorChar;
}
}
/// <summary>
/// Wildcarded config file name for global reference
/// </summary>
public const string ConfigFileName = "*configurationFile*.json";
/// <summary>
/// Sets the file path prefix
/// </summary>
/// <param name="prefix"></param>
public static void SetFilePathPrefix(string prefix)
{
FilePathPrefix = prefix;
}
static string _AssemblyVersion;
/// <summary>
/// Gets the Assembly Version of Essentials
/// </summary>
/// <returns>The Assembly Version at Runtime</returns>
public static string AssemblyVersion
{
get
{
return _AssemblyVersion;
}
private set
{
_AssemblyVersion = value;
}
}
/// <summary>
/// Sets the Assembly version to the version of the Essentials Library
/// </summary>
/// <param name="assemblyVersion"></param>
public static void SetAssemblyVersion(string assemblyVersion)
{
AssemblyVersion = assemblyVersion;
}
/// <summary>
/// Checks to see if the running version meets or exceed the minimum specified version. For beta versions (0.xx.yy), will always return true.
/// </summary>
/// <param name="minimumVersion">Minimum specified version in format of xx.yy.zz</param>
/// <returns>Returns true if the running version meets or exceeds the minimum specified version</returns>
public static bool IsRunningMinimumVersionOrHigher(string minimumVersion)
{
Debug.Console(2, "Comparing running version '{0}' to minimum version '{1}'", AssemblyVersion, minimumVersion);
if (String.IsNullOrEmpty(minimumVersion))
{
Debug.Console(0,"Plugin does not specify a minimum version. Loading plugin may not work as expected. Proceeding with loading plugin");
return true;
}
var runtimeVersion = Regex.Match(AssemblyVersion, @"^(\d*).(\d*).(\d*).*");
var runtimeVersionMajor = Int16.Parse(runtimeVersion.Groups[1].Value);
var runtimeVersionMinor = Int16.Parse(runtimeVersion.Groups[2].Value);
var runtimeVersionBuild = Int16.Parse(runtimeVersion.Groups[3].Value);
var runtimeVer = new Version(runtimeVersionMajor, runtimeVersionMinor, runtimeVersionBuild);
Version minimumVer;
try
{
minimumVer = new Version(minimumVersion);
}
catch
{
Debug.Console(2, "unable to parse minimum version {0}. Bypassing plugin load.", minimumVersion);
return false;
}
// Check for beta build version
if (runtimeVer.Major != 0)
{
return runtimeVer.CompareTo(minimumVer) >= 0;
}
Debug.Console(2, "Running Local Build. Bypassing Dependency Check.");
return true;
/*
var minVersion = Regex.Match(minimumVersion, @"^(\d*).(\d*).(\d*)$");
if(!minVersion.Success)
{
}
var minVersionMajor = Int16.Parse(minVersion.Groups[1].Value);
var minVersionMinor = Int16.Parse(minVersion.Groups[2].Value);
var minVersionBuild = Int16.Parse(minVersion.Groups[3].Value);
if (minVersionMajor > runtimeVersionMajor)
return false;
if (minVersionMinor > runtimeVersionMinor)
return false;
if (minVersionBuild > runtimeVersionBuild)
return false;
return true;
*/
}
static Global()
{
// Fire up CrestronDataStoreStatic
var err = CrestronDataStoreStatic.InitCrestronDataStore();
if (err != CrestronDataStore.CDS_ERROR.CDS_SUCCESS)
{
CrestronConsole.PrintLine("Error starting CrestronDataStoreStatic: {0}", err);
return;
}
}
}
public static eDevicePlatform Platform { get { return CrestronEnvironment.DevicePlatform; } }
public static Dictionary<short, EthernetAdapterInfo> EthernetAdapterInfoCollection { get; private set; }
public static LicenseManager LicenseManager { get; set; }
/// <summary>
/// The file path prefix to the folder containing configuration files
/// </summary>
public static string FilePathPrefix { get; private set; }
/// <summary>
/// The file path prefix to the applciation directory
/// </summary>
public static string ApplicationDirectoryPathPrefix
{
get
{
return Crestron.SimplSharp.CrestronIO.Directory.GetApplicationDirectory();
}
}
/// <summary>
/// Returns the directory separator character based on the running OS
/// </summary>
public static char DirectorySeparator
{
get
{
return System.IO.Path.DirectorySeparatorChar;
}
}
/// <summary>
/// Wildcarded config file name for global reference
/// </summary>
public const string ConfigFileName = "*configurationFile*.json";
/// <summary>
/// Sets the file path prefix
/// </summary>
/// <param name="prefix"></param>
public static void SetFilePathPrefix(string prefix)
{
FilePathPrefix = prefix;
}
static string _AssemblyVersion;
/// <summary>
/// Gets the Assembly Version of Essentials
/// </summary>
/// <returns>The Assembly Version at Runtime</returns>
public static string AssemblyVersion
{
get
{
return _AssemblyVersion;
}
private set
{
_AssemblyVersion = value;
}
}
/// <summary>
/// Sets the Assembly version to the version of the Essentials Library
/// </summary>
/// <param name="assemblyVersion"></param>
public static void SetAssemblyVersion(string assemblyVersion)
{
AssemblyVersion = assemblyVersion;
}
/// <summary>
/// Checks to see if the running version meets or exceed the minimum specified version. For beta versions (0.xx.yy), will always return true.
/// </summary>
/// <param name="minimumVersion">Minimum specified version in format of xx.yy.zz</param>
/// <returns>Returns true if the running version meets or exceeds the minimum specified version</returns>
public static bool IsRunningMinimumVersionOrHigher(string minimumVersion)
{
Debug.Console(2, "Comparing running version '{0}' to minimum version '{1}'", AssemblyVersion, minimumVersion);
if (String.IsNullOrEmpty(minimumVersion))
{
Debug.Console(0,"Plugin does not specify a minimum version. Loading plugin may not work as expected. Proceeding with loading plugin");
return true;
}
var runtimeVersion = Regex.Match(AssemblyVersion, @"^(\d*).(\d*).(\d*).*");
var runtimeVersionMajor = Int16.Parse(runtimeVersion.Groups[1].Value);
var runtimeVersionMinor = Int16.Parse(runtimeVersion.Groups[2].Value);
var runtimeVersionBuild = Int16.Parse(runtimeVersion.Groups[3].Value);
var runtimeVer = new Version(runtimeVersionMajor, runtimeVersionMinor, runtimeVersionBuild);
Version minimumVer;
try
{
minimumVer = new Version(minimumVersion);
}
catch
{
Debug.Console(2, "unable to parse minimum version {0}. Bypassing plugin load.", minimumVersion);
return false;
}
// Check for beta build version
if (runtimeVer.Major != 0)
{
return runtimeVer.CompareTo(minimumVer) >= 0;
}
Debug.Console(2, "Running Local Build. Bypassing Dependency Check.");
return true;
/*
var minVersion = Regex.Match(minimumVersion, @"^(\d*).(\d*).(\d*)$");
if(!minVersion.Success)
{
}
var minVersionMajor = Int16.Parse(minVersion.Groups[1].Value);
var minVersionMinor = Int16.Parse(minVersion.Groups[2].Value);
var minVersionBuild = Int16.Parse(minVersion.Groups[3].Value);
if (minVersionMajor > runtimeVersionMajor)
return false;
if (minVersionMinor > runtimeVersionMinor)
return false;
if (minVersionBuild > runtimeVersionBuild)
return false;
return true;
*/
}
static Global()
{
// Fire up CrestronDataStoreStatic
var err = CrestronDataStoreStatic.InitCrestronDataStore();
if (err != CrestronDataStore.CDS_ERROR.CDS_SUCCESS)
{
CrestronConsole.PrintLine("Error starting CrestronDataStoreStatic: {0}", err);
return;
}
}
}
}

View File

@@ -213,6 +213,7 @@
<Compile Include="Fusion\FusionRviDataClasses.cs" />
<Compile Include="Gateways\CenRfgwController.cs" />
<Compile Include="Gateways\EssentialsRfGatewayConfig.cs" />
<Compile Include="Global\EthernetAdapterInfo.cs" />
<Compile Include="Queues\ComsMessage.cs" />
<Compile Include="Queues\ProcessStringMessage.cs" />
<Compile Include="Queues\GenericQueue.cs" />

View File

@@ -24,24 +24,32 @@ namespace PepperDash.Essentials.Devices.Common.Codec
public class CodecScheduleAwareness
{
List<Meeting> _Meetings;
List<Meeting> _meetings;
public event EventHandler<MeetingEventArgs> MeetingEventChange;
public event EventHandler<EventArgs> MeetingsListHasChanged;
/// <summary>
private int _meetingWarningMinutes = 5;
public int MeetingWarningMinutes
{
get { return _meetingWarningMinutes; }
set { _meetingWarningMinutes = value; }
}
/// <summary>
/// Setter triggers MeetingsListHasChanged event
/// </summary>
public List<Meeting> Meetings
{
get
{
return _Meetings;
return _meetings;
}
set
{
_Meetings = value;
_meetings = value;
var handler = MeetingsListHasChanged;
if (handler != null)
@@ -51,13 +59,20 @@ namespace PepperDash.Essentials.Devices.Common.Codec
}
}
private CTimer ScheduleChecker;
private CTimer _scheduleChecker;
public CodecScheduleAwareness()
{
Meetings = new List<Meeting>();
ScheduleChecker = new CTimer(CheckSchedule, null, 1000, 1000);
_scheduleChecker = new CTimer(CheckSchedule, null, 1000, 1000);
}
public CodecScheduleAwareness(long pollTime)
{
Meetings = new List<Meeting>();
_scheduleChecker = new CTimer(CheckSchedule, null, pollTime, pollTime);
}
private void OnMeetingChange(eMeetingEventChangeType changeType, Meeting meeting)
@@ -74,9 +89,9 @@ namespace PepperDash.Essentials.Devices.Common.Codec
// Iterate the meeting list and check if any meeting need to do anythingk
const double meetingTimeEpsilon = 0.0001;
foreach (Meeting m in Meetings)
foreach (var m in Meetings)
{
eMeetingEventChangeType changeType = eMeetingEventChangeType.Unkown;
var changeType = eMeetingEventChangeType.Unkown;
if (m.TimeToMeetingStart.TotalMinutes <= m.MeetingWarningMinutes.TotalMinutes) // Meeting is about to start
changeType = eMeetingEventChangeType.MeetingStartWarning;
@@ -100,12 +115,17 @@ namespace PepperDash.Essentials.Devices.Common.Codec
/// </summary>
public class Meeting
{
public TimeSpan MeetingWarningMinutes = TimeSpan.FromMinutes(5);
public int MinutesBeforeMeeting;
public string Id { get; set; }
public string Organizer { get; set; }
public string Title { get; set; }
public string Agenda { get; set; }
public TimeSpan MeetingWarningMinutes
{
get { return TimeSpan.FromMinutes(MinutesBeforeMeeting); }
}
public TimeSpan TimeToMeetingStart
{
get
@@ -134,7 +154,7 @@ namespace PepperDash.Essentials.Devices.Common.Codec
{
get
{
return StartTime.AddMinutes(-5) <= DateTime.Now
return StartTime.AddMinutes(-MinutesBeforeMeeting) <= DateTime.Now
&& DateTime.Now <= EndTime; //.AddMinutes(-5);
}
}

View File

@@ -2103,6 +2103,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory Attempting to create new Cisco Codec Device");
var comm = CommFactory.CreateCommForDevice(dc);
return new VideoCodec.Cisco.CiscoSparkCodec(dc, comm);
}

View File

@@ -60,8 +60,10 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
public List<CodecActiveCallItem> ActiveCalls { get; set; }
public bool ShowSelfViewByDefault { get; protected set; }
public bool ShowSelfViewByDefault { get; protected set; }
protected bool SupportsCameraOff;
protected bool SupportsCameraAutoMode;
public bool IsReady { get; protected set; }
@@ -133,16 +135,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
{
get
{
bool value;
if (ActiveCalls != null)
{
value = ActiveCalls.Any(c => c.IsActiveCall);
}
else
{
value = false;
}
var value = ActiveCalls != null && ActiveCalls.Any(c => c.IsActiveCall);
return value;
}
}
@@ -314,8 +307,14 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
if (codec is IHasCameraAutoMode)
{
trilist.SetBool(joinMap.CameraSupportsAutoMode.JoinNumber, true);
trilist.SetBool(joinMap.CameraSupportsAutoMode.JoinNumber, SupportsCameraAutoMode);
LinkVideoCodecCameraModeToApi(codec as IHasCameraAutoMode, trilist, joinMap);
}
if (codec is IHasCameraOff)
{
trilist.SetBool(joinMap.CameraSupportsOffMode.JoinNumber, SupportsCameraOff);
LinkVideoCodecCameraOffToApi(codec as IHasCameraOff, trilist, joinMap);
}
if (codec is IHasCodecLayouts)
@@ -373,8 +372,15 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
UpdateCallStatusXSig();
};
}
}
private void LinkVideoCodecCameraOffToApi(IHasCameraOff codec, BasicTriList trilist, VideoCodecControllerJoinMap joinMap)
{
codec.CameraIsOffFeedback.LinkInputSig(trilist.BooleanInput[joinMap.CameraModeOff.JoinNumber]);
trilist.SetSigFalseAction(joinMap.CameraModeOff.JoinNumber, codec.CameraOff);
}
private void LinkVideoCodecVolumeToApi(BasicTriList trilist, VideoCodecControllerJoinMap joinMap)
{
MuteFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VolumeMuteOn.JoinNumber]);
@@ -484,41 +490,49 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
{
trilist.SetSigFalseAction(joinMap.UpdateMeetings.JoinNumber, codec.GetSchedule);
codec.CodecSchedule.MeetingsListHasChanged += (sender, args) =>
trilist.SetUShortSigAction(joinMap.MinutesBeforeMeetingStart.JoinNumber, (i) =>
{
var clearBytes = XSigHelpers.ClearOutputs();
codec.CodecSchedule.MeetingWarningMinutes = i;
});
trilist.SetString(joinMap.Schedule.JoinNumber,
Encoding.GetEncoding(XSigEncoding).GetString(clearBytes, 0, clearBytes.Length));
codec.CodecSchedule.MeetingsListHasChanged += (sender, args) => UpdateMeetingsList(codec, trilist, joinMap);
var meetingsData = UpdateMeetingsListXSig(codec.CodecSchedule.Meetings);
trilist.SetString(joinMap.Schedule.JoinNumber, meetingsData);
trilist.SetSigFalseAction(joinMap.DialMeeting.JoinNumber, () =>
codec.CodecSchedule.MeetingEventChange +=
(sender, args) =>
{
if (codec.CodecSchedule.Meetings[0].Joinable)
if (args.ChangeType == eMeetingEventChangeType.MeetingStartWarning)
{
Dial(codec.CodecSchedule.Meetings[0]);
UpdateMeetingsList(codec, trilist, joinMap);
}
});
};
}
trilist.SetUshort(joinMap.MeetingCount.JoinNumber, (ushort) codec.CodecSchedule.Meetings.Count);
};
private void UpdateMeetingsList(IHasScheduleAwareness codec, BasicTriList trilist, VideoCodecControllerJoinMap joinMap)
{
var currentTime = DateTime.Now;
var currentMeetings =
codec.CodecSchedule.Meetings.Where(m => m.StartTime >= currentTime || m.EndTime >= currentTime).ToList();
var meetingsData = UpdateMeetingsListXSig(currentMeetings);
trilist.SetString(joinMap.Schedule.JoinNumber, meetingsData);
trilist.SetSigFalseAction(joinMap.DialMeeting.JoinNumber, () =>
{
if (codec.CodecSchedule.Meetings[0].Joinable)
{
Dial(codec.CodecSchedule.Meetings[0]);
}
});
trilist.SetUshort(joinMap.MeetingCount.JoinNumber, (ushort)currentMeetings.Count);
}
private string UpdateMeetingsListXSig(List<Meeting> meetings)
{
/*const int maxCalls = 8;
const int maxStrings = 5;
const int offset = 6;
var callIndex = 0;
var digitalIndex = maxStrings*maxCalls;
*/
const int maxMeetings = 3;
const int maxDigitals = 1;
const int maxStrings = 4;
const int maxDigitals = 2;
const int maxStrings = 7;
const int offset = maxDigitals + maxStrings;
var digitalIndex = maxStrings*maxMeetings; //15
var stringIndex = 0;
@@ -528,37 +542,71 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
/*
* Digitals
* IsJoinable - 1
* IsDialable - 2
*
* Serials
* Organizer - 1
* Title - 2
* Agenda - 3
* Start Date - 3
* Start Time - 4
* End Time - 5
* End Date - 5
* End Time - 6
*/
foreach(var meeting in meetings)
{
var currentTime = DateTime.Now;
if(meeting.StartTime < currentTime && meeting.EndTime < currentTime) continue;
if (meetingIndex > maxMeetings*offset) break;
if (meetingIndex >= maxMeetings*offset)
{
Debug.Console(2, this, "Max Meetings reached");
break;}
//digitals
tokenArray[digitalIndex] = new XSigDigitalToken(digitalIndex + 1, meeting.Joinable);
tokenArray[digitalIndex + 1] = new XSigDigitalToken(digitalIndex + 2, meeting.Id != "0");
//serials
tokenArray[stringIndex] = new XSigSerialToken(stringIndex + 1, meeting.Organizer);
tokenArray[stringIndex + 1] = new XSigSerialToken(stringIndex + 2, meeting.Title);
tokenArray[stringIndex + 2] = new XSigSerialToken(stringIndex + 3, meeting.StartTime.ToString("MM/dd/yyyy h:mm"));
tokenArray[stringIndex + 3] = new XSigSerialToken(stringIndex + 4, meeting.EndTime.ToString("MM/dd/yyyy h:mm"));
tokenArray[stringIndex + 2] = new XSigSerialToken(stringIndex + 3, meeting.StartTime.ToShortDateString());
tokenArray[stringIndex + 3] = new XSigSerialToken(stringIndex + 4, meeting.StartTime.ToShortTimeString());
tokenArray[stringIndex + 4] = new XSigSerialToken(stringIndex + 5, meeting.EndTime.ToShortDateString());
tokenArray[stringIndex + 5] = new XSigSerialToken(stringIndex + 6, meeting.EndTime.ToShortTimeString());
tokenArray[stringIndex + 6] = new XSigSerialToken(stringIndex + 7, meeting.Id);
digitalIndex += maxDigitals;
meetingIndex += offset;
stringIndex += maxStrings;
}
while (meetingIndex < maxMeetings*offset)
{
Debug.Console(2, this, "Clearing unused data. Meeting Index: {0} MaxMeetings * Offset: {1}",
meetingIndex, maxMeetings*offset);
//digitals
tokenArray[digitalIndex] = new XSigDigitalToken(digitalIndex + 1, false);
tokenArray[digitalIndex + 1] = new XSigDigitalToken(digitalIndex + 2, false);
//serials
tokenArray[stringIndex] = new XSigSerialToken(stringIndex + 1, String.Empty);
tokenArray[stringIndex + 1] = new XSigSerialToken(stringIndex + 2, String.Empty);
tokenArray[stringIndex + 2] = new XSigSerialToken(stringIndex + 3, String.Empty);
tokenArray[stringIndex + 3] = new XSigSerialToken(stringIndex + 4, String.Empty);
tokenArray[stringIndex + 4] = new XSigSerialToken(stringIndex + 5, String.Empty);
tokenArray[stringIndex + 5] = new XSigSerialToken(stringIndex + 6, String.Empty);
tokenArray[stringIndex + 6] = new XSigSerialToken(stringIndex + 7, String.Empty);
digitalIndex += maxDigitals;
meetingIndex += offset;
stringIndex += maxStrings;
}
return GetXSigString(tokenArray);
}
@@ -734,6 +782,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
trilist.BooleanInput[joinMap.CameraModeManual.JoinNumber]);
}
private void LinkVideoCodecSelfviewToApi(IHasCodecSelfView codec, BasicTriList trilist,
VideoCodecControllerJoinMap joinMap)
{

View File

@@ -86,6 +86,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
public zConfiguration.Audio Audio { get; set; }
public zConfiguration.Video Video { get; set; }
public zConfiguration.Client Client { get; set; }
public zConfiguration.Camera Camera { get; set; }
public ZoomRoomConfiguration()
{
@@ -93,6 +94,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
Audio = new zConfiguration.Audio();
Video = new zConfiguration.Video();
Client = new zConfiguration.Client();
Camera = new zConfiguration.Camera();
}
}
@@ -698,9 +700,25 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
public bool OptimizeVideoSharing { get; set; }
}
public class Camera
public class Camera : NotifiableObject
{
public bool Mute { get; set; }
private bool _mute;
public bool Mute
{
get
{
return _mute;
}
set
{
if (value != _mute)
{
_mute = value;
NotifyPropertyChanged("Mute");
}
}
}
}
public class Microphone : NotifiableObject
@@ -946,8 +964,20 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
public ThirdParty ThirdParty { get; set; }
}
public static List<Meeting> GetGenericMeetingsFromBookingResult(List<BookingsListResult> bookings,
int minutesBeforeMeetingStart)
{
var rv = GetGenericMeetingsFromBookingResult(bookings);
foreach (var meeting in rv)
{
meeting.MinutesBeforeMeeting = minutesBeforeMeetingStart;
}
return rv;
}
/// <summary>
/// Extracts the necessary meeting values from the Cisco bookings response ans converts them to the generic class
/// Extracts the necessary meeting values from the Zoom bookings response and converts them to the generic class
/// </summary>
/// <param name="bookings"></param>
/// <returns></returns>

View File

@@ -20,8 +20,9 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
{
public class ZoomRoom : VideoCodecBase, IHasCodecSelfView, IHasDirectoryHistoryStack, ICommunicationMonitor,
IRouting,
IHasScheduleAwareness, IHasCodecCameras, IHasParticipants
IHasScheduleAwareness, IHasCodecCameras, IHasParticipants, IHasCameraOff, IHasCameraAutoMode
{
private const long MeetingRefreshTimer = 60000;
private const uint DefaultMeetingDurationMin = 30;
private const string Delimiter = "\x0D\x0A";
private readonly CrestronQueue<string> _receiveQueue;
@@ -38,23 +39,25 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
private int _previousVolumeLevel;
private CameraBase _selectedCamera;
private readonly ZoomRoomPropertiesConfig _props;
public ZoomRoom(DeviceConfig config, IBasicCommunication comm)
: base(config)
{
var props = JsonConvert.DeserializeObject<ZoomRoomPropertiesConfig>(config.Properties.ToString());
_props = JsonConvert.DeserializeObject<ZoomRoomPropertiesConfig>(config.Properties.ToString());
// The queue that will collect the repsonses in the order they are received
_receiveQueue = new CrestronQueue<string>(25);
_receiveQueue = new CrestronQueue<string>(1024);
// The thread responsible for dequeuing and processing the messages
_receiveThread = new Thread(o => ProcessQueue(), null) {Priority = Thread.eThreadPriority.MediumPriority};
Communication = comm;
if (props.CommunicationMonitorProperties != null)
if (_props.CommunicationMonitorProperties != null)
{
CommunicationMonitor = new GenericCommunicationMonitor(this, Communication,
props.CommunicationMonitorProperties);
_props.CommunicationMonitorProperties);
}
else
{
@@ -89,7 +92,11 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
SelfviewIsOnFeedback = new BoolFeedback(SelfViewIsOnFeedbackFunc);
CodecSchedule = new CodecScheduleAwareness();
CameraIsOffFeedback = new BoolFeedback(CameraIsOffFeedbackFunc);
CameraAutoModeIsOnFeedback = new BoolFeedback(CameraAutoModeIsOnFeedbackFunc);
CodecSchedule = new CodecScheduleAwareness(MeetingRefreshTimer);
SetUpFeedbackActions();
@@ -98,6 +105,9 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
SetUpDirectory();
Participants = new CodecParticipants();
SupportsCameraOff = _props.SupportsCameraOff;
SupportsCameraAutoMode = _props.SupportsCameraAutoMode;
}
public CommunicationGather PortGather { get; private set; }
@@ -171,6 +181,16 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
get { return () => !Configuration.Video.HideConfSelfVideo; }
}
protected Func<bool> CameraIsOffFeedbackFunc
{
get { return () => Configuration.Camera.Mute; }
}
protected Func<bool> CameraAutoModeIsOnFeedbackFunc
{
get { return () => !Configuration.Camera.Mute; }
}
protected Func<string> SelfviewPipPositionFeedbackFunc
{
get { return () => ""; }
@@ -412,6 +432,13 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
}
};
Configuration.Camera.PropertyChanged += (o, a) =>
{
if (a.PropertyName != "Mute") return;
CameraIsOffFeedback.FireUpdate();
};
Status.Call.Sharing.PropertyChanged += (o, a) =>
{
if (a.PropertyName == "State")
@@ -624,7 +651,11 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
// zCommand
_syncState.AddQueryToQueue("zCommand Phonebook List Offset: 0 Limit: 512");
if (!_props.DisablePhonebookAutoDownload)
{
_syncState.AddQueryToQueue("zCommand Phonebook List Offset: 0 Limit: 512");
}
_syncState.AddQueryToQueue("zCommand Bookings List");
@@ -843,7 +874,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
// this is a single participant event notification
var participant =
JsonConvert.DeserializeObject<zCommand.ListParticipant>(responseObj.ToString());
JsonConvert.DeserializeObject<zCommand.ListParticipant>(
responseObj.ToString());
if (participant != null)
{
@@ -947,18 +979,15 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
if (codecBookings != null && codecBookings.Count > 0)
{
CodecSchedule.Meetings = zCommand.GetGenericMeetingsFromBookingResult(codecBookings);
CodecSchedule.Meetings = zCommand.GetGenericMeetingsFromBookingResult(
codecBookings, CodecSchedule.MeetingWarningMinutes);
}
break;
}
case "bookings":
case "bookings updated":
{
// Bookings have been updated, trigger a query to retreive the new bookings
if (responseObj["Updated"] != null)
{
GetBookings();
}
GetBookings();
break;
}
@@ -1231,9 +1260,21 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
if (ActiveCalls.Count == 0)
{
if (callStatus == zStatus.eCallStatus.CONNECTING_MEETING)
if (callStatus == zStatus.eCallStatus.CONNECTING_MEETING || callStatus == zStatus.eCallStatus.IN_MEETING )
{
var newCall = new CodecActiveCallItem {Status = eCodecCallStatus.Connecting};
var newStatus = eCodecCallStatus.Unknown;
switch (callStatus)
{
case zStatus.eCallStatus.CONNECTING_MEETING:
newStatus = eCodecCallStatus.Connecting;
break;
case zStatus.eCallStatus.IN_MEETING:
newStatus = eCodecCallStatus.Connected;
break;
}
var newCall = new CodecActiveCallItem {Status = newStatus};
ActiveCalls.Add(newCall);
@@ -1342,7 +1383,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
}
/// <summary>
/// Increments the voluem
/// </summary>
@@ -1552,6 +1592,39 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
public CodecParticipants Participants { get; private set; }
#endregion
#region Implementation of IHasCameraOff
public BoolFeedback CameraIsOffFeedback { get; private set; }
public void CameraOff()
{
SendText("zConfiguration Call Camera Mute: On");
}
#endregion
#region Implementation of IHasCameraAutoMode
//Zoom doesn't support camera auto modes. Setting this to just unmute video
public void CameraAutoModeOn()
{
throw new NotImplementedException("Zoom Room Doesn't support camera auto mode");
}
//Zoom doesn't support camera auto modes. Setting this to just unmute video
public void CameraAutoModeOff()
{
SendText("zConfiguration Call Camera Mute: Off");
}
public void CameraAutoModeToggle()
{
throw new NotImplementedException("Zoom Room doesn't support camera auto mode");
}
public BoolFeedback CameraAutoModeIsOnFeedback { get; private set; }
#endregion
}
/// <summary>

View File

@@ -79,8 +79,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
void StartContinueTimer()
{
if(ContinueTimer == null)
ContinueTimer = new CTimer((o) => SendContinueAction(LastAction), ContinueTime);
if (ContinueTimer == null)
ContinueTimer = new CTimer((o) => SendContinueAction(LastAction), null, ContinueTime, ContinueTime);
}
void SendContinueAction(eZoomRoomCameraAction action)

View File

@@ -12,5 +12,9 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
public class ZoomRoomPropertiesConfig
{
public CommunicationMonitorConfig CommunicationMonitorProperties { get; set; }
public bool DisablePhonebookAutoDownload { get; set; }
public bool SupportsCameraAutoMode { get; set; }
public bool SupportsCameraOff { get; set; }
}
}

View File

@@ -1,3 +1,3 @@
<packages>
<package id="PepperDashCore" version="1.0.42" targetFramework="net35" allowedVersions="[1.0,1.1)"/>
<package id="PepperDashCore" version="1.0.43-alpha-170" targetFramework="net35" allowedVersions="[1.0,1.1)"/>
</packages>