Updated JoinMetadata to add Description property

Updated Hrxx0WirelessRemoteController to remove references to JoinMetadata

#198
This commit is contained in:
Trevor Payne
2020-05-22 13:56:18 -05:00
parent 469d3b0975
commit 608a9068b9
7 changed files with 108 additions and 52 deletions

View File

@@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Runtime.InteropServices;
using Crestron.SimplSharp.Reflection; using Crestron.SimplSharp.Reflection;
using PepperDash.Core; using PepperDash.Core;
@@ -363,8 +364,12 @@ namespace PepperDash.Essentials.Core
/// <summary> /// <summary>
/// A label for the join to better describe it's usage /// A label for the join to better describe it's usage
/// </summary> /// </summary>
[JsonProperty("label")] [Obsolete]
public string Label { get; set; } [JsonProperty("label")]
public string Label { get { return Description; } set { Description = value; } }
[JsonProperty("description")]
public string Description { get; set; }
/// <summary> /// <summary>
/// Signal type(s) /// Signal type(s)
/// </summary> /// </summary>
@@ -454,11 +459,13 @@ namespace PepperDash.Essentials.Core
name = attribute.Name; name = attribute.Name;
Debug.Console(2, "JoinName Attribute value: {0}", name); Debug.Console(2, "JoinName Attribute value: {0}", name);
return name; return name;
} }
} }
[AttributeUsage(AttributeTargets.All)] [AttributeUsage(AttributeTargets.All)]
public class JoinNameAttribute : Attribute public class JoinNameAttribute : CAttribute
{ {
private string _Name; private string _Name;
@@ -472,5 +479,5 @@ namespace PepperDash.Essentials.Core
{ {
get { return _Name; } get { return _Name; }
} }
} }
} }

View File

@@ -149,7 +149,7 @@ namespace PepperDash.Essentials.Core
} }
#endregion #endregion
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, PepperDash.Essentials.Core.Bridges.EiscApiAdvanced bridge) public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{ {
var joinMap = new Hrxxx0WirelessRemoteControllerJoinMap(joinStart); var joinMap = new Hrxxx0WirelessRemoteControllerJoinMap(joinStart);
@@ -161,33 +161,39 @@ namespace PepperDash.Essentials.Core
bridge.AddJoinMap(Key, joinMap); bridge.AddJoinMap(Key, joinMap);
//List<string> ExcludedKeys = new List<string>(); //List<string> ExcludedKeys = new List<string>();
foreach (var feedback in Feedbacks)
foreach (Feedback feedback in Feedbacks)
{ {
Feedback myFeedback = feedback; var myFeedback = feedback;
var join = joinMap.Joins.FirstOrDefault(x => x.Value.Metadata.Label.Equals(myFeedback.Key, StringComparison.InvariantCultureIgnoreCase)).Value; var joinData =
joinMap.Joins.FirstOrDefault(
x =>
x.Key.Equals(myFeedback.Key, StringComparison.InvariantCultureIgnoreCase));
if (join == null) continue; if (string.IsNullOrEmpty((joinData.Key))) continue;
var name = joinData.Key;
var join = joinData.Value;
if (join.Metadata.JoinType == eJoinType.Digital) if (join.Metadata.JoinType == eJoinType.Digital)
{ {
Debug.Console(0, this, "Linking Bool Feedback '{0}' to join {1}", join.Metadata.Label, join.JoinNumber); Debug.Console(0, this, "Linking Bool Feedback '{0}' to join {1}", name, join.JoinNumber);
BoolFeedback someFeedback = myFeedback as BoolFeedback; var someFeedback = myFeedback as BoolFeedback;
if(someFeedback == null) continue;
someFeedback.LinkInputSig(trilist.BooleanInput[join.JoinNumber]); someFeedback.LinkInputSig(trilist.BooleanInput[join.JoinNumber]);
} }
if (join.Metadata.JoinType == eJoinType.Analog) if (join.Metadata.JoinType == eJoinType.Analog)
{ {
Debug.Console(0, this, "Linking Analog Feedback '{0}' to join {1}", join.Metadata.Label, join.JoinNumber); Debug.Console(0, this, "Linking Analog Feedback '{0}' to join {1}", name, join.JoinNumber);
IntFeedback someFeedback = myFeedback as IntFeedback; var someFeedback = myFeedback as IntFeedback;
if (someFeedback == null) continue;
someFeedback.LinkInputSig(trilist.UShortInput[join.JoinNumber]); someFeedback.LinkInputSig(trilist.UShortInput[join.JoinNumber]);
} }
if (join.Metadata.JoinType == eJoinType.Serial) if (join.Metadata.JoinType == eJoinType.Serial)
{ {
Debug.Console(0, this, "Linking Serial Feedback '{0}' to join {1}", join.Metadata.Label, join.JoinNumber); Debug.Console(0, this, "Linking Serial Feedback '{0}' to join {1}", name, join.JoinNumber);
StringFeedback someFeedback = myFeedback as StringFeedback; var someFeedback = myFeedback as StringFeedback;
if (someFeedback == null) continue;
someFeedback.LinkInputSig(trilist.StringInput[join.JoinNumber]); someFeedback.LinkInputSig(trilist.StringInput[join.JoinNumber]);
} }
} }
@@ -201,13 +207,19 @@ namespace PepperDash.Essentials.Core
for (uint i = 1; i <= _remote.Button.Count; i++) for (uint i = 1; i <= _remote.Button.Count; i++)
{ {
Debug.Console(2, this, "Attempting to link join index {0}", i); Debug.Console(2, this, "Attempting to link join index {0}", i);
var join = joinMap.Joins.FirstOrDefault(o => o.Value.Metadata.Label.Equals(_remote.Button[i].Name.ToString(), StringComparison.InvariantCultureIgnoreCase)).Value; var index = i;
if (join == null) var joinData =
{ joinMap.Joins.FirstOrDefault(
Debug.Console(2, this, "Join '{0}' is null", i); o =>
continue; o.Key.Equals(_remote.Button[index].Name.ToString(),
} StringComparison.InvariantCultureIgnoreCase));
Debug.Console(2, this, "Setting User Object for '{0}'", join.Metadata.Label);
if (string.IsNullOrEmpty((joinData.Key))) continue;
var join = joinData.Value;
var name = joinData.Key;
Debug.Console(2, this, "Setting User Object for '{0}'", name);
if (join.Metadata.JoinType == eJoinType.Digital) if (join.Metadata.JoinType == eJoinType.Digital)
{ {
_remote.Button[i].SetButtonAction((b) => trilist.BooleanInput[join.JoinNumber].BoolValue = b); _remote.Button[i].SetButtonAction((b) => trilist.BooleanInput[join.JoinNumber].BoolValue = b);

View File

@@ -80,24 +80,26 @@ namespace PepperDash.Essentials.Core
/// </summary> /// </summary>
public interface IRouting : IRoutingInputsOutputs public interface IRouting : IRoutingInputsOutputs
{ {
//void ClearRoute(object outputSelector);
void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType); void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType);
} }
public interface ITxRouting : IRouting public interface IRoutingNumeric : IRouting
{
void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type);
}
public interface ITxRouting : IRoutingNumeric
{ {
IntFeedback VideoSourceNumericFeedback { get; } IntFeedback VideoSourceNumericFeedback { get; }
IntFeedback AudioSourceNumericFeedback { get; } IntFeedback AudioSourceNumericFeedback { get; }
void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type);
} }
/// <summary> /// <summary>
/// Defines a receiver that has internal routing (DM-RMC-4K-Z-SCALER-C) /// Defines a receiver that has internal routing (DM-RMC-4K-Z-SCALER-C)
/// </summary> /// </summary>
public interface IRmcRouting : IRouting public interface IRmcRouting : IRoutingNumeric
{ {
IntFeedback AudioVideoSourceNumericFeedback { get; } IntFeedback AudioVideoSourceNumericFeedback { get; }
void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type);
} }
/// <summary> /// <summary>

View File

@@ -21,7 +21,8 @@ namespace PepperDash.Essentials.DM {
/// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions /// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions
/// ///
/// </summary> /// </summary>
public class DmBladeChassisController : CrestronGenericBridgeableBaseDevice, IDmSwitch, IRoutingInputsOutputs, IRouting, IHasFeedback { public class DmBladeChassisController : CrestronGenericBridgeableBaseDevice, IDmSwitch, IRoutingNumeric
{
public DMChassisPropertiesConfig PropertiesConfig { get; set; } public DMChassisPropertiesConfig PropertiesConfig { get; set; }
public Switch Chassis { get; private set; } public Switch Chassis { get; private set; }
@@ -563,14 +564,23 @@ namespace PepperDash.Essentials.DM {
var outCard = input == 0 ? null : Chassis.Outputs[output]; var outCard = input == 0 ? null : Chassis.Outputs[output];
// NOTE THAT BITWISE COMPARISONS - TO CATCH ALL ROUTING TYPES // NOTE THAT BITWISE COMPARISONS - TO CATCH ALL ROUTING TYPES
if ((sigType | eRoutingSignalType.Video) == eRoutingSignalType.Video) { if ((sigType | eRoutingSignalType.Video) != eRoutingSignalType.Video) return;
Chassis.VideoEnter.BoolValue = true; Chassis.VideoEnter.BoolValue = true;
Chassis.Outputs[output].VideoOut = inCard; Chassis.Outputs[output].VideoOut = inCard;
}
} }
#endregion #endregion
#region IRoutingNumeric Members
public void ExecuteNumericSwitch(ushort inputSelector, ushort outputSelector, eRoutingSignalType sigType)
{
ExecuteSwitch(inputSelector, outputSelector, sigType);
}
#endregion
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{ {
var joinMap = new DmBladeChassisControllerJoinMap(joinStart); var joinMap = new DmBladeChassisControllerJoinMap(joinStart);
@@ -808,6 +818,7 @@ namespace PepperDash.Essentials.DM {
}); });
} }
} }
} }
/* /*

View File

@@ -21,7 +21,7 @@ namespace PepperDash.Essentials.DM
/// ///
/// </summary> /// </summary>
[Description("Wrapper class for all DM-MD chassis variants from 8x8 to 32x32")] [Description("Wrapper class for all DM-MD chassis variants from 8x8 to 32x32")]
public class DmChassisController : CrestronGenericBridgeableBaseDevice, IDmSwitch, IRoutingInputsOutputs, IRouting, IHasFeedback public class DmChassisController : CrestronGenericBridgeableBaseDevice, IDmSwitch, IRoutingNumeric
{ {
public DMChassisPropertiesConfig PropertiesConfig { get; set; } public DMChassisPropertiesConfig PropertiesConfig { get; set; }
@@ -1094,6 +1094,15 @@ namespace PepperDash.Essentials.DM
} }
#endregion #endregion
#region IRoutingNumeric Members
public void ExecuteNumericSwitch(ushort inputSelector, ushort outputSelector, eRoutingSignalType sigType)
{
ExecuteSwitch(inputSelector, outputSelector, sigType);
}
#endregion
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{ {
var joinMap = new DmChassisControllerJoinMap(joinStart); var joinMap = new DmChassisControllerJoinMap(joinStart);

View File

@@ -18,8 +18,8 @@ using PepperDash.Essentials.DM.Config;
using Feedback = PepperDash.Essentials.Core.Feedback; using Feedback = PepperDash.Essentials.Core.Feedback;
namespace PepperDash.Essentials.DM namespace PepperDash.Essentials.DM
{ {
public class DmpsRoutingController : EssentialsBridgeableDevice, IRouting, IHasFeedback public class DmpsRoutingController : EssentialsBridgeableDevice, IRoutingNumeric, IHasFeedback
{ {
public CrestronControlSystem Dmps { get; set; } public CrestronControlSystem Dmps { get; set; }
public ISystemControl SystemControl { get; private set; } public ISystemControl SystemControl { get; private set; }
@@ -661,8 +661,6 @@ namespace PepperDash.Essentials.DM
} }
} }
} }
///
/// </summary>
void Dmps_DMOutputChange(Switch device, DMOutputEventArgs args) void Dmps_DMOutputChange(Switch device, DMOutputEventArgs args)
{ {
Debug.Console(2, this, "DMOutputChange Output: {0} EventId: {1}", args.Number, args.EventId.ToString()); Debug.Console(2, this, "DMOutputChange Output: {0} EventId: {1}", args.Number, args.EventId.ToString());
@@ -724,10 +722,7 @@ namespace PepperDash.Essentials.DM
{ {
if (RouteOffTimers.ContainsKey(pnt)) if (RouteOffTimers.ContainsKey(pnt))
return; return;
RouteOffTimers[pnt] = new CTimer(o => RouteOffTimers[pnt] = new CTimer(o => ExecuteSwitch(0, pnt.Number, pnt.Type), RouteOffTime);
{
ExecuteSwitch(0, pnt.Number, pnt.Type);
}, RouteOffTime);
} }
#region IRouting Members #region IRouting Members
@@ -809,6 +804,15 @@ namespace PepperDash.Essentials.DM
} }
} }
#endregion #endregion
#region IRoutingNumeric Members
public void ExecuteNumericSwitch(ushort inputSelector, ushort outputSelector, eRoutingSignalType sigType)
{
ExecuteSwitch(inputSelector, outputSelector, sigType);
}
#endregion
} }
} }

View File

@@ -16,7 +16,7 @@ using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.DM.Chassis namespace PepperDash.Essentials.DM.Chassis
{ {
[Description("Wrapper class for all HdMdNxM4E switchers")] [Description("Wrapper class for all HdMdNxM4E switchers")]
public class HdMdNxM4kEBridgeableController : CrestronGenericBridgeableBaseDevice, IRoutingInputsOutputs, IRouting, IHasFeedback public class HdMdNxM4kEBridgeableController : CrestronGenericBridgeableBaseDevice, IRoutingInputsOutputs, IRoutingNumeric, IHasFeedback
{ {
private HdMdNxM _Chassis; private HdMdNxM _Chassis;
private HdMd4x14kE _Chassis4x1; private HdMd4x14kE _Chassis4x1;
@@ -240,6 +240,15 @@ namespace PepperDash.Essentials.DM.Chassis
#endregion #endregion
#region IRoutingNumeric Members
public void ExecuteNumericSwitch(ushort inputSelector, ushort outputSelector, eRoutingSignalType signalType)
{
ExecuteSwitch(inputSelector, outputSelector, signalType);
}
#endregion
#endregion #endregion
#region Bridge Linking #region Bridge Linking
@@ -389,6 +398,8 @@ namespace PepperDash.Essentials.DM.Chassis
} }
#endregion #endregion
} }
} }