Corrects issues with order of operations so that InCallFeedback isn't null when dependent routines check it's state.

This commit is contained in:
Neil Dorin
2019-11-27 10:32:21 -07:00
parent 2fe1ac0e75
commit f2e2166146
4 changed files with 83 additions and 70 deletions

View File

@@ -231,64 +231,25 @@ namespace PepperDash.Essentials
void Initialize() void Initialize()
{ {
if (DefaultAudioDevice is IBasicVolumeControls) try
DefaultVolumeControls = DefaultAudioDevice as IBasicVolumeControls;
else if (DefaultAudioDevice is IHasVolumeDevice)
DefaultVolumeControls = (DefaultAudioDevice as IHasVolumeDevice).VolumeDevice;
CurrentVolumeControls = DefaultVolumeControls;
var disp = DefaultDisplay as DisplayBase;
if (disp != null)
{ {
// Link power, warming, cooling to display if (DefaultAudioDevice is IBasicVolumeControls)
disp.PowerIsOnFeedback.OutputChange += (o, a) => DefaultVolumeControls = DefaultAudioDevice as IBasicVolumeControls;
{ else if (DefaultAudioDevice is IHasVolumeDevice)
if (disp.PowerIsOnFeedback.BoolValue != OnFeedback.BoolValue) DefaultVolumeControls = (DefaultAudioDevice as IHasVolumeDevice).VolumeDevice;
{ CurrentVolumeControls = DefaultVolumeControls;
if (!disp.PowerIsOnFeedback.BoolValue)
CurrentSourceInfo = null;
OnFeedback.FireUpdate();
}
if (disp.PowerIsOnFeedback.BoolValue)
{
SetDefaultLevels();
}
};
disp.IsWarmingUpFeedback.OutputChange += (o, a) =>
{
IsWarmingUpFeedback.FireUpdate();
if (!IsWarmingUpFeedback.BoolValue)
(CurrentVolumeControls as IBasicVolumeWithFeedback).SetVolume(DefaultVolume);
};
disp.IsCoolingDownFeedback.OutputChange += (o, a) =>
{
IsCoolingDownFeedback.FireUpdate();
};
// Get Microphone Privacy object, if any
this.MicrophonePrivacy = EssentialsRoomConfigHelper.GetMicrophonePrivacy(PropertiesConfig, this);
Debug.Console(2, this, "Microphone Privacy Config evaluated.");
// Get emergency object, if any
this.Emergency = EssentialsRoomConfigHelper.GetEmergency(PropertiesConfig, this);
Debug.Console(2, this, "Emergency Config evaluated.");
}
// Combines call feedback from both codecs if available // Combines call feedback from both codecs if available
InCallFeedback = new BoolFeedback(() => InCallFeedback = new BoolFeedback(() =>
{ {
bool inAudioCall = false; bool inAudioCall = false;
bool inVideoCall = false; bool inVideoCall = false;
if(AudioCodec != null) if (AudioCodec != null)
inAudioCall = AudioCodec.IsInCall; inAudioCall = AudioCodec.IsInCall;
if(VideoCodec != null) if (VideoCodec != null)
inVideoCall = VideoCodec.IsInCall; inVideoCall = VideoCodec.IsInCall;
if (inAudioCall || inVideoCall) if (inAudioCall || inVideoCall)
@@ -297,22 +258,71 @@ namespace PepperDash.Essentials
return false; return false;
}); });
VideoCodec.CallStatusChange += (o, a) => this.InCallFeedback.FireUpdate(); var disp = DefaultDisplay as DisplayBase;
if (disp != null)
{
// Link power, warming, cooling to display
disp.PowerIsOnFeedback.OutputChange += (o, a) =>
{
if (disp.PowerIsOnFeedback.BoolValue != OnFeedback.BoolValue)
{
if (!disp.PowerIsOnFeedback.BoolValue)
CurrentSourceInfo = null;
OnFeedback.FireUpdate();
}
if (disp.PowerIsOnFeedback.BoolValue)
{
SetDefaultLevels();
}
};
if (AudioCodec != null) disp.IsWarmingUpFeedback.OutputChange += (o, a) =>
AudioCodec.CallStatusChange += (o, a) => this.InCallFeedback.FireUpdate(); {
IsWarmingUpFeedback.FireUpdate();
if (!IsWarmingUpFeedback.BoolValue)
(CurrentVolumeControls as IBasicVolumeWithFeedback).SetVolume(DefaultVolume);
};
disp.IsCoolingDownFeedback.OutputChange += (o, a) =>
{
IsCoolingDownFeedback.FireUpdate();
};
IsSharingFeedback = new BoolFeedback(() => VideoCodec.SharingContentIsOnFeedback.BoolValue); }
VideoCodec.SharingContentIsOnFeedback.OutputChange += (o, a) => this.IsSharingFeedback.FireUpdate();
// link privacy to VC (for now?)
PrivacyModeIsOnFeedback = new BoolFeedback(() => VideoCodec.PrivacyModeIsOnFeedback.BoolValue);
VideoCodec.PrivacyModeIsOnFeedback.OutputChange += (o, a) => this.PrivacyModeIsOnFeedback.FireUpdate();
CallTypeFeedback = new IntFeedback(() => 0);
SourceListKey = "default"; // Get Microphone Privacy object, if any MUST HAPPEN AFTER setting InCallFeedback
EnablePowerOnToLastSource = true; this.MicrophonePrivacy = EssentialsRoomConfigHelper.GetMicrophonePrivacy(PropertiesConfig, this);
Debug.Console(2, this, "Microphone Privacy Config evaluated.");
// Get emergency object, if any
this.Emergency = EssentialsRoomConfigHelper.GetEmergency(PropertiesConfig, this);
Debug.Console(2, this, "Emergency Config evaluated.");
VideoCodec.CallStatusChange += (o, a) => this.InCallFeedback.FireUpdate();
if (AudioCodec != null)
AudioCodec.CallStatusChange += (o, a) => this.InCallFeedback.FireUpdate();
IsSharingFeedback = new BoolFeedback(() => VideoCodec.SharingContentIsOnFeedback.BoolValue);
VideoCodec.SharingContentIsOnFeedback.OutputChange += (o, a) => this.IsSharingFeedback.FireUpdate();
// link privacy to VC (for now?)
PrivacyModeIsOnFeedback = new BoolFeedback(() => VideoCodec.PrivacyModeIsOnFeedback.BoolValue);
VideoCodec.PrivacyModeIsOnFeedback.OutputChange += (o, a) => this.PrivacyModeIsOnFeedback.FireUpdate();
CallTypeFeedback = new IntFeedback(() => 0);
SourceListKey = "default";
EnablePowerOnToLastSource = true;
}
catch (Exception e)
{
Debug.Console(0, this, "Error Initializing Room: {0}", e);
}
} }
protected override void CustomSetConfig(DeviceConfig config) protected override void CustomSetConfig(DeviceConfig config)

View File

@@ -33,9 +33,9 @@ namespace PepperDash.Essentials.Core
{ {
Audio = 1, Audio = 1,
Video = 2, Video = 2,
//AudioVideo = 4, AudioVideo = 4,
UsbOutput = 4, UsbOutput = 8,
UsbInput = 8 UsbInput = 16
} }
public enum eRoutingPortConnectionType public enum eRoutingPortConnectionType

View File

@@ -33,7 +33,7 @@ namespace PepperDash.Essentials.Core
public ushort Count public ushort Count
{ {
get { return SetNumberOfItemsSig.UShortValue; } get { return SetNumberOfItemsSig.UShortValue; }
set { SetNumberOfItemsSig.UShortValue = value; } set { SetNumberOfItemsSig.UShortValue = value; }
} }
public ushort MaxDefinedItems { get; private set; } public ushort MaxDefinedItems { get; private set; }
@@ -100,8 +100,9 @@ namespace PepperDash.Essentials.Core
// Empty the list // Empty the list
Items.Clear(); Items.Clear();
// Clean up the SRL // Clean up the SRL
Count = 0; Count = 1;
ScrollToItemSig.UShortValue = 1;
ScrollToItemSig.UShortValue = 1;
} }
/// <summary> /// <summary>

View File

@@ -87,7 +87,11 @@ namespace PepperDash.Essentials.Devices.Common.Microphones
else else
Debug.Console(0, this, "Unable to add Red LED device"); Debug.Console(0, this, "Unable to add Red LED device");
CheckPrivacyMode(); AddPostActivationAction(() => {
CheckPrivacyMode();
PrivacyDevice.PrivacyModeIsOnFeedback.OutputChange -= PrivacyModeIsOnFeedback_OutputChange;
PrivacyDevice.PrivacyModeIsOnFeedback.OutputChange += PrivacyModeIsOnFeedback_OutputChange;
});
initialized = true; initialized = true;
@@ -97,8 +101,6 @@ namespace PepperDash.Essentials.Devices.Common.Microphones
public void SetPrivacyDevice(IPrivacy privacyDevice) public void SetPrivacyDevice(IPrivacy privacyDevice)
{ {
PrivacyDevice = privacyDevice; PrivacyDevice = privacyDevice;
PrivacyDevice.PrivacyModeIsOnFeedback.OutputChange += PrivacyModeIsOnFeedback_OutputChange;
} }
void PrivacyModeIsOnFeedback_OutputChange(object sender, EventArgs e) void PrivacyModeIsOnFeedback_OutputChange(object sender, EventArgs e)