Tech PIN from config

This commit is contained in:
Heath Volmer
2017-10-06 10:19:01 -06:00
parent f9d320e2b2
commit 0196997a4e
12 changed files with 945 additions and 974 deletions

View File

@@ -102,7 +102,6 @@ namespace PepperDash.Essentials.Core
eRoutingSignalType signalType, int cycle, RouteDescriptor routeTable) eRoutingSignalType signalType, int cycle, RouteDescriptor routeTable)
{ {
cycle++; cycle++;
Debug.Console(2, destination, "*#* SelectInput-cycle {1}. Finding {2} route back to {0}", source.Key, cycle, signalType);
var destDevInputTies = TieLineCollection.Default.Where(t => var destDevInputTies = TieLineCollection.Default.Where(t =>
t.DestinationPort.ParentDevice == destination && (t.Type == signalType || t.Type == eRoutingSignalType.AudioVideo)); t.DestinationPort.ParentDevice == destination && (t.Type == signalType || t.Type == eRoutingSignalType.AudioVideo));
@@ -115,7 +114,6 @@ namespace PepperDash.Essentials.Core
RoutingInputPort goodInputPort = null; RoutingInputPort goodInputPort = null;
if (directTie != null) // Found a tie directly to the source if (directTie != null) // Found a tie directly to the source
{ {
Debug.Console(2, destination, "*#* Found direct tie to {0}**", source.Key);
goodInputPort = directTie.DestinationPort; goodInputPort = directTie.DestinationPort;
} }
else // no direct-connect. Walk back devices. else // no direct-connect. Walk back devices.

View File

@@ -182,7 +182,6 @@ namespace PepperDash.Essentials.Devices.Displays
// Good length, grab the message // Good length, grab the message
var message = newBytes.Skip(4).Take(msgLen).ToArray(); var message = newBytes.Skip(4).Take(msgLen).ToArray();
Debug.Console(2, this, "*#* Parsing input: {0}", ComTextHelper.GetEscapedText(message));
// At this point, the ack/nak is the first byte // At this point, the ack/nak is the first byte
if (message[0] == 0x41) if (message[0] == 0x41)
@@ -254,7 +253,6 @@ namespace PepperDash.Essentials.Devices.Displays
IsInStandby = true; IsInStandby = true;
if (powerByte == 0x00 && IsInStandby) // Ignore power off if coming from standby - glitch if (powerByte == 0x00 && IsInStandby) // Ignore power off if coming from standby - glitch
{ {
Debug.Console(2, this, "*#* STANDBY GLITCH - IGNORING");
IsInStandby = false; IsInStandby = false;
return; return;
} }
@@ -319,7 +317,7 @@ namespace PepperDash.Essentials.Devices.Displays
checksum = checksum & 0x000000FF; // mask off MSBs checksum = checksum & 0x000000FF; // mask off MSBs
b[b.Length - 1] = (byte)checksum; b[b.Length - 1] = (byte)checksum;
if(Debug.Level == 2) // This check is here to prevent following string format from building unnecessarily on level 0 or 1 if(Debug.Level == 2) // This check is here to prevent following string format from building unnecessarily on level 0 or 1
Debug.Console(2, this, "*#* Sending:{0}", ComTextHelper.GetEscapedText(b)); Debug.Console(2, this, "Sending:{0}", ComTextHelper.GetEscapedText(b));
Communication.SendBytes(b); Communication.SendBytes(b);
} }
@@ -372,7 +370,6 @@ namespace PepperDash.Essentials.Devices.Displays
// Fake cool-down cycle // Fake cool-down cycle
CooldownTimer = new CTimer(o => CooldownTimer = new CTimer(o =>
{ {
Debug.Console(2, this, "*#* Cooldown timer ending");
_IsCoolingDown = false; _IsCoolingDown = false;
IsCoolingDownFeedback.FireUpdate(); IsCoolingDownFeedback.FireUpdate();
}, CooldownTime); }, CooldownTime);

View File

@@ -110,6 +110,7 @@ namespace PepperDash.Essentials.Room.Config
public EssentialsRoomAddressPropertiesConfig Addresses { get; set; } public EssentialsRoomAddressPropertiesConfig Addresses { get; set; }
public EssentialsRoomOccSensorConfig OccupancySensors { get; set; } public EssentialsRoomOccSensorConfig OccupancySensors { get; set; }
public EssentialsLogoPropertiesConfig Logo { get; set; } public EssentialsLogoPropertiesConfig Logo { get; set; }
public EssentialsRoomTechConfig Tech { get; set; }
public EssentialsRoomVolumesConfig Volumes { get; set; } public EssentialsRoomVolumesConfig Volumes { get; set; }
} }
@@ -176,4 +177,9 @@ namespace PepperDash.Essentials.Room.Config
public List<string> Types { get; set; } public List<string> Types { get; set; }
} }
public class EssentialsRoomTechConfig
{
public string Password { get; set; }
}
} }

View File

@@ -1,433 +1,433 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using Crestron.SimplSharp; using Crestron.SimplSharp;
using PepperDash.Core; using PepperDash.Core;
using PepperDash.Essentials.Core; using PepperDash.Essentials.Core;
using PepperDash.Essentials.Room.Config; using PepperDash.Essentials.Room.Config;
namespace PepperDash.Essentials namespace PepperDash.Essentials
{ {
public class EssentialsHuddleSpaceRoom : EssentialsRoomBase, IHasCurrentSourceInfoChange public class EssentialsHuddleSpaceRoom : EssentialsRoomBase, IHasCurrentSourceInfoChange
{ {
public event EventHandler<VolumeDeviceChangeEventArgs> CurrentVolumeDeviceChange; public event EventHandler<VolumeDeviceChangeEventArgs> CurrentVolumeDeviceChange;
public event SourceInfoChangeHandler CurrentSingleSourceChange; public event SourceInfoChangeHandler CurrentSingleSourceChange;
protected override Func<bool> OnFeedbackFunc protected override Func<bool> OnFeedbackFunc
{ {
get get
{ {
return () => return () =>
{ {
var disp = DefaultDisplay as DisplayBase; var disp = DefaultDisplay as DisplayBase;
var val = CurrentSourceInfo != null var val = CurrentSourceInfo != null
&& CurrentSourceInfo.Type == eSourceListItemType.Route && CurrentSourceInfo.Type == eSourceListItemType.Route
&& disp != null && disp != null
&& disp.PowerIsOnFeedback.BoolValue; && disp.PowerIsOnFeedback.BoolValue;
return val; return val;
}; };
} }
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
protected override Func<bool> IsWarmingFeedbackFunc protected override Func<bool> IsWarmingFeedbackFunc
{ {
get get
{ {
return () => return () =>
{ {
var disp = DefaultDisplay as DisplayBase; var disp = DefaultDisplay as DisplayBase;
if (disp != null) if (disp != null)
return disp.IsWarmingUpFeedback.BoolValue; return disp.IsWarmingUpFeedback.BoolValue;
else else
return false; return false;
}; };
} }
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
protected override Func<bool> IsCoolingFeedbackFunc protected override Func<bool> IsCoolingFeedbackFunc
{ {
get get
{ {
return () => return () =>
{ {
var disp = DefaultDisplay as DisplayBase; var disp = DefaultDisplay as DisplayBase;
if (disp != null) if (disp != null)
return disp.IsCoolingDownFeedback.BoolValue; return disp.IsCoolingDownFeedback.BoolValue;
else else
return false; return false;
}; };
} }
} }
public EssentialsRoomPropertiesConfig Config { get; private set; } public EssentialsRoomPropertiesConfig Config { get; private set; }
public IRoutingSinkWithSwitching DefaultDisplay { get; private set; } public IRoutingSinkWithSwitching DefaultDisplay { get; private set; }
public IRoutingSinkNoSwitching DefaultAudioDevice { get; private set; } public IRoutingSinkNoSwitching DefaultAudioDevice { get; private set; }
public IBasicVolumeControls DefaultVolumeControls { get; private set; } public IBasicVolumeControls DefaultVolumeControls { get; private set; }
public bool ExcludeFromGlobalFunctions { get; set; } public bool ExcludeFromGlobalFunctions { get; set; }
/// <summary> /// <summary>
/// The config name of the source list /// The config name of the source list
/// </summary> /// </summary>
public string SourceListKey { get; set; } public string SourceListKey { get; set; }
public string DefaultSourceItem { get; set; } public string DefaultSourceItem { get; set; }
public ushort DefaultVolume { get; set; } public ushort DefaultVolume { get; set; }
/// <summary> /// <summary>
/// If room is off, enables power on to last source. Default true /// If room is off, enables power on to last source. Default true
/// </summary> /// </summary>
public bool EnablePowerOnToLastSource { get; set; } public bool EnablePowerOnToLastSource { get; set; }
string LastSourceKey; string LastSourceKey;
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public IBasicVolumeControls CurrentVolumeControls public IBasicVolumeControls CurrentVolumeControls
{ {
get { return _CurrentAudioDevice; } get { return _CurrentAudioDevice; }
set set
{ {
if (value == _CurrentAudioDevice) return; if (value == _CurrentAudioDevice) return;
var oldDev = _CurrentAudioDevice; var oldDev = _CurrentAudioDevice;
// derigister this room from the device, if it can // derigister this room from the device, if it can
if (oldDev is IInUseTracking) if (oldDev is IInUseTracking)
(oldDev as IInUseTracking).InUseTracker.RemoveUser(this, "audio"); (oldDev as IInUseTracking).InUseTracker.RemoveUser(this, "audio");
var handler = CurrentVolumeDeviceChange; var handler = CurrentVolumeDeviceChange;
if (handler != null) if (handler != null)
CurrentVolumeDeviceChange(this, new VolumeDeviceChangeEventArgs(oldDev, value, ChangeType.WillChange)); CurrentVolumeDeviceChange(this, new VolumeDeviceChangeEventArgs(oldDev, value, ChangeType.WillChange));
_CurrentAudioDevice = value; _CurrentAudioDevice = value;
if (handler != null) if (handler != null)
CurrentVolumeDeviceChange(this, new VolumeDeviceChangeEventArgs(oldDev, value, ChangeType.DidChange)); CurrentVolumeDeviceChange(this, new VolumeDeviceChangeEventArgs(oldDev, value, ChangeType.DidChange));
// register this room with new device, if it can // register this room with new device, if it can
if (_CurrentAudioDevice is IInUseTracking) if (_CurrentAudioDevice is IInUseTracking)
(_CurrentAudioDevice as IInUseTracking).InUseTracker.AddUser(this, "audio"); (_CurrentAudioDevice as IInUseTracking).InUseTracker.AddUser(this, "audio");
} }
} }
IBasicVolumeControls _CurrentAudioDevice; IBasicVolumeControls _CurrentAudioDevice;
/// <summary> /// <summary>
/// The SourceListItem last run - containing names and icons /// The SourceListItem last run - containing names and icons
/// </summary> /// </summary>
public SourceListItem CurrentSourceInfo public SourceListItem CurrentSourceInfo
{ {
get { return _CurrentSourceInfo; } get { return _CurrentSourceInfo; }
private set private set
{ {
if (value == _CurrentSourceInfo) return; if (value == _CurrentSourceInfo) return;
var handler = CurrentSingleSourceChange; var handler = CurrentSingleSourceChange;
// remove from in-use tracker, if so equipped // remove from in-use tracker, if so equipped
if(_CurrentSourceInfo != null && _CurrentSourceInfo.SourceDevice is IInUseTracking) if(_CurrentSourceInfo != null && _CurrentSourceInfo.SourceDevice is IInUseTracking)
(_CurrentSourceInfo.SourceDevice as IInUseTracking).InUseTracker.RemoveUser(this, "control"); (_CurrentSourceInfo.SourceDevice as IInUseTracking).InUseTracker.RemoveUser(this, "control");
if (handler != null) if (handler != null)
handler(this, _CurrentSourceInfo, ChangeType.WillChange); handler(this, _CurrentSourceInfo, ChangeType.WillChange);
_CurrentSourceInfo = value; _CurrentSourceInfo = value;
// add to in-use tracking // add to in-use tracking
if (_CurrentSourceInfo != null && _CurrentSourceInfo.SourceDevice is IInUseTracking) if (_CurrentSourceInfo != null && _CurrentSourceInfo.SourceDevice is IInUseTracking)
(_CurrentSourceInfo.SourceDevice as IInUseTracking).InUseTracker.AddUser(this, "control"); (_CurrentSourceInfo.SourceDevice as IInUseTracking).InUseTracker.AddUser(this, "control");
if (handler != null) if (handler != null)
handler(this, _CurrentSourceInfo, ChangeType.DidChange); handler(this, _CurrentSourceInfo, ChangeType.DidChange);
} }
} }
SourceListItem _CurrentSourceInfo; SourceListItem _CurrentSourceInfo;
public string CurrentSourceInfoKey { get; private set; } public string CurrentSourceInfoKey { get; private set; }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="key"></param> /// <param name="key"></param>
/// <param name="name"></param> /// <param name="name"></param>
public EssentialsHuddleSpaceRoom(string key, string name, IRoutingSinkWithSwitching defaultDisplay, public EssentialsHuddleSpaceRoom(string key, string name, IRoutingSinkWithSwitching defaultDisplay,
IRoutingSinkNoSwitching defaultAudio, EssentialsRoomPropertiesConfig config) IRoutingSinkNoSwitching defaultAudio, EssentialsRoomPropertiesConfig config)
: base(key, name) : base(key, name)
{ {
Config = config; Config = config;
DefaultDisplay = defaultDisplay; DefaultDisplay = defaultDisplay;
DefaultAudioDevice = defaultAudio; DefaultAudioDevice = defaultAudio;
if (defaultAudio is IBasicVolumeControls) if (defaultAudio is IBasicVolumeControls)
DefaultVolumeControls = defaultAudio as IBasicVolumeControls; DefaultVolumeControls = defaultAudio as IBasicVolumeControls;
else if (defaultAudio is IHasVolumeDevice) else if (defaultAudio is IHasVolumeDevice)
DefaultVolumeControls = (defaultAudio as IHasVolumeDevice).VolumeDevice; DefaultVolumeControls = (defaultAudio as IHasVolumeDevice).VolumeDevice;
CurrentVolumeControls = DefaultVolumeControls; CurrentVolumeControls = DefaultVolumeControls;
var disp = DefaultDisplay as DisplayBase; var disp = DefaultDisplay as DisplayBase;
if (disp != null) if (disp != null)
{ {
// Link power, warming, cooling to display // Link power, warming, cooling to display
disp.PowerIsOnFeedback.OutputChange += (o, a) => disp.PowerIsOnFeedback.OutputChange += (o, a) =>
{ {
if (disp.PowerIsOnFeedback.BoolValue != OnFeedback.BoolValue) if (disp.PowerIsOnFeedback.BoolValue != OnFeedback.BoolValue)
{ {
if (!disp.PowerIsOnFeedback.BoolValue) if (!disp.PowerIsOnFeedback.BoolValue)
CurrentSourceInfo = null; CurrentSourceInfo = null;
OnFeedback.FireUpdate(); OnFeedback.FireUpdate();
} }
}; };
disp.IsWarmingUpFeedback.OutputChange += (o, a) => disp.IsWarmingUpFeedback.OutputChange += (o, a) =>
{ {
IsWarmingUpFeedback.FireUpdate(); IsWarmingUpFeedback.FireUpdate();
if (!IsWarmingUpFeedback.BoolValue) if (!IsWarmingUpFeedback.BoolValue)
(DefaultDisplay as IBasicVolumeWithFeedback).SetVolume(DefaultVolume); (DefaultDisplay as IBasicVolumeWithFeedback).SetVolume(DefaultVolume);
}; };
disp.IsCoolingDownFeedback.OutputChange += (o, a) => disp.IsCoolingDownFeedback.OutputChange += (o, a) =>
{ {
IsCoolingDownFeedback.FireUpdate(); IsCoolingDownFeedback.FireUpdate();
if (IsCoolingDownFeedback.BoolValue) if (IsCoolingDownFeedback.BoolValue)
(DefaultDisplay as IBasicVolumeWithFeedback).SetVolume(DefaultVolume); (DefaultDisplay as IBasicVolumeWithFeedback).SetVolume(DefaultVolume);
}; };
} }
SourceListKey = "default"; SourceListKey = "default";
EnablePowerOnToLastSource = true; EnablePowerOnToLastSource = true;
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public override void Shutdown() public override void Shutdown()
{ {
RunRouteAction("roomOff"); RunRouteAction("roomOff");
} }
/// <summary> /// <summary>
/// Routes the default source item, if any /// Routes the default source item, if any
/// </summary> /// </summary>
public void RunDefaultRoute() public void RunDefaultRoute()
{ {
if (DefaultSourceItem != null) if (DefaultSourceItem != null)
RunRouteAction(DefaultSourceItem); RunRouteAction(DefaultSourceItem);
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="routeKey"></param> /// <param name="routeKey"></param>
public void RunRouteAction(string routeKey) public void RunRouteAction(string routeKey)
{ {
RunRouteAction(routeKey, null); RunRouteAction(routeKey, null);
} }
/// <summary> /// <summary>
/// Gets a source from config list SourceListKey and dynamically build and executes the /// Gets a source from config list SourceListKey and dynamically build and executes the
/// route or commands /// route or commands
/// </summary> /// </summary>
/// <param name="name"></param> /// <param name="name"></param>
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 =>
{ {
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;
} }
// Try to get the list item by it's string key // Try to get the list item by it's string key
if (!dict.ContainsKey(routeKey)) if (!dict.ContainsKey(routeKey))
{ {
Debug.Console(1, this, "WARNING: No item '{0}' found on config list '{1}'", Debug.Console(1, this, "WARNING: No item '{0}' found on config list '{1}'",
routeKey, SourceListKey); routeKey, SourceListKey);
return; return;
} }
var item = dict[routeKey]; var item = dict[routeKey];
//Debug.Console(2, this, "Action {0} has {1} steps", //Debug.Console(2, this, "Action {0} has {1} steps",
// item.SourceKey, item.RouteList.Count); // item.SourceKey, item.RouteList.Count);
// End usage timer on last source // End usage timer on last source
if (!string.IsNullOrEmpty(LastSourceKey)) if (!string.IsNullOrEmpty(LastSourceKey))
{ {
var lastSource = dict[LastSourceKey].SourceDevice; var lastSource = dict[LastSourceKey].SourceDevice;
try try
{ {
if (lastSource != null && lastSource is IUsageTracking) if (lastSource != null && lastSource is IUsageTracking)
(lastSource as IUsageTracking).UsageTracker.EndDeviceUsage(); (lastSource as IUsageTracking).UsageTracker.EndDeviceUsage();
} }
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 (257):\r{0}", e);
} }
} }
// Let's run it // Let's run it
if (routeKey.ToLower() != "roomoff") if (routeKey.ToLower() != "roomoff")
{ {
LastSourceKey = routeKey; LastSourceKey = routeKey;
} }
else else
{ {
CurrentSourceInfoKey = null; CurrentSourceInfoKey = null;
} }
foreach (var route in item.RouteList) foreach (var route in item.RouteList)
{ {
// if there is a $defaultAll on route, run two separate // if there is a $defaultAll on route, run two separate
if (route.DestinationKey.Equals("$defaultAll", StringComparison.OrdinalIgnoreCase)) if (route.DestinationKey.Equals("$defaultAll", StringComparison.OrdinalIgnoreCase))
{ {
// Going to assume a single-path route for now // Going to assume a single-path route for now
var tempVideo = new SourceRouteListItem var tempVideo = new SourceRouteListItem
{ {
DestinationKey = "$defaultDisplay", DestinationKey = "$defaultDisplay",
SourceKey = route.SourceKey, SourceKey = route.SourceKey,
Type = eRoutingSignalType.Video Type = eRoutingSignalType.Video
}; };
DoRoute(tempVideo); DoRoute(tempVideo);
//var tempAudio = new SourceRouteListItem //var tempAudio = new SourceRouteListItem
//{ //{
// DestinationKey = "$defaultAudio", // DestinationKey = "$defaultAudio",
// SourceKey = route.SourceKey, // SourceKey = route.SourceKey,
// Type = eRoutingSignalType.Audio // Type = eRoutingSignalType.Audio
//}; //};
//DoRoute(tempAudio); //DoRoute(tempAudio);
//continue; -- not sure why this was here //continue; -- not sure why this was here
} }
else else
DoRoute(route); 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 // Set volume control on room, using default if non provided
IBasicVolumeControls volDev = null; IBasicVolumeControls volDev = null;
// Handle special cases for volume control // Handle special cases for volume control
if (string.IsNullOrEmpty(item.VolumeControlKey) if (string.IsNullOrEmpty(item.VolumeControlKey)
|| item.VolumeControlKey.Equals("$defaultAudio", StringComparison.OrdinalIgnoreCase)) || item.VolumeControlKey.Equals("$defaultAudio", StringComparison.OrdinalIgnoreCase))
volDev = DefaultVolumeControls; volDev = DefaultVolumeControls;
else if (item.VolumeControlKey.Equals("$defaultDisplay", StringComparison.OrdinalIgnoreCase)) else if (item.VolumeControlKey.Equals("$defaultDisplay", StringComparison.OrdinalIgnoreCase))
volDev = DefaultDisplay as IBasicVolumeControls; volDev = DefaultDisplay as IBasicVolumeControls;
// Or a specific device, probably rarely used. // Or a specific device, probably rarely used.
else else
{ {
var dev = DeviceManager.GetDeviceForKey(item.VolumeControlKey); var dev = DeviceManager.GetDeviceForKey(item.VolumeControlKey);
if (dev is IBasicVolumeControls) if (dev is IBasicVolumeControls)
volDev = dev as IBasicVolumeControls; volDev = dev as IBasicVolumeControls;
else if (dev is IHasVolumeDevice) else if (dev is IHasVolumeDevice)
volDev = (dev as IHasVolumeDevice).VolumeDevice; volDev = (dev as IHasVolumeDevice).VolumeDevice;
} }
CurrentVolumeControls = volDev; 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")
{ {
CurrentSourceInfoKey = routeKey; CurrentSourceInfoKey = routeKey;
CurrentSourceInfo = null; CurrentSourceInfo = null;
} }
else if (item.SourceKey != null) else if (item.SourceKey != null)
{ {
CurrentSourceInfoKey = routeKey; CurrentSourceInfoKey = routeKey;
CurrentSourceInfo = item; CurrentSourceInfo = item;
} }
// And finally, set the "control". This will trigger event // And finally, set the "control". This will trigger event
//CurrentControlDevice = DeviceManager.GetDeviceForKey(item.SourceKey) as Device; //CurrentControlDevice = DeviceManager.GetDeviceForKey(item.SourceKey) as Device;
OnFeedback.FireUpdate(); OnFeedback.FireUpdate();
// report back when done // report back when done
if (successCallback != null) if (successCallback != null)
successCallback(); successCallback();
}, 0); // end of CTimer }, 0); // end of CTimer
} }
/// <summary> /// <summary>
/// Will power the room on with the last-used source /// Will power the room on with the last-used source
/// </summary> /// </summary>
public void PowerOnToDefaultOrLastSource() public void PowerOnToDefaultOrLastSource()
{ {
if (!EnablePowerOnToLastSource || LastSourceKey == null) if (!EnablePowerOnToLastSource || LastSourceKey == null)
return; return;
RunRouteAction(LastSourceKey); RunRouteAction(LastSourceKey);
} }
/// <summary> /// <summary>
/// Does what it says /// Does what it says
/// </summary> /// </summary>
public override void SetDefaultLevels() public override void SetDefaultLevels()
{ {
Debug.Console(0, this, "SetDefaultLevels not implemented"); Debug.Console(0, this, "SetDefaultLevels not implemented");
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="route"></param> /// <param name="route"></param>
/// <returns></returns> /// <returns></returns>
bool DoRoute(SourceRouteListItem route) bool DoRoute(SourceRouteListItem route)
{ {
IRoutingSinkNoSwitching dest = null; IRoutingSinkNoSwitching dest = null;
if (route.DestinationKey.Equals("$defaultaudio", StringComparison.OrdinalIgnoreCase)) if (route.DestinationKey.Equals("$defaultaudio", StringComparison.OrdinalIgnoreCase))
dest = DefaultAudioDevice; dest = DefaultAudioDevice;
else if (route.DestinationKey.Equals("$defaultDisplay", StringComparison.OrdinalIgnoreCase)) else if (route.DestinationKey.Equals("$defaultDisplay", StringComparison.OrdinalIgnoreCase))
dest = DefaultDisplay; dest = DefaultDisplay;
else else
dest = DeviceManager.GetDeviceForKey(route.DestinationKey) as IRoutingSinkNoSwitching; dest = DeviceManager.GetDeviceForKey(route.DestinationKey) as IRoutingSinkNoSwitching;
if (dest == null) if (dest == null)
{ {
Debug.Console(1, this, "Cannot route, unknown destination '{0}'", route.DestinationKey); Debug.Console(1, this, "Cannot route, unknown destination '{0}'", route.DestinationKey);
return false; return false;
} }
if (route.SourceKey.Equals("$off", StringComparison.OrdinalIgnoreCase)) if (route.SourceKey.Equals("$off", StringComparison.OrdinalIgnoreCase))
{ {
dest.ReleaseRoute(); dest.ReleaseRoute();
if (dest is IPower) if (dest is IPower)
(dest as IPower).PowerOff(); (dest as IPower).PowerOff();
} }
else else
{ {
var source = DeviceManager.GetDeviceForKey(route.SourceKey) as IRoutingOutputs; var source = DeviceManager.GetDeviceForKey(route.SourceKey) as IRoutingOutputs;
if (source == null) if (source == null)
{ {
Debug.Console(1, this, "Cannot route unknown source '{0}' to {1}", route.SourceKey, route.DestinationKey); Debug.Console(1, this, "Cannot route unknown source '{0}' to {1}", route.SourceKey, route.DestinationKey);
return false; return false;
} }
dest.ReleaseAndMakeRoute(source, route.Type); dest.ReleaseAndMakeRoute(source, route.Type);
} }
return true; return true;
} }
public override void RoomVacatedForTimeoutPeriod(object o) public override void RoomVacatedForTimeoutPeriod(object o)
{ {
//Implement this //Implement this
} }
/// <summary> /// <summary>
/// Runs "roomOff" action on all rooms not set to ExcludeFromGlobalFunctions /// Runs "roomOff" action on all rooms not set to ExcludeFromGlobalFunctions
/// </summary> /// </summary>
public static void AllRoomsOff() public static void AllRoomsOff()
{ {
var allRooms = DeviceManager.AllDevices.Where(d => var allRooms = DeviceManager.AllDevices.Where(d =>
d is EssentialsHuddleSpaceRoom && !(d as EssentialsHuddleSpaceRoom).ExcludeFromGlobalFunctions); d is EssentialsHuddleSpaceRoom && !(d as EssentialsHuddleSpaceRoom).ExcludeFromGlobalFunctions);
foreach (var room in allRooms) foreach (var room in allRooms)
(room as EssentialsHuddleSpaceRoom).RunRouteAction("roomOff"); (room as EssentialsHuddleSpaceRoom).RunRouteAction("roomOff");
} }
} }
} }

View File

@@ -227,19 +227,9 @@ namespace PepperDash.Essentials
/// 2904 /// 2904
/// </summary> /// </summary>
public const uint KeyboardButton2Press = 2904; public const uint KeyboardButton2Press = 2904;
/// <summary>
/// 2910
/// </summary>
//public const uint KeyboardClearPress = 2910;
/// <summary>
/// 2911
/// </summary>
//public const uint KeyboardClearVisible = 2911;
// Letter joins start at 2921; // Letter joins start at 2921;
/// <summary> /// <summary>
/// 3101 /// 3101
/// </summary> /// </summary>
@@ -273,8 +263,6 @@ namespace PepperDash.Essentials
/// </summary> /// </summary>
public const uint TechSchedulerVisible = 3112; public const uint TechSchedulerVisible = 3112;
//****************************************************** //******************************************************
/// <summary> /// <summary>
/// 3811 /// 3811

View File

@@ -537,11 +537,9 @@ namespace PepperDash.Essentials
/// <param name="e"></param> /// <param name="e"></param>
void ShutdownPromptTimer_HasFinished(object sender, EventArgs e) void ShutdownPromptTimer_HasFinished(object sender, EventArgs e)
{ {
//Debug.Console(2, "*#*UI shutdown prompt finished");
EndMeetingButtonSig.BoolValue = false; EndMeetingButtonSig.BoolValue = false;
CurrentRoom.ShutdownPromptTimer.TimeRemainingFeedback.OutputChange -= ShutdownPromptTimer_TimeRemainingFeedback_OutputChange; CurrentRoom.ShutdownPromptTimer.TimeRemainingFeedback.OutputChange -= ShutdownPromptTimer_TimeRemainingFeedback_OutputChange;
CurrentRoom.ShutdownPromptTimer.PercentFeedback.OutputChange -= ShutdownPromptTimer_PercentFeedback_OutputChange; CurrentRoom.ShutdownPromptTimer.PercentFeedback.OutputChange -= ShutdownPromptTimer_PercentFeedback_OutputChange;
} }
/// <summary> /// <summary>
@@ -551,7 +549,6 @@ namespace PepperDash.Essentials
/// <param name="e"></param> /// <param name="e"></param>
void ShutdownPromptTimer_WasCancelled(object sender, EventArgs e) void ShutdownPromptTimer_WasCancelled(object sender, EventArgs e)
{ {
//Debug.Console(2, "*#*UI shutdown prompt cancelled");
if (PowerDownModal != null) if (PowerDownModal != null)
PowerDownModal.HideDialog(); PowerDownModal.HideDialog();
EndMeetingButtonSig.BoolValue = false; EndMeetingButtonSig.BoolValue = false;

View File

@@ -12,6 +12,7 @@ using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.SmartObjects; using PepperDash.Essentials.Core.SmartObjects;
using PepperDash.Essentials.Core.Touchpanels.Keyboards; using PepperDash.Essentials.Core.Touchpanels.Keyboards;
using PepperDash.Essentials.Devices.Displays; using PepperDash.Essentials.Devices.Displays;
using PepperDash.Essentials.Room.Config;
namespace PepperDash.Essentials.UIDrivers namespace PepperDash.Essentials.UIDrivers
{ {
@@ -49,7 +50,7 @@ namespace PepperDash.Essentials.UIDrivers
CTimer PinAuthorizedTimer; CTimer PinAuthorizedTimer;
string Pin; EssentialsRoomTechConfig Config;
StringBuilder PinEntryBuilder = new StringBuilder(4); StringBuilder PinEntryBuilder = new StringBuilder(4);
@@ -57,18 +58,16 @@ namespace PepperDash.Essentials.UIDrivers
SmartObjectNumeric PinKeypad; SmartObjectNumeric PinKeypad;
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="trilist"></param> /// <param name="trilist"></param>
/// <param name="parent"></param> /// <param name="parent"></param>
public EssentialsHuddleTechPageDriver(BasicTriListWithSmartObject trilist, IAVDriver parent, string pin) public EssentialsHuddleTechPageDriver(BasicTriListWithSmartObject trilist, IAVDriver parent, EssentialsRoomTechConfig config)
: base(trilist) : base(trilist)
{ {
Parent = parent; Parent = parent;
Pin = pin; Config = config;
PagesInterlock = new JoinedSigInterlock(trilist); PagesInterlock = new JoinedSigInterlock(trilist);
PagesInterlock.SetButDontShow(UIBoolJoin.TechSystemStatusVisible); PagesInterlock.SetButDontShow(UIBoolJoin.TechSystemStatusVisible);
@@ -176,7 +175,7 @@ namespace PepperDash.Essentials.UIDrivers
// check it! // check it!
if (len == 4) if (len == 4)
{ {
if (Pin == PinEntryBuilder.ToString()) if (Config.Password == PinEntryBuilder.ToString())
{ {
IsAuthorized = true; IsAuthorized = true;
SetPinDotsFeedback(0); SetPinDotsFeedback(0);
@@ -257,10 +256,8 @@ namespace PepperDash.Essentials.UIDrivers
d.Group.Equals("display", StringComparison.OrdinalIgnoreCase) d.Group.Equals("display", StringComparison.OrdinalIgnoreCase)
|| d.Group.Equals("projector", StringComparison.OrdinalIgnoreCase)) || d.Group.Equals("projector", StringComparison.OrdinalIgnoreCase))
.Select(dd => dd.Key); .Select(dd => dd.Key);
Debug.Console(1, "#################### Config has {0} displays", devKeys.Count());
var disps = DeviceManager.AllDevices.Where(d => var disps = DeviceManager.AllDevices.Where(d =>
devKeys.Contains(d.Key)); devKeys.Contains(d.Key));
Debug.Console(1, "#################### Devices has {0} displays", disps.Count());
ushort i = 0; ushort i = 0;
foreach (var disp in disps) foreach (var disp in disps)
{ {

View File

@@ -153,8 +153,7 @@ namespace PepperDash.Essentials
get get
{ {
if (_TechDriver == null) if (_TechDriver == null)
#warning HLV-Make PIN come from config! _TechDriver = new PepperDash.Essentials.UIDrivers.EssentialsHuddleTechPageDriver(TriList, this, CurrentRoom.Config.Tech);
_TechDriver = new PepperDash.Essentials.UIDrivers.EssentialsHuddleTechPageDriver(TriList, this, "1234");
return _TechDriver; return _TechDriver;
} }
} }
@@ -390,7 +389,6 @@ namespace PepperDash.Essentials
var ss = CurrentRoom.ScheduleSource; var ss = CurrentRoom.ScheduleSource;
if (ss != null) if (ss != null)
{ {
#warning HLV-Add some sort of every-minute "cron" thing to run these.
NextMeetingTimer = new CTimer(o => NextMeetingTimer = new CTimer(o =>
{ {
if (CurrentRoom.OnFeedback.BoolValue) if (CurrentRoom.OnFeedback.BoolValue)
@@ -578,7 +576,6 @@ namespace PepperDash.Essentials
} }
else // room is on show what's active or select a source if nothing is yet active else // room is on show what's active or select a source if nothing is yet active
{ {
Debug.Console(0, "*#*#*#*# ActivitySharPressed: CurrentSourceInfoKey={0}", CurrentRoom.CurrentSourceInfoKey);
if(CurrentRoom.CurrentSourceInfo == null || CurrentRoom.CurrentSourceInfoKey == CurrentRoom.DefaultCodecRouteString) if(CurrentRoom.CurrentSourceInfo == null || CurrentRoom.CurrentSourceInfoKey == CurrentRoom.DefaultCodecRouteString)
TriList.SetBool(UIBoolJoin.SelectASourceVisible, true); TriList.SetBool(UIBoolJoin.SelectASourceVisible, true);
else if (CurrentSourcePageManager != null) else if (CurrentSourcePageManager != null)

View File

@@ -16,9 +16,6 @@ using PepperDash.Essentials.Devices.Common.VideoCodec;
namespace PepperDash.Essentials.UIDrivers.VC namespace PepperDash.Essentials.UIDrivers.VC
{ {
#warning HLV - FOR SPARK - (GFX also) we need a staging bar for in call state where there is no camera button
/// <summary> /// <summary>
/// This fella will likely need to interact with the room's source, although that is routed via the spark... /// This fella will likely need to interact with the room's source, although that is routed via the spark...
/// Probably needs event or FB to feed AV driver - to show two-mute volume when appropriate. /// Probably needs event or FB to feed AV driver - to show two-mute volume when appropriate.
@@ -154,12 +151,10 @@ namespace PepperDash.Essentials.UIDrivers.VC
void Codec_CallStatusChange(object sender, CodecCallStatusItemChangeEventArgs e) void Codec_CallStatusChange(object sender, CodecCallStatusItemChangeEventArgs e)
{ {
var call = e.CallItem; var call = e.CallItem;
Debug.Console(1, "*#* UI: Codec status {0}: {1} --> {2}", call.Name, e.PreviousStatus, e.NewStatus);
switch (e.NewStatus) switch (e.NewStatus)
{ {
case eCodecCallStatus.Connected: case eCodecCallStatus.Connected:
// fire at SRL item // fire at SRL item
Debug.Console(1, "*#* UI: Call Connected {0}", call.Name);
KeypadMode = eKeypadMode.DTMF; KeypadMode = eKeypadMode.DTMF;
DialStringBuilder.Remove(0, DialStringBuilder.Length); DialStringBuilder.Remove(0, DialStringBuilder.Length);
DialStringFeedback.FireUpdate(); DialStringFeedback.FireUpdate();
@@ -170,15 +165,12 @@ namespace PepperDash.Essentials.UIDrivers.VC
break; break;
case eCodecCallStatus.Connecting: case eCodecCallStatus.Connecting:
// fire at SRL item // fire at SRL item
Debug.Console(1, "*#* UI: Call Connecting {0}", call.Name);
Parent.ShowNotificationRibbon("Connecting", 0); Parent.ShowNotificationRibbon("Connecting", 0);
break; break;
case eCodecCallStatus.Dialing: case eCodecCallStatus.Dialing:
Debug.Console(1, "*#* UI: Call Dialing {0}", call.Name);
Parent.ShowNotificationRibbon("Dialing", 0); Parent.ShowNotificationRibbon("Dialing", 0);
break; break;
case eCodecCallStatus.Disconnected: case eCodecCallStatus.Disconnected:
Debug.Console(1, "*#* UI: Call Disconnecting {0}", call.Name);
if (!Codec.IsInCall) if (!Codec.IsInCall)
{ {
KeypadMode = eKeypadMode.Dial; KeypadMode = eKeypadMode.Dial;