component/bt : cleanup the return style

This commit is contained in:
Tian Hao 2016-12-01 19:58:52 +08:00
parent c6ec70b67b
commit bdf4006da7
5 changed files with 136 additions and 88 deletions

View file

@ -23,7 +23,8 @@
*
* @brief Enable bluetooth, must after esp_init_bluetooth()
*
* @return - ESP_OK : Succeed
* @return
* - ESP_OK : Succeed
* - Other : Failed
*/
esp_err_t esp_enable_bluetooth(void);
@ -33,7 +34,8 @@ esp_err_t esp_enable_bluetooth(void);
*
* @brief Disable bluetooth, must prior to esp_deinit_bluetooth()
*
* @return - ESP_OK : Succeed
* @return
* - ESP_OK : Succeed
* - Other : Failed
*/
esp_err_t esp_disable_bluetooth(void);
@ -43,7 +45,8 @@ esp_err_t esp_disable_bluetooth(void);
*
* @brief Init and alloc the resource for bluetooth, must be prior to every bluetooth stuff
*
* @return - ESP_OK : Succeed
* @return
* - ESP_OK : Succeed
* - Other : Failed
*/
esp_err_t esp_init_bluetooth(void);
@ -53,7 +56,8 @@ esp_err_t esp_init_bluetooth(void);
*
* @brief Deinit and free the resource for bluetooth, must be after every bluetooth stuff
*
* @return - ESP_OK : Succeed
* @return
* - ESP_OK : Succeed
* - Other : Failed
*/
esp_err_t esp_deinit_bluetooth(void);

View file

@ -247,7 +247,8 @@ typedef union {
*
* @param[in] callback: callback function
*
* @return - ESP_OK : success
* @return
* - ESP_OK : success
* - other : failed
*
*/
@ -263,7 +264,8 @@ esp_err_t esp_ble_gap_register_callback(esp_profile_cb_t callback);
* memory space can not be freed until callback of config_adv_data
* is received.
*
* @return - ESP_OK : success
* @return
* - ESP_OK : success
* - other : failed
*
*/
@ -279,7 +281,8 @@ esp_err_t esp_ble_gap_config_adv_data (esp_ble_adv_data_t *adv_data);
* @param[in] esp_ble_scan_params: Pointer to User defined scan_params data structure. This
* memory space can not be freed until callback of set_scan_params
*
* @return - ESP_OK : success
* @return
* - ESP_OK : success
* - other : failed
*
*/
@ -293,7 +296,8 @@ esp_err_t esp_ble_gap_set_scan_params(esp_ble_scan_params_t *scan_params);
*
* @param[in] duration: Keeping the scanning time, the unit is second.
*
* @return - ESP_OK : success
* @return
* - ESP_OK : success
* - other : failed
*
*/
@ -305,7 +309,8 @@ esp_err_t esp_ble_gap_start_scanning(uint32_t duration);
*
* @brief This function call to stop the device scanning the peer device which advertising on the air
* @param void
* @return - ESP_OK : success
* @return
* - ESP_OK : success
* - other : failed
*
*/
@ -318,7 +323,8 @@ esp_err_t esp_ble_gap_stop_scanning(void);
*
* @param[in] esp_ble_adv_params_all_t: pointer to User defined adv_params data structure.
*
* @return - ESP_OK : success
* @return
* - ESP_OK : success
* - other : failed
*
*/
@ -333,7 +339,8 @@ esp_err_t esp_ble_gap_start_advertising (esp_ble_adv_params_t *adv_params);
*
* @param None
*
* @return - ESP_OK : success
* @return
* - ESP_OK : success
* - other : failed
*
*/
@ -348,7 +355,8 @@ esp_err_t esp_ble_gap_stop_advertising(void);
*
* @param[in] param - connection update parameters
*
* @return - ESP_OK : success
* @return
* - ESP_OK : success
* - other : failed
*
*/
@ -360,7 +368,8 @@ esp_err_t esp_ble_gap_update_conn_params(esp_ble_conn_update_params_t *params);
*
* @brief This function is to set maximum LE data packet size
*
* @return - ESP_OK : success
* @return
* - ESP_OK : success
* - other : failed
*
*/
@ -375,7 +384,8 @@ esp_err_t esp_ble_gap_set_pkt_data_len(esp_bd_addr_t remote_device, uint16_t tx_
*
* @param[in] rand_addr: the random address which should be setting
*
* @return - ESP_OK : success
* @return
* - ESP_OK : success
* - other : failed
*
*/
@ -390,7 +400,8 @@ esp_err_t esp_ble_gap_set_rand_addr(esp_bd_addr_t rand_addr);
*
* @param[in] privacy_enable - enable/disable privacy on remote device.
*
* @return - ESP_OK : success
* @return
* - ESP_OK : success
* - other : failed
*
*/
@ -404,7 +415,8 @@ esp_err_t esp_ble_gap_config_local_privacy (bool privacy_enable);
*
* @param[in] name - device name.
*
* @return - ESP_OK : success
* @return
* - ESP_OK : success
* - other : failed
*
*/

View file

@ -158,7 +158,7 @@ typedef struct {
uint8_t auth_req; /*!< Gatt authentication request */
} esp_gatt_value_t;
/** GATT remote read request response type */
/// GATT remote read request response type
typedef union {
esp_gatt_value_t attr_value; /*!< Gatt attribute structure */
uint16_t handle; /*!< Gatt attribute handle */

View file

@ -22,45 +22,45 @@
/// GATT Client callback function events
typedef enum {
ESP_GATTC_REG_EVT = 0, /*!> when GATT client is registered */
ESP_GATTC_UNREG_EVT, /*!> when GATT client is unregistered */
ESP_GATTC_OPEN_EVT, /*!> when GATT connection is set up */
ESP_GATTC_READ_CHAR_EVT, /*!> when GATT characteristic is read */
ESP_GATTC_WRITE_CHAR_EVT, /*!> when GATT characteristic write operation completes */
ESP_GATTC_CLOSE_EVT, /*!> when GATT connection is closed */
ESP_GATTC_SEARCH_CMPL_EVT, /*!> when GATT service discovery is completed */
ESP_GATTC_SEARCH_RES_EVT, /*!> when GATT service discovery result is got */
ESP_GATTC_READ_DESCR_EVT, /*!> when GATT characteristic descriptor read completes */
ESP_GATTC_WRITE_DESCR_EVT, /*!> when GATT characteristic descriptor write completes */
ESP_GATTC_NOTIFY_EVT, /*!> when GATT notification or indication arrives */
ESP_GATTC_PREP_WRITE_EVT, /*!> when GATT prepare-write operation conpletes */
ESP_GATTC_EXEC_EVT, /*!> when write execution completes */
ESP_GATTC_ACL_EVT, /*!> when ACL connection is up */
ESP_GATTC_CANCEL_OPEN_EVT, /*!> when GATT client ongoing connection is cancelled */
ESP_GATTC_SRVC_CHG_EVT, /*!> when "service changed" occurs */
ESP_GATTC_ENC_CMPL_CB_EVT, /*!> when encryption procedure completes */
ESP_GATTC_CFG_MTU_EVT, /*!> when configuration of MTU completes */
ESP_GATTC_ADV_DATA_EVT, /*!> when advertising of data */
ESP_GATTC_MULT_ADV_ENB_EVT, /*!> when multi-advertising is enabled */
ESP_GATTC_MULT_ADV_UPD_EVT, /*!> when multi-advertising parameters are updated */
ESP_GATTC_MULT_ADV_DATA_EVT, /*!> when multi-advertising data arrives */
ESP_GATTC_MULT_ADV_DIS_EVT, /*!> when multi-advertising is disabled */
ESP_GATTC_CONGEST_EVT, /*!> when GATT connection congestion comes */
ESP_GATTC_BTH_SCAN_ENB_EVT, /*!> when batch scan is enabled */
ESP_GATTC_BTH_SCAN_CFG_EVT, /*!> when batch scan storage is configured */
ESP_GATTC_BTH_SCAN_RD_EVT, /*!> when Batch scan read event is reported */
ESP_GATTC_BTH_SCAN_THR_EVT, /*!> when Batch scan threshold is set */
ESP_GATTC_BTH_SCAN_PARAM_EVT, /*!> when Batch scan parameters are set */
ESP_GATTC_BTH_SCAN_DIS_EVT, /*!> when Batch scan is disabled */
ESP_GATTC_SCAN_FLT_CFG_EVT, /*!> when Scan filter configuration completes */
ESP_GATTC_SCAN_FLT_PARAM_EVT, /*!> when Scan filter parameters are set */
ESP_GATTC_SCAN_FLT_STATUS_EVT, /*!> when Scan filter status is reported */
ESP_GATTC_ADV_VSC_EVT, /*!> when ADV VSC event is reported*/
ESP_GATTC_GET_CHAR_EVT, /*!> when characteristic is got from GATT server */
ESP_GATTC_GET_DESCR_EVT, /*!> when charcteristic descriptor is got from GATT server */
ESP_GATTC_GET_INCL_SRVC_EVT, /*!> when included service is got from GATT server */
ESP_GATTC_REG_FOR_NOTIFY_EVT, /*!> when registration for notification of a service completes */
ESP_GATTC_UNREG_FOR_NOTIFY_EVT /*!> when unregistration for notification of a service completes */
ESP_GATTC_REG_EVT = 0, /*!< When GATT client is registered, the event comes */
ESP_GATTC_UNREG_EVT = 1, /*!< When GATT client is unregistered, the event comes */
ESP_GATTC_OPEN_EVT = 2, /*!< When GATT connection is set up, the event comes */
ESP_GATTC_READ_CHAR_EVT = 3, /*!< When GATT characteristic is read, the event comes */
ESP_GATTC_WRITE_CHAR_EVT = 4, /*!< When GATT characteristic write operation completes, the event comes */
ESP_GATTC_CLOSE_EVT = 5, /*!< When GATT connection is closed, the event comes */
ESP_GATTC_SEARCH_CMPL_EVT = 6, /*!< When GATT service discovery is completed, the event comes */
ESP_GATTC_SEARCH_RES_EVT = 7, /*!< When GATT service discovery result is got, the event comes */
ESP_GATTC_READ_DESCR_EVT = 8, /*!< When GATT characteristic descriptor read completes, the event comes */
ESP_GATTC_WRITE_DESCR_EVT = 9, /*!< When GATT characteristic descriptor write completes, the event comes */
ESP_GATTC_NOTIFY_EVT = 10, /*!< When GATT notification or indication arrives, the event comes */
ESP_GATTC_PREP_WRITE_EVT = 11, /*!< When GATT prepare-write operation completes, the event comes */
ESP_GATTC_EXEC_EVT = 12, /*!< When write execution completes, the event comes */
ESP_GATTC_ACL_EVT = 13, /*!< When ACL connection is up, the event comes */
ESP_GATTC_CANCEL_OPEN_EVT = 14, /*!< When GATT client ongoing connection is cancelled, the event comes */
ESP_GATTC_SRVC_CHG_EVT = 15, /*!< When "service changed" occurs, the event comes */
ESP_GATTC_ENC_CMPL_CB_EVT = 17, /*!< When encryption procedure completes, the event comes */
ESP_GATTC_CFG_MTU_EVT = 18, /*!< When configuration of MTU completes, the event comes */
ESP_GATTC_ADV_DATA_EVT = 19, /*!< When advertising of data, the event comes */
ESP_GATTC_MULT_ADV_ENB_EVT = 20, /*!< When multi-advertising is enabled, the event comes */
ESP_GATTC_MULT_ADV_UPD_EVT = 21, /*!< When multi-advertising parameters are updated, the event comes */
ESP_GATTC_MULT_ADV_DATA_EVT = 22, /*!< When multi-advertising data arrives, the event comes */
ESP_GATTC_MULT_ADV_DIS_EVT = 23, /*!< When multi-advertising is disabled, the event comes */
ESP_GATTC_CONGEST_EVT = 24, /*!< When GATT connection congestion comes, the event comes */
ESP_GATTC_BTH_SCAN_ENB_EVT = 25, /*!< When batch scan is enabled, the event comes */
ESP_GATTC_BTH_SCAN_CFG_EVT = 26, /*!< When batch scan storage is configured, the event comes */
ESP_GATTC_BTH_SCAN_RD_EVT = 27, /*!< When Batch scan read event is reported, the event comes */
ESP_GATTC_BTH_SCAN_THR_EVT = 28, /*!< When Batch scan threshold is set, the event comes */
ESP_GATTC_BTH_SCAN_PARAM_EVT = 29, /*!< When Batch scan parameters are set, the event comes */
ESP_GATTC_BTH_SCAN_DIS_EVT = 30, /*!< When Batch scan is disabled, the event comes */
ESP_GATTC_SCAN_FLT_CFG_EVT = 31, /*!< When Scan filter configuration completes, the event comes */
ESP_GATTC_SCAN_FLT_PARAM_EVT = 32, /*!< When Scan filter parameters are set, the event comes */
ESP_GATTC_SCAN_FLT_STATUS_EVT = 33, /*!< When Scan filter status is reported, the event comes */
ESP_GATTC_ADV_VSC_EVT = 34, /*!< When advertising vendor spec content event is reported, the event comes */
ESP_GATTC_GET_CHAR_EVT = 35, /*!< When characteristic is got from GATT server, the event comes */
ESP_GATTC_GET_DESCR_EVT = 36, /*!< When characteristic descriptor is got from GATT server, the event comes */
ESP_GATTC_GET_INCL_SRVC_EVT = 37, /*!< When included service is got from GATT server, the event comes */
ESP_GATTC_REG_FOR_NOTIFY_EVT = 38, /*!< When register for notification of a service completes, the event comes */
ESP_GATTC_UNREG_FOR_NOTIFY_EVT = 39, /*!< When unregister for notification of a service completes, the event comes */
} esp_gattc_cb_event_t;
/// Maximum Transmission Unit used in GATT
@ -254,7 +254,8 @@ typedef union {
*
* @param[in] callback : pointer to the application callback function.
*
* @return - ESP_OK: success
* @return
* - ESP_OK: success
* - other: failed
*
*/
@ -270,7 +271,8 @@ esp_err_t esp_ble_gattc_register_callback(esp_profile_cb_t callback);
*
* @param[in] app_id : Application Identify (UUID), for different application
*
* @return - ESP_OK: success
* @return
* - ESP_OK: success
* - other: failed
*
*/
@ -286,7 +288,8 @@ esp_err_t esp_ble_gattc_app_register(uint16_t app_id);
*
* @param[in] gatt_if : app identifier.
*
* @return - ESP_OK: success
* @return
* - ESP_OK: success
* - other: failed
*
*/
@ -303,7 +306,8 @@ esp_err_t esp_ble_gattc_app_unregister(esp_gatt_if_t gatt_if);
* @param[in] remote_bda: remote device bluetooth device address.
* @param[in] is_direct: direct connection or background auto connection
*
* @return - ESP_OK: success
* @return
* - ESP_OK: success
* - other: failed
*
*/
@ -318,7 +322,8 @@ esp_err_t esp_ble_gattc_open(esp_gatt_if_t gatt_if, esp_bd_addr_t remote_bda, bo
*
* @param[in] conn_id: connection ID to be closed.
*
* @return - ESP_OK: success
* @return
* - ESP_OK: success
* - other: failed
*
*/
@ -335,7 +340,8 @@ esp_err_t esp_ble_gattc_close (uint16_t conn_id);
* @param[in] conn_id: connection ID.
* mtu: desired MTU size to use.
*
* @return - ESP_OK: success
* @return
* - ESP_OK: success
* - other: failed
*
*/
@ -355,7 +361,8 @@ esp_err_t esp_ble_gattc_config_mtu (uint16_t conn_id, uint16_t mtu);
* @param[in] filter_uuid: a UUID of the service application is interested in.
* If Null, discover for all services.
*
* @return - ESP_OK: success
* @return
* - ESP_OK: success
* - other: failed
*
*/
@ -375,7 +382,8 @@ esp_err_t esp_ble_gattc_search_service(uint16_t conn_id, esp_bt_uuid_t *filter_u
*
* @param[in] start_char_id: the start characteristic ID
*
* @return - ESP_OK: success
* @return
* - ESP_OK: success
* - other: failed
*
*/
@ -396,7 +404,8 @@ esp_err_t esp_ble_gattc_get_characteristic(uint16_t conn_id,
* characteristic.
* @param[in] start_descr_id: the start descriptor id
*
* @return - ESP_OK: success
* @return
* - ESP_OK: success
* - other: failed
*
*/
@ -416,7 +425,8 @@ esp_err_t esp_ble_gattc_get_descriptor(uint16_t conn_id,
* @param[in] srvc_id: the service ID of which the characteristic is belonged to.
* @param[in] start_incl_srvc_id: the start include service id
*
* @return - ESP_OK: success
* @return
* - ESP_OK: success
* - other: failed
*
*/
@ -436,7 +446,8 @@ esp_err_t esp_ble_gattc_get_included_service(uint16_t conn_id,
* @param[in] char_id : characteristic ID to read.
* @param[in] auth_req : authenticate request type
*
* @return - ESP_OK: success
* @return
* - ESP_OK: success
* - other: failed
*
*/
@ -457,7 +468,8 @@ esp_err_t esp_ble_gattc_read_char (uint16_t conn_id,
* @param[in] descr_id : characteristic descriptor ID to read.
* @param[in] auth_req : authenticate request type
*
* @return - ESP_OK: success
* @return
* - ESP_OK: success
* - other: failed
*
*/
@ -483,7 +495,8 @@ esp_err_t esp_ble_gattc_read_char_descr (uint16_t conn_id,
* @param[in] auth_req : authentication request.
*
*
* @return - ESP_OK: success
* @return
* - ESP_OK: success
* - other: failed
*
*/
@ -512,7 +525,8 @@ esp_err_t esp_ble_gattc_write_char( uint16_t conn_id,
* @param[in] auth_req : authentication request.
*
*
* @return - ESP_OK: success
* @return
* - ESP_OK: success
* - other: failed
*
*/
@ -539,7 +553,8 @@ esp_err_t esp_ble_gattc_write_char_descr (uint16_t conn_id,
* @param[in] value : the value to be written.
* @param[in] auth_req : authentication request.
*
* @return - ESP_OK: success
* @return
* - ESP_OK: success
* - other: failed
*
*/
@ -560,7 +575,8 @@ esp_err_t esp_ble_gattc_prepare_write(uint16_t conn_id,
* @param[in] conn_id : connection ID.
* @param[in] is_execute : execute or cancel.
*
* @return - ESP_OK: success
* @return
* - ESP_OK: success
* - other: failed
*
*/
@ -579,7 +595,8 @@ esp_err_t esp_ble_gattc_execute_write (uint16_t conn_id, bool is_execute);
* @param[in] char_id : pointer to GATT characteristic ID.
*
*
* @return - ESP_OK: registration succeeds
* @return
* - ESP_OK: registration succeeds
* - other: failed
*
*/
@ -601,7 +618,8 @@ esp_gatt_status_t esp_ble_gattc_register_for_notify (esp_gatt_if_t gatt_if,
* @param[in] char_id : pointer to GATT characteristic ID.
*
*
* @return - ESP_OK: unregister succeeds
* @return
* - ESP_OK: unregister succeeds
* - other: failed
*
*/

View file

@ -246,7 +246,8 @@ typedef union {
* with BTA GATTS module.
*
*
* @return - ESP_OK : success
* @return
* - ESP_OK : success
* - other : failed
*
*/
@ -261,7 +262,8 @@ esp_err_t esp_ble_gatts_register_callback(esp_profile_cb_t callback);
* @brief This function is called to register application identifier
*
*
* @return - ESP_OK : success
* @return
* - ESP_OK : success
* - other : failed
*
*/
@ -277,7 +279,8 @@ esp_err_t esp_ble_gatts_app_register(uint16_t app_id);
*
* @param[in] gatt_if: gatt interface id.
*
* @return - ESP_OK : success
* @return
* - ESP_OK : success
* - other : failed
*
*/
@ -298,7 +301,8 @@ esp_err_t esp_ble_gatts_app_unregister(esp_gatt_if_t gatt_if);
* @param[in] service_id: service ID.
* @param[in] num_handle: number of handle requested for this service.
*
* @return - ESP_OK : success
* @return
* - ESP_OK : success
* - other : failed
*
*/
@ -319,7 +323,8 @@ esp_err_t esp_ble_gatts_create_service(esp_gatt_if_t gatt_if,
* be added.
* @param[in] included_service_handle: the service ID to be included.
*
* @return - ESP_OK : success
* @return
* - ESP_OK : success
* - other : failed
*
*/
@ -339,7 +344,8 @@ esp_err_t esp_ble_gatts_add_included_service(uint16_t service_handle, uint16_t i
* @param[in] perm : Characteristic value declaration attribute permission.
* @param[in] property : Characteristic Properties
*
* @return - ESP_OK : success
* @return
* - ESP_OK : success
* - other : failed
*
*/
@ -360,7 +366,8 @@ esp_err_t esp_ble_gatts_add_char(uint16_t service_handle, esp_bt_uuid_t *char_
* @param[in] perm: descriptor access permission.
* @param[in] descr_uuid: descriptor UUID.
*
* @return - ESP_OK : success
* @return
* - ESP_OK : success
* - other : failed
*
*/
@ -379,7 +386,8 @@ esp_err_t esp_ble_gatts_add_char_descr (uint16_t service_handle,
*
* @param[in] service_handled: service_handle to be deleted.
*
* @return - ESP_OK : success
* @return
* - ESP_OK : success
* - other : failed
*
*/
@ -396,7 +404,8 @@ esp_err_t esp_ble_gatts_delete_service(uint16_t service_handle);
* @param[in] service_handle: the service handle to be started.
* @param[in] sup_transport: supported transport.
*
* @return - ESP_OK : success
* @return
* - ESP_OK : success
* - other : failed
*
*/
@ -412,7 +421,8 @@ esp_err_t esp_ble_gatts_start_service(uint16_t service_handle);
*
* @param[in] service_handle - service to be topped.
*
* @return - ESP_OK : success
* @return
* - ESP_OK : success
* - other : failed
*
*/
@ -432,7 +442,8 @@ esp_err_t esp_ble_gatts_stop_service(uint16_t service_handle);
* @param[in] value: value to indicate.
* @param[in] need_confirm - if this indication expects a confirmation or not.
*
* @return - ESP_OK : success
* @return
* - ESP_OK : success
* - other : failed
*
*/
@ -451,7 +462,8 @@ esp_err_t esp_ble_gatts_send_indicate(uint16_t conn_id, uint16_t attr_handle,
* @param[in] status - response status
* @param[in] rsp - response data.
*
* @return - ESP_OK : success
* @return
* - ESP_OK : success
* - other : failed
*
*/
@ -469,7 +481,8 @@ esp_err_t esp_ble_gatts_send_response(uint16_t conn_id, uint32_t trans_id,
* @param[in] remote_bda: remote device bluetooth device address.
* @param[in] is_direct: direct connection or background auto connection
*
* @return - ESP_OK : success
* @return
* - ESP_OK : success
* - other : failed
*
*/
@ -483,7 +496,8 @@ esp_err_t esp_ble_gatts_open(esp_gatt_if_t gatt_if, esp_bd_addr_t remote_bda, bo
*
* @param[in] conn_id: connection ID to be closed.
*
* @return - ESP_OK : success
* @return
* - ESP_OK : success
* - other : failed
*
*/