mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-08 09:15:06 +00:00
Hopefully fixed standby/power off glitch on Sammy; Removed some debugging; Removed duplicate routing on huddle room
This commit is contained in:
@@ -112,7 +112,7 @@ namespace PepperDash.Essentials.Core
|
|||||||
StartErrorTimers();
|
StartErrorTimers();
|
||||||
if (Client.IsConnected)
|
if (Client.IsConnected)
|
||||||
{
|
{
|
||||||
Debug.Console(2, this, "Polling");
|
//Debug.Console(2, this, "Polling");
|
||||||
if(PollAction != null)
|
if(PollAction != null)
|
||||||
PollAction.Invoke();
|
PollAction.Invoke();
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ namespace PepperDash.Essentials.Core
|
|||||||
var newRoute = destination.GetRouteToSource(source, signalType);
|
var newRoute = destination.GetRouteToSource(source, signalType);
|
||||||
if (newRoute == null) return;
|
if (newRoute == null) return;
|
||||||
RouteDescriptorCollection.DefaultCollection.AddRouteDescriptor(newRoute);
|
RouteDescriptorCollection.DefaultCollection.AddRouteDescriptor(newRoute);
|
||||||
Debug.Console(1, destination, "Executing new route");
|
//Debug.Console(1, destination, "Executing new route");
|
||||||
newRoute.ExecuteRoutes();
|
newRoute.ExecuteRoutes();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,7 +80,7 @@ namespace PepperDash.Essentials.Core
|
|||||||
routeDescr = null;
|
routeDescr = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug.Console(1, destination, "Route{0} discovered", routeDescr == null ? " NOT" : "");
|
//Debug.Console(1, destination, "Route{0} discovered", routeDescr == null ? " NOT" : "");
|
||||||
return routeDescr;
|
return routeDescr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,7 +102,7 @@ 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);
|
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));
|
||||||
|
|
||||||
@@ -114,7 +114,7 @@ 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);
|
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.
|
||||||
@@ -149,7 +149,7 @@ namespace PepperDash.Essentials.Core
|
|||||||
// we have a route on corresponding inputPort. *** Do the route ***
|
// we have a route on corresponding inputPort. *** Do the route ***
|
||||||
if (goodInputPort != null)
|
if (goodInputPort != null)
|
||||||
{
|
{
|
||||||
Debug.Console(2, destination, "adding RouteDescriptor");
|
//Debug.Console(2, destination, "adding RouteDescriptor");
|
||||||
if (outputPortToUse == null)
|
if (outputPortToUse == null)
|
||||||
{
|
{
|
||||||
// it's a sink device
|
// it's a sink device
|
||||||
@@ -161,7 +161,7 @@ namespace PepperDash.Essentials.Core
|
|||||||
}
|
}
|
||||||
else // device is merely IRoutingInputOutputs
|
else // device is merely IRoutingInputOutputs
|
||||||
Debug.Console(2, destination, " No routing. Passthrough device");
|
Debug.Console(2, destination, " No routing. Passthrough device");
|
||||||
Debug.Console(2, destination, "Exiting cycle {0}", cycle);
|
//Debug.Console(2, destination, "Exiting cycle {0}", cycle);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ namespace PepperDash.Essentials.Devices.Displays
|
|||||||
|
|
||||||
|
|
||||||
bool _PowerIsOn;
|
bool _PowerIsOn;
|
||||||
bool _PowerValueIncomingWaitingForCheck;
|
|
||||||
bool _IsWarmingUp;
|
bool _IsWarmingUp;
|
||||||
bool _IsCoolingDown;
|
bool _IsCoolingDown;
|
||||||
ushort _VolumeLevelForSig;
|
ushort _VolumeLevelForSig;
|
||||||
@@ -34,6 +33,7 @@ namespace PepperDash.Essentials.Devices.Displays
|
|||||||
byte[] IncomingBuffer = new byte[]{};
|
byte[] IncomingBuffer = new byte[]{};
|
||||||
ActionIncrementer VolumeIncrementer;
|
ActionIncrementer VolumeIncrementer;
|
||||||
bool VolumeIsRamping;
|
bool VolumeIsRamping;
|
||||||
|
public bool IsInStandby { get; private set; }
|
||||||
|
|
||||||
protected override Func<bool> PowerIsOnFeedbackFunc { get { return () => _PowerIsOn; } }
|
protected override Func<bool> PowerIsOnFeedbackFunc { get { return () => _PowerIsOn; } }
|
||||||
protected override Func<bool> IsCoolingDownFeedbackFunc { get { return () => _IsCoolingDown; } }
|
protected override Func<bool> IsCoolingDownFeedbackFunc { get { return () => _IsCoolingDown; } }
|
||||||
@@ -181,7 +181,7 @@ 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));
|
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)
|
||||||
@@ -244,13 +244,20 @@ namespace PepperDash.Essentials.Devices.Displays
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Updates power status from general updates where source is included.
|
/// Updates power status from general updates where source is included.
|
||||||
/// Compensates for errant standby / power off hiccups by ignoring
|
/// Compensates for errant standby / power off hiccups by ignoring
|
||||||
/// power off states with input < 0x10
|
/// power off states with input < 0x10
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void UpdatePowerFB(byte powerByte, byte inputByte)
|
void UpdatePowerFB(byte powerByte, byte inputByte)
|
||||||
{
|
{
|
||||||
// This should reject errant power feedbacks when switching away from input on standby.
|
// This should reject errant power feedbacks when switching away from input on standby.
|
||||||
if (powerByte == 0x00 && inputByte < 0x10)
|
if (powerByte == 0x01 && inputByte < 0x10)
|
||||||
|
IsInStandby = true;
|
||||||
|
if (powerByte == 0x00 && IsInStandby) // Ignore power off if coming from standby - glitch
|
||||||
|
{
|
||||||
|
Debug.Console(2, this, "*#* STANDBY GLITCH - IGNORING");
|
||||||
|
IsInStandby = false;
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
UpdatePowerFB(powerByte);
|
UpdatePowerFB(powerByte);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -311,7 +318,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -364,7 +371,7 @@ 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");
|
Debug.Console(2, this, "*#* Cooldown timer ending");
|
||||||
_IsCoolingDown = false;
|
_IsCoolingDown = false;
|
||||||
IsCoolingDownFeedback.FireUpdate();
|
IsCoolingDownFeedback.FireUpdate();
|
||||||
}, CooldownTime);
|
}, CooldownTime);
|
||||||
@@ -446,8 +453,8 @@ namespace PepperDash.Essentials.Devices.Displays
|
|||||||
/// <param name="selector"></param>
|
/// <param name="selector"></param>
|
||||||
public override void ExecuteSwitch(object selector)
|
public override void ExecuteSwitch(object selector)
|
||||||
{
|
{
|
||||||
if (!(selector is Action))
|
//if (!(selector is Action))
|
||||||
Debug.Console(1, this, "WARNING: ExecuteSwitch cannot handle type {0}", selector.GetType());
|
// Debug.Console(1, this, "WARNING: ExecuteSwitch cannot handle type {0}", selector.GetType());
|
||||||
|
|
||||||
if (_PowerIsOn)
|
if (_PowerIsOn)
|
||||||
(selector as Action)();
|
(selector as Action)();
|
||||||
|
|||||||
@@ -1,378 +0,0 @@
|
|||||||
//using System;
|
|
||||||
//using System.Collections.Generic;
|
|
||||||
//using System.Linq;
|
|
||||||
//using System.Text;
|
|
||||||
//using Crestron.SimplSharp;
|
|
||||||
//using Crestron.SimplSharpPro;
|
|
||||||
|
|
||||||
//using PepperDash.Core;
|
|
||||||
//using PepperDash.Essentials.Core;
|
|
||||||
|
|
||||||
//namespace PepperDash.Essentials
|
|
||||||
//{
|
|
||||||
// //***************************************************************************************************
|
|
||||||
|
|
||||||
// public class HuddleSpaceRoom : EssentialsRoom
|
|
||||||
// {
|
|
||||||
// public override BoolFeedback RoomIsOnFeedback { get; protected set; }
|
|
||||||
// public override BoolFeedback IsWarmingUpFeedback { get; protected set; }
|
|
||||||
// public override BoolFeedback IsCoolingDownFeedback { get; protected set; }
|
|
||||||
// public override BoolFeedback RoomIsOnStandby { get; protected set; }
|
|
||||||
// public override BoolFeedback RoomIsOccupied { get; protected set; }
|
|
||||||
|
|
||||||
// public override uint WarmupTime
|
|
||||||
// {
|
|
||||||
// get
|
|
||||||
// {
|
|
||||||
// if (_Display != null)
|
|
||||||
// return _Display.WarmupTime;
|
|
||||||
// return base.WarmupTime;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// public override uint CooldownTime
|
|
||||||
// {
|
|
||||||
// get
|
|
||||||
// {
|
|
||||||
// if (_Display != null)
|
|
||||||
// return _Display.CooldownTime;
|
|
||||||
// return base.CooldownTime;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// bool NoDisplayRoomIsOn = false;
|
|
||||||
|
|
||||||
// public DisplayBase DefaultDisplay // PROTECT ---------------------------------------------
|
|
||||||
// {
|
|
||||||
// get
|
|
||||||
// {
|
|
||||||
// if (_Display == null)
|
|
||||||
// _Display = TwoWayDisplayBase.DefaultDisplay;
|
|
||||||
// return _Display;
|
|
||||||
// }
|
|
||||||
// set
|
|
||||||
// {
|
|
||||||
// // Disconnect current display
|
|
||||||
// if (_Display != null)
|
|
||||||
// {
|
|
||||||
// _Display.PowerIsOnFeedback.OutputChange -= Display_Various_OutputChange;
|
|
||||||
// _Display.IsCoolingDownFeedback.OutputChange -= Display_Various_OutputChange;
|
|
||||||
// _Display.IsWarmingUpFeedback.OutputChange -= Display_Various_OutputChange;
|
|
||||||
// }
|
|
||||||
// _Display = value;
|
|
||||||
// if (value != null)
|
|
||||||
// {
|
|
||||||
// _Display.PowerIsOnFeedback.OutputChange += Display_Various_OutputChange;
|
|
||||||
// _Display.IsCoolingDownFeedback.OutputChange += Display_Various_OutputChange;
|
|
||||||
// _Display.IsWarmingUpFeedback.OutputChange += Display_Various_OutputChange;
|
|
||||||
// }
|
|
||||||
// CurrentAudioDevice = (value as IBasicVolumeControls);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// DisplayBase _Display;
|
|
||||||
|
|
||||||
// public IBasicVolumeControls DefaultVolumeControls
|
|
||||||
// {
|
|
||||||
// get { return DefaultDisplay as IBasicVolumeControls; }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// public IntFeedback SourcesCount { get; private set; }
|
|
||||||
// public StringFeedback CurrentSourceName { get; private set; }
|
|
||||||
|
|
||||||
// public string SourceListKey { get; set; }
|
|
||||||
// string LastSourceKey;
|
|
||||||
|
|
||||||
// public HuddleSpaceRoom(string key, string name)
|
|
||||||
// : base(key, name)
|
|
||||||
// {
|
|
||||||
// // Return the state of the display, unless no display, then return
|
|
||||||
// // a local or default state.
|
|
||||||
|
|
||||||
// RoomIsOnFeedback = new BoolFeedback(RoomCue.RoomIsOn,
|
|
||||||
// () => DefaultDisplay != null ? DefaultDisplay.PowerIsOnFeedback.BoolValue : NoDisplayRoomIsOn);
|
|
||||||
// IsWarmingUpFeedback = new BoolFeedback(RoomCue.RoomIsWarmingUp,
|
|
||||||
// () => DefaultDisplay != null ? DefaultDisplay.IsWarmingUpFeedback.BoolValue : false);
|
|
||||||
// IsCoolingDownFeedback = new BoolFeedback(RoomCue.RoomIsCoolingDown,
|
|
||||||
// () => DefaultDisplay != null ? DefaultDisplay.IsCoolingDownFeedback.BoolValue : false);
|
|
||||||
// RoomIsOnStandby = new BoolFeedback(RoomCue.RoomIsOnStandby,
|
|
||||||
// () => false);
|
|
||||||
// RoomIsOccupied = new BoolFeedback(RoomCue.RoomIsOccupied,
|
|
||||||
// () => true);
|
|
||||||
|
|
||||||
// Sources = new Dictionary<uint, Device>();
|
|
||||||
|
|
||||||
// SourcesCount = new IntFeedback(RoomCue.SourcesCount,
|
|
||||||
// () => Sources.Count);
|
|
||||||
// CurrentSourceName = new StringFeedback(() => CurrentPresentationSourceInfo.PreferredName);// CurrentPresentationSource.Name);
|
|
||||||
// //CurrentSourceType = new IntOutput(RoomCue.CurrentSourceType,
|
|
||||||
// // () => CurrentPresentationSource.Type);
|
|
||||||
|
|
||||||
// UnattendedShutdownTimeMs = 60000;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// public override void RoomOn()
|
|
||||||
// {
|
|
||||||
// Debug.Console(0, this, "Room on");
|
|
||||||
// if (IsCoolingDownFeedback.BoolValue || IsWarmingUpFeedback.BoolValue)
|
|
||||||
// {
|
|
||||||
// Debug.Console(2, this, "Room is warming or cooling. Ignoring room on");
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// if (!RoomIsOnFeedback.BoolValue)
|
|
||||||
// {
|
|
||||||
// // Setup callback when powerOn happens
|
|
||||||
// EventHandler<EventArgs> oneTimeHandler = null;
|
|
||||||
// oneTimeHandler = (o, a) =>
|
|
||||||
// {
|
|
||||||
// Debug.Console(0, this, "RoomOn received display power on: {0}",
|
|
||||||
// DefaultDisplay.PowerIsOnFeedback.BoolValue);
|
|
||||||
// // if it's power on
|
|
||||||
// if (DefaultDisplay.PowerIsOnFeedback.BoolValue)
|
|
||||||
// {
|
|
||||||
// (DefaultDisplay as TwoWayDisplayBase).PowerIsOnFeedback.OutputChange -= oneTimeHandler;
|
|
||||||
// Debug.Console(1, this, "Display has powered on");
|
|
||||||
// RoomIsOnFeedback.FireUpdate();
|
|
||||||
// //if (callback != null)
|
|
||||||
// // callback();
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
// DefaultDisplay.PowerIsOnFeedback.OutputChange += oneTimeHandler;
|
|
||||||
// DefaultDisplay.PowerOn();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// public override void RoomOff()
|
|
||||||
// {
|
|
||||||
// if (!RoomIsOnFeedback.BoolValue)
|
|
||||||
// {
|
|
||||||
// Debug.Console(2, this, "Room is already off");
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// Debug.Console(0, this, "Room off");
|
|
||||||
// DefaultDisplay.PowerOff();
|
|
||||||
|
|
||||||
// //RoomIsOn.FireUpdate(); ---Display will provide this in huddle
|
|
||||||
// //OnPresentationSourceChange(null);
|
|
||||||
// //CurrentPresentationSource = null;
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// public override void SelectSource(uint sourceNum)
|
|
||||||
// {
|
|
||||||
// // Run this on a separate thread
|
|
||||||
// new CTimer(o =>
|
|
||||||
// {
|
|
||||||
// var routeKey = "source-" + sourceNum;
|
|
||||||
// Debug.Console(1, this, "Run room action '{0}'", routeKey);
|
|
||||||
// if (string.IsNullOrEmpty(SourceListKey))
|
|
||||||
// {
|
|
||||||
// Debug.Console(1, this, "WARNING: No source/action list defined for this room");
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // Try to get the list from the config object, using SourceListKey string
|
|
||||||
// if (!ConfigReader.ConfigObject.SourceLists.ContainsKey(SourceListKey))
|
|
||||||
// {
|
|
||||||
// Debug.Console(1, this, "WARNING: Config source list '{0}' not found", SourceListKey);
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// var list = ConfigReader.ConfigObject.SourceLists[SourceListKey];
|
|
||||||
|
|
||||||
// // Try to get the list item by it's string key
|
|
||||||
// if (!list.ContainsKey(routeKey))
|
|
||||||
// {
|
|
||||||
// Debug.Console(1, this, "WARNING: No item '{0}' found on config list '{1}'",
|
|
||||||
// routeKey, SourceListKey);
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// var item = list[routeKey];
|
|
||||||
// Debug.Console(2, this, "Action {0} has {1} steps",
|
|
||||||
// item.SourceKey, item.RouteList.Count);
|
|
||||||
|
|
||||||
// // Let's run it
|
|
||||||
// if (routeKey.ToLower() != "roomoff")
|
|
||||||
// LastSourceKey = routeKey;
|
|
||||||
|
|
||||||
// foreach (var route in item.RouteList)
|
|
||||||
// {
|
|
||||||
// // if there is a $defaultAll on route, run two separate
|
|
||||||
// if (route.DestinationKey.Equals("$defaultAll", StringComparison.OrdinalIgnoreCase))
|
|
||||||
// {
|
|
||||||
// var tempAudio = new SourceRouteListItem
|
|
||||||
// {
|
|
||||||
// DestinationKey = "$defaultDisplay",
|
|
||||||
// SourceKey = route.SourceKey,
|
|
||||||
// Type = eRoutingSignalType.Video
|
|
||||||
// };
|
|
||||||
// DoRoute(tempAudio);
|
|
||||||
|
|
||||||
// var tempVideo = new SourceRouteListItem
|
|
||||||
// {
|
|
||||||
// DestinationKey = "$defaultAudio",
|
|
||||||
// SourceKey = route.SourceKey,
|
|
||||||
// Type = eRoutingSignalType.Audio
|
|
||||||
// };
|
|
||||||
// DoRoute(tempVideo);
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// DoRoute(route);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // 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;
|
|
||||||
// }
|
|
||||||
// CurrentAudioDevice = volDev;
|
|
||||||
|
|
||||||
// // store the name and UI info for routes
|
|
||||||
// if (item.SourceKey != null)
|
|
||||||
// CurrentPresentationSourceInfo = item;
|
|
||||||
// // And finally, set the "control". This will trigger event
|
|
||||||
// //CurrentControlDevice = DeviceManager.GetDeviceForKey(item.SourceKey) as Device;
|
|
||||||
|
|
||||||
// RoomIsOnFeedback.FireUpdate();
|
|
||||||
|
|
||||||
// }, 0); // end of CTimer
|
|
||||||
|
|
||||||
// //Debug.Console(1, this, "Checking for source {0}", sourceNum);
|
|
||||||
// //if (Sources.ContainsKey(sourceNum))
|
|
||||||
// //{
|
|
||||||
// // var newSrc = Sources[sourceNum];
|
|
||||||
// // if (!RoomIsOn.BoolValue)
|
|
||||||
// // {
|
|
||||||
// // EventHandler<EventArgs> oneTimeHandler = null;
|
|
||||||
// // oneTimeHandler = (o, a) =>
|
|
||||||
// // {
|
|
||||||
// // RoomIsOn.OutputChange -= oneTimeHandler;
|
|
||||||
// // FinishSourceSelection(newSrc);
|
|
||||||
// // };
|
|
||||||
// // RoomIsOn.OutputChange -= oneTimeHandler;
|
|
||||||
// // RoomIsOn.OutputChange += oneTimeHandler;
|
|
||||||
// // RoomOn();
|
|
||||||
// // }
|
|
||||||
// // else FinishSourceSelection(newSrc);
|
|
||||||
// //}
|
|
||||||
// }
|
|
||||||
|
|
||||||
// /// <summary>
|
|
||||||
// ///
|
|
||||||
// /// </summary>
|
|
||||||
// /// <param name="route"></param>
|
|
||||||
// /// <returns></returns>
|
|
||||||
// bool DoRoute(SourceRouteListItem route)
|
|
||||||
// {
|
|
||||||
// IRoutingSinkNoSwitching dest = null;
|
|
||||||
|
|
||||||
// if (route.DestinationKey.Equals("$defaultDisplay", StringComparison.OrdinalIgnoreCase))
|
|
||||||
// dest = DefaultDisplay;
|
|
||||||
// else
|
|
||||||
// dest = DeviceManager.GetDeviceForKey(route.DestinationKey) as IRoutingSinkNoSwitching;
|
|
||||||
|
|
||||||
// if (dest == null)
|
|
||||||
// {
|
|
||||||
// Debug.Console(1, this, "Cannot route, unknown destination '{0}'", route.DestinationKey);
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (route.SourceKey.Equals("$off", StringComparison.OrdinalIgnoreCase))
|
|
||||||
// {
|
|
||||||
// dest.ReleaseRoute();
|
|
||||||
// if (dest is IPower)
|
|
||||||
// (dest as IPower).PowerOff();
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// var source = DeviceManager.GetDeviceForKey(route.SourceKey) as IRoutingOutputs;
|
|
||||||
// if (source == null)
|
|
||||||
// {
|
|
||||||
// Debug.Console(1, this, "Cannot route unknown source '{0}' to {1}", route.SourceKey, route.DestinationKey);
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// dest.ReleaseAndMakeRoute(source, route.Type);
|
|
||||||
// }
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// ///// <summary>
|
|
||||||
// /////
|
|
||||||
// ///// </summary>
|
|
||||||
// ///// <param name="newSrc"></param>
|
|
||||||
// //public override void SelectSource(IPresentationSource newSrc)
|
|
||||||
// //{
|
|
||||||
// // if (Sources.ContainsValue(newSrc))
|
|
||||||
// // {
|
|
||||||
// // if (!RoomIsOn.BoolValue)
|
|
||||||
// // {
|
|
||||||
// // EventHandler<EventArgs> oneTimeHandler = null;
|
|
||||||
// // oneTimeHandler = (o, a) =>
|
|
||||||
// // {
|
|
||||||
// // RoomIsOn.OutputChange -= oneTimeHandler;
|
|
||||||
// // FinishSourceSelection(newSrc);
|
|
||||||
// // };
|
|
||||||
// // RoomIsOn.OutputChange -= oneTimeHandler;
|
|
||||||
// // RoomIsOn.OutputChange += oneTimeHandler;
|
|
||||||
// // RoomOn();
|
|
||||||
// // }
|
|
||||||
// // else FinishSourceSelection(newSrc);
|
|
||||||
// // }
|
|
||||||
// //}
|
|
||||||
|
|
||||||
// void Display_Various_OutputChange(object sender, EventArgs e)
|
|
||||||
// {
|
|
||||||
// // Bounce through the output changes
|
|
||||||
// if (sender == DefaultDisplay.PowerIsOnFeedback)
|
|
||||||
// this.RoomIsOnFeedback.FireUpdate();
|
|
||||||
// else if (sender == DefaultDisplay.IsCoolingDownFeedback)
|
|
||||||
// this.IsCoolingDownFeedback.FireUpdate();
|
|
||||||
// else if (sender == DefaultDisplay.IsWarmingUpFeedback)
|
|
||||||
// this.IsWarmingUpFeedback.FireUpdate();
|
|
||||||
// }
|
|
||||||
|
|
||||||
//// void FinishSourceSelection(IPresentationSource newSource)
|
|
||||||
//// {
|
|
||||||
//// Debug.Console(1, this, "Selecting source {0}", newSource.Key);
|
|
||||||
//// // Notify anyone watching source that it's leaving
|
|
||||||
//// OnPresentationSourceChange(newSource);
|
|
||||||
//// CurrentPresentationSource = newSource;
|
|
||||||
//// var routeableSource = CurrentPresentationSource as IRoutingOutputs;
|
|
||||||
//// if (routeableSource != null)
|
|
||||||
////#warning source route type will need clarification
|
|
||||||
//// DefaultDisplay.GetRouteToSource(routeableSource, eRoutingSignalType.AudioVideo);
|
|
||||||
//// else
|
|
||||||
//// Debug.Console(1, this, "New selected source {0} is not routeable", CurrentPresentationSource);
|
|
||||||
|
|
||||||
//// CurrentSourceName.FireUpdate();
|
|
||||||
//// //CurrentSourceType.FireUpdate();
|
|
||||||
//// }
|
|
||||||
|
|
||||||
// public override List<Feedback> Feedbacks
|
|
||||||
// {
|
|
||||||
// get
|
|
||||||
// {
|
|
||||||
// var feedbacks = new List<Feedback>
|
|
||||||
// {
|
|
||||||
// SourcesCount,
|
|
||||||
// CurrentSourceName,
|
|
||||||
// //CurrentSourceType,
|
|
||||||
// };
|
|
||||||
// feedbacks.AddRange(base.Feedbacks);
|
|
||||||
// return feedbacks;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
@@ -25,7 +25,6 @@ namespace PepperDash.Essentials
|
|||||||
&& CurrentSourceInfo.Type == eSourceListItemType.Route
|
&& CurrentSourceInfo.Type == eSourceListItemType.Route
|
||||||
&& disp != null
|
&& disp != null
|
||||||
&& disp.PowerIsOnFeedback.BoolValue;
|
&& disp.PowerIsOnFeedback.BoolValue;
|
||||||
Debug.Console(2, this, "Display power={0}, has CurrentSource={1}", disp.PowerIsOnFeedback, CurrentSourceInfo != null);
|
|
||||||
return val;
|
return val;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -221,7 +220,7 @@ namespace PepperDash.Essentials
|
|||||||
// Run this on a separate thread
|
// Run this on a separate thread
|
||||||
new CTimer(o =>
|
new CTimer(o =>
|
||||||
{
|
{
|
||||||
Debug.Console(1, this, "Run room 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)
|
||||||
{
|
{
|
||||||
@@ -238,8 +237,8 @@ namespace PepperDash.Essentials
|
|||||||
}
|
}
|
||||||
|
|
||||||
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))
|
||||||
@@ -253,7 +252,7 @@ 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 (257):\r{0}", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -273,22 +272,23 @@ namespace PepperDash.Essentials
|
|||||||
// 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))
|
||||||
{
|
{
|
||||||
var tempAudio = new SourceRouteListItem
|
// Going to assume a single-path route for now
|
||||||
|
var tempVideo = new SourceRouteListItem
|
||||||
{
|
{
|
||||||
DestinationKey = "$defaultDisplay",
|
DestinationKey = "$defaultDisplay",
|
||||||
SourceKey = route.SourceKey,
|
SourceKey = route.SourceKey,
|
||||||
Type = eRoutingSignalType.Video
|
Type = eRoutingSignalType.Video
|
||||||
};
|
};
|
||||||
DoRoute(tempAudio);
|
DoRoute(tempVideo);
|
||||||
|
|
||||||
var tempVideo = new SourceRouteListItem
|
//var tempAudio = new SourceRouteListItem
|
||||||
{
|
//{
|
||||||
DestinationKey = "$defaultAudio",
|
// DestinationKey = "$defaultAudio",
|
||||||
SourceKey = route.SourceKey,
|
// SourceKey = route.SourceKey,
|
||||||
Type = eRoutingSignalType.Audio
|
// Type = eRoutingSignalType.Audio
|
||||||
};
|
//};
|
||||||
DoRoute(tempVideo);
|
//DoRoute(tempAudio);
|
||||||
continue;
|
//continue; -- not sure why this was here
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
DoRoute(route);
|
DoRoute(route);
|
||||||
@@ -321,7 +321,12 @@ namespace PepperDash.Essentials
|
|||||||
CurrentVolumeControls = volDev;
|
CurrentVolumeControls = volDev;
|
||||||
|
|
||||||
// store the name and UI info for routes
|
// store the name and UI info for routes
|
||||||
if (item.SourceKey != null)
|
if (item.SourceKey == "$off")
|
||||||
|
{
|
||||||
|
CurrentSourceInfoKey = routeKey;
|
||||||
|
CurrentSourceInfo = null;
|
||||||
|
}
|
||||||
|
else if (item.SourceKey != null)
|
||||||
{
|
{
|
||||||
CurrentSourceInfoKey = routeKey;
|
CurrentSourceInfoKey = routeKey;
|
||||||
CurrentSourceInfo = item;
|
CurrentSourceInfo = item;
|
||||||
|
|||||||
@@ -302,8 +302,8 @@ namespace PepperDash.Essentials
|
|||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
// Let's run it
|
// Let's run it
|
||||||
if (routeKey.ToLower() != "roomoff")
|
if (routeKey.ToLower() != "roomoff")
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user