bluetooth-utils

## bluetooth-utils bluetooth-utils — Bluetooth utility functions |

## Stability Level

Stable, unless otherwise indicated

## Synopsis

    #include <bluetooth-utils.h>

    void                bluetooth_browse_address            (GObject *object,
                                                             const char *address,
                                                             guint timestamp,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    gboolean            bluetooth_browse_address_finish     (GObject *object,
                                                             GAsyncResult *result,
                                                             GError **error);
    BluetoothType       bluetooth_class_to_type             (guint32 class);
    void                bluetooth_send_to_address           (const char *address,
                                                             const char *alias);
    const gchar *       bluetooth_type_to_string            (guint type);
    const char *        bluetooth_uuid_to_string            (const char *uuid);
    gboolean            bluetooth_verify_address            (const char *bdaddr);

## Description

Those helper functions are used throughout the Bluetooth management utilities.

## Details

### bluetooth_browse_address ()

    void                bluetooth_browse_address            (GObject *object,
                                                             const char *address,
                                                             guint timestamp,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Opens a Bluetooth device in Nautilus.

Ideally the timestamp is taken from the event triggering the call to this function. If timestamp is not known you can take GDK_CURRENT_TIME.

`object` : | a GObject, such as the top-level of your management application
`address` : | the Bluetooth device to browse
`timestamp` : | a timestamp to prevent focus stealing
`callback` : | the completion callback. [scope async]
`user_data` : | the data to pass to callback function

### bluetooth_browse_address_finish ()

    gboolean            bluetooth_browse_address_finish     (GObject *object,
                                                             GAsyncResult *result,
                                                             GError **error);

Finishes the browse operation, See `bluetooth_browse_address()`.

`object` : | a GObject
`result` : | the GAsyncResult from the callback
`error` : | a GError
Returns : | `TRUE` if the operation was successful, `FALSE` if error is set.

### bluetooth_class_to_type ()

    BluetoothType       bluetooth_class_to_type             (guint32 class);

Returns the type of device corresponding to the given `class` value.

`class` : | a Bluetooth device class
Returns : | a BluetoothType.

### bluetooth_send_to_address ()

    void                bluetooth_send_to_address           (const char *address,
                                                             const char *alias);

Start a GUI application for transfering files over Bluetooth.

`address` : | Remote device to use
`alias` : | Remote device's name

### bluetooth_type_to_string ()

    const gchar *       bluetooth_type_to_string            (guint type);

Returns a human-readable string representation of `type` usable for display to users. Do not free the return value. The returned string is already translated with `gettext()`.

`type` : | a BluetoothType
Returns : | a string.

### bluetooth_uuid_to_string ()

    const char *        bluetooth_uuid_to_string            (const char *uuid);

Returns a string representing a human-readable (but not usable for display to users) version of the `uuid`. Do not free the return value.

`uuid` : | a string representing a Bluetooth UUID
Returns : | a string.

### bluetooth_verify_address ()

    gboolean            bluetooth_verify_address            (const char *bdaddr);

Returns whether the string is a valid Bluetooth address. This does not contact the device in any way.

`bdaddr` : | a string representing a Bluetooth address
Returns : | `TRUE` if the address is valid, `FALSE` if not.