Skip to content
Snippets Groups Projects
Commit 05f3ae93 authored by Henri Chataing's avatar Henri Chataing
Browse files

system/bta/rfcomm: Migrate to libbluetooth_log

Test: m com.android.btservices
Bug: 305066880
Flag: EXEMPT, mechanical refactor
Change-Id: I7ca86bc4278996744ef2e9d22f9a847a989816a0
parent 9cea4f7a
No related branches found
No related tags found
No related merge requests found
...@@ -18,11 +18,15 @@ ...@@ -18,11 +18,15 @@
#define LOG_TAG "bta" #define LOG_TAG "bta"
#include <bluetooth/log.h>
#include <cstdint> #include <cstdint>
#include "bta/jv/bta_jv_int.h" // tBTA_JV_CB #include "bta/jv/bta_jv_int.h" // tBTA_JV_CB
#include "stack/include/rfcdefs.h" // RFCOMM_MAX_SCN #include "stack/include/rfcdefs.h" // RFCOMM_MAX_SCN
using namespace bluetooth;
extern tBTA_JV_CB bta_jv_cb; extern tBTA_JV_CB bta_jv_cb;
/******************************************************************************* /*******************************************************************************
...@@ -41,7 +45,7 @@ uint8_t BTA_AllocateSCN(void) { ...@@ -41,7 +45,7 @@ uint8_t BTA_AllocateSCN(void) {
if (!bta_jv_cb.scn_in_use[i]) { if (!bta_jv_cb.scn_in_use[i]) {
bta_jv_cb.scn_in_use[i] = true; bta_jv_cb.scn_in_use[i] = true;
bta_jv_cb.scn_search_index = (i + 1); bta_jv_cb.scn_search_index = (i + 1);
LOG_DEBUG("Allocating scn: %u", i + 1); log::debug("Allocating scn: {}", i + 1);
return (i + 1); // allocated scn is index + 1 return (i + 1); // allocated scn is index + 1
} }
} }
...@@ -57,11 +61,11 @@ uint8_t BTA_AllocateSCN(void) { ...@@ -57,11 +61,11 @@ uint8_t BTA_AllocateSCN(void) {
if (!bta_jv_cb.scn_in_use[i]) { if (!bta_jv_cb.scn_in_use[i]) {
bta_jv_cb.scn_in_use[i] = true; bta_jv_cb.scn_in_use[i] = true;
bta_jv_cb.scn_search_index = (i + 1); bta_jv_cb.scn_search_index = (i + 1);
LOG_DEBUG("Allocating scn: %u", i + 1); log::debug("Allocating scn: {}", i + 1);
return (i + 1); // allocated scn is index + 1 return (i + 1); // allocated scn is index + 1
} }
} }
LOG_DEBUG("Unable to allocate an scn"); log::debug("Unable to allocate an scn");
return (0); /* No free ports */ return (0); /* No free ports */
} }
...@@ -84,10 +88,10 @@ bool BTA_TryAllocateSCN(uint8_t scn) { ...@@ -84,10 +88,10 @@ bool BTA_TryAllocateSCN(uint8_t scn) {
/* check if this scn is available */ /* check if this scn is available */
if (!bta_jv_cb.scn_in_use[scn - 1]) { if (!bta_jv_cb.scn_in_use[scn - 1]) {
bta_jv_cb.scn_in_use[scn - 1] = true; bta_jv_cb.scn_in_use[scn - 1] = true;
LOG_DEBUG("Allocating scn: %u", scn); log::debug("Allocating scn: {}", scn);
return true; return true;
} }
LOG_DEBUG("Unable to allocate scn %u", scn); log::debug("Unable to allocate scn {}", scn);
return (false); /* scn was busy */ return (false); /* scn was busy */
} }
...@@ -106,10 +110,10 @@ bool BTA_FreeSCN(uint8_t scn) { ...@@ -106,10 +110,10 @@ bool BTA_FreeSCN(uint8_t scn) {
*/ */
if (scn < RFCOMM_MAX_SCN && scn > 1) { if (scn < RFCOMM_MAX_SCN && scn > 1) {
bta_jv_cb.scn_in_use[scn - 1] = false; bta_jv_cb.scn_in_use[scn - 1] = false;
LOG_DEBUG("Freed SCN: %u", scn); log::debug("Freed SCN: {}", scn);
return (true); return (true);
} else { } else {
LOG_WARN("Invalid SCN: %u", scn); log::warn("Invalid SCN: {}", scn);
return (false); /* Illegal SCN passed in */ return (false); /* Illegal SCN passed in */
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment