Merge "support peripheral mode feature to connect iphone to android device." into klp-wireless-dev
diff --git a/btif/src/btif_gatt_client.c b/btif/src/btif_gatt_client.c
index 6aab986..80c50d0 100644
--- a/btif/src/btif_gatt_client.c
+++ b/btif/src/btif_gatt_client.c
@@ -840,7 +840,7 @@
break;
case BTIF_GATTC_LISTEN:
-#ifdef BLE_PERIPHERAL_MODE_SUPPORT
+#if (defined(BLE_PERIPHERAL_MODE_SUPPORT) && (BLE_PERIPHERAL_MODE_SUPPORT == TRUE))
BTA_GATTC_Listen(p_cb->client_if, p_cb->start, NULL);
#else
BTA_GATTC_Broadcast(p_cb->client_if, p_cb->start);
@@ -1108,6 +1108,10 @@
}
}
+#if (defined(BLE_PERIPHERAL_ADV_NAME) && (BLE_PERIPHERAL_ADV_NAME == TRUE))
+ btif_cb.adv_data.mask |= BTM_BLE_AD_BIT_DEV_NAME;
+#endif
+
return btif_transfer_context(btgattc_handle_event, BTIF_GATTC_SET_ADV_DATA,
(char*) &btif_cb, sizeof(btif_gattc_cb_t), NULL);
}
diff --git a/include/bt_target.h b/include/bt_target.h
index 8d237ec..23e4fdb 100644
--- a/include/bt_target.h
+++ b/include/bt_target.h
@@ -1440,6 +1440,18 @@
#define GATT_CLIENT_ENABLED TRUE
#endif
+#ifndef BLE_PERIPHERAL_MODE_SUPPORT
+#define BLE_PERIPHERAL_MODE_SUPPORT FALSE
+#endif
+
+#ifndef BLE_PERIPHERAL_DISPLAYONLY
+#define BLE_PERIPHERAL_DISPLAYONLY FALSE
+#endif
+
+#ifndef BLE_PERIPHERAL_ADV_NAME
+#define BLE_PERIPHERAL_ADV_NAME FALSE
+#endif
+
#ifndef GATT_MAX_SR_PROFILES
#define GATT_MAX_SR_PROFILES 32 /* max is 32 */
#endif
diff --git a/stack/gatt/gatt_api.c b/stack/gatt/gatt_api.c
index 232b191..54ea0f0 100644
--- a/stack/gatt/gatt_api.c
+++ b/stack/gatt/gatt_api.c
@@ -1295,7 +1295,7 @@
gatt_deregister_bgdev_list(gatt_if);
/* update the listen mode */
-#ifdef BLE_PERIPHERAL_MODE_SUPPORT
+#if (defined(BLE_PERIPHERAL_MODE_SUPPORT) && (BLE_PERIPHERAL_MODE_SUPPORT == TRUE))
GATT_Listen(gatt_if, FALSE, NULL);
#endif
diff --git a/stack/include/btm_ble_api.h b/stack/include/btm_ble_api.h
index 0dcc8d2..584ce9a 100644
--- a/stack/include/btm_ble_api.h
+++ b/stack/include/btm_ble_api.h
@@ -276,8 +276,8 @@
tBTM_BLE_MANU manu; /* manufactuer data */
tBTM_BLE_INT_RANGE int_range; /* slave prefered conn interval range */
tBTM_BLE_SERVICE services; /* services */
- UINT8 flag;
UINT16 appearance;
+ UINT8 flag;
tBTM_BLE_PROPRIETARY *p_proprietary;
}tBTM_BLE_ADV_DATA;
diff --git a/stack/smp/smp_act.c b/stack/smp/smp_act.c
index 3370a2c..47cd2c9 100644
--- a/stack/smp/smp_act.c
+++ b/stack/smp/smp_act.c
@@ -108,6 +108,12 @@
{
p_cb->loc_auth_req = cb_data.io_req.auth_req;
p_cb->loc_io_caps = cb_data.io_req.io_cap;
+#if (defined(BLE_PERIPHERAL_DISPLAYONLY) && (BLE_PERIPHERAL_DISPLAYONLY == TRUE))
+ if (p_cb->role == HCI_ROLE_SLAVE)
+ {
+ p_cb->loc_io_caps = SMP_IO_CAP_OUT;
+ }
+#endif
p_cb->loc_oob_flag = cb_data.io_req.oob_data;
p_cb->loc_enc_size = cb_data.io_req.max_key_size;
p_cb->loc_i_key = cb_data.io_req.init_keys;