OSDN Git Service

Re-log stack/btm/btm_ble::BTM_BleSetPhy
authorChris Manton <cmanton@google.com>
Wed, 23 Sep 2020 15:07:55 +0000 (08:07 -0700)
committerChris Manton <cmanton@google.com>
Thu, 8 Oct 2020 06:08:16 +0000 (06:08 +0000)
Towards loggable code

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working
Test: act.py -tc BleCocTest
Change-Id: I9dee4893066ed0a80a4dac652d622909a05416fd

stack/btm/btm_ble.cc

index 2f93333..037f385 100644 (file)
@@ -784,21 +784,6 @@ void BTM_BleReadPhy(
 
 void doNothing(uint8_t* data, uint16_t len) {}
 
-/*******************************************************************************
- *
- * Function         BTM_BleSetPhy
- *
- * Description      To set PHY preferences for specified LE connection
- *
- *
- * Returns          BTM_SUCCESS if command successfully sent to controller,
- *                  BTM_MODE_UNSUPPORTED if local controller doesn't support LE
- *                  2M or LE Coded PHY,
- *                  BTM_ILLEGAL_VALUE if specified remote doesn't support LE 2M
- *                  or LE Coded PHY,
- *                  BTM_WRONG_MODE if Device in wrong mode for request.
- *
- ******************************************************************************/
 void BTM_BleSetPhy(const RawAddress& bd_addr, uint8_t tx_phys, uint8_t rx_phys,
                    uint16_t phy_options) {
   if (bluetooth::shim::is_gd_shim_enabled()) {
@@ -806,8 +791,9 @@ void BTM_BleSetPhy(const RawAddress& bd_addr, uint8_t tx_phys, uint8_t rx_phys,
                                           phy_options);
   }
   if (!BTM_IsAclConnectionUp(bd_addr, BT_TRANSPORT_LE)) {
-    BTM_TRACE_ERROR("%s: Wrong mode: no LE link exist or LE not supported",
-                    __func__);
+    LOG_INFO(
+        "Unable to set phy preferences because no le acl is connected to "
+        "device");
     return;
   }
 
@@ -815,25 +801,19 @@ void BTM_BleSetPhy(const RawAddress& bd_addr, uint8_t tx_phys, uint8_t rx_phys,
   if (tx_phys == 0) all_phys &= 0x01;
   if (rx_phys == 0) all_phys &= 0x02;
 
-  BTM_TRACE_DEBUG(
-      "%s: all_phys = 0x%02x, tx_phys = 0x%02x, rx_phys = 0x%02x, phy_options "
-      "= 0x%04x",
-      __func__, all_phys, tx_phys, rx_phys, phy_options);
-
   uint16_t handle = acl_get_hci_handle_for_hcif(bd_addr, BT_TRANSPORT_LE);
 
   // checking if local controller supports it!
   if (!controller_get_interface()->supports_ble_2m_phy() &&
       !controller_get_interface()->supports_ble_coded_phy()) {
-    BTM_TRACE_ERROR("%s failed, request not supported in local controller!",
-                    __func__);
+    LOG_INFO("Local controller unable to support setting of le phy parameters");
     gatt_notify_phy_updated(GATT_REQ_NOT_SUPPORTED, handle, tx_phys, rx_phys);
     return;
   }
 
   if (!acl_peer_supports_ble_2m_phy(handle) &&
       !acl_peer_supports_ble_coded_phy(handle)) {
-    BTM_TRACE_ERROR("%s failed, peer does not support request", __func__);
+    LOG_INFO("Remote device unable to support setting of le phy parameter");
     gatt_notify_phy_updated(GATT_REQ_NOT_SUPPORTED, handle, tx_phys, rx_phys);
     return;
   }