Refactored for source change handler updates

This commit is contained in:
Neil Dorin
2019-11-08 12:30:49 -07:00
parent c22e95cad2
commit ed468add2c
19 changed files with 178 additions and 73 deletions

View File

@@ -95,6 +95,9 @@ namespace PepperDash.Essentials.Core
[JsonProperty("disableRoutedSharing")]
public bool DisableRoutedSharing { get; set; }
[JsonProperty("destinations")]
public List<eSourceListItemDestinationTypes> Destinations { get; set; }
public SourceListItem()
{
Icon = "Blank";
@@ -112,4 +115,16 @@ namespace PepperDash.Essentials.Core
[JsonProperty("type")]
public eRoutingSignalType Type { get; set; }
}
/// <summary>
/// Defines the valid destination types for SourceListItems in a room
/// </summary>
public enum eSourceListItemDestinationTypes
{
defaultDisplay,
leftDisplay,
rightDisplay,
programAudio,
codecContent
}
}

View File

@@ -12,7 +12,7 @@ using PepperDash.Essentials.Core.Routing;
namespace PepperDash.Essentials.Core
{
public class BasicIrDisplay : DisplayBase, IBasicVolumeControls, IPower, IWarmingCooling, IRoutingSinkWithSwitching
public class BasicIrDisplay : DisplayBase, IBasicVolumeControls, IPower, IWarmingCooling
{
public IrOutputPortController IrPort { get; private set; }
public ushort IrPulseTime { get; set; }

View File

@@ -20,8 +20,29 @@ namespace PepperDash.Essentials.Core
{
public event SourceInfoChangeHandler CurrentSourceChange;
public string CurrentSourceInfoKey { get; protected set; }
public SourceListItem CurrentSourceInfo { get; protected set; }
public string CurrentSourceInfoKey { get; set; }
public SourceListItem CurrentSourceInfo
{
get
{
return _CurrentSourceInfo;
}
set
{
if (value == _CurrentSourceInfo) return;
var handler = CurrentSourceChange;
if (handler != null)
handler(_CurrentSourceInfo, ChangeType.WillChange);
_CurrentSourceInfo = value;
if (handler != null)
handler(_CurrentSourceInfo, ChangeType.DidChange);
}
}
SourceListItem _CurrentSourceInfo;
public BoolFeedback PowerIsOnFeedback { get; protected set; }
public BoolFeedback IsCoolingDownFeedback { get; protected set; }

View File

@@ -1387,7 +1387,7 @@ namespace PepperDash.Essentials.Core.Fusion
/// <summary>
/// Event handler for when room source changes
/// </summary>
protected void Room_CurrentSourceInfoChange(EssentialsRoomBase room, SourceListItem info, ChangeType type)
protected void Room_CurrentSourceInfoChange(SourceListItem info, ChangeType type)
{
// Handle null. Nothing to do when switching from or to null
if (info == null || info.SourceDevice == null)
@@ -1403,7 +1403,7 @@ namespace PepperDash.Essentials.Core.Fusion
{
if (SourceToFeedbackSigs.ContainsKey(dev))
SourceToFeedbackSigs[dev].BoolValue = true;
var name = (room == null ? "" : room.Name);
//var name = (room == null ? "" : room.Name);
CurrentRoomSourceNameSig.InputSig.StringValue = info.SourceDevice.Name;
}
}

View File

@@ -30,6 +30,8 @@ namespace PepperDash.Essentials.Core
void RunRouteAction(string routeKey);
void RunRouteAction(string routeKey, Action successCallback);
}
/// <summary>

View File

@@ -15,7 +15,7 @@ namespace PepperDash.Essentials.Core
/// <summary>
/// The handler type for a Room's SourceInfoChange
/// </summary>
public delegate void SourceInfoChangeHandler(EssentialsRoomBase room, SourceListItem info, ChangeType type);
public delegate void SourceInfoChangeHandler(/*EssentialsRoomBase room,*/ SourceListItem info, ChangeType type);
//*******************************************************************************************
@@ -26,8 +26,8 @@ namespace PepperDash.Essentials.Core
/// </summary>
public interface IHasCurrentSourceInfoChange
{
string CurrentSourceInfoKey { get; }
SourceListItem CurrentSourceInfo { get; }
string CurrentSourceInfoKey { get; set; }
SourceListItem CurrentSourceInfo { get; set; }
event SourceInfoChangeHandler CurrentSourceChange;
}
@@ -52,7 +52,7 @@ namespace PepperDash.Essentials.Core
/// <summary>
/// For fixed-source endpoint devices
/// </summary>
public interface IRoutingSinkNoSwitching : IRoutingInputs
public interface IRoutingSinkNoSwitching : IRoutingInputs, IHasCurrentSourceInfoChange
{
}