component/bt : cleanup the spell && redundant

This commit is contained in:
Tian Hao 2016-11-28 14:58:30 +08:00
parent 1173106a20
commit ff8ce12787
21 changed files with 33 additions and 571 deletions

View file

@ -1,106 +0,0 @@
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <stdlib.h> // standard library
#include <string.h>
#include "esp_sec_api.h"
extern void srand (unsigned int seed);
extern int random (void);
/// Application Security Environment Structure
tAPP_SEC_ENV app_sec_env;
/*******************************************************************************
**
** Function app_ble_sec_gen_tk
**
** Description This function is called to generate the ble tk
**
** Returns the generate tk value
**
*******************************************************************************/
UINT32 app_ble_sec_gen_tk(void)
{
// Generate a PIN Code (Between 100000 and 999999)
return (100000 + (random() % 900000));
}
/*******************************************************************************
**
** Function app_ble_sec_gen_ltk
**
** Description This function is called to generate the ble ltk
**
** Returns NULL
**
*******************************************************************************/
void app_ble_sec_gen_ltk(UINT8 key_size)
{
// Counter
UINT8 i;
app_sec_env.key_size = key_size;
// Randomly generate the LTK and the Random Number
for (i = 0; i < RAND_NB_LEN; i++) {
app_sec_env.rand_nb.nb[i] = random() % 256;
}
// Randomly generate the end of the LTK
for (i = 0; i < SEC_KEY_LEN; i++) {
app_sec_env.ltk.key[i] = (((key_size) < (16 - i)) ? 0 : random() % 256);
}
// Randomly generate the EDIV
app_sec_env.ediv = random() % 65536;
}
/*******************************************************************************
**
** Function app_ble_sec_init
**
** Description This function is init the security env and function
**
** Returns NULL
**
*******************************************************************************/
void app_ble_sec_init()
{
// Reset Security Environment
memset(&app_sec_env, 0, sizeof(app_sec_env));
}
/*******************************************************************************
**
** Function app_ble_security_start
**
** Description This function is called by the slave when the seurity start
**
** Returns NULL
**
*******************************************************************************/
void app_ble_security_start(void)
{
}

View file

@ -172,7 +172,7 @@ esp_err_t esp_ble_gap_config_local_privacy (bool privacy_enable)
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_set_device_name(char *name)
esp_err_t esp_ble_gap_set_device_name(const char *name)
{
btc_msg_t msg;
btc_ble_gap_args_t arg;

View file

@ -1,18 +0,0 @@
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "esp_gap_bt_api.h"
#include "bta_api.h"
#include "bt_trace.h"

View file

@ -125,7 +125,7 @@ esp_err_t esp_ble_gattc_open(esp_gatt_if_t gatt_if, esp_bd_addr_t remote_bda, bo
**
** @brief Close a connection to a GATT server.
**
** @param[in] conn_id: connectino ID to be closed.
** @param[in] conn_id: connection ID to be closed.
**
** @return ESP_OK - success, other - failed
**
@ -343,8 +343,8 @@ esp_err_t esp_ble_gattc_get_included_service(uint16_t conn_id,
** @brief This function is called to read a service's characteristics of
** the given characteritisc ID.UTH_REQ_NO_SCATTERNET
**
** @param[in] conn_id - connectino ID.
** @param[in] srvc_id - serivcie ID.
** @param[in] conn_id - connection ID.
** @param[in] srvc_id - service ID.
** @param[in] char_id - characteritic ID to read.
** @param[in] auth_req - authenticate request type
**
@ -375,7 +375,7 @@ esp_err_t esp_ble_gattc_read_char (uint16_t conn_id, esp_gatt_srvc_id_t *srvc_id
** @brief This function is called to read a characteristics descriptor.
**
** @param[in] conn_id - connection ID.
** @param[in] srvc_id - serivcie ID.
** @param[in] srvc_id - service ID.
** @param[in] descr_id - characteritic descriptor ID to read.
** @param[in] auth_req - authenticate request type
**
@ -410,7 +410,7 @@ esp_err_t esp_ble_gattc_read_char_descr (uint16_t conn_id,
** @brief This function is called to write characteristic value.
**
** @param[in] conn_id - connection ID.
** @param[in] srvc_id - serivcie ID.
** @param[in] srvc_id - service ID.
** @param[in] char_id - characteristic ID to write.
** @param[in] value_len: length of the value to be written.
** @param[in] value - the value to be written.
@ -448,7 +448,7 @@ esp_err_t esp_ble_gattc_write_char( uint16_t conn_id,
** @brief This function is called to write characteristic descriptor value.
**
** @param[in] conn_id - connection ID
** @param[in] srvc_id - serivcie ID.
** @param[in] srvc_id - service ID.
** @param[in] char_id - characteristic ID.
** @param[in] descr_id - characteristic descriptor ID to write.
** @param[in] value_len: length of the value to be written.

View file

@ -73,7 +73,7 @@ esp_err_t esp_ble_gatts_create_service(esp_gatt_if_t gatt_if,
}
esp_err_t esp_ble_gatts_add_include_service(uint16_t service_handle, uint16_t included_service_handle)
esp_err_t esp_ble_gatts_add_included_service(uint16_t service_handle, uint16_t included_service_handle)
{
btc_msg_t msg;
btc_ble_gatts_args_t arg;

View file

@ -1,125 +0,0 @@
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "esp_sdp_api.h"
esp_err_t esp_bt_sdp_enable(bt_sdp_cb_t *cback)
{
tBTA_SDP_STATUS status = BTA_SdpEnable((tBTA_SDP_DM_CBACK *)cback);
return (status == BTA_SDP_SUCCESS) ? ESP_OK : ESP_FAIL;
}
esp_err_t esp_bt_sdp_search(esp_bd_addr_t bd_addr, esp_bt_uuid_t *uuid)
{
tBTA_SDP_STATUS status = BTA_SdpSearch(bd_addr, (tSDP_UUID *)uuid);
return (status == BTA_SDP_SUCCESS) ? ESP_OK : ESP_FAIL;
}
esp_err_t esp_bt_sdp_create_record_by_user(void *user_data)
{
tBTA_SDP_STATUS status = BTA_SdpCreateRecordByUser(user_data);
return (status == BTA_SDP_SUCCESS) ? ESP_OK : ESP_FAIL;
}
esp_err_t esp_bt_sdp_remove_record_by_user(void *user_data)
{
tBTA_SDP_STATUS status = BTA_SdpRemoveRecordByUser(user_data);
return (status == BTA_SDP_SUCCESS) ? ESP_OK : ESP_FAIL;
}
/**********************************************************************************************/
/**********************************************************************************************/
/* API into SDP for local service database updates */
/* these APIs are indended to be called in callback function in the context of stack task,
* to handle BT_SDP_CREATE_RECORD_USER_EVT and BT_SDP_REMOVE_RECORD_USER_EVT
*/
uint32_t esp_bt_sdp_create_record(void)
{
return SDP_CreateRecord();
}
bool esp_bt_sdp_delete_record(uint32_t handle)
{
return SDP_DeleteRecord(handle);
}
int32_t esp_bt_sdp_read_record(uint32_t handle, uint8_t *data, int32_t *data_len)
{
return SDP_ReadRecord(handle, data, data_len);
}
bool esp_bt_sdp_add_attribute (uint32_t handle, uint16_t attr_id,
uint8_t attr_type, uint32_t attr_len,
uint8_t *p_val)
{
return SDP_AddAttribute(handle, attr_id, attr_type, attr_len, p_val);
}
bool esp_bt_sdp_add_sequence (uint32_t handle, uint16_t attr_id,
uint16_t num_elem, uint8_t type[],
uint8_t len[], uint8_t *p_val[])
{
return SDP_AddSequence(handle, attr_id, num_elem, type, len, p_val);
}
bool esp_bt_sdp_add_uuid_sequence (uint32_t handle, uint16_t attr_id,
uint16_t num_uuids, uint16_t *p_uuids)
{
return SDP_AddUuidSequence(handle, attr_id, num_uuids, p_uuids);
}
bool esp_bt_sdp_add_protocol_list (uint32_t handle, uint16_t num_elem,
sdp_proto_elem_t *p_elem_list)
{
return SDP_AddProtocolList(handle, num_elem, (tSDP_PROTOCOL_ELEM *)p_elem_list);
}
bool esp_bt_sdp_add_addition_protocol_lists(uint32_t handle, uint16_t num_elem,
sdp_proto_list_elem_t *p_proto_list)
{
return SDP_AddAdditionProtoLists(handle, num_elem, (tSDP_PROTO_LIST_ELEM *)p_proto_list);
}
bool esp_bt_sdp_add_profile_dscp_list (uint32_t handle,
uint16_t profile_uuid,
uint16_t version)
{
return SDP_AddProfileDescriptorList(handle, profile_uuid, version);
}
bool esp_bt_sdp_add_lang_base_attr_id_list(uint32_t handle,
uint16_t lang, uint16_t char_enc,
uint16_t base_id)
{
return SDP_AddLanguageBaseAttrIDList(handle, lang, char_enc, base_id);
}
bool esp_bt_sdp_add_service_class_id_list(uint32_t handle,
uint16_t num_services,
uint16_t *p_service_uuids)
{
return SDP_AddServiceClassIdList(handle, num_services, p_service_uuids);
}
bool esp_bt_sdp_delete_attribute(uint32_t handle, uint16_t attr_id)
{
return SDP_DeleteAttribute(handle, attr_id);
}
/**********************************************************************************************/
/**********************************************************************************************/

View file

@ -369,7 +369,7 @@ esp_err_t esp_ble_gap_config_local_privacy (bool privacy_enable);
** @return ESP_OK - success, other - failed
**
*******************************************************************************/
esp_err_t esp_ble_gap_set_device_name(char *name);
esp_err_t esp_ble_gap_set_device_name(const char *name);
/*******************************************************************************
@ -385,6 +385,6 @@ esp_err_t esp_ble_gap_set_device_name(char *name);
** @return pointer of ADV data
**
*******************************************************************************/
uint8_t *esp_ble_resolve_adv_data( uint8_t *p_adv, uint8_t type, uint8_t *p_length );
uint8_t *esp_ble_resolve_adv_data(uint8_t *p_adv, uint8_t type, uint8_t *p_length);
#endif /* __ESP_GAP_BLE_API_H__ */

View file

@ -1,31 +0,0 @@
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef __ESP_GAP_BT_API_H__
#define __ESP_GAP_BT_API_H__
#include <stdint.h>
#include "esp_err.h"
#include "esp_bt_defs.h"
typedef enum {
BT_SCAN_MODE_NONE = 0,
BT_SCAN_MODE_CONNECTABLE,
BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE
} bt_scan_mode_t;
esp_err_t esp_bt_gap_set_scan_mode(bt_scan_mode_t mode);
#endif /* __ESP_GAP_BT_API_H__ */

View file

@ -274,7 +274,7 @@ esp_err_t esp_ble_gattc_open(esp_gatt_if_t gatt_if, esp_bd_addr_t remote_bda, bo
**
** @brief Close a connection to a GATT server.
**
** @param[in] conn_id: connectino ID to be closed.
** @param[in] conn_id: connection ID to be closed.
**
** @return ESP_OK - success, other - failed
**
@ -387,8 +387,8 @@ esp_err_t esp_ble_gattc_get_included_service(uint16_t conn_id,
** @brief This function is called to read a service's characteristics of
** the given characteritisc ID.UTH_REQ_NO_SCATTERNET
**
** @param[in] conn_id - connectino ID.
** @param[in] srvc_id - serivcie ID.
** @param[in] conn_id - connection ID.
** @param[in] srvc_id - service ID.
** @param[in] char_id - characteritic ID to read.
** @param[in] auth_req - authenticate request type
**
@ -409,7 +409,7 @@ esp_err_t esp_ble_gattc_read_char (uint16_t conn_id,
** @brief This function is called to read a characteristics descriptor.
**
** @param[in] conn_id - connection ID.
** @param[in] srvc_id - serivcie ID.
** @param[in] srvc_id - service ID.
** @param[in] descr_id - characteritic descriptor ID to read.
** @param[in] auth_req - authenticate request type
**
@ -430,7 +430,7 @@ esp_err_t esp_ble_gattc_read_char_descr (uint16_t conn_id,
** @brief This function is called to write characteristic value.
**
** @param[in] conn_id - connection ID.
** @param[in] srvc_id - serivcie ID.
** @param[in] srvc_id - service ID.
** @param[in] char_id - characteristic ID to write.
** @param[in] value_len: length of the value to be written.
** @param[in] value - the value to be written.
@ -453,7 +453,7 @@ esp_err_t esp_ble_gattc_write_char( uint16_t conn_id,
** @brief This function is called to write characteristic descriptor value.
**
** @param[in] conn_id - connection ID
** @param[in] srvc_id - serivcie ID.
** @param[in] srvc_id - service ID.
** @param[in] char_id - characteristic ID.
** @param[in] descr_id - characteristic descriptor ID to write.
** @param[in] value_len: length of the value to be written.

View file

@ -193,7 +193,7 @@ esp_err_t esp_ble_gatts_register_callback(esp_profile_cb_t callback);
**
** @function esp_ble_gatts_app_register
**
** @brief This function is called to register application identity
** @brief This function is called to register application identifier
**
**
** @return ESP_OK - success, other - failed
@ -241,7 +241,7 @@ esp_err_t esp_ble_gatts_create_service(esp_gatt_if_t gatt_if,
/*******************************************************************************
**
** @function esp_ble_gatts_add_include_service
** @function esp_ble_gatts_add_included_service
**
** @brief This function is called to add an included service. After included
** service is included, a callback event BTA_GATTS_ADD_INCL_SRVC_EVT
@ -254,7 +254,7 @@ esp_err_t esp_ble_gatts_create_service(esp_gatt_if_t gatt_if,
** @return ESP_OK - success, other - failed
**
*******************************************************************************/
esp_err_t esp_ble_gatts_add_include_service(uint16_t service_handle, uint16_t included_service_handle);
esp_err_t esp_ble_gatts_add_included_service(uint16_t service_handle, uint16_t included_service_handle);
@ -407,7 +407,7 @@ esp_err_t esp_ble_gatts_open(esp_gatt_if_t gatt_if, esp_bd_addr_t remote_bda, bo
**
** @brief Close a connection a remote device.
**
** @param[in] conn_id: connectino ID to be closed.
** @param[in] conn_id: connection ID to be closed.
**
** @return ESP_OK - success, other - failed
**

View file

@ -1,129 +0,0 @@
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef __ESP_SDP_API_H__
#define __ESP_SDP_API_H__
#include <stdint.h>
#include "esp_err.h"
#include "esp_bt_defs.h"
#include "bta_sdp_api.h"
#include "bt_sdp.h"
#define BT_SDP_STAT_SUCCESS BTA_SDP_SUCCESS
#define BT_SDP_STAT_FAILURE BTA_SDP_FAILURE
#define BT_SDP_STAT_BUSY BTA_SDP_BUSY
#define BT_SDP_ENABLE_EVT BTA_SDP_ENABLE_EVT
#define BT_SDP_SEARCH_EVT BTA_SDP_SEARCH_EVT
#define BT_SDP_SEARCH_COMP_EVT BTA_SDP_SEARCH_COMP_EVT
#define BT_SDP_CREATE_RECORD_USER_EVT BTA_SDP_CREATE_RECORD_USER_EVT
#define BT_SDP_REMOVE_RECORD_USER_EVT BTA_SDP_REMOVE_RECORD_USER_EVT
#define BT_SDP_MAX_EVT BTA_SDP_MAX_EVT
#define BT_SDP_MAX_RECORDS BTA_SDP_MAX_RECORDS
typedef tBTA_SDP_STATUS bt_sdp_status_t;
typedef tBTA_SDP_EVT bt_sdp_evt_t;
typedef bluetooth_sdp_record bt_sdp_record_t;
/* tBTA_SEARCH_COMP, bta_sdp_api.h */
typedef struct {
bt_sdp_status_t status;
esp_bd_addr_t remote_addr;
esp_bt_uuid_t uuid;
int record_count;
bt_sdp_record_t records[BT_SDP_MAX_RECORDS];
} bt_sdp_search_comp_t;
/* tBTA_SDP, bta_sdp_api.h */
typedef union {
bt_sdp_status_t status;
bt_sdp_search_comp_t sdp_search_comp;
} bt_sdp_t;
typedef void (bt_sdp_cb_t)(bt_sdp_evt_t event, bt_sdp_t *p_data, void *user_data);
esp_err_t esp_bt_sdp_enable(bt_sdp_cb_t *cback);
esp_err_t esp_bt_sdp_search(esp_bd_addr_t bd_addr, esp_bt_uuid_t *uuid);
esp_err_t esp_bt_sdp_create_record_by_user(void *user_data);
esp_err_t esp_bt_sdp_remove_record_by_user(void *user_data);
/**********************************************************************************************/
/**********************************************************************************************/
/* API into SDP for local service database updates
* these APIs are indended to be called in callback function in the context of stack task,
* to handle BT_SDP_CREATE_RECORD_USER_EVT and BT_SDP_REMOVE_RECORD_USER_EVT
*/
/* This structure is used to add protocol lists and find protocol elements */
#define ESP_BT_SDP_MAX_PROTOCOL_PARAMS SDP_MAX_PROTOCOL_PARAMS // bt_target.h
typedef struct {
uint16_t protocol_uuid;
uint16_t num_params;
uint16_t params[ESP_BT_SDP_MAX_PROTOCOL_PARAMS];
} sdp_proto_elem_t; // tSDP_PROTOCOL_ELEM, sdp_api.h
#define ESP_BT_SDP_MAX_LIST_ELEMS SDP_MAX_LIST_ELEMS // sdp_api.h
typedef struct {
uint16_t num_elems;
sdp_proto_elem_t list_elem[ESP_BT_SDP_MAX_LIST_ELEMS];
} sdp_proto_list_elem_t; // tSDP_PROTO_LIST_ELEM, sdp_api.h
uint32_t esp_bt_sdp_create_record(void);
bool esp_bt_sdp_delete_record(uint32_t handle);
int32_t esp_bt_sdp_read_record(uint32_t handle, uint8_t *data, int32_t *data_len);
bool esp_bt_sdp_add_attribute (uint32_t handle, uint16_t attr_id,
uint8_t attr_type, uint32_t attr_len,
uint8_t *p_val);
bool esp_bt_sdp_add_sequence (uint32_t handle, uint16_t attr_id,
uint16_t num_elem, uint8_t type[],
uint8_t len[], uint8_t *p_val[]);
bool esp_bt_sdp_add_uuid_sequence (uint32_t handle, uint16_t attr_id,
uint16_t num_uuids, uint16_t *p_uuids);
bool esp_bt_sdp_add_protocol_list (uint32_t handle, uint16_t num_elem,
sdp_proto_elem_t *p_elem_list);
bool esp_bt_sdp_add_addition_protocol_lists(uint32_t handle, uint16_t num_elem,
sdp_proto_list_elem_t *p_proto_list);
bool esp_bt_sdp_add_profile_dscp_list (uint32_t handle,
uint16_t profile_uuid,
uint16_t version);
bool esp_bt_sdp_add_lang_base_attr_id_list(uint32_t handle,
uint16_t lang, uint16_t char_enc,
uint16_t base_id);
bool esp_bt_sdp_add_service_class_id_list(uint32_t handle,
uint16_t num_services,
uint16_t *p_service_uuids);
bool esp_bt_sdp_delete_attribute(uint32_t handle, uint16_t attr_id);
#endif /* __ESP_SDP_API_H__ */

View file

@ -1,79 +0,0 @@
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef __ESP_SEC_API_H__
#define __ESP_SEC_API_H__
#include "bt_types.h"
#define APP_SEC_IRK_FLAG (0)
#define RAND_NB_LEN 0x08
#define SEC_KEY_LEN 0x10
/*
* STRUCTURES DEFINITIONS
****************************************************************************************
*/
/// Generic Security key structure
typedef struct {
/// Key value MSB -> LSB
UINT8 key[SEC_KEY_LEN];
} smp_sec_key;
///Random number structure
typedef struct {
///8-byte array for random number
UINT8 nb[RAND_NB_LEN];
} rand_nb;
typedef struct {
// LTK
smp_sec_key ltk;
// Random Number
rand_nb rand_nb;
// EDIV
UINT16 ediv;
// LTK key size
UINT8 key_size;
// Last paired peer address type
UINT8 peer_addr_type;
// Last paired peer address
BD_ADDR peer_addr;
// authentication level
UINT8 auth;
} tAPP_SEC_ENV;
extern tAPP_SEC_ENV app_sec_env;
/*
* GLOBAL FUNCTIONS DECLARATIONS
****************************************************************************************
*/
void app_ble_sec_init(void);
void app_ble_sec_pairing_cmp_evt_send(UINT8);
UINT32 app_ble_sec_gen_tk(void);
void app_ble_sec_gen_ltk(UINT8 key_size);
void app_ble_security_start(void);
#endif /* __ESP_SEC_API_H__ */

View file

@ -196,7 +196,7 @@ void BTA_GATTC_CancelOpen(tBTA_GATTC_IF client_if, BD_ADDR remote_bda, BOOLEAN i
**
** Description Close a connection to a GATT server.
**
** Parameters conn_id: connectino ID to be closed.
** Parameters conn_id: connection ID to be closed.
**
** Returns void
**
@ -542,7 +542,7 @@ tBTA_GATT_STATUS BTA_GATTC_GetNextIncludedService(UINT16 conn_id,
** Description This function is called to read a service's characteristics of
** the given characteritisc ID.
**
** Parameters conn_id - connectino ID.
** Parameters conn_id - connection ID.
** p_char_id - characteritic ID to read.
**
** Returns None
@ -613,7 +613,7 @@ void BTA_GATTC_ReadCharDescr (UINT16 conn_id,
** Description This function is called to read multiple characteristic or
** characteristic descriptors.
**
** Parameters conn_id - connectino ID.
** Parameters conn_id - connection ID.
** p_read_multi - pointer to the read multiple parameter.
**
** Returns None

View file

@ -818,7 +818,7 @@ static void bta_gatts_send_request_cback (UINT16 conn_id,
APPL_TRACE_ERROR("connection request on gatt_if[%d] is not interested", gatt_if);
}
} else {
APPL_TRACE_ERROR("request received on unknown connectino ID: %d", conn_id);
APPL_TRACE_ERROR("request received on unknown connection ID: %d", conn_id);
}
}

View file

@ -501,7 +501,7 @@ void BTA_GATTS_CancelOpen(tBTA_GATTS_IF server_if, BD_ADDR remote_bda, BOOLEAN i
**
** Description Close a connection a remote device.
**
** Parameters conn_id: connectino ID to be closed.
** Parameters conn_id: connection ID to be closed.
**
** Returns void
**

View file

@ -679,7 +679,7 @@ extern void BTA_GATTC_CancelOpen(tBTA_GATTC_IF client_if, BD_ADDR remote_bda, BO
**
** Description Close a connection to a GATT server.
**
** Parameters conn_id: connectino ID to be closed.
** Parameters conn_id: connection ID to be closed.
**
** Returns void
**
@ -850,7 +850,7 @@ extern tBTA_GATT_STATUS BTA_GATTC_GetNextIncludedService(UINT16 conn_id,
** Description This function is called to read a service's characteristics of
** the given characteritisc ID.
**
** Parameters conn_id - connectino ID.
** Parameters conn_id - connection ID.
** p_char_id - characteritic ID to read.
**
** Returns None
@ -1010,7 +1010,7 @@ extern void BTA_GATTC_ExecuteWrite (UINT16 conn_id, BOOLEAN is_execute);
** Description This function is called to read multiple characteristic or
** characteristic descriptors.
**
** Parameters conn_id - connectino ID.
** Parameters conn_id - connection ID.
** p_read_multi - read multiple parameters.
**
** Returns None
@ -1337,7 +1337,7 @@ extern void BTA_GATTS_CancelOpen(tBTA_GATTS_IF server_if, BD_ADDR remote_bda, BO
**
** Description Close a connection a remote device.
**
** Parameters conn_id: connectino ID to be closed.
** Parameters conn_id: connection ID to be closed.
**
** Returns void
**

View file

@ -1,49 +0,0 @@
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "esp_gap_bt_api.h"
#include "bta_api.h"
#include "bt_trace.h"
esp_err_t esp_bt_gap_set_scan_mode(bt_scan_mode_t mode)
{
tBTA_DM_DISC disc_mode;
tBTA_DM_CONN conn_mode;
switch (mode) {
case BT_SCAN_MODE_NONE:
disc_mode = BTA_DM_NON_DISC;
conn_mode = BTA_DM_NON_CONN;
break;
case BT_SCAN_MODE_CONNECTABLE:
disc_mode = BTA_DM_NON_DISC;
conn_mode = BTA_DM_CONN;
break;
case BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE:
disc_mode = BTA_DM_GENERAL_DISC;
conn_mode = BTA_DM_CONN;
break;
default:
// BTIF_TRACE_ERROR("invalid scan mode (0x%x)", mode);
return ESP_ERR_INVALID_ARG;
}
// BTIF_TRACE_EVENT("set property scan mode : %x", mode);
BTA_DmSetVisibility(disc_mode, conn_mode, BTA_DM_IGNORE, BTA_DM_IGNORE);
return ESP_OK;
}

View file

@ -441,7 +441,7 @@ BOOLEAN btm_ble_start_auto_conn(BOOLEAN start)
** p_select_cback: callback function to return application
** selection.
**
** Returns BOOLEAN: selective connectino procedure is started.
** Returns BOOLEAN: selective connection procedure is started.
**
*******************************************************************************/
BOOLEAN btm_ble_start_select_conn(BOOLEAN start, tBTM_BLE_SEL_CBACK *p_select_cback)
@ -523,7 +523,7 @@ BOOLEAN btm_ble_start_select_conn(BOOLEAN start, tBTM_BLE_SEL_CBACK *p_select_cb
** p_select_cback: callback function to return application
** selection.
**
** Returns BOOLEAN: selective connectino procedure is started.
** Returns BOOLEAN: selective connection procedure is started.
**
*******************************************************************************/
void btm_ble_initiate_select_conn(BD_ADDR bda)

View file

@ -496,7 +496,7 @@ tGATT_STATUS attp_cl_send_cmd(tGATT_TCB *p_tcb, UINT16 clcb_idx, UINT8 cmd_code,
** Description This function sends the client request or confirmation message
** to server.
**
** Parameter p_tcb: pointer to the connectino control block.
** Parameter p_tcb: pointer to the connection control block.
** clcb_idx: clcb index
** op_code: message op code.
** p_msg: pointer to message parameters structure.

View file

@ -167,7 +167,7 @@ typedef UINT8 tBTM_BLE_SFP;
#define BTM_BLE_CONN_INT_MIN_DEF 24 /* recommended min: 30ms = 24 * 1.25 */
#endif
/* default connectino interval max */
/* default connection interval max */
#ifndef BTM_BLE_CONN_INT_MAX_DEF
#define BTM_BLE_CONN_INT_MAX_DEF 40 /* recommended max: 50 ms = 56 * 1.25 */
#endif

View file

@ -127,7 +127,6 @@ void app_main()
esp_err_t ret;
nvs_flash_init();
system_init();
initialise_wifi();
//vTaskDelay(3000 / portTICK_PERIOD_MS);