mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-01-27 19:34:51 +00:00
Tuning up InCall statuses, removed ActiveCallCountFB
This commit is contained in:
@@ -20,5 +20,20 @@ namespace PepperDash.Essentials.Devices.Common.Codec
|
||||
public string Id { get; set; }
|
||||
|
||||
public object CallMetaData { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns true when this call is NOT status Unkown,
|
||||
/// Disconnected, Disconnecting
|
||||
/// </summary>
|
||||
public bool IsActiveCall
|
||||
{
|
||||
get
|
||||
{
|
||||
return
|
||||
!(Status == eCodecCallStatus.Disconnected
|
||||
|| Status == eCodecCallStatus.Disconnecting
|
||||
|| Status ==eCodecCallStatus.Unknown);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,10 +5,21 @@ using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Codec
|
||||
|
||||
{
|
||||
public enum eCodecCallStatus
|
||||
{
|
||||
Unknown = 0, Dialing, Connected, Connecting, Incoming, OnHold, Disconnected
|
||||
Connected,
|
||||
Connecting,
|
||||
Dialing,
|
||||
Disconnected,
|
||||
Disconnecting,
|
||||
EarlyMedia,
|
||||
Idle,
|
||||
Incoming,
|
||||
OnHold,
|
||||
Ringing,
|
||||
Preserved,
|
||||
RemotePreserved,
|
||||
Unknown = 0
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,7 @@ namespace PepperDash.Essentials.Devices.Common.Codec
|
||||
void RejectCall(CodecActiveCallItem item);
|
||||
void SendDtmf(string digit);
|
||||
|
||||
IntFeedback ActiveCallCountFeedback { get; }
|
||||
//IntFeedback ActiveCallCountFeedback { get; }
|
||||
BoolFeedback IncomingCallFeedback { get; }
|
||||
}
|
||||
}
|
||||
@@ -799,11 +799,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
{
|
||||
SendText("xCommand SystemUnit Boot Action: Restart");
|
||||
}
|
||||
|
||||
protected override Func<int> ActiveCallCountFeedbackFunc
|
||||
{
|
||||
get { return () => 0; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
|
||||
: base(key, name)
|
||||
{
|
||||
// Debug helpers
|
||||
ActiveCallCountFeedback.OutputChange += (o, a) => Debug.Console(1, this, "InCall={0}", ActiveCallCountFeedback.IntValue);
|
||||
//ActiveCallCountFeedback.OutputChange += (o, a) => Debug.Console(1, this, "InCall={0}", ActiveCallCountFeedback.IntValue);
|
||||
IncomingCallFeedback.OutputChange += (o, a) => Debug.Console(1, this, "IncomingCall={0}", _IncomingCall);
|
||||
MuteFeedback.OutputChange += (o, a) => Debug.Console(1, this, "Mute={0}", _IsMuted);
|
||||
PrivacyModeIsOnFeedback.OutputChange += (o, a) => Debug.Console(1, this, "Privacy={0}", _PrivacyModeIsOn);
|
||||
@@ -25,11 +25,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
|
||||
VolumeLevelFeedback.OutputChange += (o, a) => Debug.Console(1, this, "Volume={0}", _VolumeLevel);
|
||||
}
|
||||
|
||||
protected override Func<int> ActiveCallCountFeedbackFunc
|
||||
{
|
||||
get { return () => ActiveCalls.Count; }
|
||||
}
|
||||
|
||||
protected override Func<bool> IncomingCallFeedbackFunc
|
||||
{
|
||||
get { return () => _IncomingCall; }
|
||||
@@ -69,7 +64,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
|
||||
var call = new CodecActiveCallItem() { Name = s, Number = s, Id = s, Status = eCodecCallStatus.Dialing };
|
||||
ActiveCalls.Add(call);
|
||||
OnCallStatusChange(eCodecCallStatus.Unknown, call.Status, call);
|
||||
ActiveCallCountFeedback.FireUpdate();
|
||||
//ActiveCallCountFeedback.FireUpdate();
|
||||
// Simulate 2-second ring, then connecting, then connected
|
||||
new CTimer(o =>
|
||||
{
|
||||
@@ -86,9 +81,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
|
||||
{
|
||||
Debug.Console(1, this, "EndCall");
|
||||
ActiveCalls.Remove(call);
|
||||
|
||||
SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus.Disconnected, call);
|
||||
ActiveCallCountFeedback.FireUpdate();
|
||||
//ActiveCallCountFeedback.FireUpdate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -102,7 +96,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
|
||||
ActiveCalls.Remove(call);
|
||||
SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus.Disconnected, call);
|
||||
}
|
||||
ActiveCallCountFeedback.FireUpdate();
|
||||
//ActiveCallCountFeedback.FireUpdate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -122,6 +116,9 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
|
||||
public override void RejectCall(CodecActiveCallItem call)
|
||||
{
|
||||
Debug.Console(1, this, "RejectCall");
|
||||
ActiveCalls.Remove(call);
|
||||
SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus.Disconnected, call);
|
||||
//ActiveCallCountFeedback.FireUpdate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -259,7 +256,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
|
||||
SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus.Incoming, call);
|
||||
_IncomingCall = true;
|
||||
IncomingCallFeedback.FireUpdate();
|
||||
ActiveCallCountFeedback.FireUpdate();
|
||||
//ActiveCallCountFeedback.FireUpdate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -274,7 +271,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
|
||||
SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus.Incoming, call);
|
||||
_IncomingCall = true;
|
||||
IncomingCallFeedback.FireUpdate();
|
||||
ActiveCallCountFeedback.FireUpdate();
|
||||
//ActiveCallCountFeedback.FireUpdate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -35,15 +35,15 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Returns true when ActiveCallCountFeedback is > 0
|
||||
/// Returns true when any call is not in state Unknown, Disconnecting, Disconnected
|
||||
/// </summary>
|
||||
public bool IsInCall { get { return ActiveCallCountFeedback.IntValue > 0; } }
|
||||
public bool IsInCall { get { return ActiveCalls.Any(c => c.IsActiveCall); } }
|
||||
|
||||
public BoolFeedback IncomingCallFeedback { get; private set; }
|
||||
|
||||
public IntFeedback ActiveCallCountFeedback { get; private set; }
|
||||
//public IntFeedback ActiveCallCountFeedback { get; private set; }
|
||||
|
||||
abstract protected Func<int> ActiveCallCountFeedbackFunc { get; }
|
||||
//abstract protected Func<int> ActiveCallCountFeedbackFunc { get; }
|
||||
abstract protected Func<bool> IncomingCallFeedbackFunc { get; }
|
||||
abstract protected Func<bool> PrivacyModeIsOnFeedbackFunc { get; }
|
||||
abstract protected Func<int> VolumeLevelFeedbackFunc { get; }
|
||||
@@ -55,7 +55,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
|
||||
public VideoCodecBase(string key, string name)
|
||||
: base(key, name)
|
||||
{
|
||||
ActiveCallCountFeedback = new IntFeedback(ActiveCallCountFeedbackFunc);
|
||||
//ActiveCallCountFeedback = new IntFeedback(ActiveCallCountFeedbackFunc);
|
||||
IncomingCallFeedback = new BoolFeedback(IncomingCallFeedbackFunc);
|
||||
PrivacyModeIsOnFeedback = new BoolFeedback(PrivacyModeIsOnFeedbackFunc);
|
||||
VolumeLevelFeedback = new IntFeedback(VolumeLevelFeedbackFunc);
|
||||
@@ -64,7 +64,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
|
||||
|
||||
InputPorts = new RoutingPortCollection<RoutingInputPort>();
|
||||
|
||||
ActiveCallCountFeedback.OutputChange += new EventHandler<EventArgs>(ActiveCallCountFeedback_OutputChange);
|
||||
//ActiveCallCountFeedback.OutputChange += new EventHandler<EventArgs>(ActiveCallCountFeedback_OutputChange);
|
||||
|
||||
ActiveCalls = new List<CodecActiveCallItem>();
|
||||
}
|
||||
@@ -74,16 +74,16 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
void ActiveCallCountFeedback_OutputChange(object sender, EventArgs e)
|
||||
{
|
||||
if (UsageTracker != null)
|
||||
{
|
||||
if (IsInCall)
|
||||
UsageTracker.StartDeviceUsage();
|
||||
else
|
||||
UsageTracker.EndDeviceUsage();
|
||||
}
|
||||
}
|
||||
//void ActiveCallCountFeedback_OutputChange(object sender, EventArgs e)
|
||||
//{
|
||||
// if (UsageTracker != null)
|
||||
// {
|
||||
// if (IsInCall)
|
||||
// UsageTracker.StartDeviceUsage();
|
||||
// else
|
||||
// UsageTracker.EndDeviceUsage();
|
||||
// }
|
||||
//}
|
||||
#region IHasDialer Members
|
||||
|
||||
public abstract void Dial(string s);
|
||||
|
||||
@@ -9,6 +9,7 @@ using PepperDash.Core;
|
||||
using PepperDash.Essentials;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.SmartObjects;
|
||||
using PepperDash.Essentials.Devices.Common.Codec;
|
||||
using PepperDash.Essentials.Devices.Common.VideoCodec;
|
||||
|
||||
namespace PepperDash.Essentials.UIDrivers.VC
|
||||
@@ -60,6 +61,8 @@ namespace PepperDash.Essentials.UIDrivers.VC
|
||||
StringBuilder DialStringBuilder = new StringBuilder();
|
||||
BoolFeedback DialStringBackspaceVisibleFeedback;
|
||||
|
||||
ModalDialog IncomingCallModal;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@@ -72,6 +75,8 @@ namespace PepperDash.Essentials.UIDrivers.VC
|
||||
SetupCallStagingPopover();
|
||||
SetupDialKeypad();
|
||||
|
||||
codec.CallStatusChange += new EventHandler<CodecCallStatusItemChangeEventArgs>(Codec_CallStatusChange);
|
||||
|
||||
InCall = new BoolFeedback(() => false);
|
||||
LocalPrivacyIsMuted = new BoolFeedback(() => false);
|
||||
|
||||
@@ -93,7 +98,91 @@ namespace PepperDash.Essentials.UIDrivers.VC
|
||||
DialStringBackspaceVisibleFeedback
|
||||
.LinkInputSig(TriList.BooleanInput[UIBoolJoin.KeyboardClearVisible]);
|
||||
|
||||
Codec.ActiveCallCountFeedback.OutputChange += new EventHandler<EventArgs>(InCallFeedback_OutputChange);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles status changes for calls
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
void Codec_CallStatusChange(object sender, CodecCallStatusItemChangeEventArgs e)
|
||||
{
|
||||
var call = e.CallItem;
|
||||
Debug.Console(1, "*#* UI: Codec status {0}: {1} --> {2}", call.Name, e.PreviousStatus, e.NewStatus);
|
||||
switch (e.NewStatus)
|
||||
{
|
||||
case eCodecCallStatus.Connected:
|
||||
// fire at SRL item
|
||||
Debug.Console(1, "*#* UI: Call Connected {0}", call.Name);
|
||||
break;
|
||||
case eCodecCallStatus.Connecting:
|
||||
// fire at SRL item
|
||||
Debug.Console(1, "*#* UI: Call Connecting {0}", call.Name);
|
||||
break;
|
||||
case eCodecCallStatus.Dialing:
|
||||
Debug.Console(1, "*#* UI: Call Dialing {0}", call.Name);
|
||||
break;
|
||||
case eCodecCallStatus.Disconnected:
|
||||
Debug.Console(1, "*#* UI: Call Disconnecting {0}", call.Name);
|
||||
break;
|
||||
case eCodecCallStatus.Disconnecting:
|
||||
break;
|
||||
case eCodecCallStatus.EarlyMedia:
|
||||
break;
|
||||
case eCodecCallStatus.Idle:
|
||||
break;
|
||||
case eCodecCallStatus.Incoming:
|
||||
// fire up a modal
|
||||
ShowIncomingModal(call);
|
||||
break;
|
||||
case eCodecCallStatus.OnHold:
|
||||
break;
|
||||
case eCodecCallStatus.Preserved:
|
||||
break;
|
||||
case eCodecCallStatus.RemotePreserved:
|
||||
break;
|
||||
case eCodecCallStatus.Ringing:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
TriList.UShortInput[UIUshortJoin.VCStagingConnectButtonMode].UShortValue = (ushort)(Codec.IsInCall ? 1 : 0);
|
||||
StagingBarInterlock.ShowInterlocked(Codec.IsInCall ?
|
||||
UIBoolJoin.VCStagingActivePopoverVisible : UIBoolJoin.VCStagingInactivePopoverVisible);
|
||||
|
||||
// Update list of calls
|
||||
var activeList = Codec.ActiveCalls.Where(c => c.IsActiveCall).ToList();
|
||||
Debug.Console(1, "*#* UI - Codec has {0} calls", activeList.Count);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void ShowIncomingModal(CodecActiveCallItem call)
|
||||
{
|
||||
IncomingCallModal = new ModalDialog(TriList);
|
||||
string msg;
|
||||
string icon;
|
||||
if (call.Type == eCodecCallType.Audio)
|
||||
{
|
||||
icon = "Phone";
|
||||
msg = string.Format("Incoming phone call from: {0}", call.Name);
|
||||
}
|
||||
else
|
||||
{
|
||||
icon = "Camera";
|
||||
msg = string.Format("Incoming video call from: {0}", call.Name);
|
||||
}
|
||||
IncomingCallModal.PresentModalDialog(2, "Incoming Call", icon, msg,
|
||||
"Ignore", "Accept", false, false, b =>
|
||||
{
|
||||
if (b == 1)
|
||||
Codec.RejectCall(call);
|
||||
else //2
|
||||
Codec.AcceptCall(call);
|
||||
IncomingCallModal = null;
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -196,28 +285,6 @@ namespace PepperDash.Essentials.UIDrivers.VC
|
||||
Codec.Dial(DialStringBuilder.ToString());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void InCallFeedback_OutputChange(object sender, EventArgs e)
|
||||
{
|
||||
var inCall = Codec.IsInCall;
|
||||
Debug.Console(1, "*#* Codec Driver InCallFeedback change={0}", InCall);
|
||||
TriList.UShortInput[UIUshortJoin.VCStagingConnectButtonMode].UShortValue = (ushort)(inCall ? 1 : 0);
|
||||
StagingBarInterlock.ShowInterlocked(
|
||||
inCall ? UIBoolJoin.VCStagingActivePopoverVisible : UIBoolJoin.VCStagingInactivePopoverVisible);
|
||||
|
||||
if (Codec.IsInCall) // Call is starting
|
||||
{
|
||||
// Header icon
|
||||
// Volume bar needs to have mic mute
|
||||
}
|
||||
else // ending
|
||||
{
|
||||
// Header icon
|
||||
// Volume bar no mic mute (or hidden if no source?)
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -8,4 +8,12 @@ devjson:1 {"deviceKey":"timer","methodName":"Cancel" }
|
||||
|
||||
devjson:1 {"deviceKey":"timer","methodName":"Reset" }
|
||||
|
||||
devjson:1 {"deviceKey":"room1","methodName":"Shutdown" }
|
||||
devjson:1 {"deviceKey":"room1","methodName":"Shutdown" }
|
||||
|
||||
devjson:1 {"deviceKey":"mockVc-1", "methodName":"TestIncomingVideoCall", "params": ["123-456-7890"]}
|
||||
|
||||
devjson:1 {"deviceKey":"mockVc-1", "methodName":"TestIncomingAudioCall", "params": ["111-111-1111"]}
|
||||
|
||||
devjson:1 {"deviceKey":"mockVc-1", "methodName":"TestIncomingVideoCall", "params": ["444-444-4444"]}
|
||||
|
||||
devjson:1 {"deviceKey":"mockVc-1", "methodName":"ListCalls"}
|
||||
|
||||
Reference in New Issue
Block a user