Skip to content

Commit

Permalink
Bluetooth: TWSP: Support Battery status indication
Browse files Browse the repository at this point in the history
Support Battery status Indication for TWS+ devices

Change-Id: Iaee7c7cbd9031a9c2b18be5914e8a07383788ad2
  • Loading branch information
Bhakthavatsala Raghavendra authored and Gerrit - the friendly Code Review server committed Jun 13, 2019
1 parent 2906234 commit daa883f
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 5 deletions.
1 change: 1 addition & 0 deletions bta/Android.bp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ cc_defaults {
"vendor/qcom/opensource/commonsys/bluetooth_ext/system_bt_ext",
"vendor/qcom/opensource/commonsys/bluetooth_ext/vhal/include",
"vendor/qcom/opensource/commonsys/bluetooth_ext/system_bt_ext/bta/include",
"vendor/qcom/opensource/commonsys/bluetooth_ext/system_bt_ext/btif/include",
"vendor/qcom/opensource/commonsys-intf/bluetooth/include",
"vendor/qcom/opensource/commonsys/system/bt/device/include",
],
Expand Down
4 changes: 2 additions & 2 deletions bta/ag/bta_ag_cmd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ const tBTA_AG_AT_CMD bta_ag_hfp_cmd[] = {
{"%QMQ", BTA_AG_TWSP_AT_QMQ_EVT, BTA_AG_AT_SET, BTA_AG_AT_INT, TWSPLUS_MIN_MIC_QUALITY, TWSPLUS_MAX_MIC_QUALITY},
{"%QES", BTA_AG_TWSP_AT_QES_EVT, BTA_AG_AT_SET, BTA_AG_AT_INT, TWSPLUS_EB_STATE_UNKNOWN, TWSPLUS_EB_STATE_INEAR},
{"%QER", BTA_AG_TWSP_AT_QER_EVT, BTA_AG_AT_SET, BTA_AG_AT_INT, TWSPLUS_EB_ROLE_LEFT, TWSPLUS_EB_ROLE_MONO},
{"%QBC", BTA_AG_TWSP_AT_QBC_EVT, BTA_AG_AT_SET, BTA_AG_AT_INT, TWSPLUS_MIN_BATTERY_CHARGE, TWSPLUS_MAX_BATTERY_CHARGE},
{"%QBC", BTA_AG_TWSP_AT_QBC_EVT, BTA_AG_AT_SET, BTA_AG_AT_STR, 0, 0},
{"%QMD", BTA_AG_TWSP_AT_QMD_EVT, BTA_AG_AT_SET, BTA_AG_AT_INT, TWSPLUS_MIN_MICPATH_DELAY, TWSPLUS_MAX_MICPATH_DELAY/2-1},
{"%QDSP", BTA_AG_TWSP_AT_QDSP_EVT, BTA_AG_AT_SET, BTA_AG_AT_INT, TWSPLUS_MIN_QDSP, TWSPLUS_MAX_QDSP},
#endif
Expand Down Expand Up @@ -1498,7 +1498,7 @@ void bta_ag_at_hfp_cback(tBTA_AG_SCB* p_scb, uint16_t cmd, uint8_t arg_type,
case BTA_AG_TWSP_AT_QDSP_EVT:
if (is_twsp_device(p_scb->peer_addr)) {
bta_ag_send_ok(p_scb);
twsp_handle_vs_at_events(p_scb, cmd, int_arg);
twsp_handle_vs_at_events(p_scb, cmd, &val, int_arg);
} else {
APPL_TRACE_DEBUG("Not supported for non-twsp devices");
bta_ag_send_error(p_scb, BTA_AG_ERR_OP_NOT_SUPPORTED);
Expand Down
1 change: 1 addition & 0 deletions btif/Android.bp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
btifCommonIncludes = [
"vendor/qcom/opensource/commonsys/system/bt",
"vendor/qcom/opensource/commonsys/system/bt/bta/include",
"vendor/qcom/opensource/commonsys/system/bt/bta/ag",
"vendor/qcom/opensource/commonsys/system/bt/bta/sys",
"vendor/qcom/opensource/commonsys/system/bt/bta/ag",
"vendor/qcom/opensource/commonsys/system/bt/bta/dm",
Expand Down
13 changes: 11 additions & 2 deletions btif/src/btif_hf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#if (TWS_AG_ENABLED == TRUE)
#include "btif_tws_plus.h"
#include "btif_twsp_hf.h"
#include "bta_ag_twsp.h"
#endif
#include "device/include/device_iot_config.h"

Expand Down Expand Up @@ -718,7 +719,7 @@ static void btif_hf_upstreams_evt(uint16_t event, char* p_param) {
case BTA_AG_SWB_EVT:
BTIF_TRACE_DEBUG("%s: AG final selected SWB codec is 0x%02x 0=Q0 4=Q1 6=Q3 7=Q4",
__func__, p_data->val.num);
btif_handle_vendor_hf_events(event, p_data->val.num, &btif_hf_cb[idx].connected_bda);
btif_handle_vendor_hf_events(event, p_data, &btif_hf_cb[idx].connected_bda);
break;
#endif

Expand Down Expand Up @@ -784,7 +785,7 @@ static void btif_hf_upstreams_evt(uint16_t event, char* p_param) {
case BTA_AG_AT_QCS_EVT:
BTIF_TRACE_DEBUG("%s: AG final selected SWB codec is 0x%02x 0=Q0 4=Q1 6=Q3 7=Q4",
__func__, p_data->val.num);
btif_handle_vendor_hf_events(event, p_data->val.num, &btif_hf_cb[idx].connected_bda);
btif_handle_vendor_hf_events(event, p_data, &btif_hf_cb[idx].connected_bda);
break;
#endif

Expand All @@ -801,6 +802,14 @@ static void btif_hf_upstreams_evt(uint16_t event, char* p_param) {
(int)p_data->val.num, &btif_hf_cb[idx].connected_bda);
}
break;
case BTA_AG_TWSP_BATTERY_UPDATE: {
BTIF_TRACE_DEBUG("%s: Twsp battery status update : %s",
__func__, p_data->val.str);
btif_handle_vendor_hf_events(event, p_data,
&btif_hf_cb[idx].connected_bda);
}
break;

default:
BTIF_TRACE_WARNING("%s: Unhandled event: %d", __func__, event);
break;
Expand Down
3 changes: 2 additions & 1 deletion btif/src/btif_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
#include "btif_dm.h"
#include "btu.h"
#include "btif_av.h"
#include "btif_twsp_hf.h"
#if (SWB_ENABLED == TRUE)
#include "bta_ag_swb.h"
#endif
Expand Down Expand Up @@ -221,7 +222,7 @@ const char* dump_hf_event(uint16_t event) {
CASE_RETURN_STR(BTA_AG_AT_BCS_EVT)
CASE_RETURN_STR(BTA_AG_AT_BIND_EVT)
CASE_RETURN_STR(BTA_AG_AT_BIEV_EVT)

CASE_RETURN_STR(BTA_AG_TWSP_BATTERY_UPDATE)
default:
return "UNKNOWN MSG ID";
}
Expand Down

0 comments on commit daa883f

Please sign in to comment.