diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Rooms/Config/EssentialsDualDisplayRoomPropertiesConfig.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Rooms/Config/EssentialsDualDisplayRoomPropertiesConfig.cs index d1d1ee4d..32ab61c1 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Rooms/Config/EssentialsDualDisplayRoomPropertiesConfig.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Rooms/Config/EssentialsDualDisplayRoomPropertiesConfig.cs @@ -1,6 +1,4 @@ -using PepperDash.Essentials.Core.Config; - -namespace PepperDash.Essentials.Core.Rooms.Config +namespace PepperDash.Essentials.Core.Rooms.Config { public class EssentialsDualDisplayRoomPropertiesConfig : EssentialsNDisplayRoomPropertiesConfig { diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Rooms/Config/EssentialsNDisplayRoomPropertiesConfig.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Rooms/Config/EssentialsNDisplayRoomPropertiesConfig.cs index 4678574a..b6a9bb32 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Rooms/Config/EssentialsNDisplayRoomPropertiesConfig.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Rooms/Config/EssentialsNDisplayRoomPropertiesConfig.cs @@ -10,7 +10,7 @@ namespace PepperDash.Essentials.Core.Rooms.Config /// /// /// - public class EssentialsNDisplayRoomPropertiesConfig : EssentialsHuddleRoomPropertiesConfig + public class EssentialsNDisplayRoomPropertiesConfig : EssentialsHuddleVtc1PropertiesConfig { [JsonProperty("defaultAudioBehavior")] public string DefaultAudioBehavior { get; set; } diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Rooms/Types/EssentialsDualDisplayRoom.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Rooms/Types/EssentialsDualDisplayRoom.cs index 8e0c05f7..b10370a7 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Rooms/Types/EssentialsDualDisplayRoom.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Rooms/Types/EssentialsDualDisplayRoom.cs @@ -4,16 +4,27 @@ using System.Linq; using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Config; +using PepperDash.Essentials.Core.Devices.AudioCodec; +using PepperDash.Essentials.Core.Devices.VideoCodec; +using PepperDash.Essentials.Core.Rooms; using PepperDash.Essentials.Core.Rooms.Config; using PepperDash_Essentials_Core.Devices; namespace PepperDash.Essentials { - public class EssentialsDualDisplayRoom : EssentialsRoomBase + public class EssentialsDualDisplayRoom : EssentialsRoomBase, IHasCurrentSourceInfoChange, + IPrivacy, IHasCurrentVolumeControls, IRunRouteAction, IRunDefaultCallRoute, IHasVideoCodec, IHasAudioCodec, + IHasDefaultDisplay, IHasInCallFeedback { public const string DefaultDestinationListKey = "default"; private const string LeftDestinationKey = "leftDisplay"; private const string RightDestinationKey = "rightDisplay"; + + /// + /// "codecOsd" + /// + public const string DefaultCodecRouteString = "codecOsd"; + private readonly EssentialsDualDisplayRoomPropertiesConfig _config; private string _destinationListKey; @@ -25,6 +36,20 @@ namespace PepperDash.Essentials DefaultDisplay = DeviceManager.GetDeviceForKey(_config.DefaultDisplayKey) as IRoutingSinkWithSwitching; DefaultAudioDevice = DeviceManager.GetDeviceForKey(_config.DefaultAudioKey) as IRoutingSinkWithSwitching; + VideoCodec = DeviceManager.GetDeviceForKey(_config.VideoCodecKey) as VideoCodecBase; + + if (VideoCodec == null) + { + throw new ArgumentNullException("codec cannot be null"); + } + + AudioCodec = DeviceManager.GetDeviceForKey(_config.AudioCodecKey) as AudioCodecBase; + + if (AudioCodec == null) + { + Debug.Console(0, this, "No audio codec found"); + } + Initialize(); } @@ -38,26 +63,114 @@ namespace PepperDash.Essentials public IRoutingSinkWithSwitching LeftDisplay { get; private set; } public IRoutingSinkWithSwitching RightDisplay { get; private set; } + #region IHasAudioCodec Members + + public AudioCodecBase AudioCodec { get; private set; } + + #endregion + + #region IHasVideoCodec Members + + public BoolFeedback InCallFeedback { get; private set; } + + public IntFeedback CallTypeFeedback { get; private set; } + + public BoolFeedback IsSharingFeedback { get; private set; } + + public VideoCodecBase VideoCodec { get; private set; } + + #endregion + + #region IPrivacy Members + + public BoolFeedback PrivacyModeIsOnFeedback { get; private set; } + + public void PrivacyModeOff() + { + VideoCodec.PrivacyModeOff(); + } + + public void PrivacyModeOn() + { + VideoCodec.PrivacyModeOn(); + } + + public void PrivacyModeToggle() + { + VideoCodec.PrivacyModeToggle(); + } + + #endregion + + #region IRunDefaultCallRoute Members + + /// + /// Sets up the room when started into call mode without presenting a source + /// + /// + public bool RunDefaultCallRoute() + { + RunRouteAction(DefaultCodecRouteString); + return true; + } + + #endregion + private void Initialize() { - if (DefaultAudioDevice is IBasicVolumeControls) + try { - DefaultVolumeControls = DefaultAudioDevice as IBasicVolumeControls; + if (DefaultAudioDevice is IBasicVolumeControls) + { + DefaultVolumeControls = DefaultAudioDevice as IBasicVolumeControls; + } + else if (DefaultAudioDevice is IHasVolumeDevice) + { + DefaultVolumeControls = (DefaultAudioDevice as IHasVolumeDevice).VolumeDevice; + } + + CurrentVolumeControls = DefaultVolumeControls; + + _destinationListKey = String.IsNullOrEmpty(_config.DestinationListKey) + ? DefaultDestinationListKey + : _config.DestinationListKey; + + SourceListKey = String.IsNullOrEmpty(_config.SourceListKey) + ? DefaultSourceListKey + : _config.SourceListKey; + + InitializeDestinations(); + + InCallFeedback = new BoolFeedback(() => + { + var inAudioCall = AudioCodec != null && AudioCodec.IsInCall; + var inVideoCall = VideoCodec != null && VideoCodec.IsInCall; + + return inAudioCall || inVideoCall; + }); + + MicrophonePrivacy = EssentialsRoomConfigHelper.GetMicrophonePrivacy(_config, this); + Emergency = EssentialsRoomConfigHelper.GetEmergency(_config, this); + + VideoCodec.CallStatusChange += (o, a) => InCallFeedback.FireUpdate(); + + if (AudioCodec != null) + { + AudioCodec.CallStatusChange += (o, a) => InCallFeedback.FireUpdate(); + } + + IsSharingFeedback = new BoolFeedback(() => VideoCodec.SharingContentIsOnFeedback.BoolValue); + VideoCodec.SharingContentIsOnFeedback.OutputChange += (o, a) => IsSharingFeedback.FireUpdate(); + + PrivacyModeIsOnFeedback = new BoolFeedback(() => VideoCodec.PrivacyModeIsOnFeedback.BoolValue); + VideoCodec.PrivacyModeIsOnFeedback.OutputChange += (o, a) => PrivacyModeIsOnFeedback.FireUpdate(); + + CallTypeFeedback = new IntFeedback(() => 0); } - else if (DefaultAudioDevice is IHasVolumeDevice) + catch (Exception e) { - DefaultVolumeControls = (DefaultAudioDevice as IHasVolumeDevice).VolumeDevice; + Debug.Console(0, this, "Error Initializing Room: {0}", e); } - - CurrentVolumeControls = DefaultVolumeControls; - - _destinationListKey = String.IsNullOrEmpty(_config.DestinationListKey) - ? DefaultDestinationListKey - : _config.DestinationListKey; - - SourceListKey = String.IsNullOrEmpty(_config.SourceListKey) ? DefaultSourceListKey : _config.SourceListKey; - - InitializeDestinations(); } private void InitializeDestinations() @@ -78,7 +191,7 @@ namespace PepperDash.Essentials if (leftDest == null) { DestinationList.Values.FirstOrDefault( - (li) => li.SurfaceLocation == 0 && li.HorizontalLocation == 0 && li.VerticalLocation == 0); + li => li.SurfaceLocation == 0 && li.HorizontalLocation == 0 && li.VerticalLocation == 0); } //right destination is defined as the display on the 0 surface, at location 0,0 (h, v) @@ -88,7 +201,7 @@ namespace PepperDash.Essentials if (rightDest == null) { DestinationList.Values.FirstOrDefault( - (li) => li.SurfaceLocation == 0 && li.HorizontalLocation == 1 && li.VerticalLocation == 0); + li => li.SurfaceLocation == 0 && li.HorizontalLocation == 1 && li.VerticalLocation == 0); } if (leftDest == null || rightDest == null) @@ -188,5 +301,17 @@ namespace PepperDash.Essentials OnFeedback.FireUpdate(); } + + public void RouteAction(string sourceKey, string destinationKey) + { + var routeItem = new SourceRouteListItem + { + DestinationKey = destinationKey, + SourceKey = sourceKey, + Type = eRoutingSignalType.AudioVideo + }; + + DoRoute(routeItem); + } } } \ No newline at end of file