From 163f6e694132619ea78371b744b529ea69919a73 Mon Sep 17 00:00:00 2001 From: Heath Volmer Date: Wed, 1 Aug 2018 16:59:09 -0600 Subject: [PATCH] Various cleanup; added messaging for codec status events; added initial state of codec to fullstatus message --- .../CotijaEssentialsHuddleSpaceRoomBridge.cs | 64 +++++++++++++++++++ .../Room/Types/EssentialsHuddleVtc1Room.cs | 2 +- 2 files changed, 65 insertions(+), 1 deletion(-) diff --git a/PepperDashEssentials/Room/Cotija/RoomBridges/CotijaEssentialsHuddleSpaceRoomBridge.cs b/PepperDashEssentials/Room/Cotija/RoomBridges/CotijaEssentialsHuddleSpaceRoomBridge.cs index 3a2b8f1a..75a159e6 100644 --- a/PepperDashEssentials/Room/Cotija/RoomBridges/CotijaEssentialsHuddleSpaceRoomBridge.cs +++ b/PepperDashEssentials/Room/Cotija/RoomBridges/CotijaEssentialsHuddleSpaceRoomBridge.cs @@ -7,6 +7,8 @@ using Newtonsoft.Json; using Newtonsoft.Json.Linq; using PepperDash.Essentials.Core; using PepperDash.Essentials.Room.Cotija; +using PepperDash.Essentials.Devices.Common.Codec; +using PepperDash.Essentials.Devices.Common.VideoCodec; namespace PepperDash.Essentials { @@ -83,6 +85,13 @@ namespace PepperDash.Essentials if(sscRoom != null) sscRoom.CurrentSingleSourceChange += new SourceInfoChangeHandler(Room_CurrentSingleSourceChange); + var vidRoom = Room as IHasVideoCodec; + if (vidRoom != null) + { + var codec = vidRoom.VideoCodec; + codec.CallStatusChange += new EventHandler(codec_CallStatusChange); + } + Parent.AddAction(string.Format(@"/room/{0}/shutdownStart", Room.Key), new Action(() => Room.StartShutdown(eShutdownType.Manual))); Parent.AddAction(string.Format(@"/room/{0}/shutdownEnd", Room.Key), new Action(() => Room.ShutdownPromptTimer.Finish())); Parent.AddAction(string.Format(@"/room/{0}/shutdownCancel", Room.Key), new Action(() => Room.ShutdownPromptTimer.Cancel())); @@ -96,6 +105,18 @@ namespace PepperDash.Essentials Room.ShutdownPromptTimer.WasCancelled += ShutdownPromptTimer_WasCancelled; } + /// + /// Handler for codec changes + /// + void codec_CallStatusChange(object sender, CodecCallStatusItemChangeEventArgs e) + { + PostStatusMessage(new + { + calls = GetCallsMessageObject() + }); + + } + /// /// Helper for posting status message /// @@ -337,21 +358,64 @@ namespace PepperDash.Essentials } } + //var callRm = room as IHasVideoCodec; + //object calls = null; + //if(callRm != null) + //{ + // calls = new { + // activeCalls = callRm.VideoCodec.ActiveCalls, + // callType = callRm.CallTypeFeedback.IntValue, + // inCall = callRm.InCallFeedback.BoolValue, + // isSharing = callRm.IsSharingFeedback.BoolValue, + // privacyModeIsOn = callRm.PrivacyModeIsOnFeedback.BoolValue + // }; + //} + PostStatusMessage(new { + calls = GetCallsMessageObject(), isOn = room.OnFeedback.BoolValue, selectedSourceKey = sourceKey, + videoCodec = new { + + }, volumes = volumes }); } + + /// + /// Helper to return a anonymous object with the call data for JSON message + /// + /// + object GetCallsMessageObject() + { + var callRm = Room as IHasVideoCodec; + if (callRm == null) + return null; + return new + { + activeCalls = callRm.VideoCodec.ActiveCalls, + callType = callRm.CallTypeFeedback.IntValue, + inCall = callRm.InCallFeedback.BoolValue, + isSharing = callRm.IsSharingFeedback.BoolValue, + privacyModeIsOn = callRm.PrivacyModeIsOnFeedback.BoolValue + }; + } } + /// + /// + /// public class SourceSelectMessageContent { public string SourceListItem { get; set; } } + /// + /// + /// + /// public delegate void PressAndHoldAction(bool b); } \ No newline at end of file diff --git a/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs b/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs index 0290bf98..a5bdb1a6 100644 --- a/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs +++ b/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs @@ -13,7 +13,7 @@ using PepperDash.Essentials.Devices.Common.VideoCodec; namespace PepperDash.Essentials { public class EssentialsHuddleVtc1Room : EssentialsRoomBase, IHasCurrentSourceInfoChange, - IPrivacy, IHasCurrentVolumeControls, IRunRouteAction, IRunDefaultCallRoute + IPrivacy, IHasCurrentVolumeControls, IRunRouteAction, IRunDefaultCallRoute, IHasVideoCodec { public event EventHandler CurrentVolumeDeviceChange; public event SourceInfoChangeHandler CurrentSingleSourceChange;