def open_usb_device(dev_id): """ Open exclusive access to the device connected to USB channel dev_id :param dev_id: the SEPIA device number, ordered from 0 :type dev_id: int :returns: the product model and serial number """ check_channel(dev_id, "open_device") product_model = string_buffer() serial_number = string_buffer() dll.SEPIA2_USB_OpenDevice(dev_id, product_model, serial_number) return product_model, serial_number
def get_dll_version(): """ String representation of the current .dll version. :returns: .dll version """ str_buff = string_buffer() dll.SEPIA2_LIB_GetVersion(str_buff) return str_buff
def get_dll_version(): """ String representation of the current .dll version. :returns: .dll version """ return_string = string_buffer() dll.SEPIA2_LIB_GetVersion( return_string ) return return_string.value
def get_state_descriptor(dev_id): """ Get a description message of the device connected to USB channel dev_id :param dev_id: the SEPIA device number, ordered from 0 :type dev_id: int :returns: concatenated string descriptors of the USB device """ check_channel(dev_id, "get_state_descriptor") desc = string_buffer() dll.SEPIA2_USB_GetStrDescriptor(dev_id, desc) return desc
def get_fwr_version(dev_id): """ Return the current firmware version - the laser head must be online :param dev_id: the SEPIA device number, ordered from 0 :type dev_id: int :returns: current version :type current version: string """ vers = string_buffer() dll.SEPIA2_FWR_GetVersion(dev_id, vers) return vers
def decode_module_type(module_type): """ Decode the module type into human-readable string :param module_type: module type :type module_type: int :returns: module :type module: string """ buff = string_buffer() dll.SEPIA2_COM_DecodeModuleType(module_type, buff) return buff
def decode_freq_trig_mode(freq_mode): """ Translate the frequency mode to a string for any SLM module :param freq_mode: the frequency mode - 0 (80MHz), 1 (40MHz), 2 (20MHz), 3 (10MHz), 4 (5MHz), 5 (2.5MHz), 6 (external pulse, rising edge), 7 (external pulse, falling edge) :type freq_mode: int :returns: mode_string :type mode_string: string :raises: :class:`.SepiaLogicError` if the frequency mode is invalid, i.e. not between 0 and 7 """ if not freq_mode in xrange(8): raise SepiaLogicError("Cannot decode the frequency mode - must be an integer between 0 and 7 inclusive") return_string = string_buffer() dll.SEPIA2_SLM_DecodeFreqTrigMode(freq_mode, return_string ) return return_string.value
def decode_head_type(head_type_code): """ Returns the head_type string at list position `head_type_code` for a given SLM module :param head_type_code: must be between 0 and 3 inclusive :type head_type_code: int :returns: head_type :type head_type: string :raises: :class:`.SepiaLogicError` if the head_type_code is invalid, i.e. not between 0 and 3 """ if not head_type_code in xrange(4): raise SepiaLogicError("Cannot decode head type code - must be between 0 and 3") return_string = string_buffer() dll.SEPIA2_SLM_DecodeHeadType(head_type_code, return_string ) return return_string.value
def decode_head_type(head_type_code): """ Returns the head_type string at list position `head_type_code` for a given SLM module :param head_type_code: must be between 0 and 3 inclusive :type head_type_code: int :returns: head_type :type head_type: string :raises: :class:`.SepiaLogicError` if the head_type_code is invalid, i.e. not between 0 and 3 """ if not head_type_code in xrange(4): raise SepiaLogicError( "Cannot decode head type code - must be between 0 and 3") head_type = string_buffer() dll.SEPIA2_SLM_DecodeHeadType(head_type_code, head_type) return head_type
def decode_freq_trig_mode(freq_mode): """ Translate the frequency mode to a string for any SLM module :param freq_mode: the frequency mode - 0 (80MHz), 1 (40MHz), 2 (20MHz), 3 (10MHz), 4 (5MHz), 5 (2.5MHz), 6 (external pulse, rising edge), 7 (external pulse, falling edge) :type freq_mode: int :returns: mode_string :type mode_string: string :raises: :class:`.SepiaLogicError` if the frequency mode is invalid, i.e. not between 0 and 7 """ if not freq_mode in xrange(8): raise SepiaLogicError( "Cannot decode the frequency mode - must be an integer between 0 and 7 inclusive" ) buff = string_buffer() dll.SEPIA2_SLM_DecodeFreqTrigMode(freq_mode, buff) return buff
def get_serial_number(dev_id, slot_id, iGetPrimary): """ Get the serial number of a given module :param dev_id: the SEPIA device number, ordered from 0 :type dev_id: int :param slot_id: the slot number, between 000 and 989 :type slot_id: int :param iGetPrimary: 1/0 for primary/secondary, i.e. laser driver/laser head :type iGetPrimary: bool :returns: serial number :type serial number: string """ buff = string_buffer() dll.SEPIA2_COM_GetSerialNumber(dev_id, slot_id, iGetPrimary, buff) return buff