mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-16 13:15:03 +00:00
update mobileControl retrieval method
remove commented out MC stuff
This commit is contained in:
@@ -290,33 +290,14 @@ namespace PepperDash.Essentials
|
|||||||
|
|
||||||
DeviceManager.ActivateAll();
|
DeviceManager.ActivateAll();
|
||||||
|
|
||||||
var mobileControl = DeviceManager.GetDeviceForKey("appServer") as IMobileControl;
|
var mobileControl = GetMobileControlDevice();
|
||||||
|
|
||||||
if (mobileControl == null) return;
|
if (mobileControl == null) return;
|
||||||
|
|
||||||
mobileControl.LinkSystemMonitorToAppServer();
|
mobileControl.LinkSystemMonitorToAppServer();
|
||||||
//LinkSystemMonitorToAppServer();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//void LinkSystemMonitorToAppServer()
|
|
||||||
//{
|
|
||||||
// var sysMon = DeviceManager.GetDeviceForKey("systemMonitor") as PepperDash.Essentials.Core.Monitoring.SystemMonitorController;
|
|
||||||
|
|
||||||
// var appServer = DeviceManager.GetDeviceForKey("appServer") as MobileControlSystemController;
|
|
||||||
|
|
||||||
|
|
||||||
// if (sysMon != null && appServer != null)
|
|
||||||
// {
|
|
||||||
// var key = sysMon.Key + "-" + appServer.Key;
|
|
||||||
// var messenger = new PepperDash.Essentials.AppServer.Messengers.SystemMonitorMessenger
|
|
||||||
// (key, sysMon, "/device/systemMonitor");
|
|
||||||
|
|
||||||
// messenger.RegisterWithAppServer(appServer);
|
|
||||||
|
|
||||||
// DeviceManager.AddDevice(messenger);
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reads all devices from config and adds them to DeviceManager
|
/// Reads all devices from config and adds them to DeviceManager
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -504,7 +485,7 @@ namespace PepperDash.Essentials
|
|||||||
|
|
||||||
private static void CreateMobileControlBridge(EssentialsRoomBase room)
|
private static void CreateMobileControlBridge(EssentialsRoomBase room)
|
||||||
{
|
{
|
||||||
var mobileControl = DeviceManager.GetDeviceForKey("appServer") as IMobileControl;
|
var mobileControl = GetMobileControlDevice();
|
||||||
|
|
||||||
if (mobileControl == null) return;
|
if (mobileControl == null) return;
|
||||||
|
|
||||||
@@ -513,6 +494,26 @@ namespace PepperDash.Essentials
|
|||||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Mobile Control Bridge Added...");
|
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Mobile Control Bridge Added...");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static IMobileControl GetMobileControlDevice()
|
||||||
|
{
|
||||||
|
var mobileControlList = DeviceManager.AllDevices.OfType<IMobileControl>().ToList();
|
||||||
|
|
||||||
|
if (mobileControlList.Count > 0)
|
||||||
|
{
|
||||||
|
Debug.Console(0, Debug.ErrorLogLevel.Notice,
|
||||||
|
"Multiple instances of Mobile Control Server found. Using instance with key {0}",
|
||||||
|
mobileControlList[0].Key);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mobileControlList.Count != 0)
|
||||||
|
{
|
||||||
|
return mobileControlList[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Mobile Control not enabled for this system");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Helps add the post activation steps that link bridges to main controller
|
/// Helps add the post activation steps that link bridges to main controller
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user