Add the API function interface for LE OOB pairing 07/124907/1 accepted/tizen/unified/20170418.072731 submit/tizen/20170418.011550
authorDoHyun Pyun <dh79.pyun@samsung.com>
Thu, 13 Apr 2017 04:18:15 +0000 (13:18 +0900)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Thu, 13 Apr 2017 04:18:15 +0000 (13:18 +0900)
Change-Id: Ia266568762687533db3f4be41d9447dcf3b6d253
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
bt-api/bt-oob.c
bt-service-emul/bt-request-handler.c
bt-service-emul/bt-service-oob.c
bt-service-emul/include/bt-service-oob.h
bt-service/bt-request-handler.c
bt-service/bt-service-oob.c
bt-service/include/bt-service-oob.h
include/bluetooth-api.h
test/bluetooth-frwk-test.c

index aefd7c9..3a8788f 100644 (file)
@@ -45,6 +45,7 @@ BT_EXPORT_API int bluetooth_oob_read_local_data(bt_oob_data_t *local_oob_data)
 
 BT_EXPORT_API int bluetooth_oob_add_remote_data(
                        const bluetooth_device_address_t *remote_device_address,
+                       bluetooth_bdaddr_type_e address_type,
                        bt_oob_data_t *remote_oob_data)
 {
        int result;
@@ -59,7 +60,9 @@ BT_EXPORT_API int bluetooth_oob_add_remote_data(
        g_array_append_vals(in_param1, remote_device_address,
                                sizeof(bluetooth_device_address_t));
 
-       g_array_append_vals(in_param2, remote_oob_data, sizeof(bt_oob_data_t));
+       g_array_append_vals(in_param2, &address_type, sizeof(unsigned short));
+
+       g_array_append_vals(in_param3, remote_oob_data, sizeof(bt_oob_data_t));
 
        result = _bt_send_request(BT_BLUEZ_SERVICE, BT_OOB_ADD_REMOTE_DATA,
                in_param1, in_param2, in_param3, in_param4, &out_param);
index a68c921..fba752f 100644 (file)
@@ -1154,14 +1154,17 @@ int __bt_bluez_request(int function_name,
        }
        case BT_OOB_ADD_REMOTE_DATA: {
                bluetooth_device_address_t address = { {0} };
-               bt_oob_data_t local_oob_data;
+               unsigned short address_type;
+               bt_oob_data_t remote_oob_data;
 
                __bt_service_get_parameters(in_param1,
                                &address, sizeof(bluetooth_device_address_t));
                __bt_service_get_parameters(in_param2,
-                               &local_oob_data, sizeof(bt_oob_data_t));
+                               &address_type, sizeof(unsigned short));
+               __bt_service_get_parameters(in_param3,
+                               &remote_oob_data, sizeof(bt_oob_data_t));
 
-               result = _bt_oob_add_remote_data(&address, &local_oob_data);
+               result = _bt_oob_add_remote_data(&address, address_type, &remote_oob_data);
 
                break;
        }
index 1a16a3f..12e9f04 100644 (file)
@@ -32,6 +32,7 @@ int _bt_oob_read_local_data(bt_oob_data_t *local_oob_data)
 
 int _bt_oob_add_remote_data(
                        bluetooth_device_address_t *remote_device_address,
+                       unsigned short address_type,
                        bt_oob_data_t *remote_oob_data)
 {
        BT_CHECK_PARAMETER(remote_device_address, return);
index 4d3b971..239ade9 100644 (file)
@@ -31,6 +31,7 @@ int _bt_oob_read_local_data(bt_oob_data_t *local_oob_data);
 
 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 _bt_oob_remove_remote_data(
index 2a3275f..c017876 100644 (file)
@@ -1298,14 +1298,17 @@ int __bt_bluez_request(int function_name,
        }
        case BT_OOB_ADD_REMOTE_DATA: {
                bluetooth_device_address_t address = { {0} };
+               unsigned short address_type;
                bt_oob_data_t remote_oob_data;
 
                __bt_service_get_parameters(in_param1,
                                &address, sizeof(bluetooth_device_address_t));
                __bt_service_get_parameters(in_param2,
+                               &address_type, sizeof(unsigned short));
+               __bt_service_get_parameters(in_param3,
                                &remote_oob_data, sizeof(bt_oob_data_t));
 
-               result = _bt_oob_add_remote_data(&address, &remote_oob_data);
+               result = _bt_oob_add_remote_data(&address, address_type, &remote_oob_data);
 
                break;
        }
index c5dcc71..09cf034 100644 (file)
@@ -134,6 +134,7 @@ int _bt_oob_read_local_data(bt_oob_data_t *local_oob_data)
 
 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;
@@ -178,6 +179,8 @@ int _bt_oob_add_remote_data(
                return BLUETOOTH_ERROR_INTERNAL;
        }
 
+       BT_DBG("address type: %d", address_type);
+
        /* Remote address */
        dev_addr = g_strdup(address);
 
@@ -221,13 +224,15 @@ int _bt_oob_add_remote_data(
 
        /* Call AddRemoteData Method */
        reply = g_dbus_proxy_call_sync(proxy, "AddRemoteData",
-                       g_variant_new("(s@ay@ay@ay@ay)", dev_addr,
+                       g_variant_new("(sy@ay@ay@ay@ay)", dev_addr, address_type,
                                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");
@@ -240,6 +245,8 @@ int _bt_oob_add_remote_data(
        }
        g_variant_unref(reply);
 
+       BT_DBG("No error");
+
        return BLUETOOTH_ERROR_NONE;
 }
 
index 4d3b971..239ade9 100755 (executable)
@@ -31,6 +31,7 @@ int _bt_oob_read_local_data(bt_oob_data_t *local_oob_data);
 
 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 _bt_oob_remove_remote_data(
index 8adf067..619b52a 100644 (file)
@@ -230,6 +230,15 @@ typedef enum {
 } bluetooth_device_address_type_t;
 
 /**
+ * This is BD Address type defined in kernel BT header
+ */
+typedef enum {
+       BLUETOOTH_BDADDR_BREDR = 0x00,
+       BLUETOOTH_BDADDR_LE_PUBLIC = 0x01,
+       BLUETOOTH_BDADDR_LE_RANDOM = 0x02
+} bluetooth_bdaddr_type_e;
+
+/**
  * This is Bluetooth version
  */
 typedef struct {
@@ -5081,6 +5090,7 @@ int bluetooth_oob_read_local_data(bt_oob_data_t *local_oob_data);
 /**
  * @fn int bluetooth_oob_add_remote_data(
  *                     const bluetooth_device_address_t *remote_device_address,
+ *                     bluetooth_bdaddr_type_e address_type,
  *                     bt_oob_data_t *oob_data)
  * @brief Add/updated the remote device  Hash and Randmizer.
  *
@@ -5092,6 +5102,7 @@ int bluetooth_oob_read_local_data(bt_oob_data_t *local_oob_data);
  *
  * @exception  None
  * @param[in] remote_device_address - Remote device address
+  *          address_type - bdaddr type
  *           remote_oob_data - Ponter to Hash and Randomizer oob data structure
  *
  * @remark     None
@@ -5100,6 +5111,7 @@ int bluetooth_oob_read_local_data(bt_oob_data_t *local_oob_data);
 
 int bluetooth_oob_add_remote_data(
                   const bluetooth_device_address_t *remote_device_address,
+                  bluetooth_bdaddr_type_e address_type,
                   bt_oob_data_t *remote_oob_data);
 
 
index c653d71..05ec47e 100644 (file)
@@ -784,6 +784,7 @@ int test_input_callback(void *data)
                TC_PRT("randomizer_len: %d\n", g_local_oob_data.oob_data.randomizer_len);
 
                if (bluetooth_oob_add_remote_data(&g_local_oob_data.address,
+                       BLUETOOTH_BDADDR_BREDR,
                        &g_local_oob_data.oob_data))
                        TC_PRT("ERROR in bluetooth_oob_add_remote_data\n");
                else