# -*- coding: utf-8 -*-
"""
Created on Mon Feb 25 12:48:59 2019

@author: Axel Lacapmesure
"""

from enum import IntEnum

class EnumMixin:

    @classmethod
    def to_plain_dict(cls, inverse=False):
        dictionary = {}
        for name, enum in cls.__members__.items():
            if inverse:
                dictionary[enum.value] = enum
            else:
                dictionary[enum] = enum.value
        
        return dictionary
    

class TrueFalse(EnumMixin, IntEnum):
    TRUE = 1
    FALSE = 0

class Error(EnumMixin, IntEnum):
    IS_NO_SUCCESS = -1
    IS_SUCCESS = 0
    IS_INVALID_CAMERA_HANDLE = 1
    IS_INVALID_HANDLE = 1
    IS_IO_REQUEST_FAILED = 2
    IS_CANT_OPEN_DEVICE = 3
    IS_CANT_CLOSE_DEVICE = 4
    IS_CANT_SETUP_MEMORY = 5
    IS_NO_HWND_FOR_ERROR_REPORT = 6
    IS_ERROR_MESSAGE_NOT_CREATED = 7
    IS_ERROR_STRING_NOT_FOUND = 8
    IS_HOOK_NOT_CREATED = 9
    IS_TIMER_NOT_CREATED = 10
    IS_CANT_OPEN_REGISTRY = 11
    IS_CANT_READ_REGISTRY = 12
    IS_CANT_VALIDATE_BOARD = 13
    IS_CANT_GIVE_BOARD_ACCESS = 14
    IS_NO_IMAGE_MEM_ALLOCATED = 15
    IS_CANT_CLEANUP_MEMORY = 16
    IS_CANT_COMMUNICATE_WITH_DRIVER = 17
    IS_FUNCTION_NOT_SUPPORTED_YET = 18
    IS_OPERATING_SYSTEM_NOT_SUPPORTED = 19
    IS_INVALID_VIDEO_IN = 20
    IS_INVALID_IMG_SIZE = 21
    IS_INVALID_ADDRESS = 22
    IS_INVALID_VIDEO_MODE = 23
    IS_INVALID_AGC_MODE = 24
    IS_INVALID_GAMMA_MODE = 25
    IS_INVALID_SYNC_LEVEL = 26
    IS_INVALID_CBARS_MODE = 27
    IS_INVALID_COLOR_MODE = 28
    IS_INVALID_SCALE_FACTOR = 29
    IS_INVALID_IMAGE_SIZE = 30
    IS_INVALID_IMAGE_POS = 31
    IS_INVALID_CAPTURE_MODE = 32
    IS_INVALID_RISC_PROGRAM = 33
    IS_INVALID_BRIGHTNESS = 34
    IS_INVALID_CONTRAST = 35
    IS_INVALID_SATURATION_U = 36
    IS_INVALID_SATURATION_V = 37
    IS_INVALID_HUE = 38
    IS_INVALID_HOR_FILTER_STEP = 39
    IS_INVALID_VERT_FILTER_STEP = 40
    IS_INVALID_EEPROM_READ_ADDRESS = 41
    IS_INVALID_EEPROM_WRITE_ADDRESS = 42
    IS_INVALID_EEPROM_READ_LENGTH = 43
    IS_INVALID_EEPROM_WRITE_LENGTH = 44
    IS_INVALID_BOARD_INFO_POINTER = 45
    IS_INVALID_DISPLAY_MODE = 46
    IS_INVALID_ERR_REP_MODE = 47
    IS_INVALID_BITS_PIXEL = 48
    IS_INVALID_MEMORY_POINTER = 49
    IS_FILE_WRITE_OPEN_ERROR = 50
    IS_FILE_READ_OPEN_ERROR = 51
    IS_FILE_READ_INVALID_BMP_ID = 52
    IS_FILE_READ_INVALID_BMP_SIZE = 53
    IS_FILE_READ_INVALID_BIT_COUNT = 54
    IS_WRONG_KERNEL_VERSION = 55
    IS_RISC_INVALID_XLENGTH = 60
    IS_RISC_INVALID_YLENGTH = 61
    IS_RISC_EXCEED_IMG_SIZE = 62
    IS_DD_MAIN_FAILED = 70
    IS_DD_PRIMSURFACE_FAILED = 71
    IS_DD_SCRN_SIZE_NOT_SUPPORTED = 72
    IS_DD_CLIPPER_FAILED = 73
    IS_DD_CLIPPER_HWND_FAILED = 74
    IS_DD_CLIPPER_CONNECT_FAILED = 75
    IS_DD_BACKSURFACE_FAILED = 76
    IS_DD_BACKSURFACE_IN_SYSMEM = 77
    IS_DD_MDL_MALLOC_ERR = 78
    IS_DD_MDL_SIZE_ERR = 79
    IS_DD_CLIP_NO_CHANGE = 80
    IS_DD_PRIMMEM_NULL = 81
    IS_DD_BACKMEM_NULL = 82
    IS_DD_BACKOVLMEM_NULL = 83
    IS_DD_OVERLAYSURFACE_FAILED = 84
    IS_DD_OVERLAYSURFACE_IN_SYSMEM = 85
    IS_DD_OVERLAY_NOT_ALLOWED = 86
    IS_DD_OVERLAY_COLKEY_ERR = 87
    IS_DD_OVERLAY_NOT_ENABLED = 88
    IS_DD_GET_DC_ERROR = 89
    IS_DD_DDRAW_DLL_NOT_LOADED = 90
    IS_DD_THREAD_NOT_CREATED = 91
    IS_DD_CANT_GET_CAPS = 92
    IS_DD_NO_OVERLAYSURFACE = 93
    IS_DD_NO_OVERLAYSTRETCH = 94
    IS_DD_CANT_CREATE_OVERLAYSURFACE = 95
    IS_DD_CANT_UPDATE_OVERLAYSURFACE = 96
    IS_DD_INVALID_STRETCH = 97
    IS_EV_INVALID_EVENT_NUMBER = 100
    IS_INVALID_MODE = 101
    IS_CANT_FIND_FALCHOOK = 102
    IS_CANT_FIND_HOOK = 102
    IS_CANT_GET_HOOK_PROC_ADDR = 103
    IS_CANT_CHAIN_HOOK_PROC = 104
    IS_CANT_SETUP_WND_PROC = 105
    IS_HWND_NULL = 106
    IS_INVALID_UPDATE_MODE = 107
    IS_NO_ACTIVE_IMG_MEM = 108
    IS_CANT_INIT_EVENT = 109
    IS_FUNC_NOT_AVAIL_IN_OS = 110
    IS_CAMERA_NOT_CONNECTED = 111
    IS_SEQUENCE_LIST_EMPTY = 112
    IS_CANT_ADD_TO_SEQUENCE = 113
    IS_LOW_OF_SEQUENCE_RISC_MEM = 114
    IS_IMGMEM2FREE_USED_IN_SEQ = 115
    IS_IMGMEM_NOT_IN_SEQUENCE_LIST = 116
    IS_SEQUENCE_BUF_ALREADY_LOCKED = 117
    IS_INVALID_DEVICE_ID = 118
    IS_INVALID_BOARD_ID = 119
    IS_ALL_DEVICES_BUSY = 120
    IS_HOOK_BUSY = 121
    IS_TIMED_OUT = 122
    IS_NULL_POINTER = 123
    IS_WRONG_HOOK_VERSION = 124
    IS_INVALID_PARAMETER = 125
    IS_NOT_ALLOWED = 126
    IS_OUT_OF_MEMORY = 127
    IS_INVALID_WHILE_LIVE = 128
    IS_ACCESS_VIOLATION = 129
    IS_UNKNOWN_ROP_EFFECT = 130
    IS_INVALID_RENDER_MODE = 131
    IS_INVALID_THREAD_CONTEXT = 132
    IS_NO_HARDWARE_INSTALLED = 133
    IS_INVALID_WATCHDOG_TIME = 134
    IS_INVALID_WATCHDOG_MODE = 135
    IS_INVALID_PASSTHROUGH_IN = 136
    IS_ERROR_SETTING_PASSTHROUGH_IN = 137
    IS_FAILURE_ON_SETTING_WATCHDOG = 138
    IS_NO_USB20 = 139
    IS_CAPTURE_RUNNING = 140
    IS_MEMORY_BOARD_ACTIVATED = 141
    IS_MEMORY_BOARD_DEACTIVATED = 142
    IS_NO_MEMORY_BOARD_CONNECTED = 143
    IS_TOO_LESS_MEMORY = 144
    IS_IMAGE_NOT_PRESENT = 145
    IS_MEMORY_MODE_RUNNING = 146
    IS_MEMORYBOARD_DISABLED = 147
    IS_TRIGGER_ACTIVATED = 148
    IS_WRONG_KEY = 150
    IS_CRC_ERROR = 151
    IS_NOT_YET_RELEASED = 152
    IS_NOT_CALIBRATED = 153
    IS_WAITING_FOR_KERNEL = 154
    IS_NOT_SUPPORTED = 155
    IS_TRIGGER_NOT_ACTIVATED = 156
    IS_OPERATION_ABORTED = 157
    IS_BAD_STRUCTURE_SIZE = 158
    IS_INVALID_BUFFER_SIZE = 159
    IS_INVALID_PIXEL_CLOCK = 160
    IS_INVALID_EXPOSURE_TIME = 161
    IS_AUTO_EXPOSURE_RUNNING = 162
    IS_CANNOT_CREATE_BB_SURF = 163
    IS_CANNOT_CREATE_BB_MIX = 164
    IS_BB_OVLMEM_NULL = 165
    IS_CANNOT_CREATE_BB_OVL = 166
    IS_NOT_SUPP_IN_OVL_SURF_MODE = 167
    IS_INVALID_SURFACE = 168
    IS_SURFACE_LOST = 169
    IS_RELEASE_BB_OVL_DC = 170
    IS_BB_TIMER_NOT_CREATED = 171
    IS_BB_OVL_NOT_EN = 172
    IS_ONLY_IN_BB_MODE = 173
    IS_INVALID_COLOR_FORMAT = 174
    IS_INVALID_WB_BINNING_MODE = 175
    IS_INVALID_I2C_DEVICE_ADDRESS = 176
    IS_COULD_NOT_CONVERT = 177
    IS_TRANSFER_ERROR = 178
    IS_PARAMETER_SET_NOT_PRESENT = 179
    IS_INVALID_CAMERA_TYPE = 180
    IS_INVALID_HOST_IP_HIBYTE = 181
    IS_CM_NOT_SUPP_IN_CURR_DISPLAYMODE = 182
    IS_NO_IR_FILTER = 183
    IS_STARTER_FW_UPLOAD_NEEDED = 184
    IS_DR_LIBRARY_NOT_FOUND = 185
    IS_DR_DEVICE_OUT_OF_MEMORY = 186
    IS_DR_CANNOT_CREATE_SURFACE = 187
    IS_DR_CANNOT_CREATE_VERTEX_BUFFER = 188
    IS_DR_CANNOT_CREATE_TEXTURE = 189
    IS_DR_CANNOT_LOCK_OVERLAY_SURFACE = 190
    IS_DR_CANNOT_UNLOCK_OVERLAY_SURFACE = 191
    IS_DR_CANNOT_GET_OVERLAY_DC = 192
    IS_DR_CANNOT_RELEASE_OVERLAY_DC = 193
    IS_DR_DEVICE_CAPS_INSUFFICIENT = 194
    IS_INCOMPATIBLE_SETTING = 195
    IS_DR_NOT_ALLOWED_WHILE_DC_IS_ACTIVE = 196
    IS_DEVICE_ALREADY_PAIRED = 197
    IS_SUBNETMASK_MISMATCH = 198
    IS_SUBNET_MISMATCH = 199
    IS_INVALID_IP_CONFIGURATION = 200
    IS_DEVICE_NOT_COMPATIBLE = 201
    IS_NETWORK_FRAME_SIZE_INCOMPATIBLE = 202
    IS_NETWORK_CONFIGURATION_INVALID = 203
    IS_ERROR_CPU_IDLE_STATES_CONFIGURATION = 204
    IS_DEVICE_BUSY = 205
    IS_SENSOR_INITIALIZATION_FAILED = 206
    IS_IMAGE_BUFFER_NOT_DWORD_ALIGNED = 207

class SensorID(EnumMixin, IntEnum):
    IS_SENSOR_INVALID = 0x0000
    IS_SENSOR_UI141X_M = 0x0001
    IS_SENSOR_UI141X_C = 0x0002
    IS_SENSOR_UI144X_M = 0x0003
    IS_SENSOR_UI144X_C = 0x0004
    IS_SENSOR_UI154X_M = 0x0030
    IS_SENSOR_UI154X_C = 0x0031
    IS_SENSOR_UI145X_C = 0x0008
    IS_SENSOR_UI146X_C = 0x000a
    IS_SENSOR_UI148X_M = 0x000b
    IS_SENSOR_UI148X_C = 0x000c
    IS_SENSOR_UI121X_M = 0x0010
    IS_SENSOR_UI121X_C = 0x0011
    IS_SENSOR_UI122X_M = 0x0012
    IS_SENSOR_UI122X_C = 0x0013
    IS_SENSOR_UI164X_C = 0x0015
    IS_SENSOR_UI155X_C = 0x0017
    IS_SENSOR_UI1223_M = 0x0018
    IS_SENSOR_UI1223_C = 0x0019
    IS_SENSOR_UI149X_M = 0x003E
    IS_SENSOR_UI149X_C = 0x003F
    IS_SENSOR_UI1225_M = 0x0022
    IS_SENSOR_UI1225_C = 0x0023
    IS_SENSOR_UI1645_C = 0x0025
    IS_SENSOR_UI1555_C = 0x0027
    IS_SENSOR_UI1545_M = 0x0028
    IS_SENSOR_UI1545_C = 0x0029
    IS_SENSOR_UI1455_C = 0x002B
    IS_SENSOR_UI1465_C = 0x002D
    IS_SENSOR_UI1485_M = 0x002E
    IS_SENSOR_UI1485_C = 0x002F
    IS_SENSOR_UI1495_M = 0x0040
    IS_SENSOR_UI1495_C = 0x0041
    IS_SENSOR_UI112X_M = 0x004A
    IS_SENSOR_UI112X_C = 0x004B
    IS_SENSOR_UI1008_M = 0x004C
    IS_SENSOR_UI1008_C = 0x004D
    IS_SENSOR_UI1005_M = 0x020A
    IS_SENSOR_UI1005_C = 0x020B
    IS_SENSOR_UI1240_M = 0x0050
    IS_SENSOR_UI1240_C = 0x0051
    IS_SENSOR_UI1240_NIR = 0x0062
    IS_SENSOR_UI1240LE_M = 0x0054
    IS_SENSOR_UI1240LE_C = 0x0055
    IS_SENSOR_UI1240LE_NIR = 0x0064
    IS_SENSOR_UI1240ML_M = 0x0066
    IS_SENSOR_UI1240ML_C = 0x0067
    IS_SENSOR_UI1240ML_NIR = 0x0200
    IS_SENSOR_UI1243_M_SMI = 0x0078
    IS_SENSOR_UI1243_C_SMI = 0x0079
    IS_SENSOR_UI1543_M = 0x0032
    IS_SENSOR_UI1543_C = 0x0033
    IS_SENSOR_UI1544_M = 0x003A
    IS_SENSOR_UI1544_C = 0x003B
    IS_SENSOR_UI1543_M_WO = 0x003C
    IS_SENSOR_UI1543_C_WO = 0x003D
    IS_SENSOR_UI1453_C = 0x0035
    IS_SENSOR_UI1463_C = 0x0037
    IS_SENSOR_UI1483_M = 0x0038
    IS_SENSOR_UI1483_C = 0x0039
    IS_SENSOR_UI1493_M = 0x004E
    IS_SENSOR_UI1493_C = 0x004F
    IS_SENSOR_UI1463_M_WO = 0x0044
    IS_SENSOR_UI1463_C_WO = 0x0045
    IS_SENSOR_UI1553_C_WN = 0x0047
    IS_SENSOR_UI1483_M_WO = 0x0048
    IS_SENSOR_UI1483_C_WO = 0x0049
    IS_SENSOR_UI1580_M = 0x005A
    IS_SENSOR_UI1580_C = 0x005B
    IS_SENSOR_UI1580LE_M = 0x0060
    IS_SENSOR_UI1580LE_C = 0x0061
    IS_SENSOR_UI1360M = 0x0068
    IS_SENSOR_UI1360C = 0x0069
    IS_SENSOR_UI1360NIR = 0x0212
    IS_SENSOR_UI1370M = 0x006A
    IS_SENSOR_UI1370C = 0x006B
    IS_SENSOR_UI1370NIR = 0x0214
    IS_SENSOR_UI1250_M = 0x006C
    IS_SENSOR_UI1250_C = 0x006D
    IS_SENSOR_UI1250_NIR = 0x006E
    IS_SENSOR_UI1250LE_M = 0x0070
    IS_SENSOR_UI1250LE_C = 0x0071
    IS_SENSOR_UI1250LE_NIR = 0x0072
    IS_SENSOR_UI1250ML_M = 0x0074
    IS_SENSOR_UI1250ML_C = 0x0075
    IS_SENSOR_UI1250ML_NIR = 0x0202
    IS_SENSOR_XS = 0x020B
    IS_SENSOR_UI1493_M_AR = 0x0204
    IS_SENSOR_UI1493_C_AR = 0x0205
    IS_SENSOR_UI1060_M = 0x021A
    IS_SENSOR_UI1060_C = 0x021B
    IS_SENSOR_UI1013XC = 0x021D
    IS_SENSOR_UI1140M = 0x021E
    IS_SENSOR_UI1140C = 0x021F
    IS_SENSOR_UI1140NIR = 0x0220
    IS_SENSOR_UI1590M = 0x0222
    IS_SENSOR_UI1590C = 0x0223
    IS_SENSOR_UI1260_M = 0x0226
    IS_SENSOR_UI1260_C = 0x0227
    IS_SENSOR_UI1130_M = 0x022A
    IS_SENSOR_UI1130_C = 0x022B
    IS_SENSOR_UI1160_M = 0x022C
    IS_SENSOR_UI1160_C = 0x022D
    IS_SENSOR_UI1180_M = 0x022E
    IS_SENSOR_UI1180_C = 0x022F
    IS_SENSOR_UI1080_M = 0x0230
    IS_SENSOR_UI1080_C = 0x0231
    IS_SENSOR_UI1280_M = 0x0232
    IS_SENSOR_UI1280_C = 0x0233
    IS_SENSOR_UI1860_M = 0x0234
    IS_SENSOR_UI1860_C = 0x0235
    IS_SENSOR_UI1880_M = 0x0236
    IS_SENSOR_UI1880_C = 0x0237
    IS_SENSOR_UI1270_M = 0x0238
    IS_SENSOR_UI1270_C = 0x0239
    IS_SENSOR_UI1070_M = 0x023A
    IS_SENSOR_UI1070_C = 0x023B
    IS_SENSOR_UI1130LE_M = 0x023C
    IS_SENSOR_UI1130LE_C = 0x023D
    IS_SENSOR_UI1290_M = 0x023E
    IS_SENSOR_UI1290_C = 0x023F
    IS_SENSOR_UI1090_M = 0x0240
    IS_SENSOR_UI1090_C = 0x0241
    IS_SENSOR_UI1000_M = 0x0242
    IS_SENSOR_UI1000_C = 0x0243
    IS_SENSOR_UI1200_M = 0x0244
    IS_SENSOR_UI1200_C = 0x0245
    IS_SENSOR_UI223X_M = 0x0080
    IS_SENSOR_UI223X_C = 0x0081
    IS_SENSOR_UI241X_M = 0x0082
    IS_SENSOR_UI241X_C = 0x0083
    IS_SENSOR_UI234X_M = 0x0084
    IS_SENSOR_UI234X_C = 0x0085
    IS_SENSOR_UI221X_M = 0x0088
    IS_SENSOR_UI221X_C = 0x0089
    IS_SENSOR_UI231X_M = 0x0090
    IS_SENSOR_UI231X_C = 0x0091
    IS_SENSOR_UI222X_M = 0x0092
    IS_SENSOR_UI222X_C = 0x0093
    IS_SENSOR_UI224X_M = 0x0096
    IS_SENSOR_UI224X_C = 0x0097
    IS_SENSOR_UI225X_M = 0x0098
    IS_SENSOR_UI225X_C = 0x0099
    IS_SENSOR_UI214X_M = 0x009A
    IS_SENSOR_UI214X_C = 0x009B
    IS_SENSOR_UI228X_M = 0x009C
    IS_SENSOR_UI228X_C = 0x009D
    IS_SENSOR_UI223X_M_R3 = 0x0180
    IS_SENSOR_UI223X_C_R3 = 0x0181
    IS_SENSOR_UI241X_M_R2 = 0x0182
    IS_SENSOR_UI251X_M = 0x0182
    IS_SENSOR_UI241X_C_R2 = 0x0183
    IS_SENSOR_UI251X_C = 0x0183
    IS_SENSOR_UI234X_M_R3 = 0x0184
    IS_SENSOR_UI234X_C_R3 = 0x0185
    IS_SENSOR_UI221X_M_R3 = 0x0188
    IS_SENSOR_UI221X_C_R3 = 0x0189
    IS_SENSOR_UI222X_M_R3 = 0x0192
    IS_SENSOR_UI222X_C_R3 = 0x0193
    IS_SENSOR_UI224X_M_R3 = 0x0196
    IS_SENSOR_UI224X_C_R3 = 0x0197
    IS_SENSOR_UI225X_M_R3 = 0x0198
    IS_SENSOR_UI225X_C_R3 = 0x0199
    IS_SENSOR_UI2130_M = 0x019E
    IS_SENSOR_UI2130_C = 0x019F
    IS_SENSOR_PASSIVE_MULTICAST = 0x0F00

class SensorColorMode(EnumMixin, IntEnum):
    IS_COLORMODE_INVALID = 0
    IS_COLORMODE_MONOCHROME = 1
    IS_COLORMODE_BAYER = 2
    IS_COLORMODE_CBYCRY = 4
    IS_COLORMODE_JPEG = 8

class ImageColorMode(EnumMixin, IntEnum):
    IS_GET_COLOR_MODE = 0x8000
    IS_CM_FORMAT_PLANAR = 0x2000
    IS_CM_FORMAT_MASK = 0x2000
    IS_CM_ORDER_BGR = 0x0000
    IS_CM_ORDER_RGB = 0x0080
    IS_CM_ORDER_MASK = 0x0080
    IS_CM_PREFER_PACKED_SOURCE_FORMAT = 0x4000
    
    # Raw modes
    IS_CM_SENSOR_RAW8 = 11
    IS_CM_SENSOR_RAW10 = 33
    IS_CM_SENSOR_RAW12 = 27
    IS_CM_SENSOR_RAW16 = 29
    
    # Monochromatic modes
    IS_CM_MONO8 = 6
    IS_CM_MONO10 = 34
    IS_CM_MONO12 = 26
    IS_CM_MONO16 = 28
    
    # RGB
    IS_CM_RGB8_PACKED = (1|IS_CM_ORDER_RGB)
    IS_CM_RGBA8_PACKED = (0|IS_CM_ORDER_RGB)
    IS_CM_RGBY8_PACKED = (24|IS_CM_ORDER_RGB)
    IS_CM_RGB8_PLANAR = (1|IS_CM_ORDER_RGB|IS_CM_FORMAT_PLANAR)
    
    IS_CM_RGB10_PACKED = (25|IS_CM_ORDER_RGB)
    IS_CM_RGB10_UNPACKED = (35|IS_CM_ORDER_RGB)
    
    IS_CM_RGB12_PACKED = (30|IS_CM_ORDER_RGB)
    IS_CM_RGBA12_PACKED = (31|IS_CM_ORDER_RGB)
    
    # BGR
    IS_CM_BGR8_PACKED = (1|IS_CM_ORDER_BGR)
    IS_CM_BGRA8_PACKED = (0|IS_CM_ORDER_BGR)
    IS_CM_BGRY8_PACKED = (24|IS_CM_ORDER_BGR)
    
    IS_CM_BGR10_PACKED = (25|IS_CM_ORDER_BGR)
    IS_CM_BGR10_UNPACKED = (35|IS_CM_ORDER_BGR)
    
    IS_CM_BGR12_PACKED = (30|IS_CM_ORDER_BGR)
    IS_CM_BGRA12_PACKED = (31|IS_CM_ORDER_BGR)
    
    IS_CM_BGR565_PACKED = (2|IS_CM_ORDER_BGR)
    IS_CM_BGR5_PACKED = (3|IS_CM_ORDER_BGR)
    
    # Others
    IS_CM_UYVY_PACKED = 12
    IS_CM_UYVY_MONO_PACKED = 13
    IS_CM_UYVY_BAYER_PACKED = 14
    IS_CM_CBYCRY_PACKED = 23
    IS_CM_JPEG = 32
    IS_CM_ALL_POSSIBLE = 0xFFFF
    IS_CM_MODE_MASK = 0x007F

class BitsPerPixel(EnumMixin, IntEnum):
    # Raw modes
    IS_CM_SENSOR_RAW8 = 8
    IS_CM_SENSOR_RAW10 = 16
    IS_CM_SENSOR_RAW12 = 16
    IS_CM_SENSOR_RAW16 = 16
    
    # Monochromatic modes
    IS_CM_MONO8 = 8
    IS_CM_MONO10 = 16
    IS_CM_MONO12 = 16
    IS_CM_MONO16 = 16
    
    # RGB
    IS_CM_RGB8_PACKED = 24
    IS_CM_RGBA8_PACKED = 32
    IS_CM_RGBY8_PACKED = 32
    IS_CM_RGB8_PLANAR = 24
    
    IS_CM_RGB10_PACKED = 32
    IS_CM_RGB10_UNPACKED = 48
    
    IS_CM_RGB12_PACKED = 48
    IS_CM_RGBA12_PACKED = 64
    
    # BGR
    IS_CM_BGR8_PACKED = 24
    IS_CM_BGRA8_PACKED = 32
    IS_CM_BGRY8_PACKED = 32
    
    IS_CM_BGR10_PACKED = 32
    IS_CM_BGR10_UNPACKED = 48
    
    IS_CM_BGR12_PACKED = 48
    IS_CM_BGRA12_PACKED = 64
    
    IS_CM_BGR565_PACKED = 16
    IS_CM_BGR5_PACKED = 16
    
    # Others
    IS_CM_UYVY = 32
    IS_CM_UYVY_MONO = 32
    IS_CM_UYVY_BAYER = 32
    IS_CM_CBYCRY_PACKED = 32

class DisplayMode(EnumMixin, IntEnum):
    IS_GET_DISPLAY_MODE = 0x8000
    IS_SET_DM_DIB = 1
    IS_SET_DM_DIRECT3D = 4
    IS_SET_DM_OPENGL = 8
    IS_SET_DM_MONO = 0x800
    IS_SET_DM_BAYER = 0x1000
    IS_SET_DM_YCBCR = 0x4000

class AOI(EnumMixin, IntEnum):
    IS_AOI_IMAGE_SET_AOI = 0x0001
    IS_AOI_IMAGE_GET_AOI = 0x0002
    IS_AOI_IMAGE_SET_POS = 0x0003
    IS_AOI_IMAGE_GET_POS = 0x0004
    IS_AOI_IMAGE_SET_SIZE = 0x0005
    IS_AOI_IMAGE_GET_SIZE = 0x0006
    IS_AOI_IMAGE_GET_POS_MIN = 0x0007
    IS_AOI_IMAGE_GET_SIZE_MIN = 0x0008
    IS_AOI_IMAGE_GET_POS_MAX = 0x0009
    IS_AOI_IMAGE_GET_SIZE_MAX = 0x0010
    IS_AOI_IMAGE_GET_POS_INC = 0x0011
    IS_AOI_IMAGE_GET_SIZE_INC = 0x0012
    IS_AOI_IMAGE_GET_POS_X_ABS = 0x0013
    IS_AOI_IMAGE_GET_POS_Y_ABS = 0x0014
    IS_AOI_IMAGE_GET_ORIGINAL_AOI = 0x0015
    IS_AOI_IMAGE_POS_ABSOLUTE = 0x10000000
    IS_AOI_IMAGE_SET_POS_FAST = 0x0020
    IS_AOI_IMAGE_GET_POS_FAST_SUPPORTED = 0x0021
    IS_AOI_AUTO_BRIGHTNESS_SET_AOI = 0x0030
    IS_AOI_AUTO_BRIGHTNESS_GET_AOI = 0x0031
    IS_AOI_AUTO_WHITEBALANCE_SET_AOI = 0x0032
    IS_AOI_AUTO_WHITEBALANCE_GET_AOI = 0x0033
    IS_AOI_MULTI_GET_SUPPORTED_MODES = 0x0100
    IS_AOI_MULTI_SET_AOI = 0x0200
    IS_AOI_MULTI_GET_AOI = 0x0400
    IS_AOI_MULTI_DISABLE_AOI = 0x0800
    IS_AOI_MULTI_MODE_X_Y_AXES = 0x0001
    IS_AOI_MULTI_MODE_Y_AXES = 0x0002
    IS_AOI_MULTI_MODE_GET_MAX_NUMBER = 0x0003
    IS_AOI_MULTI_MODE_GET_DEFAULT = 0x0004
    IS_AOI_MULTI_MODE_ONLY_VERIFY_AOIS = 0x0005
    IS_AOI_MULTI_MODE_GET_MINIMUM_SIZE = 0x0006
    IS_AOI_MULTI_MODE_GET_ENABLED = 0x0007
    IS_AOI_MULTI_STATUS_SETBYUSER = 0x00000001
    IS_AOI_MULTI_STATUS_COMPLEMENT = 0x00000002
    IS_AOI_MULTI_STATUS_VALID = 0x00000004
    IS_AOI_MULTI_STATUS_CONFLICT = 0x00000008
    IS_AOI_MULTI_STATUS_ERROR = 0x00000010
    IS_AOI_MULTI_STATUS_UNUSED = 0x00000020
    IS_AOI_SEQUENCE_GET_SUPPORTED = 0x0050
    IS_AOI_SEQUENCE_SET_PARAMS = 0x0051
    IS_AOI_SEQUENCE_GET_PARAMS = 0x0052
    IS_AOI_SEQUENCE_SET_ENABLE = 0x0053
    IS_AOI_SEQUENCE_GET_ENABLE = 0x0054
    IS_AOI_SEQUENCE_INDEX_AOI_1 = 0
    IS_AOI_SEQUENCE_INDEX_AOI_2 = 1
    IS_AOI_SEQUENCE_INDEX_AOI_3 = 2
    IS_AOI_SEQUENCE_INDEX_AOI_4 = 4

class VideoCapture(EnumMixin, IntEnum):
    IS_GET_LIVE = 0x8000
    IS_WAIT = 0x0001
    IS_DONT_WAIT = 0x0000
    IS_FORCE_VIDEO_STOP = 0x4000
    IS_FORCE_VIDEO_START = 0x4000

class Trigger(EnumMixin, IntEnum):
    IS_GET_EXTERNALTRIGGER = 0x8000
    IS_GET_TRIGGER_STATUS = 0x8001
    IS_GET_TRIGGER_MASK = 0x8002
    IS_GET_TRIGGER_INPUTS = 0x8003
    IS_GET_SUPPORTED_TRIGGER_MODE = 0x8004
    IS_GET_TRIGGER_COUNTER = 0x8000
    IS_SET_TRIGGER_MASK = 0x0100
    IS_SET_TRIGGER_CONTINUOUS = 0x1000
    IS_SET_TRIGGER_OFF = 0x0000
    IS_SET_TRIGGER_HI_LO = (IS_SET_TRIGGER_CONTINUOUS|0x0001)
    IS_SET_TRIGGER_LO_HI = (IS_SET_TRIGGER_CONTINUOUS|0x0002)
    IS_SET_TRIGGER_SOFTWARE = (IS_SET_TRIGGER_CONTINUOUS|0x0008)
    IS_SET_TRIGGER_HI_LO_SYNC = 0x0010
    IS_SET_TRIGGER_LO_HI_SYNC = 0x0020
    IS_SET_TRIGGER_PRE_HI_LO = (IS_SET_TRIGGER_CONTINUOUS|0x0040)
    IS_SET_TRIGGER_PRE_LO_HI = (IS_SET_TRIGGER_CONTINUOUS|0x0080)
    IS_GET_TRIGGER_DELAY = 0x8000
    IS_GET_MIN_TRIGGER_DELAY = 0x8001
    IS_GET_MAX_TRIGGER_DELAY = 0x8002
    IS_GET_TRIGGER_DELAY_GRANULARITY = 0x8003

class Exposure(EnumMixin, IntEnum):
    IS_EXPOSURE_CMD_GET_CAPS = 1
    IS_EXPOSURE_CMD_GET_EXPOSURE_DEFAULT = 2
    IS_EXPOSURE_CMD_GET_EXPOSURE_RANGE_MIN = 3
    IS_EXPOSURE_CMD_GET_EXPOSURE_RANGE_MAX = 4
    IS_EXPOSURE_CMD_GET_EXPOSURE_RANGE_INC = 5
    IS_EXPOSURE_CMD_GET_EXPOSURE_RANGE = 6
    IS_EXPOSURE_CMD_GET_EXPOSURE = 7
    IS_EXPOSURE_CMD_GET_FINE_INCREMENT_RANGE_MIN = 8
    IS_EXPOSURE_CMD_GET_FINE_INCREMENT_RANGE_MAX = 9
    IS_EXPOSURE_CMD_GET_FINE_INCREMENT_RANGE_INC = 10
    IS_EXPOSURE_CMD_GET_FINE_INCREMENT_RANGE = 11
    IS_EXPOSURE_CMD_SET_EXPOSURE = 12
    IS_EXPOSURE_CMD_GET_LONG_EXPOSURE_RANGE_MIN = 13
    IS_EXPOSURE_CMD_GET_LONG_EXPOSURE_RANGE_MAX = 14
    IS_EXPOSURE_CMD_GET_LONG_EXPOSURE_RANGE_INC = 15
    IS_EXPOSURE_CMD_GET_LONG_EXPOSURE_RANGE = 16
    IS_EXPOSURE_CMD_GET_LONG_EXPOSURE_ENABLE = 17
    IS_EXPOSURE_CMD_SET_LONG_EXPOSURE_ENABLE = 18
    IS_EXPOSURE_CMD_GET_DUAL_EXPOSURE_RATIO_DEFAULT = 19
    IS_EXPOSURE_CMD_GET_DUAL_EXPOSURE_RATIO_RANGE = 20
    IS_EXPOSURE_CMD_GET_DUAL_EXPOSURE_RATIO = 21
    IS_EXPOSURE_CMD_SET_DUAL_EXPOSURE_RATIO = 22

class PixelClock(EnumMixin, IntEnum):
    IS_PIXELCLOCK_CMD_GET_NUMBER = 1
    IS_PIXELCLOCK_CMD_GET_LIST = 2
    IS_PIXELCLOCK_CMD_GET_RANGE = 3
    IS_PIXELCLOCK_CMD_GET_DEFAULT = 4
    IS_PIXELCLOCK_CMD_GET = 5
    IS_PIXELCLOCK_CMD_SET = 6

class ShutterModes(EnumMixin, IntEnum):
    IS_DEVICE_FEATURE_CAP_SHUTTER_MODE_ROLLING = 1
    IS_DEVICE_FEATURE_CAP_SHUTTER_MODE_GLOBAL = 2
    IS_DEVICE_FEATURE_CAP_SHUTTER_MODE_ROLLING_GLOBAL_START = 64
    IS_DEVICE_FEATURE_CAP_SHUTTER_MODE_GLOBAL_ALTERNATIVE_TIMING = 128

class Shutter(EnumMixin, IntEnum):
    IS_DEVICE_FEATURE_CMD_SET_SHUTTER_MODE = 6
    IS_DEVICE_FEATURE_CMD_GET_SHUTTER_MODE = 7
    
    IS_SET_GLOBAL_SHUTTER_ON = 0x0001
    IS_SET_GLOBAL_SHUTTER_OFF = 0x0000
    IS_GET_GLOBAL_SHUTTER = 0x0010
    IS_GET_SUPPORTED_GLOBAL_SHUTTER = 0x0020

class DeviceFeature(EnumMixin, IntEnum):
    IS_DEVICE_FEATURE_CMD_GET_SUPPORTED_FEATURES = 1

class Blacklevel(EnumMixin, IntEnum):
    IS_BLACKLEVEL_CMD_GET_CAPS = 1
    IS_BLACKLEVEL_CMD_GET_MODE_DEFAULT = 2
    IS_BLACKLEVEL_CMD_GET_MODE = 3
    IS_BLACKLEVEL_CMD_SET_MODE = 4
    IS_BLACKLEVEL_CMD_GET_OFFSET_DEFAULT = 5
    IS_BLACKLEVEL_CMD_GET_OFFSET_RANGE = 6
    IS_BLACKLEVEL_CMD_GET_OFFSET = 7
    IS_BLACKLEVEL_CMD_SET_OFFSET = 8

class BlacklevelCaps(EnumMixin, IntEnum):
    IS_BLACKLEVEL_CAP_SET_AUTO_BLACKLEVEL = 1
    IS_BLACKLEVEL_CAP_SET_OFFSET = 2

class BlacklevelModes(EnumMixin, IntEnum):
    IS_AUTO_BLACKLEVEL_OFF = 0
    IS_AUTO_BLACKLEVEL_ON = 1

class SensorBitDepths(EnumMixin, IntEnum):
    IS_SENSOR_BIT_DEPTH_AUTO = 0
    IS_SENSOR_BIT_DEPTH_8_BIT = 1
    IS_SENSOR_BIT_DEPTH_10_BIT = 2
    IS_SENSOR_BIT_DEPTH_12_BIT = 4

class SensorBitDepth(EnumMixin, IntEnum):
    IS_DEVICE_FEATURE_CAP_SENSOR_BIT_DEPTH = 4096
    IS_DEVICE_FEATURE_CMD_GET_SUPPORTED_SENSOR_BIT_DEPTHS = 41
    IS_DEVICE_FEATURE_CMD_GET_SENSOR_BIT_DEPTH_DEFAULT = 42
    IS_DEVICE_FEATURE_CMD_GET_SENSOR_BIT_DEPTH = 43
    IS_DEVICE_FEATURE_CMD_SET_SENSOR_BIT_DEPTH = 44

class Framerate(EnumMixin, IntEnum):
    IS_GET_FRAMERATE = 0x8000

class Connectivity(EnumMixin, IntEnum):
    IS_USB_10 = 0x0001
    IS_USB_11 = 0x0002
    IS_USB_20 = 0x0004
    IS_USB_30 = 0x0008
    IS_ETHERNET_10 = 0x0080
    IS_ETHERNET_100 = 0x0100
    IS_ETHERNET_1000 = 0x0200
    IS_ETHERNET_10000 = 0x0400
    IS_USB_LOW_SPEED = 1
    IS_USB_FULL_SPEED = 12
    IS_USB_HIGH_SPEED = 480
    IS_USB_SUPER_SPEED = 4000
    IS_ETHERNET_10Base = 10
    IS_ETHERNET_100Base = 100
    IS_ETHERNET_1000Base = 1000
    IS_ETHERNET_10GBase = 10000






