component/bt : cleanup status and spell check

This commit is contained in:
Tian Hao 2016-11-28 22:40:30 +08:00
parent 9d9e758756
commit f6de7ea764
6 changed files with 87 additions and 103 deletions

View File

@ -189,21 +189,7 @@ esp_err_t esp_ble_gap_set_device_name(const char *name)
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
/*******************************************************************************
**
** Function esp_ble_resolve_adv_data
**
** Description This function is called to get ADV data for a specific type.
**
** Parameters p_adv - pointer of ADV data
** type - finding ADV data type
** p_length - return the length of ADV data not including type
**
** Returns pointer of ADV data
**
*******************************************************************************/
uint8_t *esp_ble_resolve_adv_data( uint8_t *p_adv, uint8_t type, uint8_t *p_length)
uint8_t *esp_ble_resolve_adv_data( uint8_t *adv_data, uint8_t type, uint8_t *length)
{
if (((type < ESP_BLE_AD_TYPE_FLAG) || (type > ESP_BLE_AD_TYPE_128SERVICE_DATA)) &&
(type != ESP_BLE_AD_MANUFACTURER_SPECIFIC_TYPE)) {
@ -211,11 +197,11 @@ uint8_t *esp_ble_resolve_adv_data( uint8_t *p_adv, uint8_t type, uint8_t *p_leng
return NULL;
}
if (p_adv == NULL) {
if (adv_data == NULL) {
LOG_ERROR("Invalid p_eir data.\n");
return NULL;
}
return (BTM_CheckAdvData( p_adv, type, p_length));
return (BTM_CheckAdvData( adv_data, type, length));
}

View File

@ -79,7 +79,7 @@ esp_err_t esp_blufi_register_callback(esp_profile_cb_t callback);
**
** @brief This function is called to send config state to phone
**
** @param[in] state: blufi config ok or not
** @param[in] state: blufi config OK or not
**
** @return ESP_OK - success, other - failed
**
@ -90,7 +90,7 @@ esp_err_t esp_blufi_send_config_state(esp_blufi_config_state_t state);
**
** @function esp_blufi_profile_init
**
** @brief This function is called to init blufi_profile
** @brief This function is called to initialize blufi_profile
**
** @return ESP_OK - success, other - failed
**
@ -101,7 +101,7 @@ esp_err_t esp_blufi_profile_init(void);
**
** @function esp_blufi_profile_deinit
**
** @brief This function is called to init blufi_profile
** @brief This function is called to de-initialize blufi_profile
**
** @return ESP_OK - success, other - failed
**

View File

@ -109,16 +109,16 @@ typedef struct {
typedef struct {
bool set_scan_rsp; /*!< Set this advertising data as scan response or not*/
bool include_name; /*!< Advertising data include device name or not */
bool include_txpower; /*!< Advertising data include tx power */
int min_interval; /*!< Advertising data show advertising min internval */
int max_interval; /*!< Advertising data show advertising max internval */
int appearance; /*!< Extenal appearance of device */
bool include_txpower; /*!< Advertising data include TX power */
int min_interval; /*!< Advertising data show advertising min interval */
int max_interval; /*!< Advertising data show advertising max interval */
int appearance; /*!< External appearance of device */
uint16_t manufacturer_len; /*!< Manufacturer data length */
uint8_t *p_manufacturer_data; /*!< Manufacturer data point */
uint16_t service_data_len; /*!< Service data length */
uint8_t *p_service_data; /*!< Service data point */
uint16_t service_uuid_len; /*!< Service uuid length */
uint8_t *p_service_uuid; /*!< Service uuid arrary point */
uint8_t *p_service_uuid; /*!< Service uuid array point */
uint8_t flag; /*!< Advertising flag of discovery mode */
} esp_ble_adv_data_t;
@ -196,7 +196,7 @@ typedef enum {
ESP_GAP_SEARCH_INQ_RES_EVT = 0, /* Inquiry result for a peer device. */
ESP_GAP_SEARCH_INQ_CMPL_EVT = 1, /* Inquiry complete. */
ESP_GAP_SEARCH_DISC_RES_EVT = 2, /* Discovery result for a peer device. */
ESP_GAP_SEARCH_DISC_BLE_RES_EVT = 3, /* Discovery result for BLE GATT based servoce on a peer device. */
ESP_GAP_SEARCH_DISC_BLE_RES_EVT = 3, /* Discovery result for BLE GATT based service on a peer device. */
ESP_GAP_SEARCH_DISC_CMPL_EVT = 4, /* Discovery complete. */
ESP_GAP_SEARCH_DI_DISC_CMPL_EVT = 5, /* Discovery complete. */
ESP_GAP_SEARCH_SEARCH_CANCEL_CMPL_EVT = 6, /* Search cancelled */
@ -218,10 +218,10 @@ typedef union {
//ESP_GAP_BLE_SCAN_RESULT_EVT
struct ble_scan_result_evt_param {
esp_gap_search_evt_t search_evt; /*!< Search event type */
esp_bd_addr_t bda; /*!< BD address which has been searched */
esp_bd_addr_t bda; /*!< Bluetooth device address which has been searched */
esp_bt_dev_type_t dev_type; /*!< Device type */
esp_ble_addr_type_t ble_addr_type; /*!< Ble device address type */
int rssi; /*!< Searched device's rssi */
int rssi; /*!< Searched device's RSSI */
uint8_t ble_adv[ESP_BLE_ADV_DATA_LEN_MAX]; /*!< Received EIR */
int flag; /*!< Advertising data flag bit */
int num_resps; /*!< Scan result number */
@ -250,9 +250,8 @@ esp_err_t esp_ble_gap_register_callback(esp_profile_cb_t callback);
** @brief This function is called to override the BTA default ADV parameters.
**
** @param[in] adv_data: Pointer to User defined ADV data structure. This
** memory space can not be freed until p_adv_data_cback
** memory space can not be freed until callback of config_adv_data
** is received.
** @param[in|out] adv_data_cback: set adv data complete callback.
**
** @return ESP_OK - success, other - failed
**
@ -268,7 +267,7 @@ esp_err_t esp_ble_gap_config_adv_data (esp_ble_adv_data_t *adv_data);
** @brief This function is called to set scan parameters
**
** @param[in] esp_ble_scan_params: Pointer to User defined scan_params data structure. This
** memory space can not be freed until scan_param_setup_cback
** memory space can not be freed until callback of set_scan_params
**
** @return ESP_OK - success, other - failed
**
@ -280,9 +279,9 @@ esp_err_t esp_ble_gap_set_scan_params(esp_ble_scan_params_t *scan_params);
**
** @function esp_ble_gap_start_scanning
**
** @brief This procedure keep the device scanning the peer device whith advertising on the air
** @brief This procedure keep the device scanning the peer device which advertising on the air
**
** @param[in] duration: Keeping the scaning time, the unit is second.
** @param[in] duration: Keeping the scanning time, the unit is second.
**
** @return ESP_OK - success, other - failed
**
@ -294,7 +293,7 @@ esp_err_t esp_ble_gap_start_scanning(uint32_t duration);
**
** @function esp_ble_gap_stop_scanning
**
** @brief This function call to stop the device scanning the peer device whith advertising on the air
** @brief This function call to stop the device scanning the peer device which advertising on the air
** @param void
** @return ESP_OK - success, other - failed
**
@ -307,7 +306,7 @@ esp_err_t esp_ble_gap_stop_scanning(void);
**
** @brief This function is called to start advertising.
**
** @param[in] esp_ble_adv_params_all_t: ointer to User defined adv_params data structure.
** @param[in] esp_ble_adv_params_all_t: pointer to User defined adv_params data structure.
**
** @return ESP_OK - success, other - failed
**
@ -337,7 +336,7 @@ esp_err_t esp_ble_gap_stop_advertising(void);
**
** @brief Update connection parameters, can only be used when connection is up.
**
** @param[in] param - connection update params
** @param[in] param - connection update parameters
**
** @return ESP_OK - success, other - failed
**
@ -362,9 +361,9 @@ esp_err_t esp_ble_gap_set_pkt_data_len(esp_bd_addr_t remote_device, uint16_t tx_
**
** @function esp_ble_gap_set_rand_addr
**
** @brief This function set the random address for the appliction
** @brief This function set the random address for the application
**
** @param[in] rand_addr: the random address whith should be setting
** @param[in] rand_addr: the random address which should be setting
**
** @return ESP_OK - success, other - failed
**
@ -380,7 +379,7 @@ esp_err_t esp_ble_gap_set_rand_addr(esp_bd_addr_t rand_addr);
**
** @brief Enable/disable privacy on the local device
**
** @param[in] privacy_enable - enable/disabe privacy on remote device.
** @param[in] privacy_enable - enable/disable privacy on remote device.
**
** @return ESP_OK - success, other - failed
**
@ -408,13 +407,13 @@ esp_err_t esp_ble_gap_set_device_name(const char *name);
**
** @brief This function is called to get ADV data for a specific type.
**
** @param[in] p_adv - pointer of ADV data whitch to be resolved
** @param[in] adv_data - pointer of ADV data which to be resolved
** @param[in] type - finding ADV data type
** @param[out] p_length - return the length of ADV data not including type
** @param[out] length - return the length of ADV data not including type
**
** @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 *adv_data, uint8_t type, uint8_t *p_length);
#endif /* __ESP_GAP_BLE_API_H__ */

View File

@ -29,7 +29,7 @@
#define ESP_GATTC_CLOSE_EVT 5 /* GATTC close request status event */
#define ESP_GATTC_SEARCH_CMPL_EVT 6 /* GATT discovery complete event */
#define ESP_GATTC_SEARCH_RES_EVT 7 /* GATT discovery result event */
#define ESP_GATTC_READ_DESCR_EVT 8 /* GATT read characterisitc descriptor event */
#define ESP_GATTC_READ_DESCR_EVT 8 /* GATT read characteristic descriptor event */
#define ESP_GATTC_WRITE_DESCR_EVT 9 /* GATT write characteristic descriptor event */
#define ESP_GATTC_NOTIFY_EVT 10 /* GATT attribute notification event */
#define ESP_GATTC_PREP_WRITE_EVT 11 /* GATT prepare write event */
@ -213,7 +213,7 @@ typedef union {
** @brief This function is called to register application callbacks
** with GATTC module.
**
** @param[in] callback - pointer to the application callback function.
** @param[in] callback : pointer to the application callback function.
**
** @return ESP_OK - success, other - failed
**
@ -244,7 +244,7 @@ esp_err_t esp_ble_gattc_app_register(uint16_t app_id);
** @brief This function is called to unregister an application
** from GATTC module.
**
** @param[in] gatt_if - app identifier.
** @param[in] gatt_if : app identifier.
**
** @return ESP_OK - success, other - failed
**
@ -326,7 +326,7 @@ esp_err_t esp_ble_gattc_search_service(uint16_t conn_id, esp_bt_uuid_t *filter_u
**
** @param[in] conn_id: connection ID which identify the server.
**
** @param[in] srvc_id: serivce ID
** @param[in] srvc_id: service ID
**
** @param[in] start_char_id: the start characteristic ID
**
@ -348,7 +348,7 @@ esp_err_t esp_ble_gattc_get_characteristic(uint16_t conn_id,
** @param[in] srvc_id: the service ID of which the characteristic is belonged to.
** @param[in] char_id: Characteristic ID, if NULL find the first available
** characteristic.
** @param[in] start_descr_id: the sctart descriptor id
** @param[in] start_descr_id: the start descriptor id
**
** @return ESP_OK - success, other - failed
**
@ -384,12 +384,12 @@ esp_err_t esp_ble_gattc_get_included_service(uint16_t conn_id,
** @function esp_ble_gattc_read_char
**
** @brief This function is called to read a service's characteristics of
** the given characteritisc ID.UTH_REQ_NO_SCATTERNET
** the given characteriistic 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
** @param[in] conn_id : connection ID.
** @param[in] srvc_id : service ID.
** @param[in] char_id : characteristic ID to read.
** @param[in] auth_req : authenticate request type
**
** @return ESP_OK - success, other - failed
**
@ -407,10 +407,10 @@ 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 - service ID.
** @param[in] descr_id - characteritic descriptor ID to read.
** @param[in] auth_req - authenticate request type
** @param[in] conn_id : connection ID.
** @param[in] srvc_id : service ID.
** @param[in] descr_id : characteristic descriptor ID to read.
** @param[in] auth_req : authenticate request type
**
** @return ESP_OK - success, other - failed
**
@ -428,11 +428,11 @@ 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 - service ID.
** @param[in] char_id - characteristic ID to write.
** @param[in] conn_id : connection 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.
** @param[in] value : the value to be written.
**
** @return ESP_OK - success, other - failed
**
@ -451,12 +451,12 @@ 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 - service ID.
** @param[in] char_id - characteristic ID.
** @param[in] descr_id - characteristic descriptor ID to write.
** @param[in] conn_id : connection 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.
** @param[in] value - the value to be written.
** @param[in] value : the value to be written.
**
** @return ESP_OK - success, other - failed
**
@ -477,11 +477,11 @@ esp_err_t esp_ble_gattc_write_char_descr (uint16_t conn_id,
**
** @brief This function is called to prepare write a characteristic value.
**
** @param[in] conn_id - connection ID.
** @param[in] char_id - GATT characteritic ID of the service.
** @param[in] offset - offset of the write value.
** @param[in] conn_id : connection ID.
** @param[in] char_id : GATT characteristic ID of the service.
** @param[in] offset : offset of the write value.
** @param[in] value_len: length of the value to be written.
** @param[in] value - the value to be written.
** @param[in] value : the value to be written.
**
** @return ESP_OK - success, other - failed
**
@ -496,12 +496,12 @@ esp_err_t esp_ble_gattc_prepare_write(uint16_t conn_id,
/*******************************************************************************
**
** @function esp_ble_gattc_execu_write
** @function esp_ble_gattc_execute_write
**
** @brief This function is called to execute write a prepare write sequence.
**
** @param[in] conn_id - connection ID.
** @param[in] is_execute - execute or cancel.
** @param[in] conn_id : connection ID.
** @param[in] is_execute : execute or cancel.
**
** @return ESP_OK - success, other - failed
**
@ -515,10 +515,10 @@ esp_err_t esp_ble_gattc_execute_write (uint16_t conn_id, bool is_execute);
**
** @brief This function is called to register for notification of a service.
**
** @param[in] gatt_if - gatt interface id.
** @param[in] bda - target GATT server.
** @param[in] srvc_id - pointer to GATT service ID.
** @param[in] char_id - pointer to GATT characteristic ID.
** @param[in] gatt_if : gatt interface id.
** @param[in] bda : target GATT server.
** @param[in] srvc_id : pointer to GATT service ID.
** @param[in] char_id : pointer to GATT characteristic ID.
**
** @return OK if registration succeed, otherwise failed.
**
@ -536,12 +536,12 @@ esp_gatt_status_t esp_ble_gattc_register_for_notify (esp_gatt_if_t gatt_if,
**
** @brief This function is called to de-register for notification of a service.
**
** @param[in] gatt_if - gatt interface id.
** @param[in] bda - target GATT server.
** @param[in] srvc_id - pointer to GATT service ID.
** @param[in] char_id - pointer to GATT characteristic ID.
** @param[in] gatt_if : gatt interface id.
** @param[in] bda : target GATT server.
** @param[in] srvc_id : pointer to GATT service ID.
** @param[in] char_id : pointer to GATT characteristic ID.
**
** @return OK if deregistration succeed, otherwise failed.
** @return OK if unregister succeed, otherwise failed.
**
*******************************************************************************/
esp_gatt_status_t esp_ble_gattc_unregister_for_notify (esp_gatt_if_t gatt_if,

View File

@ -51,7 +51,7 @@
typedef union {
//ESP_GATTS_REG_EVT
struct gatts_reg_evt_param {
int status; /*!< Operation status */
esp_gatt_status_t status; /*!< Operation status */
uint16_t gatt_if; /*!< Gatt interface id, different application on gatt client different gatt_if */
uint16_t app_id; /*!< Application id which input in register API */
} reg; /*!< Gatt server callback param of ESP_GATTS_REG_EVT */
@ -97,14 +97,14 @@ typedef union {
// param for ESP_GATTS_CONF_EVT
struct gatts_conf_evt_param {
int status; /*!< Operation status */
esp_gatt_status_t status; /*!< Operation status */
uint16_t conn_id; /*!< Connection id */
} conf; /*!< Gatt server callback param of ESP_GATTS_CONF_EVT (confirm) */
// param for ESP_GATTS_UNREG_EVT, NONE
// param for ESP_GATTS_CREATE_EVT
struct gatts_create_evt_param {
int status; /*!< Operation status */
esp_gatt_status_t status; /*!< Operation status */
uint16_t gatt_if; /*!< Gatt interface id, different application on gatt client different gatt_if */
uint16_t service_handle; /*!< Service attribute handle */
esp_gatt_srvc_id_t service_id; /*!< Service id, include service uuid and other information */
@ -112,7 +112,7 @@ typedef union {
// param for ESP_GATTS_ADD_INCL_SRVC_EVT
struct gatts_add_incl_srvc_evt_param {
int status; /*!< Operation status */
esp_gatt_status_t status; /*!< Operation status */
uint16_t gatt_if; /*!< Gatt interface id, different application on gatt client different gatt_if */
uint16_t attr_handle; /*!< Included service attribute handle */
uint16_t service_handle; /*!< Service attribute handle */
@ -120,7 +120,7 @@ typedef union {
// param for ESP_GATTS_ADD_CHAR_EVT
struct gatts_add_char_evt_param {
int status; /*!< Operation status */
esp_gatt_status_t status; /*!< Operation status */
uint16_t gatt_if; /*!< Gatt interface id, different application on gatt client different gatt_if */
uint16_t attr_handle; /*!< Characteristic attribute handle */
uint16_t service_handle; /*!< Service attribute handle */
@ -129,7 +129,7 @@ typedef union {
// param for ESP_GATTS_ADD_CHAR_DESCR_EVT
struct gatts_add_char_descr_evt_param {
int status; /*!< Operation status */
esp_gatt_status_t status; /*!< Operation status */
uint16_t gatt_if; /*!< Gatt interface id, different application on gatt client different gatt_if */
uint16_t attr_handle; /*!< Descriptor attribute handle */
uint16_t service_handle; /*!< Service attribute handle */
@ -138,21 +138,21 @@ typedef union {
// param for ESP_GATTS_DELETE_EVT
struct gatts_delete_evt_param {
int status; /*!< Operation status */
esp_gatt_status_t status; /*!< Operation status */
uint16_t gatt_if; /*!< Gatt interface id, different application on gatt client different gatt_if */
uint16_t service_handle; /*!< Service attribute handle */
} del; /*!< Gatt server callback param of ESP_GATTS_DELETE_EVT */
// param for ESP_GATTS_START_EVT
struct gatts_start_evt_param {
int status; /*!< Operation status */
esp_gatt_status_t status; /*!< Operation status */
uint16_t gatt_if; /*!< Gatt interface id, different application on gatt client different gatt_if */
uint16_t service_handle; /*!< Service attribute handle */
} start; /*!< Gatt server callback param of ESP_GATTS_START_EVT */
// param for ESP_GATTS_STOP_EVT
struct gatts_stop_evt_param {
int status; /*!< Operation status */
esp_gatt_status_t status; /*!< Operation status */
uint16_t gatt_if; /*!< Gatt interface id, different application on gatt client different gatt_if */
uint16_t service_handle; /*!< Service attribute handle */
} stop; /*!< Gatt server callback param of ESP_GATTS_STOP_EVT */
@ -185,7 +185,7 @@ typedef union {
// param for ESP_GATTS_RESPONSE_EVT
struct gatts_rsp_evt_param {
int status; /*!< Operation status */
esp_gatt_status_t status; /*!< Operation status */
uint16_t handle; /*!< Attribute handle which send response */
} rsp; /*!< Gatt server callback param of ESP_GATTS_RESPONSE_EVT */
} esp_ble_gatts_cb_param_t;
@ -223,7 +223,7 @@ esp_err_t esp_ble_gatts_app_register(uint16_t app_id);
**
** @function esp_ble_gatts_app_unregister
**
** @brief un-register with GATT Server.
** @brief unregister with GATT Server.
**
** @param[in] gatt_if: gatt interface id.
**
@ -245,7 +245,7 @@ esp_err_t esp_ble_gatts_app_unregister(esp_gatt_if_t gatt_if);
**
** @param[in] gatt_if: gatt interface ID
** @param[in] service_id: service ID.
** @param[in] num_handle: numble of handle requessted for this service.
** @param[in] num_handle: number of handle requested for this service.
**
** @return ESP_OK - success, other - failed
**
@ -303,7 +303,7 @@ esp_err_t esp_ble_gatts_add_char(uint16_t service_handle, esp_bt_uuid_t *char_
** it's done, a callback event BTA_GATTS_ADD_DESCR_EVT is called
** to report the status and an ID number for this descriptor.
**
** @param[in] service_handle: service handle to which this charatceristic descriptor is to
** @param[in] service_handle: service handle to which this characteristic descriptor is to
** be added.
** @param[in] perm: descriptor access permission.
** @param[in] descr_uuid: descriptor UUID.
@ -340,7 +340,7 @@ esp_err_t esp_ble_gatts_delete_service(uint16_t service_handle);
** @brief This function is called to start a service.
**
** @param[in] service_handle: the service handle to be started.
** @param[in] sup_transport: supported trasnport.
** @param[in] sup_transport: supported transport.
**
** @return ESP_OK - success, other - failed
**
@ -390,7 +390,7 @@ esp_err_t esp_ble_gatts_send_indicate(uint16_t conn_id, uint16_t attr_handle,
** @brief This function is called to send a response to a request.
**
** @param[in] conn_id - connection identifier.
** @param[in] trans_id - transfe id
** @param[in] trans_id - transfer id
** @param[in] status - response status
** @param[in] rsp - response data.
**
@ -406,10 +406,9 @@ esp_err_t esp_ble_gatts_send_response(uint16_t conn_id, uint32_t trans_id,
** @function esp_ble_gatts_open
**
** @brief Open a direct open connection or add a background auto connection
** bd address
**
** @param[in] gatt_if: application ID.
** @param[in] remote_bda: remote device BD address.
** @param[in] remote_bda: remote device bluetooth device address.
** @param[in] is_direct: direct connection or background auto connection
**
** @return ESP_OK - success, other - failed

View File

@ -174,7 +174,7 @@ static void gatts_event_handler(uint32_t event, void *param)
LOG_INFO("ADD_DESCR_EVT, status %d, gatt_if %d, attr_handle %d, service_handle %d\n",
p->add_char.status, p->add_char.gatt_if, p->add_char.attr_handle, p->add_char.service_handle);
break;
case ESP_GATTS_DELELTE_EVT:
case ESP_GATTS_DELETE_EVT:
break;
case ESP_GATTS_START_EVT:
LOG_INFO("SERVICE_START_EVT, status %d, gatt_if %d, service_handle %d\n",