Colord.Sensor

g Colord.Sensor Colord.Sensor GObject.Object GObject.Object GObject.Object->Colord.Sensor

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

cap_from_string (sensor_cap)

class

cap_to_string (sensor_cap)

class

error_from_string (error_desc)

class

error_quark ()

class

error_to_string (error_enum)

class

kind_from_string (sensor_kind)

class

kind_to_string (sensor_kind)

class

new ()

class

new_with_object_path (object_path)

class

state_from_string (sensor_state)

class

state_to_string (sensor_state)

connect (cancellable, callback, *user_data)

connect_finish (res)

connect_sync (cancellable)

equal (sensor2)

get_caps ()

get_connected ()

get_embedded ()

get_id ()

get_kind ()

get_locked ()

get_metadata ()

get_metadata_item (key)

get_mode ()

get_model ()

get_native ()

get_object_path ()

get_option (key)

get_options ()

get_sample (cap, cancellable, callback, *user_data)

get_sample_finish (res)

get_sample_sync (cap, cancellable)

get_serial ()

get_spectrum (cap, cancellable, callback, *user_data)

get_spectrum_finish (res)

get_spectrum_sync (cap, cancellable)

get_state ()

get_vendor ()

has_cap (cap)

lock (cancellable, callback, *user_data)

lock_finish (res)

lock_sync (cancellable)

set_object_path (object_path)

set_options (values, cancellable, callback, *user_data)

set_options_finish (res)

set_options_sync (values, cancellable)

to_string ()

unlock (cancellable, callback, *user_data)

unlock_finish (res)

unlock_sync (cancellable)

Virtual Methods

Inherited:

GObject.Object (7)

do_button_pressed ()

Properties

Name

Type

Flags

Short Description

connected

str

r

embedded

str

r

id

str

r

kind

str

r

locked

str

r

mode

str

r

model

str

r

native

str

r

object-path

str

r/w/c

serial

str

r

state

str

r

vendor

str

r

Signals

Inherited:

GObject.Object (1)

Name

Short Description

button-pressed

The ::button-pressed signal is emitted when the button has been pressed.

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent_instance

GObject.Object

r

Class Details

class Colord.Sensor(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

Colord.SensorClass

classmethod cap_from_string(sensor_cap)[source]
Parameters:

sensor_cap (str) – the sensor capability, e.g. ‘projector’.

Returns:

a Colord.SensorCap

Return type:

Colord.SensorCap

Gets the sensor capability as a enumerated value.

classmethod cap_to_string(sensor_cap)[source]
Parameters:

sensor_cap (Colord.SensorCap) – a Colord.SensorCap

Returns:

the sensor capability, e.g. ‘projector’.

Return type:

str

Gets the sensor capability as a string.

classmethod error_from_string(error_desc)[source]
Parameters:

error_desc (str) –

Returns:

enumerated value

Return type:

Colord.SensorError

Converts a string to a Colord.SensorError.

New in version 0.1.26.

classmethod error_quark()[source]
Returns:

An error quark.

Return type:

int

New in version 0.1.6.

classmethod error_to_string(error_enum)[source]
Parameters:

error_enum (Colord.SensorError) –

Returns:

identifier string

Return type:

str

Converts a Colord.SensorError to a string.

New in version 0.1.26.

classmethod kind_from_string(sensor_kind)[source]
Parameters:

sensor_kind (str) – the sensor kind, e.g. ‘huey’.

Returns:

a Colord.SensorKind

Return type:

Colord.SensorKind

Gets the sensor kind as a enumerated value.

classmethod kind_to_string(sensor_kind)[source]
Parameters:

sensor_kind (Colord.SensorKind) – a Colord.SensorKind

Returns:

the sensor kind, e.g. ‘huey’.

Return type:

str

Gets the sensor kind as a string.

classmethod new()[source]
Returns:

a new Colord.Sensor object.

Return type:

Colord.Sensor

Creates a new Colord.Sensor object.

New in version 0.1.6.

classmethod new_with_object_path(object_path)[source]
Parameters:

object_path (str) – The colord object path.

Returns:

a new sensor object.

Return type:

Colord.Sensor

Creates a new Colord.Sensor object with a known object path.

New in version 0.1.8.

classmethod state_from_string(sensor_state)[source]
Parameters:

sensor_state (str) – the sensor stateability, e.g. ‘measuring’.

Returns:

a Colord.SensorState

Return type:

Colord.SensorState

Gets the sensor stateability as a enumerated value.

classmethod state_to_string(sensor_state)[source]
Parameters:

sensor_state (Colord.SensorState) – a Colord.SensorState

Returns:

the sensor stateability, e.g. ‘measuring’.

Return type:

str

Gets the sensor stateability as a string.

connect(cancellable, callback, *user_data)[source]
Parameters:

Connects to the sensor.

New in version 0.1.8.

connect_finish(res)[source]
Parameters:

res (Gio.AsyncResult) – the Gio.AsyncResult

Raises:

GLib.Error

Returns:

True if we could connect to to the sensor

Return type:

bool

Gets the result from the asynchronous function.

New in version 0.1.8.

connect_sync(cancellable)[source]
Parameters:

cancellable (Gio.Cancellable or None) – a Gio.Cancellable or None

Raises:

GLib.Error

Returns:

True for success, else False.

Return type:

bool

Connects to the object and fills up initial properties.

WARNING: This function is synchronous, and may block. Do not use it in GUI applications.

New in version 0.1.8.

equal(sensor2)[source]
Parameters:

sensor2 (Colord.Sensor) – another Colord.Sensor instance.

Returns:

True if the sensors are the same device

Return type:

bool

Tests two sensors for equality.

New in version 0.1.8.

get_caps()[source]
Returns:

The sensor capability bitfield.

Return type:

int

Returns the sensor metadata.

New in version 0.1.6.

get_connected()[source]
Returns:

True if properties are valid

Return type:

bool

Gets if the sensor has been connected.

New in version 0.1.9.

get_embedded()[source]
Returns:

True if embedded.

Return type:

bool

Returns if the sensor is embedded into the computer.

New in version 0.1.26.

get_id()[source]
Returns:

the object ID, or None

Return type:

str

Gets the object ID for the sensor.

New in version 0.1.26.

get_kind()[source]
Returns:

A Colord.SensorKind, e.g. Colord.SensorKind.HUEY

Return type:

Colord.SensorKind

Gets the sensor kind.

New in version 0.1.6.

get_locked()[source]
Returns:

True if VCGT is valid.

Return type:

bool

Returns if the sensor is locked.

New in version 0.1.6.

get_metadata()[source]
Returns:

a GLib.HashTable.

Return type:

{str: str}

Returns the sensor metadata.

New in version 0.1.28.

get_metadata_item(key)[source]
Parameters:

key (str) – a key for the metadata dictionary

Returns:

the metadata value, or None if not set.

Return type:

str

Returns the sensor metadata for a specific key.

New in version 0.1.28.

get_mode()[source]
Returns:

A Colord.SensorCap, e.g. Colord.SensorCap.AMBIENT

Return type:

Colord.SensorCap

Gets the sensor operating mode.

New in version 0.1.6.

get_model()[source]
Returns:

A string, or None for invalid

Return type:

str

Gets the sensor model.

New in version 0.1.6.

get_native()[source]
Returns:

True if VCGT is valid.

Return type:

bool

Returns if the sensor has a native driver.

New in version 0.1.6.

get_object_path()[source]
Returns:

the object path, or None

Return type:

str

Gets the object path for the sensor.

New in version 0.1.6.

get_option(key)[source]
Parameters:

key (str) – a key to search for.

Returns:

A const string, or None of not found.

Return type:

str

Gets a specific sensor option.

New in version 0.1.20.

get_options()[source]
Returns:

A refcounted GLib.HashTable of (string, GLib.Variant).

Return type:

{str: GLib.Variant}

Gets any sensor options.

New in version 0.1.20.

get_sample(cap, cancellable, callback, *user_data)[source]
Parameters:

Gets a color sample from a sensor

New in version 0.1.8.

get_sample_finish(res)[source]
Parameters:

res (Gio.AsyncResult) – the Gio.AsyncResult

Raises:

GLib.Error

Returns:

the XYZ reading, or None

Return type:

Colord.ColorXYZ

Gets the result from the asynchronous function.

New in version 0.1.8.

get_sample_sync(cap, cancellable)[source]
Parameters:
Raises:

GLib.Error

Returns:

the XYZ reading, with ambient levels in Lux encoded in X, or None for error.

Return type:

Colord.ColorXYZ

Gets a sample from the sensor.

WARNING: This function is synchronous, and may block. Do not use it in GUI applications.

New in version 0.1.8.

get_serial()[source]
Returns:

A string, or None for invalid

Return type:

str

Gets the sensor serial number.

New in version 0.1.6.

get_spectrum(cap, cancellable, callback, *user_data)[source]
Parameters:

Gets a color spectrum from a sensor

New in version 1.3.1.

get_spectrum_finish(res)[source]
Parameters:

res (Gio.AsyncResult) – the Gio.AsyncResult

Raises:

GLib.Error

Returns:

the XYZ reading, or None

Return type:

Colord.Spectrum

Gets the result from the asynchronous function.

New in version 1.3.1.

get_spectrum_sync(cap, cancellable)[source]
Parameters:
Raises:

GLib.Error

Returns:

the XYZ reading, with ambient levels in Lux encoded in X, or None for error.

Return type:

Colord.Spectrum

Gets a spectrum from the sensor.

WARNING: This function is synchronous, and may block. Do not use it in GUI applications.

New in version 1.3.1.

get_state()[source]
Returns:

A Colord.SensorState, e.g. Colord.SensorState.IDLE

Return type:

Colord.SensorState

Gets the sensor state.

New in version 0.1.6.

get_vendor()[source]
Returns:

A string, or None for invalid

Return type:

str

Gets the sensor vendor.

New in version 0.1.6.

has_cap(cap)[source]
Parameters:

cap (Colord.SensorCap) – a specified capability, e.g. Colord.SensorCap.LCD

Returns:

True if the sensor has the specified capability

Return type:

bool

Returns the sensor metadata for a specific key.

New in version 0.1.6.

lock(cancellable, callback, *user_data)[source]
Parameters:

Locks the device so we can use it.

New in version 0.1.8.

lock_finish(res)[source]
Parameters:

res (Gio.AsyncResult) – the Gio.AsyncResult

Raises:

GLib.Error

Returns:

success

Return type:

bool

Gets the result from the asynchronous function.

New in version 0.1.8.

lock_sync(cancellable)[source]
Parameters:

cancellable (Gio.Cancellable or None) – a Gio.Cancellable or None

Raises:

GLib.Error

Returns:

True for success, else False.

Return type:

bool

Locks the device so we can use it.

WARNING: This function is synchronous, and may block. Do not use it in GUI applications.

New in version 0.1.6.

set_object_path(object_path)[source]
Parameters:

object_path (str) – The colord object path.

Sets the object path of the sensor.

New in version 0.1.8.

set_options(values, cancellable, callback, *user_data)[source]
Parameters:

Sets options on the sensor device.

New in version 0.1.20.

set_options_finish(res)[source]
Parameters:

res (Gio.AsyncResult) – the Gio.AsyncResult

Raises:

GLib.Error

Returns:

success

Return type:

bool

Gets the result from the asynchronous function.

New in version 0.1.20.

set_options_sync(values, cancellable)[source]
Parameters:
Raises:

GLib.Error

Returns:

True for success, else False.

Return type:

bool

Sets options on the sensor device.

WARNING: This function is synchronous, and may block. Do not use it in GUI applications.

New in version 0.1.20.

to_string()
Return type:

str

unlock(cancellable, callback, *user_data)[source]
Parameters:

Unlocks the sensor for use by other programs.

New in version 0.1.8.

unlock_finish(res)[source]
Parameters:

res (Gio.AsyncResult) – the Gio.AsyncResult

Raises:

GLib.Error

Returns:

success

Return type:

bool

Gets the result from the asynchronous function.

New in version 0.1.8.

unlock_sync(cancellable)[source]
Parameters:

cancellable (Gio.Cancellable or None) – a Gio.Cancellable or None

Raises:

GLib.Error

Returns:

True for success, else False.

Return type:

bool

Unlocks the device for use by other programs.

WARNING: This function is synchronous, and may block. Do not use it in GUI applications.

New in version 0.1.6.

do_button_pressed() virtual

Signal Details

Colord.Sensor.signals.button_pressed(sensor)
Signal Name:

button-pressed

Flags:

RUN_LAST

Parameters:

sensor (Colord.Sensor) – The object which received the signal

The ::button-pressed signal is emitted when the button has been pressed.

New in version 0.1.6.

Property Details

Colord.Sensor.props.connected
Name:

connected

Type:

str

Default Value:

None

Flags:

READABLE

The if the object path has been connected as is valid for use.

New in version 0.1.9.

Colord.Sensor.props.embedded
Name:

embedded

Type:

str

Default Value:

None

Flags:

READABLE

If the sensor has a native driver.

New in version 0.1.26.

Colord.Sensor.props.id
Name:

id

Type:

str

Default Value:

None

Flags:

READABLE

The object ID of the remote object

New in version 0.1.26.

Colord.Sensor.props.kind
Name:

kind

Type:

str

Default Value:

None

Flags:

READABLE

The sensor kind.

New in version 0.1.6.

Colord.Sensor.props.locked
Name:

locked

Type:

str

Default Value:

None

Flags:

READABLE

If the sensor is locked.

New in version 0.1.6.

Colord.Sensor.props.mode
Name:

mode

Type:

str

Default Value:

None

Flags:

READABLE

The sensor mode.

New in version 0.1.6.

Colord.Sensor.props.model
Name:

model

Type:

str

Default Value:

None

Flags:

READABLE

The sensor model.

New in version 0.1.6.

Colord.Sensor.props.native
Name:

native

Type:

str

Default Value:

None

Flags:

READABLE

If the sensor has a native driver.

New in version 0.1.6.

Colord.Sensor.props.object_path
Name:

object-path

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT

The object path of the remote object

New in version 0.1.8.

Colord.Sensor.props.serial
Name:

serial

Type:

str

Default Value:

None

Flags:

READABLE

The sensor ID.

New in version 0.1.6.

Colord.Sensor.props.state
Name:

state

Type:

str

Default Value:

None

Flags:

READABLE

The sensor state.

New in version 0.1.6.

Colord.Sensor.props.vendor
Name:

vendor

Type:

str

Default Value:

None

Flags:

READABLE

The sensor vendor.

New in version 0.1.6.