341417f193
- Ab.Transport: AbOpcUaStatusMap is the single AbStatus->OPC UA table; AbCip/AbLegacy mappers delegate. - Remove dead MapCipGeneralStatus / MapPcccStatus / AbLegacy MapException (+ tests). - LibplctagOrphanRelease is one source file (Ab.LibplctagShared) compiled into both drivers. - LibplctagConfinementGuardTests: tokenising comment/literal stripper, block comments, csproj PackageReference guard. - LibplctagStatusTranslationTests: real LibPlcTagException round trip, WrapSync/Wrap OCE pass-through, adapter routes decode via WrapSync. - AbCipTypeMismatchTests: libplctag width-mismatch path (BadTypeMismatch, handle kept, no Degraded, warn once). - Host: AddAbCipDriverDefaults extension + Program.cs source pin for Drivers:AbCip:DefaultTransport. - docs/drivers/AbCip.md: layout rows + benign Degraded-after-outage note. Claude-Session: https://claude.ai/code/session_01Ef2ozxS7QPanGT8uoATbTe
36 lines
1.5 KiB
C#
36 lines
1.5 KiB
C#
using ZB.MOM.WW.OtOpcUa.Driver.Ab.Transport;
|
|
|
|
namespace ZB.MOM.WW.OtOpcUa.Driver.AbLegacy;
|
|
|
|
/// <summary>
|
|
/// Maps transport status codes to OPC UA StatusCodes via the table shared with AbCip
|
|
/// (<see cref="AbOpcUaStatusMap"/>).
|
|
/// </summary>
|
|
public static class AbLegacyStatusMapper
|
|
{
|
|
public const uint Good = 0u;
|
|
public const uint GoodMoreData = 0x00A60000u;
|
|
public const uint BadInternalError = 0x80020000u;
|
|
public const uint BadNodeIdUnknown = 0x80340000u;
|
|
public const uint BadNotWritable = 0x803B0000u;
|
|
public const uint BadOutOfRange = 0x803C0000u;
|
|
public const uint BadNotSupported = 0x803D0000u;
|
|
public const uint BadDeviceFailure = 0x808B0000u;
|
|
public const uint BadCommunicationError = 0x80050000u;
|
|
public const uint BadTimeout = 0x800A0000u;
|
|
public const uint BadTypeMismatch = 0x80740000u;
|
|
|
|
/// <summary>
|
|
/// Map the integer form of an <see cref="AbStatus"/> (what <see cref="IAbLegacyTagRuntime.GetStatus"/>
|
|
/// returns) to an OPC UA StatusCode.
|
|
/// </summary>
|
|
/// <param name="status">The integer transport status.</param>
|
|
/// <returns>The corresponding OPC UA status code.</returns>
|
|
public static uint MapStatus(int status) => MapStatus((AbStatus)status);
|
|
|
|
/// <summary>Map a transport-neutral <see cref="AbStatus"/> to an OPC UA StatusCode.</summary>
|
|
/// <param name="status">The transport status.</param>
|
|
/// <returns>The corresponding OPC UA status code.</returns>
|
|
public static uint MapStatus(AbStatus status) => AbOpcUaStatusMap.MapStatus(status);
|
|
}
|