mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-16 13:15:03 +00:00
Updates to JoinMapBaseAdvanced constructor to properly add JoinDataComplete fields to Joins collection and to BridgeBase to implement console methods to print data at runtime.
This commit is contained in:
@@ -267,6 +267,7 @@ namespace PepperDash.Essentials.Bridges
|
|||||||
|
|
||||||
foreach (var joinMap in JoinMaps)
|
foreach (var joinMap in JoinMaps)
|
||||||
{
|
{
|
||||||
|
Debug.Console(0, "Join map for device '{0}':", joinMap.Key);
|
||||||
joinMap.Value.PrintJoinMapInfo();
|
joinMap.Value.PrintJoinMapInfo();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -285,6 +286,7 @@ namespace PepperDash.Essentials.Bridges
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Debug.Console(0, "Join map for device '{0}' on EISC '{1}':", deviceKey, this.Key);
|
||||||
joinMap.PrintJoinMapInfo();
|
joinMap.PrintJoinMapInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -88,14 +88,17 @@ namespace PepperDash.Essentials.Core
|
|||||||
// Get the joins of each type and print them
|
// Get the joins of each type and print them
|
||||||
Debug.Console(0, "Digitals:");
|
Debug.Console(0, "Digitals:");
|
||||||
var digitals = Joins.Where(j => (j.Value.JoinType & eJoinType.Digital) == eJoinType.Digital).ToDictionary(j => j.Key, j => j.Value);
|
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));
|
PrintJoinList(GetSortedJoins(digitals));
|
||||||
|
|
||||||
Debug.Console(0, "Analogs:");
|
Debug.Console(0, "Analogs:");
|
||||||
var analogs = Joins.Where(j => (j.Value.JoinType & eJoinType.Analog) == eJoinType.Analog).ToDictionary(j => j.Key, j => j.Value);
|
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));
|
PrintJoinList(GetSortedJoins(analogs));
|
||||||
|
|
||||||
Debug.Console(0, "Serials:");
|
Debug.Console(0, "Serials:");
|
||||||
var serials = Joins.Where(j => (j.Value.JoinType & eJoinType.Serial) == eJoinType.Serial).ToDictionary(j => j.Key, j => j.Value);
|
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));
|
PrintJoinList(GetSortedJoins(serials));
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -166,24 +169,43 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The collection of joins and associated metadata
|
/// The collection of joins and associated metadata
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Dictionary<string, JoinDataComplete> Joins = new Dictionary<string, JoinDataComplete>();
|
public Dictionary<string, JoinDataComplete> Joins { get; private set; }
|
||||||
|
|
||||||
protected JoinMapBaseAdvanced(uint joinStart)
|
protected JoinMapBaseAdvanced(uint joinStart)
|
||||||
{
|
{
|
||||||
|
Joins = new Dictionary<string, JoinDataComplete>();
|
||||||
|
|
||||||
_joinOffset = joinStart - 1;
|
_joinOffset = joinStart - 1;
|
||||||
|
|
||||||
// Add all the JoinDataComplete properties to the Joins Dictionary and pass in the offset
|
// Add all the JoinDataComplete properties to the Joins Dictionary and pass in the offset
|
||||||
Joins = GetType()
|
Joins = this.GetType()
|
||||||
.GetCType()
|
.GetCType()
|
||||||
.GetProperties()
|
.GetFields(BindingFlags.Public | BindingFlags.Instance)
|
||||||
.Where(prop => prop.IsDefined(typeof(JoinNameAttribute), false))
|
.Where(field => field.IsDefined(typeof(JoinNameAttribute), false))
|
||||||
.Select(prop => (JoinDataComplete)prop.GetValue(this, null))
|
.Select(prop => (JoinDataComplete)prop.GetValue(this))
|
||||||
.ToDictionary(join => join.GetNameAttribute(), join =>
|
.ToDictionary(join => join.GetNameAttribute(), join =>
|
||||||
{
|
{
|
||||||
join.SetJoinOffset(_joinOffset);
|
join.SetJoinOffset(_joinOffset);
|
||||||
return join;
|
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();
|
PrintJoinMapInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,14 +219,17 @@ namespace PepperDash.Essentials.Core
|
|||||||
// Get the joins of each type and print them
|
// Get the joins of each type and print them
|
||||||
Debug.Console(0, "Digitals:");
|
Debug.Console(0, "Digitals:");
|
||||||
var digitals = Joins.Where(j => (j.Value.Metadata.JoinType & eJoinType.Digital) == eJoinType.Digital).ToDictionary(j => j.Key, j => j.Value);
|
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));
|
PrintJoinList(GetSortedJoins(digitals));
|
||||||
|
|
||||||
Debug.Console(0, "Analogs:");
|
Debug.Console(0, "Analogs:");
|
||||||
var analogs = Joins.Where(j => (j.Value.Metadata.JoinType & eJoinType.Analog) == eJoinType.Analog).ToDictionary(j => j.Key, j => j.Value);
|
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));
|
PrintJoinList(GetSortedJoins(analogs));
|
||||||
|
|
||||||
Debug.Console(0, "Serials:");
|
Debug.Console(0, "Serials:");
|
||||||
var serials = Joins.Where(j => (j.Value.Metadata.JoinType & eJoinType.Serial) == eJoinType.Serial).ToDictionary(j => j.Key, j => j.Value);
|
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));
|
PrintJoinList(GetSortedJoins(serials));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user