]> granicus.if.org Git - esp-idf/commitdiff
Merge remote-tracking branch 'remotes/origin/feature/btdm_arch_debug1' into feature...
authorTian Hao <tianhao@espressif.com>
Mon, 21 Nov 2016 06:50:51 +0000 (14:50 +0800)
committerTian Hao <tianhao@espressif.com>
Mon, 21 Nov 2016 06:50:51 +0000 (14:50 +0800)
# Conflicts:
# components/bt/bluedroid/api/include/esp_gatt_defs.h
# components/bt/bluedroid/btc/profile/std/gap/btc_gap_ble.c

13 files changed:
1  2 
components/bt/bluedroid/api/esp_gap_ble_api.c
components/bt/bluedroid/api/include/esp_gap_ble_api.h
components/bt/bluedroid/api/include/esp_gatt_defs.h
components/bt/bluedroid/btc/core/btc_task.c
components/bt/bluedroid/btc/profile/std/gap/btc_gap_ble.c
examples/10_gatt_client/Makefile
examples/10_gatt_client/README.rst
examples/10_gatt_client/components/bluedroid_demos/app_core/bt_app_core.c
examples/10_gatt_client/components/bluedroid_demos/app_project/Arch_SimpleClientProject.c
examples/10_gatt_client/components/bluedroid_demos/component.mk
examples/10_gatt_client/components/bluedroid_demos/include/bt_app_common.h
examples/10_gatt_client/main/component.mk
examples/10_gatt_client/main/demo_main.c

index 37e4f295cf2816a2a214d5a863a1559003850ceb,dfba3798566280bcdd5c2faba7f2eeac8574be69..72b3e1c26ca4d0de5e45c63f094f1bc3e54dc3b8
@@@ -70,12 -70,24 +70,24 @@@ esp_err_t esp_ble_gap_start_scanning(ui
  
        msg.sig = BTC_SIG_API_CALL;
        msg.pid = BTC_PID_GAP_BLE;
-       msg.act = BTC_GAP_BLE_ACT_SET_SCAN_PARAM;
+       msg.act = BTC_GAP_BLE_ACT_START_SCAN;
        arg.duration = duration;
  
 -      return (btc_transfer_context(&msg, &arg, sizeof(esp_ble_gap_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
 +      return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
  }
  
 -      esp_ble_gap_args_t arg;
+ esp_err_t esp_ble_gap_stop_scanning(void)
+ {
+       btc_msg_t msg;
 -      return (btc_transfer_context(&msg, &arg, sizeof(esp_ble_gap_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
++      btc_ble_gap_args_t arg;
+       msg.sig = BTC_SIG_API_CALL;
+       msg.pid = BTC_PID_GAP_BLE;
+       msg.act = BTC_GAP_BLE_ACT_STOP_SCAN;
++      return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+ }
  esp_err_t esp_ble_gap_start_advertising(esp_ble_adv_params_t *adv_params)
  {
        btc_msg_t msg;
@@@ -170,6 -182,38 +182,38 @@@ esp_err_t esp_ble_gap_set_device_name(c
        msg.act = BTC_GAP_BLE_ACT_SET_DEV_NAME;
        strcpy(arg.device_name, name);
  
 -      return (btc_transfer_context(&msg, &arg, sizeof(esp_ble_gap_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
 +      return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
  }
  
+ /*******************************************************************************
+ **
+ ** Function           esp_ble_resolve_adv_data
+ **
+ ** Description       This function is called to get ADV data for a specific type.
+ **
+ ** Parameters       p_adv - pointer of ADV data
+ **                    type   - finding ADV data type
+ **                    p_length - return the length of ADV data not including type
+ **
+ ** Returns            pointer of ADV data
+ **
+ *******************************************************************************/
+ uint8_t *esp_ble_resolve_adv_data( uint8_t *p_adv, uint8_t type, uint8_t *p_length )
+ {
+     if (((type < ESP_BLE_AD_TYPE_FLAG) || (type > ESP_BLE_AD_TYPE_128SERVICE_DATA)) &&
+        (type != ESP_BLE_AD_MANUFACTURER_SPECIFIC_TYPE))
+     {
+               LOG_ERROR("the eir type not define, type = %x\n", type);
+               return NULL;
+     }
+    if (p_adv == NULL)
+    {
+       LOG_ERROR("Invalid p_eir data.\n");
+       return NULL;
+    }
+    return (BTM_CheckAdvData( p_adv, type, p_length));
+ }
index 7a4f8413f85c936e6087b796a574cb5edb33aecd,8b15122410c2bf6842d0b60edcef43d52e407ec0..af3469574c5b23bcd64ae19b1c27b3c5439a1d26
@@@ -58,18 -92,36 +88,36 @@@ typedef struct 
        bool                                    set_scan_rsp;
        bool                                    include_name;
        bool                                    include_txpower;
 -      int                                     min_interval;
 -      int                                     max_interval;
 -      int                                     appearance;
 +      int                                             min_interval;
 +      int                                             max_interval;
 +      int                                             appearance;
        uint16_t                                manufacturer_len;
 -      uint8_t                         *p_manufacturer_data;
 +      uint8_t                                 *p_manufacturer_data;
        uint16_t                                service_data_len;
 -      uint8_t                         *p_service_data;
 +      uint8_t                                 *p_service_data;
        uint16_t                                service_uuid_len;
 -      uint8_t                         *p_service_uuid;
 -      uint8_t                    flag;
 +      uint8_t                                 *p_service_uuid;
 +      uint8_t                 flag;
  } esp_ble_adv_data_t;
  
+ /// Own BD address source of the device
+ typedef enum 
+ {
+    /// Public Address
+    ESP_PUBLIC_ADDR,
+    /// Provided random address
+    ESP_PROVIDED_RND_ADDR,
+    /// Provided static random address
+    ESP_GEN_STATIC_RND_ADDR,
+    /// Generated resolvable private random address
+    ESP_GEN_RSLV_ADDR,
+    /// Generated non-resolvable private random address
+    ESP_GEN_NON_RSLV_ADDR,
+    /// Provided Reconnection address
+    ESP_PROVIDED_RECON_ADDR,
+ }esp_ble_own_addr_src_t;
  typedef enum {
        BLE_SCAN_TYPE_PASSIVE   =       0x0,
        BLE_SCAN_TYPE_ACTIVE    =       0x1,
index 1e9d5a7835d70692bcf6c502d5512792865bc698,13d4df4b4a75072286028a6fdb75a7d5753b3dd6..21628559927ad539185185de6176f00589f14e4c
@@@ -114,7 -114,7 +114,8 @@@ typedef enum 
        ESP_GATT_CHAR_PROP_BIT_EXT_PROP         =       (1 << 7),       /* 0x80 */
  } esp_gatt_char_prop_t;
  
 -#define ESP_GATT_MAX_ATTR_LEN   300
 +#define ESP_GATT_MAX_ATTR_LEN 600 //as same as GATT_MAX_ATTR_LEN
++
  typedef struct {
      uint8_t           value[ESP_GATT_MAX_ATTR_LEN];
      uint16_t          handle;
index d9539182d299b9cf5209d75c2dbb4ae29622e672,2e1b5889b7271203ae18d6d2f2cb6eeabedb9b1a..d6c88cec4f14310b5ced2bc04c35c5c3877f2662
@@@ -415,22 -399,21 +416,21 @@@ void btc_ble_start_advertising (esp_ble
                LOG_ERROR("Invalid advertisting type parameters.\n");
                return;
        }
 +      LOG_DEBUG("API_Ble_AppStartAdvertising\n");
  
 -      LOG_ERROR("API_Ble_AppStartAdvertising\n");
 -
 -      bd_addr.type = ble_adv_params->peer_addr_type;
 -      memcpy(&bd_addr.bda, ble_adv_params->peer_addr, sizeof(BD_ADDR));
        ///
 +      memcpy(peer_addr.bda, ble_adv_params->peer_addr, ESP_BD_ADDR_LEN);
 +      peer_addr.type = ble_adv_params->peer_addr_type;
        BTA_DmSetBleAdvParamsAll(ble_adv_params->adv_int_min,
 -                                                         ble_adv_params->adv_int_max,
 -                                                         ble_adv_params->adv_type,
 -                                                         ble_adv_params->own_addr_type,
 -                                                         ble_adv_params->channel_map,
 -                                                         ble_adv_params->adv_filter_policy,
 -                                                         &bd_addr);
 -
 -      
 +                      ble_adv_params->adv_int_max,
 +                      ble_adv_params->adv_type,
 +                      ble_adv_params->own_addr_type,
 +                      ble_adv_params->channel_map,
 +                      ble_adv_params->adv_filter_policy,
 +                      &peer_addr);
 +
 +      /*set connectable,discoverable, pairable and paired only modes of local device*/
 +      BTA_DmSetVisibility(disc_mode, conn_mode, (UINT8)BTA_DM_NON_PAIRABLE, (UINT8)BTA_DM_CONN_ALL);
  }
  
  
index 0000000000000000000000000000000000000000,0000000000000000000000000000000000000000..1e91bbb891193f83fe744eb77aa9c3ae0411fa7f
new file mode 100644 (file)
--- /dev/null
--- /dev/null
@@@ -1,0 -1,0 +1,11 @@@
++#
++# This is a project Makefile. It is assumed the directory this Makefile resides in is a
++# project subdirectory.
++#
++
++PROJECT_NAME := bluedroid_demos
++
++COMPONENT_ADD_INCLUDEDIRS := components/include
++
++include $(IDF_PATH)/make/project.mk
++
index 0000000000000000000000000000000000000000,3b074c72d9a830473f73dcb76be089700341ca83..3b074c72d9a830473f73dcb76be089700341ca83
mode 000000,100644..100644
--- /dev/null
index 0000000000000000000000000000000000000000,71854cfba1014a3328555dae76c5fbfe067cf1a7..71854cfba1014a3328555dae76c5fbfe067cf1a7
mode 000000,100644..100644
--- /dev/null
index 0000000000000000000000000000000000000000,1d1eec6a032d27ab7c2a12a74521bf3c195148f1..1d1eec6a032d27ab7c2a12a74521bf3c195148f1
mode 000000,100644..100644
--- /dev/null
index 0000000000000000000000000000000000000000,81ba2de72b0976fc9be283848a6dad73d1dc229f..81ba2de72b0976fc9be283848a6dad73d1dc229f
mode 000000,100644..100644
--- /dev/null
index 0000000000000000000000000000000000000000,501bfccc97e3ed4799a553b075ecb534c1cbb69e..501bfccc97e3ed4799a553b075ecb534c1cbb69e
mode 000000,100644..100644
--- /dev/null
index 0000000000000000000000000000000000000000,0000000000000000000000000000000000000000..24356f23ed2e292e153170d8edda3dd5dce430aa
new file mode 100644 (file)
--- /dev/null
--- /dev/null
@@@ -1,0 -1,0 +1,10 @@@
++#
++# Main Makefile. This is basically the same as a component makefile.
++#
++# This Makefile should, at the very least, just include $(SDK_PATH)/make/component_common.mk. By default, 
++# this will take the sources in the src/ directory, compile them and link them into 
++# lib(subdirectory_name).a in the build directory. This behaviour is entirely configurable,
++# please read the ESP-IDF documents if you need to do this.
++#
++
++include $(IDF_PATH)/make/component_common.mk
index 0000000000000000000000000000000000000000,a128c1f066980bfa1e30d72c26a836a58de2cf80..a128c1f066980bfa1e30d72c26a836a58de2cf80
mode 000000,100644..100644
--- /dev/null