ev->num_props = 0;
size = sizeof(*ev);
ERR("Error: Failed to get Remote device properties after SDP,"
- " Num Prop [%d] total size [%d]", ev->num_props, size);
+ " Num Prop [%d] total size [%zd]", ev->num_props, size);
event_cb(HAL_EV_REMOTE_DEVICE_PROPS, (void*) buf, size);
cleanup:
}
DBG("Send Remote Device services to HAL,"
- " Num Prop [%d] total size [%d]", ev->num_props, size);
+ " Num Prop [%d] total size [%zd]", ev->num_props, size);
event_cb(HAL_EV_REMOTE_DEVICE_PROPS, (void*) buf, size);
g_variant_unref(result);
ev->num_props = num_props_tmp + 1;
g_free(uuid_value);
}
- } else if (!g_strcmp0(key, "ManufacturerDataLen")) {
+ } else if (!g_strcmp0(key, "LegacyManufacturerDataLen")) {
data_len = g_variant_get_uint16(value);
- DBG("ManufacturerDataLen [%d]", data_len);
- } else if (!g_strcmp0(key, "ManufacturerData")) {
+ DBG("LegacyManufacturerDataLen [%d]", data_len);
+ } else if (!g_strcmp0(key, "LegacyManufacturerData")) {
manufacturer_data = g_byte_array_new();
g_variant_get(value, "ay", &char_value_iter);
while (g_variant_iter_loop(char_value_iter, "y", &char_value))
ev->num_props = 0;
size = sizeof(*ev);
DBG("Send Remote Device properties event to HAL,"
- " Num Prop [%d] total size [%d]", ev->num_props, size);
+ " Num Prop [%d] total size [%zd]", ev->num_props, size);
event_cb(HAL_EV_REMOTE_DEVICE_PROPS, (void*) buf, size);
} else {
if (size > 2) {
DBG("Send Remote Device properties event to HAL,"
- " Num Prop [%d] total size [%d]", ev->num_props, size);
+ " Num Prop [%d] total size [%zd]", ev->num_props, size);
event_cb(HAL_EV_REMOTE_DEVICE_PROPS, (void*) buf, size);
}
}
DBG("-");
return BT_STATUS_SUCCESS;
}
+
+
+int _bt_hal_device_disconnect(const bt_bdaddr_t *bd_addr)
+{
+ GDBusProxy *proxy;
+ char address[BT_HAL_ADDRESS_STRING_SIZE] = { 0 };
+ GError *error = NULL;
+ GVariant *result = NULL;
+ GDBusConnection *conn;
+ char *device_path = NULL;
+ DBG("+");
+
+ conn = _bt_hal_get_system_gconn();
+ if (!conn) {
+ DBG("Could not get DBUS connection!");
+ return BT_STATUS_FAIL;
+ }
+
+ _bt_hal_convert_addr_type_to_string(address, bd_addr->address);
+ device_path = _bt_hal_get_device_object_path(address);
+
+ if (device_path == NULL) {
+ ERR("No created device with address:[%s] in statck", address);
+ return BT_STATUS_FAIL;
+ }
+ proxy = g_dbus_proxy_new_sync(conn, G_DBUS_PROXY_FLAGS_NONE,
+ NULL, BT_HAL_BLUEZ_NAME,
+ device_path, BT_HAL_DEVICE_INTERFACE, NULL, NULL);
+
+ g_free(device_path);
+ if (proxy == NULL) {
+ ERR("Could not get Device Proxy");
+ return BT_STATUS_FAIL;
+ }
+
+ result = g_dbus_proxy_call_sync(proxy, "Disconnect",
+ NULL,
+ G_DBUS_CALL_FLAGS_NONE,
+ -1, NULL,
+ &error);
+
+ if (error != NULL) {
+ ERR("Dbus Call Error:[%s]", error->message);
+ g_clear_error(&error);
+ g_object_unref(proxy);
+ return BT_STATUS_FAIL;
+ }
+
+ g_object_unref(proxy);
+ if (result)
+ g_variant_unref(result);
+
+ DBG("-");
+ return BT_STATUS_SUCCESS;
+}
#endif