namespace MxNativeCodec; public enum MxStatusCategory : short { Unknown = -1, Ok = 0, Pending = 1, Warning = 2, CommunicationError = 3, ConfigurationError = 4, OperationalError = 5, SecurityError = 6, SoftwareError = 7, OtherError = 8, } public enum MxStatusSource : short { Unknown = -1, RequestingLmx = 0, RespondingLmx = 1, RequestingNmx = 2, RespondingNmx = 3, RequestingAutomationObject = 4, RespondingAutomationObject = 5, } public sealed record MxStatus( short Success, MxStatusCategory Category, MxStatusSource DetectedBy, short Detail) { public string? DetailText => MxStatusDetails.GetKnownText(Detail); public static MxStatus DataChangeOk { get; } = new( Success: -1, Category: MxStatusCategory.Ok, DetectedBy: MxStatusSource.RequestingLmx, Detail: 0); public static MxStatus WriteCompleteOk { get; } = new( Success: -1, Category: MxStatusCategory.Ok, DetectedBy: MxStatusSource.RespondingAutomationObject, Detail: 0); public static MxStatus SuspendPending { get; } = new( Success: -1, Category: MxStatusCategory.Pending, DetectedBy: MxStatusSource.RequestingLmx, Detail: 0); public static MxStatus ActivateOk { get; } = new( Success: -1, Category: MxStatusCategory.Ok, DetectedBy: MxStatusSource.RequestingLmx, Detail: 0); public static MxStatus InvalidReferenceConfiguration { get; } = new( Success: 0, Category: MxStatusCategory.ConfigurationError, DetectedBy: MxStatusSource.RequestingLmx, Detail: 6); } public static class MxStatusDetails { private static readonly IReadOnlyDictionary KnownDetails = new Dictionary { [16] = "Request timed out", [17] = "Platform communication error", [18] = "Invalid platform ID", [19] = "Invalid engine ID", [20] = "Engine communication error", [21] = "Invalid reference", [22] = "No Galaxy Repository", [23] = "Invalid object ID", [24] = "Object signature mismatch", [25] = "Invalid primitive ID", [26] = "Invalid attribute ID", [27] = "Invalid property ID", [28] = "Index out of range", [29] = "Data out of range", [30] = "Incorrect data type", [31] = "Attribute not readable", [32] = "Attribute not writeable", [33] = "Write access denied", [34] = "Unknown error", [35] = "detected by", [36] = "Wrong data type", [37] = "Wrong number of dimensions", [38] = "Invalid index", [39] = "Index out of order", [40] = "Dimension does not exist", [41] = "Conversion not supported", [42] = "Unable to convert string", [43] = "Overflow", [44] = "Attribute signature mismatch", [45] = "Resolving local portion of reference", [46] = "Resolving global portion of reference", [47] = "Nmx version mismatch", [48] = "Nmx command not valid", [49] = "Lmx version mismatch", [50] = "Lmx command not valid", [51] = "However, the object could not be put On Scan - Permission to modify \"Operate\" attributes is required", [52] = "Unable to resolve reference for 'set' request because Galaxy Repository is busy performing a 'Deploy/Undeploy' operation", [53] = "Too many outstanding pending requests to engine", [54] = "Object Initializing", [55] = "Engine Initializing", [56] = "Secured Write", [57] = "Verified Write", [58] = "No Alarm Ack Privilege", [59] = "Alarm Acked Already", [60] = "User did not have the necessary permissions to write", [61] = "Verifier did not have the necessary permissions to verify", [541] = "Conversion to intended data type is not supported", [542] = "Unable to convert the input string to intended data type", [8017] = "Object must be offscan to modify attributes that have an MxSecurityConfigure security classification", }; public static string? GetKnownText(short detail) { return KnownDetails.TryGetValue(detail, out string? text) ? text : null; } }