up-device

## up-device up-device — Client object for accessing information about UPower devices |

## Synopsis

    #define             UP_DEVICE_ERROR
    #define             UP_DEVICE_TYPE_ERROR
    void                (*_up_device_reserved1)             (void);
    void                (*_up_device_reserved2)             (void);
    void                (*_up_device_reserved3)             (void);
    void                (*_up_device_reserved4)             (void);
    void                (*_up_device_reserved5)             (void);
    void                (*_up_device_reserved6)             (void);
    void                (*_up_device_reserved7)             (void);
    void                (*_up_device_reserved8)             (void);
    void                (*changed)                          (UpClient *client);
    GPtrArray *         up_device_get_history_sync          (UpDevice *device,
                                                             const gchar *type,
                                                             guint timespec,
                                                             guint resolution,
                                                             GCancellable *cancellable,
                                                             GError **error);
    const gchar *       up_device_get_object_path           (UpDevice *device);
    GPtrArray *         up_device_get_statistics_sync       (UpDevice *device,
                                                             const gchar *type,
                                                             GCancellable *cancellable,
                                                             GError **error);
    UpDevice *          up_device_new                       (void);
    gboolean            up_device_refresh_sync              (UpDevice *device,
                                                             GCancellable *cancellable,
                                                             GError **error);
    gboolean            up_device_set_object_path_sync      (UpDevice *device,
                                                             const gchar *object_path,
                                                             GCancellable *cancellable,
                                                             GError **error);
    gchar *             up_device_to_text                   (UpDevice *device);

## Description

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

See also: UpClient

## Details

### UP_DEVICE_ERROR

    #define UP_DEVICE_ERROR		(up_device_error_quark ())

### UP_DEVICE_TYPE_ERROR

    #define UP_DEVICE_TYPE_ERROR (up_device_error_get_type ())

### _up_device_reserved1 ()

    void                (*_up_device_reserved1)             (void);

### _up_device_reserved2 ()

    void                (*_up_device_reserved2)             (void);

### _up_device_reserved3 ()

    void                (*_up_device_reserved3)             (void);

### _up_device_reserved4 ()

    void                (*_up_device_reserved4)             (void);

### _up_device_reserved5 ()

    void                (*_up_device_reserved5)             (void);

### _up_device_reserved6 ()

    void                (*_up_device_reserved6)             (void);

### _up_device_reserved7 ()

    void                (*_up_device_reserved7)             (void);

### _up_device_reserved8 ()

    void                (*_up_device_reserved8)             (void);

### changed ()

    void                (*changed)                          (UpClient *client);

### up_device_get_history_sync ()

    GPtrArray *         up_device_get_history_sync          (UpDevice *device,
                                                             const gchar *type,
                                                             guint timespec,
                                                             guint resolution,
                                                             GCancellable *cancellable,
                                                             GError **error);

Gets the device history.

`device` : | a UpDevice instance.
`type` : | The type of history, known values are "rate" and "charge".
`timespec` : | the amount of time to look back into time.
`resolution` : | the resolution of data.
`cancellable` : | a GCancellable or `NULL`
`error` : | a GError, or `NULL`.
Returns : | an array of UpHistoryItem's, else NULL and `error` is used. [transfer full]

Since 0.9.0

### up_device_get_object_path ()

    const gchar *       up_device_get_object_path           (UpDevice *device);

Gets the object path for the device.

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

Since 0.9.0

### up_device_get_statistics_sync ()

    GPtrArray *         up_device_get_statistics_sync       (UpDevice *device,
                                                             const gchar *type,
                                                             GCancellable *cancellable,
                                                             GError **error);

Gets the device current statistics.

`device` : | a UpDevice instance.
`type` : | the type of statistics.
`cancellable` : | a GCancellable or `NULL`
`error` : | a GError, or `NULL`.
Returns : | an array of UpStatsItem's, else NULL and `error` is used. [transfer full]

Since 0.9.0

### up_device_new ()

    UpDevice *          up_device_new                       (void);

Creates a new UpDevice object.

Returns : | a new UpDevice object.

Since 0.9.0

### up_device_refresh_sync ()

    gboolean            up_device_refresh_sync              (UpDevice *device,
                                                             GCancellable *cancellable,
                                                             GError **error);

Refreshes properties on the device. This function is normally not required.

`device` : | a UpDevice instance.
`cancellable` : | a GCancellable or `NULL`
`error` : | a GError, or `NULL`.
Returns : | TRUE for success, else FALSE and `error` is used

Since 0.9.0

### up_device_set_object_path_sync ()

    gboolean            up_device_set_object_path_sync      (UpDevice *device,
                                                             const gchar *object_path,
                                                             GCancellable *cancellable,
                                                             GError **error);

Sets the object path of the object and fills up initial properties.

`device` : | a UpDevice instance.
`object_path` : | The UPower object path.
`cancellable` : | a GCancellable or `NULL`
`error` : | a GError, or `NULL`.
Returns : | TRUE for success, else FALSE and `error` is used

Since 0.9.0

### up_device_to_text ()

    gchar *             up_device_to_text                   (UpDevice *device);

Converts the device to a string description.

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

Since 0.9.0