Loading system/internal_include/bt_target.h +5 −0 Original line number Diff line number Diff line Loading @@ -826,6 +826,11 @@ #define AVDT_PROTECT_SIZE 90 #endif /* Default sink delay value in ms. */ #ifndef AVDT_SINK_DELAY_MS #define AVDT_SINK_DELAY_MS 300 #endif /****************************************************************************** * * PAN Loading system/stack/Android.bp +50 −0 Original line number Diff line number Diff line Loading @@ -507,6 +507,56 @@ cc_test { }, } cc_test { name: "net_test_stack_avdtp", defaults: ["fluoride_defaults"], test_suites: ["device-tests"], host_supported: true, test_options: { unit_test: true, }, include_dirs: [ "external/libldac/inc", "packages/modules/Bluetooth/system", "packages/modules/Bluetooth/system/stack/include", "packages/modules/Bluetooth/system/utils/include", ], srcs: [ "test/stack_avdtp_test.cc", "avdt/avdt_ad.cc", "avdt/avdt_api.cc", "avdt/avdt_ccb.cc", "avdt/avdt_ccb_act.cc", "avdt/avdt_l2c.cc", "avdt/avdt_scb.cc", "avdt/avdt_scb_act.cc", "test/common/mock_btu_layer.cc", "test/common/mock_stack_avdt_msg.cc", ":TestMockStackL2cap", ":TestMockStackAcl", ":TestMockStackA2dp", ":TestMockBta", ":TestMockDevice", ], shared_libs: [ "libcrypto", "libcutils", "libprotobuf-cpp-lite", ], static_libs: [ "libbt-common", "libbt-protos-lite", "liblog", "libosi", "libosi-AllocationTestHarness", ], sanitize: { address: true, cfi: true, misc_undefined: ["bounds"], }, } cc_test { name: "net_test_stack_a2dp_native", defaults: ["fluoride_defaults"], Loading system/stack/avdt/avdt_int.h +2 −0 Original line number Diff line number Diff line Loading @@ -234,6 +234,7 @@ enum { AVDT_SCB_SND_SETCONFIG_REQ, AVDT_SCB_SND_SETCONFIG_REJ, AVDT_SCB_SND_SETCONFIG_RSP, AVDT_SCB_SND_SNK_DELAY_RPT_REQ, AVDT_SCB_SND_TC_CLOSE, AVDT_SCB_CB_ERR, AVDT_SCB_CONG_STATE, Loading Loading @@ -910,6 +911,7 @@ extern void avdt_scb_snd_security_rsp(AvdtpScb* p_scb, tAVDT_SCB_EVT* p_data); extern void avdt_scb_snd_setconfig_req(AvdtpScb* p_scb, tAVDT_SCB_EVT* p_data); extern void avdt_scb_snd_setconfig_rej(AvdtpScb* p_scb, tAVDT_SCB_EVT* p_data); extern void avdt_scb_snd_setconfig_rsp(AvdtpScb* p_scb, tAVDT_SCB_EVT* p_data); extern void avdt_scb_snd_snk_delay_rpt_req(AvdtpScb* p_scb, tAVDT_SCB_EVT* p_data); extern void avdt_scb_snd_tc_close(AvdtpScb* p_scb, tAVDT_SCB_EVT* p_data); extern void avdt_scb_cb_err(AvdtpScb* p_scb, tAVDT_SCB_EVT* p_data); extern void avdt_scb_cong_state(AvdtpScb* p_scb, tAVDT_SCB_EVT* p_data); Loading system/stack/avdt/avdt_scb.cc +2 −1 Original line number Diff line number Diff line Loading @@ -112,6 +112,7 @@ const tAVDT_SCB_ACTION avdt_scb_action[] = {avdt_scb_hdl_abort_cmd, avdt_scb_snd_setconfig_req, avdt_scb_snd_setconfig_rej, avdt_scb_snd_setconfig_rsp, avdt_scb_snd_snk_delay_rpt_req, avdt_scb_snd_tc_close, avdt_scb_cb_err, avdt_scb_cong_state, Loading Loading @@ -158,7 +159,7 @@ const uint8_t avdt_scb_st_idle[][AVDT_SCB_NUM_COLS] = { /* API_GETCONFIG_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST}, /* API_SETCONFIG_RSP_EVT */ {AVDT_SCB_SND_SETCONFIG_RSP, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST}, {AVDT_SCB_SND_SETCONFIG_RSP, AVDT_SCB_SND_SNK_DELAY_RPT_REQ, AVDT_SCB_CONF_ST}, /* API_SETCONFIG_REJ_EVT */ {AVDT_SCB_SND_SETCONFIG_REJ, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST}, /* API_OPEN_RSP_EVT */ Loading system/stack/avdt/avdt_scb_act.cc +35 −0 Original line number Diff line number Diff line Loading @@ -642,6 +642,33 @@ void avdt_scb_hdl_setconfig_rej(AvdtpScb* p_scb, tAVDT_SCB_EVT* p_data) { (tAVDT_CTRL*)&p_data->msg.hdr, p_scb->stream_config.scb_index); } /******************************************************************************* * * Function avdt_scb_snd_snk_delay_rpt_req * * Description This function sends the delay report request once it is sink * * Returns Nothing. * ******************************************************************************/ void avdt_scb_snd_snk_delay_rpt_req(AvdtpScb* p_scb, UNUSED_ATTR tAVDT_SCB_EVT* p_data) { if (p_scb->p_ccb == NULL) { return; } // In sink mode, report a fixed delay value when this device is the sink // side. Delay value in this function is in unit of 1/10ms. if (p_scb->stream_config.tsep != AVDT_TSEP_SNK) { return; } tAVDT_SCB_EVT evt; evt.apidelay.hdr.seid = p_scb->peer_seid; evt.apidelay.delay = AVDT_SINK_DELAY_MS * 10; avdt_scb_event(p_scb, AVDT_SCB_API_DELAY_RPT_REQ_EVT, &evt); } /******************************************************************************* * * Function avdt_scb_hdl_setconfig_rsp Loading @@ -649,6 +676,10 @@ void avdt_scb_hdl_setconfig_rej(AvdtpScb* p_scb, tAVDT_SCB_EVT* p_data) { * Description This function sends the SCB an AVDT_SCB_API_OPEN_REQ_EVT * to initiate sending of an open command message. * * This function sends the SCB an AVDT_SCB_API_DELAY_RPT_REQ_EVT * to initiate sending of delay report command message only * when the endpoint takes sink role. * * Returns Nothing. * ******************************************************************************/ Loading @@ -660,6 +691,10 @@ void avdt_scb_hdl_setconfig_rsp(AvdtpScb* p_scb, /* save configuration */ p_scb->curr_cfg = p_scb->req_cfg; // In sink mode, report delay value when this device initiates the connection. // Delay reporting is sent before open request (i.e., in configured state). avdt_scb_snd_snk_delay_rpt_req(p_scb, p_data); /* initiate open */ single.seid = p_scb->peer_seid; tAVDT_SCB_EVT avdt_scb_evt; Loading Loading
system/internal_include/bt_target.h +5 −0 Original line number Diff line number Diff line Loading @@ -826,6 +826,11 @@ #define AVDT_PROTECT_SIZE 90 #endif /* Default sink delay value in ms. */ #ifndef AVDT_SINK_DELAY_MS #define AVDT_SINK_DELAY_MS 300 #endif /****************************************************************************** * * PAN Loading
system/stack/Android.bp +50 −0 Original line number Diff line number Diff line Loading @@ -507,6 +507,56 @@ cc_test { }, } cc_test { name: "net_test_stack_avdtp", defaults: ["fluoride_defaults"], test_suites: ["device-tests"], host_supported: true, test_options: { unit_test: true, }, include_dirs: [ "external/libldac/inc", "packages/modules/Bluetooth/system", "packages/modules/Bluetooth/system/stack/include", "packages/modules/Bluetooth/system/utils/include", ], srcs: [ "test/stack_avdtp_test.cc", "avdt/avdt_ad.cc", "avdt/avdt_api.cc", "avdt/avdt_ccb.cc", "avdt/avdt_ccb_act.cc", "avdt/avdt_l2c.cc", "avdt/avdt_scb.cc", "avdt/avdt_scb_act.cc", "test/common/mock_btu_layer.cc", "test/common/mock_stack_avdt_msg.cc", ":TestMockStackL2cap", ":TestMockStackAcl", ":TestMockStackA2dp", ":TestMockBta", ":TestMockDevice", ], shared_libs: [ "libcrypto", "libcutils", "libprotobuf-cpp-lite", ], static_libs: [ "libbt-common", "libbt-protos-lite", "liblog", "libosi", "libosi-AllocationTestHarness", ], sanitize: { address: true, cfi: true, misc_undefined: ["bounds"], }, } cc_test { name: "net_test_stack_a2dp_native", defaults: ["fluoride_defaults"], Loading
system/stack/avdt/avdt_int.h +2 −0 Original line number Diff line number Diff line Loading @@ -234,6 +234,7 @@ enum { AVDT_SCB_SND_SETCONFIG_REQ, AVDT_SCB_SND_SETCONFIG_REJ, AVDT_SCB_SND_SETCONFIG_RSP, AVDT_SCB_SND_SNK_DELAY_RPT_REQ, AVDT_SCB_SND_TC_CLOSE, AVDT_SCB_CB_ERR, AVDT_SCB_CONG_STATE, Loading Loading @@ -910,6 +911,7 @@ extern void avdt_scb_snd_security_rsp(AvdtpScb* p_scb, tAVDT_SCB_EVT* p_data); extern void avdt_scb_snd_setconfig_req(AvdtpScb* p_scb, tAVDT_SCB_EVT* p_data); extern void avdt_scb_snd_setconfig_rej(AvdtpScb* p_scb, tAVDT_SCB_EVT* p_data); extern void avdt_scb_snd_setconfig_rsp(AvdtpScb* p_scb, tAVDT_SCB_EVT* p_data); extern void avdt_scb_snd_snk_delay_rpt_req(AvdtpScb* p_scb, tAVDT_SCB_EVT* p_data); extern void avdt_scb_snd_tc_close(AvdtpScb* p_scb, tAVDT_SCB_EVT* p_data); extern void avdt_scb_cb_err(AvdtpScb* p_scb, tAVDT_SCB_EVT* p_data); extern void avdt_scb_cong_state(AvdtpScb* p_scb, tAVDT_SCB_EVT* p_data); Loading
system/stack/avdt/avdt_scb.cc +2 −1 Original line number Diff line number Diff line Loading @@ -112,6 +112,7 @@ const tAVDT_SCB_ACTION avdt_scb_action[] = {avdt_scb_hdl_abort_cmd, avdt_scb_snd_setconfig_req, avdt_scb_snd_setconfig_rej, avdt_scb_snd_setconfig_rsp, avdt_scb_snd_snk_delay_rpt_req, avdt_scb_snd_tc_close, avdt_scb_cb_err, avdt_scb_cong_state, Loading Loading @@ -158,7 +159,7 @@ const uint8_t avdt_scb_st_idle[][AVDT_SCB_NUM_COLS] = { /* API_GETCONFIG_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST}, /* API_SETCONFIG_RSP_EVT */ {AVDT_SCB_SND_SETCONFIG_RSP, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST}, {AVDT_SCB_SND_SETCONFIG_RSP, AVDT_SCB_SND_SNK_DELAY_RPT_REQ, AVDT_SCB_CONF_ST}, /* API_SETCONFIG_REJ_EVT */ {AVDT_SCB_SND_SETCONFIG_REJ, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST}, /* API_OPEN_RSP_EVT */ Loading
system/stack/avdt/avdt_scb_act.cc +35 −0 Original line number Diff line number Diff line Loading @@ -642,6 +642,33 @@ void avdt_scb_hdl_setconfig_rej(AvdtpScb* p_scb, tAVDT_SCB_EVT* p_data) { (tAVDT_CTRL*)&p_data->msg.hdr, p_scb->stream_config.scb_index); } /******************************************************************************* * * Function avdt_scb_snd_snk_delay_rpt_req * * Description This function sends the delay report request once it is sink * * Returns Nothing. * ******************************************************************************/ void avdt_scb_snd_snk_delay_rpt_req(AvdtpScb* p_scb, UNUSED_ATTR tAVDT_SCB_EVT* p_data) { if (p_scb->p_ccb == NULL) { return; } // In sink mode, report a fixed delay value when this device is the sink // side. Delay value in this function is in unit of 1/10ms. if (p_scb->stream_config.tsep != AVDT_TSEP_SNK) { return; } tAVDT_SCB_EVT evt; evt.apidelay.hdr.seid = p_scb->peer_seid; evt.apidelay.delay = AVDT_SINK_DELAY_MS * 10; avdt_scb_event(p_scb, AVDT_SCB_API_DELAY_RPT_REQ_EVT, &evt); } /******************************************************************************* * * Function avdt_scb_hdl_setconfig_rsp Loading @@ -649,6 +676,10 @@ void avdt_scb_hdl_setconfig_rej(AvdtpScb* p_scb, tAVDT_SCB_EVT* p_data) { * Description This function sends the SCB an AVDT_SCB_API_OPEN_REQ_EVT * to initiate sending of an open command message. * * This function sends the SCB an AVDT_SCB_API_DELAY_RPT_REQ_EVT * to initiate sending of delay report command message only * when the endpoint takes sink role. * * Returns Nothing. * ******************************************************************************/ Loading @@ -660,6 +691,10 @@ void avdt_scb_hdl_setconfig_rsp(AvdtpScb* p_scb, /* save configuration */ p_scb->curr_cfg = p_scb->req_cfg; // In sink mode, report delay value when this device initiates the connection. // Delay reporting is sent before open request (i.e., in configured state). avdt_scb_snd_snk_delay_rpt_req(p_scb, p_data); /* initiate open */ single.seid = p_scb->peer_seid; tAVDT_SCB_EVT avdt_scb_evt; Loading