summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Sungsoo Lim <sungsoo@google.com> 2022-04-12 12:53:16 +0900
committer Sungsoo Lim <sungsoo@google.com> 2022-04-15 13:59:27 +0900
commit4ac00a2c9d6a2d058c5471121e7266bb2063740a (patch)
tree004b6ecb2b6c636681cbdc722b42469146061966
parent96b86320d4a23ea58a8ee26b14914d2aa79c93b2 (diff)
Adjust log level for AVCT
Bug: 215742462 Tag: #refactor Test: atest CtsBluetoothTestCases bluetooth_test_gd_unit Change-Id: Ib9e6df2a2a604fbce47cbd12f9ead182a4376ae8
-rw-r--r--system/main/bte_logmsg.cc2
-rw-r--r--system/stack/avct/avct_api.cc35
-rw-r--r--system/stack/include/avct_api.h23
-rw-r--r--system/test/mock/mock_stack_avct_api.cc4
-rw-r--r--system/test/stub/legacy_trace.cc1
5 files changed, 60 insertions, 5 deletions
diff --git a/system/main/bte_logmsg.cc b/system/main/bte_logmsg.cc
index fcdcc415a1..fe6dd7f518 100644
--- a/system/main/bte_logmsg.cc
+++ b/system/main/bte_logmsg.cc
@@ -133,6 +133,8 @@ static tBTTRC_FUNC_MAP bttrc_set_level_map[] = {
DEFAULT_CONF_TRACE_LEVEL},
{BTTRC_ID_STK_RFCOMM, BTTRC_ID_STK_RFCOMM_DATA, PORT_SetTraceLevel,
"TRC_RFCOMM", DEFAULT_CONF_TRACE_LEVEL},
+ {BTTRC_ID_STK_AVCT, BTTRC_ID_STK_AVCT, AVCT_SetTraceLevel, "TRC_AVCT",
+ DEFAULT_CONF_TRACE_LEVEL},
{BTTRC_ID_STK_AVDT, BTTRC_ID_STK_AVDT, AVDT_SetTraceLevel, "TRC_AVDT",
DEFAULT_CONF_TRACE_LEVEL},
{BTTRC_ID_STK_AVRC, BTTRC_ID_STK_AVRC, AVRC_SetTraceLevel, "TRC_AVRC",
diff --git a/system/stack/avct/avct_api.cc b/system/stack/avct/avct_api.cc
index 6720ef4532..b52e1afdf4 100644
--- a/system/stack/avct/avct_api.cc
+++ b/system/stack/avct/avct_api.cc
@@ -41,6 +41,7 @@
/* Control block for AVCT */
tAVCT_CB avct_cb;
+uint8_t avct_trace_level = AVCT_INITIAL_TRACE_LEVEL;
/*******************************************************************************
*
@@ -74,11 +75,7 @@ void AVCT_Register() {
&ertm_info, kAvrcBrMtu, AVCT_MIN_BROWSE_MTU,
BTA_SEC_AUTHENTICATE);
-#if defined(AVCT_INITIAL_TRACE_LEVEL)
- avct_cb.trace_level = AVCT_INITIAL_TRACE_LEVEL;
-#else
- avct_cb.trace_level = BT_TRACE_LEVEL_NONE;
-#endif
+ avct_cb.trace_level = avct_trace_level;
}
/*******************************************************************************
@@ -427,3 +424,31 @@ uint16_t AVCT_MsgReq(uint8_t handle, uint8_t label, uint8_t cr, BT_HDR* p_msg) {
}
return result;
}
+
+/******************************************************************************
+ *
+ * Function AVCT_SetTraceLevel
+ *
+ * Description Sets the trace level for AVCT. If 0xff is passed, the
+ * current trace level is returned.
+ *
+ * Input Parameters:
+ * new_level: The level to set the AVCT tracing to:
+ * 0xff-returns the current setting.
+ * 0-turns off tracing.
+ * >= 1-Errors.
+ * >= 2-Warnings.
+ * >= 3-APIs.
+ * >= 4-Events.
+ * >= 5-Debug.
+ *
+ * Returns The new trace level or current trace level if
+ * the input parameter is 0xff.
+ *
+ *****************************************************************************/
+uint8_t AVCT_SetTraceLevel(uint8_t new_level) {
+ if (new_level != 0xFF) {
+ avct_cb.trace_level = avct_trace_level = new_level;
+ }
+ return avct_trace_level;
+}
diff --git a/system/stack/include/avct_api.h b/system/stack/include/avct_api.h
index 8d8e945b5f..aaa62c02e6 100644
--- a/system/stack/include/avct_api.h
+++ b/system/stack/include/avct_api.h
@@ -276,4 +276,27 @@ extern uint16_t AVCT_GetPeerMtu(uint8_t handle);
extern uint16_t AVCT_MsgReq(uint8_t handle, uint8_t label, uint8_t cr,
BT_HDR* p_msg);
+/******************************************************************************
+ *
+ * Function AVCT_SetTraceLevel
+ *
+ * Description Sets the trace level for AVCT. If 0xff is passed, the
+ * current trace level is returned.
+ *
+ * Input Parameters:
+ * new_level: The level to set the AVCT tracing to:
+ * 0xff-returns the current setting.
+ * 0-turns off tracing.
+ * >= 1-Errors.
+ * >= 2-Warnings.
+ * >= 3-APIs.
+ * >= 4-Events.
+ * >= 5-Debug.
+ *
+ * Returns The new trace level or current trace level if
+ * the input parameter is 0xff.
+ *
+ *****************************************************************************/
+extern uint8_t AVCT_SetTraceLevel(uint8_t new_level);
+
#endif /* AVCT_API_H */
diff --git a/system/test/mock/mock_stack_avct_api.cc b/system/test/mock/mock_stack_avct_api.cc
index 327918aa33..e9a0a9c3e5 100644
--- a/system/test/mock/mock_stack_avct_api.cc
+++ b/system/test/mock/mock_stack_avct_api.cc
@@ -73,3 +73,7 @@ uint16_t AVCT_RemoveConn(uint8_t handle) {
}
void AVCT_Deregister(void) { mock_function_count_map[__func__]++; }
void AVCT_Register() { mock_function_count_map[__func__]++; }
+uint8_t AVCT_SetTraceLevel(uint8_t new_level) {
+ mock_function_count_map[__func__]++;
+ return 0;
+}
diff --git a/system/test/stub/legacy_trace.cc b/system/test/stub/legacy_trace.cc
index 2b4e3dcc55..e3351ee210 100644
--- a/system/test/stub/legacy_trace.cc
+++ b/system/test/stub/legacy_trace.cc
@@ -22,6 +22,7 @@ uint8_t appl_trace_level = 6;
uint8_t btif_trace_level = 6;
uint8_t A2DP_SetTraceLevel(uint8_t new_level) { return 0; }
+uint8_t AVCT_SetTraceLevel(uint8_t new_level) { return 0; }
uint8_t AVDT_SetTraceLevel(uint8_t new_level) { return 0; }
uint8_t AVRC_SetTraceLevel(uint8_t new_level) { return 0; }
uint8_t BNEP_SetTraceLevel(uint8_t new_level) { return 0; }