summaryrefslogtreecommitdiff
path: root/src/bluetooth-device.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bluetooth-device.c')
-rw-r--r--src/bluetooth-device.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/bluetooth-device.c b/src/bluetooth-device.c
index 2fc478d..3c17967 100644
--- a/src/bluetooth-device.c
+++ b/src/bluetooth-device.c
@@ -278,6 +278,46 @@ int bt_device_unset_connection_state_changed_cb(void)
return BT_ERROR_NONE;
}
+int bt_device_connect_le(bt_device_gatt_state_changed_cb callback, const char *address)
+{
+ int ret;
+ bluetooth_device_address_t bd_addr = { {0,} };
+
+ BT_CHECK_INIT_STATUS();
+ BT_CHECK_INPUT_PARAMETER(address);
+
+ _bt_set_cb(BT_EVENT_GATT_CONNECTION_STATUS, callback, NULL);
+
+ _bt_convert_address_to_hex(&bd_addr, address);
+
+ ret = _bt_get_error_code(bluetooth_connect_le(&bd_addr));
+
+ if (ret != BT_ERROR_NONE) {
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(ret), ret);
+ }
+ return ret;
+}
+
+int bt_device_disconnect_le(bt_device_gatt_state_changed_cb callback, const char *address)
+{
+ int ret;
+ bluetooth_device_address_t bd_addr = { {0,} };
+
+ BT_CHECK_INIT_STATUS();
+ BT_CHECK_INPUT_PARAMETER(address);
+
+ _bt_convert_address_to_hex(&bd_addr, address);
+
+ _bt_set_cb(BT_EVENT_GATT_CONNECTION_STATUS, callback, NULL);
+
+ ret = _bt_get_error_code(bluetooth_disconnect_le(&bd_addr));
+
+ if (ret != BT_ERROR_NONE) {
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(ret), ret);
+ }
+ return ret;
+}
+
int bt_device_read_rssi_value(const char *address)
{
int ret;