ErrorCode.cs 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using System;
  2. namespace IACommService4CSharp
  3. {
  4. public static class ErrorCode
  5. {
  6. public const UInt32 Good = 0;
  7. public const UInt32 Failed = 0x80000000; /* Common error */
  8. public const UInt32 DataTypeMismatch = 0x80000001;
  9. public const UInt32 OutofRange = 0x80000002;
  10. public const UInt32 NotFound = 0x80000003;
  11. public const UInt32 InvalidArgument = 0x80000004;
  12. public const UInt32 InternalError = 0x80000005;
  13. public const UInt32 NotSupported = 0x80000006;
  14. public const UInt32 InvalidState = 0x80000007;
  15. public const UInt32 ConnectFailed = 0x80000008;
  16. public const UInt32 AccessDenied = 0x80000009;
  17. public const UInt32 NameDuplicated = 0x8000000A;
  18. public const UInt32 AlreadyConnected = 0x8000000B;
  19. public const UInt32 ConfigError = 0x8000000C; /* The device connection configuration is wrong, such as enable gateway connector, but no gateway IP, port*/
  20. public const UInt32 Uninitialized = 0x8000000D; /* The client instances has not been initialized*/
  21. public const UInt32 NotConnected = 0x8000000E; /* The communication hasn't been established, or loss*/
  22. public const UInt32 NothingToDo = 0x8000000F;
  23. public const UInt32 DataEmpty = 0x80000010;
  24. public const UInt32 LoadSymbolsFailed = 0x80000011;
  25. public const UInt32 NoSubscription = 0x80000012; /* The handle doesn't existed in the subscriber list*/
  26. public const UInt32 LimitExceed = 0x80000013; /* The number of symbols for one subscription has exceed the limitation*/
  27. public const UInt32 NotSupportedDevices = 0x80000014;
  28. public const UInt32 Timeout = 0x80000015;
  29. public const UInt32 TooManyOperations = 0x80000016;
  30. public const UInt32 AbandonedGroup = 0x80000017;
  31. }
  32. public class IACommServiceException : System.ApplicationException
  33. {
  34. public uint Status { get; set; }
  35. public IACommServiceException(uint status) : base()
  36. {
  37. Status = status;
  38. }
  39. public IACommServiceException(uint status, string message) : base(message)
  40. {
  41. Status = status;
  42. }
  43. }
  44. }