From 3778314d51a9dd8dd4dcd2d189f3e09a9c4830c1 Mon Sep 17 00:00:00 2001 From: Heath Volmer Date: Thu, 2 Aug 2018 17:06:10 -0600 Subject: [PATCH] Added messages for share state to essentials MC bridge --- .../CotijaEssentialsHuddleSpaceRoomBridge.cs | 57 ++++++++++++++++--- 1 file changed, 48 insertions(+), 9 deletions(-) diff --git a/PepperDashEssentials/Room/Cotija/RoomBridges/CotijaEssentialsHuddleSpaceRoomBridge.cs b/PepperDashEssentials/Room/Cotija/RoomBridges/CotijaEssentialsHuddleSpaceRoomBridge.cs index 75a159e6..b59c7881 100644 --- a/PepperDashEssentials/Room/Cotija/RoomBridges/CotijaEssentialsHuddleSpaceRoomBridge.cs +++ b/PepperDashEssentials/Room/Cotija/RoomBridges/CotijaEssentialsHuddleSpaceRoomBridge.cs @@ -5,6 +5,8 @@ using System.Text; using Crestron.SimplSharp; using Newtonsoft.Json; using Newtonsoft.Json.Linq; + +using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Room.Cotija; using PepperDash.Essentials.Devices.Common.Codec; @@ -63,17 +65,17 @@ namespace PepperDash.Essentials if(defaultRoom != null) Parent.AddAction(string.Format(@"/room/{0}/defaultsource", Room.Key), new Action(() => defaultRoom.RunDefaultPresentRoute())); - var vcRoom = Room as IHasCurrentVolumeControls; - if (vcRoom != null) + var volumeRoom = Room as IHasCurrentVolumeControls; + if (volumeRoom != null) { Parent.AddAction(string.Format(@"/room/{0}/volumes/master/level", Room.Key), new Action(u => - (vcRoom.CurrentVolumeControls as IBasicVolumeWithFeedback).SetVolume(u))); + (volumeRoom.CurrentVolumeControls as IBasicVolumeWithFeedback).SetVolume(u))); Parent.AddAction(string.Format(@"/room/{0}/volumes/master/mute", Room.Key), new Action(() => - vcRoom.CurrentVolumeControls.MuteToggle())); - vcRoom.CurrentVolumeDeviceChange += new EventHandler(Room_CurrentVolumeDeviceChange); + volumeRoom.CurrentVolumeControls.MuteToggle())); + volumeRoom.CurrentVolumeDeviceChange += new EventHandler(Room_CurrentVolumeDeviceChange); // Registers for initial volume events, if possible - var currentVolumeDevice = vcRoom.CurrentVolumeControls as IBasicVolumeWithFeedback; + var currentVolumeDevice = volumeRoom.CurrentVolumeControls as IBasicVolumeWithFeedback; if (currentVolumeDevice != null) { currentVolumeDevice.MuteFeedback.OutputChange += VolumeLevelFeedback_OutputChange; @@ -85,11 +87,13 @@ namespace PepperDash.Essentials if(sscRoom != null) sscRoom.CurrentSingleSourceChange += new SourceInfoChangeHandler(Room_CurrentSingleSourceChange); - var vidRoom = Room as IHasVideoCodec; - if (vidRoom != null) + var vcRoom = Room as IHasVideoCodec; + if (vcRoom != null) { - var codec = vidRoom.VideoCodec; + var codec = vcRoom.VideoCodec; codec.CallStatusChange += new EventHandler(codec_CallStatusChange); + + vcRoom.IsSharingFeedback.OutputChange += new EventHandler(IsSharingFeedback_OutputChange); } Parent.AddAction(string.Format(@"/room/{0}/shutdownStart", Room.Key), new Action(() => Room.StartShutdown(eShutdownType.Manual))); @@ -105,6 +109,41 @@ namespace PepperDash.Essentials Room.ShutdownPromptTimer.WasCancelled += ShutdownPromptTimer_WasCancelled; } + /// + /// + /// + /// + /// + void IsSharingFeedback_OutputChange(object sender, FeedbackEventArgs e) + { + // sharing source + string shareText; + bool isSharing; + + var vcRoom = Room as IHasVideoCodec; + var srcInfoRoom = Room as IHasCurrentSourceInfoChange; + if (vcRoom.VideoCodec.SharingContentIsOnFeedback.BoolValue && srcInfoRoom.CurrentSourceInfo != null) + { + + shareText = srcInfoRoom.CurrentSourceInfo.PreferredName; + isSharing = true; + } + else + { + shareText = "None"; + isSharing = false; + } + + PostStatusMessage(new + { + share = new + { + currentShareText = shareText, + isSharing = isSharing + } + }); + } + /// /// Handler for codec changes ///