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

Commit 3cf334d1 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 6091606 from fd3255e6 to rvc-release

Change-Id: Ic74dfe88a44b7ae85be4fe13f8971b0bef3b7cf3
parents ead874a0 fd3255e6
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@
#include <cstddef>
#include <cstdint>
#include <cstring>
#include <mutex>

#include "main/shim/btm.h"
#include "main/shim/controller.h"
@@ -71,6 +72,7 @@ extern void btm_api_process_extended_inquiry_result(

void bluetooth::shim::Btm::StartUp(bluetooth::shim::Btm* btm) {
  CHECK(btm != nullptr);
  std::unique_lock<std::mutex> lock(btm->sync_mutex_);
  CHECK(btm->observing_timer_ == nullptr);
  CHECK(btm->scanning_timer_ == nullptr);
  btm->observing_timer_ = new bluetooth::shim::Timer("observing_timer");
@@ -79,10 +81,13 @@ void bluetooth::shim::Btm::StartUp(bluetooth::shim::Btm* btm) {

void bluetooth::shim::Btm::ShutDown(bluetooth::shim::Btm* btm) {
  CHECK(btm != nullptr);
  std::unique_lock<std::mutex> lock(btm->sync_mutex_);
  CHECK(btm->observing_timer_ != nullptr);
  CHECK(btm->scanning_timer_ != nullptr);
  delete btm->scanning_timer_;
  delete btm->observing_timer_;
  btm->scanning_timer_ = nullptr;
  btm->observing_timer_ = nullptr;
}

void bluetooth::shim::Btm::OnInquiryResult(std::string string_address,
+2 −0
Original line number Diff line number Diff line
@@ -243,6 +243,8 @@ class Btm {
  Timer* observing_timer_{nullptr};
  Timer* scanning_timer_{nullptr};

  std::mutex sync_mutex_;

  LegacyInquiryCompleteCallback legacy_inquiry_complete_callback_{};

  uint8_t active_inquiry_mode_ = 0;
+0 −227
Original line number Diff line number Diff line
@@ -35,47 +35,27 @@
 * set settings request, or to the application in the set settings indication.
*/
typedef struct {
#define PORT_BAUD_RATE_2400 0x00
#define PORT_BAUD_RATE_4800 0x01
#define PORT_BAUD_RATE_7200 0x02
#define PORT_BAUD_RATE_9600 0x03
#define PORT_BAUD_RATE_19200 0x04
#define PORT_BAUD_RATE_38400 0x05
#define PORT_BAUD_RATE_57600 0x06
#define PORT_BAUD_RATE_115200 0x07
#define PORT_BAUD_RATE_230400 0x08

  uint8_t baud_rate;

#define PORT_5_BITS 0x00
#define PORT_6_BITS 0x01
#define PORT_7_BITS 0x02
#define PORT_8_BITS 0x03

  uint8_t byte_size;

#define PORT_ONESTOPBIT 0x00
#define PORT_ONE5STOPBITS 0x01
  uint8_t stop_bits;

#define PORT_PARITY_NO 0x00
#define PORT_PARITY_YES 0x01
  uint8_t parity;

#define PORT_ODD_PARITY 0x00
#define PORT_EVEN_PARITY 0x01
#define PORT_MARK_PARITY 0x02
#define PORT_SPACE_PARITY 0x03

  uint8_t parity_type;

#define PORT_FC_OFF 0x00
#define PORT_FC_XONXOFF_ON_INPUT 0x01
#define PORT_FC_XONXOFF_ON_OUTPUT 0x02
#define PORT_FC_CTS_ON_INPUT 0x04
#define PORT_FC_CTS_ON_OUTPUT 0x08
#define PORT_FC_DSR_ON_INPUT 0x10
#define PORT_FC_DSR_ON_OUTPUT 0x20

  uint8_t fc_type;

@@ -132,18 +112,6 @@ typedef void(tPORT_CALLBACK)(uint32_t code, uint16_t port_handle);
/* data flow enable status true = enabled */
#define PORT_EV_FCS 0x00020000

/*
 * To register for events application should provide bitmask with
 * corresponding bit set
*/

#define PORT_MASK_ALL                                                  \
  (PORT_EV_RXCHAR | PORT_EV_TXEMPTY | PORT_EV_CTS | PORT_EV_DSR |      \
   PORT_EV_RLSD | PORT_EV_BREAK | PORT_EV_ERR | PORT_EV_RING |         \
   PORT_EV_CONNECT_ERR | PORT_EV_DSRS | PORT_EV_CTSS | PORT_EV_RLSDS | \
   PORT_EV_RXFLAG | PORT_EV_TXCHAR | PORT_EV_OVERRUN | PORT_EV_FC |    \
   PORT_EV_FCS | PORT_EV_CONNECTED)

/*
 * Define port result codes
*/
@@ -267,21 +235,6 @@ extern int PORT_SetEventCallback(uint16_t port_handle,
 ******************************************************************************/
int PORT_ClearKeepHandleFlag(uint16_t port_handle);

/*******************************************************************************
 *
 * Function         PORT_SetEventCallback
 *
 * Description      Set event data callback the specified connection.
 *
 * Parameters:      handle       - Handle of the port returned in the Open
 *                  p_callback   - address of the callback function which should
 *                                 be called from the RFCOMM when a data
 *                                 packet is received.
 *
 ******************************************************************************/
extern int PORT_SetDataCallback(uint16_t port_handle,
                                tPORT_DATA_CALLBACK* p_cb);

extern int PORT_SetDataCOCallback(uint16_t port_handle,
                                  tPORT_DATA_CO_CALLBACK* p_port_cb);
/*******************************************************************************
@@ -339,18 +292,6 @@ extern bool PORT_IsOpening(RawAddress* bd_addr);
 ******************************************************************************/
extern int PORT_SetState(uint16_t handle, tPORT_STATE* p_settings);

/*******************************************************************************
 *
 * Function         PORT_GetRxQueueCnt
 *
 * Description      This function return number of buffers on the rx queue.
 *
 * Parameters:      handle     - Handle returned in the RFCOMM_CreateConnection
 *                  p_rx_queue_count - Pointer to return queue count in.
 *
 ******************************************************************************/
extern int PORT_GetRxQueueCnt(uint16_t handle, uint16_t* p_rx_queue_count);

/*******************************************************************************
 *
 * Function         PORT_GetState
@@ -365,43 +306,6 @@ extern int PORT_GetRxQueueCnt(uint16_t handle, uint16_t* p_rx_queue_count);
 ******************************************************************************/
extern int PORT_GetState(uint16_t handle, tPORT_STATE* p_settings);

/*******************************************************************************
 *
 * Function         PORT_Control
 *
 * Description      This function directs a specified connection to pass control
 *                  control information to the peer device.
 *
 * Parameters:      handle     - Handle returned in the RFCOMM_CreateConnection
 *                  signal     - specify the function to be passed
 *
 ******************************************************************************/
#define PORT_SET_DTRDSR 0x01
#define PORT_CLR_DTRDSR 0x02
#define PORT_SET_CTSRTS 0x03
#define PORT_CLR_CTSRTS 0x04
#define PORT_SET_RI 0x05  /* DCE only */
#define PORT_CLR_RI 0x06  /* DCE only */
#define PORT_SET_DCD 0x07 /* DCE only */
#define PORT_CLR_DCD 0x08 /* DCE only */
#define PORT_BREAK 0x09   /* Break event */

extern int PORT_Control(uint16_t handle, uint8_t signal);

/*******************************************************************************
 *
 * Function         PORT_FlowControl
 *
 * Description      This function directs a specified connection to pass
 *                  flow control message to the peer device.  Enable flag passed
 *                  shows if port can accept more data.
 *
 * Parameters:      handle     - Handle returned in the RFCOMM_CreateConnection
 *                  enable     - enables data flow
 *
 ******************************************************************************/
extern int PORT_FlowControl(uint16_t handle, bool enable);

/*******************************************************************************
 *
 * Function         PORT_FlowControl_MaxCredit
@@ -417,20 +321,6 @@ extern int PORT_FlowControl(uint16_t handle, bool enable);
 ******************************************************************************/
extern int PORT_FlowControl_MaxCredit(uint16_t handle, bool enable);

/*******************************************************************************
 *
 * Function         PORT_GetModemStatus
 *
 * Description      This function retrieves modem control signals.  Normally
 *                  application will call this function after a callback
 *                  function is called with notification that one of signals
 *                  has been changed.
 *
 * Parameters:      handle     - Handle returned in the RFCOMM_CreateConnection
 *                               callback.
 *                  p_signal   - specify the pointer to control signals info
 *
 ******************************************************************************/
#define PORT_DTRDSR_ON 0x01
#define PORT_CTSRTS_ON 0x02
#define PORT_RING_ON 0x04
@@ -447,103 +337,12 @@ extern int PORT_FlowControl_MaxCredit(uint16_t handle, bool enable);
  (PORT_DTRDSR_ON | PORT_CTSRTS_ON | PORT_DCD_ON)
#define PORT_DUN_DEFAULT_SIGNAL_STATE (PORT_DTRDSR_ON | PORT_CTSRTS_ON)

extern int PORT_GetModemStatus(uint16_t handle, uint8_t* p_control_signal);

/*******************************************************************************
 *
 * Function         PORT_ClearError
 *
 * Description      This function retreives information about a communications
 *                  error and reports current status of a connection.  The
 *                  function should be called when an error occures to clear
 *                  the connection error flag and to enable additional read
 *                  and write operations.
 *
 * Parameters:      handle     - Handle returned in the RFCOMM_CreateConnection
 *                  p_errors   - pointer of the variable to receive error codes
 *                  p_status   - pointer to the tPORT_STATUS structur to receive
 *                               connection status
 *
 ******************************************************************************/

#define PORT_ERR_BREAK 0x01   /* Break condition occured on the peer device */
#define PORT_ERR_OVERRUN 0x02 /* Overrun is reported by peer device */
#define PORT_ERR_FRAME 0x04   /* Framing error reported by peer device */
#define PORT_ERR_RXOVER 0x08  /* Input queue overflow occured */
#define PORT_ERR_TXFULL 0x10  /* Output queue overflow occured */

typedef struct {
#define PORT_FLAG_CTS_HOLD 0x01  /* Tx is waiting for CTS signal */
#define PORT_FLAG_DSR_HOLD 0x02  /* Tx is waiting for DSR signal */
#define PORT_FLAG_RLSD_HOLD 0x04 /* Tx is waiting for RLSD signal */

  uint16_t flags;
  uint16_t in_queue_size;  /* Number of bytes in the input queue */
  uint16_t out_queue_size; /* Number of bytes in the output queue */
  uint16_t mtu_size;       /* peer MTU size */
} tPORT_STATUS;

extern int PORT_ClearError(uint16_t handle, uint16_t* p_errors,
                           tPORT_STATUS* p_status);

/*******************************************************************************
 *
 * Function         PORT_SendError
 *
 * Description      This function send a communications error to the peer device
 *
 * Parameters:      handle     - Handle returned in the RFCOMM_CreateConnection
 *                  errors     - receive error codes
 *
 ******************************************************************************/
extern int PORT_SendError(uint16_t handle, uint8_t errors);

/*******************************************************************************
 *
 * Function         PORT_GetQueueStatus
 *
 * Description      This function reports current status of a connection.
 *
 * Parameters:      handle     - Handle returned in the RFCOMM_CreateConnection
 *                  p_status   - pointer to the tPORT_STATUS structur to receive
 *                               connection status
 *
 ******************************************************************************/
extern int PORT_GetQueueStatus(uint16_t handle, tPORT_STATUS* p_status);

/*******************************************************************************
 *
 * Function         PORT_Purge
 *
 * Description      This function discards all the data from the output or
 *                  input queues of the specified connection.
 *
 * Parameters:      handle     - Handle returned in the RFCOMM_CreateConnection
 *                  purge_flags - specify the action to take.
 *
 ******************************************************************************/
#define PORT_PURGE_TXCLEAR 0x01
#define PORT_PURGE_RXCLEAR 0x02

extern int PORT_Purge(uint16_t handle, uint8_t purge_flags);

/*******************************************************************************
 *
 * Function         PORT_Read
 *
 * Description      This function returns the pointer to the buffer received
 *                  from the peer device.  Normally application will call this
 *                  function after receiving PORT_EVT_RXCHAR event.
 *                  Application calling this function is responsible to free
 *                  buffer returned.
 *
 * Parameters:      handle     - Handle returned in the RFCOMM_CreateConnection
 *                                callback.
 *                  pp_buf      - pointer to address of buffer with data,
 *
 ******************************************************************************/
extern int PORT_Read(uint16_t handle, BT_HDR** pp_buf);

/*******************************************************************************
 *
 * Function         PORT_ReadData
@@ -561,19 +360,6 @@ extern int PORT_Read(uint16_t handle, BT_HDR** pp_buf);
extern int PORT_ReadData(uint16_t handle, char* p_data, uint16_t max_len,
                         uint16_t* p_len);

/*******************************************************************************
 *
 * Function         PORT_Write
 *
 * Description      This function to send BT buffer to the peer device.
 *                  Application should not free the buffer.
 *
 * Parameters:      handle     - Handle returned in the RFCOMM_CreateConnection
 *                  p_buf       - pointer to the buffer with data,
 *
 ******************************************************************************/
extern int PORT_Write(uint16_t handle, BT_HDR* p_buf);

/*******************************************************************************
 *
 * Function         PORT_WriteData
@@ -602,19 +388,6 @@ extern int PORT_WriteData(uint16_t handle, const char* p_data, uint16_t max_len,
 ******************************************************************************/
extern int PORT_WriteDataCO(uint16_t handle, int* p_len);

/*******************************************************************************
 *
 * Function         PORT_Test
 *
 * Description      Application can call this function to send RFCOMM Test frame
 *
 * Parameters:      handle      - Handle returned in the RFCOMM_CreateConnection
 *                  p_data      - Data area
 *                  max_len     - Byte count requested
 *
 ******************************************************************************/
extern int PORT_Test(uint16_t handle, uint8_t* p_data, uint16_t len);

/*******************************************************************************
 *
 * Function         RFCOMM_Init
+0 −47
Original line number Diff line number Diff line
@@ -83,9 +83,6 @@ typedef union {
  tSDP_DR_DATA data;
} tSDP_DATA;

/* Define a callback function for when discovery result is received. */
typedef void(tSDP_DISC_RES_CB)(uint16_t event, tSDP_DATA* p_data);

/* Define a structure to hold the discovered service information. */
typedef struct {
  union {
@@ -238,21 +235,6 @@ bool SDP_ServiceSearchAttributeRequest2(const RawAddress& p_bd_addr,

/* API of utilities to find data in the local discovery database */

/*******************************************************************************
 *
 * Function         SDP_FindAttributeInDb
 *
 * Description      This function queries an SDP database for a specific
 *                  attribute. If the p_start_rec pointer is NULL, it looks from
 *                  the beginning of the database, else it continues from the
 *                  next record after p_start_rec.
 *
 * Returns          Pointer to matching record, or NULL
 *
 ******************************************************************************/
tSDP_DISC_REC* SDP_FindAttributeInDb(tSDP_DISCOVERY_DB* p_db, uint16_t attr_id,
                                     tSDP_DISC_REC* p_start_rec);

/*******************************************************************************
 *
 * Function         SDP_FindAttributeInRec
@@ -346,20 +328,6 @@ tSDP_DISC_REC* SDP_FindServiceInDb_128bit(tSDP_DISCOVERY_DB* p_db,
bool SDP_FindProtocolListElemInRec(tSDP_DISC_REC* p_rec, uint16_t layer_uuid,
                                   tSDP_PROTOCOL_ELEM* p_elem);

/*******************************************************************************
 *
 * Function         SDP_FindAddProtoListsElemInRec
 *
 * Description      This function looks at a specific discovery record for a
 *                  protocol list element.
 *
 * Returns          true if found, false if not
 *                  If found, the passed protocol list element is filled in.
 *
 ******************************************************************************/
bool SDP_FindAddProtoListsElemInRec(tSDP_DISC_REC* p_rec, uint16_t layer_uuid,
                                    tSDP_PROTOCOL_ELEM* p_elem);

/*******************************************************************************
 *
 * Function         SDP_FindProfileVersionInRec
@@ -408,21 +376,6 @@ uint32_t SDP_CreateRecord(void);
 ******************************************************************************/
bool SDP_DeleteRecord(uint32_t handle);

/*******************************************************************************
 *
 * Function         SDP_ReadRecord
 *
 * Description      This function is called to get the raw data of the record
 *                  with the given handle from the database.
 *
 * Returns          -1, if the record is not found.
 *                  Otherwise, the offset (0 or 1) to start of data in p_data.
 *
 *                  The size of data copied into p_data is in *p_data_len.
 *
 ******************************************************************************/
int32_t SDP_ReadRecord(uint32_t handle, uint8_t* p_data, int32_t* p_data_len);

/*******************************************************************************
 *
 * Function         SDP_AddAttribute
+0 −603

File changed.

Preview size limit exceeded, changes collapsed.

Loading