{BT_UPDATE_LE_CONNECTION_MODE, "BT_UPDATE_LE_CONNECTION_MODE"},
{BT_SET_PROFILE_TRUSTED, "BT_SET_PROFILE_TRUSTED"},
{BT_GET_PROFILE_TRUSTED, "BT_GET_PROFILE_TRUSTED"},
+ {BT_DISCONNECT_DEVICE, "BT_DISCONNECT_DEVICE"},
{BT_HID_CONNECT, "BT_HID_CONNECT"},
{BT_HID_DISCONNECT, "BT_HID_DISCONNECT"},
{BT_HID_DEVICE_ACTIVATE, "BT_HID_DEVICE_ACTIVATE"},
#include "bt-dpm.h"
#endif
+BT_EXPORT_API int bluetooth_disconnect_device(const bluetooth_device_address_t *remote_address)
+{
+ int result;
+
+ BT_CHECK_PARAMETER(remote_address, return);
+ BT_CHECK_ENABLED(return);
+
+ BT_INIT_PARAMS();
+ BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+ g_array_append_vals(in_param1, remote_address, sizeof(bluetooth_device_address_t));
+
+ result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DISCONNECT_DEVICE,
+ in_param1, in_param2, in_param3, in_param4, &out_param);
+
+ BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+ return result;
+}
+
BT_EXPORT_API int bluetooth_bond_device(const bluetooth_device_address_t *device_address)
{
int result;
break;
}
+ case BT_DISCONNECT_DEVICE: {
+ bluetooth_device_address_t addr = { {0} };
+ char address[BLUETOOTH_ADDRESS_STRING_LENGTH + 1];
+
+ __bt_service_get_parameters(in_param1,
+ &addr, sizeof(bluetooth_device_address_t));
+ _bt_convert_addr_type_to_string(address, addr.addr);
+
+ result = _bt_disconnect_all(address);
+ break;
+ }
case BT_BOND_DEVICE: {
bluetooth_device_address_t address = { {0} };
case BT_SET_PASSKEY_NOTIFICATION:
case BT_SET_PROFILE_RESTRICTED:
+ case BT_DISCONNECT_DEVICE:
case BT_CANCEL_SEARCH_SERVICE:
case BT_ENABLE_RSSI:
{BT_GET_PROFILE_CONNECTED_DEVICES, "BT_GET_PROFILE_CONNECTED_DEVICES"},
{BT_ENABLE_FORCE_HCI_DUMP, "BT_ENABLE_FORCE_HCI_DUMP"},
{BT_SET_PASSKEY_NOTIFICATION, "BT_SET_PASSKEY_NOTIFICATION"},
+ {BT_DISCONNECT_DEVICE, "BT_DISCONNECT_DEVICE"},
{BT_BOND_DEVICE, "BT_BOND_DEVICE"},
{BT_BOND_DEVICE_BY_TYPE, "BT_BOND_DEVICE_BY_TYPE"},
{BT_CANCEL_BONDING, "BT_CANCEL_BONDING"},
return BLUETOOTH_ERROR_NONE;
}
+int _bt_disconnect_all(char *address)
+{
+ int ret = BLUETOOTH_ERROR_NONE;
+ char *object_path;
+ GDBusProxy *proxy;
+ GDBusConnection *conn;
+ GVariant *result = NULL;
+ GError *err = NULL;
+
+ BT_DBG("");
+ conn = _bt_gdbus_get_system_gconn();
+ retv_if(conn == NULL, BLUETOOTH_ERROR_INTERNAL);
+
+ object_path = _bt_get_device_object_path(address);
+ retv_if(object_path == NULL, BLUETOOTH_ERROR_INTERNAL);
+
+ proxy = g_dbus_proxy_new_sync(conn, G_DBUS_PROXY_FLAGS_NONE,
+ NULL, BT_BLUEZ_NAME,
+ object_path, BT_DEVICE_INTERFACE, NULL, NULL);
+ g_free(object_path);
+ retv_if(proxy == NULL, BLUETOOTH_ERROR_INTERNAL);
+
+ result = g_dbus_proxy_call_sync(proxy, "Disconnect",
+ NULL,
+ G_DBUS_CALL_FLAGS_NONE,
+ -1, NULL,
+ &err);
+
+ if (err != NULL) {
+ BT_ERR("Dbus Call Error:[%s]", err->message);
+ g_error_free(err);
+ ret = BLUETOOTH_ERROR_INTERNAL;
+ }
+
+ g_object_unref(proxy);
+ if (result)
+ g_variant_unref(result);
+
+ return ret;
+}
+
int _bt_disconnect_profile(char *address, char *uuid,
void *cb, gpointer func_data)
{
int _bt_connect_profile(char *address, char *uuid,
void *cb, gpointer func_data);
+int _bt_disconnect_all(char *address);
+
int _bt_disconnect_profile(char *address, char *uuid,
void *cb, gpointer func_data);
int bluetooth_is_connectable(gboolean *is_connectable);
+int bluetooth_disconnect_device(const bluetooth_device_address_t *device_address);
+
/**
* @fn int bluetooth_bond_device(const bluetooth_device_address_t *device_address)
* @brief Initiate a bonding process
BT_UPDATE_LE_CONNECTION_MODE,
BT_SET_PROFILE_TRUSTED,
BT_GET_PROFILE_TRUSTED,
+ BT_DISCONNECT_DEVICE,
BT_HID_CONNECT = BT_FUNC_HID_BASE,
BT_HID_DISCONNECT,
BT_HID_DEVICE_ACTIVATE,