Colorhug.DeviceQueue¶
| Subclasses: | None | 
|---|
Methods¶
| Inherited: | GObject.Object (37) | 
|---|---|
| Structs: | GObject.ObjectClass (5) | 
| class | new() | 
| add(device, cmd, buffer_in, buffer_in_len, buffer_out, buffer_out_len) | |
| boot_flash(device) | |
| clear_calibration(device, calibration_index) | |
| erase_flash(device, address) | |
| get_adc_vref_neg(device, vref) | |
| get_adc_vref_pos(device, vref) | |
| get_calibration(device, calibration_index, calibration, types, description) | |
| get_calibration_map(device, calibration_map) | |
| get_ccd_calibration(device, indexes) | |
| get_color_select(device, color_select) | |
| get_dac_value(device, dac_value) | |
| get_dark_offsets(device, value) | |
| get_firmware_ver(device, major, minor, micro) | |
| get_hardware_version(device, hw_version) | |
| get_integral_time(device, integral_time) | |
| get_leds(device, leds) | |
| get_measure_mode(device, measure_mode) | |
| get_multiplier(device, multiplier) | |
| get_owner_email(device, email) | |
| get_owner_name(device, name) | |
| get_pcb_errata(device, pcb_errata) | |
| get_post_scale(device, post_scale) | |
| get_pre_scale(device, pre_scale) | |
| get_remote_hash(device, remote_hash) | |
| get_serial_number(device, serial_number) | |
| get_temperature(device, temperature) | |
| process(process_flags, cancellable) | |
| process_async(process_flags, cancellable, callback, *user_data) | |
| process_finish(res) | |
| read_firmware(device, data) | |
| read_flash(device, address, data) | |
| read_sram(device, address, data) | |
| reset(device) | |
| self_test(device) | |
| set_calibration(device, calibration_index, calibration, types, description) | |
| set_calibration_ccmx(device, calibration_index, ccmx) | |
| set_calibration_map(device, calibration_map) | |
| set_ccd_calibration(device, indexes) | |
| set_color_select(device, color_select) | |
| set_dac_value(device, dac_value) | |
| set_dark_offsets(device, value) | |
| set_flash_success(device, value) | |
| set_integral_time(device, integral_time) | |
| set_leds(device, leds, repeat, on_time, off_time) | |
| set_measure_mode(device, measure_mode) | |
| set_multiplier(device, multiplier) | |
| set_owner_email(device, email) | |
| set_owner_name(device, name) | |
| set_pcb_errata(device, pcb_errata) | |
| set_post_scale(device, post_scale) | |
| set_pre_scale(device, pre_scale) | |
| set_remote_hash(device, remote_hash) | |
| set_serial_number(device, serial_number) | |
| take_reading_array(device, reading_array) | |
| take_reading_raw(device, take_reading) | |
| take_reading_spectral(device, sram_addr) | |
| take_readings(device, value) | |
| take_readings_xyz(device, calibration_index, value) | |
| verify_firmware(device, data) | |
| verify_flash(device, address, data) | |
| write_eeprom(device, magic) | |
| write_firmware(device, data) | |
| write_flash(device, address, data) | |
| write_sram(device, address, data) | 
Virtual Methods¶
| Inherited: | GObject.Object (7) | 
|---|
| do_device_failed(device, error_message) | |
| do_progress_changed(percentage) | 
Properties¶
None
Class Details¶
- 
class Colorhug.DeviceQueue(**kwargs)¶
- Bases: - GObject.Object- Abstract: - No - Structure: - Colorhug.DeviceQueueClass- 
classmethod new()¶
- Return type: - Colorhug.DeviceQueue- New in version 0.1.29. 
 - 
add(device, cmd, buffer_in, buffer_in_len, buffer_out, buffer_out_len)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- cmd (int) – The command, e.g.Colorhug.CMD_TAKE_READINGS
- buffer_in (int) – The input buffer, orNone
- buffer_in_len (int) – The size of buffer_in
- buffer_out (int) – The output buffer, orNone
- buffer_out_len (int) – The size of buffer_out
 - Adds a raw command to the device queue. - New in version 0.1.29. 
- device (
 - 
boot_flash(device)¶
- Parameters: - device ( - GUsb.Device) – A- GUsb.Device- Boots the device from bootloader to firmware mode. - NOTE: This command is available on hardware version: 1 & 2 - New in version 0.1.29. 
 - 
clear_calibration(device, calibration_index)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- calibration_index (int) – Slot
 - Clears a calibration slot. - NOTE: This command is available on hardware version: 1 & 2 - New in version 0.1.29. 
- device (
 - 
erase_flash(device, address)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- address ([int]) – The device EEPROM address
 - Erase program code on the device. - NOTE: This command is available on hardware version: 1 & 2 - New in version 0.1.29. 
- device (
 - 
get_adc_vref_neg(device, vref)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- vref (float) – The voltage reference, ranging from 0.0 to 3.3V.
 - Gets the ADC Vref- calibration value. - NOTE: This command is available on hardware version: 2 - New in version 0.1.31. 
- device (
 - 
get_adc_vref_pos(device, vref)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- vref (float) – The voltage reference, ranging from 0.0 to 3.3V.
 - Gets the ADC Vref+ calibration value. - NOTE: This command is available on hardware version: 2 - New in version 0.1.31. 
- device (
 - 
get_calibration(device, calibration_index, calibration, types, description)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- calibration_index (int) – The slot position
- calibration (Colord.Mat3x3) – the 3x3 calibration matrix
- types (int) – The types the matrix supports
- description (str) – The description of the calibration
 - Gets the calibration data. - NOTE: This command is available on hardware version: 1 & 2 - New in version 0.1.29. 
- device (
 - 
get_calibration_map(device, calibration_map)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- calibration_map (int) – An array of slot positions
 - Gets the calibration map. - NOTE: This command is available on hardware version: 1 & 2 - New in version 0.1.29. 
- device (
 - 
get_ccd_calibration(device, indexes)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- indexes (int) – An array of red, green, blue indexes
 - Gets the CCD spectral calibration indexes. These are “pointers” to specific spectral peaks returned by the CCD. - NOTE: This command is available on hardware version: 2 - New in version 0.1.31. 
- device (
 - 
get_color_select(device, color_select)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- color_select (Colorhug.ColorSelect) – The color select, e.g.Colorhug.ColorSelect.RED
 - Gets the selected sensor color. - NOTE: This command is available on hardware version: 1 & 2 - New in version 0.1.29. 
- device (
 - 
get_dac_value(device, dac_value)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- dac_value (float) – value between 0.0 and 0.99
 - Gets the DAC value. - NOTE: This command is available on hardware version: 2 - New in version 1.1.6. 
- device (
 - 
get_dark_offsets(device, value)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- value (Colord.ColorRGB) – AColord.ColorRGB
 - Gets the device dark offsets. - NOTE: This command is available on hardware version: 1 & 2 - New in version 0.1.29. 
- device (
 - 
get_firmware_ver(device, major, minor, micro)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- major (int) – The firmware major version
- minor (int) – The firmware minor version
- micro (int) – The firmware micro version
 - Gets the firmware version. - NOTE: This command is available on hardware version: 1 & 2 - New in version 0.1.29. 
- device (
 - 
get_hardware_version(device, hw_version)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- hw_version (int) – The hardware version
 - Gets the hardware version. - NOTE: This command is available on hardware version: 1 & 2 - New in version 0.1.29. 
- device (
 - 
get_integral_time(device, integral_time)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- integral_time (int) – The sensor integral time in device units
 - Gets the reading integral time. - NOTE: This command is available on hardware version: 1 & 2 - New in version 0.1.29. 
- device (
 - 
get_leds(device, leds)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- leds (int) – The LED bitfield
 - Gets the LED status. - NOTE: This command is available on hardware version: 1 & 2 - New in version 0.1.29. 
- device (
 - 
get_measure_mode(device, measure_mode)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- measure_mode (Colorhug.MeasureMode) – TheColorhug.MeasureMode, e.g.Colorhug.MeasureMode.DURATION
 - Gets the measurement mode. - NOTE: This command is available on hardware version: 1 & 2 - New in version 0.1.29. 
- device (
 - 
get_multiplier(device, multiplier)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- multiplier (Colorhug.FreqScale) – The device multiplier, e.g.Colorhug.FreqScale._100
 - Gets the sensor multiplier. - NOTE: This command is available on hardware version: 1 & 2 - New in version 0.1.29. 
- device (
 - 
get_owner_email(device, email)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- email (str) – An email address
 - Gets the owner email address. - NOTE: This command is available on hardware version: 1 & 2 - New in version 0.1.29. 
- device (
 - 
get_owner_name(device, name)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- name (str) – The owner name
 - Gets the owner name. - NOTE: This command is available on hardware version: 1 & 2 - New in version 0.1.29. 
- device (
 - 
get_pcb_errata(device, pcb_errata)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- pcb_errata (int) – The PCB errata, e.g.Colorhug.PcbErrata.SWAPPED_LEDS
 - Gets the PCB errata level. - NOTE: This command is available on hardware version: 1 & 2 - New in version 0.1.29. 
- device (
 - 
get_post_scale(device, post_scale)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- post_scale (float) – The post-scale value
 - Gets the post scale value. - NOTE: This command is available on hardware version: 1 & 2 - New in version 0.1.29. 
- device (
 - 
get_pre_scale(device, pre_scale)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- pre_scale (float) – Pre-scale value
 - Gets the pre scale value. - NOTE: This command is available on hardware version: 1 & 2 - New in version 0.1.29. 
- device (
 - 
get_remote_hash(device, remote_hash)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- remote_hash (Colorhug.Sha1) – AColorhug.Sha1
 - Gets the remote hash stored on the device. - NOTE: This command is available on hardware version: 1 & 2 - New in version 0.1.29. 
- device (
 - 
get_serial_number(device, serial_number)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- serial_number (int) – The device serial number
 - Gets the device serial number. - NOTE: This command is available on hardware version: 1 & 2 - New in version 0.1.29. 
- device (
 - 
get_temperature(device, temperature)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- temperature (float) – Temperature in Celsius
 - Gets the device temperature. - NOTE: This command is available on hardware version: 2 - New in version 0.1.29. 
- device (
 - 
process(process_flags, cancellable)¶
- Parameters: - process_flags (Colorhug.DeviceQueueProcessFlags) – Flags how to process the queue, e.g.Colorhug.DeviceQueueProcessFlags.CONTINUE_ERRORS
- cancellable (Gio.CancellableorNone) –Gio.CancellableorNone
 - Raises: - Returns: - Trueif the commands were executed successfully.- Return type: - Processes all commands in the command queue. WARNING: this function is synchronous and will block. - New in version 0.1.29. 
- process_flags (
 - 
process_async(process_flags, cancellable, callback, *user_data)¶
- Parameters: - process_flags (Colorhug.DeviceQueueProcessFlags) –
- cancellable (Gio.CancellableorNone) – AGio.Cancellable, orNone
- callback (Gio.AsyncReadyCallbackorNone) – AGio.AsyncReadyCallbackthat will be called when finished.
- user_data (objectorNone) – User data passed to callback
 - Processes all commands in the command queue. - New in version 0.1.29. 
- process_flags (
 - 
process_finish(res)¶
- Parameters: - res ( - Gio.AsyncResult) – the- Gio.AsyncResult- Raises: - GLib.Error- Returns: - Trueif the request was fulfilled.- Return type: - bool- Gets the result from the asynchronous function. - New in version 0.1.29. 
 - 
read_firmware(device, data)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- data (bytes) – Firmware binary data
 - Reads firmware on the device. - NOTE: This command is available on hardware version: 1 & 2 - New in version 1.2.11. 
- device (
 - 
read_flash(device, address, data)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- address (int) – The device EEPROM address
- data (bytes) – Binary data
 - Read flash code from the device. - NOTE: This command is available on hardware version: 1 & 2 - New in version 0.1.29. 
- device (
 - 
read_sram(device, address, data)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- address (int) – The device memory address
- data (bytes) – The binary data
 - Reads binary data from the SRAM. - NOTE: This command is available on hardware version: 2 - New in version 0.1.29. 
- device (
 - 
reset(device)¶
- Parameters: - device ( - GUsb.Device) – A- GUsb.Device- Resets the device back to bootloader mode. - NOTE: This command is available on hardware version: 1 & 2 - New in version 0.1.29. 
 - 
self_test(device)¶
- Parameters: - device ( - GUsb.Device) – A- GUsb.Device- Performs some self tests on the device. - NOTE: This command is available on hardware version: 1 & 2 - New in version 0.1.29. 
 - 
set_calibration(device, calibration_index, calibration, types, description)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- calibration_index (int) – The slot position
- calibration (Colord.Mat3x3) – the 3x3 calibration matrix
- types (int) – The types the matrix supports
- description (str) – The description of the calibration
 - Sets the calibration data. - NOTE: This command is available on hardware version: 1 & 2 - New in version 0.1.29. 
- device (
 - 
set_calibration_ccmx(device, calibration_index, ccmx)¶
- Parameters: - device (GUsb.Device) –
- calibration_index (int) –
- ccmx (Colord.It8) –
 - Raises: - Return type: - New in version 0.1.29. 
- device (
 - 
set_calibration_map(device, calibration_map)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- calibration_map (int) – An array of slot positions
 - Sets the calibration map. - NOTE: This command is available on hardware version: 1 & 2 - New in version 0.1.29. 
- device (
 - 
set_ccd_calibration(device, indexes)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- indexes (int) – An array of red, green, blue indexes
 - Sets the CCD spectral calibration indexes. These are “pointers” to specific spectral peaks returned by the CCD. - NOTE: This command is available on hardware version: 2 - New in version 0.1.31. 
- device (
 - 
set_color_select(device, color_select)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- color_select (Colorhug.ColorSelect) – The color select, e.g.Colorhug.ColorSelect.RED
 - Sets the sensor measurement color. - NOTE: This command is available on hardware version: 1 & 2 - New in version 0.1.29. 
- device (
 - 
set_dac_value(device, dac_value)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- dac_value (float) – The DAC value
 - Sets the post scale value. - NOTE: This command is available on hardware version: 1 & 2 - New in version 1.1.6. 
- device (
 - 
set_dark_offsets(device, value)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- value (Colord.ColorRGB) – AColord.ColorRGB
 - Sets the device dark offsets. - NOTE: This command is available on hardware version: 1 & 2 - New in version 0.1.29. 
- device (
 - 
set_flash_success(device, value)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- value (int) – Success value
 - Sets the firmware flash success value. Be careful using this function as misuse can result in a ‘bricked’ ColorHug device. - NOTE: This command is available on hardware version: 1 & 2 - New in version 0.1.29. 
- device (
 - 
set_integral_time(device, integral_time)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- integral_time (int) – The sensor integral time in device units
 - Sets the reading integral time. - NOTE: This command is available on hardware version: 1 & 2 - New in version 0.1.29. 
- device (
 - 
set_leds(device, leds, repeat, on_time, off_time)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- leds (int) – The LEDs bitfield
- repeat (int) – Sets the number of times to repeat the pattern
- on_time (int) – Set the on time
- off_time (int) – Set the off time
 - Sets the LED status. - NOTE: This command is available on hardware version: 1 & 2 - New in version 0.1.29. 
- device (
 - 
set_measure_mode(device, measure_mode)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- measure_mode (Colorhug.MeasureMode) – TheColorhug.MeasureMode, e.g.Colorhug.MeasureMode.DURATION
 - Sets the measurement mode. - NOTE: This command is available on hardware version: 1 & 2 - New in version 0.1.29. 
- device (
 - 
set_multiplier(device, multiplier)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- multiplier (Colorhug.FreqScale) – The device multiplier, e.g.Colorhug.FreqScale._100
 - Sets the sensor multiplier. - NOTE: This command is available on hardware version: 1 & 2 - New in version 0.1.29. 
- device (
 - 
set_owner_email(device, email)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- email (str) – An email address
 - Sets the owner email address. - NOTE: This command is available on hardware version: 1 & 2 - New in version 0.1.29. 
- device (
 - 
set_owner_name(device, name)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- name (str) – The owner name
 - Sets the owner name. - NOTE: This command is available on hardware version: 1 & 2 - New in version 0.1.29. 
- device (
 - 
set_pcb_errata(device, pcb_errata)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- pcb_errata (int) – The PCB errata, e.g.Colorhug.PcbErrata.SWAPPED_LEDS
 - Sets the PCB board errata. - NOTE: This command is available on hardware version: 1 & 2 - New in version 0.1.29. 
- device (
 - 
set_post_scale(device, post_scale)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- post_scale (float) – The post-scale value
 - Sets the post scale value. - NOTE: This command is available on hardware version: 1 & 2 - New in version 0.1.29. 
- device (
 - 
set_pre_scale(device, pre_scale)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- pre_scale (float) – Pre-scale value
 - Sets the pre-scale value. - NOTE: This command is available on hardware version: 1 & 2 - New in version 0.1.29. 
- device (
 - 
set_remote_hash(device, remote_hash)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- remote_hash (Colorhug.Sha1) – AColorhug.Sha1
 - Sets the remote hash on the device. - NOTE: This command is available on hardware version: 1 & 2 - New in version 0.1.29. 
- device (
 - 
set_serial_number(device, serial_number)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- serial_number (int) – The device serial number
 - Sets the device serial number. - NOTE: This command is available on hardware version: 1 & 2 - New in version 0.1.29. 
- device (
 - 
take_reading_array(device, reading_array)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- reading_array (int) – An array of raw readings
 - Get an array of raw readings in quick succession. - NOTE: This command is available on hardware version: 1 & 2 - New in version 0.1.29. 
- device (
 - 
take_reading_raw(device, take_reading)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- take_reading (int) – A raw reading value
 - Take a raw reading from the sensor. - NOTE: This command is available on hardware version: 1 & 2 - New in version 0.1.29. 
- device (
 - 
take_reading_spectral(device, sram_addr)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- sram_addr (int) – The SRAM location where the data is held
 - Takes a raw spectral reading. - NOTE: This command is available on hardware version: 2 - New in version 0.1.31. 
- device (
 - 
take_readings(device, value)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- value (Colord.ColorRGB) – TheColord.ColorRGBof the raw reading
 - Take a RGB triplet of readings from the sensor without applying the calibration matrix. - NOTE: This command is available on hardware version: 1 & 2 - New in version 0.1.29. 
- device (
 - 
take_readings_xyz(device, calibration_index, value)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- calibration_index (int) –
- value (Colord.ColorXYZ) – TheColord.ColorXYZfor a given calibration slot
 - Take an XYZ fully cooked reading from the sensor. - NOTE: This command is available on hardware version: 1 & 2 - New in version 0.1.29. 
- device (
 - 
verify_firmware(device, data)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- data (bytes) – Firmware binary data
 - Verifies firmware on the device. - NOTE: This command is available on hardware version: 1 & 2 - New in version 0.1.29. 
- device (
 - 
verify_flash(device, address, data)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- address (int) – The device EEPROM address
- data (bytes) – Binary data
 - Verify flash code from the device. - NOTE: This command is available on hardware version: 1 & 2 - New in version 0.1.29. 
- device (
 - 
write_eeprom(device, magic)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- magic (str) – The magic sekret string
 - Writes values to the firmware to be set at device startup. - NOTE: This command is available on hardware version: 1 & 2 - New in version 0.1.29. 
- device (
 - 
write_firmware(device, data)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- data (bytes) – Firmware binary data
 - Writes new firmware to the device. - NOTE: This command is available on hardware version: 1 & 2 - New in version 0.1.29. 
- device (
 - 
write_flash(device, address, data)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- address (int) – The device EEPROM address
- data (bytes) – Binary data
 - Write flash code to the device. - NOTE: This command is available on hardware version: 1 & 2 - New in version 0.1.29. 
- device (
 - 
write_sram(device, address, data)¶
- Parameters: - device (GUsb.Device) – AGUsb.Device
- address (int) – The device memory address
- data (bytes) – The binary data
 - Writes binary data to the SRAM. - NOTE: This command is available on hardware version: 2 - New in version 0.1.29. 
- device (
 - 
do_device_failed(device, error_message) virtual¶
- Parameters: - device (GUsb.Device) –
- error_message (str) –
 
- device (
 
- 
classmethod 
Signal Details¶
- 
Colorhug.DeviceQueue.signals.device_failed(device_queue, object, p0)¶
- Signal Name: - device-failed- Flags: - Parameters: - device_queue (Colorhug.DeviceQueue) – The object which received the signal
- object (GObject.Object) –
- p0 (str) –
 
- device_queue (
- 
Colorhug.DeviceQueue.signals.progress_changed(device_queue, object)¶
- Signal Name: - progress-changed- Flags: - Parameters: - device_queue (Colorhug.DeviceQueue) – The object which received the signal
- object (int) –
 
- device_queue (