mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-15 20:54:55 +00:00
Fusion now working for EssentialsHuddleSpaceRoom types
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,164 +1,164 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
using Crestron.SimplSharpPro;
|
using Crestron.SimplSharpPro;
|
||||||
using Crestron.SimplSharpPro.CrestronThread;
|
using Crestron.SimplSharpPro.CrestronThread;
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Core.PortalSync;
|
using PepperDash.Core.PortalSync;
|
||||||
using PepperDash.Essentials.Core;
|
using PepperDash.Essentials.Core;
|
||||||
using PepperDash.Essentials.Devices.Common;
|
using PepperDash.Essentials.Devices.Common;
|
||||||
using PepperDash.Essentials.DM;
|
using PepperDash.Essentials.DM;
|
||||||
using PepperDash.Essentials.Fusion;
|
using PepperDash.Essentials.Fusion;
|
||||||
|
|
||||||
namespace PepperDash.Essentials
|
namespace PepperDash.Essentials
|
||||||
{
|
{
|
||||||
public class ControlSystem : CrestronControlSystem
|
public class ControlSystem : CrestronControlSystem
|
||||||
{
|
{
|
||||||
PepperDashPortalSyncClient PortalSync;
|
PepperDashPortalSyncClient PortalSync;
|
||||||
|
|
||||||
public ControlSystem()
|
public ControlSystem()
|
||||||
: base()
|
: base()
|
||||||
{
|
{
|
||||||
Thread.MaxNumberOfUserThreads = 400;
|
Thread.MaxNumberOfUserThreads = 400;
|
||||||
Global.ControlSystem = this;
|
Global.ControlSystem = this;
|
||||||
DeviceManager.Initialize(this);
|
DeviceManager.Initialize(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Git 'er goin'
|
/// Git 'er goin'
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public override void InitializeSystem()
|
public override void InitializeSystem()
|
||||||
{
|
{
|
||||||
//CrestronConsole.AddNewConsoleCommand(s => GoWithLoad(), "go", "Reloads configuration file",
|
//CrestronConsole.AddNewConsoleCommand(s => GoWithLoad(), "go", "Reloads configuration file",
|
||||||
// ConsoleAccessLevelEnum.AccessOperator);
|
// ConsoleAccessLevelEnum.AccessOperator);
|
||||||
//CrestronConsole.AddNewConsoleCommand(s => TearDown(), "ungo", "Reloads configuration file",
|
//CrestronConsole.AddNewConsoleCommand(s => TearDown(), "ungo", "Reloads configuration file",
|
||||||
// ConsoleAccessLevelEnum.AccessOperator);
|
// ConsoleAccessLevelEnum.AccessOperator);
|
||||||
CrestronConsole.AddNewConsoleCommand(s =>
|
CrestronConsole.AddNewConsoleCommand(s =>
|
||||||
{
|
{
|
||||||
foreach (var tl in TieLineCollection.Default)
|
foreach (var tl in TieLineCollection.Default)
|
||||||
CrestronConsole.ConsoleCommandResponse(" {0}\r", tl);
|
CrestronConsole.ConsoleCommandResponse(" {0}\r", tl);
|
||||||
},
|
},
|
||||||
"listtielines", "Prints out all tie lines", ConsoleAccessLevelEnum.AccessOperator);
|
"listtielines", "Prints out all tie lines", ConsoleAccessLevelEnum.AccessOperator);
|
||||||
|
|
||||||
GoWithLoad();
|
GoWithLoad();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Do it, yo
|
/// Do it, yo
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void GoWithLoad()
|
public void GoWithLoad()
|
||||||
{
|
{
|
||||||
var thread = new Thread(o =>
|
var thread = new Thread(o =>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
CrestronConsole.AddNewConsoleCommand(EnablePortalSync, "portalsync", "Loads Portal Sync",
|
CrestronConsole.AddNewConsoleCommand(EnablePortalSync, "portalsync", "Loads Portal Sync",
|
||||||
ConsoleAccessLevelEnum.AccessOperator);
|
ConsoleAccessLevelEnum.AccessOperator);
|
||||||
|
|
||||||
//PortalSync = new PepperDashPortalSyncClient();
|
//PortalSync = new PepperDashPortalSyncClient();
|
||||||
|
|
||||||
//Temp Cotija testing
|
//Temp Cotija testing
|
||||||
//CotijaInterfaceController CotijaInterface = new CotijaInterfaceController("WebClient1");
|
//CotijaInterfaceController CotijaInterface = new CotijaInterfaceController("WebClient1");
|
||||||
|
|
||||||
//CotijaInterface.InitializeClient("http://192.168.1.105");
|
//CotijaInterface.InitializeClient("http://192.168.1.105");
|
||||||
|
|
||||||
Debug.Console(0, "Starting Essentials load from configuration");
|
Debug.Console(0, "Starting Essentials load from configuration");
|
||||||
ConfigReader.LoadConfig2();
|
ConfigReader.LoadConfig2();
|
||||||
LoadDevices();
|
LoadDevices();
|
||||||
LoadTieLines();
|
LoadTieLines();
|
||||||
LoadRooms();
|
LoadRooms();
|
||||||
// FUSION - should go per room I believe. See CreateSystems in original Configuration.cs
|
// FUSION - should go per room I believe. See CreateSystems in original Configuration.cs
|
||||||
// ???
|
// ???
|
||||||
DeviceManager.ActivateAll();
|
DeviceManager.ActivateAll();
|
||||||
Debug.Console(0, "Essentials load complete\r" +
|
Debug.Console(0, "Essentials load complete\r" +
|
||||||
"-------------------------------------------------------------");
|
"-------------------------------------------------------------");
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Debug.Console(0, "FATAL INITIALIZE ERROR. System is in an inconsistent state:\r{0}", e);
|
Debug.Console(0, "FATAL INITIALIZE ERROR. System is in an inconsistent state:\r{0}", e);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}, null);
|
}, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void EnablePortalSync(string s)
|
public void EnablePortalSync(string s)
|
||||||
{
|
{
|
||||||
if (s.ToLower() == "enable")
|
if (s.ToLower() == "enable")
|
||||||
{
|
{
|
||||||
CrestronConsole.ConsoleCommandResponse("Portal Sync features enabled");
|
CrestronConsole.ConsoleCommandResponse("Portal Sync features enabled");
|
||||||
PortalSync = new PepperDashPortalSyncClient();
|
PortalSync = new PepperDashPortalSyncClient();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TearDown()
|
public void TearDown()
|
||||||
{
|
{
|
||||||
Debug.Console(0, "Tearing down existing system");
|
Debug.Console(0, "Tearing down existing system");
|
||||||
DeviceManager.DeactivateAll();
|
DeviceManager.DeactivateAll();
|
||||||
|
|
||||||
TieLineCollection.Default.Clear();
|
TieLineCollection.Default.Clear();
|
||||||
|
|
||||||
foreach (var key in DeviceManager.GetDevices())
|
foreach (var key in DeviceManager.GetDevices())
|
||||||
DeviceManager.RemoveDevice(key);
|
DeviceManager.RemoveDevice(key);
|
||||||
|
|
||||||
Debug.Console(0, "Tear down COMPLETE");
|
Debug.Console(0, "Tear down COMPLETE");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reads all devices from config and adds them to DeviceManager
|
/// Reads all devices from config and adds them to DeviceManager
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void LoadDevices()
|
public void LoadDevices()
|
||||||
{
|
{
|
||||||
foreach (var devConf in ConfigReader.ConfigObject.Devices)
|
foreach (var devConf in ConfigReader.ConfigObject.Devices)
|
||||||
{
|
{
|
||||||
Debug.Console(0, "Creating device '{0}'", devConf.Key);
|
Debug.Console(0, "Creating device '{0}'", devConf.Key);
|
||||||
// Skip this to prevent unnecessary warnings
|
// Skip this to prevent unnecessary warnings
|
||||||
if (devConf.Key == "processor")
|
if (devConf.Key == "processor")
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Try local factory first
|
// Try local factory first
|
||||||
var newDev = DeviceFactory.GetDevice(devConf);
|
var newDev = DeviceFactory.GetDevice(devConf);
|
||||||
|
|
||||||
// Then associated library factories
|
// Then associated library factories
|
||||||
if (newDev == null)
|
if (newDev == null)
|
||||||
newDev = PepperDash.Essentials.Devices.Common.DeviceFactory.GetDevice(devConf);
|
newDev = PepperDash.Essentials.Devices.Common.DeviceFactory.GetDevice(devConf);
|
||||||
if (newDev == null)
|
if (newDev == null)
|
||||||
newDev = PepperDash.Essentials.DM.DeviceFactory.GetDevice(devConf);
|
newDev = PepperDash.Essentials.DM.DeviceFactory.GetDevice(devConf);
|
||||||
if (newDev == null)
|
if (newDev == null)
|
||||||
newDev = PepperDash.Essentials.Devices.Displays.DisplayDeviceFactory.GetDevice(devConf);
|
newDev = PepperDash.Essentials.Devices.Displays.DisplayDeviceFactory.GetDevice(devConf);
|
||||||
|
|
||||||
if (newDev != null)
|
if (newDev != null)
|
||||||
DeviceManager.AddDevice(newDev);
|
DeviceManager.AddDevice(newDev);
|
||||||
else
|
else
|
||||||
Debug.Console(0, "WARNING: Cannot load unknown device type '{0}', key '{1}'.", devConf.Type, devConf.Key);
|
Debug.Console(0, "WARNING: Cannot load unknown device type '{0}', key '{1}'.", devConf.Type, devConf.Key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Helper method to load tie lines. This should run after devices have loaded
|
/// Helper method to load tie lines. This should run after devices have loaded
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void LoadTieLines()
|
public void LoadTieLines()
|
||||||
{
|
{
|
||||||
// Make this reusable by clearing the TieLineCollection
|
// Make this reusable by clearing the TieLineCollection
|
||||||
|
|
||||||
var tlc = TieLineCollection.Default;
|
var tlc = TieLineCollection.Default;
|
||||||
tlc.Clear();
|
tlc.Clear();
|
||||||
foreach (var tieLineConfig in ConfigReader.ConfigObject.TieLines)
|
foreach (var tieLineConfig in ConfigReader.ConfigObject.TieLines)
|
||||||
{
|
{
|
||||||
var newTL = tieLineConfig.GetTieLine();
|
var newTL = tieLineConfig.GetTieLine();
|
||||||
if (newTL != null)
|
if (newTL != null)
|
||||||
tlc.Add(newTL);
|
tlc.Add(newTL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reads all rooms from config and adds them to DeviceManager
|
/// Reads all rooms from config and adds them to DeviceManager
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void LoadRooms()
|
public void LoadRooms()
|
||||||
{
|
{
|
||||||
foreach (var roomConfig in ConfigReader.ConfigObject.Rooms)
|
foreach (var roomConfig in ConfigReader.ConfigObject.Rooms)
|
||||||
{
|
{
|
||||||
var room = roomConfig.GetRoomObject();
|
var room = roomConfig.GetRoomObject();
|
||||||
if (room != null)
|
if (room != null)
|
||||||
{
|
{
|
||||||
if (room is EssentialsHuddleSpaceRoom)
|
if (room is EssentialsHuddleSpaceRoom)
|
||||||
{
|
{
|
||||||
@@ -169,15 +169,15 @@ namespace PepperDash.Essentials
|
|||||||
{
|
{
|
||||||
Debug.Console(1, "Room is NOT EssentialsHuddleSpaceRoom, attempting to add to DeviceManager w/o Fusion");
|
Debug.Console(1, "Room is NOT EssentialsHuddleSpaceRoom, attempting to add to DeviceManager w/o Fusion");
|
||||||
DeviceManager.AddDevice(room);
|
DeviceManager.AddDevice(room);
|
||||||
}
|
}
|
||||||
|
|
||||||
#warning Add Fusion connector to room factory?
|
#warning Add Fusion connector to room factory?
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Debug.Console(0, "WARNING: Cannot create room from config, key '{0}'", roomConfig.Key);
|
Debug.Console(0, "WARNING: Cannot create room from config, key '{0}'", roomConfig.Key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Reference in New Issue
Block a user