From: Chris Manton Date: Tue, 6 Oct 2020 17:09:58 +0000 (-0700) Subject: enum-ify stack/include/l2c_api::L2CAP_PRIORITY_ X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=f7305fee7134a28a96a337af5c44cedccb26a6e3;p=android-x86%2Fsystem-bt.git enum-ify stack/include/l2c_api::L2CAP_PRIORITY_ Towards readable code Bug: 163134718 Tag: #refactor Test: act.py -tc BleCocTest Test: ble paired 2 phones Test: classic paired Bose SoundLink Change-Id: I6d0f97493f407f1a4e32bc12434ec5c3c3b8ef54 --- diff --git a/main/shim/l2c_api.cc b/main/shim/l2c_api.cc index ac75e6f31..2433e9403 100644 --- a/main/shim/l2c_api.cc +++ b/main/shim/l2c_api.cc @@ -163,7 +163,7 @@ bool bluetooth::shim::L2CA_SetIdleTimeoutByBdAddr(const RawAddress& bd_addr, } bool bluetooth::shim::L2CA_SetAclPriority(const RawAddress& bd_addr, - uint8_t priority) { + tL2CAP_PRIORITY priority) { LOG_INFO("UNIMPLEMENTED %s", __func__); return false; } diff --git a/main/shim/l2c_api.h b/main/shim/l2c_api.h index bbc77acd5..231d3dcf5 100644 --- a/main/shim/l2c_api.h +++ b/main/shim/l2c_api.h @@ -265,7 +265,7 @@ uint16_t L2CA_FlushChannel(uint16_t lcid, uint16_t num_to_flush); * Returns true if a valid channel, else false * ******************************************************************************/ -bool L2CA_SetAclPriority(const RawAddress& bd_addr, uint8_t priority); +bool L2CA_SetAclPriority(const RawAddress& bd_addr, tL2CAP_PRIORITY priority); /******************************************************************************* * diff --git a/stack/include/l2c_api.h b/stack/include/l2c_api.h index ca638b208..29c9d4e48 100644 --- a/stack/include/l2c_api.h +++ b/stack/include/l2c_api.h @@ -52,8 +52,10 @@ #define L2CAP_DW_CONGESTED 2 /* Values for priority parameter to L2CA_SetAclPriority */ -#define L2CAP_PRIORITY_NORMAL 0 -#define L2CAP_PRIORITY_HIGH 1 +typedef enum : uint8_t { + L2CAP_PRIORITY_NORMAL = 0, + L2CAP_PRIORITY_HIGH = 1, +} tL2CAP_PRIORITY; /* Values for priority parameter to L2CA_SetTxPriority */ #define L2CAP_CHNL_PRIORITY_HIGH 0 @@ -518,7 +520,8 @@ extern uint16_t L2CA_FlushChannel(uint16_t lcid, uint16_t num_to_flush); * Returns true if a valid channel, else false * ******************************************************************************/ -extern bool L2CA_SetAclPriority(const RawAddress& bd_addr, uint8_t priority); +extern bool L2CA_SetAclPriority(const RawAddress& bd_addr, + tL2CAP_PRIORITY priority); /******************************************************************************* * diff --git a/stack/l2cap/l2c_api.cc b/stack/l2cap/l2c_api.cc index 0d1e9b3c2..887e0ed0d 100644 --- a/stack/l2cap/l2c_api.cc +++ b/stack/l2cap/l2c_api.cc @@ -783,7 +783,7 @@ uint8_t L2CA_SetTraceLevel(uint8_t new_level) { * Returns true if a valid channel, else false * ******************************************************************************/ -bool L2CA_SetAclPriority(const RawAddress& bd_addr, uint8_t priority) { +bool L2CA_SetAclPriority(const RawAddress& bd_addr, tL2CAP_PRIORITY priority) { if (bluetooth::shim::is_gd_shim_enabled()) { return bluetooth::shim::L2CA_SetAclPriority(bd_addr, priority); } diff --git a/stack/l2cap/l2c_int.h b/stack/l2cap/l2c_int.h index 68eb90501..f44df89f5 100644 --- a/stack/l2cap/l2c_int.h +++ b/stack/l2cap/l2c_int.h @@ -384,7 +384,7 @@ typedef struct t_l2c_linkcb { uint8_t peer_chnl_mask[L2CAP_FIXED_CHNL_ARRAY_SIZE]; - uint8_t acl_priority; /* L2C_PRIORITY_NORMAL or L2C_PRIORITY_HIGH */ + tL2CAP_PRIORITY acl_priority; tL2C_CCB* p_fixed_ccbs[L2CAP_NUM_FIXED_CHNLS]; @@ -528,7 +528,8 @@ extern tL2C_LCB* l2cu_find_lcb_by_bd_addr(const RawAddress& p_bd_addr, tBT_TRANSPORT transport); extern tL2C_LCB* l2cu_find_lcb_by_handle(uint16_t handle); -extern bool l2cu_set_acl_priority(const RawAddress& bd_addr, uint8_t priority, +extern bool l2cu_set_acl_priority(const RawAddress& bd_addr, + tL2CAP_PRIORITY priority, bool reset_after_rs); extern void l2cu_enqueue_ccb(tL2C_CCB* p_ccb); diff --git a/stack/l2cap/l2c_utils.cc b/stack/l2cap/l2c_utils.cc index b1614ddf7..ead38c1f2 100644 --- a/stack/l2cap/l2c_utils.cc +++ b/stack/l2cap/l2c_utils.cc @@ -2143,7 +2143,7 @@ bool l2cu_lcb_disconnecting(void) { * ******************************************************************************/ -bool l2cu_set_acl_priority(const RawAddress& bd_addr, uint8_t priority, +bool l2cu_set_acl_priority(const RawAddress& bd_addr, tL2CAP_PRIORITY priority, bool reset_after_rs) { tL2C_LCB* p_lcb; uint8_t* pp;