using System;

namespace IACommService4CSharp
{
    public static class ErrorCode
    {
        public const UInt32 Good                = 0;
        public const UInt32 Failed              = 0x80000000; /* Common error */
        public const UInt32 DataTypeMismatch    = 0x80000001;
        public const UInt32 OutofRange          = 0x80000002;
        public const UInt32 NotFound            = 0x80000003;
        public const UInt32 InvalidArgument     = 0x80000004;
        public const UInt32 InternalError       = 0x80000005;
        public const UInt32 NotSupported        = 0x80000006;
        public const UInt32 InvalidState        = 0x80000007;
        public const UInt32 ConnectFailed       = 0x80000008;
        public const UInt32 AccessDenied        = 0x80000009;
        public const UInt32 NameDuplicated      = 0x8000000A;
        public const UInt32 AlreadyConnected    = 0x8000000B;
        public const UInt32 ConfigError         = 0x8000000C; /* The device connection configuration is wrong, such as enable gateway connector, but no gateway IP, port*/
        public const UInt32 Uninitialized       = 0x8000000D; /* The client instances has not been initialized*/
        public const UInt32 NotConnected        = 0x8000000E; /* The communication hasn't been established, or loss*/
        public const UInt32 NothingToDo         = 0x8000000F;
        public const UInt32 DataEmpty           = 0x80000010;
        public const UInt32 LoadSymbolsFailed   = 0x80000011;
        public const UInt32 NoSubscription      = 0x80000012; /* The handle doesn't existed in the subscriber list*/
        public const UInt32 LimitExceed         = 0x80000013; /* The number of symbols for one subscription has exceed the limitation*/
        public const UInt32 NotSupportedDevices = 0x80000014;
        public const UInt32 Timeout             = 0x80000015;
        public const UInt32 TooManyOperations   = 0x80000016;
        public const UInt32 AbandonedGroup      = 0x80000017;
    }

    public class IACommServiceException : System.ApplicationException
    {
        public uint Status { get; set; }
        public IACommServiceException(uint status) : base()
        {
            Status = status;
        }
        public IACommServiceException(uint status, string message) : base(message)
        {
            Status = status;
        }
    }
}
