Skip to content

Commit

Permalink
Merge branch 'bugfix/add_par_check_in_ag_cind_res_v5.1' into 'release…
Browse files Browse the repository at this point in the history
…/v5.1'

Bugfix/add par check in ag cind res v5.1

See merge request espressif/esp-idf!27257
  • Loading branch information
jack0c committed Nov 22, 2023
2 parents d5e87fe + b9a0ca6 commit 2cc61ca
Show file tree
Hide file tree
Showing 4 changed files with 113 additions and 99 deletions.
12 changes: 11 additions & 1 deletion components/bt/host/bluedroid/api/esp_hf_ag_api.c
Expand Up @@ -171,6 +171,9 @@ esp_err_t esp_hf_ag_volume_control(esp_bd_addr_t remote_addr, esp_hf_volume_cont
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
return ESP_ERR_INVALID_STATE;
}
if (volume < 0 || volume > 15) {
return ESP_ERR_INVALID_ARG;
}
btc_msg_t msg;
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_HF;
Expand Down Expand Up @@ -237,6 +240,9 @@ esp_err_t esp_hf_ag_devices_status_indchange(esp_bd_addr_t remote_addr,
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
return ESP_ERR_INVALID_STATE;
}
if (signal < 0 || signal > 5) {
return ESP_ERR_INVALID_ARG;
}
btc_msg_t msg;
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_HF;
Expand Down Expand Up @@ -285,6 +291,10 @@ esp_err_t esp_hf_ag_cind_response(esp_bd_addr_t remote_addr,
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
return ESP_ERR_INVALID_STATE;
}
if (signal < 0 || signal > 5 || batt_lev < 0 || batt_lev > 5) {
return ESP_ERR_INVALID_ARG;
}

btc_msg_t msg;
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_HF;
Expand Down Expand Up @@ -363,7 +373,7 @@ esp_err_t esp_hf_ag_cnum_response(esp_bd_addr_t remote_addr, char *number, int n
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
return ESP_ERR_INVALID_STATE;
}
if (number == NULL) {
if (number == NULL || number_type < 128 || number_type > 175) {
return ESP_ERR_INVALID_ARG;
}
btc_msg_t msg;
Expand Down
30 changes: 15 additions & 15 deletions components/bt/host/bluedroid/api/include/api/esp_a2dp_api.h
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand Down Expand Up @@ -241,7 +241,7 @@ typedef int32_t (* esp_a2d_source_data_cb_t)(uint8_t *buf, int32_t len);
*
* @return
* - ESP_OK: success
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
* - ESP_FAIL: if callback is a NULL function pointer
*
*/
Expand All @@ -258,7 +258,7 @@ esp_err_t esp_a2d_register_callback(esp_a2d_cb_t callback);
*
* @return
* - ESP_OK: success
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
* - ESP_FAIL: if callback is a NULL function pointer
*
*/
Expand All @@ -275,7 +275,7 @@ esp_err_t esp_a2d_sink_register_data_callback(esp_a2d_sink_data_cb_t callback);
*
* @return
* - ESP_OK: if the initialization request is sent successfully
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
* - ESP_FAIL: others
*
*/
Expand All @@ -290,7 +290,7 @@ esp_err_t esp_a2d_sink_init(void);
*
* @return
* - ESP_OK: if the deinitialization request is sent successfully
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
* - ESP_FAIL: others
*
*/
Expand All @@ -306,7 +306,7 @@ esp_err_t esp_a2d_sink_deinit(void);
*
* @return
* - ESP_OK: connect request is sent to lower layer successfully
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
* - ESP_FAIL: others
*
*/
Expand All @@ -322,7 +322,7 @@ esp_err_t esp_a2d_sink_connect(esp_bd_addr_t remote_bda);
*
* @return
* - ESP_OK: disconnect request is sent to lower layer successfully
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
* - ESP_FAIL: others
*
*/
Expand All @@ -339,7 +339,7 @@ esp_err_t esp_a2d_sink_disconnect(esp_bd_addr_t remote_bda);
*
* @return
* - ESP_OK: delay value is sent to lower layer successfully
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
* - ESP_FAIL: others
*
*/
Expand All @@ -352,7 +352,7 @@ esp_err_t esp_a2d_sink_set_delay_value(uint16_t delay_value);
*
* @return
* - ESP_OK: if the request is sent successfully
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
* - ESP_FAIL: others
*
*/
Expand All @@ -368,7 +368,7 @@ esp_err_t esp_a2d_sink_get_delay_value(void);
*
* @return
* - ESP_OK: control command is sent to lower layer successfully
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
* - ESP_FAIL: others
*
*/
Expand All @@ -385,7 +385,7 @@ esp_err_t esp_a2d_media_ctrl(esp_a2d_media_ctrl_t ctrl);
*
* @return
* - ESP_OK: if the initialization request is sent to lower layer successfully
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
* - ESP_FAIL: others
*
*/
Expand All @@ -400,7 +400,7 @@ esp_err_t esp_a2d_source_init(void);
*
* @return
* - ESP_OK: success
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
* - ESP_FAIL: others
*
*/
Expand All @@ -417,7 +417,7 @@ esp_err_t esp_a2d_source_deinit(void);
*
* @return
* - ESP_OK: success
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
* - ESP_FAIL: if callback is a NULL function pointer
*
*/
Expand All @@ -433,7 +433,7 @@ esp_err_t esp_a2d_source_register_data_callback(esp_a2d_source_data_cb_t callbac
*
* @return
* - ESP_OK: connect request is sent to lower layer successfully
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
* - ESP_FAIL: others
*
*/
Expand All @@ -448,7 +448,7 @@ esp_err_t esp_a2d_source_connect(esp_bd_addr_t remote_bda);
* @param[in] remote_bda: remote bluetooth device address
* @return
* - ESP_OK: disconnect request is sent to lower layer
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
* - ESP_FAIL: others
*
*/
Expand Down

0 comments on commit 2cc61ca

Please sign in to comment.