mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-16 21:24:54 +00:00
Adds new event to DeviceManager to indicate that all devices have been activated. Necessary for MicrophonePrivacyManager
#485
This commit is contained in:
@@ -41,12 +41,12 @@ namespace PepperDash.Essentials.Core.CrestronIO
|
|||||||
{
|
{
|
||||||
InputPort = postActivationFunc(config);
|
InputPort = postActivationFunc(config);
|
||||||
|
|
||||||
|
InputPort.Register();
|
||||||
|
|
||||||
InputPort.SetVersiportConfiguration(eVersiportConfiguration.DigitalInput);
|
InputPort.SetVersiportConfiguration(eVersiportConfiguration.DigitalInput);
|
||||||
if (config.DisablePullUpResistor)
|
if (config.DisablePullUpResistor)
|
||||||
InputPort.DisablePullUpResistor = true;
|
InputPort.DisablePullUpResistor = true;
|
||||||
|
|
||||||
InputPort.Register();
|
|
||||||
|
|
||||||
InputPort.VersiportChange += InputPort_VersiportChange;
|
InputPort.VersiportChange += InputPort_VersiportChange;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ namespace PepperDash.Essentials.Core
|
|||||||
{
|
{
|
||||||
public static class DeviceManager
|
public static class DeviceManager
|
||||||
{
|
{
|
||||||
|
public static event EventHandler<EventArgs> AllDevicesActivated;
|
||||||
|
|
||||||
private static readonly CCriticalSection DeviceCriticalSection = new CCriticalSection();
|
private static readonly CCriticalSection DeviceCriticalSection = new CCriticalSection();
|
||||||
private static readonly CEvent AllowAddDevicesCEvent = new CEvent(false, true);
|
private static readonly CEvent AllowAddDevicesCEvent = new CEvent(false, true);
|
||||||
//public static List<Device> Devices { get { return _Devices; } }
|
//public static List<Device> Devices { get { return _Devices; } }
|
||||||
@@ -98,6 +100,8 @@ namespace PepperDash.Essentials.Core
|
|||||||
Debug.Console(0, d, "ERROR: Device PostActivation failure:\r{0}", e);
|
Debug.Console(0, d, "ERROR: Device PostActivation failure:\r{0}", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OnAllDevicesActivated();
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
@@ -105,6 +109,15 @@ namespace PepperDash.Essentials.Core
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void OnAllDevicesActivated()
|
||||||
|
{
|
||||||
|
var handler = AllDevicesActivated;
|
||||||
|
if (handler != null)
|
||||||
|
{
|
||||||
|
handler(null, new EventArgs());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Calls activate on all Device class items
|
/// Calls activate on all Device class items
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -88,8 +88,12 @@ namespace PepperDash.Essentials.Core.Privacy
|
|||||||
else
|
else
|
||||||
Debug.Console(0, this, "Unable to add Red LED device");
|
Debug.Console(0, this, "Unable to add Red LED device");
|
||||||
|
|
||||||
|
DeviceManager.AllDevicesActivated += (o, a) =>
|
||||||
|
{
|
||||||
|
CheckPrivacyMode();
|
||||||
|
};
|
||||||
|
|
||||||
AddPostActivationAction(() => {
|
AddPostActivationAction(() => {
|
||||||
CheckPrivacyMode();
|
|
||||||
PrivacyDevice.PrivacyModeIsOnFeedback.OutputChange -= PrivacyModeIsOnFeedback_OutputChange;
|
PrivacyDevice.PrivacyModeIsOnFeedback.OutputChange -= PrivacyModeIsOnFeedback_OutputChange;
|
||||||
PrivacyDevice.PrivacyModeIsOnFeedback.OutputChange += PrivacyModeIsOnFeedback_OutputChange;
|
PrivacyDevice.PrivacyModeIsOnFeedback.OutputChange += PrivacyModeIsOnFeedback_OutputChange;
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user