## GcmDdcDevice

GcmDdcDevice — For managing a specific i2c devices using DDC/CI.

## Synopsis

    #define             GCM_DDC_DEVICE_ERROR
    #define             GCM_DDC_DEVICE_TYPE_ERROR
    enum                GcmDdcDeviceError;
    struct              GcmDdcDevice;
    struct              GcmDdcDeviceClass;
    enum                GcmDdcDeviceKind;
    GQuark              gcm_ddc_device_error_quark          (void);
    GcmDdcDevice *      gcm_ddc_device_new                  (void);
    gboolean            gcm_ddc_device_open                 (GcmDdcDevice *device,
                                                             const gchar *filename,
                                                             GError **error);
    gboolean            gcm_ddc_device_close                (GcmDdcDevice *device,
                                                             GError **error);
    const guint8 *      gcm_ddc_device_get_edid             (GcmDdcDevice *device,
                                                             gsize *length,
                                                             GError **error);
    const gchar *       gcm_ddc_device_get_edid_md5         (GcmDdcDevice *device,
                                                             GError **error);
    gboolean            gcm_ddc_device_write                (GcmDdcDevice *device,
                                                             guchar *data,
                                                             gsize length,
                                                             GError **error);
    gboolean            gcm_ddc_device_read                 (GcmDdcDevice *device,
                                                             guchar *data,
                                                             gsize data_length,
                                                             gsize *recieved_length,
                                                             GError **error);
    gboolean            gcm_ddc_device_save                 (GcmDdcDevice *device,
                                                             GError **error);
    const gchar *       gcm_ddc_device_get_pnpid            (GcmDdcDevice *device,
                                                             GError **error);
    const gchar *       gcm_ddc_device_get_model            (GcmDdcDevice *device,
                                                             GError **error);
    GcmDdcDeviceKind    gcm_ddc_device_get_kind             (GcmDdcDevice *device,
                                                             GError **error);
    GPtrArray *         gcm_ddc_device_get_controls         (GcmDdcDevice *device,
                                                             GError **error);
    GcmDdcControl *     gcm_ddc_device_get_control_by_id    (GcmDdcDevice *device,
                                                             guchar id,
                                                             GError **error);
    void                gcm_ddc_device_set_verbose          (GcmDdcDevice *device,
                                                             GcmVerbose verbose);
                        GcmDdcDevicePrivate;

## Object Hierarchy

      GObject
       +----GcmDdcDevice

## Properties

      "has-coldplug"             gboolean              : Read

## Description

A GObject to use for controlling I2C devices with DDC/CI. A GcmDdcDevice will contain many GcmDdcControl's.

## Details

### GCM_DDC_DEVICE_ERROR

    #define GCM_DDC_DEVICE_ERROR		(gcm_ddc_device_error_quark ())

### GCM_DDC_DEVICE_TYPE_ERROR

    #define GCM_DDC_DEVICE_TYPE_ERROR (gcm_ddc_device_error_get_type ())

### enum GcmDdcDeviceError

    typedef enum
    {
    	GCM_DDC_DEVICE_ERROR_FAILED
    } GcmDdcDeviceError;

Errors that can be thrown

`GCM_DDC_DEVICE_ERROR_FAILED` | the transaction failed for an unknown reason

### struct GcmDdcDevice

    struct GcmDdcDevice;

### struct GcmDdcDeviceClass

    struct GcmDdcDeviceClass {
    	GObjectClass parent_class;

    	/* signals */
    	void		(* changed)			(GcmDdcDevice *device);
    	/* padding for future expansion */
    	void (*_gcm_reserved1) (void);
    	void (*_gcm_reserved2) (void);
    	void (*_gcm_reserved3) (void);
    	void (*_gcm_reserved4) (void);
    	void (*_gcm_reserved5) (void);
    };

### enum GcmDdcDeviceKind

    typedef enum {
    	GCM_DDC_DEVICE_KIND_LCD,
    	GCM_DDC_DEVICE_KIND_CRT,
    	GCM_DDC_DEVICE_KIND_UNKNOWN
    } GcmDdcDeviceKind;

The device type

### gcm_ddc_device_error_quark ()

    GQuark              gcm_ddc_device_error_quark          (void);

Returns : | Our personal error quark.

Since 2.91.1

### gcm_ddc_device_new ()

    GcmDdcDevice *      gcm_ddc_device_new                  (void);

Returns : | A new `GcmDdcDevice` instance

Since 2.91.1

### gcm_ddc_device_open ()

    gboolean            gcm_ddc_device_open                 (GcmDdcDevice *device,
                                                             const gchar *filename,
                                                             GError **error);

Open a device, and take control of the OSD if possible.

`device` : | A valid GcmDdcDevice
`filename` : | the device node, e.g. "/dev/ddc-1"
`error` : | a GError, or `NULL`
Returns : | `TRUE` for success

Since 2.91.1

### gcm_ddc_device_close ()

    gboolean            gcm_ddc_device_close                (GcmDdcDevice *device,
                                                             GError **error);

Close the device, and returning control back to the OSD.

`device` : | A valid GcmDdcDevice
`error` : | a GError, or `NULL`
Returns : | `TRUE` for success

Since 2.91.1

### gcm_ddc_device_get_edid ()

    const guint8 *      gcm_ddc_device_get_edid             (GcmDdcDevice *device,
                                                             gsize *length,
                                                             GError **error);

Gets the raw EDID data for the device.

`device` : | A valid GcmDdcDevice
`length` : | the length of the return buffer, or `NULL`
`error` : | a GError, or `NULL`
Returns : | a pointer to the EDID block. Do not free this value.

Since 2.91.1

### gcm_ddc_device_get_edid_md5 ()

    const gchar *       gcm_ddc_device_get_edid_md5         (GcmDdcDevice *device,
                                                             GError **error);

Gets the MD5 of the EDID.

`device` : | A valid GcmDdcDevice
`error` : | a GError, or `NULL`
Returns : | The MD5 value of the current EDID. Do not free this value.

Since 2.91.1

### gcm_ddc_device_write ()

    gboolean            gcm_ddc_device_write                (GcmDdcDevice *device,
                                                             guchar *data,
                                                             gsize length,
                                                             GError **error);

Write data to DDC/CI at previoulsly set address address.

`device` : | A valid GcmDdcDevice
`data` : | the data to write
`length` : | the length of the data to write
`error` : | a GError, or `NULL`
Returns : | `TRUE` for success

Since 2.91.1

### gcm_ddc_device_read ()

    gboolean            gcm_ddc_device_read                 (GcmDdcDevice *device,
                                                             guchar *data,
                                                             gsize data_length,
                                                             gsize *recieved_length,
                                                             GError **error);

Read DDC/CI formatted frame from the device.

`device` : | A valid GcmDdcDevice
`data` : | the data location to read into
`data_length` : | the length of the `data` buffer
`recieved_length` : | the amount of data that was copied
`error` : | a GError, or `NULL`
Returns : | `TRUE` for success

Since 2.91.1

### gcm_ddc_device_save ()

    gboolean            gcm_ddc_device_save                 (GcmDdcDevice *device,
                                                             GError **error);

Saves any state to the device EEPROM.

`device` : | A valid GcmDdcDevice
`error` : | a GError, or `NULL`
Returns : | `TRUE` for success

Since 2.91.1

### gcm_ddc_device_get_pnpid ()

    const gchar *       gcm_ddc_device_get_pnpid            (GcmDdcDevice *device,
                                                             GError **error);

Gets the PNPID for the device.

`device` : | A valid GcmDdcDevice
`error` : | a GError, or `NULL`
Returns : | The PNPID, or `NULL`.

Since 2.91.1

### gcm_ddc_device_get_model ()

    const gchar *       gcm_ddc_device_get_model            (GcmDdcDevice *device,
                                                             GError **error);

Gets the model of the device.

`device` : | A valid GcmDdcDevice
`error` : | a GError, or `NULL`
Returns : | The model string, or `NULL`.

Since 2.91.1

### gcm_ddc_device_get_kind ()

    GcmDdcDeviceKind    gcm_ddc_device_get_kind             (GcmDdcDevice *device,
                                                             GError **error);

Gets the device kind.

`device` : | A valid GcmDdcDevice
`error` : | a GError, or `NULL`
Returns : | The device kind, e.g. GCM_DDC_DEVICE_KIND_LCD, or `GCM_DDC_DEVICE_KIND_UNKNOWN` for an error.

Since 2.91.1

### gcm_ddc_device_get_controls ()

    GPtrArray *         gcm_ddc_device_get_controls         (GcmDdcDevice *device,
                                                             GError **error);

Get the list of controls for this device.

`device` : | A valid GcmDdcDevice
`error` : | a GError, or `NULL`
Returns : | A GPtrArray of GcmDdcControl's, free with `g_ptr_array_unref()` when done.

Since 2.91.1

### gcm_ddc_device_get_control_by_id ()

    GcmDdcControl *     gcm_ddc_device_get_control_by_id    (GcmDdcDevice *device,
                                                             guchar id,
                                                             GError **error);

Gets a GcmDdcControl object from the ID.

`device` : | A valid GcmDdcDevice
`id` : | the device ID, e.g. GCM_DDC_CONTROL_ID_BRIGHTNESS
`error` : | a GError, or `NULL`
Returns : | `NULL`, or a GcmDdcControl which needs to be freed with `g_object_unref()`.

Since 2.91.1

### gcm_ddc_device_set_verbose ()

    void                gcm_ddc_device_set_verbose          (GcmDdcDevice *device,
                                                             GcmVerbose verbose);

Sets the logging mode of the device. By default we log nothing.

`device` : | A valid GcmDdcDevice
`verbose` : | if we should print out debugging to the console

Since 2.91.1

### GcmDdcDevicePrivate

    typedef struct _GcmDdcDevicePrivate GcmDdcDevicePrivate;

Private GcmDdcDevice data

## Property Details

### The `"has-coldplug"` property

      "has-coldplug"             gboolean              : Read

if there are no transactions in progress on this device.

Default value: TRUE

Since 2.91.1