cd-sensor-sync

cd-sensor-sync — Sync helpers for CdSensor

Functions

Description

These helper functions provide a simple way to use the async functions in command line tools.

See also: CdSensor

Functions

cd_sensor_connect_sync ()

gboolean
cd_sensor_connect_sync (CdSensor *sensor,
                        GCancellable *cancellable,
                        GError **error);

Connects to the object and fills up initial properties.

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

Parameters

sensor

a CdSensor instance.

 

cancellable

a GCancellable or NULL

 

error

a GError, or NULL.

 

Returns

TRUE for success, else FALSE.

Since: 0.1.8


cd_sensor_lock_sync ()

gboolean
cd_sensor_lock_sync (CdSensor *sensor,
                     GCancellable *cancellable,
                     GError **error);

Locks the device so we can use it.

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

Parameters

sensor

a CdSensor instance.

 

cancellable

a GCancellable or NULL

 

error

a GError, or NULL.

 

Returns

TRUE for success, else FALSE.

Since: 0.1.6


cd_sensor_unlock_sync ()

gboolean
cd_sensor_unlock_sync (CdSensor *sensor,
                       GCancellable *cancellable,
                       GError **error);

Unlocks the device for use by other programs.

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

Parameters

sensor

a CdSensor instance.

 

cancellable

a GCancellable or NULL

 

error

a GError, or NULL.

 

Returns

TRUE for success, else FALSE.

Since: 0.1.6


cd_sensor_set_options_sync ()

gboolean
cd_sensor_set_options_sync (CdSensor *sensor,
                            GHashTable *values,
                            GCancellable *cancellable,
                            GError **error);

Sets options on the sensor device.

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

Parameters

sensor

a CdSensor instance.

 

values

the options.

[element-type utf8 GVariant]

cancellable

a GCancellable or NULL

 

error

a GError, or NULL.

 

Returns

TRUE for success, else FALSE.

Since: 0.1.20


cd_sensor_get_sample_sync ()

CdColorXYZ *
cd_sensor_get_sample_sync (CdSensor *sensor,
                           CdSensorCap cap,
                           GCancellable *cancellable,
                           GError **error);

Gets a sample from the sensor.

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

Parameters

sensor

a CdSensor instance.

 

cap

The device capability, e.g. CD_SENSOR_CAP_AMBIENT.

 

cancellable

a GCancellable or NULL

 

error

a GError, or NULL.

 

Returns

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

Since: 0.1.8


cd_sensor_get_spectrum_sync ()

CdSpectrum *
cd_sensor_get_spectrum_sync (CdSensor *sensor,
                             CdSensorCap cap,
                             GCancellable *cancellable,
                             GError **error);

Gets a spectrum from the sensor.

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

Parameters

sensor

a CdSensor instance.

 

cap

The device capability, e.g. CD_SENSOR_CAP_AMBIENT.

 

cancellable

a GCancellable or NULL

 

error

a GError, or NULL.

 

Returns

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

Since: 1.3.1

Types and Values