Merge remote-tracking branch 'origin/feature/ecs-994' into JTA

This commit is contained in:
Jason T Alborough
2019-01-10 10:51:38 -05:00
10 changed files with 323 additions and 121 deletions

View File

@@ -47,6 +47,8 @@ namespace PepperDash.Essentials
long ServerReconnectInterval = 5000; long ServerReconnectInterval = 5000;
DateTime LastAckMessage;
string SystemUuid; string SystemUuid;
List<CotijaBridgeBase> RoomBridges = new List<CotijaBridgeBase>(); List<CotijaBridgeBase> RoomBridges = new List<CotijaBridgeBase>();
@@ -307,14 +309,17 @@ namespace PepperDash.Essentials
code = "Not available"; code = "Not available";
} }
var conn = WSClient == null ? "No client" : (WSClient.Connected ? "Yes" : "No"); var conn = WSClient == null ? "No client" : (WSClient.Connected ? "Yes" : "No");
var secSinceLastAck = DateTime.Now - LastAckMessage;
CrestronConsole.ConsoleCommandResponse(@"Mobile Control Information: CrestronConsole.ConsoleCommandResponse(@"Mobile Control Information:
Server address: {0} Server address: {0}
System Name: {1} System Name: {1}
System UUID: {2} System UUID: {2}
System User code: {3} System User code: {3}
Connected?: {4}", url, name, SystemUuid, Connected?: {4}
code, conn); Seconds Since Last Ack: {5}", url, name, SystemUuid,
code, conn, secSinceLastAck.Seconds);
} }
/// <summary> /// <summary>
@@ -430,7 +435,12 @@ namespace PepperDash.Essentials
if (WSClient != null && WSClient.Connected) if (WSClient != null && WSClient.Connected)
{ {
string message = JsonConvert.SerializeObject(o, Formatting.None, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }); string message = JsonConvert.SerializeObject(o, Formatting.None, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
Debug.Console(1, this, "Message TX: {0}", message);
if (!message.Contains("/system/heartbeat"))
Debug.Console(1, this, "Message TX: {0}", message);
//else
// Debug.Console(1, this, "TX messages contains /system/heartbeat");
var messageBytes = System.Text.Encoding.UTF8.GetBytes(message); var messageBytes = System.Text.Encoding.UTF8.GetBytes(message);
var result = WSClient.Send(messageBytes, (uint)messageBytes.Length, WebSocketClient.WEBSOCKET_PACKET_TYPES.LWS_WS_OPCODE_07__TEXT_FRAME); var result = WSClient.Send(messageBytes, (uint)messageBytes.Length, WebSocketClient.WEBSOCKET_PACKET_TYPES.LWS_WS_OPCODE_07__TEXT_FRAME);
if (result != WebSocketClient.WEBSOCKET_RESULT_CODES.WEBSOCKET_CLIENT_SUCCESS) if (result != WebSocketClient.WEBSOCKET_RESULT_CODES.WEBSOCKET_CLIENT_SUCCESS)
@@ -656,7 +666,14 @@ namespace PepperDash.Essentials
if(string.IsNullOrEmpty(message)) if(string.IsNullOrEmpty(message))
return; return;
Debug.Console(1, this, "Message RX: {0}", message); if (!message.Contains("/system/heartbeat"))
Debug.Console(1, this, "Message RX: {0}", message);
else
{
LastAckMessage = DateTime.Now;
//Debug.Console(1, this, "RX message contains /system/heartbeat");
}
try try
{ {
var messageObj = JObject.Parse(message); var messageObj = JObject.Parse(message);

View File

@@ -31,11 +31,19 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// <summary> /// <summary>
/// 211 /// 211
/// </summary> /// </summary>
const uint SCurrentCallString = 211; const uint SCurrentCallNumber = 211;
/// <summary>
/// 212
/// </summary>
const uint SCurrentCallName = 212;
/// <summary> /// <summary>
/// 221 /// 221
/// </summary> /// </summary>
const uint SHookState = 221; const uint SHookState = 221;
/// <summary>
/// 222
/// </summary>
const uint SCallDirection = 222;
/// <summary> /// <summary>
/// ///
@@ -79,12 +87,14 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// </summary> /// </summary>
void SendFullStatus() void SendFullStatus()
{ {
this.PostStatusMessage(new this.PostStatusMessage(new
{ {
calls = GetCurrentCallList(), calls = GetCurrentCallList(),
callStatus = EISC.GetString(SHookState), currentCallString = EISC.GetString(SCurrentCallNumber),
currentCallString = EISC.GetString(SCurrentCallString),
currentDialString = EISC.GetString(SCurrentDialString), currentDialString = EISC.GetString(SCurrentDialString),
isInCall = EISC.GetString(SHookState) == "Connected"
}); });
} }
@@ -94,31 +104,33 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// <param name="appServerController"></param> /// <param name="appServerController"></param>
protected override void CustomRegisterWithAppServer(CotijaSystemController appServerController) protected override void CustomRegisterWithAppServer(CotijaSystemController appServerController)
{ {
Action<object> send = this.PostStatusMessage; //EISC.SetStringSigAction(SCurrentDialString, s => PostStatusMessage(new { currentDialString = s }));
EISC.SetStringSigAction(SCurrentDialString, s => send(new { currentDialString = s }));
EISC.SetStringSigAction(SHookState, s => EISC.SetStringSigAction(SHookState, s =>
{ {
CurrentCallItem.Status = (eCodecCallStatus)Enum.Parse(typeof(eCodecCallStatus), s, true); CurrentCallItem.Status = (eCodecCallStatus)Enum.Parse(typeof(eCodecCallStatus), s, true);
GetCurrentCallList(); //GetCurrentCallList();
send(new SendCallsList();
{
calls = GetCurrentCallList(),
callStatus = s
});
}); });
EISC.SetStringSigAction(SCurrentCallString, s => EISC.SetStringSigAction(SCurrentCallNumber, s =>
{ {
CurrentCallItem.Name = s;
CurrentCallItem.Number = s; CurrentCallItem.Number = s;
send(new SendCallsList();
{
calls = GetCurrentCallList(),
currentCallString = s
});
}); });
EISC.SetStringSigAction(SCurrentCallName, s =>
{
CurrentCallItem.Name = s;
SendCallsList();
});
EISC.SetStringSigAction(SCallDirection, s =>
{
CurrentCallItem.Direction = (eCodecCallDirection)Enum.Parse(typeof(eCodecCallDirection), s, true);
SendCallsList();
});
// Add press and holds using helper // Add press and holds using helper
Action<string, uint> addPHAction = (s, u) => Action<string, uint> addPHAction = (s, u) =>
AppServerController.AddAction(MessagePath + s, new PressAndHoldAction(b => EISC.SetBool(u, b))); AppServerController.AddAction(MessagePath + s, new PressAndHoldAction(b => EISC.SetBool(u, b)));
@@ -126,9 +138,9 @@ namespace PepperDash.Essentials.AppServer.Messengers
// Add straight pulse calls // Add straight pulse calls
Action<string, uint> addAction = (s, u) => Action<string, uint> addAction = (s, u) =>
AppServerController.AddAction(MessagePath + s, new Action(() => EISC.PulseBool(u, 100))); AppServerController.AddAction(MessagePath + s, new Action(() => EISC.PulseBool(u, 100)));
addAction("/endCall", BDialHangup); addAction("/endCallById", BDialHangup);
addAction("/incomingAnswer", BIncomingAnswer); addAction("/acceptById", BIncomingAnswer);
addAction("/incomingReject", BIncomingReject); addAction("/rejectById", BIncomingReject);
addAction("/speedDial1", BSpeedDial1); addAction("/speedDial1", BSpeedDial1);
addAction("/speedDial2", BSpeedDial2); addAction("/speedDial2", BSpeedDial2);
addAction("/speedDial3", BSpeedDial3); addAction("/speedDial3", BSpeedDial3);
@@ -148,6 +160,14 @@ namespace PepperDash.Essentials.AppServer.Messengers
})); }));
} }
void SendCallsList()
{
PostStatusMessage(new
{
calls = GetCurrentCallList(),
});
}
/// <summary> /// <summary>
/// Turns the /// Turns the
/// </summary> /// </summary>

View File

@@ -0,0 +1,102 @@
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
{
/// <summary>
/// Provides a messaging bridge for an AudioCodecBase device
/// </summary>
public class AudioCodecBaseMessenger : MessengerBase
{
/// <summary>
/// Device being bridged
/// </summary>
public AudioCodecBase Codec { get; set; }
/// <summary>
/// Constuctor
/// </summary>
/// <param name="key"></param>
/// <param name="codec"></param>
/// <param name="messagePath"></param>
public AudioCodecBaseMessenger(string key, AudioCodecBase codec, string messagePath)
: base(key, messagePath)
{
if (codec == null)
throw new ArgumentNullException("codec");
Codec = codec;
codec.CallStatusChange += new EventHandler<CodecCallStatusItemChangeEventArgs>(codec_CallStatusChange);
}
protected override void CustomRegisterWithAppServer(CotijaSystemController appServerController)
{
appServerController.AddAction(MessagePath + "/fullStatus", new Action(SendAtcFullMessageObject));
appServerController.AddAction(MessagePath + "/dial", new Action<string>(s => Codec.Dial(s)));
appServerController.AddAction(MessagePath + "/endCallById", new Action<string>(s =>
{
var call = GetCallWithId(s);
if (call != null)
Codec.EndCall(call);
}));
appServerController.AddAction(MessagePath + "/endAllCalls", new Action(Codec.EndAllCalls));
appServerController.AddAction(MessagePath + "/dtmf", new Action<string>(s => Codec.SendDtmf(s)));
appServerController.AddAction(MessagePath + "/rejectById", new Action<string>(s =>
{
var call = GetCallWithId(s);
if (call != null)
Codec.RejectCall(call);
}));
appServerController.AddAction(MessagePath + "/acceptById", new Action<string>(s =>
{
var call = GetCallWithId(s);
if (call != null)
Codec.AcceptCall(call);
}));
}
/// <summary>
/// Helper to grab a call with string ID
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
CodecActiveCallItem GetCallWithId(string id)
{
return Codec.ActiveCalls.FirstOrDefault(c => c.Id == id);
}
void codec_CallStatusChange(object sender, CodecCallStatusItemChangeEventArgs e)
{
SendAtcFullMessageObject();
}
/// <summary>
/// Helper method to build call status for vtc
/// </summary>
/// <returns></returns>
void SendAtcFullMessageObject()
{
var info = Codec.CodecInfo;
PostStatusMessage(new
{
isInCall = Codec.IsInCall,
calls = Codec.ActiveCalls,
info = new
{
phoneNumber = info.PhoneNumber
}
});
}
}
}

View File

@@ -27,8 +27,10 @@ namespace PepperDash.Essentials.AppServer.Messengers
foreach (var p in SysMon.ProgramStatusFeedbackCollection) foreach (var p in SysMon.ProgramStatusFeedbackCollection)
{ {
p.Value.AggregatedProgramInfoFeedback.OutputChange += new EventHandler<PepperDash.Essentials.Core.FeedbackEventArgs>(AggregatedProgramInfoFeedback_OutputChange); p.Value.ProgramInfoChanged += new EventHandler<ProgramInfoEventArgs>(ProgramInfoChanged);
} }
CrestronConsole.AddNewConsoleCommand(s => SendFullStatusMessage(), "SendFullSysMonStatus", "Sends the full System Monitor Status", ConsoleAccessLevelEnum.AccessOperator);
} }
/// <summary> /// <summary>
@@ -36,19 +38,10 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// </summary> /// </summary>
/// <param name="sender"></param> /// <param name="sender"></param>
/// <param name="e"></param> /// <param name="e"></param>
void AggregatedProgramInfoFeedback_OutputChange(object sender, PepperDash.Essentials.Core.FeedbackEventArgs e) void ProgramInfoChanged(object sender, ProgramInfoEventArgs e)
{ {
SendProgramInfoStatusMessage(e.StringValue); Debug.Console(1, "Posting Status Message: {0}", e.ProgramInfo.ToString());
} PostStatusMessage(e.ProgramInfo);
// Deserializes the program info into an object that can be setn in a status message
void SendProgramInfoStatusMessage(string serializedProgramInfo)
{
var programInfo = JsonConvert.DeserializeObject<ProgramInfo>(serializedProgramInfo);
Debug.Console(2, "Posting Status Message: {0}", programInfo.ToString());
PostStatusMessage(programInfo);
} }
/// <summary> /// <summary>
@@ -67,13 +60,13 @@ namespace PepperDash.Essentials.AppServer.Messengers
foreach (var p in SysMon.ProgramStatusFeedbackCollection) foreach (var p in SysMon.ProgramStatusFeedbackCollection)
{ {
SendProgramInfoStatusMessage(p.Value.AggregatedProgramInfoFeedback.StringValue); PostStatusMessage(p.Value.ProgramInfo);
} }
} }
void SendSystemMonitorStatusMessage() void SendSystemMonitorStatusMessage()
{ {
Debug.Console(2, "Posting System Monitor Status Message."); Debug.Console(1, "Posting System Monitor Status Message.");
// This takes a while, launch a new thread // This takes a while, launch a new thread
CrestronInvoke.BeginInvoke((o) => CrestronInvoke.BeginInvoke((o) =>

View File

@@ -13,7 +13,7 @@ using PepperDash.Essentials.Devices.Common.VideoCodec;
namespace PepperDash.Essentials.AppServer.Messengers namespace PepperDash.Essentials.AppServer.Messengers
{ {
/// <summary> /// <summary>
/// Provides a messaging bridge for a VideoCodecBase /// Provides a messaging bridge for a VideoCodecBase device
/// </summary> /// </summary>
public class VideoCodecBaseMessenger : MessengerBase public class VideoCodecBaseMessenger : MessengerBase
{ {
@@ -41,7 +41,31 @@ namespace PepperDash.Essentials.AppServer.Messengers
{ {
dirCodec.DirectoryResultReturned += new EventHandler<DirectoryEventArgs>(dirCodec_DirectoryResultReturned); dirCodec.DirectoryResultReturned += new EventHandler<DirectoryEventArgs>(dirCodec_DirectoryResultReturned);
} }
var recCodec = codec as IHasCallHistory;
if (recCodec != null)
{
recCodec.CallHistory.RecentCallsListHasChanged += new EventHandler<EventArgs>(CallHistory_RecentCallsListHasChanged);
}
} }
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void CallHistory_RecentCallsListHasChanged(object sender, EventArgs e)
{
var recents = (sender as CodecCallHistory).RecentCalls;
if (recents != null)
{
PostStatusMessage(new
{
recentCalls = recents
});
}
}
/// <summary> /// <summary>
/// ///
@@ -50,7 +74,6 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// <param name="e"></param> /// <param name="e"></param>
void dirCodec_DirectoryResultReturned(object sender, DirectoryEventArgs e) void dirCodec_DirectoryResultReturned(object sender, DirectoryEventArgs e)
{ {
var dir = e.Directory;
PostStatusMessage(new PostStatusMessage(new
{ {
currentDirectory = e.Directory currentDirectory = e.Directory
@@ -102,6 +125,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
appServerController.AddAction(MessagePath + "/directoryRoot", new Action(GetDirectoryRoot)); appServerController.AddAction(MessagePath + "/directoryRoot", new Action(GetDirectoryRoot));
appServerController.AddAction(MessagePath + "/directoryById", new Action<string>(s => GetDirectory(s))); appServerController.AddAction(MessagePath + "/directoryById", new Action<string>(s => GetDirectory(s)));
appServerController.AddAction(MessagePath + "/directorySearch", new Action<string>(s => DirectorySearch(s))); appServerController.AddAction(MessagePath + "/directorySearch", new Action<string>(s => DirectorySearch(s)));
appServerController.AddAction(MessagePath + "/getCallHistory", new Action(GetCallHistory));
appServerController.AddAction(MessagePath + "/privacyModeOn", new Action(Codec.PrivacyModeOn)); appServerController.AddAction(MessagePath + "/privacyModeOn", new Action(Codec.PrivacyModeOn));
appServerController.AddAction(MessagePath + "/privacyModeOff", new Action(Codec.PrivacyModeOff)); appServerController.AddAction(MessagePath + "/privacyModeOff", new Action(Codec.PrivacyModeOff));
appServerController.AddAction(MessagePath + "/privacyModeToggle", new Action(Codec.PrivacyModeToggle)); appServerController.AddAction(MessagePath + "/privacyModeToggle", new Action(Codec.PrivacyModeToggle));
@@ -111,6 +135,24 @@ namespace PepperDash.Essentials.AppServer.Messengers
appServerController.AddAction(MessagePath + "/standbyOff", new Action(Codec.StandbyDeactivate)); appServerController.AddAction(MessagePath + "/standbyOff", new Action(Codec.StandbyDeactivate));
} }
void GetCallHistory()
{
var codec = (Codec as IHasCallHistory);
if (codec != null)
{
var recents = codec.CallHistory.RecentCalls;
if (recents != null)
{
PostStatusMessage(new
{
recentCalls = recents
});
}
}
}
public void GetFullStatusMessage() public void GetFullStatusMessage()
{ {
@@ -228,7 +270,9 @@ namespace PepperDash.Essentials.AppServer.Messengers
sipURI = info.SipUri sipURI = info.SipUri
}, },
showSelfViewByDefault = Codec.ShowSelfViewByDefault, showSelfViewByDefault = Codec.ShowSelfViewByDefault,
hasDirectory = Codec is IHasDirectory hasDirectory = Codec is IHasDirectory,
hasRecents = Codec is IHasCallHistory,
hasCameras = Codec is IHasCameraControl
}); });
} }
} }

View File

@@ -12,6 +12,7 @@ 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;
using PepperDash.Essentials.Devices.Common.VideoCodec; using PepperDash.Essentials.Devices.Common.VideoCodec;
using PepperDash.Essentials.Devices.Common.AudioCodec;
namespace PepperDash.Essentials namespace PepperDash.Essentials
{ {
@@ -22,6 +23,8 @@ namespace PepperDash.Essentials
public VideoCodecBaseMessenger VCMessenger { get; private set; } public VideoCodecBaseMessenger VCMessenger { get; private set; }
public AudioCodecBaseMessenger ACMessenger { get; private set; }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@@ -92,30 +95,25 @@ namespace PepperDash.Essentials
sscRoom.CurrentSingleSourceChange += new SourceInfoChangeHandler(Room_CurrentSingleSourceChange); sscRoom.CurrentSingleSourceChange += new SourceInfoChangeHandler(Room_CurrentSingleSourceChange);
var vcRoom = Room as IHasVideoCodec; var vcRoom = Room as IHasVideoCodec;
if (vcRoom != null) if (vcRoom != null && vcRoom.VideoCodec != null)
{ {
var codec = vcRoom.VideoCodec; var codec = vcRoom.VideoCodec;
var key = vcRoom.VideoCodec.Key + "-" + parent.Key; var key = vcRoom.VideoCodec.Key + "-" + parent.Key;
VCMessenger = new VideoCodecBaseMessenger(key, vcRoom.VideoCodec, "/device/videoCodec"); VCMessenger = new VideoCodecBaseMessenger(key, vcRoom.VideoCodec, "/device/videoCodec");
VCMessenger.RegisterWithAppServer(Parent); VCMessenger.RegisterWithAppServer(Parent);
// May need to move this or remove this
codec.CallStatusChange += new EventHandler<CodecCallStatusItemChangeEventArgs>(codec_CallStatusChange);
vcRoom.IsSharingFeedback.OutputChange += new EventHandler<FeedbackEventArgs>(IsSharingFeedback_OutputChange); vcRoom.IsSharingFeedback.OutputChange += new EventHandler<FeedbackEventArgs>(IsSharingFeedback_OutputChange);
//Parent.AddAction("/device/videoCodec/dial", new Action<string>(s => codec.Dial(s)));
//Parent.AddAction("/device/videoCodec/endCall", new Action<string>(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; var defCallRm = Room as IRunDefaultCallRoute;
if (defCallRm != null) if (defCallRm != null)
{ {
@@ -170,18 +168,18 @@ namespace PepperDash.Essentials
}); });
} }
/// <summary> ///// <summary>
/// Handler for codec changes ///// Handler for codec changes
/// </summary> ///// </summary>
void codec_CallStatusChange(object sender, CodecCallStatusItemChangeEventArgs e) //void codec_CallStatusChange(object sender, CodecCallStatusItemChangeEventArgs e)
{ //{
PostStatusMessage(new // PostStatusMessage(new
{ // {
calls = GetCallsMessageObject(), // calls = GetCallsMessageObject(),
//vtc = GetVtcCallsMessageObject() // //vtc = GetVtcCallsMessageObject()
}); // });
} //}
/// <summary> /// <summary>
/// Helper for posting status message /// Helper for posting status message
@@ -426,52 +424,52 @@ namespace PepperDash.Essentials
PostStatusMessage(new PostStatusMessage(new
{ {
calls = GetCallsMessageObject(), //calls = GetCallsMessageObject(),
isOn = room.OnFeedback.BoolValue, isOn = room.OnFeedback.BoolValue,
selectedSourceKey = sourceKey, selectedSourceKey = sourceKey,
vtc = GetVtcCallsMessageObject(), //vtc = GetVtcCallsMessageObject(),
volumes = volumes volumes = volumes
}); });
} }
/// <summary> ///// <summary>
/// Helper to return a anonymous object with the call data for JSON message ///// Helper to return a anonymous object with the call data for JSON message
/// </summary> ///// </summary>
/// <returns></returns> ///// <returns></returns>
object GetCallsMessageObject() //object GetCallsMessageObject()
{ //{
var callRm = Room as IHasVideoCodec; // var callRm = Room as IHasVideoCodec;
if (callRm == null) // if (callRm == null)
return null; // return null;
return new // return new
{ // {
activeCalls = callRm.VideoCodec.ActiveCalls, // activeCalls = callRm.VideoCodec.ActiveCalls,
callType = callRm.CallTypeFeedback.IntValue, // callType = callRm.CallTypeFeedback.IntValue,
inCall = callRm.InCallFeedback.BoolValue, // inCall = callRm.InCallFeedback.BoolValue,
isSharing = callRm.IsSharingFeedback.BoolValue, // isSharing = callRm.IsSharingFeedback.BoolValue,
privacyModeIsOn = callRm.PrivacyModeIsOnFeedback.BoolValue // privacyModeIsOn = callRm.PrivacyModeIsOnFeedback.BoolValue
}; // };
} //}
/// <summary> ///// <summary>
/// Helper method to build call status for vtc ///// Helper method to build call status for vtc
/// </summary> ///// </summary>
/// <returns></returns> ///// <returns></returns>
object GetVtcCallsMessageObject() //object GetVtcCallsMessageObject()
{ //{
var callRm = Room as IHasVideoCodec; // var callRm = Room as IHasVideoCodec;
object vtc = null; // object vtc = null;
if (callRm != null) // if (callRm != null)
{ // {
var codec = callRm.VideoCodec; // var codec = callRm.VideoCodec;
vtc = new // vtc = new
{ // {
isInCall = codec.IsInCall, // isInCall = codec.IsInCall,
calls = codec.ActiveCalls // calls = codec.ActiveCalls
}; // };
} // }
return vtc; // return vtc;
} //}
} }
/// <summary> /// <summary>

View File

@@ -212,12 +212,13 @@ namespace PepperDash.Essentials
void Load() void Load()
{ {
LoadDevices(); LoadDevices();
LinkSystemMonitorToAppServer();
LoadTieLines(); LoadTieLines();
LoadRooms(); LoadRooms();
LoadLogoServer(); LoadLogoServer();
DeviceManager.ActivateAll(); DeviceManager.ActivateAll();
LinkSystemMonitorToAppServer();
} }
void LinkSystemMonitorToAppServer() void LinkSystemMonitorToAppServer()
@@ -235,9 +236,7 @@ namespace PepperDash.Essentials
messenger.RegisterWithAppServer(appServer); messenger.RegisterWithAppServer(appServer);
DeviceManager.AddDevice(messenger); DeviceManager.AddDevice(messenger);
} }
} }

View File

@@ -109,6 +109,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="AppServer\Messengers\AtcDdvc01Messenger.cs" /> <Compile Include="AppServer\Messengers\AtcDdvc01Messenger.cs" />
<Compile Include="AppServer\Messengers\AudioCodecBaseMessenger.cs" />
<Compile Include="AppServer\Messengers\MessengerBase.cs" /> <Compile Include="AppServer\Messengers\MessengerBase.cs" />
<Compile Include="AppServer\Messengers\SystemMonitorMessenger.cs" /> <Compile Include="AppServer\Messengers\SystemMonitorMessenger.cs" />
<Compile Include="AppServer\Messengers\VideoCodecBaseMessenger.cs" /> <Compile Include="AppServer\Messengers\VideoCodecBaseMessenger.cs" />

View File

@@ -12,11 +12,12 @@ using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Room.Config; using PepperDash.Essentials.Room.Config;
using PepperDash.Essentials.Devices.Common.Codec; using PepperDash.Essentials.Devices.Common.Codec;
using PepperDash.Essentials.Devices.Common.VideoCodec; using PepperDash.Essentials.Devices.Common.VideoCodec;
using PepperDash.Essentials.Devices.Common.AudioCodec;
namespace PepperDash.Essentials namespace PepperDash.Essentials
{ {
public class EssentialsHuddleVtc1Room : EssentialsRoomBase, IHasCurrentSourceInfoChange, public class EssentialsHuddleVtc1Room : EssentialsRoomBase, IHasCurrentSourceInfoChange,
IPrivacy, IHasCurrentVolumeControls, IRunRouteAction, IRunDefaultCallRoute, IHasVideoCodec IPrivacy, IHasCurrentVolumeControls, IRunRouteAction, IRunDefaultCallRoute, IHasVideoCodec, IHasAudioCodec
{ {
public event EventHandler<VolumeDeviceChangeEventArgs> CurrentVolumeDeviceChange; public event EventHandler<VolumeDeviceChangeEventArgs> CurrentVolumeDeviceChange;
public event SourceInfoChangeHandler CurrentSingleSourceChange; public event SourceInfoChangeHandler CurrentSingleSourceChange;
@@ -27,10 +28,10 @@ namespace PepperDash.Essentials
public BoolFeedback InCallFeedback { get; private set; } public BoolFeedback InCallFeedback { get; private set; }
/// <summary> ///// <summary>
/// Make this more specific ///// Make this more specific
/// </summary> ///// </summary>
public List<CodecActiveCallItem> ActiveCalls { get; private set; } //public List<CodecActiveCallItem> ActiveCalls { get; private set; }
/// <summary> /// <summary>
/// States: 0 for on hook, 1 for video, 2 for audio, 3 for telekenesis /// 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 VideoCodecBase VideoCodec { get; private set; }
public AudioCodecBase AudioCodec { get; private set; }
public bool ExcludeFromGlobalFunctions { get; set; } public bool ExcludeFromGlobalFunctions { get; set; }
/// <summary> /// <summary>
@@ -197,7 +200,6 @@ namespace PepperDash.Essentials
CCriticalSection SourceSelectLock = new CCriticalSection(); CCriticalSection SourceSelectLock = new CCriticalSection();
public EssentialsHuddleVtc1Room(DeviceConfig config) public EssentialsHuddleVtc1Room(DeviceConfig config)
: base(config) : base(config)
{ {
@@ -212,6 +214,11 @@ namespace PepperDash.Essentials
if (VideoCodec == null) if (VideoCodec == null)
throw new ArgumentNullException("codec cannot be 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; DefaultAudioDevice = DeviceManager.GetDeviceForKey(PropertiesConfig.DefaultAudioKey) as IBasicVolumeControls;
Initialize(); 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(); VideoCodec.CallStatusChange += (o, a) => this.InCallFeedback.FireUpdate();
if (AudioCodec != null)
AudioCodec.CallStatusChange += (o, a) => this.InCallFeedback.FireUpdate();
IsSharingFeedback = new BoolFeedback(() => VideoCodec.SharingContentIsOnFeedback.BoolValue); IsSharingFeedback = new BoolFeedback(() => VideoCodec.SharingContentIsOnFeedback.BoolValue);
VideoCodec.SharingContentIsOnFeedback.OutputChange += (o, a) => this.IsSharingFeedback.FireUpdate(); VideoCodec.SharingContentIsOnFeedback.OutputChange += (o, a) => this.IsSharingFeedback.FireUpdate();

View File

@@ -484,9 +484,9 @@ namespace PepperDash.Essentials.UIDrivers.VC
TriList.SetString(timeTextOffset + i, timeText); TriList.SetString(timeTextOffset + i, timeText);
string iconName = null; string iconName = null;
if (c.OccurenceType == eCodecOccurrenceType.Received) if (c.OccurrenceType == eCodecOccurrenceType.Received)
iconName = "Misc-18_Light"; iconName = "Misc-18_Light";
else if (c.OccurenceType == eCodecOccurrenceType.Placed) else if (c.OccurrenceType == eCodecOccurrenceType.Placed)
iconName = "Misc-17_Light"; iconName = "Misc-17_Light";
else else
iconName = "Delete"; iconName = "Delete";