Added messages for share state to essentials MC bridge

This commit is contained in:
Heath Volmer
2018-08-02 17:06:10 -06:00
parent 163f6e6941
commit 3778314d51

View File

@@ -5,6 +5,8 @@ using System.Text;
using Crestron.SimplSharp; using Crestron.SimplSharp;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Essentials.Core; using PepperDash.Essentials.Core;
using PepperDash.Essentials.Room.Cotija; using PepperDash.Essentials.Room.Cotija;
using PepperDash.Essentials.Devices.Common.Codec; using PepperDash.Essentials.Devices.Common.Codec;
@@ -63,17 +65,17 @@ namespace PepperDash.Essentials
if(defaultRoom != null) if(defaultRoom != null)
Parent.AddAction(string.Format(@"/room/{0}/defaultsource", Room.Key), new Action(() => defaultRoom.RunDefaultPresentRoute())); Parent.AddAction(string.Format(@"/room/{0}/defaultsource", Room.Key), new Action(() => defaultRoom.RunDefaultPresentRoute()));
var vcRoom = Room as IHasCurrentVolumeControls; var volumeRoom = Room as IHasCurrentVolumeControls;
if (vcRoom != null) if (volumeRoom != null)
{ {
Parent.AddAction(string.Format(@"/room/{0}/volumes/master/level", Room.Key), new Action<ushort>(u => Parent.AddAction(string.Format(@"/room/{0}/volumes/master/level", Room.Key), new Action<ushort>(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(() => Parent.AddAction(string.Format(@"/room/{0}/volumes/master/mute", Room.Key), new Action(() =>
vcRoom.CurrentVolumeControls.MuteToggle())); volumeRoom.CurrentVolumeControls.MuteToggle()));
vcRoom.CurrentVolumeDeviceChange += new EventHandler<VolumeDeviceChangeEventArgs>(Room_CurrentVolumeDeviceChange); volumeRoom.CurrentVolumeDeviceChange += new EventHandler<VolumeDeviceChangeEventArgs>(Room_CurrentVolumeDeviceChange);
// Registers for initial volume events, if possible // Registers for initial volume events, if possible
var currentVolumeDevice = vcRoom.CurrentVolumeControls as IBasicVolumeWithFeedback; var currentVolumeDevice = volumeRoom.CurrentVolumeControls as IBasicVolumeWithFeedback;
if (currentVolumeDevice != null) if (currentVolumeDevice != null)
{ {
currentVolumeDevice.MuteFeedback.OutputChange += VolumeLevelFeedback_OutputChange; currentVolumeDevice.MuteFeedback.OutputChange += VolumeLevelFeedback_OutputChange;
@@ -85,11 +87,13 @@ namespace PepperDash.Essentials
if(sscRoom != null) if(sscRoom != null)
sscRoom.CurrentSingleSourceChange += new SourceInfoChangeHandler(Room_CurrentSingleSourceChange); sscRoom.CurrentSingleSourceChange += new SourceInfoChangeHandler(Room_CurrentSingleSourceChange);
var vidRoom = Room as IHasVideoCodec; var vcRoom = Room as IHasVideoCodec;
if (vidRoom != null) if (vcRoom != null)
{ {
var codec = vidRoom.VideoCodec; var codec = vcRoom.VideoCodec;
codec.CallStatusChange += new EventHandler<CodecCallStatusItemChangeEventArgs>(codec_CallStatusChange); codec.CallStatusChange += new EventHandler<CodecCallStatusItemChangeEventArgs>(codec_CallStatusChange);
vcRoom.IsSharingFeedback.OutputChange += new EventHandler<FeedbackEventArgs>(IsSharingFeedback_OutputChange);
} }
Parent.AddAction(string.Format(@"/room/{0}/shutdownStart", Room.Key), new Action(() => Room.StartShutdown(eShutdownType.Manual))); 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; Room.ShutdownPromptTimer.WasCancelled += ShutdownPromptTimer_WasCancelled;
} }
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
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
}
});
}
/// <summary> /// <summary>
/// Handler for codec changes /// Handler for codec changes
/// </summary> /// </summary>