diff --git a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IMobileControl.cs b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IMobileControl.cs index 80e9cc8c..5e46f17f 100644 --- a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IMobileControl.cs +++ b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IMobileControl.cs @@ -6,9 +6,9 @@ using PepperDash.Core; namespace PepperDash.Essentials.Core.DeviceTypeInterfaces { /// - /// Use this interface on a device or room if it should use default Mobile Control messengers + /// Use this interface on a device or room if it uses custom Mobile Control messengers /// - public interface IStandardMobileControl : IKeyed + public interface ICustomMobileControl : IKeyed { } diff --git a/src/PepperDash.Essentials.Core/Devices/EssentialsDevice.cs b/src/PepperDash.Essentials.Core/Devices/EssentialsDevice.cs index 1846a512..cd9e3923 100644 --- a/src/PepperDash.Essentials.Core/Devices/EssentialsDevice.cs +++ b/src/PepperDash.Essentials.Core/Devices/EssentialsDevice.cs @@ -48,6 +48,20 @@ namespace PepperDash.Essentials.Core } }); } + + public override bool CustomActivate() + { + CreateMobileControlMessengers(); + + return base.CustomActivate(); + } + + /// + /// Override this method to build and create custom Mobile Control Messengers during the Activation phase + /// + protected virtual void CreateMobileControlMessengers() { + + } } [AttributeUsage(AttributeTargets.Class, Inherited = true, AllowMultiple = true)] diff --git a/src/PepperDash.Essentials/ControlSystem.cs b/src/PepperDash.Essentials/ControlSystem.cs index 7d4281bd..18cee177 100644 --- a/src/PepperDash.Essentials/ControlSystem.cs +++ b/src/PepperDash.Essentials/ControlSystem.cs @@ -476,23 +476,23 @@ namespace PepperDash.Essentials var room = Core.DeviceFactory.GetDevice(roomConfig); DeviceManager.AddDevice(room); - if (!(room is IStandardMobileControl)) + if (room is ICustomMobileControl) { continue; } - BuildMC(room as IStandardMobileControl); + BuildMC(room as IEssentialsRoom); } Debug.Console(0, Debug.ErrorLogLevel.Notice, "All Rooms Loaded."); } - private static void BuildMC(IStandardMobileControl room) + private static void BuildMC(IEssentialsRoom room) { - Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Mobile Control Bridge for "); + Debug.Console(0, Debug.ErrorLogLevel.Notice, $"Attempting to build Mobile Control Bridge for {room?.Key}"); - CreateMobileControlBridge(room as IEssentialsRoom); + CreateMobileControlBridge(room); } private static void CreateMobileControlBridge(IEssentialsRoom room)