fix(galaxy): #866 grade OK-status data changes by the item's OPC DA quality
The gateway fills Statuses on every data change (live OnDataChange, value-cache replay and session snapshot all carry Quality too), and EventPump used the status row whenever one was present, so Quality was never read: an off-scan, Bad or Uncertain attribute with an OK status row was published Good. A failure status row still wins; otherwise the quality byte grades the value (legacy parity: quality >= 192 Good). Live, read-only on VD03 (DEV): healthy ScanState and _TestArea attributes stay Good (0x00000000) via quality 192; the stopped JoePlatform/JoeAppEngine ScanState now publish BadCommunicationError (0x80050000) instead of generic Bad, with no "unrecognised quality byte" warning. Claude-Session: https://claude.ai/code/session_01GT67AD99zQQqpLCVm3p7xk
This commit is contained in:
@@ -2,6 +2,7 @@ using System.Diagnostics.Metrics;
|
||||
using System.Threading.Channels;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
using ZB.MOM.WW.MxGateway.Client;
|
||||
using ZB.MOM.WW.MxGateway.Contracts.Proto;
|
||||
using ZB.MOM.WW.OtOpcUa.Core.Abstractions;
|
||||
|
||||
@@ -512,7 +513,12 @@ internal sealed class EventPump : IAsyncDisposable
|
||||
ServerTimestampUtc: DateTime.UtcNow);
|
||||
}
|
||||
|
||||
var statusCode = ev.Statuses.Count > 0
|
||||
// A failure status row wins (it names why the read failed); otherwise the item's OPC DA quality grades
|
||||
// the value. The gateway fills Statuses on every data change, so keying on "any statuses present" meant
|
||||
// Quality was never read and an off-scan / Bad / Uncertain attribute with an OK status row was
|
||||
// published Good (#866 review). Every gateway path (live OnDataChange, value-cache replay, session
|
||||
// snapshot) carries Quality.
|
||||
var statusCode = ev.Statuses.Count > 0 && !ev.Statuses[0].IsSuccess()
|
||||
? StatusCodeMap.FromMxStatus(ev.Statuses[0], _logger)
|
||||
: StatusCodeMap.FromQualityByte((byte)(ev.Quality & 0xFF), _logger);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user