BluetoothClient: gnome-bluetooth Reference Manual

## BluetoothClient BluetoothClient — Bluetooth client object |

## Stability Level

Stable, unless otherwise indicated

## Functions

void | bluetooth_client_connect_service ()
gboolean | bluetooth_client_connect_service_finish ()
GtkTreeModel * | bluetooth_client_get_adapter_model ()
GtkTreeModel * | bluetooth_client_get_device_model ()
GtkTreeModel * | bluetooth_client_get_filter_model ()
GtkTreeModel * | bluetooth_client_get_model ()
BluetoothClient * | bluetooth_client_new ()

## Properties

gchar * | default-adapter | Read
gboolean | default-adapter-discoverable | Read / Write
gboolean | default-adapter-discovering | Read / Write
gchar * | default-adapter-name | Read
gboolean | default-adapter-powered | Read

## Signals

void | device-removed | Run Last

## Types and Values

struct | BluetoothClient

## Object Hierarchy

        GObject
        ╰── BluetoothClient

## Includes

    #include <bluetooth-client.h>

## Description

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

## Functions

### bluetooth_client_connect_service ()

    void
    bluetooth_client_connect_service (BluetoothClient *client,
                                      const char *path,
                                      gboolean connect,
                                      GCancellable *cancellable,
                                      GAsyncReadyCallback callback,
                                      gpointer user_data);

When the connection operation is finished, `callback` will be called. You can then call `bluetooth_client_connect_service_finish()` to get the result of the operation.

#### Parameters

client | a BluetoothClient |
path | the object path on which to operate |
connect | Whether try to connect or disconnect from services on a device |
cancellable | optional GCancellable object, `NULL` to ignore |
callback | a GAsyncReadyCallback to call when the connection is complete. | [scope async]
user_data | the data to pass to callback function |

### bluetooth_client_connect_service_finish ()

    gboolean
    bluetooth_client_connect_service_finish
                                   (BluetoothClient *client,
                                    GAsyncResult *res,
                                    GError **error);

Finishes the connection operation. See `bluetooth_client_connect_service()`.

#### Parameters

client | a BluetoothClient |
res | a GAsyncResult |
error | a GError |

#### Returns

`TRUE` if the connection operation succeeded, `FALSE` otherwise.

### bluetooth_client_get_adapter_model ()

    GtkTreeModel *
    bluetooth_client_get_adapter_model (BluetoothClient *client);

Returns a GtkTreeModelFilter with only adapters present.

#### Parameters

client | a BluetoothClient object |

#### Returns

a GtkTreeModel object.

[transfer full]

### bluetooth_client_get_device_model ()

    GtkTreeModel *
    bluetooth_client_get_device_model (BluetoothClient *client);

Returns a GtkTreeModelFilter with only devices belonging to the default adapter listed. Note that the model will follow a specific adapter, and will not follow the default adapter. Also note that due to the way GtkTreeModelFilter works, you will probably want to monitor signals on the "child-model" GtkTreeModel to monitor for changes.

#### Parameters

client | a BluetoothClient object |

#### Returns

a GtkTreeModel object.

[transfer full]

### bluetooth_client_get_filter_model ()

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

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

#### Parameters

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.

[transfer full]

### bluetooth_client_get_model ()

    GtkTreeModel *
    bluetooth_client_get_model (BluetoothClient *client);

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

#### Parameters

client | a BluetoothClient object |

#### Returns

a GtkTreeModel object.

[transfer full]

### bluetooth_client_new ()

    BluetoothClient *
    bluetooth_client_new (void);

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

#### Returns

a BluetoothClient object.

[transfer full]

## Types and Values

### struct BluetoothClient

    struct BluetoothClient;

The BluetoothClient struct contains only private fields and should not be directly accessed.

## Property Details

### The `“default-adapter”` property

      “default-adapter”          gchar *

The D-Bus path of the default Bluetooth adapter or `NULL`.

Flags: Read

Default value: NULL

### The `“default-adapter-discoverable”` property

      “default-adapter-discoverable” gboolean

`TRUE` if the default Bluetooth adapter is discoverable.

Flags: Read / Write

Default value: FALSE

### The `“default-adapter-discovering”` property

      “default-adapter-discovering” gboolean

`TRUE` if the default Bluetooth adapter is discovering.

Flags: Read / Write

Default value: FALSE

### The `“default-adapter-name”` property

      “default-adapter-name”     gchar *

The name of the default Bluetooth adapter or `NULL`.

Flags: Read

Default value: NULL

### The `“default-adapter-powered”` property

      “default-adapter-powered”  gboolean

`TRUE` if the default Bluetooth adapter is powered.

Flags: Read

Default value: FALSE

## Signal Details

### The `“device-removed”` signal

    void
    user_function (BluetoothClient *client,
                   gchar           *device,
                   gpointer         user_data)

The “device-removed” signal is launched when a device gets removed from the model.

#### Parameters

client | a BluetoothClient object which received the signal |
device | the D-Bus object path for the now-removed device |
user_data | user data set when the signal handler was connected. |

Flags: Run Last