fix(dcl): resolve OPC UA alarm type NodeId to friendly name so conditionFilter works (#8)
HandleAlarmEvent set AlarmTypeName to the event-type NodeId string ("i=9341"),
but the client-side conditionFilter gate (and the OPC UA WhereClause) use friendly
type names — so a friendly-name filter built a correct server WhereClause yet the
client gate dropped every event (zero alarms delivered). Resolve the event-type
NodeId to its friendly name via an inverse of KnownConditionTypeIds (NodeId-string
fallback for custom types) so both sides agree. Also fix a dead-code ternary in
the SourceName derivation.
This commit is contained in:
@@ -96,4 +96,18 @@ public class AlarmConditionFilterTests
|
||||
Assert.Equal(new[] { "AnalogLimit.Hi", "DiscreteAlarm" }, f.Names.OrderBy(n => n).ToArray());
|
||||
Assert.Empty(AlarmConditionFilter.Parse(null).Names);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void IsAllowed_OpcUaResolvedFriendlyName_MatchesFriendlyNameFilter()
|
||||
{
|
||||
// M2.4 (#8) regression: OPC UA delivers events whose AlarmTypeName, after
|
||||
// RealOpcUaClient.ResolveAlarmTypeName, is a standard friendly type name
|
||||
// (e.g. "ExclusiveLevelAlarmType"). A friendly-name filter on that source
|
||||
// built a correct server WhereClause; the client gate must agree and deliver,
|
||||
// not drop every event (which the prior NodeId-string AlarmTypeName caused).
|
||||
var f = AlarmConditionFilter.Parse("ExclusiveLevelAlarmType,DiscreteAlarmType");
|
||||
Assert.True(f.IsAllowed(Tx("ExclusiveLevelAlarmType")));
|
||||
Assert.True(f.IsAllowed(Tx("DiscreteAlarmType")));
|
||||
Assert.False(f.IsAllowed(Tx("OffNormalAlarmType")));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user