diff --git a/PepperDashEssentials/AppServer/Messengers/AudioCodecBaseMessenger.cs b/PepperDashEssentials/AppServer/Messengers/AudioCodecBaseMessenger.cs
new file mode 100644
index 00000000..2441345d
--- /dev/null
+++ b/PepperDashEssentials/AppServer/Messengers/AudioCodecBaseMessenger.cs
@@ -0,0 +1,88 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Crestron.SimplSharp;
+
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+
+using PepperDash.Essentials.Devices.Common.Codec;
+using PepperDash.Essentials.Devices.Common.AudioCodec;
+
+namespace PepperDash.Essentials.AppServer.Messengers
+{
+ ///
+ /// Provides a messaging bridge for an AudioCodecBase device
+ ///
+ public class AudioCodecBaseMessenger : MessengerBase
+ {
+ ///
+ /// Device being bridged
+ ///
+ public AudioCodecBase Codec { get; set; }
+
+ ///
+ /// Constuctor
+ ///
+ ///
+ ///
+ ///
+ public AudioCodecBaseMessenger(string key, AudioCodecBase codec, string messagePath)
+ : base(key, messagePath)
+ {
+ if (codec == null)
+ throw new ArgumentNullException("codec");
+
+ Codec = codec;
+ codec.CallStatusChange += new EventHandler(codec_CallStatusChange);
+
+ }
+
+ protected override void CustomRegisterWithAppServer(CotijaSystemController appServerController)
+ {
+ appServerController.AddAction(MessagePath + "/fullStatus", new Action(SendAtcFullMessageObject));
+ appServerController.AddAction(MessagePath + "/dial", new Action(s => Codec.Dial(s)));
+ appServerController.AddAction(MessagePath + "/endCallById", new Action(s =>
+ {
+ var call = GetCallWithId(s);
+ if (call != null)
+ Codec.EndCall(call);
+ }));
+ }
+
+ ///
+ /// Helper to grab a call with string ID
+ ///
+ ///
+ ///
+ CodecActiveCallItem GetCallWithId(string id)
+ {
+ return Codec.ActiveCalls.FirstOrDefault(c => c.Id == id);
+ }
+
+ void codec_CallStatusChange(object sender, CodecCallStatusItemChangeEventArgs e)
+ {
+ SendAtcFullMessageObject();
+ }
+
+ ///
+ /// Helper method to build call status for vtc
+ ///
+ ///
+ void SendAtcFullMessageObject()
+ {
+
+ var info = Codec.CodecInfo;
+ PostStatusMessage(new
+ {
+ isInCall = Codec.IsInCall,
+ calls = Codec.ActiveCalls,
+ info = new
+ {
+ phoneNumber = info.PhoneNumber
+ }
+ });
+ }
+ }
+}
\ No newline at end of file
diff --git a/PepperDashEssentials/AppServer/Messengers/VideoCodecBaseMessenger.cs b/PepperDashEssentials/AppServer/Messengers/VideoCodecBaseMessenger.cs
index af07366f..5e545aac 100644
--- a/PepperDashEssentials/AppServer/Messengers/VideoCodecBaseMessenger.cs
+++ b/PepperDashEssentials/AppServer/Messengers/VideoCodecBaseMessenger.cs
@@ -13,7 +13,7 @@ using PepperDash.Essentials.Devices.Common.VideoCodec;
namespace PepperDash.Essentials.AppServer.Messengers
{
///
- /// Provides a messaging bridge for a VideoCodecBase
+ /// Provides a messaging bridge for a VideoCodecBase device
///
public class VideoCodecBaseMessenger : MessengerBase
{
diff --git a/PepperDashEssentials/AppServer/RoomBridges/CotijaEssentialsHuddleSpaceRoomBridge.cs b/PepperDashEssentials/AppServer/RoomBridges/CotijaEssentialsHuddleSpaceRoomBridge.cs
index 913158bb..976cb484 100644
--- a/PepperDashEssentials/AppServer/RoomBridges/CotijaEssentialsHuddleSpaceRoomBridge.cs
+++ b/PepperDashEssentials/AppServer/RoomBridges/CotijaEssentialsHuddleSpaceRoomBridge.cs
@@ -12,6 +12,7 @@ using PepperDash.Essentials.Core;
using PepperDash.Essentials.Room.Cotija;
using PepperDash.Essentials.Devices.Common.Codec;
using PepperDash.Essentials.Devices.Common.VideoCodec;
+using PepperDash.Essentials.Devices.Common.AudioCodec;
namespace PepperDash.Essentials
{
@@ -22,6 +23,8 @@ namespace PepperDash.Essentials
public VideoCodecBaseMessenger VCMessenger { get; private set; }
+ public AudioCodecBaseMessenger ACMessenger { get; private set; }
+
///
///
///
@@ -92,30 +95,25 @@ namespace PepperDash.Essentials
sscRoom.CurrentSingleSourceChange += new SourceInfoChangeHandler(Room_CurrentSingleSourceChange);
var vcRoom = Room as IHasVideoCodec;
- if (vcRoom != null)
+ if (vcRoom != null && vcRoom.VideoCodec != null)
{
var codec = vcRoom.VideoCodec;
var key = vcRoom.VideoCodec.Key + "-" + parent.Key;
VCMessenger = new VideoCodecBaseMessenger(key, vcRoom.VideoCodec, "/device/videoCodec");
VCMessenger.RegisterWithAppServer(Parent);
- // May need to move this or remove this
- //codec.CallStatusChange += new EventHandler(codec_CallStatusChange);
-
vcRoom.IsSharingFeedback.OutputChange += new EventHandler(IsSharingFeedback_OutputChange);
-
- //Parent.AddAction("/device/videoCodec/dial", new Action(s => codec.Dial(s)));
- //Parent.AddAction("/device/videoCodec/endCall", new Action(s =>
- //{
- // var call = codec.ActiveCalls.FirstOrDefault(c => c.Id == s);
- // if (call != null)
- // {
- // codec.EndCall(call);
- // }
- //}));
- //Parent.AddAction("/device/videoCodec/endAllCalls", new Action(() => codec.EndAllCalls()));
}
+ var acRoom = Room as IHasAudioCodec;
+ if (acRoom != null && acRoom.AudioCodec != null)
+ {
+ var codec = acRoom.AudioCodec;
+ var key = acRoom.AudioCodec.Key + "-" + parent.Key;
+ ACMessenger = new AudioCodecBaseMessenger(key, acRoom.AudioCodec, "/device/audioCodec");
+ ACMessenger.RegisterWithAppServer(Parent);
+ }
+
var defCallRm = Room as IRunDefaultCallRoute;
if (defCallRm != null)
{
diff --git a/PepperDashEssentials/PepperDashEssentials.csproj b/PepperDashEssentials/PepperDashEssentials.csproj
index 6957f8c5..7270eaf5 100644
--- a/PepperDashEssentials/PepperDashEssentials.csproj
+++ b/PepperDashEssentials/PepperDashEssentials.csproj
@@ -109,6 +109,7 @@
+
diff --git a/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs b/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs
index 72b0d7f7..62b11e49 100644
--- a/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs
+++ b/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs
@@ -12,11 +12,12 @@ using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Room.Config;
using PepperDash.Essentials.Devices.Common.Codec;
using PepperDash.Essentials.Devices.Common.VideoCodec;
+using PepperDash.Essentials.Devices.Common.AudioCodec;
namespace PepperDash.Essentials
{
public class EssentialsHuddleVtc1Room : EssentialsRoomBase, IHasCurrentSourceInfoChange,
- IPrivacy, IHasCurrentVolumeControls, IRunRouteAction, IRunDefaultCallRoute, IHasVideoCodec
+ IPrivacy, IHasCurrentVolumeControls, IRunRouteAction, IRunDefaultCallRoute, IHasVideoCodec, IHasAudioCodec
{
public event EventHandler CurrentVolumeDeviceChange;
public event SourceInfoChangeHandler CurrentSingleSourceChange;
@@ -27,10 +28,10 @@ namespace PepperDash.Essentials
public BoolFeedback InCallFeedback { get; private set; }
- ///
- /// Make this more specific
- ///
- public List ActiveCalls { get; private set; }
+ /////
+ ///// Make this more specific
+ /////
+ //public List ActiveCalls { get; private set; }
///
/// States: 0 for on hook, 1 for video, 2 for audio, 3 for telekenesis
@@ -108,6 +109,8 @@ namespace PepperDash.Essentials
public VideoCodecBase VideoCodec { get; private set; }
+ public AudioCodecBase AudioCodec { get; private set; }
+
public bool ExcludeFromGlobalFunctions { get; set; }
///
@@ -197,7 +200,6 @@ namespace PepperDash.Essentials
CCriticalSection SourceSelectLock = new CCriticalSection();
-
public EssentialsHuddleVtc1Room(DeviceConfig config)
: base(config)
{
@@ -212,6 +214,11 @@ namespace PepperDash.Essentials
if (VideoCodec == null)
throw new ArgumentNullException("codec cannot be null");
+ AudioCodec = DeviceManager.GetDeviceForKey(PropertiesConfig.AudioCodecKey) as
+ PepperDash.Essentials.Devices.Common.AudioCodec.AudioCodecBase;
+ if (AudioCodec == null)
+ Debug.Console(0, this, "No Audio Codec Found");
+
DefaultAudioDevice = DeviceManager.GetDeviceForKey(PropertiesConfig.DefaultAudioKey) as IBasicVolumeControls;
Initialize();
@@ -261,9 +268,30 @@ namespace PepperDash.Essentials
};
}
- InCallFeedback = new BoolFeedback(() => VideoCodec.IsInCall);
+
+ // 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 = AudioCodec.IsInCall;
+
+ if (inAudioCall || inVideoCall)
+ return true;
+ else
+ return false;
+ });
+
VideoCodec.CallStatusChange += (o, a) => this.InCallFeedback.FireUpdate();
+ if (AudioCodec != null)
+ AudioCodec.CallStatusChange += (o, a) => this.InCallFeedback.FireUpdate();
+
IsSharingFeedback = new BoolFeedback(() => VideoCodec.SharingContentIsOnFeedback.BoolValue);
VideoCodec.SharingContentIsOnFeedback.OutputChange += (o, a) => this.IsSharingFeedback.FireUpdate();
diff --git a/PepperDashEssentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs b/PepperDashEssentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs
index be65410e..13bf6a85 100644
--- a/PepperDashEssentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs
+++ b/PepperDashEssentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs
@@ -484,9 +484,9 @@ namespace PepperDash.Essentials.UIDrivers.VC
TriList.SetString(timeTextOffset + i, timeText);
string iconName = null;
- if (c.OccurenceType == eCodecOccurrenceType.Received)
+ if (c.OccurrenceType == eCodecOccurrenceType.Received)
iconName = "Misc-18_Light";
- else if (c.OccurenceType == eCodecOccurrenceType.Placed)
+ else if (c.OccurrenceType == eCodecOccurrenceType.Placed)
iconName = "Misc-17_Light";
else
iconName = "Delete";