Added VC Mock and some interaction in UI layer

This commit is contained in:
Heath Volmer
2017-09-12 13:52:25 -06:00
parent 2196f5e67a
commit fd14eeb9a7
8 changed files with 329 additions and 65 deletions

View File

@@ -127,10 +127,7 @@
<Compile Include="SetTopBox\IRSetTopBoxBase.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Streaming\Roku.cs" />
<Compile Include="VC\Cisco\Configuration.cs" />
<Compile Include="VC\Cisco\HttpApiServer.cs" />
<Compile Include="VC\Cisco\Status.cs" />
<Compile Include="VC\Cisco\CiscoCodec.cs" />
<Compile Include="VC\MockVC\MockVC.cs" />
<Compile Include="VC\VideoCodecBase.cs" />
<None Include="Properties\ControlSystem.cfg" />
</ItemGroup>

View File

@@ -0,0 +1,191 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Core;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Devices.Common.VideoCodec
{
public class MockVC : VideoCodecBase
{
public MockVC(string key, string name)
: base(key, name)
{
}
protected override Func<bool> InCallFeedbackFunc
{
get { return () => _InCall; }
}
bool _InCall;
protected override Func<bool> IncomingCallFeedbackFunc
{
get { return () => _IncomingCall; }
}
bool _IncomingCall;
protected override Func<bool> TransmitMuteFeedbackFunc
{
get { return () => _TransmitMute; }
}
bool _TransmitMute;
protected override Func<bool> ReceiveMuteFeedbackFunc
{
get { return () => _ReceiveMute; }
}
bool _ReceiveMute;
protected override Func<bool> PrivacyModeFeedbackFunc
{
get { return () => _PrivacyModeIsOn; }
}
bool _PrivacyModeIsOn;
/// <summary>
/// Dials, yo!
/// </summary>
public override void Dial(string s)
{
_InCall = true;
InCallFeedback.FireUpdate();
}
/// <summary>
/// Makes horrible tones go out on the wire!
/// </summary>
/// <param name="s"></param>
public void SendDTMF(string s)
{
}
public override void EndCall()
{
_InCall = false;
InCallFeedback.FireUpdate();
}
/// <summary>
/// For a call from the test methods below
/// </summary>
public override void AcceptCall()
{
}
/// <summary>
/// For a call from the test methods below
/// </summary>
public override void RejectCall()
{
}
public override void ExecuteSwitch(object selector)
{
}
public override void ReceiveMuteOff()
{
if (!_ReceiveMute)
return;
_ReceiveMute = false;
ReceiveMuteIsOnFeedback.FireUpdate();
}
public override void ReceiveMuteOn()
{
if (_ReceiveMute)
return;
ReceiveMuteIsOnFeedback.FireUpdate();
}
public override void ReceiveMuteToggle()
{
_ReceiveMute = !_ReceiveMute;
ReceiveMuteIsOnFeedback.FireUpdate();
}
public override void SetReceiveVolume(ushort level)
{
}
public override void TransmitMuteOff()
{
if (!_TransmitMute)
return;
_TransmitMute = false;
TransmitMuteIsOnFeedback.FireUpdate();
}
public override void TransmitMuteOn()
{
if (_TransmitMute)
return;
TransmitMuteIsOnFeedback.FireUpdate();
}
public override void TransmitMuteToggle()
{
_TransmitMute = !_TransmitMute;
TransmitMuteIsOnFeedback.FireUpdate();
}
public override void SetTransmitVolume(ushort level)
{
}
public override void PrivacyModeOn()
{
if (_PrivacyModeIsOn)
return;
_PrivacyModeIsOn = true;
PrivacyModeIsOnFeedback.FireUpdate();
}
public override void PrivacyModeOff()
{
if (!_PrivacyModeIsOn)
return;
_PrivacyModeIsOn = false;
PrivacyModeIsOnFeedback.FireUpdate();
}
public override void PrivacyModeToggle()
{
_PrivacyModeIsOn = !_PrivacyModeIsOn;
PrivacyModeIsOnFeedback.FireUpdate();
}
//********************************************************
// SIMULATION METHODS
public void TestIncomingCall(string url)
{
_IncomingCall = true;
IncomingCallFeedback.FireUpdate();
}
public void TestFarEndHangup()
{
}
}
}

View File

@@ -7,9 +7,9 @@ using Crestron.SimplSharp;
using PepperDash.Core;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Devices.VideoCodec
namespace PepperDash.Essentials.Devices.Common.VideoCodec
{
public abstract class VideoCodecBase : Device, IRoutingSinkWithSwitching, IUsageTracking, IHasDialer //, ICodecAudio
public abstract class VideoCodecBase : Device, IRoutingSinkWithSwitching, IUsageTracking, IHasDialer, ICodecAudio
{
#region IUsageTracking Members
@@ -57,7 +57,7 @@ namespace PepperDash.Essentials.Devices.VideoCodec
}
}
public abstract void Dial();
public abstract void Dial(string s);
public abstract void EndCall();
public abstract void AcceptCall();
public abstract void RejectCall();

View File

@@ -59,12 +59,12 @@ namespace PepperDash.Essentials
// CODEC TESTING
GenericSshClient TestCodecClient = new GenericSshClient("TestCodec-1--SshClient", "10.11.50.135", 22, "crestron", "2H3Zu&OvgXp6");
//GenericSshClient TestCodecClient = new GenericSshClient("TestCodec-1--SshClient", "10.11.50.135", 22, "crestron", "2H3Zu&OvgXp6");
PepperDash.Essentials.Devices.VideoCodec.Cisco.CiscoCodec TestCodec =
new PepperDash.Essentials.Devices.VideoCodec.Cisco.CiscoCodec("TestCodec-1", "Cisco Spark Room Kit", TestCodecClient, 8080);
//PepperDash.Essentials.Devices.VideoCodec.Cisco.CiscoCodec TestCodec =
// new PepperDash.Essentials.Devices.VideoCodec.Cisco.CiscoCodec("TestCodec-1", "Cisco Spark Room Kit", TestCodecClient, 8080);
TestCodec.CustomActivate();
//TestCodec.CustomActivate();
// CODEC TESTING

View File

@@ -25,9 +25,9 @@ namespace PepperDash.Essentials.Fusion
{
public class EssentialsHuddleSpaceFusionSystemController : Device
{
//public event EventHandler<ScheduleChangeEventArgs> ScheduleChange;
//public event EventHandler<MeetingChangeEventArgs> MeetingEndWarning;
//public event EventHandler<MeetingChangeEventArgs> NextMeetingBeginWarning;
public event EventHandler<ScheduleChangeEventArgs> ScheduleChange;
public event EventHandler<MeetingChangeEventArgs> MeetingEndWarning;
public event EventHandler<MeetingChangeEventArgs> NextMeetingBeginWarning;
FusionRoom FusionRoom;
EssentialsHuddleSpaceRoom Room;
@@ -41,10 +41,10 @@ namespace PepperDash.Essentials.Fusion
StringSigData CurrentRoomSourceNameSig;
#region System Info Sigs
StringSigData SystemName;
StringSigData Model;
StringSigData SerialNumber;
StringSigData Uptime;
//StringSigData SystemName;
//StringSigData Model;
//StringSigData SerialNumber;
//StringSigData Uptime;
#endregion
@@ -788,6 +788,15 @@ namespace PepperDash.Essentials.Fusion
if (!IsRegisteredForSchedulePushNotifications)
PollTimer.Reset(SchedulePollInterval, SchedulePollInterval);
// Fire Schedule Change Event
var handler = ScheduleChange;
if (handler != null)
{
handler(this, new ScheduleChangeEventArgs() { Schedule = CurrentSchedule });
}
}
}
@@ -806,20 +815,26 @@ namespace PepperDash.Essentials.Fusion
}
/// <summary>
/// Prints today's schedule to console for debugging
/// </summary>
void PrintTodaysSchedule()
{
if (CurrentSchedule.Meetings.Count > 0)
if (Debug.Level > 1)
{
Debug.Console(1, this, "Today's Schedule for '{0}'\n", Room.Name);
foreach (Event e in CurrentSchedule.Meetings)
if (CurrentSchedule.Meetings.Count > 0)
{
Debug.Console(1, this, "Subject: {0}", e.Subject);
Debug.Console(1, this, "Organizer: {0}", e.Organizer);
Debug.Console(1, this, "MeetingID: {0}", e.MeetingID);
Debug.Console(1, this, "Start Time: {0}", e.dtStart);
Debug.Console(1, this, "End Time: {0}", e.dtEnd);
Debug.Console(1, this, "Duration: {0}\n", e.DurationInMinutes);
Debug.Console(1, this, "Today's Schedule for '{0}'\n", Room.Name);
foreach (Event e in CurrentSchedule.Meetings)
{
Debug.Console(1, this, "Subject: {0}", e.Subject);
Debug.Console(1, this, "Organizer: {0}", e.Organizer);
Debug.Console(1, this, "MeetingID: {0}", e.MeetingID);
Debug.Console(1, this, "Start Time: {0}", e.dtStart);
Debug.Console(1, this, "End Time: {0}", e.dtEnd);
Debug.Console(1, this, "Duration: {0}\n", e.DurationInMinutes);
}
}
}
}
@@ -888,13 +903,8 @@ namespace PepperDash.Essentials.Fusion
/// <param name="sender"></param>
/// <param name="e"></param>
void UsageTracker_DeviceUsageEnded(object sender, DeviceUsageEventArgs e)
<<<<<<< HEAD
{
var device = sender as Device;
=======
{
var deviceTracker = sender as UsageTracking;
>>>>>>> origin/feature/fusion-nyu
var configDevice = ConfigReader.ConfigObject.Devices.Where(d => d.Key.Equals(deviceTracker.Parent));
@@ -960,6 +970,7 @@ namespace PepperDash.Essentials.Fusion
string attrName = null;
uint attrNum = Convert.ToUInt32(keyNum);
<<<<<<< HEAD
if (dev is BasicTriListWithSmartObject)
@@ -971,13 +982,32 @@ namespace PepperDash.Essentials.Fusion
}
// add xpanel here
if (dev is Crestron.SimplSharpPro.UI.XpanelForSmartGraphics)
//if (dev is Crestron.SimplSharpPro.UI.XpanelForSmartGraphics)
//{
// if (attrNum > 10)
// continue;
// attrName = "Online - XPanel " + attrNum;
// attrNum += 160;
//}
=======
if (dev is EssentialsTouchpanelController)
{
if (attrNum > 10)
continue;
attrName = "Online - XPanel " + attrNum;
attrNum += 160;
}
if ((dev as EssentialsTouchpanelController).Panel is Crestron.SimplSharpPro.DeviceSupport.TswFt5Button)
{
if (attrNum > 10)
continue;
attrName = "Online - Touch Panel " + attrNum;
attrNum += 150;
}
else if ((dev as EssentialsTouchpanelController).Panel is Crestron.SimplSharpPro.UI.XpanelForSmartGraphics)
{
if (attrNum > 10)
continue;
attrName = "Online - XPanel " + attrNum;
attrNum += 160;
}
}
>>>>>>> origin/feature/cisco-spark
//else
if (dev is DisplayBase)

View File

@@ -9,6 +9,7 @@ using PepperDash.Core;
using PepperDash.Essentials;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.SmartObjects;
using PepperDash.Essentials.Devices.Common.VideoCodec;
namespace PepperDash.Essentials.UIDrivers.VC
{
@@ -20,7 +21,7 @@ namespace PepperDash.Essentials.UIDrivers.VC
/// </summary>
public class EssentialsCiscoSparkUiDriver : PanelDriverBase
{
object Codec;
VideoCodecBase Codec;
/// <summary>
///
@@ -51,12 +52,17 @@ namespace PepperDash.Essentials.UIDrivers.VC
SmartObjectNumeric DialKeypad;
// These are likely temp until we get a keyboard built
StringFeedback DialStringFeedback;
StringBuilder DialStringBuilder = new StringBuilder();
BoolFeedback DialStringBackspaceVisibleFeedback;
/// <summary>
///
/// </summary>
/// <param name="triList"></param>
/// <param name="codec"></param>
public EssentialsCiscoSparkUiDriver(BasicTriListWithSmartObject triList, object codec)
public EssentialsCiscoSparkUiDriver(BasicTriListWithSmartObject triList, VideoCodecBase codec)
: base(triList)
{
Codec = codec;
@@ -76,6 +82,15 @@ namespace PepperDash.Essentials.UIDrivers.VC
StagingButtonFeedbackInterlock = new JoinedSigInterlock(triList);
StagingButtonFeedbackInterlock.ShowInterlocked(UIBoolJoin.VCRecentsVisible);
DialStringFeedback = new StringFeedback(() => DialStringBuilder.ToString());
DialStringFeedback.LinkInputSig(triList.StringInput[UIStringJoin.KeyboardText]);
DialStringBackspaceVisibleFeedback = new BoolFeedback(() => DialStringBuilder.Length > 0);
DialStringBackspaceVisibleFeedback
.LinkInputSig(TriList.BooleanInput[UIBoolJoin.KeyboardClearVisible]);
Codec.InCallFeedback.OutputChange += new EventHandler<EventArgs>(InCallFeedback_OutputChange);
}
/// <summary>
@@ -104,7 +119,7 @@ namespace PepperDash.Essentials.UIDrivers.VC
void SetupCallStagingPopover()
{
TriList.SetSigFalseAction(UIBoolJoin.VCStagingDirectoryPress, ShowDirectory);
TriList.SetSigFalseAction(UIBoolJoin.VCStagingConnectPress, () => { });
TriList.SetSigFalseAction(UIBoolJoin.VCStagingConnectPress, ConnectPress);
TriList.SetSigFalseAction(UIBoolJoin.VCStagingKeypadPress, ShowKeypad);
TriList.SetSigFalseAction(UIBoolJoin.VCStagingRecentsPress, ShowRecents);
}
@@ -117,20 +132,20 @@ namespace PepperDash.Essentials.UIDrivers.VC
if(TriList.SmartObjects.Contains(UISmartObjectJoin.VCDialKeypad))
{
DialKeypad = new SmartObjectNumeric(TriList.SmartObjects[UISmartObjectJoin.VCDialKeypad], true);
DialKeypad.Digit0.SetSigFalseAction(() => ___DialPlaceholder___(0));
DialKeypad.Digit1.SetSigFalseAction(() => ___DialPlaceholder___(1));
DialKeypad.Digit2.SetSigFalseAction(() => ___DialPlaceholder___(2));
DialKeypad.Digit3.SetSigFalseAction(() => ___DialPlaceholder___(3));
DialKeypad.Digit4.SetSigFalseAction(() => ___DialPlaceholder___(4));
DialKeypad.Digit5.SetSigFalseAction(() => ___DialPlaceholder___(5));
DialKeypad.Digit6.SetSigFalseAction(() => ___DialPlaceholder___(6));
DialKeypad.Digit7.SetSigFalseAction(() => ___DialPlaceholder___(7));
DialKeypad.Digit8.SetSigFalseAction(() => ___DialPlaceholder___(8));
DialKeypad.Digit9.SetSigFalseAction(() => ___DialPlaceholder___(9));
DialKeypad.Digit0.SetSigFalseAction(() => DialKeypadPress("0"));
DialKeypad.Digit1.SetSigFalseAction(() => DialKeypadPress("1"));
DialKeypad.Digit2.SetSigFalseAction(() => DialKeypadPress("2"));
DialKeypad.Digit3.SetSigFalseAction(() => DialKeypadPress("3"));
DialKeypad.Digit4.SetSigFalseAction(() => DialKeypadPress("4"));
DialKeypad.Digit5.SetSigFalseAction(() => DialKeypadPress("5"));
DialKeypad.Digit6.SetSigFalseAction(() => DialKeypadPress("6"));
DialKeypad.Digit7.SetSigFalseAction(() => DialKeypadPress("7"));
DialKeypad.Digit8.SetSigFalseAction(() => DialKeypadPress("8"));
DialKeypad.Digit9.SetSigFalseAction(() => DialKeypadPress("9"));
DialKeypad.Misc1SigName = "*";
DialKeypad.Misc1.SetSigFalseAction(() => { });
DialKeypad.Misc1.SetSigFalseAction(() => DialKeypadPress("*"));
DialKeypad.Misc2SigName = "#";
DialKeypad.Misc2.SetSigFalseAction(() => { });
DialKeypad.Misc2.SetSigFalseAction(() => DialKeypadPress("#"));
}
else
Debug.Console(0, "Trilist {0:x2}, VC dial keypad object {1} not found. Check SGD file or VTP",
@@ -166,24 +181,55 @@ namespace PepperDash.Essentials.UIDrivers.VC
StagingButtonFeedbackInterlock.ShowInterlocked(UIBoolJoin.VCStagingRecentsPress);
}
void CallHasStarted()
/// <summary>
///
/// </summary>
void ConnectPress()
{
// Header icon
// Add end call button to stage
// Volume bar needs to have mic mute
if (Codec.InCallFeedback.BoolValue)
Codec.EndCall();
else
Codec.Dial(DialStringBuilder.ToString());
}
void CallHasEnded()
/// <summary>
///
/// </summary>
void InCallFeedback_OutputChange(object sender, EventArgs e)
{
// Header icon
// Remove end call
// Volume bar no mic mute (or hidden if no source?)
if (Codec.InCallFeedback.BoolValue) // Call is starting
{
// Header icon
// Add end call button to stage
// Volume bar needs to have mic mute
}
else // ending
{
// Header icon
// Remove end call
// Volume bar no mic mute (or hidden if no source?)
}
}
void ___DialPlaceholder___(int i)
/// <summary>
///
/// </summary>
/// <param name="i"></param>
void DialKeypadPress(string i)
{
throw new NotImplementedException();
DialStringBuilder.Append(i);
DialStringFeedback.FireUpdate();
TriList.BooleanInput[UIBoolJoin.KeyboardClearVisible].BoolValue =
DialStringBuilder.Length > 0;
}
void DialKeypadBackspacePress()
{
DialStringBuilder.Remove(DialStringBuilder.Length - 1, 1);
DialStringFeedback.FireUpdate();
TriList.BooleanInput[UIBoolJoin.KeyboardClearVisible].BoolValue =
DialStringBuilder.Length > 0;
}
}
}