|  |  |  | Libbtctl Reference Manual |  | 
|---|---|---|---|---|
| Top | Description | Object Hierarchy | Properties | Signals | ||||
                    BtctlController;
BtctlController*    btctl_controller_new                (const char *hci_device);
#define             BTCTL_RFCOMM_NO_DEVICE
#define             BTCTL_RFCOMM_DEVICE_IN_USE
void                btctl_controller_discover_devices   (BtctlController *bc,
                                                         GError **err);
void                btctl_controller_list_rfcomm_connections
                                                        (BtctlController *bc);
gint                btctl_controller_establish_rfcomm_connection
                                                        (BtctlController *bc,
                                                         const gchar *bdstr,
                                                         guint channel);
gint                btctl_controller_get_established_rfcomm_connection
                                                        (BtctlController *bc,
                                                         const gchar *bdstr,
                                                         guint channel);
gboolean            btctl_controller_scan_for_service   (BtctlController *bc,
                                                         const gchar *bdstr,
                                                         guint clsid,
                                                         GError **err);
void                btctl_controller_cancel_discovery   (BtctlController *bc);
void                btctl_controller_discover_async     (BtctlController *bc);
gboolean            btctl_controller_is_initialised     (BtctlController *bc,
                                                         GError **err);
int                 btctl_controller_get_signal_strength
                                                        (BtctlController *bc,
                                                         const gchar *bdaddr,
                                                         GError **err);
"add-device" : Run First "add-device-service" : Run First "device-name" : Run First "status-change" : Run First
BtctlController* btctl_controller_new (const char *hci_device);
Create a new Bluetooth controller object.  This will attempt to open
an HCI socket to the default Bluetooth device.  Use
btctl_controller_is_initialised() to check whether this was successful.
| 
 | Bluetooth HCI device string (e.g. "hci0") or NULL. | 
| Returns : | a pointer to the controller object. | 
void btctl_controller_discover_devices (BtctlController *bc, GError **err);
Commence a synchronous device discovery cycle.
| 
 | Bluetooth controller object. | 
| 
 | An error message (if applicable). | 
void                btctl_controller_list_rfcomm_connections
                                                        (BtctlController *bc);
Dump established rfcomm connections to the terminal.
| 
 | Bluetooth controller object. | 
gint btctl_controller_establish_rfcomm_connection (BtctlController *bc, const gchar *bdstr, guint channel);
Link an rfcomm device to the destination device. Returns BTCTL_RFCOMM_NO_DEVICE if the connection cannot be made.
| 
 | Bluetooth controller object. | 
| 
 | Bluetooth address of destination device. | 
| 
 | RFCOMM channel. | 
| Returns : | rfcomm device number. | 
gint btctl_controller_get_established_rfcomm_connection (BtctlController *bc, const gchar *bdstr, guint channel);
Find rfcomm device number (ie. N for /dev/rfcommN) connected to the destination device on the specified channel. Returns BTCTL_RFCOMM_NO_DEVICE is no device is available, or BTCTL_RFCOMM_DEVICE_IN_USE if a device is available but already in use.
| 
 | Bluetooth controller object. | 
| 
 | Bluetooth address of destination device. | 
| 
 | RFCOMM channel. | 
| Returns : | rfcomm device number. | 
gboolean btctl_controller_scan_for_service (BtctlController *bc, const gchar *bdstr, guint clsid, GError **err);
Performs a specific SDP scan for the service specified. The service class identifiers can be found in /usr/include/bluetooth/sdp.h
| 
 | Bluetooth controller object. | 
| 
 | Bluetooth address of destination device. | 
| 
 | SDP service class ID. | 
| 
 | An error message (if applicable). | 
| Returns : | TRUEif the scan was successful. | 
void btctl_controller_cancel_discovery (BtctlController *bc);
Cancel an asynchronous discovery cycle. Will only work if inquiry cancellation support is present in the kernel.
| 
 | Bluetooth controller object. | 
void btctl_controller_discover_async (BtctlController *bc);
Commence an asychronous device discovery cycle. Signals will be sent on device discovery, but no SDP discovery is being done. The status-change signal will send information about the completion of the scan.
| 
 | Bluetooth controller object. | 
gboolean btctl_controller_is_initialised (BtctlController *bc, GError **err);
Check if controller was able to get the Bluetooth HCI connection. If not, we won't be able to do anything like discovery.
| 
 | Bluetooth controller object. | 
| 
 | An error message (if applicable). | 
| Returns : | TRUE if initialised OK. | 
int                 btctl_controller_get_signal_strength
                                                        (BtctlController *bc,
                                                         const gchar *bdaddr,
                                                         GError **err);
Bluetooth allows the monitoring of the signal strength of an established connection. There must be an existing connection for this function to work.
| 
 | Bluetooth controller object. | 
| 
 | Destination device address. | 
| 
 | GError | 
| Returns : | integer representing the signal strength. | 
"hci-device" property"hci-device" gchar* : Write / Construct Only
HCI device.
Default value: NULL
"add-device" signalvoid user_function (BtctlController *btctlcontroller, gchar *arg1, guint arg2, gpointer user_data) : Run First
Emitted when a device has been discovered.
| 
 | the object which received the signal. | 
| 
 | device bdaddr | 
| 
 | device class flags | 
| 
 | user data set when the signal handler was connected. | 
"add-device-service" signalvoid user_function (BtctlController *btctlcontroller, gchar *arg1, gchar *arg2, guint arg3, guint arg4, gpointer user_data) : Run First
Emitted when a service record is found for a device.
| 
 | the object which received the signal. | 
| 
 | bdaddr of the device. | 
| 
 | name of the device. | 
| 
 | SDP class ID of the service. | 
| 
 | RFCOMM port the service is on, if any. | 
| 
 | user data set when the signal handler was connected. | 
"device-name" signalvoid user_function (BtctlController *btctlcontroller, gchar *arg1, gchar *arg2, gpointer user_data) : Run First
Emitted when a response is received to a name query.
| 
 | the object which received the signal. | 
| 
 | bdaddr of device | 
| 
 | name of device | 
| 
 | user data set when the signal handler was connected. | 
"status-change" signalvoid user_function (BtctlController *btctlcontroller, gint arg1, gpointer user_data) : Run First
Emitted when the discovery process changes phase.
| 
 | the object which received the signal. | 
| 
 | status indicator | 
| 
 | user data set when the signal handler was connected. |