forked from espressif/arduino-esp32
Update IDF to 1c3dd23
* Update mDNS and LEDC * update toolchain * Update IDF to 1c3dd23 * Advertise the board variant for Arduino OTA * Add generic variant definition for mDNS
This commit is contained in:
@ -57,6 +57,9 @@ void osi_alarm_free(osi_alarm_t *alarm);
|
||||
// |alarm| and |cb| may not be NULL.
|
||||
osi_alarm_err_t osi_alarm_set(osi_alarm_t *alarm, period_ms_t timeout);
|
||||
|
||||
// Sets an periodic alarm to fire |cb| each given |period|.
|
||||
osi_alarm_err_t osi_alarm_set_periodic(osi_alarm_t *alarm, period_ms_t period);
|
||||
|
||||
// This function cancels the |alarm| if it was previously set. When this call
|
||||
// returns, the caller has a guarantee that the callback is not in progress and
|
||||
// will not be called if it hasn't already been called. This function is idempotent.
|
||||
@ -65,6 +68,7 @@ osi_alarm_err_t osi_alarm_cancel(osi_alarm_t *alarm);
|
||||
|
||||
// Figure out how much time until next expiration.
|
||||
// Returns 0 if not armed. |alarm| may not be NULL.
|
||||
// only for oneshot alarm, not for periodic alarm
|
||||
// TODO: Remove this function once PM timers can be re-factored
|
||||
period_ms_t osi_alarm_get_remaining_ms(const osi_alarm_t *alarm);
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
#define __BLUFI_INT_H__
|
||||
|
||||
#define BTC_BLUFI_GREAT_VER 0x01 //Version + Subversion
|
||||
#define BTC_BLUFI_SUB_VER 0x00 //Version + Subversion
|
||||
#define BTC_BLUFI_SUB_VER 0x01 //Version + Subversion
|
||||
#define BTC_BLUFI_VERSION ((BTC_BLUFI_GREAT_VER<<8)|BTC_BLUFI_SUB_VER) //Version + Subversion
|
||||
|
||||
/* service engine control block */
|
||||
@ -93,6 +93,7 @@ typedef struct blufi_frag_hdr blufi_frag_hdr_t;
|
||||
#define BLUFI_TYPE_CTRL_SUBTYPE_DEAUTHENTICATE_STA 0x06
|
||||
#define BLUFI_TYPE_CTRL_SUBTYPE_GET_VERSION 0x07
|
||||
#define BLUFI_TYPE_CTRL_SUBTYPE_DISCONNECT_BLE 0x08
|
||||
#define BLUFI_TYPE_CTRL_SUBTYPE_GET_WIFI_LIST 0x09
|
||||
|
||||
#define BLUFI_TYPE_DATA 0x1
|
||||
#define BLUFI_TYPE_DATA_SUBTYPE_NEG 0x00
|
||||
@ -111,7 +112,8 @@ typedef struct blufi_frag_hdr blufi_frag_hdr_t;
|
||||
#define BLUFI_TYPE_DATA_SUBTYPE_CLIENT_PRIV_KEY 0x0d
|
||||
#define BLUFI_TYPE_DATA_SUBTYPE_SERVER_PRIV_KEY 0x0e
|
||||
#define BLUFI_TYPE_DATA_SUBTYPE_WIFI_REP 0x0f
|
||||
#define BLUFI_TYPE_DATA_SUBTYPE_REPLY_VERSION 0x10
|
||||
#define BLUFI_TYPE_DATA_SUBTYPE_REPLY_VERSION 0x10
|
||||
#define BLUFI_TYPE_DATA_SUBTYPE_WIFI_LIST 0x11
|
||||
#define BLUFI_TYPE_IS_CTRL(type) (BLUFI_GET_TYPE((type)) == BLUFI_TYPE_CTRL)
|
||||
#define BLUFI_TYPE_IS_DATA(type) (BLUFI_GET_TYPE((type)) == BLUFI_TYPE_DATA)
|
||||
|
||||
|
@ -90,6 +90,7 @@ typedef enum {
|
||||
BT_STATUS_UNACCEPT_CONN_INTERVAL,
|
||||
BT_STATUS_PARAM_OUT_OF_RANGE,
|
||||
BT_STATUS_TIMEOUT,
|
||||
BT_STATUS_MEMORY_FULL,
|
||||
} bt_status_t;
|
||||
|
||||
#ifndef CPU_LITTLE_ENDIAN
|
||||
|
@ -39,56 +39,57 @@
|
||||
|
||||
#include "dyn_mem.h" /* defines static and/or dynamic memory for components */
|
||||
|
||||
/******************************************************************************
|
||||
**
|
||||
** Classic BT features
|
||||
**
|
||||
******************************************************************************/
|
||||
#if CONFIG_CLASSIC_BT_ENABLED
|
||||
#define CLASSIC_BT_INCLUDED TRUE
|
||||
#define BTC_SM_INCLUDED TRUE
|
||||
#define BTC_PRF_QUEUE_INCLUDED TRUE
|
||||
#define BTC_GAP_BT_INCLUDED TRUE
|
||||
#define BTA_SDP_INCLUDED TRUE
|
||||
#define BTA_PAN_INCLUDED FALSE
|
||||
#define BTA_HH_INCLUDED FALSE
|
||||
#define SDP_INCLUDED TRUE
|
||||
|
||||
#if CONFIG_A2DP_ENABLE
|
||||
#define BTA_AR_INCLUDED TRUE
|
||||
#define BTA_AV_INCLUDED TRUE
|
||||
#define BTA_AV_SINK_INCLUDED TRUE
|
||||
#define SDP_INCLUDED TRUE
|
||||
#define RFCOMM_INCLUDED FALSE
|
||||
#define PAN_INCLUDED FALSE
|
||||
#define HID_HOST_INCLUDED FALSE
|
||||
#define AVDT_INCLUDED TRUE
|
||||
#define A2D_INCLUDED TRUE
|
||||
#define AVCT_INCLUDED TRUE
|
||||
#define AVRC_INCLUDED TRUE
|
||||
#define SBC_DEC_INCLUDED TRUE
|
||||
#define SBC_ENC_INCLUDED FALSE
|
||||
#define MCA_INCLUDED FALSE
|
||||
#define BTC_SM_INCLUDED TRUE
|
||||
#define BTC_PRF_QUEUE_INCLUDED TRUE
|
||||
#define BTC_GAP_BT_INCLUDED TRUE
|
||||
#define BTC_AV_INCLUDED TRUE
|
||||
#endif /* CONFIG_A2DP_ENABLE */
|
||||
|
||||
#else /* #if CONFIG_CLASSIC_BT_ENABLED */
|
||||
#define CLASSIC_BT_INCLUDED FALSE
|
||||
#define BTA_SDP_INCLUDED FALSE
|
||||
#define BTA_PAN_INCLUDED FALSE
|
||||
#define BTA_HH_INCLUDED FALSE
|
||||
#define BTA_AR_INCLUDED FALSE
|
||||
#define BTA_AV_INCLUDED FALSE
|
||||
#define BTA_AV_SINK_INCLUDED FALSE
|
||||
#define SDP_INCLUDED FALSE
|
||||
#define RFCOMM_INCLUDED FALSE
|
||||
#define PAN_INCLUDED FALSE
|
||||
#define HID_HOST_INCLUDED FALSE
|
||||
#define AVDT_INCLUDED FALSE
|
||||
#define A2D_INCLUDED FALSE
|
||||
#define AVCT_INCLUDED FALSE
|
||||
#define AVRC_INCLUDED FALSE
|
||||
#define SBC_DEC_INCLUDED FALSE
|
||||
#define SBC_ENC_INCLUDED FALSE
|
||||
#define MCA_INCLUDED FALSE
|
||||
#define BTC_SM_INCLUDED FALSE
|
||||
#define BTC_PRF_QUEUE_INCLUDED FALSE
|
||||
#define BTC_GAP_BT_INCLUDED FALSE
|
||||
#define BTC_AV_INCLUDED FALSE
|
||||
#if CONFIG_A2DP_SINK_ENABLE
|
||||
#define BTA_AV_SINK_INCLUDED TRUE
|
||||
#define BTC_AV_SINK_INCLUDED TRUE
|
||||
#define SBC_DEC_INCLUDED TRUE
|
||||
#endif /* CONFIG_A2DP_SINK_ENABLE */
|
||||
|
||||
#if CONFIG_A2DP_SRC_ENABLE
|
||||
#define BTC_AV_SRC_INCLUDED TRUE
|
||||
#define SBC_ENC_INCLUDED TRUE
|
||||
#endif /* CONFIG_A2DP_SRC_ENABLE */
|
||||
|
||||
#if CONFIG_BT_SPP_ENABLED
|
||||
#define RFCOMM_INCLUDED TRUE
|
||||
#define BTA_JV_INCLUDED TRUE
|
||||
#define BTC_SPP_INCLUDED TRUE
|
||||
#endif /* CONFIG_BT_SPP_ENABLED */
|
||||
|
||||
#endif /* #if CONFIG_CLASSIC_BT_ENABLED */
|
||||
|
||||
#ifndef CLASSIC_BT_INCLUDED
|
||||
#define CLASSIC_BT_INCLUDED FALSE
|
||||
#endif /* CLASSIC_BT_INCLUDED */
|
||||
|
||||
/******************************************************************************
|
||||
**
|
||||
** BLE features
|
||||
**
|
||||
******************************************************************************/
|
||||
#if (CONFIG_GATTS_ENABLE)
|
||||
#define GATTS_INCLUDED TRUE
|
||||
#else
|
||||
@ -139,16 +140,62 @@
|
||||
#define BTIF_INCLUDED FALSE
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
**
|
||||
** BTC-layer components
|
||||
**
|
||||
******************************************************************************/
|
||||
#ifndef BTC_GAP_BT_INCLUDED
|
||||
#define BTC_GAP_BT_INCLUDED FALSE
|
||||
#endif
|
||||
|
||||
#ifndef BTC_PRF_QUEUE_INCLUDED
|
||||
#define BTC_PRF_QUEUE_INCLUDED FALSE
|
||||
#endif
|
||||
|
||||
#ifndef BTC_SM_INCLUDED
|
||||
#define BTC_SM_INCLUDED FALSE
|
||||
#endif
|
||||
|
||||
#ifndef BTC_AV_INCLUDED
|
||||
#define BTC_AV_INCLUDED FALSE
|
||||
#endif
|
||||
|
||||
#ifndef BTC_AV_SINK_INCLUDED
|
||||
#define BTC_AV_SINK_INCLUDED FALSE
|
||||
#endif
|
||||
|
||||
#ifndef BTC_AV_SRC_INCLUDED
|
||||
#define BTC_AV_SRC_INCLUDED FALSE
|
||||
#endif
|
||||
|
||||
#ifndef BTC_SPP_INCLUDED
|
||||
#define BTC_SPP_INCLUDED FALSE
|
||||
#endif
|
||||
|
||||
#ifndef SBC_DEC_INCLUDED
|
||||
#define SBC_DEC_INCLUDED FALSE
|
||||
#endif
|
||||
|
||||
#ifndef SBC_ENC_INCLUDED
|
||||
#define SBC_ENC_INCLUDED FALSE
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
**
|
||||
** BTA-layer components
|
||||
**
|
||||
******************************************************************************/
|
||||
#ifndef BTA_INCLUDED
|
||||
#define BTA_INCLUDED TRUE
|
||||
#endif
|
||||
|
||||
#ifndef BTA_PAN_INCLUDED
|
||||
#define BTA_PAN_INCLUDED FALSE//TRUE
|
||||
#define BTA_PAN_INCLUDED FALSE
|
||||
#endif
|
||||
|
||||
#ifndef BTA_HH_INCLUDED
|
||||
#define BTA_HH_INCLUDED FALSE//TRUE
|
||||
#define BTA_HH_INCLUDED FALSE
|
||||
#endif
|
||||
|
||||
#ifndef BTA_HH_ROLE
|
||||
@ -156,21 +203,47 @@
|
||||
#endif
|
||||
|
||||
#ifndef BTA_HH_LE_INCLUDED
|
||||
#define BTA_HH_LE_INCLUDED FALSE//TRUE
|
||||
#define BTA_HH_LE_INCLUDED FALSE
|
||||
#endif
|
||||
|
||||
#ifndef BTA_AR_INCLUDED
|
||||
#define BTA_AR_INCLUDED TRUE//TRUE
|
||||
#define BTA_AR_INCLUDED FALSE
|
||||
#endif
|
||||
|
||||
#ifndef BTA_AV_INCLUDED
|
||||
#define BTA_AV_INCLUDED TRUE//TRUE
|
||||
#define BTA_AV_INCLUDED FALSE
|
||||
#endif
|
||||
|
||||
#ifndef BTA_AV_SINK_INCLUDED
|
||||
#define BTA_AV_SINK_INCLUDED TRUE//FALSE
|
||||
#define BTA_AV_SINK_INCLUDED FALSE
|
||||
#endif
|
||||
|
||||
#ifndef BTA_JV_INCLUDED
|
||||
#define BTA_JV_INCLUDED FALSE
|
||||
#endif
|
||||
|
||||
#ifndef BTA_SDP_INCLUDED
|
||||
#define BTA_SDP_INCLUDED FALSE
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
**
|
||||
** Stack-layer components
|
||||
**
|
||||
******************************************************************************/
|
||||
#ifndef AVCT_INCLUDED
|
||||
#define AVCT_INCLUDED FALSE
|
||||
#endif
|
||||
|
||||
#ifndef AVDT_INCLUDED
|
||||
#define AVDT_INCLUDED FALSE
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
**
|
||||
** Parameter Configurations for components
|
||||
**
|
||||
******************************************************************************/
|
||||
#ifndef BTA_DISABLE_DELAY
|
||||
#define BTA_DISABLE_DELAY 200 /* in milliseconds */
|
||||
#endif
|
||||
@ -647,7 +720,8 @@
|
||||
|
||||
/* 4.1/4.2 secure connections feature */
|
||||
#ifndef SC_MODE_INCLUDED
|
||||
#define SC_MODE_INCLUDED TRUE
|
||||
// Disable AES-CCM (BT 4.1) for BT Classic to workaround controller AES issue. E0 encryption (BT 4.0) will be used.
|
||||
#define SC_MODE_INCLUDED FALSE
|
||||
#endif
|
||||
|
||||
/* Used for conformance testing ONLY */
|
||||
@ -1045,7 +1119,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef SDP_INCLUDED
|
||||
#define SDP_INCLUDED FALSE //TRUE
|
||||
#define SDP_INCLUDED FALSE
|
||||
#endif
|
||||
|
||||
/* This is set to enable SDP server functionality. */
|
||||
@ -1432,7 +1506,7 @@ Range: 2 octets
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef PAN_INCLUDED
|
||||
#define PAN_INCLUDED FALSE//TRUE
|
||||
#define PAN_INCLUDED FALSE
|
||||
#endif
|
||||
|
||||
/* This will enable the PANU role */
|
||||
@ -1577,7 +1651,7 @@ Range: 2 octets
|
||||
** Definitions for HID-Host
|
||||
*/
|
||||
#ifndef HID_HOST_INCLUDED
|
||||
#define HID_HOST_INCLUDED FALSE//TRUE
|
||||
#define HID_HOST_INCLUDED FALSE
|
||||
#endif
|
||||
|
||||
#ifndef HID_HOST_MAX_DEVICES
|
||||
@ -1604,7 +1678,7 @@ Range: 2 octets
|
||||
* A2DP Definitions
|
||||
*/
|
||||
#ifndef A2D_INCLUDED
|
||||
#define A2D_INCLUDED FALSE//TRUE
|
||||
#define A2D_INCLUDED FALSE
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
@ -1629,7 +1703,7 @@ Range: 2 octets
|
||||
**
|
||||
******************************************************************************/
|
||||
#ifndef AVRC_INCLUDED
|
||||
#define AVRC_INCLUDED TRUE
|
||||
#define AVRC_INCLUDED FALSE
|
||||
#endif
|
||||
|
||||
#ifndef AVRC_METADATA_INCLUDED
|
||||
|
@ -276,6 +276,7 @@ typedef struct {
|
||||
/********************************************************************************
|
||||
** Macros to get and put bytes to and from a stream (Big Endian format)
|
||||
*/
|
||||
#define UINT64_TO_BE_STREAM(p, u64) {*(p)++ = (UINT8)((u64) >> 56); *(p)++ = (UINT8)((u64) >> 48); *(p)++ = (UINT8)((u64) >> 40); *(p)++ = (UINT8)((u64) >> 32); *(p)++ = (UINT8)((u64) >> 24); *(p)++ = (UINT8)((u64) >> 16); *(p)++ = (UINT8)((u64) >> 8); *(p)++ = (UINT8)(u64); }
|
||||
#define UINT32_TO_BE_STREAM(p, u32) {*(p)++ = (UINT8)((u32) >> 24); *(p)++ = (UINT8)((u32) >> 16); *(p)++ = (UINT8)((u32) >> 8); *(p)++ = (UINT8)(u32); }
|
||||
#define UINT24_TO_BE_STREAM(p, u24) {*(p)++ = (UINT8)((u24) >> 16); *(p)++ = (UINT8)((u24) >> 8); *(p)++ = (UINT8)(u24);}
|
||||
#define UINT16_TO_BE_STREAM(p, u16) {*(p)++ = (UINT8)((u16) >> 8); *(p)++ = (UINT8)(u16);}
|
||||
|
@ -1,46 +0,0 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2009-2012 Broadcom Corporation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at:
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef BT_UTILS_H
|
||||
#define BT_UTILS_H
|
||||
|
||||
// static const char BT_UTILS_MODULE[] = "bt_utils_module";
|
||||
|
||||
/*******************************************************************************
|
||||
** Type definitions
|
||||
********************************************************************************/
|
||||
|
||||
typedef enum {
|
||||
TASK_HIGH_MEDIA = 0,
|
||||
TASK_HIGH_GKI_TIMER,
|
||||
TASK_HIGH_BTU,
|
||||
TASK_HIGH_HCI_WORKER,
|
||||
TASK_HIGH_USERIAL_READ,
|
||||
TASK_UIPC_READ,
|
||||
TASK_JAVA_ALARM,
|
||||
TASK_HIGH_MAX
|
||||
} tHIGH_PRIORITY_TASK;
|
||||
|
||||
/*******************************************************************************
|
||||
** Functions
|
||||
********************************************************************************/
|
||||
|
||||
void raise_priority_a2dp(tHIGH_PRIORITY_TASK high_task);
|
||||
void adjust_priority_a2dp(int start);
|
||||
#define UNUSED(x) (void)(x)
|
||||
#endif /* BT_UTILS_H */
|
@ -400,7 +400,10 @@ typedef struct {
|
||||
|
||||
typedef void (tBTA_SET_ADV_DATA_CMPL_CBACK) (tBTA_STATUS status);
|
||||
|
||||
typedef void (tBTA_START_ADV_CMPL_CBACK) (tBTA_STATUS status);
|
||||
typedef tBTM_START_ADV_CMPL_CBACK tBTA_START_ADV_CMPL_CBACK;
|
||||
|
||||
typedef tBTM_START_STOP_ADV_CMPL_CBACK tBTA_START_STOP_ADV_CMPL_CBACK;
|
||||
|
||||
|
||||
typedef tBTM_ADD_WHITELIST_CBACK tBTA_ADD_WHITELIST_CBACK;
|
||||
|
||||
@ -782,6 +785,7 @@ typedef struct {
|
||||
typedef struct {
|
||||
BD_ADDR bd_addr; /* BD address peer device. */
|
||||
UINT8 status; /* connection open/closed */
|
||||
UINT8 reason; /* link down reason */
|
||||
BOOLEAN is_removed; /* TRUE if device is removed when link is down */
|
||||
#if BLE_INCLUDED == TRUE
|
||||
tBTA_TRANSPORT link_type;
|
||||
|
@ -375,6 +375,7 @@ typedef struct {
|
||||
/* data associated with BTA_AV_RC_OPEN_EVT */
|
||||
typedef struct {
|
||||
UINT8 rc_handle;
|
||||
BOOLEAN sdp_disc_done;
|
||||
tBTA_AV_FEAT peer_features;
|
||||
BD_ADDR peer_addr;
|
||||
tBTA_AV_STATUS status;
|
||||
|
884
tools/sdk/include/bluedroid/bta_jv_api.h
Normal file
884
tools/sdk/include/bluedroid/bta_jv_api.h
Normal file
@ -0,0 +1,884 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2006-2012 Broadcom Corporation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at:
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* This is the public interface file the BTA Java I/F
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef BTA_JV_API_H
|
||||
#define BTA_JV_API_H
|
||||
|
||||
#include "bt_target.h"
|
||||
#include "bt_types.h"
|
||||
#include "bta_api.h"
|
||||
#include "btm_api.h"
|
||||
#include "l2c_api.h"
|
||||
#include "rfcdefs.h"
|
||||
#include "sdp_api.h"
|
||||
|
||||
#if (defined BTA_JV_INCLUDED && BTA_JV_INCLUDED == TRUE)
|
||||
/*****************************************************************************
|
||||
** Constants and data types
|
||||
*****************************************************************************/
|
||||
/* status values */
|
||||
#define BTA_JV_SUCCESS 0 /* Successful operation. */
|
||||
#define BTA_JV_FAILURE 1 /* Generic failure. */
|
||||
#define BTA_JV_BUSY 2 /* Temporarily can not handle this request. */
|
||||
#define BTA_JV_NO_DATA 3 /* no data. */
|
||||
#define BTA_JV_NO_RESOURCE 4 /* No more set pm control block */
|
||||
|
||||
typedef UINT8 tBTA_JV_STATUS;
|
||||
#define BTA_JV_INTERNAL_ERR (-1) /* internal error. */
|
||||
|
||||
#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 */
|
||||
#define BTA_JV_MAX_SCN PORT_MAX_RFC_PORTS /* same as BTM_MAX_SCN (in btm_int.h) */
|
||||
#define BTA_JV_MAX_RFC_CONN MAX_RFC_PORTS
|
||||
|
||||
#ifndef BTA_JV_DEF_RFC_MTU
|
||||
#define BTA_JV_DEF_RFC_MTU (3*330)
|
||||
#endif
|
||||
|
||||
#ifndef BTA_JV_MAX_RFC_SR_SESSION
|
||||
#define BTA_JV_MAX_RFC_SR_SESSION MAX_BD_CONNECTIONS
|
||||
#endif
|
||||
|
||||
/* BTA_JV_MAX_RFC_SR_SESSION can not be bigger than MAX_BD_CONNECTIONS */
|
||||
#if (BTA_JV_MAX_RFC_SR_SESSION > MAX_BD_CONNECTIONS)
|
||||
#undef BTA_JV_MAX_RFC_SR_SESSION
|
||||
#define BTA_JV_MAX_RFC_SR_SESSION MAX_BD_CONNECTIONS
|
||||
#endif
|
||||
|
||||
#define BTA_JV_FIRST_SERVICE_ID BTA_FIRST_JV_SERVICE_ID
|
||||
#define BTA_JV_LAST_SERVICE_ID BTA_LAST_JV_SERVICE_ID
|
||||
#define BTA_JV_NUM_SERVICE_ID (BTA_LAST_JV_SERVICE_ID - BTA_FIRST_JV_SERVICE_ID + 1)
|
||||
|
||||
/* Discoverable modes */
|
||||
enum {
|
||||
BTA_JV_DISC_NONE,
|
||||
BTA_JV_DISC_LIMITED,
|
||||
BTA_JV_DISC_GENERAL
|
||||
};
|
||||
typedef UINT16 tBTA_JV_DISC;
|
||||
|
||||
#define BTA_JV_ROLE_SLAVE BTM_ROLE_SLAVE
|
||||
#define BTA_JV_ROLE_MASTER BTM_ROLE_MASTER
|
||||
typedef UINT32 tBTA_JV_ROLE;
|
||||
|
||||
#define BTA_JV_SERVICE_LMTD_DISCOVER BTM_COD_SERVICE_LMTD_DISCOVER /* 0x0020 */
|
||||
#define BTA_JV_SERVICE_POSITIONING BTM_COD_SERVICE_POSITIONING /* 0x0100 */
|
||||
#define BTA_JV_SERVICE_NETWORKING BTM_COD_SERVICE_NETWORKING /* 0x0200 */
|
||||
#define BTA_JV_SERVICE_RENDERING BTM_COD_SERVICE_RENDERING /* 0x0400 */
|
||||
#define BTA_JV_SERVICE_CAPTURING BTM_COD_SERVICE_CAPTURING /* 0x0800 */
|
||||
#define BTA_JV_SERVICE_OBJ_TRANSFER BTM_COD_SERVICE_OBJ_TRANSFER /* 0x1000 */
|
||||
#define BTA_JV_SERVICE_AUDIO BTM_COD_SERVICE_AUDIO /* 0x2000 */
|
||||
#define BTA_JV_SERVICE_TELEPHONY BTM_COD_SERVICE_TELEPHONY /* 0x4000 */
|
||||
#define BTA_JV_SERVICE_INFORMATION BTM_COD_SERVICE_INFORMATION /* 0x8000 */
|
||||
|
||||
/* JV ID type */
|
||||
#define BTA_JV_PM_ID_1 1 /* PM example profile 1 */
|
||||
#define BTA_JV_PM_ID_2 2 /* PM example profile 2 */
|
||||
#define BTA_JV_PM_ID_CLEAR 0 /* Special JV ID used to clear PM profile */
|
||||
#define BTA_JV_PM_ALL 0xFF /* Generic match all id, see bta_dm_cfg.c */
|
||||
typedef UINT8 tBTA_JV_PM_ID;
|
||||
|
||||
#define BTA_JV_PM_HANDLE_CLEAR 0xFF /* Special JV ID used to clear PM profile */
|
||||
|
||||
/* define maximum number of registered PM entities. should be in sync with bta pm! */
|
||||
#ifndef BTA_JV_PM_MAX_NUM
|
||||
#define BTA_JV_PM_MAX_NUM 5
|
||||
#endif
|
||||
|
||||
/* JV pm connection states */
|
||||
enum {
|
||||
BTA_JV_CONN_OPEN = 0, /* Connection opened state */
|
||||
BTA_JV_CONN_CLOSE, /* Connection closed state */
|
||||
BTA_JV_APP_OPEN, /* JV Application opened state */
|
||||
BTA_JV_APP_CLOSE, /* JV Application closed state */
|
||||
BTA_JV_SCO_OPEN, /* SCO connection opened state */
|
||||
BTA_JV_SCO_CLOSE, /* SCO connection opened state */
|
||||
BTA_JV_CONN_IDLE, /* Connection idle state */
|
||||
BTA_JV_CONN_BUSY, /* Connection busy state */
|
||||
BTA_JV_MAX_CONN_STATE /* Max number of connection state */
|
||||
};
|
||||
typedef UINT8 tBTA_JV_CONN_STATE;
|
||||
|
||||
/* JV Connection types */
|
||||
#define BTA_JV_CONN_TYPE_RFCOMM 0
|
||||
#define BTA_JV_CONN_TYPE_L2CAP 1
|
||||
#define BTA_JV_CONN_TYPE_L2CAP_LE 2
|
||||
|
||||
/* Java I/F callback events */
|
||||
/* events received by tBTA_JV_DM_CBACK */
|
||||
#define BTA_JV_ENABLE_EVT 0 /* JV enabled */
|
||||
#define BTA_JV_GET_SCN_EVT 6 /* Reserved an SCN */
|
||||
#define BTA_JV_GET_PSM_EVT 7 /* Reserved a PSM */
|
||||
#define BTA_JV_DISCOVERY_COMP_EVT 8 /* SDP discovery complete */
|
||||
#define BTA_JV_CREATE_RECORD_EVT 11 /* the result for BTA_JvCreateRecord */
|
||||
/* events received by tBTA_JV_L2CAP_CBACK */
|
||||
#define BTA_JV_L2CAP_OPEN_EVT 16 /* open status of L2CAP connection */
|
||||
#define BTA_JV_L2CAP_CLOSE_EVT 17 /* L2CAP connection closed */
|
||||
#define BTA_JV_L2CAP_START_EVT 18 /* L2CAP server started */
|
||||
#define BTA_JV_L2CAP_CL_INIT_EVT 19 /* L2CAP client initiated a connection */
|
||||
#define BTA_JV_L2CAP_DATA_IND_EVT 20 /* L2CAP connection received data */
|
||||
#define BTA_JV_L2CAP_CONG_EVT 21 /* L2CAP connection congestion status changed */
|
||||
#define BTA_JV_L2CAP_READ_EVT 22 /* the result for BTA_JvL2capRead */
|
||||
#define BTA_JV_L2CAP_RECEIVE_EVT 23 /* the result for BTA_JvL2capReceive*/
|
||||
#define BTA_JV_L2CAP_WRITE_EVT 24 /* the result for BTA_JvL2capWrite*/
|
||||
#define BTA_JV_L2CAP_WRITE_FIXED_EVT 25 /* the result for BTA_JvL2capWriteFixed */
|
||||
|
||||
/* events received by tBTA_JV_RFCOMM_CBACK */
|
||||
#define BTA_JV_RFCOMM_OPEN_EVT 26 /* open status of RFCOMM Client connection */
|
||||
#define BTA_JV_RFCOMM_CLOSE_EVT 27 /* RFCOMM connection closed */
|
||||
#define BTA_JV_RFCOMM_START_EVT 28 /* RFCOMM server started */
|
||||
#define BTA_JV_RFCOMM_CL_INIT_EVT 29 /* RFCOMM client initiated a connection */
|
||||
#define BTA_JV_RFCOMM_DATA_IND_EVT 30 /* RFCOMM connection received data */
|
||||
#define BTA_JV_RFCOMM_CONG_EVT 31 /* RFCOMM connection congestion status changed */
|
||||
#define BTA_JV_RFCOMM_READ_EVT 32 /* the result for BTA_JvRfcommRead */
|
||||
#define BTA_JV_RFCOMM_WRITE_EVT 33 /* the result for BTA_JvRfcommWrite*/
|
||||
#define BTA_JV_RFCOMM_SRV_OPEN_EVT 34 /* open status of Server RFCOMM connection */
|
||||
#define BTA_JV_MAX_EVT 35 /* max number of JV events */
|
||||
|
||||
typedef UINT16 tBTA_JV_EVT;
|
||||
|
||||
/* data associated with BTA_JV_SET_DISCOVER_EVT */
|
||||
typedef struct {
|
||||
tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */
|
||||
tBTA_JV_DISC disc_mode; /* The current discoverable mode */
|
||||
} tBTA_JV_SET_DISCOVER;
|
||||
|
||||
/* data associated with BTA_JV_DISCOVERY_COMP_EVT_ */
|
||||
typedef struct {
|
||||
tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */
|
||||
UINT8 scn_num; /* num of channel */
|
||||
UINT8 scn[BTA_JV_MAX_SCN]; /* channel # */
|
||||
} tBTA_JV_DISCOVERY_COMP;
|
||||
|
||||
/* data associated with BTA_JV_CREATE_RECORD_EVT */
|
||||
typedef struct {
|
||||
tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */
|
||||
UINT32 handle; /* The SDP handle */
|
||||
} tBTA_JV_CREATE_RECORD;
|
||||
|
||||
/* data associated with BTA_JV_L2CAP_OPEN_EVT */
|
||||
typedef struct {
|
||||
tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */
|
||||
UINT32 handle; /* The connection handle */
|
||||
BD_ADDR rem_bda; /* The peer address */
|
||||
INT32 tx_mtu; /* The transmit MTU */
|
||||
} tBTA_JV_L2CAP_OPEN;
|
||||
|
||||
/* data associated with BTA_JV_L2CAP_OPEN_EVT for LE sockets */
|
||||
typedef struct {
|
||||
tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */
|
||||
UINT32 handle; /* The connection handle */
|
||||
BD_ADDR rem_bda; /* The peer address */
|
||||
INT32 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 */
|
||||
typedef struct {
|
||||
tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */
|
||||
UINT32 handle; /* The connection handle */
|
||||
BOOLEAN async; /* FALSE, if local initiates disconnect */
|
||||
} tBTA_JV_L2CAP_CLOSE;
|
||||
|
||||
/* data associated with BTA_JV_L2CAP_START_EVT */
|
||||
typedef struct {
|
||||
tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */
|
||||
UINT32 handle; /* The connection handle */
|
||||
UINT8 sec_id; /* security ID used by this server */
|
||||
} tBTA_JV_L2CAP_START;
|
||||
|
||||
/* data associated with BTA_JV_L2CAP_CL_INIT_EVT */
|
||||
typedef struct {
|
||||
tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */
|
||||
UINT32 handle; /* The connection handle */
|
||||
UINT8 sec_id; /* security ID used by this client */
|
||||
} tBTA_JV_L2CAP_CL_INIT;
|
||||
|
||||
/* data associated with BTA_JV_L2CAP_CONG_EVT */
|
||||
typedef struct {
|
||||
tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */
|
||||
UINT32 handle; /* The connection handle */
|
||||
BOOLEAN cong; /* TRUE, congested. FALSE, uncongested */
|
||||
} tBTA_JV_L2CAP_CONG;
|
||||
|
||||
/* data associated with BTA_JV_L2CAP_READ_EVT */
|
||||
typedef struct {
|
||||
tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */
|
||||
UINT32 handle; /* The connection handle */
|
||||
UINT32 req_id; /* The req_id in the associated BTA_JvL2capRead() */
|
||||
UINT8 *p_data; /* This points the same location as the p_data
|
||||
* parameter in BTA_JvL2capRead () */
|
||||
UINT16 len; /* The length of the data read. */
|
||||
} tBTA_JV_L2CAP_READ;
|
||||
|
||||
/* data associated with BTA_JV_L2CAP_RECEIVE_EVT */
|
||||
typedef struct {
|
||||
tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */
|
||||
UINT32 handle; /* The connection handle */
|
||||
UINT32 req_id; /* The req_id in the associated BTA_JvL2capReceive() */
|
||||
UINT8 *p_data; /* This points the same location as the p_data
|
||||
* parameter in BTA_JvL2capReceive () */
|
||||
UINT16 len; /* The length of the data read. */
|
||||
} tBTA_JV_L2CAP_RECEIVE;
|
||||
|
||||
/* data associated with BTA_JV_L2CAP_WRITE_EVT */
|
||||
typedef struct {
|
||||
tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */
|
||||
UINT32 handle; /* The connection handle */
|
||||
UINT32 req_id; /* The req_id in the associated BTA_JvL2capWrite() */
|
||||
UINT16 len; /* The length of the data written. */
|
||||
BOOLEAN cong; /* congestion status */
|
||||
} tBTA_JV_L2CAP_WRITE;
|
||||
|
||||
|
||||
/* data associated with BTA_JV_L2CAP_WRITE_FIXED_EVT */
|
||||
typedef struct {
|
||||
tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */
|
||||
UINT16 channel; /* The connection channel */
|
||||
BD_ADDR addr; /* The peer address */
|
||||
UINT32 req_id; /* The req_id in the associated BTA_JvL2capWrite() */
|
||||
UINT16 len; /* The length of the data written. */
|
||||
BOOLEAN cong; /* congestion status */
|
||||
} tBTA_JV_L2CAP_WRITE_FIXED;
|
||||
|
||||
/* data associated with BTA_JV_RFCOMM_OPEN_EVT */
|
||||
typedef struct {
|
||||
tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */
|
||||
UINT32 handle; /* The connection handle */
|
||||
BD_ADDR rem_bda; /* The peer address */
|
||||
} tBTA_JV_RFCOMM_OPEN;
|
||||
/* data associated with BTA_JV_RFCOMM_SRV_OPEN_EVT */
|
||||
typedef struct {
|
||||
tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */
|
||||
UINT32 handle; /* The connection handle */
|
||||
UINT32 new_listen_handle; /* The new listen handle */
|
||||
BD_ADDR rem_bda; /* The peer address */
|
||||
} tBTA_JV_RFCOMM_SRV_OPEN;
|
||||
|
||||
|
||||
/* data associated with BTA_JV_RFCOMM_CLOSE_EVT */
|
||||
typedef struct {
|
||||
tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */
|
||||
UINT32 port_status; /* PORT status */
|
||||
UINT32 handle; /* The connection handle */
|
||||
BOOLEAN async; /* FALSE, if local initiates disconnect */
|
||||
} tBTA_JV_RFCOMM_CLOSE;
|
||||
|
||||
/* data associated with BTA_JV_RFCOMM_START_EVT */
|
||||
typedef struct {
|
||||
tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */
|
||||
UINT32 handle; /* The connection handle */
|
||||
UINT8 sec_id; /* security ID used by this server */
|
||||
BOOLEAN use_co; /* TRUE to use co_rfc_data */
|
||||
} tBTA_JV_RFCOMM_START;
|
||||
|
||||
/* data associated with BTA_JV_RFCOMM_CL_INIT_EVT */
|
||||
typedef struct {
|
||||
tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */
|
||||
UINT32 handle; /* The connection handle */
|
||||
UINT8 sec_id; /* security ID used by this client */
|
||||
BOOLEAN use_co; /* TRUE to use co_rfc_data */
|
||||
} tBTA_JV_RFCOMM_CL_INIT;
|
||||
/*data associated with BTA_JV_L2CAP_DATA_IND_EVT & BTA_JV_RFCOMM_DATA_IND_EVT */
|
||||
typedef struct {
|
||||
UINT32 handle; /* The connection handle */
|
||||
BT_HDR *p_buf; /* The incoming data */
|
||||
} tBTA_JV_DATA_IND;
|
||||
|
||||
/*data associated with BTA_JV_L2CAP_DATA_IND_EVT if used for LE */
|
||||
typedef struct {
|
||||
UINT32 handle; /* The connection handle */
|
||||
BT_HDR *p_buf; /* The incoming data */
|
||||
} tBTA_JV_LE_DATA_IND;
|
||||
|
||||
|
||||
/* data associated with BTA_JV_RFCOMM_CONG_EVT */
|
||||
typedef struct {
|
||||
tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */
|
||||
UINT32 handle; /* The connection handle */
|
||||
BOOLEAN cong; /* TRUE, congested. FALSE, uncongested */
|
||||
} tBTA_JV_RFCOMM_CONG;
|
||||
|
||||
/* data associated with BTA_JV_RFCOMM_READ_EVT */
|
||||
typedef struct {
|
||||
tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */
|
||||
UINT32 handle; /* The connection handle */
|
||||
UINT32 req_id; /* The req_id in the associated BTA_JvRfcommRead() */
|
||||
UINT8 *p_data; /* This points the same location as the p_data
|
||||
* parameter in BTA_JvRfcommRead () */
|
||||
UINT16 len; /* The length of the data read. */
|
||||
} tBTA_JV_RFCOMM_READ;
|
||||
|
||||
/* data associated with BTA_JV_RFCOMM_WRITE_EVT */
|
||||
typedef struct {
|
||||
tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */
|
||||
UINT32 handle; /* The connection handle */
|
||||
UINT32 req_id; /* The req_id in the associated BTA_JvRfcommWrite() */
|
||||
int len; /* The length of the data written. */
|
||||
BOOLEAN cong; /* congestion status */
|
||||
} tBTA_JV_RFCOMM_WRITE;
|
||||
|
||||
/* data associated with BTA_JV_API_SET_PM_PROFILE_EVT */
|
||||
typedef struct {
|
||||
tBTA_JV_STATUS status; /* Status of the operation */
|
||||
UINT32 handle; /* Connection handle */
|
||||
tBTA_JV_PM_ID app_id; /* JV app ID */
|
||||
} tBTA_JV_SET_PM_PROFILE;
|
||||
|
||||
/* data associated with BTA_JV_API_NOTIFY_PM_STATE_CHANGE_EVT */
|
||||
typedef struct {
|
||||
UINT32 handle; /* Connection handle */
|
||||
tBTA_JV_CONN_STATE state; /* JV connection stata */
|
||||
} tBTA_JV_NOTIFY_PM_STATE_CHANGE;
|
||||
|
||||
|
||||
/* union of data associated with JV callback */
|
||||
typedef union {
|
||||
tBTA_JV_STATUS status; /* BTA_JV_ENABLE_EVT */
|
||||
tBTA_JV_DISCOVERY_COMP disc_comp; /* BTA_JV_DISCOVERY_COMP_EVT */
|
||||
tBTA_JV_SET_DISCOVER set_discover; /* BTA_JV_SET_DISCOVER_EVT */
|
||||
UINT8 scn; /* BTA_JV_GET_SCN_EVT */
|
||||
UINT16 psm; /* BTA_JV_GET_PSM_EVT */
|
||||
tBTA_JV_CREATE_RECORD create_rec; /* BTA_JV_CREATE_RECORD_EVT */
|
||||
tBTA_JV_L2CAP_OPEN l2c_open; /* BTA_JV_L2CAP_OPEN_EVT */
|
||||
tBTA_JV_L2CAP_CLOSE l2c_close; /* BTA_JV_L2CAP_CLOSE_EVT */
|
||||
tBTA_JV_L2CAP_START l2c_start; /* BTA_JV_L2CAP_START_EVT */
|
||||
tBTA_JV_L2CAP_CL_INIT l2c_cl_init; /* BTA_JV_L2CAP_CL_INIT_EVT */
|
||||
tBTA_JV_L2CAP_CONG l2c_cong; /* BTA_JV_L2CAP_CONG_EVT */
|
||||
tBTA_JV_L2CAP_READ l2c_read; /* BTA_JV_L2CAP_READ_EVT */
|
||||
tBTA_JV_L2CAP_WRITE l2c_write; /* BTA_JV_L2CAP_WRITE_EVT */
|
||||
tBTA_JV_RFCOMM_OPEN rfc_open; /* BTA_JV_RFCOMM_OPEN_EVT */
|
||||
tBTA_JV_RFCOMM_SRV_OPEN rfc_srv_open; /* BTA_JV_RFCOMM_SRV_OPEN_EVT */
|
||||
tBTA_JV_RFCOMM_CLOSE rfc_close; /* BTA_JV_RFCOMM_CLOSE_EVT */
|
||||
tBTA_JV_RFCOMM_START rfc_start; /* BTA_JV_RFCOMM_START_EVT */
|
||||
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_READ rfc_read; /* BTA_JV_RFCOMM_READ_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_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_L2CAP_WRITE_FIXED l2c_write_fixed; /* BTA_JV_L2CAP_WRITE_FIXED_EVT */
|
||||
} tBTA_JV;
|
||||
|
||||
/* JAVA DM Interface callback */
|
||||
typedef void (tBTA_JV_DM_CBACK)(tBTA_JV_EVT event, tBTA_JV *p_data, void *user_data);
|
||||
|
||||
/* JAVA RFCOMM interface callback */
|
||||
typedef void *(tBTA_JV_RFCOMM_CBACK)(tBTA_JV_EVT event, tBTA_JV *p_data, void *user_data);
|
||||
|
||||
/* JAVA L2CAP interface callback */
|
||||
typedef void (tBTA_JV_L2CAP_CBACK)(tBTA_JV_EVT event, tBTA_JV *p_data, void *user_Data);
|
||||
|
||||
/* JV configuration structure */
|
||||
typedef struct {
|
||||
UINT16 sdp_raw_size; /* The size of p_sdp_raw_data */
|
||||
UINT16 sdp_db_size; /* The size of p_sdp_db */
|
||||
UINT8 *p_sdp_raw_data; /* The data buffer to keep raw data */
|
||||
tSDP_DISCOVERY_DB *p_sdp_db; /* The data buffer to keep SDP database */
|
||||
} tBTA_JV_CFG;
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_JvEnable
|
||||
**
|
||||
** Description Enable the Java I/F service. When the enable
|
||||
** operation is complete the callback function will be
|
||||
** called with a BTA_JV_ENABLE_EVT. This function must
|
||||
** be called before other functions in the JV API are
|
||||
** called.
|
||||
**
|
||||
** Returns BTA_JV_SUCCESS if successful.
|
||||
** BTA_JV_FAIL if internal failure.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tBTA_JV_STATUS BTA_JvEnable(tBTA_JV_DM_CBACK *p_cback);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_JvDisable
|
||||
**
|
||||
** Description Disable the Java I/F
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void BTA_JvDisable(void);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_JvIsEnable
|
||||
**
|
||||
** Description Get the JV registration status.
|
||||
**
|
||||
** Returns TRUE, if registered
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN BTA_JvIsEnable(void);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_JvIsEncrypted
|
||||
**
|
||||
** Description This function checks if the link to peer device is encrypted
|
||||
**
|
||||
** Returns TRUE if encrypted.
|
||||
** FALSE if not.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN BTA_JvIsEncrypted(BD_ADDR bd_addr);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_JvGetChannelId
|
||||
**
|
||||
** Description This function reserves a SCN/PSM for applications running
|
||||
** over RFCOMM or L2CAP. It is primarily called by
|
||||
** server profiles/applications to register their SCN/PSM into the
|
||||
** SDP database. The SCN is reported by the tBTA_JV_DM_CBACK
|
||||
** callback with a BTA_JV_GET_SCN_EVT.
|
||||
** If the SCN/PSM reported is 0, that means all SCN resources are
|
||||
** exhausted.
|
||||
** The channel parameter can be used to request a specific
|
||||
** channel. If the request on the specific channel fails, the
|
||||
** SCN/PSM returned in the EVT will be 0 - no attempt to request
|
||||
** a new channel will be made. set channel to <= 0 to automatically
|
||||
** assign an channel ID.
|
||||
**
|
||||
** Returns BTA_JV_SUCCESS, if the request is being processed.
|
||||
** BTA_JV_FAILURE, otherwise.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tBTA_JV_STATUS BTA_JvGetChannelId(int conn_type, void *user_data,
|
||||
INT32 channel);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_JvFreeChannel
|
||||
**
|
||||
** Description This function frees a SCN/PSM that was used
|
||||
** by an application running over RFCOMM or L2CAP.
|
||||
**
|
||||
** Returns BTA_JV_SUCCESS, if the request is being processed.
|
||||
** BTA_JV_FAILURE, otherwise.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tBTA_JV_STATUS BTA_JvFreeChannel(UINT16 channel, int conn_type);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_JvStartDiscovery
|
||||
**
|
||||
** Description This function performs service discovery for the services
|
||||
** provided by the given peer device. When the operation is
|
||||
** complete the tBTA_JV_DM_CBACK callback function will be
|
||||
** called with a BTA_JV_DISCOVERY_COMP_EVT.
|
||||
**
|
||||
** Returns BTA_JV_SUCCESS, if the request is being processed.
|
||||
** BTA_JV_FAILURE, otherwise.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tBTA_JV_STATUS BTA_JvStartDiscovery(BD_ADDR bd_addr, UINT16 num_uuid,
|
||||
tSDP_UUID *p_uuid_list, void *user_data);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_JvCreateRecordByUser
|
||||
**
|
||||
** Description Create a service record in the local SDP database by user in
|
||||
** tBTA_JV_DM_CBACK callback with a BTA_JV_CREATE_RECORD_EVT.
|
||||
**
|
||||
** Returns BTA_JV_SUCCESS, if the request is being processed.
|
||||
** BTA_JV_FAILURE, otherwise.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tBTA_JV_STATUS BTA_JvCreateRecordByUser(const char *name, UINT32 channel, void *user_data);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_JvDeleteRecord
|
||||
**
|
||||
** Description Delete a service record in the local SDP database.
|
||||
**
|
||||
** Returns BTA_JV_SUCCESS, if the request is being processed.
|
||||
** BTA_JV_FAILURE, otherwise.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tBTA_JV_STATUS BTA_JvDeleteRecord(UINT32 handle);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_JvL2capConnectLE
|
||||
**
|
||||
** Description Initiate a connection as an LE L2CAP client to the given BD
|
||||
** Address.
|
||||
** When the connection is initiated or failed to initiate,
|
||||
** tBTA_JV_L2CAP_CBACK is called with BTA_JV_L2CAP_CL_INIT_EVT
|
||||
** When the connection is established or failed,
|
||||
** tBTA_JV_L2CAP_CBACK is called with BTA_JV_L2CAP_OPEN_EVT
|
||||
**
|
||||
** Returns BTA_JV_SUCCESS, if the request is being processed.
|
||||
** BTA_JV_FAILURE, otherwise.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tBTA_JV_STATUS BTA_JvL2capConnectLE(tBTA_SEC sec_mask, tBTA_JV_ROLE role,
|
||||
const tL2CAP_ERTM_INFO *ertm_info, UINT16 remote_chan,
|
||||
UINT16 rx_mtu, tL2CAP_CFG_INFO *cfg,
|
||||
BD_ADDR peer_bd_addr, tBTA_JV_L2CAP_CBACK *p_cback, void *user_data);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_JvL2capConnect
|
||||
**
|
||||
** Description Initiate a connection as a L2CAP client to the given BD
|
||||
** Address.
|
||||
** When the connection is initiated or failed to initiate,
|
||||
** tBTA_JV_L2CAP_CBACK is called with BTA_JV_L2CAP_CL_INIT_EVT
|
||||
** When the connection is established or failed,
|
||||
** tBTA_JV_L2CAP_CBACK is called with BTA_JV_L2CAP_OPEN_EVT
|
||||
**
|
||||
** Returns BTA_JV_SUCCESS, if the request is being processed.
|
||||
** BTA_JV_FAILURE, otherwise.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tBTA_JV_STATUS BTA_JvL2capConnect(tBTA_SEC sec_mask, tBTA_JV_ROLE role,
|
||||
const tL2CAP_ERTM_INFO *ertm_info, UINT16 remote_psm,
|
||||
UINT16 rx_mtu, tL2CAP_CFG_INFO *cfg,
|
||||
BD_ADDR peer_bd_addr, tBTA_JV_L2CAP_CBACK *p_cback, void *user_data);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_JvL2capClose
|
||||
**
|
||||
** Description This function closes an L2CAP client connection
|
||||
**
|
||||
** Returns BTA_JV_SUCCESS, if the request is being processed.
|
||||
** BTA_JV_FAILURE, otherwise.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tBTA_JV_STATUS BTA_JvL2capClose(UINT32 handle);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_JvL2capCloseLE
|
||||
**
|
||||
** Description This function closes an L2CAP client connection for Fixed Channels
|
||||
** Function is idempotent and no callbacks are called!
|
||||
**
|
||||
** Returns BTA_JV_SUCCESS, if the request is being processed.
|
||||
** BTA_JV_FAILURE, otherwise.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tBTA_JV_STATUS BTA_JvL2capCloseLE(UINT32 handle);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_JvL2capStartServer
|
||||
**
|
||||
** Description This function starts an L2CAP server and listens for an L2CAP
|
||||
** connection from a remote Bluetooth device. When the server
|
||||
** is started successfully, tBTA_JV_L2CAP_CBACK is called with
|
||||
** BTA_JV_L2CAP_START_EVT. When the connection is established,
|
||||
** tBTA_JV_L2CAP_CBACK is called with BTA_JV_L2CAP_OPEN_EVT.
|
||||
**
|
||||
** Returns BTA_JV_SUCCESS, if the request is being processed.
|
||||
** BTA_JV_FAILURE, otherwise.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tBTA_JV_STATUS BTA_JvL2capStartServer(tBTA_SEC sec_mask, tBTA_JV_ROLE role,
|
||||
const tL2CAP_ERTM_INFO *ertm_info,
|
||||
UINT16 local_psm, UINT16 rx_mtu, tL2CAP_CFG_INFO *cfg,
|
||||
tBTA_JV_L2CAP_CBACK *p_cback, void *user_data);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_JvL2capStartServerLE
|
||||
**
|
||||
** Description This function starts an LE L2CAP server and listens for an L2CAP
|
||||
** connection from a remote Bluetooth device on a fixed channel
|
||||
** over an LE link. When the server
|
||||
** is started successfully, tBTA_JV_L2CAP_CBACK is called with
|
||||
** BTA_JV_L2CAP_START_EVT. When the connection is established,
|
||||
** tBTA_JV_L2CAP_CBACK is called with BTA_JV_L2CAP_OPEN_EVT.
|
||||
**
|
||||
** Returns BTA_JV_SUCCESS, if the request is being processed.
|
||||
** BTA_JV_FAILURE, otherwise.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tBTA_JV_STATUS BTA_JvL2capStartServerLE(tBTA_SEC sec_mask, tBTA_JV_ROLE role,
|
||||
const tL2CAP_ERTM_INFO *ertm_info,
|
||||
UINT16 local_chan, UINT16 rx_mtu, tL2CAP_CFG_INFO *cfg,
|
||||
tBTA_JV_L2CAP_CBACK *p_cback, void *user_data);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_JvL2capStopServerLE
|
||||
**
|
||||
** Description This function stops the LE L2CAP server. If the server has an
|
||||
** active connection, it would be closed.
|
||||
**
|
||||
** Returns BTA_JV_SUCCESS, if the request is being processed.
|
||||
** BTA_JV_FAILURE, otherwise.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tBTA_JV_STATUS BTA_JvL2capStopServerLE(UINT16 local_chan, void *user_data);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_JvL2capStopServerLE
|
||||
**
|
||||
** Description This function stops the LE L2CAP server. If the server has an
|
||||
** active connection, it would be closed.
|
||||
**
|
||||
** Returns BTA_JV_SUCCESS, if the request is being processed.
|
||||
** BTA_JV_FAILURE, otherwise.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tBTA_JV_STATUS BTA_JvL2capStopServer(UINT16 local_psm, void *user_data);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_JvL2capRead
|
||||
**
|
||||
** Description This function reads data from an L2CAP connection
|
||||
** When the operation is complete, tBTA_JV_L2CAP_CBACK is
|
||||
** called with BTA_JV_L2CAP_READ_EVT.
|
||||
**
|
||||
** Returns BTA_JV_SUCCESS, if the request is being processed.
|
||||
** BTA_JV_FAILURE, otherwise.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tBTA_JV_STATUS BTA_JvL2capRead(UINT32 handle, UINT32 req_id,
|
||||
UINT8 *p_data, UINT16 len);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_JvL2capReceive
|
||||
**
|
||||
** Description This function reads data from an L2CAP connection
|
||||
** When the operation is complete, tBTA_JV_L2CAP_CBACK is
|
||||
** called with BTA_JV_L2CAP_RECEIVE_EVT.
|
||||
** If there are more data queued in L2CAP than len, the extra data will be discarded.
|
||||
**
|
||||
** Returns BTA_JV_SUCCESS, if the request is being processed.
|
||||
** BTA_JV_FAILURE, otherwise.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tBTA_JV_STATUS BTA_JvL2capReceive(UINT32 handle, UINT32 req_id,
|
||||
UINT8 *p_data, UINT16 len);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_JvL2capReady
|
||||
**
|
||||
** Description This function determined if there is data to read from
|
||||
** an L2CAP connection
|
||||
**
|
||||
** Returns BTA_JV_SUCCESS, if data queue size is in *p_data_size.
|
||||
** BTA_JV_FAILURE, if error.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tBTA_JV_STATUS BTA_JvL2capReady(UINT32 handle, UINT32 *p_data_size);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_JvL2capWrite
|
||||
**
|
||||
** Description This function writes data to an L2CAP connection
|
||||
** When the operation is complete, tBTA_JV_L2CAP_CBACK is
|
||||
** called with BTA_JV_L2CAP_WRITE_EVT. Works for
|
||||
** PSM-based connections
|
||||
**
|
||||
** Returns BTA_JV_SUCCESS, if the request is being processed.
|
||||
** BTA_JV_FAILURE, otherwise.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tBTA_JV_STATUS BTA_JvL2capWrite(UINT32 handle, UINT32 req_id,
|
||||
UINT8 *p_data, UINT16 len, void *user_data);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_JvL2capWriteFixed
|
||||
**
|
||||
** Description This function writes data to an L2CAP connection
|
||||
** When the operation is complete, tBTA_JV_L2CAP_CBACK is
|
||||
** called with BTA_JV_L2CAP_WRITE_FIXED_EVT. Works for
|
||||
** fixed-channel connections
|
||||
**
|
||||
** Returns BTA_JV_SUCCESS, if the request is being processed.
|
||||
** BTA_JV_FAILURE, otherwise.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tBTA_JV_STATUS BTA_JvL2capWriteFixed(UINT16 channel, BD_ADDR *addr, UINT32 req_id,
|
||||
tBTA_JV_L2CAP_CBACK *p_cback,
|
||||
UINT8 *p_data, UINT16 len, void *user_data);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_JvRfcommConnect
|
||||
**
|
||||
** Description This function makes an RFCOMM conection to a remote BD
|
||||
** Address.
|
||||
** When the connection is initiated or failed to initiate,
|
||||
** tBTA_JV_RFCOMM_CBACK is called with BTA_JV_RFCOMM_CL_INIT_EVT
|
||||
** When the connection is established or failed,
|
||||
** tBTA_JV_RFCOMM_CBACK is called with BTA_JV_RFCOMM_OPEN_EVT
|
||||
**
|
||||
** Returns BTA_JV_SUCCESS, if the request is being processed.
|
||||
** BTA_JV_FAILURE, otherwise.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tBTA_JV_STATUS BTA_JvRfcommConnect(tBTA_SEC sec_mask,
|
||||
tBTA_JV_ROLE role, UINT8 remote_scn, BD_ADDR peer_bd_addr,
|
||||
tBTA_JV_RFCOMM_CBACK *p_cback, void *user_data);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_JvRfcommClose
|
||||
**
|
||||
** Description This function closes an RFCOMM connection
|
||||
**
|
||||
** Returns BTA_JV_SUCCESS, if the request is being processed.
|
||||
** BTA_JV_FAILURE, otherwise.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tBTA_JV_STATUS BTA_JvRfcommClose(UINT32 handle, void *user_data);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_JvRfcommStartServer
|
||||
**
|
||||
** Description This function starts listening for an RFCOMM connection
|
||||
** request from a remote Bluetooth device. When the server is
|
||||
** started successfully, tBTA_JV_RFCOMM_CBACK is called
|
||||
** with BTA_JV_RFCOMM_START_EVT.
|
||||
** When the connection is established, tBTA_JV_RFCOMM_CBACK
|
||||
** is called with BTA_JV_RFCOMM_OPEN_EVT.
|
||||
**
|
||||
** Returns BTA_JV_SUCCESS, if the request is being processed.
|
||||
** BTA_JV_FAILURE, otherwise.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tBTA_JV_STATUS BTA_JvRfcommStartServer(tBTA_SEC sec_mask,
|
||||
tBTA_JV_ROLE role, UINT8 local_scn, UINT8 max_session,
|
||||
tBTA_JV_RFCOMM_CBACK *p_cback, void *user_data);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_JvRfcommStopServer
|
||||
**
|
||||
** Description This function stops the RFCOMM server. If the server has an
|
||||
** active connection, it would be closed.
|
||||
**
|
||||
** Returns BTA_JV_SUCCESS, if the request is being processed.
|
||||
** BTA_JV_FAILURE, otherwise.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tBTA_JV_STATUS BTA_JvRfcommStopServer(UINT32 handle, void *user_data);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_JvRfcommRead
|
||||
**
|
||||
** Description This function reads data from an RFCOMM connection
|
||||
** When the operation is complete, tBTA_JV_RFCOMM_CBACK is
|
||||
** called with BTA_JV_RFCOMM_READ_EVT.
|
||||
**
|
||||
** Returns BTA_JV_SUCCESS, if the request is being processed.
|
||||
** BTA_JV_FAILURE, otherwise.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tBTA_JV_STATUS BTA_JvRfcommRead(UINT32 handle, UINT32 req_id,
|
||||
UINT8 *p_data, UINT16 len);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_JvRfcommReady
|
||||
**
|
||||
** Description This function determined if there is data to read from
|
||||
** an RFCOMM connection
|
||||
**
|
||||
** Returns BTA_JV_SUCCESS, if data queue size is in *p_data_size.
|
||||
** BTA_JV_FAILURE, if error.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tBTA_JV_STATUS BTA_JvRfcommReady(UINT32 handle, UINT32 *p_data_size);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_JvRfcommWrite
|
||||
**
|
||||
** Description This function writes data to an RFCOMM connection
|
||||
** When the operation is complete, tBTA_JV_RFCOMM_CBACK is
|
||||
** called with BTA_JV_RFCOMM_WRITE_EVT.
|
||||
**
|
||||
** Returns BTA_JV_SUCCESS, if the request is being processed.
|
||||
** BTA_JV_FAILURE, otherwise.
|
||||
**
|
||||
*******************************************************************************/
|
||||
// extern tBTA_JV_STATUS BTA_JvRfcommWrite(UINT32 handle, UINT32 req_id);
|
||||
extern tBTA_JV_STATUS BTA_JvRfcommWrite(UINT32 handle, UINT32 req_id, int len, UINT8 *p_data);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_JVSetPmProfile
|
||||
**
|
||||
** Description This function set or free power mode profile for different JV application
|
||||
**
|
||||
** Parameters: handle, JV handle from RFCOMM or L2CAP
|
||||
** app_id: app specific pm ID, can be BTA_JV_PM_ALL, see bta_dm_cfg.c for details
|
||||
** BTA_JV_PM_ID_CLEAR: removes pm management on the handle. init_st is ignored and
|
||||
** BTA_JV_CONN_CLOSE is called implicitely
|
||||
** init_st: state after calling this API. typically it should be BTA_JV_CONN_OPEN
|
||||
**
|
||||
** Returns BTA_JV_SUCCESS, if the request is being processed.
|
||||
** BTA_JV_FAILURE, otherwise.
|
||||
**
|
||||
** NOTE: BTA_JV_PM_ID_CLEAR: In general no need to be called as jv pm calls automatically
|
||||
** BTA_JV_CONN_CLOSE to remove in case of connection close!
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tBTA_JV_STATUS BTA_JvSetPmProfile(UINT32 handle, tBTA_JV_PM_ID app_id,
|
||||
tBTA_JV_CONN_STATE init_st);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_JvRfcommGetPortHdl
|
||||
**
|
||||
** Description This function fetches the rfcomm port handle
|
||||
**
|
||||
** Returns BTA_JV_SUCCESS, if the request is being processed.
|
||||
** BTA_JV_FAILURE, otherwise.
|
||||
**
|
||||
*******************************************************************************/
|
||||
UINT16 BTA_JvRfcommGetPortHdl(UINT32 handle);
|
||||
|
||||
#endif ///defined BTA_JV_INCLUDED && BTA_JV_INCLUDED == TRUE
|
||||
#endif /* BTA_JV_API_H */
|
55
tools/sdk/include/bluedroid/bta_jv_co.h
Normal file
55
tools/sdk/include/bluedroid/bta_jv_co.h
Normal file
@ -0,0 +1,55 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2007-2012 Broadcom Corporation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at:
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* This is the interface file for java interface call-out functions.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef BTA_JV_CO_H
|
||||
#define BTA_JV_CO_H
|
||||
|
||||
#include "bta_jv_api.h"
|
||||
|
||||
#if (defined BTA_JV_INCLUDED && BTA_JV_INCLUDED == TRUE)
|
||||
/*****************************************************************************
|
||||
** Function Declarations
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function bta_jv_co_rfc_data
|
||||
**
|
||||
** Description This function is called by JV to send data to the java glue
|
||||
** code when the RX data path is configured to use a call-out
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
|
||||
extern int bta_co_rfc_data_incoming(void *user_data, BT_HDR *p_buf);
|
||||
extern int bta_co_rfc_data_outgoing_size(void *user_data, int *size);
|
||||
extern int bta_co_rfc_data_outgoing(void *user_data, UINT8 *buf, UINT16 size);
|
||||
|
||||
extern int bta_co_l2cap_data_incoming(void *user_data, BT_HDR *p_buf);
|
||||
extern int bta_co_l2cap_data_outgoing_size(void *user_data, int *size);
|
||||
extern int bta_co_l2cap_data_outgoing(void *user_data, UINT8 *buf, UINT16 size);
|
||||
|
||||
#endif ///defined BTA_JV_INCLUDED && BTA_JV_INCLUDED == TRUE
|
||||
#endif /* BTA_DG_CO_H */
|
108
tools/sdk/include/bluedroid/btc_a2dp.h
Normal file
108
tools/sdk/include/bluedroid/btc_a2dp.h
Normal file
@ -0,0 +1,108 @@
|
||||
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Filename: btc_a2dp.h
|
||||
*
|
||||
* Description: Common definitions for A2DP
|
||||
*
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef __BTC_A2DP_H__
|
||||
#define __BTC_A2DP_H__
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "bt_target.h"
|
||||
#include "bta_api.h"
|
||||
#include "btc_av_api.h"
|
||||
#include "esp_a2dp_api.h"
|
||||
|
||||
#if BTC_AV_INCLUDED
|
||||
|
||||
/*******************************************************************************
|
||||
** Constants
|
||||
*******************************************************************************/
|
||||
#define BTC_AV_SUCCESS (0)
|
||||
/**
|
||||
* AV (Audio Video source) Errors
|
||||
*/
|
||||
#define BTC_ERROR_SRV_AV_NOT_ENABLED 700 /* AV is not enabled */
|
||||
#define BTC_ERROR_SRV_AV_FEEDING_NOT_SUPPORTED 701 /* Requested Feeding not supported */
|
||||
#define BTC_ERROR_SRV_AV_BUSY 702 /* Another operation ongoing */
|
||||
#define BTC_ERROR_SRV_AV_NOT_OPENED 703 /* No AV link opened */
|
||||
#define BTC_ERROR_SRV_AV_NOT_STARTED 704 /* AV is not started */
|
||||
#define BTC_ERROR_SRV_AV_CP_NOT_SUPPORTED 705 /* Content protection is not supported by all headsets */
|
||||
|
||||
/* Transcoding definition for TxTranscoding and RxTranscoding */
|
||||
#define BTC_MEDIA_TRSCD_OFF 0
|
||||
#define BTC_MEDIA_TRSCD_PCM_2_SBC 1 /* Tx */
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Data types
|
||||
*******************************************************************************/
|
||||
typedef int tBTC_AV_STATUS;
|
||||
|
||||
/*******************************************************************************
|
||||
** Public functions
|
||||
*******************************************************************************/
|
||||
|
||||
void btc_a2dp_on_init(void);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btc_a2dp_on_idle
|
||||
**
|
||||
** Description Process 'idle' request from BTC AV state machine during
|
||||
** initialization
|
||||
**
|
||||
*******************************************************************************/
|
||||
void btc_a2dp_on_idle(void);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btc_a2dp_on_started
|
||||
**
|
||||
** Description Process 'start' request from BTC AV state machine to prepare
|
||||
** for A2DP streaming
|
||||
**
|
||||
** Return TRUE if an ACK for the local command is sent
|
||||
**
|
||||
*******************************************************************************/
|
||||
BOOLEAN btc_a2dp_on_started(tBTA_AV_START *p_av, BOOLEAN pending_start);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btc_a2dp_on_stopped
|
||||
**
|
||||
** Description Process 'stop' request from BTC AV state machine to stop
|
||||
** A2DP streaming
|
||||
**
|
||||
*******************************************************************************/
|
||||
void btc_a2dp_on_stopped(tBTA_AV_SUSPEND *p_av);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btc_a2dp_on_suspended
|
||||
**
|
||||
** Description Process 'stop' request from BTC AV state machine to suspend
|
||||
** A2DP streaming
|
||||
**
|
||||
*******************************************************************************/
|
||||
void btc_a2dp_on_suspended(tBTA_AV_SUSPEND *p_av);
|
||||
|
||||
#endif /* #if BTC_AV_INCLUDED */
|
||||
|
||||
#endif /* __BTC_A2DP_H__ */
|
110
tools/sdk/include/bluedroid/btc_a2dp_control.h
Normal file
110
tools/sdk/include/bluedroid/btc_a2dp_control.h
Normal file
@ -0,0 +1,110 @@
|
||||
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Filename: btc_a2dp_control.h
|
||||
*
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef __BTC_A2DP_CONTROL_H__
|
||||
#define __BTC_A2DP_CONTROL_H__
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "bt_target.h"
|
||||
#include "bta_api.h"
|
||||
#include "btc_av_api.h"
|
||||
#include "esp_a2dp_api.h"
|
||||
|
||||
#if BTC_AV_INCLUDED
|
||||
/*******************************************************************************
|
||||
** Public functions
|
||||
*******************************************************************************/
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btc_a2dp_control_media_ctrl
|
||||
**
|
||||
** Description Handle the media_ctrl command
|
||||
**
|
||||
*******************************************************************************/
|
||||
void btc_a2dp_control_media_ctrl(esp_a2d_media_ctrl_t ctrl);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btc_a2dp_control_datapath_ctrl
|
||||
**
|
||||
** Description Handle the media datapath event, which is adapted from UIPC
|
||||
** data channel from bluedroid
|
||||
**
|
||||
*******************************************************************************/
|
||||
void btc_a2dp_control_datapath_ctrl(uint32_t dp_evt);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btc_a2dp_control_command_ack
|
||||
**
|
||||
** Description Acknowledge the pending media_ctrl command
|
||||
**
|
||||
*******************************************************************************/
|
||||
void btc_a2dp_control_command_ack(int status);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btc_a2dp_control_get_datachnl_stat
|
||||
**
|
||||
** Description Check whether the data channel state is open
|
||||
**
|
||||
** Return TRUE if the data channel state is open
|
||||
**
|
||||
*******************************************************************************/
|
||||
BOOLEAN btc_a2dp_control_get_datachnl_stat(void);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btc_a2dp_control_set_datachnl_stat
|
||||
**
|
||||
** Description Set the data channel state flag
|
||||
**
|
||||
*******************************************************************************/
|
||||
void btc_a2dp_control_set_datachnl_stat(BOOLEAN open);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btc_a2dp_control_init
|
||||
**
|
||||
** Description Initialize the A2DP control module. It should be called during
|
||||
** the startup stage of A2DP streaming.
|
||||
**
|
||||
*******************************************************************************/
|
||||
bool btc_a2dp_control_init(void);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btc_a2dp_control_cleanup
|
||||
**
|
||||
** Description Cleanup the A2DP control module
|
||||
**
|
||||
*******************************************************************************/
|
||||
void btc_a2dp_control_cleanup(void);
|
||||
|
||||
#endif /* #if BTC_AV_INCLUDED */
|
||||
|
||||
#endif /* __BTC_A2DP_CONTROL_H__ */
|
139
tools/sdk/include/bluedroid/btc_a2dp_sink.h
Normal file
139
tools/sdk/include/bluedroid/btc_a2dp_sink.h
Normal file
@ -0,0 +1,139 @@
|
||||
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Filename: btc_a2dp_sink.h
|
||||
*
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef __BTC_A2DP_SINK_H__
|
||||
#define __BTC_A2DP_SINK_H__
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "bt_target.h"
|
||||
#include "bta_api.h"
|
||||
#include "btc_av_api.h"
|
||||
#include "esp_a2dp_api.h"
|
||||
|
||||
#if BTC_AV_SINK_INCLUDED
|
||||
/*******************************************************************************
|
||||
** Data types
|
||||
*******************************************************************************/
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT8 codec_info[AVDT_CODEC_SIZE];
|
||||
} tBTC_MEDIA_SINK_CFG_UPDATE;
|
||||
|
||||
/*******************************************************************************
|
||||
** Public functions
|
||||
*******************************************************************************/
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btc_a2dp_sink_startup
|
||||
**
|
||||
** Description Initialize and startup the A2DP sink module. This function
|
||||
** should be called by the BTC AV state machine prior to using
|
||||
** the module.
|
||||
**
|
||||
** Returns true if success
|
||||
**
|
||||
*******************************************************************************/
|
||||
bool btc_a2dp_sink_startup(void);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btc_a2dp_sink_shutdown
|
||||
**
|
||||
** Description Shutdown and cleanup the A2DP sink module
|
||||
**
|
||||
*******************************************************************************/
|
||||
void btc_a2dp_sink_shutdown(void);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btc_a2dp_sink_rx_flush_req
|
||||
**
|
||||
** Description Request to flush audio decoding pipe
|
||||
**
|
||||
** Returns TRUE if success
|
||||
**
|
||||
*******************************************************************************/
|
||||
BOOLEAN btc_a2dp_sink_rx_flush_req(void);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btc_a2dp_sink_enque_buf
|
||||
**
|
||||
** Description Enqueue a Advance Audio media buffer to be processed by btc media task.
|
||||
**
|
||||
** Returns size of the queue
|
||||
**
|
||||
*******************************************************************************/
|
||||
UINT8 btc_a2dp_sink_enque_buf(BT_HDR *p_buf);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btc_a2dp_sink_on_idle
|
||||
**
|
||||
** Description Process 'idle' request from the BTC AV state machine during
|
||||
** initialization
|
||||
**
|
||||
*******************************************************************************/
|
||||
void btc_a2dp_sink_on_idle(void);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btc_a2dp_sink_on_stopped
|
||||
**
|
||||
** Description Process 'stop' request from the BTC AV state machine to stop
|
||||
** A2DP streaming
|
||||
**
|
||||
*******************************************************************************/
|
||||
void btc_a2dp_sink_on_stopped(tBTA_AV_SUSPEND *p_av);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btc_a2dp_sink_on_suspended
|
||||
**
|
||||
** Description Process 'suspend' request from the BTC AV state machine to
|
||||
** suspend A2DP streaming
|
||||
**
|
||||
*******************************************************************************/
|
||||
void btc_a2dp_sink_on_suspended(tBTA_AV_SUSPEND *p_av);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btc_a2dp_sink_set_rx_flush
|
||||
**
|
||||
** Description enable/disabel discarding of received A2DP frames
|
||||
**
|
||||
*******************************************************************************/
|
||||
void btc_a2dp_sink_set_rx_flush(BOOLEAN enable);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btc_a2dp_sink_reset_decoder
|
||||
**
|
||||
** Description Reset decoder parameters according to configuration from remote
|
||||
** device
|
||||
**
|
||||
*******************************************************************************/
|
||||
void btc_a2dp_sink_reset_decoder(UINT8 *p_av);
|
||||
|
||||
#endif /* #if BTC_AV_SINK_INCLUDED */
|
||||
|
||||
#endif /* __BTC_A2DP_SINK_H__ */
|
@ -14,46 +14,24 @@
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Filename: btc_media.h
|
||||
*
|
||||
* Description: This is the audio module for the BTC system.
|
||||
* Filename: btc_a2dp_source.h
|
||||
*
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef __BTC_MEDIA_H__
|
||||
#define __BTC_MEDIA_H__
|
||||
#ifndef __BTC_A2DP_SOURCE_H__
|
||||
#define __BTC_A2DP_SOURCE_H__
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "bt_target.h"
|
||||
#include "bta_api.h"
|
||||
#include "btc_av_api.h"
|
||||
#include "esp_a2dp_api.h"
|
||||
|
||||
#if (BTA_AV_INCLUDED == TRUE)
|
||||
|
||||
/*******************************************************************************
|
||||
** Constants
|
||||
*******************************************************************************/
|
||||
#define BTC_SUCCESS (0)
|
||||
/**
|
||||
* AV (Audio Video source) Errors
|
||||
*/
|
||||
#define BTC_ERROR_SRV_AV_NOT_ENABLED 700 /* AV is not enabled */
|
||||
#define BTC_ERROR_SRV_AV_FEEDING_NOT_SUPPORTED 701 /* Requested Feeding not supported */
|
||||
#define BTC_ERROR_SRV_AV_BUSY 702 /* Another operation ongoing */
|
||||
#define BTC_ERROR_SRV_AV_NOT_OPENED 703 /* No AV link opened */
|
||||
#define BTC_ERROR_SRV_AV_NOT_STARTED 704 /* AV is not started */
|
||||
#define BTC_ERROR_SRV_AV_CP_NOT_SUPPORTED 705 /* Content protection is not supported by all headsets */
|
||||
|
||||
/* Transcoding definition for TxTranscoding and RxTranscoding */
|
||||
#define BTC_MEDIA_TRSCD_OFF 0
|
||||
#define BTC_MEDIA_TRSCD_PCM_2_SBC 1 /* Tx */
|
||||
|
||||
|
||||
#if BTC_AV_SRC_INCLUDED
|
||||
/*******************************************************************************
|
||||
** Data types
|
||||
*******************************************************************************/
|
||||
|
||||
typedef int tBTC_STATUS;
|
||||
|
||||
/* tBTC_MEDIA_INIT_AUDIO msg structure */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
@ -65,7 +43,6 @@ typedef struct {
|
||||
UINT16 MtuSize; /* peer mtu size */
|
||||
} tBTC_MEDIA_INIT_AUDIO;
|
||||
|
||||
#if (BTA_AV_INCLUDED == TRUE)
|
||||
/* tBTC_MEDIA_UPDATE_AUDIO msg structure */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
@ -81,187 +58,187 @@ typedef struct {
|
||||
tBTC_AV_MEDIA_FEEDINGS feeding;
|
||||
} tBTC_MEDIA_INIT_AUDIO_FEEDING;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT8 codec_info[AVDT_CODEC_SIZE];
|
||||
} tBTC_MEDIA_SINK_CFG_UPDATE;
|
||||
#endif
|
||||
|
||||
/*******************************************************************************
|
||||
** Public functions
|
||||
*******************************************************************************/
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btc_av_task
|
||||
** Function btc_a2dp_source_startup
|
||||
**
|
||||
** Description
|
||||
** Description Initialize and startup the A2DP source module. This function
|
||||
** should be called by the BTC AV state machine prior to using
|
||||
** the module
|
||||
**
|
||||
** Returns void
|
||||
** Returns TRUE is success
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void btc_media_task(void);
|
||||
bool btc_a2dp_source_startup(void);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btc_media_task_enc_init_req
|
||||
** Function btc_a2dp_source_shutdown
|
||||
**
|
||||
** Description Shutdown and cleanup the A2DP source module.
|
||||
**
|
||||
*******************************************************************************/
|
||||
void btc_a2dp_source_shutdown(void);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btc_a2dp_source_enc_init_req
|
||||
**
|
||||
** Description Request to initialize the media task encoder
|
||||
**
|
||||
** Returns TRUE is success
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN btc_media_task_enc_init_req(tBTC_MEDIA_INIT_AUDIO *p_msg);
|
||||
BOOLEAN btc_a2dp_source_enc_init_req(tBTC_MEDIA_INIT_AUDIO *p_msg);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btc_media_task_enc_update_req
|
||||
** Function btc_a2dp_source_enc_udpate_req
|
||||
**
|
||||
** Description Request to update the media task encoder
|
||||
**
|
||||
** Returns TRUE is success
|
||||
**
|
||||
*******************************************************************************/
|
||||
#if (BTA_AV_INCLUDED == TRUE)
|
||||
extern BOOLEAN btc_media_task_enc_update_req(tBTC_MEDIA_UPDATE_AUDIO *p_msg);
|
||||
#endif
|
||||
BOOLEAN btc_a2dp_source_enc_update_req(tBTC_MEDIA_UPDATE_AUDIO *p_msg);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btc_media_task_start_aa_req
|
||||
** Function btc_a2dp_source_start_audio_req
|
||||
**
|
||||
** Description Request to start audio encoding task
|
||||
**
|
||||
** Returns TRUE is success
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN btc_media_task_start_aa_req(void);
|
||||
BOOLEAN btc_a2dp_source_start_audio_req(void);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btc_media_task_stop_aa_req
|
||||
** Function btc_a2dp_source_stop_audio_req
|
||||
**
|
||||
** Description Request to stop audio encoding task
|
||||
**
|
||||
** Returns TRUE is success
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN btc_media_task_stop_aa_req(void);
|
||||
BOOLEAN btc_a2dp_source_stop_audio_req(void);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btc_media_task_aa_rx_flush_req
|
||||
**
|
||||
** Description Request to flush audio decoding pipe
|
||||
**
|
||||
** Returns TRUE is success
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN btc_media_task_aa_rx_flush_req(void);
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btc_media_task_aa_tx_flush_req
|
||||
** Function btc_a2dp_source_tx_flush_req
|
||||
**
|
||||
** Description Request to flush audio encoding pipe
|
||||
**
|
||||
** Returns TRUE is success
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN btc_media_task_aa_tx_flush_req(void);
|
||||
BOOLEAN btc_a2dp_source_tx_flush_req(void);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btc_media_aa_readbuf
|
||||
** Function btc_a2dp_source_audio_readbuf
|
||||
**
|
||||
** Description Read an audio buffer from the BTC media TX queue
|
||||
**
|
||||
** Returns pointer on a aa buffer ready to send
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern BT_HDR *btc_media_aa_readbuf(void);
|
||||
BT_HDR *btc_a2dp_source_audio_readbuf(void);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btc_media_sink_enque_buf
|
||||
**
|
||||
** Description This function is called by the av_co to fill A2DP Sink Queue
|
||||
**
|
||||
**
|
||||
** Returns size of the queue
|
||||
*******************************************************************************/
|
||||
UINT8 btc_media_sink_enque_buf(BT_HDR *p_buf);
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btc_media_aa_writebuf
|
||||
**
|
||||
** Description Enqueue a Advance Audio media buffer to be processed by btc media task.
|
||||
**
|
||||
** Returns TRUE is success
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void btc_media_aa_writebuf(BT_HDR *pBuf, UINT32 timestamp, UINT16 seq_num);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btc_media_av_writebuf
|
||||
**
|
||||
** Description Enqueue a video media buffer to be processed by btc media task.
|
||||
**
|
||||
** Returns TRUE is success
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN btc_media_av_writebuf(UINT8 *p_media, UINT32 media_len,
|
||||
UINT32 timestamp, UINT16 seq_num);
|
||||
|
||||
#if (BTA_AV_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btc_media_task_audio_feeding_init_req
|
||||
** Function btc_a2dp_source_audio_feeding_init_req
|
||||
**
|
||||
** Description Request to initialize audio feeding
|
||||
**
|
||||
** Returns TRUE is success
|
||||
** Returns TRUE if success
|
||||
**
|
||||
*******************************************************************************/
|
||||
|
||||
extern BOOLEAN btc_media_task_audio_feeding_init_req(tBTC_MEDIA_INIT_AUDIO_FEEDING *p_msg);
|
||||
#endif
|
||||
BOOLEAN btc_a2dp_source_audio_feeding_init_req(tBTC_MEDIA_INIT_AUDIO_FEEDING *p_msg);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function dump_codec_info
|
||||
** Function btc_a2dp_source_is_streaming
|
||||
**
|
||||
** Description Decode and display codec_info (for debug)
|
||||
**
|
||||
** Returns void
|
||||
** Description Check whether A2DP source is in streaming state
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void dump_codec_info(unsigned char *p_codec);
|
||||
bool btc_a2dp_source_is_streaming(void);
|
||||
|
||||
/**
|
||||
* Local adaptation helper functions between btc and media task
|
||||
*/
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btc_a2dp_source_is_task_shutting_down
|
||||
**
|
||||
** Description Check whether A2DP source media task is shutting down
|
||||
**
|
||||
*******************************************************************************/
|
||||
bool btc_a2dp_source_is_task_shutting_down(void);
|
||||
|
||||
bool btc_a2dp_start_media_task(void);
|
||||
void btc_a2dp_stop_media_task(void);
|
||||
|
||||
void btc_a2dp_on_init(void);
|
||||
void btc_a2dp_setup_codec(void);
|
||||
void btc_a2dp_on_idle(void);
|
||||
BOOLEAN btc_a2dp_on_started(tBTA_AV_START *p_av, BOOLEAN pending_start);
|
||||
void btc_a2dp_on_stop_req(void);
|
||||
void btc_a2dp_on_stopped(tBTA_AV_SUSPEND *p_av);
|
||||
void btc_a2dp_on_suspend(void);
|
||||
void btc_a2dp_on_suspended(tBTA_AV_SUSPEND *p_av);
|
||||
void btc_a2dp_set_rx_flush(BOOLEAN enable);
|
||||
void btc_media_check_iop_exceptions(UINT8 *peer_bda);
|
||||
void btc_reset_decoder(UINT8 *p_av);
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btc_a2dp_source_on_idle
|
||||
**
|
||||
** Description Request 'idle' request from BTC AV state machine during
|
||||
** initialization
|
||||
**
|
||||
*******************************************************************************/
|
||||
void btc_a2dp_source_on_idle(void);
|
||||
|
||||
int btc_a2dp_get_track_frequency(UINT8 frequency);
|
||||
int btc_a2dp_get_track_channel_count(UINT8 channeltype);
|
||||
void btc_a2dp_set_peer_sep(UINT8 sep);
|
||||
#endif ///BTA_AV_INCLUDED == TRUE
|
||||
#endif
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btc_a2dp_source_on_stopped
|
||||
**
|
||||
** Description Process 'stop' request from the BTC AV state machine to stop
|
||||
** A2DP streaming
|
||||
**
|
||||
*******************************************************************************/
|
||||
void btc_a2dp_source_on_stopped(tBTA_AV_SUSPEND *p_av);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btc_a2dp_source_on_suspended
|
||||
**
|
||||
** Description Process 'suspend' request from the BTC AV state machine to stop
|
||||
** A2DP streaming
|
||||
**
|
||||
*******************************************************************************/
|
||||
void btc_a2dp_source_on_suspended(tBTA_AV_SUSPEND *p_av);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btc_a2dp_source_setup_codec
|
||||
**
|
||||
** Description initialize the encoder parameters
|
||||
**
|
||||
*******************************************************************************/
|
||||
void btc_a2dp_source_setup_codec(void);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btc_a2dp_source_set_tx_flush
|
||||
**
|
||||
** Description enable/disable discarding of transmitted frames
|
||||
**
|
||||
*******************************************************************************/
|
||||
void btc_a2dp_source_set_tx_flush(BOOLEAN enable);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btc_a2dp_source_encoder_update
|
||||
**
|
||||
** Description update changed SBC encoder parameters
|
||||
**
|
||||
*******************************************************************************/
|
||||
void btc_a2dp_source_encoder_update(void);
|
||||
|
||||
#endif /* #if BTC_AV_SRC_INCLUDED */
|
||||
|
||||
#endif /* __BTC_A2DP_SOURCE_H__ */
|
@ -25,17 +25,23 @@
|
||||
#ifndef __BTC_AV_H__
|
||||
#define __BTC_AV_H__
|
||||
|
||||
#include "bt_target.h"
|
||||
#include "esp_a2dp_api.h"
|
||||
#include "btc_task.h"
|
||||
#include "btc_common.h"
|
||||
#include "btc_sm.h"
|
||||
#include "bta_av_api.h"
|
||||
|
||||
#if (BTA_AV_INCLUDED == TRUE)
|
||||
#if (BTC_AV_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
** Type definitions for callback functions
|
||||
********************************************************************************/
|
||||
|
||||
enum {
|
||||
BTC_AV_DATAPATH_OPEN_EVT, // original UIPC_OPEN_EVT for data channel in bluedroid
|
||||
BTC_AV_DATAPATH_MAX_EVT,
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
BTC_AV_CONNECT_REQ_EVT = BTA_AV_MAX_EVT,
|
||||
BTC_AV_DISCONNECT_REQ_EVT,
|
||||
@ -46,21 +52,44 @@ typedef enum {
|
||||
} btc_av_sm_event_t;
|
||||
|
||||
typedef enum {
|
||||
#if BTC_AV_SINK_INCLUDED
|
||||
BTC_AV_SINK_API_INIT_EVT = 0,
|
||||
BTC_AV_SINK_API_DEINIT_EVT,
|
||||
BTC_AV_SINK_API_CONNECT_EVT,
|
||||
BTC_AV_SINK_API_DISCONNECT_EVT,
|
||||
BTC_AV_SINK_API_REG_DATA_CB_EVT,
|
||||
#endif /* BTC_AV_SINK_INCLUDED */
|
||||
#if BTC_AV_SRC_INCLUDED
|
||||
BTC_AV_SRC_API_INIT_EVT,
|
||||
BTC_AV_SRC_API_DEINIT_EVT,
|
||||
BTC_AV_SRC_API_CONNECT_EVT,
|
||||
BTC_AV_SRC_API_DISCONNECT_EVT,
|
||||
BTC_AV_SRC_API_REG_DATA_CB_EVT,
|
||||
#endif /* BTC_AV_SRC_INCLUDED */
|
||||
BTC_AV_API_MEDIA_CTRL_EVT,
|
||||
BTC_AV_DATAPATH_CTRL_EVT,
|
||||
} btc_av_act_t;
|
||||
|
||||
/* btc_av_args_t */
|
||||
typedef union {
|
||||
#if BTC_AV_SINK_INCLUDED
|
||||
// BTC_AV_SINK_CONFIG_REQ_EVT -- internal event
|
||||
esp_a2d_mcc_t mcc;
|
||||
// BTC_AV_SINK_API_CONNECT_EVT
|
||||
bt_bdaddr_t connect;
|
||||
// BTC_AV_SINK_API_REG_DATA_CB_EVT
|
||||
esp_a2d_data_cb_t data_cb;
|
||||
esp_a2d_sink_data_cb_t data_cb;
|
||||
#endif /* BTC_AV_SINK_INCLUDED */
|
||||
#if BTC_AV_SRC_INCLUDED
|
||||
// BTC_AV_SRC_API_REG_DATA_CB_EVT
|
||||
esp_a2d_source_data_cb_t src_data_cb;
|
||||
// BTC_AV_SRC_API_CONNECT
|
||||
bt_bdaddr_t src_connect;
|
||||
#endif /* BTC_AV_SRC_INCLUDED */
|
||||
// BTC_AV_API_MEDIA_CTRL_EVT
|
||||
esp_a2d_media_ctrl_t ctrl;
|
||||
// BTC_AV_DATAPATH_CTRL_EVT
|
||||
uint32_t dp_evt;
|
||||
} btc_av_args_t;
|
||||
|
||||
/*******************************************************************************
|
||||
@ -71,7 +100,9 @@ void btc_a2dp_call_handler(btc_msg_t *msg);
|
||||
|
||||
void btc_a2dp_cb_handler(btc_msg_t *msg);
|
||||
|
||||
void btc_a2dp_sink_reg_data_cb(esp_a2d_data_cb_t callback);
|
||||
void btc_a2dp_sink_reg_data_cb(esp_a2d_sink_data_cb_t callback);
|
||||
|
||||
void btc_a2dp_src_reg_data_cb(esp_a2d_source_data_cb_t callback);
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btc_av_get_sm_handle
|
||||
@ -121,18 +152,6 @@ BOOLEAN btc_av_stream_started_ready(void);
|
||||
/* used to pass events to AV statemachine from other tasks */
|
||||
void btc_dispatch_sm_event(btc_av_sm_event_t event, void *p_data, int len);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btc_av_init
|
||||
**
|
||||
** Description Initializes btc AV if not already done
|
||||
**
|
||||
** Returns bt_status_t
|
||||
**
|
||||
*******************************************************************************/
|
||||
|
||||
bt_status_t btc_av_init(void);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btc_av_is_connected
|
||||
@ -146,6 +165,19 @@ bt_status_t btc_av_init(void);
|
||||
BOOLEAN btc_av_is_connected(void);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Function btc_av_get_peer_sep
|
||||
*
|
||||
* Description Get the stream endpoint type.
|
||||
*
|
||||
* Returns The stream endpoint type: either AVDT_TSEP_SRC or
|
||||
* AVDT_TSEP_SNK.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
uint8_t btc_av_get_peer_sep(void);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btc_av_is_peer_edr
|
||||
@ -171,6 +203,6 @@ BOOLEAN btc_av_is_peer_edr(void);
|
||||
********************************************************************************/
|
||||
void btc_av_clear_remote_suspend_flag(void);
|
||||
|
||||
#endif ///BTA_AV_INCLUDED == TRUE
|
||||
#endif ///BTC_AV_INCLUDED == TRUE
|
||||
|
||||
#endif /* __BTC_AV_H__ */
|
||||
|
@ -27,8 +27,6 @@
|
||||
|
||||
#include "bt_target.h"
|
||||
#include "bta_av_api.h"
|
||||
|
||||
#include "btc_media.h"
|
||||
#include "a2d_api.h"
|
||||
#include "a2d_sbc.h"
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
#ifndef __BTC_AV_CO_H__
|
||||
#define __BTC_AV_CO_H__
|
||||
|
||||
#include "btc_media.h"
|
||||
#include "btc_a2dp.h"
|
||||
|
||||
#if (BTA_AV_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
@ -93,7 +93,7 @@ void bta_av_co_audio_codec_reset(void);
|
||||
** Returns TRUE if all opened devices support this codec, FALSE otherwise
|
||||
**
|
||||
*******************************************************************************/
|
||||
BOOLEAN bta_av_co_audio_codec_supported(tBTC_STATUS *p_status);
|
||||
BOOLEAN bta_av_co_audio_codec_supported(tBTC_AV_STATUS *p_status);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@ -106,7 +106,7 @@ BOOLEAN bta_av_co_audio_codec_supported(tBTC_STATUS *p_status);
|
||||
** Returns TRUE if successful, FALSE otherwise
|
||||
**
|
||||
*******************************************************************************/
|
||||
BOOLEAN bta_av_co_audio_set_codec(const tBTC_AV_MEDIA_FEEDINGS *p_feeding, tBTC_STATUS *p_status);
|
||||
BOOLEAN bta_av_co_audio_set_codec(const tBTC_AV_MEDIA_FEEDINGS *p_feeding, tBTC_AV_STATUS *p_status);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
|
@ -28,18 +28,14 @@
|
||||
#define BTC_AVRC_TGT_INCLUDED FALSE
|
||||
#endif
|
||||
|
||||
/* Macros */
|
||||
typedef enum {
|
||||
BTRC_FEAT_NONE = 0x00, /* AVRCP 1.0 */
|
||||
BTRC_FEAT_METADATA = 0x01, /* AVRCP 1.3 */
|
||||
BTRC_FEAT_ABSOLUTE_VOLUME = 0x02, /* Supports TG role and volume sync */
|
||||
BTRC_FEAT_BROWSE = 0x04, /* AVRCP 1.4 and up, with Browsing support */
|
||||
} btrc_remote_features_t;
|
||||
|
||||
typedef enum {
|
||||
BTC_AVRC_CTRL_API_INIT_EVT = 0,
|
||||
BTC_AVRC_CTRL_API_DEINIT_EVT,
|
||||
BTC_AVRC_CTRL_API_SND_PTCMD_EVT
|
||||
BTC_AVRC_CTRL_API_SND_PTCMD_EVT,
|
||||
BTC_AVRC_STATUS_API_SND_META_EVT,
|
||||
BTC_AVRC_STATUS_API_SND_PLAY_STATUS_EVT,
|
||||
BTC_AVRC_NOTIFY_API_SND_REG_NOTIFY_EVT,
|
||||
BTC_AVRC_CTRL_API_SET_PLAYER_SETTING_EVT
|
||||
} btc_avrc_act_t;
|
||||
|
||||
typedef struct {
|
||||
@ -48,14 +44,29 @@ typedef struct {
|
||||
uint8_t key_state;
|
||||
} pt_cmd_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t tl;
|
||||
uint8_t attr_mask;
|
||||
} md_cmd_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t tl;
|
||||
uint8_t event_id;
|
||||
uint32_t event_parameter;
|
||||
} rn_cmd_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t tl;
|
||||
uint8_t attr_id;
|
||||
uint8_t value_id;
|
||||
} ps_cmd_t;
|
||||
|
||||
/* btc_avrc_args_t */
|
||||
typedef union {
|
||||
// BTC_AVRC_CTRL_API_SND_PT_CMD_EVT
|
||||
struct {
|
||||
uint8_t tl;
|
||||
uint8_t key_code;
|
||||
uint8_t key_state;
|
||||
} pt_cmd;
|
||||
pt_cmd_t pt_cmd;
|
||||
md_cmd_t md_cmd;
|
||||
rn_cmd_t rn_cmd;
|
||||
ps_cmd_t ps_cmd;
|
||||
} btc_avrc_args_t;
|
||||
|
||||
/** BT-RC Controller callback structure. */
|
||||
|
@ -23,6 +23,7 @@ typedef enum {
|
||||
BTC_BLUFI_ACT_INIT = 0,
|
||||
BTC_BLUFI_ACT_DEINIT,
|
||||
BTC_BLUFI_ACT_SEND_CFG_REPORT,
|
||||
BTC_BLUFI_ACT_SEND_WIFI_LIST,
|
||||
} btc_blufi_act_t;
|
||||
|
||||
typedef union {
|
||||
@ -33,6 +34,13 @@ typedef union {
|
||||
esp_blufi_extra_info_t *extra_info;
|
||||
int extra_info_len;
|
||||
} wifi_conn_report;
|
||||
/*
|
||||
BTC_BLUFI_ACT_SEND_WIFI_LIST
|
||||
*/
|
||||
struct blufi_wifi_list {
|
||||
uint16_t apCount;
|
||||
esp_blufi_ap_record_t *list;
|
||||
} wifi_list;
|
||||
} btc_blufi_args_t;
|
||||
|
||||
void btc_blufi_cb_handler(btc_msg_t *msg);
|
||||
|
@ -15,12 +15,23 @@
|
||||
#ifndef __BTC_GAP_BT_H__
|
||||
#define __BTC_GAP_BT_H__
|
||||
|
||||
#include "bt_target.h"
|
||||
#include "esp_bt_defs.h"
|
||||
#include "esp_gap_bt_api.h"
|
||||
#include "btc_task.h"
|
||||
|
||||
#if (BTC_GAP_BT_INCLUDED == TRUE)
|
||||
|
||||
typedef enum {
|
||||
BTC_GAP_BT_ACT_SET_SCAN_MODE = 0,
|
||||
BTC_GAP_BT_ACT_REG_CB,
|
||||
BTC_GAP_BT_ACT_START_DISCOVERY,
|
||||
BTC_GAP_BT_ACT_SEARCH_DEVICES,
|
||||
BTC_GAP_BT_ACT_CANCEL_DISCOVERY,
|
||||
BTC_GAP_BT_ACT_GET_REMOTE_SERVICES,
|
||||
BTC_GAP_BT_ACT_SEARCH_SERVICES,
|
||||
BTC_GAP_BT_ACT_GET_REMOTE_SERVICE_RECORD,
|
||||
BTC_GAP_BT_ACT_SEARCH_SERVICE_RECORD,
|
||||
} btc_gap_bt_act_t;
|
||||
|
||||
/* btc_bt_gap_args_t */
|
||||
@ -29,10 +40,28 @@ typedef union {
|
||||
struct set_bt_scan_mode_args {
|
||||
esp_bt_scan_mode_t mode;
|
||||
} set_scan_mode;
|
||||
|
||||
// BTC_GAP_BT_ACT_START_DISCOVERY
|
||||
struct start_disc_args {
|
||||
esp_bt_inq_mode_t mode;
|
||||
uint8_t inq_len;
|
||||
uint8_t num_rsps;
|
||||
} start_disc;
|
||||
|
||||
// BTC_BT_GAP_ACT_GET_REMOTE_SERVICES
|
||||
bt_bdaddr_t bda;
|
||||
|
||||
// BTC_BT_GAP_ACT_GET_REMTOE_SERVICE_RECORD
|
||||
struct get_rmt_srv_rcd_args {
|
||||
bt_bdaddr_t bda;
|
||||
esp_bt_uuid_t uuid;
|
||||
} get_rmt_srv_rcd;
|
||||
} btc_gap_bt_args_t;
|
||||
|
||||
void btc_gap_bt_call_handler(btc_msg_t *msg);
|
||||
|
||||
void btc_gap_bt_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src);
|
||||
void btc_gap_bt_busy_level_updated(uint8_t bl_flags);
|
||||
|
||||
#endif /* #if BTC_GAP_BT_INCLUDED */
|
||||
|
||||
#endif /* __BTC_GAP_BT_H__ */
|
||||
|
89
tools/sdk/include/bluedroid/btc_spp.h
Normal file
89
tools/sdk/include/bluedroid/btc_spp.h
Normal file
@ -0,0 +1,89 @@
|
||||
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef __BTC_SPP_H__
|
||||
#define __BTC_SPP_H__
|
||||
|
||||
#include "btc_task.h"
|
||||
#include "esp_bt_defs.h"
|
||||
#include "esp_spp_api.h"
|
||||
#include "bt_target.h"
|
||||
#include "bta_jv_api.h"
|
||||
|
||||
#if (defined BTC_SPP_INCLUDED && BTC_SPP_INCLUDED == TRUE)
|
||||
|
||||
#define ESP_SPP_MAX_SESSION BTA_JV_MAX_RFC_SR_SESSION
|
||||
#define ESP_SPP_SERVER_NAME_MAX 32
|
||||
|
||||
typedef enum {
|
||||
BTC_SPP_ACT_INIT = 0,
|
||||
BTC_SPP_ACT_UNINIT,
|
||||
BTC_SPP_ACT_START_DISCOVERY,
|
||||
BTC_SPP_ACT_CONNECT,
|
||||
BTC_SPP_ACT_DISCONNECT,
|
||||
BTC_SPP_ACT_START_SRV,
|
||||
BTC_SPP_ACT_WRITE,
|
||||
} btc_spp_act_t;
|
||||
|
||||
/* btc_spp_args_t */
|
||||
typedef union {
|
||||
//BTC_SPP_ACT_INIT
|
||||
struct init_arg {
|
||||
} init;
|
||||
//BTC_SPP_ACT_UNINIT
|
||||
struct uninit_arg {
|
||||
} uninit;
|
||||
|
||||
//BTC_SPP_ACT_START_DISCOVERY
|
||||
struct start_discovery_arg {
|
||||
BD_ADDR bd_addr;
|
||||
UINT16 num_uuid;
|
||||
tSDP_UUID *p_uuid_list;
|
||||
} start_discovery;
|
||||
//BTC_SPP_ACT_CONNECT
|
||||
struct connect_arg {
|
||||
esp_spp_sec_t sec_mask;
|
||||
esp_spp_role_t role;
|
||||
UINT8 remote_scn;
|
||||
esp_bd_addr_t peer_bd_addr;
|
||||
} connect;
|
||||
//BTC_SPP_ACT_DISCONNECT
|
||||
struct disconnect_arg {
|
||||
UINT32 handle;
|
||||
} disconnect;
|
||||
//BTC_SPP_ACT_START_SRV
|
||||
struct start_srv_arg {
|
||||
esp_spp_sec_t sec_mask;
|
||||
esp_spp_role_t role;
|
||||
UINT8 local_scn;
|
||||
UINT8 max_session;
|
||||
char name[ESP_SPP_SERVER_NAME_MAX + 1];
|
||||
} start_srv;
|
||||
//BTC_SPP_ACT_WRITE
|
||||
struct write_arg {
|
||||
UINT32 handle;
|
||||
int len;
|
||||
UINT8 *p_data;
|
||||
} write;
|
||||
|
||||
} btc_spp_args_t;
|
||||
|
||||
|
||||
void btc_spp_call_handler(btc_msg_t *msg);
|
||||
void btc_spp_cb_handler(btc_msg_t *msg);
|
||||
void btc_spp_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src);
|
||||
|
||||
|
||||
#endif ///defined BTC_SPP_INCLUDED && BTC_SPP_INCLUDED == TRUE
|
||||
#endif ///__BTC_SPP_H__
|
@ -52,6 +52,7 @@ typedef enum {
|
||||
BTC_PID_PRF_QUE,
|
||||
BTC_PID_A2DP,
|
||||
BTC_PID_AVRC,
|
||||
BTC_PID_SPP,
|
||||
#endif /* CONFIG_CLASSIC_BT_ENABLED */
|
||||
BTC_PID_NUM,
|
||||
} btc_pid_t; //btc profile id
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include <stdbool.h>
|
||||
#include "bt_types.h"
|
||||
#include "bt_defs.h"
|
||||
#include "esp_bt_defs.h"
|
||||
|
||||
/*******************************************************************************
|
||||
** Constants & Macros
|
||||
@ -39,9 +40,8 @@ const char *dump_rc_pdu(UINT8 pdu);
|
||||
|
||||
UINT32 devclass2uint(DEV_CLASS dev_class);
|
||||
void uint2devclass(UINT32 dev, DEV_CLASS dev_class);
|
||||
void uuid16_to_uuid128(uint16_t uuid16, bt_uuid_t *uuid128);
|
||||
void uuid128_be_to_esp_uuid(esp_bt_uuid_t *u, uint8_t* uuid128);
|
||||
|
||||
void uuid_to_string_legacy(bt_uuid_t *p_uuid, char *str);
|
||||
void string_to_uuid(char *str, bt_uuid_t *p_uuid);
|
||||
|
||||
#endif /* __BTC_UTIL_H__ */
|
||||
|
@ -852,6 +852,11 @@ typedef void (*tBLE_SCAN_PARAM_SETUP_CBACK)(tGATT_IF client_if, tBTM_STATUS stat
|
||||
|
||||
tBTM_BLE_SCAN_SETUP_CBACK bta_ble_scan_setup_cb;
|
||||
|
||||
typedef void (tBTM_START_ADV_CMPL_CBACK) (UINT8 status);
|
||||
typedef void (tBTM_START_STOP_ADV_CMPL_CBACK) (UINT8 status);
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
** EXTERNAL FUNCTION DECLARATIONS
|
||||
*****************************************************************************/
|
||||
@ -943,7 +948,7 @@ tBTM_STATUS BTM_BleSetAdvParams(UINT16 adv_int_min, UINT16 adv_int_max,
|
||||
*******************************************************************************/
|
||||
tBTM_STATUS BTM_BleSetAdvParamsStartAdv(UINT16 adv_int_min, UINT16 adv_int_max, UINT8 adv_type,
|
||||
tBLE_ADDR_TYPE own_bda_type, tBLE_BD_ADDR *p_dir_bda,
|
||||
tBTM_BLE_ADV_CHNL_MAP chnl_map, tBTM_BLE_AFP afp);
|
||||
tBTM_BLE_ADV_CHNL_MAP chnl_map, tBTM_BLE_AFP afp, tBTM_START_ADV_CMPL_CBACK *adv_cb);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
@ -1610,7 +1615,7 @@ BOOLEAN BTM_ReadConnectedTransportAddress(BD_ADDR remote_bda,
|
||||
**
|
||||
*******************************************************************************/
|
||||
//extern
|
||||
tBTM_STATUS BTM_BleBroadcast(BOOLEAN start);
|
||||
tBTM_STATUS BTM_BleBroadcast(BOOLEAN start, tBTM_START_STOP_ADV_CMPL_CBACK *p_stop_adv_cback);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
|
@ -147,7 +147,8 @@ typedef struct {
|
||||
UINT16 adv_interval_max;
|
||||
tBTM_BLE_AFP afp; /* advertising filter policy */
|
||||
tBTM_BLE_SFP sfp; /* scanning filter policy */
|
||||
|
||||
tBTM_START_ADV_CMPL_CBACK *p_adv_cb;
|
||||
tBTM_START_STOP_ADV_CMPL_CBACK *p_stop_adv_cb;
|
||||
tBLE_ADDR_TYPE adv_addr_type;
|
||||
UINT8 evt_type;
|
||||
UINT8 adv_mode;
|
||||
@ -319,7 +320,6 @@ typedef struct {
|
||||
UINT32 scan_int;
|
||||
UINT32 scan_win;
|
||||
tBTM_BLE_SEL_CBACK *p_select_cback;
|
||||
|
||||
/* white list information */
|
||||
UINT8 white_list_avail_size;
|
||||
tBTM_ADD_WHITELIST_CBACK *add_wl_cb;
|
||||
|
@ -234,6 +234,7 @@ extern const BD_ADDR BT_BD_ANY;
|
||||
*/
|
||||
void btu_start_timer (TIMER_LIST_ENT *p_tle, UINT16 type, UINT32 timeout);
|
||||
void btu_stop_timer (TIMER_LIST_ENT *p_tle);
|
||||
void btu_free_timer (TIMER_LIST_ENT *p_tle);
|
||||
void btu_start_timer_oneshot(TIMER_LIST_ENT *p_tle, UINT16 type, UINT32 timeout);
|
||||
void btu_stop_timer_oneshot(TIMER_LIST_ENT *p_tle);
|
||||
|
||||
|
@ -69,6 +69,7 @@ typedef struct controller_t {
|
||||
uint16_t (*get_acl_packet_size_ble)(void);
|
||||
|
||||
uint16_t (*get_ble_default_data_packet_length)(void);
|
||||
uint16_t (*get_ble_default_data_packet_txtime)(void);
|
||||
|
||||
// Get the number of acl packets the controller can buffer.
|
||||
uint16_t (*get_acl_buffer_count_classic)(void);
|
||||
|
@ -67,11 +67,28 @@ typedef enum {
|
||||
ESP_A2D_AUDIO_STATE_STARTED, /*!< audio stream datapath started */
|
||||
} esp_a2d_audio_state_t;
|
||||
|
||||
/// A2DP media control command acknowledgement code
|
||||
typedef enum {
|
||||
ESP_A2D_MEDIA_CTRL_ACK_SUCCESS = 0, /*!< media control command is acknowledged with success */
|
||||
ESP_A2D_MEDIA_CTRL_ACK_FAILURE, /*!< media control command is acknowledged with failure */
|
||||
ESP_A2D_MEDIA_CTRL_ACK_BUSY, /*!< media control command is rejected, as previous command is not yet acknowledged */
|
||||
} esp_a2d_media_ctrl_ack_t;
|
||||
|
||||
/// A2DP media control commands
|
||||
typedef enum {
|
||||
ESP_A2D_MEDIA_CTRL_NONE = 0, /*!< dummy command */
|
||||
ESP_A2D_MEDIA_CTRL_CHECK_SRC_RDY, /*!< check whether AVDTP is connected, only used in A2DP source */
|
||||
ESP_A2D_MEDIA_CTRL_START, /*!< command to set up media transmission channel */
|
||||
ESP_A2D_MEDIA_CTRL_STOP, /*!< command to stop media transmission */
|
||||
ESP_A2D_MEDIA_CTRL_SUSPEND, /*!< command to suspend media transmission */
|
||||
} esp_a2d_media_ctrl_t;
|
||||
|
||||
/// A2DP callback events
|
||||
typedef enum {
|
||||
ESP_A2D_CONNECTION_STATE_EVT = 0, /*!< connection state changed event */
|
||||
ESP_A2D_AUDIO_STATE_EVT = 1, /*!< audio stream transmission state changed event */
|
||||
ESP_A2D_AUDIO_CFG_EVT = 2 /*!< audio codec is configured */
|
||||
ESP_A2D_AUDIO_STATE_EVT, /*!< audio stream transmission state changed event */
|
||||
ESP_A2D_AUDIO_CFG_EVT, /*!< audio codec is configured, only used for A2DP SINK */
|
||||
ESP_A2D_MEDIA_CTRL_ACK_EVT, /*!< acknowledge event in response to media control commands */
|
||||
} esp_a2d_cb_event_t;
|
||||
|
||||
/// A2DP state callback parameters
|
||||
@ -84,7 +101,7 @@ typedef union {
|
||||
esp_bd_addr_t remote_bda; /*!< remote bluetooth device address */
|
||||
esp_a2d_disc_rsn_t disc_rsn; /*!< reason of disconnection for "DISCONNECTED" */
|
||||
} conn_stat; /*!< A2DP connection status */
|
||||
|
||||
|
||||
/**
|
||||
* @brief ESP_A2D_AUDIO_STATE_EVT
|
||||
*/
|
||||
@ -92,7 +109,7 @@ typedef union {
|
||||
esp_a2d_audio_state_t state; /*!< one of the values from esp_a2d_audio_state_t */
|
||||
esp_bd_addr_t remote_bda; /*!< remote bluetooth device address */
|
||||
} audio_stat; /*!< audio stream playing state */
|
||||
|
||||
|
||||
/**
|
||||
* @brief ESP_A2D_AUDIO_CFG_EVT
|
||||
*/
|
||||
@ -100,32 +117,52 @@ typedef union {
|
||||
esp_bd_addr_t remote_bda; /*!< remote bluetooth device address */
|
||||
esp_a2d_mcc_t mcc; /*!< A2DP media codec capability information */
|
||||
} audio_cfg; /*!< media codec configuration infomation */
|
||||
|
||||
/**
|
||||
* @brief ESP_A2D_MEDIA_CTRL_ACK_EVT
|
||||
*/
|
||||
struct media_ctrl_stat_param {
|
||||
esp_a2d_media_ctrl_t cmd; /*!< media control commands to acknowledge */
|
||||
esp_a2d_media_ctrl_ack_t status; /*!< acknowledgement to media control commands */
|
||||
} media_ctrl_stat; /*!< status in acknowledgement to media control commands */
|
||||
} esp_a2d_cb_param_t;
|
||||
|
||||
/**
|
||||
* @brief A2DP profile callback function type
|
||||
*
|
||||
* @param event : Event type
|
||||
*
|
||||
* @param param : Pointer to callback parameter
|
||||
*/
|
||||
typedef void (* esp_a2d_cb_t)(esp_a2d_cb_event_t event, esp_a2d_cb_param_t *param);
|
||||
|
||||
/**
|
||||
* @brief A2DP profile data callback function
|
||||
*
|
||||
* @param[in] buf : data received from A2DP source device and is PCM format decoder from SBC decoder;
|
||||
* buf references to a static memory block and can be overwritten by upcoming data
|
||||
*
|
||||
* @param[in] len : size(in bytes) in buf
|
||||
*/
|
||||
typedef void (* esp_a2d_sink_data_cb_t)(const uint8_t *buf, uint32_t len);
|
||||
|
||||
/**
|
||||
* @brief A2DP source data read callback function
|
||||
*
|
||||
* @param[in] buf : buffer to be filled with PCM data stream from higer layer
|
||||
*
|
||||
* @param[in] len : size(in bytes) of data block to be copied to buf. -1 is an indication to user
|
||||
* that data buffer shall be flushed
|
||||
*
|
||||
* @return size of bytes read successfully, if the argumetn len is -1, this value is ignored.
|
||||
*
|
||||
*/
|
||||
typedef void (* esp_a2d_data_cb_t)(const uint8_t *buf, uint32_t len);
|
||||
|
||||
typedef int32_t (* esp_a2d_source_data_cb_t)(uint8_t *buf, int32_t len);
|
||||
|
||||
/**
|
||||
* @brief Register application callback function to A2DP module. This function should be called
|
||||
* only after esp_bluedroid_enable() completes successfully
|
||||
*
|
||||
* @param[in] callback: A2DP sink event callback function
|
||||
* only after esp_bluedroid_enable() completes successfully, used by both A2DP source
|
||||
* and sink.
|
||||
*
|
||||
* @param[in] callback: A2DP event callback function
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
@ -138,10 +175,10 @@ esp_err_t esp_a2d_register_callback(esp_a2d_cb_t callback);
|
||||
|
||||
/**
|
||||
* @brief Register A2DP sink data output function; For now the output is PCM data stream decoded
|
||||
* from SBC format. This function should be called only after esp_bluedroid_enable()
|
||||
* completes successfully
|
||||
*
|
||||
* @param[in] callback: A2DP data callback function
|
||||
* from SBC format. This function should be called only after esp_bluedroid_enable()
|
||||
* completes successfully, used only by A2DP sink.
|
||||
*
|
||||
* @param[in] callback: A2DP sink data callback function
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
@ -149,7 +186,7 @@ esp_err_t esp_a2d_register_callback(esp_a2d_cb_t callback);
|
||||
* - ESP_FAIL: if callback is a NULL function pointer
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_a2d_register_data_callback(esp_a2d_data_cb_t callback);
|
||||
esp_err_t esp_a2d_sink_register_data_callback(esp_a2d_sink_data_cb_t callback);
|
||||
|
||||
|
||||
/**
|
||||
@ -157,7 +194,7 @@ esp_err_t esp_a2d_register_data_callback(esp_a2d_data_cb_t callback);
|
||||
* @brief Initialize the bluetooth A2DP sink module. This function should be called
|
||||
* after esp_bluedroid_enable() completes successfully
|
||||
*
|
||||
* @return
|
||||
* @return
|
||||
* - ESP_OK: if the initialization request is sent successfully
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
@ -168,10 +205,10 @@ esp_err_t esp_a2d_sink_init(void);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief De-initialize for A2DP sink module. This function
|
||||
* @brief De-initialize for A2DP sink module. This function
|
||||
* should be called only after esp_bluedroid_enable() completes successfully
|
||||
*
|
||||
* @return
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
@ -182,11 +219,11 @@ esp_err_t esp_a2d_sink_deinit(void);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Connect the remote bluetooth device bluetooth, must after esp_a2d_sink_init()
|
||||
* @brief Connect to remote bluetooth A2DP source device, must after esp_a2d_sink_init()
|
||||
*
|
||||
* @param[in] remote_bda: remote bluetooth device address
|
||||
*
|
||||
* @return
|
||||
* @return
|
||||
* - ESP_OK: connect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
@ -197,10 +234,10 @@ esp_err_t esp_a2d_sink_connect(esp_bd_addr_t remote_bda);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Disconnect the remote bluetooth device
|
||||
* @brief Disconnect from the remote A2DP source device
|
||||
*
|
||||
* @param[in] remote_bda: remote bluetooth device address
|
||||
* @return
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
@ -208,6 +245,93 @@ esp_err_t esp_a2d_sink_connect(esp_bd_addr_t remote_bda);
|
||||
*/
|
||||
esp_err_t esp_a2d_sink_disconnect(esp_bd_addr_t remote_bda);
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief media control commands; this API can be used for both A2DP sink and source
|
||||
*
|
||||
* @param[in] ctrl: control commands for A2DP data channel
|
||||
* @return
|
||||
* - ESP_OK: control command is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_a2d_media_ctrl(esp_a2d_media_ctrl_t ctrl);
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Initialize the bluetooth A2DP source module. This function should be called
|
||||
* after esp_bluedroid_enable() completes successfully
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: if the initialization request is sent successfully
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_a2d_source_init(void);
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief De-initialize for A2DP source module. This function
|
||||
* should be called only after esp_bluedroid_enable() completes successfully
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_a2d_source_deinit(void);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Register A2DP source data input function; For now the input is PCM data stream.
|
||||
* This function should be called only after esp_bluedroid_enable() completes
|
||||
* successfully
|
||||
*
|
||||
* @param[in] callback: A2DP source data callback function
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: if callback is a NULL function pointer
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_a2d_source_register_data_callback(esp_a2d_source_data_cb_t callback);
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Connect to remote A2DP sink device, must after esp_a2d_source_init()
|
||||
*
|
||||
* @param[in] remote_bda: remote bluetooth device address
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: connect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_a2d_source_connect(esp_bd_addr_t remote_bda);
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Disconnect from the remote A2DP sink device
|
||||
*
|
||||
* @param[in] remote_bda: remote bluetooth device address
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_a2d_source_disconnect(esp_bd_addr_t remote_bda);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -40,7 +40,9 @@ typedef enum {
|
||||
ESP_AVRC_PT_CMD_STOP = 0x45, /*!< stop */
|
||||
ESP_AVRC_PT_CMD_PAUSE = 0x46, /*!< pause */
|
||||
ESP_AVRC_PT_CMD_FORWARD = 0x4B, /*!< forward */
|
||||
ESP_AVRC_PT_CMD_BACKWARD = 0x4C /*!< backward */
|
||||
ESP_AVRC_PT_CMD_BACKWARD = 0x4C, /*!< backward */
|
||||
ESP_AVRC_PT_CMD_REWIND = 0x48, /*!< rewind */
|
||||
ESP_AVRC_PT_CMD_FAST_FORWARD = 0x49 /*!< fast forward */
|
||||
} esp_avrc_pt_cmd_t;
|
||||
|
||||
/// AVRC passthrough command state
|
||||
@ -53,9 +55,73 @@ typedef enum {
|
||||
typedef enum {
|
||||
ESP_AVRC_CT_CONNECTION_STATE_EVT = 0, /*!< connection state changed event */
|
||||
ESP_AVRC_CT_PASSTHROUGH_RSP_EVT = 1, /*!< passthrough response event */
|
||||
ESP_AVRC_CT_MAX_EVT
|
||||
ESP_AVRC_CT_METADATA_RSP_EVT = 2, /*!< metadata response event */
|
||||
ESP_AVRC_CT_PLAY_STATUS_RSP_EVT = 3, /*!< play status response event */
|
||||
ESP_AVRC_CT_CHANGE_NOTIFY_EVT = 4, /*!< notification event */
|
||||
ESP_AVRC_CT_REMOTE_FEATURES_EVT = 5, /*!< feature of remote device indication event */
|
||||
} esp_avrc_ct_cb_event_t;
|
||||
|
||||
/// AVRC metadata attribute mask
|
||||
typedef enum {
|
||||
ESP_AVRC_MD_ATTR_TITLE = 0x1, /*!< title of the playing track */
|
||||
ESP_AVRC_MD_ATTR_ARTIST = 0x2, /*!< track artist */
|
||||
ESP_AVRC_MD_ATTR_ALBUM = 0x4, /*!< album name */
|
||||
ESP_AVRC_MD_ATTR_TRACK_NUM = 0x8, /*!< track position on the album */
|
||||
ESP_AVRC_MD_ATTR_NUM_TRACKS = 0x10, /*!< number of tracks on the album */
|
||||
ESP_AVRC_MD_ATTR_GENRE = 0x20, /*!< track genre */
|
||||
ESP_AVRC_MD_ATTR_PLAYING_TIME = 0x40 /*!< total album playing time in miliseconds */
|
||||
} esp_avrc_md_attr_mask_t;
|
||||
|
||||
/// AVRC event notification ids
|
||||
typedef enum {
|
||||
ESP_AVRC_RN_PLAY_STATUS_CHANGE = 0x01, /*!< track status change, eg. from playing to paused */
|
||||
ESP_AVRC_RN_TRACK_CHANGE = 0x02, /*!< new track is loaded */
|
||||
ESP_AVRC_RN_TRACK_REACHED_END = 0x03, /*!< current track reached end */
|
||||
ESP_AVRC_RN_TRACK_REACHED_START = 0x04, /*!< current track reached start position */
|
||||
ESP_AVRC_RN_PLAY_POS_CHANGED = 0x05, /*!< track playing position changed */
|
||||
ESP_AVRC_RN_BATTERY_STATUS_CHANGE = 0x06, /*!< battery status changed */
|
||||
ESP_AVRC_RN_SYSTEM_STATUS_CHANGE = 0x07, /*!< system status changed */
|
||||
ESP_AVRC_RN_APP_SETTING_CHANGE = 0x08, /*!< application settings changed */
|
||||
ESP_AVRC_RN_MAX_EVT
|
||||
} esp_avrc_rn_event_ids_t;
|
||||
|
||||
/// AVRC player setting ids
|
||||
typedef enum {
|
||||
ESP_AVRC_PS_EQUALIZER = 0x01, /*!< equalizer, on or off */
|
||||
ESP_AVRC_PS_REPEAT_MODE = 0x02, /*!< repeat mode */
|
||||
ESP_AVRC_PS_SHUFFLE_MODE = 0x03, /*!< shuffle mode */
|
||||
ESP_AVRC_PS_SCAN_MODE = 0x04, /*!< scan mode on or off */
|
||||
ESP_AVRC_PS_MAX_ATTR
|
||||
} esp_avrc_ps_attr_ids_t;
|
||||
|
||||
/// AVRC equalizer modes
|
||||
typedef enum {
|
||||
ESP_AVRC_PS_EQUALIZER_OFF = 0x1, /*!< equalizer OFF */
|
||||
ESP_AVRC_PS_EQUALIZER_ON = 0x2 /*!< equalizer ON */
|
||||
} esp_avrc_ps_eq_value_ids_t;
|
||||
|
||||
/// AVRC repeat modes
|
||||
typedef enum {
|
||||
ESP_AVRC_PS_REPEAT_OFF = 0x1, /*!< repeat mode off */
|
||||
ESP_AVRC_PS_REPEAT_SINGLE = 0x2, /*!< single track repeat */
|
||||
ESP_AVRC_PS_REPEAT_GROUP = 0x3 /*!< group repeat */
|
||||
} esp_avrc_ps_rpt_value_ids_t;
|
||||
|
||||
|
||||
/// AVRC shuffle modes
|
||||
typedef enum {
|
||||
ESP_AVRC_PS_SHUFFLE_OFF = 0x1, /*<! shuffle off */
|
||||
ESP_AVRC_PS_SHUFFLE_ALL = 0x2, /*<! all trackes shuffle */
|
||||
ESP_AVRC_PS_SHUFFLE_GROUP = 0x3 /*<! group shuffle */
|
||||
} esp_avrc_ps_shf_value_ids_t;
|
||||
|
||||
/// AVRC scan modes
|
||||
typedef enum {
|
||||
ESP_AVRC_PS_SCAN_OFF = 0x1, /*!< scan off */
|
||||
ESP_AVRC_PS_SCAN_ALL = 0x2, /*!< all tracks scan */
|
||||
ESP_AVRC_PS_SCAN_GROUP = 0x3 /*!< group scan */
|
||||
} esp_avrc_ps_scn_value_ids_t;
|
||||
|
||||
/// AVRC controller callback parameters
|
||||
typedef union {
|
||||
/**
|
||||
@ -63,10 +129,9 @@ typedef union {
|
||||
*/
|
||||
struct avrc_ct_conn_stat_param {
|
||||
bool connected; /*!< whether AVRC connection is set up */
|
||||
uint32_t feat_mask; /*!< AVRC feature mask of remote device */
|
||||
esp_bd_addr_t remote_bda; /*!< remote bluetooth device address */
|
||||
} conn_stat; /*!< AVRC connection status */
|
||||
|
||||
|
||||
/**
|
||||
* @brief ESP_AVRC_CT_PASSTHROUGH_RSP_EVT
|
||||
*/
|
||||
@ -75,6 +140,32 @@ typedef union {
|
||||
uint8_t key_code; /*!< passthrough command code */
|
||||
uint8_t key_state; /*!< 0 for PRESSED, 1 for RELEASED */
|
||||
} psth_rsp; /*!< passthrough command response */
|
||||
|
||||
/**
|
||||
* @brief ESP_AVRC_CT_METADATA_RSP_EVT
|
||||
*/
|
||||
struct avrc_ct_meta_rsp_param {
|
||||
uint8_t attr_id; /*!< id of metadata attribute */
|
||||
uint8_t *attr_text; /*!< attribute itself */
|
||||
int attr_length; /*!< attribute character length */
|
||||
} meta_rsp; /*!< metadata attributes response */
|
||||
|
||||
/**
|
||||
* @brief ESP_AVRC_CT_CHANGE_NOTIFY_EVT
|
||||
*/
|
||||
struct avrc_ct_change_notify_param {
|
||||
uint8_t event_id; /*!< id of AVRC event notification */
|
||||
uint32_t event_parameter; /*!< event notification parameter */
|
||||
} change_ntf; /*!< notifications */
|
||||
|
||||
/**
|
||||
* @brief ESP_AVRC_CT_REMOTE_FEATURES_EVT
|
||||
*/
|
||||
struct avrc_ct_rmt_feats_param {
|
||||
uint32_t feat_mask; /*!< AVRC feature mask of remote device */
|
||||
esp_bd_addr_t remote_bda; /*!< remote bluetooth device address */
|
||||
} rmt_feats; /*!< AVRC features discovered from remote SDP server */
|
||||
|
||||
} esp_avrc_ct_cb_param_t;
|
||||
|
||||
|
||||
@ -88,9 +179,9 @@ typedef void (* esp_avrc_ct_cb_t)(esp_avrc_ct_cb_event_t event, esp_avrc_ct_cb_p
|
||||
|
||||
/**
|
||||
* @brief Register application callbacks to AVRCP module; for now only AVRCP Controller
|
||||
* role is supported. This function should be called after esp_bluedroid_enable()
|
||||
* role is supported. This function should be called after esp_bluedroid_enable()
|
||||
* completes successfully
|
||||
*
|
||||
*
|
||||
* @param[in] callback: AVRCP controller callback function
|
||||
*
|
||||
* @return
|
||||
@ -107,7 +198,7 @@ esp_err_t esp_avrc_ct_register_callback(esp_avrc_ct_cb_t callback);
|
||||
* @brief Initialize the bluetooth AVRCP controller module, This function should be called
|
||||
* after esp_bluedroid_enable() completes successfully
|
||||
*
|
||||
* @return
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
@ -121,13 +212,57 @@ esp_err_t esp_avrc_ct_init(void);
|
||||
* @brief De-initialize AVRCP controller module. This function should be called after
|
||||
* after esp_bluedroid_enable() completes successfully
|
||||
*
|
||||
* @return
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*/
|
||||
esp_err_t esp_avrc_ct_deinit(void);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Send player application settings command to AVRCP target. This function should be called
|
||||
* after ESP_AVRC_CT_CONNECTION_STATE_EVT is received and AVRCP connection is established.
|
||||
*
|
||||
* @param[in] tl : transaction label, 0 to 15, consecutive commands should use different values.
|
||||
* @param[in] attr_id : player application setting attribute IDs from one of esp_avrc_ps_attr_ids_t
|
||||
* @param[in] value_id : attribute value defined for the specific player application setting attribute
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*/
|
||||
esp_err_t esp_avrc_ct_send_set_player_value_cmd(uint8_t tl, uint8_t attr_id, uint8_t value_id);
|
||||
|
||||
/**
|
||||
* @brief Send register notification command to AVRCP target, This function should be called after
|
||||
* ESP_AVRC_CT_CONNECTION_STATE_EVT is received and AVRCP connection is established
|
||||
*
|
||||
* @param[in] tl : transaction label, 0 to 15, consecutive commands should use different values.
|
||||
* @param[in] event_id : id of events, e.g. ESP_AVRC_RN_PLAY_STATUS_CHANGE, ESP_AVRC_RN_TRACK_CHANGE, etc.
|
||||
* @param[in] event_parameter : special parameters, eg. playback interval for ESP_AVRC_RN_PLAY_POS_CHANGED
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*/
|
||||
esp_err_t esp_avrc_ct_send_register_notification_cmd(uint8_t tl, uint8_t event_id, uint32_t event_parameter);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Send metadata command to AVRCP target, This function should be called after
|
||||
* ESP_AVRC_CT_CONNECTION_STATE_EVT is received and AVRCP connection is established
|
||||
*
|
||||
* @param[in] tl : transaction label, 0 to 15, consecutive commands should use different values.
|
||||
* @param[in] attr_mask : mask of attributes, e.g. ESP_AVRC_MD_ATTR_ID_TITLE | ESP_AVRC_MD_ATTR_ID_ARTIST.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*/
|
||||
esp_err_t esp_avrc_ct_send_metadata_cmd(uint8_t tl, uint8_t attr_mask);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Send passthrough command to AVRCP target, This function should be called after
|
||||
@ -138,7 +273,7 @@ esp_err_t esp_avrc_ct_deinit(void);
|
||||
* @param[in] key_state : passthrough command key state, ESP_AVRC_PT_CMD_STATE_PRESSED or
|
||||
* ESP_AVRC_PT_CMD_STATE_RELEASED
|
||||
*
|
||||
* @return
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
|
@ -50,6 +50,7 @@ typedef enum {
|
||||
ESP_BLUFI_EVENT_RECV_CLIENT_PRIV_KEY, /*<! When Phone send Client Private key to ESP32, this event happen */
|
||||
ESP_BLUFI_EVENT_RECV_SERVER_PRIV_KEY, /*<! When Phone send Server Private key to ESP32, this event happen */
|
||||
ESP_BLUFI_EVENT_RECV_SLAVE_DISCONNECT_BLE, /*<! When Phone send Disconnect key to ESP32, this event happen */
|
||||
ESP_BLUFI_EVENT_GET_WIFI_LIST, /*<! When Phone send get wifi list command to ESP32, this event happen */
|
||||
} esp_blufi_cb_event_t;
|
||||
|
||||
/// BLUFI config status
|
||||
@ -61,13 +62,13 @@ typedef enum {
|
||||
/// BLUFI init status
|
||||
typedef enum {
|
||||
ESP_BLUFI_INIT_OK = 0,
|
||||
ESP_BLUFI_INIT_FAILED = 0,
|
||||
ESP_BLUFI_INIT_FAILED,
|
||||
} esp_blufi_init_state_t;
|
||||
|
||||
/// BLUFI deinit status
|
||||
typedef enum {
|
||||
ESP_BLUFI_DEINIT_OK = 0,
|
||||
ESP_BLUFI_DEINIT_FAILED = 0,
|
||||
ESP_BLUFI_DEINIT_FAILED,
|
||||
} esp_blufi_deinit_state_t;
|
||||
|
||||
/**
|
||||
@ -93,6 +94,12 @@ typedef struct {
|
||||
bool softap_channel_set; /*!< is channel of softap interface set */
|
||||
} esp_blufi_extra_info_t;
|
||||
|
||||
/** @brief Description of an WiFi AP */
|
||||
typedef struct {
|
||||
uint8_t ssid[33]; /**< SSID of AP */
|
||||
int8_t rssi; /**< signal strength of AP */
|
||||
} esp_blufi_ap_record_t;
|
||||
|
||||
/**
|
||||
* @brief BLUFI callback parameters union
|
||||
*/
|
||||
@ -347,6 +354,17 @@ esp_err_t esp_blufi_profile_deinit(void);
|
||||
*/
|
||||
esp_err_t esp_blufi_send_wifi_conn_report(wifi_mode_t opmode, esp_blufi_sta_conn_state_t sta_conn_state, uint8_t softap_conn_num, esp_blufi_extra_info_t *extra_info);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief This function is called to send wifi list
|
||||
* @param apCount : wifi list count
|
||||
* @param list : wifi list
|
||||
*
|
||||
* @return ESP_OK - success, other - failed
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_blufi_send_wifi_list(uint16_t apCount, esp_blufi_ap_record_t *list);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Get BLUFI profile version
|
||||
|
@ -51,6 +51,7 @@ typedef enum {
|
||||
ESP_BT_STATUS_PEER_LE_DATA_LEN_UNSUPPORTED, /* relate to BTM_PEER_LE_DATA_LEN_UNSUPPORTED in btm_api.h */
|
||||
ESP_BT_STATUS_CONTROL_LE_DATA_LEN_UNSUPPORTED,/* relate to BTM_CONTROL_LE_DATA_LEN_UNSUPPORTED in btm_api.h */
|
||||
ESP_BT_STATUS_ERR_ILLEGAL_PARAMETER_FMT, /* relate to HCI_ERR_ILLEGAL_PARAMETER_FMT in hcidefs.h */
|
||||
ESP_BT_STATUS_MEMORY_FULL, /* relate to BT_STATUS_MEMORY_FULL in bt_def.h */
|
||||
} esp_bt_status_t;
|
||||
|
||||
|
||||
|
@ -97,9 +97,11 @@ typedef enum {
|
||||
ESP_GAP_BLE_CLEAR_BOND_DEV_COMPLETE_EVT, /*!< When clear the bond device clear complete, the event comes */
|
||||
ESP_GAP_BLE_GET_BOND_DEV_COMPLETE_EVT, /*!< When get the bond device list complete, the event comes */
|
||||
ESP_GAP_BLE_READ_RSSI_COMPLETE_EVT, /*!< When read the rssi complete, the event comes */
|
||||
ESP_GAP_BLE_ADD_WHITELIST_COMPLETE_EVT, /*!< When add or remove whitelist complete, the event comes */
|
||||
ESP_GAP_BLE_UPDATE_WHITELIST_COMPLETE_EVT, /*!< When add or remove whitelist complete, the event comes */
|
||||
ESP_GAP_BLE_EVT_MAX,
|
||||
} esp_gap_ble_cb_event_t;
|
||||
/// This is the old name, just for backwards compatibility
|
||||
#define ESP_GAP_BLE_ADD_WHITELIST_COMPLETE_EVT ESP_GAP_BLE_UPDATE_WHITELIST_COMPLETE_EVT
|
||||
|
||||
/// Advertising data maximum length
|
||||
#define ESP_BLE_ADV_DATA_LEN_MAX 31
|
||||
@ -239,7 +241,7 @@ typedef struct {
|
||||
uint8_t flag; /*!< Advertising flag of discovery mode, see BLE_ADV_DATA_FLAG detail */
|
||||
} esp_ble_adv_data_t;
|
||||
|
||||
/// Ble scan type
|
||||
/// Ble scan type
|
||||
typedef enum {
|
||||
BLE_SCAN_TYPE_PASSIVE = 0x0, /*!< Passive scan */
|
||||
BLE_SCAN_TYPE_ACTIVE = 0x1, /*!< Active scan */
|
||||
@ -249,7 +251,7 @@ typedef enum {
|
||||
typedef enum {
|
||||
BLE_SCAN_FILTER_ALLOW_ALL = 0x0, /*!< Accept all :
|
||||
1. advertisement packets except directed advertising packets not addressed to this device (default). */
|
||||
BLE_SCAN_FILTER_ALLOW_ONLY_WLST = 0x1, /*!< Accept only :
|
||||
BLE_SCAN_FILTER_ALLOW_ONLY_WLST = 0x1, /*!< Accept only :
|
||||
1. advertisement packets from devices where the advertiser’s address is in the White list.
|
||||
2. Directed advertising packets which are not addressed for this device shall be ignored. */
|
||||
BLE_SCAN_FILTER_ALLOW_UND_RPA_DIR = 0x2, /*!< Accept all :
|
||||
@ -312,7 +314,7 @@ typedef struct
|
||||
} esp_ble_penc_keys_t; /*!< The key type*/
|
||||
|
||||
/**
|
||||
* @brief BLE CSRK keys
|
||||
* @brief BLE CSRK keys
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
@ -322,7 +324,7 @@ typedef struct
|
||||
} esp_ble_pcsrk_keys_t; /*!< The pcsrk key type */
|
||||
|
||||
/**
|
||||
* @brief BLE pid keys
|
||||
* @brief BLE pid keys
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
@ -354,7 +356,7 @@ typedef struct
|
||||
} esp_ble_lcsrk_keys; /*!< The csrk key type */
|
||||
|
||||
/**
|
||||
* @brief Structure associated with ESP_KEY_NOTIF_EVT
|
||||
* @brief Structure associated with ESP_KEY_NOTIF_EVT
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
@ -476,7 +478,7 @@ typedef enum {
|
||||
typedef enum{
|
||||
ESP_BLE_WHITELIST_REMOVE = 0X00, /*!< remove mac from whitelist */
|
||||
ESP_BLE_WHITELIST_ADD = 0X01, /*!< add address to whitelist */
|
||||
}esp_ble_wl_opration;
|
||||
}esp_ble_wl_opration_t;
|
||||
/**
|
||||
* @brief Gap callback parameters union
|
||||
*/
|
||||
@ -486,7 +488,7 @@ typedef union {
|
||||
*/
|
||||
struct ble_adv_data_cmpl_evt_param {
|
||||
esp_bt_status_t status; /*!< Indicate the set advertising data operation success status */
|
||||
} adv_data_cmpl; /*!< Event parameter of ESP_GAP_BLE_ADV_DATA_SET_COMPLETE_EVT */
|
||||
} adv_data_cmpl; /*!< Event parameter of ESP_GAP_BLE_ADV_DATA_SET_COMPLETE_EVT */
|
||||
/**
|
||||
* @brief ESP_GAP_BLE_SCAN_RSP_DATA_SET_COMPLETE_EVT
|
||||
*/
|
||||
@ -520,7 +522,7 @@ typedef union {
|
||||
*/
|
||||
struct ble_adv_data_raw_cmpl_evt_param {
|
||||
esp_bt_status_t status; /*!< Indicate the set raw advertising data operation success status */
|
||||
} adv_data_raw_cmpl; /*!< Event parameter of ESP_GAP_BLE_ADV_DATA_RAW_SET_COMPLETE_EVT */
|
||||
} adv_data_raw_cmpl; /*!< Event parameter of ESP_GAP_BLE_ADV_DATA_RAW_SET_COMPLETE_EVT */
|
||||
/**
|
||||
* @brief ESP_GAP_BLE_SCAN_RSP_DATA_RAW_SET_COMPLETE_EVT
|
||||
*/
|
||||
@ -616,12 +618,12 @@ typedef union {
|
||||
esp_bd_addr_t remote_addr; /*!< The remote device address */
|
||||
} read_rssi_cmpl; /*!< Event parameter of ESP_GAP_BLE_READ_RSSI_COMPLETE_EVT */
|
||||
/**
|
||||
* @brief ESP_GAP_BLE_ADD_WHITELIST_COMPLETE_EVT
|
||||
* @brief ESP_GAP_BLE_UPDATE_WHITELIST_COMPLETE_EVT
|
||||
*/
|
||||
struct ble_add_whitelist_cmpl_evt_param {
|
||||
struct ble_update_whitelist_cmpl_evt_param {
|
||||
esp_bt_status_t status; /*!< Indicate the add or remove whitelist operation success status */
|
||||
esp_ble_wl_opration wl_opration; /*!< The value is ESP_BLE_WHITELIST_ADD if add address to whitelist operation success, ESP_BLE_WHITELIST_REMOVE if remove address from the whitelist operation success */
|
||||
} add_whitelist_cmpl; /*!< Event parameter of ESP_GAP_BLE_ADD_WHITELIST_COMPLETE_EVT */
|
||||
esp_ble_wl_opration_t wl_opration; /*!< The value is ESP_BLE_WHITELIST_ADD if add address to whitelist operation success, ESP_BLE_WHITELIST_REMOVE if remove address from the whitelist operation success */
|
||||
} update_whitelist_cmpl; /*!< Event parameter of ESP_GAP_BLE_UPDATE_WHITELIST_COMPLETE_EVT */
|
||||
} esp_ble_gap_cb_param_t;
|
||||
|
||||
/**
|
||||
@ -983,7 +985,7 @@ int esp_ble_get_bond_device_num(void);
|
||||
* Suggest that dev_num value equal to esp_ble_get_bond_device_num().
|
||||
*
|
||||
* @param[out] dev_list: an array(buffer) of `esp_ble_bond_dev_t` type. Use for storing the bonded devices address.
|
||||
* The dev_list should be allocated by who call this API.
|
||||
* The dev_list should be allocated by who call this API.
|
||||
* @return - ESP_OK : success
|
||||
* - other : failed
|
||||
*
|
||||
|
@ -28,9 +28,227 @@ extern "C" {
|
||||
typedef enum {
|
||||
ESP_BT_SCAN_MODE_NONE = 0, /*!< Neither discoverable nor connectable */
|
||||
ESP_BT_SCAN_MODE_CONNECTABLE, /*!< Connectable but not discoverable */
|
||||
ESP_BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE /*!< both discoverable and connectaable */
|
||||
ESP_BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE /*!< both discoverable and connectable */
|
||||
} esp_bt_scan_mode_t;
|
||||
|
||||
/// Bluetooth Device Property type
|
||||
typedef enum {
|
||||
ESP_BT_GAP_DEV_PROP_BDNAME = 1, /*!< Bluetooth device name, value type is int8_t [] */
|
||||
ESP_BT_GAP_DEV_PROP_COD, /*!< Class of Device, value type is uint32_t */
|
||||
ESP_BT_GAP_DEV_PROP_RSSI, /*!< Received Signal strength Indication, value type is int8_t, ranging from -128 to 127 */
|
||||
ESP_BT_GAP_DEV_PROP_EIR, /*!< Extended Inquiry Response, value type is uint8_t [] */
|
||||
} esp_bt_gap_dev_prop_type_t;
|
||||
|
||||
/// Maximum bytes of Bluetooth device name
|
||||
#define ESP_BT_GAP_MAX_BDNAME_LEN (248)
|
||||
|
||||
/// Maximum size of EIR Significant part
|
||||
#define ESP_BT_GAP_EIR_DATA_LEN (240)
|
||||
|
||||
/// Bluetooth Device Property Descriptor
|
||||
typedef struct {
|
||||
esp_bt_gap_dev_prop_type_t type; /*!< device property type */
|
||||
int len; /*!< device property value length */
|
||||
void *val; /*!< devlice prpoerty value */
|
||||
} esp_bt_gap_dev_prop_t;
|
||||
|
||||
/// Extended Inquiry Response data type
|
||||
typedef enum {
|
||||
ESP_BT_EIR_TYPE_FLAGS = 0x01, /*!< Flag with information such as BR/EDR and LE support */
|
||||
ESP_BT_EIR_TYPE_INCMPL_16BITS_UUID = 0x02, /*!< Incomplete list of 16-bit service UUIDs */
|
||||
ESP_BT_EIR_TYPE_CMPL_16BITS_UUID = 0x03, /*!< Complete list of 16-bit service UUIDs */
|
||||
ESP_BT_EIR_TYPE_INCMPL_32BITS_UUID = 0x04, /*!< Incomplete list of 32-bit service UUIDs */
|
||||
ESP_BT_EIR_TYPE_CMPL_32BITS_UUID = 0x05, /*!< Complete list of 32-bit service UUIDs */
|
||||
ESP_BT_EIR_TYPE_INCMPL_128BITS_UUID = 0x06, /*!< Incomplete list of 128-bit service UUIDs */
|
||||
ESP_BT_EIR_TYPE_CMPL_128BITS_UUID = 0x07, /*!< Complete list of 128-bit service UUIDs */
|
||||
ESP_BT_EIR_TYPE_SHORT_LOCAL_NAME = 0x08, /*!< Shortened Local Name */
|
||||
ESP_BT_EIR_TYPE_CMPL_LOCAL_NAME = 0x09, /*!< Complete Local Name */
|
||||
ESP_BT_EIR_TYPE_TX_POWER_LEVEL = 0x0a, /*!< Tx power level, value is 1 octet ranging from -127 to 127, unit is dBm*/
|
||||
ESP_BT_EIR_TYPE_MANU_SPECIFIC = 0xff, /*!< Manufacturer specific data */
|
||||
} esp_bt_eir_type_t;
|
||||
|
||||
/// Major service class field of Class of Device, mutiple bits can be set
|
||||
typedef enum {
|
||||
ESP_BT_COD_SRVC_NONE = 0, /*!< None indicates an invalid value */
|
||||
ESP_BT_COD_SRVC_LMTD_DISCOVER = 0x1, /*!< Limited Discoverable Mode */
|
||||
ESP_BT_COD_SRVC_POSITIONING = 0x8, /*!< Positioning (Location identification) */
|
||||
ESP_BT_COD_SRVC_NETWORKING = 0x10, /*!< Networking, e.g. LAN, Ad hoc */
|
||||
ESP_BT_COD_SRVC_RENDERING = 0x20, /*!< Rendering, e.g. Printing, Speakers */
|
||||
ESP_BT_COD_SRVC_CAPTURING = 0x40, /*!< Capturing, e.g. Scanner, Microphone */
|
||||
ESP_BT_COD_SRVC_OBJ_TRANSFER = 0x80, /*!< Object Transfer, e.g. v-Inbox, v-Folder */
|
||||
ESP_BT_COD_SRVC_AUDIO = 0x100, /*!< Audio, e.g. Speaker, Microphone, Headerset service */
|
||||
ESP_BT_COD_SRVC_TELEPHONY = 0x200, /*!< Telephony, e.g. Cordless telephony, Modem, Headset service */
|
||||
ESP_BT_COD_SRVC_INFORMATION = 0x400, /*!< Information, e.g., WEB-server, WAP-server */
|
||||
} esp_bt_cod_srvc_t;
|
||||
|
||||
/// Bits of major service class field
|
||||
#define ESP_BT_COD_SRVC_BIT_MASK (0xffe000) /*!< Major service bit mask */
|
||||
#define ESP_BT_COD_SRVC_BIT_OFFSET (13) /*!< Major service bit offset */
|
||||
|
||||
/// Major device class field of Class of Device
|
||||
typedef enum {
|
||||
ESP_BT_COD_MAJOR_DEV_MISC = 0, /*!< Miscellaneous */
|
||||
ESP_BT_COD_MAJOR_DEV_COMPUTER = 1, /*!< Computer */
|
||||
ESP_BT_COD_MAJOR_DEV_PHONE = 2, /*!< Phone(cellular, cordless, pay phone, modem */
|
||||
ESP_BT_COD_MAJOR_DEV_LAN_NAP = 3, /*!< LAN, Network Access Point */
|
||||
ESP_BT_COD_MAJOR_DEV_AV = 4, /*!< Audio/Video(headset, speaker, stereo, video display, VCR */
|
||||
ESP_BT_COD_MAJOR_DEV_PERIPHERAL = 5, /*!< Peripheral(mouse, joystick, keyboard) */
|
||||
ESP_BT_COD_MAJOR_DEV_IMAGING = 6, /*!< Imaging(printer, scanner, camera, display */
|
||||
ESP_BT_COD_MAJOR_DEV_WEARABLE = 7, /*!< Wearable */
|
||||
ESP_BT_COD_MAJOR_DEV_TOY = 8, /*!< Toy */
|
||||
ESP_BT_COD_MAJOR_DEV_HEALTH = 9, /*!< Health */
|
||||
ESP_BT_COD_MAJOR_DEV_UNCATEGORIZED = 31, /*!< Uncategorized: device not specified */
|
||||
} esp_bt_cod_major_dev_t;
|
||||
|
||||
/// Bits of major device class field
|
||||
#define ESP_BT_COD_MAJOR_DEV_BIT_MASK (0x1f00) /*!< Major device bit mask */
|
||||
#define ESP_BT_COD_MAJOR_DEV_BIT_OFFSET (8) /*!< Major device bit offset */
|
||||
|
||||
/// Bits of minor device class field
|
||||
#define ESP_BT_COD_MINOR_DEV_BIT_MASK (0xfc) /*!< Minor device bit mask */
|
||||
#define ESP_BT_COD_MINOR_DEV_BIT_OFFSET (2) /*!< Minor device bit offset */
|
||||
|
||||
/// Bits of format type
|
||||
#define ESP_BT_COD_FORMAT_TYPE_BIT_MASK (0x03) /*!< Format type bit mask */
|
||||
#define ESP_BT_COD_FORMAT_TYPE_BIT_OFFSET (0) /*!< Format type bit offset */
|
||||
|
||||
/// Class of device format type 1
|
||||
#define ESP_BT_COD_FORMAT_TYPE_1 (0x00)
|
||||
|
||||
/** Bluetooth Device Discovery state */
|
||||
typedef enum {
|
||||
ESP_BT_GAP_DISCOVERY_STOPPED, /*!< device discovery stopped */
|
||||
ESP_BT_GAP_DISCOVERY_STARTED, /*!< device discovery started */
|
||||
} esp_bt_gap_discovery_state_t;
|
||||
|
||||
/// BT GAP callback events
|
||||
typedef enum {
|
||||
ESP_BT_GAP_DISC_RES_EVT = 0, /*!< device discovery result event */
|
||||
ESP_BT_GAP_DISC_STATE_CHANGED_EVT, /*!< discovery state changed event */
|
||||
ESP_BT_GAP_RMT_SRVCS_EVT, /*!< get remote services event */
|
||||
ESP_BT_GAP_RMT_SRVC_REC_EVT, /*!< get remote service record event */
|
||||
} esp_bt_gap_cb_event_t;
|
||||
|
||||
/** Inquiry Mode */
|
||||
typedef enum {
|
||||
ESP_BT_INQ_MODE_GENERAL_INQUIRY, /*!< General inquiry mode */
|
||||
ESP_BT_INQ_MODE_LIMITED_INQIURY, /*!< Limited inquiry mode */
|
||||
} esp_bt_inq_mode_t;
|
||||
|
||||
/** Minimum and Maximum inquiry length*/
|
||||
#define ESP_BT_GAP_MIN_INQ_LEN (0x01) /*!< Minimum inquiry duration, unit is 1.28s */
|
||||
#define ESP_BT_GAP_MAX_INQ_LEN (0x30) /*!< Maximum inquiry duration, unit is 1.28s */
|
||||
|
||||
/// A2DP state callback parameters
|
||||
typedef union {
|
||||
/**
|
||||
* @brief ESP_BT_GAP_DISC_RES_EVT
|
||||
*/
|
||||
struct disc_res_param {
|
||||
esp_bd_addr_t bda; /*!< remote bluetooth device address*/
|
||||
int num_prop; /*!< number of properties got */
|
||||
esp_bt_gap_dev_prop_t *prop; /*!< properties discovered from the new device */
|
||||
} disc_res; /*!< discovery result paramter struct */
|
||||
|
||||
/**
|
||||
* @brief ESP_BT_GAP_DISC_STATE_CHANGED_EVT
|
||||
*/
|
||||
struct disc_state_changed_param {
|
||||
esp_bt_gap_discovery_state_t state; /*!< discovery state */
|
||||
} disc_st_chg; /*!< discovery state changed parameter struct */
|
||||
|
||||
/**
|
||||
* @brief ESP_BT_GAP_RMT_SRVCS_EVT
|
||||
*/
|
||||
struct rmt_srvcs_param {
|
||||
esp_bd_addr_t bda; /*!< remote bluetooth device address*/
|
||||
esp_bt_status_t stat; /*!< service search status */
|
||||
int num_uuids; /*!< number of UUID in uuid_list */
|
||||
esp_bt_uuid_t *uuid_list; /*!< list of service UUIDs of remote device */
|
||||
} rmt_srvcs; /*!< services of remote device parameter struct */
|
||||
|
||||
/**
|
||||
* @brief ESP_BT_GAP_RMT_SRVC_REC_EVT
|
||||
*/
|
||||
struct rmt_srvc_rec_param {
|
||||
esp_bd_addr_t bda; /*!< remote bluetooth device address*/
|
||||
esp_bt_status_t stat; /*!< service search status */
|
||||
} rmt_srvc_rec; /*!< specific service record from remote device parameter struct */
|
||||
} esp_bt_gap_cb_param_t;
|
||||
|
||||
/**
|
||||
* @brief bluetooth GAP callback function type
|
||||
* @param event : Event type
|
||||
* @param param : Pointer to callback parameter
|
||||
*/
|
||||
typedef void (* esp_bt_gap_cb_t)(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_param_t *param);
|
||||
|
||||
/**
|
||||
* @brief get major service field of COD
|
||||
* @param[in] cod: Class of Device
|
||||
* @return major service bits
|
||||
*/
|
||||
inline uint32_t esp_bt_gap_get_cod_srvc(uint32_t cod)
|
||||
{
|
||||
return (cod & ESP_BT_COD_SRVC_BIT_MASK) >> ESP_BT_COD_SRVC_BIT_OFFSET;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get major device field of COD
|
||||
* @param[in] cod: Class of Device
|
||||
* @return major device bits
|
||||
*/
|
||||
inline uint32_t esp_bt_gap_get_cod_major_dev(uint32_t cod)
|
||||
{
|
||||
return (cod & ESP_BT_COD_MAJOR_DEV_BIT_MASK) >> ESP_BT_COD_MAJOR_DEV_BIT_OFFSET;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get minor service field of COD
|
||||
* @param[in] cod: Class of Device
|
||||
* @return minor service bits
|
||||
*/
|
||||
inline uint32_t esp_bt_gap_get_cod_minor_dev(uint32_t cod)
|
||||
{
|
||||
return (cod & ESP_BT_COD_MINOR_DEV_BIT_MASK) >> ESP_BT_COD_MINOR_DEV_BIT_OFFSET;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get format type of COD
|
||||
* @param[in] cod: Class of Device
|
||||
* @return format type
|
||||
*/
|
||||
inline uint32_t esp_bt_gap_get_cod_format_type(uint32_t cod)
|
||||
{
|
||||
return (cod & ESP_BT_COD_FORMAT_TYPE_BIT_MASK);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief decide the integrity of COD
|
||||
* @param[in] cod: Class of Device
|
||||
* @return
|
||||
* - true if cod is valid
|
||||
* - false otherise
|
||||
*/
|
||||
inline bool esp_bt_gap_is_valid_cod(uint32_t cod)
|
||||
{
|
||||
if (esp_bt_gap_get_cod_format_type(cod) == ESP_BT_COD_FORMAT_TYPE_1 &&
|
||||
esp_bt_gap_get_cod_srvc(cod) != ESP_BT_COD_SRVC_NONE) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief register callback function. This function should be called after esp_bluedroid_enable() completes successfully
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK : Succeed
|
||||
* - ESP_FAIL: others
|
||||
*/
|
||||
esp_err_t esp_bt_gap_register_callback(esp_bt_gap_cb_t callback);
|
||||
|
||||
/**
|
||||
* @brief Set discoverability and connectability mode for legacy bluetooth. This function should
|
||||
* be called after esp_bluedroid_enable() completes successfully
|
||||
@ -45,6 +263,69 @@ typedef enum {
|
||||
*/
|
||||
esp_err_t esp_bt_gap_set_scan_mode(esp_bt_scan_mode_t mode);
|
||||
|
||||
/**
|
||||
* @brief Start device discovery. This function should be called after esp_bluedroid_enable() completes successfully.
|
||||
* esp_bt_gap_cb_t will is called with ESP_BT_GAP_DISC_STATE_CHANGED_EVT if discovery is started or halted.
|
||||
* esp_bt_gap_cb_t will is called with ESP_BT_GAP_DISC_RES_EVT if discovery result is got.
|
||||
*
|
||||
* @param[in] mode - inquiry mode
|
||||
* @param[in] inq_len - inquiry duration in 1.28 sec units, ranging from 0x01 to 0x30
|
||||
* @param[in] num_rsps - number of inquiry responses that can be received, value 0 indicates an unlimited number of responses
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK : Succeed
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_ERR_INVALID_ARG: if invalid parameters are provided
|
||||
* - ESP_FAIL: others
|
||||
*/
|
||||
esp_err_t esp_bt_gap_start_discovery(esp_bt_inq_mode_t mode, uint8_t inq_len, uint8_t num_rsps);
|
||||
|
||||
/**
|
||||
* @brief Cancel device discovery. This function should be called after esp_bluedroid_enable() completes successfully
|
||||
* esp_bt_gap_cb_t will is called with ESP_BT_GAP_DISC_STATE_CHANGED_EVT if discovery is stopped.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK : Succeed
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*/
|
||||
esp_err_t esp_bt_gap_cancel_discovery(void);
|
||||
|
||||
/**
|
||||
* @brief Start SDP to get remote services. This function should be called after esp_bluedroid_enable() completes successfully.
|
||||
* esp_bt_gap_cb_t will is called with ESP_BT_GAP_RMT_SRVCS_EVT after service discovery ends
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK : Succeed
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*/
|
||||
esp_err_t esp_bt_gap_get_remote_services(esp_bd_addr_t remote_bda);
|
||||
|
||||
/**
|
||||
* @brief Start SDP to look up the service matching uuid on the remote device. This function should be called after
|
||||
* esp_bluedroid_enable() completes successfully
|
||||
*
|
||||
* esp_bt_gap_cb_t will is called with ESP_BT_GAP_RMT_SRVC_REC_EVT after service discovery ends
|
||||
* @return
|
||||
* - ESP_OK : Succeed
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*/
|
||||
esp_err_t esp_bt_gap_get_remote_service_record(esp_bd_addr_t remote_bda, esp_bt_uuid_t *uuid);
|
||||
|
||||
/**
|
||||
* @brief This function is called to get EIR data for a specific type.
|
||||
*
|
||||
* @param[in] eir - pointer of raw eir data to be resolved
|
||||
* @param[in] type - specific EIR data type
|
||||
* @param[out] length - return the length of EIR data excluding fields of length and data type
|
||||
*
|
||||
* @return pointer of starting position of eir data excluding eir data type, NULL if not found
|
||||
*
|
||||
*/
|
||||
uint8_t *esp_bt_gap_resolve_eir_data(uint8_t *eir, esp_bt_eir_type_t type, uint8_t *length);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
294
tools/sdk/include/bluedroid/esp_spp_api.h
Normal file
294
tools/sdk/include/bluedroid/esp_spp_api.h
Normal file
@ -0,0 +1,294 @@
|
||||
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef __ESP_SPP_API_H__
|
||||
#define __ESP_SPP_API_H__
|
||||
|
||||
#include "esp_err.h"
|
||||
#include "esp_bt_defs.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
ESP_SPP_SUCCESS = 0, /*!< Successful operation. */
|
||||
ESP_SPP_FAILURE, /*!< Generic failure. */
|
||||
ESP_SPP_BUSY, /*!< Temporarily can not handle this request. */
|
||||
ESP_SPP_NO_DATA, /*!< no data. */
|
||||
ESP_SPP_NO_RESOURCE /*!< No more set pm control block */
|
||||
} esp_spp_status_t;
|
||||
|
||||
/* Security Setting Mask */
|
||||
#define ESP_SPP_SEC_NONE 0x0000 /*!< No security. relate to BTA_SEC_NONE in bta_api.h */
|
||||
#define ESP_SPP_SEC_AUTHORIZE 0x0001 /*!< Authorization required (only needed for out going connection ) relate to BTA_SEC_AUTHORIZE in bta_api.h*/
|
||||
#define ESP_SPP_SEC_AUTHENTICATE 0x0012 /*!< Authentication required. relate to BTA_SEC_AUTHENTICATE in bta_api.h*/
|
||||
#define ESP_SPP_SEC_ENCRYPT 0x0024 /*!< Encryption required. relate to BTA_SEC_ENCRYPT in bta_api.h*/
|
||||
#define ESP_SPP_SEC_MODE4_LEVEL4 0x0040 /*!< Mode 4 level 4 service, i.e. incoming/outgoing MITM and P-256 encryption relate to BTA_SEC_MODE4_LEVEL4 in bta_api.h*/
|
||||
#define ESP_SPP_SEC_MITM 0x3000 /*!< Man-In-The_Middle protection relate to BTA_SEC_MITM in bta_api.h*/
|
||||
#define ESP_SPP_SEC_IN_16_DIGITS 0x4000 /*!< Min 16 digit for pin code relate to BTA_SEC_IN_16_DIGITS in bta_api.h*/
|
||||
typedef uint16_t esp_spp_sec_t;
|
||||
|
||||
typedef enum {
|
||||
ESP_SPP_ROLE_MASTER = 0, /*!< Role: master */
|
||||
ESP_SPP_ROLE_SLAVE = 1, /*!< Role: slave */
|
||||
} esp_spp_role_t;
|
||||
|
||||
typedef enum {
|
||||
ESP_SPP_MODE_CB = 0, /*!< When data is coming, a callback will come with data */
|
||||
ESP_SPP_MODE_VFS = 1, /*!< Use VFS to write/read data */
|
||||
} esp_spp_mode_t;
|
||||
|
||||
#define ESP_SPP_MAX_MTU (3*330) /*!< SPP max MTU */
|
||||
#define ESP_SPP_MAX_SCN 31 /*!< SPP max SCN */
|
||||
/**
|
||||
* @brief SPP callback function events
|
||||
*/
|
||||
typedef enum {
|
||||
ESP_SPP_INIT_EVT = 0, /*!< When SPP is inited, the event comes */
|
||||
ESP_SPP_DISCOVERY_COMP_EVT = 8, /*!< When SDP discovery complete, the event comes */
|
||||
ESP_SPP_OPEN_EVT = 26, /*!< When SPP Client connection open, the event comes */
|
||||
ESP_SPP_CLOSE_EVT = 27, /*!< When SPP connection closed, the event comes */
|
||||
ESP_SPP_START_EVT = 28, /*!< When SPP server started, the event comes */
|
||||
ESP_SPP_CL_INIT_EVT = 29, /*!< When SPP client initiated a connection, the event comes */
|
||||
ESP_SPP_DATA_IND_EVT = 30, /*!< When SPP connection received data, the event comes */
|
||||
ESP_SPP_CONG_EVT = 31, /*!< When SPP connection congestion status changed, the event comes */
|
||||
ESP_SPP_WRITE_EVT = 33, /*!< When SPP write operation completes, the event comes */
|
||||
ESP_SPP_SRV_OPEN_EVT = 34, /*!< When SPP Server connection open, the event comes */
|
||||
} esp_spp_cb_event_t;
|
||||
|
||||
|
||||
/**
|
||||
* @brief SPP callback parameters union
|
||||
*/
|
||||
typedef union {
|
||||
/**
|
||||
* @brief SPP_INIT_EVT
|
||||
*/
|
||||
struct spp_init_evt_param {
|
||||
esp_spp_status_t status; /*!< status */
|
||||
} init; /*!< SPP callback param of SPP_INIT_EVT */
|
||||
|
||||
/**
|
||||
* @brief SPP_DISCOVERY_COMP_EVT
|
||||
*/
|
||||
struct spp_discovery_comp_evt_param {
|
||||
esp_spp_status_t status; /*!< status */
|
||||
uint8_t scn_num; /*!< The num of scn_num */
|
||||
uint8_t scn[ESP_SPP_MAX_SCN]; /*!< channel # */
|
||||
} disc_comp; /*!< SPP callback param of SPP_DISCOVERY_COMP_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_SPP_OPEN_EVT
|
||||
*/
|
||||
struct spp_open_evt_param {
|
||||
esp_spp_status_t status; /*!< status */
|
||||
uint32_t handle; /*!< The connection handle */
|
||||
esp_bd_addr_t rem_bda; /*!< The peer address */
|
||||
} open; /*!< SPP callback param of ESP_SPP_OPEN_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_SPP_SRV_OPEN_EVT
|
||||
*/
|
||||
struct spp_srv_open_evt_param {
|
||||
esp_spp_status_t status; /*!< status */
|
||||
uint32_t handle; /*!< The connection handle */
|
||||
uint32_t new_listen_handle; /*!< The new listen handle */
|
||||
esp_bd_addr_t rem_bda; /*!< The peer address */
|
||||
} srv_open; /*!< SPP callback param of ESP_SPP_SRV_OPEN_EVT */
|
||||
/**
|
||||
* @brief ESP_SPP_CLOSE_EVT
|
||||
*/
|
||||
struct spp_close_evt_param {
|
||||
esp_spp_status_t status; /*!< status */
|
||||
uint32_t port_status; /*!< PORT status */
|
||||
uint32_t handle; /*!< The connection handle */
|
||||
bool async; /*!< FALSE, if local initiates disconnect */
|
||||
} close; /*!< SPP callback param of ESP_SPP_CLOSE_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_SPP_START_EVT
|
||||
*/
|
||||
struct spp_start_evt_param {
|
||||
esp_spp_status_t status; /*!< status */
|
||||
uint32_t handle; /*!< The connection handle */
|
||||
uint8_t sec_id; /*!< security ID used by this server */
|
||||
bool use_co; /*!< TRUE to use co_rfc_data */
|
||||
} start; /*!< SPP callback param of ESP_SPP_START_EVT */
|
||||
/**
|
||||
* @brief ESP_SPP_CL_INIT_EVT
|
||||
*/
|
||||
struct spp_cl_init_evt_param {
|
||||
esp_spp_status_t status; /*!< status */
|
||||
uint32_t handle; /*!< The connection handle */
|
||||
uint8_t sec_id; /*!< security ID used by this server */
|
||||
bool use_co; /*!< TRUE to use co_rfc_data */
|
||||
} cl_init; /*!< SPP callback param of ESP_SPP_CL_INIT_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_SPP_WRITE_EVT
|
||||
*/
|
||||
struct spp_write_evt_param {
|
||||
esp_spp_status_t status; /*!< status */
|
||||
uint32_t handle; /*!< The connection handle */
|
||||
uint32_t req_id; /*!< The req_id in the associated BTA_JvRfcommWrite() */
|
||||
int len; /*!< The length of the data written. */
|
||||
bool cong; /*!< congestion status */
|
||||
} write; /*!< SPP callback param of ESP_SPP_WRITE_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_SPP_DATA_IND_EVT
|
||||
*/
|
||||
struct spp_data_ind_evt_param {
|
||||
esp_spp_status_t status; /*!< status */
|
||||
uint32_t handle; /*!< The connection handle */
|
||||
uint16_t len; /*!< The length of data */
|
||||
uint8_t *data; /*!< The data recived */
|
||||
} data_ind; /*!< SPP callback param of ESP_SPP_DATA_IND_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_SPP_CONG_EVT
|
||||
*/
|
||||
struct spp_cong_evt_param {
|
||||
esp_spp_status_t status; /*!< status */
|
||||
uint32_t handle; /*!< The connection handle */
|
||||
bool cong; /*!< TRUE, congested. FALSE, uncongested */
|
||||
} cong; /*!< SPP callback param of ESP_SPP_CONG_EVT */
|
||||
} esp_spp_cb_param_t; /*!< SPP callback parameter union type */
|
||||
|
||||
/**
|
||||
* @brief SPP callback function type
|
||||
* @param event: Event type
|
||||
* @param param: Point to callback parameter, currently is union type
|
||||
*/
|
||||
typedef void (esp_spp_cb_t)(esp_spp_cb_event_t event, esp_spp_cb_param_t *param);
|
||||
|
||||
/**
|
||||
* @brief This function is called to init callbacks
|
||||
* with SPP module.
|
||||
*
|
||||
* @param[in] callback: pointer to the init callback function.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - other: failed
|
||||
*/
|
||||
esp_err_t esp_spp_register_callback(esp_spp_cb_t callback);
|
||||
|
||||
/**
|
||||
* @brief This function is called to init SPP.
|
||||
*
|
||||
* @param[in] mode: Choose the mode of SPP, ESP_SPP_MODE_CB or ESP_SPP_MODE_CB.
|
||||
* Now only supports ESP_SPP_MODE_CB mode, we will continue to update.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - other: failed
|
||||
*/
|
||||
esp_err_t esp_spp_init(esp_spp_mode_t mode);
|
||||
|
||||
/**
|
||||
* @brief This function is called to uninit SPP.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - other: failed
|
||||
*/
|
||||
esp_err_t esp_spp_deinit();
|
||||
|
||||
|
||||
/**
|
||||
* @brief This function is called to performs service discovery for
|
||||
* the services provided by the given peer device. When the
|
||||
* operation is complete the callback function will be called
|
||||
* with a ESP_SPP_DISCOVERY_COMP_EVT.
|
||||
*
|
||||
* @param[in] bd_addr: Remote device bluetooth device address.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - other: failed
|
||||
*/
|
||||
esp_err_t esp_spp_start_discovery(esp_bd_addr_t bd_addr);
|
||||
|
||||
/**
|
||||
* @brief This function makes an SPP conection to a remote BD Address.
|
||||
* When the connection is initiated or failed to initiate,
|
||||
* the callback is called with ESP_SPP_CL_INIT_EVT.
|
||||
* When the connection is established or failed,
|
||||
* the callback is called with ESP_SPP_OPEN_EVT.
|
||||
*
|
||||
* @param[in] sec_mask: Security Setting Mask .
|
||||
* @param[in] role: Msater or slave.
|
||||
* @param[in] remote_scn: Remote device bluetooth device SCN.
|
||||
* @param[in] peer_bd_addr: Remote device bluetooth device address.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - other: failed
|
||||
*/
|
||||
esp_err_t esp_spp_connect(esp_spp_sec_t sec_mask,
|
||||
esp_spp_role_t role, uint8_t remote_scn, esp_bd_addr_t peer_bd_addr);
|
||||
|
||||
/**
|
||||
* @brief This function closes an SPP connection.
|
||||
*
|
||||
* @param[in] handle: The connection handle.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - other: failed
|
||||
*/
|
||||
esp_err_t esp_spp_disconnect(uint32_t handle);
|
||||
|
||||
/**
|
||||
* @brief This function create a SPP server and starts listening for an
|
||||
* SPP connection request from a remote Bluetooth device.
|
||||
* When the server is started successfully, the callback is called
|
||||
* with ESP_SPP_START_EVT.
|
||||
* When the connection is established, the callback is called
|
||||
* with ESP_SPP_SRV_OPEN_EVT.
|
||||
*
|
||||
* @param[in] sec_mask: Security Setting Mask .
|
||||
* @param[in] role: Msater or slave.
|
||||
* @param[in] local_scn: The specific channel you want to get.
|
||||
* If channel is 0, means get any channel.
|
||||
* @param[in] name: Server's name.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - other: failed
|
||||
*/
|
||||
esp_err_t esp_spp_start_srv(esp_spp_sec_t sec_mask,
|
||||
esp_spp_role_t role, uint8_t local_scn, const char *name);
|
||||
|
||||
|
||||
/**
|
||||
* @brief This function closes an SPP connection.
|
||||
*
|
||||
* @param[in] handle: The connection handle.
|
||||
* @param[in] len: The length of the data written.
|
||||
* @param[in] p_data: The data written.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - other: failed
|
||||
*/
|
||||
esp_err_t esp_spp_write(uint32_t handle, int len, uint8_t *p_data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif ///__ESP_SPP_API_H__
|
@ -90,7 +90,8 @@ typedef struct {
|
||||
|
||||
void (*parse_ble_read_suggested_default_data_length_response)(
|
||||
BT_HDR *response,
|
||||
uint16_t *ble_default_packet_length_ptr
|
||||
uint16_t *ble_default_packet_length_ptr,
|
||||
uint16_t *ble_default_packet_txtime_ptr
|
||||
);
|
||||
} hci_packet_parser_t;
|
||||
|
||||
|
@ -598,7 +598,7 @@ extern int PORT_WriteData (UINT16 handle, char *p_data, UINT16 max_len,
|
||||
** Parameters: handle - Handle returned in the RFCOMM_CreateConnection
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern int PORT_WriteDataCO (UINT16 handle, int *p_len);
|
||||
extern int PORT_WriteDataCO (UINT16 handle, int *p_len, int len, UINT8 *p_data);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
|
@ -28,6 +28,8 @@
|
||||
#include "bt_target.h"
|
||||
#include "rfcdefs.h"
|
||||
#include "port_api.h"
|
||||
#include "fixed_queue.h"
|
||||
#include "bt_defs.h"
|
||||
|
||||
/* Local events passed when application event is sent from the api to PORT */
|
||||
/* ???*/
|
||||
|
@ -84,10 +84,10 @@ typedef enum {
|
||||
#define BTC_TASK_QUEUE_LEN 60
|
||||
|
||||
#define BTC_MEDIA_TASK_PINNED_TO_CORE (TASK_PINNED_TO_CORE)
|
||||
#define BTC_MEDIA_TASK_STACK_SIZE (CONFIG_BTC_TASK_STACK_SIZE + BT_TASK_EXTRA_STACK_SIZE)
|
||||
#define BTC_MEDIA_TASK_STACK_SIZE (2048 + BT_TASK_EXTRA_STACK_SIZE)
|
||||
#define BTC_MEDIA_TASK_NAME "BtcMediaT"
|
||||
#define BTC_MEDIA_TASK_PRIO (configMAX_PRIORITIES - 3)
|
||||
#define BTC_MEDIA_DATA_QUEUE_LEN (1)
|
||||
#define BTC_MEDIA_DATA_QUEUE_LEN (3)
|
||||
#define BTC_MEDIA_CTRL_QUEUE_LEN (5)
|
||||
#define BTC_MEDIA_TASK_QUEUE_SET_LEN (BTC_MEDIA_DATA_QUEUE_LEN + BTC_MEDIA_CTRL_QUEUE_LEN)
|
||||
|
||||
|
Reference in New Issue
Block a user