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

Commit 3313c7b0 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "legacy: Use proper types stack/pan::tBTA_PAN_RESULT"

parents c2603b51 60084bac
Loading
Loading
Loading
Loading
+8 −12
Original line number Diff line number Diff line
@@ -214,12 +214,10 @@ static void bta_pan_data_buf_ind_cback(uint16_t handle, const RawAddress& src,
 *
 ******************************************************************************/
static void bta_pan_pfilt_ind_cback(uint16_t handle, bool indication,
                                    tBNEP_RESULT result, uint16_t num_filters,
                                    tPAN_RESULT result, uint16_t num_filters,
                                    uint8_t* p_filters) {
  bta_pan_co_pfilt_ind(
      handle, indication,
      (tBTA_PAN_STATUS)((result == BNEP_SUCCESS) ? BTA_PAN_SUCCESS
                                                 : BTA_PAN_FAIL),
  bta_pan_co_pfilt_ind(handle, indication,
                       (result == PAN_SUCCESS) ? BTA_PAN_SUCCESS : BTA_PAN_FAIL,
                       num_filters, p_filters);
}

@@ -234,12 +232,10 @@ static void bta_pan_pfilt_ind_cback(uint16_t handle, bool indication,
 *
 ******************************************************************************/
static void bta_pan_mfilt_ind_cback(uint16_t handle, bool indication,
                                    tBNEP_RESULT result, uint16_t num_mfilters,
                                    tPAN_RESULT result, uint16_t num_mfilters,
                                    uint8_t* p_mfilters) {
  bta_pan_co_mfilt_ind(
      handle, indication,
      (tBTA_PAN_STATUS)((result == BNEP_SUCCESS) ? BTA_PAN_SUCCESS
                                                 : BTA_PAN_FAIL),
  bta_pan_co_mfilt_ind(handle, indication,
                       (result == PAN_SUCCESS) ? BTA_PAN_SUCCESS : BTA_PAN_FAIL,
                       num_mfilters, p_mfilters);
}

+6 −6
Original line number Diff line number Diff line
@@ -161,7 +161,7 @@ typedef void(tPAN_TX_DATA_FLOW_CB)(uint16_t handle, tPAN_RESULT event);
 *                      next two bytes will be ending of the range.
*/
typedef void(tPAN_FILTER_IND_CB)(uint16_t handle, bool indication,
                                 tBNEP_RESULT result, uint16_t num_filters,
                                 tPAN_RESULT result, uint16_t num_filters,
                                 uint8_t* p_filters);

/* Multicast Filters received indication callback prototype. Parameters are
@@ -177,7 +177,7 @@ typedef void(tPAN_FILTER_IND_CB)(uint16_t handle, bool indication,
 *                      next six bytes will be ending of the range.
*/
typedef void(tPAN_MFILTER_IND_CB)(uint16_t handle, bool indication,
                                  tBNEP_RESULT result, uint16_t num_mfilters,
                                  tPAN_RESULT result, uint16_t num_mfilters,
                                  uint8_t* p_mfilters);

/* This structure is used to register with PAN profile
@@ -392,7 +392,7 @@ extern tPAN_RESULT PAN_SetProtocolFilters(uint16_t handle, uint16_t num_filters,
 *                  PAN_FAILURE     if connection not found or error in setting
 *
 ******************************************************************************/
extern tBNEP_RESULT PAN_SetMulticastFilters(uint16_t handle,
extern tPAN_RESULT PAN_SetMulticastFilters(uint16_t handle,
                                           uint16_t num_mcast_filters,
                                           uint8_t* p_start_array,
                                           uint8_t* p_end_array);
+15 −17
Original line number Diff line number Diff line
@@ -323,13 +323,14 @@ tPAN_RESULT PAN_Connect(const RawAddress& rem_bda, uint8_t src_role,
                   Uuid::From16Bit(dst_uuid), &(pcb->handle), mx_chan_id);
  if (ret != BNEP_SUCCESS) {
    pan_release_pcb(pcb);
    return ret;
    return (tPAN_RESULT)ret;
  }

  PAN_TRACE_DEBUG("PAN_Connect() current active role set to %d", src_role);
  pan_cb.prv_active_role = pan_cb.active_role;
  pan_cb.active_role = src_role;
  *handle = pcb->handle;

  return PAN_SUCCESS;
}

@@ -494,10 +495,10 @@ tPAN_RESULT PAN_WriteBuf(uint16_t handle, const RawAddress& dst,
        BNEP_WriteBuf(pan_cb.pcb[i].handle, dst, p_buf, protocol, &src, ext);
    if (result == BNEP_IGNORE_CMD) {
      PAN_TRACE_DEBUG("PAN ignored data write for PANU connection");
      return result;
      return (tPAN_RESULT)result;
    } else if (result != BNEP_SUCCESS) {
      PAN_TRACE_ERROR("PAN failed to write data for the PANU connection");
      return result;
      return (tPAN_RESULT)result;
    }

    PAN_TRACE_DEBUG("PAN successfully wrote data for the PANU connection");
@@ -521,10 +522,10 @@ tPAN_RESULT PAN_WriteBuf(uint16_t handle, const RawAddress& dst,
  result = BNEP_WriteBuf(pcb->handle, dst, p_buf, protocol, &src, ext);
  if (result == BNEP_IGNORE_CMD) {
    PAN_TRACE_DEBUG("PAN ignored data buf write to PANU");
    return result;
    return (tPAN_RESULT)result;
  } else if (result != BNEP_SUCCESS) {
    PAN_TRACE_ERROR("PAN failed to send data buf to the PANU");
    return result;
    return (tPAN_RESULT)result;
  }

  PAN_TRACE_DEBUG("PAN successfully sent data buf to the PANU");
@@ -551,7 +552,6 @@ tPAN_RESULT PAN_SetProtocolFilters(uint16_t handle, uint16_t num_filters,
                                   uint16_t* p_start_array,
                                   uint16_t* p_end_array) {
  tPAN_CONN* pcb;
  tPAN_RESULT result;

  /* Check if the connection exists */
  pcb = pan_get_pcb_by_handle(handle);
@@ -560,11 +560,11 @@ tPAN_RESULT PAN_SetProtocolFilters(uint16_t handle, uint16_t num_filters,
    return PAN_FAILURE;
  }

  result = BNEP_SetProtocolFilters(pcb->handle, num_filters, p_start_array,
                                   p_end_array);
  tBNEP_RESULT result = BNEP_SetProtocolFilters(pcb->handle, num_filters,
                                                p_start_array, p_end_array);
  if (result != BNEP_SUCCESS) {
    PAN_TRACE_ERROR("PAN failed to set protocol filters for handle %d", handle);
    return result;
    return (tPAN_RESULT)result;
  }

  PAN_TRACE_API("PAN successfully sent protocol filters for handle %d", handle);
@@ -587,12 +587,10 @@ tPAN_RESULT PAN_SetProtocolFilters(uint16_t handle, uint16_t num_filters,
 *                  PAN_FAILURE    if connection not found or error in setting
 *
 ******************************************************************************/
tBNEP_RESULT PAN_SetMulticastFilters(uint16_t handle,
                                     uint16_t num_mcast_filters,
tPAN_RESULT PAN_SetMulticastFilters(uint16_t handle, uint16_t num_mcast_filters,
                                    uint8_t* p_start_array,
                                    uint8_t* p_end_array) {
  tPAN_CONN* pcb;
  tPAN_RESULT result;

  /* Check if the connection exists */
  pcb = pan_get_pcb_by_handle(handle);
@@ -601,12 +599,12 @@ tBNEP_RESULT PAN_SetMulticastFilters(uint16_t handle,
    return PAN_FAILURE;
  }

  result = BNEP_SetMulticastFilters(pcb->handle, num_mcast_filters,
  tBNEP_RESULT result = BNEP_SetMulticastFilters(pcb->handle, num_mcast_filters,
                                                 p_start_array, p_end_array);
  if (result != BNEP_SUCCESS) {
    PAN_TRACE_ERROR("PAN failed to set multicast filters for handle %d",
                    handle);
    return result;
    return (tPAN_RESULT)result;
  }

  PAN_TRACE_API("PAN successfully sent multicast filters for handle %d",
+10 −9
Original line number Diff line number Diff line
@@ -295,9 +295,9 @@ void pan_connect_state_cb(uint16_t handle,
  if (result != BNEP_SUCCESS) {
    /* Inform the application that connection is down */
    if (pan_cb.pan_conn_state_cb)
      (*pan_cb.pan_conn_state_cb)(pcb->handle, pcb->rem_bda, result,
                                  is_role_change, PAN_ROLE_INACTIVE,
                                  PAN_ROLE_INACTIVE);
      (*pan_cb.pan_conn_state_cb)(pcb->handle, pcb->rem_bda,
                                  (tPAN_RESULT)result, is_role_change,
                                  PAN_ROLE_INACTIVE, PAN_ROLE_INACTIVE);

    /* Check if this failure is for role change only */
    if (pcb->con_state != PAN_STATE_CONNECTED &&
@@ -476,8 +476,9 @@ void pan_data_buf_ind_cb(uint16_t handle, const RawAddress& src,
 * Returns          none
 *
 ******************************************************************************/
void pan_tx_data_flow_cb(uint16_t handle, tBNEP_RESULT event) {
  if (pan_cb.pan_tx_data_flow_cb) (*pan_cb.pan_tx_data_flow_cb)(handle, event);
void pan_tx_data_flow_cb(uint16_t handle, tBNEP_RESULT result) {
  if (pan_cb.pan_tx_data_flow_cb)
    (*pan_cb.pan_tx_data_flow_cb)(handle, (tPAN_RESULT)result);

  return;
}
@@ -512,8 +513,8 @@ void pan_proto_filt_ind_cb(uint16_t handle, bool indication,
      handle, indication, result, num_filters);

  if (pan_cb.pan_pfilt_ind_cb)
    (*pan_cb.pan_pfilt_ind_cb)(handle, indication, result, num_filters,
                               p_filters);
    (*pan_cb.pan_pfilt_ind_cb)(handle, indication, (tPAN_RESULT)result,
                               num_filters, p_filters);
}

/*******************************************************************************
@@ -546,6 +547,6 @@ void pan_mcast_filt_ind_cb(uint16_t handle, bool indication,
      handle, indication, result, num_filters);

  if (pan_cb.pan_mfilt_ind_cb)
    (*pan_cb.pan_mfilt_ind_cb)(handle, indication, result, num_filters,
                               p_filters);
    (*pan_cb.pan_mfilt_ind_cb)(handle, indication, (tPAN_RESULT)result,
                               num_filters, p_filters);
}
+10 −11
Original line number Diff line number Diff line
@@ -42,44 +42,43 @@ extern std::map<std::string, int> mock_function_count_map;
#define UNUSED_ATTR
#endif

tBNEP_RESULT PAN_SetMulticastFilters(uint16_t handle,
                                     uint16_t num_mcast_filters,
tPAN_RESULT PAN_SetMulticastFilters(uint16_t handle, uint16_t num_mcast_filters,
                                    uint8_t* p_start_array,
                                    uint8_t* p_end_array) {
  mock_function_count_map[__func__]++;
  return 0;
  return PAN_SUCCESS;
}
tPAN_RESULT PAN_Connect(const RawAddress& rem_bda, uint8_t src_role,
                        uint8_t dst_role, uint16_t* handle) {
  mock_function_count_map[__func__]++;
  return 0;
  return PAN_SUCCESS;
}
tPAN_RESULT PAN_Disconnect(uint16_t handle) {
  mock_function_count_map[__func__]++;
  return 0;
  return PAN_SUCCESS;
}
tPAN_RESULT PAN_SetProtocolFilters(uint16_t handle, uint16_t num_filters,
                                   uint16_t* p_start_array,
                                   uint16_t* p_end_array) {
  mock_function_count_map[__func__]++;
  return 0;
  return PAN_SUCCESS;
}
tPAN_RESULT PAN_SetRole(uint8_t role, const char* p_user_name,
                        const char* p_nap_name) {
  mock_function_count_map[__func__]++;
  return 0;
  return PAN_SUCCESS;
}
tPAN_RESULT PAN_Write(uint16_t handle, const RawAddress& dst,
                      const RawAddress& src, uint16_t protocol, uint8_t* p_data,
                      uint16_t len, bool ext) {
  mock_function_count_map[__func__]++;
  return 0;
  return PAN_SUCCESS;
}
tPAN_RESULT PAN_WriteBuf(uint16_t handle, const RawAddress& dst,
                         const RawAddress& src, uint16_t protocol,
                         BT_HDR* p_buf, bool ext) {
  mock_function_count_map[__func__]++;
  return 0;
  return PAN_SUCCESS;
}
uint8_t PAN_SetTraceLevel(uint8_t new_level) {
  mock_function_count_map[__func__]++;