diff --git a/PepperDashEssentials/Bridges/BridgeBase.cs b/PepperDashEssentials/Bridges/BridgeBase.cs index 32e550b2..b3f131c3 100644 --- a/PepperDashEssentials/Bridges/BridgeBase.cs +++ b/PepperDashEssentials/Bridges/BridgeBase.cs @@ -267,6 +267,7 @@ namespace PepperDash.Essentials.Bridges foreach (var joinMap in JoinMaps) { + Debug.Console(0, "Join map for device '{0}':", joinMap.Key); joinMap.Value.PrintJoinMapInfo(); } } @@ -285,6 +286,7 @@ namespace PepperDash.Essentials.Bridges return; } + Debug.Console(0, "Join map for device '{0}' on EISC '{1}':", deviceKey, this.Key); joinMap.PrintJoinMapInfo(); } diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/JoinMaps/JoinMapBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/JoinMaps/JoinMapBase.cs index 9e9538e1..fbbad609 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/JoinMaps/JoinMapBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/JoinMaps/JoinMapBase.cs @@ -88,14 +88,17 @@ namespace PepperDash.Essentials.Core // Get the joins of each type and print them Debug.Console(0, "Digitals:"); var digitals = Joins.Where(j => (j.Value.JoinType & eJoinType.Digital) == eJoinType.Digital).ToDictionary(j => j.Key, j => j.Value); + Debug.Console(2, "Found {0} Digital Joins", digitals.Count); PrintJoinList(GetSortedJoins(digitals)); Debug.Console(0, "Analogs:"); var analogs = Joins.Where(j => (j.Value.JoinType & eJoinType.Analog) == eJoinType.Analog).ToDictionary(j => j.Key, j => j.Value); + Debug.Console(2, "Found {0} Analog Joins", analogs.Count); PrintJoinList(GetSortedJoins(analogs)); Debug.Console(0, "Serials:"); var serials = Joins.Where(j => (j.Value.JoinType & eJoinType.Serial) == eJoinType.Serial).ToDictionary(j => j.Key, j => j.Value); + Debug.Console(2, "Found {0} Serial Joins", serials.Count); PrintJoinList(GetSortedJoins(serials)); } @@ -166,24 +169,43 @@ namespace PepperDash.Essentials.Core /// /// The collection of joins and associated metadata /// - public Dictionary Joins = new Dictionary(); + public Dictionary Joins { get; private set; } protected JoinMapBaseAdvanced(uint joinStart) { + Joins = new Dictionary(); + _joinOffset = joinStart - 1; // Add all the JoinDataComplete properties to the Joins Dictionary and pass in the offset - Joins = GetType() + Joins = this.GetType() .GetCType() - .GetProperties() - .Where(prop => prop.IsDefined(typeof(JoinNameAttribute), false)) - .Select(prop => (JoinDataComplete)prop.GetValue(this, null)) - .ToDictionary(join => join.GetNameAttribute(), join => + .GetFields(BindingFlags.Public | BindingFlags.Instance) + .Where(field => field.IsDefined(typeof(JoinNameAttribute), false)) + .Select(prop => (JoinDataComplete)prop.GetValue(this)) + .ToDictionary(join => join.GetNameAttribute(), join => { join.SetJoinOffset(_joinOffset); return join; }); + //var type = this.GetType(); + //var cType = type.GetCType(); + //var fields = cType.GetFields(BindingFlags.Public | BindingFlags.Instance); + //foreach (var field in fields) + //{ + // if (field.IsDefined(typeof(JoinNameAttribute), true)) + // { + // var value = field.GetValue(this) as JoinDataComplete; + + // if (value != null) + // { + // value.SetJoinOffset(_joinOffset); + // Joins.Add(value.GetNameAttribute(), value); + // } + // } + //} + PrintJoinMapInfo(); } @@ -197,14 +219,17 @@ namespace PepperDash.Essentials.Core // Get the joins of each type and print them Debug.Console(0, "Digitals:"); var digitals = Joins.Where(j => (j.Value.Metadata.JoinType & eJoinType.Digital) == eJoinType.Digital).ToDictionary(j => j.Key, j => j.Value); + Debug.Console(2, "Found {0} Digital Joins", digitals.Count); PrintJoinList(GetSortedJoins(digitals)); Debug.Console(0, "Analogs:"); var analogs = Joins.Where(j => (j.Value.Metadata.JoinType & eJoinType.Analog) == eJoinType.Analog).ToDictionary(j => j.Key, j => j.Value); + Debug.Console(2, "Found {0} Analog Joins", analogs.Count); PrintJoinList(GetSortedJoins(analogs)); Debug.Console(0, "Serials:"); var serials = Joins.Where(j => (j.Value.Metadata.JoinType & eJoinType.Serial) == eJoinType.Serial).ToDictionary(j => j.Key, j => j.Value); + Debug.Console(2, "Found {0} Serial Joins", serials.Count); PrintJoinList(GetSortedJoins(serials)); }