Merge branch 'bugfix/some_host_and_example_bugfix_Backport_to_4v0' into 'release/v4.0'
Bugfix/some host and example bugfix backport to v4.0 See merge request espressif/esp-idf!7360
This commit is contained in:
commit
615dc00e86
42 changed files with 322 additions and 231 deletions
|
@ -389,7 +389,7 @@ bool config_save(const config_t *config, const char *filename)
|
|||
const size_t keyname_bufsz = sizeof(CONFIG_KEY) + 5 + 1; // including log10(sizeof(i))
|
||||
char *keyname = osi_calloc(keyname_bufsz);
|
||||
int config_size = get_config_size(config);
|
||||
char *buf = osi_calloc(config_size + 100);
|
||||
char *buf = osi_calloc(config_size);
|
||||
if (!line || !buf || !keyname) {
|
||||
err_code |= 0x01;
|
||||
goto error;
|
||||
|
@ -414,7 +414,7 @@ bool config_save(const config_t *config, const char *filename)
|
|||
err_code |= 0x10;
|
||||
goto error;
|
||||
}
|
||||
if(w_cnt_total + w_cnt > config_size + 100) {
|
||||
if(w_cnt_total + w_cnt > config_size) {
|
||||
OSI_TRACE_ERROR("%s, memcpy size (w_cnt + w_cnt_total = %d) is larger than buffer size (config_size = %d).", __func__, (w_cnt + w_cnt_total), config_size);
|
||||
err_code |= 0x20;
|
||||
goto error;
|
||||
|
@ -432,8 +432,8 @@ bool config_save(const config_t *config, const char *filename)
|
|||
err_code |= 0x10;
|
||||
goto error;
|
||||
}
|
||||
if(w_cnt_total + w_cnt > config_size + 100) {
|
||||
OSI_TRACE_ERROR("%s, memcpy size (w_cnt + w_cnt_total = %d) is larger than buffer size.(config_size = %d)", __func__, w_cnt + w_cnt_total,config_size);
|
||||
if(w_cnt_total + w_cnt > config_size) {
|
||||
OSI_TRACE_ERROR("%s, memcpy size (w_cnt + w_cnt_total = %d) is larger than buffer size.(config_size = %d)", __func__, (w_cnt + w_cnt_total), config_size);
|
||||
err_code |= 0x20;
|
||||
goto error;
|
||||
}
|
||||
|
@ -544,7 +544,10 @@ static void config_parse(nvs_handle_t fp, config_t *config)
|
|||
const size_t keyname_bufsz = sizeof(CONFIG_KEY) + 5 + 1; // including log10(sizeof(i))
|
||||
char *keyname = osi_calloc(keyname_bufsz);
|
||||
int buf_size = get_config_size_from_flash(fp);
|
||||
char *buf = osi_calloc(buf_size + 100);
|
||||
char *buf = osi_calloc(buf_size);
|
||||
if(buf_size == 0) { //First use nvs
|
||||
goto error;
|
||||
}
|
||||
if (!line || !section || !buf || !keyname) {
|
||||
err_code |= 0x01;
|
||||
goto error;
|
||||
|
|
|
@ -129,6 +129,8 @@ size_t fixed_queue_capacity(fixed_queue_t *queue)
|
|||
|
||||
bool fixed_queue_enqueue(fixed_queue_t *queue, void *data, uint32_t timeout)
|
||||
{
|
||||
bool status=false; //Flag whether enqueued success
|
||||
|
||||
assert(queue != NULL);
|
||||
assert(data != NULL);
|
||||
|
||||
|
@ -137,13 +139,13 @@ bool fixed_queue_enqueue(fixed_queue_t *queue, void *data, uint32_t timeout)
|
|||
}
|
||||
|
||||
osi_mutex_lock(&queue->lock, OSI_MUTEX_MAX_TIMEOUT);
|
||||
|
||||
list_append(queue->list, data);
|
||||
status = list_append(queue->list, data); //Check whether enqueued success
|
||||
osi_mutex_unlock(&queue->lock);
|
||||
|
||||
if(status == true )
|
||||
osi_sem_give(&queue->dequeue_sem);
|
||||
|
||||
return true;
|
||||
return status;
|
||||
}
|
||||
|
||||
void *fixed_queue_dequeue(fixed_queue_t *queue, uint32_t timeout)
|
||||
|
|
|
@ -102,6 +102,7 @@ bool list_insert_after(list_t *list, list_node_t *prev_node, void *data) {
|
|||
assert(data != NULL);
|
||||
list_node_t *node = (list_node_t *)osi_calloc(sizeof(list_node_t));
|
||||
if (!node) {
|
||||
OSI_TRACE_ERROR("%s osi_calloc failed.\n", __FUNCTION__ );
|
||||
return false;
|
||||
}
|
||||
node->next = prev_node->next;
|
||||
|
@ -120,6 +121,7 @@ bool list_prepend(list_t *list, void *data)
|
|||
assert(data != NULL);
|
||||
list_node_t *node = (list_node_t *)osi_calloc(sizeof(list_node_t));
|
||||
if (!node) {
|
||||
OSI_TRACE_ERROR("%s osi_calloc failed.\n", __FUNCTION__ );
|
||||
return false;
|
||||
}
|
||||
node->next = list->head;
|
||||
|
@ -138,6 +140,7 @@ bool list_append(list_t *list, void *data)
|
|||
assert(data != NULL);
|
||||
list_node_t *node = (list_node_t *)osi_calloc(sizeof(list_node_t));
|
||||
if (!node) {
|
||||
OSI_TRACE_ERROR("%s osi_calloc failed.\n", __FUNCTION__ );
|
||||
return false;
|
||||
}
|
||||
node->next = NULL;
|
||||
|
|
|
@ -891,7 +891,7 @@ typedef struct {
|
|||
/** Parameters of Generic Location state */
|
||||
typedef struct {
|
||||
int32_t global_latitude; /*!< The value of the Global Latitude field */
|
||||
int32_t global_longitude; /*!< The value of the Global Longtitude field */
|
||||
int32_t global_longitude; /*!< The value of the Global Longitude field */
|
||||
int16_t global_altitude; /*!< The value of the Global Altitude field */
|
||||
int16_t local_north; /*!< The value of the Local North field */
|
||||
int16_t local_east; /*!< The value of the Local East field */
|
||||
|
@ -914,7 +914,7 @@ typedef struct {
|
|||
esp_ble_mesh_gen_location_state_t *state; /*!< Parameters of the Generic Location state */
|
||||
} esp_ble_mesh_gen_location_setup_srv_t;
|
||||
|
||||
/** This enum value is the access vlue of Generic User Property */
|
||||
/** This enum value is the access value of Generic User Property */
|
||||
typedef enum {
|
||||
ESP_BLE_MESH_GEN_USER_ACCESS_PROHIBIT,
|
||||
ESP_BLE_MESH_GEN_USER_ACCESS_READ,
|
||||
|
@ -1078,7 +1078,7 @@ typedef union {
|
|||
esp_ble_mesh_state_change_gen_loc_local_set_t loc_local_set; /*!< Generic Location Local Set */
|
||||
esp_ble_mesh_state_change_gen_user_property_set_t user_property_set; /*!< Generic User Property Set */
|
||||
esp_ble_mesh_state_change_gen_admin_property_set_t admin_property_set; /*!< Generic Admin Property Set */
|
||||
esp_ble_mesh_state_change_gen_manu_property_set_t manu_property_set; /*!< Generic Manufactuer Property Set */
|
||||
esp_ble_mesh_state_change_gen_manu_property_set_t manu_property_set; /*!< Generic Manufacturer Property Set */
|
||||
} esp_ble_mesh_generic_server_state_change_t;
|
||||
|
||||
/** Context of the received Generic User Property Get message */
|
||||
|
@ -1202,7 +1202,7 @@ typedef struct {
|
|||
/** Context of the received Generic Admin Property Set message */
|
||||
typedef struct {
|
||||
uint16_t property_id; /*!< Property ID identifying a Generic Admin Property */
|
||||
uint8_t user_access; /*!< Enumeration indicating user accessn */
|
||||
uint8_t user_access; /*!< Enumeration indicating user access */
|
||||
struct net_buf_simple *property_value; /*!< Raw value for the Admin Property */
|
||||
} esp_ble_mesh_server_recv_gen_admin_property_set_t;
|
||||
|
||||
|
|
|
@ -1301,8 +1301,8 @@ static void bt_mesh_bta_gattc_cb(tBTA_GATTC_EVT event, tBTA_GATTC *p_data)
|
|||
tBT_UUID char_uuid = {0};
|
||||
tBTA_GATT_STATUS status;
|
||||
tBTA_GATT_UNFMT write;
|
||||
int count = 0;
|
||||
int num = 0;
|
||||
u16_t count = 0;
|
||||
u16_t num = 0;
|
||||
|
||||
/* Get the characteristic num within Mesh Provisioning/Proxy Service */
|
||||
BTA_GATTC_GetDBSizeByType(p_data->search_cmpl.conn_id, BTGATT_DB_CHARACTERISTIC,
|
||||
|
|
|
@ -47,3 +47,12 @@ esp_err_t esp_ble_gatt_set_local_mtu (uint16_t mtu)
|
|||
|
||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gatt_com_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
extern uint16_t L2CA_GetFreePktBufferNum_LE(void);
|
||||
|
||||
uint16_t esp_ble_get_sendable_packets_num ()
|
||||
{
|
||||
return L2CA_GetFreePktBufferNum_LE();
|
||||
}
|
||||
#endif
|
|
@ -44,6 +44,10 @@ extern "C" {
|
|||
*/
|
||||
extern esp_err_t esp_ble_gatt_set_local_mtu (uint16_t mtu);
|
||||
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
extern uint16_t esp_ble_get_sendable_packets_num (void);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -73,8 +73,14 @@ extern "C" {
|
|||
#define ESP_GATT_UUID_CHAR_PRESENT_FORMAT 0x2904 /* Characteristic Presentation Format*/
|
||||
#define ESP_GATT_UUID_CHAR_AGG_FORMAT 0x2905 /* Characteristic Aggregate Format*/
|
||||
#define ESP_GATT_UUID_CHAR_VALID_RANGE 0x2906 /* Characteristic Valid Range */
|
||||
#define ESP_GATT_UUID_EXT_RPT_REF_DESCR 0x2907
|
||||
#define ESP_GATT_UUID_RPT_REF_DESCR 0x2908
|
||||
#define ESP_GATT_UUID_EXT_RPT_REF_DESCR 0x2907 /* External Report Reference */
|
||||
#define ESP_GATT_UUID_RPT_REF_DESCR 0x2908 /* Report Reference */
|
||||
#define ESP_GATT_UUID_NUM_DIGITALS_DESCR 0x2909 /* Number of Digitals */
|
||||
#define ESP_GATT_UUID_VALUE_TRIGGER_DESCR 0x290A /* Value Trigger Setting */
|
||||
#define ESP_GATT_UUID_ENV_SENSING_CONFIG_DESCR 0x290B /* Environmental Sensing Configuration */
|
||||
#define ESP_GATT_UUID_ENV_SENSING_MEASUREMENT_DESCR 0x290C /* Environmental Sensing Measurement */
|
||||
#define ESP_GATT_UUID_ENV_SENSING_TRIGGER_DESCR 0x290D /* Environmental Sensing Trigger Setting */
|
||||
#define ESP_GATT_UUID_TIME_TRIGGER_DESCR 0x290E /* Time Trigger Setting */
|
||||
|
||||
/* GAP Profile Attributes */
|
||||
#define ESP_GATT_UUID_GAP_DEVICE_NAME 0x2A00
|
||||
|
@ -443,7 +449,7 @@ typedef struct {
|
|||
* @brief service element
|
||||
*/
|
||||
typedef struct {
|
||||
bool is_primary; /*!< The service flag, true if the service is primary service, else is secondly service */
|
||||
bool is_primary; /*!< The service flag, true if the service is primary service, else is secondary service */
|
||||
uint16_t start_handle; /*!< The start handle of the service */
|
||||
uint16_t end_handle; /*!< The end handle of the service */
|
||||
esp_bt_uuid_t uuid; /*!< The uuid of the service */
|
||||
|
|
|
@ -784,7 +784,7 @@ UINT16 BTA_DmGetConnectionState( BD_ADDR bd_addr )
|
|||
**
|
||||
** Description This function adds a DI record to the local SDP database.
|
||||
**
|
||||
** Returns BTA_SUCCESS if record set sucessfully, otherwise error code.
|
||||
** Returns BTA_SUCCESS if record set successfully, otherwise error code.
|
||||
**
|
||||
*******************************************************************************/
|
||||
tBTA_STATUS BTA_DmSetLocalDiRecord( tBTA_DI_RECORD *p_device_info,
|
||||
|
@ -1867,7 +1867,7 @@ void BTA_DmBleConfigLocalIcon(uint16_t icon)
|
|||
** p_cback: callback function associated to this adv instance.
|
||||
** p_ref: reference data pointer to this adv instance.
|
||||
**
|
||||
** Returns BTA_SUCCESS if command started sucessfully; otherwise failure.
|
||||
** Returns BTA_SUCCESS if command started successfully; otherwise failure.
|
||||
**
|
||||
*******************************************************************************/
|
||||
void BTA_BleEnableAdvInstance (tBTA_BLE_ADV_PARAMS *p_params,
|
||||
|
@ -1905,7 +1905,7 @@ void BTA_BleEnableAdvInstance (tBTA_BLE_ADV_PARAMS *p_params,
|
|||
** Parameters inst_id: Adv instance to update the parameter.
|
||||
** p_params: pointer to the adv parameter structure.
|
||||
**
|
||||
** Returns BTA_SUCCESS if command started sucessfully; otherwise failure.
|
||||
** Returns BTA_SUCCESS if command started successfully; otherwise failure.
|
||||
**
|
||||
*******************************************************************************/
|
||||
void BTA_BleUpdateAdvInstParam (UINT8 inst_id, tBTA_BLE_ADV_PARAMS *p_params)
|
||||
|
@ -1940,7 +1940,7 @@ void BTA_BleUpdateAdvInstParam (UINT8 inst_id, tBTA_BLE_ADV_PARAMS *p_params)
|
|||
** memory space can not be freed until BTA_BLE_MULTI_ADV_DATA_EVT
|
||||
** is sent to application.
|
||||
**
|
||||
** Returns BTA_SUCCESS if command started sucessfully; otherwise failure.
|
||||
** Returns BTA_SUCCESS if command started successfully; otherwise failure.
|
||||
**
|
||||
*******************************************************************************/
|
||||
void BTA_BleCfgAdvInstData (UINT8 inst_id, BOOLEAN is_scan_rsp,
|
||||
|
@ -1973,7 +1973,7 @@ void BTA_BleCfgAdvInstData (UINT8 inst_id, BOOLEAN is_scan_rsp,
|
|||
**
|
||||
** Parameter inst_id: instance ID to disable.
|
||||
**
|
||||
** Returns BTA_SUCCESS if command started sucessfully; otherwise failure.
|
||||
** Returns BTA_SUCCESS if command started successfully; otherwise failure.
|
||||
**
|
||||
*******************************************************************************/
|
||||
void BTA_BleDisableAdvInstance (UINT8 inst_id) //this function just used for vendor debug
|
||||
|
|
|
@ -76,7 +76,7 @@ void BTA_GATTC_Disable(void)
|
|||
** Description This function is called to register application callbacks
|
||||
** with BTA GATTC module.
|
||||
**
|
||||
** Parameters p_app_uuid - applicaiton UUID
|
||||
** Parameters p_app_uuid - application UUID
|
||||
** p_client_cb - pointer to the application callback function.
|
||||
**
|
||||
** Returns None
|
||||
|
@ -338,13 +338,13 @@ const tBTA_GATTC_DESCRIPTOR* BTA_GATTC_GetDescriptor(UINT16 conn_id, UINT16 hand
|
|||
}
|
||||
|
||||
void BTA_GATTC_GetServiceWithUUID(UINT16 conn_id, tBT_UUID *svc_uuid,
|
||||
btgatt_db_element_t **db, int *count)
|
||||
btgatt_db_element_t **db, UINT16 *count)
|
||||
{
|
||||
bta_gattc_get_service_with_uuid(conn_id, svc_uuid, db, count);
|
||||
}
|
||||
|
||||
void BTA_GATTC_GetAllChar(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle,
|
||||
btgatt_db_element_t **db, int *count)
|
||||
btgatt_db_element_t **db, UINT16 *count)
|
||||
{
|
||||
bta_gattc_get_db_with_opration(conn_id,
|
||||
GATT_OP_GET_ALL_CHAR,
|
||||
|
@ -359,7 +359,7 @@ void BTA_GATTC_GetAllChar(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle
|
|||
}
|
||||
|
||||
void BTA_GATTC_GetAllDescriptor(UINT16 conn_id, UINT16 char_handle,
|
||||
btgatt_db_element_t **db, int *count)
|
||||
btgatt_db_element_t **db, UINT16 *count)
|
||||
{
|
||||
bta_gattc_get_db_with_opration(conn_id,
|
||||
GATT_OP_GET_ALL_DESCRI,
|
||||
|
@ -374,7 +374,7 @@ void BTA_GATTC_GetAllDescriptor(UINT16 conn_id, UINT16 char_handle,
|
|||
}
|
||||
|
||||
void BTA_GATTC_GetCharByUUID(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, tBT_UUID char_uuid,
|
||||
btgatt_db_element_t **db, int *count)
|
||||
btgatt_db_element_t **db, UINT16 *count)
|
||||
{
|
||||
bta_gattc_get_db_with_opration(conn_id,
|
||||
GATT_OP_GET_CHAR_BY_UUID,
|
||||
|
@ -390,7 +390,7 @@ void BTA_GATTC_GetCharByUUID(UINT16 conn_id, UINT16 start_handle, UINT16 end_han
|
|||
|
||||
void BTA_GATTC_GetDescrByUUID(UINT16 conn_id, uint16_t start_handle, uint16_t end_handle,
|
||||
tBT_UUID char_uuid, tBT_UUID descr_uuid,
|
||||
btgatt_db_element_t **db, int *count)
|
||||
btgatt_db_element_t **db, UINT16 *count)
|
||||
{
|
||||
bta_gattc_get_db_with_opration(conn_id,
|
||||
GATT_OP_GET_DESCRI_BY_UUID,
|
||||
|
@ -405,7 +405,7 @@ void BTA_GATTC_GetDescrByUUID(UINT16 conn_id, uint16_t start_handle, uint16_t en
|
|||
}
|
||||
|
||||
void BTA_GATTC_GetDescrByCharHandle(UINT16 conn_id, UINT16 char_handle, tBT_UUID descr_uuid,
|
||||
btgatt_db_element_t **db, int *count)
|
||||
btgatt_db_element_t **db, UINT16 *count)
|
||||
{
|
||||
bta_gattc_get_db_with_opration(conn_id,
|
||||
GATT_OP_GET_DESCRI_BY_HANDLE,
|
||||
|
@ -420,7 +420,7 @@ void BTA_GATTC_GetDescrByCharHandle(UINT16 conn_id, UINT16 char_handle, tBT_UUID
|
|||
}
|
||||
|
||||
void BTA_GATTC_GetIncludeService(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle,
|
||||
tBT_UUID *incl_uuid, btgatt_db_element_t **db, int *count)
|
||||
tBT_UUID *incl_uuid, btgatt_db_element_t **db, UINT16 *count)
|
||||
{
|
||||
bta_gattc_get_db_with_opration(conn_id,
|
||||
GATT_OP_GET_INCLUDE_SVC,
|
||||
|
@ -434,13 +434,13 @@ void BTA_GATTC_GetIncludeService(UINT16 conn_id, UINT16 start_handle, UINT16 end
|
|||
count);
|
||||
}
|
||||
|
||||
void BTA_GATTC_GetDBSize(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, int *count)
|
||||
void BTA_GATTC_GetDBSize(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, UINT16 *count)
|
||||
{
|
||||
bta_gattc_get_db_size_handle(conn_id, start_handle, end_handle, count);
|
||||
}
|
||||
|
||||
void BTA_GATTC_GetDBSizeByType(UINT16 conn_id, bt_gatt_db_attribute_type_t type,
|
||||
UINT16 start_handle, UINT16 end_handle, UINT16 char_handle, int *count)
|
||||
UINT16 start_handle, UINT16 end_handle, UINT16 char_handle, UINT16 *count)
|
||||
{
|
||||
bta_gattc_get_db_size_with_type_handle(conn_id, type, start_handle, end_handle, char_handle, count);
|
||||
}
|
||||
|
@ -459,7 +459,7 @@ void BTA_GATTC_GetDBSizeByType(UINT16 conn_id, bt_gatt_db_attribute_type_t type,
|
|||
**
|
||||
*******************************************************************************/
|
||||
void BTA_GATTC_GetGattDb(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle,
|
||||
btgatt_db_element_t **db, int *count)
|
||||
btgatt_db_element_t **db, UINT16 *count)
|
||||
{
|
||||
bta_gattc_get_gatt_db(conn_id, start_handle, end_handle, db, count);
|
||||
}
|
||||
|
|
|
@ -1233,7 +1233,7 @@ tBTA_GATTC_DESCRIPTOR* bta_gattc_get_descriptor(UINT16 conn_id, UINT16 handle)
|
|||
|
||||
void bta_gattc_get_service_with_uuid(UINT16 conn_id, tBT_UUID *svc_uuid,
|
||||
btgatt_db_element_t **svc_db,
|
||||
int *count)
|
||||
UINT16 *count)
|
||||
{
|
||||
const list_t* svc = bta_gattc_get_services(conn_id);
|
||||
if(!svc) {
|
||||
|
@ -1307,7 +1307,7 @@ void bta_gattc_get_db_with_opration(UINT16 conn_id,
|
|||
tBT_UUID *descr_uuid,
|
||||
UINT16 start_handle, UINT16 end_handle,
|
||||
btgatt_db_element_t **char_db,
|
||||
int *count)
|
||||
UINT16 *count)
|
||||
{
|
||||
tBTA_GATTC_CLCB *p_clcb = bta_gattc_find_clcb_by_conn_id(conn_id);
|
||||
|
||||
|
@ -1672,7 +1672,7 @@ static size_t bta_gattc_get_db_size(list_t *services,
|
|||
return db_size;
|
||||
}
|
||||
|
||||
void bta_gattc_get_db_size_handle(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, int *count)
|
||||
void bta_gattc_get_db_size_handle(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, UINT16 *count)
|
||||
{
|
||||
tBTA_GATTC_CLCB *p_clcb = bta_gattc_find_clcb_by_conn_id(conn_id);
|
||||
|
||||
|
@ -1691,7 +1691,7 @@ void bta_gattc_get_db_size_handle(UINT16 conn_id, UINT16 start_handle, UINT16 en
|
|||
}
|
||||
|
||||
void bta_gattc_get_db_size_with_type_handle(UINT16 conn_id, bt_gatt_db_attribute_type_t type,
|
||||
UINT16 start_handle, UINT16 end_handle, UINT16 char_handle, int *count)
|
||||
UINT16 start_handle, UINT16 end_handle, UINT16 char_handle, UINT16 *count)
|
||||
{
|
||||
tBTA_GATTC_CLCB *p_clcb = bta_gattc_find_clcb_by_conn_id(conn_id);
|
||||
|
||||
|
@ -1738,7 +1738,7 @@ void bta_gattc_get_db_size_with_type_handle(UINT16 conn_id, bt_gatt_db_attribute
|
|||
static void bta_gattc_get_gatt_db_impl(tBTA_GATTC_SERV *p_srvc_cb,
|
||||
UINT16 start_handle, UINT16 end_handle,
|
||||
btgatt_db_element_t **db,
|
||||
int *count)
|
||||
UINT16 *count)
|
||||
{
|
||||
APPL_TRACE_DEBUG("%s: start_handle 0x%04x, end_handle 0x%04x",
|
||||
__func__, start_handle, end_handle);
|
||||
|
@ -1886,7 +1886,7 @@ static void bta_gattc_get_gatt_db_impl(tBTA_GATTC_SERV *p_srvc_cb,
|
|||
** Returns None.
|
||||
**
|
||||
*******************************************************************************/
|
||||
void bta_gattc_get_gatt_db(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, btgatt_db_element_t **db, int *count)
|
||||
void bta_gattc_get_gatt_db(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, btgatt_db_element_t **db, UINT16 *count)
|
||||
{
|
||||
tBTA_GATTC_CLCB *p_clcb = bta_gattc_find_clcb_by_conn_id(conn_id);
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ void BTA_GATTS_Disable(void)
|
|||
** Description This function is called to register application callbacks
|
||||
** with BTA GATTS module.
|
||||
**
|
||||
** Parameters p_app_uuid - applicaiton UUID
|
||||
** Parameters p_app_uuid - application UUID
|
||||
** p_cback - pointer to the application callback function.
|
||||
**
|
||||
** Returns None
|
||||
|
@ -347,7 +347,7 @@ void BTA_GATTS_DeleteService(UINT16 service_id)
|
|||
** Description This function is called to start a service.
|
||||
**
|
||||
** Parameters service_id: the service ID to be started.
|
||||
** sup_transport: supported trasnport.
|
||||
** sup_transport: supported transport.
|
||||
**
|
||||
** Returns None.
|
||||
**
|
||||
|
|
|
@ -515,12 +515,12 @@ extern const tBTA_GATTC_SERVICE* bta_gattc_get_service_for_handle(UINT16 conn_id
|
|||
tBTA_GATTC_CHARACTERISTIC* bta_gattc_get_characteristic_srcb(tBTA_GATTC_SERV *p_srcb, UINT16 handle);
|
||||
extern tBTA_GATTC_CHARACTERISTIC* bta_gattc_get_characteristic(UINT16 conn_id, UINT16 handle);
|
||||
extern tBTA_GATTC_DESCRIPTOR* bta_gattc_get_descriptor(UINT16 conn_id, UINT16 handle);
|
||||
extern void bta_gattc_get_db_size_handle(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, int *count);
|
||||
extern void bta_gattc_get_db_size_handle(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, UINT16 *count);
|
||||
extern void bta_gattc_get_db_size_with_type_handle(UINT16 conn_id, bt_gatt_db_attribute_type_t type,
|
||||
UINT16 start_handle, UINT16 end_handle, UINT16 char_handle, int *count);
|
||||
UINT16 start_handle, UINT16 end_handle, UINT16 char_handle, UINT16 *count);
|
||||
extern void bta_gattc_get_service_with_uuid(UINT16 conn_id, tBT_UUID *svc_uuid,
|
||||
btgatt_db_element_t **svc_db,
|
||||
int *count);
|
||||
UINT16 *count);
|
||||
|
||||
extern void bta_gattc_get_db_with_opration(UINT16 conn_id,
|
||||
bt_gatt_get_db_op_t op,
|
||||
|
@ -530,9 +530,9 @@ extern void bta_gattc_get_db_with_opration(UINT16 conn_id,
|
|||
tBT_UUID *descr_uuid,
|
||||
UINT16 start_handle, UINT16 end_handle,
|
||||
btgatt_db_element_t **char_db,
|
||||
int *count);
|
||||
UINT16 *count);
|
||||
|
||||
extern void bta_gattc_get_gatt_db(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, btgatt_db_element_t **db, int *count);
|
||||
extern void bta_gattc_get_gatt_db(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, btgatt_db_element_t **db, UINT16 *count);
|
||||
|
||||
extern tBTA_GATT_STATUS bta_gattc_init_cache(tBTA_GATTC_SERV *p_srvc_cb);
|
||||
extern void bta_gattc_rebuild_cache(tBTA_GATTC_SERV *p_srcv, UINT16 num_attr, tBTA_GATTC_NV_ATTR *attr);
|
||||
|
|
|
@ -850,7 +850,7 @@ void bta_hh_le_register_input_notif(tBTA_HH_DEV_CB *p_dev_cb, UINT8 srvc_inst,
|
|||
**
|
||||
** Function bta_hh_le_open_cmpl
|
||||
**
|
||||
** Description HID over GATT connection sucessfully opened
|
||||
** Description HID over GATT connection successfully opened
|
||||
**
|
||||
*******************************************************************************/
|
||||
void bta_hh_le_open_cmpl(tBTA_HH_DEV_CB *p_cb)
|
||||
|
@ -1556,7 +1556,7 @@ void bta_hh_le_srvc_search_cmpl(tBTA_GATTC_SEARCH_CMPL *p_data)
|
|||
/* close the connection and report service discovery complete with error */
|
||||
bta_hh_le_api_disc_act(p_dev_cb);
|
||||
}
|
||||
/* GATT service discovery sucessfully finished */
|
||||
/* GATT service discovery successfully finished */
|
||||
else {
|
||||
if (p_dev_cb->disc_active & BTA_HH_LE_DISC_SCPS) {
|
||||
p_dev_cb->disc_active &= ~BTA_HH_LE_DISC_SCPS;
|
||||
|
|
|
@ -600,10 +600,10 @@ typedef struct {
|
|||
|
||||
typedef union {
|
||||
tBLE_BD_ADDR target_addr;
|
||||
tBTA_DM_BLE_PF_LOCAL_NAME_COND local_name; /* lcoal name filtering */
|
||||
tBTA_DM_BLE_PF_MANU_COND manu_data; /* manufactuer data filtering */
|
||||
tBTA_DM_BLE_PF_LOCAL_NAME_COND local_name; /* local name filtering */
|
||||
tBTA_DM_BLE_PF_MANU_COND manu_data; /* manufacturer data filtering */
|
||||
tBTA_DM_BLE_PF_UUID_COND srvc_uuid; /* service UUID filtering */
|
||||
tBTA_DM_BLE_PF_UUID_COND solicitate_uuid; /* solicitated service UUID filtering */
|
||||
tBTA_DM_BLE_PF_UUID_COND solicitate_uuid; /* solicited service UUID filtering */
|
||||
tBTA_DM_BLE_PF_SRVC_PATTERN_COND srvc_data; /* service data pattern */
|
||||
} tBTA_DM_BLE_PF_COND_PARAM;
|
||||
|
||||
|
@ -1215,7 +1215,7 @@ typedef UINT16 tBTA_DM_LP_MASK;
|
|||
#define BTA_DM_PM_ACTIVE 0x40 /* prefers active mode */
|
||||
#define BTA_DM_PM_RETRY 0x80 /* retry power mode based on current settings */
|
||||
#define BTA_DM_PM_SUSPEND 0x04 /* prefers suspend mode */
|
||||
#define BTA_DM_PM_NO_PREF 0x01 /* service has no prefernce on power mode setting. eg. connection to service got closed */
|
||||
#define BTA_DM_PM_NO_PREF 0x01 /* service has no preference on power mode setting. eg. connection to service got closed */
|
||||
|
||||
typedef UINT8 tBTA_DM_PM_ACTION;
|
||||
|
||||
|
@ -1757,7 +1757,7 @@ extern UINT16 BTA_DmGetConnectionState( BD_ADDR bd_addr );
|
|||
**
|
||||
** Description This function adds a DI record to the local SDP database.
|
||||
**
|
||||
** Returns BTA_SUCCESS if record set sucessfully, otherwise error code.
|
||||
** Returns BTA_SUCCESS if record set successfully, otherwise error code.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tBTA_STATUS BTA_DmSetLocalDiRecord( tBTA_DI_RECORD *p_device_info,
|
||||
|
|
|
@ -151,7 +151,7 @@ typedef UINT8 tBTA_GATT_STATUS;
|
|||
#define BTA_GATTC_CLOSE_EVT 5 /* GATTC close request status event */
|
||||
#define BTA_GATTC_SEARCH_CMPL_EVT 6 /* GATT discovery complete event */
|
||||
#define BTA_GATTC_SEARCH_RES_EVT 7 /* GATT discovery result event */
|
||||
#define BTA_GATTC_READ_DESCR_EVT 8 /* GATT read characterisitc descriptor event */
|
||||
#define BTA_GATTC_READ_DESCR_EVT 8 /* GATT read characteristic descriptor event */
|
||||
#define BTA_GATTC_WRITE_DESCR_EVT 9 /* GATT write characteristic descriptor event */
|
||||
#define BTA_GATTC_NOTIF_EVT 10 /* GATT attribute notification event */
|
||||
#define BTA_GATTC_PREP_WRITE_EVT 11 /* GATT prepare write event */
|
||||
|
@ -752,7 +752,7 @@ extern void BTA_GATTC_Disable(void);
|
|||
** Description This function is called to register application callbacks
|
||||
** with BTA GATTC module.
|
||||
**
|
||||
** Parameters p_app_uuid - applicaiton UUID
|
||||
** Parameters p_app_uuid - application UUID
|
||||
** p_client_cb - pointer to the application callback function.
|
||||
**
|
||||
** Returns None
|
||||
|
@ -881,31 +881,31 @@ extern const tBTA_GATTC_CHARACTERISTIC* BTA_GATTC_GetCharacteristic(UINT16 conn_
|
|||
extern const tBTA_GATTC_DESCRIPTOR* BTA_GATTC_GetDescriptor(UINT16 conn_id, UINT16 handle);
|
||||
|
||||
extern void BTA_GATTC_GetServiceWithUUID(UINT16 conn_id, tBT_UUID *svc_uuid,
|
||||
btgatt_db_element_t **db, int *count);
|
||||
btgatt_db_element_t **db, UINT16 *count);
|
||||
|
||||
extern void BTA_GATTC_GetAllChar(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle,
|
||||
btgatt_db_element_t **db, int *count);
|
||||
btgatt_db_element_t **db, UINT16 *count);
|
||||
|
||||
extern void BTA_GATTC_GetAllDescriptor(UINT16 conn_id, UINT16 char_handle,
|
||||
btgatt_db_element_t **db, int *count);
|
||||
btgatt_db_element_t **db, UINT16 *count);
|
||||
|
||||
extern void BTA_GATTC_GetCharByUUID(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, tBT_UUID char_uuid,
|
||||
btgatt_db_element_t **db, int *count);
|
||||
btgatt_db_element_t **db, UINT16 *count);
|
||||
|
||||
extern void BTA_GATTC_GetDescrByUUID(UINT16 conn_id, uint16_t start_handle, uint16_t end_handle,
|
||||
tBT_UUID char_uuid, tBT_UUID descr_uuid,
|
||||
btgatt_db_element_t **db, int *count);
|
||||
btgatt_db_element_t **db, UINT16 *count);
|
||||
|
||||
extern void BTA_GATTC_GetDescrByCharHandle(UINT16 conn_id, UINT16 char_handle, tBT_UUID descr_uuid,
|
||||
btgatt_db_element_t **db, int *count);
|
||||
btgatt_db_element_t **db, UINT16 *count);
|
||||
|
||||
extern void BTA_GATTC_GetIncludeService(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle,
|
||||
tBT_UUID *incl_uuid, btgatt_db_element_t **db, int *count);
|
||||
tBT_UUID *incl_uuid, btgatt_db_element_t **db, UINT16 *count);
|
||||
|
||||
extern void BTA_GATTC_GetDBSize(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, int *count);
|
||||
extern void BTA_GATTC_GetDBSize(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, UINT16 *count);
|
||||
|
||||
extern void BTA_GATTC_GetDBSizeByType(UINT16 conn_id, bt_gatt_db_attribute_type_t type,
|
||||
UINT16 start_handle, UINT16 end_handle, UINT16 char_handle, int *count);
|
||||
UINT16 start_handle, UINT16 end_handle, UINT16 char_handle, UINT16 *count);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
|
@ -920,7 +920,7 @@ extern void BTA_GATTC_GetDBSizeByType(UINT16 conn_id, bt_gatt_db_attribute_type_
|
|||
**
|
||||
*******************************************************************************/
|
||||
extern void BTA_GATTC_GetGattDb(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle,
|
||||
btgatt_db_element_t **db, int *count);
|
||||
btgatt_db_element_t **db, UINT16 *count);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
|
@ -1227,7 +1227,7 @@ extern void BTA_GATTS_Disable(void);
|
|||
** Description This function is called to register application callbacks
|
||||
** with BTA GATTS module.
|
||||
**
|
||||
** Parameters p_app_uuid - applicaiton UUID
|
||||
** Parameters p_app_uuid - application UUID
|
||||
** p_cback - pointer to the application callback function.
|
||||
**
|
||||
** Returns None
|
||||
|
@ -1350,7 +1350,7 @@ extern void BTA_GATTS_DeleteService(UINT16 service_id);
|
|||
** Description This function is called to start a service.
|
||||
**
|
||||
** Parameters service_id: the service ID to be started.
|
||||
** sup_transport: supported trasnport.
|
||||
** sup_transport: supported transport.
|
||||
**
|
||||
** Returns None.
|
||||
**
|
||||
|
|
|
@ -80,7 +80,7 @@ static void _btc_storage_save(void)
|
|||
//delete device info
|
||||
string_to_bdaddr(need_remove_section, &bd_addr);
|
||||
BTM_SecDeleteDevice(bd_addr.address, BT_TRANSPORT_LE);
|
||||
//delet config info
|
||||
//delete config info
|
||||
if(btc_config_remove_section(need_remove_section)) {
|
||||
BTIF_TRACE_WARNING("exceeded the maximum nubmer of bonded devices, delete the last device info : %s", need_remove_section);
|
||||
}
|
||||
|
@ -901,7 +901,7 @@ bt_status_t btc_storage_get_bonded_ble_devices_list(esp_ble_bond_dev_t *bond_dev
|
|||
bond_dev->bond_key.pid_key.addr_type = pid_key->addr_type;
|
||||
memcpy(&bond_dev->bond_key.pid_key.static_addr, pid_key->static_addr, ESP_BD_ADDR_LEN);
|
||||
}
|
||||
//serch for the next bond device
|
||||
//search for the next bond device
|
||||
bond_dev++;
|
||||
}
|
||||
btc_config_unlock();
|
||||
|
|
|
@ -315,7 +315,7 @@ esp_gatt_status_t btc_ble_gattc_get_service(uint16_t conn_id, esp_bt_uuid_t *svc
|
|||
{
|
||||
esp_gatt_status_t status;
|
||||
btgatt_db_element_t *db = NULL;
|
||||
int svc_num = 0;
|
||||
uint16_t svc_num = 0;
|
||||
tBT_UUID *bta_uuid = NULL;
|
||||
if (svc_uuid) {
|
||||
bta_uuid = osi_malloc(sizeof(tBT_UUID));
|
||||
|
@ -324,7 +324,7 @@ esp_gatt_status_t btc_ble_gattc_get_service(uint16_t conn_id, esp_bt_uuid_t *svc
|
|||
|
||||
BTA_GATTC_GetServiceWithUUID(conn_id, bta_uuid, &db, &svc_num);
|
||||
|
||||
if ((status = btc_gattc_check_valid_param(svc_num, offset)) != ESP_GATT_OK) {
|
||||
if ((status = btc_gattc_check_valid_param((int)svc_num, offset)) != ESP_GATT_OK) {
|
||||
if (db) {
|
||||
osi_free(db);
|
||||
}
|
||||
|
@ -334,7 +334,7 @@ esp_gatt_status_t btc_ble_gattc_get_service(uint16_t conn_id, esp_bt_uuid_t *svc
|
|||
*count = 0;
|
||||
return status;
|
||||
} else {
|
||||
btc_gattc_fill_gatt_db_conversion(*count, (uint16_t)svc_num, ESP_GATT_DB_PRIMARY_SERVICE, offset, (void *)result, db);
|
||||
btc_gattc_fill_gatt_db_conversion(*count, svc_num, ESP_GATT_DB_PRIMARY_SERVICE, offset, (void *)result, db);
|
||||
}
|
||||
|
||||
*count = svc_num;
|
||||
|
@ -356,17 +356,17 @@ esp_gatt_status_t btc_ble_gattc_get_all_char(uint16_t conn_id,
|
|||
{
|
||||
esp_gatt_status_t status;
|
||||
btgatt_db_element_t *db = NULL;
|
||||
int char_num = 0;
|
||||
uint16_t char_num = 0;
|
||||
BTA_GATTC_GetAllChar(conn_id, start_handle, end_handle, &db, &char_num);
|
||||
|
||||
if ((status = btc_gattc_check_valid_param(char_num, offset)) != ESP_GATT_OK) {
|
||||
if ((status = btc_gattc_check_valid_param((int)char_num, offset)) != ESP_GATT_OK) {
|
||||
if (db) {
|
||||
osi_free(db);
|
||||
}
|
||||
*count = 0;
|
||||
return status;
|
||||
} else {
|
||||
btc_gattc_fill_gatt_db_conversion(*count, (uint16_t)char_num, ESP_GATT_DB_CHARACTERISTIC, offset, (void *)result, db);
|
||||
btc_gattc_fill_gatt_db_conversion(*count, char_num, ESP_GATT_DB_CHARACTERISTIC, offset, (void *)result, db);
|
||||
}
|
||||
|
||||
*count = char_num;
|
||||
|
@ -384,17 +384,17 @@ esp_gatt_status_t btc_ble_gattc_get_all_descr(uint16_t conn_id,
|
|||
{
|
||||
esp_gatt_status_t status;
|
||||
btgatt_db_element_t *db = NULL;
|
||||
int descr_num = 0;
|
||||
uint16_t descr_num = 0;
|
||||
BTA_GATTC_GetAllDescriptor(conn_id, char_handle, &db, &descr_num);
|
||||
|
||||
if ((status = btc_gattc_check_valid_param(descr_num, offset)) != ESP_GATT_OK) {
|
||||
if ((status = btc_gattc_check_valid_param((int)descr_num, offset)) != ESP_GATT_OK) {
|
||||
if (db) {
|
||||
osi_free(db);
|
||||
}
|
||||
*count = 0;
|
||||
return status;
|
||||
} else {
|
||||
btc_gattc_fill_gatt_db_conversion(*count, (uint16_t)descr_num, ESP_GATT_DB_DESCRIPTOR, offset, (void *)result, db);
|
||||
btc_gattc_fill_gatt_db_conversion(*count, descr_num, ESP_GATT_DB_DESCRIPTOR, offset, (void *)result, db);
|
||||
}
|
||||
|
||||
*count = descr_num;
|
||||
|
@ -414,19 +414,19 @@ esp_gatt_status_t btc_ble_gattc_get_char_by_uuid(uint16_t conn_id,
|
|||
{
|
||||
esp_gatt_status_t status;
|
||||
btgatt_db_element_t *db = NULL;
|
||||
int char_num = 0;
|
||||
uint16_t char_num = 0;
|
||||
tBT_UUID bta_uuid = {0};
|
||||
btc_to_bta_uuid(&bta_uuid, &char_uuid);
|
||||
BTA_GATTC_GetCharByUUID(conn_id, start_handle, end_handle, bta_uuid, &db, &char_num);
|
||||
|
||||
if ((status = btc_gattc_check_valid_param(char_num, 0)) != ESP_GATT_OK) {
|
||||
if ((status = btc_gattc_check_valid_param((int)char_num, 0)) != ESP_GATT_OK) {
|
||||
if (db) {
|
||||
osi_free(db);
|
||||
}
|
||||
*count = 0;
|
||||
return status;
|
||||
} else {
|
||||
btc_gattc_fill_gatt_db_conversion(*count, (uint16_t)char_num, ESP_GATT_DB_CHARACTERISTIC, 0, (void *)result, db);
|
||||
btc_gattc_fill_gatt_db_conversion(*count, char_num, ESP_GATT_DB_CHARACTERISTIC, 0, (void *)result, db);
|
||||
}
|
||||
|
||||
*count = char_num;
|
||||
|
@ -447,7 +447,7 @@ esp_gatt_status_t btc_ble_gattc_get_descr_by_uuid(uint16_t conn_id,
|
|||
{
|
||||
esp_gatt_status_t status;
|
||||
btgatt_db_element_t *db = NULL;
|
||||
int descr_num = 0;
|
||||
uint16_t descr_num = 0;
|
||||
tBT_UUID bta_char_uuid = {0};
|
||||
tBT_UUID bta_descr_uuid = {0};
|
||||
btc_to_bta_uuid(&bta_char_uuid, &char_uuid);
|
||||
|
@ -456,14 +456,14 @@ esp_gatt_status_t btc_ble_gattc_get_descr_by_uuid(uint16_t conn_id,
|
|||
BTA_GATTC_GetDescrByUUID(conn_id, start_handle, end_handle,
|
||||
bta_char_uuid, bta_descr_uuid, &db, &descr_num);
|
||||
|
||||
if ((status = btc_gattc_check_valid_param(descr_num, 0)) != ESP_GATT_OK) {
|
||||
if ((status = btc_gattc_check_valid_param((int)descr_num, 0)) != ESP_GATT_OK) {
|
||||
if (db) {
|
||||
osi_free(db);
|
||||
}
|
||||
*count = 0;
|
||||
return status;
|
||||
} else {
|
||||
btc_gattc_fill_gatt_db_conversion(*count, (uint16_t)descr_num, ESP_GATT_DB_DESCRIPTOR, 0, (void *)result, db);
|
||||
btc_gattc_fill_gatt_db_conversion(*count, descr_num, ESP_GATT_DB_DESCRIPTOR, 0, (void *)result, db);
|
||||
}
|
||||
|
||||
*count = descr_num;
|
||||
|
@ -482,20 +482,20 @@ esp_gatt_status_t btc_ble_gattc_get_descr_by_char_handle(uint16_t conn_id,
|
|||
{
|
||||
esp_gatt_status_t status;
|
||||
btgatt_db_element_t *db = NULL;
|
||||
int descr_num = 0;
|
||||
uint16_t descr_num = 0;
|
||||
tBT_UUID bta_descr_uuid = {0};
|
||||
btc_to_bta_uuid(&bta_descr_uuid, &descr_uuid);
|
||||
|
||||
BTA_GATTC_GetDescrByCharHandle(conn_id, char_handle, bta_descr_uuid, &db, &descr_num);
|
||||
|
||||
if ((status = btc_gattc_check_valid_param(descr_num, 0)) != ESP_GATT_OK) {
|
||||
if ((status = btc_gattc_check_valid_param((int)descr_num, 0)) != ESP_GATT_OK) {
|
||||
if (db) {
|
||||
osi_free(db);
|
||||
}
|
||||
*count = 0;
|
||||
return status;
|
||||
} else {
|
||||
btc_gattc_fill_gatt_db_conversion(*count, (uint16_t)descr_num, ESP_GATT_DB_DESCRIPTOR, 0, (void *)result, db);
|
||||
btc_gattc_fill_gatt_db_conversion(*count, descr_num, ESP_GATT_DB_DESCRIPTOR, 0, (void *)result, db);
|
||||
}
|
||||
|
||||
*count = descr_num;
|
||||
|
@ -516,7 +516,7 @@ esp_gatt_status_t btc_ble_gattc_get_include_service(uint16_t conn_id,
|
|||
{
|
||||
esp_gatt_status_t status;
|
||||
btgatt_db_element_t *db = NULL;
|
||||
int incl_num = 0;
|
||||
uint16_t incl_num = 0;
|
||||
tBT_UUID bta_uuid = {0};
|
||||
|
||||
if (incl_uuid != NULL) {
|
||||
|
@ -526,14 +526,14 @@ esp_gatt_status_t btc_ble_gattc_get_include_service(uint16_t conn_id,
|
|||
BTA_GATTC_GetIncludeService(conn_id, start_handle, end_handle, NULL, &db, &incl_num);
|
||||
}
|
||||
|
||||
if ((status = btc_gattc_check_valid_param(incl_num, 0)) != ESP_GATT_OK) {
|
||||
if ((status = btc_gattc_check_valid_param((int)incl_num, 0)) != ESP_GATT_OK) {
|
||||
if (db) {
|
||||
osi_free(db);
|
||||
}
|
||||
*count = 0;
|
||||
return status;
|
||||
}else {
|
||||
btc_gattc_fill_gatt_db_conversion(*count, (uint16_t)incl_num, ESP_GATT_DB_INCLUDED_SERVICE, 0, (void *)result, db);
|
||||
btc_gattc_fill_gatt_db_conversion(*count, incl_num, ESP_GATT_DB_INCLUDED_SERVICE, 0, (void *)result, db);
|
||||
}
|
||||
|
||||
*count = incl_num;
|
||||
|
@ -552,9 +552,9 @@ esp_gatt_status_t btc_ble_gattc_get_attr_count(uint16_t conn_id,
|
|||
uint16_t *count)
|
||||
{
|
||||
if (type == ESP_GATT_DB_ALL) {
|
||||
BTA_GATTC_GetDBSize(conn_id, start_handle, end_handle, (int *)count);
|
||||
BTA_GATTC_GetDBSize(conn_id, start_handle, end_handle, count);
|
||||
} else {
|
||||
BTA_GATTC_GetDBSizeByType(conn_id, type, start_handle, end_handle, char_handle, (int *)count);
|
||||
BTA_GATTC_GetDBSizeByType(conn_id, type, start_handle, end_handle, char_handle, count);
|
||||
}
|
||||
|
||||
return ESP_GATT_OK;
|
||||
|
@ -564,7 +564,7 @@ esp_gatt_status_t btc_ble_gattc_get_db(uint16_t conn_id, uint16_t start_handle,
|
|||
esp_gattc_db_elem_t *db, uint16_t *count)
|
||||
{
|
||||
btgatt_db_element_t *get_db = NULL;
|
||||
int num = 0;
|
||||
uint16_t num = 0;
|
||||
tBT_UUID bta_uuid;
|
||||
uint16_t db_size = 0;
|
||||
BTA_GATTC_GetGattDb(conn_id, start_handle, end_handle, &get_db, &num);
|
||||
|
|
|
@ -381,7 +381,13 @@ static void btc_gatts_act_create_attr_tab(esp_gatts_attr_db_t *gatts_attr_db,
|
|||
case ESP_GATT_UUID_CHAR_AGG_FORMAT:
|
||||
case ESP_GATT_UUID_CHAR_VALID_RANGE:
|
||||
case ESP_GATT_UUID_EXT_RPT_REF_DESCR:
|
||||
case ESP_GATT_UUID_RPT_REF_DESCR:{
|
||||
case ESP_GATT_UUID_RPT_REF_DESCR:
|
||||
case ESP_GATT_UUID_NUM_DIGITALS_DESCR:
|
||||
case ESP_GATT_UUID_VALUE_TRIGGER_DESCR:
|
||||
case ESP_GATT_UUID_ENV_SENSING_CONFIG_DESCR:
|
||||
case ESP_GATT_UUID_ENV_SENSING_MEASUREMENT_DESCR:
|
||||
case ESP_GATT_UUID_ENV_SENSING_TRIGGER_DESCR:
|
||||
case ESP_GATT_UUID_TIME_TRIGGER_DESCR: {
|
||||
uint16_t svc_hal = btc_creat_tab_env.svc_start_hdl;
|
||||
tBT_UUID bta_char_uuid;
|
||||
esp_bt_uuid_t uuid_temp;
|
||||
|
@ -443,7 +449,7 @@ static esp_gatt_status_t btc_gatts_check_valid_attr_tab(esp_gatts_attr_db_t *gat
|
|||
case ESP_GATT_UUID_PRI_SERVICE:
|
||||
case ESP_GATT_UUID_SEC_SERVICE:
|
||||
if (++svc_num > 1) {
|
||||
BTC_TRACE_ERROR("Each service table can only created one primary service or secondly service.");
|
||||
BTC_TRACE_ERROR("Each service table can only created one primary service or secondary service.");
|
||||
return ESP_GATT_ERROR;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -127,7 +127,7 @@ static void avdt_sec_check_complete_term (BD_ADDR bd_addr, tBT_TRANSPORT transpo
|
|||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
static void avdt_sec_check_complete_orig (BD_ADDR bd_addr, tBT_TRANSPORT trasnport,
|
||||
static void avdt_sec_check_complete_orig (BD_ADDR bd_addr, tBT_TRANSPORT transport,
|
||||
void *p_ref_data, UINT8 res)
|
||||
{
|
||||
tAVDT_CCB *p_ccb = NULL;
|
||||
|
|
|
@ -921,7 +921,7 @@ tBTM_STATUS btm_ble_clear_scan_pf_filter(tBTM_BLE_SCAN_COND_OP action,
|
|||
|
||||
/* clear the general filter entry */
|
||||
if (NULL == p_target) {
|
||||
/* clear manufactuer data filter */
|
||||
/* clear manufacturer data filter */
|
||||
st = btm_ble_update_pf_manu_data(BTM_BLE_SCAN_COND_CLEAR, filt_index, NULL,
|
||||
BTM_BLE_PF_MANU_DATA, cb_evt, ref_value);
|
||||
if (BTM_CMD_STARTED == st) {
|
||||
|
@ -1213,7 +1213,7 @@ tBTM_STATUS BTM_BleCfgFilterCondition(tBTM_BLE_SCAN_COND_OP action,
|
|||
st = btm_ble_update_addr_filter(action, filt_index, p_cond);
|
||||
break;
|
||||
|
||||
/* filter on service/solicitated UUID */
|
||||
/* filter on service/solicited UUID */
|
||||
case BTM_BLE_PF_SRVC_UUID:
|
||||
case BTM_BLE_PF_SRVC_SOL_UUID:
|
||||
st = btm_ble_update_uuid_filter(action, filt_index, cond_type, p_cond, 0, ref_value);
|
||||
|
|
|
@ -1116,7 +1116,7 @@ void btm_sec_link_key_notification (UINT8 *p_bda, UINT8 *p_link_key, UINT8 key_
|
|||
void btm_sec_link_key_request (UINT8 *p_bda);
|
||||
void btm_sec_pin_code_request (UINT8 *p_bda);
|
||||
void btm_sec_update_clock_offset (UINT16 handle, UINT16 clock_offset);
|
||||
void btm_sec_dev_rec_cback_event (tBTM_SEC_DEV_REC *p_dev_rec, UINT8 res, BOOLEAN is_le_trasnport);
|
||||
void btm_sec_dev_rec_cback_event (tBTM_SEC_DEV_REC *p_dev_rec, UINT8 res, BOOLEAN is_le_transport);
|
||||
void btm_sec_set_peer_sec_caps (tACL_CONN *p_acl_cb, tBTM_SEC_DEV_REC *p_dev_rec);
|
||||
|
||||
#if BLE_INCLUDED == TRUE
|
||||
|
|
|
@ -455,7 +455,7 @@ BT_HDR *attp_build_sr_msg(tGATT_TCB *p_tcb, UINT8 op_code, tGATT_SR_MSG *p_msg)
|
|||
** Parameter p_tcb: pointer to the connecton control block.
|
||||
** p_msg: pointer to message parameters structure.
|
||||
**
|
||||
** Returns GATT_SUCCESS if sucessfully sent; otherwise error code.
|
||||
** Returns GATT_SUCCESS if successfully sent; otherwise error code.
|
||||
**
|
||||
**
|
||||
*******************************************************************************/
|
||||
|
@ -526,7 +526,7 @@ tGATT_STATUS attp_cl_send_cmd(tGATT_TCB *p_tcb, UINT16 clcb_idx, UINT8 cmd_code,
|
|||
** op_code: message op code.
|
||||
** p_msg: pointer to message parameters structure.
|
||||
**
|
||||
** Returns GATT_SUCCESS if sucessfully sent; otherwise error code.
|
||||
** Returns GATT_SUCCESS if successfully sent; otherwise error code.
|
||||
**
|
||||
**
|
||||
*******************************************************************************/
|
||||
|
|
|
@ -80,7 +80,7 @@ UINT8 GATT_SetTraceLevel (UINT8 new_level)
|
|||
**
|
||||
** Parameter p_hndl_range: pointer to allocated handles information
|
||||
**
|
||||
** Returns TRUE if handle range is added sucessfully; otherwise FALSE.
|
||||
** Returns TRUE if handle range is added successfully; otherwise FALSE.
|
||||
**
|
||||
*******************************************************************************/
|
||||
|
||||
|
@ -382,7 +382,7 @@ BOOLEAN GATTS_DeleteService (tGATT_IF gatt_if, tBT_UUID *p_svc_uuid, UINT16 svc_
|
|||
GATT_TRACE_DEBUG ("GATTS_DeleteService");
|
||||
|
||||
if (p_reg == NULL) {
|
||||
GATT_TRACE_ERROR ("Applicaiton not foud");
|
||||
GATT_TRACE_ERROR ("Application not foud");
|
||||
return (FALSE);
|
||||
}
|
||||
p_app_uuid128 = &p_reg->app_uuid128;
|
||||
|
@ -434,7 +434,7 @@ BOOLEAN GATTS_DeleteService (tGATT_IF gatt_if, tBT_UUID *p_svc_uuid, UINT16 svc_
|
|||
** p_cback : application service callback functions.
|
||||
** sup_transport : supported transport(s) for this primary service
|
||||
**
|
||||
** return GATT_SUCCESS if sucessfully started; otherwise error code.
|
||||
** return GATT_SUCCESS if successfully started; otherwise error code.
|
||||
**
|
||||
*******************************************************************************/
|
||||
tGATT_STATUS GATTS_StartService (tGATT_IF gatt_if, UINT16 service_handle,
|
||||
|
@ -454,7 +454,7 @@ tGATT_STATUS GATTS_StartService (tGATT_IF gatt_if, UINT16 service_handle,
|
|||
|
||||
if (p_reg == NULL) {
|
||||
/* Not found */
|
||||
GATT_TRACE_ERROR ("Applicaiton not found ");
|
||||
GATT_TRACE_ERROR ("Application not found ");
|
||||
return GATT_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
@ -562,7 +562,7 @@ void GATTS_StopService (UINT16 service_handle)
|
|||
** val_len: Length of the indicated attribute value.
|
||||
** p_val: Pointer to the indicated attribute value data.
|
||||
**
|
||||
** Returns GATT_SUCCESS if sucessfully sent or queued; otherwise error code.
|
||||
** Returns GATT_SUCCESS if successfully sent or queued; otherwise error code.
|
||||
**
|
||||
*******************************************************************************/
|
||||
tGATT_STATUS GATTS_HandleValueIndication (UINT16 conn_id, UINT16 attr_handle, UINT16 val_len, UINT8 *p_val)
|
||||
|
@ -629,7 +629,7 @@ tGATT_STATUS GATTS_HandleValueIndication (UINT16 conn_id, UINT16 attr_handle, U
|
|||
** val_len: Length of the indicated attribute value.
|
||||
** p_val: Pointer to the indicated attribute value data.
|
||||
**
|
||||
** Returns GATT_SUCCESS if sucessfully sent; otherwise error code.
|
||||
** Returns GATT_SUCCESS if successfully sent; otherwise error code.
|
||||
**
|
||||
*******************************************************************************/
|
||||
tGATT_STATUS GATTS_HandleValueNotification (UINT16 conn_id, UINT16 attr_handle,
|
||||
|
@ -677,7 +677,7 @@ tGATT_STATUS GATTS_HandleValueNotification (UINT16 conn_id, UINT16 attr_handle,
|
|||
** status: response status
|
||||
** p_msg: pointer to message parameters structure.
|
||||
**
|
||||
** Returns GATT_SUCCESS if sucessfully sent; otherwise error code.
|
||||
** Returns GATT_SUCCESS if successfully sent; otherwise error code.
|
||||
**
|
||||
*******************************************************************************/
|
||||
tGATT_STATUS GATTS_SendRsp (UINT16 conn_id, UINT32 trans_id,
|
||||
|
@ -1054,7 +1054,7 @@ tGATT_STATUS GATTC_Write (UINT16 conn_id, tGATT_WRITE_TYPE type, tGATT_VALUE *p_
|
|||
** the server.
|
||||
**
|
||||
** Parameters conn_id: connection identifier.
|
||||
** is_execute - to execute or cancel the prepare write requet(s)
|
||||
** is_execute - to execute or cancel the prepare write request(s)
|
||||
**
|
||||
** Returns GATT_SUCCESS if command started successfully.
|
||||
**
|
||||
|
@ -1232,7 +1232,7 @@ tGATT_IF GATT_Register (tBT_UUID *p_app_uuid128, const tGATT_CBACK *p_cb_info)
|
|||
**
|
||||
** Description This function deregistered the application from GATT.
|
||||
**
|
||||
** Parameters gatt_if: applicaiton interface.
|
||||
** Parameters gatt_if: application interface.
|
||||
**
|
||||
** Returns None.
|
||||
**
|
||||
|
@ -1309,7 +1309,7 @@ void GATT_Deregister (tGATT_IF gatt_if)
|
|||
** callbacks for registered interface. Function may call back
|
||||
** with connection status and queued notifications
|
||||
**
|
||||
** Parameter gatt_if: applicaiton interface.
|
||||
** Parameter gatt_if: application interface.
|
||||
**
|
||||
** Returns None.
|
||||
**
|
||||
|
@ -1342,13 +1342,13 @@ void GATT_StartIf (tGATT_IF gatt_if)
|
|||
**
|
||||
** Function GATT_Connect
|
||||
**
|
||||
** Description This function initiate a connecttion to a remote device on GATT
|
||||
** Description This function initiate a connection to a remote device on GATT
|
||||
** channel.
|
||||
**
|
||||
** Parameters gatt_if: applicaiton interface
|
||||
** Parameters gatt_if: application interface
|
||||
** bd_addr: peer device address.
|
||||
** bd_addr_type: peer device address type.
|
||||
** is_direct: is a direct conenection or a background auto connection
|
||||
** is_direct: is a direct connection or a background auto connection
|
||||
**
|
||||
** Returns TRUE if connection started; FALSE if connection start failure.
|
||||
**
|
||||
|
@ -1532,10 +1532,10 @@ tGATT_STATUS GATT_SendServiceChangeIndication (BD_ADDR bd_addr)
|
|||
** interface
|
||||
**
|
||||
** Parameters conn_id: connection id (input)
|
||||
** p_gatt_if: applicaiton interface (output)
|
||||
** p_gatt_if: application interface (output)
|
||||
** bd_addr: peer device address. (output)
|
||||
**
|
||||
** Returns TRUE the ligical link information is found for conn_id
|
||||
** Returns TRUE the logical link information is found for conn_id
|
||||
**
|
||||
*******************************************************************************/
|
||||
BOOLEAN GATT_GetConnectionInfor(UINT16 conn_id, tGATT_IF *p_gatt_if, BD_ADDR bd_addr,
|
||||
|
@ -1567,7 +1567,7 @@ BOOLEAN GATT_GetConnectionInfor(UINT16 conn_id, tGATT_IF *p_gatt_if, BD_ADDR bd_
|
|||
** Description This function find the conn_id if the logical link for BD address
|
||||
** and applciation interface is connected
|
||||
**
|
||||
** Parameters gatt_if: applicaiton interface (input)
|
||||
** Parameters gatt_if: application interface (input)
|
||||
** bd_addr: peer device address. (input)
|
||||
** p_conn_id: connection id (output)
|
||||
** transport: transport option
|
||||
|
@ -1599,7 +1599,7 @@ BOOLEAN GATT_GetConnIdIfConnected(tGATT_IF gatt_if, BD_ADDR bd_addr, UINT16 *p_c
|
|||
** Description This function start or stop LE advertisement and listen for
|
||||
** connection.
|
||||
**
|
||||
** Parameters gatt_if: applicaiton interface
|
||||
** Parameters gatt_if: application interface
|
||||
** p_bd_addr: listen for specific address connection, or NULL for
|
||||
** listen to all device connection.
|
||||
** start: start or stop listening.
|
||||
|
|
|
@ -1028,7 +1028,7 @@ void gatt_add_a_bonded_dev_for_srv_chg (BD_ADDR bda)
|
|||
** Description This function is called to send a service changed indication to
|
||||
** the specified bd address
|
||||
**
|
||||
** Returns GATT_SUCCESS if sucessfully sent; otherwise error code
|
||||
** Returns GATT_SUCCESS if successfully sent; otherwise error code
|
||||
**
|
||||
*******************************************************************************/
|
||||
#if (GATTS_INCLUDED == TRUE)
|
||||
|
|
|
@ -669,7 +669,7 @@ static tGATT_STATUS gatt_build_primary_service_rsp (BT_HDR *p_msg, tGATT_TCB *p_
|
|||
** Description fill the find information response information in the given
|
||||
** buffer.
|
||||
**
|
||||
** Returns TRUE: if data filled sucessfully.
|
||||
** Returns TRUE: if data filled successfully.
|
||||
** FALSE: packet full, or format mismatch.
|
||||
**
|
||||
*******************************************************************************/
|
||||
|
@ -962,7 +962,7 @@ static void gatts_process_mtu_req (tGATT_TCB *p_tcb, UINT16 len, UINT8 *p_data)
|
|||
if ((p_buf = attp_build_sr_msg(p_tcb, GATT_RSP_MTU, (tGATT_SR_MSG *) &p_tcb->payload_size)) != NULL) {
|
||||
attp_send_sr_msg (p_tcb, p_buf);
|
||||
|
||||
/* Notify all registered applicaiton with new MTU size. Us a transaction ID */
|
||||
/* Notify all registered application with new MTU size. Us a transaction ID */
|
||||
/* of 0, as no response is allowed from applcations */
|
||||
|
||||
for (i = 0; i < GATT_MAX_APPS; i ++) {
|
||||
|
|
|
@ -1887,7 +1887,7 @@ void gatt_sr_reset_prep_cnt(tGATT_TCB *p_tcb )
|
|||
**
|
||||
** Function gatt_sr_update_cback_cnt
|
||||
**
|
||||
** Description Update the teh applicaiton callback count
|
||||
** Description Update the teh application callback count
|
||||
**
|
||||
** Returns None
|
||||
**
|
||||
|
@ -1977,7 +1977,7 @@ BOOLEAN gatt_cancel_open(tGATT_IF gatt_if, BD_ADDR bda)
|
|||
**
|
||||
** Function gatt_find_app_hold_link
|
||||
**
|
||||
** Description find the applicaiton that is holding the specified link
|
||||
** Description find the application that is holding the specified link
|
||||
**
|
||||
** Returns Boolean
|
||||
**
|
||||
|
@ -2002,7 +2002,7 @@ BOOLEAN gatt_find_app_hold_link(tGATT_TCB *p_tcb, UINT8 start_idx, UINT8 *p_foun
|
|||
**
|
||||
** Function gatt_find_specific_app_in_hold_link
|
||||
**
|
||||
** Description find the specific applicaiton that is holding the specified link
|
||||
** Description find the specific application that is holding the specified link
|
||||
**
|
||||
** Returns Boolean
|
||||
**
|
||||
|
|
|
@ -1562,7 +1562,7 @@ typedef void (tBTM_MKEY_CALLBACK) (BD_ADDR bd_addr, UINT8 status, UINT8 key_flag
|
|||
** optional data passed in by BTM_SetEncryption
|
||||
** tBTM_STATUS - result of the operation
|
||||
*/
|
||||
typedef void (tBTM_SEC_CBACK) (BD_ADDR bd_addr, tBT_TRANSPORT trasnport,
|
||||
typedef void (tBTM_SEC_CBACK) (BD_ADDR bd_addr, tBT_TRANSPORT transport,
|
||||
void *p_ref_data, tBTM_STATUS result);
|
||||
|
||||
/* Bond Cancel complete. Parameters are
|
||||
|
|
|
@ -448,7 +448,7 @@ typedef struct {
|
|||
|
||||
typedef struct {
|
||||
tBTM_BLE_INT_RANGE int_range; /* slave prefered conn interval range */
|
||||
tBTM_BLE_MANU *p_manu; /* manufactuer data */
|
||||
tBTM_BLE_MANU *p_manu; /* manufacturer data */
|
||||
tBTM_BLE_SERVICE *p_services; /* services */
|
||||
tBTM_BLE_128SERVICE *p_services_128b; /* 128 bits service */
|
||||
tBTM_BLE_32SERVICE *p_service_32b; /* 32 bits Service UUID */
|
||||
|
@ -732,10 +732,10 @@ typedef struct {
|
|||
|
||||
typedef union {
|
||||
tBLE_BD_ADDR target_addr;
|
||||
tBTM_BLE_PF_LOCAL_NAME_COND local_name; /* lcoal name filtering */
|
||||
tBTM_BLE_PF_MANU_COND manu_data; /* manufactuer data filtering */
|
||||
tBTM_BLE_PF_LOCAL_NAME_COND local_name; /* local name filtering */
|
||||
tBTM_BLE_PF_MANU_COND manu_data; /* manufacturer data filtering */
|
||||
tBTM_BLE_PF_UUID_COND srvc_uuid; /* service UUID filtering */
|
||||
tBTM_BLE_PF_UUID_COND solicitate_uuid; /* solicitated service UUID filtering */
|
||||
tBTM_BLE_PF_UUID_COND solicitate_uuid; /* solicited service UUID filtering */
|
||||
tBTM_BLE_PF_SRVC_PATTERN_COND srvc_data; /* service data pattern */
|
||||
} tBTM_BLE_PF_COND_PARAM;
|
||||
|
||||
|
@ -1052,9 +1052,9 @@ void BTM_BleReadAdvParams (UINT16 *adv_int_min, UINT16 *adv_int_max,
|
|||
**
|
||||
** Function BTM_BleObtainVendorCapabilities
|
||||
**
|
||||
** Description This function is called to obatin vendor capabilties
|
||||
** Description This function is called to obtain vendor capabilities
|
||||
**
|
||||
** Parameters p_cmn_vsc_cb - Returns the vednor capabilities
|
||||
** Parameters p_cmn_vsc_cb - Returns the vendor capabilities
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
|
|
|
@ -111,7 +111,7 @@ typedef UINT8 tGATT_STATUS;
|
|||
#define GATT_SIGN_CMD_WRITE 0xD2 /* changed in V4.0 1101-0010 (signed write) see write cmd above*/
|
||||
#define GATT_OP_CODE_MAX GATT_HANDLE_VALUE_CONF + 1 /* 0x1E = 30 + 1 = 31*/
|
||||
|
||||
#define GATT_COMMAND_FLAG 0x40 /* Command Flag: set to one means commond */
|
||||
#define GATT_COMMAND_FLAG 0x40 /* Command Flag: set to one means command */
|
||||
|
||||
#define GATT_HANDLE_IS_VALID(x) ((x) != 0)
|
||||
|
||||
|
@ -131,7 +131,7 @@ typedef UINT16 tGATT_DISCONN_REASON;
|
|||
#define GATT_MAX_MTU_SIZE 517
|
||||
#endif
|
||||
|
||||
/* max legth of an attribute value
|
||||
/* max length of an attribute value
|
||||
*/
|
||||
#ifndef GATT_MAX_ATTR_LEN
|
||||
#define GATT_MAX_ATTR_LEN 600
|
||||
|
@ -247,7 +247,7 @@ typedef UINT8 tGATT_FORMAT;
|
|||
/* Characteristic Presentation Format Descriptor value
|
||||
*/
|
||||
typedef struct {
|
||||
UINT16 unit; /* as UUIUD defined by SIG */
|
||||
UINT16 unit; /* as UUID defined by SIG */
|
||||
UINT16 descr; /* as UUID as defined by SIG */
|
||||
tGATT_FORMAT format;
|
||||
INT8 exp;
|
||||
|
@ -317,7 +317,7 @@ typedef UINT8 tGATT_AUTH_REQ;
|
|||
typedef struct {
|
||||
UINT16 conn_id;
|
||||
UINT16 handle; /* attribute handle */
|
||||
UINT16 offset; /* attribute value offset, if no offfset is needed for the command, ignore it */
|
||||
UINT16 offset; /* attribute value offset, if no offset is needed for the command, ignore it */
|
||||
UINT16 len; /* length of attribute value */
|
||||
tGATT_AUTH_REQ auth_req; /* authentication request */
|
||||
UINT8 value[GATT_MAX_ATTR_LEN]; /* the actual attribute value */
|
||||
|
@ -368,7 +368,7 @@ typedef struct {
|
|||
/* write request data */
|
||||
typedef struct {
|
||||
UINT16 handle; /* attribute handle */
|
||||
UINT16 offset; /* attribute value offset, if no offfset is needed for the command, ignore it */
|
||||
UINT16 offset; /* attribute value offset, if no offset is needed for the command, ignore it */
|
||||
UINT16 len; /* length of attribute value */
|
||||
UINT8 value[GATT_MAX_ATTR_LEN]; /* the actual attribute value */
|
||||
BOOLEAN need_rsp; /* need write response */
|
||||
|
@ -468,7 +468,7 @@ typedef struct {
|
|||
*/
|
||||
typedef union {
|
||||
tGATT_READ_BY_TYPE service;
|
||||
tGATT_READ_BY_TYPE char_type; /* characterisitc type */
|
||||
tGATT_READ_BY_TYPE char_type; /* characteristic type */
|
||||
tGATT_READ_MULTI read_multiple;
|
||||
tGATT_READ_BY_HANDLE by_handle;
|
||||
tGATT_READ_PARTIAL partial;
|
||||
|
@ -505,7 +505,7 @@ typedef UINT8 tGATTC_OPTYPE;
|
|||
/* characteristic declaration
|
||||
*/
|
||||
typedef struct {
|
||||
tGATT_CHAR_PROP char_prop; /* characterisitc properties */
|
||||
tGATT_CHAR_PROP char_prop; /* characteristic properties */
|
||||
UINT16 val_handle; /* characteristic value attribute handle */
|
||||
tBT_UUID char_uuid; /* characteristic UUID type */
|
||||
} tGATT_CHAR_DCLR_VAL;
|
||||
|
@ -639,7 +639,7 @@ typedef struct {
|
|||
tGATTS_HNDL_RANGE *p_new_srv_start;
|
||||
} tGATTS_PENDING_NEW_SRV_START;
|
||||
|
||||
/* Attibute server handle ranges NV storage callback functions
|
||||
/* Attribute server handle ranges NV storage callback functions
|
||||
*/
|
||||
typedef void (tGATTS_NV_SAVE_CBACK)(BOOLEAN is_saved, tGATTS_HNDL_RANGE *p_hndl_range);
|
||||
typedef BOOLEAN (tGATTS_NV_SRV_CHG_CBACK)(tGATTS_SRV_CHG_CMD cmd, tGATTS_SRV_CHG_REQ *p_req,
|
||||
|
@ -688,7 +688,7 @@ extern UINT8 GATT_SetTraceLevel (UINT8 new_level);
|
|||
**
|
||||
** Parameter p_hndl_range: pointer to allocated handles information
|
||||
**
|
||||
** Returns TRUE if handle range is added sucessfully; otherwise FALSE.
|
||||
** Returns TRUE if handle range is added successfully; otherwise FALSE.
|
||||
**
|
||||
*******************************************************************************/
|
||||
|
||||
|
@ -724,7 +724,7 @@ extern BOOLEAN GATTS_NVRegister (const tGATT_APPL_INFO *p_cb_info);
|
|||
** num_handles : number of handles needed by the service.
|
||||
** is_pri : is a primary service or not.
|
||||
**
|
||||
** Returns service handle if sucessful, otherwise 0.
|
||||
** Returns service handle if successful, otherwise 0.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT16 GATTS_CreateService (tGATT_IF gatt_if, tBT_UUID *p_svc_uuid,
|
||||
|
@ -819,7 +819,7 @@ extern BOOLEAN GATTS_DeleteService (tGATT_IF gatt_if, tBT_UUID *p_svc_uuid,
|
|||
** p_cback : application service callback functions.
|
||||
** sup_transport : supported transport(s) for this primary service
|
||||
**
|
||||
** return GATT_SUCCESS if sucessfully started; otherwise error code.
|
||||
** return GATT_SUCCESS if successfully started; otherwise error code.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tGATT_STATUS GATTS_StartService (tGATT_IF gatt_if, UINT16 service_handle,
|
||||
|
@ -851,7 +851,7 @@ extern void GATTS_StopService (UINT16 service_handle);
|
|||
** val_len: Length of the indicated attribute value.
|
||||
** p_val: Pointer to the indicated attribute value data.
|
||||
**
|
||||
** Returns GATT_SUCCESS if sucessfully sent or queued; otherwise error code.
|
||||
** Returns GATT_SUCCESS if successfully sent or queued; otherwise error code.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tGATT_STATUS GATTS_HandleValueIndication (UINT16 conn_id,
|
||||
|
@ -869,7 +869,7 @@ extern tGATT_STATUS GATTS_HandleValueIndication (UINT16 conn_id,
|
|||
** val_len: Length of the indicated attribute value.
|
||||
** p_val: Pointer to the indicated attribute value data.
|
||||
**
|
||||
** Returns GATT_SUCCESS if sucessfully sent; otherwise error code.
|
||||
** Returns GATT_SUCCESS if successfully sent; otherwise error code.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tGATT_STATUS GATTS_HandleValueNotification (UINT16 conn_id, UINT16 attr_handle,
|
||||
|
@ -887,7 +887,7 @@ extern tGATT_STATUS GATTS_HandleValueNotification (UINT16 conn_id, UINT16 attr_
|
|||
** status: response status
|
||||
** p_msg: pointer to message parameters structure.
|
||||
**
|
||||
** Returns GATT_SUCCESS if sucessfully sent; otherwise error code.
|
||||
** Returns GATT_SUCCESS if successfully sent; otherwise error code.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tGATT_STATUS GATTS_SendRsp (UINT16 conn_id, UINT32 trans_id,
|
||||
|
@ -904,7 +904,7 @@ extern tGATT_STATUS GATTS_SendRsp (UINT16 conn_id, UINT32 trans_id,
|
|||
** length: the attribute length
|
||||
** value: the value to be set to the attribute in the database
|
||||
**
|
||||
** Returns GATT_SUCCESS if sucessfully sent; otherwise error code.
|
||||
** Returns GATT_SUCCESS if successfully sent; otherwise error code.
|
||||
**
|
||||
*******************************************************************************/
|
||||
tGATT_STATUS GATTS_SetAttributeValue(UINT16 attr_handle, UINT16 length, UINT8 *value);
|
||||
|
@ -920,7 +920,7 @@ tGATT_STATUS GATTS_SetAttributeValue(UINT16 attr_handle, UINT16 length, UINT8 *v
|
|||
** length:the attribute value length in the database
|
||||
** value: the attribute value out put
|
||||
**
|
||||
** Returns GATT_SUCCESS if sucessfully sent; otherwise error code.
|
||||
** Returns GATT_SUCCESS if successfully sent; otherwise error code.
|
||||
**
|
||||
*******************************************************************************/
|
||||
tGATT_STATUS GATTS_GetAttributeValue(UINT16 attr_handle, UINT16 *length, UINT8 **value);
|
||||
|
@ -1005,7 +1005,7 @@ extern tGATT_STATUS GATTC_Write (UINT16 conn_id, tGATT_WRITE_TYPE type,
|
|||
** the server.
|
||||
**
|
||||
** Parameters conn_id: connection identifier.
|
||||
** is_execute - to execute or cancel the prepare write requet(s)
|
||||
** is_execute - to execute or cancel the prepare write request(s)
|
||||
**
|
||||
** Returns GATT_SUCCESS if command started successfully.
|
||||
**
|
||||
|
@ -1037,7 +1037,7 @@ extern tGATT_STATUS GATTC_SendHandleValueConfirm (UINT16 conn_id, UINT16 handle)
|
|||
**
|
||||
** Parameter bd_addr: target device bd address.
|
||||
** idle_tout: timeout value in seconds.
|
||||
** transport: trasnport option.
|
||||
** transport: transport option.
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
|
@ -1067,7 +1067,7 @@ extern tGATT_IF GATT_Register (tBT_UUID *p_app_uuid128, const tGATT_CBACK *p_cb
|
|||
**
|
||||
** Description This function deregistered the application from GATT.
|
||||
**
|
||||
** Parameters gatt_if: applicaiton interface.
|
||||
** Parameters gatt_if: application interface.
|
||||
**
|
||||
** Returns None.
|
||||
**
|
||||
|
@ -1082,7 +1082,7 @@ extern void GATT_Deregister (tGATT_IF gatt_if);
|
|||
** callbacks for registered interface. Function may call back
|
||||
** with connection status and queued notifications
|
||||
**
|
||||
** Parameter gatt_if: applicaiton interface.
|
||||
** Parameter gatt_if: application interface.
|
||||
**
|
||||
** Returns None
|
||||
**
|
||||
|
@ -1093,13 +1093,13 @@ extern void GATT_StartIf (tGATT_IF gatt_if);
|
|||
**
|
||||
** Function GATT_Connect
|
||||
**
|
||||
** Description This function initiate a connecttion to a remote device on GATT
|
||||
** Description This function initiate a connection to a remote device on GATT
|
||||
** channel.
|
||||
**
|
||||
** Parameters gatt_if: applicaiton interface
|
||||
** Parameters gatt_if: application interface
|
||||
** bd_addr: peer device address.
|
||||
** bd_addr_type: peer device address type.
|
||||
** is_direct: is a direct conenection or a background auto connection
|
||||
** is_direct: is a direct connection or a background auto connection
|
||||
** transport : Physical transport for GATT connection (BR/EDR or LE)
|
||||
**
|
||||
** Returns TRUE if connection started; FALSE if connection start failure.
|
||||
|
@ -1119,7 +1119,7 @@ extern BOOLEAN GATT_Connect (tGATT_IF gatt_if, BD_ADDR bd_addr, tBLE_ADDR_TYPE b
|
|||
** Parameters gatt_if: client interface. If 0 used as unconditionally disconnect,
|
||||
** typically used for direct connection cancellation.
|
||||
** bd_addr: peer device address.
|
||||
** is_direct: is a direct conenection or a background auto connection
|
||||
** is_direct: is a direct connection or a background auto connection
|
||||
**
|
||||
** Returns TRUE if connection started; FALSE if connection start failure.
|
||||
**
|
||||
|
@ -1158,15 +1158,15 @@ extern tGATT_STATUS GATT_SendServiceChangeIndication (BD_ADDR bd_addr);
|
|||
**
|
||||
** Function GATT_GetConnectionInfor
|
||||
**
|
||||
** Description This function use conn_id to find its associated BD address and applciation
|
||||
** Description This function use conn_id to find its associated BD address and application
|
||||
** interface
|
||||
**
|
||||
** Parameters conn_id: connection id (input)
|
||||
** p_gatt_if: applicaiton interface (output)
|
||||
** p_gatt_if: application interface (output)
|
||||
** bd_addr: peer device address. (output)
|
||||
** transport : physical transport of the GATT connection (BR/EDR or LE)
|
||||
**
|
||||
** Returns TRUE the ligical link information is found for conn_id
|
||||
** Returns TRUE the logical link information is found for conn_id
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN GATT_GetConnectionInfor(UINT16 conn_id, tGATT_IF *p_gatt_if,
|
||||
|
@ -1178,14 +1178,14 @@ extern BOOLEAN GATT_GetConnectionInfor(UINT16 conn_id, tGATT_IF *p_gatt_if,
|
|||
** Function GATT_GetConnIdIfConnected
|
||||
**
|
||||
** Description This function find the conn_id if the logical link for BD address
|
||||
** and applciation interface is connected
|
||||
** and application interface is connected
|
||||
**
|
||||
** Parameters gatt_if: applicaiton interface (input)
|
||||
** Parameters gatt_if: application interface (input)
|
||||
** bd_addr: peer device address. (input)
|
||||
** p_conn_id: connection id (output)
|
||||
** transport : physical transport of the GATT connection (BR/EDR or LE)
|
||||
**
|
||||
** Returns TRUE the ligical link is connected
|
||||
** Returns TRUE the logical link is connected
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN GATT_GetConnIdIfConnected(tGATT_IF gatt_if, BD_ADDR bd_addr,
|
||||
|
@ -1199,10 +1199,10 @@ extern BOOLEAN GATT_GetConnIdIfConnected(tGATT_IF gatt_if, BD_ADDR bd_addr,
|
|||
** Description This function start or stop LE advertisement and listen for
|
||||
** connection.
|
||||
**
|
||||
** Parameters gatt_if: applicaiton interface
|
||||
** Parameters gatt_if: application interface
|
||||
** p_bd_addr: listen for specific address connection, or NULL for
|
||||
** listen to all device connection.
|
||||
** start: is a direct conenection or a background auto connection
|
||||
** start: is a direct connection or a background auto connection
|
||||
**
|
||||
** Returns TRUE if advertisement is started; FALSE if adv start failure.
|
||||
**
|
||||
|
|
|
@ -251,7 +251,7 @@ typedef struct {
|
|||
tL2CAP_APPL_INFO api;
|
||||
} tL2C_RCB;
|
||||
|
||||
typedef void (tL2CAP_SEC_CBACK) (BD_ADDR bd_addr, tBT_TRANSPORT trasnport,
|
||||
typedef void (tL2CAP_SEC_CBACK) (BD_ADDR bd_addr, tBT_TRANSPORT transport,
|
||||
void *p_ref_data, tBTM_STATUS result);
|
||||
|
||||
typedef struct
|
||||
|
@ -723,7 +723,7 @@ extern void l2c_link_process_num_completed_blocks (UINT8 controller_id, UINT
|
|||
extern void l2c_link_processs_num_bufs (UINT16 num_lm_acl_bufs);
|
||||
extern UINT8 l2c_link_pkts_rcvd (UINT16 *num_pkts, UINT16 *handles);
|
||||
extern void l2c_link_role_changed (BD_ADDR bd_addr, UINT8 new_role, UINT8 hci_status);
|
||||
extern void l2c_link_sec_comp (BD_ADDR p_bda, tBT_TRANSPORT trasnport, void *p_ref_data, UINT8 status);
|
||||
extern void l2c_link_sec_comp (BD_ADDR p_bda, tBT_TRANSPORT transport, void *p_ref_data, UINT8 status);
|
||||
extern void l2c_link_segments_xmitted (BT_HDR *p_msg);
|
||||
extern void l2c_pin_code_request (BD_ADDR bd_addr);
|
||||
extern void l2c_link_adjust_chnl_allocation (void);
|
||||
|
|
|
@ -1871,6 +1871,14 @@ BOOLEAN L2CA_CheckIsCongest(UINT16 fixed_cid, UINT16 handle)
|
|||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
UINT16 L2CA_GetFreePktBufferNum_LE(void)
|
||||
{
|
||||
return l2cb.controller_le_xmit_window;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function L2CA_RemoveFixedChnl
|
||||
|
|
|
@ -250,7 +250,7 @@ BOOLEAN l2c_link_hci_conn_comp (UINT8 status, UINT16 handle, BD_ADDR p_bda)
|
|||
l2cu_release_lcb (p_lcb);
|
||||
} else { /* there are any CCBs remaining */
|
||||
if (ci.status == HCI_ERR_CONNECTION_EXISTS) {
|
||||
/* we are in collision situation, wait for connecttion request from controller */
|
||||
/* we are in collision situation, wait for connection request from controller */
|
||||
p_lcb->link_state = LST_CONNECTING;
|
||||
} else {
|
||||
l2cu_create_conn(p_lcb, BT_TRANSPORT_BR_EDR);
|
||||
|
|
|
@ -352,7 +352,7 @@ esp_err_t esp_event_isr_post_to(esp_event_loop_handle_t event_loop,
|
|||
address - memory address of the event loop
|
||||
name - name of the event loop, 'none' if no dedicated task
|
||||
total_recieved - number of successfully posted events
|
||||
total_dropped - number of events unsucessfully posted due to queue being full
|
||||
total_dropped - number of events unsuccessfully posted due to queue being full
|
||||
|
||||
handler
|
||||
format: address ev:base,id inv:total_invoked run:total_runtime
|
||||
|
|
|
@ -181,7 +181,7 @@ set in the ``send_queue_size``. All the buffers are restricted to be no larger t
|
|||
mode several buffers can be sent in one transfer, each buffer is still counted as one in the queue.
|
||||
|
||||
The application can call ``sdio_slave_transmit`` to send packets. In this case the function returns when the transfer
|
||||
is sucessfully done, so the queue is not fully used. When higher effeciency is required, the application can use the
|
||||
is successfully done, so the queue is not fully used. When higher effeciency is required, the application can use the
|
||||
following functions instead:
|
||||
|
||||
1. Pass buffer information (address, length, as well as an ``arg`` indicating the buffer) to ``sdio_slave_send_queue``.
|
||||
|
|
|
@ -269,7 +269,7 @@ On the other hand, if device was not able to connect using the provided Wi-Fi cr
|
|||
|
||||
If this default behavior is not desired, it can be disabled by calling :cpp:func:`wifi_prov_mgr_disable_auto_stop()`. Now the provisioning service will only be stopped after an explicit call to :cpp:func:`wifi_prov_mgr_stop_provisioning()`, which returns immediately after scheduling a task for stopping the service. The service stops after a certain delay and WIFI_PROV_END event gets emitted. This delay is specified by the argument to :cpp:func:`wifi_prov_mgr_disable_auto_stop()`.
|
||||
|
||||
The customized behavior is useful for applications which want the provisioning service to be stopped some time after the Wi-Fi connection is successfully established. For example, if the application requires the device to connect to some cloud service and obtain another set of credentials, and exchange this credentials over a custom protocomm endpoint, then after sucessfully doing so stop the provisioning service by calling :cpp:func:`wifi_prov_mgr_stop_provisioning()` inside the protocomm handler itself. The right amount of delay ensures that the transport resources are freed only after the response from the protocomm handler reaches the client side application.
|
||||
The customized behavior is useful for applications which want the provisioning service to be stopped some time after the Wi-Fi connection is successfully established. For example, if the application requires the device to connect to some cloud service and obtain another set of credentials, and exchange this credentials over a custom protocomm endpoint, then after successfully doing so stop the provisioning service by calling :cpp:func:`wifi_prov_mgr_stop_provisioning()` inside the protocomm handler itself. The right amount of delay ensures that the transport resources are freed only after the response from the protocomm handler reaches the client side application.
|
||||
|
||||
Application Examples
|
||||
--------------------
|
||||
|
|
|
@ -50,14 +50,15 @@ typedef enum {
|
|||
ESP_HIDD_DEINIT_FAILED = 0,
|
||||
} esp_hidd_deinit_state_t;
|
||||
|
||||
#define LEFT_CONTROL_KEY_MASK (1 >> 0)
|
||||
#define LEFT_SHIFT_KEY_MASK (1 >> 1)
|
||||
#define LEFT_ALT_KEY_MASK (1 >> 2)
|
||||
#define LEFT_GUI_KEY_MASK (1 >> 3)
|
||||
#define RIGHT_CONTROL_KEY_MASK (1 >> 4)
|
||||
#define RIGHT_SHIFT_KEY_MASK (1 >> 5)
|
||||
#define RIGHT_ALT_KEY_MASK (1 >> 6)
|
||||
#define RIGHT_GUI_KEY_MASK (1 >> 7)
|
||||
#define LEFT_CONTROL_KEY_MASK (1 << 0)
|
||||
#define LEFT_SHIFT_KEY_MASK (1 << 1)
|
||||
#define LEFT_ALT_KEY_MASK (1 << 2)
|
||||
#define LEFT_GUI_KEY_MASK (1 << 3)
|
||||
#define RIGHT_CONTROL_KEY_MASK (1 << 4)
|
||||
#define RIGHT_SHIFT_KEY_MASK (1 << 5)
|
||||
#define RIGHT_ALT_KEY_MASK (1 << 6)
|
||||
#define RIGHT_GUI_KEY_MASK (1 << 7)
|
||||
|
||||
typedef uint8_t key_mask_t;
|
||||
/**
|
||||
* @brief HIDD callback parameters union
|
||||
|
|
|
@ -30,6 +30,15 @@
|
|||
#include "freertos/semphr.h"
|
||||
#include "freertos/task.h"
|
||||
|
||||
/**********************************************************
|
||||
* Thread/Task reference
|
||||
**********************************************************/
|
||||
#ifdef CONFIG_BLUEDROID_PINNED_TO_CORE
|
||||
#define BLUETOOTH_TASK_PINNED_TO_CORE (CONFIG_BLUEDROID_PINNED_TO_CORE < portNUM_PROCESSORS ? CONFIG_BLUEDROID_PINNED_TO_CORE : tskNO_AFFINITY)
|
||||
#else
|
||||
#define BLUETOOTH_TASK_PINNED_TO_CORE (0)
|
||||
#endif
|
||||
|
||||
#define GATTC_TAG "GATTC_DEMO"
|
||||
#define REMOTE_SERVICE_UUID 0x00FF
|
||||
#define REMOTE_NOTIFY_CHAR_UUID 0xFF01
|
||||
|
@ -58,7 +67,7 @@ static SemaphoreHandle_t gattc_semaphore;
|
|||
uint8_t write_data[GATTC_WRITE_LEN] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0e, 0x0f};
|
||||
#endif /* #if (CONFIG_GATTC_WRITE_THROUGHPUT) */
|
||||
|
||||
static bool is_connecet = false;
|
||||
static bool is_connect = false;
|
||||
|
||||
/* Declare static functions */
|
||||
static void esp_gap_cb(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *param);
|
||||
|
@ -141,7 +150,7 @@ static void gattc_profile_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_
|
|||
}
|
||||
break;
|
||||
case ESP_GATTC_CONNECT_EVT: {
|
||||
is_connecet = true;
|
||||
is_connect = true;
|
||||
ESP_LOGI(GATTC_TAG, "ESP_GATTC_CONNECT_EVT conn_id %d, if %d", p_data->connect.conn_id, gattc_if);
|
||||
gl_profile_tab[PROFILE_A_APP_ID].conn_id = p_data->connect.conn_id;
|
||||
memcpy(gl_profile_tab[PROFILE_A_APP_ID].remote_bda, p_data->connect.remote_bda, sizeof(esp_bd_addr_t));
|
||||
|
@ -331,7 +340,7 @@ static void gattc_profile_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_
|
|||
ESP_LOGI(GATTC_TAG, "write char success ");
|
||||
break;
|
||||
case ESP_GATTC_DISCONNECT_EVT:
|
||||
is_connecet = false;
|
||||
is_connect = false;
|
||||
get_server = false;
|
||||
#if (CONFIG_GATTS_NOTIFY_THROUGHPUT)
|
||||
start = false;
|
||||
|
@ -477,15 +486,15 @@ static void throughput_client_task(void *param)
|
|||
while(1) {
|
||||
#if (CONFIG_GATTS_NOTIFY_THROUGHPUT)
|
||||
vTaskDelay(2000 / portTICK_PERIOD_MS);
|
||||
if(is_connecet){
|
||||
if(is_connect){
|
||||
uint32_t bit_rate = 0;
|
||||
if (start_time) {
|
||||
current_time = esp_timer_get_time();
|
||||
bit_rate = notify_len * SECOND_TO_USECOND / (current_time - start_time);
|
||||
ESP_LOGI(GATTC_TAG, "Notify Bit rate = %d Btye/s, = %d bit/s, time = %ds",
|
||||
ESP_LOGI(GATTC_TAG, "Notify Bit rate = %d Byte/s, = %d bit/s, time = %ds",
|
||||
bit_rate, bit_rate<<3, (int)((current_time - start_time) / SECOND_TO_USECOND));
|
||||
} else {
|
||||
ESP_LOGI(GATTC_TAG, "Notify Bit rate = 0 Btye/s, = 0 bit/s");
|
||||
ESP_LOGI(GATTC_TAG, "Notify Bit rate = 0 Byte/s, = 0 bit/s");
|
||||
}
|
||||
}
|
||||
#endif /* #if (CONFIG_GATTS_NOTIFY_THROUGHPUT) */
|
||||
|
@ -494,7 +503,10 @@ static void throughput_client_task(void *param)
|
|||
int res = xSemaphoreTake(gattc_semaphore, portMAX_DELAY);
|
||||
assert(res == pdTRUE);
|
||||
} else {
|
||||
if (is_connecet) {
|
||||
if (is_connect) {
|
||||
int free_buff_num = esp_ble_get_sendable_packets_num();
|
||||
if(free_buff_num > 0) {
|
||||
for( ; free_buff_num > 0; free_buff_num--) {
|
||||
// the app data set to 490 just for divided into two packages to send in the low layer
|
||||
// when the packet length set to 251.
|
||||
esp_ble_gattc_write_char(gl_profile_tab[PROFILE_A_APP_ID].gattc_if,
|
||||
|
@ -504,6 +516,10 @@ static void throughput_client_task(void *param)
|
|||
ESP_GATT_WRITE_TYPE_NO_RSP,
|
||||
ESP_GATT_AUTH_REQ_NONE);
|
||||
}
|
||||
} else { //Add the vTaskDelay to prevent this task from consuming the CPU all the time, causing low-priority tasks to not be executed at all.
|
||||
vTaskDelay( 10 / portTICK_PERIOD_MS );
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* #if (CONFIG_GATTC_WRITE_THROUGHPUT) */
|
||||
|
||||
|
@ -570,10 +586,12 @@ void app_main()
|
|||
if (local_mtu_ret){
|
||||
ESP_LOGE(GATTC_TAG, "set local MTU failed, error code = %x", local_mtu_ret);
|
||||
}
|
||||
// The task is only created on the CPU core that Bluetooth is working on,
|
||||
// preventing the sending task from using the un-updated Bluetooth state on another CPU.
|
||||
xTaskCreatePinnedToCore(&throughput_client_task, "throughput_client_task", 4096, NULL, 10, NULL, BLUETOOTH_TASK_PINNED_TO_CORE);
|
||||
|
||||
xTaskCreate(&throughput_client_task, "throughput_client_task", 4096, NULL, 10, NULL);
|
||||
#if (CONFIG_GATTC_WRITE_THROUGHPUT)
|
||||
gattc_semaphore = xSemaphoreCreateMutex();
|
||||
gattc_semaphore = xSemaphoreCreateBinary();
|
||||
if (!gattc_semaphore) {
|
||||
ESP_LOGE(GATTC_TAG, "%s, init fail, the gattc semaphore create fail.", __func__);
|
||||
return;
|
||||
|
|
|
@ -24,16 +24,23 @@
|
|||
#include "esp_log.h"
|
||||
#include "nvs_flash.h"
|
||||
#include "esp_bt.h"
|
||||
|
||||
#include "esp_gap_ble_api.h"
|
||||
#include "esp_gatts_api.h"
|
||||
#include "esp_bt_defs.h"
|
||||
#include "esp_bt_main.h"
|
||||
#include "esp_bt_main.h"
|
||||
#include "esp_gatt_common_api.h"
|
||||
|
||||
#include "sdkconfig.h"
|
||||
|
||||
/**********************************************************
|
||||
* Thread/Task reference
|
||||
**********************************************************/
|
||||
#ifdef CONFIG_BLUEDROID_PINNED_TO_CORE
|
||||
#define BLUETOOTH_TASK_PINNED_TO_CORE (CONFIG_BLUEDROID_PINNED_TO_CORE < portNUM_PROCESSORS ? CONFIG_BLUEDROID_PINNED_TO_CORE : tskNO_AFFINITY)
|
||||
#else
|
||||
#define BLUETOOTH_TASK_PINNED_TO_CORE (0)
|
||||
#endif
|
||||
|
||||
#define SECOND_TO_USECOND 1000000
|
||||
|
||||
#define GATTS_TAG "GATTS_DEMO"
|
||||
|
@ -53,7 +60,7 @@ static uint64_t start_time = 0;
|
|||
static uint64_t current_time = 0;
|
||||
#endif /* #if (CONFIG_EXAMPLE_GATTC_WRITE_THROUGHPUT) */
|
||||
|
||||
static bool is_connecet = false;
|
||||
static bool is_connect = false;
|
||||
///Declare the static function
|
||||
static void gatts_profile_a_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_t gatts_if, esp_ble_gatts_cb_param_t *param);
|
||||
|
||||
|
@ -522,7 +529,7 @@ static void gatts_profile_a_event_handler(esp_gatts_cb_event_t event, esp_gatt_i
|
|||
case ESP_GATTS_STOP_EVT:
|
||||
break;
|
||||
case ESP_GATTS_CONNECT_EVT: {
|
||||
is_connecet = true;
|
||||
is_connect = true;
|
||||
esp_ble_conn_update_params_t conn_params = {0};
|
||||
memcpy(conn_params.bda, param->connect.remote_bda, sizeof(esp_bd_addr_t));
|
||||
/* For the IOS system, please reference the apple official documents about the ble connection parameters restrictions. */
|
||||
|
@ -540,7 +547,7 @@ static void gatts_profile_a_event_handler(esp_gatts_cb_event_t event, esp_gatt_i
|
|||
break;
|
||||
}
|
||||
case ESP_GATTS_DISCONNECT_EVT:
|
||||
is_connecet = false;
|
||||
is_connect = false;
|
||||
ESP_LOGI(GATTS_TAG, "ESP_GATTS_DISCONNECT_EVT");
|
||||
esp_ble_gap_start_advertising(&adv_params);
|
||||
break;
|
||||
|
@ -616,11 +623,18 @@ void throughput_server_task(void *param)
|
|||
int res = xSemaphoreTake(gatts_semaphore, portMAX_DELAY);
|
||||
assert(res == pdTRUE);
|
||||
} else {
|
||||
if (is_connecet) {
|
||||
if (is_connect) {
|
||||
int free_buff_num = esp_ble_get_sendable_packets_num();
|
||||
if(free_buff_num > 0) {
|
||||
for( ; free_buff_num > 0; free_buff_num--) {
|
||||
esp_ble_gatts_send_indicate(gl_profile_tab[PROFILE_A_APP_ID].gatts_if, gl_profile_tab[PROFILE_A_APP_ID].conn_id,
|
||||
gl_profile_tab[PROFILE_A_APP_ID].char_handle,
|
||||
sizeof(indicate_data), indicate_data, false);
|
||||
}
|
||||
} else { //Add the vTaskDelay to prevent this task from consuming the CPU all the time, causing low-priority tasks to not be executed at all.
|
||||
vTaskDelay( 10 / portTICK_PERIOD_MS );
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* #if (CONFIG_EXAMPLE_GATTS_NOTIFY_THROUGHPUT) */
|
||||
|
||||
|
@ -630,10 +644,10 @@ void throughput_server_task(void *param)
|
|||
if (start_time) {
|
||||
current_time = esp_timer_get_time();
|
||||
bit_rate = write_len * SECOND_TO_USECOND / (current_time - start_time);
|
||||
ESP_LOGI(GATTS_TAG, "GATTC write Bit rate = %d Btye/s, = %d bit/s, time = %ds",
|
||||
ESP_LOGI(GATTS_TAG, "GATTC write Bit rate = %d Byte/s, = %d bit/s, time = %ds",
|
||||
bit_rate, bit_rate<<3, (int)((current_time - start_time) / SECOND_TO_USECOND));
|
||||
} else {
|
||||
ESP_LOGI(GATTS_TAG, "GATTC write Bit rate = 0 Btye/s, = 0 bit/s");
|
||||
ESP_LOGI(GATTS_TAG, "GATTC write Bit rate = 0 Byte/s, = 0 bit/s");
|
||||
}
|
||||
#endif /* #if (CONFIG_EXAMPLE_GATTC_WRITE_THROUGHPUT) */
|
||||
|
||||
|
@ -697,10 +711,11 @@ void app_main()
|
|||
if (local_mtu_ret){
|
||||
ESP_LOGE(GATTS_TAG, "set local MTU failed, error code = %x", local_mtu_ret);
|
||||
}
|
||||
|
||||
xTaskCreate(&throughput_server_task, "throughput_server_task", 4048, NULL, 15, NULL);
|
||||
// The task is only created on the CPU core that Bluetooth is working on,
|
||||
// preventing the sending task from using the un-updated Bluetooth state on another CPU.
|
||||
xTaskCreatePinnedToCore(&throughput_server_task, "throughput_server_task", 4096, NULL, 15, NULL, BLUETOOTH_TASK_PINNED_TO_CORE);
|
||||
#if (CONFIG_EXAMPLE_GATTS_NOTIFY_THROUGHPUT)
|
||||
gatts_semaphore = xSemaphoreCreateMutex();
|
||||
gatts_semaphore = xSemaphoreCreateBinary();
|
||||
if (!gatts_semaphore) {
|
||||
ESP_LOGE(GATTS_TAG, "%s, init fail, the gatts semaphore create fail.", __func__);
|
||||
return;
|
||||
|
|
|
@ -86,6 +86,7 @@ const int CONNECTED_BIT = BIT0;
|
|||
|
||||
/* store the station info for send back to phone */
|
||||
static bool gl_sta_connected = false;
|
||||
static bool ble_is_connected = false;
|
||||
static uint8_t gl_sta_bssid[6];
|
||||
static uint8_t gl_sta_ssid[32];
|
||||
static int gl_sta_ssid_len;
|
||||
|
@ -112,7 +113,11 @@ static esp_err_t example_net_event_handler(void *ctx, system_event_t *event)
|
|||
info.sta_bssid_set = true;
|
||||
info.sta_ssid = gl_sta_ssid;
|
||||
info.sta_ssid_len = gl_sta_ssid_len;
|
||||
if (ble_is_connected == true) {
|
||||
esp_blufi_send_wifi_conn_report(mode, ESP_BLUFI_STA_CONN_SUCCESS, 0, &info);
|
||||
} else {
|
||||
BLUFI_INFO("BLUFI BLE is not connected yet\n");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SYSTEM_EVENT_STA_CONNECTED:
|
||||
|
@ -135,11 +140,15 @@ static esp_err_t example_net_event_handler(void *ctx, system_event_t *event)
|
|||
esp_wifi_get_mode(&mode);
|
||||
|
||||
/* TODO: get config or information of softap, then set to report extra_info */
|
||||
if (ble_is_connected == true) {
|
||||
if (gl_sta_connected) {
|
||||
esp_blufi_send_wifi_conn_report(mode, ESP_BLUFI_STA_CONN_SUCCESS, 0, NULL);
|
||||
} else {
|
||||
esp_blufi_send_wifi_conn_report(mode, ESP_BLUFI_STA_CONN_FAIL, 0, NULL);
|
||||
}
|
||||
} else {
|
||||
BLUFI_INFO("BLUFI BLE is not connected yet\n");
|
||||
}
|
||||
break;
|
||||
case SYSTEM_EVENT_SCAN_DONE: {
|
||||
uint16_t apCount = 0;
|
||||
|
@ -167,7 +176,13 @@ static esp_err_t example_net_event_handler(void *ctx, system_event_t *event)
|
|||
blufi_ap_list[i].rssi = ap_list[i].rssi;
|
||||
memcpy(blufi_ap_list[i].ssid, ap_list[i].ssid, sizeof(ap_list[i].ssid));
|
||||
}
|
||||
|
||||
if (ble_is_connected == true) {
|
||||
esp_blufi_send_wifi_list(apCount, blufi_ap_list);
|
||||
} else {
|
||||
BLUFI_INFO("BLUFI BLE is not connected yet\n");
|
||||
}
|
||||
|
||||
esp_wifi_scan_stop();
|
||||
free(ap_list);
|
||||
free(blufi_ap_list);
|
||||
|
@ -186,7 +201,6 @@ static void initialise_wifi(void)
|
|||
ESP_ERROR_CHECK( esp_event_loop_init(example_net_event_handler, NULL) );
|
||||
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
|
||||
ESP_ERROR_CHECK( esp_wifi_init(&cfg) );
|
||||
ESP_ERROR_CHECK( esp_wifi_set_storage(WIFI_STORAGE_RAM) );
|
||||
ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) );
|
||||
ESP_ERROR_CHECK( esp_wifi_start() );
|
||||
}
|
||||
|
@ -215,6 +229,7 @@ static void example_event_callback(esp_blufi_cb_event_t event, esp_blufi_cb_para
|
|||
break;
|
||||
case ESP_BLUFI_EVENT_BLE_CONNECT:
|
||||
BLUFI_INFO("BLUFI ble connect\n");
|
||||
ble_is_connected = true;
|
||||
server_if = param->connect.server_if;
|
||||
conn_id = param->connect.conn_id;
|
||||
esp_ble_gap_stop_advertising();
|
||||
|
@ -222,6 +237,7 @@ static void example_event_callback(esp_blufi_cb_event_t event, esp_blufi_cb_para
|
|||
break;
|
||||
case ESP_BLUFI_EVENT_BLE_DISCONNECT:
|
||||
BLUFI_INFO("BLUFI ble disconnect\n");
|
||||
ble_is_connected = false;
|
||||
blufi_security_deinit();
|
||||
esp_ble_gap_start_advertising(&example_adv_params);
|
||||
break;
|
||||
|
|
|
@ -62,31 +62,31 @@ I (317) uart: queue free spaces: 16
|
|||
I (317) nmea_parser: NMEA Parser init OK
|
||||
I (1067) gps_demo: 2018/12/4 13:59:34 =>
|
||||
latitude = 31.20177°N
|
||||
longtitude = 121.57933°E
|
||||
longitude = 121.57933°E
|
||||
altitude = 17.30m
|
||||
speed = 0.370400m/s
|
||||
W (1177) gps_demo: Unknown statement:$GPTXT,01,01,01,ANTENNA OK*35
|
||||
I (2067) gps_demo: 2018/12/4 13:59:35 =>
|
||||
latitude = 31.20177°N
|
||||
longtitude = 121.57933°E
|
||||
longitude = 121.57933°E
|
||||
altitude = 17.30m
|
||||
speed = 0.000000m/s
|
||||
W (2177) gps_demo: Unknown statement:$GPTXT,01,01,01,ANTENNA OK*35
|
||||
I (3067) gps_demo: 2018/12/4 13:59:36 =>
|
||||
latitude = 31.20178°N
|
||||
longtitude = 121.57933°E
|
||||
longitude = 121.57933°E
|
||||
altitude = 17.30m
|
||||
speed = 0.000000m/s
|
||||
W (3177) gps_demo: Unknown statement:$GPTXT,01,01,01,ANTENNA OK*35
|
||||
I (4067) gps_demo: 2018/12/4 13:59:37 =>
|
||||
latitude = 31.20178°N
|
||||
longtitude = 121.57933°E
|
||||
longitude = 121.57933°E
|
||||
altitude = 17.30m
|
||||
speed = 0.000000m/s
|
||||
W (4177) gps_demo: Unknown statement:$GPTXT,01,01,01,ANTENNA OK*35
|
||||
I (5067) gps_demo: 2018/12/4 13:59:38 =>
|
||||
latitude = 31.20178°N
|
||||
longtitude = 121.57933°E
|
||||
longitude = 121.57933°E
|
||||
altitude = 17.30m
|
||||
speed = 0.685240m/s
|
||||
W (5177) gps_demo: Unknown statement:$GPTXT,01,01,01,ANTENNA OK*35
|
||||
|
|
|
@ -36,7 +36,7 @@ static void gps_event_handler(void *event_handler_arg, esp_event_base_t event_ba
|
|||
/* print information parsed from GPS statements */
|
||||
ESP_LOGI(TAG, "%d/%d/%d %d:%d:%d => \r\n"
|
||||
"\t\t\t\t\t\tlatitude = %.05f°N\r\n"
|
||||
"\t\t\t\t\t\tlongtitude = %.05f°E\r\n"
|
||||
"\t\t\t\t\t\tlongitude = %.05f°E\r\n"
|
||||
"\t\t\t\t\t\taltitude = %.02fm\r\n"
|
||||
"\t\t\t\t\t\tspeed = %fm/s",
|
||||
gps->date.year + YEAR_BASE, gps->date.month, gps->date.day,
|
||||
|
|
Loading…
Reference in a new issue