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

@@ -230,6 +230,8 @@ namespace PepperDash.Essentials
} }
void Initialize() void Initialize()
{
try
{ {
if (DefaultAudioDevice is IBasicVolumeControls) if (DefaultAudioDevice is IBasicVolumeControls)
DefaultVolumeControls = DefaultAudioDevice as IBasicVolumeControls; DefaultVolumeControls = DefaultAudioDevice as IBasicVolumeControls;
@@ -238,6 +240,24 @@ namespace PepperDash.Essentials
CurrentVolumeControls = DefaultVolumeControls; CurrentVolumeControls = DefaultVolumeControls;
// Combines call feedback from both codecs if available
InCallFeedback = new BoolFeedback(() =>
{
bool inAudioCall = false;
bool inVideoCall = false;
if (AudioCodec != null)
inAudioCall = AudioCodec.IsInCall;
if (VideoCodec != null)
inVideoCall = VideoCodec.IsInCall;
if (inAudioCall || inVideoCall)
return true;
else
return false;
});
var disp = DefaultDisplay as DisplayBase; var disp = DefaultDisplay as DisplayBase;
if (disp != null) if (disp != null)
{ {
@@ -267,7 +287,11 @@ namespace PepperDash.Essentials
IsCoolingDownFeedback.FireUpdate(); IsCoolingDownFeedback.FireUpdate();
}; };
// Get Microphone Privacy object, if any }
// Get Microphone Privacy object, if any MUST HAPPEN AFTER setting InCallFeedback
this.MicrophonePrivacy = EssentialsRoomConfigHelper.GetMicrophonePrivacy(PropertiesConfig, this); this.MicrophonePrivacy = EssentialsRoomConfigHelper.GetMicrophonePrivacy(PropertiesConfig, this);
Debug.Console(2, this, "Microphone Privacy Config evaluated."); Debug.Console(2, this, "Microphone Privacy Config evaluated.");
@@ -276,27 +300,8 @@ namespace PepperDash.Essentials
this.Emergency = EssentialsRoomConfigHelper.GetEmergency(PropertiesConfig, this); this.Emergency = EssentialsRoomConfigHelper.GetEmergency(PropertiesConfig, this);
Debug.Console(2, this, "Emergency Config evaluated."); Debug.Console(2, this, "Emergency Config evaluated.");
}
// Combines call feedback from both codecs if available
InCallFeedback = new BoolFeedback(() =>
{
bool inAudioCall = false;
bool inVideoCall = false;
if(AudioCodec != null)
inAudioCall = AudioCodec.IsInCall;
if(VideoCodec != null)
inVideoCall = VideoCodec.IsInCall;
if (inAudioCall || inVideoCall)
return true;
else
return false;
});
VideoCodec.CallStatusChange += (o, a) => this.InCallFeedback.FireUpdate(); VideoCodec.CallStatusChange += (o, a) => this.InCallFeedback.FireUpdate();
if (AudioCodec != null) if (AudioCodec != null)
@@ -314,6 +319,11 @@ namespace PepperDash.Essentials
SourceListKey = "default"; SourceListKey = "default";
EnablePowerOnToLastSource = true; 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

@@ -100,7 +100,8 @@ 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;
} }

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");
AddPostActivationAction(() => {
CheckPrivacyMode(); 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)