got it building...

This commit is contained in:
Andrew Welker
2020-11-19 14:16:34 -07:00
parent ef215e8b16
commit f3ddce99d5
21 changed files with 1260 additions and 766 deletions

View File

@@ -12,10 +12,10 @@ using PepperDash.Core;
using PepperDash.Essentials.Core; using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.Fusion;
using PepperDash.Essentials.Core.Rooms.Config; using PepperDash.Essentials.Core.Rooms.Config;
using PepperDash.Essentials.Devices.Common;
using PepperDash.Essentials.DM; using PepperDash.Essentials.DM;
using PepperDash.Essentials.Fusion;
using PepperDash.Essentials.Room.Config;
using Newtonsoft.Json; using Newtonsoft.Json;
using PepperDash.Essentials.Core.DeviceTypeInterfaces; using PepperDash.Essentials.Core.DeviceTypeInterfaces;
@@ -429,18 +429,15 @@ namespace PepperDash.Essentials
foreach (var roomConfig in ConfigReader.ConfigObject.Rooms) foreach (var roomConfig in ConfigReader.ConfigObject.Rooms)
{ {
var room = EssentialsRoomConfigHelper.GetRoomObject(roomConfig) as EssentialsRoomBase; var room = EssentialsRoomConfigHelper.GetRoomObject(roomConfig) as EssentialsRoomBase;
if (room == null) if (room != null)
{ {
Debug.Console(0, Debug.ErrorLogLevel.Notice, "WARNING: Cannot create room from config, key '{0}'", roomConfig.Key);' if (room is EssentialsHuddleSpaceRoom)
return; {
} DeviceManager.AddDevice(room);
var huddleRoom = room as EssentialsHuddleSpaceRoom; Debug.Console(0, Debug.ErrorLogLevel.Notice, "Room is EssentialsHuddleSpaceRoom, attempting to add to DeviceManager with Fusion");
var vtcRoom = room as EssentialsHuddleVtc1Room; DeviceManager.AddDevice(new Core.Fusion.EssentialsHuddleSpaceFusionSystemControllerBase((EssentialsHuddleSpaceRoom)room, 0xf1));
if (huddleRoom != null)
{
DeviceManager.AddDevice(huddleRoom);
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Mobile Control Bridge..."); Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Mobile Control Bridge...");
@@ -450,11 +447,8 @@ namespace PepperDash.Essentials
{ {
DeviceManager.AddDevice(room); DeviceManager.AddDevice(room);
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Mobile Control Bridge..."); Debug.Console(0, Debug.ErrorLogLevel.Notice, "Room is EssentialsHuddleVtc1Room, attempting to add to DeviceManager with Fusion");
// Mobile Control bridge DeviceManager.AddDevice(new EssentialsHuddleVtc1FusionController((EssentialsHuddleVtc1Room)room, 0xf1));
var bridge = new MobileControlEssentialsHuddleSpaceRoomBridge(huddleRoom);
AddBridgePostActivationHelper(bridge); // Lets things happen later when all devices are present
DeviceManager.AddDevice(bridge);
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Mobile Control Bridge..."); Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Mobile Control Bridge...");
@@ -466,15 +460,6 @@ namespace PepperDash.Essentials
DeviceManager.AddDevice(room); DeviceManager.AddDevice(room);
} }
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Room is EssentialsHuddleVtc1Room, attempting to add to DeviceManager with Fusion");
DeviceManager.AddDevice(new EssentialsHuddleVtc1FusionController(vtcRoom, 0xf1));
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Mobile Control Bridge...");
// Mobile Control bridge
var bridge = new MobileControlEssentialsHuddleSpaceRoomBridge(room);
AddBridgePostActivationHelper(bridge); // Lets things happen later when all devices are present
DeviceManager.AddDevice(bridge);
continue;
} }
else else
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Notice: Cannot create room from config, key '{0}' - Is this intentional? This may be a valid configuration.", roomConfig.Key); Debug.Console(0, Debug.ErrorLogLevel.Notice, "Notice: Cannot create room from config, key '{0}' - Is this intentional? This may be a valid configuration.", roomConfig.Key);

View File

@@ -0,0 +1,574 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.CrestronThread;
using Crestron.SimplSharpPro.Diagnostics;
using Crestron.SimplSharp.Reflection;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.Rooms.Config;
using PepperDash.Essentials.DM;
using PepperDash.Essentials.Fusion;
using PepperDash.Essentials.Room.Config;
using Newtonsoft.Json;
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
using EssentialsRoomConfigHelper = PepperDash.Essentials.Core.Rooms.Config.EssentialsRoomConfigHelper;
namespace PepperDash.Essentials
{
public class ControlSystem : CrestronControlSystem
{
HttpLogoServer LogoServer;
private CTimer _startTimer;
private const long StartupTime = 500;
public ControlSystem()
: base()
{
Thread.MaxNumberOfUserThreads = 400;
Global.ControlSystem = this;
DeviceManager.Initialize(this);
SystemMonitor.ProgramInitialization.ProgramInitializationUnderUserControl = true;
}
/// <summary>
/// Entry point for the program
/// </summary>
public override void InitializeSystem()
{
_startTimer = new CTimer(StartSystem,StartupTime);
}
private void StartSystem(object obj)
{
DeterminePlatform();
if (Debug.DoNotLoadOnNextBoot)
{
CrestronConsole.AddNewConsoleCommand(s => GoWithLoad(), "go", "Loads configuration file",
ConsoleAccessLevelEnum.AccessOperator);
}
CrestronConsole.AddNewConsoleCommand(PluginLoader.ReportAssemblyVersions, "reportversions", "Reports the versions of the loaded assemblies", ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(PepperDash.Essentials.Core.DeviceFactory.GetDeviceFactoryTypes, "gettypes", "Gets the device types that can be built. Accepts a filter string.", ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(BridgeHelper.PrintJoinMap, "getjoinmap", "map(s) for bridge or device on bridge [brKey [devKey]]", ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(s =>
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "CONSOLE MESSAGE: {0}", s);
}, "appdebugmessage", "Writes message to log", ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(s =>
{
foreach (var tl in TieLineCollection.Default)
CrestronConsole.ConsoleCommandResponse(" {0}\r", tl);
},
"listtielines", "Prints out all tie lines", ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(s =>
{
CrestronConsole.ConsoleCommandResponse
("Current running configuration. This is the merged system and template configuration");
CrestronConsole.ConsoleCommandResponse(Newtonsoft.Json.JsonConvert.SerializeObject
(ConfigReader.ConfigObject, Newtonsoft.Json.Formatting.Indented));
}, "showconfig", "Shows the current running merged config", ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(s =>
{
CrestronConsole.ConsoleCommandResponse("This system can be found at the following URLs:\r" +
"System URL: {0}\r" +
"Template URL: {1}", ConfigReader.ConfigObject.SystemUrl, ConfigReader.ConfigObject.TemplateUrl);
}, "portalinfo", "Shows portal URLS from configuration", ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(DeviceManager.GetRoutingPorts,
"getroutingports", "Reports all routing ports, if any. Requires a device key", ConsoleAccessLevelEnum.AccessOperator);
if (!Debug.DoNotLoadOnNextBoot)
{
GoWithLoad();
return;
}
SystemMonitor.ProgramInitialization.ProgramInitializationComplete = true;
}
/// <summary>
/// Determines if the program is running on a processor (appliance) or server (VC-4).
///
/// Sets Global.FilePathPrefix and Global.ApplicationDirectoryPathPrefix based on platform
/// </summary>
public void DeterminePlatform()
{
try
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Determining Platform....");
string filePathPrefix;
var dirSeparator = Global.DirectorySeparator;
string directoryPrefix;
directoryPrefix = Crestron.SimplSharp.CrestronIO.Directory.GetApplicationRootDirectory();
var fullVersion = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyInformationalVersionAttribute), false);
AssemblyInformationalVersionAttribute fullVersionAtt = fullVersion[0] as AssemblyInformationalVersionAttribute;
Global.SetAssemblyVersion(fullVersionAtt.InformationalVersion);
if (CrestronEnvironment.DevicePlatform != eDevicePlatform.Server) // Handles 3-series running Windows CE OS
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Starting Essentials v{0} on 3-series Appliance", Global.AssemblyVersion);
// Check if User/ProgramX exists
if (Directory.Exists(Global.ApplicationDirectoryPathPrefix + dirSeparator + "User"
+ dirSeparator + string.Format("program{0}", InitialParametersClass.ApplicationNumber)))
{
Debug.Console(0, @"User/program{0} directory found", InitialParametersClass.ApplicationNumber);
filePathPrefix = directoryPrefix + dirSeparator + "User"
+ dirSeparator + string.Format("program{0}", InitialParametersClass.ApplicationNumber) + dirSeparator;
}
// Check if Nvram/Programx exists
else if (Directory.Exists(directoryPrefix + dirSeparator + "Nvram"
+ dirSeparator + string.Format("program{0}", InitialParametersClass.ApplicationNumber)))
{
Debug.Console(0, @"Nvram/program{0} directory found", InitialParametersClass.ApplicationNumber);
filePathPrefix = directoryPrefix + dirSeparator + "Nvram"
+ dirSeparator + string.Format("program{0}", InitialParametersClass.ApplicationNumber) + dirSeparator;
}
// If neither exists, set path to User/ProgramX
else
{
Debug.Console(0, @"No previous directory found. Using User/program{0}", InitialParametersClass.ApplicationNumber);
filePathPrefix = directoryPrefix + dirSeparator + "User"
+ dirSeparator + string.Format("program{0}", InitialParametersClass.ApplicationNumber) + dirSeparator;
}
}
else // Handles Linux OS (Virtual Control)
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Starting Essentials v{0} on Virtual Control Server", Global.AssemblyVersion);
// Set path to User/
filePathPrefix = directoryPrefix + dirSeparator + "User" + dirSeparator;
}
Global.SetFilePathPrefix(filePathPrefix);
}
catch (Exception e)
{
Debug.Console(0, "Unable to Determine Platform due to Exception: {0}", e.Message);
}
}
/// <summary>
/// Begins the process of loading resources including plugins and configuration data
/// </summary>
public void GoWithLoad()
{
try
{
Debug.SetDoNotLoadOnNextBoot(false);
PluginLoader.AddProgramAssemblies();
new Core.DeviceFactory();
new Devices.Common.DeviceFactory();
new DM.DeviceFactory();
new DeviceFactory();
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Starting Essentials load from configuration");
var filesReady = SetupFilesystem();
if (filesReady)
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Checking for plugins");
PluginLoader.LoadPlugins();
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Folder structure verified. Loading config...");
if (!ConfigReader.LoadConfig2())
{
Debug.Console(0, Debug.ErrorLogLevel.Error, "Essentials Load complete with errors");
return;
}
Load();
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Essentials load complete\r\n" +
"-------------------------------------------------------------");
}
else
{
Debug.Console(0,
@"----------------------------------------------
------------------------------------------------
------------------------------------------------
Essentials file structure setup completed.
Please load config, sgd and ir files and
restart program.
------------------------------------------------
------------------------------------------------
------------------------------------------------");
}
}
catch (Exception e)
{
Debug.Console(0, "FATAL INITIALIZE ERROR. System is in an inconsistent state:\r\n{0}", e);
}
finally
{
// Notify the OS that the program intitialization has completed
SystemMonitor.ProgramInitialization.ProgramInitializationComplete = true;
}
}
/// <summary>
/// Verifies filesystem is set up. IR, SGD, and programX folders
/// </summary>
bool SetupFilesystem()
{
Debug.Console(0, "Verifying and/or creating folder structure");
var configDir = Global.FilePathPrefix;
var configExists = Directory.Exists(configDir);
if (!configExists)
Directory.Create(configDir);
var irDir = Global.FilePathPrefix + "ir";
if (!Directory.Exists(irDir))
Directory.Create(irDir);
var sgdDir = Global.FilePathPrefix + "sgd";
if (!Directory.Exists(sgdDir))
Directory.Create(sgdDir);
var pluginDir = Global.FilePathPrefix + "plugins";
if (!Directory.Exists(pluginDir))
Directory.Create(pluginDir);
return configExists;
}
/// <summary>
///
/// </summary>
public void TearDown()
{
Debug.Console(0, "Tearing down existing system");
DeviceManager.DeactivateAll();
TieLineCollection.Default.Clear();
foreach (var key in DeviceManager.GetDevices())
DeviceManager.RemoveDevice(key);
Debug.Console(0, "Tear down COMPLETE");
}
/// <summary>
///
/// </summary>
void Load()
{
LoadDevices();
LoadTieLines();
LoadRooms();
LoadLogoServer();
DeviceManager.ActivateAll();
var mobileControl = GetMobileControlDevice();
if (mobileControl == null) return;
mobileControl.LinkSystemMonitorToAppServer();
}
/// <summary>
/// Reads all devices from config and adds them to DeviceManager
/// </summary>
public void LoadDevices()
{
// Build the processor wrapper class
DeviceManager.AddDevice(new PepperDash.Essentials.Core.Devices.CrestronProcessor("processor"));
// Add global System Monitor device
if (CrestronEnvironment.DevicePlatform == eDevicePlatform.Appliance)
{
DeviceManager.AddDevice(
new PepperDash.Essentials.Core.Monitoring.SystemMonitorController("systemMonitor"));
}
foreach (var devConf in ConfigReader.ConfigObject.Devices)
{
try
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Creating device '{0}', type '{1}'", devConf.Key, devConf.Type);
// Skip this to prevent unnecessary warnings
if (devConf.Key == "processor")
{
if (devConf.Type.ToLower() != Global.ControlSystem.ControllerPrompt.ToLower())
Debug.Console(0,
"WARNING: Config file defines processor type as '{0}' but actual processor is '{1}'! Some ports may not be available",
devConf.Type.ToUpper(), Global.ControlSystem.ControllerPrompt.ToUpper());
// Check if the processor is a DMPS model
if (this.ControllerPrompt.IndexOf("dmps", StringComparison.OrdinalIgnoreCase) > -1)
{
Debug.Console(2, "Adding DmpsRoutingController for {0} to Device Manager.", this.ControllerPrompt);
var propertiesConfig = JsonConvert.DeserializeObject<DM.Config.DmpsRoutingPropertiesConfig>(devConf.Properties.ToString());
if(propertiesConfig == null)
propertiesConfig = new DM.Config.DmpsRoutingPropertiesConfig();
var dmpsRoutingController = DmpsRoutingController.GetDmpsRoutingController("processor-avRouting", this.ControllerPrompt, propertiesConfig);
DeviceManager.AddDevice(dmpsRoutingController);
}
else if (this.ControllerPrompt.IndexOf("mpc3", StringComparison.OrdinalIgnoreCase) > -1)
{
Debug.Console(2, "MPC3 processor type detected. Adding Mpc3TouchpanelController.");
var butToken = devConf.Properties["buttons"];
if (butToken != null)
{
var buttons = butToken.ToObject<Dictionary<string, Essentials.Core.Touchpanels.KeypadButton>>();
var tpController = new Essentials.Core.Touchpanels.Mpc3TouchpanelController(devConf.Key, devConf.Name, Global.ControlSystem, buttons);
DeviceManager.AddDevice(tpController);
}
else
{
Debug.Console(0, Debug.ErrorLogLevel.Error, "Error: Unable to deserialize buttons collection for device: {0}", devConf.Key);
}
}
else
{
Debug.Console(2, "************Processor is not DMPS type***************");
}
continue;
}
// Try local factories first
IKeyed newDev = null;
if (newDev == null)
newDev = PepperDash.Essentials.Core.DeviceFactory.GetDevice(devConf);
if (newDev != null)
DeviceManager.AddDevice(newDev);
else
Debug.Console(0, Debug.ErrorLogLevel.Notice, "ERROR: Cannot load unknown device type '{0}', key '{1}'.", devConf.Type, devConf.Key);
}
catch (Exception e)
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "ERROR: Creating device {0}. Skipping device. \r{1}", devConf.Key, e);
}
}
Debug.Console(0, Debug.ErrorLogLevel.Notice, "All Devices Loaded.");
}
/// <summary>
/// Helper method to load tie lines. This should run after devices have loaded
/// </summary>
public void LoadTieLines()
{
// In the future, we can't necessarily just clear here because devices
// might be making their own internal sources/tie lines
var tlc = TieLineCollection.Default;
//tlc.Clear();
if (ConfigReader.ConfigObject.TieLines == null)
{
return;
}
foreach (var tieLineConfig in ConfigReader.ConfigObject.TieLines)
{
var newTL = tieLineConfig.GetTieLine();
if (newTL != null)
tlc.Add(newTL);
}
Debug.Console(0, Debug.ErrorLogLevel.Notice, "All Tie Lines Loaded.");
}
/// <summary>
/// Reads all rooms from config and adds them to DeviceManager
/// </summary>
public void LoadRooms()
{
if (ConfigReader.ConfigObject.Rooms == null)
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Notice: Configuration contains no rooms - Is this intentional? This may be a valid configuration.");
return;
}
foreach (var roomConfig in ConfigReader.ConfigObject.Rooms)
{
var room = EssentialsRoomConfigHelper.GetRoomObject(roomConfig) as EssentialsRoomBase;
if (room == null)
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "WARNING: Cannot create room from config, key '{0}'", roomConfig.Key);'
return;
}
var huddleRoom = room as EssentialsHuddleSpaceRoom;
var vtcRoom = room as EssentialsHuddleVtc1Room;
if (huddleRoom != null)
{
DeviceManager.AddDevice(huddleRoom);
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Mobile Control Bridge...");
CreateMobileControlBridge(room);
}
else if (room is EssentialsHuddleVtc1Room)
{
DeviceManager.AddDevice(room);
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Mobile Control Bridge...");
// Mobile Control bridge
var bridge = new MobileControlEssentialsHuddleSpaceRoomBridge(huddleRoom);
AddBridgePostActivationHelper(bridge); // Lets things happen later when all devices are present
DeviceManager.AddDevice(bridge);
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Mobile Control Bridge...");
CreateMobileControlBridge(room);
}
else
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Room is NOT EssentialsRoom, attempting to add to DeviceManager w/o Fusion");
DeviceManager.AddDevice(room);
}
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Room is EssentialsHuddleVtc1Room, attempting to add to DeviceManager with Fusion");
DeviceManager.AddDevice(new EssentialsHuddleVtc1FusionController(vtcRoom, 0xf1));
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Mobile Control Bridge...");
// Mobile Control bridge
var bridge = new MobileControlEssentialsHuddleSpaceRoomBridge(room);
AddBridgePostActivationHelper(bridge); // Lets things happen later when all devices are present
DeviceManager.AddDevice(bridge);
continue;
}
else
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Notice: Cannot create room from config, key '{0}' - Is this intentional? This may be a valid configuration.", roomConfig.Key);
}
Debug.Console(0, Debug.ErrorLogLevel.Notice, "All Rooms Loaded.");
}
private static void CreateMobileControlBridge(EssentialsRoomBase room)
{
var mobileControl = GetMobileControlDevice();
if (mobileControl == null) return;
mobileControl.CreateMobileControlRoomBridge(room, mobileControl);
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Mobile Control Bridge Added...");
}
private static IMobileControl GetMobileControlDevice()
{
var mobileControlList = DeviceManager.AllDevices.OfType<IMobileControl>().ToList();
if (mobileControlList.Count > 1)
{
Debug.Console(0, Debug.ErrorLogLevel.Warning,
"Multiple instances of Mobile Control Server found.");
return null;
}
if (mobileControlList.Count > 0)
{
return mobileControlList[0];
}
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Mobile Control not enabled for this system");
return null;
}
/// <summary>
/// Fires up a logo server if not already running
/// </summary>
void LoadLogoServer()
{
if (ConfigReader.ConfigObject.Rooms == null)
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "No rooms configured. Bypassing Logo server startup.");
return;
}
if (
!ConfigReader.ConfigObject.Rooms.Any(
CheckRoomConfig))
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "No rooms configured to use system Logo server. Bypassing Logo server startup");
return;
}
try
{
LogoServer = new HttpLogoServer(8080, Global.DirectorySeparator + "html" + Global.DirectorySeparator + "logo");
}
catch (Exception)
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "NOTICE: Logo server cannot be started. Likely already running in another program");
}
}
private bool CheckRoomConfig(DeviceConfig c)
{
string logoDark = null;
string logoLight = null;
string logo = null;
if (c.Properties["logoDark"] != null)
{
logoDark = c.Properties["logoDark"].Value<string>("type");
}
if (c.Properties["logoLight"] != null)
{
logoLight = c.Properties["logoLight"].Value<string>("type");
}
if (c.Properties["logo"] != null)
{
logo = c.Properties["logo"].Value<string>("type");
}
return ((logoDark != null && logoDark == "system") ||
(logoLight != null && logoLight == "system") || (logo != null && logo == "system"));
}
}
}

View File

@@ -11,7 +11,7 @@ using PepperDash.Essentials.Core.Routing;
namespace PepperDash.Essentials namespace PepperDash.Essentials
{ {
public class Amplifier : EssentialsDevice, IRoutingSinkNoSwitching public class Amplifier : EssentialsDevice, IRoutingSink
{ {
public event SourceInfoChangeHandler CurrentSourceChange; public event SourceInfoChangeHandler CurrentSourceChange;

View File

@@ -303,7 +303,7 @@ namespace PepperDash.Essentials.Fusion
return; return;
} }
var defaultDisplay = essentialsHuddleVtc1Room.DefaultDisplay as DisplayBase; var defaultDisplay = essentialsHuddleVtc1Room.DefaultDisplay as TwoWayDisplayBase;
if (defaultDisplay == null) if (defaultDisplay == null)
{ {
Debug.Console(1, this, "Cannot link null display to Fusion because default display is null"); Debug.Console(1, this, "Cannot link null display to Fusion because default display is null");
@@ -373,7 +373,7 @@ namespace PepperDash.Essentials.Fusion
} }
} }
protected override void MapDisplayToRoomJoins(int displayIndex, int joinOffset, DisplayBase display) protected override void MapDisplayToRoomJoins(int displayIndex, int joinOffset, TwoWayDisplayBase display)
{ {
var displayName = string.Format("Display {0} - ", displayIndex); var displayName = string.Format("Display {0} - ", displayIndex);

View File

@@ -129,23 +129,10 @@
<Compile Include="Bridges\JoinMaps\SetTopBoxControllerJoinMap.cs" /> <Compile Include="Bridges\JoinMaps\SetTopBoxControllerJoinMap.cs" />
<Compile Include="Bridges\JoinMaps\StatusSignControllerJoinMap.cs" /> <Compile Include="Bridges\JoinMaps\StatusSignControllerJoinMap.cs" />
<Compile Include="Bridges\JoinMaps\SystemMonitorJoinMap.cs" /> <Compile Include="Bridges\JoinMaps\SystemMonitorJoinMap.cs" />
<Compile Include="ControlSystem.cs" />
<Compile Include="Factory\DeviceFactory.cs" /> <Compile Include="Factory\DeviceFactory.cs" />
<Compile Include="Devices\Amplifier.cs" /> <Compile Include="Devices\Amplifier.cs" />
<Compile Include="ControlSystem.cs" />
<Compile Include="Fusion\EssentialsHuddleVtc1FusionController.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Room\Config\EssentialsDualDisplayRoomPropertiesConfig.cs" />
<Compile Include="Room\Config\EssentialsNDisplayRoomPropertiesConfig.cs" />
<Compile Include="Room\Config\DDVC01RoomPropertiesConfig.cs" />
<Compile Include="Room\Config\EssentialsPresentationPropertiesConfig.cs" />
<Compile Include="Room\Config\EssentialsHuddleRoomPropertiesConfig.cs" />
<Compile Include="Room\Config\EssentialsHuddleVtc1PropertiesConfig.cs" />
<Compile Include="Room\Config\EssentialsRoomEmergencyConfig.cs" />
<Compile Include="Room\Emergency\EsentialsRoomEmergencyContactClosure.cs" />
<None Include="Room\Types\EssentialsDualDisplayRoom.cs" />
<Compile Include="Room\Types\EssentialsHuddleVtc1Room.cs" />
<None Include="Room\Types\EssentialsNDisplayRoomBase.cs" />
<Compile Include="Room\Config\EssentialsRoomConfig.cs" />
<Compile Include="UIDrivers\Environment Drivers\EssentialsEnvironmentDriver.cs" /> <Compile Include="UIDrivers\Environment Drivers\EssentialsEnvironmentDriver.cs" />
<Compile Include="UIDrivers\Environment Drivers\EssentialsLightingDriver.cs" /> <Compile Include="UIDrivers\Environment Drivers\EssentialsLightingDriver.cs" />
<Compile Include="UIDrivers\Environment Drivers\EssentialsShadeDriver.cs" /> <Compile Include="UIDrivers\Environment Drivers\EssentialsShadeDriver.cs" />

View File

@@ -22,6 +22,11 @@ namespace PepperDash.Essentials
PresentationMode, AudioSetup PresentationMode, AudioSetup
} }
/// <summary>
/// The parent driver for this
/// </summary>
public PanelDriverBase Parent { get; private set; }
public uint StartPageVisibleJoin { get; private set; } public uint StartPageVisibleJoin { get; private set; }
@@ -214,14 +219,25 @@ namespace PepperDash.Essentials
switch (_config.HeaderStyle.ToLower()) switch (_config.HeaderStyle.ToLower())
{ {
case CrestronTouchpanelPropertiesConfig.Habanero: case CrestronTouchpanelPropertiesConfig.Habanero:
TriList.SetSigFalseAction(UIBoolJoin.HeaderRoomButtonPress, () => TriList.SetSigFalseAction(UIBoolJoin.HeaderRoomButtonPress, (() =>
PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.RoomHeaderPageVisible)); {
if (CurrentRoom.IsMobileControlEnabled)
{
Debug.Console(1, "Showing Mobile Control Header Info");
PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.RoomHeaderInfoMCPageVisible);
}
else
{
Debug.Console(1, "Showing Non Mobile Control Header Info");
PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.RoomHeaderInfoPageVisible);
}
}));
break; break;
case CrestronTouchpanelPropertiesConfig.Verbose: case CrestronTouchpanelPropertiesConfig.Verbose:
break; break;
} }
if (Config.HeaderStyle.ToLower() == CrestronTouchpanelPropertiesConfig.Habanero) if (_config.HeaderStyle.ToLower() == CrestronTouchpanelPropertiesConfig.Habanero)
{ {
TriList.SetSigFalseAction(UIBoolJoin.HeaderRoomButtonPress, () => TriList.SetSigFalseAction(UIBoolJoin.HeaderRoomButtonPress, () =>
{ {
@@ -237,7 +253,7 @@ namespace PepperDash.Essentials
} }
}); });
} }
else if (Config.HeaderStyle.ToLower() == CrestronTouchpanelPropertiesConfig.Verbose) else if (_config.HeaderStyle.ToLower() == CrestronTouchpanelPropertiesConfig.Verbose)
{ {
TriList.SetSigFalseAction(UIBoolJoin.HeaderRoomButtonPress, () => TriList.SetSigFalseAction(UIBoolJoin.HeaderRoomButtonPress, () =>
{ {
@@ -254,9 +270,9 @@ namespace PepperDash.Essentials
}); });
} }
TriList.SetBool(UIBoolJoin.DateAndTimeVisible, Config.ShowDate && Config.ShowTime); TriList.SetBool(UIBoolJoin.DateAndTimeVisible, _config.ShowDate && _config.ShowTime);
TriList.SetBool(UIBoolJoin.DateOnlyVisible, Config.ShowDate && !Config.ShowTime); TriList.SetBool(UIBoolJoin.DateOnlyVisible, _config.ShowDate && !_config.ShowTime);
TriList.SetBool(UIBoolJoin.TimeOnlyVisible, !Config.ShowDate && Config.ShowTime); TriList.SetBool(UIBoolJoin.TimeOnlyVisible, !_config.ShowDate && _config.ShowTime);
TriList.SetBool(UIBoolJoin.TopBarHabaneroDynamicVisible, true); TriList.SetBool(UIBoolJoin.TopBarHabaneroDynamicVisible, true);
TriList.BooleanInput[UIBoolJoin.ActivityFooterVisible].BoolValue = true; TriList.BooleanInput[UIBoolJoin.ActivityFooterVisible].BoolValue = true;
@@ -343,8 +359,8 @@ namespace PepperDash.Essentials
{ {
TriList.SetBool(UIBoolJoin.LogoDefaultVisible, false); TriList.SetBool(UIBoolJoin.LogoDefaultVisible, false);
TriList.SetBool(UIBoolJoin.LogoUrlVisible, true); TriList.SetBool(UIBoolJoin.LogoUrlVisible, true);
TriList.SetString(UIStringJoin.LogoUrlLightBkgnd, _CurrentRoom.LogoUrlLightBkgnd); TriList.SetString(UIStringJoin.LogoUrlLightBkgnd, _currentRoom.LogoUrlLightBkgnd);
TriList.SetString(UIStringJoin.LogoUrlDarkBkgnd, _CurrentRoom.LogoUrlDarkBkgnd); TriList.SetString(UIStringJoin.LogoUrlDarkBkgnd, _currentRoom.LogoUrlDarkBkgnd);
} }
} }
@@ -854,8 +870,8 @@ namespace PepperDash.Essentials
if (_currentRoom == room) return; if (_currentRoom == room) return;
// Disconnect current (probably never called) // Disconnect current (probably never called)
if (_CurrentRoom != null) if (_currentRoom != null)
_CurrentRoom.ConfigChanged -= room_ConfigChanged; _currentRoom.ConfigChanged -= room_ConfigChanged;
room.ConfigChanged -= room_ConfigChanged; room.ConfigChanged -= room_ConfigChanged;
room.ConfigChanged += room_ConfigChanged; room.ConfigChanged += room_ConfigChanged;
@@ -865,8 +881,8 @@ namespace PepperDash.Essentials
StartPageVisibleJoin = UIBoolJoin.StartMCPageVisible; StartPageVisibleJoin = UIBoolJoin.StartMCPageVisible;
UpdateMCJoins(room); UpdateMCJoins(room);
if (_CurrentRoom != null) if (_currentRoom != null)
_CurrentRoom.MobileControlRoomBridge.UserCodeChanged -= MobileControlRoomBridge_UserCodeChanged; _currentRoom.MobileControlRoomBridge.UserCodeChanged -= MobileControlRoomBridge_UserCodeChanged;
room.MobileControlRoomBridge.UserCodeChanged -= MobileControlRoomBridge_UserCodeChanged; room.MobileControlRoomBridge.UserCodeChanged -= MobileControlRoomBridge_UserCodeChanged;
room.MobileControlRoomBridge.UserCodeChanged += MobileControlRoomBridge_UserCodeChanged; room.MobileControlRoomBridge.UserCodeChanged += MobileControlRoomBridge_UserCodeChanged;
@@ -881,7 +897,7 @@ namespace PepperDash.Essentials
void MobileControlRoomBridge_UserCodeChanged(object sender, EventArgs e) void MobileControlRoomBridge_UserCodeChanged(object sender, EventArgs e)
{ {
UpdateMCJoins(_CurrentRoom); UpdateMCJoins(_currentRoom);
} }
void UpdateMCJoins(EssentialsHuddleSpaceRoom room) void UpdateMCJoins(EssentialsHuddleSpaceRoom room)

View File

@@ -14,6 +14,8 @@ using PepperDash.Essentials.Core.Devices.VideoCodec;
using PepperDash.Essentials.Core.SmartObjects; using PepperDash.Essentials.Core.SmartObjects;
using PepperDash.Essentials.Core.Touchpanels.Keyboards; using PepperDash.Essentials.Core.Touchpanels.Keyboards;
using PepperDash.Essentials.Core.Devices.Codec; using PepperDash.Essentials.Core.Devices.Codec;
using PepperDash.Essentials.Devices.Common.Cameras;
using PepperDash.Essentials.Devices.Common.Codec;
using PepperDash.Essentials.Devices.Common.VideoCodec; using PepperDash.Essentials.Devices.Common.VideoCodec;
using PepperDash.Essentials.Devices.Core.VideoCodec; using PepperDash.Essentials.Devices.Core.VideoCodec;

View File

@@ -46,6 +46,13 @@ namespace PepperDash.Essentials.Core.Devices.Codec
RecentCalls = new List<CallHistoryEntry> {_listEmptyEntry}; RecentCalls = new List<CallHistoryEntry> {_listEmptyEntry};
} }
public void UpdateRecentCallsList(List<CallHistoryEntry> entries)
{
RecentCalls = entries;
OnRecentCallsListChange();
}
private void OnRecentCallsListChange() private void OnRecentCallsListChange()
{ {
var handler = RecentCallsListHasChanged; var handler = RecentCallsListHasChanged;

View File

@@ -22,24 +22,32 @@ namespace PepperDash.Essentials.Core.Devices.Codec
public class CodecScheduleAwareness public class CodecScheduleAwareness
{ {
List<Meeting> _Meetings; List<Meeting> _meetings;
public event EventHandler<MeetingEventArgs> MeetingEventChange; public event EventHandler<MeetingEventArgs> MeetingEventChange;
public event EventHandler<EventArgs> MeetingsListHasChanged; public event EventHandler<EventArgs> MeetingsListHasChanged;
/// <summary> private int _meetingWarningMinutes = 5;
/// Setter triggers MeetingsListHasChanged event
/// </summary> public int MeetingWarningMinutes
{
get { return _meetingWarningMinutes; }
set { _meetingWarningMinutes = value; }
}
/// <summary>
/// Setter triggers MeetingsListHasChanged event
/// </summary>
public List<Meeting> Meetings public List<Meeting> Meetings
{ {
get get
{ {
return _Meetings; return _meetings;
} }
set set
{ {
_Meetings = value; _meetings = value;
var handler = MeetingsListHasChanged; var handler = MeetingsListHasChanged;
if (handler != null) if (handler != null)
@@ -49,13 +57,20 @@ namespace PepperDash.Essentials.Core.Devices.Codec
} }
} }
private CTimer ScheduleChecker; private CTimer _scheduleChecker;
public CodecScheduleAwareness() public CodecScheduleAwareness()
{ {
Meetings = new List<Meeting>(); 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) private void OnMeetingChange(eMeetingEventChangeType changeType, Meeting meeting)
@@ -72,9 +87,9 @@ namespace PepperDash.Essentials.Core.Devices.Codec
// Iterate the meeting list and check if any meeting need to do anythingk // Iterate the meeting list and check if any meeting need to do anythingk
const double meetingTimeEpsilon = 0.0001; 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 if (m.TimeToMeetingStart.TotalMinutes <= m.MeetingWarningMinutes.TotalMinutes) // Meeting is about to start
changeType = eMeetingEventChangeType.MeetingStartWarning; changeType = eMeetingEventChangeType.MeetingStartWarning;
@@ -98,12 +113,17 @@ namespace PepperDash.Essentials.Core.Devices.Codec
/// </summary> /// </summary>
public class Meeting public class Meeting
{ {
public TimeSpan MeetingWarningMinutes = TimeSpan.FromMinutes(5); public int MinutesBeforeMeeting;
public string Id { get; set; } public string Id { get; set; }
public string Organizer { get; set; } public string Organizer { get; set; }
public string Title { get; set; } public string Title { get; set; }
public string Agenda { get; set; } public string Agenda { get; set; }
public TimeSpan MeetingWarningMinutes
{
get { return TimeSpan.FromMinutes(MinutesBeforeMeeting); }
}
public TimeSpan TimeToMeetingStart public TimeSpan TimeToMeetingStart
{ {
get get
@@ -132,7 +152,7 @@ namespace PepperDash.Essentials.Core.Devices.Codec
{ {
get get
{ {
return StartTime.AddMinutes(-5) <= DateTime.Now return StartTime.AddMinutes(-MinutesBeforeMeeting) <= DateTime.Now
&& DateTime.Now <= EndTime; //.AddMinutes(-5); && DateTime.Now <= EndTime; //.AddMinutes(-5);
} }
} }

View File

@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
namespace PepperDash.Essentials.Devices.Common.Cameras
{
/// <summary>
/// Describes a camera with preset functionality
/// </summary>
public interface IHasCameraPresets
{
event EventHandler<EventArgs> PresetsListHasChanged;
List<CameraPreset> Presets { get; }
void PresetSelect(int preset);
void PresetStore(int preset, string description);
}
}

View File

@@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core.Presets;
namespace PepperDash.Essentials.Devices.Common.VideoCodec
{
/// <summary>
/// Interface for camera presets
/// </summary>
public interface IHasCodecRoomPresets
{
event EventHandler<EventArgs> CodecRoomPresetsListHasChanged;
List<CodecRoomPreset> NearEndPresets { get; }
List<CodecRoomPreset> FarEndRoomPresets { get; }
void CodecRoomPresetSelect(int preset);
void CodecRoomPresetStore(int preset, string description);
}
/// <summary>
/// Represents a room preset on a video codec. Typically stores camera position(s) and video routing. Can be recalled by Far End if enabled.
/// </summary>
public class CodecRoomPreset : PresetBase
{
public CodecRoomPreset(int id, string description, bool def, bool isDef)
: base(id, description, def, isDef)
{
}
}
}

View File

@@ -199,11 +199,13 @@
<Compile Include="Devices\DeviceFeedbackExtensions.cs" /> <Compile Include="Devices\DeviceFeedbackExtensions.cs" />
<Compile Include="Devices\GenericIRController.cs" /> <Compile Include="Devices\GenericIRController.cs" />
<Compile Include="Devices\IDspPreset.cs" /> <Compile Include="Devices\IDspPreset.cs" />
<Compile Include="Devices\Interfaces\IHasCameraPresets.cs" />
<Compile Include="Devices\Interfaces\IProjectorInterfaces.cs" /> <Compile Include="Devices\Interfaces\IProjectorInterfaces.cs" />
<Compile Include="Devices\PC\InRoomPc.cs" /> <Compile Include="Devices\PC\InRoomPc.cs" />
<Compile Include="Devices\PC\Laptop.cs" /> <Compile Include="Devices\PC\Laptop.cs" />
<Compile Include="Devices\Base Classes\ReconfigurableDevice.cs" /> <Compile Include="Devices\Base Classes\ReconfigurableDevice.cs" />
<Compile Include="Devices\Base Classes\VideoCodecBase.cs" /> <Compile Include="Devices\Base Classes\VideoCodecBase.cs" />
<Compile Include="Devices\RoomPresets.cs" />
<Compile Include="Devices\VolumeDeviceChangeEventArgs.cs" /> <Compile Include="Devices\VolumeDeviceChangeEventArgs.cs" />
<Compile Include="DeviceTypeInterfaces\Codec\IHasExternalSourceSwitching.cs" /> <Compile Include="DeviceTypeInterfaces\Codec\IHasExternalSourceSwitching.cs" />
<Compile Include="DeviceTypeInterfaces\Codec\IHasParticipants.cs" /> <Compile Include="DeviceTypeInterfaces\Codec\IHasParticipants.cs" />

View File

@@ -1,4 +1,4 @@
namespace PepperDash.Essentials namespace PepperDash.Essentials.Core
{ {
/// <summary> /// <summary>
/// ///

View File

@@ -5,6 +5,7 @@ using Crestron.SimplSharp;
using PepperDash.Core; using PepperDash.Core;
using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.Devices; using PepperDash.Essentials.Core.Devices;
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
using PepperDash.Essentials.Core.Rooms.Config; using PepperDash.Essentials.Core.Rooms.Config;
namespace PepperDash.Essentials.Core namespace PepperDash.Essentials.Core
@@ -20,6 +21,21 @@ namespace PepperDash.Essentials.Core
protected Func<bool> IsWarmingFeedbackFunc; protected Func<bool> IsWarmingFeedbackFunc;
protected string LastSourceKey; protected string LastSourceKey;
public string LogoUrlLightBkgnd { get; set; }
public string LogoUrlDarkBkgnd { get; set; }
/// <summary>
/// Indicates if this room is Mobile Control Enabled
/// </summary>
public bool IsMobileControlEnabled { get; private set; }
/// <summary>
/// The bridge for this room if Mobile Control is enabled
/// </summary>
public IMobileControlRoomBridge MobileControlRoomBridge { get; private set; }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@@ -222,6 +238,27 @@ namespace PepperDash.Essentials.Core
VacancyMode = eVacancyMode.None; VacancyMode = eVacancyMode.None;
} }
/// <summary>
/// If mobile control is enabled, sets the appropriate properties
/// </summary>
void SetUpMobileControl()
{
var mcBridgeKey = string.Format("mobileControlBridge-{0}", Key);
var mcBridge = DeviceManager.GetDeviceForKey(mcBridgeKey);
if (mcBridge == null)
{
Debug.Console(1, this, "*********************Mobile Control Bridge Not found for this room.");
IsMobileControlEnabled = false;
return;
}
else
{
MobileControlRoomBridge = mcBridge as IMobileControlRoomBridge;
Debug.Console(1, this, "*********************Mobile Control Bridge found and enabled for this room");
IsMobileControlEnabled = true;
}
}
private void SetupShutdownPrompt() private void SetupShutdownPrompt()
{ {
// Setup the ShutdownPromptTimer // Setup the ShutdownPromptTimer

View File

@@ -15,7 +15,7 @@ namespace PepperDash.Essentials.Devices.Common
/// <summary> /// <summary>
/// Represents and audio endpoint /// Represents and audio endpoint
/// </summary> /// </summary>
public class GenericAudioOut : EssentialsDevice, IRoutingSinkNoSwitching public class GenericAudioOut : EssentialsDevice, IRoutingSink
{ {
public event SourceInfoChangeHandler CurrentSourceChange; public event SourceInfoChangeHandler CurrentSourceChange;

View File

@@ -98,7 +98,6 @@
<Compile Include="AudioCodec\MockAC\MockAC.cs" /> <Compile Include="AudioCodec\MockAC\MockAC.cs" />
<Compile Include="AudioCodec\MockAC\MockAcPropertiesConfig.cs" /> <Compile Include="AudioCodec\MockAC\MockAcPropertiesConfig.cs" />
<Compile Include="Cameras\CameraVisca.cs" /> <Compile Include="Cameras\CameraVisca.cs" />
<Compile Include="Cameras\IHasCameraPresets.cs" />
<Compile Include="ImageProcessors\TVOneCorio.cs" /> <Compile Include="ImageProcessors\TVOneCorio.cs" />
<Compile Include="ImageProcessors\TVOneCorioPropertiesConfig.cs" /> <Compile Include="ImageProcessors\TVOneCorioPropertiesConfig.cs" />
<Compile Include="Power Controllers\Digitallogger.cs" /> <Compile Include="Power Controllers\Digitallogger.cs" />
@@ -107,7 +106,6 @@
<Compile Include="ImageProcessors\AnalogWay\AnalogWayLiveCorePropertiesConfig.cs" /> <Compile Include="ImageProcessors\AnalogWay\AnalogWayLiveCorePropertiesConfig.cs" />
<Compile Include="SoftCodec\BlueJeansPc.cs" /> <Compile Include="SoftCodec\BlueJeansPc.cs" />
<Compile Include="VideoCodec\CiscoCodec\CiscoCamera.cs" /> <Compile Include="VideoCodec\CiscoCodec\CiscoCamera.cs" />
<Compile Include="VideoCodec\CiscoCodec\RoomPresets.cs" />
<Compile Include="Display\PanasonicThDisplay.cs" /> <Compile Include="Display\PanasonicThDisplay.cs" />
<Compile Include="Display\ComTcpDisplayBase.cs" /> <Compile Include="Display\ComTcpDisplayBase.cs" />
<Compile Include="Display\AvocorVTFDisplay.cs" /> <Compile Include="Display\AvocorVTFDisplay.cs" />

View File

@@ -94,9 +94,9 @@ namespace PepperDash.Essentials.Devices.Common.SoftCodec
/// <returns></returns> /// <returns></returns>
bool DoRoute(SourceRouteListItem route) bool DoRoute(SourceRouteListItem route)
{ {
IRoutingSinkNoSwitching dest = null; IRoutingSink dest = null;
dest = DeviceManager.GetDeviceForKey(route.DestinationKey) as IRoutingSinkNoSwitching; dest = DeviceManager.GetDeviceForKey(route.DestinationKey) as IRoutingSink;
if (dest == null) if (dest == null)
{ {

View File

@@ -289,6 +289,36 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
public RoutingOutputPort HdmiOut1 { get; private set; } public RoutingOutputPort HdmiOut1 { get; private set; }
public RoutingOutputPort HdmiOut2 { get; private set; } public RoutingOutputPort HdmiOut2 { get; private set; }
public static List<CodecRoomPreset> GetGenericPresets(List<CiscoCodecStatus.RoomPreset> presets)
{
var cameraPresets = new List<CodecRoomPreset>();
if (Debug.Level > 0)
{
Debug.Console(1, "Presets List:");
}
foreach (CiscoCodecStatus.RoomPreset preset in presets)
{
try
{
var cameraPreset = new CodecRoomPreset(UInt16.Parse(preset.id), preset.Description.Value, preset.Defined.BoolValue, true);
cameraPresets.Add(cameraPreset);
if (Debug.Level > 0)
{
Debug.Console(1, "Added Preset ID: {0}, Description: {1}, IsDefined: {2}, isDefinable: {3}", cameraPreset.ID, cameraPreset.Description, cameraPreset.Defined, cameraPreset.IsDefinable);
}
}
catch (Exception e)
{
Debug.Console(2, "Unable to convert preset: {0}. Error: {1}", preset.id, e);
}
}
return cameraPresets;
}
// Constructor for IBasicCommunication // Constructor for IBasicCommunication
public CiscoSparkCodec(DeviceConfig config, IBasicCommunication comm) public CiscoSparkCodec(DeviceConfig config, IBasicCommunication comm)
@@ -457,6 +487,57 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
TieLineCollection.Default.Add(tl); TieLineCollection.Default.Add(tl);
} }
public void ConvertCiscoCallHistoryToGeneric(List<CiscoCallHistory.Entry> entries)
{
var genericEntries = new List<CodecCallHistory.CallHistoryEntry>();
foreach (CiscoCallHistory.Entry entry in entries)
{
genericEntries.Add(new CodecCallHistory.CallHistoryEntry()
{
Name = entry.DisplayName.Value,
Number = entry.CallbackNumber.Value,
StartTime = entry.LastOccurrenceStartTime.Value,
OccurrenceHistoryId = entry.LastOccurrenceHistoryId.Value,
OccurrenceType = ConvertToOccurenceTypeEnum(entry.OccurrenceType.Value)
});
}
// Check if list is empty and if so, add an item to display No Recent Calls
if (genericEntries.Count == 0)
genericEntries.Add(CallHistory.ListEmptyEntry);
CallHistory.UpdateCallHistory(genericEntries);
}
/// <summary>
/// Takes the Cisco occurence type and converts it to the matching enum
/// </summary>
/// <param name="s"></para
public eCodecOccurrenceType ConvertToOccurenceTypeEnum(string s)
{
switch (s)
{
case "Placed":
{
return eCodecOccurrenceType.Placed;
}
case "Received":
{
return eCodecOccurrenceType.Received;
}
case "NoAnswer":
{
return eCodecOccurrenceType.NoAnswer;
}
default:
return eCodecOccurrenceType.Unknown;
}
}
public void InitializeBranding(string roomKey) public void InitializeBranding(string roomKey)
{ {
Debug.Console(1, this, "Initializing Branding for room {0}", roomKey); Debug.Console(1, this, "Initializing Branding for room {0}", roomKey);
@@ -902,7 +983,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
CodecStatus.Status.RoomPreset = existingRoomPresets; CodecStatus.Status.RoomPreset = existingRoomPresets;
// Generecise the list // Generecise the list
NearEndPresets = RoomPresets.GetGenericPresets(CodecStatus.Status.RoomPreset); NearEndPresets = GetGenericPresets(CodecStatus.Status.RoomPreset);
var handler = CodecRoomPresetsListHasChanged; var handler = CodecRoomPresetsListHasChanged;
if (handler != null) if (handler != null)
@@ -976,7 +1057,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
JsonConvert.PopulateObject(response, codecCallHistory); JsonConvert.PopulateObject(response, codecCallHistory);
CallHistory.ConvertCiscoCallHistoryToGeneric(codecCallHistory.CommandResponse.CallHistoryRecentsResult.Entry); ConvertCiscoCallHistoryToGeneric(codecCallHistory.CommandResponse.CallHistoryRecentsResult.Entry);
} }
else if (response.IndexOf("\"CallHistoryDeleteEntryResult\":{") > -1 || response.IndexOf("\"CallHistoryDeleteEntryResult\": {") > -1) else if (response.IndexOf("\"CallHistoryDeleteEntryResult\":{") > -1 || response.IndexOf("\"CallHistoryDeleteEntryResult\": {") > -1)
{ {

View File

@@ -241,7 +241,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
foreach (ContactMethod m in c.ContactMethod) foreach (ContactMethod m in c.ContactMethod)
{ {
var tempContactMethod = new Essentials.Core.Devices.Codec.ContactMethod(); var tempContactMethod = new Codec.ContactMethod();
eContactMethodCallType callType = eContactMethodCallType.Unknown; eContactMethodCallType callType = eContactMethodCallType.Unknown;
if (!string.IsNullOrEmpty(m.CallType.Value)) if (!string.IsNullOrEmpty(m.CallType.Value))
@@ -300,11 +300,11 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
/// <returns></returns> /// <returns></returns>
public static CodecDirectory ConvertCiscoPhonebookToGeneric(PhonebookSearchResult result) public static CodecDirectory ConvertCiscoPhonebookToGeneric(PhonebookSearchResult result)
{ {
var directory = new Essentials.Core.Devices.Codec.CodecDirectory(); var directory = new CodecDirectory();
var folders = new List<Essentials.Core.Devices.Codec.DirectoryItem>(); var folders = new List<DirectoryItem>();
var contacts = new List<Essentials.Core.Devices.Codec.DirectoryItem>(); var contacts = new List<DirectoryItem>();
try try
{ {
@@ -371,7 +371,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
device = eContactMethodDevice.Other; device = eContactMethodDevice.Other;
} }
contact.ContactMethods.Add(new Essentials.Core.Devices.Codec.ContactMethod() contact.ContactMethods.Add(new Codec.ContactMethod()
{ {
Number = m.Number.Value, Number = m.Number.Value,
ContactMethodId = m.ContactMethodId.Value, ContactMethodId = m.ContactMethodId.Value,

View File

@@ -1,81 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core.Presets;
using PepperDash.Essentials.Devices.Common.VideoCodec.Cisco;
namespace PepperDash.Essentials.Devices.Common.VideoCodec
{
/// <summary>
/// Interface for camera presets
/// </summary>
public interface IHasCodecRoomPresets
{
event EventHandler<EventArgs> CodecRoomPresetsListHasChanged;
List<CodecRoomPreset> NearEndPresets { get; }
List<CodecRoomPreset> FarEndRoomPresets { get; }
void CodecRoomPresetSelect(int preset);
void CodecRoomPresetStore(int preset, string description);
}
public static class RoomPresets
{
/// <summary>
/// Converts Cisco RoomPresets to generic CameraPresets
/// </summary>
/// <param name="presets"></param>
/// <returns></returns>
public static List<CodecRoomPreset> GetGenericPresets(List<CiscoCodecStatus.RoomPreset> presets)
{
var cameraPresets = new List<CodecRoomPreset>();
if (Debug.Level > 0)
{
Debug.Console(1, "Presets List:");
}
foreach (CiscoCodecStatus.RoomPreset preset in presets)
{
try
{
var cameraPreset = new CodecRoomPreset(UInt16.Parse(preset.id), preset.Description.Value, preset.Defined.BoolValue, true);
cameraPresets.Add(cameraPreset);
if (Debug.Level > 0)
{
Debug.Console(1, "Added Preset ID: {0}, Description: {1}, IsDefined: {2}, isDefinable: {3}", cameraPreset.ID, cameraPreset.Description, cameraPreset.Defined, cameraPreset.IsDefinable);
}
}
catch (Exception e)
{
Debug.Console(2, "Unable to convert preset: {0}. Error: {1}", preset.id, e);
}
}
return cameraPresets;
}
}
/// <summary>
/// Represents a room preset on a video codec. Typically stores camera position(s) and video routing. Can be recalled by Far End if enabled.
/// </summary>
public class CodecRoomPreset : PresetBase
{
public CodecRoomPreset(int id, string description, bool def, bool isDef)
: base(id, description, def, isDef)
{
}
}
}