Added behaviour options for MicrophonePrivacyController to track either room power state or room call state from config

This commit is contained in:
Neil Dorin
2017-11-06 15:20:50 -07:00
parent d9013157ad
commit f9d1a737c4
5 changed files with 51 additions and 15 deletions

View File

@@ -19,6 +19,8 @@ namespace PepperDash.Essentials.Devices.Common.Microphones
{ {
MicrophonePrivacyControllerConfig Config; MicrophonePrivacyControllerConfig Config;
bool initialized;
public bool EnableLeds public bool EnableLeds
{ {
get get
@@ -29,13 +31,16 @@ namespace PepperDash.Essentials.Devices.Common.Microphones
{ {
_enableLeds = value; _enableLeds = value;
if (value) if (initialized)
{ {
CheckPrivacyMode(); if (value)
SetLedStates(); {
CheckPrivacyMode();
SetLedStates();
}
else
TurnOffAllLeds();
} }
else
TurnOffAllLeds();
} }
} }
bool _enableLeds; bool _enableLeds;
@@ -84,6 +89,8 @@ namespace PepperDash.Essentials.Devices.Common.Microphones
CheckPrivacyMode(); CheckPrivacyMode();
initialized = true;
return base.CustomActivate(); return base.CustomActivate();
} }

View File

@@ -50,7 +50,12 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
{ {
get get
{ {
var value = ActiveCalls.Any(c => c.IsActiveCall); bool value;
if (ActiveCalls != null)
value = ActiveCalls.Any(c => c.IsActiveCall);
else
value = false;
return value; return value;
} }
} }

View File

@@ -112,16 +112,39 @@ namespace PepperDash.Essentials.Room.Config
{ {
mP.SetPrivacyDevice(room); mP.SetPrivacyDevice(room);
// Tie LED enable to room power state var behaviour = props.MicrophonePrivacy.Behaviour.ToLower();
room.OnFeedback.OutputChange += (o, a) =>
{
if (room.OnFeedback.BoolValue)
mP.EnableLeds = true;
else
mP.EnableLeds = false;
};
mP.EnableLeds = room.OnFeedback.BoolValue; if (behaviour != null)
{
if (behaviour == "trackroomstate")
{
// Tie LED enable to room power state
room.OnFeedback.OutputChange += (o, a) =>
{
if (room.OnFeedback.BoolValue)
mP.EnableLeds = true;
else
mP.EnableLeds = false;
};
mP.EnableLeds = room.OnFeedback.BoolValue;
}
else if (behaviour == "trackcallstate")
{
// Tie LED enable to room power state
room.InCallFeedback.OutputChange += (o, a) =>
{
if (room.InCallFeedback.BoolValue)
mP.EnableLeds = true;
else
mP.EnableLeds = false;
};
mP.EnableLeds = room.InCallFeedback.BoolValue;
}
}
else
Debug.Console(0, "No behaviour defined for MicrophonePrivacyController");
return mP; return mP;
} }
@@ -153,6 +176,7 @@ namespace PepperDash.Essentials.Room.Config
public class EssentialsRoomMicrophonePrivacyConfig public class EssentialsRoomMicrophonePrivacyConfig
{ {
public string DeviceKey { get; set; } public string DeviceKey { get; set; }
public string Behaviour { get; set; }
} }
/// <summary> /// <summary>