Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f55e2de7 authored by Pomai Ahlo's avatar Pomai Ahlo
Browse files

RFCOMM cpplint: logging, comment, and syntax

Bug: 356407893
Test: m com.android.btservices
Flag: EXEMPT logging + mechanical refactor
Change-Id: I4d7d68ec820ff256fd032dd2efcd919df11a1f7c
parent bef7a499
Loading
Loading
Loading
Loading
+6 −13
Original line number Diff line number Diff line
@@ -21,15 +21,14 @@
 *  This is the public interface file the BTA Java I/F
 *
 ******************************************************************************/
#ifndef BTA_JV_API_H
#define BTA_JV_API_H
#pragma once

#include <cstdint>
#include <memory>
#include <string>

#include "bta/include/bta_api.h"
#include "bta_sec_api.h"
#include "bta/include/bta_sec_api.h"
#include "include/macros.h"
#include "internal_include/bt_target.h"
#include "stack/include/bt_hdr.h"
@@ -79,9 +78,8 @@ typedef uint8_t tBTA_JV_L2CAP_REASON;
#define BTA_JV_MAX_UUIDS SDP_MAX_UUID_FILTERS
#define BTA_JV_MAX_ATTRS SDP_MAX_ATTR_FILTERS
#define BTA_JV_MAX_SDP_REC SDP_MAX_RECORDS
#define BTA_JV_MAX_L2C_CONN                                                    \
  GAP_MAX_CONNECTIONS /* GAP handle is used as index, hence do not change this \
                         value */
/* GAP handle is used as index, hence do not change this value */
#define BTA_JV_MAX_L2C_CONN GAP_MAX_CONNECTIONS
#define BTA_JV_MAX_RFC_CONN MAX_RFC_PORTS

#ifndef BTA_JV_DEF_RFC_MTU
@@ -272,7 +270,6 @@ typedef struct {
  int32_t tx_mtu;        /* The transmit MTU */
  void** p_p_cback;      /* set them for new socket */
  void** p_user_data;    /* set them for new socket */

} tBTA_JV_L2CAP_LE_OPEN;

/* data associated with BTA_JV_L2CAP_CLOSE_EVT */
@@ -311,8 +308,7 @@ typedef struct {
  tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */
  uint32_t handle;       /* The connection handle */
  uint32_t req_id;       /* The req_id in the associated BTA_JvL2capRead() */
  uint8_t* p_data;       /* This points the same location as the p_data
                          * parameter in BTA_JvL2capRead () */
  uint8_t* p_data;       /* Points to the same location as p_data parameter in BTA_JvL2capRead() */
  uint16_t len;          /* The length of the data read. */
} tBTA_JV_L2CAP_READ;

@@ -424,8 +420,7 @@ typedef union {
  tBTA_JV_RFCOMM_CL_INIT rfc_cl_init;   /* BTA_JV_RFCOMM_CL_INIT_EVT */
  tBTA_JV_RFCOMM_CONG rfc_cong;         /* BTA_JV_RFCOMM_CONG_EVT */
  tBTA_JV_RFCOMM_WRITE rfc_write;       /* BTA_JV_RFCOMM_WRITE_EVT */
  tBTA_JV_DATA_IND data_ind;            /* BTA_JV_L2CAP_DATA_IND_EVT
                                           BTA_JV_RFCOMM_DATA_IND_EVT */
  tBTA_JV_DATA_IND data_ind;            /* BTA_JV_L2CAP_DATA_IND_EVT, BTA_JV_RFCOMM_DATA_IND_EVT */
  tBTA_JV_LE_DATA_IND le_data_ind;      /* BTA_JV_L2CAP_LE_DATA_IND_EVT */
  tBTA_JV_L2CAP_LE_OPEN l2c_le_open;    /* BTA_JV_L2CAP_OPEN_EVT */
} tBTA_JV;
@@ -761,5 +756,3 @@ tBTA_JV_STATUS BTA_JvSetPmProfile(uint32_t handle, tBTA_JV_PM_ID app_id,
 *
 ******************************************************************************/
uint16_t BTA_JvRfcommGetPortHdl(uint32_t handle);

#endif /* BTA_JV_API_H */
+3 −3
Original line number Diff line number Diff line
@@ -1738,6 +1738,7 @@ static tBTA_JV_PCB* bta_jv_add_rfc_port(tBTA_JV_RFC_CB* p_cb, tBTA_JV_PCB* p_pcb
        port_state.fc_type = (PORT_FC_CTS_ON_INPUT | PORT_FC_CTS_ON_OUTPUT);

        if (PORT_SetState(p_pcb->port_handle, &port_state) != PORT_SUCCESS) {
          log::warn("Unable to set RFCOMM server state handle:{}", p_pcb->port_handle);
        }
        p_pcb->handle = BTA_JV_RFC_H_S_TO_HDL(p_cb->handle, si);
        log::verbose("p_pcb->handle=0x{:x}, curr_sess={}", p_pcb->handle, p_cb->curr_sess);
@@ -1805,7 +1806,7 @@ void bta_jv_rfcomm_start_server(tBTA_SEC sec_mask, uint8_t local_scn, uint8_t ma

    if (PORT_SetState(handle, &port_state) != PORT_SUCCESS) {
      log::warn("Unable to set RFCOMM port state handle:{}", handle);
    };
    }
  } while (0);

  tBTA_JV bta_jv;
@@ -1891,8 +1892,7 @@ void bta_jv_set_pm_profile(uint32_t handle, tBTA_JV_PM_ID app_id, tBTA_JV_CONN_S
    if (status != tBTA_JV_STATUS::SUCCESS) {
      log::warn("free pm cb failed: reason={}", bta_jv_status_text(status));
    }
  } else /* set PM control block */
  {
  } else { /* set PM control block */
    p_cb = bta_jv_alloc_set_pm_profile_cb(handle, app_id);

    if (NULL != p_cb) {
+1 −3
Original line number Diff line number Diff line
@@ -925,9 +925,7 @@ int PORT_WriteDataCO(uint16_t handle, int* p_len) {
    // if(recv(fd, (uint8_t *)(p_buf + 1) + p_buf->offset + p_buf->len,
    // available, 0) != available)
    if (!p_port->p_data_co_callback(handle, (uint8_t*)(p_buf + 1) + p_buf->offset + p_buf->len,
                                    available, DATA_CO_CALLBACK_TYPE_OUTGOING))

    {
                                    available, DATA_CO_CALLBACK_TYPE_OUTGOING)) {
      log::error("p_data_co_callback DATA_CO_CALLBACK_TYPE_OUTGOING failed, available:{}",
                 available);
      mutex_global_unlock();