Added various things to mock. Trying to find exception in routing

This commit is contained in:
Heath Volmer
2017-09-14 20:29:15 -06:00
parent e8a9282180
commit dc3cc1d4eb
8 changed files with 406 additions and 374 deletions

View File

@@ -41,6 +41,11 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
} }
} }
protected override Func<bool> MuteFeedbackFunc
{
get { return () => false; }
}
//private HttpsClient Client; //private HttpsClient Client;
//private HttpApiServer Server; //private HttpApiServer Server;
@@ -576,6 +581,22 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
{ {
} }
public override void MuteOff()
{
}
public override void MuteOn()
{
}
public override void SetVolume(ushort level)
{
}
public override void MuteToggle()
{
}
} }
/// <summary> /// <summary>

View File

@@ -49,8 +49,15 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
protected override Func<int> VolumeLevelFeedbackFunc protected override Func<int> VolumeLevelFeedbackFunc
{ {
get { throw new NotImplementedException(); } get { return () => _VolumeLevel; }
} }
int _VolumeLevel;
protected override Func<bool> MuteFeedbackFunc
{
get { return () => _IsMuted; }
}
bool _IsMuted;
/// <summary> /// <summary>
/// Dials, yo! /// Dials, yo!
@@ -118,6 +125,31 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
} }
public override void MuteOff()
{
_IsMuted = false;
MuteFeedback.FireUpdate();
}
public override void MuteOn()
{
_IsMuted = true;
MuteFeedback.FireUpdate();
}
public override void MuteToggle()
{
_IsMuted = !_IsMuted;
MuteFeedback.FireUpdate();
}
public override void SetVolume(ushort level)
{
_VolumeLevel = level;
VolumeLevelFeedback.FireUpdate();
}
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@@ -241,5 +273,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
Debug.Console(1, this, "TestFarEndHangup"); Debug.Console(1, this, "TestFarEndHangup");
} }
} }
} }

View File

@@ -33,6 +33,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
abstract protected Func<bool> PrivacyModeFeedbackFunc { get; } abstract protected Func<bool> PrivacyModeFeedbackFunc { get; }
abstract protected Func<int> VolumeLevelFeedbackFunc { get; } abstract protected Func<int> VolumeLevelFeedbackFunc { get; }
abstract protected Func<bool> MuteFeedbackFunc { get; }
public VideoCodecBase(string key, string name) public VideoCodecBase(string key, string name)
: base(key, name) : base(key, name)
@@ -44,6 +45,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
PrivacyModeIsOnFeedback = new BoolFeedback(PrivacyModeFeedbackFunc); PrivacyModeIsOnFeedback = new BoolFeedback(PrivacyModeFeedbackFunc);
VolumeLevelFeedback = new IntFeedback(VolumeLevelFeedbackFunc); VolumeLevelFeedback = new IntFeedback(VolumeLevelFeedbackFunc);
MuteFeedback = new BoolFeedback(MuteFeedbackFunc);
InputPorts = new RoutingPortCollection<RoutingInputPort>(); InputPorts = new RoutingPortCollection<RoutingInputPort>();
@@ -123,20 +125,11 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
public BoolFeedback MuteFeedback { get; private set; } public BoolFeedback MuteFeedback { get; private set; }
public void MuteOff() public abstract void MuteOff();
{
} public abstract void MuteOn();
public void MuteOn() public abstract void SetVolume(ushort level);
{
}
public void SetVolume(ushort level)
{
}
public IntFeedback VolumeLevelFeedback { get; private set; } public IntFeedback VolumeLevelFeedback { get; private set; }
@@ -144,17 +137,14 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
#region IBasicVolumeControls Members #region IBasicVolumeControls Members
public void MuteToggle() public abstract void MuteToggle();
public virtual void VolumeDown(bool pressRelease)
{ {
} }
public void VolumeDown(bool pressRelease) public virtual void VolumeUp(bool pressRelease)
{
}
public void VolumeUp(bool pressRelease)
{ {
} }

View File

@@ -63,7 +63,7 @@ namespace PepperDash.Essentials.Room.Config
var codec = DeviceManager.GetDeviceForKey(props.VideoCodecKey) as var codec = DeviceManager.GetDeviceForKey(props.VideoCodecKey) as
PepperDash.Essentials.Devices.Common.VideoCodec.VideoCodecBase; PepperDash.Essentials.Devices.Common.VideoCodec.VideoCodecBase;
var rm = new EssentialsHuddleVtc1Room(Key, Name, disp, disp, codec, props); var rm = new EssentialsHuddleVtc1Room(Key, Name, disp, codec, codec, props);
rm.LogoUrl = props.Logo.GetUrl(); rm.LogoUrl = props.Logo.GetUrl();
rm.SourceListKey = props.SourceListKey; rm.SourceListKey = props.SourceListKey;
rm.DefaultSourceItem = props.DefaultSourceItem; rm.DefaultSourceItem = props.DefaultSourceItem;

View File

@@ -235,11 +235,14 @@ namespace PepperDash.Essentials
public void RunRouteAction(string routeKey, Action successCallback) public void RunRouteAction(string routeKey, Action successCallback)
{ {
// Run this on a separate thread // Run this on a separate thread
new CTimer(o => //new CTimer(o =>
// {
try
{ {
Debug.Console(1, this, "Run route action '{0}'", routeKey); Debug.Console(1, this, "Run route action '{0}'", routeKey);
var dict = ConfigReader.ConfigObject.GetSourceListForKey(SourceListKey); var dict = ConfigReader.ConfigObject.GetSourceListForKey(SourceListKey);
if(dict == null) if (dict == null)
{ {
Debug.Console(1, this, "WARNING: Config source list '{0}' not found", SourceListKey); Debug.Console(1, this, "WARNING: Config source list '{0}' not found", SourceListKey);
return; return;
@@ -253,8 +256,6 @@ namespace PepperDash.Essentials
return; return;
} }
var item = dict[routeKey];
// End usage timer on last source // End usage timer on last source
if (!string.IsNullOrEmpty(LastSourceKey)) if (!string.IsNullOrEmpty(LastSourceKey))
{ {
@@ -267,63 +268,24 @@ namespace PepperDash.Essentials
} }
catch (Exception e) catch (Exception e)
{ {
Debug.Console(1, this, "*#* EXCEPTION in end usage tracking (257):\r{0}", e); Debug.Console(1, this, "*#* EXCEPTION in end usage tracking:\r{0}", e);
} }
} }
// Let's run it // Let's run it
var item = dict[routeKey];
if (routeKey.ToLower() != "roomoff") if (routeKey.ToLower() != "roomoff")
{
LastSourceKey = routeKey; LastSourceKey = routeKey;
}
else else
{
CurrentSourceInfoKey = null; CurrentSourceInfoKey = null;
}
// hand off the individual routes to this helper
foreach (var route in item.RouteList) foreach (var route in item.RouteList)
{ DoRouteItem(route);
// if there is a $defaultAll on route, run two separate
if (route.DestinationKey.Equals("$defaultAll", StringComparison.OrdinalIgnoreCase))
{
// Going to assume a single-path route for now
var tempVideo = new SourceRouteListItem
{
DestinationKey = "$defaultDisplay",
SourceKey = route.SourceKey,
Type = eRoutingSignalType.Video
};
DoRoute(tempVideo);
}
else
DoRoute(route);
}
// Start usage timer on routed source // Start usage timer on routed source
if (item.SourceDevice is IUsageTracking) if (item.SourceDevice is IUsageTracking)
{
(item.SourceDevice as IUsageTracking).UsageTracker.StartDeviceUsage(); (item.SourceDevice as IUsageTracking).UsageTracker.StartDeviceUsage();
}
// Set volume control on room, using default if non provided
IBasicVolumeControls volDev = null;
// Handle special cases for volume control
if (string.IsNullOrEmpty(item.VolumeControlKey)
|| item.VolumeControlKey.Equals("$defaultAudio", StringComparison.OrdinalIgnoreCase))
volDev = DefaultVolumeControls;
else if (item.VolumeControlKey.Equals("$defaultDisplay", StringComparison.OrdinalIgnoreCase))
volDev = DefaultDisplay as IBasicVolumeControls;
// Or a specific device, probably rarely used.
else
{
var dev = DeviceManager.GetDeviceForKey(item.VolumeControlKey);
if (dev is IBasicVolumeControls)
volDev = dev as IBasicVolumeControls;
else if (dev is IHasVolumeDevice)
volDev = (dev as IHasVolumeDevice).VolumeDevice;
}
CurrentVolumeControls = volDev;
// store the name and UI info for routes // store the name and UI info for routes
if (item.SourceKey == "$off") if (item.SourceKey == "$off")
@@ -342,18 +304,35 @@ namespace PepperDash.Essentials
// report back when done // report back when done
if (successCallback != null) if (successCallback != null)
successCallback(); successCallback();
}
catch (Exception e)
{
Debug.Console(1, this, "ERROR in routing: {0}", e);
}
}, 0); // end of CTimer //}, 0); // end of CTimer
} }
/// <summary> /// <summary>
/// Will power the room on with the last-used source ///
/// </summary> /// </summary>
public void PowerOnToDefaultOrLastSource() /// <param name="route"></param>
void DoRouteItem(SourceRouteListItem route)
{ {
if (!EnablePowerOnToLastSource || LastSourceKey == null) // if there is a $defaultAll on route, run two separate
return; if (route.DestinationKey.Equals("$defaultAll", StringComparison.OrdinalIgnoreCase))
RunRouteAction(LastSourceKey); {
// Going to assume a single-path route for now
var tempVideo = new SourceRouteListItem
{
DestinationKey = "$defaultDisplay",
SourceKey = route.SourceKey,
Type = eRoutingSignalType.Video
};
DoRoute(tempVideo);
}
else
DoRoute(route);
} }
/// <summary> /// <summary>
@@ -397,6 +376,16 @@ namespace PepperDash.Essentials
return true; return true;
} }
/// <summary>
/// Will power the room on with the last-used source
/// </summary>
public void PowerOnToDefaultOrLastSource()
{
if (!EnablePowerOnToLastSource || LastSourceKey == null)
return;
RunRouteAction(LastSourceKey);
}
/// <summary> /// <summary>
/// Runs "roomOff" action on all rooms not set to ExcludeFromGlobalFunctions /// Runs "roomOff" action on all rooms not set to ExcludeFromGlobalFunctions
/// </summary> /// </summary>

View File

@@ -199,7 +199,6 @@ namespace PepperDash.Essentials.UIDrivers.VC
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
void InCallFeedback_OutputChange(object sender, EventArgs e) void InCallFeedback_OutputChange(object sender, EventArgs e)
{ {
var inCall = Codec.InCallFeedback.BoolValue; var inCall = Codec.InCallFeedback.BoolValue;