## BluetoothClient

BluetoothClient — Bluetooth client object

## Stability Level

Stable, unless otherwise indicated

## Synopsis

    #include <bluetooth-client.h>

    #define             BLUETOOTH_GET_CLIENT_CLASS          (obj)
                        BluetoothClient;
    BluetoothClient *   bluetooth_client_new                (void);
    GtkTreeModel *      bluetooth_client_get_model          (BluetoothClient *client);
    GtkTreeModel *      bluetooth_client_get_filter_model   (BluetoothClient *client,
                                                             GtkTreeModelFilterVisibleFunc func,
                                                             gpointer data,
                                                             GDestroyNotify destroy);
    GtkTreeModel *      bluetooth_client_get_adapter_model  (BluetoothClient *client);
    GtkTreeModel *      bluetooth_client_get_device_model   (BluetoothClient *client,
                                                             DBusGProxy *adapter);
    GtkTreeModel *      bluetooth_client_get_device_filter_model
                                                            (BluetoothClient *client,
                                                             DBusGProxy *adapter,
                                                             GtkTreeModelFilterVisibleFunc func,
                                                             gpointer data,
                                                             GDestroyNotify destroy);
    const gchar *       bluetooth_type_to_string            (guint type);
    gboolean            bluetooth_verify_address            (const char *bdaddr);
    const char *        bluetooth_uuid_to_string            (const char *uuid);

## Description

The BluetoothClient object is used to query the state of Bluetooth devices and adapters.

## Details

### BLUETOOTH_GET_CLIENT_CLASS()

    #define             BLUETOOTH_GET_CLIENT_CLASS(obj)

`obj` : |

### BluetoothClient

    typedef struct {
    	GObject parent;
    } BluetoothClient;

### bluetooth_client_new ()

    BluetoothClient *   bluetooth_client_new                (void);

Returns a reference to the BluetoothClient singleton. Use #`g_object_unref()` the object when done.

Returns : | a BluetoothClient object.

### bluetooth_client_get_model ()

    GtkTreeModel *      bluetooth_client_get_model          (BluetoothClient *client);

Returns an unfiltered GtkTreeModel representing the adapter and devices available on the system.

`client` : | a BluetoothClient object
Returns : | a GtkTreeModel object.

### bluetooth_client_get_filter_model ()

    GtkTreeModel *      bluetooth_client_get_filter_model   (BluetoothClient *client,
                                                             GtkTreeModelFilterVisibleFunc func,
                                                             gpointer data,
                                                             GDestroyNotify destroy);

Returns a GtkTreeModel of devices filtered using the `func`, `data` and `destroy` arguments to pass to `gtk_tree_model_filter_set_visible_func()`.

`client` : | a BluetoothClient object
`func` : | a GtkTreeModelFilterVisibleFunc
`data` : | user data to pass to `gtk_tree_model_filter_set_visible_func()`
`destroy` : | a destroy function for `gtk_tree_model_filter_set_visible_func()`
Returns : | a GtkTreeModel object.

### bluetooth_client_get_adapter_model ()

    GtkTreeModel *      bluetooth_client_get_adapter_model  (BluetoothClient *client);

Returns a filtered GtkTreeModel with only adapters present.

`client` : | a BluetoothClient object
Returns : | a GtkTreeModel object.

### bluetooth_client_get_device_model ()

    GtkTreeModel *      bluetooth_client_get_device_model   (BluetoothClient *client,
                                                             DBusGProxy *adapter);

Returns a filtered GtkTreeModel with only devices belonging to the selected adapter listed. Note that the model will follow a specific adapter, and will not follow the default-adapter when `NULL` is passed.

`client` : | a BluetoothClient object
`adapter` : | a DBusGProxy of the adapter object, or `NULL` to get the default adapter.
Returns : | a GtkTreeModel object.

### bluetooth_client_get_device_filter_model ()

    GtkTreeModel *      bluetooth_client_get_device_filter_model
                                                            (BluetoothClient *client,
                                                             DBusGProxy *adapter,
                                                             GtkTreeModelFilterVisibleFunc func,
                                                             gpointer data,
                                                             GDestroyNotify destroy);

Returns a GtkTreeModel of adapters filtered using the `func`, `data` and `destroy` arguments to pass to `gtk_tree_model_filter_set_visible_func()`.

`client` : | a BluetoothClient object
`adapter` : | a DBusGProxy representing a particular adapter, or `NULL` for the default adapter.
`func` : | a GtkTreeModelFilterVisibleFunc
`data` : | user data to pass to `gtk_tree_model_filter_set_visible_func()`
`destroy` : | a destroy function for `gtk_tree_model_filter_set_visible_func()`
Returns : | a GtkTreeModel object.

### bluetooth_type_to_string ()

    const gchar *       bluetooth_type_to_string            (guint type);

Returns the string representation of the `type` passed. Do not free the return value.

`type` : | a BluetoothType
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.

### 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.