Update IDF to aaf1239 (#1539)

* fix sdmmc config

* Fix warnings in EEPROM

from @Curclamas

* remove leftover TAG in EEPROM

* Initial add of @stickbreaker i2c

* Add log_n

* fix warnings when log is off

* i2c code clean up and reorganization

* add flags to interrupt allocator

* fix sdmmc config

* Fix warnings in EEPROM

from @Curclamas

* remove leftover TAG in EEPROM

* fix errors with latest IDF

* fix debug optimization (#1365)

incorrect optimization for debugging tick markers.

* Fix some missing BT header

* Change BTSerial log calls

* Update BLE lib

* Arduino-ESP32 release management scripted (#1515)

* Calculate an absolute path for a custom partitions table (#1452)

* * Arduino-ESP32 release management scripted
(ready-to-merge)

* * secure env for espressif/arduino-esp32

* * build tests enabled
* gitter webhook enabled

* * gitter room link fixed
* better comment

* * filepaths fixed

* BT Serial adjustments

* * don't run sketch builds & tests for tagged builds

* Return false from WiFi.hostByName() if hostname is not resolved

* Free BT Memory when BT is not used

* WIFI_MODE_NULL is not supported anymore

* Select some key examples to build with PlatformIO to save some time

* Update BLE lib

* Fixed BLE lib

* Major WiFi overhaul

- auto reconnect on connection loss now works
- moved to event groups
- some code clean up and procedure optimizations
- new methods to get a more elaborate system ststus

* Add cmake tests to travis

* Add initial AsyncUDP

* Add NetBIOS lib and fix CMake includes

* Add Initial WebServer

* Fix WebServer and examples

* travis not quiting on build fail

* Try different travis build

* Update IDF to aaf1239

* Fix WPS Example

* fix script permission and add some fail tests to sketch builder

* Add missing space in WiFiClient::write(Stream &stream)
This commit is contained in:
Me No Dev
2018-06-27 09:01:06 +02:00
committed by GitHub
parent 7abd5862ed
commit a59eafbc9d
626 changed files with 39585 additions and 16687 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,144 @@
/******************************************************************************
*
* Copyright (C) 2004-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 for the simulatenous advanced
* audio/video streaming (AV) source and sink of BTA, Broadcom's Bluetooth
* application layer for mobile phones.
*
******************************************************************************/
#ifndef BTA_AR_API_H
#define BTA_AR_API_H
#include "stack/avdt_api.h"
#include "stack/avct_api.h"
#include "stack/avrc_api.h"
#include "stack/sdp_api.h"
#include "bta/bta_av_api.h"
#include "bta/bta_sys.h"
#if (BTA_AR_INCLUDED == TRUE)
/*****************************************************************************
** Constants and data types
*****************************************************************************/
/* This event signal to AR user that other profile is connected */
#define BTA_AR_AVDT_CONN_EVT (AVDT_MAX_EVT + 1)
/*******************************************************************************
**
** Function bta_ar_init
**
** Description This function is called from bta_sys_init().
** to initialize the control block
**
** Returns void
**
*******************************************************************************/
extern void bta_ar_init(void);
/*******************************************************************************
**
** Function bta_ar_reg_avdt
**
** Description This function is called to register to AVDTP.
**
** Returns void
**
*******************************************************************************/
extern void bta_ar_reg_avdt(tAVDT_REG *p_reg, tAVDT_CTRL_CBACK *p_cback, tBTA_SYS_ID sys_id);
/*******************************************************************************
**
** Function bta_ar_dereg_avdt
**
** Description This function is called to de-register from AVDTP.
**
** Returns void
**
*******************************************************************************/
extern void bta_ar_dereg_avdt(tBTA_SYS_ID sys_id);
/*******************************************************************************
**
** Function bta_ar_avdt_conn
**
** Description This function is called to let ar know that some AVDTP profile
** is connected for this sys_id.
** If the other sys modules started a timer for PENDING_EVT,
** the timer can be stopped now.
**
** Returns void
**
*******************************************************************************/
extern void bta_ar_avdt_conn(tBTA_SYS_ID sys_id, BD_ADDR bd_addr);
/*******************************************************************************
**
** Function bta_ar_reg_avct
**
** Description This function is called to register to AVCTP.
**
** Returns void
**
*******************************************************************************/
extern void bta_ar_reg_avct(UINT16 mtu, UINT16 mtu_br, UINT8 sec_mask, tBTA_SYS_ID sys_id);
/*******************************************************************************
**
** Function bta_ar_dereg_avct
**
** Description This function is called to deregister from AVCTP.
**
** Returns void
**
*******************************************************************************/
extern void bta_ar_dereg_avct(tBTA_SYS_ID sys_id);
/******************************************************************************
**
** Function bta_ar_reg_avrc
**
** Description This function is called to register an SDP record for AVRCP.
**
** Returns void
**
******************************************************************************/
extern void bta_ar_reg_avrc(UINT16 service_uuid, char *p_service_name,
char *p_provider_name, UINT16 categories, tBTA_SYS_ID sys_id);
/******************************************************************************
**
** Function bta_ar_dereg_avrc
**
** Description This function is called to de-register/delete an SDP record for AVRCP.
**
** Returns void
**
******************************************************************************/
extern void bta_ar_dereg_avrc(UINT16 service_uuid, tBTA_SYS_ID sys_id);
#ifdef __cplusplus
}
#endif
#endif ///BTA_AR_INCLUDED == TRUE
#endif /* BTA_AR_API_H */

View File

@ -0,0 +1,813 @@
/******************************************************************************
*
* Copyright (C) 2004-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 for the advanced audio/video streaming
* (AV) subsystem of BTA, Broadcom's Bluetooth application layer for mobile
* phones.
*
******************************************************************************/
#ifndef BTA_AV_API_H
#define BTA_AV_API_H
#include "stack/avrc_api.h"
#include "stack/avdt_api.h"
#include "stack/a2d_api.h"
#include "bta/bta_api.h"
#if (BTA_AV_INCLUDED == TRUE)
/*****************************************************************************
** Constants and data types
*****************************************************************************/
/* Set to TRUE if seperate authorization prompt desired for AVCTP besides A2DP authorization */
/* Typically FALSE when AVRCP is used in conjunction with A2DP */
#ifndef BTA_AV_WITH_AVCTP_AUTHORIZATION
#define BTA_AV_WITH_AVCTP_AUTHORIZATION FALSE
#endif
/* AV status values */
#define BTA_AV_SUCCESS 0 /* successful operation */
#define BTA_AV_FAIL 1 /* generic failure */
#define BTA_AV_FAIL_SDP 2 /* service not found */
#define BTA_AV_FAIL_STREAM 3 /* stream connection failed */
#define BTA_AV_FAIL_RESOURCES 4 /* no resources */
#define BTA_AV_FAIL_ROLE 5 /* failed due to role management related issues */
#define BTA_AV_FAIL_GET_CAP 6 /* get capability failed due to no SEP availale on the peer */
typedef UINT8 tBTA_AV_STATUS;
/* AV features masks */
#define BTA_AV_FEAT_RCTG 0x0001 /* remote control target */
#define BTA_AV_FEAT_RCCT 0x0002 /* remote control controller */
#define BTA_AV_FEAT_PROTECT 0x0004 /* streaming media contect protection */
#define BTA_AV_FEAT_VENDOR 0x0008 /* remote control vendor dependent commands */
#define BTA_AV_FEAT_REPORT 0x0020 /* use reporting service for VDP */
#define BTA_AV_FEAT_METADATA 0x0040 /* remote control Metadata Transfer command/response */
#define BTA_AV_FEAT_MULTI_AV 0x0080 /* use multi-av, if controller supports it */
#define BTA_AV_FEAT_BROWSE 0x0010 /* use browsing channel */
#define BTA_AV_FEAT_MASTER 0x0100 /* stream only as master role */
#define BTA_AV_FEAT_ADV_CTRL 0x0200 /* remote control Advanced Control command/response */
#define BTA_AV_FEAT_DELAY_RPT 0x0400 /* allow delay reporting */
#define BTA_AV_FEAT_ACP_START 0x0800 /* start stream when 2nd SNK was accepted */
/* Internal features */
#define BTA_AV_FEAT_NO_SCO_SSPD 0x8000 /* Do not suspend av streaming as to AG events(SCO or Call) */
typedef UINT16 tBTA_AV_FEAT;
/* AV channel values */
#define BTA_AV_CHNL_MSK 0xC0
#define BTA_AV_CHNL_AUDIO 0x40 /* audio channel */
#define BTA_AV_CHNL_VIDEO 0x80 /* video channel */
typedef UINT8 tBTA_AV_CHNL;
#define BTA_AV_HNDL_MSK 0x3F
typedef UINT8 tBTA_AV_HNDL;
/* handle index to mask */
#define BTA_AV_HNDL_TO_MSK(h) ((UINT8)(1 << (h)))
/* tBTA_AV_HNDL to mask */
#define BTA_AV_HNDL_TYPE_TO_MSK(h) ((UINT8)(1 << (h&BTA_AV_HNDL_MSK)))
/* offset of codec type in codec info byte array */
#define BTA_AV_CODEC_TYPE_IDX AVDT_CODEC_TYPE_INDEX /* 2 */
/* maximum number of streams created: 1 for audio, 1 for video */
#ifndef BTA_AV_NUM_STRS
#define BTA_AV_NUM_STRS 2
#endif
#ifndef BTA_AV_MAX_SEPS
#define BTA_AV_MAX_SEPS 2
#endif
#ifndef BTA_AV_MAX_A2DP_MTU
/*#define BTA_AV_MAX_A2DP_MTU 668 //224 (DM5) * 3 - 4(L2CAP header) */
#define BTA_AV_MAX_A2DP_MTU 1008
#endif
#ifndef BTA_AV_MAX_VDP_MTU
#define BTA_AV_MAX_VDP_MTU 1008
#endif
/* codec type */
#define BTA_AV_CODEC_SBC A2D_MEDIA_CT_SBC /* SBC media codec type */
#define BTA_AV_CODEC_M12 A2D_MEDIA_CT_M12 /* MPEG-1, 2 Audio media codec type */
#define BTA_AV_CODEC_M24 A2D_MEDIA_CT_M24 /* MPEG-2, 4 AAC media codec type */
#define BTA_AV_CODEC_ATRAC A2D_MEDIA_CT_ATRAC /* ATRAC family media codec type */
#define BTA_AV_CODEC_H263_P0 VDP_MEDIA_CT_H263_P0 /* H.263 baseline (profile 0) */
#define BTA_AV_CODEC_MPEG4 VDP_MEDIA_CT_MPEG4 /* MPEG-4 Visual Simple Profile */
#define BTA_AV_CODEC_H263_P3 VDP_MEDIA_CT_H263_P3 /* H.263 profile 3 */
#define BTA_AV_CODEC_H263_P8 VDP_MEDIA_CT_H263_P8 /* H.263 profile 8 */
#define BTA_AV_CODEC_VEND VDP_MEDIA_CT_VEND /* Non-VDP */
typedef UINT8 tBTA_AV_CODEC;
/* Company ID in BT assigned numbers */
#define BTA_AV_BT_VENDOR_ID VDP_BT_VENDOR_ID /* Broadcom Corporation */
/* vendor specific codec ID */
#define BTA_AV_CODEC_ID_H264 VDP_CODEC_ID_H264 /* Non-VDP codec ID - H.264 */
#define BTA_AV_CODEC_ID_IMG VDP_CODEC_ID_IMG /* Non-VDP codec ID - images/slideshow */
/* operation id list for BTA_AvRemoteCmd */
#define BTA_AV_RC_SELECT AVRC_ID_SELECT /* select */
#define BTA_AV_RC_UP AVRC_ID_UP /* up */
#define BTA_AV_RC_DOWN AVRC_ID_DOWN /* down */
#define BTA_AV_RC_LEFT AVRC_ID_LEFT /* left */
#define BTA_AV_RC_RIGHT AVRC_ID_RIGHT /* right */
#define BTA_AV_RC_RIGHT_UP AVRC_ID_RIGHT_UP /* right-up */
#define BTA_AV_RC_RIGHT_DOWN AVRC_ID_RIGHT_DOWN /* right-down */
#define BTA_AV_RC_LEFT_UP AVRC_ID_LEFT_UP /* left-up */
#define BTA_AV_RC_LEFT_DOWN AVRC_ID_LEFT_DOWN /* left-down */
#define BTA_AV_RC_ROOT_MENU AVRC_ID_ROOT_MENU /* root menu */
#define BTA_AV_RC_SETUP_MENU AVRC_ID_SETUP_MENU /* setup menu */
#define BTA_AV_RC_CONT_MENU AVRC_ID_CONT_MENU /* contents menu */
#define BTA_AV_RC_FAV_MENU AVRC_ID_FAV_MENU /* favorite menu */
#define BTA_AV_RC_EXIT AVRC_ID_EXIT /* exit */
#define BTA_AV_RC_0 AVRC_ID_0 /* 0 */
#define BTA_AV_RC_1 AVRC_ID_1 /* 1 */
#define BTA_AV_RC_2 AVRC_ID_2 /* 2 */
#define BTA_AV_RC_3 AVRC_ID_3 /* 3 */
#define BTA_AV_RC_4 AVRC_ID_4 /* 4 */
#define BTA_AV_RC_5 AVRC_ID_5 /* 5 */
#define BTA_AV_RC_6 AVRC_ID_6 /* 6 */
#define BTA_AV_RC_7 AVRC_ID_7 /* 7 */
#define BTA_AV_RC_8 AVRC_ID_8 /* 8 */
#define BTA_AV_RC_9 AVRC_ID_9 /* 9 */
#define BTA_AV_RC_DOT AVRC_ID_DOT /* dot */
#define BTA_AV_RC_ENTER AVRC_ID_ENTER /* enter */
#define BTA_AV_RC_CLEAR AVRC_ID_CLEAR /* clear */
#define BTA_AV_RC_CHAN_UP AVRC_ID_CHAN_UP /* channel up */
#define BTA_AV_RC_CHAN_DOWN AVRC_ID_CHAN_DOWN /* channel down */
#define BTA_AV_RC_PREV_CHAN AVRC_ID_PREV_CHAN /* previous channel */
#define BTA_AV_RC_SOUND_SEL AVRC_ID_SOUND_SEL /* sound select */
#define BTA_AV_RC_INPUT_SEL AVRC_ID_INPUT_SEL /* input select */
#define BTA_AV_RC_DISP_INFO AVRC_ID_DISP_INFO /* display information */
#define BTA_AV_RC_HELP AVRC_ID_HELP /* help */
#define BTA_AV_RC_PAGE_UP AVRC_ID_PAGE_UP /* page up */
#define BTA_AV_RC_PAGE_DOWN AVRC_ID_PAGE_DOWN /* page down */
#define BTA_AV_RC_POWER AVRC_ID_POWER /* power */
#define BTA_AV_RC_VOL_UP AVRC_ID_VOL_UP /* volume up */
#define BTA_AV_RC_VOL_DOWN AVRC_ID_VOL_DOWN /* volume down */
#define BTA_AV_RC_MUTE AVRC_ID_MUTE /* mute */
#define BTA_AV_RC_PLAY AVRC_ID_PLAY /* play */
#define BTA_AV_RC_STOP AVRC_ID_STOP /* stop */
#define BTA_AV_RC_PAUSE AVRC_ID_PAUSE /* pause */
#define BTA_AV_RC_RECORD AVRC_ID_RECORD /* record */
#define BTA_AV_RC_REWIND AVRC_ID_REWIND /* rewind */
#define BTA_AV_RC_FAST_FOR AVRC_ID_FAST_FOR /* fast forward */
#define BTA_AV_RC_EJECT AVRC_ID_EJECT /* eject */
#define BTA_AV_RC_FORWARD AVRC_ID_FORWARD /* forward */
#define BTA_AV_RC_BACKWARD AVRC_ID_BACKWARD /* backward */
#define BTA_AV_RC_ANGLE AVRC_ID_ANGLE /* angle */
#define BTA_AV_RC_SUBPICT AVRC_ID_SUBPICT /* subpicture */
#define BTA_AV_RC_F1 AVRC_ID_F1 /* F1 */
#define BTA_AV_RC_F2 AVRC_ID_F2 /* F2 */
#define BTA_AV_RC_F3 AVRC_ID_F3 /* F3 */
#define BTA_AV_RC_F4 AVRC_ID_F4 /* F4 */
#define BTA_AV_RC_F5 AVRC_ID_F5 /* F5 */
#define BTA_AV_VENDOR AVRC_ID_VENDOR /* vendor unique */
typedef UINT8 tBTA_AV_RC;
/* state flag for pass through command */
#define BTA_AV_STATE_PRESS AVRC_STATE_PRESS /* key pressed */
#define BTA_AV_STATE_RELEASE AVRC_STATE_RELEASE /* key released */
typedef UINT8 tBTA_AV_STATE;
/* command codes for BTA_AvVendorCmd */
#define BTA_AV_CMD_CTRL AVRC_CMD_CTRL
#define BTA_AV_CMD_STATUS AVRC_CMD_STATUS
#define BTA_AV_CMD_SPEC_INQ AVRC_CMD_SPEC_INQ
#define BTA_AV_CMD_NOTIF AVRC_CMD_NOTIF
#define BTA_AV_CMD_GEN_INQ AVRC_CMD_GEN_INQ
typedef UINT8 tBTA_AV_CMD;
/* response codes for BTA_AvVendorRsp */
#define BTA_AV_RSP_NOT_IMPL AVRC_RSP_NOT_IMPL
#define BTA_AV_RSP_ACCEPT AVRC_RSP_ACCEPT
#define BTA_AV_RSP_REJ AVRC_RSP_REJ
#define BTA_AV_RSP_IN_TRANS AVRC_RSP_IN_TRANS
#define BTA_AV_RSP_IMPL_STBL AVRC_RSP_IMPL_STBL
#define BTA_AV_RSP_CHANGED AVRC_RSP_CHANGED
#define BTA_AV_RSP_INTERIM AVRC_RSP_INTERIM
typedef UINT8 tBTA_AV_CODE;
/* error codes for BTA_AvProtectRsp */
#define BTA_AV_ERR_NONE A2D_SUCCESS /* Success, no error */
#define BTA_AV_ERR_BAD_STATE AVDT_ERR_BAD_STATE /* Message cannot be processed in this state */
#define BTA_AV_ERR_RESOURCE AVDT_ERR_RESOURCE /* Insufficient resources */
#define BTA_AV_ERR_BAD_CP_TYPE A2D_BAD_CP_TYPE /* The requested Content Protection Type is not supported */
#define BTA_AV_ERR_BAD_CP_FORMAT A2D_BAD_CP_FORMAT /* The format of Content Protection Data is not correct */
typedef UINT8 tBTA_AV_ERR;
/* AV callback events */
#define BTA_AV_ENABLE_EVT 0 /* AV enabled */
#define BTA_AV_REGISTER_EVT 1 /* registered to AVDT */
#define BTA_AV_OPEN_EVT 2 /* connection opened */
#define BTA_AV_CLOSE_EVT 3 /* connection closed */
#define BTA_AV_START_EVT 4 /* stream data transfer started */
#define BTA_AV_STOP_EVT 5 /* stream data transfer stopped */
#define BTA_AV_PROTECT_REQ_EVT 6 /* content protection request */
#define BTA_AV_PROTECT_RSP_EVT 7 /* content protection response */
#define BTA_AV_RC_OPEN_EVT 8 /* remote control channel open */
#define BTA_AV_RC_CLOSE_EVT 9 /* remote control channel closed */
#define BTA_AV_REMOTE_CMD_EVT 10 /* remote control command */
#define BTA_AV_REMOTE_RSP_EVT 11 /* remote control response */
#define BTA_AV_VENDOR_CMD_EVT 12 /* vendor dependent remote control command */
#define BTA_AV_VENDOR_RSP_EVT 13 /* vendor dependent remote control response */
#define BTA_AV_RECONFIG_EVT 14 /* reconfigure response */
#define BTA_AV_SUSPEND_EVT 15 /* suspend response */
#define BTA_AV_PENDING_EVT 16 /* incoming connection pending:
* signal channel is open and stream is not open
* after BTA_AV_SIG_TIME_VAL ms */
#define BTA_AV_META_MSG_EVT 17 /* metadata messages */
#define BTA_AV_REJECT_EVT 18 /* incoming connection rejected */
#define BTA_AV_RC_FEAT_EVT 19 /* remote control channel peer supported features update */
#define BTA_AV_MEDIA_SINK_CFG_EVT 20 /* command to configure codec */
#define BTA_AV_MEDIA_DATA_EVT 21 /* sending data to Media Task */
/* Max BTA event */
#define BTA_AV_MAX_EVT 22
/* function types for call-out functions */
typedef BOOLEAN (*tBTA_AV_CO_INIT) (UINT8 *p_codec_type, UINT8 *p_codec_info,
UINT8 *p_num_protect, UINT8 *p_protect_info, UINT8 index);
typedef void (*tBTA_AV_CO_DISC_RES) (tBTA_AV_HNDL hndl, UINT8 num_seps,
UINT8 num_snk, UINT8 num_src, BD_ADDR addr, UINT16 uuid_local);
typedef UINT8 (*tBTA_AV_CO_GETCFG) (tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type,
UINT8 *p_codec_info, UINT8 *p_sep_info_idx, UINT8 seid,
UINT8 *p_num_protect, UINT8 *p_protect_info);
typedef void (*tBTA_AV_CO_SETCFG) (tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type,
UINT8 *p_codec_info, UINT8 seid, BD_ADDR addr,
UINT8 num_protect, UINT8 *p_protect_info,
UINT8 t_local_sep, UINT8 avdt_handle);
typedef void (*tBTA_AV_CO_OPEN) (tBTA_AV_HNDL hndl,
tBTA_AV_CODEC codec_type, UINT8 *p_codec_info,
UINT16 mtu);
typedef void (*tBTA_AV_CO_CLOSE) (tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type, UINT16 mtu);
typedef void (*tBTA_AV_CO_START) (tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type, UINT8 *p_codec_info, BOOLEAN *p_no_rtp_hdr);
typedef void (*tBTA_AV_CO_STOP) (tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type);
typedef void *(*tBTA_AV_CO_DATAPATH) (tBTA_AV_CODEC codec_type,
UINT32 *p_len, UINT32 *p_timestamp);
typedef void (*tBTA_AV_CO_DELAY) (tBTA_AV_HNDL hndl, UINT16 delay);
/* the call-out functions for one stream */
typedef struct {
tBTA_AV_CO_INIT init;
tBTA_AV_CO_DISC_RES disc_res;
tBTA_AV_CO_GETCFG getcfg;
tBTA_AV_CO_SETCFG setcfg;
tBTA_AV_CO_OPEN open;
tBTA_AV_CO_CLOSE close;
tBTA_AV_CO_START start;
tBTA_AV_CO_STOP stop;
tBTA_AV_CO_DATAPATH data;
tBTA_AV_CO_DELAY delay;
} tBTA_AV_CO_FUNCTS;
typedef UINT8 tBTA_AV_EVT;
/* Event associated with BTA_AV_ENABLE_EVT */
typedef struct {
tBTA_AV_FEAT features;
} tBTA_AV_ENABLE;
/* Event associated with BTA_AV_REGISTER_EVT */
typedef struct {
tBTA_AV_CHNL chnl; /* audio/video */
tBTA_AV_HNDL hndl; /* Handle associated with the stream. */
UINT8 app_id; /* ID associated with call to BTA_AvRegister() */
tBTA_AV_STATUS status;
tBTA_AV_CO_FUNCTS *p_bta_av_cos;
} tBTA_AV_REGISTER;
/* data associated with BTA_AV_OPEN_EVT */
#define BTA_AV_EDR_2MBPS 0x01
#define BTA_AV_EDR_3MBPS 0x02
typedef UINT8 tBTA_AV_EDR;
typedef struct {
tBTA_AV_CHNL chnl;
tBTA_AV_HNDL hndl;
BD_ADDR bd_addr;
tBTA_AV_STATUS status;
BOOLEAN starting;
tBTA_AV_EDR edr; /* 0, if peer device does not support EDR */
UINT8 sep; /* sep type of peer device */
} tBTA_AV_OPEN;
/* data associated with BTA_AV_CLOSE_EVT */
typedef struct {
tBTA_AV_CHNL chnl;
tBTA_AV_HNDL hndl;
UINT8 disc_rsn; /* disconnection reason */
} tBTA_AV_CLOSE;
/* data associated with BTA_AV_START_EVT */
typedef struct {
tBTA_AV_CHNL chnl;
tBTA_AV_HNDL hndl;
tBTA_AV_STATUS status;
BOOLEAN initiator; /* TRUE, if local device initiates the START */
BOOLEAN suspending;
} tBTA_AV_START;
/* data associated with BTA_AV_SUSPEND_EVT */
typedef struct {
tBTA_AV_CHNL chnl;
tBTA_AV_HNDL hndl;
BOOLEAN initiator; /* TRUE, if local device initiates the SUSPEND */
tBTA_AV_STATUS status;
} tBTA_AV_SUSPEND;
/* data associated with BTA_AV_RECONFIG_EVT */
typedef struct {
tBTA_AV_CHNL chnl;
tBTA_AV_HNDL hndl;
tBTA_AV_STATUS status;
} tBTA_AV_RECONFIG;
/* data associated with BTA_AV_PROTECT_REQ_EVT */
typedef struct {
tBTA_AV_CHNL chnl;
tBTA_AV_HNDL hndl;
UINT8 *p_data;
UINT16 len;
} tBTA_AV_PROTECT_REQ;
/* data associated with BTA_AV_PROTECT_RSP_EVT */
typedef struct {
tBTA_AV_CHNL chnl;
tBTA_AV_HNDL hndl;
UINT8 *p_data;
UINT16 len;
tBTA_AV_ERR err_code;
} tBTA_AV_PROTECT_RSP;
/* 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;
} tBTA_AV_RC_OPEN;
/* data associated with BTA_AV_RC_CLOSE_EVT */
typedef struct {
UINT8 rc_handle;
BD_ADDR peer_addr;
} tBTA_AV_RC_CLOSE;
/* data associated with BTA_AV_RC_FEAT_EVT */
typedef struct {
UINT8 rc_handle;
tBTA_AV_FEAT peer_features;
} tBTA_AV_RC_FEAT;
/* data associated with BTA_AV_REMOTE_CMD_EVT */
typedef struct {
UINT8 rc_handle;
tBTA_AV_RC rc_id;
tBTA_AV_STATE key_state;
UINT8 len;
UINT8 *p_data;
tAVRC_HDR hdr; /* Message header. */
UINT8 label;
} tBTA_AV_REMOTE_CMD;
/* data associated with BTA_AV_REMOTE_RSP_EVT */
typedef struct {
UINT8 rc_handle;
tBTA_AV_RC rc_id;
tBTA_AV_STATE key_state;
UINT8 len;
UINT8 *p_data;
tBTA_AV_CODE rsp_code;
UINT8 label;
} tBTA_AV_REMOTE_RSP;
/* data associated with BTA_AV_VENDOR_CMD_EVT, BTA_AV_VENDOR_RSP_EVT */
typedef struct {
UINT8 rc_handle;
UINT16 len; /* Max vendor dependent message is 512 */
UINT8 label;
tBTA_AV_CODE code;
UINT32 company_id;
UINT8 *p_data;
} tBTA_AV_VENDOR;
/* data associated with BTA_AV_META_MSG_EVT */
typedef struct {
UINT8 rc_handle;
UINT16 len;
UINT8 label;
tBTA_AV_CODE code;
UINT32 company_id;
UINT8 *p_data;
tAVRC_MSG *p_msg;
} tBTA_AV_META_MSG;
/* data associated with BTA_AV_PENDING_EVT */
typedef struct {
BD_ADDR bd_addr;
} tBTA_AV_PEND;
/* data associated with BTA_AV_REJECT_EVT */
typedef struct {
BD_ADDR bd_addr;
tBTA_AV_HNDL hndl; /* Handle associated with the stream that rejected the connection. */
} tBTA_AV_REJECT;
/* union of data associated with AV callback */
typedef union {
tBTA_AV_CHNL chnl;
tBTA_AV_ENABLE enable;
tBTA_AV_REGISTER registr;
tBTA_AV_OPEN open;
tBTA_AV_CLOSE close;
tBTA_AV_START start;
tBTA_AV_PROTECT_REQ protect_req;
tBTA_AV_PROTECT_RSP protect_rsp;
tBTA_AV_RC_OPEN rc_open;
tBTA_AV_RC_CLOSE rc_close;
tBTA_AV_REMOTE_CMD remote_cmd;
tBTA_AV_REMOTE_RSP remote_rsp;
tBTA_AV_VENDOR vendor_cmd;
tBTA_AV_VENDOR vendor_rsp;
tBTA_AV_RECONFIG reconfig;
tBTA_AV_SUSPEND suspend;
tBTA_AV_PEND pend;
tBTA_AV_META_MSG meta_msg;
tBTA_AV_REJECT reject;
tBTA_AV_RC_FEAT rc_feat;
} tBTA_AV;
/* union of data associated with AV Media callback */
typedef union {
BT_HDR *p_data;
UINT8 *codec_info;
} tBTA_AV_MEDIA;
#define BTA_AVC_PACKET_LEN AVRC_PACKET_LEN
#define BTA_VENDOR_DATA_OFFSET 6
#define BTA_VENDOR_HEADER_LEN 4
#define BTA_MAX_VENDOR_DEPENDENT_DATA_LEN (BTA_AVC_PACKET_LEN-BTA_VENDOR_DATA_OFFSET-BTA_VENDOR_HEADER_LEN)
#define BTA_GROUP_NAVI_MSG_OP_DATA_LEN 5
#define BTA_ERROR_INVALID_CMD AVRC_STS_BAD_CMD
#define BTA_ERROR_INVALID_PARAM AVRC_STS_BAD_PARAM
#define BTA_ERROR_BAD_CONTENTS AVRC_STS_NOT_FOUND
#define BTA_ERROR_INTERNAL AVRC_STS_INTERNAL_ERR
#define BTA_AV_META_SINGLE_PACKET AVRC_PKT_SINGLE
#define BTA_AV_CO_METADATA AVRC_CO_METADATA
/* AV callback */
typedef void (tBTA_AV_CBACK)(tBTA_AV_EVT event, tBTA_AV *p_data);
typedef void (tBTA_AV_DATA_CBACK)(tBTA_AV_EVT event, tBTA_AV_MEDIA *p_data);
/* type for stream state machine action functions */
typedef void (*tBTA_AV_ACT)(void *p_cb, void *p_data);
/* type for registering VDP */
typedef void (tBTA_AV_REG) (tAVDT_CS *p_cs, char *p_service_name, void *p_data);
/* AV configuration structure */
typedef struct {
UINT32 company_id; /* AVRCP Company ID */
UINT16 avrc_mtu; /* AVRCP MTU at L2CAP for control channel */
UINT16 avrc_br_mtu; /* AVRCP MTU at L2CAP for browsing channel */
UINT16 avrc_ct_cat; /* AVRCP controller categories */
UINT16 avrc_tg_cat; /* AVRCP target categories */
UINT16 sig_mtu; /* AVDTP signaling channel MTU at L2CAP */
UINT16 audio_mtu; /* AVDTP audio transport channel MTU at L2CAP */
const UINT16 *p_audio_flush_to;/* AVDTP audio transport channel flush timeout */
UINT16 audio_mqs; /* AVDTP audio channel max data queue size */
UINT16 video_mtu; /* AVDTP video transport channel MTU at L2CAP */
UINT16 video_flush_to; /* AVDTP video transport channel flush timeout */
BOOLEAN avrc_group; /* TRUE, to accept AVRC 1.3 group nevigation command */
UINT8 num_co_ids; /* company id count in p_meta_co_ids */
UINT8 num_evt_ids; /* event id count in p_meta_evt_ids */
tBTA_AV_CODE rc_pass_rsp; /* the default response code for pass through commands */
const UINT32 *p_meta_co_ids;/* the metadata Get Capabilities response for company id */
const UINT8 *p_meta_evt_ids;/* the the metadata Get Capabilities response for event id */
const tBTA_AV_ACT *p_act_tbl;/* the action function table for VDP stream */
tBTA_AV_REG *p_reg; /* action function to register VDP */
char avrc_controller_name[BTA_SERVICE_NAME_LEN]; /* Default AVRCP controller name */
char avrc_target_name[BTA_SERVICE_NAME_LEN]; /* Default AVRCP target name*/
} tBTA_AV_CFG;
#ifdef __cplusplus
extern "C"
{
#endif
/*****************************************************************************
** External Function Declarations
*****************************************************************************/
/*******************************************************************************
**
** Function BTA_AvEnable
**
** Description Enable the advanced audio/video service. When the enable
** operation is complete the callback function will be
** called with a BTA_AV_ENABLE_EVT. This function must
** be called before other function in the AV API are
** called.
**
** Returns void
**
*******************************************************************************/
void BTA_AvEnable(tBTA_SEC sec_mask, tBTA_AV_FEAT features,
tBTA_AV_CBACK *p_cback);
/*******************************************************************************
**
** Function BTA_AvDisable
**
** Description Disable the advanced audio/video service.
**
**
** Returns void
**
*******************************************************************************/
void BTA_AvDisable(void);
/*******************************************************************************
**
** Function BTA_AvRegister
**
** Description Register the audio or video service to stack. When the
** operation is complete the callback function will be
** called with a BTA_AV_REGISTER_EVT. This function must
** be called before AVDT stream is open.
**
**
** Returns void
**
*******************************************************************************/
void BTA_AvRegister(tBTA_AV_CHNL chnl, const char *p_service_name,
UINT8 app_id, tBTA_AV_DATA_CBACK *p_data_cback, tBTA_AV_CO_FUNCTS *bta_av_cos);
/*******************************************************************************
**
** Function BTA_AvDeregister
**
** Description Deregister the audio or video service
**
** Returns void
**
*******************************************************************************/
void BTA_AvDeregister(tBTA_AV_HNDL hndl);
/*******************************************************************************
**
** Function BTA_AvOpen
**
** Description Opens an advanced audio/video connection to a peer device.
** When connection is open callback function is called
** with a BTA_AV_OPEN_EVT.
**
** Returns void
**
*******************************************************************************/
void BTA_AvOpen(BD_ADDR bd_addr, tBTA_AV_HNDL handle,
BOOLEAN use_rc, tBTA_SEC sec_mask, UINT16 uuid);
/*******************************************************************************
**
** Function BTA_AvClose
**
** Description Close the current streams.
**
** Returns void
**
*******************************************************************************/
void BTA_AvClose(tBTA_AV_HNDL handle);
/*******************************************************************************
**
** Function BTA_AvDisconnect
**
** Description Close the connection to the address.
**
** Returns void
**
*******************************************************************************/
void BTA_AvDisconnect(BD_ADDR bd_addr);
/*******************************************************************************
**
** Function BTA_AvEnable_Sink
**
** Description Enable/Disable A2DP Sink.
**
** Returns void
**
*******************************************************************************/
void BTA_AvEnable_Sink(int enable);
/*******************************************************************************
**
** Function BTA_AvStart
**
** Description Start audio/video stream data transfer.
**
** Returns void
**
*******************************************************************************/
void BTA_AvStart(void);
/*******************************************************************************
**
** Function BTA_AvStop
**
** Description Stop audio/video stream data transfer.
** If suspend is TRUE, this function sends AVDT suspend signal
** to the connected peer(s).
**
** Returns void
**
*******************************************************************************/
void BTA_AvStop(BOOLEAN suspend);
/*******************************************************************************
**
** Function BTA_AvReconfig
**
** Description Reconfigure the audio/video stream.
** If suspend is TRUE, this function tries the suspend/reconfigure
** procedure first.
** If suspend is FALSE or when suspend/reconfigure fails,
** this function closes and re-opens the AVDT connection.
**
** Returns void
**
*******************************************************************************/
void BTA_AvReconfig(tBTA_AV_HNDL hndl, BOOLEAN suspend, UINT8 sep_info_idx,
UINT8 *p_codec_info, UINT8 num_protect, UINT8 *p_protect_info);
/*******************************************************************************
**
** Function BTA_AvProtectReq
**
** Description Send a content protection request. This function can only
** be used if AV is enabled with feature BTA_AV_FEAT_PROTECT.
**
** Returns void
**
*******************************************************************************/
void BTA_AvProtectReq(tBTA_AV_HNDL hndl, UINT8 *p_data, UINT16 len);
/*******************************************************************************
**
** Function BTA_AvProtectRsp
**
** Description Send a content protection response. This function must
** be called if a BTA_AV_PROTECT_REQ_EVT is received.
** This function can only be used if AV is enabled with
** feature BTA_AV_FEAT_PROTECT.
**
** Returns void
**
*******************************************************************************/
void BTA_AvProtectRsp(tBTA_AV_HNDL hndl, UINT8 error_code, UINT8 *p_data,
UINT16 len);
/*******************************************************************************
**
** Function BTA_AvRemoteCmd
**
** Description Send a remote control command. This function can only
** be used if AV is enabled with feature BTA_AV_FEAT_RCCT.
**
** Returns void
**
*******************************************************************************/
void BTA_AvRemoteCmd(UINT8 rc_handle, UINT8 label, tBTA_AV_RC rc_id,
tBTA_AV_STATE key_state);
/*******************************************************************************
**
** Function BTA_AvVendorCmd
**
** Description Send a vendor dependent remote control command. This
** function can only be used if AV is enabled with feature
** BTA_AV_FEAT_VENDOR.
**
** Returns void
**
*******************************************************************************/
void BTA_AvVendorCmd(UINT8 rc_handle, UINT8 label, tBTA_AV_CODE cmd_code,
UINT8 *p_data, UINT16 len);
/*******************************************************************************
**
** Function BTA_AvVendorRsp
**
** Description Send a vendor dependent remote control response.
** This function must be called if a BTA_AV_VENDOR_CMD_EVT
** is received. This function can only be used if AV is
** enabled with feature BTA_AV_FEAT_VENDOR.
**
** Returns void
**
*******************************************************************************/
void BTA_AvVendorRsp(UINT8 rc_handle, UINT8 label, tBTA_AV_CODE rsp_code,
UINT8 *p_data, UINT16 len, UINT32 company_id);
/*******************************************************************************
**
** Function BTA_AvOpenRc
**
** Description Open an AVRCP connection toward the device with the
** specified handle
**
** Returns void
**
*******************************************************************************/
void BTA_AvOpenRc(tBTA_AV_HNDL handle);
/*******************************************************************************
**
** Function BTA_AvCloseRc
**
** Description Close an AVRCP connection
**
** Returns void
**
*******************************************************************************/
void BTA_AvCloseRc(UINT8 rc_handle);
/*******************************************************************************
**
** Function BTA_AvMetaRsp
**
** Description Send a Metadata command/response. The message contained
** in p_pkt can be composed with AVRC utility functions.
** This function can only be used if AV is enabled with feature
** BTA_AV_FEAT_METADATA.
**
** Returns void
**
*******************************************************************************/
void BTA_AvMetaRsp(UINT8 rc_handle, UINT8 label, tBTA_AV_CODE rsp_code,
BT_HDR *p_pkt);
/*******************************************************************************
**
** Function BTA_AvMetaCmd
**
** Description Send a Metadata/Advanced Control command. The message contained
** in p_pkt can be composed with AVRC utility functions.
** This function can only be used if AV is enabled with feature
** BTA_AV_FEAT_METADATA.
** This message is sent only when the peer supports the TG role.
*8 The only command makes sense right now is the absolute volume command.
**
** Returns void
**
*******************************************************************************/
void BTA_AvMetaCmd(UINT8 rc_handle, UINT8 label, tBTA_AV_CMD cmd_code, BT_HDR *p_pkt);
#ifdef __cplusplus
}
#endif
#endif ///BTA_AV_INCLUDED == TRUE
#endif /* BTA_AV_API_H */

View File

@ -0,0 +1,77 @@
/******************************************************************************
*
* Copyright (C) 2005-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 advanced audio/video call-in functions.
*
******************************************************************************/
#ifndef BTA_AV_CI_H
#define BTA_AV_CI_H
#include "bta/bta_av_api.h"
#if (BTA_AV_INCLUDED == TRUE)
/*****************************************************************************
** Function Declarations
*****************************************************************************/
#ifdef __cplusplus
extern "C"
{
#endif
/*******************************************************************************
**
** Function bta_av_ci_src_data_ready
**
** Description This function sends an event to the AV indicating that
** the phone has audio stream data ready to send and AV
** should call bta_av_co_audio_src_data_path() or
** bta_av_co_video_src_data_path().
**
** Returns void
**
*******************************************************************************/
extern void bta_av_ci_src_data_ready(tBTA_AV_CHNL chnl);
/*******************************************************************************
**
** Function bta_av_ci_setconfig
**
** Description This function must be called in response to function
** bta_av_co_audio_setconfig() or bta_av_co_video_setconfig.
** Parameter err_code is set to an AVDTP status value;
** AVDT_SUCCESS if the codec configuration is ok,
** otherwise error.
**
** Returns void
**
*******************************************************************************/
extern void bta_av_ci_setconfig(tBTA_AV_HNDL hndl, UINT8 err_code,
UINT8 category, UINT8 num_seid, UINT8 *p_seid,
BOOLEAN recfg_needed, UINT8 avdt_handle);
#ifdef __cplusplus
}
#endif
#endif ///BTA_AV_INCLUDED == TRUE
#endif /* BTA_AV_CI_H */

View File

@ -0,0 +1,393 @@
/******************************************************************************
*
* Copyright (C) 2003-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 advanced audio/video call-out functions.
*
******************************************************************************/
#ifndef BTA_AV_CO_H
#define BTA_AV_CO_H
#include "stack/l2c_api.h"
#include "bta/bta_av_api.h"
#if (BTA_AV_INCLUDED == TRUE)
/*****************************************************************************
** Constants and data types
*****************************************************************************/
/* TRUE to use SCMS-T content protection */
#ifndef BTA_AV_CO_CP_SCMS_T
#define BTA_AV_CO_CP_SCMS_T FALSE
#endif
/* the content protection IDs assigned by BT SIG */
#define BTA_AV_CP_SCMS_T_ID 0x0002
#define BTA_AV_CP_DTCP_ID 0x0001
#define BTA_AV_CP_LOSC 2
#define BTA_AV_CP_INFO_LEN 3
#define BTA_AV_CP_SCMS_COPY_MASK 3
#define BTA_AV_CP_SCMS_COPY_FREE 2
#define BTA_AV_CP_SCMS_COPY_ONCE 1
#define BTA_AV_CP_SCMS_COPY_NEVER 0
#define BTA_AV_CO_DEFAULT_AUDIO_OFFSET AVDT_MEDIA_OFFSET
enum {
BTA_AV_CO_ST_INIT,
BTA_AV_CO_ST_IN,
BTA_AV_CO_ST_OUT,
BTA_AV_CO_ST_OPEN,
BTA_AV_CO_ST_STREAM
};
/* data type for the Audio Codec Information*/
typedef struct {
UINT16 bit_rate; /* SBC encoder bit rate in kbps */
UINT16 bit_rate_busy; /* SBC encoder bit rate in kbps */
UINT16 bit_rate_swampd;/* SBC encoder bit rate in kbps */
UINT8 busy_level; /* Busy level indicating the bit-rate to be used */
UINT8 codec_info[AVDT_CODEC_SIZE];
UINT8 codec_type; /* Codec type */
} tBTA_AV_AUDIO_CODEC_INFO;
/*******************************************************************************
**
** Function bta_av_co_audio_init
**
** Description This callout function is executed by AV when it is
** started by calling BTA_AvEnable(). This function can be
** used by the phone to initialize audio paths or for other
** initialization purposes.
**
**
** Returns Stream codec and content protection capabilities info.
**
*******************************************************************************/
extern BOOLEAN bta_av_co_audio_init(UINT8 *p_codec_type, UINT8 *p_codec_info,
UINT8 *p_num_protect, UINT8 *p_protect_info, UINT8 index);
/*******************************************************************************
**
** Function bta_av_co_audio_disc_res
**
** Description This callout function is executed by AV to report the
** number of stream end points (SEP) were found during the
** AVDT stream discovery process.
**
**
** Returns void.
**
*******************************************************************************/
extern void bta_av_co_audio_disc_res(tBTA_AV_HNDL hndl, UINT8 num_seps,
UINT8 num_snk, UINT8 num_src, BD_ADDR addr, UINT16 uuid_local);
/*******************************************************************************
**
** Function bta_av_co_video_disc_res
**
** Description This callout function is executed by AV to report the
** number of stream end points (SEP) were found during the
** AVDT stream discovery process.
**
**
** Returns void.
**
*******************************************************************************/
extern void bta_av_co_video_disc_res(tBTA_AV_HNDL hndl, UINT8 num_seps,
UINT8 num_snk, BD_ADDR addr);
/*******************************************************************************
**
** Function bta_av_co_audio_getconfig
**
** Description This callout function is executed by AV to retrieve the
** desired codec and content protection configuration for the
** audio stream.
**
**
** Returns Stream codec and content protection configuration info.
**
*******************************************************************************/
extern UINT8 bta_av_co_audio_getconfig(tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type,
UINT8 *p_codec_info, UINT8 *p_sep_info_idx, UINT8 seid,
UINT8 *p_num_protect, UINT8 *p_protect_info);
/*******************************************************************************
**
** Function bta_av_co_video_getconfig
**
** Description This callout function is executed by AV to retrieve the
** desired codec and content protection configuration for the
** video stream.
**
**
** Returns Stream codec and content protection configuration info.
**
*******************************************************************************/
extern UINT8 bta_av_co_video_getconfig(tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type,
UINT8 *p_codec_info, UINT8 *p_sep_info_idx, UINT8 seid,
UINT8 *p_num_protect, UINT8 *p_protect_info);
/*******************************************************************************
**
** Function bta_av_co_audio_setconfig
**
** Description This callout function is executed by AV to set the
** codec and content protection configuration of the audio stream.
**
**
** Returns void
**
*******************************************************************************/
extern void bta_av_co_audio_setconfig(tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type,
UINT8 *p_codec_info, UINT8 seid, BD_ADDR addr,
UINT8 num_protect, UINT8 *p_protect_info, UINT8 t_local_sep, UINT8 avdt_handle);
/*******************************************************************************
**
** Function bta_av_co_video_setconfig
**
** Description This callout function is executed by AV to set the
** codec and content protection configuration of the video stream.
**
**
** Returns void
**
*******************************************************************************/
extern void bta_av_co_video_setconfig(tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type,
UINT8 *p_codec_info, UINT8 seid, BD_ADDR addr,
UINT8 num_protect, UINT8 *p_protect_info);
/*******************************************************************************
**
** Function bta_av_co_audio_open
**
** Description This function is called by AV when the audio stream connection
** is opened.
** BTA-AV maintains the MTU of A2DP streams.
** If this is the 2nd audio stream, mtu is the smaller of the 2
** streams.
**
** Returns void
**
*******************************************************************************/
extern void bta_av_co_audio_open(tBTA_AV_HNDL hndl,
tBTA_AV_CODEC codec_type, UINT8 *p_codec_info,
UINT16 mtu);
/*******************************************************************************
**
** Function bta_av_co_video_open
**
** Description This function is called by AV when the video stream connection
** is opened.
**
**
** Returns void
**
*******************************************************************************/
extern void bta_av_co_video_open(tBTA_AV_HNDL hndl,
tBTA_AV_CODEC codec_type, UINT8 *p_codec_info,
UINT16 mtu);
/*******************************************************************************
**
** Function bta_av_co_audio_close
**
** Description This function is called by AV when the audio stream connection
** is closed.
** BTA-AV maintains the MTU of A2DP streams.
** When one stream is closed and no other audio stream is open,
** mtu is reported as 0.
** Otherwise, the MTU remains open is reported.
**
** Returns void
**
*******************************************************************************/
extern void bta_av_co_audio_close(tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type,
UINT16 mtu);
/*******************************************************************************
**
** Function bta_av_co_video_close
**
** Description This function is called by AV when the video stream connection
** is closed.
**
**
** Returns void
**
*******************************************************************************/
extern void bta_av_co_video_close(tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type,
UINT16 mtu);
/*******************************************************************************
**
** Function bta_av_co_audio_start
**
** Description This function is called by AV when the audio streaming data
** transfer is started.
**
**
** Returns void
**
*******************************************************************************/
extern void bta_av_co_audio_start(tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type,
UINT8 *p_codec_info, BOOLEAN *p_no_rtp_hdr);
/*******************************************************************************
**
** Function bta_av_co_video_start
**
** Description This function is called by AV when the video streaming data
** transfer is started.
**
**
** Returns void
**
*******************************************************************************/
extern void bta_av_co_video_start(tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type,
UINT8 *p_codec_info, BOOLEAN *p_no_rtp_hdr);
/*******************************************************************************
**
** Function bta_av_co_audio_stop
**
** Description This function is called by AV when the audio streaming data
** transfer is stopped.
**
**
** Returns void
**
*******************************************************************************/
extern void bta_av_co_audio_stop(tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type);
/*******************************************************************************
**
** Function bta_av_co_video_stop
**
** Description This function is called by AV when the video streaming data
** transfer is stopped.
**
**
** Returns void
**
*******************************************************************************/
extern void bta_av_co_video_stop(tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type);
/*******************************************************************************
**
** Function bta_av_co_audio_src_data_path
**
** Description This function is called to get the next data buffer from
** the audio codec
**
** Returns NULL if data is not ready.
** Otherwise, a buffer (BT_HDR*) containing the audio data.
**
*******************************************************************************/
extern void *bta_av_co_audio_src_data_path(tBTA_AV_CODEC codec_type,
UINT32 *p_len, UINT32 *p_timestamp);
/*******************************************************************************
**
** Function bta_av_co_video_src_data_path
**
** Description This function is called to get the next data buffer from
** the video codec.
**
** Returns NULL if data is not ready.
** Otherwise, a video data buffer (UINT8*).
**
*******************************************************************************/
extern void *bta_av_co_video_src_data_path(tBTA_AV_CODEC codec_type,
UINT32 *p_len, UINT32 *p_timestamp);
/*******************************************************************************
**
** Function bta_av_co_audio_drop
**
** Description An Audio packet is dropped. .
** It's very likely that the connected headset with this handle
** is moved far away. The implementation may want to reduce
** the encoder bit rate setting to reduce the packet size.
**
** Returns void
**
*******************************************************************************/
extern void bta_av_co_audio_drop(tBTA_AV_HNDL hndl);
/*******************************************************************************
**
** Function bta_av_co_video_report_conn
**
** Description This function is called by AV when the reporting channel is
** opened (open=TRUE) or closed (open=FALSE).
**
** Returns void
**
*******************************************************************************/
extern void bta_av_co_video_report_conn (BOOLEAN open, UINT8 avdt_handle);
/*******************************************************************************
**
** Function bta_av_co_video_report_rr
**
** Description This function is called by AV when a Receiver Report is
** received
**
** Returns void
**
*******************************************************************************/
extern void bta_av_co_video_report_rr (UINT32 packet_lost);
/*******************************************************************************
**
** Function bta_av_co_audio_delay
**
** Description This function is called by AV when the audio stream connection
** needs to send the initial delay report to the connected SRC.
**
**
** Returns void
**
*******************************************************************************/
extern void bta_av_co_audio_delay(tBTA_AV_HNDL hndl, UINT16 delay);
/*******************************************************************************
**
** Function bta_av_co_video_delay
**
** Description This function is called by AV when the video stream connection
** needs to send the initial delay report to the connected SRC.
**
**
** Returns void
**
*******************************************************************************/
extern void bta_av_co_video_delay(tBTA_AV_HNDL hndl, UINT16 delay);
#endif ///BTA_AV_INCLUDED == TRUE
#endif /* BTA_AV_CO_H */

View File

@ -0,0 +1,223 @@
/******************************************************************************
*
* Copyright (C) 2004-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 to utility functions for dealing with SBC data
* frames and codec capabilities.
*
******************************************************************************/
#ifndef BTA_AV_SBC_H
#define BTA_AV_SBC_H
#if (BTA_AV_INCLUDED == TRUE)
/*****************************************************************************
** constants
*****************************************************************************/
/* SBC packet header size */
#define BTA_AV_SBC_HDR_SIZE A2D_SBC_MPL_HDR_LEN
/*******************************************************************************
**
** Function bta_av_sbc_init_up_sample
**
** Description initialize the up sample
**
** src_sps: samples per second (source audio data)
** dst_sps: samples per second (converted audio data)
** bits: number of bits per pcm sample
** n_channels: number of channels (i.e. mono(1), stereo(2)...)
**
** Returns none
**
*******************************************************************************/
extern void bta_av_sbc_init_up_sample (UINT32 src_sps, UINT32 dst_sps,
UINT16 bits, UINT16 n_channels);
/*******************************************************************************
**
** Function bta_av_sbc_up_sample
**
** Description Given the source (p_src) audio data and
** source speed (src_sps, samples per second),
** This function converts it to audio data in the desired format
**
** p_src: the data buffer that holds the source audio data
** p_dst: the data buffer to hold the converted audio data
** src_samples: The number of source samples (number of bytes)
** dst_samples: The size of p_dst (number of bytes)
**
** Note: An AE reported an issue with this function.
** When called with bta_av_sbc_up_sample(src, uint8_array_dst..)
** the byte before uint8_array_dst may get overwritten.
** Using uint16_array_dst avoids the problem.
** This issue is related to endian-ness and is hard to resolve
** in a generic manner.
** **************** Please use uint16 array as dst.
**
** Returns The number of bytes used in p_dst
** The number of bytes used in p_src (in *p_ret)
**
*******************************************************************************/
extern int bta_av_sbc_up_sample (void *p_src, void *p_dst,
UINT32 src_samples, UINT32 dst_samples,
UINT32 *p_ret);
/*******************************************************************************
**
** Function bta_av_sbc_up_sample_16s (16bits-stereo)
**
** Description Given the source (p_src) audio data and
** source speed (src_sps, samples per second),
** This function converts it to audio data in the desired format
**
** p_src: the data buffer that holds the source audio data
** p_dst: the data buffer to hold the converted audio data
** src_samples: The number of source samples (in uint of 4 bytes)
** dst_samples: The size of p_dst (in uint of 4 bytes)
**
** Returns The number of bytes used in p_dst
** The number of bytes used in p_src (in *p_ret)
**
*******************************************************************************/
extern int bta_av_sbc_up_sample_16s (void *p_src, void *p_dst,
UINT32 src_samples, UINT32 dst_samples,
UINT32 *p_ret);
/*******************************************************************************
**
** Function bta_av_sbc_up_sample_16m (16bits-mono)
**
** Description Given the source (p_src) audio data and
** source speed (src_sps, samples per second),
** This function converts it to audio data in the desired format
**
** p_src: the data buffer that holds the source audio data
** p_dst: the data buffer to hold the converted audio data
** src_samples: The number of source samples (in uint of 2 bytes)
** dst_samples: The size of p_dst (in uint of 2 bytes)
**
** Returns The number of bytes used in p_dst
** The number of bytes used in p_src (in *p_ret)
**
*******************************************************************************/
extern int bta_av_sbc_up_sample_16m (void *p_src, void *p_dst,
UINT32 src_samples, UINT32 dst_samples,
UINT32 *p_ret);
/*******************************************************************************
**
** Function bta_av_sbc_up_sample_8s (8bits-stereo)
**
** Description Given the source (p_src) audio data and
** source speed (src_sps, samples per second),
** This function converts it to audio data in the desired format
**
** p_src: the data buffer that holds the source audio data
** p_dst: the data buffer to hold the converted audio data
** src_samples: The number of source samples (in uint of 2 bytes)
** dst_samples: The size of p_dst (in uint of 2 bytes)
**
** Returns The number of bytes used in p_dst
** The number of bytes used in p_src (in *p_ret)
**
*******************************************************************************/
extern int bta_av_sbc_up_sample_8s (void *p_src, void *p_dst,
UINT32 src_samples, UINT32 dst_samples,
UINT32 *p_ret);
/*******************************************************************************
**
** Function bta_av_sbc_up_sample_8m (8bits-mono)
**
** Description Given the source (p_src) audio data and
** source speed (src_sps, samples per second),
** This function converts it to audio data in the desired format
**
** p_src: the data buffer that holds the source audio data
** p_dst: the data buffer to hold the converted audio data
** src_samples: The number of source samples (number of bytes)
** dst_samples: The size of p_dst (number of bytes)
**
** Returns The number of bytes used in p_dst
** The number of bytes used in p_src (in *p_ret)
**
*******************************************************************************/
extern int bta_av_sbc_up_sample_8m (void *p_src, void *p_dst,
UINT32 src_samples, UINT32 dst_samples,
UINT32 *p_ret);
/*******************************************************************************
**
** Function bta_av_sbc_cfg_for_cap
**
** Description Determine the preferred SBC codec configuration for the
** given codec capabilities. The function is passed the
** preferred codec configuration and the peer codec
** capabilities for the stream. The function attempts to
** match the preferred capabilities with the configuration
** as best it can. The resulting codec configuration is
** returned in the same memory used for the capabilities.
**
** Returns 0 if ok, nonzero if error.
** Codec configuration in p_cap.
**
*******************************************************************************/
extern UINT8 bta_av_sbc_cfg_for_cap(UINT8 *p_peer, tA2D_SBC_CIE *p_cap, tA2D_SBC_CIE *p_pref);
/*******************************************************************************
**
** Function bta_av_sbc_cfg_in_cap
**
** Description This function checks whether an SBC codec configuration
** is allowable for the given codec capabilities.
**
** Returns 0 if ok, nonzero if error.
**
*******************************************************************************/
extern UINT8 bta_av_sbc_cfg_in_cap(UINT8 *p_cfg, tA2D_SBC_CIE *p_cap);
/*******************************************************************************
**
** Function bta_av_sbc_cfg_matches_cap
**
** Description This function checks whether an SBC codec configuration
** matched with capabilities. Here we check subset.
**
** Returns 0 if ok, nonzero if error.
**
*******************************************************************************/
extern UINT8 bta_av_sbc_cfg_matches_cap(UINT8 *p_cfg, tA2D_SBC_CIE *p_cap);
/*******************************************************************************
**
** Function bta_av_sbc_bld_hdr
**
** Description This function builds the packet header for MPF1.
**
** Returns void
**
*******************************************************************************/
extern void bta_av_sbc_bld_hdr(BT_HDR *p_buf, UINT16 fr_per_pkt);
#endif ///BTA_AV_INCLUDED == TRUE
#endif /* BTA_AV_SBC_H */

View File

@ -0,0 +1,68 @@
/******************************************************************************
*
* 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 interface file for device mananger call-in functions.
*
******************************************************************************/
#ifndef BTA_DM_CI_H
#define BTA_DM_CI_H
#include "bta/bta_api.h"
/*****************************************************************************
** Function Declarations
*****************************************************************************/
#ifdef __cplusplus
extern "C"
{
#endif
/*******************************************************************************
**
** Function bta_dm_ci_io_req
**
** Description This function must be called in response to function
** bta_dm_co_io_req(), if *p_oob_data is set to BTA_OOB_UNKNOWN
** by bta_dm_co_io_req().
**
** Returns void
**
*******************************************************************************/
extern void bta_dm_ci_io_req(BD_ADDR bd_addr, tBTA_IO_CAP io_cap,
tBTA_OOB_DATA oob_data, tBTA_AUTH_REQ auth_req);
/*******************************************************************************
**
** Function bta_dm_ci_rmt_oob
**
** Description This function must be called in response to function
** bta_dm_co_rmt_oob() to provide the OOB data associated
** with the remote device.
**
** Returns void
**
*******************************************************************************/
extern void bta_dm_ci_rmt_oob(BOOLEAN accept, BD_ADDR bd_addr,
BT_OCTET16 c, BT_OCTET16 r);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,193 @@
/******************************************************************************
*
* 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 interface file for device mananger callout functions.
*
******************************************************************************/
#ifndef BTA_DM_CO_H
#define BTA_DM_CO_H
#include "bta/bta_sys.h"
/*****************************************************************************
** Function Declarations
*****************************************************************************/
/*******************************************************************************
**
** Function bta_dm_co_io_req
**
** Description This callout function is executed by DM to get IO capabilities
** of the local device for the Simple Pairing process
**
** Parameters bd_addr - The peer device
** *p_io_cap - The local Input/Output capabilities
** *p_oob_data - TRUE, if OOB data is available for the peer device.
** *p_auth_req - TRUE, if MITM protection is required.
**
** Returns void.
**
*******************************************************************************/
extern void bta_dm_co_io_req(BD_ADDR bd_addr, tBTA_IO_CAP *p_io_cap,
tBTA_OOB_DATA *p_oob_data, tBTA_AUTH_REQ *p_auth_req,
BOOLEAN is_orig);
/*******************************************************************************
**
** Function bta_dm_co_io_rsp
**
** Description This callout function is executed by DM to report IO capabilities
** of the peer device for the Simple Pairing process
**
** Parameters bd_addr - The peer device
** io_cap - The remote Input/Output capabilities
** oob_data - TRUE, if OOB data is available for the peer device.
** auth_req - TRUE, if MITM protection is required.
**
** Returns void.
**
*******************************************************************************/
extern void bta_dm_co_io_rsp(BD_ADDR bd_addr, tBTA_IO_CAP io_cap,
tBTA_OOB_DATA oob_data, tBTA_AUTH_REQ auth_req);
/*******************************************************************************
**
** Function bta_dm_co_lk_upgrade
**
** Description This callout function is executed by DM to check if the
** platform wants allow link key upgrade
**
** Parameters bd_addr - The peer device
** *p_upgrade - TRUE, if link key upgrade is desired.
**
** Returns void.
**
*******************************************************************************/
extern void bta_dm_co_lk_upgrade(BD_ADDR bd_addr, BOOLEAN *p_upgrade );
/*******************************************************************************
**
** Function bta_dm_co_loc_oob
**
** Description This callout function is executed by DM to report the OOB
** data of the local device for the Simple Pairing process
**
** Parameters valid - TRUE, if the local OOB data is retrieved from LM
** c - Simple Pairing Hash C
** r - Simple Pairing Randomnizer R
**
** Returns void.
**
*******************************************************************************/
extern void bta_dm_co_loc_oob(BOOLEAN valid, BT_OCTET16 c, BT_OCTET16 r);
/*******************************************************************************
**
** Function bta_dm_co_rmt_oob
**
** Description This callout function is executed by DM to request the OOB
** data for the remote device for the Simple Pairing process
**
** Parameters bd_addr - The peer device
**
** Returns void.
**
*******************************************************************************/
extern void bta_dm_co_rmt_oob(BD_ADDR bd_addr);
/*******************************************************************************
**
** Function bta_dm_co_ble_io_req
**
** Description This callout function is executed by DM to get BLE IO capabilities
** before SMP pairing gets going.
**
** Parameters bd_addr - The peer device
** *p_io_cap - The local Input/Output capabilities
** *p_oob_data - TRUE, if OOB data is available for the peer device.
** *p_auth_req - Auth request setting (Bonding and MITM required or not)
** *p_max_key_size - max key size local device supported.
** *p_init_key - initiator keys.
** *p_resp_key - responder keys.
**
** Returns void.
**
*******************************************************************************/
extern void bta_dm_co_ble_io_req(BD_ADDR bd_addr, tBTA_IO_CAP *p_io_cap,
tBTA_OOB_DATA *p_oob_data,
tBTA_LE_AUTH_REQ *p_auth_req,
UINT8 *p_max_key_size,
tBTA_LE_KEY_TYPE *p_init_key,
tBTA_LE_KEY_TYPE *p_resp_key );
/*******************************************************************************
**
** Function bta_dm_co_ble_local_key_reload
**
** Description This callout function is to load the local BLE keys if available
** on the device.
**
** Parameters none
**
** Returns void.
**
*******************************************************************************/
extern void bta_dm_co_ble_load_local_keys (tBTA_DM_BLE_LOCAL_KEY_MASK *p_key_mask, BT_OCTET16 er,
tBTA_BLE_LOCAL_ID_KEYS *p_id_keys);
// btla-specific ++
/*******************************************************************************
**
** Function bta_dm_co_ble_io_req
**
** Description This callout function is executed by DM to get BLE IO capabilities
** before SMP pairing gets going.
**
** Parameters bd_addr - The peer device
** *p_io_cap - The local Input/Output capabilities
** *p_oob_data - TRUE, if OOB data is available for the peer device.
** *p_auth_req - Auth request setting (Bonding and MITM required or not)
** *p_max_key_size - max key size local device supported.
** *p_init_key - initiator keys.
** *p_resp_key - responder keys.
**
** Returns void.
**
*******************************************************************************/
extern void bta_dm_co_ble_io_req(BD_ADDR bd_addr, tBTA_IO_CAP *p_io_cap,
tBTA_OOB_DATA *p_oob_data,
tBTA_LE_AUTH_REQ *p_auth_req,
UINT8 *p_max_key_size,
tBTA_LE_KEY_TYPE *p_init_key,
tBTA_LE_KEY_TYPE *p_resp_key );
// btla-specific --
extern void bta_dm_co_ble_set_io_cap(UINT8 ble_io_cap);
extern void bta_dm_co_ble_set_auth_req(UINT8 ble_auth_req);
extern void bta_dm_co_ble_set_init_key_req(UINT8 init_key);
extern void bta_dm_co_ble_set_rsp_key_req(UINT8 rsp_key);
extern void bta_dm_co_ble_set_max_key_size(UINT8 ble_key_size);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,36 @@
/******************************************************************************
* Copyright 2015-2017 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.
******************************************************************************/
/******************************************************************************
*
* This file contains the action functions for gatts and gattc.
*
*
******************************************************************************/
#include "stack/bt_types.h"
#ifdef __cplusplus
extern "C"
{
#endif
extern void BTA_GATT_SetLocalMTU(uint16_t mtu);
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,117 @@
/******************************************************************************
*
* Copyright (C) 2003-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 GATT call-in functions.
*
******************************************************************************/
#ifndef BTA_GATTC_CI_H
#define BTA_GATTC_CI_H
#include "bta/bta_gatt_api.h"
/*****************************************************************************
** Constants and data types
*****************************************************************************/
/* Open Complete Event */
typedef struct {
BT_HDR hdr;
tBTA_GATT_STATUS status;
} tBTA_GATTC_CI_EVT;
#define BTA_GATTC_NV_LOAD_MAX 100
/* Read Ready Event */
typedef struct {
BT_HDR hdr;
tBTA_GATT_STATUS status;
UINT16 num_attr;
tBTA_GATTC_NV_ATTR attr[BTA_GATTC_NV_LOAD_MAX];
} tBTA_GATTC_CI_LOAD;
/*****************************************************************************
** Function Declarations
*****************************************************************************/
#ifdef __cplusplus
extern "C"
{
#endif
/*******************************************************************************
**
** Function bta_gattc_ci_cache_open
**
** Description This function sends an event to indicate server cache open
** completed.
**
** Parameters server_bda - server BDA of this cache.
** status - BTA_GATT_OK if full buffer of data,
** BTA_GATT_FAIL if an error has occurred.
**
** Returns void
**
*******************************************************************************/
extern void bta_gattc_ci_cache_open(BD_ADDR server_bda, UINT16 evt,
tBTA_GATT_STATUS status, UINT16 conn_id);
/*******************************************************************************
**
** Function bta_gattc_ci_cache_load
**
** Description This function sends an event to BTA indicating the phone has
** load the servere cache and ready to send it to the stack.
**
** Parameters server_bda - server BDA of this cache.
** num_bytes_read - number of bytes read into the buffer
** specified in the read callout-function.
** status - BTA_GATT_OK if full buffer of data,
** BTA_GATT_FAIL if an error has occurred.
**
** Returns void
**
*******************************************************************************/
extern void bta_gattc_ci_cache_load(BD_ADDR server_bda, UINT16 evt,
UINT16 num_attr, tBTA_GATTC_NV_ATTR *p_atrr,
tBTA_GATT_STATUS status, UINT16 conn_id);
/*******************************************************************************
**
** Function bta_gattc_ci_save
**
** Description This function sends an event to BTA indicating the phone has
** save the server cache.
**
** Parameters server_bda - server BDA of this cache.
** status - BTA_GATT_OK if full buffer of data,
** BTA_GATT_FAIL if an error has occurred.
**
** Returns void
**
*******************************************************************************/
extern void bta_gattc_ci_cache_save(BD_ADDR server_bda, UINT16 evt,
tBTA_GATT_STATUS status, UINT16 conn_id);
#ifdef __cplusplus
}
#endif
#endif /* BTA_GATTC_CI_H */

View File

@ -0,0 +1,140 @@
/******************************************************************************
*
* Copyright (C) 2009-2013 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 BTA GATT client call-out functions.
*
******************************************************************************/
#ifndef BTA_GATTC_CO_H
#define BTA_GATTC_CO_H
#include "bta/bta_gatt_api.h"
#include "osi/hash_functions.h"
/*******************************************************************************
**
** Function bta_gattc_co_cache_open
**
** Description This callout function is executed by GATTC when a GATT server
** cache is ready to be sent.
**
** Parameter server_bda: server bd address of this cache belongs to
** evt: call in event to be passed in when cache open is done.
** conn_id: connection ID of this cache operation attach to.
** to_save: open cache to save or to load.
**
** Returns void.
**
*******************************************************************************/
extern tBTA_GATT_STATUS bta_gattc_co_cache_open(BD_ADDR server_bda, BOOLEAN to_save, UINT8 *index);
/*******************************************************************************
**
** Function bta_gattc_co_cache_close
**
** Description This callout function is executed by GATTC when a GATT server
** cache is written completely.
**
** Parameter server_bda: server bd address of this cache belongs to
** conn_id: connection ID of this cache operation attach to.
**
** Returns void.
**
*******************************************************************************/
extern void bta_gattc_co_cache_close(BD_ADDR server_bda, UINT16 conn_id);
/*******************************************************************************
**
** Function bta_gattc_co_cache_save
**
** Description This callout function is executed by GATT when a server cache
** is available to save.
**
** Parameter server_bda: server bd address of this cache belongs to
** evt: call in event to be passed in when cache save is done.
** num_attr: number of attribute to be save.
** p_attr: pointer to the list of attributes to save.
** attr_index: starting attribute index of the save operation.
** conn_id: connection ID of this cache operation attach to.
** Returns
**
*******************************************************************************/
extern void bta_gattc_co_cache_save (BD_ADDR server_bda, UINT16 num_attr,
tBTA_GATTC_NV_ATTR *p_attr_list);
/*******************************************************************************
**
** Function bta_gattc_co_cache_load
**
** Description This callout function is executed by GATT when server cache
** is required to load.
**
** Parameter server_bda: server bd address of this cache belongs to
** evt: call in event to be passed in when cache save is done.
** num_attr: number of attribute to be save.
** attr_index: starting attribute index of the save operation.
** conn_id: connection ID of this cache operation attach to.
** Returns
**
*******************************************************************************/
extern tBTA_GATT_STATUS bta_gattc_co_cache_load(tBTA_GATTC_NV_ATTR *attr, UINT8 index);
/*******************************************************************************
**
** Function bta_gattc_co_cache_reset
**
** Description This callout function is executed by GATTC to reset cache in
** application
**
** Parameter server_bda: server bd address of this cache belongs to
**
** Returns void.
**
*******************************************************************************/
extern void bta_gattc_co_cache_reset(BD_ADDR server_bda);
extern size_t bta_gattc_get_cache_attr_length(UINT8 index);
extern void bta_gattc_co_cache_addr_init(void);
extern void bta_gattc_co_cache_addr_deinit(void);
extern BOOLEAN bta_gattc_co_addr_in_cache(BD_ADDR bda);
extern uint8_t bta_gattc_co_find_addr_in_cache(BD_ADDR bda);
extern uint8_t bta_gattc_co_find_hash_in_cache(hash_key_t hash_key);
extern UINT8 bta_gattc_co_get_addr_num(void);
extern void bta_gattc_co_get_addr_list(BD_ADDR *addr_list);
extern void bta_gattc_co_cache_addr_save(BD_ADDR bd_addr, hash_key_t hash_key);
extern BOOLEAN bta_gattc_co_cache_new_assoc_list(BD_ADDR src_addr, uint8_t index);
extern BOOLEAN bta_gattc_co_cache_append_assoc_addr(BD_ADDR src_addr, BD_ADDR assoc_addr);
extern BOOLEAN bta_gattc_co_cache_remove_assoc_addr(BD_ADDR src_addr, BD_ADDR assoc_addr);
uint8_t* bta_gattc_co_cache_find_src_addr(BD_ADDR assoc_addr, uint8_t *index);
extern BOOLEAN bta_gattc_co_cache_clear_assoc_addr(BD_ADDR src_addr);
#endif /* BTA_GATT_CO_H */

View File

@ -0,0 +1,81 @@
/******************************************************************************
*
* Copyright (C) 2010-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 BTA GATT server call-out functions.
*
******************************************************************************/
#ifndef BTA_GATTS_CO_H
#define BTA_GATTS_CO_H
#include "bta/bta_gatt_api.h"
/*******************************************************************************
**
** Function bta_gatts_co_update_handle_range
**
** Description This callout function is executed by GATTS when a GATT server
** handle range ios to be added or removed.
**
** Parameter is_add: true is to add a handle range; otherwise is to delete.
** p_hndl_range: handle range.
**
** Returns void.
**
*******************************************************************************/
extern void bta_gatts_co_update_handle_range(BOOLEAN is_add, tBTA_GATTS_HNDL_RANGE *p_hndl_range);
/*******************************************************************************
**
** Function bta_gatts_co_srv_chg
**
** Description This call-out is to read/write/remove service change related
** informaiton. The request consists of the cmd and p_req and the
** response is returned in p_rsp
**
** Parameter cmd - request command
** p_req - request paramters
** p_rsp - response data for the request
**
** Returns TRUE - if the request is processed successfully and
** the response is returned in p_rsp.
** FASLE - if the request can not be processed
**
*******************************************************************************/
extern BOOLEAN bta_gatts_co_srv_chg(tBTA_GATTS_SRV_CHG_CMD cmd,
tBTA_GATTS_SRV_CHG_REQ *p_req,
tBTA_GATTS_SRV_CHG_RSP *p_rsp);
/*******************************************************************************
**
** Function bta_gatts_co_load_handle_range
**
** Description This callout function is executed by GATTS when a GATT server
** handle range is requested to be loaded from NV.
**
** Parameter
**
** Returns void.
**
*******************************************************************************/
extern BOOLEAN bta_gatts_co_load_handle_range(UINT8 index,
tBTA_GATTS_HNDL_RANGE *p_handle);
#endif /* BTA_GATTS_CO_H */

View File

@ -0,0 +1,378 @@
/******************************************************************************
*
* Copyright (c) 2014 The Android Open Source Project
* Copyright (C) 2003-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 for the handsfree (HF role) subsystem
*
******************************************************************************/
#ifndef BTA_HF_CLIENT_API_H
#define BTA_HF_CLIENT_API_H
#include "bta_api.h"
#include "bta_hfp_defs.h"
#if (BTA_HF_INCLUDED == TRUE)
/*****************************************************************************
** Constants and data types
*****************************************************************************/
/* HFP peer (AG) features*/
#define BTA_HF_CLIENT_PEER_FEAT_3WAY 0x00000001 /* Three-way calling */
#define BTA_HF_CLIENT_PEER_FEAT_ECNR 0x00000002 /* Echo cancellation and/or noise reduction */
#define BTA_HF_CLIENT_PEER_FEAT_VREC 0x00000004 /* Voice recognition */
#define BTA_HF_CLIENT_PEER_INBAND 0x00000008 /* In-band ring tone */
#define BTA_HF_CLIENT_PEER_VTAG 0x00000010 /* Attach a phone number to a voice tag */
#define BTA_HF_CLIENT_PEER_REJECT 0x00000020 /* Ability to reject incoming call */
#define BTA_HF_CLIENT_PEER_ECS 0x00000040 /* Enhanced Call Status */
#define BTA_HF_CLIENT_PEER_ECC 0x00000080 /* Enhanced Call Control */
#define BTA_HF_CLIENT_PEER_EXTERR 0x00000100 /* Extended error codes */
#define BTA_HF_CLIENT_PEER_CODEC 0x00000200 /* Codec Negotiation */
typedef UINT16 tBTA_HF_CLIENT_PEER_FEAT;
/* HFP HF features */
#define BTA_HF_CLIENT_FEAT_ECNR 0x00000001 /* Echo cancellation and/or noise reduction */
#define BTA_HF_CLIENT_FEAT_3WAY 0x00000002 /* Call waiting and three-way calling */
#define BTA_HF_CLIENT_FEAT_CLI 0x00000004 /* Caller ID presentation capability */
#define BTA_HF_CLIENT_FEAT_VREC 0x00000008 /* Voice recognition activation */
#define BTA_HF_CLIENT_FEAT_VOL 0x00000010 /* Remote volume control */
#define BTA_HF_CLIENT_FEAT_ECS 0x00000020 /* Enhanced Call Status */
#define BTA_HF_CLIENT_FEAT_ECC 0x00000040 /* Enhanced Call Control */
#define BTA_HF_CLIENT_FEAT_CODEC 0x00000080 /* Codec Negotiation */
/* HFP HF extended call handling - masks not related to any spec */
#define BTA_HF_CLIENT_CHLD_REL 0x00000001 /* 0 Release waiting call or held calls */
#define BTA_HF_CLIENT_CHLD_REL_ACC 0x00000002 /* 1 Release active calls and accept other (waiting or held) cal */
#define BTA_HF_CLIENT_CHLD_REL_X 0x00000004 /* 1x Release x call*/
#define BTA_HF_CLIENT_CHLD_HOLD_ACC 0x00000008 /* 2 Active calls on hold and accept other call */
#define BTA_HF_CLIENT_CHLD_PRIV_X 0x00000010 /* 2x Active multiparty call on hold except call x */
#define BTA_HF_CLIENT_CHLD_MERGE 0x00000020 /* 3 Add held call to multiparty */
#define BTA_HF_CLIENT_CHLD_MERGE_DETACH 0x00000040 /* 4 Add held call to multiparty */
typedef UINT16 tBTA_HF_CLIENT_CHLD_FEAT;
/* HFP AG errors ot OK sent to HF Unit */
#define BTA_HF_CLIENT_AT_RESULT_OK 0
#define BTA_HF_CLIENT_AT_RESULT_ERROR 1
#define BTA_HF_CLIENT_AT_RESULT_NO_CARRIER 2
#define BTA_HF_CLIENT_AT_RESULT_BUSY 3
#define BTA_HF_CLIENT_AT_RESULT_NO_ANSWER 4
#define BTA_HF_CLIENT_AT_RESULT_DELAY 5
#define BTA_HF_CLIENT_AT_RESULT_BLACKLISTED 6
#define BTA_HF_CLIENT_AT_RESULT_CME 7
typedef UINT8 tBTA_HF_CLIENT_AT_RESULT_TYPE;
/* HF Client callback events */
#define BTA_HF_CLIENT_ENABLE_EVT 0 /* HF Client enabled */
#define BTA_HF_CLIENT_REGISTER_EVT 1 /* HF Client registered */
#define BTA_HF_CLIENT_OPEN_EVT 2 /* HF Client connection open */
#define BTA_HF_CLIENT_CLOSE_EVT 3 /* HF Client connection closed */
#define BTA_HF_CLIENT_CONN_EVT 4 /* Service level connection opened */
#define BTA_HF_CLIENT_AUDIO_OPEN_EVT 5 /* Audio connection open */
#define BTA_HF_CLIENT_AUDIO_MSBC_OPEN_EVT 6 /* Audio connection with mSBC codec open */
#define BTA_HF_CLIENT_AUDIO_CLOSE_EVT 7 /* Audio connection closed */
#define BTA_HF_CLIENT_SPK_EVT 8 /* Speaker volume changed */
#define BTA_HF_CLIENT_MIC_EVT 9 /* Microphone volume changed */
#define BTA_HF_CLIENT_IND_EVT 10 /* Indicator */
#define BTA_HF_CLIENT_VOICE_REC_EVT 11 /* AG changed voice recognition setting */
#define BTA_HF_CLIENT_OPERATOR_NAME_EVT 12 /* Operator name acquired */
#define BTA_HF_CLIENT_CLIP_EVT 13 /* Calling line identification event */
#define BTA_HF_CLIENT_CCWA_EVT 14 /* Call waiting notification */
#define BTA_HF_CLIENT_AT_RESULT_EVT 15 /* Call waiting notification */
#define BTA_HF_CLIENT_CLCC_EVT 16 /* current call event */
#define BTA_HF_CLIENT_CNUM_EVT 17 /* subscriber information event */
#define BTA_HF_CLIENT_BTRH_EVT 18 /* bluetooth response and hold event */
#define BTA_HF_CLIENT_BSIR_EVT 19 /* in-band ring tone setting changed event */
#define BTA_HF_CLIENT_BINP_EVT 20 /* binp number event */
#define BTA_HF_CLIENT_RING_INDICATION 21 /* HF Client ring indication */
#define BTA_HF_CLIENT_DISABLE_EVT 30 /* HF Client disabled */
typedef UINT8 tBTA_HF_CLIENT_EVT;
/* HF Client open status */
#define BTA_HF_CLIENT_SUCCESS 0 /* Connection successfully opened */
#define BTA_HF_CLIENT_FAIL_SDP 1 /* Open failed due to SDP */
#define BTA_HF_CLIENT_FAIL_RFCOMM 2 /* Open failed due to RFCOMM */
#define BTA_HF_CLIENT_FAIL_RESOURCES 3 /* out of resources failure */
typedef UINT8 tBTA_HF_CLIENT_STATUS;
/* indicator type */
#define BTA_HF_CLIENT_IND_BATTCH 0 /* Battery charge indicator */
#define BTA_HF_CLIENT_IND_SIGNAL 1 /* Signal Strength indicator */
#define BTA_HF_CLIENT_IND_SERVICE 2 /* Service availability indicator */
#define BTA_HF_CLIENT_IND_CALL 3 /* Standard call status indicator*/
#define BTA_HF_CLIENT_IND_ROAM 4 /* Roaming status indicator */
#define BTA_HF_CLIENT_IND_CALLSETUP 5 /* Call setup status indicator */
#define BTA_HF_CLIENT_IND_CALLHELD 6 /* Call hold status indicator */
typedef UINT8 tBTA_HF_CLIENT_IND_TYPE;
/* AT commands */
#define BTA_HF_CLIENT_AT_CMD_VTS 0
#define BTA_HF_CLIENT_AT_CMD_BTRH 1
#define BTA_HF_CLIENT_AT_CMD_CHUP 2
#define BTA_HF_CLIENT_AT_CMD_CHLD 3
#define BTA_HF_CLIENT_AT_CMD_BCC 4
#define BTA_HF_CLIENT_AT_CMD_CNUM 5
#define BTA_HF_CLIENT_AT_CMD_ATA 6
#define BTA_HF_CLIENT_AT_CMD_COPS 7
#define BTA_HF_CLIENT_AT_CMD_ATD 8
#define BTA_HF_CLIENT_AT_CMD_VGM 9
#define BTA_HF_CLIENT_AT_CMD_VGS 10
#define BTA_HF_CLIENT_AT_CMD_BVRA 11
#define BTA_HF_CLIENT_AT_CMD_CLCC 12
#define BTA_HF_CLIENT_AT_CMD_BINP 13
#define BTA_HF_CLIENT_AT_CMD_BLDN 14
#define BTA_HF_CLIENT_AT_CMD_NREC 15
typedef UINT8 tBTA_HF_CLIENT_AT_CMD_TYPE;
/* data associated with most non-AT events */
/* placeholder, if not needed should be removed*/
typedef struct {
} tBTA_HF_CLIENT_HDR;
/* data associated with BTA_HF_CLIENT_REGISTER_EVT */
typedef struct {
tBTA_HF_CLIENT_HDR hdr;
UINT16 handle;
tBTA_HF_CLIENT_STATUS status;
} tBTA_HF_CLIENT_REGISTER;
/* data associated with BTA_HF_CLIENT_OPEN_EVT */
typedef struct {
tBTA_HF_CLIENT_HDR hdr;
BD_ADDR bd_addr;
tBTA_HF_CLIENT_STATUS status;
} tBTA_HF_CLIENT_OPEN;
/* data associated with BTA_HF_CLIENT_CONN_EVT */
typedef struct {
tBTA_HF_CLIENT_HDR hdr;
tBTA_HF_CLIENT_PEER_FEAT peer_feat;
tBTA_HF_CLIENT_CHLD_FEAT chld_feat;
} tBTA_HF_CLIENT_CONN;
/* data associated with BTA_HF_CLIENT_IND_EVT event */
typedef struct {
tBTA_HF_CLIENT_HDR hdr;
tBTA_HF_CLIENT_IND_TYPE type;
UINT16 value;
} tBTA_HF_CLIENT_IND;
/* data associated with BTA_HF_CLIENT_OPERATOR_NAME_EVT */
#define BTA_HF_CLIENT_OPERATOR_NAME_LEN 16
typedef struct {
char name[BTA_HF_CLIENT_OPERATOR_NAME_LEN + 1];
} tBTA_HF_CLIENT_OPERATOR_NAME;
/* data associated with BTA_HF_CLIENT_CLIP_EVT and BTA_HF_CLIENT_CCWA_EVT*/
#define BTA_HF_CLIENT_NUMBER_LEN 32
typedef struct {
char number[BTA_HF_CLIENT_NUMBER_LEN + 1];
} tBTA_HF_CLIENT_NUMBER;
/* data associated with BTA_HF_CLIENT_AT_RESULT_EVT event */
typedef struct {
tBTA_HF_CLIENT_AT_RESULT_TYPE type;
UINT16 cme;
} tBTA_HF_CLIENT_AT_RESULT;
/* data associated with BTA_HF_CLIENT_CLCC_EVT event */
typedef struct {
UINT32 idx;
BOOLEAN inc;
UINT8 status;
BOOLEAN mpty;
BOOLEAN number_present;
char number[BTA_HF_CLIENT_NUMBER_LEN + 1];
} tBTA_HF_CLIENT_CLCC;
/* data associated with BTA_HF_CLIENT_CNUM_EVT event */
typedef struct {
UINT16 service;
char number[BTA_HF_CLIENT_NUMBER_LEN + 1];
} tBTA_HF_CLIENT_CNUM;
/* data associated with other events */
typedef struct {
UINT16 value;
} tBTA_HF_CLIENT_VAL;
/* union of data associated with AG callback */
typedef union {
tBTA_HF_CLIENT_HDR hdr;
tBTA_HF_CLIENT_REGISTER reg;
tBTA_HF_CLIENT_OPEN open;
tBTA_HF_CLIENT_CONN conn;
tBTA_HF_CLIENT_IND ind;
tBTA_HF_CLIENT_VAL val;
tBTA_HF_CLIENT_OPERATOR_NAME operator;
tBTA_HF_CLIENT_NUMBER number;
tBTA_HF_CLIENT_AT_RESULT result;
tBTA_HF_CLIENT_CLCC clcc;
tBTA_HF_CLIENT_CNUM cnum;
} tBTA_HF_CLIENT;
typedef UINT32 tBTA_HF_CLIENT_FEAT;
/* HF Client callback */
typedef void (tBTA_HF_CLIENT_CBACK)(tBTA_HF_CLIENT_EVT event, void *p_data);
#ifdef __cplusplus
extern "C"
{
#endif
/*****************************************************************************
** External Function Declarations
*****************************************************************************/
/*******************************************************************************
**
** Function BTA_HfClientEnable
**
** Description Enable the HF CLient service. When the enable
** operation is complete the callback function will be
** called with a BTA_HF_CLIENT_ENABLE_EVT. This function must
** be called before other function in the HF CLient API are
** called.
**
** Returns BTA_SUCCESS if OK, BTA_FAILURE otherwise.
**
*******************************************************************************/
tBTA_STATUS BTA_HfClientEnable(tBTA_HF_CLIENT_CBACK *p_cback);
/*******************************************************************************
**
** Function BTA_HfClientDisable
**
** Description Disable the HF Client service
**
**
** Returns void
**
*******************************************************************************/
void BTA_HfClientDisable(void);
/*******************************************************************************
**
** Function BTA_HfClientRegister
**
** Description Register an HF Client service.
**
**
** Returns void
**
*******************************************************************************/
void BTA_HfClientRegister(tBTA_SEC sec_mask, tBTA_HF_CLIENT_FEAT features,
char *p_service_name);
/*******************************************************************************
**
** Function BTA_HfClientDeregister
**
** Description Deregister an HF Client service.
**
**
** Returns void
**
*******************************************************************************/
void BTA_HfClientDeregister(UINT16 handle);
/*******************************************************************************
**
** Function BTA_HfClientOpen
**
** Description Opens a connection to an audio gateway.
** When connection is open callback function is called
** with a BTA_HF_CLIENT_OPEN_EVT. Only the data connection is
** opened. The audio connection is not opened.
**
**
** Returns void
**
*******************************************************************************/
void BTA_HfClientOpen(UINT16 handle, BD_ADDR bd_addr, tBTA_SEC sec_mask);
/*******************************************************************************
**
** Function BTA_HfClientClose
**
** Description Close the current connection to an audio gateway.
** Any current audio connection will also be closed
**
**
** Returns void
**
*******************************************************************************/
void BTA_HfClientClose(UINT16 handle);
/*******************************************************************************
**
** Function BTA_HfCllientAudioOpen
**
** Description Opens an audio connection to the currently connected
** audio gateway
**
**
** Returns void
**
*******************************************************************************/
void BTA_HfClientAudioOpen(UINT16 handle);
/*******************************************************************************
**
** Function BTA_HfClientAudioClose
**
** Description Close the currently active audio connection to an audio
** gateway. The data connection remains open
**
**
** Returns void
**
*******************************************************************************/
void BTA_HfClientAudioClose(UINT16 handle);
/*******************************************************************************
**
** Function BTA_HfClientSendAT
**
** Description send AT command
**
**
** Returns void
**
*******************************************************************************/
void BTA_HfClientSendAT(UINT16 handle, tBTA_HF_CLIENT_AT_CMD_TYPE at, UINT32 val1, UINT32 val2, const char *str);
#if (BTM_SCO_HCI_INCLUDED == TRUE )
void BTA_HfClientCiData(void);
#endif /*#if (BTM_SCO_HCI_INCLUDED == TRUE ) */
int BTA_HfClientGetCbDataSize(tBTA_HF_CLIENT_EVT event);
#ifdef __cplusplus
}
#endif
#endif /* #if (BTA_HF_INCLUDED == TRUE) */
#endif /* BTA_HF_CLIENT_API_H */

View File

@ -0,0 +1,115 @@
// Copyright 2018 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.
/******************************************************************************
*
* This is the interface file for hf client call-out functions.
*
******************************************************************************/
#ifndef BTA_HF_CLIENT_CO_H
#define BTA_HF_CLIENT_CO_H
#include "common/bt_target.h"
#include "bta/bta_hf_client_api.h"
#if (BTA_HF_INCLUDED == TRUE)
#if (BTM_SCO_HCI_INCLUDED == TRUE)
/*******************************************************************************
**
** Function bta_hf_client_co_audio_state
**
** Description This function is called by the HF CLIENT before the audio connection
** is brought up, after it comes up, and after it goes down.
**
** Parameters handle - handle of the AG instance
** state - Audio state
** codec - if WBS support is compiled in, codec to going to be used is provided
** and when in SCO_STATE_SETUP, BTM_I2SPCMConfig() must be called with
** the correct platform parameters.
** in the other states codec type should not be ignored
**
** Returns void
**
*******************************************************************************/
void bta_hf_client_co_audio_state(UINT16 handle, UINT8 state, tBTA_HFP_PEER_CODEC codec);
/*******************************************************************************
**
** Function bta_hf_client_sco_co_init
**
** Description This function can be used by the phone to initialize audio
** codec or for other initialization purposes before SCO connection
** is opened.
**
**
** Returns Void.
**
*******************************************************************************/
tBTA_HFP_SCO_ROUTE_TYPE bta_hf_client_sco_co_init(UINT32 rx_bw, UINT32 tx_bw,
tBTA_HFP_CODEC_INFO *p_codec_info, UINT8 app_id);
/*******************************************************************************
**
** Function bta_hf_client_sco_co_open
**
** Description This function is executed when a SCO connection is open.
**
**
** Returns void
**
*******************************************************************************/
void bta_hf_client_sco_co_open(UINT16 handle, UINT8 pkt_size, UINT16 event);
/*******************************************************************************
**
** Function bta_hf_client_sco_co_close
**
** Description This function is called when a SCO connection is closed
**
**
** Returns void
**
*******************************************************************************/
void bta_hf_client_sco_co_close(void);
/*******************************************************************************
**
** Function bta_hf_client_sco_co_out_data
**
** Description This function is called to send SCO data over HCI.
**
** Returns number of bytes got from application
**
*******************************************************************************/
uint32_t bta_hf_client_sco_co_out_data(uint8_t *p_buf, uint32_t sz);
/*******************************************************************************
**
** Function bta_hf_client_sco_co_in_data
**
** Description This function is called to send incoming SCO data to application.
**
** Returns void
**
*******************************************************************************/
extern void bta_hf_client_sco_co_in_data(BT_HDR *p_buf, tBTM_SCO_DATA_FLAG status);
#endif /* #if (BTM_SCO_HCI_INCLUDED == TRUE) */
#endif /* #if (BTA_HF_INCLUDED == TRUE) */
#endif /* BTA_HF_CLIENT_CO_H */

View File

@ -0,0 +1,47 @@
// Copyright 2018 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 __BTA_HFP_DEFS_H__
#define __BTA_HFP_DEFS_H__
#include "stack/btm_api.h"
#define BTA_HFP_CODEC_NONE BTM_SCO_CODEC_NONE
#define BTA_HFP_CODEC_CVSD BTM_SCO_CODEC_CVSD /* CVSD */
#define BTA_HFP_CODEC_MSBC BTM_SCO_CODEC_MSBC /* mSBC */
typedef UINT16 tBTA_HFP_PEER_CODEC;
#ifndef BTA_HFP_SCO_OUT_PKT_SIZE
#define BTA_HFP_SCO_OUT_PKT_SIZE BTM_SCO_DATA_SIZE_MAX
#endif
#define BTA_HFP_SCO_CODEC_PCM 0 /* used for regular SCO */
#define BTA_HFP_SCO_CODEC_SBC 1 /* used for WBS */
typedef UINT8 tBTA_HFP_SCO_CODEC_TYPE;
#define BTA_HFP_SCO_SAMP_RATE_8K 8000
#define BTA_HFP_SCO_SAMP_RATE_16K 16000
/* SCO codec information */
typedef struct {
tBTA_HFP_SCO_CODEC_TYPE codec_type;
} tBTA_HFP_CODEC_INFO;
#define BTA_HFP_SCO_ROUTE_PCM BTM_SCO_ROUTE_PCM
#define BTA_HFP_SCO_ROUTE_HCI BTM_SCO_ROUTE_HCI
typedef tBTM_SCO_ROUTE_TYPE tBTA_HFP_SCO_ROUTE_TYPE;
#endif /* __BTA_HFP_DEFS_H__ */

View File

@ -0,0 +1,545 @@
/******************************************************************************
*
* Copyright (C) 2002-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 BTA_HH_API_H
#define BTA_HH_API_H
#include "bta/bta_api.h"
#include "stack/hidh_api.h"
#if defined(BTA_HH_INCLUDED) && (BTA_HH_INCLUDED == TRUE)
#if (defined BTA_HH_LE_INCLUDED && BTA_HH_LE_INCLUDED == TRUE)
#include "stack/gatt_api.h"
#endif
/*****************************************************************************
** Constants and Type Definitions
*****************************************************************************/
#ifndef BTA_HH_DEBUG
#define BTA_HH_DEBUG TRUE
#endif
#ifndef BTA_HH_SSR_MAX_LATENCY_DEF
#define BTA_HH_SSR_MAX_LATENCY_DEF 800 /* 500 ms*/
#endif
#ifndef BTA_HH_SSR_MIN_TOUT_DEF
#define BTA_HH_SSR_MIN_TOUT_DEF 2
#endif
/* BTA HID Host callback events */
#define BTA_HH_ENABLE_EVT 0 /* HH enabled */
#define BTA_HH_DISABLE_EVT 1 /* HH disabled */
#define BTA_HH_OPEN_EVT 2 /* connection opened */
#define BTA_HH_CLOSE_EVT 3 /* connection closed */
#define BTA_HH_GET_RPT_EVT 4 /* BTA_HhGetReport callback */
#define BTA_HH_SET_RPT_EVT 5 /* BTA_HhSetReport callback */
#define BTA_HH_GET_PROTO_EVT 6 /* BTA_GetProtoMode callback */
#define BTA_HH_SET_PROTO_EVT 7 /* BTA_HhSetProtoMode callback */
#define BTA_HH_GET_IDLE_EVT 8 /* BTA_HhGetIdle comes callback */
#define BTA_HH_SET_IDLE_EVT 9 /* BTA_HhSetIdle finish callback */
#define BTA_HH_GET_DSCP_EVT 10 /* Get report descriptor */
#define BTA_HH_ADD_DEV_EVT 11 /* Add Device callback */
#define BTA_HH_RMV_DEV_EVT 12 /* remove device finished */
#define BTA_HH_VC_UNPLUG_EVT 13 /* virtually unplugged */
#define BTA_HH_DATA_EVT 15
#define BTA_HH_API_ERR_EVT 16 /* API error is caught */
#define BTA_HH_UPDATE_SCPP_EVT 17 /* update scan paramter complete */
typedef UINT16 tBTA_HH_EVT;
/* application ID(none-zero) for each type of device */
#define BTA_HH_APP_ID_MI 1
#define BTA_HH_APP_ID_KB 2
#define BTA_HH_APP_ID_RMC 3
#define BTA_HH_APP_ID_3DSG 4
#define BTA_HH_APP_ID_JOY 5
#define BTA_HH_APP_ID_GPAD 6
#define BTA_HH_APP_ID_LE 0xff
/* defined the minimum offset */
#define BTA_HH_MIN_OFFSET L2CAP_MIN_OFFSET+1
/* HID_HOST_MAX_DEVICES can not exceed 15 for th design of BTA HH */
#define BTA_HH_IDX_INVALID 0xff
#define BTA_HH_MAX_KNOWN HID_HOST_MAX_DEVICES
#if (defined BTA_HH_LE_INCLUDED && BTA_HH_LE_INCLUDED == TRUE)
/* GATT_MAX_PHY_CHANNEL can not exceed 14 for the design of BTA HH */
#define BTA_HH_LE_MAX_KNOWN GATT_MAX_PHY_CHANNEL
#define BTA_HH_MAX_DEVICE (HID_HOST_MAX_DEVICES + GATT_MAX_PHY_CHANNEL)
#else
#define BTA_HH_MAX_DEVICE HID_HOST_MAX_DEVICES
#endif
/* invalid device handle */
#define BTA_HH_INVALID_HANDLE 0xff
/* type of protocol mode */
#define BTA_HH_PROTO_RPT_MODE (0x00)
#define BTA_HH_PROTO_BOOT_MODE (0x01)
#define BTA_HH_PROTO_UNKNOWN (0xff)
typedef UINT8 tBTA_HH_PROTO_MODE;
enum {
BTA_HH_KEYBD_RPT_ID = 1,
BTA_HH_MOUSE_RPT_ID
};
typedef UINT8 tBTA_HH_BOOT_RPT_ID;
/* type of devices, bit mask */
#define BTA_HH_DEVT_UNKNOWN 0x00
#define BTA_HH_DEVT_JOS 0x01 /* joy stick */
#define BTA_HH_DEVT_GPD 0x02 /* game pad */
#define BTA_HH_DEVT_RMC 0x03 /* remote control */
#define BTA_HH_DEVT_SED 0x04 /* sensing device */
#define BTA_HH_DEVT_DGT 0x05 /* Digitizer tablet */
#define BTA_HH_DEVT_CDR 0x06 /* card reader */
#define BTA_HH_DEVT_KBD 0x10 /* keyboard */
#define BTA_HH_DEVT_MIC 0x20 /* pointing device */
#define BTA_HH_DEVT_COM 0x30 /* Combo keyboard/pointing */
#define BTA_HH_DEVT_OTHER 0x80
typedef UINT8 tBTA_HH_DEVT;
enum {
BTA_HH_OK,
BTA_HH_HS_HID_NOT_READY, /* handshake error : device not ready */
BTA_HH_HS_INVALID_RPT_ID, /* handshake error : invalid report ID */
BTA_HH_HS_TRANS_NOT_SPT, /* handshake error : transaction not spt */
BTA_HH_HS_INVALID_PARAM, /* handshake error : invalid paremter */
BTA_HH_HS_ERROR, /* handshake error : unspecified HS error */
BTA_HH_ERR, /* general BTA HH error */
BTA_HH_ERR_SDP, /* SDP error */
BTA_HH_ERR_PROTO, /* SET_Protocol error,
only used in BTA_HH_OPEN_EVT callback */
BTA_HH_ERR_DB_FULL, /* device database full error, used in
BTA_HH_OPEN_EVT/BTA_HH_ADD_DEV_EVT */
BTA_HH_ERR_TOD_UNSPT, /* type of device not supported */
BTA_HH_ERR_NO_RES, /* out of system resources */
BTA_HH_ERR_AUTH_FAILED, /* authentication fail */
BTA_HH_ERR_HDL,
BTA_HH_ERR_SEC
};
typedef UINT8 tBTA_HH_STATUS;
#define BTA_HH_VIRTUAL_CABLE HID_VIRTUAL_CABLE
#define BTA_HH_NORMALLY_CONNECTABLE HID_NORMALLY_CONNECTABLE
#define BTA_HH_RECONN_INIT HID_RECONN_INIT
#define BTA_HH_SDP_DISABLE HID_SDP_DISABLE
#define BTA_HH_BATTERY_POWER HID_BATTERY_POWER
#define BTA_HH_REMOTE_WAKE HID_REMOTE_WAKE
#define BTA_HH_SUP_TOUT_AVLBL HID_SUP_TOUT_AVLBL
#define BTA_HH_SEC_REQUIRED HID_SEC_REQUIRED
typedef UINT16 tBTA_HH_ATTR_MASK;
/* supported type of device and corresponding application ID */
typedef struct {
tBTA_HH_DEVT tod; /* type of device */
UINT8 app_id; /* corresponding application ID */
} tBTA_HH_SPT_TOD;
/* configuration struct */
typedef struct {
UINT8 max_devt_spt; /* max number of types of devices spt */
tBTA_HH_SPT_TOD *p_devt_list; /* supported types of device list */
UINT16 sdp_db_size;
} tBTA_HH_CFG;
enum {
BTA_HH_RPTT_RESRV, /* reserved */
BTA_HH_RPTT_INPUT, /* input report */
BTA_HH_RPTT_OUTPUT, /* output report */
BTA_HH_RPTT_FEATURE /* feature report */
};
typedef UINT8 tBTA_HH_RPT_TYPE;
/* HID_CONTROL operation code used in BTA_HhSendCtrl()
*/
enum {
BTA_HH_CTRL_NOP = 0 + HID_PAR_CONTROL_NOP ,/* mapping from BTE */
BTA_HH_CTRL_HARD_RESET, /* hard reset */
BTA_HH_CTRL_SOFT_RESET, /* soft reset */
BTA_HH_CTRL_SUSPEND, /* enter suspend */
BTA_HH_CTRL_EXIT_SUSPEND, /* exit suspend */
BTA_HH_CTRL_VIRTUAL_CABLE_UNPLUG /* virtual unplug */
};
typedef UINT8 tBTA_HH_TRANS_CTRL_TYPE;
typedef tHID_DEV_DSCP_INFO tBTA_HH_DEV_DESCR;
#define BTA_HH_SSR_PARAM_INVALID HID_SSR_PARAM_INVALID
/* id DI is not existing in remote device, vendor_id in tBTA_HH_DEV_DSCP_INFO will be set to 0xffff */
#define BTA_HH_VENDOR_ID_INVALID 0xffff
/* report descriptor information */
typedef struct {
UINT16 vendor_id; /* vendor ID */
UINT16 product_id; /* product ID */
UINT16 version; /* version */
UINT16 ssr_max_latency; /* SSR max latency, BTA_HH_SSR_PARAM_INVALID if unknown */
UINT16 ssr_min_tout; /* SSR min timeout, BTA_HH_SSR_PARAM_INVALID if unknown */
UINT8 ctry_code; /*Country Code.*/
#if (defined BTA_HH_LE_INCLUDED && BTA_HH_LE_INCLUDED == TRUE)
#define BTA_HH_LE_REMOTE_WAKE 0x01
#define BTA_HH_LE_NORMAL_CONN 0x02
UINT8 flag;
#endif
tBTA_HH_DEV_DESCR descriptor;
} tBTA_HH_DEV_DSCP_INFO;
/* callback event data for BTA_HH_OPEN_EVT */
typedef struct {
BD_ADDR bda; /* HID device bd address */
tBTA_HH_STATUS status; /* operation status */
UINT8 handle; /* device handle */
#if (defined BTA_HH_LE_INCLUDED && BTA_HH_LE_INCLUDED == TRUE)
BOOLEAN le_hid; /* is LE devices? */
BOOLEAN scps_supported; /* scan parameter service supported */
#endif
} tBTA_HH_CONN;
typedef tBTA_HH_CONN tBTA_HH_DEV_INFO;
/* callback event data */
typedef struct {
tBTA_HH_STATUS status; /* operation status */
UINT8 handle; /* device handle */
} tBTA_HH_CBDATA;
enum {
BTA_HH_MOD_CTRL_KEY,
BTA_HH_MOD_SHFT_KEY,
BTA_HH_MOD_ALT_KEY,
BTA_HH_MOD_GUI_KEY,
BTA_HH_MOD_MAX_KEY
};
/* parsed boot mode keyboard report */
typedef struct {
UINT8 this_char[6]; /* virtual key code */
BOOLEAN mod_key[BTA_HH_MOD_MAX_KEY];
/* ctrl, shift, Alt, GUI */
/* modifier key: is Shift key pressed */
/* modifier key: is Ctrl key pressed */
/* modifier key: is Alt key pressed */
/* modifier key: GUI up/down */
BOOLEAN caps_lock; /* is caps locked */
BOOLEAN num_lock; /* is Num key pressed */
} tBTA_HH_KEYBD_RPT;
/* parsed boot mode mouse report */
typedef struct {
UINT8 mouse_button; /* mouse button is clicked */
INT8 delta_x; /* displacement x */
INT8 delta_y; /* displacement y */
} tBTA_HH_MICE_RPT;
/* parsed Boot report */
typedef struct {
tBTA_HH_BOOT_RPT_ID dev_type; /* type of device report */
union {
tBTA_HH_KEYBD_RPT keybd_rpt; /* keyboard report */
tBTA_HH_MICE_RPT mice_rpt; /* mouse report */
} data_rpt;
} tBTA_HH_BOOT_RPT;
/* handshake data */
typedef struct {
tBTA_HH_STATUS status; /* handshake status */
UINT8 handle; /* device handle */
union {
tBTA_HH_PROTO_MODE proto_mode; /* GET_PROTO_EVT :protocol mode */
BT_HDR *p_rpt_data; /* GET_RPT_EVT : report data */
UINT8 idle_rate; /* GET_IDLE_EVT : idle rate */
} rsp_data;
} tBTA_HH_HSDATA;
/* union of data associated with HD callback */
typedef union {
tBTA_HH_DEV_INFO dev_info; /* BTA_HH_ADD_DEV_EVT, BTA_HH_RMV_DEV_EVT */
tBTA_HH_CONN conn; /* BTA_HH_OPEN_EVT */
tBTA_HH_CBDATA dev_status; /* BTA_HH_CLOSE_EVT,
BTA_HH_SET_PROTO_EVT
BTA_HH_SET_RPT_EVT
BTA_HH_SET_IDLE_EVT
BTA_HH_UPDATE_SCPP_EVT */
tBTA_HH_STATUS status; /* BTA_HH_ENABLE_EVT */
tBTA_HH_DEV_DSCP_INFO dscp_info; /* BTA_HH_GET_DSCP_EVT */
tBTA_HH_HSDATA hs_data; /* GET_ transaction callback
BTA_HH_GET_RPT_EVT
BTA_HH_GET_PROTO_EVT
BTA_HH_GET_IDLE_EVT */
} tBTA_HH;
/* BTA HH callback function */
typedef void (tBTA_HH_CBACK) (tBTA_HH_EVT event, tBTA_HH *p_data);
/*****************************************************************************
** External Function Declarations
*****************************************************************************/
#ifdef __cplusplus
extern "C"
{
#endif
/*******************************************************************************
**
** Function BTA_HhRegister
**
** Description This function enable HID host and registers HID-Host with
** lower layers.
**
** Returns void
**
*******************************************************************************/
extern void BTA_HhEnable(tBTA_SEC sec_mask, tBTA_HH_CBACK *p_cback);
/*******************************************************************************
**
** Function BTA_HhDeregister
**
** Description This function is called when the host is about power down.
**
** Returns void
**
*******************************************************************************/
extern void BTA_HhDisable(void);
/*******************************************************************************
**
** Function BTA_HhOpen
**
** Description This function is called to start an inquiry and read SDP
** record of responding devices; connect to a device if only
** one active HID device is found.
**
** Returns void
**
*******************************************************************************/
extern void BTA_HhOpen (BD_ADDR dev_bda, tBTA_HH_PROTO_MODE mode,
tBTA_SEC sec_mask);
/*******************************************************************************
**
** Function BTA_HhClose
**
** Description This function disconnects the device.
**
** Returns void
**
*******************************************************************************/
extern void BTA_HhClose(UINT8 dev_handle);
/*******************************************************************************
**
** Function BTA_HhSetProtoMode
**
** Description This function set the protocol mode at specified HID handle
**
** Returns void
**
*******************************************************************************/
extern void BTA_HhSetProtoMode(UINT8 handle, tBTA_HH_PROTO_MODE t_type);
/*******************************************************************************
**
** Function BTA_HhGetProtoMode
**
** Description This function get the protocol mode of a specified HID device.
**
** Returns void
**
*******************************************************************************/
extern void BTA_HhGetProtoMode(UINT8 dev_handle);
/*******************************************************************************
**
** Function BTA_HhSetReport
**
** Description send SET_REPORT to device.
**
** Returns void
**
*******************************************************************************/
extern void BTA_HhSetReport(UINT8 dev_handle, tBTA_HH_RPT_TYPE r_type,
BT_HDR *p_data);
/*******************************************************************************
**
** Function BTA_HhGetReport
**
** Description Send a GET_REPORT to HID device.
**
** Returns void
**
*******************************************************************************/
extern void BTA_HhGetReport(UINT8 dev_handle, tBTA_HH_RPT_TYPE r_type,
UINT8 rpt_id, UINT16 buf_size);
/*******************************************************************************
**
** Function BTA_HhSetIdle
**
** Description send SET_IDLE to device.
**
** Returns void
**
*******************************************************************************/
extern void BTA_HhSetIdle(UINT8 dev_handle, UINT16 idle_rate);
/*******************************************************************************
**
** Function BTA_HhGetIdle
**
** Description Send a GET_IDLE to HID device.
**
** Returns void
**
*******************************************************************************/
extern void BTA_HhGetIdle(UINT8 dev_handle);
/*******************************************************************************
**
** Function BTA_HhSendCtrl
**
** Description Send HID_CONTROL request to a HID device.
**
** Returns void
**
*******************************************************************************/
extern void BTA_HhSendCtrl(UINT8 dev_handle,
tBTA_HH_TRANS_CTRL_TYPE c_type);
/*******************************************************************************
**
** Function BTA_HhSetIdle
**
** Description send SET_IDLE to device.
**
** Returns void
**
*******************************************************************************/
extern void BTA_HhSetIdle(UINT8 dev_handle, UINT16 idle_rate);
/*******************************************************************************
**
** Function BTA_HhGetIdle
**
** Description Send a GET_IDLE from HID device.
**
** Returns void
**
*******************************************************************************/
extern void BTA_HhGetIdle(UINT8 dev_handle);
/*******************************************************************************
**
** Function BTA_HhSendData
**
** Description Send DATA transaction to a HID device.
**
** Returns void
**
*******************************************************************************/
extern void BTA_HhSendData(UINT8 dev_handle, BD_ADDR dev_bda, BT_HDR *p_buf);
/*******************************************************************************
**
** Function BTA_HhGetDscpInfo
**
** Description Get report descriptor of the device
**
** Returns void
**
*******************************************************************************/
extern void BTA_HhGetDscpInfo(UINT8 dev_handle);
/*******************************************************************************
** Function BTA_HhAddDev
**
** Description Add a virtually cabled device into HID-Host device list
** to manage and assign a device handle for future API call,
** host applciation call this API at start-up to initialize its
** virtually cabled devices.
**
** Returns void
**
*******************************************************************************/
extern void BTA_HhAddDev(BD_ADDR bda, tBTA_HH_ATTR_MASK attr_mask,
UINT8 sub_class, UINT8 app_id,
tBTA_HH_DEV_DSCP_INFO dscp_info);
/*******************************************************************************
**
** Function BTA_HhRemoveDev
**
** Description Remove a device from the HID host devices list.
**
** Returns void
**
*******************************************************************************/
extern void BTA_HhRemoveDev(UINT8 dev_handle );
/*******************************************************************************
**
** Parsing Utility Functions
**
*******************************************************************************/
/*******************************************************************************
**
** Function BTA_HhParseBootRpt
**
** Description This utility function parse a boot mode report.
**
** Returns void
**
*******************************************************************************/
extern void BTA_HhParseBootRpt(tBTA_HH_BOOT_RPT *p_data, UINT8 *p_report,
UINT16 report_len);
#if BTA_HH_LE_INCLUDED == TRUE
/*******************************************************************************
**
** Function BTA_HhUpdateLeScanParam
**
** Description Update the scan paramteters if connected to a LE hid device as
** report host.
**
** Returns void
**
*******************************************************************************/
extern void BTA_HhUpdateLeScanParam(UINT8 dev_handle, UINT16 scan_int, UINT16 scan_win);
#endif
/* test commands */
extern void bta_hh_le_hid_read_rpt_clt_cfg(BD_ADDR bd_addr, UINT8 rpt_id);
#ifdef __cplusplus
}
#endif
#endif ///defined(BTA_HH_INCLUDED) && (BTA_HH_INCLUDED == TRUE)
#endif /* BTA_HH_API_H */

View File

@ -0,0 +1,132 @@
/******************************************************************************
*
* Copyright (C) 2005-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 hid host call-out functions.
*
******************************************************************************/
#ifndef BTA_HH_CO_H
#define BTA_HH_CO_H
#include "bta/bta_hh_api.h"
typedef struct {
UINT16 rpt_uuid;
UINT8 rpt_id;
tBTA_HH_RPT_TYPE rpt_type;
UINT8 inst_id;
UINT8 prop;
} tBTA_HH_RPT_CACHE_ENTRY;
/*******************************************************************************
**
** Function bta_hh_co_data
**
** Description This callout function is executed by HH when data is received
** in interupt channel.
**
**
** Returns void.
**
*******************************************************************************/
extern void bta_hh_co_data(UINT8 dev_handle, UINT8 *p_rpt, UINT16 len,
tBTA_HH_PROTO_MODE mode, UINT8 sub_class,
UINT8 ctry_code, BD_ADDR peer_addr, UINT8 app_id);
/*******************************************************************************
**
** Function bta_hh_co_open
**
** Description This callout function is executed by HH when connection is
** opened, and application may do some device specific
** initialization.
**
** Returns void.
**
*******************************************************************************/
extern void bta_hh_co_open(UINT8 dev_handle, UINT8 sub_class,
UINT16 attr_mask, UINT8 app_id);
/*******************************************************************************
**
** Function bta_hh_co_close
**
** Description This callout function is executed by HH when connection is
** closed, and device specific finalizatio nmay be needed.
**
** Returns void.
**
*******************************************************************************/
extern void bta_hh_co_close(UINT8 dev_handle, UINT8 app_id);
#if (BLE_INCLUDED == TRUE && BTA_HH_LE_INCLUDED == TRUE)
/*******************************************************************************
**
** Function bta_hh_le_co_rpt_info
**
** Description This callout function is to convey the report information on
** a HOGP device to the application. Application can save this
** information in NV if device is bonded and load it back when
** stack reboot.
**
** Parameters remote_bda - remote device address
** p_entry - report entry pointer
** app_id - application id
**
** Returns void.
**
*******************************************************************************/
extern void bta_hh_le_co_rpt_info(BD_ADDR remote_bda,
tBTA_HH_RPT_CACHE_ENTRY *p_entry,
UINT8 app_id);
/*******************************************************************************
**
** Function bta_hh_le_co_cache_load
**
** Description This callout function is to request the application to load the
** cached HOGP report if there is any. When cache reading is completed,
** bta_hh_le_ci_cache_load() is called by the application.
**
** Parameters remote_bda - remote device address
** p_num_rpt: number of cached report
** app_id - application id
**
** Returns the acched report array
**
*******************************************************************************/
extern tBTA_HH_RPT_CACHE_ENTRY *bta_hh_le_co_cache_load (BD_ADDR remote_bda,
UINT8 *p_num_rpt,
UINT8 app_id);
/*******************************************************************************
**
** Function bta_hh_le_co_reset_rpt_cache
**
** Description This callout function is to reset the HOGP device cache.
**
** Parameters remote_bda - remote device address
**
** Returns none
**
*******************************************************************************/
extern void bta_hh_le_co_reset_rpt_cache (BD_ADDR remote_bda, UINT8 app_id);
#endif /* #if (BLE_INCLUDED == TRUE && BTA_HH_LE_INCLUDED == TRUE) */
#endif /* BTA_HH_CO_H */

View 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 "common/bt_target.h"
#include "stack/bt_types.h"
#include "bta/bta_api.h"
#include "stack/btm_api.h"
#include "stack/l2c_api.h"
#include "stack/rfcdefs.h"
#include "stack/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 */

View 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/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 */

View File

@ -0,0 +1,147 @@
/******************************************************************************
*
* Copyright (C) 2015 The Android Open Source Project
*
* 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 for the BTA SDP I/F
*
******************************************************************************/
#ifndef BTA_SDP_API_H
#define BTA_SDP_API_H
#include "bt_sdp.h"
#include "common/bt_target.h"
#include "stack/bt_types.h"
#include "bta/bta_api.h"
#include "stack/btm_api.h"
#if (SDP_INCLUDED == TRUE)
/* status values */
#define BTA_SDP_SUCCESS 0 /* Successful operation. */
#define BTA_SDP_FAILURE 1 /* Generic failure. */
#define BTA_SDP_BUSY 2 /* Temporarily can not handle this request. */
typedef UINT8 tBTA_SDP_STATUS;
/* SDP I/F callback events */
/* events received by tBTA_SDP_DM_CBACK */
#define BTA_SDP_ENABLE_EVT 0 /* SDP service i/f enabled*/
#define BTA_SDP_SEARCH_EVT 1 /* SDP Service started */
#define BTA_SDP_SEARCH_COMP_EVT 2 /* SDP search complete */
#define BTA_SDP_CREATE_RECORD_USER_EVT 3 /* SDP search complete */
#define BTA_SDP_REMOVE_RECORD_USER_EVT 4 /* SDP search complete */
#define BTA_SDP_MAX_EVT 5 /* max number of SDP events */
#define BTA_SDP_MAX_RECORDS 15
typedef UINT16 tBTA_SDP_EVT;
/* data associated with BTA_SDP_DISCOVERY_COMP_EVT */
typedef struct {
tBTA_SDP_STATUS status;
BD_ADDR remote_addr;
tBT_UUID uuid;
int record_count;
bluetooth_sdp_record records[BTA_SDP_MAX_RECORDS];
} tBTA_SDP_SEARCH_COMP;
typedef union {
tBTA_SDP_STATUS status; /* BTA_SDP_SEARCH_EVT */
tBTA_SDP_SEARCH_COMP sdp_search_comp; /* BTA_SDP_SEARCH_COMP_EVT */
} tBTA_SDP;
/* SDP DM Interface callback */
typedef void (tBTA_SDP_DM_CBACK)(tBTA_SDP_EVT event, tBTA_SDP *p_data, void *user_data);
/* MCE configuration structure */
typedef struct {
UINT16 sdp_db_size; /* The size of p_sdp_db */
#if (SDP_INCLUDED == TRUE)
tSDP_DISCOVERY_DB *p_sdp_db; /* The data buffer to keep SDP database */
#endif ///SDP_INCLUDED == TRUE
} tBTA_SDP_CFG;
#ifdef __cplusplus
extern "C"
{
#endif
/*******************************************************************************
**
** Function BTA_SdpEnable
**
** Description Enable the SDP I/F service. When the enable
** operation is complete the callback function will be
** called with a BTA_SDP_ENABLE_EVT. This function must
** be called before other functions in the MCE API are
** called.
**
** Returns BTA_SDP_SUCCESS if successful.
** BTA_SDP_FAIL if internal failure.
**
*******************************************************************************/
extern tBTA_SDP_STATUS BTA_SdpEnable(tBTA_SDP_DM_CBACK *p_cback);
/*******************************************************************************
**
** Function BTA_SdpSearch
**
** Description Start a search for sdp records for a specific BD_ADDR with a
** specific profile uuid.
** When the search operation is completed, the callback function
** will be called with a BTA_SDP_SEARCH_EVT.
** Returns BTA_SDP_SUCCESS if successful.
** BTA_SDP_FAIL if internal failure.
**
*******************************************************************************/
extern tBTA_SDP_STATUS BTA_SdpSearch(BD_ADDR bd_addr, tSDP_UUID *uuid);
/*******************************************************************************
**
** Function BTA_SdpCreateRecordByUser
**
** Description This function is used to request a callback to create a SDP
** record. The registered callback will be called with event
** BTA_SDP_CREATE_RECORD_USER_EVT.
**
** Returns BTA_SDP_SUCCESS, if the request is being processed.
** BTA_SDP_FAILURE, otherwise.
**
*******************************************************************************/
extern tBTA_SDP_STATUS BTA_SdpCreateRecordByUser(void *user_data);
/*******************************************************************************
**
** Function BTA_SdpRemoveRecordByUser
**
** Description This function is used to request a callback to remove a SDP
** record. The registered callback will be called with event
** BTA_SDP_REMOVE_RECORD_USER_EVT.
**
** Returns BTA_SDP_SUCCESS, if the request is being processed.
** BTA_SDP_FAILURE, otherwise.
**
*******************************************************************************/
extern tBTA_SDP_STATUS BTA_SdpRemoveRecordByUser(void *user_data);
#ifdef __cplusplus
}
#endif
#endif ///SDP_INCLUDED == TRUE
#endif /* BTA_SDP_API_H */

View File

@ -0,0 +1,283 @@
/******************************************************************************
*
* Copyright (C) 2003-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 for the BTA system manager.
*
******************************************************************************/
#ifndef BTA_SYS_H
#define BTA_SYS_H
#include "common/bt_target.h"
#include "common/bt_defs.h"
/*****************************************************************************
** Constants and data types
*****************************************************************************/
/* vendor specific event handler function type */
typedef BOOLEAN (tBTA_SYS_VS_EVT_HDLR)(UINT16 evt, void *p);
/* event handler function type */
typedef BOOLEAN (tBTA_SYS_EVT_HDLR)(BT_HDR *p_msg);
/* disable function type */
typedef void (tBTA_SYS_DISABLE)(void);
/* HW modules */
enum {
BTA_SYS_HW_BLUETOOTH,
BTA_SYS_HW_RT,
BTA_SYS_MAX_HW_MODULES
};
typedef UINT16 tBTA_SYS_HW_MODULE;
#ifndef BTA_DM_NUM_JV_ID
#define BTA_DM_NUM_JV_ID 2
#endif
/* SW sub-systems */
#define BTA_ID_SYS 0 /* system manager */
/* BLUETOOTH PART - from 0 to BTA_ID_BLUETOOTH_MAX */
#define BTA_ID_DM 1 /* device manager */
#define BTA_ID_DM_SEARCH 2 /* device manager search */
#define BTA_ID_DM_SEC 3 /* device manager security */
#define BTA_ID_DG 4 /* data gateway */
#define BTA_ID_AG 5 /* audio gateway */
#define BTA_ID_OPC 6 /* object push client */
#define BTA_ID_OPS 7 /* object push server */
#define BTA_ID_FTS 8 /* file transfer server */
#define BTA_ID_CT 9 /* cordless telephony terminal */
#define BTA_ID_FTC 10 /* file transfer client */
#define BTA_ID_SS 11 /* synchronization server */
#define BTA_ID_PR 12 /* Printer client */
#define BTA_ID_BIC 13 /* Basic Imaging Client */
#define BTA_ID_PAN 14 /* Personal Area Networking */
#define BTA_ID_BIS 15 /* Basic Imaging Server */
#define BTA_ID_ACC 16 /* Advanced Camera Client */
#define BTA_ID_SC 17 /* SIM Card Access server */
#define BTA_ID_AV 18 /* Advanced audio/video */
#define BTA_ID_AVK 19 /* Audio/video sink */
#define BTA_ID_HD 20 /* HID Device */
#define BTA_ID_CG 21 /* Cordless Gateway */
#define BTA_ID_BP 22 /* Basic Printing Client */
#define BTA_ID_HH 23 /* Human Interface Device Host */
#define BTA_ID_PBS 24 /* Phone Book Access Server */
#define BTA_ID_PBC 25 /* Phone Book Access Client */
#define BTA_ID_JV 26 /* Java */
#define BTA_ID_HS 27 /* Headset */
#define BTA_ID_MSE 28 /* Message Server Equipment */
#define BTA_ID_MCE 29 /* Message Client Equipment */
#define BTA_ID_HL 30 /* Health Device Profile*/
#define BTA_ID_GATTC 31 /* GATT Client */
#define BTA_ID_GATTS 32 /* GATT Client */
#define BTA_ID_SDP 33 /* SDP Client */
#define BTA_ID_BLUETOOTH_MAX 34 /* last BT profile */
/* GENERIC */
#define BTA_ID_PRM 38
#define BTA_ID_SYSTEM 39 /* platform-specific */
#define BTA_ID_SWRAP 40 /* Insight script wrapper */
#define BTA_ID_MIP 41 /* Multicase Individual Polling */
#define BTA_ID_RT 42 /* Audio Routing module: This module is always on. */
/* JV */
#define BTA_ID_JV1 44 /* JV1 */
#define BTA_ID_JV2 45 /* JV2 */
#define BTA_ID_MAX (44 + BTA_DM_NUM_JV_ID)
typedef UINT8 tBTA_SYS_ID;
#define BTA_SYS_CONN_OPEN 0x00
#define BTA_SYS_CONN_CLOSE 0x01
#define BTA_SYS_APP_OPEN 0x02
#define BTA_SYS_APP_CLOSE 0x03
#define BTA_SYS_SCO_OPEN 0x04
#define BTA_SYS_SCO_CLOSE 0x05
#define BTA_SYS_CONN_IDLE 0x06
#define BTA_SYS_CONN_BUSY 0x07
/* for link policy */
#define BTA_SYS_PLCY_SET 0x10 /* set the link policy to the given addr */
#define BTA_SYS_PLCY_CLR 0x11 /* clear the link policy to the given addr */
#define BTA_SYS_PLCY_DEF_SET 0x12 /* set the default link policy */
#define BTA_SYS_PLCY_DEF_CLR 0x13 /* clear the default link policy */
#define BTA_SYS_ROLE_CHANGE 0x14 /* role change */
typedef UINT8 tBTA_SYS_CONN_STATUS;
/* Bitmask of sys features */
#define BTA_SYS_FEAT_PCM2 0x0001
#define BTA_SYS_FEAT_PCM2_MASTER 0x0002
/* tBTA_PREF_ROLES */
typedef UINT8 tBTA_SYS_PREF_ROLES;
/* conn callback for role / low power manager*/
typedef void (tBTA_SYS_CONN_CBACK)(tBTA_SYS_CONN_STATUS status, UINT8 id, UINT8 app_id, BD_ADDR peer_addr);
/* conn callback for role / low power manager*/
typedef void (tBTA_SYS_SSR_CFG_CBACK)(UINT8 id, UINT8 app_id, UINT16 latency, UINT16 tout);
#if (BTA_EIR_CANNED_UUID_LIST != TRUE)
/* eir callback for adding/removeing UUID */
typedef void (tBTA_SYS_EIR_CBACK)(UINT16 uuid16, BOOLEAN adding);
#endif
/* registration structure */
typedef struct {
tBTA_SYS_EVT_HDLR *evt_hdlr;
tBTA_SYS_DISABLE *disable;
} tBTA_SYS_REG;
/* data type to send events to BTA SYS HW manager */
typedef struct {
BT_HDR hdr;
tBTA_SYS_HW_MODULE hw_module;
} tBTA_SYS_HW_MSG;
/*****************************************************************************
** Global data
*****************************************************************************/
/* trace level */
extern UINT8 appl_trace_level;
/*****************************************************************************
** Macros
*****************************************************************************/
/* Calculate start of event enumeration; id is top 8 bits of event */
#define BTA_SYS_EVT_START(id) ((id) << 8)
/*****************************************************************************
** events for BTA SYS HW manager
*****************************************************************************/
/* events sent to SYS HW manager - must be kept synchronized with tables in bta_sys_main.c */
enum {
/* device manager local device API events */
BTA_SYS_API_ENABLE_EVT = BTA_SYS_EVT_START(BTA_ID_SYS),
BTA_SYS_EVT_ENABLED_EVT,
BTA_SYS_EVT_STACK_ENABLED_EVT,
BTA_SYS_API_DISABLE_EVT,
BTA_SYS_EVT_DISABLED_EVT,
BTA_SYS_ERROR_EVT,
BTA_SYS_MAX_EVT
};
/* SYS HW status events - returned by SYS HW manager to other modules. */
enum {
BTA_SYS_HW_OFF_EVT,
BTA_SYS_HW_ON_EVT,
BTA_SYS_HW_STARTING_EVT,
BTA_SYS_HW_STOPPING_EVT,
BTA_SYS_HW_ERROR_EVT
};
typedef UINT8 tBTA_SYS_HW_EVT;
/* HW enable callback type */
typedef void (tBTA_SYS_HW_CBACK)(tBTA_SYS_HW_EVT status);
/*****************************************************************************
** Function declarations
*****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
extern void bta_sys_init(void);
extern void bta_sys_free(void);
extern void bta_sys_event(BT_HDR *p_msg);
extern void bta_sys_set_trace_level(UINT8 level);
extern void bta_sys_register(UINT8 id, const tBTA_SYS_REG *p_reg);
extern void bta_sys_deregister(UINT8 id);
extern BOOLEAN bta_sys_is_register(UINT8 id);
extern UINT16 bta_sys_get_sys_features(void);
extern void bta_sys_sendmsg(void *p_msg);
extern void bta_sys_start_timer(TIMER_LIST_ENT *p_tle, UINT16 type, INT32 timeout_ms);
extern void bta_sys_stop_timer(TIMER_LIST_ENT *p_tle);
extern void bta_sys_free_timer(TIMER_LIST_ENT *p_tle);
extern void bta_sys_disable(tBTA_SYS_HW_MODULE module);
extern UINT32 bta_sys_get_remaining_ticks(TIMER_LIST_ENT *p_target_tle);
extern void bta_sys_hw_register( tBTA_SYS_HW_MODULE module, tBTA_SYS_HW_CBACK *cback);
extern void bta_sys_hw_unregister( tBTA_SYS_HW_MODULE module );
extern void bta_sys_rm_register(tBTA_SYS_CONN_CBACK *p_cback);
extern void bta_sys_pm_register(tBTA_SYS_CONN_CBACK *p_cback);
extern void bta_sys_policy_register(tBTA_SYS_CONN_CBACK *p_cback);
extern void bta_sys_sco_register(tBTA_SYS_CONN_CBACK *p_cback);
extern void bta_sys_conn_open(UINT8 id, UINT8 app_id, BD_ADDR peer_addr);
extern void bta_sys_conn_close(UINT8 id, UINT8 app_id, BD_ADDR peer_addr);
extern void bta_sys_app_open(UINT8 id, UINT8 app_id, BD_ADDR peer_addr);
extern void bta_sys_app_close(UINT8 id, UINT8 app_id, BD_ADDR peer_addr);
extern void bta_sys_sco_open(UINT8 id, UINT8 app_id, BD_ADDR peer_addr);
extern void bta_sys_sco_close(UINT8 id, UINT8 app_id, BD_ADDR peer_addr);
extern void bta_sys_sco_use(UINT8 id, UINT8 app_id, BD_ADDR peer_addr);
extern void bta_sys_sco_unuse(UINT8 id, UINT8 app_id, BD_ADDR peer_addr);
extern void bta_sys_idle(UINT8 id, UINT8 app_id, BD_ADDR peer_addr);
extern void bta_sys_busy(UINT8 id, UINT8 app_id, BD_ADDR peer_addr);
#if (BTM_SSR_INCLUDED == TRUE)
extern void bta_sys_ssr_cfg_register(tBTA_SYS_SSR_CFG_CBACK *p_cback);
extern void bta_sys_chg_ssr_config (UINT8 id, UINT8 app_id, UINT16 max_latency, UINT16 min_tout);
#endif
extern void bta_sys_role_chg_register(tBTA_SYS_CONN_CBACK *p_cback);
extern void bta_sys_notify_role_chg(BD_ADDR_PTR p_bda, UINT8 new_role, UINT8 hci_status);
extern void bta_sys_collision_register(UINT8 bta_id, tBTA_SYS_CONN_CBACK *p_cback);
extern void bta_sys_notify_collision (BD_ADDR_PTR p_bda);
#if (BTA_EIR_CANNED_UUID_LIST != TRUE)
extern void bta_sys_eir_register(tBTA_SYS_EIR_CBACK *p_cback);
extern void bta_sys_add_uuid(UINT16 uuid16);
extern void bta_sys_remove_uuid(UINT16 uuid16);
#else
#define bta_sys_eir_register(ut)
#define bta_sys_add_uuid(ut)
#define bta_sys_remove_uuid(ut)
#endif
extern void bta_sys_set_policy (UINT8 id, UINT8 policy, BD_ADDR peer_addr);
extern void bta_sys_clear_policy (UINT8 id, UINT8 policy, BD_ADDR peer_addr);
extern void bta_sys_set_default_policy (UINT8 id, UINT8 policy);
extern void bta_sys_clear_default_policy (UINT8 id, UINT8 policy);
extern BOOLEAN bta_sys_vs_hdl(UINT16 evt, void *p);
#ifdef __cplusplus
}
#endif
#endif /* BTA_SYS_H */

View File

@ -0,0 +1,184 @@
/******************************************************************************
*
* Copyright (C) 2003-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.
*
******************************************************************************/
/******************************************************************************
*
* Basic utility functions.
*
******************************************************************************/
#ifndef UTL_H
#define UTL_H
#include "stack/bt_types.h"
// #include "bt_utils.h"
/*****************************************************************************
** Constants
*****************************************************************************/
/*** class of device settings ***/
#define BTA_UTL_SET_COD_MAJOR_MINOR 0x01
#define BTA_UTL_SET_COD_SERVICE_CLASS 0x02 /* only set the bits in the input */
#define BTA_UTL_CLR_COD_SERVICE_CLASS 0x04
#define BTA_UTL_SET_COD_ALL 0x08 /* take service class as the input (may clear some set bits!!) */
#define BTA_UTL_INIT_COD 0x0a
/*****************************************************************************
** Type Definitions
*****************************************************************************/
/** for utl_set_device_class() **/
typedef struct {
UINT8 minor;
UINT8 major;
UINT16 service;
} tBTA_UTL_COD;
#ifdef __cplusplus
extern "C"
{
#endif
/*****************************************************************************
** External Function Declarations
*****************************************************************************/
/*******************************************************************************
**
** Function utl_str2int
**
** Description This utility function converts a character string to an
** integer. Acceptable values in string are 0-9. If invalid
** string or string value too large, -1 is returned.
**
**
** Returns Integer value or -1 on error.
**
*******************************************************************************/
extern INT16 utl_str2int(const char *p_s);
/*******************************************************************************
**
** Function utl_strucmp
**
** Description This utility function compares two strings in uppercase.
** String p_s must be uppercase. String p_t is converted to
** uppercase if lowercase. If p_s ends first, the substring
** match is counted as a match.
**
**
** Returns 0 if strings match, nonzero otherwise.
**
*******************************************************************************/
extern int utl_strucmp(const char *p_s, const char *p_t);
/*******************************************************************************
**
** Function utl_itoa
**
** Description This utility function converts a UINT16 to a string. The
** string is NULL-terminated. The length of the string is
** returned.
**
**
** Returns Length of string.
**
*******************************************************************************/
extern UINT8 utl_itoa(UINT16 i, char *p_s);
/*******************************************************************************
**
** Function utl_freebuf
**
** Description This function calls osi_free to free the buffer passed
** in, if buffer pointer is not NULL, and also initializes
** buffer pointer to NULL.
**
**
** Returns Nothing.
**
*******************************************************************************/
extern void utl_freebuf(void **p);
/*******************************************************************************
**
** Function utl_set_device_class
**
** Description This function updates the local Device Class.
**
** Parameters:
** p_cod - Pointer to the device class to set to
**
** cmd - the fields of the device class to update.
** BTA_UTL_SET_COD_MAJOR_MINOR, - overwrite major, minor class
** BTA_UTL_SET_COD_SERVICE_CLASS - set the bits in the input
** BTA_UTL_CLR_COD_SERVICE_CLASS - clear the bits in the input
** BTA_UTL_SET_COD_ALL - overwrite major, minor, set the bits in service class
** BTA_UTL_INIT_COD - overwrite major, minor, and service class
**
** Returns TRUE if successful, Otherwise FALSE
**
*******************************************************************************/
extern BOOLEAN utl_set_device_class(tBTA_UTL_COD *p_cod, UINT8 cmd);
/*******************************************************************************
**
** Function utl_get_device_class
**
** Description This function get the local Device Class.
**
** Parameters:
** p_cod - Pointer to the device class to get to
**
**
** Returns TRUE if successful, Otherwise FALSE
**
*******************************************************************************/
extern BOOLEAN utl_get_device_class(tBTA_UTL_COD *p_cod);
/*******************************************************************************
**
** Function utl_isintstr
**
** Description This utility function checks if the given string is an
** integer string or not
**
**
** Returns TRUE if successful, Otherwise FALSE
**
*******************************************************************************/
extern BOOLEAN utl_isintstr(const char *p_s);
/*******************************************************************************
**
** Function utl_isdialstr
**
** Description This utility function checks if the given string contains
** only dial digits or not
**
**
** Returns TRUE if successful, Otherwise FALSE
**
*******************************************************************************/
extern BOOLEAN utl_isdialstr(const char *p_s);
#ifdef __cplusplus
}
#endif
#endif /* UTL_H */