class Item(NiceObject): _init_ = 'create_item' _prefix_ = 'item_' get_id = Sig('in') get_value = Sig('in', ret=ret_ignore) set_value = Sig('in', 'in')
class Item(NiceObject): _init_ = 'create_item' _prefix_ = 'item_' get_id = Sig('in') get_value = Sig('in') set_value = Sig('in', 'in') static_value = Sig(use_handle=False)
class NicePixelfly(NiceLib): _info_ = info _ret_ = pixelfly_errorcheck INITBOARD = Sig('in', 'out') # Second arg should really be 'inout' CHECK_BOARD_AVAILABILITY = Sig('in') class Board(NiceObject): _init_ = 'INITBOARD' CLOSEBOARD = Sig('inout') START_CAMERA = Sig('in') STOP_CAMERA = Sig('in') TRIGGER_CAMERA = Sig('in') SETMODE = Sig('in', 'in', 'in', 'in', 'in', 'in', 'in', 'in', 'in', 'in') SET_EXPOSURE = Sig('in', 'in') GETMODE = Sig('in', 'out', 'out', 'out', 'out', 'out', 'out', 'out', 'out', 'out') GETSIZES = Sig('in', 'out', 'out', 'out', 'out', 'out') READVERSION = Sig('in', 'in', 'buf', 'len=64') READTEMPERATURE = Sig('in', 'out') WRRDORION = Sig('in', 'in', 'out') SETORIONINT = Sig('in', 'in', 'in', 'in', 'in') # TODO: NiceLib needs something like bufin GETORIONINT = Sig('in', 'in', 'in', 'buf', 'len') READEEPROM = Sig('in', 'in', 'in', 'out') WRITEEEPROM = Sig('in', 'in', 'in', 'in') SETTIMEOUTS = Sig('in', 'in', 'in', 'in') #SET_TIMEOUT_VALUES = Sig('in', 'arr', 'len') # TODO: len is in bytes SETDRIVER_EVENT = Sig('in', 'in', 'inout') PCC_GET_VERSION = Sig('in', 'out', 'out') READ_IMAGE = Sig('in', 'in', 'len', 'arr', 'in') # TODO: Check this ALLOCATE_BUFFER_EX = Sig('in', 'inout', 'in', 'inout', 'inout') FREE_BUFFER = Sig('in', 'in') SETBUFFER_EVENT = Sig('in', 'in', 'inout') CLEARBUFFER_EVENT = Sig('in', 'in', 'inout') PCC_RESETEVENT = Sig('in', 'in') ADD_BUFFER_TO_LIST = Sig('in', 'in', 'in', 'in', 'in') REMOVE_BUFFER_FROM_LIST = Sig('in', 'in') ADD_BUFFER = Sig('in', 'in', 'in', 'in', 'in') REMOVE_BUFFER = Sig('in', 'in') REMOVE_ALL_BUFFERS_FROM_LIST = Sig('in') PCC_WAITFORBUFFER = Sig('in', 'in', 'inout', 'in') GETBUFFER_STATUS = Sig('in', 'in', 'in', 'arr', 'len=4:byte') @Sig('in', 'in', 'inout') def GETBOARDVAL(self, pcc_val): data = ffi.new('DWORD*') self._autofunc_GETBOARDVAL(pcc_val, ffi.cast('void*', data)) return data[0]
class NiceFoo(NiceLib): """Foo library""" _info = load_lib('foo', pkg=None, dir=__file__) _ret = ret_return add = Sig('in', 'in') subtract = Sig('in', 'in') create_item = Sig() class Item(NiceObject): _init_ = 'create_item' _prefix_ = 'item_' get_id = Sig('in') get_value = Sig('in') set_value = Sig('in', 'in') static_value = Sig(use_handle=False)
class NiceCCSLib(NiceLib): """Mid-level wrapper for TLCCS_XX.dll""" _info_ = load_lib('tlccs', __package__) _prefix_ = 'tlccs_' _buflen_ = 256 _ret_ = ccs_errcheck init = Sig('in', 'in', 'in', 'out') error_message = Sig('in', 'in', 'buf[512]') class NiceCCS(NiceObject): close = Sig('in') setIntegrationTime = Sig('in', 'in') getIntegrationTime = Sig('in', 'out') startScan = Sig('in') startScanCont = Sig('in') startScanExtTrg = Sig('in') startScanContExtTrg = Sig('in') getDeviceStatus = Sig('in', 'out') getScanData = Sig('in', 'arr[{}]'.format(NUM_RAW_PIXELS)) getRawScanData = Sig('in', 'out') setWavelengthData = Sig('in', 'in', 'in', 'in') getWavelengthData = Sig('in', 'in', 'arr[{}]'.format(NUM_RAW_PIXELS), 'out', 'out') getUserCalibrationPoints = Sig('in', 'out', 'out', 'out') setAmplitudeData = Sig('in', 'in', 'in', 'in', 'in') getAmplitudeData = Sig('in', 'arr[{}]'.format(NUM_RAW_PIXELS), 'in', 'in', 'in') identificationQuery = Sig('in', 'buf[256]', 'buf[256]', 'buf[256]', 'buf[256]', 'buf[256]') revision_query = Sig('in', 'out', 'out') reset = Sig('in') self_test = Sig('in', 'out', 'out') setUserText = Sig('in', 'in') getUserText = Sig('in', 'out') setAttribute = Sig('in', 'in', 'in') getAttribute = Sig('in', 'in', 'out') error_query = Sig('in', 'out', 'out') error_message = Sig('in', 'in', 'buf[512]', ret=ret_ignore)
class NiceISC(NiceLib): """Mid-level wrapper for Thorlabs.MotionControl.IntegratedStepperMotors.dll""" _info_ = load_lib('isc_', __package__, builder='._build_kinesis', kwargs={'shortname': 'isc', 'sublib': 'Thorlabs.MotionControl.IntegratedStepperMotors'}) _prefix_ = 'TLI_' _ret_ = ret_errcheck BuildDeviceList = Sig() GetDeviceListSize = Sig(ret=ret_return) GetDeviceListExt = Sig('buf', 'len') GetDeviceListByTypeExt = Sig('buf', 'len', 'in') GetDeviceListByTypesExt = Sig('buf', 'len', 'in', 'in') GetDeviceInfo = Sig('in', 'out', ret=ret_success) # GetDeviceList = Sig('out') # GetDeviceListByType = Sig('out', 'in', dict(first_arg=False)) # GetDeviceListByTypes = Sig('out', 'in', 'in', dict(first_arg=False)) class Device(NiceObject): _prefix_ = 'ISC_' _sigs_ = {name: all_sigs[name] for name in [ 'Open', 'Close', 'Identify', 'GetHardwareInfo', 'GetFirmwareVersion', 'GetSoftwareVersion', 'LoadSettings', 'PersistSettings', 'GetNumberPositions', 'CanHome', 'Home', 'NeedsHoming', 'MoveToPosition', 'GetPosition', 'GetPositionCounter', 'RequestStatus', 'RequestStatusBits', 'GetStatusBits', 'StartPolling', 'PollingDuration', 'StopPolling', 'RequestSettings', 'ClearMessageQueue', 'RegisterMessageCallback', 'MessageQueueSize', 'GetNextMessage', 'WaitForMessage', 'GetMotorParamsExt', 'SetJogStepSize', 'GetJogVelParams', 'GetBacklash', 'SetBacklash', 'GetLimitSwitchParams', 'GetLimitSwitchParamsBlock', ]}
class NiceFilterFlipper(NiceLib): """Mid-level wrapper for Thorlabs.MotionControl.FilterFlipper.dll""" _ffi_ = ffi _ffilib_ = lib _prefix_ = ('FF_', 'TLI_') _buflen_ = 512 _ret_ = ret_errcheck BuildDeviceList = Sig() GetDeviceListSize = Sig(ret=ret_return) GetDeviceList = Sig('out') GetDeviceListByType = Sig('out', 'in') GetDeviceInfo = Sig('in', 'out', ret=ret_success) # GetDeviceListByTypes seemed not to be properly implemented in the .dll # GetDeviceListByTypes = Sig('out', 'in', 'in') GetDeviceListExt = Sig('buf', 'len') GetDeviceListByTypeExt = Sig('buf', 'len', 'in') GetDeviceListByTypesExt = Sig('buf', 'len', 'in', 'in') class Flipper(NiceObject): Open = Sig('in') Close = Sig('in') Identify = Sig('in') GetHardwareInfo = Sig('in', 'buf', 'len', 'out', 'out', 'buf', 'len', 'out', 'out', 'out') GetFirmwareVersion = Sig('in', ret=ret_return) GetSoftwareVersion = Sig('in', ret=ret_return) LoadSettings = Sig('in', ret=ret_success) PersistSettings = Sig('in', ret=ret_success) GetNumberPositions = Sig('in', ret=ret_return) Home = Sig('in') MoveToPosition = Sig('in', 'in') GetPosition = Sig('in', ret=ret_return) GetIOSettings = Sig('in', 'out') GetTransitTime = Sig('in', ret=ret_return) SetTransitTime = Sig('in', 'in') RequestStatus = Sig('in') GetStatusBits = Sig('in', ret=ret_return) StartPolling = Sig('in', 'in', ret=ret_success) PollingDuration = Sig('in', ret=ret_return) StopPolling = Sig('in') RequestSettings = Sig('in') ClearMessageQueue = Sig('in') RegisterMessageCallback = Sig('in', 'in') MessageQueueSize = Sig('in', ret=ret_return) GetNextMessage = Sig('in', 'in', 'in', 'in', ret=ret_success) WaitForMessage = Sig('in', 'in', 'in', 'in', ret=ret_success)
class NiceKinesisISC(NiceLib): """Mid-level wrapper for Thorlabs.MotionControl.IntegratedStepperMotors.dll""" _info_ = load_lib('kinesis', __package__) _prefix_ = 'TLI_' _ret_ = ret_errcheck BuildDeviceList = Sig() GetDeviceListSize = Sig(ret=ret_return) GetDeviceListExt = Sig('buf', 'len') GetDeviceListByTypeExt = Sig('buf', 'len', 'in') GetDeviceListByTypesExt = Sig('buf', 'len', 'in', 'in') GetDeviceInfo = Sig('in', 'out') # GetDeviceList = Sig('out') # GetDeviceListByType = Sig('out', 'in', dict(first_arg=False)) # GetDeviceListByTypes = Sig('out', 'in', 'in', dict(first_arg=False)) class Device(NiceObject): _prefix_ = 'ISC_' Open = Sig('in') Close = Sig('in', ret=ret_return) Identify = Sig('in', ret=ret_ignore) GetHardwareInfo = Sig('in', 'buf', 'len', 'out', 'out', 'buf', 'len', 'out', 'out', 'out') GetFirmwareVersion = Sig('in', ret=ret_return) GetSoftwareVersion = Sig('in', ret=ret_return) LoadSettings = Sig('in', ret=ret_success) PersistSettings = Sig('in', ret=ret_success) GetNumberPositions = Sig('in', ret=ret_return) CanHome = Sig('in', ret=ret_return) Home = Sig('in') NeedsHoming = Sig('in', ret=ret_return) MoveToPosition = Sig('in', 'in') GetPosition = Sig('in', ret=ret_return) GetPositionCounter = Sig('in', ret=ret_return) RequestStatus = Sig('in') RequestStatusBits = Sig('in') GetStatusBits = Sig('in', ret=ret_return) StartPolling = Sig('in', 'in', ret=ret_success) PollingDuration = Sig('in', ret=ret_return) StopPolling = Sig('in', ret=ret_ignore) RequestSettings = Sig('in') ClearMessageQueue = Sig('in', ret=ret_ignore) RegisterMessageCallback = Sig('in', 'in', ret=ret_ignore) MessageQueueSize = Sig('in', ret=ret_return) GetNextMessage = Sig('in', 'out', 'out', 'out', ret=ret_success) WaitForMessage = Sig('in', 'out', 'out', 'out', ret=ret_success) GetMotorParamsExt = Sig('in', 'out', 'out', 'out') SetJogStepSize = Sig('in', 'in') GetJogVelParams = Sig('in', 'out', 'out') GetBacklash = Sig('in', ret=ret_return) SetBacklash = Sig('in', 'in') GetLimitSwitchParams = Sig('in', 'out', 'out', 'out', 'out', 'out') GetLimitSwitchParamsBlock = Sig('in', 'out')
class NiceFoo(NiceLib): """Foo library""" _info = load_lib('foo', pkg=None, dir=__file__) _ret = ret_return @Sig('in', 'in') def add(cls, a, b): return cls._autofunc_add(a, b) create_item = Sig() class Item(NiceObject): _init_ = 'create_item' _prefix_ = 'item_' get_id = Sig('in') get_value = Sig('in', ret=ret_ignore) set_value = Sig('in', 'in')
class NiceTLI(NiceLib): """Mid-level wrapper for Thorlabs Kinesis TLI_ functions""" # NOTE: Wraps FilterFlipper DLL now because as of August 2020, DeviceManager DLL does not # include simulation-related functions _info_ = load_lib('tli_', __package__, builder='._build_kinesis', kwargs={ 'shortname': 'tli', 'sublib': 'Thorlabs.MotionControl.FilterFlipper' }) _prefix_ = 'TLI_' _ret_ = ret_errcheck BuildDeviceList = Sig() GetDeviceListSize = Sig(ret=ret_return) GetDeviceListExt = Sig('buf', 'len') GetDeviceListByTypeExt = Sig('buf', 'len', 'in') GetDeviceListByTypesExt = Sig('buf', 'len', 'in', 'in') GetDeviceInfo = Sig('in', 'out', ret=ret_success) InitializeSimulations = Sig(ret=ret_ignore) UninitializeSimulations = Sig(ret=ret_ignore)
class NiceFF(NiceLib): """Mid-level wrapper for Thorlabs.MotionControl.FilterFlipper.dll""" _info_ = load_lib('ff_', __package__, builder='._build_kinesis', kwargs={'shortname': 'ff', 'sublib': 'Thorlabs.MotionControl.FilterFlipper'}) _prefix_ = 'TLI_' _ret_ = ret_errcheck BuildDeviceList = Sig() GetDeviceListSize = Sig(ret=ret_return) GetDeviceListExt = Sig('buf', 'len') GetDeviceListByTypeExt = Sig('buf', 'len', 'in') GetDeviceListByTypesExt = Sig('buf', 'len', 'in', 'in') GetDeviceInfo = Sig('in', 'out', ret=ret_success) # GetDeviceList = Sig('out') # GetDeviceListByType = Sig('out', 'in', first_arg=False) # GetDeviceListByTypes = Sig('out', 'in', 'in', first_arg=False) class Flipper(NiceObject): _prefix_ = 'FF_' Open = Sig('in') Close = Sig('in') Identify = Sig('in') GetHardwareInfo = Sig('in', 'buf', 'len', 'out', 'out', 'buf', 'len', 'out', 'out', 'out') GetFirmwareVersion = Sig('in', ret=ret_return) GetSoftwareVersion = Sig('in', ret=ret_return) LoadSettings = Sig('in', ret=ret_success) PersistSettings = Sig('in', ret=ret_success) GetNumberPositions = Sig('in', ret=ret_return) Home = Sig('in') MoveToPosition = Sig('in', 'in') GetPosition = Sig('in', ret=ret_return) GetIOSettings = Sig('in', 'out') GetTransitTime = Sig('in', ret=ret_return) SetTransitTime = Sig('in', 'in') RequestStatus = Sig('in') GetStatusBits = Sig('in', ret=ret_return) StartPolling = Sig('in', 'in', ret=ret_success) PollingDuration = Sig('in', ret=ret_return) StopPolling = Sig('in') RequestSettings = Sig('in') ClearMessageQueue = Sig('in') RegisterMessageCallback = Sig('in', 'in') MessageQueueSize = Sig('in', ret=ret_return) GetNextMessage = Sig('in', 'in', 'in', 'in', ret=ret_success) WaitForMessage = Sig('in', 'in', 'in', 'in', ret=ret_success)
class Flipper(NiceObject): Open = Sig('in') Close = Sig('in') Identify = Sig('in') GetHardwareInfo = Sig('in', 'buf', 'len', 'out', 'out', 'buf', 'len', 'out', 'out', 'out') GetFirmwareVersion = Sig('in', ret=ret_return) GetSoftwareVersion = Sig('in', ret=ret_return) LoadSettings = Sig('in', ret=ret_success) PersistSettings = Sig('in', ret=ret_success) GetNumberPositions = Sig('in', ret=ret_return) Home = Sig('in') MoveToPosition = Sig('in', 'in') GetPosition = Sig('in', ret=ret_return) GetIOSettings = Sig('in', 'out') GetTransitTime = Sig('in', ret=ret_return) SetTransitTime = Sig('in', 'in') RequestStatus = Sig('in') GetStatusBits = Sig('in', ret=ret_return) StartPolling = Sig('in', 'in', ret=ret_success) PollingDuration = Sig('in', ret=ret_return) StopPolling = Sig('in') RequestSettings = Sig('in') ClearMessageQueue = Sig('in') RegisterMessageCallback = Sig('in', 'in') MessageQueueSize = Sig('in', ret=ret_return) GetNextMessage = Sig('in', 'in', 'in', 'in', ret=ret_success) WaitForMessage = Sig('in', 'in', 'in', 'in', ret=ret_success)
class Camera(NiceObject): CloseCamera = Sig('in') GetSizes = Sig('in', 'out', 'out', 'out', 'out') SetROI = Sig('in', 'in', 'in', 'in', 'in') GetROI = Sig('in', 'out', 'out', 'out', 'out') GetInfoString = Sig('in', 'in', 'buf', 'len') GetCameraName = Sig('in', 'buf', 'len', buflen=40) GetRecordingState = Sig('in', 'out') SetRecordingState = Sig('in', 'in') SetDelayExposureTime = Sig('in', 'in', 'in', 'in', 'in') GetDelayExposureTime = Sig('in', 'out', 'out', 'out', 'out') SetFrameRate = Sig('in', 'out', 'in', 'inout', 'inout') GetFrameRate = Sig('in', 'out', 'out', 'out') ArmCamera = Sig('in') SetBinning = Sig('in', 'in', 'in') GetBinning = Sig('in', 'out', 'out') GetActiveLookupTable = Sig('in', 'out', 'out') SetActiveLookupTable = Sig('in', 'inout', 'inout') GetPixelRate = Sig('in', 'out') # GetTransferParameter = ('in', 'buf', 'len') GetTriggerMode = Sig('in', 'out') SetTriggerMode = Sig('in', 'in') ForceTrigger = Sig('in', 'out') AllocateBuffer = Sig('in', 'inout', 'in', 'inout', 'inout') CamLinkSetImageParameters = Sig('in', 'in', 'in') FreeBuffer = Sig('in', 'in') CancelImages = Sig('in') AddBufferEx = Sig('in', 'in', 'in', 'in', 'in', 'in', 'in') GetBufferStatus = Sig('in', 'in', 'out', 'out') GetLookupTableInfo = Sig('in', 'in', 'out', 'buf', 'len', 'out', 'out', 'out', 'out', buflen=20) GetCameraDescription = Sig('in', 'out') EnableSoftROI = Sig('in', 'in', 'in', 'in') GetHWIOSignalDescriptor = Sig('in', 'in', 'out') GetHWIOSignal = Sig('in', 'in', 'out') SetHWIOSignal = Sig('in', 'in', 'in') GetIRSensitivity = Sig('in', 'out') SetIRSensitivity = Sig('in', 'in') SetTransferParametersAuto = Sig('in', 'ignore', 'ignore') def GetTransferParameter(self): hcam, = self._handles params_p = ffi.new('PCO_SC2_CL_TRANSFER_PARAM *') void_p = ffi.cast('void *', params_p) ret = lib.PCO_GetTransferParameter(hcam, void_p, ffi.sizeof(params_p[0])) pco_errcheck.__func__(ret) return params_p[0]
class NicePicamLib(NiceLib): """Wrapper for Picam.dll""" _info = lib _buflen = 256 _prefix = 'Picam_' # _ret = 'error' _ret_ = ret_error GetVersion = Sig('out', 'out', 'out', 'out') IsLibraryInitialized = Sig('out', ret=ret_ignore) InitializeLibrary = Sig() UninitializeLibrary = Sig() DestroyString = Sig('in') # GetEnumerationString = Sig('in', 'in', 'bufout', ret=ret_ignore) GetEnumerationString = Sig('in', 'in', 'bufout', ret=ret_enum_string_error) DestroyCameraIDs = Sig('in') GetAvailableCameraIDs = Sig('out', 'out') GetUnavailableCameraIDs = Sig('out', 'out') IsCameraIDConnected = Sig('in', 'out') IsCameraIDOpenElsewhere = Sig('in', 'out') DestroyHandles = Sig('in') OpenFirstCamera = Sig('out') OpenCamera = Sig('in', 'out') # DestroyFirmwareDetails = Sig(firmware_array) DestroyFirmwareDetails = Sig('in') # DestroyModels = Sig(model_array) DestroyModels = Sig('in') GetAvailableDemoCameraModels = Sig('out', 'out') ConnectDemoCamera = Sig('in', 'in', 'out') DisconnectDemoCamera = Sig('in') GetOpenCameras = Sig('out', 'out') IsDemoCamera = Sig('in', 'out') # GetFirmwareDetails = Sig(id, firmware_array, firmware_count) GetFirmwareDetails = Sig('in', 'out', 'out') # DestroyRois = Sig(rois) DestroyRois = Sig('in') # DestroyModulations = Sig(modulations) DestroyModulations = Sig('in') # DestroyPulses = Sig(pulses) DestroyPulses = Sig('in') # DestroyParameters = Sig(parameter_array) DestroyParameters = Sig('in') # DestroyCollectionConstraints = Sig(constraint_array) DestroyCollectionConstraints = Sig('in') # DestroyRangeConstraints = Sig(constraint_array) DestroyRangeConstraints = Sig('in') # DestroyRoisConstraints = Sig(constraint_array) DestroyRoisConstraints = Sig('in') # DestroyModulationsConstraints = Sig(constraint_array) DestroyModulationsConstraints = Sig('in') # DestroyPulseConstraints = Sig(constraint_array) DestroyPulseConstraints = Sig('in') class NicePicam(NiceObject): CloseCamera = Sig('in') IsCameraConnected = Sig('in', 'out') GetCameraID = Sig('in', 'out') #GetParameterIntegerValue = Sig(camera, parameter, value) GetParameterIntegerValue = Sig('in', 'in', 'out') #SetParameterIntegerValue = Sig(camera, parameter, value) SetParameterIntegerValue = Sig('in', 'in', 'in') #CanSetParameterIntegerValue = Sig(camera, parameter, value, settable) CanSetParameterIntegerValue = Sig('in', 'in', 'in', 'out') #GetParameterLargeIntegerValue = Sig(camera, parameter, value) GetParameterLargeIntegerValue = Sig('in', 'in', 'out') #SetParameterLargeIntegerValue = Sig(camera, parameter, value) SetParameterLargeIntegerValue = Sig('in', 'in', 'in') #CanSetParameterLargeIntegerValue = Sig(camera, parameter, value, settable) CanSetParameterLargeIntegerValue = Sig('in', 'in', 'in', 'out') #GetParameterFloatingPointValue = Sig(camera, parameter, value) GetParameterFloatingPointValue = Sig('in', 'in', 'out') #SetParameterFloatingPointValue = Sig(camera, parameter, value) SetParameterFloatingPointValue = Sig('in', 'in', 'in') #CanSetParameterFloatingPointValue = Sig(camera, parameter, value, settable) CanSetParameterFloatingPointValue = Sig('in', 'in', 'in', 'out') #GetParameterRoisValue = Sig(camera, parameter, value) GetParameterRoisValue = Sig('in', 'in', 'out') #SetParameterRoisValue = Sig(camera, parameter, value) SetParameterRoisValue = Sig('in', 'in', 'in') #CanSetParameterRoisValue = Sig(camera, parameter, value, settable) CanSetParameterRoisValue = Sig('in', 'in', 'in', 'out') #GetParameterPulseValue = Sig(camera, parameter, value) GetParameterPulseValue = Sig('in', 'in', 'out') #SetParameterPulseValue = Sig(camera, parameter, value) SetParameterPulseValue = Sig('in', 'in', 'in') #CanSetParameterPulseValue = Sig(camera, parameter, value, settable) CanSetParameterPulseValue = Sig('in', 'in', 'in', 'out') #GetParameterModulationsValue = Sig(camera, parameter, value) GetParameterModulationsValue = Sig('in', 'in', 'out') #SetParameterModulationsValue = Sig(camera, parameter, value) SetParameterModulationsValue = Sig('in', 'in', 'in') #CanSetParameterModulationsValue = Sig(camera, parameter, value, settable) CanSetParameterModulationsValue = Sig('in', 'in', 'in', 'out') #GetParameterIntegerDefaultValue = Sig(camera, parameter, value) GetParameterIntegerDefaultValue = Sig('in', 'in', 'out') #GetParameterLargeIntegerDefaultValue = Sig(camera, parameter, value) GetParameterLargeIntegerDefaultValue = Sig('in', 'in', 'out') #GetParameterFloatingPointDefaultValue = Sig(camera, parameter, value) GetParameterFloatingPointDefaultValue = Sig('in', 'in', 'out') #GetParameterRoisDefaultValue = Sig(camera, parameter, value) GetParameterRoisDefaultValue = Sig('in', 'in', 'out') #GetParameterPulseDefaultValue = Sig(camera, parameter, value) GetParameterPulseDefaultValue = Sig('in', 'in', 'out') #GetParameterModulationsDefaultValue = Sig(camera, parameter, value) GetParameterModulationsDefaultValue = Sig('in', 'in', 'out') #CanSetParameterOnline = Sig(camera, parameter, onlineable) CanSetParameterOnline = Sig('in', 'in', 'out') #SetParameterIntegerValueOnline = Sig(camera, parameter, value) SetParameterIntegerValueOnline = Sig('in', 'in', 'in') #SetParameterFloatingPointValueOnline = Sig(camera, parameter, value) SetParameterFloatingPointValueOnline = Sig('in', 'in', 'in') #SetParameterPulseValueOnline = Sig(camera, parameter, value) SetParameterPulseValueOnline = Sig('in', 'in', 'in') #CanReadParameter = Sig(camera, parameter, readable) CanReadParameter = Sig('in', 'in', 'out') #ReadParameterIntegerValue = Sig(camera, parameter, value) ReadParameterIntegerValue = Sig('in', 'in', 'out') #ReadParameterFloatingPointValue = Sig(camera, parameter, value) ReadParameterFloatingPointValue = Sig('in', 'in', 'out') #GetParameters = Sig(camera, parameter_array, parameter_count) GetParameters = Sig('in', 'out', 'out') #DoesParameterExist = Sig(camera, parameter, exists) DoesParameterExist = Sig('in', 'in', 'out') #IsParameterRelevant = Sig(camera, parameter, relevant) IsParameterRelevant = Sig('in', 'in', 'out') #GetParameterValueType = Sig(camera, parameter, type) GetParameterValueType = Sig('in', 'in', 'out') #GetParameterEnumeratedType = Sig(camera, parameter, type) GetParameterEnumeratedType = Sig('in', 'in', 'out') #GetParameterValueAccess = Sig(camera, parameter, access) GetParameterValueAccess = Sig('in', 'in', 'out') #GetParameterConstraintType = Sig(camera, parameter, type) GetParameterConstraintType = Sig('in', 'in', 'out') #GetParameterCollectionConstraint = Sig(camera, parameter, category, constraint) GetParameterCollectionConstraint = Sig('in', 'in', 'in', 'out') #GetParameterRangeConstraint = Sig(camera, parameter, category, constraint) GetParameterRangeConstraint = Sig('in', 'in', 'in', 'out') #GetParameterRoisConstraint = Sig(camera, parameter, category, constraint) GetParameterRoisConstraint = Sig('in', 'in', 'in', 'out') #GetParameterPulseConstraint = Sig(camera, parameter, category, constraint) GetParameterPulseConstraint = Sig('in', 'in', 'in', 'out') #GetParameterModulationsConstraint = Sig(camera, parameter, category, constraint) GetParameterModulationsConstraint = Sig('in', 'in', 'in', 'out') #AreParametersCommitted = Sig(camera, committed) AreParametersCommitted = Sig('in', 'out') #CommitParameters = Sig(camera, failed_parameter_array, failed_parameter_count) CommitParameters = Sig('in', 'out', 'out') #Acquire = Sig(camera, readout_count, readout_time_out, available, errors) Acquire = Sig('in', 'in', 'in', 'out', 'out') #StartAcquisition = Sig(camera) StartAcquisition = Sig('in') #StopAcquisition = Sig(camera) StopAcquisition = Sig('in') #IsAcquisitionRunning = Sig(camera, running) IsAcquisitionRunning = Sig('in', 'out') #WaitForAcquisitionUpdate = Sig(camera, readout_time_out, available, status) WaitForAcquisitionUpdate = Sig('in', 'in', 'out', 'out')
class NicePCO(NiceLib): _ffi_ = ffi _ffilib_ = lib _prefix_ = 'PCO_' _ret_ = pco_errcheck def _struct_maker_(*args): """PCO makes you fill in the wSize field of every struct""" struct_p = ffi.new(*args) struct_p[0].wSize = ffi.sizeof(struct_p[0]) for name, field in ffi.typeof(struct_p[0]).fields: # Only goes one level deep for now if field.type.kind == 'struct': s = getattr(struct_p[0], name) s.wSize = ffi.sizeof(s) return struct_p OpenCamera = Sig('inout', 'ignore') OpenCameraEx = Sig('inout', 'inout') class Camera(NiceObject): CloseCamera = Sig('in') GetSizes = Sig('in', 'out', 'out', 'out', 'out') SetROI = Sig('in', 'in', 'in', 'in', 'in') GetROI = Sig('in', 'out', 'out', 'out', 'out') GetInfoString = Sig('in', 'in', 'buf', 'len') GetCameraName = Sig('in', 'buf', 'len', buflen=40) GetRecordingState = Sig('in', 'out') SetRecordingState = Sig('in', 'in') SetDelayExposureTime = Sig('in', 'in', 'in', 'in', 'in') GetDelayExposureTime = Sig('in', 'out', 'out', 'out', 'out') SetFrameRate = Sig('in', 'out', 'in', 'inout', 'inout') GetFrameRate = Sig('in', 'out', 'out', 'out') ArmCamera = Sig('in') SetBinning = Sig('in', 'in', 'in') GetBinning = Sig('in', 'out', 'out') GetActiveLookupTable = Sig('in', 'out', 'out') SetActiveLookupTable = Sig('in', 'inout', 'inout') GetPixelRate = Sig('in', 'out') # GetTransferParameter = ('in', 'buf', 'len') GetTriggerMode = Sig('in', 'out') SetTriggerMode = Sig('in', 'in') ForceTrigger = Sig('in', 'out') AllocateBuffer = Sig('in', 'inout', 'in', 'inout', 'inout') CamLinkSetImageParameters = Sig('in', 'in', 'in') FreeBuffer = Sig('in', 'in') CancelImages = Sig('in') AddBufferEx = Sig('in', 'in', 'in', 'in', 'in', 'in', 'in') GetBufferStatus = Sig('in', 'in', 'out', 'out') GetLookupTableInfo = Sig('in', 'in', 'out', 'buf', 'len', 'out', 'out', 'out', 'out', buflen=20) GetCameraDescription = Sig('in', 'out') EnableSoftROI = Sig('in', 'in', 'in', 'in') GetHWIOSignalDescriptor = Sig('in', 'in', 'out') GetHWIOSignal = Sig('in', 'in', 'out') SetHWIOSignal = Sig('in', 'in', 'in') GetIRSensitivity = Sig('in', 'out') SetIRSensitivity = Sig('in', 'in') SetTransferParametersAuto = Sig('in', 'ignore', 'ignore') def GetTransferParameter(self): hcam, = self._handles params_p = ffi.new('PCO_SC2_CL_TRANSFER_PARAM *') void_p = ffi.cast('void *', params_p) ret = lib.PCO_GetTransferParameter(hcam, void_p, ffi.sizeof(params_p[0])) pco_errcheck.__func__(ret) return params_p[0]
@RetHandler(num_retvals=0) def ret_errcheck(ret): """Check error code, ignoring void functions""" if ret is not None and ret != 0: raise KinesisError(ret) @RetHandler(num_retvals=0) def ret_success(ret, funcname): if not ret: raise KinesisError(msg="Call to function '{}' failed".format(funcname)) # Global list of function Sigs, with prefixes stripped all_sigs = { 'BuildDeviceList': Sig(), 'CanHome': Sig('in', ret=ret_return), #'CanMoveWithoutHomingFirst': Sig(...), #'ChannelEnable': Sig(...), #'CheckConnection': Sig(...), 'ClearMessageQueue': Sig('in'), 'Close': Sig('in'), #'Disable': Sig(...), #'DisableChannel': Sig(...), #'DisableOutput': Sig(...), #'Disconnect': Sig(...), #'Enable': Sig(...), #'EnableChannel': Sig(...), #'EnableLastMsgTimer': Sig(...), #'EnableMaxCurrentAdjust': Sig(...), #'EnableOutput': Sig(...),
class NiceCCS(NiceObject): close = Sig('in') setIntegrationTime = Sig('in', 'in') getIntegrationTime = Sig('in', 'out') startScan = Sig('in') startScanCont = Sig('in') startScanExtTrg = Sig('in') startScanContExtTrg = Sig('in') getDeviceStatus = Sig('in', 'out') getScanData = Sig('in', 'arr[{}]'.format(NUM_RAW_PIXELS)) getRawScanData = Sig('in', 'out') setWavelengthData = Sig('in', 'in', 'in', 'in') getWavelengthData = Sig('in', 'in', 'arr[{}]'.format(NUM_RAW_PIXELS), 'out', 'out') getUserCalibrationPoints = Sig('in', 'out', 'out', 'out') setAmplitudeData = Sig('in', 'in', 'in', 'in', 'in') getAmplitudeData = Sig('in', 'arr[{}]'.format(NUM_RAW_PIXELS), 'in', 'in', 'in') identificationQuery = Sig('in', 'buf[256]', 'buf[256]', 'buf[256]', 'buf[256]', 'buf[256]') revision_query = Sig('in', 'out', 'out') reset = Sig('in') self_test = Sig('in', 'out', 'out') setUserText = Sig('in', 'in') getUserText = Sig('in', 'out') setAttribute = Sig('in', 'in', 'in') getAttribute = Sig('in', 'in', 'out') error_query = Sig('in', 'out', 'out') error_message = Sig('in', 'in', 'buf[512]', ret=ret_ignore)
class NicePCO(NiceLib): _ffi_ = ffi _ffilib_ = lib _prefix_ = 'PCO_' _ret_ = pco_error_check def _struct_maker_(*args): """PCO makes you fill in the wSize field of many structs""" struct_p = ffi.new(*args) # Only set wSize if the object has that property if hasattr(struct_p[0], 'wSize'): struct_p[0].wSize = ffi.sizeof(struct_p[0]) for name, field in ffi.typeof(struct_p[0]).fields: # Only goes one level deep for now if field.type.kind == 'struct': s = getattr(struct_p[0], name) # Only set wSize if the object has that property if hasattr(s, 'wSize'): s.wSize = ffi.sizeof(s) return struct_p OpenCamera = Sig('inout', 'ignore') OpenCameraEx = Sig('inout', 'inout') class Camera(NiceObject): # Note: Not all functions are wrapped yet. Additionally, not all PCO # cameras support all pco.sdk functions. Some functions may be manually # wrapped using cffi directly if NiceLib can't handle the function # directly, e.g. GetTransferParameter() below. # Functions from pco.sdk manual section 2.1 "Camera Access" CloseCamera = Sig('in') # Functions from pco.sdk manual section 2.2 "Camera Description" GetCameraDescription = Sig('in', 'out') # Functions from pco.sdk manual section 2.3 "General Camera Status" GetCameraType = Sig('in', 'out') GetInfoString = Sig('in', 'in', 'buf', 'len') GetCameraName = Sig('in', 'buf', 'len', buflen=40) GetFirmwareInfo = Sig('in', 'in', 'out') # Functions from pco.sdk manual section 2.4 "General Camera Control" ArmCamera = Sig('in') CamLinkSetImageParameters = Sig('in', 'in', 'in') ResetSettingsToDefault = Sig('in') # Functions from pco.sdk manual section 2.5 "Image Sensor" GetSizes = Sig('in', 'out', 'out', 'out', 'out') GetSensorFormat = Sig('in', 'out') SetSensorFormat = Sig('in', 'in') GetROI = Sig('in', 'out', 'out', 'out', 'out') SetROI = Sig('in', 'in', 'in', 'in', 'in') GetBinning = Sig('in', 'out', 'out') SetBinning = Sig('in', 'in', 'in') GetPixelRate = Sig('in', 'out') SetPixelRate = Sig('in', 'in') GetIRSensitivity = Sig('in', 'out') SetIRSensitivity = Sig('in', 'in') GetActiveLookupTable = Sig('in', 'out', 'out') SetActiveLookupTable = Sig('in', 'inout', 'inout') GetLookupTableInfo = Sig('in', 'in', 'out', 'buf', 'len', 'out', 'out', 'out', 'out', buflen=20) # Functions from pco.sdk manual section 2.6 "Timing Control" GetDelayExposureTime = Sig('in', 'out', 'out', 'out', 'out') SetDelayExposureTime = Sig('in', 'in', 'in', 'in', 'in') GetFrameRate = Sig('in', 'out', 'out', 'out') SetFrameRate = Sig('in', 'out', 'in', 'inout', 'inout') GetTriggerMode = Sig('in', 'out') SetTriggerMode = Sig('in', 'in') ForceTrigger = Sig('in', 'out') GetHWIOSignalDescriptor = Sig('in', 'in', 'out') GetHWIOSignal = Sig('in', 'in', 'out') SetHWIOSignal = Sig('in', 'in', 'in') GetTimestampMode = Sig('in', 'out') SetTimestampMode = Sig('in', 'in') # Functions from pco.sdk manual section 2.7 "Recording Control" GetRecordingState = Sig('in', 'out') SetRecordingState = Sig('in', 'in') GetStorageMode = Sig('in', 'out') SetStorageMode = Sig('in', 'in') GetRecorderSubmode = Sig('in', 'out') SetRecorderSubmode = Sig('in', 'in') # Functions from pco.sdk manual section 2.8 "Storage Control" GetActiveRamSegment = Sig('in', 'out') # Functions from pco.sdk manual section 2.9 "Image Information" GetSegmentStruct = Sig('in', 'out', 'out') GetNumberOfImagesInSegment = Sig('in', 'in', 'out', 'out') GetBitAlignment = Sig('in', 'out') SetBitAlignment = Sig('in', 'in') # Functions from pco.sdk manual section 2.10 "Buffer Management" AllocateBuffer = Sig('in', 'inout', 'in', 'inout', 'inout') FreeBuffer = Sig('in', 'in') GetBufferStatus = Sig('in', 'in', 'out', 'out') GetBuffer = Sig('in', 'in', 'out', 'out') # Functions from pco.sdk manual section 2.11 "Image Acquisition" GetImageEx = Sig('in', 'in', 'in', 'in', 'in', 'in', 'in', 'in') AddBufferEx = Sig('in', 'in', 'in', 'in', 'in', 'in', 'in') CancelImages = Sig('in') GetPendingBuffer = Sig('in', 'out') WaitforBuffer = Sig('in', 'in', 'in', 'in') EnableSoftROI = Sig('in', 'in', 'in', 'in') # Functions from pco.sdk manual section 2.12 "Driver Management" # GetTransferParameter = ('in', 'buf', 'len') def GetTransferParameter(self): # This function needs to be wrapped manually because the buffer # object passed to it is a void * and the type of the structure # that it points to depends on the camera's interface type (USB, # Firewire, etc.) camera_handle, = self._handles # Figure out type of interface, necessary to make correct type for # params_p. See PCO documentation on Transfer Parameter Structures # and PCO_GetCameraType's Interface Type Codes. interface_type_index = self.GetCameraType().wInterfaceType interface_params_dict = { 1: 'PCO_1394_TRANSFER_PARAM', # Firewire 2: 'PCO_SC2_CL_TRANSFER_PARAM', # Camera Link 3: 'PCO_USB_TRANSFER_PARAM', # USB 2.0 4: 'PCO_GIGE_TRANSFER_PARAM', # GigE 5: '', # Serial Interface, Not sure what to put here 6: 'PCO_USB_TRANSFER_PARAM', # USB 3.0 7: 'PCO_SC2_CL_TRANSFER_PARAM', # CLHS } # Construct input arguments struct_type = interface_params_dict[interface_type_index] params_p = ffi.new(struct_type + ' *') void_p = ffi.cast('void *', params_p) struct_size = ffi.sizeof(params_p[0]) # Finally call the library function and return the result return_code = lib.PCO_GetTransferParameter(camera_handle, void_p, struct_size) pco_error_check.__func__(return_code) # pylint: disable=no-member return params_p[0] # Functions from pco.sdk manual section 2.13 "Special Commands # PCO.Edge" SetTransferParametersAuto = Sig('in', 'ignore', 'ignore')
class Device(NiceObject): _prefix_ = 'ISC_' Open = Sig('in') Close = Sig('in', ret=ret_return) Identify = Sig('in', ret=ret_ignore) GetHardwareInfo = Sig('in', 'buf', 'len', 'out', 'out', 'buf', 'len', 'out', 'out', 'out') GetFirmwareVersion = Sig('in', ret=ret_return) GetSoftwareVersion = Sig('in', ret=ret_return) LoadSettings = Sig('in', ret=ret_success) PersistSettings = Sig('in', ret=ret_success) GetNumberPositions = Sig('in', ret=ret_return) CanHome = Sig('in', ret=ret_return) Home = Sig('in') NeedsHoming = Sig('in', ret=ret_return) MoveToPosition = Sig('in', 'in') GetPosition = Sig('in', ret=ret_return) GetPositionCounter = Sig('in', ret=ret_return) RequestStatus = Sig('in') RequestStatusBits = Sig('in') GetStatusBits = Sig('in', ret=ret_return) StartPolling = Sig('in', 'in', ret=ret_success) PollingDuration = Sig('in', ret=ret_return) StopPolling = Sig('in', ret=ret_ignore) RequestSettings = Sig('in') ClearMessageQueue = Sig('in', ret=ret_ignore) RegisterMessageCallback = Sig('in', 'in', ret=ret_ignore) MessageQueueSize = Sig('in', ret=ret_return) GetNextMessage = Sig('in', 'out', 'out', 'out', ret=ret_success) WaitForMessage = Sig('in', 'out', 'out', 'out', ret=ret_success) GetMotorParamsExt = Sig('in', 'out', 'out', 'out') SetJogStepSize = Sig('in', 'in') GetJogVelParams = Sig('in', 'out', 'out') GetBacklash = Sig('in', ret=ret_return) SetBacklash = Sig('in', 'in') GetLimitSwitchParams = Sig('in', 'out', 'out', 'out', 'out', 'out') GetLimitSwitchParamsBlock = Sig('in', 'out')
class TDC001(NiceObject): Open = Sig('in') Close = Sig('in', ret=ret_return) Identify = Sig('in', ret=ret_return) GetLEDswitches = Sig('in', ret=ret_return) SetLEDswitches = Sig('in', 'in') GetHardwareInfo = Sig('in', 'buf', 'len', 'out', 'out', 'buf', 'len', 'out', 'out', 'out') GetHardwareInfoBlock = Sig('in', 'out') GetHubBay = Sig('in', ret=ret_return) GetSoftwareVersion = Sig('in', ret=ret_return) LoadSettings = Sig('in', ret=ret_success) PersistSettings = Sig('in', ret=ret_success) DisableChannel = Sig('in') EnableChannel = Sig('in') GetNumberPositions = Sig('in', ret=ret_return) CanHome = Sig('in', ret=ret_success) NeedsHoming = Sig('in', ret=ret_return) Home = Sig('in') MoveToPosition = Sig('in', 'in') GetPosition = Sig('in', ret=ret_return) GetHomingVelocity = Sig('in', ret=ret_return) SetHomingVelocity = Sig('in', 'in') MoveRelative = Sig('in', 'in') GetJogMode = Sig('in', 'out', 'out') SetJogMode = Sig('in', 'in', 'in') SetJogStepSize = Sig('in', 'in') GetJogStepSize = Sig('in', ret=ret_return) GetJogVelParams = Sig('in', 'out', 'out') SetJogVelParams = Sig('in', 'in', 'in') MoveJog = Sig('in', 'in') SetVelParams = Sig('in', 'in', 'in') GetVelParams = Sig('in', 'out', 'out') MoveAtVelocity = Sig('in', 'in') SetDirection = Sig('in', 'in', ret=ret_return) StopImmediate = Sig('in') StopProfiled = Sig('in') GetBacklash = Sig('in', ret=ret_return) SetBacklash = Sig('in', 'in') GetPositionCounter = Sig('in', ret=ret_return) SetPositionCounter = Sig('in', 'in') GetEncoderCounter = Sig('in', ret=ret_return) SetEncoderCounter = Sig('in', 'in') GetLimitSwitchParams = Sig('in', 'out', 'out', 'out', 'out', 'out') SetLimitSwitchParams = Sig('in', 'in', 'in', 'in', 'in', 'in') GetSoftLimitMode = Sig('in', ret=ret_return) SetLimitsSoftwareApproachPolicy = Sig('in', 'in', ret=ret_return) GetButtonParams = Sig('in', 'out', 'out', 'out', 'out') SetButtonParams = Sig('in', 'in', 'in', 'in') SetPotentiometerParams = Sig('in', 'in', 'in', 'in') GetPotentiometerParams = Sig('in', 'in', 'out', 'out') GetVelParamsBlock = Sig('in', 'out') SetVelParamsBlock = Sig('in', 'in') SetMoveAbsolutePosition = Sig('in', 'in') GetMoveAbsolutePosition = Sig('in', ret=ret_return) MoveAbsolute = Sig('in') SetMoveRelativeDistance = Sig('in', 'in') GetMoveRelativeDistance = Sig('in', ret=ret_return) MoveRelativeDistance = Sig('in') GetHomingParamsBlock = Sig('in', 'out') SetHomingParamsBlock = Sig('in', 'in') GetJogParamsBlock = Sig('in', 'out') SetJogParamsBlock = Sig('in', 'in') GetButtonParamsBlock = Sig('in', 'out') SetButtonParamsBlock = Sig('in', 'in') GetPotentiometerParamsBlock = Sig('in', 'out') SetPotentiometerParamsBlock = Sig('in', 'in') GetLimitSwitchParamsBlock = Sig('in', 'out') SetLimitSwitchParamsBlock = Sig('in', 'in') GetDCPIDParams = Sig('in', 'out') SetDCPIDParams = Sig('in', 'in') SuspendMoveMessages = Sig('in') ResumeMoveMessages = Sig('in') RequestPosition = Sig('in') RequestStatusBits = Sig('in', ret=ret_return) GetStatusBits = Sig('in', ret=ret_return) StartPolling = Sig('in', 'in', ret=ret_success) PollingDuration = Sig('in', ret=ret_return) StopPolling = Sig('in', ret=ret_return) RequestSettings = Sig('in') GetStageAxisMinPos = Sig('in', ret=ret_return) GetStageAxisMaxPos = Sig('in', ret=ret_return) SetStageAxisLimits = Sig('in', 'in', 'in') SetMotorTravelMode = Sig('in', 'in') GetMotorTravelMode = Sig('in', ret=ret_return) SetMotorParams = Sig('in', 'in', 'in', 'in') GetMotorParams = Sig('in', 'out', 'out', 'out') SetMotorParamsExt = Sig('in', 'in', 'in', 'in') GetMotorParamsExt = Sig('in', 'out', 'out', 'out') ClearMessageQueue = Sig('in', ret=ret_return) RegisterMessageCallback = Sig('in', 'in', ret=ret_return) MessageQueueSize = Sig('in', ret=ret_return) GetNextMessage = Sig('in', 'out', 'out', 'out', ret=ret_success) WaitForMessage = Sig('in', 'in', 'in', 'in', ret=ret_success)
class NiceTDC001(NiceLib): """Mid-level wrapper for Thorlabs.MotionControl.TCube.DCServo.dll""" _ffi_ = ffi _ffilib_ = lib _prefix_ = ('CC_', 'TLI_') _buflen_ = 512 _ret_ = ret_errcheck BuildDeviceList = Sig() GetDeviceListSize = Sig(ret=ret_return) GetDeviceInfo = Sig('in', 'out', ret=ret_success) GetDeviceList = Sig('out') GetDeviceListByType = Sig('out', 'in') GetDeviceListByTypes = Sig('out', 'in', 'in') GetDeviceListExt = Sig('buf', 'len') GetDeviceListByTypeExt = Sig('buf', 'len', 'in') GetDeviceListByTypesExt = Sig('buf', 'len', 'in', 'in') class TDC001(NiceObject): Open = Sig('in') Close = Sig('in', ret=ret_return) Identify = Sig('in', ret=ret_return) GetLEDswitches = Sig('in', ret=ret_return) SetLEDswitches = Sig('in', 'in') GetHardwareInfo = Sig('in', 'buf', 'len', 'out', 'out', 'buf', 'len', 'out', 'out', 'out') GetHardwareInfoBlock = Sig('in', 'out') GetHubBay = Sig('in', ret=ret_return) GetSoftwareVersion = Sig('in', ret=ret_return) LoadSettings = Sig('in', ret=ret_success) PersistSettings = Sig('in', ret=ret_success) DisableChannel = Sig('in') EnableChannel = Sig('in') GetNumberPositions = Sig('in', ret=ret_return) CanHome = Sig('in', ret=ret_success) NeedsHoming = Sig('in', ret=ret_return) Home = Sig('in') MoveToPosition = Sig('in', 'in') GetPosition = Sig('in', ret=ret_return) GetHomingVelocity = Sig('in', ret=ret_return) SetHomingVelocity = Sig('in', 'in') MoveRelative = Sig('in', 'in') GetJogMode = Sig('in', 'out', 'out') SetJogMode = Sig('in', 'in', 'in') SetJogStepSize = Sig('in', 'in') GetJogStepSize = Sig('in', ret=ret_return) GetJogVelParams = Sig('in', 'out', 'out') SetJogVelParams = Sig('in', 'in', 'in') MoveJog = Sig('in', 'in') SetVelParams = Sig('in', 'in', 'in') GetVelParams = Sig('in', 'out', 'out') MoveAtVelocity = Sig('in', 'in') SetDirection = Sig('in', 'in', ret=ret_return) StopImmediate = Sig('in') StopProfiled = Sig('in') GetBacklash = Sig('in', ret=ret_return) SetBacklash = Sig('in', 'in') GetPositionCounter = Sig('in', ret=ret_return) SetPositionCounter = Sig('in', 'in') GetEncoderCounter = Sig('in', ret=ret_return) SetEncoderCounter = Sig('in', 'in') GetLimitSwitchParams = Sig('in', 'out', 'out', 'out', 'out', 'out') SetLimitSwitchParams = Sig('in', 'in', 'in', 'in', 'in', 'in') GetSoftLimitMode = Sig('in', ret=ret_return) SetLimitsSoftwareApproachPolicy = Sig('in', 'in', ret=ret_return) GetButtonParams = Sig('in', 'out', 'out', 'out', 'out') SetButtonParams = Sig('in', 'in', 'in', 'in') SetPotentiometerParams = Sig('in', 'in', 'in', 'in') GetPotentiometerParams = Sig('in', 'in', 'out', 'out') GetVelParamsBlock = Sig('in', 'out') SetVelParamsBlock = Sig('in', 'in') SetMoveAbsolutePosition = Sig('in', 'in') GetMoveAbsolutePosition = Sig('in', ret=ret_return) MoveAbsolute = Sig('in') SetMoveRelativeDistance = Sig('in', 'in') GetMoveRelativeDistance = Sig('in', ret=ret_return) MoveRelativeDistance = Sig('in') GetHomingParamsBlock = Sig('in', 'out') SetHomingParamsBlock = Sig('in', 'in') GetJogParamsBlock = Sig('in', 'out') SetJogParamsBlock = Sig('in', 'in') GetButtonParamsBlock = Sig('in', 'out') SetButtonParamsBlock = Sig('in', 'in') GetPotentiometerParamsBlock = Sig('in', 'out') SetPotentiometerParamsBlock = Sig('in', 'in') GetLimitSwitchParamsBlock = Sig('in', 'out') SetLimitSwitchParamsBlock = Sig('in', 'in') GetDCPIDParams = Sig('in', 'out') SetDCPIDParams = Sig('in', 'in') SuspendMoveMessages = Sig('in') ResumeMoveMessages = Sig('in') RequestPosition = Sig('in') RequestStatusBits = Sig('in', ret=ret_return) GetStatusBits = Sig('in', ret=ret_return) StartPolling = Sig('in', 'in', ret=ret_success) PollingDuration = Sig('in', ret=ret_return) StopPolling = Sig('in', ret=ret_return) RequestSettings = Sig('in') GetStageAxisMinPos = Sig('in', ret=ret_return) GetStageAxisMaxPos = Sig('in', ret=ret_return) SetStageAxisLimits = Sig('in', 'in', 'in') SetMotorTravelMode = Sig('in', 'in') GetMotorTravelMode = Sig('in', ret=ret_return) SetMotorParams = Sig('in', 'in', 'in', 'in') GetMotorParams = Sig('in', 'out', 'out', 'out') SetMotorParamsExt = Sig('in', 'in', 'in', 'in') GetMotorParamsExt = Sig('in', 'out', 'out', 'out') ClearMessageQueue = Sig('in', ret=ret_return) RegisterMessageCallback = Sig('in', 'in', ret=ret_return) MessageQueueSize = Sig('in', ret=ret_return) GetNextMessage = Sig('in', 'out', 'out', 'out', ret=ret_success) WaitForMessage = Sig('in', 'in', 'in', 'in', ret=ret_success)
class Camera(NiceObject): _init_ = 'InitCamera' _ret_ = ret_cam_errcheck AddToSequence = Sig('in', 'in', 'in') AllocImageMem = Sig('in', 'in', 'in', 'in', 'out', 'out') CaptureVideo = Sig('in', 'in', ret=cmd_ret_handler('IS_GET_LIVE')) ClearSequence = Sig('in') DisableEvent = Sig('in', 'in') EnableEvent = Sig('in', 'in') ExitCamera = Sig('in') ExitEvent = Sig('in', 'in') ExitImageQueue = Sig('in') FreeImageMem = Sig('in', 'in', 'in') GetActSeqBuf = Sig('in', 'out', 'out', 'out') GetError = Sig('in', 'out', 'bufout') GetImageMemPitch = Sig('in', 'out') GetSensorInfo = Sig('in', 'out') HasVideoStarted = Sig('in', 'out') InitEvent = Sig('in', 'in', 'in') InitImageQueue = Sig('in', 'in') ParameterSet = Sig('in', 'in', 'inout', 'in') ResetToDefault = Sig('in') SetAutoParameter = Sig('in', 'in', 'inout', 'inout') SetBinning = Sig('in', 'in', ret=cmd_ret_handler('IS_GET_*BINNING*')) SetCameraID = Sig('in', 'in', ret=cmd_ret_handler('IS_GET_CAMERA_ID')) SetColorMode = Sig('in', 'in', ret=cmd_ret_handler('IS_GET_COLOR_MODE')) SetDisplayMode = Sig('in', 'in', ret=cmd_ret_handler('IS_GET_DISPLAY_MODE')) SetExternalTrigger = Sig('in', 'in', ret=cmd_ret_handler('IS_GET_*TRIGGER*')) SetFrameRate = Sig('in', 'in', 'out') SetGainBoost = Sig('in', 'in', ret=cmd_ret_handler(('IS_GET_GAINBOOST', 'IS_GET_SUPPORTED_GAINBOOST'))) SetHWGainFactor = Sig('in', 'in', 'in', ret=ret_return) SetSubSampling = Sig('in', 'in', ret=cmd_ret_handler('IS_GET_*SUBSAMPLING*')) SetTriggerDelay = Sig('in', 'in', ret=cmd_ret_handler('IS_GET_*TRIGGER*')) StopLiveVideo = Sig('in', 'in') SetHardwareGain = Sig('in', 'in', 'in', 'in', 'in', ret=cmd_ret_handler( ('IS_GET_MASTER_GAIN', 'IS_GET_RED_GAIN', 'IS_GET_GREEN_GAIN', 'IS_GET_BLUE_GAIN', 'IS_GET_DEFAULT_MASTER', 'IS_GET_DEFAULT_RED', 'IS_GET_DEFAULT_GREEN', 'IS_GET_DEFAULT_BLUE'))) # Hand-wrapped methods # @Sig('in', 'in', 'inout', 'in') def AOI(self, command, param=None): """AOI(command, param=None)""" if command & lib.AOI_MULTI_GET_AOI: if command == lib.AOI_MULTI_GET_AOI: raise Error("command AOI_MULTI_GET_AOI must be or'd together with another flag") param_type = 'UINT[8]' getting = True elif command in AOI_GET_PARAM_TYPES: param_type = AOI_GET_PARAM_TYPES[command] getting = True elif command in AOI_SET_PARAM_TYPES: param_type = AOI_SET_PARAM_TYPES[command] getting = False else: raise Error("Unsupported command given") if getting and param is not None: raise ValueError("Cannot give a param value when using a GET command") elif not getting and param is None: raise ValueError("Must give a param value when using a SET command") param_type = ffi.typeof(param_type) deref = (param_type.kind == 'pointer') # Don't dereference arrays param_data = ffi.new(param_type, param) size = ffi.sizeof(ffi.typeof(param_data).item if deref else param_data) param_ptr = ffi.cast('void*', param_data) self._autofunc_AOI(command, param_ptr, size) if getting: return param_data[0] if deref else param_data @Sig('in', 'in', 'inout', 'in') def Exposure(self, command, param=None): if command in EXPOSURE_GET_PARAM_TYPES: param_type = EXPOSURE_GET_PARAM_TYPES[command] getting = True elif command in EXPOSURE_SET_PARAM_TYPES: param_type = EXPOSURE_SET_PARAM_TYPES[command] getting = False else: raise Error("Unsupported command given") if getting and param is not None: raise ValueError("Cannot give a param value when using a GET command") elif not getting and param is None: raise ValueError("Must give a param value when using a SET command") param_type = ffi.typeof(param_type) deref = (param_type.kind == 'pointer') # Don't dereference arrays param_data = ffi.new(param_type, param) size = ffi.sizeof(ffi.typeof(param_data).item if deref else param_data) param_ptr = ffi.cast('void*', param_data) self._autofunc_Exposure(command, param_ptr, size) if getting: return param_data[0] if deref else param_data @Sig('in', 'in', 'inout', 'in') def Gamma(self, command, param=None): if command in (lib.GAMMA_CMD_GET, lib.GAMMA_CMD_GET_DEFAULT): getting = True elif command == lib.GAMMA_CMD_SET: getting = False else: raise ValueError("Unsupported command given") if getting and param is not None: raise ValueError("Cannot give a param value when using a GET command") elif not getting and param is None: raise ValueError("Must give a param value when using a SET command") param_data = ffi.new('INT*', param) size = ffi.sizeof('INT') param_ptr = ffi.cast('void*', param_data) self._autofunc_Gamma(command, param_ptr, size) if getting: return param_data[0] @Sig('in', 'in', 'inout', 'in') def Blacklevel(self, command, param=None): if command in BLACKLEVEL_GET_PARAM_TYPES: param_type = BLACKLEVEL_GET_PARAM_TYPES[command] getting = True elif command in BLACKLEVEL_SET_PARAM_TYPES: param_type = BLACKLEVEL_SET_PARAM_TYPES[command] getting = False else: raise Error("Unsupported command given") if getting and param is not None: raise ValueError("Cannot give a param value when using a GET command") elif not getting and param is None: raise ValueError("Must give a param value when using a SET command") param_type = ffi.typeof(param_type) deref = (param_type.kind == 'pointer') # Don't dereference arrays param_data = ffi.new(param_type, param) size = ffi.sizeof(ffi.typeof(param_data).item if deref else param_data) param_ptr = ffi.cast('void*', param_data) self._autofunc_Blacklevel(command, param_ptr, size) if getting: return param_data[0] if deref else param_data @Sig('in', 'in', 'inout', 'in') def PixelClock(self, command, param=None): if command in PIXELCLOCK_GET_PARAM_TYPES: param_type = PIXELCLOCK_GET_PARAM_TYPES[command] getting = True elif command in PIXELCLOCK_SET_PARAM_TYPES: param_type = PIXELCLOCK_SET_PARAM_TYPES[command] getting = False else: raise Error("Unsupported command given") if getting and param is not None: raise ValueError("Cannot give a param value when using a GET command") elif not getting and param is None: raise ValueError("Must give a param value when using a SET command") param_type = ffi.typeof(param_type) deref = (param_type.kind == 'pointer') # Don't dereference arrays param_data = ffi.new(param_type, param) size = ffi.sizeof(ffi.typeof(param_data).item if deref else param_data) param_ptr = ffi.cast('void*', param_data) self._autofunc_PixelClock(command, param_ptr, size) if getting: return param_data[0] if deref else param_data
class NicePicam(NiceObject): CloseCamera = Sig('in') IsCameraConnected = Sig('in', 'out') GetCameraID = Sig('in', 'out') #GetParameterIntegerValue = Sig(camera, parameter, value) GetParameterIntegerValue = Sig('in', 'in', 'out') #SetParameterIntegerValue = Sig(camera, parameter, value) SetParameterIntegerValue = Sig('in', 'in', 'in') #CanSetParameterIntegerValue = Sig(camera, parameter, value, settable) CanSetParameterIntegerValue = Sig('in', 'in', 'in', 'out') #GetParameterLargeIntegerValue = Sig(camera, parameter, value) GetParameterLargeIntegerValue = Sig('in', 'in', 'out') #SetParameterLargeIntegerValue = Sig(camera, parameter, value) SetParameterLargeIntegerValue = Sig('in', 'in', 'in') #CanSetParameterLargeIntegerValue = Sig(camera, parameter, value, settable) CanSetParameterLargeIntegerValue = Sig('in', 'in', 'in', 'out') #GetParameterFloatingPointValue = Sig(camera, parameter, value) GetParameterFloatingPointValue = Sig('in', 'in', 'out') #SetParameterFloatingPointValue = Sig(camera, parameter, value) SetParameterFloatingPointValue = Sig('in', 'in', 'in') #CanSetParameterFloatingPointValue = Sig(camera, parameter, value, settable) CanSetParameterFloatingPointValue = Sig('in', 'in', 'in', 'out') #GetParameterRoisValue = Sig(camera, parameter, value) GetParameterRoisValue = Sig('in', 'in', 'out') #SetParameterRoisValue = Sig(camera, parameter, value) SetParameterRoisValue = Sig('in', 'in', 'in') #CanSetParameterRoisValue = Sig(camera, parameter, value, settable) CanSetParameterRoisValue = Sig('in', 'in', 'in', 'out') #GetParameterPulseValue = Sig(camera, parameter, value) GetParameterPulseValue = Sig('in', 'in', 'out') #SetParameterPulseValue = Sig(camera, parameter, value) SetParameterPulseValue = Sig('in', 'in', 'in') #CanSetParameterPulseValue = Sig(camera, parameter, value, settable) CanSetParameterPulseValue = Sig('in', 'in', 'in', 'out') #GetParameterModulationsValue = Sig(camera, parameter, value) GetParameterModulationsValue = Sig('in', 'in', 'out') #SetParameterModulationsValue = Sig(camera, parameter, value) SetParameterModulationsValue = Sig('in', 'in', 'in') #CanSetParameterModulationsValue = Sig(camera, parameter, value, settable) CanSetParameterModulationsValue = Sig('in', 'in', 'in', 'out') #GetParameterIntegerDefaultValue = Sig(camera, parameter, value) GetParameterIntegerDefaultValue = Sig('in', 'in', 'out') #GetParameterLargeIntegerDefaultValue = Sig(camera, parameter, value) GetParameterLargeIntegerDefaultValue = Sig('in', 'in', 'out') #GetParameterFloatingPointDefaultValue = Sig(camera, parameter, value) GetParameterFloatingPointDefaultValue = Sig('in', 'in', 'out') #GetParameterRoisDefaultValue = Sig(camera, parameter, value) GetParameterRoisDefaultValue = Sig('in', 'in', 'out') #GetParameterPulseDefaultValue = Sig(camera, parameter, value) GetParameterPulseDefaultValue = Sig('in', 'in', 'out') #GetParameterModulationsDefaultValue = Sig(camera, parameter, value) GetParameterModulationsDefaultValue = Sig('in', 'in', 'out') #CanSetParameterOnline = Sig(camera, parameter, onlineable) CanSetParameterOnline = Sig('in', 'in', 'out') #SetParameterIntegerValueOnline = Sig(camera, parameter, value) SetParameterIntegerValueOnline = Sig('in', 'in', 'in') #SetParameterFloatingPointValueOnline = Sig(camera, parameter, value) SetParameterFloatingPointValueOnline = Sig('in', 'in', 'in') #SetParameterPulseValueOnline = Sig(camera, parameter, value) SetParameterPulseValueOnline = Sig('in', 'in', 'in') #CanReadParameter = Sig(camera, parameter, readable) CanReadParameter = Sig('in', 'in', 'out') #ReadParameterIntegerValue = Sig(camera, parameter, value) ReadParameterIntegerValue = Sig('in', 'in', 'out') #ReadParameterFloatingPointValue = Sig(camera, parameter, value) ReadParameterFloatingPointValue = Sig('in', 'in', 'out') #GetParameters = Sig(camera, parameter_array, parameter_count) GetParameters = Sig('in', 'out', 'out') #DoesParameterExist = Sig(camera, parameter, exists) DoesParameterExist = Sig('in', 'in', 'out') #IsParameterRelevant = Sig(camera, parameter, relevant) IsParameterRelevant = Sig('in', 'in', 'out') #GetParameterValueType = Sig(camera, parameter, type) GetParameterValueType = Sig('in', 'in', 'out') #GetParameterEnumeratedType = Sig(camera, parameter, type) GetParameterEnumeratedType = Sig('in', 'in', 'out') #GetParameterValueAccess = Sig(camera, parameter, access) GetParameterValueAccess = Sig('in', 'in', 'out') #GetParameterConstraintType = Sig(camera, parameter, type) GetParameterConstraintType = Sig('in', 'in', 'out') #GetParameterCollectionConstraint = Sig(camera, parameter, category, constraint) GetParameterCollectionConstraint = Sig('in', 'in', 'in', 'out') #GetParameterRangeConstraint = Sig(camera, parameter, category, constraint) GetParameterRangeConstraint = Sig('in', 'in', 'in', 'out') #GetParameterRoisConstraint = Sig(camera, parameter, category, constraint) GetParameterRoisConstraint = Sig('in', 'in', 'in', 'out') #GetParameterPulseConstraint = Sig(camera, parameter, category, constraint) GetParameterPulseConstraint = Sig('in', 'in', 'in', 'out') #GetParameterModulationsConstraint = Sig(camera, parameter, category, constraint) GetParameterModulationsConstraint = Sig('in', 'in', 'in', 'out') #AreParametersCommitted = Sig(camera, committed) AreParametersCommitted = Sig('in', 'out') #CommitParameters = Sig(camera, failed_parameter_array, failed_parameter_count) CommitParameters = Sig('in', 'out', 'out') #Acquire = Sig(camera, readout_count, readout_time_out, available, errors) Acquire = Sig('in', 'in', 'in', 'out', 'out') #StartAcquisition = Sig(camera) StartAcquisition = Sig('in') #StopAcquisition = Sig(camera) StopAcquisition = Sig('in') #IsAcquisitionRunning = Sig(camera, running) IsAcquisitionRunning = Sig('in', 'out') #WaitForAcquisitionUpdate = Sig(camera, readout_time_out, available, status) WaitForAcquisitionUpdate = Sig('in', 'in', 'out', 'out')