Set the adv flag as per address type 33/114333/1 submit/tizen/20170220.233016
authorInjun Yang <injun.yang@samsung.com>
Mon, 13 Feb 2017 02:51:18 +0000 (11:51 +0900)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Mon, 13 Feb 2017 04:28:16 +0000 (13:28 +0900)
[Model] All
[BinType] AP
[Customer] OPEN

[Issue#] N/A
[Request] Internal
[Occurence Version] N/A

[Problem] Regardless of address type, set adv flag as BLE only
[Cause & Measure] Set the adv flag as per address type
[Checking Method] Scan adv

[Team] Basic Connection
[Developer] Injun Yang
[Solution company] Samsung
[Change Type] Specification change

Change-Id: I865c4461a0ec79667da4b195a0b9d85cbb69aed5
Signed-off-by: Injun Yang <injun.yang@samsung.com>
src/adapter.c

index a2dd114..f649825 100644 (file)
@@ -3766,12 +3766,18 @@ gboolean adapter_le_set_platform_scan_filter_data(struct btd_adapter *adapter,
 }
 #endif
 
-static int set_adv_data_flag(uint8_t *adv_data, uint8_t *data, int data_len)
+static int set_adv_data_flag(uint8_t *adv_data, uint8_t *data, int data_len, void *user_data)
 {
+       struct btd_adapter *adapter = user_data;
+
        adv_data[0] = 2;
        adv_data[1] = EIR_FLAGS;
-       adv_data[2] = EIR_GEN_DISC | EIR_CONTROLLER |
-                       EIR_SIM_HOST | EIR_BREDR_UNSUP;
+
+       if (adapter->le_static_addr.b[5] != 0)
+               adv_data[2] = EIR_GEN_DISC | EIR_CONTROLLER |
+                               EIR_SIM_HOST | EIR_BREDR_UNSUP;
+       else
+               adv_data[2] = EIR_GEN_DISC | EIR_CONTROLLER | EIR_SIM_HOST;
 
        memcpy(adv_data + 3, data, data_len);
        return data_len + 3;
@@ -3863,8 +3869,9 @@ static int set_adv_data_tx_power(uint8_t *adv_data, int adv_len, int8_t tx_power
 }
 
 
-int adapter_le_set_missed_adv_data(uint8_t *p_data, uint8_t data_len,
-               gboolean is_scan_rsp, char *adapter_name, int8_t tx_power, uint8_t **adv_data, int *adv_len)
+static int adapter_le_set_missed_adv_data(uint8_t *p_data, uint8_t data_len,
+               gboolean is_scan_rsp, char *adapter_name, int8_t tx_power, uint8_t **adv_data, int *adv_len,
+               void *user_data)
 {
        uint8_t *data;
        int len;
@@ -3876,7 +3883,7 @@ int adapter_le_set_missed_adv_data(uint8_t *p_data, uint8_t data_len,
        /* In case multi advertising, need to update the below AD type
                since it handled into kernel */
        if (!is_scan_rsp) {
-               len = set_adv_data_flag(data, p_data, data_len);
+               len = set_adv_data_flag(data, p_data, data_len, user_data);
        }
 
        len = set_adv_data_tx_power(data, len, tx_power);
@@ -4235,7 +4242,7 @@ static DBusMessage *adapter_set_advertising_data(DBusConnection *conn,
        }
 
        adapter_le_set_missed_adv_data(value, len, FALSE,
-                       adapter_name, adapter->adv_tx_power, &adv_data, &adv_len);
+                       adapter_name, adapter->adv_tx_power, &adv_data, &adv_len, adapter);
 
        if (adapter_le_is_supported_multi_advertising() && slot_id > 0) {
                if (adapter_le_set_multi_adv_data(slot_id, FALSE, adv_len, adv_data)) {
@@ -4593,7 +4600,7 @@ static DBusMessage *adapter_set_scan_rsp_data(DBusConnection *conn,
        }
 
        adapter_le_set_missed_adv_data(value, len, TRUE,
-                       adapter_name, adapter->adv_tx_power, &adv_data, &adv_len);
+                       adapter_name, adapter->adv_tx_power, &adv_data, &adv_len, adapter);
 
        if (adapter_le_is_supported_multi_advertising() && slot_id > 0) {
                if (adapter_le_set_multi_adv_data(slot_id, TRUE, adv_len, (uint8_t *)adv_data)) {