chore: miscellaeneous cleanup

This commit is contained in:
Andrew Welker
2025-03-25 22:46:41 -05:00
parent 789111cb9a
commit 277771d154
19 changed files with 289 additions and 496 deletions

View File

@@ -31,54 +31,4 @@ namespace PepperDash.Essentials
}
}
}
public class MobileControlSimplFactory : EssentialsDeviceFactory<MobileControlSIMPLRoomBridge>
{
public MobileControlSimplFactory()
{
TypeNames = new List<string> { "mobilecontrolbridge-ddvc01", "mobilecontrolbridge-simpl" };
}
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
var comm = CommFactory.GetControlPropertiesConfig(dc);
var bridge = new MobileControlSIMPLRoomBridge(dc.Key, dc.Name, comm.IpIdInt);
bridge.AddPreActivationAction(() =>
{
var parent = GetMobileControlDevice();
if (parent == null)
{
bridge.LogInformation("ERROR: Cannot connect bridge. System controller not present");
return;
}
bridge.LogInformation("Linking to parent controller");
parent.AddDeviceMessenger(bridge);
});
return bridge;
}
private static MobileControlSystemController GetMobileControlDevice()
{
var mobileControlList = DeviceManager.AllDevices.OfType<MobileControlSystemController>().ToList();
if (mobileControlList.Count > 1)
{
Debug.LogMessage(LogEventLevel.Warning, "Multiple instances of Mobile Control Server found.");
return null;
}
if (mobileControlList.Count > 0)
{
return mobileControlList[0];
}
Debug.LogMessage(LogEventLevel.Warning, "Mobile Control not enabled for this system");
return null;
}
}
}