int _bt_oob_add_remote_data(
bluetooth_device_address_t *remote_device_address,
- unsigned short address_type,
bt_oob_data_t *remote_oob_data)
{
int i;
return BLUETOOTH_ERROR_INTERNAL;
}
- BT_DBG("address type: %d", address_type);
-
/* Remote address */
dev_addr = g_strdup(address);
/* Call AddRemoteData Method */
reply = g_dbus_proxy_call_sync(proxy, "AddRemoteData",
- g_variant_new("(sy@ay@ay@ay@ay)", dev_addr, address_type,
+ g_variant_new("(s@ay@ay@ay@ay)", dev_addr,
hash192, randomizer192, hash256, randomizer256),
G_DBUS_CALL_FLAGS_NONE, -1,
NULL, &err);
g_object_unref(proxy);
g_free(dev_addr);
- BT_DBG("Add remote OOB data!!");
-
/* Check the reply */
if (reply == NULL) {
BT_ERR("AddRemoteData dBUS-RPC is failed");
}
g_variant_unref(reply);
- BT_DBG("No error");
-
return BLUETOOTH_ERROR_NONE;
}
g_variant_unref(reply);
return BLUETOOTH_ERROR_NONE;
}
+
+int _bt_le_oob_read_local_data(bt_oob_data_t *local_oob_data)
+{
+ GDBusProxy *proxy;
+ GVariant *reply;
+ GError *err = NULL;
+ char *adapter_path;
+ GDBusConnection *conn;
+ GVariant *eir = NULL;
+
+ BT_CHECK_PARAMETER(local_oob_data, return);
+
+ conn = _bt_gdbus_get_system_gconn();
+ retv_if(conn == NULL, BLUETOOTH_ERROR_INTERNAL);
+
+ adapter_path = _bt_get_adapter_path();
+ retv_if(adapter_path == NULL, BLUETOOTH_ERROR_INTERNAL);
+
+ proxy = g_dbus_proxy_new_sync(conn,
+ G_DBUS_PROXY_FLAGS_NONE, NULL,
+ BT_BLUEZ_NAME, adapter_path,
+ BT_OOB_INTERFACE, NULL, &err);
+ g_free(adapter_path);
+ if (!proxy) {
+ BT_ERR("Unable to create proxy");
+ if (err) {
+ BT_ERR("Error: %s", err->message);
+ g_clear_error(&err);
+ }
+ return BLUETOOTH_ERROR_INTERNAL;
+ }
+
+ if (device_power_request_lock(POWER_LOCK_CPU, 2000) != DEVICE_ERROR_NONE)
+ BT_ERR("device_power_request_lock() failed");
+ else
+ BT_ERR("device_power_request_lock() succeed");
+
+ reply = g_dbus_proxy_call_sync(proxy, "LEReadLocalData",
+ NULL,
+ G_DBUS_CALL_FLAGS_NONE, -1,
+ NULL, &err);
+ g_object_unref(proxy);
+
+ if (reply == NULL) {
+ BT_ERR("LEReadLocalData dBUS-RPC is failed");
+ if (err != NULL) {
+ BT_ERR("D-Bus API failure: errCode[%x], message[%s]",
+ err->code, err->message);
+ g_clear_error(&err);
+ }
+ return BLUETOOTH_ERROR_INTERNAL;
+ }
+
+ g_variant_get(reply, "(@ay)", &eir);
+ g_variant_unref(reply);
+
+ if (eir) {
+ local_oob_data->eir_len = __get_oob_data_from_variant(eir,
+ local_oob_data->eir,
+ sizeof(local_oob_data->eir));
+ g_variant_unref(eir);
+ }
+
+ return BLUETOOTH_ERROR_NONE;
+}
+