cd-device

## cd-device cd-device — Client object for accessing information about colord devices |

## Synopsis

    #define             CD_DEVICE_ERROR
    #define             CD_DEVICE_TYPE_ERROR
    void                (*changed)                          (CdClient *client);
    void                (*_cd_device_reserved1)             (void);
    void                (*_cd_device_reserved2)             (void);
    void                (*_cd_device_reserved3)             (void);
    void                (*_cd_device_reserved4)             (void);
    void                (*_cd_device_reserved5)             (void);
    void                (*_cd_device_reserved6)             (void);
    void                (*_cd_device_reserved7)             (void);
    void                (*_cd_device_reserved8)             (void);
    GQuark              cd_device_error_quark               (void);
    CdDevice *          cd_device_new                       (void);
    CdDevice *          cd_device_new_with_object_path      (const gchar *object_path);
    void                cd_device_connect                   (CdDevice *device,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    gboolean            cd_device_connect_finish            (CdDevice *device,
                                                             GAsyncResult *res,
                                                             GError **error);
    void                cd_device_set_property              (CdDevice *device,
                                                             const gchar *key,
                                                             const gchar *value,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    gboolean            cd_device_set_property_finish       (CdDevice *device,
                                                             GAsyncResult *res,
                                                             GError **error);
    void                cd_device_add_profile               (CdDevice *device,
                                                             CdDeviceRelation relation,
                                                             CdProfile *profile,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    gboolean            cd_device_add_profile_finish        (CdDevice *device,
                                                             GAsyncResult *res,
                                                             GError **error);
    void                cd_device_remove_profile            (CdDevice *device,
                                                             CdProfile *profile,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    gboolean            cd_device_remove_profile_finish     (CdDevice *device,
                                                             GAsyncResult *res,
                                                             GError **error);
    void                cd_device_make_profile_default      (CdDevice *device,
                                                             CdProfile *profile,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    gboolean            cd_device_make_profile_default_finish
                                                            (CdDevice *device,
                                                             GAsyncResult *res,
                                                             GError **error);
    void                cd_device_profiling_inhibit         (CdDevice *device,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    gboolean            cd_device_profiling_inhibit_finish  (CdDevice *device,
                                                             GAsyncResult *res,
                                                             GError **error);
    void                cd_device_set_enabled               (CdDevice *device,
                                                             gboolean enabled,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    gboolean            cd_device_set_enabled_finish        (CdDevice *device,
                                                             GAsyncResult *res,
                                                             GError **error);
    void                cd_device_profiling_uninhibit       (CdDevice *device,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    gboolean            cd_device_profiling_uninhibit_finish
                                                            (CdDevice *device,
                                                             GAsyncResult *res,
                                                             GError **error);
    void                cd_device_get_profile_for_qualifiers
                                                            (CdDevice *device,
                                                             const gchar **qualifiers,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    CdProfile *         cd_device_get_profile_for_qualifiers_finish
                                                            (CdDevice *device,
                                                             GAsyncResult *res,
                                                             GError **error);
    void                cd_device_get_profile_relation      (CdDevice *device,
                                                             CdProfile *profile,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    CdDeviceRelation    cd_device_get_profile_relation_finish
                                                            (CdDevice *device,
                                                             GAsyncResult *res,
                                                             GError **error);
    const gchar *       cd_device_get_id                    (CdDevice *device);
    const gchar *       cd_device_get_model                 (CdDevice *device);
    const gchar *       cd_device_get_vendor                (CdDevice *device);
    const gchar *       cd_device_get_serial                (CdDevice *device);
    const gchar *       cd_device_get_seat                  (CdDevice *device);
    const gchar *       cd_device_get_format                (CdDevice *device);
    const gchar **      cd_device_get_profiling_inhibitors  (CdDevice *device);
    guint64             cd_device_get_created               (CdDevice *device);
    guint64             cd_device_get_modified              (CdDevice *device);
    CdDeviceKind        cd_device_get_kind                  (CdDevice *device);
    CdColorspace        cd_device_get_colorspace            (CdDevice *device);
    CdDeviceMode        cd_device_get_mode                  (CdDevice *device);
    gboolean            cd_device_get_enabled               (CdDevice *device);
    gboolean            cd_device_get_embedded              (CdDevice *device);
    CdObjectScope       cd_device_get_scope                 (CdDevice *device);
    guint               cd_device_get_owner                 (CdDevice *device);
    GPtrArray *         cd_device_get_profiles              (CdDevice *device);
    CdProfile *         cd_device_get_default_profile       (CdDevice *device);
    const gchar *       cd_device_get_object_path           (CdDevice *device);
    GHashTable *        cd_device_get_metadata              (CdDevice *device);
    const gchar *       cd_device_get_metadata_item         (CdDevice *device,
                                                             const gchar *key);
    void                cd_device_set_object_path           (CdDevice *device,
                                                             const gchar *object_path);
    gboolean            cd_device_get_connected             (CdDevice *device);
    gchar *             cd_device_to_string                 (CdDevice *device);
    gboolean            cd_device_equal                     (CdDevice *device1,
                                                             CdDevice *device2);

## Description

A helper GObject to use for accessing colord devices, and to be notified when it is changed.

See also: CdClient

## Details

### CD_DEVICE_ERROR

    #define CD_DEVICE_ERROR		(cd_device_error_quark ())

### CD_DEVICE_TYPE_ERROR

    #define CD_DEVICE_TYPE_ERROR (cd_device_error_get_type ())

### changed ()

    void                (*changed)                          (CdClient *client);

### _cd_device_reserved1 ()

    void                (*_cd_device_reserved1)             (void);

### _cd_device_reserved2 ()

    void                (*_cd_device_reserved2)             (void);

### _cd_device_reserved3 ()

    void                (*_cd_device_reserved3)             (void);

### _cd_device_reserved4 ()

    void                (*_cd_device_reserved4)             (void);

### _cd_device_reserved5 ()

    void                (*_cd_device_reserved5)             (void);

### _cd_device_reserved6 ()

    void                (*_cd_device_reserved6)             (void);

### _cd_device_reserved7 ()

    void                (*_cd_device_reserved7)             (void);

### _cd_device_reserved8 ()

    void                (*_cd_device_reserved8)             (void);

### cd_device_error_quark ()

    GQuark              cd_device_error_quark               (void);

Returns : | An error quark.

Since 0.1.0

### cd_device_new ()

    CdDevice *          cd_device_new                       (void);

Creates a new CdDevice object.

Returns : | a new CdDevice object.

Since 0.1.0

### cd_device_new_with_object_path ()

    CdDevice *          cd_device_new_with_object_path      (const gchar *object_path);

Creates a new CdDevice object with a known object path.

`object_path` : | The colord object path.
Returns : | a new device object.

Since 0.1.8

### cd_device_connect ()

    void                cd_device_connect                   (CdDevice *device,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Connects to the object and fills up initial properties.

`device` : | a CdDevice instance.
`cancellable` : | a GCancellable, or `NULL`
`callback` : | the function to run on completion
`user_data` : | the data to pass to `callback`

Since 0.1.8

### cd_device_connect_finish ()

    gboolean            cd_device_connect_finish            (CdDevice *device,
                                                             GAsyncResult *res,
                                                             GError **error);

Gets the result from the asynchronous function.

`device` : | a CdDevice instance.
`res` : | the GAsyncResult
`error` : | A GError or `NULL`
Returns : | success

Since 0.1.8

### cd_device_set_property ()

    void                cd_device_set_property              (CdDevice *device,
                                                             const gchar *key,
                                                             const gchar *value,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Sets a property on the device.

`device` : | a CdDevice instance.
`key` : | a property key
`value` : | a property key
`cancellable` : | a GCancellable, or `NULL`
`callback` : | the function to run on completion
`user_data` : | the data to pass to `callback`

Since 0.1.8

### cd_device_set_property_finish ()

    gboolean            cd_device_set_property_finish       (CdDevice *device,
                                                             GAsyncResult *res,
                                                             GError **error);

Gets the result from the asynchronous function.

`device` : | a CdDevice instance.
`res` : | the GAsyncResult
`error` : | A GError or `NULL`
Returns : | success

Since 0.1.8

### cd_device_add_profile ()

    void                cd_device_add_profile               (CdDevice *device,
                                                             CdDeviceRelation relation,
                                                             CdProfile *profile,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Adds a profile to a device.

`device` : | a CdDevice instance.
`relation` : | a CdDeviceRelation, e.g. CD_DEVICE_RELATION_HARD
`profile` : | a CdProfile instance
`cancellable` : | a GCancellable, or `NULL`
`callback` : | the function to run on completion
`user_data` : | the data to pass to `callback`

Since 0.1.8

### cd_device_add_profile_finish ()

    gboolean            cd_device_add_profile_finish        (CdDevice *device,
                                                             GAsyncResult *res,
                                                             GError **error);

Gets the result from the asynchronous function.

`device` : | a CdDevice instance.
`res` : | the GAsyncResult
`error` : | A GError or `NULL`
Returns : | success

Since 0.1.8

### cd_device_remove_profile ()

    void                cd_device_remove_profile            (CdDevice *device,
                                                             CdProfile *profile,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Removes a profile from a device.

`device` : | a CdDevice instance.
`profile` : | a CdProfile instance
`cancellable` : | a GCancellable, or `NULL`
`callback` : | the function to run on completion
`user_data` : | the data to pass to `callback`

Since 0.1.8

### cd_device_remove_profile_finish ()

    gboolean            cd_device_remove_profile_finish     (CdDevice *device,
                                                             GAsyncResult *res,
                                                             GError **error);

Gets the result from the asynchronous function.

`device` : | a CdDevice instance.
`res` : | the GAsyncResult
`error` : | A GError or `NULL`
Returns : | success

Since 0.1.8

### cd_device_make_profile_default ()

    void                cd_device_make_profile_default      (CdDevice *device,
                                                             CdProfile *profile,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Makes an already added profile default for a device.

`device` : | a CdDevice instance.
`profile` : | a CdProfile instance
`cancellable` : | a GCancellable, or `NULL`
`callback` : | the function to run on completion
`user_data` : | the data to pass to `callback`

Since 0.1.8

### cd_device_make_profile_default_finish ()

    gboolean            cd_device_make_profile_default_finish
                                                            (CdDevice *device,
                                                             GAsyncResult *res,
                                                             GError **error);

Gets the result from the asynchronous function.

`device` : | a CdDevice instance.
`res` : | the GAsyncResult
`error` : | A GError or `NULL`
Returns : | success

Since 0.1.8

### cd_device_profiling_inhibit ()

    void                cd_device_profiling_inhibit         (CdDevice *device,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Sets up the device for profiling and causes no profiles to be returned if `cd_device_get_profile_for_qualifiers_sync()` is used.

`device` : | a CdDevice instance.
`cancellable` : | a GCancellable, or `NULL`
`callback` : | the function to run on completion
`user_data` : | the data to pass to `callback`

Since 0.1.8

### cd_device_profiling_inhibit_finish ()

    gboolean            cd_device_profiling_inhibit_finish  (CdDevice *device,
                                                             GAsyncResult *res,
                                                             GError **error);

Gets the result from the asynchronous function.

`device` : | a CdDevice instance.
`res` : | the GAsyncResult
`error` : | A GError or `NULL`
Returns : | success

Since 0.1.8

### cd_device_set_enabled ()

    void                cd_device_set_enabled               (CdDevice *device,
                                                             gboolean enabled,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Enables or disables a device.

`device` : | a CdDevice instance.
`enabled` : | the enabled state
`cancellable` : | a GCancellable, or `NULL`
`callback` : | the function to run on completion
`user_data` : | the data to pass to `callback`

Since 0.1.26

### cd_device_set_enabled_finish ()

    gboolean            cd_device_set_enabled_finish        (CdDevice *device,
                                                             GAsyncResult *res,
                                                             GError **error);

Gets the result from the asynchronous function.

`device` : | a CdDevice instance.
`res` : | the GAsyncResult
`error` : | A GError or `NULL`
Returns : | success

Since 0.1.26

### cd_device_profiling_uninhibit ()

    void                cd_device_profiling_uninhibit       (CdDevice *device,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Restores the device after profiling and causes normal profiles to be returned if `cd_device_get_profile_for_qualifiers_sync()` is used.

`device` : | a CdDevice instance.
`cancellable` : | a GCancellable, or `NULL`
`callback` : | the function to run on completion
`user_data` : | the data to pass to `callback`

Since 0.1.8

### cd_device_profiling_uninhibit_finish ()

    gboolean            cd_device_profiling_uninhibit_finish
                                                            (CdDevice *device,
                                                             GAsyncResult *res,
                                                             GError **error);

Gets the result from the asynchronous function.

`device` : | a CdDevice instance.
`res` : | the GAsyncResult
`error` : | A GError or `NULL`
Returns : | success

Since 0.1.8

### cd_device_get_profile_for_qualifiers ()

    void                cd_device_get_profile_for_qualifiers
                                                            (CdDevice *device,
                                                             const gchar **qualifiers,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Gets the prefered profile for some qualifiers.

`device` : | a CdDevice instance.
`qualifiers` : | a set of qualifiers that can included wildcards
`cancellable` : | a GCancellable, or `NULL`
`callback` : | the function to run on completion
`user_data` : | the data to pass to `callback`

Since 0.1.8

### cd_device_get_profile_for_qualifiers_finish ()

    CdProfile *         cd_device_get_profile_for_qualifiers_finish
                                                            (CdDevice *device,
                                                             GAsyncResult *res,
                                                             GError **error);

Gets the result from the asynchronous function.

`device` : | a CdDevice instance.
`res` : | the GAsyncResult
`error` : | A GError or `NULL`
Returns : | a CdProfile or `NULL`. [transfer full]

Since 0.1.8

### cd_device_get_profile_relation ()

    void                cd_device_get_profile_relation      (CdDevice *device,
                                                             CdProfile *profile,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Gets the property relationship to the device.

`device` : | a CdDevice instance.
`profile` : | a CdProfile instance
`cancellable` : | a GCancellable, or `NULL`
`callback` : | the function to run on completion
`user_data` : | the data to pass to `callback`

Since 0.1.8

### cd_device_get_profile_relation_finish ()

    CdDeviceRelation    cd_device_get_profile_relation_finish
                                                            (CdDevice *device,
                                                             GAsyncResult *res,
                                                             GError **error);

Gets the result from the asynchronous function.

`device` : | a CdDevice instance.
`res` : | the GAsyncResult
`error` : | A GError or `NULL`
Returns : | success

Since 0.1.8

### cd_device_get_id ()

    const gchar *       cd_device_get_id                    (CdDevice *device);

Gets the device ID.

`device` : | a CdDevice instance.
Returns : | A string, or `NULL` for invalid

Since 0.1.0

### cd_device_get_model ()

    const gchar *       cd_device_get_model                 (CdDevice *device);

Gets the device model.

`device` : | a CdDevice instance.
Returns : | A string, or `NULL` for invalid

Since 0.1.0

### cd_device_get_vendor ()

    const gchar *       cd_device_get_vendor                (CdDevice *device);

Gets the device vendor.

`device` : | a CdDevice instance.
Returns : | A string, or `NULL` for invalid

Since 0.1.1

### cd_device_get_serial ()

    const gchar *       cd_device_get_serial                (CdDevice *device);

Gets the device serial number.

`device` : | a CdDevice instance.
Returns : | A string, or `NULL` for invalid

Since 0.1.0

### cd_device_get_seat ()

    const gchar *       cd_device_get_seat                  (CdDevice *device);

Gets the device seat identifier.

`device` : | a CdDevice instance.
Returns : | A string, or `NULL` for invalid

Since 0.1.24

### cd_device_get_format ()

    const gchar *       cd_device_get_format                (CdDevice *device);

Gets the device format.

`device` : | a CdDevice instance.
Returns : | A string, or `NULL` for invalid

Since 0.1.9

### cd_device_get_profiling_inhibitors ()

    const gchar **      cd_device_get_profiling_inhibitors  (CdDevice *device);

Gets any profiling inhibitors for the device.

`device` : | a CdDevice instance.
Returns : | A strv, or `NULL` for invalid. [transfer none]

Since 0.1.17

### cd_device_get_created ()

    guint64             cd_device_get_created               (CdDevice *device);

Gets the device creation date.

`device` : | a CdDevice instance.
Returns : | A value in microseconds, or 0 for invalid

Since 0.1.0

### cd_device_get_modified ()

    guint64             cd_device_get_modified              (CdDevice *device);

Gets the device modified date.

`device` : | a CdDevice instance.
Returns : | A value in microseconds, or 0 for invalid

Since 0.1.1

### cd_device_get_kind ()

    CdDeviceKind        cd_device_get_kind                  (CdDevice *device);

Gets the device kind.

`device` : | a CdDevice instance.
Returns : | A device kind, e.g. `CD_DEVICE_KIND_DISPLAY`

Since 0.1.0

### cd_device_get_colorspace ()

    CdColorspace        cd_device_get_colorspace            (CdDevice *device);

Gets the device colorspace.

`device` : | a CdDevice instance.
Returns : | A colorspace, e.g. `CD_COLORSPACE_RGB`

Since 0.1.1

### cd_device_get_mode ()

    CdDeviceMode        cd_device_get_mode                  (CdDevice *device);

Gets the device mode.

`device` : | a CdDevice instance.
Returns : | A colorspace, e.g. `CD_DEVICE_MODE_VIRTUAL`

Since 0.1.2

### cd_device_get_enabled ()

    gboolean            cd_device_get_enabled               (CdDevice *device);

Gets the device enabled state.

`device` : | a CdDevice instance.
Returns : | `TRUE` if the device is enabled

Since 0.1.26

### cd_device_get_embedded ()

    gboolean            cd_device_get_embedded              (CdDevice *device);

Returns if the device is embedded in the computer and cannot be removed.

`device` : | a CdDevice instance.
Returns : | `TRUE` if embedded.

Since 0.1.27

### cd_device_get_scope ()

    CdObjectScope       cd_device_get_scope                 (CdDevice *device);

Gets the device scope.

`device` : | a CdDevice instance.
Returns : | An object scope, e.g. `CD_OBJECT_SCOPE_TEMP`

Since 0.1.10

### cd_device_get_owner ()

    guint               cd_device_get_owner                 (CdDevice *device);

Gets the device owner.

`device` : | a CdDevice instance.
Returns : | The UID of the user that created the device

Since 0.1.13

### cd_device_get_profiles ()

    GPtrArray *         cd_device_get_profiles              (CdDevice *device);

Gets the device profiles.

`device` : | a CdDevice instance.
Returns : | An array of CdProfile's. [element-type CdProfile][transfer full]

Since 0.1.0

### cd_device_get_default_profile ()

    CdProfile *         cd_device_get_default_profile       (CdDevice *device);

Gets the default device profile. A profile will not be returned if the device is being profiled or is disabled.

`device` : | a CdDevice instance.
Returns : | A CdProfile's or NULL. [transfer full]

Since 0.1.1

### cd_device_get_object_path ()

    const gchar *       cd_device_get_object_path           (CdDevice *device);

Gets the object path for the device.

`device` : | a CdDevice instance.
Returns : | the object path, or `NULL`

Since 0.1.0

### cd_device_get_metadata ()

    GHashTable *        cd_device_get_metadata              (CdDevice *device);

Returns the device metadata.

`device` : | a CdDevice instance.
Returns : | a GHashTable. [transfer container][element-type utf8 utf8]

Since 0.1.5

### cd_device_get_metadata_item ()

    const gchar *       cd_device_get_metadata_item         (CdDevice *device,
                                                             const gchar *key);

Returns the device metadata for a specific key.

`device` : | a CdDevice instance.
`key` : | a key for the metadata dictionary
Returns : | the metadata value, or `NULL` if not set.

Since 0.1.5

### cd_device_set_object_path ()

    void                cd_device_set_object_path           (CdDevice *device,
                                                             const gchar *object_path);

Sets the object path of the device.

`device` : | a CdDevice instance.
`object_path` : | The colord object path.

Since 0.1.8

### cd_device_get_connected ()

    gboolean            cd_device_get_connected             (CdDevice *device);

Gets if the device has been connected.

`device` : | a CdDevice instance.
Returns : | `TRUE` if properties are valid

Since 0.1.9

### cd_device_to_string ()

    gchar *             cd_device_to_string                 (CdDevice *device);

Converts the device to a string description.

`device` : | a CdDevice instance.
Returns : | text representation of CdDevice

Since 0.1.0

### cd_device_equal ()

    gboolean            cd_device_equal                     (CdDevice *device1,
                                                             CdDevice *device2);

Tests two devices for equality.

`device1` : | one CdDevice instance.
`device2` : | another CdDevice instance.
Returns : | `TRUE` if the devices are the same device

Since 0.1.8