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

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

Merge "Remove unused code in GAP_API"

parents a6a0f79b 109c25ef
Loading
Loading
Loading
Loading
+0 −15
Original line number Diff line number Diff line
@@ -535,21 +535,6 @@ bool GAP_BleReadPeerDevName(const RawAddress& peer_bda,
  return accept_client_operation(peer_bda, GATT_UUID_GAP_DEVICE_NAME, p_cback);
}

/*******************************************************************************
 *
 * Function         GAP_BleReadPeerAddressResolutionCap
 *
 * Description      Start a process to read peer address resolution capability
 *
 * Returns          true if request accepted
 *
 ******************************************************************************/
bool GAP_BleReadPeerAddressResolutionCap(const RawAddress& peer_bda,
                                         tGAP_BLE_CMPL_CBACK* p_cback) {
  return accept_client_operation(peer_bda, GATT_UUID_GAP_CENTRAL_ADDR_RESOL,
                                 p_cback);
}

/*******************************************************************************
 *
 * Function         GAP_BleCancelReadPeerDevName
+0 −95
Original line number Diff line number Diff line
@@ -441,40 +441,6 @@ int GAP_GetRxQueueCnt(uint16_t handle, uint32_t* p_rx_queue_count) {
  return (rc);
}

/*******************************************************************************
 *
 * Function         GAP_ConnBTRead
 *
 * Description      Bluetooth-aware applications will call this function after
 *                  receiving GAP_EVT_RXDATA event.
 *
 * Parameters:      handle      - Handle of the connection returned in the Open
 *                  pp_buf      - pointer to address of buffer with data,
 *
 * Returns          BT_PASS             - data read
 *                  GAP_ERR_BAD_HANDLE  - invalid handle
 *                  GAP_NO_DATA_AVAIL   - no data available
 *
 ******************************************************************************/
uint16_t GAP_ConnBTRead(uint16_t gap_handle, BT_HDR** pp_buf) {
  tGAP_CCB* p_ccb = gap_find_ccb_by_handle(gap_handle);
  BT_HDR* p_buf;

  if (!p_ccb) return (GAP_ERR_BAD_HANDLE);

  p_buf = (BT_HDR*)fixed_queue_try_dequeue(p_ccb->rx_queue);

  if (p_buf) {
    *pp_buf = p_buf;

    p_ccb->rx_queue_size -= p_buf->len;
    return (BT_PASS);
  } else {
    *pp_buf = NULL;
    return (GAP_NO_DATA_AVAIL);
  }
}

/* Try to write the queued data to l2ca. Return true on success, or if queue is
 * congested. False if error occured when writing. */
static bool gap_try_write_queued_data(tGAP_CCB* p_ccb) {
@@ -538,67 +504,6 @@ uint16_t GAP_ConnWriteData(uint16_t gap_handle, BT_HDR* msg) {
  return (BT_PASS);
}

/*******************************************************************************
 *
 * Function         GAP_ConnReconfig
 *
 * Description      Applications can call this function to reconfigure the
 *                  connection.
 *
 * Parameters:      handle      - Handle of the connection
 *                  p_cfg       - Pointer to new configuration
 *
 * Returns          BT_PASS                 - config process started
 *                  GAP_ERR_BAD_HANDLE      - invalid handle
 *
 ******************************************************************************/
uint16_t GAP_ConnReconfig(uint16_t gap_handle, tL2CAP_CFG_INFO* p_cfg) {
  tGAP_CCB* p_ccb = gap_find_ccb_by_handle(gap_handle);

  if (!p_ccb) return (GAP_ERR_BAD_HANDLE);

  p_ccb->cfg = *p_cfg;

  if (p_ccb->con_state == GAP_CCB_STATE_CONNECTED)
    L2CA_ConfigReq(p_ccb->connection_id, p_cfg);

  return (BT_PASS);
}

/*******************************************************************************
 *
 * Function         GAP_ConnSetIdleTimeout
 *
 * Description      Higher layers call this function to set the idle timeout for
 *                  a connection, or for all future connections. The "idle
 *                  timeout" is the amount of time that a connection can remain
 *                  up with no L2CAP channels on it. A timeout of zero means
 *                  that the connection will be torn down immediately when the
 *                  last channel is removed. A timeout of 0xFFFF means no
 *                  timeout. Values are in seconds.
 *
 * Parameters:      handle      - Handle of the connection
 *                  timeout     - in secs
 *                                0 = immediate disconnect when last channel is
 *                                    removed
 *                                0xFFFF = no idle timeout
 *
 * Returns          BT_PASS                 - config process started
 *                  GAP_ERR_BAD_HANDLE      - invalid handle
 *
 ******************************************************************************/
uint16_t GAP_ConnSetIdleTimeout(uint16_t gap_handle, uint16_t timeout) {
  tGAP_CCB* p_ccb;

  p_ccb = gap_find_ccb_by_handle(gap_handle);
  if (p_ccb == NULL) return (GAP_ERR_BAD_HANDLE);

  if (L2CA_SetIdleTimeout(p_ccb->connection_id, timeout, false))
    return (BT_PASS);
  else
    return (GAP_ERR_BAD_HANDLE);
}

/*******************************************************************************
 *
 * Function         GAP_ConnGetRemoteAddr
+0 −110
Original line number Diff line number Diff line
@@ -28,50 +28,15 @@
 *  Constants
 ****************************************************************************/
/*** GAP Error and Status Codes ***/
/* Unsupported call */
#define GAP_UNSUPPORTED (GAP_ERR_GRP + 0x01)
/* End of inquiry database marker */
#define GAP_EOINQDB (GAP_ERR_GRP + 0x02)
/* The requested function was busy */
#define GAP_ERR_BUSY (GAP_ERR_GRP + 0x03)
/* No control blocks available */
#define GAP_ERR_NO_CTRL_BLK (GAP_ERR_GRP + 0x04)
/* Error occurred while initiating the command */
#define GAP_ERR_STARTING_CMD (GAP_ERR_GRP + 0x05)
/* No Inquiry DB record for BD_ADDR */
#define GAP_NO_BDADDR_REC (GAP_ERR_GRP + 0x06)
/* An illegal mode parameter was detected */
#define GAP_ERR_ILL_MODE (GAP_ERR_GRP + 0x07)
/* An illegal time parameter was detected */
#define GAP_ERR_ILL_INQ_TIME (GAP_ERR_GRP + 0x08)
/* An illegal parameter was detected */
#define GAP_ERR_ILL_PARM (GAP_ERR_GRP + 0x09)
/* Error starting the remote device name request */
#define GAP_ERR_REM_NAME (GAP_ERR_GRP + 0x0a)
/* The GAP command was started (result pending) */
#define GAP_CMD_INITIATED (GAP_ERR_GRP + 0x0b)
/* The device was not up; the request was not executed */
#define GAP_DEVICE_NOT_UP (GAP_ERR_GRP + 0x0c)
/* The bd addr passed in was not found or invalid */
#define GAP_BAD_BD_ADDR (GAP_ERR_GRP + 0x0d)

/* Bad GAP handle */
#define GAP_ERR_BAD_HANDLE (GAP_ERR_GRP + 0x0e)
/* Buffer offset invalid */
#define GAP_ERR_BUF_OFFSET (GAP_ERR_GRP + 0x0f)
/* Connection is in invalid state */
#define GAP_ERR_BAD_STATE (GAP_ERR_GRP + 0x10)
/* No data available */
#define GAP_NO_DATA_AVAIL (GAP_ERR_GRP + 0x11)
/* BT stack is congested */
#define GAP_ERR_CONGESTED (GAP_ERR_GRP + 0x12)
/* Security failed */
#define GAP_ERR_SECURITY (GAP_ERR_GRP + 0x13)

/* General error processing BTM request */
#define GAP_ERR_PROCESSING (GAP_ERR_GRP + 0x14)
/* Timeout occurred while processing cmd */
#define GAP_ERR_TIMEOUT (GAP_ERR_GRP + 0x15)
#define GAP_EVT_CONN_OPENED 0x0100
#define GAP_EVT_CONN_CLOSED 0x0101
#define GAP_EVT_CONN_DATA_AVAIL 0x0102
@@ -87,9 +52,6 @@
/*** used in connection variables and functions ***/
#define GAP_INVALID_HANDLE 0xFFFF

/* This is used to change the criteria for AMP */
#define GAP_PROTOCOL_ID (UUID_PROTOCOL_UDP)

#ifndef GAP_PREFER_CONN_INT_MAX
#define GAP_PREFER_CONN_INT_MAX BTM_BLE_CONN_INT_MIN
#endif
@@ -107,7 +69,6 @@
#endif

struct tGAP_COC_CREDITS {
  uint16_t gap_handle;
  uint16_t credits_received;
  uint16_t credit_count;
};
@@ -125,19 +86,6 @@ union tGAP_CB_DATA {
typedef void(tGAP_CONN_CALLBACK)(uint16_t gap_handle, uint16_t event,
                                 tGAP_CB_DATA* data);

/*
 * Define the callback function prototypes.  Parameters are specific
 * to each event and are described below
*/
typedef void(tGAP_CALLBACK)(uint16_t event, void* p_data);

/* Definition of the GAP_FindAddrByName results structure */
typedef struct {
  uint16_t status;
  RawAddress bd_addr;
  tBTM_BD_NAME devname;
} tGAP_FINDADDR_RESULTS;

typedef struct {
  uint16_t int_min;
  uint16_t int_max;
@@ -222,21 +170,6 @@ extern uint16_t GAP_ConnReadData(uint16_t gap_handle, uint8_t* p_data,
 ******************************************************************************/
extern int GAP_GetRxQueueCnt(uint16_t handle, uint32_t* p_rx_queue_count);

/*******************************************************************************
 *
 * Function         GAP_ConnBTRead
 *
 * Description      GKI buffer aware applications will call this function after
 *                  receiving an GAP_EVT_RXDATA event to process the incoming
 *                  data buffer.
 *
 * Returns          BT_PASS             - data read
 *                  GAP_ERR_BAD_HANDLE  - invalid handle
 *                  GAP_NO_DATA_AVAIL   - no data available
 *
 ******************************************************************************/
extern uint16_t GAP_ConnBTRead(uint16_t gap_handle, BT_HDR** pp_buf);

/*******************************************************************************
 *
 * Function         GAP_ConnWriteData
@@ -253,37 +186,6 @@ extern uint16_t GAP_ConnBTRead(uint16_t gap_handle, BT_HDR** pp_buf);
 ******************************************************************************/
extern uint16_t GAP_ConnWriteData(uint16_t gap_handle, BT_HDR* msg);

/*******************************************************************************
 *
 * Function         GAP_ConnReconfig
 *
 * Description      Applications can call this function to reconfigure the
 *                  connection.
 *
 * Returns          BT_PASS                 - config process started
 *                  GAP_ERR_BAD_HANDLE      - invalid handle
 *
 ******************************************************************************/
extern uint16_t GAP_ConnReconfig(uint16_t gap_handle, tL2CAP_CFG_INFO* p_cfg);

/*******************************************************************************
 *
 * Function         GAP_ConnSetIdleTimeout
 *
 * Description      Higher layers call this function to set the idle timeout for
 *                  a connection, or for all future connections. The "idle
 *                  timeout" is the amount of time that a connection can remain
 *                  up with no L2CAP channels on it. A timeout of zero means
 *                  that the connection will be torn down immediately when the
 *                  last channel is removed. A timeout of 0xFFFF means no
 *                  timeout. Values are in seconds.
 *
 * Returns          BT_PASS                 - config process started
 *                  GAP_ERR_BAD_HANDLE      - invalid handle
 *
 ******************************************************************************/
extern uint16_t GAP_ConnSetIdleTimeout(uint16_t gap_handle, uint16_t timeout);

/*******************************************************************************
 *
 * Function         GAP_ConnGetRemoteAddr
@@ -373,18 +275,6 @@ extern bool GAP_BleReadPeerPrefConnParams(const RawAddress& peer_bda);
extern bool GAP_BleReadPeerDevName(const RawAddress& peer_bda,
                                   tGAP_BLE_CMPL_CBACK* p_cback);

/*******************************************************************************
 *
 * Function         GAP_BleReadPeerAddressResolutionCap
 *
 * Description      Start a process to read peer address resolution capability
 *
 * Returns          true if request accepted
 *
 ******************************************************************************/
extern bool GAP_BleReadPeerAddressResolutionCap(const RawAddress& peer_bda,
                                                tGAP_BLE_CMPL_CBACK* p_cback);

/*******************************************************************************
 *
 * Function         GAP_BleCancelReadPeerDevName