return BT_STATUS_SUCCESS;
}
+static void __le_disconnection_req_cb(GDBusProxy *proxy, GAsyncResult *res,
+ gpointer user_data)
+{
+ GError *g_error = NULL;
+ GVariant *reply = NULL;
+
+ DBG("+");
+
+ reply = g_dbus_proxy_call_finish(proxy, res, &g_error);
+ g_object_unref(proxy);
+ if (reply == NULL) {
+ ERR("Disconnect LE Dbus Call Error");
+ if (g_error) {
+ ERR("Error: %s\n", g_error->message);
+ g_clear_error(&g_error);
+ }
+ }
+ g_variant_unref(reply);
+}
+
+
static bt_status_t gatt_server_close(int server_if, const bt_bdaddr_t *bd_addr, int conn_id)
{
CHECK_BTGATT_INIT();
+
+ char device_address[BT_HAL_ADDRESS_STRING_SIZE] = { 0 };
+ gchar *device_path;
+ GDBusProxy *device_proxy;
+ GDBusConnection *g_conn;
+ struct gatt_client_info_t *conn_info = NULL;
+
+ INFO("+");
+
+ if (NULL == bd_addr) {
+ ERR("bd_addr is NULL");
+ return BT_STATUS_PARM_INVALID;
+ }
+
+ /* GDBUS Connection Info validate */
+ g_conn = _bt_hal_get_system_gconn();
+ if (g_conn == NULL) {
+ ERR("Could not get System DBUS Connection");
+ return BT_STATUS_FAIL;
+ }
+
+ /* Connection Info validate */
+ conn_info = __bt_find_remote_gatt_client_info_from_conn(conn_id);
+ if (conn_info == NULL) {
+ ERR("No Connection Inforamtion!!!");
+ return BT_STATUS_FAIL;
+ }
+
+ _bt_hal_convert_addr_type_to_string(device_address,
+ (unsigned char *)bd_addr->address);
+
+ //check if connection has the same device address
+ if (g_strcmp0(conn_info->addr, device_address) != 0) {
+ ERR("device address [%s] does not match", device_address);
+ return BT_STATUS_FAIL;
+ }
+
+ device_path = _bt_hal_get_device_object_path(conn_info->addr);
+ if (device_path == NULL) {
+ ERR("device_path is NULL");
+ return BT_STATUS_PARM_INVALID;
+ }
+
+ device_proxy = g_dbus_proxy_new_sync(g_conn, G_DBUS_PROXY_FLAGS_NONE,
+ NULL, BT_HAL_BLUEZ_NAME,
+ device_path, BT_HAL_DEVICE_INTERFACE, NULL, NULL);
+
+
+ g_free(device_path);
+ if (device_proxy == NULL)
+ return BT_STATUS_FAIL;
+
+ INFO("Disconnect LE [%s]", device_address);
+
+ g_dbus_proxy_call(device_proxy, "DisconnectLE",
+ NULL,
+ G_DBUS_CALL_FLAGS_NONE,
+ BT_HAL_MAX_DBUS_TIMEOUT,
+ NULL,
+ (GAsyncReadyCallback)__le_disconnection_req_cb, conn_info);
+
+ INFO("-");
return BT_STATUS_SUCCESS;
}